Index: issm/oecreview/Archive/16554-17801/Date.tex
===================================================================
--- issm/oecreview/Archive/16554-17801/Date.tex	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/Date.tex	(revision 17802)
@@ -0,0 +1,1 @@
+Apr-22-2014
Index: issm/oecreview/Archive/16554-17801/ISSM-16554-16555.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16554-16555.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16554-16555.diff	(revision 17802)
@@ -0,0 +1,77 @@
+Index: ../trunk-jpl/examples/SquareIceShelf/runme.m
+===================================================================
+--- ../trunk-jpl/examples/SquareIceShelf/runme.m	(revision 16554)
++++ ../trunk-jpl/examples/SquareIceShelf/runme.m	(revision 16555)
+@@ -2,6 +2,6 @@
+ md=triangle(md,'DomainOutline.exp',100000);
+ md=setmask(md,'all','');
+ md=parameterize(md,'Square.par');
+-md=setflowequation(md,'macayeal','all');
++md=setflowequation(md,'SSA','all');
+ md.cluster=generic('name',oshostname,'np',2);
+-md=solve(md,DiagnosticSolutionEnum);
++md=solve(md,StressbalanceSolutionEnum);
+Index: ../trunk-jpl/examples/Jakobshavn/runme.m
+===================================================================
+--- ../trunk-jpl/examples/Jakobshavn/runme.m	(revision 16554)
++++ ../trunk-jpl/examples/Jakobshavn/runme.m	(revision 16555)
+@@ -41,7 +41,7 @@
+ 	disp('	Step 3: Control method friction');
+ 	md=loadmodel('JksPar.mdl');
+ 
+-	md=setflowequation(md,'macayeal','all');
++	md=setflowequation(md,'SSA','all');
+ 
+ 	%Control general
+ 	md.inversion.iscontrol=1;
+@@ -63,15 +63,13 @@
+ 	md.inversion.max_parameters=200*ones(md.mesh.numberofvertices,1);
+ 
+ 	%Additional parameters
+-	md.diagnostic.restol=0.01;
+-	md.diagnostic.reltol=0.1;
+-	md.diagnostic.abstol=NaN;
++	md.stressbalance.restol=0.01;
++	md.stressbalance.reltol=0.1;
++	md.stressbalance.abstol=NaN;
+ 
+ 	%Go solve
+ 	md.cluster=generic('name',oshostname,'np',4);
+-	md.solver=addoptions(md.solver,NoneAnalysisEnum,asmoptions);
+-	md.solver=addoptions(md.solver,DiagnosticVertAnalysisEnum,jacobiasmoptions);
+-	md=solve(md,DiagnosticSolutionEnum);
++	md=solve(md,StressbalanceSolutionEnum);
+ 	
+ 	save JksControl.mdl md
+ end 
+@@ -82,11 +80,11 @@
+ 	plotmodel(md,'unit#all','km','axis#all','equal',...
+ 		'FontSize#all',12,...
+ 		'data',md.inversion.vel_obs,'title','Observed velocity',...
+-		'data',md.results.DiagnosticSolution.Vel,'title','Modeled Velocity',...
++		'data',md.results.StressbalanceSolution.Vel,'title','Modeled Velocity',...
+ 		'colorbar#1','off','colorbar#2','on','colorbartitle#2','[m/yr]',...
+ 		'caxis#1-2',[0,7000],...
+ 		'data',md.geometry.bed,'title','Bed elevation',...
+-		'data',md.results.DiagnosticSolution.FrictionCoefficient,...
++		'data',md.results.StressbalanceSolution.FrictionCoefficient,...
+ 		'title','Friction Coefficient',...
+ 		'colorbar#3','on','colorbartitle#3','[m]','colorbar#4','on');
+ end
+Index: ../trunk-jpl/examples/Jakobshavn/Jks.par
+===================================================================
+--- ../trunk-jpl/examples/Jakobshavn/Jks.par	(revision 16554)
++++ ../trunk-jpl/examples/Jakobshavn/Jks.par	(revision 16555)
+@@ -56,5 +56,4 @@
+ 
+ disp('   Set other boundary conditions');
+ md=SetMarineIceSheetBC(md,'./Front.exp');
+-md.diagnostic.icefront(:,end)=1; %Apply water pressure at the ice front
+ md.basalforcings.melting_rate=zeros(md.mesh.numberofvertices,1);
+
+Property changes on: ../trunk-jpl
+___________________________________________________________________
+Name: svn:mergeinfo
+   - /issm/trunk:10936-10941,10943-11232,11236,11238-11993,11995,11997-12325,12332,12334-12335,12337,12339-12703,12709,12711-13392,13395,13397-13972,13975,13977-14065,14067,14069-14308,14310,14312-15394,15396,15398-16135,16137
+   + /issm/trunk:10936-10941,10943-11232,11236,11238-11993,11995,11997-12325,12332,12334-12335,12337,12339-12703,12709,12711-13392,13395,13397-13972,13975,13977-14065,14067,14069-14308,14310,14312-15394,15396,15398-16135,16137,16139-16554
+
Index: issm/oecreview/Archive/16554-17801/ISSM-16558-16559.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16558-16559.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16558-16559.diff	(revision 17802)
@@ -0,0 +1,27 @@
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 16558)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 16559)
+@@ -679,7 +679,9 @@
+ 			if ~isnan(md.initialization.vel),md.initialization.vel=project3d(md,'vector',md.initialization.vel,'type','node');end;
+ 			if ~isnan(md.initialization.temperature),md.initialization.temperature=project3d(md,'vector',md.initialization.temperature,'type','node');end;
+ 			if ~isnan(md.initialization.waterfraction),md.initialization.waterfraction=project3d(md,'vector',md.initialization.waterfraction,'type','node');end;
+-            if ~isnan(md.initialization.watercolumn),md.initialization.watercolumn=project3d(md,'vector',md.initialization.watercolumn,'type','node','layer',1);end;
++      if ~isnan(md.initialization.watercolumn),md.initialization.watercolumn=project3d(md,'vector',md.initialization.watercolumn,'type','node','layer',1);end;
++      if ~isnan(md.initialization.sediment_head),md.initialization.sediment_head=project3d(md,'vector',md.initialization.sediment_head,'type','node','layer',1);end;
++      if ~isnan(md.initialization.epl_head),md.initialization.epl_head=project3d(md,'vector',md.initialization.epl_head,'type','node','layer',1);end;
+ 
+ 			%bedinfo and surface info
+ 			md.mesh.elementonbed=project3d(md,'vector',ones(md.mesh.numberofelements2d,1),'type','element','layer',1);
+@@ -714,6 +716,11 @@
+ 			md.damage.spcdamage=project3d(md,'vector',md.damage.spcdamage,'type','node');
+ 			md.stressbalance.referential=project3d(md,'vector',md.stressbalance.referential,'type','node');
+ 			md.stressbalance.loadingforce=project3d(md,'vector',md.stressbalance.loadingforce,'type','node');
++			if isa(md.hydrology,'hydrologydc');
++				md.hydrology.spcsediment_head=project3d(md,'vector',md.hydrology.spcsediment_head,'type','node','layer',1);
++				md.hydrology.spcepl_head=project3d(md,'vector',md.hydrology.spcepl_head,'type','node','layer',1);
++				md.hydrology.mask_eplactive=project3d(md,'vector',md.hydrology.mask_eplactive,'type','node','layer',1);
++	    end
+ 
+ 			%connectivity
+ 			md.mesh.elementconnectivity=repmat(md.mesh.elementconnectivity,numlayers-1,1);
Index: issm/oecreview/Archive/16554-17801/ISSM-16565-16566.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16565-16566.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16565-16566.diff	(revision 17802)
@@ -0,0 +1,20 @@
+Index: ../trunk-jpl/test/Archives/Archive334.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/test/Archives/Archive334.nc
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+
+Index: ../trunk-jpl/test/Archives/Archive335.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/test/Archives/Archive335.nc
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+
Index: issm/oecreview/Archive/16554-17801/ISSM-16566-16567.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16566-16567.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16566-16567.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/configure.ac
+===================================================================
+--- ../trunk-jpl/configure.ac	(revision 16566)
++++ ../trunk-jpl/configure.ac	(revision 16567)
+@@ -1,7 +1,7 @@
+ # Process this file with autoconf to produce a configure script.
+ 
+ #AUTOCONF
+-AC_INIT([Ice Sheet System Model (ISSM)],[4.4],[issm@jpl.nasa.gov],[issm],[http://issm.jpl.nasa.gov]) #Initializing configure
++AC_INIT([Ice Sheet System Model (ISSM)],[4.5],[issm@jpl.nasa.gov],[issm],[http://issm.jpl.nasa.gov]) #Initializing configure
+ AC_CONFIG_AUX_DIR([./aux-config])         #Put config files in aux-config
+ AC_CONFIG_MACRO_DIR([m4])                 #m4 macros are located in m4
+ m4_include([m4/issm_options.m4])
Index: issm/oecreview/Archive/16554-17801/ISSM-16567-16568.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16567-16568.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16567-16568.diff	(revision 17802)
@@ -0,0 +1,312 @@
+
+Property changes on: ../trunk-jpl/src/wrappers/python/io
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/Scotch
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/NodeConnectivity
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/BamgConvertMesh
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/KMLOverlay
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/ContourToNodes
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/HoleFiller
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/EdgeDetection
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/MeshProfileIntersection
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/InterpFromMeshToMesh3d
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/Ll2xy
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/BamgMesher
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/InterpFromMeshToGrid
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/InterpFromGridToMesh
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/KMLFileRead
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/Shp2Kml
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/AverageFilter
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/TriMeshProcessRifts
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/Exp2Kml
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/Kml2Exp
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/PointCloudFindNeighbors
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/PropagateFlagsFromConnectivity
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/TriaSearch
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/InternalFront
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/MeshPartition
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/InterpFromMesh2d
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/ElementConnectivity
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/Kriging
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/EnumToString
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/StringToEnum
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/matlab/io
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/BamgTriangulate
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/InterpFromMeshToMesh2d
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/ContourToMesh
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/ExpSimplify
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/Xy2ll
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/KMLMeshWrite
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/TriMesh
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/Chaco
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
Index: issm/oecreview/Archive/16554-17801/ISSM-16568-16569.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16568-16569.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16568-16569.diff	(revision 17802)
@@ -0,0 +1,8 @@
+
+Property changes on: ../trunk-jpl/src/wrappers/ShpRead
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
Index: issm/oecreview/Archive/16554-17801/ISSM-16569-16570.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16569-16570.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16569-16570.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16569)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16570)
+@@ -165,6 +165,7 @@
+ 			nu_sed=ug_sed_main_iter->Norm(NORM_TWO);
+ 			delete ug_sed_main_iter;
+ 			if (xIsNan<IssmDouble>(ndu_sed) || xIsNan<IssmDouble>(nu_sed)) _error_("Sed convergence criterion is NaN!");
++			if (ndu_sed==0.0 && nu_sed==0.0) nu_sed=1.0e-6; /*Hacking the case where the Sediment is used but empty*/
+ 			if (!xIsNan<IssmDouble>(eps_hyd)){
+ 				if (!isefficientlayer){
+ 					if ((ndu_sed/nu_sed)<eps_hyd){
Index: issm/oecreview/Archive/16554-17801/ISSM-16570-16571.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16570-16571.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16570-16571.diff	(revision 17802)
@@ -0,0 +1,90 @@
+Index: ../trunk-jpl/src/m/contrib/paraview/exportVTK.m
+===================================================================
+--- ../trunk-jpl/src/m/contrib/paraview/exportVTK.m	(revision 16570)
++++ ../trunk-jpl/src/m/contrib/paraview/exportVTK.m	(revision 16571)
+@@ -41,18 +41,20 @@
+ %Getting all the solutions of the model
+ solnames=fields(res_struct);
+ num_of_sols=length(solnames);
++num_of_timesteps=1;
+ %building solution structure 
+ for i=1:num_of_sols
+ 	sol_struct{i}=res_struct.(solnames{i});
++	%looking for multiple time steps
++	if(size(sol_struct{i},2)>num_of_timesteps);
++		num_of_timesteps=size(sol_struct{i},2);
++  end
+ end
+ 
+-%looking for multiple time steps
+-num_of_timesteps=size(sol_struct{1},2);
+-
+ for step=1:num_of_timesteps;
+-	%by default, we take the timestep from the first solution sturcture
+-	timestep=sol_struct{1}(step).step;
+ 	
++	timestep=step;
++
+ 	FID = fopen(strcat(path,filesep,name,filesep,name,'.vtk',int2str(timestep),'.vtk'),'w+');
+ 	fprintf(FID,'# vtk DataFile Version 2.0 \n');
+ 	fprintf(FID,'Data for run %s \n',model.miscellaneous.name);
+@@ -83,22 +85,28 @@
+ 
+ 	%loop over the different solution structures
+ 	for j=1:num_of_sols
+-		
++		%dealing with results on different timesteps
++		if(size(sol_struct{j},2)>timestep);
++			timestep = step;
++		else
++			timestep = size(sol_struct{j},2);
++	  end
++
+ 		%getting the number of fields in the solution
+-		fieldnames=fields(sol_struct{j}(step));
++		fieldnames=fields(sol_struct{j}(timestep));
+ 		num_of_fields=length(fieldnames);
+ 		
+ 		%check which field is a real result and print
+ 			for k=1:num_of_fields
+-			if ((length(sol_struct{j}(step).(fieldnames{k})))== ...
++			if ((length(sol_struct{j}(timestep).(fieldnames{k})))== ...
+ 					num_of_points);
+ 				%paraview does not like NaN, replacing
+-				pos=find(isnan(sol_struct{j}(step).(fieldnames{k})));
+-				sol_struct{j}(step).(fieldnames{k})(pos)=-9999;
++				pos=find(isnan(sol_struct{j}(timestep).(fieldnames{k})));
++				sol_struct{j}(timestep).(fieldnames{k})(pos)=-9999;
+ 				fprintf(FID,'SCALARS %s float 1 \n',fieldnames{k});
+ 				fprintf(FID,'LOOKUP_TABLE default\n');
+ 				s='%e\n';
+-				fprintf(FID,s,sol_struct{j}(step).(fieldnames{k}));
++				fprintf(FID,s,sol_struct{j}(timestep).(fieldnames{k}));
+     	end		
+ 	  end 
+ 	end
+@@ -107,17 +115,17 @@
+ 	%it now
+ 	for j= 1:nargin-2
+ 		res_struct=model.(varargin{j});
+-		solnames=fields(res_struct);
+-		num_of_sols=length(solnames);
++		fieldnames=fields(res_struct);
++		num_of_fields=length(fieldnames);
+ 		for k=1:num_of_sols
+-			if ((length(res_struct.(solnames{k})))==num_of_points);
++			if ((length(res_struct.(fieldnames{k})))==num_of_points);
+ 				%paraview does not like NaN, replacing
+-				pos=find(isnan(res_struct.(solnames{k})));
+-				res_struct.(solnames{k})(pos)=-9999;
+-				fprintf(FID,'SCALARS %s float 1 \n',solnames{k});
++				pos=find(isnan(res_struct.(fieldnames{k})));
++				res_struct.(fieldnames{k})(pos)=-9999;
++				fprintf(FID,'SCALARS %s float 1 \n',fieldnames{k});
+ 				fprintf(FID,'LOOKUP_TABLE default\n');
+ 				s='%e\n';
+-				fprintf(FID,s,res_struct.(solnames{k}));
++				fprintf(FID,s,res_struct.(fieldnames{k}));
+ 	    end		
+ 		end 
+ 	end
Index: issm/oecreview/Archive/16554-17801/ISSM-16571-16572.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16571-16572.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16571-16572.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/m/Makefile.am	(revision 16571)
++++ ../trunk-jpl/src/m/Makefile.am	(revision 16572)
+@@ -12,6 +12,8 @@
+ 					./qmu/examples/*.m \
+ 					./kml/*.m \
+ 					./enum/*.m \
++					./dev/issmversion.m \
++					./dev/issmversion.py \
+ 					./classes/*.m \
+ 					./classes/qmu/*.m \
+ 					./classes/qmu/@dakota_method/*.m \
Index: issm/oecreview/Archive/16554-17801/ISSM-16572-16573.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16572-16573.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16572-16573.diff	(revision 17802)
@@ -0,0 +1,20 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16572)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16573)
+@@ -2803,6 +2803,7 @@
+ 		input->GetInputValue(&value,gauss);
+ 		this->nodes[indices[i]]->ApplyConstraint(1,value);
+ 	}
++	delete gauss;
+ 
+ }
+ /*}}}*/
+@@ -2825,6 +2826,7 @@
+ 		input->GetInputValue(&value,gauss);
+ 		this->nodes[indices[i]]->ApplyConstraint(1,value);
+ 	}
++	delete gauss;
+ 
+ }
+ /*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16573-16574.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16573-16574.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16573-16574.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 16573)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 16574)
+@@ -27,7 +27,7 @@
+ }/*}}}*/
+ void ExtrudeFromTopAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+-	::CreateNodes(nodes,iomodel,ExtrudeFromBaseAnalysisEnum,P1Enum);
++	::CreateNodes(nodes,iomodel,ExtrudeFromTopAnalysisEnum,P1Enum);
+ 
+ }/*}}}*/
+ void ExtrudeFromTopAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16574-16575.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16574-16575.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16574-16575.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/m4/issm_options.m4
+===================================================================
+--- ../trunk-jpl/m4/issm_options.m4	(revision 16574)
++++ ../trunk-jpl/m4/issm_options.m4	(revision 16575)
+@@ -14,7 +14,7 @@
+ 	if test "$DATE" ; then
+ 		PACKAGE_DATE=`date`
+ 	else
+-		PACKAGE_DATE="unknown date"
++		PACKAGE_DATE="unknown"
+ 	fi
+ 	AC_DEFINE_UNQUOTED(PACKAGE_BUILD_DATE,"$PACKAGE_DATE", Build date)
+ 	AC_MSG_RESULT($PACKAGE_DATE)
Index: issm/oecreview/Archive/16554-17801/ISSM-16575-16576.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16575-16576.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16575-16576.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/classes/inversion.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/inversion.m	(revision 16575)
++++ ../trunk-jpl/src/m/classes/inversion.m	(revision 16576)
+@@ -40,7 +40,7 @@
+ 						obj.control_parameters          = in.control_parameters;
+ 						obj.nsteps                      = in.nsteps;
+ 						obj.maxiter_per_step            = 10*ones(in.nsteps,1);
+-						obj.cost_functions              = repmat(in.cost_functions,in.nsteps,1);
++						obj.cost_functions              = in.cost_functions;
+ 						obj.cost_functions_coefficients = in.cost_functions_coefficients;
+ 						obj.gradient_scaling            = 100*ones(in.nsteps,1);
+ 						obj.cost_function_threshold     = NaN;
Index: issm/oecreview/Archive/16554-17801/ISSM-16576-16577.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16576-16577.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16576-16577.diff	(revision 17802)
@@ -0,0 +1,24 @@
+Index: ../trunk-jpl/src/m/classes/model.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.py	(revision 16576)
++++ ../trunk-jpl/src/m/classes/model.py	(revision 16577)
+@@ -571,6 +571,7 @@
+ 		md.inversion.vx_obs=project3d(md,'vector',md.inversion.vx_obs,'type','node')
+ 		md.inversion.vy_obs=project3d(md,'vector',md.inversion.vy_obs,'type','node')
+ 		md.inversion.vel_obs=project3d(md,'vector',md.inversion.vel_obs,'type','node')
++		md.inversion.thickness_obs=project3d(md,'vector',md.inversion.thickness_obs,'type','node')
+ 		md.surfaceforcings.mass_balance=project3d(md,'vector',md.surfaceforcings.mass_balance,'type','node')
+ 		md.surfaceforcings.precipitation=project3d(md,'vector',md.surfaceforcings.precipitation,'type','node')
+ 		md.balancethickness.thickening_rate=project3d(md,'vector',md.balancethickness.thickening_rate,'type','node')
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 16576)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 16577)
+@@ -667,6 +667,7 @@
+ 			md.inversion.vx_obs=project3d(md,'vector',md.inversion.vx_obs,'type','node');
+ 			md.inversion.vy_obs=project3d(md,'vector',md.inversion.vy_obs,'type','node');
+ 			md.inversion.vel_obs=project3d(md,'vector',md.inversion.vel_obs,'type','node');
++			md.inversion.thickness_obs=project3d(md,'vector',md.inversion.thickness_obs,'type','node');
+ 			md.surfaceforcings.mass_balance=project3d(md,'vector',md.surfaceforcings.mass_balance,'type','node');
+ 			md.surfaceforcings.precipitation=project3d(md,'vector',md.surfaceforcings.precipitation,'type','node');
+ 			md.balancethickness.thickening_rate=project3d(md,'vector',md.balancethickness.thickening_rate,'type','node');
Index: issm/oecreview/Archive/16554-17801/ISSM-16577-16578.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16577-16578.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16577-16578.diff	(revision 17802)
@@ -0,0 +1,15 @@
+Index: ../trunk-jpl/m4/issm_options.m4
+===================================================================
+--- ../trunk-jpl/m4/issm_options.m4	(revision 16577)
++++ ../trunk-jpl/m4/issm_options.m4	(revision 16578)
+@@ -120,8 +120,8 @@
+ 		elif test $VENDOR = intel-pleiades-gcc; then
+ 			export CC=gcc
+ 			export CXX=g++
+-			export CXXFLAGS=" -g -O2 "
+-			export CFLAGS=" -g -O2 "
++			export CXXFLAGS="-O3 -march=corei7-avx"
++			export CFLAGS="-O3 -march=corei7-avx"
+         else
+ 		AC_MSG_ERROR([unknown compiler vendor!])
+ 		fi
Index: issm/oecreview/Archive/16554-17801/ISSM-16578-16579.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16578-16579.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16578-16579.diff	(revision 17802)
@@ -0,0 +1,29 @@
+Index: ../trunk-jpl/configs/config-linux64-pleiades-ampi-gcc.sh
+===================================================================
+--- ../trunk-jpl/configs/config-linux64-pleiades-ampi-gcc.sh	(revision 16578)
++++ ../trunk-jpl/configs/config-linux64-pleiades-ampi-gcc.sh	(revision 16579)
+@@ -4,16 +4,19 @@
+ 	--without-kriging \
+ 	--with-wrappers=no \
+ 	--with-triangle-dir="$ISSM_DIR/externalpackages/triangle/install" \
+-	--with-mpi-include="/nasa/mvapich2/1.6.sles11/gcc/include" \
+-	--with-mpi-libflags="-L/nasa/mvapich2/1.6.sles11/gcc/lib -llmpe -lmpe -lmpich" \
++	--with-mpi-include=$ISSM_DIR/externalpackages/mpich/install/include  \
++	--with-mpi-libflags="-L$ISSM_DIR/externalpackages/mpich/install/lib/ -lmpich -lmpl " \
+ 	--with-adolc-dir="$ISSM_DIR/externalpackages/adolc/install"\
+ 	--with-ampi-dir="$ISSM_DIR/externalpackages/adjoinablempi/install"\
++	--with-metis-dir="$ISSM_DIR/externalpackages/petsc/install" \
+ 	--with-blas-lapack-dir="$ISSM_DIR/externalpackages/petsc/install" \
+ 	--with-gsl-dir="$ISSM_DIR/externalpackages/gsl/install" \
+-	--with-metis-dir="$ISSM_DIR/externalpackages/petsc/install" \
+ 	--with-mumps-dir="$ISSM_DIR/externalpackages/petsc/install" \
+ 	--with-scalapack-dir="$ISSM_DIR/externalpackages/petsc/install" \
+ 	--with-hypre-dir="$ISSM_DIR/externalpackages/petsc/install" \
+ 	--with-graphics-lib="/usr/lib64/libX11.so" \
+-	--with-cxxoptflags="-g -O2" \
+-	--with-vendor="intel-pleiades-gcc"
++	--with-cxxoptflags=" -O3 -march=corei7-avx" \
++	--with-vendor="intel-pleiades-gcc"  \
++	CFLAGS="-O3 -march=corei7-avx" \
++	CXXFLAGS="-O3 -march=corei7-avx" \
++	FFLAGS="-O3 -march=corei7-avx" 
Index: issm/oecreview/Archive/16554-17801/ISSM-16579-16580.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16579-16580.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16579-16580.diff	(revision 17802)
@@ -0,0 +1,38 @@
+Index: ../trunk-jpl/externalpackages/adjoinablempi/install-pleaides-gcc.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/adjoinablempi/install-pleaides-gcc.sh	(revision 0)
++++ ../trunk-jpl/externalpackages/adjoinablempi/install-pleaides-gcc.sh	(revision 16580)
+@@ -0,0 +1,27 @@
++#!/bin/bash
++set -eu
++
++#Some cleanup
++rm -rf src  install
++
++#Mercurial cloning: 
++hg clone http://mercurial.mcs.anl.gov//ad/AdjoinableMPI src
++
++#Configure adjoinablempi
++cd src
++autoreconf -fi
++
++./configure \
++	--prefix="$ISSM_DIR/externalpackages/adjoinablempi/install" \
++	--libdir="$ISSM_DIR/externalpackages/adjoinablempi/install/lib" \
++	--with-mpi-root="$ISSM_DIR/externalpackages/mpich/instqall" \
++	--enable-requestOnTrace CFLAGS="-g -O0"
++
++#Compile adjoinablempi 
++make clean
++if [ $# -eq 0 ]; then
++	make 
++else
++	make -j $1
++fi
++make install
+
+Property changes on: ../trunk-jpl/externalpackages/adjoinablempi/install-pleaides-gcc.sh
+___________________________________________________________________
+Name: svn:executable
+   + *
+
Index: issm/oecreview/Archive/16554-17801/ISSM-16580-16581.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16580-16581.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16580-16581.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/etc/environment.csh
+===================================================================
+--- ../trunk-jpl/etc/environment.csh	(revision 16580)
++++ ../trunk-jpl/etc/environment.csh	(revision 16581)
+@@ -12,7 +12,7 @@
+ endif
+ 
+ #MPI
+-set MPI_DIR="$ISSM_DIR/externalpackages/mpich2/install"
++set MPI_DIR="$ISSM_DIR/externalpackages/mpich/install"
+ if (-d $MPI_DIR) then
+ 	setenv MPI_DIR {$MPI_DIR}
+ 	setenv PATH {$MPI_DIR}/bin:{$PATH}
Index: issm/oecreview/Archive/16554-17801/ISSM-16581-16582.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16581-16582.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16581-16582.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/externalpackages/mpich/install-2_1.5-linux64.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/mpich/install-2_1.5-linux64.sh	(revision 16581)
++++ ../trunk-jpl/externalpackages/mpich/install-2_1.5-linux64.sh	(revision 16582)
+@@ -21,7 +21,7 @@
+ 	--prefix="$ISSM_DIR/externalpackages/mpich/install" \
+ 	--enable-shared \
+ 	--enable-sharedlibs=gcc \
+-	--enable-f91=gfortran 
++	--enable-f91=gfortran  CC=gcc FC=gfortran
+ 
+ #Compile mpich2 (this new version supports parallel make)
+ if [ $# -eq 0 ]; then
Index: issm/oecreview/Archive/16554-17801/ISSM-16582-16583.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16582-16583.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16582-16583.diff	(revision 17802)
@@ -0,0 +1,79 @@
+Index: ../trunk-jpl/externalpackages/petsc/install-3.4-pleiades-mpich2.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/petsc/install-3.4-pleiades-mpich2.sh	(revision 0)
++++ ../trunk-jpl/externalpackages/petsc/install-3.4-pleiades-mpich2.sh	(revision 16583)
+@@ -0,0 +1,68 @@
++#!/bin/bash
++
++#Some cleanup
++rm -rf install petsc-3.4.2 src
++mkdir install src
++
++export cc=gcc
++alias cc='gcc'
++
++#Download from ISSM server
++$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/petsc-lite-3.4.2.tar.gz' 'petsc-3.4.2.tar.gz'
++
++#Untar and move petsc to install directory
++tar -zxvf  petsc-3.4.2.tar.gz
++mv petsc-3.4.2/* src/
++rm -rf petsc-3.4.2
++
++#configure
++cd src
++./config/configure.py \
++ --prefix="$ISSM_DIR/externalpackages/petsc/install" \
++ --PETSC_ARCH="$ISSM_ARCH" \
++ --PETSC_DIR="$ISSM_DIR/externalpackages/petsc/src" \
++ --with-batch=1  \
++ --with-debugging=0 \
++ --with-shared-libraries=1 \
++ --with-mpi=1 \
++ --with-mpi-lib="$ISSM_DIR/externalpackages/mpich/install/lib/libmpich.so"\
++ --with-mpi-include="$ISSM_DIR/externalpackages/mpich/install/include" \
++  --known-mpi-shared-libraries=1 \
++  --download-f-blas-lapack=yes \
++ --download-scalapack=yes \
++ --download-metis=yes \
++ --download-parmetis=yes \
++ --download-blacs=yes \
++ --download-mumps=yes \
++  --download-trilinos=yes \
++ --download-euclid=yes \
++ --download-hypre=yes  \
++ --COPTFLAGS=" -O3 -march=corei7-avx" \
++ --FOPTFLAGS=" -O3 -march=corei7-avx" \
++ --CXXOPTFLAGS=" -O3 -march=corei7-avx" 
++
++#--with-mpi-lib="/nasa/mvapich2/1.4.1/gcc.sles11/lib/libmpich.a" \
++# --with-mpi-include="/nasa/mvapich2/1.4.1/gcc.sles11/include" \
++
++
++#prepare script to reconfigure petsc
++cat > script.queue << EOF
++#PBS -S /bin/bash
++#PBS -l select=1:ncpus=1:model=wes 
++#PBS -l walltime=200 
++#PBS -W group_list=s1010
++#PBS -m e 
++
++. /usr/share/modules/init/bash 
++module load mpi-mvapich2/1.6/gcc
++module load gcc/4.7.0
++
++export PATH="$PATH:." 
++export MPI_GROUP_MAX=64 
++mpiexec -np 1 ./conftest-linux-gnu-ia64-intel.py
++EOF
++
++#print instructions
++echo "== Now: cd src/ "
++echo "== qsub -q devel script.queue "
++echo "== Then run reconfigure script generated by PETSc and follow instructions"
+
+Property changes on: ../trunk-jpl/externalpackages/petsc/install-3.4-pleiades-mpich2.sh
+___________________________________________________________________
+Name: svn:executable
+   + *
+
Index: issm/oecreview/Archive/16554-17801/ISSM-16583-16584.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16583-16584.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16583-16584.diff	(revision 17802)
@@ -0,0 +1,57 @@
+Index: ../trunk-jpl/externalpackages/modules/install-macosx64.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/modules/install-macosx64.sh	(revision 16583)
++++ ../trunk-jpl/externalpackages/modules/install-macosx64.sh	(revision 16584)
+@@ -3,37 +3,37 @@
+ 
+ #Some cleanup
+ rm -rf install
+-rm -rf modules-3.2.9
++rm -rf modules-3.2.10
+ mkdir install
+ 
+ #Download from ISSM server
+-$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/modules-3.2.9.tar.gz' 'modules-3.2.9.tar.gz'
++$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/modules-3.2.10.tar.gz' 'modules-3.2.10.tar.gz'
+ 
+ #Untar 
+-tar -zxvf  modules-3.2.9.tar.gz
++tar -zxvf  modules-3.2.10.tar.gz
+ 
+ #Move modules into src directory
+ 
+ #Configure modules
+-cd modules-3.2.9
+-./configure \
+-	--prefix=$ISSM_DIR/externalpackages/modules/install\
+-	--with-module-path=$ISSM_DIR/externalpackages/modules/install/modules/files\
+-	--with-version-path=$ISSM_DIR/externalpackages/modules/install/modules/versions\
++cd modules-3.2.10
++sudo ./configure \
++	--prefix=/usr/local/modules \
+ 	--with-tcl-lib=$ISSM_DIR/externalpackages/tcl/install/Library/Frameworks/Tcl.framework/Versions/8.5\
+ 	--with-tcl-inc=$ISSM_DIR/externalpackages/tcl/install/Library/Frameworks/Tcl.framework/Versions/8.5/Headers\
+-	--with-tcl-ver=8.5\
++	--with-tcl-ver=8.5 \
+ 	--with-tclx-lib=$ISSM_DIR/externalpackages/tclx/install/lib/tclx8.4\
+     --with-tclx-inc=$ISSM_DIR/externalpackages/tclx/install/include\
+-	--with-tclx-ver=8.4\
+-	--with-etc-path=$ISSM_DIR/externalpackages/modules/install/modules/etc\
+-	--with-skel-path=$ISSM_DIR/externalpackages/modules/install/modules/etc/skel\
++	--with-tclx-ver=8.4 \
++	--with-version-path=/usr/local/modules/versions \
++	--with-skel-path=/usr/local/modules/etc/skel \
++	--with-etc-path=/usr/local/modules/etc \
++	--with-module-path=/usr/local/modules/files \
+ 	--disable-dependency-tracking
+ 
+ #Compile and install modules
+ if [ $# -eq 0 ]; then
+-	make
++	sudo make
+ else
+-	make -j $1
++	sudo make -j $1
+ fi
+-make install
++sudo make install
Index: issm/oecreview/Archive/16554-17801/ISSM-16584-16585.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16584-16585.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16584-16585.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/externalpackages/adjoinablempi/install-pleaides-gcc.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/adjoinablempi/install-pleaides-gcc.sh	(revision 16584)
++++ ../trunk-jpl/externalpackages/adjoinablempi/install-pleaides-gcc.sh	(revision 16585)
+@@ -14,7 +14,7 @@
+ ./configure \
+ 	--prefix="$ISSM_DIR/externalpackages/adjoinablempi/install" \
+ 	--libdir="$ISSM_DIR/externalpackages/adjoinablempi/install/lib" \
+-	--with-mpi-root="$ISSM_DIR/externalpackages/mpich/instqall" \
++	--with-mpi-root="$ISSM_DIR/externalpackages/mpich/install" \
+ 	--enable-requestOnTrace CFLAGS="-g -O0"
+ 
+ #Compile adjoinablempi 
+Index: ../trunk-jpl/externalpackages/adolc/install-withampi-pleiades-gcc.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/adolc/install-withampi-pleiades-gcc.sh	(revision 16584)
++++ ../trunk-jpl/externalpackages/adolc/install-withampi-pleiades-gcc.sh	(revision 16585)
+@@ -13,7 +13,7 @@
+ 
+ ./configure --prefix=$ISSM_DIR/externalpackages/adolc/install  \
+ 	--libdir=$ISSM_DIR/externalpackages/adolc/install/lib \
+-	--with-mpi-root="/nasa/mvapich2/1.6.sles11/gcc" \
++	--with-mpi-root=$ISSM_DIR/externalpackages/mpich/install \
+ 	--enable-ampi \
+ 	--with-ampi=$ISSM_DIR/externalpackages/adjoinablempi/install \
+ 	--disable-tapedoc-values
Index: issm/oecreview/Archive/16554-17801/ISSM-16585-16586.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16585-16586.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16585-16586.diff	(revision 17802)
@@ -0,0 +1,101 @@
+Index: ../trunk-jpl/externalpackages/petsc/install-3.4-pleiades-intel2012.0.032-mpt.2.06rp16
+===================================================================
+--- ../trunk-jpl/externalpackages/petsc/install-3.4-pleiades-intel2012.0.032-mpt.2.06rp16	(revision 0)
++++ ../trunk-jpl/externalpackages/petsc/install-3.4-pleiades-intel2012.0.032-mpt.2.06rp16	(revision 16586)
+@@ -0,0 +1,61 @@
++#!/bin/bash
++
++#Some cleanup
++rm -rf install petsc-3.4.2 src
++mkdir install src
++
++#Download from ISSM server
++$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/petsc-lite-3.4.2.tar.gz' 'petsc-3.4.2.tar.gz'
++
++#Untar and move petsc to install directory
++tar -zxvf  petsc-3.4.2.tar.gz
++mv petsc-3.4.2/* src/
++rm -rf petsc-3.4.2
++
++#configure
++cd src
++./config/configure.py \
++ --prefix="$ISSM_DIR/externalpackages/petsc/install" \
++ --PETSC_ARCH="$ISSM_ARCH" \
++ --PETSC_DIR="$ISSM_DIR/externalpackages/petsc/src" \
++ --with-batch=1  \
++ --with-debugging=0 \
++ --with-shared-libraries=1 \
++ --known-mpi-shared-libraries=1 \
++ --with-mpi=1 \
++ --with-mpi-lib="/nasa/sgi/mpt/2.06rp16/lib/libmpi.so" \
++ --with-mpi-include="/nasa/sgi/mpt/2.06rp16/include" \
++ --with-blas-lapack-dir="/nasa/intel/Compiler/2012.0.032/composer_xe_2011_sp1/mkl/lib/intel64" \
++ --download-scalapack=yes \
++ --download-blacs=yes \
++ --download-mumps=yes \
++ --download-metis=yes \
++ --download-parmetis=yes \
++ --download-trilinos=yes \
++ --download-euclid=yes \
++ --download-hypre=yes \
++ --COPTFLAGS="-lmpi -O3" \
++ --FOPTFLAGS="-lmpi -O3" \
++ --CXXOPTFLAGS="-lmpi -O3"
++
++#prepare script to reconfigure petsc
++cat > script.queue << EOF
++#PBS -S /bin/bash
++#PBS -l select=1:ncpus=1:model=wes 
++#PBS -l walltime=200 
++#PBS -W group_list=s1010
++#PBS -m e 
++
++. /usr/share/modules/init/bash 
++module load comp-intel/2012.0.032
++module load mpi-sgi/mpt.2.06rp16
++
++export PATH="$PATH:." 
++export MPI_GROUP_MAX=64 
++mpiexec -np 1 ./conftest-linux-gnu-ia64-intel.py
++EOF
++
++#print instructions
++echo "== Now: cd src/ "
++echo "== qsub -q devel script.queue "
++echo "== Then run reconfigure script generated by PETSc and follow instructions"
+
+Property changes on: ../trunk-jpl/externalpackages/petsc/install-3.4-pleiades-intel2012.0.032-mpt.2.06rp16
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/configs/config-linux64-pleiades-intel2012.0.032-mpt.2.06rp16.sh
+===================================================================
+--- ../trunk-jpl/configs/config-linux64-pleiades-intel2012.0.032-mpt.2.06rp16.sh	(revision 0)
++++ ../trunk-jpl/configs/config-linux64-pleiades-intel2012.0.032-mpt.2.06rp16.sh	(revision 16586)
+@@ -0,0 +1,18 @@
++#!/bin/csh
++./configure \
++	--prefix=$ISSM_DIR \
++	--without-kriging \
++	--with-matlab-dir="$ISSM_DIR/externalpackages/matlab/install" \
++	--with-petsc-dir="$ISSM_DIR/externalpackages/petsc/install" \
++	--with-petsc-arch=$ISSM_ARCH \
++	--with-triangle-dir="$ISSM_DIR/externalpackages/triangle/install" \
++	--with-mpi-include="/nasa/sgi/mpt/2.06rp16/include" \
++	--with-mpi-libflags="-L/nasa/sgi/mpt/2.06rp16/ -lmpi" \
++	--with-mkl-dir="/nasa/intel/Compiler/2012.0.032/composer_xe_2011_sp1/mkl/lib/intel64"\
++	--with-metis-dir="$ISSM_DIR/externalpackages/petsc/install" \
++	--with-mumps-dir="$ISSM_DIR/externalpackages/petsc/install" \
++	--with-scalapack-dir="$ISSM_DIR/externalpackages/petsc/install" \
++	--with-hypre-dir="$ISSM_DIR/externalpackages/petsc/install" \
++	--with-graphics-lib="/usr/lib64/libX11.so" \
++	--with-cxxoptflags="-g -O2" \
++	--with-vendor="intel-pleiades"
+
+Property changes on: ../trunk-jpl/configs/config-linux64-pleiades-intel2012.0.032-mpt.2.06rp16.sh
+___________________________________________________________________
+Name: svn:executable
+   + *
+
Index: issm/oecreview/Archive/16554-17801/ISSM-16586-16587.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16586-16587.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16586-16587.diff	(revision 17802)
@@ -0,0 +1,17 @@
+Index: ../trunk-jpl/src/m/classes/clusters/discover.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/clusters/discover.m	(revision 16586)
++++ ../trunk-jpl/src/m/classes/clusters/discover.m	(revision 16587)
+@@ -95,10 +95,10 @@
+ 
+ 			 %write queuing script 
+ 			 fid=fopen([modelname '.queue'],'w');
+-			 fprintf(fid,'#PBS -S /bin/bash\n');
++			 fprintf(fid,'#!/bin/bash\n');
+ %			 fprintf(fid,'#PBS -N %s\n',modelname);
+ 			 fprintf(fid,'#PBS -l select=%i:ncpus=%i:proc=%s\n',cluster.numnodes,cluster.cpuspernode,cluster.processor);
+-			 fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds.
++			 fprintf(fid,'#PBS -l walltime=%i:00\n',cluster.time); %SLURM walltime is in minutes:
+ 			 fprintf(fid,'#PBS -q %s \n',cluster.queue);
+ 			 fprintf(fid,'#PBS -W group_list=s1010\n');
+ 			 fprintf(fid,'#PBS -m e\n');
Index: issm/oecreview/Archive/16554-17801/ISSM-16587-16588.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16587-16588.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16587-16588.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/classes/clusters/discover.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/clusters/discover.m	(revision 16587)
++++ ../trunk-jpl/src/m/classes/clusters/discover.m	(revision 16588)
+@@ -97,7 +97,7 @@
+ 			 fid=fopen([modelname '.queue'],'w');
+ 			 fprintf(fid,'#!/bin/bash\n');
+ %			 fprintf(fid,'#PBS -N %s\n',modelname);
+-			 fprintf(fid,'#PBS -l select=%i:ncpus=%i:proc=%s\n',cluster.numnodes,cluster.cpuspernode,cluster.processor);
++			 fprintf(fid,'#PBS -l select=%i:mpiprocs=%i:proc=%s\n',cluster.numnodes,cluster.cpuspernode,cluster.processor);
+ 			 fprintf(fid,'#PBS -l walltime=%i:00\n',cluster.time); %SLURM walltime is in minutes:
+ 			 fprintf(fid,'#PBS -q %s \n',cluster.queue);
+ 			 fprintf(fid,'#PBS -W group_list=s1010\n');
Index: issm/oecreview/Archive/16554-17801/ISSM-16588-16589.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16588-16589.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16588-16589.diff	(revision 17802)
@@ -0,0 +1,207 @@
+Index: ../trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h	(revision 16588)
++++ ../trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h	(revision 16589)
+@@ -382,6 +382,7 @@
+ template <> inline Object* GenericExternalResult<Vector<IssmPDouble>*>::copy(void){ /*{{{*/
+ 	return new GenericExternalResult<Vector<IssmPDouble>*>(this->id,StringToEnumx(this->result_name),this->value,this->step,this->time);
+ } /*}}}*/
++#if defined(_HAVE_ADOLC_) && !defined(_WRAPPERS_)  //We hook off this specific specialization when not running ADOLC, otherwise we get a redeclaration with the next specialization. 
+ template <> inline void GenericExternalResult<Vector<IssmPDouble>*>::WriteData(FILE* fid,bool io_gather){ /*{{{*/
+ 
+ 	char *name   = NULL;
+@@ -419,9 +420,56 @@
+ 
+ }
+ /*}}}*/
++#endif
+ template <> inline int GenericExternalResult<Vector<IssmPDouble>*>::ObjectEnum(void){ /*{{{*/
+ 	return NoneEnum;
+ 	/*???? FIXME*/
+ } /*}}}*/
+ 
++/*Specifics instantiations for Vector<IssmDouble>*/
++template <> inline void GenericExternalResult<Vector<IssmDouble>*>::WriteData(FILE* fid,bool io_gather){ /*{{{*/
++
++	int i;
++	char *name   = NULL;
++	int   length,rows,cols=1;
++	IssmDouble*  serialvalues = NULL;
++	IssmPDouble* pserialvalues = NULL;
++
++	if(!io_gather){
++		_error_("not supported yet");
++	}
++
++	/*Serialize vector*/
++	serialvalues = this->value->ToMPISerial();
++	this->value->GetSize(&rows);
++	
++	pserialvalues=xNew<IssmPDouble>(rows);
++	for(i=0;i<rows;i++)pserialvalues[i]=reCast<IssmPDouble>(serialvalues[i]);
++
++	if(IssmComm::GetRank()==0){
++		/*First write name: */
++		length=(strlen(this->result_name)+1)*sizeof(char);
++		fwrite(&length,sizeof(int),1,fid);
++		fwrite(this->result_name,length,1,fid);
++
++		/*Now write time and step: */
++		IssmPDouble passiveDouble=reCast<IssmPDouble>(time);
++		fwrite(&passiveDouble,sizeof(IssmPDouble),1,fid);
++		fwrite(&step,sizeof(int),1,fid);
++
++		/*writing a IssmDouble array, type is 3:*/
++		int type=3;
++		fwrite(&type,sizeof(int),1,fid);
++		fwrite(&rows,sizeof(int),1,fid);
++		fwrite(&cols,sizeof(int),1,fid);
++		fwrite(pserialvalues,cols*rows*sizeof(IssmPDouble),1,fid);
++	}
++
++	/*Clean up*/
++	xDelete<IssmPDouble>(pserialvalues);
++	xDelete<IssmDouble>(serialvalues);
++
++}
++/*}}}*/
++
+ #endif  /* _EXTERNAL_RESULTOBJECT_H */
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 16588)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 16589)
+@@ -561,7 +561,7 @@
+ 						default:     _error_("Interpolation "<<EnumToStringx(interpolation)<<" not supported yet");
+ 
+ 					}
+-					Vector<IssmPDouble> *vector_result = new Vector<IssmPDouble>(this->vertices->NumberOfVertices());
++					Vector<IssmDouble> *vector_result = new Vector<IssmDouble>(this->vertices->NumberOfVertices());
+ 
+ 					/*Fill in vector*/
+ 					for(int j=0;j<elements->Size();j++){
+@@ -570,7 +570,7 @@
+ 					}
+ 					vector_result->Assemble();
+ 
+-					results->AddResult(new GenericExternalResult<Vector<IssmPDouble>*>(results->Size()+1,output_enum,vector_result,step,time));
++					results->AddResult(new GenericExternalResult<Vector<IssmDouble>*>(results->Size()+1,output_enum,vector_result,step,time));
+ 					isvec = true;
+ 					break;
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16588)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16589)
+@@ -59,7 +59,7 @@
+ 		virtual void   ComputeBasalStress(Vector<IssmDouble>* sigma_b)=0;
+ 		virtual void   ComputeStrainRate(Vector<IssmDouble>* eps)=0;
+ 		virtual void   ResultInterpolation(int* pinterpolation,int output_enum)=0;
+-		virtual void   ResultToVector(Vector<IssmPDouble>* vector,int output_enum)=0;
++		virtual void   ResultToVector(Vector<IssmDouble>* vector,int output_enum)=0;
+ 		virtual void   Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finite_element)=0;
+ 		virtual void   InputDuplicate(int original_enum,int new_enum)=0;
+ 		virtual void   InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16588)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16589)
+@@ -2463,7 +2463,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION Tria::ResultToVector{{{*/
+-void Tria::ResultToVector(Vector<IssmPDouble>* vector,int output_enum){
++void Tria::ResultToVector(Vector<IssmDouble>* vector,int output_enum){
+ 
+ 	Input* input=this->inputs->GetInput(output_enum);
+ 	if(!input) _error_("input "<<EnumToStringx(output_enum)<<" not found in element");
+@@ -2474,16 +2474,15 @@
+ 			break;
+ 		case P1Enum:{
+ 			IssmDouble  values[NUMVERTICES];
+-			IssmPDouble pvalues[NUMVERTICES]; 
+ 			int         connectivity[NUMVERTICES];
+ 			int         sidlist[NUMVERTICES];
+ 
+ 			this->GetVertexSidList(&sidlist[0]);
+ 			this->GetConnectivityList(&connectivity[0]);
+ 			this->GetInputListOnVertices(&values[0],output_enum);
+-			for(int i=0;i<NUMVERTICES;i++) pvalues[i] = reCast<IssmPDouble>(values[i])/reCast<IssmPDouble>(connectivity[i]);
++			for(int i=0;i<NUMVERTICES;i++) values[i] = values[i]/reCast<IssmDouble>(connectivity[i]);
+ 
+-			vector->SetValues(NUMVERTICES,&sidlist[0],&pvalues[0],ADD_VAL);
++			vector->SetValues(NUMVERTICES,&sidlist[0],&values[0],ADD_VAL);
+ 			break;
+ 					}
+ 		default:
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16588)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16589)
+@@ -102,7 +102,7 @@
+ 		int         NodalValue(IssmDouble* pvalue, int index, int natureofdataenum);
+ 		void        PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm);
+ 		void        ResultInterpolation(int* pinterpolation,int output_enum);
+-		void        ResultToVector(Vector<IssmPDouble>* vector,int output_enum);
++		void        ResultToVector(Vector<IssmDouble>* vector,int output_enum);
+ 		void        ResetCoordinateSystem(void);
+ 		void	      SmbGradients();
+ 		IssmDouble  SurfaceArea(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16588)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16589)
+@@ -2863,7 +2863,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION Penta::ResultToVector{{{*/
+-void Penta::ResultToVector(Vector<IssmPDouble>* vector,int output_enum){
++void Penta::ResultToVector(Vector<IssmDouble>* vector,int output_enum){
+ 
+ 	Input* input=this->inputs->GetInput(output_enum);
+ 	if(!input) _error_("input "<<EnumToStringx(output_enum)<<" not found in element");
+@@ -2874,16 +2874,15 @@
+ 			break;
+ 		case P1Enum:{
+ 			IssmDouble  values[NUMVERTICES];
+-			IssmPDouble pvalues[NUMVERTICES]; 
+ 			int         connectivity[NUMVERTICES];
+ 			int         sidlist[NUMVERTICES];
+ 
+ 			this->GetVertexSidList(&sidlist[0]);
+ 			this->GetConnectivityList(&connectivity[0]);
+ 			this->GetInputListOnVertices(&values[0],output_enum);
+-			for(int i=0;i<NUMVERTICES;i++) pvalues[i] = reCast<IssmPDouble>(values[i])/reCast<IssmPDouble>(connectivity[i]);
++			for(int i=0;i<NUMVERTICES;i++) values[i] = values[i]/reCast<IssmDouble>(connectivity[i]);
+ 
+-			vector->SetValues(NUMVERTICES,&sidlist[0],&pvalues[0],ADD_VAL);
++			vector->SetValues(NUMVERTICES,&sidlist[0],&values[0],ADD_VAL);
+ 			break;
+ 					}
+ 		default:
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16588)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16589)
+@@ -95,7 +95,7 @@
+ 		void   InputScale(int enum_type,IssmDouble scale_factor);
+ 
+ 		void   ResultInterpolation(int* pinterpolation,int output_enum);
+-		void   ResultToVector(Vector<IssmPDouble>* vector,int output_enum);
++		void   ResultToVector(Vector<IssmDouble>* vector,int output_enum);
+ 		void   PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm);
+ 		void   ResetCoordinateSystem(void);
+ 		void   SmbGradients();
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16588)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16589)
+@@ -111,7 +111,7 @@
+ 		int         NodalValue(IssmDouble* pvalue, int index, int natureofdataenum){_error_("not implemented yet");};
+ 		void        PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm){_error_("not implemented yet");};
+ 		void        ResultInterpolation(int* pinterpolation,int output_enum){_error_("not implemented");};
+-		void        ResultToVector(Vector<IssmPDouble>* vector,int output_enum){_error_("not implemented");};
++		void        ResultToVector(Vector<IssmDouble>* vector,int output_enum){_error_("not implemented");};
+ 		void        ResetCoordinateSystem(void){_error_("not implemented yet");};
+ 		void	      SmbGradients(){_error_("not implemented yet");};
+ 		IssmDouble  SurfaceArea(void){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16589-16590.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16589-16590.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16589-16590.diff	(revision 17802)
@@ -0,0 +1,338 @@
+Index: ../trunk-jpl/test/Archives/Archive327.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive120.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive432.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive325.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive121.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive326.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive122.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive431.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16589)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16590)
+@@ -177,6 +177,7 @@
+ 	MaterialsMuWaterEnum,
+ 	MaterialsThermalExchangeVelocityEnum,
+ 	MaterialsThermalconductivityEnum,
++  MaterialsTemperateiceconductivityEnum,
+ 	MaterialsLithosphereShearModulusEnum,
+ 	MaterialsLithosphereDensityEnum,
+ 	MaterialsMantleShearModulusEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 16589)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 16590)
+@@ -185,6 +185,7 @@
+ 		case MaterialsMuWaterEnum : return "MaterialsMuWater";
+ 		case MaterialsThermalExchangeVelocityEnum : return "MaterialsThermalExchangeVelocity";
+ 		case MaterialsThermalconductivityEnum : return "MaterialsThermalconductivity";
++		case MaterialsTemperateiceconductivityEnum : return "MaterialsTemperateiceconductivity";
+ 		case MaterialsLithosphereShearModulusEnum : return "MaterialsLithosphereShearModulus";
+ 		case MaterialsLithosphereDensityEnum : return "MaterialsLithosphereDensity";
+ 		case MaterialsMantleShearModulusEnum : return "MaterialsMantleShearModulus";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 16589)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 16590)
+@@ -188,6 +188,7 @@
+ 	      else if (strcmp(name,"MaterialsMuWater")==0) return MaterialsMuWaterEnum;
+ 	      else if (strcmp(name,"MaterialsThermalExchangeVelocity")==0) return MaterialsThermalExchangeVelocityEnum;
+ 	      else if (strcmp(name,"MaterialsThermalconductivity")==0) return MaterialsThermalconductivityEnum;
++	      else if (strcmp(name,"MaterialsTemperateiceconductivity")==0) return MaterialsTemperateiceconductivityEnum;
+ 	      else if (strcmp(name,"MaterialsLithosphereShearModulus")==0) return MaterialsLithosphereShearModulusEnum;
+ 	      else if (strcmp(name,"MaterialsLithosphereDensity")==0) return MaterialsLithosphereDensityEnum;
+ 	      else if (strcmp(name,"MaterialsMantleShearModulus")==0) return MaterialsMantleShearModulusEnum;
+@@ -258,11 +259,11 @@
+ 	      else if (strcmp(name,"SurfaceforcingsPrecipitation")==0) return SurfaceforcingsPrecipitationEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsMassBalance")==0) return SurfaceforcingsMassBalanceEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsIspdd")==0) return SurfaceforcingsIspddEnum;
+-	      else if (strcmp(name,"SurfaceforcingsDesfac")==0) return SurfaceforcingsDesfacEnum;
+          else stage=3;
+    }
+    if(stage==3){
+-	      if (strcmp(name,"SurfaceforcingsS0p")==0) return SurfaceforcingsS0pEnum;
++	      if (strcmp(name,"SurfaceforcingsDesfac")==0) return SurfaceforcingsDesfacEnum;
++	      else if (strcmp(name,"SurfaceforcingsS0p")==0) return SurfaceforcingsS0pEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsIssmbgradients")==0) return SurfaceforcingsIssmbgradientsEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsMonthlytemperatures")==0) return SurfaceforcingsMonthlytemperaturesEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsHref")==0) return SurfaceforcingsHrefEnum;
+@@ -381,11 +382,11 @@
+ 	      else if (strcmp(name,"Input")==0) return InputEnum;
+ 	      else if (strcmp(name,"IntInput")==0) return IntInputEnum;
+ 	      else if (strcmp(name,"InputToExtrude")==0) return InputToExtrudeEnum;
+-	      else if (strcmp(name,"InputToL2Project")==0) return InputToL2ProjectEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"IntParam")==0) return IntParamEnum;
++	      if (strcmp(name,"InputToL2Project")==0) return InputToL2ProjectEnum;
++	      else if (strcmp(name,"IntParam")==0) return IntParamEnum;
+ 	      else if (strcmp(name,"IntVecParam")==0) return IntVecParamEnum;
+ 	      else if (strcmp(name,"TransientParam")==0) return TransientParamEnum;
+ 	      else if (strcmp(name,"Matice")==0) return MaticeEnum;
+@@ -504,11 +505,11 @@
+ 	      else if (strcmp(name,"StressTensor")==0) return StressTensorEnum;
+ 	      else if (strcmp(name,"StressTensorxx")==0) return StressTensorxxEnum;
+ 	      else if (strcmp(name,"StressTensorxy")==0) return StressTensorxyEnum;
+-	      else if (strcmp(name,"StressTensorxz")==0) return StressTensorxzEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"StressTensoryy")==0) return StressTensoryyEnum;
++	      if (strcmp(name,"StressTensorxz")==0) return StressTensorxzEnum;
++	      else if (strcmp(name,"StressTensoryy")==0) return StressTensoryyEnum;
+ 	      else if (strcmp(name,"StressTensoryz")==0) return StressTensoryzEnum;
+ 	      else if (strcmp(name,"StressTensorzz")==0) return StressTensorzzEnum;
+ 	      else if (strcmp(name,"GiaCrossSectionShape")==0) return GiaCrossSectionShapeEnum;
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 16589)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 16590)
+@@ -33,6 +33,7 @@
+ 	iomodel->Constant(&this->mu_water,MaterialsMuWaterEnum);
+ 	iomodel->Constant(&this->heatcapacity,MaterialsHeatcapacityEnum);
+ 	iomodel->Constant(&this->thermalconductivity,MaterialsThermalconductivityEnum);
++	iomodel->Constant(&this->temperateiceconductivity,MaterialsTemperateiceconductivityEnum);
+ 	iomodel->Constant(&this->latentheat,MaterialsLatentheatEnum);
+ 	iomodel->Constant(&this->beta,MaterialsBetaEnum);
+ 	iomodel->Constant(&this->meltingpoint,MaterialsMeltingpointEnum);
+@@ -99,6 +100,7 @@
+ 	_printf_("   mu_water: " << mu_water << "\n");
+ 	_printf_("   heatcapacity: " << heatcapacity << "\n");
+ 	_printf_("   thermalconductivity: " << thermalconductivity << "\n");
++	_printf_("   temperateiceconductivity: " << temperateiceconductivity << "\n");
+ 	_printf_("   latentheat: " << latentheat << "\n");
+ 	_printf_("   beta: " << beta << "\n");
+ 	_printf_("   meltingpoint: " << meltingpoint << "\n");
+@@ -168,9 +170,12 @@
+ 		case MaterialsHeatcapacityEnum:
+ 			this->heatcapacity=constant;
+ 			break;
+-		case MaterialsThermalconductivityEnum:
++	  	case MaterialsThermalconductivityEnum:
+ 			this->thermalconductivity=constant;
+ 			break;
++	  	case MaterialsTemperateiceconductivityEnum:
++			this->temperateiceconductivity=constant;
++			break;
+ 		case  MaterialsLatentheatEnum:
+ 			this->latentheat=constant;
+ 			break;
+@@ -307,6 +312,11 @@
+ 	return thermalconductivity;
+ }
+ /*}}}*/
++/*FUNCTION Matpar::GetTemperateIceConductivity {{{*/
++IssmDouble Matpar::GetTemperateIceConductivity(){
++	return temperateiceconductivity;
++}
++/*}}}*/
+ /*FUNCTION Matpar::GetThermalExchangeVelocity {{{*/
+ IssmDouble Matpar::GetThermalExchangeVelocity(){
+ 	return thermal_exchange_velocity;
+@@ -382,11 +392,22 @@
+ 		return thermalconductivity/heatcapacity*pow(10.,-5);
+ 	*/
+ 
+-	IssmDouble eps=0.05*heatcapacity;
++	IssmDouble eps=0.1*heatcapacity;
+ 	IssmDouble hpmp=PureIceEnthalpy(pressure);
+ 	IssmDouble kappa_c=thermalconductivity/heatcapacity;
+-	IssmDouble kappa_t=thermalconductivity/heatcapacity*pow(10.,-1);
+-	return 1./(1.+exp(-(enthalpy-(hpmp))/eps))*(kappa_t-kappa_c) + kappa_c;
++	IssmDouble kappa_t=temperateiceconductivity/heatcapacity;
++	
++	if(enthalpy<=hpmp-eps)
++		return kappa_c;
++	else if(enthalpy>=hpmp+eps)
++		return kappa_t;
++	else {
++		IssmDouble xi=enthalpy-hpmp;
++		IssmDouble pi=3.141592653589793238462643;
++		return kappa_c + (kappa_t-kappa_c)*((xi+eps)/(2*eps) + sin(pi*xi/eps)/(2*pi));
++	}
++
++	//return 1./(1.+exp(-(enthalpy-(hpmp))/eps))*(kappa_t-kappa_c) + kappa_c;
+ }
+ /*}}}*/
+ /*FUNCTION Matpar::GetEnthalpyDiffusionParameterVolume{{{*/
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 16589)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 16590)
+@@ -21,6 +21,7 @@
+ 		IssmDouble  mu_water;
+ 		IssmDouble  heatcapacity;
+ 		IssmDouble  thermalconductivity;
++		IssmDouble  temperateiceconductivity;
+ 		IssmDouble  latentheat;
+ 		IssmDouble  beta;
+ 		IssmDouble  meltingpoint;
+@@ -108,6 +109,7 @@
+ 		IssmDouble GetThermalExchangeVelocity();
+ 		IssmDouble GetHeatCapacity();
+ 		IssmDouble GetThermalConductivity();
++		IssmDouble GetTemperateIceConductivity();
+ 		IssmDouble GetLatentHeat();
+ 		IssmDouble GetBeta();
+ 		IssmDouble GetMeltingPoint();
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16589)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16590)
+@@ -3814,7 +3814,7 @@
+ 	if (stabilization==2) diameter=MinEdgeLength(xyz_list);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(2,2);
++	gauss=new GaussPenta(3,3);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 
+ 		gauss->GaussPoint(ig);
+@@ -3827,6 +3827,7 @@
+ 		enthalpy_input->GetInputValue(&enthalpy, gauss);
+ 		pressure_input->GetInputValue(&pressure, gauss);
+ 		kappa=matpar->GetEnthalpyDiffusionParameter(enthalpy,pressure); _assert_(kappa>0.);
++
+ 		D_scalar_conduct=gauss->weight*Jdet*kappa/rho_ice;
+ 		if(reCast<bool,IssmDouble>(dt)) D_scalar_conduct=D_scalar_conduct*dt;
+ 
+@@ -3894,7 +3895,7 @@
+ 		}
+ 		else if(stabilization==2){
+ 			GetNodalFunctionsP1Derivatives(&dbasis[0][0],&xyz_list[0][0], gauss);
+-			tau_parameter=GetStabilizationParameter(u-um,v-vm,w-wm,diameter,kappa);
++			tau_parameter=GetStabilizationParameter(u-um,v-vm,w-wm,diameter,kappa/rho_ice);
+ 
+ 			for(i=0;i<numdof;i++){
+ 				for(j=0;j<numdof;j++){
+Index: ../trunk-jpl/src/m/classes/matice.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/matice.m	(revision 16589)
++++ ../trunk-jpl/src/m/classes/matice.m	(revision 16590)
+@@ -12,6 +12,7 @@
+ 		heatcapacity               = 0.;
+ 		latentheat                 = 0.;
+ 		thermalconductivity        = 0.;
++		temperateiceconductivity         = 0.;
+ 		meltingpoint               = 0.;
+ 		beta                       = 0.;
+ 		mixed_layer_capacity       = 0.;
+@@ -68,6 +69,9 @@
+ 
+ 			%ice thermal conductivity (W/m/K)
+ 			obj.thermalconductivity=2.4;
++			
++			%wet ice thermal conductivity (W/m/K)
++			obj.temperateiceconductivity=.24;
+ 
+ 			%the melting point of ice at 1 atmosphere of pressure in K
+ 			obj.meltingpoint=273.15;
+@@ -117,7 +121,8 @@
+ 			fielddisplay(obj,'rho_freshwater','fresh water density [kg/m^3]');
+ 			fielddisplay(obj,'mu_water','water viscosity [N s/m^2]');
+ 			fielddisplay(obj,'heatcapacity','heat capacity [J/kg/K]');
+-			fielddisplay(obj,'thermalconductivity','ice thermal conductivity [W/m/K]');
++			fielddisplay(obj,'thermalconductivity',['ice thermal conductivity [W/m/K]']);
++			fielddisplay(obj,'temperateiceconductivity','temperate ice thermal conductivity [W/m/K]');
+ 			fielddisplay(obj,'meltingpoint','melting point of ice at 1atm in K');
+ 			fielddisplay(obj,'latentheat','latent heat of fusion [J/m^3]');
+ 			fielddisplay(obj,'beta','rate of change of melting point with pressure [K/Pa]');
+@@ -140,6 +145,7 @@
+ 			WriteData(fid,'object',obj,'class','materials','fieldname','heatcapacity','format','Double');
+ 			WriteData(fid,'object',obj,'class','materials','fieldname','latentheat','format','Double');
+ 			WriteData(fid,'object',obj,'class','materials','fieldname','thermalconductivity','format','Double');
++			WriteData(fid,'object',obj,'class','materials','fieldname','temperateiceconductivity','format','Double');
+ 			WriteData(fid,'object',obj,'class','materials','fieldname','meltingpoint','format','Double');
+ 			WriteData(fid,'object',obj,'class','materials','fieldname','beta','format','Double');
+ 			WriteData(fid,'object',obj,'class','materials','fieldname','mixed_layer_capacity','format','Double');
+Index: ../trunk-jpl/src/m/classes/matice.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/matice.py	(revision 16589)
++++ ../trunk-jpl/src/m/classes/matice.py	(revision 16590)
+@@ -20,6 +20,7 @@
+ 		self.heatcapacity              = 0.
+ 		self.latentheat                = 0.
+ 		self.thermalconductivity       = 0.
++		self.temperateiceconductivity  = 0.
+ 		self.meltingpoint              = 0.
+ 		self.beta                      = 0.
+ 		self.mixed_layer_capacity      = 0.
+@@ -45,6 +46,7 @@
+ 		string="%s\n%s"%(string,fielddisplay(self,"mu_water","water viscosity [N s/m^2]"))
+ 		string="%s\n%s"%(string,fielddisplay(self,"heatcapacity","heat capacity [J/kg/K]"))
+ 		string="%s\n%s"%(string,fielddisplay(self,"thermalconductivity","ice thermal conductivity [W/m/K]"))
++		string="%s\n%s"%(string,fielddisplay(self,"temperateiceconductivity","temperate ice thermal conductivity [W/m/K]"))
+ 		string="%s\n%s"%(string,fielddisplay(self,"meltingpoint","melting point of ice at 1atm in K"))
+ 		string="%s\n%s"%(string,fielddisplay(self,"latentheat","latent heat of fusion [J/m^3]"))
+ 		string="%s\n%s"%(string,fielddisplay(self,"beta","rate of change of melting point with pressure [K/Pa]"))
+@@ -82,6 +84,9 @@
+ 		#ice thermal conductivity (W/m/K)
+ 		self.thermalconductivity=2.4
+ 
++		#temperate ice thermal conductivity (W/m/K)
++		self.temperateiceconductivity=0.24
++
+ 		#the melting point of ice at 1 atmosphere of pressure in K
+ 		self.meltingpoint=273.15
+ 
+@@ -129,6 +134,7 @@
+ 		WriteData(fid,'object',self,'class','materials','fieldname','heatcapacity','format','Double')
+ 		WriteData(fid,'object',self,'class','materials','fieldname','latentheat','format','Double')
+ 		WriteData(fid,'object',self,'class','materials','fieldname','thermalconductivity','format','Double')
++		WriteData(fid,'object',self,'class','materials','fieldname','temperateiceconductivity','format','Double')
+ 		WriteData(fid,'object',self,'class','materials','fieldname','meltingpoint','format','Double')
+ 		WriteData(fid,'object',self,'class','materials','fieldname','beta','format','Double')
+ 		WriteData(fid,'object',self,'class','materials','fieldname','mixed_layer_capacity','format','Double')
+Index: ../trunk-jpl/src/m/enum/MaterialsTemperateiceconductivityEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/MaterialsTemperateiceconductivityEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/MaterialsTemperateiceconductivityEnum.m	(revision 16590)
+@@ -0,0 +1,11 @@
++function macro=MaterialsTemperateiceconductivityEnum()
++%MATERIALSTEMPERATEICECONDUCTIVITYENUM - Enum of MaterialsTemperateiceconductivity
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=MaterialsTemperateiceconductivityEnum()
++
++macro=StringToEnum('MaterialsTemperateiceconductivity');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 16589)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 16590)
+@@ -177,6 +177,7 @@
+ def MaterialsMuWaterEnum(): return StringToEnum("MaterialsMuWater")[0]
+ def MaterialsThermalExchangeVelocityEnum(): return StringToEnum("MaterialsThermalExchangeVelocity")[0]
+ def MaterialsThermalconductivityEnum(): return StringToEnum("MaterialsThermalconductivity")[0]
++def MaterialsTemperateiceconductivityEnum(): return StringToEnum("MaterialsTemperateiceconductivity")[0]
+ def MaterialsLithosphereShearModulusEnum(): return StringToEnum("MaterialsLithosphereShearModulus")[0]
+ def MaterialsLithosphereDensityEnum(): return StringToEnum("MaterialsLithosphereDensity")[0]
+ def MaterialsMantleShearModulusEnum(): return StringToEnum("MaterialsMantleShearModulus")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-16590-16591.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16590-16591.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16590-16591.diff	(revision 17802)
@@ -0,0 +1,171 @@
+Index: ../trunk-jpl/src/c/main/issm.cpp
+===================================================================
+--- ../trunk-jpl/src/c/main/issm.cpp	(revision 16590)
++++ ../trunk-jpl/src/c/main/issm.cpp	(revision 16591)
+@@ -19,7 +19,7 @@
+ 	femmodel->Solve();
+ 
+ 	/*Output results: */
+-	femmodel->OutputResults();
++	OutputResultsx(femmodel);
+ 
+ 	/*Wrap up: */
+ 	delete femmodel;
+Index: ../trunk-jpl/src/c/modules/OutputResultsx/OutputResultsx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/OutputResultsx/OutputResultsx.h	(revision 16590)
++++ ../trunk-jpl/src/c/modules/OutputResultsx/OutputResultsx.h	(revision 16591)
+@@ -13,6 +13,6 @@
+ 
+ #include "../../classes/classes.h"
+ 
+-void OutputResultsx(Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads,  Materials* materials, Parameters* parameters, Results* results);
++void OutputResultsx(FemModel* femmodel);
+ 
+ #endif  /* _OUTPUTRESULTS_H */
+Index: ../trunk-jpl/src/c/modules/OutputResultsx/OutputResultsx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/OutputResultsx/OutputResultsx.cpp	(revision 16590)
++++ ../trunk-jpl/src/c/modules/OutputResultsx/OutputResultsx.cpp	(revision 16591)
+@@ -14,7 +14,7 @@
+ #include "../../shared/io/io.h"
+ #include "../../classes/classes.h"
+ 
+-void OutputResultsx(Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Results* results){
++void OutputResultsx(FemModel* femmodel){
+ 
+ 	int         my_rank;
+ 	FILE       *fid                     = NULL;
+@@ -26,7 +26,7 @@
+ 	bool        dakota_analysis         = false;
+ 
+ 	/*retrieve parameters: */
+-	parameters->FindParam(&dakota_analysis,QmuIsdakotaEnum);
++	femmodel->parameters->FindParam(&dakota_analysis,QmuIsdakotaEnum);
+ 
+ 	/*recover my_rank:*/
+ 	my_rank=IssmComm::GetRank();
+@@ -39,20 +39,20 @@
+ 	/*Results do not include the type of solution being run	. In parallel, we output results to a filename, 
+ 	 *therefore, we need to include the solutiontype into the filename: */
+ 	if(my_rank==0){
+-		parameters->FindParam(&solutiontype,SolutionTypeEnum);
++		femmodel->parameters->FindParam(&solutiontype,SolutionTypeEnum);
+ 		EnumToStringx(&solutiontypestring,solutiontype);
+-		results->AddResult(new GenericExternalResult<char*>(results->Size()+1,SolutionTypeEnum,solutiontypestring,1,0));
++		femmodel->results->AddResult(new GenericExternalResult<char*>(femmodel->results->Size()+1,SolutionTypeEnum,solutiontypestring,1,0));
+ 		xDelete<char>(solutiontypestring);
+ 	}
+ 
+ 	/*Now, open file for writing, if not already done: */
+-	if(!parameters->Exist(OutputFilePointerEnum)){
++	if(!femmodel->parameters->Exist(OutputFilePointerEnum)){
+ 
+ 		/*We don't have a file pointer. Retrieve the output file name and open it for writing:*/
+-		parameters->FindParam(&outputfilename,OutputFileNameEnum);
++		femmodel->parameters->FindParam(&outputfilename,OutputFileNameEnum);
+ 
+ 		/*What strategy? : */
+-		parameters->FindParam(&io_gather,SettingsIoGatherEnum);
++		femmodel->parameters->FindParam(&io_gather,SettingsIoGatherEnum);
+ 
+ 		if(io_gather){
+ 			/*Just open the file for output on cpu 0. We are gathering the data on cpu 0 from all other cpus: */
+@@ -60,24 +60,24 @@
+ 		}
+ 		else{
+ 			/*We are opening different  files for output on all cpus. Append the  rank to the filename, and open: */
+-			parameters->FindParam(&fid,OutputFilePointerEnum);
++			femmodel->parameters->FindParam(&fid,OutputFilePointerEnum);
+ 			sprintf(cpu_outputfilename,"%s.%i",outputfilename,my_rank);
+ 			fid=pfopen(cpu_outputfilename ,"wb");
+ 		}
+ 		xDelete<char>(outputfilename);
+ 
+ 		/*Add file pointer in parameters for further calls to OutputResultsx: */
+-		parameters->SetParam(fid,OutputFilePointerEnum);
++		femmodel->parameters->SetParam(fid,OutputFilePointerEnum);
+ 	}
+ 
+ 	/*Write results to disk: */
+-	results->Write(parameters);
++	femmodel->results->Write(femmodel->parameters);
+ 
+ 	/*Delete and reinitialize results, in parallel: */
+-	results->clear();
++	femmodel->results->clear();
+ 
+ 	/*Close output file? :*/
+-	/*WARNING: issm.cpp is taking care of it for now (quick fix)
++	/*FIXME WARNING: issm.cpp is taking care of it for now (quick fix)
+ 	  if((step==1) && (time==0)){
+ 	  if(io_gather){
+ 	  if(my_rank==0) pfclose(fid,outputfilename);
+Index: ../trunk-jpl/src/c/cores/transient_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 16590)
++++ ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 16591)
+@@ -171,7 +171,7 @@
+ 				femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],1);
+ 			}
+ 			if(VerboseSolution()) _printf0_("   saving temporary results\n");
+-			OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,femmodel->results);
++			OutputResultsx(femmodel);
+ 		}
+ 	}
+ 
+Index: ../trunk-jpl/src/c/cores/hydrology_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/hydrology_core.cpp	(revision 16590)
++++ ../trunk-jpl/src/c/cores/hydrology_core.cpp	(revision 16591)
+@@ -72,7 +72,7 @@
+ 
+ 				/*unload results*/
+ 				if(VerboseSolution()) _printf0_("   saving temporary results\n");
+-				OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,femmodel->results);
++				OutputResultsx(femmodel);
+ 			}
+ 		}
+ 
+@@ -97,7 +97,7 @@
+ 				}
+ 				/*unload results*/
+ 				if(VerboseSolution()) _printf0_("   saving temporary results\n");
+-				OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,femmodel->results);
++				OutputResultsx(femmodel);
+ 			}
+ 		}
+ 
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 16590)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 16591)
+@@ -244,16 +244,6 @@
+ 
+ 	}
+ /*}}}*/
+-/*FUNCTION FemModel::OutputResults {{{*/
+-void FemModel::OutputResults(void){
+-
+-	_printf0_("write results to disk:\n");
+-
+-	/*Just call the OutputResultsx module: */
+-	OutputResultsx(this->elements, this->nodes, this->vertices, this->loads, this->materials, this->parameters,this->results);
+-
+-}
+-/*}}}*/
+ /*FUNCTION FemModel::SetStaticComm {{{*/
+ void FemModel::SetStaticComm(void){
+ 
+Index: ../trunk-jpl/src/c/classes/FemModel.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.h	(revision 16590)
++++ ../trunk-jpl/src/c/classes/FemModel.h	(revision 16591)
+@@ -53,7 +53,6 @@
+ 		void Echo();
+ 		void InitFromFiles(char* rootpath, char* inputfilename, char* outputfilename, char* petscfilename, char* lockfilename, const int solution_type,const int* analyses,const int nummodels);
+ 		void Solve(void);
+-		void OutputResults(void);
+ 		void SetStaticComm();
+ 		void SetCurrentConfiguration(int configuration_type);
+ 		void SetCurrentConfiguration(int configuration_type,int analysis_type);
Index: issm/oecreview/Archive/16554-17801/ISSM-16591-16592.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16591-16592.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16591-16592.diff	(revision 17802)
@@ -0,0 +1,290 @@
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16591)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16592)
+@@ -99,7 +99,9 @@
+ 	SedimentHeadResidualEnum,
+ 	EplHeadEnum,
+ 	EplHeadOldEnum,
+-  HydrologydcRelTolEnum,
++  EplHeadSlopeXEnum,
++	EplHeadSlopeYEnum,
++	HydrologydcRelTolEnum,
+ 	HydrologydcSpcsedimentHeadEnum,
+ 	HydrologydcSedimentCompressibilityEnum,
+ 	HydrologydcSedimentPorosityEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 16591)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 16592)
+@@ -107,6 +107,8 @@
+ 		case SedimentHeadResidualEnum : return "SedimentHeadResidual";
+ 		case EplHeadEnum : return "EplHead";
+ 		case EplHeadOldEnum : return "EplHeadOld";
++		case EplHeadSlopeXEnum : return "EplHeadSlopeX";
++		case EplHeadSlopeYEnum : return "EplHeadSlopeY";
+ 		case HydrologydcRelTolEnum : return "HydrologydcRelTol";
+ 		case HydrologydcSpcsedimentHeadEnum : return "HydrologydcSpcsedimentHead";
+ 		case HydrologydcSedimentCompressibilityEnum : return "HydrologydcSedimentCompressibility";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 16591)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 16592)
+@@ -107,6 +107,8 @@
+ 	      else if (strcmp(name,"SedimentHeadResidual")==0) return SedimentHeadResidualEnum;
+ 	      else if (strcmp(name,"EplHead")==0) return EplHeadEnum;
+ 	      else if (strcmp(name,"EplHeadOld")==0) return EplHeadOldEnum;
++	      else if (strcmp(name,"EplHeadSlopeX")==0) return EplHeadSlopeXEnum;
++	      else if (strcmp(name,"EplHeadSlopeY")==0) return EplHeadSlopeYEnum;
+ 	      else if (strcmp(name,"HydrologydcRelTol")==0) return HydrologydcRelTolEnum;
+ 	      else if (strcmp(name,"HydrologydcSpcsedimentHead")==0) return HydrologydcSpcsedimentHeadEnum;
+ 	      else if (strcmp(name,"HydrologydcSedimentCompressibility")==0) return HydrologydcSedimentCompressibilityEnum;
+@@ -134,12 +136,12 @@
+ 	      else if (strcmp(name,"IndependentObject")==0) return IndependentObjectEnum;
+ 	      else if (strcmp(name,"InversionControlParameters")==0) return InversionControlParametersEnum;
+ 	      else if (strcmp(name,"InversionCostFunctionThreshold")==0) return InversionCostFunctionThresholdEnum;
+-	      else if (strcmp(name,"InversionCostFunctionsCoefficients")==0) return InversionCostFunctionsCoefficientsEnum;
+-	      else if (strcmp(name,"InversionCostFunctions")==0) return InversionCostFunctionsEnum;
+          else stage=2;
+    }
+    if(stage==2){
+-	      if (strcmp(name,"InversionGradientScaling")==0) return InversionGradientScalingEnum;
++	      if (strcmp(name,"InversionCostFunctionsCoefficients")==0) return InversionCostFunctionsCoefficientsEnum;
++	      else if (strcmp(name,"InversionCostFunctions")==0) return InversionCostFunctionsEnum;
++	      else if (strcmp(name,"InversionGradientScaling")==0) return InversionGradientScalingEnum;
+ 	      else if (strcmp(name,"InversionIscontrol")==0) return InversionIscontrolEnum;
+ 	      else if (strcmp(name,"InversionTao")==0) return InversionTaoEnum;
+ 	      else if (strcmp(name,"InversionIncompleteAdjoint")==0) return InversionIncompleteAdjointEnum;
+@@ -257,12 +259,12 @@
+ 	      else if (strcmp(name,"SteadystateRequestedOutputs")==0) return SteadystateRequestedOutputsEnum;
+ 	      else if (strcmp(name,"Surface")==0) return SurfaceEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsPrecipitation")==0) return SurfaceforcingsPrecipitationEnum;
+-	      else if (strcmp(name,"SurfaceforcingsMassBalance")==0) return SurfaceforcingsMassBalanceEnum;
+-	      else if (strcmp(name,"SurfaceforcingsIspdd")==0) return SurfaceforcingsIspddEnum;
+          else stage=3;
+    }
+    if(stage==3){
+-	      if (strcmp(name,"SurfaceforcingsDesfac")==0) return SurfaceforcingsDesfacEnum;
++	      if (strcmp(name,"SurfaceforcingsMassBalance")==0) return SurfaceforcingsMassBalanceEnum;
++	      else if (strcmp(name,"SurfaceforcingsIspdd")==0) return SurfaceforcingsIspddEnum;
++	      else if (strcmp(name,"SurfaceforcingsDesfac")==0) return SurfaceforcingsDesfacEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsS0p")==0) return SurfaceforcingsS0pEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsIssmbgradients")==0) return SurfaceforcingsIssmbgradientsEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsMonthlytemperatures")==0) return SurfaceforcingsMonthlytemperaturesEnum;
+@@ -380,12 +382,12 @@
+ 	      else if (strcmp(name,"ExternalResult")==0) return ExternalResultEnum;
+ 	      else if (strcmp(name,"FileParam")==0) return FileParamEnum;
+ 	      else if (strcmp(name,"Input")==0) return InputEnum;
+-	      else if (strcmp(name,"IntInput")==0) return IntInputEnum;
+-	      else if (strcmp(name,"InputToExtrude")==0) return InputToExtrudeEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"InputToL2Project")==0) return InputToL2ProjectEnum;
++	      if (strcmp(name,"IntInput")==0) return IntInputEnum;
++	      else if (strcmp(name,"InputToExtrude")==0) return InputToExtrudeEnum;
++	      else if (strcmp(name,"InputToL2Project")==0) return InputToL2ProjectEnum;
+ 	      else if (strcmp(name,"IntParam")==0) return IntParamEnum;
+ 	      else if (strcmp(name,"IntVecParam")==0) return IntVecParamEnum;
+ 	      else if (strcmp(name,"TransientParam")==0) return TransientParamEnum;
+@@ -503,12 +505,12 @@
+ 	      else if (strcmp(name,"HydrologyWaterVx")==0) return HydrologyWaterVxEnum;
+ 	      else if (strcmp(name,"HydrologyWaterVy")==0) return HydrologyWaterVyEnum;
+ 	      else if (strcmp(name,"StressTensor")==0) return StressTensorEnum;
+-	      else if (strcmp(name,"StressTensorxx")==0) return StressTensorxxEnum;
+-	      else if (strcmp(name,"StressTensorxy")==0) return StressTensorxyEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"StressTensorxz")==0) return StressTensorxzEnum;
++	      if (strcmp(name,"StressTensorxx")==0) return StressTensorxxEnum;
++	      else if (strcmp(name,"StressTensorxy")==0) return StressTensorxyEnum;
++	      else if (strcmp(name,"StressTensorxz")==0) return StressTensorxzEnum;
+ 	      else if (strcmp(name,"StressTensoryy")==0) return StressTensoryyEnum;
+ 	      else if (strcmp(name,"StressTensoryz")==0) return StressTensoryzEnum;
+ 	      else if (strcmp(name,"StressTensorzz")==0) return StressTensorzzEnum;
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16591)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16592)
+@@ -6,6 +6,8 @@
+ #include "../classes/classes.h"
+ #include "../shared/shared.h"
+ #include "../modules/modules.h"
++/*FIXME, dirty hack to get the solutionsequence linear needed to compute the slopes*/
++#include "../solutionsequences/solutionsequences.h"
+ 
+ void solutionsequence_hydro_nonlinear(FemModel* femmodel){
+ 	/*solution : */
+@@ -91,7 +93,6 @@
+ 			Mergesolutionfromftogx(&ug_sed,uf_sed,ys,femmodel->nodes,femmodel->parameters); delete ys;
+ 			InputUpdateFromSolutionx(femmodel,ug_sed);
+ 			ConstraintsStatex(&constraints_converged,&num_unstable_constraints,femmodel);
+-
+ 			if (!sedconverged){
+ 				if(VerboseConvergence()) _printf0_("   # Sediment unstable constraints = " << num_unstable_constraints << "\n");
+ 				if(num_unstable_constraints==0) sedconverged = true;
+@@ -112,6 +113,15 @@
+ 
+ 		/*Second layer*/
+ 		if(isefficientlayer){
++
++			/*Start by retrieving the EPL head slopes*/
++			if(VerboseSolution()) _printf0_("computing EPL Head slope...\n");
++			femmodel->SetCurrentConfiguration(L2ProjectionBaseAnalysisEnum);
++			femmodel->parameters->SetParam(EplHeadSlopeXEnum,InputToL2ProjectEnum);
++			solutionsequence_linear(femmodel);
++			femmodel->parameters->SetParam(EplHeadSlopeYEnum,InputToL2ProjectEnum);
++			solutionsequence_linear(femmodel);
++			
+ 			femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
+ 			InputUpdateFromConstantx(femmodel,true,ResetPenaltiesEnum);
+ 			InputUpdateFromConstantx(femmodel,false,ConvergedEnum);
+Index: ../trunk-jpl/src/c/cores/hydrology_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/hydrology_core.cpp	(revision 16591)
++++ ../trunk-jpl/src/c/cores/hydrology_core.cpp	(revision 16592)
+@@ -56,6 +56,7 @@
+ 		femmodel->parameters->SetParam(time,TimeEnum);
+ 		femmodel->parameters->SetParam(step,StepEnum);
+ 
++		/*Using the Shreve based Model*/
+ 		if (hydrology_model==HydrologyshreveEnum){
+ 			if(VerboseSolution()) _printf0_("   computing water column\n");
+ 			femmodel->SetCurrentConfiguration(HydrologyShreveAnalysisEnum);
+@@ -76,20 +77,22 @@
+ 			}
+ 		}
+ 
++		/*Using the double continuum model*/
+ 		else if (hydrology_model==HydrologydcEnum){
+ 			InputDuplicatex(femmodel,SedimentHeadEnum,SedimentHeadOldEnum);
+ 			femmodel->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);
+ 			if (isefficientlayer){
+ 				InputDuplicatex(femmodel,EplHeadEnum,EplHeadOldEnum);
+ 			}
+-
++			
++			/*Proceed now to heads computations*/
+ 			if(VerboseSolution()) _printf0_("   computing water head\n");
+ 			solutionsequence_hydro_nonlinear(femmodel);
+ 			if(save_results && ((i+1)%output_frequency==0 || (i+1)==nsteps)){
+ 				if(VerboseSolution()) _printf0_("   saving results \n");
+ 				if(isefficientlayer){
+-					int outputs[4] = {SedimentHeadEnum,SedimentHeadResidualEnum,EplHeadEnum,HydrologydcMaskEplactiveEnum};
+-					femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],4);
++					int outputs[6] = {SedimentHeadEnum,SedimentHeadResidualEnum,EplHeadEnum,HydrologydcMaskEplactiveEnum,EplHeadSlopeXEnum,EplHeadSlopeYEnum};
++					femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],6);
+ 				}
+ 				else{
+ 					int outputs[2] = {SedimentHeadEnum,SedimentHeadResidualEnum};
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16591)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16592)
+@@ -572,6 +572,8 @@
+ 		case SurfaceSlopeYEnum: input2 = inputs->GetInput(SurfaceEnum); _assert_(input2); break;
+ 		case BedSlopeXEnum:     input2 = inputs->GetInput(BedEnum);     _assert_(input2); break;
+ 		case BedSlopeYEnum:     input2 = inputs->GetInput(BedEnum);     _assert_(input2); break;
++		case EplHeadSlopeXEnum: input2 = inputs->GetInput(EplHeadEnum); _assert_(input2); break;
++		case EplHeadSlopeYEnum: input2 = inputs->GetInput(EplHeadEnum); _assert_(input2); break;
+ 		default: input = inputs->GetInput(input_enum);
+ 	}
+ 
+@@ -586,8 +588,8 @@
+ 
+ 		if(input2) input2->GetInputDerivativeValue(&slopes[0],&xyz_list[0][0],gauss);
+ 		switch(input_enum){
+-			case SurfaceSlopeXEnum: case BedSlopeXEnum: value = slopes[0]; break;
+-			case SurfaceSlopeYEnum: case BedSlopeYEnum: value = slopes[1]; break;
++			case SurfaceSlopeXEnum: case BedSlopeXEnum: case EplHeadSlopeXEnum: value = slopes[0]; break;
++			case SurfaceSlopeYEnum: case BedSlopeYEnum: case EplHeadSlopeYEnum: value = slopes[1]; break;
+ 			default: input->GetInputValue(&value,gauss);
+ 		}
+ 
+Index: ../trunk-jpl/src/m/plot/plot_contour.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_contour.m	(revision 16591)
++++ ../trunk-jpl/src/m/plot/plot_contour.m	(revision 16592)
+@@ -229,7 +229,7 @@
+ 			if (max(xc)-min(xc)+max(yc)-min(yc))<dist, continue; end
+ 			h=patch('Xdata',[xc;NaN],'Ydata',[yc;NaN],'facecolor','none','edgecolor',color,'linewidth',linewidth);
+ 			c = horzcat([level, xc'; length(xc), yc']);
+-			clabel(c,h,'FontSize',10,'labelspacing',20000,'color',color);
++			%clabel(c,h,'FontSize',10,'labelspacing',20000,'color',color);
+ 			hold on
+ 		end
+ 
+Index: ../trunk-jpl/src/m/classes/clusters/greenplanet.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/clusters/greenplanet.m	(revision 16591)
++++ ../trunk-jpl/src/m/classes/clusters/greenplanet.m	(revision 16592)
+@@ -146,8 +146,8 @@
+ 			 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
+ 
+ 			 disp('launching solution sequence on remote cluster');
+-			 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
+-				 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub ' modelname '.queue '];
++			 % launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
++			 % 	 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && hostname && qsub ' modelname '.queue '];
+ 			 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
+ 		 end %}}}
+ 		 function Download(cluster,dirname,filelist)% {{{
+Index: ../trunk-jpl/src/m/contrib/paraview/exportVTK.m
+===================================================================
+--- ../trunk-jpl/src/m/contrib/paraview/exportVTK.m	(revision 16591)
++++ ../trunk-jpl/src/m/contrib/paraview/exportVTK.m	(revision 16592)
+@@ -117,7 +117,7 @@
+ 		res_struct=model.(varargin{j});
+ 		fieldnames=fields(res_struct);
+ 		num_of_fields=length(fieldnames);
+-		for k=1:num_of_sols
++		for k=1:num_of_fields
+ 			if ((length(res_struct.(fieldnames{k})))==num_of_points);
+ 				%paraview does not like NaN, replacing
+ 				pos=find(isnan(res_struct.(fieldnames{k})));
+Index: ../trunk-jpl/src/m/enum/EplHeadSlopeXEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/EplHeadSlopeXEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/EplHeadSlopeXEnum.m	(revision 16592)
+@@ -0,0 +1,11 @@
++function macro=EplHeadSlopeXEnum()
++%EPLHEADSLOPEXENUM - Enum of EplHeadSlopeX
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=EplHeadSlopeXEnum()
++
++macro=StringToEnum('EplHeadSlopeX');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 16591)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 16592)
+@@ -99,6 +99,8 @@
+ def SedimentHeadResidualEnum(): return StringToEnum("SedimentHeadResidual")[0]
+ def EplHeadEnum(): return StringToEnum("EplHead")[0]
+ def EplHeadOldEnum(): return StringToEnum("EplHeadOld")[0]
++def EplHeadSlopeXEnum(): return StringToEnum("EplHeadSlopeX")[0]
++def EplHeadSlopeYEnum(): return StringToEnum("EplHeadSlopeY")[0]
+ def HydrologydcRelTolEnum(): return StringToEnum("HydrologydcRelTol")[0]
+ def HydrologydcSpcsedimentHeadEnum(): return StringToEnum("HydrologydcSpcsedimentHead")[0]
+ def HydrologydcSedimentCompressibilityEnum(): return StringToEnum("HydrologydcSedimentCompressibility")[0]
+Index: ../trunk-jpl/src/m/enum/EplHeadSlopeYEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/EplHeadSlopeYEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/EplHeadSlopeYEnum.m	(revision 16592)
+@@ -0,0 +1,11 @@
++function macro=EplHeadSlopeYEnum()
++%EPLHEADSLOPEYENUM - Enum of EplHeadSlopeY
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=EplHeadSlopeYEnum()
++
++macro=StringToEnum('EplHeadSlopeY');
Index: issm/oecreview/Archive/16554-17801/ISSM-16592-16593.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16592-16593.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16592-16593.diff	(revision 17802)
@@ -0,0 +1,44 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16592)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16593)
+@@ -2881,13 +2881,9 @@
+ 
+ 	if(NoIceInElement())return 0;
+ 
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	/*First get back the area of the base*/
++	base=this->GetArea();
+ 
+-	/*First calculate the area of the base (cross section triangle)
+-	 * http://en.wikipedia.org/wiki/Triangle
+-	 * base = 1/2 abs((xA-xC)(yB-yA)-(xA-xB)(yC-yA))*/
+-	base = 1./2. * fabs((xyz_list[0][0]-xyz_list[2][0])*(xyz_list[1][1]-xyz_list[0][1]) - (xyz_list[0][0]-xyz_list[1][0])*(xyz_list[2][1]-xyz_list[0][1]));
+-
+ 	/*Now get the average height*/
+ 	Input* surface_input = inputs->GetInput(SurfaceEnum); _assert_(surface_input);
+ 	Input* bed_input     = inputs->GetInput(BedEnum);     _assert_(bed_input);
+@@ -2895,7 +2891,14 @@
+ 	bed_input->GetInputAverage(&bed);
+ 
+ 	/*Return: */
+-	return base*(surface-bed);
++	int meshtype;
++	parameters->FindParam(&meshtype,MeshTypeEnum);
++	if(meshtype==Mesh2DverticalEnum){
++	  return base;
++	}
++	else{
++	  return base*(surface-bed);
++	}
+ }
+ /*}}}*/
+ /*FUNCTION Tria::IceVolumeAboveFloatation {{{*/
+@@ -3773,6 +3776,7 @@
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	rho_water = matpar->GetRhoWater();
++	rho_ice = matpar->GetRhoIce();
+ 	gravity   = matpar->GetG();
+ 	GetZeroLevelsetCoordinates(&xyz_list_front[0][0],xyz_list,MaskIceLevelsetEnum);
+ 	GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,xyz_list,2);
Index: issm/oecreview/Archive/16554-17801/ISSM-16593-16594.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16593-16594.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16593-16594.diff	(revision 17802)
@@ -0,0 +1,359 @@
+Index: ../trunk-jpl/scripts/jenkins.sh
+===================================================================
+--- ../trunk-jpl/scripts/jenkins.sh	(revision 0)
++++ ../trunk-jpl/scripts/jenkins.sh	(revision 16594)
+@@ -0,0 +1,348 @@
++#!/bin/bash
++#This bash script calls the nightlyrun.m matlab file to run our nightly test decks. 
++#It then processes the results and sends an email to the Ice developpers.
++
++#some functions
++function timer() #{{{
++{
++	if [[ $# -eq 0 ]]; then
++		echo $(date '+%s')
++	else
++		local  stime=$1
++		etime=$(date '+%s')
++
++		if [[ -z "$stime" ]]; then stime=$etime; fi
++
++		dt=$((etime - stime))
++		ds=$((dt % 60))
++		dm=$(((dt / 60) % 60))
++		dh=$((dt / 3600))
++		printf '%d:%02d:%02d' $dh $dm $ds
++	fi
++} #}}}
++function todaydate() #{{{
++{
++	suffix=`date | awk '{printf("%s-%s-%s  %s",$2,$3,$6,$4);}'`			 
++	echo $suffix;			 
++} #}}}
++function host_name() #{{{
++{
++	#return host name depending on the OS
++	if [ "$1" = "win7" ] 
++	then
++		HOST_NAME=`hostname | sed 's/-//g'`;
++	else
++		HOST_NAME=`hostname -s | sed 's/-//g'`;
++	fi
++	echo $HOST_NAME;
++} #}}}
++function pause() #{{{
++{
++pid=`ps aux -W | grep $1 | awk '{printf("%s\n",$1);}'`
++
++while [ -n "$pid" ]
++do
++	pid=`ps aux -W | grep $1 | awk '{printf("%s\n",$1);}'`
++done
++}
++#}}}
++
++#Get configuration
++#Source config file{{{
++if [ $# -ne 1 ];
++then
++	#no config file specified: exit
++	echo "no config file specified. Exiting..." >&2 # Error message to stderr.
++	rm NIGHTLYLOCK
++	exit 1
++fi
++if [ ! -f "$1" ]
++then
++	echo "File $1 not found!" >&2   # Error message to stderr.
++	rm NIGHTLYLOCK
++	exit 1
++fi 
++source $1;
++#}}}
++#Export ISSM_* variables{{{
++export ISSM_DIR
++export ISSM_ARCH
++#}}}
++#Initialize variables {{{
++TODAY=$(todaydate);
++HOST_NAME=$(host_name $OS);
++OS=$(uname -s)
++START_TIME=$(timer);
++ISSM_RELEASE=$(basename $(echo $REPOSITORY));
++USER=$(whoami);
++INIT_PATH=$(pwd);
++#}}}
++
++#Installation ISSM
++#Checkout/update/none ISSM if requested (ISSM_INSTALLATION){{{
++if [ "$ISSM_INSTALLATION" == "checkout" ]
++then
++	rm -rf $ISSM_RELEASE
++	svn checkout "$REPOSITORY"
++elif [ "$ISSM_INSTALLATION" == "update" ]
++then
++	cd $ISSM_DIR
++	svn update
++elif [ "$ISSM_INSTALLATION" == "none" ]
++then
++	echo "Skipping ISSM installation"
++else
++	echo "ISSM_INSTALLATION supported values are: checkout, update and none. Exiting..." >&2 # Error message to stderr.
++	exit 1
++fi
++source $ISSM_DIR/etc/environment.sh
++#}}}
++#create matlab's installation sript {{{
++cat << END > $ISSM_DIR/externalpackages/matlab/install.sh
++#!/bin/bash
++rm -rf install
++ln -s $MATLAB_PATH install
++END
++#}}}
++#install/copy/none external packages    (ISSM_EXTERNALPACKAGES){{{
++if [ "$ISSM_EXTERNALPACKAGES" == "install" ]
++then
++	
++	cd $ISSM_DIR/externalpackages
++
++	#number of packages: 
++	NUMPACKAGES=$(($(echo $EXTERNALPACKAGES | wc -w )/2))
++
++	for ((i=1;i<=$NUMPACKAGES;i++))
++	do
++		NUM1=$((2*$i-1))
++		NUM2=$((2*$i))
++		PACKAGENAME=$(echo $EXTERNALPACKAGES | cut -d " " -f $NUM1-$NUM1)
++		PACKAGEINST=$(echo $EXTERNALPACKAGES | cut -d " " -f $NUM2-$NUM2)
++
++		cd $PACKAGENAME
++		echo "======================================================";
++		echo "       Installing $PACKAGENAME (see compil.log)       ";
++		echo "======================================================";
++		./$PACKAGEINST > compil.log
++		if [ $? -ne 0 ]; then
++			echo "======================================================";
++			echo "    ERROR: installation of $PACKAGENAME failed        ";
++			echo "======================================================";
++		fi
++		source $ISSM_DIR/etc/environment.sh
++		cd ..
++	done
++
++elif [ "$ISSM_EXTERNALPACKAGES" == "copy" ]
++then
++	cd $ISSM_DIR
++	rm -rf externalpackages
++	cp -Rf $EXTERNALPACKAGESDIR ./
++elif [ "$ISSM_EXTERNALPACKAGES" == "link" ]
++then
++	cd $ISSM_DIR
++	rm -rf externalpackages
++	ln -s  $EXTERNALPACKAGESDIR  .
++elif [ "$ISSM_EXTERNALPACKAGES" == "none" ]
++then
++	echo "Skipping external packages installation"
++else
++	echo "ISSM_EXTERNALPACKAGES supported values are: install, copy and none. Exiting..." >&2 # Error message to stderr.
++	exit 1
++fi
++source $ISSM_DIR/etc/environment.sh
++#}}}
++#ISSM compilation yes/no                (ISSM_COMPILATION) {{{
++if [ "$ISSM_COMPILATION" == "yes" ]
++then
++	cd $ISSM_DIR
++	make uninstall
++	make clean
++	make distclean
++	./scripts/automakererun.sh
++	cat > configure.sh << EOF
++./configure $ISSM_CONFIG
++EOF
++	chmod 700 configure.sh
++	./configure.sh
++
++	#4: compile and install ISSM
++	if [ $NUMCPUS_INSTALL -gt 1 ]
++	then
++		echo "Making with " $NUMCPUS_INSTALL " cpus"
++		make -j $NUMCPUS_INSTALL install
++	else
++		make install
++	fi
++elif [ "$ISSM_COMPILATION" == "no" ]
++then
++	echo "Skipping ISSM compilation"
++else
++	echo "ISSM_COMPILATION supported values are: yes and no. Exiting..." >&2 # Error message to stderr.
++	exit 1
++fi
++#}}}
++
++#Prepare info.log
++#{{{
++rm -rf $ISSM_DIR/nightlylog
++mkdir  $ISSM_DIR/nightlylog
++INSTALL_TIME=$(timer)
++ELAPSED=$(timer $START_TIME)
++VERSION=$(svnversion $ISSM_DIR)
++cat << END > $ISSM_DIR/nightlylog/info.log
++name:      $(echo $NAME)
++today:     $(echo $TODAY)
++user:      $(echo $USER)
++host:      $(echo $HOST_NAME)
++OS:        $(echo $OS)
++release:   $(echo $ISSM_RELEASE)
++init_path: $(echo $INIT_PATH)
++is_matlab: $(echo $MATLAB_TEST)
++is_python: $(echo $PYTHON_TEST)
++elapsed_install: $(echo $ELAPSED)
++version: $(echo $VERSION)
++END
++#}}}
++
++#matlab tests
++if [ $MATLAB_TEST -eq 1 ]; then
++#Launch all tests on different cpus {{{
++MATLAB_START_TIME=$(timer);
++for (( i=1;i<=$NUMCPUS_RUN;i++ ))
++do
++	#Launch matlab and the nightly run script
++	cat > $ISSM_DIR/nightlylog/matlab_run$i.m << EOF
++	warning off %necessary to avoid a info.log of several Go for parallel runs
++	try,
++	$(if [ "$MATLAB_NROPTIONS" = ""  ]
++	then
++		echo "runme('output','nightly','rank',$i,'numprocs',$NUMCPUS_RUN);"
++	else
++		echo "runme($MATLAB_NROPTIONS,'output','nightly','rank',$i,'numprocs',$NUMCPUS_RUN);"
++	fi
++	)
++	catch me,
++		%An error occured, get report and exit
++		message=getReport(me)
++		directory=strsplit(pwd,'/');
++		fid=fopen([issmdir '/nightlylog/matlaberror.log'], 'at');
++		fprintf(fid,'\nMatlab error occured in: %s\n\n',directory{end});
++		fprintf(fid,'%s',message);
++		fclose(fid);
++	end
++	disp('MATLABEXITEDCORRECTLY');
++	exit
++EOF
++	cd $ISSM_DIR/test/NightlyRun
++	matlab -nojvm -nosplash -r "addpath $ISSM_DIR/src/m/dev; devpath; addpath $ISSM_DIR/nightlylog/; matlab_run$i" -logfile $ISSM_DIR/nightlylog/matlab_log$i.log &
++done
++
++#wait until matlab closes
++if [ "$OS" = "win7" ]; then
++	pause MATLAB
++else
++	wait
++fi
++
++#concatenate reports
++cd $ISSM_DIR/nightlylog/
++rm matlab_log.log
++for (( i=1;i<=$NUMCPUS_RUN;i++ ))
++do
++	cat matlab_log$i.log >> matlab_log.log
++done
++#}}}
++#Complete info.log {{{
++if [ $(cat matlab_log.log | grep "MATLABEXITEDCORRECTLY" | wc -l) -eq $NUMCPUS_RUN ]
++then
++	MATLABCRASH=0
++else
++	MATLABCRASH=1
++fi
++ELAPSED=$(timer $MATLAB_START_TIME)
++cat << END >>  $ISSM_DIR/nightlylog/info.log
++elapsed_matlab: $(echo $ELAPSED)
++matlab_crash:   $(echo $MATLABCRASH)
++END
++#}}}
++fi
++
++#python tests
++if [ $PYTHON_TEST -eq 1 ]; then
++#Launch all tests on different cpus {{{
++PYTHON_START_TIME=$(timer);
++export PYTHONSTARTUP=$ISSM_DIR/src/m/dev/devpath.py
++for (( i=1;i<=$NUMCPUS_RUN;i++ ))
++do
++	cd $ISSM_DIR/test/NightlyRun
++	./runme.py --output=nightly --rank=$i --numprocs=$NUMCPUS_RUN $PYTHON_NROPTIONS 2>&1 > $ISSM_DIR/nightlylog/python_log$i.log &
++done
++
++#wait until python closes
++if [ "$OS" = "win7" ]; then
++	pause MATLAB
++else
++	wait
++fi
++
++#concatenate reports
++cd $ISSM_DIR/nightlylog/
++rm python_log.log
++for (( i=1;i<=$NUMCPUS_RUN;i++ ))
++do
++	cat python_log$i.log >> python_log.log
++done
++#}}}
++#Complete info.log {{{
++if [ $(cat python_log.log | grep "PYTHONEXITEDCORRECTLY" | wc -l) -eq $NUMCPUS_RUN ]
++then
++	PYTHONCRASH=0
++else
++	PYTHONCRASH=1
++fi
++ELAPSED=$(timer $PYTHON_START_TIME)
++cat << END >>  $ISSM_DIR/nightlylog/info.log
++elapsed_python: $(echo $ELAPSED)
++python_crash:   $(echo $PYTHONCRASH)
++END
++#}}}
++fi
++
++#complete info.log
++#{{{
++ELAPSED=$(timer $START_TIME)
++cat << END >>  $ISSM_DIR/nightlylog/info.log
++elapsed_total:  $(echo $ELAPSED)
++END
++#}}}
++
++#Send Report
++#Build html report {{{
++cd $ISSM_DIR/nightlylog/
++sh ../scripts/report.sh
++echo "html report located in $ISSM_DIR/nightlylog/report.html"
++#}}}
++#send mail if requested                  (SKIPMAIL) {{{
++if [ "$SKIPMAIL" != "yes" ]
++then
++	echo "sending report..."
++	for i in `echo $MAILINGLIST`; do
++
++cat - $ISSM_DIR/nightlylog/report.html <<HERE | /usr/lib/sendmail  -oi -t
++From: "ISSM Nightly run" <$EMAIL_ADRESS>
++To: $i
++Subject: ISSM nightly runs report: $NAME
++Mime-Version: 1.0
++Content-Type: text/html
++HERE
++	done
++fi
++#}}}
++
++#remove lock file
++#{{{
++cd $ISSM_DIR/../
++rm NIGHTLYLOCK
++#}}}
+
+Property changes on: ../trunk-jpl/scripts/jenkins.sh
+___________________________________________________________________
+Name: svn:executable
+   + *
+
Index: issm/oecreview/Archive/16554-17801/ISSM-16594-16595.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16594-16595.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16594-16595.diff	(revision 17802)
@@ -0,0 +1,18 @@
+Index: ../trunk-jpl/scripts/jenkins.sh
+===================================================================
+--- ../trunk-jpl/scripts/jenkins.sh	(revision 16594)
++++ ../trunk-jpl/scripts/jenkins.sh	(revision 16595)
+@@ -53,13 +53,11 @@
+ then
+ 	#no config file specified: exit
+ 	echo "no config file specified. Exiting..." >&2 # Error message to stderr.
+-	rm NIGHTLYLOCK
+ 	exit 1
+ fi
+ if [ ! -f "$1" ]
+ then
+ 	echo "File $1 not found!" >&2   # Error message to stderr.
+-	rm NIGHTLYLOCK
+ 	exit 1
+ fi 
+ source $1;
Index: issm/oecreview/Archive/16554-17801/ISSM-16595-16596.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16595-16596.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16595-16596.diff	(revision 17802)
@@ -0,0 +1,29 @@
+Index: ../trunk-jpl/scripts/jenkins.sh
+===================================================================
+--- ../trunk-jpl/scripts/jenkins.sh	(revision 16595)
++++ ../trunk-jpl/scripts/jenkins.sh	(revision 16596)
+@@ -77,24 +77,6 @@
+ #}}}
+ 
+ #Installation ISSM
+-#Checkout/update/none ISSM if requested (ISSM_INSTALLATION){{{
+-if [ "$ISSM_INSTALLATION" == "checkout" ]
+-then
+-	rm -rf $ISSM_RELEASE
+-	svn checkout "$REPOSITORY"
+-elif [ "$ISSM_INSTALLATION" == "update" ]
+-then
+-	cd $ISSM_DIR
+-	svn update
+-elif [ "$ISSM_INSTALLATION" == "none" ]
+-then
+-	echo "Skipping ISSM installation"
+-else
+-	echo "ISSM_INSTALLATION supported values are: checkout, update and none. Exiting..." >&2 # Error message to stderr.
+-	exit 1
+-fi
+-source $ISSM_DIR/etc/environment.sh
+-#}}}
+ #create matlab's installation sript {{{
+ cat << END > $ISSM_DIR/externalpackages/matlab/install.sh
+ #!/bin/bash
Index: issm/oecreview/Archive/16554-17801/ISSM-16596-16597.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16596-16597.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16596-16597.diff	(revision 17802)
@@ -0,0 +1,16 @@
+Index: ../trunk-jpl/scripts/jenkins.sh
+===================================================================
+--- ../trunk-jpl/scripts/jenkins.sh	(revision 16596)
++++ ../trunk-jpl/scripts/jenkins.sh	(revision 16597)
+@@ -102,9 +102,9 @@
+ 
+ 		cd $PACKAGENAME
+ 		echo "======================================================";
+-		echo "       Installing $PACKAGENAME (see compil.log)       ";
++		echo "       Installing $PACKAGENAME                        ";
+ 		echo "======================================================";
+-		./$PACKAGEINST > compil.log
++		./$PACKAGEINST |  compil.log
+ 		if [ $? -ne 0 ]; then
+ 			echo "======================================================";
+ 			echo "    ERROR: installation of $PACKAGENAME failed        ";
Index: issm/oecreview/Archive/16554-17801/ISSM-16597-16598.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16597-16598.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16597-16598.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/scripts/jenkins.sh
+===================================================================
+--- ../trunk-jpl/scripts/jenkins.sh	(revision 16597)
++++ ../trunk-jpl/scripts/jenkins.sh	(revision 16598)
+@@ -104,7 +104,7 @@
+ 		echo "======================================================";
+ 		echo "       Installing $PACKAGENAME                        ";
+ 		echo "======================================================";
+-		./$PACKAGEINST |  compil.log
++		./$PACKAGEINST |  tee compil.log
+ 		if [ $? -ne 0 ]; then
+ 			echo "======================================================";
+ 			echo "    ERROR: installation of $PACKAGENAME failed        ";
Index: issm/oecreview/Archive/16554-17801/ISSM-16598-16599.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16598-16599.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16598-16599.diff	(revision 17802)
@@ -0,0 +1,107 @@
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16598)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16599)
+@@ -9,6 +9,22 @@
+ 	return 1;
+ }/*}}}*/
+ void ThermalAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
++
++	int     numoutputs;
++	char**  requestedoutputs = NULL;
++
++	parameters->AddObject(iomodel->CopyConstantObject(ThermalMaxiterEnum));
++	parameters->AddObject(iomodel->CopyConstantObject(ThermalStabilizationEnum));
++	parameters->AddObject(iomodel->CopyConstantObject(ThermalPenaltyThresholdEnum));
++	parameters->AddObject(iomodel->CopyConstantObject(ThermalPenaltyLockEnum));
++	parameters->AddObject(iomodel->CopyConstantObject(ThermalIsenthalpyEnum));
++	parameters->AddObject(iomodel->CopyConstantObject(ThermalIsdynamicbasalspcEnum));
++
++	iomodel->FetchData(&requestedoutputs,&numoutputs,ThermalRequestedOutputsEnum);
++	parameters->AddObject(new IntParam(ThermalNumRequestedOutputsEnum,numoutputs));
++	if(numoutputs)parameters->AddObject(new StringArrayParam(ThermalRequestedOutputsEnum,requestedoutputs,numoutputs));
++	iomodel->DeleteData(&requestedoutputs,numoutputs,ThermalRequestedOutputsEnum);
++
+ }/*}}}*/
+ void ThermalAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16598)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16599)
+@@ -10,8 +10,22 @@
+ }/*}}}*/
+ void MasstransportAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+ 
++	int     numoutputs;
++	char**  requestedoutputs = NULL;
++
+ 	parameters->AddObject(iomodel->CopyConstantObject(FlowequationIsFSEnum));
+ 
++	parameters->AddObject(iomodel->CopyConstantObject(MasstransportIsfreesurfaceEnum));
++	parameters->AddObject(iomodel->CopyConstantObject(MasstransportHydrostaticAdjustmentEnum));
++	parameters->AddObject(iomodel->CopyConstantObject(MasstransportStabilizationEnum));
++	parameters->AddObject(iomodel->CopyConstantObject(MasstransportMinThicknessEnum));
++	parameters->AddObject(iomodel->CopyConstantObject(MasstransportPenaltyFactorEnum));
++
++	iomodel->FetchData(&requestedoutputs,&numoutputs,MasstransportRequestedOutputsEnum);
++	parameters->AddObject(new IntParam(MasstransportNumRequestedOutputsEnum,numoutputs));
++	if(numoutputs)parameters->AddObject(new StringArrayParam(MasstransportRequestedOutputsEnum,requestedoutputs,numoutputs));
++	iomodel->DeleteData(&requestedoutputs,numoutputs,MasstransportRequestedOutputsEnum);
++
+ }/*}}}*/
+ void MasstransportAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 16598)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 16599)
+@@ -50,11 +50,6 @@
+ 	parameters->AddObject(iomodel->CopyConstantObject(TimesteppingTimeAdaptEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(TimesteppingTimeStepEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(TimesteppingCflCoefficientEnum));
+-	parameters->AddObject(iomodel->CopyConstantObject(MasstransportIsfreesurfaceEnum));
+-	parameters->AddObject(iomodel->CopyConstantObject(MasstransportHydrostaticAdjustmentEnum));
+-	parameters->AddObject(iomodel->CopyConstantObject(MasstransportStabilizationEnum));
+-	parameters->AddObject(iomodel->CopyConstantObject(MasstransportMinThicknessEnum));
+-	parameters->AddObject(iomodel->CopyConstantObject(MasstransportPenaltyFactorEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(ThermalPenaltyFactorEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(SettingsLowmemEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(DebugProfilingEnum));
+@@ -62,10 +57,6 @@
+ 	parameters->AddObject(iomodel->CopyConstantObject(ConstantsReferencetemperatureEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(BalancethicknessStabilizationEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(GroundinglineMeltingRateEnum));
+-	parameters->AddObject(iomodel->CopyConstantObject(ThermalMaxiterEnum));
+-	parameters->AddObject(iomodel->CopyConstantObject(ThermalStabilizationEnum));
+-	parameters->AddObject(iomodel->CopyConstantObject(ThermalPenaltyThresholdEnum));
+-	parameters->AddObject(iomodel->CopyConstantObject(ThermalPenaltyLockEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(SettingsWaitonlockEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(MeshNumberofelementsEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(MeshNumberofverticesEnum));
+@@ -76,8 +67,6 @@
+ 	parameters->AddObject(iomodel->CopyConstantObject(TransientIsthermalEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(TransientIsgroundinglineEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(TransientIsgiaEnum));
+-	parameters->AddObject(iomodel->CopyConstantObject(ThermalIsenthalpyEnum));
+-	parameters->AddObject(iomodel->CopyConstantObject(ThermalIsdynamicbasalspcEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(MaterialsRheologyLawEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(AutodiffIsautodiffEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(QmuIsdakotaEnum));
+@@ -145,16 +134,6 @@
+ 	if(numoutputs)parameters->AddObject(new StringArrayParam(SteadystateRequestedOutputsEnum,requestedoutputs,numoutputs));
+ 	iomodel->DeleteData(&requestedoutputs,numoutputs,SteadystateRequestedOutputsEnum);
+ 
+-	iomodel->FetchData(&requestedoutputs,&numoutputs,MasstransportRequestedOutputsEnum);
+-	parameters->AddObject(new IntParam(MasstransportNumRequestedOutputsEnum,numoutputs));
+-	if(numoutputs)parameters->AddObject(new StringArrayParam(MasstransportRequestedOutputsEnum,requestedoutputs,numoutputs));
+-	iomodel->DeleteData(&requestedoutputs,numoutputs,MasstransportRequestedOutputsEnum);
+-
+-	iomodel->FetchData(&requestedoutputs,&numoutputs,ThermalRequestedOutputsEnum);
+-	parameters->AddObject(new IntParam(ThermalNumRequestedOutputsEnum,numoutputs));
+-	if(numoutputs)parameters->AddObject(new StringArrayParam(ThermalRequestedOutputsEnum,requestedoutputs,numoutputs));
+-	iomodel->DeleteData(&requestedoutputs,numoutputs,ThermalRequestedOutputsEnum);
+-
+ 	/*Deal with mass flux segments: {{{*/
+ 	iomodel->FetchData(&qmu_mass_flux_present,QmuMassFluxSegmentsPresentEnum);
+ 	iomodel->FetchData(&autodiff_mass_flux_present,AutodiffMassFluxSegmentsPresentEnum);
Index: issm/oecreview/Archive/16554-17801/ISSM-16599-16600.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16599-16600.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16599-16600.diff	(revision 17802)
@@ -0,0 +1,340 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16599)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16600)
+@@ -13,6 +13,7 @@
+ 	int         hydrology_model;
+ 	int         sedimentlimit_flag;
+ 	int         transfer_flag;
++	int         penalty_lock;
+ 	bool        isefficientlayer;
+ 	IssmDouble  sedimentlimit;
+ 	IssmDouble  penalty_factor;
+@@ -30,6 +31,7 @@
+ 	iomodel->FetchData(&transfer_flag,HydrologydcTransferFlagEnum);
+ 	iomodel->FetchData(&penalty_factor,HydrologydcPenaltyFactorEnum);
+ 	iomodel->FetchData(&rel_tol,HydrologydcRelTolEnum);
++	iomodel->FetchData(&penalty_lock,HydrologydcPenaltyLockEnum);
+ 
+ 	if(sedimentlimit_flag==1){
+ 		iomodel->FetchData(&sedimentlimit,HydrologydcSedimentlimitEnum);
+@@ -47,6 +49,7 @@
+ 	parameters->AddObject(new IntParam(HydrologydcSedimentlimitFlagEnum,sedimentlimit_flag));
+ 	parameters->AddObject(new IntParam(HydrologydcTransferFlagEnum,transfer_flag));
+ 	parameters->AddObject(new DoubleParam(HydrologydcRelTolEnum,rel_tol));
++	parameters->AddObject(new IntParam(HydrologydcPenaltyLockEnum,penalty_lock));
+ 
+ }/*}}}*/
+ void HydrologyDCInefficientAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16599)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16600)
+@@ -120,6 +120,7 @@
+ 	HydrologydcTransferFlagEnum,
+ 	HydrologydcLeakageFactorEnum,
+ 	HydrologydcPenaltyFactorEnum,
++	HydrologydcPenaltyLockEnum,
+ 	HydrologyLayerEnum,
+ 	HydrologySedimentEnum,
+ 	HydrologyEfficientEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 16599)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 16600)
+@@ -128,6 +128,7 @@
+ 		case HydrologydcTransferFlagEnum : return "HydrologydcTransferFlag";
+ 		case HydrologydcLeakageFactorEnum : return "HydrologydcLeakageFactor";
+ 		case HydrologydcPenaltyFactorEnum : return "HydrologydcPenaltyFactor";
++		case HydrologydcPenaltyLockEnum : return "HydrologydcPenaltyLock";
+ 		case HydrologyLayerEnum : return "HydrologyLayer";
+ 		case HydrologySedimentEnum : return "HydrologySediment";
+ 		case HydrologyEfficientEnum : return "HydrologyEfficient";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 16599)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 16600)
+@@ -128,6 +128,7 @@
+ 	      else if (strcmp(name,"HydrologydcTransferFlag")==0) return HydrologydcTransferFlagEnum;
+ 	      else if (strcmp(name,"HydrologydcLeakageFactor")==0) return HydrologydcLeakageFactorEnum;
+ 	      else if (strcmp(name,"HydrologydcPenaltyFactor")==0) return HydrologydcPenaltyFactorEnum;
++	      else if (strcmp(name,"HydrologydcPenaltyLock")==0) return HydrologydcPenaltyLockEnum;
+ 	      else if (strcmp(name,"HydrologyLayer")==0) return HydrologyLayerEnum;
+ 	      else if (strcmp(name,"HydrologySediment")==0) return HydrologySedimentEnum;
+ 	      else if (strcmp(name,"HydrologyEfficient")==0) return HydrologyEfficientEnum;
+@@ -135,11 +136,11 @@
+ 	      else if (strcmp(name,"WaterTransfer")==0) return WaterTransferEnum;
+ 	      else if (strcmp(name,"IndependentObject")==0) return IndependentObjectEnum;
+ 	      else if (strcmp(name,"InversionControlParameters")==0) return InversionControlParametersEnum;
+-	      else if (strcmp(name,"InversionCostFunctionThreshold")==0) return InversionCostFunctionThresholdEnum;
+          else stage=2;
+    }
+    if(stage==2){
+-	      if (strcmp(name,"InversionCostFunctionsCoefficients")==0) return InversionCostFunctionsCoefficientsEnum;
++	      if (strcmp(name,"InversionCostFunctionThreshold")==0) return InversionCostFunctionThresholdEnum;
++	      else if (strcmp(name,"InversionCostFunctionsCoefficients")==0) return InversionCostFunctionsCoefficientsEnum;
+ 	      else if (strcmp(name,"InversionCostFunctions")==0) return InversionCostFunctionsEnum;
+ 	      else if (strcmp(name,"InversionGradientScaling")==0) return InversionGradientScalingEnum;
+ 	      else if (strcmp(name,"InversionIscontrol")==0) return InversionIscontrolEnum;
+@@ -258,11 +259,11 @@
+ 	      else if (strcmp(name,"SteadystateReltol")==0) return SteadystateReltolEnum;
+ 	      else if (strcmp(name,"SteadystateRequestedOutputs")==0) return SteadystateRequestedOutputsEnum;
+ 	      else if (strcmp(name,"Surface")==0) return SurfaceEnum;
+-	      else if (strcmp(name,"SurfaceforcingsPrecipitation")==0) return SurfaceforcingsPrecipitationEnum;
+          else stage=3;
+    }
+    if(stage==3){
+-	      if (strcmp(name,"SurfaceforcingsMassBalance")==0) return SurfaceforcingsMassBalanceEnum;
++	      if (strcmp(name,"SurfaceforcingsPrecipitation")==0) return SurfaceforcingsPrecipitationEnum;
++	      else if (strcmp(name,"SurfaceforcingsMassBalance")==0) return SurfaceforcingsMassBalanceEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsIspdd")==0) return SurfaceforcingsIspddEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsDesfac")==0) return SurfaceforcingsDesfacEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsS0p")==0) return SurfaceforcingsS0pEnum;
+@@ -381,11 +382,11 @@
+ 	      else if (strcmp(name,"Element")==0) return ElementEnum;
+ 	      else if (strcmp(name,"ExternalResult")==0) return ExternalResultEnum;
+ 	      else if (strcmp(name,"FileParam")==0) return FileParamEnum;
+-	      else if (strcmp(name,"Input")==0) return InputEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"IntInput")==0) return IntInputEnum;
++	      if (strcmp(name,"Input")==0) return InputEnum;
++	      else if (strcmp(name,"IntInput")==0) return IntInputEnum;
+ 	      else if (strcmp(name,"InputToExtrude")==0) return InputToExtrudeEnum;
+ 	      else if (strcmp(name,"InputToL2Project")==0) return InputToL2ProjectEnum;
+ 	      else if (strcmp(name,"IntParam")==0) return IntParamEnum;
+@@ -504,11 +505,11 @@
+ 	      else if (strcmp(name,"QmuTemperature")==0) return QmuTemperatureEnum;
+ 	      else if (strcmp(name,"HydrologyWaterVx")==0) return HydrologyWaterVxEnum;
+ 	      else if (strcmp(name,"HydrologyWaterVy")==0) return HydrologyWaterVyEnum;
+-	      else if (strcmp(name,"StressTensor")==0) return StressTensorEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"StressTensorxx")==0) return StressTensorxxEnum;
++	      if (strcmp(name,"StressTensor")==0) return StressTensorEnum;
++	      else if (strcmp(name,"StressTensorxx")==0) return StressTensorxxEnum;
+ 	      else if (strcmp(name,"StressTensorxy")==0) return StressTensorxyEnum;
+ 	      else if (strcmp(name,"StressTensorxz")==0) return StressTensorxzEnum;
+ 	      else if (strcmp(name,"StressTensoryy")==0) return StressTensoryyEnum;
+Index: ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 16599)
++++ ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 16600)
+@@ -639,8 +639,9 @@
+ void  Pengrid::ConstraintActivateHydrologyDCInefficient(int* punstable){
+ 
+ 	//   The penalty is stable if it doesn't change during two consecutive iterations.   
+-	int        unstable        = 0;
++	int        unstable=0;
+ 	int        new_active;
++	int        penalty_lock;
+ 	IssmDouble pressure;
+ 	IssmDouble h;
+ 	IssmDouble h_max;	
+@@ -655,16 +656,28 @@
+ 	/*Get sediment water head h*/
+ 	element->GetInputValue(&h,node,SedimentHeadEnum);
+ 	element->GetHydrologyDCInefficientHmax(&h_max,node);
++	parameters->FindParam(&penalty_lock,HydrologydcPenaltyLockEnum);
++
+ 	if (h>h_max)
+ 	 new_active=1;
+ 	else
+ 	 new_active=0;
+ 
+-	if(this->active==new_active)
+-	 unstable=0;
+-	else
+-	 unstable=1;
++	if(this->active==new_active){
++		unstable=0;
++	}
++	else{
++		unstable=1;
++		if(penalty_lock)zigzag_counter++;
++	}
+ 
++	/*If penalty keeps zigzagging more than penalty_lock times: */
++	if(penalty_lock){
++		if(zigzag_counter>penalty_lock){
++			unstable=0;
++			active=1;
++		}
++	}
+ 	/*Set penalty flag*/
+ 	this->active=new_active;
+ 
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 16599)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 16600)
+@@ -1411,4 +1411,12 @@
+ 	delete transferg;
+ }
+ /*}}}*/
++void FemModel::HydrologyEPLThicknessx(void){ /*{{{*/
++
++	for (int i=0;i<elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
++		element->ComputeEPLThickness();
++	}
++}
++/*}}}*/
+ #endif
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16599)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16600)
+@@ -135,6 +135,7 @@
+ 		virtual void GetHydrologyTransfer(Vector<IssmDouble>* transfer)=0; 
+ 		virtual void HydrologyEPLGetMask(Vector<IssmDouble>* mask)=0;
+ 		virtual void HydrologyEPLGetActive(Vector<IssmDouble>* active)=0;
++		virtual void ComputeEPLThickness(void)=0;
+ 		#endif
+ 
+ 		#ifdef _HAVE_GROUNDINGLINE_
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16599)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16600)
+@@ -7223,6 +7223,12 @@
+ 	}
+ }
+ /*}}}*/
++/*FUNCTION Tria::ComputeEPLThickness{{{*/
++void  Tria::ComputeEPLThickness(void){
++}
++/*}}}*/
++
++
+ #endif
+ 
+ #ifdef _HAVE_MASSTRANSPORT_
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16599)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16600)
+@@ -302,6 +302,7 @@
+ 		void    GetHydrologyTransfer(Vector<IssmDouble>* transfer);
+ 		void    HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
+ 		void    HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask);
++		void    ComputeEPLThickness(void);
+ 		bool    AllActive(void);
+ 		bool    AnyActive(void);
+ 		#endif
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16599)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16600)
+@@ -10844,6 +10844,17 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Penta::ComputeEPLThickness{{{*/
++void  Penta::ComputeEPLThickness(void){
++
++	if (!IsOnBed())return;
++
++	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
++	tria->ComputeEPLThickness();
++	delete tria->material; delete tria;
++
++}
++/*}}}*/
+ /*FUNCTION Penta::InputUpdateFromSolutionHydrologyDCInefficient{{{*/
+ void  Penta::InputUpdateFromSolutionHydrologyDCInefficient(IssmDouble* solution){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16599)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16600)
+@@ -322,6 +322,7 @@
+ 		void    HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
+ 		void    HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask);
+ 		void    InputUpdateFromSolutionHydrologyDCInefficient(IssmDouble* solution);
++		void    ComputeEPLThickness(void);
+ 		#endif
+ 
+ 		void           UpdateConstraintsExtrudeFromBase(void){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16599)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16600)
+@@ -100,6 +100,7 @@
+ 		void    GetHydrologyTransfer(Vector<IssmDouble>* transfer){_error_("not implemented yet");};
+ 		void    HydrologyEPLGetActive(Vector<IssmDouble>* active_vec){_error_("not implemented yet");};
+ 		void    HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask){_error_("not implemented yet");};
++		void    ComputeEPLThickness(void){_error_("not implemented yet");};
+ 		#endif
+ 		void        GetSolutionFromInputs(Vector<IssmDouble>* solution){_error_("not implemented yet");};
+ 		void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/FemModel.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.h	(revision 16599)
++++ ../trunk-jpl/src/c/classes/FemModel.h	(revision 16600)
+@@ -101,6 +101,7 @@
+ 		#ifdef _HAVE_HYDROLOGY_
+ 		void HydrologyTransferx(void);
+ 		void HydrologyEPLupdateDomainx(void);
++		void HydrologyEPLThicknessx(void);
+ 		#endif
+ };
+ 
+Index: ../trunk-jpl/src/m/classes/hydrologydc.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/hydrologydc.m	(revision 16599)
++++ ../trunk-jpl/src/m/classes/hydrologydc.m	(revision 16600)
+@@ -8,6 +8,7 @@
+ 		water_compressibility    = 0;
+ 		isefficientlayer         = 0;
+ 		penalty_factor           = 0;
++		penalty_lock             = 0;
+ 		rel_tol                  = 0;
+ 		sedimentlimit_flag       = 0;
+ 		sedimentlimit            = 0;
+@@ -106,6 +107,7 @@
+ 			fielddisplay(obj,'water_compressibility','compressibility of water [Pa^-1]');
+ 			fielddisplay(obj,'isefficientlayer','do we use an efficient drainage system [1: true; 0: false]');
+ 			fielddisplay(obj,'penalty_factor','exponent of the value used in the penalisation method [dimensionless]');
++			fielddisplay(obj,'penalty_lock','stabilize unstable constraints that keep zigzagging after n iteration (default is 0, no stabilization)');
+ 			fielddisplay(obj,'rel_tol','tolerance of the nonlinear iteration for the transfer between layers [dimensionless]');
+ 			fielddisplay(obj,'sedimentlimit_flag','what kind of upper limit is applied for the inefficient layer');
+ 			disp(sprintf('%55s  0: no limit',' '));
+@@ -146,6 +148,7 @@
+ 			WriteData(fid,'object',obj,'fieldname','water_compressibility','format','Double');
+ 			WriteData(fid,'object',obj,'fieldname','isefficientlayer','format','Boolean');
+ 			WriteData(fid,'object',obj,'fieldname','penalty_factor','format','Double');
++			WriteData(fid,'object',obj,'fieldname','penalty_lock','format','Integer');
+ 			WriteData(fid,'object',obj,'fieldname','rel_tol','format','Double');
+ 			WriteData(fid,'object',obj,'fieldname','sedimentlimit_flag','format','Integer');
+ 			WriteData(fid,'object',obj,'fieldname','transfer_flag','format','Integer');
+Index: ../trunk-jpl/src/m/enum/HydrologydcPenaltyLockEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/HydrologydcPenaltyLockEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/HydrologydcPenaltyLockEnum.m	(revision 16600)
+@@ -0,0 +1,11 @@
++function macro=HydrologydcPenaltyLockEnum()
++%HYDROLOGYDCPENALTYLOCKENUM - Enum of HydrologydcPenaltyLock
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=HydrologydcPenaltyLockEnum()
++
++macro=StringToEnum('HydrologydcPenaltyLock');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 16599)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 16600)
+@@ -120,6 +120,7 @@
+ def HydrologydcTransferFlagEnum(): return StringToEnum("HydrologydcTransferFlag")[0]
+ def HydrologydcLeakageFactorEnum(): return StringToEnum("HydrologydcLeakageFactor")[0]
+ def HydrologydcPenaltyFactorEnum(): return StringToEnum("HydrologydcPenaltyFactor")[0]
++def HydrologydcPenaltyLockEnum(): return StringToEnum("HydrologydcPenaltyLock")[0]
+ def HydrologyLayerEnum(): return StringToEnum("HydrologyLayer")[0]
+ def HydrologySedimentEnum(): return StringToEnum("HydrologySediment")[0]
+ def HydrologyEfficientEnum(): return StringToEnum("HydrologyEfficient")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-16600-16601.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16600-16601.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16600-16601.diff	(revision 17802)
@@ -0,0 +1,25 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 16600)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 16601)
+@@ -51,6 +51,9 @@
+ 	parameters->AddObject(iomodel->CopyConstantObject(TimesteppingTimeStepEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(TimesteppingCflCoefficientEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(ThermalPenaltyFactorEnum));
++	parameters->AddObject(iomodel->CopyConstantObject(ThermalIsenthalpyEnum)); 
++	parameters->AddObject(iomodel->CopyConstantObject(ThermalStabilizationEnum));
++	parameters->AddObject(iomodel->CopyConstantObject(ThermalIsdynamicbasalspcEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(SettingsLowmemEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(DebugProfilingEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(MeshAverageVertexConnectivityEnum));
+@@ -134,6 +137,10 @@
+ 	if(numoutputs)parameters->AddObject(new StringArrayParam(SteadystateRequestedOutputsEnum,requestedoutputs,numoutputs));
+ 	iomodel->DeleteData(&requestedoutputs,numoutputs,SteadystateRequestedOutputsEnum);
+ 
++	iomodel->FetchData(&requestedoutputs,&numoutputs,ThermalRequestedOutputsEnum);		 
++	parameters->AddObject(new IntParam(ThermalNumRequestedOutputsEnum,numoutputs));		 
++	if(numoutputs)parameters->AddObject(new StringArrayParam(ThermalRequestedOutputsEnum,requestedoutputs,numoutputs));		 
++	iomodel->DeleteData(&requestedoutputs,numoutputs,ThermalRequestedOutputsEnum);
+ 	/*Deal with mass flux segments: {{{*/
+ 	iomodel->FetchData(&qmu_mass_flux_present,QmuMassFluxSegmentsPresentEnum);
+ 	iomodel->FetchData(&autodiff_mass_flux_present,AutodiffMassFluxSegmentsPresentEnum);
Index: issm/oecreview/Archive/16554-17801/ISSM-16601-16602.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16601-16602.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16601-16602.diff	(revision 17802)
@@ -0,0 +1,52 @@
+Index: ../trunk-jpl/externalpackages/shell2junit/install.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/shell2junit/install.sh	(revision 0)
++++ ../trunk-jpl/externalpackages/shell2junit/install.sh	(revision 16602)
+@@ -0,0 +1,17 @@
++#!/bin/bash
++set -eu
++
++#Some cleanup
++rm -rf install
++rm -rf shell2junit
++mkdir install
++
++#Download from ISSM server
++$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/shell2junit-1.0.0.zip' 'shell2junit-1.0.0.zip'
++
++#Untar 
++unzip shell2junit-1.0.0.zip
++
++#Move shell2junit into install directory
++mv shell2junit/* install
++rm -rf shell2junit
+
+Property changes on: ../trunk-jpl/externalpackages/shell2junit/install.sh
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/externalpackages/shell2junit/README
+===================================================================
+--- ../trunk-jpl/externalpackages/shell2junit/README	(revision 0)
++++ ../trunk-jpl/externalpackages/shell2junit/README	(revision 16602)
+@@ -0,0 +1,9 @@
++http://code.google.com/p/shell2junit/
++
++Shell2junit
++
++Shell2junit is a simple utility which facilitates to generate junit reports for batch processes executed in shell scripts. 
++
++The reports can be easily parsed in Hudson and other CI software in order to monitor and generate trends and alerts. 
++
++This page teaches how to do it in Hudson. 
+Index: ../trunk-jpl/externalpackages/shell2junit/shell2junit-1.0.0.zip
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/externalpackages/shell2junit/shell2junit-1.0.0.zip
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+
Index: issm/oecreview/Archive/16554-17801/ISSM-16602-16603.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16602-16603.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16602-16603.diff	(revision 17802)
@@ -0,0 +1,34 @@
+Index: ../trunk-jpl/externalpackages/shell2junit/install.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/shell2junit/install.sh	(revision 16602)
++++ ../trunk-jpl/externalpackages/shell2junit/install.sh	(revision 16603)
+@@ -2,9 +2,9 @@
+ set -eu
+ 
+ #Some cleanup
+-rm -rf install
++rm -rf install src
+ rm -rf shell2junit
+-mkdir install
++mkdir install src
+ 
+ #Download from ISSM server
+ $ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/shell2junit-1.0.0.zip' 'shell2junit-1.0.0.zip'
+@@ -13,5 +13,8 @@
+ unzip shell2junit-1.0.0.zip
+ 
+ #Move shell2junit into install directory
+-mv shell2junit/* install
++mv shell2junit/* src
+ rm -rf shell2junit
++
++#Copy executable: 
++cp src/sh2ju.sh install
+
+Property changes on: ../trunk-jpl/externalpackages/shell2junit
+___________________________________________________________________
+Name: svn:ignore
+   + install
+src
+
+
Index: issm/oecreview/Archive/16554-17801/ISSM-16603-16604.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16603-16604.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16603-16604.diff	(revision 17802)
@@ -0,0 +1,49 @@
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16603)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16604)
+@@ -9,6 +9,18 @@
+ 	return 1;
+ }/*}}}*/
+ void EnthalpyAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
++
++	int     numoutputs;
++	char**  requestedoutputs = NULL;
++
++	parameters->AddObject(iomodel->CopyConstantObject(ThermalStabilizationEnum));
++	parameters->AddObject(iomodel->CopyConstantObject(ThermalIsenthalpyEnum));
++	parameters->AddObject(iomodel->CopyConstantObject(ThermalIsdynamicbasalspcEnum));
++
++	iomodel->FetchData(&requestedoutputs,&numoutputs,ThermalRequestedOutputsEnum);
++	parameters->AddObject(new IntParam(ThermalNumRequestedOutputsEnum,numoutputs));
++	if(numoutputs)parameters->AddObject(new StringArrayParam(ThermalRequestedOutputsEnum,requestedoutputs,numoutputs));
++	iomodel->DeleteData(&requestedoutputs,numoutputs,ThermalRequestedOutputsEnum);
+ }/*}}}*/
+ void EnthalpyAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 16603)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 16604)
+@@ -50,10 +50,6 @@
+ 	parameters->AddObject(iomodel->CopyConstantObject(TimesteppingTimeAdaptEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(TimesteppingTimeStepEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(TimesteppingCflCoefficientEnum));
+-	parameters->AddObject(iomodel->CopyConstantObject(ThermalPenaltyFactorEnum));
+-	parameters->AddObject(iomodel->CopyConstantObject(ThermalIsenthalpyEnum)); 
+-	parameters->AddObject(iomodel->CopyConstantObject(ThermalStabilizationEnum));
+-	parameters->AddObject(iomodel->CopyConstantObject(ThermalIsdynamicbasalspcEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(SettingsLowmemEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(DebugProfilingEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(MeshAverageVertexConnectivityEnum));
+@@ -137,10 +133,6 @@
+ 	if(numoutputs)parameters->AddObject(new StringArrayParam(SteadystateRequestedOutputsEnum,requestedoutputs,numoutputs));
+ 	iomodel->DeleteData(&requestedoutputs,numoutputs,SteadystateRequestedOutputsEnum);
+ 
+-	iomodel->FetchData(&requestedoutputs,&numoutputs,ThermalRequestedOutputsEnum);		 
+-	parameters->AddObject(new IntParam(ThermalNumRequestedOutputsEnum,numoutputs));		 
+-	if(numoutputs)parameters->AddObject(new StringArrayParam(ThermalRequestedOutputsEnum,requestedoutputs,numoutputs));		 
+-	iomodel->DeleteData(&requestedoutputs,numoutputs,ThermalRequestedOutputsEnum);
+ 	/*Deal with mass flux segments: {{{*/
+ 	iomodel->FetchData(&qmu_mass_flux_present,QmuMassFluxSegmentsPresentEnum);
+ 	iomodel->FetchData(&autodiff_mass_flux_present,AutodiffMassFluxSegmentsPresentEnum);
Index: issm/oecreview/Archive/16554-17801/ISSM-16604-16605.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16604-16605.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16604-16605.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16604)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16605)
+@@ -15,6 +15,7 @@
+ 
+ 	parameters->AddObject(iomodel->CopyConstantObject(ThermalMaxiterEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(ThermalStabilizationEnum));
++	parameters->AddObject(iomodel->CopyConstantObject(ThermalPenaltyFactorEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(ThermalPenaltyThresholdEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(ThermalPenaltyLockEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(ThermalIsenthalpyEnum));
Index: issm/oecreview/Archive/16554-17801/ISSM-16605-16606.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16605-16606.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16605-16606.diff	(revision 17802)
@@ -0,0 +1,333 @@
+Index: ../trunk-jpl/scripts/jenkins.sh
+===================================================================
+--- ../trunk-jpl/scripts/jenkins.sh	(revision 16605)
++++ ../trunk-jpl/scripts/jenkins.sh	(revision 16606)
+@@ -1,328 +0,0 @@
+-#!/bin/bash
+-#This bash script calls the nightlyrun.m matlab file to run our nightly test decks. 
+-#It then processes the results and sends an email to the Ice developpers.
+-
+-#some functions
+-function timer() #{{{
+-{
+-	if [[ $# -eq 0 ]]; then
+-		echo $(date '+%s')
+-	else
+-		local  stime=$1
+-		etime=$(date '+%s')
+-
+-		if [[ -z "$stime" ]]; then stime=$etime; fi
+-
+-		dt=$((etime - stime))
+-		ds=$((dt % 60))
+-		dm=$(((dt / 60) % 60))
+-		dh=$((dt / 3600))
+-		printf '%d:%02d:%02d' $dh $dm $ds
+-	fi
+-} #}}}
+-function todaydate() #{{{
+-{
+-	suffix=`date | awk '{printf("%s-%s-%s  %s",$2,$3,$6,$4);}'`			 
+-	echo $suffix;			 
+-} #}}}
+-function host_name() #{{{
+-{
+-	#return host name depending on the OS
+-	if [ "$1" = "win7" ] 
+-	then
+-		HOST_NAME=`hostname | sed 's/-//g'`;
+-	else
+-		HOST_NAME=`hostname -s | sed 's/-//g'`;
+-	fi
+-	echo $HOST_NAME;
+-} #}}}
+-function pause() #{{{
+-{
+-pid=`ps aux -W | grep $1 | awk '{printf("%s\n",$1);}'`
+-
+-while [ -n "$pid" ]
+-do
+-	pid=`ps aux -W | grep $1 | awk '{printf("%s\n",$1);}'`
+-done
+-}
+-#}}}
+-
+-#Get configuration
+-#Source config file{{{
+-if [ $# -ne 1 ];
+-then
+-	#no config file specified: exit
+-	echo "no config file specified. Exiting..." >&2 # Error message to stderr.
+-	exit 1
+-fi
+-if [ ! -f "$1" ]
+-then
+-	echo "File $1 not found!" >&2   # Error message to stderr.
+-	exit 1
+-fi 
+-source $1;
+-#}}}
+-#Export ISSM_* variables{{{
+-export ISSM_DIR
+-export ISSM_ARCH
+-#}}}
+-#Initialize variables {{{
+-TODAY=$(todaydate);
+-HOST_NAME=$(host_name $OS);
+-OS=$(uname -s)
+-START_TIME=$(timer);
+-ISSM_RELEASE=$(basename $(echo $REPOSITORY));
+-USER=$(whoami);
+-INIT_PATH=$(pwd);
+-#}}}
+-
+-#Installation ISSM
+-#create matlab's installation sript {{{
+-cat << END > $ISSM_DIR/externalpackages/matlab/install.sh
+-#!/bin/bash
+-rm -rf install
+-ln -s $MATLAB_PATH install
+-END
+-#}}}
+-#install/copy/none external packages    (ISSM_EXTERNALPACKAGES){{{
+-if [ "$ISSM_EXTERNALPACKAGES" == "install" ]
+-then
+-	
+-	cd $ISSM_DIR/externalpackages
+-
+-	#number of packages: 
+-	NUMPACKAGES=$(($(echo $EXTERNALPACKAGES | wc -w )/2))
+-
+-	for ((i=1;i<=$NUMPACKAGES;i++))
+-	do
+-		NUM1=$((2*$i-1))
+-		NUM2=$((2*$i))
+-		PACKAGENAME=$(echo $EXTERNALPACKAGES | cut -d " " -f $NUM1-$NUM1)
+-		PACKAGEINST=$(echo $EXTERNALPACKAGES | cut -d " " -f $NUM2-$NUM2)
+-
+-		cd $PACKAGENAME
+-		echo "======================================================";
+-		echo "       Installing $PACKAGENAME                        ";
+-		echo "======================================================";
+-		./$PACKAGEINST |  tee compil.log
+-		if [ $? -ne 0 ]; then
+-			echo "======================================================";
+-			echo "    ERROR: installation of $PACKAGENAME failed        ";
+-			echo "======================================================";
+-		fi
+-		source $ISSM_DIR/etc/environment.sh
+-		cd ..
+-	done
+-
+-elif [ "$ISSM_EXTERNALPACKAGES" == "copy" ]
+-then
+-	cd $ISSM_DIR
+-	rm -rf externalpackages
+-	cp -Rf $EXTERNALPACKAGESDIR ./
+-elif [ "$ISSM_EXTERNALPACKAGES" == "link" ]
+-then
+-	cd $ISSM_DIR
+-	rm -rf externalpackages
+-	ln -s  $EXTERNALPACKAGESDIR  .
+-elif [ "$ISSM_EXTERNALPACKAGES" == "none" ]
+-then
+-	echo "Skipping external packages installation"
+-else
+-	echo "ISSM_EXTERNALPACKAGES supported values are: install, copy and none. Exiting..." >&2 # Error message to stderr.
+-	exit 1
+-fi
+-source $ISSM_DIR/etc/environment.sh
+-#}}}
+-#ISSM compilation yes/no                (ISSM_COMPILATION) {{{
+-if [ "$ISSM_COMPILATION" == "yes" ]
+-then
+-	cd $ISSM_DIR
+-	make uninstall
+-	make clean
+-	make distclean
+-	./scripts/automakererun.sh
+-	cat > configure.sh << EOF
+-./configure $ISSM_CONFIG
+-EOF
+-	chmod 700 configure.sh
+-	./configure.sh
+-
+-	#4: compile and install ISSM
+-	if [ $NUMCPUS_INSTALL -gt 1 ]
+-	then
+-		echo "Making with " $NUMCPUS_INSTALL " cpus"
+-		make -j $NUMCPUS_INSTALL install
+-	else
+-		make install
+-	fi
+-elif [ "$ISSM_COMPILATION" == "no" ]
+-then
+-	echo "Skipping ISSM compilation"
+-else
+-	echo "ISSM_COMPILATION supported values are: yes and no. Exiting..." >&2 # Error message to stderr.
+-	exit 1
+-fi
+-#}}}
+-
+-#Prepare info.log
+-#{{{
+-rm -rf $ISSM_DIR/nightlylog
+-mkdir  $ISSM_DIR/nightlylog
+-INSTALL_TIME=$(timer)
+-ELAPSED=$(timer $START_TIME)
+-VERSION=$(svnversion $ISSM_DIR)
+-cat << END > $ISSM_DIR/nightlylog/info.log
+-name:      $(echo $NAME)
+-today:     $(echo $TODAY)
+-user:      $(echo $USER)
+-host:      $(echo $HOST_NAME)
+-OS:        $(echo $OS)
+-release:   $(echo $ISSM_RELEASE)
+-init_path: $(echo $INIT_PATH)
+-is_matlab: $(echo $MATLAB_TEST)
+-is_python: $(echo $PYTHON_TEST)
+-elapsed_install: $(echo $ELAPSED)
+-version: $(echo $VERSION)
+-END
+-#}}}
+-
+-#matlab tests
+-if [ $MATLAB_TEST -eq 1 ]; then
+-#Launch all tests on different cpus {{{
+-MATLAB_START_TIME=$(timer);
+-for (( i=1;i<=$NUMCPUS_RUN;i++ ))
+-do
+-	#Launch matlab and the nightly run script
+-	cat > $ISSM_DIR/nightlylog/matlab_run$i.m << EOF
+-	warning off %necessary to avoid a info.log of several Go for parallel runs
+-	try,
+-	$(if [ "$MATLAB_NROPTIONS" = ""  ]
+-	then
+-		echo "runme('output','nightly','rank',$i,'numprocs',$NUMCPUS_RUN);"
+-	else
+-		echo "runme($MATLAB_NROPTIONS,'output','nightly','rank',$i,'numprocs',$NUMCPUS_RUN);"
+-	fi
+-	)
+-	catch me,
+-		%An error occured, get report and exit
+-		message=getReport(me)
+-		directory=strsplit(pwd,'/');
+-		fid=fopen([issmdir '/nightlylog/matlaberror.log'], 'at');
+-		fprintf(fid,'\nMatlab error occured in: %s\n\n',directory{end});
+-		fprintf(fid,'%s',message);
+-		fclose(fid);
+-	end
+-	disp('MATLABEXITEDCORRECTLY');
+-	exit
+-EOF
+-	cd $ISSM_DIR/test/NightlyRun
+-	matlab -nojvm -nosplash -r "addpath $ISSM_DIR/src/m/dev; devpath; addpath $ISSM_DIR/nightlylog/; matlab_run$i" -logfile $ISSM_DIR/nightlylog/matlab_log$i.log &
+-done
+-
+-#wait until matlab closes
+-if [ "$OS" = "win7" ]; then
+-	pause MATLAB
+-else
+-	wait
+-fi
+-
+-#concatenate reports
+-cd $ISSM_DIR/nightlylog/
+-rm matlab_log.log
+-for (( i=1;i<=$NUMCPUS_RUN;i++ ))
+-do
+-	cat matlab_log$i.log >> matlab_log.log
+-done
+-#}}}
+-#Complete info.log {{{
+-if [ $(cat matlab_log.log | grep "MATLABEXITEDCORRECTLY" | wc -l) -eq $NUMCPUS_RUN ]
+-then
+-	MATLABCRASH=0
+-else
+-	MATLABCRASH=1
+-fi
+-ELAPSED=$(timer $MATLAB_START_TIME)
+-cat << END >>  $ISSM_DIR/nightlylog/info.log
+-elapsed_matlab: $(echo $ELAPSED)
+-matlab_crash:   $(echo $MATLABCRASH)
+-END
+-#}}}
+-fi
+-
+-#python tests
+-if [ $PYTHON_TEST -eq 1 ]; then
+-#Launch all tests on different cpus {{{
+-PYTHON_START_TIME=$(timer);
+-export PYTHONSTARTUP=$ISSM_DIR/src/m/dev/devpath.py
+-for (( i=1;i<=$NUMCPUS_RUN;i++ ))
+-do
+-	cd $ISSM_DIR/test/NightlyRun
+-	./runme.py --output=nightly --rank=$i --numprocs=$NUMCPUS_RUN $PYTHON_NROPTIONS 2>&1 > $ISSM_DIR/nightlylog/python_log$i.log &
+-done
+-
+-#wait until python closes
+-if [ "$OS" = "win7" ]; then
+-	pause MATLAB
+-else
+-	wait
+-fi
+-
+-#concatenate reports
+-cd $ISSM_DIR/nightlylog/
+-rm python_log.log
+-for (( i=1;i<=$NUMCPUS_RUN;i++ ))
+-do
+-	cat python_log$i.log >> python_log.log
+-done
+-#}}}
+-#Complete info.log {{{
+-if [ $(cat python_log.log | grep "PYTHONEXITEDCORRECTLY" | wc -l) -eq $NUMCPUS_RUN ]
+-then
+-	PYTHONCRASH=0
+-else
+-	PYTHONCRASH=1
+-fi
+-ELAPSED=$(timer $PYTHON_START_TIME)
+-cat << END >>  $ISSM_DIR/nightlylog/info.log
+-elapsed_python: $(echo $ELAPSED)
+-python_crash:   $(echo $PYTHONCRASH)
+-END
+-#}}}
+-fi
+-
+-#complete info.log
+-#{{{
+-ELAPSED=$(timer $START_TIME)
+-cat << END >>  $ISSM_DIR/nightlylog/info.log
+-elapsed_total:  $(echo $ELAPSED)
+-END
+-#}}}
+-
+-#Send Report
+-#Build html report {{{
+-cd $ISSM_DIR/nightlylog/
+-sh ../scripts/report.sh
+-echo "html report located in $ISSM_DIR/nightlylog/report.html"
+-#}}}
+-#send mail if requested                  (SKIPMAIL) {{{
+-if [ "$SKIPMAIL" != "yes" ]
+-then
+-	echo "sending report..."
+-	for i in `echo $MAILINGLIST`; do
+-
+-cat - $ISSM_DIR/nightlylog/report.html <<HERE | /usr/lib/sendmail  -oi -t
+-From: "ISSM Nightly run" <$EMAIL_ADRESS>
+-To: $i
+-Subject: ISSM nightly runs report: $NAME
+-Mime-Version: 1.0
+-Content-Type: text/html
+-HERE
+-	done
+-fi
+-#}}}
+-
+-#remove lock file
+-#{{{
+-cd $ISSM_DIR/../
+-rm NIGHTLYLOCK
+-#}}}
Index: issm/oecreview/Archive/16554-17801/ISSM-16606-16607.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16606-16607.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16606-16607.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 16606)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 16607)
+@@ -77,7 +77,7 @@
+ 			}
+ 			else if (!xIsNan<IssmDouble>(iomodel->Data(StressbalanceSpcvzEnum)[i])){
+ 				constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,
+-								iomodel->Data(StressbalanceSpcvzEnum)[i]/yts,StressbalanceVerticalAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
++								iomodel->Data(StressbalanceSpcvzEnum)[i],StressbalanceVerticalAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+ 				count++;
+ 
+ 			}
Index: issm/oecreview/Archive/16554-17801/ISSM-16607-16608.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16607-16608.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16607-16608.diff	(revision 17802)
@@ -0,0 +1,64 @@
+Index: ../trunk-jpl/test/NightlyRun/test1106.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1106.m	(revision 16607)
++++ ../trunk-jpl/test/NightlyRun/test1106.m	(revision 16608)
+@@ -65,7 +65,7 @@
+ 	1e-12,2e-12,2e-12,...
+ 	1e-12,1e-12,1e-12,...
+ 	1e-12,2e-12,2e-12,...
+-	1e-11,2e-12,2e-12,...
++	1e-11,2e-12,3e-12,...
+ 	1e-11,2e-11,2e-12,...
+ };
+ field_values={};
+Index: ../trunk-jpl/test/NightlyRun/test1108.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1108.m	(revision 16607)
++++ ../trunk-jpl/test/NightlyRun/test1108.m	(revision 16608)
+@@ -72,7 +72,7 @@
+ };
+ field_tolerances={...
+ 	1e-07,1e-07,1e-07,...
+-	1e-08,1e-08,1e-08,...
++	1e-08,2e-08,1e-08,...
+ 	1e-08,1e-07,1e-07,...
+ 	1e-08,1e-08,2e-08,...
+ 	1e-08,1e-07,1e-07,...
+Index: ../trunk-jpl/test/NightlyRun/test1110.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1110.m	(revision 16607)
++++ ../trunk-jpl/test/NightlyRun/test1110.m	(revision 16608)
+@@ -115,7 +115,7 @@
+ 	1e-10,1e-09,1e-09,1e-10,...
+ 	1e-10,1e-09,1e-09,1e-10,...
+ 	1e-08,1e-09,1e-08,1e-09,...
+-	1e-08,1e-09,1e-08,1e-09,...
++	1e-08,2e-09,1e-08,1e-09,...
+ };
+ field_values={};
+ for i=1:4,
+Index: ../trunk-jpl/test/NightlyRun/test1208.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1208.m	(revision 16607)
++++ ../trunk-jpl/test/NightlyRun/test1208.m	(revision 16608)
+@@ -30,7 +30,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure','Thickness','Bed','Surface','Temperature','BasalforcingsMeltingRate'};
+-field_tolerances={1e-08,1e-08,1e-07,1e-08,1e-08,1e-08,1e-08,1e-08,1e-07,2e-07};
++field_tolerances={1e-08,1e-08,1e-07,1e-08,1e-08,1e-08,1e-08,1e-08,1e-07,3e-07};
+ field_values={...
+ 	(md.results.TransientSolution(end).Vx),...
+ 	(md.results.TransientSolution(end).Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test212.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test212.m	(revision 16607)
++++ ../trunk-jpl/test/NightlyRun/test212.m	(revision 16608)
+@@ -15,6 +15,7 @@
+ md.inversion.maxiter_per_step=2*ones(md.inversion.nsteps,1);
+ md.inversion.step_threshold=0.3*ones(md.inversion.nsteps,1);
+ md.inversion.vx_obs=md.initialization.vx; md.inversion.vy_obs=md.initialization.vy;
++md.verbose.control=true;
+ 
+ md.cluster=generic('name',oshostname(),'np',3);
+ md=solve(md,StressbalanceSolutionEnum());
Index: issm/oecreview/Archive/16554-17801/ISSM-16608-16609.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16608-16609.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16608-16609.diff	(revision 17802)
@@ -0,0 +1,42 @@
+Index: ../trunk-jpl/test/NightlyRun/test1502.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1502.m	(revision 16608)
++++ ../trunk-jpl/test/NightlyRun/test1502.m	(revision 16609)
+@@ -1,26 +1,25 @@
+ printingflag = false;
+ 
+-md=triangle(model(),'../Exp/Square.exp',450000.);
++md=triangle(model(),'../Exp/Square.exp',350000.);
+ md=setmask(md,'all','');
+ md=parameterize(md,'../Par/SquareShelf.par');
+ md=setflowequation(md,'SSA','all');
+-%md=extrude(md,3,1.);
++md=extrude(md,3,1.);
+ md.cluster=generic('name',oshostname(),'np',1);
+ md.transient.isthermal=0;
+ 
+-%md.timestepping.time_step=1.;
+-%md.settings.output_frequency=1;
+-%md.timestepping.final_time=2000.;
++md.timestepping.time_step=1.;
++md.settings.output_frequency=1;
++md.timestepping.final_time=2000.;
+ 
+ %Solve for thinning rate -> -1 * surface mass balance
+ smb= 2.*ones(md.mesh.numberofvertices,1);
+-%md.surfaceforcings.mass_balance= smb;
+-%md.basalforcings.melting_rate= smb;
++md.surfaceforcings.mass_balance= smb;
++md.basalforcings.melting_rate= smb;
+ md.verbose=verbose('all');
+ 
+ md=solve(md,MasstransportSolutionEnum());
+ 
+-error
+ for i=1:10
+ 	 md=solve(md,MasstransportSolutionEnum());
+ 	 md.surfaceforcings.mass_balance= md.surfaceforcings.mass_balance - ((md.results.MasstransportSolution.Thickness)-md.geometry.thickness);
+Index: ../trunk-jpl/test/Archives/Archive1502.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-16609-16610.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16609-16610.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16609-16610.diff	(revision 17802)
@@ -0,0 +1,19 @@
+Index: ../trunk-jpl/externalpackages/mpich/install-3.0-macosx64.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/mpich/install-3.0-macosx64.sh	(revision 16609)
++++ ../trunk-jpl/externalpackages/mpich/install-3.0-macosx64.sh	(revision 16610)
+@@ -19,11 +19,10 @@
+ cd src
+ ./configure \
+ 	--prefix="$ISSM_DIR/externalpackages/mpich/install" \
+-	--enable-shared \
+-	CC=llvm-gcc \
+-	FC=gfortran \
+-	F77=gfortran 
++	--enable-shared
+ 
++	#CC=llvm-gcc \
++
+ #Compile mpich (this new version supports parallel make)
+ if [ $# -eq 0 ]; then
+ 	make
Index: issm/oecreview/Archive/16554-17801/ISSM-16610-16611.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16610-16611.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16610-16611.diff	(revision 17802)
@@ -0,0 +1,45 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 16610)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 16611)
+@@ -347,6 +347,7 @@
+ 	IssmDouble Jdet;
+ 	IssmDouble xyz_list[NUMVERTICES][3];
+ 	IssmDouble value;
++	Input*     input  = NULL;
+ 	Input*     input2 = NULL;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -359,13 +360,10 @@
+ 	/*Retrieve all inputs and parameters*/
+ 	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&input_enum,InputToL2ProjectEnum);
+-	Input* input = inputs->GetInput(input_enum);
+-	if(!input){
+-		switch(input_enum){
+-			case SurfaceSlopeXEnum: input2 = inputs->GetInput(SurfaceEnum); _assert_(input2); break;
+-			case BedSlopeXEnum:     input2 = inputs->GetInput(BedEnum);     _assert_(input2); break;
+-			default: _error_("input not found in element");
+-		}
++	switch(input_enum){
++		case SurfaceSlopeXEnum: input2 = inputs->GetInput(SurfaceEnum); _assert_(input2); break;
++		case BedSlopeXEnum:     input2 = inputs->GetInput(BedEnum);     _assert_(input2); break;
++		default: input = inputs->GetInput(input_enum);
+ 	}
+ 
+ 	/* Start  looping on the number of gaussian points: */
+@@ -377,11 +375,11 @@
+ 		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+ 		GetNodalFunctions(basis,gauss);
+ 
+-		if(input){
+-			input->GetInputValue(&value,gauss);
++		if(input2){
++			input2->GetInputDerivativeValue(&value,&xyz_list[0][0],gauss);
+ 		}
+ 		else{
+-			input2->GetInputDerivativeValue(&value,&xyz_list[0][0],gauss);
++			input->GetInputValue(&value,gauss);
+ 		}
+ 
+ 		for(i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*value*basis[i];
Index: issm/oecreview/Archive/16554-17801/ISSM-16611-16612.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16611-16612.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16611-16612.diff	(revision 17802)
@@ -0,0 +1,245 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16611)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16612)
+@@ -195,6 +195,9 @@
+ 		iomodel->FetchDataToInput(elements,VzEnum,0.);
+ 		if(dakota_analysis)elements->InputDuplicate(VzEnum,QmuVzEnum);
+ 	}
++	if(iomodel->meshtype==Mesh2DverticalEnum){
++	      iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
++	}
+ 	if(isFS){
+ 		iomodel->FetchDataToInput(elements,MeshVertexonbedEnum);
+ 		iomodel->FetchDataToInput(elements,PressureEnum,0.);
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16611)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16612)
+@@ -320,6 +320,7 @@
+ 	MasstransportSolutionEnum,
+ 	FreeSurfaceBaseAnalysisEnum,
+ 	FreeSurfaceTopAnalysisEnum,
++	SurfaceNormalVelocityEnum,
+ 	ExtrudeFromBaseAnalysisEnum,
+ 	ExtrudeFromTopAnalysisEnum,
+ 	SteadystateSolutionEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 16611)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 16612)
+@@ -326,6 +326,7 @@
+ 		case MasstransportSolutionEnum : return "MasstransportSolution";
+ 		case FreeSurfaceBaseAnalysisEnum : return "FreeSurfaceBaseAnalysis";
+ 		case FreeSurfaceTopAnalysisEnum : return "FreeSurfaceTopAnalysis";
++		case SurfaceNormalVelocityEnum : return "SurfaceNormalVelocity";
+ 		case ExtrudeFromBaseAnalysisEnum : return "ExtrudeFromBaseAnalysis";
+ 		case ExtrudeFromTopAnalysisEnum : return "ExtrudeFromTopAnalysis";
+ 		case SteadystateSolutionEnum : return "SteadystateSolution";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 16611)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 16612)
+@@ -332,6 +332,7 @@
+ 	      else if (strcmp(name,"MasstransportSolution")==0) return MasstransportSolutionEnum;
+ 	      else if (strcmp(name,"FreeSurfaceBaseAnalysis")==0) return FreeSurfaceBaseAnalysisEnum;
+ 	      else if (strcmp(name,"FreeSurfaceTopAnalysis")==0) return FreeSurfaceTopAnalysisEnum;
++	      else if (strcmp(name,"SurfaceNormalVelocity")==0) return SurfaceNormalVelocityEnum;
+ 	      else if (strcmp(name,"ExtrudeFromBaseAnalysis")==0) return ExtrudeFromBaseAnalysisEnum;
+ 	      else if (strcmp(name,"ExtrudeFromTopAnalysis")==0) return ExtrudeFromTopAnalysisEnum;
+ 	      else if (strcmp(name,"SteadystateSolution")==0) return SteadystateSolutionEnum;
+@@ -381,11 +382,11 @@
+ 	      else if (strcmp(name,"DoubleVecParam")==0) return DoubleVecParamEnum;
+ 	      else if (strcmp(name,"Element")==0) return ElementEnum;
+ 	      else if (strcmp(name,"ExternalResult")==0) return ExternalResultEnum;
+-	      else if (strcmp(name,"FileParam")==0) return FileParamEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"Input")==0) return InputEnum;
++	      if (strcmp(name,"FileParam")==0) return FileParamEnum;
++	      else if (strcmp(name,"Input")==0) return InputEnum;
+ 	      else if (strcmp(name,"IntInput")==0) return IntInputEnum;
+ 	      else if (strcmp(name,"InputToExtrude")==0) return InputToExtrudeEnum;
+ 	      else if (strcmp(name,"InputToL2Project")==0) return InputToL2ProjectEnum;
+@@ -504,11 +505,11 @@
+ 	      else if (strcmp(name,"ViscousHeating")==0) return ViscousHeatingEnum;
+ 	      else if (strcmp(name,"QmuTemperature")==0) return QmuTemperatureEnum;
+ 	      else if (strcmp(name,"HydrologyWaterVx")==0) return HydrologyWaterVxEnum;
+-	      else if (strcmp(name,"HydrologyWaterVy")==0) return HydrologyWaterVyEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"StressTensor")==0) return StressTensorEnum;
++	      if (strcmp(name,"HydrologyWaterVy")==0) return HydrologyWaterVyEnum;
++	      else if (strcmp(name,"StressTensor")==0) return StressTensorEnum;
+ 	      else if (strcmp(name,"StressTensorxx")==0) return StressTensorxxEnum;
+ 	      else if (strcmp(name,"StressTensorxy")==0) return StressTensorxyEnum;
+ 	      else if (strcmp(name,"StressTensorxz")==0) return StressTensorxzEnum;
+Index: ../trunk-jpl/src/c/cores/surfaceslope_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/surfaceslope_core.cpp	(revision 16611)
++++ ../trunk-jpl/src/c/cores/surfaceslope_core.cpp	(revision 16612)
+@@ -31,6 +31,10 @@
+ 		femmodel->parameters->SetParam(SurfaceSlopeYEnum,InputToL2ProjectEnum);
+ 		solutionsequence_linear(femmodel);
+ 	}
++	if(meshtype==Mesh2DverticalEnum){
++	      femmodel->parameters->SetParam(SurfaceSlopeXEnum,InputToExtrudeEnum);
++		extrudefrombase_core(femmodel);
++	}
+ 
+ 	if(save_results){
+ 		if(VerboseSolution()) _printf0_("saving results:\n");
+Index: ../trunk-jpl/src/c/cores/stressbalance_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/stressbalance_core.cpp	(revision 16611)
++++ ../trunk-jpl/src/c/cores/stressbalance_core.cpp	(revision 16612)
+@@ -47,7 +47,7 @@
+ 	}
+ 
+ 	/*Compute slopes: */
+-	if(isSIA) surfaceslope_core(femmodel);
++	if(isSIA || (isFS && meshtype==Mesh2DverticalEnum)) surfaceslope_core(femmodel);
+ 	if(isFS){
+ 		bedslope_core(femmodel);
+ 		femmodel->SetCurrentConfiguration(StressbalanceAnalysisEnum);
+Index: ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp	(revision 16611)
++++ ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp	(revision 16612)
+@@ -25,12 +25,13 @@
+ 	switch(solutiontype){
+ 
+ 		case StressbalanceSolutionEnum:
+-			numanalyses=4;
++			numanalyses=5;
+ 			analyses=xNew<int>(numanalyses);
+ 			analyses[0]=StressbalanceAnalysisEnum;
+ 			analyses[1]=StressbalanceVerticalAnalysisEnum;
+ 			analyses[2]=StressbalanceSIAAnalysisEnum;
+ 			analyses[3]=L2ProjectionBaseAnalysisEnum;
++			analyses[4]=ExtrudeFromBaseAnalysisEnum;
+ 			break;
+ 
+ 		case SteadystateSolutionEnum:
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16611)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16612)
+@@ -2454,6 +2454,10 @@
+ 				this->ComputeStressTensor();
+ 				input=this->inputs->GetInput(output_enum);
+ 				break;
++      		case SurfaceNormalVelocityEnum:
++			      this->ComputeSurfaceNormalVelocity();
++				input=this->inputs->GetInput(output_enum);
++				break;
+ 			default:
+ 				_error_("input "<<EnumToStringx(output_enum)<<" not found in element");
+ 		}
+@@ -2485,6 +2489,9 @@
+ 			for(int i=0;i<NUMVERTICES;i++) values[i] = values[i]/reCast<IssmDouble>(connectivity[i]);
+ 
+ 			vector->SetValues(NUMVERTICES,&sidlist[0],&values[0],ADD_VAL);
++			
++			this->inputs->DeleteInput(SurfaceNormalVelocityEnum);
++
+ 			break;
+ 					}
+ 		default:
+@@ -2643,6 +2650,53 @@
+ 	*(surface_normal+2) = normal[2]/normal_norm;
+ }
+ /*}}}*/
++/*FUNCTION Tria::ComputeSurfaceNormalVelocity{{{*/
++void Tria::ComputeSurfaceNormalVelocity(){
++
++  IssmDouble      sum,tangential_vector[2],normal_vector[2],time,ux,uy;
++  IssmDouble      normal_velocity[NUMVERTICES],xyz_list[NUMVERTICES][3];
++  IssmDouble      value[NUMVERTICES],verticesonsurface[NUMVERTICES];
++
++  for(int iv=0;iv<NUMVERTICES;iv++){
++    normal_velocity[iv]=0.;
++    value[iv]=0.;
++  }
++
++  GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++
++  GaussTria* gauss=new GaussTria();
++  Input* slope_input=inputs->GetInput(SurfaceSlopeXEnum); _assert_(slope_input);
++  //  Input* slope_input= inputs->GetInput(SurfaceEnum); _assert_(slope_input);
++  Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
++  Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
++
++
++  /*Get list of nodes on surface*/
++  GetInputListOnVertices(&verticesonsurface[0],MeshVertexonsurfaceEnum);  
++  sum = verticesonsurface[0]+verticesonsurface[1]+verticesonsurface[2];
++  _assert_(sum==0. || sum==1. || sum==2.);
++
++  /*Compute normal velocity for surface nodes from L2 projected slope*/
++  for(int iv=0;iv<NUMVERTICES;iv++){
++    if(verticesonsurface[iv] == 1){
++	gauss->GaussNode(P1Enum,iv);	
++	slope_input->GetInputValue(&value[iv],gauss);
++	//	slope_input->GetInputDerivativeValue(&value[iv],&xyz_list[0][0],gauss);
++	vx_input->GetInputValue(&ux,gauss);
++	vy_input->GetInputValue(&uy,gauss);
++	tangential_vector[0]=sqrt(1./(pow(value[iv],2.)+1.));
++	tangential_vector[1]=value[iv]*tangential_vector[0];
++	normal_vector[0]=-1.*tangential_vector[1];
++	normal_vector[1]=tangential_vector[0];
++     	normal_velocity[iv]=ux*normal_vector[0]+uy*normal_vector[1];
++    }
++  }
++
++  delete gauss;
++  this->inputs->AddInput(new TriaInput(SurfaceNormalVelocityEnum,&normal_velocity[0],P1Enum));
++
++}
++/*}}}*/
+ /*FUNCTION Tria::TimeAdapt{{{*/
+ IssmDouble  Tria::TimeAdapt(void){
+ 
+@@ -3223,7 +3277,7 @@
+ 	/*Now get the average SMB over the element*/
+ 	Input* smb_input = inputs->GetInput(SurfaceforcingsMassBalanceEnum); _assert_(smb_input);
+ 	smb_input->GetInputAverage(&smb);																								// average smb on element in m ice s-1
+-   Total_Smb=rho_ice*base*smb;																											// smb on element in kg s-1
++	Total_Smb=rho_ice*base*smb;																											// smb on element in kg s-1
+ 
+ 	/*Return: */
+ 	return Total_Smb;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16611)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16612)
+@@ -69,6 +69,7 @@
+ 		void        ComputeBasalStress(Vector<IssmDouble>* sigma_b);
+ 		void        ComputeStrainRate(Vector<IssmDouble>* eps);
+ 		void        ComputeStressTensor();
++		void        ComputeSurfaceNormalVelocity();
+ 		void        Configure(Elements* elements,Loads* loads,Nodes* nodesin,Vertices* verticesin,Materials* materials,Parameters* parameters);
+ 		void        SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters);
+ 		void        SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum);
+@@ -240,7 +241,6 @@
+ 		void	         SetClone(int* minranks);
+ 		Seg*	         SpawnSeg(int index1,int index2);
+ 		void	         SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]);
+-
+ 		#ifdef _HAVE_STRESSBALANCE_
+ 		ElementMatrix* CreateKMatrixStressbalanceSSA(void);
+ 		ElementMatrix* CreateKMatrixStressbalanceSSAViscous(void);
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 16611)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 16612)
+@@ -318,6 +318,7 @@
+ def MasstransportSolutionEnum(): return StringToEnum("MasstransportSolution")[0]
+ def FreeSurfaceBaseAnalysisEnum(): return StringToEnum("FreeSurfaceBaseAnalysis")[0]
+ def FreeSurfaceTopAnalysisEnum(): return StringToEnum("FreeSurfaceTopAnalysis")[0]
++def SurfaceNormalVelocityEnum(): return StringToEnum("SurfaceNormalVelocity")[0]
+ def ExtrudeFromBaseAnalysisEnum(): return StringToEnum("ExtrudeFromBaseAnalysis")[0]
+ def ExtrudeFromTopAnalysisEnum(): return StringToEnum("ExtrudeFromTopAnalysis")[0]
+ def SteadystateSolutionEnum(): return StringToEnum("SteadystateSolution")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-16612-16613.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16612-16613.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16612-16613.diff	(revision 17802)
@@ -0,0 +1,14 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16612)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16613)
+@@ -2490,8 +2490,8 @@
+ 
+ 			vector->SetValues(NUMVERTICES,&sidlist[0],&values[0],ADD_VAL);
+ 			
++			/*FIXME: Inputs needs to be updated first in Tria::ResultInterpolation, this is a hack*/
+ 			this->inputs->DeleteInput(SurfaceNormalVelocityEnum);
+-
+ 			break;
+ 					}
+ 		default:
Index: issm/oecreview/Archive/16554-17801/ISSM-16613-16614.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16613-16614.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16613-16614.diff	(revision 17802)
@@ -0,0 +1,189 @@
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16613)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16614)
+@@ -180,7 +180,7 @@
+ 	MaterialsMuWaterEnum,
+ 	MaterialsThermalExchangeVelocityEnum,
+ 	MaterialsThermalconductivityEnum,
+-  MaterialsTemperateiceconductivityEnum,
++  	MaterialsTemperateiceconductivityEnum,
+ 	MaterialsLithosphereShearModulusEnum,
+ 	MaterialsLithosphereDensityEnum,
+ 	MaterialsMantleShearModulusEnum,
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 16613)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 16614)
+@@ -386,48 +386,52 @@
+ /*}}}*/
+ /*FUNCTION Matpar::GetEnthalpyDiffusionParameter{{{*/
+ IssmDouble Matpar::GetEnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure){
+-	/*if (enthalpy<=PureIceEnthalpy(pressure))
++	if (enthalpy<PureIceEnthalpy(pressure))
+ 		return thermalconductivity/heatcapacity;
+ 	else
+-		return thermalconductivity/heatcapacity*pow(10.,-5);
+-	*/
++		return temperateiceconductivity/heatcapacity;
++}
++/*}}}*/
++/*FUNCTION Matpar::GetEnthalpyDiffusionParameterVolume{{{*/
++IssmDouble Matpar::GetEnthalpyDiffusionParameterVolume(IssmDouble enthalpy[6], IssmDouble pressure[6]){
+ 
+-	IssmDouble eps=0.1*heatcapacity;
+-	IssmDouble hpmp=PureIceEnthalpy(pressure);
+-	IssmDouble kappa_c=thermalconductivity/heatcapacity;
+-	IssmDouble kappa_t=temperateiceconductivity/heatcapacity;
+-	
+-	if(enthalpy<=hpmp-eps)
+-		return kappa_c;
+-	else if(enthalpy>=hpmp+eps)
+-		return kappa_t;
+-	else {
+-		IssmDouble xi=enthalpy-hpmp;
+-		IssmDouble pi=3.141592653589793238462643;
+-		return kappa_c + (kappa_t-kappa_c)*((xi+eps)/(2*eps) + sin(pi*xi/eps)/(2*pi));
++	IssmDouble lambda; // fraction of cold ice
++	IssmDouble kappa,kappa_c, kappa_t;
++	IssmDouble Hc, Ht;
++	IssmDouble PIE[6], dHpmp[6];
++	int iv;
++
++	for (iv=0; iv<6; iv++){
++		PIE[iv]=PureIceEnthalpy(pressure[iv]);
++		dHpmp[iv]=enthalpy[iv]-PIE[iv];
+ 	}
+ 
+-	//return 1./(1.+exp(-(enthalpy-(hpmp))/eps))*(kappa_t-kappa_c) + kappa_c;
+-}
+-/*}}}*/
+-/*FUNCTION Matpar::GetEnthalpyDiffusionParameterVolume{{{*/
+-IssmDouble Matpar::GetEnthalpyDiffusionParameterVolume(IssmDouble enthalpy0, IssmDouble enthalpy1, IssmDouble pressure0, IssmDouble pressure1){
+-	/*returns kappa depending on distribution of enthalpy over edge of element
+-		lambda is the barycentric coordinate that solves H0+(H1-H0)*lambda=H_pureice.
+-		it represents the fraction of the ice column which is temperate/cold like H0.
+-		if lambda<0 or lambda>1, then the whole ice column is cold or temperate, respectively.
+-	*/
+-	IssmDouble kappa, kappa0, kappa1;
+-	if (enthalpy0!=enthalpy1){
+-		IssmDouble lambda=(PureIceEnthalpy(pressure0)-enthalpy0)/(enthalpy1-enthalpy0);
+-		if ((lambda>=0.) && (lambda<=1.)){
+-			kappa0=GetEnthalpyDiffusionParameter(enthalpy0,pressure0);
+-			kappa1=GetEnthalpyDiffusionParameter(enthalpy1,pressure1);
+-			kappa=lambda*kappa0+(1.-lambda)*kappa1;
++	bool allequalsign=true;
++	if(dHpmp[0]<0)
++		for(iv=1; iv<6;iv++)
++			allequalsign=(allequalsign && (dHpmp[iv]<0));
++	else
++		for(iv=1; iv<6;iv++)
++			allequalsign=(allequalsign && (dHpmp[iv]>=0));
++
++	if(allequalsign){
++		kappa=GetEnthalpyDiffusionParameter(enthalpy[0], pressure[0]);
++	}
++	else {
++		/* return harmonic mean of thermal conductivities, weighted by fraction of cold/temperate ice*/
++		kappa_c=GetEnthalpyDiffusionParameter(PureIceEnthalpy(0.)-1.,0.);
++		kappa_t=GetEnthalpyDiffusionParameter(PureIceEnthalpy(0.)+1.,0.);
++		Hc=0.; Ht=0.;
++		for(iv=0; iv<6;iv++){
++			if(enthalpy[iv]<PIE[iv])
++				Hc+=(PIE[iv]-enthalpy[iv]);
++			else
++				Ht+=(enthalpy[iv]-PIE[iv]);
+ 		}
++		_assert_((Hc+Ht)>0.);
++		lambda=Hc/(Hc+Ht);
++		kappa=1./(lambda/kappa_c + (1.-lambda)/kappa_t);
+ 	}
+-	else
+-		kappa=GetEnthalpyDiffusionParameter(enthalpy0, pressure0);
+ 	return kappa;
+ }
+ /*}}}*/
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 16613)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 16614)
+@@ -127,7 +127,7 @@
+ 		IssmDouble TMeltingPoint(IssmDouble pressure);
+ 		IssmDouble PureIceEnthalpy(IssmDouble pressure);
+ 		IssmDouble GetEnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure);
+-		IssmDouble GetEnthalpyDiffusionParameterVolume(IssmDouble enthalpy0, IssmDouble enthalpy1, IssmDouble pressure0, IssmDouble pressure1);
++		IssmDouble GetEnthalpyDiffusionParameterVolume(IssmDouble enthalpy[6], IssmDouble pressure[6]);
+ 		IssmDouble GetLithosphereShearModulus();
+ 		IssmDouble GetLithosphereDensity();
+ 		IssmDouble GetMantleShearModulus();
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16613)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16614)
+@@ -3775,7 +3775,7 @@
+ 	IssmDouble gravity,rho_ice,rho_water;
+ 	IssmDouble epsvel=2.220446049250313e-16;
+ 	IssmDouble heatcapacity,thermalconductivity,dt;
+-	IssmDouble pressure,enthalpy;
++	IssmDouble pressure[NUMVERTICES],enthalpy[NUMVERTICES];
+ 	IssmDouble latentheat,kappa;
+ 	IssmDouble tau_parameter,diameter;
+ 	IssmDouble xyz_list[NUMVERTICES][3];
+@@ -3814,7 +3814,7 @@
+ 	if (stabilization==2) diameter=MinEdgeLength(xyz_list);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(3,3);
++	gauss=new GaussPenta(2,2);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 
+ 		gauss->GaussPoint(ig);
+@@ -3824,9 +3824,11 @@
+ 		/*Conduction: */  
+ 		GetBConduct(&B_conduct[0][0],&xyz_list[0][0],gauss); 
+ 
+-		enthalpy_input->GetInputValue(&enthalpy, gauss);
+-		pressure_input->GetInputValue(&pressure, gauss);
+-		kappa=matpar->GetEnthalpyDiffusionParameter(enthalpy,pressure); _assert_(kappa>0.);
++		//enthalpy_input->GetInputValue(&enthalpy, gauss);
++		//pressure_input->GetInputValue(&pressure, gauss);
++		GetInputListOnVertices(&enthalpy[0],EnthalpyPicardEnum);
++		GetInputListOnVertices(&pressure[0],PressureEnum);
++		kappa=matpar->GetEnthalpyDiffusionParameterVolume(enthalpy,pressure); _assert_(kappa>0.);  // TODO: switch to pointers
+ 
+ 		D_scalar_conduct=gauss->weight*Jdet*kappa/rho_ice;
+ 		if(reCast<bool,IssmDouble>(dt)) D_scalar_conduct=D_scalar_conduct*dt;
+@@ -4230,7 +4232,8 @@
+ 	IssmDouble rho_ice,heatcapacity;
+ 	IssmDouble thermalconductivity,kappa;
+ 	IssmDouble viscosity,pressure;
+-	IssmDouble enthalpy,enthalpypicard;
++	IssmDouble enthalpy;
++	IssmDouble enthalpy_v[NUMVERTICES], pressure_v[NUMVERTICES];
+ 	IssmDouble tau_parameter,diameter;
+ 	IssmDouble u,v,w;
+ 	IssmDouble scalar_def,scalar_transient;
+@@ -4296,9 +4299,11 @@
+ 			vx_input->GetInputValue(&u, gauss);
+ 			vy_input->GetInputValue(&v, gauss);
+ 			vz_input->GetInputValue(&w, gauss);
+-			pressure_input->GetInputValue(&pressure, gauss);
+-			enthalpypicard_input->GetInputValue(&enthalpypicard, gauss);
+-			kappa=matpar->GetEnthalpyDiffusionParameter(enthalpy,pressure);
++			//pressure_input->GetInputValue(&pressure, gauss);
++			//enthalpypicard_input->GetInputValue(&enthalpypicard, gauss);
++			GetInputListOnVertices(&enthalpy_v[0],EnthalpyPicardEnum);
++			GetInputListOnVertices(&pressure_v[0],PressureEnum);
++			kappa=matpar->GetEnthalpyDiffusionParameterVolume(enthalpy_v,pressure_v);
+ 			kappa/=rho_ice;
+ 			tau_parameter=GetStabilizationParameter(u,v,w,diameter,kappa); 
+ 
+@@ -5020,7 +5025,7 @@
+ 			if(istemperatelayer) for(i=0;i<3;i++) vec_heatflux[i]=0.; // TODO: add -k*nabla T_pmp
+ 			else{
+ 				enthalpy_input->GetInputDerivativeValue(&d1enthalpy[0],&xyz_list[0][0],gauss);
+-				kappa=matpar->GetEnthalpyDiffusionParameterVolume(enthalpy[iv],enthalpy[iv+NUMVERTICES2D], pressure[iv],pressure[iv+NUMVERTICES2D]); _assert_(kappa>0.);
++				kappa=matpar->GetEnthalpyDiffusionParameterVolume(enthalpy, pressure); _assert_(kappa>0.);
+ 				for(i=0;i<3;i++) vec_heatflux[i]=-kappa*d1enthalpy[i];
+ 			}
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16614-16615.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16614-16615.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16614-16615.diff	(revision 17802)
@@ -0,0 +1,32 @@
+Index: ../trunk-jpl/test/Archives/Archive327.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive120.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive432.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive325.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive121.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive326.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive122.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive431.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-16615-16616.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16615-16616.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16615-16616.diff	(revision 17802)
@@ -0,0 +1,677 @@
+Index: ../trunk-jpl/jenkins/linux64_murdo
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo	(revision 0)
++++ ../trunk-jpl/jenkins/linux64_murdo	(revision 16616)
+@@ -0,0 +1,106 @@
++#
++########### Configuration file for Eric Larour's Jenkins run on Murdo ############
++
++#-------------------------------#
++# 1: ISSM general configuration #
++#-------------------------------#
++
++#Nightly run name
++NAME="ISSM matlab tests on Linux64 (murdo)"
++
++#ISSM Architecture
++ISSM_ARCH="linux-gnu-amd64"
++
++#ISSM CONFIGURATION 
++ISSM_CONFIG='--prefix=$ISSM_DIR\
++	--with-matlab-dir=$MATLAB_DIR \
++	--with-triangle-dir=$ISSM_DIR/externalpackages/triangle/install \
++	--with-metis-dir=$ISSM_DIR/externalpackages/metis/install \
++	--with-mpi-include=$ISSM_DIR/externalpackages/mpich/install/include  \
++	--with-mpi-libflags="-L$ISSM_DIR/externalpackages/mpich/install/lib/ -lmpich" \
++	--with-petsc-dir=$ISSM_DIR/externalpackages/petsc/install \
++	--with-petsc-arch=$ISSM_ARCH \
++	--with-mumps-dir=$ISSM_DIR/externalpackages/petsc/install/ \
++	--with-blas-lapack-dir=$ISSM_DIR/externalpackages/petsc/install \
++	--with-chaco-dir="$ISSM_DIR/externalpackages/chaco/install" \
++	--with-numthreads=18 \
++	--with-cxxoptflags="-mtune=barcelona -ffast-math -O3 -msse4.2 -Wno-write-strings "\
++	--with-graphics-lib="/usr/lib/x86_64-linux-gnu/libX11.so" \
++	--with-tao-dir=$ISSM_DIR/externalpackages/tao/install \
++	--enable-debugging '
++
++#MATLAB path
++MATLAB_PATH="/usr/local/matlab80/"
++
++#PYTHON and MATLAB testing
++MATLAB_TEST=1
++PYTHON_TEST=0
++
++#execution path used for parallel runs
++EXECUTION_PATH=$ISSM_DIR/execution
++
++#-----------------------------------#
++# 3: External packages installation #
++#-----------------------------------#
++
++#ISSM_EXTERNALPACKAGES can have 3 values:
++# - "install" install all external packages listed below
++# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
++# - "none"    leave external packages as is
++#             ->skip to section 4
++ISSM_EXTERNALPACKAGES="install"
++EXTERNALPACKAGESDIR=$ISSM_DIR/externalpackages
++
++#List of external pakages to be installed and their installation scripts
++EXTERNALPACKAGES="autotools install.sh                
++						matlab    install.sh                
++						mpich     install-3.0-linux64.sh    
++						cmake     install.sh                
++						petsc     install-3.4-linux64.sh    
++						triangle  install-linux64.sh        
++						boost     install.sh                
++						dakota    install-5.3.1-linux64.sh  
++						tao       install-2.2.sh
++						chaco     install.sh 
++						shell2junit install.sh"
++
++#---------------------#
++# 4: ISSM Compilation #
++#---------------------#
++
++#ISSM_COMPILATION can have 2 values:
++# - "yes" compile ISSM
++# - "no"  do not compile ISSM
++ISSM_COMPILATION="yes"
++
++#----------------------#
++# 5: Mail notification #
++#----------------------#
++
++#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
++#sent to the adresses present in $ISSM_DIR/cron/mailinglist.
++SKIPMAIL="no"
++
++#Sender email address
++EMAIL_ADRESS="eric.larour@jpl.nasa.gov"
++
++#Mailing list
++MAILINGLIST="eric.larour@jpl.nasa.gov"
++
++#------------------------#
++# 6: Nightly run options #
++#------------------------#
++
++#number of cpus used in ISSM installation and compilation (one is usually
++#safer as some packages are very sensitive to parallel compilation)
++NUMCPUS_INSTALL=8
++
++#number of cpus used in the nightly runs.
++NUMCPUS_RUN=8
++
++#Nightly run options. The matlab routine runme.m will be called
++#as follows: runme($MATLAB_NROPTIONS). The options must be understandable
++#by Matlab and runme.m
++#ex: "'id',[101 102 103]"
++MATLAB_NROPTIONS=""
++PYTHON_NROPTIONS=""
+
+Property changes on: ../trunk-jpl/jenkins/linux64_murdo
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/jenkins/imac
+===================================================================
+--- ../trunk-jpl/jenkins/imac	(revision 0)
++++ ../trunk-jpl/jenkins/imac	(revision 16616)
+@@ -0,0 +1,105 @@
++#
++########### Configuration file for Eric Larour's Jenkins run on MaxOSX ############
++
++#-------------------------------#
++# 1: ISSM general configuration #
++#-------------------------------#
++
++#Nightly run name
++NAME="ISSM matlab tests on MacOSX"
++
++#ISSM Architecture
++ISSM_ARCH="macosx-gnu"
++
++#ISSM CONFIGURATION 
++ISSM_CONFIG='--prefix=$ISSM_DIR \
++	--with-matlab-dir=$MATLAB_DIR \
++	--with-triangle-dir=$ISSM_DIR/externalpackages/triangle/install \
++	--with-metis-dir=$ISSM_DIR/externalpackages/metis/install \
++	--with-mpi-include=$ISSM_DIR/externalpackages/mpich/install/include  \
++	--with-mpi-libflags=" $ISSM_DIR/externalpackages/mpich/install/lib/libpmpich.a $ISSM_DIR/externalpackages/mpich/install/lib/libmpich.a $ISSM_DIR/externalpackages/mpich/install/lib/libmpl.a " \
++	--with-fortran-lib="/usr/local/gfortran/lib/libgfortran.a" \
++	--with-math-lib="/usr/lib/libm.dylib" \
++	--with-graphics-lib="/usr/X11/lib/libX11.dylib" \
++	--with-cxxoptflags=" -fno-common -no-cpp-precomp -fexceptions -arch x86_64 -mmacosx-version-min=10.5  -O3 -DNDEBUG -w "\
++	--with-numthreads=8 \
++	--with-petsc-dir=$ISSM_DIR/externalpackages/petsc/install  \
++	--with-petsc-arch=$ISSM_ARCH \
++	--with-blas-lapack-dir=$ISSM_DIR/externalpackages/petsc/install \
++	--with-scalapack-dir=$ISSM_DIR/externalpackages/petsc/install/ \
++	--with-mumps-dir=$ISSM_DIR/externalpackages/petsc/install \
++	--with-tao-dir=$ISSM_DIR/externalpackages/tao/install'
++
++#MATLAB path
++MATLAB_PATH="/Applications/MATLAB_R2011b.app/"
++
++#PYTHON and MATLAB testing
++MATLAB_TEST=1
++PYTHON_TEST=0
++
++#execution path used for parallel runs
++EXECUTION_PATH=$ISSM_DIR/execution
++
++#-----------------------------------#
++# 3: External packages installation #
++#-----------------------------------#
++
++#ISSM_EXTERNALPACKAGES can have 3 values:
++# - "install" install all external packages listed below
++# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
++# - "none"    leave external packages as is
++#             ->skip to section 4
++ISSM_EXTERNALPACKAGES="install"
++EXTERNALPACKAGESDIR=$ISSM_DIR/externalpackages
++
++#List of external pakages to be installed and their installation scripts
++EXTERNALPACKAGES="autotools install.sh                
++						matlab    install.sh                
++						mpich     install-3.0-macosx64.sh    
++						cmake     install.sh                
++						petsc     install-3.4-macosx64.sh    
++						tao       install-2.2.sh
++						triangle  install-macosx64.sh 
++						shell2junit  install.sh "
++
++
++#---------------------#
++# 4: ISSM Compilation #
++#---------------------#
++
++#ISSM_COMPILATION can have 2 values:
++# - "yes" compile ISSM
++# - "no"  do not compile ISSM
++ISSM_COMPILATION="yes"
++
++#----------------------#
++# 5: Mail notification #
++#----------------------#
++
++#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
++#sent to the adresses present in $ISSM_DIR/cron/mailinglist.
++SKIPMAIL="no"
++
++#Sender email address
++EMAIL_ADRESS="eric.larour@jpl.nasa.gov"
++
++#Mailing list
++MAILINGLIST="eric.larour@jpl.nasa.gov"
++
++#------------------------#
++# 6: Nightly run options #
++#------------------------#
++
++#number of cpus used in ISSM installation and compilation (one is usually
++#safer as some packages are very sensitive to parallel compilation)
++NUMCPUS_INSTALL=8
++
++#number of cpus used in the nightly runs.
++NUMCPUS_RUN=1
++
++#Nightly run options. The matlab routine runme.m will be called
++#as follows: runme($MATLAB_NROPTIONS). The options must be understandable
++#by Matlab and runme.m
++#ex: "'id',[101 102 103]"
++MATLAB_NROPTIONS=""
++PYTHON_NROPTIONS=""
+
+Property changes on: ../trunk-jpl/jenkins/imac
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/jenkins/jenkins.sh
+===================================================================
+--- ../trunk-jpl/jenkins/jenkins.sh	(revision 0)
++++ ../trunk-jpl/jenkins/jenkins.sh	(revision 16616)
+@@ -0,0 +1,316 @@
++#!/bin/bash
++#This bash script calls the nightlyrun.m matlab file to run our nightly test decks. 
++#It then processes the results and sends an email to the Ice developpers.
++
++#some functions
++function timer() #{{{
++{
++	if [[ $# -eq 0 ]]; then
++		echo $(date '+%s')
++	else
++		local  stime=$1
++		etime=$(date '+%s')
++
++		if [[ -z "$stime" ]]; then stime=$etime; fi
++
++		dt=$((etime - stime))
++		ds=$((dt % 60))
++		dm=$(((dt / 60) % 60))
++		dh=$((dt / 3600))
++		printf '%d:%02d:%02d' $dh $dm $ds
++	fi
++} #}}}
++function todaydate() #{{{
++{
++	suffix=`date | awk '{printf("%s-%s-%s  %s",$2,$3,$6,$4);}'`			 
++	echo $suffix;			 
++} #}}}
++function host_name() #{{{
++{
++	#return host name depending on the OS
++	if [ "$1" = "win7" ] 
++	then
++		HOST_NAME=`hostname | sed 's/-//g'`;
++	else
++		HOST_NAME=`hostname -s | sed 's/-//g'`;
++	fi
++	echo $HOST_NAME;
++} #}}}
++function pause() #{{{
++{
++pid=`ps aux -W | grep $1 | awk '{printf("%s\n",$1);}'`
++
++while [ -n "$pid" ]
++do
++	pid=`ps aux -W | grep $1 | awk '{printf("%s\n",$1);}'`
++done
++}
++#}}}
++
++#Get configuration
++#Source config file{{{
++if [ $# -ne 1 ];
++then
++	#no config file specified: exit
++	echo "no config file specified. Exiting..." >&2 # Error message to stderr.
++	exit 1
++fi
++if [ ! -f "$1" ]
++then
++	echo "File $1 not found!" >&2   # Error message to stderr.
++	exit 1
++fi 
++source $1;
++#}}}
++#Initialize variables {{{
++TODAY=$(todaydate);
++HOST_NAME=$(host_name $OS);
++OS=$(uname -s)
++START_TIME=$(timer);
++ISSM_RELEASE=$(basename $(echo $REPOSITORY));
++USER=$(whoami);
++INIT_PATH=$(pwd);
++#}}}
++
++#Installation ISSM
++#create matlab's installation sript {{{
++cat << END > $ISSM_DIR/externalpackages/matlab/install.sh
++#!/bin/bash
++rm -rf install
++ln -s $MATLAB_PATH install
++END
++#}}}
++#install/copy/none external packages    (ISSM_EXTERNALPACKAGES){{{
++if [ "$ISSM_EXTERNALPACKAGES" == "install" ]
++then
++	
++	cd $ISSM_DIR/externalpackages
++
++	#number of packages: 
++	NUMPACKAGES=$(($(echo $EXTERNALPACKAGES | wc -w )/2))
++
++	for ((i=1;i<=$NUMPACKAGES;i++))
++	do
++		NUM1=$((2*$i-1))
++		NUM2=$((2*$i))
++		PACKAGENAME=$(echo $EXTERNALPACKAGES | cut -d " " -f $NUM1-$NUM1)
++		PACKAGEINST=$(echo $EXTERNALPACKAGES | cut -d " " -f $NUM2-$NUM2)
++
++		cd $PACKAGENAME
++		echo "======================================================";
++		echo "       Installing $PACKAGENAME                        ";
++		echo "======================================================";
++		./$PACKAGEINST |  tee compil.log
++		if [ $? -ne 0 ]; then
++			echo "======================================================";
++			echo "    ERROR: installation of $PACKAGENAME failed        ";
++			echo "======================================================";
++		fi
++		source $ISSM_DIR/etc/environment.sh
++		cd ..
++	done
++
++elif [ "$ISSM_EXTERNALPACKAGES" == "copy" ]
++then
++	cd $ISSM_DIR
++	rm -rf externalpackages
++	cp -Rf $EXTERNALPACKAGESDIR ./
++elif [ "$ISSM_EXTERNALPACKAGES" == "link" ]
++then
++	cd $ISSM_DIR
++	rm -rf externalpackages
++	ln -s  $EXTERNALPACKAGESDIR  .
++elif [ "$ISSM_EXTERNALPACKAGES" == "none" ]
++then
++	echo "Skipping external packages installation"
++else
++	echo "ISSM_EXTERNALPACKAGES supported values are: install, copy and none. Exiting..." >&2 # Error message to stderr.
++	exit 1
++fi
++source $ISSM_DIR/etc/environment.sh
++#}}}
++#ISSM compilation yes/no                (ISSM_COMPILATION) {{{
++if [ "$ISSM_COMPILATION" == "yes" ]
++then
++	cd $ISSM_DIR
++	make uninstall
++	make clean
++	make distclean
++	./scripts/automakererun.sh
++	cat > configure.sh << EOF
++./configure $ISSM_CONFIG
++EOF
++	chmod 700 configure.sh
++	./configure.sh
++
++	#4: compile and install ISSM
++	if [ $NUMCPUS_INSTALL -gt 1 ]
++	then
++		echo "Making with " $NUMCPUS_INSTALL " cpus"
++		make -j $NUMCPUS_INSTALL install
++	else
++		make install
++	fi
++elif [ "$ISSM_COMPILATION" == "no" ]
++then
++	echo "Skipping ISSM compilation"
++else
++	echo "ISSM_COMPILATION supported values are: yes and no. Exiting..." >&2 # Error message to stderr.
++	exit 1
++fi
++#}}}
++
++#shell2junit {{{
++source $ISSM_DIR/externalpackages/shell2junit/install/sh2ju.sh
++#}}}
++
++#Prepare info.log
++#{{{
++rm -rf $ISSM_DIR/nightlylog
++mkdir  $ISSM_DIR/nightlylog
++INSTALL_TIME=$(timer)
++ELAPSED=$(timer $START_TIME)
++VERSION=$(svnversion $ISSM_DIR)
++cat << END > $ISSM_DIR/nightlylog/info.log
++name:      $(echo $NAME)
++today:     $(echo $TODAY)
++user:      $(echo $USER)
++host:      $(echo $HOST_NAME)
++OS:        $(echo $OS)
++release:   $(echo $ISSM_RELEASE)
++init_path: $(echo $INIT_PATH)
++is_matlab: $(echo $MATLAB_TEST)
++is_python: $(echo $PYTHON_TEST)
++elapsed_install: $(echo $ELAPSED)
++version: $(echo $VERSION)
++END
++#}}}
++
++#matlab tests
++if [ $MATLAB_TEST -eq 1 ]; then
++#Launch all tests on different cpus {{{
++MATLAB_START_TIME=$(timer);
++for (( i=1;i<=$NUMCPUS_RUN;i++ ))
++do
++	#Launch matlab and the nightly run script
++	cat > $ISSM_DIR/nightlylog/matlab_run$i.m << EOF
++	warning off %necessary to avoid a info.log of several Go for parallel runs
++	try,
++	$(if [ "$MATLAB_NROPTIONS" = ""  ]
++	then
++		echo "runme('output','nightly','rank',$i,'numprocs',$NUMCPUS_RUN);"
++	else
++		echo "runme($MATLAB_NROPTIONS,'output','nightly','rank',$i,'numprocs',$NUMCPUS_RUN);"
++	fi
++	)
++	catch me,
++		%An error occured, get report and exit
++		message=getReport(me)
++		directory=strsplit(pwd,'/');
++		fid=fopen([issmdir '/nightlylog/matlaberror.log'], 'at');
++		fprintf(fid,'\nMatlab error occured in: %s\n\n',directory{end});
++		fprintf(fid,'%s',message);
++		fclose(fid);
++	end
++	disp('MATLABEXITEDCORRECTLY');
++	exit
++EOF
++	cd $ISSM_DIR/test/NightlyRun
++	matlab -nojvm -nosplash -r "addpath $ISSM_DIR/src/m/dev; devpath; addpath $ISSM_DIR/nightlylog/; matlab_run$i" -logfile $ISSM_DIR/nightlylog/matlab_log$i.log &
++done
++
++#wait until matlab closes
++if [ "$OS" = "win7" ]; then
++	pause MATLAB
++else
++	wait
++fi
++
++#concatenate reports
++cd $ISSM_DIR/nightlylog/
++rm matlab_log.log
++for (( i=1;i<=$NUMCPUS_RUN;i++ ))
++do
++	cat matlab_log$i.log >> matlab_log.log
++done
++
++#filter out windows characters: 
++cat matlab_log.log | tr -cd '\11\12\40-\176' > matlab_log.log2 && mv matlab_log.log2 matlab_log.log
++
++#}}}
++#Complete info.log {{{
++if [ $(cat matlab_log.log | grep "MATLABEXITEDCORRECTLY" | wc -l) -eq $NUMCPUS_RUN ]
++then
++	MATLABCRASH=0
++else
++	MATLABCRASH=1
++fi
++ELAPSED=$(timer $MATLAB_START_TIME)
++cat << END >>  $ISSM_DIR/nightlylog/info.log
++elapsed_matlab: $(echo $ELAPSED)
++matlab_crash:   $(echo $MATLABCRASH)
++END
++#}}}
++fi
++
++#python tests
++if [ $PYTHON_TEST -eq 1 ]; then
++#Launch all tests on different cpus {{{
++PYTHON_START_TIME=$(timer);
++export PYTHONSTARTUP=$ISSM_DIR/src/m/dev/devpath.py
++for (( i=1;i<=$NUMCPUS_RUN;i++ ))
++do
++	cd $ISSM_DIR/test/NightlyRun
++	./runme.py --output=nightly --rank=$i --numprocs=$NUMCPUS_RUN $PYTHON_NROPTIONS 2>&1 > $ISSM_DIR/nightlylog/python_log$i.log &
++done
++
++#wait until python closes
++if [ "$OS" = "win7" ]; then
++	pause MATLAB
++else
++	wait
++fi
++
++#concatenate reports
++cd $ISSM_DIR/nightlylog/
++rm python_log.log
++for (( i=1;i<=$NUMCPUS_RUN;i++ ))
++do
++	cat python_log$i.log >> python_log.log
++done
++#}}}
++#Complete info.log {{{
++if [ $(cat python_log.log | grep "PYTHONEXITEDCORRECTLY" | wc -l) -eq $NUMCPUS_RUN ]
++then
++	PYTHONCRASH=0
++else
++	PYTHONCRASH=1
++fi
++ELAPSED=$(timer $PYTHON_START_TIME)
++cat << END >>  $ISSM_DIR/nightlylog/info.log
++elapsed_python: $(echo $ELAPSED)
++python_crash:   $(echo $PYTHONCRASH)
++END
++#}}}
++fi
++
++#complete info.log
++#{{{
++ELAPSED=$(timer $START_TIME)
++cat << END >>  $ISSM_DIR/nightlylog/info.log
++elapsed_total:  $(echo $ELAPSED)
++END
++#}}}
++
++#process logs to be junit compatible
++#{{{
++cd $ISSM_DIR/nightlylog/
++juLogClean
++
++rm -rf juLogFile && cat matlab_log.log | grep "test id" > juLogFile
++
++while read i; do 
++	juLog  -name=Error -error=ERROR echo $i 
++	juLog  -name=Failure -error=FAILURE   echo $i 
++done < juLogFile
++#}}}
+
+Property changes on: ../trunk-jpl/jenkins/jenkins.sh
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/jenkins/linux64_larsen
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_larsen	(revision 0)
++++ ../trunk-jpl/jenkins/linux64_larsen	(revision 16616)
+@@ -0,0 +1,106 @@
++#
++########### Configuration file for Eric Larour's Jenkins run on Murdo ############
++
++#-------------------------------#
++# 1: ISSM general configuration #
++#-------------------------------#
++
++#Nightly run name
++NAME="ISSM matlab tests on Linux64 (murdo)"
++
++#ISSM Architecture
++ISSM_ARCH="linux-gnu-amd64"
++
++#ISSM CONFIGURATION 
++ISSM_CONFIG='--prefix=$ISSM_DIR\
++	--with-matlab-dir=$MATLAB_DIR \
++	--with-triangle-dir=$ISSM_DIR/externalpackages/triangle/install \
++	--with-metis-dir=$ISSM_DIR/externalpackages/metis/install \
++	--with-mpi-include=$ISSM_DIR/externalpackages/mpich/install/include  \
++	--with-mpi-libflags="-L$ISSM_DIR/externalpackages/mpich/install/lib/ -lmpich" \
++	--with-petsc-dir=$ISSM_DIR/externalpackages/petsc/install \
++	--with-petsc-arch=$ISSM_ARCH \
++	--with-mumps-dir=$ISSM_DIR/externalpackages/petsc/install/ \
++	--with-blas-lapack-dir=$ISSM_DIR/externalpackages/petsc/install \
++	--with-chaco-dir="$ISSM_DIR/externalpackages/chaco/install" \
++	--with-numthreads=18 \
++	--with-cxxoptflags="-mtune=barcelona -ffast-math -O3 -msse4.2 -Wno-write-strings "\
++	--with-graphics-lib="/usr/lib/x86_64-linux-gnu/libX11.so" \
++	--with-tao-dir=$ISSM_DIR/externalpackages/tao/install \
++	--enable-debugging '
++
++#MATLAB path
++MATLAB_PATH="/usr/local/matlab80/"
++
++#PYTHON and MATLAB testing
++MATLAB_TEST=1
++PYTHON_TEST=0
++
++#execution path used for parallel runs
++EXECUTION_PATH=$ISSM_DIR/execution
++
++#-----------------------------------#
++# 3: External packages installation #
++#-----------------------------------#
++
++#ISSM_EXTERNALPACKAGES can have 3 values:
++# - "install" install all external packages listed below
++# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
++# - "none"    leave external packages as is
++#             ->skip to section 4
++ISSM_EXTERNALPACKAGES="install"
++EXTERNALPACKAGESDIR=$ISSM_DIR/externalpackages
++
++#List of external pakages to be installed and their installation scripts
++EXTERNALPACKAGES="autotools install.sh                
++						matlab    install.sh                
++						mpich     install-3.0-linux64.sh    
++						cmake     install.sh                
++						petsc     install-3.4-linux64.sh    
++						triangle  install-linux64.sh        
++						boost     install.sh                
++						dakota    install-5.3.1-linux64.sh  
++						tao       install-2.2.sh
++						chaco     install.sh 
++						shell2junit install.sh"
++
++#---------------------#
++# 4: ISSM Compilation #
++#---------------------#
++
++#ISSM_COMPILATION can have 2 values:
++# - "yes" compile ISSM
++# - "no"  do not compile ISSM
++ISSM_COMPILATION="yes"
++
++#----------------------#
++# 5: Mail notification #
++#----------------------#
++
++#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
++#sent to the adresses present in $ISSM_DIR/cron/mailinglist.
++SKIPMAIL="no"
++
++#Sender email address
++EMAIL_ADRESS="eric.larour@jpl.nasa.gov"
++
++#Mailing list
++MAILINGLIST="eric.larour@jpl.nasa.gov"
++
++#------------------------#
++# 6: Nightly run options #
++#------------------------#
++
++#number of cpus used in ISSM installation and compilation (one is usually
++#safer as some packages are very sensitive to parallel compilation)
++NUMCPUS_INSTALL=8
++
++#number of cpus used in the nightly runs.
++NUMCPUS_RUN=8
++
++#Nightly run options. The matlab routine runme.m will be called
++#as follows: runme($MATLAB_NROPTIONS). The options must be understandable
++#by Matlab and runme.m
++#ex: "'id',[101 102 103]"
++MATLAB_NROPTIONS=""
++PYTHON_NROPTIONS=""
+
+Property changes on: ../trunk-jpl/jenkins/linux64_larsen
+___________________________________________________________________
+Name: svn:executable
+   + *
+
Index: issm/oecreview/Archive/16554-17801/ISSM-16616-16617.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16616-16617.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16616-16617.diff	(revision 17802)
@@ -0,0 +1,24 @@
+Index: ../trunk-jpl/jenkins/execute_shell
+===================================================================
+--- ../trunk-jpl/jenkins/execute_shell	(revision 0)
++++ ../trunk-jpl/jenkins/execute_shell	(revision 16617)
+@@ -0,0 +1,19 @@
++#!/bin/bash
++
++#some exports required
++export ISSM_DIR="$WORKSPACE"
++
++#which configuration are we using? 
++if [[ $Platform == "master" ]]; then
++configfile=linux64_murdo
++elif [[ $Platform == "macosx" ]]; then 
++configfile=imac
++elif [[ $Platform == "larsen" ]]; then 
++configfile=linux64_larsen
++fi
++
++
++#run
++cd "$WORKSPACE"
++source $ISSM_DIR/jenkins/jenkins.sh $ISSM_DIR/jenkins/$configfile
++
Index: issm/oecreview/Archive/16554-17801/ISSM-16617-16618.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16617-16618.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16617-16618.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/jenkins/linux64_murdo
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo	(revision 16617)
++++ ../trunk-jpl/jenkins/linux64_murdo	(revision 16618)
+@@ -48,7 +48,7 @@
+ # - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
+ # - "none"    leave external packages as is
+ #             ->skip to section 4
+-ISSM_EXTERNALPACKAGES="install"
++ISSM_EXTERNALPACKAGES="none"
+ EXTERNALPACKAGESDIR=$ISSM_DIR/externalpackages
+ 
+ #List of external pakages to be installed and their installation scripts
+Index: ../trunk-jpl/jenkins/linux64_larsen
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_larsen	(revision 16617)
++++ ../trunk-jpl/jenkins/linux64_larsen	(revision 16618)
+@@ -48,7 +48,7 @@
+ # - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
+ # - "none"    leave external packages as is
+ #             ->skip to section 4
+-ISSM_EXTERNALPACKAGES="install"
++ISSM_EXTERNALPACKAGES="none"
+ EXTERNALPACKAGESDIR=$ISSM_DIR/externalpackages
+ 
+ #List of external pakages to be installed and their installation scripts
Index: issm/oecreview/Archive/16554-17801/ISSM-16618-16619.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16618-16619.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16618-16619.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/jenkins/imac
+===================================================================
+--- ../trunk-jpl/jenkins/imac	(revision 16618)
++++ ../trunk-jpl/jenkins/imac	(revision 16619)
+@@ -49,7 +49,7 @@
+ # - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
+ # - "none"    leave external packages as is
+ #             ->skip to section 4
+-ISSM_EXTERNALPACKAGES="install"
++ISSM_EXTERNALPACKAGES="none"
+ EXTERNALPACKAGESDIR=$ISSM_DIR/externalpackages
+ 
+ #List of external pakages to be installed and their installation scripts
Index: issm/oecreview/Archive/16554-17801/ISSM-16619-16620.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16619-16620.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16619-16620.diff	(revision 17802)
@@ -0,0 +1,22 @@
+Index: ../trunk-jpl/src/m/classes/matice.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/matice.m	(revision 16619)
++++ ../trunk-jpl/src/m/classes/matice.m	(revision 16620)
+@@ -12,7 +12,7 @@
+ 		heatcapacity               = 0.;
+ 		latentheat                 = 0.;
+ 		thermalconductivity        = 0.;
+-		temperateiceconductivity         = 0.;
++		temperateiceconductivity   = 0.;
+ 		meltingpoint               = 0.;
+ 		beta                       = 0.;
+ 		mixed_layer_capacity       = 0.;
+@@ -124,7 +124,7 @@
+ 			fielddisplay(obj,'thermalconductivity',['ice thermal conductivity [W/m/K]']);
+ 			fielddisplay(obj,'temperateiceconductivity','temperate ice thermal conductivity [W/m/K]');
+ 			fielddisplay(obj,'meltingpoint','melting point of ice at 1atm in K');
+-			fielddisplay(obj,'latentheat','latent heat of fusion [J/m^3]');
++			fielddisplay(obj,'latentheat','latent heat of fusion [J/kg]');
+ 			fielddisplay(obj,'beta','rate of change of melting point with pressure [K/Pa]');
+ 			fielddisplay(obj,'mixed_layer_capacity','mixed layer capacity [W/kg/K]');
+ 			fielddisplay(obj,'thermal_exchange_velocity','thermal exchange velocity [m/s]');
Index: issm/oecreview/Archive/16554-17801/ISSM-16620-16621.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16620-16621.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16620-16621.diff	(revision 17802)
@@ -0,0 +1,114 @@
+Index: ../trunk-jpl/test/Archives/Archive327.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive120.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive432.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive325.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive121.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive326.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive122.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive431.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 16620)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 16621)
+@@ -396,9 +396,9 @@
+ IssmDouble Matpar::GetEnthalpyDiffusionParameterVolume(IssmDouble enthalpy[6], IssmDouble pressure[6]){
+ 
+ 	IssmDouble lambda; // fraction of cold ice
+-	IssmDouble kappa,kappa_c, kappa_t;
+-	IssmDouble Hc, Ht;
+-	IssmDouble PIE[6], dHpmp[6];
++	IssmDouble kappa,kappa_c,kappa_t;  //enthalpy conductivities
++	IssmDouble Hc,Ht;
++	IssmDouble PIE[6],dHpmp[6];
+ 	int iv;
+ 
+ 	for (iv=0; iv<6; iv++){
+@@ -418,7 +418,8 @@
+ 		kappa=GetEnthalpyDiffusionParameter(enthalpy[0], pressure[0]);
+ 	}
+ 	else {
+-		/* return harmonic mean of thermal conductivities, weighted by fraction of cold/temperate ice*/
++		/* return harmonic mean of thermal conductivities, weighted by fraction of cold/temperate ice,
++		 cf Patankar 1980, pp44 */
+ 		kappa_c=GetEnthalpyDiffusionParameter(PureIceEnthalpy(0.)-1.,0.);
+ 		kappa_t=GetEnthalpyDiffusionParameter(PureIceEnthalpy(0.)+1.,0.);
+ 		Hc=0.; Ht=0.;
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16620)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16621)
+@@ -3775,7 +3775,7 @@
+ 	IssmDouble gravity,rho_ice,rho_water;
+ 	IssmDouble epsvel=2.220446049250313e-16;
+ 	IssmDouble heatcapacity,thermalconductivity,dt;
+-	IssmDouble pressure[NUMVERTICES],enthalpy[NUMVERTICES];
++	IssmDouble enthalpy[NUMVERTICES], pressure[NUMVERTICES];
+ 	IssmDouble latentheat,kappa;
+ 	IssmDouble tau_parameter,diameter;
+ 	IssmDouble xyz_list[NUMVERTICES][3];
+@@ -3823,12 +3823,9 @@
+ 
+ 		/*Conduction: */  
+ 		GetBConduct(&B_conduct[0][0],&xyz_list[0][0],gauss); 
+-
+-		//enthalpy_input->GetInputValue(&enthalpy, gauss);
+-		//pressure_input->GetInputValue(&pressure, gauss);
+-		GetInputListOnVertices(&enthalpy[0],EnthalpyPicardEnum);
++		GetInputListOnVertices(&enthalpy[0],EnthalpyEnum);
+ 		GetInputListOnVertices(&pressure[0],PressureEnum);
+-		kappa=matpar->GetEnthalpyDiffusionParameterVolume(enthalpy,pressure); _assert_(kappa>0.);  // TODO: switch to pointers
++		kappa=matpar->GetEnthalpyDiffusionParameterVolume(enthalpy,pressure); _assert_(kappa>0.);
+ 
+ 		D_scalar_conduct=gauss->weight*Jdet*kappa/rho_ice;
+ 		if(reCast<bool,IssmDouble>(dt)) D_scalar_conduct=D_scalar_conduct*dt;
+@@ -4231,9 +4228,8 @@
+ 	IssmDouble Jdet,phi,dt;
+ 	IssmDouble rho_ice,heatcapacity;
+ 	IssmDouble thermalconductivity,kappa;
+-	IssmDouble viscosity,pressure;
+-	IssmDouble enthalpy;
+-	IssmDouble enthalpy_v[NUMVERTICES], pressure_v[NUMVERTICES];
++	IssmDouble viscosity,pressure,enthalpy;
++	IssmDouble enthalpypicard[NUMVERTICES], pressure_p[NUMVERTICES];
+ 	IssmDouble tau_parameter,diameter;
+ 	IssmDouble u,v,w;
+ 	IssmDouble scalar_def,scalar_transient;
+@@ -4299,11 +4295,9 @@
+ 			vx_input->GetInputValue(&u, gauss);
+ 			vy_input->GetInputValue(&v, gauss);
+ 			vz_input->GetInputValue(&w, gauss);
+-			//pressure_input->GetInputValue(&pressure, gauss);
+-			//enthalpypicard_input->GetInputValue(&enthalpypicard, gauss);
+-			GetInputListOnVertices(&enthalpy_v[0],EnthalpyPicardEnum);
+-			GetInputListOnVertices(&pressure_v[0],PressureEnum);
+-			kappa=matpar->GetEnthalpyDiffusionParameterVolume(enthalpy_v,pressure_v);
++			GetInputListOnVertices(&enthalpypicard[0],EnthalpyPicardEnum);
++			GetInputListOnVertices(&pressure_p[0],PressureEnum);
++			kappa=matpar->GetEnthalpyDiffusionParameterVolume(enthalpypicard,pressure_p);
+ 			kappa/=rho_ice;
+ 			tau_parameter=GetStabilizationParameter(u,v,w,diameter,kappa); 
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16621-16622.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16621-16622.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16621-16622.diff	(revision 17802)
@@ -0,0 +1,18 @@
+Index: ../trunk-jpl/jenkins/execute_shell
+===================================================================
+--- ../trunk-jpl/jenkins/execute_shell	(revision 16621)
++++ ../trunk-jpl/jenkins/execute_shell	(revision 16622)
+@@ -6,7 +6,7 @@
+ #which configuration are we using? 
+ if [[ $Platform == "master" ]]; then
+ configfile=linux64_murdo
+-elif [[ $Platform == "macosx" ]]; then 
++elif [[ $Platform == "imac-012301-gil" ]]; then 
+ configfile=imac
+ elif [[ $Platform == "larsen" ]]; then 
+ configfile=linux64_larsen
+@@ -16,4 +16,3 @@
+ #run
+ cd "$WORKSPACE"
+ source $ISSM_DIR/jenkins/jenkins.sh $ISSM_DIR/jenkins/$configfile
+-
Index: issm/oecreview/Archive/16554-17801/ISSM-16622-16623.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16622-16623.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16622-16623.diff	(revision 17802)
@@ -0,0 +1,28 @@
+Index: ../trunk-jpl/test/NightlyRun/runme.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/runme.m	(revision 16622)
++++ ../trunk-jpl/test/NightlyRun/runme.m	(revision 16623)
+@@ -132,6 +132,7 @@
+ 		%Execute test
+ 		eval(['cd ' root ]);
+ 		id_string=IdToName(id);
++		disp(sprintf('%s%i%s','----------------starting-------',id,'-----------------------'));
+ 		eval(['test' num2str(id)]);
+ 
+ 		%UPDATE ARCHIVE?
+@@ -249,6 +250,8 @@
+ 				end
+ 			end
+ 		end
++		
++		disp(sprintf('%s%i%s','----------------finished-------',id,'-----------------------'));
+ 
+ 	catch me,
+ 
+@@ -271,5 +274,6 @@
+ 			disp(sprintf(['FAILURE difference: N/A test id: %i test name: %s field: %s'],id,id_string,'N/A'));
+ 			rethrow(me);
+ 		end
++		disp(sprintf('%s%i%s','----------------finished-------',id,'-----------------------'));
+ 	end
+ end
Index: issm/oecreview/Archive/16554-17801/ISSM-16623-16624.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16623-16624.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16623-16624.diff	(revision 17802)
@@ -0,0 +1,30 @@
+Index: ../trunk-jpl/test/NightlyRun/runme.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/runme.m	(revision 16623)
++++ ../trunk-jpl/test/NightlyRun/runme.m	(revision 16624)
+@@ -132,7 +132,7 @@
+ 		%Execute test
+ 		eval(['cd ' root ]);
+ 		id_string=IdToName(id);
+-		disp(sprintf('%s%i%s','----------------starting-------',id,'-----------------------'));
++		disp(sprintf('%s%i%s','----------------starting:',id,'-----------------------'));
+ 		eval(['test' num2str(id)]);
+ 
+ 		%UPDATE ARCHIVE?
+@@ -251,7 +251,7 @@
+ 			end
+ 		end
+ 		
+-		disp(sprintf('%s%i%s','----------------finished-------',id,'-----------------------'));
++		disp(sprintf('%s%i%s','----------------finished:',id,'-----------------------'));
+ 
+ 	catch me,
+ 
+@@ -274,6 +274,6 @@
+ 			disp(sprintf(['FAILURE difference: N/A test id: %i test name: %s field: %s'],id,id_string,'N/A'));
+ 			rethrow(me);
+ 		end
+-		disp(sprintf('%s%i%s','----------------finished-------',id,'-----------------------'));
++		disp(sprintf('%s%i%s','----------------finished:id,'-----------------------'));
+ 	end
+ end
Index: issm/oecreview/Archive/16554-17801/ISSM-16624-16625.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16624-16625.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16624-16625.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/test/NightlyRun/runme.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/runme.m	(revision 16624)
++++ ../trunk-jpl/test/NightlyRun/runme.m	(revision 16625)
+@@ -274,6 +274,6 @@
+ 			disp(sprintf(['FAILURE difference: N/A test id: %i test name: %s field: %s'],id,id_string,'N/A'));
+ 			rethrow(me);
+ 		end
+-		disp(sprintf('%s%i%s','----------------finished:id,'-----------------------'));
++		disp(sprintf('%s%i%s','----------------finished:',id,'-----------------------'));
+ 	end
+ end
Index: issm/oecreview/Archive/16554-17801/ISSM-16625-16626.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16625-16626.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16625-16626.diff	(revision 17802)
@@ -0,0 +1,25 @@
+Index: ../trunk-jpl/jenkins/jenkins.sh
+===================================================================
+--- ../trunk-jpl/jenkins/jenkins.sh	(revision 16625)
++++ ../trunk-jpl/jenkins/jenkins.sh	(revision 16626)
+@@ -307,10 +307,15 @@
+ cd $ISSM_DIR/nightlylog/
+ juLogClean
+ 
+-rm -rf juLogFile && cat matlab_log.log | grep "test id" > juLogFile
++#number tests:
++numtests=`cat matlab_log.log  | grep "\-\-\-\-\-\-\-\-starting" | wc -l`
++testlist=`cat matlab_log.log  | grep "\-\-\-\-\-\-\-\-starting" | sed 's/----------------starting://g'  | sed 's/-//g'`
+ 
+-while read i; do 
+-	juLog  -name=Error -error=ERROR echo $i 
+-	juLog  -name=Failure -error=FAILURE   echo $i 
+-done < juLogFile
++#look through numtests:
++for i in `echo $testlist`
++do
++	test=`awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" matlab_log.log`
++	juLog  -name=Error -error=ERROR echo $test
++	juLog  -name=Failure -error=FAILURE  echo $test
++done
+ #}}}
Index: issm/oecreview/Archive/16554-17801/ISSM-16626-16627.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16626-16627.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16626-16627.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/jenkins/linux64_murdo
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo	(revision 16626)
++++ ../trunk-jpl/jenkins/linux64_murdo	(revision 16627)
+@@ -26,6 +26,7 @@
+ 	--with-numthreads=18 \
+ 	--with-cxxoptflags="-mtune=barcelona -ffast-math -O3 -msse4.2 -Wno-write-strings "\
+ 	--with-graphics-lib="/usr/lib/x86_64-linux-gnu/libX11.so" \
++	--with-dakota-dir=$ISSM_DIR/externalpackages/dakota/install \
+ 	--with-tao-dir=$ISSM_DIR/externalpackages/tao/install \
+ 	--enable-debugging '
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16627-16628.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16627-16628.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16627-16628.diff	(revision 17802)
@@ -0,0 +1,27 @@
+Index: ../trunk-jpl/jenkins/linux64_murdo
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo	(revision 16627)
++++ ../trunk-jpl/jenkins/linux64_murdo	(revision 16628)
+@@ -72,7 +72,7 @@
+ #ISSM_COMPILATION can have 2 values:
+ # - "yes" compile ISSM
+ # - "no"  do not compile ISSM
+-ISSM_COMPILATION="yes"
++ISSM_COMPILATION="no"
+ 
+ #----------------------#
+ # 5: Mail notification #
+Index: ../trunk-jpl/jenkins/jenkins.sh
+===================================================================
+--- ../trunk-jpl/jenkins/jenkins.sh	(revision 16627)
++++ ../trunk-jpl/jenkins/jenkins.sh	(revision 16628)
+@@ -315,7 +315,7 @@
+ for i in `echo $testlist`
+ do
+ 	test=`awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" matlab_log.log`
+-	juLog  -name=Error -error=ERROR echo $test
+-	juLog  -name=Failure -error=FAILURE  echo $test
++	juLog  -test $i -name=Error -error=ERROR echo $test
++	juLog  -test $i -name=Failure -error=FAILURE  echo $test
+ done
+ #}}}
Index: issm/oecreview/Archive/16554-17801/ISSM-16628-16629.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16628-16629.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16628-16629.diff	(revision 17802)
@@ -0,0 +1,202 @@
+Index: ../trunk-jpl/externalpackages/shell2junit/install.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/shell2junit/install.sh	(revision 16628)
++++ ../trunk-jpl/externalpackages/shell2junit/install.sh	(revision 16629)
+@@ -1,20 +1,9 @@
+ #!/bin/bash
+ set -eu
+ 
++
+ #Some cleanup
+-rm -rf install src
+-rm -rf shell2junit
+-mkdir install src
++rm -rf install 
++mkdir install 
+ 
+-#Download from ISSM server
+-$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/shell2junit-1.0.0.zip' 'shell2junit-1.0.0.zip'
+-
+-#Untar 
+-unzip shell2junit-1.0.0.zip
+-
+-#Move shell2junit into install directory
+-mv shell2junit/* src
+-rm -rf shell2junit
+-
+-#Copy executable: 
+-cp src/sh2ju.sh install
++cp patch/sh2ju.sh install/
+Index: ../trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh	(revision 0)
++++ ../trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh	(revision 16629)
+@@ -0,0 +1,131 @@
++#!/bin/sh
++### Copyright 2010 Manuel Carrasco Moñino. (manolo at apache.org) 
++###
++### Licensed under the Apache License, Version 2.0.
++### You may obtain a copy of it at
++### http://www.apache.org/licenses/LICENSE-2.0
++
++###
++### A library for shell scripts which creates reports in jUnit format.
++### These reports can be used in Hudson, or any other CI.
++###
++### Usage: 
++###     - Include this file in your shell script
++###     - Use juLog to call your command any time you want to produce a new report
++###        Usage:   juLog <options> command arguments
++###           options:
++###             -name="TestName" : the test name which will be shown in the junit report
++###             -error="RegExp"  : a regexp which sets the test as failure when the output matches it
++###             -ierror="RegExp" : same as -error but case insensitive
++###     - Junit reports are left in the folder 'result' under the directory where the script is executed.
++###     - Configure hudson to parse junit files from the generated folder
++###
++
++asserts=00; errors=0; total=0; content=""
++
++# create output folder
++juDIR=`pwd`/results
++mkdir -p $juDIR || exit
++
++# The name of the suite is calculated based in your script name
++suite=`basename $0 | sed -e 's/.sh$//' | tr "." "_"`
++
++# A wrapper for the eval method witch allows catching seg-faults and use tee
++errfile=/tmp/evErr.$$.log
++eVal() {
++  eval "$1"
++  echo $? | tr -d "\n" >$errfile
++}
++
++# Method to clean old tests
++juLogClean() {
++  echo "+++ Removing old junit reports from: $juDIR "
++  rm -f $juDIR/TEST-*	
++}
++
++# Execute a command and record its results 
++juLog() {
++  
++  # parse arguments
++  ya=""; icase=""; testname="";
++  while [ -z "$ya" ]; do  
++    case "$1" in
++  	  -name=*)   name=$asserts-`echo "$1" | sed -e 's/-name=//'`;   shift;;
++      -ierror=*) ereg=`echo "$1" | sed -e 's/-ierror=//'`; icase="-i"; shift;;
++      -error=*)  ereg=`echo "$1" | sed -e 's/-error=//'`;  shift;;
++      -test=*)  testname=`echo "$1" | sed -e 's/-test=//'`;  shift;;
++      *)         ya=1;;
++    esac
++  done  
++
++  # use first arg as name if it was not given 
++  if [ -z "$name" ]; then
++    name="$asserts-$1" 
++    shift
++  fi
++
++  # calculate command to eval
++  [ -z "$1" ] && return
++  cmd="$1"; shift
++  while [ -n "$1" ]
++  do
++     cmd="$cmd \"$1\""
++     shift
++  done
++
++  # eval the command sending output to a file
++  outf=/var/tmp/ju$$.txt
++  >$outf
++  echo ""                         | tee -a $outf
++  echo "+++ Running case: $name " | tee -a $outf
++  echo "+++ working dir: "`pwd`           | tee -a $outf
++  echo "+++ command: $cmd"            | tee -a $outf
++  ini=`date +%s`
++  eVal "$cmd" 2>&1                | tee -a $outf
++  evErr=`cat $errfile`
++  rm -f $errfile
++  end=`date +%s`
++  echo "+++ exit code: $evErr"        | tee -a $outf
++  
++  # set the appropriate error, based in the exit code and the regex  
++  [ $evErr != 0 ] && err=1 || err=0
++  out=`cat $outf | sed -e 's/^\([^+]\)/| \1/g'`
++  if [ $err = 0 -a -n "$ereg" ]; then
++      H=`echo "$out" | egrep $icase "$ereg"`
++      [ -n "$H" ] && err=1
++  fi
++  echo "+++ error: $err"         | tee -a $outf
++  rm -f $outf
++
++  # calculate vars
++  asserts=`expr $asserts + 1`
++  asserts=`printf "%.2d" $asserts`
++  errors=`expr $errors + $err`
++  time=`expr $end - $ini`
++  total=`expr $total + $time`
++
++  # write the junit xml report
++  ## failure tag
++  [ $err = 0 ] && failure="" || failure="
++      <failure type=\"ScriptError\" message=\"Script Error\"></failure>
++  "
++  ## testcase tag
++  content="$content
++    <testcase assertions=\"1\" name=\"$name\" time=\"$time\">
++    $failure
++    <system-out>
++<![CDATA[
++$out
++]]>
++    </system-out>
++    </testcase>
++  "
++  ## testsuite block
++  cat <<EOF >$juDIR/TEST-$suite.xml
++  <testsuite failures="0" assertions="$assertions" name="$testname" tests="1" errors="$errors" time="$total">
++    $content
++  </testsuite>
++EOF
++
++}
++
+
+Property changes on: ../trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/externalpackages/shell2junit/install.sh.old
+===================================================================
+--- ../trunk-jpl/externalpackages/shell2junit/install.sh.old	(revision 0)
++++ ../trunk-jpl/externalpackages/shell2junit/install.sh.old	(revision 16629)
+@@ -0,0 +1,20 @@
++#!/bin/bash
++set -eu
++
++#Some cleanup
++rm -rf install src
++rm -rf shell2junit
++mkdir install src
++
++#Download from ISSM server
++$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/shell2junit-1.0.0.zip' 'shell2junit-1.0.0.zip'
++
++#Untar 
++unzip shell2junit-1.0.0.zip
++
++#Move shell2junit into install directory
++mv shell2junit/* src
++rm -rf shell2junit
++
++#Copy executable: 
++cp src/sh2ju.sh install
+
+Property changes on: ../trunk-jpl/externalpackages/shell2junit/install.sh.old
+___________________________________________________________________
+Name: svn:executable
+   + *
+
Index: issm/oecreview/Archive/16554-17801/ISSM-16629-16630.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16629-16630.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16629-16630.diff	(revision 17802)
@@ -0,0 +1,39 @@
+Index: ../trunk-jpl/jenkins/linux64_murdo
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo	(revision 16629)
++++ ../trunk-jpl/jenkins/linux64_murdo	(revision 16630)
+@@ -49,21 +49,22 @@
+ # - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
+ # - "none"    leave external packages as is
+ #             ->skip to section 4
+-ISSM_EXTERNALPACKAGES="none"
++ISSM_EXTERNALPACKAGES="install"
+ EXTERNALPACKAGESDIR=$ISSM_DIR/externalpackages
+ 
+ #List of external pakages to be installed and their installation scripts
+-EXTERNALPACKAGES="autotools install.sh                
+-						matlab    install.sh                
+-						mpich     install-3.0-linux64.sh    
+-						cmake     install.sh                
+-						petsc     install-3.4-linux64.sh    
+-						triangle  install-linux64.sh        
+-						boost     install.sh                
+-						dakota    install-5.3.1-linux64.sh  
+-						tao       install-2.2.sh
+-						chaco     install.sh 
+-						shell2junit install.sh"
++EXTERNALPACKAGES="shell2junit install.sh"
++#EXTERNALPACKAGES="autotools install.sh                
++#						matlab    install.sh                
++#						mpich     install-3.0-linux64.sh    
++#						cmake     install.sh                
++#						petsc     install-3.4-linux64.sh    
++#						triangle  install-linux64.sh        
++#						boost     install.sh                
++#						dakota    install-5.3.1-linux64.sh  
++#						tao       install-2.2.sh
++#						chaco     install.sh 
++#						shell2junit install.sh"
+ 
+ #---------------------#
+ # 4: ISSM Compilation #
Index: issm/oecreview/Archive/16554-17801/ISSM-16630-16631.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16630-16631.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16630-16631.diff	(revision 17802)
@@ -0,0 +1,14 @@
+Index: ../trunk-jpl/jenkins/jenkins.sh
+===================================================================
+--- ../trunk-jpl/jenkins/jenkins.sh	(revision 16630)
++++ ../trunk-jpl/jenkins/jenkins.sh	(revision 16631)
+@@ -315,7 +315,7 @@
+ for i in `echo $testlist`
+ do
+ 	test=`awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" matlab_log.log`
+-	juLog  -test $i -name=Error -error=ERROR echo $test
+-	juLog  -test $i -name=Failure -error=FAILURE  echo $test
++	juLog  -test=$i -name=Error -error=ERROR echo $test
++	juLog  -test=$i -name=Failure -error=FAILURE  echo $test
+ done
+ #}}}
Index: issm/oecreview/Archive/16554-17801/ISSM-16631-16632.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16631-16632.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16631-16632.diff	(revision 17802)
@@ -0,0 +1,23 @@
+Index: ../trunk-jpl/jenkins/jenkins.sh
+===================================================================
+--- ../trunk-jpl/jenkins/jenkins.sh	(revision 16631)
++++ ../trunk-jpl/jenkins/jenkins.sh	(revision 16632)
+@@ -160,10 +160,6 @@
+ fi
+ #}}}
+ 
+-#shell2junit {{{
+-source $ISSM_DIR/externalpackages/shell2junit/install/sh2ju.sh
+-#}}}
+-
+ #Prepare info.log
+ #{{{
+ rm -rf $ISSM_DIR/nightlylog
+@@ -305,6 +301,7 @@
+ #process logs to be junit compatible
+ #{{{
+ cd $ISSM_DIR/nightlylog/
++source $ISSM_DIR/externalpackages/shell2junit/install/sh2ju.sh
+ juLogClean
+ 
+ #number tests:
Index: issm/oecreview/Archive/16554-17801/ISSM-16632-16633.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16632-16633.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16632-16633.diff	(revision 17802)
@@ -0,0 +1,22 @@
+Index: ../trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh	(revision 16632)
++++ ../trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh	(revision 16633)
+@@ -111,7 +111,7 @@
+   "
+   ## testcase tag
+   content="$content
+-    <testcase assertions=\"1\" name=\"$name\" time=\"$time\">
++    <testcase assertions=\"1\" name=\"$testname\" time=\"$time\">
+     $failure
+     <system-out>
+ <![CDATA[
+@@ -122,7 +122,7 @@
+   "
+   ## testsuite block
+   cat <<EOF >$juDIR/TEST-$suite.xml
+-  <testsuite failures="0" assertions="$assertions" name="$testname" tests="1" errors="$errors" time="$total">
++  <testsuite failures="0" assertions="$assertions" name="ISSM Test Suite" tests="1" errors="$errors" time="$total">
+     $content
+   </testsuite>
+ EOF
Index: issm/oecreview/Archive/16554-17801/ISSM-16633-16634.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16633-16634.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16633-16634.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh	(revision 16633)
++++ ../trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh	(revision 16634)
+@@ -111,7 +111,7 @@
+   "
+   ## testcase tag
+   content="$content
+-    <testcase assertions=\"1\" name=\"$testname\" time=\"$time\">
++    <testcase assertions=\"1\" name=\"$testname $name\" time=\"$time\">
+     $failure
+     <system-out>
+ <![CDATA[
Index: issm/oecreview/Archive/16554-17801/ISSM-16634-16635.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16634-16635.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16634-16635.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh	(revision 16634)
++++ ../trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh	(revision 16635)
+@@ -111,7 +111,7 @@
+   "
+   ## testcase tag
+   content="$content
+-    <testcase assertions=\"1\" name=\"$testname $name\" time=\"$time\">
++    <testcase assertions=\"1\" name=\"$testname $ereg\" time=\"$time\">
+     $failure
+     <system-out>
+ <![CDATA[
Index: issm/oecreview/Archive/16554-17801/ISSM-16635-16636.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16635-16636.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16635-16636.diff	(revision 17802)
@@ -0,0 +1,51 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16635)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16636)
+@@ -3803,8 +3803,6 @@
+ 	thermalconductivity=matpar->GetThermalConductivity();
+ 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	this->parameters->FindParam(&stabilization,ThermalStabilizationEnum);
+-	Input* pressure_input=inputs->GetInput(PressureEnum);      _assert_(pressure_input);
+-	Input* enthalpy_input=inputs->GetInput(EnthalpyPicardEnum);_assert_(enthalpy_input); //for this iteration of the step
+ 	Input* vx_input=inputs->GetInput(VxEnum);                  _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum);                  _assert_(vy_input);
+ 	Input* vz_input=inputs->GetInput(VzEnum);                  _assert_(vz_input);
+@@ -3823,7 +3821,7 @@
+ 
+ 		/*Conduction: */  
+ 		GetBConduct(&B_conduct[0][0],&xyz_list[0][0],gauss); 
+-		GetInputListOnVertices(&enthalpy[0],EnthalpyEnum);
++		GetInputListOnVertices(&enthalpy[0],EnthalpyPicardEnum);
+ 		GetInputListOnVertices(&pressure[0],PressureEnum);
+ 		kappa=matpar->GetEnthalpyDiffusionParameterVolume(enthalpy,pressure); _assert_(kappa>0.);
+ 
+@@ -4252,15 +4250,12 @@
+ 	Input* vx_input=inputs->GetInput(VxEnum);                                  _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum);                                  _assert_(vy_input);
+ 	Input* vz_input=inputs->GetInput(VzEnum);                                  _assert_(vz_input);
+-	Input* pressure_input=inputs->GetInput(PressureEnum);                      _assert_(pressure_input);
+ 	Input* enthalpy_input=NULL; 
+-	Input* enthalpypicard_input=NULL; 
+ 	if(reCast<bool,IssmDouble>(dt)){
+ 		enthalpy_input=inputs->GetInput(EnthalpyEnum); _assert_(enthalpy_input);
+ 	}
+ 	if (stabilization==2){
+ 		diameter=MinEdgeLength(xyz_list);
+-		enthalpypicard_input=inputs->GetInput(EnthalpyPicardEnum); _assert_(enthalpypicard_input);
+ 	}
+ 
+ 	/* Start  looping on the number of gaussian points: */
+@@ -4409,10 +4404,10 @@
+ 	Input* vx_input=inputs->GetInput(VxEnum);                         _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum);                         _assert_(vy_input);
+ 	Input* vz_input=inputs->GetInput(VzEnum);                         _assert_(vz_input);
+-	Input* enthalpy_input=inputs->GetInput(EnthalpyEnum);             _assert_(enthalpy_input);
++	Input* enthalpy_input=inputs->GetInput(EnthalpyPicardEnum);       _assert_(enthalpy_input);
+ 	Input* pressure_input=inputs->GetInput(PressureEnum);             _assert_(pressure_input);
+ 	Input* geothermalflux_input=inputs->GetInput(BasalforcingsGeothermalfluxEnum); _assert_(geothermalflux_input);
+-	Input* watercolumn_input=inputs->GetInput(WatercolumnEnum); _assert_(watercolumn_input);
++	Input* watercolumn_input=inputs->GetInput(WatercolumnEnum);       _assert_(watercolumn_input);
+ 
+ 	/*Build friction element, needed later: */
+ 	friction=new Friction("3d",inputs,matpar,analysis_type);
Index: issm/oecreview/Archive/16554-17801/ISSM-16636-16637.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16636-16637.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16636-16637.diff	(revision 17802)
@@ -0,0 +1,22 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateSingleNodeToElementConnectivity.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateSingleNodeToElementConnectivity.cpp	(revision 16636)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateSingleNodeToElementConnectivity.cpp	(revision 16637)
+@@ -29,12 +29,12 @@
+ 	connectivity=xNewZeroInit<int>(iomodel->numberofvertices);
+ 
+ 	/*Get element width (3 or 6)*/
+-	if(iomodel->meshtype==Mesh2DhorizontalEnum){
+-		elementswidth=3;
++	switch(iomodel->meshtype){
++		case Mesh2DhorizontalEnum: elementswidth=3; break;
++		case Mesh2DverticalEnum  : elementswidth=3; break;
++		case Mesh3DEnum          : elementswidth=6; break;
++		default:  _error_("mesh type "<<EnumToStringx(iomodel->meshtype)<<" not supported yet");
+ 	}
+-	else{
+-		elementswidth=6;
+-	}
+ 
+ 	/*Create connectivity table*/
+ 	for(int i=0;i<iomodel->numberofelements;i++){
Index: issm/oecreview/Archive/16554-17801/ISSM-16637-16638.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16637-16638.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16637-16638.diff	(revision 17802)
@@ -0,0 +1,794 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 16637)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 16638)
+@@ -56,6 +56,8 @@
+ 	iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
+ 	iomodel->FetchDataToInput(elements,EplHeadEnum);
++	iomodel->FetchDataToInput(elements,HydrologydcEplThicknessEnum);
++	
+ }/*}}}*/
+ void HydrologyDCEfficientAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16637)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16638)
+@@ -113,7 +113,8 @@
+ 	HydrologydcEplCompressibilityEnum,
+ 	HydrologydcEplPorosityEnum,
+ 	HydrologydcEplThicknessEnum,
+-	HydrologydcEplTransmitivityEnum,
++	HydrologydcEplThicknessOldEnum,
++	HydrologydcEplConductivityEnum,
+ 	HydrologydcIsefficientlayerEnum,
+ 	HydrologydcSedimentlimitFlagEnum,
+ 	HydrologydcSedimentlimitEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 16637)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 16638)
+@@ -121,7 +121,8 @@
+ 		case HydrologydcEplCompressibilityEnum : return "HydrologydcEplCompressibility";
+ 		case HydrologydcEplPorosityEnum : return "HydrologydcEplPorosity";
+ 		case HydrologydcEplThicknessEnum : return "HydrologydcEplThickness";
+-		case HydrologydcEplTransmitivityEnum : return "HydrologydcEplTransmitivity";
++		case HydrologydcEplThicknessOldEnum : return "HydrologydcEplThicknessOld";
++		case HydrologydcEplConductivityEnum : return "HydrologydcEplConductivity";
+ 		case HydrologydcIsefficientlayerEnum : return "HydrologydcIsefficientlayer";
+ 		case HydrologydcSedimentlimitFlagEnum : return "HydrologydcSedimentlimitFlag";
+ 		case HydrologydcSedimentlimitEnum : return "HydrologydcSedimentlimit";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 16637)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 16638)
+@@ -121,7 +121,8 @@
+ 	      else if (strcmp(name,"HydrologydcEplCompressibility")==0) return HydrologydcEplCompressibilityEnum;
+ 	      else if (strcmp(name,"HydrologydcEplPorosity")==0) return HydrologydcEplPorosityEnum;
+ 	      else if (strcmp(name,"HydrologydcEplThickness")==0) return HydrologydcEplThicknessEnum;
+-	      else if (strcmp(name,"HydrologydcEplTransmitivity")==0) return HydrologydcEplTransmitivityEnum;
++	      else if (strcmp(name,"HydrologydcEplThicknessOld")==0) return HydrologydcEplThicknessOldEnum;
++	      else if (strcmp(name,"HydrologydcEplConductivity")==0) return HydrologydcEplConductivityEnum;
+ 	      else if (strcmp(name,"HydrologydcIsefficientlayer")==0) return HydrologydcIsefficientlayerEnum;
+ 	      else if (strcmp(name,"HydrologydcSedimentlimitFlag")==0) return HydrologydcSedimentlimitFlagEnum;
+ 	      else if (strcmp(name,"HydrologydcSedimentlimit")==0) return HydrologydcSedimentlimitEnum;
+@@ -135,11 +136,11 @@
+ 	      else if (strcmp(name,"HydrologySedimentKmax")==0) return HydrologySedimentKmaxEnum;
+ 	      else if (strcmp(name,"WaterTransfer")==0) return WaterTransferEnum;
+ 	      else if (strcmp(name,"IndependentObject")==0) return IndependentObjectEnum;
+-	      else if (strcmp(name,"InversionControlParameters")==0) return InversionControlParametersEnum;
+          else stage=2;
+    }
+    if(stage==2){
+-	      if (strcmp(name,"InversionCostFunctionThreshold")==0) return InversionCostFunctionThresholdEnum;
++	      if (strcmp(name,"InversionControlParameters")==0) return InversionControlParametersEnum;
++	      else if (strcmp(name,"InversionCostFunctionThreshold")==0) return InversionCostFunctionThresholdEnum;
+ 	      else if (strcmp(name,"InversionCostFunctionsCoefficients")==0) return InversionCostFunctionsCoefficientsEnum;
+ 	      else if (strcmp(name,"InversionCostFunctions")==0) return InversionCostFunctionsEnum;
+ 	      else if (strcmp(name,"InversionGradientScaling")==0) return InversionGradientScalingEnum;
+@@ -258,11 +259,11 @@
+ 	      else if (strcmp(name,"SteadystateNumRequestedOutputs")==0) return SteadystateNumRequestedOutputsEnum;
+ 	      else if (strcmp(name,"SteadystateReltol")==0) return SteadystateReltolEnum;
+ 	      else if (strcmp(name,"SteadystateRequestedOutputs")==0) return SteadystateRequestedOutputsEnum;
+-	      else if (strcmp(name,"Surface")==0) return SurfaceEnum;
+          else stage=3;
+    }
+    if(stage==3){
+-	      if (strcmp(name,"SurfaceforcingsPrecipitation")==0) return SurfaceforcingsPrecipitationEnum;
++	      if (strcmp(name,"Surface")==0) return SurfaceEnum;
++	      else if (strcmp(name,"SurfaceforcingsPrecipitation")==0) return SurfaceforcingsPrecipitationEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsMassBalance")==0) return SurfaceforcingsMassBalanceEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsIspdd")==0) return SurfaceforcingsIspddEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsDesfac")==0) return SurfaceforcingsDesfacEnum;
+@@ -381,11 +382,11 @@
+ 	      else if (strcmp(name,"DoubleParam")==0) return DoubleParamEnum;
+ 	      else if (strcmp(name,"DoubleVecParam")==0) return DoubleVecParamEnum;
+ 	      else if (strcmp(name,"Element")==0) return ElementEnum;
+-	      else if (strcmp(name,"ExternalResult")==0) return ExternalResultEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"FileParam")==0) return FileParamEnum;
++	      if (strcmp(name,"ExternalResult")==0) return ExternalResultEnum;
++	      else if (strcmp(name,"FileParam")==0) return FileParamEnum;
+ 	      else if (strcmp(name,"Input")==0) return InputEnum;
+ 	      else if (strcmp(name,"IntInput")==0) return IntInputEnum;
+ 	      else if (strcmp(name,"InputToExtrude")==0) return InputToExtrudeEnum;
+@@ -504,11 +505,11 @@
+ 	      else if (strcmp(name,"BasalFriction")==0) return BasalFrictionEnum;
+ 	      else if (strcmp(name,"ViscousHeating")==0) return ViscousHeatingEnum;
+ 	      else if (strcmp(name,"QmuTemperature")==0) return QmuTemperatureEnum;
+-	      else if (strcmp(name,"HydrologyWaterVx")==0) return HydrologyWaterVxEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"HydrologyWaterVy")==0) return HydrologyWaterVyEnum;
++	      if (strcmp(name,"HydrologyWaterVx")==0) return HydrologyWaterVxEnum;
++	      else if (strcmp(name,"HydrologyWaterVy")==0) return HydrologyWaterVyEnum;
+ 	      else if (strcmp(name,"StressTensor")==0) return StressTensorEnum;
+ 	      else if (strcmp(name,"StressTensorxx")==0) return StressTensorxxEnum;
+ 	      else if (strcmp(name,"StressTensorxy")==0) return StressTensorxyEnum;
+Index: ../trunk-jpl/src/c/modules/InputDuplicatex/InputDuplicatex.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/InputDuplicatex/InputDuplicatex.cpp	(revision 16637)
++++ ../trunk-jpl/src/c/modules/InputDuplicatex/InputDuplicatex.cpp	(revision 16638)
+@@ -8,7 +8,6 @@
+ #include "../../toolkits/toolkits.h"
+ 
+ void InputDuplicatex(FemModel* femmodel,int original_enum, int new_enum){
+-
+ 	/*Go through elemnets, and ask to reinitialie the input: */
+ 	for(int i=0;i<femmodel->elements->Size();i++){
+ 		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16637)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16638)
+@@ -128,9 +128,12 @@
+ 			femmodel->HydrologyEPLupdateDomainx();
+ 			femmodel->parameters->SetParam(HydrologyEfficientEnum,HydrologyLayerEnum);
+ 
++			/*Reset constraint on the ZigZag Lock*/
++			ResetConstraintsx(femmodel);
+ 			/*Iteration on the EPL layer*/
+ 			eplconverged = false;
+ 			for(;;){
++				femmodel->HydrologyEPLThicknessx();
+ 				femmodel->HydrologyTransferx();
+ 				SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
+ 				CreateNodalConstraintsx(&ys,femmodel->nodes,HydrologyDCEfficientAnalysisEnum);
+Index: ../trunk-jpl/src/c/cores/hydrology_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/hydrology_core.cpp	(revision 16637)
++++ ../trunk-jpl/src/c/cores/hydrology_core.cpp	(revision 16638)
+@@ -83,6 +83,7 @@
+ 			femmodel->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);
+ 			if (isefficientlayer){
+ 				InputDuplicatex(femmodel,EplHeadEnum,EplHeadOldEnum);
++				InputDuplicatex(femmodel,HydrologydcEplThicknessEnum,HydrologydcEplThicknessOldEnum);
+ 			}
+ 			
+ 			/*Proceed now to heads computations*/
+@@ -91,8 +92,8 @@
+ 			if(save_results && ((i+1)%output_frequency==0 || (i+1)==nsteps)){
+ 				if(VerboseSolution()) _printf0_("   saving results \n");
+ 				if(isefficientlayer){
+-					int outputs[6] = {SedimentHeadEnum,SedimentHeadResidualEnum,EplHeadEnum,HydrologydcMaskEplactiveEnum,EplHeadSlopeXEnum,EplHeadSlopeYEnum};
+-					femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],6);
++					int outputs[7] = {SedimentHeadEnum,SedimentHeadResidualEnum,EplHeadEnum,HydrologydcMaskEplactiveEnum,EplHeadSlopeXEnum,EplHeadSlopeYEnum,HydrologydcEplThicknessEnum};
++					femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],7);
+ 				}
+ 				else{
+ 					int outputs[2] = {SedimentHeadEnum,SedimentHeadResidualEnum};
+Index: ../trunk-jpl/src/c/classes/Materials/Matice.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 16637)
++++ ../trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 16638)
+@@ -144,6 +144,20 @@
+ 	return pow(B,-n);
+ }
+ /*}}}*/
++/*FUNCTION Matice::GetAbar {{{*/
++IssmDouble Matice::GetAbar(){
++	/*
++	 * A = 1/B^n
++	 */
++
++	IssmDouble B,n;
++
++	inputs->GetInputAverage(&B,MaterialsRheologyBbarEnum);
++	n=this->GetN();
++
++	return pow(B,-n);
++}
++/*}}}*/
+ /*FUNCTION Matice::GetB {{{*/
+ IssmDouble Matice::GetB(){
+ 
+Index: ../trunk-jpl/src/c/classes/Materials/Material.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Material.h	(revision 16637)
++++ ../trunk-jpl/src/c/classes/Materials/Material.h	(revision 16638)
+@@ -35,6 +35,7 @@
+ 		virtual void       GetViscosityDerivativeEpsSquareFS(IssmDouble* pmu_prime, IssmDouble* pepsilon)=0;
+ 		virtual void       GetViscosity2dDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* pepsilon)=0;
+ 		virtual IssmDouble GetA()=0;
++		virtual IssmDouble GetAbar()=0;
+ 		virtual IssmDouble GetB()=0;
+ 		virtual IssmDouble GetBbar()=0;
+ 		virtual IssmDouble GetN()=0;
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 16637)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 16638)
+@@ -65,8 +65,7 @@
+ 		if(isefficientlayer){
+ 				iomodel->Constant(&this->epl_compressibility,HydrologydcEplCompressibilityEnum);
+ 				iomodel->Constant(&this->epl_porosity,HydrologydcEplPorosityEnum);
+-				iomodel->Constant(&this->epl_thickness,HydrologydcEplThicknessEnum);
+-				iomodel->Constant(&this->epl_transmitivity,HydrologydcEplTransmitivityEnum);
++				iomodel->Constant(&this->epl_conductivity,HydrologydcEplConductivityEnum);
+ 		}
+ 	}
+ 	else{
+@@ -353,9 +352,9 @@
+     ( this->water_compressibility+( this->sediment_compressibility/ this->sediment_porosity));		 
+ }		 
+ /*}}}*/ 
+-/*FUNCTION Matpar::GetEplStoring {{{*/
+-IssmDouble Matpar::GetEplStoring(){
+-	return this->rho_freshwater* this->g* this->epl_porosity* this->epl_thickness*
++/*FUNCTION Matpar::GetEplSpecificStoring {{{*/
++IssmDouble Matpar::GetEplSpecificStoring(){
++	return this->rho_freshwater* this->g* this->epl_porosity* 
+     ( this->water_compressibility+( this->epl_compressibility/ this->epl_porosity));		 
+ }		 
+ /*}}}*/ 
+@@ -368,10 +367,10 @@
+ IssmDouble Matpar::GetSedimentThickness(){
+ 	return sediment_thickness;		 
+ }		 
+-/*}}}*/ 
+-/*FUNCTION Matpar::GetEplTransitivity {{{*/
+-IssmDouble Matpar::GetEplTransmitivity(){
+-	return epl_transmitivity;		 
++/*}}}*/	
++/*FUNCTION Matpar::GetEplConductivity {{{*/
++IssmDouble Matpar::GetEplConductivity(){
++	return epl_conductivity;		 
+ }		 
+ /*}}}*/			 
+ /*FUNCTION Matpar::TMeltingPoint {{{*/
+Index: ../trunk-jpl/src/c/classes/Materials/Matice.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matice.h	(revision 16637)
++++ ../trunk-jpl/src/c/classes/Materials/Matice.h	(revision 16638)
+@@ -62,6 +62,7 @@
+ 		void       GetViscosityDerivativeEpsSquareFS(IssmDouble* pmu_prime, IssmDouble* pepsilon);
+ 		void       GetViscosity2dDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* pepsilon);
+ 		IssmDouble GetA();
++		IssmDouble GetAbar();
+ 		IssmDouble GetB();
+ 		IssmDouble GetBbar();
+ 		IssmDouble GetD();
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 16637)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 16638)
+@@ -48,8 +48,7 @@
+ 
+ 		IssmDouble  epl_compressibility;
+ 		IssmDouble  epl_porosity;	 
+-		IssmDouble  epl_thickness;
+-		IssmDouble  epl_transmitivity;	 
++		IssmDouble  epl_conductivity;	 
+ 
+ 		/*gia: */
+ 		IssmDouble lithosphere_shear_modulus;
+@@ -93,6 +92,7 @@
+ 		void       GetViscosityDerivativeEpsSquareFS(IssmDouble* pmu_prime, IssmDouble* pepsilon){_error_("not supported");};
+ 		void       GetViscosity2dDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* pepsilon){_error_("not supported");};
+ 		IssmDouble GetA(){_error_("not supported");};
++		IssmDouble GetAbar(){_error_("not supported");};
+ 		IssmDouble GetB(){_error_("not supported");};
+ 		IssmDouble GetBbar(){_error_("not supported");};
+ 		IssmDouble GetN(){_error_("not supported");};
+@@ -120,10 +120,10 @@
+ 		IssmDouble GetHydrologyCR();
+ 		IssmDouble GetHydrologyN();
+ 		IssmDouble GetSedimentStoring();
+-		IssmDouble GetEplStoring();
++		IssmDouble GetEplSpecificStoring();
+ 		IssmDouble GetSedimentTransmitivity();
+ 		IssmDouble GetSedimentThickness();
+-		IssmDouble GetEplTransmitivity();
++		IssmDouble GetEplConductivity();
+ 		IssmDouble TMeltingPoint(IssmDouble pressure);
+ 		IssmDouble PureIceEnthalpy(IssmDouble pressure);
+ 		IssmDouble GetEnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure);
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16637)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16638)
+@@ -1577,8 +1577,9 @@
+ void  Tria::InputDuplicate(int original_enum,int new_enum){
+ 
+ 	/*Call inputs method*/
+-	if (IsInput(original_enum)) inputs->DuplicateInput(original_enum,new_enum);
+-
++	if (IsInput(original_enum)) {
++		inputs->DuplicateInput(original_enum,new_enum);
++	}
+ }
+ /*}}}*/
+ /*FUNCTION Tria::InputScale{{{*/
+@@ -2096,6 +2097,8 @@
+ 				name==SedimentHeadEnum ||
+ 				name==EplHeadOldEnum ||
+ 				name==EplHeadEnum ||
++				name==HydrologydcEplThicknessOldEnum ||
++				name==HydrologydcEplThicknessEnum ||
+ 				name==HydrologydcMaskEplactiveEnum ||
+ 				name==MeshVertexonbedEnum ||
+ 				name==WaterTransferEnum ||
+@@ -2454,10 +2457,6 @@
+ 				this->ComputeStressTensor();
+ 				input=this->inputs->GetInput(output_enum);
+ 				break;
+-      		case SurfaceNormalVelocityEnum:
+-			      this->ComputeSurfaceNormalVelocity();
+-				input=this->inputs->GetInput(output_enum);
+-				break;
+ 			default:
+ 				_error_("input "<<EnumToStringx(output_enum)<<" not found in element");
+ 		}
+@@ -2489,9 +2488,6 @@
+ 			for(int i=0;i<NUMVERTICES;i++) values[i] = values[i]/reCast<IssmDouble>(connectivity[i]);
+ 
+ 			vector->SetValues(NUMVERTICES,&sidlist[0],&values[0],ADD_VAL);
+-			
+-			/*FIXME: Inputs needs to be updated first in Tria::ResultInterpolation, this is a hack*/
+-			this->inputs->DeleteInput(SurfaceNormalVelocityEnum);
+ 			break;
+ 					}
+ 		default:
+@@ -2650,53 +2646,6 @@
+ 	*(surface_normal+2) = normal[2]/normal_norm;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::ComputeSurfaceNormalVelocity{{{*/
+-void Tria::ComputeSurfaceNormalVelocity(){
+-
+-  IssmDouble      sum,tangential_vector[2],normal_vector[2],time,ux,uy;
+-  IssmDouble      normal_velocity[NUMVERTICES],xyz_list[NUMVERTICES][3];
+-  IssmDouble      value[NUMVERTICES],verticesonsurface[NUMVERTICES];
+-
+-  for(int iv=0;iv<NUMVERTICES;iv++){
+-    normal_velocity[iv]=0.;
+-    value[iv]=0.;
+-  }
+-
+-  GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-
+-  GaussTria* gauss=new GaussTria();
+-  Input* slope_input=inputs->GetInput(SurfaceSlopeXEnum); _assert_(slope_input);
+-  //  Input* slope_input= inputs->GetInput(SurfaceEnum); _assert_(slope_input);
+-  Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+-  Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+-
+-
+-  /*Get list of nodes on surface*/
+-  GetInputListOnVertices(&verticesonsurface[0],MeshVertexonsurfaceEnum);  
+-  sum = verticesonsurface[0]+verticesonsurface[1]+verticesonsurface[2];
+-  _assert_(sum==0. || sum==1. || sum==2.);
+-
+-  /*Compute normal velocity for surface nodes from L2 projected slope*/
+-  for(int iv=0;iv<NUMVERTICES;iv++){
+-    if(verticesonsurface[iv] == 1){
+-	gauss->GaussNode(P1Enum,iv);	
+-	slope_input->GetInputValue(&value[iv],gauss);
+-	//	slope_input->GetInputDerivativeValue(&value[iv],&xyz_list[0][0],gauss);
+-	vx_input->GetInputValue(&ux,gauss);
+-	vy_input->GetInputValue(&uy,gauss);
+-	tangential_vector[0]=sqrt(1./(pow(value[iv],2.)+1.));
+-	tangential_vector[1]=value[iv]*tangential_vector[0];
+-	normal_vector[0]=-1.*tangential_vector[1];
+-	normal_vector[1]=tangential_vector[0];
+-     	normal_velocity[iv]=ux*normal_vector[0]+uy*normal_vector[1];
+-    }
+-  }
+-
+-  delete gauss;
+-  this->inputs->AddInput(new TriaInput(SurfaceNormalVelocityEnum,&normal_velocity[0],P1Enum));
+-
+-}
+-/*}}}*/
+ /*FUNCTION Tria::TimeAdapt{{{*/
+ IssmDouble  Tria::TimeAdapt(void){
+ 
+@@ -3277,7 +3226,7 @@
+ 	/*Now get the average SMB over the element*/
+ 	Input* smb_input = inputs->GetInput(SurfaceforcingsMassBalanceEnum); _assert_(smb_input);
+ 	smb_input->GetInputAverage(&smb);																								// average smb on element in m ice s-1
+-	Total_Smb=rho_ice*base*smb;																											// smb on element in kg s-1
++   Total_Smb=rho_ice*base*smb;																											// smb on element in kg s-1
+ 
+ 	/*Return: */
+ 	return Total_Smb;
+@@ -6733,9 +6682,10 @@
+ ElementMatrix* Tria::CreateKMatrixHydrologyDCEfficient(void){
+ 
+ 	/* Intermediaries */
+-	IssmDouble  D_scalar,Jdet;
+-	IssmDouble 	epl_transmitivity,dt;
+-	IssmDouble  epl_storing;
++	IssmDouble  D_scalar,Jdet,dt;
++	IssmDouble  epl_thickness;
++	IssmDouble 	epl_conductivity;
++	IssmDouble  epl_specificstoring;
+ 	IssmDouble  xyz_list[NUMVERTICES][3];
+ 
+ 	/*Check that all nodes are active, else return empty matrix*/
+@@ -6754,19 +6704,23 @@
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	Input* thickness_input=inputs->GetInput(HydrologydcEplThicknessEnum); _assert_(thickness);
+ 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	epl_storing       = matpar->GetEplStoring();
+-	epl_transmitivity = matpar->GetEplTransmitivity();
++	epl_specificstoring = matpar->GetEplSpecificStoring();
++	epl_conductivity    = matpar->GetEplConductivity();
+ 
++
+ 	/* Start looping on the number of gaussian points: */
+ 	GaussTria* gauss=new GaussTria(2);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
++		
++		
+ 		gauss->GaussPoint(ig);
+ 		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
++		thickness_input->GetInputValue(&epl_thickness,gauss);
+ 
+ 		/*Diffusivity*/
+-		D_scalar=epl_transmitivity*gauss->weight*Jdet;
++		D_scalar=epl_conductivity*epl_thickness*gauss->weight*Jdet;
+ 		if(reCast<bool,IssmDouble>(dt)) D_scalar=D_scalar*dt;
+ 		D[0][0]=D_scalar; D[0][1]=0.;
+ 		D[1][0]=0.;       D[1][1]=D_scalar;
+@@ -6779,7 +6733,7 @@
+ 		/*Transient*/
+ 		if(reCast<bool,IssmDouble>(dt)){
+ 			GetNodalFunctions(basis,gauss);
+-			D_scalar=epl_storing*gauss->weight*Jdet;
++			D_scalar=epl_specificstoring*epl_thickness*gauss->weight*Jdet;
+ 
+ 			TripleMultiply(basis,numnodes,1,0,
+ 						&D_scalar,1,1,0,
+@@ -6915,7 +6869,8 @@
+ 	IssmDouble xyz_list[NUMVERTICES][3];
+ 	IssmDouble dt,scalar,water_head;
+ 	IssmDouble transfer,residual;
+-	IssmDouble epl_storing;
++	IssmDouble epl_thickness;
++	IssmDouble epl_specificstoring;
+ 	GaussTria* gauss = NULL;
+ 
+ 	/*Check that all nodes are active, else return empty matrix*/
+@@ -6931,11 +6886,12 @@
+ 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	epl_storing = matpar->GetEplStoring();
++	epl_specificstoring = matpar->GetEplSpecificStoring();
+ 	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	Input* residual_input=inputs->GetInput(SedimentHeadResidualEnum);  _assert_(residual_input);
+-	Input* transfer_input=inputs->GetInput(WaterTransferEnum);  _assert_(transfer_input);
++	Input* residual_input=inputs->GetInput(SedimentHeadResidualEnum);     _assert_(residual_input);
++	Input* transfer_input=inputs->GetInput(WaterTransferEnum);            _assert_(transfer_input);
++	Input* thickness_input=inputs->GetInput(HydrologydcEplThicknessEnum); _assert_(thickness_input);
+ 	Input* old_wh_input=NULL; 
+ 
+ 	if(reCast<bool,IssmDouble>(dt)){
+@@ -6958,8 +6914,9 @@
+ 
+ 		/*Transient term*/
+ 		if(reCast<bool,IssmDouble>(dt)){
++			thickness_input->GetInputValue(&epl_thickness,gauss);
+ 			old_wh_input->GetInputValue(&water_head,gauss);
+-			scalar = Jdet*gauss->weight*water_head*epl_storing;
++			scalar = Jdet*gauss->weight*water_head*epl_specificstoring*epl_thickness;
+ 			for(int i=0;i<numnodes;i++) pe->values[i]+=scalar*basis[i];
+ 		}
+ 	}
+@@ -7141,8 +7098,8 @@
+ 	IssmDouble sed_trans,sed_thick;
+ 	IssmDouble leakage,h_max;
+ 	IssmDouble wh_trans;
+-	IssmDouble activeEpl[numdof];
+-	IssmDouble eplstoring[numdof],sedstoring[numdof];
++	IssmDouble activeEpl[numdof],epl_thickness[numdof];
++	IssmDouble epl_specificstoring[numdof],sedstoring[numdof];
+ 	IssmDouble epl_head[numdof],sed_head[numdof];
+ 
+ 	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+@@ -7164,6 +7121,7 @@
+ 			GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveEnum);
+ 			GetInputListOnVertices(&sed_head[0],SedimentHeadEnum); 
+ 			GetInputListOnVertices(&epl_head[0],EplHeadEnum);
++			GetInputListOnVertices(&epl_thickness[0],HydrologydcEplThicknessEnum);
+ 
+ 			this->parameters->FindParam(&leakage,HydrologydcLeakageFactorEnum);
+ 
+@@ -7176,12 +7134,12 @@
+ 					wh_trans=0.0;
+ 				}
+ 				else{
+-					eplstoring[i]=matpar->GetEplStoring();		
++					epl_specificstoring[i]=matpar->GetEplSpecificStoring();		
+ 					sedstoring[i]=matpar->GetSedimentStoring();
+ 
+ 					/*EPL head higher than sediment head, transfer from the epl to the sediment*/
+ 					if(epl_head[i]>sed_head[i]){
+-						wh_trans=eplstoring[i]*sed_trans*(epl_head[i]-sed_head[i])/(leakage*sed_thick);				
++						wh_trans=epl_specificstoring[i]*epl_thickness[i]*sed_trans*(epl_head[i]-sed_head[i])/(leakage*sed_thick);				
+ 
+ 						/*No transfer if the sediment head is allready at the maximum*/
+ 						this->GetHydrologyDCInefficientHmax(&h_max,nodes[i]);
+@@ -7245,7 +7203,7 @@
+ 	GetInputListOnVertices(&eplhead[0],EplHeadEnum);
+ 	GetInputListOnVertices(&residual[0],SedimentHeadResidualEnum);
+ 
+-	/*Get minimum sediment head*/
++	/*Get minimum sediment head of the element*/
+ 	sedheadmin=sedhead[0];
+ 	for(i=1;i<numdof;i++) if(sedhead[i]<=sedheadmin)sedheadmin=sedhead[i];
+ 
+@@ -7279,6 +7237,63 @@
+ /*}}}*/
+ /*FUNCTION Tria::ComputeEPLThickness{{{*/
+ void  Tria::ComputeEPLThickness(void){
++
++	int         i;
++	const int   numdof         = NDOF1 *NUMVERTICES;
++	bool        isefficientlayer;
++	IssmDouble  n,A,dt;
++	IssmDouble  rho_water,rho_ice;
++	IssmDouble  gravity,latentheat,EPLgrad;
++	IssmDouble  EPL_N,epl_conductivity;
++	IssmDouble  activeEpl[numdof],thickness[numdof];
++	IssmDouble  eplhead[numdof], old_thickness[numdof];
++	IssmDouble  epl_slopeX[numdof],epl_slopeY[numdof];
++	IssmDouble  ice_thickness[numdof],bed[numdof];
++
++
++	/*Get the flag to know if the efficient layer is present*/
++	this->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);
++	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
++
++	if(isefficientlayer){
++		/*For now, assuming just one way to compute EPL thickness*/
++		rho_water  = matpar->GetRhoWater();
++		rho_ice    = matpar->GetRhoIce();
++		gravity    = matpar->GetG();
++		latentheat = matpar->GetLatentHeat();
++		n          = material->GetN();
++		A          = material->GetAbar();
++		
++		GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveEnum);
++		GetInputListOnVertices(&eplhead[0],EplHeadEnum);
++		GetInputListOnVertices(&epl_slopeX[0],EplHeadSlopeXEnum); 
++		GetInputListOnVertices(&epl_slopeY[0],EplHeadSlopeYEnum);
++		GetInputListOnVertices(&old_thickness[0],HydrologydcEplThicknessOldEnum);
++		GetInputListOnVertices(&ice_thickness[0],ThicknessEnum);
++		GetInputListOnVertices(&bed[0],BedEnum);
++		
++		epl_conductivity = matpar->GetEplConductivity();
++		
++		for(int i=0;i<numdof;i++){
++			/*Keeping thickness to 1 if EPL is not active*/
++			if(activeEpl[i]==0.0){
++				thickness[i]=1.0;
++			}
++			else{
++
++				/*Compute first the effective pressure in the EPL*/
++				EPL_N=gravity*((rho_ice*ice_thickness[i])-(rho_water*(eplhead[i]-bed[i])));
++				
++				/*Get then the gradient of EPL heads*/
++				EPLgrad = epl_slopeX[i]+epl_slopeY[i];
++				
++				/*And proceed to the real thing*/
++				thickness[i] = old_thickness[i]*(1-((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*pow(EPLgrad,2.0)-2.0*(A*dt/(pow(n,n)))*EPL_N);
++
++			}
++		}
++		this->inputs->AddInput(new TriaInput(HydrologydcEplThicknessEnum,thickness,P1Enum));
++	}
+ }
+ /*}}}*/
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16637)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16638)
+@@ -2644,6 +2644,8 @@
+ 				name==EplHeadEnum ||
+ 				name==SedimentHeadOldEnum ||
+ 				name==EplHeadOldEnum ||
++				name==HydrologydcEplThicknessOldEnum ||
++				name==HydrologydcEplThicknessEnum ||
+ 				name==HydrologydcMaskEplactiveEnum ||
+ 				name==WaterTransferEnum
+ 
+@@ -2870,7 +2872,7 @@
+ 
+ 	switch(input->GetResultInterpolation()){
+ 		case P0Enum:
+-			_error_("not implemented...");
++			_error_("P0 not implemented yet for input "<<EnumToStringx(output_enum));
+ 			break;
+ 		case P1Enum:{
+ 			IssmDouble  values[NUMVERTICES];
+@@ -10841,12 +10843,77 @@
+ /*FUNCTION Penta::ComputeEPLThickness{{{*/
+ void  Penta::ComputeEPLThickness(void){
+ 
++	int         i;
++	const int   numdof   = NDOF1 *NUMVERTICES;
++	const int   numdof2d = NDOF1 *NUMVERTICES2D;
++	bool        isefficientlayer;
++	IssmDouble  n,A,dt;
++	IssmDouble  rho_water,rho_ice;
++	IssmDouble  gravity,latentheat,EPLgrad;
++	IssmDouble  EPL_N,epl_conductivity;
++	IssmDouble  activeEpl[numdof],thickness[numdof];
++	IssmDouble  eplhead[numdof], old_thickness[numdof];
++	IssmDouble  epl_slopeX[numdof],epl_slopeY[numdof];
++	IssmDouble  ice_thickness[numdof],bed[numdof];
++	Penta       *penta = NULL;
++	/*If not on bed, return*/
+ 	if (!IsOnBed())return;
+ 
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	tria->ComputeEPLThickness();
+-	delete tria->material; delete tria;
++	/*Get the flag to know if the efficient layer is present*/
++	this->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);
++	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+ 
++	if(isefficientlayer){
++		/*For now, assuming just one way to compute EPL thickness*/
++		rho_water        = matpar->GetRhoWater();
++		rho_ice          = matpar->GetRhoIce();
++		gravity          = matpar->GetG();
++		latentheat       = matpar->GetLatentHeat();
++		epl_conductivity = matpar->GetEplConductivity();
++		n                = material->GetN();
++		A                = material->GetA();
++		
++		
++		GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveEnum);
++		GetInputListOnVertices(&eplhead[0],EplHeadEnum);
++		GetInputListOnVertices(&epl_slopeX[0],EplHeadSlopeXEnum); 
++		GetInputListOnVertices(&epl_slopeY[0],EplHeadSlopeYEnum);
++		GetInputListOnVertices(&old_thickness[0],HydrologydcEplThicknessOldEnum);
++		GetInputListOnVertices(&ice_thickness[0],ThicknessEnum);
++		GetInputListOnVertices(&bed[0],BedEnum);
++		
++		for(int i=0;i<numdof2d;i++){
++			/*Keeping thickness to 1 if EPL is not active*/
++			if(activeEpl[i]==0.0){
++				thickness[i]=1.0;
++				thickness[i+numdof2d]=thickness[i];
++			}
++			else{
++
++				/*Compute first the effective pressure in the EPL*/
++				EPL_N=gravity*((rho_ice*ice_thickness[i])-(rho_water*(eplhead[i]-bed[i])));
++				
++				/*Get then the gradient of EPL heads*/
++				EPLgrad = epl_slopeX[i]+epl_slopeY[i];
++				
++				/*And proceed to the real thing*/
++				thickness[i] = old_thickness[i]*(1-((rho_water*gravity*dt)/(rho_ice* latentheat))*epl_conductivity*pow(EPLgrad,2.0)-2.0*(A*dt/(pow(n,n)))*EPL_N);
++				thickness[i+numdof2d]=thickness[i];
++			}
++		}
++		penta=this;
++		for(;;){
++
++			/*Add input to the element: */			
++			penta->inputs->AddInput(new PentaInput(HydrologydcEplThicknessEnum,thickness,P1Enum));
++			
++			/*Stop if we have reached the surface*/
++			if (penta->IsOnSurface()) break;
++			
++			/* get upper Penta*/
++			penta=penta->GetUpperElement(); _assert_(penta->Id()!=this->id);
++		}
++	}
+ }
+ /*}}}*/
+ /*FUNCTION Penta::InputUpdateFromSolutionHydrologyDCInefficient{{{*/
+Index: ../trunk-jpl/src/m/classes/hydrologydc.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/hydrologydc.m	(revision 16637)
++++ ../trunk-jpl/src/m/classes/hydrologydc.m	(revision 16638)
+@@ -26,7 +26,7 @@
+ 		epl_compressibility      = 0;
+ 		epl_porosity             = 0;
+ 		epl_thickness            = 0;
+-		epl_transmitivity        = 0;
++		epl_conductivity         = 0;
+   end
+ 	methods
+ 		% {{{ function obj = hydrologydc(varargin) 
+@@ -60,7 +60,7 @@
+ 			obj.epl_compressibility      = 1.0e-08;
+ 			obj.epl_porosity             = 0.4;
+ 			obj.epl_thickness            = 1.0;
+-			obj.epl_transmitivity        = 8.0e-02;
++			obj.epl_conductivity         = 8.0e-02;
+ 
+ 		end 
+ 		% }}}
+@@ -96,7 +96,7 @@
+ 				md = checkfield(md,'hydrology.epl_compressibility','>',0,'numel',1);
+ 				md = checkfield(md,'hydrology.epl_porosity','>',0,'numel',1);
+ 				md = checkfield(md,'hydrology.epl_thickness','>',0,'numel',1);
+-				md = checkfield(md,'hydrology.epl_transmitivity','>',0,'numel',1);
++				md = checkfield(md,'hydrology.epl_conductivity','>',0,'numel',1);
+ 	    end
+ 		end 
+ 		% }}}
+@@ -136,8 +136,8 @@
+ 				fielddisplay(obj,'mask_eplactive','active (1) or not (0) EPL');
+ 				fielddisplay(obj,'epl_compressibility','epl compressibility [Pa^-1]');
+ 				fielddisplay(obj,'epl_porosity','epl [dimensionless]');
+-				fielddisplay(obj,'epl_thickness','epl thickness [m]');
+-				fielddisplay(obj,'epl_transmitivity','epl transmitivity [m^2/s]');
++				fielddisplay(obj,'epl_thickness','epl initial thickness [m]');
++				fielddisplay(obj,'epl_conductivity','epl conductivity [m^2/s]');
+ 	    end
+ 
+ 		end 
+@@ -171,7 +171,8 @@
+ 				WriteData(fid,'object',obj,'fieldname','epl_compressibility','format','Double');			
+ 				WriteData(fid,'object',obj,'fieldname','epl_porosity','format','Double');			
+ 				WriteData(fid,'object',obj,'fieldname','epl_thickness','format','Double');
+-				WriteData(fid,'object',obj,'fieldname','epl_transmitivity','format','Double');
++				%WriteData(fid,'object',obj,'fieldname','epl_transmitivity','format','Double');
++				WriteData(fid,'object',obj,'fieldname','epl_conductivity','format','Double');
+ 			end
+ 		end 
+ % }}}
+Index: ../trunk-jpl/src/m/enum/HydrologydcEplConductivityEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/HydrologydcEplConductivityEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/HydrologydcEplConductivityEnum.m	(revision 16638)
+@@ -0,0 +1,11 @@
++function macro=HydrologydcEplConductivityEnum()
++%HYDROLOGYDCEPLCONDUCTIVITYENUM - Enum of HydrologydcEplConductivity
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=HydrologydcEplConductivityEnum()
++
++macro=StringToEnum('HydrologydcEplConductivity');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 16637)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 16638)
+@@ -113,7 +113,8 @@
+ def HydrologydcEplCompressibilityEnum(): return StringToEnum("HydrologydcEplCompressibility")[0]
+ def HydrologydcEplPorosityEnum(): return StringToEnum("HydrologydcEplPorosity")[0]
+ def HydrologydcEplThicknessEnum(): return StringToEnum("HydrologydcEplThickness")[0]
+-def HydrologydcEplTransmitivityEnum(): return StringToEnum("HydrologydcEplTransmitivity")[0]
++def HydrologydcEplThicknessOldEnum(): return StringToEnum("HydrologydcEplThicknessOld")[0]
++def HydrologydcEplConductivityEnum(): return StringToEnum("HydrologydcEplConductivity")[0]
+ def HydrologydcIsefficientlayerEnum(): return StringToEnum("HydrologydcIsefficientlayer")[0]
+ def HydrologydcSedimentlimitFlagEnum(): return StringToEnum("HydrologydcSedimentlimitFlag")[0]
+ def HydrologydcSedimentlimitEnum(): return StringToEnum("HydrologydcSedimentlimit")[0]
+Index: ../trunk-jpl/src/m/enum/HydrologydcEplThicknessOldEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/HydrologydcEplThicknessOldEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/HydrologydcEplThicknessOldEnum.m	(revision 16638)
+@@ -0,0 +1,11 @@
++function macro=HydrologydcEplThicknessOldEnum()
++%HYDROLOGYDCEPLTHICKNESSOLDENUM - Enum of HydrologydcEplThicknessOld
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=HydrologydcEplThicknessOldEnum()
++
++macro=StringToEnum('HydrologydcEplThicknessOld');
Index: issm/oecreview/Archive/16554-17801/ISSM-16638-16639.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16638-16639.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16638-16639.diff	(revision 17802)
@@ -0,0 +1,16 @@
+Index: ../trunk-jpl/src/m/enum/HydrologydcEplTransmitivityEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/HydrologydcEplTransmitivityEnum.m	(revision 16638)
++++ ../trunk-jpl/src/m/enum/HydrologydcEplTransmitivityEnum.m	(revision 16639)
+@@ -1,11 +0,0 @@
+-function macro=HydrologydcEplTransmitivityEnum()
+-%HYDROLOGYDCEPLTRANSMITIVITYENUM - Enum of HydrologydcEplTransmitivity
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=HydrologydcEplTransmitivityEnum()
+-
+-macro=StringToEnum('HydrologydcEplTransmitivity');
Index: issm/oecreview/Archive/16554-17801/ISSM-16639-16640.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16639-16640.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16639-16640.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16639)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16640)
+@@ -6704,7 +6704,7 @@
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* thickness_input=inputs->GetInput(HydrologydcEplThicknessEnum); _assert_(thickness);
++	Input* thickness_input=inputs->GetInput(HydrologydcEplThicknessEnum); _assert_(thickness_input);
+ 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	epl_specificstoring = matpar->GetEplSpecificStoring();
+ 	epl_conductivity    = matpar->GetEplConductivity();
Index: issm/oecreview/Archive/16554-17801/ISSM-16640-16641.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16640-16641.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16640-16641.diff	(revision 17802)
@@ -0,0 +1,21 @@
+Index: ../trunk-jpl/src/c/classes/IoModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 16640)
++++ ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 16641)
+@@ -157,13 +157,13 @@
+ 				_printf0_("=========================================================================\n");
+ 				_printf0_(" Enums in marshalled file are not compatible with compiled code          \n");
+ 				_printf0_("                                                                         \n");
++				_printf0_("   * If you are running ISSM on your local machine:                      \n");
++				_printf0_("     make sure that all the code is compiled and installed (make install)\n");
+ 				_printf0_("   * If you are running ISSM on a remote cluster:                        \n");
+ 				_printf0_("     make sure that you are using the same version of ISSM on your local \n");
+ 				_printf0_("     machine and remote cluster (you might need to run svn update)       \n");
+-				_printf0_("   * If you are running ISSM on your local machine:                      \n");
+-				_printf0_("     make sure that all the code is compiled (modules and executables)   \n");
+ 				_printf0_("   * If you are a developer and just added a new Enum:                   \n");
+-				_printf0_("     you might need to run ./Synchronize.sh in src/c/EnumDefinitions     \n");
++				_printf0_("     you might need to run ./Synchronize.sh in src/c/shared/Enum         \n");
+ 				_printf0_("     and recompile                                                       \n");
+ 				_printf0_("=========================================================================\n");
+ 				_printf0_("\n");
Index: issm/oecreview/Archive/16554-17801/ISSM-16641-16642.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16641-16642.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16641-16642.diff	(revision 17802)
@@ -0,0 +1,20 @@
+Index: ../trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh	(revision 16641)
++++ ../trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh	(revision 16642)
+@@ -77,11 +77,12 @@
+   outf=/var/tmp/ju$$.txt
+   >$outf
+   echo ""                         | tee -a $outf
+-  echo "+++ Running case: $name " | tee -a $outf
++  echo "+++ Running case: $testname " | tee -a $outf
+   echo "+++ working dir: "`pwd`           | tee -a $outf
+-  echo "+++ command: $cmd"            | tee -a $outf
++  #echo "+++ command: $cmd"            | tee -a $outf
+   ini=`date +%s`
+-  eVal "$cmd" 2>&1                | tee -a $outf
++  #eVal "$cmd" 2>&1                | tee -a $outf
++  echo $cmd | tee -a $outf
+   evErr=`cat $errfile`
+   rm -f $errfile
+   end=`date +%s`
Index: issm/oecreview/Archive/16554-17801/ISSM-16642-16643.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16642-16643.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16642-16643.diff	(revision 17802)
@@ -0,0 +1,11 @@
+Index: ../trunk-jpl/jenkins/linux64_murdo
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo	(revision 16642)
++++ ../trunk-jpl/jenkins/linux64_murdo	(revision 16643)
+@@ -104,5 +104,5 @@
+ #as follows: runme($MATLAB_NROPTIONS). The options must be understandable
+ #by Matlab and runme.m
+ #ex: "'id',[101 102 103]"
+-MATLAB_NROPTIONS=""
++MATLAB_NROPTIONS="'id',[101 102 103]"
+ PYTHON_NROPTIONS=""
Index: issm/oecreview/Archive/16554-17801/ISSM-16643-16644.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16643-16644.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16643-16644.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh	(revision 16643)
++++ ../trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh	(revision 16644)
+@@ -82,7 +82,7 @@
+   #echo "+++ command: $cmd"            | tee -a $outf
+   ini=`date +%s`
+   #eVal "$cmd" 2>&1                | tee -a $outf
+-  echo $cmd | tee -a $outf
++  echo "$cmd" | tee -a $outf
+   evErr=`cat $errfile`
+   rm -f $errfile
+   end=`date +%s`
Index: issm/oecreview/Archive/16554-17801/ISSM-16644-16645.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16644-16645.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16644-16645.diff	(revision 17802)
@@ -0,0 +1,14 @@
+Index: ../trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh	(revision 16644)
++++ ../trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh	(revision 16645)
+@@ -81,8 +81,7 @@
+   echo "+++ working dir: "`pwd`           | tee -a $outf
+   #echo "+++ command: $cmd"            | tee -a $outf
+   ini=`date +%s`
+-  #eVal "$cmd" 2>&1                | tee -a $outf
+-  echo "$cmd" | tee -a $outf
++  eVal "$cmd" 2>&1                | tee -a $outf
+   evErr=`cat $errfile`
+   rm -f $errfile
+   end=`date +%s`
Index: issm/oecreview/Archive/16554-17801/ISSM-16645-16646.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16645-16646.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16645-16646.diff	(revision 17802)
@@ -0,0 +1,11 @@
+Index: ../trunk-jpl/jenkins/linux64_murdo
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo	(revision 16645)
++++ ../trunk-jpl/jenkins/linux64_murdo	(revision 16646)
+@@ -104,5 +104,5 @@
+ #as follows: runme($MATLAB_NROPTIONS). The options must be understandable
+ #by Matlab and runme.m
+ #ex: "'id',[101 102 103]"
+-MATLAB_NROPTIONS="'id',[101 102 103]"
++MATLAB_NROPTIONS=""
+ PYTHON_NROPTIONS=""
Index: issm/oecreview/Archive/16554-17801/ISSM-16646-16647.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16646-16647.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16646-16647.diff	(revision 17802)
@@ -0,0 +1,17 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16646)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16647)
+@@ -177,7 +177,11 @@
+ 
+ 	if(Ke){
+ 		/*Static condensation if requested*/
+-		if(this->element_type==P1bubblecondensedEnum){
++		if(this->element_type==MINIcondensedEnum){
++			int indices[2]={6,7};
++			Ke->StaticCondensation(2,&indices[0]);
++		}
++		else if(this->element_type==P1bubblecondensedEnum){
+ 			int size   = nodes[3]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
+ 			int offset = 0;
+ 			for(int i=0;i<3;i++) offset+=nodes[i]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
Index: issm/oecreview/Archive/16554-17801/ISSM-16647-16648.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16647-16648.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16647-16648.diff	(revision 17802)
@@ -0,0 +1,22 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16647)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16648)
+@@ -389,7 +389,16 @@
+ 	/*Add to global Vector*/
+ 	if(pe){
+ 		/*Static condensation if requested*/
+-		if(this->element_type==P1bubblecondensedEnum){
++		if(this->element_type==MINIcondensedEnum){
++			int indices[2]={6,7};
++			this->element_type=MINIEnum;
++			ElementMatrix* Ke = CreateKMatrixStressbalanceFS();
++			this->element_type=MINIcondensedEnum;
++
++			pe->StaticCondensation(Ke,2,&indices[0]);
++			delete Ke;
++		}
++		else if(this->element_type==P1bubblecondensedEnum){
+ 			int size   = nodes[3]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
+ 			int offset = 0;
+ 			for(int i=0;i<3;i++) offset+=nodes[i]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
Index: issm/oecreview/Archive/16554-17801/ISSM-16648-16649.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16648-16649.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16648-16649.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/test/NightlyRun/test333.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test333.m	(revision 16648)
++++ ../trunk-jpl/test/NightlyRun/test333.m	(revision 16649)
+@@ -16,7 +16,7 @@
+ md.hydrology.spcepl_head=NaN*ones(md.mesh.numberofvertices,1);
+ md.hydrology.mask_eplactive=0*ones(md.mesh.numberofvertices,1);
+ md.basalforcings.melting_rate = 2.0*ones(md.mesh.numberofvertices,1);
+-md.hydrology.epl_transmitivity=30;
++md.hydrology.epl_conductivity=30;
+ md.hydrology.epl_thickness=1;
+ md.timestepping.time_step=0.2;
+ md.timestepping.final_time=2.0;
+Index: ../trunk-jpl/test/NightlyRun/test335.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test335.m	(revision 16648)
++++ ../trunk-jpl/test/NightlyRun/test335.m	(revision 16649)
+@@ -16,7 +16,7 @@
+ md.hydrology.spcepl_head=NaN*ones(md.mesh.numberofvertices,1);
+ md.hydrology.mask_eplactive=0*ones(md.mesh.numberofvertices,1);
+ md.basalforcings.melting_rate = 2.0*ones(md.mesh.numberofvertices,1);
+-md.hydrology.epl_transmitivity=30;
++md.hydrology.epl_conductivity=30;
+ md.hydrology.epl_thickness=1;
+ md.timestepping.time_step=0.2;
+ md.timestepping.final_time=2.0;
Index: issm/oecreview/Archive/16554-17801/ISSM-16649-16650.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16649-16650.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16649-16650.diff	(revision 17802)
@@ -0,0 +1,8 @@
+Index: ../trunk-jpl/test/Archives/Archive333.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive335.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-16650-16651.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16650-16651.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16650-16651.diff	(revision 17802)
@@ -0,0 +1,15 @@
+Index: ../trunk-jpl/jenkins/jenkins.sh
+===================================================================
+--- ../trunk-jpl/jenkins/jenkins.sh	(revision 16650)
++++ ../trunk-jpl/jenkins/jenkins.sh	(revision 16651)
+@@ -311,8 +311,7 @@
+ #look through numtests:
+ for i in `echo $testlist`
+ do
+-	test=`awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" matlab_log.log`
+-	juLog  -test=$i -name=Error -error=ERROR echo $test
+-	juLog  -test=$i -name=Failure -error=FAILURE  echo $test
++	juLog  -test=$i -name=Error -error=ERROR awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" matlab_log.log
++	juLog  -test=$i -name=Failure -error=FAILURE awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" matlab_log.log
+ done
+ #}}}
Index: issm/oecreview/Archive/16554-17801/ISSM-16651-16652.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16651-16652.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16651-16652.diff	(revision 17802)
@@ -0,0 +1,77 @@
+Index: ../trunk-jpl/jenkins/linux64_murdo
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo	(revision 16651)
++++ ../trunk-jpl/jenkins/linux64_murdo	(revision 16652)
+@@ -53,18 +53,17 @@
+ EXTERNALPACKAGESDIR=$ISSM_DIR/externalpackages
+ 
+ #List of external pakages to be installed and their installation scripts
+-EXTERNALPACKAGES="shell2junit install.sh"
+-#EXTERNALPACKAGES="autotools install.sh                
+-#						matlab    install.sh                
+-#						mpich     install-3.0-linux64.sh    
+-#						cmake     install.sh                
+-#						petsc     install-3.4-linux64.sh    
+-#						triangle  install-linux64.sh        
+-#						boost     install.sh                
+-#						dakota    install-5.3.1-linux64.sh  
+-#						tao       install-2.2.sh
+-#						chaco     install.sh 
+-#						shell2junit install.sh"
++EXTERNALPACKAGES="autotools install.sh                
++						matlab    install.sh                
++						mpich     install-3.0-linux64.sh    
++						cmake     install.sh                
++						petsc     install-3.4-linux64.sh    
++						triangle  install-linux64.sh        
++						boost     install.sh                
++						dakota    install-5.3.1-linux64.sh  
++						tao       install-2.2.sh
++						chaco     install.sh 
++						shell2junit install.sh"
+ 
+ #---------------------#
+ # 4: ISSM Compilation #
+@@ -73,7 +72,7 @@
+ #ISSM_COMPILATION can have 2 values:
+ # - "yes" compile ISSM
+ # - "no"  do not compile ISSM
+-ISSM_COMPILATION="no"
++ISSM_COMPILATION="yes"
+ 
+ #----------------------#
+ # 5: Mail notification #
+Index: ../trunk-jpl/jenkins/imac
+===================================================================
+--- ../trunk-jpl/jenkins/imac	(revision 16651)
++++ ../trunk-jpl/jenkins/imac	(revision 16652)
+@@ -49,7 +49,7 @@
+ # - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
+ # - "none"    leave external packages as is
+ #             ->skip to section 4
+-ISSM_EXTERNALPACKAGES="none"
++ISSM_EXTERNALPACKAGES="install"
+ EXTERNALPACKAGESDIR=$ISSM_DIR/externalpackages
+ 
+ #List of external pakages to be installed and their installation scripts
+Index: ../trunk-jpl/jenkins/linux64_larsen
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_larsen	(revision 16651)
++++ ../trunk-jpl/jenkins/linux64_larsen	(revision 16652)
+@@ -21,6 +21,7 @@
+ 	--with-petsc-dir=$ISSM_DIR/externalpackages/petsc/install \
+ 	--with-petsc-arch=$ISSM_ARCH \
+ 	--with-mumps-dir=$ISSM_DIR/externalpackages/petsc/install/ \
++	--with-dakota-dir=$ISSM_DIR/externalpackages/dakota/install \
+ 	--with-blas-lapack-dir=$ISSM_DIR/externalpackages/petsc/install \
+ 	--with-chaco-dir="$ISSM_DIR/externalpackages/chaco/install" \
+ 	--with-numthreads=18 \
+@@ -48,7 +49,7 @@
+ # - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
+ # - "none"    leave external packages as is
+ #             ->skip to section 4
+-ISSM_EXTERNALPACKAGES="none"
++ISSM_EXTERNALPACKAGES="install"
+ EXTERNALPACKAGESDIR=$ISSM_DIR/externalpackages
+ 
+ #List of external pakages to be installed and their installation scripts
Index: issm/oecreview/Archive/16554-17801/ISSM-16652-16653.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16652-16653.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16652-16653.diff	(revision 17802)
@@ -0,0 +1,178 @@
+Index: ../trunk-jpl/src/c/classes/Params/BoolParam.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Params/BoolParam.cpp	(revision 16652)
++++ ../trunk-jpl/src/c/classes/Params/BoolParam.cpp	(revision 16653)
+@@ -42,9 +42,7 @@
+ /*FUNCTION BoolParam::DeepEcho{{{*/
+ void BoolParam::DeepEcho(void){
+ 
+-	_printf_("BoolParam:\n");
+-	_printf_("   enum:  " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
+-	_printf_("   value: " <<(this->value?"true":"false") << "\n");
++	_printf_("   BoolParam "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" "<<(value?"true":"false")<<"\n");
+ }
+ /*}}}*/
+ /*FUNCTION BoolParam::Id{{{*/
+Index: ../trunk-jpl/src/c/classes/Params/StringParam.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Params/StringParam.cpp	(revision 16652)
++++ ../trunk-jpl/src/c/classes/Params/StringParam.cpp	(revision 16653)
+@@ -43,9 +43,7 @@
+ /*}}}*/
+ /*FUNCTION StringParam::DeepEcho{{{*/
+ void StringParam::DeepEcho(void){
+-	_printf_("StringParam:\n");
+-	_printf_("   enum:  " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
+-	_printf_("   value: " << this->value << "\n");
++	_printf_("   StringParam "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" "<<this->value<<"\n");
+ }
+ /*}}}*/
+ /*FUNCTION StringParam::Id{{{*/
+Index: ../trunk-jpl/src/c/classes/Params/FileParam.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Params/FileParam.cpp	(revision 16652)
++++ ../trunk-jpl/src/c/classes/Params/FileParam.cpp	(revision 16653)
+@@ -42,9 +42,7 @@
+ /*FUNCTION FileParam::DeepEcho{{{*/
+ void FileParam::DeepEcho(void){
+ 
+-	_printf_("FileParam:\n");
+-	_printf_("   enum:  " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
+-	_printf_("   value: " << this->value << "\n");
++	_printf_("   FileParam "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" "<<this->value<<"\n");
+ }
+ /*}}}*/
+ /*FUNCTION FileParam::Id{{{*/
+Index: ../trunk-jpl/src/c/classes/Params/IntParam.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Params/IntParam.cpp	(revision 16652)
++++ ../trunk-jpl/src/c/classes/Params/IntParam.cpp	(revision 16653)
+@@ -42,9 +42,7 @@
+ /*FUNCTION IntParam::DeepEcho{{{*/
+ void IntParam::DeepEcho(void){
+ 
+-	_printf_("IntParam:\n");
+-	_printf_("   enum:  " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
+-	_printf_("   value: " << this->value << "\n");
++	_printf_("   IntParam "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" "<<this->value<<"\n");
+ }
+ /*}}}*/
+ /*FUNCTION IntParam::Id{{{*/
+Index: ../trunk-jpl/src/c/classes/Params/DoubleParam.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Params/DoubleParam.cpp	(revision 16652)
++++ ../trunk-jpl/src/c/classes/Params/DoubleParam.cpp	(revision 16653)
+@@ -39,9 +39,7 @@
+ /*FUNCTION DoubleParam::DeepEcho{{{*/
+ void DoubleParam::DeepEcho(void){
+ 
+-	_printf_("DoubleParam:\n");
+-	_printf_("   enum:  " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
+-	_printf_("   value: " << this->value << "\n");
++	_printf_("   DoubleParam "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" "<<this->value<<"\n");
+ }
+ /*}}}*/
+ /*FUNCTION DoubleParam::Id{{{*/
+Index: ../trunk-jpl/src/c/classes/Inputs/SegInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/SegInput.cpp	(revision 16652)
++++ ../trunk-jpl/src/c/classes/Inputs/SegInput.cpp	(revision 16653)
+@@ -49,9 +49,7 @@
+ /*FUNCTION SegInput::DeepEcho{{{*/
+ void SegInput::DeepEcho(void){
+ 
+-	_printf_("SegInput:\n");
+-	_printf_("   enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
+-	_printf_("   values: [");
++	_printf_("   SegInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" [");
+ 	for(int i=0;i<this->NumberofNodes();i++) _printf_(" "<<this->values[i]);
+ 	_printf_("]\n");
+ }
+Index: ../trunk-jpl/src/c/classes/Inputs/ControlInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/ControlInput.cpp	(revision 16652)
++++ ../trunk-jpl/src/c/classes/Inputs/ControlInput.cpp	(revision 16653)
+@@ -67,7 +67,7 @@
+ void ControlInput::DeepEcho(void){
+ 
+ 	_printf_("ControlInput:\n");
+-	_printf_("   enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
++	_printf_("   ControlInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<"\n");
+ 	_printf_("---values: \n");     if (values)      values->Echo();
+ 	_printf_("---savedvalues: \n");if (savedvalues) savedvalues->Echo();
+ 	_printf_("---minvalues: \n");  if (minvalues)   minvalues->Echo();
+Index: ../trunk-jpl/src/c/classes/Inputs/IntInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/IntInput.cpp	(revision 16652)
++++ ../trunk-jpl/src/c/classes/Inputs/IntInput.cpp	(revision 16653)
+@@ -34,9 +34,7 @@
+ /*FUNCTION IntInput::DeepEcho{{{*/
+ void IntInput::DeepEcho(void){
+ 
+-	_printf_("IntInput:\n");
+-	_printf_("   enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
+-	_printf_("   value: " << (int)this->value << "\n");
++	_printf_("   IntInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" "<<this->value<<"\n");
+ }
+ /*}}}*/
+ /*FUNCTION IntInput::Id{{{*/
+Index: ../trunk-jpl/src/c/classes/Inputs/BoolInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/BoolInput.cpp	(revision 16652)
++++ ../trunk-jpl/src/c/classes/Inputs/BoolInput.cpp	(revision 16653)
+@@ -39,9 +39,7 @@
+ /*FUNCTION BoolInput::DeepEcho{{{*/
+ void BoolInput::DeepEcho(void){
+ 
+-	_printf_("BoolInput:\n");
+-	_printf_("   enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
+-	_printf_("   value: " <<(value?"true":"false") << "\n");
++	_printf_("   BoolInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" "<<(value?"true":"false") << "\n");
+ }
+ /*}}}*/
+ /*FUNCTION BoolInput::Id{{{*/
+Index: ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 16652)
++++ ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 16653)
+@@ -49,9 +49,7 @@
+ /*FUNCTION TriaInput::DeepEcho{{{*/
+ void TriaInput::DeepEcho(void){
+ 
+-	_printf_("TriaInput:\n");
+-	_printf_("   enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
+-	_printf_("   values: [");
++	_printf_("   TriaInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" [");
+ 	for(int i=0;i<this->NumberofNodes();i++) _printf_(" "<<this->values[i]);
+ 	_printf_("]\n");
+ }
+Index: ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 16652)
++++ ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 16653)
+@@ -49,9 +49,7 @@
+ /*FUNCTION PentaInput::DeepEcho{{{*/
+ void PentaInput::DeepEcho(void){
+ 
+-	_printf_("PentaInput:\n");
+-	_printf_("   enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
+-	_printf_("   values: [");
++	_printf_("   PentaInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" [");
+ 	for(int i=0;i<this->NumberofNodes();i++) _printf_(" "<<this->values[i]);
+ 	_printf_("]\n");
+ }
+Index: ../trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp	(revision 16652)
++++ ../trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp	(revision 16653)
+@@ -39,9 +39,7 @@
+ /*FUNCTION DoubleInput::DeepEcho{{{*/
+ void DoubleInput::DeepEcho(void){
+ 
+-	_printf_("DoubleInput:\n");
+-	_printf_("   enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
+-	_printf_("   value: " << this->value << "\n");
++	_printf_("   DoubleInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" "<<this->value<<"\n");
+ }
+ /*}}}*/
+ /*FUNCTION DoubleInput::Id{{{*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16653-16654.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16653-16654.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16653-16654.diff	(revision 17802)
@@ -0,0 +1,20 @@
+Index: ../trunk-jpl/test/Archives/Archive120.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive432.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive325.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive122.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive431.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-16654-16655.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16654-16655.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16654-16655.diff	(revision 17802)
@@ -0,0 +1,137 @@
+Index: ../trunk-jpl/src/c/classes/Params/BoolParam.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Params/BoolParam.cpp	(revision 16654)
++++ ../trunk-jpl/src/c/classes/Params/BoolParam.cpp	(revision 16655)
+@@ -41,8 +41,7 @@
+ /*}}}*/
+ /*FUNCTION BoolParam::DeepEcho{{{*/
+ void BoolParam::DeepEcho(void){
+-
+-	_printf_("   BoolParam "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" "<<(value?"true":"false")<<"\n");
++	_printf_(setw(22)<<"   BoolParam "<<setw(35)<<left<<EnumToStringx(this->enum_type)<<" "<<(value?"true":"false")<<"\n");
+ }
+ /*}}}*/
+ /*FUNCTION BoolParam::Id{{{*/
+Index: ../trunk-jpl/src/c/classes/Params/StringParam.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Params/StringParam.cpp	(revision 16654)
++++ ../trunk-jpl/src/c/classes/Params/StringParam.cpp	(revision 16655)
+@@ -43,7 +43,7 @@
+ /*}}}*/
+ /*FUNCTION StringParam::DeepEcho{{{*/
+ void StringParam::DeepEcho(void){
+-	_printf_("   StringParam "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" "<<this->value<<"\n");
++	_printf_(setw(22)<<"   StringParam "<<setw(35)<<left<<EnumToStringx(this->enum_type)<<" "<<this->value<<"\n");
+ }
+ /*}}}*/
+ /*FUNCTION StringParam::Id{{{*/
+Index: ../trunk-jpl/src/c/classes/Params/DoubleVecParam.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Params/DoubleVecParam.cpp	(revision 16654)
++++ ../trunk-jpl/src/c/classes/Params/DoubleVecParam.cpp	(revision 16655)
+@@ -41,23 +41,15 @@
+ /*FUNCTION DoubleVecParam::Echo {{{*/
+ void DoubleVecParam::Echo(void){
+ 
+-	_printf_("DoubleVecParam:\n");
+-	_printf_("   enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
+-	_printf_("   vector size: " << this->M << "\n");
++	_printf_(setw(22)<<"   DoubleVecParam "<<setw(35)<<left<<EnumToStringx(this->enum_type)<<" size: "<<this->M<<"\n");
+ 
+ }
+ /*}}}*/
+ /*FUNCTION DoubleVecParam::DeepEcho{{{*/
+ void DoubleVecParam::DeepEcho(void){
+-
+-	int i;
+-
+-	_printf_("DoubleVecParam:\n");
+-	_printf_("   enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
+-	_printf_("   vector size: " << this->M << "\n");
+-	for(i=0;i<this->M;i++){
+-		_printf_(i << " " << this->values[i] << "\n");
+-	}
++	_printf_(setw(22)<<"   DoubleVecParam "<<setw(35)<<left<<EnumToStringx(this->enum_type)<<" "<<"[");
++	for(int i=0;i<this->M;i++) _printf_(" "<< this->values[i]);
++	_printf_("\n");
+ }
+ /*}}}*/
+ /*FUNCTION DoubleVecParam::Id{{{*/
+Index: ../trunk-jpl/src/c/classes/Params/FileParam.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Params/FileParam.cpp	(revision 16654)
++++ ../trunk-jpl/src/c/classes/Params/FileParam.cpp	(revision 16655)
+@@ -42,7 +42,7 @@
+ /*FUNCTION FileParam::DeepEcho{{{*/
+ void FileParam::DeepEcho(void){
+ 
+-	_printf_("   FileParam "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" "<<this->value<<"\n");
++	_printf_(setw(22)<<"   FileParam "<<setw(35)<<left<<EnumToStringx(this->enum_type)<<" "<<this->value<<"\n");
+ }
+ /*}}}*/
+ /*FUNCTION FileParam::Id{{{*/
+Index: ../trunk-jpl/src/c/classes/Params/DataSetParam.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Params/DataSetParam.cpp	(revision 16654)
++++ ../trunk-jpl/src/c/classes/Params/DataSetParam.cpp	(revision 16655)
+@@ -43,9 +43,9 @@
+ /*FUNCTION DataSetParam::DeepEcho{{{*/
+ void DataSetParam::DeepEcho(void){
+ 
+-	_printf_("DataSetParam:\n");
+-	_printf_("   enum:  " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
++	_printf_(setw(22)<<"   DataSetParam "<<setw(35)<<left<<EnumToStringx(this->enum_type)<<" ----- begin\n");
+ 	this->value->Echo();
++	_printf_(setw(22)<<"   DataSetParam "<<setw(35)<<left<<EnumToStringx(this->enum_type)<<" ----- end\n");
+ }
+ /*}}}*/
+ /*FUNCTION DataSetParam::Id{{{*/
+Index: ../trunk-jpl/src/c/classes/Params/IntParam.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Params/IntParam.cpp	(revision 16654)
++++ ../trunk-jpl/src/c/classes/Params/IntParam.cpp	(revision 16655)
+@@ -42,7 +42,7 @@
+ /*FUNCTION IntParam::DeepEcho{{{*/
+ void IntParam::DeepEcho(void){
+ 
+-	_printf_("   IntParam "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" "<<this->value<<"\n");
++	_printf_(setw(22)<<"   IntParam "<<setw(35)<<left<<EnumToStringx(this->enum_type)<<" "<<this->value<<"\n");
+ }
+ /*}}}*/
+ /*FUNCTION IntParam::Id{{{*/
+Index: ../trunk-jpl/src/c/classes/Params/StringArrayParam.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Params/StringArrayParam.cpp	(revision 16654)
++++ ../trunk-jpl/src/c/classes/Params/StringArrayParam.cpp	(revision 16655)
+@@ -66,15 +66,9 @@
+ /*FUNCTION StringArrayParam::DeepEcho{{{*/
+ void StringArrayParam::DeepEcho(void){
+ 
+-	int i;
+-	char* string=NULL;
+-
+-	_printf_("StringArrayParam:\n");
+-	_printf_("   enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
+-	for(i=0;i<this->numstrings;i++){
+-		string=this->value[i];
+-		_printf_("   " << i << ": " << string << "\n");
+-	}
++	_printf_(setw(22)<<"   StringArrayParam "<<setw(35)<<left<<EnumToStringx(this->enum_type)<<" {");
++	for(int i=0;i<this->numstrings;i++) _printf_(" '"<<this->value[i]<<"'");
++	_printf_("}\n");
+ }
+ /*}}}*/
+ /*FUNCTION StringArrayParam::Id{{{*/
+Index: ../trunk-jpl/src/c/classes/Params/DoubleParam.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Params/DoubleParam.cpp	(revision 16654)
++++ ../trunk-jpl/src/c/classes/Params/DoubleParam.cpp	(revision 16655)
+@@ -39,7 +39,7 @@
+ /*FUNCTION DoubleParam::DeepEcho{{{*/
+ void DoubleParam::DeepEcho(void){
+ 
+-	_printf_("   DoubleParam "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" "<<this->value<<"\n");
++	_printf_(setw(22)<<"   DoubleParam "<<setw(35)<<left<<EnumToStringx(this->enum_type)<<" "<<this->value<<"\n");
+ }
+ /*}}}*/
+ /*FUNCTION DoubleParam::Id{{{*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16655-16656.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16655-16656.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16655-16656.diff	(revision 17802)
@@ -0,0 +1,91 @@
+Index: ../trunk-jpl/src/c/classes/Inputs/SegInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/SegInput.cpp	(revision 16655)
++++ ../trunk-jpl/src/c/classes/Inputs/SegInput.cpp	(revision 16656)
+@@ -49,7 +49,7 @@
+ /*FUNCTION SegInput::DeepEcho{{{*/
+ void SegInput::DeepEcho(void){
+ 
+-	_printf_("   SegInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" [");
++	_printf_(setw(15)<<"   SegInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" [");
+ 	for(int i=0;i<this->NumberofNodes();i++) _printf_(" "<<this->values[i]);
+ 	_printf_("]\n");
+ }
+Index: ../trunk-jpl/src/c/classes/Inputs/ControlInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/ControlInput.cpp	(revision 16655)
++++ ../trunk-jpl/src/c/classes/Inputs/ControlInput.cpp	(revision 16656)
+@@ -67,7 +67,7 @@
+ void ControlInput::DeepEcho(void){
+ 
+ 	_printf_("ControlInput:\n");
+-	_printf_("   ControlInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<"\n");
++	_printf_(setw(15)<<"   ControlInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<"\n");
+ 	_printf_("---values: \n");     if (values)      values->Echo();
+ 	_printf_("---savedvalues: \n");if (savedvalues) savedvalues->Echo();
+ 	_printf_("---minvalues: \n");  if (minvalues)   minvalues->Echo();
+Index: ../trunk-jpl/src/c/classes/Inputs/IntInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/IntInput.cpp	(revision 16655)
++++ ../trunk-jpl/src/c/classes/Inputs/IntInput.cpp	(revision 16656)
+@@ -34,7 +34,7 @@
+ /*FUNCTION IntInput::DeepEcho{{{*/
+ void IntInput::DeepEcho(void){
+ 
+-	_printf_("   IntInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" "<<this->value<<"\n");
++	_printf_(setw(15)<<"   IntInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" "<<this->value<<"\n");
+ }
+ /*}}}*/
+ /*FUNCTION IntInput::Id{{{*/
+Index: ../trunk-jpl/src/c/classes/Inputs/BoolInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/BoolInput.cpp	(revision 16655)
++++ ../trunk-jpl/src/c/classes/Inputs/BoolInput.cpp	(revision 16656)
+@@ -39,7 +39,7 @@
+ /*FUNCTION BoolInput::DeepEcho{{{*/
+ void BoolInput::DeepEcho(void){
+ 
+-	_printf_("   BoolInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" "<<(value?"true":"false") << "\n");
++	_printf_(setw(15)<<"   BoolInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" "<<(value?"true":"false") << "\n");
+ }
+ /*}}}*/
+ /*FUNCTION BoolInput::Id{{{*/
+Index: ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 16655)
++++ ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 16656)
+@@ -49,7 +49,7 @@
+ /*FUNCTION TriaInput::DeepEcho{{{*/
+ void TriaInput::DeepEcho(void){
+ 
+-	_printf_("   TriaInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" [");
++	_printf_(setw(15)<<"   TriaInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" [");
+ 	for(int i=0;i<this->NumberofNodes();i++) _printf_(" "<<this->values[i]);
+ 	_printf_("]\n");
+ }
+Index: ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 16655)
++++ ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 16656)
+@@ -49,7 +49,7 @@
+ /*FUNCTION PentaInput::DeepEcho{{{*/
+ void PentaInput::DeepEcho(void){
+ 
+-	_printf_("   PentaInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" [");
++	_printf_(setw(15)<<"   PentaInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" [");
+ 	for(int i=0;i<this->NumberofNodes();i++) _printf_(" "<<this->values[i]);
+ 	_printf_("]\n");
+ }
+Index: ../trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp	(revision 16655)
++++ ../trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp	(revision 16656)
+@@ -39,7 +39,7 @@
+ /*FUNCTION DoubleInput::DeepEcho{{{*/
+ void DoubleInput::DeepEcho(void){
+ 
+-	_printf_("   DoubleInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" "<<this->value<<"\n");
++	_printf_(setw(15)<<"   DoubleInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" "<<this->value<<"\n");
+ }
+ /*}}}*/
+ /*FUNCTION DoubleInput::Id{{{*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16656-16657.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16656-16657.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16656-16657.diff	(revision 17802)
@@ -0,0 +1,110 @@
+Index: ../trunk-jpl/src/c/classes/matrix/ElementMatrix.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/matrix/ElementMatrix.cpp	(revision 16656)
++++ ../trunk-jpl/src/c/classes/matrix/ElementMatrix.cpp	(revision 16657)
+@@ -268,8 +268,13 @@
+ 			for(i=0;i<this->row_fsize;i++){
+ 				for(j=0;j<this->row_fsize;j++){
+ 					*(localvalues+this->row_fsize*i+j)=*(this->values+this->ncols*this->row_flocaldoflist[i]+this->row_flocaldoflist[j]);
++					//if(this->row_fglobaldoflist[i]==0 && this->row_fglobaldoflist[j]==304) printf("rank = %i\n",IssmComm::GetRank());
++					if(this->row_fglobaldoflist[i]==0 && *(this->values+this->ncols*this->row_flocaldoflist[i]+this->row_flocaldoflist[j])!=0.){
++						//printf("[%i] dof = %i\n",IssmComm::GetRank(),this->row_fglobaldoflist[j]);
++					}
+ 				}
+ 			}
++
+ 			/*add local values into global  matrix, using the fglobaldoflist: */
+ 			Kff->SetValues(this->row_fsize,this->row_fglobaldoflist,this->row_fsize,this->row_fglobaldoflist,localvalues,ADD_VAL);
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16656)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16657)
+@@ -2163,6 +2163,19 @@
+ 	}
+ }
+ /*}}}*/
++/*FUNCTION Tria::HasNodeOnBed {{{*/
++bool Tria::HasNodeOnBed(){
++
++	IssmDouble values[NUMVERTICES];
++	IssmDouble sum;
++
++	/*Retrieve all inputs and parameters*/
++	GetInputListOnVertices(&values[0],MeshVertexonbedEnum);
++	sum = values[0]+values[1]+values[2];
++
++	return sum>0.;
++}
++/*}}}*/
+ /*FUNCTION Tria::HasEdgeOnSurface {{{*/
+ bool Tria::HasEdgeOnSurface(){
+ 
+@@ -2185,6 +2198,19 @@
+ 	}
+ }
+ /*}}}*/
++/*FUNCTION Tria::HasNodeOnSurface {{{*/
++bool Tria::HasNodeOnSurface(){
++
++	IssmDouble values[NUMVERTICES];
++	IssmDouble sum;
++
++	/*Retrieve all inputs and parameters*/
++	GetInputListOnVertices(&values[0],MeshVertexonbedEnum);
++	sum = values[0]+values[1]+values[2];
++
++	return sum>0.;
++}
++/*}}}*/
+ /*FUNCTION Tria::EdgeOnBedIndices{{{*/
+ void Tria::EdgeOnBedIndices(int* pindex1,int* pindex2){
+ 
+@@ -2804,21 +2830,23 @@
+ /*FUNCTION Tria::UpdateConstraintsExtrudeFromBase{{{*/
+ void  Tria::UpdateConstraintsExtrudeFromBase(void){
+ 
+-	if(!HasEdgeOnBed()) return;
++	if(!HasNodeOnBed()) return;
+ 
+-	int extrusioninput;
+-	int indices[2];
+-	IssmDouble value;
++	int        extrusioninput;
++	IssmDouble value,isonbed;
+ 
+ 	this->parameters->FindParam(&extrusioninput,InputToExtrudeEnum);
+-	Input* input = inputs->GetInput(extrusioninput); _assert_(extrusioninput);
+-	this->EdgeOnBedIndices(&indices[0],&indices[1]);
++	Input* input = inputs->GetInput(extrusioninput);      _assert_(extrusioninput);
++	Input* onbed = inputs->GetInput(MeshVertexonbedEnum); _assert_(onbed);
+ 
+ 	GaussTria* gauss=new GaussTria();
+-	for(int i=0;i<2;i++){
+-		gauss->GaussNode(P1Enum,indices[i]);
+-		input->GetInputValue(&value,gauss);
+-		this->nodes[indices[i]]->ApplyConstraint(1,value);
++	for(int iv=0;iv<this->NumberofNodes();iv++){
++		gauss->GaussNode(this->element_type,iv);
++		onbed->GetInputValue(&isonbed,gauss);
++		if(isonbed==1.){
++			input->GetInputValue(&value,gauss);
++			this->nodes[iv]->ApplyConstraint(1,value);
++		}
+ 	}
+ 	delete gauss;
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16656)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16657)
+@@ -85,7 +85,9 @@
+ 		int         Sid();
+ 		bool        IsOnBed();
+ 		bool        HasEdgeOnBed();
++		bool        HasNodeOnBed();
+ 		bool        HasEdgeOnSurface();
++		bool        HasNodeOnSurface();
+ 		void        EdgeOnSurfaceIndices(int* pindex1,int* pindex);
+ 		void        EdgeOnBedIndices(int* pindex1,int* pindex);
+ 		int         EdgeOnBedIndex();
Index: issm/oecreview/Archive/16554-17801/ISSM-16657-16658.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16657-16658.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16657-16658.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/src/c/classes/matrix/ElementMatrix.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/matrix/ElementMatrix.cpp	(revision 16657)
++++ ../trunk-jpl/src/c/classes/matrix/ElementMatrix.cpp	(revision 16658)
+@@ -267,11 +267,7 @@
+ 			localvalues=xNew<IssmDouble>(this->row_fsize*this->row_fsize);
+ 			for(i=0;i<this->row_fsize;i++){
+ 				for(j=0;j<this->row_fsize;j++){
+-					*(localvalues+this->row_fsize*i+j)=*(this->values+this->ncols*this->row_flocaldoflist[i]+this->row_flocaldoflist[j]);
+-					//if(this->row_fglobaldoflist[i]==0 && this->row_fglobaldoflist[j]==304) printf("rank = %i\n",IssmComm::GetRank());
+-					if(this->row_fglobaldoflist[i]==0 && *(this->values+this->ncols*this->row_flocaldoflist[i]+this->row_flocaldoflist[j])!=0.){
+-						//printf("[%i] dof = %i\n",IssmComm::GetRank(),this->row_fglobaldoflist[j]);
+-					}
++					localvalues[this->row_fsize*i+j]=this->values[this->ncols*this->row_flocaldoflist[i]+this->row_flocaldoflist[j]];
+ 				}
+ 			}
+ 
+@@ -287,7 +283,7 @@
+ 			localvalues=xNew<IssmDouble>(this->row_fsize*this->row_ssize);
+ 			for(i=0;i<this->row_fsize;i++){
+ 				for(j=0;j<this->row_ssize;j++){
+-					*(localvalues+this->row_ssize*i+j)=*(this->values+this->ncols*this->row_flocaldoflist[i]+this->row_slocaldoflist[j]);
++					localvalues[this->row_ssize*i+j]=this->values[this->ncols*this->row_flocaldoflist[i]+this->row_slocaldoflist[j]];
+ 				}
+ 			}
+ 			/*add local values into global  matrix, using the fglobaldoflist: */
Index: issm/oecreview/Archive/16554-17801/ISSM-16658-16659.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16658-16659.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16658-16659.diff	(revision 17802)
@@ -0,0 +1,64 @@
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16658)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16659)
+@@ -302,6 +302,7 @@
+ 	BalancevelocityAnalysisEnum,
+ 	BalancevelocitySolutionEnum,
+ 	L2ProjectionBaseAnalysisEnum,
++	L2ProjectionEPLAnalysisEnum,
+ 	BedSlopeSolutionEnum,
+ 	DamageEvolutionSolutionEnum,
+ 	DamageEvolutionAnalysisEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 16658)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 16659)
+@@ -308,6 +308,7 @@
+ 		case BalancevelocityAnalysisEnum : return "BalancevelocityAnalysis";
+ 		case BalancevelocitySolutionEnum : return "BalancevelocitySolution";
+ 		case L2ProjectionBaseAnalysisEnum : return "L2ProjectionBaseAnalysis";
++		case L2ProjectionEPLAnalysisEnum : return "L2ProjectionEPLAnalysis";
+ 		case BedSlopeSolutionEnum : return "BedSlopeSolution";
+ 		case DamageEvolutionSolutionEnum : return "DamageEvolutionSolution";
+ 		case DamageEvolutionAnalysisEnum : return "DamageEvolutionAnalysis";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 16658)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 16659)
+@@ -314,6 +314,7 @@
+ 	      else if (strcmp(name,"BalancevelocityAnalysis")==0) return BalancevelocityAnalysisEnum;
+ 	      else if (strcmp(name,"BalancevelocitySolution")==0) return BalancevelocitySolutionEnum;
+ 	      else if (strcmp(name,"L2ProjectionBaseAnalysis")==0) return L2ProjectionBaseAnalysisEnum;
++	      else if (strcmp(name,"L2ProjectionEPLAnalysis")==0) return L2ProjectionEPLAnalysisEnum;
+ 	      else if (strcmp(name,"BedSlopeSolution")==0) return BedSlopeSolutionEnum;
+ 	      else if (strcmp(name,"DamageEvolutionSolution")==0) return DamageEvolutionSolutionEnum;
+ 	      else if (strcmp(name,"DamageEvolutionAnalysis")==0) return DamageEvolutionAnalysisEnum;
+@@ -381,11 +382,11 @@
+ 	      else if (strcmp(name,"DoubleMatParam")==0) return DoubleMatParamEnum;
+ 	      else if (strcmp(name,"DoubleParam")==0) return DoubleParamEnum;
+ 	      else if (strcmp(name,"DoubleVecParam")==0) return DoubleVecParamEnum;
+-	      else if (strcmp(name,"Element")==0) return ElementEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"ExternalResult")==0) return ExternalResultEnum;
++	      if (strcmp(name,"Element")==0) return ElementEnum;
++	      else if (strcmp(name,"ExternalResult")==0) return ExternalResultEnum;
+ 	      else if (strcmp(name,"FileParam")==0) return FileParamEnum;
+ 	      else if (strcmp(name,"Input")==0) return InputEnum;
+ 	      else if (strcmp(name,"IntInput")==0) return IntInputEnum;
+@@ -504,11 +505,11 @@
+ 	      else if (strcmp(name,"Watercolumn")==0) return WatercolumnEnum;
+ 	      else if (strcmp(name,"BasalFriction")==0) return BasalFrictionEnum;
+ 	      else if (strcmp(name,"ViscousHeating")==0) return ViscousHeatingEnum;
+-	      else if (strcmp(name,"QmuTemperature")==0) return QmuTemperatureEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"HydrologyWaterVx")==0) return HydrologyWaterVxEnum;
++	      if (strcmp(name,"QmuTemperature")==0) return QmuTemperatureEnum;
++	      else if (strcmp(name,"HydrologyWaterVx")==0) return HydrologyWaterVxEnum;
+ 	      else if (strcmp(name,"HydrologyWaterVy")==0) return HydrologyWaterVyEnum;
+ 	      else if (strcmp(name,"StressTensor")==0) return StressTensorEnum;
+ 	      else if (strcmp(name,"StressTensorxx")==0) return StressTensorxxEnum;
Index: issm/oecreview/Archive/16554-17801/ISSM-16659-16660.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16659-16660.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16659-16660.diff	(revision 17802)
@@ -0,0 +1,28 @@
+Index: ../trunk-jpl/src/m/enum/L2ProjectionEPLAnalysisEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/L2ProjectionEPLAnalysisEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/L2ProjectionEPLAnalysisEnum.m	(revision 16660)
+@@ -0,0 +1,11 @@
++function macro=L2ProjectionEPLAnalysisEnum()
++%L2PROJECTIONEPLANALYSISENUM - Enum of L2ProjectionEPLAnalysis
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=L2ProjectionEPLAnalysisEnum()
++
++macro=StringToEnum('L2ProjectionEPLAnalysis');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 16659)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 16660)
+@@ -300,6 +300,7 @@
+ def BalancevelocityAnalysisEnum(): return StringToEnum("BalancevelocityAnalysis")[0]
+ def BalancevelocitySolutionEnum(): return StringToEnum("BalancevelocitySolution")[0]
+ def L2ProjectionBaseAnalysisEnum(): return StringToEnum("L2ProjectionBaseAnalysis")[0]
++def L2ProjectionEPLAnalysisEnum(): return StringToEnum("L2ProjectionEPLAnalysis")[0]
+ def BedSlopeSolutionEnum(): return StringToEnum("BedSlopeSolution")[0]
+ def DamageEvolutionSolutionEnum(): return StringToEnum("DamageEvolutionSolution")[0]
+ def DamageEvolutionAnalysisEnum(): return StringToEnum("DamageEvolutionAnalysis")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-16660-16661.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16660-16661.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16660-16661.diff	(revision 17802)
@@ -0,0 +1,43 @@
+Index: ../trunk-jpl/jenkins/jenkins.sh
+===================================================================
+--- ../trunk-jpl/jenkins/jenkins.sh	(revision 16660)
++++ ../trunk-jpl/jenkins/jenkins.sh	(revision 16661)
+@@ -97,16 +97,31 @@
+ 		PACKAGEINST=$(echo $EXTERNALPACKAGES | cut -d " " -f $NUM2-$NUM2)
+ 
+ 		cd $PACKAGENAME
+-		echo "======================================================";
+-		echo "       Installing $PACKAGENAME                        ";
+-		echo "======================================================";
+-		./$PACKAGEINST |  tee compil.log
+-		if [ $? -ne 0 ]; then
++
++		#tricky part here. We do not want to reinstall this package if it's already installed
++		#and the svn file which does the install has not be modified! To keep track of 
++		#this, we check the current svn version against the "last changed" revision number.  If they 
++		#are the same, we reinstall the package. 
++		current_version=`svnversion $PACKAGEINST`
++		last_changed_version=`svn info $PACKAGEINST | grep "Last Changed Rev" | awk '{printf("%s\n",$4);}'`
++
++		if [[ $current_version == $last_changed_version ]]; then 
++			#go ahead and reinstall. 
+ 			echo "======================================================";
+-			echo "    ERROR: installation of $PACKAGENAME failed        ";
++			echo "       Installing $PACKAGENAME                        ";
+ 			echo "======================================================";
++			./$PACKAGEINST |  tee compil.log
++			if [ $? -ne 0 ]; then
++				echo "======================================================";
++				echo "    ERROR: installation of $PACKAGENAME failed        ";
++				echo "======================================================";
++			fi
++			source $ISSM_DIR/etc/environment.sh
++		else
++			echo "======================================================";
++			echo "       Skipping install of $PACKAGENAME                        ";
++			echo "======================================================";
+ 		fi
+-		source $ISSM_DIR/etc/environment.sh
+ 		cd ..
+ 	done
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16661-16662.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16661-16662.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16661-16662.diff	(revision 17802)
@@ -0,0 +1,33 @@
+Index: ../trunk-jpl/jenkins/jenkins.sh
+===================================================================
+--- ../trunk-jpl/jenkins/jenkins.sh	(revision 16661)
++++ ../trunk-jpl/jenkins/jenkins.sh	(revision 16662)
+@@ -107,9 +107,28 @@
+ 
+ 		if [[ $current_version == $last_changed_version ]]; then 
+ 			#go ahead and reinstall. 
++			echo "For $PACKAGENAME: svn current_version  is $current_version and last changed version is $last_changed_version"
++			echo "Triggering new install of $PACKAGENAME"
++			install_test=1
++		else
++			#ok, we want to skip, unless the package is not installed: 
++			if [ -d install ]; then 
++				echo "For $PACKAGENAME: svn current_version  is $current_version and last changed version is $last_changed_version"
++				echo "and install directory exists, so skipping install of $PACKAGENAME"
++				install_test=0;
++			else
++				echo "For $PACKAGENAME: svn current_version  is $current_version and last changed version is $last_changed_version"
++				echo "However, install directory does not exist, so triggering install of $PACKAGENAME"
++				install_test=1;
++			fi
++		fi
++
++		if [[ $install_test == 1 ]]; then 
+ 			echo "======================================================";
+ 			echo "       Installing $PACKAGENAME                        ";
+ 			echo "======================================================";
++			echo "current version: $current_version"
++			echo "last changed version: $last_changed_version"
+ 			./$PACKAGEINST |  tee compil.log
+ 			if [ $? -ne 0 ]; then
+ 				echo "======================================================";
Index: issm/oecreview/Archive/16554-17801/ISSM-16662-16663.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16662-16663.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16662-16663.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/jenkins/jenkins.sh
+===================================================================
+--- ../trunk-jpl/jenkins/jenkins.sh	(revision 16662)
++++ ../trunk-jpl/jenkins/jenkins.sh	(revision 16663)
+@@ -127,8 +127,6 @@
+ 			echo "======================================================";
+ 			echo "       Installing $PACKAGENAME                        ";
+ 			echo "======================================================";
+-			echo "current version: $current_version"
+-			echo "last changed version: $last_changed_version"
+ 			./$PACKAGEINST |  tee compil.log
+ 			if [ $? -ne 0 ]; then
+ 				echo "======================================================";
Index: issm/oecreview/Archive/16554-17801/ISSM-16663-16664.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16663-16664.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16663-16664.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/jenkins/jenkins.sh
+===================================================================
+--- ../trunk-jpl/jenkins/jenkins.sh	(revision 16663)
++++ ../trunk-jpl/jenkins/jenkins.sh	(revision 16664)
+@@ -102,7 +102,7 @@
+ 		#and the svn file which does the install has not be modified! To keep track of 
+ 		#this, we check the current svn version against the "last changed" revision number.  If they 
+ 		#are the same, we reinstall the package. 
+-		current_version=`svnversion $PACKAGEINST`
++		current_version=`svnversion`
+ 		last_changed_version=`svn info $PACKAGEINST | grep "Last Changed Rev" | awk '{printf("%s\n",$4);}'`
+ 
+ 		if [[ $current_version == $last_changed_version ]]; then 
Index: issm/oecreview/Archive/16554-17801/ISSM-16664-16665.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16664-16665.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16664-16665.diff	(revision 17802)
@@ -0,0 +1,24 @@
+Index: ../trunk-jpl/jenkins/jenkins.sh
+===================================================================
+--- ../trunk-jpl/jenkins/jenkins.sh	(revision 16664)
++++ ../trunk-jpl/jenkins/jenkins.sh	(revision 16665)
+@@ -113,9 +113,16 @@
+ 		else
+ 			#ok, we want to skip, unless the package is not installed: 
+ 			if [ -d install ]; then 
+-				echo "For $PACKAGENAME: svn current_version  is $current_version and last changed version is $last_changed_version"
+-				echo "and install directory exists, so skipping install of $PACKAGENAME"
+-				install_test=0;
++				#could be empty, signaling a failed previous install: 
++				if [ "$(ls -A install)" ];then
++					echo "For $PACKAGENAME: svn current_version  is $current_version and last changed version is $last_changed_version"
++					echo "and install directory exists, so skipping install of $PACKAGENAME"
++					install_test=0;
++				else
++					echo "For $PACKAGENAME: svn current_version  is $current_version and last changed version is $last_changed_version"
++					echo "and install directory exists, however, it is empty, so triggering install of $PACKAGENAME"
++					install_test=1;
++				fi
+ 			else
+ 				echo "For $PACKAGENAME: svn current_version  is $current_version and last changed version is $last_changed_version"
+ 				echo "However, install directory does not exist, so triggering install of $PACKAGENAME"
Index: issm/oecreview/Archive/16554-17801/ISSM-16665-16666.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16665-16666.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16665-16666.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/jenkins/jenkins.sh
+===================================================================
+--- ../trunk-jpl/jenkins/jenkins.sh	(revision 16665)
++++ ../trunk-jpl/jenkins/jenkins.sh	(revision 16666)
+@@ -145,6 +145,7 @@
+ 			echo "======================================================";
+ 			echo "       Skipping install of $PACKAGENAME                        ";
+ 			echo "======================================================";
++			source $ISSM_DIR/etc/environment.sh #for good measure :)
+ 		fi
+ 		cd ..
+ 	done
Index: issm/oecreview/Archive/16554-17801/ISSM-16666-16667.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16666-16667.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16666-16667.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/jenkins/jenkins.sh
+===================================================================
+--- ../trunk-jpl/jenkins/jenkins.sh	(revision 16666)
++++ ../trunk-jpl/jenkins/jenkins.sh	(revision 16667)
+@@ -139,6 +139,8 @@
+ 				echo "======================================================";
+ 				echo "    ERROR: installation of $PACKAGENAME failed        ";
+ 				echo "======================================================";
++				#erase install directory, so that next time, we still try and compile this!
++				rm -rf install
+ 			fi
+ 			source $ISSM_DIR/etc/environment.sh
+ 		else
Index: issm/oecreview/Archive/16554-17801/ISSM-16667-16668.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16667-16668.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16667-16668.diff	(revision 17802)
@@ -0,0 +1,16 @@
+Index: ../trunk-jpl/src/m/enum/SurfaceNormalVelocityEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/SurfaceNormalVelocityEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/SurfaceNormalVelocityEnum.m	(revision 16668)
+@@ -0,0 +1,11 @@
++function macro=SurfaceNormalVelocityEnum()
++%SURFACENORMALVELOCITYENUM - Enum of SurfaceNormalVelocity
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=SurfaceNormalVelocityEnum()
++
++macro=StringToEnum('SurfaceNormalVelocity');
Index: issm/oecreview/Archive/16554-17801/ISSM-16668-16669.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16668-16669.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16668-16669.diff	(revision 17802)
@@ -0,0 +1,42 @@
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16668)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16669)
+@@ -301,8 +301,8 @@
+ 	BalancethicknessSoftSolutionEnum,
+ 	BalancevelocityAnalysisEnum,
+ 	BalancevelocitySolutionEnum,
++	L2ProjectionEPLAnalysisEnum,
+ 	L2ProjectionBaseAnalysisEnum,
+-	L2ProjectionEPLAnalysisEnum,
+ 	BedSlopeSolutionEnum,
+ 	DamageEvolutionSolutionEnum,
+ 	DamageEvolutionAnalysisEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 16668)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 16669)
+@@ -307,8 +307,8 @@
+ 		case BalancethicknessSoftSolutionEnum : return "BalancethicknessSoftSolution";
+ 		case BalancevelocityAnalysisEnum : return "BalancevelocityAnalysis";
+ 		case BalancevelocitySolutionEnum : return "BalancevelocitySolution";
++		case L2ProjectionEPLAnalysisEnum : return "L2ProjectionEPLAnalysis";
+ 		case L2ProjectionBaseAnalysisEnum : return "L2ProjectionBaseAnalysis";
+-		case L2ProjectionEPLAnalysisEnum : return "L2ProjectionEPLAnalysis";
+ 		case BedSlopeSolutionEnum : return "BedSlopeSolution";
+ 		case DamageEvolutionSolutionEnum : return "DamageEvolutionSolution";
+ 		case DamageEvolutionAnalysisEnum : return "DamageEvolutionAnalysis";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 16668)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 16669)
+@@ -313,8 +313,8 @@
+ 	      else if (strcmp(name,"BalancethicknessSoftSolution")==0) return BalancethicknessSoftSolutionEnum;
+ 	      else if (strcmp(name,"BalancevelocityAnalysis")==0) return BalancevelocityAnalysisEnum;
+ 	      else if (strcmp(name,"BalancevelocitySolution")==0) return BalancevelocitySolutionEnum;
++	      else if (strcmp(name,"L2ProjectionEPLAnalysis")==0) return L2ProjectionEPLAnalysisEnum;
+ 	      else if (strcmp(name,"L2ProjectionBaseAnalysis")==0) return L2ProjectionBaseAnalysisEnum;
+-	      else if (strcmp(name,"L2ProjectionEPLAnalysis")==0) return L2ProjectionEPLAnalysisEnum;
+ 	      else if (strcmp(name,"BedSlopeSolution")==0) return BedSlopeSolutionEnum;
+ 	      else if (strcmp(name,"DamageEvolutionSolution")==0) return DamageEvolutionSolutionEnum;
+ 	      else if (strcmp(name,"DamageEvolutionAnalysis")==0) return DamageEvolutionAnalysisEnum;
Index: issm/oecreview/Archive/16554-17801/ISSM-16669-16670.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16669-16670.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16669-16670.diff	(revision 17802)
@@ -0,0 +1,14 @@
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 16669)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 16670)
+@@ -299,8 +299,8 @@
+ def BalancethicknessSoftSolutionEnum(): return StringToEnum("BalancethicknessSoftSolution")[0]
+ def BalancevelocityAnalysisEnum(): return StringToEnum("BalancevelocityAnalysis")[0]
+ def BalancevelocitySolutionEnum(): return StringToEnum("BalancevelocitySolution")[0]
++def L2ProjectionEPLAnalysisEnum(): return StringToEnum("L2ProjectionEPLAnalysis")[0]
+ def L2ProjectionBaseAnalysisEnum(): return StringToEnum("L2ProjectionBaseAnalysis")[0]
+-def L2ProjectionEPLAnalysisEnum(): return StringToEnum("L2ProjectionEPLAnalysis")[0]
+ def BedSlopeSolutionEnum(): return StringToEnum("BedSlopeSolution")[0]
+ def DamageEvolutionSolutionEnum(): return StringToEnum("DamageEvolutionSolution")[0]
+ def DamageEvolutionAnalysisEnum(): return StringToEnum("DamageEvolutionAnalysis")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-16670-16671.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16670-16671.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16670-16671.diff	(revision 17802)
@@ -0,0 +1,24 @@
+Index: ../trunk-jpl/jenkins/linux64_murdo
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo	(revision 16670)
++++ ../trunk-jpl/jenkins/linux64_murdo	(revision 16671)
+@@ -27,6 +27,7 @@
+ 	--with-cxxoptflags="-mtune=barcelona -ffast-math -O3 -msse4.2 -Wno-write-strings "\
+ 	--with-graphics-lib="/usr/lib/x86_64-linux-gnu/libX11.so" \
+ 	--with-dakota-dir=$ISSM_DIR/externalpackages/dakota/install \
++	--with-boost-dir=$ISSM_DIR/externalpackages/boost/install/ \
+ 	--with-tao-dir=$ISSM_DIR/externalpackages/tao/install \
+ 	--enable-debugging '
+ 
+Index: ../trunk-jpl/jenkins/linux64_larsen
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_larsen	(revision 16670)
++++ ../trunk-jpl/jenkins/linux64_larsen	(revision 16671)
+@@ -22,6 +22,7 @@
+ 	--with-petsc-arch=$ISSM_ARCH \
+ 	--with-mumps-dir=$ISSM_DIR/externalpackages/petsc/install/ \
+ 	--with-dakota-dir=$ISSM_DIR/externalpackages/dakota/install \
++	--with-boost-dir=$ISSM_DIR/externalpackages/boost/install/ \
+ 	--with-blas-lapack-dir=$ISSM_DIR/externalpackages/petsc/install \
+ 	--with-chaco-dir="$ISSM_DIR/externalpackages/chaco/install" \
+ 	--with-numthreads=18 \
Index: issm/oecreview/Archive/16554-17801/ISSM-16671-16672.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16671-16672.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16671-16672.diff	(revision 17802)
@@ -0,0 +1,226 @@
+Index: ../trunk-jpl/jenkins/imac
+===================================================================
+--- ../trunk-jpl/jenkins/imac	(revision 16671)
++++ ../trunk-jpl/jenkins/imac	(revision 16672)
+@@ -1,105 +0,0 @@
+-#
+-########### Configuration file for Eric Larour's Jenkins run on MaxOSX ############
+-
+-#-------------------------------#
+-# 1: ISSM general configuration #
+-#-------------------------------#
+-
+-#Nightly run name
+-NAME="ISSM matlab tests on MacOSX"
+-
+-#ISSM Architecture
+-ISSM_ARCH="macosx-gnu"
+-
+-#ISSM CONFIGURATION 
+-ISSM_CONFIG='--prefix=$ISSM_DIR \
+-	--with-matlab-dir=$MATLAB_DIR \
+-	--with-triangle-dir=$ISSM_DIR/externalpackages/triangle/install \
+-	--with-metis-dir=$ISSM_DIR/externalpackages/metis/install \
+-	--with-mpi-include=$ISSM_DIR/externalpackages/mpich/install/include  \
+-	--with-mpi-libflags=" $ISSM_DIR/externalpackages/mpich/install/lib/libpmpich.a $ISSM_DIR/externalpackages/mpich/install/lib/libmpich.a $ISSM_DIR/externalpackages/mpich/install/lib/libmpl.a " \
+-	--with-fortran-lib="/usr/local/gfortran/lib/libgfortran.a" \
+-	--with-math-lib="/usr/lib/libm.dylib" \
+-	--with-graphics-lib="/usr/X11/lib/libX11.dylib" \
+-	--with-cxxoptflags=" -fno-common -no-cpp-precomp -fexceptions -arch x86_64 -mmacosx-version-min=10.5  -O3 -DNDEBUG -w "\
+-	--with-numthreads=8 \
+-	--with-petsc-dir=$ISSM_DIR/externalpackages/petsc/install  \
+-	--with-petsc-arch=$ISSM_ARCH \
+-	--with-blas-lapack-dir=$ISSM_DIR/externalpackages/petsc/install \
+-	--with-scalapack-dir=$ISSM_DIR/externalpackages/petsc/install/ \
+-	--with-mumps-dir=$ISSM_DIR/externalpackages/petsc/install \
+-	--with-tao-dir=$ISSM_DIR/externalpackages/tao/install'
+-
+-#MATLAB path
+-MATLAB_PATH="/Applications/MATLAB_R2011b.app/"
+-
+-#PYTHON and MATLAB testing
+-MATLAB_TEST=1
+-PYTHON_TEST=0
+-
+-#execution path used for parallel runs
+-EXECUTION_PATH=$ISSM_DIR/execution
+-
+-#-----------------------------------#
+-# 3: External packages installation #
+-#-----------------------------------#
+-
+-#ISSM_EXTERNALPACKAGES can have 3 values:
+-# - "install" install all external packages listed below
+-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
+-# - "none"    leave external packages as is
+-#             ->skip to section 4
+-ISSM_EXTERNALPACKAGES="install"
+-EXTERNALPACKAGESDIR=$ISSM_DIR/externalpackages
+-
+-#List of external pakages to be installed and their installation scripts
+-EXTERNALPACKAGES="autotools install.sh                
+-						matlab    install.sh                
+-						mpich     install-3.0-macosx64.sh    
+-						cmake     install.sh                
+-						petsc     install-3.4-macosx64.sh    
+-						tao       install-2.2.sh
+-						triangle  install-macosx64.sh 
+-						shell2junit  install.sh "
+-
+-
+-#---------------------#
+-# 4: ISSM Compilation #
+-#---------------------#
+-
+-#ISSM_COMPILATION can have 2 values:
+-# - "yes" compile ISSM
+-# - "no"  do not compile ISSM
+-ISSM_COMPILATION="yes"
+-
+-#----------------------#
+-# 5: Mail notification #
+-#----------------------#
+-
+-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
+-#sent to the adresses present in $ISSM_DIR/cron/mailinglist.
+-SKIPMAIL="no"
+-
+-#Sender email address
+-EMAIL_ADRESS="eric.larour@jpl.nasa.gov"
+-
+-#Mailing list
+-MAILINGLIST="eric.larour@jpl.nasa.gov"
+-
+-#------------------------#
+-# 6: Nightly run options #
+-#------------------------#
+-
+-#number of cpus used in ISSM installation and compilation (one is usually
+-#safer as some packages are very sensitive to parallel compilation)
+-NUMCPUS_INSTALL=8
+-
+-#number of cpus used in the nightly runs.
+-NUMCPUS_RUN=1
+-
+-#Nightly run options. The matlab routine runme.m will be called
+-#as follows: runme($MATLAB_NROPTIONS). The options must be understandable
+-#by Matlab and runme.m
+-#ex: "'id',[101 102 103]"
+-MATLAB_NROPTIONS=""
+-PYTHON_NROPTIONS=""
+Index: ../trunk-jpl/jenkins/imac-012301-gil
+===================================================================
+--- ../trunk-jpl/jenkins/imac-012301-gil	(revision 0)
++++ ../trunk-jpl/jenkins/imac-012301-gil	(revision 16672)
+@@ -0,0 +1,105 @@
++#
++########### Configuration file for Eric Larour's Jenkins run on MaxOSX ############
++
++#-------------------------------#
++# 1: ISSM general configuration #
++#-------------------------------#
++
++#Nightly run name
++NAME="ISSM matlab tests on MacOSX"
++
++#ISSM Architecture
++ISSM_ARCH="macosx-gnu"
++
++#ISSM CONFIGURATION 
++ISSM_CONFIG='--prefix=$ISSM_DIR \
++	--with-matlab-dir=$MATLAB_DIR \
++	--with-triangle-dir=$ISSM_DIR/externalpackages/triangle/install \
++	--with-metis-dir=$ISSM_DIR/externalpackages/metis/install \
++	--with-mpi-include=$ISSM_DIR/externalpackages/mpich/install/include  \
++	--with-mpi-libflags=" $ISSM_DIR/externalpackages/mpich/install/lib/libpmpich.a $ISSM_DIR/externalpackages/mpich/install/lib/libmpich.a $ISSM_DIR/externalpackages/mpich/install/lib/libmpl.a " \
++	--with-fortran-lib="/usr/local/gfortran/lib/libgfortran.a" \
++	--with-math-lib="/usr/lib/libm.dylib" \
++	--with-graphics-lib="/usr/X11/lib/libX11.dylib" \
++	--with-cxxoptflags=" -fno-common -no-cpp-precomp -fexceptions -arch x86_64 -mmacosx-version-min=10.5  -O3 -DNDEBUG -w "\
++	--with-numthreads=8 \
++	--with-petsc-dir=$ISSM_DIR/externalpackages/petsc/install  \
++	--with-petsc-arch=$ISSM_ARCH \
++	--with-blas-lapack-dir=$ISSM_DIR/externalpackages/petsc/install \
++	--with-scalapack-dir=$ISSM_DIR/externalpackages/petsc/install/ \
++	--with-mumps-dir=$ISSM_DIR/externalpackages/petsc/install \
++	--with-tao-dir=$ISSM_DIR/externalpackages/tao/install'
++
++#MATLAB path
++MATLAB_PATH="/Applications/MATLAB_R2011b.app/"
++
++#PYTHON and MATLAB testing
++MATLAB_TEST=1
++PYTHON_TEST=0
++
++#execution path used for parallel runs
++EXECUTION_PATH=$ISSM_DIR/execution
++
++#-----------------------------------#
++# 3: External packages installation #
++#-----------------------------------#
++
++#ISSM_EXTERNALPACKAGES can have 3 values:
++# - "install" install all external packages listed below
++# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
++# - "none"    leave external packages as is
++#             ->skip to section 4
++ISSM_EXTERNALPACKAGES="install"
++EXTERNALPACKAGESDIR=$ISSM_DIR/externalpackages
++
++#List of external pakages to be installed and their installation scripts
++EXTERNALPACKAGES="autotools install.sh                
++						matlab    install.sh                
++						mpich     install-3.0-macosx64.sh    
++						cmake     install.sh                
++						petsc     install-3.4-macosx64.sh    
++						tao       install-2.2.sh
++						triangle  install-macosx64.sh 
++						shell2junit  install.sh "
++
++
++#---------------------#
++# 4: ISSM Compilation #
++#---------------------#
++
++#ISSM_COMPILATION can have 2 values:
++# - "yes" compile ISSM
++# - "no"  do not compile ISSM
++ISSM_COMPILATION="yes"
++
++#----------------------#
++# 5: Mail notification #
++#----------------------#
++
++#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
++#sent to the adresses present in $ISSM_DIR/cron/mailinglist.
++SKIPMAIL="no"
++
++#Sender email address
++EMAIL_ADRESS="eric.larour@jpl.nasa.gov"
++
++#Mailing list
++MAILINGLIST="eric.larour@jpl.nasa.gov"
++
++#------------------------#
++# 6: Nightly run options #
++#------------------------#
++
++#number of cpus used in ISSM installation and compilation (one is usually
++#safer as some packages are very sensitive to parallel compilation)
++NUMCPUS_INSTALL=8
++
++#number of cpus used in the nightly runs.
++NUMCPUS_RUN=1
++
++#Nightly run options. The matlab routine runme.m will be called
++#as follows: runme($MATLAB_NROPTIONS). The options must be understandable
++#by Matlab and runme.m
++#ex: "'id',[101 102 103]"
++MATLAB_NROPTIONS=""
++PYTHON_NROPTIONS=""
+
+Property changes on: ../trunk-jpl/jenkins/imac-012301-gil
+___________________________________________________________________
+Name: svn:executable
+   + *
+
Index: issm/oecreview/Archive/16554-17801/ISSM-16672-16673.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16672-16673.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16672-16673.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/jenkins/execute_shell
+===================================================================
+--- ../trunk-jpl/jenkins/execute_shell	(revision 16672)
++++ ../trunk-jpl/jenkins/execute_shell	(revision 16673)
+@@ -7,7 +7,7 @@
+ if [[ $Platform == "master" ]]; then
+ configfile=linux64_murdo
+ elif [[ $Platform == "imac-012301-gil" ]]; then 
+-configfile=imac
++configfile=imac-012301-gil
+ elif [[ $Platform == "larsen" ]]; then 
+ configfile=linux64_larsen
+ fi
Index: issm/oecreview/Archive/16554-17801/ISSM-16673-16674.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16673-16674.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16673-16674.diff	(revision 17802)
@@ -0,0 +1,38 @@
+Index: ../trunk-jpl/jenkins/execute_shell
+===================================================================
+--- ../trunk-jpl/jenkins/execute_shell	(revision 16673)
++++ ../trunk-jpl/jenkins/execute_shell	(revision 16674)
+@@ -4,15 +4,25 @@
+ export ISSM_DIR="$WORKSPACE"
+ 
+ #which configuration are we using? 
+-if [[ $Platform == "master" ]]; then
+-configfile=linux64_murdo
+-elif [[ $Platform == "imac-012301-gil" ]]; then 
+-configfile=imac-012301-gil
+-elif [[ $Platform == "larsen" ]]; then 
+-configfile=linux64_larsen
+-fi
++case $Platform in 
++	master )
++		case $AD in 
++			off ) 
++				configfile=linux64_murdo ;;
++			on )
++				case $AMPI in 
++					on ) 
++						configfile=linux64_murdo_ampi ;;
++					off )
++						configfile=linux64_murdo_ad ;;
++				esac ;;
++		esac ;;
++	imac-012301-gil )
++		configfile=imac-012301-gil ;;
++	larsen )
++		configfile=linux64_larsen ;;
++esac
+ 
+-
+ #run
+ cd "$WORKSPACE"
+ source $ISSM_DIR/jenkins/jenkins.sh $ISSM_DIR/jenkins/$configfile
Index: issm/oecreview/Archive/16554-17801/ISSM-16674-16675.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16674-16675.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16674-16675.diff	(revision 17802)
@@ -0,0 +1,2089 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h	(revision 16675)
+@@ -17,5 +17,6 @@
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 16675)
+@@ -79,3 +79,8 @@
+ void HydrologyShreveAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+ 	/*No loads*/
+ }/*}}}*/
++
++/*Numerics*/
++void HydrologyShreveAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	element->GetSolutionFromInputsOneDof(solution,WatercolumnEnum);
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp	(revision 16675)
+@@ -23,3 +23,8 @@
+ void BalancethicknessSoftAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
++
++/*Numerics*/
++void BalancethicknessSoftAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	   _error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16675)
+@@ -17,5 +17,8 @@
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void GetSolutionFromInputsFS(Vector<IssmDouble>* solution,Element* element);
++		void GetSolutionFromInputsHoriz(Vector<IssmDouble>* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 16675)
+@@ -17,5 +17,6 @@
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 16675)
+@@ -111,3 +111,8 @@
+ 		iomodel->DeleteData(1,ThicknessEnum);
+ 	}
+ }/*}}}*/
++
++/*Numerics*/
++void BalancethicknessAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	   _error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.h	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.h	(revision 16675)
+@@ -17,5 +17,6 @@
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 16675)
+@@ -104,3 +104,8 @@
+ 
+ 	/*Nothing for now*/
+ }/*}}}*/
++
++/*Numerics*/
++void HydrologyDCEfficientAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	element->GetSolutionFromInputsOneDof(solution,EplHeadEnum);
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h	(revision 16675)
+@@ -17,5 +17,6 @@
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 16675)
+@@ -23,3 +23,8 @@
+ void AdjointHorizAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
++
++/*Numerics*/
++void AdjointHorizAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	   _error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 16675)
+@@ -56,3 +56,8 @@
+ 
+ 	/*No loads*/
+ }/*}}}*/
++
++/*Numerics*/
++void BalancevelocityAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	   _error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/MeltingAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeltingAnalysis.h	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/MeltingAnalysis.h	(revision 16675)
+@@ -17,5 +17,6 @@
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/GiaAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/GiaAnalysis.h	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/GiaAnalysis.h	(revision 16675)
+@@ -17,5 +17,6 @@
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 16675)
+@@ -52,3 +52,8 @@
+ 
+ 	/*No loads*/
+ }/*}}}*/
++
++/*Numerics*/
++void L2ProjectionBaseAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	   _error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 16675)
+@@ -85,3 +85,8 @@
+ 	iomodel->DeleteData(vertex_pairing,MasstransportVertexPairingEnum);
+ 	iomodel->DeleteData(nodeonsurface,MeshVertexonsurfaceEnum);
+ }/*}}}*/
++
++/*Numerics*/
++void FreeSurfaceTopAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	   _error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h	(revision 16675)
+@@ -17,5 +17,6 @@
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 16675)
+@@ -93,3 +93,8 @@
+ 	/*No loads*/
+ 
+ }/*}}}*/
++
++/*Numerics*/
++void StressbalanceVerticalAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	   _error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/Analysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/Analysis.h	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/Analysis.h	(revision 16675)
+@@ -5,12 +5,14 @@
+ #ifndef _ANALYSIS_H_
+ #define _ANALYSIS_H_
+ 
++#include "../toolkits/objects/toolkitobjects.h"
+ class Parameters;
+ class IoModel;
+ class Elements;
+ class Nodes;
+ class Constraints;
+ class Loads;
++class Element;
+ 
+ class Analysis{
+ 
+@@ -23,5 +25,7 @@
+ 		virtual void CreateNodes(Nodes* nodes,IoModel* iomodel)=0;
+ 		virtual void CreateConstraints(Constraints* constraints,IoModel* iomodel)=0;
+ 		virtual void CreateLoads(Loads* loads, IoModel* iomodel)=0;
++
++		virtual void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element)=0;
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h	(revision 16675)
+@@ -17,5 +17,6 @@
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 16675)
+@@ -131,3 +131,38 @@
+ 	/*No loads*/
+ 
+ }/*}}}*/
++
++/*Numerics*/
++void StressbalanceSIAAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++
++	IssmDouble vx,vy;
++	int       *doflist = NULL;
++
++	/*Fetch number of nodes and initialize values*/
++	int         numnodes = element->GetNumberOfNodes();
++	int         numdof   = numnodes*2;
++	IssmDouble* values   = xNew<IssmDouble>(numdof);
++
++	/*Get dof list and inputs */
++	element->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
++	Input* vx_input=element->GetInput(VxEnum); _assert_(vx_input);
++	Input* vy_input=element->GetInput(VyEnum); _assert_(vy_input);
++
++	/*Ok, we have the velocities in inputs, fill in solution */
++	Gauss* gauss=element->NewGauss();
++	for(int i=0;i<numnodes;i++){
++		gauss->GaussVertex(i);
++		vx_input->GetInputValue(&vx,gauss);
++		vy_input->GetInputValue(&vy,gauss);
++		values[i*2+0]=vx;
++		values[i*2+1]=vy;
++	}
++
++	/*Add value to global vector*/
++	solution->SetValues(numdof,doflist,values,INS_VAL);
++
++	/*Free ressources:*/
++	delete gauss;
++	xDelete<int>(doflist);
++	xDelete<IssmDouble>(values);
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h	(revision 16675)
+@@ -17,5 +17,6 @@
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16675)
+@@ -799,3 +799,127 @@
+ 	}
+ #endif
+ }/*}}}*/
++
++/*Numerics*/
++void StressbalanceAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++
++	int approximation;
++	element->GetInputValue(&approximation,ApproximationEnum);
++	switch(approximation){
++		case FSApproximationEnum: case NoneApproximationEnum:
++			GetSolutionFromInputsFS(solution,element);
++			return;
++		case SSAApproximationEnum: case HOApproximationEnum: case SIAApproximationEnum:
++			GetSolutionFromInputsHoriz(solution,element);
++			return;
++		case SSAHOApproximationEnum: case HOFSApproximationEnum: case SSAFSApproximationEnum:
++			/*the elements around will create the solution*/
++			return;
++		default:
++			_error_("Approximation "<<EnumToStringx(approximation)<<" not supported");
++	}
++}/*}}}*/
++void StressbalanceAnalysis::GetSolutionFromInputsFS(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++
++	int*         vdoflist=NULL;
++	int*         pdoflist=NULL;
++	Input*       vz_input=NULL;
++	int          meshtype,dim;
++	IssmDouble   vx,vy,vz,p;
++	IssmDouble   FSreconditioning;
++
++	/*Get some parameters*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; break;
++		case Mesh3DEnum:         dim = 3; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int vnumnodes = element->NumberofNodesVelocity();
++	int pnumnodes = element->NumberofNodesPressure();
++	int vnumdof   = vnumnodes*dim;
++	int pnumdof   = pnumnodes*1;
++
++	/*Initialize values*/
++	IssmDouble* vvalues = xNew<IssmDouble>(vnumdof);
++	IssmDouble* pvalues = xNew<IssmDouble>(pnumdof);
++
++	/*Get dof list: */
++	element->GetDofListVelocity(&vdoflist,GsetEnum);
++	element->GetDofListPressure(&pdoflist,GsetEnum);
++	Input*     vx_input=element->GetInput(VxEnum);       _assert_(vx_input);
++	Input*     vy_input=element->GetInput(VyEnum);       _assert_(vy_input);
++	if(dim==3) vz_input=element->GetInput(VzEnum);       _assert_(vz_input);
++	Input*     p_input =element->GetInput(PressureEnum); _assert_(p_input);
++
++	element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
++
++	/*Ok, we have the velocities in inputs, fill in solution */
++	Gauss* gauss = element->NewGauss();
++	for(int i=0;i<vnumnodes;i++){
++		gauss->GaussNode(element->VelocityInterpolation(),i);
++		vx_input->GetInputValue(&vx,gauss);
++		vy_input->GetInputValue(&vy,gauss);
++		vvalues[i*dim+0]=vx;
++		vvalues[i*dim+1]=vy;
++		if(dim==3){
++			vz_input->GetInputValue(&vz,gauss);
++			vvalues[i*dim+2]=vz;
++		}
++	}
++	for(int i=0;i<pnumnodes;i++){
++		gauss->GaussNode(element->PressureInterpolation(),i);
++		p_input->GetInputValue(&p ,gauss);
++		pvalues[i]=p/FSreconditioning;
++	}
++
++	/*Add value to global vector*/
++	solution->SetValues(vnumdof,vdoflist,vvalues,INS_VAL);
++	solution->SetValues(pnumdof,pdoflist,pvalues,INS_VAL);
++
++	/*Free ressources:*/
++	delete gauss;
++	xDelete<int>(pdoflist);
++	xDelete<int>(vdoflist);
++	xDelete<IssmDouble>(pvalues);
++	xDelete<IssmDouble>(vvalues);
++}/*}}}*/
++void StressbalanceAnalysis::GetSolutionFromInputsHoriz(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++
++	IssmDouble   vx,vy;
++	int*         doflist = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++	int numdof   = numnodes*2;
++
++	/*Fetch dof list and allocate solution vector*/
++	element->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
++	IssmDouble* values = xNew<IssmDouble>(numdof);
++
++	/*Get inputs*/
++	Input* vx_input=element->GetInput(VxEnum); _assert_(vx_input);
++	Input* vy_input=element->GetInput(VyEnum); _assert_(vy_input);
++
++	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
++	Gauss* gauss=element->NewGauss();
++	for(int i=0;i<numnodes;i++){
++		gauss->GaussNode(element->FiniteElement(),i);
++
++		/*Recover vx and vy*/
++		vx_input->GetInputValue(&vx,gauss);
++		vy_input->GetInputValue(&vy,gauss);
++		values[i*NDOF2+0]=vx;
++		values[i*NDOF2+1]=vy;
++	}
++
++	solution->SetValues(numdof,doflist,values,INS_VAL);
++
++	/*Free ressources:*/
++	delete gauss;
++	xDelete<IssmDouble>(values);
++	xDelete<int>(doflist);
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h	(revision 16675)
+@@ -17,5 +17,6 @@
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h	(revision 16675)
+@@ -17,5 +17,6 @@
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h	(revision 16675)
+@@ -17,5 +17,6 @@
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h	(revision 16675)
+@@ -17,5 +17,6 @@
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16675)
+@@ -134,3 +134,8 @@
+ 	}
+ 	iomodel->DeleteData(1,MeshVertexonbedEnum);
+ }/*}}}*/
++
++/*Numerics*/
++void HydrologyDCInefficientAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	element->GetSolutionFromInputsOneDof(solution,SedimentHeadEnum);
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16675)
+@@ -109,3 +109,8 @@
+ 	iomodel->DeleteData(1,ThermalSpctemperatureEnum);
+ 
+ }/*}}}*/
++
++/*Numerics*/
++void ThermalAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	element->GetSolutionFromInputsOneDof(solution,TemperatureEnum);
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h	(revision 16675)
+@@ -17,5 +17,6 @@
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h	(revision 16675)
+@@ -17,5 +17,6 @@
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 16675)
+@@ -34,3 +34,8 @@
+ }/*}}}*/
+ void ExtrudeFromBaseAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+ }/*}}}*/
++
++/*Numerics*/
++void ExtrudeFromBaseAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	   _error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 16675)
+@@ -69,3 +69,8 @@
+ 	iomodel->DeleteData(1,MeshVertexonbedEnum);
+ 
+ }/*}}}*/
++
++/*Numerics*/
++void MeltingAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	   _error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/GiaAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/GiaAnalysis.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/GiaAnalysis.cpp	(revision 16675)
+@@ -35,3 +35,8 @@
+ void GiaAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+ 	/*No loads*/
+ }/*}}}*/
++
++/*Numerics*/
++void GiaAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	   _error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h	(revision 16675)
+@@ -17,5 +17,6 @@
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h	(revision 16675)
+@@ -17,5 +17,6 @@
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h	(revision 16675)
+@@ -17,5 +17,6 @@
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 16675)
+@@ -17,5 +17,6 @@
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h	(revision 16675)
+@@ -17,5 +17,6 @@
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h	(revision 16675)
+@@ -17,5 +17,6 @@
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 16675)
+@@ -23,3 +23,8 @@
+ void AdjointBalancethicknessAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+ 	_error_("not implemented yet");
+ }/*}}}*/
++
++/*Numerics*/
++void AdjointBalancethicknessAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h	(revision 16675)
+@@ -17,5 +17,6 @@
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/EnumToAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnumToAnalysis.h	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/EnumToAnalysis.h	(revision 16675)
+@@ -12,3 +12,4 @@
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16675)
+@@ -209,3 +209,8 @@
+ 	iomodel->DeleteData(nodeonbed,MeshVertexonbedEnum);
+ 
+ }/*}}}*/
++
++/*Numerics*/
++void MasstransportAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	   _error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h	(revision 16675)
+@@ -17,5 +17,6 @@
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 16675)
+@@ -92,3 +92,8 @@
+ 	iomodel->DeleteData(1,DamageSpcdamageEnum);
+ 
+ }/*}}}*/
++
++/*Numerics*/
++void DamageEvolutionAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	   _error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16675)
+@@ -181,3 +181,8 @@
+ 
+ 	/*No loads */
+ }/*}}}*/
++
++/*Numerics*/
++void EnthalpyAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	element->GetSolutionFromInputsOneDof(solution,EnthalpyEnum);
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp	(revision 16675)
+@@ -23,3 +23,8 @@
+ void MeshdeformationAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
++
++/*Numerics*/
++void MeshdeformationAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	   _error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 16675)
+@@ -87,3 +87,8 @@
+ 	iomodel->DeleteData(vertex_pairing,MasstransportVertexPairingEnum);
+ 	iomodel->DeleteData(nodeonbed,MeshVertexonbedEnum);
+ }/*}}}*/
++
++/*Numerics*/
++void FreeSurfaceBaseAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	   _error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 16675)
+@@ -42,3 +42,8 @@
+ }/*}}}*/
+ void SmoothedSurfaceSlopeXAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+ }/*}}}*/
++
++/*Numerics*/
++void SmoothedSurfaceSlopeXAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	   _error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 16675)
+@@ -34,3 +34,8 @@
+ }/*}}}*/
+ void ExtrudeFromTopAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+ }/*}}}*/
++
++/*Numerics*/
++void ExtrudeFromTopAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	   _error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 16675)
+@@ -42,3 +42,8 @@
+ }/*}}}*/
+ void SmoothedSurfaceSlopeYAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+ }/*}}}*/
++
++/*Numerics*/
++void SmoothedSurfaceSlopeYAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	   _error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h	(revision 16674)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h	(revision 16675)
+@@ -17,5 +17,6 @@
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16674)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16675)
+@@ -579,6 +579,11 @@
+ 	MaskGroundediceLevelsetEnum,
+ 	QmuMaskGroundediceLevelsetEnum,
+ 	/*}}}*/
++	/*Gauss{{{*/
++	GaussSegEnum,
++	GaussTriaEnum,
++	GaussPentaEnum,
++	/*}}}*/
+ 	/*Solver{{{*/
+ 	FSSolverEnum,
+ 	/*}}}*/
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 16675)
+@@ -560,6 +560,9 @@
+ 		case SubelementMigration2Enum : return "SubelementMigration2";
+ 		case MaskGroundediceLevelsetEnum : return "MaskGroundediceLevelset";
+ 		case QmuMaskGroundediceLevelsetEnum : return "QmuMaskGroundediceLevelset";
++		case GaussSegEnum : return "GaussSeg";
++		case GaussTriaEnum : return "GaussTria";
++		case GaussPentaEnum : return "GaussPenta";
+ 		case FSSolverEnum : return "FSSolver";
+ 		case AdjointEnum : return "Adjoint";
+ 		case ColinearEnum : return "Colinear";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 16675)
+@@ -572,6 +572,9 @@
+ 	      else if (strcmp(name,"SubelementMigration2")==0) return SubelementMigration2Enum;
+ 	      else if (strcmp(name,"MaskGroundediceLevelset")==0) return MaskGroundediceLevelsetEnum;
+ 	      else if (strcmp(name,"QmuMaskGroundediceLevelset")==0) return QmuMaskGroundediceLevelsetEnum;
++	      else if (strcmp(name,"GaussSeg")==0) return GaussSegEnum;
++	      else if (strcmp(name,"GaussTria")==0) return GaussTriaEnum;
++	      else if (strcmp(name,"GaussPenta")==0) return GaussPentaEnum;
+ 	      else if (strcmp(name,"FSSolver")==0) return FSSolverEnum;
+ 	      else if (strcmp(name,"Adjoint")==0) return AdjointEnum;
+ 	      else if (strcmp(name,"Colinear")==0) return ColinearEnum;
+Index: ../trunk-jpl/src/c/modules/GetSolutionFromInputsx/GetSolutionFromInputsx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/GetSolutionFromInputsx/GetSolutionFromInputsx.h	(revision 16674)
++++ ../trunk-jpl/src/c/modules/GetSolutionFromInputsx/GetSolutionFromInputsx.h	(revision 16675)
+@@ -6,6 +6,7 @@
+ #define _GETSOLUTIONFROMINPUTSXX_H
+ 
+ #include "../../classes/classes.h"
++#include "../../analyses/analyses.h"
+ 
+ /* local prototypes: */
+ void GetSolutionFromInputsx(Vector<IssmDouble>** psolution,FemModel* femmodel);
+Index: ../trunk-jpl/src/c/modules/GetSolutionFromInputsx/GetSolutionFromInputsx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/GetSolutionFromInputsx/GetSolutionFromInputsx.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/modules/GetSolutionFromInputsx/GetSolutionFromInputsx.cpp	(revision 16675)
+@@ -10,30 +10,31 @@
+ 
+ 	/*intermediary: */
+ 	int      gsize;
+-	Element* element = NULL;
++	int      configuration,analysisenum;
+ 
+-	int configuration_type;
+-
+ 	/*output: */
+ 	Vector<IssmDouble>* solution=NULL;
+ 
+ 	if(VerboseModule()) _printf0_("   Get solution from inputs\n");
+ 
+ 	/*retrive parameters: */
+-	femmodel->parameters->FindParam(&configuration_type,ConfigurationTypeEnum);
++	femmodel->parameters->FindParam(&configuration,ConfigurationTypeEnum);
++	femmodel->parameters->FindParam(&analysisenum,AnalysisTypeEnum);
+ 
+ 	/*Get size of vector: */
+-	gsize=femmodel->nodes->NumberOfDofs(configuration_type,GsetEnum);
+-	if(gsize==0) _error_("Allocating a Vec of size 0 as gsize=0 for configuration: " << EnumToStringx(configuration_type));
++	gsize=femmodel->nodes->NumberOfDofs(configuration,GsetEnum);
++	if(gsize==0) _error_("Allocating a Vec of size 0 as gsize=0 for configuration "<<EnumToStringx(configuration));
+ 
+ 	/*Initialize solution: */
+ 	solution=new Vector<IssmDouble>(gsize);
+ 
+ 	/*Go through elements and plug solution: */
++	Analysis* analysis = EnumToAnalysis(analysisenum);
+ 	for(int i=0;i<femmodel->elements->Size();i++){
+-		element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+-		element->GetSolutionFromInputs(solution);
++		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++		analysis->GetSolutionFromInputs(solution,element);
+ 	}
++	delete analysis;
+ 
+ 	/*Assemble vector: */
+ 	solution->Assemble();
+Index: ../trunk-jpl/src/c/toolkits/objects/Solver.h
+===================================================================
+--- ../trunk-jpl/src/c/toolkits/objects/Solver.h	(revision 16674)
++++ ../trunk-jpl/src/c/toolkits/objects/Solver.h	(revision 16675)
+@@ -13,6 +13,7 @@
+ #include "./Matrix.h"
+ #include "./Vector.h"
+ #include "../issm/issmtoolkit.h"
++#include "../petsc/petscincludes.h"
+ class Parameters;
+ 
+ template <class doubletype> 
+Index: ../trunk-jpl/src/c/toolkits/objects/Vector.h
+===================================================================
+--- ../trunk-jpl/src/c/toolkits/objects/Vector.h	(revision 16674)
++++ ../trunk-jpl/src/c/toolkits/objects/Vector.h	(revision 16675)
+@@ -15,6 +15,7 @@
+ #endif
+ #include <cstring>
+ #include "../../shared/Enum/Enum.h"
++#include "../petsc/petscincludes.h"
+ #include "../issm/issmtoolkit.h"
+ /*}}}*/
+ 
+Index: ../trunk-jpl/src/c/toolkits/objects/Matrix.h
+===================================================================
+--- ../trunk-jpl/src/c/toolkits/objects/Matrix.h	(revision 16674)
++++ ../trunk-jpl/src/c/toolkits/objects/Matrix.h	(revision 16675)
+@@ -15,6 +15,7 @@
+ #endif
+ #include <cstring>
+ #include "../../shared/Enum/Enum.h"
++#include "../petsc/petscincludes.h"
+ #include "../issm/issmtoolkit.h"
+ /*}}}*/
+ 
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 16674)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 16675)
+@@ -24,6 +24,7 @@
+ 					./datastructures/Object.h\
+ 					./datastructures/datastructures.h\
+ 					./classes/classes.h\
++					./classes/gauss/Gauss.h\
+ 					./classes/gauss/GaussSeg.h\
+ 					./classes/gauss/GaussSeg.cpp\
+ 					./classes/gauss/GaussTria.h\
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16674)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16675)
+@@ -20,6 +20,8 @@
+ class Nodes;
+ class Vertices;
+ class Materials;
++class Input;
++class Gauss;
+ template <class doublematrix> class Matrix;
+ template <class doubletype> class Vector;
+ 
+@@ -39,7 +41,14 @@
+ 		virtual void   CreateDVector(Vector<IssmDouble>* df)=0;
+ 		virtual void   CreatePVector(Vector<IssmDouble>* pf)=0;
+ 		virtual void   CreateJacobianMatrix(Matrix<IssmDouble>* Jff)=0;
++		virtual void   FindParam(int* pvalue,int paramenum)=0;
++		virtual void   FindParam(IssmDouble* pvalue,int paramenum)=0;
++		virtual int    FiniteElement(void)=0;
++		virtual void	GetDofList(int** pdoflist,int approximation_enum,int setenum)=0;
++		virtual void	GetDofListVelocity(int** pdoflist,int setenum)=0;
++		virtual void	GetDofListPressure(int** pdoflist,int setenum)=0;
+ 		virtual void   GetSolutionFromInputs(Vector<IssmDouble>* solution)=0;
++		virtual void   GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int solutionenum)=0;
+ 		virtual int    GetNodeIndex(Node* node)=0;
+ 		virtual int    GetNumberOfNodes(void)=0;
+ 		virtual void   GetNodesSidList(int* sidlist)=0;
+@@ -51,7 +60,11 @@
+ 		virtual bool   IsOnBed()=0;
+ 		virtual void   GetInputListOnVertices(IssmDouble* pvalue,int enumtype)=0;
+ 		virtual void   GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue)=0;
++		virtual Input* GetInput(int inputenum)=0;
+ 		virtual void   GetInputValue(IssmDouble* pvalue,Node* node,int enumtype)=0;
++		virtual void   GetInputValue(bool* pvalue,int enum_type)=0;
++		virtual void   GetInputValue(int* pvalue,int enum_type)=0;
++		virtual void   GetInputValue(IssmDouble* pvalue,int enum_type)=0;
+ 		virtual void   GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype)=0;
+ 
+ 		virtual IssmDouble SurfaceArea(void)=0;
+@@ -65,6 +78,9 @@
+ 		virtual void   InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code)=0;
+ 
+ 		virtual int    NodalValue(IssmDouble* pvalue, int index, int natureofdataenum)=0;
++		virtual int    NumberofNodesVelocity(void)=0;
++		virtual int    NumberofNodesPressure(void)=0;
++		virtual Gauss* NewGauss(void)=0;
+ 		virtual void   InputScale(int enum_type,IssmDouble scale_factor)=0;
+ 		virtual void   GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum)=0;
+ 		virtual IssmDouble TimeAdapt()=0;
+@@ -72,6 +88,8 @@
+ 		virtual void   Delta18oParameterization(void)=0;
+ 		virtual void   SmbGradients()=0;
+ 		virtual void   ResetCoordinateSystem()=0;
++		virtual int    VelocityInterpolation()=0;
++		virtual int    PressureInterpolation()=0;
+ 
+ 		#ifdef _HAVE_RESPONSES_
+ 		virtual void   AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16675)
+@@ -866,6 +866,21 @@
+ 	else _printf_("inputs=NULL\n");
+ }
+ /*}}}*/
++/*FUNCTION Tria::FindParam(int* pvalue,int paramenum){{{*/
++void Tria::FindParam(int* pvalue,int paramenum){
++	this->parameters->FindParam(pvalue,paramenum);
++}
++/*}}}*/
++/*FUNCTION Tria::FindParam(IssmDouble* pvalue,int paramenum){{{*/
++void Tria::FindParam(IssmDouble* pvalue,int paramenum){
++	this->parameters->FindParam(pvalue,paramenum);
++}
++/*}}}*/
++/*FUNCTION Tria::FiniteElement{{{*/
++int Tria::FiniteElement(void){
++	return this->element_type;
++}
++/*}}}*/
+ /*FUNCTION Tria::ObjectEnum{{{*/
+ int Tria::ObjectEnum(void){
+ 
+@@ -1310,6 +1325,11 @@
+ 	return this->NumberofNodes();
+ }
+ /*}}}*/
++/*FUNCTION Tria::GetInput(int inputenum) {{{*/
++Input* Tria::GetInput(int inputenum){
++	return inputs->GetInput(inputenum);
++}
++/*}}}*/
+ /*FUNCTION Tria::GetInputListOnVertices(IssmDouble* pvalue,int enumtype) {{{*/
+ void Tria::GetInputListOnVertices(IssmDouble* pvalue,int enumtype){
+ 
+@@ -1428,6 +1448,30 @@
+ 	delete gauss;
+ }
+ /*}}}*/
++/*FUNCTION Tria::GetInputValue(bool* pvalue,int inputenum) {{{*/
++void Tria::GetInputValue(bool* pvalue,int inputenum){
++
++	Input* input=inputs->GetInput(inputenum);
++	if(!input) _error_("Input " << EnumToStringx(inputenum) << " not found in element");
++	input->GetInputValue(pvalue);
++
++}/*}}}*/
++/*FUNCTION Tria::GetInputValue(int* pvalue,int inputenum) {{{*/
++void Tria::GetInputValue(int* pvalue,int inputenum){
++
++	Input* input=inputs->GetInput(inputenum);
++	if(!input) _error_("Input " << EnumToStringx(inputenum) << " not found in element");
++	input->GetInputValue(pvalue);
++
++}/*}}}*/
++/*FUNCTION Tria::GetInputValue(IssmDouble* pvalue,int inputenum) {{{*/
++void Tria::GetInputValue(IssmDouble* pvalue,int inputenum){
++
++	Input* input=inputs->GetInput(inputenum);
++	if(!input) _error_("Input " << EnumToStringx(inputenum) << " not found in element");
++	input->GetInputValue(pvalue);
++
++}/*}}}*/
+ /*FUNCTION Tria::GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype) {{{*/
+ void Tria::GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype){
+ 
+@@ -2326,6 +2370,11 @@
+ 	return shelf;
+ }
+ /*}}}*/
++/*FUNCTION Tria::NewGauss{{{*/
++Gauss* Tria::NewGauss(void){
++	return new GaussTria();
++}
++/*}}}*/
+ /*FUNCTION Tria::NoIceInElement {{{*/
+ bool   Tria::NoIceInElement(){
+ 
+@@ -2373,6 +2422,26 @@
+ 	return found;
+ }
+ /*}}}*/
++/*FUNCTION Tria::VelocityInterpolation{{{*/
++int Tria::VelocityInterpolation(void){
++	return TriaRef::VelocityInterpolation();
++}
++/*}}}*/
++/*FUNCTION Tria::PressureInterpolation{{{*/
++int Tria::PressureInterpolation(void){
++	return TriaRef::PressureInterpolation();
++}
++/*}}}*/
++/*FUNCTION Tria::NumberofNodesPressure{{{*/
++int Tria::NumberofNodesPressure(void){
++	return TriaRef::NumberofNodesPressure();
++}
++/*}}}*/
++/*FUNCTION Tria::NumberofNodesVelocity{{{*/
++int Tria::NumberofNodesVelocity(void){
++	return TriaRef::NumberofNodesVelocity();
++}
++/*}}}*/
+ /*FUNCTION Tria::PositiveDegreeDay{{{*/
+ void  Tria::PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm){
+ 
+@@ -7337,8 +7406,6 @@
+ 	}
+ }
+ /*}}}*/
+-
+-
+ #endif
+ 
+ #ifdef _HAVE_MASSTRANSPORT_
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16674)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16675)
+@@ -78,6 +78,12 @@
+ 		void        CreatePVector(Vector<IssmDouble>* pf);
+ 		void        CreateJacobianMatrix(Matrix<IssmDouble>* Jff);
+ 		void        Delta18oParameterization(void);
++		void        FindParam(int* pvalue,int paramenum);
++		void        FindParam(IssmDouble* pvalue,int paramenum);
++		int         FiniteElement(void);
++		void	      GetDofList(int** pdoflist,int approximation_enum,int setenum);
++		void	      GetDofListVelocity(int** pdoflist,int setenum);
++		void	      GetDofListPressure(int** pdoflist,int setenum);
+ 		int         GetNodeIndex(Node* node);
+ 		void        GetNodesSidList(int* sidlist);
+ 		void        GetNodesLidList(int* lidlist);
+@@ -94,8 +100,11 @@
+ 		int         EdgeOnSurfaceIndex();
+ 		bool        IsFloating();
+ 		bool        IsNodeOnShelfFromFlags(IssmDouble* flags);
++		int         NumberofNodesVelocity(void);
++		int         NumberofNodesPressure(void);
+ 		bool        NoIceInElement();
+ 		void        GetSolutionFromInputs(Vector<IssmDouble>* solution);
++		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
+ 		void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum);
+ 		void        InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);
+ 		void        InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum=MeshElementsEnum);
+@@ -108,6 +117,8 @@
+ 		void        ResultToVector(Vector<IssmDouble>* vector,int output_enum);
+ 		void        ResetCoordinateSystem(void);
+ 		void	      SmbGradients();
++		int         VelocityInterpolation();
++		int         PressureInterpolation();
+ 		IssmDouble  SurfaceArea(void);
+ 		void        Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement);
+ 		IssmDouble  TimeAdapt();
+@@ -219,9 +230,7 @@
+ 		IssmDouble     GetArea(void);
+ 		void           GetAreaCoordinates(IssmDouble *area_coordinates,IssmDouble xyz_zero[3][3],IssmDouble xyz_list[3][3],int numpoints);
+ 		int            GetElementType(void);
+-		void	         GetDofList(int** pdoflist,int approximation_enum,int setenum);
+-		void	         GetDofListVelocity(int** pdoflist,int setenum);
+-		void	         GetDofListPressure(int** pdoflist,int setenum);
++
+ 		void	         GetVertexPidList(int* doflist);
+ 		void           GetVertexSidList(int* sidlist);
+ 		void           GetConnectivityList(int* connectivity);
+@@ -229,17 +238,22 @@
+ 		IssmDouble     GetGroundedPortion(IssmDouble* xyz_list);
+ 		void           GetSegmentNormal(IssmDouble* normal,IssmDouble xyz_list[2][3]);
+ 		void           GetZeroLevelsetCoordinates(IssmDouble* xyz_zero,IssmDouble xyz_list[3][3],int levelsetenum);
++		Input*         GetInput(int inputenum);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue,int index); //TO BE REMOVED
+ 		void           GetInputListOnNodes(IssmDouble* pvalue,int enumtype);
+ 		void           GetInputListOnNodes(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue);
+ 		void           GetInputValue(IssmDouble* pvalue,Node* node,int enumtype);
++		void           GetInputValue(bool* pvalue,int enum_type);
++		void           GetInputValue(int* pvalue,int enum_type);
++		void           GetInputValue(IssmDouble* pvalue,int enum_type);
+ 		void           GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype);
+ 		void           GetStrainRate2d(IssmDouble* epsilon,IssmDouble* xyz_list, GaussTria* gauss, Input* vx_input, Input* vy_input);
+ 		void	         InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type);
+ 		void	         InputUpdateFromSolutionMasstransport(IssmDouble* solution);
+ 		bool	         IsInput(int name);
++		Gauss*         NewGauss(void);
+ 		void	         SetClone(int* minranks);
+ 		Seg*	         SpawnSeg(int index1,int index2);
+ 		void	         SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]);
+@@ -293,7 +307,6 @@
+ 		ElementVector* CreatePVectorHydrologyShreve(void);
+ 		ElementVector* CreatePVectorHydrologyDCInefficient(void);
+ 		ElementVector* CreatePVectorHydrologyDCEfficient(void);
+-		void    GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
+ 		void    CreateHydrologyWaterVelocityInput(void);
+ 		void	  InputUpdateFromSolutionHydrology(IssmDouble* solution);
+ 		void	  InputUpdateFromSolutionHydrologyShreve(IssmDouble* solution);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16675)
+@@ -917,6 +917,21 @@
+ 	this->DeepEcho();
+ }
+ /*}}}*/
++/*FUNCTION Penta::FindParam(int* pvalue,int paramenum){{{*/
++void Penta::FindParam(int* pvalue,int paramenum){
++	this->parameters->FindParam(pvalue,paramenum);
++}
++/*}}}*/
++/*FUNCTION Penta::FindParam(IssmDouble* pvalue,int paramenum){{{*/
++void Penta::FindParam(IssmDouble* pvalue,int paramenum){
++	this->parameters->FindParam(pvalue,paramenum);
++}
++/*}}}*/
++/*FUNCTION Penta::FiniteElement{{{*/
++int Penta::FiniteElement(void){
++	return this->element_type;
++}
++/*}}}*/
+ /*FUNCTION Penta::ObjectEnum{{{*/
+ int Penta::ObjectEnum(void){
+ 
+@@ -1315,6 +1330,11 @@
+ 	return this->NumberofNodes();
+ }
+ /*}}}*/
++/*FUNCTION Penta::GetInput(int inputenum) {{{*/
++Input* Penta::GetInput(int inputenum){
++	return inputs->GetInput(inputenum);
++}
++/*}}}*/
+ /*FUNCTION Penta::GetInputListOnVertices(IssmDouble* pvalue,int enumtype) {{{*/
+ void Penta::GetInputListOnVertices(IssmDouble* pvalue,int enumtype){
+ 
+@@ -1412,6 +1432,30 @@
+ 	delete gauss;
+ }
+ /*}}}*/
++/*FUNCTION Penta::GetInputValue(bool* pvalue,int inputenum) {{{*/
++void Penta::GetInputValue(bool* pvalue,int inputenum){
++
++	Input* input=inputs->GetInput(inputenum);
++	if(!input) _error_("Input " << EnumToStringx(inputenum) << " not found in element");
++	input->GetInputValue(pvalue);
++
++}/*}}}*/
++/*FUNCTION Penta::GetInputValue(int* pvalue,int inputenum) {{{*/
++void Penta::GetInputValue(int* pvalue,int inputenum){
++
++	Input* input=inputs->GetInput(inputenum);
++	if(!input) _error_("Input " << EnumToStringx(inputenum) << " not found in element");
++	input->GetInputValue(pvalue);
++
++}/*}}}*/
++/*FUNCTION Penta::GetInputValue(IssmDouble* pvalue,int inputenum) {{{*/
++void Penta::GetInputValue(IssmDouble* pvalue,int inputenum){
++
++	Input* input=inputs->GetInput(inputenum);
++	if(!input) _error_("Input " << EnumToStringx(inputenum) << " not found in element");
++	input->GetInputValue(pvalue);
++
++}/*}}}*/
+ /*FUNCTION Penta::GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype) {{{*/
+ void Penta::GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype){
+ 
+@@ -2766,6 +2810,21 @@
+ 	return found;
+ }
+ /*}}}*/
++/*FUNCTION Penta::NewGauss{{{*/
++Gauss* Penta::NewGauss(void){
++	return new GaussPenta();
++}
++/*}}}*/
++/*FUNCTION Penta::NumberofNodesPressure{{{*/
++int Penta::NumberofNodesPressure(void){
++	return PentaRef::NumberofNodesPressure();
++}
++/*}}}*/
++/*FUNCTION Penta::NumberofNodesVelocity{{{*/
++int Penta::NumberofNodesVelocity(void){
++	return PentaRef::NumberofNodesVelocity();
++}
++/*}}}*/
+ /*FUNCTION Penta::PositiveDegreeDay{{{*/
+ void  Penta::PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm){
+ 
+@@ -3458,6 +3517,16 @@
+ 	delete gauss;
+ }
+ /*}}}*/
++/*FUNCTION Penta::VelocityInterpolation{{{*/
++int Penta::VelocityInterpolation(void){
++	return PentaRef::VelocityInterpolation();
++}
++/*}}}*/
++/*FUNCTION Penta::PressureInterpolation{{{*/
++int Penta::PressureInterpolation(void){
++	return PentaRef::PressureInterpolation();
++}
++/*}}}*/
+ 
+ #ifdef _HAVE_RESPONSES_
+ /*FUNCTION Penta::AverageOntoPartition {{{*/
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16674)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16675)
+@@ -73,6 +73,9 @@
+ 		void   ComputeStrainRate(Vector<IssmDouble>* eps);
+ 		void   ComputeStressTensor();
+ 		void   Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
++		void   FindParam(int* pvalue,int paramenum);
++		void   FindParam(IssmDouble* pvalue,int paramenum);
++		int    FiniteElement(void);
+ 		void   SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters);
+ 		void   SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum);
+ 		void   CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs);
+@@ -80,11 +83,15 @@
+ 		void   CreatePVector(Vector<IssmDouble>* pf);
+ 		void   CreateJacobianMatrix(Matrix<IssmDouble>* Jff);
+ 		void   Delta18oParameterization(void);
++		void	 GetDofList(int** pdoflist,int approximation_enum,int setenum);
++		void	 GetDofListVelocity(int** pdoflist,int setenum);
++		void	 GetDofListPressure(int** pdoflist,int setenum);
+ 		int    GetNodeIndex(Node* node);
+ 		void   GetNodesSidList(int* sidlist);
+ 		void   GetNodesLidList(int* lidlist);
+ 		int    GetNumberOfNodes(void);
+ 		void   GetSolutionFromInputs(Vector<IssmDouble>* solution);
++		void   GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
+ 		IssmDouble GetZcoord(GaussPenta* gauss);
+ 		void   GetVectorFromInputs(Vector<IssmDouble>* vector,int name_enum);
+ 
+@@ -93,6 +100,10 @@
+ 		void   InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum=MeshElementsEnum);
+ 		void   InputDuplicate(int original_enum,int new_enum);
+ 		void   InputScale(int enum_type,IssmDouble scale_factor);
++		int    NumberofNodesVelocity(void);
++		int    NumberofNodesPressure(void);
++		int    VelocityInterpolation();
++		int    PressureInterpolation();
+ 
+ 		void   ResultInterpolation(int* pinterpolation,int output_enum);
+ 		void   ResultToVector(Vector<IssmDouble>* vector,int output_enum);
+@@ -180,9 +191,7 @@
+ 		ElementVector* CreatePVectorFreeSurfaceBase(void);
+ 		ElementVector* CreatePVectorL2ProjectionBase(void);
+ 		void           GetAreaCoordinates(IssmDouble *area_coordinates,IssmDouble xyz_zero[3][3],IssmDouble xyz_list[6][3],int numpoints);
+-		void	         GetDofList(int** pdoflist,int approximation_enum,int setenum);
+-		void	         GetDofListVelocity(int** pdoflist,int setenum);
+-		void	         GetDofListPressure(int** pdoflist,int setenum);
++
+ 		void	         GetVertexPidList(int* doflist);
+ 		void           GetVertexSidList(int* sidlist);
+ 		void           GetConnectivityList(int* connectivity);
+@@ -190,11 +199,15 @@
+ 		IssmDouble     GetGroundedPortion(IssmDouble* xyz_list);
+ 		int            GetElementType(void);
+ 		void           GetElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz);
++		Input*         GetInput(int inputenum);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue);
+ 		void           GetInputListOnNodes(IssmDouble* pvalue,int enumtype);
+ 		void           GetInputListOnNodes(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue);
+ 		void           GetInputValue(IssmDouble* pvalue,Node* node,int enumtype);
++		void           GetInputValue(bool* pvalue,int enum_type);
++		void           GetInputValue(int* pvalue,int enum_type);
++		void           GetInputValue(IssmDouble* pvalue,int enum_type);
+ 		void           GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype);
+ 		void	         GetPhi(IssmDouble* phi, IssmDouble*  epsilon, IssmDouble viscosity);
+ 		void           GetQuadNormal(IssmDouble* normal,IssmDouble xyz_list[4][3]);
+@@ -217,6 +230,7 @@
+ 		bool           IsFloating(void); 
+ 		bool           IsNodeOnShelfFromFlags(IssmDouble* flags);
+ 		bool           NoIceInElement(void); 
++		Gauss*         NewGauss(void);
+ 		IssmDouble     MinEdgeLength(IssmDouble xyz_list[6][3]);
+ 		void	         SetClone(int* minranks);
+ 		Tria*	         SpawnTria(int location);
+@@ -318,7 +332,6 @@
+ 		ElementVector* CreatePVectorHydrologyDCEfficient(void);
+ 		void    GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode);
+ 		void    GetHydrologyTransfer(Vector<IssmDouble>* transfer);
+-		void    GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution, int enum_type);
+ 		void    HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
+ 		void    HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask);
+ 		void    InputUpdateFromSolutionHydrologyDCInefficient(IssmDouble* solution);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 16675)
+@@ -87,6 +87,21 @@
+ 	else _printf_("inputs=NULL\n");
+ }
+ /*}}}*/
++/*FUNCTION Seg::FindParam(int* pvalue,int paramenum){{{*/
++void Seg::FindParam(int* pvalue,int paramenum){
++	this->parameters->FindParam(pvalue,paramenum);
++}
++/*}}}*/
++/*FUNCTION Seg::FindParam(IssmDouble* pvalue,int paramenum){{{*/
++void Seg::FindParam(IssmDouble* pvalue,int paramenum){
++	this->parameters->FindParam(pvalue,paramenum);
++}
++/*}}}*/
++/*FUNCTION Seg::FiniteElement{{{*/
++int Seg::FiniteElement(void){
++	return this->element_type;
++}
++/*}}}*/
+ /*FUNCTION Seg::DeepEcho{{{*/
+ void Seg::DeepEcho(void){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16674)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16675)
+@@ -77,6 +77,12 @@
+ 		ElementVector* CreatePVectorL2Projection(void);
+ 		void        CreateJacobianMatrix(Matrix<IssmDouble>* Jff){_error_("not implemented yet");};
+ 		void        Delta18oParameterization(void){_error_("not implemented yet");};
++		void        FindParam(int* pvalue,int paramenum);
++		void        FindParam(IssmDouble* pvalue,int paramenum);
++		int         FiniteElement(void);
++		void        GetDofList(int** pdoflist,int approximation_enum,int setenum){_error_("not implemented yet");};
++		void        GetDofListVelocity(int** pdoflist,int setenum){_error_("not implemented yet");};
++		void        GetDofListPressure(int** pdoflist,int setenum){_error_("not implemented yet");};
+ 		int         GetNodeIndex(Node* node){_error_("not implemented yet");};
+ 		void        GetNodesSidList(int* sidlist){_error_("not implemented yet");};
+ 		void        GetNodesLidList(int* lidlist){_error_("not implemented yet");};
+@@ -85,11 +91,20 @@
+ 		bool        IsOnBed(){_error_("not implemented yet");};
+ 		bool        IsFloating(){_error_("not implemented yet");};
+ 		bool        IsNodeOnShelfFromFlags(IssmDouble* flags){_error_("not implemented yet");};
++		int         NumberofNodesVelocity(void){_error_("not implemented yet");};
++		int         NumberofNodesPressure(void){_error_("not implemented yet");};
++		int         VelocityInterpolation(void){_error_("not implemented yet");};
++		int         PressureInterpolation(void){_error_("not implemented yet");};
+ 		bool        NoIceInElement(){_error_("not implemented yet");};
+-		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype){_error_("not implemented yet");};
+-		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){_error_("not implemented yet");};
+-		void           GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");};
+-		void           GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");};
++		Input*      GetInput(int inputenum){_error_("not implemented yet");};
++		void        GetInputListOnVertices(IssmDouble* pvalue,int enumtype){_error_("not implemented yet");};
++		void        GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){_error_("not implemented yet");};
++		void        GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");};
++		void        GetInputValue(bool* pvalue,int enum_type){_error_("not implemented yet");};
++		void        GetInputValue(int* pvalue,int enum_type){_error_("not implemented yet");};
++		void        GetInputValue(IssmDouble* pvalue,int enum_type){_error_("not implemented yet");};
++		void        GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");};
++		Gauss*      NewGauss(void){_error_("not implemented yet");};
+ 		#ifdef _HAVE_THERMAL_
+ 		void UpdateBasalConstraintsEnthalpy(void){_error_("not implemented yet");};
+ 		void ComputeBasalMeltingrate(void){_error_("not implemented yet");};
+@@ -103,6 +118,7 @@
+ 		void    ComputeEPLThickness(void){_error_("not implemented yet");};
+ 		#endif
+ 		void        GetSolutionFromInputs(Vector<IssmDouble>* solution){_error_("not implemented yet");};
++		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type){_error_("not implemented yet");};
+ 		void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum){_error_("not implemented yet");};
+ 		void        InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){_error_("not implemented yet");};
+ 		void        InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum=MeshElementsEnum){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/gauss/GaussPenta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussPenta.h	(revision 16674)
++++ ../trunk-jpl/src/c/classes/gauss/GaussPenta.h	(revision 16675)
+@@ -7,9 +7,10 @@
+ 
+ /*Headers:*/
+ #include "../../shared/Numerics/types.h"
++#include "./Gauss.h"
+ class GaussTria;
+ 
+-class GaussPenta{
++class GaussPenta: public Gauss{
+ 
+ 	private:
+ 		int numgauss;
+@@ -42,6 +43,7 @@
+ 		int  begin(void);
+ 		int  end(void);
+ 		void Echo(void);
++		int  Enum(void);
+ 		void GaussPoint(int ig);
+ 		void GaussVertex(int iv);
+ 		void GaussNode(int finitelement,int iv);
+Index: ../trunk-jpl/src/c/classes/gauss/GaussSeg.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussSeg.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/classes/gauss/GaussSeg.cpp	(revision 16675)
+@@ -69,6 +69,11 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION GaussSeg::Enum{{{*/
++int GaussSeg::Enum(void){
++	return GaussSegEnum;
++}
++/*}}}*/
+ /*FUNCTION GaussSeg::GaussPoint{{{*/
+ void GaussSeg::GaussPoint(int ig){
+ 
+@@ -80,6 +85,19 @@
+ 	 coord1=coords1[ig];
+ }
+ /*}}}*/
++/*FUNCTION GaussSeg::GaussVertex{{{*/
++void GaussSeg::GaussVertex(int iv){
++
++	_error_("not supported");
++}
++/*}}}*/
++/*FUNCTION GaussSeg::GaussNode{{{*/
++void GaussSeg::GaussNode(int finiteelement,int iv){
++
++	_error_("not supported");
++
++}
++/*}}}*/
+ /*FUNCTION GaussSeg::begin{{{*/
+ int GaussSeg::begin(void){
+ 
+Index: ../trunk-jpl/src/c/classes/gauss/gaussobjects.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/gaussobjects.h	(revision 16674)
++++ ../trunk-jpl/src/c/classes/gauss/gaussobjects.h	(revision 16675)
+@@ -5,6 +5,7 @@
+ #ifndef ALL_GAUSS_OBJECTS_H_
+ #define ALL_GAUSS_OBJECTS_H_
+ 
++#include "./Gauss.h"
+ #include "./GaussSeg.h"
+ #include "./GaussTria.h"
+ #include "./GaussPenta.h"
+Index: ../trunk-jpl/src/c/classes/gauss/GaussTria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussTria.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/classes/gauss/GaussTria.cpp	(revision 16675)
+@@ -340,6 +340,11 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION GaussTria::Enum{{{*/
++int GaussTria::Enum(void){
++	return GaussTriaEnum;
++}
++/*}}}*/
+ /*FUNCTION GaussTria::GaussEdgeCenter{{{*/
+ void GaussTria::GaussEdgeCenter(int index1,int index2){
+ 
+Index: ../trunk-jpl/src/c/classes/gauss/GaussSeg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussSeg.h	(revision 16674)
++++ ../trunk-jpl/src/c/classes/gauss/GaussSeg.h	(revision 16675)
+@@ -7,8 +7,9 @@
+ 
+ /*Headers:*/
+ #include "../../shared/Numerics/types.h"
++#include "./Gauss.h"
+ 
+-class GaussSeg{
++class GaussSeg: public Gauss{
+ 
+ 	private:
+ 		int numgauss;
+@@ -29,6 +30,9 @@
+ 		int  begin(void);
+ 		int  end(void);
+ 		void Echo(void);
++		int  Enum(void);
+ 		void GaussPoint(int ig);
++		void GaussVertex(int iv);
++		void GaussNode(int finitelement,int iv);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/classes/gauss/Gauss.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/Gauss.h	(revision 0)
++++ ../trunk-jpl/src/c/classes/gauss/Gauss.h	(revision 16675)
+@@ -0,0 +1,22 @@
++/*!\file Gauss.h
++ * \brief: header file for vvirtual Gauss object
++ */
++
++#ifndef _GAUSS_H_
++#define _GAUSS_H_
++
++class Gauss{
++
++	public: 
++		virtual        ~Gauss(){};
++
++		virtual int  begin(void)=0;
++		virtual int  end(void)=0;
++		virtual void Echo(void)=0;
++		virtual int  Enum(void)=0;
++		virtual void GaussPoint(int ig)=0;
++		virtual void GaussVertex(int iv)=0;
++		virtual void GaussNode(int finitelement,int iv)=0;
++
++};
++#endif
+Index: ../trunk-jpl/src/c/classes/gauss/GaussTria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussTria.h	(revision 16674)
++++ ../trunk-jpl/src/c/classes/gauss/GaussTria.h	(revision 16675)
+@@ -7,8 +7,9 @@
+ 
+ /*Headers:*/
+ #include "../../shared/Numerics/types.h"
++#include "./Gauss.h"
+ 
+-class GaussTria{
++class GaussTria: public Gauss{
+ 
+ 	private:
+ 		int numgauss;
+@@ -37,6 +38,7 @@
+ 		int  begin(void);
+ 		int  end(void);
+ 		void Echo(void);
++		int  Enum(void);
+ 		void GaussFromCoords(IssmDouble x1,IssmDouble y1,IssmDouble* xyz_list);
+ 		void GaussPoint(int ig);
+ 		void GaussVertex(int iv);
+Index: ../trunk-jpl/src/c/classes/gauss/GaussPenta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussPenta.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/classes/gauss/GaussPenta.cpp	(revision 16675)
+@@ -494,6 +494,11 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION GaussPenta::Enum{{{*/
++int GaussPenta::Enum(void){
++	return GaussPentaEnum;
++}
++/*}}}*/
+ /*FUNCTION GaussPenta::GaussPoint{{{*/
+ void GaussPenta::GaussPoint(int ig){
+ 
+Index: ../trunk-jpl/src/c/classes/Inputs/SegInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/SegInput.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/classes/Inputs/SegInput.cpp	(revision 16675)
+@@ -95,11 +95,12 @@
+ 	*pvalue=value;
+ }
+ /*}}}*/
+-/*FUNCTION SegInput::GetInputValue(IssmDouble* pvalue,GaussSeg* gauss){{{*/
+-void SegInput::GetInputValue(IssmDouble* pvalue,GaussSeg* gauss){
++/*FUNCTION SegInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){{{*/
++void SegInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){
+ 
+ 	/*Call SegRef function*/
+-	SegRef::GetInputValue(pvalue,&values[0],gauss);
++	_assert_(gauss->Enum()==GaussSegEnum);
++	SegRef::GetInputValue(pvalue,&values[0],(GaussSeg*)gauss);
+ 
+ }
+ /*}}}*/
+Index: ../trunk-jpl/src/c/classes/Inputs/DoubleInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/DoubleInput.h	(revision 16674)
++++ ../trunk-jpl/src/c/classes/Inputs/DoubleInput.h	(revision 16675)
+@@ -45,13 +45,9 @@
+ 		void GetInputValue(bool* pvalue);
+ 		void GetInputValue(int* pvalue);
+ 		void GetInputValue(IssmDouble* pvalue);
+-		void GetInputValue(IssmDouble* pvalue,GaussSeg* gauss){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussTria* gauss);
+-		void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss);
+-		void GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss ,int index){_error_("not implemented yet");};
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss);
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){_error_("not implemented yet");};
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index){_error_("not implemented yet");};
+ 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss){_error_("not implemented yet");};
+ 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss);
+ 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss);
+Index: ../trunk-jpl/src/c/classes/Inputs/ControlInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/ControlInput.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/classes/Inputs/ControlInput.cpp	(revision 16675)
+@@ -234,14 +234,10 @@
+ void ControlInput::GetInputValue(IssmDouble* pvalue){
+ 	values->GetInputValue(pvalue);
+ }/*}}}*/
+-/*FUNCTION ControlInput::GetInputValue(IssmDouble* pvalue){{{*/
+-void ControlInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){
++/*FUNCTION ControlInput::GetInputValue(Issm* pvalue,Gauss* gauss){{{*/
++void ControlInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){
+ 	values->GetInputValue(pvalue,gauss);
+ }/*}}}*/
+-/*FUNCTION ControlInput::GetInputValue(IssmDouble* pvalue){{{*/
+-void ControlInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){
+-	values->GetInputValue(pvalue,gauss);
+-}/*}}}*/
+ /*FUNCTION ControlInput::GetGradientValue(IssmDouble* pvalue,GaussTria* gauss){{{*/
+ void ControlInput::GetGradientValue(IssmDouble* pvalue,GaussTria* gauss){
+ 	gradient->GetInputValue(pvalue,gauss);
+Index: ../trunk-jpl/src/c/classes/Inputs/SegInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/SegInput.h	(revision 16674)
++++ ../trunk-jpl/src/c/classes/Inputs/SegInput.h	(revision 16675)
+@@ -46,13 +46,10 @@
+ 		void GetInputValue(bool* pvalue){_error_("not implemented yet");}
+ 		void GetInputValue(int* pvalue){_error_("not implemented yet");}
+ 		void GetInputValue(IssmDouble* pvalue){_error_("not implemented yet");}
+-		void GetInputValue(IssmDouble* pvalue,GaussSeg* gauss);
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss);
+ 		void GetInputValue(IssmDouble* pvalue,GaussTria* gauss){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,int index){_error_("not implemented yet");};
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){_error_("not implemented yet");};
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index){_error_("not implemented yet");};
+ 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss);
+ 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){_error_("not implemented yet");};
+ 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/Input.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/Input.h	(revision 16674)
++++ ../trunk-jpl/src/c/classes/Inputs/Input.h	(revision 16675)
+@@ -10,6 +10,7 @@
+ #include "../../datastructures/datastructures.h"
+ #include "../../shared/shared.h"
+ class Node;
++class Gauss;
+ class GaussTria;
+ class GaussSeg;
+ class Parameters;
+@@ -27,13 +28,9 @@
+ 		virtual void GetInputValue(bool* pvalue)=0;
+ 		virtual void GetInputValue(int* pvalue)=0;
+ 		virtual void GetInputValue(IssmDouble* pvalue)=0;
+-		virtual void GetInputValue(IssmDouble* pvalue,GaussSeg* gauss)=0;
+-		virtual void GetInputValue(IssmDouble* pvalue,GaussTria* gauss)=0;
+-		virtual void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss)=0;
+-		virtual void GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time)=0;
+-		virtual void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time)=0;
+-		virtual void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index)=0;
+-		virtual void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,int index)=0;
++		virtual void GetInputValue(IssmDouble* pvalue,Gauss* gauss)=0;
++		virtual void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time)=0;
++		virtual void GetInputValue(IssmDouble* pvalue,Gauss* gauss,int index)=0;
+ 		virtual void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss)=0;
+ 		virtual void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss)=0;
+ 		virtual void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss)=0;
+Index: ../trunk-jpl/src/c/classes/Inputs/ControlInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/ControlInput.h	(revision 16674)
++++ ../trunk-jpl/src/c/classes/Inputs/ControlInput.h	(revision 16675)
+@@ -52,13 +52,9 @@
+ 		void GetInputValue(bool* pvalue);
+ 		void GetInputValue(int* pvalue);
+ 		void GetInputValue(IssmDouble* pvalue);
+-		void GetInputValue(IssmDouble* pvalue,GaussSeg* gauss){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussTria* gauss);
+-		void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss);
+-		void GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss ,int index){_error_("not implemented yet");};
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss);
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){_error_("not implemented yet");};
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index){_error_("not implemented yet");};
+ 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss){_error_("not implemented yet");};
+ 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss);
+ 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss);
+Index: ../trunk-jpl/src/c/classes/Inputs/DatasetInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/DatasetInput.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/classes/Inputs/DatasetInput.cpp	(revision 16675)
+@@ -157,8 +157,8 @@
+ 	/*do nothing: */
+ }
+ /*}}}*/
+-/*FUNCTION DatasetInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss,int id){{{*/
+-void DatasetInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss,int id){
++/*FUNCTION DatasetInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss,int id){{{*/
++void DatasetInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss,int id){
+ 
+ 	int  offset = -1;
+ 	_assert_(this->numids == this->inputs->Size());
+@@ -171,17 +171,3 @@
+ 	input->GetInputValue(pvalue,gauss);
+ }
+ /*}}}*/
+-/*FUNCTION DatasetInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,int id){{{*/
+-void DatasetInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,int id){
+-
+-	int  offset = -1;
+-	_assert_(this->numids == this->inputs->Size());
+-
+-	/*Get requested input within dataset*/
+-	for(int i=0;i<this->numids;i++) if(this->ids[i]==id) offset=i;
+-	if(offset<0) _error_("Could not find input of id "<<id);
+-
+-	Input* input=dynamic_cast<Input*>(this->inputs->GetObjectByOffset(offset));
+-	input->GetInputValue(pvalue,gauss);
+-}
+-/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Inputs/DatasetInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/DatasetInput.h	(revision 16674)
++++ ../trunk-jpl/src/c/classes/Inputs/DatasetInput.h	(revision 16675)
+@@ -47,13 +47,9 @@
+ 		void GetInputValue(bool* pvalue){_error_("not implemented yet");};
+ 		void GetInputValue(int* pvalue){_error_("not implemented yet");};
+ 		void GetInputValue(IssmDouble* pvalue){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussSeg* gauss){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussTria* gauss){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index);
+-		void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss ,int index);
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss){_error_("not implemented yet");};
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){_error_("not implemented yet");};
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index);
+ 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss){_error_("not implemented yet");};
+ 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){_error_("not implemented yet");};
+ 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/IntInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/IntInput.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/classes/Inputs/IntInput.cpp	(revision 16675)
+@@ -111,12 +111,9 @@
+ 	_error_("IntInput cannot return a IssmDouble in parallel");
+ }
+ /*}}}*/
+-/*FUNCTION IntInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){{{*/
+-void IntInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){_error_("not supported yet!");}
++/*FUNCTION IntInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){{{*/
++void IntInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){_error_("not supported yet!");}
+ /*}}}*/
+-/*FUNCTION IntInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){{{*/
+-void IntInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){_error_("not supported yet!");}
+-/*}}}*/
+ /*FUNCTION IntInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){{{*/
+ void IntInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){_error_("not supported yet!");}
+ /*}}}*/
+Index: ../trunk-jpl/src/c/classes/Inputs/BoolInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/BoolInput.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/classes/Inputs/BoolInput.cpp	(revision 16675)
+@@ -111,12 +111,9 @@
+ /*FUNCTION BoolInput::GetInputValue(IssmDouble* pvalue){{{*/
+ void BoolInput::GetInputValue(IssmDouble* pvalue){_error_("not supported yet!");}
+ /*}}}*/
+-/*FUNCTION BoolInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){{{*/
+-void BoolInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){_error_("not supported yet!");}
++/*FUNCTION BoolInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){{{*/
++void BoolInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){_error_("not supported yet!");}
+ /*}}}*/
+-/*FUNCTION BoolInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){{{*/
+-void BoolInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){_error_("not supported yet!");}
+-/*}}}*/
+ /*FUNCTION BoolInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){{{*/
+ void BoolInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){_error_("not supported yet!");}
+ /*}}}*/
+Index: ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 16675)
+@@ -123,11 +123,12 @@
+ /*}}}*/
+ 
+ /*Object functions*/
+-/*FUNCTION TriaInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){{{*/
+-void TriaInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){
++/*FUNCTION TriaInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){{{*/
++void TriaInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){
+ 
+ 	/*Call TriaRef function*/
+-	TriaRef::GetInputValue(pvalue,&values[0],gauss);
++	_assert_(gauss->Enum()==GaussTriaEnum);
++	TriaRef::GetInputValue(pvalue,&values[0],(GaussTria*)gauss);
+ 
+ }
+ /*}}}*/
+Index: ../trunk-jpl/src/c/classes/Inputs/IntInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/IntInput.h	(revision 16674)
++++ ../trunk-jpl/src/c/classes/Inputs/IntInput.h	(revision 16675)
+@@ -46,13 +46,9 @@
+ 		void GetInputValue(bool* pvalue);
+ 		void GetInputValue(int* pvalue);
+ 		void GetInputValue(IssmDouble* pvalue);
+-		void GetInputValue(IssmDouble* pvalue,GaussSeg* gauss){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussTria* gauss);
+-		void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss);
+-		void GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss ,int index){_error_("not implemented yet");};
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss);
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){_error_("not implemented yet");};
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index){_error_("not implemented yet");};
+ 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss){_error_("not implemented yet");};
+ 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss);
+ 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss);
+Index: ../trunk-jpl/src/c/classes/Inputs/BoolInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/BoolInput.h	(revision 16674)
++++ ../trunk-jpl/src/c/classes/Inputs/BoolInput.h	(revision 16675)
+@@ -46,13 +46,9 @@
+ 		void GetInputValue(bool* pvalue);
+ 		void GetInputValue(int* pvalue);
+ 		void GetInputValue(IssmDouble* pvalue);
+-		void GetInputValue(IssmDouble* pvalue,GaussSeg* gauss){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussTria* gauss);
+-		void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss);
+-		void GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss ,int index){_error_("not implemented yet");};
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss);
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){_error_("not implemented yet");};
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index){_error_("not implemented yet");};
+ 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss){_error_("not implemented yet");};
+ 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss);
+ 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss);
+Index: ../trunk-jpl/src/c/classes/Inputs/TriaInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TriaInput.h	(revision 16674)
++++ ../trunk-jpl/src/c/classes/Inputs/TriaInput.h	(revision 16675)
+@@ -46,13 +46,9 @@
+ 		void GetInputValue(bool* pvalue){_error_("not implemented yet");}
+ 		void GetInputValue(int* pvalue){_error_("not implemented yet");}
+ 		void GetInputValue(IssmDouble* pvalue){_error_("not implemented yet");}
+-		void GetInputValue(IssmDouble* pvalue,GaussSeg* gauss){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussTria* gauss);
+-		void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,int index){_error_("not implemented yet");};
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss);
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){_error_("not implemented yet");};
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss,int index){_error_("not implemented yet");};
+ 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss){_error_("not implemented yet");};
+ 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss);
+ 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 16675)
+@@ -136,11 +136,12 @@
+ /*}}}*/
+ 
+ /*Object functions*/
+-/*FUNCTION PentaInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){{{*/
+-void PentaInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){
++/*FUNCTION PentaInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){{{*/
++void PentaInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){
+ 
+ 	/*Call PentaRef function*/
+-	PentaRef::GetInputValue(pvalue,&values[0],gauss);
++	_assert_(gauss->Enum()==GaussPentaEnum);
++	PentaRef::GetInputValue(pvalue,&values[0],(GaussPenta*)gauss);
+ 
+ }
+ /*}}}*/
+Index: ../trunk-jpl/src/c/classes/Inputs/TransientInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TransientInput.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/classes/Inputs/TransientInput.cpp	(revision 16675)
+@@ -148,8 +148,8 @@
+ /*}}}*/
+ 
+ /*Object functions*/
+-/*FUNCTION TransientInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){{{*/
+-void TransientInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){
++/*FUNCTION TransientInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){{{*/
++void TransientInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){
+ 	IssmDouble time;
+ 
+ 	/*First, recover current time from parameters: */
+@@ -164,13 +164,9 @@
+ 	delete input;
+ }
+ /*}}}*/
+-/*FUNCTION TransientInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){{{*/
+-void TransientInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){
+-	IssmDouble time;
++/*FUNCTION TransientInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){{{*/
++void TransientInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){
+ 
+-	/*First, recover current time from parameters: */
+-	this->parameters->FindParam(&time,TimeEnum);
+-
+ 	/*Retrieve interpolated values for this time step: */
+ 	Input* input=GetTimeInput(time);
+ 
+@@ -180,30 +176,6 @@
+ 	delete input;
+ }
+ /*}}}*/
+-/*FUNCTION TransientInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time){{{*/
+-void TransientInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time){
+-
+-	/*Retrieve interpolated values for this time step: */
+-	Input* input=GetTimeInput(time);
+-
+-	/*Call input function*/
+-	input->GetInputValue(pvalue,gauss);
+-
+-	delete input;
+-}
+-/*}}}*/
+-/*FUNCTION TransientInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time){{{*/
+-void TransientInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time){
+-
+-	/*Retrieve interpolated values for this time step: */
+-	Input* input=GetTimeInput(time);
+-
+-	/*Call input function*/
+-	input->GetInputValue(pvalue,gauss);
+-
+-	delete input;
+-}
+-/*}}}*/
+ /*FUNCTION TransientInput::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, GaussTria* gauss){{{*/
+ void TransientInput::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, GaussTria* gauss){
+ 
+Index: ../trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp	(revision 16674)
++++ ../trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp	(revision 16675)
+@@ -119,12 +119,9 @@
+ 	*pvalue=value;
+ }
+ /*}}}*/
+-/*FUNCTION DoubleInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){{{*/
+-void DoubleInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){*pvalue=this->value;}
++/*FUNCTION DoubleInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){{{*/
++void DoubleInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){*pvalue=this->value;}
+ /*}}}*/
+-/*FUNCTION DoubleInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){{{*/
+-void DoubleInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){*pvalue=this->value;}
+-/*}}}*/
+ /*FUNCTION DoubleInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){{{*/
+ void DoubleInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){_error_("not supported yet!");}
+ /*}}}*/
+Index: ../trunk-jpl/src/c/classes/Inputs/PentaInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/PentaInput.h	(revision 16674)
++++ ../trunk-jpl/src/c/classes/Inputs/PentaInput.h	(revision 16675)
+@@ -45,13 +45,9 @@
+ 		void GetInputValue(bool* pvalue){_error_("not implemented yet");};
+ 		void GetInputValue(int* pvalue){_error_("not implemented yet");};
+ 		void GetInputValue(IssmDouble* pvalue){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussSeg* gauss){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussTria* gauss){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss);
+-		void GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss ,int index){_error_("not implemented yet");};
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss);
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){_error_("not implemented yet");};
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index){_error_("not implemented yet");};
+ 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss){_error_("not implemented yet");};
+ 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){_error_("not implemented yet");};
+ 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss);
+Index: ../trunk-jpl/src/c/classes/Inputs/TransientInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TransientInput.h	(revision 16674)
++++ ../trunk-jpl/src/c/classes/Inputs/TransientInput.h	(revision 16675)
+@@ -49,13 +49,9 @@
+ 		void GetInputValue(bool* pvalue){_error_("not implemented yet");};
+ 		void GetInputValue(int* pvalue){_error_("not implemented yet");};
+ 		void GetInputValue(IssmDouble* pvalue){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussSeg* gauss){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussTria* gauss);
+-		void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss);
+-		void GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time);
+-		void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time);
+-		void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss ,int index){_error_("not implemented yet");};
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss);
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time);
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index){_error_("not implemented yet");};
+ 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss){_error_("not implemented yet");};
+ 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss);
+ 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16675-16676.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16675-16676.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16675-16676.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16675)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16676)
+@@ -852,7 +852,7 @@
+ 	element->GetDofListPressure(&pdoflist,GsetEnum);
+ 	Input*     vx_input=element->GetInput(VxEnum);       _assert_(vx_input);
+ 	Input*     vy_input=element->GetInput(VyEnum);       _assert_(vy_input);
+-	if(dim==3) vz_input=element->GetInput(VzEnum);       _assert_(vz_input);
++	if(dim==3){vz_input=element->GetInput(VzEnum);       _assert_(vz_input);}
+ 	Input*     p_input =element->GetInput(PressureEnum); _assert_(p_input);
+ 
+ 	element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
Index: issm/oecreview/Archive/16554-17801/ISSM-16676-16677.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16676-16677.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16676-16677.diff	(revision 17802)
@@ -0,0 +1,25 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 16676)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 16677)
+@@ -96,5 +96,5 @@
+ 
+ /*Numerics*/
+ void StressbalanceVerticalAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+-	   _error_("not implemented yet");
++	element->GetSolutionFromInputsOneDof(solution,VzEnum);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16676)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16677)
+@@ -812,6 +812,9 @@
+ 		case SSAApproximationEnum: case HOApproximationEnum: case SIAApproximationEnum:
+ 			GetSolutionFromInputsHoriz(solution,element);
+ 			return;
++		case L1L2ApproximationEnum:
++			GetSolutionFromInputsHoriz(solution,element);
++			return;
+ 		case SSAHOApproximationEnum: case HOFSApproximationEnum: case SSAFSApproximationEnum:
+ 			/*the elements around will create the solution*/
+ 			return;
Index: issm/oecreview/Archive/16554-17801/ISSM-16677-16678.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16677-16678.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16677-16678.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16677)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16678)
+@@ -813,7 +813,7 @@
+ 			GetSolutionFromInputsHoriz(solution,element);
+ 			return;
+ 		case L1L2ApproximationEnum:
+-			GetSolutionFromInputsHoriz(solution,element);
++//			GetSolutionFromInputsHoriz(solution,element);
+ 			return;
+ 		case SSAHOApproximationEnum: case HOFSApproximationEnum: case SSAFSApproximationEnum:
+ 			/*the elements around will create the solution*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16678-16679.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16678-16679.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16678-16679.diff	(revision 17802)
@@ -0,0 +1,62 @@
+Index: ../trunk-jpl/src/m/enum/GaussTriaEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/GaussTriaEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/GaussTriaEnum.m	(revision 16679)
+@@ -0,0 +1,11 @@
++function macro=GaussTriaEnum()
++%GAUSSTRIAENUM - Enum of GaussTria
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=GaussTriaEnum()
++
++macro=StringToEnum('GaussTria');
+Index: ../trunk-jpl/src/m/enum/GaussPentaEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/GaussPentaEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/GaussPentaEnum.m	(revision 16679)
+@@ -0,0 +1,11 @@
++function macro=GaussPentaEnum()
++%GAUSSPENTAENUM - Enum of GaussPenta
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=GaussPentaEnum()
++
++macro=StringToEnum('GaussPenta');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 16678)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 16679)
+@@ -552,6 +552,9 @@
+ def SubelementMigration2Enum(): return StringToEnum("SubelementMigration2")[0]
+ def MaskGroundediceLevelsetEnum(): return StringToEnum("MaskGroundediceLevelset")[0]
+ def QmuMaskGroundediceLevelsetEnum(): return StringToEnum("QmuMaskGroundediceLevelset")[0]
++def GaussSegEnum(): return StringToEnum("GaussSeg")[0]
++def GaussTriaEnum(): return StringToEnum("GaussTria")[0]
++def GaussPentaEnum(): return StringToEnum("GaussPenta")[0]
+ def FSSolverEnum(): return StringToEnum("FSSolver")[0]
+ def AdjointEnum(): return StringToEnum("Adjoint")[0]
+ def ColinearEnum(): return StringToEnum("Colinear")[0]
+Index: ../trunk-jpl/src/m/enum/GaussSegEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/GaussSegEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/GaussSegEnum.m	(revision 16679)
+@@ -0,0 +1,11 @@
++function macro=GaussSegEnum()
++%GAUSSSEGENUM - Enum of GaussSeg
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=GaussSegEnum()
++
++macro=StringToEnum('GaussSeg');
Index: issm/oecreview/Archive/16554-17801/ISSM-16679-16680.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16679-16680.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16679-16680.diff	(revision 17802)
@@ -0,0 +1,22 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16679)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16680)
+@@ -893,14 +893,16 @@
+ void StressbalanceAnalysis::GetSolutionFromInputsHoriz(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 
+ 	IssmDouble   vx,vy;
++	int          approximation;
+ 	int*         doflist = NULL;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+ 	int numdof   = numnodes*2;
++	element->GetInputValue(&approximation,ApproximationEnum);
+ 
+ 	/*Fetch dof list and allocate solution vector*/
+-	element->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
++	element->GetDofList(&doflist,approximation,GsetEnum);
+ 	IssmDouble* values = xNew<IssmDouble>(numdof);
+ 
+ 	/*Get inputs*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16680-16681.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16680-16681.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16680-16681.diff	(revision 17802)
@@ -0,0 +1,468 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16680)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16681)
+@@ -47,7 +47,6 @@
+ 		virtual void	GetDofList(int** pdoflist,int approximation_enum,int setenum)=0;
+ 		virtual void	GetDofListVelocity(int** pdoflist,int setenum)=0;
+ 		virtual void	GetDofListPressure(int** pdoflist,int setenum)=0;
+-		virtual void   GetSolutionFromInputs(Vector<IssmDouble>* solution)=0;
+ 		virtual void   GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int solutionenum)=0;
+ 		virtual int    GetNodeIndex(Node* node)=0;
+ 		virtual int    GetNumberOfNodes(void)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16680)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16681)
+@@ -1502,50 +1502,6 @@
+ 	for(int i=0;i<NUMVERTICES;i++) connectivity[i]=vertices[i]->Connectivity();
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetSolutionFromInputs{{{*/
+-void  Tria::GetSolutionFromInputs(Vector<IssmDouble>* solution){
+-
+-	/*retrive parameters: */
+-	int analysis_type;
+-	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-
+-	/*Just branch to the correct InputUpdateFromSolution generator, according to the type of analysis we are carrying out: */
+-	switch(analysis_type){
+-	#ifdef _HAVE_STRESSBALANCE_
+-	case StressbalanceAnalysisEnum:
+-		int approximation;
+-		inputs->GetInputValue(&approximation,ApproximationEnum);
+-		if(approximation==FSApproximationEnum || approximation==NoneApproximationEnum){
+-			GetSolutionFromInputsStressbalanceFS(solution);
+-		}
+-		else if (approximation==SSAApproximationEnum || approximation==SIAApproximationEnum){
+-			GetSolutionFromInputsStressbalanceHoriz(solution);
+-		}
+-		else{
+-			_error_("approximation not supported yet");
+-		}
+-		break;
+-	case StressbalanceSIAAnalysisEnum:
+-		GetSolutionFromInputsStressbalanceSIA(solution);
+-		break;
+-	#endif
+-	#ifdef _HAVE_HYDROLOGY_
+-	case HydrologyShreveAnalysisEnum:
+-		GetSolutionFromInputsOneDof(solution,WatercolumnEnum);
+-		break;
+-	case HydrologyDCInefficientAnalysisEnum:
+-		GetSolutionFromInputsOneDof(solution,SedimentHeadEnum);
+-		break;
+-	case HydrologyDCEfficientAnalysisEnum:
+-		GetSolutionFromInputsOneDof(solution,EplHeadEnum);
+-		break;
+-	#endif
+-	default:
+-		_error_("analysis: " << EnumToStringx(analysis_type) << " not supported yet");
+-	}
+-
+-}
+-/*}}}*/
+ /*FUNCTION Tria::GetStrainRate2d(IssmDouble* epsilon,IssmDouble* xyz_list, GaussTria* gauss, Input* vx_input, Input* vy_input){{{*/
+ void Tria::GetStrainRate2d(IssmDouble* epsilon,IssmDouble* xyz_list, GaussTria* gauss, Input* vx_input, Input* vy_input){
+ 	/*Compute the 2d Strain Rate (3 components):
+@@ -4325,139 +4281,6 @@
+ 	return Ke;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetSolutionFromInputsStressbalanceFS{{{*/
+-void  Tria::GetSolutionFromInputsStressbalanceFS(Vector<IssmDouble>* solution){
+-
+-	int*         vdoflist=NULL;
+-	int*         pdoflist=NULL;
+-	IssmDouble   vx,vy,p;
+-	IssmDouble   FSreconditioning;
+-	GaussTria   *gauss;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumnodes = this->NumberofNodesPressure();
+-	int vnumdof   = vnumnodes*NDOF2;
+-	int pnumdof   = pnumnodes*NDOF1;
+-
+-	/*Initialize values*/
+-	IssmDouble* vvalues = xNew<IssmDouble>(vnumdof);
+-	IssmDouble* pvalues = xNew<IssmDouble>(pnumdof);
+-
+-	/*Get dof list: */
+-	GetDofListVelocity(&vdoflist,GsetEnum);
+-	GetDofListPressure(&pdoflist,GsetEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum);       _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);       _assert_(vy_input);
+-	Input* p_input =inputs->GetInput(PressureEnum); _assert_(p_input);
+-
+-	this->parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+-
+-	/*Ok, we have vx vy vz in values, fill in vx vy vz arrays: */
+-	gauss = new GaussTria();
+-	for(int i=0;i<vnumnodes;i++){
+-		gauss->GaussNode(this->VelocityInterpolation(),i);
+-		vx_input->GetInputValue(&vx,gauss);
+-		vy_input->GetInputValue(&vy,gauss);
+-		vvalues[i*NDOF2+0]=vx;
+-		vvalues[i*NDOF2+1]=vy;
+-	}
+-	for(int i=0;i<pnumnodes;i++){
+-		gauss->GaussNode(this->PressureInterpolation(),i);
+-		p_input->GetInputValue(&p ,gauss);
+-		pvalues[i]=p/FSreconditioning;
+-	}
+-
+-	/*Add value to global vector*/
+-	solution->SetValues(vnumdof,vdoflist,vvalues,INS_VAL);
+-	solution->SetValues(pnumdof,pdoflist,pvalues,INS_VAL);
+-
+-	/*Free ressources:*/
+-	delete gauss;
+-	xDelete<int>(pdoflist);
+-	xDelete<int>(vdoflist);
+-	xDelete<IssmDouble>(pvalues);
+-	xDelete<IssmDouble>(vvalues);
+-}
+-/*}}}*/
+-/*FUNCTION Tria::GetSolutionFromInputsStressbalanceHoriz{{{*/
+-void  Tria::GetSolutionFromInputsStressbalanceHoriz(Vector<IssmDouble>* solution){
+-
+-	IssmDouble   vx,vy;
+-	int*         doflist = NULL;
+-	GaussTria*   gauss   = NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-	int numdof   = numnodes*NDOF2;
+-
+-	/*Fetch dof list and allocate solution vector*/
+-	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+-	IssmDouble* values = xNew<IssmDouble>(numdof);
+-
+-	/*Get inputs*/
+-	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+-
+-	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+-	gauss=new GaussTria();
+-	for(int i=0;i<numnodes;i++){
+-		gauss->GaussNode(this->element_type,i);
+-
+-		/*Recover vx and vy*/
+-		vx_input->GetInputValue(&vx,gauss);
+-		vy_input->GetInputValue(&vy,gauss);
+-		values[i*NDOF2+0]=vx;
+-		values[i*NDOF2+1]=vy;
+-	}
+-
+-	solution->SetValues(numdof,doflist,values,INS_VAL);
+-
+-	/*Free ressources:*/
+-	delete gauss;
+-	xDelete<IssmDouble>(values);
+-	xDelete<int>(doflist);
+-}
+-/*}}}*/
+-/*FUNCTION Tria::GetSolutionFromInputsStressbalanceSIA{{{*/
+-void  Tria::GetSolutionFromInputsStressbalanceSIA(Vector<IssmDouble>* solution){
+-
+-	const int    numdof=NDOF2*NUMVERTICES;
+-
+-	int        i;
+-	IssmDouble     vx,vy;
+-	IssmDouble     values[numdof];
+-	int       *doflist = NULL;
+-	GaussTria *gauss   = NULL;
+-
+-	/*Get dof list: */
+-	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+-
+-	/*Get inputs*/
+-	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+-
+-	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+-	/*P1 element only for now*/
+-	gauss=new GaussTria();
+-	for(i=0;i<NUMVERTICES;i++){
+-
+-		gauss->GaussVertex(i);
+-
+-		/*Recover vx and vy*/
+-		vx_input->GetInputValue(&vx,gauss);
+-		vy_input->GetInputValue(&vy,gauss);
+-		values[i*NDOF2+0]=vx;
+-		values[i*NDOF2+1]=vy;
+-	}
+-
+-	solution->SetValues(numdof,doflist,values,INS_VAL);
+-
+-	/*Free ressources:*/
+-	delete gauss;
+-	xDelete<int>(doflist);
+-}
+-/*}}}*/
+ /*FUNCTION Tria::GetYcoord {{{*/
+ IssmDouble Tria::GetYcoord(GaussTria* gauss){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16680)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16681)
+@@ -103,7 +103,6 @@
+ 		int         NumberofNodesVelocity(void);
+ 		int         NumberofNodesPressure(void);
+ 		bool        NoIceInElement();
+-		void        GetSolutionFromInputs(Vector<IssmDouble>* solution);
+ 		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
+ 		void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum);
+ 		void        InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);
+@@ -275,9 +274,6 @@
+ 		void           PVectorGLSstabilization(ElementVector* pe);
+ 		ElementVector* CreatePVectorStressbalanceFSShelf(void);
+ 		ElementMatrix* CreateJacobianStressbalanceSSA(void);
+-		void	         GetSolutionFromInputsStressbalanceFS(Vector<IssmDouble>* solution);
+-		void	         GetSolutionFromInputsStressbalanceHoriz(Vector<IssmDouble>* solution);
+-		void	         GetSolutionFromInputsStressbalanceSIA(Vector<IssmDouble>* solution);
+ 		IssmDouble     GetYcoord(GaussTria* gauss);
+ 		void	         InputUpdateFromSolutionStressbalanceHoriz( IssmDouble* solution);
+ 		void	         InputUpdateFromSolutionStressbalanceFS( IssmDouble* solution);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16680)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16681)
+@@ -1528,58 +1528,6 @@
+ 	for(int i=0;i<3;i++) normal[i]=normal[i]/norm;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetSolutionFromInputs{{{*/
+-void  Penta::GetSolutionFromInputs(Vector<IssmDouble>* solution){
+-
+-	int analysis_type;
+-
+-	/*retrive parameters: */
+-	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-
+-	/*Just branch to the correct InputUpdateFromSolution generator, according to the type of analysis we are carrying out: */
+-	switch(analysis_type){
+-	#ifdef _HAVE_STRESSBALANCE_
+-	case StressbalanceAnalysisEnum:
+-		int approximation;
+-		inputs->GetInputValue(&approximation,ApproximationEnum);
+-		if(approximation==FSApproximationEnum || approximation==NoneApproximationEnum){
+-			GetSolutionFromInputsStressbalanceFS(solution);
+-		}
+-		else if (approximation==SSAApproximationEnum || approximation==HOApproximationEnum || approximation==SIAApproximationEnum){
+-			GetSolutionFromInputsStressbalanceHoriz(solution);
+-		}
+-		else if (approximation==SSAHOApproximationEnum || approximation==HOFSApproximationEnum || approximation==SSAFSApproximationEnum){
+-			return; //the elements around will create the solution
+-		}
+-		break;
+-	case StressbalanceSIAAnalysisEnum:
+-		GetSolutionFromInputsStressbalanceSIA(solution);
+-		break;
+-	case StressbalanceVerticalAnalysisEnum:
+-		GetSolutionFromInputsOneDof(solution, VzEnum);
+-		break;
+-	#endif
+-	#ifdef _HAVE_THERMAL_
+-	case ThermalAnalysisEnum:
+-		GetSolutionFromInputsOneDof(solution, TemperatureEnum);
+-		break;
+-	case EnthalpyAnalysisEnum:
+-		GetSolutionFromInputsOneDof(solution, EnthalpyEnum);
+-		break;
+-	#endif
+-	#ifdef _HAVE_HYDROLOGY_
+-	case HydrologyDCInefficientAnalysisEnum:
+-		GetSolutionFromInputsOneDof(solution, SedimentHeadEnum);
+-		break;
+-	case HydrologyDCEfficientAnalysisEnum:
+-		GetSolutionFromInputsOneDof(solution, EplHeadEnum);
+-		break;
+-  #endif
+-	default:
+-		_error_("analysis: " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet");
+-	}
+-}
+-/*}}}*/
+ /*FUNCTION Penta::GetStabilizationParameter {{{*/
+ IssmDouble Penta::GetStabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa){
+ 	/*Compute stabilization parameter*/
+@@ -9704,141 +9652,6 @@
+ 	return Ke;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetSolutionFromInputsStressbalanceHoriz{{{*/
+-void  Penta::GetSolutionFromInputsStressbalanceHoriz(Vector<IssmDouble>* solution){
+-
+-	int         approximation;
+-	int        *doflist = NULL;
+-	IssmDouble  vx,vy;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-	int numdof   = numnodes*NDOF2;
+-
+-	/*Get approximation enum and dof list: */
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+-
+-	/*Fetch dof list and allocate solution vectors*/
+-	GetDofList(&doflist,approximation,GsetEnum);
+-	IssmDouble* values = xNew<IssmDouble>(numdof);
+-
+-	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+-	GaussPenta* gauss=new GaussPenta();
+-	for(int i=0;i<numnodes;i++){
+-		gauss->GaussNode(this->element_type,i);
+-
+-		/*Recover vx and vy*/
+-		vx_input->GetInputValue(&vx,gauss);
+-		vy_input->GetInputValue(&vy,gauss);
+-		values[i*NDOF2+0]=vx;
+-		values[i*NDOF2+1]=vy;
+-	}
+-
+-	/*Add value to global vector*/
+-	solution->SetValues(numdof,doflist,values,INS_VAL);
+-
+-	/*Free ressources:*/
+-	delete gauss;
+-	xDelete<IssmDouble>(values);
+-	xDelete<int>(doflist);
+-}
+-/*}}}*/
+-/*FUNCTION Penta::GetSolutionFromInputsStressbalanceSIA{{{*/
+-void  Penta::GetSolutionFromInputsStressbalanceSIA(Vector<IssmDouble>* solution){
+-
+-	const int    numdof=NDOF2*NUMVERTICES;
+-
+-	int          i;
+-	int*         doflist=NULL;
+-	IssmDouble       vx,vy;
+-	IssmDouble       values[numdof];
+-	GaussPenta*  gauss=NULL;
+-
+-	/*Get dof list: */
+-	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+-
+-	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+-	/*P1 element only for now*/
+-	gauss=new GaussPenta();
+-	for(i=0;i<NUMVERTICES;i++){
+-		/*Recover vx and vy*/
+-		gauss->GaussVertex(i);
+-		vx_input->GetInputValue(&vx,gauss);
+-		vy_input->GetInputValue(&vy,gauss);
+-		values[i*NDOF2+0]=vx;
+-		values[i*NDOF2+1]=vy;
+-	}
+-
+-	/*Add value to global vector*/
+-	solution->SetValues(numdof,doflist,values,INS_VAL);
+-
+-	/*Free ressources:*/
+-	delete gauss;
+-	xDelete<int>(doflist);
+-}
+-/*}}}*/
+-/*FUNCTION Penta::GetSolutionFromInputsStressbalanceFS{{{*/
+-void  Penta::GetSolutionFromInputsStressbalanceFS(Vector<IssmDouble>* solution){
+-
+-	int*         vdoflist=NULL;
+-	int*         pdoflist=NULL;
+-	IssmDouble   vx,vy,vz,p;
+-	IssmDouble   FSreconditioning;
+-	GaussPenta  *gauss;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumnodes = this->NumberofNodesPressure();
+-	int vnumdof   = vnumnodes*NDOF3;
+-	int pnumdof   = pnumnodes*NDOF1;
+-
+-	/*Initialize values*/
+-	IssmDouble* vvalues = xNew<IssmDouble>(vnumdof);
+-	IssmDouble* pvalues = xNew<IssmDouble>(pnumdof);
+-
+-	/*Get dof list: */
+-	GetDofListVelocity(&vdoflist,GsetEnum);
+-	GetDofListPressure(&pdoflist,GsetEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum);       _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);       _assert_(vy_input);
+-	Input* vz_input=inputs->GetInput(VzEnum);       _assert_(vz_input);
+-	Input* p_input =inputs->GetInput(PressureEnum); _assert_(p_input);
+-
+-	this->parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+-
+-	/*Ok, we have vx vy vz in values, fill in vx vy vz arrays: */
+-	gauss = new GaussPenta();
+-	for(int i=0;i<vnumnodes;i++){
+-		gauss->GaussNode(this->VelocityInterpolation(),i);
+-		vx_input->GetInputValue(&vx,gauss);
+-		vy_input->GetInputValue(&vy,gauss);
+-		vz_input->GetInputValue(&vz,gauss);
+-		vvalues[i*NDOF3+0]=vx;
+-		vvalues[i*NDOF3+1]=vy;
+-		vvalues[i*NDOF3+2]=vz;
+-	}
+-	for(int i=0;i<pnumnodes;i++){
+-		gauss->GaussNode(this->PressureInterpolation(),i);
+-		p_input ->GetInputValue(&p ,gauss);
+-		pvalues[i]=p/FSreconditioning;
+-	}
+-
+-	/*Add value to global vector*/
+-	solution->SetValues(vnumdof,vdoflist,vvalues,INS_VAL);
+-	solution->SetValues(pnumdof,pdoflist,pvalues,INS_VAL);
+-
+-	/*Free ressources:*/
+-	delete gauss;
+-	xDelete<int>(pdoflist);
+-	xDelete<int>(vdoflist);
+-	xDelete<IssmDouble>(pvalues);
+-	xDelete<IssmDouble>(vvalues);
+-}
+-/*}}}*/
+ /*FUNCTION Penta::GetL1L2Viscosity{{{*/
+ void Penta::GetL1L2Viscosity(IssmDouble* pviscosity,IssmDouble* xyz_list, GaussPenta* gauss, Input* vx_input, Input* vy_input,Input* surface_input){
+ 	/*Compute the L1L2 viscosity
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16680)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16681)
+@@ -90,7 +90,6 @@
+ 		void   GetNodesSidList(int* sidlist);
+ 		void   GetNodesLidList(int* lidlist);
+ 		int    GetNumberOfNodes(void);
+-		void   GetSolutionFromInputs(Vector<IssmDouble>* solution);
+ 		void   GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
+ 		IssmDouble GetZcoord(GaussPenta* gauss);
+ 		void   GetVectorFromInputs(Vector<IssmDouble>* vector,int name_enum);
+@@ -283,9 +282,6 @@
+ 		void           InputUpdateFromSolutionStressbalanceSIA( IssmDouble* solutiong);
+ 		void           InputUpdateFromSolutionStressbalanceVert( IssmDouble* solutiong);
+ 		void           InputUpdateFromSolutionStressbalanceFS( IssmDouble* solutiong);
+-		void	         GetSolutionFromInputsStressbalanceHoriz(Vector<IssmDouble>* solutiong);
+-		void	         GetSolutionFromInputsStressbalanceSIA(Vector<IssmDouble>* solutiong);
+-		void	         GetSolutionFromInputsStressbalanceFS(Vector<IssmDouble>* solutiong);
+ 		ElementVector* CreatePVectorCouplingSSAFS(void);
+ 		ElementVector* CreatePVectorCouplingSSAFSViscous(void);
+ 		ElementVector* CreatePVectorCouplingSSAFSFriction(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16680)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16681)
+@@ -117,7 +117,6 @@
+ 		void    HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask){_error_("not implemented yet");};
+ 		void    ComputeEPLThickness(void){_error_("not implemented yet");};
+ 		#endif
+-		void        GetSolutionFromInputs(Vector<IssmDouble>* solution){_error_("not implemented yet");};
+ 		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type){_error_("not implemented yet");};
+ 		void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum){_error_("not implemented yet");};
+ 		void        InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16681-16682.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16681-16682.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16681-16682.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16681)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16682)
+@@ -813,7 +813,7 @@
+ 			GetSolutionFromInputsHoriz(solution,element);
+ 			return;
+ 		case L1L2ApproximationEnum:
+-//			GetSolutionFromInputsHoriz(solution,element);
++			GetSolutionFromInputsHoriz(solution,element);
+ 			return;
+ 		case SSAHOApproximationEnum: case HOFSApproximationEnum: case SSAFSApproximationEnum:
+ 			/*the elements around will create the solution*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16682-16683.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16682-16683.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16682-16683.diff	(revision 17802)
@@ -0,0 +1,4 @@
+Index: ../trunk-jpl/test/Archives/Archive434.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-16683-16684.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16683-16684.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16683-16684.diff	(revision 17802)
@@ -0,0 +1,571 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h	(revision 16684)
+@@ -18,5 +18,6 @@
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 16684)
+@@ -84,3 +84,6 @@
+ void HydrologyShreveAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,WatercolumnEnum);
+ }/*}}}*/
++void HydrologyShreveAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp	(revision 16684)
+@@ -28,3 +28,6 @@
+ void BalancethicknessSoftAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
++void BalancethicknessSoftAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16684)
+@@ -18,6 +18,7 @@
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ 		void GetSolutionFromInputsFS(Vector<IssmDouble>* solution,Element* element);
+ 		void GetSolutionFromInputsHoriz(Vector<IssmDouble>* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 16684)
+@@ -18,5 +18,6 @@
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 16684)
+@@ -116,3 +116,6 @@
+ void BalancethicknessAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
++void BalancethicknessAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.h	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.h	(revision 16684)
+@@ -18,5 +18,6 @@
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 16684)
+@@ -109,3 +109,6 @@
+ void HydrologyDCEfficientAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,EplHeadEnum);
+ }/*}}}*/
++void HydrologyDCEfficientAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h	(revision 16684)
+@@ -18,5 +18,6 @@
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 16684)
+@@ -28,3 +28,6 @@
+ void AdjointHorizAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
++void AdjointHorizAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 16684)
+@@ -61,3 +61,6 @@
+ void BalancevelocityAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
++void BalancevelocityAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/MeltingAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeltingAnalysis.h	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/MeltingAnalysis.h	(revision 16684)
+@@ -18,5 +18,6 @@
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/GiaAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/GiaAnalysis.h	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/GiaAnalysis.h	(revision 16684)
+@@ -18,5 +18,6 @@
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 16684)
+@@ -57,3 +57,6 @@
+ void L2ProjectionBaseAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
++void L2ProjectionBaseAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 16684)
+@@ -90,3 +90,6 @@
+ void FreeSurfaceTopAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
++void FreeSurfaceTopAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h	(revision 16684)
+@@ -18,5 +18,6 @@
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 16684)
+@@ -98,3 +98,6 @@
+ void StressbalanceVerticalAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,VzEnum);
+ }/*}}}*/
++void StressbalanceVerticalAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/Analysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/Analysis.h	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/Analysis.h	(revision 16684)
+@@ -27,5 +27,6 @@
+ 		virtual void CreateLoads(Loads* loads, IoModel* iomodel)=0;
+ 
+ 		virtual void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element)=0;
++		virtual void InputUpdateFromSolution(IssmDouble* solution,Element* element)=0;
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h	(revision 16684)
+@@ -18,5 +18,6 @@
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 16684)
+@@ -166,3 +166,6 @@
+ 	xDelete<int>(doflist);
+ 	xDelete<IssmDouble>(values);
+ }/*}}}*/
++void StressbalanceSIAAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h	(revision 16684)
+@@ -18,5 +18,6 @@
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16684)
+@@ -928,3 +928,6 @@
+ 	xDelete<IssmDouble>(values);
+ 	xDelete<int>(doflist);
+ }/*}}}*/
++void StressbalanceAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h	(revision 16684)
+@@ -18,5 +18,6 @@
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h	(revision 16684)
+@@ -18,5 +18,6 @@
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h	(revision 16684)
+@@ -18,5 +18,6 @@
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h	(revision 16684)
+@@ -18,5 +18,6 @@
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16684)
+@@ -139,3 +139,6 @@
+ void HydrologyDCInefficientAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,SedimentHeadEnum);
+ }/*}}}*/
++void HydrologyDCInefficientAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16684)
+@@ -114,3 +114,6 @@
+ void ThermalAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,TemperatureEnum);
+ }/*}}}*/
++void ThermalAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h	(revision 16684)
+@@ -18,5 +18,6 @@
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h	(revision 16684)
+@@ -18,5 +18,6 @@
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 16684)
+@@ -39,3 +39,6 @@
+ void ExtrudeFromBaseAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
++void ExtrudeFromBaseAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 16684)
+@@ -74,3 +74,6 @@
+ void MeltingAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
++void MeltingAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/GiaAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/GiaAnalysis.cpp	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/GiaAnalysis.cpp	(revision 16684)
+@@ -40,3 +40,6 @@
+ void GiaAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
++void GiaAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h	(revision 16684)
+@@ -18,5 +18,6 @@
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h	(revision 16684)
+@@ -18,5 +18,6 @@
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h	(revision 16684)
+@@ -18,5 +18,6 @@
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 16684)
+@@ -18,5 +18,6 @@
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h	(revision 16684)
+@@ -18,5 +18,6 @@
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h	(revision 16684)
+@@ -18,5 +18,6 @@
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 16684)
+@@ -28,3 +28,6 @@
+ void AdjointBalancethicknessAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	_error_("not implemented yet");
+ }/*}}}*/
++void AdjointBalancethicknessAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h	(revision 16684)
+@@ -18,5 +18,6 @@
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/EnumToAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnumToAnalysis.h	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/EnumToAnalysis.h	(revision 16684)
+@@ -13,3 +13,4 @@
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16684)
+@@ -214,3 +214,6 @@
+ void MasstransportAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
++void MasstransportAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h	(revision 16684)
+@@ -18,5 +18,6 @@
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 16684)
+@@ -97,3 +97,6 @@
+ void DamageEvolutionAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
++void DamageEvolutionAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16684)
+@@ -186,3 +186,6 @@
+ void EnthalpyAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,EnthalpyEnum);
+ }/*}}}*/
++void EnthalpyAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp	(revision 16684)
+@@ -28,3 +28,6 @@
+ void MeshdeformationAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
++void MeshdeformationAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 16684)
+@@ -92,3 +92,6 @@
+ void FreeSurfaceBaseAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
++void FreeSurfaceBaseAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 16684)
+@@ -47,3 +47,6 @@
+ void SmoothedSurfaceSlopeXAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
++void SmoothedSurfaceSlopeXAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 16684)
+@@ -39,3 +39,6 @@
+ void ExtrudeFromTopAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
++void ExtrudeFromTopAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 16684)
+@@ -47,3 +47,6 @@
+ void SmoothedSurfaceSlopeYAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
++void SmoothedSurfaceSlopeYAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h	(revision 16683)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h	(revision 16684)
+@@ -18,5 +18,6 @@
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+ #endif
Index: issm/oecreview/Archive/16554-17801/ISSM-16684-16685.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16684-16685.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16684-16685.diff	(revision 17802)
@@ -0,0 +1,716 @@
+Index: ../trunk-jpl/src/c/analyses/EnumToAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnumToAnalysis.cpp	(revision 16684)
++++ ../trunk-jpl/src/c/analyses/EnumToAnalysis.cpp	(revision 16685)
+@@ -19,6 +19,7 @@
+ 		case BalancethicknessSoftAnalysisEnum : return new BalancethicknessSoftAnalysis();
+ 		case BalancevelocityAnalysisEnum : return new BalancevelocityAnalysis();
+ 		case L2ProjectionBaseAnalysisEnum : return new L2ProjectionBaseAnalysis();
++		case L2ProjectionEPLAnalysisEnum : return new L2ProjectionEPLAnalysis();
+ 		case DamageEvolutionAnalysisEnum : return new DamageEvolutionAnalysis();
+ 		case StressbalanceAnalysisEnum : return new StressbalanceAnalysis();
+ 		case StressbalanceSIAAnalysisEnum : return new StressbalanceSIAAnalysis();
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h	(revision 0)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h	(revision 16685)
+@@ -0,0 +1,22 @@
++/*! \file L2ProjectionEPLAnalysis.h 
++ *  \brief: header file for generic external result object
++ */
++
++#ifndef _L2ProjectionEPLAnalysis_
++#define _L2ProjectionEPLAnalysis_
++
++/*Headers*/
++#include "./Analysis.h"
++
++class L2ProjectionEPLAnalysis: public Analysis{
++
++	public:
++		int  DofsPerNode(int** doflist,int meshtype,int approximation);
++		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
++		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
++		void CreateNodes(Nodes* nodes,IoModel* iomodel);
++		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
++		void CreateLoads(Loads* loads, IoModel* iomodel);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++};
++#endif
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 0)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 16685)
+@@ -0,0 +1,55 @@
++#include "./L2ProjectionEPLAnalysis.h"
++#include "../toolkits/toolkits.h"
++#include "../classes/classes.h"
++#include "../shared/shared.h"
++#include "../modules/modules.h"
++
++/*Model processing*/
++int  L2ProjectionEPLAnalysis::DofsPerNode(int** doflist,int meshtype,int approximation){/*{{{*/
++	return 1;
++}/*}}}*/
++void L2ProjectionEPLAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
++}/*}}}*/
++void L2ProjectionEPLAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
++
++	/*Update elements: */
++	int counter=0;
++	for(int i=0;i<iomodel->numberofelements;i++){
++		if(iomodel->my_elements[i]){
++			Element* element=(Element*)elements->GetObjectByOffset(counter);
++			element->Update(i,iomodel,analysis_counter,analysis_type,P1Enum);
++			counter++;
++		}
++	}
++
++	iomodel->FetchDataToInput(elements,EplHeadEnum);
++	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
++	if(iomodel->meshtype==Mesh3DEnum){
++		iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
++	}
++}/*}}}*/
++void L2ProjectionEPLAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
++
++	if(iomodel->meshtype==Mesh3DEnum){
++		iomodel->FetchData(1,MeshVertexonbedEnum);
++	}
++	else if(iomodel->meshtype==Mesh2DverticalEnum){
++		iomodel->FetchData(1,MeshVertexonbedEnum);
++	}
++	::CreateNodes(nodes,iomodel,L2ProjectionEPLAnalysisEnum,P1Enum);
++	iomodel->DeleteData(1,MeshVertexonbedEnum);
++}/*}}}*/
++void L2ProjectionEPLAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
++
++	/*No constraints*/
++}/*}}}*/
++void L2ProjectionEPLAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
++
++	/*No loads*/
++}/*}}}*/
++
++/*Numerics*/
++void L2ProjectionEPLAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	   _error_("not implemented yet");
++}/*}}}*/
++
+Index: ../trunk-jpl/src/c/analyses/analyses.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/analyses.h	(revision 16684)
++++ ../trunk-jpl/src/c/analyses/analyses.h	(revision 16685)
+@@ -31,7 +31,7 @@
+ #include "./StressbalanceSIAAnalysis.h"
+ #include "./StressbalanceVerticalAnalysis.h"
+ #include "./L2ProjectionBaseAnalysis.h"
++#include "./L2ProjectionEPLAnalysis.h"
+ #include "./ThermalAnalysis.h"
+-
+-#include "EnumToAnalysis.h"
++#include "./EnumToAnalysis.h"
+ #endif
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16684)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16685)
+@@ -45,6 +45,7 @@
+ 	femmodel->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);
+ 	femmodel->parameters->FindParam(&eps_hyd,HydrologydcRelTolEnum);
+ 	femmodel->parameters->FindParam(&time,TimeEnum);
++	/*FIXME, hardcoded, put on an enum*/
+ 	hydro_maxiter=150;
+ 	hydrocount=1;
+ 	hydroconverged=false;
+@@ -97,6 +98,8 @@
+ 				if(VerboseConvergence()) _printf0_("   # Sediment unstable constraints = " << num_unstable_constraints << "\n");
+ 				if(num_unstable_constraints==0) sedconverged = true;
+ 				if (sedcount>=hydro_maxiter){
++					/*Hacking to get the results of non converged runs*/
++					//					sedconverged = true;
+ 					_error_("   maximum number of Sediment iterations (" << hydro_maxiter << ") exceeded");
+ 				}
+ 			}
+@@ -115,12 +118,12 @@
+ 		if(isefficientlayer){
+ 
+ 			/*Start by retrieving the EPL head slopes*/
+-			if(VerboseSolution()) _printf0_("computing EPL Head slope...\n");
+-			femmodel->SetCurrentConfiguration(L2ProjectionBaseAnalysisEnum);
+-			femmodel->parameters->SetParam(EplHeadSlopeXEnum,InputToL2ProjectEnum);
+-			solutionsequence_linear(femmodel);
+-			femmodel->parameters->SetParam(EplHeadSlopeYEnum,InputToL2ProjectEnum);
+-			solutionsequence_linear(femmodel);
++			/* if(VerboseSolution()) _printf0_("computing EPL Head slope...\n"); */
++			/* femmodel->SetCurrentConfiguration(L2ProjectionEPLAnalysisEnum); */
++			/* femmodel->parameters->SetParam(EplHeadSlopeXEnum,InputToL2ProjectEnum); */
++			/* solutionsequence_linear(femmodel); */
++			/* femmodel->parameters->SetParam(EplHeadSlopeYEnum,InputToL2ProjectEnum); */
++			/* solutionsequence_linear(femmodel); */
+ 			
+ 			femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
+ 			InputUpdateFromConstantx(femmodel,true,ResetPenaltiesEnum);
+@@ -133,7 +136,20 @@
+ 			/*Iteration on the EPL layer*/
+ 			eplconverged = false;
+ 			for(;;){
++
++			/*Start by retrieving the EPL head slopes*/
++				if(VerboseSolution()) _printf0_("computing EPL Head slope...\n");
++				femmodel->SetCurrentConfiguration(L2ProjectionEPLAnalysisEnum);
++				femmodel->UpdateConstraintsL2ProjectionEPLx();
++				femmodel->parameters->SetParam(EplHeadSlopeXEnum,InputToL2ProjectEnum);
++				solutionsequence_linear(femmodel);
++				femmodel->parameters->SetParam(EplHeadSlopeYEnum,InputToL2ProjectEnum);
++				solutionsequence_linear(femmodel);
++				femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
++
+ 				femmodel->HydrologyEPLThicknessx();
++				//updating mask after the computation of the epl thickness
++				femmodel->HydrologyEPLupdateDomainx();
+ 				femmodel->HydrologyTransferx();
+ 				SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
+ 				CreateNodalConstraintsx(&ys,femmodel->nodes,HydrologyDCEfficientAnalysisEnum);
+@@ -154,6 +170,8 @@
+ 					if(VerboseConvergence()) _printf0_("   # EPL unstable constraints = " << num_unstable_constraints << "\n");
+ 					if(num_unstable_constraints==0) eplconverged = true;
+ 					if (eplcount>=hydro_maxiter){
++					/*Hacking to get the results of non converged runs*/
++					//eplconverged = true;
+ 						_error_("   maximum number of EPL iterations (" << hydro_maxiter << ") exceeded");
+ 					}
+ 				}
+@@ -213,7 +231,9 @@
+ 			}
+ 			else _printf0_(setw(50) << left << "   Convergence criterion:" << ndu_sed/nu_sed*100 << " %\n");
+ 			if (hydrocount>=hydro_maxiter){
+-				_error_("   maximum number for hydrological global iterations (" << hydro_maxiter << ") exceeded");
++					/*Hacking to get the results of non converged runs*/
++					//hydroconverged = true;
++					_error_("   maximum number for hydrological global iterations (" << hydro_maxiter << ") exceeded");
+ 			}
+ 		}
+ 		hydrocount++;
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 16684)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 16685)
+@@ -464,6 +464,8 @@
+ 							./analyses/HydrologyDCInefficientAnalysis.cpp\
+ 							./analyses/HydrologyShreveAnalysis.h\
+ 							./analyses/HydrologyShreveAnalysis.cpp\
++							./analyses/L2ProjectionEPLAnalysis.h\
++					  	./analyses/L2ProjectionEPLAnalysis.cpp\
+ 							./cores/hydrology_core.cpp\
+ 							./solutionsequences/solutionsequence_hydro_nonlinear.cpp
+ #}}}
+Index: ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp	(revision 16684)
++++ ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp	(revision 16685)
+@@ -55,12 +55,13 @@
+ 			break;
+ 
+ 		case HydrologySolutionEnum:
+-			numanalyses=4;
++			numanalyses=5;
+ 			analyses=xNew<int>(numanalyses);
+ 			analyses[0]=HydrologyShreveAnalysisEnum;
+ 			analyses[1]=HydrologyDCInefficientAnalysisEnum;
+ 			analyses[2]=HydrologyDCEfficientAnalysisEnum;
+ 			analyses[3]=L2ProjectionBaseAnalysisEnum;
++			analyses[4]=L2ProjectionEPLAnalysisEnum;
+ 			break;
+ 
+ 		case MasstransportSolutionEnum:
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 16684)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 16685)
+@@ -260,9 +260,9 @@
+ 	 * analysis_type to drive the element numerics. This allows for use of 1 configuration_type for several 
+ 	 * analyses. For example: do a SurfaceSlopeX, SurfaceSlopeY, BedSlopeX and BedSlopeY analysis using the 
+ 	 * Slope configuration.*/
+-
+ 	int found=-1;
+ 	for(int i=0;i<nummodels;i++){
++	
+ 		if (analysis_type_list[i]==configuration_type){
+ 			found=i;
+ 			break;
+@@ -1419,4 +1419,13 @@
+ 	}
+ }
+ /*}}}*/
+-#endif
++
++void FemModel::UpdateConstraintsL2ProjectionEPLx(void){ /*{{{*/
++
++	for(int i=0;i<elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
++		element->UpdateConstraintsL2ProjectionEPL();
++	}
++
++}
++/*}}}*/#endif
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16684)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16685)
+@@ -153,6 +153,7 @@
+ 		virtual void HydrologyEPLGetMask(Vector<IssmDouble>* mask)=0;
+ 		virtual void HydrologyEPLGetActive(Vector<IssmDouble>* active)=0;
+ 		virtual void ComputeEPLThickness(void)=0;
++		virtual void UpdateConstraintsL2ProjectionEPL(void)=0;
+ 		#endif
+ 
+ 		#ifdef _HAVE_GROUNDINGLINE_
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16684)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16685)
+@@ -288,6 +288,9 @@
+ 		case HydrologyDCEfficientAnalysisEnum:
+ 			return CreateKMatrixHydrologyDCEfficient();
+ 			break;
++	  case L2ProjectionEPLAnalysisEnum:
++			return CreateEPLDomainMassMatrix();
++			break;
+ 		#endif
+ 		#ifdef _HAVE_BALANCED_
+ 		case BalancethicknessAnalysisEnum:
+@@ -512,6 +515,9 @@
+ 		case HydrologyDCEfficientAnalysisEnum:
+ 			return CreatePVectorHydrologyDCEfficient();
+ 			break;
++	  case L2ProjectionEPLAnalysisEnum:
++			return CreatePVectorL2ProjectionEPL();
++			break;
+ 		#endif
+ 		#ifdef _HAVE_BALANCED_
+ 		case BalancethicknessAnalysisEnum:
+@@ -585,8 +591,6 @@
+ 		case SurfaceSlopeYEnum: input2 = inputs->GetInput(SurfaceEnum); _assert_(input2); break;
+ 		case BedSlopeXEnum:     input2 = inputs->GetInput(BedEnum);     _assert_(input2); break;
+ 		case BedSlopeYEnum:     input2 = inputs->GetInput(BedEnum);     _assert_(input2); break;
+-		case EplHeadSlopeXEnum: input2 = inputs->GetInput(EplHeadEnum); _assert_(input2); break;
+-		case EplHeadSlopeYEnum: input2 = inputs->GetInput(EplHeadEnum); _assert_(input2); break;
+ 		default: input = inputs->GetInput(input_enum);
+ 	}
+ 
+@@ -601,8 +605,8 @@
+ 
+ 		if(input2) input2->GetInputDerivativeValue(&slopes[0],&xyz_list[0][0],gauss);
+ 		switch(input_enum){
+-			case SurfaceSlopeXEnum: case BedSlopeXEnum: case EplHeadSlopeXEnum: value = slopes[0]; break;
+-			case SurfaceSlopeYEnum: case BedSlopeYEnum: case EplHeadSlopeYEnum: value = slopes[1]; break;
++			case SurfaceSlopeXEnum: case BedSlopeXEnum: value = slopes[0]; break;
++			case SurfaceSlopeYEnum: case BedSlopeYEnum: value = slopes[1]; break;
+ 			default: input->GetInputValue(&value,gauss);
+ 		}
+ 
+@@ -1783,6 +1787,10 @@
+ 		case HydrologyDCEfficientAnalysisEnum:
+ 			InputUpdateFromSolutionOneDof(solution,EplHeadEnum);
+ 			break;
++		case L2ProjectionEPLAnalysisEnum:
++			this->parameters->FindParam(&extrusioninput,InputToL2ProjectEnum);
++			InputUpdateFromSolutionOneDof(solution,extrusioninput);
++			break;
+ 		#endif
+ 	 	#ifdef _HAVE_DAMAGE_
+ 		case DamageEvolutionAnalysisEnum:
+@@ -2900,7 +2908,17 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Tria::UpdateConstraintsL2ProjectionEPL{{{*/
++void  Tria::UpdateConstraintsL2ProjectionEPL(void){
+ 
++	IssmDouble activeEpl[NUMVERTICES];
++ 
++	GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveEnum);
++	for(int i=0;i<NUMVERTICES;i++){
++		if(!activeEpl[i])this->nodes[i]->Deactivate();
++	}
++}
++/*}}}*/
+ #ifdef _HAVE_RESPONSES_
+ /*FUNCTION Tria::AverageOntoPartition {{{*/
+ void  Tria::AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part){
+@@ -6682,6 +6700,46 @@
+ 	return Ke;
+ }
+ /*}}}*/
++
++/*FUNCTION Tria::CreatEPLDomainMassMatrix {{{*/
++ElementMatrix* Tria::CreateEPLDomainMassMatrix(void){
++
++	/* Intermediaries */
++	IssmDouble  D,Jdet;
++	IssmDouble  xyz_list[NUMVERTICES][3];
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = this->NumberofNodes();
++
++	/*Initialize Element matrix and vectors*/
++	ElementMatrix* Ke    = new ElementMatrix(nodes,numnodes,this->parameters,NoneApproximationEnum);
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++
++	/* Start looping on the number of gaussian points: */
++	GaussTria* gauss=new GaussTria(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++
++		GetNodalFunctions(basis,gauss);
++		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
++		D=gauss->weight*Jdet;
++
++		TripleMultiply(basis,1,numnodes,1,
++					&D,1,1,0,
++					basis,1,numnodes,0,
++					&Ke->values[0],1);
++	}
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<IssmDouble>(basis);
++	return Ke;
++}
++/*}}}*/
+ /*FUNCTION Tria::CreatePVectorHydrologyShreve {{{*/
+ ElementVector* Tria::CreatePVectorHydrologyShreve(void){
+ 
+@@ -6707,7 +6765,6 @@
+ 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	Input* basal_melting_input=inputs->GetInput(BasalforcingsMeltingRateEnum); _assert_(basal_melting_input);
+ 	Input* old_watercolumn_input=inputs->GetInput(WaterColumnOldEnum);         _assert_(old_watercolumn_input);
+-
+ 	/*Initialize basal_melting_correction_g to 0, do not forget!:*/
+ 	/* Start  looping on the number of gaussian points: */
+ 	GaussTria* gauss=new GaussTria(2);
+@@ -6871,6 +6928,58 @@
+ 	return pe;
+ }
+ /*}}}*/
++/*FUNCTION Tria::CreatePVectorL2ProjectionEPL {{{*/
++ElementVector* Tria::CreatePVectorL2ProjectionEPL(void){
++
++	/*Intermediaries */
++	int        i,input_enum;
++	IssmDouble Jdet,value;
++	IssmDouble xyz_list[NUMVERTICES][3];
++	IssmDouble slopes[2];
++	Input*     input  = NULL;
++	Input*     input2 = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = this->NumberofNodes();
++
++	/*Initialize Element vector*/
++	ElementVector* pe    = new ElementVector(nodes,numnodes,this->parameters);
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	this->parameters->FindParam(&input_enum,InputToL2ProjectEnum);
++	switch(input_enum){
++		case EplHeadSlopeXEnum: input2 = inputs->GetInput(SurfaceEnum); _assert_(input2); break;
++		case EplHeadSlopeYEnum: input2 = inputs->GetInput(SurfaceEnum); _assert_(input2); break;
++	default: input = inputs->GetInput(input_enum);
++	}
++
++	/* Start  looping on the number of gaussian points: */
++	GaussTria* gauss=new GaussTria(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++
++		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
++		GetNodalFunctions(basis,gauss);
++
++		if(input2) input2->GetInputDerivativeValue(&slopes[0],&xyz_list[0][0],gauss);
++		switch(input_enum){
++			case EplHeadSlopeXEnum: value = slopes[0]; break;
++			case EplHeadSlopeYEnum: value = slopes[1]; break;
++			default: input->GetInputValue(&value,gauss);
++		}
++
++		for(i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*value*basis[i];
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	return pe;
++}
++/*}}}*/
+ /*FUNCTION Tria::GetSolutionFromInputsOneDof{{{*/
+ void  Tria::GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution, int enum_type){
+ 
+@@ -7126,12 +7235,14 @@
+ 	const int   numdof         = NDOF1 *NUMVERTICES;
+ 	IssmDouble  h_max;
+ 	IssmDouble  sedheadmin;
++	IssmDouble  epl_thickness[numdof];
+ 	IssmDouble  old_active[numdof];
+ 	IssmDouble  sedhead[numdof];
+ 	IssmDouble  eplhead[numdof];
+ 	IssmDouble  residual[numdof];
+ 
+ 	GetInputListOnVertices(&old_active[0],HydrologydcMaskEplactiveEnum);	
++	GetInputListOnVertices(&epl_thickness[0],HydrologydcEplThicknessEnum);	
+ 	GetInputListOnVertices(&sedhead[0],SedimentHeadEnum);
+ 	GetInputListOnVertices(&eplhead[0],EplHeadEnum);
+ 	GetInputListOnVertices(&residual[0],SedimentHeadResidualEnum);
+@@ -7148,9 +7259,13 @@
+ 
+ 		/*If mask was alread one, keep one*/
+ 		else if(old_active[i]>0.){
+-			vec_mask->SetValue(nodes[i]->Sid(),1.,INS_VAL);
++			if(epl_thickness[i]>0.0){
++				vec_mask->SetValue(nodes[i]->Sid(),1.,INS_VAL);
++			}
++			else{
++				vec_mask->SetValue(nodes[i]->Sid(),0.,INS_VAL);
++			}
+ 		}
+-
+ 		/*Increase of the efficient system is needed if the epl head reach the maximum value (sediment max value for now)*/
+ 		this->GetHydrologyDCInefficientHmax(&h_max,nodes[i]);
+ 		if(eplhead[i]>=h_max && this->AnyActive()){
+@@ -7216,13 +7331,13 @@
+ 
+ 				/*Compute first the effective pressure in the EPL*/
+ 				EPL_N=gravity*((rho_ice*ice_thickness[i])-(rho_water*(eplhead[i]-bed[i])));
+-				
++				if(EPL_N<0.0)EPL_N=0.0;
+ 				/*Get then the gradient of EPL heads*/
+ 				EPLgrad = epl_slopeX[i]+epl_slopeY[i];
+ 				
+ 				/*And proceed to the real thing*/
+-				thickness[i] = old_thickness[i]*(1-((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*pow(EPLgrad,2.0)-2.0*(A*dt/(pow(n,n)))*EPL_N);
+-
++				thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*pow(EPLgrad,2.0)-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
++				if(this->nodes[i]->id==1553)printf("term1  %e, term2 %e\n",+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*pow(EPLgrad,2.0), -2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
+ 			}
+ 		}
+ 		this->inputs->AddInput(new TriaInput(HydrologydcEplThicknessEnum,thickness,P1Enum));
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16684)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16685)
+@@ -300,22 +300,25 @@
+ 		ElementMatrix* CreateKMatrixHydrologyShreve(void);
+ 		ElementMatrix* CreateKMatrixHydrologyDCInefficient(void);
+ 		ElementMatrix* CreateKMatrixHydrologyDCEfficient(void);
++		ElementMatrix* CreateEPLDomainMassMatrix(void);
+ 		ElementVector* CreatePVectorHydrologyShreve(void);
+ 		ElementVector* CreatePVectorHydrologyDCInefficient(void);
+ 		ElementVector* CreatePVectorHydrologyDCEfficient(void);
+-		void    CreateHydrologyWaterVelocityInput(void);
+-		void	  InputUpdateFromSolutionHydrology(IssmDouble* solution);
+-		void	  InputUpdateFromSolutionHydrologyShreve(IssmDouble* solution);
+-		void    InputUpdateFromSolutionHydrologyDC(IssmDouble* solution);
+-		void	  InputUpdateFromSolutionHydrologyDCInefficient(IssmDouble* solution);
+-		void	  InputUpdateFromSolutionHydrologyDCEfficient(IssmDouble* solution);
+-		void    GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode);
+-		void    GetHydrologyTransfer(Vector<IssmDouble>* transfer);
+-		void    HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
+-		void    HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask);
+-		void    ComputeEPLThickness(void);
+-		bool    AllActive(void);
+-		bool    AnyActive(void);
++		ElementVector* CreatePVectorL2ProjectionEPL(void);
++		void           CreateHydrologyWaterVelocityInput(void);
++		void	         InputUpdateFromSolutionHydrology(IssmDouble* solution);
++		void	         InputUpdateFromSolutionHydrologyShreve(IssmDouble* solution);
++		void           InputUpdateFromSolutionHydrologyDC(IssmDouble* solution);
++		void	         InputUpdateFromSolutionHydrologyDCInefficient(IssmDouble* solution);
++		void	         InputUpdateFromSolutionHydrologyDCEfficient(IssmDouble* solution);
++		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode);
++		void           GetHydrologyTransfer(Vector<IssmDouble>* transfer);
++		void           HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
++		void           HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask);
++		void           ComputeEPLThickness(void);
++		void           UpdateConstraintsL2ProjectionEPL(void);
++		bool           AllActive(void);
++		bool           AnyActive(void);
+ 		#endif
+ 
+ 		#ifdef _HAVE_DAMAGE_
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16684)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16685)
+@@ -481,6 +481,9 @@
+ 	  case HydrologyDCEfficientAnalysisEnum:
+ 			return CreateKMatrixHydrologyDCEfficient();
+ 			break;
++	  case L2ProjectionEPLAnalysisEnum:
++			return CreateEPLDomainMassMatrix();
++			break;
+ 		#endif
+ 		default:
+ 			_error_("analysis " << EnumToStringx(analysis_type) << " not supported yet");
+@@ -696,6 +699,9 @@
+ 	  case HydrologyDCEfficientAnalysisEnum:
+ 			return CreatePVectorHydrologyDCEfficient();
+ 			break;
++	  case L2ProjectionEPLAnalysisEnum:
++			return CreatePVectorL2ProjectionEPL();
++			break;
+ 		#endif
+ 		default:
+ 			_error_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet");
+@@ -2258,6 +2264,10 @@
+ 	case HydrologyDCEfficientAnalysisEnum:
+ 		InputUpdateFromSolutionOneDofCollapsed(solution,EplHeadEnum);
+ 		break;
++	case L2ProjectionEPLAnalysisEnum:
++		this->parameters->FindParam(&inputenum,InputToL2ProjectEnum);
++		InputUpdateFromSolutionOneDofCollapsed(solution,inputenum);
++		break;
+ 	#endif
+ 	default: 
+ 		_error_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet");
+@@ -10621,6 +10631,19 @@
+ 	return Ke;
+ }
+ /*}}}*/
++/*FUNCTION Penta::CreateEPLDomainMassMatrix {{{*/
++ElementMatrix* Penta::CreateEPLDomainMassMatrix(void){
++
++	if (!IsOnBed()) return NULL;
++
++	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
++	ElementMatrix* Ke=tria->CreateEPLDomainMassMatrix();
++	delete tria->material; delete tria;
++
++	/*clean up and return*/
++	return Ke;
++}
++/*}}}*/
+ /*FUNCTION Penta::CreatePVectorHydrologyDCInefficient {{{*/
+ ElementVector* Penta::CreatePVectorHydrologyDCInefficient(void){
+ 
+@@ -10649,6 +10672,20 @@
+ 	return pe;
+ }
+ /*}}}*/
++/*FUNCTION Penta::CreatePVectorL@ProjectionEPL {{{*/
++ElementVector* Penta::CreatePVectorL2ProjectionEPL(void){
++
++	if (!IsOnBed()) return NULL;
++
++	/*Call Tria function*/
++	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
++	ElementVector* pe=tria->CreatePVectorL2ProjectionEPL();
++	delete tria->material; delete tria;
++
++	/*Clean up and return*/
++	return pe;
++}
++/*}}}*/
+ /*FUNCTION Penta::GetHydrologyDCInefficientHmax{{{*/
+ void  Penta::GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode){
+ 
+@@ -10774,13 +10811,15 @@
+ 
+ 				/*Compute first the effective pressure in the EPL*/
+ 				EPL_N=gravity*((rho_ice*ice_thickness[i])-(rho_water*(eplhead[i]-bed[i])));
+-				
++				if(EPL_N<0.0)EPL_N=0.0;
+ 				/*Get then the gradient of EPL heads*/
+ 				EPLgrad = epl_slopeX[i]+epl_slopeY[i];
+ 				
+ 				/*And proceed to the real thing*/
+-				thickness[i] = old_thickness[i]*(1-((rho_water*gravity*dt)/(rho_ice* latentheat))*epl_conductivity*pow(EPLgrad,2.0)-2.0*(A*dt/(pow(n,n)))*EPL_N);
++				thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*pow(EPLgrad,2.0)-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
+ 				thickness[i+numdof2d]=thickness[i];
++				printf("N, %e - thick term2, %e \n",EPL_N,-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
++				printf("old thick, %e - thick , %e \n",old_thickness[i],thickness[i]);
+ 			}
+ 		}
+ 		penta=this;
+@@ -10867,6 +10906,23 @@
+ 	xDelete<int>(doflist);
+ }
+ /*}}}*/
++/*FUNCTION Penta::UpdateConstraintsL2ProjectionEPL{{{*/
++void  Penta::UpdateConstraintsL2ProjectionEPL(void){
++
++	IssmDouble activeEpl[NUMVERTICES];
++
++
++	if(!IsOnBed()){
++		for(int i=0;i<this->NumberofNodes();i++)this->nodes[i]->Deactivate();
++	}
++	else{
++		GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveEnum);
++		for(int i=0;i<3;i++){
++			if(!activeEpl[i])this->nodes[i]->Deactivate();
++		}
++	}
++}
++/*}}}*/
+ #endif
+ 
+ #ifdef _HAVE_GROUNDINGLINE_
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16684)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16685)
+@@ -324,14 +324,17 @@
+ 		#ifdef _HAVE_HYDROLOGY_
+ 		ElementMatrix* CreateKMatrixHydrologyDCInefficient(void);
+ 		ElementMatrix* CreateKMatrixHydrologyDCEfficient(void);
++		ElementMatrix* CreateEPLDomainMassMatrix(void);
+ 		ElementVector* CreatePVectorHydrologyDCInefficient(void);
+ 		ElementVector* CreatePVectorHydrologyDCEfficient(void);
+-		void    GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode);
+-		void    GetHydrologyTransfer(Vector<IssmDouble>* transfer);
+-		void    HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
+-		void    HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask);
+-		void    InputUpdateFromSolutionHydrologyDCInefficient(IssmDouble* solution);
+-		void    ComputeEPLThickness(void);
++		ElementVector* CreatePVectorL2ProjectionEPL(void);
++		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode);
++		void           GetHydrologyTransfer(Vector<IssmDouble>* transfer);
++		void           HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
++		void           HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask);
++		void           InputUpdateFromSolutionHydrologyDCInefficient(IssmDouble* solution);
++		void           ComputeEPLThickness(void);
++		void           UpdateConstraintsL2ProjectionEPL(void);
+ 		#endif
+ 
+ 		void           UpdateConstraintsExtrudeFromBase(void){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16684)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16685)
+@@ -116,6 +116,7 @@
+ 		void    HydrologyEPLGetActive(Vector<IssmDouble>* active_vec){_error_("not implemented yet");};
+ 		void    HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask){_error_("not implemented yet");};
+ 		void    ComputeEPLThickness(void){_error_("not implemented yet");};
++		void    UpdateConstraintsL2ProjectionEPL(){_error_("not implemented");};
+ 		#endif
+ 		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type){_error_("not implemented yet");};
+ 		void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/FemModel.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.h	(revision 16684)
++++ ../trunk-jpl/src/c/classes/FemModel.h	(revision 16685)
+@@ -102,6 +102,7 @@
+ 		void HydrologyTransferx(void);
+ 		void HydrologyEPLupdateDomainx(void);
+ 		void HydrologyEPLThicknessx(void);
++		void UpdateConstraintsL2ProjectionEPLx(void);
+ 		#endif
+ };
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16685-16686.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16685-16686.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16685-16686.diff	(revision 17802)
@@ -0,0 +1,23 @@
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h	(revision 16685)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h	(revision 16686)
+@@ -18,5 +18,6 @@
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 16685)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 16686)
+@@ -52,4 +52,7 @@
+ void L2ProjectionEPLAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
++void L2ProjectionEPLAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16686-16687.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16686-16687.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16686-16687.diff	(revision 17802)
@@ -0,0 +1,50 @@
+Index: ../trunk-jpl/jenkins/execute_shell
+===================================================================
+--- ../trunk-jpl/jenkins/execute_shell	(revision 16686)
++++ ../trunk-jpl/jenkins/execute_shell	(revision 16687)
+@@ -6,17 +6,7 @@
+ #which configuration are we using? 
+ case $Platform in 
+ 	master )
+-		case $AD in 
+-			off ) 
+-				configfile=linux64_murdo ;;
+-			on )
+-				case $AMPI in 
+-					on ) 
+-						configfile=linux64_murdo_ampi ;;
+-					off )
+-						configfile=linux64_murdo_ad ;;
+-				esac ;;
+-		esac ;;
++		configfile=linux64_murdo ;;
+ 	imac-012301-gil )
+ 		configfile=imac-012301-gil ;;
+ 	larsen )
+Index: ../trunk-jpl/jenkins/execute_shell_ad
+===================================================================
+--- ../trunk-jpl/jenkins/execute_shell_ad	(revision 0)
++++ ../trunk-jpl/jenkins/execute_shell_ad	(revision 16687)
+@@ -0,0 +1,16 @@
++#!/bin/bash
++
++#some exports required
++export ISSM_DIR="$WORKSPACE"
++
++#which configuration are we using? 
++case $AMPI in 
++	on ) 
++		configfile=linux64_murdo_ampi ;;
++	off )
++		configfile=linux64_murdo_ad ;;
++esac 
++
++#run
++cd "$WORKSPACE"
++source $ISSM_DIR/jenkins/jenkins.sh $ISSM_DIR/jenkins/$configfile
+
+Property changes on: ../trunk-jpl/jenkins/execute_shell_ad
+___________________________________________________________________
+Name: svn:executable
+   + *
+
Index: issm/oecreview/Archive/16554-17801/ISSM-16687-16688.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16687-16688.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16687-16688.diff	(revision 17802)
@@ -0,0 +1,225 @@
+Index: ../trunk-jpl/jenkins/linux64_murdo_ad
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo_ad	(revision 0)
++++ ../trunk-jpl/jenkins/linux64_murdo_ad	(revision 16688)
+@@ -0,0 +1,95 @@
++########### Configuration file for Eric Larour's Jenkins runs on Linux. Automatic differentiation ############
++
++#-------------------------------#
++# 1: ISSM general configuration #
++#-------------------------------#
++
++#Nightly run name
++NAME="ISSM tests on Linux64 (murdo). Automatic differentiation validation tests"
++
++#ISSM Architecture
++ISSM_ARCH="linux-gnu-amd64"
++
++#ISSM CONFIGURATION 
++ISSM_CONFIG='--prefix=$ISSM_DIR\
++                  --prefix=$ISSM_DIR \
++				  --without-kriging \
++				  --without-kml \
++				  --with-gsl-dir=$ISSM_DIR/externalpackages/gsl/install \
++				  --with-adolc-dir=$ISSM_DIR/externalpackages/adolc/install \
++				  --with-matlab-dir=$MATLAB_DIR \
++				  --with-triangle-dir=$ISSM_DIR/externalpackages/triangle/install '
++#MATLAB path
++MATLAB_PATH="/usr/local/matlab80/"
++
++#PYTHON and MATLAB testing
++MATLAB_TEST=1
++PYTHON_TEST=0
++
++#execution path used for parallel runs
++EXECUTION_PATH=$ISSM_DIR/execution
++
++#-----------------------------------#
++# 3: External packages installation #
++#-----------------------------------#
++
++#ISSM_EXTERNALPACKAGES can have 3 values:
++# - "install" install all external packages listed below
++# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
++# - "none"    leave external packages as is
++#             ->skip to section 4
++ISSM_EXTERNALPACKAGES="install"
++EXTERNALPACKAGESDIR=$ISSM_DIR/externalpackages
++
++#List of external pakages to be installed and their installation scripts
++EXTERNALPACKAGES="autotools install.sh                
++					 git install.sh 
++					 cmake install.sh 
++					 matlab install.sh 
++					 mpich install-3.0-linux64.sh
++					 petsc install-3.4-linux64.sh
++					 metis install-5.0.1-linux64.sh
++					 triangle install-linux64.sh 
++					 gsl install-linux64.sh 
++					 adolc install.sh"
++
++#---------------------#
++# 4: ISSM Compilation #
++#---------------------#
++
++#ISSM_COMPILATION can have 2 values:
++# - "yes" compile ISSM
++# - "no"  do not compile ISSM
++ISSM_COMPILATION="yes"
++
++#----------------------#
++# 5: Mail notification #
++#----------------------#
++
++#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
++#sent to the adresses present in $ISSM_DIR/cron/mailinglist.
++SKIPMAIL="no"
++
++#Sender email address
++EMAIL_ADRESS="eric.larour@jpl.nasa.gov"
++
++#Mailing list
++MAILINGLIST="eric.larour@jpl.nasa.gov"
++
++#------------------------#
++# 6: Nightly run options #
++#------------------------#
++
++#number of cpus used in ISSM installation and compilation (one is usually
++#safer as some packages are very sensitive to parallel compilation)
++NUMCPUS_INSTALL=8
++
++#number of cpus used in the nightly runs.
++NUMCPUS_RUN=8
++
++#Nightly run options. The matlab routine runme.m will be called
++#as follows: runme($MATLAB_NROPTIONS). The options must be understandable
++#by Matlab and runme.m
++#ex: "'id',[101 102 103]"
++MATLAB_NROPTIONS="'benchmark','adolc','id',[3001:3019]"
++PYTHON_NROPTIONS=""
+
+Property changes on: ../trunk-jpl/jenkins/linux64_murdo_ad
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/jenkins/linux64_murdo_ampi
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo_ampi	(revision 0)
++++ ../trunk-jpl/jenkins/linux64_murdo_ampi	(revision 16688)
+@@ -0,0 +1,108 @@
++#
++########### Configuration file for Eric Larour's Jenkins run on Murdo ############
++
++#-------------------------------#
++# 1: ISSM general configuration #
++#-------------------------------#
++
++#Nightly run name
++NAME="ISSM tests on Linux64 (murdo). Automatic differentiation validation tests with ampi"
++
++#ISSM Architecture
++ISSM_ARCH="linux-gnu-amd64"
++
++#ISSM CONFIGURATION 
++ISSM_CONFIG='--prefix=$ISSM_DIR\
++--prefix=$ISSM_DIR \
++				  --without-kriging \
++				  --without-kml \
++				  --with-gsl-dir=$ISSM_DIR/externalpackages/gsl/install \
++				  --with-adolc-dir=$ISSM_DIR/externalpackages/adolc/install \
++				  --with-ampi-dir=$ISSM_DIR/externalpackages/adjoinablempi/install \
++				  --with-matlab-dir=$MATLAB_DIR \
++				  --with-metis-dir=$ISSM_DIR/externalpackages/petsc/install \
++				  --with-mpi-include=$ISSM_DIR/externalpackages/mpich/install/include  \
++				  --with-mpi-libflags="-L$ISSM_DIR/externalpackages/mpich/install/lib/ -lmpich" \
++				  --with-graphics-lib="/usr/lib/x86_64-linux-gnu/libX11.so" \
++				  --with-mumps-dir=$ISSM_DIR/externalpackages/petsc/install/ \
++				  --with-blas-lapack-dir=$ISSM_DIR/externalpackages/petsc/install \
++				  --with-numthreads=18  \
++				  --with-scalapack-dir=$ISSM_DIR/externalpackages/petsc/install/ \
++				  --with-triangle-dir=$ISSM_DIR/externalpackages/triangle/install \
++				  --enable-debugging CXXFLAGS="-g -O0" '
++#MATLAB path
++MATLAB_PATH="/usr/local/matlab80/"
++
++#PYTHON and MATLAB testing
++MATLAB_TEST=1
++PYTHON_TEST=0
++
++#execution path used for parallel runs
++EXECUTION_PATH=$ISSM_DIR/execution
++
++#-----------------------------------#
++# 3: External packages installation #
++#-----------------------------------#
++
++#ISSM_EXTERNALPACKAGES can have 3 values:
++# - "install" install all external packages listed below
++# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
++# - "none"    leave external packages as is
++#             ->skip to section 4
++ISSM_EXTERNALPACKAGES="install"
++EXTERNALPACKAGESDIR=$ISSM_DIR/externalpackages
++
++#List of external pakages to be installed and their installation scripts
++EXTERNALPACKAGES="autotools install.sh 
++					 git install.sh 
++					 cmake install.sh 
++					 matlab install.sh 
++					 mpich install-3.0-linux64.sh
++					 petsc install-3.4-linux64.sh
++					 metis install-5.0.1-linux64.sh
++					 triangle install-linux64.sh 
++					 gsl install-linux64.sh 
++					 mercurial install.sh
++					 adjoinablempi install.sh
++					 adolc install-withampi.sh"
++
++#---------------------#
++# 4: ISSM Compilation #
++#---------------------#
++
++#ISSM_COMPILATION can have 2 values:
++# - "yes" compile ISSM
++# - "no"  do not compile ISSM
++ISSM_COMPILATION="yes"
++
++#----------------------#
++# 5: Mail notification #
++#----------------------#
++
++#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
++#sent to the adresses present in $ISSM_DIR/cron/mailinglist.
++SKIPMAIL="no"
++
++#Sender email address
++EMAIL_ADRESS="eric.larour@jpl.nasa.gov"
++
++#Mailing list
++MAILINGLIST="eric.larour@jpl.nasa.gov"
++
++#------------------------#
++# 6: Nightly run options #
++#------------------------#
++
++#number of cpus used in ISSM installation and compilation (one is usually
++#safer as some packages are very sensitive to parallel compilation)
++NUMCPUS_INSTALL=8
++
++#number of cpus used in the nightly runs.
++NUMCPUS_RUN=8
++
++#Nightly run options. The matlab routine runme.m will be called
++#as follows: runme($MATLAB_NROPTIONS). The options must be understandable
++#by Matlab and runme.m
++#ex: "'id',[101 102 103]"
++MATLAB_NROPTIONS="'benchmark','adolc','id',[3001, 3002, 3003, 3004, 3005, 3006, 3007, 3008, 3009, 3010, 3101, 3102, 3103, 3104, 3105, 3106, 3107, 3108, 3109, 3119]"
++PYTHON_NROPTIONS=""
+
+Property changes on: ../trunk-jpl/jenkins/linux64_murdo_ampi
+___________________________________________________________________
+Name: svn:executable
+   + *
+
Index: issm/oecreview/Archive/16554-17801/ISSM-16688-16689.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16688-16689.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16688-16689.diff	(revision 17802)
@@ -0,0 +1,16 @@
+Index: ../trunk-jpl/jenkins/execute_shell_ad
+===================================================================
+--- ../trunk-jpl/jenkins/execute_shell_ad	(revision 16688)
++++ ../trunk-jpl/jenkins/execute_shell_ad	(revision 16689)
+@@ -5,9 +5,9 @@
+ 
+ #which configuration are we using? 
+ case $AMPI in 
+-	on ) 
++	ampion ) 
+ 		configfile=linux64_murdo_ampi ;;
+-	off )
++	ampioff )
+ 		configfile=linux64_murdo_ad ;;
+ esac 
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16689-16690.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16689-16690.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16689-16690.diff	(revision 17802)
@@ -0,0 +1,74 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 16689)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 16690)
+@@ -91,17 +91,6 @@
+ 
+ }/*}}}*/
+ void HydrologyDCEfficientAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+-
+-	/*Do we really want DC?*/
+-	int  hydrology_model;
+-	iomodel->Constant(&hydrology_model,HydrologyModelEnum);
+-	if(hydrology_model!=HydrologydcEnum) return;
+-
+-	/*Do we want an efficient layer*/
+-	bool isefficientlayer;
+-	iomodel->Constant(&isefficientlayer,HydrologydcIsefficientlayerEnum);
+-	if(!isefficientlayer) return;
+-
+ 	/*Nothing for now*/
+ }/*}}}*/
+ 
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 16689)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 16690)
+@@ -12,6 +12,17 @@
+ }/*}}}*/
+ void L2ProjectionEPLAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+ 
++	bool   isefficientlayer;
++	int    hydrology_model;
++
++	/*Now, do we really want DC?*/
++	iomodel->Constant(&hydrology_model,HydrologyModelEnum);
++	if(hydrology_model!=HydrologydcEnum) return;
++
++	/*Do we want an efficient layer*/
++	iomodel->Constant(&isefficientlayer,HydrologydcIsefficientlayerEnum);
++	if(!isefficientlayer) return;
++
+ 	/*Update elements: */
+ 	int counter=0;
+ 	for(int i=0;i<iomodel->numberofelements;i++){
+@@ -29,7 +40,16 @@
+ 	}
+ }/*}}}*/
+ void L2ProjectionEPLAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
++	/*Now, do we really want DC?*/
++	int  hydrology_model;
++	iomodel->Constant(&hydrology_model,HydrologyModelEnum);
++	if(hydrology_model!=HydrologydcEnum) return;
+ 
++	/*Do we want an efficient layer*/
++	bool isefficientlayer;
++	iomodel->Constant(&isefficientlayer,HydrologydcIsefficientlayerEnum);
++	if(!isefficientlayer) return;
++
+ 	if(iomodel->meshtype==Mesh3DEnum){
+ 		iomodel->FetchData(1,MeshVertexonbedEnum);
+ 	}
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16689)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16690)
+@@ -10818,8 +10818,6 @@
+ 				/*And proceed to the real thing*/
+ 				thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*pow(EPLgrad,2.0)-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
+ 				thickness[i+numdof2d]=thickness[i];
+-				printf("N, %e - thick term2, %e \n",EPL_N,-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
+-				printf("old thick, %e - thick , %e \n",old_thickness[i],thickness[i]);
+ 			}
+ 		}
+ 		penta=this;
Index: issm/oecreview/Archive/16554-17801/ISSM-16690-16691.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16690-16691.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16690-16691.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16690)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16691)
+@@ -7337,7 +7337,6 @@
+ 				
+ 				/*And proceed to the real thing*/
+ 				thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*pow(EPLgrad,2.0)-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
+-				if(this->nodes[i]->id==1553)printf("term1  %e, term2 %e\n",+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*pow(EPLgrad,2.0), -2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
+ 			}
+ 		}
+ 		this->inputs->AddInput(new TriaInput(HydrologydcEplThicknessEnum,thickness,P1Enum));
Index: issm/oecreview/Archive/16554-17801/ISSM-16691-16692.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16691-16692.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16691-16692.diff	(revision 17802)
@@ -0,0 +1,28 @@
+Index: ../trunk-jpl/jenkins/linux64_murdo_ad
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo_ad	(revision 16691)
++++ ../trunk-jpl/jenkins/linux64_murdo_ad	(revision 16692)
+@@ -51,7 +51,8 @@
+ 					 metis install-5.0.1-linux64.sh
+ 					 triangle install-linux64.sh 
+ 					 gsl install-linux64.sh 
+-					 adolc install.sh"
++					 adolc install.sh
++					 shell2junit install.sh"
+ 
+ #---------------------#
+ # 4: ISSM Compilation #
+Index: ../trunk-jpl/jenkins/linux64_murdo_ampi
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo_ampi	(revision 16691)
++++ ../trunk-jpl/jenkins/linux64_murdo_ampi	(revision 16692)
+@@ -64,7 +64,8 @@
+ 					 gsl install-linux64.sh 
+ 					 mercurial install.sh
+ 					 adjoinablempi install.sh
+-					 adolc install-withampi.sh"
++					 adolc install-withampi.sh
++					 shell2junit install.sh"
+ 
+ #---------------------#
+ # 4: ISSM Compilation #
Index: issm/oecreview/Archive/16554-17801/ISSM-16692-16693.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16692-16693.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16692-16693.diff	(revision 17802)
@@ -0,0 +1,484 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16692)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16693)
+@@ -18,8 +18,9 @@
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+-		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ 		void GetSolutionFromInputsFS(Vector<IssmDouble>* solution,Element* element);
+ 		void GetSolutionFromInputsHoriz(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolutionHoriz(IssmDouble* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16692)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16693)
+@@ -929,5 +929,94 @@
+ 	xDelete<int>(doflist);
+ }/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	int approximation;
++	element->GetInputValue(&approximation,ApproximationEnum);
++	switch(approximation){
++		case FSApproximationEnum: case NoneApproximationEnum:
++			//InputUpdateFromSolutionFS(solution,element);
++			return;
++		case SSAApproximationEnum: case HOApproximationEnum: case SIAApproximationEnum:
++			InputUpdateFromSolutionHoriz(solution,element);
++			return;
++		case L1L2ApproximationEnum:
++			//InputUpdateFromSolutionHoriz(solution,element);
++			return;
++		case SSAHOApproximationEnum: case HOFSApproximationEnum: case SSAFSApproximationEnum:
++			/*the elements around will create the solution*/
++			return;
++		default:
++			_error_("Approximation "<<EnumToStringx(approximation)<<" not supported");
++	}
+ }/*}}}*/
++void StressbalanceAnalysis::InputUpdateFromSolutionHoriz(IssmDouble* solution,Element* element){/*{{{*/
++
++	int        i;
++	IssmDouble rho_ice,g;
++	int*       doflist=NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++	int numdof   = numnodes*2;
++
++	/*Fetch dof list and allocate solution vectors*/
++	element->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
++	IssmDouble* values    = xNew<IssmDouble>(numdof);
++	IssmDouble* vx        = xNew<IssmDouble>(numnodes);
++	IssmDouble* vy        = xNew<IssmDouble>(numnodes);
++	IssmDouble* vz        = xNew<IssmDouble>(numnodes);
++	IssmDouble* vel       = xNew<IssmDouble>(numnodes);
++	IssmDouble* pressure  = xNew<IssmDouble>(numnodes);
++	IssmDouble* thickness = xNew<IssmDouble>(numnodes);
++
++	/*Use the dof list to index into the solution vector: */
++	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
++
++	/*Transform solution in Cartesian Space*/
++	element->TransformSolutionCoord(&values[0],XYEnum);
++
++	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
++	for(i=0;i<numnodes;i++){
++		vx[i]=values[i*NDOF2+0];
++		vy[i]=values[i*NDOF2+1];
++
++		/*Check solution*/
++		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
++		if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
++	}
++
++	/*Get Vz and compute vel*/
++	element->GetInputListOnNodes(&vz[0],VzEnum,0.);
++	for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
++
++	/*For pressure: we have not computed pressure in this analysis, for this element. We are in 2D, 
++	 *so the pressure is just the pressure at the bedrock: */
++	Matpar* matpar=element->GetMatparPointer();
++	rho_ice=matpar->GetRhoIce();
++	g=matpar->GetG();
++	element->GetInputListOnNodes(&thickness[0],ThicknessEnum);
++	for(i=0;i<numnodes;i++) pressure[i]=rho_ice*g*thickness[i];
++
++	/*Now, we have to move the previous Vx and Vy inputs  to old 
++	 * status, otherwise, we'll wipe them off: */
++	element->InputChangeName(VxEnum,VxPicardEnum);
++	element->InputChangeName(VyEnum,VyPicardEnum);
++	element->InputChangeName(PressureEnum,PressurePicardEnum);
++
++	/*Add vx and vy as inputs to the tria element: */
++	element->AddInput(VxEnum,vx,P1Enum);
++	element->AddInput(VyEnum,vy,P1Enum);
++	element->AddInput(VelEnum,vel,P1Enum);
++	element->AddInput(PressureEnum,pressure,P1Enum);
++
++	/*Free ressources:*/
++	xDelete<IssmDouble>(thickness);
++	xDelete<IssmDouble>(pressure);
++	xDelete<IssmDouble>(vel);
++	xDelete<IssmDouble>(vz);
++	xDelete<IssmDouble>(vy);
++	xDelete<IssmDouble>(vx);
++	xDelete<IssmDouble>(values);
++	xDelete<int>(doflist);
++
++}/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16692)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16693)
+@@ -20,6 +20,7 @@
+ class Nodes;
+ class Vertices;
+ class Materials;
++class Matpar;
+ class Input;
+ class Gauss;
+ template <class doublematrix> class Matrix;
+@@ -37,6 +38,7 @@
+ 		virtual void   Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters)=0;
+ 		virtual void   SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters)=0;
+ 		virtual void   SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum)=0;
++		virtual void   AddInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
+ 		virtual void   CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>*  Kfs)=0;
+ 		virtual void   CreateDVector(Vector<IssmDouble>* df)=0;
+ 		virtual void   CreatePVector(Vector<IssmDouble>* pf)=0;
+@@ -44,6 +46,8 @@
+ 		virtual void   FindParam(int* pvalue,int paramenum)=0;
+ 		virtual void   FindParam(IssmDouble* pvalue,int paramenum)=0;
+ 		virtual int    FiniteElement(void)=0;
++		virtual Matpar* GetMatparPointer(void)=0;
++		virtual void   TransformSolutionCoord(IssmDouble* values,int transformenum)=0;
+ 		virtual void	GetDofList(int** pdoflist,int approximation_enum,int setenum)=0;
+ 		virtual void	GetDofListVelocity(int** pdoflist,int setenum)=0;
+ 		virtual void	GetDofListPressure(int** pdoflist,int setenum)=0;
+@@ -57,6 +61,8 @@
+ 		virtual bool   IsFloating()=0; 
+ 		virtual bool   IsNodeOnShelfFromFlags(IssmDouble* flags)=0; 
+ 		virtual bool   IsOnBed()=0;
++		virtual void   GetInputListOnNodes(IssmDouble* pvalue,int enumtype)=0;
++		virtual void   GetInputListOnNodes(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue)=0;
+ 		virtual void   GetInputListOnVertices(IssmDouble* pvalue,int enumtype)=0;
+ 		virtual void   GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue)=0;
+ 		virtual Input* GetInput(int inputenum)=0;
+@@ -68,6 +74,7 @@
+ 
+ 		virtual IssmDouble SurfaceArea(void)=0;
+ 		virtual void   InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum)=0;
++		virtual void   InputChangeName(int enum_type,int enum_type_old)=0;
+ 		virtual void   ComputeBasalStress(Vector<IssmDouble>* sigma_b)=0;
+ 		virtual void   ComputeStrainRate(Vector<IssmDouble>* eps)=0;
+ 		virtual void   ResultInterpolation(int* pinterpolation,int output_enum)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16692)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16693)
+@@ -165,6 +165,13 @@
+ 	*po_nz=o_nz;
+ }
+ /*}}}*/
++/*FUNCTION Tria::AddInput{{{*/
++void  Tria::AddInput(int input_enum,IssmDouble* values, int interpolation_enum){
++
++	/*Call inputs method*/
++	this->inputs->AddInput(new TriaInput(input_enum,values,interpolation_enum));
++}
++/*}}}*/
+ /*FUNCTION Tria::CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs) {{{*/
+ void  Tria::CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs){
+ 
+@@ -1489,6 +1496,11 @@
+ 	delete gauss;
+ }
+ /*}}}*/
++/*FUNCTION Tria::GetMatparPointer(void) {{{*/
++Matpar* Tria::GetMatparPointer(void){
++	return this->matpar;
++}
++/*}}}*/
+ /*FUNCTION Tria::GetVertexPidList {{{*/
+ void  Tria::GetVertexPidList(int* doflist){
+ 
+@@ -1599,6 +1611,13 @@
+ 	}
+ }
+ /*}}}*/
++/*FUNCTION Tria::InputChangeName{{{*/
++void  Tria::InputChangeName(int new_enum,int original_enum){
++
++	/*Call inputs method*/
++	this->inputs->ChangeEnum(original_enum,new_enum);
++}
++/*}}}*/
+ /*FUNCTION Tria::InputScale{{{*/
+ void  Tria::InputScale(int enum_type,IssmDouble scale_factor){
+ 
+@@ -2764,6 +2783,13 @@
+ 	return dt;
+ }
+ /*}}}*/
++/*FUNCTION Tria::TransformSolutionCoord{{{*/
++void Tria::TransformSolutionCoord(IssmDouble* values,int transformenum){
++
++	::TransformSolutionCoord(values,this->nodes,this->NumberofNodes(),transformenum);
++
++}
++/*}}}*/
+ /*FUNCTION Tria::Update{{{*/
+ void Tria::Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finiteelement_type){
+ 
+@@ -4338,7 +4364,7 @@
+ 	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+ 
+ 	/*Transform solution in Cartesian Space*/
+-	TransformSolutionCoord(&values[0],nodes,numnodes,XYEnum);
++	::TransformSolutionCoord(&values[0],nodes,numnodes,XYEnum);
+ 
+ 	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+ 	for(i=0;i<numnodes;i++){
+@@ -4420,7 +4446,7 @@
+ 	for(i=0;i<pnumdof;i++) values[vnumdof+i]=solution[pdoflist[i]];
+ 
+ 	/*Transform solution in Cartesian Space*/
+-	TransformSolutionCoord(&values[0],nodes,vnumnodes+pnumdof,cs_list);
++	::TransformSolutionCoord(&values[0],nodes,vnumnodes+pnumdof,cs_list);
+ 
+ 	/*Ok, we have vx and vy in values, fill in all arrays: */
+ 	for(i=0;i<vnumnodes;i++){
+@@ -4487,7 +4513,7 @@
+ 	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+ 
+ 	/*Transform solution in Cartesian Space*/
+-	TransformSolutionCoord(&values[0],nodes,numnodes,XYEnum);
++	::TransformSolutionCoord(&values[0],nodes,numnodes,XYEnum);
+ 
+ 	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+ 	for(i=0;i<numnodes;i++){
+@@ -6257,7 +6283,7 @@
+ 	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+ 
+ 	/*Transform solution in Cartesian Space*/
+-	TransformSolutionCoord(&values[0],nodes,numnodes,XYEnum);
++	::TransformSolutionCoord(&values[0],nodes,numnodes,XYEnum);
+ 
+ 	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+ 	for(i=0;i<numnodes;i++){
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16692)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16693)
+@@ -190,6 +190,7 @@
+ 
+ 		/*}}}*/
+ 		/*Tria specific routines:{{{*/
++		void           AddInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		ElementMatrix* CreateKMatrix(void);
+ 		ElementMatrix* CreateKMatrixBalancethickness(void);
+ 		ElementMatrix* CreateKMatrixBalancethickness_DG(void);
+@@ -236,6 +237,7 @@
+ 		void           GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating);
+ 		IssmDouble     GetGroundedPortion(IssmDouble* xyz_list);
+ 		void           GetSegmentNormal(IssmDouble* normal,IssmDouble xyz_list[2][3]);
++      Matpar*        GetMatparPointer(void);
+ 		void           GetZeroLevelsetCoordinates(IssmDouble* xyz_zero,IssmDouble xyz_list[3][3],int levelsetenum);
+ 		Input*         GetInput(int inputenum);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype);
+@@ -249,6 +251,7 @@
+ 		void           GetInputValue(IssmDouble* pvalue,int enum_type);
+ 		void           GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype);
+ 		void           GetStrainRate2d(IssmDouble* epsilon,IssmDouble* xyz_list, GaussTria* gauss, Input* vx_input, Input* vy_input);
++		void	         InputChangeName(int enum_type,int enum_type_old);
+ 		void	         InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type);
+ 		void	         InputUpdateFromSolutionMasstransport(IssmDouble* solution);
+ 		bool	         IsInput(int name);
+@@ -256,6 +259,7 @@
+ 		void	         SetClone(int* minranks);
+ 		Seg*	         SpawnSeg(int index1,int index2);
+ 		void	         SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]);
++		void           TransformSolutionCoord(IssmDouble* values,int transformenum);
+ 		#ifdef _HAVE_STRESSBALANCE_
+ 		ElementMatrix* CreateKMatrixStressbalanceSSA(void);
+ 		ElementMatrix* CreateKMatrixStressbalanceSSAViscous(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16692)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16693)
+@@ -1814,6 +1814,13 @@
+ 	return id; 
+ }
+ /*}}}*/
++/*FUNCTION Penta::InputChangeName{{{*/
++void  Penta::InputChangeName(int new_enum,int original_enum){
++
++	/*Call inputs method*/
++	this->inputs->ChangeEnum(original_enum,new_enum);
++}
++/*}}}*/
+ /*FUNCTION Penta::InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){{{*/
+ void Penta::InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){
+ 
+@@ -3226,6 +3233,13 @@
+ 
+ 	return dt;
+ }/*}}}*/
++/*FUNCTION Penta::TransformSolutionCoord{{{*/
++void Penta::TransformSolutionCoord(IssmDouble* values,int transformenum){
++
++	::TransformSolutionCoord(values,this->nodes,this->NumberofNodes(),transformenum);
++
++}
++/*}}}*/
+ /*FUNCTION Penta::Update {{{*/
+ void Penta::Update(int index,IoModel* iomodel,int analysis_counter,int analysis_type,int finiteelement_type){ 
+ 
+@@ -6285,7 +6299,7 @@
+ 	for(i=0;i<pnumdof;i++) pvalues[i]=solution[pdoflist[i]];
+ 
+ 	/*Transform solution in Cartesian Space*/
+-	TransformSolutionCoord(&vvalues[0],nodes,vnumnodes,XYZEnum);
++	::TransformSolutionCoord(&vvalues[0],nodes,vnumnodes,XYZEnum);
+ 
+ 	/*fill in all arrays: */
+ 	for(i=0;i<vnumnodes;i++){
+@@ -9798,7 +9812,7 @@
+ 	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+ 
+ 	/*Transform solution in Cartesian Space*/
+-	TransformSolutionCoord(&values[0],nodes,NUMVERTICES2D,XYEnum); /*2D: only the first 3 nodes are taken*/
++	::TransformSolutionCoord(&values[0],nodes,NUMVERTICES2D,XYEnum); /*2D: only the first 3 nodes are taken*/
+ 
+ 	/*Ok, we have vx and vy in values, fill in vx and vy arrays and extrude */
+ 	for(i=0;i<3;i++){
+@@ -9897,8 +9911,8 @@
+ 	}
+ 
+ 	/*Transform solution in Cartesian Space*/
+-	TransformSolutionCoord(&SSA_values[0],penta->nodes,NUMVERTICES,XYEnum);
+-	TransformSolutionCoord(&HO_values[0],   this->nodes,NUMVERTICES,XYEnum);
++	::TransformSolutionCoord(&SSA_values[0],penta->nodes,NUMVERTICES,XYEnum);
++	::TransformSolutionCoord(&HO_values[0],   this->nodes,NUMVERTICES,XYEnum);
+ 
+ 	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+ 	for(i=0;i<NUMVERTICES;i++){
+@@ -9990,8 +10004,8 @@
+ 	for(i=0;i<numdofFSp;i++) FS_values[numdofFSv+i]=solution[doflistFSp[i]];
+ 
+ 	/*Transform solution in Cartesian Space*/
+-	TransformSolutionCoord(&SSA_values[0],this->nodes,NUMVERTICES,XYEnum);
+-	TransformSolutionCoord(&FS_values[0],this->nodes,2*NUMVERTICES,cs_list);
++	::TransformSolutionCoord(&SSA_values[0],this->nodes,NUMVERTICES,XYEnum);
++	::TransformSolutionCoord(&FS_values[0],this->nodes,2*NUMVERTICES,cs_list);
+ 
+ 	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+ 	for(i=0;i<NUMVERTICES;i++){
+@@ -10072,7 +10086,7 @@
+ 	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+ 
+ 	/*Transform solution in Cartesian Space*/
+-	TransformSolutionCoord(&values[0],nodes,NUMVERTICES2D,XYEnum); /*2D: only the first 3 nodes are taken*/
++	::TransformSolutionCoord(&values[0],nodes,NUMVERTICES2D,XYEnum); /*2D: only the first 3 nodes are taken*/
+ 
+ 	/*Ok, we have vx and vy in values, fill in vx and vy arrays and extrude */
+ 	for(i=0;i<3;i++){
+@@ -10154,7 +10168,7 @@
+ 	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+ 
+ 	/*Transform solution in Cartesian Space*/
+-	TransformSolutionCoord(&values[0],nodes,NUMVERTICES,XYEnum);
++	::TransformSolutionCoord(&values[0],nodes,NUMVERTICES,XYEnum);
+ 	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+@@ -10244,8 +10258,8 @@
+ 	for(i=0;i<numdofFSp;i++) FS_values[numdofFSv+i]=solution[doflistFSp[i]];
+ 
+ 	/*Transform solution in Cartesian Space*/
+-	TransformSolutionCoord(&HO_values[0],this->nodes,NUMVERTICES,XYEnum);
+-	TransformSolutionCoord(&FS_values[0],this->nodes,2*NUMVERTICES,cs_list);
++	::TransformSolutionCoord(&HO_values[0],this->nodes,NUMVERTICES,XYEnum);
++	::TransformSolutionCoord(&FS_values[0],this->nodes,2*NUMVERTICES,cs_list);
+ 
+ 	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+ 	for(i=0;i<NUMVERTICES;i++){
+@@ -10505,7 +10519,7 @@
+ 	for(i=0;i<pnumdof;i++) values[vnumdof+i]=solution[pdoflist[i]];
+ 
+ 	/*Transform solution in Cartesian Space*/
+-	TransformSolutionCoord(&values[0],nodes,vnumnodes+pnumdof,cs_list);
++	::TransformSolutionCoord(&values[0],nodes,vnumnodes+pnumdof,cs_list);
+ 
+ 	/*Ok, we have vx and vy in values, fill in all arrays: */
+ 	for(i=0;i<vnumnodes;i++){
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16692)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16693)
+@@ -90,6 +90,7 @@
+ 		void   GetNodesSidList(int* sidlist);
+ 		void   GetNodesLidList(int* lidlist);
+ 		int    GetNumberOfNodes(void);
++		Matpar* GetMatparPointer(void){_error_("not implemented yet");};
+ 		void   GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
+ 		IssmDouble GetZcoord(GaussPenta* gauss);
+ 		void   GetVectorFromInputs(Vector<IssmDouble>* vector,int name_enum);
+@@ -178,6 +179,7 @@
+ 
+ 		/*}}}*/
+ 		/*Penta specific routines:{{{*/
++		void           AddInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
+ 		void	         BedNormal(IssmDouble* bed_normal, IssmDouble xyz_list[3][3]);
+ 		ElementMatrix* CreateBasalMassMatrix(void);
+ 		ElementMatrix* CreateKMatrix(void);
+@@ -217,6 +219,7 @@
+ 		void           GetZeroLevelsetCoordinates(IssmDouble* xyz_zero,IssmDouble xyz_list[6][3],int levelsetenum);
+ 		Penta*         GetLowerElement(void);
+ 		Penta*         GetBasalElement(void);
++		void           InputChangeName(int input_enum, int enum_type_old);
+ 		void	         InputExtrude(int enum_type,int object_type);
+ 		void           InputUpdateFromSolutionMasstransport(IssmDouble* solutiong);
+ 		void           InputUpdateFromSolutionFreeSurfaceTop(IssmDouble* solutiong);
+@@ -234,6 +237,7 @@
+ 		void	         SetClone(int* minranks);
+ 		Tria*	         SpawnTria(int location);
+ 		void	         SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]);
++		void           TransformSolutionCoord(IssmDouble* values,int transformenum);
+ 
+ 		#ifdef _HAVE_STRESSBALANCE_
+ 		ElementMatrix* CreateKMatrixCouplingSSAHO(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16692)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16693)
+@@ -65,6 +65,7 @@
+ 		void  InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented yet");};
+ 		/*}}}*/
+ 		/*Element virtual functions definitions: {{{*/
++		void        AddInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
+ 		void        ComputeBasalStress(Vector<IssmDouble>* sigma_b){_error_("not implemented yet");};
+ 		void        ComputeStrainRate(Vector<IssmDouble>* eps){_error_("not implemented yet");};
+ 		void        ComputeStressTensor(){_error_("not implemented yet");};
+@@ -83,11 +84,15 @@
+ 		void        GetDofList(int** pdoflist,int approximation_enum,int setenum){_error_("not implemented yet");};
+ 		void        GetDofListVelocity(int** pdoflist,int setenum){_error_("not implemented yet");};
+ 		void        GetDofListPressure(int** pdoflist,int setenum){_error_("not implemented yet");};
++		void        GetInputListOnNodes(IssmDouble* pvalue,int enumtype){_error_("not implemented yet");};
++		void        GetInputListOnNodes(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){_error_("not implemented yet");};
++		Matpar*     GetMatparPointer(void){_error_("not implemented yet");};
+ 		int         GetNodeIndex(Node* node){_error_("not implemented yet");};
+ 		void        GetNodesSidList(int* sidlist){_error_("not implemented yet");};
+ 		void        GetNodesLidList(int* lidlist){_error_("not implemented yet");};
+ 		int         GetNumberOfNodes(void){_error_("not implemented yet");};
+ 		int         Sid(){_error_("not implemented yet");};
++		void        InputChangeName(int input_enum, int enum_type_old){_error_("not implemented yet");};
+ 		bool        IsOnBed(){_error_("not implemented yet");};
+ 		bool        IsFloating(){_error_("not implemented yet");};
+ 		bool        IsNodeOnShelfFromFlags(IssmDouble* flags){_error_("not implemented yet");};
+@@ -116,7 +121,6 @@
+ 		void    HydrologyEPLGetActive(Vector<IssmDouble>* active_vec){_error_("not implemented yet");};
+ 		void    HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask){_error_("not implemented yet");};
+ 		void    ComputeEPLThickness(void){_error_("not implemented yet");};
+-		void    UpdateConstraintsL2ProjectionEPL(){_error_("not implemented");};
+ 		#endif
+ 		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type){_error_("not implemented yet");};
+ 		void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum){_error_("not implemented yet");};
+@@ -134,8 +138,10 @@
+ 		IssmDouble  SurfaceArea(void){_error_("not implemented yet");};
+ 		void        Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement){_error_("not implemented yet");};
+ 		IssmDouble  TimeAdapt(){_error_("not implemented yet");};
++		void        TransformSolutionCoord(IssmDouble* values,int transformenum){_error_("not implemented yet");};
+ 		void UpdateConstraintsExtrudeFromBase(){_error_("not implemented");};
+ 		void UpdateConstraintsExtrudeFromTop(){_error_("not implemented");};
++		void UpdateConstraintsL2ProjectionEPL(){_error_("not implemented");};
+ 
+ #ifdef _HAVE_RESPONSES_
+ 		void       AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16693-16694.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16693-16694.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16693-16694.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16693)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16694)
+@@ -1612,7 +1612,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION Tria::InputChangeName{{{*/
+-void  Tria::InputChangeName(int new_enum,int original_enum){
++void  Tria::InputChangeName(int original_enum,int new_enum){
+ 
+ 	/*Call inputs method*/
+ 	this->inputs->ChangeEnum(original_enum,new_enum);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16693)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16694)
+@@ -1815,7 +1815,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION Penta::InputChangeName{{{*/
+-void  Penta::InputChangeName(int new_enum,int original_enum){
++void  Penta::InputChangeName(int original_enum,int new_enum){
+ 
+ 	/*Call inputs method*/
+ 	this->inputs->ChangeEnum(original_enum,new_enum);
Index: issm/oecreview/Archive/16554-17801/ISSM-16694-16695.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16694-16695.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16694-16695.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.h	(revision 16694)
++++ ../trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.h	(revision 16695)
+@@ -6,6 +6,7 @@
+ #define _UPDATEINPUTSFROMSOLUTIONXX_H
+ 
+ #include "../../classes/classes.h"
++#include "../../analyses/analyses.h"
+ 
+ /* local prototypes: */
+ void	InputUpdateFromSolutionx(FemModel* femmodel,Vector<IssmDouble>* solution);
Index: issm/oecreview/Archive/16554-17801/ISSM-16695-16696.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16695-16696.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16695-16696.diff	(revision 17802)
@@ -0,0 +1,20 @@
+Index: ../trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp	(revision 16695)
++++ ../trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp	(revision 16696)
+@@ -20,8 +20,15 @@
+ 
+ void InputUpdateFromSolutionx(FemModel* femmodel,IssmDouble* solution){
+ 
++	/*retrive parameters: */
++	int analysisenum;
++	femmodel->parameters->FindParam(&analysisenum,AnalysisTypeEnum);
++
++	Analysis* analysis = EnumToAnalysis(analysisenum);
+ 	for(int i=0;i<femmodel->elements->Size();i++){
+ 		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++		//analysis->InputUpdateFromSolution(solution,element);
+ 		element->InputUpdateFromSolution(solution);
+ 	}
++	delete analysis;
+ }
Index: issm/oecreview/Archive/16554-17801/ISSM-16696-16697.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16696-16697.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16696-16697.diff	(revision 17802)
@@ -0,0 +1,206 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16696)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16697)
+@@ -977,8 +977,8 @@
+ 
+ 	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+ 	for(i=0;i<numnodes;i++){
+-		vx[i]=values[i*NDOF2+0];
+-		vy[i]=values[i*NDOF2+1];
++		vx[i]=values[i*2+0];
++		vy[i]=values[i*2+1];
+ 
+ 		/*Check solution*/
+ 		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
+@@ -991,9 +991,8 @@
+ 
+ 	/*For pressure: we have not computed pressure in this analysis, for this element. We are in 2D, 
+ 	 *so the pressure is just the pressure at the bedrock: */
+-	Matpar* matpar=element->GetMatparPointer();
+-	rho_ice=matpar->GetRhoIce();
+-	g=matpar->GetG();
++	rho_ice = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	g       = element->GetMaterialParameter(ConstantsGEnum);
+ 	element->GetInputListOnNodes(&thickness[0],ThicknessEnum);
+ 	for(i=0;i<numnodes;i++) pressure[i]=rho_ice*g*thickness[i];
+ 
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 16696)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 16697)
+@@ -240,6 +240,29 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Matpar::Configure {{{*/
++IssmDouble Matpar::GetMaterialParameter(int enum_in){
++
++	switch(enum_in){
++		case MaterialsRhoIceEnum:                   return this->rho_ice;
++		case MaterialsRhoWaterEnum:                 return this->rho_water;
++		case MaterialsRhoFreshwaterEnum:            return this->rho_freshwater;
++		case MaterialsMuWaterEnum:                  return this->mu_water;
++		case MaterialsHeatcapacityEnum:             return this->heatcapacity;
++		case MaterialsThermalconductivityEnum:      return this->thermalconductivity;
++		case MaterialsTemperateiceconductivityEnum: return this->temperateiceconductivity;
++		case MaterialsLatentheatEnum:               return this->latentheat;
++		case MaterialsBetaEnum:                     return this->beta;
++		case MaterialsMeltingpointEnum:             return this->meltingpoint;
++		case ConstantsReferencetemperatureEnum:     return this->referencetemperature;
++		case MaterialsMixedLayerCapacityEnum:       return this->mixed_layer_capacity;
++		case MaterialsThermalExchangeVelocityEnum:  return this->thermal_exchange_velocity;
++		case ConstantsGEnum:                        return this->g;
++		default: _error_("Enum "<<EnumToStringx(enum_in)<<" not supported yet");
++	}
++
++}
++/*}}}*/
+ /*FUNCTION Matpar::GetBeta {{{*/
+ IssmDouble Matpar::GetBeta(){
+ 	return beta;
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 16696)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 16697)
+@@ -14,7 +14,7 @@
+ class Matpar: public Material{
+ 
+ 	private: 
+-		int	  mid;
++		int	      mid;
+ 		IssmDouble  rho_ice; 
+ 		IssmDouble  rho_water;
+ 		IssmDouble  rho_freshwater;
+@@ -132,10 +132,11 @@
+ 		IssmDouble GetLithosphereDensity();
+ 		IssmDouble GetMantleShearModulus();
+ 		IssmDouble GetMantleDensity();
+-		void   EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure);
+-		void   ThermalToEnthalpy(IssmDouble* penthalpy,IssmDouble temperature,IssmDouble waterfraction,IssmDouble pressure);
++		void       EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure);
++		void       ThermalToEnthalpy(IssmDouble* penthalpy,IssmDouble temperature,IssmDouble waterfraction,IssmDouble pressure);
+ 		IssmDouble GetDesFac();
+ 		IssmDouble GetS0p(); 
++		IssmDouble GetMaterialParameter(int in_enum); 
+ 		bool       IsInput(int name);
+ 		/*}}}*/
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16696)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16697)
+@@ -46,7 +46,7 @@
+ 		virtual void   FindParam(int* pvalue,int paramenum)=0;
+ 		virtual void   FindParam(IssmDouble* pvalue,int paramenum)=0;
+ 		virtual int    FiniteElement(void)=0;
+-		virtual Matpar* GetMatparPointer(void)=0;
++		virtual IssmDouble GetMaterialParameter(int enum_in)=0;
+ 		virtual void   TransformSolutionCoord(IssmDouble* values,int transformenum)=0;
+ 		virtual void	GetDofList(int** pdoflist,int approximation_enum,int setenum)=0;
+ 		virtual void	GetDofListVelocity(int** pdoflist,int setenum)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16696)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16697)
+@@ -1188,6 +1188,13 @@
+ 	return phi;
+ }
+ /*}}}*/
++/*FUNCTION Tria::GetMaterialParameter{{{*/
++IssmDouble Tria::GetMaterialParameter(int enum_in){
++
++	_assert_(this->matpar);
++	return this->matpar->GetMaterialParameter(enum_in);
++}
++/*}}}*/
+ /*FUNCTION Tria::GetSegmentNormal {{{*/
+ void Tria:: GetSegmentNormal(IssmDouble* normal,IssmDouble xyz_list[2][3]){
+ 
+@@ -1496,11 +1503,6 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetMatparPointer(void) {{{*/
+-Matpar* Tria::GetMatparPointer(void){
+-	return this->matpar;
+-}
+-/*}}}*/
+ /*FUNCTION Tria::GetVertexPidList {{{*/
+ void  Tria::GetVertexPidList(int* doflist){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16696)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16697)
+@@ -237,7 +237,7 @@
+ 		void           GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating);
+ 		IssmDouble     GetGroundedPortion(IssmDouble* xyz_list);
+ 		void           GetSegmentNormal(IssmDouble* normal,IssmDouble xyz_list[2][3]);
+-      Matpar*        GetMatparPointer(void);
++		IssmDouble     GetMaterialParameter(int enum_in);
+ 		void           GetZeroLevelsetCoordinates(IssmDouble* xyz_zero,IssmDouble xyz_list[3][3],int levelsetenum);
+ 		Input*         GetInput(int inputenum);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16696)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16697)
+@@ -1075,6 +1075,13 @@
+ 	*pdoflist=doflist;
+ }
+ /*}}}*/
++/*FUNCTION Penta::GetMaterialParameter{{{*/
++IssmDouble Penta::GetMaterialParameter(int enum_in){
++
++	_assert_(this->matpar);
++	return this->matpar->GetMaterialParameter(enum_in);
++}
++/*}}}*/
+ /*FUNCTION Penta::GetGroundedPart{{{*/
+ void Penta::GetGroundedPart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* mainlyfloating){
+ 	/*Computeportion of the element that is grounded*/ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16696)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16697)
+@@ -90,7 +90,7 @@
+ 		void   GetNodesSidList(int* sidlist);
+ 		void   GetNodesLidList(int* lidlist);
+ 		int    GetNumberOfNodes(void);
+-		Matpar* GetMatparPointer(void){_error_("not implemented yet");};
++		IssmDouble GetMaterialParameter(int enum_in);
+ 		void   GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
+ 		IssmDouble GetZcoord(GaussPenta* gauss);
+ 		void   GetVectorFromInputs(Vector<IssmDouble>* vector,int name_enum);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 16696)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 16697)
+@@ -145,6 +145,13 @@
+ }
+ /*}}}*/
+ 
++/*FUNCTION Seg::GetMaterialParameter{{{*/
++IssmDouble Seg::GetMaterialParameter(int enum_in){
++
++	_assert_(this->matpar);
++	return this->matpar->GetMaterialParameter(enum_in);
++}
++/*}}}*/
+ /*FUNCTION Seg::GetSize{{{*/
+ IssmDouble Seg::GetSize(void){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16696)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16697)
+@@ -86,7 +86,7 @@
+ 		void        GetDofListPressure(int** pdoflist,int setenum){_error_("not implemented yet");};
+ 		void        GetInputListOnNodes(IssmDouble* pvalue,int enumtype){_error_("not implemented yet");};
+ 		void        GetInputListOnNodes(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){_error_("not implemented yet");};
+-		Matpar*     GetMatparPointer(void){_error_("not implemented yet");};
++		IssmDouble  GetMaterialParameter(int enum_in);
+ 		int         GetNodeIndex(Node* node){_error_("not implemented yet");};
+ 		void        GetNodesSidList(int* sidlist){_error_("not implemented yet");};
+ 		void        GetNodesLidList(int* lidlist){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16697-16698.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16697-16698.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16697-16698.diff	(revision 17802)
@@ -0,0 +1,1506 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16697)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16698)
+@@ -951,9 +951,10 @@
+ }/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionHoriz(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	int        i;
+-	IssmDouble rho_ice,g;
+-	int*       doflist=NULL;
++	int         i,meshtype;
++	IssmDouble  rho_ice,g;
++	int*        doflist=NULL;
++	IssmDouble* xyz_list=NULL;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+@@ -968,12 +969,14 @@
+ 	IssmDouble* vel       = xNew<IssmDouble>(numnodes);
+ 	IssmDouble* pressure  = xNew<IssmDouble>(numnodes);
+ 	IssmDouble* thickness = xNew<IssmDouble>(numnodes);
++	IssmDouble* surface   = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Use the dof list to index into the solution vector: */
+ 	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+ 
+ 	/*Transform solution in Cartesian Space*/
+ 	element->TransformSolutionCoord(&values[0],XYEnum);
++	element->FindParam(&meshtype,MeshTypeEnum);
+ 
+ 	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+ 	for(i=0;i<numnodes;i++){
+@@ -993,8 +996,18 @@
+ 	 *so the pressure is just the pressure at the bedrock: */
+ 	rho_ice = element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 	g       = element->GetMaterialParameter(ConstantsGEnum);
+-	element->GetInputListOnNodes(&thickness[0],ThicknessEnum);
+-	for(i=0;i<numnodes;i++) pressure[i]=rho_ice*g*thickness[i];
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			element->GetInputListOnNodes(&thickness[0],ThicknessEnum);
++			for(i=0;i<numnodes;i++) pressure[i]=rho_ice*g*thickness[i];
++			break;
++		case Mesh3DEnum:   
++			element->GetVerticesCoordinates(&xyz_list);
++			element->GetInputListOnNodes(&surface[0],SurfaceEnum);
++			for(i=0;i<numnodes;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
+ 
+ 	/*Now, we have to move the previous Vx and Vy inputs  to old 
+ 	 * status, otherwise, we'll wipe them off: */
+@@ -1010,12 +1023,14 @@
+ 
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(thickness);
++	xDelete<IssmDouble>(surface);
+ 	xDelete<IssmDouble>(pressure);
+ 	xDelete<IssmDouble>(vel);
+ 	xDelete<IssmDouble>(vz);
+ 	xDelete<IssmDouble>(vy);
+ 	xDelete<IssmDouble>(vx);
+ 	xDelete<IssmDouble>(values);
++	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<int>(doflist);
+ 
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16697)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16698)
+@@ -70,6 +70,7 @@
+ 		virtual void   GetInputValue(bool* pvalue,int enum_type)=0;
+ 		virtual void   GetInputValue(int* pvalue,int enum_type)=0;
+ 		virtual void   GetInputValue(IssmDouble* pvalue,int enum_type)=0;
++		virtual void   GetVerticesCoordinates(IssmDouble** xyz_list)=0;
+ 		virtual void   GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype)=0;
+ 
+ 		virtual IssmDouble SurfaceArea(void)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16697)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16698)
+@@ -341,7 +341,7 @@
+ 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/* Start looping on the number of gaussian points: */
+ 	GaussTria* gauss=new GaussTria(2);
+@@ -591,7 +591,7 @@
+ 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&input_enum,InputToL2ProjectEnum);
+ 	switch(input_enum){
+ 		case SurfaceSlopeXEnum: input2 = inputs->GetInput(SurfaceEnum); _assert_(input2); break;
+@@ -684,7 +684,7 @@
+ 	GaussTria* gauss=NULL;
+ 
+ 	/* Get node coordinates and dof list: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*Retrieve all inputs we will be needing: */
+ 	Input* pressure_input=inputs->GetInput(PressureEnum); _assert_(pressure_input);
+@@ -906,7 +906,7 @@
+ 	IssmDouble x1,y1,x2,y2,x3,y3;
+ 
+ 	/*Get xyz list: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	x1=xyz_list[0][0]; y1=xyz_list[0][1];
+ 	x2=xyz_list[1][0]; y2=xyz_list[1][1];
+ 	x3=xyz_list[2][0]; y3=xyz_list[2][1];
+@@ -2699,7 +2699,7 @@
+ 	/*If on water, return 0: */
+ 	if(NoIceInElement())return 0;
+ 
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	for(int i=0;i<3;i++){
+ 		v13[i]=xyz_list[0][i]-xyz_list[2][i];
+@@ -2763,7 +2763,7 @@
+ 	#endif
+ 
+ 	/* Get node coordinates and dof list: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	minx=xyz_list[0][0];
+ 	maxx=xyz_list[0][0];
+@@ -3028,7 +3028,7 @@
+ 
+ 	rho_ice=matpar->GetRhoIce();
+ 	rho_water=matpar->GetRhoWater();
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*First calculate the area of the base (cross section triangle)
+ 	 * http://en.wikipedia.org/wiki/Triangle
+@@ -3067,7 +3067,7 @@
+ 	if (segment_id!=this->id)_error_("error message: segment with id " << segment_id << " does not belong to element with id:" << this->id);
+ 
+ 	/*Get xyz list: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*get area coordinates of 0 and 1 locations: */
+ 	gauss_1=new GaussTria();
+@@ -3134,7 +3134,7 @@
+ 	x1=*(segment+0); y1=*(segment+1); x2=*(segment+2); y2=*(segment+3);
+ 
+ 	/*Get xyz list: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*get area coordinates of 0 and 1 locations: */
+ 	gauss_1=new GaussTria();
+@@ -3328,7 +3328,7 @@
+ 
+    if(NoIceInElement())return 0;
+ 
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*First calculate the area of the base (cross section triangle)
+ 	 * http://en.wikipedia.org/wiki/Triangle
+@@ -3428,7 +3428,7 @@
+ 	re=sqrt(area/PI);
+ 
+ 	/*figure out gravity center of our element: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	x0=(xyz_list[0][0]+xyz_list[1][0]+xyz_list[2][0])/3.0;
+ 	y0=(xyz_list[0][1]+xyz_list[1][1]+xyz_list[2][1])/3.0;
+ 
+@@ -3522,7 +3522,7 @@
+ 	IssmDouble*    D      = xNewZeroInit<IssmDouble>(5*5);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+ 	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+@@ -3593,7 +3593,7 @@
+ 	IssmDouble     D;
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+ 	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+@@ -3669,7 +3669,7 @@
+ 	IssmDouble*    D      = xNewZeroInit<IssmDouble>(3*3);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* thickness_input=inputs->GetInput(ThicknessEnum); _assert_(thickness_input);
+ 	Input* vx_input=inputs->GetInput(VxEnum);               _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum);               _assert_(vy_input);
+@@ -3743,7 +3743,7 @@
+ 	IssmDouble*    D      = xNewZeroInit<IssmDouble>(2*2);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	parameters->FindParam(&migration_style,GroundinglineMigrationEnum);
+ 	Input* surface_input=inputs->GetInput(SurfaceEnum);       _assert_(surface_input);
+ 	Input* vx_input=inputs->GetInput(VxEnum);                 _assert_(vx_input);
+@@ -3885,7 +3885,7 @@
+ 	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
+ 
+ 	/*Initialize Element matrix and vectors*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	ElementVector* pe     = new ElementVector(nodes,vnumnodes+pnumnodes,this->parameters,FSvelocityEnum);
+ 	IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
+ 
+@@ -3957,7 +3957,7 @@
+ 	IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* loadingforcex_input=inputs->GetInput(LoadingforceXEnum);  _assert_(loadingforcex_input);
+ 	Input* loadingforcey_input=inputs->GetInput(LoadingforceYEnum);  _assert_(loadingforcey_input);
+ 	rho_ice = matpar->GetRhoIce();
+@@ -4024,7 +4024,7 @@
+ 	/*Retrieve all inputs and parameters*/
+ 	rho_water=matpar->GetRhoWater();
+ 	gravity=matpar->GetG();
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* bed_input=inputs->GetInput(BedEnum); _assert_(bed_input);
+ 
+ 	/*Get vertex indices that lie on bed*/
+@@ -4095,7 +4095,7 @@
+ 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* thickness_input=inputs->GetInput(ThicknessEnum); _assert_(thickness_input); 
+ 	Input* surface_input=inputs->GetInput(SurfaceEnum);     _assert_(surface_input);
+ 	Input* drag_input=inputs->GetInput(FrictionCoefficientEnum);_assert_(drag_input);
+@@ -4164,7 +4164,7 @@
+ 	int numnodes = this->NumberofNodes();
+ 
+ 	/*Initialize Element vector and other vectors*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	ElementVector* pe    = new ElementVector(nodes,numnodes,this->parameters,SSAApproximationEnum);
+ 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+@@ -4283,7 +4283,7 @@
+ 	IssmDouble*    dbasis = xNew<IssmDouble>(2*numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* vx_input=inputs->GetInput(VxEnum);       _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum);       _assert_(vy_input);
+ 	Input* thickness_input=inputs->GetInput(ThicknessEnum); _assert_(thickness_input);
+@@ -4334,7 +4334,7 @@
+ 	IssmDouble xyz_list[NUMVERTICES][3];
+ 	IssmDouble y_list[NUMVERTICES];
+ 
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	for(int i=0;i<NUMVERTICES;i++) y_list[i]=xyz_list[i][1];
+ 	TriaRef::GetInputValue(&y,&y_list[0],gauss,P1Enum);
+ 
+@@ -4582,7 +4582,7 @@
+ 	if(NoIceInElement()) return 0;
+ 
+ 	/*Retrieve all inputs we will be needing: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* weights_input              = inputs->GetInput(InversionCostFunctionsCoefficientsEnum);   _assert_(weights_input);
+ 	Input* thickness_input            = inputs->GetInput(ThicknessEnum); _assert_(thickness_input);
+ 	Input* vx_input                   = inputs->GetInput(VxEnum);                                 _assert_(vx_input);
+@@ -4835,7 +4835,7 @@
+ 	GaussTria  *gauss=NULL;
+ 
+ 	/*Retrieve all inputs we will be needing: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	GradientIndexing(&vertexpidlist[0],control_index);
+ 	Input* rheologyb_input=material->inputs->GetInput(MaterialsRheologyBbarEnum); _assert_(rheologyb_input);
+ 	Input* weights_input=inputs->GetInput(InversionCostFunctionsCoefficientsEnum);                _assert_(weights_input);
+@@ -4877,7 +4877,7 @@
+ 	GaussTria *gauss = NULL;
+ 
+ 	/* Get node coordinates and dof list: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	GradientIndexing(&doflist[0],control_index);
+ 
+ 	/*Retrieve all inputs*/
+@@ -4934,7 +4934,7 @@
+ 	GaussTria *gauss = NULL;
+ 
+ 	/* Get node coordinates and dof list: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	GradientIndexing(&doflist[0],control_index);
+ 
+ 	/*Retrieve all inputs*/
+@@ -4996,7 +4996,7 @@
+ 
+ 	/*retrive parameters: */
+ 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	GradientIndexing(&vertexpidlist[0],control_index);
+ 	this->GetConnectivityList(&connectivity[0]);
+ 
+@@ -5076,7 +5076,7 @@
+ 
+ 	/*Retrieve all inputs we will be needing: */
+ 	if(IsFloating())return;
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	GradientIndexing(&vertexpidlist[0],control_index);
+ 	Input* dragcoefficient_input=inputs->GetInput(FrictionCoefficientEnum); _assert_(dragcoefficient_input);
+ 	Input* weights_input=inputs->GetInput(InversionCostFunctionsCoefficientsEnum);                 _assert_(weights_input);
+@@ -5136,7 +5136,7 @@
+ 	GaussTria *gauss                = NULL;
+ 
+ 	/* Get node coordinates and dof list: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	GradientIndexing(&vertexpidlist[0],control_index);
+ 
+ 	/*Retrieve all inputs we will be needing: */
+@@ -5179,7 +5179,7 @@
+ 	GaussTria *gauss                = NULL;
+ 
+ 	/* Get node coordinates and dof list: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	GradientIndexing(&vertexpidlist[0],control_index);
+ 
+ 	/*Retrieve all inputs we will be needing: */
+@@ -5228,11 +5228,11 @@
+ 	IssmDouble grade_g[NUMVERTICES] = {0.0};
+ 
+ 	/* Get node coordinates and dof list: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	GradientIndexing(&vertexpidlist[0],control_index);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&num_responses,InversionNumCostFunctionsEnum);
+ 	this->parameters->FindParam(&responses,NULL,InversionCostFunctionsEnum);
+ 	Input* thickness_input            = inputs->GetInput(ThicknessEnum);                          _assert_(thickness_input);
+@@ -5347,7 +5347,7 @@
+ 	if(NoIceInElement()) return 0;
+ 
+ 	/*Retrieve all inputs we will be needing: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* weights_input  =inputs->GetInput(InversionCostFunctionsCoefficientsEnum);              _assert_(weights_input);
+ 	Input* rheologyb_input=material->inputs->GetInput(MaterialsRheologyBbarEnum); _assert_(rheologyb_input);
+ 
+@@ -5386,7 +5386,7 @@
+ 	if(NoIceInElement())return 0;
+ 
+ 	/* Get node coordinates and dof list: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*Retrieve all inputs we will be needing: */
+ 	inputs->GetInputValue(&S,SurfaceAreaEnum);
+@@ -5445,7 +5445,7 @@
+ 	if(NoIceInElement())return 0;
+ 
+ 	/* Get node coordinates and dof list: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*Retrieve all inputs we will be needing: */
+ 	Input* weights_input=inputs->GetInput(InversionCostFunctionsCoefficientsEnum);   _assert_(weights_input);
+@@ -5504,7 +5504,7 @@
+ 	if(NoIceInElement())return 0;
+ 
+ 	/* Get node coordinates and dof list: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*Retrieve all inputs we will be needing: */
+ 	Input* weights_input=inputs->GetInput(InversionCostFunctionsCoefficientsEnum);   _assert_(weights_input);
+@@ -5562,7 +5562,7 @@
+ 	if(NoIceInElement())return 0;
+ 
+ 	/* Get node coordinates and dof list: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*Retrieve all inputs we will be needing: */
+ 	Input* weights_input=inputs->GetInput(InversionCostFunctionsCoefficientsEnum);   _assert_(weights_input);
+@@ -5621,7 +5621,7 @@
+ 	if(NoIceInElement())return 0;
+ 
+ 	/* Get node coordinates and dof list: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*Retrieve all inputs we will be needing: */
+ 	Input* weights_input=inputs->GetInput(InversionCostFunctionsCoefficientsEnum);   _assert_(weights_input);
+@@ -5683,7 +5683,7 @@
+ 	if(NoIceInElement()) return 0;
+ 
+ 	/*Retrieve all inputs we will be needing: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* weights_input  =inputs->GetInput(InversionCostFunctionsCoefficientsEnum);   _assert_(weights_input);
+ 	Input* thickness_input=inputs->GetInput(ThicknessEnum); _assert_(thickness_input);
+ 
+@@ -5727,7 +5727,7 @@
+ 	if(NoIceInElement()) return 0;
+ 
+ 	/*Retrieve all inputs we will be needing: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* weights_input  = inputs->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
+ 	Input* thickness_input= inputs->GetInput(ThicknessEnum);                          _assert_(thickness_input);
+ 	Input* vx_input       = inputs->GetInput(VxEnum);                                 _assert_(vx_input);
+@@ -5778,7 +5778,7 @@
+ 	if(NoIceInElement()) return 0;
+ 
+ 	/*Retrieve all inputs we will be needing: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* weights_input  = inputs->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
+ 	Input* thickness_input= inputs->GetInput(ThicknessEnum);                          _assert_(thickness_input);
+ 	Input* vx_input       = inputs->GetInput(VxEnum);                                 _assert_(vx_input);
+@@ -5826,7 +5826,7 @@
+ 	if(NoIceInElement())return 0;
+ 
+ 	/*Retrieve all inputs we will be needing: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* thickness_input   =inputs->GetInput(ThicknessEnum);   _assert_(thickness_input);
+ 	Input* thicknessobs_input=inputs->GetInput(InversionThicknessObsEnum);_assert_(thicknessobs_input);
+ 	Input* weights_input     =inputs->GetInput(InversionCostFunctionsCoefficientsEnum);     _assert_(weights_input);
+@@ -5877,7 +5877,7 @@
+ 	IssmDouble*    dbasis = xNew<IssmDouble>(2*numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&num_responses,InversionNumCostFunctionsEnum);
+ 	this->parameters->FindParam(&responses,NULL,InversionCostFunctionsEnum);
+ 	Input* thickness_input    = inputs->GetInput(ThicknessEnum);                          _assert_(thickness_input);
+@@ -5967,7 +5967,7 @@
+ 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&num_responses,InversionNumCostFunctionsEnum);
+ 	this->parameters->FindParam(&responses,NULL,InversionCostFunctionsEnum);
+ 	Input* weights_input=inputs->GetInput(InversionCostFunctionsCoefficientsEnum);   _assert_(weights_input);
+@@ -6145,7 +6145,7 @@
+ 	if(NoIceInElement()) return 0;
+ 
+ 	/*Retrieve all inputs we will be needing: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* weights_input=inputs->GetInput(InversionCostFunctionsCoefficientsEnum);         _assert_(weights_input);
+ 	Input* drag_input   =inputs->GetInput(FrictionCoefficientEnum); _assert_(drag_input);
+ 
+@@ -6217,7 +6217,7 @@
+ 	if(incomplete_adjoint) return Ke;
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* vx_input=inputs->GetInput(VxEnum);       _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum);       _assert_(vy_input);
+ 	Input* thickness_input=inputs->GetInput(ThicknessEnum); _assert_(thickness_input);
+@@ -6389,7 +6389,7 @@
+ 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	latentheat   = matpar->GetLatentHeat();
+ 	heatcapacity = matpar->GetHeatCapacity();
+ 
+@@ -6525,7 +6525,7 @@
+ 	CreateHydrologyWaterVelocityInput();
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	this->parameters->FindParam(&diffusivity,HydrologyshreveStabilizationEnum);
+ 	Input* vx_input=inputs->GetInput(HydrologyWaterVxEnum); _assert_(vx_input);
+@@ -6615,7 +6615,7 @@
+ 	IssmDouble     D[2][2];
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	sediment_storing       = matpar->GetSedimentStoring();
+ 	sediment_transmitivity = matpar->GetSedimentTransmitivity();
+@@ -6682,7 +6682,7 @@
+ 	IssmDouble     D[2][2];
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* thickness_input=inputs->GetInput(HydrologydcEplThicknessEnum); _assert_(thickness_input);
+ 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	epl_specificstoring = matpar->GetEplSpecificStoring();
+@@ -6744,7 +6744,7 @@
+ 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/* Start looping on the number of gaussian points: */
+ 	GaussTria* gauss=new GaussTria(2);
+@@ -6789,7 +6789,7 @@
+ 	IssmDouble*    basis = xNewZeroInit<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	Input* basal_melting_input=inputs->GetInput(BasalforcingsMeltingRateEnum); _assert_(basal_melting_input);
+ 	Input* old_watercolumn_input=inputs->GetInput(WaterColumnOldEnum);         _assert_(old_watercolumn_input);
+@@ -6839,7 +6839,7 @@
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	sediment_storing = matpar->GetSedimentStoring();
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	Input* water_input=inputs->GetInput(BasalforcingsMeltingRateEnum);  _assert_(water_input);
+ 	Input* transfer_input=inputs->GetInput(WaterTransferEnum);  _assert_(transfer_input);
+@@ -6905,7 +6905,7 @@
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	epl_specificstoring = matpar->GetEplSpecificStoring();
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	Input* residual_input=inputs->GetInput(SedimentHeadResidualEnum);     _assert_(residual_input);
+ 	Input* transfer_input=inputs->GetInput(WaterTransferEnum);            _assert_(transfer_input);
+@@ -6975,7 +6975,7 @@
+ 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&input_enum,InputToL2ProjectEnum);
+ 	switch(input_enum){
+ 		case EplHeadSlopeXEnum: input2 = inputs->GetInput(SurfaceEnum); _assert_(input2); break;
+@@ -7406,7 +7406,7 @@
+ 	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	gauss=new GaussTria(2);
+@@ -7452,7 +7452,7 @@
+ 	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*Get vertex indices that lie on bed*/
+ 	this->EdgeOnSurfaceIndices(&indices[0],&indices[1]);
+@@ -7502,7 +7502,7 @@
+ 	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*Get vertex indices that lie on bed*/
+ 	this->EdgeOnBedIndices(&indices[0],&indices[1]);
+@@ -7566,7 +7566,7 @@
+ 	IssmDouble     D[2][2];
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	this->parameters->FindParam(&meshtype,MeshTypeEnum);
+ 	this->parameters->FindParam(&stabilization,MasstransportStabilizationEnum);
+@@ -7682,7 +7682,7 @@
+ 	IssmDouble     D[2][2];
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	this->parameters->FindParam(&meshtype,MeshTypeEnum);
+ 	Input* vxaverage_input=NULL;
+@@ -7759,7 +7759,7 @@
+ 	IssmDouble     D[2][2];
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	this->parameters->FindParam(&stabilization,MasstransportStabilizationEnum);
+ 	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+@@ -7872,7 +7872,7 @@
+ 	IssmDouble     D[2][2];
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	this->parameters->FindParam(&stabilization,MasstransportStabilizationEnum);
+ 	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+@@ -7994,7 +7994,7 @@
+ 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	Input* ms_input     = inputs->GetInput(SurfaceforcingsMassBalanceEnum);      _assert_(ms_input);
+ 	Input* mb_input     = inputs->GetInput(BasalforcingsMeltingRateEnum); _assert_(mb_input);
+@@ -8045,7 +8045,7 @@
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* ms_input=inputs->GetInput(SurfaceforcingsMassBalanceEnum); _assert_(ms_input);
+ 	Input* mb_input=inputs->GetInput(BasalforcingsMeltingRateEnum);   _assert_(mb_input);
+ 	Input* thickness_input=inputs->GetInput(ThicknessEnum);           _assert_(thickness_input);
+@@ -8088,7 +8088,7 @@
+ 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	Input* vz_input     = inputs->GetInput(VzEnum);                         _assert_(vz_input);
+ 	Input* ms_input     = inputs->GetInput(SurfaceforcingsMassBalanceEnum); _assert_(ms_input);
+@@ -8149,7 +8149,7 @@
+ 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	Input* vz_input  = inputs->GetInput(VzEnum);                         _assert_(vz_input);
+ 	Input* mb_input  = inputs->GetInput(BasalforcingsMeltingRateEnum);   _assert_(mb_input);
+@@ -8237,7 +8237,7 @@
+ 	IssmDouble     D[2][2];
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	this->parameters->FindParam(&meshtype,MeshTypeEnum);
+ 	this->parameters->FindParam(&stabilization,DamageStabilizationEnum);
+@@ -8364,7 +8364,7 @@
+ 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	damage_input  = this->material->inputs->GetInput(DamageDbarEnum);     _assert_(damage_input);
+ 	
+@@ -8661,7 +8661,7 @@
+ 	IssmDouble     D[2][2];
+ 
+ 	/*Retrieve all Inputs and parameters: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&stabilization,BalancethicknessStabilizationEnum);
+ 	this->parameters->FindParam(&meshtype,MeshTypeEnum);
+ 	Input* vxaverage_input=NULL;
+@@ -8766,7 +8766,7 @@
+ 	IssmDouble     D[2][2];
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+ 
+@@ -8828,7 +8828,7 @@
+ 	IssmDouble*    Ny     = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all Inputs and parameters: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* H_input =inputs->GetInput(ThicknessEnum); _assert_(H_input);
+ 	h=sqrt(2.*this->GetArea());
+ 
+@@ -8901,7 +8901,7 @@
+ 	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* thickness_input=inputs->GetInput(ThicknessEnum); _assert_(thickness_input);
+ 
+ 	/* Start looping on the number of gaussian points: */
+@@ -8963,7 +8963,7 @@
+ 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* ms_input=inputs->GetInput(SurfaceforcingsMassBalanceEnum); _assert_(ms_input);
+ 	Input* mb_input=inputs->GetInput(BasalforcingsMeltingRateEnum);   _assert_(mb_input);
+ 	Input* dhdt_input=inputs->GetInput(BalancethicknessThickeningRateEnum); _assert_(dhdt_input);
+@@ -9005,7 +9005,7 @@
+ 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* ms_input=inputs->GetInput(SurfaceforcingsMassBalanceEnum); _assert_(ms_input);
+ 	Input* mb_input=inputs->GetInput(BasalforcingsMeltingRateEnum);   _assert_(mb_input);
+ 	Input* dhdt_input=inputs->GetInput(BalancethicknessThickeningRateEnum);_assert_(dhdt_input);
+@@ -9055,7 +9055,7 @@
+ 	IssmDouble*    Ny     = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* ms_input=inputs->GetInput(SurfaceforcingsMassBalanceEnum); _assert_(ms_input);
+ 	Input* mb_input=inputs->GetInput(BasalforcingsMeltingRateEnum);   _assert_(mb_input);
+ 	Input* dhdt_input=inputs->GetInput(BalancethicknessThickeningRateEnum); _assert_(dhdt_input);
+@@ -9131,7 +9131,7 @@
+ 	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* H_input       = inputs->GetInput(ThicknessEnum); _assert_(H_input);
+ 	Input* surface_input = inputs->GetInput(SurfaceEnum);   _assert_(surface_input);
+ 	Input* vx_input      = inputs->GetInput(VxEnum);
+@@ -9183,7 +9183,7 @@
+ 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* H_input       = inputs->GetInput(ThicknessEnum); _assert_(H_input);
+ 	Input* surface_input = inputs->GetInput(SurfaceEnum);   _assert_(surface_input);
+ 	Input* vx_input      = inputs->GetInput(VxEnum);
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16697)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16698)
+@@ -105,6 +105,7 @@
+ 		bool        NoIceInElement();
+ 		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
+ 		void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum);
++		void        GetVerticesCoordinates(IssmDouble** pxyz_list){_error_("not implemented yet");};
+ 		void        InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);
+ 		void        InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum=MeshElementsEnum);
+ 		void        InputDuplicate(int original_enum,int new_enum);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16697)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16698)
+@@ -120,6 +120,13 @@
+ /*}}}*/
+ 
+ /*Other*/
++/*FUNCTION Penta::AddInput{{{*/
++void  Penta::AddInput(int input_enum,IssmDouble* values, int interpolation_enum){
++
++	/*Call inputs method*/
++	this->inputs->AddInput(new PentaInput(input_enum,values,interpolation_enum));
++}
++/*}}}*/
+ /*FUNCTION Penta::BedNormal {{{*/
+ void Penta::BedNormal(IssmDouble* bed_normal, IssmDouble xyz_list[3][3]){
+ 
+@@ -233,7 +240,7 @@
+ 	gravity=matpar->GetG();
+ 
+ 	/* Get node coordinates and dof list: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	for(i=0;i<3;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+ 
+ 	/*Retrieve all inputs we will be needing: */
+@@ -301,7 +308,7 @@
+ 	GaussPenta* gauss=NULL;
+ 
+ 	/* Get node coordinates and dof list: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*Retrieve all inputs we will be needing: */
+ 	Input* pressure_input=inputs->GetInput(PressureEnum); _assert_(pressure_input);
+@@ -1272,7 +1279,7 @@
+ 	IssmDouble xmax,ymax,zmax;
+ 
+ 	/*Get xyz list: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	xmin=xyz_list[0][0]; xmax=xyz_list[0][0];
+ 	ymin=xyz_list[0][1]; ymax=xyz_list[0][1];
+ 	zmin=xyz_list[0][2]; zmax=xyz_list[0][2];
+@@ -1469,6 +1476,16 @@
+ 	input->GetInputValue(pvalue);
+ 
+ }/*}}}*/
++/*FUNCTION Penta::GetVerticesCoordinates(IssmDouble** pxyz_list){{{*/
++void Penta::GetVerticesCoordinates(IssmDouble** pxyz_list){
++
++	IssmDouble* xyz_list = xNew<IssmDouble>(NUMVERTICES*3);
++	::GetVerticesCoordinates(xyz_list,this->vertices,NUMVERTICES);
++
++	/*Assign output pointer*/
++	*pxyz_list = xyz_list;
++
++}/*}}}*/
+ /*FUNCTION Penta::GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype) {{{*/
+ void Penta::GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype){
+ 
+@@ -1650,7 +1667,7 @@
+ 	IssmDouble xyz_list[NUMVERTICES][3];
+ 	IssmDouble z_list[NUMVERTICES];
+ 
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	for(i=0;i<NUMVERTICES;i++) z_list[i]=xyz_list[i][2];
+ 	PentaRef::GetInputValue(&z,z_list,gauss);
+ 
+@@ -1954,7 +1971,7 @@
+ 		}
+ 
+ 		/*Step2: Create element thickness input*/
+-		GetVerticesCoordinates(&xyz_list[0][0],penta->vertices,NUMVERTICES);
++		::GetVerticesCoordinates(&xyz_list[0][0],penta->vertices,NUMVERTICES);
+ 		for(i=0;i<3;i++){
+ 			Helem_list[i]=xyz_list[i+3][2]-xyz_list[i][2];
+ 			Helem_list[i+3]=Helem_list[i];
+@@ -3214,7 +3231,7 @@
+ 	this->MaxAbsVz(&maxabsvz);
+ 
+ 	/* Get node coordinates and dof list: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	minx=xyz_list[0][0];
+ 	maxx=xyz_list[0][0];
+@@ -3469,7 +3486,7 @@
+ 	IssmDouble thickness;
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+ 	Input* vz_input=inputs->GetInput(VzEnum); _assert_(vz_input);
+@@ -3522,7 +3539,7 @@
+ 
+ 	if(NoIceInElement())return 0;
+ 
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*First calculate the area of the base (cross section triangle)
+ 	 * http://en.wikipedia.org/wiki/Pentangle
+@@ -3548,7 +3565,7 @@
+ 
+ 	rho_ice=matpar->GetRhoIce();
+ 	rho_water=matpar->GetRhoWater();
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*First calculate the area of the base (cross section triangle)
+ 	 * http://en.wikipedia.org/wiki/Pentangle
+@@ -3769,7 +3786,7 @@
+ 
+ 	if(NoIceInElement() || !IsOnSurface()) return 0.;
+ 
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*First calculate the area of the base (cross section triangle)
+ 	 * http://en.wikipedia.org/wiki/Triangle
+@@ -3844,7 +3861,7 @@
+ 	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	rho_water=matpar->GetRhoWater();
+ 	rho_ice=matpar->GetRhoIce();
+ 	gravity=matpar->GetG();
+@@ -3993,7 +4010,7 @@
+ 	rho_water=matpar->GetRhoWater();
+ 	rho_ice=matpar->GetRhoIce();
+ 	heatcapacity=matpar->GetHeatCapacity();
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+ 
+ 	/* Start looping on the number of gauss (nodes on the bedrock) */
+@@ -4075,7 +4092,7 @@
+ 	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	rho_water=matpar->GetRhoWater();
+ 	rho_ice=matpar->GetRhoIce();
+ 	gravity=matpar->GetG();
+@@ -4222,7 +4239,7 @@
+ 	rho_water=matpar->GetRhoWater();
+ 	rho_ice=matpar->GetRhoIce();
+ 	heatcapacity=matpar->GetHeatCapacity();
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+ 
+ 	/* Start looping on the number of gauss (nodes on the bedrock) */
+@@ -4291,7 +4308,7 @@
+ 	ElementVector* pe=new ElementVector(nodes,NUMVERTICES,this->parameters);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	rho_ice=matpar->GetRhoIce();
+ 	heatcapacity=matpar->GetHeatCapacity();
+ 	thermalconductivity=matpar->GetThermalConductivity();
+@@ -4382,7 +4399,7 @@
+ 	ElementVector* pe=new ElementVector(nodes,NUMVERTICES,this->parameters);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+ 	mixed_layer_capacity=matpar->GetMixedLayerCapacity();
+ 	thermal_exchange_velocity=matpar->GetThermalExchangeVelocity();
+@@ -4445,7 +4462,7 @@
+ 	ElementVector* pe=new ElementVector(nodes,NUMVERTICES,this->parameters);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+ 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+ 	rho_ice=matpar->GetRhoIce();
+@@ -4564,7 +4581,7 @@
+ 	ElementVector* pe=new ElementVector(nodes,NUMVERTICES,this->parameters);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	rho_ice=matpar->GetRhoIce();
+ 	heatcapacity=matpar->GetHeatCapacity();
+ 	thermalconductivity=matpar->GetThermalConductivity();
+@@ -4648,7 +4665,7 @@
+ 	ElementVector* pe=new ElementVector(nodes,NUMVERTICES,this->parameters);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+ 	mixed_layer_capacity=matpar->GetMixedLayerCapacity();
+ 	thermal_exchange_velocity=matpar->GetThermalExchangeVelocity();
+@@ -4707,7 +4724,7 @@
+ 	ElementVector* pe=new ElementVector(nodes,NUMVERTICES,this->parameters);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+ 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+ 	rho_ice=matpar->GetRhoIce();
+@@ -4787,7 +4804,7 @@
+ 
+ 
+ 	/*Get all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* surface_input=inputs->GetInput(SurfaceEnum); _assert_(surface_input);
+ 
+ 	this->inputs->GetInputValue(&converged,ConvergedEnum);
+@@ -4855,7 +4872,7 @@
+ 	}
+ 
+ 	/*Get all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	GetInputListOnVertices(&pressure[0],PressureEnum);
+ 	Input* surface_input=inputs->GetInput(SurfaceEnum); _assert_(surface_input);
+ 
+@@ -5028,7 +5045,7 @@
+ 	GetInputListOnVertices(&geothermalflux[0],BasalforcingsGeothermalfluxEnum);
+ 	Input* enthalpy_input=inputs->GetInput(EnthalpyEnum); _assert_(enthalpy_input);
+ 
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+ 
+ 	/*Build friction element, needed later: */
+@@ -5345,7 +5362,7 @@
+ 	if(incomplete_adjoint) return Ke;
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* vx_input=inputs->GetInput(VxEnum);       _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum);       _assert_(vy_input);
+ 
+@@ -5415,7 +5432,7 @@
+ 	int numdof    = vnumnodes*NDOF3 + pnumnodes*NDOF1;
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* vx_input=inputs->GetInput(VxEnum);       _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum);       _assert_(vy_input);
+ 	Input* vz_input=inputs->GetInput(VzEnum);       _assert_(vz_input);
+@@ -5529,7 +5546,7 @@
+ 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&num_responses,InversionNumCostFunctionsEnum);
+ 	this->parameters->FindParam(&responses,NULL,InversionCostFunctionsEnum);
+ 	Input* weights_input=inputs->GetInput(InversionCostFunctionsCoefficientsEnum);   _assert_(weights_input);
+@@ -5725,7 +5742,7 @@
+ 	IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&num_responses,InversionNumCostFunctionsEnum);
+ 	this->parameters->FindParam(&responses,NULL,InversionCostFunctionsEnum);
+ 	Input* weights_input = inputs->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
+@@ -6032,7 +6049,7 @@
+ 	/*Retrieve all inputs and parameters*/
+ 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+ 	GradientIndexing(&vertexpidlist[0],control_index);
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+ 	Input* adjointx_input=inputs->GetInput(AdjointxEnum);               _assert_(adjointx_input);
+ 	Input* adjointy_input=inputs->GetInput(AdjointyEnum);               _assert_(adjointy_input);
+@@ -6104,7 +6121,7 @@
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+ 	GradientIndexing(&vertexpidlist[0],control_index);
+ 	Input* drag_input    =inputs->GetInput(FrictionCoefficientEnum); _assert_(drag_input);
+@@ -6922,7 +6939,7 @@
+ 	delete Ke1; delete Ke2;
+ 
+ 	/* Get node coordinates and dof list: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&viscosity_overshoot,StressbalanceViscosityOvershootEnum);
+ 	Input* vx_input=inputs->GetInput(VxEnum);       _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum);       _assert_(vy_input);
+@@ -7009,7 +7026,7 @@
+ 	}
+ 
+ 	/*retrieve inputs :*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+ 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+ 	Input* vx_input=inputs->GetInput(VxEnum);           _assert_(vx_input);
+@@ -7128,7 +7145,7 @@
+ 	delete Ke1; delete Ke2;
+ 
+ 	/* Get node coordinates and dof list: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+ 	Input* vx_input=inputs->GetInput(VxEnum);       _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum);       _assert_(vy_input);
+@@ -7242,7 +7259,7 @@
+ 	delete Ke1; delete Ke2;
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+ 	parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+ 	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+@@ -7542,7 +7559,7 @@
+ 	inputs->GetInputValue(&approximation,ApproximationEnum);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&viscosity_overshoot,StressbalanceViscosityOvershootEnum);
+ 	Input* vx_input=inputs->GetInput(VxEnum);       _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum);       _assert_(vy_input);
+@@ -7693,7 +7710,7 @@
+ 	ElementMatrix* Ke=new ElementMatrix(tria->nodes,NUMVERTICES2D,this->parameters,L1L2ApproximationEnum);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* vx_input=inputs->GetInput(VxEnum);        _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum);        _assert_(vy_input);
+ 	Input* surf_input=inputs->GetInput(SurfaceEnum); _assert_(surf_input);
+@@ -7789,7 +7806,7 @@
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	inputs->GetInputValue(&approximation,ApproximationEnum);
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&viscosity_overshoot,StressbalanceViscosityOvershootEnum);
+ 	Input* vx_input=inputs->GetInput(VxEnum);       _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum);       _assert_(vy_input);
+@@ -7863,7 +7880,7 @@
+ 	IssmDouble*    D      = xNewZeroInit<IssmDouble>(2*2);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+ 	parameters->FindParam(&migration_style,GroundinglineMigrationEnum);
+ 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+@@ -7987,7 +8004,7 @@
+ 	int c=3; //index of pressure
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+ 	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+@@ -8099,7 +8116,7 @@
+ 	IssmDouble*    D      = xNewZeroInit<IssmDouble>(8*8);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+ 	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+@@ -8170,7 +8187,7 @@
+ 	IssmDouble*    D         = xNewZeroInit<IssmDouble>(2*2);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+ 	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+@@ -8241,7 +8258,7 @@
+ 	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	gauss=new GaussPenta(2,2);
+@@ -8287,7 +8304,7 @@
+ 	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i+3][j];
+ 	SurfaceNormal(&surface_normal[0],xyz_list_tria);
+ 
+@@ -8354,7 +8371,7 @@
+ 	ElementVector* pe=new ElementVector(nodes,vnumnodes+pnumnodes,this->parameters,FSvelocityEnum);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+ 	Input* vx_input=inputs->GetInput(VxEnum);               _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum);               _assert_(vy_input);
+@@ -8425,7 +8442,7 @@
+ 	ElementVector* pe=new ElementVector(nodes,vnumnodes+pnumnodes,this->parameters,FSvelocityEnum);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+ 	this->parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+ 	Input* vx_input=inputs->GetInput(VxEnum);        _assert_(vx_input);
+@@ -8516,7 +8533,7 @@
+ 	ElementVector* pe=new ElementVector(nodes,vnumnodes+pnumnodes,this->parameters,FSvelocityEnum);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+ 	Input* vx_input=inputs->GetInput(VxEnum);       _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum);       _assert_(vy_input);
+@@ -8590,7 +8607,7 @@
+ 	ElementVector* pe=new ElementVector(nodes,numnodes,this->parameters,FSvelocityEnum);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+ 	this->parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+ 	Input* vx_input=inputs->GetInput(VxEnum);               _assert_(vx_input);
+@@ -8755,7 +8772,7 @@
+ 	ElementVector* pe=new ElementVector(nodes,numnodes,this->parameters);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	rho_ice=matpar->GetRhoIce();
+ 	gravity=matpar->GetG();
+ 	n=material->GetN();
+@@ -8881,7 +8898,7 @@
+ 	IssmDouble*    basis = xNewZeroInit<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* thickness_input=inputs->GetInput(ThicknessEnum); _assert_(thickness_input);
+ 	Input* surface_input=inputs->GetInput(SurfaceEnum);     _assert_(surface_input);
+ 
+@@ -8949,7 +8966,7 @@
+ 	int numnodes = this->NumberofNodes();
+ 
+ 	/*Initialize Element vector and other vectors*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	ElementVector* pe    = new ElementVector(nodes,numnodes,this->parameters,HOApproximationEnum);
+ 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+@@ -9064,7 +9081,7 @@
+ 	IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	rho_water=matpar->GetRhoWater();
+ 	rho_ice  =matpar->GetRhoIce();
+ 	gravity  =matpar->GetG();
+@@ -9130,7 +9147,7 @@
+ 	rho_ice=matpar->GetRhoIce();
+ 	gravity=matpar->GetG();
+ 	B=material->GetB();
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+ 	Input* vz_input=inputs->GetInput(VzEnum); _assert_(vz_input);
+@@ -9222,7 +9239,7 @@
+ 	IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* loadingforcex_input=inputs->GetInput(LoadingforceXEnum);  _assert_(loadingforcex_input);
+ 	Input* loadingforcey_input=inputs->GetInput(LoadingforceYEnum);  _assert_(loadingforcey_input);
+ 	Input* loadingforcez_input=inputs->GetInput(LoadingforceZEnum);  _assert_(loadingforcez_input);
+@@ -9297,7 +9314,7 @@
+ 	this->parameters->FindParam(&shelf_dampening,StressbalanceShelfDampeningEnum);
+ 	rho_water=matpar->GetRhoWater();
+ 	gravity=matpar->GetG();
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* bed_input=inputs->GetInput(BedEnum); _assert_(bed_input);
+ 	Input* vx_input=inputs->GetInput(VxEnum);   _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum);   _assert_(vy_input);
+@@ -9378,7 +9395,7 @@
+ 	ElementVector* pe=new ElementVector(nodes,NUMVERTICES,this->parameters);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	inputs->GetInputValue(&approximation,ApproximationEnum);
+ 	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+@@ -9437,7 +9454,7 @@
+ 	ElementVector* pe=new ElementVector(nodes,NUMVERTICES,this->parameters);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+ 	inputs->GetInputValue(&approximation,ApproximationEnum);
+ 	Input* bed_input=inputs->GetInput(BedEnum);                                _assert_(bed_input);
+@@ -9548,7 +9565,7 @@
+ 	ElementMatrix* Ke=CreateKMatrixStressbalanceHO();
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* vx_input=inputs->GetInput(VxEnum);       _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum);       _assert_(vy_input);
+ 
+@@ -9624,7 +9641,7 @@
+ 	IssmDouble*    dbasis = xNew<IssmDouble>(3*vnumnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+ 	Input* vz_input=inputs->GetInput(VzEnum); _assert_(vz_input);
+@@ -9842,7 +9859,7 @@
+ 	for(;;){
+ 
+ 		/*Get node data: */
+-		GetVerticesCoordinates(&xyz_list[0][0],penta->vertices,NUMVERTICES);
++		::GetVerticesCoordinates(&xyz_list[0][0],penta->vertices,NUMVERTICES);
+ 
+ 		/*Now Compute vel*/
+ 		GetInputListOnVertices(&vz[0],VzEnum,0.0); //default is 0
+@@ -9905,7 +9922,7 @@
+ 	penta->GetDofList(&doflistm,SSAApproximationEnum,GsetEnum);
+ 
+ 	/*Get node data: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*Use the dof list to index into the solution vector: */
+ 	for(i=0;i<numdof2d;i++){
+@@ -10000,7 +10017,7 @@
+ 	this->parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+ 
+ 	/*Get node data: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*Use the dof list to index into the solution vector: */
+ 	for(i=0;i<numdof2d;i++){
+@@ -10116,7 +10133,7 @@
+ 	for(;;){
+ 
+ 		/*Get node data: */
+-		GetVerticesCoordinates(&xyz_list[0][0],penta->vertices,NUMVERTICES);
++		::GetVerticesCoordinates(&xyz_list[0][0],penta->vertices,NUMVERTICES);
+ 
+ 		/*Now Compute vel*/
+ 		GetInputListOnVertices(&vz[0],VzEnum,0.0); //default is 0
+@@ -10176,7 +10193,7 @@
+ 
+ 	/*Transform solution in Cartesian Space*/
+ 	::TransformSolutionCoord(&values[0],nodes,NUMVERTICES,XYEnum);
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+ 	for(i=0;i<numnodes;i++){
+@@ -10257,7 +10274,7 @@
+ 	this->parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+ 
+ 	/*Get node data: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*Use the dof list to index into the solution vector: */
+ 	for(i=0;i<numdofHO;i++)  HO_values[i]=solution[doflistHO[i]];
+@@ -10344,7 +10361,7 @@
+ 	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+ 
+ 	/*Get node data: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*Use the dof list to index into the solution vector: */
+ 	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+@@ -10416,7 +10433,7 @@
+ 
+ 	/*Get dof list and vertices coordinates: */
+ 	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*Use the dof list to index into the solution vector vz: */
+ 	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16697)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16698)
+@@ -94,6 +94,7 @@
+ 		void   GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
+ 		IssmDouble GetZcoord(GaussPenta* gauss);
+ 		void   GetVectorFromInputs(Vector<IssmDouble>* vector,int name_enum);
++		void   GetVerticesCoordinates(IssmDouble** pxyz_list);
+ 
+ 		int    Sid();
+ 		void   InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);
+@@ -179,7 +180,7 @@
+ 
+ 		/*}}}*/
+ 		/*Penta specific routines:{{{*/
+-		void           AddInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
++		void           AddInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		void	         BedNormal(IssmDouble* bed_normal, IssmDouble xyz_list[3][3]);
+ 		ElementMatrix* CreateBasalMassMatrix(void);
+ 		ElementMatrix* CreateKMatrix(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 16697)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 16698)
+@@ -159,7 +159,7 @@
+ 	IssmDouble x1,y1,x2,y2;
+ 
+ 	/*Get xyz list: */
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	x1=xyz_list[0][0]; y1=xyz_list[0][1];
+ 	x2=xyz_list[1][0]; y2=xyz_list[1][1];
+ 
+@@ -185,7 +185,7 @@
+ 	IssmDouble*    Bprime = xNew<IssmDouble>(1*numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	this->parameters->FindParam(&stabilization,MasstransportStabilizationEnum);
+ 	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+@@ -263,7 +263,7 @@
+ 	IssmDouble*    Bprime = xNew<IssmDouble>(1*numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	this->parameters->FindParam(&stabilization,MasstransportStabilizationEnum);
+ 	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+@@ -337,7 +337,7 @@
+ 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/* Start looping on the number of gaussian points: */
+ 	GaussSeg* gauss=new GaussSeg(2);
+@@ -380,7 +380,7 @@
+ 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&input_enum,InputToL2ProjectEnum);
+ 	switch(input_enum){
+ 		case SurfaceSlopeXEnum: input2 = inputs->GetInput(SurfaceEnum); _assert_(input2); break;
+@@ -429,7 +429,7 @@
+ 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	Input* vy_input     = inputs->GetInput(VyEnum);                         _assert_(vy_input);
+ 	Input* ms_input     = inputs->GetInput(SurfaceforcingsMassBalanceEnum); _assert_(ms_input);
+@@ -474,7 +474,7 @@
+ 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	Input* vy_input            = inputs->GetInput(VyEnum);                         _assert_(vy_input);
+ 	Input* mb_input            = inputs->GetInput(BasalforcingsMeltingRateEnum);   _assert_(mb_input);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16697)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16698)
+@@ -91,6 +91,7 @@
+ 		void        GetNodesSidList(int* sidlist){_error_("not implemented yet");};
+ 		void        GetNodesLidList(int* lidlist){_error_("not implemented yet");};
+ 		int         GetNumberOfNodes(void){_error_("not implemented yet");};
++		void        GetVerticesCoordinates(IssmDouble** pxyz_list){_error_("not implemented yet");};
+ 		int         Sid(){_error_("not implemented yet");};
+ 		void        InputChangeName(int input_enum, int enum_type_old){_error_("not implemented yet");};
+ 		bool        IsOnBed(){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16698-16699.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16698-16699.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16698-16699.diff	(revision 17802)
@@ -0,0 +1,244 @@
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16698)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16699)
+@@ -115,5 +115,82 @@
+ 	element->GetSolutionFromInputsOneDof(solution,TemperatureEnum);
+ }/*}}}*/
+ void ThermalAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	bool        converged;
++	int         i,rheology_law;
++	IssmDouble  B_average,s_average,T_average=0.;
++	int        *doflist   = NULL;
++	IssmDouble *xyz_list  = NULL;
++	bool        hack      = false;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Fetch dof list and allocate solution vector*/
++	element->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
++	IssmDouble* values    = xNew<IssmDouble>(numnodes);
++
++	/*Use the dof list to index into the solution vector: */
++	for(i=0;i<numnodes;i++){
++		values[i]=solution[doflist[i]];
++
++		/*Check solution*/
++		if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector");
++		//if(values[i]<0)      _printf_("temperature < 0°K found in solution vector\n");
++		//if(values[i]>275)    _printf_("temperature > 275°K found in solution vector (Paterson's rheology associated is negative)\n");
++	}
++
++	/*Force temperature between [Tpmp-50 Tpmp] to disable penalties*/
++	if(hack){
++		IssmDouble* pressure = xNew<IssmDouble>(numnodes);
++		element->GetInputListOnVertices(pressure,PressureEnum);
++		for(i=0;i<numnodes;i++){
++			if(values[i]>element->TMeltingPoint(pressure[i]))     values[i]=element->TMeltingPoint(pressure[i]);
++			if(values[i]<element->TMeltingPoint(pressure[i])-50.) values[i]=element->TMeltingPoint(pressure[i])-50.;
++		}
++		xDelete<IssmDouble>(pressure);
++	}
++
++	/*Get all inputs and parameters*/
++
++	element->GetInputValue(&converged,ConvergedEnum);
++	if(converged){
++		element->AddInput(TemperatureEnum,values,P1Enum);
++
++		/*Update Rheology only if converged (we must make sure that the temperature is below melting point
++		 * otherwise the rheology could be negative*/
++		element->FindParam(&rheology_law,MaterialsRheologyLawEnum);
++		switch(rheology_law){
++			case NoneEnum:
++				/*Do nothing: B is not temperature dependent*/
++				break;
++			case PatersonEnum:
++				for(i=0;i<numnodes;i++) T_average+=values[i]/reCast<IssmDouble>(numnodes);
++				B_average=Paterson(T_average);
++				element->AddMaterialInput(MaterialsRheologyBEnum,&B_average,P0Enum);
++				break;
++			case ArrheniusEnum:{
++				Input* surface_input=element->GetInput(SurfaceEnum); _assert_(surface_input);
++				surface_input->GetInputAverage(&s_average);
++				element->GetVerticesCoordinates(&xyz_list);
++				for(i=0;i<numnodes;i++) T_average+=values[i]/reCast<IssmDouble>(numnodes);
++				//B_average=Arrhenius(T_average,
++							//s_average-((xyz_list[0][2]+xyz_list[1][2]+xyz_list[2][2]+xyz_list[3][2]+xyz_list[4][2]+xyz_list[5][2])/6.0),
++							//element->GetMaticeParameter(MaterialsRheologyNEnum));
++				element->AddMaterialInput(MaterialsRheologyBEnum,&B_average,P0Enum);
++				break;
++				}
++			default:
++				_error_("Rheology law " << EnumToStringx(rheology_law) << " not supported yet");
++
++		}
++	}
++	else{
++		element->AddInput(TemperaturePicardEnum,values,P1Enum);
++	}
++
++	/*Free ressources:*/
++	xDelete<IssmDouble>(values);
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<int>(doflist);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16698)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16699)
+@@ -39,6 +39,7 @@
+ 		virtual void   SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters)=0;
+ 		virtual void   SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum)=0;
+ 		virtual void   AddInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
++		virtual void   AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
+ 		virtual void   CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>*  Kfs)=0;
+ 		virtual void   CreateDVector(Vector<IssmDouble>* df)=0;
+ 		virtual void   CreatePVector(Vector<IssmDouble>* pf)=0;
+@@ -94,6 +95,7 @@
+ 		virtual void   PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm)=0;
+ 		virtual void   Delta18oParameterization(void)=0;
+ 		virtual void   SmbGradients()=0;
++		virtual IssmDouble TMeltingPoint(IssmDouble pressure)=0;
+ 		virtual void   ResetCoordinateSystem()=0;
+ 		virtual int    VelocityInterpolation()=0;
+ 		virtual int    PressureInterpolation()=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16698)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16699)
+@@ -169,9 +169,17 @@
+ void  Tria::AddInput(int input_enum,IssmDouble* values, int interpolation_enum){
+ 
+ 	/*Call inputs method*/
++	_assert_(this->inputs);
+ 	this->inputs->AddInput(new TriaInput(input_enum,values,interpolation_enum));
+ }
+ /*}}}*/
++/*FUNCTION Tria::AddMaterialInput{{{*/
++void  Tria::AddMaterialInput(int input_enum,IssmDouble* values, int interpolation_enum){
++
++	_assert_(this->material);
++	this->material->inputs->AddInput(new TriaInput(input_enum,values,interpolation_enum));
++}
++/*}}}*/
+ /*FUNCTION Tria::CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs) {{{*/
+ void  Tria::CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs){
+ 
+@@ -2642,6 +2650,14 @@
+ 	  this->inputs->AddInput(new TriaInput(SurfaceforcingsMassBalanceEnum,&smb[0],P1Enum));
+ }
+ /*}}}*/
++/*FUNCTION Tria::TMeltingPoint{{{*/
++IssmDouble Tria::TMeltingPoint(IssmDouble pressure){
++
++	_assert_(matpar);
++	return this->matpar->TMeltingPoint(pressure);
++
++}
++/*}}}*/
+ /*FUNCTION Tria::SetCurrentConfiguration {{{*/
+ void  Tria::SetCurrentConfiguration(Elements* elementsin, Loads* loadsin, Nodes* nodesin, Materials* materialsin, Parameters* parametersin){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16698)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16699)
+@@ -117,6 +117,7 @@
+ 		void        ResultToVector(Vector<IssmDouble>* vector,int output_enum);
+ 		void        ResetCoordinateSystem(void);
+ 		void	      SmbGradients();
++		IssmDouble  TMeltingPoint(IssmDouble pressure);
+ 		int         VelocityInterpolation();
+ 		int         PressureInterpolation();
+ 		IssmDouble  SurfaceArea(void);
+@@ -192,6 +193,7 @@
+ 		/*}}}*/
+ 		/*Tria specific routines:{{{*/
+ 		void           AddInput(int input_enum, IssmDouble* values, int interpolation_enum);
++		void           AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		ElementMatrix* CreateKMatrix(void);
+ 		ElementMatrix* CreateKMatrixBalancethickness(void);
+ 		ElementMatrix* CreateKMatrixBalancethickness_DG(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16698)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16699)
+@@ -123,10 +123,18 @@
+ /*FUNCTION Penta::AddInput{{{*/
+ void  Penta::AddInput(int input_enum,IssmDouble* values, int interpolation_enum){
+ 
+-	/*Call inputs method*/
++	_assert_(this->inputs);
+ 	this->inputs->AddInput(new PentaInput(input_enum,values,interpolation_enum));
+ }
+ /*}}}*/
++/*FUNCTION Penta::AddMaterialInput{{{*/
++void  Penta::AddMaterialInput(int input_enum,IssmDouble* values, int interpolation_enum){
++
++	_assert_(this->material);
++	this->material->inputs->AddInput(new TriaInput(input_enum,values,interpolation_enum));
++}
++/*}}}*/
++
+ /*FUNCTION Penta::BedNormal {{{*/
+ void Penta::BedNormal(IssmDouble* bed_normal, IssmDouble xyz_list[3][3]){
+ 
+@@ -3152,6 +3160,14 @@
+ 	  this->inputs->AddInput(new PentaInput(SurfaceforcingsMassBalanceEnum,&smb[0],P1Enum));
+ }
+ /*}}}*/
++/*FUNCTION Penta::TMeltingPoint{{{*/
++IssmDouble Penta::TMeltingPoint(IssmDouble pressure){
++
++	_assert_(matpar);
++	return this->matpar->TMeltingPoint(pressure);
++
++}
++/*}}}*/
+ /*FUNCTION Penta::SurfaceArea {{{*/
+ IssmDouble Penta::SurfaceArea(void){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16698)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16699)
+@@ -111,6 +111,7 @@
+ 		void   PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm);
+ 		void   ResetCoordinateSystem(void);
+ 		void   SmbGradients();
++		IssmDouble  TMeltingPoint(IssmDouble pressure);
+ 		IssmDouble SurfaceArea(void);
+ 		void   Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement);
+ 		int    NodalValue(IssmDouble* pvalue, int index, int natureofdataenum);
+@@ -181,6 +182,7 @@
+ 		/*}}}*/
+ 		/*Penta specific routines:{{{*/
+ 		void           AddInput(int input_enum, IssmDouble* values, int interpolation_enum);
++		void           AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		void	         BedNormal(IssmDouble* bed_normal, IssmDouble xyz_list[3][3]);
+ 		ElementMatrix* CreateBasalMassMatrix(void);
+ 		ElementMatrix* CreateKMatrix(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16698)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16699)
+@@ -66,6 +66,7 @@
+ 		/*}}}*/
+ 		/*Element virtual functions definitions: {{{*/
+ 		void        AddInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
++		void        AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
+ 		void        ComputeBasalStress(Vector<IssmDouble>* sigma_b){_error_("not implemented yet");};
+ 		void        ComputeStrainRate(Vector<IssmDouble>* eps){_error_("not implemented yet");};
+ 		void        ComputeStressTensor(){_error_("not implemented yet");};
+@@ -136,6 +137,7 @@
+ 		void        ResultToVector(Vector<IssmDouble>* vector,int output_enum){_error_("not implemented");};
+ 		void        ResetCoordinateSystem(void){_error_("not implemented yet");};
+ 		void	      SmbGradients(){_error_("not implemented yet");};
++		IssmDouble  TMeltingPoint(IssmDouble pressure){_error_("not implemented yet");};
+ 		IssmDouble  SurfaceArea(void){_error_("not implemented yet");};
+ 		void        Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement){_error_("not implemented yet");};
+ 		IssmDouble  TimeAdapt(){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16699-16700.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16699-16700.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16699-16700.diff	(revision 17802)
@@ -0,0 +1,122 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 16699)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 16700)
+@@ -99,5 +99,116 @@
+ 	element->GetSolutionFromInputsOneDof(solution,VzEnum);
+ }/*}}}*/
+ void StressbalanceVerticalAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	int          numnodes = element->GetNumberOfNodes();
++	int          numdof=numnodes*1;
++
++	int          i;
++	int          approximation;
++	int*         doflist  = NULL;
++	IssmDouble*  xyz_list = NULL;
++	IssmDouble   rho_ice,g;
++
++	IssmDouble*  values    = xNew<IssmDouble>(numdof);
++	IssmDouble*  vx        = xNew<IssmDouble>(numnodes);
++	IssmDouble*  vy        = xNew<IssmDouble>(numnodes);
++	IssmDouble*  vz        = xNew<IssmDouble>(numnodes);
++	IssmDouble*  vzSSA     = xNew<IssmDouble>(numnodes);
++	IssmDouble*  vzHO      = xNew<IssmDouble>(numnodes);
++	IssmDouble*  vzFS      = xNew<IssmDouble>(numnodes);
++	IssmDouble*  vel       = xNew<IssmDouble>(numnodes);
++	IssmDouble*  pressure  = xNew<IssmDouble>(numnodes);
++	IssmDouble*  surface   = xNew<IssmDouble>(numnodes);
++
++	/*Get the approximation and do nothing if the element in FS or None*/
++	element->GetInputValue(&approximation,ApproximationEnum);
++	if(approximation==FSApproximationEnum || approximation==NoneApproximationEnum){
++		return;
++	}
++
++	/*Get dof list and vertices coordinates: */
++	element->GetVerticesCoordinates(&xyz_list);
++	element->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
++
++	/*Use the dof list to index into the solution vector vz: */
++	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
++	for(i=0;i<numdof;i++){
++		vz[i]=values[i*1+0];
++
++		/*Check solution*/
++		if(xIsNan<IssmDouble>(vz[i])) _error_("NaN found in solution vector");
++	}
++
++	/*Get Vx and Vy*/
++	element->GetInputListOnNodes(&vx[0],VxEnum,0.0); //default is 0
++	element->GetInputListOnNodes(&vy[0],VyEnum,0.0); //default is 0
++
++	/*Do some modifications if we actually have a HOFS or SSAFS element*/
++	if(approximation==HOFSApproximationEnum){
++		Input* vzFS_input=element->GetInput(VzFSEnum);
++		if (vzFS_input){
++			if (vzFS_input->ObjectEnum()!=PentaInputEnum) _error_("Cannot compute Vel as VzFS is of type " << EnumToStringx(vzFS_input->ObjectEnum()));
++			element->GetInputListOnNodes(&vzFS[0],VzFSEnum,0.);
++		}
++		else _error_("Cannot compute Vz as VzFS in not present in HOFS element");
++		for(i=0;i<numnodes;i++){
++			vzHO[i]=vz[i];
++			vz[i]=vzHO[i]+vzFS[i];
++		}
++	}
++	else if(approximation==SSAFSApproximationEnum){
++		Input* vzFS_input=element->GetInput(VzFSEnum);
++		if (vzFS_input){
++			if (vzFS_input->ObjectEnum()!=PentaInputEnum) _error_("Cannot compute Vel as VzFS is of type " << EnumToStringx(vzFS_input->ObjectEnum()));
++			element->GetInputListOnNodes(&vzFS[0],VzFSEnum,0.);
++		}
++		else _error_("Cannot compute Vz as VzFS in not present in SSAFS element");
++		for(i=0;i<numnodes;i++){
++			vzSSA[i]=vz[i];
++			vz[i]=vzSSA[i]+vzFS[i];
++		}
++	}
++
++	/*Now Compute vel*/
++	for(i=0;i<numnodes;i++) vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5);
++
++	/*For pressure: we have not computed pressure in this analysis, for this element. We are in 3D, 
++	 *so the pressure is just the pressure at the z elevation: except it this is a HOFS element */
++	if(approximation!=HOFSApproximationEnum &&  approximation!=SSAFSApproximationEnum){
++		rho_ice = element->GetMaterialParameter(MaterialsRhoIceEnum);
++		g       = element->GetMaterialParameter(ConstantsGEnum);
++		element->GetInputListOnNodes(&surface[0],SurfaceEnum,0.);
++		for(i=0;i<numnodes;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
++	}
++
++	/*Now, we have to move the previous Vz inputs to old 
++	 * status, otherwise, we'll wipe them off and add the new inputs: */
++	element->InputChangeName(VzEnum,VzPicardEnum);
++
++	if(approximation!=HOFSApproximationEnum && approximation!=SSAFSApproximationEnum){
++		element->InputChangeName(PressureEnum,PressurePicardEnum);
++		element->AddInput(PressureEnum,pressure,P1Enum);
++	}
++	else if(approximation==HOFSApproximationEnum){
++		element->AddInput(VzHOEnum,vzHO,P1Enum);
++	}
++	else if(approximation==SSAFSApproximationEnum){
++		element->AddInput(VzSSAEnum,vzSSA,P1Enum);
++	}
++	element->AddInput(VzEnum,vz,P1Enum);
++	element->AddInput(VelEnum,vel,P1Enum);
++
++	/*Free ressources:*/
++	xDelete<IssmDouble>(surface);
++	xDelete<IssmDouble>(pressure);
++	xDelete<IssmDouble>(vel);
++	xDelete<IssmDouble>(vz);
++	xDelete<IssmDouble>(vzSSA);
++	xDelete<IssmDouble>(vzHO);
++	xDelete<IssmDouble>(vzFS);
++	xDelete<IssmDouble>(vy);
++	xDelete<IssmDouble>(vx);
++	xDelete<IssmDouble>(values);
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<int>(doflist);
+ }/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16700-16701.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16700-16701.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16700-16701.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/jenkins/parsing_rules
+===================================================================
+--- ../trunk-jpl/jenkins/parsing_rules	(revision 0)
++++ ../trunk-jpl/jenkins/parsing_rules	(revision 16701)
+@@ -0,0 +1,15 @@
++ok /not really/
++
++# match line starting with 'error ', case-insensitive
++error /.*\\berror:\\b.*/
++
++# list of warnings here...
++warning /[Ww]arning/
++warning /WARNING/
++
++# create a quick access link to lines in the report containing 'INFO'
++info /INFO/
++
++# each line containing 'BUILD' represents the start of a section for grouping errors and warnings found after the line.
++# also creates a quick access link.
++start /BUILD/
+
+Property changes on: ../trunk-jpl/jenkins/parsing_rules
+___________________________________________________________________
+Name: svn:executable
+   + *
+
Index: issm/oecreview/Archive/16554-17801/ISSM-16701-16702.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16701-16702.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16701-16702.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16701)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16702)
+@@ -2959,7 +2959,7 @@
+  
+ 	GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveEnum);
+ 	for(int i=0;i<NUMVERTICES;i++){
+-		if(!activeEpl[i])this->nodes[i]->Deactivate();
++		if(!reCast<bool>(activeEpl[i]))this->nodes[i]->Deactivate();
+ 	}
+ }
+ /*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16701)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16702)
+@@ -10970,7 +10970,7 @@
+ 	else{
+ 		GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveEnum);
+ 		for(int i=0;i<3;i++){
+-			if(!activeEpl[i])this->nodes[i]->Deactivate();
++			if(!reCast<bool>(activeEpl[i]))this->nodes[i]->Deactivate();
+ 		}
+ 	}
+ }
Index: issm/oecreview/Archive/16554-17801/ISSM-16702-16703.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16702-16703.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16702-16703.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/jenkins/linux64_murdo_ampi
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo_ampi	(revision 16702)
++++ ../trunk-jpl/jenkins/linux64_murdo_ampi	(revision 16703)
+@@ -13,7 +13,6 @@
+ 
+ #ISSM CONFIGURATION 
+ ISSM_CONFIG='--prefix=$ISSM_DIR\
+---prefix=$ISSM_DIR \
+ 				  --without-kriging \
+ 				  --without-kml \
+ 				  --with-gsl-dir=$ISSM_DIR/externalpackages/gsl/install \
Index: issm/oecreview/Archive/16554-17801/ISSM-16703-16704.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16703-16704.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16703-16704.diff	(revision 17802)
@@ -0,0 +1,4 @@
+Index: ../trunk-jpl/test/Archives/Archive3108.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-16704-16705.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16704-16705.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16704-16705.diff	(revision 17802)
@@ -0,0 +1,132 @@
+Index: ../trunk-jpl/jenkins/linux64_murdo_pythonandmatlab
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo_pythonandmatlab	(revision 0)
++++ ../trunk-jpl/jenkins/linux64_murdo_pythonandmatlab	(revision 16705)
+@@ -0,0 +1,121 @@
++#
++########### Configuration file for Eric Larour's Jenkins run on Murdo ############
++
++#-------------------------------#
++# 1: ISSM general configuration #
++#-------------------------------#
++
++#Nightly run name
++NAME="ISSM matlab tests on Linux64 (murdo)"
++
++#ISSM Architecture
++ISSM_ARCH="linux-gnu-amd64"
++
++#ISSM CONFIGURATION 
++ISSM_CONFIG='--prefix=$ISSM_DIR\
++	--with-matlab-dir=$MATLAB_DIR \
++	--with-triangle-dir=$ISSM_DIR/externalpackages/triangle/install \
++	--with-metis-dir=$ISSM_DIR/externalpackages/metis/install \
++	--with-mpi-include=$ISSM_DIR/externalpackages/mpich/install/include  \
++	--with-mpi-libflags="-L$ISSM_DIR/externalpackages/mpich/install/lib/ -lmpich" \
++	--with-petsc-dir=$ISSM_DIR/externalpackages/petsc/install \
++	--with-petsc-arch=$ISSM_ARCH \
++	--with-python-dir=$ISSM_DIR/externalpackages/python/install\
++	--with-python-numpy-dir=$ISSM_DIR/externalpackages/python/install/lib/python2.7/site-packages/numpy/core/include/numpy\
++	--with-mumps-dir=$ISSM_DIR/externalpackages/petsc/install/ \
++	--with-blas-lapack-dir=$ISSM_DIR/externalpackages/petsc/install \
++	--with-chaco-dir="$ISSM_DIR/externalpackages/chaco/install" \
++	--with-numthreads=18 \
++	--with-cxxoptflags="-mtune=barcelona -ffast-math -O3 -msse4.2 -Wno-write-strings "\
++	--with-graphics-lib="/usr/lib/x86_64-linux-gnu/libX11.so" \
++	--with-dakota-dir=$ISSM_DIR/externalpackages/dakota/install \
++	--with-boost-dir=$ISSM_DIR/externalpackages/boost/install/ \
++	--with-tao-dir=$ISSM_DIR/externalpackages/tao/install \
++	--enable-debugging '
++
++#MATLAB path
++MATLAB_PATH="/usr/local/matlab80/"
++
++#PYTHON and MATLAB testing
++MATLAB_TEST=1
++PYTHON_TEST=1
++
++#execution path used for parallel runs
++EXECUTION_PATH=$ISSM_DIR/execution
++
++#-----------------------------------#
++# 3: External packages installation #
++#-----------------------------------#
++
++#ISSM_EXTERNALPACKAGES can have 3 values:
++# - "install" install all external packages listed below
++# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
++# - "none"    leave external packages as is
++#             ->skip to section 4
++ISSM_EXTERNALPACKAGES="install"
++EXTERNALPACKAGESDIR=$ISSM_DIR/externalpackages
++
++#List of external pakages to be installed and their installation scripts
++EXTERNALPACKAGES="autotools install.sh                
++						matlab    install.sh                
++						mpich     install-3.0-linux64.sh    
++						cmake     install.sh                
++						petsc     install-3.4-linux64.sh    
++						triangle  install-linux64.sh        
++						boost     install.sh                
++						dakota    install-5.3.1-linux64.sh  
++						tao       install-2.2.sh
++						chaco     install.sh 
++						python        install-2.7.3-linux64.sh    
++						nose          install-linux64-python2.sh  
++						blas          install-linux64.sh          
++						lapack        install-linux64.sh          
++						git           install.sh                  
++						numpy         install-linux64.sh          
++						scipy         install-linux64.sh          
++						hdf5          install.sh                  
++						netcdf        install.sh                  
++						netcdf-python install.sh
++						shell2junit install.sh"
++
++
++#---------------------#
++# 4: ISSM Compilation #
++#---------------------#
++
++#ISSM_COMPILATION can have 2 values:
++# - "yes" compile ISSM
++# - "no"  do not compile ISSM
++ISSM_COMPILATION="yes"
++
++#----------------------#
++# 5: Mail notification #
++#----------------------#
++
++#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
++#sent to the adresses present in $ISSM_DIR/cron/mailinglist.
++SKIPMAIL="no"
++
++#Sender email address
++EMAIL_ADRESS="eric.larour@jpl.nasa.gov"
++
++#Mailing list
++MAILINGLIST="eric.larour@jpl.nasa.gov"
++
++#------------------------#
++# 6: Nightly run options #
++#------------------------#
++
++#number of cpus used in ISSM installation and compilation (one is usually
++#safer as some packages are very sensitive to parallel compilation)
++NUMCPUS_INSTALL=8
++
++#number of cpus used in the nightly runs.
++NUMCPUS_RUN=8
++
++#Nightly run options. The matlab routine runme.m will be called
++#as follows: runme($MATLAB_NROPTIONS). The options must be understandable
++#by Matlab and runme.m
++#ex: "'id',[101 102 103]"
++MATLAB_NROPTIONS=""
++PYTHON_NROPTIONS=""
+
+Property changes on: ../trunk-jpl/jenkins/linux64_murdo_pythonandmatlab
+___________________________________________________________________
+Name: svn:executable
+   + *
+
Index: issm/oecreview/Archive/16554-17801/ISSM-16705-16706.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16705-16706.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16705-16706.diff	(revision 17802)
@@ -0,0 +1,17 @@
+Index: ../trunk-jpl/jenkins/jenkins.sh
+===================================================================
+--- ../trunk-jpl/jenkins/jenkins.sh	(revision 16705)
++++ ../trunk-jpl/jenkins/jenkins.sh	(revision 16706)
+@@ -353,7 +353,10 @@
+ #look through numtests:
+ for i in `echo $testlist`
+ do
+-	juLog  -test=$i -name=Error -error=ERROR awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" matlab_log.log
+-	juLog  -test=$i -name=Failure -error=FAILURE awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" matlab_log.log
++	juLog  -test=$i -name=Matlab.Error -error=ERROR awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" matlab_log.log
++	juLog  -test=$i -name=Matlab.Failure -error=FAILURE awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" matlab_log.log
++	juLog  -test=$i -name=Python.Error -error=ERROR awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" python_log.log
++	juLog  -test=$i -name=Python.Failure -error=FAILURE awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" python_log.log
++
+ done
+ #}}}
Index: issm/oecreview/Archive/16554-17801/ISSM-16706-16707.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16706-16707.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16706-16707.diff	(revision 17802)
@@ -0,0 +1,62 @@
+Index: ../trunk-jpl/externalpackages/nose/install-macosx64-python2.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/nose/install-macosx64-python2.sh	(revision 16706)
++++ ../trunk-jpl/externalpackages/nose/install-macosx64-python2.sh	(revision 16707)
+@@ -12,3 +12,8 @@
+ cd src
+ python ./setup.py build
+ python ./setup.py install
++
++#to be flagged by jenkins, we create an empty install dir: 
++cd ../
++mkdir install
++touch install/emptyfile
+Index: ../trunk-jpl/externalpackages/nose/install-macosx64-python3.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/nose/install-macosx64-python3.sh	(revision 16706)
++++ ../trunk-jpl/externalpackages/nose/install-macosx64-python3.sh	(revision 16707)
+@@ -9,3 +9,8 @@
+ cd src
+ python ./setup.py build
+ python ./setup.py install
++
++#to be flagged by jenkins, we create an empty install dir: 
++cd ../
++mkdir install
++touch install/emptyfile
+Index: ../trunk-jpl/externalpackages/nose/install-linux64-python2.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/nose/install-linux64-python2.sh	(revision 16706)
++++ ../trunk-jpl/externalpackages/nose/install-linux64-python2.sh	(revision 16707)
+@@ -1,7 +1,7 @@
+ #!/bin/bash
+ #Install Python nose module
+ 
+-rm -rf src 
++rm -rf src  install
+ 
+ #Download from ISSM server
+ $ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/nose-1.1.2.tar.gz' 'nose-1.1.2.tar.gz'
+@@ -12,3 +12,9 @@
+ cd src
+ python ./setup.py build
+ python ./setup.py install
++
++#to be flagged by jenkins, we create an empty install dir: 
++cd ../
++mkdir install
++touch install/emptyfile
++
+Index: ../trunk-jpl/externalpackages/nose/install-linux64-python3.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/nose/install-linux64-python3.sh	(revision 16706)
++++ ../trunk-jpl/externalpackages/nose/install-linux64-python3.sh	(revision 16707)
+@@ -9,3 +9,8 @@
+ cd src
+ python ./setup.py build
+ python ./setup.py install
++
++#to be flagged by jenkins, we create an empty install dir: 
++cd ../
++mkdir install
++touch install/emptyfile
Index: issm/oecreview/Archive/16554-17801/ISSM-16707-16708.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16707-16708.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16707-16708.diff	(revision 17802)
@@ -0,0 +1,127 @@
+Index: ../trunk-jpl/externalpackages/nose/install-macosx64-python2.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/nose/install-macosx64-python2.sh	(revision 16707)
++++ ../trunk-jpl/externalpackages/nose/install-macosx64-python2.sh	(revision 16708)
+@@ -1,7 +1,7 @@
+ #!/bin/bash
+ #Install Python nose module
+ 
+-rm -rf src 
++rm -rf src  install
+ 
+ #Download from ISSM server
+ $ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/nose-1.1.2.tar.gz' 'nose-1.1.2.tar.gz'
+Index: ../trunk-jpl/externalpackages/nose/install-macosx64-python3.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/nose/install-macosx64-python3.sh	(revision 16707)
++++ ../trunk-jpl/externalpackages/nose/install-macosx64-python3.sh	(revision 16708)
+@@ -1,7 +1,7 @@
+ #!/bin/bash
+ #Install Python nose module
+ 
+-rm -rf src 
++rm -rf src  install
+ 
+ svn checkout http://python-nose.googlecode.com/svn/branches/py3k
+ mv py3k src
+Index: ../trunk-jpl/externalpackages/nose/install-linux64-python3.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/nose/install-linux64-python3.sh	(revision 16707)
++++ ../trunk-jpl/externalpackages/nose/install-linux64-python3.sh	(revision 16708)
+@@ -1,7 +1,7 @@
+ #!/bin/bash
+ #Install Python nose module
+ 
+-rm -rf src 
++rm -rf src  install
+ 
+ svn checkout http://python-nose.googlecode.com/svn/branches/py3k
+ mv py3k src
+Index: ../trunk-jpl/externalpackages/numpy/install-macosx-snowleopard.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/numpy/install-macosx-snowleopard.sh	(revision 16707)
++++ ../trunk-jpl/externalpackages/numpy/install-macosx-snowleopard.sh	(revision 16708)
+@@ -1,6 +1,8 @@
+ #!/bin/bash
+ set -eu
+ 
++rm -rf install
++
+ # On OSX 10.6, gfortran gets installed in /usr/local/gfortran 
+ export CC="/usr/local/gfortran/bin/gcc"
+ export CXX="/usr/local/gfortran/bin/g++"
+@@ -15,3 +17,8 @@
+ cd ..
+ python -c "import numpy; print 'Installed NumPy', numpy.__version__"
+ python -c "import numpy; numpy.test()"
++
++#to be flagged by jenkins, we create an empty install dir: 
++mkdir install
++touch install/emptyfile
++
+Index: ../trunk-jpl/externalpackages/numpy/install-macosx-mlion.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/numpy/install-macosx-mlion.sh	(revision 16707)
++++ ../trunk-jpl/externalpackages/numpy/install-macosx-mlion.sh	(revision 16708)
+@@ -1,6 +1,8 @@
+ #!/bin/bash
+ set -eu
+ 
++rm -rf install
++
+ export CC=gcc
+ export CXX=g++
+ export FFLAGS=-ff2c
+@@ -22,3 +24,8 @@
+ cd ..
+ python -c "import numpy; print 'Installed NumPy', numpy.__version__"
+ python -c "import numpy; numpy.test()"
++
++#to be flagged by jenkins, we create an empty install dir: 
++mkdir install
++touch install/emptyfile
++
+Index: ../trunk-jpl/externalpackages/numpy/install-linux64.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/numpy/install-linux64.sh	(revision 16707)
++++ ../trunk-jpl/externalpackages/numpy/install-linux64.sh	(revision 16708)
+@@ -1,6 +1,8 @@
+ #!/bin/bash
+ set -eu
+ 
++rm -rf install
++
+ export CC="gcc -fPIC"
+ export CXX="g++ -fPIC"
+ export F77="gfortran -fPIC"
+@@ -24,3 +26,8 @@
+ cd ..
+ python -c "import numpy; print 'Installed NumPy', numpy.__version__"
+ python -c "import numpy; numpy.test()"
++
++#to be flagged by jenkins, we create an empty install dir: 
++mkdir install
++touch install/emptyfile
++
+Index: ../trunk-jpl/externalpackages/numpy/install-macosx-lion.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/numpy/install-macosx-lion.sh	(revision 16707)
++++ ../trunk-jpl/externalpackages/numpy/install-macosx-lion.sh	(revision 16708)
+@@ -1,6 +1,8 @@
+ #!/bin/bash
+ set -eu
+ 
++rm -rf install
++
+ export CC=gcc
+ export CXX=g++
+ export FFLAGS=-ff2c
+@@ -22,3 +24,8 @@
+ cd ..
+ python -c "import numpy; print 'Installed NumPy', numpy.__version__"
+ python -c "import numpy; numpy.test()"
++
++#to be flagged by jenkins, we create an empty install dir: 
++mkdir install
++touch install/emptyfile
++
Index: issm/oecreview/Archive/16554-17801/ISSM-16708-16709.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16708-16709.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16708-16709.diff	(revision 17802)
@@ -0,0 +1,47 @@
+Index: ../trunk-jpl/test/NightlyRun/runme.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/runme.py	(revision 16708)
++++ ../trunk-jpl/test/NightlyRun/runme.py	(revision 16709)
+@@ -134,6 +134,7 @@
+ 			#Execute test
+ 			os.chdir(root)
+ 			id_string=IdToName(id)
++			print "----------------starting:%i-----------------------" % id
+ 			execfile('test'+str(id)+'.py',globals())
+ 
+ 			#UPDATE ARCHIVE?
+@@ -219,6 +220,7 @@
+ 							raise RuntimeError(me2)
+ 
+ 				f.close()
++				printf "----------------finished:%i-----------------------" % id
+ 
+ 		except Exception as me:
+ 
+@@ -240,6 +242,7 @@
+ 			else:
+ 				print 'FAILURE difference: N/A test id: %i test name: %s field: %s' % (id,id_string,'N/A')
+ 				raise RuntimeError(me)
++			printf "----------------finished:%i-----------------------" % id
+ 
+ 	return
+ 
+Index: ../trunk-jpl/jenkins/jenkins.sh
+===================================================================
+--- ../trunk-jpl/jenkins/jenkins.sh	(revision 16708)
++++ ../trunk-jpl/jenkins/jenkins.sh	(revision 16709)
+@@ -353,10 +353,9 @@
+ #look through numtests:
+ for i in `echo $testlist`
+ do
+-	juLog  -test=$i -name=Matlab.Error -error=ERROR awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" matlab_log.log
+-	juLog  -test=$i -name=Matlab.Failure -error=FAILURE awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" matlab_log.log
+-	juLog  -test=$i -name=Python.Error -error=ERROR awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" python_log.log
+-	juLog  -test=$i -name=Python.Failure -error=FAILURE awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" python_log.log
+-
++	juLog  -test=MATLAB-$i -name=Error -error=ERROR awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" matlab_log.log
++	juLog  -test=MATLAB-$i -name=Failure -error=FAILURE awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" matlab_log.log
++	juLog  -test=PYTHON-$i -name=Error -error=ERROR awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" python_log.log
++	juLog  -test=PYTHON-$i -name=Failure -error=FAILURE awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" python_log.log
+ done
+ #}}}
Index: issm/oecreview/Archive/16554-17801/ISSM-16709-16710.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16709-16710.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16709-16710.diff	(revision 17802)
@@ -0,0 +1,22 @@
+Index: ../trunk-jpl/test/NightlyRun/runme.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/runme.py	(revision 16709)
++++ ../trunk-jpl/test/NightlyRun/runme.py	(revision 16710)
+@@ -220,7 +220,7 @@
+ 							raise RuntimeError(me2)
+ 
+ 				f.close()
+-				printf "----------------finished:%i-----------------------" % id
++				print "----------------finished:%i-----------------------" % id
+ 
+ 		except Exception as me:
+ 
+@@ -242,7 +242,7 @@
+ 			else:
+ 				print 'FAILURE difference: N/A test id: %i test name: %s field: %s' % (id,id_string,'N/A')
+ 				raise RuntimeError(me)
+-			printf "----------------finished:%i-----------------------" % id
++			print "----------------finished:%i-----------------------" % id
+ 
+ 	return
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16710-16711.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16710-16711.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16710-16711.diff	(revision 17802)
@@ -0,0 +1,168 @@
+Index: ../trunk-jpl/jenkins/linux64_murdo_pythonandmatlab
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo_pythonandmatlab	(revision 16710)
++++ ../trunk-jpl/jenkins/linux64_murdo_pythonandmatlab	(revision 16711)
+@@ -1,121 +0,0 @@
+-#
+-########### Configuration file for Eric Larour's Jenkins run on Murdo ############
+-
+-#-------------------------------#
+-# 1: ISSM general configuration #
+-#-------------------------------#
+-
+-#Nightly run name
+-NAME="ISSM matlab tests on Linux64 (murdo)"
+-
+-#ISSM Architecture
+-ISSM_ARCH="linux-gnu-amd64"
+-
+-#ISSM CONFIGURATION 
+-ISSM_CONFIG='--prefix=$ISSM_DIR\
+-	--with-matlab-dir=$MATLAB_DIR \
+-	--with-triangle-dir=$ISSM_DIR/externalpackages/triangle/install \
+-	--with-metis-dir=$ISSM_DIR/externalpackages/metis/install \
+-	--with-mpi-include=$ISSM_DIR/externalpackages/mpich/install/include  \
+-	--with-mpi-libflags="-L$ISSM_DIR/externalpackages/mpich/install/lib/ -lmpich" \
+-	--with-petsc-dir=$ISSM_DIR/externalpackages/petsc/install \
+-	--with-petsc-arch=$ISSM_ARCH \
+-	--with-python-dir=$ISSM_DIR/externalpackages/python/install\
+-	--with-python-numpy-dir=$ISSM_DIR/externalpackages/python/install/lib/python2.7/site-packages/numpy/core/include/numpy\
+-	--with-mumps-dir=$ISSM_DIR/externalpackages/petsc/install/ \
+-	--with-blas-lapack-dir=$ISSM_DIR/externalpackages/petsc/install \
+-	--with-chaco-dir="$ISSM_DIR/externalpackages/chaco/install" \
+-	--with-numthreads=18 \
+-	--with-cxxoptflags="-mtune=barcelona -ffast-math -O3 -msse4.2 -Wno-write-strings "\
+-	--with-graphics-lib="/usr/lib/x86_64-linux-gnu/libX11.so" \
+-	--with-dakota-dir=$ISSM_DIR/externalpackages/dakota/install \
+-	--with-boost-dir=$ISSM_DIR/externalpackages/boost/install/ \
+-	--with-tao-dir=$ISSM_DIR/externalpackages/tao/install \
+-	--enable-debugging '
+-
+-#MATLAB path
+-MATLAB_PATH="/usr/local/matlab80/"
+-
+-#PYTHON and MATLAB testing
+-MATLAB_TEST=1
+-PYTHON_TEST=1
+-
+-#execution path used for parallel runs
+-EXECUTION_PATH=$ISSM_DIR/execution
+-
+-#-----------------------------------#
+-# 3: External packages installation #
+-#-----------------------------------#
+-
+-#ISSM_EXTERNALPACKAGES can have 3 values:
+-# - "install" install all external packages listed below
+-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
+-# - "none"    leave external packages as is
+-#             ->skip to section 4
+-ISSM_EXTERNALPACKAGES="install"
+-EXTERNALPACKAGESDIR=$ISSM_DIR/externalpackages
+-
+-#List of external pakages to be installed and their installation scripts
+-EXTERNALPACKAGES="autotools install.sh                
+-						matlab    install.sh                
+-						mpich     install-3.0-linux64.sh    
+-						cmake     install.sh                
+-						petsc     install-3.4-linux64.sh    
+-						triangle  install-linux64.sh        
+-						boost     install.sh                
+-						dakota    install-5.3.1-linux64.sh  
+-						tao       install-2.2.sh
+-						chaco     install.sh 
+-						python        install-2.7.3-linux64.sh    
+-						nose          install-linux64-python2.sh  
+-						blas          install-linux64.sh          
+-						lapack        install-linux64.sh          
+-						git           install.sh                  
+-						numpy         install-linux64.sh          
+-						scipy         install-linux64.sh          
+-						hdf5          install.sh                  
+-						netcdf        install.sh                  
+-						netcdf-python install.sh
+-						shell2junit install.sh"
+-
+-
+-#---------------------#
+-# 4: ISSM Compilation #
+-#---------------------#
+-
+-#ISSM_COMPILATION can have 2 values:
+-# - "yes" compile ISSM
+-# - "no"  do not compile ISSM
+-ISSM_COMPILATION="yes"
+-
+-#----------------------#
+-# 5: Mail notification #
+-#----------------------#
+-
+-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
+-#sent to the adresses present in $ISSM_DIR/cron/mailinglist.
+-SKIPMAIL="no"
+-
+-#Sender email address
+-EMAIL_ADRESS="eric.larour@jpl.nasa.gov"
+-
+-#Mailing list
+-MAILINGLIST="eric.larour@jpl.nasa.gov"
+-
+-#------------------------#
+-# 6: Nightly run options #
+-#------------------------#
+-
+-#number of cpus used in ISSM installation and compilation (one is usually
+-#safer as some packages are very sensitive to parallel compilation)
+-NUMCPUS_INSTALL=8
+-
+-#number of cpus used in the nightly runs.
+-NUMCPUS_RUN=8
+-
+-#Nightly run options. The matlab routine runme.m will be called
+-#as follows: runme($MATLAB_NROPTIONS). The options must be understandable
+-#by Matlab and runme.m
+-#ex: "'id',[101 102 103]"
+-MATLAB_NROPTIONS=""
+-PYTHON_NROPTIONS=""
+Index: ../trunk-jpl/jenkins/linux64_murdo
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo	(revision 16710)
++++ ../trunk-jpl/jenkins/linux64_murdo	(revision 16711)
+@@ -20,6 +20,8 @@
+ 	--with-mpi-libflags="-L$ISSM_DIR/externalpackages/mpich/install/lib/ -lmpich" \
+ 	--with-petsc-dir=$ISSM_DIR/externalpackages/petsc/install \
+ 	--with-petsc-arch=$ISSM_ARCH \
++	--with-python-dir=$ISSM_DIR/externalpackages/python/install\
++	--with-python-numpy-dir=$ISSM_DIR/externalpackages/python/install/lib/python2.7/site-packages/numpy/core/include/numpy\
+ 	--with-mumps-dir=$ISSM_DIR/externalpackages/petsc/install/ \
+ 	--with-blas-lapack-dir=$ISSM_DIR/externalpackages/petsc/install \
+ 	--with-chaco-dir="$ISSM_DIR/externalpackages/chaco/install" \
+@@ -36,7 +38,7 @@
+ 
+ #PYTHON and MATLAB testing
+ MATLAB_TEST=1
+-PYTHON_TEST=0
++PYTHON_TEST=1
+ 
+ #execution path used for parallel runs
+ EXECUTION_PATH=$ISSM_DIR/execution
+@@ -64,8 +66,19 @@
+ 						dakota    install-5.3.1-linux64.sh  
+ 						tao       install-2.2.sh
+ 						chaco     install.sh 
++						python        install-2.7.3-linux64.sh    
++						nose          install-linux64-python2.sh  
++						blas          install-linux64.sh          
++						lapack        install-linux64.sh          
++						git           install.sh                  
++						numpy         install-linux64.sh          
++						scipy         install-linux64.sh          
++						hdf5          install.sh                  
++						netcdf        install.sh                  
++						netcdf-python install.sh
+ 						shell2junit install.sh"
+ 
++
+ #---------------------#
+ # 4: ISSM Compilation #
+ #---------------------#
Index: issm/oecreview/Archive/16554-17801/ISSM-16711-16712.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16711-16712.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16711-16712.diff	(revision 17802)
@@ -0,0 +1,8 @@
+Index: ../trunk-jpl/test/Archives/Archive333.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive335.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-16712-16713.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16712-16713.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16712-16713.diff	(revision 17802)
@@ -0,0 +1,44 @@
+Index: ../trunk-jpl/jenkins/jenkins.sh
+===================================================================
+--- ../trunk-jpl/jenkins/jenkins.sh	(revision 16712)
++++ ../trunk-jpl/jenkins/jenkins.sh	(revision 16713)
+@@ -346,16 +346,28 @@
+ source $ISSM_DIR/externalpackages/shell2junit/install/sh2ju.sh
+ juLogClean
+ 
+-#number tests:
+-numtests=`cat matlab_log.log  | grep "\-\-\-\-\-\-\-\-starting" | wc -l`
+-testlist=`cat matlab_log.log  | grep "\-\-\-\-\-\-\-\-starting" | sed 's/----------------starting://g'  | sed 's/-//g'`
++if [ $MATLAB_TEST -eq 1 ]; then
++	#number tests:
++	numtests=`cat matlab_log.log  | grep "\-\-\-\-\-\-\-\-starting" | wc -l`
++	testlist=`cat matlab_log.log  | grep "\-\-\-\-\-\-\-\-starting" | sed 's/----------------starting://g'  | sed 's/-//g'`
+ 
+-#look through numtests:
+-for i in `echo $testlist`
+-do
+-	juLog  -test=MATLAB-$i -name=Error -error=ERROR awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" matlab_log.log
+-	juLog  -test=MATLAB-$i -name=Failure -error=FAILURE awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" matlab_log.log
+-	juLog  -test=PYTHON-$i -name=Error -error=ERROR awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" python_log.log
+-	juLog  -test=PYTHON-$i -name=Failure -error=FAILURE awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" python_log.log
+-done
++	#look through numtests:
++	for i in `echo $testlist`
++	do
++		juLog  -test=MATLAB-$i -name=Error -error=ERROR awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" matlab_log.log
++		juLog  -test=MATLAB-$i -name=Failure -error=FAILURE awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" matlab_log.log
++	done
++fi
++if [ $PYTHON_TEST -eq 1 ]; then
++	#number tests:
++	numtests=`cat python_log.log  | grep "\-\-\-\-\-\-\-\-starting" | wc -l`
++	testlist=`cat python_log.log  | grep "\-\-\-\-\-\-\-\-starting" | sed 's/----------------starting://g'  | sed 's/-//g'`
++
++	#look through numtests:
++	for i in `echo $testlist`
++	do
++		juLog  -test=PYTHON-$i -name=Error -error=ERROR awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" python_log.log
++		juLog  -test=PYTHON-$i -name=Failure -error=FAILURE awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" python_log.log
++	done
++fi
+ #}}}
Index: issm/oecreview/Archive/16554-17801/ISSM-16713-16714.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16713-16714.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16713-16714.diff	(revision 17802)
@@ -0,0 +1,15 @@
+Index: ../trunk-jpl/src/m/classes/clusters/greenplanet.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/clusters/greenplanet.m	(revision 16713)
++++ ../trunk-jpl/src/m/classes/clusters/greenplanet.m	(revision 16714)
+@@ -146,8 +146,8 @@
+ 			 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
+ 
+ 			 disp('launching solution sequence on remote cluster');
+-			 % launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
+-			 % 	 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && hostname && qsub ' modelname '.queue '];
++			  launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
++											 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && hostname && qsub ' modelname '.queue '];
+ 			 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
+ 		 end %}}}
+ 		 function Download(cluster,dirname,filelist)% {{{
Index: issm/oecreview/Archive/16554-17801/ISSM-16714-16715.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16714-16715.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16714-16715.diff	(revision 17802)
@@ -0,0 +1,273 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16714)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16715)
+@@ -20,7 +20,8 @@
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void GetSolutionFromInputsFS(Vector<IssmDouble>* solution,Element* element);
+ 		void GetSolutionFromInputsHoriz(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void InputUpdateFromSolutionFS(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionHoriz(IssmDouble* solution,Element* element);
+-		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 16714)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 16715)
+@@ -58,5 +58,9 @@
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+ void L2ProjectionBaseAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	int inputenum;
++
++	element->FindParam(&inputenum,InputToL2ProjectEnum);
++	element->InputUpdateFromSolutionOneDofCollapsed(solution,inputenum);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16714)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16715)
+@@ -934,7 +934,7 @@
+ 	element->GetInputValue(&approximation,ApproximationEnum);
+ 	switch(approximation){
+ 		case FSApproximationEnum: case NoneApproximationEnum:
+-			//InputUpdateFromSolutionFS(solution,element);
++			InputUpdateFromSolutionFS(solution,element);
+ 			return;
+ 		case SSAApproximationEnum: case HOApproximationEnum: case SIAApproximationEnum:
+ 			InputUpdateFromSolutionHoriz(solution,element);
+@@ -1034,3 +1034,86 @@
+ 	xDelete<int>(doflist);
+ 
+ }/*}}}*/
++void StressbalanceAnalysis::InputUpdateFromSolutionFS(IssmDouble* solution,Element* element){/*{{{*/
++
++	int          i;
++	int*         vdoflist=NULL;
++	int*         pdoflist=NULL;
++	IssmDouble   FSreconditioning;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int vnumnodes = element->GetNumberOfNodesVelocity();
++	int pnumnodes = element->GetNumberOfNodesPressure();
++	int vnumdof   = vnumnodes*3;
++	int pnumdof   = pnumnodes*1;
++
++	/*Initialize values*/
++	IssmDouble* values   = xNew<IssmDouble>(vnumdof+pnumdof);
++	IssmDouble* vx       = xNew<IssmDouble>(vnumnodes);
++	IssmDouble* vy       = xNew<IssmDouble>(vnumnodes);
++	IssmDouble* vz       = xNew<IssmDouble>(vnumnodes);
++	IssmDouble* vel      = xNew<IssmDouble>(vnumnodes);
++	IssmDouble* pressure = xNew<IssmDouble>(pnumnodes);
++
++	/*Prepare coordinate system list*/
++	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
++	for(i=0;i<vnumnodes;i++) cs_list[i]           = XYZEnum;
++	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
++
++	/*Get dof list: */
++	element->GetDofListVelocity(&vdoflist,GsetEnum);
++	element->GetDofListPressure(&pdoflist,GsetEnum);
++
++	/*Use the dof list to index into the solution vector: */
++	for(i=0;i<vnumdof;i++) values[i]        =solution[vdoflist[i]];
++	for(i=0;i<pnumdof;i++) values[vnumdof+i]=solution[pdoflist[i]];
++
++	/*Transform solution in Cartesian Space*/
++	element->TransformSolutionCoord(&values[0],&cs_list[0]);
++
++	/*Ok, we have vx and vy in values, fill in all arrays: */
++	for(i=0;i<vnumnodes;i++){
++		vx[i] = values[i*NDOF3+0];
++		vy[i] = values[i*NDOF3+1];
++		vz[i] = values[i*NDOF3+2];
++		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
++		if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
++		if(xIsNan<IssmDouble>(vz[i])) _error_("NaN found in solution vector");
++	}
++	for(i=0;i<pnumnodes;i++){
++		pressure[i] = values[vnumdof+i];
++		if(xIsNan<IssmDouble>(pressure[i])) _error_("NaN found in solution vector");
++	}
++
++	/*Recondition pressure and compute vel: */
++	element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
++	for(i = 0;i<pnumnodes;i++) pressure[i] = pressure[i]*FSreconditioning;
++	for(i = 0;i<vnumnodes;i++) vel[i]      = sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
++
++	/*Now, we have to move the previous inputs  to old 
++	 * status, otherwise, we'll wipe them off: */
++	element->InputChangeName(VxEnum,VxPicardEnum);
++	element->InputChangeName(VyEnum,VyPicardEnum);
++	element->InputChangeName(VzEnum,VzPicardEnum);
++	element->InputChangeName(PressureEnum,PressurePicardEnum);
++
++	/*Add vx and vy as inputs to the tria element: */
++	element->AddInput(VxEnum,vx,P1Enum);
++	element->AddInput(VyEnum,vy,P1Enum);
++	element->AddInput(VzEnum,vz,P1Enum);
++	element->AddInput(VelEnum,vel,P1Enum);
++	element->AddInput(PressureEnum,pressure,P1Enum);
++
++	/*Free ressources:*/
++	xDelete<IssmDouble>(pressure);
++	xDelete<IssmDouble>(vel);
++	xDelete<IssmDouble>(vz);
++	xDelete<IssmDouble>(vy);
++	xDelete<IssmDouble>(vx);
++	xDelete<IssmDouble>(values);
++	xDelete<int>(vdoflist);
++	xDelete<int>(pdoflist);
++	xDelete<int>(cs_list);
++
++
++}/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16714)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16715)
+@@ -49,12 +49,15 @@
+ 		virtual int    FiniteElement(void)=0;
+ 		virtual IssmDouble GetMaterialParameter(int enum_in)=0;
+ 		virtual void   TransformSolutionCoord(IssmDouble* values,int transformenum)=0;
++		virtual void   TransformSolutionCoord(IssmDouble* values,int* transformenum_list)=0;
+ 		virtual void	GetDofList(int** pdoflist,int approximation_enum,int setenum)=0;
+ 		virtual void	GetDofListVelocity(int** pdoflist,int setenum)=0;
+ 		virtual void	GetDofListPressure(int** pdoflist,int setenum)=0;
+ 		virtual void   GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int solutionenum)=0;
+ 		virtual int    GetNodeIndex(Node* node)=0;
+ 		virtual int    GetNumberOfNodes(void)=0;
++		virtual int    GetNumberOfNodesVelocity(void)=0;
++		virtual int    GetNumberOfNodesPressure(void)=0;
+ 		virtual void   GetNodesSidList(int* sidlist)=0;
+ 		virtual void   GetNodesLidList(int* sidlist)=0;
+ 
+@@ -84,6 +87,7 @@
+ 		virtual void   Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finite_element)=0;
+ 		virtual void   InputDuplicate(int original_enum,int new_enum)=0;
+ 		virtual void   InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code)=0;
++		virtual void   InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solution,int inputenum)=0;
+ 
+ 		virtual int    NodalValue(IssmDouble* pvalue, int index, int natureofdataenum)=0;
+ 		virtual int    NumberofNodesVelocity(void)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16714)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16715)
+@@ -88,6 +88,8 @@
+ 		void        GetNodesSidList(int* sidlist);
+ 		void        GetNodesLidList(int* lidlist);
+ 		int         GetNumberOfNodes(void);
++		int         GetNumberOfNodesPressure(void){_error_("not implemented yet");};
++		int         GetNumberOfNodesVelocity(void){_error_("not implemented yet");};
+ 		int         Sid();
+ 		bool        IsOnBed();
+ 		bool        HasEdgeOnBed();
+@@ -256,6 +258,7 @@
+ 		void           GetStrainRate2d(IssmDouble* epsilon,IssmDouble* xyz_list, GaussTria* gauss, Input* vx_input, Input* vy_input);
+ 		void	         InputChangeName(int enum_type,int enum_type_old);
+ 		void	         InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type);
++		void	         InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solution,int enum_type){_error_("not implemented yet");};
+ 		void	         InputUpdateFromSolutionMasstransport(IssmDouble* solution);
+ 		bool	         IsInput(int name);
+ 		Gauss*         NewGauss(void);
+@@ -263,6 +266,7 @@
+ 		Seg*	         SpawnSeg(int index1,int index2);
+ 		void	         SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]);
+ 		void           TransformSolutionCoord(IssmDouble* values,int transformenum);
++		void           TransformSolutionCoord(IssmDouble* values,int* transformenum_list){_error_("not implemented yet");};
+ 		#ifdef _HAVE_STRESSBALANCE_
+ 		ElementMatrix* CreateKMatrixStressbalanceSSA(void);
+ 		ElementMatrix* CreateKMatrixStressbalanceSSAViscous(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16714)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16715)
+@@ -1358,6 +1358,16 @@
+ 	return this->NumberofNodes();
+ }
+ /*}}}*/
++/*FUNCTION Penta::GetNumberOfNodesPressure;{{{*/
++int Penta::GetNumberOfNodesPressure(void){
++	return this->NumberofNodesPressure();
++}
++/*}}}*/
++/*FUNCTION Penta::GetNumberOfNodesVelocity;{{{*/
++int Penta::GetNumberOfNodesVelocity(void){
++	return this->NumberofNodesVelocity();
++}
++/*}}}*/
+ /*FUNCTION Penta::GetInput(int inputenum) {{{*/
+ Input* Penta::GetInput(int inputenum){
+ 	return inputs->GetInput(inputenum);
+@@ -3280,6 +3290,13 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Penta::TransformSolutionCoord{{{*/
++void Penta::TransformSolutionCoord(IssmDouble* values,int* transformenum_list){
++
++	::TransformSolutionCoord(values,this->nodes,this->NumberofNodes(),transformenum_list);
++
++}
++/*}}}*/
+ /*FUNCTION Penta::Update {{{*/
+ void Penta::Update(int index,IoModel* iomodel,int analysis_counter,int analysis_type,int finiteelement_type){ 
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16714)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16715)
+@@ -90,6 +90,8 @@
+ 		void   GetNodesSidList(int* sidlist);
+ 		void   GetNodesLidList(int* lidlist);
+ 		int    GetNumberOfNodes(void);
++		int    GetNumberOfNodesPressure(void);
++		int    GetNumberOfNodesVelocity(void);
+ 		IssmDouble GetMaterialParameter(int enum_in);
+ 		void   GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
+ 		IssmDouble GetZcoord(GaussPenta* gauss);
+@@ -241,6 +243,7 @@
+ 		Tria*	         SpawnTria(int location);
+ 		void	         SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]);
+ 		void           TransformSolutionCoord(IssmDouble* values,int transformenum);
++		void           TransformSolutionCoord(IssmDouble* values,int* transformenum_list);
+ 
+ 		#ifdef _HAVE_STRESSBALANCE_
+ 		ElementMatrix* CreateKMatrixCouplingSSAHO(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16714)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16715)
+@@ -53,7 +53,8 @@
+ 		Object *copy();
+ 		/*}}}*/
+ 		/*Update virtual functions resolution: {{{*/
+-		void  InputUpdateFromSolution(IssmDouble* solutiong){_error_("not implemented yet");};
++		void  InputUpdateFromSolution(IssmDouble* solution){_error_("not implemented yet");};
++		void  InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solution,int inputenum){_error_("not implemented yet");};
+ 		void  InputUpdateFromVector(IssmDouble* vector, int name, int type){_error_("not implemented yet");};
+ #ifdef _HAVE_DAKOTA_
+ 		void  InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){_error_("not implemented yet");};
+@@ -92,6 +93,8 @@
+ 		void        GetNodesSidList(int* sidlist){_error_("not implemented yet");};
+ 		void        GetNodesLidList(int* lidlist){_error_("not implemented yet");};
+ 		int         GetNumberOfNodes(void){_error_("not implemented yet");};
++		int         GetNumberOfNodesVelocity(void){_error_("not implemented yet");};
++		int         GetNumberOfNodesPressure(void){_error_("not implemented yet");};
+ 		void        GetVerticesCoordinates(IssmDouble** pxyz_list){_error_("not implemented yet");};
+ 		int         Sid(){_error_("not implemented yet");};
+ 		void        InputChangeName(int input_enum, int enum_type_old){_error_("not implemented yet");};
+@@ -142,6 +145,7 @@
+ 		void        Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement){_error_("not implemented yet");};
+ 		IssmDouble  TimeAdapt(){_error_("not implemented yet");};
+ 		void        TransformSolutionCoord(IssmDouble* values,int transformenum){_error_("not implemented yet");};
++		void        TransformSolutionCoord(IssmDouble* values,int* transformenum_list){_error_("not implemented yet");};
+ 		void UpdateConstraintsExtrudeFromBase(){_error_("not implemented");};
+ 		void UpdateConstraintsExtrudeFromTop(){_error_("not implemented");};
+ 		void UpdateConstraintsL2ProjectionEPL(){_error_("not implemented");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16715-16716.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16715-16716.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16715-16716.diff	(revision 17802)
@@ -0,0 +1,69 @@
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16715)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16716)
+@@ -145,11 +145,12 @@
+ 				solutionsequence_linear(femmodel);
+ 				femmodel->parameters->SetParam(EplHeadSlopeYEnum,InputToL2ProjectEnum);
+ 				solutionsequence_linear(femmodel);
++
+ 				femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
+-
+ 				femmodel->HydrologyEPLThicknessx();
+-				//updating mask after the computation of the epl thickness
++				//updating mask after the computation of the epl thickness (Allow to close too thin EPL)
+ 				femmodel->HydrologyEPLupdateDomainx();
++
+ 				femmodel->HydrologyTransferx();
+ 				SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
+ 				CreateNodalConstraintsx(&ys,femmodel->nodes,HydrologyDCEfficientAnalysisEnum);
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_linear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_linear.cpp	(revision 16715)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_linear.cpp	(revision 16716)
+@@ -22,8 +22,8 @@
+ 	/*Recover parameters: */
+ 	femmodel->parameters->FindParam(&configuration_type,ConfigurationTypeEnum);
+ 	femmodel->UpdateConstraintsx();
++	SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
+ 
+-	SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
+ 	CreateNodalConstraintsx(&ys,femmodel->nodes,configuration_type);
+ 	Reduceloadx(pf, Kfs, ys); delete Kfs;
+ 	Solverx(&uf, Kff, pf, NULL, df, femmodel->parameters); 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16715)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16716)
+@@ -2959,7 +2959,12 @@
+  
+ 	GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveEnum);
+ 	for(int i=0;i<NUMVERTICES;i++){
+-		if(!reCast<bool>(activeEpl[i]))this->nodes[i]->Deactivate();
++		if(!reCast<bool>(activeEpl[i])){
++			this->nodes[i]->Deactivate();
++		}
++		else{
++			this->nodes[i]->Activate();
++		}
+ 	}
+ }
+ /*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16715)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16716)
+@@ -10987,7 +10987,12 @@
+ 	else{
+ 		GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveEnum);
+ 		for(int i=0;i<3;i++){
+-			if(!reCast<bool>(activeEpl[i]))this->nodes[i]->Deactivate();
++			if(!reCast<bool>(activeEpl[i])){
++				this->nodes[i]->Deactivate();
++			}
++			else{
++				this->nodes[i]->Activate();
++			}
+ 		}
+ 	}
+ }
Index: issm/oecreview/Archive/16554-17801/ISSM-16716-16717.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16716-16717.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16716-16717.diff	(revision 17802)
@@ -0,0 +1,151 @@
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 16716)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 16717)
+@@ -59,8 +59,17 @@
+ }/*}}}*/
+ void L2ProjectionBaseAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	int inputenum;
++	int inputenum,meshtype;
+ 
+ 	element->FindParam(&inputenum,InputToL2ProjectEnum);
+-	element->InputUpdateFromSolutionOneDofCollapsed(solution,inputenum);
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			element->InputUpdateFromSolutionOneDof(solution,inputenum);
++			break;
++		case Mesh3DEnum:
++			element->InputUpdateFromSolutionOneDofCollapsed(solution,inputenum);
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 16716)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 16717)
+@@ -167,5 +167,84 @@
+ 	xDelete<IssmDouble>(values);
+ }/*}}}*/
+ void StressbalanceSIAAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	int         i,meshtype;
++	IssmDouble  rho_ice,g;
++	int*        doflist=NULL;
++	IssmDouble* xyz_list=NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++	int numdof   = numnodes*2;
++
++	/*Fetch dof list and allocate solution vectors*/
++	element->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
++	IssmDouble* values    = xNew<IssmDouble>(numdof);
++	IssmDouble* vx        = xNew<IssmDouble>(numdof);
++	IssmDouble* vy        = xNew<IssmDouble>(numdof);
++	IssmDouble* vz        = xNew<IssmDouble>(numdof);
++	IssmDouble* vel       = xNew<IssmDouble>(numdof);
++	IssmDouble* pressure  = xNew<IssmDouble>(numdof);
++	IssmDouble* thickness = xNew<IssmDouble>(numdof);
++	IssmDouble* surface   = xNew<IssmDouble>(numnodes);
++
++	/*Use the dof list to index into the solution vector: */
++	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
++
++	/*Transform solution in Cartesian Space*/
++	element->TransformSolutionCoord(&values[0],XYEnum);
++
++	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
++	for(i=0;i<numnodes;i++){
++		vx[i]=values[i*NDOF2+0];
++		vy[i]=values[i*NDOF2+1];
++
++		/*Check solution*/
++		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
++		if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
++	}
++
++	/*Get Vz and compute vel*/
++	element->GetInputListOnNodes(&vz[0],VzEnum,0.);
++	for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
++
++	/*For pressure: we have not computed pressure in this analysis, for this element. We are in 2D, 
++	 *so the pressure is just the pressure at the bedrock: */
++	rho_ice = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	g       = element->GetMaterialParameter(ConstantsGEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			element->GetInputListOnNodes(&thickness[0],ThicknessEnum);
++			for(i=0;i<numnodes;i++) pressure[i]=rho_ice*g*thickness[i];
++			break;
++		case Mesh3DEnum:   
++			element->GetVerticesCoordinates(&xyz_list);
++			element->GetInputListOnNodes(&surface[0],SurfaceEnum);
++			for(i=0;i<numnodes;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Now, we have to move the previous Vx and Vy inputs  to old 
++	 * status, otherwise, we'll wipe them off: */
++	element->InputChangeName(VxEnum,VxPicardEnum);
++	element->InputChangeName(VyEnum,VyPicardEnum);
++	element->InputChangeName(PressureEnum,PressurePicardEnum);
++
++	/*Add vx and vy as inputs to the tria element: */
++	element->AddInput(VxEnum,vx,P1Enum);
++	element->AddInput(VyEnum,vy,P1Enum);
++	element->AddInput(VelEnum,vel,P1Enum);
++	element->AddInput(PressureEnum,pressure,P1Enum);
++
++	/*Free ressources:*/
++	xDelete<IssmDouble>(thickness);
++	xDelete<IssmDouble>(surface);
++	xDelete<IssmDouble>(pressure);
++	xDelete<IssmDouble>(vel);
++	xDelete<IssmDouble>(vz);
++	xDelete<IssmDouble>(vy);
++	xDelete<IssmDouble>(vx);
++	xDelete<IssmDouble>(values);
++	xDelete<int>(doflist);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16716)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16717)
+@@ -940,7 +940,7 @@
+ 			InputUpdateFromSolutionHoriz(solution,element);
+ 			return;
+ 		case L1L2ApproximationEnum:
+-			//InputUpdateFromSolutionHoriz(solution,element);
++			InputUpdateFromSolutionHoriz(solution,element);
+ 			return;
+ 		case SSAHOApproximationEnum: case HOFSApproximationEnum: case SSAFSApproximationEnum:
+ 			/*the elements around will create the solution*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16716)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16717)
+@@ -88,6 +88,7 @@
+ 		virtual void   InputDuplicate(int original_enum,int new_enum)=0;
+ 		virtual void   InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code)=0;
+ 		virtual void   InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solution,int inputenum)=0;
++		virtual void   InputUpdateFromSolutionOneDof(IssmDouble* solution,int inputenum)=0;
+ 
+ 		virtual int    NodalValue(IssmDouble* pvalue, int index, int natureofdataenum)=0;
+ 		virtual int    NumberofNodesVelocity(void)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16716)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16717)
+@@ -55,6 +55,7 @@
+ 		/*Update virtual functions resolution: {{{*/
+ 		void  InputUpdateFromSolution(IssmDouble* solution){_error_("not implemented yet");};
+ 		void  InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solution,int inputenum){_error_("not implemented yet");};
++		void  InputUpdateFromSolutionOneDof(IssmDouble* solution,int inputenum){_error_("not implemented yet");};
+ 		void  InputUpdateFromVector(IssmDouble* vector, int name, int type){_error_("not implemented yet");};
+ #ifdef _HAVE_DAKOTA_
+ 		void  InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16717-16718.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16717-16718.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16717-16718.diff	(revision 17802)
@@ -0,0 +1,20 @@
+Index: ../trunk-jpl/src/m/shp/shpwrite.m
+===================================================================
+--- ../trunk-jpl/src/m/shp/shpwrite.m	(revision 16717)
++++ ../trunk-jpl/src/m/shp/shpwrite.m	(revision 16718)
+@@ -13,10 +13,13 @@
+ %initialize number of profile
+ count=0;
+ 
+-
+ contours=struct([]);
+ for i=1:length(shp),
+-	contours(i).Geometry='Polygon';
++	if strcmpi(shp(i).Geometry,'Point'),
++		contours(i).Geometry='Point';
++	else strcmpi(shp(i).Geometry,'Polygon'),
++		contours(i).Geometry='Polygon';
++	end
+ 	contours(i).id=i;
+ 	contours(i).X=shp(i).x;
+ 	contours(i).Y=shp(i).y;
Index: issm/oecreview/Archive/16554-17801/ISSM-16718-16719.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16718-16719.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16718-16719.diff	(revision 17802)
@@ -0,0 +1,25 @@
+Index: ../trunk-jpl/etc/environment.csh
+===================================================================
+--- ../trunk-jpl/etc/environment.csh	(revision 16718)
++++ ../trunk-jpl/etc/environment.csh	(revision 16719)
+@@ -95,3 +95,9 @@
+ if (-d $YAMS_DIR) then
+ 	setenv PATH {$PATH}:{$YAMS_DIR}/bin
+ endif
++
++#SHELL2JUNIT
++set SHELL2JUNIT_DIR="$ISSM_DIR/externalpackages/shell2junit"
++if (-d $SHELL2JUNIT_DIR) then
++	setenv PATH {$PATH}:{$SHELL2JUNIT_DIR}/install
++endif
+Index: ../trunk-jpl/etc/environment.sh
+===================================================================
+--- ../trunk-jpl/etc/environment.sh	(revision 16718)
++++ ../trunk-jpl/etc/environment.sh	(revision 16719)
+@@ -286,3 +286,6 @@
+ 
+ #INISHELL
+ pathappend   "$ISSM_DIR/externalpackages/inishell/install"
++
++#SHELL2JUNIT
++pathappend   "$ISSM_DIR/externalpackages/shell2junit/install"
Index: issm/oecreview/Archive/16554-17801/ISSM-16719-16720.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16719-16720.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16719-16720.diff	(revision 17802)
@@ -0,0 +1,198 @@
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16719)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16720)
+@@ -215,5 +215,78 @@
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+ void MasstransportAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	int        i,hydroadjustment;
++	int*       doflist=NULL;
++	IssmDouble rho_ice,rho_water,minthickness;
++	//Element* basalelement=element->SpawnBasalElement();
++	Element* basalelement=element;
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = basalelement->GetNumberOfNodes();
++
++	/*Fetch dof list and allocate solution vector*/
++	basalelement->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
++	IssmDouble* newthickness = xNew<IssmDouble>(numnodes);
++	IssmDouble* newbed       = xNew<IssmDouble>(numnodes);
++	IssmDouble* newsurface   = xNew<IssmDouble>(numnodes);
++	IssmDouble* oldthickness = xNew<IssmDouble>(numnodes);
++	IssmDouble* oldbed       = xNew<IssmDouble>(numnodes);
++	IssmDouble* oldsurface   = xNew<IssmDouble>(numnodes);
++	IssmDouble* phi          = xNew<IssmDouble>(numnodes);
++
++	/*Use the dof list to index into the solution vector: */
++	basalelement->FindParam(&minthickness,MasstransportMinThicknessEnum);
++	for(i=0;i<numnodes;i++){
++		newthickness[i]=solution[doflist[i]];
++		if(xIsNan<IssmDouble>(newthickness[i])) _error_("NaN found in solution vector");
++		/*Constrain thickness to be at least 1m*/
++		if(newthickness[i]<minthickness) newthickness[i]=minthickness;
++	}
++
++	/*Get previous bed, thickness and surface*/
++	basalelement->GetInputListOnNodes(&oldbed[0],BedEnum);
++	basalelement->GetInputListOnNodes(&oldsurface[0],SurfaceEnum);
++	basalelement->GetInputListOnNodes(&oldthickness[0],ThicknessEnum);
++	basalelement->GetInputListOnNodes(&phi[0],MaskGroundediceLevelsetEnum);
++
++	/*Find MasstransportHydrostaticAdjustment to figure out how to update the geometry:*/
++	basalelement->FindParam(&hydroadjustment,MasstransportHydrostaticAdjustmentEnum);
++	rho_ice   = basalelement->GetMaterialParameter(MaterialsRhoIceEnum);
++	rho_water = basalelement->GetMaterialParameter(MaterialsRhoWaterEnum);
++
++	for(i=0;i<numnodes;i++) {
++		/*If shelf: hydrostatic equilibrium*/
++		if (phi[i]>0.){
++			newsurface[i] = oldbed[i]+newthickness[i]; //surface = oldbed + newthickness
++			newbed[i]     = oldbed[i];                 //same bed: do nothing
++		}
++		else{ //this is an ice shelf
++			if(hydroadjustment==AbsoluteEnum){
++				newsurface[i] = newthickness[i]*(1-rho_ice/rho_water);
++				newbed[i]     = newthickness[i]*(-rho_ice/rho_water);
++			}
++			else if(hydroadjustment==IncrementalEnum){
++				newsurface[i] = oldsurface[i]+(1.0-rho_ice/rho_water)*(newthickness[i]-oldthickness[i]); //surface = oldsurface + (1-di) * dH
++				newbed[i]     = oldbed[i]-rho_ice/rho_water*(newthickness[i]-oldthickness[i]); //bed               = oldbed + di * dH
++			}
++			else _error_("Hydrostatic adjustment " << hydroadjustment << " (" << EnumToStringx(hydroadjustment) << ") not supported yet");
++		}
++	}
++
++	/*Add input to the element: */
++	element->AddBasalInput(ThicknessEnum,newthickness,P1Enum);
++	element->AddBasalInput(SurfaceEnum,newsurface,P1Enum);
++	element->AddBasalInput(BedEnum,newbed,P1Enum);
++
++	/*Free ressources:*/
++	xDelete<IssmDouble>(newthickness);
++	xDelete<IssmDouble>(newbed);
++	xDelete<IssmDouble>(newsurface);
++	xDelete<IssmDouble>(oldthickness);
++	xDelete<IssmDouble>(oldbed);
++	xDelete<IssmDouble>(oldsurface);
++	xDelete<IssmDouble>(phi);
++	xDelete<int>(doflist);
++	if(basalelement!=element) delete element;
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16719)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16720)
+@@ -38,6 +38,7 @@
+ 		virtual void   Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters)=0;
+ 		virtual void   SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters)=0;
+ 		virtual void   SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum)=0;
++		virtual void   AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
+ 		virtual void   AddInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
+ 		virtual void   AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
+ 		virtual void   CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>*  Kfs)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16719)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16720)
+@@ -165,6 +165,23 @@
+ 	*po_nz=o_nz;
+ }
+ /*}}}*/
++/*FUNCTION Tria::AddBasalInput{{{*/
++void  Tria::AddBasalInput(int input_enum,IssmDouble* values, int interpolation_enum){
++
++	/*Call inputs method*/
++	_assert_(this->inputs);
++	
++	int meshtype;
++	parameters->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			this->inputs->AddInput(new TriaInput(input_enum,values,interpolation_enum));
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++}
++/*}}}*/
+ /*FUNCTION Tria::AddInput{{{*/
+ void  Tria::AddInput(int input_enum,IssmDouble* values, int interpolation_enum){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16719)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16720)
+@@ -194,6 +194,7 @@
+ 
+ 		/*}}}*/
+ 		/*Tria specific routines:{{{*/
++		void           AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		void           AddInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		void           AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		ElementMatrix* CreateKMatrix(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16719)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16720)
+@@ -127,6 +127,33 @@
+ 	this->inputs->AddInput(new PentaInput(input_enum,values,interpolation_enum));
+ }
+ /*}}}*/
++/*FUNCTION Penta::AddBasalInput{{{*/
++void  Penta::AddBasalInput(int input_enum,IssmDouble* values, int interpolation_enum){
++
++	_assert_(this->inputs);
++	if(!IsOnBed()) return;
++	else{
++		if(interpolation_enum==P1Enum){
++			int        i;
++			IssmDouble extrudedvalues[NUMVERTICES];
++			Penta*     penta=NULL;
++
++			for(i=1;i<NUMVERTICES2D;i++){
++				extrudedvalues[i]=values[i];
++				extrudedvalues[i+NUMVERTICES2D]=values[i];
++			}
++			this->inputs->AddInput(new PentaInput(input_enum,&extrudedvalues[0],P1Enum));
++			penta=this;
++			for(;;){
++				penta->inputs->AddInput(new PentaInput(input_enum,&extrudedvalues[0],P1Enum));
++				if (penta->IsOnSurface()) break;
++				penta=penta->GetUpperElement(); _assert_(penta->Id()!=this->id);
++			}
++		}
++		else _error_("not implemented yet");
++	}
++}
++/*}}}*/
+ /*FUNCTION Penta::AddMaterialInput{{{*/
+ void  Penta::AddMaterialInput(int input_enum,IssmDouble* values, int interpolation_enum){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16719)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16720)
+@@ -183,6 +183,7 @@
+ 
+ 		/*}}}*/
+ 		/*Penta specific routines:{{{*/
++		void           AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		void           AddInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		void           AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		void	         BedNormal(IssmDouble* bed_normal, IssmDouble xyz_list[3][3]);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16719)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16720)
+@@ -67,6 +67,7 @@
+ 		void  InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented yet");};
+ 		/*}}}*/
+ 		/*Element virtual functions definitions: {{{*/
++		void        AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
+ 		void        AddInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
+ 		void        AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
+ 		void        ComputeBasalStress(Vector<IssmDouble>* sigma_b){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16720-16721.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16720-16721.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16720-16721.diff	(revision 17802)
@@ -0,0 +1,136 @@
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16720)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16721)
+@@ -216,12 +216,20 @@
+ }/*}}}*/
+ void MasstransportAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	int        i,hydroadjustment;
++	int        i,hydroadjustment,meshtype;
+ 	int*       doflist=NULL;
+ 	IssmDouble rho_ice,rho_water,minthickness;
+-	//Element* basalelement=element->SpawnBasalElement();
+-	Element* basalelement=element;
++	Element*   basalelement=NULL;
+ 
++	element->FindParam(&meshtype,MeshTypeEnum);
++	if(meshtype!=Mesh2DhorizontalEnum){
++		if(!element->IsOnBed()) return;
++		basalelement=element->SpawnBasalElement();
++	}
++	else{
++		basalelement = element;
++	}
++
+ 	/*Fetch number of nodes for this finite element*/
+ 	int numnodes = basalelement->GetNumberOfNodes();
+ 
+@@ -288,5 +296,5 @@
+ 	xDelete<IssmDouble>(oldsurface);
+ 	xDelete<IssmDouble>(phi);
+ 	xDelete<int>(doflist);
+-	if(basalelement!=element) delete element;
++	if(meshtype!=Mesh2DhorizontalEnum) delete element;
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16720)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16721)
+@@ -100,7 +100,8 @@
+ 		virtual IssmDouble TimeAdapt()=0;
+ 		virtual void   PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm)=0;
+ 		virtual void   Delta18oParameterization(void)=0;
+-		virtual void   SmbGradients()=0;
++		virtual void   SmbGradients(void)=0;
++	   virtual Element*   SpawnBasalElement(void)=0;
+ 		virtual IssmDouble TMeltingPoint(IssmDouble pressure)=0;
+ 		virtual void   ResetCoordinateSystem()=0;
+ 		virtual int    VelocityInterpolation()=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16720)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16721)
+@@ -2721,6 +2721,20 @@
+ 	return seg;
+ }
+ /*}}}*/
++/*FUNCTION Tria::SpawnBasalElement{{{*/
++Element*  Tria::SpawnBasalElement(void){
++
++	int meshtype;
++
++	/*go into parameters and get the analysis_counter: */
++	this->parameters->FindParam(&meshtype,MeshTypeEnum);
++
++	if(meshtype==Mesh2DhorizontalEnum){
++		return this;
++	}
++	else _error_("not implemented yet");
++}
++/*}}}*/
+ /*FUNCTION Tria::SurfaceArea {{{*/
+ IssmDouble Tria::SurfaceArea(void){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16720)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16721)
+@@ -119,6 +119,7 @@
+ 		void        ResultToVector(Vector<IssmDouble>* vector,int output_enum);
+ 		void        ResetCoordinateSystem(void);
+ 		void	      SmbGradients();
++	   Element*    SpawnBasalElement(void);
+ 		IssmDouble  TMeltingPoint(IssmDouble pressure);
+ 		int         VelocityInterpolation();
+ 		int         PressureInterpolation();
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16720)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16721)
+@@ -3151,6 +3151,14 @@
+ 	return tria;
+ }
+ /*}}}*/
++/*FUNCTION Penta::SpawnBasalElement{{{*/
++Element*  Penta::SpawnBasalElement(void){
++
++	_assert_(this->IsOnBed());
++	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
++	return tria;
++}
++/*}}}*/
+ /*FUNCTION Penta::SmbGradients{{{*/
+ void Penta::SmbGradients(void){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16720)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16721)
+@@ -113,6 +113,7 @@
+ 		void   PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm);
+ 		void   ResetCoordinateSystem(void);
+ 		void   SmbGradients();
++	   Element* SpawnBasalElement(void);
+ 		IssmDouble  TMeltingPoint(IssmDouble pressure);
+ 		IssmDouble SurfaceArea(void);
+ 		void   Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16720)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16721)
+@@ -103,11 +103,12 @@
+ 		bool        IsOnBed(){_error_("not implemented yet");};
+ 		bool        IsFloating(){_error_("not implemented yet");};
+ 		bool        IsNodeOnShelfFromFlags(IssmDouble* flags){_error_("not implemented yet");};
++		bool        NoIceInElement(){_error_("not implemented yet");};
+ 		int         NumberofNodesVelocity(void){_error_("not implemented yet");};
+ 		int         NumberofNodesPressure(void){_error_("not implemented yet");};
++	   Element*    SpawnBasalElement(void){_error_("not implemented yet");};
++		int         PressureInterpolation(void){_error_("not implemented yet");};
+ 		int         VelocityInterpolation(void){_error_("not implemented yet");};
+-		int         PressureInterpolation(void){_error_("not implemented yet");};
+-		bool        NoIceInElement(){_error_("not implemented yet");};
+ 		Input*      GetInput(int inputenum){_error_("not implemented yet");};
+ 		void        GetInputListOnVertices(IssmDouble* pvalue,int enumtype){_error_("not implemented yet");};
+ 		void        GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16721-16722.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16721-16722.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16721-16722.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/m/dev/devpath.py
+===================================================================
+--- ../trunk-jpl/src/m/dev/devpath.py	(revision 16721)
++++ ../trunk-jpl/src/m/dev/devpath.py	(revision 16722)
+@@ -19,6 +19,7 @@
+ 					sys.path.append(root)
+ 				
+ sys.path.append(ISSM_DIR + '/lib')
++sys.path.append(ISSM_DIR + '/src/wrappers/python/.libs')
+ 
+ #Manual imports for commonly used functions
+ from plotmodel import plotmodel
Index: issm/oecreview/Archive/16554-17801/ISSM-16722-16723.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16722-16723.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16722-16723.diff	(revision 17802)
@@ -0,0 +1,92 @@
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16722)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16723)
+@@ -112,6 +112,7 @@
+ 	HydrologydcMaskEplactiveEnum,
+ 	HydrologydcEplCompressibilityEnum,
+ 	HydrologydcEplPorosityEnum,
++	HydrologydcEplInitialThicknessEnum,
+ 	HydrologydcEplThicknessEnum,
+ 	HydrologydcEplThicknessOldEnum,
+ 	HydrologydcEplConductivityEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 16722)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 16723)
+@@ -120,6 +120,7 @@
+ 		case HydrologydcMaskEplactiveEnum : return "HydrologydcMaskEplactive";
+ 		case HydrologydcEplCompressibilityEnum : return "HydrologydcEplCompressibility";
+ 		case HydrologydcEplPorosityEnum : return "HydrologydcEplPorosity";
++		case HydrologydcEplInitialThicknessEnum : return "HydrologydcEplInitialThickness";
+ 		case HydrologydcEplThicknessEnum : return "HydrologydcEplThickness";
+ 		case HydrologydcEplThicknessOldEnum : return "HydrologydcEplThicknessOld";
+ 		case HydrologydcEplConductivityEnum : return "HydrologydcEplConductivity";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 16722)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 16723)
+@@ -120,6 +120,7 @@
+ 	      else if (strcmp(name,"HydrologydcMaskEplactive")==0) return HydrologydcMaskEplactiveEnum;
+ 	      else if (strcmp(name,"HydrologydcEplCompressibility")==0) return HydrologydcEplCompressibilityEnum;
+ 	      else if (strcmp(name,"HydrologydcEplPorosity")==0) return HydrologydcEplPorosityEnum;
++	      else if (strcmp(name,"HydrologydcEplInitialThickness")==0) return HydrologydcEplInitialThicknessEnum;
+ 	      else if (strcmp(name,"HydrologydcEplThickness")==0) return HydrologydcEplThicknessEnum;
+ 	      else if (strcmp(name,"HydrologydcEplThicknessOld")==0) return HydrologydcEplThicknessOldEnum;
+ 	      else if (strcmp(name,"HydrologydcEplConductivity")==0) return HydrologydcEplConductivityEnum;
+@@ -135,11 +136,11 @@
+ 	      else if (strcmp(name,"HydrologyEfficient")==0) return HydrologyEfficientEnum;
+ 	      else if (strcmp(name,"HydrologySedimentKmax")==0) return HydrologySedimentKmaxEnum;
+ 	      else if (strcmp(name,"WaterTransfer")==0) return WaterTransferEnum;
+-	      else if (strcmp(name,"IndependentObject")==0) return IndependentObjectEnum;
+          else stage=2;
+    }
+    if(stage==2){
+-	      if (strcmp(name,"InversionControlParameters")==0) return InversionControlParametersEnum;
++	      if (strcmp(name,"IndependentObject")==0) return IndependentObjectEnum;
++	      else if (strcmp(name,"InversionControlParameters")==0) return InversionControlParametersEnum;
+ 	      else if (strcmp(name,"InversionCostFunctionThreshold")==0) return InversionCostFunctionThresholdEnum;
+ 	      else if (strcmp(name,"InversionCostFunctionsCoefficients")==0) return InversionCostFunctionsCoefficientsEnum;
+ 	      else if (strcmp(name,"InversionCostFunctions")==0) return InversionCostFunctionsEnum;
+@@ -258,11 +259,11 @@
+ 	      else if (strcmp(name,"SteadystateMaxiter")==0) return SteadystateMaxiterEnum;
+ 	      else if (strcmp(name,"SteadystateNumRequestedOutputs")==0) return SteadystateNumRequestedOutputsEnum;
+ 	      else if (strcmp(name,"SteadystateReltol")==0) return SteadystateReltolEnum;
+-	      else if (strcmp(name,"SteadystateRequestedOutputs")==0) return SteadystateRequestedOutputsEnum;
+          else stage=3;
+    }
+    if(stage==3){
+-	      if (strcmp(name,"Surface")==0) return SurfaceEnum;
++	      if (strcmp(name,"SteadystateRequestedOutputs")==0) return SteadystateRequestedOutputsEnum;
++	      else if (strcmp(name,"Surface")==0) return SurfaceEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsPrecipitation")==0) return SurfaceforcingsPrecipitationEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsMassBalance")==0) return SurfaceforcingsMassBalanceEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsIspdd")==0) return SurfaceforcingsIspddEnum;
+@@ -381,11 +382,11 @@
+ 	      else if (strcmp(name,"DoubleMatArrayParam")==0) return DoubleMatArrayParamEnum;
+ 	      else if (strcmp(name,"DoubleMatParam")==0) return DoubleMatParamEnum;
+ 	      else if (strcmp(name,"DoubleParam")==0) return DoubleParamEnum;
+-	      else if (strcmp(name,"DoubleVecParam")==0) return DoubleVecParamEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"Element")==0) return ElementEnum;
++	      if (strcmp(name,"DoubleVecParam")==0) return DoubleVecParamEnum;
++	      else if (strcmp(name,"Element")==0) return ElementEnum;
+ 	      else if (strcmp(name,"ExternalResult")==0) return ExternalResultEnum;
+ 	      else if (strcmp(name,"FileParam")==0) return FileParamEnum;
+ 	      else if (strcmp(name,"Input")==0) return InputEnum;
+@@ -504,11 +505,11 @@
+ 	      else if (strcmp(name,"Waterfraction")==0) return WaterfractionEnum;
+ 	      else if (strcmp(name,"Watercolumn")==0) return WatercolumnEnum;
+ 	      else if (strcmp(name,"BasalFriction")==0) return BasalFrictionEnum;
+-	      else if (strcmp(name,"ViscousHeating")==0) return ViscousHeatingEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"QmuTemperature")==0) return QmuTemperatureEnum;
++	      if (strcmp(name,"ViscousHeating")==0) return ViscousHeatingEnum;
++	      else if (strcmp(name,"QmuTemperature")==0) return QmuTemperatureEnum;
+ 	      else if (strcmp(name,"HydrologyWaterVx")==0) return HydrologyWaterVxEnum;
+ 	      else if (strcmp(name,"HydrologyWaterVy")==0) return HydrologyWaterVyEnum;
+ 	      else if (strcmp(name,"StressTensor")==0) return StressTensorEnum;
Index: issm/oecreview/Archive/16554-17801/ISSM-16723-16724.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16723-16724.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16723-16724.diff	(revision 17802)
@@ -0,0 +1,28 @@
+Index: ../trunk-jpl/src/m/enum/HydrologydcEplInitialThicknessEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/HydrologydcEplInitialThicknessEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/HydrologydcEplInitialThicknessEnum.m	(revision 16724)
+@@ -0,0 +1,11 @@
++function macro=HydrologydcEplInitialThicknessEnum()
++%HYDROLOGYDCEPLINITIALTHICKNESSENUM - Enum of HydrologydcEplInitialThickness
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=HydrologydcEplInitialThicknessEnum()
++
++macro=StringToEnum('HydrologydcEplInitialThickness');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 16723)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 16724)
+@@ -112,6 +112,7 @@
+ def HydrologydcMaskEplactiveEnum(): return StringToEnum("HydrologydcMaskEplactive")[0]
+ def HydrologydcEplCompressibilityEnum(): return StringToEnum("HydrologydcEplCompressibility")[0]
+ def HydrologydcEplPorosityEnum(): return StringToEnum("HydrologydcEplPorosity")[0]
++def HydrologydcEplInitialThicknessEnum(): return StringToEnum("HydrologydcEplInitialThickness")[0]
+ def HydrologydcEplThicknessEnum(): return StringToEnum("HydrologydcEplThickness")[0]
+ def HydrologydcEplThicknessOldEnum(): return StringToEnum("HydrologydcEplThicknessOld")[0]
+ def HydrologydcEplConductivityEnum(): return StringToEnum("HydrologydcEplConductivity")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-16724-16725.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16724-16725.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16724-16725.diff	(revision 17802)
@@ -0,0 +1,171 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 16724)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 16725)
+@@ -56,7 +56,7 @@
+ 	iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
+ 	iomodel->FetchDataToInput(elements,EplHeadEnum);
+-	iomodel->FetchDataToInput(elements,HydrologydcEplThicknessEnum);
++	iomodel->FetchDataToInput(elements,HydrologydcEplInitialThicknessEnum);
+ 	
+ }/*}}}*/
+ void HydrologyDCEfficientAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+Index: ../trunk-jpl/src/c/cores/hydrology_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/hydrology_core.cpp	(revision 16724)
++++ ../trunk-jpl/src/c/cores/hydrology_core.cpp	(revision 16725)
+@@ -83,7 +83,8 @@
+ 			femmodel->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);
+ 			if (isefficientlayer){
+ 				InputDuplicatex(femmodel,EplHeadEnum,EplHeadOldEnum);
+-				InputDuplicatex(femmodel,HydrologydcEplThicknessEnum,HydrologydcEplThicknessOldEnum);
++				InputDuplicatex(femmodel,HydrologydcEplInitialThicknessEnum,HydrologydcEplThicknessEnum);
++				InputDuplicatex(femmodel,HydrologydcEplInitialThicknessEnum,HydrologydcEplThicknessOldEnum);
+ 			}
+ 			
+ 			/*Proceed now to heads computations*/
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 16724)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 16725)
+@@ -65,6 +65,7 @@
+ 		if(isefficientlayer){
+ 				iomodel->Constant(&this->epl_compressibility,HydrologydcEplCompressibilityEnum);
+ 				iomodel->Constant(&this->epl_porosity,HydrologydcEplPorosityEnum);
++				iomodel->Constant(&this->epl_init_thickness,HydrologydcEplInitialThicknessEnum);
+ 				iomodel->Constant(&this->epl_conductivity,HydrologydcEplConductivityEnum);
+ 		}
+ 	}
+@@ -391,6 +392,11 @@
+ 	return sediment_thickness;		 
+ }		 
+ /*}}}*/	
++/*FUNCTION Matpar::GetEplInitialThickness {{{*/
++IssmDouble Matpar::GetEplInitialThickness(){
++	return epl_init_thickness;		 
++}		 
++/*}}}*/	
+ /*FUNCTION Matpar::GetEplConductivity {{{*/
+ IssmDouble Matpar::GetEplConductivity(){
+ 	return epl_conductivity;		 
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 16724)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 16725)
+@@ -47,7 +47,8 @@
+ 		IssmDouble  water_compressibility;
+ 
+ 		IssmDouble  epl_compressibility;
+-		IssmDouble  epl_porosity;	 
++		IssmDouble  epl_porosity;
++		IssmDouble  epl_init_thickness;
+ 		IssmDouble  epl_conductivity;	 
+ 
+ 		/*gia: */
+@@ -124,6 +125,7 @@
+ 		IssmDouble GetSedimentTransmitivity();
+ 		IssmDouble GetSedimentThickness();
+ 		IssmDouble GetEplConductivity();
++		IssmDouble GetEplInitialThickness();
+ 		IssmDouble TMeltingPoint(IssmDouble pressure);
+ 		IssmDouble PureIceEnthalpy(IssmDouble pressure);
+ 		IssmDouble GetEnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure);
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16724)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16725)
+@@ -2165,6 +2165,7 @@
+ 				name==EplHeadOldEnum ||
+ 				name==EplHeadEnum ||
+ 				name==HydrologydcEplThicknessOldEnum ||
++				name==HydrologydcEplInitialThicknessEnum ||
+ 				name==HydrologydcEplThicknessEnum ||
+ 				name==HydrologydcMaskEplactiveEnum ||
+ 				name==MeshVertexonbedEnum ||
+@@ -7369,7 +7370,7 @@
+ 	int         i;
+ 	const int   numdof         = NDOF1 *NUMVERTICES;
+ 	bool        isefficientlayer;
+-	IssmDouble  n,A,dt;
++	IssmDouble  n,A,dt,init_thick;
+ 	IssmDouble  rho_water,rho_ice;
+ 	IssmDouble  gravity,latentheat,EPLgrad;
+ 	IssmDouble  EPL_N,epl_conductivity;
+@@ -7385,12 +7386,14 @@
+ 
+ 	if(isefficientlayer){
+ 		/*For now, assuming just one way to compute EPL thickness*/
+-		rho_water  = matpar->GetRhoWater();
+-		rho_ice    = matpar->GetRhoIce();
+-		gravity    = matpar->GetG();
+-		latentheat = matpar->GetLatentHeat();
+-		n          = material->GetN();
+-		A          = material->GetAbar();
++		rho_water        = matpar->GetRhoWater();
++		rho_ice          = matpar->GetRhoIce();
++		gravity          = matpar->GetG();
++		latentheat       = matpar->GetLatentHeat();
++		epl_conductivity = matpar->GetEplConductivity();
++		init_thick       = matpar->GetEplInitialThickness();
++		n                = material->GetN();
++		A                = material->GetAbar();
+ 		
+ 		GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveEnum);
+ 		GetInputListOnVertices(&eplhead[0],EplHeadEnum);
+@@ -7400,12 +7403,10 @@
+ 		GetInputListOnVertices(&ice_thickness[0],ThicknessEnum);
+ 		GetInputListOnVertices(&bed[0],BedEnum);
+ 		
+-		epl_conductivity = matpar->GetEplConductivity();
+-		
+ 		for(int i=0;i<numdof;i++){
+ 			/*Keeping thickness to 1 if EPL is not active*/
+ 			if(activeEpl[i]==0.0){
+-				thickness[i]=1.0;
++				thickness[i]=init_thick;
+ 			}
+ 			else{
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16724)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16725)
+@@ -2723,6 +2723,7 @@
+ 				name==SedimentHeadOldEnum ||
+ 				name==EplHeadOldEnum ||
+ 				name==HydrologydcEplThicknessOldEnum ||
++				name==HydrologydcEplInitialThicknessEnum ||
+ 				name==HydrologydcEplThicknessEnum ||
+ 				name==HydrologydcMaskEplactiveEnum ||
+ 				name==WaterTransferEnum
+@@ -10872,7 +10873,7 @@
+ 	const int   numdof   = NDOF1 *NUMVERTICES;
+ 	const int   numdof2d = NDOF1 *NUMVERTICES2D;
+ 	bool        isefficientlayer;
+-	IssmDouble  n,A,dt;
++	IssmDouble  n,A,dt,init_thick;
+ 	IssmDouble  rho_water,rho_ice;
+ 	IssmDouble  gravity,latentheat,EPLgrad;
+ 	IssmDouble  EPL_N,epl_conductivity;
+@@ -10895,10 +10896,10 @@
+ 		gravity          = matpar->GetG();
+ 		latentheat       = matpar->GetLatentHeat();
+ 		epl_conductivity = matpar->GetEplConductivity();
++		init_thick       = matpar->GetEplInitialThickness();
+ 		n                = material->GetN();
+ 		A                = material->GetA();
+ 		
+-		
+ 		GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveEnum);
+ 		GetInputListOnVertices(&eplhead[0],EplHeadEnum);
+ 		GetInputListOnVertices(&epl_slopeX[0],EplHeadSlopeXEnum); 
+@@ -10910,7 +10911,7 @@
+ 		for(int i=0;i<numdof2d;i++){
+ 			/*Keeping thickness to 1 if EPL is not active*/
+ 			if(activeEpl[i]==0.0){
+-				thickness[i]=1.0;
++				thickness[i]=init_thick;
+ 				thickness[i+numdof2d]=thickness[i];
+ 			}
+ 			else{
Index: issm/oecreview/Archive/16554-17801/ISSM-16725-16726.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16725-16726.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16725-16726.diff	(revision 17802)
@@ -0,0 +1,50 @@
+Index: ../trunk-jpl/src/m/classes/hydrologydc.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/hydrologydc.m	(revision 16725)
++++ ../trunk-jpl/src/m/classes/hydrologydc.m	(revision 16726)
+@@ -25,7 +25,7 @@
+ 		mask_eplactive           = NaN;
+ 		epl_compressibility      = 0;
+ 		epl_porosity             = 0;
+-		epl_thickness            = 0;
++		epl_initial_thickness    = 0;
+ 		epl_conductivity         = 0;
+   end
+ 	methods
+@@ -59,7 +59,7 @@
+ 
+ 			obj.epl_compressibility      = 1.0e-08;
+ 			obj.epl_porosity             = 0.4;
+-			obj.epl_thickness            = 1.0;
++			obj.epl_initial_thickness    = 1.0;
+ 			obj.epl_conductivity         = 8.0e-02;
+ 
+ 		end 
+@@ -95,7 +95,7 @@
+ 				md = checkfield(md,'hydrology.mask_eplactive','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+ 				md = checkfield(md,'hydrology.epl_compressibility','>',0,'numel',1);
+ 				md = checkfield(md,'hydrology.epl_porosity','>',0,'numel',1);
+-				md = checkfield(md,'hydrology.epl_thickness','>',0,'numel',1);
++				md = checkfield(md,'hydrology.epl_initial_thickness','>',0,'numel',1);
+ 				md = checkfield(md,'hydrology.epl_conductivity','>',0,'numel',1);
+ 	    end
+ 		end 
+@@ -136,7 +136,7 @@
+ 				fielddisplay(obj,'mask_eplactive','active (1) or not (0) EPL');
+ 				fielddisplay(obj,'epl_compressibility','epl compressibility [Pa^-1]');
+ 				fielddisplay(obj,'epl_porosity','epl [dimensionless]');
+-				fielddisplay(obj,'epl_thickness','epl initial thickness [m]');
++				fielddisplay(obj,'epl_initial_thickness','epl initial thickness [m]');
+ 				fielddisplay(obj,'epl_conductivity','epl conductivity [m^2/s]');
+ 	    end
+ 
+@@ -170,8 +170,7 @@
+ 				WriteData(fid,'object',obj,'fieldname','mask_eplactive','format','DoubleMat','mattype',1);
+ 				WriteData(fid,'object',obj,'fieldname','epl_compressibility','format','Double');			
+ 				WriteData(fid,'object',obj,'fieldname','epl_porosity','format','Double');			
+-				WriteData(fid,'object',obj,'fieldname','epl_thickness','format','Double');
+-				%WriteData(fid,'object',obj,'fieldname','epl_transmitivity','format','Double');
++				WriteData(fid,'object',obj,'fieldname','epl_initial_thickness','format','Double');
+ 				WriteData(fid,'object',obj,'fieldname','epl_conductivity','format','Double');
+ 			end
+ 		end 
Index: issm/oecreview/Archive/16554-17801/ISSM-16726-16727.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16726-16727.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16726-16727.diff	(revision 17802)
@@ -0,0 +1,309 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16726)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16727)
+@@ -22,6 +22,7 @@
+ 		void GetSolutionFromInputsHoriz(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionFS(IssmDouble* solution,Element* element);
+-		void InputUpdateFromSolutionHoriz(IssmDouble* solution,Element* element);
++		void InputUpdateFromSolutionHO(IssmDouble* solution,Element* element);
++		void InputUpdateFromSolutionSSA(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16726)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16727)
+@@ -936,11 +936,17 @@
+ 		case FSApproximationEnum: case NoneApproximationEnum:
+ 			InputUpdateFromSolutionFS(solution,element);
+ 			return;
+-		case SSAApproximationEnum: case HOApproximationEnum: case SIAApproximationEnum:
+-			InputUpdateFromSolutionHoriz(solution,element);
++		case SSAApproximationEnum: 
++			InputUpdateFromSolutionSSA(solution,element);
+ 			return;
++		case HOApproximationEnum: 
++			InputUpdateFromSolutionHO(solution,element);
++			return;
++		case SIAApproximationEnum:
++			InputUpdateFromSolutionHO(solution,element);
++			return;
+ 		case L1L2ApproximationEnum:
+-			InputUpdateFromSolutionHoriz(solution,element);
++			InputUpdateFromSolutionHO(solution,element);
+ 			return;
+ 		case SSAHOApproximationEnum: case HOFSApproximationEnum: case SSAFSApproximationEnum:
+ 			/*the elements around will create the solution*/
+@@ -949,14 +955,113 @@
+ 			_error_("Approximation "<<EnumToStringx(approximation)<<" not supported");
+ 	}
+ }/*}}}*/
+-void StressbalanceAnalysis::InputUpdateFromSolutionHoriz(IssmDouble* solution,Element* element){/*{{{*/
++void StressbalanceAnalysis::InputUpdateFromSolutionSSA(IssmDouble* solution,Element* element){/*{{{*/
+ 
+ 	int         i,meshtype;
+ 	IssmDouble  rho_ice,g;
+ 	int*        doflist=NULL;
+ 	IssmDouble* xyz_list=NULL;
++	Element*    basalelement=NULL;
+ 
++	/*Deal with pressure first*/
++	int numvertices = element->GetNumberOfVertices();
++	IssmDouble* pressure  = xNew<IssmDouble>(numvertices);
++	IssmDouble* thickness = xNew<IssmDouble>(numvertices);
++	IssmDouble* surface   = xNew<IssmDouble>(numvertices);
++
++	element->FindParam(&meshtype,MeshTypeEnum);
++	rho_ice =element->GetMaterialParameter(MaterialsRhoIceEnum);
++	g       =element->GetMaterialParameter(ConstantsGEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			element->GetInputListOnNodes(thickness,ThicknessEnum);
++			for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*thickness[i];
++			break;
++		case Mesh3DEnum:
++			element->GetVerticesCoordinates(&xyz_list);
++			element->GetInputListOnNodes(surface,SurfaceEnum);
++			for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++	element->AddInput(PressureEnum,pressure,P1Enum);
++	xDelete<IssmDouble>(pressure);
++	xDelete<IssmDouble>(thickness);
++	xDelete<IssmDouble>(surface);
++
++	/*Get basal element*/
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()) return;
++			basalelement=element->SpawnBasalElement();
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
+ 	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = basalelement->GetNumberOfNodes();
++	int numdof   = numnodes*2;
++
++	/*Fetch dof list and allocate solution vectors*/
++	basalelement->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
++	IssmDouble* values    = xNew<IssmDouble>(numdof);
++	IssmDouble* vx        = xNew<IssmDouble>(numnodes);
++	IssmDouble* vy        = xNew<IssmDouble>(numnodes);
++	IssmDouble* vz        = xNew<IssmDouble>(numnodes);
++	IssmDouble* vel       = xNew<IssmDouble>(numnodes);
++
++	/*Use the dof list to index into the solution vector: */
++	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
++
++	/*Transform solution in Cartesian Space*/
++	basalelement->TransformSolutionCoord(&values[0],XYEnum);
++	basalelement->FindParam(&meshtype,MeshTypeEnum);
++
++	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
++	for(i=0;i<numnodes;i++){
++		vx[i]=values[i*2+0];
++		vy[i]=values[i*2+1];
++
++		/*Check solution*/
++		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
++		if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
++	}
++
++	/*Get Vz and compute vel*/
++	basalelement->GetInputListOnNodes(&vz[0],VzEnum,0.);
++	for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
++
++	/*Now, we have to move the previous Vx and Vy inputs  to old 
++	 * status, otherwise, we'll wipe them off: */
++	element->InputChangeName(VxEnum,VxPicardEnum);
++	element->InputChangeName(VyEnum,VyPicardEnum);
++
++	/*Add vx and vy as inputs to the tria element: */
++	element->AddBasalInput(VxEnum,vx,P1Enum);
++	element->AddBasalInput(VyEnum,vy,P1Enum);
++	element->AddBasalInput(VelEnum,vel,P1Enum);
++
++	/*Free ressources:*/
++	xDelete<IssmDouble>(vel);
++	xDelete<IssmDouble>(vz);
++	xDelete<IssmDouble>(vy);
++	xDelete<IssmDouble>(vx);
++	xDelete<IssmDouble>(values);
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<int>(doflist);
++	if(meshtype!=Mesh2DhorizontalEnum) delete basalelement;
++}/*}}}*/
++void StressbalanceAnalysis::InputUpdateFromSolutionHO(IssmDouble* solution,Element* element){/*{{{*/
++
++	int         i,meshtype;
++	IssmDouble  rho_ice,g;
++	int*        doflist=NULL;
++	IssmDouble* xyz_list=NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+ 	int numdof   = numnodes*2;
+ 
+@@ -968,7 +1073,6 @@
+ 	IssmDouble* vz        = xNew<IssmDouble>(numnodes);
+ 	IssmDouble* vel       = xNew<IssmDouble>(numnodes);
+ 	IssmDouble* pressure  = xNew<IssmDouble>(numnodes);
+-	IssmDouble* thickness = xNew<IssmDouble>(numnodes);
+ 	IssmDouble* surface   = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Use the dof list to index into the solution vector: */
+@@ -996,18 +1100,9 @@
+ 	 *so the pressure is just the pressure at the bedrock: */
+ 	rho_ice = element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 	g       = element->GetMaterialParameter(ConstantsGEnum);
+-	switch(meshtype){
+-		case Mesh2DhorizontalEnum:
+-			element->GetInputListOnNodes(&thickness[0],ThicknessEnum);
+-			for(i=0;i<numnodes;i++) pressure[i]=rho_ice*g*thickness[i];
+-			break;
+-		case Mesh3DEnum:   
+-			element->GetVerticesCoordinates(&xyz_list);
+-			element->GetInputListOnNodes(&surface[0],SurfaceEnum);
+-			for(i=0;i<numnodes;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
+-			break;
+-		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+-	}
++	element->GetVerticesCoordinates(&xyz_list);
++	element->GetInputListOnNodes(&surface[0],SurfaceEnum);
++	for(i=0;i<numnodes;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
+ 
+ 	/*Now, we have to move the previous Vx and Vy inputs  to old 
+ 	 * status, otherwise, we'll wipe them off: */
+@@ -1018,11 +1113,10 @@
+ 	/*Add vx and vy as inputs to the tria element: */
+ 	element->AddInput(VxEnum,vx,P1Enum);
+ 	element->AddInput(VyEnum,vy,P1Enum);
+-	element->AddInput(VelEnum,vel,P1Enum);
+-	element->AddInput(PressureEnum,pressure,P1Enum);
++	element->AddBasalInput(VelEnum,vel,P1Enum);
++	element->AddBasalInput(PressureEnum,pressure,P1Enum);
+ 
+ 	/*Free ressources:*/
+-	xDelete<IssmDouble>(thickness);
+ 	xDelete<IssmDouble>(surface);
+ 	xDelete<IssmDouble>(pressure);
+ 	xDelete<IssmDouble>(vel);
+@@ -1032,7 +1126,6 @@
+ 	xDelete<IssmDouble>(values);
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<int>(doflist);
+-
+ }/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionFS(IssmDouble* solution,Element* element){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16726)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16727)
+@@ -296,5 +296,5 @@
+ 	xDelete<IssmDouble>(oldsurface);
+ 	xDelete<IssmDouble>(phi);
+ 	xDelete<int>(doflist);
+-	if(meshtype!=Mesh2DhorizontalEnum) delete element;
++	if(meshtype!=Mesh2DhorizontalEnum) delete basalelement;
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16726)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16727)
+@@ -59,6 +59,7 @@
+ 		virtual int    GetNumberOfNodes(void)=0;
+ 		virtual int    GetNumberOfNodesVelocity(void)=0;
+ 		virtual int    GetNumberOfNodesPressure(void)=0;
++		virtual int    GetNumberOfVertices(void)=0;
+ 		virtual void   GetNodesSidList(int* sidlist)=0;
+ 		virtual void   GetNodesLidList(int* sidlist)=0;
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16726)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16727)
+@@ -1368,6 +1368,11 @@
+ 	return this->NumberofNodes();
+ }
+ /*}}}*/
++/*FUNCTION Tria::GetNumberOfVertices;{{{*/
++int Tria::GetNumberOfVertices(void){
++	return NUMVERTICES;
++}
++/*}}}*/
+ /*FUNCTION Tria::GetInput(int inputenum) {{{*/
+ Input* Tria::GetInput(int inputenum){
+ 	return inputs->GetInput(inputenum);
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16726)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16727)
+@@ -90,6 +90,7 @@
+ 		int         GetNumberOfNodes(void);
+ 		int         GetNumberOfNodesPressure(void){_error_("not implemented yet");};
+ 		int         GetNumberOfNodesVelocity(void){_error_("not implemented yet");};
++		int         GetNumberOfVertices(void);
+ 		int         Sid();
+ 		bool        IsOnBed();
+ 		bool        HasEdgeOnBed();
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16726)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16727)
+@@ -138,11 +138,10 @@
+ 			IssmDouble extrudedvalues[NUMVERTICES];
+ 			Penta*     penta=NULL;
+ 
+-			for(i=1;i<NUMVERTICES2D;i++){
++			for(i=0;i<NUMVERTICES2D;i++){
+ 				extrudedvalues[i]=values[i];
+ 				extrudedvalues[i+NUMVERTICES2D]=values[i];
+ 			}
+-			this->inputs->AddInput(new PentaInput(input_enum,&extrudedvalues[0],P1Enum));
+ 			penta=this;
+ 			for(;;){
+ 				penta->inputs->AddInput(new PentaInput(input_enum,&extrudedvalues[0],P1Enum));
+@@ -1395,6 +1394,11 @@
+ 	return this->NumberofNodesVelocity();
+ }
+ /*}}}*/
++/*FUNCTION Penta::GetNumberOfVertices;{{{*/
++int Penta::GetNumberOfVertices(void){
++	return NUMVERTICES; 
++}
++/*}}}*/
+ /*FUNCTION Penta::GetInput(int inputenum) {{{*/
+ Input* Penta::GetInput(int inputenum){
+ 	return inputs->GetInput(inputenum);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16726)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16727)
+@@ -92,6 +92,7 @@
+ 		int    GetNumberOfNodes(void);
+ 		int    GetNumberOfNodesPressure(void);
+ 		int    GetNumberOfNodesVelocity(void);
++		int    GetNumberOfVertices(void);
+ 		IssmDouble GetMaterialParameter(int enum_in);
+ 		void   GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
+ 		IssmDouble GetZcoord(GaussPenta* gauss);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16726)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16727)
+@@ -97,6 +97,7 @@
+ 		int         GetNumberOfNodes(void){_error_("not implemented yet");};
+ 		int         GetNumberOfNodesVelocity(void){_error_("not implemented yet");};
+ 		int         GetNumberOfNodesPressure(void){_error_("not implemented yet");};
++		int         GetNumberOfVertices(void){_error_("not implemented yet");};
+ 		void        GetVerticesCoordinates(IssmDouble** pxyz_list){_error_("not implemented yet");};
+ 		int         Sid(){_error_("not implemented yet");};
+ 		void        InputChangeName(int input_enum, int enum_type_old){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16727-16728.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16727-16728.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16727-16728.diff	(revision 17802)
@@ -0,0 +1,22 @@
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 16727)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 16728)
+@@ -117,5 +117,16 @@
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+ void BalancethicknessAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	_error_("not implemented yet");
++	int inputenum,meshtype;
++
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			element->InputUpdateFromSolutionOneDof(solution,ThicknessEnum);
++			break;
++		case Mesh3DEnum:
++			element->InputUpdateFromSolutionOneDofCollapsed(solution,ThicknessEnum);
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
+ }/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16728-16729.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16728-16729.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16728-16729.diff	(revision 17802)
@@ -0,0 +1,43 @@
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16728)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16729)
+@@ -152,7 +152,6 @@
+ 	}
+ 
+ 	/*Get all inputs and parameters*/
+-
+ 	element->GetInputValue(&converged,ConvergedEnum);
+ 	if(converged){
+ 		element->AddInput(TemperatureEnum,values,P1Enum);
+Index: ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 16728)
++++ ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 16729)
+@@ -75,5 +75,5 @@
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+ void MeltingAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	_error_("not implemented yet");
++	element->InputUpdateFromSolutionOneDof(solution,BasalforcingsMeltingRateEnum);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp	(revision 16728)
++++ ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp	(revision 16729)
+@@ -15,6 +15,7 @@
+ /*}}}*/
+ 
+ /*Element macros*/
++#define NUMNODESP0  1
+ #define NUMNODESP1  3
+ #define NUMNODESP1b 4
+ #define NUMNODESP2  6
+@@ -982,6 +983,7 @@
+ int TriaRef::NumberofNodes(int finiteelement){
+ 
+ 	switch(finiteelement){
++		case P0Enum:                return NUMNODESP0;
+ 		case P1Enum:                return NUMNODESP1;
+ 		case P1DGEnum:              return NUMNODESP1;
+ 		case P1bubbleEnum:          return NUMNODESP1b;
Index: issm/oecreview/Archive/16554-17801/ISSM-16729-16730.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16729-16730.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16729-16730.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/test/NightlyRun/test333.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test333.m	(revision 16729)
++++ ../trunk-jpl/test/NightlyRun/test333.m	(revision 16730)
+@@ -17,7 +17,7 @@
+ md.hydrology.mask_eplactive=0*ones(md.mesh.numberofvertices,1);
+ md.basalforcings.melting_rate = 2.0*ones(md.mesh.numberofvertices,1);
+ md.hydrology.epl_conductivity=30;
+-md.hydrology.epl_thickness=1;
++md.hydrology.epl_initial_thickness=1;
+ md.timestepping.time_step=0.2;
+ md.timestepping.final_time=2.0;
+ 
+Index: ../trunk-jpl/test/NightlyRun/test335.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test335.m	(revision 16729)
++++ ../trunk-jpl/test/NightlyRun/test335.m	(revision 16730)
+@@ -17,7 +17,7 @@
+ md.hydrology.mask_eplactive=0*ones(md.mesh.numberofvertices,1);
+ md.basalforcings.melting_rate = 2.0*ones(md.mesh.numberofvertices,1);
+ md.hydrology.epl_conductivity=30;
+-md.hydrology.epl_thickness=1;
++md.hydrology.epl_initial_thickness=1;
+ md.timestepping.time_step=0.2;
+ md.timestepping.final_time=2.0;
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16730-16731.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16730-16731.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16730-16731.diff	(revision 17802)
@@ -0,0 +1,44 @@
+Index: ../trunk-jpl/externalpackages/petsc/install-3.4-acenet.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/petsc/install-3.4-acenet.sh	(revision 0)
++++ ../trunk-jpl/externalpackages/petsc/install-3.4-acenet.sh	(revision 16731)
+@@ -0,0 +1,33 @@
++#!/bin/bash
++set -eu
++
++#Some cleanup
++rm -rf install petsc-3.4.3 src
++mkdir install src
++
++#Download from ISSM server
++$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/petsc-lite-3.4.3.tar.gz' 'petsc-3.4.3.tar.gz'
++
++#Untar and move petsc to install directory
++tar -zxvf  petsc-3.4.3.tar.gz
++mv petsc-3.4.3/* src/
++rm -rf petsc-3.4.3
++
++#configure
++cd src
++./config/configure.py \
++ --prefix="$ISSM_DIR/externalpackages/petsc/install" \
++ --PETSC_ARCH="linux-gnu-amd64" \
++ --PETSC_DIR="$ISSM_DIR/externalpackages/petsc/src" \
++ --with-debugging=0 \
++ --with-shared-libraries=1 \
++ --known-mpi-shared-libraries=1 \
++ --with-mpi-dir=$OPENMPI \
++ --download-scalapack=yes \
++ --download-blacs=yes \
++ --download-mumps=yes \
++ --download-metis=yes \
++ --download-parmetis=yes 
++
++make
++make install
+
+Property changes on: ../trunk-jpl/externalpackages/petsc/install-3.4-acenet.sh
+___________________________________________________________________
+Name: svn:executable
+   + *
+
Index: issm/oecreview/Archive/16554-17801/ISSM-16731-16732.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16731-16732.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16731-16732.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/externalpackages/petsc/install-3.4-acenet.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/petsc/install-3.4-acenet.sh	(revision 16731)
++++ ../trunk-jpl/externalpackages/petsc/install-3.4-acenet.sh	(revision 16732)
+@@ -27,6 +27,8 @@
+  --download-blacs=yes \
+  --download-mumps=yes \
+  --download-metis=yes \
++ --download-blas=yes \
++ --download-f-blas-lapack=yes \
+  --download-parmetis=yes 
+ 
+ make
Index: issm/oecreview/Archive/16554-17801/ISSM-16732-16733.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16732-16733.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16732-16733.diff	(revision 17802)
@@ -0,0 +1,15 @@
+Index: ../trunk-jpl/src/m/plot/plot_section.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_section.m	(revision 16732)
++++ ../trunk-jpl/src/m/plot/plot_section.m	(revision 16733)
+@@ -58,6 +58,10 @@
+ 		%Compute section value
+ 		[elements,x,y,z,s,data_s]=SectionValues(md,datai,profile,resolution);
+ 
++		if getfieldvalue(options,'sectionmean',0)==1,
++			disp(['Mean value of data along section: ' num2str(mean(data_s))])
++		end
++
+ 		%units
+ 		if exist(options,'unit'),
+ 			unit=getfieldvalue(options,'unit');
Index: issm/oecreview/Archive/16554-17801/ISSM-16733-16734.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16733-16734.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16733-16734.diff	(revision 17802)
@@ -0,0 +1,161 @@
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16733)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16734)
+@@ -187,5 +187,91 @@
+ 	element->GetSolutionFromInputsOneDof(solution,EnthalpyEnum);
+ }/*}}}*/
+ void EnthalpyAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	bool        converged;
++	int         i,rheology_law;
++	IssmDouble  B_average,s_average,T_average=0.,P_average=0.;
++	int        *doflist   = NULL;
++	IssmDouble *xyz_list  = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes    = element->GetNumberOfNodes();
++
++	/*Fetch dof list and allocate solution vector*/
++	element->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
++	IssmDouble* values        = xNew<IssmDouble>(numnodes);
++	IssmDouble* pressure      = xNew<IssmDouble>(numnodes);
++	IssmDouble* temperature   = xNew<IssmDouble>(numnodes);
++	IssmDouble* waterfraction = xNew<IssmDouble>(numnodes);
++
++	/*Use the dof list to index into the solution vector: */
++	for(i=0;i<numnodes;i++){
++		values[i]=solution[doflist[i]];
++
++		/*Check solution*/
++		if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector");
++	}
++
++	/*Get all inputs and parameters*/
++	element->GetInputValue(&converged,ConvergedEnum);
++	element->GetInputListOnNodes(pressure,PressureEnum);
++	if(converged){
++		for(i=0;i<numnodes;i++){
++			element->EnthalpyToThermal(&temperature[i],&waterfraction[i],values[i],pressure[i]);
++			if(waterfraction[i]<0.) _error_("Negative water fraction found in solution vector");
++			//if(waterfraction[i]>1.) _error_("Water fraction >1 found in solution vector");
++		}
++		element->AddInput(EnthalpyEnum,values,P1Enum);
++		element->AddInput(WaterfractionEnum,waterfraction,P1Enum);
++		element->AddInput(TemperatureEnum,temperature,P1Enum);
++
++		/*Update Rheology only if converged (we must make sure that the temperature is below melting point
++		 * otherwise the rheology could be negative*/
++		element->FindParam(&rheology_law,MaterialsRheologyLawEnum);
++		switch(rheology_law){
++			case NoneEnum:
++				/*Do nothing: B is not temperature dependent*/
++				break;
++			case PatersonEnum:
++				for(i=0;i<numnodes;i++) T_average+=values[i]/reCast<IssmDouble>(numnodes);
++				B_average=Paterson(T_average);
++				element->AddMaterialInput(MaterialsRheologyBEnum,&B_average,P0Enum);
++				break;
++			case ArrheniusEnum:{
++				Input* surface_input=element->GetInput(SurfaceEnum); _assert_(surface_input);
++				surface_input->GetInputAverage(&s_average);
++				element->GetVerticesCoordinates(&xyz_list);
++				for(i=0;i<numnodes;i++) T_average+=values[i]/reCast<IssmDouble>(numnodes);
++				//B_average=Arrhenius(T_average,
++							//s_average-((xyz_list[0][2]+xyz_list[1][2]+xyz_list[2][2]+xyz_list[3][2]+xyz_list[4][2]+xyz_list[5][2])/6.0),
++							//element->GetMaticeParameter(MaterialsRheologyNEnum));
++				element->AddMaterialInput(MaterialsRheologyBEnum,&B_average,P0Enum);
++				break;
++				}
++			case LliboutryDuvalEnum:
++				for(i=0;i<numnodes;i++) T_average+=values[i]/reCast<IssmDouble>(numnodes);
++				for(i=0;i<numnodes;i++) P_average+=pressure[i]/reCast<IssmDouble>(numnodes);
++				B_average=LliboutryDuval(T_average,P_average,
++							element->GetMaterialParameter(MaterialsRheologyNEnum),
++							element->GetMaterialParameter(MaterialsBetaEnum),
++							element->GetMaterialParameter(ConstantsReferencetemperatureEnum),
++							element->GetMaterialParameter(MaterialsHeatcapacityEnum),
++							element->GetMaterialParameter(MaterialsLatentheatEnum));
++				element->AddMaterialInput(MaterialsRheologyBEnum,&B_average,P0Enum);
++				break;
++			default:
++				_error_("Rheology law " << EnumToStringx(rheology_law) << " not supported yet");
++		}
++	}
++	else{
++		element->AddInput(EnthalpyPicardEnum,values,P1Enum);
++	}
++
++	/*Free ressources:*/
++	xDelete<IssmDouble>(values);
++	xDelete<IssmDouble>(pressure);
++	xDelete<IssmDouble>(temperature);
++	xDelete<IssmDouble>(waterfraction);
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<int>(doflist);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16733)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16734)
+@@ -45,6 +45,7 @@
+ 		virtual void   CreateDVector(Vector<IssmDouble>* df)=0;
+ 		virtual void   CreatePVector(Vector<IssmDouble>* pf)=0;
+ 		virtual void   CreateJacobianMatrix(Matrix<IssmDouble>* Jff)=0;
++		virtual void   EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure)=0;
+ 		virtual void   FindParam(int* pvalue,int paramenum)=0;
+ 		virtual void   FindParam(IssmDouble* pvalue,int paramenum)=0;
+ 		virtual int    FiniteElement(void)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16733)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16734)
+@@ -78,6 +78,7 @@
+ 		void        CreatePVector(Vector<IssmDouble>* pf);
+ 		void        CreateJacobianMatrix(Matrix<IssmDouble>* Jff);
+ 		void        Delta18oParameterization(void);
++		void        EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented yet");};
+ 		void        FindParam(int* pvalue,int paramenum);
+ 		void        FindParam(IssmDouble* pvalue,int paramenum);
+ 		int         FiniteElement(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16733)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16734)
+@@ -964,6 +964,11 @@
+ 	this->DeepEcho();
+ }
+ /*}}}*/
++/*FUNCTION Penta::EnthalpyToThermal{{{*/
++void Penta::EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){
++	matpar->EnthalpyToThermal(ptemperature,pwaterfraction,enthalpy,pressure);
++}
++/*}}}*/
+ /*FUNCTION Penta::FindParam(int* pvalue,int paramenum){{{*/
+ void Penta::FindParam(int* pvalue,int paramenum){
+ 	this->parameters->FindParam(pvalue,paramenum);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16733)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16734)
+@@ -83,6 +83,7 @@
+ 		void   CreatePVector(Vector<IssmDouble>* pf);
+ 		void   CreateJacobianMatrix(Matrix<IssmDouble>* Jff);
+ 		void   Delta18oParameterization(void);
++		void   EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure);
+ 		void	 GetDofList(int** pdoflist,int approximation_enum,int setenum);
+ 		void	 GetDofListVelocity(int** pdoflist,int setenum);
+ 		void	 GetDofListPressure(int** pdoflist,int setenum);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16733)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16734)
+@@ -82,6 +82,7 @@
+ 		ElementVector* CreatePVectorL2Projection(void);
+ 		void        CreateJacobianMatrix(Matrix<IssmDouble>* Jff){_error_("not implemented yet");};
+ 		void        Delta18oParameterization(void){_error_("not implemented yet");};
++		void        EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented yet");};
+ 		void        FindParam(int* pvalue,int paramenum);
+ 		void        FindParam(IssmDouble* pvalue,int paramenum);
+ 		int         FiniteElement(void);
Index: issm/oecreview/Archive/16554-17801/ISSM-16734-16735.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16734-16735.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16734-16735.diff	(revision 17802)
@@ -0,0 +1,16 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 16734)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 16735)
+@@ -210,8 +210,9 @@
+ 
+ 	/*For pressure: we have not computed pressure in this analysis, for this element. We are in 2D, 
+ 	 *so the pressure is just the pressure at the bedrock: */
+-	rho_ice = element->GetMaterialParameter(MaterialsRhoIceEnum);
+-	g       = element->GetMaterialParameter(ConstantsGEnum);
++	rho_ice  = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	g        = element->GetMaterialParameter(ConstantsGEnum);
++	element->FindParam(&meshtype,MeshTypeEnum);
+ 	switch(meshtype){
+ 		case Mesh2DhorizontalEnum:
+ 			element->GetInputListOnNodes(&thickness[0],ThicknessEnum);
Index: issm/oecreview/Archive/16554-17801/ISSM-16735-16736.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16735-16736.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16735-16736.diff	(revision 17802)
@@ -0,0 +1,28 @@
+Index: ../trunk-jpl/configs/config-linux64-acenet.sh
+===================================================================
+--- ../trunk-jpl/configs/config-linux64-acenet.sh	(revision 0)
++++ ../trunk-jpl/configs/config-linux64-acenet.sh	(revision 16736)
+@@ -0,0 +1,17 @@
++#!/bin/bash
++
++./configure \
++ --prefix=/home/klemorza/issm/trunk-jpl \
++ --with-metis-dir=$ISSM_DIR/externalpackages/metis/install \
++ --with-metis-dir=$ISSM_DIR/externalpackages/petsc/install
++ --with-petsc-dir=$ISSM_DIR/externalpackages/petsc/install \
++ --with-mpi-include=$OPENMPI/include  \
++ --with-mpi-libflags="-L$OPENMPI/lib -lmpi" \
++ --with-blas-lapack-dir=$ISSM_DIR/externalpackages/petsc/install \
++ --with-scalapack-dir=$ISSM_DIR/externalpackages/petsc/install/ \
++ --with-mumps-dir=$ISSM_DIR/externalpackages/petsc/install/ \
++ --with-cxxoptflags="-O2" \
++ --with-numthreads=32 \
++ --with-serial=no \
++ --with-modules=no \
++ --enable-debugging CC=mpicc CXX=mpiCC F77=mpif77
+
+Property changes on: ../trunk-jpl/configs/config-linux64-acenet.sh
+___________________________________________________________________
+Name: svn:executable
+   + *
+
Index: issm/oecreview/Archive/16554-17801/ISSM-16736-16737.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16736-16737.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16736-16737.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/classes/clusters/acenet.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/clusters/acenet.m	(revision 16736)
++++ ../trunk-jpl/src/m/classes/clusters/acenet.m	(revision 16737)
+@@ -71,6 +71,8 @@
+           fprintf(fid,'module purge\n');
+           fprintf(fid,'module load gcc openmpi/gcc\n');
+           fprintf(fid,'module load issm\n');
++			 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
++			 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
+           fprintf(fid,'\n');
+           fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog ',...
+                    cluster.np,cluster.codepath,EnumToString(solution),[cluster.executionpath '/' dirname],modelname,modelname,modelname);
Index: issm/oecreview/Archive/16554-17801/ISSM-16737-16738.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16737-16738.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16737-16738.diff	(revision 17802)
@@ -0,0 +1,8 @@
+Index: ../trunk-jpl/test/Archives/Archive333.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive335.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-16738-16739.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16738-16739.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16738-16739.diff	(revision 17802)
@@ -0,0 +1,71 @@
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 16738)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 16739)
+@@ -15,6 +15,7 @@
+ /*}}}*/
+ 
+ /*Element macros*/
++#define NUMNODESP0    1
+ #define NUMNODESP1    6
+ #define NUMNODESP1_2d 3
+ #define NUMNODESP1b   7
+@@ -1961,6 +1962,7 @@
+ int PentaRef::NumberofNodes(void){
+ 
+ 	switch(this->element_type){
++		case P0Enum:                return NUMNODESP0;
+ 		case P1Enum:                return NUMNODESP1;
+ 		case P1bubbleEnum:          return NUMNODESP1b;
+ 		case P1bubblecondensedEnum: return NUMNODESP1b;
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16738)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16739)
+@@ -157,7 +157,7 @@
+ void  Penta::AddMaterialInput(int input_enum,IssmDouble* values, int interpolation_enum){
+ 
+ 	_assert_(this->material);
+-	this->material->inputs->AddInput(new TriaInput(input_enum,values,interpolation_enum));
++	this->material->inputs->AddInput(new PentaInput(input_enum,values,interpolation_enum));
+ }
+ /*}}}*/
+ 
+@@ -2020,8 +2020,11 @@
+ 			 total_integrated_input=new PentaInput(average_enum_type,zeros_list,P1Enum);
+ 			else if (original_input->ObjectEnum()==DoubleInputEnum)
+ 			 total_integrated_input=new DoubleInput(average_enum_type,0.0);
+-			else
++			else{
++				printf("id %i \n",this->id);
++				printf("enum %i \n",average_enum_type);
+ 			 _error_("object " << EnumToStringx(original_input->ObjectEnum()) << " not supported yet");
++			}
+ 		}
+ 
+ 		/*Step2: Create element thickness input*/
+@@ -4852,8 +4855,8 @@
+ 	int         i,rheology_law;
+ 	IssmDouble  xyz_list[NUMVERTICES][3];
+ 	IssmDouble  values[numdof];
+-	IssmDouble  B[numdof];
+-	IssmDouble  B_average,s_average;
++	IssmDouble  B[numdof],surface[numdof];
++	IssmDouble  B_average;
+ 	int        *doflist = NULL;
+ 	bool        hack    = false;
+ 
+@@ -4902,11 +4905,8 @@
+ 				this->material->inputs->AddInput(new PentaInput(MaterialsRheologyBEnum,B,P1Enum));
+ 				break;
+ 			case ArrheniusEnum:
+-				surface_input->GetInputAverage(&s_average);
+-				B_average=Arrhenius((values[0]+values[1]+values[2]+values[3]+values[4]+values[5])/6.0,
+-							s_average-((xyz_list[0][2]+xyz_list[1][2]+xyz_list[2][2]+xyz_list[3][2]+xyz_list[4][2]+xyz_list[5][2])/6.0),
+-							material->GetN());
+-				for(i=0;i<numdof;i++) B[i]=B_average;
++				GetInputListOnVertices(&surface[0],SurfaceEnum);
++				for(i=0;i<numdof;i++) B[i]=Arrhenius(values[i],surface[i]-xyz_list[i][2],material->GetN());
+ 				this->material->inputs->AddInput(new PentaInput(MaterialsRheologyBEnum,B,P1Enum));
+ 				break;
+ 			default:
Index: issm/oecreview/Archive/16554-17801/ISSM-16739-16740.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16739-16740.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16739-16740.diff	(revision 17802)
@@ -0,0 +1,131 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16739)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16740)
+@@ -2094,21 +2094,15 @@
+ 		}
+ 		else if(M==iomodel->numberofvertices+1){
+ 			/*create transient input: */
+-			for(t=0;t<N;t++){ //N is the number of times
+-
+-				/*create input values: */
+-				for(i=0;i<3;i++){
+-					row=tria_vertex_ids[i]-1;
+-					nodeinputs[i]=vector[N*row+t];
+-				}
+-
+-				/*time? :*/
+-				time=vector[(M-1)*N+t];
+-
+-				if(t==0) transientinput=new TransientInput(vector_enum);
+-				transientinput->AddTimeInput(new TriaInput(vector_enum,nodeinputs,P1Enum),time);
++			IssmDouble* times = xNew<IssmDouble>(N);
++			for(t=0;t<N;t++) times[t] = vector[(M-1)*N+t];
++			transientinput=new TransientInput(vector_enum,times,N);
++			for(t=0;t<N;t++){
++				for(i=0;i<NUMVERTICES;i++) nodeinputs[i]=vector[N*(tria_vertex_ids[i]-1)+t];
++				transientinput->AddTimeInput(new TriaInput(vector_enum,nodeinputs,P1Enum));
+ 			}
+ 			this->inputs->AddInput(transientinput);
++			xDelete<IssmDouble>(times);
+ 		}
+ 		else _error_("nodal vector is either numberofvertices or numberofvertices+1 long. Field provided (" << EnumToStringx(vector_enum) << ") is " << M << " long");
+ 	}
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16739)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16740)
+@@ -1930,21 +1930,15 @@
+ 		}
+ 		else if(M==iomodel->numberofvertices+1){
+ 			/*create transient input: */
+-			for(t=0;t<N;t++){ //N is the number of times
+-
+-				/*create input values: */
+-				for(i=0;i<6;i++){
+-					row=penta_vertex_ids[i]-1;
+-					nodeinputs[i]=(IssmDouble)vector[N*row+t];
+-				}
+-
+-				/*time? :*/
+-				time=(IssmDouble)vector[(M-1)*N+t];
+-
+-				if(t==0)transientinput=new TransientInput(vector_enum);
+-				transientinput->AddTimeInput(new PentaInput(vector_enum,nodeinputs,P1Enum),time);
++			IssmDouble* times = xNew<IssmDouble>(N);
++			for(t=0;t<N;t++) times[t] = vector[(M-1)*N+t];
++			transientinput=new TransientInput(vector_enum,times,N);
++			for(t=0;t<N;t++){
++				for(i=0;i<NUMVERTICES;i++) nodeinputs[i]=vector[N*(penta_vertex_ids[i]-1)+t];
++				transientinput->AddTimeInput(new PentaInput(vector_enum,nodeinputs,P1Enum));
+ 			}
+ 			this->inputs->AddInput(transientinput);
++			xDelete<IssmDouble>(times);
+ 		}
+ 		else _error_("nodal vector is either numberofvertices (" << iomodel->numberofvertices << "), or numberofvertices+1 long. Field provided is " << M << " long. Enum " << EnumToStringx(vector_enum));
+ 	}
+Index: ../trunk-jpl/src/c/classes/Inputs/TransientInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TransientInput.cpp	(revision 16739)
++++ ../trunk-jpl/src/c/classes/Inputs/TransientInput.cpp	(revision 16740)
+@@ -38,6 +38,21 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION TransientInput::TransientInput(int in_enum_type,IssmDouble* timesin,int N){{{*/
++TransientInput::TransientInput(int in_enum_type,IssmDouble* timesin,int N){
++
++	/*Set Enum*/
++	enum_type=in_enum_type;
++
++	/*Allocate values and timesteps, and copy: */
++	this->numtimesteps=N;
++	this->timesteps=xNew<IssmDouble>(N);
++	xMemCpy(this->timesteps,timesin,N);
++
++	inputs = new Inputs();
++	this->parameters=NULL;
++}
++/*}}}*/
+ /*FUNCTION TransientInput::~TransientInput{{{*/
+ TransientInput::~TransientInput(){
+ 	xDelete(this->timesteps);
+@@ -65,7 +80,7 @@
+ 	_printf_("   numtimesteps: " << this->numtimesteps << "\n");
+ 	_printf_("---inputs: \n"); 
+ 	for(i=0;i<this->numtimesteps;i++){
+-		_printf_("   time: " << this->timesteps[i] << "  \n");
++		_printf_("   time: " << this->timesteps[i]<<"  ");
+ 		((Input*)this->inputs->GetObjectByOffset(i))->Echo();
+ 	}
+ }
+@@ -313,6 +328,14 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION TransientInput::AddTimeInput{{{*/
++void TransientInput::AddTimeInput(Input* input){
++
++	_assert_(this->inputs->Size()<this->numtimesteps);
++	inputs->AddObject(input);
++
++}
++/*}}}*/
+ /*FUNCTION TransientInput::GetResultInterpolation{{{*/
+ int  TransientInput::GetResultInterpolation(void){
+ 
+Index: ../trunk-jpl/src/c/classes/Inputs/TransientInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TransientInput.h	(revision 16739)
++++ ../trunk-jpl/src/c/classes/Inputs/TransientInput.h	(revision 16740)
+@@ -25,8 +25,10 @@
+ 		/*TransientInput constructors, destructors: {{{*/
+ 		TransientInput();
+ 		TransientInput(int enum_type);
++		TransientInput(int in_enum_type,IssmDouble* times,int N);
+ 		~TransientInput();
+ 		void AddTimeInput(Input* input,IssmDouble time);
++		void AddTimeInput(Input* input);
+ 		/*}}}*/
+ 		/*Object virtual functions definitions:{{{*/
+ 		void  Echo();
Index: issm/oecreview/Archive/16554-17801/ISSM-16740-16741.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16740-16741.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16740-16741.diff	(revision 17802)
@@ -0,0 +1,8 @@
+Index: ../trunk-jpl/test/Archives/Archive333.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive335.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-16741-16742.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16741-16742.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16741-16742.diff	(revision 17802)
@@ -0,0 +1,58 @@
+Index: ../trunk-jpl/src/c/cores/thermal_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/thermal_core.cpp	(revision 16741)
++++ ../trunk-jpl/src/c/cores/thermal_core.cpp	(revision 16742)
+@@ -62,4 +62,7 @@
+ 		if(VerboseSolution()) _printf0_("   saving results\n");
+ 		femmodel->RequestedOutputsx(&femmodel->results,requested_outputs,numoutputs);
+ 	}
++
++	/*Free ressources:*/	
++	if(numoutputs){for(int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs);}
+ }
+Index: ../trunk-jpl/src/c/cores/transient_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 16741)
++++ ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 16742)
+@@ -178,5 +178,5 @@
+ 	femmodel->RequestedDependentsx();
+ 
+ 	/*Free ressources:*/	
+-	if(numoutputs){ for (i=0;i<numoutputs;i++){char* string=requested_outputs[i];xDelete<char>(string);} xDelete<char*>(requested_outputs);}
++	if(numoutputs){for(int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs);}
+ }
+Index: ../trunk-jpl/src/c/cores/masstransport_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/masstransport_core.cpp	(revision 16741)
++++ ../trunk-jpl/src/c/cores/masstransport_core.cpp	(revision 16742)
+@@ -83,5 +83,5 @@
+ 	if(solution_type==MasstransportSolutionEnum)femmodel->RequestedDependentsx();
+ 
+ 	/*Free ressources:*/
+-	if(numoutputs){for(int i=0;i<numoutputs;i++){char* string=requested_outputs[i];xDelete<char>(string);} xDelete<char*>(requested_outputs);} 
++	if(numoutputs){for(int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs);}
+ }
+Index: ../trunk-jpl/src/c/cores/stressbalance_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/stressbalance_core.cpp	(revision 16741)
++++ ../trunk-jpl/src/c/cores/stressbalance_core.cpp	(revision 16742)
+@@ -93,5 +93,5 @@
+ 	if(solution_type==StressbalanceSolutionEnum)femmodel->RequestedDependentsx();
+ 
+ 	/*Free ressources:*/	
+-	if(numoutputs){ for (i=0;i<numoutputs;i++){char* string=requested_outputs[i];xDelete<char>(string);} xDelete<char*>(requested_outputs);}
++	if(numoutputs){for(int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs);}
+ }
+Index: ../trunk-jpl/src/c/cores/steadystate_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/steadystate_core.cpp	(revision 16741)
++++ ../trunk-jpl/src/c/cores/steadystate_core.cpp	(revision 16742)
+@@ -86,7 +86,7 @@
+ 	delete ug_old;
+ 	delete tg;
+ 	delete ug;	
+-	if(numoutputs){ for (i=0;i<numoutputs;i++){char* string=requested_outputs[i];xDelete<char>(string);} xDelete<char*>(requested_outputs);}
++	if(numoutputs){for(int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs);}
+ }
+ bool steadystateconvergence(Vector<IssmDouble>* tg,Vector<IssmDouble>* tg_old,Vector<IssmDouble>* ug,Vector<IssmDouble>* ug_old,IssmDouble reltol){
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16742-16743.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16742-16743.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16742-16743.diff	(revision 17802)
@@ -0,0 +1,76 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16742)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16743)
+@@ -4850,7 +4850,6 @@
+ 	IssmDouble  xyz_list[NUMVERTICES][3];
+ 	IssmDouble  values[numdof];
+ 	IssmDouble  B[numdof],surface[numdof];
+-	IssmDouble  B_average;
+ 	int        *doflist = NULL;
+ 	bool        hack    = false;
+ 
+@@ -4889,17 +4888,16 @@
+ 		/*Update Rheology only if converged (we must make sure that the temperature is below melting point
+ 		 * otherwise the rheology could be negative*/
+ 		this->parameters->FindParam(&rheology_law,MaterialsRheologyLawEnum);
++		GetInputListOnVertices(&surface[0],SurfaceEnum);
+ 		switch(rheology_law){
+ 			case NoneEnum:
+ 				/*Do nothing: B is not temperature dependent*/
+ 				break;
+ 			case PatersonEnum:
+-				B_average=Paterson((values[0]+values[1]+values[2]+values[3]+values[4]+values[5])/6.0);
+-				for(i=0;i<numdof;i++) B[i]=B_average;
++				for(i=0;i<numdof;i++) B[i]=Paterson(values[i]);
+ 				this->material->inputs->AddInput(new PentaInput(MaterialsRheologyBEnum,B,P1Enum));
+ 				break;
+ 			case ArrheniusEnum:
+-				GetInputListOnVertices(&surface[0],SurfaceEnum);
+ 				for(i=0;i<numdof;i++) B[i]=Arrhenius(values[i],surface[i]-xyz_list[i][2],material->GetN());
+ 				this->material->inputs->AddInput(new PentaInput(MaterialsRheologyBEnum,B,P1Enum));
+ 				break;
+@@ -4925,7 +4923,8 @@
+ 	int        i,rheology_law;
+ 	IssmDouble xyz_list[NUMVERTICES][3];
+ 	IssmDouble values[numdof];
+-	IssmDouble pressure[NUMVERTICES];
++	IssmDouble pressure[numdof];
++	IssmDouble surface[numdof];
+ 	IssmDouble temperatures[numdof];
+ 	IssmDouble waterfraction[numdof];
+ 	IssmDouble B[numdof];
+@@ -4964,29 +4963,21 @@
+ 		/*Update Rheology only if converged (we must make sure that the temperature is below melting point
+ 		 * otherwise the rheology could be negative*/
+ 		this->parameters->FindParam(&rheology_law,MaterialsRheologyLawEnum);
++		GetInputListOnVertices(&surface[0],PressureEnum);
+ 		switch(rheology_law){
+ 			case NoneEnum:
+ 				/*Do nothing: B is not temperature dependent*/
+ 				break;
+ 			case PatersonEnum:
+-				B_average=Paterson((temperatures[0]+temperatures[1]+temperatures[2]+temperatures[3]+temperatures[4]+temperatures[5])/6.0);
+-				for(i=0;i<numdof;i++) B[i]=B_average;
++				for(i=0;i<numdof;i++) B[i]=Paterson(values[i]);
+ 				this->material->inputs->AddInput(new PentaInput(MaterialsRheologyBEnum,B,P1Enum));
+ 				break;
+ 			case ArrheniusEnum:
+-				surface_input->GetInputAverage(&s_average);
+-				B_average=Arrhenius((temperatures[0]+temperatures[1]+temperatures[2]+temperatures[3]+temperatures[4]+temperatures[5])/6.0,
+-							s_average-((xyz_list[0][2]+xyz_list[1][2]+xyz_list[2][2]+xyz_list[3][2]+xyz_list[4][2]+xyz_list[5][2])/6.0),
+-							material->GetN());
+-				for(i=0;i<numdof;i++) B[i]=B_average;
++				for(i=0;i<numdof;i++) B[i]=Arrhenius(values[i],surface[i]-xyz_list[i][2],material->GetN());
+ 				this->material->inputs->AddInput(new PentaInput(MaterialsRheologyBEnum,B,P1Enum));
+ 				break;
+ 			case LliboutryDuvalEnum:
+-				B_average=LliboutryDuval((values[0]+values[1]+values[2]+values[3]+values[4]+values[5])/6.0,
+-																 (pressure[0]+pressure[1]+pressure[2]+pressure[3]+pressure[4]+pressure[5])/6.0,
+-																 material->GetN(), 
+-																 matpar->GetBeta(), matpar->GetReferenceTemperature(), matpar->GetHeatCapacity(), matpar->GetLatentHeat());
+-				for(i=0;i<numdof;i++) B[i]=B_average;
++				for(i=0;i<numdof;i++) B[i]=LliboutryDuval(values[i],pressure[i],material->GetN(),matpar->GetBeta(),matpar->GetReferenceTemperature(),matpar->GetHeatCapacity(),matpar->GetLatentHeat());
+ 				this->material->inputs->AddInput(new PentaInput(MaterialsRheologyBEnum,B,P1Enum));
+ 				break;
+ 			default:
Index: issm/oecreview/Archive/16554-17801/ISSM-16743-16744.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16743-16744.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16743-16744.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/src/c/classes/Inputs/TransientInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TransientInput.cpp	(revision 16743)
++++ ../trunk-jpl/src/c/classes/Inputs/TransientInput.cpp	(revision 16744)
+@@ -337,13 +337,19 @@
+ }
+ /*}}}*/
+ /*FUNCTION TransientInput::GetResultInterpolation{{{*/
+-int  TransientInput::GetResultInterpolation(void){
++int TransientInput::GetResultInterpolation(void){
+ 
+ 	IssmDouble time;
++	int        output;
++
+ 	parameters->FindParam(&time,TimeEnum);
+ 	Input* input=GetTimeInput(time);
+-	return input->GetResultInterpolation();
++	output = input->GetResultInterpolation();
+ 
++	/*Clean up and return*/
++	delete input;
++	return output;
++
+ }
+ /*}}}*/
+ /*FUNCTION TransientInput::Extrude{{{*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16744-16745.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16744-16745.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16744-16745.diff	(revision 17802)
@@ -0,0 +1,177 @@
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16744)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16745)
+@@ -118,7 +118,6 @@
+ 
+ 	bool        converged;
+ 	int         i,rheology_law;
+-	IssmDouble  B_average,s_average,T_average=0.;
+ 	int        *doflist   = NULL;
+ 	IssmDouble *xyz_list  = NULL;
+ 	bool        hack      = false;
+@@ -129,6 +128,8 @@
+ 	/*Fetch dof list and allocate solution vector*/
+ 	element->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+ 	IssmDouble* values    = xNew<IssmDouble>(numnodes);
++	IssmDouble* surface   = xNew<IssmDouble>(numnodes);
++	IssmDouble* B         = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Use the dof list to index into the solution vector: */
+ 	for(i=0;i<numnodes;i++){
+@@ -143,7 +144,7 @@
+ 	/*Force temperature between [Tpmp-50 Tpmp] to disable penalties*/
+ 	if(hack){
+ 		IssmDouble* pressure = xNew<IssmDouble>(numnodes);
+-		element->GetInputListOnVertices(pressure,PressureEnum);
++		element->GetInputListOnNodes(&pressure[0],PressureEnum);
+ 		for(i=0;i<numnodes;i++){
+ 			if(values[i]>element->TMeltingPoint(pressure[i]))     values[i]=element->TMeltingPoint(pressure[i]);
+ 			if(values[i]<element->TMeltingPoint(pressure[i])-50.) values[i]=element->TMeltingPoint(pressure[i])-50.;
+@@ -159,29 +160,23 @@
+ 		/*Update Rheology only if converged (we must make sure that the temperature is below melting point
+ 		 * otherwise the rheology could be negative*/
+ 		element->FindParam(&rheology_law,MaterialsRheologyLawEnum);
++		element->GetInputListOnNodes(&surface[0],SurfaceEnum);
+ 		switch(rheology_law){
+ 			case NoneEnum:
+ 				/*Do nothing: B is not temperature dependent*/
+ 				break;
+ 			case PatersonEnum:
+-				for(i=0;i<numnodes;i++) T_average+=values[i]/reCast<IssmDouble>(numnodes);
+-				B_average=Paterson(T_average);
+-				element->AddMaterialInput(MaterialsRheologyBEnum,&B_average,P0Enum);
++				for(i=0;i<numnodes;i++) B[i]=Paterson(values[i]);
++				element->AddMaterialInput(MaterialsRheologyBEnum,&B[0],P1Enum);
+ 				break;
+ 			case ArrheniusEnum:{
+-				Input* surface_input=element->GetInput(SurfaceEnum); _assert_(surface_input);
+-				surface_input->GetInputAverage(&s_average);
+ 				element->GetVerticesCoordinates(&xyz_list);
+-				for(i=0;i<numnodes;i++) T_average+=values[i]/reCast<IssmDouble>(numnodes);
+-				//B_average=Arrhenius(T_average,
+-							//s_average-((xyz_list[0][2]+xyz_list[1][2]+xyz_list[2][2]+xyz_list[3][2]+xyz_list[4][2]+xyz_list[5][2])/6.0),
+-							//element->GetMaticeParameter(MaterialsRheologyNEnum));
+-				element->AddMaterialInput(MaterialsRheologyBEnum,&B_average,P0Enum);
++				for(i=0;i<numnodes;i++) B[i]=Arrhenius(values[i],surface[i]-xyz_list[i*3+2],element->GetMaterialParameter(MaterialsRheologyNEnum));
++				element->AddMaterialInput(MaterialsRheologyBEnum,&B[0],P1Enum);
+ 				break;
+ 				}
+ 			default:
+ 				_error_("Rheology law " << EnumToStringx(rheology_law) << " not supported yet");
+-
+ 		}
+ 	}
+ 	else{
+@@ -190,6 +185,8 @@
+ 
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(values);
++	xDelete<IssmDouble>(surface);
++	xDelete<IssmDouble>(B);
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<int>(doflist);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16744)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16745)
+@@ -201,6 +201,8 @@
+ 	element->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+ 	IssmDouble* values        = xNew<IssmDouble>(numnodes);
+ 	IssmDouble* pressure      = xNew<IssmDouble>(numnodes);
++	IssmDouble* surface       = xNew<IssmDouble>(numnodes);
++	IssmDouble* B             = xNew<IssmDouble>(numnodes);
+ 	IssmDouble* temperature   = xNew<IssmDouble>(numnodes);
+ 	IssmDouble* waterfraction = xNew<IssmDouble>(numnodes);
+ 
+@@ -214,7 +216,7 @@
+ 
+ 	/*Get all inputs and parameters*/
+ 	element->GetInputValue(&converged,ConvergedEnum);
+-	element->GetInputListOnNodes(pressure,PressureEnum);
++	element->GetInputListOnNodes(&pressure[0],PressureEnum);
+ 	if(converged){
+ 		for(i=0;i<numnodes;i++){
+ 			element->EnthalpyToThermal(&temperature[i],&waterfraction[i],values[i],pressure[i]);
+@@ -228,39 +230,26 @@
+ 		/*Update Rheology only if converged (we must make sure that the temperature is below melting point
+ 		 * otherwise the rheology could be negative*/
+ 		element->FindParam(&rheology_law,MaterialsRheologyLawEnum);
++		element->GetInputListOnNodes(&surface[0],SurfaceEnum);
+ 		switch(rheology_law){
+ 			case NoneEnum:
+ 				/*Do nothing: B is not temperature dependent*/
+ 				break;
+ 			case PatersonEnum:
+-				for(i=0;i<numnodes;i++) T_average+=values[i]/reCast<IssmDouble>(numnodes);
+-				B_average=Paterson(T_average);
+-				element->AddMaterialInput(MaterialsRheologyBEnum,&B_average,P0Enum);
++				for(i=0;i<numnodes;i++) B[i]=Paterson(values[i]);
++				element->AddMaterialInput(MaterialsRheologyBEnum,&B[0],P1Enum);
+ 				break;
+-			case ArrheniusEnum:{
+-				Input* surface_input=element->GetInput(SurfaceEnum); _assert_(surface_input);
+-				surface_input->GetInputAverage(&s_average);
++			case ArrheniusEnum:
+ 				element->GetVerticesCoordinates(&xyz_list);
+-				for(i=0;i<numnodes;i++) T_average+=values[i]/reCast<IssmDouble>(numnodes);
+-				//B_average=Arrhenius(T_average,
+-							//s_average-((xyz_list[0][2]+xyz_list[1][2]+xyz_list[2][2]+xyz_list[3][2]+xyz_list[4][2]+xyz_list[5][2])/6.0),
+-							//element->GetMaticeParameter(MaterialsRheologyNEnum));
+-				element->AddMaterialInput(MaterialsRheologyBEnum,&B_average,P0Enum);
++				for(i=0;i<numnodes;i++) B[i]=Arrhenius(values[i],surface[i]-xyz_list[i*3+2],element->GetMaterialParameter(MaterialsRheologyNEnum));
++				element->AddMaterialInput(MaterialsRheologyBEnum,&B[0],P1Enum);
+ 				break;
+-				}
+ 			case LliboutryDuvalEnum:
+-				for(i=0;i<numnodes;i++) T_average+=values[i]/reCast<IssmDouble>(numnodes);
+-				for(i=0;i<numnodes;i++) P_average+=pressure[i]/reCast<IssmDouble>(numnodes);
+-				B_average=LliboutryDuval(T_average,P_average,
+-							element->GetMaterialParameter(MaterialsRheologyNEnum),
+-							element->GetMaterialParameter(MaterialsBetaEnum),
+-							element->GetMaterialParameter(ConstantsReferencetemperatureEnum),
+-							element->GetMaterialParameter(MaterialsHeatcapacityEnum),
+-							element->GetMaterialParameter(MaterialsLatentheatEnum));
+-				element->AddMaterialInput(MaterialsRheologyBEnum,&B_average,P0Enum);
+-				break;
+-			default:
+-				_error_("Rheology law " << EnumToStringx(rheology_law) << " not supported yet");
++				//for(i=0;i<numnodes;i++) B[i]=LliboutryDuval(values[i],pressure[i],material->GetN(),matpar->GetBeta(),matpar->GetReferenceTemperature(),matpar->GetHeatCapacity(),matpar->GetLatentHeat()); for(i=0;i<numnodes;i++) B[i]=Paterson(values[i]); 
++				for(i=0;i<numnodes;i++) B[i]=Paterson(values[i]);
++				element->AddMaterialInput(MaterialsRheologyBEnum,&B[0],P1Enum); 
++				break; 
++			default: _error_("Rheology law " << EnumToStringx(rheology_law) << " not supported yet");
+ 		}
+ 	}
+ 	else{
+@@ -270,6 +259,8 @@
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(values);
+ 	xDelete<IssmDouble>(pressure);
++	xDelete<IssmDouble>(surface);
++	xDelete<IssmDouble>(B);
+ 	xDelete<IssmDouble>(temperature);
+ 	xDelete<IssmDouble>(waterfraction);
+ 	xDelete<IssmDouble>(xyz_list);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16744)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16745)
+@@ -4928,7 +4928,6 @@
+ 	IssmDouble temperatures[numdof];
+ 	IssmDouble waterfraction[numdof];
+ 	IssmDouble B[numdof];
+-	IssmDouble B_average,s_average;
+ 	int*       doflist=NULL;
+ 
+ 	/*Get dof list: */
+@@ -4963,7 +4962,7 @@
+ 		/*Update Rheology only if converged (we must make sure that the temperature is below melting point
+ 		 * otherwise the rheology could be negative*/
+ 		this->parameters->FindParam(&rheology_law,MaterialsRheologyLawEnum);
+-		GetInputListOnVertices(&surface[0],PressureEnum);
++		GetInputListOnVertices(&surface[0],SurfaceEnum);
+ 		switch(rheology_law){
+ 			case NoneEnum:
+ 				/*Do nothing: B is not temperature dependent*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16745-16746.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16745-16746.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16745-16746.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16745)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16746)
+@@ -4850,6 +4850,7 @@
+ 	IssmDouble  xyz_list[NUMVERTICES][3];
+ 	IssmDouble  values[numdof];
+ 	IssmDouble  B[numdof],surface[numdof];
++	IssmDouble  B_average;
+ 	int        *doflist = NULL;
+ 	bool        hack    = false;
+ 
+@@ -4968,11 +4969,11 @@
+ 				/*Do nothing: B is not temperature dependent*/
+ 				break;
+ 			case PatersonEnum:
+-				for(i=0;i<numdof;i++) B[i]=Paterson(values[i]);
++				for(i=0;i<numdof;i++) B[i]=Paterson(temperatures[i]);
+ 				this->material->inputs->AddInput(new PentaInput(MaterialsRheologyBEnum,B,P1Enum));
+ 				break;
+ 			case ArrheniusEnum:
+-				for(i=0;i<numdof;i++) B[i]=Arrhenius(values[i],surface[i]-xyz_list[i][2],material->GetN());
++				for(i=0;i<numdof;i++) B[i]=Arrhenius(temperatures[i],surface[i]-xyz_list[i][2],material->GetN());
+ 				this->material->inputs->AddInput(new PentaInput(MaterialsRheologyBEnum,B,P1Enum));
+ 				break;
+ 			case LliboutryDuvalEnum:
Index: issm/oecreview/Archive/16554-17801/ISSM-16746-16747.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16746-16747.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16746-16747.diff	(revision 17802)
@@ -0,0 +1,140 @@
+Index: ../trunk-jpl/test/Archives/Archive111.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive232.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive515.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive327.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive509.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive510.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive209.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive210.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive224.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive513.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive432.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive507.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive233.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive207.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive415.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive227.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive409.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive121.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive410.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive505.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive317.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive211.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive225.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive326.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive508.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive315.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive416.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive329.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive122.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive411.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive431.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive324.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive506.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive237.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive318.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-16747-16748.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16747-16748.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16747-16748.diff	(revision 17802)
@@ -0,0 +1,25 @@
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16747)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16748)
+@@ -236,17 +236,17 @@
+ 				/*Do nothing: B is not temperature dependent*/
+ 				break;
+ 			case PatersonEnum:
+-				for(i=0;i<numnodes;i++) B[i]=Paterson(values[i]);
++				for(i=0;i<numnodes;i++) B[i]=Paterson(temperature[i]);
+ 				element->AddMaterialInput(MaterialsRheologyBEnum,&B[0],P1Enum);
+ 				break;
+ 			case ArrheniusEnum:
+ 				element->GetVerticesCoordinates(&xyz_list);
+-				for(i=0;i<numnodes;i++) B[i]=Arrhenius(values[i],surface[i]-xyz_list[i*3+2],element->GetMaterialParameter(MaterialsRheologyNEnum));
++				for(i=0;i<numnodes;i++) B[i]=Arrhenius(temperature[i],surface[i]-xyz_list[i*3+2],element->GetMaterialParameter(MaterialsRheologyNEnum));
+ 				element->AddMaterialInput(MaterialsRheologyBEnum,&B[0],P1Enum);
+ 				break;
+ 			case LliboutryDuvalEnum:
+ 				//for(i=0;i<numnodes;i++) B[i]=LliboutryDuval(values[i],pressure[i],material->GetN(),matpar->GetBeta(),matpar->GetReferenceTemperature(),matpar->GetHeatCapacity(),matpar->GetLatentHeat()); for(i=0;i<numnodes;i++) B[i]=Paterson(values[i]); 
+-				for(i=0;i<numnodes;i++) B[i]=Paterson(values[i]);
++				for(i=0;i<numnodes;i++) B[i]=Paterson(temperature[i]);
+ 				element->AddMaterialInput(MaterialsRheologyBEnum,&B[0],P1Enum); 
+ 				break; 
+ 			default: _error_("Rheology law " << EnumToStringx(rheology_law) << " not supported yet");
Index: issm/oecreview/Archive/16554-17801/ISSM-16748-16749.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16748-16749.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16748-16749.diff	(revision 17802)
@@ -0,0 +1,8 @@
+Index: ../trunk-jpl/test/Archives/Archive333.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive335.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-16749-16750.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16749-16750.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16749-16750.diff	(revision 17802)
@@ -0,0 +1,14 @@
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16749)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16750)
+@@ -245,8 +245,7 @@
+ 				element->AddMaterialInput(MaterialsRheologyBEnum,&B[0],P1Enum);
+ 				break;
+ 			case LliboutryDuvalEnum:
+-				//for(i=0;i<numnodes;i++) B[i]=LliboutryDuval(values[i],pressure[i],material->GetN(),matpar->GetBeta(),matpar->GetReferenceTemperature(),matpar->GetHeatCapacity(),matpar->GetLatentHeat()); for(i=0;i<numnodes;i++) B[i]=Paterson(values[i]); 
+-				for(i=0;i<numnodes;i++) B[i]=Paterson(temperature[i]);
++				for(i=0;i<numnodes;i++) B[i]=LliboutryDuval(values[i],pressure[i],element->GetMaterialParameter(MaterialsRheologyNEnum),element->GetMaterialParameter(MaterialsBetaEnum),element->GetMaterialParameter(ConstantsReferencetemperatureEnum),element->GetMaterialParameter(MaterialsHeatcapacityEnum),element->GetMaterialParameter(MaterialsLatentheatEnum)); 
+ 				element->AddMaterialInput(MaterialsRheologyBEnum,&B[0],P1Enum); 
+ 				break; 
+ 			default: _error_("Rheology law " << EnumToStringx(rheology_law) << " not supported yet");
Index: issm/oecreview/Archive/16554-17801/ISSM-16750-16751.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16750-16751.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16750-16751.diff	(revision 17802)
@@ -0,0 +1,48 @@
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 16750)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 16751)
+@@ -29,5 +29,42 @@
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+ void AdjointHorizAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	_error_("not implemented yet");
++	int  i;
++	int* doflist=NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++	int numdof   = numnodes*2;
++
++	/*Fetch dof list and allocate solution vectors*/
++	element->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
++	IssmDouble* values  = xNew<IssmDouble>(numdof);
++	IssmDouble* lambdax = xNew<IssmDouble>(numnodes);
++	IssmDouble* lambday = xNew<IssmDouble>(numnodes);
++
++	/*Use the dof list to index into the solution vector: */
++	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
++
++	/*Transform solution in Cartesian Space*/
++	element->TransformSolutionCoord(&values[0],XYEnum);
++
++	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
++	for(i=0;i<numnodes;i++){
++		lambdax[i]=values[i*NDOF2+0];
++		lambday[i]=values[i*NDOF2+1];
++
++		/*Check solution*/
++		if(xIsNan<IssmDouble>(lambdax[i])) _error_("NaN found in solution vector");
++		if(xIsNan<IssmDouble>(lambday[i])) _error_("NaN found in solution vector");
++	}
++
++	/*Add vx and vy as inputs to the tria element: */
++	element->AddInput(AdjointxEnum,lambdax,P1Enum);
++	element->AddInput(AdjointyEnum,lambday,P1Enum);
++
++	/*Free ressources:*/
++	xDelete<IssmDouble>(values);
++	xDelete<IssmDouble>(lambdax);
++	xDelete<IssmDouble>(lambday);
++	xDelete<int>(doflist);
+ }/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16751-16752.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16751-16752.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16751-16752.diff	(revision 17802)
@@ -0,0 +1,98 @@
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 16751)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 16752)
+@@ -29,6 +29,16 @@
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+ void AdjointHorizAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	int approximation;
++	element->GetInputValue(&approximation,ApproximationEnum);
++	if(approximation==FSApproximationEnum || approximation==NoneApproximationEnum){
++		InputUpdateFromSolutionFS(solution,element);
++	}
++	else{
++		InputUpdateFromSolutionHoriz(solution,element);
++	}
++}/*}}}*/
++void AdjointHorizAnalysis::InputUpdateFromSolutionHoriz(IssmDouble* solution,Element* element){/*{{{*/
+ 	int  i;
+ 	int* doflist=NULL;
+ 
+@@ -68,3 +78,64 @@
+ 	xDelete<IssmDouble>(lambday);
+ 	xDelete<int>(doflist);
+ }/*}}}*/
++void AdjointHorizAnalysis::InputUpdateFromSolutionFS(IssmDouble* solution,Element* element){/*{{{*/
++	int          i;
++	int*         vdoflist=NULL;
++	int*         pdoflist=NULL;
++	IssmDouble   FSreconditioning;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int vnumnodes = element->GetNumberOfNodesVelocity();
++	int pnumnodes = element->GetNumberOfNodesPressure();
++	int vnumdof   = vnumnodes*3;
++	int pnumdof   = pnumnodes*1;
++
++	/*Initialize values*/
++	IssmDouble* vvalues = xNew<IssmDouble>(vnumdof);
++	IssmDouble* pvalues = xNew<IssmDouble>(pnumdof);
++	IssmDouble* lambdax = xNew<IssmDouble>(vnumnodes);
++	IssmDouble* lambday = xNew<IssmDouble>(vnumnodes);
++	IssmDouble* lambdaz = xNew<IssmDouble>(vnumnodes);
++	IssmDouble* lambdap = xNew<IssmDouble>(pnumnodes);
++
++	/*Get dof list: */
++	element->GetDofListVelocity(&vdoflist,GsetEnum);
++	element->GetDofListPressure(&pdoflist,GsetEnum);
++
++	/*Use the dof list to index into the solution vector: */
++	for(i=0;i<vnumdof;i++) vvalues[i]=solution[vdoflist[i]];
++	for(i=0;i<pnumdof;i++) pvalues[i]=solution[pdoflist[i]];
++
++	/*Transform solution in Cartesian Space*/
++	element->TransformSolutionCoord(&vvalues[0],XYZEnum);
++
++	/*fill in all arrays: */
++	for(i=0;i<vnumnodes;i++){
++		lambdax[i] = vvalues[i*NDOF3+0]; if(xIsNan<IssmDouble>(lambdax[i])) _error_("NaN found in solution vector");
++		lambday[i] = vvalues[i*NDOF3+1]; if(xIsNan<IssmDouble>(lambday[i])) _error_("NaN found in solution vector");
++		lambdaz[i] = vvalues[i*NDOF3+2]; if(xIsNan<IssmDouble>(lambdaz[i])) _error_("NaN found in solution vector");
++	}
++	for(i=0;i<pnumnodes;i++){
++		lambdap[i] = pvalues[i]; if(xIsNan<IssmDouble>(lambdap[i])) _error_("NaN found in solution vector");
++	}
++
++	/*Recondition pressure and compute vel: */
++	element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
++	for(i=0;i<pnumnodes;i++) lambdap[i]=lambdap[i]*FSreconditioning;
++
++	/*Add vx and vy as inputs to the tria element: */
++	element->AddInput(AdjointxEnum,lambdax,P1Enum);
++	element->AddInput(AdjointyEnum,lambday,P1Enum);
++	element->AddInput(AdjointzEnum,lambdaz,P1Enum);
++	element->AddInput(AdjointpEnum,lambdap,P1Enum);
++
++	/*Free ressources:*/
++	xDelete<int>(vdoflist);
++	xDelete<int>(pdoflist);
++	xDelete<IssmDouble>(lambdap);
++	xDelete<IssmDouble>(lambdaz);
++	xDelete<IssmDouble>(lambday);
++	xDelete<IssmDouble>(lambdax);
++	xDelete<IssmDouble>(vvalues);
++	xDelete<IssmDouble>(pvalues);
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h	(revision 16751)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h	(revision 16752)
+@@ -19,5 +19,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void InputUpdateFromSolutionHoriz(IssmDouble* solution,Element* element);
++		void InputUpdateFromSolutionFS(IssmDouble* solution,Element* element);
+ };
+ #endif
Index: issm/oecreview/Archive/16554-17801/ISSM-16752-16753.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16752-16753.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16752-16753.diff	(revision 17802)
@@ -0,0 +1,80 @@
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 16752)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 16753)
+@@ -117,8 +117,8 @@
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+ void BalancethicknessAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	int inputenum,meshtype;
+ 
++	int meshtype;
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+ 	switch(meshtype){
+ 		case Mesh2DhorizontalEnum:
+Index: ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 16752)
++++ ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 16753)
+@@ -62,5 +62,16 @@
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+ void BalancevelocityAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	int meshtype;
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			element->InputUpdateFromSolutionOneDof(solution,VelEnum);
++			break;
++		case Mesh3DEnum:
++			element->InputUpdateFromSolutionOneDofCollapsed(solution,VelEnum);
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 16752)
++++ ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 16753)
+@@ -29,5 +29,16 @@
+ 	_error_("not implemented yet");
+ }/*}}}*/
+ void AdjointBalancethicknessAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	int meshtype;
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			element->InputUpdateFromSolutionOneDof(solution,AdjointEnum);
++			break;
++		case Mesh3DEnum:
++			element->InputUpdateFromSolutionOneDofCollapsed(solution,AdjointEnum);
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 16752)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 16753)
+@@ -48,5 +48,5 @@
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+ void SmoothedSurfaceSlopeXAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	_error_("not implemented yet");
++	element->InputUpdateFromSolutionOneDof(solution,SurfaceSlopeXEnum);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 16752)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 16753)
+@@ -48,5 +48,5 @@
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+ void SmoothedSurfaceSlopeYAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	_error_("not implemented yet");
++	element->InputUpdateFromSolutionOneDof(solution,SurfaceSlopeYEnum);
+ }/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16753-16754.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16753-16754.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16753-16754.diff	(revision 17802)
@@ -0,0 +1,148 @@
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 16753)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 16754)
+@@ -67,6 +67,9 @@
+ 		case Mesh2DhorizontalEnum:
+ 			element->InputUpdateFromSolutionOneDof(solution,inputenum);
+ 			break;
++		case Mesh2DverticalEnum:
++			element->InputUpdateFromSolutionOneDof(solution,inputenum);
++			break;
+ 		case Mesh3DEnum:
+ 			element->InputUpdateFromSolutionOneDofCollapsed(solution,inputenum);
+ 			break;
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 16753)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 16754)
+@@ -40,5 +40,8 @@
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+ void ExtrudeFromBaseAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	int inputenum;
++	element->FindParam(&inputenum,InputToExtrudeEnum);
++	element->InputUpdateFromSolutionOneDof(solution,inputenum);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 16753)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 16754)
+@@ -98,5 +98,34 @@
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+ void DamageEvolutionAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	IssmDouble  max_damage;
++	int			*doflist = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Fetch dof list and allocate solution vector*/
++	element->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
++	IssmDouble* values    = xNew<IssmDouble>(numnodes);
++
++	/*Get user-supplied max_damage: */
++	element->FindParam(&max_damage,DamageMaxDamageEnum);
++
++	/*Use the dof list to index into the solution vector: */
++	for(int i=0;i<numnodes;i++){
++		values[i]=solution[doflist[i]];
++		/*Check solution*/
++		if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector");
++		/*Enforce D < max_damage and D > 0 */
++		if(values[i]>max_damage) values[i]=max_damage;
++		else if(values[i]<0.)    values[i]=0.;
++	}
++
++	/*Get all inputs and parameters*/
++	element->AddMaterialInput(DamageDbarEnum,values,P1Enum);
++
++	/*Free ressources:*/
++	xDelete<IssmDouble>(values);
++	xDelete<int>(doflist);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16753)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16754)
+@@ -1368,6 +1368,16 @@
+ 	return this->NumberofNodes();
+ }
+ /*}}}*/
++/*FUNCTION Tria::GetNumberOfNodesPressure;{{{*/
++int Tria::GetNumberOfNodesPressure(void){
++	return this->NumberofNodesPressure();
++}
++/*}}}*/
++/*FUNCTION Tria::GetNumberOfNodesVelocity;{{{*/
++int Tria::GetNumberOfNodesVelocity(void){
++	return this->NumberofNodesVelocity();
++}
++/*}}}*/
+ /*FUNCTION Tria::GetNumberOfVertices;{{{*/
+ int Tria::GetNumberOfVertices(void){
+ 	return NUMVERTICES;
+@@ -6780,7 +6790,6 @@
+ 	return Ke;
+ }
+ /*}}}*/
+-
+ /*FUNCTION Tria::CreatEPLDomainMassMatrix {{{*/
+ ElementMatrix* Tria::CreateEPLDomainMassMatrix(void){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16753)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16754)
+@@ -89,8 +89,8 @@
+ 		void        GetNodesSidList(int* sidlist);
+ 		void        GetNodesLidList(int* lidlist);
+ 		int         GetNumberOfNodes(void);
+-		int         GetNumberOfNodesPressure(void){_error_("not implemented yet");};
+-		int         GetNumberOfNodesVelocity(void){_error_("not implemented yet");};
++		int         GetNumberOfNodesPressure(void);
++		int         GetNumberOfNodesVelocity(void);
+ 		int         GetNumberOfVertices(void);
+ 		int         Sid();
+ 		bool        IsOnBed();
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16753)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16754)
+@@ -2546,16 +2546,18 @@
+ /*FUNCTION Penta::InputUpdateFromSolutionOneDof{{{*/
+ void  Penta::InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type){
+ 
+-	const int numdof = NDOF1*NUMVERTICES;
++	/*Intermediary*/
++	int* doflist = NULL;
+ 
+-	IssmDouble values[numdof];
+-	int*   doflist=NULL;
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = this->NumberofNodes();
+ 
+-	/*Get dof list: */
++	/*Fetch dof list and allocate solution vector*/
+ 	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
++	IssmDouble* values    = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Use the dof list to index into the solution vector: */
+-	for(int i=0;i<numdof;i++){
++	for(int i=0;i<numnodes;i++){
+ 		values[i]=solution[doflist[i]];
+ 		if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector");
+ 	}
+@@ -2564,6 +2566,7 @@
+ 	this->inputs->AddInput(new PentaInput(enum_type,values,P1Enum));
+ 
+ 	/*Free ressources:*/
++	xDelete<IssmDouble>(values);
+ 	xDelete<int>(doflist);
+ }
+ /*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16754-16755.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16754-16755.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16754-16755.diff	(revision 17802)
@@ -0,0 +1,81 @@
+Index: ../trunk-jpl/src/c/cores/transient_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 16754)
++++ ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 16755)
+@@ -105,7 +105,7 @@
+ 		femmodel->parameters->SetParam(step,StepEnum);
+ 
+ 		if(VerboseSolution()) _printf0_("iteration " << step << "/" << floor((finaltime-time)/dt)+step << "  time [yr]: " << time/yts << " (time step: " << dt/yts << ")\n");
+-		if(step%output_frequency==0 || time==finaltime)
++		if(step%output_frequency==0 || time==finaltime || step==1)
+ 		 save_results=true;
+ 		else
+ 		 save_results=false;
+Index: ../trunk-jpl/src/c/cores/hydrology_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/hydrology_core.cpp	(revision 16754)
++++ ../trunk-jpl/src/c/cores/hydrology_core.cpp	(revision 16755)
+@@ -66,7 +66,7 @@
+ 
+ 			InputDuplicatex(femmodel,WatercolumnEnum,WaterColumnOldEnum);
+ 
+-			if(save_results && ((i+1)%output_frequency==0 || (i+1)==nsteps)){
++			if(save_results && ((i+1)%output_frequency==0 || (i+1)==nsteps || i==0)){
+ 				if(VerboseSolution()) _printf0_("   saving results \n");
+ 				int outputs[3] = {WatercolumnEnum,HydrologyWaterVxEnum,HydrologyWaterVyEnum};
+ 				femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],3);
+@@ -90,7 +90,7 @@
+ 			/*Proceed now to heads computations*/
+ 			if(VerboseSolution()) _printf0_("   computing water head\n");
+ 			solutionsequence_hydro_nonlinear(femmodel);
+-			if(save_results && ((i+1)%output_frequency==0 || (i+1)==nsteps)){
++			if(save_results && ((i+1)%output_frequency==0 || (i+1)==nsteps || i==0)){
+ 				if(VerboseSolution()) _printf0_("   saving results \n");
+ 				if(isefficientlayer){
+ 					int outputs[7] = {SedimentHeadEnum,SedimentHeadResidualEnum,EplHeadEnum,HydrologydcMaskEplactiveEnum,EplHeadSlopeXEnum,EplHeadSlopeYEnum,HydrologydcEplThicknessEnum};
+Index: ../trunk-jpl/src/m/solve/parseresultsfromdisk.m
+===================================================================
+--- ../trunk-jpl/src/m/solve/parseresultsfromdisk.m	(revision 16754)
++++ ../trunk-jpl/src/m/solve/parseresultsfromdisk.m	(revision 16755)
+@@ -25,24 +25,32 @@
+ results=struct();
+ 
+ %Read fields until the end of the file.
+-result=ReadData(fid);
++result  = ReadData(fid);
++counter = 1;
++step    = result.step;
+ while ~isempty(result), 
+-	%Get time and step
+-	results(result.step).step=result.step;
+-	results(result.step).time=result.time; 
+ 
++	%Check step, increase counter if this is a new step
++	if(step~=result.step & result.step>1)
++		counter = counter + 1;
++		step    = result.step;
++	end
++
+ 	%Add result
+-	if (length(results)>=result.step & isfield(results,result.fieldname) & ~strcmp(result.fieldname,'SolutionType')),
+-			results(result.step).(result.fieldname)=[ results(result.step).(result.fieldname); result.field];
++	if(result.step==1),
++		index = 1;
+ 	else
+-		results(result.step).(result.fieldname)=result.field;
++		index = counter;
+ 	end
++	results(index).step=result.step;
++	results(index).time=result.time; 
++	results(index).(result.fieldname)=result.field;
+ 
+ 	%read next result
+ 	try,
+-		result=ReadData(fid);
++		result  = ReadData(fid);
+ 	catch me,
+-		disp('WARNING: file corrupted, results partial recovery');
++		disp('WARNING: file corrupted, trying partial recovery');
+ 		result=[];
+ 	end
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16755-16756.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16755-16756.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16755-16756.diff	(revision 17802)
@@ -0,0 +1,146 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16755)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16756)
+@@ -1129,15 +1129,23 @@
+ }/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionFS(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	int          i;
++	int          i,dim,meshtype;
+ 	int*         vdoflist=NULL;
+ 	int*         pdoflist=NULL;
+ 	IssmDouble   FSreconditioning;
+ 
++	element->FindParam(&meshtype,MeshTypeEnum);
++	element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; break;
++		case Mesh3DEnum:         dim = 3; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int vnumnodes = element->GetNumberOfNodesVelocity();
+ 	int pnumnodes = element->GetNumberOfNodesPressure();
+-	int vnumdof   = vnumnodes*3;
++	int vnumdof   = vnumnodes*dim;
+ 	int pnumdof   = pnumnodes*1;
+ 
+ 	/*Initialize values*/
+@@ -1150,7 +1158,12 @@
+ 
+ 	/*Prepare coordinate system list*/
+ 	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+-	for(i=0;i<vnumnodes;i++) cs_list[i]           = XYZEnum;
++	if(dim==2){
++		for(i=0;i<vnumnodes;i++) cs_list[i] = XYEnum;
++	}
++	else{
++		for(i=0;i<vnumnodes;i++) cs_list[i] = XYZEnum;
++	}
+ 	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
+ 
+ 	/*Get dof list: */
+@@ -1166,12 +1179,15 @@
+ 
+ 	/*Ok, we have vx and vy in values, fill in all arrays: */
+ 	for(i=0;i<vnumnodes;i++){
+-		vx[i] = values[i*NDOF3+0];
+-		vy[i] = values[i*NDOF3+1];
+-		vz[i] = values[i*NDOF3+2];
++		vx[i] = values[i*dim+0];
++		vy[i] = values[i*dim+1];
+ 		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
+ 		if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
+-		if(xIsNan<IssmDouble>(vz[i])) _error_("NaN found in solution vector");
++
++		if(dim==3){
++			vz[i] = values[i*dim+2];
++			if(xIsNan<IssmDouble>(vz[i])) _error_("NaN found in solution vector");
++		}
+ 	}
+ 	for(i=0;i<pnumnodes;i++){
+ 		pressure[i] = values[vnumdof+i];
+@@ -1179,23 +1195,23 @@
+ 	}
+ 
+ 	/*Recondition pressure and compute vel: */
+-	element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+-	for(i = 0;i<pnumnodes;i++) pressure[i] = pressure[i]*FSreconditioning;
+-	for(i = 0;i<vnumnodes;i++) vel[i]      = sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
++	for(i=0;i<pnumnodes;i++) pressure[i] = pressure[i]*FSreconditioning;
++	if(dim==3) for(i=0;i<vnumnodes;i++) vel[i] = sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
++	else       for(i=0;i<vnumnodes;i++) vel[i] = sqrt(vx[i]*vx[i] + vy[i]*vy[i]);
+ 
+ 	/*Now, we have to move the previous inputs  to old 
+ 	 * status, otherwise, we'll wipe them off: */
+ 	element->InputChangeName(VxEnum,VxPicardEnum);
+ 	element->InputChangeName(VyEnum,VyPicardEnum);
+-	element->InputChangeName(VzEnum,VzPicardEnum);
+ 	element->InputChangeName(PressureEnum,PressurePicardEnum);
++	if(dim==3) element->InputChangeName(VzEnum,VzPicardEnum);
+ 
+ 	/*Add vx and vy as inputs to the tria element: */
+ 	element->AddInput(VxEnum,vx,P1Enum);
+ 	element->AddInput(VyEnum,vy,P1Enum);
+-	element->AddInput(VzEnum,vz,P1Enum);
+ 	element->AddInput(VelEnum,vel,P1Enum);
+ 	element->AddInput(PressureEnum,pressure,P1Enum);
++	if(dim==3) element->AddInput(VzEnum,vz,P1Enum);
+ 
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(pressure);
+@@ -1207,6 +1223,4 @@
+ 	xDelete<int>(vdoflist);
+ 	xDelete<int>(pdoflist);
+ 	xDelete<int>(cs_list);
+-
+-
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp	(revision 16755)
++++ ../trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp	(revision 16756)
+@@ -27,8 +27,8 @@
+ 	Analysis* analysis = EnumToAnalysis(analysisenum);
+ 	for(int i=0;i<femmodel->elements->Size();i++){
+ 		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+-		//analysis->InputUpdateFromSolution(solution,element);
+-		element->InputUpdateFromSolution(solution);
++		analysis->InputUpdateFromSolution(solution,element);
++		//element->InputUpdateFromSolution(solution);
+ 	}
+ 	delete analysis;
+ }
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16755)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16756)
+@@ -2849,6 +2849,13 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Tria::TransformSolutionCoord{{{*/
++void Tria::TransformSolutionCoord(IssmDouble* values,int* transformenum_list){
++
++	::TransformSolutionCoord(values,this->nodes,this->NumberofNodes(),transformenum_list);
++
++}
++/*}}}*/
+ /*FUNCTION Tria::Update{{{*/
+ void Tria::Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finiteelement_type){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16755)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16756)
+@@ -270,7 +270,7 @@
+ 		Seg*	         SpawnSeg(int index1,int index2);
+ 		void	         SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]);
+ 		void           TransformSolutionCoord(IssmDouble* values,int transformenum);
+-		void           TransformSolutionCoord(IssmDouble* values,int* transformenum_list){_error_("not implemented yet");};
++		void           TransformSolutionCoord(IssmDouble* values,int* transformenum_list);
+ 		#ifdef _HAVE_STRESSBALANCE_
+ 		ElementMatrix* CreateKMatrixStressbalanceSSA(void);
+ 		ElementMatrix* CreateKMatrixStressbalanceSSAViscous(void);
Index: issm/oecreview/Archive/16554-17801/ISSM-16756-16757.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16756-16757.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16756-16757.diff	(revision 17802)
@@ -0,0 +1,22 @@
+Index: ../trunk-jpl/src/m/contrib/paraview/exportVTK.m
+===================================================================
+--- ../trunk-jpl/src/m/contrib/paraview/exportVTK.m	(revision 16756)
++++ ../trunk-jpl/src/m/contrib/paraview/exportVTK.m	(revision 16757)
+@@ -98,7 +98,7 @@
+ 		
+ 		%check which field is a real result and print
+ 			for k=1:num_of_fields
+-			if ((length(sol_struct{j}(timestep).(fieldnames{k})))== ...
++			if ((numel(sol_struct{j}(timestep).(fieldnames{k})))== ...
+ 					num_of_points);
+ 				%paraview does not like NaN, replacing
+ 				pos=find(isnan(sol_struct{j}(timestep).(fieldnames{k})));
+@@ -118,7 +118,7 @@
+ 		fieldnames=fields(res_struct);
+ 		num_of_fields=length(fieldnames);
+ 		for k=1:num_of_fields
+-			if ((length(res_struct.(fieldnames{k})))==num_of_points);
++			if ((numel(res_struct.(fieldnames{k})))==num_of_points);
+ 				%paraview does not like NaN, replacing
+ 				pos=find(isnan(res_struct.(fieldnames{k})));
+ 				res_struct.(fieldnames{k})(pos)=-9999;
Index: issm/oecreview/Archive/16554-17801/ISSM-16757-16758.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16757-16758.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16757-16758.diff	(revision 17802)
@@ -0,0 +1,42 @@
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16757)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16758)
+@@ -117,14 +117,6 @@
+ 		/*Second layer*/
+ 		if(isefficientlayer){
+ 
+-			/*Start by retrieving the EPL head slopes*/
+-			/* if(VerboseSolution()) _printf0_("computing EPL Head slope...\n"); */
+-			/* femmodel->SetCurrentConfiguration(L2ProjectionEPLAnalysisEnum); */
+-			/* femmodel->parameters->SetParam(EplHeadSlopeXEnum,InputToL2ProjectEnum); */
+-			/* solutionsequence_linear(femmodel); */
+-			/* femmodel->parameters->SetParam(EplHeadSlopeYEnum,InputToL2ProjectEnum); */
+-			/* solutionsequence_linear(femmodel); */
+-			
+ 			femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
+ 			InputUpdateFromConstantx(femmodel,true,ResetPenaltiesEnum);
+ 			InputUpdateFromConstantx(femmodel,false,ConvergedEnum);
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16757)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16758)
+@@ -7355,13 +7355,12 @@
+ 
+ 		/*If mask was alread one, keep one*/
+ 		else if(old_active[i]>0.){
+-			if(epl_thickness[i]>0.0){
+-				vec_mask->SetValue(nodes[i]->Sid(),1.,INS_VAL);
+-			}
+-			else{
+-				vec_mask->SetValue(nodes[i]->Sid(),0.,INS_VAL);
+-			}
++			vec_mask->SetValue(nodes[i]->Sid(),1.,INS_VAL);
+ 		}
++		/*If epl thickness gets under 0, close the layer*/
++		else if(epl_thickness[i]<0.0){
++			vec_mask->SetValue(nodes[i]->Sid(),0.,INS_VAL);
++		}
+ 		/*Increase of the efficient system is needed if the epl head reach the maximum value (sediment max value for now)*/
+ 		this->GetHydrologyDCInefficientHmax(&h_max,nodes[i]);
+ 		if(eplhead[i]>=h_max && this->AnyActive()){
Index: issm/oecreview/Archive/16554-17801/ISSM-16758-16759.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16758-16759.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16758-16759.diff	(revision 17802)
@@ -0,0 +1,62 @@
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 16758)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 16759)
+@@ -91,32 +91,35 @@
+ 	int pnumdof   = pnumnodes*1;
+ 
+ 	/*Initialize values*/
+-	IssmDouble* vvalues = xNew<IssmDouble>(vnumdof);
+-	IssmDouble* pvalues = xNew<IssmDouble>(pnumdof);
++	IssmDouble* values  = xNew<IssmDouble>(vnumdof+pnumdof);
+ 	IssmDouble* lambdax = xNew<IssmDouble>(vnumnodes);
+ 	IssmDouble* lambday = xNew<IssmDouble>(vnumnodes);
+ 	IssmDouble* lambdaz = xNew<IssmDouble>(vnumnodes);
+ 	IssmDouble* lambdap = xNew<IssmDouble>(pnumnodes);
+ 
++	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
++	for(i=0;i<vnumnodes;i++) cs_list[i] = XYZEnum;
++	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
++
+ 	/*Get dof list: */
+ 	element->GetDofListVelocity(&vdoflist,GsetEnum);
+ 	element->GetDofListPressure(&pdoflist,GsetEnum);
+ 
+ 	/*Use the dof list to index into the solution vector: */
+-	for(i=0;i<vnumdof;i++) vvalues[i]=solution[vdoflist[i]];
+-	for(i=0;i<pnumdof;i++) pvalues[i]=solution[pdoflist[i]];
++	for(i=0;i<vnumdof;i++) values[i]        =solution[vdoflist[i]];
++	for(i=0;i<pnumdof;i++) values[vnumdof+i]=solution[pdoflist[i]];
+ 
+ 	/*Transform solution in Cartesian Space*/
+-	element->TransformSolutionCoord(&vvalues[0],XYZEnum);
++	element->TransformSolutionCoord(values,cs_list);
+ 
+ 	/*fill in all arrays: */
+ 	for(i=0;i<vnumnodes;i++){
+-		lambdax[i] = vvalues[i*NDOF3+0]; if(xIsNan<IssmDouble>(lambdax[i])) _error_("NaN found in solution vector");
+-		lambday[i] = vvalues[i*NDOF3+1]; if(xIsNan<IssmDouble>(lambday[i])) _error_("NaN found in solution vector");
+-		lambdaz[i] = vvalues[i*NDOF3+2]; if(xIsNan<IssmDouble>(lambdaz[i])) _error_("NaN found in solution vector");
++		lambdax[i] = values[i*NDOF3+0]; if(xIsNan<IssmDouble>(lambdax[i])) _error_("NaN found in solution vector");
++		lambday[i] = values[i*NDOF3+1]; if(xIsNan<IssmDouble>(lambday[i])) _error_("NaN found in solution vector");
++		lambdaz[i] = values[i*NDOF3+2]; if(xIsNan<IssmDouble>(lambdaz[i])) _error_("NaN found in solution vector");
+ 	}
+ 	for(i=0;i<pnumnodes;i++){
+-		lambdap[i] = pvalues[i]; if(xIsNan<IssmDouble>(lambdap[i])) _error_("NaN found in solution vector");
++		lambdap[i] = values[vnumdof+i]; if(xIsNan<IssmDouble>(lambdap[i])) _error_("NaN found in solution vector");
+ 	}
+ 
+ 	/*Recondition pressure and compute vel: */
+@@ -132,10 +135,10 @@
+ 	/*Free ressources:*/
+ 	xDelete<int>(vdoflist);
+ 	xDelete<int>(pdoflist);
++	xDelete<int>(cs_list);
+ 	xDelete<IssmDouble>(lambdap);
+ 	xDelete<IssmDouble>(lambdaz);
+ 	xDelete<IssmDouble>(lambday);
+ 	xDelete<IssmDouble>(lambdax);
+-	xDelete<IssmDouble>(vvalues);
+-	xDelete<IssmDouble>(pvalues);
++	xDelete<IssmDouble>(values);
+ }/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16759-16760.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16759-16760.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16759-16760.diff	(revision 17802)
@@ -0,0 +1,15 @@
+Index: ../trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp	(revision 16759)
++++ ../trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp	(revision 16760)
+@@ -27,8 +27,8 @@
+ 	Analysis* analysis = EnumToAnalysis(analysisenum);
+ 	for(int i=0;i<femmodel->elements->Size();i++){
+ 		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+-		analysis->InputUpdateFromSolution(solution,element);
+-		//element->InputUpdateFromSolution(solution);
++		//analysis->InputUpdateFromSolution(solution,element);
++		element->InputUpdateFromSolution(solution);
+ 	}
+ 	delete analysis;
+ }
Index: issm/oecreview/Archive/16554-17801/ISSM-16760-16761.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16760-16761.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16760-16761.diff	(revision 17802)
@@ -0,0 +1,242 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 16760)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 16761)
+@@ -85,5 +85,28 @@
+ 	element->GetSolutionFromInputsOneDof(solution,WatercolumnEnum);
+ }/*}}}*/
+ void HydrologyShreveAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	/*Intermediary*/
++	int* doflist = NULL;
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Fetch dof list and allocate solution vector*/
++	element->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
++	IssmDouble* values = xNew<IssmDouble>(numnodes);
++
++	/*Use the dof list to index into the solution vector: */
++	for(int i=0;i<numnodes;i++){
++		values[i]=solution[doflist[i]];
++		if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector");
++		if (values[i]<10e-10) values[i]=10e-10; //correcting the water column to positive values
++	}
++
++	/*Add input to the element: */
++	element->AddInput(WatercolumnEnum,values,P1Enum);
++
++	/*Free ressources:*/
++	xDelete<IssmDouble>(values);
++	xDelete<int>(doflist);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 16760)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 16761)
+@@ -99,5 +99,15 @@
+ 	element->GetSolutionFromInputsOneDof(solution,EplHeadEnum);
+ }/*}}}*/
+ void HydrologyDCEfficientAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	_error_("not implemented yet");
++	int meshtype;
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			element->InputUpdateFromSolutionOneDof(solution,EplHeadEnum);
++			break;
++		case Mesh3DEnum:
++			element->InputUpdateFromSolutionOneDofCollapsed(solution,EplHeadEnum);
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16760)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16761)
+@@ -140,5 +140,60 @@
+ 	element->GetSolutionFromInputsOneDof(solution,SedimentHeadEnum);
+ }/*}}}*/
+ void HydrologyDCInefficientAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	int        meshtype;
++	bool       converged;
++	int*       doflist=NULL;
++	Element*   basalelement=NULL;
++
++	element->FindParam(&meshtype,MeshTypeEnum);
++	if(meshtype!=Mesh2DhorizontalEnum){
++		if(!element->IsOnBed()) return;
++		basalelement=element->SpawnBasalElement();
++	}
++	else{
++		basalelement = element;
++	}
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = basalelement->GetNumberOfNodes();
++
++	/*Fetch dof list and allocate solution vector*/
++	basalelement->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
++	IssmDouble* values   = xNew<IssmDouble>(numnodes);
++	IssmDouble* residual = xNew<IssmDouble>(numnodes);
++
++	/*Use the dof list to index into the solution vector: */
++	for(int i=0;i<numnodes;i++){
++		values[i] =solution[doflist[i]];
++		if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector");
++	}
++
++	/*If converged keep the residual in mind*/
++	element->GetInputValue(&converged,ConvergedEnum);
++
++	/*Get inputs*/
++	if(converged){
++		IssmDouble penalty_factor,kmax,kappa,h_max;
++		element->FindParam(&kmax,HydrologySedimentKmaxEnum);
++		element->FindParam(&penalty_factor,HydrologydcPenaltyFactorEnum);
++
++		kappa=kmax*pow(10.,penalty_factor);
++
++		for(int i=0;i<numnodes;i++){
++			basalelement->GetHydrologyDCInefficientHmax(&h_max,i);
++			if(values[i]>h_max) residual[i] = kappa*(values[i]-h_max);
++			else                residual[i] = 0.;
++		}
++	}
++
++	/*Add input to the element: */
++	element->AddBasalInput(SedimentHeadEnum,values,P1Enum);
++	element->AddBasalInput(SedimentHeadResidualEnum,residual,P1Enum);
++
++	/*Free ressources:*/
++	xDelete<IssmDouble>(values);
++	xDelete<IssmDouble>(residual);
++	xDelete<int>(doflist);
++	if(meshtype!=Mesh2DhorizontalEnum) delete basalelement;
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 16760)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 16761)
+@@ -73,6 +73,21 @@
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+ void L2ProjectionEPLAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	_error_("not implemented yet");
++	int inputenum,meshtype;
++
++	element->FindParam(&inputenum,InputToL2ProjectEnum);
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			element->InputUpdateFromSolutionOneDof(solution,inputenum);
++			break;
++		case Mesh2DverticalEnum:
++			element->InputUpdateFromSolutionOneDof(solution,inputenum);
++			break;
++		case Mesh3DEnum:
++			element->InputUpdateFromSolutionOneDofCollapsed(solution,inputenum);
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
+ }/*}}}*/
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16760)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16761)
+@@ -168,6 +168,7 @@
+ 
+ 		#ifdef _HAVE_HYDROLOGY_
+ 		virtual void GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode)=0;
++		virtual void GetHydrologyDCInefficientHmax(IssmDouble* ph_max, int index)=0;
+ 		virtual void GetHydrologyTransfer(Vector<IssmDouble>* transfer)=0; 
+ 		virtual void HydrologyEPLGetMask(Vector<IssmDouble>* mask)=0;
+ 		virtual void HydrologyEPLGetActive(Vector<IssmDouble>* active)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16760)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16761)
+@@ -7226,6 +7226,41 @@
+ 		*ph_max=h_max;
+ }
+ /*}}}*/
++/*FUNCTION Tria::GetHydrologyDCInefficientHmax{{{*/
++void  Tria::GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index){
++
++	int        hmax_flag;
++	IssmDouble h_max;
++	IssmDouble rho_ice,rho_water;
++	IssmDouble thickness,bed;
++	/*Get the flag to the limitation method*/
++	this->parameters->FindParam(&hmax_flag,HydrologydcSedimentlimitFlagEnum);
++
++	/*Switch between the different cases*/
++	switch(hmax_flag){
++		case 0:
++			h_max=1.0e+10;
++			break;
++		case 1:
++			parameters->FindParam(&h_max,HydrologydcSedimentlimitEnum);
++			break;
++		case 2:
++			rho_ice=matpar->GetRhoIce();
++			rho_water=matpar->GetRhoFreshwater();
++			this->GetInputValue(&thickness,this->nodes[index],ThicknessEnum);
++			this->GetInputValue(&bed,this->nodes[index],BedEnum);
++			h_max=((rho_ice*thickness)/rho_water)+bed;
++			break;
++		case 3:
++			_error_("Using normal stress  not supported yet");
++			break;
++		default:
++			_error_("no case higher than 3 for SedimentlimitFlag");
++	}
++	/*Assign output pointer*/
++	*ph_max=h_max;
++}
++/*}}}*/
+ /*FUNCTION Tria::GetHydrologyTransfer{{{*/
+ void  Tria::GetHydrologyTransfer(Vector<IssmDouble>* transfer){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16760)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16761)
+@@ -327,6 +327,7 @@
+ 		void	         InputUpdateFromSolutionHydrologyDCInefficient(IssmDouble* solution);
+ 		void	         InputUpdateFromSolutionHydrologyDCEfficient(IssmDouble* solution);
+ 		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode);
++		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index);
+ 		void           GetHydrologyTransfer(Vector<IssmDouble>* transfer);
+ 		void           HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
+ 		void           HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16760)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16761)
+@@ -343,6 +343,7 @@
+ 		ElementVector* CreatePVectorHydrologyDCEfficient(void);
+ 		ElementVector* CreatePVectorL2ProjectionEPL(void);
+ 		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode);
++		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index){_error_("not implemented yet");};
+ 		void           GetHydrologyTransfer(Vector<IssmDouble>* transfer);
+ 		void           HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
+ 		void           HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16760)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16761)
+@@ -127,6 +127,7 @@
+ 		#endif
+ 		#ifdef _HAVE_HYDROLOGY_
+ 		void    GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode){_error_("not implemented yet");};
++		void    GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index){_error_("not implemented yet");};
+ 		void    GetHydrologyTransfer(Vector<IssmDouble>* transfer){_error_("not implemented yet");};
+ 		void    HydrologyEPLGetActive(Vector<IssmDouble>* active_vec){_error_("not implemented yet");};
+ 		void    HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16761-16762.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16761-16762.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16761-16762.diff	(revision 17802)
@@ -0,0 +1,288 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16761)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16762)
+@@ -24,5 +24,6 @@
+ 		void InputUpdateFromSolutionFS(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionHO(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionSSA(IssmDouble* solution,Element* element);
++		void InputUpdateFromSolutionSSAHO(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16761)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16762)
+@@ -946,11 +946,16 @@
+ 			InputUpdateFromSolutionHO(solution,element);
+ 			return;
+ 		case L1L2ApproximationEnum:
+-			InputUpdateFromSolutionHO(solution,element);
++			InputUpdateFromSolutionSSA(solution,element);
+ 			return;
+-		case SSAHOApproximationEnum: case HOFSApproximationEnum: case SSAFSApproximationEnum:
+-			/*the elements around will create the solution*/
++		case SSAHOApproximationEnum:
++			InputUpdateFromSolutionSSAHO(solution,element);
+ 			return;
++		case HOFSApproximationEnum:
++			_error_("not implemented yet");
++		case SSAFSApproximationEnum:
++			_error_("not implemented yet");
++			return;
+ 		default:
+ 			_error_("Approximation "<<EnumToStringx(approximation)<<" not supported");
+ 	}
+@@ -974,12 +979,12 @@
+ 	g       =element->GetMaterialParameter(ConstantsGEnum);
+ 	switch(meshtype){
+ 		case Mesh2DhorizontalEnum:
+-			element->GetInputListOnNodes(thickness,ThicknessEnum);
++			element->GetInputListOnVertices(thickness,ThicknessEnum);
+ 			for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*thickness[i];
+ 			break;
+ 		case Mesh3DEnum:
+ 			element->GetVerticesCoordinates(&xyz_list);
+-			element->GetInputListOnNodes(surface,SurfaceEnum);
++			element->GetInputListOnVertices(surface,SurfaceEnum);
+ 			for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+@@ -995,7 +1000,7 @@
+ 			basalelement = element;
+ 			break;
+ 		case Mesh3DEnum:
+-			if(!element->IsOnBed()) return;
++			if(!element->IsOnBed()){xDelete<IssmDouble>(xyz_list); return;}
+ 			basalelement=element->SpawnBasalElement();
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+@@ -1224,3 +1229,96 @@
+ 	xDelete<int>(pdoflist);
+ 	xDelete<int>(cs_list);
+ }/*}}}*/
++void StressbalanceAnalysis::InputUpdateFromSolutionSSAHO(IssmDouble* solution,Element* element){/*{{{*/
++
++	int         i,meshtype;
++	IssmDouble  rho_ice,g;
++	int*        SSAdoflist = NULL;
++	int*        HOdoflist  = NULL;
++	IssmDouble* xyz_list   = NULL;
++
++	/*we have to add results of this element for HO and results from the element
++	 * at base for SSA, so we need to have the pointer toward the basal element*/
++	Element* basalelement=element->GetBasalElement();
++	if(basalelement->ObjectEnum()!=PentaEnum){
++		_error_("Coupling not supported for "<<EnumToStringx(basalelement->ObjectEnum()));
++	}
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++	int numdof   = numnodes*2;
++	int numdof2d = numnodes;/*FIXME: only works for Penta*/
++
++	/*Fetch dof list and allocate solution vectors*/
++	basalelement->GetDofList(&SSAdoflist,SSAApproximationEnum,GsetEnum);
++	element->GetDofList(     &HOdoflist, HOApproximationEnum, GsetEnum);
++	IssmDouble* HOvalues  = xNew<IssmDouble>(numdof);
++	IssmDouble* SSAvalues = xNew<IssmDouble>(numdof);
++	IssmDouble* vx        = xNew<IssmDouble>(numnodes);
++	IssmDouble* vy        = xNew<IssmDouble>(numnodes);
++	IssmDouble* vz        = xNew<IssmDouble>(numnodes);
++	IssmDouble* vel       = xNew<IssmDouble>(numnodes);
++	IssmDouble* pressure  = xNew<IssmDouble>(numnodes);
++	IssmDouble* surface   = xNew<IssmDouble>(numnodes);
++
++	/*Use the dof list to index into the solution vector: */
++	for(i=0;i<numdof2d;i++){
++		HOvalues[i]  = solution[HOdoflist[i]];
++		SSAvalues[i] = solution[SSAdoflist[i]];
++	}
++	for(i=numdof2d;i<numdof;i++){
++		HOvalues[i]  = solution[HOdoflist[i]];
++		SSAvalues[i] = SSAvalues[i-numdof2d];
++	}
++
++	/*Transform solution in Cartesian Space*/
++	basalelement->TransformSolutionCoord(SSAvalues,XYEnum);
++	element->TransformSolutionCoord(HOvalues,XYEnum);
++
++	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
++	for(i=0;i<numnodes;i++){
++		vx[i]=SSAvalues[i*2+0]+HOvalues[i*2+0];
++		vy[i]=SSAvalues[i*2+1]+HOvalues[i*2+1];
++
++		/*Check solution*/
++		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
++		if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
++	}
++
++	/*Get Vz and compute vel*/
++	element->GetInputListOnNodes(&vz[0],VzEnum,0.);
++	for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
++
++	/*For pressure: we have not computed pressure in this analysis, for this element. We are in 2D, 
++	 *so the pressure is just the pressure at the bedrock: */
++	rho_ice = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	g       = element->GetMaterialParameter(ConstantsGEnum);
++	element->GetVerticesCoordinates(&xyz_list);
++	element->GetInputListOnNodes(&surface[0],SurfaceEnum);
++	for(i=0;i<numnodes;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
++
++	/*Now, we have to move the previous Vx and Vy inputs  to old 
++	 * status, otherwise, we'll wipe them off: */
++	element->InputChangeName(VxEnum,VxPicardEnum);
++	element->InputChangeName(VyEnum,VyPicardEnum);
++	element->InputChangeName(PressureEnum,PressurePicardEnum);
++
++	/*Add vx and vy as inputs to the tria element: */
++	element->AddInput(VxEnum,vx,P1Enum);
++	element->AddInput(VyEnum,vy,P1Enum);
++	element->AddBasalInput(VelEnum,vel,P1Enum);
++	element->AddBasalInput(PressureEnum,pressure,P1Enum);
++
++	/*Free ressources:*/
++	xDelete<IssmDouble>(surface);
++	xDelete<IssmDouble>(pressure);
++	xDelete<IssmDouble>(vel);
++	xDelete<IssmDouble>(vz);
++	xDelete<IssmDouble>(vy);
++	xDelete<IssmDouble>(vx);
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(SSAvalues);
++	xDelete<IssmDouble>(HOvalues);
++	xDelete<int>(SSAdoflist);
++	xDelete<int>(HOdoflist);
++}/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16761)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16762)
+@@ -52,6 +52,7 @@
+ 		virtual IssmDouble GetMaterialParameter(int enum_in)=0;
+ 		virtual void   TransformSolutionCoord(IssmDouble* values,int transformenum)=0;
+ 		virtual void   TransformSolutionCoord(IssmDouble* values,int* transformenum_list)=0;
++		virtual Element* GetBasalElement(void)=0;
+ 		virtual void	GetDofList(int** pdoflist,int approximation_enum,int setenum)=0;
+ 		virtual void	GetDofListVelocity(int** pdoflist,int setenum)=0;
+ 		virtual void	GetDofListPressure(int** pdoflist,int setenum)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16761)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16762)
+@@ -82,6 +82,7 @@
+ 		void        FindParam(int* pvalue,int paramenum);
+ 		void        FindParam(IssmDouble* pvalue,int paramenum);
+ 		int         FiniteElement(void);
++		Element*    GetBasalElement(void){_error_("not implemented yet");};
+ 		void	      GetDofList(int** pdoflist,int approximation_enum,int setenum);
+ 		void	      GetDofListVelocity(int** pdoflist,int setenum);
+ 		void	      GetDofListPressure(int** pdoflist,int setenum);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16761)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16762)
+@@ -1028,7 +1028,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION Penta::GetBasalElement{{{*/
+-Penta* Penta::GetBasalElement(void){
++Element* Penta::GetBasalElement(void){
+ 
+ 	/*Output*/
+ 	Penta* penta=NULL;
+@@ -5214,7 +5214,7 @@
+ 	if(!isenthalpy) return;       
+ 	
+ 	/*get basal element, needed for basal watercolumn*/
+-	pentabase=this->GetBasalElement();
++	pentabase=(Penta*)this->GetBasalElement();
+ 	
+ 	this->GetInputListOnVertices(&enthalpy[0],EnthalpyEnum);
+ 	this->GetInputListOnVertices(&pressure[0],PressureEnum);
+@@ -6987,7 +6987,7 @@
+ 	int         cs_list[numnodes];
+ 
+ 	/*Find penta on bed as HO must be coupled to the dofs on the bed: */
+-	Penta* pentabase=GetBasalElement();
++	Penta* pentabase=(Penta*)GetBasalElement();
+ 	Tria*  tria=pentabase->SpawnTria(0); //lower face is 0, upper face is 1.
+ 
+ 	/*prepare node list*/
+@@ -7182,7 +7182,7 @@
+ 	Node       *node_list[20];
+ 
+ 	/*Find penta on bed as FS must be coupled to the dofs on the bed: */
+-	Penta* pentabase=GetBasalElement();
++	Penta* pentabase=(Penta*)GetBasalElement();
+ 	Tria* tria=pentabase->SpawnTria(0); //lower face is 0, upper face is 1.
+ 
+ 	int vnumnodes = this->NumberofNodesVelocity();
+@@ -7617,7 +7617,7 @@
+ 	GaussTria  *gauss_tria = NULL;
+ 
+ 	/*Find penta on bed as this is a SSA elements: */
+-	pentabase=GetBasalElement();
++	pentabase=(Penta*)GetBasalElement();
+ 	tria=pentabase->SpawnTria(0); //lower face is 0, upper face is 1.
+ 
+ 	/*Initialize Element matrix*/
+@@ -7769,7 +7769,7 @@
+ 	GaussTria  *gauss_tria = NULL;
+ 
+ 	/*Find penta on bed as this is a SSA elements: */
+-	pentabase=GetBasalElement();
++	pentabase=(Penta*)GetBasalElement();
+ 	tria=pentabase->SpawnTria(0); //lower face is 0, upper face is 1.
+ 
+ 	/*Initialize Element matrix*/
+@@ -9981,7 +9981,7 @@
+ 
+ 	/*OK, we have to add results of this element for HO 
+ 	 * and results from the penta at base for SSA. Now recover results*/
+-	penta=GetBasalElement();
++	penta=(Penta*)GetBasalElement();
+ 
+ 	/*Get dof listof this element (HO dofs) and of the penta at base (SSA dofs): */
+ 	GetDofList(&doflistp,HOApproximationEnum,GsetEnum);
+@@ -10074,7 +10074,7 @@
+ 
+ 	/*OK, we have to add results of this element for SSA 
+ 	 * and results from the penta at base for SSA. Now recover results*/
+-	penta=GetBasalElement();
++	penta=(Penta*)GetBasalElement();
+ 
+ 	/*Get dof listof this element (SSA dofs) and of the penta at base (SSA dofs): */
+ 	penta->GetDofList(&doflistSSA,SSAApproximationEnum,GsetEnum);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16761)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16762)
+@@ -84,6 +84,7 @@
+ 		void   CreateJacobianMatrix(Matrix<IssmDouble>* Jff);
+ 		void   Delta18oParameterization(void);
+ 		void   EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure);
++		Element* GetBasalElement(void);
+ 		void	 GetDofList(int** pdoflist,int approximation_enum,int setenum);
+ 		void	 GetDofListVelocity(int** pdoflist,int setenum);
+ 		void	 GetDofListPressure(int** pdoflist,int setenum);
+@@ -227,7 +228,6 @@
+ 		Penta*         GetUpperElement(void);
+ 		void           GetZeroLevelsetCoordinates(IssmDouble* xyz_zero,IssmDouble xyz_list[6][3],int levelsetenum);
+ 		Penta*         GetLowerElement(void);
+-		Penta*         GetBasalElement(void);
+ 		void           InputChangeName(int input_enum, int enum_type_old);
+ 		void	         InputExtrude(int enum_type,int object_type);
+ 		void           InputUpdateFromSolutionMasstransport(IssmDouble* solutiong);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16761)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16762)
+@@ -86,6 +86,7 @@
+ 		void        FindParam(int* pvalue,int paramenum);
+ 		void        FindParam(IssmDouble* pvalue,int paramenum);
+ 		int         FiniteElement(void);
++		Element*    GetBasalElement(void){_error_("not implemented yet");};
+ 		void        GetDofList(int** pdoflist,int approximation_enum,int setenum){_error_("not implemented yet");};
+ 		void        GetDofListVelocity(int** pdoflist,int setenum){_error_("not implemented yet");};
+ 		void        GetDofListPressure(int** pdoflist,int setenum){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16762-16763.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16762-16763.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16762-16763.diff	(revision 17802)
@@ -0,0 +1,33 @@
+Index: ../trunk-jpl/test/NightlyRun/testad.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/testad.m	(revision 16762)
++++ ../trunk-jpl/test/NightlyRun/testad.m	(revision 16763)
+@@ -1,28 +0,0 @@
+-%test reverse scalar vs forward vectorial drivers in ADOLC, using the test3009 setup, equivalent to test109 setup.
+-md=triangle(model(),'../Exp/Square.exp',100000.);
+-md=setmask(md,'all','');
+-md=parameterize(md,'../Par/SquareShelfConstrained.par');
+-md=setflowequation(md,'SSA','all');
+-md.cluster=generic('name',oshostname(),'np',3);
+-%md.debug.valgrind=true;
+-%md.verbose=verbose('11111111')
+-md.toolkits.DefaultAnalysis=issmmumpssolver();
+-%md.toolkits.DefaultAnalysis.solver_type='gsl';
+-
+-md.autodiff.isautodiff=true;
+-md.verbose.autodiff=true;
+-
+-%first run scalar reverse mode: 
+-md.autodiff.independents={independent('name','Thickness','type','vertex','nods',md.mesh.numberofvertices)};
+-md.autodiff.dependents={dependent('name','MaxVel','type','scalar','fos_reverse_index',1)};
+-md.autodiff.driver='fos_reverse';
+-
+-md=solve(md,TransientSolutionEnum());
+-
+-%recover jacobian: 
+-jac_reverse=md.results.TransientSolution(1).AutodiffJacobian;
+-
+-%Fields and tolerances to track changes
+-field_names     ={'Jac Reverse'};
+-field_tolerances={1e-8};
+-field_values={jac_reverse};
Index: issm/oecreview/Archive/16554-17801/ISSM-16763-16764.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16763-16764.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16763-16764.diff	(revision 17802)
@@ -0,0 +1,2091 @@
+Index: ../trunk-jpl/src/m/consistency/checkfield.py
+===================================================================
+--- ../trunk-jpl/src/m/consistency/checkfield.py	(revision 16763)
++++ ../trunk-jpl/src/m/consistency/checkfield.py	(revision 16764)
+@@ -3,11 +3,15 @@
+ from pairoptions import *
+ from MatlabFuncs import *
+ 
+-def checkfield(md,fieldname,*args):
++def checkfield(md,*args):
+ 	"""
+ 	CHECKFIELD - check field consistency
+ 
+-	   Used to check model consistency.
++	   Used to check model consistency.,
++	   Requires: 
++	   'field' or 'fieldname' option. If 'fieldname' is provided, it will retrieve it from the model md. (md.(fieldname)) 
++             If 'field' is provided, it will assume the argument following 'field' is a numeric array.
++
+ 	   Available options:
+ 	      - NaN: 1 if check that there is no NaN
+ 	      - size: [lines cols], NaN for non checked dimensions
+@@ -34,8 +38,13 @@
+ 	options=pairoptions(*args)
+ 
+ 	#get field from model
+-#	field=getattr(md,fieldname)
+-	exec("field=md.%s" % fieldname)
++	if options.exist('field'):
++		field=options.getfieldvalue('field')
++		fieldname=options.getfieldvalue('fieldname','no fieldname')
++	else:
++		fieldname=options.getfieldvalue('fieldname') 
++		exec("field=md.%s" % fieldname)
++
+ 	if isinstance(field,(bool,int,long,float)):
+ 		field=numpy.array([field])
+ 
+Index: ../trunk-jpl/src/m/consistency/checkfield.m
+===================================================================
+--- ../trunk-jpl/src/m/consistency/checkfield.m	(revision 16763)
++++ ../trunk-jpl/src/m/consistency/checkfield.m	(revision 16764)
+@@ -1,7 +1,10 @@
+-function md = checkfield(md,fieldname,varargin)
++function md = checkfield(md,varargin)
+ %CHECKFIELD - check field consistency
+ %
+ %   Used to check model consistency.
++%   Requires: 
++%     'field' or 'fieldname' option. If 'fieldname' is provided, it will retrieve it from the model md. (md.(fieldname)) 
++%             If 'field' is provided, it will assume the argument following 'field' is a numeric array.
+ %   Available options:
+ %      - NaN: 1 if check that there is no NaN
+ %      - size: [lines cols], NaN for non checked dimensions
+@@ -26,9 +29,16 @@
+ %get options
+ options=pairoptions(varargin{:});
+ 
+-%get field from model
+-eval(['field=md.' fieldname ';']);
++%get field: 
++if exist(options,'field'), 
++	field=getfieldvalue(options,'field'); 
++	fieldname=getfieldvalue(options,'fieldname','no fieldname'); 
++else
++	fieldname=getfieldvalue(options,'fieldname'); 
++	eval(['field=md.' fieldname ';']);
++end
+ 
++
+ %check empty
+ if exist(options,'empty')
+ 	if isempty(field),
+Index: ../trunk-jpl/src/m/classes/hydrologydc.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/hydrologydc.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/hydrologydc.m	(revision 16764)
+@@ -71,32 +71,32 @@
+ 				return;
+ 			end
+ 
+-			md = checkfield(md,'hydrology.water_compressibility','>',0,'numel',1);
+-			md = checkfield(md,'hydrology.isefficientlayer','numel',[1],'values',[0 1]);
+-			md = checkfield(md,'hydrology.penalty_factor','>',0,'numel',1);
+-			md = checkfield(md,'hydrology.rel_tol','>',0,'numel',1);
+-			md = checkfield(md,'hydrology.sedimentlimit_flag','numel',[1],'values',[0 1 2 3]);
+-			md = checkfield(md,'hydrology.transfer_flag','numel',[1],'values',[0 1]);
++			md = checkfield(md,'fieldname','hydrology.water_compressibility','>',0,'numel',1);
++			md = checkfield(md,'fieldname','hydrology.isefficientlayer','numel',[1],'values',[0 1]);
++			md = checkfield(md,'fieldname','hydrology.penalty_factor','>',0,'numel',1);
++			md = checkfield(md,'fieldname','hydrology.rel_tol','>',0,'numel',1);
++			md = checkfield(md,'fieldname','hydrology.sedimentlimit_flag','numel',[1],'values',[0 1 2 3]);
++			md = checkfield(md,'fieldname','hydrology.transfer_flag','numel',[1],'values',[0 1]);
+ 			if obj.sedimentlimit_flag==1,
+-				md = checkfield(md,'hydrology.sedimentlimit','>',0,'numel',1);
++				md = checkfield(md,'fieldname','hydrology.sedimentlimit','>',0,'numel',1);
+ 	    end
+ 			if obj.transfer_flag==1,
+-				md = checkfield(md,'hydrology.leakage_factor','>',0,'numel',1);
++				md = checkfield(md,'fieldname','hydrology.leakage_factor','>',0,'numel',1);
+ 	    end
+ 
+-			md = checkfield(md,'hydrology.spcsediment_head','forcing',1);
+-			md = checkfield(md,'hydrology.sediment_compressibility','>',0,'numel',1);
+-			md = checkfield(md,'hydrology.sediment_porosity','>',0,'numel',1);
+-			md = checkfield(md,'hydrology.sediment_thickness','>',0,'numel',1);
+-			md = checkfield(md,'hydrology.sediment_transmitivity','>',0,'numel',1);
++			md = checkfield(md,'fieldname','hydrology.spcsediment_head','forcing',1);
++			md = checkfield(md,'fieldname','hydrology.sediment_compressibility','>',0,'numel',1);
++			md = checkfield(md,'fieldname','hydrology.sediment_porosity','>',0,'numel',1);
++			md = checkfield(md,'fieldname','hydrology.sediment_thickness','>',0,'numel',1);
++			md = checkfield(md,'fieldname','hydrology.sediment_transmitivity','>',0,'numel',1);
+ 
+ 			if obj.isefficientlayer==1,
+-				md = checkfield(md,'hydrology.spcepl_head','forcing',1);
+-				md = checkfield(md,'hydrology.mask_eplactive','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+-				md = checkfield(md,'hydrology.epl_compressibility','>',0,'numel',1);
+-				md = checkfield(md,'hydrology.epl_porosity','>',0,'numel',1);
+-				md = checkfield(md,'hydrology.epl_initial_thickness','>',0,'numel',1);
+-				md = checkfield(md,'hydrology.epl_conductivity','>',0,'numel',1);
++				md = checkfield(md,'fieldname','hydrology.spcepl_head','forcing',1);
++				md = checkfield(md,'fieldname','hydrology.mask_eplactive','size',[md.mesh.numberofvertices 1],'values',[0 1]);
++				md = checkfield(md,'fieldname','hydrology.epl_compressibility','>',0,'numel',1);
++				md = checkfield(md,'fieldname','hydrology.epl_porosity','>',0,'numel',1);
++				md = checkfield(md,'fieldname','hydrology.epl_initial_thickness','>',0,'numel',1);
++				md = checkfield(md,'fieldname','hydrology.epl_conductivity','>',0,'numel',1);
+ 	    end
+ 		end 
+ 		% }}}
+Index: ../trunk-jpl/src/m/classes/initialization.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/initialization.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/initialization.m	(revision 16764)
+@@ -31,48 +31,48 @@
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+ 			if ismember(StressbalanceAnalysisEnum(),analyses)
+ 				if ~(isnan(md.initialization.vx) | isnan(md.initialization.vy)),
+-					md = checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
+-					md = checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
++					md = checkfield(md,'fieldname','initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
++					md = checkfield(md,'fieldname','initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
+ 				end
+ 			end
+ 			if ismember(MasstransportAnalysisEnum(),analyses),
+-				md = checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
+-				md = checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
++				md = checkfield(md,'fieldname','initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
++				md = checkfield(md,'fieldname','initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
+ 			end
+ 			if ismember(BalancethicknessAnalysisEnum(),analyses) & solution==BalancethicknessSolutionEnum,
+-				md = checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
+-				md = checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
++				md = checkfield(md,'fieldname','initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
++				md = checkfield(md,'fieldname','initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
+ 				%Triangle with zero velocity
+ 				if any(sum(abs(md.initialization.vx(md.mesh.elements)),2)==0 & sum(abs(md.initialization.vy(md.mesh.elements)),2)==0)
+ 					md = checkmessage(md,'at least one triangle has all its vertices with a zero velocity');
+ 				end
+ 			end
+ 			if ismember(ThermalAnalysisEnum(),analyses),
+-				md = checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
+-				md = checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
++				md = checkfield(md,'fieldname','initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
++				md = checkfield(md,'fieldname','initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
+ 				if strcmp(meshtype(md.mesh),'3D')
+-					md = checkfield(md,'initialization.vz','NaN',1,'size',[md.mesh.numberofvertices 1]);
++					md = checkfield(md,'fieldname','initialization.vz','NaN',1,'size',[md.mesh.numberofvertices 1]);
+ 				end
+-				md = checkfield(md,'initialization.pressure','NaN',1,'size',[md.mesh.numberofvertices 1]);
++				md = checkfield(md,'fieldname','initialization.pressure','NaN',1,'size',[md.mesh.numberofvertices 1]);
+ 			end
+ 			if (ismember(EnthalpyAnalysisEnum(),analyses) & md.thermal.isenthalpy)
+-				md = checkfield(md,'initialization.waterfraction','>=',0,'size',[md.mesh.numberofvertices 1]);
+-				md = checkfield(md,'initialization.watercolumn'  ,'>=',0,'size',[md.mesh.numberofvertices 1]);
++				md = checkfield(md,'fieldname','initialization.waterfraction','>=',0,'size',[md.mesh.numberofvertices 1]);
++				md = checkfield(md,'fieldname','initialization.watercolumn'  ,'>=',0,'size',[md.mesh.numberofvertices 1]);
+ 			end
+ 			if ismember(HydrologyShreveAnalysisEnum(),analyses),
+ 				if isa(md.hydrology,'hydrologyshreve'),
+-					md = checkfield(md,'initialization.watercolumn','NaN',1,'size',[md.mesh.numberofvertices 1]);
++					md = checkfield(md,'fieldname','initialization.watercolumn','NaN',1,'size',[md.mesh.numberofvertices 1]);
+ 				end
+ 			end
+ 			if ismember(HydrologyDCInefficientAnalysisEnum(),analyses),
+ 				if isa(md.hydrology,'hydrologydc'),
+-					md = checkfield(md,'initialization.sediment_head','NaN',1,'size',[md.mesh.numberofvertices 1]);
++					md = checkfield(md,'fieldname','initialization.sediment_head','NaN',1,'size',[md.mesh.numberofvertices 1]);
+ 				end
+ 			end
+ 			if ismember(HydrologyDCEfficientAnalysisEnum(),analyses),
+ 				if isa(md.hydrology,'hydrologydc'),
+ 					if md.hydrology.isefficientlayer==1,
+-						md = checkfield(md,'initialization.epl_head','NaN',1,'size',[md.mesh.numberofvertices 1]);
++						md = checkfield(md,'fieldname','initialization.epl_head','NaN',1,'size',[md.mesh.numberofvertices 1]);
+ 					end
+ 				end
+ 			end
+Index: ../trunk-jpl/src/m/classes/thermal.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/thermal.py	(revision 16763)
++++ ../trunk-jpl/src/m/classes/thermal.py	(revision 16764)
+@@ -78,15 +78,15 @@
+ 		if (ThermalAnalysisEnum() not in analyses and EnthalpyAnalysisEnum() not in analyses) or (solution==TransientSolutionEnum() and not md.transient.isthermal):
+ 			return md
+ 
+-		md = checkfield(md,'thermal.stabilization','numel',[1],'values',[0,1,2])
+-		md = checkfield(md,'thermal.spctemperature','forcing',1)
++		md = checkfield(md,'fieldname','thermal.stabilization','numel',[1],'values',[0,1,2])
++		md = checkfield(md,'fieldname','thermal.spctemperature','forcing',1)
+ 		if EnthalpyAnalysisEnum() in analyses and md.thermal.isenthalpy and md.mesh.dimension==3:
+ 			pos=numpy.nonzero(numpy.logical_not(numpy.isnan(md.thermal.spctemperature[0:md.mesh.numberofvertices])))
+ 			replicate=numpy.tile(md.geometry.surface-md.mesh.z,(1,numpy.size(md.thermal.spctemperature,axis=1)))
+-			md = checkfield(md,'thermal.spctemperature[numpy.nonzero(numpy.logical_not(numpy.isnan(md.thermal.spctemperature[0:md.mesh.numberofvertices,:])))]','<',md.materials.meltingpoint-md.materials.beta*md.materials.rho_ice*md.constants.g*replicate[pos],'message',"spctemperature should be below the adjusted melting point")
+-			md = checkfield(md,'thermal.isenthalpy','numel',[1],'values',[0,1])
+-			md = checkfield(md,'thermal.isdynamicbasalspc','numel',[1],'values',[0,1]);
+-			md = checkfield(md,'thermal.requested_outputs','stringrow',1)
++			md = checkfield(md,'fieldname','thermal.spctemperature[numpy.nonzero(numpy.logical_not(numpy.isnan(md.thermal.spctemperature[0:md.mesh.numberofvertices,:])))]','<',md.materials.meltingpoint-md.materials.beta*md.materials.rho_ice*md.constants.g*replicate[pos],'message',"spctemperature should be below the adjusted melting point")
++			md = checkfield(md,'fieldname','thermal.isenthalpy','numel',[1],'values',[0,1])
++			md = checkfield(md,'fieldname','thermal.isdynamicbasalspc','numel',[1],'values',[0,1]);
++			md = checkfield(md,'fieldname','thermal.requested_outputs','stringrow',1)
+ 
+ 		return md
+ 	# }}}
+Index: ../trunk-jpl/src/m/classes/flaim.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/flaim.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/flaim.m	(revision 16764)
+@@ -36,11 +36,11 @@
+ 			%Early return
+ 			if solution~=FlaimSolutionEnum(), return; end
+ 
+-			md = checkfield(md,'flaim.tracks','file',1);
++			md = checkfield(md,'fieldname','flaim.tracks','file',1);
+ 			if any(isnan(md.flaim.criterion)) || isempty(md.flaim.criterion)
+-				md = checkfield(md,'flaim.targets','file',1);
++				md = checkfield(md,'fieldname','flaim.targets','file',1);
+ 			else
+-				md = checkfield(md,'flaim.criterion','numel',[md.mesh.numberofvertices md.mesh.numberofelements]);
++				md = checkfield(md,'fieldname','flaim.criterion','numel',[md.mesh.numberofvertices md.mesh.numberofelements]);
+ 			end
+ 
+ 		end % }}}
+Index: ../trunk-jpl/src/m/classes/mask.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mask.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/mask.m	(revision 16764)
+@@ -22,8 +22,8 @@
+ 		end % }}}
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+ 
+-			md = checkfield(md,'mask.groundedice_levelset','size',[md.mesh.numberofvertices 1]);
+-			md = checkfield(md,'mask.ice_levelset'        ,'size',[md.mesh.numberofvertices 1]);
++			md = checkfield(md,'fieldname','mask.groundedice_levelset','size',[md.mesh.numberofvertices 1]);
++			md = checkfield(md,'fieldname','mask.ice_levelset'        ,'size',[md.mesh.numberofvertices 1]);
+ 			isice=(md.mask.ice_levelset>0);
+ 			if any(sum(isice(md.mesh.elements),2)==0),
+ 				warning('elements with no ice not implemented yet, each element should have at least one vertex with md.mask.ice_levelset > 0');
+Index: ../trunk-jpl/src/m/classes/settings.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/settings.py	(revision 16763)
++++ ../trunk-jpl/src/m/classes/settings.py	(revision 16764)
+@@ -50,10 +50,10 @@
+ 		return self
+ 	#}}}
+ 	def checkconsistency(self,md,solution,analyses):    # {{{
+-		md = checkfield(md,'settings.io_gather','numel',[1],'values',[0,1])
+-		md = checkfield(md,'settings.lowmem','numel',[1],'values',[0,1])
+-		md = checkfield(md,'settings.output_frequency','numel',[1],'>=',1)
+-		md = checkfield(md,'settings.waitonlock','numel',[1])
++		md = checkfield(md,'fieldname','settings.io_gather','numel',[1],'values',[0,1])
++		md = checkfield(md,'fieldname','settings.lowmem','numel',[1],'values',[0,1])
++		md = checkfield(md,'fieldname','settings.output_frequency','numel',[1],'>=',1)
++		md = checkfield(md,'fieldname','settings.waitonlock','numel',[1])
+ 
+ 		return md
+ 	# }}}
+Index: ../trunk-jpl/src/m/classes/gia.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/gia.py	(revision 16763)
++++ ../trunk-jpl/src/m/classes/gia.py	(revision 16764)
+@@ -41,9 +41,9 @@
+ 		if (GiaAnalysisEnum() not in  analyses):
+ 			return md 
+ 		
+-		md = checkfield(md,'gia.mantle_viscosity','NaN',1,'size',[md.mesh.numberofvertices,1],'>',0)
+-		md = checkfield(md,'gia.lithosphere_thickness','NaN',1,'size',[md.mesh.numberofvertices,1],'>',0)
+-		md = checkfield(md,'gia.cross_section_shape','numel',[1],'values',[1,2])
++		md = checkfield(md,'fieldname','gia.mantle_viscosity','NaN',1,'size',[md.mesh.numberofvertices,1],'>',0)
++		md = checkfield(md,'fieldname','gia.lithosphere_thickness','NaN',1,'size',[md.mesh.numberofvertices,1],'>',0)
++		md = 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.
+Index: ../trunk-jpl/src/m/classes/balancethickness.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/balancethickness.py	(revision 16763)
++++ ../trunk-jpl/src/m/classes/balancethickness.py	(revision 16764)
+@@ -41,9 +41,9 @@
+ 		if not solution==BalancethicknessSolutionEnum():
+ 			return md
+ 
+-		md = checkfield(md,'balancethickness.spcthickness')
+-		md = checkfield(md,'balancethickness.thickening_rate','size',[md.mesh.numberofvertices],'NaN',1)
+-		md = checkfield(md,'balancethickness.stabilization','size',[1],'values',[0,1,2,3])
++		md = checkfield(md,'fieldname','balancethickness.spcthickness')
++		md = checkfield(md,'fieldname','balancethickness.thickening_rate','size',[md.mesh.numberofvertices],'NaN',1)
++		md = checkfield(md,'fieldname','balancethickness.stabilization','size',[1],'values',[0,1,2,3])
+ 
+ 		return md
+ 	# }}}
+Index: ../trunk-jpl/src/m/classes/groundingline.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/groundingline.py	(revision 16763)
++++ ../trunk-jpl/src/m/classes/groundingline.py	(revision 16764)
+@@ -41,7 +41,7 @@
+ 	#}}}
+ 	def checkconsistency(self,md,solution,analyses):    # {{{
+ 
+-		md = checkfield(md,'groundingline.migration','values',['None','AgressiveMigration','SoftMigration','SubelementMigration','SubelementMigration2'])
++		md = checkfield(md,'fieldname','groundingline.migration','values',['None','AgressiveMigration','SoftMigration','SubelementMigration','SubelementMigration2'])
+ 
+ 		if not strcmp(self.migration,'None'):
+ 			if numpy.any(numpy.isnan(md.geometry.bathymetry)):
+Index: ../trunk-jpl/src/m/classes/balancethickness.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/balancethickness.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/balancethickness.m	(revision 16764)
+@@ -28,9 +28,9 @@
+ 			%Early return
+ 			if solution~=BalancethicknessSolutionEnum(), return; end
+ 
+-			md = checkfield(md,'balancethickness.spcthickness');
+-			md = checkfield(md,'balancethickness.thickening_rate','size',[md.mesh.numberofvertices 1],'NaN',1);
+-			md = checkfield(md,'balancethickness.stabilization','size',[1 1],'values',[0 1 2 3]);
++			md = checkfield(md,'fieldname','balancethickness.spcthickness');
++			md = checkfield(md,'fieldname','balancethickness.thickening_rate','size',[md.mesh.numberofvertices 1],'NaN',1);
++			md = checkfield(md,'fieldname','balancethickness.stabilization','size',[1 1],'values',[0 1 2 3]);
+ 		end % }}}
+ 		function disp(obj) % {{{
+ 			disp(sprintf('   balance thickness solution parameters:'));
+Index: ../trunk-jpl/src/m/classes/transient.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/transient.py	(revision 16763)
++++ ../trunk-jpl/src/m/classes/transient.py	(revision 16764)
+@@ -57,12 +57,12 @@
+ 		if not solution==TransientSolutionEnum():
+ 			return md
+ 
+-		md = checkfield(md,'transient.ismasstransport','numel',[1],'values',[0,1])
+-		md = checkfield(md,'transient.isstressbalance','numel',[1],'values',[0,1])
+-		md = checkfield(md,'transient.isthermal','numel',[1],'values',[0,1])
+-		md = checkfield(md,'transient.isgroundingline','numel',[1],'values',[0,1])
+-		md = checkfield(md,'transient.isgia','numel',[1],'values',[0,1])
+-		md = checkfield(md,'transient.requested_outputs','stringrow',1)
++		md = checkfield(md,'fieldname','transient.ismasstransport','numel',[1],'values',[0,1])
++		md = checkfield(md,'fieldname','transient.isstressbalance','numel',[1],'values',[0,1])
++		md = checkfield(md,'fieldname','transient.isthermal','numel',[1],'values',[0,1])
++		md = checkfield(md,'fieldname','transient.isgroundingline','numel',[1],'values',[0,1])
++		md = checkfield(md,'fieldname','transient.isgia','numel',[1],'values',[0,1])
++		md = checkfield(md,'fieldname','transient.requested_outputs','stringrow',1)
+ 
+ 		return md
+ 	# }}}
+Index: ../trunk-jpl/src/m/classes/damage.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/damage.py	(revision 16763)
++++ ../trunk-jpl/src/m/classes/damage.py	(revision 16764)
+@@ -98,24 +98,24 @@
+ 	# }}}
+ 	def checkconsistency(self,md,solution,analyses):    # {{{
+ 
+-		md = checkfield(md,'damage.D','>=',0,'<=',self.max_damage,'size',[md.mesh.numberofvertices])
+-		md = checkfield(md,'damage.max_damage','<',1,'>=',0)
+-		md = checkfield(md,'damage.law','values',['undamaged','pralong'])
+-		md = checkfield(md,'damage.spcdamage','forcing',1)
++		md = checkfield(md,'fieldname','damage.D','>=',0,'<=',self.max_damage,'size',[md.mesh.numberofvertices])
++		md = checkfield(md,'fieldname','damage.max_damage','<',1,'>=',0)
++		md = checkfield(md,'fieldname','damage.law','values',['undamaged','pralong'])
++		md = checkfield(md,'fieldname','damage.spcdamage','forcing',1)
+ 			
+-		md = checkfield(md,'damage.stabilization','numel',[1],'values',[0,1,2]);
+-		md = checkfield(md,'damage.maxiter','>=0',0);
+-		md = checkfield(md,'damage.penalty_factor','>=0',0);
+-		md = checkfield(md,'damage.penalty_lock','>=0',0);
+-		md = checkfield(md,'damage.penalty_threshold','>=0',0);
++		md = checkfield(md,'fieldname','damage.stabilization','numel',[1],'values',[0,1,2]);
++		md = checkfield(md,'fieldname','damage.maxiter','>=0',0);
++		md = checkfield(md,'fieldname','damage.penalty_factor','>=0',0);
++		md = checkfield(md,'fieldname','damage.penalty_lock','>=0',0);
++		md = checkfield(md,'fieldname','damage.penalty_threshold','>=0',0);
+ 
+ 		if self.law == 'pralong':
+-			md = checkfield(md,'damage.healing','>=',0);
+-			md = checkfield(md,'damage.c1','>=',0)
+-			md = checkfield(md,'damage.c2','>=',0)
+-			md = checkfield(md,'damage.c3','>=',0)
+-			md = checkfield(md,'damage.c4','>=',0)
+-			md = checkfield(md,'damage.stress_threshold','>=',0)
++			md = checkfield(md,'fieldname','damage.healing','>=',0);
++			md = checkfield(md,'fieldname','damage.c1','>=',0)
++			md = checkfield(md,'fieldname','damage.c2','>=',0)
++			md = checkfield(md,'fieldname','damage.c3','>=',0)
++			md = checkfield(md,'fieldname','damage.c4','>=',0)
++			md = checkfield(md,'fieldname','damage.stress_threshold','>=',0)
+ 		elif strcmpi(self.law,'undamaged'):
+ 			if (solution==DamageEvolutionSolutionEnum):
+ 				raise RuntimeError('Invalid evolution law (md.damage.law) for a damage solution');
+Index: ../trunk-jpl/src/m/classes/inversion.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/inversion.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/inversion.m	(revision 16764)
+@@ -106,19 +106,19 @@
+ 			num_controls=numel(md.inversion.control_parameters);
+ 			num_costfunc=size(md.inversion.cost_functions,2);
+ 
+-			md = checkfield(md,'inversion.iscontrol','values',[0 1]);
+-			md = checkfield(md,'inversion.tao','values',[0 1]);
+-			md = checkfield(md,'inversion.incomplete_adjoint','values',[0 1]);
+-			md = checkfield(md,'inversion.control_parameters','cell',1,'values',...
++			md = checkfield(md,'fieldname','inversion.iscontrol','values',[0 1]);
++			md = checkfield(md,'fieldname','inversion.tao','values',[0 1]);
++			md = checkfield(md,'fieldname','inversion.incomplete_adjoint','values',[0 1]);
++			md = checkfield(md,'fieldname','inversion.control_parameters','cell',1,'values',...
+ 				{'BalancethicknessThickeningRate' 'FrictionCoefficient' 'MaterialsRheologyBbar' 'DamageDbar' 'Vx' 'Vy' 'Thickness'});
+-			md = checkfield(md,'inversion.nsteps','numel',1,'>=',0);
+-			md = checkfield(md,'inversion.maxiter_per_step','size',[md.inversion.nsteps 1],'>=',0);
+-			md = checkfield(md,'inversion.step_threshold','size',[md.inversion.nsteps 1]);
+-			md = checkfield(md,'inversion.cost_functions','size',[1 num_costfunc],'values',[101:105 201 501:506]);
+-			md = checkfield(md,'inversion.cost_functions_coefficients','size',[md.mesh.numberofvertices num_costfunc],'>=',0);
+-			md = checkfield(md,'inversion.gradient_scaling','size',[md.inversion.nsteps num_controls]);
+-			md = checkfield(md,'inversion.min_parameters','size',[md.mesh.numberofvertices num_controls]);
+-			md = checkfield(md,'inversion.max_parameters','size',[md.mesh.numberofvertices num_controls]);
++			md = checkfield(md,'fieldname','inversion.nsteps','numel',1,'>=',0);
++			md = checkfield(md,'fieldname','inversion.maxiter_per_step','size',[md.inversion.nsteps 1],'>=',0);
++			md = checkfield(md,'fieldname','inversion.step_threshold','size',[md.inversion.nsteps 1]);
++			md = checkfield(md,'fieldname','inversion.cost_functions','size',[1 num_costfunc],'values',[101:105 201 501:506]);
++			md = checkfield(md,'fieldname','inversion.cost_functions_coefficients','size',[md.mesh.numberofvertices num_costfunc],'>=',0);
++			md = checkfield(md,'fieldname','inversion.gradient_scaling','size',[md.inversion.nsteps num_controls]);
++			md = checkfield(md,'fieldname','inversion.min_parameters','size',[md.mesh.numberofvertices num_controls]);
++			md = checkfield(md,'fieldname','inversion.max_parameters','size',[md.mesh.numberofvertices num_controls]);
+ 
+ 			%Only SSA, HO and FS are supported right now
+ 			if solution==StressbalanceSolutionEnum()
+@@ -128,12 +128,12 @@
+ 			end
+ 
+ 			if solution==BalancethicknessSolutionEnum()
+-				md = checkfield(md,'inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
++				md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+ 			elseif solution==BalancethicknessSoftSolutionEnum()
+-				md = checkfield(md,'inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
++				md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+ 			else
+-				md = checkfield(md,'inversion.vx_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+-				md = checkfield(md,'inversion.vy_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
++				md = checkfield(md,'fieldname','inversion.vx_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
++				md = checkfield(md,'fieldname','inversion.vy_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+ 			end
+ 		end % }}}
+ 		function disp(obj) % {{{
+Index: ../trunk-jpl/src/m/classes/surfaceforcings.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/surfaceforcings.py	(revision 16763)
++++ ../trunk-jpl/src/m/classes/surfaceforcings.py	(revision 16764)
+@@ -72,30 +72,30 @@
+ 	def checkconsistency(self,md,solution,analyses):    # {{{
+ 
+ 		if MasstransportAnalysisEnum() in analyses:
+-			md = checkfield(md,'surfaceforcings.ispdd','numel',[1],'values',[0,1])
+-			md = checkfield(md,'surfaceforcings.issmbgradients','numel',[1],'values',[0,1])
++			md = checkfield(md,'fieldname','surfaceforcings.ispdd','numel',[1],'values',[0,1])
++			md = checkfield(md,'fieldname','surfaceforcings.issmbgradients','numel',[1],'values',[0,1])
+ 			if   self.ispdd:
+-				md = checkfield(md,'surfaceforcings.desfac','<=',1,'numel',[1]);
+-				md = checkfield(md,'surfaceforcings.s0p','>=',0,'numel',[1]);
++				md = checkfield(md,'fieldname','surfaceforcings.desfac','<=',1,'numel',[1]);
++				md = checkfield(md,'fieldname','surfaceforcings.s0p','>=',0,'numel',[1]);
+ 				if not self.isdelta18o:
+-					md = checkfield(md,'surfaceforcings.monthlytemperatures','forcing',1,'NaN',1)
+-					md = checkfield(md,'surfaceforcings.precipitation','forcing',1,'NaN',1)
++					md = checkfield(md,'fieldname','surfaceforcings.monthlytemperatures','forcing',1,'NaN',1)
++					md = checkfield(md,'fieldname','surfaceforcings.precipitation','forcing',1,'NaN',1)
+ 				else:
+-					md = checkfield(md,'surfaceforcings.delta18o','NaN',1)
+-					md = checkfield(md,'surfaceforcings.delta18o_surface','NaN',1)
+-					md = checkfield(md,'surfaceforcings.temperatures_presentday','size',[md.mesh.numberofvertices+1,12],'NaN',1)
+-					md = checkfield(md,'surfaceforcings.temperatures_lgm','size',[md.mesh.numberofvertices+1,12],'NaN',1)
+-					md = checkfield(md,'surfaceforcings.precipitations_presentday','size',[md.mesh.numberofvertices+1,12],'NaN',1)
++					md = checkfield(md,'fieldname','surfaceforcings.delta18o','NaN',1)
++					md = checkfield(md,'fieldname','surfaceforcings.delta18o_surface','NaN',1)
++					md = checkfield(md,'fieldname','surfaceforcings.temperatures_presentday','size',[md.mesh.numberofvertices+1,12],'NaN',1)
++					md = checkfield(md,'fieldname','surfaceforcings.temperatures_lgm','size',[md.mesh.numberofvertices+1,12],'NaN',1)
++					md = checkfield(md,'fieldname','surfaceforcings.precipitations_presentday','size',[md.mesh.numberofvertices+1,12],'NaN',1)
+ 			elif self.issmbgradients:
+-				md = checkfield(md,'surfaceforcings.href','forcing',1,'NaN',1)
+-				md = checkfield(md,'surfaceforcings.smbref','forcing',1,'NaN',1)
+-				md = checkfield(md,'surfaceforcings.b_pos','forcing',1,'NaN',1)
+-				md = checkfield(md,'surfaceforcings.b_neg','forcing',1,'NaN',1)
++				md = checkfield(md,'fieldname','surfaceforcings.href','forcing',1,'NaN',1)
++				md = checkfield(md,'fieldname','surfaceforcings.smbref','forcing',1,'NaN',1)
++				md = checkfield(md,'fieldname','surfaceforcings.b_pos','forcing',1,'NaN',1)
++				md = checkfield(md,'fieldname','surfaceforcings.b_neg','forcing',1,'NaN',1)
+ 			else:
+-				md = checkfield(md,'surfaceforcings.mass_balance','forcing',1,'NaN',1)
++				md = checkfield(md,'fieldname','surfaceforcings.mass_balance','forcing',1,'NaN',1)
+ 
+ 		if BalancethicknessAnalysisEnum() in analyses:
+-			md = checkfield(md,'surfaceforcings.mass_balance','size',[md.mesh.numberofvertices],'NaN',1)
++			md = checkfield(md,'fieldname','surfaceforcings.mass_balance','size',[md.mesh.numberofvertices],'NaN',1)
+ 
+ 		return md
+ 	# }}}
+Index: ../trunk-jpl/src/m/classes/mesh.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh.py	(revision 16763)
++++ ../trunk-jpl/src/m/classes/mesh.py	(revision 16764)
+@@ -122,42 +122,42 @@
+ 	#}}}
+ 	def checkconsistency(self,md,solution,analyses):    # {{{
+ 
+-		md = checkfield(md,'mesh.x','NaN',1,'size',[md.mesh.numberofvertices])
+-		md = checkfield(md,'mesh.y','NaN',1,'size',[md.mesh.numberofvertices])
+-		md = checkfield(md,'mesh.z','NaN',1,'size',[md.mesh.numberofvertices])
+-		md = checkfield(md,'mesh.elements','NaN',1,'>',0,'values',numpy.arange(1,md.mesh.numberofvertices+1))
++		md = checkfield(md,'fieldname','mesh.x','NaN',1,'size',[md.mesh.numberofvertices])
++		md = checkfield(md,'fieldname','mesh.y','NaN',1,'size',[md.mesh.numberofvertices])
++		md = checkfield(md,'fieldname','mesh.z','NaN',1,'size',[md.mesh.numberofvertices])
++		md = checkfield(md,'fieldname','mesh.elements','NaN',1,'>',0,'values',numpy.arange(1,md.mesh.numberofvertices+1))
+ 		if md.mesh.dimension==2:
+-			md = checkfield(md,'mesh.elements','size',[md.mesh.numberofelements,3])
++			md = checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements,3])
+ 		else:
+-			md = checkfield(md,'mesh.elements','size',[md.mesh.numberofelements,6])
++			md = checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements,6])
+ 		if numpy.any(numpy.logical_not(ismember(numpy.arange(1,md.mesh.numberofvertices+1),md.mesh.elements))):
+ 			md.checkmessage("orphan nodes have been found. Check the mesh outline")
+-		md = checkfield(md,'mesh.dimension','values',[2,3])
+-		md = checkfield(md,'mesh.numberoflayers','>=',0)
+-		md = checkfield(md,'mesh.numberofelements','>',0)
+-		md = checkfield(md,'mesh.numberofvertices','>',0)
++		md = checkfield(md,'fieldname','mesh.dimension','values',[2,3])
++		md = checkfield(md,'fieldname','mesh.numberoflayers','>=',0)
++		md = checkfield(md,'fieldname','mesh.numberofelements','>',0)
++		md = checkfield(md,'fieldname','mesh.numberofvertices','>',0)
+ 		#no checks for numberofedges lat long and hemisphere
+-		md = checkfield(md,'mesh.elementonbed','size',[md.mesh.numberofelements],'values',[0,1])
+-		md = checkfield(md,'mesh.elementonsurface','size',[md.mesh.numberofelements],'values',[0,1])
+-		md = checkfield(md,'mesh.vertexonbed','size',[md.mesh.numberofvertices],'values',[0,1])
+-		md = checkfield(md,'mesh.vertexonsurface','size',[md.mesh.numberofvertices],'values',[0,1])
++		md = checkfield(md,'fieldname','mesh.elementonbed','size',[md.mesh.numberofelements],'values',[0,1])
++		md = checkfield(md,'fieldname','mesh.elementonsurface','size',[md.mesh.numberofelements],'values',[0,1])
++		md = checkfield(md,'fieldname','mesh.vertexonbed','size',[md.mesh.numberofvertices],'values',[0,1])
++		md = checkfield(md,'fieldname','mesh.vertexonsurface','size',[md.mesh.numberofvertices],'values',[0,1])
+ 		if md.mesh.dimension==2:
+-			md = checkfield(md,'mesh.average_vertex_connectivity','>=',9,'message',"'mesh.average_vertex_connectivity' should be at least 9 in 2d")
++			md = checkfield(md,'fieldname','mesh.average_vertex_connectivity','>=',9,'message',"'mesh.average_vertex_connectivity' should be at least 9 in 2d")
+ 		else:
+-			md = checkfield(md,'mesh.average_vertex_connectivity','>=',24,'message',"'mesh.average_vertex_connectivity' should be at least 24 in 3d")
++			md = checkfield(md,'fieldname','mesh.average_vertex_connectivity','>=',24,'message',"'mesh.average_vertex_connectivity' should be at least 24 in 3d")
+ 
+ 		#Solution specific checks
+ 		if   solution==MasstransportSolutionEnum():
+ 			if md.masstransport.stabilization==3:
+-				md = checkfield(md,'mesh.dimension','values',2,'message',"Discontinuous Galerkin only supported for 2d meshes")
++				md = checkfield(md,'fieldname','mesh.dimension','values',2,'message',"Discontinuous Galerkin only supported for 2d meshes")
+ 		elif solution==BalancethicknessSolutionEnum():
+ 			if md.balancethickness.stabilization==3:
+-				md = checkfield(md,'mesh.dimension','values',2,'message',"Discontinuous Galerkin only supported for 2d meshes")
++				md = checkfield(md,'fieldname','mesh.dimension','values',2,'message',"Discontinuous Galerkin only supported for 2d meshes")
+ 		elif solution==TransientSolutionEnum():
+ 			if md.transient.ismasstransport and md.masstransport.stabilization==3:
+-				md = checkfield(md,'mesh.dimension','values',2,'message',"Discontinuous Galerkin only supported for 2d meshes")
++				md = checkfield(md,'fieldname','mesh.dimension','values',2,'message',"Discontinuous Galerkin only supported for 2d meshes")
+ 		elif solution==ThermalSolutionEnum():
+-			md = checkfield(md,'mesh.dimension','values',3,'message','thermal solution only supported on 3d meshes')
++			md = checkfield(md,'fieldname','mesh.dimension','values',3,'message','thermal solution only supported on 3d meshes')
+ 
+ 		return md
+ 	# }}}
+Index: ../trunk-jpl/src/m/classes/geometry.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/geometry.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/geometry.m	(revision 16764)
+@@ -26,16 +26,16 @@
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+ 
+ 			if (solution==TransientSolutionEnum() & md.transient.isgia) | (solution==GiaSolutionEnum()),
+-				md = checkfield(md,'geometry.thickness','forcing',1,'NaN',1,'>=',0);
++				md = checkfield(md,'fieldname','geometry.thickness','forcing',1,'NaN',1,'>=',0);
+ 			else
+-				md = checkfield(md,'geometry.surface'  ,'NaN',1,'size',[md.mesh.numberofvertices 1]);
+-				md = checkfield(md,'geometry.bed'      ,'NaN',1,'size',[md.mesh.numberofvertices 1]);
+-				md = checkfield(md,'geometry.thickness','NaN',1,'size',[md.mesh.numberofvertices 1],'>',0);
++				md = checkfield(md,'fieldname','geometry.surface'  ,'NaN',1,'size',[md.mesh.numberofvertices 1]);
++				md = checkfield(md,'fieldname','geometry.bed'      ,'NaN',1,'size',[md.mesh.numberofvertices 1]);
++				md = checkfield(md,'fieldname','geometry.thickness','NaN',1,'size',[md.mesh.numberofvertices 1],'>',0);
+ 				if any((obj.thickness-obj.surface+obj.bed)>10^-9),
+ 					md = checkmessage(md,['equality thickness=surface-bed violated']);
+ 				end 
+ 				if solution==TransientSolutionEnum() & md.transient.isgroundingline,
+-					md = checkfield(md,'geometry.bathymetry','NaN',1,'size',[md.mesh.numberofvertices 1]);
++					md = checkfield(md,'fieldname','geometry.bathymetry','NaN',1,'size',[md.mesh.numberofvertices 1]);
+ 				end
+ 			end
+ 		end % }}}
+Index: ../trunk-jpl/src/m/classes/thermal.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/thermal.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/thermal.m	(revision 16764)
+@@ -61,20 +61,20 @@
+ 			%Early return
+ 			if (~ismember(ThermalAnalysisEnum(),analyses) & ~ismember(EnthalpyAnalysisEnum(),analyses)) | (solution==TransientSolutionEnum() & md.transient.isthermal==0), return; end
+ 
+-			md = checkfield(md,'thermal.stabilization','numel',[1],'values',[0 1 2]);
+-			md = checkfield(md,'thermal.spctemperature','forcing',1);
++			md = checkfield(md,'fieldname','thermal.stabilization','numel',[1],'values',[0 1 2]);
++			md = checkfield(md,'fieldname','thermal.spctemperature','forcing',1);
+ 			if (ismember(EnthalpyAnalysisEnum(),analyses) & md.thermal.isenthalpy & md.mesh.dimension==3),
+ 				pos=find(md.thermal.spctemperature(1:md.mesh.numberofvertices,:)~=NaN);
+ 				replicate=repmat(md.geometry.surface-md.mesh.z,1,size(md.thermal.spctemperature,2));
+-				md = checkfield(md,'thermal.spctemperature(find(md.thermal.spctemperature(1:md.mesh.numberofvertices,:)~=NaN))','<',md.materials.meltingpoint-md.materials.beta*md.materials.rho_ice*md.constants.g*replicate(pos),'message','spctemperature should be below the adjusted melting point');
+-				md = checkfield(md,'thermal.isenthalpy','numel',[1],'values',[0 1]);
+-				md = checkfield(md,'thermal.isdynamicbasalspc','numel', [1],'values',[0 1]);
++				md = checkfield(md,'fieldname','thermal.spctemperature(find(md.thermal.spctemperature(1:md.mesh.numberofvertices,:)~=NaN))','<',md.materials.meltingpoint-md.materials.beta*md.materials.rho_ice*md.constants.g*replicate(pos),'message','spctemperature should be below the adjusted melting point');
++				md = checkfield(md,'fieldname','thermal.isenthalpy','numel',[1],'values',[0 1]);
++				md = checkfield(md,'fieldname','thermal.isdynamicbasalspc','numel', [1],'values',[0 1]);
+ 				if(md.thermal.isenthalpy)
+-					md = checkfield(md,'thermal.isdynamicbasalspc','numel', [1],'values',[1], 'message',['for enthalpy run thermal.isdynamicbasalspc should be 1']);
++					md = checkfield(md,'fieldname','thermal.isdynamicbasalspc','numel', [1],'values',[1], 'message',['for enthalpy run thermal.isdynamicbasalspc should be 1']);
+ 				end
+ 	    end
+ 
+-		 md = checkfield(md,'thermal.requested_outputs','stringrow',1);
++		 md = checkfield(md,'fieldname','thermal.requested_outputs','stringrow',1);
+     end % }}} 
+ 		function disp(obj) % {{{
+ 			disp(sprintf('   Thermal solution parameters:'));
+Index: ../trunk-jpl/src/m/classes/gia.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/gia.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/gia.m	(revision 16764)
+@@ -24,9 +24,9 @@
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+ 
+ 			if ~ismember(GiaAnalysisEnum(),analyses), return; end
+-			md = checkfield(md,'gia.mantle_viscosity','NaN',1,'size',[md.mesh.numberofvertices 1],'>',0);
+-			md = checkfield(md,'gia.lithosphere_thickness','NaN',1,'size',[md.mesh.numberofvertices 1],'>',0);
+-			md = checkfield(md,'gia.cross_section_shape','numel',[1],'values',[1,2]);
++			md = checkfield(md,'fieldname','gia.mantle_viscosity','NaN',1,'size',[md.mesh.numberofvertices 1],'>',0);
++			md = checkfield(md,'fieldname','gia.lithosphere_thickness','NaN',1,'size',[md.mesh.numberofvertices 1],'>',0);
++			md = 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.
+Index: ../trunk-jpl/src/m/classes/settings.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/settings.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/settings.m	(revision 16764)
+@@ -48,10 +48,10 @@
+ 		end % }}}
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+ 
+-			md = checkfield(md,'settings.io_gather','numel',[1],'values',[0 1]);
+-			md = checkfield(md,'settings.lowmem','numel',[1],'values',[0 1]);
+-			md = checkfield(md,'settings.output_frequency','numel',[1],'>=',1);
+-			md = checkfield(md,'settings.waitonlock','numel',[1]);
++			md = checkfield(md,'fieldname','settings.io_gather','numel',[1],'values',[0 1]);
++			md = checkfield(md,'fieldname','settings.lowmem','numel',[1],'values',[0 1]);
++			md = checkfield(md,'fieldname','settings.output_frequency','numel',[1],'>=',1);
++			md = checkfield(md,'fieldname','settings.waitonlock','numel',[1]);
+ 
+ 		end % }}}
+ 		function disp(obj) % {{{
+Index: ../trunk-jpl/src/m/classes/miscellaneous.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/miscellaneous.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/miscellaneous.m	(revision 16764)
+@@ -20,7 +20,7 @@
+ 		end % }}}
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+ 
+-			md = checkfield(md,'miscellaneous.name','empty',1);
++			md = checkfield(md,'fieldname','miscellaneous.name','empty',1);
+ 
+ 		end % }}}
+ 		function obj = setdefaultparameters(obj) % {{{
+Index: ../trunk-jpl/src/m/classes/groundingline.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/groundingline.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/groundingline.m	(revision 16764)
+@@ -28,7 +28,7 @@
+ 		end % }}}
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+ 
+-			md = checkfield(md,'groundingline.migration','values',{'None' 'AgressiveMigration' 'SoftMigration' 'SubelementMigration','SubelementMigration2'});
++			md = checkfield(md,'fieldname','groundingline.migration','values',{'None' 'AgressiveMigration' 'SoftMigration' 'SubelementMigration','SubelementMigration2'});
+ 
+ 			if ~strcmp(obj.migration,'None'),
+ 				if isnan(md.geometry.bathymetry),
+Index: ../trunk-jpl/src/m/classes/timestepping.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/timestepping.py	(revision 16763)
++++ ../trunk-jpl/src/m/classes/timestepping.py	(revision 16764)
+@@ -47,11 +47,11 @@
+ 	#}}}
+ 	def checkconsistency(self,md,solution,analyses):    # {{{
+ 
+-		md = checkfield(md,'timestepping.start_time','numel',[1],'NaN',1)
+-		md = checkfield(md,'timestepping.final_time','numel',[1],'NaN',1)
+-		md = checkfield(md,'timestepping.time_step','numel',[1],'>=',0,'NaN',1)
+-		md = checkfield(md,'timestepping.time_adapt','numel',[1],'values',[0,1])
+-		md = checkfield(md,'timestepping.cfl_coefficient','numel',[1],'>',0,'<=',1)
++		md = checkfield(md,'fieldname','timestepping.start_time','numel',[1],'NaN',1)
++		md = checkfield(md,'fieldname','timestepping.final_time','numel',[1],'NaN',1)
++		md = checkfield(md,'fieldname','timestepping.time_step','numel',[1],'>=',0,'NaN',1)
++		md = checkfield(md,'fieldname','timestepping.time_adapt','numel',[1],'values',[0,1])
++		md = checkfield(md,'fieldname','timestepping.cfl_coefficient','numel',[1],'>',0,'<=',1)
+ 		if self.final_time-self.start_time<0:
+ 			md.checkmessage("timestepping.final_time should be larger than timestepping.start_time")
+ 
+Index: ../trunk-jpl/src/m/classes/constants.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/constants.py	(revision 16763)
++++ ../trunk-jpl/src/m/classes/constants.py	(revision 16764)
+@@ -44,9 +44,9 @@
+ 	#}}}
+ 	def checkconsistency(self,md,solution,analyses):    # {{{
+ 
+-		md = checkfield(md,'constants.g','>',0,'size',[1])
+-		md = checkfield(md,'constants.yts','>',0,'size',[1])
+-		md = checkfield(md,'constants.referencetemperature','size',[1])
++		md = checkfield(md,'fieldname','constants.g','>',0,'size',[1])
++		md = checkfield(md,'fieldname','constants.yts','>',0,'size',[1])
++		md = checkfield(md,'fieldname','constants.referencetemperature','size',[1])
+ 
+ 		return md
+ 	# }}}
+Index: ../trunk-jpl/src/m/classes/friction.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/friction.py	(revision 16763)
++++ ../trunk-jpl/src/m/classes/friction.py	(revision 16764)
+@@ -37,9 +37,9 @@
+ 		if StressbalanceAnalysisEnum() not in analyses and ThermalAnalysisEnum() not in analyses:
+ 			return md
+ 
+-		md = checkfield(md,'friction.coefficient','NaN',1,'size',[md.mesh.numberofvertices])
+-		md = checkfield(md,'friction.q','NaN',1,'size',[md.mesh.numberofelements])
+-		md = checkfield(md,'friction.p','NaN',1,'size',[md.mesh.numberofelements])
++		md = checkfield(md,'fieldname','friction.coefficient','NaN',1,'size',[md.mesh.numberofvertices])
++		md = checkfield(md,'fieldname','friction.q','NaN',1,'size',[md.mesh.numberofelements])
++		md = checkfield(md,'fieldname','friction.p','NaN',1,'size',[md.mesh.numberofelements])
+ 
+ 		return md
+ 	# }}}
+Index: ../trunk-jpl/src/m/classes/mesh2dvertical.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh2dvertical.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/mesh2dvertical.m	(revision 16764)
+@@ -57,18 +57,18 @@
+ 		end % }}}
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+ 
+-			md = checkfield(md,'mesh.x','NaN',1,'size',[md.mesh.numberofvertices 1]);
+-			md = checkfield(md,'mesh.y','NaN',1,'size',[md.mesh.numberofvertices 1]);
+-			md = checkfield(md,'mesh.elements','NaN',1,'>',0,'values',1:md.mesh.numberofvertices);
+-			md = checkfield(md,'mesh.elements','size',[md.mesh.numberofelements 3]);
++			md = checkfield(md,'fieldname','mesh.x','NaN',1,'size',[md.mesh.numberofvertices 1]);
++			md = checkfield(md,'fieldname','mesh.y','NaN',1,'size',[md.mesh.numberofvertices 1]);
++			md = checkfield(md,'fieldname','mesh.elements','NaN',1,'>',0,'values',1:md.mesh.numberofvertices);
++			md = checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements 3]);
+ 			if any(~ismember(1:md.mesh.numberofvertices,sort(unique(md.mesh.elements(:)))));
+ 				md = checkmessage(md,'orphan nodes have been found. Check the mesh outline');
+ 			end
+-			md = checkfield(md,'mesh.numberofelements','>',0);
+-			md = checkfield(md,'mesh.numberofvertices','>',0);
+-			md = checkfield(md,'mesh.vertexonbed','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+-			md = checkfield(md,'mesh.vertexonsurface','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+-			md = checkfield(md,'mesh.average_vertex_connectivity','>=',9,'message','''mesh.average_vertex_connectivity'' should be at least 9 in 2d');
++			md = checkfield(md,'fieldname','mesh.numberofelements','>',0);
++			md = checkfield(md,'fieldname','mesh.numberofvertices','>',0);
++			md = checkfield(md,'fieldname','mesh.vertexonbed','size',[md.mesh.numberofvertices 1],'values',[0 1]);
++			md = checkfield(md,'fieldname','mesh.vertexonsurface','size',[md.mesh.numberofvertices 1],'values',[0 1]);
++			md = checkfield(md,'fieldname','mesh.average_vertex_connectivity','>=',9,'message','''mesh.average_vertex_connectivity'' should be at least 9 in 2d');
+ 
+ 			switch(solution),
+ 				case ThermalSolutionEnum(),
+Index: ../trunk-jpl/src/m/classes/friction.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/friction.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/friction.m	(revision 16764)
+@@ -26,9 +26,9 @@
+ 			%Early return
+ 			if ~ismember(StressbalanceAnalysisEnum(),analyses) & ~ismember(ThermalAnalysisEnum(),analyses), return; end
+ 
+-			md = checkfield(md,'friction.coefficient','NaN',1,'size',[md.mesh.numberofvertices 1]);
+-			md = checkfield(md,'friction.q','NaN',1,'size',[md.mesh.numberofelements 1]);
+-			md = checkfield(md,'friction.p','NaN',1,'size',[md.mesh.numberofelements 1]);
++			md = checkfield(md,'fieldname','friction.coefficient','NaN',1,'size',[md.mesh.numberofvertices 1]);
++			md = checkfield(md,'fieldname','friction.q','NaN',1,'size',[md.mesh.numberofelements 1]);
++			md = checkfield(md,'fieldname','friction.p','NaN',1,'size',[md.mesh.numberofelements 1]);
+ 		end % }}}
+ 		function disp(obj) % {{{
+ 			disp(sprintf('Sigma= drag^2 * Neff ^r * u ^s, with Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p'));
+Index: ../trunk-jpl/src/m/classes/initialization.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/initialization.py	(revision 16763)
++++ ../trunk-jpl/src/m/classes/initialization.py	(revision 16764)
+@@ -49,29 +49,29 @@
+ 	def checkconsistency(self,md,solution,analyses):    # {{{
+ 		if StressbalanceAnalysisEnum() in analyses:
+ 			if not numpy.any(numpy.logical_or(numpy.isnan(md.initialization.vx),numpy.isnan(md.initialization.vy))):
+-				md = checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices])
+-				md = checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices])
++				md = checkfield(md,'fieldname','initialization.vx','NaN',1,'size',[md.mesh.numberofvertices])
++				md = checkfield(md,'fieldname','initialization.vy','NaN',1,'size',[md.mesh.numberofvertices])
+ 		if MasstransportAnalysisEnum() in analyses:
+-			md = checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices])
+-			md = checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices])
++			md = checkfield(md,'fieldname','initialization.vx','NaN',1,'size',[md.mesh.numberofvertices])
++			md = checkfield(md,'fieldname','initialization.vy','NaN',1,'size',[md.mesh.numberofvertices])
+ 		if BalancethicknessAnalysisEnum() in analyses:
+-			md = checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices])
+-			md = checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices])
++			md = checkfield(md,'fieldname','initialization.vx','NaN',1,'size',[md.mesh.numberofvertices])
++			md = checkfield(md,'fieldname','initialization.vy','NaN',1,'size',[md.mesh.numberofvertices])
+ 			#Triangle with zero velocity
+ 			if numpy.any(numpy.logical_and(numpy.sum(numpy.abs(md.initialization.vx[md.mesh.elements-1]),axis=1)==0,\
+ 			                               numpy.sum(numpy.abs(md.initialization.vy[md.mesh.elements-1]),axis=1)==0)):
+ 				md.checkmessage("at least one triangle has all its vertices with a zero velocity")
+ 		if ThermalAnalysisEnum() in analyses:
+-			md = checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices])
+-			md = checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices])
++			md = checkfield(md,'fieldname','initialization.vx','NaN',1,'size',[md.mesh.numberofvertices])
++			md = checkfield(md,'fieldname','initialization.vy','NaN',1,'size',[md.mesh.numberofvertices])
+ 			if strcmp(md.mesh.meshtype(),'3D'):
+-				md = checkfield(md,'initialization.vz','NaN',1,'size',[md.mesh.numberofvertices])
+-			md = checkfield(md,'initialization.pressure','NaN',1,'size',[md.mesh.numberofvertices])
++				md = checkfield(md,'fieldname','initialization.vz','NaN',1,'size',[md.mesh.numberofvertices])
++			md = checkfield(md,'fieldname','initialization.pressure','NaN',1,'size',[md.mesh.numberofvertices])
+ 		if (EnthalpyAnalysisEnum() in analyses and md.thermal.isenthalpy):
+-			md = checkfield(md,'initialization.waterfraction','>=',0,'size',[md.mesh.numberofvertices])
+-			md = checkfield(md,'initialization.watercolumn'  ,'>=',0,'size',[md.mesh.numberofvertices])
++			md = checkfield(md,'fieldname','initialization.waterfraction','>=',0,'size',[md.mesh.numberofvertices])
++			md = checkfield(md,'fieldname','initialization.watercolumn'  ,'>=',0,'size',[md.mesh.numberofvertices])
+ 		if HydrologyShreveAnalysisEnum() in analyses:
+-			md = checkfield(md,'initialization.watercolumn','NaN',1,'size',[md.mesh.numberofvertices])
++			md = checkfield(md,'fieldname','initialization.watercolumn','NaN',1,'size',[md.mesh.numberofvertices])
+ 		return md
+ 	# }}}
+ 	def marshall(self,md,fid):    # {{{
+Index: ../trunk-jpl/src/m/classes/mask.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/mask.py	(revision 16763)
++++ ../trunk-jpl/src/m/classes/mask.py	(revision 16764)
+@@ -31,7 +31,7 @@
+ 	#}}}
+ 	def checkconsistency(self,md,solution,analyses):    # {{{
+ 
+-		md = checkfield(md,'mask.ice_levelset'        ,'size',[md.mesh.numberofvertices])
++		md = checkfield(md,'fieldname','mask.ice_levelset'        ,'size',[md.mesh.numberofvertices])
+ 		isice=numpy.array(md.mask.ice_levelset>0,int)
+ 		totallyicefree=(numpy.sum(isice[md.mesh.elements-1],axis=1)==0).astype(int)
+ 		if any(totallyicefree):
+Index: ../trunk-jpl/src/m/classes/steadystate.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/steadystate.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/steadystate.m	(revision 16764)
+@@ -41,7 +41,7 @@
+ 			if md.timestepping.time_step~=0,
+ 				md = checkmessage(md,['for a steadystate computation, timestepping.time_step must be zero.']);
+ 			end
+-			md = checkfield(md,'steadystate.requested_outputs','stringrow',1);
++			md = checkfield(md,'fieldname','steadystate.requested_outputs','stringrow',1);
+ 
+ 			if isnan(md.stressbalance.reltol),
+ 				md = checkmessage(md,['for a steadystate computation, stressbalance.reltol (relative convergence criterion) must be defined!']);
+Index: ../trunk-jpl/src/m/classes/mesh.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/mesh.m	(revision 16764)
+@@ -78,53 +78,53 @@
+ 		end % }}}
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+ 
+-			md = checkfield(md,'mesh.x','NaN',1,'size',[md.mesh.numberofvertices 1]);
+-			md = checkfield(md,'mesh.y','NaN',1,'size',[md.mesh.numberofvertices 1]);
+-			md = checkfield(md,'mesh.z','NaN',1,'size',[md.mesh.numberofvertices 1]);
+-			md = checkfield(md,'mesh.elements','NaN',1,'>',0,'values',1:md.mesh.numberofvertices);
++			md = checkfield(md,'fieldname','mesh.x','NaN',1,'size',[md.mesh.numberofvertices 1]);
++			md = checkfield(md,'fieldname','mesh.y','NaN',1,'size',[md.mesh.numberofvertices 1]);
++			md = checkfield(md,'fieldname','mesh.z','NaN',1,'size',[md.mesh.numberofvertices 1]);
++			md = checkfield(md,'fieldname','mesh.elements','NaN',1,'>',0,'values',1:md.mesh.numberofvertices);
+ 			if(md.mesh.dimension==2),
+-				md = checkfield(md,'mesh.elements','size',[md.mesh.numberofelements 3]);
++				md = checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements 3]);
+ 			else
+-				md = checkfield(md,'mesh.elements','size',[md.mesh.numberofelements 6]);
++				md = checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements 6]);
+ 			end
+ 			if any(~ismember(1:md.mesh.numberofvertices,sort(unique(md.mesh.elements(:)))));
+ 				md = checkmessage(md,'orphan nodes have been found. Check the mesh outline');
+ 			end
+-			md = checkfield(md,'mesh.dimension','values',[2 3]);
+-			md = checkfield(md,'mesh.numberoflayers','>=',0);
+-			md = checkfield(md,'mesh.numberofelements','>',0);
+-			md = checkfield(md,'mesh.numberofvertices','>',0);
++			md = checkfield(md,'fieldname','mesh.dimension','values',[2 3]);
++			md = checkfield(md,'fieldname','mesh.numberoflayers','>=',0);
++			md = checkfield(md,'fieldname','mesh.numberofelements','>',0);
++			md = checkfield(md,'fieldname','mesh.numberofvertices','>',0);
+ 			%no checks for numberofedges lat long and hemisphere
+-			md = checkfield(md,'mesh.elementonbed','size',[md.mesh.numberofelements 1],'values',[0 1]);
+-			md = checkfield(md,'mesh.elementonsurface','size',[md.mesh.numberofelements 1],'values',[0 1]);
+-			md = checkfield(md,'mesh.vertexonbed','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+-			md = checkfield(md,'mesh.vertexonsurface','size',[md.mesh.numberofvertices 1],'values',[0 1]);
++			md = checkfield(md,'fieldname','mesh.elementonbed','size',[md.mesh.numberofelements 1],'values',[0 1]);
++			md = checkfield(md,'fieldname','mesh.elementonsurface','size',[md.mesh.numberofelements 1],'values',[0 1]);
++			md = checkfield(md,'fieldname','mesh.vertexonbed','size',[md.mesh.numberofvertices 1],'values',[0 1]);
++			md = checkfield(md,'fieldname','mesh.vertexonsurface','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+ 			if (md.mesh.dimension==3),
+-				md = checkfield(md,'mesh.z','>=',md.geometry.bed-10^-10,'message','''mesh.z'' lower than bedrock');
+-				md = checkfield(md,'mesh.z','<=',md.geometry.surface+10^-10,'message','''mesh.z'' higher than surface elevation');
++				md = checkfield(md,'fieldname','mesh.z','>=',md.geometry.bed-10^-10,'message','''mesh.z'' lower than bedrock');
++				md = checkfield(md,'fieldname','mesh.z','<=',md.geometry.surface+10^-10,'message','''mesh.z'' higher than surface elevation');
+ 			end
+ 			if (md.mesh.dimension==2),
+-				md = checkfield(md,'mesh.average_vertex_connectivity','>=',9,'message','''mesh.average_vertex_connectivity'' should be at least 9 in 2d');
++				md = checkfield(md,'fieldname','mesh.average_vertex_connectivity','>=',9,'message','''mesh.average_vertex_connectivity'' should be at least 9 in 2d');
+ 			else
+-				md = checkfield(md,'mesh.average_vertex_connectivity','>=',24,'message','''mesh.average_vertex_connectivity'' should be at least 24 in 3d');
++				md = checkfield(md,'fieldname','mesh.average_vertex_connectivity','>=',24,'message','''mesh.average_vertex_connectivity'' should be at least 24 in 3d');
+ 			end
+ 
+ 			%Solution specific checks
+ 			switch(solution),
+ 				case MasstransportSolutionEnum(),
+ 					if md.masstransport.stabilization==3,
+-						md = checkfield(md,'mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes');
++						md = checkfield(md,'fieldname','mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes');
+ 					end
+ 				case BalancethicknessSolutionEnum(),
+ 					if md.balancethickness.stabilization==3,
+-						md = checkfield(md,'mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes');
++						md = checkfield(md,'fieldname','mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes');
+ 					end
+ 				case TransientSolutionEnum(),
+ 					if md.transient.ismasstransport & md.masstransport.stabilization==3,
+-						md = checkfield(md,'mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes');
++						md = checkfield(md,'fieldname','mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes');
+ 					end
+ 				case ThermalSolutionEnum(),
+-					md = checkfield(md,'mesh.dimension','values',3,'message','thermal solution only supported on 3d meshes');
++					md = checkfield(md,'fieldname','mesh.dimension','values',3,'message','thermal solution only supported on 3d meshes');
+ 			end
+ 		end % }}}
+ 		function disp(obj) % {{{
+Index: ../trunk-jpl/src/m/classes/autodiff.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/autodiff.py	(revision 16763)
++++ ../trunk-jpl/src/m/classes/autodiff.py	(revision 16764)
+@@ -61,15 +61,15 @@
+ 		if not self.isautodiff:
+ 			return md 
+ 		
+-		md = checkfield(md,'autodiff.obufsize','>=',524288)
+-		md = checkfield(md,'autodiff.lbufsize','>=',524288)
+-		md = checkfield(md,'autodiff.cbufsize','>=',524288)
+-		md = checkfield(md,'autodiff.tbufsize','>=',524288)
+-		md = checkfield(md,'autodiff.gcTriggerRatio','>=',2.0)
+-		md = checkfield(md,'autodiff.gcTriggerMaxSize','>=',2000000)
++		md = checkfield(md,'fieldname','autodiff.obufsize','>=',524288)
++		md = checkfield(md,'fieldname','autodiff.lbufsize','>=',524288)
++		md = checkfield(md,'fieldname','autodiff.cbufsize','>=',524288)
++		md = checkfield(md,'fieldname','autodiff.tbufsize','>=',524288)
++		md = checkfield(md,'fieldname','autodiff.gcTriggerRatio','>=',2.0)
++		md = checkfield(md,'fieldname','autodiff.gcTriggerMaxSize','>=',2000000)
+ 
+ 		#Driver value:
+-		md = checkfield(md,'autodiff.driver','values',['fos_forward','fov_forward','fov_forward_all','fos_reverse','fov_reverse','fov_reverse_all'])
++		md = checkfield(md,'fieldname','autodiff.driver','values',['fos_forward','fov_forward','fov_forward_all','fos_reverse','fov_reverse','fov_reverse_all'])
+ 
+ 		#go through our dependents and independents and check consistency: 
+ 		for dep in self.dependents:
+Index: ../trunk-jpl/src/m/classes/autodiff.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/autodiff.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/autodiff.m	(revision 16764)
+@@ -41,15 +41,15 @@
+ 			if ~obj.isautodiff, return; end
+ 
+ 			%Driver value:
+-			md = checkfield(md,'autodiff.driver','values',{'fos_forward','fov_forward','fov_forward_all','fos_reverse','fov_reverse','fov_reverse_all'});
++			md = checkfield(md,'fieldname','autodiff.driver','values',{'fos_forward','fov_forward','fov_forward_all','fos_reverse','fov_reverse','fov_reverse_all'});
+ 			
+ 			%buffer values: 
+-			md = checkfield(md,'autodiff.obufsize','>=',16);
+-			md = checkfield(md,'autodiff.lbufsize','>=',16);
+-			md = checkfield(md,'autodiff.cbufsize','>=',16);
+-			md = checkfield(md,'autodiff.tbufsize','>=',16);
+-			md = checkfield(md,'autodiff.gcTriggerRatio','>=',0);
+-			md = checkfield(md,'autodiff.gcTriggerMaxSize','>=',65536);
++			md = checkfield(md,'fieldname','autodiff.obufsize','>=',16);
++			md = checkfield(md,'fieldname','autodiff.lbufsize','>=',16);
++			md = checkfield(md,'fieldname','autodiff.cbufsize','>=',16);
++			md = checkfield(md,'fieldname','autodiff.tbufsize','>=',16);
++			md = checkfield(md,'fieldname','autodiff.gcTriggerRatio','>=',0);
++			md = checkfield(md,'fieldname','autodiff.gcTriggerMaxSize','>=',65536);
+ 
+ 			%go through our dependents and independents and check consistency: 
+ 			for i=1:numel(obj.dependents),
+Index: ../trunk-jpl/src/m/classes/matice.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/matice.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/matice.m	(revision 16764)
+@@ -97,19 +97,19 @@
+ 
+ 		end % }}}
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+-			md = checkfield(md,'materials.rho_ice','>',0);
+-			md = checkfield(md,'materials.rho_water','>',0);
+-			md = checkfield(md,'materials.rho_freshwater','>',0);
+-			md = checkfield(md,'materials.mu_water','>',0);
+-			md = checkfield(md,'materials.rheology_B','>',0,'size',[md.mesh.numberofvertices 1]);
+-			md = checkfield(md,'materials.rheology_n','>',0,'size',[md.mesh.numberofelements 1]);
+-			md = checkfield(md,'materials.rheology_law','values',{'None' 'Paterson' 'Arrhenius' 'LliboutryDuval'});
++			md = checkfield(md,'fieldname','materials.rho_ice','>',0);
++			md = checkfield(md,'fieldname','materials.rho_water','>',0);
++			md = checkfield(md,'fieldname','materials.rho_freshwater','>',0);
++			md = checkfield(md,'fieldname','materials.mu_water','>',0);
++			md = checkfield(md,'fieldname','materials.rheology_B','>',0,'size',[md.mesh.numberofvertices 1]);
++			md = checkfield(md,'fieldname','materials.rheology_n','>',0,'size',[md.mesh.numberofelements 1]);
++			md = checkfield(md,'fieldname','materials.rheology_law','values',{'None' 'Paterson' 'Arrhenius' 'LliboutryDuval'});
+ 
+ 			if ismember(GiaAnalysisEnum(),analyses),
+-				md = checkfield(md,'materials.lithosphere_shear_modulus','>',0,'numel',1);
+-				md = checkfield(md,'materials.lithosphere_density','>',0,'numel',1);
+-				md = checkfield(md,'materials.mantle_shear_modulus','>',0,'numel',1);
+-				md = checkfield(md,'materials.mantle_density','>',0,'numel',1);
++				md = checkfield(md,'fieldname','materials.lithosphere_shear_modulus','>',0,'numel',1);
++				md = checkfield(md,'fieldname','materials.lithosphere_density','>',0,'numel',1);
++				md = checkfield(md,'fieldname','materials.mantle_shear_modulus','>',0,'numel',1);
++				md = checkfield(md,'fieldname','materials.mantle_density','>',0,'numel',1);
+ 			end
+ 
+ 		end % }}}
+Index: ../trunk-jpl/src/m/classes/outputdefinition.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/outputdefinition.py	(revision 16763)
++++ ../trunk-jpl/src/m/classes/outputdefinition.py	(revision 16764)
+@@ -28,7 +28,7 @@
+ 		#}}}
+ 	def checkconsistency(self,md,solution,analyses):    # {{{
+ 		
+-		md = checkfield(md,'outputdefinition.definitions','cell',1)
++		md = checkfield(md,'fieldname','outputdefinition.definitions','cell',1)
+ 		for definition in self.definitions:
+ 			definition.checkconsistency(md,solution,analyses);
+ 
+Index: ../trunk-jpl/src/m/classes/transient.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/transient.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/transient.m	(revision 16764)
+@@ -45,13 +45,13 @@
+ 			%Early return
+ 			if solution~=TransientSolutionEnum(), return; end
+ 
+-			md = checkfield(md,'transient.ismasstransport','numel',[1],'values',[0 1]);
+-			md = checkfield(md,'transient.isstressbalance','numel',[1],'values',[0 1]);
+-			md = checkfield(md,'transient.isthermal','numel',[1],'values',[0 1]);
+-			md = checkfield(md,'transient.isgroundingline','numel',[1],'values',[0 1]);
+-			md = checkfield(md,'transient.isgia','numel',[1],'values',[0 1]);
+-			md = checkfield(md,'transient.isdamage','numel',[1],'values',[0 1]);
+-			md = checkfield(md,'transient.requested_outputs','stringrow',1);
++			md = checkfield(md,'fieldname','transient.ismasstransport','numel',[1],'values',[0 1]);
++			md = checkfield(md,'fieldname','transient.isstressbalance','numel',[1],'values',[0 1]);
++			md = checkfield(md,'fieldname','transient.isthermal','numel',[1],'values',[0 1]);
++			md = checkfield(md,'fieldname','transient.isgroundingline','numel',[1],'values',[0 1]);
++			md = checkfield(md,'fieldname','transient.isgia','numel',[1],'values',[0 1]);
++			md = checkfield(md,'fieldname','transient.isdamage','numel',[1],'values',[0 1]);
++			md = checkfield(md,'fieldname','transient.requested_outputs','stringrow',1);
+ 
+ 		end % }}}
+ 		function disp(obj) % {{{
+Index: ../trunk-jpl/src/m/classes/timestepping.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/timestepping.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/timestepping.m	(revision 16764)
+@@ -34,11 +34,11 @@
+ 		end % }}}
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+ 
+-			md = checkfield(md,'timestepping.start_time','numel',[1],'NaN',1);
+-			md = checkfield(md,'timestepping.final_time','numel',[1],'NaN',1);
+-			md = checkfield(md,'timestepping.time_step','numel',[1],'>=',0,'NaN',1);
+-			md = checkfield(md,'timestepping.time_adapt','numel',[1],'values',[0 1]);
+-			md = checkfield(md,'timestepping.cfl_coefficient','numel',[1],'>',0,'<=',1);
++			md = checkfield(md,'fieldname','timestepping.start_time','numel',[1],'NaN',1);
++			md = checkfield(md,'fieldname','timestepping.final_time','numel',[1],'NaN',1);
++			md = checkfield(md,'fieldname','timestepping.time_step','numel',[1],'>=',0,'NaN',1);
++			md = checkfield(md,'fieldname','timestepping.time_adapt','numel',[1],'values',[0 1]);
++			md = checkfield(md,'fieldname','timestepping.cfl_coefficient','numel',[1],'>',0,'<=',1);
+ 			if obj.final_time-obj.start_time<0,
+ 				md = checkmessage(md,'timestepping.final_time should be larger than timestepping.start_time');
+ 			end 
+Index: ../trunk-jpl/src/m/classes/outputdefinition.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/outputdefinition.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/outputdefinition.m	(revision 16764)
+@@ -23,7 +23,7 @@
+ 		end % }}}
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+ 
+-			md = checkfield(md,'outputdefinition.definitions','cell',1);
++			md = checkfield(md,'fieldname','outputdefinition.definitions','cell',1);
+ 
+ 			for i=1:length(obj.definitions),
+ 				md=checkconsistency(obj.definitions{i},md,solution,analyses);
+Index: ../trunk-jpl/src/m/classes/masstransport.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/masstransport.py	(revision 16763)
++++ ../trunk-jpl/src/m/classes/masstransport.py	(revision 16764)
+@@ -66,12 +66,12 @@
+ 		if (MasstransportAnalysisEnum() not in analyses) or (solution==TransientSolutionEnum() and not md.transient.ismasstransport):
+ 			return md
+ 
+-		md = checkfield(md,'masstransport.spcthickness','forcing',1)
+-		md = checkfield(md,'masstransport.isfreesurface','values',[0,1])
+-		md = checkfield(md,'masstransport.hydrostatic_adjustment','values',['Absolute','Incremental'])
+-		md = checkfield(md,'masstransport.stabilization','values',[0,1,2,3])
+-		md = checkfield(md,'masstransport.min_thickness','>',0)
+-		md = checkfield(md,'masstransport.requested_outputs','stringrow',1)
++		md = checkfield(md,'fieldname','masstransport.spcthickness','forcing',1)
++		md = checkfield(md,'fieldname','masstransport.isfreesurface','values',[0,1])
++		md = checkfield(md,'fieldname','masstransport.hydrostatic_adjustment','values',['Absolute','Incremental'])
++		md = checkfield(md,'fieldname','masstransport.stabilization','values',[0,1,2,3])
++		md = checkfield(md,'fieldname','masstransport.min_thickness','>',0)
++		md = checkfield(md,'fieldname','masstransport.requested_outputs','stringrow',1)
+ 
+ 		return md
+ 	# }}}
+Index: ../trunk-jpl/src/m/classes/constants.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/constants.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/constants.m	(revision 16764)
+@@ -32,9 +32,9 @@
+ 		end % }}}
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+ 
+-%			md = checkfield(md,'constants.g','>',0,'size',[1 1]);
+-			md = checkfield(md,'constants.yts','>',0,'size',[1 1]);
+-			md = checkfield(md,'constants.referencetemperature','size',[1 1]);
++%			md = checkfield(md,'fieldname','constants.g','>',0,'size',[1 1]);
++			md = checkfield(md,'fieldname','constants.yts','>',0,'size',[1 1]);
++			md = checkfield(md,'fieldname','constants.referencetemperature','size',[1 1]);
+ 
+ 		end % }}}
+ 		function disp(obj) % {{{
+Index: ../trunk-jpl/src/m/classes/mesh2d.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh2d.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/mesh2d.m	(revision 16764)
+@@ -48,16 +48,16 @@
+ 		end % }}}
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+ 
+-			md = checkfield(md,'mesh.x','NaN',1,'size',[md.mesh.numberofvertices 1]);
+-			md = checkfield(md,'mesh.y','NaN',1,'size',[md.mesh.numberofvertices 1]);
+-			md = checkfield(md,'mesh.elements','NaN',1,'>',0,'values',1:md.mesh.numberofvertices);
+-			md = checkfield(md,'mesh.elements','size',[md.mesh.numberofelements 3]);
++			md = checkfield(md,'fieldname','mesh.x','NaN',1,'size',[md.mesh.numberofvertices 1]);
++			md = checkfield(md,'fieldname','mesh.y','NaN',1,'size',[md.mesh.numberofvertices 1]);
++			md = checkfield(md,'fieldname','mesh.elements','NaN',1,'>',0,'values',1:md.mesh.numberofvertices);
++			md = checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements 3]);
+ 			if any(~ismember(1:md.mesh.numberofvertices,sort(unique(md.mesh.elements(:)))));
+ 				md = checkmessage(md,'orphan nodes have been found. Check the mesh outline');
+ 			end
+-			md = checkfield(md,'mesh.numberofelements','>',0);
+-			md = checkfield(md,'mesh.numberofvertices','>',0);
+-			md = checkfield(md,'mesh.average_vertex_connectivity','>=',9,'message','''mesh.average_vertex_connectivity'' should be at least 9 in 2d');
++			md = checkfield(md,'fieldname','mesh.numberofelements','>',0);
++			md = checkfield(md,'fieldname','mesh.numberofvertices','>',0);
++			md = checkfield(md,'fieldname','mesh.average_vertex_connectivity','>=',9,'message','''mesh.average_vertex_connectivity'' should be at least 9 in 2d');
+ 
+ 			switch(solution),
+ 				case ThermalSolutionEnum(),
+Index: ../trunk-jpl/src/m/classes/surfaceforcings.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/surfaceforcings.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/surfaceforcings.m	(revision 16764)
+@@ -44,32 +44,32 @@
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+ 
+ 			if ismember(MasstransportAnalysisEnum(),analyses),
+-				md = checkfield(md,'surfaceforcings.ispdd','numel',[1],'values',[0 1]);
+-				md = checkfield(md,'surfaceforcings.issmbgradients','numel',[1],'values',[0 1]);
++				md = checkfield(md,'fieldname','surfaceforcings.ispdd','numel',[1],'values',[0 1]);
++				md = checkfield(md,'fieldname','surfaceforcings.issmbgradients','numel',[1],'values',[0 1]);
+ 				if(obj.ispdd)
+-				  md = checkfield(md,'surfaceforcings.desfac','<=',1,'numel',1);
+-				  md = checkfield(md,'surfaceforcings.s0p','>=',0,'numel',1);
++				  md = checkfield(md,'fieldname','surfaceforcings.desfac','<=',1,'numel',1);
++				  md = checkfield(md,'fieldname','surfaceforcings.s0p','>=',0,'numel',1);
+ 					if(obj.isdelta18o==0)
+-						md = checkfield(md,'surfaceforcings.monthlytemperatures','forcing',1,'NaN',1);
+-						md = checkfield(md,'surfaceforcings.precipitation','forcing',1,'NaN',1);
++						md = checkfield(md,'fieldname','surfaceforcings.monthlytemperatures','forcing',1,'NaN',1);
++						md = checkfield(md,'fieldname','surfaceforcings.precipitation','forcing',1,'NaN',1);
+ 					else
+-						md = checkfield(md,'surfaceforcings.delta18o','NaN',1);
+-						md = checkfield(md,'surfaceforcings.delta18o_surface','NaN',1);
+-						md = checkfield(md,'surfaceforcings.temperatures_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1);
+-						md = checkfield(md,'surfaceforcings.temperatures_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1);
+-						md = checkfield(md,'surfaceforcings.precipitations_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1);
++						md = checkfield(md,'fieldname','surfaceforcings.delta18o','NaN',1);
++						md = checkfield(md,'fieldname','surfaceforcings.delta18o_surface','NaN',1);
++						md = checkfield(md,'fieldname','surfaceforcings.temperatures_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1);
++						md = checkfield(md,'fieldname','surfaceforcings.temperatures_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1);
++						md = checkfield(md,'fieldname','surfaceforcings.precipitations_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1);
+ 					end
+ 				elseif(obj.issmbgradients)
+-					md = checkfield(md,'surfaceforcings.href','forcing',1,'NaN',1);
+-					md = checkfield(md,'surfaceforcings.smbref','forcing',1,'NaN',1);
+-					md = checkfield(md,'surfaceforcings.b_pos','forcing',1,'NaN',1);
+-					md = checkfield(md,'surfaceforcings.b_neg','forcing',1,'NaN',1);
++					md = checkfield(md,'fieldname','surfaceforcings.href','forcing',1,'NaN',1);
++					md = checkfield(md,'fieldname','surfaceforcings.smbref','forcing',1,'NaN',1);
++					md = checkfield(md,'fieldname','surfaceforcings.b_pos','forcing',1,'NaN',1);
++					md = checkfield(md,'fieldname','surfaceforcings.b_neg','forcing',1,'NaN',1);
+ 				else
+-					md = checkfield(md,'surfaceforcings.mass_balance','forcing',1,'NaN',1);
++					md = checkfield(md,'fieldname','surfaceforcings.mass_balance','forcing',1,'NaN',1);
+ 				end
+ 			end
+ 			if ismember(BalancethicknessAnalysisEnum(),analyses),
+-				md = checkfield(md,'surfaceforcings.mass_balance','size',[md.mesh.numberofvertices 1],'NaN',1);
++				md = checkfield(md,'fieldname','surfaceforcings.mass_balance','size',[md.mesh.numberofvertices 1],'NaN',1);
+ 			end
+ 		end % }}}
+ 		function disp(obj) % {{{
+Index: ../trunk-jpl/src/m/classes/flaim.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/flaim.py	(revision 16763)
++++ ../trunk-jpl/src/m/classes/flaim.py	(revision 16764)
+@@ -62,11 +62,11 @@
+ 		if not solution==FlaimSolutionEnum():
+ 			return md
+ 
+-		md = checkfield(md,'flaim.tracks','file',1)
++		md = checkfield(md,'fieldname','flaim.tracks','file',1)
+ 		if numpy.any(numpy.isnan(md.flaim.criterion)) or not md.flaim.criterion:
+-			md = checkfield(md,'flaim.targets','file',1)
++			md = checkfield(md,'fieldname','flaim.targets','file',1)
+ 		else:
+-			md = checkfield(md,'flaim.criterion','numel',[md.mesh.numberofvertices,md.mesh.numberofelements])
++			md = checkfield(md,'fieldname','flaim.criterion','numel',[md.mesh.numberofvertices,md.mesh.numberofelements])
+ 
+ 		return md
+ 	# }}}
+Index: ../trunk-jpl/src/m/classes/snowpack.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/snowpack.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/snowpack.m	(revision 16764)
+@@ -218,121 +218,121 @@
+ 		end % }}}
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+ 			%snowpack:  %{{{
+-			md=checkfield(md,'snowpack.snowpack_meas_tss','values',[0 1]);
+-			md=checkfield(md,'snowpack.snowpack_enforce_measured_snow_heights','values',[0 1]);
+-			md=checkfield(md,'snowpack.snowpack_sw_mode','values',[0 1 2]);
+-			md=checkfield(md,'snowpack.snowpack_incoming_longwave','values',[0 1]);
+-			md=checkfield(md,'snowpack.snowpack_height_of_wind_value','>=',0);
+-			md=checkfield(md,'snowpack.snowpack_height_of_meteo_values','>=',0);
+-			md=checkfield(md,'snowpack.snowpack_neutral','values',[-1 0 1]);
+-			md=checkfield(md,'snowpack.snowpack_roughness_length','>=',0);
+-			md=checkfield(md,'snowpack.snowpack_number_slopes','values',[1 3 5 9]);
+-			md=checkfield(md,'snowpack.snowpack_snow_redistribution','values',[0 1]);
+-			md=checkfield(md,'snowpack.snowpack_calculation_step_length','>',0);
+-			md=checkfield(md,'snowpack.snowpack_change_bc','values',[0 1]);
+-			md=checkfield(md,'snowpack.snowpack_thresh_change_bc','<=',0);
+-			md=checkfield(md,'snowpack.snowpack_snp_soil','values',[0 1]);
+-			md=checkfield(md,'snowpack.snowpack_soil_flux','values',[0 1]);
+-			md=checkfield(md,'snowpack.snowpack_geo_heat','>=',0);
+-			md=checkfield(md,'snowpack.snowpack_canopy','values',[0 1]);
++			md=checkfield(md,'fieldname','snowpack.snowpack_meas_tss','values',[0 1]);
++			md=checkfield(md,'fieldname','snowpack.snowpack_enforce_measured_snow_heights','values',[0 1]);
++			md=checkfield(md,'fieldname','snowpack.snowpack_sw_mode','values',[0 1 2]);
++			md=checkfield(md,'fieldname','snowpack.snowpack_incoming_longwave','values',[0 1]);
++			md=checkfield(md,'fieldname','snowpack.snowpack_height_of_wind_value','>=',0);
++			md=checkfield(md,'fieldname','snowpack.snowpack_height_of_meteo_values','>=',0);
++			md=checkfield(md,'fieldname','snowpack.snowpack_neutral','values',[-1 0 1]);
++			md=checkfield(md,'fieldname','snowpack.snowpack_roughness_length','>=',0);
++			md=checkfield(md,'fieldname','snowpack.snowpack_number_slopes','values',[1 3 5 9]);
++			md=checkfield(md,'fieldname','snowpack.snowpack_snow_redistribution','values',[0 1]);
++			md=checkfield(md,'fieldname','snowpack.snowpack_calculation_step_length','>',0);
++			md=checkfield(md,'fieldname','snowpack.snowpack_change_bc','values',[0 1]);
++			md=checkfield(md,'fieldname','snowpack.snowpack_thresh_change_bc','<=',0);
++			md=checkfield(md,'fieldname','snowpack.snowpack_snp_soil','values',[0 1]);
++			md=checkfield(md,'fieldname','snowpack.snowpack_soil_flux','values',[0 1]);
++			md=checkfield(md,'fieldname','snowpack.snowpack_geo_heat','>=',0);
++			md=checkfield(md,'fieldname','snowpack.snowpack_canopy','values',[0 1]);
+ 			%}}}
+ 			%snowpackadvanced:  %{{{
+-			md=checkfield(md,'snowpack.snowpackadvanced_variant','values',{'JAPAN','DEFAULT','ANTARCTICA'});
+-			md=checkfield(md,'snowpack.snowpackadvanced_hn_density','values',{'PARAMETERIZED','EVENT','MEASURED'});
++			md=checkfield(md,'fieldname','snowpack.snowpackadvanced_variant','values',{'JAPAN','DEFAULT','ANTARCTICA'});
++			md=checkfield(md,'fieldname','snowpack.snowpackadvanced_hn_density','values',{'PARAMETERIZED','EVENT','MEASURED'});
+ 			%}}}
+ 			%general:  %{{{
+-			md=checkfield(md,'snowpack.general_buff_chunk_size','>',0);
+-			md=checkfield(md,'snowpack.general_buff_before','>',0);
++			md=checkfield(md,'fieldname','snowpack.general_buff_chunk_size','>',0);
++			md=checkfield(md,'fieldname','snowpack.general_buff_before','>',0);
+ 			%}}}
+ 			%input {{{
+-			md=checkfield(md,'snowpack.input_coordsys','values',{'CH1903','UTM','UPS','PROJ4','LOCAL'});
+-			md=checkfield(md,'snowpack.input_coordparam','values','null');
+-			md=checkfield(md,'snowpack.input_time_zone','>',-12,'<',12);
+-			md=checkfield(md,'snowpack.input_meteo','values',{'BORMA','COSMO','GEOTOP','GRIB','GSN','IMIS','SMET','SNOWPACK'});
+-			md=checkfield(md,'snowpack.input_meteopath','empty',1);
+-			md=checkfield(md,'snowpack.input_station1 ','empty',1);
+-			md=checkfield(md,'snowpack.input_snowfile1','empty',1);
++			md=checkfield(md,'fieldname','snowpack.input_coordsys','values',{'CH1903','UTM','UPS','PROJ4','LOCAL'});
++			md=checkfield(md,'fieldname','snowpack.input_coordparam','values','null');
++			md=checkfield(md,'fieldname','snowpack.input_time_zone','>',-12,'<',12);
++			md=checkfield(md,'fieldname','snowpack.input_meteo','values',{'BORMA','COSMO','GEOTOP','GRIB','GSN','IMIS','SMET','SNOWPACK'});
++			md=checkfield(md,'fieldname','snowpack.input_meteopath','empty',1);
++			md=checkfield(md,'fieldname','snowpack.input_station1 ','empty',1);
++			md=checkfield(md,'fieldname','snowpack.input_snowfile1','empty',1);
+ 			%}}}
+ 			%output {{{
+-			md=checkfield(md,'snowpack.output_coordsys','values',{'CH1903','UTM','UPS','PROJ4','LOCAL'});
+-			md=checkfield(md,'snowpack.output_coordparam','values','null');
+-			md=checkfield(md,'snowpack.output_time_zone','>',-12,'<',12);
+-			md=checkfield(md,'snowpack.output_meteopath','empty',1);
+-			md=checkfield(md,'snowpack.output_experiment','empty',1);
+-			md=checkfield(md,'snowpack.output_ts_write','values',[0 1]);
+-			md=checkfield(md,'snowpack.output_ts_start','>=',0);
+-			md=checkfield(md,'snowpack.output_ts_days_between','>=',0);
+-			md=checkfield(md,'snowpack.output_profile','values',{'ASCII','IMIS','ASCII IMIS'});
+-			md=checkfield(md,'snowpack.output_prof_write','values',[0 1]);
+-			md=checkfield(md,'snowpack.output_prof_start','>=',0);
+-			md=checkfield(md,'snowpack.output_prof_days_between','>=',0);
++			md=checkfield(md,'fieldname','snowpack.output_coordsys','values',{'CH1903','UTM','UPS','PROJ4','LOCAL'});
++			md=checkfield(md,'fieldname','snowpack.output_coordparam','values','null');
++			md=checkfield(md,'fieldname','snowpack.output_time_zone','>',-12,'<',12);
++			md=checkfield(md,'fieldname','snowpack.output_meteopath','empty',1);
++			md=checkfield(md,'fieldname','snowpack.output_experiment','empty',1);
++			md=checkfield(md,'fieldname','snowpack.output_ts_write','values',[0 1]);
++			md=checkfield(md,'fieldname','snowpack.output_ts_start','>=',0);
++			md=checkfield(md,'fieldname','snowpack.output_ts_days_between','>=',0);
++			md=checkfield(md,'fieldname','snowpack.output_profile','values',{'ASCII','IMIS','ASCII IMIS'});
++			md=checkfield(md,'fieldname','snowpack.output_prof_write','values',[0 1]);
++			md=checkfield(md,'fieldname','snowpack.output_prof_start','>=',0);
++			md=checkfield(md,'fieldname','snowpack.output_prof_days_between','>=',0);
+ 			%}}}
+ 			%interpolations1d %{{{
+-			md=checkfield(md,'snowpack.interpolations1d_window_size','>',0);
+-			md=checkfield(md,'snowpack.interpolations1d_hnw_resample','values',{'NONE','NEAREST_NEIGHBOUR','ACCUMULATE','LINEAR'});
+-			md=checkfield(md,'snowpack.interpolations1d_hs_resample','values',{'NONE','NEAREST_NEIGHBOUR','ACCUMULATE','LINEAR'});
+-			md=checkfield(md,'snowpack.interpolations1d_tsg_resample','values',{'NONE','NEAREST_NEIGHBOUR','ACCUMULATE','LINEAR'});
+-			md=checkfield(md,'snowpack.interpolations1d_rho_hn_resample','values',{'NONE','NEAREST_NEIGHBOUR','ACCUMULATE','LINEAR'});
+-			md=checkfield(md,'snowpack.interpolations1d_vw_resample','values',{'NONE','NEAREST_NEIGHBOUR','ACCUMULATE','LINEAR'});
+-			md=checkfield(md,'snowpack.interpolations1d_vw_args','values',{'EXTRAPOLATE'});
++			md=checkfield(md,'fieldname','snowpack.interpolations1d_window_size','>',0);
++			md=checkfield(md,'fieldname','snowpack.interpolations1d_hnw_resample','values',{'NONE','NEAREST_NEIGHBOUR','ACCUMULATE','LINEAR'});
++			md=checkfield(md,'fieldname','snowpack.interpolations1d_hs_resample','values',{'NONE','NEAREST_NEIGHBOUR','ACCUMULATE','LINEAR'});
++			md=checkfield(md,'fieldname','snowpack.interpolations1d_tsg_resample','values',{'NONE','NEAREST_NEIGHBOUR','ACCUMULATE','LINEAR'});
++			md=checkfield(md,'fieldname','snowpack.interpolations1d_rho_hn_resample','values',{'NONE','NEAREST_NEIGHBOUR','ACCUMULATE','LINEAR'});
++			md=checkfield(md,'fieldname','snowpack.interpolations1d_vw_resample','values',{'NONE','NEAREST_NEIGHBOUR','ACCUMULATE','LINEAR'});
++			md=checkfield(md,'fieldname','snowpack.interpolations1d_vw_args','values',{'EXTRAPOLATE'});
+ 			%}}}
+ 			%filters {{{
+ 			filter_values={'MIN_MAX','RATE_FILTER1','RATE_FILTER2','UNHEATED_RAIN_GAUGE_FILTER','WMO_UNDERCATCH_FILTER','WMO_UNDERCATCH_FILTER-SIMPLIFIED','UNVENTILLATED_TEMPERATURE_SENSOR','ADD_AN_OFFSET'};
+ 
+-			md=checkfield(md,'snowpack.filters_ta_filter1','values',{filter_values});
+-			if strcmpi(md.snowpack.filters_ta_filter1,'MIN_MAX'), md=checkfield(md,'snowpack.filters_ta_filter1','size',[1 NaN]); end
+-			md=checkfield(md,'snowpack.filters_ta_arg1','values',{filter_values});
+-			if strcmpi(md.snowpack.filters_ta_arg1,'MIN_MAX'), md=checkfield(md,'snowpack.filters_ta_arg1','size',[1 NaN]); end
+-			md=checkfield(md,'snowpack.filters_rh_filter1','values',{filter_values});
+-			if strcmpi(md.snowpack.filters_rh_filter1,'MIN_MAX'), md=checkfield(md,'snowpack.filters_rh_filter1','size',[1 NaN]); end
+-			md=checkfield(md,'snowpack.filters_rh_arg1','values',{filter_values});
+-			if strcmpi(md.snowpack.filters_rh_arg1,'MIN_MAX'), md=checkfield(md,'snowpack.filters_rh_arg1','size',[1 NaN]); end
+-			md=checkfield(md,'snowpack.filters_rh_filter2','values',{filter_values});
+-			if strcmpi(md.snowpack.filters_rh_filter2,'MIN_MAX'), md=checkfield(md,'snowpack.filters_rh_filter2','size',[1 NaN]); end
+-			md=checkfield(md,'snowpack.filters_rh_arg2','values',{filter_values});
+-			if strcmpi(md.snowpack.filters_rh_arg2,'MIN_MAX'), md=checkfield(md,'snowpack.filters_rh_arg2','size',[1 NaN]); end
+-			md=checkfield(md,'snowpack.filters_iswr_filter1','values',{filter_values});
+-			if strcmpi(md.snowpack.filters_iswr_filter1,'MIN_MAX'), md=checkfield(md,'snowpack.filters_iswr_filter1','size',[1 NaN]); end
+-			md=checkfield(md,'snowpack.filters_iswr_arg1','values',{filter_values});
+-			if strcmpi(md.snowpack.filters_iswr_arg1,'MIN_MAX'), md=checkfield(md,'snowpack.filters_iswr_arg1','size',[1 NaN]); end
+-			md=checkfield(md,'snowpack.filters_iswr_filter2','values',{filter_values});
+-			if strcmpi(md.snowpack.filters_iswr_filter2,'MIN_MAX'), md=checkfield(md,'snowpack.filters_iswr_filter2','size',[1 NaN]); end
+-			md=checkfield(md,'snowpack.filters_iswr_arg2','values',{filter_values});
+-			if strcmpi(md.snowpack.filters_iswr_arg2,'MIN_MAX'), md=checkfield(md,'snowpack.filters_iswr_arg2','size',[1 NaN]); end
+-			md=checkfield(md,'snowpack.filters_rswr_filter1','values',{filter_values});
+-			if strcmpi(md.snowpack.filters_rswr_filter1,'MIN_MAX'), md=checkfield(md,'snowpack.filters_rswr_filter1','size',[1 NaN]); end
+-			md=checkfield(md,'snowpack.filters_rswr_arg1','values',{filter_values});
+-			if strcmpi(md.snowpack.filters_rswr_arg1,'MIN_MAX'), md=checkfield(md,'snowpack.filters_rswr_arg1','size',[1 NaN]); end
+-			md=checkfield(md,'snowpack.filters_rswr_filter2','values',{filter_values});
+-			if strcmpi(md.snowpack.filters_rswr_filter2,'MIN_MAX'), md=checkfield(md,'snowpack.filters_rswr_filter2','size',[1 NaN]); end
+-			md=checkfield(md,'snowpack.filters_rswr_arg2','values',{filter_values});
+-			if strcmpi(md.snowpack.filters_rswr_arg2,'MIN_MAX'), md=checkfield(md,'snowpack.filters_rswr_arg2','size',[1 NaN]); end
++			md=checkfield(md,'fieldname','snowpack.filters_ta_filter1','values',{filter_values});
++			if strcmpi(md.snowpack.filters_ta_filter1,'MIN_MAX'), md=checkfield(md,'fieldname','snowpack.filters_ta_filter1','size',[1 NaN]); end
++			md=checkfield(md,'fieldname','snowpack.filters_ta_arg1','values',{filter_values});
++			if strcmpi(md.snowpack.filters_ta_arg1,'MIN_MAX'), md=checkfield(md,'fieldname','snowpack.filters_ta_arg1','size',[1 NaN]); end
++			md=checkfield(md,'fieldname','snowpack.filters_rh_filter1','values',{filter_values});
++			if strcmpi(md.snowpack.filters_rh_filter1,'MIN_MAX'), md=checkfield(md,'fieldname','snowpack.filters_rh_filter1','size',[1 NaN]); end
++			md=checkfield(md,'fieldname','snowpack.filters_rh_arg1','values',{filter_values});
++			if strcmpi(md.snowpack.filters_rh_arg1,'MIN_MAX'), md=checkfield(md,'fieldname','snowpack.filters_rh_arg1','size',[1 NaN]); end
++			md=checkfield(md,'fieldname','snowpack.filters_rh_filter2','values',{filter_values});
++			if strcmpi(md.snowpack.filters_rh_filter2,'MIN_MAX'), md=checkfield(md,'fieldname','snowpack.filters_rh_filter2','size',[1 NaN]); end
++			md=checkfield(md,'fieldname','snowpack.filters_rh_arg2','values',{filter_values});
++			if strcmpi(md.snowpack.filters_rh_arg2,'MIN_MAX'), md=checkfield(md,'fieldname','snowpack.filters_rh_arg2','size',[1 NaN]); end
++			md=checkfield(md,'fieldname','snowpack.filters_iswr_filter1','values',{filter_values});
++			if strcmpi(md.snowpack.filters_iswr_filter1,'MIN_MAX'), md=checkfield(md,'fieldname','snowpack.filters_iswr_filter1','size',[1 NaN]); end
++			md=checkfield(md,'fieldname','snowpack.filters_iswr_arg1','values',{filter_values});
++			if strcmpi(md.snowpack.filters_iswr_arg1,'MIN_MAX'), md=checkfield(md,'fieldname','snowpack.filters_iswr_arg1','size',[1 NaN]); end
++			md=checkfield(md,'fieldname','snowpack.filters_iswr_filter2','values',{filter_values});
++			if strcmpi(md.snowpack.filters_iswr_filter2,'MIN_MAX'), md=checkfield(md,'fieldname','snowpack.filters_iswr_filter2','size',[1 NaN]); end
++			md=checkfield(md,'fieldname','snowpack.filters_iswr_arg2','values',{filter_values});
++			if strcmpi(md.snowpack.filters_iswr_arg2,'MIN_MAX'), md=checkfield(md,'fieldname','snowpack.filters_iswr_arg2','size',[1 NaN]); end
++			md=checkfield(md,'fieldname','snowpack.filters_rswr_filter1','values',{filter_values});
++			if strcmpi(md.snowpack.filters_rswr_filter1,'MIN_MAX'), md=checkfield(md,'fieldname','snowpack.filters_rswr_filter1','size',[1 NaN]); end
++			md=checkfield(md,'fieldname','snowpack.filters_rswr_arg1','values',{filter_values});
++			if strcmpi(md.snowpack.filters_rswr_arg1,'MIN_MAX'), md=checkfield(md,'fieldname','snowpack.filters_rswr_arg1','size',[1 NaN]); end
++			md=checkfield(md,'fieldname','snowpack.filters_rswr_filter2','values',{filter_values});
++			if strcmpi(md.snowpack.filters_rswr_filter2,'MIN_MAX'), md=checkfield(md,'fieldname','snowpack.filters_rswr_filter2','size',[1 NaN]); end
++			md=checkfield(md,'fieldname','snowpack.filters_rswr_arg2','values',{filter_values});
++			if strcmpi(md.snowpack.filters_rswr_arg2,'MIN_MAX'), md=checkfield(md,'fieldname','snowpack.filters_rswr_arg2','size',[1 NaN]); end
+ 
+ 			%for ta between 190 and 280 k;
+-			md=checkfield(md,'snowpack.filters_ilwr_filter1','values',{filter_values});
+-			if strcmpi(md.snowpack.filters_ilwr_filter1,'MIN_MAX'), md=checkfield(md,'snowpack.filters_ilwr_filter1','size',[1 NaN]); end
+-			md=checkfield(md,'snowpack.filters_ilwr_arg1','values',{filter_values});
+-			if strcmpi(md.snowpack.filters_ilwr_arg1,'MIN_MAX'), md=checkfield(md,'snowpack.filters_ilwr_arg1','size',[1 NaN]); end
+-			md=checkfield(md,'snowpack.filters_ilwr_filter2','values',{filter_values});
+-			if strcmpi(md.snowpack.filters_ilwr_filter2,'MIN_MAX'), md=checkfield(md,'snowpack.filters_ilwr_filter2','size',[1 NaN]); end
+-			md=checkfield(md,'snowpack.filters_ilwr_arg2','values',{filter_values});
+-			if strcmpi(md.snowpack.filters_ilwr_arg2,'MIN_MAX'), md=checkfield(md,'snowpack.filters_ilwr_arg2','size',[1 NaN]); end
+-			md=checkfield(md,'snowpack.filters_tss_filter1','values',{filter_values});
+-			if strcmpi(md.snowpack.filters_tss_filter1,'MIN_MAX'), md=checkfield(md,'snowpack.filters_tss_filter1','size',[1 NaN]); end
+-			md=checkfield(md,'snowpack.filters_tss_arg1','values',{filter_values});
+-			if strcmpi(md.snowpack.filters_tss_arg1,'MIN_MAX'), md=checkfield(md,'snowpack.filters_tss_arg1','size',[1 NaN]); end
+-			md=checkfield(md,'snowpack.filters_tsg_filter1','values',{filter_values});
+-			if strcmpi(md.snowpack.filters_tsg_filter1,'MIN_MAX'), md=checkfield(md,'snowpack.filters_tsg_filter1','size',[1 NaN]); end
+-			md=checkfield(md,'snowpack.filters_tsg_arg1','values',{filter_values});
+-			if strcmpi(md.snowpack.filters_tsg_arg1,'MIN_MAX'), md=checkfield(md,'snowpack.filters_tsg_arg1','size',[1 NaN]); end
+-			md=checkfield(md,'snowpack.filters_vw_filter1','values',{filter_values});
+-			if strcmpi(md.snowpack.filters_vw_filter1,'MIN_MAX'), md=checkfield(md,'snowpack.filters_vw_filter1','size',[1 NaN]); end
+-			md=checkfield(md,'snowpack.filters_vw_arg1','values',{filter_values});
+-			if strcmpi(md.snowpack.filters_vw_arg1,'MIN_MAX'), md=checkfield(md,'snowpack.filters_vw_arg1','size',[1 NaN]); end
+-			md=checkfield(md,'snowpack.filters_vw_filter2','values',{filter_values});
+-			if strcmpi(md.snowpack.filters_vw_filter2,'MIN_MAX'), md=checkfield(md,'snowpack.filters_vw_filter2','size',[1 NaN]); end
+-			md=checkfield(md,'snowpack.filters_vw_arg2','values',{filter_values});
+-			if strcmpi(md.snowpack.filters_vw_arg2,'MIN_MAX'), md=checkfield(md,'snowpack.filters_vw_arg2','size',[1 NaN]); end
++			md=checkfield(md,'fieldname','snowpack.filters_ilwr_filter1','values',{filter_values});
++			if strcmpi(md.snowpack.filters_ilwr_filter1,'MIN_MAX'), md=checkfield(md,'fieldname','snowpack.filters_ilwr_filter1','size',[1 NaN]); end
++			md=checkfield(md,'fieldname','snowpack.filters_ilwr_arg1','values',{filter_values});
++			if strcmpi(md.snowpack.filters_ilwr_arg1,'MIN_MAX'), md=checkfield(md,'fieldname','snowpack.filters_ilwr_arg1','size',[1 NaN]); end
++			md=checkfield(md,'fieldname','snowpack.filters_ilwr_filter2','values',{filter_values});
++			if strcmpi(md.snowpack.filters_ilwr_filter2,'MIN_MAX'), md=checkfield(md,'fieldname','snowpack.filters_ilwr_filter2','size',[1 NaN]); end
++			md=checkfield(md,'fieldname','snowpack.filters_ilwr_arg2','values',{filter_values});
++			if strcmpi(md.snowpack.filters_ilwr_arg2,'MIN_MAX'), md=checkfield(md,'fieldname','snowpack.filters_ilwr_arg2','size',[1 NaN]); end
++			md=checkfield(md,'fieldname','snowpack.filters_tss_filter1','values',{filter_values});
++			if strcmpi(md.snowpack.filters_tss_filter1,'MIN_MAX'), md=checkfield(md,'fieldname','snowpack.filters_tss_filter1','size',[1 NaN]); end
++			md=checkfield(md,'fieldname','snowpack.filters_tss_arg1','values',{filter_values});
++			if strcmpi(md.snowpack.filters_tss_arg1,'MIN_MAX'), md=checkfield(md,'fieldname','snowpack.filters_tss_arg1','size',[1 NaN]); end
++			md=checkfield(md,'fieldname','snowpack.filters_tsg_filter1','values',{filter_values});
++			if strcmpi(md.snowpack.filters_tsg_filter1,'MIN_MAX'), md=checkfield(md,'fieldname','snowpack.filters_tsg_filter1','size',[1 NaN]); end
++			md=checkfield(md,'fieldname','snowpack.filters_tsg_arg1','values',{filter_values});
++			if strcmpi(md.snowpack.filters_tsg_arg1,'MIN_MAX'), md=checkfield(md,'fieldname','snowpack.filters_tsg_arg1','size',[1 NaN]); end
++			md=checkfield(md,'fieldname','snowpack.filters_vw_filter1','values',{filter_values});
++			if strcmpi(md.snowpack.filters_vw_filter1,'MIN_MAX'), md=checkfield(md,'fieldname','snowpack.filters_vw_filter1','size',[1 NaN]); end
++			md=checkfield(md,'fieldname','snowpack.filters_vw_arg1','values',{filter_values});
++			if strcmpi(md.snowpack.filters_vw_arg1,'MIN_MAX'), md=checkfield(md,'fieldname','snowpack.filters_vw_arg1','size',[1 NaN]); end
++			md=checkfield(md,'fieldname','snowpack.filters_vw_filter2','values',{filter_values});
++			if strcmpi(md.snowpack.filters_vw_filter2,'MIN_MAX'), md=checkfield(md,'fieldname','snowpack.filters_vw_filter2','size',[1 NaN]); end
++			md=checkfield(md,'fieldname','snowpack.filters_vw_arg2','values',{filter_values});
++			if strcmpi(md.snowpack.filters_vw_arg2,'MIN_MAX'), md=checkfield(md,'fieldname','snowpack.filters_vw_arg2','size',[1 NaN]); end
+ 
+ 			%}}}
+ 		end % }}}
+Index: ../trunk-jpl/src/m/classes/stressbalance.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/stressbalance.py	(revision 16763)
++++ ../trunk-jpl/src/m/classes/stressbalance.py	(revision 16764)
+@@ -126,20 +126,20 @@
+ 		if StressbalanceAnalysisEnum() not in analyses:
+ 			return md
+ 
+-		md = checkfield(md,'stressbalance.spcvx','forcing',1)
+-		md = checkfield(md,'stressbalance.spcvy','forcing',1)
++		md = checkfield(md,'fieldname','stressbalance.spcvx','forcing',1)
++		md = checkfield(md,'fieldname','stressbalance.spcvy','forcing',1)
+ 		if strcmp(md.mesh.meshtype(),'3D'):
+-			md = checkfield(md,'stressbalance.spcvz','forcing',1)
+-		md = checkfield(md,'stressbalance.restol','size',[1],'>',0)
+-		md = checkfield(md,'stressbalance.reltol','size',[1])
+-		md = checkfield(md,'stressbalance.abstol','size',[1])
+-		md = checkfield(md,'stressbalance.isnewton','numel',[1],'values',[0,1,2])
+-		md = checkfield(md,'stressbalance.FSreconditioning','size',[1],'NaN',1)
+-		md = checkfield(md,'stressbalance.viscosity_overshoot','size',[1],'NaN',1)
+-		md = checkfield(md,'stressbalance.maxiter','size',[1],'>=',1)
+-		md = checkfield(md,'stressbalance.referential','size',[md.mesh.numberofvertices,6])
+-		md = checkfield(md,'stressbalance.loadingforce','size',[md.mesh.numberofvertices,3])
+-		md = checkfield(md,'stressbalance.requested_outputs','stringrow',1);
++			md = checkfield(md,'fieldname','stressbalance.spcvz','forcing',1)
++		md = checkfield(md,'fieldname','stressbalance.restol','size',[1],'>',0)
++		md = checkfield(md,'fieldname','stressbalance.reltol','size',[1])
++		md = checkfield(md,'fieldname','stressbalance.abstol','size',[1])
++		md = checkfield(md,'fieldname','stressbalance.isnewton','numel',[1],'values',[0,1,2])
++		md = checkfield(md,'fieldname','stressbalance.FSreconditioning','size',[1],'NaN',1)
++		md = checkfield(md,'fieldname','stressbalance.viscosity_overshoot','size',[1],'NaN',1)
++		md = checkfield(md,'fieldname','stressbalance.maxiter','size',[1],'>=',1)
++		md = checkfield(md,'fieldname','stressbalance.referential','size',[md.mesh.numberofvertices,6])
++		md = checkfield(md,'fieldname','stressbalance.loadingforce','size',[md.mesh.numberofvertices,3])
++		md = checkfield(md,'fieldname','stressbalance.requested_outputs','stringrow',1);
+ 
+ 		#singular solution
+ #		if ~any((~isnan(md.stressbalance.spcvx)+~isnan(md.stressbalance.spcvy))==2),
+Index: ../trunk-jpl/src/m/classes/steadystate.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/steadystate.py	(revision 16763)
++++ ../trunk-jpl/src/m/classes/steadystate.py	(revision 16764)
+@@ -57,7 +57,7 @@
+ 		if numpy.isnan(md.stressbalance.reltol):
+ 			md.checkmessage("for a steadystate computation, stressbalance.reltol (relative convergence criterion) must be defined!")
+ 
+-		md = checkfield(md,'steadystate.requested_outputs','stringrow',1)
++		md = checkfield(md,'fieldname','steadystate.requested_outputs','stringrow',1)
+ 
+ 		return md
+ 	# }}}
+Index: ../trunk-jpl/src/m/classes/geometry.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/geometry.py	(revision 16763)
++++ ../trunk-jpl/src/m/classes/geometry.py	(revision 16764)
+@@ -37,13 +37,13 @@
+ 	#}}}
+ 	def checkconsistency(self,md,solution,analyses):    # {{{
+ 
+-		md = checkfield(md,'geometry.surface'  ,'NaN',1,'size',[md.mesh.numberofvertices])
+-		md = checkfield(md,'geometry.bed'      ,'NaN',1,'size',[md.mesh.numberofvertices])
+-		md = checkfield(md,'geometry.thickness','NaN',1,'size',[md.mesh.numberofvertices],'>',0,'forcing',1)
++		md = checkfield(md,'fieldname','geometry.surface'  ,'NaN',1,'size',[md.mesh.numberofvertices])
++		md = checkfield(md,'fieldname','geometry.bed'      ,'NaN',1,'size',[md.mesh.numberofvertices])
++		md = checkfield(md,'fieldname','geometry.thickness','NaN',1,'size',[md.mesh.numberofvertices],'>',0,'forcing',1)
+ 		if any((self.thickness-self.surface+self.bed)>10**-9):
+ 			md.checkmessage("equality thickness=surface-bed violated")
+ 		if solution==TransientSolutionEnum() and md.transient.isgroundingline:
+-			md = checkfield(md,'geometry.bathymetry','NaN',1,'size',[md.mesh.numberofvertices])
++			md = checkfield(md,'fieldname','geometry.bathymetry','NaN',1,'size',[md.mesh.numberofvertices])
+ 
+ 		return md
+ 	# }}}
+Index: ../trunk-jpl/src/m/classes/hydrologyshreve.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/hydrologyshreve.py	(revision 16763)
++++ ../trunk-jpl/src/m/classes/hydrologyshreve.py	(revision 16764)
+@@ -56,8 +56,8 @@
+ 		if HydrologyShreveAnalysisEnum() not in analyses:
+ 			return md
+ 
+-		md = checkfield(md,'hydrology.spcwatercolumn','forcing',1)
+-		md = checkfield(md,'hydrology.stabilization','>=',0)
++		md = checkfield(md,'fieldname','hydrology.spcwatercolumn','forcing',1)
++		md = checkfield(md,'fieldname','hydrology.stabilization','>=',0)
+ 
+ 		return md
+ 	# }}}
+Index: ../trunk-jpl/src/m/classes/stressbalance.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/stressbalance.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/stressbalance.m	(revision 16764)
+@@ -81,19 +81,19 @@
+ 			%Early return
+ 			if ~ismember(StressbalanceAnalysisEnum(),analyses), return; end
+ 
+-			md = checkfield(md,'stressbalance.spcvx','forcing',1);
+-			md = checkfield(md,'stressbalance.spcvy','forcing',1);
+-			md = checkfield(md,'stressbalance.spcvz','forcing',1);
+-			md = checkfield(md,'stressbalance.restol','size',[1 1],'>',0,'NaN',1);
+-			md = checkfield(md,'stressbalance.reltol','size',[1 1]);
+-			md = checkfield(md,'stressbalance.abstol','size',[1 1]);
+-			md = checkfield(md,'stressbalance.isnewton','numel',[1],'values',[0 1 2]);
+-			md = checkfield(md,'stressbalance.FSreconditioning','size',[1 1],'NaN',1);
+-			md = checkfield(md,'stressbalance.viscosity_overshoot','size',[1 1],'NaN',1);
+-			md = checkfield(md,'stressbalance.maxiter','size',[1 1],'>=',1);
+-			md = checkfield(md,'stressbalance.referential','size',[md.mesh.numberofvertices 6]);
+-			md = checkfield(md,'stressbalance.loadingforce','size',[md.mesh.numberofvertices 3]);
+-			md = checkfield(md,'stressbalance.requested_outputs','stringrow',1);
++			md = checkfield(md,'fieldname','stressbalance.spcvx','forcing',1);
++			md = checkfield(md,'fieldname','stressbalance.spcvy','forcing',1);
++			md = checkfield(md,'fieldname','stressbalance.spcvz','forcing',1);
++			md = checkfield(md,'fieldname','stressbalance.restol','size',[1 1],'>',0,'NaN',1);
++			md = checkfield(md,'fieldname','stressbalance.reltol','size',[1 1]);
++			md = checkfield(md,'fieldname','stressbalance.abstol','size',[1 1]);
++			md = checkfield(md,'fieldname','stressbalance.isnewton','numel',[1],'values',[0 1 2]);
++			md = checkfield(md,'fieldname','stressbalance.FSreconditioning','size',[1 1],'NaN',1);
++			md = checkfield(md,'fieldname','stressbalance.viscosity_overshoot','size',[1 1],'NaN',1);
++			md = checkfield(md,'fieldname','stressbalance.maxiter','size',[1 1],'>=',1);
++			md = checkfield(md,'fieldname','stressbalance.referential','size',[md.mesh.numberofvertices 6]);
++			md = checkfield(md,'fieldname','stressbalance.loadingforce','size',[md.mesh.numberofvertices 3]);
++			md = checkfield(md,'fieldname','stressbalance.requested_outputs','stringrow',1);
+ 
+ 			%singular solution
+ 			if ~(any(~isnan(md.stressbalance.spcvx)) | any(~isnan(md.stressbalance.spcvy))),
+@@ -116,7 +116,7 @@
+ 				if any(~isnan(md.stressbalance.referential(pos,:))),
+ 					md = checkmessage(md,['no referential should be specified for basal vertices of grounded ice']);
+ 				end
+-				md = checkfield(md,'stressbalance.FSreconditioning','>',0);
++				md = checkfield(md,'fieldname','stressbalance.FSreconditioning','>',0);
+ 			end
+ 		end % }}}
+ 		function list=defaultoutputs(self,md) % {{{
+Index: ../trunk-jpl/src/m/classes/hydrologyshreve.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/hydrologyshreve.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/hydrologyshreve.m	(revision 16764)
+@@ -43,8 +43,8 @@
+ 				return;
+ 			end
+ 
+-			md = checkfield(md,'hydrology.spcwatercolumn','forcing',1);
+-			md = checkfield(md,'hydrology.stabilization','>=',0);
++			md = checkfield(md,'fieldname','hydrology.spcwatercolumn','forcing',1);
++			md = checkfield(md,'fieldname','hydrology.stabilization','>=',0);
+ 		end % }}}
+ 		function disp(obj) % {{{
+ 			disp(sprintf('   hydrologyshreve solution parameters:'));
+Index: ../trunk-jpl/src/m/classes/matice.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/matice.py	(revision 16763)
++++ ../trunk-jpl/src/m/classes/matice.py	(revision 16764)
+@@ -112,17 +112,17 @@
+ 		return self
+ 		#}}}
+ 	def checkconsistency(self,md,solution,analyses):    # {{{
+-		md = checkfield(md,'materials.rho_ice','>',0)
+-		md = checkfield(md,'materials.rho_water','>',0)
+-		md = checkfield(md,'materials.rho_freshwater','>',0)
+-		md = checkfield(md,'materials.mu_water','>',0)
+-		md = checkfield(md,'materials.rheology_B','>',0,'size',[md.mesh.numberofvertices])
+-		md = checkfield(md,'materials.rheology_n','>',0,'size',[md.mesh.numberofelements])
+-		md = checkfield(md,'materials.rheology_law','values',['None','Paterson','Arrhenius','LliboutryDuval'])
+-		md = checkfield(md,'materials.lithosphere_shear_modulus','>',0,'numel',[1]);
+-		md = checkfield(md,'materials.lithosphere_density','>',0,'numel',[1]);
+-		md = checkfield(md,'materials.mantle_shear_modulus','>',0,'numel',[1]);
+-		md = checkfield(md,'materials.mantle_density','>',0,'numel',[1]);
++		md = checkfield(md,'fieldname','materials.rho_ice','>',0)
++		md = checkfield(md,'fieldname','materials.rho_water','>',0)
++		md = checkfield(md,'fieldname','materials.rho_freshwater','>',0)
++		md = checkfield(md,'fieldname','materials.mu_water','>',0)
++		md = checkfield(md,'fieldname','materials.rheology_B','>',0,'size',[md.mesh.numberofvertices])
++		md = checkfield(md,'fieldname','materials.rheology_n','>',0,'size',[md.mesh.numberofelements])
++		md = checkfield(md,'fieldname','materials.rheology_law','values',['None','Paterson','Arrhenius','LliboutryDuval'])
++		md = checkfield(md,'fieldname','materials.lithosphere_shear_modulus','>',0,'numel',[1]);
++		md = checkfield(md,'fieldname','materials.lithosphere_density','>',0,'numel',[1]);
++		md = checkfield(md,'fieldname','materials.mantle_shear_modulus','>',0,'numel',[1]);
++		md = checkfield(md,'fieldname','materials.mantle_density','>',0,'numel',[1]);
+ 		return md
+ 	# }}}
+ 	def marshall(self,md,fid):    # {{{
+Index: ../trunk-jpl/src/m/classes/miscellaneous.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/miscellaneous.py	(revision 16763)
++++ ../trunk-jpl/src/m/classes/miscellaneous.py	(revision 16764)
+@@ -33,7 +33,7 @@
+ 		return self
+ 	#}}}
+ 	def checkconsistency(self,md,solution,analyses):    # {{{
+-		md = checkfield(md,'miscellaneous.name','empty',1)
++		md = checkfield(md,'fieldname','miscellaneous.name','empty',1)
+ 		return md
+ 	# }}}
+ 	def marshall(self,md,fid):    #  {{{
+Index: ../trunk-jpl/src/m/classes/spheremesh.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/spheremesh.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/spheremesh.m	(revision 16764)
+@@ -41,44 +41,44 @@
+ 		end % }}}
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+ 
+-			md = checkfield(md,'spheremesh.x','NaN',1,'size',[md.spheremesh.numberofvertices 1]);
+-			md = checkfield(md,'spheremesh.y','NaN',1,'size',[md.spheremesh.numberofvertices 1]);
+-			md = checkfield(md,'spheremesh.z','NaN',1,'size',[md.spheremesh.numberofvertices 1]);
+-			md = checkfield(md,'spheremesh.r','NaN',1,'size',[md.spheremesh.numberofvertices 1]);
+-			md = checkfield(md,'spheremesh.theta','NaN',1,'size',[md.spheremesh.numberofvertices 1]);
+-			md = checkfield(md,'spheremesh.phi','NaN',1,'size',[md.spheremesh.numberofvertices 1]);
+-			md = checkfield(md,'spheremesh.elements','NaN',1,'>',0,'values',1:md.spheremesh.numberofvertices);
++			md = checkfield(md,'fieldname','spheremesh.x','NaN',1,'size',[md.spheremesh.numberofvertices 1]);
++			md = checkfield(md,'fieldname','spheremesh.y','NaN',1,'size',[md.spheremesh.numberofvertices 1]);
++			md = checkfield(md,'fieldname','spheremesh.z','NaN',1,'size',[md.spheremesh.numberofvertices 1]);
++			md = checkfield(md,'fieldname','spheremesh.r','NaN',1,'size',[md.spheremesh.numberofvertices 1]);
++			md = checkfield(md,'fieldname','spheremesh.theta','NaN',1,'size',[md.spheremesh.numberofvertices 1]);
++			md = checkfield(md,'fieldname','spheremesh.phi','NaN',1,'size',[md.spheremesh.numberofvertices 1]);
++			md = checkfield(md,'fieldname','spheremesh.elements','NaN',1,'>',0,'values',1:md.spheremesh.numberofvertices);
+ 			if(md.spheremesh.dimension==2),
+-				md = checkfield(md,'spheremesh.elements','size',[md.spheremesh.numberofelements 3]);
++				md = checkfield(md,'fieldname','spheremesh.elements','size',[md.spheremesh.numberofelements 3]);
+ 			else
+-				md = checkfield(md,'spheremesh.elements','size',[md.spheremesh.numberofelements 6]);
++				md = checkfield(md,'fieldname','spheremesh.elements','size',[md.spheremesh.numberofelements 6]);
+ 			end
+ 			if any(~ismember(1:md.spheremesh.numberofvertices,sort(unique(md.spheremesh.elements(:)))));
+ 				md = checkmessage(md,'orphan nodes have been found. Check the spheremesh outline');
+ 			end
+-			md = checkfield(md,'spheremesh.dimension','values',[2 3]);
+-			md = checkfield(md,'spheremesh.numberoflayers','>=',0);
+-			md = checkfield(md,'spheremesh.numberofelements','>',0);
+-			md = checkfield(md,'spheremesh.numberofvertices','>',0);
++			md = checkfield(md,'fieldname','spheremesh.dimension','values',[2 3]);
++			md = checkfield(md,'fieldname','spheremesh.numberoflayers','>=',0);
++			md = checkfield(md,'fieldname','spheremesh.numberofelements','>',0);
++			md = checkfield(md,'fieldname','spheremesh.numberofvertices','>',0);
+ 			if (md.spheremesh.dimension==2),
+-				md = checkfield(md,'spheremesh.average_vertex_connectivity','>=',9,'message','''spheremesh.average_vertex_connectivity'' should be at least 9 in 2d');
++				md = checkfield(md,'fieldname','spheremesh.average_vertex_connectivity','>=',9,'message','''spheremesh.average_vertex_connectivity'' should be at least 9 in 2d');
+ 			else
+-				md = checkfield(md,'spheremesh.average_vertex_connectivity','>=',24,'message','''spheremesh.average_vertex_connectivity'' should be at least 24 in 3d');
++				md = checkfield(md,'fieldname','spheremesh.average_vertex_connectivity','>=',24,'message','''spheremesh.average_vertex_connectivity'' should be at least 24 in 3d');
+ 			end
+-			md = checkfield(md,'spheremesh.elementconnectivity','size',[md.spheremesh.numberofelements 3],'NaN',1);
++			md = checkfield(md,'fieldname','spheremesh.elementconnectivity','size',[md.spheremesh.numberofelements 3],'NaN',1);
+ 
+ 			%Solution specific checks
+ 			switch(solution),
+ 				case MasstransportSolutionEnum(),
+ 					if md.masstransport.stabilization==3,
+-						md = checkfield(md,'spheremesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d spheremeshes');
++						md = checkfield(md,'fieldname','spheremesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d spheremeshes');
+ 					end
+ 				case TransientSolutionEnum(),
+ 					if md.transient.ismasstransport & md.masstransport.stabilization==3,
+-						md = checkfield(md,'spheremesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d spheremeshes');
++						md = checkfield(md,'fieldname','spheremesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d spheremeshes');
+ 					end
+ 				case ThermalSolutionEnum(),
+-					md = checkfield(md,'spheremesh.dimension','values',3,'message','thermal solution only supported on 3d spheremeshes');
++					md = checkfield(md,'fieldname','spheremesh.dimension','values',3,'message','thermal solution only supported on 3d spheremeshes');
+ 			end
+ 		end % }}}
+ 		function disp(obj) % {{{
+Index: ../trunk-jpl/src/m/classes/inversion.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/inversion.py	(revision 16763)
++++ ../trunk-jpl/src/m/classes/inversion.py	(revision 16764)
+@@ -115,18 +115,18 @@
+ 		num_controls=numpy.size(md.inversion.control_parameters)
+ 		num_costfunc=numpy.size(md.inversion.cost_functions)
+ 
+-		md = checkfield(md,'inversion.iscontrol','values',[0,1])
+-		md = checkfield(md,'inversion.tao','values',[0,1])
+-		md = checkfield(md,'inversion.incomplete_adjoint','values',[0,1])
+-		md = checkfield(md,'inversion.control_parameters','cell',1,'values',['BalancethicknessThickeningRate','FrictionCoefficient','MaterialsRheologyBbar','DamageDbar','Vx','Vy'])
+-		md = checkfield(md,'inversion.nsteps','numel',[1],'>=',0)
+-		md = checkfield(md,'inversion.maxiter_per_step','size',[md.inversion.nsteps],'>=',0)
+-		md = checkfield(md,'inversion.step_threshold','size',[md.inversion.nsteps])
+-		md = checkfield(md,'inversion.cost_functions','size',[num_costfunc],'values',[101,102,103,104,105,201,501,502,503,504,505])
+-		md = checkfield(md,'inversion.cost_functions_coefficients','size',[md.mesh.numberofvertices,num_costfunc],'>=',0)
+-		md = checkfield(md,'inversion.gradient_scaling','size',[md.inversion.nsteps,num_controls])
+-		md = checkfield(md,'inversion.min_parameters','size',[md.mesh.numberofvertices,num_controls])
+-		md = checkfield(md,'inversion.max_parameters','size',[md.mesh.numberofvertices,num_controls])
++		md = checkfield(md,'fieldname','inversion.iscontrol','values',[0,1])
++		md = checkfield(md,'fieldname','inversion.tao','values',[0,1])
++		md = checkfield(md,'fieldname','inversion.incomplete_adjoint','values',[0,1])
++		md = checkfield(md,'fieldname','inversion.control_parameters','cell',1,'values',['BalancethicknessThickeningRate','FrictionCoefficient','MaterialsRheologyBbar','DamageDbar','Vx','Vy'])
++		md = checkfield(md,'fieldname','inversion.nsteps','numel',[1],'>=',0)
++		md = checkfield(md,'fieldname','inversion.maxiter_per_step','size',[md.inversion.nsteps],'>=',0)
++		md = checkfield(md,'fieldname','inversion.step_threshold','size',[md.inversion.nsteps])
++		md = checkfield(md,'fieldname','inversion.cost_functions','size',[num_costfunc],'values',[101,102,103,104,105,201,501,502,503,504,505])
++		md = checkfield(md,'fieldname','inversion.cost_functions_coefficients','size',[md.mesh.numberofvertices,num_costfunc],'>=',0)
++		md = checkfield(md,'fieldname','inversion.gradient_scaling','size',[md.inversion.nsteps,num_controls])
++		md = checkfield(md,'fieldname','inversion.min_parameters','size',[md.mesh.numberofvertices,num_controls])
++		md = checkfield(md,'fieldname','inversion.max_parameters','size',[md.mesh.numberofvertices,num_controls])
+ 
+ 		#Only SSA, HO and FS are supported right now
+ 		if solution==StressbalanceSolutionEnum():
+@@ -134,10 +134,10 @@
+ 				md.checkmessage("'inversion can only be performed for SSA, HO or FS ice flow models");
+ 
+ 		if solution==BalancethicknessSolutionEnum():
+-			md = checkfield(md,'inversion.thickness_obs','size',[md.mesh.numberofvertices],'NaN',1)
++			md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices],'NaN',1)
+ 		else:
+-			md = checkfield(md,'inversion.vx_obs','size',[md.mesh.numberofvertices],'NaN',1)
+-			md = checkfield(md,'inversion.vy_obs','size',[md.mesh.numberofvertices],'NaN',1)
++			md = checkfield(md,'fieldname','inversion.vx_obs','size',[md.mesh.numberofvertices],'NaN',1)
++			md = checkfield(md,'fieldname','inversion.vy_obs','size',[md.mesh.numberofvertices],'NaN',1)
+ 
+ 		return md
+ 	# }}}
+Index: ../trunk-jpl/src/m/classes/basalforcings.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/basalforcings.py	(revision 16763)
++++ ../trunk-jpl/src/m/classes/basalforcings.py	(revision 16764)
+@@ -35,14 +35,14 @@
+ 	def checkconsistency(self,md,solution,analyses):    # {{{
+ 
+ 		if MasstransportAnalysisEnum() in analyses and not (solution==TransientSolutionEnum() and not md.transient.ismasstransport):
+-			md = checkfield(md,'basalforcings.melting_rate','NaN',1,'forcing',1)
++			md = checkfield(md,'fieldname','basalforcings.melting_rate','NaN',1,'forcing',1)
+ 
+ 		if BalancethicknessAnalysisEnum() in analyses:
+-			md = checkfield(md,'basalforcings.melting_rate','NaN',1,'size',[md.mesh.numberofvertices])
++			md = checkfield(md,'fieldname','basalforcings.melting_rate','NaN',1,'size',[md.mesh.numberofvertices])
+ 
+ 		if ThermalAnalysisEnum() in analyses and not (solution==TransientSolutionEnum() and not md.transient.isthermal):
+-			md = checkfield(md,'basalforcings.melting_rate','NaN',1,'forcing',1)
+-			md = checkfield(md,'basalforcings.geothermalflux','NaN',1,'forcing',1,'>=',0)
++			md = checkfield(md,'fieldname','basalforcings.melting_rate','NaN',1,'forcing',1)
++			md = checkfield(md,'fieldname','basalforcings.geothermalflux','NaN',1,'forcing',1,'>=',0)
+ 
+ 		return md
+ 	# }}}
+Index: ../trunk-jpl/src/m/classes/flowequation.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/flowequation.py	(revision 16763)
++++ ../trunk-jpl/src/m/classes/flowequation.py	(revision 16764)
+@@ -67,23 +67,23 @@
+ 	def checkconsistency(self,md,solution,analyses):    # {{{
+ 
+ 		if StressbalanceAnalysisEnum() in analyses:
+-			md = checkfield(md,'flowequation.isSIA','numel',[1],'values',[0,1])
+-			md = checkfield(md,'flowequation.isSSA','numel',[1],'values',[0,1])
+-			md = checkfield(md,'flowequation.isL1L2','numel',[1],'values',[0,1])
+-			md = checkfield(md,'flowequation.isHO','numel',[1],'values',[0,1])
+-			md = checkfield(md,'flowequation.isFS','numel',[1],'values',[0,1])
+-			md = checkfield(md,'flowequation.fe_SSA','values',['P1','P1bubble','P1bubblecondensed','P2'])
+-			md = checkfield(md,'flowequation.fe_HO' ,'values',['P1','P1bubble','P1bubblecondensed','P1xP2','P2xP1','P2'])
+-			md = checkfield(md,'flowequation.fe_FS' ,'values',['P1P1','P1P1GLS','MINIcondensed','MINI','TaylorHood'])
+-			md = checkfield(md,'flowequation.borderSSA','size',[md.mesh.numberofvertices],'values',[0,1])
+-			md = checkfield(md,'flowequation.borderHO','size',[md.mesh.numberofvertices],'values',[0,1])
+-			md = checkfield(md,'flowequation.borderFS','size',[md.mesh.numberofvertices],'values',[0,1])
++			md = checkfield(md,'fieldname','flowequation.isSIA','numel',[1],'values',[0,1])
++			md = checkfield(md,'fieldname','flowequation.isSSA','numel',[1],'values',[0,1])
++			md = checkfield(md,'fieldname','flowequation.isL1L2','numel',[1],'values',[0,1])
++			md = checkfield(md,'fieldname','flowequation.isHO','numel',[1],'values',[0,1])
++			md = checkfield(md,'fieldname','flowequation.isFS','numel',[1],'values',[0,1])
++			md = checkfield(md,'fieldname','flowequation.fe_SSA','values',['P1','P1bubble','P1bubblecondensed','P2'])
++			md = checkfield(md,'fieldname','flowequation.fe_HO' ,'values',['P1','P1bubble','P1bubblecondensed','P1xP2','P2xP1','P2'])
++			md = checkfield(md,'fieldname','flowequation.fe_FS' ,'values',['P1P1','P1P1GLS','MINIcondensed','MINI','TaylorHood'])
++			md = checkfield(md,'fieldname','flowequation.borderSSA','size',[md.mesh.numberofvertices],'values',[0,1])
++			md = checkfield(md,'fieldname','flowequation.borderHO','size',[md.mesh.numberofvertices],'values',[0,1])
++			md = checkfield(md,'fieldname','flowequation.borderFS','size',[md.mesh.numberofvertices],'values',[0,1])
+ 			if strcmp(md.mesh.meshtype(),'2Dhorizontal'):
+-				md = checkfield(md,'flowequation.vertex_equation','size',[md.mesh.numberofvertices],'values',[1,2])
+-				md = checkfield(md,'flowequation.element_equation','size',[md.mesh.numberofelements],'values',[1,2])
++				md = checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices],'values',[1,2])
++				md = checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements],'values',[1,2])
+ 			elif strcmp(md.mesh.meshtype(),'3D'):
+-				md = checkfield(md,'flowequation.vertex_equation','size',[md.mesh.numberofvertices],'values',numpy.arange(0,8+1))
+-				md = checkfield(md,'flowequation.element_equation','size',[md.mesh.numberofelements],'values',numpy.arange(0,8+1))
++				md = checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices],'values',numpy.arange(0,8+1))
++				md = checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements],'values',numpy.arange(0,8+1))
+ 			else:
+ 				raise RuntimeError('mesh type not supported yet')
+ 			if not (self.isSIA or self.isSSA or self.isL1L2 or self.isHO or self.isFS):
+Index: ../trunk-jpl/src/m/classes/basalforcings.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/basalforcings.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/basalforcings.m	(revision 16764)
+@@ -24,14 +24,14 @@
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+ 
+ 			if ismember(MasstransportAnalysisEnum(),analyses) & ~(solution==TransientSolutionEnum() & md.transient.ismasstransport==0),
+-				md = checkfield(md,'basalforcings.melting_rate','NaN',1,'forcing',1);
++				md = checkfield(md,'fieldname','basalforcings.melting_rate','NaN',1,'forcing',1);
+ 			end
+ 			if ismember(BalancethicknessAnalysisEnum(),analyses),
+-				md = checkfield(md,'basalforcings.melting_rate','NaN',1,'size',[md.mesh.numberofvertices 1]);
++				md = checkfield(md,'fieldname','basalforcings.melting_rate','NaN',1,'size',[md.mesh.numberofvertices 1]);
+ 			end
+ 			if ismember(ThermalAnalysisEnum(),analyses) & ~(solution==TransientSolutionEnum() & md.transient.isthermal==0),
+-				md = checkfield(md,'basalforcings.melting_rate','NaN',1,'forcing',1);
+-				md = checkfield(md,'basalforcings.geothermalflux','NaN',1,'forcing',1,'>=',0);
++				md = checkfield(md,'fieldname','basalforcings.melting_rate','NaN',1,'forcing',1);
++				md = checkfield(md,'fieldname','basalforcings.geothermalflux','NaN',1,'forcing',1,'>=',0);
+ 			end
+ 		end % }}}
+ 		function disp(obj) % {{{
+Index: ../trunk-jpl/src/m/classes/flowequation.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/flowequation.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/flowequation.m	(revision 16764)
+@@ -79,26 +79,26 @@
+ 
+ 			if ismember(StressbalanceAnalysisEnum(),analyses),
+ 
+-				md = checkfield(md,'flowequation.isSIA','numel',[1],'values',[0 1]);
+-				md = checkfield(md,'flowequation.isSSA','numel',[1],'values',[0 1]);
+-				md = checkfield(md,'flowequation.isL1L2','numel',[1],'values',[0 1]);
+-				md = checkfield(md,'flowequation.isHO','numel',[1],'values',[0 1]);
+-				md = checkfield(md,'flowequation.isFS','numel',[1],'values',[0 1]);
+-				md = checkfield(md,'flowequation.fe_SSA','values',{'P1','P1bubble','P1bubblecondensed','P2'});
+-				md = checkfield(md,'flowequation.fe_HO' ,'values',{'P1','P1bubble','P1bubblecondensed','P1xP2','P2xP1','P2'});
+-				md = checkfield(md,'flowequation.fe_FS' ,'values',{'P1P1','P1P1GLS','MINIcondensed','MINI','TaylorHood'});
+-				md = checkfield(md,'flowequation.borderSSA','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+-				md = checkfield(md,'flowequation.borderHO','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+-				md = checkfield(md,'flowequation.borderFS','size',[md.mesh.numberofvertices 1],'values',[0 1]);
++				md = checkfield(md,'fieldname','flowequation.isSIA','numel',[1],'values',[0 1]);
++				md = checkfield(md,'fieldname','flowequation.isSSA','numel',[1],'values',[0 1]);
++				md = checkfield(md,'fieldname','flowequation.isL1L2','numel',[1],'values',[0 1]);
++				md = checkfield(md,'fieldname','flowequation.isHO','numel',[1],'values',[0 1]);
++				md = checkfield(md,'fieldname','flowequation.isFS','numel',[1],'values',[0 1]);
++				md = checkfield(md,'fieldname','flowequation.fe_SSA','values',{'P1','P1bubble','P1bubblecondensed','P2'});
++				md = checkfield(md,'fieldname','flowequation.fe_HO' ,'values',{'P1','P1bubble','P1bubblecondensed','P1xP2','P2xP1','P2'});
++				md = checkfield(md,'fieldname','flowequation.fe_FS' ,'values',{'P1P1','P1P1GLS','MINIcondensed','MINI','TaylorHood'});
++				md = checkfield(md,'fieldname','flowequation.borderSSA','size',[md.mesh.numberofvertices 1],'values',[0 1]);
++				md = checkfield(md,'fieldname','flowequation.borderHO','size',[md.mesh.numberofvertices 1],'values',[0 1]);
++				md = checkfield(md,'fieldname','flowequation.borderFS','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+ 				if strcmp(meshtype(md.mesh),'2Dhorizontal')
+-					md = checkfield(md,'flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[1:2]);
+-					md = checkfield(md,'flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[1:2]);
++					md = checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[1:2]);
++					md = checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[1:2]);
+ 				elseif strcmp(meshtype(md.mesh),'2Dvertical')
+-					md = checkfield(md,'flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[4]);
+-					md = checkfield(md,'flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[4]);
++					md = checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[4]);
++					md = checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[4]);
+ 				elseif strcmp(meshtype(md.mesh),'3D'),
+-					md = checkfield(md,'flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[0:8]);
+-					md = checkfield(md,'flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[0:8]);
++					md = checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[0:8]);
++					md = checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[0:8]);
+ 				else
+ 					error('Case not supported yet');
+ 				end
+Index: ../trunk-jpl/src/m/classes/mesh2d.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh2d.py	(revision 16763)
++++ ../trunk-jpl/src/m/classes/mesh2d.py	(revision 16764)
+@@ -82,16 +82,16 @@
+ 	#}}}
+ 	def checkconsistency(self,md,solution,analyses):    # {{{
+ 
+-		md = checkfield(md,'mesh.x','NaN',1,'size',[md.mesh.numberofvertices])
+-		md = checkfield(md,'mesh.y','NaN',1,'size',[md.mesh.numberofvertices])
+-		md = checkfield(md,'mesh.z','NaN',1,'size',[md.mesh.numberofvertices])
+-		md = checkfield(md,'mesh.elements','NaN',1,'>',0,'values',numpy.arange(1,md.mesh.numberofvertices+1))
+-		md = checkfield(md,'mesh.elements','size',[md.mesh.numberofelements,3])
++		md = checkfield(md,'fieldname','mesh.x','NaN',1,'size',[md.mesh.numberofvertices])
++		md = checkfield(md,'fieldname','mesh.y','NaN',1,'size',[md.mesh.numberofvertices])
++		md = checkfield(md,'fieldname','mesh.z','NaN',1,'size',[md.mesh.numberofvertices])
++		md = checkfield(md,'fieldname','mesh.elements','NaN',1,'>',0,'values',numpy.arange(1,md.mesh.numberofvertices+1))
++		md = checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements,3])
+ 		if numpy.any(numpy.logical_not(ismember(numpy.arange(1,md.mesh.numberofvertices+1),md.mesh.elements))):
+ 			md.checkmessage("orphan nodes have been found. Check the mesh outline")
+-		md = checkfield(md,'mesh.numberofelements','>',0)
+-		md = checkfield(md,'mesh.numberofvertices','>',0)
+-		md = checkfield(md,'mesh.average_vertex_connectivity','>=',9,'message',"'mesh.average_vertex_connectivity' should be at least 9 in 2d")
++		md = checkfield(md,'fieldname','mesh.numberofelements','>',0)
++		md = checkfield(md,'fieldname','mesh.numberofvertices','>',0)
++		md = checkfield(md,'fieldname','mesh.average_vertex_connectivity','>=',9,'message',"'mesh.average_vertex_connectivity' should be at least 9 in 2d")
+ 		if solution==ThermalSolutionEnum():
+ 			md.checkmessage("thermal not supported for 2d mesh")
+ 
+Index: ../trunk-jpl/src/m/classes/damage.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/damage.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/damage.m	(revision 16764)
+@@ -79,24 +79,24 @@
+ 		end % }}}
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+ 			
+-			md = checkfield(md,'damage.D','>=',0,'<=',obj.max_damage,'size',[md.mesh.numberofvertices 1]);
+-			md = checkfield(md,'damage.max_damage','<',1,'>=',0);
+-			md = checkfield(md,'damage.law','values',{'undamaged','pralong'});
+-			md = checkfield(md,'damage.spcdamage','forcing',1);
++			md = checkfield(md,'fieldname','damage.D','>=',0,'<=',obj.max_damage,'size',[md.mesh.numberofvertices 1]);
++			md = checkfield(md,'fieldname','damage.max_damage','<',1,'>=',0);
++			md = checkfield(md,'fieldname','damage.law','values',{'undamaged','pralong'});
++			md = checkfield(md,'fieldname','damage.spcdamage','forcing',1);
+ 			
+-			md = checkfield(md,'damage.stabilization','numel',[1],'values',[0 1 2]);
+-			md = checkfield(md,'damage.maxiter','>=0',0);
+-			md = checkfield(md,'damage.penalty_factor','>=0',0);
+-			md = checkfield(md,'damage.penalty_lock','>=0',0);
+-			md = checkfield(md,'damage.penalty_threshold','>=0',0);
++			md = checkfield(md,'fieldname','damage.stabilization','numel',[1],'values',[0 1 2]);
++			md = checkfield(md,'fieldname','damage.maxiter','>=0',0);
++			md = checkfield(md,'fieldname','damage.penalty_factor','>=0',0);
++			md = checkfield(md,'fieldname','damage.penalty_lock','>=0',0);
++			md = checkfield(md,'fieldname','damage.penalty_threshold','>=0',0);
+ 
+ 			if strcmpi(obj.law,'pralong'),
+-				md = checkfield(md,'damage.healing','>=',0);
+-				md = checkfield(md,'damage.c1','>=',0);
+-				md = checkfield(md,'damage.c2','>=',0);
+-				md = checkfield(md,'damage.c3','>=',0);
+-				md = checkfield(md,'damage.c4','>=',0);
+-				md = checkfield(md,'damage.stress_threshold','>=',0);
++				md = checkfield(md,'fieldname','damage.healing','>=',0);
++				md = checkfield(md,'fieldname','damage.c1','>=',0);
++				md = checkfield(md,'fieldname','damage.c2','>=',0);
++				md = checkfield(md,'fieldname','damage.c3','>=',0);
++				md = checkfield(md,'fieldname','damage.c4','>=',0);
++				md = checkfield(md,'fieldname','damage.stress_threshold','>=',0);
+ 			elseif strcmpi(obj.law,'undamaged'),
+ 				if (solution==DamageEvolutionSolutionEnum),
+ 					error('Invalid evolution law (md.damage.law) for a damage solution');
+Index: ../trunk-jpl/src/m/classes/masstransport.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/masstransport.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/masstransport.m	(revision 16764)
+@@ -86,12 +86,12 @@
+ 			%Early return
+ 			if ~ismember(MasstransportAnalysisEnum(),analyses) |  (solution==TransientSolutionEnum() & md.transient.ismasstransport==0), return; end
+ 
+-			md = checkfield(md,'masstransport.spcthickness','forcing',1);
+-			md = checkfield(md,'masstransport.isfreesurface','values',[0 1]);
+-			md = checkfield(md,'masstransport.hydrostatic_adjustment','values',{'Absolute' 'Incremental'});
+-			md = checkfield(md,'masstransport.stabilization','values',[0 1 2 3]);
+-			md = checkfield(md,'masstransport.min_thickness','>',0);
+-			md = checkfield(md,'masstransport.requested_outputs','stringrow',1);
++			md = checkfield(md,'fieldname','masstransport.spcthickness','forcing',1);
++			md = checkfield(md,'fieldname','masstransport.isfreesurface','values',[0 1]);
++			md = checkfield(md,'fieldname','masstransport.hydrostatic_adjustment','values',{'Absolute' 'Incremental'});
++			md = checkfield(md,'fieldname','masstransport.stabilization','values',[0 1 2 3]);
++			md = checkfield(md,'fieldname','masstransport.min_thickness','>',0);
++			md = checkfield(md,'fieldname','masstransport.requested_outputs','stringrow',1);
+ 
+ 		end % }}}
+ 		function disp(obj) % {{{
+Index: ../trunk-jpl/src/m/classes/taoinversion.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/taoinversion.m	(revision 16763)
++++ ../trunk-jpl/src/m/classes/taoinversion.m	(revision 16764)
+@@ -74,23 +74,23 @@
+ 			num_controls=numel(md.inversion.control_parameters);
+ 			num_costfunc=size(md.inversion.cost_functions,2);
+ 
+-			md = checkfield(md,'inversion.iscontrol','values',[0 1]);
+-			md = checkfield(md,'inversion.incomplete_adjoint','values',[0 1]);
+-			md = checkfield(md,'inversion.control_parameters','cell',1,'values',...
++			md = checkfield(md,'fieldname','inversion.iscontrol','values',[0 1]);
++			md = checkfield(md,'fieldname','inversion.incomplete_adjoint','values',[0 1]);
++			md = checkfield(md,'fieldname','inversion.control_parameters','cell',1,'values',...
+ 				{'BalancethicknessThickeningRate' 'FrictionCoefficient' 'MaterialsRheologyBbar' 'MaterialsRheologyZbar' 'Vx' 'Vy' 'Thickness'});
+-			md = checkfield(md,'inversion.nsteps','numel',1,'>=',0);
+-			md = checkfield(md,'inversion.cost_functions','size',[1 num_costfunc],'values',[101:105 201 501:506]);
+-			md = checkfield(md,'inversion.cost_functions_coefficients','size',[md.mesh.numberofvertices num_costfunc],'>=',0);
+-			md = checkfield(md,'inversion.min_parameters','size',[md.mesh.numberofvertices num_controls]);
+-			md = checkfield(md,'inversion.max_parameters','size',[md.mesh.numberofvertices num_controls]);
++			md = checkfield(md,'fieldname','inversion.nsteps','numel',1,'>=',0);
++			md = checkfield(md,'fieldname','inversion.cost_functions','size',[1 num_costfunc],'values',[101:105 201 501:506]);
++			md = checkfield(md,'fieldname','inversion.cost_functions_coefficients','size',[md.mesh.numberofvertices num_costfunc],'>=',0);
++			md = checkfield(md,'fieldname','inversion.min_parameters','size',[md.mesh.numberofvertices num_controls]);
++			md = checkfield(md,'fieldname','inversion.max_parameters','size',[md.mesh.numberofvertices num_controls]);
+ 
+ 			if solution==BalancethicknessSolutionEnum()
+-				md = checkfield(md,'inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
++				md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+ 			elseif solution==BalancethicknessSoftSolutionEnum()
+-				md = checkfield(md,'inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
++				md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+ 			else
+-				md = checkfield(md,'inversion.vx_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+-				md = checkfield(md,'inversion.vy_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
++				md = checkfield(md,'fieldname','inversion.vx_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
++				md = checkfield(md,'fieldname','inversion.vy_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+ 			end
+ 		end % }}}
+ 		function disp(obj) % {{{
+Index: ../trunk-jpl/src/m/interp/averaging.py
+===================================================================
+--- ../trunk-jpl/src/m/interp/averaging.py	(revision 16763)
++++ ../trunk-jpl/src/m/interp/averaging.py	(revision 16764)
+@@ -49,6 +49,7 @@
+ 		index=md.mesh.elements2d
+ 		numberofnodes=md.mesh.numberofvertices2d
+ 		numberofelements=md.mesh.numberofelements2d
++
+ 	
+ 	#build some variables
+ 	if md.mesh.dimension==3 and layer==0:
+@@ -74,8 +75,10 @@
+ 	if len(data)==numberofelements:
+ 		average_node=csc_matrix( (npy.tile(areas*data,(rep,1)).reshape(-1,),(line,npy.zeros(linesize,))), shape=(numberofnodes,1))
+ 		average_node=average_node/weights
++		average_node = csc_matrix(average_node)
+ 	else:
+ 		average_node=data
++
+ 	
+ 	#loop over iteration
+ 	for i in npy.arange(1,iterations+1):
Index: issm/oecreview/Archive/16554-17801/ISSM-16764-16765.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16764-16765.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16764-16765.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/classes/rifts.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/rifts.m	(revision 16764)
++++ ../trunk-jpl/src/m/classes/rifts.m	(revision 16765)
+@@ -38,7 +38,7 @@
+ 					md = checkmessage(md,['model should be processed for rifts (run meshprocessrifts)!']);
+ 				end
+ 				for i=1:numrifts,
+-					md = checkfield(md,sprintf('rifts.riftstruct(%d).fill',i),'values',[WaterEnum() AirEnum() IceEnum() MelangeEnum()]);
++					md = checkfield(md,'fieldname',sprintf('rifts.riftstruct(%d).fill',i),'values',[WaterEnum() AirEnum() IceEnum() MelangeEnum()]);
+ 				end
+ 			else
+ 				if ~isnans(obj.riftstruct),
Index: issm/oecreview/Archive/16554-17801/ISSM-16765-16766.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16765-16766.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16765-16766.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/classes/rifts.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/rifts.py	(revision 16765)
++++ ../trunk-jpl/src/m/classes/rifts.py	(revision 16766)
+@@ -46,7 +46,7 @@
+ 				#We have segments with rift markers, but no rift structure!
+ 				md.checkmessage("model should be processed for rifts (run meshprocessrifts)!")
+ 			for i,rift in enumerate(self.riftstruct):
+-				md = checkfield(md,"rifts.riftstruct[%d]['fill']" % i,'values',[WaterEnum(),AirEnum(),IceEnum(),MelangeEnum()])
++				md = checkfield(md,'fieldname',"rifts.riftstruct[%d]['fill']" % i,'values',[WaterEnum(),AirEnum(),IceEnum(),MelangeEnum()])
+ 		else:
+ 			if self.riftstruct and numpy.any(numpy.logical_not(isnans(self.riftstruct))):
+ 				md.checkmessage("riftstruct should be NaN since numrifts is 0!")
Index: issm/oecreview/Archive/16554-17801/ISSM-16766-16767.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16766-16767.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16766-16767.diff	(revision 17802)
@@ -0,0 +1,160 @@
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16766)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16767)
+@@ -550,6 +550,11 @@
+ 	MassfluxatgateEnum,
+ 	MassfluxatgateNameEnum,
+ 	MassfluxatgateSegmentsEnum,
++	MisfitNameEnum,
++	MisfitModelEnum,
++	MisfitObservationsEnum,
++	MisfitTimeinterpolationEnum,
++	MisfitWeightsEnum,
+ 	/*}}}*/
+ 	/*Responses{{{*/
+ 	MinVelEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 16766)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 16767)
+@@ -538,6 +538,11 @@
+ 		case MassfluxatgateEnum : return "Massfluxatgate";
+ 		case MassfluxatgateNameEnum : return "MassfluxatgateName";
+ 		case MassfluxatgateSegmentsEnum : return "MassfluxatgateSegments";
++		case MisfitNameEnum : return "MisfitName";
++		case MisfitModelEnum : return "MisfitModel";
++		case MisfitObservationsEnum : return "MisfitObservations";
++		case MisfitTimeinterpolationEnum : return "MisfitTimeinterpolation";
++		case MisfitWeightsEnum : return "MisfitWeights";
+ 		case MinVelEnum : return "MinVel";
+ 		case MaxVelEnum : return "MaxVel";
+ 		case MinVxEnum : return "MinVx";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 16766)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 16767)
+@@ -550,6 +550,11 @@
+ 	      else if (strcmp(name,"Massfluxatgate")==0) return MassfluxatgateEnum;
+ 	      else if (strcmp(name,"MassfluxatgateName")==0) return MassfluxatgateNameEnum;
+ 	      else if (strcmp(name,"MassfluxatgateSegments")==0) return MassfluxatgateSegmentsEnum;
++	      else if (strcmp(name,"MisfitName")==0) return MisfitNameEnum;
++	      else if (strcmp(name,"MisfitModel")==0) return MisfitModelEnum;
++	      else if (strcmp(name,"MisfitObservations")==0) return MisfitObservationsEnum;
++	      else if (strcmp(name,"MisfitTimeinterpolation")==0) return MisfitTimeinterpolationEnum;
++	      else if (strcmp(name,"MisfitWeights")==0) return MisfitWeightsEnum;
+ 	      else if (strcmp(name,"MinVel")==0) return MinVelEnum;
+ 	      else if (strcmp(name,"MaxVel")==0) return MaxVelEnum;
+ 	      else if (strcmp(name,"MinVx")==0) return MinVxEnum;
+@@ -623,10 +628,13 @@
+ 	      else if (strcmp(name,"OptionStruct")==0) return OptionStructEnum;
+ 	      else if (strcmp(name,"Paterson")==0) return PatersonEnum;
+ 	      else if (strcmp(name,"Arrhenius")==0) return ArrheniusEnum;
+-	      else if (strcmp(name,"LliboutryDuval")==0) return LliboutryDuvalEnum;
+-	      else if (strcmp(name,"MaximumNumberOfDefinitions")==0) return MaximumNumberOfDefinitionsEnum;
+          else stage=6;
+    }
++   if(stage==6){
++	      if (strcmp(name,"LliboutryDuval")==0) return LliboutryDuvalEnum;
++	      else if (strcmp(name,"MaximumNumberOfDefinitions")==0) return MaximumNumberOfDefinitionsEnum;
++         else stage=7;
++   }
+ 	/*If we reach this point, the string provided has not been found*/
+ 	if(notfounderror)
+ 		_error_("Enum " << name << " not found");
+Index: ../trunk-jpl/src/m/enum/MisfitWeightsEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/MisfitWeightsEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/MisfitWeightsEnum.m	(revision 16767)
+@@ -0,0 +1,11 @@
++function macro=MisfitWeightsEnum()
++%MISFITWEIGHTSENUM - Enum of MisfitWeights
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=MisfitWeightsEnum()
++
++macro=StringToEnum('MisfitWeights');
+Index: ../trunk-jpl/src/m/enum/MisfitNameEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/MisfitNameEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/MisfitNameEnum.m	(revision 16767)
+@@ -0,0 +1,11 @@
++function macro=MisfitNameEnum()
++%MISFITNAMEENUM - Enum of MisfitName
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=MisfitNameEnum()
++
++macro=StringToEnum('MisfitName');
+Index: ../trunk-jpl/src/m/enum/MisfitObservationsEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/MisfitObservationsEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/MisfitObservationsEnum.m	(revision 16767)
+@@ -0,0 +1,11 @@
++function macro=MisfitObservationsEnum()
++%MISFITOBSERVATIONSENUM - Enum of MisfitObservations
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=MisfitObservationsEnum()
++
++macro=StringToEnum('MisfitObservations');
+Index: ../trunk-jpl/src/m/enum/MisfitTimeinterpolationEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/MisfitTimeinterpolationEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/MisfitTimeinterpolationEnum.m	(revision 16767)
+@@ -0,0 +1,11 @@
++function macro=MisfitTimeinterpolationEnum()
++%MISFITTIMEINTERPOLATIONENUM - Enum of MisfitTimeinterpolation
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=MisfitTimeinterpolationEnum()
++
++macro=StringToEnum('MisfitTimeinterpolation');
+Index: ../trunk-jpl/src/m/enum/MisfitModelEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/MisfitModelEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/MisfitModelEnum.m	(revision 16767)
+@@ -0,0 +1,11 @@
++function macro=MisfitModelEnum()
++%MISFITMODELENUM - Enum of MisfitModel
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=MisfitModelEnum()
++
++macro=StringToEnum('MisfitModel');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 16766)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 16767)
+@@ -530,6 +530,11 @@
+ def MassfluxatgateEnum(): return StringToEnum("Massfluxatgate")[0]
+ def MassfluxatgateNameEnum(): return StringToEnum("MassfluxatgateName")[0]
+ def MassfluxatgateSegmentsEnum(): return StringToEnum("MassfluxatgateSegments")[0]
++def MisfitNameEnum(): return StringToEnum("MisfitName")[0]
++def MisfitModelEnum(): return StringToEnum("MisfitModel")[0]
++def MisfitObservationsEnum(): return StringToEnum("MisfitObservations")[0]
++def MisfitTimeinterpolationEnum(): return StringToEnum("MisfitTimeinterpolation")[0]
++def MisfitWeightsEnum(): return StringToEnum("MisfitWeights")[0]
+ def MinVelEnum(): return StringToEnum("MinVel")[0]
+ def MaxVelEnum(): return StringToEnum("MaxVel")[0]
+ def MinVxEnum(): return StringToEnum("MinVx")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-16767-16768.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16767-16768.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16767-16768.diff	(revision 17802)
@@ -0,0 +1,130 @@
+Index: ../trunk-jpl/src/c/classes/IoModel.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/IoModel.h	(revision 16767)
++++ ../trunk-jpl/src/c/classes/IoModel.h	(revision 16768)
+@@ -78,6 +78,7 @@
+ 		void        FetchData(IssmDouble*** pmatrixarray,int** pmdims,int** pndims, int* pnumrecords,int data_enum);
+ 		void        FetchMultipleData(char***   pstringarray,int* pnumstrings,int data_enum);
+ 		void        FetchMultipleData(IssmDouble*** pmatrixarray,int** pmdims,int** pndims, int* pnumrecords,int data_enum);
++		void        FetchMultipleData(int*** pmatrices,int** pmdims,int** pndims, int* pnumrecords,int data_enum);
+ 		void        FetchData(Option **poption,int data_enum);
+ 		void        FetchData(int num,...);
+ 		void        FetchDataToInput(Elements* elements,int vector_enum);
+Index: ../trunk-jpl/src/c/classes/IoModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 16767)
++++ ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 16768)
+@@ -1299,6 +1299,113 @@
+ 	*pnumrecords=num_instances;
+ }
+ /*}}}*/
++/*FUNCTION IoModel::FetchMultipleData(int*** pmatrices,int** pmdims,int** pndims, int* pM,int data_enum){{{*/
++void  IoModel::FetchMultipleData(int*** pmatrices,int** pmdims,int** pndims, int* pnumrecords,int data_enum){
++
++	int     num_instances;
++	fpos_t* file_positions=NULL;
++
++	/*output: */
++	int        **matrices = NULL;
++	int         *mdims    = NULL;
++	int         *ndims    = NULL;
++
++	/*intermediary: */
++	int          M, N;
++	IssmPDouble *pmatrix = NULL;
++	IssmDouble  *matrix  = NULL;
++	int         *integer_matrix=NULL;
++	int         *codes   = NULL;
++	int          code;
++
++	/*recover my_rank:*/
++	int my_rank=IssmComm::GetRank();
++	
++	/*Get file pointers to beginning of the data (multiple instances of it): */
++	file_positions=this->SetFilePointersToData(&codes,NULL,&num_instances,data_enum);
++
++	if(num_instances){
++
++		/*Allocate matrices :*/
++		matrices=xNew<int*>(num_instances);
++		mdims=xNew<int>(num_instances);
++		ndims=xNew<int>(num_instances);
++
++		for(int i=0;i<num_instances;i++){
++
++			if(my_rank==0){
++				code=codes[i];
++
++				if((code!=5) && (code!=6) && (code!=7))_error_("expecting a IssmDouble, integer or boolean matrix for enum " << EnumToStringx(data_enum));
++
++				/*We have to read a matrix from disk. First read the dimensions of the matrix, then the whole matrix: */
++				/*numberofelements: */
++				fsetpos(fid,file_positions+i);
++				if(fread(&M,sizeof(int),1,fid)!=1) _error_("could not read number of rows for matrix ");
++			}
++			ISSM_MPI_Bcast(&M,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
++
++			if(my_rank==0){  
++				if(fread(&N,sizeof(int),1,fid)!=1) _error_("could not read number of columns for matrix ");
++			}
++			ISSM_MPI_Bcast(&N,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
++
++
++			/*Now allocate matrix: */
++			if(M*N){
++				pmatrix=xNew<IssmPDouble>(M*N);
++				integer_matrix=xNew<int>(M*N);
++
++				/*Read matrix on node 0, then broadcast: */
++				if(my_rank==0){  
++					if(fread(pmatrix,M*N*sizeof(IssmPDouble),1,fid)!=1) _error_("could not read matrix ");
++				}
++				ISSM_MPI_Bcast(pmatrix,M*N,ISSM_MPI_PDOUBLE,0,IssmComm::GetComm()); 
++
++				_assert_(this->independents);
++				if(this->independents[data_enum]){
++					/*this data has already been checked out! So cancel all that we've done here, and return 
++					 * the data[data_enum] directly: */
++					matrix=this->data[data_enum];
++					for (int i=0;i<M*N;++i) integer_matrixmatrix[i]=reCast<int>(matrix[i]);
++				}
++				else{
++					for (int i=0;i<M*N;++i) integer_matrix[i]=pmatrix[i];
++				}
++				xDelete<IssmPDouble>(pmatrix);
++			}
++			else
++				integer_matrix=NULL;
++			
++			
++			/*Assign: */
++			mdims[i]=M;
++			matrices[i]=integer_matrix;
++			ndims[i]=N;
++		}
++	}
++			
++	/*Free ressources:*/
++	xDelete<fpos_t>(file_positions);
++	xDelete<int>(codes);
++
++	/*Assign output pointers: */
++	*pmatrices=matrices;
++	if(pmdims){
++		*pmdims=mdims;
++	}
++	else{
++		xDelete<int>(mdims);
++	}
++	if(pndims){
++		*pndims=ndims;
++	}
++	else{
++		xDelete<int>(ndims);
++	}
++	*pnumrecords=num_instances;
++}
++/*}}}*/
+ /*FUNCTION IoModel::FetchDataToInput(Elements* elements,int vector_enum,IssmDouble default_value){{{*/
+ void IoModel::FetchDataToInput(Elements* elements,int vector_enum,IssmDouble default_value){
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16768-16769.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16768-16769.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16768-16769.diff	(revision 17802)
@@ -0,0 +1,28 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16768)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16769)
+@@ -1247,7 +1247,7 @@
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+ 	int numdof   = numnodes*2;
+-	int numdof2d = numnodes;/*FIXME: only works for Penta*/
++	int numdof2d = numnodes;
+ 
+ 	/*Fetch dof list and allocate solution vectors*/
+ 	basalelement->GetDofList(&SSAdoflist,SSAApproximationEnum,GsetEnum);
+@@ -1303,11 +1303,11 @@
+ 	element->InputChangeName(VyEnum,VyPicardEnum);
+ 	element->InputChangeName(PressureEnum,PressurePicardEnum);
+ 
+-	/*Add vx and vy as inputs to the tria element: */
++	/*Add vx and vy as inputs to element: */
+ 	element->AddInput(VxEnum,vx,P1Enum);
+ 	element->AddInput(VyEnum,vy,P1Enum);
+-	element->AddBasalInput(VelEnum,vel,P1Enum);
+-	element->AddBasalInput(PressureEnum,pressure,P1Enum);
++	element->AddInput(VelEnum,vel,P1Enum);
++	element->AddInput(PressureEnum,pressure,P1Enum);
+ 
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(surface);
Index: issm/oecreview/Archive/16554-17801/ISSM-16769-16770.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16769-16770.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16769-16770.diff	(revision 17802)
@@ -0,0 +1,80 @@
+Index: ../trunk-jpl/src/c/classes/IoModel.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/IoModel.h	(revision 16769)
++++ ../trunk-jpl/src/c/classes/IoModel.h	(revision 16770)
+@@ -79,6 +79,7 @@
+ 		void        FetchMultipleData(char***   pstringarray,int* pnumstrings,int data_enum);
+ 		void        FetchMultipleData(IssmDouble*** pmatrixarray,int** pmdims,int** pndims, int* pnumrecords,int data_enum);
+ 		void        FetchMultipleData(int*** pmatrices,int** pmdims,int** pndims, int* pnumrecords,int data_enum);
++		void        FetchMultipleData(int** pvector, int* pnum_instances,int data_enum);
+ 		void        FetchData(Option **poption,int data_enum);
+ 		void        FetchData(int num,...);
+ 		void        FetchDataToInput(Elements* elements,int vector_enum);
+Index: ../trunk-jpl/src/c/classes/IoModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 16769)
++++ ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 16770)
+@@ -1194,6 +1194,63 @@
+ 	*pnumstrings=num_instances;
+ }
+ /*}}}*/
++/*FUNCTION IoModel::FetchMultipleData(int** pvector, int* pM,int data_enum){{{*/
++void  IoModel::FetchMultipleData(int** pvector, int* pnum_instances,int data_enum){
++
++	int     num_instances;
++	fpos_t* file_positions=NULL;
++
++	/*output: */
++	int* vector=NULL;
++	int num
++
++	/*intermediary: */
++	int          M, N;
++	IssmPDouble *pmatrix = NULL;
++	IssmDouble  *matrix  = NULL;
++	int         *codes   = NULL;
++	int          code;
++
++	/*recover my_rank:*/
++	int my_rank=IssmComm::GetRank();
++	
++	/*Get file pointers to beginning of the data (multiple instances of it): */
++	file_positions=this->SetFilePointersToData(&codes,NULL,&num_instances,data_enum);
++
++	if(num_instances){
++
++		/*Allocate vector :*/
++		vector=xNew<int>(num_instances);
++
++		for(int i=0;i<num_instances;i++){
++
++			if(my_rank==0){
++				code=codes[i];
++
++				if(code!=2)_error_("expecting an integer for enum " << EnumToStringx(data_enum));
++				
++				/*We have to read a integer from disk. First read the dimensions of the integer, then the integer: */
++				fsetpos(fid,file_positions+i);
++				if(my_rank==0){  
++					if(fread(&integer,sizeof(int),1,fid)!=1) _error_("could not read integer ");
++				}
++			}
++			ISSM_MPI_Bcast(&integer,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
++
++			/*Assign: */
++			vector[i]=integer;
++		}
++	}
++			
++	/*Free ressources:*/
++	xDelete<fpos_t>(file_positions);
++	xDelete<int>(codes);
++
++	/*Assign output pointers: */
++	*pvector=vector;
++	*pnum_instances=num_instances;
++}
++/*}}}*/
+ /*FUNCTION IoModel::FetchMultipleData(IssmDouble*** pmatrices,int** pmdims,int** pndims, int* pM,int data_enum){{{*/
+ void  IoModel::FetchMultipleData(IssmDouble*** pmatrices,int** pmdims,int** pndims, int* pnumrecords,int data_enum){
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16770-16771.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16770-16771.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16770-16771.diff	(revision 17802)
@@ -0,0 +1,27 @@
+Index: ../trunk-jpl/src/c/classes/IoModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 16770)
++++ ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 16771)
+@@ -1202,12 +1202,9 @@
+ 
+ 	/*output: */
+ 	int* vector=NULL;
+-	int num
+ 
+ 	/*intermediary: */
+-	int          M, N;
+-	IssmPDouble *pmatrix = NULL;
+-	IssmDouble  *matrix  = NULL;
++	int          integer;
+ 	int         *codes   = NULL;
+ 	int          code;
+ 
+@@ -1424,7 +1421,7 @@
+ 					/*this data has already been checked out! So cancel all that we've done here, and return 
+ 					 * the data[data_enum] directly: */
+ 					matrix=this->data[data_enum];
+-					for (int i=0;i<M*N;++i) integer_matrixmatrix[i]=reCast<int>(matrix[i]);
++					for (int i=0;i<M*N;++i) integer_matrix[i]=reCast<int>(matrix[i]);
+ 				}
+ 				else{
+ 					for (int i=0;i<M*N;++i) integer_matrix[i]=pmatrix[i];
Index: issm/oecreview/Archive/16554-17801/ISSM-16771-16772.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16771-16772.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16771-16772.diff	(revision 17802)
@@ -0,0 +1,25 @@
+Index: ../trunk-jpl/src/m/exp/expdisp.m
+===================================================================
+--- ../trunk-jpl/src/m/exp/expdisp.m	(revision 16771)
++++ ../trunk-jpl/src/m/exp/expdisp.m	(revision 16772)
+@@ -43,10 +43,15 @@
+ domain=expread(domainoutline);
+ 
+ figure(figurenumber),hold on
+-for i=1:length(domain),
+-	if (isnumeric(linestyle))
+-		plot(domain(i).x*unitmultiplier,domain(i).y*unitmultiplier,'Color',linestyle,'linewidth',linewidth);
++for i=1:length(domain),		
++	if domain(i).nods==1
++		plot(domain(i).x*unitmultiplier,domain(i).y*unitmultiplier,'ok','MarkerSize',10);
+ 	else
+-		plot(domain(i).x*unitmultiplier,domain(i).y*unitmultiplier,linestyle,'linewidth',linewidth);
+-	end
++		if (isnumeric(linestyle))
++			plot(domain(i).x*unitmultiplier,domain(i).y*unitmultiplier,'Color',linestyle,'linewidth',linewidth);
++		else
++			plot(domain(i).x*unitmultiplier,domain(i).y*unitmultiplier,linestyle,'linewidth',linewidth);
++	  end
++  end
+ end
++
Index: issm/oecreview/Archive/16554-17801/ISSM-16772-16773.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16772-16773.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16772-16773.diff	(revision 17802)
@@ -0,0 +1,439 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16772)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16773)
+@@ -23,6 +23,7 @@
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionFS(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionHO(IssmDouble* solution,Element* element);
++		void InputUpdateFromSolutionL1L2(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionSSA(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionSSAHO(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16772)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16773)
+@@ -942,9 +942,6 @@
+ 		case HOApproximationEnum: 
+ 			InputUpdateFromSolutionHO(solution,element);
+ 			return;
+-		case SIAApproximationEnum:
+-			InputUpdateFromSolutionHO(solution,element);
+-			return;
+ 		case L1L2ApproximationEnum:
+ 			InputUpdateFromSolutionSSA(solution,element);
+ 			return;
+@@ -960,12 +957,182 @@
+ 			_error_("Approximation "<<EnumToStringx(approximation)<<" not supported");
+ 	}
+ }/*}}}*/
+-void StressbalanceAnalysis::InputUpdateFromSolutionSSA(IssmDouble* solution,Element* element){/*{{{*/
++void StressbalanceAnalysis::InputUpdateFromSolutionFS(IssmDouble* solution,Element* element){/*{{{*/
+ 
++	int          i,dim,meshtype;
++	int*         vdoflist=NULL;
++	int*         pdoflist=NULL;
++	IssmDouble   FSreconditioning;
++
++	element->FindParam(&meshtype,MeshTypeEnum);
++	element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; break;
++		case Mesh3DEnum:         dim = 3; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int vnumnodes = element->GetNumberOfNodesVelocity();
++	int pnumnodes = element->GetNumberOfNodesPressure();
++	int vnumdof   = vnumnodes*dim;
++	int pnumdof   = pnumnodes*1;
++
++	/*Initialize values*/
++	IssmDouble* values   = xNew<IssmDouble>(vnumdof+pnumdof);
++	IssmDouble* vx       = xNew<IssmDouble>(vnumnodes);
++	IssmDouble* vy       = xNew<IssmDouble>(vnumnodes);
++	IssmDouble* vz       = xNew<IssmDouble>(vnumnodes);
++	IssmDouble* vel      = xNew<IssmDouble>(vnumnodes);
++	IssmDouble* pressure = xNew<IssmDouble>(pnumnodes);
++
++	/*Prepare coordinate system list*/
++	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
++	if(dim==2){
++		for(i=0;i<vnumnodes;i++) cs_list[i] = XYEnum;
++	}
++	else{
++		for(i=0;i<vnumnodes;i++) cs_list[i] = XYZEnum;
++	}
++	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
++
++	/*Get dof list: */
++	element->GetDofListVelocity(&vdoflist,GsetEnum);
++	element->GetDofListPressure(&pdoflist,GsetEnum);
++
++	/*Use the dof list to index into the solution vector: */
++	for(i=0;i<vnumdof;i++) values[i]        =solution[vdoflist[i]];
++	for(i=0;i<pnumdof;i++) values[vnumdof+i]=solution[pdoflist[i]];
++
++	/*Transform solution in Cartesian Space*/
++	element->TransformSolutionCoord(&values[0],&cs_list[0]);
++
++	/*Ok, we have vx and vy in values, fill in all arrays: */
++	for(i=0;i<vnumnodes;i++){
++		vx[i] = values[i*dim+0];
++		vy[i] = values[i*dim+1];
++		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
++		if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
++
++		if(dim==3){
++			vz[i] = values[i*dim+2];
++			if(xIsNan<IssmDouble>(vz[i])) _error_("NaN found in solution vector");
++		}
++	}
++	for(i=0;i<pnumnodes;i++){
++		pressure[i] = values[vnumdof+i];
++		if(xIsNan<IssmDouble>(pressure[i])) _error_("NaN found in solution vector");
++	}
++
++	/*Recondition pressure and compute vel: */
++	for(i=0;i<pnumnodes;i++) pressure[i] = pressure[i]*FSreconditioning;
++	if(dim==3) for(i=0;i<vnumnodes;i++) vel[i] = sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
++	else       for(i=0;i<vnumnodes;i++) vel[i] = sqrt(vx[i]*vx[i] + vy[i]*vy[i]);
++
++	/*Now, we have to move the previous inputs  to old 
++	 * status, otherwise, we'll wipe them off: */
++	element->InputChangeName(VxEnum,VxPicardEnum);
++	element->InputChangeName(VyEnum,VyPicardEnum);
++	element->InputChangeName(PressureEnum,PressurePicardEnum);
++	if(dim==3) element->InputChangeName(VzEnum,VzPicardEnum);
++
++	/*Add vx and vy as inputs to the tria element: */
++	element->AddInput(VxEnum,vx,P1Enum);
++	element->AddInput(VyEnum,vy,P1Enum);
++	element->AddInput(VelEnum,vel,P1Enum);
++	element->AddInput(PressureEnum,pressure,P1Enum);
++	if(dim==3) element->AddInput(VzEnum,vz,P1Enum);
++
++	/*Free ressources:*/
++	xDelete<IssmDouble>(pressure);
++	xDelete<IssmDouble>(vel);
++	xDelete<IssmDouble>(vz);
++	xDelete<IssmDouble>(vy);
++	xDelete<IssmDouble>(vx);
++	xDelete<IssmDouble>(values);
++	xDelete<int>(vdoflist);
++	xDelete<int>(pdoflist);
++	xDelete<int>(cs_list);
++}/*}}}*/
++void StressbalanceAnalysis::InputUpdateFromSolutionHO(IssmDouble* solution,Element* element){/*{{{*/
++
+ 	int         i,meshtype;
+ 	IssmDouble  rho_ice,g;
+ 	int*        doflist=NULL;
+ 	IssmDouble* xyz_list=NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++	int numdof   = numnodes*2;
++
++	/*Fetch dof list and allocate solution vectors*/
++	element->GetDofList(&doflist,HOApproximationEnum,GsetEnum);
++	IssmDouble* values    = xNew<IssmDouble>(numdof);
++	IssmDouble* vx        = xNew<IssmDouble>(numnodes);
++	IssmDouble* vy        = xNew<IssmDouble>(numnodes);
++	IssmDouble* vz        = xNew<IssmDouble>(numnodes);
++	IssmDouble* vel       = xNew<IssmDouble>(numnodes);
++	IssmDouble* pressure  = xNew<IssmDouble>(numnodes);
++	IssmDouble* surface   = xNew<IssmDouble>(numnodes);
++
++	/*Use the dof list to index into the solution vector: */
++	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
++
++	/*Transform solution in Cartesian Space*/
++	element->TransformSolutionCoord(&values[0],XYEnum);
++	element->FindParam(&meshtype,MeshTypeEnum);
++
++	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
++	for(i=0;i<numnodes;i++){
++		vx[i]=values[i*2+0];
++		vy[i]=values[i*2+1];
++
++		/*Check solution*/
++		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
++		if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
++	}
++
++	/*Get Vz and compute vel*/
++	element->GetInputListOnNodes(&vz[0],VzEnum,0.);
++	for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
++
++	/*For pressure: we have not computed pressure in this analysis, for this element. We are in 2D, 
++	 *so the pressure is just the pressure at the bedrock: */
++	rho_ice = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	g       = element->GetMaterialParameter(ConstantsGEnum);
++	element->GetVerticesCoordinates(&xyz_list);
++	element->GetInputListOnNodes(&surface[0],SurfaceEnum);
++	for(i=0;i<numnodes;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
++
++	/*Now, we have to move the previous Vx and Vy inputs  to old 
++	 * status, otherwise, we'll wipe them off: */
++	element->InputChangeName(VxEnum,VxPicardEnum);
++	element->InputChangeName(VyEnum,VyPicardEnum);
++	element->InputChangeName(PressureEnum,PressurePicardEnum);
++
++	/*Add vx and vy as inputs to the tria element: */
++	element->AddInput(VxEnum,vx,P1Enum);
++	element->AddInput(VyEnum,vy,P1Enum);
++	element->AddBasalInput(VelEnum,vel,P1Enum);
++	element->AddBasalInput(PressureEnum,pressure,P1Enum);
++
++	/*Free ressources:*/
++	xDelete<IssmDouble>(surface);
++	xDelete<IssmDouble>(pressure);
++	xDelete<IssmDouble>(vel);
++	xDelete<IssmDouble>(vz);
++	xDelete<IssmDouble>(vy);
++	xDelete<IssmDouble>(vx);
++	xDelete<IssmDouble>(values);
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<int>(doflist);
++}/*}}}*/
++void StressbalanceAnalysis::InputUpdateFromSolutionL1L2(IssmDouble* solution,Element* element){/*{{{*/
++
++	int         i,meshtype;
++	IssmDouble  rho_ice,g;
++	int*        doflist=NULL;
++	IssmDouble* xyz_list=NULL;
+ 	Element*    basalelement=NULL;
+ 
+ 	/*Deal with pressure first*/
+@@ -1059,33 +1226,70 @@
+ 	xDelete<int>(doflist);
+ 	if(meshtype!=Mesh2DhorizontalEnum) delete basalelement;
+ }/*}}}*/
+-void StressbalanceAnalysis::InputUpdateFromSolutionHO(IssmDouble* solution,Element* element){/*{{{*/
++void StressbalanceAnalysis::InputUpdateFromSolutionSSA(IssmDouble* solution,Element* element){/*{{{*/
+ 
+ 	int         i,meshtype;
+ 	IssmDouble  rho_ice,g;
+ 	int*        doflist=NULL;
+ 	IssmDouble* xyz_list=NULL;
++	Element*    basalelement=NULL;
+ 
++	/*Deal with pressure first*/
++	int numvertices = element->GetNumberOfVertices();
++	IssmDouble* pressure  = xNew<IssmDouble>(numvertices);
++	IssmDouble* thickness = xNew<IssmDouble>(numvertices);
++	IssmDouble* surface   = xNew<IssmDouble>(numvertices);
++
++	element->FindParam(&meshtype,MeshTypeEnum);
++	rho_ice =element->GetMaterialParameter(MaterialsRhoIceEnum);
++	g       =element->GetMaterialParameter(ConstantsGEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			element->GetInputListOnVertices(thickness,ThicknessEnum);
++			for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*thickness[i];
++			break;
++		case Mesh3DEnum:
++			element->GetVerticesCoordinates(&xyz_list);
++			element->GetInputListOnVertices(surface,SurfaceEnum);
++			for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++	element->AddInput(PressureEnum,pressure,P1Enum);
++	xDelete<IssmDouble>(pressure);
++	xDelete<IssmDouble>(thickness);
++	xDelete<IssmDouble>(surface);
++
++	/*Get basal element*/
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()){xDelete<IssmDouble>(xyz_list); return;}
++			basalelement=element->SpawnBasalElement();
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
+ 	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = element->GetNumberOfNodes();
++	int numnodes = basalelement->GetNumberOfNodes();
+ 	int numdof   = numnodes*2;
+ 
+ 	/*Fetch dof list and allocate solution vectors*/
+-	element->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
++	basalelement->GetDofList(&doflist,SSAApproximationEnum,GsetEnum);
+ 	IssmDouble* values    = xNew<IssmDouble>(numdof);
+ 	IssmDouble* vx        = xNew<IssmDouble>(numnodes);
+ 	IssmDouble* vy        = xNew<IssmDouble>(numnodes);
+ 	IssmDouble* vz        = xNew<IssmDouble>(numnodes);
+ 	IssmDouble* vel       = xNew<IssmDouble>(numnodes);
+-	IssmDouble* pressure  = xNew<IssmDouble>(numnodes);
+-	IssmDouble* surface   = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Use the dof list to index into the solution vector: */
+ 	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+ 
+ 	/*Transform solution in Cartesian Space*/
+-	element->TransformSolutionCoord(&values[0],XYEnum);
+-	element->FindParam(&meshtype,MeshTypeEnum);
++	basalelement->TransformSolutionCoord(&values[0],XYEnum);
++	basalelement->FindParam(&meshtype,MeshTypeEnum);
+ 
+ 	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+ 	for(i=0;i<numnodes;i++){
+@@ -1098,32 +1302,20 @@
+ 	}
+ 
+ 	/*Get Vz and compute vel*/
+-	element->GetInputListOnNodes(&vz[0],VzEnum,0.);
++	basalelement->GetInputListOnNodes(&vz[0],VzEnum,0.);
+ 	for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
+ 
+-	/*For pressure: we have not computed pressure in this analysis, for this element. We are in 2D, 
+-	 *so the pressure is just the pressure at the bedrock: */
+-	rho_ice = element->GetMaterialParameter(MaterialsRhoIceEnum);
+-	g       = element->GetMaterialParameter(ConstantsGEnum);
+-	element->GetVerticesCoordinates(&xyz_list);
+-	element->GetInputListOnNodes(&surface[0],SurfaceEnum);
+-	for(i=0;i<numnodes;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
+-
+ 	/*Now, we have to move the previous Vx and Vy inputs  to old 
+ 	 * status, otherwise, we'll wipe them off: */
+ 	element->InputChangeName(VxEnum,VxPicardEnum);
+ 	element->InputChangeName(VyEnum,VyPicardEnum);
+-	element->InputChangeName(PressureEnum,PressurePicardEnum);
+ 
+ 	/*Add vx and vy as inputs to the tria element: */
+-	element->AddInput(VxEnum,vx,P1Enum);
+-	element->AddInput(VyEnum,vy,P1Enum);
++	element->AddBasalInput(VxEnum,vx,P1Enum);
++	element->AddBasalInput(VyEnum,vy,P1Enum);
+ 	element->AddBasalInput(VelEnum,vel,P1Enum);
+-	element->AddBasalInput(PressureEnum,pressure,P1Enum);
+ 
+ 	/*Free ressources:*/
+-	xDelete<IssmDouble>(surface);
+-	xDelete<IssmDouble>(pressure);
+ 	xDelete<IssmDouble>(vel);
+ 	xDelete<IssmDouble>(vz);
+ 	xDelete<IssmDouble>(vy);
+@@ -1131,104 +1323,8 @@
+ 	xDelete<IssmDouble>(values);
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<int>(doflist);
++	if(meshtype!=Mesh2DhorizontalEnum) delete basalelement;
+ }/*}}}*/
+-void StressbalanceAnalysis::InputUpdateFromSolutionFS(IssmDouble* solution,Element* element){/*{{{*/
+-
+-	int          i,dim,meshtype;
+-	int*         vdoflist=NULL;
+-	int*         pdoflist=NULL;
+-	IssmDouble   FSreconditioning;
+-
+-	element->FindParam(&meshtype,MeshTypeEnum);
+-	element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+-	switch(meshtype){
+-		case Mesh2DverticalEnum: dim = 2; break;
+-		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+-	}
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = element->GetNumberOfNodesVelocity();
+-	int pnumnodes = element->GetNumberOfNodesPressure();
+-	int vnumdof   = vnumnodes*dim;
+-	int pnumdof   = pnumnodes*1;
+-
+-	/*Initialize values*/
+-	IssmDouble* values   = xNew<IssmDouble>(vnumdof+pnumdof);
+-	IssmDouble* vx       = xNew<IssmDouble>(vnumnodes);
+-	IssmDouble* vy       = xNew<IssmDouble>(vnumnodes);
+-	IssmDouble* vz       = xNew<IssmDouble>(vnumnodes);
+-	IssmDouble* vel      = xNew<IssmDouble>(vnumnodes);
+-	IssmDouble* pressure = xNew<IssmDouble>(pnumnodes);
+-
+-	/*Prepare coordinate system list*/
+-	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+-	if(dim==2){
+-		for(i=0;i<vnumnodes;i++) cs_list[i] = XYEnum;
+-	}
+-	else{
+-		for(i=0;i<vnumnodes;i++) cs_list[i] = XYZEnum;
+-	}
+-	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
+-
+-	/*Get dof list: */
+-	element->GetDofListVelocity(&vdoflist,GsetEnum);
+-	element->GetDofListPressure(&pdoflist,GsetEnum);
+-
+-	/*Use the dof list to index into the solution vector: */
+-	for(i=0;i<vnumdof;i++) values[i]        =solution[vdoflist[i]];
+-	for(i=0;i<pnumdof;i++) values[vnumdof+i]=solution[pdoflist[i]];
+-
+-	/*Transform solution in Cartesian Space*/
+-	element->TransformSolutionCoord(&values[0],&cs_list[0]);
+-
+-	/*Ok, we have vx and vy in values, fill in all arrays: */
+-	for(i=0;i<vnumnodes;i++){
+-		vx[i] = values[i*dim+0];
+-		vy[i] = values[i*dim+1];
+-		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
+-		if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
+-
+-		if(dim==3){
+-			vz[i] = values[i*dim+2];
+-			if(xIsNan<IssmDouble>(vz[i])) _error_("NaN found in solution vector");
+-		}
+-	}
+-	for(i=0;i<pnumnodes;i++){
+-		pressure[i] = values[vnumdof+i];
+-		if(xIsNan<IssmDouble>(pressure[i])) _error_("NaN found in solution vector");
+-	}
+-
+-	/*Recondition pressure and compute vel: */
+-	for(i=0;i<pnumnodes;i++) pressure[i] = pressure[i]*FSreconditioning;
+-	if(dim==3) for(i=0;i<vnumnodes;i++) vel[i] = sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
+-	else       for(i=0;i<vnumnodes;i++) vel[i] = sqrt(vx[i]*vx[i] + vy[i]*vy[i]);
+-
+-	/*Now, we have to move the previous inputs  to old 
+-	 * status, otherwise, we'll wipe them off: */
+-	element->InputChangeName(VxEnum,VxPicardEnum);
+-	element->InputChangeName(VyEnum,VyPicardEnum);
+-	element->InputChangeName(PressureEnum,PressurePicardEnum);
+-	if(dim==3) element->InputChangeName(VzEnum,VzPicardEnum);
+-
+-	/*Add vx and vy as inputs to the tria element: */
+-	element->AddInput(VxEnum,vx,P1Enum);
+-	element->AddInput(VyEnum,vy,P1Enum);
+-	element->AddInput(VelEnum,vel,P1Enum);
+-	element->AddInput(PressureEnum,pressure,P1Enum);
+-	if(dim==3) element->AddInput(VzEnum,vz,P1Enum);
+-
+-	/*Free ressources:*/
+-	xDelete<IssmDouble>(pressure);
+-	xDelete<IssmDouble>(vel);
+-	xDelete<IssmDouble>(vz);
+-	xDelete<IssmDouble>(vy);
+-	xDelete<IssmDouble>(vx);
+-	xDelete<IssmDouble>(values);
+-	xDelete<int>(vdoflist);
+-	xDelete<int>(pdoflist);
+-	xDelete<int>(cs_list);
+-}/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionSSAHO(IssmDouble* solution,Element* element){/*{{{*/
+ 
+ 	int         i,meshtype;
+@@ -1251,7 +1347,7 @@
+ 
+ 	/*Fetch dof list and allocate solution vectors*/
+ 	basalelement->GetDofList(&SSAdoflist,SSAApproximationEnum,GsetEnum);
+-	element->GetDofList(     &HOdoflist, HOApproximationEnum, GsetEnum);
++	element     ->GetDofList(&HOdoflist, HOApproximationEnum, GsetEnum);
+ 	IssmDouble* HOvalues  = xNew<IssmDouble>(numdof);
+ 	IssmDouble* SSAvalues = xNew<IssmDouble>(numdof);
+ 	IssmDouble* vx        = xNew<IssmDouble>(numnodes);
Index: issm/oecreview/Archive/16554-17801/ISSM-16773-16774.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16773-16774.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16773-16774.diff	(revision 17802)
@@ -0,0 +1,139 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16773)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16774)
+@@ -23,6 +23,7 @@
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionFS(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionHO(IssmDouble* solution,Element* element);
++		void InputUpdateFromSolutionHOFS(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionL1L2(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionSSA(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionSSAHO(IssmDouble* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16773)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16774)
+@@ -949,7 +949,8 @@
+ 			InputUpdateFromSolutionSSAHO(solution,element);
+ 			return;
+ 		case HOFSApproximationEnum:
+-			_error_("not implemented yet");
++			InputUpdateFromSolutionHOFS(solution,element);
++			return;
+ 		case SSAFSApproximationEnum:
+ 			_error_("not implemented yet");
+ 			return;
+@@ -1005,7 +1006,7 @@
+ 	for(i=0;i<pnumdof;i++) values[vnumdof+i]=solution[pdoflist[i]];
+ 
+ 	/*Transform solution in Cartesian Space*/
+-	element->TransformSolutionCoord(&values[0],&cs_list[0]);
++	element->TransformSolutionCoord(values,cs_list);
+ 
+ 	/*Ok, we have vx and vy in values, fill in all arrays: */
+ 	for(i=0;i<vnumnodes;i++){
+@@ -1127,6 +1128,103 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<int>(doflist);
+ }/*}}}*/
++void StressbalanceAnalysis::InputUpdateFromSolutionHOFS(IssmDouble* solution,Element* element){/*{{{*/
++
++	int         i;
++	IssmDouble  rho_ice,g,FSreconditioning;
++	int*        doflistHO  = NULL;
++	int*        doflistFSv = NULL;
++	int*        doflistFSp = NULL;
++
++	/*Only works with Penta for now*/
++	if(element->ObjectEnum()!=PentaEnum) _error_("Coupling not supported for "<<EnumToStringx(element->ObjectEnum()));
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes  = 6;
++	int numdofHO  = 6*2;
++	int numdofFSv = 6*3;
++	int numdofFSp = 6;
++
++	/*Fetch dof list and allocate solution vectors*/
++	element->GetDofList(&doflistFSv,FSvelocityEnum,GsetEnum);
++	element->GetDofList(&doflistHO, HOApproximationEnum, GsetEnum);
++	element->GetDofListPressure(&doflistFSp,GsetEnum);
++	IssmDouble* HOvalues  = xNew<IssmDouble>(numdofHO);
++	IssmDouble* FSvalues  = xNew<IssmDouble>(numdofFSv+numdofFSp);
++	IssmDouble* vx        = xNew<IssmDouble>(numnodes);
++	IssmDouble* vy        = xNew<IssmDouble>(numnodes);
++	IssmDouble* vz        = xNew<IssmDouble>(numnodes);
++	IssmDouble* vzHO      = xNew<IssmDouble>(numnodes);
++	IssmDouble* vzFS      = xNew<IssmDouble>(numnodes);
++	IssmDouble* vel       = xNew<IssmDouble>(numnodes);
++	IssmDouble* pressure  = xNew<IssmDouble>(numnodes);
++
++	/*Prepare coordinate system list*/
++	int* cs_list = xNew<int>(2*numnodes);
++	for(i=0;i<numnodes;i++) cs_list[i]          = XYZEnum;
++	for(i=0;i<numnodes;i++) cs_list[numnodes+i] = PressureEnum;
++
++	/*Use the dof list to index into the solution vector: */
++	element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
++	for(i=0;i<numdofHO ;i++) HOvalues[i]=solution[doflistHO[i]];
++	for(i=0;i<numdofFSv;i++) FSvalues[i]=solution[doflistFSv[i]];
++	for(i=0;i<numdofFSp;i++) FSvalues[numdofFSv+i]=solution[doflistFSp[i]];
++
++	/*Transform solution in Cartesian Space*/
++	element->TransformSolutionCoord(FSvalues,cs_list);
++	element->TransformSolutionCoord(HOvalues,XYEnum);
++
++	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
++	for(i=0;i<numnodes;i++){
++		vx[i]       = FSvalues[i*3+0]+HOvalues[i*2+0];
++		vy[i]       = FSvalues[i*3+1]+HOvalues[i*2+1];
++		vzFS[i]     = FSvalues[i*3+2];
++		pressure[i] = FSvalues[numnodes*3+i]*FSreconditioning;
++
++		/*Check solution*/
++		if(xIsNan<IssmDouble>(vx[i]))       _error_("NaN found in solution vector");
++		if(xIsNan<IssmDouble>(vy[i]))       _error_("NaN found in solution vector");
++		if(xIsNan<IssmDouble>(vzFS[i]))     _error_("NaN found in solution vector");
++		if(xIsNan<IssmDouble>(pressure[i])) _error_("NaN found in solution vector");
++	}
++
++	/*Get Vz and compute vel*/
++	element->GetInputListOnVertices(vzHO,VzHOEnum);
++	for(i=0;i<numnodes;i++){
++		vz[i] = vzHO[i]+vzFS[i];
++		vel[i]= sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
++	}
++
++	/*Now, we have to move the previous Vx and Vy inputs  to old 
++	 * status, otherwise, we'll wipe them off: */
++	element->InputChangeName(VxEnum,VxPicardEnum);
++	element->InputChangeName(VyEnum,VyPicardEnum);
++	element->InputChangeName(VzEnum,VzPicardEnum);
++	element->InputChangeName(PressureEnum,PressurePicardEnum);
++
++	/*Add vx and vy as inputs to element: */
++	element->AddInput(VxEnum,vx,P1Enum);
++	element->AddInput(VyEnum,vy,P1Enum);
++	element->AddInput(VzEnum,vz,P1Enum);
++	element->AddInput(VzFSEnum,vzFS,P1Enum);
++	element->AddInput(VelEnum,vel,P1Enum);
++	element->AddInput(PressureEnum,pressure,P1Enum);
++
++	/*Free ressources:*/
++	xDelete<IssmDouble>(pressure);
++	xDelete<IssmDouble>(vel);
++	xDelete<IssmDouble>(vz);
++	xDelete<IssmDouble>(vzHO);
++	xDelete<IssmDouble>(vzFS);
++	xDelete<IssmDouble>(vy);
++	xDelete<IssmDouble>(vx);
++	xDelete<IssmDouble>(FSvalues);
++	xDelete<IssmDouble>(HOvalues);
++	xDelete<int>(doflistFSp);
++	xDelete<int>(doflistFSv);
++	xDelete<int>(doflistHO);
++	xDelete<int>(cs_list);
++}/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionL1L2(IssmDouble* solution,Element* element){/*{{{*/
+ 
+ 	int         i,meshtype;
Index: issm/oecreview/Archive/16554-17801/ISSM-16774-16775.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16774-16775.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16774-16775.diff	(revision 17802)
@@ -0,0 +1,117 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16774)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16775)
+@@ -1171,8 +1171,8 @@
+ 	for(i=0;i<numdofFSp;i++) FSvalues[numdofFSv+i]=solution[doflistFSp[i]];
+ 
+ 	/*Transform solution in Cartesian Space*/
+-	element->TransformSolutionCoord(FSvalues,cs_list);
+-	element->TransformSolutionCoord(HOvalues,XYEnum);
++	element->TransformSolutionCoord(FSvalues,2*numnodes,cs_list);
++	element->TransformSolutionCoord(HOvalues,numnodes,XYEnum);
+ 
+ 	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+ 	for(i=0;i<numnodes;i++){
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16774)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16775)
+@@ -52,6 +52,8 @@
+ 		virtual IssmDouble GetMaterialParameter(int enum_in)=0;
+ 		virtual void   TransformSolutionCoord(IssmDouble* values,int transformenum)=0;
+ 		virtual void   TransformSolutionCoord(IssmDouble* values,int* transformenum_list)=0;
++		virtual void   TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum)=0;
++		virtual void   TransformSolutionCoord(IssmDouble* values,int numnodes,int* transformenum_list)=0;
+ 		virtual Element* GetBasalElement(void)=0;
+ 		virtual void	GetDofList(int** pdoflist,int approximation_enum,int setenum)=0;
+ 		virtual void	GetDofListVelocity(int** pdoflist,int setenum)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16774)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16775)
+@@ -272,6 +272,8 @@
+ 		void	         SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]);
+ 		void           TransformSolutionCoord(IssmDouble* values,int transformenum);
+ 		void           TransformSolutionCoord(IssmDouble* values,int* transformenum_list);
++		void           TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum){_error_("not implemented yet");};
++		void           TransformSolutionCoord(IssmDouble* values,int numnodes,int* transformenum_list){_error_("not implemented yet");};
+ 		#ifdef _HAVE_STRESSBALANCE_
+ 		ElementMatrix* CreateKMatrixStressbalanceSSA(void);
+ 		ElementMatrix* CreateKMatrixStressbalanceSSAViscous(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16774)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16775)
+@@ -2015,8 +2015,6 @@
+ 			else if (original_input->ObjectEnum()==DoubleInputEnum)
+ 			 total_integrated_input=new DoubleInput(average_enum_type,0.0);
+ 			else{
+-				printf("id %i \n",this->id);
+-				printf("enum %i \n",average_enum_type);
+ 			 _error_("object " << EnumToStringx(original_input->ObjectEnum()) << " not supported yet");
+ 			}
+ 		}
+@@ -3328,20 +3326,34 @@
+ 
+ 	return dt;
+ }/*}}}*/
+-/*FUNCTION Penta::TransformSolutionCoord{{{*/
++/*FUNCTION Penta::TransformSolutionCoord(IssmDouble* values,int transformenum){{{*/
+ void Penta::TransformSolutionCoord(IssmDouble* values,int transformenum){
+ 
+ 	::TransformSolutionCoord(values,this->nodes,this->NumberofNodes(),transformenum);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::TransformSolutionCoord{{{*/
++/*FUNCTION Penta::TransformSolutionCoord(IssmDouble* values,int* transformenum_list){{{*/
+ void Penta::TransformSolutionCoord(IssmDouble* values,int* transformenum_list){
+ 
+ 	::TransformSolutionCoord(values,this->nodes,this->NumberofNodes(),transformenum_list);
+ 
+ }
+ /*}}}*/
++/*FUNCTION Penta::TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum){{{*/
++void Penta::TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum){
++
++	::TransformSolutionCoord(values,this->nodes,numnodes,transformenum);
++
++}
++/*}}}*/
++/*FUNCTION Penta::TransformSolutionCoord(IssmDouble* values,int numnodes,int* transformenum_list){{{*/
++void Penta::TransformSolutionCoord(IssmDouble* values,int numnodes,int* transformenum_list){
++
++	::TransformSolutionCoord(values,this->nodes,numnodes,transformenum_list);
++
++}
++/*}}}*/
+ /*FUNCTION Penta::Update {{{*/
+ void Penta::Update(int index,IoModel* iomodel,int analysis_counter,int analysis_type,int finiteelement_type){ 
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16774)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16775)
+@@ -248,6 +248,8 @@
+ 		void	         SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]);
+ 		void           TransformSolutionCoord(IssmDouble* values,int transformenum);
+ 		void           TransformSolutionCoord(IssmDouble* values,int* transformenum_list);
++		void           TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum);      /*Tiling only*/
++		void           TransformSolutionCoord(IssmDouble* values,int numnodes,int* transformenum_list);/*Tiling only*/
+ 
+ 		#ifdef _HAVE_STRESSBALANCE_
+ 		ElementMatrix* CreateKMatrixCouplingSSAHO(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16774)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16775)
+@@ -153,6 +153,8 @@
+ 		IssmDouble  TimeAdapt(){_error_("not implemented yet");};
+ 		void        TransformSolutionCoord(IssmDouble* values,int transformenum){_error_("not implemented yet");};
+ 		void        TransformSolutionCoord(IssmDouble* values,int* transformenum_list){_error_("not implemented yet");};
++		void        TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum){_error_("not implemented yet");};
++		void        TransformSolutionCoord(IssmDouble* values,int numnodes,int* transformenum_list){_error_("not implemented yet");};
+ 		void UpdateConstraintsExtrudeFromBase(){_error_("not implemented");};
+ 		void UpdateConstraintsExtrudeFromTop(){_error_("not implemented");};
+ 		void UpdateConstraintsL2ProjectionEPL(){_error_("not implemented");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16775-16776.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16775-16776.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16775-16776.diff	(revision 17802)
@@ -0,0 +1,138 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16775)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16776)
+@@ -26,6 +26,7 @@
+ 		void InputUpdateFromSolutionHOFS(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionL1L2(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionSSA(IssmDouble* solution,Element* element);
++		void InputUpdateFromSolutionSSAFS(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionSSAHO(IssmDouble* solution,Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16775)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16776)
+@@ -952,7 +952,7 @@
+ 			InputUpdateFromSolutionHOFS(solution,element);
+ 			return;
+ 		case SSAFSApproximationEnum:
+-			_error_("not implemented yet");
++			InputUpdateFromSolutionSSAFS(solution,element);
+ 			return;
+ 		default:
+ 			_error_("Approximation "<<EnumToStringx(approximation)<<" not supported");
+@@ -1423,6 +1423,112 @@
+ 	xDelete<int>(doflist);
+ 	if(meshtype!=Mesh2DhorizontalEnum) delete basalelement;
+ }/*}}}*/
++void StressbalanceAnalysis::InputUpdateFromSolutionSSAFS(IssmDouble* solution,Element* element){/*{{{*/
++
++	int         i;
++	IssmDouble  rho_ice,g,FSreconditioning;
++	int*        doflistSSA  = NULL;
++	int*        doflistFSv = NULL;
++	int*        doflistFSp = NULL;
++
++	/*we have to add results of this element for FS and results from the element
++	 * at base for SSA, so we need to have the pointer toward the basal element*/
++	Element* basalelement=element->GetBasalElement();
++	if(basalelement->ObjectEnum()!=PentaEnum){
++		_error_("Coupling not supported for "<<EnumToStringx(basalelement->ObjectEnum()));
++	}
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes  = 6;
++	int numdof2d  = numnodes;
++	int numdofSSA = 6*2;
++	int numdofFSv = 6*3;
++	int numdofFSp = 6;
++
++	/*Fetch dof list and allocate solution vectors*/
++	element->GetDofList(&doflistFSv,FSvelocityEnum,GsetEnum);
++	element->GetDofListPressure(&doflistFSp,GsetEnum);
++	basalelement->GetDofList(&doflistSSA, SSAApproximationEnum, GsetEnum);
++	IssmDouble* SSAvalues  = xNew<IssmDouble>(numdofSSA);
++	IssmDouble* FSvalues  = xNew<IssmDouble>(numdofFSv+numdofFSp);
++	IssmDouble* vx        = xNew<IssmDouble>(numnodes);
++	IssmDouble* vy        = xNew<IssmDouble>(numnodes);
++	IssmDouble* vz        = xNew<IssmDouble>(numnodes);
++	IssmDouble* vzSSA      = xNew<IssmDouble>(numnodes);
++	IssmDouble* vzFS      = xNew<IssmDouble>(numnodes);
++	IssmDouble* vel       = xNew<IssmDouble>(numnodes);
++	IssmDouble* pressure  = xNew<IssmDouble>(numnodes);
++
++	/*Prepare coordinate system list*/
++	int* cs_list = xNew<int>(2*numnodes);
++	for(i=0;i<numnodes;i++) cs_list[i]          = XYZEnum;
++	for(i=0;i<numnodes;i++) cs_list[numnodes+i] = PressureEnum;
++
++	/*Use the dof list to index into the solution vector: */
++	element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
++	for(i=0;i<numdof2d;i++){
++		SSAvalues[i]          = solution[doflistSSA[i]];
++		SSAvalues[i+numdof2d] = solution[doflistSSA[i]];
++	}
++	for(i=0;i<numdofFSv;i++) FSvalues[i]=solution[doflistFSv[i]];
++	for(i=0;i<numdofFSp;i++) FSvalues[numdofFSv+i]=solution[doflistFSp[i]];
++
++	/*Transform solution in Cartesian Space*/
++	element->TransformSolutionCoord(FSvalues,2*numnodes,cs_list);
++	element->TransformSolutionCoord(SSAvalues,numnodes,XYEnum);
++
++	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
++
++	for(i=0;i<numnodes;i++){
++		vx[i]       = FSvalues[i*3+0]+SSAvalues[i*2+0];
++		vy[i]       = FSvalues[i*3+1]+SSAvalues[i*2+1];
++		vzFS[i]     = FSvalues[i*3+2];
++		pressure[i] = FSvalues[numnodes*3+i]*FSreconditioning;
++
++		/*Check solution*/
++		if(xIsNan<IssmDouble>(vx[i]))       _error_("NaN found in solution vector");
++		if(xIsNan<IssmDouble>(vy[i]))       _error_("NaN found in solution vector");
++		if(xIsNan<IssmDouble>(vzFS[i]))     _error_("NaN found in solution vector");
++		if(xIsNan<IssmDouble>(pressure[i])) _error_("NaN found in solution vector");
++	}
++
++	/*Get Vz and compute vel*/
++	element->GetInputListOnVertices(vzSSA,VzSSAEnum);
++	for(i=0;i<numnodes;i++){
++		vz[i] = vzSSA[i]+vzFS[i];
++		vel[i]= sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
++	}
++
++	/*Now, we have to move the previous Vx and Vy inputs  to old 
++	 * status, otherwise, we'll wipe them off: */
++	element->InputChangeName(VxEnum,VxPicardEnum);
++	element->InputChangeName(VyEnum,VyPicardEnum);
++	element->InputChangeName(VzEnum,VzPicardEnum);
++	element->InputChangeName(PressureEnum,PressurePicardEnum);
++
++	/*Add vx and vy as inputs to element: */
++	element->AddInput(VxEnum,vx,P1Enum);
++	element->AddInput(VyEnum,vy,P1Enum);
++	element->AddInput(VzEnum,vz,P1Enum);
++	element->AddInput(VzFSEnum,vzFS,P1Enum);
++	element->AddInput(VelEnum,vel,P1Enum);
++	element->AddInput(PressureEnum,pressure,P1Enum);
++
++	/*Free ressources:*/
++	xDelete<IssmDouble>(pressure);
++	xDelete<IssmDouble>(vel);
++	xDelete<IssmDouble>(vz);
++	xDelete<IssmDouble>(vzSSA);
++	xDelete<IssmDouble>(vzFS);
++	xDelete<IssmDouble>(vy);
++	xDelete<IssmDouble>(vx);
++	xDelete<IssmDouble>(FSvalues);
++	xDelete<IssmDouble>(SSAvalues);
++	xDelete<int>(doflistFSp);
++	xDelete<int>(doflistFSv);
++	xDelete<int>(doflistSSA);
++	xDelete<int>(cs_list);
++}/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionSSAHO(IssmDouble* solution,Element* element){/*{{{*/
+ 
+ 	int         i,meshtype;
Index: issm/oecreview/Archive/16554-17801/ISSM-16776-16777.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16776-16777.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16776-16777.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16776)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16777)
+@@ -936,6 +936,8 @@
+ 		case FSApproximationEnum: case NoneApproximationEnum:
+ 			InputUpdateFromSolutionFS(solution,element);
+ 			return;
++		case SIAApproximationEnum: 
++			return;
+ 		case SSAApproximationEnum: 
+ 			InputUpdateFromSolutionSSA(solution,element);
+ 			return;
Index: issm/oecreview/Archive/16554-17801/ISSM-16777-16778.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16777-16778.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16777-16778.diff	(revision 17802)
@@ -0,0 +1,108 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16777)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16778)
+@@ -1324,7 +1324,7 @@
+ 	xDelete<IssmDouble>(values);
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<int>(doflist);
+-	if(meshtype!=Mesh2DhorizontalEnum) delete basalelement;
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ }/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionSSA(IssmDouble* solution,Element* element){/*{{{*/
+ 
+@@ -1423,7 +1423,7 @@
+ 	xDelete<IssmDouble>(values);
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<int>(doflist);
+-	if(meshtype!=Mesh2DhorizontalEnum) delete basalelement;
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ }/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionSSAFS(IssmDouble* solution,Element* element){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16777)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16778)
+@@ -195,5 +195,5 @@
+ 	xDelete<IssmDouble>(values);
+ 	xDelete<IssmDouble>(residual);
+ 	xDelete<int>(doflist);
+-	if(meshtype!=Mesh2DhorizontalEnum) delete basalelement;
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16777)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16778)
+@@ -296,5 +296,5 @@
+ 	xDelete<IssmDouble>(oldsurface);
+ 	xDelete<IssmDouble>(phi);
+ 	xDelete<int>(doflist);
+-	if(meshtype!=Mesh2DhorizontalEnum) delete basalelement;
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16777)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16778)
+@@ -45,6 +45,7 @@
+ 		virtual void   CreateDVector(Vector<IssmDouble>* df)=0;
+ 		virtual void   CreatePVector(Vector<IssmDouble>* pf)=0;
+ 		virtual void   CreateJacobianMatrix(Matrix<IssmDouble>* Jff)=0;
++		virtual void   DeleteMaterials(void)=0;
+ 		virtual void   EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure)=0;
+ 		virtual void   FindParam(int* pvalue,int paramenum)=0;
+ 		virtual void   FindParam(IssmDouble* pvalue,int paramenum)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16777)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16778)
+@@ -805,6 +805,11 @@
+ 	return;
+ }
+ /*}}}*/
++/*FUNCTION Tria::DeleteMaterials{{{*/
++void Tria::DeleteMaterials(void){
++	delete this->material;
++}
++/*}}}*/
+ /*FUNCTION Tria::Delta18oParameterization{{{*/
+ void  Tria::Delta18oParameterization(void){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16777)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16778)
+@@ -77,6 +77,7 @@
+ 		void        CreateDVector(Vector<IssmDouble>* df);
+ 		void        CreatePVector(Vector<IssmDouble>* pf);
+ 		void        CreateJacobianMatrix(Matrix<IssmDouble>* Jff);
++		void        DeleteMaterials(void);
+ 		void        Delta18oParameterization(void);
+ 		void        EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented yet");};
+ 		void        FindParam(int* pvalue,int paramenum);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16777)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16778)
+@@ -73,6 +73,7 @@
+ 		void   ComputeStrainRate(Vector<IssmDouble>* eps);
+ 		void   ComputeStressTensor();
+ 		void   Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
++		void   DeleteMaterials(void){_error_("not implemented yet");};
+ 		void   FindParam(int* pvalue,int paramenum);
+ 		void   FindParam(IssmDouble* pvalue,int paramenum);
+ 		int    FiniteElement(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16777)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16778)
+@@ -74,6 +74,7 @@
+ 		void        ComputeStrainRate(Vector<IssmDouble>* eps){_error_("not implemented yet");};
+ 		void        ComputeStressTensor(){_error_("not implemented yet");};
+ 		void        Configure(Elements* elements,Loads* loads,Nodes* nodesin,Vertices* verticesin,Materials* materials,Parameters* parameters){_error_("not implemented yet");};
++		void        DeleteMaterials(void){_error_("not implemented yet");};
+ 		void        SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters){_error_("not implemented yet");};
+ 		void        SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum){_error_("not implemented yet");};
+ 		void        CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16778-16779.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16778-16779.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16778-16779.diff	(revision 17802)
@@ -0,0 +1,37 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 16778)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 16779)
+@@ -109,6 +109,15 @@
+ 	IssmDouble*  xyz_list = NULL;
+ 	IssmDouble   rho_ice,g;
+ 
++	/*Get the approximation and do nothing if the element in FS or None*/
++	element->GetInputValue(&approximation,ApproximationEnum);
++	if(approximation==FSApproximationEnum || approximation==NoneApproximationEnum){
++		return;
++	}
++
++	/*Get dof list and vertices coordinates: */
++	element->GetVerticesCoordinates(&xyz_list);
++	element->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+ 	IssmDouble*  values    = xNew<IssmDouble>(numdof);
+ 	IssmDouble*  vx        = xNew<IssmDouble>(numnodes);
+ 	IssmDouble*  vy        = xNew<IssmDouble>(numnodes);
+@@ -120,16 +129,6 @@
+ 	IssmDouble*  pressure  = xNew<IssmDouble>(numnodes);
+ 	IssmDouble*  surface   = xNew<IssmDouble>(numnodes);
+ 
+-	/*Get the approximation and do nothing if the element in FS or None*/
+-	element->GetInputValue(&approximation,ApproximationEnum);
+-	if(approximation==FSApproximationEnum || approximation==NoneApproximationEnum){
+-		return;
+-	}
+-
+-	/*Get dof list and vertices coordinates: */
+-	element->GetVerticesCoordinates(&xyz_list);
+-	element->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+-
+ 	/*Use the dof list to index into the solution vector vz: */
+ 	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+ 	for(i=0;i<numdof;i++){
Index: issm/oecreview/Archive/16554-17801/ISSM-16779-16780.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16779-16780.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16779-16780.diff	(revision 17802)
@@ -0,0 +1,73 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16779)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16780)
+@@ -1059,11 +1059,23 @@
+ }/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionHO(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	int         i,meshtype;
+-	IssmDouble  rho_ice,g;
++	int         i;
+ 	int*        doflist=NULL;
+ 	IssmDouble* xyz_list=NULL;
+ 
++	/*Deal with pressure first*/
++	int numvertices = element->GetNumberOfVertices();
++	IssmDouble* pressure  = xNew<IssmDouble>(numvertices);
++	IssmDouble* surface   = xNew<IssmDouble>(numvertices);
++	IssmDouble  rho_ice   = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	IssmDouble  g         = element->GetMaterialParameter(ConstantsGEnum);
++	element->GetVerticesCoordinates(&xyz_list);
++	element->GetInputListOnVertices(surface,SurfaceEnum);
++	for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
++	element->AddInput(PressureEnum,pressure,P1Enum);
++	xDelete<IssmDouble>(pressure);
++	xDelete<IssmDouble>(surface);
++
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+ 	int numdof   = numnodes*2;
+@@ -1075,15 +1087,12 @@
+ 	IssmDouble* vy        = xNew<IssmDouble>(numnodes);
+ 	IssmDouble* vz        = xNew<IssmDouble>(numnodes);
+ 	IssmDouble* vel       = xNew<IssmDouble>(numnodes);
+-	IssmDouble* pressure  = xNew<IssmDouble>(numnodes);
+-	IssmDouble* surface   = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Use the dof list to index into the solution vector: */
+ 	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+ 
+ 	/*Transform solution in Cartesian Space*/
+ 	element->TransformSolutionCoord(&values[0],XYEnum);
+-	element->FindParam(&meshtype,MeshTypeEnum);
+ 
+ 	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+ 	for(i=0;i<numnodes;i++){
+@@ -1099,14 +1108,6 @@
+ 	element->GetInputListOnNodes(&vz[0],VzEnum,0.);
+ 	for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
+ 
+-	/*For pressure: we have not computed pressure in this analysis, for this element. We are in 2D, 
+-	 *so the pressure is just the pressure at the bedrock: */
+-	rho_ice = element->GetMaterialParameter(MaterialsRhoIceEnum);
+-	g       = element->GetMaterialParameter(ConstantsGEnum);
+-	element->GetVerticesCoordinates(&xyz_list);
+-	element->GetInputListOnNodes(&surface[0],SurfaceEnum);
+-	for(i=0;i<numnodes;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
+-
+ 	/*Now, we have to move the previous Vx and Vy inputs  to old 
+ 	 * status, otherwise, we'll wipe them off: */
+ 	element->InputChangeName(VxEnum,VxPicardEnum);
+@@ -1117,11 +1118,8 @@
+ 	element->AddInput(VxEnum,vx,P1Enum);
+ 	element->AddInput(VyEnum,vy,P1Enum);
+ 	element->AddBasalInput(VelEnum,vel,P1Enum);
+-	element->AddBasalInput(PressureEnum,pressure,P1Enum);
+ 
+ 	/*Free ressources:*/
+-	xDelete<IssmDouble>(surface);
+-	xDelete<IssmDouble>(pressure);
+ 	xDelete<IssmDouble>(vel);
+ 	xDelete<IssmDouble>(vz);
+ 	xDelete<IssmDouble>(vy);
Index: issm/oecreview/Archive/16554-17801/ISSM-16780-16781.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16780-16781.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16780-16781.diff	(revision 17802)
@@ -0,0 +1,11 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 16780)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 16781)
+@@ -247,5 +247,6 @@
+ 	xDelete<IssmDouble>(vy);
+ 	xDelete<IssmDouble>(vx);
+ 	xDelete<IssmDouble>(values);
++	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<int>(doflist);
+ }/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16781-16782.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16781-16782.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16781-16782.diff	(revision 17802)
@@ -0,0 +1,1119 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h	(revision 16782)
+@@ -11,12 +11,17 @@
+ class StressbalanceSIAAnalysis: public Analysis{
+ 
+ 	public:
++		/*Model processing*/
+ 		int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 16782)
+@@ -80,7 +80,13 @@
+ 	/*No loads*/
+ }/*}}}*/
+ 
+-/*Numerics*/
++/*Finite Element Analysis*/
++ElementMatrix* HydrologyShreveAnalysis::CreateKMatrix(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* HydrologyShreveAnalysis::CreatePVector(Element* element){/*{{{*/
++_error_("not implemented yet");
++}/*}}}*/
+ void HydrologyShreveAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,WatercolumnEnum);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp	(revision 16782)
+@@ -24,7 +24,13 @@
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+ 
+-/*Numerics*/
++/*Finite Element Analysis*/
++ElementMatrix* BalancethicknessSoftAnalysis::CreateKMatrix(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* BalancethicknessSoftAnalysis::CreatePVector(Element* element){/*{{{*/
++_error_("not implemented yet");
++}/*}}}*/
+ void BalancethicknessSoftAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16782)
+@@ -11,12 +11,17 @@
+ class StressbalanceAnalysis: public Analysis{
+ 
+ 	public:
++		/*Model processing*/
+ 		int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void GetSolutionFromInputsFS(Vector<IssmDouble>* solution,Element* element);
+ 		void GetSolutionFromInputsHoriz(Vector<IssmDouble>* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 16782)
+@@ -11,12 +11,17 @@
+ class HydrologyDCInefficientAnalysis: public Analysis{
+ 
+ 	public:
++		/*Model processing*/
+ 		int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 16782)
+@@ -112,7 +112,13 @@
+ 	}
+ }/*}}}*/
+ 
+-/*Numerics*/
++/*Finite Element Analysis*/
++ElementMatrix* BalancethicknessAnalysis::CreateKMatrix(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* BalancethicknessAnalysis::CreatePVector(Element* element){/*{{{*/
++_error_("not implemented yet");
++}/*}}}*/
+ void BalancethicknessAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.h	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.h	(revision 16782)
+@@ -11,12 +11,17 @@
+ class ThermalAnalysis: public Analysis{
+ 
+ 	public:
++		/*Model processing*/
+ 		int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 16782)
+@@ -94,7 +94,13 @@
+ 	/*Nothing for now*/
+ }/*}}}*/
+ 
+-/*Numerics*/
++/*Finite Element Analysis*/
++ElementMatrix* HydrologyDCEfficientAnalysis::CreateKMatrix(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* HydrologyDCEfficientAnalysis::CreatePVector(Element* element){/*{{{*/
++_error_("not implemented yet");
++}/*}}}*/
+ void HydrologyDCEfficientAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,EplHeadEnum);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h	(revision 16782)
+@@ -11,12 +11,17 @@
+ class ExtrudeFromBaseAnalysis: public Analysis{
+ 
+ 	public:
++		/*Model processing*/
+ 		int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 16782)
+@@ -24,7 +24,13 @@
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+ 
+-/*Numerics*/
++/*Finite Element Analysis*/
++ElementMatrix* AdjointHorizAnalysis::CreateKMatrix(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* AdjointHorizAnalysis::CreatePVector(Element* element){/*{{{*/
++_error_("not implemented yet");
++}/*}}}*/
+ void AdjointHorizAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 16782)
+@@ -57,7 +57,13 @@
+ 	/*No loads*/
+ }/*}}}*/
+ 
+-/*Numerics*/
++/*Finite Element Analysis*/
++ElementMatrix* BalancevelocityAnalysis::CreateKMatrix(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* BalancevelocityAnalysis::CreatePVector(Element* element){/*{{{*/
++_error_("not implemented yet");
++}/*}}}*/
+ void BalancevelocityAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/MeltingAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeltingAnalysis.h	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/MeltingAnalysis.h	(revision 16782)
+@@ -11,12 +11,17 @@
+ class MeltingAnalysis: public Analysis{
+ 
+ 	public:
++		/*Model processing*/
+ 		int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/GiaAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/GiaAnalysis.h	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/GiaAnalysis.h	(revision 16782)
+@@ -11,12 +11,17 @@
+ class GiaAnalysis: public Analysis{
+ 
+ 	public:
++		/*Model processing*/
+ 		int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 16782)
+@@ -53,7 +53,13 @@
+ 	/*No loads*/
+ }/*}}}*/
+ 
+-/*Numerics*/
++/*Finite Element Analysis*/
++ElementMatrix* L2ProjectionBaseAnalysis::CreateKMatrix(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* L2ProjectionBaseAnalysis::CreatePVector(Element* element){/*{{{*/
++_error_("not implemented yet");
++}/*}}}*/
+ void L2ProjectionBaseAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 16782)
+@@ -86,7 +86,13 @@
+ 	iomodel->DeleteData(nodeonsurface,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+ 
+-/*Numerics*/
++/*Finite Element Analysis*/
++ElementMatrix* FreeSurfaceTopAnalysis::CreateKMatrix(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* FreeSurfaceTopAnalysis::CreatePVector(Element* element){/*{{{*/
++_error_("not implemented yet");
++}/*}}}*/
+ void FreeSurfaceTopAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h	(revision 16782)
+@@ -11,12 +11,17 @@
+ class AdjointBalancethicknessAnalysis: public Analysis{
+ 
+ 	public:
++		/*Model processing*/
+ 		int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h	(revision 16782)
+@@ -11,12 +11,17 @@
+ class L2ProjectionEPLAnalysis: public Analysis{
+ 
+ 	public:
++		/*Model processing*/
+ 		int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 16782)
+@@ -94,7 +94,13 @@
+ 
+ }/*}}}*/
+ 
+-/*Numerics*/
++/*Finite Element Analysis*/
++ElementMatrix* StressbalanceVerticalAnalysis::CreateKMatrix(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* StressbalanceVerticalAnalysis::CreatePVector(Element* element){/*{{{*/
++_error_("not implemented yet");
++}/*}}}*/
+ void StressbalanceVerticalAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,VzEnum);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/Analysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/Analysis.h	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/Analysis.h	(revision 16782)
+@@ -13,12 +13,16 @@
+ class Constraints;
+ class Loads;
+ class Element;
++class ElementVector;
++class ElementMatrix;
+ 
+ class Analysis{
+ 
+ 	public: 
++		/*Constructor/Destructor*/
++		virtual      ~Analysis(){};
+ 
+-		virtual      ~Analysis(){};
++		/*Model processing*/
+ 		virtual int  DofsPerNode(int** doflist,int meshtype,int approximation)=0;
+ 		virtual void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum)=0;
+ 		virtual void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type)=0;
+@@ -26,6 +30,9 @@
+ 		virtual void CreateConstraints(Constraints* constraints,IoModel* iomodel)=0;
+ 		virtual void CreateLoads(Loads* loads, IoModel* iomodel)=0;
+ 
++		/*Finite element Analysis*/
++		virtual ElementMatrix* CreateKMatrix(Element* element)=0;
++		virtual ElementVector* CreatePVector(Element* element)=0;
+ 		virtual void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element)=0;
+ 		virtual void InputUpdateFromSolution(IssmDouble* solution,Element* element)=0;
+ };
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h	(revision 16782)
+@@ -11,12 +11,17 @@
+ class MasstransportAnalysis: public Analysis{
+ 
+ 	public:
++		/*Model processing*/
+ 		int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 16782)
+@@ -132,7 +132,13 @@
+ 
+ }/*}}}*/
+ 
+-/*Numerics*/
++/*Finite Element Analysis*/
++ElementMatrix* StressbalanceSIAAnalysis::CreateKMatrix(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* StressbalanceSIAAnalysis::CreatePVector(Element* element){/*{{{*/
++_error_("not implemented yet");
++}/*}}}*/
+ void StressbalanceSIAAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 
+ 	IssmDouble vx,vy;
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h	(revision 16782)
+@@ -11,12 +11,17 @@
+ class DamageEvolutionAnalysis: public Analysis{
+ 
+ 	public:
++		/*Model processing*/
+ 		int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16782)
+@@ -800,7 +800,13 @@
+ #endif
+ }/*}}}*/
+ 
+-/*Numerics*/
++/*Finite Element Analysis*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrix(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* StressbalanceAnalysis::CreatePVector(Element* element){/*{{{*/
++_error_("not implemented yet");
++}/*}}}*/
+ void StressbalanceAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 
+ 	int approximation;
+Index: ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h	(revision 16782)
+@@ -11,12 +11,17 @@
+ class MeshdeformationAnalysis: public Analysis{
+ 
+ 	public:
++		/*Model processing*/
+ 		int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h	(revision 16782)
+@@ -11,12 +11,17 @@
+ class EnthalpyAnalysis: public Analysis{
+ 
+ 	public:
++		/*Model processing*/
+ 		int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h	(revision 16782)
+@@ -11,12 +11,17 @@
+ class FreeSurfaceBaseAnalysis: public Analysis{
+ 
+ 	public:
++		/*Model processing*/
+ 		int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h	(revision 16782)
+@@ -11,12 +11,17 @@
+ class SmoothedSurfaceSlopeXAnalysis: public Analysis{
+ 
+ 	public:
++		/*Model processing*/
+ 		int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16782)
+@@ -135,7 +135,13 @@
+ 	iomodel->DeleteData(1,MeshVertexonbedEnum);
+ }/*}}}*/
+ 
+-/*Numerics*/
++/*Finite Element Analysis*/
++ElementMatrix* HydrologyDCInefficientAnalysis::CreateKMatrix(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* HydrologyDCInefficientAnalysis::CreatePVector(Element* element){/*{{{*/
++_error_("not implemented yet");
++}/*}}}*/
+ void HydrologyDCInefficientAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,SedimentHeadEnum);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16782)
+@@ -110,7 +110,13 @@
+ 
+ }/*}}}*/
+ 
+-/*Numerics*/
++/*Finite Element Analysis*/
++ElementMatrix* ThermalAnalysis::CreateKMatrix(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* ThermalAnalysis::CreatePVector(Element* element){/*{{{*/
++_error_("not implemented yet");
++}/*}}}*/
+ void ThermalAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,TemperatureEnum);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h	(revision 16782)
+@@ -11,12 +11,17 @@
+ class SmoothedSurfaceSlopeYAnalysis: public Analysis{
+ 
+ 	public:
++		/*Model processing*/
+ 		int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h	(revision 16782)
+@@ -11,12 +11,17 @@
+ class ExtrudeFromTopAnalysis: public Analysis{
+ 
+ 	public:
++		/*Model processing*/
+ 		int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 16782)
+@@ -35,7 +35,13 @@
+ void ExtrudeFromBaseAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+ }/*}}}*/
+ 
+-/*Numerics*/
++/*Finite Element Analysis*/
++ElementMatrix* ExtrudeFromBaseAnalysis::CreateKMatrix(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* ExtrudeFromBaseAnalysis::CreatePVector(Element* element){/*{{{*/
++_error_("not implemented yet");
++}/*}}}*/
+ void ExtrudeFromBaseAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 16782)
+@@ -70,7 +70,13 @@
+ 
+ }/*}}}*/
+ 
+-/*Numerics*/
++/*Finite Element Analysis*/
++ElementMatrix* MeltingAnalysis::CreateKMatrix(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* MeltingAnalysis::CreatePVector(Element* element){/*{{{*/
++_error_("not implemented yet");
++}/*}}}*/
+ void MeltingAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/GiaAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/GiaAnalysis.cpp	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/GiaAnalysis.cpp	(revision 16782)
+@@ -36,7 +36,13 @@
+ 	/*No loads*/
+ }/*}}}*/
+ 
+-/*Numerics*/
++/*Finite Element Analysis*/
++ElementMatrix* GiaAnalysis::CreateKMatrix(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* GiaAnalysis::CreatePVector(Element* element){/*{{{*/
++_error_("not implemented yet");
++}/*}}}*/
+ void GiaAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h	(revision 16782)
+@@ -11,12 +11,17 @@
+ class BalancethicknessSoftAnalysis: public Analysis{
+ 
+ 	public:
++		/*Model processing*/
+ 		int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h	(revision 16782)
+@@ -11,12 +11,17 @@
+ class HydrologyShreveAnalysis: public Analysis{
+ 
+ 	public:
++		/*Model processing*/
+ 		int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h	(revision 16782)
+@@ -11,12 +11,17 @@
+ class BalancethicknessAnalysis: public Analysis{
+ 
+ 	public:
++		/*Model processing*/
+ 		int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 16782)
+@@ -11,12 +11,17 @@
+ class HydrologyDCEfficientAnalysis: public Analysis{
+ 
+ 	public:
++		/*Model processing*/
+ 		int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h	(revision 16782)
+@@ -11,12 +11,17 @@
+ class AdjointHorizAnalysis: public Analysis{
+ 
+ 	public:
++		/*Model processing*/
+ 		int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionHoriz(IssmDouble* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h	(revision 16782)
+@@ -11,12 +11,17 @@
+ class BalancevelocityAnalysis: public Analysis{
+ 
+ 	public:
++		/*Model processing*/
+ 		int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 16782)
+@@ -24,7 +24,13 @@
+ 	_error_("not implemented yet");
+ }/*}}}*/
+ 
+-/*Numerics*/
++/*Finite Element Analysis*/
++ElementMatrix* AdjointBalancethicknessAnalysis::CreateKMatrix(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* AdjointBalancethicknessAnalysis::CreatePVector(Element* element){/*{{{*/
++_error_("not implemented yet");
++}/*}}}*/
+ void AdjointBalancethicknessAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	_error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h	(revision 16782)
+@@ -11,12 +11,17 @@
+ class L2ProjectionBaseAnalysis: public Analysis{
+ 
+ 	public:
++		/*Model processing*/
+ 		int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 16782)
+@@ -68,7 +68,13 @@
+ 	/*No loads*/
+ }/*}}}*/
+ 
+-/*Numerics*/
++/*Finite Element Analysis*/
++ElementMatrix* L2ProjectionEPLAnalysis::CreateKMatrix(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* L2ProjectionEPLAnalysis::CreatePVector(Element* element){/*{{{*/
++_error_("not implemented yet");
++}/*}}}*/
+ void L2ProjectionEPLAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/EnumToAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnumToAnalysis.h	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/EnumToAnalysis.h	(revision 16782)
+@@ -6,11 +6,16 @@
+ Analysis* EnumToAnalysis(int analysis_enum);
+ 
+ #endif
++		/*Model processing*/
+ 		int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16782)
+@@ -210,7 +210,13 @@
+ 
+ }/*}}}*/
+ 
+-/*Numerics*/
++/*Finite Element Analysis*/
++ElementMatrix* MasstransportAnalysis::CreateKMatrix(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* MasstransportAnalysis::CreatePVector(Element* element){/*{{{*/
++_error_("not implemented yet");
++}/*}}}*/
+ void MasstransportAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h	(revision 16782)
+@@ -11,12 +11,17 @@
+ class FreeSurfaceTopAnalysis: public Analysis{
+ 
+ 	public:
++		/*Model processing*/
+ 		int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 16782)
+@@ -93,7 +93,13 @@
+ 
+ }/*}}}*/
+ 
+-/*Numerics*/
++/*Finite Element Analysis*/
++ElementMatrix* DamageEvolutionAnalysis::CreateKMatrix(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* DamageEvolutionAnalysis::CreatePVector(Element* element){/*{{{*/
++_error_("not implemented yet");
++}/*}}}*/
+ void DamageEvolutionAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16782)
+@@ -182,7 +182,13 @@
+ 	/*No loads */
+ }/*}}}*/
+ 
+-/*Numerics*/
++/*Finite Element Analysis*/
++ElementMatrix* EnthalpyAnalysis::CreateKMatrix(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* EnthalpyAnalysis::CreatePVector(Element* element){/*{{{*/
++_error_("not implemented yet");
++}/*}}}*/
+ void EnthalpyAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,EnthalpyEnum);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp	(revision 16782)
+@@ -24,7 +24,13 @@
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+ 
+-/*Numerics*/
++/*Finite Element Analysis*/
++ElementMatrix* MeshdeformationAnalysis::CreateKMatrix(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* MeshdeformationAnalysis::CreatePVector(Element* element){/*{{{*/
++_error_("not implemented yet");
++}/*}}}*/
+ void MeshdeformationAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 16782)
+@@ -88,7 +88,13 @@
+ 	iomodel->DeleteData(nodeonbed,MeshVertexonbedEnum);
+ }/*}}}*/
+ 
+-/*Numerics*/
++/*Finite Element Analysis*/
++ElementMatrix* FreeSurfaceBaseAnalysis::CreateKMatrix(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* FreeSurfaceBaseAnalysis::CreatePVector(Element* element){/*{{{*/
++_error_("not implemented yet");
++}/*}}}*/
+ void FreeSurfaceBaseAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 16782)
+@@ -43,7 +43,13 @@
+ void SmoothedSurfaceSlopeXAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+ }/*}}}*/
+ 
+-/*Numerics*/
++/*Finite Element Analysis*/
++ElementMatrix* SmoothedSurfaceSlopeXAnalysis::CreateKMatrix(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* SmoothedSurfaceSlopeXAnalysis::CreatePVector(Element* element){/*{{{*/
++_error_("not implemented yet");
++}/*}}}*/
+ void SmoothedSurfaceSlopeXAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 16782)
+@@ -35,7 +35,13 @@
+ void ExtrudeFromTopAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+ }/*}}}*/
+ 
+-/*Numerics*/
++/*Finite Element Analysis*/
++ElementMatrix* ExtrudeFromTopAnalysis::CreateKMatrix(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* ExtrudeFromTopAnalysis::CreatePVector(Element* element){/*{{{*/
++_error_("not implemented yet");
++}/*}}}*/
+ void ExtrudeFromTopAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 16782)
+@@ -43,7 +43,13 @@
+ void SmoothedSurfaceSlopeYAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+ }/*}}}*/
+ 
+-/*Numerics*/
++/*Finite Element Analysis*/
++ElementMatrix* SmoothedSurfaceSlopeYAnalysis::CreateKMatrix(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* SmoothedSurfaceSlopeYAnalysis::CreatePVector(Element* element){/*{{{*/
++_error_("not implemented yet");
++}/*}}}*/
+ void SmoothedSurfaceSlopeYAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h	(revision 16781)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h	(revision 16782)
+@@ -11,12 +11,17 @@
+ class StressbalanceVerticalAnalysis: public Analysis{
+ 
+ 	public:
++		/*Model processing*/
+ 		int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
Index: issm/oecreview/Archive/16554-17801/ISSM-16782-16783.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16782-16783.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16782-16783.diff	(revision 17802)
@@ -0,0 +1,2321 @@
+Index: ../trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp	(revision 16782)
++++ ../trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp	(revision 16783)
+@@ -27,8 +27,8 @@
+ 	Analysis* analysis = EnumToAnalysis(analysisenum);
+ 	for(int i=0;i<femmodel->elements->Size();i++){
+ 		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+-		//analysis->InputUpdateFromSolution(solution,element);
+-		element->InputUpdateFromSolution(solution);
++		analysis->InputUpdateFromSolution(solution,element);
++		//element->InputUpdateFromSolution(solution);
+ 	}
+ 	delete analysis;
+ }
+Index: ../trunk-jpl/src/c/classes/Materials/Matice.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 16782)
++++ ../trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 16783)
+@@ -853,11 +853,6 @@
+ 	/*Nothing updated yet*/
+ }
+ /*}}}*/
+-/*FUNCTION Matice::InputUpdateFromSolution{{{*/
+-void  Matice::InputUpdateFromSolution(IssmDouble* solution){
+-	/*Nothing updated yet*/
+-}
+-/*}}}*/
+ /*FUNCTION Matice::InputUpdateFromIoModel{{{*/
+ void Matice::InputUpdateFromIoModel(int index, IoModel* iomodel){
+ 
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 16782)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 16783)
+@@ -219,11 +219,6 @@
+ 	/*Nothing updated yet*/
+ }
+ /*}}}*/
+-/*FUNCTION Matpar::InputUpdateFromSolution{{{*/
+-void   Matpar::InputUpdateFromSolution(IssmDouble* solution){
+-	/*Nothing updated yet*/
+-}
+-/*}}}*/
+ 
+ /*Matpar management: */
+ /*FUNCTION Matpar::InputDuplicate{{{*/
+Index: ../trunk-jpl/src/c/classes/Materials/Matice.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matice.h	(revision 16782)
++++ ../trunk-jpl/src/c/classes/Materials/Matice.h	(revision 16783)
+@@ -44,7 +44,6 @@
+ 		void  InputUpdateFromConstant(IssmDouble constant, int name);
+ 		void  InputUpdateFromConstant(int constant, int name);
+ 		void  InputUpdateFromConstant(bool constant, int name);
+-		void  InputUpdateFromSolution(IssmDouble* solution);
+ 		void  InputUpdateFromIoModel(int index, IoModel* iomodel);
+ 		/*}}}*/
+ 		/*Material virtual functions resolution: {{{*/
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 16782)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 16783)
+@@ -76,7 +76,6 @@
+ 		void   InputUpdateFromConstant(IssmDouble constant, int name);
+ 		void   InputUpdateFromConstant(int constant, int name);
+ 		void   InputUpdateFromConstant(bool constant, int name);
+-		void   InputUpdateFromSolution(IssmDouble* solution);
+ 		void   InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented yet");};
+ 		/*}}}*/
+ 		/*Material virtual functions resolution: {{{*/
+Index: ../trunk-jpl/src/c/classes/Loads/Riftfront.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Riftfront.h	(revision 16782)
++++ ../trunk-jpl/src/c/classes/Loads/Riftfront.h	(revision 16783)
+@@ -64,8 +64,7 @@
+ 		void    InputUpdateFromConstant(IssmDouble constant, int name);
+ 		void    InputUpdateFromConstant(int constant, int name){_error_("Not implemented yet!");}
+ 		void    InputUpdateFromConstant(bool constant, int name);
+-		void    InputUpdateFromSolution(IssmDouble* solution){_error_("Not implemented yet!");}
+-		void  InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented yet");};
++		void    InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented yet");};
+ 		/*}}}*/
+ 		/*Load virtual functions definitions: {{{*/
+ 		void  Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
+Index: ../trunk-jpl/src/c/classes/Loads/Numericalflux.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Numericalflux.h	(revision 16782)
++++ ../trunk-jpl/src/c/classes/Loads/Numericalflux.h	(revision 16783)
+@@ -53,7 +53,6 @@
+ 		void InputUpdateFromConstant(IssmDouble constant, int name){/*Do nothing*/};
+ 		void InputUpdateFromConstant(int constant, int name){/*Do nothing*/};
+ 		void InputUpdateFromConstant(bool constant, int name){_error_("Not implemented yet!");}
+-		void InputUpdateFromSolution(IssmDouble* solution){_error_("Not implemented yet!");}
+ 		void InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented yet");};
+ 		/*}}}*/
+ 		/*Load virtual functions definitions: {{{*/
+Index: ../trunk-jpl/src/c/classes/Loads/Penpair.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Penpair.h	(revision 16782)
++++ ../trunk-jpl/src/c/classes/Loads/Penpair.h	(revision 16783)
+@@ -43,7 +43,6 @@
+ 		void  InputUpdateFromConstant(IssmDouble constant, int name);
+ 		void  InputUpdateFromConstant(int constant, int name);
+ 		void  InputUpdateFromConstant(bool constant, int name);
+-		void  InputUpdateFromSolution(IssmDouble* solution){_error_("Not implemented yet!");}
+ 		void  InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented yet");};
+ 		/*}}}*/
+ 			/*Load virtual functions definitions: {{{*/
+Index: ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 16782)
++++ ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 16783)
+@@ -406,11 +406,6 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Pengrid::InputUpdateFromSolution{{{*/
+-void  Pengrid::InputUpdateFromSolution(IssmDouble* solution){
+-	/*Nothing updated yet*/
+-}
+-/*}}}*/		
+ 
+ /*Pengrid management:*/
+ /*FUNCTION Pengrid::ConstraintActivate {{{*/
+Index: ../trunk-jpl/src/c/classes/Loads/Pengrid.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Pengrid.h	(revision 16782)
++++ ../trunk-jpl/src/c/classes/Loads/Pengrid.h	(revision 16783)
+@@ -63,7 +63,6 @@
+ 		void  InputUpdateFromConstant(IssmDouble constant, int name);
+ 		void  InputUpdateFromConstant(int constant, int name);
+ 		void  InputUpdateFromConstant(bool constant, int name);
+-		void  InputUpdateFromSolution(IssmDouble* solution);
+ 		void  InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented yet");};
+ 		/*}}}*/
+ 		/*Load virtual functions definitions: {{{*/
+Index: ../trunk-jpl/src/c/classes/Update.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Update.h	(revision 16782)
++++ ../trunk-jpl/src/c/classes/Update.h	(revision 16783)
+@@ -21,7 +21,6 @@
+ 		virtual void  InputUpdateFromConstant(IssmDouble constant, int name)=0;
+ 		virtual void  InputUpdateFromConstant(int constant, int name)=0;
+ 		virtual void  InputUpdateFromConstant(bool constant, int name)=0;
+-		virtual void  InputUpdateFromSolution(IssmDouble* solution)=0;
+ 		virtual void  InputUpdateFromIoModel(int index, IoModel* iomodel)=0;
+ 
+ };
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16782)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16783)
+@@ -1808,97 +1808,6 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Tria::InputUpdateFromSolution {{{*/
+-void  Tria::InputUpdateFromSolution(IssmDouble* solution){
+-
+-	/*retrive parameters: */
+-	int analysis_type,extrusioninput;
+-	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-
+-	/*Just branch to the correct InputUpdateFromSolution generator, according to the type of analysis we are carrying out: */
+-	switch(analysis_type){
+-		#ifdef _HAVE_STRESSBALANCE_
+-		case StressbalanceAnalysisEnum:
+-			int approximation;
+-			inputs->GetInputValue(&approximation,ApproximationEnum);
+-			if(approximation==FSApproximationEnum || approximation==NoneApproximationEnum){
+-				InputUpdateFromSolutionStressbalanceFS(solution);
+-			}
+-			else if (approximation==SSAApproximationEnum || approximation==SIAApproximationEnum){
+-				InputUpdateFromSolutionStressbalanceHoriz(solution);
+-			}
+-			else{
+-				_error_("approximation not supported yet");
+-			}
+-			break;
+-		case StressbalanceSIAAnalysisEnum:
+-			InputUpdateFromSolutionStressbalanceHoriz(solution);
+-			break;
+-		#endif
+-		#ifdef _HAVE_CONTROL_
+-		case AdjointHorizAnalysisEnum:
+-			InputUpdateFromSolutionAdjointHoriz(solution);
+-			break;
+-		case AdjointBalancethicknessAnalysisEnum:
+-			InputUpdateFromSolutionOneDof(solution,AdjointEnum);
+-			break;
+-		#endif
+-		#ifdef _HAVE_HYDROLOGY_ 
+-		case HydrologyShreveAnalysisEnum:
+-			InputUpdateFromSolutionHydrologyShreve(solution);
+-			break;
+-		case HydrologyDCInefficientAnalysisEnum:
+-			InputUpdateFromSolutionHydrologyDCInefficient(solution);
+-			break;
+-		case HydrologyDCEfficientAnalysisEnum:
+-			InputUpdateFromSolutionOneDof(solution,EplHeadEnum);
+-			break;
+-		case L2ProjectionEPLAnalysisEnum:
+-			this->parameters->FindParam(&extrusioninput,InputToL2ProjectEnum);
+-			InputUpdateFromSolutionOneDof(solution,extrusioninput);
+-			break;
+-		#endif
+-	 	#ifdef _HAVE_DAMAGE_
+-		case DamageEvolutionAnalysisEnum:
+-			InputUpdateFromSolutionDamageEvolution(solution);
+-			break;
+-		#endif
+-	 	#ifdef _HAVE_BALANCED_
+-		case BalancethicknessAnalysisEnum:
+-			InputUpdateFromSolutionOneDof(solution,ThicknessEnum);
+-			break;
+-		case BalancevelocityAnalysisEnum:
+-			InputUpdateFromSolutionOneDof(solution,VelEnum);
+-			break;
+-		case SmoothedSurfaceSlopeXAnalysisEnum:
+-			InputUpdateFromSolutionOneDof(solution,SurfaceSlopeXEnum);
+-			break;
+-		case SmoothedSurfaceSlopeYAnalysisEnum:
+-			InputUpdateFromSolutionOneDof(solution,SurfaceSlopeYEnum);
+-			break;
+-		#endif
+-		case L2ProjectionBaseAnalysisEnum:
+-			this->parameters->FindParam(&extrusioninput,InputToL2ProjectEnum);
+-			InputUpdateFromSolutionOneDof(solution,extrusioninput);
+-			break;
+-		case MasstransportAnalysisEnum:
+-			InputUpdateFromSolutionMasstransport(solution);
+-			break;
+-		case FreeSurfaceTopAnalysisEnum:
+-			InputUpdateFromSolutionOneDof(solution,SurfaceEnum);
+-			break;
+-		case FreeSurfaceBaseAnalysisEnum:
+-			InputUpdateFromSolutionOneDof(solution,BedEnum);
+-			break;
+-		case ExtrudeFromBaseAnalysisEnum: case ExtrudeFromTopAnalysisEnum:
+-			this->parameters->FindParam(&extrusioninput,InputToExtrudeEnum);
+-			InputUpdateFromSolutionOneDof(solution,extrusioninput);
+-			break;
+-		default:
+-			_error_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet");
+-	}
+-}
+-/*}}}*/
+ /*FUNCTION Tria::InputUpdateFromSolutionOneDof{{{*/
+ void  Tria::InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type){
+ 
+@@ -1926,82 +1835,6 @@
+ 	xDelete<int>(doflist);
+ }
+ /*}}}*/
+-/*FUNCTION Tria::InputUpdateFromSolutionMasstransport{{{*/
+-void  Tria::InputUpdateFromSolutionMasstransport(IssmDouble* solution){
+-
+-	/*Intermediaries*/
+-	int        i,hydroadjustment;
+-	int*       doflist=NULL;
+-	IssmDouble rho_ice,rho_water,minthickness;
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Fetch dof list and allocate solution vector*/
+-	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+-	IssmDouble* newthickness = xNew<IssmDouble>(numnodes);
+-	IssmDouble* newbed       = xNew<IssmDouble>(numnodes);
+-	IssmDouble* newsurface   = xNew<IssmDouble>(numnodes);
+-	IssmDouble* oldthickness = xNew<IssmDouble>(numnodes);
+-	IssmDouble* oldbed       = xNew<IssmDouble>(numnodes);
+-	IssmDouble* oldsurface   = xNew<IssmDouble>(numnodes);
+-	IssmDouble* phi          = xNew<IssmDouble>(numnodes);
+-
+-	/*Use the dof list to index into the solution vector: */
+-	this->parameters->FindParam(&minthickness,MasstransportMinThicknessEnum);
+-	for(i=0;i<numnodes;i++){
+-		newthickness[i]=solution[doflist[i]];
+-		if(xIsNan<IssmDouble>(newthickness[i])) _error_("NaN found in solution vector");
+-		/*Constrain thickness to be at least 1m*/
+-		if(newthickness[i]<minthickness) newthickness[i]=minthickness;
+-	}
+-
+-	/*Get previous bed, thickness and surface*/
+-	GetInputListOnNodes(&oldbed[0],BedEnum);
+-	GetInputListOnNodes(&oldsurface[0],SurfaceEnum);
+-	GetInputListOnNodes(&oldthickness[0],ThicknessEnum);
+-	GetInputListOnNodes(&phi[0],MaskGroundediceLevelsetEnum);
+-
+-	/*Find MasstransportHydrostaticAdjustment to figure out how to update the geometry:*/
+-	this->parameters->FindParam(&hydroadjustment,MasstransportHydrostaticAdjustmentEnum);
+-	rho_ice=matpar->GetRhoIce();
+-	rho_water=matpar->GetRhoWater();
+-
+-	for(i=0;i<numnodes;i++) {
+-		/*If shelf: hydrostatic equilibrium*/
+-		if (phi[i]>0.){
+-			newsurface[i] = oldbed[i]+newthickness[i]; //surface = oldbed + newthickness
+-			newbed[i]     = oldbed[i];                 //same bed: do nothing
+-		}
+-		else{ //this is an ice shelf
+-			if(hydroadjustment==AbsoluteEnum){
+-				newsurface[i] = newthickness[i]*(1-rho_ice/rho_water);
+-				newbed[i]     = newthickness[i]*(-rho_ice/rho_water);
+-			}
+-			else if(hydroadjustment==IncrementalEnum){
+-				newsurface[i] = oldsurface[i]+(1.0-rho_ice/rho_water)*(newthickness[i]-oldthickness[i]); //surface = oldsurface + (1-di) * dH
+-				newbed[i]     = oldbed[i]-rho_ice/rho_water*(newthickness[i]-oldthickness[i]); //bed               = oldbed + di * dH
+-			}
+-			else _error_("Hydrostatic adjustment " << hydroadjustment << " (" << EnumToStringx(hydroadjustment) << ") not supported yet");
+-		}
+-	}
+-
+-	/*Add input to the element: */
+-	this->inputs->AddInput(new TriaInput(ThicknessEnum,newthickness,P1Enum));
+-	this->inputs->AddInput(new TriaInput(SurfaceEnum,newsurface,P1Enum));
+-	this->inputs->AddInput(new TriaInput(BedEnum,newbed,P1Enum));
+-
+-	/*Free ressources:*/
+-	xDelete<IssmDouble>(newthickness);
+-	xDelete<IssmDouble>(newbed);
+-	xDelete<IssmDouble>(newsurface);
+-	xDelete<IssmDouble>(oldthickness);
+-	xDelete<IssmDouble>(oldbed);
+-	xDelete<IssmDouble>(oldsurface);
+-	xDelete<IssmDouble>(phi);
+-	xDelete<int>(doflist);
+-}
+-/*}}}*/
+ /*FUNCTION Tria::InputUpdateFromVector(IssmDouble* vector, int name, int type);{{{*/
+ void  Tria::InputUpdateFromVector(IssmDouble* vector, int name, int type){
+ 
+@@ -4415,226 +4248,6 @@
+ 	return y;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::InputUpdateFromSolutionStressbalanceHoriz {{{*/
+-void  Tria::InputUpdateFromSolutionStressbalanceHoriz(IssmDouble* solution){
+-
+-	int        i;
+-	IssmDouble rho_ice,g;
+-	int*       doflist=NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-	int numdof   = numnodes*NDOF2;
+-
+-	/*Fetch dof list and allocate solution vectors*/
+-	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+-	IssmDouble* values    = xNew<IssmDouble>(numdof);
+-	IssmDouble* vx        = xNew<IssmDouble>(numnodes);
+-	IssmDouble* vy        = xNew<IssmDouble>(numnodes);
+-	IssmDouble* vz        = xNew<IssmDouble>(numnodes);
+-	IssmDouble* vel       = xNew<IssmDouble>(numnodes);
+-	IssmDouble* pressure  = xNew<IssmDouble>(numnodes);
+-	IssmDouble* thickness = xNew<IssmDouble>(numnodes);
+-
+-	/*Use the dof list to index into the solution vector: */
+-	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+-
+-	/*Transform solution in Cartesian Space*/
+-	::TransformSolutionCoord(&values[0],nodes,numnodes,XYEnum);
+-
+-	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+-	for(i=0;i<numnodes;i++){
+-		vx[i]=values[i*NDOF2+0];
+-		vy[i]=values[i*NDOF2+1];
+-
+-		/*Check solution*/
+-		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
+-		if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
+-	}
+-
+-	/*Get Vz and compute vel*/
+-	GetInputListOnNodes(&vz[0],VzEnum,0.);
+-	for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
+-
+-	/*For pressure: we have not computed pressure in this analysis, for this element. We are in 2D, 
+-	 *so the pressure is just the pressure at the bedrock: */
+-	rho_ice=matpar->GetRhoIce();
+-	g=matpar->GetG();
+-	GetInputListOnNodes(&thickness[0],ThicknessEnum);
+-	for(i=0;i<numnodes;i++) pressure[i]=rho_ice*g*thickness[i];
+-
+-	/*Now, we have to move the previous Vx and Vy inputs  to old 
+-	 * status, otherwise, we'll wipe them off: */
+-	this->inputs->ChangeEnum(VxEnum,VxPicardEnum);
+-	this->inputs->ChangeEnum(VyEnum,VyPicardEnum);
+-	this->inputs->ChangeEnum(PressureEnum,PressurePicardEnum);
+-
+-	/*Add vx and vy as inputs to the tria element: */
+-	this->inputs->AddInput(new TriaInput(VxEnum,vx,P1Enum));
+-	this->inputs->AddInput(new TriaInput(VyEnum,vy,P1Enum));
+-	this->inputs->AddInput(new TriaInput(VelEnum,vel,P1Enum));
+-	this->inputs->AddInput(new TriaInput(PressureEnum,pressure,P1Enum));
+-
+-	/*Free ressources:*/
+-	xDelete<IssmDouble>(thickness);
+-	xDelete<IssmDouble>(pressure);
+-	xDelete<IssmDouble>(vel);
+-	xDelete<IssmDouble>(vz);
+-	xDelete<IssmDouble>(vy);
+-	xDelete<IssmDouble>(vx);
+-	xDelete<IssmDouble>(values);
+-	xDelete<int>(doflist);
+-
+-}
+-/*}}}*/
+-/*FUNCTION Tria::InputUpdateFromSolutionStressbalanceFS {{{*/
+-void  Tria::InputUpdateFromSolutionStressbalanceFS(IssmDouble* solution){
+-
+-	int          i;
+-	int*         vdoflist=NULL;
+-	int*         pdoflist=NULL;
+-	IssmDouble   FSreconditioning;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumnodes = this->NumberofNodesPressure();
+-	int vnumdof   = vnumnodes*NDOF2;
+-	int pnumdof   = pnumnodes*NDOF1;
+-
+-	/*Initialize values*/
+-	IssmDouble* values   = xNew<IssmDouble>(vnumdof+pnumdof);
+-	IssmDouble* vx       = xNew<IssmDouble>(vnumnodes);
+-	IssmDouble* vy       = xNew<IssmDouble>(vnumnodes);
+-	IssmDouble* vel      = xNew<IssmDouble>(vnumnodes);
+-	IssmDouble* pressure = xNew<IssmDouble>(pnumnodes);
+-
+-	/*Prepare coordinate system list*/
+-	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+-	for(i=0;i<vnumnodes;i++) cs_list[i]           = XYEnum;
+-	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
+-
+-	/*Get dof list: */
+-	GetDofListVelocity(&vdoflist,GsetEnum);
+-	GetDofListPressure(&pdoflist,GsetEnum);
+-
+-	/*Use the dof list to index into the solution vector: */
+-	for(i=0;i<vnumdof;i++) values[i]        =solution[vdoflist[i]];
+-	for(i=0;i<pnumdof;i++) values[vnumdof+i]=solution[pdoflist[i]];
+-
+-	/*Transform solution in Cartesian Space*/
+-	::TransformSolutionCoord(&values[0],nodes,vnumnodes+pnumdof,cs_list);
+-
+-	/*Ok, we have vx and vy in values, fill in all arrays: */
+-	for(i=0;i<vnumnodes;i++){
+-		vx[i] = values[i*NDOF2+0];
+-		vy[i] = values[i*NDOF2+1];
+-		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
+-		if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
+-	}
+-	for(i=0;i<pnumnodes;i++){
+-		pressure[i] = values[vnumdof+i];
+-		if(xIsNan<IssmDouble>(pressure[i])) _error_("NaN found in solution vector");
+-	}
+-
+-	/*Recondition pressure and compute vel: */
+-	this->parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+-	for(i=0;i<pnumnodes;i++) pressure[i] = pressure[i]*FSreconditioning;
+-	for(i=0;i<vnumnodes;i++) vel[i]      = sqrt(vx[i]*vx[i] + vy[i]*vy[i]);
+-
+-	/*Now, we have to move the previous inputs  to old 
+-	 * status, otherwise, we'll wipe them off: */
+-	this->inputs->ChangeEnum(VxEnum,VxPicardEnum);
+-	this->inputs->ChangeEnum(VyEnum,VyPicardEnum);
+-	this->inputs->ChangeEnum(PressureEnum,PressurePicardEnum);
+-
+-	/*Add vx and vy as inputs to the tria element: */
+-	this->inputs->AddInput(new TriaInput(VxEnum,vx,P1Enum));
+-	this->inputs->AddInput(new TriaInput(VyEnum,vy,P1Enum));
+-	this->inputs->AddInput(new TriaInput(VelEnum,vel,P1Enum));
+-	this->inputs->AddInput(new TriaInput(PressureEnum,pressure,P1Enum));
+-
+-	/*Free ressources:*/
+-	xDelete<IssmDouble>(pressure);
+-	xDelete<IssmDouble>(vel);
+-	xDelete<IssmDouble>(vy);
+-	xDelete<IssmDouble>(vx);
+-	xDelete<IssmDouble>(values);
+-	xDelete<int>(vdoflist);
+-	xDelete<int>(pdoflist);
+-	xDelete<int>(cs_list);
+-}
+-/*}}}*/
+-/*FUNCTION Tria::InputUpdateFromSolutionStressbalanceSIA {{{*/
+-void  Tria::InputUpdateFromSolutionStressbalanceSIA(IssmDouble* solution){
+-
+-	int        i;
+-	IssmDouble rho_ice,g;
+-	int*       doflist=NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-	int numdof   = numnodes*NDOF2;
+-
+-	/*Fetch dof list and allocate solution vectors*/
+-	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+-	IssmDouble* values    = xNew<IssmDouble>(numdof);
+-	IssmDouble* vx        = xNew<IssmDouble>(numdof);
+-	IssmDouble* vy        = xNew<IssmDouble>(numdof);
+-	IssmDouble* vz        = xNew<IssmDouble>(numdof);
+-	IssmDouble* vel       = xNew<IssmDouble>(numdof);
+-	IssmDouble* pressure  = xNew<IssmDouble>(numdof);
+-	IssmDouble* thickness = xNew<IssmDouble>(numdof);
+-
+-	/*Use the dof list to index into the solution vector: */
+-	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+-
+-	/*Transform solution in Cartesian Space*/
+-	::TransformSolutionCoord(&values[0],nodes,numnodes,XYEnum);
+-
+-	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+-	for(i=0;i<numnodes;i++){
+-		vx[i]=values[i*NDOF2+0];
+-		vy[i]=values[i*NDOF2+1];
+-
+-		/*Check solution*/
+-		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
+-		if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
+-	}
+-
+-	/*Get Vz and compute vel*/
+-	GetInputListOnNodes(&vz[0],VzEnum,0.);
+-	for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
+-
+-	/*For pressure: we have not computed pressure in this analysis, for this element. We are in 2D, 
+-	 *so the pressure is just the pressure at the bedrock: */
+-	rho_ice=matpar->GetRhoIce();
+-	g=matpar->GetG();
+-	GetInputListOnNodes(&thickness[0],ThicknessEnum);
+-	for(i=0;i<numnodes;i++) pressure[i]=rho_ice*g*thickness[i];
+-
+-	/*Now, we have to move the previous Vx and Vy inputs  to old 
+-	 * status, otherwise, we'll wipe them off: */
+-	this->inputs->ChangeEnum(VxEnum,VxPicardEnum);
+-	this->inputs->ChangeEnum(VyEnum,VyPicardEnum);
+-	this->inputs->ChangeEnum(PressureEnum,PressurePicardEnum);
+-
+-	/*Add vx and vy as inputs to the tria element: */
+-	this->inputs->AddInput(new TriaInput(VxEnum,vx,P1Enum));
+-	this->inputs->AddInput(new TriaInput(VyEnum,vy,P1Enum));
+-	this->inputs->AddInput(new TriaInput(VelEnum,vel,P1Enum));
+-	this->inputs->AddInput(new TriaInput(PressureEnum,pressure,P1Enum));
+-
+-	/*Free ressources:*/
+-	xDelete<IssmDouble>(thickness);
+-	xDelete<IssmDouble>(pressure);
+-	xDelete<IssmDouble>(vel);
+-	xDelete<IssmDouble>(vz);
+-	xDelete<IssmDouble>(vy);
+-	xDelete<IssmDouble>(vx);
+-	xDelete<IssmDouble>(values);
+-	xDelete<int>(doflist);
+-}
+-/*}}}*/
+ #endif
+ 
+ #ifdef _HAVE_CONTROL_
+@@ -6339,49 +5952,6 @@
+ 	return Ke;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::InputUpdateFromSolutionAdjointHoriz {{{*/
+-void  Tria::InputUpdateFromSolutionAdjointHoriz(IssmDouble* solution){
+-
+-	int  i;
+-	int* doflist=NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-	int numdof   = numnodes*NDOF2;
+-
+-	/*Fetch dof list and allocate solution vectors*/
+-	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+-	IssmDouble* values  = xNew<IssmDouble>(numdof);
+-	IssmDouble* lambdax = xNew<IssmDouble>(numnodes);
+-	IssmDouble* lambday = xNew<IssmDouble>(numnodes);
+-
+-	/*Use the dof list to index into the solution vector: */
+-	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+-
+-	/*Transform solution in Cartesian Space*/
+-	::TransformSolutionCoord(&values[0],nodes,numnodes,XYEnum);
+-
+-	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+-	for(i=0;i<numnodes;i++){
+-		lambdax[i]=values[i*NDOF2+0];
+-		lambday[i]=values[i*NDOF2+1];
+-
+-		/*Check solution*/
+-		if(xIsNan<IssmDouble>(lambdax[i])) _error_("NaN found in solution vector");
+-		if(xIsNan<IssmDouble>(lambday[i])) _error_("NaN found in solution vector");
+-	}
+-
+-	/*Add vx and vy as inputs to the tria element: */
+-	this->inputs->AddInput(new TriaInput(AdjointxEnum,lambdax,P1Enum));
+-	this->inputs->AddInput(new TriaInput(AdjointyEnum,lambday,P1Enum));
+-
+-	/*Free ressources:*/
+-	xDelete<IssmDouble>(values);
+-	xDelete<IssmDouble>(lambdax);
+-	xDelete<IssmDouble>(lambday);
+-	xDelete<int>(doflist);
+-}
+-/*}}}*/
+ /*FUNCTION Tria::GetVectorFromControlInputs{{{*/
+ void  Tria::GetVectorFromControlInputs(Vector<IssmDouble>* vector,int control_enum,int control_index,const char* data){
+ 
+@@ -7114,88 +6684,6 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::InputUpdateFromSolutionHydrologyShreve{{{*/
+-void  Tria::InputUpdateFromSolutionHydrologyShreve(IssmDouble* solution){
+-
+-	/*Intermediary*/
+-	int* doflist = NULL;
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Fetch dof list and allocate solution vector*/
+-	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+-	IssmDouble* values    = xNew<IssmDouble>(numnodes);
+-
+-	/*Use the dof list to index into the solution vector: */
+-	for(int i=0;i<numnodes;i++){
+-		values[i]=solution[doflist[i]];
+-		if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector");
+-		if (values[i]<10e-10) values[i]=10e-10; //correcting the water column to positive values
+-	}
+-
+-	/*Add input to the element: */
+-	this->inputs->AddInput(new TriaInput(WatercolumnEnum,values,P1Enum));
+-
+-	/*Free ressources:*/
+-	xDelete<IssmDouble>(values);
+-	xDelete<int>(doflist);
+-}
+-/*}}}*/
+-/*FUNCTION Tria::InputUpdateFromSolutionHydrologyDCInefficient{{{*/
+-void  Tria::InputUpdateFromSolutionHydrologyDCInefficient(IssmDouble* solution){
+-
+-	/*Intermediaries*/
+-	int        *doflist  = NULL;
+-	bool        converged;
+-	IssmDouble  penalty_factor, dt;
+-	IssmDouble  kmax, kappa, h_max;
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Fetch dof list and allocate solution vector*/
+-	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+-	IssmDouble* values   = xNew<IssmDouble>(numnodes);
+-	IssmDouble* residual = xNew<IssmDouble>(numnodes);
+-
+-	/*Use the dof list to index into the solution vector: */
+-	for(int i=0;i<numnodes;i++){
+-		values[i]=solution[doflist[i]];
+-		if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector");
+-	}
+-
+-	/*If converged keep the residual in mind*/
+-	this->inputs->GetInputValue(&converged,ConvergedEnum);
+-
+-	/*Get inputs*/
+-	if(converged){
+-		this->parameters->FindParam(&kmax,HydrologySedimentKmaxEnum);
+-		this->parameters->FindParam(&penalty_factor,HydrologydcPenaltyFactorEnum);
+-
+-		kappa=kmax*pow(10.,penalty_factor);
+-
+-		for(int i=0;i<numnodes;i++){
+-			this->GetHydrologyDCInefficientHmax(&h_max,nodes[i]);
+-			if(values[i]>h_max){
+-				residual[i]=kappa*(values[i]-h_max);
+-			}
+-			else{
+-				residual[i]=0.0;
+-			}
+-		}
+-		this->inputs->AddInput(new TriaInput(SedimentHeadResidualEnum,residual,P1Enum));
+-	}
+-
+-	/*Add input to the element: */
+-	this->inputs->AddInput(new TriaInput(SedimentHeadEnum,values,P1Enum));
+-
+-	/*Free ressources:*/
+-	xDelete<IssmDouble>(values);
+-	xDelete<IssmDouble>(residual);
+-	xDelete<int>(doflist);
+-}
+-/*}}}*/
+ /*FUNCTION Tria::GetHydrologyDCInefficientHmax{{{*/
+ void  Tria::GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode){
+ 
+@@ -8566,39 +8054,6 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::InputUpdateFromSolutionDamageEvolution {{{*/
+-void  Tria::InputUpdateFromSolutionDamageEvolution(IssmDouble* solution){
+-
+-	const int    numdof=NDOF1*NUMVERTICES;
+-
+-	int         i;
+-	IssmDouble  values[numdof];
+-	IssmDouble  max_damage;
+-	int			*doflist = NULL;
+-
+-	/*Get dof list: */
+-	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+-
+-	/*Get user-supplied max_damage: */
+-	this->parameters->FindParam(&max_damage,DamageMaxDamageEnum);
+-
+-	/*Use the dof list to index into the solution vector: */
+-	for(i=0;i<numdof;i++){
+-		values[i]=solution[doflist[i]];
+-		/*Check solution*/
+-		if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector");
+-		/*Enforce D < max_damage and D > 0 */
+-		if(values[i]>max_damage) values[i]=max_damage;
+-		else if(values[i]<0) values[i]=0;
+-	}
+-
+-	/*Get all inputs and parameters*/
+-	this->material->inputs->AddInput(new TriaInput(DamageDbarEnum,values,P1Enum));
+-
+-	/*Free ressources:*/
+-	xDelete<int>(doflist);
+-}
+-/*}}}*/
+ #endif
+ 
+ #ifdef _HAVE_DAKOTA_
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16782)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16783)
+@@ -54,7 +54,6 @@
+ 		Object *copy();
+ 		/*}}}*/
+ 		/*Update virtual functions resolution: {{{*/
+-		void  InputUpdateFromSolution(IssmDouble* solutiong);
+ 		void  InputUpdateFromVector(IssmDouble* vector, int name, int type);
+ 		#ifdef _HAVE_DAKOTA_
+ 		void  InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type);
+@@ -265,7 +264,6 @@
+ 		void	         InputChangeName(int enum_type,int enum_type_old);
+ 		void	         InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type);
+ 		void	         InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solution,int enum_type){_error_("not implemented yet");};
+-		void	         InputUpdateFromSolutionMasstransport(IssmDouble* solution);
+ 		bool	         IsInput(int name);
+ 		Gauss*         NewGauss(void);
+ 		void	         SetClone(int* minranks);
+@@ -294,9 +292,6 @@
+ 		ElementVector* CreatePVectorStressbalanceFSShelf(void);
+ 		ElementMatrix* CreateJacobianStressbalanceSSA(void);
+ 		IssmDouble     GetYcoord(GaussTria* gauss);
+-		void	         InputUpdateFromSolutionStressbalanceHoriz( IssmDouble* solution);
+-		void	         InputUpdateFromSolutionStressbalanceFS( IssmDouble* solution);
+-		void	         InputUpdateFromSolutionStressbalanceSIA( IssmDouble* solution);
+ 		#endif
+ 
+ 		#ifdef _HAVE_CONTROL_
+@@ -304,7 +299,6 @@
+ 		ElementMatrix* CreateKMatrixAdjointSSA(void);
+ 		ElementVector* CreatePVectorAdjointHoriz(void);
+ 		ElementVector* CreatePVectorAdjointBalancethickness(void);
+-		void	         InputUpdateFromSolutionAdjointHoriz( IssmDouble* solution);
+ 		#endif
+ 
+ 		void UpdateConstraintsExtrudeFromBase(void);
+@@ -325,11 +319,6 @@
+ 		ElementVector* CreatePVectorHydrologyDCEfficient(void);
+ 		ElementVector* CreatePVectorL2ProjectionEPL(void);
+ 		void           CreateHydrologyWaterVelocityInput(void);
+-		void	         InputUpdateFromSolutionHydrology(IssmDouble* solution);
+-		void	         InputUpdateFromSolutionHydrologyShreve(IssmDouble* solution);
+-		void           InputUpdateFromSolutionHydrologyDC(IssmDouble* solution);
+-		void	         InputUpdateFromSolutionHydrologyDCInefficient(IssmDouble* solution);
+-		void	         InputUpdateFromSolutionHydrologyDCEfficient(IssmDouble* solution);
+ 		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode);
+ 		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index);
+ 		void           GetHydrologyTransfer(Vector<IssmDouble>* transfer);
+@@ -347,7 +336,6 @@
+ 		ElementVector* CreatePVectorDamageEvolution(void);
+ 		ElementVector* CreatePVectorDamageEvolution_CG(void);
+ 		void           DamageEvolutionF(IssmDouble* flist);
+-		void	         InputUpdateFromSolutionDamageEvolution(IssmDouble* solution);
+ 		#endif
+ 
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16782)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16783)
+@@ -2275,272 +2275,6 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Penta::InputUpdateFromSolution {{{*/
+-void  Penta::InputUpdateFromSolution(IssmDouble* solution){
+-
+-	int analysis_type,inputenum;
+-
+-	/*retreive parameters: */
+-	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-
+-	/*Just branch to the correct InputUpdateFromSolution generator, according to the type of analysis we are carrying out: */
+-	switch(analysis_type){
+-	#ifdef _HAVE_STRESSBALANCE_
+-	case StressbalanceAnalysisEnum:
+-		InputUpdateFromSolutionStressbalanceHoriz( solution);
+-		break;
+-	case StressbalanceSIAAnalysisEnum:
+-		InputUpdateFromSolutionStressbalanceSIA( solution);
+-		break;
+-	case StressbalanceVerticalAnalysisEnum:
+-		InputUpdateFromSolutionStressbalanceVert( solution);
+-		break;
+-	#endif
+-	#ifdef _HAVE_CONTROL_
+-	case AdjointHorizAnalysisEnum:
+-		int approximation;
+-		inputs->GetInputValue(&approximation,ApproximationEnum);
+-		if(approximation==FSApproximationEnum || approximation==NoneApproximationEnum){
+-			InputUpdateFromSolutionAdjointFS( solution);
+-		}
+-		else{
+-			InputUpdateFromSolutionAdjointHoriz( solution);
+-		}
+-		break;
+-	#endif
+-	#ifdef _HAVE_THERMAL_
+-	case ThermalAnalysisEnum:
+-		InputUpdateFromSolutionThermal( solution);
+-		break;
+-	case EnthalpyAnalysisEnum:
+-		InputUpdateFromSolutionEnthalpy( solution);
+-		break;
+-	case MeltingAnalysisEnum:
+-		InputUpdateFromSolutionOneDof(solution,BasalforcingsMeltingRateEnum);
+-		break;
+-	#endif
+-	case L2ProjectionBaseAnalysisEnum:
+-		this->parameters->FindParam(&inputenum,InputToL2ProjectEnum);
+-		InputUpdateFromSolutionOneDofCollapsed(solution,inputenum);
+-		break;
+-	case MasstransportAnalysisEnum:
+-		InputUpdateFromSolutionMasstransport(solution);
+-		break;
+-	case FreeSurfaceTopAnalysisEnum:
+-		InputUpdateFromSolutionFreeSurfaceTop(solution);
+-		break;
+-	case FreeSurfaceBaseAnalysisEnum:
+-		InputUpdateFromSolutionFreeSurfaceBase(solution);
+-		break;
+-	#ifdef _HAVE_BALANCED_
+-	case BalancethicknessAnalysisEnum:
+-		InputUpdateFromSolutionOneDofCollapsed(solution,ThicknessEnum);
+-		break;
+-	#endif
+-	#ifdef _HAVE_HYDROLOGY_
+-	case HydrologyDCInefficientAnalysisEnum:
+-		InputUpdateFromSolutionHydrologyDCInefficient(solution);
+-		break;
+-	case HydrologyDCEfficientAnalysisEnum:
+-		InputUpdateFromSolutionOneDofCollapsed(solution,EplHeadEnum);
+-		break;
+-	case L2ProjectionEPLAnalysisEnum:
+-		this->parameters->FindParam(&inputenum,InputToL2ProjectEnum);
+-		InputUpdateFromSolutionOneDofCollapsed(solution,inputenum);
+-		break;
+-	#endif
+-	default: 
+-		_error_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet");
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION Penta::InputUpdateFromSolutionMasstransport{{{*/
+-void  Penta::InputUpdateFromSolutionMasstransport(IssmDouble* solution){
+-
+-	const int  numdof   = NDOF1*NUMVERTICES;
+-	const int  numdof2d = NDOF1*NUMVERTICES2D;
+-
+-	int    i,hydroadjustment;
+-	int*   doflist = NULL;
+-	IssmDouble rho_ice,rho_water,minthickness;
+-	IssmDouble newthickness[numdof];
+-	IssmDouble newbed[numdof];
+-	IssmDouble newsurface[numdof];
+-	IssmDouble oldbed[NUMVERTICES];
+-	IssmDouble oldsurface[NUMVERTICES];
+-	IssmDouble oldthickness[NUMVERTICES];
+-	IssmDouble phi[NUMVERTICES];
+-	Penta  *penta   = NULL;
+-
+-	/*If not on bed, return*/
+-	if (!IsOnBed()) return;
+-
+-	/*Get dof list: */
+-	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+-
+-	/*Use the dof list to index into the solution vector and extrude it */
+-	this->parameters->FindParam(&minthickness,MasstransportMinThicknessEnum);
+-	for(i=0;i<numdof2d;i++){
+-		newthickness[i]=solution[doflist[i]];
+-		if(xIsNan<IssmDouble>(newthickness[i])) _error_("NaN found in solution vector");
+-		/*Constrain thickness to be at least 1m*/
+-		if(newthickness[i]<minthickness) newthickness[i]=minthickness;
+-		newthickness[i+numdof2d]=newthickness[i];
+-	}
+-
+-	/*Get previous bed, thickness and surface*/
+-	GetInputListOnVertices(&oldbed[0],BedEnum);
+-	GetInputListOnVertices(&oldsurface[0],SurfaceEnum);
+-	GetInputListOnVertices(&oldthickness[0],ThicknessEnum);
+-	GetInputListOnVertices(&phi[0],MaskGroundediceLevelsetEnum);
+-
+-	/*Fing MasstransportHydrostaticAdjustment to figure out how to update the geometry:*/
+-	this->parameters->FindParam(&hydroadjustment,MasstransportHydrostaticAdjustmentEnum);
+-
+-	/*recover material parameters: */
+-	rho_ice=matpar->GetRhoIce();
+-	rho_water=matpar->GetRhoWater();
+-
+-	for(i=0;i<numdof;i++) {
+-		/*If shelf: hydrostatic equilibrium*/
+-		if (phi[i]>0.){
+-			newsurface[i]=oldbed[i]+newthickness[i]; //surface = oldbed + newthickness
+-			newbed[i]=oldbed[i];               //same bed: do nothing
+-		}
+-		else{ //so it is an ice shelf
+-			if(hydroadjustment==AbsoluteEnum){
+-				newsurface[i]=newthickness[i]*(1-rho_ice/rho_water);
+-				newbed[i]=newthickness[i]*(-rho_ice/rho_water);
+-			}
+-			else if(hydroadjustment==IncrementalEnum){
+-				newsurface[i]=oldsurface[i]+(1.0-rho_ice/rho_water)*(newthickness[i]-oldthickness[i]); //surface = oldsurface + (1-di) * dH 
+-				newbed[i]=oldbed[i]-rho_ice/rho_water*(newthickness[i]-oldthickness[i]); //bed = oldbed + di * dH
+-			}
+-			else _error_("Hydrostatic adjustment " << hydroadjustment << " (" << EnumToStringx(hydroadjustment) << ") not supported yet");
+-		}
+-	}
+-
+-	/*Start looping over all elements above current element and update all inputs*/
+-	penta=this;
+-	for(;;){
+-		/*Add input to the element: */
+-		penta->inputs->AddInput(new PentaInput(ThicknessEnum,newthickness,P1Enum));
+-		penta->inputs->AddInput(new PentaInput(SurfaceEnum,newsurface,P1Enum));
+-		penta->inputs->AddInput(new PentaInput(BedEnum,newbed,P1Enum));
+-
+-		/*Stop if we have reached the surface*/
+-		if (penta->IsOnSurface()) break;
+-
+-		/* get upper Penta*/
+-		penta=penta->GetUpperElement(); _assert_(penta->Id()!=this->id);
+-	}
+-
+-	/*Free ressources:*/
+-	xDelete<int>(doflist);
+-}
+-/*}}}*/
+-/*FUNCTION Penta::InputUpdateFromSolutionFreeSurfaceTop{{{*/
+-void  Penta::InputUpdateFromSolutionFreeSurfaceTop(IssmDouble* solution){
+-
+-	const int  numdof   = NDOF1*NUMVERTICES;
+-	const int  numdof2d = NDOF1*NUMVERTICES2D;
+-
+-	int    i;
+-	int*   doflist = NULL;
+-	IssmDouble newthickness[numdof];
+-	IssmDouble newbed[numdof];
+-	IssmDouble newsurface[numdof];
+-
+-	/*If not on bed, return*/
+-	if (!IsOnSurface()) return;
+-
+-	/*Get dof list: */
+-	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+-
+-	/*Use the dof list to index into the solution vector and extrude it */
+-	for(i=0;i<numdof2d;i++){
+-		newsurface[i+numdof2d]=solution[doflist[i+numdof2d]];
+-		if(xIsNan<IssmDouble>(newsurface[i+numdof2d])) _error_("NaN found in solution vector");
+-		newsurface[i]=newsurface[i+numdof2d];
+-	}
+-
+-	/*Get previous bed and thickness*/
+-	GetInputListOnVertices(&newbed[0],BedEnum);
+-
+-	for(i=0;i<numdof;i++) {
+-		newthickness[i]=newsurface[i]-newbed[i];
+-		_assert_(newthickness[i]>0.);
+-	}
+-
+-	/*Start looping over all elements above current element and update all inputs*/
+-	Penta* penta=this;
+-	for(;;){
+-		/*Add input to the element: */
+-		penta->inputs->AddInput(new PentaInput(ThicknessEnum,newthickness,P1Enum));
+-		penta->inputs->AddInput(new PentaInput(SurfaceEnum,newsurface,P1Enum));
+-
+-		/*Stop if we have reached the surface*/
+-		if(penta->IsOnBed()) break;
+-
+-		/* get upper Penta*/
+-		penta=penta->GetLowerElement(); _assert_(penta->Id()!=this->id);
+-	}
+-
+-	/*Free ressources:*/
+-	xDelete<int>(doflist);
+-}
+-/*}}}*/
+-/*FUNCTION Penta::InputUpdateFromSolutionFreeSurfaceBase{{{*/
+-void  Penta::InputUpdateFromSolutionFreeSurfaceBase(IssmDouble* solution){
+-
+-	const int  numdof   = NDOF1*NUMVERTICES;
+-	const int  numdof2d = NDOF1*NUMVERTICES2D;
+-
+-	int    i;
+-	int*   doflist = NULL;
+-	IssmDouble newthickness[numdof];
+-	IssmDouble newbed[numdof];
+-	IssmDouble newsurface[numdof];
+-
+-	/*If not on bed, return*/
+-	if (!IsOnBed()) return;
+-
+-	/*Get dof list: */
+-	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+-
+-	/*Use the dof list to index into the solution vector and extrude it */
+-	for(i=0;i<numdof2d;i++){
+-		newbed[i]=solution[doflist[i]];
+-		if(xIsNan<IssmDouble>(newbed[i])) _error_("NaN found in solution vector");
+-		newbed[i+numdof2d]=newbed[i];
+-	}
+-
+-	/*Get previous bed and thickness*/
+-	GetInputListOnVertices(&newsurface[0],SurfaceEnum);
+-
+-	for(i=0;i<numdof;i++) {
+-		newthickness[i]=newsurface[i]-newbed[i];
+-		_assert_(newthickness[i]>0.);
+-	}
+-
+-	/*Start looping over all elements above current element and update all inputs*/
+-	Penta* penta=this;
+-	for(;;){
+-		/*Add input to the element: */
+-		penta->inputs->AddInput(new PentaInput(ThicknessEnum,newthickness,P1Enum));
+-		penta->inputs->AddInput(new PentaInput(BedEnum,newbed,P1Enum));
+-
+-		/*Stop if we have reached the surface*/
+-		if(penta->IsOnSurface()) break;
+-
+-		/* get upper Penta*/
+-		penta=penta->GetUpperElement(); _assert_(penta->Id()!=this->id);
+-	}
+-
+-	/*Free ressources:*/
+-	xDelete<int>(doflist);
+-}
+-/*}}}*/
+ /*FUNCTION Penta::InputUpdateFromSolutionOneDof{{{*/
+ void  Penta::InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type){
+ 
+@@ -4855,158 +4589,6 @@
+ 	return pe;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::InputUpdateFromSolutionThermal {{{*/
+-void  Penta::InputUpdateFromSolutionThermal(IssmDouble* solution){
+-
+-	const int    numdof=NDOF1*NUMVERTICES;
+-
+-	bool        converged;
+-	int         i,rheology_law;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble  values[numdof];
+-	IssmDouble  B[numdof],surface[numdof];
+-	IssmDouble  B_average;
+-	int        *doflist = NULL;
+-	bool        hack    = false;
+-
+-	/*Get dof list: */
+-	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+-
+-	/*Use the dof list to index into the solution vector: */
+-	for(i=0;i<numdof;i++){
+-		values[i]=solution[doflist[i]];
+-
+-		/*Check solution*/
+-		if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector");
+-		//if(values[i]<0)      _printf_("temperature < 0°K found in solution vector\n");
+-		//if(values[i]>275)    _printf_("temperature > 275°K found in solution vector (Paterson's rheology associated is negative)\n");
+-	}
+-
+-	if(hack){
+-		/*Force temperature between [Tpmp-50 Tpmp] to disable penalties*/
+-		IssmDouble pressure[numdof];
+-		GetInputListOnVertices(&pressure[0],PressureEnum);
+-		for(i=0;i<numdof;i++){
+-			if(values[i]>matpar->TMeltingPoint(pressure[i]))     values[i]=matpar->TMeltingPoint(pressure[i]);
+-			if(values[i]<matpar->TMeltingPoint(pressure[i])-50.) values[i]=matpar->TMeltingPoint(pressure[i])-50.;
+-		}
+-	}
+-
+-
+-	/*Get all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* surface_input=inputs->GetInput(SurfaceEnum); _assert_(surface_input);
+-
+-	this->inputs->GetInputValue(&converged,ConvergedEnum);
+-	if(converged){
+-		this->inputs->AddInput(new PentaInput(TemperatureEnum,values,P1Enum));
+-
+-		/*Update Rheology only if converged (we must make sure that the temperature is below melting point
+-		 * otherwise the rheology could be negative*/
+-		this->parameters->FindParam(&rheology_law,MaterialsRheologyLawEnum);
+-		GetInputListOnVertices(&surface[0],SurfaceEnum);
+-		switch(rheology_law){
+-			case NoneEnum:
+-				/*Do nothing: B is not temperature dependent*/
+-				break;
+-			case PatersonEnum:
+-				for(i=0;i<numdof;i++) B[i]=Paterson(values[i]);
+-				this->material->inputs->AddInput(new PentaInput(MaterialsRheologyBEnum,B,P1Enum));
+-				break;
+-			case ArrheniusEnum:
+-				for(i=0;i<numdof;i++) B[i]=Arrhenius(values[i],surface[i]-xyz_list[i][2],material->GetN());
+-				this->material->inputs->AddInput(new PentaInput(MaterialsRheologyBEnum,B,P1Enum));
+-				break;
+-			default:
+-				_error_("Rheology law " << EnumToStringx(rheology_law) << " not supported yet");
+-
+-		}
+-	}
+-	else{
+-		this->inputs->AddInput(new PentaInput(TemperaturePicardEnum,values,P1Enum));
+-	}
+-
+-	/*Free ressources:*/
+-	xDelete<int>(doflist);
+-}
+-/*}}}*/
+-/*FUNCTION Penta::InputUpdateFromSolutionEnthalpy {{{*/
+-void  Penta::InputUpdateFromSolutionEnthalpy(IssmDouble* solution){
+-
+-	const int    numdof=NDOF1*NUMVERTICES;
+-
+-	bool       converged=false;
+-	int        i,rheology_law;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble values[numdof];
+-	IssmDouble pressure[numdof];
+-	IssmDouble surface[numdof];
+-	IssmDouble temperatures[numdof];
+-	IssmDouble waterfraction[numdof];
+-	IssmDouble B[numdof];
+-	int*       doflist=NULL;
+-
+-	/*Get dof list: */
+-	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+-
+-	/*Use the dof list to index into the solution vector: */
+-	for(i=0;i<numdof;i++){
+-		values[i]=solution[doflist[i]];
+-
+-		/*Check solution*/
+-		if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector");
+-	}
+-
+-	/*Get all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	GetInputListOnVertices(&pressure[0],PressureEnum);
+-	Input* surface_input=inputs->GetInput(SurfaceEnum); _assert_(surface_input);
+-
+-	this->inputs->GetInputValue(&converged,ConvergedEnum);
+-	if(converged){
+-		/*Convert enthalpy into temperature and water fraction*/
+-		for(i=0;i<numdof;i++){
+-			matpar->EnthalpyToThermal(&temperatures[i],&waterfraction[i],values[i],pressure[i]);
+-			if(waterfraction[i]<0) _error_("Negative water fraction found in solution vector");
+-			//if(waterfraction[i]>1) _error_("Water fraction >1 found in solution vector");
+-		}
+-
+-		this->inputs->AddInput(new PentaInput(EnthalpyEnum,values,P1Enum));
+-		this->inputs->AddInput(new PentaInput(WaterfractionEnum,waterfraction,P1Enum));
+-		this->inputs->AddInput(new PentaInput(TemperatureEnum,temperatures,P1Enum));
+-
+-		/*Update Rheology only if converged (we must make sure that the temperature is below melting point
+-		 * otherwise the rheology could be negative*/
+-		this->parameters->FindParam(&rheology_law,MaterialsRheologyLawEnum);
+-		GetInputListOnVertices(&surface[0],SurfaceEnum);
+-		switch(rheology_law){
+-			case NoneEnum:
+-				/*Do nothing: B is not temperature dependent*/
+-				break;
+-			case PatersonEnum:
+-				for(i=0;i<numdof;i++) B[i]=Paterson(temperatures[i]);
+-				this->material->inputs->AddInput(new PentaInput(MaterialsRheologyBEnum,B,P1Enum));
+-				break;
+-			case ArrheniusEnum:
+-				for(i=0;i<numdof;i++) B[i]=Arrhenius(temperatures[i],surface[i]-xyz_list[i][2],material->GetN());
+-				this->material->inputs->AddInput(new PentaInput(MaterialsRheologyBEnum,B,P1Enum));
+-				break;
+-			case LliboutryDuvalEnum:
+-				for(i=0;i<numdof;i++) B[i]=LliboutryDuval(values[i],pressure[i],material->GetN(),matpar->GetBeta(),matpar->GetReferenceTemperature(),matpar->GetHeatCapacity(),matpar->GetLatentHeat());
+-				this->material->inputs->AddInput(new PentaInput(MaterialsRheologyBEnum,B,P1Enum));
+-				break;
+-			default:
+-				_error_("Rheology law " << EnumToStringx(rheology_law) << " not supported yet");
+-		}
+-	}
+-	else{
+-		this->inputs->AddInput(new PentaInput(EnthalpyPicardEnum,values,P1Enum));
+-	}
+-
+-	/*Free ressources:*/
+-	xDelete<int>(doflist);
+-}
+-/*}}}*/
+ /*FUNCTION Penta::UpdateBasalConstraintsEnthalpy{{{*/
+ void  Penta::UpdateBasalConstraintsEnthalpy(void){
+ 
+@@ -6370,105 +5952,6 @@
+ 	xDelete<int>(control_type);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::InputUpdateFromSolutionAdjointFS {{{*/
+-void  Penta::InputUpdateFromSolutionAdjointFS(IssmDouble* solution){
+-
+-	int          i;
+-	int*         vdoflist=NULL;
+-	int*         pdoflist=NULL;
+-	IssmDouble   FSreconditioning;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumnodes = this->NumberofNodesPressure();
+-	int vnumdof   = vnumnodes*NDOF3;
+-	int pnumdof   = pnumnodes*NDOF1;
+-
+-	/*Initialize values*/
+-	IssmDouble* vvalues = xNew<IssmDouble>(vnumdof);
+-	IssmDouble* pvalues = xNew<IssmDouble>(pnumdof);
+-	IssmDouble* lambdax = xNew<IssmDouble>(vnumnodes);
+-	IssmDouble* lambday = xNew<IssmDouble>(vnumnodes);
+-	IssmDouble* lambdaz = xNew<IssmDouble>(vnumnodes);
+-	IssmDouble* lambdap = xNew<IssmDouble>(pnumnodes);
+-
+-	/*Get dof list: */
+-	GetDofListVelocity(&vdoflist,GsetEnum);
+-	GetDofListPressure(&pdoflist,GsetEnum);
+-
+-	/*Use the dof list to index into the solution vector: */
+-	for(i=0;i<vnumdof;i++) vvalues[i]=solution[vdoflist[i]];
+-	for(i=0;i<pnumdof;i++) pvalues[i]=solution[pdoflist[i]];
+-
+-	/*Transform solution in Cartesian Space*/
+-	::TransformSolutionCoord(&vvalues[0],nodes,vnumnodes,XYZEnum);
+-
+-	/*fill in all arrays: */
+-	for(i=0;i<vnumnodes;i++){
+-		lambdax[i] = vvalues[i*NDOF3+0]; if(xIsNan<IssmDouble>(lambdax[i])) _error_("NaN found in solution vector");
+-		lambday[i] = vvalues[i*NDOF3+1]; if(xIsNan<IssmDouble>(lambday[i])) _error_("NaN found in solution vector");
+-		lambdaz[i] = vvalues[i*NDOF3+2]; if(xIsNan<IssmDouble>(lambdaz[i])) _error_("NaN found in solution vector");
+-	}
+-	for(i=0;i<pnumnodes;i++){
+-		lambdap[i] = pvalues[i]; if(xIsNan<IssmDouble>(lambdap[i])) _error_("NaN found in solution vector");
+-	}
+-
+-	/*Recondition pressure and compute vel: */
+-	this->parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+-	for(i=0;i<pnumnodes;i++) lambdap[i]=lambdap[i]*FSreconditioning;
+-
+-	/*Add vx and vy as inputs to the tria element: */
+-	this->inputs->AddInput(new PentaInput(AdjointxEnum,lambdax,P1Enum));
+-	this->inputs->AddInput(new PentaInput(AdjointyEnum,lambday,P1Enum));
+-	this->inputs->AddInput(new PentaInput(AdjointzEnum,lambdaz,P1Enum));
+-	this->inputs->AddInput(new PentaInput(AdjointpEnum,lambdap,P1Enum));
+-
+-	/*Free ressources:*/
+-	xDelete<int>(vdoflist);
+-	xDelete<int>(pdoflist);
+-	xDelete<IssmDouble>(lambdap);
+-	xDelete<IssmDouble>(lambdaz);
+-	xDelete<IssmDouble>(lambday);
+-	xDelete<IssmDouble>(lambdax);
+-	xDelete<IssmDouble>(vvalues);
+-	xDelete<IssmDouble>(pvalues);
+-}
+-/*}}}*/
+-/*FUNCTION Penta::InputUpdateFromSolutionAdjointHoriz {{{*/
+-void  Penta::InputUpdateFromSolutionAdjointHoriz(IssmDouble* solution){
+-
+-	const int numdof=NDOF2*NUMVERTICES;
+-
+-	int    i;
+-	IssmDouble values[numdof];
+-	IssmDouble lambdax[NUMVERTICES];
+-	IssmDouble lambday[NUMVERTICES];
+-	int*   doflist=NULL;
+-
+-	/*Get dof list: */
+-	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+-
+-	/*Use the dof list to index into the solution vector: */
+-	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+-
+-	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+-	for(i=0;i<NUMVERTICES;i++){
+-		lambdax[i]=values[i*NDOF2+0];
+-		lambday[i]=values[i*NDOF2+1];
+-
+-		/*Check solution*/
+-		if(xIsNan<IssmDouble>(lambdax[i]))       _error_("NaN found in solution vector");
+-		if(xIsNan<IssmDouble>(lambday[i]))       _error_("NaN found in solution vector");
+-	}
+-
+-	/*Add vx and vy as inputs to the tria element: */
+-	this->inputs->AddInput(new PentaInput(AdjointxEnum,lambdax,P1Enum));
+-	this->inputs->AddInput(new PentaInput(AdjointyEnum,lambday,P1Enum));
+-
+-	/*Free ressources:*/
+-	xDelete<int>(doflist);
+-}
+-/*}}}*/
+ /*FUNCTION Penta::SurfaceAverageVelMisfit {{{*/
+ IssmDouble Penta::SurfaceAverageVelMisfit(void){
+ 
+@@ -9847,827 +9330,6 @@
+ 	return; 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::InputUpdateFromSolutionStressbalanceHoriz {{{*/
+-void  Penta::InputUpdateFromSolutionStressbalanceHoriz(IssmDouble* solution){
+-
+-	int  approximation;
+-
+-	/*Recover inputs*/
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-
+-	/*SSA, everything is done by the element on bed*/
+-	if (approximation==SSAApproximationEnum){
+-		if (!IsOnBed()){
+-			/*Do nothing. Element on bed will take care of it*/
+-			return;
+-		}
+-		else{
+-			InputUpdateFromSolutionStressbalanceSSA(solution);
+-			return;
+-		}
+-	}
+-	if (approximation==L1L2ApproximationEnum){
+-		if (!IsOnBed()) return;
+-		InputUpdateFromSolutionStressbalanceL1L2(solution);
+-		return;
+-	}
+-	else if (approximation==HOApproximationEnum){
+-		InputUpdateFromSolutionStressbalanceHO(solution);
+-	}
+-	else if (approximation==HOFSApproximationEnum){
+-		InputUpdateFromSolutionStressbalanceHOFS(solution);
+-	}
+-	else if (approximation==SSAFSApproximationEnum){
+-		InputUpdateFromSolutionStressbalanceSSAFS(solution);
+-	}
+-	else if (approximation==FSApproximationEnum || approximation==NoneApproximationEnum){
+-		InputUpdateFromSolutionStressbalanceFS(solution);
+-	}
+-	else if (approximation==SSAHOApproximationEnum){
+-		InputUpdateFromSolutionStressbalanceSSAHO(solution);
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION Penta::InputUpdateFromSolutionStressbalanceSSA {{{*/
+-void  Penta::InputUpdateFromSolutionStressbalanceSSA(IssmDouble* solution){
+-
+-	int         numnodes = this->NumberofNodes();
+-	int         numdof   = NDOF2*numnodes;
+-
+-	int         i;
+-	IssmDouble  rho_ice,g;
+-	IssmDouble  values[2*NUMVERTICES];
+-	IssmDouble  vx[NUMVERTICES];
+-	IssmDouble  vy[NUMVERTICES];
+-	IssmDouble  vz[NUMVERTICES];
+-	IssmDouble  vel[NUMVERTICES];
+-	IssmDouble  pressure[NUMVERTICES];
+-	IssmDouble  surface[NUMVERTICES];
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	int        *doflist = NULL;
+-	Penta      *penta   = NULL;
+-
+-	/*Get dof list: */
+-	GetDofList(&doflist,SSAApproximationEnum,GsetEnum);
+-
+-	/*Use the dof list to index into the solution vector: */
+-	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+-
+-	/*Transform solution in Cartesian Space*/
+-	::TransformSolutionCoord(&values[0],nodes,NUMVERTICES2D,XYEnum); /*2D: only the first 3 nodes are taken*/
+-
+-	/*Ok, we have vx and vy in values, fill in vx and vy arrays and extrude */
+-	for(i=0;i<3;i++){
+-		vx[i]  =values[i*NDOF2+0];
+-		vy[i]  =values[i*NDOF2+1];
+-		vx[i+3]=vx[i];
+-		vy[i+3]=vy[i];
+-
+-		/*Check solution*/
+-		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
+-		if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
+-	}
+-
+-	/*Get parameters fro pressure computation*/
+-	rho_ice=matpar->GetRhoIce();
+-	g=matpar->GetG();
+-
+-	/*Start looping over all elements above current element and update all inputs*/
+-	penta=this;
+-	for(;;){
+-
+-		/*Get node data: */
+-		::GetVerticesCoordinates(&xyz_list[0][0],penta->vertices,NUMVERTICES);
+-
+-		/*Now Compute vel*/
+-		GetInputListOnVertices(&vz[0],VzEnum,0.0); //default is 0
+-		for(i=0;i<NUMVERTICES;i++) vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5);
+-
+-		/*Now compute pressure*/
+-		GetInputListOnVertices(&surface[0],SurfaceEnum);
+-		for(i=0;i<NUMVERTICES;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i][2]);
+-
+-		/*Now, we have to move the previous Vx and Vy inputs  to old 
+-		 * status, otherwise, we'll wipe them off: */
+-		penta->inputs->ChangeEnum(VxEnum,VxPicardEnum);
+-		penta->inputs->ChangeEnum(VyEnum,VyPicardEnum);
+-		penta->inputs->ChangeEnum(PressureEnum,PressurePicardEnum);
+-
+-		/*Add vx and vy as inputs to the tria element: */
+-		penta->inputs->AddInput(new PentaInput(VxEnum,vx,P1Enum));
+-		penta->inputs->AddInput(new PentaInput(VyEnum,vy,P1Enum));
+-		penta->inputs->AddInput(new PentaInput(VelEnum,vel,P1Enum));
+-		penta->inputs->AddInput(new PentaInput(PressureEnum,pressure,P1Enum));
+-
+-		/*Stop if we have reached the surface*/
+-		if (penta->IsOnSurface()) break;
+-
+-		/* get upper Penta*/
+-		penta=penta->GetUpperElement(); _assert_(penta->Id()!=this->id);
+-	}
+-
+-	/*Free ressources:*/
+-	xDelete<int>(doflist);
+-}
+-/*}}}*/
+-/*FUNCTION Penta::InputUpdateFromSolutionStressbalanceSSAHO {{{*/
+-void  Penta::InputUpdateFromSolutionStressbalanceSSAHO(IssmDouble* solution){
+-
+-	const int    numdof=NDOF2*NUMVERTICES;
+-	const int    numdof2d=NDOF2*NUMVERTICES2D;
+-
+-	int     i;
+-	IssmDouble  rho_ice,g;
+-	IssmDouble  SSA_values[numdof];
+-	IssmDouble  HO_values[numdof];
+-	IssmDouble  vx[NUMVERTICES];
+-	IssmDouble  vy[NUMVERTICES];
+-	IssmDouble  vz[NUMVERTICES];
+-	IssmDouble  vel[NUMVERTICES];
+-	IssmDouble  pressure[NUMVERTICES];
+-	IssmDouble  surface[NUMVERTICES];
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	int*    doflistp = NULL;
+-	int*    doflistm = NULL;
+-	Penta   *penta   = NULL;
+-
+-	/*OK, we have to add results of this element for HO 
+-	 * and results from the penta at base for SSA. Now recover results*/
+-	penta=(Penta*)GetBasalElement();
+-
+-	/*Get dof listof this element (HO dofs) and of the penta at base (SSA dofs): */
+-	GetDofList(&doflistp,HOApproximationEnum,GsetEnum);
+-	penta->GetDofList(&doflistm,SSAApproximationEnum,GsetEnum);
+-
+-	/*Get node data: */
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-
+-	/*Use the dof list to index into the solution vector: */
+-	for(i=0;i<numdof2d;i++){
+-		HO_values[i]=solution[doflistp[i]];
+-		SSA_values[i]=solution[doflistm[i]];
+-	}
+-	for(i=numdof2d;i<numdof;i++){
+-		HO_values[i]=solution[doflistp[i]];
+-		SSA_values[i]=SSA_values[i-numdof2d];
+-	}
+-
+-	/*Transform solution in Cartesian Space*/
+-	::TransformSolutionCoord(&SSA_values[0],penta->nodes,NUMVERTICES,XYEnum);
+-	::TransformSolutionCoord(&HO_values[0],   this->nodes,NUMVERTICES,XYEnum);
+-
+-	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+-	for(i=0;i<NUMVERTICES;i++){
+-		vx[i]=SSA_values[i*NDOF2+0]+HO_values[i*NDOF2+0];
+-		vy[i]=SSA_values[i*NDOF2+1]+HO_values[i*NDOF2+1];
+-
+-		/*Check solution*/
+-		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
+-		if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
+-	}
+-
+-	/*Now Compute vel*/
+-	GetInputListOnVertices(&vz[0],VzEnum,0.0); //default is 0
+-	for(i=0;i<NUMVERTICES;i++) vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5);
+-
+-	/*For pressure: we have not computed pressure in this analysis, for this element. We are in 3D, 
+-	 *so the pressure is just the pressure at the z elevation: */
+-	rho_ice=matpar->GetRhoIce();
+-	g=matpar->GetG();
+-	GetInputListOnVertices(&surface[0],SurfaceEnum);
+-	for(i=0;i<NUMVERTICES;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i][2]);
+-
+-	/*Now, we have to move the previous Vx and Vy inputs  to old 
+-	 * status, otherwise, we'll wipe them off: */
+-	this->inputs->ChangeEnum(VxEnum,VxPicardEnum);
+-	this->inputs->ChangeEnum(VyEnum,VyPicardEnum);
+-	this->inputs->ChangeEnum(PressureEnum,PressurePicardEnum);
+-
+-	/*Add vx and vy as inputs to the tria element: */
+-	this->inputs->AddInput(new PentaInput(VxEnum,vx,P1Enum));
+-	this->inputs->AddInput(new PentaInput(VyEnum,vy,P1Enum));
+-	this->inputs->AddInput(new PentaInput(VelEnum,vel,P1Enum));
+-	this->inputs->AddInput(new PentaInput(PressureEnum,pressure,P1Enum));
+-
+-	/*Free ressources:*/
+-	xDelete<int>(doflistp);
+-	xDelete<int>(doflistm);
+-}
+-/*}}}*/
+-/*FUNCTION Penta::InputUpdateFromSolutionStressbalanceSSAFS {{{*/
+-void  Penta::InputUpdateFromSolutionStressbalanceSSAFS(IssmDouble* solution){
+-
+-	const int    numdofSSA = NDOF2*NUMVERTICES;
+-	const int    numdof2d  = NDOF2*NUMVERTICES2D;
+-	const int    numdofFSv = NDOF3*NUMVERTICES;
+-	const int    numdofFSp = NDOF1*NUMVERTICES;
+-
+-	int     i;
+-	IssmDouble  FSreconditioning;
+-	IssmDouble  SSA_values[numdofSSA];
+-	IssmDouble  FS_values[numdofFSv+numdofFSp];
+-	IssmDouble  vx[NUMVERTICES];
+-	IssmDouble  vy[NUMVERTICES];
+-	IssmDouble  vz[NUMVERTICES];
+-	IssmDouble  vzSSA[NUMVERTICES];
+-	IssmDouble  vzFS[NUMVERTICES];
+-	IssmDouble  vel[NUMVERTICES];
+-	IssmDouble  pressure[NUMVERTICES];
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	int   *doflistSSA = NULL;
+-	int   *doflistFSv = NULL;
+-	int   *doflistFSp = NULL;
+-	Penta *penta      = NULL;
+-
+-	/*Prepare coordinate system list*/
+-	int* cs_list = xNew<int>(2*NUMVERTICES);
+-	for(i=0;i<NUMVERTICES;i++) cs_list[i]             = XYZEnum;
+-	for(i=0;i<NUMVERTICES;i++) cs_list[NUMVERTICES+i] = PressureEnum;
+-
+-	/*OK, we have to add results of this element for SSA 
+-	 * and results from the penta at base for SSA. Now recover results*/
+-	penta=(Penta*)GetBasalElement();
+-
+-	/*Get dof listof this element (SSA dofs) and of the penta at base (SSA dofs): */
+-	penta->GetDofList(&doflistSSA,SSAApproximationEnum,GsetEnum);
+-	GetDofList(&doflistFSv,FSvelocityEnum,GsetEnum);
+-	GetDofListPressure(&doflistFSp,GsetEnum);
+-	this->parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+-
+-	/*Get node data: */
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-
+-	/*Use the dof list to index into the solution vector: */
+-	for(i=0;i<numdof2d;i++){
+-		SSA_values[i]=solution[doflistSSA[i]];
+-		SSA_values[i+numdof2d]=solution[doflistSSA[i]];
+-	}
+-	for(i=0;i<numdofFSv;i++) FS_values[i]=solution[doflistFSv[i]];
+-	for(i=0;i<numdofFSp;i++) FS_values[numdofFSv+i]=solution[doflistFSp[i]];
+-
+-	/*Transform solution in Cartesian Space*/
+-	::TransformSolutionCoord(&SSA_values[0],this->nodes,NUMVERTICES,XYEnum);
+-	::TransformSolutionCoord(&FS_values[0],this->nodes,2*NUMVERTICES,cs_list);
+-
+-	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+-	for(i=0;i<NUMVERTICES;i++){
+-		vx[i]       = FS_values[i*NDOF3+0]+SSA_values[i*NDOF2+0];
+-		vy[i]       = FS_values[i*NDOF3+1]+SSA_values[i*NDOF2+1];
+-		vzFS[i]     = FS_values[i*NDOF3+2];
+-		pressure[i] = FS_values[NUMVERTICES*NDOF3+i]*FSreconditioning;
+-
+-		/*Check solution*/
+-		if(xIsNan<IssmDouble>(vx[i]))       _error_("NaN found in solution vector");
+-		if(xIsNan<IssmDouble>(vy[i]))       _error_("NaN found in solution vector");
+-		if(xIsNan<IssmDouble>(vzFS[i]))     _error_("NaN found in solution vector");
+-		if(xIsNan<IssmDouble>(pressure[i])) _error_("NaN found in solution vector");
+-	}
+-
+-	/*Get Vz*/
+-	Input* vzSSA_input=inputs->GetInput(VzSSAEnum);
+-	if (vzSSA_input){
+-		if (vzSSA_input->ObjectEnum()!=PentaInputEnum){
+-			_error_("Cannot compute Vel as VzSSA is of type " << EnumToStringx(vzSSA_input->ObjectEnum()));
+-		}
+-		GetInputListOnVertices(&vzSSA[0],VzSSAEnum);
+-	}
+-	else{
+-		_error_("Cannot update solution as VzSSA is not present");
+-	}
+-
+-	/*Now Compute vel*/
+-	for(i=0;i<NUMVERTICES;i++) {
+-		vz[i]  = vzSSA[i]+vzFS[i];
+-		vel[i] = sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
+-	}
+-
+-	/*Now, we have to move the previous Vx and Vy inputs  to old 
+-	 * status, otherwise, we'll wipe them off: */
+-	this->inputs->ChangeEnum(VxEnum,VxPicardEnum);
+-	this->inputs->ChangeEnum(VyEnum,VyPicardEnum);
+-	this->inputs->ChangeEnum(VzEnum,VzPicardEnum);
+-	this->inputs->ChangeEnum(PressureEnum,PressurePicardEnum);
+-
+-	/*Add vx and vy as inputs to the tria element: */
+-	this->inputs->AddInput(new PentaInput(VxEnum,vx,P1Enum));
+-	this->inputs->AddInput(new PentaInput(VyEnum,vy,P1Enum));
+-	this->inputs->AddInput(new PentaInput(VzEnum,vz,P1Enum));
+-	this->inputs->AddInput(new PentaInput(VzFSEnum,vzFS,P1Enum));
+-	this->inputs->AddInput(new PentaInput(VelEnum,vel,P1Enum));
+-	this->inputs->AddInput(new PentaInput(PressureEnum,pressure,P1Enum));
+-
+-	/*Free ressources:*/
+-	xDelete<int>(doflistSSA);
+-	xDelete<int>(doflistFSv);
+-	xDelete<int>(doflistFSp);
+-	xDelete<int>(cs_list);
+-}
+-/*}}}*/
+-/*FUNCTION Penta::InputUpdateFromSolutionStressbalanceL1L2 {{{*/
+-void  Penta::InputUpdateFromSolutionStressbalanceL1L2(IssmDouble* solution){
+-
+-	const int    numdof=NDOF2*NUMVERTICES;
+-
+-	int     i;
+-	IssmDouble  rho_ice,g;
+-	IssmDouble  values[numdof];
+-	IssmDouble  vx[NUMVERTICES];
+-	IssmDouble  vy[NUMVERTICES];
+-	IssmDouble  vz[NUMVERTICES];
+-	IssmDouble  vel[NUMVERTICES];
+-	IssmDouble  pressure[NUMVERTICES];
+-	IssmDouble  surface[NUMVERTICES];
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	int    *doflist = NULL;
+-	Penta  *penta   = NULL;
+-
+-	/*Get dof list: */
+-	GetDofList(&doflist,L1L2ApproximationEnum,GsetEnum);
+-
+-	/*Use the dof list to index into the solution vector: */
+-	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+-
+-	/*Transform solution in Cartesian Space*/
+-	::TransformSolutionCoord(&values[0],nodes,NUMVERTICES2D,XYEnum); /*2D: only the first 3 nodes are taken*/
+-
+-	/*Ok, we have vx and vy in values, fill in vx and vy arrays and extrude */
+-	for(i=0;i<3;i++){
+-		vx[i]  =values[i*NDOF2+0];
+-		vy[i]  =values[i*NDOF2+1];
+-		vx[i+3]=vx[i];
+-		vy[i+3]=vy[i];
+-
+-		/*Check solution*/
+-		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
+-		if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
+-	}
+-
+-	/*Get parameters fro pressure computation*/
+-	rho_ice=matpar->GetRhoIce();
+-	g=matpar->GetG();
+-
+-	/*Start looping over all elements above current element and update all inputs*/
+-	penta=this;
+-	for(;;){
+-
+-		/*Get node data: */
+-		::GetVerticesCoordinates(&xyz_list[0][0],penta->vertices,NUMVERTICES);
+-
+-		/*Now Compute vel*/
+-		GetInputListOnVertices(&vz[0],VzEnum,0.0); //default is 0
+-		for(i=0;i<NUMVERTICES;i++) vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5);
+-
+-		/*Now compute pressure*/
+-		GetInputListOnVertices(&surface[0],SurfaceEnum);
+-		for(i=0;i<NUMVERTICES;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i][2]);
+-
+-		/*Now, we have to move the previous Vx and Vy inputs  to old 
+-		 * status, otherwise, we'll wipe them off: */
+-		penta->inputs->ChangeEnum(VxEnum,VxPicardEnum);
+-		penta->inputs->ChangeEnum(VyEnum,VyPicardEnum);
+-		penta->inputs->ChangeEnum(PressureEnum,PressurePicardEnum);
+-
+-		/*Add vx and vy as inputs to the tria element: */
+-		penta->inputs->AddInput(new PentaInput(VxEnum,vx,P1Enum));
+-		penta->inputs->AddInput(new PentaInput(VyEnum,vy,P1Enum));
+-		penta->inputs->AddInput(new PentaInput(VelEnum,vel,P1Enum));
+-		penta->inputs->AddInput(new PentaInput(PressureEnum,pressure,P1Enum));
+-
+-		/*Stop if we have reached the surface*/
+-		if (penta->IsOnSurface()) break;
+-
+-		/* get upper Penta*/
+-		penta=penta->GetUpperElement(); _assert_(penta->Id()!=this->id);
+-	}
+-
+-	/*Free ressources:*/
+-	xDelete<int>(doflist);
+-}
+-/*}}}*/
+-/*FUNCTION Penta::InputUpdateFromSolutionStressbalanceHO {{{*/
+-void  Penta::InputUpdateFromSolutionStressbalanceHO(IssmDouble* solution){
+-
+-	int         i;
+-	IssmDouble  rho_ice,g;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	int        *doflist = NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-	int numdof   = numnodes*NDOF2;
+-
+-	/*Fetch dof list and allocate solution vectors*/
+-	GetDofList(&doflist,HOApproximationEnum,GsetEnum);
+-	IssmDouble* values    = xNew<IssmDouble>(numdof);
+-	IssmDouble* vx        = xNew<IssmDouble>(numnodes);
+-	IssmDouble* vy        = xNew<IssmDouble>(numnodes);
+-	IssmDouble* vz        = xNew<IssmDouble>(numnodes);
+-	IssmDouble* vel       = xNew<IssmDouble>(numnodes);
+-	IssmDouble* pressure  = xNew<IssmDouble>(numnodes);
+-	IssmDouble* surface   = xNew<IssmDouble>(numnodes);
+-
+-	/*Use the dof list to index into the solution vector: */
+-	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+-
+-	/*Transform solution in Cartesian Space*/
+-	::TransformSolutionCoord(&values[0],nodes,NUMVERTICES,XYEnum);
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-
+-	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+-	for(i=0;i<numnodes;i++){
+-		vx[i]=values[i*NDOF2+0];
+-		vy[i]=values[i*NDOF2+1];
+-
+-		/*Check solution*/
+-		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
+-		if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
+-	}
+-
+-	/*Get Vz and compute vel*/
+-	GetInputListOnNodes(&vz[0],VzEnum,0.);
+-	for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
+-
+-	/*For pressure: we have not computed pressure in this analysis, for this element. We are in 3D, 
+-	 *so the pressure is just the pressure at the z elevation: */
+-	rho_ice=matpar->GetRhoIce();
+-	g=matpar->GetG();
+-	GetInputListOnVertices(&surface[0],SurfaceEnum);
+-	for(i=0;i<NUMVERTICES;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i][2]);
+-
+-	/*Now, we have to move the previous Vx and Vy inputs  to old 
+-	 * status, otherwise, we'll wipe them off: */
+-	this->inputs->ChangeEnum(VxEnum,VxPicardEnum);
+-	this->inputs->ChangeEnum(VyEnum,VyPicardEnum);
+-	this->inputs->ChangeEnum(PressureEnum,PressurePicardEnum);
+-
+-	/*Add vx and vy as inputs to the tria element: */
+-	this->inputs->AddInput(new PentaInput(VxEnum,vx,P1Enum));
+-	this->inputs->AddInput(new PentaInput(VyEnum,vy,P1Enum));
+-	this->inputs->AddInput(new PentaInput(VelEnum,vel,P1Enum));
+-	this->inputs->AddInput(new PentaInput(PressureEnum,pressure,P1Enum));
+-
+-	/*Free ressources:*/
+-	xDelete<IssmDouble>(surface);
+-	xDelete<IssmDouble>(pressure);
+-	xDelete<IssmDouble>(vel);
+-	xDelete<IssmDouble>(vz);
+-	xDelete<IssmDouble>(vy);
+-	xDelete<IssmDouble>(vx);
+-	xDelete<IssmDouble>(values);
+-	xDelete<int>(doflist);
+-}
+-/*}}}*/
+-/*FUNCTION Penta::InputUpdateFromSolutionStressbalanceHOFS {{{*/
+-void  Penta::InputUpdateFromSolutionStressbalanceHOFS(IssmDouble* solution){
+-
+-	const int    numdofHO  = NDOF2*NUMVERTICES;
+-	const int    numdofFSv = NDOF3*NUMVERTICES;
+-	const int    numdofFSp = NDOF1*NUMVERTICES;
+-
+-	int        i;
+-	IssmDouble HO_values[numdofHO];
+-	IssmDouble FS_values[numdofFSv+numdofFSp];
+-	IssmDouble vx[NUMVERTICES];
+-	IssmDouble vy[NUMVERTICES];
+-	IssmDouble vz[NUMVERTICES];
+-	IssmDouble vzHO[NUMVERTICES];
+-	IssmDouble vzFS[NUMVERTICES];
+-	IssmDouble vel[NUMVERTICES];
+-	IssmDouble pressure[NUMVERTICES];
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble FSreconditioning;
+-	int*       doflistHO        = NULL;
+-	int*       doflistFSv        = NULL;
+-	int*       doflistFSp = NULL;
+-
+-	/*Prepare coordinate system list*/
+-	int* cs_list = xNew<int>(2*NUMVERTICES);
+-	for(i=0;i<NUMVERTICES;i++) cs_list[i]             = XYZEnum;
+-	for(i=0;i<NUMVERTICES;i++) cs_list[NUMVERTICES+i] = PressureEnum;
+-
+-	/*Get dof listof this element (HO dofs) and of the penta at base (SSA dofs): */
+-	GetDofList(&doflistHO,HOApproximationEnum,GsetEnum);
+-	GetDofList(&doflistFSv,FSvelocityEnum,GsetEnum);
+-	GetDofListPressure(&doflistFSp,GsetEnum);
+-	this->parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+-
+-	/*Get node data: */
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-
+-	/*Use the dof list to index into the solution vector: */
+-	for(i=0;i<numdofHO;i++)  HO_values[i]=solution[doflistHO[i]];
+-	for(i=0;i<numdofFSv;i++) FS_values[i]=solution[doflistFSv[i]];
+-	for(i=0;i<numdofFSp;i++) FS_values[numdofFSv+i]=solution[doflistFSp[i]];
+-
+-	/*Transform solution in Cartesian Space*/
+-	::TransformSolutionCoord(&HO_values[0],this->nodes,NUMVERTICES,XYEnum);
+-	::TransformSolutionCoord(&FS_values[0],this->nodes,2*NUMVERTICES,cs_list);
+-
+-	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+-	for(i=0;i<NUMVERTICES;i++){
+-		vx[i]       = FS_values[i*NDOF3+0]+HO_values[i*NDOF2+0];
+-		vy[i]       = FS_values[i*NDOF3+1]+HO_values[i*NDOF2+1];
+-		vzFS[i]     = FS_values[i*NDOF3+2];
+-		pressure[i] = FS_values[NUMVERTICES*NDOF3+i]*FSreconditioning;
+-
+-		/*Check solution*/
+-		if(xIsNan<IssmDouble>(vx[i]))       _error_("NaN found in solution vector");
+-		if(xIsNan<IssmDouble>(vy[i]))       _error_("NaN found in solution vector");
+-		if(xIsNan<IssmDouble>(vzFS[i]))     _error_("NaN found in solution vector");
+-		if(xIsNan<IssmDouble>(pressure[i])) _error_("NaN found in solution vector");
+-	}
+-
+-	/*Get Vz*/
+-	Input* vzHO_input=inputs->GetInput(VzHOEnum);
+-	if (vzHO_input){
+-		if (vzHO_input->ObjectEnum()!=PentaInputEnum){
+-			_error_("Cannot compute Vel as VzHO is of type " << EnumToStringx(vzHO_input->ObjectEnum()));
+-		}
+-		GetInputListOnVertices(&vzHO[0],VzHOEnum);
+-	}
+-	else{
+-		_error_("Cannot update solution as VzHO is not present");
+-	}
+-
+-	/*Now Compute vel*/
+-	for(i=0;i<NUMVERTICES;i++) {
+-		vz[i]  = vzHO[i]+vzFS[i];
+-		vel[i] = sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
+-	}
+-
+-	/*Now, we have to move the previous Vx and Vy inputs  to old 
+-	 * status, otherwise, we'll wipe them off: */
+-	this->inputs->ChangeEnum(VxEnum,VxPicardEnum);
+-	this->inputs->ChangeEnum(VyEnum,VyPicardEnum);
+-	this->inputs->ChangeEnum(VzEnum,VzPicardEnum);
+-	this->inputs->ChangeEnum(PressureEnum,PressurePicardEnum);
+-
+-	/*Add vx and vy as inputs to the tria element: */
+-	this->inputs->AddInput(new PentaInput(VxEnum,vx,P1Enum));
+-	this->inputs->AddInput(new PentaInput(VyEnum,vy,P1Enum));
+-	this->inputs->AddInput(new PentaInput(VzEnum,vz,P1Enum));
+-	this->inputs->AddInput(new PentaInput(VzFSEnum,vzFS,P1Enum));
+-	this->inputs->AddInput(new PentaInput(VelEnum,vel,P1Enum));
+-	this->inputs->AddInput(new PentaInput(PressureEnum,pressure,P1Enum));
+-
+-	/*Free ressources:*/
+-	xDelete<int>(doflistHO);
+-	xDelete<int>(doflistFSv);
+-	xDelete<int>(doflistFSp);
+-	xDelete<int>(cs_list);
+-}
+-/*}}}*/
+-/*FUNCTION Penta::InputUpdateFromSolutionStressbalanceSIA {{{*/
+-void  Penta::InputUpdateFromSolutionStressbalanceSIA(IssmDouble* solution){
+-
+-	int         numnodes = this->NumberofNodes();
+-	int         numdof=NDOF2*numnodes;
+-
+-	int     i;
+-	IssmDouble  rho_ice,g;
+-	IssmDouble  values[numdof];
+-	IssmDouble  vx[NUMVERTICES];
+-	IssmDouble  vy[NUMVERTICES];
+-	IssmDouble  vz[NUMVERTICES];
+-	IssmDouble  vel[NUMVERTICES];
+-	IssmDouble  pressure[NUMVERTICES];
+-	IssmDouble  surface[NUMVERTICES];
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	int*    doflist = NULL;
+-
+-	/*Get dof list: */
+-	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+-
+-	/*Get node data: */
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-
+-	/*Use the dof list to index into the solution vector: */
+-	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+-
+-	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+-	for(i=0;i<NUMVERTICES;i++){
+-		vx[i]=values[i*NDOF2+0];
+-		vy[i]=values[i*NDOF2+1];
+-
+-		/*Check solution*/
+-		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
+-		if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
+-	}
+-
+-	/*Now Compute vel*/
+-	GetInputListOnVertices(&vz[0],VzEnum,0.0); //default is 0
+-	for(i=0;i<NUMVERTICES;i++) vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5);
+-
+-	/*For pressure: we have not computed pressure in this analysis, for this element. We are in 3D, 
+-	 *so the pressure is just the pressure at the z elevation: */
+-	rho_ice=matpar->GetRhoIce();
+-	g=matpar->GetG();
+-	GetInputListOnVertices(&surface[0],SurfaceEnum);
+-	for(i=0;i<NUMVERTICES;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i][2]);
+-
+-	/*Now, we have to move the previous Vx and Vy inputs  to old 
+-	 * status, otherwise, we'll wipe them off: */
+-	this->inputs->ChangeEnum(VxEnum,VxPicardEnum);
+-	this->inputs->ChangeEnum(VyEnum,VyPicardEnum);
+-	this->inputs->ChangeEnum(PressureEnum,PressurePicardEnum);
+-
+-	/*Add vx and vy as inputs to the tria element: */
+-	this->inputs->AddInput(new PentaInput(VxEnum,vx,P1Enum));
+-	this->inputs->AddInput(new PentaInput(VyEnum,vy,P1Enum));
+-	this->inputs->AddInput(new PentaInput(VelEnum,vel,P1Enum));
+-	this->inputs->AddInput(new PentaInput(PressureEnum,pressure,P1Enum));
+-
+-	/*Free ressources:*/
+-	xDelete<int>(doflist);
+-}
+-/*}}}*/
+-/*FUNCTION Penta::InputUpdateFromSolutionStressbalanceVert {{{*/
+-void  Penta::InputUpdateFromSolutionStressbalanceVert(IssmDouble* solution){
+-
+-	int          numnodes = this->NumberofNodes();
+-	int          numdof=NDOF1*numnodes;
+-
+-	int          i;
+-	int          approximation;
+-	IssmDouble   rho_ice,g;
+-	IssmDouble   values[numdof];
+-	IssmDouble   vx[NUMVERTICES];
+-	IssmDouble   vy[NUMVERTICES];
+-	IssmDouble   vz[NUMVERTICES];
+-	IssmDouble   vzSSA[NUMVERTICES];
+-	IssmDouble   vzHO[NUMVERTICES];
+-	IssmDouble   vzFS[NUMVERTICES];
+-	IssmDouble   vel[NUMVERTICES];
+-	IssmDouble   pressure[NUMVERTICES];
+-	IssmDouble   surface[NUMVERTICES];
+-	IssmDouble   xyz_list[NUMVERTICES][3];
+-	int*         doflist      = NULL;
+-
+-	/*Get the approximation and do nothing if the element in FS or None*/
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-	if(approximation==FSApproximationEnum || approximation==NoneApproximationEnum){
+-		return;
+-	}
+-
+-	/*Get dof list and vertices coordinates: */
+-	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-
+-	/*Use the dof list to index into the solution vector vz: */
+-	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+-	for(i=0;i<NUMVERTICES;i++){
+-		vz[i]=values[i*NDOF1+0];
+-
+-		/*Check solution*/
+-		if(xIsNan<IssmDouble>(vz[i])) _error_("NaN found in solution vector");
+-	}
+-
+-	/*Get Vx and Vy*/
+-	GetInputListOnVertices(&vx[0],VxEnum,0.0); //default is 0
+-	GetInputListOnVertices(&vy[0],VyEnum,0.0); //default is 0
+-
+-	/*Do some modifications if we actually have a HOFS or SSAFS element*/
+-	if(approximation==HOFSApproximationEnum){
+-		Input* vzFS_input=inputs->GetInput(VzFSEnum);
+-		if (vzFS_input){
+-			if (vzFS_input->ObjectEnum()!=PentaInputEnum) _error_("Cannot compute Vel as VzFS is of type " << EnumToStringx(vzFS_input->ObjectEnum()));
+-			GetInputListOnVertices(&vzFS[0],VzFSEnum);
+-		}
+-		else _error_("Cannot compute Vz as VzFS in not present in HOFS element");
+-		for(i=0;i<NUMVERTICES;i++){
+-			vzHO[i]=vz[i];
+-			vz[i]=vzHO[i]+vzFS[i];
+-		}
+-	}
+-	else if(approximation==SSAFSApproximationEnum){
+-		Input* vzFS_input=inputs->GetInput(VzFSEnum);
+-		if (vzFS_input){
+-			if (vzFS_input->ObjectEnum()!=PentaInputEnum) _error_("Cannot compute Vel as VzFS is of type " << EnumToStringx(vzFS_input->ObjectEnum()));
+-			GetInputListOnVertices(&vzFS[0],VzFSEnum);
+-		}
+-		else _error_("Cannot compute Vz as VzFS in not present in SSAFS element");
+-		for(i=0;i<NUMVERTICES;i++){
+-			vzSSA[i]=vz[i];
+-			vz[i]=vzSSA[i]+vzFS[i];
+-		}
+-	}
+-
+-	/*Now Compute vel*/
+-	for(i=0;i<NUMVERTICES;i++) vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5);
+-
+-	/*For pressure: we have not computed pressure in this analysis, for this element. We are in 3D, 
+-	 *so the pressure is just the pressure at the z elevation: except it this is a HOFS element */
+-	if(approximation!=HOFSApproximationEnum &&  approximation!=SSAFSApproximationEnum){
+-		rho_ice=matpar->GetRhoIce();
+-		g=matpar->GetG();
+-		GetInputListOnVertices(&surface[0],SurfaceEnum);
+-		for(i=0;i<NUMVERTICES;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i][2]);
+-	}
+-
+-	/*Now, we have to move the previous Vz inputs to old 
+-	 * status, otherwise, we'll wipe them off and add the new inputs: */
+-	this->inputs->ChangeEnum(VzEnum,VzPicardEnum);
+-
+-	if(approximation!=HOFSApproximationEnum && approximation!=SSAFSApproximationEnum){
+-		this->inputs->ChangeEnum(PressureEnum,PressurePicardEnum);
+-		this->inputs->AddInput(new PentaInput(PressureEnum,pressure,P1Enum));
+-	}
+-	else if(approximation==HOFSApproximationEnum){
+-		this->inputs->AddInput(new PentaInput(VzHOEnum,vzHO,P1Enum));
+-	}
+-	else if(approximation==SSAFSApproximationEnum){
+-		this->inputs->AddInput(new PentaInput(VzSSAEnum,vzSSA,P1Enum));
+-	}
+-	this->inputs->AddInput(new PentaInput(VzEnum,vz,P1Enum));
+-	this->inputs->AddInput(new PentaInput(VelEnum,vel,P1Enum));
+-
+-	/*Free ressources:*/
+-	xDelete<int>(doflist);
+-}
+-/*}}}*/
+-/*FUNCTION Penta::InputUpdateFromSolutionStressbalanceFS {{{*/
+-void  Penta::InputUpdateFromSolutionStressbalanceFS(IssmDouble* solution){
+-
+-	int          i;
+-	int*         vdoflist=NULL;
+-	int*         pdoflist=NULL;
+-	IssmDouble   FSreconditioning;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumnodes = this->NumberofNodesPressure();
+-	int vnumdof   = vnumnodes*NDOF3;
+-	int pnumdof   = pnumnodes*NDOF1;
+-
+-	/*Initialize values*/
+-	IssmDouble* values   = xNew<IssmDouble>(vnumdof+pnumdof);
+-	IssmDouble* vx       = xNew<IssmDouble>(vnumnodes);
+-	IssmDouble* vy       = xNew<IssmDouble>(vnumnodes);
+-	IssmDouble* vz       = xNew<IssmDouble>(vnumnodes);
+-	IssmDouble* vel      = xNew<IssmDouble>(vnumnodes);
+-	IssmDouble* pressure = xNew<IssmDouble>(pnumnodes);
+-
+-	/*Prepare coordinate system list*/
+-	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+-	for(i=0;i<vnumnodes;i++) cs_list[i]           = XYZEnum;
+-	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
+-
+-	/*Get dof list: */
+-	GetDofListVelocity(&vdoflist,GsetEnum);
+-	GetDofListPressure(&pdoflist,GsetEnum);
+-
+-	/*Use the dof list to index into the solution vector: */
+-	for(i=0;i<vnumdof;i++) values[i]        =solution[vdoflist[i]];
+-	for(i=0;i<pnumdof;i++) values[vnumdof+i]=solution[pdoflist[i]];
+-
+-	/*Transform solution in Cartesian Space*/
+-	::TransformSolutionCoord(&values[0],nodes,vnumnodes+pnumdof,cs_list);
+-
+-	/*Ok, we have vx and vy in values, fill in all arrays: */
+-	for(i=0;i<vnumnodes;i++){
+-		vx[i] = values[i*NDOF3+0];
+-		vy[i] = values[i*NDOF3+1];
+-		vz[i] = values[i*NDOF3+2];
+-		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
+-		if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
+-		if(xIsNan<IssmDouble>(vz[i])) _error_("NaN found in solution vector");
+-	}
+-	for(i=0;i<pnumnodes;i++){
+-		pressure[i] = values[vnumdof+i];
+-		if(xIsNan<IssmDouble>(pressure[i])) _error_("NaN found in solution vector");
+-	}
+-
+-	/*Recondition pressure and compute vel: */
+-	this->parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+-	for(i = 0;i<pnumnodes;i++) pressure[i] = pressure[i]*FSreconditioning;
+-	for(i = 0;i<vnumnodes;i++) vel[i]      = sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
+-
+-	/*Now, we have to move the previous inputs  to old 
+-	 * status, otherwise, we'll wipe them off: */
+-	this->inputs->ChangeEnum(VxEnum,VxPicardEnum);
+-	this->inputs->ChangeEnum(VyEnum,VyPicardEnum);
+-	this->inputs->ChangeEnum(VzEnum,VzPicardEnum);
+-	this->inputs->ChangeEnum(PressureEnum,PressurePicardEnum);
+-
+-	/*Add vx and vy as inputs to the tria element: */
+-	this->inputs->AddInput(new PentaInput(VxEnum,vx,P1Enum));
+-	this->inputs->AddInput(new PentaInput(VyEnum,vy,P1Enum));
+-	this->inputs->AddInput(new PentaInput(VzEnum,vz,P1Enum));
+-	this->inputs->AddInput(new PentaInput(VelEnum,vel,P1Enum));
+-	this->inputs->AddInput(new PentaInput(PressureEnum,pressure,P1Enum));
+-
+-	/*Free ressources:*/
+-	xDelete<IssmDouble>(pressure);
+-	xDelete<IssmDouble>(vel);
+-	xDelete<IssmDouble>(vz);
+-	xDelete<IssmDouble>(vy);
+-	xDelete<IssmDouble>(vx);
+-	xDelete<IssmDouble>(values);
+-	xDelete<int>(vdoflist);
+-	xDelete<int>(pdoflist);
+-	xDelete<int>(cs_list);
+-}
+-/*}}}*/
+ #endif
+ 
+ #ifdef _HAVE_BALANCED_
+@@ -10951,75 +9613,6 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Penta::InputUpdateFromSolutionHydrologyDCInefficient{{{*/
+-void  Penta::InputUpdateFromSolutionHydrologyDCInefficient(IssmDouble* solution){
+-
+-	const int   numdof   = NDOF1*NUMVERTICES;
+-	const int   numdof2d = NDOF1*NUMVERTICES2D;
+-	int*        doflist  = NULL;
+-	bool        converged;
+-	IssmDouble  values[numdof];
+-	IssmDouble  residual[numdof];
+-	IssmDouble  penalty_factor;
+-	IssmDouble  kmax, kappa, h_max;
+-	Penta      *penta    = NULL;
+-
+-	/*If not on bed, return*/
+-	if (!IsOnBed()) return;
+-
+-	/*Get dof list: */
+-	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+-
+-	/*Use the dof list to index into the solution vector and extrude it */
+-	for(int i=0;i<numdof2d;i++){
+-		values[i]         =solution[doflist[i]];
+-		values[i+numdof2d]=values[i];
+-		if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector");
+-	}
+-
+-	/*If converged keep the residual in mind*/
+-	this->inputs->GetInputValue(&converged,ConvergedEnum);
+-
+-	/*Get inputs*/
+-	if(converged){
+-		this->parameters->FindParam(&kmax,HydrologySedimentKmaxEnum);
+-		this->parameters->FindParam(&penalty_factor,HydrologydcPenaltyFactorEnum);
+-
+-		kappa=kmax*pow(10.,penalty_factor);
+-
+-		Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.	
+-		for(int i=0;i<NUMVERTICES2D;i++){
+-			tria->GetHydrologyDCInefficientHmax(&h_max,nodes[i]);
+-			if(values[i]>h_max){
+-				residual[i]=kappa*(values[i]-h_max);
+-				residual[i+numdof2d]=residual[i];
+-			}
+-			else{
+-				residual[i]=0.0;
+-				residual[i+numdof2d]=residual[i];
+-			}
+-		}
+-		delete tria->material; delete tria;
+-	}
+-
+-	/*Start looping over all elements above current element and update all inputs*/
+-	penta=this;
+-	for(;;){
+-		/*Add input to the element: */
+-		penta->inputs->AddInput(new PentaInput(SedimentHeadEnum,values,P1Enum));
+-		penta->inputs->AddInput(new PentaInput(SedimentHeadResidualEnum,residual,P1Enum));
+-
+-		/*Stop if we have reached the surface*/
+-		if (penta->IsOnSurface()) break;
+-
+-		/* get upper Penta*/
+-		penta=penta->GetUpperElement(); _assert_(penta->Id()!=this->id);
+-	}
+-
+-	/*Free ressources:*/
+-	xDelete<int>(doflist);
+-}
+-/*}}}*/
+ /*FUNCTION Penta::UpdateConstraintsL2ProjectionEPL{{{*/
+ void  Penta::UpdateConstraintsL2ProjectionEPL(void){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16782)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16783)
+@@ -59,7 +59,6 @@
+ 		void  InputUpdateFromConstant(bool constant, int name);
+ 		void  InputUpdateFromConstant(IssmDouble constant, int name);
+ 		void  InputUpdateFromConstant(int constant, int name);
+-		void  InputUpdateFromSolution(IssmDouble* solutiong);
+ 		void  InputUpdateFromVector(IssmDouble* vector, int name, int type);
+ 		#ifdef _HAVE_DAKOTA_
+ 		void  InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type);
+@@ -231,9 +230,6 @@
+ 		Penta*         GetLowerElement(void);
+ 		void           InputChangeName(int input_enum, int enum_type_old);
+ 		void	         InputExtrude(int enum_type,int object_type);
+-		void           InputUpdateFromSolutionMasstransport(IssmDouble* solutiong);
+-		void           InputUpdateFromSolutionFreeSurfaceTop(IssmDouble* solutiong);
+-		void           InputUpdateFromSolutionFreeSurfaceBase(IssmDouble* solutiong);
+ 		void           InputUpdateFromSolutionOneDof(IssmDouble* solutiong,int enum_type);
+ 		void           InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solutiong,int enum_type);
+ 		bool	         IsInput(int name);
+@@ -289,16 +285,6 @@
+ 		ElementMatrix* CreateJacobianStressbalanceSSA2d(void);
+ 		ElementMatrix* CreateJacobianStressbalanceHO(void);
+ 		ElementMatrix* CreateJacobianStressbalanceFS(void);
+-		void           InputUpdateFromSolutionStressbalanceHoriz( IssmDouble* solutiong);
+-		void           InputUpdateFromSolutionStressbalanceSSA( IssmDouble* solutiong);
+-		void           InputUpdateFromSolutionStressbalanceSSAHO( IssmDouble* solutiong);
+-		void           InputUpdateFromSolutionStressbalanceSSAFS( IssmDouble* solutiong);
+-		void           InputUpdateFromSolutionStressbalanceL1L2( IssmDouble* solutiong);
+-		void           InputUpdateFromSolutionStressbalanceHO( IssmDouble* solutiong);
+-		void           InputUpdateFromSolutionStressbalanceHOFS( IssmDouble* solutiong);
+-		void           InputUpdateFromSolutionStressbalanceSIA( IssmDouble* solutiong);
+-		void           InputUpdateFromSolutionStressbalanceVert( IssmDouble* solutiong);
+-		void           InputUpdateFromSolutionStressbalanceFS( IssmDouble* solutiong);
+ 		ElementVector* CreatePVectorCouplingSSAFS(void);
+ 		ElementVector* CreatePVectorCouplingSSAFSViscous(void);
+ 		ElementVector* CreatePVectorCouplingSSAFSFriction(void);
+@@ -334,8 +320,6 @@
+ 		ElementVector* CreatePVectorAdjointSSA(void);
+ 		ElementVector* CreatePVectorAdjointHO(void);
+ 		ElementVector* CreatePVectorAdjointFS(void);
+-		void           InputUpdateFromSolutionAdjointHoriz( IssmDouble* solutiong);
+-		void           InputUpdateFromSolutionAdjointFS( IssmDouble* solutiong);
+ 		#endif
+ 
+ 		#ifdef _HAVE_HYDROLOGY_
+@@ -350,7 +334,6 @@
+ 		void           GetHydrologyTransfer(Vector<IssmDouble>* transfer);
+ 		void           HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
+ 		void           HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask);
+-		void           InputUpdateFromSolutionHydrologyDCInefficient(IssmDouble* solution);
+ 		void           ComputeEPLThickness(void);
+ 		void           UpdateConstraintsL2ProjectionEPL(void);
+ 		#endif
+@@ -374,8 +357,6 @@
+ 		ElementVector* CreatePVectorThermalVolume(void);
+ 		ElementVector* CreatePVectorThermalShelf(void);
+ 		ElementVector* CreatePVectorThermalSheet(void);
+-		void           InputUpdateFromSolutionThermal(IssmDouble* solutiong);
+-		void           InputUpdateFromSolutionEnthalpy(IssmDouble* solutiong);
+ 		void           UpdateBasalConstraintsEnthalpy(void);
+ 		void           ComputeBasalMeltingrate(void);
+ 		void           DrainWaterfraction(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16782)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16783)
+@@ -53,7 +53,6 @@
+ 		Object *copy();
+ 		/*}}}*/
+ 		/*Update virtual functions resolution: {{{*/
+-		void  InputUpdateFromSolution(IssmDouble* solution){_error_("not implemented yet");};
+ 		void  InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solution,int inputenum){_error_("not implemented yet");};
+ 		void  InputUpdateFromSolutionOneDof(IssmDouble* solution,int inputenum){_error_("not implemented yet");};
+ 		void  InputUpdateFromVector(IssmDouble* vector, int name, int type){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16783-16784.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16783-16784.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16783-16784.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp	(revision 16783)
++++ ../trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp	(revision 16784)
+@@ -28,7 +28,6 @@
+ 	for(int i=0;i<femmodel->elements->Size();i++){
+ 		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+ 		analysis->InputUpdateFromSolution(solution,element);
+-		//element->InputUpdateFromSolution(solution);
+ 	}
+ 	delete analysis;
+ }
Index: issm/oecreview/Archive/16554-17801/ISSM-16784-16785.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16784-16785.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16784-16785.diff	(revision 17802)
@@ -0,0 +1,37 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16784)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16785)
+@@ -8610,8 +8610,6 @@
+ 	ElementVector* pe    = new ElementVector(nodes,numnodes,this->parameters);
+ 	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+ 	IssmDouble*    dbasis = xNew<IssmDouble>(numnodes*2);
+-	IssmDouble*    HNx    = xNew<IssmDouble>(numnodes);
+-	IssmDouble*    HNy    = xNew<IssmDouble>(numnodes);
+ 	IssmDouble*    H      = xNew<IssmDouble>(numnodes);
+ 	IssmDouble*    Nx     = xNew<IssmDouble>(numnodes);
+ 	IssmDouble*    Ny     = xNew<IssmDouble>(numnodes);
+@@ -8650,10 +8648,10 @@
+ 		GetNodalFunctions(basis,gauss);
+ 		GetNodalFunctionsDerivatives(dbasis,&xyz_list[0][0],gauss);
+ 
+-		TriaRef::GetInputDerivativeValue(&dhnx[0],HNx,&xyz_list[0][0],gauss);
+-		TriaRef::GetInputDerivativeValue(&dhny[0],HNy,&xyz_list[0][0],gauss);
+-		TriaRef::GetInputValue(&hnx,HNx,gauss);
+-		TriaRef::GetInputValue(&hny,HNy,gauss);
++		TriaRef::GetInputDerivativeValue(&dhnx[0],Nx,&xyz_list[0][0],gauss);
++		TriaRef::GetInputDerivativeValue(&dhny[0],Ny,&xyz_list[0][0],gauss);
++		TriaRef::GetInputValue(&hnx,Nx,gauss);
++		TriaRef::GetInputValue(&hny,Ny,gauss);
+ 
+ 		gamma=h/(2.*thickness+1.e-10);
+ 
+@@ -8670,8 +8668,6 @@
+ 	xDelete<IssmDouble>(H);
+ 	xDelete<IssmDouble>(Nx);
+ 	xDelete<IssmDouble>(Ny);
+-	xDelete<IssmDouble>(HNx);
+-	xDelete<IssmDouble>(HNy);
+ 	delete gauss;
+ 	return pe;
+ }
Index: issm/oecreview/Archive/16554-17801/ISSM-16785-16786.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16785-16786.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16785-16786.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/test/NightlyRun/test511.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test511.m	(revision 16785)
++++ ../trunk-jpl/test/NightlyRun/test511.m	(revision 16786)
+@@ -22,7 +22,7 @@
+ md.inversion.step_threshold=0.99*ones(md.inversion.nsteps,1);
+ md.inversion.vx_obs=md.initialization.vx; md.inversion.vy_obs=md.initialization.vy;
+ 
+-md.cluster=generic('name',oshostname(),'np',3);
++md.cluster=generic('name',oshostname(),'np',1);
+ md=solve(md,StressbalanceSolutionEnum());
+ 
+ %Fields and tolerances to track changes
Index: issm/oecreview/Archive/16554-17801/ISSM-16786-16787.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16786-16787.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16786-16787.diff	(revision 17802)
@@ -0,0 +1,727 @@
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16786)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16787)
+@@ -551,10 +551,14 @@
+ 	MassfluxatgateNameEnum,
+ 	MassfluxatgateSegmentsEnum,
+ 	MisfitNameEnum,
+-	MisfitModelEnum,
+-	MisfitObservationsEnum,
++	MisfitModelEnumEnum,
++	MisfitObservationEnum,
++	MisfitObservationEnumEnum,
+ 	MisfitTimeinterpolationEnum,
+ 	MisfitWeightsEnum,
++	MisfitWeightsEnumEnum,
++	SurfaceObservationEnum,
++	WeightsSurfaceObservationEnum,
+ 	/*}}}*/
+ 	/*Responses{{{*/
+ 	MinVelEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 16786)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 16787)
+@@ -539,10 +539,14 @@
+ 		case MassfluxatgateNameEnum : return "MassfluxatgateName";
+ 		case MassfluxatgateSegmentsEnum : return "MassfluxatgateSegments";
+ 		case MisfitNameEnum : return "MisfitName";
+-		case MisfitModelEnum : return "MisfitModel";
+-		case MisfitObservationsEnum : return "MisfitObservations";
++		case MisfitModelEnumEnum : return "MisfitModelEnum";
++		case MisfitObservationEnum : return "MisfitObservation";
++		case MisfitObservationEnumEnum : return "MisfitObservationEnum";
+ 		case MisfitTimeinterpolationEnum : return "MisfitTimeinterpolation";
+ 		case MisfitWeightsEnum : return "MisfitWeights";
++		case MisfitWeightsEnumEnum : return "MisfitWeightsEnum";
++		case SurfaceObservationEnum : return "SurfaceObservation";
++		case WeightsSurfaceObservationEnum : return "WeightsSurfaceObservation";
+ 		case MinVelEnum : return "MinVel";
+ 		case MaxVelEnum : return "MaxVel";
+ 		case MinVxEnum : return "MinVx";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 16786)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 16787)
+@@ -551,10 +551,14 @@
+ 	      else if (strcmp(name,"MassfluxatgateName")==0) return MassfluxatgateNameEnum;
+ 	      else if (strcmp(name,"MassfluxatgateSegments")==0) return MassfluxatgateSegmentsEnum;
+ 	      else if (strcmp(name,"MisfitName")==0) return MisfitNameEnum;
+-	      else if (strcmp(name,"MisfitModel")==0) return MisfitModelEnum;
+-	      else if (strcmp(name,"MisfitObservations")==0) return MisfitObservationsEnum;
++	      else if (strcmp(name,"MisfitModelEnum")==0) return MisfitModelEnumEnum;
++	      else if (strcmp(name,"MisfitObservation")==0) return MisfitObservationEnum;
++	      else if (strcmp(name,"MisfitObservationEnum")==0) return MisfitObservationEnumEnum;
+ 	      else if (strcmp(name,"MisfitTimeinterpolation")==0) return MisfitTimeinterpolationEnum;
+ 	      else if (strcmp(name,"MisfitWeights")==0) return MisfitWeightsEnum;
++	      else if (strcmp(name,"MisfitWeightsEnum")==0) return MisfitWeightsEnumEnum;
++	      else if (strcmp(name,"SurfaceObservation")==0) return SurfaceObservationEnum;
++	      else if (strcmp(name,"WeightsSurfaceObservation")==0) return WeightsSurfaceObservationEnum;
+ 	      else if (strcmp(name,"MinVel")==0) return MinVelEnum;
+ 	      else if (strcmp(name,"MaxVel")==0) return MaxVelEnum;
+ 	      else if (strcmp(name,"MinVx")==0) return MinVxEnum;
+@@ -624,14 +628,14 @@
+ 	      else if (strcmp(name,"Gsl")==0) return GslEnum;
+ 	      else if (strcmp(name,"Option")==0) return OptionEnum;
+ 	      else if (strcmp(name,"GenericOption")==0) return GenericOptionEnum;
+-	      else if (strcmp(name,"OptionCell")==0) return OptionCellEnum;
++         else stage=6;
++   }
++   if(stage==6){
++	      if (strcmp(name,"OptionCell")==0) return OptionCellEnum;
+ 	      else if (strcmp(name,"OptionStruct")==0) return OptionStructEnum;
+ 	      else if (strcmp(name,"Paterson")==0) return PatersonEnum;
+ 	      else if (strcmp(name,"Arrhenius")==0) return ArrheniusEnum;
+-         else stage=6;
+-   }
+-   if(stage==6){
+-	      if (strcmp(name,"LliboutryDuval")==0) return LliboutryDuvalEnum;
++	      else if (strcmp(name,"LliboutryDuval")==0) return LliboutryDuvalEnum;
+ 	      else if (strcmp(name,"MaximumNumberOfDefinitions")==0) return MaximumNumberOfDefinitionsEnum;
+          else stage=7;
+    }
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateOutputDefinitions.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateOutputDefinitions.cpp	(revision 16786)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateOutputDefinitions.cpp	(revision 16787)
+@@ -7,17 +7,13 @@
+ #include "../../shared/shared.h"
+ #include "./ModelProcessorx.h"
+ 
+-void CreateOutputDefinitions(Parameters* parameters,IoModel* iomodel){
++void CreateOutputDefinitions(Elements* elements, Parameters* parameters,IoModel* iomodel){
+ 
+ 	int i,j;
+ 	
+-	DataSet     *output_definitions      = NULL;
+-	int         *output_definition_enums = NULL;
++	DataSet*     output_definitions      = NULL;
++	int*         output_definition_enums = NULL;
+ 	int          num_output_definitions;
+-	int          numgates;
+-	char       **gatenames               = NULL;
+-	IssmDouble **gatesegments            = NULL;
+-	int         *gatesegments_M          = NULL;
+ 
+ 	/*Create output_definitions dataset: */
+ 	output_definitions=new DataSet();
+@@ -27,8 +23,16 @@
+ 		for (i=0;i<num_output_definitions;i++){
+ 
+ 			if (output_definition_enums[i]==MassfluxatgateEnum){
++
+ 				/*Deal with mass flux gates:{{{ */
++				
++				/*massfluxatgate variables: */
++				int          numgates;
++				char       **gatenames               = NULL;
++				IssmDouble **gatesegments            = NULL;
++				int         *gatesegments_M          = NULL;
+ 
++
+ 				/*Fetch segments and names: */
+ 				iomodel->FetchMultipleData(&gatenames,&numgates,MassfluxatgateNameEnum);
+ 				iomodel->FetchMultipleData(&gatesegments,&gatesegments_M,NULL,&numgates,MassfluxatgateSegmentsEnum);
+@@ -46,6 +50,70 @@
+ 				xDelete<int>(gatesegments_M);
+ 				/*}}}*/
+ 			}
++			else if (output_definition_enums[i]==MisfitEnum){
++				/*Deal with misfits: {{{*/
++				
++				/*misfit variables: */
++				int          nummisfits;
++				char**       misfit_name_s             = NULL;    
++				int*         misfit_model_enum_s        = NULL;
++				IssmDouble** misfit_observation_s      = NULL;
++				int*         misfit_observation_enum_s  = NULL;
++				int*         misfit_observation_M_s    = NULL;
++				int*         misfit_observation_N_s    = NULL;
++				char**       misfit_timeinterpolation_s = NULL;
++				IssmDouble** misfit_weights_s           = NULL;
++				int*         misfit_weights_M_s    = NULL;
++				int*         misfit_weights_N_s    = NULL;
++				int*         misfit_weights_enum_s= NULL;
++
++				/*Fetch name, model_enum, observation, observation_enum, etc ... (see src/m/classes/misfit.m): */
++				iomodel->FetchMultipleData(&misfit_name_s,&nummisfits,MisfitNameEnum);
++				iomodel->FetchMultipleData(&misfit_model_enum_s,&nummisfits,MisfitModelEnumEnum);
++				iomodel->FetchMultipleData(&misfit_observation_s,&misfit_observation_M_s,&misfit_observation_N_s,&nummisfits,MisfitObservationEnum);
++				iomodel->FetchMultipleData(&misfit_observation_enum_s,&nummisfits,MisfitObservationEnumEnum);
++				iomodel->FetchMultipleData(&misfit_timeinterpolation_s,&nummisfits,MisfitTimeinterpolationEnum);
++				iomodel->FetchMultipleData(&misfit_weights_s,&misfit_weights_M_s,&misfit_weights_N_s,&nummisfits,MisfitWeightsEnum);
++				iomodel->FetchMultipleData(&misfit_weights_enum_s,&nummisfits,MisfitWeightsEnumEnum);
++
++				for(j=0;j<nummisfits;j++){
++
++					/*First create a misfit object for that specific enum (misfit_model_enum_s[j]):*/
++					output_definitions->AddObject(new Misfit(misfit_name_s[j],misfit_model_enum_s[j],misfit_observation_enum_s[j],misfit_timeinterpolation_s[j],misfit_weights_enum_s[j]));
++
++					/*Now, for this particular misfit object, make sure we plug into the elements: the observation, and the weights.*/
++					for(i=0;i<elements->Size();i++){
++						Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
++						element->InputCreate(misfit_observation_s[j], iomodel,misfit_observation_M_s[j],misfit_observation_N_s[j],1,misfit_observation_enum_s[j],7);
++						element->InputCreate(misfit_weights_s[j], iomodel,misfit_weights_M_s[j],misfit_weights_N_s[j],1,misfit_weights_enum_s[j],7);
++					}
++
++				}
++
++				/*Free ressources:*/
++				for(j=0;j<nummisfits;j++){
++					char* string=NULL;
++					IssmDouble* matrix = NULL;
++
++					string = misfit_name_s[j];    xDelete<char>(string);
++					string = misfit_timeinterpolation_s[j];    xDelete<char>(string);
++					matrix = misfit_observation_s[j]; xDelete<IssmDouble>(matrix);
++					matrix = misfit_weights_s[j]; xDelete<IssmDouble>(matrix);
++				}
++				xDelete<char*>(misfit_name_s);
++				xDelete<int>(misfit_model_enum_s);
++				xDelete<IssmDouble*>(misfit_observation_s);
++				xDelete<int>(misfit_observation_enum_s);
++				xDelete<int>(misfit_observation_M_s);
++				xDelete<int>(misfit_observation_N_s);
++				xDelete<char*>(misfit_timeinterpolation_s);
++				xDelete<IssmDouble*>(misfit_weights_s);
++				xDelete<int>(misfit_weights_M_s);
++				xDelete<int>(misfit_weights_N_s);
++				xDelete<int>(misfit_weights_enum_s);
++				/*}}}*/
++			}
++
+ 			else _error_("output definition enum " << output_definition_enums[i] << "not supported yet!");
+ 		}
+ 	}
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 16786)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 16787)
+@@ -195,9 +195,7 @@
+ 	}
+ 	/*}}}*/
+ 
+-	/*Output definitions dataset: */
+-	CreateOutputDefinitions(parameters,iomodel);
+-
++	
+ 	/*Before returning, create parameters in case we are running Qmu or control types runs: */
+ 	#ifdef _HAVE_CONTROL_
+ 	CreateParametersControl(parameters,iomodel,solution_type);
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp	(revision 16786)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp	(revision 16787)
+@@ -104,6 +104,9 @@
+ 	}
+ 	#endif
+ 
++	/*Output definitions dataset: */
++	CreateOutputDefinitions(elements,parameters,iomodel);
++
+ 	/* Sort datasets:
+ 	 * All our datasets are already ordered by ids. Set presort flag so that
+ 	 * later on, when sorting is requested on these datasets, it will not be
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.h	(revision 16786)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.h	(revision 16787)
+@@ -16,7 +16,7 @@
+ void CreateParametersAutodiff(Parameters* parameters,IoModel* iomodel);
+ void CreateParametersControl(Parameters* parameters,IoModel* iomodel,int solution_type);
+ void CreateParametersDakota(Parameters* parameters,IoModel* iomodel,char* rootpath);
+-void CreateOutputDefinitions(Parameters* parameters,IoModel* iomodel);
++void CreateOutputDefinitions(Elements* elements, Parameters* parameters,IoModel* iomodel);
+ void UpdateElementsAndMaterialsControl(Elements* elements,Materials* materials, IoModel* iomodel);
+ void UpdateElementsAndMaterialsDakota(Elements* elements,Materials* materials, IoModel* iomodel);
+ void UpdateElementsTransient(Elements* elements,Parameters* parameters,IoModel* iomodel,int analysis_type);
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 16786)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 16787)
+@@ -539,6 +539,7 @@
+ #}}}
+ #Responses sources  {{{
+ responses_sources= ./classes/Massfluxatgate.h \
++				   ./classes/Misfit.h \
+ 				   ./modules/ModelProcessorx/CreateOutputDefinitions.cpp\
+ 				   ./modules/OutputDefinitionsResponsex/OutputDefinitionsResponsex.h\
+ 				   ./modules/OutputDefinitionsResponsex/OutputDefinitionsResponsex.cpp
+Index: ../trunk-jpl/src/c/classes/classes.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/classes.h	(revision 16786)
++++ ../trunk-jpl/src/c/classes/classes.h	(revision 16787)
+@@ -17,6 +17,7 @@
+ #include "./IndependentObject.h"
+ #include "./Segment.h"
+ #include "./Massfluxatgate.h"
++#include "./Misfit.h"
+ 
+ /*Constraints: */
+ #include "./Constraints/Constraints.h"
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16786)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16787)
+@@ -132,6 +132,7 @@
+ 		virtual IssmDouble IceVolume(void)=0;
+ 		virtual IssmDouble IceVolumeAboveFloatation(void)=0;
+ 		virtual IssmDouble TotalSmb(void)=0;
++		virtual IssmDouble Misfit(int modelenum,int observationenum,int weightsenum)=0;
+ 		#endif
+ 
+ 		#ifdef _HAVE_GIA_
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16786)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16787)
+@@ -3251,6 +3251,48 @@
+ 	return Total_Smb;
+ }
+ /*}}}*/
++/*FUNCTION Tria::Misfit{{{*/
++IssmDouble Tria::Misfit(int modelenum,int observationenum,int weightsenum){
++
++	/*Intermediaries*/
++	IssmDouble model,observation,weight;
++	IssmDouble Jdet;
++	IssmDouble Jelem = 0;
++	IssmDouble xyz_list[NUMVERTICES][3];
++	GaussTria *gauss = NULL;
++
++	/*If on water, return 0: */
++	if(NoIceInElement())return 0;
++
++	/*Retrieve all inputs we will be needing: */
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	Input* model_input=inputs->GetInput(modelenum);   _assert_(model_input);
++	Input* observation_input=inputs->GetInput(observationenum);_assert_(observation_input);
++	Input* weights_input     =inputs->GetInput(weightsenum);     _assert_(weights_input);
++
++	/* Start  looping on the number of gaussian points: */
++	gauss=new GaussTria(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++
++		/* Get Jacobian determinant: */
++		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
++
++		/*Get parameters at gauss point*/
++		model_input->GetInputValue(&model,gauss);
++		observation_input->GetInputValue(&observation,gauss);
++		weights_input->GetInputValue(&weight,gauss);
++
++		/*compute misfit between model and observation */
++		Jelem+=0.5*(model-observation)*(model-observation)*weight*Jdet*gauss->weight;
++	}
++
++	/* clean up and Return: */
++	delete gauss;
++	return Jelem;
++}
++/*}}}*/
+ #endif
+ 
+ #ifdef _HAVE_GIA_
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16786)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16787)
+@@ -149,6 +149,7 @@
+ 		void       MaxVx(IssmDouble* pmaxvx);
+ 		void       MaxVy(IssmDouble* pmaxvy);
+ 		void       MaxVz(IssmDouble* pmaxvz);
++		IssmDouble Misfit(int modelenum,int observationenum,int weightsenum);
+ 		#endif
+ 
+ 		#ifdef _HAVE_GIA_
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16786)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16787)
+@@ -177,6 +177,7 @@
+ 		IssmDouble ThicknessAcrossGradient(void){_error_("not supported");};
+ 		IssmDouble BalancethicknessMisfit(void){_error_("not supported");};
+ 		void   InputControlUpdate(IssmDouble scalar,bool save_parameter);
++		IssmDouble Misfit(int modelenum,int observationenum,int weightsenum){_error_("not implemented yet");};
+ 		#endif
+ 
+ 		#ifdef _HAVE_GROUNDINGLINE_
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16786)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16787)
+@@ -178,6 +178,7 @@
+ 		void       MaxVx(IssmDouble* pmaxvx){_error_("not implemented yet");};
+ 		void       MaxVy(IssmDouble* pmaxvy){_error_("not implemented yet");};
+ 		void       MaxVz(IssmDouble* pmaxvz){_error_("not implemented yet");};
++		IssmDouble Misfit(int modelenum,int observationenum,int weightsenum){_error_("not implemented yet");};
+ #endif
+ 
+ #ifdef _HAVE_GIA_
+Index: ../trunk-jpl/src/c/classes/Misfit.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Misfit.h	(revision 0)
++++ ../trunk-jpl/src/c/classes/Misfit.h	(revision 16787)
+@@ -0,0 +1,117 @@
++/*!\file Misfit.h
++ * \brief: header file for Misfit object
++ */
++
++#ifndef _MISFIT_H_
++#define _MISFIT_H_
++
++/*Headers:*/
++/*{{{*/
++#include "./Definition.h"
++#include "../datastructures/datastructures.h"
++#include "./Elements/Element.h"
++#include "./Elements/Elements.h"
++#include "./FemModel.h"
++/*}}}*/
++
++class Misfit: public Object, public Definition{
++
++	public: 
++
++		char*       name;
++		int         model_enum;
++		int         observation_enum;
++		int         weights_enum;
++		char*       timeinterpolation;
++		
++		/*Misfit constructors, destructors :*/
++		/*FUNCTION Misfit() {{{*/
++		Misfit(){
++
++			this->name = NULL;
++			this->model_enum = UNDEF;
++			this->observation_enum = UNDEF;
++			this->weights_enum = UNDEF;
++			this->timeinterpolation=NULL;
++
++		}
++		/*}}}*/
++		/*FUNCTION Misfit(char* in_name, int in_model_enum, int in_observation_enum char* in_timeinterpolation, int in_weights_enum) {{{*/
++		Misfit(char* in_name, int in_model_enum, int in_observation_enum, char* in_timeinterpolation, int in_weights_enum){
++
++			this->name   = xNew<char>(strlen(in_name)+1);
++			xMemCpy<char>(this->name,in_name,strlen(in_name)+1);
++
++			this->timeinterpolation   = xNew<char>(strlen(in_timeinterpolation)+1);
++			xMemCpy<char>(this->timeinterpolation,in_timeinterpolation,strlen(in_timeinterpolation)+1);
++
++			this->model_enum=in_model_enum;
++			this->observation_enum=in_observation_enum;
++			this->weights_enum=in_weights_enum;
++		}
++		/*}}}*/
++		/*FUNCTION ~Misfit() {{{*/
++		~Misfit(){
++			if(this->name)xDelete(this->name);
++			if(this->timeinterpolation)xDelete(this->timeinterpolation);
++		}
++		/*}}}*/
++		/*Object virtual function resolutoin: */
++		/*FUNCTION Echo(){{{*/
++		void Echo(void){
++			_printf_(" Misfit: " << name << "\n");
++			_printf_("    model_enum: " << model_enum << " " << EnumToStringx(model_enum) << "\n");
++			_printf_("    observation_enum: " << observation_enum << " " << EnumToStringx(observation_enum) << "\n");
++			_printf_("    weights_enum: " << weights_enum << " " << EnumToStringx(weights_enum) << "\n");
++			_printf_("    timeinterpolation: " << timeinterpolation << "\n");
++		}
++		/*}}}*/
++		/*FUNCTION DeepEcho(){{{*/
++		void DeepEcho(void){
++			this->Echo();
++		}
++		/*}}}*/
++		/*FUNCTION Id(){{{*/
++		int Id(void){
++			return -1;
++		}
++		/*}}}*/
++		/*FUNCTION ObjectEnum{{{*/
++		int ObjectEnum(void){
++			return MisfitEnum;
++		}
++		/*}}}*/
++		/*FUNCTION copy {{{*/
++		Object* copy() {
++			return new Misfit(this->name,this->model_enum,this->observation_enum,this->timeinterpolation,this->weights_enum);
++		}
++		/*}}}*/
++		/*Definition virtual function resolutoin: */
++		/*FUNCTION char* Name() {{{*/
++		char* Name(){
++
++			char* name2=xNew<char>(strlen(this->name)+1);
++			xMemCpy(name2,this->name,strlen(this->name)+1);
++
++			return name2;
++		}
++		/*}}}*/
++		/*FUNCTION IssmDouble Response(FemModel* femmodel) {{{*/
++		 IssmDouble Response(FemModel* femmodel){
++
++			 int i;
++			 IssmDouble response=0;
++			 IssmDouble all_response=0;
++
++			 for(i=0;i<femmodel->elements->Size();i++){
++				 Element* element=(Element*)femmodel->elements->GetObjectByOffset(i);
++				 response+=element->Misfit(model_enum,observation_enum,weights_enum);
++			 }
++			 
++			 ISSM_MPI_Allreduce ( (void*)&response,(void*)&all_response,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,IssmComm::GetComm());
++			 return all_response;
++		 }
++			/*}}}*/
++};
++
++#endif  /* _MISFIT_H_ */
+Index: ../trunk-jpl/src/m/classes/misfit.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/misfit.m	(revision 0)
++++ ../trunk-jpl/src/m/classes/misfit.m	(revision 16787)
+@@ -0,0 +1,88 @@
++%MISFIT class definition
++%
++%   Usage:
++%      misfit=misfit();
++%      misfit=misfit('name','SurfaceAltimetry',...
++%                    'model_enum',SurfaceEnum,...
++%                    'observation_enum',SurfaceObservationsEnum,...
++%                    'observation',md.geometry.surface,...
++%                    'timeinterpolation','nearestneighbor',...
++%                    'weights',ones(md.mesh.numberofvertices,1),...
++%                    'weights_enum',WeightsSurfaceObservationsEnum);
++%
++%
++
++classdef misfit
++	properties (SetAccess=public)
++		%misfit
++		name              = '';
++		model_enum        = NaN; %enum for field that is modeled
++		observation      = NaN; %observed field that we compare the model against
++		observation_enum = NaN; %enum for observed field.
++		timeinterpolation = '';
++		weights           = NaN; %weight coefficients for every vertex
++		weights_enum      = NaN; %enum to identify this particular set of weights
++	end
++	
++	methods
++		function obj = misfit(varargin) % {{{
++			if nargin==0,
++				obj=setdefaultparameters(obj);
++			else
++				%use provided options to change fields
++				options=pairoptions(varargin{:});
++
++				%get name
++				obj.name=getfieldvalue(options,'name','');
++				obj.model_enum=getfieldvalue(options,'model_enum');
++				obj.observation=getfieldvalue(options,'observation',NaN);
++				obj.observation_enum=getfieldvalue(options,'observation_enum');
++				obj.timeinterpolation=getfieldvalue(options,'timeinterpolation','nearestneighbor');
++				obj.weights=getfieldvalue(options,'weights',NaN);
++				obj.weights_enum=getfieldvalue(options,'weights_enum',NaN);
++
++			end
++		end % }}}
++		function obj = setdefaultparameters(obj) % {{{
++			obj.timeinterpolation='nearestneighbor';
++		end % }}}
++		function md = checkconsistency(obj,md,solution,analyses) % {{{
++
++			if ~ischar(obj.name),
++				error('misfit error message: ''name'' field should be a string!');
++			end
++
++			if ~ischar(obj.timeinterpolation),
++				error('misfit error message: ''timeinterpolation'' field should be a string!');
++			end
++			md = checkfield(md,'fieldname','obj.observation','field',obj.observation,'forcing',1,'NaN',1);
++			md = checkfield(md,'fieldname','obj.timeinterpolation','field',obj.timeinterpolation,'values',{'nearestneighbor'});
++			md = checkfield(md,'fieldname','obj.weights','field',obj.weights,'size',[md.mesh.numberofvertices 1],'>=',0,'<=',1);
++
++		end % }}}
++		function md = disp(obj) % {{{
++		
++			disp(sprintf('   Misfit:\n'));
++
++			fielddisplay(obj,'name','identifier for this misfit response');
++			fielddisplay(obj,'model_enum','enum for field that is modeled');
++			fielddisplay(obj,'observation','observed field that we compare the model against');
++			fielddisplay(obj,'observation_enum','observation enum');
++			fielddisplay(obj,'timeinterpolation','interpolation routine used to interpolate misfit between two time steps (default is ''nearestneighbor''');
++			fielddisplay(obj,'weights','weights (at vertices) to apply to the misfit');
++			fielddisplay(obj,'weights_enum','enum for weights for identification purposes');
++
++		end % }}}
++		function md = marshall(obj,md,fid) % {{{
++
++		WriteData(fid,'object',obj,'fieldname','name','format','String');
++		WriteData(fid,'object',obj,'fieldname','model_enum','format','Integer');
++		WriteData(fid,'object',obj,'fieldname','observation','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
++		WriteData(fid,'object',obj,'fieldname','observation_enum','format','Integer');
++		WriteData(fid,'object',obj,'fieldname','timeinterpolation','format','String');
++		WriteData(fid,'object',obj,'fieldname','weights','format','DoubleMat','mattype',1);
++		WriteData(fid,'object',obj,'fieldname','weights_enum','format','Integer');
++
++		end % }}}
++	end
++end
+Index: ../trunk-jpl/src/m/enum/MisfitObservationsEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/MisfitObservationsEnum.m	(revision 16786)
++++ ../trunk-jpl/src/m/enum/MisfitObservationsEnum.m	(revision 16787)
+@@ -1,11 +0,0 @@
+-function macro=MisfitObservationsEnum()
+-%MISFITOBSERVATIONSENUM - Enum of MisfitObservations
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=MisfitObservationsEnum()
+-
+-macro=StringToEnum('MisfitObservations');
+Index: ../trunk-jpl/src/m/enum/MisfitModelEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/MisfitModelEnum.m	(revision 16786)
++++ ../trunk-jpl/src/m/enum/MisfitModelEnum.m	(revision 16787)
+@@ -1,11 +0,0 @@
+-function macro=MisfitModelEnum()
+-%MISFITMODELENUM - Enum of MisfitModel
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=MisfitModelEnum()
+-
+-macro=StringToEnum('MisfitModel');
+Index: ../trunk-jpl/src/m/enum/MisfitObservationEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/MisfitObservationEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/MisfitObservationEnum.m	(revision 16787)
+@@ -0,0 +1,11 @@
++function macro=MisfitObservationEnum()
++%MISFITOBSERVATIONENUM - Enum of MisfitObservation
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=MisfitObservationEnum()
++
++macro=StringToEnum('MisfitObservation');
+Index: ../trunk-jpl/src/m/enum/MisfitWeightsEnumEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/MisfitWeightsEnumEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/MisfitWeightsEnumEnum.m	(revision 16787)
+@@ -0,0 +1,11 @@
++function macro=MisfitWeightsEnumEnum()
++%MISFITWEIGHTSENUMENUM - Enum of MisfitWeights
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=MisfitWeightsEnumEnum()
++
++macro=StringToEnum('MisfitWeights');
+Index: ../trunk-jpl/src/m/enum/MisfitObservationEnumEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/MisfitObservationEnumEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/MisfitObservationEnumEnum.m	(revision 16787)
+@@ -0,0 +1,11 @@
++function macro=MisfitObservationEnumEnum()
++%MISFITOBSERVATIONENUMENUM - Enum of MisfitObservation
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=MisfitObservationEnumEnum()
++
++macro=StringToEnum('MisfitObservation');
+Index: ../trunk-jpl/src/m/enum/MisfitModelEnumEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/MisfitModelEnumEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/MisfitModelEnumEnum.m	(revision 16787)
+@@ -0,0 +1,11 @@
++function macro=MisfitModelEnumEnum()
++%MISFITMODELENUMENUM - Enum of MisfitModel
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=MisfitModelEnumEnum()
++
++macro=StringToEnum('MisfitModel');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 16786)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 16787)
+@@ -531,10 +531,14 @@
+ def MassfluxatgateNameEnum(): return StringToEnum("MassfluxatgateName")[0]
+ def MassfluxatgateSegmentsEnum(): return StringToEnum("MassfluxatgateSegments")[0]
+ def MisfitNameEnum(): return StringToEnum("MisfitName")[0]
+-def MisfitModelEnum(): return StringToEnum("MisfitModel")[0]
+-def MisfitObservationsEnum(): return StringToEnum("MisfitObservations")[0]
++def MisfitModelEnumEnum(): return StringToEnum("MisfitModelEnum")[0]
++def MisfitObservationEnum(): return StringToEnum("MisfitObservation")[0]
++def MisfitObservationEnumEnum(): return StringToEnum("MisfitObservationEnum")[0]
+ def MisfitTimeinterpolationEnum(): return StringToEnum("MisfitTimeinterpolation")[0]
+ def MisfitWeightsEnum(): return StringToEnum("MisfitWeights")[0]
++def MisfitWeightsEnumEnum(): return StringToEnum("MisfitWeightsEnum")[0]
++def SurfaceObservationEnum(): return StringToEnum("SurfaceObservation")[0]
++def WeightsSurfaceObservationEnum(): return StringToEnum("WeightsSurfaceObservation")[0]
+ def MinVelEnum(): return StringToEnum("MinVel")[0]
+ def MaxVelEnum(): return StringToEnum("MaxVel")[0]
+ def MinVxEnum(): return StringToEnum("MinVx")[0]
+Index: ../trunk-jpl/src/m/enum/WeightsSurfaceObservationEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/WeightsSurfaceObservationEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/WeightsSurfaceObservationEnum.m	(revision 16787)
+@@ -0,0 +1,11 @@
++function macro=WeightsSurfaceObservationEnum()
++%WEIGHTSSURFACEOBSERVATIONENUM - Enum of WeightsSurfaceObservation
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=WeightsSurfaceObservationEnum()
++
++macro=StringToEnum('WeightsSurfaceObservation');
+Index: ../trunk-jpl/src/m/enum/SurfaceObservationEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/SurfaceObservationEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/SurfaceObservationEnum.m	(revision 16787)
+@@ -0,0 +1,11 @@
++function macro=SurfaceObservationEnum()
++%SURFACEOBSERVATIONENUM - Enum of SurfaceObservation
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=SurfaceObservationEnum()
++
++macro=StringToEnum('SurfaceObservation');
Index: issm/oecreview/Archive/16554-17801/ISSM-16787-16788.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16787-16788.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16787-16788.diff	(revision 17802)
@@ -0,0 +1,134 @@
+Index: ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 16787)
++++ ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 16788)
+@@ -647,16 +647,24 @@
+ 		*punstable=unstable;
+ 		return;
+ 	}
++	if(!element->IsOnBed()){
++		unstable=0;
++		active=0;
++		*punstable=unstable;
++		return;
++	}
+ 
+ 	/*Get sediment water head h*/
+ 	element->GetInputValue(&h,node,SedimentHeadEnum);
+ 	element->GetHydrologyDCInefficientHmax(&h_max,node);
+ 	parameters->FindParam(&penalty_lock,HydrologydcPenaltyLockEnum);
+ 
+-	if (h>h_max)
++	if (h>h_max){
+ 	 new_active=1;
+-	else
++	}
++	else{
+ 	 new_active=0;
++	}
+ 
+ 	if(this->active==new_active){
+ 		unstable=0;
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 16787)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 16788)
+@@ -1422,10 +1422,49 @@
+ 
+ void FemModel::UpdateConstraintsL2ProjectionEPLx(void){ /*{{{*/
+ 
+-	for(int i=0;i<elements->Size();i++){
++	Vector<IssmDouble>* active        = NULL;
++	IssmDouble*         serial_active = NULL;
++
++	/*update node activity. If one element is connected to mask=1, all nodes are active*/
++	active=new Vector<IssmDouble>(nodes->NumberOfNodes(HydrologyDCEfficientAnalysisEnum));
++	for (int i=0;i<elements->Size();i++){
+ 		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+-		element->UpdateConstraintsL2ProjectionEPL();
++		element->HydrologyEPLGetActive(active);
+ 	}
+ 
++	/*Assemble and serialize*/
++	active->Assemble();
++	serial_active=active->ToMPISerial();
++	delete active;
++
++	/*Update node activation accordingly*/
++	int counter =0;
++	for (int i=0;i<nodes->Size();i++){
++		Node* node=dynamic_cast<Node*>(nodes->GetObjectByOffset(i));
++		if(node->InAnalysis(L2ProjectionEPLAnalysisEnum)){
++			if(serial_active[node->Sid()]==1.){
++				node->Activate();
++				counter++;
++			}
++			else{
++				node->Deactivate();
++			}
++		}
++	}
++	xDelete<IssmDouble>(serial_active);
++	int sum_counter;
++	ISSM_MPI_Reduce(&counter,&sum_counter,1,ISSM_MPI_INT,ISSM_MPI_SUM,0,IssmComm::GetComm() );
++	ISSM_MPI_Bcast(&sum_counter,1,ISSM_MPI_INT,0,IssmComm::GetComm());                
++	counter=sum_counter;
++	if(VerboseSolution()) _printf0_("   Number of active nodes L2 Projection: "<< counter <<"\n");
++
++	/*Update dof indexings*/
++	this->UpdateConstraintsx();
++
++	/* for(int i=0;i<elements->Size();i++){ */
++	/* 	Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i)); */
++	/* 	element->UpdateConstraintsL2ProjectionEPL(); */
++	/* } */
++
+ }
+ /*}}}*/#endif
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16787)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16788)
+@@ -6988,12 +6988,11 @@
+ 		GetInputListOnVertices(&bed[0],BedEnum);
+ 		
+ 		for(int i=0;i<numdof;i++){
+-			/*Keeping thickness to 1 if EPL is not active*/
+-			if(activeEpl[i]==0.0){
+-				thickness[i]=init_thick;
+-			}
+-			else{
+-
++			/*Keeping thickness to initial value if EPL is not active*/
++			/* if(activeEpl[i]==0.0){ */
++			/* 	thickness[i]=init_thick; */
++			/* } */
++			/* else{ */
+ 				/*Compute first the effective pressure in the EPL*/
+ 				EPL_N=gravity*((rho_ice*ice_thickness[i])-(rho_water*(eplhead[i]-bed[i])));
+ 				if(EPL_N<0.0)EPL_N=0.0;
+@@ -7002,7 +7001,7 @@
+ 				
+ 				/*And proceed to the real thing*/
+ 				thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*pow(EPLgrad,2.0)-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
+-			}
++				//}
+ 		}
+ 		this->inputs->AddInput(new TriaInput(HydrologydcEplThicknessEnum,thickness,P1Enum));
+ 	}
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16787)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16788)
+@@ -9518,8 +9518,9 @@
+ /*FUNCTION Penta::HydrologyEPLGetActive {{{*/
+ void Penta::HydrologyEPLGetActive(Vector<IssmDouble>* active_vec){
+ 
+-	if (!IsOnBed())return;
+-
++	if (!IsOnBed()){
++		return;
++	}
+ 	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+ 	tria->HydrologyEPLGetActive(active_vec);
+ 	delete tria->material; delete tria;
Index: issm/oecreview/Archive/16554-17801/ISSM-16788-16789.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16788-16789.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16788-16789.diff	(revision 17802)
@@ -0,0 +1,317 @@
+Index: ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 16788)
++++ ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 16789)
+@@ -11,7 +11,7 @@
+ 
+ 	/*intermediary: */
+ 	int      i,M,N;
+-	int      configuration_type;
++	int      configuration_type,analysisenum;
+ 	Element *element = NULL;
+ 	Load    *load    = NULL;
+ 
+@@ -25,8 +25,10 @@
+ 	/*Display message*/
+ 	if(VerboseModule()) _printf0_("   Generating matrices");
+ 
+-	/*retrive parameters: */
++	/*retrieve parameters: */
+ 	femmodel->parameters->FindParam(&configuration_type,ConfigurationTypeEnum);
++	femmodel->parameters->FindParam(&analysisenum,AnalysisTypeEnum);
++	Analysis* analysis = EnumToAnalysis(analysisenum);
+ 
+ 	/*First, we might need to do a dry run to get kmax if penalties are employed*/
+ 	if(femmodel->loads->IsPenalty(configuration_type)){
+@@ -61,37 +63,39 @@
+ 		_printf0_(" (Kff stiffness matrix size: "<<M<<" x "<<N<<")\n");
+ 	}
+ 
+-	/*Fill stiffness matrix from elements and loads */
++	/*Fill stiffness matrix and load vector from elements*/
+ 	for (i=0;i<femmodel->elements->Size();i++){
+ 		element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+-		element->CreateKMatrix(Kff,Kfs);
++		element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++		//ElementVector* pe = analysis->CreatePVector(element);
++		//ElementMatrix* Ke = analysis->CreateKMatrix(element);
++		ElementVector* pe = element->CreatePVector();
++		ElementMatrix* Ke = element->CreateKMatrix();
++		element->ReduceMatrices(Ke,pe);
++		if(Ke) Ke->AddToGlobal(Kff,Kfs);
++		if(pe) pe->AddToGlobal(pf);
++		delete Ke;
++		delete pe;
+ 	}
+ 
+-	for (i=0;i<femmodel->loads->Size();i++){
++	/*Fill stiffness matrix and load vector from loads*/
++	for(i=0;i<femmodel->loads->Size();i++){
+ 		load=dynamic_cast<Load*>(femmodel->loads->GetObjectByOffset(i));
+-		if(load->InAnalysis(configuration_type)) load->CreateKMatrix(Kff,Kfs);
++		if(load->InAnalysis(configuration_type)){
++			load->CreateKMatrix(Kff,Kfs);
++			load->CreatePVector(pf);
++		}
+ 	}
+ 
+-	/*Fill right hand side vector, from elements and loads */
+-	for (i=0;i<femmodel->elements->Size();i++){
+-		element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+-		element->CreatePVector(pf);
+-	}
+-	for (i=0;i<femmodel->loads->Size();i++){
+-		load=dynamic_cast<Load*>(femmodel->loads->GetObjectByOffset(i));
+-		if(load->InAnalysis(configuration_type)) load->CreatePVector(pf);
+-	}
+-
+ 	/*Now deal with penalties (only in loads)*/
+ 	if(femmodel->loads->IsPenalty(configuration_type)){
+ 		for (i=0;i<femmodel->loads->Size();i++){
+ 			load=dynamic_cast<Load*>(femmodel->loads->GetObjectByOffset(i));
+-			if(load->InAnalysis(configuration_type)) load->PenaltyCreateKMatrix(Kff,Kfs,kmax);
++			if(load->InAnalysis(configuration_type)){
++				load->PenaltyCreateKMatrix(Kff,Kfs,kmax);
++				load->PenaltyCreatePVector(pf,kmax);
++			}
+ 		}
+-		for (i=0;i<femmodel->loads->Size();i++){
+-			load=dynamic_cast<Load*>(femmodel->loads->GetObjectByOffset(i));
+-			if(load->InAnalysis(configuration_type)) load->PenaltyCreatePVector(pf,kmax);
+-		}
+ 	}
+ 
+ 	/*Create dof vector for stiffness matrix preconditioning*/
+@@ -108,7 +112,8 @@
+ 	//Kff->AllocationInfo();
+ 	//Kfs->AllocationInfo();
+ 
+-	/*Assign output pointers: */
++	/*cleanu up and assign output pointers: */
++	delete analysis;
+ 	if(pKff) *pKff=Kff;
+ 	else      delete Kff;
+ 	if(pKfs) *pKfs=Kfs;
+Index: ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.h	(revision 16788)
++++ ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.h	(revision 16789)
+@@ -5,6 +5,7 @@
+ #define _SYSTEMMATRICESX_H
+ 
+ #include "../../classes/classes.h"
++#include "../../analyses/analyses.h"
+ 
+ /* local prototypes: */
+ void SystemMatricesx(Matrix<IssmDouble>** pKff, Matrix<IssmDouble>** pKfs, Vector<IssmDouble>** ppf, Vector<IssmDouble>** pdf, IssmDouble* pkmax,FemModel* femmodel);
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16788)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16789)
+@@ -10,8 +10,8 @@
+ /*Headers:*/
+ /*{{{*/
+ #include "../../datastructures/datastructures.h"
++#include "../../toolkits/toolkits.h"
+ #include "../Update.h"
+-
+ class DataSet;
+ class Parameters;
+ class Elements;
+@@ -25,8 +25,8 @@
+ class Gauss;
+ template <class doublematrix> class Matrix;
+ template <class doubletype> class Vector;
+-
+-#include "../../toolkits/toolkits.h"
++class ElementMatrix;
++class ElementVector;
+ /*}}}*/
+ 
+ class Element: public Object,public Update{
+@@ -42,8 +42,10 @@
+ 		virtual void   AddInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
+ 		virtual void   AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
+ 		virtual void   CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>*  Kfs)=0;
++		virtual ElementMatrix* CreateKMatrix(void)=0;
+ 		virtual void   CreateDVector(Vector<IssmDouble>* df)=0;
+ 		virtual void   CreatePVector(Vector<IssmDouble>* pf)=0;
++		virtual ElementVector* CreatePVector(void)=0;
+ 		virtual void   CreateJacobianMatrix(Matrix<IssmDouble>* Jff)=0;
+ 		virtual void   DeleteMaterials(void)=0;
+ 		virtual void   EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure)=0;
+@@ -109,6 +111,7 @@
+ 		virtual void   SmbGradients(void)=0;
+ 	   virtual Element*   SpawnBasalElement(void)=0;
+ 		virtual IssmDouble TMeltingPoint(IssmDouble pressure)=0;
++		virtual void   ReduceMatrices(ElementMatrix* Ke,ElementVector* pe)=0;
+ 		virtual void   ResetCoordinateSystem()=0;
+ 		virtual int    VelocityInterpolation()=0;
+ 		virtual int    PressureInterpolation()=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16788)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16789)
+@@ -2350,6 +2350,45 @@
+ 	delete gauss;
+ }
+ /*}}}*/
++/*FUNCTION Tria::ReduceMatrices {{{*/
++void Tria::ReduceMatrices(ElementMatrix* Ke,ElementVector* pe){
++
++	/*Static condensation if requested*/
++	if(pe){
++		if(this->element_type==MINIcondensedEnum){
++			int indices[2]={6,7};
++			pe->StaticCondensation(Ke,2,&indices[0]);
++		}
++		else if(this->element_type==P1bubblecondensedEnum){
++			int size   = nodes[3]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
++			int offset = 0;
++			for(int i=0;i<3;i++) offset+=nodes[i]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
++			int* indices=xNew<int>(size);
++			for(int i=0;i<size;i++) indices[i] = offset+i;
++			pe->StaticCondensation(Ke,size,indices);
++			xDelete<int>(indices);
++		}
++	}
++
++	if(Ke){
++		if(this->element_type==MINIcondensedEnum){
++			int indices[2]={6,7};
++			Ke->StaticCondensation(2,&indices[0]);
++		}
++		else if(this->element_type==P1bubblecondensedEnum){
++			int size   = nodes[3]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
++			int offset = 0;
++			for(int i=0;i<3;i++) offset+=nodes[i]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
++			int* indices=xNew<int>(size);
++			for(int i=0;i<size;i++) indices[i] = offset+i;
++			Ke->StaticCondensation(size,indices);
++			xDelete<int>(indices);
++		}
++	}
++
++
++}
++/*}}}*/
+ /*FUNCTION Tria::ResetCoordinateSystem{{{*/
+ void  Tria::ResetCoordinateSystem(void){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16788)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16789)
+@@ -120,6 +120,7 @@
+ 		void        PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm);
+ 		void        ResultInterpolation(int* pinterpolation,int output_enum);
+ 		void        ResultToVector(Vector<IssmDouble>* vector,int output_enum);
++		void        ReduceMatrices(ElementMatrix* Ke,ElementVector* pe);
+ 		void        ResetCoordinateSystem(void);
+ 		void	      SmbGradients();
+ 	   Element*    SpawnBasalElement(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16788)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16789)
+@@ -2653,6 +2653,65 @@
+ 	delete gauss;
+ }
+ /*}}}*/
++/*FUNCTION Penta::ReduceMatrices) {{{*/
++void Penta::ReduceMatrices(ElementMatrix* Ke,ElementVector* pe){
++
++	int analysis_type;
++	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
++
++	if(pe){
++		if(analysis_type==StressbalanceAnalysisEnum){
++			if(this->element_type==MINIcondensedEnum){
++				int approximation;
++				inputs->GetInputValue(&approximation,ApproximationEnum);
++				if(approximation==HOFSApproximationEnum || approximation==SSAFSApproximationEnum){
++					//Do nothing, condensation already done in PVectorCoupling
++				}
++				else{
++					int indices[3]={18,19,20};
++					pe->StaticCondensation(Ke,3,&indices[0]);
++				}
++			}
++			else if(this->element_type==P1bubblecondensedEnum){
++				int size   = nodes[6]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
++				int offset = 0;
++				for(int i=0;i<6;i++) offset+=nodes[i]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
++				int* indices=xNew<int>(size);
++				for(int i=0;i<size;i++) indices[i] = offset+i;
++				pe->StaticCondensation(Ke,size,indices);
++				xDelete<int>(indices);
++				delete Ke;
++			}
++		}
++	}
++
++	if(Ke){
++		if(analysis_type==StressbalanceAnalysisEnum){
++			int approximation;
++			inputs->GetInputValue(&approximation,ApproximationEnum);
++			if(approximation==HOFSApproximationEnum || approximation==SSAFSApproximationEnum){
++				//Do nothing condensatino already done for Stokes part
++			}
++			else{
++				if(this->element_type==MINIcondensedEnum){
++					int indices[3]={18,19,20};
++					Ke->StaticCondensation(3,&indices[0]);
++				}
++				else if(this->element_type==P1bubblecondensedEnum){
++					int size   = nodes[6]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
++					int offset = 0;
++					for(int i=0;i<6;i++) offset+=nodes[i]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
++					int* indices=xNew<int>(size);
++					for(int i=0;i<size;i++) indices[i] = offset+i;
++					Ke->StaticCondensation(size,indices);
++					xDelete<int>(indices);
++				}
++			}
++		}
++	}
++
++}
++/*}}}*/
+ /*FUNCTION Penta::ResultInterpolation{{{*/
+ void Penta::ResultInterpolation(int* pinterpolation,int output_enum){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16788)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16789)
+@@ -114,6 +114,7 @@
+ 		void   ResultInterpolation(int* pinterpolation,int output_enum);
+ 		void   ResultToVector(Vector<IssmDouble>* vector,int output_enum);
+ 		void   PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm);
++		void   ReduceMatrices(ElementMatrix* Ke,ElementVector* pe);
+ 		void   ResetCoordinateSystem(void);
+ 		void   SmbGradients();
+ 	   Element* SpawnBasalElement(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16788)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16789)
+@@ -77,8 +77,10 @@
+ 		void        SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters){_error_("not implemented yet");};
+ 		void        SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum){_error_("not implemented yet");};
+ 		void        CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs){_error_("not implemented yet");};
++		ElementMatrix* CreateKMatrix(void){_error_("not implemented yet");};
+ 		void        CreateDVector(Vector<IssmDouble>* df){_error_("not implemented yet");};
+ 		void        CreatePVector(Vector<IssmDouble>* pf){_error_("not implemented yet");};
++		ElementVector* CreatePVector(void){_error_("not implemented yet");};
+ 		ElementVector* CreatePVectorL2Projection(void);
+ 		void        CreateJacobianMatrix(Matrix<IssmDouble>* Jff){_error_("not implemented yet");};
+ 		void        Delta18oParameterization(void){_error_("not implemented yet");};
+@@ -146,6 +148,7 @@
+ 		void        ResultInterpolation(int* pinterpolation,int output_enum){_error_("not implemented");};
+ 		void        ResultToVector(Vector<IssmDouble>* vector,int output_enum){_error_("not implemented");};
+ 		void        ResetCoordinateSystem(void){_error_("not implemented yet");};
++		void        ReduceMatrices(ElementMatrix* Ke,ElementVector* pe){_error_("not implemented yet");};
+ 		void	      SmbGradients(){_error_("not implemented yet");};
+ 		IssmDouble  TMeltingPoint(IssmDouble pressure){_error_("not implemented yet");};
+ 		IssmDouble  SurfaceArea(void){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16789-16790.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16789-16790.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16789-16790.diff	(revision 17802)
@@ -0,0 +1,20 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16789)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16790)
+@@ -2680,7 +2680,6 @@
+ 				for(int i=0;i<size;i++) indices[i] = offset+i;
+ 				pe->StaticCondensation(Ke,size,indices);
+ 				xDelete<int>(indices);
+-				delete Ke;
+ 			}
+ 		}
+ 	}
+@@ -2709,7 +2708,6 @@
+ 			}
+ 		}
+ 	}
+-
+ }
+ /*}}}*/
+ /*FUNCTION Penta::ResultInterpolation{{{*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16790-16791.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16790-16791.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16790-16791.diff	(revision 17802)
@@ -0,0 +1,14 @@
+Index: ../trunk-jpl/src/c/modules/SurfaceAreax/SurfaceAreax.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/SurfaceAreax/SurfaceAreax.h	(revision 16790)
++++ ../trunk-jpl/src/c/modules/SurfaceAreax/SurfaceAreax.h	(revision 16791)
+@@ -5,7 +5,8 @@
+ #ifndef _SURFACEAREAX_H
+ #define _SURFACEAREAX_H
+ 
+-#include "../../classes/classes.h"
++#include "../../shared/shared.h"
++class FemModel;
+ 
+ /* local prototypes: */
+ void SurfaceAreax(IssmDouble* pS,FemModel* femmodel);
Index: issm/oecreview/Archive/16554-17801/ISSM-16791-16792.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16791-16792.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16791-16792.diff	(revision 17802)
@@ -0,0 +1,60 @@
+Index: ../trunk-jpl/src/c/classes/Params/Parameters.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Params/Parameters.h	(revision 16791)
++++ ../trunk-jpl/src/c/classes/Params/Parameters.h	(revision 16792)
+@@ -51,6 +51,7 @@
+ 		void  SetParam(Vector<IssmDouble>* vec,int enum_type);
+ 		void  SetParam(Matrix<IssmDouble>* mat,int enum_type);
+ 		void  SetParam(FILE* fid,int enum_type);
++		void  SetParam(DataSet* dataset,int enum_type);
+ 
+ 		Object* FindParamObject(int enum_type);
+ 
+Index: ../trunk-jpl/src/c/classes/Params/DataSetParam.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Params/DataSetParam.h	(revision 16791)
++++ ../trunk-jpl/src/c/classes/Params/DataSetParam.h	(revision 16792)
+@@ -21,9 +21,10 @@
+ 
+ 	private: 
+ 		int   enum_type;
++
++	public:
+ 		DataSet* value;
+ 
+-	public:
+ 		/*DataSetParam constructors, destructors: {{{*/
+ 		DataSetParam();
+ 		DataSetParam(int enum_type,DataSet* dataset);
+Index: ../trunk-jpl/src/c/classes/Params/Parameters.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Params/Parameters.cpp	(revision 16791)
++++ ../trunk-jpl/src/c/classes/Params/Parameters.cpp	(revision 16792)
+@@ -20,6 +20,7 @@
+ 
+ #include "./BoolParam.h"
+ #include "./DoubleMatParam.h"
++#include "./DataSetParam.h"
+ #include "./DoubleParam.h"
+ #include "./DoubleVecParam.h"
+ #include "./IntParam.h"
+@@ -473,7 +474,19 @@
+ 	else this->AddObject(new FileParam(enum_type,fid)); //just add the new parameter.
+ }
+ /*}}}*/
++/*FUNCTION Parameters::SetParam(DataSet* dataset, int enum_type);{{{*/
++void   Parameters::SetParam(DataSet* dataset,int enum_type){
+ 
++	Param* param=NULL;
++
++	/*first, figure out if the param has already been created: */
++	param=dynamic_cast<Param*>(this->FindParamObject(enum_type));
++
++	if(param) param->SetValue(dataset); //already exists, just set it.
++	else this->AddObject(new DataSetParam(enum_type,dataset)); //just add the new parameter.
++}
++/*}}}*/
++
+ /*FUNCTION Parameters::FindParamObject{{{*/
+ Object* Parameters::FindParamObject(int enum_type){
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16792-16793.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16792-16793.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16792-16793.diff	(revision 17802)
@@ -0,0 +1,98 @@
+Index: ../trunk-jpl/src/c/classes/Misfit.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Misfit.h	(revision 16792)
++++ ../trunk-jpl/src/c/classes/Misfit.h	(revision 16793)
+@@ -12,6 +12,8 @@
+ #include "./Elements/Element.h"
+ #include "./Elements/Elements.h"
+ #include "./FemModel.h"
++#include "../modules/SurfaceAreax/SurfaceAreax.h"
++#include "../classes/Params/Parameters.h"
+ /*}}}*/
+ 
+ class Misfit: public Object, public Definition{
+@@ -24,6 +26,9 @@
+ 		int         weights_enum;
+ 		char*       timeinterpolation;
+ 		
++		IssmDouble  misfit; //value carried over in time.
++		int         lock; // if lock is on, we just return the value stored in "misfit".  this is used so we don't compute misfit past the final_time
++		
+ 		/*Misfit constructors, destructors :*/
+ 		/*FUNCTION Misfit() {{{*/
+ 		Misfit(){
+@@ -33,6 +38,8 @@
+ 			this->observation_enum = UNDEF;
+ 			this->weights_enum = UNDEF;
+ 			this->timeinterpolation=NULL;
++			this->misfit=0;
++			this->lock=0;
+ 
+ 		}
+ 		/*}}}*/
+@@ -48,12 +55,17 @@
+ 			this->model_enum=in_model_enum;
+ 			this->observation_enum=in_observation_enum;
+ 			this->weights_enum=in_weights_enum;
++			
++			this->misfit=0;
++			this->lock=0;
+ 		}
+ 		/*}}}*/
+ 		/*FUNCTION ~Misfit() {{{*/
+ 		~Misfit(){
+ 			if(this->name)xDelete(this->name);
+ 			if(this->timeinterpolation)xDelete(this->timeinterpolation);
++			this->misfit=0;
++			this->lock=0;
+ 		}
+ 		/*}}}*/
+ 		/*Object virtual function resolutoin: */
+@@ -100,16 +112,42 @@
+ 		 IssmDouble Response(FemModel* femmodel){
+ 
+ 			 int i;
+-			 IssmDouble response=0;
+-			 IssmDouble all_response=0;
++			 IssmDouble misfit_t=0;
++			 IssmDouble all_misfit_t=0;
++			 IssmDouble dt;
++			 IssmDouble area;
++			 IssmDouble time,starttime,finaltime;
+ 
++			 femmodel->parameters->FindParam(&starttime,TimesteppingStartTimeEnum);
++			 femmodel->parameters->FindParam(&finaltime,TimesteppingFinalTimeEnum);
++			 femmodel->parameters->FindParam(&time,TimeEnum);
++
++			 /*If we are locked, return time average: */
++			 if(this->lock)return misfit/(time-starttime);
++
+ 			 for(i=0;i<femmodel->elements->Size();i++){
+ 				 Element* element=(Element*)femmodel->elements->GetObjectByOffset(i);
+-				 response+=element->Misfit(model_enum,observation_enum,weights_enum);
++				 misfit_t+=element->Misfit(model_enum,observation_enum,weights_enum);
+ 			 }
++
++			 ISSM_MPI_Allreduce ( (void*)&misfit_t,(void*)&all_misfit_t,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,IssmComm::GetComm());
++			 misfit_t=all_misfit_t;
+ 			 
+-			 ISSM_MPI_Allreduce ( (void*)&response,(void*)&all_response,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,IssmComm::GetComm());
+-			 return all_response;
++			 /*Divide by surface area: */
++			 SurfaceAreax(&area,femmodel);
++			 misfit_t=misfit_t/area;
++
++			 /*Recover delta_t: */
++			 femmodel->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
++
++			 /*Add this time's contribution to curent misfit: */
++			 misfit+=dt*misfit_t;
++
++			 /*Do we lock? i.e. are we at final_time? :*/
++			 if(time==finaltime)this->lock=1;
++
++			 /*What we return is the value of misfit / time: */
++			 return misfit/(time-starttime);
+ 		 }
+ 			/*}}}*/
+ };
Index: issm/oecreview/Archive/16554-17801/ISSM-16793-16794.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16793-16794.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16793-16794.diff	(revision 17802)
@@ -0,0 +1,34 @@
+Index: ../trunk-jpl/src/c/modules/OutputDefinitionsResponsex/OutputDefinitionsResponsex.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/OutputDefinitionsResponsex/OutputDefinitionsResponsex.cpp	(revision 16793)
++++ ../trunk-jpl/src/c/modules/OutputDefinitionsResponsex/OutputDefinitionsResponsex.cpp	(revision 16794)
+@@ -14,7 +14,7 @@
+ 	IssmDouble  return_value;
+ 
+ 	/*Ok, go find the output definitions dataset in the parameters, where our responses are hiding: */
+-	femmodel->parameters->FindParam(&output_definitions,OutputdefinitionEnum); _assert_(output_definitions);
++	output_definitions=((DataSetParam*)femmodel->parameters->FindParamObject(OutputdefinitionEnum))->value;
+ 
+ 	/*Now, go through the output definitions, and retrieve the object which corresponds to our requested response, output_string: */
+ 	for(int i=0;i<output_definitions->Size();i++){
+@@ -23,14 +23,19 @@
+ 
+ 		char* name = definition->Name();
+ 		if (strcmp(name,output_string)==0){
++
+ 			/*This is the object that we have been chasing for. compute the response and return: */
+ 			return_value=definition->Response(femmodel);
+-			delete output_definitions;
++		
++			/*cleanup: */
+ 			xDelete<char>(name);
++
++			/*return:*/
+ 			return return_value;
+ 		}
+ 		xDelete<char>(name);
+ 	}
++	
+ 	/*If we are here, did not find the definition for this response, not good!: */
+ 	_error_("Could not find the response for output definition " << output_string << " because could not find the definition itself!");
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16794-16795.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16794-16795.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16794-16795.diff	(revision 17802)
@@ -0,0 +1,50 @@
+Index: ../trunk-jpl/test/NightlyRun/IdToName.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/IdToName.m	(revision 16794)
++++ ../trunk-jpl/test/NightlyRun/IdToName.m	(revision 16795)
+@@ -27,6 +27,7 @@
+ 	case 120, name='SquareShelfConstrainedEnthalpyStea';
+ 	case 121, name='SquareShelfConstrainedEnthalpyTran';
+ 	case 122, name='SquareShelfConstrainedTransHOEnth';
++	case 123, name='SquareShelfConstrainedTranMisfitSurface';
+ 	case 201, name='SquareShelfStressSSA2d';
+ 	case 202, name='SquareShelfStressSSA3d';
+ 	case 203, name='SquareShelfStressHO';
+Index: ../trunk-jpl/test/NightlyRun/test123.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test123.m	(revision 0)
++++ ../trunk-jpl/test/NightlyRun/test123.m	(revision 16795)
+@@ -0,0 +1,23 @@
++md=triangle(model(),'../Exp/Square.exp',180000.);
++md=setmask(md,'all','');
++md=parameterize(md,'../Par/SquareShelfConstrained.par');
++md=setflowequation(md,'SSA','all');
++md.cluster=generic('name',oshostname(),'np',3);
++
++fake_surface=[[md.geometry.surface+100;1.1],...
++[md.geometry.surface+200;2.1],...
++[md.geometry.surface+300;2.5]];
++
++md.transient.requested_outputs={'default','SurfaceMisfit'};
++md.outputdefinition.definitions={misfit('name','SurfaceMisfit', 'model_enum',SurfaceEnum,'observation_enum',SurfaceObservationEnum,'observation',fake_surface,'timeinterpolation','nearestneighbor','weights',ones(md.mesh.numberofvertices,1),'weights_enum',WeightsSurfaceObservationEnum)};
++
++md=solve(md,TransientSolutionEnum());
++
++%Fields and tolerances to track changes
++field_names     ={'SurfaceMisfitFirstStep','SurfaceMisfitSecondStep','SurfaceMisfitThirdStep'};
++field_tolerances={1e-13,1e-13,1e-13};
++field_values={...
++	(md.results.TransientSolution(1).SurfaceMisfit),...
++	(md.results.TransientSolution(2).SurfaceMisfit),...
++	(md.results.TransientSolution(3).SurfaceMisfit)
++	};
+Index: ../trunk-jpl/test/Archives/Archive123.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/test/Archives/Archive123.nc
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+
Index: issm/oecreview/Archive/16554-17801/ISSM-16795-16796.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16795-16796.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16795-16796.diff	(revision 17802)
@@ -0,0 +1,29 @@
+Index: ../trunk-jpl/externalpackages/gdal/install-1.6-macosx64.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/gdal/install-1.6-macosx64.sh	(revision 16795)
++++ ../trunk-jpl/externalpackages/gdal/install-1.6-macosx64.sh	(revision 16796)
+@@ -26,8 +26,9 @@
+ 	--with-netcdf=no \
+ 	--with-jasper=no \
+ 	--without-ld-shared \
++	--without-hdf5 \
+ 	--with-unix-stdio-64=no \
+-	--with-expat-lib=/usr/lib64/libexpat.so
++	--with-expat=$ISSM_DIR/externalpackages/expat/install
+ 
+ #Compile and install gdal
+ if [ $# -eq 0 ]; then
+Index: ../trunk-jpl/externalpackages/gdal/install-1.10-macosx64.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/gdal/install-1.10-macosx64.sh	(revision 16795)
++++ ../trunk-jpl/externalpackages/gdal/install-1.10-macosx64.sh	(revision 16796)
+@@ -24,7 +24,8 @@
+ 	--with-python \
+ 	--with-netcdf=no \
+ 	--with-libiconv-prefix="/usr/lib/" \
+-	--without-hdf5
++	--without-hdf5 \
++	--with-expat=$ISSM_DIR/externalpackages/expat/install
+ #Note:
+ # look for libiconv in /usr/lib/ because there seemed to be a conflict with port's library
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16796-16797.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16796-16797.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16796-16797.diff	(revision 17802)
@@ -0,0 +1,22 @@
+Index: ../trunk-jpl/etc/environment.sh
+===================================================================
+--- ../trunk-jpl/etc/environment.sh	(revision 16796)
++++ ../trunk-jpl/etc/environment.sh	(revision 16797)
+@@ -115,7 +115,8 @@
+ libpathappend "$GDAL_DIR/lib"
+ 
+ PROJ4_DIR="$ISSM_DIR/externalpackages/proj.4/install"
+-libpathappend "$PROJ4_DIR/lib"
++dylibpathprepend "$PROJ4_DIR/lib"
++libpathprepend "$PROJ4_DIR/lib"
+ 
+ MERCURIAL_DIR="$ISSM_DIR/externalpackages/mercurial/install"
+ if [ -d "$MERCURIAL_DIR" ]; then
+@@ -289,3 +290,7 @@
+ 
+ #SHELL2JUNIT
+ pathappend   "$ISSM_DIR/externalpackages/shell2junit/install"
++
++#EXPAT
++libpathprepend   "$ISSM_DIR/externalpackages/expat/install"
++dylibpathprepend   "$ISSM_DIR/externalpackages/expat/install"
Index: issm/oecreview/Archive/16554-17801/ISSM-16797-16798.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16797-16798.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16797-16798.diff	(revision 17802)
@@ -0,0 +1,24 @@
+Index: ../trunk-jpl/src/m/coordsystems/gdaltransform.m
+===================================================================
+--- ../trunk-jpl/src/m/coordsystems/gdaltransform.m	(revision 0)
++++ ../trunk-jpl/src/m/coordsystems/gdaltransform.m	(revision 16798)
+@@ -0,0 +1,19 @@
++function [xout,yout] = gdaltransform(x,y,proj_in,proj_out)
++%GDALTRANSFORM - switch from one projection system to another 
++%
++%   Usage:
++%      [x,y] = gdaltransform(x1,y1,'EPSG:3184','EPSG:3411')
++%
++%
++
++	fid=fopen('.rand1234.txt','w');
++	for i=1:length(x),
++		fprintf(fid,'%g %g\n',x(i),y(i));
++	end
++	fclose(fid);
++
++	[s,r]=system(['gdaltransform -s_srs ',proj_in,' -t_srs ',proj_out,'  < .rand1234.txt > .rand1235.txt']);
++
++	A=textread('.rand1235.txt');
++	xout=A(:,1);
++	yout=A(:,2);
Index: issm/oecreview/Archive/16554-17801/ISSM-16798-16799.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16798-16799.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16798-16799.diff	(revision 17802)
@@ -0,0 +1,798 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16798)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16799)
+@@ -22,6 +22,9 @@
+ 		/*Finite element Analysis*/
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
++		ElementVector* CreatePVectorSSA(Element* element);
++		ElementVector* CreatePVectorSSADrivingStress(Element* element);
++		ElementVector* CreatePVectorSSAFront(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void GetSolutionFromInputsFS(Vector<IssmDouble>* solution,Element* element);
+ 		void GetSolutionFromInputsHoriz(Vector<IssmDouble>* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16798)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16799)
+@@ -805,8 +805,83 @@
+ 	_error_("not implemented yet");
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVector(Element* element){/*{{{*/
+-_error_("not implemented yet");
++
++	int approximation;
++	element->GetInputValue(&approximation,ApproximationEnum);
++	switch(approximation){
++		case SSAApproximationEnum: 
++			return CreatePVectorSSA(element);
++		default:
++			_error_("Approximation "<<EnumToStringx(approximation)<<" not supported");
++	}
+ }/*}}}*/
++ElementVector* StressbalanceAnalysis::CreatePVectorSSA(Element* element){/*{{{*/
++
++	/*compute all load vectors for this element*/
++	ElementVector* pe1=CreatePVectorSSADrivingStress(element);
++	ElementVector* pe2=CreatePVectorSSAFront(element);
++	ElementVector* pe =new ElementVector(pe1,pe2);
++
++	/*clean-up and return*/
++	delete pe1;
++	delete pe2;
++	return pe;
++}/*}}}*/
++ElementVector* StressbalanceAnalysis::CreatePVectorSSADrivingStress(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	int         i;
++	IssmDouble  driving_stress_baseline,thickness;
++	IssmDouble  Jdet;
++	IssmDouble* xyz_list=NULL;
++	IssmDouble  slope[2];
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++	IssmDouble* icefrontlevel= xNew<IssmDouble>(numnodes);
++
++	/*Initialize Element vector and vectors*/
++	ElementVector* pe=element->NewElementVector(SSAApproximationEnum);
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	Input* thickness_input=element->GetInput(ThicknessEnum);          _assert_(thickness_input); 
++	Input* surface_input  =element->GetInput(SurfaceEnum);            _assert_(surface_input);
++	Input* drag_input     =element->GetInput(FrictionCoefficientEnum);_assert_(drag_input);
++	element->GetInputListOnVertices(icefrontlevel,BedEnum);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctions(basis, gauss);
++
++		thickness_input->GetInputValue(&thickness,gauss);
++		surface_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
++		driving_stress_baseline=element->GetMaterialParameter(MaterialsRhoIceEnum)*element->GetMaterialParameter(ConstantsGEnum)*thickness;
++
++		/*Build load vector: */
++		for(i=0;i<numnodes;i++){
++			pe->values[i*NDOF2+0]+=-driving_stress_baseline*slope[0]*Jdet*gauss->weight*basis[i];
++			pe->values[i*NDOF2+1]+=-driving_stress_baseline*slope[1]*Jdet*gauss->weight*basis[i];
++		}
++	}
++
++	/*Transform coordinate system*/
++	element->TransformLoadVectorCoord(pe,XYEnum);
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	return pe;
++}/*}}}*/
++ElementVector* StressbalanceAnalysis::CreatePVectorSSAFront(Element* element){/*{{{*/
++
++}/*}}}*/
+ void StressbalanceAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 
+ 	int approximation;
+@@ -951,7 +1026,7 @@
+ 			InputUpdateFromSolutionHO(solution,element);
+ 			return;
+ 		case L1L2ApproximationEnum:
+-			InputUpdateFromSolutionSSA(solution,element);
++			InputUpdateFromSolutionL1L2(solution,element);
+ 			return;
+ 		case SSAHOApproximationEnum:
+ 			InputUpdateFromSolutionSSAHO(solution,element);
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16798)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16799)
+@@ -23,6 +23,7 @@
+ class Matpar;
+ class Input;
+ class Gauss;
++class ElementVector;
+ template <class doublematrix> class Matrix;
+ template <class doubletype> class Vector;
+ class ElementMatrix;
+@@ -53,6 +54,11 @@
+ 		virtual void   FindParam(IssmDouble* pvalue,int paramenum)=0;
+ 		virtual int    FiniteElement(void)=0;
+ 		virtual IssmDouble GetMaterialParameter(int enum_in)=0;
++		virtual void   NodalFunctions(IssmDouble* basis,Gauss* gauss)=0;
++		virtual void   TransformLoadVectorCoord(ElementVector* pe,int transformenum)=0;
++		virtual void   TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list)=0;
++		virtual void   TransformLoadVectorCoord(ElementVector* pe,int numnodes,int transformenum)=0;
++		virtual void   TransformLoadVectorCoord(ElementVector* pe,int numnodes,int* transformenum_list)=0;
+ 		virtual void   TransformSolutionCoord(IssmDouble* values,int transformenum)=0;
+ 		virtual void   TransformSolutionCoord(IssmDouble* values,int* transformenum_list)=0;
+ 		virtual void   TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum)=0;
+@@ -61,6 +67,7 @@
+ 		virtual void	GetDofList(int** pdoflist,int approximation_enum,int setenum)=0;
+ 		virtual void	GetDofListVelocity(int** pdoflist,int setenum)=0;
+ 		virtual void	GetDofListPressure(int** pdoflist,int setenum)=0;
++		virtual void   JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss)=0;
+ 		virtual void   GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int solutionenum)=0;
+ 		virtual int    GetNodeIndex(Node* node)=0;
+ 		virtual int    GetNumberOfNodes(void)=0;
+@@ -103,6 +110,8 @@
+ 		virtual int    NumberofNodesVelocity(void)=0;
+ 		virtual int    NumberofNodesPressure(void)=0;
+ 		virtual Gauss* NewGauss(void)=0;
++		virtual Gauss* NewGauss(int order)=0;
++		virtual ElementVector*  NewElementVector(int approximation_enum)=0;
+ 		virtual void   InputScale(int enum_type,IssmDouble scale_factor)=0;
+ 		virtual void   GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum)=0;
+ 		virtual IssmDouble TimeAdapt()=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16798)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16799)
+@@ -2043,6 +2043,14 @@
+ 	return onbed;
+ }
+ /*}}}*/
++/*FUNCTION Tria::JacobianDeterminant{{{*/
++void Tria::JacobianDeterminant(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussTriaEnum);
++	this->JacobianDeterminant(pJdet,xyz_list,(GaussTria*)gauss);
++
++}
++/*}}}*/
+ /*FUNCTION Tria::HasEdgeOnBed {{{*/
+ bool Tria::HasEdgeOnBed(){
+ 
+@@ -2228,11 +2236,21 @@
+ 	return shelf;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::NewGauss{{{*/
++/*FUNCTION Tria::NewGauss(){{{*/
+ Gauss* Tria::NewGauss(void){
+ 	return new GaussTria();
+ }
+ /*}}}*/
++/*FUNCTION Tria::NewGauss(int order){{{*/
++Gauss* Tria::NewGauss(int order){
++	return new GaussTria(order);
++}
++/*}}}*/
++/*FUNCTION Tria::NewElementVector{{{*/
++ElementVector* Tria::NewElementVector(int approximation_enum){
++	return new ElementVector(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
++}
++/*}}}*/
+ /*FUNCTION Tria::NoIceInElement {{{*/
+ bool   Tria::NoIceInElement(){
+ 
+@@ -2247,6 +2265,14 @@
+ 	return true;
+ }
+ /*}}}*/
++/*FUNCTION Tria::NodalFunctions{{{*/
++void Tria::NodalFunctions(IssmDouble* basis, Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussTriaEnum);
++	this->GetNodalFunctions(basis,(GaussTria*)gauss);
++
++}
++/*}}}*/
+ /*FUNCTION Tria::NodalValue {{{*/
+ int    Tria::NodalValue(IssmDouble* pvalue, int index, int natureofdataenum){
+ 
+@@ -2733,6 +2759,20 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Tria::TransformLoadVectorCoord{{{*/
++void Tria::TransformLoadVectorCoord(ElementVector* pe,int transformenum){
++
++	::TransformLoadVectorCoord(pe,this->nodes,this->NumberofNodes(),transformenum);
++
++}
++/*}}}*/
++/*FUNCTION Tria::TransformLoadVectorCoord{{{*/
++void Tria::TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list){
++
++	::TransformLoadVectorCoord(pe,this->nodes,this->NumberofNodes(),transformenum_list);
++
++}
++/*}}}*/
+ /*FUNCTION Tria::Update{{{*/
+ void Tria::Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finiteelement_type){
+ 
+@@ -3910,7 +3950,7 @@
+ 
+ 
+ 	/*Transform coordinate system*/
+-	TransformLoadVectorCoord(pe,nodes,(vnumnodes+pnumnodes),cs_list);
++	::TransformLoadVectorCoord(pe,nodes,(vnumnodes+pnumnodes),cs_list);
+ 
+ 	/*Clean up and return*/
+ 	xDelete<int>(cs_list);
+@@ -3971,7 +4011,7 @@
+ 	}
+ 
+ 	/*Transform coordinate system*/
+-	TransformLoadVectorCoord(pe,nodes,vnumnodes+pnumnodes,cs_list);
++	::TransformLoadVectorCoord(pe,nodes,vnumnodes+pnumnodes,cs_list);
+ 
+ 	/*Clean up and return*/
+ 	delete gauss;
+@@ -4041,7 +4081,7 @@
+ 	}
+ 
+ 	/*Transform coordinate system*/
+-	TransformLoadVectorCoord(pe,nodes,(vnumnodes+pnumnodes),cs_list);
++	::TransformLoadVectorCoord(pe,nodes,(vnumnodes+pnumnodes),cs_list);
+ 
+ 	/*Clean up and return*/
+ 	delete gauss;
+@@ -4110,7 +4150,7 @@
+ 	}
+ 
+ 	/*Transform coordinate system*/
+-	TransformLoadVectorCoord(pe,nodes,numnodes,XYEnum);
++	::TransformLoadVectorCoord(pe,nodes,numnodes,XYEnum);
+ 
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(basis);
+@@ -4190,7 +4230,7 @@
+ 	}
+ 
+ 	/*Transform coordinate system*/
+-	TransformLoadVectorCoord(pe,nodes,numnodes,XYEnum);
++	::TransformLoadVectorCoord(pe,nodes,numnodes,XYEnum);
+ 
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(basis);
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16798)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16799)
+@@ -267,10 +267,18 @@
+ 		void	         InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type);
+ 		void	         InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solution,int enum_type){_error_("not implemented yet");};
+ 		bool	         IsInput(int name);
++		void           JacobianDeterminant(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss);
+ 		Gauss*         NewGauss(void);
++		Gauss*         NewGauss(int order);
++		ElementVector* NewElementVector(int approximation_enum);
++		void           NodalFunctions(IssmDouble* basis,Gauss* gauss);
+ 		void	         SetClone(int* minranks);
+ 		Seg*	         SpawnSeg(int index1,int index2);
+ 		void	         SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]);
++		void           TransformLoadVectorCoord(ElementVector* pe,int transformenum);
++		void           TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list);
++		void           TransformLoadVectorCoord(ElementVector* pe,int numnodes,int transformenum){_error_("not implemented yet");};
++		void           TransformLoadVectorCoord(ElementVector* pe,int numnodes,int* transformenum_list){_error_("not implemented yet");};
+ 		void           TransformSolutionCoord(IssmDouble* values,int transformenum);
+ 		void           TransformSolutionCoord(IssmDouble* values,int* transformenum_list);
+ 		void           TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16798)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16799)
+@@ -2518,6 +2518,14 @@
+ 	return onsurface;
+ }
+ /*}}}*/
++/*FUNCTION Penta::JacobianDeterminant{{{*/
++void Penta::JacobianDeterminant(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussPentaEnum);
++	this->GetJacobianDeterminant(pJdet,xyz_list,(GaussPenta*)gauss);
++
++}
++/*}}}*/
+ /*FUNCTION Penta::NoIceInElement {{{*/
+ bool   Penta::NoIceInElement(){
+ 
+@@ -2586,11 +2594,16 @@
+ 	return found;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::NewGauss{{{*/
++/*FUNCTION Penta::NewGauss(){{{*/
+ Gauss* Penta::NewGauss(void){
+ 	return new GaussPenta();
+ }
+ /*}}}*/
++/*FUNCTION Penta::NewGauss(int order){{{*/
++Gauss* Penta::NewGauss(int order){
++	return new GaussPenta(order,order);
++}
++/*}}}*/
+ /*FUNCTION Penta::NumberofNodesPressure{{{*/
+ int Penta::NumberofNodesPressure(void){
+ 	return PentaRef::NumberofNodesPressure();
+@@ -8020,7 +8033,7 @@
+ 	}
+ 
+ 	/*Transform coordinate system*/
+-	TransformLoadVectorCoord(pe,nodes,vnumnodes+pnumnodes,cs_list);
++	::TransformLoadVectorCoord(pe,nodes,vnumnodes+pnumnodes,cs_list);
+ 
+ 	/*Clean up and return*/
+ 	xDelete<int>(cs_list);
+@@ -8098,7 +8111,7 @@
+ 	}
+ 
+ 	/*Transform coordinate system*/
+-	TransformLoadVectorCoord(pe,nodes,(vnumnodes+pnumnodes),cs_list);
++	::TransformLoadVectorCoord(pe,nodes,(vnumnodes+pnumnodes),cs_list);
+ 
+ 	/*Clean up and return*/
+ 	xDelete<int>(cs_list);
+@@ -8182,7 +8195,7 @@
+ 	}
+ 
+ 	/*Transform coordinate system*/
+-	TransformLoadVectorCoord(pe,nodes,vnumnodes+pnumnodes,cs_list);
++	::TransformLoadVectorCoord(pe,nodes,vnumnodes+pnumnodes,cs_list);
+ 
+ 	/*Clean up and return*/
+ 	xDelete<int>(cs_list);
+@@ -8263,7 +8276,7 @@
+ 	}
+ 
+ 	/*Transform coordinate system*/
+-	TransformLoadVectorCoord(pe,nodes,vnumnodes+pnumnodes,cs_list);
++	::TransformLoadVectorCoord(pe,nodes,vnumnodes+pnumnodes,cs_list);
+ 
+ 	/*Clean up and return*/
+ 	xDelete<int>(cs_list);
+@@ -8541,7 +8554,7 @@
+ 	}
+ 
+ 	/*Transform coordinate system*/
+-	TransformLoadVectorCoord(pe,nodes,numnodes,XYEnum);
++	::TransformLoadVectorCoord(pe,nodes,numnodes,XYEnum);
+ 
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(basis);
+@@ -8624,7 +8637,7 @@
+ 	}
+ 
+ 	/*Transform coordinate system*/
+-	TransformLoadVectorCoord(pe,nodes,numnodes,XYEnum);
++	::TransformLoadVectorCoord(pe,nodes,numnodes,XYEnum);
+ 
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(basis);
+@@ -8732,7 +8745,7 @@
+ 	}
+ 
+ 	/*Transform coordinate system*/
+-	TransformLoadVectorCoord(pe,nodes,(vnumnodes+pnumnodes),cs_list);
++	::TransformLoadVectorCoord(pe,nodes,(vnumnodes+pnumnodes),cs_list);
+ 
+ 	/*Clean up and return*/
+ 	xDelete<int>(cs_list);
+@@ -8886,7 +8899,7 @@
+ 	}
+ 
+ 	/*Transform coordinate system*/
+-	TransformLoadVectorCoord(pe,nodes,vnumnodes+pnumnodes,cs_list);
++	::TransformLoadVectorCoord(pe,nodes,vnumnodes+pnumnodes,cs_list);
+ 
+ 	/*Clean up and return*/
+ 	delete gauss;
+@@ -8971,7 +8984,7 @@
+ 	}
+ 
+ 	/*Transform coordinate system*/
+-	TransformLoadVectorCoord(pe,nodes,(vnumnodes+pnumnodes),cs_list);
++	::TransformLoadVectorCoord(pe,nodes,(vnumnodes+pnumnodes),cs_list);
+ 
+ 	/*Clean up and return*/
+ 	delete gauss;
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16798)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16799)
+@@ -239,12 +239,20 @@
+ 		bool	         IsOnBed(void);
+ 		bool           IsFloating(void); 
+ 		bool           IsNodeOnShelfFromFlags(IssmDouble* flags);
++		void           JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss);
+ 		bool           NoIceInElement(void); 
+ 		Gauss*         NewGauss(void);
++		Gauss*         NewGauss(int order);
++		ElementVector* NewElementVector(int approximation_enum){_error_("not implemented yet");};
++		void           NodalFunctions(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+ 		IssmDouble     MinEdgeLength(IssmDouble xyz_list[6][3]);
+ 		void	         SetClone(int* minranks);
+ 		Tria*	         SpawnTria(int location);
+ 		void	         SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]);
++		void           TransformLoadVectorCoord(ElementVector* pe,int transformenum){_error_("not implemented yet");};
++		void           TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list){_error_("not implemented yet");};
++		void           TransformLoadVectorCoord(ElementVector* pe,int numnodes,int transformenum){_error_("not implemented yet");};      /*Tiling only*/
++		void           TransformLoadVectorCoord(ElementVector* pe,int numnodes,int* transformenum_list){_error_("not implemented yet");};/*Tiling only*/
+ 		void           TransformSolutionCoord(IssmDouble* values,int transformenum);
+ 		void           TransformSolutionCoord(IssmDouble* values,int* transformenum_list);
+ 		void           TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum);      /*Tiling only*/
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16798)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16799)
+@@ -108,6 +108,8 @@
+ 		bool        IsOnBed(){_error_("not implemented yet");};
+ 		bool        IsFloating(){_error_("not implemented yet");};
+ 		bool        IsNodeOnShelfFromFlags(IssmDouble* flags){_error_("not implemented yet");};
++		void        JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
++		void        NodalFunctions(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+ 		bool        NoIceInElement(){_error_("not implemented yet");};
+ 		int         NumberofNodesVelocity(void){_error_("not implemented yet");};
+ 		int         NumberofNodesPressure(void){_error_("not implemented yet");};
+@@ -123,6 +125,8 @@
+ 		void        GetInputValue(IssmDouble* pvalue,int enum_type){_error_("not implemented yet");};
+ 		void        GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");};
+ 		Gauss*      NewGauss(void){_error_("not implemented yet");};
++		Gauss*      NewGauss(int order){_error_("not implemented yet");};
++		ElementVector* NewElementVector(int approximation_enum){_error_("not implemented yet");};
+ 		#ifdef _HAVE_THERMAL_
+ 		void UpdateBasalConstraintsEnthalpy(void){_error_("not implemented yet");};
+ 		void ComputeBasalMeltingrate(void){_error_("not implemented yet");};
+@@ -154,6 +158,10 @@
+ 		IssmDouble  SurfaceArea(void){_error_("not implemented yet");};
+ 		void        Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement){_error_("not implemented yet");};
+ 		IssmDouble  TimeAdapt(){_error_("not implemented yet");};
++		void        TransformLoadVectorCoord(ElementVector* pe,int transformenum){_error_("not implemented yet");};
++		void        TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list){_error_("not implemented yet");};
++		void        TransformLoadVectorCoord(ElementVector* pe,int numnodes,int transformenum){_error_("not implemented yet");};
++		void        TransformLoadVectorCoord(ElementVector* pe,int numnodes,int* transformenum_list){_error_("not implemented yet");};
+ 		void        TransformSolutionCoord(IssmDouble* values,int transformenum){_error_("not implemented yet");};
+ 		void        TransformSolutionCoord(IssmDouble* values,int* transformenum_list){_error_("not implemented yet");};
+ 		void        TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/gauss/Gauss.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/Gauss.h	(revision 16798)
++++ ../trunk-jpl/src/c/classes/gauss/Gauss.h	(revision 16799)
+@@ -8,8 +8,9 @@
+ class Gauss{
+ 
+ 	public: 
++		IssmDouble   weight;
++
+ 		virtual        ~Gauss(){};
+-
+ 		virtual int  begin(void)=0;
+ 		virtual int  end(void)=0;
+ 		virtual void Echo(void)=0;
+Index: ../trunk-jpl/src/c/classes/Inputs/SegInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/SegInput.cpp	(revision 16798)
++++ ../trunk-jpl/src/c/classes/Inputs/SegInput.cpp	(revision 16799)
+@@ -104,11 +104,12 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION SegInput::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, GaussSeg* gauss){{{*/
+-void SegInput::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, GaussSeg* gauss){
++/*FUNCTION SegInput::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, Gauss* gauss){{{*/
++void SegInput::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list,Gauss* gauss){
+ 
+ 	/*Call SegRef function*/
+-	SegRef::GetInputDerivativeValue(p,&values[0],xyz_list,gauss);
++	_assert_(gauss->Enum()==GaussSegEnum);
++	SegRef::GetInputDerivativeValue(p,&values[0],xyz_list,(GaussSeg*)gauss);
+ }
+ /*}}}*/
+ /*FUNCTION SegInput::Configure{{{*/
+Index: ../trunk-jpl/src/c/classes/Inputs/DoubleInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/DoubleInput.h	(revision 16798)
++++ ../trunk-jpl/src/c/classes/Inputs/DoubleInput.h	(revision 16799)
+@@ -48,9 +48,7 @@
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss);
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){_error_("not implemented yet");};
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index){_error_("not implemented yet");};
+-		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss){_error_("not implemented yet");};
+-		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss);
+-		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss);
++		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void GetInputAverage(IssmDouble* pvalue);
+ 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
+ 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/ControlInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/ControlInput.cpp	(revision 16798)
++++ ../trunk-jpl/src/c/classes/Inputs/ControlInput.cpp	(revision 16799)
+@@ -246,14 +246,10 @@
+ void ControlInput::GetGradientValue(IssmDouble* pvalue,GaussPenta* gauss){
+ 	gradient->GetInputValue(pvalue,gauss);
+ }/*}}}*/
+-/*FUNCTION ControlInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){{{*/
+-void ControlInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){
++/*FUNCTION ControlInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, Gauss* gauss){{{*/
++void ControlInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, Gauss* gauss){
+ 	values->GetInputDerivativeValue(derivativevalues,xyz_list,gauss);
+ }/*}}}*/
+-/*FUNCTION ControlInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){{{*/
+-void ControlInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){
+-	values->GetInputDerivativeValue(derivativevalues,xyz_list,gauss);
+-}/*}}}*/
+ /*FUNCTION ControlInput::SaveValue{{{*/
+ void ControlInput::SaveValue(void){
+ 	if(!values) _error_("Values of " << EnumToStringx(this->enum_type) << " not found");
+Index: ../trunk-jpl/src/c/classes/Inputs/SegInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/SegInput.h	(revision 16798)
++++ ../trunk-jpl/src/c/classes/Inputs/SegInput.h	(revision 16799)
+@@ -47,12 +47,9 @@
+ 		void GetInputValue(int* pvalue){_error_("not implemented yet");}
+ 		void GetInputValue(IssmDouble* pvalue){_error_("not implemented yet");}
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss);
+-		void GetInputValue(IssmDouble* pvalue,GaussTria* gauss){_error_("not implemented yet");};
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){_error_("not implemented yet");};
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index){_error_("not implemented yet");};
+-		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss);
+-		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){_error_("not implemented yet");};
+-		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
++		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetInputAverage(IssmDouble* pvalue);
+ 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
+ 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/Input.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/Input.h	(revision 16798)
++++ ../trunk-jpl/src/c/classes/Inputs/Input.h	(revision 16799)
+@@ -31,9 +31,7 @@
+ 		virtual void GetInputValue(IssmDouble* pvalue,Gauss* gauss)=0;
+ 		virtual void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time)=0;
+ 		virtual void GetInputValue(IssmDouble* pvalue,Gauss* gauss,int index)=0;
+-		virtual void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss)=0;
+-		virtual void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss)=0;
+-		virtual void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss)=0;
++		virtual void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, Gauss* gauss)=0;
+ 		virtual void GetInputAverage(IssmDouble* pvalue)=0;
+ 		virtual void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes)=0;
+ 		virtual void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime)=0;
+Index: ../trunk-jpl/src/c/classes/Inputs/ControlInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/ControlInput.h	(revision 16798)
++++ ../trunk-jpl/src/c/classes/Inputs/ControlInput.h	(revision 16799)
+@@ -55,9 +55,7 @@
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss);
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){_error_("not implemented yet");};
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index){_error_("not implemented yet");};
+-		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss){_error_("not implemented yet");};
+-		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss);
+-		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss);
++		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetInputAverage(IssmDouble* pvalue);
+ 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
+ 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/DatasetInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/DatasetInput.h	(revision 16798)
++++ ../trunk-jpl/src/c/classes/Inputs/DatasetInput.h	(revision 16799)
+@@ -50,9 +50,7 @@
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss){_error_("not implemented yet");};
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){_error_("not implemented yet");};
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index);
+-		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss){_error_("not implemented yet");};
+-		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){_error_("not implemented yet");};
+-		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
++		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void GetInputAverage(IssmDouble* pvalue){_error_("not implemented yet");};
+ 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
+ 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/IntInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/IntInput.cpp	(revision 16798)
++++ ../trunk-jpl/src/c/classes/Inputs/IntInput.cpp	(revision 16799)
+@@ -114,12 +114,6 @@
+ /*FUNCTION IntInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){{{*/
+ void IntInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){_error_("not supported yet!");}
+ /*}}}*/
+-/*FUNCTION IntInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){{{*/
+-void IntInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){_error_("not supported yet!");}
+-/*}}}*/
+-/*FUNCTION IntInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){{{*/
+-void IntInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){_error_("not supported yet!");}
+-/*}}}*/
+ /*FUNCTION IntInput::ChangeEnum{{{*/
+ void IntInput::ChangeEnum(int newenumtype){
+ 	this->enum_type=newenumtype;
+Index: ../trunk-jpl/src/c/classes/Inputs/BoolInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/BoolInput.cpp	(revision 16798)
++++ ../trunk-jpl/src/c/classes/Inputs/BoolInput.cpp	(revision 16799)
+@@ -114,12 +114,6 @@
+ /*FUNCTION BoolInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){{{*/
+ void BoolInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){_error_("not supported yet!");}
+ /*}}}*/
+-/*FUNCTION BoolInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){{{*/
+-void BoolInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){_error_("not supported yet!");}
+-/*}}}*/
+-/*FUNCTION BoolInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){{{*/
+-void BoolInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){_error_("not supported yet!");}
+-/*}}}*/
+ /*FUNCTION BoolInput::ChangeEnum{{{*/
+ void BoolInput::ChangeEnum(int newenumtype){
+ 	this->enum_type=newenumtype;
+Index: ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 16798)
++++ ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 16799)
+@@ -132,11 +132,12 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION TriaInput::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, GaussTria* gauss){{{*/
+-void TriaInput::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, GaussTria* gauss){
++/*FUNCTION TriaInput::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, Gauss* gauss){{{*/
++void TriaInput::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, Gauss* gauss){
+ 
+ 	/*Call TriaRef function*/
+-	TriaRef::GetInputDerivativeValue(p,&values[0],xyz_list,gauss);
++	_assert_(gauss->Enum()==GaussTriaEnum);
++	TriaRef::GetInputDerivativeValue(p,&values[0],xyz_list,(GaussTria*)gauss);
+ }
+ /*}}}*/
+ /*FUNCTION TriaInput::GetVxStrainRate2d{{{*/
+Index: ../trunk-jpl/src/c/classes/Inputs/IntInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/IntInput.h	(revision 16798)
++++ ../trunk-jpl/src/c/classes/Inputs/IntInput.h	(revision 16799)
+@@ -49,9 +49,7 @@
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss);
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){_error_("not implemented yet");};
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index){_error_("not implemented yet");};
+-		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss){_error_("not implemented yet");};
+-		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss);
+-		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss);
++		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void GetInputAverage(IssmDouble* pvalue){_error_("not implemented yet");};
+ 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
+ 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/BoolInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/BoolInput.h	(revision 16798)
++++ ../trunk-jpl/src/c/classes/Inputs/BoolInput.h	(revision 16799)
+@@ -49,9 +49,7 @@
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss);
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){_error_("not implemented yet");};
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index){_error_("not implemented yet");};
+-		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss){_error_("not implemented yet");};
+-		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss);
+-		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss);
++		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+ 		void GetInputAverage(IssmDouble* pvalue){_error_("not implemented yet");};
+ 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
+ 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/TriaInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TriaInput.h	(revision 16798)
++++ ../trunk-jpl/src/c/classes/Inputs/TriaInput.h	(revision 16799)
+@@ -49,9 +49,7 @@
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss);
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){_error_("not implemented yet");};
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss,int index){_error_("not implemented yet");};
+-		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss){_error_("not implemented yet");};
+-		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss);
+-		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
++		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetInputAverage(IssmDouble* pvalue);
+ 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes);
+ 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime);
+Index: ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 16798)
++++ ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 16799)
+@@ -145,11 +145,12 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION PentaInput::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, GaussPenta* gauss){{{*/
+-void PentaInput::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, GaussPenta* gauss){
++/*FUNCTION PentaInput::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, Gauss* gauss){{{*/
++void PentaInput::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list,Gauss* gauss){
+ 
+ 	/*Call PentaRef function*/
+-	PentaRef::GetInputDerivativeValue(p,&values[0],xyz_list,gauss);
++	_assert_(gauss->Enum()==GaussPentaEnum);
++	PentaRef::GetInputDerivativeValue(p,&values[0],xyz_list,(GaussPenta*)gauss);
+ }
+ /*}}}*/
+ /*FUNCTION PentaInput::GetVxStrainRate3d{{{*/
+Index: ../trunk-jpl/src/c/classes/Inputs/TransientInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TransientInput.cpp	(revision 16798)
++++ ../trunk-jpl/src/c/classes/Inputs/TransientInput.cpp	(revision 16799)
+@@ -191,8 +191,8 @@
+ 	delete input;
+ }
+ /*}}}*/
+-/*FUNCTION TransientInput::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, GaussTria* gauss){{{*/
+-void TransientInput::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, GaussTria* gauss){
++/*FUNCTION TransientInput::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, Gauss* gauss){{{*/
++void TransientInput::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, Gauss* gauss){
+ 
+ 	IssmDouble time;
+ 
+@@ -206,7 +206,6 @@
+ 	input->GetInputDerivativeValue(p,xyz_list,gauss);
+ 
+ 	delete input;
+-
+ }
+ /*}}}*/
+ /*FUNCTION TransientInput::ChangeEnum{{{*/
+Index: ../trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp	(revision 16798)
++++ ../trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp	(revision 16799)
+@@ -122,12 +122,6 @@
+ /*FUNCTION DoubleInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){{{*/
+ void DoubleInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){*pvalue=this->value;}
+ /*}}}*/
+-/*FUNCTION DoubleInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){{{*/
+-void DoubleInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){_error_("not supported yet!");}
+-/*}}}*/
+-/*FUNCTION DoubleInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){{{*/
+-void DoubleInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){_error_("not supported yet!");}
+-/*}}}*/
+ /*FUNCTION DoubleInput::GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){{{*/
+ void DoubleInput::GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){
+ 	/*Epsilon is zero as vx is constant over the element*/
+Index: ../trunk-jpl/src/c/classes/Inputs/PentaInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/PentaInput.h	(revision 16798)
++++ ../trunk-jpl/src/c/classes/Inputs/PentaInput.h	(revision 16799)
+@@ -48,9 +48,7 @@
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss);
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){_error_("not implemented yet");};
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index){_error_("not implemented yet");};
+-		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss){_error_("not implemented yet");};
+-		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){_error_("not implemented yet");};
+-		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss);
++		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetInputAverage(IssmDouble* pvalue);
+ 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
+ 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/TransientInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TransientInput.h	(revision 16798)
++++ ../trunk-jpl/src/c/classes/Inputs/TransientInput.h	(revision 16799)
+@@ -54,9 +54,7 @@
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss);
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time);
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index){_error_("not implemented yet");};
+-		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss){_error_("not implemented yet");};
+-		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss);
+-		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
++		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetInputAverage(IssmDouble* pvalue);
+ 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes);
+ 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime);
Index: issm/oecreview/Archive/16554-17801/ISSM-16799-16800.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16799-16800.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16799-16800.diff	(revision 17802)
@@ -0,0 +1,311 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16799)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16800)
+@@ -880,7 +880,7 @@
+ 	return pe;
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorSSAFront(Element* element){/*{{{*/
+-
++	return NULL;
+ }/*}}}*/
+ void StressbalanceAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16799)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16800)
+@@ -42,10 +42,8 @@
+ 		virtual void   AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
+ 		virtual void   AddInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
+ 		virtual void   AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
+-		virtual void   CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>*  Kfs)=0;
+ 		virtual ElementMatrix* CreateKMatrix(void)=0;
+ 		virtual void   CreateDVector(Vector<IssmDouble>* df)=0;
+-		virtual void   CreatePVector(Vector<IssmDouble>* pf)=0;
+ 		virtual ElementVector* CreatePVector(void)=0;
+ 		virtual void   CreateJacobianMatrix(Matrix<IssmDouble>* Jff)=0;
+ 		virtual void   DeleteMaterials(void)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16799)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16800)
+@@ -197,38 +197,6 @@
+ 	this->material->inputs->AddInput(new TriaInput(input_enum,values,interpolation_enum));
+ }
+ /*}}}*/
+-/*FUNCTION Tria::CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs) {{{*/
+-void  Tria::CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs){
+-
+-
+-	/*Skip if water element*/
+-	if(NoIceInElement()) return;
+-
+-	/*Create element stiffness matrix*/
+-	ElementMatrix* Ke=CreateKMatrix();
+-
+-	if(Ke){
+-		/*Static condensation if requested*/
+-		if(this->element_type==MINIcondensedEnum){
+-			int indices[2]={6,7};
+-			Ke->StaticCondensation(2,&indices[0]);
+-		}
+-		else if(this->element_type==P1bubblecondensedEnum){
+-			int size   = nodes[3]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
+-			int offset = 0;
+-			for(int i=0;i<3;i++) offset+=nodes[i]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
+-			int* indices=xNew<int>(size);
+-			for(int i=0;i<size;i++) indices[i] = offset+i;
+-			Ke->StaticCondensation(size,indices);
+-			xDelete<int>(indices);
+-		}
+-
+-		/*Add to global matrix*/
+-		Ke->AddToGlobal(Kff,Kfs);
+-		delete Ke;
+-	}
+-}
+-/*}}}*/
+ /*FUNCTION Tria::CreateKMatrix(void) {{{*/
+ ElementMatrix* Tria::CreateKMatrix(void){
+ 
+@@ -412,48 +380,6 @@
+ 	/*Nothing done yet*/
+ }
+ /*}}}*/
+-/*FUNCTION Tria::CreatePVector(Vector<IssmDouble>* pf) {{{*/
+-void  Tria::CreatePVector(Vector<IssmDouble>* pf){
+-
+-	/*Skip if water element*/
+-	if(NoIceInElement()) return;
+-
+-	/*Create element load vector*/
+-	ElementVector* pe = CreatePVector();
+-
+-	/*Add to global Vector*/
+-	if(pe){
+-		/*Static condensation if requested*/
+-		if(this->element_type==MINIcondensedEnum){
+-			int indices[2]={6,7};
+-			this->element_type=MINIEnum;
+-			ElementMatrix* Ke = CreateKMatrixStressbalanceFS();
+-			this->element_type=MINIcondensedEnum;
+-
+-			pe->StaticCondensation(Ke,2,&indices[0]);
+-			delete Ke;
+-		}
+-		else if(this->element_type==P1bubblecondensedEnum){
+-			int size   = nodes[3]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
+-			int offset = 0;
+-			for(int i=0;i<3;i++) offset+=nodes[i]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
+-			int* indices=xNew<int>(size);
+-			for(int i=0;i<size;i++) indices[i] = offset+i;
+-
+-			this->element_type=P1bubbleEnum;
+-			ElementMatrix* Ke = CreateKMatrix();
+-			this->element_type=P1bubblecondensedEnum;
+-
+-			pe->StaticCondensation(Ke,size,indices);
+-			xDelete<int>(indices);
+-			delete Ke;
+-		}
+-
+-		pe->AddToGlobal(pf);
+-		delete pe;
+-	}
+-}
+-/*}}}*/
+ /*FUNCTION Tria::CreatePVector(void){{{*/
+ ElementVector* Tria::CreatePVector(void){
+ 
+@@ -1225,6 +1151,16 @@
+ 	return this->matpar->GetMaterialParameter(enum_in);
+ }
+ /*}}}*/
++/*FUNCTION Tria::GetVerticesCoordinates(IssmDouble** pxyz_list){{{*/
++void Tria::GetVerticesCoordinates(IssmDouble** pxyz_list){
++
++	IssmDouble* xyz_list = xNew<IssmDouble>(NUMVERTICES*3);
++	::GetVerticesCoordinates(xyz_list,this->vertices,NUMVERTICES);
++
++	/*Assign output pointer*/
++	*pxyz_list = xyz_list;
++
++}/*}}}*/
+ /*FUNCTION Tria::GetSegmentNormal {{{*/
+ void Tria:: GetSegmentNormal(IssmDouble* normal,IssmDouble xyz_list[2][3]){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16799)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16800)
+@@ -72,9 +72,7 @@
+ 		void        Configure(Elements* elements,Loads* loads,Nodes* nodesin,Vertices* verticesin,Materials* materials,Parameters* parameters);
+ 		void        SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters);
+ 		void        SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum);
+-		void        CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs);
+ 		void        CreateDVector(Vector<IssmDouble>* df);
+-		void        CreatePVector(Vector<IssmDouble>* pf);
+ 		void        CreateJacobianMatrix(Matrix<IssmDouble>* Jff);
+ 		void        DeleteMaterials(void);
+ 		void        Delta18oParameterization(void);
+@@ -110,7 +108,7 @@
+ 		bool        NoIceInElement();
+ 		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
+ 		void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum);
+-		void        GetVerticesCoordinates(IssmDouble** pxyz_list){_error_("not implemented yet");};
++		void        GetVerticesCoordinates(IssmDouble** pxyz_list);
+ 		void        InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);
+ 		void        InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum=MeshElementsEnum);
+ 		void        InputDuplicate(int original_enum,int new_enum);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16799)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16800)
+@@ -415,48 +415,6 @@
+ 	this->inputs->Configure(parameters);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs) {{{*/
+-void  Penta::CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs){
+-
+-	/*Skip if water element*/
+-	if(NoIceInElement()) return;
+-
+-	/*Create element stiffness matrix*/
+-	ElementMatrix* Ke=CreateKMatrix();
+-
+-	if(Ke){
+-		int analysis_type;
+-		parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-		if(analysis_type==StressbalanceAnalysisEnum){
+-			int approximation;
+-			inputs->GetInputValue(&approximation,ApproximationEnum);
+-			if(approximation==HOFSApproximationEnum || approximation==SSAFSApproximationEnum){
+-				//Do nothing condensatino already done for Stokes part
+-			}
+-			else{
+-				/*Condense if requested*/
+-				if(this->element_type==MINIcondensedEnum){
+-					int indices[3]={18,19,20};
+-					Ke->StaticCondensation(3,&indices[0]);
+-				}
+-				else if(this->element_type==P1bubblecondensedEnum){
+-					int size   = nodes[6]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
+-					int offset = 0;
+-					for(int i=0;i<6;i++) offset+=nodes[i]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
+-					int* indices=xNew<int>(size);
+-					for(int i=0;i<size;i++) indices[i] = offset+i;
+-					Ke->StaticCondensation(size,indices);
+-					xDelete<int>(indices);
+-				}
+-			}
+-		}
+-
+-		/*Add to global matrix*/
+-		Ke->AddToGlobal(Kff,Kfs);
+-		delete Ke;
+-	}
+-}
+-/*}}}*/
+ /*FUNCTION Penta::CreateKMatrix(void){{{*/
+ ElementMatrix* Penta::CreateKMatrix(void){
+ 
+@@ -620,59 +578,6 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Penta::CreatePVector(Vector<IssmDouble>* pf) {{{*/
+-void  Penta::CreatePVector(Vector<IssmDouble>* pf){
+-
+-	/*Skip if water element*/
+-	if(NoIceInElement()) return;
+-
+-	/*Create element load vector*/
+-	ElementVector* pe = CreatePVector();
+-
+-	if(pe){
+-		int analysis_type;
+-		parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-		if(analysis_type==StressbalanceAnalysisEnum){
+-			/*StaticCondensation if requested*/
+-			if(this->element_type==MINIcondensedEnum){
+-				int approximation;
+-				inputs->GetInputValue(&approximation,ApproximationEnum);
+-				if(approximation==HOFSApproximationEnum || approximation==SSAFSApproximationEnum){
+-					//Do nothing, condensation already done in PVectorCoupling
+-				}
+-				else{
+-					int indices[3]={18,19,20};
+-
+-					this->element_type=MINIEnum;
+-					ElementMatrix* Ke = CreateKMatrixStressbalanceFS();
+-					this->element_type=MINIcondensedEnum;
+-
+-					pe->StaticCondensation(Ke,3,&indices[0]);
+-					delete Ke;
+-				}
+-			}
+-			else if(this->element_type==P1bubblecondensedEnum){
+-				int size   = nodes[6]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
+-				int offset = 0;
+-				for(int i=0;i<6;i++) offset+=nodes[i]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
+-				int* indices=xNew<int>(size);
+-				for(int i=0;i<size;i++) indices[i] = offset+i;
+-
+-				this->element_type=P1bubbleEnum;
+-				ElementMatrix* Ke = CreateKMatrix();
+-				this->element_type=P1bubblecondensedEnum;
+-				pe->StaticCondensation(Ke,size,indices);
+-				xDelete<int>(indices);
+-				delete Ke;
+-			}
+-		}
+-
+-		/*Add to global Vector*/
+-		pe->AddToGlobal(pf);
+-		delete pe;
+-	}
+-}
+-/*}}}*/
+ /*FUNCTION Penta::CreatePVector(void) {{{*/
+ ElementVector* Penta::CreatePVector(void){
+ 
+@@ -2666,7 +2571,7 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::ReduceMatrices) {{{*/
++/*FUNCTION Penta::ReduceMatrices{{{*/
+ void Penta::ReduceMatrices(ElementMatrix* Ke,ElementVector* pe){
+ 
+ 	int analysis_type;
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16799)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16800)
+@@ -78,9 +78,7 @@
+ 		int    FiniteElement(void);
+ 		void   SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters);
+ 		void   SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum);
+-		void   CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs);
+ 		void   CreateDVector(Vector<IssmDouble>* df);
+-		void   CreatePVector(Vector<IssmDouble>* pf);
+ 		void   CreateJacobianMatrix(Matrix<IssmDouble>* Jff);
+ 		void   Delta18oParameterization(void);
+ 		void   EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16799)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16800)
+@@ -76,10 +76,8 @@
+ 		void        DeleteMaterials(void){_error_("not implemented yet");};
+ 		void        SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters){_error_("not implemented yet");};
+ 		void        SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum){_error_("not implemented yet");};
+-		void        CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs){_error_("not implemented yet");};
+ 		ElementMatrix* CreateKMatrix(void){_error_("not implemented yet");};
+ 		void        CreateDVector(Vector<IssmDouble>* df){_error_("not implemented yet");};
+-		void        CreatePVector(Vector<IssmDouble>* pf){_error_("not implemented yet");};
+ 		ElementVector* CreatePVector(void){_error_("not implemented yet");};
+ 		ElementVector* CreatePVectorL2Projection(void);
+ 		void        CreateJacobianMatrix(Matrix<IssmDouble>* Jff){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16800-16801.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16800-16801.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16800-16801.diff	(revision 17802)
@@ -0,0 +1,64 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16800)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16801)
+@@ -866,8 +866,8 @@
+ 
+ 		/*Build load vector: */
+ 		for(i=0;i<numnodes;i++){
+-			pe->values[i*NDOF2+0]+=-driving_stress_baseline*slope[0]*Jdet*gauss->weight*basis[i];
+-			pe->values[i*NDOF2+1]+=-driving_stress_baseline*slope[1]*Jdet*gauss->weight*basis[i];
++			pe->values[i*2+0]+=-driving_stress_baseline*slope[0]*Jdet*gauss->weight*basis[i];
++			pe->values[i*2+1]+=-driving_stress_baseline*slope[1]*Jdet*gauss->weight*basis[i];
+ 		}
+ 	}
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16800)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16801)
+@@ -1983,7 +1983,7 @@
+ void Tria::JacobianDeterminant(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){
+ 
+ 	_assert_(gauss->Enum()==GaussTriaEnum);
+-	this->JacobianDeterminant(pJdet,xyz_list,(GaussTria*)gauss);
++	this->GetJacobianDeterminant(pJdet,xyz_list,(GaussTria*)gauss);
+ 
+ }
+ /*}}}*/
+Index: ../trunk-jpl/src/c/classes/gauss/GaussPenta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussPenta.h	(revision 16800)
++++ ../trunk-jpl/src/c/classes/gauss/GaussPenta.h	(revision 16801)
+@@ -21,7 +21,6 @@
+ 		IssmDouble* coords4;
+ 
+ 	public:
+-		IssmDouble weight;
+ 		IssmDouble coord1;
+ 		IssmDouble coord2;
+ 		IssmDouble coord3;
+Index: ../trunk-jpl/src/c/classes/gauss/GaussSeg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussSeg.h	(revision 16800)
++++ ../trunk-jpl/src/c/classes/gauss/GaussSeg.h	(revision 16801)
+@@ -17,7 +17,6 @@
+ 		IssmDouble* coords1;
+ 
+ 	public:
+-		IssmDouble weight;
+ 		IssmDouble coord1;
+ 
+ 	public:
+Index: ../trunk-jpl/src/c/classes/gauss/GaussTria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussTria.h	(revision 16800)
++++ ../trunk-jpl/src/c/classes/gauss/GaussTria.h	(revision 16801)
+@@ -19,7 +19,6 @@
+ 		IssmDouble* coords3;
+ 
+ 	public:
+-		IssmDouble weight;
+ 		IssmDouble coord1;
+ 		IssmDouble coord2;
+ 		IssmDouble coord3;
Index: issm/oecreview/Archive/16554-17801/ISSM-16801-16802.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16801-16802.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16801-16802.diff	(revision 17802)
@@ -0,0 +1,68 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16801)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16802)
+@@ -2509,6 +2509,19 @@
+ 	return new GaussPenta(order,order);
+ }
+ /*}}}*/
++/*FUNCTION Penta::NewElementVector{{{*/
++ElementVector* Penta::NewElementVector(int approximation_enum){
++	return new ElementVector(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
++}
++/*}}}*/
++/*FUNCTION Penta::NodalFunctions{{{*/
++void Penta::NodalFunctions(IssmDouble* basis, Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussPentaEnum);
++	this->GetNodalFunctions(basis,(GaussPenta*)gauss);
++
++}
++/*}}}*/
+ /*FUNCTION Penta::NumberofNodesPressure{{{*/
+ int Penta::NumberofNodesPressure(void){
+ 	return PentaRef::NumberofNodesPressure();
+@@ -3035,6 +3048,20 @@
+ 
+ 	return dt;
+ }/*}}}*/
++/*FUNCTION Penta::TransformLoadVectorCoord{{{*/
++void Penta::TransformLoadVectorCoord(ElementVector* pe,int transformenum){
++
++	::TransformLoadVectorCoord(pe,this->nodes,this->NumberofNodes(),transformenum);
++
++}
++/*}}}*/
++/*FUNCTION Penta::TransformLoadVectorCoord{{{*/
++void Penta::TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list){
++
++	::TransformLoadVectorCoord(pe,this->nodes,this->NumberofNodes(),transformenum_list);
++
++}
++/*}}}*/
+ /*FUNCTION Penta::TransformSolutionCoord(IssmDouble* values,int transformenum){{{*/
+ void Penta::TransformSolutionCoord(IssmDouble* values,int transformenum){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16801)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16802)
+@@ -241,14 +241,14 @@
+ 		bool           NoIceInElement(void); 
+ 		Gauss*         NewGauss(void);
+ 		Gauss*         NewGauss(int order);
+-		ElementVector* NewElementVector(int approximation_enum){_error_("not implemented yet");};
+-		void           NodalFunctions(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
++		ElementVector* NewElementVector(int approximation_enum);
++		void           NodalFunctions(IssmDouble* basis,Gauss* gauss);
+ 		IssmDouble     MinEdgeLength(IssmDouble xyz_list[6][3]);
+ 		void	         SetClone(int* minranks);
+ 		Tria*	         SpawnTria(int location);
+ 		void	         SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]);
+-		void           TransformLoadVectorCoord(ElementVector* pe,int transformenum){_error_("not implemented yet");};
+-		void           TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list){_error_("not implemented yet");};
++		void           TransformLoadVectorCoord(ElementVector* pe,int transformenum);
++		void           TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list);
+ 		void           TransformLoadVectorCoord(ElementVector* pe,int numnodes,int transformenum){_error_("not implemented yet");};      /*Tiling only*/
+ 		void           TransformLoadVectorCoord(ElementVector* pe,int numnodes,int* transformenum_list){_error_("not implemented yet");};/*Tiling only*/
+ 		void           TransformSolutionCoord(IssmDouble* values,int transformenum);
Index: issm/oecreview/Archive/16554-17801/ISSM-16802-16803.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16802-16803.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16802-16803.diff	(revision 17802)
@@ -0,0 +1,359 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 16802)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 16803)
+@@ -99,8 +99,133 @@
+ 	_error_("not implemented yet");
+ }/*}}}*/
+ ElementVector* StressbalanceVerticalAnalysis::CreatePVector(Element* element){/*{{{*/
+-_error_("not implemented yet");
++
++	/*compute all load vectors for this element*/
++	ElementVector* pe1=CreatePVectorVolume(element);
++	ElementVector* pe2=CreatePVectorBase(element);
++	ElementVector* pe =new ElementVector(pe1,pe2);
++
++	/*clean-up and return*/
++	delete pe1;
++	delete pe2;
++	return pe;
+ }/*}}}*/
++ElementVector* StressbalanceVerticalAnalysis::CreatePVectorVolume(Element* element){/*{{{*/
++
++	/*Intermediaries*/
++	int         approximation;
++	IssmDouble  Jdet;
++	IssmDouble  dudx,dvdy,dwdz;
++	IssmDouble  du[3],dv[3],dw[3];
++	IssmDouble* xyz_list = NULL;
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and basis functions*/
++	ElementVector* pe    = element->NewElementVector();
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	element->GetInputValue(&approximation,ApproximationEnum);
++	Input* vx_input=element->GetInput(VxEnum); _assert_(vx_input);
++	Input* vy_input=element->GetInput(VyEnum); _assert_(vy_input);
++	Input* vzFS_input=NULL;
++	if(approximation==HOFSApproximationEnum || approximation==SSAFSApproximationEnum){
++		vzFS_input=element->GetInput(VzFSEnum); _assert_(vzFS_input);
++	}
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctions(basis,gauss);
++
++		vx_input->GetInputDerivativeValue(&du[0],xyz_list,gauss);
++		vy_input->GetInputDerivativeValue(&dv[0],xyz_list,gauss);
++		if(approximation==HOFSApproximationEnum || approximation==SSAFSApproximationEnum){
++			vzFS_input->GetInputDerivativeValue(&dw[0],xyz_list,gauss);
++			dwdz=dw[2];
++		}
++		else dwdz=0;
++		dudx=du[0];
++		dvdy=dv[1];
++
++		for(int i=0;i<numnodes;i++) pe->values[i] += (dudx+dvdy+dwdz)*Jdet*gauss->weight*basis[i];
++	}
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(xyz_list);
++	return pe;
++}/*}}}*/
++ElementVector* StressbalanceVerticalAnalysis::CreatePVectorBase(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	int         i,j,approximation;
++	IssmDouble *xyz_list      = NULL;
++	IssmDouble *xyz_list_base = NULL;
++	IssmDouble  Jdet;
++	IssmDouble  vx,vy,vz,dbdx,dbdy,basalmeltingvalue;
++	IssmDouble  slope[3];
++
++	if(!element->IsOnBed()) return NULL;
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector*/
++	ElementVector* pe    = element->NewElementVector();
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	element->GetVerticesCoordinatesBase(&xyz_list_base);
++	element->GetInputValue(&approximation,ApproximationEnum);
++	Input* bed_input=element->GetInput(BedEnum);                                _assert_(bed_input);
++	Input* basal_melting_input=element->GetInput(BasalforcingsMeltingRateEnum); _assert_(basal_melting_input);
++	Input* vx_input=element->GetInput(VxEnum);                                  _assert_(vx_input);
++	Input* vy_input=element->GetInput(VyEnum);                                  _assert_(vy_input);
++	Input* vzFS_input=NULL;
++	if(approximation==HOFSApproximationEnum || approximation==SSAFSApproximationEnum){
++		vzFS_input=element->GetInput(VzFSEnum);       _assert_(vzFS_input);
++	}
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGaussBase(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		basal_melting_input->GetInputValue(&basalmeltingvalue,gauss);
++		bed_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
++		vx_input->GetInputValue(&vx,gauss);
++		vy_input->GetInputValue(&vy,gauss);
++		if(approximation==HOFSApproximationEnum || approximation==SSAFSApproximationEnum){
++			vzFS_input->GetInputValue(&vz,gauss);
++		}
++		else vz=0.;
++
++		dbdx=slope[0];
++		dbdy=slope[1];
++
++		element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
++		element->NodalFunctions(basis,gauss);
++
++		for(i=0;i<numnodes;i++) pe->values[i]+=-Jdet*gauss->weight*(vx*dbdx+vy*dbdy-vz-basalmeltingvalue)*basis[i];
++	}
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(xyz_list_base);
++	return pe;
++
++}/*}}}*/
+ void StressbalanceVerticalAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,VzEnum);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16802)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16803)
+@@ -817,12 +817,30 @@
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorSSA(Element* element){/*{{{*/
+ 
++	/*Intermediaries*/
++	int      meshtype;
++	Element* basalelement;
++
++	/*Get basal element*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
+ 	/*compute all load vectors for this element*/
+-	ElementVector* pe1=CreatePVectorSSADrivingStress(element);
+-	ElementVector* pe2=CreatePVectorSSAFront(element);
++	ElementVector* pe1=CreatePVectorSSADrivingStress(basalelement);
++	ElementVector* pe2=CreatePVectorSSAFront(basalelement);
+ 	ElementVector* pe =new ElementVector(pe1,pe2);
+ 
+ 	/*clean-up and return*/
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	delete pe1;
+ 	delete pe2;
+ 	return pe;
+@@ -833,8 +851,8 @@
+ 	int         i;
+ 	IssmDouble  driving_stress_baseline,thickness;
+ 	IssmDouble  Jdet;
+-	IssmDouble* xyz_list=NULL;
+ 	IssmDouble  slope[2];
++	IssmDouble* xyz_list     = NULL;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+@@ -880,6 +898,7 @@
+ 	return pe;
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorSSAFront(Element* element){/*{{{*/
++
+ 	return NULL;
+ }/*}}}*/
+ void StressbalanceAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h	(revision 16802)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h	(revision 16803)
+@@ -22,6 +22,8 @@
+ 		/*Finite element Analysis*/
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
++		ElementVector* CreatePVectorVolume(Element* element);
++		ElementVector* CreatePVectorBase(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16802)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16803)
+@@ -66,6 +66,7 @@
+ 		virtual void	GetDofListVelocity(int** pdoflist,int setenum)=0;
+ 		virtual void	GetDofListPressure(int** pdoflist,int setenum)=0;
+ 		virtual void   JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss)=0;
++		virtual void   JacobianDeterminantBase(IssmDouble* Jdet,IssmDouble* xyz_list_base,Gauss* gauss)=0;
+ 		virtual void   GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int solutionenum)=0;
+ 		virtual int    GetNodeIndex(Node* node)=0;
+ 		virtual int    GetNumberOfNodes(void)=0;
+@@ -89,6 +90,7 @@
+ 		virtual void   GetInputValue(int* pvalue,int enum_type)=0;
+ 		virtual void   GetInputValue(IssmDouble* pvalue,int enum_type)=0;
+ 		virtual void   GetVerticesCoordinates(IssmDouble** xyz_list)=0;
++		virtual void   GetVerticesCoordinatesBase(IssmDouble** xyz_list)=0;
+ 		virtual void   GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype)=0;
+ 
+ 		virtual IssmDouble SurfaceArea(void)=0;
+@@ -109,7 +111,8 @@
+ 		virtual int    NumberofNodesPressure(void)=0;
+ 		virtual Gauss* NewGauss(void)=0;
+ 		virtual Gauss* NewGauss(int order)=0;
+-		virtual ElementVector*  NewElementVector(int approximation_enum)=0;
++		virtual Gauss* NewGaussBase(int order)=0;
++		virtual ElementVector*  NewElementVector(int approximation_enum=NoneApproximationEnum)=0;
+ 		virtual void   InputScale(int enum_type,IssmDouble scale_factor)=0;
+ 		virtual void   GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum)=0;
+ 		virtual IssmDouble TimeAdapt()=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16802)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16803)
+@@ -109,6 +109,7 @@
+ 		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
+ 		void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum);
+ 		void        GetVerticesCoordinates(IssmDouble** pxyz_list);
++		void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list){_error_("not implemented yet");};
+ 		void        InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);
+ 		void        InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum=MeshElementsEnum);
+ 		void        InputDuplicate(int original_enum,int new_enum);
+@@ -266,8 +267,10 @@
+ 		void	         InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solution,int enum_type){_error_("not implemented yet");};
+ 		bool	         IsInput(int name);
+ 		void           JacobianDeterminant(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss);
++		void           JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
+ 		Gauss*         NewGauss(void);
+ 		Gauss*         NewGauss(int order);
++		Gauss*         NewGaussBase(int order){_error_("not implemented yet");};
+ 		ElementVector* NewElementVector(int approximation_enum);
+ 		void           NodalFunctions(IssmDouble* basis,Gauss* gauss);
+ 		void	         SetClone(int* minranks);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16802)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16803)
+@@ -1445,6 +1445,16 @@
+ 	*pxyz_list = xyz_list;
+ 
+ }/*}}}*/
++/*FUNCTION Penta::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){{{*/
++void Penta::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){
++
++	IssmDouble* xyz_list = xNew<IssmDouble>(NUMVERTICES2D*3);
++	::GetVerticesCoordinates(xyz_list,this->vertices,NUMVERTICES2D);
++
++	/*Assign output pointer*/
++	*pxyz_list = xyz_list;
++
++}/*}}}*/
+ /*FUNCTION Penta::GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype) {{{*/
+ void Penta::GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype){
+ 
+@@ -2431,6 +2441,14 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Penta::JacobianDeterminantBase{{{*/
++void Penta::JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussPentaEnum);
++	this->GetTriaJacobianDeterminant(pJdet,xyz_list_base,(GaussPenta*)gauss);
++
++}
++/*}}}*/
+ /*FUNCTION Penta::NoIceInElement {{{*/
+ bool   Penta::NoIceInElement(){
+ 
+@@ -2509,6 +2527,11 @@
+ 	return new GaussPenta(order,order);
+ }
+ /*}}}*/
++/*FUNCTION Penta::NewGaussBase(int order){{{*/
++Gauss* Penta::NewGaussBase(int order){
++	return new GaussPenta(0,1,2,order);
++}
++/*}}}*/
+ /*FUNCTION Penta::NewElementVector{{{*/
+ ElementVector* Penta::NewElementVector(int approximation_enum){
+ 	return new ElementVector(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16802)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16803)
+@@ -98,6 +98,7 @@
+ 		IssmDouble GetZcoord(GaussPenta* gauss);
+ 		void   GetVectorFromInputs(Vector<IssmDouble>* vector,int name_enum);
+ 		void   GetVerticesCoordinates(IssmDouble** pxyz_list);
++		void   GetVerticesCoordinatesBase(IssmDouble** pxyz_list);
+ 
+ 		int    Sid();
+ 		void   InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);
+@@ -238,9 +239,11 @@
+ 		bool           IsFloating(void); 
+ 		bool           IsNodeOnShelfFromFlags(IssmDouble* flags);
+ 		void           JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss);
++		void           JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss);
+ 		bool           NoIceInElement(void); 
+ 		Gauss*         NewGauss(void);
+ 		Gauss*         NewGauss(int order);
++		Gauss*         NewGaussBase(int order);
+ 		ElementVector* NewElementVector(int approximation_enum);
+ 		void           NodalFunctions(IssmDouble* basis,Gauss* gauss);
+ 		IssmDouble     MinEdgeLength(IssmDouble xyz_list[6][3]);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16802)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16803)
+@@ -101,12 +101,14 @@
+ 		int         GetNumberOfNodesPressure(void){_error_("not implemented yet");};
+ 		int         GetNumberOfVertices(void){_error_("not implemented yet");};
+ 		void        GetVerticesCoordinates(IssmDouble** pxyz_list){_error_("not implemented yet");};
++		void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list){_error_("not implemented yet");};
+ 		int         Sid(){_error_("not implemented yet");};
+ 		void        InputChangeName(int input_enum, int enum_type_old){_error_("not implemented yet");};
+ 		bool        IsOnBed(){_error_("not implemented yet");};
+ 		bool        IsFloating(){_error_("not implemented yet");};
+ 		bool        IsNodeOnShelfFromFlags(IssmDouble* flags){_error_("not implemented yet");};
+ 		void        JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
++		void        JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctions(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+ 		bool        NoIceInElement(){_error_("not implemented yet");};
+ 		int         NumberofNodesVelocity(void){_error_("not implemented yet");};
+@@ -124,6 +126,7 @@
+ 		void        GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");};
+ 		Gauss*      NewGauss(void){_error_("not implemented yet");};
+ 		Gauss*      NewGauss(int order){_error_("not implemented yet");};
++		Gauss*      NewGaussBase(int order){_error_("not implemented yet");};
+ 		ElementVector* NewElementVector(int approximation_enum){_error_("not implemented yet");};
+ 		#ifdef _HAVE_THERMAL_
+ 		void UpdateBasalConstraintsEnthalpy(void){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16803-16804.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16803-16804.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16803-16804.diff	(revision 17802)
@@ -0,0 +1,200 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16803)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16804)
+@@ -22,6 +22,9 @@
+ 		/*Finite element Analysis*/
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
++		ElementVector* CreatePVectorHO(Element* element);
++		ElementVector* CreatePVectorHODrivingStress(Element* element);
++		ElementVector* CreatePVectorHOFront(Element* element);
+ 		ElementVector* CreatePVectorSSA(Element* element);
+ 		ElementVector* CreatePVectorSSADrivingStress(Element* element);
+ 		ElementVector* CreatePVectorSSAFront(Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 16803)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 16804)
+@@ -114,8 +114,7 @@
+ 
+ 	/*Intermediaries*/
+ 	int         approximation;
+-	IssmDouble  Jdet;
+-	IssmDouble  dudx,dvdy,dwdz;
++	IssmDouble  Jdet,dudx,dvdy,dwdz;
+ 	IssmDouble  du[3],dv[3],dw[3];
+ 	IssmDouble* xyz_list = NULL;
+ 
+@@ -166,12 +165,11 @@
+ ElementVector* StressbalanceVerticalAnalysis::CreatePVectorBase(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries */
+-	int         i,j,approximation;
++	int         approximation;
+ 	IssmDouble *xyz_list      = NULL;
+ 	IssmDouble *xyz_list_base = NULL;
+-	IssmDouble  Jdet;
+-	IssmDouble  vx,vy,vz,dbdx,dbdy,basalmeltingvalue;
+-	IssmDouble  slope[3];
++	IssmDouble  Jdet,slope[3];
++	IssmDouble  vx,vy,vz=0.,dbdx,dbdy,basalmeltingvalue;
+ 
+ 	if(!element->IsOnBed()) return NULL;
+ 
+@@ -207,15 +205,13 @@
+ 		if(approximation==HOFSApproximationEnum || approximation==SSAFSApproximationEnum){
+ 			vzFS_input->GetInputValue(&vz,gauss);
+ 		}
+-		else vz=0.;
+-
+ 		dbdx=slope[0];
+ 		dbdy=slope[1];
+ 
+ 		element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
+ 		element->NodalFunctions(basis,gauss);
+ 
+-		for(i=0;i<numnodes;i++) pe->values[i]+=-Jdet*gauss->weight*(vx*dbdx+vy*dbdy-vz-basalmeltingvalue)*basis[i];
++		for(int i=0;i<numnodes;i++) pe->values[i]+=-Jdet*gauss->weight*(vx*dbdx+vy*dbdy-vz-basalmeltingvalue)*basis[i];
+ 	}
+ 
+ 	/*Clean up and return*/
+@@ -224,7 +220,6 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(xyz_list_base);
+ 	return pe;
+-
+ }/*}}}*/
+ void StressbalanceVerticalAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,VzEnum);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16803)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16804)
+@@ -811,10 +811,70 @@
+ 	switch(approximation){
+ 		case SSAApproximationEnum: 
+ 			return CreatePVectorSSA(element);
++		case HOApproximationEnum: 
++			return CreatePVectorHO(element);
+ 		default:
+ 			_error_("Approximation "<<EnumToStringx(approximation)<<" not supported");
+ 	}
+ }/*}}}*/
++ElementVector* StressbalanceAnalysis::CreatePVectorHO(Element* element){/*{{{*/
++
++	/*compute all load vectors for this element*/
++	ElementVector* pe1=CreatePVectorHODrivingStress(element);
++	ElementVector* pe2=CreatePVectorHOFront(element);
++	ElementVector* pe =new ElementVector(pe1,pe2);
++
++	/*clean-up and return*/
++	delete pe1;
++	delete pe2;
++	return pe;
++}/*}}}*/
++ElementVector* StressbalanceAnalysis::CreatePVectorHODrivingStress(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	IssmDouble  Jdet,slope[3];
++	IssmDouble* xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and vectors*/
++	ElementVector* pe=element->NewElementVector(HOApproximationEnum);
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	Input*     surface_input = element->GetInput(SurfaceEnum);   _assert_(surface_input);
++	IssmDouble rhog = element->GetMaterialParameter(MaterialsRhoIceEnum)*element->GetMaterialParameter(ConstantsGEnum);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(3);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctions(basis, gauss);
++		surface_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
++
++		for(int i=0;i<numnodes;i++){
++			pe->values[i*2+0]+=-rhog*slope[0]*Jdet*gauss->weight*basis[i];
++			pe->values[i*2+1]+=-rhog*slope[1]*Jdet*gauss->weight*basis[i];
++		}
++	}
++
++	/*Transform coordinate system*/
++	element->TransformLoadVectorCoord(pe,XYEnum);
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(xyz_list);
++	delete gauss;
++	return pe;
++}/*}}}*/
++ElementVector* StressbalanceAnalysis::CreatePVectorHOFront(Element* element){/*{{{*/
++
++	return NULL;
++}/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorSSA(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+@@ -848,15 +908,11 @@
+ ElementVector* StressbalanceAnalysis::CreatePVectorSSADrivingStress(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries */
+-	int         i;
+-	IssmDouble  driving_stress_baseline,thickness;
+-	IssmDouble  Jdet;
+-	IssmDouble  slope[2];
+-	IssmDouble* xyz_list     = NULL;
++	IssmDouble  thickness,Jdet,slope[2];
++	IssmDouble* xyz_list = NULL;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+-	IssmDouble* icefrontlevel= xNew<IssmDouble>(numnodes);
+ 
+ 	/*Initialize Element vector and vectors*/
+ 	ElementVector* pe=element->NewElementVector(SSAApproximationEnum);
+@@ -864,10 +920,9 @@
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+-	Input* thickness_input=element->GetInput(ThicknessEnum);          _assert_(thickness_input); 
+-	Input* surface_input  =element->GetInput(SurfaceEnum);            _assert_(surface_input);
+-	Input* drag_input     =element->GetInput(FrictionCoefficientEnum);_assert_(drag_input);
+-	element->GetInputListOnVertices(icefrontlevel,BedEnum);
++	Input*     thickness_input=element->GetInput(ThicknessEnum); _assert_(thickness_input); 
++	Input*     surface_input  =element->GetInput(SurfaceEnum);   _assert_(surface_input);
++	IssmDouble rhog = element->GetMaterialParameter(MaterialsRhoIceEnum)*element->GetMaterialParameter(ConstantsGEnum);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	Gauss* gauss=element->NewGauss(2);
+@@ -880,12 +935,10 @@
+ 
+ 		thickness_input->GetInputValue(&thickness,gauss);
+ 		surface_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
+-		driving_stress_baseline=element->GetMaterialParameter(MaterialsRhoIceEnum)*element->GetMaterialParameter(ConstantsGEnum)*thickness;
+ 
+-		/*Build load vector: */
+-		for(i=0;i<numnodes;i++){
+-			pe->values[i*2+0]+=-driving_stress_baseline*slope[0]*Jdet*gauss->weight*basis[i];
+-			pe->values[i*2+1]+=-driving_stress_baseline*slope[1]*Jdet*gauss->weight*basis[i];
++		for(int i=0;i<numnodes;i++){
++			pe->values[i*2+0]+=-rhog*thickness*slope[0]*Jdet*gauss->weight*basis[i];
++			pe->values[i*2+1]+=-rhog*thickness*slope[1]*Jdet*gauss->weight*basis[i];
+ 		}
+ 	}
+ 
+@@ -893,6 +946,7 @@
+ 	element->TransformLoadVectorCoord(pe,XYEnum);
+ 
+ 	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+ 	delete gauss;
+ 	return pe;
Index: issm/oecreview/Archive/16554-17801/ISSM-16804-16805.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16804-16805.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16804-16805.diff	(revision 17802)
@@ -0,0 +1,366 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16804)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16805)
+@@ -22,6 +22,10 @@
+ 		/*Finite element Analysis*/
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
++		ElementVector* CreatePVectorFS(Element* element);
++		ElementVector* CreatePVectorFSViscous(Element* element);
++		ElementVector* CreatePVectorFSShelf(Element* element);
++		ElementVector* CreatePVectorFSFront(Element* element);
+ 		ElementVector* CreatePVectorHO(Element* element);
+ 		ElementVector* CreatePVectorHODrivingStress(Element* element);
+ 		ElementVector* CreatePVectorHOFront(Element* element);
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 16804)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 16805)
+@@ -58,7 +58,73 @@
+ 	_error_("not implemented yet");
+ }/*}}}*/
+ ElementVector* L2ProjectionBaseAnalysis::CreatePVector(Element* element){/*{{{*/
+-_error_("not implemented yet");
++
++	/*Intermediaries*/
++	int      meshtype;
++	Element* basalelement;
++
++	/*Get basal element*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Intermediaries */
++	int         input_enum;
++	IssmDouble  Jdet,value,slopes[2];
++	Input      *input     = NULL;
++	Input      *input2    = NULL;
++	IssmDouble *xyz_list  = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = basalelement->GetNumberOfNodes();
++
++	/*Initialize Element vector*/
++	ElementVector* pe    = basalelement->NewElementVector();
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	basalelement->GetVerticesCoordinates(&xyz_list);
++	basalelement->FindParam(&input_enum,InputToL2ProjectEnum);
++	switch(input_enum){
++		case SurfaceSlopeXEnum: input2 = basalelement->GetInput(SurfaceEnum); _assert_(input2); break;
++		case SurfaceSlopeYEnum: input2 = basalelement->GetInput(SurfaceEnum); _assert_(input2); break;
++		case BedSlopeXEnum:     input2 = basalelement->GetInput(BedEnum);     _assert_(input2); break;
++		case BedSlopeYEnum:     input2 = basalelement->GetInput(BedEnum);     _assert_(input2); break;
++		default: input = element->GetInput(input_enum);
++	}
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=basalelement->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		basalelement->NodalFunctions(basis,gauss);
++
++		if(input2) input2->GetInputDerivativeValue(&slopes[0],xyz_list,gauss);
++		switch(input_enum){
++			case SurfaceSlopeXEnum: case BedSlopeXEnum: value = slopes[0]; break;
++			case SurfaceSlopeYEnum: case BedSlopeYEnum: value = slopes[1]; break;
++			default: input->GetInputValue(&value,gauss);
++		}
++
++		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*value*basis[i];
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	return pe;
+ }/*}}}*/
+ void L2ProjectionBaseAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16804)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16805)
+@@ -813,10 +813,107 @@
+ 			return CreatePVectorSSA(element);
+ 		case HOApproximationEnum: 
+ 			return CreatePVectorHO(element);
++		case FSApproximationEnum: 
++			return CreatePVectorFS(element);
++		case NoneApproximationEnum:
++			return NULL;
+ 		default:
+ 			_error_("Approximation "<<EnumToStringx(approximation)<<" not supported");
+ 	}
+ }/*}}}*/
++ElementVector* StressbalanceAnalysis::CreatePVectorFS(Element* element){/*{{{*/
++
++	/*compute all load vectors for this element*/
++	ElementVector* pe1=CreatePVectorFSViscous(element);
++	ElementVector* pe2=CreatePVectorFSShelf(element);
++	ElementVector* pe3=CreatePVectorFSFront(element);
++	ElementVector* pe =new ElementVector(pe1,pe2,pe3);
++
++	/*clean-up and return*/
++	delete pe1;
++	delete pe2;
++	delete pe3;
++	return pe;
++}/*}}}*/
++ElementVector* StressbalanceAnalysis::CreatePVectorFSViscous(Element* element){/*{{{*/
++
++	int         i,meshtype,dim;
++	IssmDouble  Jdet,forcex,forcey,forcez;
++	IssmDouble *xyz_list = NULL;
++
++	/*Get problem dimension*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; break;
++		case Mesh3DEnum:         dim = 3; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int vnumnodes = element->GetNumberOfNodesVelocity();
++	int pnumnodes = element->GetNumberOfNodesPressure();
++
++	/*Prepare coordinate system list*/
++	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
++	if(dim==2) for(i=0;i<vnumnodes;i++) cs_list[i] = XYEnum;
++	else       for(i=0;i<vnumnodes;i++) cs_list[i] = XYZEnum;
++	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
++
++	/*Initialize vectors*/
++	ElementVector* pe     = element->NewElementVector(FSvelocityEnum);
++	IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	Input*      loadingforcex_input=element->GetInput(LoadingforceXEnum);  _assert_(loadingforcex_input);
++	Input*      loadingforcey_input=element->GetInput(LoadingforceYEnum);  _assert_(loadingforcey_input);
++	Input*      loadingforcez_input=element->GetInput(LoadingforceZEnum);  _assert_(loadingforcez_input);
++	IssmDouble  rho_ice =element->GetMaterialParameter(MaterialsRhoIceEnum);
++	IssmDouble  gravity =element->GetMaterialParameter(ConstantsGEnum);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(5);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctionsVelocity(vbasis,gauss);
++
++		loadingforcex_input->GetInputValue(&forcex,gauss);
++		loadingforcey_input->GetInputValue(&forcey,gauss);
++		if(dim==3) loadingforcez_input->GetInputValue(&forcez,gauss);
++
++		for(i=0;i<vnumnodes;i++){
++			pe->values[i*dim+0] += +rho_ice*forcex *Jdet*gauss->weight*vbasis[i];
++			pe->values[i*dim+1] += +rho_ice*forcey *Jdet*gauss->weight*vbasis[i];
++			if(dim==3){
++				pe->values[i*dim+2] += +rho_ice*forcez*Jdet*gauss->weight*vbasis[i];
++				pe->values[i*dim+2] += -rho_ice*gravity*Jdet*gauss->weight*vbasis[i];
++			}
++			else{
++				pe->values[i*dim+1] += -rho_ice*gravity*Jdet*gauss->weight*vbasis[i];
++			}
++		}
++	}
++
++	/*Transform coordinate system*/
++	element->TransformLoadVectorCoord(pe,cs_list);
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<int>(cs_list);
++	xDelete<IssmDouble>(vbasis);
++	xDelete<IssmDouble>(xyz_list);
++	return pe;
++}/*}}}*/
++ElementVector* StressbalanceAnalysis::CreatePVectorFSShelf(Element* element){/*{{{*/
++
++	return NULL;
++}/*}}}*/
++ElementVector* StressbalanceAnalysis::CreatePVectorFSFront(Element* element){/*{{{*/
++
++	return NULL;
++}/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorHO(Element* element){/*{{{*/
+ 
+ 	/*compute all load vectors for this element*/
+@@ -915,7 +1012,7 @@
+ 	int numnodes = element->GetNumberOfNodes();
+ 
+ 	/*Initialize Element vector and vectors*/
+-	ElementVector* pe=element->NewElementVector(SSAApproximationEnum);
++	ElementVector* pe    = element->NewElementVector(SSAApproximationEnum);
+ 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+@@ -1145,12 +1242,8 @@
+ 
+ 	/*Prepare coordinate system list*/
+ 	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+-	if(dim==2){
+-		for(i=0;i<vnumnodes;i++) cs_list[i] = XYEnum;
+-	}
+-	else{
+-		for(i=0;i<vnumnodes;i++) cs_list[i] = XYZEnum;
+-	}
++	if(dim==2) for(i=0;i<vnumnodes;i++) cs_list[i] = XYEnum;
++	else       for(i=0;i<vnumnodes;i++) cs_list[i] = XYZEnum;
+ 	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
+ 
+ 	/*Get dof list: */
+Index: ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 16804)
++++ ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 16805)
+@@ -40,7 +40,12 @@
+ 		/*Get complete stiffness matrix without penalties*/
+ 		for (i=0;i<femmodel->elements->Size();i++){
+ 			element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+-			element->CreateKMatrix(Kff_temp,NULL);
++			ElementMatrix* Ke = element->CreateKMatrix();
++			ElementVector* pe = element->CreatePVector();
++			element->ReduceMatrices(Ke,pe);
++			if(Ke) Ke->AddToGlobal(Kff_temp,NULL);
++			delete Ke;
++			delete pe;
+ 		}
+ 
+ 		for (i=0;i<femmodel->loads->Size();i++){
+@@ -67,9 +72,9 @@
+ 	for (i=0;i<femmodel->elements->Size();i++){
+ 		element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+ 		element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+-		//ElementVector* pe = analysis->CreatePVector(element);
++		ElementVector* pe = analysis->CreatePVector(element);
+ 		//ElementMatrix* Ke = analysis->CreateKMatrix(element);
+-		ElementVector* pe = element->CreatePVector();
++		//ElementVector* pe = element->CreatePVector();
+ 		ElementMatrix* Ke = element->CreateKMatrix();
+ 		element->ReduceMatrices(Ke,pe);
+ 		if(Ke) Ke->AddToGlobal(Kff,Kfs);
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16804)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16805)
+@@ -53,6 +53,8 @@
+ 		virtual int    FiniteElement(void)=0;
+ 		virtual IssmDouble GetMaterialParameter(int enum_in)=0;
+ 		virtual void   NodalFunctions(IssmDouble* basis,Gauss* gauss)=0;
++		virtual void   NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss)=0;
++		virtual void   NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss)=0;
+ 		virtual void   TransformLoadVectorCoord(ElementVector* pe,int transformenum)=0;
+ 		virtual void   TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list)=0;
+ 		virtual void   TransformLoadVectorCoord(ElementVector* pe,int numnodes,int transformenum)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16804)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16805)
+@@ -2209,6 +2209,22 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Tria::NodalFunctionsVelocity{{{*/
++void Tria::NodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussTriaEnum);
++	this->GetNodalFunctionsVelocity(basis,(GaussTria*)gauss);
++
++}
++/*}}}*/
++/*FUNCTION Tria::NodalFunctionsPressure{{{*/
++void Tria::NodalFunctionsPressure(IssmDouble* basis, Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussTriaEnum);
++	this->GetNodalFunctionsPressure(basis,(GaussTria*)gauss);
++
++}
++/*}}}*/
+ /*FUNCTION Tria::NodalValue {{{*/
+ int    Tria::NodalValue(IssmDouble* pvalue, int index, int natureofdataenum){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16804)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16805)
+@@ -273,6 +273,8 @@
+ 		Gauss*         NewGaussBase(int order){_error_("not implemented yet");};
+ 		ElementVector* NewElementVector(int approximation_enum);
+ 		void           NodalFunctions(IssmDouble* basis,Gauss* gauss);
++		void           NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss);
++		void           NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss);
+ 		void	         SetClone(int* minranks);
+ 		Seg*	         SpawnSeg(int index1,int index2);
+ 		void	         SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16804)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16805)
+@@ -2545,6 +2545,22 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Penta::NodalFunctionsVelocity{{{*/
++void Penta::NodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussPentaEnum);
++	this->GetNodalFunctionsVelocity(basis,(GaussPenta*)gauss);
++
++}
++/*}}}*/
++/*FUNCTION Penta::NodalFunctionsPressure{{{*/
++void Penta::NodalFunctionsPressure(IssmDouble* basis, Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussPentaEnum);
++	this->GetNodalFunctionsPressure(basis,(GaussPenta*)gauss);
++
++}
++/*}}}*/
+ /*FUNCTION Penta::NumberofNodesPressure{{{*/
+ int Penta::NumberofNodesPressure(void){
+ 	return PentaRef::NumberofNodesPressure();
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16804)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16805)
+@@ -246,6 +246,8 @@
+ 		Gauss*         NewGaussBase(int order);
+ 		ElementVector* NewElementVector(int approximation_enum);
+ 		void           NodalFunctions(IssmDouble* basis,Gauss* gauss);
++		void           NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss);
++		void           NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss);
+ 		IssmDouble     MinEdgeLength(IssmDouble xyz_list[6][3]);
+ 		void	         SetClone(int* minranks);
+ 		Tria*	         SpawnTria(int location);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16804)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16805)
+@@ -110,6 +110,8 @@
+ 		void        JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void        JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctions(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
++		void        NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
++		void        NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+ 		bool        NoIceInElement(){_error_("not implemented yet");};
+ 		int         NumberofNodesVelocity(void){_error_("not implemented yet");};
+ 		int         NumberofNodesPressure(void){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16805-16806.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16805-16806.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16805-16806.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/m/solve/parseresultsfromdisk.m
+===================================================================
+--- ../trunk-jpl/src/m/solve/parseresultsfromdisk.m	(revision 16805)
++++ ../trunk-jpl/src/m/solve/parseresultsfromdisk.m	(revision 16806)
+@@ -26,6 +26,7 @@
+ 
+ %Read fields until the end of the file.
+ result  = ReadData(fid);
++if isempty(result), error(['no results found in binary file ' filename]); end
+ counter = 1;
+ step    = result.step;
+ while ~isempty(result), 
Index: issm/oecreview/Archive/16554-17801/ISSM-16806-16807.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16806-16807.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16806-16807.diff	(revision 17802)
@@ -0,0 +1,327 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16806)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16807)
+@@ -430,6 +430,16 @@
+ 			iomodel->FetchData(&surface,NULL,NULL,SurfaceEnum);
+ 			iomodel->FetchData(&z,NULL,NULL,MeshZEnum);
+ 			switch(finiteelement){
++				case P1Enum:
++					for(i=0;i<iomodel->numberofvertices;i++){
++						if(iomodel->my_vertices[i]){
++							if(reCast<int,IssmDouble>(vertices_type[i])==NoneApproximationEnum){
++								constraints->AddObject(new SpcStatic(count+1,iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofelements+i+1,1,g*rho_ice*(surface[i]-z[i])/FSreconditioning,StressbalanceAnalysisEnum));
++								count++;
++							}
++						}
++					}
++					break;
+ 				case P1bubbleEnum:
+ 					for(i=0;i<iomodel->numberofvertices;i++){
+ 						if(iomodel->my_vertices[i]){
+@@ -908,7 +918,73 @@
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorFSShelf(Element* element){/*{{{*/
+ 
+-	return NULL;
++	int         i,meshtype,dim;
++	IssmDouble  Jdet,water_pressure,bed;
++	IssmDouble	normal[3];
++	IssmDouble *xyz_list_base = NULL;
++
++	/*Get basal element*/
++	if(!element->IsOnBed() || !element->IsFloating()) return NULL;
++
++	/*Get problem dimension*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; break;
++		case Mesh3DEnum:         dim = 3; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int vnumnodes = element->GetNumberOfNodesVelocity();
++	int pnumnodes = element->GetNumberOfNodesPressure();
++
++	/*Prepare coordinate system list*/
++	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
++	if(dim==2) for(i=0;i<vnumnodes;i++) cs_list[i] = XYEnum;
++	else       for(i=0;i<vnumnodes;i++) cs_list[i] = XYZEnum;
++	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
++
++	/*Initialize vectors*/
++	ElementVector* pe     = element->NewElementVector(FSvelocityEnum);
++	IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinatesBase(&xyz_list_base);
++	Input*      bed_input=element->GetInput(BedEnum); _assert_(bed_input);
++	IssmDouble  rho_water=element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble  gravity  =element->GetMaterialParameter(ConstantsGEnum);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGaussBase(5);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
++		element->NodalFunctionsVelocity(vbasis,gauss);
++
++		element->NormalBase(&normal[0],xyz_list_base);
++		_assert_(normal[dim-1]<0.);
++		bed_input->GetInputValue(&bed, gauss);
++		water_pressure=gravity*rho_water*bed;
++
++		for(i=0;i<vnumnodes;i++){
++			pe->values[i*dim+0] += water_pressure*gauss->weight*Jdet*vbasis[i]*normal[0];
++			pe->values[i*dim+1] += water_pressure*gauss->weight*Jdet*vbasis[i]*normal[1];
++			if(dim==3){
++				pe->values[i*dim+2]+=water_pressure*gauss->weight*Jdet*vbasis[i]*normal[2];
++			}
++		}
++	}
++
++	/*Transform coordinate system*/
++	element->TransformLoadVectorCoord(pe,cs_list);
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<int>(cs_list);
++	xDelete<IssmDouble>(vbasis);
++	xDelete<IssmDouble>(xyz_list_base);
++	return pe;
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorFSFront(Element* element){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16806)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16807)
+@@ -55,6 +55,7 @@
+ 		virtual void   NodalFunctions(IssmDouble* basis,Gauss* gauss)=0;
+ 		virtual void   NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss)=0;
+ 		virtual void   NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss)=0;
++		virtual void   NormalBase(IssmDouble* normal,IssmDouble* xyz_list)=0;
+ 		virtual void   TransformLoadVectorCoord(ElementVector* pe,int transformenum)=0;
+ 		virtual void   TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list)=0;
+ 		virtual void   TransformLoadVectorCoord(ElementVector* pe,int numnodes,int transformenum)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16806)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16807)
+@@ -1161,15 +1161,15 @@
+ 	*pxyz_list = xyz_list;
+ 
+ }/*}}}*/
+-/*FUNCTION Tria::GetSegmentNormal {{{*/
+-void Tria:: GetSegmentNormal(IssmDouble* normal,IssmDouble xyz_list[2][3]){
++/*FUNCTION Tria::NormalBase {{{*/
++void Tria::NormalBase(IssmDouble* normal,IssmDouble* xyz_list){
+ 
+ 	/*Build unit outward pointing vector*/
+ 	IssmDouble vector[2];
+ 	IssmDouble norm;
+ 
+-	vector[0]=xyz_list[1][0] - xyz_list[0][0];
+-	vector[1]=xyz_list[1][1] - xyz_list[0][1];
++	vector[0]=xyz_list[1*3+0] - xyz_list[0*3+0];
++	vector[1]=xyz_list[1*3+1] - xyz_list[0*3+1];
+ 
+ 	norm=sqrt(vector[0]*vector[0] + vector[1]*vector[1]);
+ 
+@@ -1975,7 +1975,17 @@
+ bool Tria::IsOnBed(){
+ 
+ 	bool onbed;
+-	inputs->GetInputValue(&onbed,MeshElementonbedEnum);
++	int meshtype;
++	this->parameters->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum:
++			return HasEdgeOnBed();
++			break;
++		case Mesh2DhorizontalEnum:
++			inputs->GetInputValue(&onbed,MeshElementonbedEnum);
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
+ 	return onbed;
+ }
+ /*}}}*/
+@@ -3875,7 +3885,7 @@
+ 	gravity   = matpar->GetG();
+ 	GetZeroLevelsetCoordinates(&xyz_list_front[0][0],xyz_list,MaskIceLevelsetEnum);
+ 	GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,xyz_list,2);
+-	GetSegmentNormal(&normal[0],xyz_list_front);
++	NormalBase(&normal[0],&xyz_list_front[0][0]);
+ 
+ 	/*Start looping on Gaussian points*/
+ 	IssmDouble ymax=max(xyz_list_front[0][1],xyz_list_front[1][1]);
+@@ -4021,7 +4031,7 @@
+ 		GetSegmentJacobianDeterminant(&Jdet,&xyz_list_seg[0][0],gauss);
+ 		GetNodalFunctionsVelocity(vbasis, gauss);
+ 
+-		GetSegmentNormal(&normal[0],xyz_list_seg);
++		NormalBase(&normal[0],&xyz_list_seg[0][0]);
+ 		_assert_(normal[1]<0.);
+ 		bed_input->GetInputValue(&bed, gauss);
+ 		water_pressure=gravity*rho_water*bed;
+@@ -4156,7 +4166,7 @@
+ 	gravity   = matpar->GetG();
+ 	GetZeroLevelsetCoordinates(&xyz_list_front[0][0],xyz_list,MaskIceLevelsetEnum);
+ 	GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,xyz_list,2);
+-	GetSegmentNormal(&normal[0],xyz_list_front);
++	NormalBase(&normal[0],&xyz_list_front[0][0]);
+ 
+ 	/*Start looping on Gaussian points*/
+ 	GaussTria* gauss=new GaussTria(area_coordinates,3);
+@@ -7124,7 +7134,7 @@
+ 	/*Get vertex indices that lie on bed*/
+ 	this->EdgeOnSurfaceIndices(&indices[0],&indices[1]);
+ 	for(int i=0;i<NUMVERTICES1D;i++) for(int j=0;j<2;j++) xyz_list_seg[i][j]=xyz_list[indices[i]][j];
+-	GetSegmentNormal(&normal[0],xyz_list_seg);
++	NormalBase(&normal[0],&xyz_list_seg[0][0]);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	gauss=new GaussTria(indices[0],indices[1],2);
+@@ -7174,7 +7184,7 @@
+ 	/*Get vertex indices that lie on bed*/
+ 	this->EdgeOnBedIndices(&indices[0],&indices[1]);
+ 	for(int i=0;i<NUMVERTICES1D;i++) for(int j=0;j<2;j++) xyz_list_seg[i][j]=xyz_list[indices[i]][j];
+-	GetSegmentNormal(&normal[0],xyz_list_seg);
++	NormalBase(&normal[0],&xyz_list_seg[0][0]);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	gauss=new GaussTria(indices[0],indices[1],2);
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16806)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16807)
+@@ -247,7 +247,7 @@
+ 		void           GetConnectivityList(int* connectivity);
+ 		void           GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating);
+ 		IssmDouble     GetGroundedPortion(IssmDouble* xyz_list);
+-		void           GetSegmentNormal(IssmDouble* normal,IssmDouble xyz_list[2][3]);
++		void           NormalBase(IssmDouble* normal,IssmDouble* xyz_list);
+ 		IssmDouble     GetMaterialParameter(int enum_in);
+ 		void           GetZeroLevelsetCoordinates(IssmDouble* xyz_zero,IssmDouble xyz_list[3][3],int levelsetenum);
+ 		Input*         GetInput(int inputenum);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16806)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16807)
+@@ -161,8 +161,8 @@
+ }
+ /*}}}*/
+ 
+-/*FUNCTION Penta::BedNormal {{{*/
+-void Penta::BedNormal(IssmDouble* bed_normal, IssmDouble xyz_list[3][3]){
++/*FUNCTION Penta::NormalBase {{{*/
++void Penta::NormalBase(IssmDouble* bed_normal,IssmDouble* xyz_list){
+ 
+ 	int i;
+ 	IssmDouble v13[3],v23[3];
+@@ -170,8 +170,8 @@
+ 	IssmDouble normal_norm;
+ 
+ 	for (i=0;i<3;i++){
+-		v13[i]=xyz_list[0][i]-xyz_list[2][i];
+-		v23[i]=xyz_list[1][i]-xyz_list[2][i];
++		v13[i]=xyz_list[0*3+i]-xyz_list[2*3+i];
++		v23[i]=xyz_list[1*3+i]-xyz_list[2*3+i];
+ 	}
+ 
+ 	normal[0]=v13[1]*v23[2]-v13[2]*v23[1];
+@@ -180,9 +180,9 @@
+ 	normal_norm=sqrt( pow(normal[0],2)+pow(normal[1],2)+pow(normal[2],2) );
+ 
+ 	/*Bed normal is opposite to surface normal*/
+-	*(bed_normal)=-normal[0]/normal_norm;
+-	*(bed_normal+1)=-normal[1]/normal_norm;
+-	*(bed_normal+2)=-normal[2]/normal_norm;
++	bed_normal[0]=-normal[0]/normal_norm;
++	bed_normal[1]=-normal[1]/normal_norm;
++	bed_normal[2]=-normal[2]/normal_norm;
+ }
+ /*}}}*/
+ /*FUNCTION Penta::BasalFrictionCreateInput {{{*/
+@@ -303,7 +303,7 @@
+ 		sigma_yz=2*viscosity*epsilon[5];
+ 
+ 		/*Get normal vector to the bed */
+-		BedNormal(&bed_normal[0],xyz_list_tria);
++		NormalBase(&bed_normal[0],&xyz_list_tria[0][0]);
+ 
+ 		/*basalforce*/
+ 		basalforce[0] += sigma_xx*bed_normal[0] + sigma_xy*bed_normal[1] + sigma_xz*bed_normal[2];
+@@ -4787,7 +4787,7 @@
+ 			}
+ 
+ 			/*geothermal heatflux*/
+-			BedNormal(&normal_base[0],xyz_list_tria);
++			NormalBase(&normal_base[0],&xyz_list_tria[0][0]);
+ 			heatflux=0.;
+ 			for(i=0;i<3;i++) heatflux+=(vec_heatflux[i])*normal_base[i];
+ 
+@@ -6887,7 +6887,7 @@
+ 		this->GetStrainRate3d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+ 		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+ 
+-		BedNormal(&bed_normal[0],xyz_list_tria);
++		NormalBase(&bed_normal[0],&xyz_list_tria[0][0]);
+ 		friction->GetAlpha2(&alpha2_gauss, gauss,VxEnum,VyEnum,VzEnum);
+ 
+ 		DLSSAFS[0][0]=alpha2_gauss*gauss->weight*Jdet2d;
+@@ -8069,7 +8069,7 @@
+ 		vzSSA_input->GetInputValue(&w, gauss);
+ 		vzSSA_input->GetInputDerivativeValue(&dw[0],&xyz_list[0][0],gauss);
+ 
+-		BedNormal(&bed_normal[0],xyz_list_tria);
++		NormalBase(&bed_normal[0],&xyz_list_tria[0][0]);
+ 		this->GetStrainRate3d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+ 		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+ 		friction->GetAlpha2(&alpha2_gauss, gauss,VxEnum,VyEnum,VzEnum);
+@@ -8234,7 +8234,7 @@
+ 		vzHO_input->GetInputValue(&w, gauss);
+ 		vzHO_input->GetInputDerivativeValue(&dw[0],&xyz_list[0][0],gauss);
+ 
+-		BedNormal(&bed_normal[0],xyz_list_tria);
++		NormalBase(&bed_normal[0],&xyz_list_tria[0][0]);
+ 		this->GetStrainRate3d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+ 		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+ 		friction->GetAlpha2(&alpha2_gauss, gauss,VxEnum,VyEnum,VzEnum);
+@@ -8933,7 +8933,7 @@
+ 		GetTriaJacobianDeterminant(&Jdet2d, &xyz_list_tria[0][0], gauss);
+ 		GetNodalFunctionsVelocity(vbasis, gauss);
+ 
+-		BedNormal(&bed_normal[0],xyz_list_tria);
++		NormalBase(&bed_normal[0],&xyz_list_tria[0][0]);
+ 		bed_input->GetInputValue(&bed, gauss);
+ 		if(shelf_dampening){ //add dampening to avoid too high vertical velocities when not in hydrostatic equilibrium
+ 			bed_input->GetInputDerivativeValue(&dz[0],&xyz_list[0][0],gauss);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16806)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16807)
+@@ -191,7 +191,7 @@
+ 		void           AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		void           AddInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		void           AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum);
+-		void	         BedNormal(IssmDouble* bed_normal, IssmDouble xyz_list[3][3]);
++		void	         NormalBase(IssmDouble* bed_normal, IssmDouble* xyz_list);
+ 		ElementMatrix* CreateBasalMassMatrix(void);
+ 		ElementMatrix* CreateKMatrix(void);
+ 		ElementMatrix* CreateKMatrixMasstransport(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16806)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16807)
+@@ -113,6 +113,7 @@
+ 		void        NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+ 		bool        NoIceInElement(){_error_("not implemented yet");};
++		void        NormalBase(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		int         NumberofNodesVelocity(void){_error_("not implemented yet");};
+ 		int         NumberofNodesPressure(void){_error_("not implemented yet");};
+ 	   Element*    SpawnBasalElement(void){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16807-16808.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16807-16808.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16807-16808.diff	(revision 17802)
@@ -0,0 +1,16 @@
+Index: ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 16807)
++++ ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 16808)
+@@ -72,9 +72,9 @@
+ 	for (i=0;i<femmodel->elements->Size();i++){
+ 		element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+ 		element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+-		ElementVector* pe = analysis->CreatePVector(element);
++		//ElementVector* pe = analysis->CreatePVector(element);
+ 		//ElementMatrix* Ke = analysis->CreateKMatrix(element);
+-		//ElementVector* pe = element->CreatePVector();
++		ElementVector* pe = element->CreatePVector();
+ 		ElementMatrix* Ke = element->CreateKMatrix();
+ 		element->ReduceMatrices(Ke,pe);
+ 		if(Ke) Ke->AddToGlobal(Kff,Kfs);
Index: issm/oecreview/Archive/16554-17801/ISSM-16808-16809.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16808-16809.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16808-16809.diff	(revision 17802)
@@ -0,0 +1,156 @@
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h	(revision 16808)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h	(revision 16809)
+@@ -22,6 +22,8 @@
+ 		/*Finite element Analysis*/
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
++		ElementVector* CreatePVectorCG(Element* element);
++		ElementVector* CreatePVectorDG(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16808)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16809)
+@@ -215,8 +215,112 @@
+ 	_error_("not implemented yet");
+ }/*}}}*/
+ ElementVector* MasstransportAnalysis::CreatePVector(Element* element){/*{{{*/
+-_error_("not implemented yet");
++
++	if(!element->IsOnBed()) return NULL;
++	Element* basalelement = element->SpawnBasalElement();
++
++	switch(element->FiniteElement()){
++		case P1Enum: case P2Enum:
++			return CreatePVectorCG(basalelement);
++		case P1DGEnum:
++			return CreatePVectorDG(basalelement);
++		default:
++			_error_("Element type " << EnumToStringx(element->FiniteElement()) << " not supported yet");
++	}
++
+ }/*}}}*/
++ElementVector* MasstransportAnalysis::CreatePVectorCG(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	IssmDouble  Jdet,dt;
++	IssmDouble  ms,mb,mb_correction=0.,thickness;
++	IssmDouble* xyz_list;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementVector* pe    = element->NewElementVector();
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	element->FindParam(&dt,TimesteppingTimeStepEnum);
++	Input* mb_correction_input = element->GetInput(BasalforcingsMeltingRateCorrectionEnum);
++	Input* mb_input            = element->GetInput(BasalforcingsMeltingRateEnum);     _assert_(mb_input);
++	Input* ms_input            = element->GetInput(SurfaceforcingsMassBalanceEnum);   _assert_(ms_input);
++	Input* thickness_input     = element->GetInput(ThicknessEnum);                    _assert_(thickness_input);
++
++	/*Initialize mb_correction to 0, do not forget!:*/
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctions(basis,gauss);
++
++		ms_input->GetInputValue(&ms,gauss);
++		mb_input->GetInputValue(&mb,gauss);
++		thickness_input->GetInputValue(&thickness,gauss);
++		if(mb_correction_input)
++		 mb_correction_input->GetInputValue(&mb_correction,gauss);
++
++		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*(thickness+dt*(ms-mb-mb_correction))*basis[i];
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	return pe;
++}/*}}}*/
++ElementVector* MasstransportAnalysis::CreatePVectorDG(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	IssmDouble  Jdet,dt;
++	IssmDouble  ms,mb,mb_correction=0.,thickness;
++	IssmDouble* xyz_list;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementVector* pe    = element->NewElementVector();
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	element->FindParam(&dt,TimesteppingTimeStepEnum);
++	Input* mb_correction_input = element->GetInput(BasalforcingsMeltingRateCorrectionEnum);
++	Input* mb_input            = element->GetInput(BasalforcingsMeltingRateEnum);     _assert_(mb_input);
++	Input* ms_input            = element->GetInput(SurfaceforcingsMassBalanceEnum);   _assert_(ms_input);
++	Input* thickness_input     = element->GetInput(ThicknessEnum);                    _assert_(thickness_input);
++
++	/*Initialize mb_correction to 0, do not forget!:*/
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctions(basis,gauss);
++
++		ms_input->GetInputValue(&ms,gauss);
++		mb_input->GetInputValue(&mb,gauss);
++		thickness_input->GetInputValue(&thickness,gauss);
++		if(mb_correction_input)
++		 mb_correction_input->GetInputValue(&mb_correction,gauss);
++
++		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*(thickness+dt*(ms-mb-mb_correction))*basis[i];
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	return pe;
++}/*}}}*/
+ void MasstransportAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16808)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16809)
+@@ -1974,19 +1974,15 @@
+ /*FUNCTION Tria::IsOnBed {{{*/
+ bool Tria::IsOnBed(){
+ 
+-	bool onbed;
+ 	int meshtype;
+ 	this->parameters->FindParam(&meshtype,MeshTypeEnum);
+ 	switch(meshtype){
+ 		case Mesh2DverticalEnum:
+ 			return HasEdgeOnBed();
+-			break;
+ 		case Mesh2DhorizontalEnum:
+-			inputs->GetInputValue(&onbed,MeshElementonbedEnum);
+-			break;
++			return true;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+-	return onbed;
+ }
+ /*}}}*/
+ /*FUNCTION Tria::JacobianDeterminant{{{*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16809-16810.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16809-16810.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16809-16810.diff	(revision 17802)
@@ -0,0 +1,484 @@
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.h	(revision 16809)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.h	(revision 16810)
+@@ -22,6 +22,9 @@
+ 		/*Finite element Analysis*/
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
++		ElementVector* CreatePVectorVolume(Element* element);
++		ElementVector* CreatePVectorSheet(Element* element);
++		ElementVector* CreatePVectorShelf(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16809)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16810)
+@@ -115,8 +115,150 @@
+ 	_error_("not implemented yet");
+ }/*}}}*/
+ ElementVector* ThermalAnalysis::CreatePVector(Element* element){/*{{{*/
+-_error_("not implemented yet");
++
++	/*compute all load vectors for this element*/
++	ElementVector* pe1=CreatePVectorVolume(element);
++	ElementVector* pe2=CreatePVectorSheet(element);
++	ElementVector* pe3=CreatePVectorShelf(element);
++	ElementVector* pe =new ElementVector(pe1,pe2,pe3);
++
++	/*clean-up and return*/
++	delete pe1;
++	delete pe2;
++	delete pe3;
++	return pe;
+ }/*}}}*/
++ElementVector* ThermalAnalysis::CreatePVectorVolume(Element* element){/*{{{*/
++
++	/*Intermediaries*/
++	int         stabilization;
++	IssmDouble  Jdet,phi,dt;
++	IssmDouble  temperature;
++	IssmDouble  tau_parameter,diameter;
++	IssmDouble  u,v,w;
++	IssmDouble  scalar_def,scalar_transient;
++	IssmDouble* xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector*/
++	ElementVector* pe     = element->NewElementVector();
++	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
++	IssmDouble*    dbasis = xNew<IssmDouble>(3*numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	IssmDouble  rho_ice             = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	IssmDouble  heatcapacity        = element->GetMaterialParameter(MaterialsHeatcapacityEnum);
++	IssmDouble  thermalconductivity = element->GetMaterialParameter(MaterialsThermalconductivityEnum);
++	IssmDouble  kappa = thermalconductivity/(rho_ice*heatcapacity);
++	element->FindParam(&dt,TimesteppingTimeStepEnum);
++	element->FindParam(&stabilization,ThermalStabilizationEnum);
++	Input* vx_input=element->GetInput(VxEnum); _assert_(vx_input);
++	Input* vy_input=element->GetInput(VyEnum); _assert_(vy_input);
++	Input* vz_input=element->GetInput(VzEnum); _assert_(vz_input);
++	Input* temperature_input = NULL;
++	if(reCast<bool,IssmDouble>(dt)){temperature_input = element->GetInput(TemperatureEnum); _assert_(temperature_input);}
++	if(stabilization==2) diameter=element->MinEdgeLength(xyz_list);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(3);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctions(basis,gauss);
++		element->ViscousHeating(&phi,xyz_list,gauss,vx_input,vy_input,vz_input);
++
++		scalar_def=phi/(rho_ice*heatcapacity)*Jdet*gauss->weight;
++		if(reCast<bool,IssmDouble>(dt)) scalar_def=scalar_def*dt;
++
++		for(int i=0;i<numnodes;i++) pe->values[i]+=scalar_def*basis[i];
++
++		/* Build transient now */
++		if(reCast<bool,IssmDouble>(dt)){
++			temperature_input->GetInputValue(&temperature, gauss);
++			scalar_transient=temperature*Jdet*gauss->weight;
++			for(int i=0;i<numnodes;i++) pe->values[i]+=scalar_transient*basis[i];
++		}
++
++		if(stabilization==2){
++			element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++			vx_input->GetInputValue(&u,gauss);
++			vy_input->GetInputValue(&v,gauss);
++			vz_input->GetInputValue(&w,gauss);
++
++			tau_parameter=element->StabilizationParameter(u,v,w,diameter,kappa);
++
++			for(int i=0;i<numnodes;i++) pe->values[i]+=tau_parameter*scalar_def*(u*dbasis[0*3+i]+v*dbasis[1*3+i]+w*dbasis[2*3+i]);
++			if(reCast<bool,IssmDouble>(dt)){
++				for(int i=0;i<numnodes;i++) pe->values[i]+=tau_parameter*scalar_transient*(u*dbasis[0*3+i]+v*dbasis[1*3+i]+w*dbasis[2*3+i]);
++			}
++		}
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(dbasis);
++	xDelete<IssmDouble>(xyz_list);
++	delete gauss;
++	return pe;
++
++}/*}}}*/
++ElementVector* ThermalAnalysis::CreatePVectorSheet(Element* element){/*{{{*/
++	return NULL;
++}/*}}}*/
++ElementVector* ThermalAnalysis::CreatePVectorShelf(Element* element){/*{{{*/
++
++	IssmDouble  t_pmp,dt,Jdet,scalar_ocean,pressure;
++	IssmDouble *xyz_list_base = NULL;
++
++	/*Get basal element*/
++	if(!element->IsOnBed() || !element->IsFloating()) return NULL;
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize vectors*/
++	ElementVector* pe    = element->NewElementVector();
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinatesBase(&xyz_list_base);
++	element->FindParam(&dt,TimesteppingTimeStepEnum);
++	Input*      pressure_input=element->GetInput(PressureEnum); _assert_(pressure_input);
++	IssmDouble  gravity             = element->GetMaterialParameter(ConstantsGEnum);
++	IssmDouble  rho_water           = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble  rho_ice             = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	IssmDouble  heatcapacity        = element->GetMaterialParameter(MaterialsHeatcapacityEnum);
++	IssmDouble  mixed_layer_capacity= element->GetMaterialParameter(MaterialsMixedLayerCapacityEnum);
++	IssmDouble  thermal_exchange_vel= element->GetMaterialParameter(MaterialsThermalExchangeVelocityEnum);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGaussBase(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
++		element->NodalFunctions(basis,gauss);
++
++		pressure_input->GetInputValue(&pressure,gauss);
++		t_pmp=element->TMeltingPoint(pressure);
++
++		scalar_ocean=gauss->weight*Jdet*rho_water*mixed_layer_capacity*thermal_exchange_vel*(t_pmp)/(heatcapacity*rho_ice);
++		if(reCast<bool,IssmDouble>(dt)) scalar_ocean=dt*scalar_ocean;
++
++		for(int i=0;i<numnodes;i++) pe->values[i]+=scalar_ocean*basis[i];
++	}
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(xyz_list_base);
++	return pe;
++}/*}}}*/
+ void ThermalAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,TemperatureEnum);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 16809)
++++ ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 16810)
+@@ -75,7 +75,7 @@
+ 	_error_("not implemented yet");
+ }/*}}}*/
+ ElementVector* MeltingAnalysis::CreatePVector(Element* element){/*{{{*/
+-_error_("not implemented yet");
++	return NULL;
+ }/*}}}*/
+ void MeltingAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16809)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16810)
+@@ -52,7 +52,9 @@
+ 		virtual void   FindParam(IssmDouble* pvalue,int paramenum)=0;
+ 		virtual int    FiniteElement(void)=0;
+ 		virtual IssmDouble GetMaterialParameter(int enum_in)=0;
++		virtual IssmDouble MinEdgeLength(IssmDouble* xyz_list)=0;
+ 		virtual void   NodalFunctions(IssmDouble* basis,Gauss* gauss)=0;
++		virtual void   NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss)=0;
+ 		virtual void   NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss)=0;
+ 		virtual void   NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss)=0;
+ 		virtual void   NormalBase(IssmDouble* normal,IssmDouble* xyz_list)=0;
+@@ -126,6 +128,8 @@
+ 		virtual IssmDouble TMeltingPoint(IssmDouble pressure)=0;
+ 		virtual void   ReduceMatrices(ElementMatrix* Ke,ElementVector* pe)=0;
+ 		virtual void   ResetCoordinateSystem()=0;
++		virtual IssmDouble StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa)=0;
++		virtual void   ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input)=0;
+ 		virtual int    VelocityInterpolation()=0;
+ 		virtual int    PressureInterpolation()=0;
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16809)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16810)
+@@ -2215,6 +2215,14 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Tria::NodalFunctionsDerivatives{{{*/
++void Tria::NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussTriaEnum);
++	this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussTria*)gauss);
++
++}
++/*}}}*/
+ /*FUNCTION Tria::NodalFunctionsVelocity{{{*/
+ void Tria::NodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16809)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16810)
+@@ -268,15 +268,18 @@
+ 		bool	         IsInput(int name);
+ 		void           JacobianDeterminant(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss);
+ 		void           JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
++		IssmDouble     MinEdgeLength(IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		Gauss*         NewGauss(void);
+ 		Gauss*         NewGauss(int order);
+ 		Gauss*         NewGaussBase(int order){_error_("not implemented yet");};
+ 		ElementVector* NewElementVector(int approximation_enum);
+ 		void           NodalFunctions(IssmDouble* basis,Gauss* gauss);
++		void           NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+ 		void           NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss);
+ 		void           NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss);
+ 		void	         SetClone(int* minranks);
+ 		Seg*	         SpawnSeg(int index1,int index2);
++		IssmDouble     StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa){_error_("not implemented yet");};
+ 		void	         SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]);
+ 		void           TransformLoadVectorCoord(ElementVector* pe,int transformenum);
+ 		void           TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list);
+@@ -286,6 +289,7 @@
+ 		void           TransformSolutionCoord(IssmDouble* values,int* transformenum_list);
+ 		void           TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum){_error_("not implemented yet");};
+ 		void           TransformSolutionCoord(IssmDouble* values,int numnodes,int* transformenum_list){_error_("not implemented yet");};
++		void           ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
+ 		#ifdef _HAVE_STRESSBALANCE_
+ 		ElementMatrix* CreateKMatrixStressbalanceSSA(void);
+ 		ElementMatrix* CreateKMatrixStressbalanceSSAViscous(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16809)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16810)
+@@ -1527,8 +1527,8 @@
+ 	for(int i=0;i<3;i++) normal[i]=normal[i]/norm;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetStabilizationParameter {{{*/
+-IssmDouble Penta::GetStabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa){
++/*FUNCTION Penta::StabilizationParameter {{{*/
++IssmDouble Penta::StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa){
+ 	/*Compute stabilization parameter*/
+ 	/*kappa=thermalconductivity/(rho_ice*hearcapacity) for thermal model*/
+ 	/*kappa=enthalpydiffusionparameter for enthalpy model*/
+@@ -2464,7 +2464,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION Penta::MinEdgeLength{{{*/
+-IssmDouble Penta::MinEdgeLength(IssmDouble xyz_list[6][3]){
++IssmDouble Penta::MinEdgeLength(IssmDouble* xyz_list){
+ 	/*Return the minimum lenght of the nine egdes of the penta*/
+ 
+ 	int    i,node0,node1;
+@@ -2478,7 +2478,7 @@
+ 		node1=edges[i][1];
+ 
+ 		/*Compute the length of this edge and compare it to the minimal length*/
+-		length=sqrt(pow(xyz_list[node0][0]-xyz_list[node1][0],2)+pow(xyz_list[node0][1]-xyz_list[node1][1],2)+pow(xyz_list[node0][2]-xyz_list[node1][2],2));
++		length=sqrt(pow(xyz_list[node0*3+0]-xyz_list[node1*3+0],2)+pow(xyz_list[node0*3+1]-xyz_list[node1*3+1],2)+pow(xyz_list[node0*3+2]-xyz_list[node1*3+2],2));
+ 		if(length<minlength || minlength<0) minlength=length;
+ 	}
+ 
+@@ -2545,6 +2545,14 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Penta::NodalFunctionsDerivatives{{{*/
++void Penta::NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussPentaEnum);
++	this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussPenta*)gauss);
++
++}
++/*}}}*/
+ /*FUNCTION Penta::NodalFunctionsVelocity{{{*/
+ void Penta::NodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss){
+ 
+@@ -3378,6 +3386,23 @@
+ 	delete gauss;
+ }
+ /*}}}*/
++/*FUNCTION Penta::ViscousHeating{{{*/
++void Penta::ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){
++
++	/*Intermediaries*/
++	IssmDouble phi;
++	IssmDouble viscosity;
++	IssmDouble epsilon[6];
++
++	_assert_(gauss->Enum()==GaussPentaEnum);
++	this->GetStrainRate3d(&epsilon[0],xyz_list,(GaussPenta*)gauss,vx_input,vy_input,vz_input);
++	material->GetViscosity3dFS(&viscosity,&epsilon[0]);
++	GetPhi(&phi,&epsilon[0],viscosity);
++
++	/*Assign output pointer*/
++	*pphi = phi;
++}
++/*}}}*/
+ /*FUNCTION Penta::VelocityInterpolation{{{*/
+ int Penta::VelocityInterpolation(void){
+ 	return PentaRef::VelocityInterpolation();
+@@ -3741,7 +3766,7 @@
+ 	Input* vxm_input=inputs->GetInput(VxMeshEnum);             _assert_(vxm_input);
+ 	Input* vym_input=inputs->GetInput(VyMeshEnum);             _assert_(vym_input);
+ 	Input* vzm_input=inputs->GetInput(VzMeshEnum);             _assert_(vzm_input);
+-	if (stabilization==2) diameter=MinEdgeLength(xyz_list);
++	if (stabilization==2) diameter=MinEdgeLength(&xyz_list[0][0]);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	gauss=new GaussPenta(2,2);
+@@ -3824,7 +3849,7 @@
+ 		}
+ 		else if(stabilization==2){
+ 			GetNodalFunctionsP1Derivatives(&dbasis[0][0],&xyz_list[0][0], gauss);
+-			tau_parameter=GetStabilizationParameter(u-um,v-vm,w-wm,diameter,kappa/rho_ice);
++			tau_parameter=StabilizationParameter(u-um,v-vm,w-wm,diameter,kappa/rho_ice);
+ 
+ 			for(i=0;i<numdof;i++){
+ 				for(j=0;j<numdof;j++){
+@@ -3972,7 +3997,7 @@
+ 	Input* vxm_input=inputs->GetInput(VxMeshEnum); _assert_(vxm_input);
+ 	Input* vym_input=inputs->GetInput(VyMeshEnum); _assert_(vym_input);
+ 	Input* vzm_input=inputs->GetInput(VzMeshEnum); _assert_(vzm_input);
+-	if (stabilization==2) diameter=MinEdgeLength(xyz_list);
++	if (stabilization==2) diameter=MinEdgeLength(&xyz_list[0][0]);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	gauss=new GaussPenta(2,2);
+@@ -4053,7 +4078,7 @@
+ 		}
+ 		else if(stabilization==2){
+ 			GetNodalFunctionsP1Derivatives(&dbasis[0][0],&xyz_list[0][0], gauss);
+-			tau_parameter=GetStabilizationParameter(u-um,v-vm,w-wm,diameter,kappa);
++			tau_parameter=StabilizationParameter(u-um,v-vm,w-wm,diameter,kappa);
+ 
+ 			for(i=0;i<numdof;i++){
+ 				for(j=0;j<numdof;j++){
+@@ -4187,7 +4212,7 @@
+ 		enthalpy_input=inputs->GetInput(EnthalpyEnum); _assert_(enthalpy_input);
+ 	}
+ 	if (stabilization==2){
+-		diameter=MinEdgeLength(xyz_list);
++		diameter=MinEdgeLength(&xyz_list[0][0]);
+ 	}
+ 
+ 	/* Start  looping on the number of gaussian points: */
+@@ -4226,7 +4251,7 @@
+ 			GetInputListOnVertices(&pressure_p[0],PressureEnum);
+ 			kappa=matpar->GetEnthalpyDiffusionParameterVolume(enthalpypicard,pressure_p);
+ 			kappa/=rho_ice;
+-			tau_parameter=GetStabilizationParameter(u,v,w,diameter,kappa); 
++			tau_parameter=StabilizationParameter(u,v,w,diameter,kappa); 
+ 
+ 			for(i=0;i<NUMVERTICES;i++)  pe->values[i]+=tau_parameter*scalar_def*(u*dbasis[0][i]+v*dbasis[1][i]+w*dbasis[2][i]);
+ 			if(reCast<bool,IssmDouble>(dt)){
+@@ -4458,7 +4483,7 @@
+ 	Input* vz_input=inputs->GetInput(VzEnum); _assert_(vz_input);
+ 	Input* temperature_input=NULL;
+ 	if(reCast<bool,IssmDouble>(dt)) temperature_input=inputs->GetInput(TemperatureEnum); _assert_(inputs);
+-	if(stabilization==2) diameter=MinEdgeLength(xyz_list);
++	if(stabilization==2) diameter=MinEdgeLength(&xyz_list[0][0]);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	gauss=new GaussPenta(2,3);
+@@ -4492,7 +4517,7 @@
+ 			vy_input->GetInputValue(&v, gauss);
+ 			vz_input->GetInputValue(&w, gauss);
+ 
+-			tau_parameter=GetStabilizationParameter(u,v,w,diameter,kappa);
++			tau_parameter=StabilizationParameter(u,v,w,diameter,kappa);
+ 
+ 			for(i=0;i<NUMVERTICES;i++)  pe->values[i]+=tau_parameter*scalar_def*(u*dbasis[0][i]+v*dbasis[1][i]+w*dbasis[2][i]);
+ 			if(reCast<bool,IssmDouble>(dt)){
+@@ -7614,7 +7639,7 @@
+ 
+ 	/*Find minimal length and B*/
+ 	rigidity=material->GetB();
+-	diameter=MinEdgeLength(xyz_list);
++	diameter=MinEdgeLength(&xyz_list[0][0]);
+ 
+ 		gauss=new GaussPenta();
+ 		for(int iv=0;iv<6;iv++){
+@@ -8755,7 +8780,7 @@
+ 	Input* vz_input=inputs->GetInput(VzEnum); _assert_(vz_input);
+ 
+ 	/*Find minimal length*/
+-	diameter=MinEdgeLength(xyz_list);
++	diameter=MinEdgeLength(&xyz_list[0][0]);
+ 
+ 		gauss=new GaussPenta();
+ 		for(int iv=0;iv<6;iv++){
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16809)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16810)
+@@ -123,6 +123,7 @@
+ 		int    NodalValue(IssmDouble* pvalue, int index, int natureofdataenum);
+ 		IssmDouble TimeAdapt();
+ 		void   ViscousHeatingCreateInput(void);
++		void   ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+ 
+ 		 #ifdef _HAVE_RESPONSES_
+ 		void   AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part);
+@@ -223,7 +224,6 @@
+ 		void           GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype);
+ 		void	         GetPhi(IssmDouble* phi, IssmDouble*  epsilon, IssmDouble viscosity);
+ 		void           GetQuadNormal(IssmDouble* normal,IssmDouble xyz_list[4][3]);
+-		IssmDouble     GetStabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa);
+ 		void           GetStrainRate3dHO(IssmDouble* epsilon,IssmDouble* xyz_list, GaussPenta* gauss, Input* vx_input, Input* vy_input);
+ 		void           GetStrainRate3d(IssmDouble* epsilon,IssmDouble* xyz_list, GaussPenta* gauss, Input* vx_input, Input* vy_input, Input* vz_input);
+ 		Penta*         GetUpperElement(void);
+@@ -246,12 +246,14 @@
+ 		Gauss*         NewGaussBase(int order);
+ 		ElementVector* NewElementVector(int approximation_enum);
+ 		void           NodalFunctions(IssmDouble* basis,Gauss* gauss);
++		void           NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+ 		void           NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss);
+ 		void           NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss);
+-		IssmDouble     MinEdgeLength(IssmDouble xyz_list[6][3]);
++		IssmDouble     MinEdgeLength(IssmDouble* xyz_list);
+ 		void	         SetClone(int* minranks);
+ 		Tria*	         SpawnTria(int location);
+ 		void	         SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]);
++		IssmDouble     StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa);
+ 		void           TransformLoadVectorCoord(ElementVector* pe,int transformenum);
+ 		void           TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list);
+ 		void           TransformLoadVectorCoord(ElementVector* pe,int numnodes,int transformenum){_error_("not implemented yet");};      /*Tiling only*/
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16809)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16810)
+@@ -109,14 +109,17 @@
+ 		bool        IsNodeOnShelfFromFlags(IssmDouble* flags){_error_("not implemented yet");};
+ 		void        JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void        JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
++		IssmDouble  MinEdgeLength(IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		void        NodalFunctions(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
++		void        NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		bool        NoIceInElement(){_error_("not implemented yet");};
+ 		void        NormalBase(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		int         NumberofNodesVelocity(void){_error_("not implemented yet");};
+ 		int         NumberofNodesPressure(void){_error_("not implemented yet");};
+ 	   Element*    SpawnBasalElement(void){_error_("not implemented yet");};
++		IssmDouble  StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa){_error_("not implemented yet");};
+ 		int         PressureInterpolation(void){_error_("not implemented yet");};
+ 		int         VelocityInterpolation(void){_error_("not implemented yet");};
+ 		Input*      GetInput(int inputenum){_error_("not implemented yet");};
+@@ -131,6 +134,7 @@
+ 		Gauss*      NewGauss(int order){_error_("not implemented yet");};
+ 		Gauss*      NewGaussBase(int order){_error_("not implemented yet");};
+ 		ElementVector* NewElementVector(int approximation_enum){_error_("not implemented yet");};
++		void           ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
+ 		#ifdef _HAVE_THERMAL_
+ 		void UpdateBasalConstraintsEnthalpy(void){_error_("not implemented yet");};
+ 		void ComputeBasalMeltingrate(void){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16810-16811.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16810-16811.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16810-16811.diff	(revision 17802)
@@ -0,0 +1,121 @@
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 16810)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 16811)
+@@ -117,8 +117,102 @@
+ 	_error_("not implemented yet");
+ }/*}}}*/
+ ElementVector* BalancethicknessAnalysis::CreatePVector(Element* element){/*{{{*/
+-_error_("not implemented yet");
++
++	if(!element->IsOnBed()) return NULL;
++	Element* basalelement = element->SpawnBasalElement();
++
++	switch(element->FiniteElement()){
++		case P1Enum: case P2Enum:
++			return CreatePVectorCG(basalelement);
++		case P1DGEnum:
++			return CreatePVectorDG(basalelement);
++		default:
++			_error_("Element type " << EnumToStringx(element->FiniteElement()) << " not supported yet");
++	}
++
+ }/*}}}*/
++ElementVector* BalancethicknessAnalysis::CreatePVectorCG(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	IssmDouble  dhdt,mb,ms,Jdet;
++	IssmDouble* xyz_list;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementVector* pe    = element->NewElementVector();
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	Input* mb_input   = element->GetInput(BasalforcingsMeltingRateEnum);       _assert_(mb_input);
++	Input* ms_input   = element->GetInput(SurfaceforcingsMassBalanceEnum);     _assert_(ms_input);
++	Input* dhdt_input = element->GetInput(BalancethicknessThickeningRateEnum); _assert_(dhdt_input);
++
++	/*Initialize mb_correction to 0, do not forget!:*/
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctions(basis,gauss);
++
++		ms_input->GetInputValue(&ms,gauss);
++		mb_input->GetInputValue(&mb,gauss);
++		dhdt_input->GetInputValue(&dhdt,gauss);
++
++		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*(ms-mb-dhdt)*basis[i];
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	return pe;
++}/*}}}*/
++ElementVector* BalancethicknessAnalysis::CreatePVectorDG(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	IssmDouble  dhdt,mb,ms,Jdet;
++	IssmDouble* xyz_list;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementVector* pe    = element->NewElementVector();
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	Input* mb_input   = element->GetInput(BasalforcingsMeltingRateEnum);       _assert_(mb_input);
++	Input* ms_input   = element->GetInput(SurfaceforcingsMassBalanceEnum);     _assert_(ms_input);
++	Input* dhdt_input = element->GetInput(BalancethicknessThickeningRateEnum); _assert_(dhdt_input);
++
++	/*Initialize mb_correction to 0, do not forget!:*/
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctions(basis,gauss);
++
++		ms_input->GetInputValue(&ms,gauss);
++		mb_input->GetInputValue(&mb,gauss);
++		dhdt_input->GetInputValue(&dhdt,gauss);
++
++		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*(ms-mb-dhdt)*basis[i];
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	return pe;
++}/*}}}*/
+ void BalancethicknessAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h	(revision 16810)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h	(revision 16811)
+@@ -22,6 +22,8 @@
+ 		/*Finite element Analysis*/
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
++		ElementVector* CreatePVectorCG(Element* element);
++		ElementVector* CreatePVectorDG(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
Index: issm/oecreview/Archive/16554-17801/ISSM-16811-16812.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16811-16812.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16811-16812.diff	(revision 17802)
@@ -0,0 +1,358 @@
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h	(revision 16811)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h	(revision 16812)
+@@ -22,6 +22,9 @@
+ 		/*Finite element Analysis*/
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
++		ElementVector* CreatePVectorVolume(Element* element);
++		ElementVector* CreatePVectorSheet(Element* element);
++		ElementVector* CreatePVectorShelf(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16811)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16812)
+@@ -187,8 +187,158 @@
+ 	_error_("not implemented yet");
+ }/*}}}*/
+ ElementVector* EnthalpyAnalysis::CreatePVector(Element* element){/*{{{*/
+-_error_("not implemented yet");
++
++	/*compute all load vectors for this element*/
++	ElementVector* pe1=CreatePVectorVolume(element);
++	ElementVector* pe2=CreatePVectorSheet(element);
++	ElementVector* pe3=CreatePVectorShelf(element);
++	ElementVector* pe =new ElementVector(pe1,pe2,pe3);
++
++	/*clean-up and return*/
++	delete pe1;
++	delete pe2;
++	delete pe3;
++	return pe;
+ }/*}}}*/
++ElementVector* EnthalpyAnalysis::CreatePVectorVolume(Element* element){/*{{{*/
++
++	/*Intermediaries*/
++	int         stabilization;
++	IssmDouble  Jdet,phi,dt;
++	IssmDouble  enthalpy;
++	IssmDouble  kappa,tau_parameter,diameter;
++	IssmDouble  u,v,w;
++	IssmDouble  scalar_def,scalar_transient;
++	IssmDouble* xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes    = element->GetNumberOfNodes();
++	int numvertices = element->GetNumberOfVertices();
++
++	/*Initialize Element vector*/
++	ElementVector* pe             = element->NewElementVector();
++	IssmDouble*    basis          = xNew<IssmDouble>(numnodes);
++	IssmDouble*    dbasis         = xNew<IssmDouble>(3*numnodes);
++	IssmDouble*    pressure       = xNew<IssmDouble>(numvertices);
++	IssmDouble*    enthalpypicard = xNew<IssmDouble>(numvertices);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	IssmDouble  rho_ice             = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	IssmDouble  thermalconductivity = element->GetMaterialParameter(MaterialsThermalconductivityEnum);
++	element->FindParam(&dt,TimesteppingTimeStepEnum);
++	element->FindParam(&stabilization,ThermalStabilizationEnum);
++	Input* vx_input=element->GetInput(VxEnum); _assert_(vx_input);
++	Input* vy_input=element->GetInput(VyEnum); _assert_(vy_input);
++	Input* vz_input=element->GetInput(VzEnum); _assert_(vz_input);
++	Input* enthalpy_input = NULL;
++	if(reCast<bool,IssmDouble>(dt)){enthalpy_input = element->GetInput(EnthalpyEnum); _assert_(enthalpy_input);}
++	if(stabilization==2){
++		element->GetInputListOnVertices(enthalpypicard,EnthalpyPicardEnum);
++		element->GetInputListOnVertices(pressure,PressureEnum);
++		diameter=element->MinEdgeLength(xyz_list);
++	}
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(3);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctions(basis,gauss);
++		element->ViscousHeating(&phi,xyz_list,gauss,vx_input,vy_input,vz_input);
++
++		scalar_def=phi/rho_ice*Jdet*gauss->weight;
++		if(reCast<bool,IssmDouble>(dt)) scalar_def=scalar_def*dt;
++
++		/*TODO: add -beta*laplace T_m(p)*/
++		for(int i=0;i<numnodes;i++) pe->values[i]+=scalar_def*basis[i];
++
++		/* Build transient now */
++		if(reCast<bool,IssmDouble>(dt)){
++			enthalpy_input->GetInputValue(&enthalpy, gauss);
++			scalar_transient=enthalpy*Jdet*gauss->weight;
++			for(int i=0;i<numnodes;i++) pe->values[i]+=scalar_transient*basis[i];
++		}
++
++		if(stabilization==2){
++			element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++			vx_input->GetInputValue(&u,gauss);
++			vy_input->GetInputValue(&v,gauss);
++			vz_input->GetInputValue(&w,gauss);
++			kappa          = element->EnthalpyDiffusionParameterVolume(numvertices,enthalpypicard,pressure) / rho_ice;
++			tau_parameter  = element->StabilizationParameter(u,v,w,diameter,kappa);
++
++			for(int i=0;i<numnodes;i++) pe->values[i]+=tau_parameter*scalar_def*(u*dbasis[0*3+i]+v*dbasis[1*3+i]+w*dbasis[2*3+i]);
++			if(reCast<bool,IssmDouble>(dt)){
++				for(int i=0;i<numnodes;i++) pe->values[i]+=tau_parameter*scalar_transient*(u*dbasis[0*3+i]+v*dbasis[1*3+i]+w*dbasis[2*3+i]);
++			}
++		}
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(dbasis);
++	xDelete<IssmDouble>(pressure);
++	xDelete<IssmDouble>(enthalpypicard);
++	xDelete<IssmDouble>(xyz_list);
++	delete gauss;
++	return pe;
++
++}/*}}}*/
++ElementVector* EnthalpyAnalysis::CreatePVectorSheet(Element* element){/*{{{*/
++	return NULL;
++}/*}}}*/
++ElementVector* EnthalpyAnalysis::CreatePVectorShelf(Element* element){/*{{{*/
++
++	IssmDouble  t_pmp,dt,Jdet,scalar_ocean,pressure;
++	IssmDouble *xyz_list_base = NULL;
++
++	/*Get basal element*/
++	if(!element->IsOnBed() || !element->IsFloating()) return NULL;
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize vectors*/
++	ElementVector* pe    = element->NewElementVector();
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinatesBase(&xyz_list_base);
++	element->FindParam(&dt,TimesteppingTimeStepEnum);
++	Input*      pressure_input=element->GetInput(PressureEnum); _assert_(pressure_input);
++	IssmDouble  gravity             = element->GetMaterialParameter(ConstantsGEnum);
++	IssmDouble  rho_water           = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble  rho_ice             = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	IssmDouble  heatcapacity        = element->GetMaterialParameter(MaterialsHeatcapacityEnum);
++	IssmDouble  mixed_layer_capacity= element->GetMaterialParameter(MaterialsMixedLayerCapacityEnum);
++	IssmDouble  thermal_exchange_vel= element->GetMaterialParameter(MaterialsThermalExchangeVelocityEnum);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGaussBase(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
++		element->NodalFunctions(basis,gauss);
++
++		pressure_input->GetInputValue(&pressure,gauss);
++		t_pmp=element->TMeltingPoint(pressure);
++
++		scalar_ocean=gauss->weight*Jdet*rho_water*mixed_layer_capacity*thermal_exchange_vel*(t_pmp)/(heatcapacity*rho_ice);
++		if(reCast<bool,IssmDouble>(dt)) scalar_ocean=dt*scalar_ocean;
++
++		for(int i=0;i<numnodes;i++) pe->values[i]+=scalar_ocean*basis[i];
++	}
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(xyz_list_base);
++	return pe;
++}/*}}}*/
+ void EnthalpyAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,EnthalpyEnum);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 16811)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 16812)
+@@ -416,26 +416,25 @@
+ }
+ /*}}}*/
+ /*FUNCTION Matpar::GetEnthalpyDiffusionParameterVolume{{{*/
+-IssmDouble Matpar::GetEnthalpyDiffusionParameterVolume(IssmDouble enthalpy[6], IssmDouble pressure[6]){
++IssmDouble Matpar::GetEnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure){
+ 
+-	IssmDouble lambda; // fraction of cold ice
+-	IssmDouble kappa,kappa_c,kappa_t;  //enthalpy conductivities
+-	IssmDouble Hc,Ht;
+-	IssmDouble PIE[6],dHpmp[6];
+-	int iv;
++	int         iv;
++	IssmDouble  lambda;                 // fraction of cold ice
++	IssmDouble  kappa,kappa_c,kappa_t;  //enthalpy conductivities
++	IssmDouble  Hc,Ht;
++	IssmDouble* PIE   = xNew<IssmDouble>(numvertices);
++	IssmDouble* dHpmp = xNew<IssmDouble>(numvertices);
+ 
+-	for (iv=0; iv<6; iv++){
++	for(iv=0; iv<numvertices; iv++){
+ 		PIE[iv]=PureIceEnthalpy(pressure[iv]);
+ 		dHpmp[iv]=enthalpy[iv]-PIE[iv];
+ 	}
+ 
+ 	bool allequalsign=true;
+ 	if(dHpmp[0]<0)
+-		for(iv=1; iv<6;iv++)
+-			allequalsign=(allequalsign && (dHpmp[iv]<0));
++		for(iv=1; iv<numvertices;iv++) allequalsign=(allequalsign && (dHpmp[iv]<0));
+ 	else
+-		for(iv=1; iv<6;iv++)
+-			allequalsign=(allequalsign && (dHpmp[iv]>=0));
++		for(iv=1; iv<numvertices;iv++) allequalsign=(allequalsign && (dHpmp[iv]>=0));
+ 
+ 	if(allequalsign){
+ 		kappa=GetEnthalpyDiffusionParameter(enthalpy[0], pressure[0]);
+@@ -446,16 +445,20 @@
+ 		kappa_c=GetEnthalpyDiffusionParameter(PureIceEnthalpy(0.)-1.,0.);
+ 		kappa_t=GetEnthalpyDiffusionParameter(PureIceEnthalpy(0.)+1.,0.);
+ 		Hc=0.; Ht=0.;
+-		for(iv=0; iv<6;iv++){
++		for(iv=0; iv<numvertices;iv++){
+ 			if(enthalpy[iv]<PIE[iv])
+-				Hc+=(PIE[iv]-enthalpy[iv]);
++			 Hc+=(PIE[iv]-enthalpy[iv]);
+ 			else
+-				Ht+=(enthalpy[iv]-PIE[iv]);
++			 Ht+=(enthalpy[iv]-PIE[iv]);
+ 		}
+ 		_assert_((Hc+Ht)>0.);
+-		lambda=Hc/(Hc+Ht);
+-		kappa=1./(lambda/kappa_c + (1.-lambda)/kappa_t);
++		lambda = Hc/(Hc+Ht);
++		kappa  = 1./(lambda/kappa_c + (1.-lambda)/kappa_t);
+ 	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(PIE);
++	xDelete<IssmDouble>(dHpmp);
+ 	return kappa;
+ }
+ /*}}}*/
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 16811)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 16812)
+@@ -128,7 +128,7 @@
+ 		IssmDouble TMeltingPoint(IssmDouble pressure);
+ 		IssmDouble PureIceEnthalpy(IssmDouble pressure);
+ 		IssmDouble GetEnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure);
+-		IssmDouble GetEnthalpyDiffusionParameterVolume(IssmDouble enthalpy[6], IssmDouble pressure[6]);
++		IssmDouble GetEnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure);
+ 		IssmDouble GetLithosphereShearModulus();
+ 		IssmDouble GetLithosphereDensity();
+ 		IssmDouble GetMantleShearModulus();
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16811)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16812)
+@@ -48,6 +48,8 @@
+ 		virtual void   CreateJacobianMatrix(Matrix<IssmDouble>* Jff)=0;
+ 		virtual void   DeleteMaterials(void)=0;
+ 		virtual void   EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure)=0;
++		virtual IssmDouble EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure)=0;
++		virtual IssmDouble EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure)=0;
+ 		virtual void   FindParam(int* pvalue,int paramenum)=0;
+ 		virtual void   FindParam(IssmDouble* pvalue,int paramenum)=0;
+ 		virtual int    FiniteElement(void)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16811)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16812)
+@@ -238,6 +238,8 @@
+ 		ElementVector* CreatePVectorFreeSurfaceBase1D(void);
+ 		ElementVector* CreatePVectorL2Projection(void);
+ 		ElementVector* CreatePVectorL2ProjectionBase(void);
++		IssmDouble     EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented");};
++		IssmDouble     EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure){_error_("not implemented");};
+ 		IssmDouble     GetArea(void);
+ 		void           GetAreaCoordinates(IssmDouble *area_coordinates,IssmDouble xyz_zero[3][3],IssmDouble xyz_list[3][3],int numpoints);
+ 		int            GetElementType(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16811)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16812)
+@@ -874,6 +874,16 @@
+ 	matpar->EnthalpyToThermal(ptemperature,pwaterfraction,enthalpy,pressure);
+ }
+ /*}}}*/
++/*FUNCTION Penta::EnthalpyDiffusionParameter{{{*/
++IssmDouble Penta::EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure){
++	return matpar->GetEnthalpyDiffusionParameter(enthalpy,pressure);
++}
++/*}}}*/
++/*FUNCTION Penta::EnthalpyDiffusionParameterVolume{{{*/
++IssmDouble Penta::EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure){
++	return matpar->GetEnthalpyDiffusionParameterVolume(numvertices,enthalpy,pressure);
++}
++/*}}}*/
+ /*FUNCTION Penta::FindParam(int* pvalue,int paramenum){{{*/
+ void Penta::FindParam(int* pvalue,int paramenum){
+ 	this->parameters->FindParam(pvalue,paramenum);
+@@ -3780,7 +3790,7 @@
+ 		GetBConduct(&B_conduct[0][0],&xyz_list[0][0],gauss); 
+ 		GetInputListOnVertices(&enthalpy[0],EnthalpyPicardEnum);
+ 		GetInputListOnVertices(&pressure[0],PressureEnum);
+-		kappa=matpar->GetEnthalpyDiffusionParameterVolume(enthalpy,pressure); _assert_(kappa>0.);
++		kappa=matpar->GetEnthalpyDiffusionParameterVolume(NUMVERTICES,enthalpy,pressure); _assert_(kappa>0.);
+ 
+ 		D_scalar_conduct=gauss->weight*Jdet*kappa/rho_ice;
+ 		if(reCast<bool,IssmDouble>(dt)) D_scalar_conduct=D_scalar_conduct*dt;
+@@ -4249,7 +4259,7 @@
+ 			vz_input->GetInputValue(&w, gauss);
+ 			GetInputListOnVertices(&enthalpypicard[0],EnthalpyPicardEnum);
+ 			GetInputListOnVertices(&pressure_p[0],PressureEnum);
+-			kappa=matpar->GetEnthalpyDiffusionParameterVolume(enthalpypicard,pressure_p);
++			kappa=matpar->GetEnthalpyDiffusionParameterVolume(NUMVERTICES,enthalpypicard,pressure_p);
+ 			kappa/=rho_ice;
+ 			tau_parameter=StabilizationParameter(u,v,w,diameter,kappa); 
+ 
+@@ -4807,7 +4817,7 @@
+ 			if(istemperatelayer) for(i=0;i<3;i++) vec_heatflux[i]=0.; // TODO: add -k*nabla T_pmp
+ 			else{
+ 				enthalpy_input->GetInputDerivativeValue(&d1enthalpy[0],&xyz_list[0][0],gauss);
+-				kappa=matpar->GetEnthalpyDiffusionParameterVolume(enthalpy, pressure); _assert_(kappa>0.);
++				kappa=matpar->GetEnthalpyDiffusionParameterVolume(NUMVERTICES,&enthalpy[0],&pressure[0]); _assert_(kappa>0.);
+ 				for(i=0;i<3;i++) vec_heatflux[i]=-kappa*d1enthalpy[i];
+ 			}
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16811)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16812)
+@@ -203,6 +203,8 @@
+ 		ElementVector* CreatePVectorFreeSurfaceTop(void);
+ 		ElementVector* CreatePVectorFreeSurfaceBase(void);
+ 		ElementVector* CreatePVectorL2ProjectionBase(void);
++		IssmDouble     EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure);
++		IssmDouble     EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure);
+ 		void           GetAreaCoordinates(IssmDouble *area_coordinates,IssmDouble xyz_zero[3][3],IssmDouble xyz_list[6][3],int numpoints);
+ 
+ 		void	         GetVertexPidList(int* doflist);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16811)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16812)
+@@ -83,6 +83,8 @@
+ 		void        CreateJacobianMatrix(Matrix<IssmDouble>* Jff){_error_("not implemented yet");};
+ 		void        Delta18oParameterization(void){_error_("not implemented yet");};
+ 		void        EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented yet");};
++		IssmDouble  EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented");};
++		IssmDouble  EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure){_error_("not implemented");};
+ 		void        FindParam(int* pvalue,int paramenum);
+ 		void        FindParam(IssmDouble* pvalue,int paramenum);
+ 		int         FiniteElement(void);
Index: issm/oecreview/Archive/16554-17801/ISSM-16812-16813.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16812-16813.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16812-16813.diff	(revision 17802)
@@ -0,0 +1,90 @@
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16812)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16813)
+@@ -292,7 +292,7 @@
+ }/*}}}*/
+ ElementVector* EnthalpyAnalysis::CreatePVectorShelf(Element* element){/*{{{*/
+ 
+-	IssmDouble  t_pmp,dt,Jdet,scalar_ocean,pressure;
++	IssmDouble  h_pmp,dt,Jdet,scalar_ocean,pressure;
+ 	IssmDouble *xyz_list_base = NULL;
+ 
+ 	/*Get basal element*/
+@@ -325,9 +325,9 @@
+ 		element->NodalFunctions(basis,gauss);
+ 
+ 		pressure_input->GetInputValue(&pressure,gauss);
+-		t_pmp=element->TMeltingPoint(pressure);
++		h_pmp=element->PureIceEnthalpy(pressure);
+ 
+-		scalar_ocean=gauss->weight*Jdet*rho_water*mixed_layer_capacity*thermal_exchange_vel*(t_pmp)/(heatcapacity*rho_ice);
++		scalar_ocean=gauss->weight*Jdet*rho_water*mixed_layer_capacity*thermal_exchange_vel*h_pmp/(heatcapacity*rho_ice);
+ 		if(reCast<bool,IssmDouble>(dt)) scalar_ocean=dt*scalar_ocean;
+ 
+ 		for(int i=0;i<numnodes;i++) pe->values[i]+=scalar_ocean*basis[i];
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16812)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16813)
+@@ -60,6 +60,7 @@
+ 		virtual void   NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss)=0;
+ 		virtual void   NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss)=0;
+ 		virtual void   NormalBase(IssmDouble* normal,IssmDouble* xyz_list)=0;
++		virtual IssmDouble PureIceEnthalpy(IssmDouble pressure)=0;
+ 		virtual void   TransformLoadVectorCoord(ElementVector* pe,int transformenum)=0;
+ 		virtual void   TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list)=0;
+ 		virtual void   TransformLoadVectorCoord(ElementVector* pe,int numnodes,int transformenum)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16812)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16813)
+@@ -125,6 +125,7 @@
+ 	   Element*    SpawnBasalElement(void);
+ 		IssmDouble  TMeltingPoint(IssmDouble pressure);
+ 		int         VelocityInterpolation();
++		IssmDouble  PureIceEnthalpy(IssmDouble pressure){_error_("not implemented yet");};
+ 		int         PressureInterpolation();
+ 		IssmDouble  SurfaceArea(void);
+ 		void        Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16812)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16813)
+@@ -2641,6 +2641,12 @@
+ 	delete gauss;
+ }
+ /*}}}*/
++/*FUNCTION Penta::PureIceEnthalpy{{{*/
++IssmDouble Penta::PureIceEnthalpy(IssmDouble pressure){
++
++	return this->matpar->PureIceEnthalpy(pressure);
++}
++/*}}}*/
+ /*FUNCTION Penta::ReduceMatrices{{{*/
+ void Penta::ReduceMatrices(ElementMatrix* Ke,ElementVector* pe){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16812)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16813)
+@@ -108,6 +108,7 @@
+ 		int    NumberofNodesVelocity(void);
+ 		int    NumberofNodesPressure(void);
+ 		int    VelocityInterpolation();
++		IssmDouble PureIceEnthalpy(IssmDouble pressure);
+ 		int    PressureInterpolation();
+ 
+ 		void   ResultInterpolation(int* pinterpolation,int output_enum);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16812)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16813)
+@@ -122,6 +122,7 @@
+ 		int         NumberofNodesPressure(void){_error_("not implemented yet");};
+ 	   Element*    SpawnBasalElement(void){_error_("not implemented yet");};
+ 		IssmDouble  StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa){_error_("not implemented yet");};
++		IssmDouble  PureIceEnthalpy(IssmDouble pressure){_error_("not implemented yet");};
+ 		int         PressureInterpolation(void){_error_("not implemented yet");};
+ 		int         VelocityInterpolation(void){_error_("not implemented yet");};
+ 		Input*      GetInput(int inputenum){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16813-16814.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16813-16814.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16813-16814.diff	(revision 17802)
@@ -0,0 +1,106 @@
+Index: ../trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim
+===================================================================
+--- ../trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim	(revision 16813)
++++ ../trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim	(revision 16814)
+@@ -437,6 +437,7 @@
+ syn keyword cType FemModel
+ syn keyword cType FileParam
+ syn keyword cType Friction
++syn keyword cType Gauss
+ syn keyword cType GaussPenta
+ syn keyword cType GaussSeg
+ syn keyword cType GaussTria
+@@ -462,6 +463,7 @@
+ syn keyword cType Matice
+ syn keyword cType Matpar
+ syn keyword cType MatrixParam
++syn keyword cType Misfit
+ syn keyword cType Node
+ syn keyword cType Nodes
+ syn keyword cType Numericalflux
+@@ -525,6 +527,7 @@
+ syn keyword cType HydrologyDCInefficientAnalysis
+ syn keyword cType HydrologyShreveAnalysis
+ syn keyword cType L2ProjectionBaseAnalysis
++syn keyword cType L2ProjectionEPLAnalysis
+ syn keyword cType MasstransportAnalysis
+ syn keyword cType MeltingAnalysis
+ syn keyword cType MeshdeformationAnalysis
+@@ -627,6 +630,8 @@
+ syn keyword cConstant SedimentHeadResidualEnum
+ syn keyword cConstant EplHeadEnum
+ syn keyword cConstant EplHeadOldEnum
++syn keyword cConstant EplHeadSlopeXEnum
++syn keyword cConstant EplHeadSlopeYEnum
+ syn keyword cConstant HydrologydcRelTolEnum
+ syn keyword cConstant HydrologydcSpcsedimentHeadEnum
+ syn keyword cConstant HydrologydcSedimentCompressibilityEnum
+@@ -638,14 +643,17 @@
+ syn keyword cConstant HydrologydcMaskEplactiveEnum
+ syn keyword cConstant HydrologydcEplCompressibilityEnum
+ syn keyword cConstant HydrologydcEplPorosityEnum
++syn keyword cConstant HydrologydcEplInitialThicknessEnum
+ syn keyword cConstant HydrologydcEplThicknessEnum
+-syn keyword cConstant HydrologydcEplTransmitivityEnum
++syn keyword cConstant HydrologydcEplThicknessOldEnum
++syn keyword cConstant HydrologydcEplConductivityEnum
+ syn keyword cConstant HydrologydcIsefficientlayerEnum
+ syn keyword cConstant HydrologydcSedimentlimitFlagEnum
+ syn keyword cConstant HydrologydcSedimentlimitEnum
+ syn keyword cConstant HydrologydcTransferFlagEnum
+ syn keyword cConstant HydrologydcLeakageFactorEnum
+ syn keyword cConstant HydrologydcPenaltyFactorEnum
++syn keyword cConstant HydrologydcPenaltyLockEnum
+ syn keyword cConstant HydrologyLayerEnum
+ syn keyword cConstant HydrologySedimentEnum
+ syn keyword cConstant HydrologyEfficientEnum
+@@ -705,6 +713,7 @@
+ syn keyword cConstant MaterialsMuWaterEnum
+ syn keyword cConstant MaterialsThermalExchangeVelocityEnum
+ syn keyword cConstant MaterialsThermalconductivityEnum
++syn keyword cConstant MaterialsTemperateiceconductivityEnum
+ syn keyword cConstant MaterialsLithosphereShearModulusEnum
+ syn keyword cConstant MaterialsLithosphereDensityEnum
+ syn keyword cConstant MaterialsMantleShearModulusEnum
+@@ -822,6 +831,7 @@
+ syn keyword cConstant BalancethicknessSoftSolutionEnum
+ syn keyword cConstant BalancevelocityAnalysisEnum
+ syn keyword cConstant BalancevelocitySolutionEnum
++syn keyword cConstant L2ProjectionEPLAnalysisEnum
+ syn keyword cConstant L2ProjectionBaseAnalysisEnum
+ syn keyword cConstant BedSlopeSolutionEnum
+ syn keyword cConstant DamageEvolutionSolutionEnum
+@@ -842,6 +852,7 @@
+ syn keyword cConstant MasstransportSolutionEnum
+ syn keyword cConstant FreeSurfaceBaseAnalysisEnum
+ syn keyword cConstant FreeSurfaceTopAnalysisEnum
++syn keyword cConstant SurfaceNormalVelocityEnum
+ syn keyword cConstant ExtrudeFromBaseAnalysisEnum
+ syn keyword cConstant ExtrudeFromTopAnalysisEnum
+ syn keyword cConstant SteadystateSolutionEnum
+@@ -1050,6 +1061,15 @@
+ syn keyword cConstant MassfluxatgateEnum
+ syn keyword cConstant MassfluxatgateNameEnum
+ syn keyword cConstant MassfluxatgateSegmentsEnum
++syn keyword cConstant MisfitNameEnum
++syn keyword cConstant MisfitModelEnumEnum
++syn keyword cConstant MisfitObservationEnum
++syn keyword cConstant MisfitObservationEnumEnum
++syn keyword cConstant MisfitTimeinterpolationEnum
++syn keyword cConstant MisfitWeightsEnum
++syn keyword cConstant MisfitWeightsEnumEnum
++syn keyword cConstant SurfaceObservationEnum
++syn keyword cConstant WeightsSurfaceObservationEnum
+ syn keyword cConstant MinVelEnum
+ syn keyword cConstant MaxVelEnum
+ syn keyword cConstant MinVxEnum
+@@ -1073,6 +1093,9 @@
+ syn keyword cConstant SubelementMigration2Enum
+ syn keyword cConstant MaskGroundediceLevelsetEnum
+ syn keyword cConstant QmuMaskGroundediceLevelsetEnum
++syn keyword cConstant GaussSegEnum
++syn keyword cConstant GaussTriaEnum
++syn keyword cConstant GaussPentaEnum
+ syn keyword cConstant FSSolverEnum
+ syn keyword cConstant AdjointEnum
+ syn keyword cConstant ColinearEnum
Index: issm/oecreview/Archive/16554-17801/ISSM-16814-16815.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16814-16815.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16814-16815.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/src/m/classes/independent.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/independent.py	(revision 16814)
++++ ../trunk-jpl/src/m/classes/independent.py	(revision 16815)
+@@ -57,7 +57,7 @@
+ 				raise TypeError("cannot declare an independent with fov_forward_indices when the driver is not fov_forward!")
+ 			if self.nods==0:
+ 				raise TypeError("independent checkconsistency error: nods should be set to the size of the independent variable")
+-			md = checkfield(md,"autodiff.independents[%d].fov_forward_indices" % i,'>=',1,'<=',self.nods,'size',[float('NaN'),1])
++			md = checkfield(md,'fieldname',"autodiff.independents[%d].fov_forward_indices" % i,'>=',1,'<=',self.nods,'size',[float('NaN'),1])
+ 
+ 		return md
+ 	# }}}
+Index: ../trunk-jpl/src/m/classes/independent.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/independent.m	(revision 16814)
++++ ../trunk-jpl/src/m/classes/independent.m	(revision 16815)
+@@ -43,7 +43,7 @@
+ 				if obj.nods==0,
+ 					error('independent checkconsistency error: nods should be set to the size of the independent variable');
+ 				end
+-				md = checkfield(md,['autodiff.independents{' num2str(i) '}.fov_forward_indices'],'>=',1,'<=',obj.nods,'size',[NaN 1]);
++				md = checkfield(md,'fieldname',['autodiff.independents{' num2str(i) '}.fov_forward_indices'],'>=',1,'<=',obj.nods,'size',[NaN 1]);
+ 			end
+ 
+ 		end % }}}
Index: issm/oecreview/Archive/16554-17801/ISSM-16815-16816.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16815-16816.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16815-16816.diff	(revision 17802)
@@ -0,0 +1,401 @@
+Index: ../trunk-jpl/test/Archives/Archive327.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive432.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive325.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive121.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive326.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive122.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive431.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/c/shared/Elements/LliboutryDuval.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Elements/LliboutryDuval.cpp	(revision 16815)
++++ ../trunk-jpl/src/c/shared/Elements/LliboutryDuval.cpp	(revision 16816)
+@@ -35,10 +35,10 @@
+    *  Convert A to B :  B = A^(-1/n) */
+ 
+ 	/*check feasibility*/
+-  _assert_(pressure>0);
++  _assert_(pressure>=0);
+   _assert_(n>0);
+-  _assert_(betaCC>0);
+-  _assert_(referencetemperature>0);
++  _assert_(betaCC>=0);
++  _assert_(referencetemperature>=0);
+   _assert_(heatcapacity>0);
+   _assert_(latentheat>0);
+ 
+@@ -57,6 +57,8 @@
+   else{
+     Tstar=Tpmp;
+     waterfraction=(enthalpy - H_sp)/latentheat;
++		if (waterfraction > 0.01)
++			waterfraction = 0.01;
+   }
+ 
+   /*Get A*/
+@@ -74,38 +76,3 @@
+ 
+   return B;
+ }
+-
+-// /*Get stiffness from temperature, waterfraction and depth*/
+-// IssmDouble LliboutryDuval(IssmDouble temperature, IssmDouble waterfraction, IssmDouble depth,IssmDouble n){
+-// 	/*Use parameterization for the rheology: Greve and Blatter 2009
+-// 	 * get enthalpy from temperature and water fraction,
+-// 	 * and use LliboutryDuval(IssmDouble enthalpy, IssmDouble pressure,IssmDouble n) */
+-// 
+-// 	/*TODO: update params from model*/
+-//   IssmDouble rho_ice=910; // kg/m^3
+-//   IssmDouble g=9.81; //kg*m/s^2
+-//   IssmDouble heatcapacity=2009; // J/kg/K
+-//   IssmDouble referencetemperature=253.15;
+-//   IssmDouble betaCC=7.9*pow(10.,-8.);
+-//   IssmDouble latentheat=3.34*pow(10,5.); // from Aschwanden 2012
+-// 
+-//   IssmDouble Tstar, enthalpy, pressure, B;
+-//   _assert_(temperature>0);
+-//   _assert_(waterfraction>0);
+-//   _assert_(depth>0);
+-// 
+-//   /*get pressure*/
+-//   pressure= rho_ice*g*depth;
+-//   Tstar=temperature-betaCC*pressure; // TODO: check whether plus or minus
+-//   /*get enthalpy*/
+-//   if (Tstar < 273.15){
+-//     enthalpy=heatcapacity*(Tstar - referencetemperature);
+-//   }
+-//   else{
+-//     enthalpy=heatcapacity*(273.15 - referencetemperature) + waterfraction*latentheat;
+-//   }
+-// 
+-//   B=LliboutryDuval(enthalpy, pressure, n, betaCC, referencetemperature, heatcapacity, latentheat);
+-// 
+-//   return B;
+-// }
+Index: ../trunk-jpl/src/c/shared/Elements/DrainageFunctionWaterfraction.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Elements/DrainageFunctionWaterfraction.cpp	(revision 16815)
++++ ../trunk-jpl/src/c/shared/Elements/DrainageFunctionWaterfraction.cpp	(revision 16816)
+@@ -13,33 +13,33 @@
+ 	_assert_(dt>=0.);
+ 
+ 	IssmDouble w0=0.01, w1=0.02, w2=0.03;
+-	IssmDouble Dret, D0=0, D1=0.005, D2=0.05;
+-	IssmDouble yts=365*24*60*60;
+-	dt/=yts;
++	IssmDouble yts=365.*24.*60.*60.;
++	IssmDouble Dret, D0=0., D1=0.005/yts, D2=0.05/yts;
+ 
+ 	/*get drainage function value*/
+ 	if((w0==w1)||(w1==w2)||(w0==w2))
+ 		_error_("Error: equal ordinates in DrainageFunctionWaterfraction -> division by zero. Abort");
++	
+ 	if(waterfraction<=w0)
+ 		Dret=D0;
+-	if((waterfraction>w0) && (waterfraction<=w1))
++	else if((waterfraction>w0) && (waterfraction<=w1))
+ 		Dret=(D1-D0)/(w1-w0)*(waterfraction-w0)+D0;
+-	if((waterfraction>w1) && (waterfraction<=w2))
++	else if((waterfraction>w1) && (waterfraction<=w2))
+ 		Dret=(D2-D1)/(w2-w1)*(waterfraction-w1)+D1;
+ 	else 
+ 		Dret=D2;
+ 
+-	/*check if dt*Dret>waterfraction. If so, drain whole waterfraction*/
++	/*drain only up to w0*/
+ 	if(dt==0.){
+-		if(Dret>waterfraction)
+-			return waterfraction;
++		if((waterfraction>w0) && (waterfraction-Dret*yts<w0))
++			return waterfraction-w0;
+ 		else
+-			return Dret;
++			return Dret*yts;
+ 	}
+ 	else{
+-		if(dt*Dret>waterfraction)
+-			return waterfraction;
++		if((waterfraction>w0) && (waterfraction-dt*Dret<w0))
++			return (waterfraction-w0)/dt;
+ 		else
+-			return dt*Dret;
++			return Dret;
+ 	}
+ }
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16815)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16816)
+@@ -191,7 +191,7 @@
+ 		#ifdef _HAVE_THERMAL_
+ 		virtual void UpdateBasalConstraintsEnthalpy(void)=0;
+ 		virtual void ComputeBasalMeltingrate(void)=0;
+-		virtual void DrainWaterfraction(void)=0;
++		virtual void DrainWaterfraction(IssmDouble* drainrate_element)=0;
+ 		#endif
+ 
+ 		#ifdef _HAVE_HYDROLOGY_
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16815)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16816)
+@@ -326,7 +326,7 @@
+ 		#ifdef _HAVE_THERMAL_
+ 		void UpdateBasalConstraintsEnthalpy(void){_error_("not implemented yet");};
+ 		void ComputeBasalMeltingrate(void){_error_("not implemented yet");};
+-		void DrainWaterfraction(void){_error_("not implemented yet");};
++		void DrainWaterfraction(IssmDouble* drainrate_element){_error_("not implemented yet");};
+ 		#endif
+ 
+ 		#ifdef _HAVE_HYDROLOGY_
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16815)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16816)
+@@ -4749,7 +4749,7 @@
+ 
+ 	/* Intermediaries */
+ 	bool        isenthalpy, checkpositivethickness, istemperatelayer;
+-	int         i,j,analysis_type;
++	int         i,j,iv,analysis_type;
+ 	IssmDouble  xyz_list[NUMVERTICES][3];
+ 	IssmDouble  xyz_list_tria[NUMVERTICES2D][3];
+ 	IssmDouble  heatflux,kappa;
+@@ -4763,9 +4763,11 @@
+ 	IssmDouble  vx[NUMVERTICES],vy[NUMVERTICES],vz[NUMVERTICES];
+ 	IssmDouble  geothermalflux[NUMVERTICES];
+ 	IssmDouble  dt, yts;
+-	IssmDouble  melting_overshoot,meltingrate_enthalpy;
+-	IssmDouble  lambda,heating;
++	IssmDouble  melting_overshoot,meltingrate_enthalpy[NUMVERTICES2D];
++	IssmDouble  drainrate_element[NUMVERTICES2D],drainrate_column[NUMVERTICES2D];
++	IssmDouble  lambda,heating[NUMVERTICES2D];
+ 	Friction   *friction  = NULL;
++	Penta      *penta = NULL;
+ 
+ 	/* Only compute melt rates at the base of grounded ice*/
+ 	if(!IsOnBed() || IsFloating()) return;
+@@ -4794,9 +4796,9 @@
+ 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+ 	friction=new Friction("3d",inputs,matpar,analysis_type);
+ 
+-	/*Ok, get meltingrates now from basal conditions*/
++	/******** MELTING RATES  ************************************/
+ 	GaussPenta* gauss=new GaussPenta();
+-	for(int iv=0;iv<3;iv++){
++	for(iv=0;iv<NUMVERTICES2D;iv++){
+ 
+ 		gauss->GaussVertex(iv);
+ 		checkpositivethickness=true;
+@@ -4804,8 +4806,8 @@
+ 		_assert_(watercolumn[iv]>=0.);
+ 
+ 		/*Calculate basal meltingrate after Fig.5 of A.Aschwanden 2012*/
+-		meltingrate_enthalpy=0.;
+-		heating=0.;
++		meltingrate_enthalpy[iv]=0.;
++		heating[iv]=0.;
+ 		if((watercolumn[iv]>0.) && (enthalpy[iv]<matpar->PureIceEnthalpy(pressure[iv]))){
+ 			/*ensure that no ice is at T<Tm(p), if water layer present*/
+ 			enthalpy[iv]=matpar->PureIceEnthalpy(pressure[iv]); 
+@@ -4819,7 +4821,7 @@
+ 		if(checkpositivethickness){
+ 			/*ok, from here on all basal ice is temperate. Check for positive thickness of layer of temperate ice. */
+ 			istemperatelayer=false;
+-			if(enthalpy[iv+3]>=matpar->PureIceEnthalpy(pressure[iv+3])) istemperatelayer=true;
++			if(enthalpy[iv+NUMVERTICES2D]>=matpar->PureIceEnthalpy(pressure[iv+NUMVERTICES2D])) istemperatelayer=true;
+ 			if(istemperatelayer) for(i=0;i<3;i++) vec_heatflux[i]=0.; // TODO: add -k*nabla T_pmp
+ 			else{
+ 				enthalpy_input->GetInputDerivativeValue(&d1enthalpy[0],&xyz_list[0][0],gauss);
+@@ -4838,31 +4840,55 @@
+ 
+ 			matpar->EnthalpyToThermal(&temperature, &waterfraction, enthalpy[iv],pressure[iv]);
+ 			// -Mb= Fb-(q-q_geo)/((1-w)*L), cf Aschwanden 2012, eq.66
+-			heating=(heatflux+basalfriction+geothermalflux[iv]);
+-			meltingrate_enthalpy=heating/((1-waterfraction)*latentheat*rho_ice); // m/s water equivalent 
+-		}
++			heating[iv]=(heatflux+basalfriction+geothermalflux[iv]);
++			meltingrate_enthalpy[iv]=heating[iv]/((1-waterfraction)*latentheat*rho_ice); // m/s water equivalent 
++		}		
++	}
++	// enthalpy might have been changed, update
++	this->inputs->AddInput(new PentaInput(EnthalpyEnum,enthalpy,P1Enum));
+ 
+-		/*Update water column, basal meltingrate*/
+-		this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
++	/******** DRAINAGE *****************************************/
++	for(iv=0; iv<NUMVERTICES2D; iv++)	
++		drainrate_column[iv]=0.;
++	penta=this;
++
++	for(;;){
++		for(iv=0; iv<NUMVERTICES2D; iv++)	drainrate_element[iv]=0.;
++		penta->DrainWaterfraction(&drainrate_element[0]); // TODO: make sure every vertex is only drained once
++		for(iv=0; iv<NUMVERTICES2D; iv++)	drainrate_column[iv]+=drainrate_element[iv];
++
++		if(penta->IsOnSurface()) break;
++		penta=penta->GetUpperElement();			
++	}
++	// add drained water to melting rate
++	for(iv=0; iv<NUMVERTICES2D;iv++)
++		meltingrate_enthalpy[iv]+=drainrate_column[iv];
++
++	/******** UPDATE MELTINGRATES AND WATERCOLUMN **************/
++	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
++	for(iv=0;iv<NUMVERTICES2D;iv++){
+ 		if(reCast<bool,IssmDouble>(dt)){
+-			if(watercolumn[iv]+meltingrate_enthalpy*dt<0.){				
+-				melting_overshoot=watercolumn[iv]+meltingrate_enthalpy*dt;
+-				lambda=melting_overshoot/(meltingrate_enthalpy*dt); _assert_(lambda>0); _assert_(lambda<1);
+-				basalmeltingrate[iv]=(1.-lambda)*meltingrate_enthalpy;
++			if(watercolumn[iv]+meltingrate_enthalpy[iv]*dt<0.){				
++				melting_overshoot=watercolumn[iv]+meltingrate_enthalpy[iv]*dt;
++				lambda=melting_overshoot/(meltingrate_enthalpy[iv]*dt); _assert_(lambda>0); _assert_(lambda<1);
++				basalmeltingrate[iv]=(1.-lambda)*meltingrate_enthalpy[iv];
+ 				watercolumn[iv]=0.;
+ 				yts=365*24*60*60;
+-				enthalpy[iv]+=dt/yts*lambda*heating;
++				enthalpy[iv]+=dt/yts*lambda*heating[iv];
+ 			}
+ 			else{
+-				basalmeltingrate[iv]=meltingrate_enthalpy;
+-				watercolumn[iv]+=dt*meltingrate_enthalpy; 
++				basalmeltingrate[iv]=meltingrate_enthalpy[iv];
++				watercolumn[iv]+=dt*meltingrate_enthalpy[iv]; 
+ 			}
+ 		}
+ 		else{
+-			basalmeltingrate[iv]=meltingrate_enthalpy;
+-			watercolumn[iv]+=meltingrate_enthalpy;
++			basalmeltingrate[iv]=meltingrate_enthalpy[iv];
++			watercolumn[iv]+=meltingrate_enthalpy[iv];
+ 		}	  
+-	}  
++		
++		_assert_(watercolumn[iv]>=0.);
++	}
++
+ 	/*feed updated variables back into model*/
+ 	this->inputs->AddInput(new PentaInput(EnthalpyEnum,enthalpy,P1Enum));
+ 	this->inputs->AddInput(new PentaInput(WatercolumnEnum,watercolumn,P1Enum));
+@@ -4874,47 +4900,52 @@
+ }
+ /*}}}*/
+ /*FUNCTION Penta::DrainWaterfraction{{{*/
+-void Penta::DrainWaterfraction(void){
++void Penta::DrainWaterfraction(IssmDouble* drainrate_element){
+ 
+     /*Intermediaries*/
+ 	bool isenthalpy;
++	int iv, index0;
+ 	IssmDouble waterfraction[NUMVERTICES], temperature[NUMVERTICES];
+-	IssmDouble watercolumnbase[NUMVERTICES];
++	IssmDouble dw[NUMVERTICES];
+ 	IssmDouble enthalpy[NUMVERTICES], pressure[NUMVERTICES]; 
+-	IssmDouble latentheat, dt;
+-	IssmDouble dw, dwc;
+-	Penta *pentabase = NULL;
++	IssmDouble dt, height_element;
++	IssmDouble xyz_list[NUMVERTICES][3];
++	IssmDouble rho_water, rho_ice;
+ 
+ 	/*Check wether enthalpy is activated*/
+ 	parameters->FindParam(&isenthalpy,ThermalIsenthalpyEnum);
+ 	if(!isenthalpy) return;       
+ 	
+-	/*get basal element, needed for basal watercolumn*/
+-	pentabase=(Penta*)this->GetBasalElement();
+-	
++	rho_ice=matpar->GetRhoIce();
++	rho_water=matpar->GetRhoFreshwater();
++
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->GetInputListOnVertices(&enthalpy[0],EnthalpyEnum);
+ 	this->GetInputListOnVertices(&pressure[0],PressureEnum);
+-	pentabase->GetInputListOnVertices(&watercolumnbase[0], WatercolumnEnum);
+ 
+ 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	latentheat=matpar->GetLatentHeat();
+-
+-	for(int iv=0;iv<NUMVERTICES;iv++){ 
++	for(iv=0;iv<NUMVERTICES;iv++){ 
+ 		matpar->EnthalpyToThermal(&temperature[iv],&waterfraction[iv], enthalpy[iv],pressure[iv]); 
+-		dw=DrainageFunctionWaterfraction(waterfraction[iv], dt);
+-		/*drain water fraction & update enthalpy*/
+-		waterfraction[iv]-=dw;
+-		matpar->ThermalToEnthalpy(&enthalpy[iv], temperature[iv], waterfraction[iv], pressure[iv]);        
+-		/*add drained water to watercolumn at base*/
+-		dwc=dw*this->IceVolume();
+-		watercolumnbase[iv%NUMVERTICES2D]+=dwc;
++		dw[iv]=DrainageFunctionWaterfraction(waterfraction[iv], dt);
+ 	}
+-
+-	/*feed updated results back into model*/
++	
++	/*drain waterfraction, feed updated variables back into model*/
++	for(iv=0;iv<NUMVERTICES;iv++){
++		if(reCast<bool,IssmDouble>(dt))
++			waterfraction[iv]-=dw[iv]*dt;
++		else
++			waterfraction[iv]-=dw[iv];
++		matpar->ThermalToEnthalpy(&enthalpy[iv], temperature[iv], waterfraction[iv], pressure[iv]);
++	}
+ 	this->inputs->AddInput(new PentaInput(EnthalpyEnum,enthalpy,P1Enum));
+ 	this->inputs->AddInput(new PentaInput(WaterfractionEnum,waterfraction,P1Enum));
+-	pentabase->inputs->AddInput(new PentaInput(WatercolumnEnum, watercolumnbase,P1Enum));
+ 
++	/*return meltwater column equivalent to drained water*/
++	for(iv=0;iv<NUMVERTICES2D;iv++){
++		index0=(iv+NUMVERTICES2D);
++		height_element=fabs(xyz_list[index0][2]-xyz_list[iv][2]);
++		drainrate_element[iv]=(dw[iv]+dw[index0])/2.*rho_water/rho_ice*height_element;
++	}
+ }
+ /*}}}*/
+ #endif
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16815)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16816)
+@@ -377,7 +377,7 @@
+ 		ElementVector* CreatePVectorThermalSheet(void);
+ 		void           UpdateBasalConstraintsEnthalpy(void);
+ 		void           ComputeBasalMeltingrate(void);
+-		void           DrainWaterfraction(void);
++		void           DrainWaterfraction(IssmDouble* drainrate_element);
+ 		#endif
+ 
+ 		#ifdef _HAVE_BALANCED_
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16815)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16816)
+@@ -141,7 +141,7 @@
+ 		#ifdef _HAVE_THERMAL_
+ 		void UpdateBasalConstraintsEnthalpy(void){_error_("not implemented yet");};
+ 		void ComputeBasalMeltingrate(void){_error_("not implemented yet");};
+-		void DrainWaterfraction(void){_error_("not implemented yet");};
++		void DrainWaterfraction(IssmDouble* drainrate_element){_error_("not implemented yet");};
+ 		#endif
+ 		#ifdef _HAVE_HYDROLOGY_
+ 		void    GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16816-16817.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16816-16817.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16816-16817.diff	(revision 17802)
@@ -0,0 +1,181 @@
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16816)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16817)
+@@ -138,8 +138,10 @@
+ 				femmodel->parameters->SetParam(EplHeadSlopeYEnum,InputToL2ProjectEnum);
+ 				solutionsequence_linear(femmodel);
+ 
++				femmodel->HydrologyEPLThicknessx();
++
+ 				femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
+-				femmodel->HydrologyEPLThicknessx();
++				//				femmodel->HydrologyEPLThicknessx();
+ 				//updating mask after the computation of the epl thickness (Allow to close too thin EPL)
+ 				femmodel->HydrologyEPLupdateDomainx();
+ 
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 16816)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 16817)
+@@ -1460,11 +1460,6 @@
+ 
+ 	/*Update dof indexings*/
+ 	this->UpdateConstraintsx();
+-
+-	/* for(int i=0;i<elements->Size();i++){ */
+-	/* 	Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i)); */
+-	/* 	element->UpdateConstraintsL2ProjectionEPL(); */
+-	/* } */
+-
+ }
+-/*}}}*/#endif
++/*}}}*/
++#endif
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16816)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16817)
+@@ -201,7 +201,6 @@
+ 		virtual void HydrologyEPLGetMask(Vector<IssmDouble>* mask)=0;
+ 		virtual void HydrologyEPLGetActive(Vector<IssmDouble>* active)=0;
+ 		virtual void ComputeEPLThickness(void)=0;
+-		virtual void UpdateConstraintsL2ProjectionEPL(void)=0;
+ 		#endif
+ 
+ 		#ifdef _HAVE_GROUNDINGLINE_
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16816)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16817)
+@@ -2883,22 +2883,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::UpdateConstraintsL2ProjectionEPL{{{*/
+-void  Tria::UpdateConstraintsL2ProjectionEPL(void){
+ 
+-	IssmDouble activeEpl[NUMVERTICES];
+- 
+-	GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveEnum);
+-	for(int i=0;i<NUMVERTICES;i++){
+-		if(!reCast<bool>(activeEpl[i])){
+-			this->nodes[i]->Deactivate();
+-		}
+-		else{
+-			this->nodes[i]->Activate();
+-		}
+-	}
+-}
+-/*}}}*/
+ #ifdef _HAVE_RESPONSES_
+ /*FUNCTION Tria::AverageOntoPartition {{{*/
+ void  Tria::AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part){
+@@ -7032,22 +7017,24 @@
+ 		GetInputListOnVertices(&ice_thickness[0],ThicknessEnum);
+ 		GetInputListOnVertices(&bed[0],BedEnum);
+ 		
+-		for(int i=0;i<numdof;i++){
++		if(!this->AnyActive()){
+ 			/*Keeping thickness to initial value if EPL is not active*/
+-			/* if(activeEpl[i]==0.0){ */
+-			/* 	thickness[i]=init_thick; */
+-			/* } */
+-			/* else{ */
+-				/*Compute first the effective pressure in the EPL*/
+-				EPL_N=gravity*((rho_ice*ice_thickness[i])-(rho_water*(eplhead[i]-bed[i])));
+-				if(EPL_N<0.0)EPL_N=0.0;
+-				/*Get then the gradient of EPL heads*/
+-				EPLgrad = epl_slopeX[i]+epl_slopeY[i];
+-				
+-				/*And proceed to the real thing*/
+-				thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*pow(EPLgrad,2.0)-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
+-				//}
++			for(int i=0;i<numdof;i++){ 
++				thickness[i]=init_thick;
++			}
+ 		}
++		else{
++			for(int i=0;i<numdof;i++){ 
++					/*Compute first the effective pressure in the EPL*/
++					EPL_N=gravity*((rho_ice*ice_thickness[i])-(rho_water*(eplhead[i]-bed[i])));
++					if(EPL_N<0.0)EPL_N=0.0;
++					/*Get then the gradient of EPL heads*/
++					EPLgrad = epl_slopeX[i]+epl_slopeY[i];
++					
++					/*And proceed to the real thing*/
++					thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*pow(EPLgrad,2.0)-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
++			}
++		}
+ 		this->inputs->AddInput(new TriaInput(HydrologydcEplThicknessEnum,thickness,P1Enum));
+ 	}
+ }
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16816)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16817)
+@@ -345,7 +345,6 @@
+ 		void           HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
+ 		void           HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask);
+ 		void           ComputeEPLThickness(void);
+-		void           UpdateConstraintsL2ProjectionEPL(void);
+ 		bool           AllActive(void);
+ 		bool           AnyActive(void);
+ 		#endif
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16816)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16817)
+@@ -9727,28 +9727,6 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Penta::UpdateConstraintsL2ProjectionEPL{{{*/
+-void  Penta::UpdateConstraintsL2ProjectionEPL(void){
+-
+-	IssmDouble activeEpl[NUMVERTICES];
+-
+-
+-	if(!IsOnBed()){
+-		for(int i=0;i<this->NumberofNodes();i++)this->nodes[i]->Deactivate();
+-	}
+-	else{
+-		GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveEnum);
+-		for(int i=0;i<3;i++){
+-			if(!reCast<bool>(activeEpl[i])){
+-				this->nodes[i]->Deactivate();
+-			}
+-			else{
+-				this->nodes[i]->Activate();
+-			}
+-		}
+-	}
+-}
+-/*}}}*/
+ #endif
+ 
+ #ifdef _HAVE_GROUNDINGLINE_
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16816)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16817)
+@@ -353,7 +353,6 @@
+ 		void           HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
+ 		void           HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask);
+ 		void           ComputeEPLThickness(void);
+-		void           UpdateConstraintsL2ProjectionEPL(void);
+ 		#endif
+ 
+ 		void           UpdateConstraintsExtrudeFromBase(void){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16816)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16817)
+@@ -179,7 +179,6 @@
+ 		void        TransformSolutionCoord(IssmDouble* values,int numnodes,int* transformenum_list){_error_("not implemented yet");};
+ 		void UpdateConstraintsExtrudeFromBase(){_error_("not implemented");};
+ 		void UpdateConstraintsExtrudeFromTop(){_error_("not implemented");};
+-		void UpdateConstraintsL2ProjectionEPL(){_error_("not implemented");};
+ 
+ #ifdef _HAVE_RESPONSES_
+ 		void       AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16817-16818.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16817-16818.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16817-16818.diff	(revision 17802)
@@ -0,0 +1,2235 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16817)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16818)
+@@ -21,6 +21,9 @@
+ 
+ 		/*Finite element Analysis*/
+ 		ElementMatrix* CreateKMatrix(Element* element);
++		ElementMatrix* CreateKMatrixSSA(Element* element);
++		ElementMatrix* CreateKMatrixSSAViscous(Element* element);
++		ElementMatrix* CreateKMatrixSSAFriction(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+ 		ElementVector* CreatePVectorFS(Element* element);
+ 		ElementVector* CreatePVectorFSViscous(Element* element);
+@@ -32,6 +35,8 @@
+ 		ElementVector* CreatePVectorSSA(Element* element);
+ 		ElementVector* CreatePVectorSSADrivingStress(Element* element);
+ 		ElementVector* CreatePVectorSSAFront(Element* element);
++		void GetBSSA(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBSSAprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void GetSolutionFromInputsFS(Vector<IssmDouble>* solution,Element* element);
+ 		void GetSolutionFromInputsHoriz(Vector<IssmDouble>* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/Analysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/Analysis.h	(revision 16817)
++++ ../trunk-jpl/src/c/analyses/Analysis.h	(revision 16818)
+@@ -15,6 +15,7 @@
+ class Element;
+ class ElementVector;
+ class ElementMatrix;
++class Gauss;
+ 
+ class Analysis{
+ 
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16817)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16818)
+@@ -812,8 +812,111 @@
+ 
+ /*Finite Element Analysis*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrix(Element* element){/*{{{*/
+-	_error_("not implemented yet");
++	int approximation;
++	element->GetInputValue(&approximation,ApproximationEnum);
++	switch(approximation){
++		case SSAApproximationEnum: 
++			return CreateKMatrixSSA(element);
++		case NoneApproximationEnum:
++			return NULL;
++		default:
++			_error_("Approximation "<<EnumToStringx(approximation)<<" not supported");
++	}
+ }/*}}}*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSA(Element* element){/*{{{*/
++
++	/*Intermediaries*/
++	int      meshtype;
++	Element* basalelement;
++
++	/*Get basal element*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*compute all stiffness matrices for this element*/
++	ElementMatrix* Ke1=CreateKMatrixSSAViscous(element);
++	ElementMatrix* Ke2=CreateKMatrixSSAFriction(element);
++	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
++
++	/*clean-up and return*/
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	delete Ke1;
++	delete Ke2;
++	return Ke;
++}/*}}}*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSAViscous(Element* element){/*{{{*/
++
++	/*Intermediaries*/
++	IssmDouble  viscosity,newviscosity,oldviscosity;
++	IssmDouble  viscosity_overshoot,thickness,Jdet;
++	IssmDouble  D_scalar;
++	IssmDouble *xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++	int numdof   = numnodes*2;
++
++	/*Initialize Element matrix and vectors*/
++	ElementMatrix* Ke     = element->NewElementMatrix(SSAApproximationEnum);
++	IssmDouble*    B      = xNew<IssmDouble>(3*numdof);
++	IssmDouble*    Bprime = xNew<IssmDouble>(3*numdof);
++	IssmDouble*    D      = xNewZeroInit<IssmDouble>(3*3);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	Input* thickness_input=element->GetInput(ThicknessEnum); _assert_(thickness_input);
++	Input* vx_input=element->GetInput(VxEnum);               _assert_(vx_input);
++	Input* vy_input=element->GetInput(VyEnum);               _assert_(vy_input);
++	Input* vxold_input=element->GetInput(VxPicardEnum);      _assert_(vxold_input);
++	Input* vyold_input=element->GetInput(VyPicardEnum);      _assert_(vyold_input);
++	element->FindParam(&viscosity_overshoot,StressbalanceViscosityOvershootEnum);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss = element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		this->GetBSSA(B,element,xyz_list,gauss);
++		this->GetBSSAprime(Bprime,element,xyz_list,gauss);
++
++		element->ViscositySSA(&viscosity,xyz_list,gauss,vx_input,vy_input);
++		element->ViscositySSA(&oldviscosity,xyz_list,gauss,vxold_input,vyold_input);
++		thickness_input->GetInputValue(&thickness, gauss);
++
++		newviscosity=viscosity+viscosity_overshoot*(viscosity-oldviscosity);
++		D_scalar=2.*newviscosity*thickness*gauss->weight*Jdet;
++		for(int i=0;i<3;i++) D[i*3+i]=D_scalar;
++
++		TripleMultiply(B,3,numdof,1,
++					D,3,3,0,
++					Bprime,3,numdof,0,
++					&Ke->values[0],1);
++	}
++
++	/*Transform Coordinate System*/
++	element->TransformStiffnessMatrixCoord(Ke,XYEnum);
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(D);
++	xDelete<IssmDouble>(Bprime);
++	xDelete<IssmDouble>(B);
++	return Ke;
++}/*}}}*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSAFriction(Element* element){/*{{{*/
++	return NULL;
++}/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+ 	int approximation;
+@@ -1128,6 +1231,70 @@
+ 
+ 	return NULL;
+ }/*}}}*/
++void StressbalanceAnalysis::GetBSSA(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
++	 * For node i, Bi can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi=[ dN/dx           0    ]
++	 *          [   0           dN/dy  ]
++	 *          [ 1/2*dN/dy  1/2*dN/dx ]
++	 * where N is the finiteelement function for node i.
++	 *
++	 * We assume B has been allocated already, of size: 3x(NDOF2*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Build B: */
++	for(int i=0;i<numnodes;i++){
++		B[2*numnodes*0+2*i+0] = dbasis[0*numnodes+i];
++		B[2*numnodes*0+2*i+1] = 0.;
++		B[2*numnodes*1+2*i+0] = 0.;
++		B[2*numnodes*1+2*i+1] = dbasis[1*numnodes+i];
++		B[2*numnodes*2+2*i+0] = .5*dbasis[1*numnodes+i];
++		B[2*numnodes*2+2*i+1] = .5*dbasis[0*numnodes+i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(dbasis);
++}/*}}}*/
++void StressbalanceAnalysis::GetBSSAprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 
++	 * For node i, Bi' can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi_prime=[ 2*dN/dx    dN/dy ]
++	 *                [   dN/dx  2*dN/dy ]
++	 *                [   dN/dy    dN/dx ]
++	 * where hNis the finiteelement function for node i.
++	 *
++	 * We assume B' has been allocated already, of size: 3x(NDOF2*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Build B': */
++	for(int i=0;i<numnodes;i++){
++		Bprime[2*numnodes*0+2*i+0] = 2.*dbasis[0*numnodes+i];
++		Bprime[2*numnodes*0+2*i+1] =    dbasis[1*numnodes+i];
++		Bprime[2*numnodes*1+2*i+0] =    dbasis[0*numnodes+i];
++		Bprime[2*numnodes*1+2*i+1] = 2.*dbasis[1*numnodes+i];
++		Bprime[2*numnodes*2+2*i+0] =    dbasis[1*numnodes+i];
++		Bprime[2*numnodes*2+2*i+1] =    dbasis[0*numnodes+i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(dbasis);
++}/*}}}*/
+ void StressbalanceAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 
+ 	int approximation;
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16817)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16818)
+@@ -69,6 +69,10 @@
+ 		virtual void   TransformSolutionCoord(IssmDouble* values,int* transformenum_list)=0;
+ 		virtual void   TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum)=0;
+ 		virtual void   TransformSolutionCoord(IssmDouble* values,int numnodes,int* transformenum_list)=0;
++		virtual void   TransformStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum)=0;
++		virtual void   TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* transformenum_list)=0;
++		virtual void   TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int transformenum)=0;
++		virtual void   TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int* transformenum_list)=0;
+ 		virtual Element* GetBasalElement(void)=0;
+ 		virtual void	GetDofList(int** pdoflist,int approximation_enum,int setenum)=0;
+ 		virtual void	GetDofListVelocity(int** pdoflist,int setenum)=0;
+@@ -121,6 +125,7 @@
+ 		virtual Gauss* NewGauss(int order)=0;
+ 		virtual Gauss* NewGaussBase(int order)=0;
+ 		virtual ElementVector*  NewElementVector(int approximation_enum=NoneApproximationEnum)=0;
++		virtual ElementMatrix*  NewElementMatrix(int approximation_enum=NoneApproximationEnum)=0;
+ 		virtual void   InputScale(int enum_type,IssmDouble scale_factor)=0;
+ 		virtual void   GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum)=0;
+ 		virtual IssmDouble TimeAdapt()=0;
+@@ -133,6 +138,7 @@
+ 		virtual void   ResetCoordinateSystem()=0;
+ 		virtual IssmDouble StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa)=0;
+ 		virtual void   ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input)=0;
++		virtual void   ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input)=0;
+ 		virtual int    VelocityInterpolation()=0;
+ 		virtual int    PressureInterpolation()=0;
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16817)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16818)
+@@ -1501,8 +1501,8 @@
+ 	for(int i=0;i<NUMVERTICES;i++) connectivity[i]=vertices[i]->Connectivity();
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetStrainRate2d(IssmDouble* epsilon,IssmDouble* xyz_list, GaussTria* gauss, Input* vx_input, Input* vy_input){{{*/
+-void Tria::GetStrainRate2d(IssmDouble* epsilon,IssmDouble* xyz_list, GaussTria* gauss, Input* vx_input, Input* vy_input){
++/*FUNCTION Tria::GetStrainRate2d(IssmDouble* epsilon,IssmDouble* xyz_list, Gauss* gauss, Input* vx_input, Input* vy_input){{{*/
++void Tria::GetStrainRate2d(IssmDouble* epsilon,IssmDouble* xyz_list, Gauss* gauss, Input* vx_input, Input* vy_input){
+ 	/*Compute the 2d Strain Rate (3 components):
+ 	 * epsilon=[exx eyy exy] */
+ 
+@@ -2193,6 +2193,11 @@
+ 	return new ElementVector(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
+ }
+ /*}}}*/
++/*FUNCTION Tria::NewElementMatrix{{{*/
++ElementMatrix* Tria::NewElementMatrix(int approximation_enum){
++	return new ElementMatrix(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
++}
++/*}}}*/
+ /*FUNCTION Tria::NoIceInElement {{{*/
+ bool   Tria::NoIceInElement(){
+ 
+@@ -2711,34 +2716,41 @@
+ 	return dt;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::TransformSolutionCoord{{{*/
++/*FUNCTION Tria::TransformSolutionCoord(IssmDouble* values,int transformenum){{{*/
+ void Tria::TransformSolutionCoord(IssmDouble* values,int transformenum){
+ 
+ 	::TransformSolutionCoord(values,this->nodes,this->NumberofNodes(),transformenum);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::TransformSolutionCoord{{{*/
++/*FUNCTION Tria::TransformSolutionCoord(IssmDouble* values,int* transformenum_list){{{*/
+ void Tria::TransformSolutionCoord(IssmDouble* values,int* transformenum_list){
+ 
+ 	::TransformSolutionCoord(values,this->nodes,this->NumberofNodes(),transformenum_list);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::TransformLoadVectorCoord{{{*/
++/*FUNCTION Tria::TransformLoadVectorCoord(ElementVector* pe,int transformenum){{{*/
+ void Tria::TransformLoadVectorCoord(ElementVector* pe,int transformenum){
+ 
+ 	::TransformLoadVectorCoord(pe,this->nodes,this->NumberofNodes(),transformenum);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::TransformLoadVectorCoord{{{*/
++/*FUNCTION Tria::TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list){{{*/
+ void Tria::TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list){
+ 
+ 	::TransformLoadVectorCoord(pe,this->nodes,this->NumberofNodes(),transformenum_list);
+ 
+ }
+ /*}}}*/
++/*FUNCTION Tria::TransformStiffnessMatrixCoord(ElementMatrix* pe,int transformenum){{{*/
++void Tria::TransformStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum){
++
++	::TransformStiffnessMatrixCoord(Ke,this->nodes,this->NumberofNodes(),transformenum);
++
++}
++/*}}}*/
+ /*FUNCTION Tria::Update{{{*/
+ void Tria::Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finiteelement_type){
+ 
+@@ -2883,7 +2895,21 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Tria::ViscositySSA{{{*/
++void Tria::ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){
+ 
++	/*Intermediaries*/
++	IssmDouble viscosity;
++	IssmDouble epsilon[3];/* epsilon=[exx,eyy,exy];    */
++
++	this->GetStrainRate2d(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
++	material->GetViscosity2d(&viscosity, &epsilon[0]);
++
++	/*Assign output pointer*/
++	*pviscosity=viscosity;
++}
++/*}}}*/
++
+ #ifdef _HAVE_RESPONSES_
+ /*FUNCTION Tria::AverageOntoPartition {{{*/
+ void  Tria::AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part){
+@@ -3530,7 +3556,7 @@
+ 	}
+ 
+ 	/*Transform Coordinate System*/
+-	TransformStiffnessMatrixCoord(Ke,nodes,(vnumnodes+pnumnodes),cs_list);
++	::TransformStiffnessMatrixCoord(Ke,nodes,(vnumnodes+pnumnodes),cs_list);
+ 
+ 	/*Clean up and return*/
+ 	delete gauss;
+@@ -3603,7 +3629,7 @@
+ 	}
+ 
+ 	/*DO NOT Transform Coordinate System: this stiffness matrix is already expressed in tangential coordinates*/
+-	//TransformStiffnessMatrixCoord(Ke,nodes,(vnumnodes+pnumnodes),cs_list);
++	//::TransformStiffnessMatrixCoord(Ke,nodes,(vnumnodes+pnumnodes),cs_list);
+ 
+ 	/*Clean up and return*/
+ 	delete gauss;
+@@ -3683,7 +3709,7 @@
+ 	}
+ 
+ 	/*Transform Coordinate System*/
+-	TransformStiffnessMatrixCoord(Ke,nodes,numnodes,XYEnum);
++	::TransformStiffnessMatrixCoord(Ke,nodes,numnodes,XYEnum);
+ 
+ 	/*Clean up and return*/
+ 	delete gauss;
+@@ -3768,7 +3794,7 @@
+ 	}
+ 
+ 	/*Transform Coordinate System*/
+-	TransformStiffnessMatrixCoord(Ke,nodes,numnodes,XYEnum);
++	::TransformStiffnessMatrixCoord(Ke,nodes,numnodes,XYEnum);
+ 
+ 	/*Clean up and return*/
+ 	delete gauss;
+@@ -4298,7 +4324,7 @@
+ 	}
+ 
+ 	/*Transform Coordinate System*/
+-	TransformStiffnessMatrixCoord(Ke,nodes,numnodes,XYEnum);
++	::TransformStiffnessMatrixCoord(Ke,nodes,numnodes,XYEnum);
+ 
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(dbasis);
+@@ -6015,7 +6041,7 @@
+ 	}
+ 
+ 	/*Transform Coordinate System*/
+-	TransformStiffnessMatrixCoord(Ke,nodes,numnodes,XYEnum);
++	::TransformStiffnessMatrixCoord(Ke,nodes,numnodes,XYEnum);
+ 
+ 	/*Clean up and return*/
+ 	delete gauss;
+Index: ../trunk-jpl/src/c/classes/Elements/TriaRef.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TriaRef.h	(revision 16817)
++++ ../trunk-jpl/src/c/classes/Elements/TriaRef.h	(revision 16818)
+@@ -6,7 +6,7 @@
+ #ifndef _TRIAREF_H_
+ #define _TRIAREF_H_
+ 
+-class GaussTria;
++class Gauss;
+ 
+ class TriaRef{
+ 
+@@ -22,38 +22,38 @@
+ 		void SetElementType(int type,int type_counter);
+ 
+ 		/*Numerics*/
+-		void GetBExtrusion(IssmDouble* B_prime, IssmDouble* xyz_list, GaussTria* gauss);
+-		void GetBFS(IssmDouble* B_prime, IssmDouble* xyz_list, GaussTria* gauss);
+-		void GetBSSA(IssmDouble* B, IssmDouble* xyz_list, GaussTria* gauss);
+-		void GetBSSAFS(IssmDouble* B , IssmDouble* xyz_list, GaussTria* gauss);
+-		void GetBprimeFS(IssmDouble* B_prime, IssmDouble* xyz_list, GaussTria* gauss);
+-		void GetBprimeSSA(IssmDouble* Bprime, IssmDouble* xyz_list, GaussTria* gauss);
+-		void GetBprimeSSAFS(IssmDouble* Bprime, IssmDouble* xyz_list, GaussTria* gauss);
+-		void GetBprimeMasstransport(IssmDouble* Bprime, IssmDouble* xyz_list, GaussTria* gauss);
+-		void GetBMasstransport(IssmDouble* B, IssmDouble* xyz_list, GaussTria* gauss);
+-		void GetBHydro(IssmDouble* B, IssmDouble* xyz_list, GaussTria* gauss);
+-		void GetBSSAFriction(IssmDouble* L, IssmDouble* xyz_list,GaussTria* gauss);
+-		void GetJacobian(IssmDouble* J, IssmDouble* xyz_list,GaussTria* gauss);
+-		void GetSegmentJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,GaussTria* gauss);
+-		void GetJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,GaussTria* gauss);
+-		void GetJacobianInvert(IssmDouble*  Jinv, IssmDouble* xyz_list,GaussTria* gauss);
+-		void GetLFS(IssmDouble* LFS, GaussTria* gauss);
+-		void GetNodalFunctions(IssmDouble* basis,GaussTria* gauss);
+-		void GetNodalFunctions(IssmDouble* basis,GaussTria* gauss,int finiteelement);
+-		void GetNodalFunctionsVelocity(IssmDouble* basis, GaussTria* gauss);
+-		void GetNodalFunctionsPressure(IssmDouble* basis, GaussTria* gauss);
+-		void GetSegmentNodalFunctions(IssmDouble* basis,GaussTria* gauss, int index1,int index2);
+-		void GetSegmentBFlux(IssmDouble* B,GaussTria* gauss, int index1,int index2);
+-		void GetSegmentBprimeFlux(IssmDouble* Bprime,GaussTria* gauss, int index1,int index2);
+-		void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTria* gauss);
+-		void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTria* gauss,int finiteelement);
+-		void GetNodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,GaussTria* gauss);
+-		void GetNodalFunctionsDerivativesPressure(IssmDouble* dbasis,IssmDouble* xyz_list,GaussTria* gauss);
+-		void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTria* gauss);
+-		void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTria* gauss,int finiteelement);
+-		void GetInputValue(IssmDouble* pp, IssmDouble* plist, GaussTria* gauss);
+-		void GetInputValue(IssmDouble* pp, IssmDouble* plist, GaussTria* gauss,int finiteelement);
+-		void GetInputDerivativeValue(IssmDouble* pp, IssmDouble* plist,IssmDouble* xyz_list, GaussTria* gauss);
++		void GetBExtrusion(IssmDouble* B_prime, IssmDouble* xyz_list, Gauss* gauss);
++		void GetBFS(IssmDouble* B_prime, IssmDouble* xyz_list, Gauss* gauss);
++		void GetBSSA(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss);
++		void GetBSSAFS(IssmDouble* B , IssmDouble* xyz_list, Gauss* gauss);
++		void GetBprimeFS(IssmDouble* B_prime, IssmDouble* xyz_list, Gauss* gauss);
++		void GetBprimeSSA(IssmDouble* Bprime, IssmDouble* xyz_list, Gauss* gauss);
++		void GetBprimeSSAFS(IssmDouble* Bprime, IssmDouble* xyz_list, Gauss* gauss);
++		void GetBprimeMasstransport(IssmDouble* Bprime, IssmDouble* xyz_list, Gauss* gauss);
++		void GetBMasstransport(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss);
++		void GetBHydro(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss);
++		void GetBSSAFriction(IssmDouble* L, IssmDouble* xyz_list,Gauss* gauss);
++		void GetJacobian(IssmDouble* J, IssmDouble* xyz_list,Gauss* gauss);
++		void GetSegmentJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss);
++		void GetJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss);
++		void GetJacobianInvert(IssmDouble*  Jinv, IssmDouble* xyz_list,Gauss* gauss);
++		void GetLFS(IssmDouble* LFS, Gauss* gauss);
++		void GetNodalFunctions(IssmDouble* basis,Gauss* gauss);
++		void GetNodalFunctions(IssmDouble* basis,Gauss* gauss,int finiteelement);
++		void GetNodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss);
++		void GetNodalFunctionsPressure(IssmDouble* basis, Gauss* gauss);
++		void GetSegmentNodalFunctions(IssmDouble* basis,Gauss* gauss, int index1,int index2);
++		void GetSegmentBFlux(IssmDouble* B,Gauss* gauss, int index1,int index2);
++		void GetSegmentBprimeFlux(IssmDouble* Bprime,Gauss* gauss, int index1,int index2);
++		void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss);
++		void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss,int finiteelement);
++		void GetNodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
++		void GetNodalFunctionsDerivativesPressure(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
++		void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss);
++		void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss,int finiteelement);
++		void GetInputValue(IssmDouble* pp, IssmDouble* plist, Gauss* gauss);
++		void GetInputValue(IssmDouble* pp, IssmDouble* plist, Gauss* gauss,int finiteelement);
++		void GetInputDerivativeValue(IssmDouble* pp, IssmDouble* plist,IssmDouble* xyz_list, Gauss* gauss);
+ 
+ 		void NodeOnEdgeIndices(int* pnumindices,int** pindices,int index,int finiteelement);
+ 		int  NumberofNodes(void);
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 16817)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 16818)
+@@ -54,7 +54,7 @@
+ 
+ /*Reference Element numerics*/
+ /*FUNCTION PentaRef::GetBSSAHO {{{*/
+-void PentaRef::GetBSSAHO(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss){
++void PentaRef::GetBSSAHO(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss){
+ 	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF2. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
+ 	 * by: 
+@@ -85,7 +85,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetBSSAFS{{{*/
+-void PentaRef::GetBSSAFS(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss){
++void PentaRef::GetBSSAFS(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss){
+ 	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF2. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
+ 	 * by: 
+@@ -145,7 +145,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetBHO {{{*/
+-void PentaRef::GetBHO(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss){
++void PentaRef::GetBHO(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss){
+ 	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF2. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
+ 	 * by: 
+@@ -185,7 +185,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetBprimeHO {{{*/
+-void PentaRef::GetBprimeHO(IssmDouble* B,IssmDouble* xyz_list,GaussPenta* gauss){
++void PentaRef::GetBprimeHO(IssmDouble* B,IssmDouble* xyz_list,Gauss* gauss){
+ 	/*Compute B  prime matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF2. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
+ 	 * by: 
+@@ -225,7 +225,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetBprimeSSAFS{{{*/
+-void PentaRef::GetBprimeSSAFS(IssmDouble* Bprime, IssmDouble* xyz_list, GaussPenta* gauss){
++void PentaRef::GetBprimeSSAFS(IssmDouble* Bprime, IssmDouble* xyz_list, Gauss* gauss){
+ 	/*Compute Bprime  matrix. Bprime=[Bprime1 Bprime2 Bprime3 Bprime4 Bprime5 Bprime6] where Bprimei is of size 5*NDOF2. 
+ 	 * For node i, Bprimei can be expressed in the actual coordinate system
+ 	 * by: 
+@@ -277,7 +277,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetBFSstrainrate {{{*/
+-void PentaRef::GetBFSstrainrate(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss){
++void PentaRef::GetBFSstrainrate(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss){
+ 
+ 	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 3*NDOF4. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
+@@ -330,7 +330,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetBFS {{{*/
+-void PentaRef::GetBFS(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss){
++void PentaRef::GetBFS(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss){
+ 
+ 	/*Compute B  matrix. B=[Bv1 Bv2 ... Bp1 Bp2 ...] where Bvi is of size 3*NDOF3. 
+ 	 * For node i, Bvi can be expressed in the actual coordinate system
+@@ -409,7 +409,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetBFSGLS {{{*/
+-void PentaRef::GetBFSGLS(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss){
++void PentaRef::GetBFSGLS(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss){
+ 
+ 	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 3*NDOF4. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
+@@ -475,7 +475,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetBprimeFS {{{*/
+-void PentaRef::GetBprimeFS(IssmDouble* B_prime, IssmDouble* xyz_list, GaussPenta* gauss){
++void PentaRef::GetBprimeFS(IssmDouble* B_prime, IssmDouble* xyz_list, Gauss* gauss){
+ 	/*	Compute B'  matrix. B'=[B1' B2' B3' B4' B5' B6' Bb'] where Bi' is of size 3*NDOF2. 
+ 	 *	For node i, Bi' can be expressed in the actual coordinate system
+ 	 *	by: 
+@@ -553,7 +553,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetBprimeFSGLS {{{*/
+-void PentaRef::GetBprimeFSGLS(IssmDouble* B_prime, IssmDouble* xyz_list, GaussPenta* gauss){
++void PentaRef::GetBprimeFSGLS(IssmDouble* B_prime, IssmDouble* xyz_list, Gauss* gauss){
+ 	/*	Compute B'  matrix. B'=[B1' B2' B3' B4' B5' B6' Bb'] where Bi' is of size 3*NDOF2. 
+ 	 *	For node i, Bi' can be expressed in the actual coordinate system
+ 	 *	by: 
+@@ -620,7 +620,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetBAdvec{{{*/
+-void PentaRef::GetBAdvec(IssmDouble* B_advec, IssmDouble* xyz_list, GaussPenta* gauss){
++void PentaRef::GetBAdvec(IssmDouble* B_advec, IssmDouble* xyz_list, Gauss* gauss){
+ 	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF1. 
+ 	 * For node i, Bi' can be expressed in the actual coordinate system
+ 	 * by: 
+@@ -651,7 +651,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetBConduct{{{*/
+-void PentaRef::GetBConduct(IssmDouble* B_conduct, IssmDouble* xyz_list, GaussPenta* gauss){
++void PentaRef::GetBConduct(IssmDouble* B_conduct, IssmDouble* xyz_list, Gauss* gauss){
+ 	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF1. 
+ 	 * For node i, Bi' can be expressed in the actual coordinate system
+ 	 * by: 
+@@ -682,7 +682,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetBVert{{{*/
+-void PentaRef::GetBVert(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss){
++void PentaRef::GetBVert(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss){
+ 	/*	Compute B  matrix. B=[dh1/dz dh2/dz dh3/dz dh4/dz dh5/dz dh6/dz];
+ 		where hi is the interpolation function for node i.*/
+ 
+@@ -703,7 +703,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetBprimeAdvec{{{*/
+-void PentaRef::GetBprimeAdvec(IssmDouble* Bprime_advec, IssmDouble* xyz_list, GaussPenta* gauss){
++void PentaRef::GetBprimeAdvec(IssmDouble* Bprime_advec, IssmDouble* xyz_list, Gauss* gauss){
+ 	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF1. 
+ 	 * For node i, Bi' can be expressed in the actual coordinate system
+ 	 * by: 
+@@ -734,14 +734,14 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetBprimeVert{{{*/
+-void PentaRef::GetBprimeVert(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss){
++void PentaRef::GetBprimeVert(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss){
+ 
+ 	GetNodalFunctions(B,gauss);
+ 
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetBHOFriction{{{*/
+-void PentaRef::GetBHOFriction(IssmDouble* B, GaussPenta* gauss){
++void PentaRef::GetBHOFriction(IssmDouble* B, Gauss* gauss){
+ 	/*Compute B  matrix. B=[B1 B2 B3] where Bi is square and of size 2x2. 
+ 	 ** For node i, Bi can be expressed in the actual coordinate system
+ 	 ** by: 
+@@ -771,7 +771,7 @@
+ } 
+ /*}}}*/
+ /*FUNCTION PentaRef::GetLFS{{{*/
+-void PentaRef::GetLFS(IssmDouble* LFS, GaussPenta* gauss){
++void PentaRef::GetLFS(IssmDouble* LFS, Gauss* gauss){
+ 	/* Compute L  matrix. L=[L1 L2 L3] where Li is square and of size numdof. 
+ 	 * For node i, Li can be expressed in the actual coordinate system
+ 	 * by: 
+@@ -811,7 +811,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetLprimeFS {{{*/
+-void PentaRef::GetLprimeFS(IssmDouble* LprimeFS, IssmDouble* xyz_list, GaussPenta* gauss){
++void PentaRef::GetLprimeFS(IssmDouble* LprimeFS, IssmDouble* xyz_list, Gauss* gauss_in){
+ 	/* Compute Lprime  matrix. Lprime=[Lp1 Lp2 Lp3] where Lpi is square and of size numdof. 
+ 	 * For node i, Lpi can be expressed in the actual coordinate system
+ 	 * by: 
+@@ -851,6 +851,10 @@
+ 	IssmDouble L1L2l3[NUMNODESP1_2d];
+ 	IssmDouble dbasis[3][NUMNODESP1];
+ 
++	/*Cast gauss to GaussPenta*/
++	_assert_(gauss_in->Enum()==GaussPentaEnum);
++	GaussPenta* gauss = dynamic_cast<GaussPenta*>(gauss_in);
++
+ 	/*Get L1L2l3 in actual coordinate system: */
+ 	L1L2l3[0]=gauss->coord1*(1-gauss->coord4)/2.0;
+ 	L1L2l3[1]=gauss->coord2*(1-gauss->coord4)/2.0;
+@@ -920,7 +924,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetLSSAFS {{{*/
+-void PentaRef::GetLSSAFS(IssmDouble* LFS, GaussPenta* gauss){
++void PentaRef::GetLSSAFS(IssmDouble* LFS, Gauss* gauss_in){
+ 	/*
+ 	 * Compute L  matrix. L=[L1 L2 L3] where Li is square and of size numdof. 
+ 	 * For node i, Li can be expressed in the actual coordinate system
+@@ -939,6 +943,10 @@
+ 	int num_dof=2;
+ 	IssmDouble L1L2l3[NUMNODESP1_2d];
+ 
++	/*Cast gauss to GaussPenta*/
++	_assert_(gauss_in->Enum()==GaussPentaEnum);
++	GaussPenta* gauss = dynamic_cast<GaussPenta*>(gauss_in);
++
+ 	/*Get L1L2l3 in actual coordinate system: */
+ 	L1L2l3[0]=gauss->coord1*(1-gauss->coord4)/2.0;
+ 	L1L2l3[1]=gauss->coord2*(1-gauss->coord4)/2.0;
+@@ -966,7 +974,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetLprimeSSAFS {{{*/
+-void PentaRef::GetLprimeSSAFS(IssmDouble* LprimeFS, IssmDouble* xyz_list, GaussPenta* gauss){
++void PentaRef::GetLprimeSSAFS(IssmDouble* LprimeFS, IssmDouble* xyz_list, Gauss* gauss_in){
+ 	/* Compute Lprime  matrix. Lprime=[Lp1 Lp2 Lp3] where Lpi is square and of size numdof. 
+ 	 * For node i, Lpi can be expressed in the actual coordinate system
+ 	 * by: 
+@@ -986,6 +994,10 @@
+ 	IssmDouble L1L2l3[NUMNODESP1_2d];
+ 	IssmDouble dbasis[3][NUMNODESP1];
+ 
++	/*Cast gauss to GaussPenta*/
++	_assert_(gauss_in->Enum()==GaussPentaEnum);
++	GaussPenta* gauss = dynamic_cast<GaussPenta*>(gauss_in);
++
+ 	/*Get L1L2l3 in actual coordinate system: */
+ 	L1L2l3[0]=gauss->coord1*(1-gauss->coord4)/2.0;
+ 	L1L2l3[1]=gauss->coord2*(1-gauss->coord4)/2.0;
+@@ -1069,7 +1081,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetLFSSSA {{{*/
+-void PentaRef::GetLFSSSA(IssmDouble* LFS, GaussPenta* gauss){
++void PentaRef::GetLFSSSA(IssmDouble* LFS, Gauss* gauss_in){
+ 	/* Compute L  matrix. L=[L1 L2 L3] where Li is square and of size numdof. 
+ 	 * For node i, Li can be expressed in the actual coordinate system
+ 	 * by: 
+@@ -1083,6 +1095,10 @@
+ 	int num_dof=3;
+ 	IssmDouble L1L2l3[NUMNODESP1_2d];
+ 
++	/*Cast gauss to GaussPenta*/
++	_assert_(gauss_in->Enum()==GaussPentaEnum);
++	GaussPenta* gauss = dynamic_cast<GaussPenta*>(gauss_in);
++
+ 	/*Get L1L2l3 in actual coordinate system: */
+ 	L1L2l3[0]=gauss->coord1*(1-gauss->coord4)/2.0;
+ 	L1L2l3[1]=gauss->coord2*(1-gauss->coord4)/2.0;
+@@ -1106,7 +1122,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetLprimeFSSSA {{{*/
+-void PentaRef::GetLprimeFSSSA(IssmDouble* LprimeFS, IssmDouble* xyz_list, GaussPenta* gauss){
++void PentaRef::GetLprimeFSSSA(IssmDouble* LprimeFS, IssmDouble* xyz_list, Gauss* gauss_in){
+ 	/* Compute Lprime  matrix. Lprime=[Lp1 Lp2 Lp3] where Lpi is square and of size numdof. 
+ 	 * For node i, Lpi can be expressed in the actual coordinate system
+ 	 * by: 
+@@ -1120,6 +1136,10 @@
+ 	IssmDouble L1L2l3[NUMNODESP1_2d];
+ 	IssmDouble dbasis[3][NUMNODESP1];
+ 
++	/*Cast gauss to GaussPenta*/
++	_assert_(gauss_in->Enum()==GaussPentaEnum);
++	GaussPenta* gauss = dynamic_cast<GaussPenta*>(gauss_in);
++
+ 	/*Get L1L2l3 in actual coordinate system: */
+ 	L1L2l3[0]=gauss->coord1*(1-gauss->coord4)/2.0;
+ 	L1L2l3[1]=gauss->coord2*(1-gauss->coord4)/2.0;
+@@ -1140,7 +1160,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetJacobian {{{*/
+-void PentaRef::GetJacobian(IssmDouble* J, IssmDouble* xyz_list,GaussPenta* gauss){
++void PentaRef::GetJacobian(IssmDouble* J, IssmDouble* xyz_list,Gauss* gauss_in){
+ 	/*The Jacobian is constant over the element, discard the gaussian points. 
+ 	 * J is assumed to have been allocated of size NDOF2xNDOF2.*/
+ 
+@@ -1150,6 +1170,10 @@
+ 	IssmDouble y1,y2,y3,y4,y5,y6;
+ 	IssmDouble z1,z2,z3,z4,z5,z6;
+ 
++	/*Cast gauss to GaussPenta*/
++	_assert_(gauss_in->Enum()==GaussPentaEnum);
++	GaussPenta* gauss = dynamic_cast<GaussPenta*>(gauss_in);
++
+ 	/*Figure out xi,eta and zi (parametric coordinates), for this gaussian point: */
+ 	A1  = gauss->coord1;
+ 	A2  = gauss->coord2;
+@@ -1193,7 +1217,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetJacobianDeterminant {{{*/
+-void PentaRef::GetJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,GaussPenta* gauss){
++void PentaRef::GetJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss){
+ 	/*On a penta, Jacobian varies according to coordinates. We need to get the Jacobian, and take 
+ 	 * the determinant of it: */
+ 	IssmDouble J[3][3];
+@@ -1208,7 +1232,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetTriaJacobianDeterminant{{{*/
+-void PentaRef::GetTriaJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,GaussPenta* gauss){
++void PentaRef::GetTriaJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss){
+ 	/*The Jacobian determinant is constant over the element, discard the gaussian points. 
+ 	 * J is assumed to have been allocated of size NDOF2xNDOF2.*/
+ 
+@@ -1228,7 +1252,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetSegmentJacobianDeterminant{{{*/
+-void PentaRef::GetSegmentJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,GaussPenta* gauss){
++void PentaRef::GetSegmentJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss){
+ 	/*The Jacobian determinant is constant over the element, discard the gaussian points. 
+ 	 * J is assumed to have been allocated of size NDOF2xNDOF2.*/
+ 
+@@ -1245,7 +1269,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetJacobianInvert {{{*/
+-void PentaRef::GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,GaussPenta* gauss){
++void PentaRef::GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,Gauss* gauss){
+ 
+ 	/*Jacobian*/
+ 	IssmDouble J[3][3];
+@@ -1258,11 +1282,15 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetNodalFunctions{{{*/
+-void PentaRef::GetNodalFunctions(IssmDouble* basis,GaussPenta* gauss){
++void PentaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss_in){
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+ 
+ 	_assert_(basis);
+ 
++	/*Cast gauss to GaussPenta*/
++	_assert_(gauss_in->Enum()==GaussPentaEnum);
++	GaussPenta* gauss = dynamic_cast<GaussPenta*>(gauss_in);
++
+ 	/*Get current coordinates in reference element*/
+ 	IssmDouble zeta=gauss->coord4;
+ 
+@@ -1339,7 +1367,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetNodalFunctionsVelocity{{{*/
+-void PentaRef::GetNodalFunctionsVelocity(IssmDouble* basis,GaussPenta* gauss){
++void PentaRef::GetNodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss){
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+ 
+ 	switch(this->element_type){
+@@ -1374,7 +1402,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetNodalFunctionsPressure{{{*/
+-void PentaRef::GetNodalFunctionsPressure(IssmDouble* basis,GaussPenta* gauss){
++void PentaRef::GetNodalFunctionsPressure(IssmDouble* basis,Gauss* gauss){
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+ 
+ 	switch(this->element_type){
+@@ -1409,7 +1437,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetNodalFunctionsDerivatives{{{*/
+-void PentaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussPenta* gauss){
++void PentaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){
+ 
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+ 	 * actual coordinate system): */
+@@ -1444,7 +1472,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetNodalFunctionsDerivativesVelocity{{{*/
+-void PentaRef::GetNodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list, GaussPenta* gauss){
++void PentaRef::GetNodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){
+ 	switch(this->element_type){
+ 		case P1P1Enum:
+ 			this->element_type = P1Enum;
+@@ -1477,7 +1505,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetNodalFunctionsDerivativesPressure{{{*/
+-void PentaRef::GetNodalFunctionsDerivativesPressure(IssmDouble* dbasis,IssmDouble* xyz_list, GaussPenta* gauss){
++void PentaRef::GetNodalFunctionsDerivativesPressure(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){
+ 	switch(this->element_type){
+ 		case P1P1Enum:
+ 			this->element_type = P1Enum;
+@@ -1510,13 +1538,17 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetNodalFunctionsDerivativesReference{{{*/
+-void PentaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussPenta* gauss){
++void PentaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss_in){
+ 
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+ 	 * natural coordinate system) at the gaussian point. */
+ 
+-	_assert_(dbasis && gauss);
++	_assert_(dbasis && gauss_in);
+ 
++	/*Cast gauss to GaussPenta*/
++	_assert_(gauss_in->Enum()==GaussPentaEnum);
++	GaussPenta* gauss = dynamic_cast<GaussPenta*>(gauss_in);
++
+ 	/*Get current coordinates in reference element*/
+ 	IssmDouble zeta=gauss->coord4;
+ 
+@@ -1738,9 +1770,13 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetNodalFunctionsMINI{{{*/
+-void PentaRef::GetNodalFunctionsMINI(IssmDouble* l1l7, GaussPenta* gauss){
++void PentaRef::GetNodalFunctionsMINI(IssmDouble* l1l7, Gauss* gauss_in){
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+ 
++	/*Cast gauss to GaussPenta*/
++	_assert_(gauss_in->Enum()==GaussPentaEnum);
++	GaussPenta* gauss = dynamic_cast<GaussPenta*>(gauss_in);
++
+ 	l1l7[0]=gauss->coord1*(1.0-gauss->coord4)/2.0;
+ 	l1l7[1]=gauss->coord2*(1.0-gauss->coord4)/2.0;
+ 	l1l7[2]=gauss->coord3*(1.0-gauss->coord4)/2.0;
+@@ -1752,7 +1788,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetNodalFunctionsMINIDerivatives{{{*/
+-void PentaRef::GetNodalFunctionsMINIDerivatives(IssmDouble* dbasismini,IssmDouble* xyz_list, GaussPenta* gauss){
++void PentaRef::GetNodalFunctionsMINIDerivatives(IssmDouble* dbasismini,IssmDouble* xyz_list, Gauss* gauss){
+ 
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+ 	 * actual coordinate system): */
+@@ -1782,10 +1818,15 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetNodalFunctionsMINIDerivativesReference{{{*/
+-void PentaRef::GetNodalFunctionsMINIDerivativesReference(IssmDouble* dbasis,GaussPenta* gauss){
+-
++void PentaRef::GetNodalFunctionsMINIDerivativesReference(IssmDouble* dbasis,Gauss* gauss_in){
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+ 	 * natural coordinate system) at the gaussian point. */
++
++	/*Cast gauss to GaussPenta*/
++	_assert_(gauss_in->Enum()==GaussPentaEnum);
++	GaussPenta* gauss = dynamic_cast<GaussPenta*>(gauss_in);
++
++
+ 	IssmDouble zeta=gauss->coord4;
+ 
+ 	/*Nodal function 1*/
+@@ -1819,9 +1860,13 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetNodalFunctionsP1 {{{*/
+-void PentaRef::GetNodalFunctionsP1(IssmDouble* basis, GaussPenta* gauss){
++void PentaRef::GetNodalFunctionsP1(IssmDouble* basis, Gauss* gauss_in){
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+ 
++	/*Cast gauss to GaussPenta*/
++	_assert_(gauss_in->Enum()==GaussPentaEnum);
++	GaussPenta* gauss = dynamic_cast<GaussPenta*>(gauss_in);
++
+ 	basis[0]=gauss->coord1*(1-gauss->coord4)/2.0;
+ 	basis[1]=gauss->coord2*(1-gauss->coord4)/2.0;
+ 	basis[2]=gauss->coord3*(1-gauss->coord4)/2.0;
+@@ -1832,7 +1877,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetNodalFunctionsP1Derivatives {{{*/
+-void PentaRef::GetNodalFunctionsP1Derivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussPenta* gauss){
++void PentaRef::GetNodalFunctionsP1Derivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){
+ 
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+ 	 * actual coordinate system): */
+@@ -1861,11 +1906,15 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetNodalFunctionsP1DerivativesReference {{{*/
+-void PentaRef::GetNodalFunctionsP1DerivativesReference(IssmDouble* dbasis,GaussPenta* gauss){
++void PentaRef::GetNodalFunctionsP1DerivativesReference(IssmDouble* dbasis,Gauss* gauss_in){
+ 
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+ 	 * natural coordinate system) at the gaussian point. Those values vary along xi,eta,z */
+ 
++	/*Cast gauss to GaussPenta*/
++	_assert_(gauss_in->Enum()==GaussPentaEnum);
++	GaussPenta* gauss = dynamic_cast<GaussPenta*>(gauss_in);
++
+ 	IssmDouble zeta=gauss->coord4;
+ 
+ 	/*Nodal function 1*/
+@@ -1895,7 +1944,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetQuadJacobianDeterminant{{{*/
+-void PentaRef::GetQuadJacobianDeterminant(IssmDouble* Jdet,IssmDouble xyz_list[4][3],GaussPenta* gauss){
++void PentaRef::GetQuadJacobianDeterminant(IssmDouble* Jdet,IssmDouble xyz_list[4][3],Gauss* gauss){
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+ 
+ 	IssmDouble x1,x2,x3,x4,y1,y2,y3,y4,z1,z2,z3,z4;
+@@ -1921,7 +1970,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetInputValue{{{*/
+-void PentaRef::GetInputValue(IssmDouble* pvalue,IssmDouble* plist,GaussPenta* gauss){
++void PentaRef::GetInputValue(IssmDouble* pvalue,IssmDouble* plist,Gauss* gauss){
+ 	/*P1 interpolation on Gauss point*/
+ 
+ 	/*intermediary*/
+@@ -1936,7 +1985,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetInputDerivativeValue{{{*/
+-void PentaRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, GaussPenta* gauss){
++void PentaRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, Gauss* gauss){
+ 	/*From node values of parameter p (p_list[0], p_list[1], p_list[2],
+ 	 * p_list[3], p_list[4] and p_list[4]), return parameter derivative value at
+ 	 * gaussian point specified by gauss_coord:
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16817)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16818)
+@@ -21,6 +21,7 @@
+ class ElementMatrix;
+ class ElementVector;
+ class Vertex;
++class GaussTria;
+ 
+ #include "../../shared/Exceptions/exceptions.h"
+ #include "../../shared/Enum/Enum.h"
+@@ -264,7 +265,7 @@
+ 		void           GetInputValue(int* pvalue,int enum_type);
+ 		void           GetInputValue(IssmDouble* pvalue,int enum_type);
+ 		void           GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype);
+-		void           GetStrainRate2d(IssmDouble* epsilon,IssmDouble* xyz_list, GaussTria* gauss, Input* vx_input, Input* vy_input);
++		void           GetStrainRate2d(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss, Input* vx_input, Input* vy_input);
+ 		void	         InputChangeName(int enum_type,int enum_type_old);
+ 		void	         InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type);
+ 		void	         InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solution,int enum_type){_error_("not implemented yet");};
+@@ -276,6 +277,7 @@
+ 		Gauss*         NewGauss(int order);
+ 		Gauss*         NewGaussBase(int order){_error_("not implemented yet");};
+ 		ElementVector* NewElementVector(int approximation_enum);
++		ElementMatrix* NewElementMatrix(int approximation_enum);
+ 		void           NodalFunctions(IssmDouble* basis,Gauss* gauss);
+ 		void           NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+ 		void           NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss);
+@@ -292,7 +294,13 @@
+ 		void           TransformSolutionCoord(IssmDouble* values,int* transformenum_list);
+ 		void           TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum){_error_("not implemented yet");};
+ 		void           TransformSolutionCoord(IssmDouble* values,int numnodes,int* transformenum_list){_error_("not implemented yet");};
++		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum);
++		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* transformenum_list){_error_("not implemented yet");};
++		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int transformenum){_error_("not implemented yet");};
++		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int* transformenum_list){_error_("not implemented yet");};
+ 		void           ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
++		void           ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
++
+ 		#ifdef _HAVE_STRESSBALANCE_
+ 		ElementMatrix* CreateKMatrixStressbalanceSSA(void);
+ 		ElementMatrix* CreateKMatrixStressbalanceSSAViscous(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16817)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16818)
+@@ -2547,6 +2547,11 @@
+ 	return new ElementVector(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
+ }
+ /*}}}*/
++/*FUNCTION Penta::NewElementMatrix{{{*/
++ElementMatrix* Penta::NewElementMatrix(int approximation_enum){
++	return new ElementMatrix(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
++}
++/*}}}*/
+ /*FUNCTION Penta::NodalFunctions{{{*/
+ void Penta::NodalFunctions(IssmDouble* basis, Gauss* gauss){
+ 
+@@ -3111,14 +3116,14 @@
+ 
+ 	return dt;
+ }/*}}}*/
+-/*FUNCTION Penta::TransformLoadVectorCoord{{{*/
++/*FUNCTION Penta::TransformLoadVectorCoord(ElementVector* pe,int transformenum){{{*/
+ void Penta::TransformLoadVectorCoord(ElementVector* pe,int transformenum){
+ 
+ 	::TransformLoadVectorCoord(pe,this->nodes,this->NumberofNodes(),transformenum);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::TransformLoadVectorCoord{{{*/
++/*FUNCTION Penta::TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list){{{*/
+ void Penta::TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list){
+ 
+ 	::TransformLoadVectorCoord(pe,this->nodes,this->NumberofNodes(),transformenum_list);
+@@ -3153,6 +3158,13 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Penta::TransformStiffnessMatrixCoord(ElementMatrix* pe,int transformenum){{{*/
++void Penta::TransformStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum){
++
++	::TransformStiffnessMatrixCoord(Ke,this->nodes,this->NumberofNodes(),transformenum);
++
++}
++/*}}}*/
+ /*FUNCTION Penta::Update {{{*/
+ void Penta::Update(int index,IoModel* iomodel,int analysis_counter,int analysis_type,int finiteelement_type){ 
+ 
+@@ -5170,7 +5182,7 @@
+ 	}
+ 
+ 	/*Transform Coordinate System*/
+-	TransformStiffnessMatrixCoord(Ke,nodes,NUMVERTICES,XYEnum);
++	::TransformStiffnessMatrixCoord(Ke,nodes,NUMVERTICES,XYEnum);
+ 
+ 	/*Clean up and return*/
+ 	delete gauss;
+@@ -5250,7 +5262,7 @@
+ 	}
+ 
+ 	/*Transform Coordinate System*/
+-	TransformStiffnessMatrixCoord(Ke,nodes,NUMVERTICES,XYZEnum);
++	::TransformStiffnessMatrixCoord(Ke,nodes,NUMVERTICES,XYZEnum);
+ 
+ 	/*Clean up and return*/
+ 	delete gauss;
+@@ -6652,7 +6664,7 @@
+ 	for(i=0;i<numdofm;i++) for(j=0;j<numdofp;j++) Ke->values[i*numdoftotal+(j+2*numdofm)]+=Ke_gg[j][i];
+ 
+ 	/*Transform Coordinate System*/
+-	TransformStiffnessMatrixCoord(Ke,node_list,numnodes,cs_list);
++	::TransformStiffnessMatrixCoord(Ke,node_list,numnodes,cs_list);
+ 
+ 	/*Clean-up and return*/
+ 	delete tria->material; delete tria;
+@@ -6738,7 +6750,7 @@
+ 	for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke->values[(i+numdof)*numdoftotal+j]+=Ke_gg[i][j];
+ 
+ 	/*Transform Coordinate System*/
+-	TransformStiffnessMatrixCoord(Ke,node_list,numnodes,cs_list);
++	::TransformStiffnessMatrixCoord(Ke,node_list,numnodes,cs_list);
+ 
+ 	/*Clean up and return*/
+ 	delete gauss;
+@@ -6864,7 +6876,7 @@
+ 	for(i=0;i<numdofm;i++)      for(j=0;j<numdofs;j++) Ke->values[i*numdoftotal+(j+2*numdofm)]+=Ke_gg2[i][j];
+ 
+ 	/*Transform Coordinate System*/
+-	TransformStiffnessMatrixCoord(Ke,node_list,numnodes,cs_list);
++	::TransformStiffnessMatrixCoord(Ke,node_list,numnodes,cs_list);
+ 
+ 	/*Clean-up and return*/
+ 	xDelete<int>(cs_list);
+@@ -6990,7 +7002,7 @@
+ 	}
+ 
+ 	/*Transform Coordinate System*/
+-	TransformStiffnessMatrixCoord(Ke,node_list,numnodes,cs_list);
++	::TransformStiffnessMatrixCoord(Ke,node_list,numnodes,cs_list);
+ 
+ 	/*Clean up and return*/
+ 	xDelete<int>(cs_list);
+@@ -7056,7 +7068,7 @@
+ 	}
+ 
+ 	/*Transform Coordinate System*/ //Do not transform, already done in the matrices
+-	TransformStiffnessMatrixCoord(Ke,node_list,numnodes,cs_list);
++	::TransformStiffnessMatrixCoord(Ke,node_list,numnodes,cs_list);
+ 
+ 	/*clean-up and return*/
+ 	delete Ke1;
+@@ -7279,7 +7291,7 @@
+ 	}
+ 
+ 	/*Transform Coordinate System*/
+-	TransformStiffnessMatrixCoord(Ke,tria->nodes,NUMVERTICES2D,XYEnum);
++	::TransformStiffnessMatrixCoord(Ke,tria->nodes,NUMVERTICES2D,XYEnum);
+ 
+ 	/*Clean up and return*/
+ 	delete tria->material;
+@@ -7414,7 +7426,7 @@
+ 	}
+ 
+ 	/*Transform Coordinate System*/
+-	TransformStiffnessMatrixCoord(Ke,tria->nodes,NUMVERTICES2D,XYEnum);
++	::TransformStiffnessMatrixCoord(Ke,tria->nodes,NUMVERTICES2D,XYEnum);
+ 
+ 	/*Clean up and return*/
+ 	delete tria->material;
+@@ -7513,7 +7525,7 @@
+ 	}
+ 
+ 	/*Transform Coordinate System*/
+-	TransformStiffnessMatrixCoord(Ke,nodes,numnodes,XYEnum);
++	::TransformStiffnessMatrixCoord(Ke,nodes,numnodes,XYEnum);
+ 
+ 	/*Clean up and return*/
+ 	delete gauss;
+@@ -7604,7 +7616,7 @@
+ 	}
+ 
+ 	/*Transform Coordinate System*/
+-	TransformStiffnessMatrixCoord(Ke,nodes,numnodes,XYEnum);
++	::TransformStiffnessMatrixCoord(Ke,nodes,numnodes,XYEnum);
+ 
+ 	/*Clean up and return*/
+ 	delete gauss;
+@@ -7820,7 +7832,7 @@
+ 	}
+ 
+ 	/*Transform Coordinate System*/
+-	TransformStiffnessMatrixCoord(Ke,nodes,(vnumnodes+pnumnodes),cs_list);
++	::TransformStiffnessMatrixCoord(Ke,nodes,(vnumnodes+pnumnodes),cs_list);
+ 
+ 	/*Clean up and return*/
+ 	delete gauss;
+@@ -7892,7 +7904,7 @@
+ 	}
+ 
+ 	/*DO NOT Transform Coordinate System: this stiffness matrix is already expressed in tangential coordinates*/
+-	//TransformStiffnessMatrixCoord(Ke,nodes,NUMVERTICES,XYZEnum);
++	//::TransformStiffnessMatrixCoord(Ke,nodes,NUMVERTICES,XYZEnum);
+ 
+ 	/*Clean up and return*/
+ 	delete gauss;
+@@ -9274,7 +9286,7 @@
+ 	}
+ 
+ 	/*Transform Coordinate System*/
+-	TransformStiffnessMatrixCoord(Ke,nodes,NUMVERTICES,XYEnum);
++	::TransformStiffnessMatrixCoord(Ke,nodes,NUMVERTICES,XYEnum);
+ 
+ 	/*Clean up and return*/
+ 	delete gauss;
+@@ -9365,7 +9377,7 @@
+ 	}
+ 
+ 	/*Transform Coordinate System*/
+-	TransformStiffnessMatrixCoord(Ke,nodes,(vnumnodes+pnumnodes),cs_list);
++	::TransformStiffnessMatrixCoord(Ke,nodes,(vnumnodes+pnumnodes),cs_list);
+ 
+ 	/*Clean up and return*/
+ 	xDelete<int>(cs_list);
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.h	(revision 16817)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.h	(revision 16818)
+@@ -6,7 +6,7 @@
+ #ifndef _PENTAREF_H_
+ #define _PENTAREF_H_
+ 
+-class GaussPenta;
++class Gauss;
+ class PentaRef{
+ 
+ 	public: 
+@@ -21,51 +21,49 @@
+ 		void SetElementType(int type,int type_counter);
+ 
+ 		/*Numerics*/
+-		void GetNodalFunctions(IssmDouble* basis, GaussPenta* gauss);
+-		void GetNodalFunctionsVelocity(IssmDouble* basis, GaussPenta* gauss);
+-		void GetNodalFunctionsPressure(IssmDouble* basis, GaussPenta* gauss);
+-		void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,GaussPenta* gauss);
+-		void GetNodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,GaussPenta* gauss);
+-		void GetNodalFunctionsDerivativesPressure(IssmDouble* dbasis,IssmDouble* xyz_list,GaussPenta* gauss);
+-		void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussPenta* gauss);
+-		void GetNodalFunctionsP1(IssmDouble* l1l6, GaussPenta* gauss);
+-		void GetNodalFunctionsMINI(IssmDouble* l1l7, GaussPenta* gauss);
+-		void GetNodalFunctionsP1Derivatives(IssmDouble* dh1dh6,IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetNodalFunctionsMINIDerivatives(IssmDouble* dh1dh7,IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetNodalFunctionsP1DerivativesReference(IssmDouble* dl1dl6,GaussPenta* gauss);
+-		void GetNodalFunctionsMINIDerivativesReference(IssmDouble* dl1dl7,GaussPenta* gauss);
+-		void GetQuadJacobianDeterminant(IssmDouble*  Jdet, IssmDouble xyz_list[4][3],GaussPenta* gauss);
+-		void GetJacobian(IssmDouble* J, IssmDouble* xyz_list,GaussPenta* gauss);
+-		void GetJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,GaussPenta* gauss);
+-		void GetTriaJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,GaussPenta* gauss);
+-		void GetSegmentJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,GaussPenta* gauss);
+-		void GetJacobianInvert(IssmDouble*  Jinv, IssmDouble* xyz_list,GaussPenta* gauss);
+-		void GetBSSAHO(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetBSSAFS(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetBHO(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetBFSstrainrate(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetBFS(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetBFSGLS(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetBprimeSSAFS(IssmDouble* Bprime, IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetBprimeHO(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetBprimeFS(IssmDouble* B_prime, IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetBprimeFSGLS(IssmDouble* B_prime, IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetBprimeVert(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetBAdvec(IssmDouble* B_advec, IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetBConduct(IssmDouble* B_conduct, IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetBVert(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetBprimeAdvec(IssmDouble* Bprime_advec, IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetBHOFriction(IssmDouble* L, GaussPenta* gauss);
+-		void GetLFS(IssmDouble* LFS, GaussPenta* gauss);
+-		void GetLprimeFS(IssmDouble* LprimeFS, IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetLSSAFS(IssmDouble* LSSAFS, GaussPenta* gauss);
+-		void GetLprimeSSAFS(IssmDouble* LprimeSSAFS, IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetLFSSSA(IssmDouble* LFSSSA, GaussPenta* gauss);
+-		void GetLprimeFSSSA(IssmDouble* LprimeFSSSA, IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetInputValue(IssmDouble* pvalue,IssmDouble* plist, GaussPenta* gauss);
+-		void GetInputValue(IssmDouble* pvalue,IssmDouble* plist,GaussTria* gauss){_error_("only PentaGauss are supported");};
+-		void GetInputDerivativeValue(IssmDouble* pvalues, IssmDouble* plist,IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetInputDerivativeValue(IssmDouble* pvalues, IssmDouble* plist,IssmDouble* xyz_list, GaussTria* gauss){_error_("only PentaGauss are supported");};
++		void GetNodalFunctions(IssmDouble* basis, Gauss* gauss);
++		void GetNodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss);
++		void GetNodalFunctionsPressure(IssmDouble* basis, Gauss* gauss);
++		void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
++		void GetNodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
++		void GetNodalFunctionsDerivativesPressure(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
++		void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss);
++		void GetNodalFunctionsP1(IssmDouble* l1l6, Gauss* gauss);
++		void GetNodalFunctionsMINI(IssmDouble* l1l7, Gauss* gauss);
++		void GetNodalFunctionsP1Derivatives(IssmDouble* dh1dh6,IssmDouble* xyz_list, Gauss* gauss);
++		void GetNodalFunctionsMINIDerivatives(IssmDouble* dh1dh7,IssmDouble* xyz_list, Gauss* gauss);
++		void GetNodalFunctionsP1DerivativesReference(IssmDouble* dl1dl6,Gauss* gauss);
++		void GetNodalFunctionsMINIDerivativesReference(IssmDouble* dl1dl7,Gauss* gauss);
++		void GetQuadJacobianDeterminant(IssmDouble*  Jdet, IssmDouble xyz_list[4][3],Gauss* gauss);
++		void GetJacobian(IssmDouble* J, IssmDouble* xyz_list,Gauss* gauss);
++		void GetJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss);
++		void GetTriaJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss);
++		void GetSegmentJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss);
++		void GetJacobianInvert(IssmDouble*  Jinv, IssmDouble* xyz_list,Gauss* gauss);
++		void GetBSSAHO(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss);
++		void GetBSSAFS(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss);
++		void GetBHO(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss);
++		void GetBFSstrainrate(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss);
++		void GetBFS(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss);
++		void GetBFSGLS(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss);
++		void GetBprimeSSAFS(IssmDouble* Bprime, IssmDouble* xyz_list, Gauss* gauss);
++		void GetBprimeHO(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss);
++		void GetBprimeFS(IssmDouble* B_prime, IssmDouble* xyz_list, Gauss* gauss);
++		void GetBprimeFSGLS(IssmDouble* B_prime, IssmDouble* xyz_list, Gauss* gauss);
++		void GetBprimeVert(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss);
++		void GetBAdvec(IssmDouble* B_advec, IssmDouble* xyz_list, Gauss* gauss);
++		void GetBConduct(IssmDouble* B_conduct, IssmDouble* xyz_list, Gauss* gauss);
++		void GetBVert(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss);
++		void GetBprimeAdvec(IssmDouble* Bprime_advec, IssmDouble* xyz_list, Gauss* gauss);
++		void GetBHOFriction(IssmDouble* L, Gauss* gauss);
++		void GetLFS(IssmDouble* LFS, Gauss* gauss);
++		void GetLprimeFS(IssmDouble* LprimeFS, IssmDouble* xyz_list, Gauss* gauss);
++		void GetLSSAFS(IssmDouble* LSSAFS, Gauss* gauss);
++		void GetLprimeSSAFS(IssmDouble* LprimeSSAFS, IssmDouble* xyz_list, Gauss* gauss);
++		void GetLFSSSA(IssmDouble* LFSSSA, Gauss* gauss);
++		void GetLprimeFSSSA(IssmDouble* LprimeFSSSA, IssmDouble* xyz_list, Gauss* gauss);
++		void GetInputValue(IssmDouble* pvalue,IssmDouble* plist, Gauss* gauss);
++		void GetInputDerivativeValue(IssmDouble* pvalues, IssmDouble* plist,IssmDouble* xyz_list, Gauss* gauss);
+ 
+ 		void BasalNodeIndices(int* pnumindices,int** pindices,int finiteelement);
+ 		void SurfaceNodeIndices(int* pnumindices,int** pindices,int finiteelement);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16817)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16818)
+@@ -22,7 +22,7 @@
+ class Tria;
+ class ElementMatrix;
+ class ElementVector;
+-
++class GaussPenta;
+ #include "../../shared/Exceptions/exceptions.h"
+ #include "../../shared/Enum/Enum.h"
+ /*}}}*/
+@@ -248,6 +248,7 @@
+ 		Gauss*         NewGauss(int order);
+ 		Gauss*         NewGaussBase(int order);
+ 		ElementVector* NewElementVector(int approximation_enum);
++		ElementMatrix* NewElementMatrix(int approximation_enum);
+ 		void           NodalFunctions(IssmDouble* basis,Gauss* gauss);
+ 		void           NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+ 		void           NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss);
+@@ -265,6 +266,11 @@
+ 		void           TransformSolutionCoord(IssmDouble* values,int* transformenum_list);
+ 		void           TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum);      /*Tiling only*/
+ 		void           TransformSolutionCoord(IssmDouble* values,int numnodes,int* transformenum_list);/*Tiling only*/
++		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum);
++		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* transformenum_list){_error_("not implemented yet");};
++		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int transformenum){_error_("not implemented yet");};
++		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int* transformenum_list){_error_("not implemented yet");};
++		void           ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
+ 
+ 		#ifdef _HAVE_STRESSBALANCE_
+ 		ElementMatrix* CreateKMatrixCouplingSSAHO(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16817)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16818)
+@@ -137,7 +137,9 @@
+ 		Gauss*      NewGauss(int order){_error_("not implemented yet");};
+ 		Gauss*      NewGaussBase(int order){_error_("not implemented yet");};
+ 		ElementVector* NewElementVector(int approximation_enum){_error_("not implemented yet");};
++		ElementMatrix* NewElementMatrix(int approximation_enum){_error_("not implemented yet");};
+ 		void           ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
++		void           ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
+ 		#ifdef _HAVE_THERMAL_
+ 		void UpdateBasalConstraintsEnthalpy(void){_error_("not implemented yet");};
+ 		void ComputeBasalMeltingrate(void){_error_("not implemented yet");};
+@@ -177,6 +179,10 @@
+ 		void        TransformSolutionCoord(IssmDouble* values,int* transformenum_list){_error_("not implemented yet");};
+ 		void        TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum){_error_("not implemented yet");};
+ 		void        TransformSolutionCoord(IssmDouble* values,int numnodes,int* transformenum_list){_error_("not implemented yet");};
++		void        TransformStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum){_error_("not implemented yet");};
++		void        TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* transformenum_list){_error_("not implemented yet");};
++		void        TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int transformenum){_error_("not implemented yet");};
++		void        TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int* transformenum_list){_error_("not implemented yet");};
+ 		void UpdateConstraintsExtrudeFromBase(){_error_("not implemented");};
+ 		void UpdateConstraintsExtrudeFromTop(){_error_("not implemented");};
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp	(revision 16817)
++++ ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp	(revision 16818)
+@@ -51,7 +51,7 @@
+ 
+ /*Reference Element numerics*/
+ /*FUNCTION TriaRef::GetBHydro {{{*/
+-void TriaRef::GetBHydro(IssmDouble* B, IssmDouble* xyz_list, GaussTria* gauss){
++void TriaRef::GetBHydro(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss){
+ 	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
+ 	 * by: 
+@@ -80,7 +80,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION TriaRef::GetBSSA {{{*/
+-void TriaRef::GetBSSA(IssmDouble* B, IssmDouble* xyz_list, GaussTria* gauss){
++void TriaRef::GetBSSA(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss){
+ 	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
+ 	 * by: 
+@@ -114,7 +114,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION TriaRef::GetBSSAFS {{{*/
+-void TriaRef::GetBSSAFS(IssmDouble* B, IssmDouble* xyz_list, GaussTria* gauss){
++void TriaRef::GetBSSAFS(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss){
+ 
+ 	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
+@@ -149,7 +149,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION TriaRef::GetSegmentBFlux{{{*/
+-void TriaRef::GetSegmentBFlux(IssmDouble* B,GaussTria* gauss, int index1,int index2){
++void TriaRef::GetSegmentBFlux(IssmDouble* B,Gauss* gauss, int index1,int index2){
+ 	/*Compute B  matrix. B=[phi1 phi2 -phi3 -phi4]
+ 	 *
+ 	 * and phi1=phi3 phi2=phi4
+@@ -175,7 +175,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION TriaRef::GetSegmentBprimeFlux{{{*/
+-void TriaRef::GetSegmentBprimeFlux(IssmDouble* Bprime,GaussTria* gauss, int index1,int index2){
++void TriaRef::GetSegmentBprimeFlux(IssmDouble* Bprime,Gauss* gauss, int index1,int index2){
+ 	/*Compute Bprime  matrix. Bprime=[phi1 phi2 phi3 phi4]
+ 	 *
+ 	 * and phi1=phi3 phi2=phi4
+@@ -201,7 +201,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION TriaRef::GetBExtrusion{{{*/
+-void TriaRef::GetBExtrusion(IssmDouble* B, IssmDouble* xyz_list, GaussTria* gauss){
++void TriaRef::GetBExtrusion(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss){
+ 	/*	Compute B  matrix. B=[dh1/dz dh2/dz dh3/dz dh4/dz dh5/dz dh6/dz];
+ 		where hi is the interpolation function for node i.*/
+ 
+@@ -222,7 +222,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION TriaRef::GetBFS {{{*/
+-void TriaRef::GetBFS(IssmDouble* B, IssmDouble* xyz_list, GaussTria* gauss){
++void TriaRef::GetBFS(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss){
+ 	/*Compute B  matrix. B=[Bv1 Bv2 ... Bp1 Bp2 ...] where Bvi is of size 3*NDOF3. 
+ 	 * For node i, Bvi can be expressed in the actual coordinate system
+ 	 * by: 	   Bvi=[ dphi/dx          0        ]
+@@ -277,7 +277,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION TriaRef::GetBprimeFS {{{*/
+-void TriaRef::GetBprimeFS(IssmDouble* B_prime, IssmDouble* xyz_list, GaussTria* gauss){
++void TriaRef::GetBprimeFS(IssmDouble* B_prime, IssmDouble* xyz_list, Gauss* gauss){
+ 	/*	Compute B'  matrix. B'=[B1' B2' B3' B4' B5' B6' Bb'] where Bi' is of size 3*NDOF2. 
+ 	 *	For node i, Bi' can be expressed in the actual coordinate system
+ 	 *	by: 
+@@ -332,7 +332,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION TriaRef::GetBMasstransport{{{*/
+-void TriaRef::GetBMasstransport(IssmDouble* B, IssmDouble* xyz_list, GaussTria* gauss){
++void TriaRef::GetBMasstransport(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss){
+ 	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
+ 	 * by: 
+@@ -361,7 +361,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION TriaRef::GetBprimeSSA {{{*/
+-void TriaRef::GetBprimeSSA(IssmDouble* Bprime, IssmDouble* xyz_list, GaussTria* gauss){
++void TriaRef::GetBprimeSSA(IssmDouble* Bprime, IssmDouble* xyz_list, Gauss* gauss){
+ 
+ 	/*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 
+ 	 * For node i, Bi' can be expressed in the actual coordinate system
+@@ -396,7 +396,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION TriaRef::GetBprimeSSAFS {{{*/
+-void TriaRef::GetBprimeSSAFS(IssmDouble* Bprime, IssmDouble* xyz_list, GaussTria* gauss){
++void TriaRef::GetBprimeSSAFS(IssmDouble* Bprime, IssmDouble* xyz_list, Gauss* gauss){
+ 	/*Compute Bprime  matrix. Bprime=[Bprime1 Bprime2 Bprime3] where Bprimei is of size 3*NDOF2. 
+ 	 * For node i, Bprimei can be expressed in the actual coordinate system
+ 	 * by: 
+@@ -433,7 +433,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION TriaRef::GetBprimeMasstransport{{{*/
+-void TriaRef::GetBprimeMasstransport(IssmDouble* Bprime, IssmDouble* xyz_list, GaussTria* gauss){
++void TriaRef::GetBprimeMasstransport(IssmDouble* Bprime, IssmDouble* xyz_list, Gauss* gauss){
+ 	/*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 
+ 	 * For node i, Bi' can be expressed in the actual coordinate system
+ 	 * by: 
+@@ -462,7 +462,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION TriaRef::GetBSSAFriction{{{*/
+-void TriaRef::GetBSSAFriction(IssmDouble* B, IssmDouble* xyz_list,GaussTria* gauss){
++void TriaRef::GetBSSAFriction(IssmDouble* B, IssmDouble* xyz_list,Gauss* gauss){
+ 	/*Compute B  matrix. B=[B1 B2 B3] where Bi is square and of size 2. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
+ 	 * by: 
+@@ -493,7 +493,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION TriaRef::GetLFS{{{*/
+-void TriaRef::GetLFS(IssmDouble* LFS, GaussTria* gauss){
++void TriaRef::GetLFS(IssmDouble* LFS, Gauss* gauss){
+ 	/* Compute L  matrix. L=[L1 L2 L3] where Li is square and of size numdof. 
+ 	 * For node i, Li can be expressed in the actual coordinate system
+ 	 * by: 
+@@ -526,7 +526,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION TriaRef::GetJacobian{{{*/
+-void TriaRef::GetJacobian(IssmDouble* J, IssmDouble* xyz_list,GaussTria* gauss){
++void TriaRef::GetJacobian(IssmDouble* J, IssmDouble* xyz_list,Gauss* gauss){
+ 	/*The Jacobian is constant over the element, discard the gaussian points. 
+ 	 * J is assumed to have been allocated of size NDOF2xNDOF2.*/
+ 
+@@ -544,7 +544,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION TriaRef::GetSegmentJacobianDeterminant{{{*/
+-void TriaRef::GetSegmentJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,GaussTria* gauss){
++void TriaRef::GetSegmentJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss){
+ 	/*The Jacobian determinant is constant over the element, discard the gaussian points. 
+ 	 * J is assumed to have been allocated*/
+ 
+@@ -559,7 +559,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION TriaRef::GetJacobianDeterminant{{{*/
+-void TriaRef::GetJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,GaussTria* gauss){
++void TriaRef::GetJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss){
+ 	/*The Jacobian determinant is constant over the element, discard the gaussian points. 
+ 	 * J is assumed to have been allocated of size NDOF2xNDOF2.*/
+ 	IssmDouble J[2][2];
+@@ -574,7 +574,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION TriaRef::GetJacobianInvert{{{*/
+-void TriaRef::GetJacobianInvert(IssmDouble*  Jinv, IssmDouble* xyz_list,GaussTria* gauss){
++void TriaRef::GetJacobianInvert(IssmDouble*  Jinv, IssmDouble* xyz_list,Gauss* gauss){
+ 
+ 	/*Jacobian*/
+ 	IssmDouble J[2][2];
+@@ -587,8 +587,8 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::GetNodalFunctions(IssmDouble* basis,GaussTria* gauss){{{*/
+-void TriaRef::GetNodalFunctions(IssmDouble* basis,GaussTria* gauss){
++/*FUNCTION TriaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss){{{*/
++void TriaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss){
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+ 
+ 	_assert_(basis);
+@@ -596,12 +596,16 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::GetNodalFunctions(IssmDouble* basis,GaussTria* gauss,int finiteelement){{{*/
+-void TriaRef::GetNodalFunctions(IssmDouble* basis,GaussTria* gauss,int finiteelement){
++/*FUNCTION TriaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss,int finiteelement){{{*/
++void TriaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss_in,int finiteelement){
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+ 
+ 	_assert_(basis);
+ 
++	/*Cast gauss to GaussTria*/
++	_assert_(gauss_in->Enum()==GaussTriaEnum);
++	GaussTria* gauss = dynamic_cast<GaussTria*>(gauss_in);
++
+ 	switch(finiteelement){
+ 		case P1Enum: case P1DGEnum:
+ 			basis[0]=gauss->coord1;
+@@ -632,7 +636,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION TriaRef::GetNodalFunctionsVelocity{{{*/
+-void TriaRef::GetNodalFunctionsVelocity(IssmDouble* basis,GaussTria* gauss){
++void TriaRef::GetNodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss){
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+ 
+ 	switch(this->element_type){
+@@ -667,7 +671,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION TriaRef::GetNodalFunctionsPressure{{{*/
+-void TriaRef::GetNodalFunctionsPressure(IssmDouble* basis,GaussTria* gauss){
++void TriaRef::GetNodalFunctionsPressure(IssmDouble* basis,Gauss* gauss){
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+ 
+ 	switch(this->element_type){
+@@ -702,7 +706,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION TriaRef::GetSegmentNodalFunctions{{{*/
+-void TriaRef::GetSegmentNodalFunctions(IssmDouble* basis,GaussTria* gauss,int index1,int index2){
++void TriaRef::GetSegmentNodalFunctions(IssmDouble* basis,Gauss* gauss,int index1,int index2){
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+ 
+ 	_assert_(index1>=0 && index1<3);
+@@ -741,15 +745,15 @@
+ 	xDelete<IssmDouble>(triabasis);
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTria* gauss){{{*/
+-void TriaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTria* gauss){
++/*FUNCTION TriaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){{{*/
++void TriaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){
+ 
+ 	GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss,this->element_type);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTria* gauss,int finiteelement){{{*/
+-void TriaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTria* gauss,int finiteelement){
++/*FUNCTION TriaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss,int finiteelement){{{*/
++void TriaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss,int finiteelement){
+ 
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+ 	 * actual coordinate system): */
+@@ -780,7 +784,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION TriaRef::GetNodalFunctionsDerivativesPressure{{{*/
+-void TriaRef::GetNodalFunctionsDerivativesPressure(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTria* gauss){
++void TriaRef::GetNodalFunctionsDerivativesPressure(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){
+ 	switch(this->element_type){
+ 		case P1P1Enum:
+ 			this->element_type = P1Enum;
+@@ -813,7 +817,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION TriaRef::GetNodalFunctionsDerivativesVelocity{{{*/
+-void TriaRef::GetNodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTria* gauss){
++void TriaRef::GetNodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){
+ 	switch(this->element_type){
+ 		case P1P1Enum:
+ 			this->element_type = P1Enum;
+@@ -845,8 +849,8 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTria* gauss){{{*/
+-void TriaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTria* gauss){
++/*FUNCTION TriaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss){{{*/
++void TriaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss){
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+ 	 * natural coordinate system) at the gaussian point. */
+ 
+@@ -854,13 +858,17 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTria* gauss,int finiteelement){{{*/
+-void TriaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTria* gauss,int finiteelement){
++/*FUNCTION TriaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss,int finiteelement){{{*/
++void TriaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss_in,int finiteelement){
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+ 	 * natural coordinate system) at the gaussian point. */
+ 
+-	_assert_(dbasis && gauss);
++	_assert_(dbasis && gauss_in);
+ 
++	/*Cast gauss to GaussTria*/
++	_assert_(gauss_in->Enum()==GaussTriaEnum);
++	GaussTria* gauss = dynamic_cast<GaussTria*>(gauss_in);
++
+ 	switch(finiteelement){
+ 		case P1Enum: case P1DGEnum:
+ 			/*Nodal function 1*/
+@@ -914,7 +922,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION TriaRef::GetInputDerivativeValue{{{*/
+-void TriaRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, GaussTria* gauss){
++void TriaRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, Gauss* gauss){
+ 
+ 	/*From node values of parameter p (plist[0],plist[1],plist[2]), return parameter derivative value at gaussian 
+ 	 * point specified by gauss_basis:
+@@ -946,14 +954,14 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTria* gauss){{{*/
+-void TriaRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTria* gauss){
++/*FUNCTION TriaRef::GetInputValue(IssmDouble* p, IssmDouble* plist, Gauss* gauss){{{*/
++void TriaRef::GetInputValue(IssmDouble* p, IssmDouble* plist, Gauss* gauss){
+ 
+ 	GetInputValue(p,plist,gauss,this->element_type);
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTria* gauss,int finiteelement){{{*/
+-void TriaRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTria* gauss,int finiteelement){
++/*FUNCTION TriaRef::GetInputValue(IssmDouble* p, IssmDouble* plist, Gauss* gauss,int finiteelement){{{*/
++void TriaRef::GetInputValue(IssmDouble* p, IssmDouble* plist, Gauss* gauss,int finiteelement){
+ 
+ 	/*Output*/
+ 	IssmDouble value =0.;
+Index: ../trunk-jpl/src/c/classes/Inputs/DoubleInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/DoubleInput.h	(revision 16817)
++++ ../trunk-jpl/src/c/classes/Inputs/DoubleInput.h	(revision 16818)
+@@ -8,8 +8,8 @@
+ /*Headers:*/
+ /*{{{*/
+ #include "./Input.h"
+-class GaussTria;
+-class GaussPenta;
++class Gauss;
++class Gauss;
+ /*}}}*/
+ 
+ class DoubleInput: public Input{
+@@ -52,13 +52,13 @@
+ 		void GetInputAverage(IssmDouble* pvalue);
+ 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
+ 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
+-		void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss);
+-		void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss);
+-		void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss);
++		void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss);
++		void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss);
++		void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss);
++		void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss);
++		void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, Gauss* gauss);
++		void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss);
++		void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss);
+ 		void ChangeEnum(int newenumtype);
+ 		void SquareMin(IssmDouble* psquaremin,Parameters* parameters);
+ 		void ConstrainMin(IssmDouble minimum);
+Index: ../trunk-jpl/src/c/classes/Inputs/ControlInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/ControlInput.cpp	(revision 16817)
++++ ../trunk-jpl/src/c/classes/Inputs/ControlInput.cpp	(revision 16818)
+@@ -234,18 +234,14 @@
+ void ControlInput::GetInputValue(IssmDouble* pvalue){
+ 	values->GetInputValue(pvalue);
+ }/*}}}*/
+-/*FUNCTION ControlInput::GetInputValue(Issm* pvalue,Gauss* gauss){{{*/
++/*FUNCTION ControlInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){{{*/
+ void ControlInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){
+ 	values->GetInputValue(pvalue,gauss);
+ }/*}}}*/
+-/*FUNCTION ControlInput::GetGradientValue(IssmDouble* pvalue,GaussTria* gauss){{{*/
+-void ControlInput::GetGradientValue(IssmDouble* pvalue,GaussTria* gauss){
++/*FUNCTION ControlInput::GetGradientValue{{{*/
++void ControlInput::GetGradientValue(IssmDouble* pvalue,Gauss* gauss){
+ 	gradient->GetInputValue(pvalue,gauss);
+ }/*}}}*/
+-/*FUNCTION ControlInput::GetGradientValue(IssmDouble* pvalue,GaussPenta* gauss){{{*/
+-void ControlInput::GetGradientValue(IssmDouble* pvalue,GaussPenta* gauss){
+-	gradient->GetInputValue(pvalue,gauss);
+-}/*}}}*/
+ /*FUNCTION ControlInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, Gauss* gauss){{{*/
+ void ControlInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, Gauss* gauss){
+ 	values->GetInputDerivativeValue(derivativevalues,xyz_list,gauss);
+Index: ../trunk-jpl/src/c/classes/Inputs/SegInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/SegInput.h	(revision 16817)
++++ ../trunk-jpl/src/c/classes/Inputs/SegInput.h	(revision 16818)
+@@ -10,7 +10,7 @@
+ #include "./Input.h"
+ #include "../Elements/SegRef.h"
+ class GaussSeg;
+-class GaussPenta;
++class Gauss;
+ /*}}}*/
+ 
+ class SegInput: public Input,public SegRef{
+@@ -53,13 +53,13 @@
+ 		void GetInputAverage(IssmDouble* pvalue);
+ 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
+ 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
+-		void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss){_error_("not implemented yet");};
+-		void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
++		void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+ 		void ChangeEnum(int newenumtype){_error_("not implemented yet");};
+ 
+ 		void SquareMin(IssmDouble* psquaremin,Parameters* parameters){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/Input.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/Input.h	(revision 16817)
++++ ../trunk-jpl/src/c/classes/Inputs/Input.h	(revision 16818)
+@@ -11,10 +11,10 @@
+ #include "../../shared/shared.h"
+ class Node;
+ class Gauss;
+-class GaussTria;
++class Gauss;
+ class GaussSeg;
+ class Parameters;
+-class GaussPenta;
++class Gauss;
+ template <class doubletype> class Vector;
+ /*}}}*/
+ 
+@@ -35,13 +35,13 @@
+ 		virtual void GetInputAverage(IssmDouble* pvalue)=0;
+ 		virtual void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes)=0;
+ 		virtual void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime)=0;
+-		virtual void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss)=0;
+-		virtual void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss)=0;
+-		virtual void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss)=0;
+-		virtual void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss)=0;
+-		virtual void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss)=0;
+-		virtual void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss)=0;
+-		virtual void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss)=0;
++		virtual void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss)=0;
++		virtual void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss)=0;
++		virtual void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss)=0;
++		virtual void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss)=0;
++		virtual void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, Gauss* gauss)=0;
++		virtual void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss)=0;
++		virtual void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss)=0;
+ 		virtual void ChangeEnum(int newenumtype)=0;
+ 		virtual void Configure(Parameters* parameters)=0;
+ 
+Index: ../trunk-jpl/src/c/classes/Inputs/ControlInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/ControlInput.h	(revision 16817)
++++ ../trunk-jpl/src/c/classes/Inputs/ControlInput.h	(revision 16818)
+@@ -8,8 +8,8 @@
+ /*Headers:*/
+ /*{{{*/
+ #include "./Input.h"
+-class GaussTria;
+-class GaussPenta;
++class Gauss;
++class Gauss;
+ /*}}}*/
+ 
+ class ControlInput: public Input{
+@@ -46,8 +46,7 @@
+ 		void Configure(Parameters* parameters);
+ 		/*}}}*/
+ 		/*numerics: {{{*/
+-		void GetGradientValue(IssmDouble* pvalue,GaussTria* gauss);
+-		void GetGradientValue(IssmDouble* pvalue,GaussPenta* gauss);
++		void GetGradientValue(IssmDouble* pvalue,Gauss* gauss);
+ 		void SetInput(Input* in_input);
+ 		void GetInputValue(bool* pvalue);
+ 		void GetInputValue(int* pvalue);
+@@ -59,13 +58,13 @@
+ 		void GetInputAverage(IssmDouble* pvalue);
+ 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
+ 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
+-		void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss){_error_("not implemented yet");};
+-		void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
++		void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+ 		void ChangeEnum(int newenumtype){_error_("not implemented yet");};
+ 		void SquareMin(IssmDouble* psquaremin,Parameters* parameters){_error_("not implemented yet");};
+ 		void ConstrainMin(IssmDouble minimum){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/DatasetInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/DatasetInput.h	(revision 16817)
++++ ../trunk-jpl/src/c/classes/Inputs/DatasetInput.h	(revision 16818)
+@@ -8,8 +8,8 @@
+ /*Headers:*/
+ /*{{{*/
+ #include "./Input.h"
+-class GaussTria;
+-class GaussPenta;
++class Gauss;
++class Gauss;
+ /*}}}*/
+ 
+ class DatasetInput: public Input{
+@@ -54,13 +54,13 @@
+ 		void GetInputAverage(IssmDouble* pvalue){_error_("not implemented yet");};
+ 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
+ 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
+-		void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss){_error_("not implemented yet");};
+-		void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
++		void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+ 		void ChangeEnum(int newenumtype){_error_("not implemented yet");};
+ 		void SquareMin(IssmDouble* psquaremin,Parameters* parameters){_error_("not implemented yet");};
+ 		void ConstrainMin(IssmDouble minimum){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 16817)
++++ ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 16818)
+@@ -141,7 +141,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION TriaInput::GetVxStrainRate2d{{{*/
+-void TriaInput::GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){
++void TriaInput::GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){
+ 
+ 	/*Intermediary*/
+ 	int numnodes=this->NumberofNodes();
+@@ -167,7 +167,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION TriaInput::GetVyStrainRate2d{{{*/
+-void TriaInput::GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss){
++void TriaInput::GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){
+ 
+ 	/*Intermediary*/
+ 	int numnodes=this->NumberofNodes();
+Index: ../trunk-jpl/src/c/classes/Inputs/IntInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/IntInput.h	(revision 16817)
++++ ../trunk-jpl/src/c/classes/Inputs/IntInput.h	(revision 16818)
+@@ -8,8 +8,8 @@
+ /*Headers:*/
+ /*{{{*/
+ #include "./Input.h"
+-class GaussTria;
+-class GaussPenta;
++class Gauss;
++class Gauss;
+ /*}}}*/
+ 
+ class IntInput: public Input{
+@@ -54,13 +54,13 @@
+ 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
+ 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
+ 
+-		void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss){_error_("not implemented yet");};
+-		void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
++		void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+ 		void ChangeEnum(int newenumtype);
+ 		void SquareMin(IssmDouble* psquaremin,Parameters* parameters);
+ 		void ConstrainMin(IssmDouble minimum){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/BoolInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/BoolInput.h	(revision 16817)
++++ ../trunk-jpl/src/c/classes/Inputs/BoolInput.h	(revision 16818)
+@@ -6,11 +6,7 @@
+ #define _BOOLINPUT_H_
+ 
+ /*Headers:*/
+-/*{{{*/
+ #include "./Input.h"
+-class GaussTria;
+-class GaussPenta;
+-/*}}}*/
+ 
+ class BoolInput: public Input{
+ 
+@@ -53,13 +49,13 @@
+ 		void GetInputAverage(IssmDouble* pvalue){_error_("not implemented yet");};
+ 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
+ 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
+-		void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss){_error_("not implemented yet");};
+-		void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
++		void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+ 		void ChangeEnum(int newenumtype);
+ 		void SquareMin(IssmDouble* psquaremin, Parameters* parameters);
+ 		void ConstrainMin(IssmDouble minimum){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/TriaInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TriaInput.h	(revision 16817)
++++ ../trunk-jpl/src/c/classes/Inputs/TriaInput.h	(revision 16818)
+@@ -9,8 +9,8 @@
+ /*{{{*/
+ #include "./Input.h"
+ #include "../Elements/TriaRef.h"
+-class GaussTria;
+-class GaussPenta;
++class Gauss;
++class Gauss;
+ /*}}}*/
+ 
+ class TriaInput: public Input,public TriaRef{
+@@ -53,13 +53,13 @@
+ 		void GetInputAverage(IssmDouble* pvalue);
+ 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes);
+ 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime);
+-		void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss);
+-		void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss);
+-		void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
++		void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss);
++		void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss);
++		void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+ 		void ChangeEnum(int newenumtype);
+ 
+ 		void SquareMin(IssmDouble* psquaremin,Parameters* parameters);
+Index: ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 16817)
++++ ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 16818)
+@@ -154,7 +154,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaInput::GetVxStrainRate3d{{{*/
+-void PentaInput::GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){
++void PentaInput::GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){
+ 
+ 	/*Intermediary*/
+ 	int         numnodes=this->NumberofNodes();
+@@ -180,7 +180,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaInput::GetVyStrainRate3d{{{*/
+-void PentaInput::GetVyStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){
++void PentaInput::GetVyStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){
+ 
+ 	/*Intermediary*/
+ 	int         numnodes=this->NumberofNodes();
+@@ -205,7 +205,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaInput::GetVzStrainRate3d{{{*/
+-void PentaInput::GetVzStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){
++void PentaInput::GetVzStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){
+ 
+ 	/*Intermediary*/
+ 	int         numnodes=this->NumberofNodes();
+@@ -230,7 +230,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaInput::GetVxStrainRate3dHO{{{*/
+-void PentaInput::GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){
++void PentaInput::GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){
+ 
+ 	int i;
+ 	const int numnodes=6;
+@@ -256,7 +256,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaInput::GetVyStrainRate3dHO{{{*/
+-void PentaInput::GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){
++void PentaInput::GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){
+ 
+ 	int i;
+ 	const int numnodes=6;
+Index: ../trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp	(revision 16817)
++++ ../trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp	(revision 16818)
+@@ -122,44 +122,44 @@
+ /*FUNCTION DoubleInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){{{*/
+ void DoubleInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){*pvalue=this->value;}
+ /*}}}*/
+-/*FUNCTION DoubleInput::GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){{{*/
+-void DoubleInput::GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){
++/*FUNCTION DoubleInput::GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){{{*/
++void DoubleInput::GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){
+ 	/*Epsilon is zero as vx is constant over the element*/
+ 	for(int i=0;i<3;i++) epsilonvx[i]=0;
+ }
+ /*}}}*/
+-/*FUNCTION DoubleInput::GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss){{{*/
+-void DoubleInput::GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss){
++/*FUNCTION DoubleInput::GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){{{*/
++void DoubleInput::GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){
+ 	/*Epsilon is zero as vy is constant over the element*/
+ 	for(int i=0;i<3;i++) epsilonvy[i]=0;
+ }
+ /*}}}*/
+-/*FUNCTION DoubleInput::GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){{{*/
+-void DoubleInput::GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){
++/*FUNCTION DoubleInput::GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){{{*/
++void DoubleInput::GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){
+ 	/*Epsilon is zero as vx is constant over the element*/
+ 	for(int i=0;i<6;i++) epsilonvx[i]=0;
+ }
+ /*}}}*/
+-/*FUNCTION DoubleInput::GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){{{*/
+-void DoubleInput::GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){
++/*FUNCTION DoubleInput::GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){{{*/
++void DoubleInput::GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){
+ 	/*Epsilon is zero as vy is constant over the element*/
+ 	for(int i=0;i<6;i++) epsilonvy[i]=0;
+ }
+ /*}}}*/
+-/*FUNCTION DoubleInput::GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss){{{*/
+-void DoubleInput::GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss){
++/*FUNCTION DoubleInput::GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, Gauss* gauss){{{*/
++void DoubleInput::GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, Gauss* gauss){
+ 	/*Epsilon is zero as vz is constant over the element*/
+ 	for(int i=0;i<6;i++) epsilonvz[i]=0;
+ }
+ /*}}}*/
+-/*FUNCTION DoubleInput::GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){{{*/
+-void DoubleInput::GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){
++/*FUNCTION DoubleInput::GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){{{*/
++void DoubleInput::GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){
+ 	/*Epsilon is zero as vx is constant over the element*/
+ 	for(int i=0;i<5;i++) epsilonvx[i]=0;
+ }
+ /*}}}*/
+-/*FUNCTION DoubleInput::GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){{{*/
+-void DoubleInput::GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){
++/*FUNCTION DoubleInput::GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){{{*/
++void DoubleInput::GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){
+ 	/*Epsilon is zero as vy is constant over the element*/
+ 	for(int i=0;i<5;i++) epsilonvy[i]=0;
+ }
+Index: ../trunk-jpl/src/c/classes/Inputs/PentaInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/PentaInput.h	(revision 16817)
++++ ../trunk-jpl/src/c/classes/Inputs/PentaInput.h	(revision 16818)
+@@ -9,8 +9,8 @@
+ /*{{{*/
+ #include "./Input.h"
+ #include "../Elements/PentaRef.h"
+-class GaussTria;
+-class GaussPenta;
++class Gauss;
++class Gauss;
+ /*}}}*/
+ 
+ class PentaInput: public Input, public PentaRef{
+@@ -53,13 +53,13 @@
+ 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
+ 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
+ 
+-		void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss){_error_("not implemented yet");};
+-		void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss);
+-		void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss);
++		void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss);
++		void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss);
++		void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, Gauss* gauss);
++		void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss);
++		void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss);
+ 		void ChangeEnum(int newenumtype);
+ 
+ 		void SquareMin(IssmDouble* psquaremin,Parameters* parameters);
+Index: ../trunk-jpl/src/c/classes/Inputs/TransientInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TransientInput.h	(revision 16817)
++++ ../trunk-jpl/src/c/classes/Inputs/TransientInput.h	(revision 16818)
+@@ -8,9 +8,9 @@
+ /*Headers:*/
+ /*{{{*/
+ #include "./Input.h"
+-class GaussTria;
++class Gauss;
+ class Parameters;
+-class GaussPenta;
++class Gauss;
+ /*}}}*/
+ 
+ class TransientInput: public Input{
+@@ -58,13 +58,13 @@
+ 		void GetInputAverage(IssmDouble* pvalue);
+ 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes);
+ 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime);
+-		void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss){_error_("not implemented yet");};
+-		void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};
++		void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
++		void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+ 		void ChangeEnum(int newenumtype);
+ 
+ 		void SquareMin(IssmDouble* psquaremin,Parameters* parameters);
Index: issm/oecreview/Archive/16554-17801/ISSM-16818-16819.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16818-16819.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16818-16819.diff	(revision 17802)
@@ -0,0 +1,24 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 16818)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 16819)
+@@ -35,6 +35,7 @@
+ 	}
+ 
+ 	iomodel->FetchDataToInput(elements,ThicknessEnum);
++	iomodel->FetchDataToInput(elements,FrictionCoefficientEnum);
+ 
+ 	/*Free data: */
+ 	iomodel->DeleteData(1,FlowequationElementEquationEnum);
+Index: ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 16818)
++++ ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 16819)
+@@ -71,7 +71,6 @@
+ 	/*Fill stiffness matrix and load vector from elements*/
+ 	for (i=0;i<femmodel->elements->Size();i++){
+ 		element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+-		element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+ 		//ElementVector* pe = analysis->CreatePVector(element);
+ 		//ElementMatrix* Ke = analysis->CreateKMatrix(element);
+ 		ElementVector* pe = element->CreatePVector();
Index: issm/oecreview/Archive/16554-17801/ISSM-16819-16820.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16819-16820.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16819-16820.diff	(revision 17802)
@@ -0,0 +1,31 @@
+Index: ../trunk-jpl/src/m/consistency/checkfield.m
+===================================================================
+--- ../trunk-jpl/src/m/consistency/checkfield.m	(revision 16819)
++++ ../trunk-jpl/src/m/consistency/checkfield.m	(revision 16820)
+@@ -173,16 +173,21 @@
+ 	end
+ end
+ 
+-%Check row of strings
++%Check row of stringrow
+ if getfieldvalue(options,'stringrow',0),
+ 	if(size(field,1)~=1 & size(field,1)~=0),
+ 		md = checkmessage(md,getfieldvalue(options,'message',...
+ 			['field ''' fieldname ''' should have only one row']));
+ 	end
+-	for i=1:size(field,2),
+-		if ~ischar(field{i}),
+-			md = checkmessage(md,getfieldvalue(options,'message',...
+-				['field ''' fieldname ''' values should a cell of chars']));
++	if ~iscell(field),
++		md = checkmessage(md,getfieldvalue(options,'message',...
++			['field ''' fieldname ''' should be a cell of strings']));
++	else
++		for i=1:size(field,2),
++			if ~ischar(field{i}),
++				md = checkmessage(md,getfieldvalue(options,'message',...
++					['field ''' fieldname ''' values should a cell of chars']));
++			end
+ 		end
+ 	end
+ end
Index: issm/oecreview/Archive/16554-17801/ISSM-16820-16821.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16820-16821.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16820-16821.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/m/consistency/ismodelselfconsistent.m
+===================================================================
+--- ../trunk-jpl/src/m/consistency/ismodelselfconsistent.m	(revision 16820)
++++ ../trunk-jpl/src/m/consistency/ismodelselfconsistent.m	(revision 16821)
+@@ -24,6 +24,7 @@
+ 	%Check that current field is an object
+ 	if ~isobject(md.(field))
+ 		md=checkmessage(md,['field ''' char(field) ''' is not an object']);
++		continue;
+ 	end
+ 
+ 	%Check consistency of the object
Index: issm/oecreview/Archive/16554-17801/ISSM-16821-16822.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16821-16822.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16821-16822.diff	(revision 17802)
@@ -0,0 +1,15 @@
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 16821)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 16822)
+@@ -99,6 +99,10 @@
+ 				md.damage.D=zeros(md.mesh.numberofvertices,1);
+ 				md.damage.spcdamage=NaN*ones(md.mesh.numberofvertices,1);
+ 			end
++			%2013 November 18
++			if ~isa(md.outputdefinition,'outputdefinition'),
++				md.outputdefinition=outputdefinition();
++			end
+ 		end% }}}
+ 	end
+ 	methods
Index: issm/oecreview/Archive/16554-17801/ISSM-16822-16823.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16822-16823.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16822-16823.diff	(revision 17802)
@@ -0,0 +1,90 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16822)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16823)
+@@ -4219,8 +4219,8 @@
+ ElementVector* Tria::CreatePVectorStressbalanceSIA(void){
+ 
+ 	/*Intermediaries */
+-	IssmDouble constant_part,ub,vb;
+-	IssmDouble rho_ice,gravity,n,B;
++	IssmDouble ub,vb;
++	IssmDouble rho_ice,gravity,n,B,drag;
+ 	IssmDouble slope2,thickness,connectivity;
+ 	IssmDouble slope[2];
+ 
+@@ -4238,6 +4238,7 @@
+ 	Input* slopex_input=inputs->GetInput(SurfaceSlopeXEnum); _assert_(slopex_input);
+ 	Input* slopey_input=inputs->GetInput(SurfaceSlopeYEnum); _assert_(slopey_input);
+ 	Input* thickness_input=inputs->GetInput(ThicknessEnum);  _assert_(thickness_input);
++	Input* drag_input=inputs->GetInput(FrictionCoefficientEnum);  _assert_(drag_input);
+ 
+ 	/*Spawn 3 sing elements: */
+ 	GaussTria* gauss=new GaussTria();
+@@ -4248,14 +4249,20 @@
+ 		connectivity=(IssmDouble)vertices[i]->Connectivity();
+ 
+ 		thickness_input->GetInputValue(&thickness,gauss);
++		drag_input->GetInputValue(&drag,gauss);
+ 		slopex_input->GetInputValue(&slope[0],gauss);
+ 		slopey_input->GetInputValue(&slope[1],gauss);
+-		slope2=pow(slope[0],2)+pow(slope[1],2);
++		slope2=slope[0]*slope[0]+slope[1]*slope[1];
+ 
+-		constant_part=-2.*pow(rho_ice*gravity,n)*pow(slope2,((n-1.)/2.));
+-
++		/*No ref...*/
+ 		ub=-1.58*1.e-10*rho_ice*gravity*thickness*slope[0];
+ 		vb=-1.58*1.e-10*rho_ice*gravity*thickness*slope[1];
++		///*Ritz et al. 1996*/
++		//ub=drag*(rho_ice*gravity*thickness)*(rho_ice*gravity*thickness)*slope[0]/sqrt(slope2);
++		//vb=drag*(rho_ice*gravity*thickness)*(rho_ice*gravity*thickness)*slope[1]/sqrt(slope2);
++		///*Rutt et al. 2009*/
++		//ub=-drag*rho_ice*gravity*thickness*slope[0];
++		//vb=-drag*rho_ice*gravity*thickness*slope[1];
+ 
+ 		pe->values[2*i+0]=(ub-2.*pow(rho_ice*gravity,n)*pow(slope2,((n-1.)/2.))*pow(thickness,n)/(pow(B,n)*(n+1))*slope[0])/connectivity;
+ 		pe->values[2*i+1]=(vb-2.*pow(rho_ice*gravity,n)*pow(slope2,((n-1.)/2.))*pow(thickness,n)/(pow(B,n)*(n+1))*slope[1])/connectivity;
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16822)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16823)
+@@ -8446,7 +8446,7 @@
+ 	IssmDouble  xyz_list_segment[2][3];
+ 	IssmDouble  z_list[NUMVERTICES];
+ 	IssmDouble  slope[2];
+-	IssmDouble  slope2,constant_part;
++	IssmDouble  slope2,constant_part,drag;
+ 	IssmDouble  rho_ice,gravity,n,B;
+ 	IssmDouble  ub,vb,z_g,surface,thickness;
+ 	GaussPenta* gauss=NULL;
+@@ -8467,6 +8467,7 @@
+ 	Input* surface_input=inputs->GetInput(SurfaceEnum);      _assert_(surface_input);
+ 	Input* slopex_input=inputs->GetInput(SurfaceSlopeXEnum); _assert_(slopex_input);
+ 	Input* slopey_input=inputs->GetInput(SurfaceSlopeYEnum); _assert_(slopey_input);
++	Input* drag_input=inputs->GetInput(FrictionCoefficientEnum);  _assert_(drag_input);
+ 	for(i=0;i<NUMVERTICES;i++)z_list[i]=xyz_list[i][2];
+ 
+ 	/*Loop on the three segments*/
+@@ -8511,10 +8512,18 @@
+ 
+ 		/*Deal with lower surface*/
+ 		if(IsOnBed()){
+-			constant_part=-1.58*1.e-10*rho_ice*gravity*thickness;
+-			ub=constant_part*slope[0];
+-			vb=constant_part*slope[1];
++			drag_input->GetInputValue(&drag,gauss);
+ 
++			/*No ref...*/
++			ub=-1.58*1.e-10*rho_ice*gravity*thickness*slope[0];
++			vb=-1.58*1.e-10*rho_ice*gravity*thickness*slope[1];
++			///*Ritz et al. 1996*/
++			//ub=drag*(rho_ice*gravity*thickness)*(rho_ice*gravity*thickness)*slope[0]/sqrt(slope2);
++			//vb=drag*(rho_ice*gravity*thickness)*(rho_ice*gravity*thickness)*slope[1]/sqrt(slope2);
++			///*Rutt et al. 2009*/
++			//ub=-drag*rho_ice*gravity*thickness*slope[0];
++			//vb=-drag*rho_ice*gravity*thickness*slope[1];
++
+ 			pe->values[2*node0+0]+=ub/connectivity[0];
+ 			pe->values[2*node0+1]+=vb/connectivity[0];
+ 		}
Index: issm/oecreview/Archive/16554-17801/ISSM-16823-16824.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16823-16824.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16823-16824.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16823)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16824)
+@@ -4254,7 +4254,7 @@
+ 		slopey_input->GetInputValue(&slope[1],gauss);
+ 		slope2=slope[0]*slope[0]+slope[1]*slope[1];
+ 
+-		/*No ref...*/
++		/*Payne 1995 (m = 1, B = 5e-3/yts = 1.58e-10  m/s/Pa*/
+ 		ub=-1.58*1.e-10*rho_ice*gravity*thickness*slope[0];
+ 		vb=-1.58*1.e-10*rho_ice*gravity*thickness*slope[1];
+ 		///*Ritz et al. 1996*/
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16823)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16824)
+@@ -8514,7 +8514,7 @@
+ 		if(IsOnBed()){
+ 			drag_input->GetInputValue(&drag,gauss);
+ 
+-			/*No ref...*/
++			/*Payne 1995 (m = 1, B = 5e-3/yts = 1.58e-10  m/s/Pa*/
+ 			ub=-1.58*1.e-10*rho_ice*gravity*thickness*slope[0];
+ 			vb=-1.58*1.e-10*rho_ice*gravity*thickness*slope[1];
+ 			///*Ritz et al. 1996*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16824-16825.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16824-16825.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16824-16825.diff	(revision 17802)
@@ -0,0 +1,52 @@
+Index: ../trunk-jpl/test/NightlyRun/test508.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test508.py	(revision 16824)
++++ ../trunk-jpl/test/NightlyRun/test508.py	(revision 16825)
+@@ -18,7 +18,7 @@
+ 
+ # Fields and tolerances to track changes
+ field_names     =['Vx','Vy','Vz','Vel','Pressure','Temperature','BasalforcingsMeltingRate']
+-field_tolerances=[7.85e-09,8.15e-09,1.5e-08,8.5e-09,1e-09,1e-09,1e-07]
++field_tolerances=[5e-08,8.15e-09,5e-08,8.5e-09,1e-09,2e-09,3e-07]
+ field_values=[\
+ 	md.results.SteadystateSolution.Vx,\
+ 	md.results.SteadystateSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test508.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test508.m	(revision 16824)
++++ ../trunk-jpl/test/NightlyRun/test508.m	(revision 16825)
+@@ -9,7 +9,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure','Temperature','BasalforcingsMeltingRate'};
+-field_tolerances={7.85e-09,8.15e-09,1.5e-08,8.5e-09,1e-09,1e-09,1e-07};
++field_tolerances={5e-08,8.15e-09,5e-08,8.5e-09,1e-09,2e-07,3e-07};
+ field_values={...
+ 	(md.results.SteadystateSolution.Vx),...
+ 	(md.results.SteadystateSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test513.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test513.py	(revision 16824)
++++ ../trunk-jpl/test/NightlyRun/test513.py	(revision 16825)
+@@ -35,7 +35,7 @@
+ 
+ # Fields and tolerances to track changes
+ field_names     =['Gradient','Misfits','FrictionCoefficient','Pressure','Vel','Vx','Vy','Vz','Temperature','BasalforcingsMeltingRate']
+-field_tolerances=[2e-10,2e-10,1e-10,1e-10,1e-6,1e-6,1e-6,1e-6,1e-6,1e-06]
++field_tolerances=[2e-10,2e-10,1e-10,1e-10,1e-6,1e-6,1e-6,1e-6,1e-6,2e-06]
+ field_values=[\
+ 	md.results.SteadystateSolution.Gradient1,\
+ 	md.results.SteadystateSolution.J,\
+Index: ../trunk-jpl/test/NightlyRun/test513.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test513.m	(revision 16824)
++++ ../trunk-jpl/test/NightlyRun/test513.m	(revision 16825)
+@@ -24,7 +24,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Gradient','Misfits','FrictionCoefficient','Pressure','Vel','Vx','Vy','Vz','Temperature','BasalforcingsMeltingRate'};
+-field_tolerances={2e-10,2e-10,1e-10,1e-10,1e-6,1e-6,1e-6,1e-6,1e-6,1e-06};
++field_tolerances={2e-10,2e-10,1e-10,1e-10,1e-6,1e-6,1e-6,1e-6,1e-6,2e-06};
+ field_values={...
+ 	(md.results.SteadystateSolution.Gradient1),...
+ 	md.results.SteadystateSolution.J,...
Index: issm/oecreview/Archive/16554-17801/ISSM-16825-16826.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16825-16826.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16825-16826.diff	(revision 17802)
@@ -0,0 +1,20 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16825)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16826)
+@@ -8508,7 +8508,6 @@
+ 				pe->values[2*node1+1]+=constant_part*pow((surface-z_g)/B,n)*slope[1]*Jdet*gauss->weight*2./connectivity[1];
+ 			}
+ 		}
+-		delete gauss;
+ 
+ 		/*Deal with lower surface*/
+ 		if(IsOnBed()){
+@@ -8527,6 +8526,7 @@
+ 			pe->values[2*node0+0]+=ub/connectivity[0];
+ 			pe->values[2*node0+1]+=vb/connectivity[0];
+ 		}
++		delete gauss;
+ 	}
+ 
+ 	/*Clean up and return*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16826-16827.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16826-16827.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16826-16827.diff	(revision 17802)
@@ -0,0 +1,531 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 16826)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 16827)
+@@ -96,8 +96,104 @@
+ 
+ /*Finite Element Analysis*/
+ ElementMatrix* StressbalanceVerticalAnalysis::CreateKMatrix(Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	/*compute all stiffness matrices for this element*/
++	ElementMatrix* Ke1=CreateKMatrixVolume(element);
++	ElementMatrix* Ke2=CreateKMatrixSurface(element);
++	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
++	//Ke1->Echo();
++	//Ke2->Echo();
++	//Ke=element->CreateKMatrix();
++	//_error_("S");
++
++	/*clean-up and return*/
++	delete Ke1;
++	delete Ke2;
++	return Ke;
++
+ }/*}}}*/
++ElementMatrix* StressbalanceVerticalAnalysis::CreateKMatrixVolume(Element* element){/*{{{*/
++
++	/*Intermediaries*/
++	IssmDouble  D,Jdet;
++	IssmDouble *xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element matrix and vectors*/
++	ElementMatrix* Ke     = element->NewElementMatrix(NoneApproximationEnum);
++	IssmDouble*    B      = xNew<IssmDouble>(numnodes);
++	IssmDouble*    Bprime = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss = element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		this->GetB(B,element,xyz_list,gauss);
++		this->GetBprime(Bprime,element,xyz_list,gauss);
++		D=gauss->weight*Jdet;
++
++		TripleMultiply(B,1,numnodes,1,
++					&D,1,1,0,
++					Bprime,1,numnodes,0,
++					&Ke->values[0],1);
++	}
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(Bprime);
++	xDelete<IssmDouble>(B);
++	return Ke;
++
++}/*}}}*/
++ElementMatrix* StressbalanceVerticalAnalysis::CreateKMatrixSurface(Element* element){/*{{{*/
++
++
++	if(!element->IsOnSurface()) return NULL;
++
++	/*Intermediaries*/
++	IssmDouble  D,Jdet,normal[3];
++	IssmDouble *xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element matrix and vectors*/
++	ElementMatrix* Ke    = element->NewElementMatrix(NoneApproximationEnum);
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinatesTop(&xyz_list);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss = element->NewGaussTop(2);
++	element->NormalTop(&normal[0],xyz_list);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminantTop(&Jdet,xyz_list,gauss);
++		element->NodalFunctions(basis,gauss);
++		D = -gauss->weight*Jdet*normal[2];
++
++		TripleMultiply( basis,1,numnodes,1,
++					&D,1,1,0,
++					basis,1,numnodes,0,
++					&Ke->values[0],1);
++	}
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	return Ke;
++}/*}}}*/
+ ElementVector* StressbalanceVerticalAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+ 	/*compute all load vectors for this element*/
+@@ -221,6 +317,30 @@
+ 	xDelete<IssmDouble>(xyz_list_base);
+ 	return pe;
+ }/*}}}*/
++void StressbalanceVerticalAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*	Compute B  matrix. B=[dh1/dz dh2/dz dh3/dz dh4/dz dh5/dz dh6/dz];
++		where hi is the interpolation function for node i.*/
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* dbasis=xNew<IssmDouble>(3*numnodes);
++	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Build B: */
++	for(int i=0;i<numnodes;i++){
++		B[i] = dbasis[2*numnodes+i];  
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(dbasis);
++}/*}}}*/
++void StressbalanceVerticalAnalysis::GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++
++	element->NodalFunctions(Bprime,gauss);
++
++}/*}}}*/
+ void StressbalanceVerticalAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,VzEnum);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16826)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16827)
+@@ -843,8 +843,8 @@
+ 	}
+ 
+ 	/*compute all stiffness matrices for this element*/
+-	ElementMatrix* Ke1=CreateKMatrixSSAViscous(element);
+-	ElementMatrix* Ke2=CreateKMatrixSSAFriction(element);
++	ElementMatrix* Ke1=CreateKMatrixSSAViscous(basalelement);
++	ElementMatrix* Ke2=CreateKMatrixSSAFriction(basalelement);
+ 	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
+ 
+ 	/*clean-up and return*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h	(revision 16826)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h	(revision 16827)
+@@ -21,9 +21,13 @@
+ 
+ 		/*Finite element Analysis*/
+ 		ElementMatrix* CreateKMatrix(Element* element);
++		ElementMatrix* CreateKMatrixVolume(Element* element);
++		ElementMatrix* CreateKMatrixSurface(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+ 		ElementVector* CreatePVectorVolume(Element* element);
+ 		ElementVector* CreatePVectorBase(Element* element);
++		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16826)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16827)
+@@ -60,6 +60,7 @@
+ 		virtual void   NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss)=0;
+ 		virtual void   NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss)=0;
+ 		virtual void   NormalBase(IssmDouble* normal,IssmDouble* xyz_list)=0;
++		virtual void   NormalTop(IssmDouble* normal,IssmDouble* xyz_list)=0;
+ 		virtual IssmDouble PureIceEnthalpy(IssmDouble pressure)=0;
+ 		virtual void   TransformLoadVectorCoord(ElementVector* pe,int transformenum)=0;
+ 		virtual void   TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list)=0;
+@@ -79,6 +80,7 @@
+ 		virtual void	GetDofListPressure(int** pdoflist,int setenum)=0;
+ 		virtual void   JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss)=0;
+ 		virtual void   JacobianDeterminantBase(IssmDouble* Jdet,IssmDouble* xyz_list_base,Gauss* gauss)=0;
++		virtual void   JacobianDeterminantTop(IssmDouble* Jdet,IssmDouble* xyz_list_base,Gauss* gauss)=0;
+ 		virtual void   GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int solutionenum)=0;
+ 		virtual int    GetNodeIndex(Node* node)=0;
+ 		virtual int    GetNumberOfNodes(void)=0;
+@@ -92,6 +94,7 @@
+ 		virtual bool   IsFloating()=0; 
+ 		virtual bool   IsNodeOnShelfFromFlags(IssmDouble* flags)=0; 
+ 		virtual bool   IsOnBed()=0;
++		virtual bool   IsOnSurface()=0;
+ 		virtual void   GetInputListOnNodes(IssmDouble* pvalue,int enumtype)=0;
+ 		virtual void   GetInputListOnNodes(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue)=0;
+ 		virtual void   GetInputListOnVertices(IssmDouble* pvalue,int enumtype)=0;
+@@ -103,6 +106,7 @@
+ 		virtual void   GetInputValue(IssmDouble* pvalue,int enum_type)=0;
+ 		virtual void   GetVerticesCoordinates(IssmDouble** xyz_list)=0;
+ 		virtual void   GetVerticesCoordinatesBase(IssmDouble** xyz_list)=0;
++		virtual void   GetVerticesCoordinatesTop(IssmDouble** xyz_list)=0;
+ 		virtual void   GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype)=0;
+ 
+ 		virtual IssmDouble SurfaceArea(void)=0;
+@@ -124,6 +128,7 @@
+ 		virtual Gauss* NewGauss(void)=0;
+ 		virtual Gauss* NewGauss(int order)=0;
+ 		virtual Gauss* NewGaussBase(int order)=0;
++		virtual Gauss* NewGaussTop(int order)=0;
+ 		virtual ElementVector*  NewElementVector(int approximation_enum=NoneApproximationEnum)=0;
+ 		virtual ElementMatrix*  NewElementMatrix(int approximation_enum=NoneApproximationEnum)=0;
+ 		virtual void   InputScale(int enum_type,IssmDouble scale_factor)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16826)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16827)
+@@ -1985,6 +1985,20 @@
+ 	}
+ }
+ /*}}}*/
++/*FUNCTION Tria::IsOnSurface {{{*/
++bool Tria::IsOnSurface(){
++
++	int meshtype;
++	this->parameters->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum:
++			return HasEdgeOnSurface();
++		case Mesh2DhorizontalEnum:
++			return true;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++}
++/*}}}*/
+ /*FUNCTION Tria::JacobianDeterminant{{{*/
+ void Tria::JacobianDeterminant(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16826)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16827)
+@@ -94,6 +94,7 @@
+ 		int         GetNumberOfVertices(void);
+ 		int         Sid();
+ 		bool        IsOnBed();
++		bool        IsOnSurface();
+ 		bool        HasEdgeOnBed();
+ 		bool        HasNodeOnBed();
+ 		bool        HasEdgeOnSurface();
+@@ -111,6 +112,7 @@
+ 		void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum);
+ 		void        GetVerticesCoordinates(IssmDouble** pxyz_list);
+ 		void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list){_error_("not implemented yet");};
++		void        GetVerticesCoordinatesTop(IssmDouble** pxyz_list){_error_("not implemented yet");};
+ 		void        InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);
+ 		void        InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum=MeshElementsEnum);
+ 		void        InputDuplicate(int original_enum,int new_enum);
+@@ -252,6 +254,7 @@
+ 		void           GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating);
+ 		IssmDouble     GetGroundedPortion(IssmDouble* xyz_list);
+ 		void           NormalBase(IssmDouble* normal,IssmDouble* xyz_list);
++		void           NormalTop(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		IssmDouble     GetMaterialParameter(int enum_in);
+ 		void           GetZeroLevelsetCoordinates(IssmDouble* xyz_zero,IssmDouble xyz_list[3][3],int levelsetenum);
+ 		Input*         GetInput(int inputenum);
+@@ -272,10 +275,12 @@
+ 		bool	         IsInput(int name);
+ 		void           JacobianDeterminant(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss);
+ 		void           JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
++		void           JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
+ 		IssmDouble     MinEdgeLength(IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		Gauss*         NewGauss(void);
+ 		Gauss*         NewGauss(int order);
+ 		Gauss*         NewGaussBase(int order){_error_("not implemented yet");};
++		Gauss*         NewGaussTop(int order){_error_("not implemented yet");};
+ 		ElementVector* NewElementVector(int approximation_enum);
+ 		ElementMatrix* NewElementMatrix(int approximation_enum);
+ 		void           NodalFunctions(IssmDouble* basis,Gauss* gauss);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16826)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16827)
+@@ -161,30 +161,6 @@
+ }
+ /*}}}*/
+ 
+-/*FUNCTION Penta::NormalBase {{{*/
+-void Penta::NormalBase(IssmDouble* bed_normal,IssmDouble* xyz_list){
+-
+-	int i;
+-	IssmDouble v13[3],v23[3];
+-	IssmDouble normal[3];
+-	IssmDouble normal_norm;
+-
+-	for (i=0;i<3;i++){
+-		v13[i]=xyz_list[0*3+i]-xyz_list[2*3+i];
+-		v23[i]=xyz_list[1*3+i]-xyz_list[2*3+i];
+-	}
+-
+-	normal[0]=v13[1]*v23[2]-v13[2]*v23[1];
+-	normal[1]=v13[2]*v23[0]-v13[0]*v23[2];
+-	normal[2]=v13[0]*v23[1]-v13[1]*v23[0];
+-	normal_norm=sqrt( pow(normal[0],2)+pow(normal[1],2)+pow(normal[2],2) );
+-
+-	/*Bed normal is opposite to surface normal*/
+-	bed_normal[0]=-normal[0]/normal_norm;
+-	bed_normal[1]=-normal[1]/normal_norm;
+-	bed_normal[2]=-normal[2]/normal_norm;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::BasalFrictionCreateInput {{{*/
+ void Penta::BasalFrictionCreateInput(void){
+ 
+@@ -1465,6 +1441,16 @@
+ 	*pxyz_list = xyz_list;
+ 
+ }/*}}}*/
++/*FUNCTION Penta::GetVerticesCoordinatesTop(IssmDouble** pxyz_list){{{*/
++void Penta::GetVerticesCoordinatesTop(IssmDouble** pxyz_list){
++
++	IssmDouble* xyz_list = xNew<IssmDouble>(NUMVERTICES2D*3);
++	::GetVerticesCoordinates(xyz_list,&this->vertices[3],NUMVERTICES2D);
++
++	/*Assign output pointer*/
++	*pxyz_list = xyz_list;
++
++}/*}}}*/
+ /*FUNCTION Penta::GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype) {{{*/
+ void Penta::GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype){
+ 
+@@ -2335,6 +2321,14 @@
+ 	return onbed;
+ }
+ /*}}}*/
++/*FUNCTION Penta::IsOnSurface{{{*/
++bool Penta::IsOnSurface(void){
++
++	bool onsurface;
++	inputs->GetInputValue(&onsurface,MeshElementonsurfaceEnum);
++	return onsurface;
++}
++/*}}}*/
+ /*FUNCTION Penta::IsInput{{{*/
+ bool Penta::IsInput(int name){
+ 	if (
+@@ -2435,14 +2429,6 @@
+ 	return shelf;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::IsOnSurface{{{*/
+-bool Penta::IsOnSurface(void){
+-
+-	bool onsurface;
+-	inputs->GetInputValue(&onsurface,MeshElementonsurfaceEnum);
+-	return onsurface;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::JacobianDeterminant{{{*/
+ void Penta::JacobianDeterminant(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){
+ 
+@@ -2459,6 +2445,14 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Penta::JacobianDeterminantTop{{{*/
++void Penta::JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_top,Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussPentaEnum);
++	this->GetTriaJacobianDeterminant(pJdet,xyz_list_top,(GaussPenta*)gauss);
++
++}
++/*}}}*/
+ /*FUNCTION Penta::NoIceInElement {{{*/
+ bool   Penta::NoIceInElement(){
+ 
+@@ -2542,6 +2536,11 @@
+ 	return new GaussPenta(0,1,2,order);
+ }
+ /*}}}*/
++/*FUNCTION Penta::NewGaussTop(int order){{{*/
++Gauss* Penta::NewGaussTop(int order){
++	return new GaussPenta(3,4,5,order);
++}
++/*}}}*/
+ /*FUNCTION Penta::NewElementVector{{{*/
+ ElementVector* Penta::NewElementVector(int approximation_enum){
+ 	return new ElementVector(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
+@@ -2584,6 +2583,53 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Penta::NormalBase {{{*/
++void Penta::NormalBase(IssmDouble* bed_normal,IssmDouble* xyz_list){
++
++	int i;
++	IssmDouble v13[3],v23[3];
++	IssmDouble normal[3];
++	IssmDouble normal_norm;
++
++	for (i=0;i<3;i++){
++		v13[i]=xyz_list[0*3+i]-xyz_list[2*3+i];
++		v23[i]=xyz_list[1*3+i]-xyz_list[2*3+i];
++	}
++
++	normal[0]=v13[1]*v23[2]-v13[2]*v23[1];
++	normal[1]=v13[2]*v23[0]-v13[0]*v23[2];
++	normal[2]=v13[0]*v23[1]-v13[1]*v23[0];
++	normal_norm=sqrt( pow(normal[0],2)+pow(normal[1],2)+pow(normal[2],2) );
++
++	/*Bed normal is opposite to surface normal*/
++	bed_normal[0]=-normal[0]/normal_norm;
++	bed_normal[1]=-normal[1]/normal_norm;
++	bed_normal[2]=-normal[2]/normal_norm;
++}
++/*}}}*/
++/*FUNCTION Penta::NormalTop {{{*/
++void Penta::NormalTop(IssmDouble* top_normal,IssmDouble* xyz_list){
++
++	int i;
++	IssmDouble v13[3],v23[3];
++	IssmDouble normal[3];
++	IssmDouble normal_norm;
++
++	for (i=0;i<3;i++){
++		v13[i]=xyz_list[0*3+i]-xyz_list[2*3+i];
++		v23[i]=xyz_list[1*3+i]-xyz_list[2*3+i];
++	}
++
++	normal[0]=v13[1]*v23[2]-v13[2]*v23[1];
++	normal[1]=v13[2]*v23[0]-v13[0]*v23[2];
++	normal[2]=v13[0]*v23[1]-v13[1]*v23[0];
++	normal_norm=sqrt(normal[0]*normal[0] + normal[1]*normal[1] + normal[2]*normal[2]);
++
++	top_normal[0]=normal[0]/normal_norm;
++	top_normal[1]=normal[1]/normal_norm;
++	top_normal[2]=normal[2]/normal_norm;
++}
++/*}}}*/
+ /*FUNCTION Penta::NumberofNodesPressure{{{*/
+ int Penta::NumberofNodesPressure(void){
+ 	return PentaRef::NumberofNodesPressure();
+@@ -2953,7 +2999,13 @@
+ Element*  Penta::SpawnBasalElement(void){
+ 
+ 	_assert_(this->IsOnBed());
++
++	this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum,MaterialsEnum);
++	this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum,MaterialsEnum);
+ 	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
++	this->material->inputs->DeleteInput(MaterialsRheologyBbarEnum);
++	this->material->inputs->DeleteInput(DamageDbarEnum);
++
+ 	return tria;
+ }
+ /*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16826)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16827)
+@@ -99,6 +99,7 @@
+ 		void   GetVectorFromInputs(Vector<IssmDouble>* vector,int name_enum);
+ 		void   GetVerticesCoordinates(IssmDouble** pxyz_list);
+ 		void   GetVerticesCoordinatesBase(IssmDouble** pxyz_list);
++		void   GetVerticesCoordinatesTop(IssmDouble** pxyz_list);
+ 
+ 		int    Sid();
+ 		void   InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);
+@@ -194,6 +195,7 @@
+ 		void           AddInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		void           AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		void	         NormalBase(IssmDouble* bed_normal, IssmDouble* xyz_list);
++		void	         NormalTop(IssmDouble* bed_normal, IssmDouble* xyz_list);
+ 		ElementMatrix* CreateBasalMassMatrix(void);
+ 		ElementMatrix* CreateKMatrix(void);
+ 		ElementMatrix* CreateKMatrixMasstransport(void);
+@@ -243,10 +245,12 @@
+ 		bool           IsNodeOnShelfFromFlags(IssmDouble* flags);
+ 		void           JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss);
+ 		void           JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss);
++		void           JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss);
+ 		bool           NoIceInElement(void); 
+ 		Gauss*         NewGauss(void);
+ 		Gauss*         NewGauss(int order);
+ 		Gauss*         NewGaussBase(int order);
++		Gauss*         NewGaussTop(int order);
+ 		ElementVector* NewElementVector(int approximation_enum);
+ 		ElementMatrix* NewElementMatrix(int approximation_enum);
+ 		void           NodalFunctions(IssmDouble* basis,Gauss* gauss);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16826)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16827)
+@@ -104,13 +104,16 @@
+ 		int         GetNumberOfVertices(void){_error_("not implemented yet");};
+ 		void        GetVerticesCoordinates(IssmDouble** pxyz_list){_error_("not implemented yet");};
+ 		void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list){_error_("not implemented yet");};
++		void        GetVerticesCoordinatesTop(IssmDouble** pxyz_list){_error_("not implemented yet");};
+ 		int         Sid(){_error_("not implemented yet");};
+ 		void        InputChangeName(int input_enum, int enum_type_old){_error_("not implemented yet");};
+ 		bool        IsOnBed(){_error_("not implemented yet");};
++		bool        IsOnSurface(){_error_("not implemented yet");};
+ 		bool        IsFloating(){_error_("not implemented yet");};
+ 		bool        IsNodeOnShelfFromFlags(IssmDouble* flags){_error_("not implemented yet");};
+ 		void        JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void        JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
++		void        JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
+ 		IssmDouble  MinEdgeLength(IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		void        NodalFunctions(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+@@ -118,6 +121,7 @@
+ 		void        NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		bool        NoIceInElement(){_error_("not implemented yet");};
+ 		void        NormalBase(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
++		void        NormalTop(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		int         NumberofNodesVelocity(void){_error_("not implemented yet");};
+ 		int         NumberofNodesPressure(void){_error_("not implemented yet");};
+ 	   Element*    SpawnBasalElement(void){_error_("not implemented yet");};
+@@ -136,6 +140,7 @@
+ 		Gauss*      NewGauss(void){_error_("not implemented yet");};
+ 		Gauss*      NewGauss(int order){_error_("not implemented yet");};
+ 		Gauss*      NewGaussBase(int order){_error_("not implemented yet");};
++		Gauss*      NewGaussTop(int order){_error_("not implemented yet");};
+ 		ElementVector* NewElementVector(int approximation_enum){_error_("not implemented yet");};
+ 		ElementMatrix* NewElementMatrix(int approximation_enum){_error_("not implemented yet");};
+ 		void           ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16827-16828.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16827-16828.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16827-16828.diff	(revision 17802)
@@ -0,0 +1,15 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 16827)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 16828)
+@@ -101,10 +101,6 @@
+ 	ElementMatrix* Ke1=CreateKMatrixVolume(element);
+ 	ElementMatrix* Ke2=CreateKMatrixSurface(element);
+ 	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
+-	//Ke1->Echo();
+-	//Ke2->Echo();
+-	//Ke=element->CreateKMatrix();
+-	//_error_("S");
+ 
+ 	/*clean-up and return*/
+ 	delete Ke1;
Index: issm/oecreview/Archive/16554-17801/ISSM-16828-16829.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16828-16829.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16828-16829.diff	(revision 17802)
@@ -0,0 +1,1615 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16828)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16829)
+@@ -21,6 +21,9 @@
+ 
+ 		/*Finite element Analysis*/
+ 		ElementMatrix* CreateKMatrix(Element* element);
++		ElementMatrix* CreateKMatrixHO(Element* element);
++		ElementMatrix* CreateKMatrixHOViscous(Element* element);
++		ElementMatrix* CreateKMatrixHOFriction(Element* element);
+ 		ElementMatrix* CreateKMatrixSSA(Element* element);
+ 		ElementMatrix* CreateKMatrixSSAViscous(Element* element);
+ 		ElementMatrix* CreateKMatrixSSAFriction(Element* element);
+@@ -35,6 +38,8 @@
+ 		ElementVector* CreatePVectorSSA(Element* element);
+ 		ElementVector* CreatePVectorSSADrivingStress(Element* element);
+ 		ElementVector* CreatePVectorSSAFront(Element* element);
++		void GetBHO(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBHOprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetBSSA(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetBSSAprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16828)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16829)
+@@ -817,12 +817,124 @@
+ 	switch(approximation){
+ 		case SSAApproximationEnum: 
+ 			return CreateKMatrixSSA(element);
++		case HOApproximationEnum: 
++			return CreateKMatrixHO(element);
+ 		case NoneApproximationEnum:
+ 			return NULL;
+ 		default:
+ 			_error_("Approximation "<<EnumToStringx(approximation)<<" not supported");
+ 	}
+ }/*}}}*/
++ElementVector* StressbalanceAnalysis::CreatePVector(Element* element){/*{{{*/
++
++	int approximation;
++	element->GetInputValue(&approximation,ApproximationEnum);
++	switch(approximation){
++		case SSAApproximationEnum: 
++			return CreatePVectorSSA(element);
++		case HOApproximationEnum: 
++			return CreatePVectorHO(element);
++		case FSApproximationEnum: 
++			return CreatePVectorFS(element);
++		case NoneApproximationEnum:
++			return NULL;
++		default:
++			_error_("Approximation "<<EnumToStringx(approximation)<<" not supported");
++	}
++}/*}}}*/
++void StressbalanceAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++
++	int approximation;
++	element->GetInputValue(&approximation,ApproximationEnum);
++	switch(approximation){
++		case FSApproximationEnum: case NoneApproximationEnum:
++			GetSolutionFromInputsFS(solution,element);
++			return;
++		case SSAApproximationEnum: case HOApproximationEnum: case SIAApproximationEnum:
++			GetSolutionFromInputsHoriz(solution,element);
++			return;
++		case L1L2ApproximationEnum:
++			GetSolutionFromInputsHoriz(solution,element);
++			return;
++		case SSAHOApproximationEnum: case HOFSApproximationEnum: case SSAFSApproximationEnum:
++			/*the elements around will create the solution*/
++			return;
++		default:
++			_error_("Approximation "<<EnumToStringx(approximation)<<" not supported");
++	}
++}/*}}}*/
++void StressbalanceAnalysis::GetSolutionFromInputsHoriz(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++
++	IssmDouble   vx,vy;
++	int          approximation;
++	int*         doflist = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++	int numdof   = numnodes*2;
++	element->GetInputValue(&approximation,ApproximationEnum);
++
++	/*Fetch dof list and allocate solution vector*/
++	element->GetDofList(&doflist,approximation,GsetEnum);
++	IssmDouble* values = xNew<IssmDouble>(numdof);
++
++	/*Get inputs*/
++	Input* vx_input=element->GetInput(VxEnum); _assert_(vx_input);
++	Input* vy_input=element->GetInput(VyEnum); _assert_(vy_input);
++
++	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
++	Gauss* gauss=element->NewGauss();
++	for(int i=0;i<numnodes;i++){
++		gauss->GaussNode(element->FiniteElement(),i);
++
++		/*Recover vx and vy*/
++		vx_input->GetInputValue(&vx,gauss);
++		vy_input->GetInputValue(&vy,gauss);
++		values[i*2+0]=vx;
++		values[i*2+1]=vy;
++	}
++
++	solution->SetValues(numdof,doflist,values,INS_VAL);
++
++	/*Free ressources:*/
++	delete gauss;
++	xDelete<IssmDouble>(values);
++	xDelete<int>(doflist);
++}/*}}}*/
++void StressbalanceAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++
++	int approximation;
++	element->GetInputValue(&approximation,ApproximationEnum);
++	switch(approximation){
++		case FSApproximationEnum: case NoneApproximationEnum:
++			InputUpdateFromSolutionFS(solution,element);
++			return;
++		case SIAApproximationEnum: 
++			return;
++		case SSAApproximationEnum: 
++			InputUpdateFromSolutionSSA(solution,element);
++			return;
++		case HOApproximationEnum: 
++			InputUpdateFromSolutionHO(solution,element);
++			return;
++		case L1L2ApproximationEnum:
++			InputUpdateFromSolutionL1L2(solution,element);
++			return;
++		case SSAHOApproximationEnum:
++			InputUpdateFromSolutionSSAHO(solution,element);
++			return;
++		case HOFSApproximationEnum:
++			InputUpdateFromSolutionHOFS(solution,element);
++			return;
++		case SSAFSApproximationEnum:
++			InputUpdateFromSolutionSSAFS(solution,element);
++			return;
++		default:
++			_error_("Approximation "<<EnumToStringx(approximation)<<" not supported");
++	}
++}/*}}}*/
++
++/*SSA*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSA(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+@@ -917,304 +1029,471 @@
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSAFriction(Element* element){/*{{{*/
+ 	return NULL;
+ }/*}}}*/
+-ElementVector* StressbalanceAnalysis::CreatePVector(Element* element){/*{{{*/
++ElementVector* StressbalanceAnalysis::CreatePVectorSSA(Element* element){/*{{{*/
+ 
+-	int approximation;
+-	element->GetInputValue(&approximation,ApproximationEnum);
+-	switch(approximation){
+-		case SSAApproximationEnum: 
+-			return CreatePVectorSSA(element);
+-		case HOApproximationEnum: 
+-			return CreatePVectorHO(element);
+-		case FSApproximationEnum: 
+-			return CreatePVectorFS(element);
+-		case NoneApproximationEnum:
+-			return NULL;
+-		default:
+-			_error_("Approximation "<<EnumToStringx(approximation)<<" not supported");
++	/*Intermediaries*/
++	int      meshtype;
++	Element* basalelement;
++
++	/*Get basal element*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+-}/*}}}*/
+-ElementVector* StressbalanceAnalysis::CreatePVectorFS(Element* element){/*{{{*/
+ 
+ 	/*compute all load vectors for this element*/
+-	ElementVector* pe1=CreatePVectorFSViscous(element);
+-	ElementVector* pe2=CreatePVectorFSShelf(element);
+-	ElementVector* pe3=CreatePVectorFSFront(element);
+-	ElementVector* pe =new ElementVector(pe1,pe2,pe3);
++	ElementVector* pe1=CreatePVectorSSADrivingStress(basalelement);
++	ElementVector* pe2=CreatePVectorSSAFront(basalelement);
++	ElementVector* pe =new ElementVector(pe1,pe2);
+ 
+ 	/*clean-up and return*/
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	delete pe1;
+ 	delete pe2;
+-	delete pe3;
+ 	return pe;
+ }/*}}}*/
+-ElementVector* StressbalanceAnalysis::CreatePVectorFSViscous(Element* element){/*{{{*/
++ElementVector* StressbalanceAnalysis::CreatePVectorSSADrivingStress(Element* element){/*{{{*/
+ 
+-	int         i,meshtype,dim;
+-	IssmDouble  Jdet,forcex,forcey,forcez;
+-	IssmDouble *xyz_list = NULL;
++	/*Intermediaries */
++	IssmDouble  thickness,Jdet,slope[2];
++	IssmDouble* xyz_list = NULL;
+ 
+-	/*Get problem dimension*/
+-	element->FindParam(&meshtype,MeshTypeEnum);
+-	switch(meshtype){
+-		case Mesh2DverticalEnum: dim = 2; break;
+-		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+-	}
+-
+ 	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = element->GetNumberOfNodesVelocity();
+-	int pnumnodes = element->GetNumberOfNodesPressure();
++	int numnodes = element->GetNumberOfNodes();
+ 
+-	/*Prepare coordinate system list*/
+-	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+-	if(dim==2) for(i=0;i<vnumnodes;i++) cs_list[i] = XYEnum;
+-	else       for(i=0;i<vnumnodes;i++) cs_list[i] = XYZEnum;
+-	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
++	/*Initialize Element vector and vectors*/
++	ElementVector* pe    = element->NewElementVector(SSAApproximationEnum);
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+-	/*Initialize vectors*/
+-	ElementVector* pe     = element->NewElementVector(FSvelocityEnum);
+-	IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
+-
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+-	Input*      loadingforcex_input=element->GetInput(LoadingforceXEnum);  _assert_(loadingforcex_input);
+-	Input*      loadingforcey_input=element->GetInput(LoadingforceYEnum);  _assert_(loadingforcey_input);
+-	Input*      loadingforcez_input=element->GetInput(LoadingforceZEnum);  _assert_(loadingforcez_input);
+-	IssmDouble  rho_ice =element->GetMaterialParameter(MaterialsRhoIceEnum);
+-	IssmDouble  gravity =element->GetMaterialParameter(ConstantsGEnum);
++	Input*     thickness_input=element->GetInput(ThicknessEnum); _assert_(thickness_input); 
++	Input*     surface_input  =element->GetInput(SurfaceEnum);   _assert_(surface_input);
++	IssmDouble rhog = element->GetMaterialParameter(MaterialsRhoIceEnum)*element->GetMaterialParameter(ConstantsGEnum);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+-	Gauss* gauss=element->NewGauss(5);
++	Gauss* gauss=element->NewGauss(2);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
+ 		gauss->GaussPoint(ig);
+ 
+ 		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+-		element->NodalFunctionsVelocity(vbasis,gauss);
++		element->NodalFunctions(basis, gauss);
+ 
+-		loadingforcex_input->GetInputValue(&forcex,gauss);
+-		loadingforcey_input->GetInputValue(&forcey,gauss);
+-		if(dim==3) loadingforcez_input->GetInputValue(&forcez,gauss);
++		thickness_input->GetInputValue(&thickness,gauss);
++		surface_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
+ 
+-		for(i=0;i<vnumnodes;i++){
+-			pe->values[i*dim+0] += +rho_ice*forcex *Jdet*gauss->weight*vbasis[i];
+-			pe->values[i*dim+1] += +rho_ice*forcey *Jdet*gauss->weight*vbasis[i];
+-			if(dim==3){
+-				pe->values[i*dim+2] += +rho_ice*forcez*Jdet*gauss->weight*vbasis[i];
+-				pe->values[i*dim+2] += -rho_ice*gravity*Jdet*gauss->weight*vbasis[i];
+-			}
+-			else{
+-				pe->values[i*dim+1] += -rho_ice*gravity*Jdet*gauss->weight*vbasis[i];
+-			}
++		for(int i=0;i<numnodes;i++){
++			pe->values[i*2+0]+=-rhog*thickness*slope[0]*Jdet*gauss->weight*basis[i];
++			pe->values[i*2+1]+=-rhog*thickness*slope[1]*Jdet*gauss->weight*basis[i];
+ 		}
+ 	}
+ 
+ 	/*Transform coordinate system*/
+-	element->TransformLoadVectorCoord(pe,cs_list);
++	element->TransformLoadVectorCoord(pe,XYEnum);
+ 
+ 	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
+ 	delete gauss;
+-	xDelete<int>(cs_list);
+-	xDelete<IssmDouble>(vbasis);
+-	xDelete<IssmDouble>(xyz_list);
+ 	return pe;
+ }/*}}}*/
+-ElementVector* StressbalanceAnalysis::CreatePVectorFSShelf(Element* element){/*{{{*/
++ElementVector* StressbalanceAnalysis::CreatePVectorSSAFront(Element* element){/*{{{*/
+ 
+-	int         i,meshtype,dim;
+-	IssmDouble  Jdet,water_pressure,bed;
+-	IssmDouble	normal[3];
+-	IssmDouble *xyz_list_base = NULL;
++	return NULL;
++}/*}}}*/
++void StressbalanceAnalysis::GetBSSA(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
++	 * For node i, Bi can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi=[ dN/dx           0    ]
++	 *          [   0           dN/dy  ]
++	 *          [ 1/2*dN/dy  1/2*dN/dx ]
++	 * where N is the finiteelement function for node i.
++	 *
++	 * We assume B has been allocated already, of size: 3x(NDOF2*numnodes)
++	 */
+ 
+-	/*Get basal element*/
+-	if(!element->IsOnBed() || !element->IsFloating()) return NULL;
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
+ 
+-	/*Get problem dimension*/
++	/*Get nodal functions derivatives*/
++	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Build B: */
++	for(int i=0;i<numnodes;i++){
++		B[2*numnodes*0+2*i+0] = dbasis[0*numnodes+i];
++		B[2*numnodes*0+2*i+1] = 0.;
++		B[2*numnodes*1+2*i+0] = 0.;
++		B[2*numnodes*1+2*i+1] = dbasis[1*numnodes+i];
++		B[2*numnodes*2+2*i+0] = .5*dbasis[1*numnodes+i];
++		B[2*numnodes*2+2*i+1] = .5*dbasis[0*numnodes+i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(dbasis);
++}/*}}}*/
++void StressbalanceAnalysis::GetBSSAprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 
++	 * For node i, Bi' can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi_prime=[ 2*dN/dx    dN/dy ]
++	 *                [   dN/dx  2*dN/dy ]
++	 *                [   dN/dy    dN/dx ]
++	 * where hNis the finiteelement function for node i.
++	 *
++	 * We assume B' has been allocated already, of size: 3x(NDOF2*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Build B': */
++	for(int i=0;i<numnodes;i++){
++		Bprime[2*numnodes*0+2*i+0] = 2.*dbasis[0*numnodes+i];
++		Bprime[2*numnodes*0+2*i+1] =    dbasis[1*numnodes+i];
++		Bprime[2*numnodes*1+2*i+0] =    dbasis[0*numnodes+i];
++		Bprime[2*numnodes*1+2*i+1] = 2.*dbasis[1*numnodes+i];
++		Bprime[2*numnodes*2+2*i+0] =    dbasis[1*numnodes+i];
++		Bprime[2*numnodes*2+2*i+1] =    dbasis[0*numnodes+i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(dbasis);
++}/*}}}*/
++void StressbalanceAnalysis::InputUpdateFromSolutionSSA(IssmDouble* solution,Element* element){/*{{{*/
++
++	int         i,meshtype;
++	IssmDouble  rho_ice,g;
++	int*        doflist=NULL;
++	IssmDouble* xyz_list=NULL;
++	Element*    basalelement=NULL;
++
++	/*Deal with pressure first*/
++	int numvertices = element->GetNumberOfVertices();
++	IssmDouble* pressure  = xNew<IssmDouble>(numvertices);
++	IssmDouble* thickness = xNew<IssmDouble>(numvertices);
++	IssmDouble* surface   = xNew<IssmDouble>(numvertices);
++
+ 	element->FindParam(&meshtype,MeshTypeEnum);
++	rho_ice =element->GetMaterialParameter(MaterialsRhoIceEnum);
++	g       =element->GetMaterialParameter(ConstantsGEnum);
+ 	switch(meshtype){
+-		case Mesh2DverticalEnum: dim = 2; break;
+-		case Mesh3DEnum:         dim = 3; break;
++		case Mesh2DhorizontalEnum:
++			element->GetInputListOnVertices(thickness,ThicknessEnum);
++			for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*thickness[i];
++			break;
++		case Mesh3DEnum:
++			element->GetVerticesCoordinates(&xyz_list);
++			element->GetInputListOnVertices(surface,SurfaceEnum);
++			for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
++			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
++	element->AddInput(PressureEnum,pressure,P1Enum);
++	xDelete<IssmDouble>(pressure);
++	xDelete<IssmDouble>(thickness);
++	xDelete<IssmDouble>(surface);
+ 
++	/*Get basal element*/
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()){xDelete<IssmDouble>(xyz_list); return;}
++			basalelement=element->SpawnBasalElement();
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
+ 	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = element->GetNumberOfNodesVelocity();
+-	int pnumnodes = element->GetNumberOfNodesPressure();
++	int numnodes = basalelement->GetNumberOfNodes();
++	int numdof   = numnodes*2;
+ 
+-	/*Prepare coordinate system list*/
+-	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+-	if(dim==2) for(i=0;i<vnumnodes;i++) cs_list[i] = XYEnum;
+-	else       for(i=0;i<vnumnodes;i++) cs_list[i] = XYZEnum;
+-	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
++	/*Fetch dof list and allocate solution vectors*/
++	basalelement->GetDofList(&doflist,SSAApproximationEnum,GsetEnum);
++	IssmDouble* values    = xNew<IssmDouble>(numdof);
++	IssmDouble* vx        = xNew<IssmDouble>(numnodes);
++	IssmDouble* vy        = xNew<IssmDouble>(numnodes);
++	IssmDouble* vz        = xNew<IssmDouble>(numnodes);
++	IssmDouble* vel       = xNew<IssmDouble>(numnodes);
+ 
+-	/*Initialize vectors*/
+-	ElementVector* pe     = element->NewElementVector(FSvelocityEnum);
+-	IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
++	/*Use the dof list to index into the solution vector: */
++	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+ 
+-	/*Retrieve all inputs and parameters*/
+-	element->GetVerticesCoordinatesBase(&xyz_list_base);
+-	Input*      bed_input=element->GetInput(BedEnum); _assert_(bed_input);
+-	IssmDouble  rho_water=element->GetMaterialParameter(MaterialsRhoWaterEnum);
+-	IssmDouble  gravity  =element->GetMaterialParameter(ConstantsGEnum);
++	/*Transform solution in Cartesian Space*/
++	basalelement->TransformSolutionCoord(&values[0],XYEnum);
++	basalelement->FindParam(&meshtype,MeshTypeEnum);
+ 
+-	/* Start  looping on the number of gaussian points: */
+-	Gauss* gauss=element->NewGaussBase(5);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-		gauss->GaussPoint(ig);
++	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
++	for(i=0;i<numnodes;i++){
++		vx[i]=values[i*2+0];
++		vy[i]=values[i*2+1];
+ 
+-		element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
+-		element->NodalFunctionsVelocity(vbasis,gauss);
++		/*Check solution*/
++		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
++		if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
++	}
+ 
+-		element->NormalBase(&normal[0],xyz_list_base);
+-		_assert_(normal[dim-1]<0.);
+-		bed_input->GetInputValue(&bed, gauss);
+-		water_pressure=gravity*rho_water*bed;
++	/*Get Vz and compute vel*/
++	basalelement->GetInputListOnNodes(&vz[0],VzEnum,0.);
++	for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
+ 
+-		for(i=0;i<vnumnodes;i++){
+-			pe->values[i*dim+0] += water_pressure*gauss->weight*Jdet*vbasis[i]*normal[0];
+-			pe->values[i*dim+1] += water_pressure*gauss->weight*Jdet*vbasis[i]*normal[1];
+-			if(dim==3){
+-				pe->values[i*dim+2]+=water_pressure*gauss->weight*Jdet*vbasis[i]*normal[2];
+-			}
+-		}
+-	}
++	/*Now, we have to move the previous Vx and Vy inputs  to old 
++	 * status, otherwise, we'll wipe them off: */
++	element->InputChangeName(VxEnum,VxPicardEnum);
++	element->InputChangeName(VyEnum,VyPicardEnum);
+ 
+-	/*Transform coordinate system*/
+-	element->TransformLoadVectorCoord(pe,cs_list);
++	/*Add vx and vy as inputs to the tria element: */
++	element->AddBasalInput(VxEnum,vx,P1Enum);
++	element->AddBasalInput(VyEnum,vy,P1Enum);
++	element->AddBasalInput(VelEnum,vel,P1Enum);
+ 
+-	/*Clean up and return*/
+-	delete gauss;
+-	xDelete<int>(cs_list);
+-	xDelete<IssmDouble>(vbasis);
+-	xDelete<IssmDouble>(xyz_list_base);
+-	return pe;
++	/*Free ressources:*/
++	xDelete<IssmDouble>(vel);
++	xDelete<IssmDouble>(vz);
++	xDelete<IssmDouble>(vy);
++	xDelete<IssmDouble>(vx);
++	xDelete<IssmDouble>(values);
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<int>(doflist);
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ }/*}}}*/
+-ElementVector* StressbalanceAnalysis::CreatePVectorFSFront(Element* element){/*{{{*/
+ 
+-	return NULL;
++/*L1L2*/
++void StressbalanceAnalysis::InputUpdateFromSolutionL1L2(IssmDouble* solution,Element* element){/*{{{*/
++
++	int         i,meshtype;
++	IssmDouble  rho_ice,g;
++	int*        doflist=NULL;
++	IssmDouble* xyz_list=NULL;
++	Element*    basalelement=NULL;
++
++	/*Deal with pressure first*/
++	int numvertices = element->GetNumberOfVertices();
++	IssmDouble* pressure  = xNew<IssmDouble>(numvertices);
++	IssmDouble* thickness = xNew<IssmDouble>(numvertices);
++	IssmDouble* surface   = xNew<IssmDouble>(numvertices);
++
++	element->FindParam(&meshtype,MeshTypeEnum);
++	rho_ice =element->GetMaterialParameter(MaterialsRhoIceEnum);
++	g       =element->GetMaterialParameter(ConstantsGEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			element->GetInputListOnVertices(thickness,ThicknessEnum);
++			for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*thickness[i];
++			break;
++		case Mesh3DEnum:
++			element->GetVerticesCoordinates(&xyz_list);
++			element->GetInputListOnVertices(surface,SurfaceEnum);
++			for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++	element->AddInput(PressureEnum,pressure,P1Enum);
++	xDelete<IssmDouble>(pressure);
++	xDelete<IssmDouble>(thickness);
++	xDelete<IssmDouble>(surface);
++
++	/*Get basal element*/
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()){xDelete<IssmDouble>(xyz_list); return;}
++			basalelement=element->SpawnBasalElement();
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = basalelement->GetNumberOfNodes();
++	int numdof   = numnodes*2;
++
++	/*Fetch dof list and allocate solution vectors*/
++	basalelement->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
++	IssmDouble* values    = xNew<IssmDouble>(numdof);
++	IssmDouble* vx        = xNew<IssmDouble>(numnodes);
++	IssmDouble* vy        = xNew<IssmDouble>(numnodes);
++	IssmDouble* vz        = xNew<IssmDouble>(numnodes);
++	IssmDouble* vel       = xNew<IssmDouble>(numnodes);
++
++	/*Use the dof list to index into the solution vector: */
++	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
++
++	/*Transform solution in Cartesian Space*/
++	basalelement->TransformSolutionCoord(&values[0],XYEnum);
++	basalelement->FindParam(&meshtype,MeshTypeEnum);
++
++	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
++	for(i=0;i<numnodes;i++){
++		vx[i]=values[i*2+0];
++		vy[i]=values[i*2+1];
++
++		/*Check solution*/
++		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
++		if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
++	}
++
++	/*Get Vz and compute vel*/
++	basalelement->GetInputListOnNodes(&vz[0],VzEnum,0.);
++	for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
++
++	/*Now, we have to move the previous Vx and Vy inputs  to old 
++	 * status, otherwise, we'll wipe them off: */
++	element->InputChangeName(VxEnum,VxPicardEnum);
++	element->InputChangeName(VyEnum,VyPicardEnum);
++
++	/*Add vx and vy as inputs to the tria element: */
++	element->AddBasalInput(VxEnum,vx,P1Enum);
++	element->AddBasalInput(VyEnum,vy,P1Enum);
++	element->AddBasalInput(VelEnum,vel,P1Enum);
++
++	/*Free ressources:*/
++	xDelete<IssmDouble>(vel);
++	xDelete<IssmDouble>(vz);
++	xDelete<IssmDouble>(vy);
++	xDelete<IssmDouble>(vx);
++	xDelete<IssmDouble>(values);
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<int>(doflist);
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ }/*}}}*/
+-ElementVector* StressbalanceAnalysis::CreatePVectorHO(Element* element){/*{{{*/
+ 
+-	/*compute all load vectors for this element*/
+-	ElementVector* pe1=CreatePVectorHODrivingStress(element);
+-	ElementVector* pe2=CreatePVectorHOFront(element);
+-	ElementVector* pe =new ElementVector(pe1,pe2);
++/*HO*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixHO(Element* element){/*{{{*/
+ 
++	/*compute all stiffness matrices for this element*/
++	ElementMatrix* Ke1=CreateKMatrixHOViscous(element);
++	ElementMatrix* Ke2=CreateKMatrixHOFriction(element);
++	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
++
+ 	/*clean-up and return*/
+-	delete pe1;
+-	delete pe2;
+-	return pe;
++	delete Ke1;
++	delete Ke2;
++	return Ke;
+ }/*}}}*/
+-ElementVector* StressbalanceAnalysis::CreatePVectorHODrivingStress(Element* element){/*{{{*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixHOViscous(Element* element){/*{{{*/
+ 
+-	/*Intermediaries */
+-	IssmDouble  Jdet,slope[3];
+-	IssmDouble* xyz_list = NULL;
++	/*Intermediaries*/
++	IssmDouble  viscosity,newviscosity,oldviscosity;
++	IssmDouble  viscosity_overshoot,thickness,Jdet;
++	IssmDouble  D_scalar;
++	IssmDouble *xyz_list = NULL;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
++	int numdof   = numnodes*2;
+ 
+-	/*Initialize Element vector and vectors*/
+-	ElementVector* pe=element->NewElementVector(HOApproximationEnum);
+-	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++	/*Initialize Element matrix and vectors*/
++	ElementMatrix* Ke     = element->NewElementMatrix(HOApproximationEnum);
++	IssmDouble*    B      = xNew<IssmDouble>(5*numdof);
++	IssmDouble*    Bprime = xNew<IssmDouble>(5*numdof);
++	IssmDouble*    D      = xNewZeroInit<IssmDouble>(5*5);
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+-	Input*     surface_input = element->GetInput(SurfaceEnum);   _assert_(surface_input);
+-	IssmDouble rhog = element->GetMaterialParameter(MaterialsRhoIceEnum)*element->GetMaterialParameter(ConstantsGEnum);
++	Input* vx_input=element->GetInput(VxEnum);               _assert_(vx_input);
++	Input* vy_input=element->GetInput(VyEnum);               _assert_(vy_input);
++	Input* vxold_input=element->GetInput(VxPicardEnum);      _assert_(vxold_input);
++	Input* vyold_input=element->GetInput(VyPicardEnum);      _assert_(vyold_input);
++	element->FindParam(&viscosity_overshoot,StressbalanceViscosityOvershootEnum);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+-	Gauss* gauss=element->NewGauss(3);
++	Gauss* gauss = element->NewGauss(5);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		gauss->GaussPoint(ig);
+ 
+ 		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+-		element->NodalFunctions(basis, gauss);
+-		surface_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
++		this->GetBHO(B,element,xyz_list,gauss);
++		this->GetBHOprime(Bprime,element,xyz_list,gauss);
+ 
+-		for(int i=0;i<numnodes;i++){
+-			pe->values[i*2+0]+=-rhog*slope[0]*Jdet*gauss->weight*basis[i];
+-			pe->values[i*2+1]+=-rhog*slope[1]*Jdet*gauss->weight*basis[i];
+-		}
++		element->ViscosityHO(&viscosity,xyz_list,gauss,vx_input,vy_input);
++		element->ViscosityHO(&oldviscosity,xyz_list,gauss,vxold_input,vyold_input);
++
++		newviscosity=viscosity+viscosity_overshoot*(viscosity-oldviscosity);
++		D_scalar=2.*newviscosity*gauss->weight*Jdet;
++		for(int i=0;i<5;i++) D[i*5+i]=D_scalar;
++
++		TripleMultiply(B,5,numdof,1,
++					D,5,5,0,
++					Bprime,5,numdof,0,
++					&Ke->values[0],1);
+ 	}
+ 
+-	/*Transform coordinate system*/
+-	element->TransformLoadVectorCoord(pe,XYEnum);
++	/*Transform Coordinate System*/
++	element->TransformStiffnessMatrixCoord(Ke,XYEnum);
+ 
+ 	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
++	delete gauss;
+ 	xDelete<IssmDouble>(xyz_list);
+-	delete gauss;
+-	return pe;
++	xDelete<IssmDouble>(D);
++	xDelete<IssmDouble>(Bprime);
++	xDelete<IssmDouble>(B);
++	return Ke;
+ }/*}}}*/
+-ElementVector* StressbalanceAnalysis::CreatePVectorHOFront(Element* element){/*{{{*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixHOFriction(Element* element){/*{{{*/
+ 
++	if(element->IsFloating() || !element->IsOnBed()) return NULL;
++
+ 	return NULL;
+ }/*}}}*/
+-ElementVector* StressbalanceAnalysis::CreatePVectorSSA(Element* element){/*{{{*/
++ElementVector* StressbalanceAnalysis::CreatePVectorHO(Element* element){/*{{{*/
+ 
+-	/*Intermediaries*/
+-	int      meshtype;
+-	Element* basalelement;
+-
+-	/*Get basal element*/
+-	element->FindParam(&meshtype,MeshTypeEnum);
+-	switch(meshtype){
+-		case Mesh2DhorizontalEnum:
+-			basalelement = element;
+-			break;
+-		case Mesh3DEnum:
+-			if(!element->IsOnBed()) return NULL;
+-			basalelement = element->SpawnBasalElement();
+-			break;
+-		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+-	}
+-
+ 	/*compute all load vectors for this element*/
+-	ElementVector* pe1=CreatePVectorSSADrivingStress(basalelement);
+-	ElementVector* pe2=CreatePVectorSSAFront(basalelement);
++	ElementVector* pe1=CreatePVectorHODrivingStress(element);
++	ElementVector* pe2=CreatePVectorHOFront(element);
+ 	ElementVector* pe =new ElementVector(pe1,pe2);
+ 
+ 	/*clean-up and return*/
+-	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	delete pe1;
+ 	delete pe2;
+ 	return pe;
+ }/*}}}*/
+-ElementVector* StressbalanceAnalysis::CreatePVectorSSADrivingStress(Element* element){/*{{{*/
++ElementVector* StressbalanceAnalysis::CreatePVectorHODrivingStress(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries */
+-	IssmDouble  thickness,Jdet,slope[2];
++	IssmDouble  Jdet,slope[3];
+ 	IssmDouble* xyz_list = NULL;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+ 
+ 	/*Initialize Element vector and vectors*/
+-	ElementVector* pe    = element->NewElementVector(SSAApproximationEnum);
++	ElementVector* pe=element->NewElementVector(HOApproximationEnum);
+ 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+-	Input*     thickness_input=element->GetInput(ThicknessEnum); _assert_(thickness_input); 
+-	Input*     surface_input  =element->GetInput(SurfaceEnum);   _assert_(surface_input);
++	Input*     surface_input = element->GetInput(SurfaceEnum);   _assert_(surface_input);
+ 	IssmDouble rhog = element->GetMaterialParameter(MaterialsRhoIceEnum)*element->GetMaterialParameter(ConstantsGEnum);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+-	Gauss* gauss=element->NewGauss(2);
++	Gauss* gauss=element->NewGauss(3);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+ 		gauss->GaussPoint(ig);
+ 
+ 		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+ 		element->NodalFunctions(basis, gauss);
+-
+-		thickness_input->GetInputValue(&thickness,gauss);
+ 		surface_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
+ 
+ 		for(int i=0;i<numnodes;i++){
+-			pe->values[i*2+0]+=-rhog*thickness*slope[0]*Jdet*gauss->weight*basis[i];
+-			pe->values[i*2+1]+=-rhog*thickness*slope[1]*Jdet*gauss->weight*basis[i];
++			pe->values[i*2+0]+=-rhog*slope[0]*Jdet*gauss->weight*basis[i];
++			pe->values[i*2+1]+=-rhog*slope[1]*Jdet*gauss->weight*basis[i];
+ 		}
+ 	}
+ 
+@@ -1222,32 +1501,34 @@
+ 	element->TransformLoadVectorCoord(pe,XYEnum);
+ 
+ 	/*Clean up and return*/
++	xDelete<IssmDouble>(basis);
+ 	xDelete<IssmDouble>(xyz_list);
+-	xDelete<IssmDouble>(basis);
+ 	delete gauss;
+ 	return pe;
+ }/*}}}*/
+-ElementVector* StressbalanceAnalysis::CreatePVectorSSAFront(Element* element){/*{{{*/
++ElementVector* StressbalanceAnalysis::CreatePVectorHOFront(Element* element){/*{{{*/
+ 
+ 	return NULL;
+ }/*}}}*/
+-void StressbalanceAnalysis::GetBSSA(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+-	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
++void StressbalanceAnalysis::GetBHO(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF2. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
+ 	 * by: 
+-	 *       Bi=[ dN/dx           0    ]
+-	 *          [   0           dN/dy  ]
+-	 *          [ 1/2*dN/dy  1/2*dN/dx ]
+-	 * where N is the finiteelement function for node i.
++	 *       Bi=[ dh/dx          0      ]
++	 *          [   0           dh/dy   ]
++	 *          [ 1/2*dh/dy  1/2*dh/dx  ]
++	 *          [ 1/2*dh/dz      0      ]
++	 *          [  0         1/2*dh/dz  ]
++	 * where h is the interpolation function for node i.
+ 	 *
+-	 * We assume B has been allocated already, of size: 3x(NDOF2*numnodes)
++	 * We assume B has been allocated already, of size: 5x(NDOF2*numnodes)
+ 	 */
+ 
+ 	/*Fetch number of nodes for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+ 
+ 	/*Get nodal functions derivatives*/
+-	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	IssmDouble* dbasis=xNew<IssmDouble>(3*numnodes);
+ 	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+ 
+ 	/*Build B: */
+@@ -1258,12 +1539,16 @@
+ 		B[2*numnodes*1+2*i+1] = dbasis[1*numnodes+i];
+ 		B[2*numnodes*2+2*i+0] = .5*dbasis[1*numnodes+i];
+ 		B[2*numnodes*2+2*i+1] = .5*dbasis[0*numnodes+i];
++		B[2*numnodes*3+2*i+0] = .5*dbasis[2*numnodes+i];
++		B[2*numnodes*3+2*i+1] = 0.;
++		B[2*numnodes*4+2*i+0] = 0.;
++		B[2*numnodes*4+2*i+1] = .5*dbasis[2*numnodes+i];
+ 	}
+ 
+ 	/*Clean-up*/
+ 	xDelete<IssmDouble>(dbasis);
+ }/*}}}*/
+-void StressbalanceAnalysis::GetBSSAprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++void StressbalanceAnalysis::GetBHOprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 
+ 	 * For node i, Bi' can be expressed in the actual coordinate system
+ 	 * by: 
+@@ -1279,43 +1564,258 @@
+ 	int numnodes = element->GetNumberOfNodes();
+ 
+ 	/*Get nodal functions derivatives*/
+-	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	IssmDouble* dbasis=xNew<IssmDouble>(3*numnodes);
+ 	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+ 
+ 	/*Build B': */
+ 	for(int i=0;i<numnodes;i++){
+ 		Bprime[2*numnodes*0+2*i+0] = 2.*dbasis[0*numnodes+i];
+-		Bprime[2*numnodes*0+2*i+1] =    dbasis[1*numnodes+i];
+-		Bprime[2*numnodes*1+2*i+0] =    dbasis[0*numnodes+i];
++		Bprime[2*numnodes*0+2*i+1] = dbasis[1*numnodes+i];
++		Bprime[2*numnodes*1+2*i+0] = dbasis[0*numnodes+i];
+ 		Bprime[2*numnodes*1+2*i+1] = 2.*dbasis[1*numnodes+i];
+-		Bprime[2*numnodes*2+2*i+0] =    dbasis[1*numnodes+i];
+-		Bprime[2*numnodes*2+2*i+1] =    dbasis[0*numnodes+i];
++		Bprime[2*numnodes*2+2*i+0] = dbasis[1*numnodes+i];
++		Bprime[2*numnodes*2+2*i+1] = dbasis[0*numnodes+i];
++		Bprime[2*numnodes*3+2*i+0] = dbasis[2*numnodes+i];
++		Bprime[2*numnodes*3+2*i+1] = 0.;
++		Bprime[2*numnodes*4+2*i+0] = 0.;
++		Bprime[2*numnodes*4+2*i+1] = dbasis[2*numnodes+i];
+ 	}
+ 
+ 	/*Clean-up*/
+ 	xDelete<IssmDouble>(dbasis);
+ }/*}}}*/
+-void StressbalanceAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++void StressbalanceAnalysis::InputUpdateFromSolutionHO(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	int approximation;
+-	element->GetInputValue(&approximation,ApproximationEnum);
+-	switch(approximation){
+-		case FSApproximationEnum: case NoneApproximationEnum:
+-			GetSolutionFromInputsFS(solution,element);
+-			return;
+-		case SSAApproximationEnum: case HOApproximationEnum: case SIAApproximationEnum:
+-			GetSolutionFromInputsHoriz(solution,element);
+-			return;
+-		case L1L2ApproximationEnum:
+-			GetSolutionFromInputsHoriz(solution,element);
+-			return;
+-		case SSAHOApproximationEnum: case HOFSApproximationEnum: case SSAFSApproximationEnum:
+-			/*the elements around will create the solution*/
+-			return;
+-		default:
+-			_error_("Approximation "<<EnumToStringx(approximation)<<" not supported");
++	int         i;
++	int*        doflist=NULL;
++	IssmDouble* xyz_list=NULL;
++
++	/*Deal with pressure first*/
++	int numvertices = element->GetNumberOfVertices();
++	IssmDouble* pressure  = xNew<IssmDouble>(numvertices);
++	IssmDouble* surface   = xNew<IssmDouble>(numvertices);
++	IssmDouble  rho_ice   = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	IssmDouble  g         = element->GetMaterialParameter(ConstantsGEnum);
++	element->GetVerticesCoordinates(&xyz_list);
++	element->GetInputListOnVertices(surface,SurfaceEnum);
++	for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
++	element->AddInput(PressureEnum,pressure,P1Enum);
++	xDelete<IssmDouble>(pressure);
++	xDelete<IssmDouble>(surface);
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++	int numdof   = numnodes*2;
++
++	/*Fetch dof list and allocate solution vectors*/
++	element->GetDofList(&doflist,HOApproximationEnum,GsetEnum);
++	IssmDouble* values    = xNew<IssmDouble>(numdof);
++	IssmDouble* vx        = xNew<IssmDouble>(numnodes);
++	IssmDouble* vy        = xNew<IssmDouble>(numnodes);
++	IssmDouble* vz        = xNew<IssmDouble>(numnodes);
++	IssmDouble* vel       = xNew<IssmDouble>(numnodes);
++
++	/*Use the dof list to index into the solution vector: */
++	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
++
++	/*Transform solution in Cartesian Space*/
++	element->TransformSolutionCoord(&values[0],XYEnum);
++
++	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
++	for(i=0;i<numnodes;i++){
++		vx[i]=values[i*2+0];
++		vy[i]=values[i*2+1];
++
++		/*Check solution*/
++		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
++		if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
+ 	}
++
++	/*Get Vz and compute vel*/
++	element->GetInputListOnNodes(&vz[0],VzEnum,0.);
++	for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
++
++	/*Now, we have to move the previous Vx and Vy inputs  to old 
++	 * status, otherwise, we'll wipe them off: */
++	element->InputChangeName(VxEnum,VxPicardEnum);
++	element->InputChangeName(VyEnum,VyPicardEnum);
++	element->InputChangeName(PressureEnum,PressurePicardEnum);
++
++	/*Add vx and vy as inputs to the tria element: */
++	element->AddInput(VxEnum,vx,P1Enum);
++	element->AddInput(VyEnum,vy,P1Enum);
++	element->AddBasalInput(VelEnum,vel,P1Enum);
++
++	/*Free ressources:*/
++	xDelete<IssmDouble>(vel);
++	xDelete<IssmDouble>(vz);
++	xDelete<IssmDouble>(vy);
++	xDelete<IssmDouble>(vx);
++	xDelete<IssmDouble>(values);
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<int>(doflist);
+ }/*}}}*/
++
++/*FS*/
++ElementVector* StressbalanceAnalysis::CreatePVectorFS(Element* element){/*{{{*/
++
++	/*compute all load vectors for this element*/
++	ElementVector* pe1=CreatePVectorFSViscous(element);
++	ElementVector* pe2=CreatePVectorFSShelf(element);
++	ElementVector* pe3=CreatePVectorFSFront(element);
++	ElementVector* pe =new ElementVector(pe1,pe2,pe3);
++
++	/*clean-up and return*/
++	delete pe1;
++	delete pe2;
++	delete pe3;
++	return pe;
++}/*}}}*/
++ElementVector* StressbalanceAnalysis::CreatePVectorFSViscous(Element* element){/*{{{*/
++
++	int         i,meshtype,dim;
++	IssmDouble  Jdet,forcex,forcey,forcez;
++	IssmDouble *xyz_list = NULL;
++
++	/*Get problem dimension*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; break;
++		case Mesh3DEnum:         dim = 3; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int vnumnodes = element->GetNumberOfNodesVelocity();
++	int pnumnodes = element->GetNumberOfNodesPressure();
++
++	/*Prepare coordinate system list*/
++	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
++	if(dim==2) for(i=0;i<vnumnodes;i++) cs_list[i] = XYEnum;
++	else       for(i=0;i<vnumnodes;i++) cs_list[i] = XYZEnum;
++	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
++
++	/*Initialize vectors*/
++	ElementVector* pe     = element->NewElementVector(FSvelocityEnum);
++	IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	Input*      loadingforcex_input=element->GetInput(LoadingforceXEnum);  _assert_(loadingforcex_input);
++	Input*      loadingforcey_input=element->GetInput(LoadingforceYEnum);  _assert_(loadingforcey_input);
++	Input*      loadingforcez_input=element->GetInput(LoadingforceZEnum);  _assert_(loadingforcez_input);
++	IssmDouble  rho_ice =element->GetMaterialParameter(MaterialsRhoIceEnum);
++	IssmDouble  gravity =element->GetMaterialParameter(ConstantsGEnum);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(5);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctionsVelocity(vbasis,gauss);
++
++		loadingforcex_input->GetInputValue(&forcex,gauss);
++		loadingforcey_input->GetInputValue(&forcey,gauss);
++		if(dim==3) loadingforcez_input->GetInputValue(&forcez,gauss);
++
++		for(i=0;i<vnumnodes;i++){
++			pe->values[i*dim+0] += +rho_ice*forcex *Jdet*gauss->weight*vbasis[i];
++			pe->values[i*dim+1] += +rho_ice*forcey *Jdet*gauss->weight*vbasis[i];
++			if(dim==3){
++				pe->values[i*dim+2] += +rho_ice*forcez*Jdet*gauss->weight*vbasis[i];
++				pe->values[i*dim+2] += -rho_ice*gravity*Jdet*gauss->weight*vbasis[i];
++			}
++			else{
++				pe->values[i*dim+1] += -rho_ice*gravity*Jdet*gauss->weight*vbasis[i];
++			}
++		}
++	}
++
++	/*Transform coordinate system*/
++	element->TransformLoadVectorCoord(pe,cs_list);
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<int>(cs_list);
++	xDelete<IssmDouble>(vbasis);
++	xDelete<IssmDouble>(xyz_list);
++	return pe;
++}/*}}}*/
++ElementVector* StressbalanceAnalysis::CreatePVectorFSShelf(Element* element){/*{{{*/
++
++	int         i,meshtype,dim;
++	IssmDouble  Jdet,water_pressure,bed;
++	IssmDouble	normal[3];
++	IssmDouble *xyz_list_base = NULL;
++
++	/*Get basal element*/
++	if(!element->IsOnBed() || !element->IsFloating()) return NULL;
++
++	/*Get problem dimension*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; break;
++		case Mesh3DEnum:         dim = 3; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int vnumnodes = element->GetNumberOfNodesVelocity();
++	int pnumnodes = element->GetNumberOfNodesPressure();
++
++	/*Prepare coordinate system list*/
++	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
++	if(dim==2) for(i=0;i<vnumnodes;i++) cs_list[i] = XYEnum;
++	else       for(i=0;i<vnumnodes;i++) cs_list[i] = XYZEnum;
++	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
++
++	/*Initialize vectors*/
++	ElementVector* pe     = element->NewElementVector(FSvelocityEnum);
++	IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinatesBase(&xyz_list_base);
++	Input*      bed_input=element->GetInput(BedEnum); _assert_(bed_input);
++	IssmDouble  rho_water=element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble  gravity  =element->GetMaterialParameter(ConstantsGEnum);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGaussBase(5);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
++		element->NodalFunctionsVelocity(vbasis,gauss);
++
++		element->NormalBase(&normal[0],xyz_list_base);
++		_assert_(normal[dim-1]<0.);
++		bed_input->GetInputValue(&bed, gauss);
++		water_pressure=gravity*rho_water*bed;
++
++		for(i=0;i<vnumnodes;i++){
++			pe->values[i*dim+0] += water_pressure*gauss->weight*Jdet*vbasis[i]*normal[0];
++			pe->values[i*dim+1] += water_pressure*gauss->weight*Jdet*vbasis[i]*normal[1];
++			if(dim==3){
++				pe->values[i*dim+2]+=water_pressure*gauss->weight*Jdet*vbasis[i]*normal[2];
++			}
++		}
++	}
++
++	/*Transform coordinate system*/
++	element->TransformLoadVectorCoord(pe,cs_list);
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<int>(cs_list);
++	xDelete<IssmDouble>(vbasis);
++	xDelete<IssmDouble>(xyz_list_base);
++	return pe;
++}/*}}}*/
++ElementVector* StressbalanceAnalysis::CreatePVectorFSFront(Element* element){/*{{{*/
++
++	return NULL;
++}/*}}}*/
+ void StressbalanceAnalysis::GetSolutionFromInputsFS(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 
+ 	int*         vdoflist=NULL;
+@@ -1384,76 +1884,6 @@
+ 	xDelete<IssmDouble>(pvalues);
+ 	xDelete<IssmDouble>(vvalues);
+ }/*}}}*/
+-void StressbalanceAnalysis::GetSolutionFromInputsHoriz(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+-
+-	IssmDouble   vx,vy;
+-	int          approximation;
+-	int*         doflist = NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = element->GetNumberOfNodes();
+-	int numdof   = numnodes*2;
+-	element->GetInputValue(&approximation,ApproximationEnum);
+-
+-	/*Fetch dof list and allocate solution vector*/
+-	element->GetDofList(&doflist,approximation,GsetEnum);
+-	IssmDouble* values = xNew<IssmDouble>(numdof);
+-
+-	/*Get inputs*/
+-	Input* vx_input=element->GetInput(VxEnum); _assert_(vx_input);
+-	Input* vy_input=element->GetInput(VyEnum); _assert_(vy_input);
+-
+-	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+-	Gauss* gauss=element->NewGauss();
+-	for(int i=0;i<numnodes;i++){
+-		gauss->GaussNode(element->FiniteElement(),i);
+-
+-		/*Recover vx and vy*/
+-		vx_input->GetInputValue(&vx,gauss);
+-		vy_input->GetInputValue(&vy,gauss);
+-		values[i*NDOF2+0]=vx;
+-		values[i*NDOF2+1]=vy;
+-	}
+-
+-	solution->SetValues(numdof,doflist,values,INS_VAL);
+-
+-	/*Free ressources:*/
+-	delete gauss;
+-	xDelete<IssmDouble>(values);
+-	xDelete<int>(doflist);
+-}/*}}}*/
+-void StressbalanceAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-
+-	int approximation;
+-	element->GetInputValue(&approximation,ApproximationEnum);
+-	switch(approximation){
+-		case FSApproximationEnum: case NoneApproximationEnum:
+-			InputUpdateFromSolutionFS(solution,element);
+-			return;
+-		case SIAApproximationEnum: 
+-			return;
+-		case SSAApproximationEnum: 
+-			InputUpdateFromSolutionSSA(solution,element);
+-			return;
+-		case HOApproximationEnum: 
+-			InputUpdateFromSolutionHO(solution,element);
+-			return;
+-		case L1L2ApproximationEnum:
+-			InputUpdateFromSolutionL1L2(solution,element);
+-			return;
+-		case SSAHOApproximationEnum:
+-			InputUpdateFromSolutionSSAHO(solution,element);
+-			return;
+-		case HOFSApproximationEnum:
+-			InputUpdateFromSolutionHOFS(solution,element);
+-			return;
+-		case SSAFSApproximationEnum:
+-			InputUpdateFromSolutionSSAFS(solution,element);
+-			return;
+-		default:
+-			_error_("Approximation "<<EnumToStringx(approximation)<<" not supported");
+-	}
+-}/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionFS(IssmDouble* solution,Element* element){/*{{{*/
+ 
+ 	int          i,dim,meshtype;
+@@ -1547,77 +1977,8 @@
+ 	xDelete<int>(pdoflist);
+ 	xDelete<int>(cs_list);
+ }/*}}}*/
+-void StressbalanceAnalysis::InputUpdateFromSolutionHO(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	int         i;
+-	int*        doflist=NULL;
+-	IssmDouble* xyz_list=NULL;
+-
+-	/*Deal with pressure first*/
+-	int numvertices = element->GetNumberOfVertices();
+-	IssmDouble* pressure  = xNew<IssmDouble>(numvertices);
+-	IssmDouble* surface   = xNew<IssmDouble>(numvertices);
+-	IssmDouble  rho_ice   = element->GetMaterialParameter(MaterialsRhoIceEnum);
+-	IssmDouble  g         = element->GetMaterialParameter(ConstantsGEnum);
+-	element->GetVerticesCoordinates(&xyz_list);
+-	element->GetInputListOnVertices(surface,SurfaceEnum);
+-	for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
+-	element->AddInput(PressureEnum,pressure,P1Enum);
+-	xDelete<IssmDouble>(pressure);
+-	xDelete<IssmDouble>(surface);
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = element->GetNumberOfNodes();
+-	int numdof   = numnodes*2;
+-
+-	/*Fetch dof list and allocate solution vectors*/
+-	element->GetDofList(&doflist,HOApproximationEnum,GsetEnum);
+-	IssmDouble* values    = xNew<IssmDouble>(numdof);
+-	IssmDouble* vx        = xNew<IssmDouble>(numnodes);
+-	IssmDouble* vy        = xNew<IssmDouble>(numnodes);
+-	IssmDouble* vz        = xNew<IssmDouble>(numnodes);
+-	IssmDouble* vel       = xNew<IssmDouble>(numnodes);
+-
+-	/*Use the dof list to index into the solution vector: */
+-	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+-
+-	/*Transform solution in Cartesian Space*/
+-	element->TransformSolutionCoord(&values[0],XYEnum);
+-
+-	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+-	for(i=0;i<numnodes;i++){
+-		vx[i]=values[i*2+0];
+-		vy[i]=values[i*2+1];
+-
+-		/*Check solution*/
+-		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
+-		if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
+-	}
+-
+-	/*Get Vz and compute vel*/
+-	element->GetInputListOnNodes(&vz[0],VzEnum,0.);
+-	for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
+-
+-	/*Now, we have to move the previous Vx and Vy inputs  to old 
+-	 * status, otherwise, we'll wipe them off: */
+-	element->InputChangeName(VxEnum,VxPicardEnum);
+-	element->InputChangeName(VyEnum,VyPicardEnum);
+-	element->InputChangeName(PressureEnum,PressurePicardEnum);
+-
+-	/*Add vx and vy as inputs to the tria element: */
+-	element->AddInput(VxEnum,vx,P1Enum);
+-	element->AddInput(VyEnum,vy,P1Enum);
+-	element->AddBasalInput(VelEnum,vel,P1Enum);
+-
+-	/*Free ressources:*/
+-	xDelete<IssmDouble>(vel);
+-	xDelete<IssmDouble>(vz);
+-	xDelete<IssmDouble>(vy);
+-	xDelete<IssmDouble>(vx);
+-	xDelete<IssmDouble>(values);
+-	xDelete<IssmDouble>(xyz_list);
+-	xDelete<int>(doflist);
+-}/*}}}*/
++/*Coupling (Tiling)*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionHOFS(IssmDouble* solution,Element* element){/*{{{*/
+ 
+ 	int         i;
+@@ -1715,204 +2076,6 @@
+ 	xDelete<int>(doflistHO);
+ 	xDelete<int>(cs_list);
+ }/*}}}*/
+-void StressbalanceAnalysis::InputUpdateFromSolutionL1L2(IssmDouble* solution,Element* element){/*{{{*/
+-
+-	int         i,meshtype;
+-	IssmDouble  rho_ice,g;
+-	int*        doflist=NULL;
+-	IssmDouble* xyz_list=NULL;
+-	Element*    basalelement=NULL;
+-
+-	/*Deal with pressure first*/
+-	int numvertices = element->GetNumberOfVertices();
+-	IssmDouble* pressure  = xNew<IssmDouble>(numvertices);
+-	IssmDouble* thickness = xNew<IssmDouble>(numvertices);
+-	IssmDouble* surface   = xNew<IssmDouble>(numvertices);
+-
+-	element->FindParam(&meshtype,MeshTypeEnum);
+-	rho_ice =element->GetMaterialParameter(MaterialsRhoIceEnum);
+-	g       =element->GetMaterialParameter(ConstantsGEnum);
+-	switch(meshtype){
+-		case Mesh2DhorizontalEnum:
+-			element->GetInputListOnVertices(thickness,ThicknessEnum);
+-			for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*thickness[i];
+-			break;
+-		case Mesh3DEnum:
+-			element->GetVerticesCoordinates(&xyz_list);
+-			element->GetInputListOnVertices(surface,SurfaceEnum);
+-			for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
+-			break;
+-		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+-	}
+-	element->AddInput(PressureEnum,pressure,P1Enum);
+-	xDelete<IssmDouble>(pressure);
+-	xDelete<IssmDouble>(thickness);
+-	xDelete<IssmDouble>(surface);
+-
+-	/*Get basal element*/
+-	switch(meshtype){
+-		case Mesh2DhorizontalEnum:
+-			basalelement = element;
+-			break;
+-		case Mesh3DEnum:
+-			if(!element->IsOnBed()){xDelete<IssmDouble>(xyz_list); return;}
+-			basalelement=element->SpawnBasalElement();
+-			break;
+-		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+-	}
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = basalelement->GetNumberOfNodes();
+-	int numdof   = numnodes*2;
+-
+-	/*Fetch dof list and allocate solution vectors*/
+-	basalelement->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+-	IssmDouble* values    = xNew<IssmDouble>(numdof);
+-	IssmDouble* vx        = xNew<IssmDouble>(numnodes);
+-	IssmDouble* vy        = xNew<IssmDouble>(numnodes);
+-	IssmDouble* vz        = xNew<IssmDouble>(numnodes);
+-	IssmDouble* vel       = xNew<IssmDouble>(numnodes);
+-
+-	/*Use the dof list to index into the solution vector: */
+-	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+-
+-	/*Transform solution in Cartesian Space*/
+-	basalelement->TransformSolutionCoord(&values[0],XYEnum);
+-	basalelement->FindParam(&meshtype,MeshTypeEnum);
+-
+-	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+-	for(i=0;i<numnodes;i++){
+-		vx[i]=values[i*2+0];
+-		vy[i]=values[i*2+1];
+-
+-		/*Check solution*/
+-		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
+-		if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
+-	}
+-
+-	/*Get Vz and compute vel*/
+-	basalelement->GetInputListOnNodes(&vz[0],VzEnum,0.);
+-	for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
+-
+-	/*Now, we have to move the previous Vx and Vy inputs  to old 
+-	 * status, otherwise, we'll wipe them off: */
+-	element->InputChangeName(VxEnum,VxPicardEnum);
+-	element->InputChangeName(VyEnum,VyPicardEnum);
+-
+-	/*Add vx and vy as inputs to the tria element: */
+-	element->AddBasalInput(VxEnum,vx,P1Enum);
+-	element->AddBasalInput(VyEnum,vy,P1Enum);
+-	element->AddBasalInput(VelEnum,vel,P1Enum);
+-
+-	/*Free ressources:*/
+-	xDelete<IssmDouble>(vel);
+-	xDelete<IssmDouble>(vz);
+-	xDelete<IssmDouble>(vy);
+-	xDelete<IssmDouble>(vx);
+-	xDelete<IssmDouble>(values);
+-	xDelete<IssmDouble>(xyz_list);
+-	xDelete<int>(doflist);
+-	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+-}/*}}}*/
+-void StressbalanceAnalysis::InputUpdateFromSolutionSSA(IssmDouble* solution,Element* element){/*{{{*/
+-
+-	int         i,meshtype;
+-	IssmDouble  rho_ice,g;
+-	int*        doflist=NULL;
+-	IssmDouble* xyz_list=NULL;
+-	Element*    basalelement=NULL;
+-
+-	/*Deal with pressure first*/
+-	int numvertices = element->GetNumberOfVertices();
+-	IssmDouble* pressure  = xNew<IssmDouble>(numvertices);
+-	IssmDouble* thickness = xNew<IssmDouble>(numvertices);
+-	IssmDouble* surface   = xNew<IssmDouble>(numvertices);
+-
+-	element->FindParam(&meshtype,MeshTypeEnum);
+-	rho_ice =element->GetMaterialParameter(MaterialsRhoIceEnum);
+-	g       =element->GetMaterialParameter(ConstantsGEnum);
+-	switch(meshtype){
+-		case Mesh2DhorizontalEnum:
+-			element->GetInputListOnVertices(thickness,ThicknessEnum);
+-			for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*thickness[i];
+-			break;
+-		case Mesh3DEnum:
+-			element->GetVerticesCoordinates(&xyz_list);
+-			element->GetInputListOnVertices(surface,SurfaceEnum);
+-			for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
+-			break;
+-		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+-	}
+-	element->AddInput(PressureEnum,pressure,P1Enum);
+-	xDelete<IssmDouble>(pressure);
+-	xDelete<IssmDouble>(thickness);
+-	xDelete<IssmDouble>(surface);
+-
+-	/*Get basal element*/
+-	switch(meshtype){
+-		case Mesh2DhorizontalEnum:
+-			basalelement = element;
+-			break;
+-		case Mesh3DEnum:
+-			if(!element->IsOnBed()){xDelete<IssmDouble>(xyz_list); return;}
+-			basalelement=element->SpawnBasalElement();
+-			break;
+-		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+-	}
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = basalelement->GetNumberOfNodes();
+-	int numdof   = numnodes*2;
+-
+-	/*Fetch dof list and allocate solution vectors*/
+-	basalelement->GetDofList(&doflist,SSAApproximationEnum,GsetEnum);
+-	IssmDouble* values    = xNew<IssmDouble>(numdof);
+-	IssmDouble* vx        = xNew<IssmDouble>(numnodes);
+-	IssmDouble* vy        = xNew<IssmDouble>(numnodes);
+-	IssmDouble* vz        = xNew<IssmDouble>(numnodes);
+-	IssmDouble* vel       = xNew<IssmDouble>(numnodes);
+-
+-	/*Use the dof list to index into the solution vector: */
+-	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+-
+-	/*Transform solution in Cartesian Space*/
+-	basalelement->TransformSolutionCoord(&values[0],XYEnum);
+-	basalelement->FindParam(&meshtype,MeshTypeEnum);
+-
+-	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+-	for(i=0;i<numnodes;i++){
+-		vx[i]=values[i*2+0];
+-		vy[i]=values[i*2+1];
+-
+-		/*Check solution*/
+-		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
+-		if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
+-	}
+-
+-	/*Get Vz and compute vel*/
+-	basalelement->GetInputListOnNodes(&vz[0],VzEnum,0.);
+-	for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
+-
+-	/*Now, we have to move the previous Vx and Vy inputs  to old 
+-	 * status, otherwise, we'll wipe them off: */
+-	element->InputChangeName(VxEnum,VxPicardEnum);
+-	element->InputChangeName(VyEnum,VyPicardEnum);
+-
+-	/*Add vx and vy as inputs to the tria element: */
+-	element->AddBasalInput(VxEnum,vx,P1Enum);
+-	element->AddBasalInput(VyEnum,vy,P1Enum);
+-	element->AddBasalInput(VelEnum,vel,P1Enum);
+-
+-	/*Free ressources:*/
+-	xDelete<IssmDouble>(vel);
+-	xDelete<IssmDouble>(vz);
+-	xDelete<IssmDouble>(vy);
+-	xDelete<IssmDouble>(vx);
+-	xDelete<IssmDouble>(values);
+-	xDelete<IssmDouble>(xyz_list);
+-	xDelete<int>(doflist);
+-	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+-}/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionSSAFS(IssmDouble* solution,Element* element){/*{{{*/
+ 
+ 	int         i;
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16828)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16829)
+@@ -143,6 +143,7 @@
+ 		virtual void   ResetCoordinateSystem()=0;
+ 		virtual IssmDouble StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa)=0;
+ 		virtual void   ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input)=0;
++		virtual void   ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input)=0;
+ 		virtual void   ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input)=0;
+ 		virtual int    VelocityInterpolation()=0;
+ 		virtual int    PressureInterpolation()=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16828)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16829)
+@@ -304,6 +304,7 @@
+ 		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int transformenum){_error_("not implemented yet");};
+ 		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int* transformenum_list){_error_("not implemented yet");};
+ 		void           ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
++		void           ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented yet");};
+ 		void           ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 
+ 		#ifdef _HAVE_STRESSBALANCE_
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16828)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16829)
+@@ -1542,7 +1542,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION Penta::GetStrainRate3dHO{{{*/
+-void Penta::GetStrainRate3dHO(IssmDouble* epsilon,IssmDouble* xyz_list, GaussPenta* gauss, Input* vx_input, Input* vy_input){
++void Penta::GetStrainRate3dHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss, Input* vx_input, Input* vy_input){
+ 	/*Compute the 3d Blatter/HOStrain Rate (5 components):
+ 	 *
+ 	 * epsilon=[exx eyy exy exz eyz]
+@@ -1571,7 +1571,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION Penta::GetStrainRate3d{{{*/
+-void Penta::GetStrainRate3d(IssmDouble* epsilon,IssmDouble* xyz_list, GaussPenta* gauss, Input* vx_input, Input* vy_input, Input* vz_input){
++void Penta::GetStrainRate3d(IssmDouble* epsilon,IssmDouble* xyz_list, Gauss* gauss, Input* vx_input, Input* vy_input, Input* vz_input){
+ 	/*Compute the 3d Strain Rate (6 components):
+ 	 *
+ 	 * epsilon=[exx eyy ezz exy exz eyz]
+@@ -3483,6 +3483,20 @@
+ 	*pphi = phi;
+ }
+ /*}}}*/
++/*FUNCTION Penta::ViscosityHO{{{*/
++void Penta::ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){
++
++	/*Intermediaries*/
++	IssmDouble viscosity;
++	IssmDouble epsilon[5];/* epsilon=[exx,eyy,exy,exz,eyz];*/
++
++	this->GetStrainRate3dHO(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
++	material->GetViscosity3d(&viscosity, &epsilon[0]);
++
++	/*Assign output pointer*/
++	*pviscosity=viscosity;
++}
++/*}}}*/
+ /*FUNCTION Penta::VelocityInterpolation{{{*/
+ int Penta::VelocityInterpolation(void){
+ 	return PentaRef::VelocityInterpolation();
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16828)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16829)
+@@ -229,8 +229,8 @@
+ 		void           GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype);
+ 		void	         GetPhi(IssmDouble* phi, IssmDouble*  epsilon, IssmDouble viscosity);
+ 		void           GetQuadNormal(IssmDouble* normal,IssmDouble xyz_list[4][3]);
+-		void           GetStrainRate3dHO(IssmDouble* epsilon,IssmDouble* xyz_list, GaussPenta* gauss, Input* vx_input, Input* vy_input);
+-		void           GetStrainRate3d(IssmDouble* epsilon,IssmDouble* xyz_list, GaussPenta* gauss, Input* vx_input, Input* vy_input, Input* vz_input);
++		void           GetStrainRate3dHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss, Input* vx_input, Input* vy_input);
++		void           GetStrainRate3d(IssmDouble* epsilon,IssmDouble* xyz_list, Gauss* gauss, Input* vx_input, Input* vy_input, Input* vz_input);
+ 		Penta*         GetUpperElement(void);
+ 		void           GetZeroLevelsetCoordinates(IssmDouble* xyz_zero,IssmDouble xyz_list[6][3],int levelsetenum);
+ 		Penta*         GetLowerElement(void);
+@@ -274,6 +274,7 @@
+ 		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* transformenum_list){_error_("not implemented yet");};
+ 		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int transformenum){_error_("not implemented yet");};
+ 		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int* transformenum_list){_error_("not implemented yet");};
++		void           ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 		void           ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
+ 
+ 		#ifdef _HAVE_STRESSBALANCE_
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16828)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16829)
+@@ -144,6 +144,7 @@
+ 		ElementVector* NewElementVector(int approximation_enum){_error_("not implemented yet");};
+ 		ElementMatrix* NewElementMatrix(int approximation_enum){_error_("not implemented yet");};
+ 		void           ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
++		void           ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
+ 		void           ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
+ 		#ifdef _HAVE_THERMAL_
+ 		void UpdateBasalConstraintsEnthalpy(void){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16829-16830.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16829-16830.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16829-16830.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/m/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/m/Makefile.am	(revision 16829)
++++ ../trunk-jpl/src/m/Makefile.am	(revision 16830)
+@@ -65,6 +65,7 @@
+ 					./exp/*.py \
+ 					./geometry/*.py \
+ 					./coordsystems/*.py \
++					./interp/*.py \
+ 					./mech/*.py \
+ 					./mesh/*.py \
+ 					./mesh/rifts/*.py \
Index: issm/oecreview/Archive/16554-17801/ISSM-16830-16831.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16830-16831.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16830-16831.diff	(revision 17802)
@@ -0,0 +1,677 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16830)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16831)
+@@ -21,36 +21,47 @@
+ 
+ 		/*Finite element Analysis*/
+ 		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void GetSolutionFromInputsHoriz(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++
++		/*SSA*/
++		ElementMatrix* CreateKMatrixSSA(Element* element);
++		ElementMatrix* CreateKMatrixSSAViscous(Element* element);
++		ElementMatrix* CreateKMatrixSSAFriction(Element* element);
++		ElementVector* CreatePVectorSSA(Element* element);
++		ElementVector* CreatePVectorSSADrivingStress(Element* element);
++		ElementVector* CreatePVectorSSAFront(Element* element);
++		void GetBSSA(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBSSAprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void InputUpdateFromSolutionSSA(IssmDouble* solution,Element* element);
++		/*L1L2*/
++		void InputUpdateFromSolutionL1L2(IssmDouble* solution,Element* element);
++		/*HO*/
+ 		ElementMatrix* CreateKMatrixHO(Element* element);
+ 		ElementMatrix* CreateKMatrixHOViscous(Element* element);
+ 		ElementMatrix* CreateKMatrixHOFriction(Element* element);
+-		ElementMatrix* CreateKMatrixSSA(Element* element);
+-		ElementMatrix* CreateKMatrixSSAViscous(Element* element);
+-		ElementMatrix* CreateKMatrixSSAFriction(Element* element);
+-		ElementVector* CreatePVector(Element* element);
+-		ElementVector* CreatePVectorFS(Element* element);
+-		ElementVector* CreatePVectorFSViscous(Element* element);
+-		ElementVector* CreatePVectorFSShelf(Element* element);
+-		ElementVector* CreatePVectorFSFront(Element* element);
+ 		ElementVector* CreatePVectorHO(Element* element);
+ 		ElementVector* CreatePVectorHODrivingStress(Element* element);
+ 		ElementVector* CreatePVectorHOFront(Element* element);
+-		ElementVector* CreatePVectorSSA(Element* element);
+-		ElementVector* CreatePVectorSSADrivingStress(Element* element);
+-		ElementVector* CreatePVectorSSAFront(Element* element);
+ 		void GetBHO(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetBHOprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+-		void GetBSSA(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+-		void GetBSSAprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+-		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolutionHO(IssmDouble* solution,Element* element);
++		/*FS*/
++		ElementMatrix* CreateKMatrixFS(Element* element);
++		ElementMatrix* CreateKMatrixFSViscous(Element* element);
++		ElementMatrix* CreateKMatrixFSFriction(Element* element);
++		ElementVector* CreatePVectorFS(Element* element);
++		ElementVector* CreatePVectorFSViscous(Element* element);
++		ElementVector* CreatePVectorFSShelf(Element* element);
++		ElementVector* CreatePVectorFSFront(Element* element);
++		void GetBFS(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBFSprime(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputsFS(Vector<IssmDouble>* solution,Element* element);
+-		void GetSolutionFromInputsHoriz(Vector<IssmDouble>* solution,Element* element);
+-		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionFS(IssmDouble* solution,Element* element);
+-		void InputUpdateFromSolutionHO(IssmDouble* solution,Element* element);
++		/*Coupling*/
+ 		void InputUpdateFromSolutionHOFS(IssmDouble* solution,Element* element);
+-		void InputUpdateFromSolutionL1L2(IssmDouble* solution,Element* element);
+-		void InputUpdateFromSolutionSSA(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionSSAFS(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionSSAHO(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 16830)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 16831)
+@@ -55,7 +55,59 @@
+ 
+ /*Finite Element Analysis*/
+ ElementMatrix* L2ProjectionBaseAnalysis::CreateKMatrix(Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	/*Intermediaries*/
++	int      meshtype;
++	Element* basalelement;
++
++	/*Get basal element*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Intermediaries */
++	IssmDouble  D,Jdet;
++	IssmDouble *xyz_list  = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = basalelement->GetNumberOfNodes();
++
++	/*Initialize Element vector*/
++	ElementMatrix* Ke    = basalelement->NewElementMatrix(NoneApproximationEnum);
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	basalelement->GetVerticesCoordinates(&xyz_list);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=basalelement->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		basalelement->NodalFunctions(basis,gauss);
++		D=gauss->weight*Jdet;
++
++		TripleMultiply(basis,1,numnodes,1,
++					&D,1,1,0,
++					basis,1,numnodes,0,
++					&Ke->values[0],1);
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	return Ke;
+ }/*}}}*/
+ ElementVector* L2ProjectionBaseAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16830)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16831)
+@@ -819,6 +819,8 @@
+ 			return CreateKMatrixSSA(element);
+ 		case HOApproximationEnum: 
+ 			return CreateKMatrixHO(element);
++		case FSApproximationEnum: 
++			return CreateKMatrixFS(element);
+ 		case NoneApproximationEnum:
+ 			return NULL;
+ 		default:
+@@ -1657,6 +1659,93 @@
+ }/*}}}*/
+ 
+ /*FS*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixFS(Element* element){/*{{{*/
++
++	/*compute all stiffness matrices for this element*/
++	ElementMatrix* Ke1=CreateKMatrixFSViscous(element);
++	ElementMatrix* Ke2=CreateKMatrixFSFriction(element);
++	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
++
++	/*clean-up and return*/
++	delete Ke1;
++	delete Ke2;
++	return Ke;
++}/*}}}*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixFSViscous(Element* element){/*{{{*/
++
++	/*Intermediaries*/
++	int         i,meshtype,dim,epssize;
++	IssmDouble  viscosity,FSreconditioning,Jdet;
++	IssmDouble *xyz_list = NULL;
++
++	/*Get problem dimension*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; epssize = 3; break;
++		case Mesh3DEnum:         dim = 3; epssize = 6; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int vnumnodes = element->GetNumberOfNodesVelocity();
++	int pnumnodes = element->GetNumberOfNodesPressure();
++	int numdof    = vnumnodes*dim + pnumnodes;
++	int bsize     = epssize + 2;
++
++	/*Prepare coordinate system list*/
++	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
++	if(dim==2) for(i=0;i<vnumnodes;i++) cs_list[i] = XYEnum;
++	else       for(i=0;i<vnumnodes;i++) cs_list[i] = XYZEnum;
++	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
++
++	/*Initialize Element matrix and vectors*/
++	ElementMatrix* Ke     = element->NewElementMatrix(FSvelocityEnum);
++	IssmDouble*    B      = xNew<IssmDouble>(bsize*numdof);
++	IssmDouble*    Bprime = xNew<IssmDouble>(bsize*numdof);
++	IssmDouble*    D      = xNewZeroInit<IssmDouble>(bsize*bsize);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
++	Input* vx_input=element->GetInput(VxEnum);     _assert_(vx_input);
++	Input* vy_input=element->GetInput(VyEnum);     _assert_(vy_input);
++	Input* vz_input;
++	if(dim==3){vz_input=element->GetInput(VzEnum); _assert_(vz_input);}
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss = element->NewGauss(5);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		this->GetBFS(B,element,dim,xyz_list,gauss);
++		this->GetBFSprime(Bprime,element,dim,xyz_list,gauss);
++
++		element->ViscosityFS(&viscosity,xyz_list,gauss,vx_input,vy_input,vz_input);
++		for(i=0;i<epssize;i++)     D[i*bsize+i] = + 2.*viscosity*gauss->weight*Jdet;
++		for(i=epssize;i<bsize;i++) D[i*bsize+i] = - FSreconditioning*gauss->weight*Jdet;
++
++		TripleMultiply(B,bsize,numdof,1,
++					D,bsize,bsize,0,
++					Bprime,bsize,numdof,0,
++					&Ke->values[0],1);
++	}
++
++	/*Transform Coordinate System*/
++	element->TransformStiffnessMatrixCoord(Ke,cs_list);
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(D);
++	xDelete<IssmDouble>(Bprime);
++	xDelete<IssmDouble>(B);
++	xDelete<int>(cs_list);
++	return Ke;
++}/*}}}*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixFSFriction(Element* element){/*{{{*/
++	return NULL;
++}/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorFS(Element* element){/*{{{*/
+ 
+ 	/*compute all load vectors for this element*/
+@@ -1816,6 +1905,231 @@
+ 
+ 	return NULL;
+ }/*}}}*/
++void StressbalanceAnalysis::GetBFS(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B  matrix. B=[Bv1 Bv2 ... Bp1 Bp2 ...] where Bvi is of size 3*NDOF3. 
++	 * For node i, Bvi can be expressed in the actual coordinate system
++	 * by: 	   Bvi=[ dphi/dx          0        ]
++	 *					 [   0           dphi/dy     ]
++	 *					 [ 1/2*dphi/dy    1/2*dphi/dx]
++	 *					 [   0             0         ]
++	 *					 [ dphi/dx         dphi/dy   ]
++	 *
++	 *         Bpi=[  0    ]
++	 *					[  0    ]
++	 *					[  0    ]
++	 *					[ phi_p ]
++	 *					[  0    ]
++	 *
++	 *	In 3d:
++	 *     	   Bvi=[ dh/dx          0             0      ]
++	 *					[   0           dh/dy           0      ]
++	 *					[   0             0           dh/dz    ]
++	 *					[ 1/2*dh/dy    1/2*dh/dx        0      ]
++	 *					[ 1/2*dh/dz       0         1/2*dh/dx  ]
++	 *					[   0          1/2*dh/dz    1/2*dh/dy  ]
++	 *					[   0             0             0      ]
++	 *					[ dh/dx         dh/dy         dh/dz    ]
++	 *
++	 *         Bpi=[ 0 ]
++	 *					[ 0 ]
++	 *					[ 0 ]
++	 *					[ 0 ]
++	 *					[ 0 ]
++	 *					[ 0 ]
++	 *					[ h ]
++	 *					[ 0 ]
++	 *	where phi is the finiteelement function for node i.
++	 *	Same thing for Bb except the last column that does not exist.
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int pnumnodes = element->NumberofNodesPressure();
++	int vnumnodes = element->NumberofNodesVelocity();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* vdbasis=xNew<IssmDouble>(dim*vnumnodes);
++	IssmDouble* pbasis =xNew<IssmDouble>(pnumnodes);
++	element->NodalFunctionsDerivativesVelocity(vdbasis,xyz_list,gauss);
++	element->NodalFunctionsPressure(pbasis,gauss);
++
++	/*Build B: */
++	if(dim==2){
++		for(int i=0;i<vnumnodes;i++){
++			B[(dim*vnumnodes+pnumnodes)*0+dim*i+0] = vdbasis[0*vnumnodes+i];
++			B[(dim*vnumnodes+pnumnodes)*0+dim*i+1] = 0.;
++			B[(dim*vnumnodes+pnumnodes)*1+dim*i+0] = 0.;
++			B[(dim*vnumnodes+pnumnodes)*1+dim*i+1] = vdbasis[1*vnumnodes+i];
++			B[(dim*vnumnodes+pnumnodes)*2+dim*i+0] = .5*vdbasis[1*vnumnodes+i];
++			B[(dim*vnumnodes+pnumnodes)*2+dim*i+1] = .5*vdbasis[0*vnumnodes+i];
++			B[(dim*vnumnodes+pnumnodes)*3+dim*i+0] = 0.;
++			B[(dim*vnumnodes+pnumnodes)*3+dim*i+1] = 0.;
++			B[(dim*vnumnodes+pnumnodes)*4+dim*i+0] = vdbasis[0*vnumnodes+i];
++			B[(dim*vnumnodes+pnumnodes)*4+dim*i+1] = vdbasis[1*vnumnodes+i];
++		}
++		for(int i=0;i<pnumnodes;i++){
++			B[(dim*vnumnodes+pnumnodes)*0+(dim*vnumnodes)+i] = 0.;
++			B[(dim*vnumnodes+pnumnodes)*1+(dim*vnumnodes)+i] = 0.;
++			B[(dim*vnumnodes+pnumnodes)*2+(dim*vnumnodes)+i] = 0.;
++			B[(dim*vnumnodes+pnumnodes)*3+(dim*vnumnodes)+i] = pbasis[i];
++			B[(dim*vnumnodes+pnumnodes)*4+(dim*vnumnodes)+i] = 0.;
++		}
++	}
++	else{
++		for(int i=0;i<vnumnodes;i++){
++			B[(dim*vnumnodes+pnumnodes)*0+dim*i+0] = vdbasis[0*vnumnodes+i];
++			B[(dim*vnumnodes+pnumnodes)*0+dim*i+1] = 0.;
++			B[(dim*vnumnodes+pnumnodes)*0+dim*i+2] = 0.;
++			B[(dim*vnumnodes+pnumnodes)*1+dim*i+0] = 0.;
++			B[(dim*vnumnodes+pnumnodes)*1+dim*i+1] = vdbasis[1*vnumnodes+i];
++			B[(dim*vnumnodes+pnumnodes)*1+dim*i+2] = 0.;
++			B[(dim*vnumnodes+pnumnodes)*2+dim*i+0] = 0.;
++			B[(dim*vnumnodes+pnumnodes)*2+dim*i+1] = 0.;
++			B[(dim*vnumnodes+pnumnodes)*2+dim*i+2] = vdbasis[2*vnumnodes+i];
++			B[(dim*vnumnodes+pnumnodes)*3+dim*i+0] = .5*vdbasis[1*vnumnodes+i];
++			B[(dim*vnumnodes+pnumnodes)*3+dim*i+1] = .5*vdbasis[0*vnumnodes+i];
++			B[(dim*vnumnodes+pnumnodes)*3+dim*i+2] = 0.;
++			B[(dim*vnumnodes+pnumnodes)*4+dim*i+0] = .5*vdbasis[2*vnumnodes+i];
++			B[(dim*vnumnodes+pnumnodes)*4+dim*i+1] = 0.;
++			B[(dim*vnumnodes+pnumnodes)*4+dim*i+2] = .5*vdbasis[0*vnumnodes+i];
++			B[(dim*vnumnodes+pnumnodes)*5+dim*i+0] = 0.;
++			B[(dim*vnumnodes+pnumnodes)*5+dim*i+1] = .5*vdbasis[2*vnumnodes+i];
++			B[(dim*vnumnodes+pnumnodes)*5+dim*i+2] = .5*vdbasis[1*vnumnodes+i];
++			B[(dim*vnumnodes+pnumnodes)*6+dim*i+0] = 0.;
++			B[(dim*vnumnodes+pnumnodes)*6+dim*i+1] = 0.;
++			B[(dim*vnumnodes+pnumnodes)*6+dim*i+2] = 0.;
++			B[(dim*vnumnodes+pnumnodes)*7+dim*i+0] = vdbasis[0*vnumnodes+i];
++			B[(dim*vnumnodes+pnumnodes)*7+dim*i+1] = vdbasis[1*vnumnodes+i];
++			B[(dim*vnumnodes+pnumnodes)*7+dim*i+2] = vdbasis[2*vnumnodes+i];
++		}
++		for(int i=0;i<pnumnodes;i++){
++			B[(dim*vnumnodes+pnumnodes)*0+(dim*vnumnodes)+i] = 0.;
++			B[(dim*vnumnodes+pnumnodes)*1+(dim*vnumnodes)+i] = 0.;
++			B[(dim*vnumnodes+pnumnodes)*2+(dim*vnumnodes)+i] = 0.;
++			B[(dim*vnumnodes+pnumnodes)*3+(dim*vnumnodes)+i] = 0.;
++			B[(dim*vnumnodes+pnumnodes)*4+(dim*vnumnodes)+i] = 0.;
++			B[(dim*vnumnodes+pnumnodes)*5+(dim*vnumnodes)+i] = 0.;
++			B[(dim*vnumnodes+pnumnodes)*6+(dim*vnumnodes)+i] = pbasis[i];
++			B[(dim*vnumnodes+pnumnodes)*7+(dim*vnumnodes)+i] = 0.;
++		}
++	}
++
++	/*Clean up*/
++	xDelete<IssmDouble>(vdbasis);
++	xDelete<IssmDouble>(pbasis);
++}/*}}}*/
++void StressbalanceAnalysis::GetBFSprime(IssmDouble* Bprime,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*	Compute B'  matrix. B'=[B1' B2' B3' B4' B5' B6' Bb'] where Bi' is of size 3*NDOF2. 
++	 *	For node i, Bi' can be expressed in the actual coordinate system
++	 *	by: 
++	 *			Bvi' = [  dphi/dx     0     ]
++	 *					 [     0      dphi/dy ]
++	 *					 [  dphi/dy   dphi/dx ]
++	 *					 [  dphi/dx   dphi/dy ]
++	 *					 [     0      0       ]
++	 *
++	 * by: 	  Bpi=[  0  ]
++	 *					[  0  ]
++	 *					[  0  ]
++	 *					[  0  ]
++	 *					[ phi ]
++	 *
++	 *	In 3d
++	 *     	   Bvi=[ dh/dx          0             0      ]
++	 *					[   0           dh/dy           0      ]
++	 *					[   0             0           dh/dz    ]
++	 *					[ 1/2*dh/dy    1/2*dh/dx        0      ]
++	 *					[ 1/2*dh/dz       0         1/2*dh/dx  ]
++	 *					[   0          1/2*dh/dz    1/2*dh/dy  ]
++	 *					[   0             0             0      ]
++	 *					[ dh/dx         dh/dy         dh/dz    ]
++	 *
++	 *         Bpi=[ 0 ]
++	 *					[ 0 ]
++	 *					[ 0 ]
++	 *					[ 0 ]
++	 *					[ 0 ]
++	 *					[ 0 ]
++	 *					[ h ]
++	 *					[ 0 ]
++	 *	where phi is the finiteelement function for node i.
++	 *	In 3d:
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int pnumnodes = element->NumberofNodesPressure();
++	int vnumnodes = element->NumberofNodesVelocity();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* vdbasis=xNew<IssmDouble>(dim*vnumnodes);
++	IssmDouble* pbasis =xNew<IssmDouble>(pnumnodes);
++	element->NodalFunctionsDerivativesVelocity(vdbasis,xyz_list,gauss);
++	element->NodalFunctionsPressure(pbasis,gauss);
++
++	/*Build B_prime: */
++	if(dim==2){
++		for(int i=0;i<vnumnodes;i++){
++			Bprime[(dim*vnumnodes+pnumnodes)*0+dim*i+0] = vdbasis[0*vnumnodes+i];
++			Bprime[(dim*vnumnodes+pnumnodes)*0+dim*i+1] = 0.;
++			Bprime[(dim*vnumnodes+pnumnodes)*1+dim*i+0] = 0.;
++			Bprime[(dim*vnumnodes+pnumnodes)*1+dim*i+1] = vdbasis[1*vnumnodes+i];
++			Bprime[(dim*vnumnodes+pnumnodes)*2+dim*i+0] = vdbasis[1*vnumnodes+i];
++			Bprime[(dim*vnumnodes+pnumnodes)*2+dim*i+1] = vdbasis[0*vnumnodes+i];
++			Bprime[(dim*vnumnodes+pnumnodes)*3+dim*i+0] = vdbasis[0*vnumnodes+i];
++			Bprime[(dim*vnumnodes+pnumnodes)*3+dim*i+1] = vdbasis[1*vnumnodes+i];
++			Bprime[(dim*vnumnodes+pnumnodes)*4+dim*i+0] = 0.;
++			Bprime[(dim*vnumnodes+pnumnodes)*4+dim*i+1] = 0.;
++		}
++		for(int i=0;i<pnumnodes;i++){
++			Bprime[(dim*vnumnodes+pnumnodes)*0+(dim*vnumnodes)+i] = 0.;
++			Bprime[(dim*vnumnodes+pnumnodes)*1+(dim*vnumnodes)+i] = 0.;
++			Bprime[(dim*vnumnodes+pnumnodes)*2+(dim*vnumnodes)+i] = 0.;
++			Bprime[(dim*vnumnodes+pnumnodes)*3+(dim*vnumnodes)+i] = 0.;
++			Bprime[(dim*vnumnodes+pnumnodes)*4+(dim*vnumnodes)+i] = pbasis[i];
++		}
++	}
++	else{
++		for(int i=0;i<vnumnodes;i++){
++			Bprime[(dim*vnumnodes+pnumnodes)*0+dim*i+0] = vdbasis[0*vnumnodes+i];
++			Bprime[(dim*vnumnodes+pnumnodes)*0+dim*i+1] = 0.;
++			Bprime[(dim*vnumnodes+pnumnodes)*0+dim*i+2] = 0.;
++			Bprime[(dim*vnumnodes+pnumnodes)*1+dim*i+0] = 0.;
++			Bprime[(dim*vnumnodes+pnumnodes)*1+dim*i+1] = vdbasis[1*vnumnodes+i];
++			Bprime[(dim*vnumnodes+pnumnodes)*1+dim*i+2] = 0.;
++			Bprime[(dim*vnumnodes+pnumnodes)*2+dim*i+0] = 0.;
++			Bprime[(dim*vnumnodes+pnumnodes)*2+dim*i+1] = 0.;
++			Bprime[(dim*vnumnodes+pnumnodes)*2+dim*i+2] = vdbasis[2*vnumnodes+i];
++			Bprime[(dim*vnumnodes+pnumnodes)*3+dim*i+0] = vdbasis[1*vnumnodes+i];
++			Bprime[(dim*vnumnodes+pnumnodes)*3+dim*i+1] = vdbasis[0*vnumnodes+i];
++			Bprime[(dim*vnumnodes+pnumnodes)*3+dim*i+2] = 0.;
++			Bprime[(dim*vnumnodes+pnumnodes)*4+dim*i+0] = vdbasis[2*vnumnodes+i];
++			Bprime[(dim*vnumnodes+pnumnodes)*4+dim*i+1] = 0.;
++			Bprime[(dim*vnumnodes+pnumnodes)*4+dim*i+2] = vdbasis[0*vnumnodes+i];
++			Bprime[(dim*vnumnodes+pnumnodes)*5+dim*i+0] = 0.;
++			Bprime[(dim*vnumnodes+pnumnodes)*5+dim*i+1] = vdbasis[2*vnumnodes+i];
++			Bprime[(dim*vnumnodes+pnumnodes)*5+dim*i+2] = vdbasis[1*vnumnodes+i];
++			Bprime[(dim*vnumnodes+pnumnodes)*6+dim*i+0] = vdbasis[0*vnumnodes+i];
++			Bprime[(dim*vnumnodes+pnumnodes)*6+dim*i+1] = vdbasis[1*vnumnodes+i];
++			Bprime[(dim*vnumnodes+pnumnodes)*6+dim*i+2] = vdbasis[2*vnumnodes+i];
++			Bprime[(dim*vnumnodes+pnumnodes)*7+dim*i+0] = 0.;
++			Bprime[(dim*vnumnodes+pnumnodes)*7+dim*i+1] = 0.;
++			Bprime[(dim*vnumnodes+pnumnodes)*7+dim*i+2] = 0.;
++		}
++		for(int i=0;i<pnumnodes;i++){
++			Bprime[(dim*vnumnodes+pnumnodes)*0+(dim*vnumnodes)+i] = 0.;
++			Bprime[(dim*vnumnodes+pnumnodes)*1+(dim*vnumnodes)+i] = 0.;
++			Bprime[(dim*vnumnodes+pnumnodes)*2+(dim*vnumnodes)+i] = 0.;
++			Bprime[(dim*vnumnodes+pnumnodes)*3+(dim*vnumnodes)+i] = 0.;
++			Bprime[(dim*vnumnodes+pnumnodes)*4+(dim*vnumnodes)+i] = 0.;
++			Bprime[(dim*vnumnodes+pnumnodes)*5+(dim*vnumnodes)+i] = 0.;
++			Bprime[(dim*vnumnodes+pnumnodes)*6+(dim*vnumnodes)+i] = 0.;
++			Bprime[(dim*vnumnodes+pnumnodes)*7+(dim*vnumnodes)+i] = pbasis[i];
++		}
++	}
++
++	/*Clean up*/
++	xDelete<IssmDouble>(vdbasis);
++	xDelete<IssmDouble>(pbasis);
++}/*}}}*/
+ void StressbalanceAnalysis::GetSolutionFromInputsFS(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 
+ 	int*         vdoflist=NULL;
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16830)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16831)
+@@ -56,9 +56,10 @@
+ 		virtual IssmDouble GetMaterialParameter(int enum_in)=0;
+ 		virtual IssmDouble MinEdgeLength(IssmDouble* xyz_list)=0;
+ 		virtual void   NodalFunctions(IssmDouble* basis,Gauss* gauss)=0;
++		virtual void   NodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss)=0;
++		virtual void   NodalFunctionsPressure(IssmDouble* basis, Gauss* gauss)=0;
+ 		virtual void   NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss)=0;
+-		virtual void   NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss)=0;
+-		virtual void   NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss)=0;
++		virtual void   NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss)=0;
+ 		virtual void   NormalBase(IssmDouble* normal,IssmDouble* xyz_list)=0;
+ 		virtual void   NormalTop(IssmDouble* normal,IssmDouble* xyz_list)=0;
+ 		virtual IssmDouble PureIceEnthalpy(IssmDouble pressure)=0;
+@@ -143,6 +144,7 @@
+ 		virtual void   ResetCoordinateSystem()=0;
+ 		virtual IssmDouble StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa)=0;
+ 		virtual void   ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input)=0;
++		virtual void   ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input)=0;
+ 		virtual void   ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input)=0;
+ 		virtual void   ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input)=0;
+ 		virtual int    VelocityInterpolation()=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16830)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16831)
+@@ -2242,6 +2242,14 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Tria::NodalFunctionsDerivativesVelocity{{{*/
++void Tria::NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussTriaEnum);
++	this->GetNodalFunctionsDerivativesVelocity(dbasis,xyz_list,(GaussTria*)gauss);
++
++}
++/*}}}*/
+ /*FUNCTION Tria::NodalFunctionsVelocity{{{*/
+ void Tria::NodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss){
+ 
+@@ -2765,6 +2773,13 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Tria::TransformStiffnessMatrixCoord(ElementMatrix* pe,int* transformenum_list){{{*/
++void Tria::TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* transformenum_list){
++
++	::TransformStiffnessMatrixCoord(Ke,this->nodes,this->NumberofNodes(),transformenum_list);
++
++}
++/*}}}*/
+ /*FUNCTION Tria::Update{{{*/
+ void Tria::Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finiteelement_type){
+ 
+@@ -2909,6 +2924,20 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Tria::ViscosityFS{{{*/
++void Tria::ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){
++
++	/*Intermediaries*/
++	IssmDouble viscosity;
++	IssmDouble epsilon[3];/* epsilon=[exx,eyy,exy];    */
++
++	this->GetStrainRate2d(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
++	material->GetViscosity2dvertical(&viscosity, &epsilon[0]);
++
++	/*Assign output pointer*/
++	*pviscosity=viscosity;
++}
++/*}}}*/
+ /*FUNCTION Tria::ViscositySSA{{{*/
+ void Tria::ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16830)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16831)
+@@ -285,6 +285,7 @@
+ 		ElementMatrix* NewElementMatrix(int approximation_enum);
+ 		void           NodalFunctions(IssmDouble* basis,Gauss* gauss);
+ 		void           NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
++		void           NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+ 		void           NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss);
+ 		void           NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss);
+ 		void	         SetClone(int* minranks);
+@@ -300,10 +301,11 @@
+ 		void           TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum){_error_("not implemented yet");};
+ 		void           TransformSolutionCoord(IssmDouble* values,int numnodes,int* transformenum_list){_error_("not implemented yet");};
+ 		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum);
+-		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* transformenum_list){_error_("not implemented yet");};
++		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* transformenum_list);
+ 		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int transformenum){_error_("not implemented yet");};
+ 		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int* transformenum_list){_error_("not implemented yet");};
+ 		void           ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
++		void           ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+ 		void           ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented yet");};
+ 		void           ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16830)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16831)
+@@ -2567,6 +2567,14 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Penta::NodalFunctionsDerivativesVelocity{{{*/
++void Penta::NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussPentaEnum);
++	this->GetNodalFunctionsDerivativesVelocity(dbasis,xyz_list,(GaussPenta*)gauss);
++
++}
++/*}}}*/
+ /*FUNCTION Penta::NodalFunctionsVelocity{{{*/
+ void Penta::NodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss){
+ 
+@@ -3217,6 +3225,13 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Penta::TransformStiffnessMatrixCoord(ElementMatrix* pe,int* transformenum_list){{{*/
++void Penta::TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* transformenum_list){
++
++	::TransformStiffnessMatrixCoord(Ke,this->nodes,this->NumberofNodes(),transformenum_list);
++
++}
++/*}}}*/
+ /*FUNCTION Penta::Update {{{*/
+ void Penta::Update(int index,IoModel* iomodel,int analysis_counter,int analysis_type,int finiteelement_type){ 
+ 
+@@ -3483,6 +3498,20 @@
+ 	*pphi = phi;
+ }
+ /*}}}*/
++/*FUNCTION Penta::ViscosityFS{{{*/
++void Penta::ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){
++
++	/*Intermediaries*/
++	IssmDouble viscosity;
++	IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
++
++	this->GetStrainRate3d(&epsilon[0],xyz_list,gauss,vx_input,vy_input,vz_input);
++	material->GetViscosity3dFS(&viscosity, &epsilon[0]);
++
++	/*Assign output pointer*/
++	*pviscosity=viscosity;
++}
++/*}}}*/
+ /*FUNCTION Penta::ViscosityHO{{{*/
+ void Penta::ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16830)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16831)
+@@ -255,6 +255,7 @@
+ 		ElementMatrix* NewElementMatrix(int approximation_enum);
+ 		void           NodalFunctions(IssmDouble* basis,Gauss* gauss);
+ 		void           NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
++		void           NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+ 		void           NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss);
+ 		void           NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss);
+ 		IssmDouble     MinEdgeLength(IssmDouble* xyz_list);
+@@ -271,9 +272,10 @@
+ 		void           TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum);      /*Tiling only*/
+ 		void           TransformSolutionCoord(IssmDouble* values,int numnodes,int* transformenum_list);/*Tiling only*/
+ 		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum);
+-		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* transformenum_list){_error_("not implemented yet");};
++		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* transformenum_list);
+ 		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int transformenum){_error_("not implemented yet");};
+ 		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int* transformenum_list){_error_("not implemented yet");};
++		void           ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+ 		void           ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 		void           ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16830)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16831)
+@@ -119,6 +119,7 @@
+ 		void        NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
++		void        NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		bool        NoIceInElement(){_error_("not implemented yet");};
+ 		void        NormalBase(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		void        NormalTop(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+@@ -144,6 +145,7 @@
+ 		ElementVector* NewElementVector(int approximation_enum){_error_("not implemented yet");};
+ 		ElementMatrix* NewElementMatrix(int approximation_enum){_error_("not implemented yet");};
+ 		void           ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
++		void           ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented");};
+ 		void           ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
+ 		void           ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
+ 		#ifdef _HAVE_THERMAL_
Index: issm/oecreview/Archive/16554-17801/ISSM-16831-16832.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16831-16832.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16831-16832.diff	(revision 17802)
@@ -0,0 +1,420 @@
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 16831)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 16832)
+@@ -135,7 +135,7 @@
+ 
+ 	/*Intermediaries */
+ 	IssmDouble  dhdt,mb,ms,Jdet;
+-	IssmDouble* xyz_list;
++	IssmDouble* xyz_list = NULL;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+@@ -176,7 +176,7 @@
+ 
+ 	/*Intermediaries */
+ 	IssmDouble  dhdt,mb,ms,Jdet;
+-	IssmDouble* xyz_list;
++	IssmDouble* xyz_list = NULL;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h	(revision 16831)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h	(revision 16832)
+@@ -21,9 +21,13 @@
+ 
+ 		/*Finite element Analysis*/
+ 		ElementMatrix* CreateKMatrix(Element* element);
++		ElementMatrix* CreateKMatrixCG(Element* element);
++		ElementMatrix* CreateKMatrixDG(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+ 		ElementVector* CreatePVectorCG(Element* element);
+ 		ElementVector* CreatePVectorDG(Element* element);
++		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16831)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16832)
+@@ -212,8 +212,211 @@
+ 
+ /*Finite Element Analysis*/
+ ElementMatrix* MasstransportAnalysis::CreateKMatrix(Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	if(!element->IsOnBed()) return NULL;
++	Element* basalelement = element->SpawnBasalElement();
++
++	int meshtype;
++	element->FindParam(&meshtype,MeshTypeEnum);
++
++	switch(element->FiniteElement()){
++		case P1Enum: case P2Enum:
++			return CreateKMatrixCG(basalelement);
++		case P1DGEnum:
++			return CreateKMatrixDG(basalelement);
++		default:
++			_error_("Element type " << EnumToStringx(element->FiniteElement()) << " not supported yet");
++	}
+ }/*}}}*/
++ElementMatrix* MasstransportAnalysis::CreateKMatrixCG(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	int        stabilization;
++	int        meshtype;
++	IssmDouble Jdet,D_scalar,dt,h;
++	IssmDouble vel,vx,vy,dvxdx,dvydy;
++	IssmDouble dvx[2],dvy[2];
++	IssmDouble* xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementMatrix* Ke     = element->NewElementMatrix();
++	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
++	IssmDouble*    B      = xNew<IssmDouble>(2*numnodes);
++	IssmDouble*    Bprime = xNew<IssmDouble>(2*numnodes);
++	IssmDouble     D[2][2];
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	element->FindParam(&dt,TimesteppingTimeStepEnum);
++	element->FindParam(&meshtype,MeshTypeEnum);
++	element->FindParam(&stabilization,MasstransportStabilizationEnum);
++	Input* vxaverage_input=NULL;
++	Input* vyaverage_input=NULL;
++	if(meshtype==Mesh2DhorizontalEnum){
++		vxaverage_input=element->GetInput(VxEnum); _assert_(vxaverage_input);
++		vyaverage_input=element->GetInput(VyEnum); _assert_(vyaverage_input);
++	}
++	else{
++		vxaverage_input=element->GetInput(VxAverageEnum); _assert_(vxaverage_input);
++		vyaverage_input=element->GetInput(VyAverageEnum); _assert_(vyaverage_input);
++	}
++	h = element->CharacteristicLength();
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctions(basis,gauss);
++
++		vxaverage_input->GetInputValue(&vx,gauss);
++		vyaverage_input->GetInputValue(&vy,gauss);
++		vxaverage_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
++		vyaverage_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
++
++		D_scalar=gauss->weight*Jdet;
++		TripleMultiply(basis,1,numnodes,1,
++					&D_scalar,1,1,0,
++					basis,1,numnodes,0,
++					&Ke->values[0],1);
++
++		GetB(B,element,xyz_list,gauss);
++		GetBprime(Bprime,element,xyz_list,gauss);
++
++		dvxdx=dvx[0];
++		dvydy=dvy[1];
++		D_scalar=dt*gauss->weight*Jdet;
++
++		D[0][0]=D_scalar*dvxdx;
++		D[0][1]=0.;
++		D[1][0]=0.;
++		D[1][1]=D_scalar*dvydy;
++		TripleMultiply(B,2,numnodes,1,
++					&D[0][0],2,2,0,
++					B,2,numnodes,0,
++					&Ke->values[0],1);
++
++		D[0][0]=D_scalar*vx;
++		D[1][1]=D_scalar*vy;
++		TripleMultiply(B,2,numnodes,1,
++					&D[0][0],2,2,0,
++					Bprime,2,numnodes,0,
++					&Ke->values[0],1);
++
++		if(stabilization==2){
++			/*Streamline upwinding*/
++			vel=sqrt(vx*vx+vy*vy)+1.e-8;
++			D[0][0]=h/(2*vel)*vx*vx;
++			D[1][0]=h/(2*vel)*vy*vx;
++			D[0][1]=h/(2*vel)*vx*vy;
++			D[1][1]=h/(2*vel)*vy*vy;
++		}
++		else if(stabilization==1){
++			/*SSA*/
++			vxaverage_input->GetInputAverage(&vx);
++			vyaverage_input->GetInputAverage(&vy);
++			D[0][0]=h/2.0*fabs(vx);
++			D[0][1]=0.;
++			D[1][0]=0.;
++			D[1][1]=h/2.0*fabs(vy);
++		}
++		if(stabilization==1 || stabilization==2){
++			D[0][0]=D_scalar*D[0][0];
++			D[1][0]=D_scalar*D[1][0];
++			D[0][1]=D_scalar*D[0][1];
++			D[1][1]=D_scalar*D[1][1];
++			TripleMultiply(Bprime,2,numnodes,1,
++						&D[0][0],2,2,0,
++						Bprime,2,numnodes,0,
++						&Ke->values[0],1);
++		}
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(B);
++	xDelete<IssmDouble>(Bprime);
++	delete gauss;
++	return Ke;
++}/*}}}*/
++ElementMatrix* MasstransportAnalysis::CreateKMatrixDG(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	int        meshtype;
++	IssmDouble Jdet,D_scalar,dt,vx,vy;
++	IssmDouble* xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementMatrix* Ke     = element->NewElementMatrix();
++	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
++	IssmDouble*    B      = xNew<IssmDouble>(2*numnodes);
++	IssmDouble*    Bprime = xNew<IssmDouble>(2*numnodes);
++	IssmDouble     D[2][2];
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	element->FindParam(&dt,TimesteppingTimeStepEnum);
++	element->FindParam(&meshtype,MeshTypeEnum);
++	Input* vxaverage_input=NULL;
++	Input* vyaverage_input=NULL;
++	if(meshtype==Mesh2DhorizontalEnum){
++		vxaverage_input=element->GetInput(VxEnum); _assert_(vxaverage_input);
++		vyaverage_input=element->GetInput(VyEnum); _assert_(vyaverage_input);
++	}
++	else{
++		vxaverage_input=element->GetInput(VxAverageEnum); _assert_(vxaverage_input);
++		vyaverage_input=element->GetInput(VyAverageEnum); _assert_(vyaverage_input);
++	}
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctions(basis,gauss);
++
++		vxaverage_input->GetInputValue(&vx,gauss);
++		vyaverage_input->GetInputValue(&vy,gauss);
++
++		D_scalar=gauss->weight*Jdet;
++		TripleMultiply(basis,1,numnodes,1,
++					&D_scalar,1,1,0,
++					basis,1,numnodes,0,
++					&Ke->values[0],1);
++
++		/*WARNING: B and Bprime are inverted compared to CG*/
++		GetB(Bprime,element,xyz_list,gauss);
++		GetBprime(B,element,xyz_list,gauss);
++
++		D_scalar = - dt*gauss->weight*Jdet;
++		D[0][0]  = D_scalar*vx;
++		D[0][1]  = 0.;
++		D[1][0]  = 0.;
++		D[1][1]  = D_scalar*vy;
++		TripleMultiply(B,2,numnodes,1,
++					&D[0][0],2,2,0,
++					Bprime,2,numnodes,0,
++					&Ke->values[0],1);
++
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(B);
++	xDelete<IssmDouble>(Bprime);
++	delete gauss;
++	return Ke;
++}/*}}}*/
+ ElementVector* MasstransportAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+ 	if(!element->IsOnBed()) return NULL;
+@@ -234,7 +437,7 @@
+ 	/*Intermediaries */
+ 	IssmDouble  Jdet,dt;
+ 	IssmDouble  ms,mb,mb_correction=0.,thickness;
+-	IssmDouble* xyz_list;
++	IssmDouble* xyz_list = NULL;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+@@ -280,7 +483,7 @@
+ 	/*Intermediaries */
+ 	IssmDouble  Jdet,dt;
+ 	IssmDouble  ms,mb,mb_correction=0.,thickness;
+-	IssmDouble* xyz_list;
++	IssmDouble* xyz_list = NULL;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+@@ -321,6 +524,61 @@
+ 	delete gauss;
+ 	return pe;
+ }/*}}}*/
++void MasstransportAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
++	 * For node i, Bi can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi=[ N ]
++	 *          [ N ]
++	 * where N is the finiteelement function for node i.
++	 *
++	 * We assume B_prog has been allocated already, of size: 2x(NDOF1*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions*/
++	IssmDouble* basis=xNew<IssmDouble>(numnodes);
++	element->NodalFunctions(basis,gauss);
++
++	/*Build B: */
++	for(int i=0;i<numnodes;i++){
++		B[numnodes*0+i] = basis[i];
++		B[numnodes*1+i] = basis[i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(basis);
++}/*}}}*/
++void MasstransportAnalysis::GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 
++	 * For node i, Bi' can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi_prime=[ dN/dx ]
++	 *                [ dN/dy ]
++	 * where N is the finiteelement function for node i.
++	 *
++	 * We assume B' has been allocated already, of size: 3x(NDOF2*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Build B': */
++	for(int i=0;i<numnodes;i++){
++		Bprime[numnodes*0+i] = dbasis[0*numnodes+i];
++		Bprime[numnodes*1+i] = dbasis[1*numnodes+i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(dbasis);
++
++}/*}}}*/
+ void MasstransportAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16831)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16832)
+@@ -36,6 +36,7 @@
+ 
+ 		virtual        ~Element(){};
+ 
++		virtual IssmDouble CharacteristicLength(void)=0;
+ 		virtual void   Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters)=0;
+ 		virtual void   SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters)=0;
+ 		virtual void   SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16831)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16832)
+@@ -197,6 +197,12 @@
+ 	this->material->inputs->AddInput(new TriaInput(input_enum,values,interpolation_enum));
+ }
+ /*}}}*/
++/*FUNCTION Tria::AddInput{{{*/
++IssmDouble Tria::CharacteristicLength(void){
++
++	return sqrt(2*this->GetArea());
++}
++/*}}}*/
+ /*FUNCTION Tria::CreateKMatrix(void) {{{*/
+ ElementMatrix* Tria::CreateKMatrix(void){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16831)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16832)
+@@ -66,6 +66,7 @@
+ 		void  InputUpdateFromIoModel(int index, IoModel* iomodel);
+ 		/*}}}*/
+ 		/*Element virtual functions definitions: {{{*/
++		IssmDouble  CharacteristicLength(void);
+ 		void        ComputeBasalStress(Vector<IssmDouble>* sigma_b);
+ 		void        ComputeStrainRate(Vector<IssmDouble>* eps);
+ 		void        ComputeStressTensor();
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16831)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16832)
+@@ -3010,9 +3010,13 @@
+ 
+ 	this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum,MaterialsEnum);
+ 	this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum,MaterialsEnum);
++	if(this->inputs->GetInput(VxEnum)) this->InputDepthAverageAtBase(VxEnum,VxAverageEnum);
++	if(this->inputs->GetInput(VyEnum)) this->InputDepthAverageAtBase(VyEnum,VyAverageEnum);
+ 	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+ 	this->material->inputs->DeleteInput(MaterialsRheologyBbarEnum);
+ 	this->material->inputs->DeleteInput(DamageDbarEnum);
++	this->inputs->DeleteInput(VxAverageEnum);
++	this->inputs->DeleteInput(VyAverageEnum);
+ 
+ 	return tria;
+ }
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16831)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16832)
+@@ -68,6 +68,7 @@
+ 		/*}}}*/
+ 		/*Element virtual functions definitions: {{{*/
+ 		void   BasalFrictionCreateInput(void);
++		IssmDouble CharacteristicLength(void){_error_("not implemented yet");};
+ 		void   ComputeBasalStress(Vector<IssmDouble>* sigma_b);
+ 		void   ComputeStrainRate(Vector<IssmDouble>* eps);
+ 		void   ComputeStressTensor();
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16831)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16832)
+@@ -69,6 +69,7 @@
+ 		void        AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
+ 		void        AddInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
+ 		void        AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
++		IssmDouble  CharacteristicLength(void){_error_("not implemented yet");};
+ 		void        ComputeBasalStress(Vector<IssmDouble>* sigma_b){_error_("not implemented yet");};
+ 		void        ComputeStrainRate(Vector<IssmDouble>* eps){_error_("not implemented yet");};
+ 		void        ComputeStressTensor(){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16832-16833.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16832-16833.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16832-16833.diff	(revision 17802)
@@ -0,0 +1,212 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16832)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16833)
+@@ -150,6 +150,7 @@
+ 		virtual void   ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input)=0;
+ 		virtual int    VelocityInterpolation()=0;
+ 		virtual int    PressureInterpolation()=0;
++		virtual bool   IsZeroLevelset(int levelset_enum)=0;
+ 
+ 		#ifdef _HAVE_RESPONSES_
+ 		virtual void   AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16832)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16833)
+@@ -2958,7 +2958,27 @@
+ 	*pviscosity=viscosity;
+ }
+ /*}}}*/
++/*FUNCTION Tria::IsZeroLevelset{{{*/
++bool Tria::IsZeroLevelset(int levelset_enum){
+ 
++	bool iszerols;
++	IssmDouble ls[NUMVERTICES];
++
++	/*Retrieve all inputs and parameters*/
++	GetInputListOnVertices(&ls[0],levelset_enum);
++
++	/*If the level set is awlays <0, there is no ice front here*/
++	iszerols= false;
++	if(ls[0]>0. || ls[1]>0. || ls[2]>0.){
++		if(ls[0]*ls[1]<0. || ls[0]*ls[2]<0. || (ls[0]*ls[1]+ls[0]*ls[2]+ls[1]*ls[2]==0.)){
++			iszerols= true;
++		}
++	}
++
++	return iszerols;
++}
++/*}}}*/
++
+ #ifdef _HAVE_RESPONSES_
+ /*FUNCTION Tria::AverageOntoPartition {{{*/
+ void  Tria::AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part){
+@@ -3903,20 +3923,11 @@
+ 
+ 	/*Intermediaries */
+ 	int         i;
+-	IssmDouble  ls[NUMVERTICES];
+ 	IssmDouble  xyz_list[NUMVERTICES][3];
+ 	bool        isfront;
+ 
+-	/*Retrieve all inputs and parameters*/
+-	GetInputListOnVertices(&ls[0],MaskIceLevelsetEnum);
+-
+ 	/*If the level set is awlays <=0, there is no ice front here*/
+-	isfront = false;
+-	if(ls[0]>0. || ls[1]>0. || ls[2]>0.){
+-		if(ls[0]*ls[1]<0. || ls[0]*ls[2]<0. || (ls[0]*ls[1]+ls[0]*ls[2]+ls[1]*ls[2]==0.)){
+-			isfront = true;
+-		}
+-	}
++	isfront=IsZeroLevelset(MaskIceLevelsetEnum);
+ 
+ 	/*If no front, return NULL*/
+ 	if(!isfront) return NULL;
+@@ -4188,21 +4199,12 @@
+ ElementVector* Tria::CreatePVectorStressbalanceSSAFront(){
+ 
+ 	/*Intermediaries */
+-	IssmDouble  ls[NUMVERTICES];
+ 	IssmDouble  xyz_list[NUMVERTICES][3];
+ 	bool        isfront;
+ 
+-	/*Retrieve all inputs and parameters*/
+-	GetInputListOnVertices(&ls[0],MaskIceLevelsetEnum);
++	/*Determine if there is an icefront in this element*/
++	isfront=IsZeroLevelset(MaskIceLevelsetEnum);
+ 
+-	/*If the level set is awlays <0, there is no ice front here*/
+-	isfront = false;
+-	if(ls[0]>0. || ls[1]>0. || ls[2]>0.){
+-		if(ls[0]*ls[1]<0. || ls[0]*ls[2]<0. || (ls[0]*ls[1]+ls[0]*ls[2]+ls[1]*ls[2]==0.)){
+-			isfront = true;
+-		}
+-	}
+-
+ 	/*If no front, return NULL*/
+ 	if(!isfront) return NULL;
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16832)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16833)
+@@ -134,6 +134,7 @@
+ 		IssmDouble  SurfaceArea(void);
+ 		void        Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement);
+ 		IssmDouble  TimeAdapt();
++		bool        IsZeroLevelset(int levelset_enum);
+ 
+ 		#ifdef _HAVE_RESPONSES_
+ 		void       AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16832)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16833)
+@@ -3540,7 +3540,26 @@
+ 	return PentaRef::PressureInterpolation();
+ }
+ /*}}}*/
++/*FUNCTION Penta::IsZeroLevelset{{{*/
++bool Penta::IsZeroLevelset(int levelset_enum){
+ 
++	bool        iszerols;
++	IssmDouble  ls[NUMVERTICES];
++
++	/*Retrieve all inputs and parameters*/
++	GetInputListOnVertices(&ls[0],levelset_enum);
++
++	/*If the level set is awlays <=0, there is no ice front here*/
++	iszerols = false;
++	if(ls[0]>0. || ls[1]>0. || ls[2]>0.){
++		if(ls[0]*ls[1]<0. || ls[0]*ls[2]<0. || (ls[0]*ls[1]+ls[0]*ls[2]+ls[1]*ls[2]==0.)){
++			iszerols = true;
++		}
++	}
++	return iszerols;
++}
++/*}}}*/
++
+ #ifdef _HAVE_RESPONSES_
+ /*FUNCTION Penta::AverageOntoPartition {{{*/
+ void  Penta::AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part){
+@@ -8729,21 +8748,11 @@
+ ElementVector* Penta::CreatePVectorStressbalanceHOFront(void){
+ 
+ 	/*Intermediaries */
+-	IssmDouble  ls[NUMVERTICES];
+ 	IssmDouble  xyz_list[NUMVERTICES][3];
+ 	bool        isfront;
+ 
+-	/*Retrieve all inputs and parameters*/
+-	GetInputListOnVertices(&ls[0],MaskIceLevelsetEnum);
++	isfront=IsZeroLevelset(MaskIceLevelsetEnum);
+ 
+-	/*If the level set is awlays <=0, there is no ice front here*/
+-	isfront = false;
+-	if(ls[0]>0. || ls[1]>0. || ls[2]>0.){
+-		if(ls[0]*ls[1]<0. || ls[0]*ls[2]<0. || (ls[0]*ls[1]+ls[0]*ls[2]+ls[1]*ls[2]==0.)){
+-			isfront = true;
+-		}
+-	}
+-
+ 	/*If no front, return NULL*/
+ 	if(!isfront) return NULL;
+ 
+@@ -8834,21 +8843,12 @@
+ 
+ 	/*Intermediaries */
+ 	int         i;
+-	IssmDouble  ls[NUMVERTICES];
+ 	IssmDouble  xyz_list[NUMVERTICES][3];
+ 	bool        isfront;
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetInputListOnVertices(&ls[0],MaskIceLevelsetEnum);
++	isfront=IsZeroLevelset(MaskIceLevelsetEnum);
+ 
+-	/*If the level set is awlays <=0, there is no ice front here*/
+-	isfront = false;
+-	if(ls[0]>0. || ls[1]>0. || ls[2]>0.){
+-		if(ls[0]*ls[1]<0. || ls[0]*ls[2]<0. || (ls[0]*ls[1]+ls[0]*ls[2]+ls[1]*ls[2]==0.)){
+-			isfront = true;
+-		}
+-	}
+-
+ 	/*If no front, return NULL*/
+ 	if(!isfront) return NULL;
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16832)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16833)
+@@ -112,6 +112,7 @@
+ 		int    VelocityInterpolation();
+ 		IssmDouble PureIceEnthalpy(IssmDouble pressure);
+ 		int    PressureInterpolation();
++		bool   IsZeroLevelset(int levelset_enum);
+ 
+ 		void   ResultInterpolation(int* pinterpolation,int output_enum);
+ 		void   ResultToVector(Vector<IssmDouble>* vector,int output_enum);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16832)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16833)
+@@ -145,10 +145,12 @@
+ 		Gauss*      NewGaussTop(int order){_error_("not implemented yet");};
+ 		ElementVector* NewElementVector(int approximation_enum){_error_("not implemented yet");};
+ 		ElementMatrix* NewElementMatrix(int approximation_enum){_error_("not implemented yet");};
+-		void           ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
+-		void           ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented");};
+-		void           ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
+-		void           ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
++		void        ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
++		void        ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented");};
++		void        ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
++		void        ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
++		bool        IsZeroLevelset(int levelset_enum){_error_("not implemented");};
++
+ 		#ifdef _HAVE_THERMAL_
+ 		void UpdateBasalConstraintsEnthalpy(void){_error_("not implemented yet");};
+ 		void ComputeBasalMeltingrate(void){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16833-16834.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16833-16834.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16833-16834.diff	(revision 17802)
@@ -0,0 +1,102 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16833)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16834)
+@@ -3921,20 +3921,14 @@
+ /*FUNCTION Tria::CreatePVectorStressbalanceFSFront{{{*/
+ ElementVector* Tria::CreatePVectorStressbalanceFSFront(void){
+ 
+-	/*Intermediaries */
+-	int         i;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	bool        isfront;
+-
+-	/*If the level set is awlays <=0, there is no ice front here*/
+-	isfront=IsZeroLevelset(MaskIceLevelsetEnum);
+-
+ 	/*If no front, return NULL*/
+-	if(!isfront) return NULL;
++	if(!IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
+ 
+ 	/*Intermediaries*/
++	int         i;
+ 	IssmDouble  rho_ice,rho_water,gravity,y_g;
+ 	IssmDouble  Jdet,water_pressure,air_pressure,pressure;
++	IssmDouble  xyz_list[NUMVERTICES][3];
+ 	IssmDouble  xyz_list_front[2][3];
+ 	IssmDouble  area_coordinates[2][3];
+ 	IssmDouble  normal[2];
+@@ -4198,20 +4192,14 @@
+ /*FUNCTION Tria::CreatePVectorStressbalanceSSAFront {{{*/
+ ElementVector* Tria::CreatePVectorStressbalanceSSAFront(){
+ 
+-	/*Intermediaries */
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	bool        isfront;
+-
+-	/*Determine if there is an icefront in this element*/
+-	isfront=IsZeroLevelset(MaskIceLevelsetEnum);
+-
+ 	/*If no front, return NULL*/
+-	if(!isfront) return NULL;
++	if(!IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble  rho_ice,rho_water,gravity;
+ 	IssmDouble  Jdet,thickness,bed,water_pressure,ice_pressure,air_pressure;
+ 	IssmDouble  surface_under_water,base_under_water,pressure;
++	IssmDouble  xyz_list[NUMVERTICES][3];
+ 	IssmDouble  xyz_list_front[2][3];
+ 	IssmDouble  area_coordinates[2][3];
+ 	IssmDouble  normal[2];
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16833)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16834)
+@@ -8747,19 +8747,14 @@
+ /*FUNCTION Penta::CreatePVectorStressbalanceHOFront{{{*/
+ ElementVector* Penta::CreatePVectorStressbalanceHOFront(void){
+ 
+-	/*Intermediaries */
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	bool        isfront;
+-
+-	isfront=IsZeroLevelset(MaskIceLevelsetEnum);
+-
+ 	/*If no front, return NULL*/
+-	if(!isfront) return NULL;
++	if(!IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble  rho_ice,rho_water,gravity;
+ 	IssmDouble  Jdet,surface,z_g,water_pressure,ice_pressure,air_pressure;
+ 	IssmDouble  surface_under_water,base_under_water,pressure;
++	IssmDouble  xyz_list[NUMVERTICES][3];
+ 	IssmDouble  xyz_list_front[4][3];
+ 	IssmDouble  area_coordinates[4][3];
+ 	IssmDouble  normal[3];
+@@ -8841,21 +8836,15 @@
+ /*FUNCTION Penta::CreatePVectorStressbalanceFSFront{{{*/
+ ElementVector* Penta::CreatePVectorStressbalanceFSFront(void){
+ 
+-	/*Intermediaries */
+-	int         i;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	bool        isfront;
+-
+-	/*Retrieve all inputs and parameters*/
+-	isfront=IsZeroLevelset(MaskIceLevelsetEnum);
+-
+ 	/*If no front, return NULL*/
+-	if(!isfront) return NULL;
++	if(!IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
++	int         i;
+ 	IssmDouble  rho_ice,rho_water,gravity;
+ 	IssmDouble  Jdet,z_g,water_pressure,air_pressure;
+ 	IssmDouble  surface_under_water,base_under_water,pressure;
++	IssmDouble  xyz_list[NUMVERTICES][3];
+ 	IssmDouble  xyz_list_front[4][3];
+ 	IssmDouble  area_coordinates[4][3];
+ 	IssmDouble  normal[3];
Index: issm/oecreview/Archive/16554-17801/ISSM-16834-16835.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16834-16835.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16834-16835.diff	(revision 17802)
@@ -0,0 +1,19 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16834)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16835)
+@@ -1016,7 +1016,13 @@
+ IssmDouble Penta::GetMaterialParameter(int enum_in){
+ 
+ 	_assert_(this->matpar);
+-	return this->matpar->GetMaterialParameter(enum_in);
++
++	switch(enum_in){
++		case MaterialsRheologyNEnum:
++			return this->material->GetN();
++		default:
++			return this->matpar->GetMaterialParameter(enum_in);
++	}
+ }
+ /*}}}*/
+ /*FUNCTION Penta::GetGroundedPart{{{*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16835-16836.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16835-16836.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16835-16836.diff	(revision 17802)
@@ -0,0 +1,25 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16835)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16836)
+@@ -1016,12 +1016,14 @@
+ IssmDouble Penta::GetMaterialParameter(int enum_in){
+ 
+ 	_assert_(this->matpar);
+-
+-	switch(enum_in){
+-		case MaterialsRheologyNEnum:
+-			return this->material->GetN();
+-		default:
+-			return this->matpar->GetMaterialParameter(enum_in);
++	
++	switch(enum_in){ // FIXME: change this to material
++	case MaterialsRheologyNEnum:
++		return this->material->GetN();
++	case MaterialsRheologyBEnum:
++		return this->material->GetB();
++	default:
++		return this->matpar->GetMaterialParameter(enum_in);
+ 	}
+ }
+ /*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16836-16837.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16836-16837.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16836-16837.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16836)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16837)
+@@ -377,7 +377,7 @@
+ 		for(i=0;i<numnodes;i++){
+ 			element->EnthalpyToThermal(&temperature[i],&waterfraction[i],values[i],pressure[i]);
+ 			if(waterfraction[i]<0.) _error_("Negative water fraction found in solution vector");
+-			//if(waterfraction[i]>1.) _error_("Water fraction >1 found in solution vector");
++			if(waterfraction[i]>1.) _error_("Water fraction >1 found in solution vector");
+ 		}
+ 		element->AddInput(EnthalpyEnum,values,P1Enum);
+ 		element->AddInput(WaterfractionEnum,waterfraction,P1Enum);
Index: issm/oecreview/Archive/16554-17801/ISSM-16837-16838.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16837-16838.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16837-16838.diff	(revision 17802)
@@ -0,0 +1,924 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16837)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16838)
+@@ -1109,6 +1109,65 @@
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorSSAFront(Element* element){/*{{{*/
+ 
++	/*If no front, return NULL*/
++	if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
++
++	/*Intermediaries*/
++	IssmDouble  rho_ice,rho_water,gravity;
++	IssmDouble  Jdet,thickness,bed,water_pressure,ice_pressure;
++	IssmDouble  surface_under_water,base_under_water,pressure;
++	IssmDouble *xyz_list = NULL;
++	IssmDouble *xyz_list_front = NULL;
++	IssmDouble  normal[2];
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementVector* pe    = element->NewElementVector(SSAApproximationEnum);
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	Input* thickness_input=element->GetInput(ThicknessEnum); _assert_(thickness_input);
++	Input* bed_input      =element->GetInput(BedEnum);       _assert_(bed_input);
++	rho_water = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	rho_ice   = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	gravity   = element->GetMaterialParameter(ConstantsGEnum);
++	element->GetVerticesCoordinates(&xyz_list);
++	element->ZeroLevelsetCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
++	element->NormalBase(&normal[0],xyz_list_front);
++
++	/*Start looping on Gaussian points*/
++	Gauss* gauss=element->NewGauss(xyz_list,xyz_list_front,3);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++		thickness_input->GetInputValue(&thickness,gauss);
++		bed_input->GetInputValue(&bed,gauss);
++		element->JacobianDeterminantSurface(&Jdet,xyz_list_front,gauss);
++		element->NodalFunctions(basis,gauss);
++
++		surface_under_water = min(0.,thickness+bed); // 0 if the top of the glacier is above water level
++		base_under_water    = min(0.,bed);           // 0 if the bottom of the glacier is above water level
++		water_pressure = 1.0/2.0*gravity*rho_water*(surface_under_water*surface_under_water - base_under_water*base_under_water);
++		ice_pressure   = 1.0/2.0*gravity*rho_ice*thickness*thickness;
++		pressure = ice_pressure + water_pressure;
++
++		for (int i=0;i<numnodes;i++){
++			pe->values[2*i+0]+= pressure*Jdet*gauss->weight*normal[0]*basis[i];
++			pe->values[2*i+1]+= pressure*Jdet*gauss->weight*normal[1]*basis[i];
++		}
++	}
++
++	/*Transform coordinate system*/
++	element->TransformLoadVectorCoord(pe,XYEnum);
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(xyz_list_front);
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	return pe;
+ 	return NULL;
+ }/*}}}*/
+ void StressbalanceAnalysis::GetBSSA(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16837)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16838)
+@@ -81,6 +81,7 @@
+ 		virtual void	GetDofListVelocity(int** pdoflist,int setenum)=0;
+ 		virtual void	GetDofListPressure(int** pdoflist,int setenum)=0;
+ 		virtual void   JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss)=0;
++		virtual void   JacobianDeterminantSurface(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss)=0;
+ 		virtual void   JacobianDeterminantBase(IssmDouble* Jdet,IssmDouble* xyz_list_base,Gauss* gauss)=0;
+ 		virtual void   JacobianDeterminantTop(IssmDouble* Jdet,IssmDouble* xyz_list_base,Gauss* gauss)=0;
+ 		virtual void   GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int solutionenum)=0;
+@@ -129,6 +130,7 @@
+ 		virtual int    NumberofNodesPressure(void)=0;
+ 		virtual Gauss* NewGauss(void)=0;
+ 		virtual Gauss* NewGauss(int order)=0;
++      virtual Gauss* NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order)=0;
+ 		virtual Gauss* NewGaussBase(int order)=0;
+ 		virtual Gauss* NewGaussTop(int order)=0;
+ 		virtual ElementVector*  NewElementVector(int approximation_enum=NoneApproximationEnum)=0;
+@@ -151,6 +153,7 @@
+ 		virtual int    VelocityInterpolation()=0;
+ 		virtual int    PressureInterpolation()=0;
+ 		virtual bool   IsZeroLevelset(int levelset_enum)=0;
++		virtual void   ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum)=0;
+ 
+ 		#ifdef _HAVE_RESPONSES_
+ 		virtual void   AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16837)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16838)
+@@ -878,7 +878,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION Tria::GetAreaCoordinates{{{*/
+-void Tria::GetAreaCoordinates(IssmDouble* area_coordinates,IssmDouble xyz_zero[3][3],IssmDouble xyz_list[3][3],int numpoints){
++void Tria::GetAreaCoordinates(IssmDouble* area_coordinates,IssmDouble* xyz_zero,IssmDouble* xyz_list,int numpoints){
+ 	/*Computeportion of the element that is grounded*/ 
+ 
+ 	int         i,j,k;
+@@ -890,14 +890,14 @@
+ 	/*Initialize xyz_list with original xyz_list of triangle coordinates*/
+ 	for(j=0;j<3;j++){ 
+ 		for(k=0;k<3;k++){
+-			xyz_bis[j][k]=xyz_list[j][k];
++			xyz_bis[j][k]=xyz_list[j*3+k];
+ 		}
+ 	}
+ 	for(i=0;i<numpoints;i++){
+ 		for(j=0;j<3;j++){ 
+ 			for(k=0;k<3;k++){
+ 				/*Change appropriate line*/
+-				xyz_bis[j][k]=xyz_zero[i][k];
++				xyz_bis[j][k]=xyz_zero[i*3+k];
+ 			}
+ 
+ 			/*Compute area fraction*/
+@@ -907,7 +907,7 @@
+ 			/*Reinitialize xyz_list*/
+ 			for(k=0;k<3;k++){
+ 				/*Reinitialize xyz_list with original coordinates*/
+-				xyz_bis[j][k]=xyz_list[j][k];
++				xyz_bis[j][k]=xyz_list[j*3+k];
+ 			}
+ 		}
+ 	}
+@@ -1183,15 +1183,15 @@
+ 	normal[1]= - vector[0]/norm;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetZeroLevelsetCoordinates{{{*/
+-void Tria::GetZeroLevelsetCoordinates(IssmDouble* xyz_zero,IssmDouble xyz_list[3][3],int levelsetenum){
+-	/*Computeportion of the element that is grounded*/ 
++/*FUNCTION Tria::ZeroLevelsetCoordinates{{{*/
++void Tria::ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){
+ 
+ 	int         normal_orientation=0;
+ 	IssmDouble  s1,s2;
+ 	IssmDouble  levelset[NUMVERTICES];
+ 
+ 	/*Recover parameters and values*/
++	IssmDouble* xyz_zero = xNew<IssmDouble>(2*3);
+ 	GetInputListOnVertices(&levelset[0],levelsetenum);
+ 
+ 	if(levelset[0]*levelset[1]>0.){ //Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2
+@@ -1201,14 +1201,14 @@
+ 
+ 		if(levelset[2]>0.) normal_orientation=1;
+ 		/*New point 1*/
+-		xyz_zero[3*normal_orientation+0]=xyz_list[2][0]+s1*(xyz_list[1][0]-xyz_list[2][0]);
+-		xyz_zero[3*normal_orientation+1]=xyz_list[2][1]+s1*(xyz_list[1][1]-xyz_list[2][1]);
+-		xyz_zero[3*normal_orientation+2]=xyz_list[2][2]+s1*(xyz_list[1][2]-xyz_list[2][2]);
++		xyz_zero[3*normal_orientation+0]=xyz_list[2*3+0]+s1*(xyz_list[1*3+0]-xyz_list[2*3+0]);
++		xyz_zero[3*normal_orientation+1]=xyz_list[2*3+1]+s1*(xyz_list[1*3+1]-xyz_list[2*3+1]);
++		xyz_zero[3*normal_orientation+2]=xyz_list[2*3+2]+s1*(xyz_list[1*3+2]-xyz_list[2*3+2]);
+ 
+ 		/*New point 0*/
+-		xyz_zero[3*(1-normal_orientation)+0]=xyz_list[2][0]+s2*(xyz_list[0][0]-xyz_list[2][0]);
+-		xyz_zero[3*(1-normal_orientation)+1]=xyz_list[2][1]+s2*(xyz_list[0][1]-xyz_list[2][1]);
+-		xyz_zero[3*(1-normal_orientation)+2]=xyz_list[2][2]+s2*(xyz_list[0][2]-xyz_list[2][2]);
++		xyz_zero[3*(1-normal_orientation)+0]=xyz_list[2*3+0]+s2*(xyz_list[0*3+0]-xyz_list[2*3+0]);
++		xyz_zero[3*(1-normal_orientation)+1]=xyz_list[2*3+1]+s2*(xyz_list[0*3+1]-xyz_list[2*3+1]);
++		xyz_zero[3*(1-normal_orientation)+2]=xyz_list[2*3+2]+s2*(xyz_list[0*3+2]-xyz_list[2*3+2]);
+ 	}
+ 	else if(levelset[1]*levelset[2]>0.){ //Nodes 1 and 2 are similar, so points must be found on segment 0-1 and 0-2
+ 		/*Portion of the segments*/
+@@ -1217,14 +1217,14 @@
+ 
+ 		if(levelset[0]>0.) normal_orientation=1;
+ 		/*New point 1*/
+-		xyz_zero[3*normal_orientation+0]=xyz_list[0][0]+s1*(xyz_list[2][0]-xyz_list[0][0]);
+-		xyz_zero[3*normal_orientation+1]=xyz_list[0][1]+s1*(xyz_list[2][1]-xyz_list[0][1]);
+-		xyz_zero[3*normal_orientation+2]=xyz_list[0][2]+s1*(xyz_list[2][2]-xyz_list[0][2]);
++		xyz_zero[3*normal_orientation+0]=xyz_list[0*3+0]+s1*(xyz_list[2*3+0]-xyz_list[0*3+0]);
++		xyz_zero[3*normal_orientation+1]=xyz_list[0*3+1]+s1*(xyz_list[2*3+1]-xyz_list[0*3+1]);
++		xyz_zero[3*normal_orientation+2]=xyz_list[0*3+2]+s1*(xyz_list[2*3+2]-xyz_list[0*3+2]);
+ 
+ 		/*New point 2*/
+-		xyz_zero[3*(1-normal_orientation)+0]=xyz_list[0][0]+s2*(xyz_list[1][0]-xyz_list[0][0]);
+-		xyz_zero[3*(1-normal_orientation)+1]=xyz_list[0][1]+s2*(xyz_list[1][1]-xyz_list[0][1]);
+-		xyz_zero[3*(1-normal_orientation)+2]=xyz_list[0][2]+s2*(xyz_list[1][2]-xyz_list[0][2]);
++		xyz_zero[3*(1-normal_orientation)+0]=xyz_list[0*3+0]+s2*(xyz_list[1*3+0]-xyz_list[0*3+0]);
++		xyz_zero[3*(1-normal_orientation)+1]=xyz_list[0*3+1]+s2*(xyz_list[1*3+1]-xyz_list[0*3+1]);
++		xyz_zero[3*(1-normal_orientation)+2]=xyz_list[0*3+2]+s2*(xyz_list[1*3+2]-xyz_list[0*3+2]);
+ 	}
+ 	else if(levelset[0]*levelset[2]>0.){ //Nodes 0 and 2 are similar, so points must be found on segment 1-0 and 1-2
+ 		/*Portion of the segments*/
+@@ -1233,46 +1233,49 @@
+ 
+ 		if(levelset[1]>0.) normal_orientation=1;
+ 		/*New point 0*/
+-		xyz_zero[3*normal_orientation+0]=xyz_list[1][0]+s1*(xyz_list[0][0]-xyz_list[1][0]);
+-		xyz_zero[3*normal_orientation+1]=xyz_list[1][1]+s1*(xyz_list[0][1]-xyz_list[1][1]);
+-		xyz_zero[3*normal_orientation+2]=xyz_list[1][2]+s1*(xyz_list[0][2]-xyz_list[1][2]);
++		xyz_zero[3*normal_orientation+0]=xyz_list[1*3+0]+s1*(xyz_list[0*3+0]-xyz_list[1*3+0]);
++		xyz_zero[3*normal_orientation+1]=xyz_list[1*3+1]+s1*(xyz_list[0*3+1]-xyz_list[1*3+1]);
++		xyz_zero[3*normal_orientation+2]=xyz_list[1*3+2]+s1*(xyz_list[0*3+2]-xyz_list[1*3+2]);
+ 
+ 		/*New point 2*/
+-		xyz_zero[3*(1-normal_orientation)+0]=xyz_list[1][0]+s2*(xyz_list[2][0]-xyz_list[1][0]);
+-		xyz_zero[3*(1-normal_orientation)+1]=xyz_list[1][1]+s2*(xyz_list[2][1]-xyz_list[1][1]);
+-		xyz_zero[3*(1-normal_orientation)+2]=xyz_list[1][2]+s2*(xyz_list[2][2]-xyz_list[1][2]);
++		xyz_zero[3*(1-normal_orientation)+0]=xyz_list[1*3+0]+s2*(xyz_list[2*3+0]-xyz_list[1*3+0]);
++		xyz_zero[3*(1-normal_orientation)+1]=xyz_list[1*3+1]+s2*(xyz_list[2*3+1]-xyz_list[1*3+1]);
++		xyz_zero[3*(1-normal_orientation)+2]=xyz_list[1*3+2]+s2*(xyz_list[2*3+2]-xyz_list[1*3+2]);
+ 	}
+ 	else if(levelset[0]==0. && levelset[1]==0.){ //front is on point 0 and 1
+-		xyz_zero[3*0+0]=xyz_list[0][0];
+-		xyz_zero[3*0+1]=xyz_list[0][1];
+-		xyz_zero[3*0+2]=xyz_list[0][2];
++		xyz_zero[3*0+0]=xyz_list[0*3+0];
++		xyz_zero[3*0+1]=xyz_list[0*3+1];
++		xyz_zero[3*0+2]=xyz_list[0*3+2];
+ 
+ 		/*New point 2*/
+-		xyz_zero[3*1+0]=xyz_list[1][0];
+-		xyz_zero[3*1+1]=xyz_list[1][1];
+-		xyz_zero[3*1+2]=xyz_list[1][2];
++		xyz_zero[3*1+0]=xyz_list[1*3+0];
++		xyz_zero[3*1+1]=xyz_list[1*3+1];
++		xyz_zero[3*1+2]=xyz_list[1*3+2];
+ 	}
+ 	else if(levelset[0]==0. && levelset[2]==0.){ //front is on point 0 and 1
+-		xyz_zero[3*0+0]=xyz_list[2][0];
+-		xyz_zero[3*0+1]=xyz_list[2][1];
+-		xyz_zero[3*0+2]=xyz_list[2][2];
++		xyz_zero[3*0+0]=xyz_list[2*3+0];
++		xyz_zero[3*0+1]=xyz_list[2*3+1];
++		xyz_zero[3*0+2]=xyz_list[2*3+2];
+ 
+ 		/*New point 2*/
+-		xyz_zero[3*1+0]=xyz_list[0][0];
+-		xyz_zero[3*1+1]=xyz_list[0][1];
+-		xyz_zero[3*1+2]=xyz_list[0][2];
++		xyz_zero[3*1+0]=xyz_list[0*3+0];
++		xyz_zero[3*1+1]=xyz_list[0*3+1];
++		xyz_zero[3*1+2]=xyz_list[0*3+2];
+ 	}
+ 	else if(levelset[1]==0. && levelset[2]==0.){ //front is on point 0 and 1
+-		xyz_zero[3*0+0]=xyz_list[1][0];
+-		xyz_zero[3*0+1]=xyz_list[1][1];
+-		xyz_zero[3*0+2]=xyz_list[1][2];
++		xyz_zero[3*0+0]=xyz_list[1*3+0];
++		xyz_zero[3*0+1]=xyz_list[1*3+1];
++		xyz_zero[3*0+2]=xyz_list[1*3+2];
+ 
+ 		/*New point 2*/
+-		xyz_zero[3*1+0]=xyz_list[2][0];
+-		xyz_zero[3*1+1]=xyz_list[2][1];
+-		xyz_zero[3*1+2]=xyz_list[2][2];
++		xyz_zero[3*1+0]=xyz_list[2*3+0];
++		xyz_zero[3*1+1]=xyz_list[2*3+1];
++		xyz_zero[3*1+2]=xyz_list[2*3+2];
+ 	}
+ 	else _error_("Case not covered");
++
++	/*Assign output pointer*/
++	*pxyz_zero= xyz_zero;
+ }
+ /*}}}*/
+ /*FUNCTION Tria::GetNodeIndex {{{*/
+@@ -2013,6 +2016,14 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Tria::JacobianDeterminantSurface{{{*/
++void Tria::JacobianDeterminantSurface(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussTriaEnum);
++	this->GetSegmentJacobianDeterminant(pJdet,xyz_list,(GaussTria*)gauss);
++
++}
++/*}}}*/
+ /*FUNCTION Tria::HasEdgeOnBed {{{*/
+ bool Tria::HasEdgeOnBed(){
+ 
+@@ -2208,6 +2219,16 @@
+ 	return new GaussTria(order);
+ }
+ /*}}}*/
++/*FUNCTION Tria::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){{{*/
++Gauss* Tria::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){
++
++	IssmDouble  area_coordinates[2][3];
++
++	GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,xyz_list,2);
++
++	return new GaussTria(area_coordinates,order);
++}
++/*}}}*/
+ /*FUNCTION Tria::NewElementVector{{{*/
+ ElementVector* Tria::NewElementVector(int approximation_enum){
+ 	return new ElementVector(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
+@@ -3929,7 +3950,7 @@
+ 	IssmDouble  rho_ice,rho_water,gravity,y_g;
+ 	IssmDouble  Jdet,water_pressure,air_pressure,pressure;
+ 	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble  xyz_list_front[2][3];
++	IssmDouble* xyz_list_front = NULL;
+ 	IssmDouble  area_coordinates[2][3];
+ 	IssmDouble  normal[2];
+ 	GaussTria*  gauss = NULL;
+@@ -3952,13 +3973,13 @@
+ 	rho_water = matpar->GetRhoWater();
+ 	rho_ice = matpar->GetRhoIce();
+ 	gravity   = matpar->GetG();
+-	GetZeroLevelsetCoordinates(&xyz_list_front[0][0],xyz_list,MaskIceLevelsetEnum);
+-	GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,xyz_list,2);
+-	NormalBase(&normal[0],&xyz_list_front[0][0]);
++	ZeroLevelsetCoordinates(&xyz_list_front,&xyz_list[0][0],MaskIceLevelsetEnum);
++	GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,&xyz_list[0][0],2);
++	NormalBase(&normal[0],xyz_list_front);
+ 
+ 	/*Start looping on Gaussian points*/
+-	IssmDouble ymax=max(xyz_list_front[0][1],xyz_list_front[1][1]);
+-	IssmDouble ymin=min(xyz_list_front[0][1],xyz_list_front[1][1]);
++	IssmDouble ymax=max(xyz_list_front[0*3+1],xyz_list_front[1*3+1]);
++	IssmDouble ymin=min(xyz_list_front[0*3+1],xyz_list_front[1*3+1]);
+ 	if(ymax>0. && ymin<0.) gauss=new GaussTria(area_coordinates,30); //refined in vertical because of the sea level discontinuity
+ 	else                   gauss=new GaussTria(area_coordinates,3);
+ 
+@@ -3967,7 +3988,7 @@
+ 		gauss->GaussPoint(ig);
+ 		y_g=GetYcoord(gauss);
+ 		GetNodalFunctionsVelocity(vbasis,gauss);
+-		GetSegmentJacobianDeterminant(&Jdet,&xyz_list_front[0][0],gauss);
++		GetSegmentJacobianDeterminant(&Jdet,xyz_list_front,gauss);
+ 
+ 		water_pressure = rho_water*gravity*min(0.,y_g); //0 if the gaussian point is above water level
+ 		air_pressure   = 0.;
+@@ -3979,12 +4000,12 @@
+ 		}
+ 	}
+ 
+-
+ 	/*Transform coordinate system*/
+ 	::TransformLoadVectorCoord(pe,nodes,(vnumnodes+pnumnodes),cs_list);
+ 
+ 	/*Clean up and return*/
+ 	xDelete<int>(cs_list);
++	xDelete<IssmDouble>(xyz_list_front);
+ 	xDelete<IssmDouble>(vbasis);
+ 	delete gauss;
+ 	return pe;
+@@ -4200,7 +4221,7 @@
+ 	IssmDouble  Jdet,thickness,bed,water_pressure,ice_pressure,air_pressure;
+ 	IssmDouble  surface_under_water,base_under_water,pressure;
+ 	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble  xyz_list_front[2][3];
++	IssmDouble  *xyz_list_front = NULL;
+ 	IssmDouble  area_coordinates[2][3];
+ 	IssmDouble  normal[2];
+ 
+@@ -4218,9 +4239,9 @@
+ 	rho_water = matpar->GetRhoWater();
+ 	rho_ice   = matpar->GetRhoIce();
+ 	gravity   = matpar->GetG();
+-	GetZeroLevelsetCoordinates(&xyz_list_front[0][0],xyz_list,MaskIceLevelsetEnum);
+-	GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,xyz_list,2);
+-	NormalBase(&normal[0],&xyz_list_front[0][0]);
++	ZeroLevelsetCoordinates(&xyz_list_front,&xyz_list[0][0],MaskIceLevelsetEnum);
++	GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,&xyz_list[0][0],2);
++	NormalBase(&normal[0],xyz_list_front);
+ 
+ 	/*Start looping on Gaussian points*/
+ 	GaussTria* gauss=new GaussTria(area_coordinates,3);
+@@ -4229,7 +4250,7 @@
+ 		gauss->GaussPoint(ig);
+ 		thickness_input->GetInputValue(&thickness,gauss);
+ 		bed_input->GetInputValue(&bed,gauss);
+-		GetSegmentJacobianDeterminant(&Jdet,&xyz_list_front[0][0],gauss);
++		GetSegmentJacobianDeterminant(&Jdet,xyz_list_front,gauss);
+ 		GetNodalFunctions(basis,gauss);
+ 
+ 		surface_under_water = min(0.,thickness+bed); // 0 if the top of the glacier is above water level
+@@ -4250,6 +4271,7 @@
+ 
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(xyz_list_front);
+ 	delete gauss;
+ 	return pe;
+ }
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 16837)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 16838)
+@@ -1944,23 +1944,23 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetQuadJacobianDeterminant{{{*/
+-void PentaRef::GetQuadJacobianDeterminant(IssmDouble* Jdet,IssmDouble xyz_list[4][3],Gauss* gauss){
++void PentaRef::GetQuadJacobianDeterminant(IssmDouble* Jdet,IssmDouble* xyz_list,Gauss* gauss){
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+ 
+ 	IssmDouble x1,x2,x3,x4,y1,y2,y3,y4,z1,z2,z3,z4;
+ 
+-	x1=xyz_list[0][0];
+-	y1=xyz_list[0][1];
+-	z1=xyz_list[0][2];
+-	x2=xyz_list[1][0];
+-	y2=xyz_list[1][1];
+-	z2=xyz_list[1][2];
+-	x3=xyz_list[2][0];
+-	y3=xyz_list[2][1];
+-	z3=xyz_list[2][2];
+-	x4=xyz_list[3][0];
+-	y4=xyz_list[3][1];
+-	z4=xyz_list[3][2];
++	x1=xyz_list[0*3+0];
++	y1=xyz_list[0*3+1];
++	z1=xyz_list[0*3+2];
++	x2=xyz_list[1*3+0];
++	y2=xyz_list[1*3+1];
++	z2=xyz_list[1*3+2];
++	x3=xyz_list[2*3+0];
++	y3=xyz_list[2*3+1];
++	z3=xyz_list[2*3+2];
++	x4=xyz_list[3*3+0];
++	y4=xyz_list[3*3+1];
++	z4=xyz_list[3*3+2];
+ 
+ 	/*Jdet = (Area of the trapezoid)/(Area trapezoid ref) with AreaRef = 4*/
+ 	/*Area of a trabezoid = altitude * (base1 + base2)/2 */
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16837)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16838)
+@@ -134,6 +134,7 @@
+ 		IssmDouble  SurfaceArea(void);
+ 		void        Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement);
+ 		IssmDouble  TimeAdapt();
++		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum);
+ 		bool        IsZeroLevelset(int levelset_enum);
+ 
+ 		#ifdef _HAVE_RESPONSES_
+@@ -247,7 +248,7 @@
+ 		IssmDouble     EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented");};
+ 		IssmDouble     EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure){_error_("not implemented");};
+ 		IssmDouble     GetArea(void);
+-		void           GetAreaCoordinates(IssmDouble *area_coordinates,IssmDouble xyz_zero[3][3],IssmDouble xyz_list[3][3],int numpoints);
++		void           GetAreaCoordinates(IssmDouble *area_coordinates,IssmDouble* xyz_zero,IssmDouble* xyz_list,int numpoints);
+ 		int            GetElementType(void);
+ 
+ 		void	         GetVertexPidList(int* doflist);
+@@ -258,7 +259,6 @@
+ 		void           NormalBase(IssmDouble* normal,IssmDouble* xyz_list);
+ 		void           NormalTop(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		IssmDouble     GetMaterialParameter(int enum_in);
+-		void           GetZeroLevelsetCoordinates(IssmDouble* xyz_zero,IssmDouble xyz_list[3][3],int levelsetenum);
+ 		Input*         GetInput(int inputenum);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue);
+@@ -276,11 +276,13 @@
+ 		void	         InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solution,int enum_type){_error_("not implemented yet");};
+ 		bool	         IsInput(int name);
+ 		void           JacobianDeterminant(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss);
++		void           JacobianDeterminantSurface(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss);
+ 		void           JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
+ 		void           JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
+ 		IssmDouble     MinEdgeLength(IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		Gauss*         NewGauss(void);
+ 		Gauss*         NewGauss(int order);
++      Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order);
+ 		Gauss*         NewGaussBase(int order){_error_("not implemented yet");};
+ 		Gauss*         NewGaussTop(int order){_error_("not implemented yet");};
+ 		ElementVector* NewElementVector(int approximation_enum);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16837)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16838)
+@@ -883,26 +883,26 @@
+ }
+ /*}}}*/
+ /*FUNCTION Penta::GetAreaCoordinates{{{*/
+-void Penta::GetAreaCoordinates(IssmDouble* area_coordinates,IssmDouble xyz_zero[4][3],IssmDouble xyz_list[6][3],int numpoints){
++void Penta::GetAreaCoordinates(IssmDouble* area_coordinates,IssmDouble* xyz_zero,IssmDouble* xyz_list,int numpoints){
+ 	/*Computeportion of the element that is grounded*/ 
+ 
+ 	int         i,j,k;
+ 	IssmDouble  area_init,area_portion;
+ 	IssmDouble  xyz_bis[3][3];
+ 
+-	area_init=fabs(xyz_list[1][0]*xyz_list[2][1] - xyz_list[1][1]*xyz_list[2][0] + xyz_list[0][0]*xyz_list[1][1] - xyz_list[0][1]*xyz_list[1][0] + xyz_list[2][0]*xyz_list[0][1] - xyz_list[2][1]*xyz_list[0][0])/2.;
++	area_init=fabs(xyz_list[1*3+0]*xyz_list[2*3+1] - xyz_list[1*3+1]*xyz_list[2*3+0] + xyz_list[0*3+0]*xyz_list[1*3+1] - xyz_list[0*3+1]*xyz_list[1*3+0] + xyz_list[2*3+0]*xyz_list[0*3+1] - xyz_list[2*3+1]*xyz_list[0*3+0])/2.;
+ 
+ 	/*Initialize xyz_list with original xyz_list of triangle coordinates*/
+ 	for(j=0;j<3;j++){ 
+ 		for(k=0;k<3;k++){
+-			xyz_bis[j][k]=xyz_list[j][k];
++			xyz_bis[j][k]=xyz_list[j*3+k];
+ 		}
+ 	}
+ 	for(i=0;i<numpoints;i++){
+ 		for(j=0;j<3;j++){ 
+ 			for(k=0;k<3;k++){
+ 				/*Change appropriate line*/
+-				xyz_bis[j][k]=xyz_zero[i][k];
++				xyz_bis[j][k]=xyz_zero[i*3+k];
+ 			}
+ 
+ 			/*Compute area fraction*/
+@@ -912,7 +912,7 @@
+ 			/*Reinitialize xyz_list*/
+ 			for(k=0;k<3;k++){
+ 				/*Reinitialize xyz_list with original coordinates*/
+-				xyz_bis[j][k]=xyz_list[j][k];
++				xyz_bis[j][k]=xyz_list[j*3+k];
+ 			}
+ 		}
+ 	}
+@@ -1511,19 +1511,19 @@
+ }
+ /*}}}*/
+ /*FUNCTION Penta::GetQuadNormal {{{*/
+-void Penta:: GetQuadNormal(IssmDouble* normal,IssmDouble xyz_list[4][3]){
++void Penta:: GetQuadNormal(IssmDouble* normal,IssmDouble* xyz_list){
+ 
+ 	/*Build unit outward pointing vector*/
+ 	IssmDouble AB[3];
+ 	IssmDouble AC[3];
+ 	IssmDouble norm;
+ 
+-	AB[0]=xyz_list[1][0] - xyz_list[0][0];
+-	AB[1]=xyz_list[1][1] - xyz_list[0][1];
+-	AB[2]=xyz_list[1][2] - xyz_list[0][2];
+-	AC[0]=xyz_list[2][0] - xyz_list[0][0];
+-	AC[1]=xyz_list[2][1] - xyz_list[0][1];
+-	AC[2]=xyz_list[2][2] - xyz_list[0][2];
++	AB[0]=xyz_list[1*3+0] - xyz_list[0*3+0];
++	AB[1]=xyz_list[1*3+1] - xyz_list[0*3+1];
++	AB[2]=xyz_list[1*3+2] - xyz_list[0*3+2];
++	AC[0]=xyz_list[2*3+0] - xyz_list[0*3+0];
++	AC[1]=xyz_list[2*3+1] - xyz_list[0*3+1];
++	AC[2]=xyz_list[2*3+2] - xyz_list[0*3+2];
+ 
+ 	cross(normal,AB,AC);
+ 	norm=sqrt(pow(normal[0],2.0)+pow(normal[1],2.0)+pow(normal[2],2.0));
+@@ -1647,13 +1647,14 @@
+ 	return z;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetZeroLevelsetCoordinates{{{*/
+-void Penta::GetZeroLevelsetCoordinates(IssmDouble* xyz_zero,IssmDouble xyz_list[6][3],int levelsetenum){
++/*FUNCTION Penta::ZeroLevelsetCoordinates{{{*/
++void Penta::ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){
+ 	/*Computeportion of the element that is grounded*/ 
+ 
+ 	int         normal_orientation=0;
+ 	IssmDouble  s1,s2;
+ 	IssmDouble  levelset[NUMVERTICES];
++	IssmDouble* xyz_zero = xNew<IssmDouble>(4*3);
+ 
+ 	/*Recover parameters and values*/
+ 	GetInputListOnVertices(&levelset[0],levelsetenum);
+@@ -1665,24 +1666,24 @@
+ 
+ 		if(levelset[2]>0.) normal_orientation=1;
+ 		/*New point 1*/
+-		xyz_zero[3*normal_orientation+0]=xyz_list[2][0]+s1*(xyz_list[1][0]-xyz_list[2][0]);
+-		xyz_zero[3*normal_orientation+1]=xyz_list[2][1]+s1*(xyz_list[1][1]-xyz_list[2][1]);
+-		xyz_zero[3*normal_orientation+2]=xyz_list[2][2]+s1*(xyz_list[1][2]-xyz_list[2][2]);
++		xyz_zero[3*normal_orientation+0]=xyz_list[2*3+0]+s1*(xyz_list[1*3+0]-xyz_list[2*3+0]);
++		xyz_zero[3*normal_orientation+1]=xyz_list[2*3+1]+s1*(xyz_list[1*3+1]-xyz_list[2*3+1]);
++		xyz_zero[3*normal_orientation+2]=xyz_list[2*3+2]+s1*(xyz_list[1*3+2]-xyz_list[2*3+2]);
+ 
+ 		/*New point 0*/
+-		xyz_zero[3*(1-normal_orientation)+0]=xyz_list[2][0]+s2*(xyz_list[0][0]-xyz_list[2][0]);
+-		xyz_zero[3*(1-normal_orientation)+1]=xyz_list[2][1]+s2*(xyz_list[0][1]-xyz_list[2][1]);
+-		xyz_zero[3*(1-normal_orientation)+2]=xyz_list[2][2]+s2*(xyz_list[0][2]-xyz_list[2][2]);
++		xyz_zero[3*(1-normal_orientation)+0]=xyz_list[2*3+0]+s2*(xyz_list[0*3+0]-xyz_list[2*3+0]);
++		xyz_zero[3*(1-normal_orientation)+1]=xyz_list[2*3+1]+s2*(xyz_list[0*3+1]-xyz_list[2*3+1]);
++		xyz_zero[3*(1-normal_orientation)+2]=xyz_list[2*3+2]+s2*(xyz_list[0*3+2]-xyz_list[2*3+2]);
+ 
+ 		/*New point 3*/
+-		xyz_zero[3*(2+1-normal_orientation)+0]=xyz_list[5][0]+s1*(xyz_list[4][0]-xyz_list[5][0]);
+-		xyz_zero[3*(2+1-normal_orientation)+1]=xyz_list[5][1]+s1*(xyz_list[4][1]-xyz_list[5][1]);
+-		xyz_zero[3*(2+1-normal_orientation)+2]=xyz_list[5][2]+s1*(xyz_list[4][2]-xyz_list[5][2]);
++		xyz_zero[3*(2+1-normal_orientation)+0]=xyz_list[5*3+0]+s1*(xyz_list[4*3+0]-xyz_list[5*3+0]);
++		xyz_zero[3*(2+1-normal_orientation)+1]=xyz_list[5*3+1]+s1*(xyz_list[4*3+1]-xyz_list[5*3+1]);
++		xyz_zero[3*(2+1-normal_orientation)+2]=xyz_list[5*3+2]+s1*(xyz_list[4*3+2]-xyz_list[5*3+2]);
+ 
+ 		/*New point 4*/
+-		xyz_zero[3*(2+normal_orientation)+0]=xyz_list[5][0]+s2*(xyz_list[3][0]-xyz_list[5][0]);
+-		xyz_zero[3*(2+normal_orientation)+1]=xyz_list[5][1]+s2*(xyz_list[3][1]-xyz_list[5][1]);
+-		xyz_zero[3*(2+normal_orientation)+2]=xyz_list[5][2]+s2*(xyz_list[3][2]-xyz_list[5][2]);
++		xyz_zero[3*(2+normal_orientation)+0]=xyz_list[5*3+0]+s2*(xyz_list[3*3+0]-xyz_list[5*3+0]);
++		xyz_zero[3*(2+normal_orientation)+1]=xyz_list[5*3+1]+s2*(xyz_list[3*3+1]-xyz_list[5*3+1]);
++		xyz_zero[3*(2+normal_orientation)+2]=xyz_list[5*3+2]+s2*(xyz_list[3*3+2]-xyz_list[5*3+2]);
+ 	}
+ 	else if(levelset[1]*levelset[2]>0.){ //Nodes 1 and 2 are similar, so points must be found on segment 0-1 and 0-2
+ 		/*Portion of the segments*/
+@@ -1691,24 +1692,24 @@
+ 
+ 		if(levelset[0]>0.) normal_orientation=1;
+ 		/*New point 1*/
+-		xyz_zero[3*normal_orientation+0]=xyz_list[0][0]+s1*(xyz_list[2][0]-xyz_list[0][0]);
+-		xyz_zero[3*normal_orientation+1]=xyz_list[0][1]+s1*(xyz_list[2][1]-xyz_list[0][1]);
+-		xyz_zero[3*normal_orientation+2]=xyz_list[0][2]+s1*(xyz_list[2][2]-xyz_list[0][2]);
++		xyz_zero[3*normal_orientation+0]=xyz_list[0*3+0]+s1*(xyz_list[2*3+0]-xyz_list[0*3+0]);
++		xyz_zero[3*normal_orientation+1]=xyz_list[0*3+1]+s1*(xyz_list[2*3+1]-xyz_list[0*3+1]);
++		xyz_zero[3*normal_orientation+2]=xyz_list[0*3+2]+s1*(xyz_list[2*3+2]-xyz_list[0*3+2]);
+ 
+ 		/*New point 2*/
+-		xyz_zero[3*(1-normal_orientation)+0]=xyz_list[0][0]+s2*(xyz_list[1][0]-xyz_list[0][0]);
+-		xyz_zero[3*(1-normal_orientation)+1]=xyz_list[0][1]+s2*(xyz_list[1][1]-xyz_list[0][1]);
+-		xyz_zero[3*(1-normal_orientation)+2]=xyz_list[0][2]+s2*(xyz_list[1][2]-xyz_list[0][2]);
++		xyz_zero[3*(1-normal_orientation)+0]=xyz_list[0*3+0]+s2*(xyz_list[1*3+0]-xyz_list[0*3+0]);
++		xyz_zero[3*(1-normal_orientation)+1]=xyz_list[0*3+1]+s2*(xyz_list[1*3+1]-xyz_list[0*3+1]);
++		xyz_zero[3*(1-normal_orientation)+2]=xyz_list[0*3+2]+s2*(xyz_list[1*3+2]-xyz_list[0*3+2]);
+ 
+ 		/*New point 3*/
+-		xyz_zero[3*(2+1-normal_orientation)+0]=xyz_list[3][0]+s1*(xyz_list[5][0]-xyz_list[3][0]);
+-		xyz_zero[3*(2+1-normal_orientation)+1]=xyz_list[3][1]+s1*(xyz_list[5][1]-xyz_list[3][1]);
+-		xyz_zero[3*(2+1-normal_orientation)+2]=xyz_list[3][2]+s1*(xyz_list[5][2]-xyz_list[3][2]);
++		xyz_zero[3*(2+1-normal_orientation)+0]=xyz_list[3*3+0]+s1*(xyz_list[5*3+0]-xyz_list[3*3+0]);
++		xyz_zero[3*(2+1-normal_orientation)+1]=xyz_list[3*3+1]+s1*(xyz_list[5*3+1]-xyz_list[3*3+1]);
++		xyz_zero[3*(2+1-normal_orientation)+2]=xyz_list[3*3+2]+s1*(xyz_list[5*3+2]-xyz_list[3*3+2]);
+ 
+ 		/*New point 4*/
+-		xyz_zero[3*(2+normal_orientation)+0]=xyz_list[3][0]+s2*(xyz_list[4][0]-xyz_list[3][0]);
+-		xyz_zero[3*(2+normal_orientation)+1]=xyz_list[3][1]+s2*(xyz_list[4][1]-xyz_list[3][1]);
+-		xyz_zero[3*(2+normal_orientation)+2]=xyz_list[3][2]+s2*(xyz_list[4][2]-xyz_list[3][2]);
++		xyz_zero[3*(2+normal_orientation)+0]=xyz_list[3*3+0]+s2*(xyz_list[4*3+0]-xyz_list[3*3+0]);
++		xyz_zero[3*(2+normal_orientation)+1]=xyz_list[3*3+1]+s2*(xyz_list[4*3+1]-xyz_list[3*3+1]);
++		xyz_zero[3*(2+normal_orientation)+2]=xyz_list[3*3+2]+s2*(xyz_list[4*3+2]-xyz_list[3*3+2]);
+ 	}
+ 	else if(levelset[0]*levelset[2]>0.){ //Nodes 0 and 2 are similar, so points must be found on segment 1-0 and 1-2
+ 		/*Portion of the segments*/
+@@ -1717,86 +1718,89 @@
+ 
+ 		if(levelset[1]>0.) normal_orientation=1;
+ 		/*New point 0*/
+-		xyz_zero[3*normal_orientation+0]=xyz_list[1][0]+s1*(xyz_list[0][0]-xyz_list[1][0]);
+-		xyz_zero[3*normal_orientation+1]=xyz_list[1][1]+s1*(xyz_list[0][1]-xyz_list[1][1]);
+-		xyz_zero[3*normal_orientation+2]=xyz_list[1][2]+s1*(xyz_list[0][2]-xyz_list[1][2]);
++		xyz_zero[3*normal_orientation+0]=xyz_list[1*3+0]+s1*(xyz_list[0*3+0]-xyz_list[1*3+0]);
++		xyz_zero[3*normal_orientation+1]=xyz_list[1*3+1]+s1*(xyz_list[0*3+1]-xyz_list[1*3+1]);
++		xyz_zero[3*normal_orientation+2]=xyz_list[1*3+2]+s1*(xyz_list[0*3+2]-xyz_list[1*3+2]);
+ 
+ 		/*New point 2*/
+-		xyz_zero[3*(1-normal_orientation)+0]=xyz_list[1][0]+s2*(xyz_list[2][0]-xyz_list[1][0]);
+-		xyz_zero[3*(1-normal_orientation)+1]=xyz_list[1][1]+s2*(xyz_list[2][1]-xyz_list[1][1]);
+-		xyz_zero[3*(1-normal_orientation)+2]=xyz_list[1][2]+s2*(xyz_list[2][2]-xyz_list[1][2]);
++		xyz_zero[3*(1-normal_orientation)+0]=xyz_list[1*3+0]+s2*(xyz_list[2*3+0]-xyz_list[1*3+0]);
++		xyz_zero[3*(1-normal_orientation)+1]=xyz_list[1*3+1]+s2*(xyz_list[2*3+1]-xyz_list[1*3+1]);
++		xyz_zero[3*(1-normal_orientation)+2]=xyz_list[1*3+2]+s2*(xyz_list[2*3+2]-xyz_list[1*3+2]);
+ 
+ 		/*New point 3*/
+-		xyz_zero[3*(2+1-normal_orientation)+0]=xyz_list[4][0]+s1*(xyz_list[3][0]-xyz_list[4][0]);
+-		xyz_zero[3*(2+1-normal_orientation)+1]=xyz_list[4][1]+s1*(xyz_list[3][1]-xyz_list[4][1]);
+-		xyz_zero[3*(2+1-normal_orientation)+2]=xyz_list[4][2]+s1*(xyz_list[3][2]-xyz_list[4][2]);
++		xyz_zero[3*(2+1-normal_orientation)+0]=xyz_list[4*3+0]+s1*(xyz_list[3*3+0]-xyz_list[4*3+0]);
++		xyz_zero[3*(2+1-normal_orientation)+1]=xyz_list[4*3+1]+s1*(xyz_list[3*3+1]-xyz_list[4*3+1]);
++		xyz_zero[3*(2+1-normal_orientation)+2]=xyz_list[4*3+2]+s1*(xyz_list[3*3+2]-xyz_list[4*3+2]);
+ 
+ 		/*New point 4*/
+-		xyz_zero[3*(2+normal_orientation)+0]=xyz_list[4][0]+s2*(xyz_list[5][0]-xyz_list[4][0]);
+-		xyz_zero[3*(2+normal_orientation)+1]=xyz_list[4][1]+s2*(xyz_list[5][1]-xyz_list[4][1]);
+-		xyz_zero[3*(2+normal_orientation)+2]=xyz_list[4][2]+s2*(xyz_list[5][2]-xyz_list[4][2]);
++		xyz_zero[3*(2+normal_orientation)+0]=xyz_list[4*3+0]+s2*(xyz_list[5*3+0]-xyz_list[4*3+0]);
++		xyz_zero[3*(2+normal_orientation)+1]=xyz_list[4*3+1]+s2*(xyz_list[5*3+1]-xyz_list[4*3+1]);
++		xyz_zero[3*(2+normal_orientation)+2]=xyz_list[4*3+2]+s2*(xyz_list[5*3+2]-xyz_list[4*3+2]);
+ 	}
+ 	else if(levelset[0]==0. && levelset[1]==0.){ //front is on point 0 and 1
+-		xyz_zero[3*0+0]=xyz_list[0][0];
+-		xyz_zero[3*0+1]=xyz_list[0][1];
+-		xyz_zero[3*0+2]=xyz_list[0][2];
++		xyz_zero[3*0+0]=xyz_list[0*3+0];
++		xyz_zero[3*0+1]=xyz_list[0*3+1];
++		xyz_zero[3*0+2]=xyz_list[0*3+2];
+ 
+ 		/*New point 2*/
+-		xyz_zero[3*1+0]=xyz_list[1][0];
+-		xyz_zero[3*1+1]=xyz_list[1][1];
+-		xyz_zero[3*1+2]=xyz_list[1][2];
++		xyz_zero[3*1+0]=xyz_list[1*3+0];
++		xyz_zero[3*1+1]=xyz_list[1*3+1];
++		xyz_zero[3*1+2]=xyz_list[1*3+2];
+ 
+ 		/*New point 3*/
+-		xyz_zero[3*2+0]=xyz_list[4][0];
+-		xyz_zero[3*2+1]=xyz_list[4][1];
+-		xyz_zero[3*2+2]=xyz_list[4][2];
++		xyz_zero[3*2+0]=xyz_list[4*3+0];
++		xyz_zero[3*2+1]=xyz_list[4*3+1];
++		xyz_zero[3*2+2]=xyz_list[4*3+2];
+ 
+ 		/*New point 4*/
+-		xyz_zero[3*3+0]=xyz_list[3][0];
+-		xyz_zero[3*3+1]=xyz_list[3][1];
+-		xyz_zero[3*3+2]=xyz_list[3][2];
++		xyz_zero[3*3+0]=xyz_list[3*3+0];
++		xyz_zero[3*3+1]=xyz_list[3*3+1];
++		xyz_zero[3*3+2]=xyz_list[3*3+2];
+ 	}
+ 	else if(levelset[0]==0. && levelset[2]==0.){ //front is on point 0 and 1
+-		xyz_zero[3*0+0]=xyz_list[2][0];
+-		xyz_zero[3*0+1]=xyz_list[2][1];
+-		xyz_zero[3*0+2]=xyz_list[2][2];
++		xyz_zero[3*0+0]=xyz_list[2*3+0];
++		xyz_zero[3*0+1]=xyz_list[2*3+1];
++		xyz_zero[3*0+2]=xyz_list[2*3+2];
+ 
+ 		/*New point 2*/
+-		xyz_zero[3*1+0]=xyz_list[0][0];
+-		xyz_zero[3*1+1]=xyz_list[0][1];
+-		xyz_zero[3*1+2]=xyz_list[0][2];
++		xyz_zero[3*1+0]=xyz_list[0*3+0];
++		xyz_zero[3*1+1]=xyz_list[0*3+1];
++		xyz_zero[3*1+2]=xyz_list[0*3+2];
+ 
+ 		/*New point 3*/
+-		xyz_zero[3*2+0]=xyz_list[3][0];
+-		xyz_zero[3*2+1]=xyz_list[3][1];
+-		xyz_zero[3*2+2]=xyz_list[3][2];
++		xyz_zero[3*2+0]=xyz_list[3*3+0];
++		xyz_zero[3*2+1]=xyz_list[3*3+1];
++		xyz_zero[3*2+2]=xyz_list[3*3+2];
+ 
+ 		/*New point 4*/
+-		xyz_zero[3*3+0]=xyz_list[5][0];
+-		xyz_zero[3*3+1]=xyz_list[5][1];
+-		xyz_zero[3*3+2]=xyz_list[5][2];
++		xyz_zero[3*3+0]=xyz_list[5*3+0];
++		xyz_zero[3*3+1]=xyz_list[5*3+1];
++		xyz_zero[3*3+2]=xyz_list[5*3+2];
+ 	}
+ 	else if(levelset[1]==0. && levelset[2]==0.){ //front is on point 0 and 1
+-		xyz_zero[3*0+0]=xyz_list[1][0];
+-		xyz_zero[3*0+1]=xyz_list[1][1];
+-		xyz_zero[3*0+2]=xyz_list[1][2];
++		xyz_zero[3*0+0]=xyz_list[1*3+0];
++		xyz_zero[3*0+1]=xyz_list[1*3+1];
++		xyz_zero[3*0+2]=xyz_list[1*3+2];
+ 
+ 		/*New point 2*/
+-		xyz_zero[3*1+0]=xyz_list[2][0];
+-		xyz_zero[3*1+1]=xyz_list[2][1];
+-		xyz_zero[3*1+2]=xyz_list[2][2];
++		xyz_zero[3*1+0]=xyz_list[2*3+0];
++		xyz_zero[3*1+1]=xyz_list[2*3+1];
++		xyz_zero[3*1+2]=xyz_list[2*3+2];
+ 
+ 		/*New point 3*/
+-		xyz_zero[3*2+0]=xyz_list[5][0];
+-		xyz_zero[3*2+1]=xyz_list[5][1];
+-		xyz_zero[3*2+2]=xyz_list[5][2];
++		xyz_zero[3*2+0]=xyz_list[5*3+0];
++		xyz_zero[3*2+1]=xyz_list[5*3+1];
++		xyz_zero[3*2+2]=xyz_list[5*3+2];
+ 
+ 		/*New point 4*/
+-		xyz_zero[3*3+0]=xyz_list[4][0];
+-		xyz_zero[3*3+1]=xyz_list[4][1];
+-		xyz_zero[3*3+2]=xyz_list[4][2];
++		xyz_zero[3*3+0]=xyz_list[4*3+0];
++		xyz_zero[3*3+1]=xyz_list[4*3+1];
++		xyz_zero[3*3+2]=xyz_list[4*3+2];
+ 	}
+ 	else _error_("Case not covered");
++
++	/*Assign output pointer*/
++	*pxyz_zero= xyz_zero;
+ }
+ /*}}}*/
+ /*FUNCTION Penta::Sid {{{*/
+@@ -8763,7 +8767,7 @@
+ 	IssmDouble  Jdet,surface,z_g,water_pressure,ice_pressure,air_pressure;
+ 	IssmDouble  surface_under_water,base_under_water,pressure;
+ 	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble  xyz_list_front[4][3];
++	IssmDouble* xyz_list_front = NULL;
+ 	IssmDouble  area_coordinates[4][3];
+ 	IssmDouble  normal[3];
+ 	GaussPenta* gauss;
+@@ -8781,8 +8785,8 @@
+ 	rho_water=matpar->GetRhoWater();
+ 	rho_ice  =matpar->GetRhoIce();
+ 	gravity  =matpar->GetG();
+-	GetZeroLevelsetCoordinates(&xyz_list_front[0][0],xyz_list,MaskIceLevelsetEnum);
+-	GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,xyz_list,4);
++	ZeroLevelsetCoordinates(&xyz_list_front,&xyz_list[0][0],MaskIceLevelsetEnum);
++	GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,&xyz_list[0][0],4);
+ 	GetQuadNormal(&normal[0],xyz_list_front);
+ 
+ 	/*Initialize gauss points*/
+@@ -8853,7 +8857,7 @@
+ 	IssmDouble  Jdet,z_g,water_pressure,air_pressure;
+ 	IssmDouble  surface_under_water,base_under_water,pressure;
+ 	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble  xyz_list_front[4][3];
++	IssmDouble* xyz_list_front = NULL;
+ 	IssmDouble  area_coordinates[4][3];
+ 	IssmDouble  normal[3];
+ 	GaussPenta* gauss;
+@@ -8868,16 +8872,16 @@
+ 	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
+ 
+ 	/*Initialize Element matrix and vectors*/
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	ElementVector* pe     = new ElementVector(nodes,vnumnodes+pnumnodes,this->parameters,FSvelocityEnum);
+ 	IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	rho_water=matpar->GetRhoWater();
+ 	rho_ice  =matpar->GetRhoIce();
+ 	gravity  =matpar->GetG();
+-	GetZeroLevelsetCoordinates(&xyz_list_front[0][0],xyz_list,MaskIceLevelsetEnum);
+-	GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,xyz_list,4);
++	ZeroLevelsetCoordinates(&xyz_list_front,&xyz_list[0][0],MaskIceLevelsetEnum);
++	GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,&xyz_list[0][0],4);
+ 	GetQuadNormal(&normal[0],xyz_list_front);
+ 
+ 	/*Start looping on Gaussian points*/
+@@ -8909,6 +8913,7 @@
+ 
+ 	/*Clean up and return*/
+ 	xDelete<int>(cs_list);
++	xDelete<IssmDouble>(xyz_list_front);
+ 	xDelete<IssmDouble>(vbasis);
+ 	delete gauss;
+ 	return pe;
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.h	(revision 16837)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.h	(revision 16838)
+@@ -34,7 +34,7 @@
+ 		void GetNodalFunctionsMINIDerivatives(IssmDouble* dh1dh7,IssmDouble* xyz_list, Gauss* gauss);
+ 		void GetNodalFunctionsP1DerivativesReference(IssmDouble* dl1dl6,Gauss* gauss);
+ 		void GetNodalFunctionsMINIDerivativesReference(IssmDouble* dl1dl7,Gauss* gauss);
+-		void GetQuadJacobianDeterminant(IssmDouble*  Jdet, IssmDouble xyz_list[4][3],Gauss* gauss);
++		void GetQuadJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetJacobian(IssmDouble* J, IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetTriaJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16837)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16838)
+@@ -113,6 +113,7 @@
+ 		IssmDouble PureIceEnthalpy(IssmDouble pressure);
+ 		int    PressureInterpolation();
+ 		bool   IsZeroLevelset(int levelset_enum);
++		void   ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum);
+ 
+ 		void   ResultInterpolation(int* pinterpolation,int output_enum);
+ 		void   ResultToVector(Vector<IssmDouble>* vector,int output_enum);
+@@ -210,7 +211,7 @@
+ 		ElementVector* CreatePVectorL2ProjectionBase(void);
+ 		IssmDouble     EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure);
+ 		IssmDouble     EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure);
+-		void           GetAreaCoordinates(IssmDouble *area_coordinates,IssmDouble xyz_zero[3][3],IssmDouble xyz_list[6][3],int numpoints);
++		void           GetAreaCoordinates(IssmDouble *area_coordinates,IssmDouble* xyz_zero,IssmDouble* xyz_list,int numpoints);
+ 
+ 		void	         GetVertexPidList(int* doflist);
+ 		void           GetVertexSidList(int* sidlist);
+@@ -230,11 +231,10 @@
+ 		void           GetInputValue(IssmDouble* pvalue,int enum_type);
+ 		void           GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype);
+ 		void	         GetPhi(IssmDouble* phi, IssmDouble*  epsilon, IssmDouble viscosity);
+-		void           GetQuadNormal(IssmDouble* normal,IssmDouble xyz_list[4][3]);
++		void           GetQuadNormal(IssmDouble* normal,IssmDouble* xyz_list);
+ 		void           GetStrainRate3dHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss, Input* vx_input, Input* vy_input);
+ 		void           GetStrainRate3d(IssmDouble* epsilon,IssmDouble* xyz_list, Gauss* gauss, Input* vx_input, Input* vy_input, Input* vz_input);
+ 		Penta*         GetUpperElement(void);
+-		void           GetZeroLevelsetCoordinates(IssmDouble* xyz_zero,IssmDouble xyz_list[6][3],int levelsetenum);
+ 		Penta*         GetLowerElement(void);
+ 		void           InputChangeName(int input_enum, int enum_type_old);
+ 		void	         InputExtrude(int enum_type,int object_type);
+@@ -246,11 +246,13 @@
+ 		bool           IsFloating(void); 
+ 		bool           IsNodeOnShelfFromFlags(IssmDouble* flags);
+ 		void           JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss);
++		void           JacobianDeterminantSurface(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void           JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss);
+ 		void           JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss);
+ 		bool           NoIceInElement(void); 
+ 		Gauss*         NewGauss(void);
+ 		Gauss*         NewGauss(int order);
++      Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){_error_("not implemented yet");};
+ 		Gauss*         NewGaussBase(int order);
+ 		Gauss*         NewGaussTop(int order);
+ 		ElementVector* NewElementVector(int approximation_enum);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16837)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16838)
+@@ -113,6 +113,7 @@
+ 		bool        IsFloating(){_error_("not implemented yet");};
+ 		bool        IsNodeOnShelfFromFlags(IssmDouble* flags){_error_("not implemented yet");};
+ 		void        JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
++		void           JacobianDeterminantSurface(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void        JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
+ 		void        JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
+ 		IssmDouble  MinEdgeLength(IssmDouble* xyz_list){_error_("not implemented yet");};
+@@ -141,6 +142,7 @@
+ 		void        GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");};
+ 		Gauss*      NewGauss(void){_error_("not implemented yet");};
+ 		Gauss*      NewGauss(int order){_error_("not implemented yet");};
++      Gauss*      NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){_error_("not implemented yet");};
+ 		Gauss*      NewGaussBase(int order){_error_("not implemented yet");};
+ 		Gauss*      NewGaussTop(int order){_error_("not implemented yet");};
+ 		ElementVector* NewElementVector(int approximation_enum){_error_("not implemented yet");};
+@@ -150,6 +152,7 @@
+ 		void        ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
+ 		void        ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
+ 		bool        IsZeroLevelset(int levelset_enum){_error_("not implemented");};
++		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented");};
+ 
+ 		#ifdef _HAVE_THERMAL_
+ 		void UpdateBasalConstraintsEnthalpy(void){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16838-16839.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16838-16839.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16838-16839.diff	(revision 17802)
@@ -0,0 +1,450 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16838)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16839)
+@@ -1135,7 +1135,7 @@
+ 	gravity   = element->GetMaterialParameter(ConstantsGEnum);
+ 	element->GetVerticesCoordinates(&xyz_list);
+ 	element->ZeroLevelsetCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
+-	element->NormalBase(&normal[0],xyz_list_front);
++	element->NormalSection(&normal[0],xyz_list_front);
+ 
+ 	/*Start looping on Gaussian points*/
+ 	Gauss* gauss=element->NewGauss(xyz_list,xyz_list_front,3);
+@@ -1569,7 +1569,68 @@
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorHOFront(Element* element){/*{{{*/
+ 
+-	return NULL;
++	/*If no front, return NULL*/
++	if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
++
++	/*Intermediaries*/
++	IssmDouble  rho_ice,rho_water,gravity;
++	IssmDouble  Jdet,surface,z_g,water_pressure,ice_pressure;
++	IssmDouble  surface_under_water,base_under_water,pressure;
++	IssmDouble* xyz_list       = NULL;
++	IssmDouble* xyz_list_front = NULL;
++	IssmDouble  normal[3];
++	Gauss*      gauss = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementVector* pe    = element->NewElementVector(HOApproximationEnum);
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	Input* surface_input=element->GetInput(SurfaceEnum); _assert_(surface_input);
++	rho_water = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	rho_ice   = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	gravity   = element->GetMaterialParameter(ConstantsGEnum);
++	element->GetVerticesCoordinates(&xyz_list);
++	element->ZeroLevelsetCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
++	element->NormalSection(&normal[0],xyz_list_front);
++
++	/*Initialize gauss points*/
++	IssmDouble zmax=xyz_list[0*3+2]; for(int i=1;i<6;i++) if(xyz_list[i*3+2]>zmax) zmax=xyz_list[i*3+2];
++	IssmDouble zmin=xyz_list[0*3+2]; for(int i=1;i<6;i++) if(xyz_list[i*3+2]<zmin) zmin=xyz_list[i*3+2];
++	if(zmax>0 && zmin<0) gauss=element->NewGauss(xyz_list,xyz_list_front,3,10);//refined in vertical because of the sea level discontinuity
++	else                 gauss=element->NewGauss(xyz_list,xyz_list_front,3,3);
++
++	/* Start  looping on the number of gaussian points: */
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++		surface_input->GetInputValue(&surface,gauss);
++		z_g=element->GetZcoord(gauss);
++		element->NodalFunctions(basis,gauss);
++		element->JacobianDeterminantSurface(&Jdet,xyz_list_front,gauss);
++
++		water_pressure = rho_water*gravity*min(0.,z_g);//0 if the gaussian point is above water level
++		ice_pressure   = rho_ice*gravity*(surface-z_g);
++		pressure       = ice_pressure + water_pressure;
++
++		for (int i=0;i<numnodes;i++){
++			pe->values[2*i+0]+= pressure*Jdet*gauss->weight*normal[0]*basis[i];
++			pe->values[2*i+1]+= pressure*Jdet*gauss->weight*normal[1]*basis[i];
++		}
++	}
++
++	/*Transform coordinate system*/
++	element->TransformLoadVectorCoord(pe,XYEnum);
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(xyz_list_front);
++	delete gauss;
++	return pe;
+ }/*}}}*/
+ void StressbalanceAnalysis::GetBHO(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF2. 
+@@ -1936,7 +1997,7 @@
+ 		element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
+ 		element->NodalFunctionsVelocity(vbasis,gauss);
+ 
+-		element->NormalBase(&normal[0],xyz_list_base);
++		element->NormalSection(&normal[0],xyz_list_base);
+ 		_assert_(normal[dim-1]<0.);
+ 		bed_input->GetInputValue(&bed, gauss);
+ 		water_pressure=gravity*rho_water*bed;
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16838)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16839)
+@@ -61,7 +61,7 @@
+ 		virtual void   NodalFunctionsPressure(IssmDouble* basis, Gauss* gauss)=0;
+ 		virtual void   NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss)=0;
+ 		virtual void   NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss)=0;
+-		virtual void   NormalBase(IssmDouble* normal,IssmDouble* xyz_list)=0;
++		virtual void   NormalSection(IssmDouble* normal,IssmDouble* xyz_list)=0;
+ 		virtual void   NormalTop(IssmDouble* normal,IssmDouble* xyz_list)=0;
+ 		virtual IssmDouble PureIceEnthalpy(IssmDouble pressure)=0;
+ 		virtual void   TransformLoadVectorCoord(ElementVector* pe,int transformenum)=0;
+@@ -110,6 +110,7 @@
+ 		virtual void   GetVerticesCoordinates(IssmDouble** xyz_list)=0;
+ 		virtual void   GetVerticesCoordinatesBase(IssmDouble** xyz_list)=0;
+ 		virtual void   GetVerticesCoordinatesTop(IssmDouble** xyz_list)=0;
++		virtual IssmDouble GetZcoord(Gauss* gauss)=0;
+ 		virtual void   GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype)=0;
+ 
+ 		virtual IssmDouble SurfaceArea(void)=0;
+@@ -131,6 +132,7 @@
+ 		virtual Gauss* NewGauss(void)=0;
+ 		virtual Gauss* NewGauss(int order)=0;
+       virtual Gauss* NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order)=0;
++      virtual Gauss* NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert)=0;
+ 		virtual Gauss* NewGaussBase(int order)=0;
+ 		virtual Gauss* NewGaussTop(int order)=0;
+ 		virtual ElementVector*  NewElementVector(int approximation_enum=NoneApproximationEnum)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16838)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16839)
+@@ -1167,8 +1167,8 @@
+ 	*pxyz_list = xyz_list;
+ 
+ }/*}}}*/
+-/*FUNCTION Tria::NormalBase {{{*/
+-void Tria::NormalBase(IssmDouble* normal,IssmDouble* xyz_list){
++/*FUNCTION Tria::NormalSection{{{*/
++void Tria::NormalSection(IssmDouble* normal,IssmDouble* xyz_list){
+ 
+ 	/*Build unit outward pointing vector*/
+ 	IssmDouble vector[2];
+@@ -2696,29 +2696,6 @@
+ 	return S;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::SurfaceNormal{{{*/
+-void Tria::SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]){
+-
+-	IssmDouble v13[3],v23[3];
+-	IssmDouble normal[3];
+-	IssmDouble normal_norm;
+-
+-	for(int i=0;i<3;i++){
+-		v13[i]=xyz_list[0][i]-xyz_list[2][i];
+-		v23[i]=xyz_list[1][i]-xyz_list[2][i];
+-	}
+-
+-	normal[0]=v13[1]*v23[2]-v13[2]*v23[1];
+-	normal[1]=v13[2]*v23[0]-v13[0]*v23[2];
+-	normal[2]=v13[0]*v23[1]-v13[1]*v23[0];
+-
+-	normal_norm=sqrt( normal[0]*normal[0] + normal[1]*normal[1] + normal[2]*normal[2]);
+-
+-	*(surface_normal+0) = normal[0]/normal_norm;
+-	*(surface_normal+1) = normal[1]/normal_norm;
+-	*(surface_normal+2) = normal[2]/normal_norm;
+-}
+-/*}}}*/
+ /*FUNCTION Tria::TimeAdapt{{{*/
+ IssmDouble  Tria::TimeAdapt(void){
+ 
+@@ -3975,7 +3952,7 @@
+ 	gravity   = matpar->GetG();
+ 	ZeroLevelsetCoordinates(&xyz_list_front,&xyz_list[0][0],MaskIceLevelsetEnum);
+ 	GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,&xyz_list[0][0],2);
+-	NormalBase(&normal[0],xyz_list_front);
++	NormalSection(&normal[0],xyz_list_front);
+ 
+ 	/*Start looping on Gaussian points*/
+ 	IssmDouble ymax=max(xyz_list_front[0*3+1],xyz_list_front[1*3+1]);
+@@ -4121,7 +4098,7 @@
+ 		GetSegmentJacobianDeterminant(&Jdet,&xyz_list_seg[0][0],gauss);
+ 		GetNodalFunctionsVelocity(vbasis, gauss);
+ 
+-		NormalBase(&normal[0],&xyz_list_seg[0][0]);
++		NormalSection(&normal[0],&xyz_list_seg[0][0]);
+ 		_assert_(normal[1]<0.);
+ 		bed_input->GetInputValue(&bed, gauss);
+ 		water_pressure=gravity*rho_water*bed;
+@@ -4241,7 +4218,7 @@
+ 	gravity   = matpar->GetG();
+ 	ZeroLevelsetCoordinates(&xyz_list_front,&xyz_list[0][0],MaskIceLevelsetEnum);
+ 	GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,&xyz_list[0][0],2);
+-	NormalBase(&normal[0],xyz_list_front);
++	NormalSection(&normal[0],xyz_list_front);
+ 
+ 	/*Start looping on Gaussian points*/
+ 	GaussTria* gauss=new GaussTria(area_coordinates,3);
+@@ -7219,7 +7196,7 @@
+ 	/*Get vertex indices that lie on bed*/
+ 	this->EdgeOnSurfaceIndices(&indices[0],&indices[1]);
+ 	for(int i=0;i<NUMVERTICES1D;i++) for(int j=0;j<2;j++) xyz_list_seg[i][j]=xyz_list[indices[i]][j];
+-	NormalBase(&normal[0],&xyz_list_seg[0][0]);
++	NormalSection(&normal[0],&xyz_list_seg[0][0]);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	gauss=new GaussTria(indices[0],indices[1],2);
+@@ -7269,7 +7246,7 @@
+ 	/*Get vertex indices that lie on bed*/
+ 	this->EdgeOnBedIndices(&indices[0],&indices[1]);
+ 	for(int i=0;i<NUMVERTICES1D;i++) for(int j=0;j<2;j++) xyz_list_seg[i][j]=xyz_list[indices[i]][j];
+-	NormalBase(&normal[0],&xyz_list_seg[0][0]);
++	NormalSection(&normal[0],&xyz_list_seg[0][0]);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	gauss=new GaussTria(indices[0],indices[1],2);
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16838)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16839)
+@@ -256,7 +256,8 @@
+ 		void           GetConnectivityList(int* connectivity);
+ 		void           GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating);
+ 		IssmDouble     GetGroundedPortion(IssmDouble* xyz_list);
+-		void           NormalBase(IssmDouble* normal,IssmDouble* xyz_list);
++		IssmDouble     GetZcoord(Gauss* gauss){_error_("not implemented");};
++		void           NormalSection(IssmDouble* normal,IssmDouble* xyz_list);
+ 		void           NormalTop(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		IssmDouble     GetMaterialParameter(int enum_in);
+ 		Input*         GetInput(int inputenum);
+@@ -283,6 +284,7 @@
+ 		Gauss*         NewGauss(void);
+ 		Gauss*         NewGauss(int order);
+       Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order);
++      Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){_error_("not implemented yet");};
+ 		Gauss*         NewGaussBase(int order){_error_("not implemented yet");};
+ 		Gauss*         NewGaussTop(int order){_error_("not implemented yet");};
+ 		ElementVector* NewElementVector(int approximation_enum);
+@@ -295,7 +297,6 @@
+ 		void	         SetClone(int* minranks);
+ 		Seg*	         SpawnSeg(int index1,int index2);
+ 		IssmDouble     StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa){_error_("not implemented yet");};
+-		void	         SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]);
+ 		void           TransformLoadVectorCoord(ElementVector* pe,int transformenum);
+ 		void           TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list);
+ 		void           TransformLoadVectorCoord(ElementVector* pe,int numnodes,int transformenum){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16838)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16839)
+@@ -1510,8 +1510,8 @@
+ 	*phi=4*pow(epsilon_eff,2.0)*viscosity;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetQuadNormal {{{*/
+-void Penta:: GetQuadNormal(IssmDouble* normal,IssmDouble* xyz_list){
++/*FUNCTION Penta::NormalSection{{{*/
++void Penta::NormalSection(IssmDouble* normal,IssmDouble* xyz_list){
+ 
+ 	/*Build unit outward pointing vector*/
+ 	IssmDouble AB[3];
+@@ -1633,7 +1633,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION Penta::GetZcoord {{{*/
+-IssmDouble Penta::GetZcoord(GaussPenta* gauss){
++IssmDouble Penta::GetZcoord(Gauss* gauss){
+ 
+ 	int    i;
+ 	IssmDouble z;
+@@ -2465,6 +2465,14 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Penta::JacobianDeterminantSurface{{{*/
++void Penta::JacobianDeterminantSurface(IssmDouble* pJdet,IssmDouble* xyz_list_quad,Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussPentaEnum);
++	this->GetQuadJacobianDeterminant(pJdet,xyz_list_quad,(GaussPenta*)gauss);
++
++}
++/*}}}*/
+ /*FUNCTION Penta::NoIceInElement {{{*/
+ bool   Penta::NoIceInElement(){
+ 
+@@ -2543,6 +2551,16 @@
+ 	return new GaussPenta(order,order);
+ }
+ /*}}}*/
++/*FUNCTION Penta::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){{{*/
++Gauss* Penta::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){
++
++	IssmDouble  area_coordinates[4][3];
++
++	GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,xyz_list,4);
++
++	return new GaussPenta(area_coordinates,order_horiz,order_vert);
++}
++/*}}}*/
+ /*FUNCTION Penta::NewGaussBase(int order){{{*/
+ Gauss* Penta::NewGaussBase(int order){
+ 	return new GaussPenta(0,1,2,order);
+@@ -3124,30 +3142,6 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Penta::SurfaceNormal {{{*/
+-void Penta::SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]){
+-
+-	int    i;
+-	IssmDouble v13[3],v23[3];
+-	IssmDouble normal[3];
+-	IssmDouble normal_norm;
+-
+-	for (i=0;i<3;i++){
+-		v13[i]=xyz_list[0][i]-xyz_list[2][i];
+-		v23[i]=xyz_list[1][i]-xyz_list[2][i];
+-	}
+-
+-	normal[0]=v13[1]*v23[2]-v13[2]*v23[1];
+-	normal[1]=v13[2]*v23[0]-v13[0]*v23[2];
+-	normal[2]=v13[0]*v23[1]-v13[1]*v23[0];
+-
+-	normal_norm=sqrt( pow(normal[0],2)+pow(normal[1],2)+pow(normal[2],2) );
+-
+-	*(surface_normal)=normal[0]/normal_norm;
+-	*(surface_normal+1)=normal[1]/normal_norm;
+-	*(surface_normal+2)=normal[2]/normal_norm;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::TimeAdapt{{{*/
+ IssmDouble  Penta::TimeAdapt(void){
+ 
+@@ -6071,7 +6065,7 @@
+ 		vz_input->GetInputValue(&vz, gauss);
+ 
+ 		/*Get normal vector to the bed */
+-		SurfaceNormal(&surface_normal[0],xyz_list_tria);
++		NormalTop(&surface_normal[0],&xyz_list_tria[0][0]);
+ 
+ 		bed_normal[0]=-surface_normal[0]; //Function is for upper surface, so the normal to the bed is the opposite of the result
+ 		bed_normal[1]=-surface_normal[1];
+@@ -8122,7 +8116,7 @@
+ 	/*Retrieve all inputs and parameters*/
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i+3][j];
+-	SurfaceNormal(&surface_normal[0],xyz_list_tria);
++	NormalTop(&surface_normal[0],&xyz_list_tria[0][0]);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	gauss=new GaussPenta(3,4,5,2);
+@@ -8787,7 +8781,7 @@
+ 	gravity  =matpar->GetG();
+ 	ZeroLevelsetCoordinates(&xyz_list_front,&xyz_list[0][0],MaskIceLevelsetEnum);
+ 	GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,&xyz_list[0][0],4);
+-	GetQuadNormal(&normal[0],xyz_list_front);
++	NormalSection(&normal[0],xyz_list_front);
+ 
+ 	/*Initialize gauss points*/
+ 	IssmDouble zmax=xyz_list[0][2]; for(int i=1;i<6;i++) if(xyz_list[i][2]>zmax) zmax=xyz_list[i][2];
+@@ -8820,6 +8814,7 @@
+ 
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(xyz_list_front);
+ 	delete gauss;
+ 	return pe;
+ }
+@@ -8882,7 +8877,7 @@
+ 	gravity  =matpar->GetG();
+ 	ZeroLevelsetCoordinates(&xyz_list_front,&xyz_list[0][0],MaskIceLevelsetEnum);
+ 	GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,&xyz_list[0][0],4);
+-	GetQuadNormal(&normal[0],xyz_list_front);
++	NormalSection(&normal[0],xyz_list_front);
+ 
+ 	/*Start looping on Gaussian points*/
+ 	IssmDouble zmax=xyz_list[0][2]; for(int i=1;i<6;i++) if(xyz_list[i][2]>zmax) zmax=xyz_list[i][2];
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16838)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16839)
+@@ -96,7 +96,7 @@
+ 		int    GetNumberOfVertices(void);
+ 		IssmDouble GetMaterialParameter(int enum_in);
+ 		void   GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
+-		IssmDouble GetZcoord(GaussPenta* gauss);
++		IssmDouble GetZcoord(Gauss* gauss);
+ 		void   GetVectorFromInputs(Vector<IssmDouble>* vector,int name_enum);
+ 		void   GetVerticesCoordinates(IssmDouble** pxyz_list);
+ 		void   GetVerticesCoordinatesBase(IssmDouble** pxyz_list);
+@@ -198,6 +198,7 @@
+ 		void           AddInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		void           AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		void	         NormalBase(IssmDouble* bed_normal, IssmDouble* xyz_list);
++		void           NormalSection(IssmDouble* normal,IssmDouble* xyz_list);
+ 		void	         NormalTop(IssmDouble* bed_normal, IssmDouble* xyz_list);
+ 		ElementMatrix* CreateBasalMassMatrix(void);
+ 		ElementMatrix* CreateKMatrix(void);
+@@ -231,7 +232,6 @@
+ 		void           GetInputValue(IssmDouble* pvalue,int enum_type);
+ 		void           GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype);
+ 		void	         GetPhi(IssmDouble* phi, IssmDouble*  epsilon, IssmDouble viscosity);
+-		void           GetQuadNormal(IssmDouble* normal,IssmDouble* xyz_list);
+ 		void           GetStrainRate3dHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss, Input* vx_input, Input* vy_input);
+ 		void           GetStrainRate3d(IssmDouble* epsilon,IssmDouble* xyz_list, Gauss* gauss, Input* vx_input, Input* vy_input, Input* vz_input);
+ 		Penta*         GetUpperElement(void);
+@@ -246,13 +246,14 @@
+ 		bool           IsFloating(void); 
+ 		bool           IsNodeOnShelfFromFlags(IssmDouble* flags);
+ 		void           JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss);
+-		void           JacobianDeterminantSurface(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
++		void           JacobianDeterminantSurface(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss);
+ 		void           JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss);
+ 		void           JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss);
+ 		bool           NoIceInElement(void); 
+ 		Gauss*         NewGauss(void);
+ 		Gauss*         NewGauss(int order);
+       Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){_error_("not implemented yet");};
++      Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert);
+ 		Gauss*         NewGaussBase(int order);
+ 		Gauss*         NewGaussTop(int order);
+ 		ElementVector* NewElementVector(int approximation_enum);
+@@ -265,7 +266,6 @@
+ 		IssmDouble     MinEdgeLength(IssmDouble* xyz_list);
+ 		void	         SetClone(int* minranks);
+ 		Tria*	         SpawnTria(int location);
+-		void	         SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]);
+ 		IssmDouble     StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa);
+ 		void           TransformLoadVectorCoord(ElementVector* pe,int transformenum);
+ 		void           TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16838)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16839)
+@@ -123,7 +123,7 @@
+ 		void        NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		bool        NoIceInElement(){_error_("not implemented yet");};
+-		void        NormalBase(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
++		void        NormalSection(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		void        NormalTop(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		int         NumberofNodesVelocity(void){_error_("not implemented yet");};
+ 		int         NumberofNodesPressure(void){_error_("not implemented yet");};
+@@ -140,9 +140,11 @@
+ 		void        GetInputValue(int* pvalue,int enum_type){_error_("not implemented yet");};
+ 		void        GetInputValue(IssmDouble* pvalue,int enum_type){_error_("not implemented yet");};
+ 		void        GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");};
++		IssmDouble  GetZcoord(Gauss* gauss){_error_("not implemented yet");};
+ 		Gauss*      NewGauss(void){_error_("not implemented yet");};
+ 		Gauss*      NewGauss(int order){_error_("not implemented yet");};
+       Gauss*      NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){_error_("not implemented yet");};
++      Gauss*      NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){_error_("not implemented yet");};
+ 		Gauss*      NewGaussBase(int order){_error_("not implemented yet");};
+ 		Gauss*      NewGaussTop(int order){_error_("not implemented yet");};
+ 		ElementVector* NewElementVector(int approximation_enum){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16839-16840.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16839-16840.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16839-16840.diff	(revision 17802)
@@ -0,0 +1,454 @@
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.h	(revision 16839)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.h	(revision 16840)
+@@ -21,10 +21,15 @@
+ 
+ 		/*Finite element Analysis*/
+ 		ElementMatrix* CreateKMatrix(Element* element);
++		ElementMatrix* CreateKMatrixVolume(Element* element);
++		ElementMatrix* CreateKMatrixShelf(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+ 		ElementVector* CreatePVectorVolume(Element* element);
+ 		ElementVector* CreatePVectorSheet(Element* element);
+ 		ElementVector* CreatePVectorShelf(Element* element);
++		void GetBConduct(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBAdvec(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBAdvecprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16839)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16840)
+@@ -112,8 +112,191 @@
+ 
+ /*Finite Element Analysis*/
+ ElementMatrix* ThermalAnalysis::CreateKMatrix(Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	/*compute all stiffness matrices for this element*/
++	ElementMatrix* Ke1=CreateKMatrixVolume(element);
++	ElementMatrix* Ke2=CreateKMatrixShelf(element);
++	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
++
++	/*clean-up and return*/
++	delete Ke1;
++	delete Ke2;
++	return Ke;
+ }/*}}}*/
++ElementMatrix* ThermalAnalysis::CreateKMatrixVolume(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	int         stabilization;
++	IssmDouble  Jdet,dt,u,v,w,um,vm,wm,vel;
++	IssmDouble  h,hx,hy,hz,vx,vy,vz;
++	IssmDouble  tau_parameter,diameter;
++	IssmDouble  D_scalar;
++	IssmDouble* xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementMatrix* Ke     = element->NewElementMatrix();
++	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
++	IssmDouble*    dbasis = xNew<IssmDouble>(3*numnodes);
++	IssmDouble*    B      = xNew<IssmDouble>(3*numnodes);
++	IssmDouble*    Bprime = xNew<IssmDouble>(3*numnodes);
++	IssmDouble     D[3][3]={0.};
++	IssmDouble     K[3][3];
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	element->FindParam(&dt,TimesteppingTimeStepEnum);
++	element->FindParam(&stabilization,ThermalStabilizationEnum);
++	IssmDouble  rho_water           = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble  rho_ice             = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	IssmDouble  gravity             = element->GetMaterialParameter(ConstantsGEnum);
++	IssmDouble  heatcapacity        = element->GetMaterialParameter(MaterialsHeatcapacityEnum);
++	IssmDouble  thermalconductivity = element->GetMaterialParameter(MaterialsThermalconductivityEnum);
++	IssmDouble  kappa = thermalconductivity/(rho_ice*heatcapacity);
++	Input* vx_input  = element->GetInput(VxEnum);     _assert_(vx_input);
++	Input* vy_input  = element->GetInput(VyEnum);     _assert_(vy_input);
++	Input* vz_input  = element->GetInput(VzEnum);     _assert_(vz_input);
++	Input* vxm_input = element->GetInput(VxMeshEnum); _assert_(vxm_input);
++	Input* vym_input = element->GetInput(VyMeshEnum); _assert_(vym_input);
++	Input* vzm_input = element->GetInput(VzMeshEnum); _assert_(vzm_input);
++	if(stabilization==2) diameter=element->MinEdgeLength(xyz_list);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		D_scalar=gauss->weight*Jdet*kappa;
++		if(dt!=0.) D_scalar=D_scalar*dt;
++
++		/*Conduction: */
++		GetBConduct(B,element,xyz_list,gauss); 
++		D[0][0]=D_scalar;
++		D[1][1]=D_scalar;
++		D[2][2]=D_scalar;
++		TripleMultiply(B,3,numnodes,1,
++					&D[0][0],3,3,0,
++					B,3,numnodes,0,
++					&Ke->values[0],1);
++
++		/*Advection: */
++		GetBAdvec(B,element,xyz_list,gauss); 
++		GetBAdvecprime(Bprime,element,xyz_list,gauss); 
++		vx_input->GetInputValue(&u,gauss); vxm_input->GetInputValue(&um,gauss); vx=u-um;
++		vy_input->GetInputValue(&v,gauss); vym_input->GetInputValue(&vm,gauss); vy=v-vm;
++		vz_input->GetInputValue(&w,gauss); vzm_input->GetInputValue(&wm,gauss); vz=w-wm;
++		D[0][0]=D_scalar*vx;
++		D[1][1]=D_scalar*vy;
++		D[2][2]=D_scalar*vz;
++		TripleMultiply(B,3,numnodes,1,
++					&D[0][0],3,3,0,
++					Bprime,3,numnodes,0,
++					&Ke->values[0],1);
++
++		/*Transient: */
++		if(dt!=0.){
++			element->NodalFunctions(basis,gauss);
++
++			TripleMultiply(basis,numnodes,1,0,
++						&D_scalar,1,1,0,
++						basis,1,numnodes,0,
++						&Ke->values[0],1);
++		}
++
++		/*Artifficial diffusivity*/
++		if(stabilization==1){
++			element->ElementSizes(&hx,&hy,&hz);
++			vel=sqrt(vx*vx + vy*vy + vz*vz)+1.e-14;
++			h=sqrt( pow(hx*vx/vel,2) + pow(hy*vy/vel,2) + pow(hz*vz/vel,2));
++			K[0][0]=h/(2.*vel)*fabs(vx*vx);  K[0][1]=h/(2.*vel)*fabs(vx*vy); K[0][2]=h/(2.*vel)*fabs(vx*vz);
++			K[1][0]=h/(2.*vel)*fabs(vy*vx);  K[1][1]=h/(2.*vel)*fabs(vy*vy); K[1][2]=h/(2.*vel)*fabs(vy*vz);
++			K[2][0]=h/(2.*vel)*fabs(vz*vx);  K[2][1]=h/(2.*vel)*fabs(vz*vy); K[2][2]=h/(2.*vel)*fabs(vz*vz);
++			for(int i=0;i<3;i++) for(int j=0;j<3;j++) K[i][j] = D_scalar*K[i][j];
++
++			GetBAdvecprime(Bprime,element,xyz_list,gauss); 
++
++			TripleMultiply(Bprime,3,numnodes,1,
++						&K[0][0],3,3,0,
++						Bprime,3,numnodes,0,
++						&Ke->values[0],1);
++		}
++		else if(stabilization==2){
++			element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++			tau_parameter=element->StabilizationParameter(u-um,v-vm,w-wm,diameter,kappa);
++			for(int i=0;i<numnodes;i++){
++				for(int j=0;j<numnodes;j++){
++					Ke->values[i*numnodes+j]+=tau_parameter*D_scalar*
++					  ((u-um)*dbasis[0*3+i]+(v-vm)*dbasis[1*3+i]+(w-wm)*dbasis[2*3+i])*((u-um)*dbasis[0*3+j]+(v-vm)*dbasis[1*3+j]+(w-wm)*dbasis[2*3+j]);
++				}
++			}
++			if(dt!=0.){
++				for(int i=0;i<numnodes;i++){
++					for(int j=0;j<numnodes;j++){
++						Ke->values[i*numnodes+j]+=tau_parameter*D_scalar*basis[j]*((u-um)*dbasis[0*3+i]+(v-vm)*dbasis[1*3+i]+(w-wm)*dbasis[2*3+i]);
++					}
++				}
++			}
++		}
++	}
++
++	/*Clean up and return*/
++	delete gauss;
++	return Ke;
++}/*}}}*/
++ElementMatrix* ThermalAnalysis::CreateKMatrixShelf(Element* element){/*{{{*/
++
++	/*Initialize Element matrix and return if necessary*/
++	if(!element->IsOnBed() || !element->IsFloating()) return NULL;
++
++	IssmDouble  dt,Jdet,D;
++	IssmDouble *xyz_list_base = NULL;
++
++	/*Get basal element*/
++	if(!element->IsOnBed() || !element->IsFloating()) return NULL;
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize vectors*/
++	ElementMatrix* Ke    = element->NewElementMatrix();
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinatesBase(&xyz_list_base);
++	element->FindParam(&dt,TimesteppingTimeStepEnum);
++	IssmDouble  gravity             = element->GetMaterialParameter(ConstantsGEnum);
++	IssmDouble  rho_water           = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble  rho_ice             = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	IssmDouble  heatcapacity        = element->GetMaterialParameter(MaterialsHeatcapacityEnum);
++	IssmDouble  mixed_layer_capacity= element->GetMaterialParameter(MaterialsMixedLayerCapacityEnum);
++	IssmDouble  thermal_exchange_vel= element->GetMaterialParameter(MaterialsThermalExchangeVelocityEnum);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGaussBase(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
++		element->NodalFunctions(basis,gauss);
++
++		D=gauss->weight*Jdet*rho_water*mixed_layer_capacity*thermal_exchange_vel/(heatcapacity*rho_ice);
++		if(reCast<bool,IssmDouble>(dt)) D=dt*D;
++		TripleMultiply(basis,numnodes,1,0,
++					&D,1,1,0,
++					basis,1,numnodes,0,
++					&Ke->values[0],1);
++
++	}
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(xyz_list_base);
++	return Ke;
++}/*}}}*/
+ ElementVector* ThermalAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+ 	/*compute all load vectors for this element*/
+@@ -262,6 +445,93 @@
+ void ThermalAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,TemperatureEnum);
+ }/*}}}*/
++void ThermalAnalysis::GetBConduct(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF1. 
++	 * For node i, Bi' can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi_conduct=[ dh/dx ]
++	 *                  [ dh/dy ]
++	 *                  [ dh/dz ]
++	 * where h is the interpolation function for node i.
++	 *
++	 * We assume B has been allocated already, of size: 3x(NDOF1*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* dbasis=xNew<IssmDouble>(3*numnodes);
++	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Build B: */
++	for(int i=0;i<numnodes;i++){
++		B[numnodes*0+i] = dbasis[0*numnodes+i];
++		B[numnodes*1+i] = dbasis[1*numnodes+i];
++		B[numnodes*2+i] = dbasis[2*numnodes+i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(dbasis);
++}/*}}}*/
++void ThermalAnalysis::GetBAdvec(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF1. 
++	 * For node i, Bi' can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi_advec =[ h ]
++	 *                 [ h ]
++	 *                 [ h ]
++	 * where h is the interpolation function for node i.
++	 *
++	 * We assume B has been allocated already, of size: 3x(NDOF1*NUMNODESP1)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions*/
++	IssmDouble* basis=xNew<IssmDouble>(numnodes);
++	element->NodalFunctions(basis,gauss);
++
++	/*Build B: */
++	for(int i=0;i<numnodes;i++){
++		B[numnodes*0+i] = basis[i];
++		B[numnodes*1+i] = basis[i];
++		B[numnodes*2+i] = basis[i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(basis);
++}/*}}}*/
++void ThermalAnalysis::GetBAdvecprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF1. 
++	 * For node i, Bi' can be expressed in the actual coordinate system
++	 * by: 
++	 *       Biprime_advec=[ dh/dx ]
++	 *                     [ dh/dy ]
++	 *                     [ dh/dz ]
++	 * where h is the interpolation function for node i.
++	 *
++	 * We assume B has been allocated already, of size: 3x(NDOF1*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* dbasis=xNew<IssmDouble>(3*numnodes);
++	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Build B: */
++	for(int i=0;i<numnodes;i++){
++		B[numnodes*0+i] = dbasis[0*numnodes+i];
++		B[numnodes*1+i] = dbasis[1*numnodes+i];
++		B[numnodes*2+i] = dbasis[2*numnodes+i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(dbasis);
++}/*}}}*/
+ void ThermalAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 
+ 	bool        converged;
+Index: ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 16839)
++++ ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 16840)
+@@ -72,7 +72,48 @@
+ 
+ /*Finite Element Analysis*/
+ ElementMatrix* MeltingAnalysis::CreateKMatrix(Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	/*Get basal element*/
++	if(!element->IsOnBed()) return NULL;
++	Element* basalelement = element->SpawnBasalElement();
++
++	/*Intermediaries */
++	IssmDouble  D,Jdet;
++	IssmDouble *xyz_list  = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = basalelement->GetNumberOfNodes();
++
++	/*Initialize Element vector*/
++	ElementMatrix* Ke    = basalelement->NewElementMatrix(NoneApproximationEnum);
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	basalelement->GetVerticesCoordinates(&xyz_list);
++	IssmDouble latentheat   = element->GetMaterialParameter(MaterialsLatentheatEnum);
++	IssmDouble heatcapacity = element->GetMaterialParameter(MaterialsHeatcapacityEnum);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=basalelement->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		basalelement->NodalFunctions(basis,gauss);
++		D=latentheat/heatcapacity*gauss->weight*Jdet;
++
++		TripleMultiply(basis,1,numnodes,1,
++					&D,1,1,0,
++					basis,1,numnodes,0,
++					&Ke->values[0],1);
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	basalelement->DeleteMaterials(); delete basalelement;
++	return Ke;
+ }/*}}}*/
+ ElementVector* MeltingAnalysis::CreatePVector(Element* element){/*{{{*/
+ 	return NULL;
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16839)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16840)
+@@ -48,6 +48,7 @@
+ 		virtual ElementVector* CreatePVector(void)=0;
+ 		virtual void   CreateJacobianMatrix(Matrix<IssmDouble>* Jff)=0;
+ 		virtual void   DeleteMaterials(void)=0;
++		virtual void   ElementSizes(IssmDouble* phx,IssmDouble* phy,IssmDouble* phz)=0;
+ 		virtual void   EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure)=0;
+ 		virtual IssmDouble EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure)=0;
+ 		virtual IssmDouble EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16839)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16840)
+@@ -78,6 +78,7 @@
+ 		void        CreateJacobianMatrix(Matrix<IssmDouble>* Jff);
+ 		void        DeleteMaterials(void);
+ 		void        Delta18oParameterization(void);
++		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){_error_("not implemented yet");};
+ 		void        EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented yet");};
+ 		void        FindParam(int* pvalue,int paramenum);
+ 		void        FindParam(IssmDouble* pvalue,int paramenum);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16839)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16840)
+@@ -1209,8 +1209,8 @@
+ 	return this->element_type;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetElementSizes{{{*/
+-void Penta::GetElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){
++/*FUNCTION Penta::ElementSizes{{{*/
++void Penta::ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){
+ 
+ 	IssmDouble xyz_list[NUMVERTICES][3];
+ 	IssmDouble xmin,ymin,zmin;
+@@ -3980,7 +3980,7 @@
+ 		/*Artificial diffusivity*/
+ 		if(stabilization==1){
+ 			/*Build K: */
+-			GetElementSizes(&hx,&hy,&hz);
++			ElementSizes(&hx,&hy,&hz);
+ 			vel=sqrt(vx*vx + vy*vy + vz*vz)+1.e-14;
+ 			h=sqrt( pow(hx*vx/vel,2) + pow(hy*vy/vel,2) + pow(hz*vz/vel,2));
+ 
+@@ -4209,7 +4209,7 @@
+ 		/*Artifficial diffusivity*/
+ 		if(stabilization==1){
+ 			/*Build K: */
+-			GetElementSizes(&hx,&hy,&hz);
++			ElementSizes(&hx,&hy,&hz);
+ 			vel=sqrt(vx*vx + vy*vy + vz*vz)+1.e-14;
+ 			h=sqrt( pow(hx*vx/vel,2) + pow(hy*vy/vel,2) + pow(hz*vz/vel,2));
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16839)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16840)
+@@ -74,6 +74,7 @@
+ 		void   ComputeStressTensor();
+ 		void   Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
+ 		void   DeleteMaterials(void){_error_("not implemented yet");};
++		void   ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz);
+ 		void   FindParam(int* pvalue,int paramenum);
+ 		void   FindParam(IssmDouble* pvalue,int paramenum);
+ 		int    FiniteElement(void);
+@@ -220,7 +221,6 @@
+ 		void           GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating);
+ 		IssmDouble     GetGroundedPortion(IssmDouble* xyz_list);
+ 		int            GetElementType(void);
+-		void           GetElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz);
+ 		Input*         GetInput(int inputenum);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16839)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16840)
+@@ -83,6 +83,7 @@
+ 		ElementVector* CreatePVectorL2Projection(void);
+ 		void        CreateJacobianMatrix(Matrix<IssmDouble>* Jff){_error_("not implemented yet");};
+ 		void        Delta18oParameterization(void){_error_("not implemented yet");};
++		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){_error_("not implemented yet");};
+ 		void        EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented yet");};
+ 		IssmDouble  EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented");};
+ 		IssmDouble  EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure){_error_("not implemented");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16840-16841.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16840-16841.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16840-16841.diff	(revision 17802)
@@ -0,0 +1,23 @@
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16840)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16841)
+@@ -169,14 +169,14 @@
+ 		gauss->GaussPoint(ig);
+ 
+ 		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+-		D_scalar=gauss->weight*Jdet*kappa;
++		D_scalar=gauss->weight*Jdet;
+ 		if(dt!=0.) D_scalar=D_scalar*dt;
+ 
+ 		/*Conduction: */
+ 		GetBConduct(B,element,xyz_list,gauss); 
+-		D[0][0]=D_scalar;
+-		D[1][1]=D_scalar;
+-		D[2][2]=D_scalar;
++		D[0][0]=D_scalar*kappa;
++		D[1][1]=D_scalar*kappa;
++		D[2][2]=D_scalar*kappa;
+ 		TripleMultiply(B,3,numnodes,1,
+ 					&D[0][0],3,3,0,
+ 					B,3,numnodes,0,
Index: issm/oecreview/Archive/16554-17801/ISSM-16841-16842.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16841-16842.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16841-16842.diff	(revision 17802)
@@ -0,0 +1,19 @@
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16841)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16842)
+@@ -198,12 +198,13 @@
+ 
+ 		/*Transient: */
+ 		if(dt!=0.){
++			D_scalar=gauss->weight*Jdet;
+ 			element->NodalFunctions(basis,gauss);
+-
+ 			TripleMultiply(basis,numnodes,1,0,
+ 						&D_scalar,1,1,0,
+ 						basis,1,numnodes,0,
+ 						&Ke->values[0],1);
++			D_scalar=D_scalar*dt;
+ 		}
+ 
+ 		/*Artifficial diffusivity*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16842-16843.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16842-16843.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16842-16843.diff	(revision 17802)
@@ -0,0 +1,278 @@
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 16842)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 16843)
+@@ -114,8 +114,192 @@
+ 
+ /*Finite Element Analysis*/
+ ElementMatrix* BalancethicknessAnalysis::CreateKMatrix(Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	if(!element->IsOnBed()) return NULL;
++	Element* basalelement = element->SpawnBasalElement();
++
++	int meshtype;
++	element->FindParam(&meshtype,MeshTypeEnum);
++
++	switch(element->FiniteElement()){
++		case P1Enum: case P2Enum:
++			return CreateKMatrixCG(basalelement);
++		case P1DGEnum:
++			return CreateKMatrixDG(basalelement);
++		default:
++			_error_("Element type " << EnumToStringx(element->FiniteElement()) << " not supported yet");
++	}
+ }/*}}}*/
++ElementMatrix* BalancethicknessAnalysis::CreateKMatrixCG(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	int        stabilization;
++	int        meshtype;
++	IssmDouble Jdet,D_scalar,h;
++	IssmDouble vel,vx,vy,dvxdx,dvydy;
++	IssmDouble dvx[2],dvy[2];
++	IssmDouble* xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementMatrix* Ke     = element->NewElementMatrix();
++	IssmDouble*    B      = xNew<IssmDouble>(2*numnodes);
++	IssmDouble*    Bprime = xNew<IssmDouble>(2*numnodes);
++	IssmDouble     D[2][2];
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	element->FindParam(&meshtype,MeshTypeEnum);
++	element->FindParam(&stabilization,BalancethicknessStabilizationEnum);
++	Input* vxaverage_input=NULL;
++	Input* vyaverage_input=NULL;
++	if(meshtype==Mesh2DhorizontalEnum){
++		vxaverage_input=element->GetInput(VxEnum); _assert_(vxaverage_input);
++		vyaverage_input=element->GetInput(VyEnum); _assert_(vyaverage_input);
++	}
++	else{
++		vxaverage_input=element->GetInput(VxAverageEnum); _assert_(vxaverage_input);
++		vyaverage_input=element->GetInput(VyAverageEnum); _assert_(vyaverage_input);
++	}
++	h = element->CharacteristicLength();
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		GetB(B,element,xyz_list,gauss);
++		GetBprime(Bprime,element,xyz_list,gauss);
++
++		vxaverage_input->GetInputValue(&vx,gauss);
++		vyaverage_input->GetInputValue(&vy,gauss);
++		vxaverage_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
++		vyaverage_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
++		dvxdx=dvx[0];
++		dvydy=dvy[1];
++		D_scalar=gauss->weight*Jdet;
++
++		D[0][0]=D_scalar*dvxdx;
++		D[0][1]=0.;
++		D[1][0]=0.;
++		D[1][1]=D_scalar*dvydy;
++		TripleMultiply(B,2,numnodes,1,
++					&D[0][0],2,2,0,
++					B,2,numnodes,0,
++					&Ke->values[0],1);
++
++		D[0][0]=D_scalar*vx;
++		D[1][1]=D_scalar*vy;
++		TripleMultiply(B,2,numnodes,1,
++					&D[0][0],2,2,0,
++					Bprime,2,numnodes,0,
++					&Ke->values[0],1);
++
++		if(stabilization==1){
++			/*Streamline upwinding*/
++			vel=sqrt(vx*vx+vy*vy);
++			D[0][0]=h/(2*vel)*vx*vx;
++			D[1][0]=h/(2*vel)*vy*vx;
++			D[0][1]=h/(2*vel)*vx*vy;
++			D[1][1]=h/(2*vel)*vy*vy;
++		}
++		else if(stabilization==2){
++			/*SSA*/
++			vxaverage_input->GetInputAverage(&vx);
++			vyaverage_input->GetInputAverage(&vy);
++			D[0][0]=h/2.0*fabs(vx);
++			D[0][1]=0.;
++			D[1][0]=0.;
++			D[1][1]=h/2.0*fabs(vy);
++		}
++		if(stabilization==1 || stabilization==2){
++			D[0][0]=D_scalar*D[0][0];
++			D[1][0]=D_scalar*D[1][0];
++			D[0][1]=D_scalar*D[0][1];
++			D[1][1]=D_scalar*D[1][1];
++			TripleMultiply(Bprime,2,numnodes,1,
++						&D[0][0],2,2,0,
++						Bprime,2,numnodes,0,
++						&Ke->values[0],1);
++		}
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(B);
++	xDelete<IssmDouble>(Bprime);
++	delete gauss;
++	return Ke;
++}/*}}}*/
++ElementMatrix* BalancethicknessAnalysis::CreateKMatrixDG(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	int        meshtype;
++	IssmDouble Jdet,D_scalar,vx,vy,dvxdx,dvydy,vel;
++	IssmDouble dvx[2],dvy[2];
++	IssmDouble* xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementMatrix* Ke     = element->NewElementMatrix();
++	IssmDouble*    B      = xNew<IssmDouble>(2*numnodes);
++	IssmDouble*    Bprime = xNew<IssmDouble>(2*numnodes);
++	IssmDouble     D[2][2];
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	element->FindParam(&meshtype,MeshTypeEnum);
++	Input* vxaverage_input=NULL;
++	Input* vyaverage_input=NULL;
++	if(meshtype==Mesh2DhorizontalEnum){
++		vxaverage_input=element->GetInput(VxEnum); _assert_(vxaverage_input);
++		vyaverage_input=element->GetInput(VyEnum); _assert_(vyaverage_input);
++	}
++	else{
++		vxaverage_input=element->GetInput(VxAverageEnum); _assert_(vxaverage_input);
++		vyaverage_input=element->GetInput(VyAverageEnum); _assert_(vyaverage_input);
++	}
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		vxaverage_input->GetInputValue(&vx,gauss);
++		vyaverage_input->GetInputValue(&vy,gauss);
++		vxaverage_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
++		vyaverage_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
++		D_scalar=gauss->weight*Jdet;
++
++		/*WARNING: B and Bprime are inverted compared to CG*/
++		GetB(Bprime,element,xyz_list,gauss);
++		GetBprime(B,element,xyz_list,gauss);
++
++		D_scalar = - gauss->weight*Jdet;
++		D[0][0]  = D_scalar*vx;
++		D[0][1]  = 0.;
++		D[1][0]  = 0.;
++		D[1][1]  = D_scalar*vy;
++		TripleMultiply(B,2,numnodes,1,
++					&D[0][0],2,2,0,
++					Bprime,2,numnodes,0,
++					&Ke->values[0],1);
++
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(B);
++	xDelete<IssmDouble>(Bprime);
++	delete gauss;
++	return Ke;
++}/*}}}*/
+ ElementVector* BalancethicknessAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+ 	if(!element->IsOnBed()) return NULL;
+@@ -213,6 +397,61 @@
+ 	delete gauss;
+ 	return pe;
+ }/*}}}*/
++void BalancethicknessAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
++	 * For node i, Bi can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi=[ N ]
++	 *          [ N ]
++	 * where N is the finiteelement function for node i.
++	 *
++	 * We assume B_prog has been allocated already, of size: 2x(NDOF1*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions*/
++	IssmDouble* basis=xNew<IssmDouble>(numnodes);
++	element->NodalFunctions(basis,gauss);
++
++	/*Build B: */
++	for(int i=0;i<numnodes;i++){
++		B[numnodes*0+i] = basis[i];
++		B[numnodes*1+i] = basis[i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(basis);
++}/*}}}*/
++void BalancethicknessAnalysis::GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 
++	 * For node i, Bi' can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi_prime=[ dN/dx ]
++	 *                [ dN/dy ]
++	 * where N is the finiteelement function for node i.
++	 *
++	 * We assume B' has been allocated already, of size: 3x(NDOF2*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Build B': */
++	for(int i=0;i<numnodes;i++){
++		Bprime[numnodes*0+i] = dbasis[0*numnodes+i];
++		Bprime[numnodes*1+i] = dbasis[1*numnodes+i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(dbasis);
++
++}/*}}}*/
+ void BalancethicknessAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h	(revision 16842)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h	(revision 16843)
+@@ -21,9 +21,13 @@
+ 
+ 		/*Finite element Analysis*/
+ 		ElementMatrix* CreateKMatrix(Element* element);
++		ElementMatrix* CreateKMatrixCG(Element* element);
++		ElementMatrix* CreateKMatrixDG(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+ 		ElementVector* CreatePVectorCG(Element* element);
+ 		ElementVector* CreatePVectorDG(Element* element);
++		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
Index: issm/oecreview/Archive/16554-17801/ISSM-16843-16844.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16843-16844.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16843-16844.diff	(revision 17802)
@@ -0,0 +1,219 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16843)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16844)
+@@ -1113,7 +1113,6 @@
+ 	if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
+ 
+ 	/*Intermediaries*/
+-	IssmDouble  rho_ice,rho_water,gravity;
+ 	IssmDouble  Jdet,thickness,bed,water_pressure,ice_pressure;
+ 	IssmDouble  surface_under_water,base_under_water,pressure;
+ 	IssmDouble *xyz_list = NULL;
+@@ -1128,11 +1127,11 @@
+ 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	Input* thickness_input=element->GetInput(ThicknessEnum); _assert_(thickness_input);
+-	Input* bed_input      =element->GetInput(BedEnum);       _assert_(bed_input);
+-	rho_water = element->GetMaterialParameter(MaterialsRhoWaterEnum);
+-	rho_ice   = element->GetMaterialParameter(MaterialsRhoIceEnum);
+-	gravity   = element->GetMaterialParameter(ConstantsGEnum);
++	Input* thickness_input = element->GetInput(ThicknessEnum); _assert_(thickness_input);
++	Input* bed_input       = element->GetInput(BedEnum);       _assert_(bed_input);
++	IssmDouble rho_water   = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble rho_ice     = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	IssmDouble gravity     = element->GetMaterialParameter(ConstantsGEnum);
+ 	element->GetVerticesCoordinates(&xyz_list);
+ 	element->ZeroLevelsetCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
+ 	element->NormalSection(&normal[0],xyz_list_front);
+@@ -1573,8 +1572,7 @@
+ 	if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
+ 
+ 	/*Intermediaries*/
+-	IssmDouble  rho_ice,rho_water,gravity;
+-	IssmDouble  Jdet,surface,z_g,water_pressure,ice_pressure;
++	IssmDouble  Jdet,surface,z,water_pressure,ice_pressure;
+ 	IssmDouble  surface_under_water,base_under_water,pressure;
+ 	IssmDouble* xyz_list       = NULL;
+ 	IssmDouble* xyz_list_front = NULL;
+@@ -1582,24 +1580,25 @@
+ 	Gauss*      gauss = NULL;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = element->GetNumberOfNodes();
++	int numnodes    = element->GetNumberOfNodes();
++	int numvertices = element->GetNumberOfVertices();
+ 
+ 	/*Initialize Element vector and other vectors*/
+ 	ElementVector* pe    = element->NewElementVector(HOApproximationEnum);
+ 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	Input* surface_input=element->GetInput(SurfaceEnum); _assert_(surface_input);
+-	rho_water = element->GetMaterialParameter(MaterialsRhoWaterEnum);
+-	rho_ice   = element->GetMaterialParameter(MaterialsRhoIceEnum);
+-	gravity   = element->GetMaterialParameter(ConstantsGEnum);
++	Input* surface_input = element->GetInput(SurfaceEnum); _assert_(surface_input);
++	IssmDouble rho_water = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble rho_ice   = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	IssmDouble gravity   = element->GetMaterialParameter(ConstantsGEnum);
+ 	element->GetVerticesCoordinates(&xyz_list);
+ 	element->ZeroLevelsetCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
+ 	element->NormalSection(&normal[0],xyz_list_front);
+ 
+ 	/*Initialize gauss points*/
+-	IssmDouble zmax=xyz_list[0*3+2]; for(int i=1;i<6;i++) if(xyz_list[i*3+2]>zmax) zmax=xyz_list[i*3+2];
+-	IssmDouble zmin=xyz_list[0*3+2]; for(int i=1;i<6;i++) if(xyz_list[i*3+2]<zmin) zmin=xyz_list[i*3+2];
++	IssmDouble zmax=xyz_list[0*3+2]; for(int i=1;i<numvertices;i++) if(xyz_list[i*3+2]>zmax) zmax=xyz_list[i*3+2];
++	IssmDouble zmin=xyz_list[0*3+2]; for(int i=1;i<numvertices;i++) if(xyz_list[i*3+2]<zmin) zmin=xyz_list[i*3+2];
+ 	if(zmax>0 && zmin<0) gauss=element->NewGauss(xyz_list,xyz_list_front,3,10);//refined in vertical because of the sea level discontinuity
+ 	else                 gauss=element->NewGauss(xyz_list,xyz_list_front,3,3);
+ 
+@@ -1608,12 +1607,12 @@
+ 
+ 		gauss->GaussPoint(ig);
+ 		surface_input->GetInputValue(&surface,gauss);
+-		z_g=element->GetZcoord(gauss);
++		z=element->GetZcoord(gauss);
+ 		element->NodalFunctions(basis,gauss);
+ 		element->JacobianDeterminantSurface(&Jdet,xyz_list_front,gauss);
+ 
+-		water_pressure = rho_water*gravity*min(0.,z_g);//0 if the gaussian point is above water level
+-		ice_pressure   = rho_ice*gravity*(surface-z_g);
++		water_pressure = rho_water*gravity*min(0.,z);//0 if the gaussian point is above water level
++		ice_pressure   = rho_ice*gravity*(surface-z);
+ 		pressure       = ice_pressure + water_pressure;
+ 
+ 		for (int i=0;i<numnodes;i++){
+@@ -1997,7 +1996,7 @@
+ 		element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
+ 		element->NodalFunctionsVelocity(vbasis,gauss);
+ 
+-		element->NormalSection(&normal[0],xyz_list_base);
++		element->NormalBase(&normal[0],xyz_list_base);
+ 		_assert_(normal[dim-1]<0.);
+ 		bed_input->GetInputValue(&bed, gauss);
+ 		water_pressure=gravity*rho_water*bed;
+@@ -2023,7 +2022,84 @@
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorFSFront(Element* element){/*{{{*/
+ 
+-	return NULL;
++	/*If no front, return NULL*/
++	if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
++
++	/*Intermediaries*/
++	int         i,meshtype,dim;
++	IssmDouble  Jdet,pressure,surface,z;
++	IssmDouble	normal[3];
++	IssmDouble *xyz_list       = NULL;
++	IssmDouble *xyz_list_front = NULL;
++	Gauss      *gauss          = NULL;
++
++	/*Get basal element*/
++	if(!element->IsOnBed() || !element->IsFloating()) return NULL;
++
++	/*Get problem dimension*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; break;
++		case Mesh3DEnum:         dim = 3; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int vnumnodes   = element->GetNumberOfNodesVelocity();
++	int pnumnodes   = element->GetNumberOfNodesPressure();
++	int numvertices = element->GetNumberOfVertices();
++
++	/*Prepare coordinate system list*/
++	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
++	if(dim==2) for(i=0;i<vnumnodes;i++) cs_list[i] = XYEnum;
++	else       for(i=0;i<vnumnodes;i++) cs_list[i] = XYZEnum;
++	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
++
++	/*Initialize vectors*/
++	ElementVector* pe     = element->NewElementVector(FSvelocityEnum);
++	IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	element->ZeroLevelsetCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
++	element->NormalSection(&normal[0],xyz_list_front);
++	Input* surface_input  = element->GetInput(SurfaceEnum); _assert_(surface_input);
++	IssmDouble  rho_water = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble  gravity   = element->GetMaterialParameter(ConstantsGEnum);
++
++	/*Initialize gauss points*/
++	IssmDouble zmax=xyz_list[0*3+2]; for(int i=1;i<numvertices;i++) if(xyz_list[i*3+2]>zmax) zmax=xyz_list[i*3+2];
++	IssmDouble zmin=xyz_list[0*3+2]; for(int i=1;i<numvertices;i++) if(xyz_list[i*3+2]<zmin) zmin=xyz_list[i*3+2];
++	if(zmax>0 && zmin<0) gauss=element->NewGauss(xyz_list,xyz_list_front,3,30);//refined in vertical because of the sea level discontinuity
++	else                 gauss=element->NewGauss(xyz_list,xyz_list_front,3,3);
++
++	/* Start  looping on the number of gaussian points: */
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminantSurface(&Jdet,xyz_list_front,gauss);
++		element->NodalFunctionsVelocity(vbasis,gauss);
++		surface_input->GetInputValue(&surface,gauss);
++		z=element->GetZcoord(gauss);
++		pressure = rho_water*gravity*min(0.,z);//0 if the gaussian point is above water level
++
++		for (int i=0;i<vnumnodes;i++){
++			pe->values[dim*i+0]+= pressure*Jdet*gauss->weight*normal[0]*vbasis[i];
++			pe->values[dim*i+1]+= pressure*Jdet*gauss->weight*normal[1]*vbasis[i];
++			if(dim==3) pe->values[dim*i+2]+= pressure*Jdet*gauss->weight*normal[2]*vbasis[i];
++		}
++	}
++
++	/*Transform coordinate system*/
++	element->TransformLoadVectorCoord(pe,cs_list);
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<int>(cs_list);
++	xDelete<IssmDouble>(vbasis);
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(xyz_list_front);
++	return pe;
+ }/*}}}*/
+ void StressbalanceAnalysis::GetBFS(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*Compute B  matrix. B=[Bv1 Bv2 ... Bp1 Bp2 ...] where Bvi is of size 3*NDOF3. 
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16843)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16844)
+@@ -64,6 +64,7 @@
+ 		virtual void   NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss)=0;
+ 		virtual void   NormalSection(IssmDouble* normal,IssmDouble* xyz_list)=0;
+ 		virtual void   NormalTop(IssmDouble* normal,IssmDouble* xyz_list)=0;
++		virtual void   NormalBase(IssmDouble* normal,IssmDouble* xyz_list)=0;
+ 		virtual IssmDouble PureIceEnthalpy(IssmDouble pressure)=0;
+ 		virtual void   TransformLoadVectorCoord(ElementVector* pe,int transformenum)=0;
+ 		virtual void   TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16843)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16844)
+@@ -260,6 +260,7 @@
+ 		IssmDouble     GetZcoord(Gauss* gauss){_error_("not implemented");};
+ 		void           NormalSection(IssmDouble* normal,IssmDouble* xyz_list);
+ 		void           NormalTop(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
++		void           NormalBase(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		IssmDouble     GetMaterialParameter(int enum_in);
+ 		Input*         GetInput(int inputenum);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16843)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16844)
+@@ -126,6 +126,7 @@
+ 		bool        NoIceInElement(){_error_("not implemented yet");};
+ 		void        NormalSection(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		void        NormalTop(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
++		void        NormalBase(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		int         NumberofNodesVelocity(void){_error_("not implemented yet");};
+ 		int         NumberofNodesPressure(void){_error_("not implemented yet");};
+ 	   Element*    SpawnBasalElement(void){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16844-16845.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16844-16845.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16844-16845.diff	(revision 17802)
@@ -0,0 +1,15 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16844)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16845)
+@@ -2033,8 +2033,8 @@
+ 	IssmDouble *xyz_list_front = NULL;
+ 	Gauss      *gauss          = NULL;
+ 
+-	/*Get basal element*/
+-	if(!element->IsOnBed() || !element->IsFloating()) return NULL;
++	/*Make sure current element is floating*/
++	if(!element->IsFloating()) return NULL;
+ 
+ 	/*Get problem dimension*/
+ 	element->FindParam(&meshtype,MeshTypeEnum);
Index: issm/oecreview/Archive/16554-17801/ISSM-16845-16846.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16845-16846.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16845-16846.diff	(revision 17802)
@@ -0,0 +1,30 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16845)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16846)
+@@ -6764,8 +6764,8 @@
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	this->parameters->FindParam(&input_enum,InputToL2ProjectEnum);
+ 	switch(input_enum){
+-		case EplHeadSlopeXEnum: input2 = inputs->GetInput(SurfaceEnum); _assert_(input2); break;
+-		case EplHeadSlopeYEnum: input2 = inputs->GetInput(SurfaceEnum); _assert_(input2); break;
++		case EplHeadSlopeXEnum: input2 = inputs->GetInput(EplHeadEnum); _assert_(input2); break;
++		case EplHeadSlopeYEnum: input2 = inputs->GetInput(EplHeadEnum); _assert_(input2); break;
+ 	default: input = inputs->GetInput(input_enum);
+ 	}
+ 
+@@ -7099,11 +7099,11 @@
+ 					/*Compute first the effective pressure in the EPL*/
+ 					EPL_N=gravity*((rho_ice*ice_thickness[i])-(rho_water*(eplhead[i]-bed[i])));
+ 					if(EPL_N<0.0)EPL_N=0.0;
+-					/*Get then the gradient of EPL heads*/
+-					EPLgrad = epl_slopeX[i]+epl_slopeY[i];
++					/*Get then the square of th gradient of EPL heads*/
++					EPLgrad = (epl_slopeX[i]*epl_slopeX[i]+epl_slopeY[i]*epl_slopeY[i]);
+ 					
+ 					/*And proceed to the real thing*/
+-					thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*pow(EPLgrad,2.0)-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
++					thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*EPLgrad-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
+ 			}
+ 		}
+ 		this->inputs->AddInput(new TriaInput(HydrologydcEplThicknessEnum,thickness,P1Enum));
Index: issm/oecreview/Archive/16554-17801/ISSM-16846-16847.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16846-16847.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16846-16847.diff	(revision 17802)
@@ -0,0 +1,716 @@
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 16846)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 16847)
+@@ -29,8 +29,600 @@
+ 	_error_("not implemented yet");
+ }/*}}}*/
+ ElementVector* AdjointHorizAnalysis::CreatePVector(Element* element){/*{{{*/
+-_error_("not implemented yet");
++
++	int approximation;
++	element->GetInputValue(&approximation,ApproximationEnum);
++	switch(approximation){
++		case SSAApproximationEnum: 
++			return CreatePVectorSSA(element);
++		case HOApproximationEnum: 
++			return CreatePVectorHO(element);
++		case FSApproximationEnum: 
++			return CreatePVectorFS(element);
++		case NoneApproximationEnum:
++			return NULL;
++		default:
++			_error_("Approximation "<<EnumToStringx(approximation)<<" not supported");
++	}
+ }/*}}}*/
++ElementVector* AdjointHorizAnalysis::CreatePVectorFS(Element* element){/*{{{*/
++
++	/*Nothing to be done if not on surface*/
++	if(!element->IsOnSurface()) return NULL;
++
++	/*Intermediaries */
++	int        num_responses,i,meshtype,dim;
++	IssmDouble thickness,Jdet,obs_velocity_mag,velocity_mag;
++	IssmDouble vx,vy,vxobs,vyobs,dux,duy,weight;
++	IssmDouble scalex,scaley,scale,S;
++	int        *responses    = NULL;
++	IssmDouble *xyz_list_top = NULL;
++
++	/*Get problem dimension*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; break;
++		case Mesh3DEnum:         dim = 3; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int vnumnodes = element->GetNumberOfNodesVelocity();
++	int pnumnodes = element->GetNumberOfNodesPressure();
++
++	/*Prepare coordinate system list*/
++	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
++	for(i=0;i<vnumnodes;i++) cs_list[i]           = XYZEnum;
++	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
++
++	/*Initialize Element vector and vectors*/
++	ElementVector* pe     = element->NewElementVector(FSApproximationEnum);
++	IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinatesTop(&xyz_list_top);
++	element->FindParam(&num_responses,InversionNumCostFunctionsEnum);
++	element->FindParam(&responses,NULL,InversionCostFunctionsEnum);
++	Input* weights_input = element->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
++	Input* vx_input      = element->GetInput(VxEnum);                                 _assert_(vx_input);
++	Input* vy_input      = element->GetInput(VyEnum);                                 _assert_(vy_input);
++	Input* vxobs_input   = element->GetInput(InversionVxObsEnum);                     _assert_(vxobs_input);
++	Input* vyobs_input   = element->GetInput(InversionVyObsEnum);                     _assert_(vyobs_input);
++	IssmDouble epsvel  = 2.220446049250313e-16;
++	IssmDouble meanvel = 3.170979198376458e-05; /*1000 m/yr*/
++
++	/*Get Surface if required by one response*/
++	for(int resp=0;resp<num_responses;resp++){
++		if(responses[resp]==SurfaceAverageVelMisfitEnum){
++			element->GetInputValue(&S,SurfaceAreaEnum); break;
++		}
++	}
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGaussTop(4);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminantTop(&Jdet,xyz_list_top,gauss);
++		element->NodalFunctionsVelocity(vbasis,gauss);
++
++		vx_input->GetInputValue(&vx,gauss);
++		vy_input->GetInputValue(&vy,gauss);
++		vxobs_input->GetInputValue(&vxobs,gauss);
++		vyobs_input->GetInputValue(&vyobs,gauss);
++
++		/*Loop over all requested responses*/
++		for(int resp=0;resp<num_responses;resp++){
++			weights_input->GetInputValue(&weight,gauss,responses[resp]);
++
++			switch(responses[resp]){
++				case SurfaceAbsVelMisfitEnum:
++					/*
++					 *      1  [           2              2 ]
++					 * J = --- | (u - u   )  +  (v - v   )  |
++					 *      2  [       obs            obs   ]
++					 *
++					 *        dJ
++					 * DU = - -- = (u   - u )
++					 *        du     obs
++					 */
++					for(i=0;i<vnumnodes;i++){
++						dux=vxobs-vx;
++						duy=vyobs-vy;
++						pe->values[i*dim+0]+=dux*weight*Jdet*gauss->weight*vbasis[i]; 
++						pe->values[i*dim+1]+=duy*weight*Jdet*gauss->weight*vbasis[i]; 
++					}
++					break;
++				case SurfaceRelVelMisfitEnum:
++					/*
++					 *      1  [     \bar{v}^2             2   \bar{v}^2              2 ]
++					 * J = --- | -------------  (u - u   ) + -------------  (v - v   )  |
++					 *      2  [  (u   + eps)^2       obs    (v   + eps)^2       obs    ]
++					 *              obs                        obs                      
++					 *
++					 *        dJ     \bar{v}^2
++					 * DU = - -- = ------------- (u   - u )
++					 *        du   (u   + eps)^2    obs
++					 *               obs
++					 */
++					for(i=0;i<vnumnodes;i++){
++						scalex=pow(meanvel/(vxobs+epsvel),2); if(vxobs==0)scalex=0;
++						scaley=pow(meanvel/(vyobs+epsvel),2); if(vyobs==0)scaley=0;
++						dux=scalex*(vxobs-vx);
++						duy=scaley*(vyobs-vy);
++						pe->values[i*dim+0]+=dux*weight*Jdet*gauss->weight*vbasis[i]; 
++						pe->values[i*dim+1]+=duy*weight*Jdet*gauss->weight*vbasis[i]; 
++					}
++					break;
++				case SurfaceLogVelMisfitEnum:
++					/*
++					 *                 [        vel + eps     ] 2
++					 * J = 4 \bar{v}^2 | log ( -----------  ) |  
++					 *                 [       vel   + eps    ]
++					 *                            obs
++					 *
++					 *        dJ                 2 * log(...)
++					 * DU = - -- = - 4 \bar{v}^2 -------------  u
++					 *        du                 vel^2 + eps
++					 *            
++					 */
++					for(i=0;i<vnumnodes;i++){
++						velocity_mag    =sqrt(pow(vx,   2)+pow(vy,   2))+epsvel;
++						obs_velocity_mag=sqrt(pow(vxobs,2)+pow(vyobs,2))+epsvel;
++						scale=-8*pow(meanvel,2)/pow(velocity_mag,2)*log(velocity_mag/obs_velocity_mag);
++						dux=scale*vx;
++						duy=scale*vy;
++						pe->values[i*dim+0]+=dux*weight*Jdet*gauss->weight*vbasis[i]; 
++						pe->values[i*dim+1]+=duy*weight*Jdet*gauss->weight*vbasis[i]; 
++					}
++					break;
++				case SurfaceAverageVelMisfitEnum:
++					/*
++					 *      1                    2              2
++					 * J = ---  sqrt(  (u - u   )  +  (v - v   )  )
++					 *      S                obs            obs
++					 *
++					 *        dJ      1       1 
++					 * DU = - -- = - --- ----------- * 2 (u - u   )
++					 *        du      S  2 sqrt(...)           obs
++					 */
++					for(i=0;i<vnumnodes;i++){
++						scale=1./(S*2*sqrt(pow(vx-vxobs,2)+pow(vy-vyobs,2))+epsvel);
++						dux=scale*(vxobs-vx);
++						duy=scale*(vyobs-vy);
++						pe->values[i*dim+0]+=dux*weight*Jdet*gauss->weight*vbasis[i]; 
++						pe->values[i*dim+1]+=duy*weight*Jdet*gauss->weight*vbasis[i]; 
++					}
++					break;
++				case SurfaceLogVxVyMisfitEnum:
++					/*
++					 *      1            [        |u| + eps     2          |v| + eps     2  ]
++					 * J = --- \bar{v}^2 | log ( -----------  )   +  log ( -----------  )   |  
++					 *      2            [       |u    |+ eps              |v    |+ eps     ]
++					 *                              obs                       obs
++					 *        dJ                              1      u                             1
++					 * DU = - -- = - \bar{v}^2 log(u...) --------- ----  ~ - \bar{v}^2 log(u...) ------
++					 *        du                         |u| + eps  |u|                           u + eps
++					 */
++					for(i=0;i<vnumnodes;i++){
++						dux = - meanvel*meanvel * log((fabs(vx)+epsvel)/(fabs(vxobs)+epsvel)) / (vx+epsvel);
++						duy = - meanvel*meanvel * log((fabs(vy)+epsvel)/(fabs(vyobs)+epsvel)) / (vy+epsvel);
++						pe->values[i*dim+0]+=dux*weight*Jdet*gauss->weight*vbasis[i]; 
++						pe->values[i*dim+1]+=duy*weight*Jdet*gauss->weight*vbasis[i]; 
++					}
++					break;
++				case DragCoefficientAbsGradientEnum:
++					/*Nothing in P vector*/
++					break;
++				case ThicknessAbsGradientEnum:
++					/*Nothing in P vector*/
++					break;
++				case ThicknessAlongGradientEnum:
++					/*Nothing in P vector*/
++					break;
++				case ThicknessAcrossGradientEnum:
++					/*Nothing in P vector*/
++					break;
++				case RheologyBbarAbsGradientEnum:
++					/*Nothing in P vector*/
++					break;
++				default:
++					_error_("response " << EnumToStringx(responses[resp]) << " not supported yet");
++			}
++		}
++	}
++
++	/*Transform coordinate system*/
++	element->TransformLoadVectorCoord(pe,cs_list);
++
++	/*Clean up and return*/
++	xDelete<int>(cs_list);
++	xDelete<IssmDouble>(xyz_list_top);
++	xDelete<IssmDouble>(vbasis);
++	delete gauss;
++	return pe;
++	_error_("S");
++}/*}}}*/
++ElementVector* AdjointHorizAnalysis::CreatePVectorHO(Element* element){/*{{{*/
++
++	/*Nothing to be done if not on surface*/
++	if(!element->IsOnSurface()) return NULL;
++
++	/*Intermediaries */
++	int        num_responses,i;
++	IssmDouble thickness,Jdet,obs_velocity_mag,velocity_mag;
++	IssmDouble vx,vy,vxobs,vyobs,dux,duy,weight;
++	IssmDouble scalex,scaley,scale,S;
++	int        *responses    = NULL;
++	IssmDouble *xyz_list_top = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and vectors*/
++	ElementVector* pe    = element->NewElementVector(HOApproximationEnum);
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinatesTop(&xyz_list_top);
++	element->FindParam(&num_responses,InversionNumCostFunctionsEnum);
++	element->FindParam(&responses,NULL,InversionCostFunctionsEnum);
++	Input* weights_input = element->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
++	Input* vx_input      = element->GetInput(VxEnum);                                 _assert_(vx_input);
++	Input* vy_input      = element->GetInput(VyEnum);                                 _assert_(vy_input);
++	Input* vxobs_input   = element->GetInput(InversionVxObsEnum);                     _assert_(vxobs_input);
++	Input* vyobs_input   = element->GetInput(InversionVyObsEnum);                     _assert_(vyobs_input);
++	IssmDouble epsvel  = 2.220446049250313e-16;
++	IssmDouble meanvel = 3.170979198376458e-05; /*1000 m/yr*/
++
++	/*Get Surface if required by one response*/
++	for(int resp=0;resp<num_responses;resp++){
++		if(responses[resp]==SurfaceAverageVelMisfitEnum){
++			element->GetInputValue(&S,SurfaceAreaEnum); break;
++		}
++	}
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGaussTop(4);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminantTop(&Jdet,xyz_list_top,gauss);
++		element->NodalFunctions(basis, gauss);
++
++		vx_input->GetInputValue(&vx,gauss);
++		vy_input->GetInputValue(&vy,gauss);
++		vxobs_input->GetInputValue(&vxobs,gauss);
++		vyobs_input->GetInputValue(&vyobs,gauss);
++
++		/*Loop over all requested responses*/
++		for(int resp=0;resp<num_responses;resp++){
++			weights_input->GetInputValue(&weight,gauss,responses[resp]);
++
++			switch(responses[resp]){
++				case SurfaceAbsVelMisfitEnum:
++					/*
++					 *      1  [           2              2 ]
++					 * J = --- | (u - u   )  +  (v - v   )  |
++					 *      2  [       obs            obs   ]
++					 *
++					 *        dJ
++					 * DU = - -- = (u   - u )
++					 *        du     obs
++					 */
++					for(i=0;i<numnodes;i++){
++						dux=vxobs-vx;
++						duy=vyobs-vy;
++						pe->values[i*2+0]+=dux*weight*Jdet*gauss->weight*basis[i]; 
++						pe->values[i*2+1]+=duy*weight*Jdet*gauss->weight*basis[i]; 
++					}
++					break;
++				case SurfaceRelVelMisfitEnum:
++					/*
++					 *      1  [     \bar{v}^2             2   \bar{v}^2              2 ]
++					 * J = --- | -------------  (u - u   ) + -------------  (v - v   )  |
++					 *      2  [  (u   + eps)^2       obs    (v   + eps)^2       obs    ]
++					 *              obs                        obs                      
++					 *
++					 *        dJ     \bar{v}^2
++					 * DU = - -- = ------------- (u   - u )
++					 *        du   (u   + eps)^2    obs
++					 *               obs
++					 */
++					for(i=0;i<numnodes;i++){
++						scalex=pow(meanvel/(vxobs+epsvel),2); if(vxobs==0)scalex=0;
++						scaley=pow(meanvel/(vyobs+epsvel),2); if(vyobs==0)scaley=0;
++						dux=scalex*(vxobs-vx);
++						duy=scaley*(vyobs-vy);
++						pe->values[i*2+0]+=dux*weight*Jdet*gauss->weight*basis[i]; 
++						pe->values[i*2+1]+=duy*weight*Jdet*gauss->weight*basis[i]; 
++					}
++					break;
++				case SurfaceLogVelMisfitEnum:
++					/*
++					 *                 [        vel + eps     ] 2
++					 * J = 4 \bar{v}^2 | log ( -----------  ) |  
++					 *                 [       vel   + eps    ]
++					 *                            obs
++					 *
++					 *        dJ                 2 * log(...)
++					 * DU = - -- = - 4 \bar{v}^2 -------------  u
++					 *        du                 vel^2 + eps
++					 *            
++					 */
++					for(i=0;i<numnodes;i++){
++						velocity_mag    =sqrt(pow(vx,   2)+pow(vy,   2))+epsvel;
++						obs_velocity_mag=sqrt(pow(vxobs,2)+pow(vyobs,2))+epsvel;
++						scale=-8*pow(meanvel,2)/pow(velocity_mag,2)*log(velocity_mag/obs_velocity_mag);
++						dux=scale*vx;
++						duy=scale*vy;
++						pe->values[i*2+0]+=dux*weight*Jdet*gauss->weight*basis[i]; 
++						pe->values[i*2+1]+=duy*weight*Jdet*gauss->weight*basis[i]; 
++					}
++					break;
++				case SurfaceAverageVelMisfitEnum:
++					/*
++					 *      1                    2              2
++					 * J = ---  sqrt(  (u - u   )  +  (v - v   )  )
++					 *      S                obs            obs
++					 *
++					 *        dJ      1       1 
++					 * DU = - -- = - --- ----------- * 2 (u - u   )
++					 *        du      S  2 sqrt(...)           obs
++					 */
++					for(i=0;i<numnodes;i++){
++						scale=1./(S*2*sqrt(pow(vx-vxobs,2)+pow(vy-vyobs,2))+epsvel);
++						dux=scale*(vxobs-vx);
++						duy=scale*(vyobs-vy);
++						pe->values[i*2+0]+=dux*weight*Jdet*gauss->weight*basis[i]; 
++						pe->values[i*2+1]+=duy*weight*Jdet*gauss->weight*basis[i]; 
++					}
++					break;
++				case SurfaceLogVxVyMisfitEnum:
++					/*
++					 *      1            [        |u| + eps     2          |v| + eps     2  ]
++					 * J = --- \bar{v}^2 | log ( -----------  )   +  log ( -----------  )   |  
++					 *      2            [       |u    |+ eps              |v    |+ eps     ]
++					 *                              obs                       obs
++					 *        dJ                              1      u                             1
++					 * DU = - -- = - \bar{v}^2 log(u...) --------- ----  ~ - \bar{v}^2 log(u...) ------
++					 *        du                         |u| + eps  |u|                           u + eps
++					 */
++					for(i=0;i<numnodes;i++){
++						dux = - meanvel*meanvel * log((fabs(vx)+epsvel)/(fabs(vxobs)+epsvel)) / (vx+epsvel);
++						duy = - meanvel*meanvel * log((fabs(vy)+epsvel)/(fabs(vyobs)+epsvel)) / (vy+epsvel);
++						pe->values[i*2+0]+=dux*weight*Jdet*gauss->weight*basis[i]; 
++						pe->values[i*2+1]+=duy*weight*Jdet*gauss->weight*basis[i]; 
++					}
++					break;
++				case DragCoefficientAbsGradientEnum:
++					/*Nothing in P vector*/
++					break;
++				case ThicknessAbsGradientEnum:
++					/*Nothing in P vector*/
++					break;
++				case ThicknessAlongGradientEnum:
++					/*Nothing in P vector*/
++					break;
++				case ThicknessAcrossGradientEnum:
++					/*Nothing in P vector*/
++					break;
++				case RheologyBbarAbsGradientEnum:
++					/*Nothing in P vector*/
++					break;
++				default:
++					_error_("response " << EnumToStringx(responses[resp]) << " not supported yet");
++			}
++		}
++	}
++
++	/*Transform coordinate system*/
++	element->TransformLoadVectorCoord(pe,XYEnum);
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list_top);
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	return pe;
++
++}/*}}}*/
++ElementVector* AdjointHorizAnalysis::CreatePVectorSSA(Element* element){/*{{{*/
++
++	/*Intermediaries*/
++	int      meshtype;
++	Element* basalelement;
++
++	/*Get basal element*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Intermediaries */
++	int         num_responses,i;
++	IssmDouble  thickness,Jdet,obs_velocity_mag,velocity_mag;
++	IssmDouble  vx,vy,vxobs,vyobs,dux,duy,weight;
++	IssmDouble scalex,scaley,scale,S;
++	int        *responses = NULL;
++	IssmDouble *xyz_list  = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = basalelement->GetNumberOfNodes();
++
++	/*Initialize Element vector and vectors*/
++	ElementVector* pe    = basalelement->NewElementVector(SSAApproximationEnum);
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	basalelement->GetVerticesCoordinates(&xyz_list);
++	basalelement->FindParam(&num_responses,InversionNumCostFunctionsEnum);
++	basalelement->FindParam(&responses,NULL,InversionCostFunctionsEnum);
++	Input* weights_input = basalelement->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
++	Input* vx_input      = basalelement->GetInput(VxEnum);                                 _assert_(vx_input);
++	Input* vy_input      = basalelement->GetInput(VyEnum);                                 _assert_(vy_input);
++	Input* vxobs_input   = basalelement->GetInput(InversionVxObsEnum);                     _assert_(vxobs_input);
++	Input* vyobs_input   = basalelement->GetInput(InversionVyObsEnum);                     _assert_(vyobs_input);
++	IssmDouble epsvel  = 2.220446049250313e-16;
++	IssmDouble meanvel = 3.170979198376458e-05; /*1000 m/yr*/
++
++	/*Get Surface if required by one response*/
++	for(int resp=0;resp<num_responses;resp++){
++		if(responses[resp]==SurfaceAverageVelMisfitEnum){
++			basalelement->GetInputValue(&S,SurfaceAreaEnum); break;
++		}
++	}
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=basalelement->NewGauss(4);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		basalelement->NodalFunctions(basis, gauss);
++
++		vx_input->GetInputValue(&vx,gauss);
++		vy_input->GetInputValue(&vy,gauss);
++		vxobs_input->GetInputValue(&vxobs,gauss);
++		vyobs_input->GetInputValue(&vyobs,gauss);
++
++		/*Loop over all requested responses*/
++		for(int resp=0;resp<num_responses;resp++){
++			weights_input->GetInputValue(&weight,gauss,responses[resp]);
++
++			switch(responses[resp]){
++				case SurfaceAbsVelMisfitEnum:
++					/*
++					 *      1  [           2              2 ]
++					 * J = --- | (u - u   )  +  (v - v   )  |
++					 *      2  [       obs            obs   ]
++					 *
++					 *        dJ
++					 * DU = - -- = (u   - u )
++					 *        du     obs
++					 */
++					for(i=0;i<numnodes;i++){
++						dux=vxobs-vx;
++						duy=vyobs-vy;
++						pe->values[i*2+0]+=dux*weight*Jdet*gauss->weight*basis[i]; 
++						pe->values[i*2+1]+=duy*weight*Jdet*gauss->weight*basis[i]; 
++					}
++					break;
++				case SurfaceRelVelMisfitEnum:
++					/*
++					 *      1  [     \bar{v}^2             2   \bar{v}^2              2 ]
++					 * J = --- | -------------  (u - u   ) + -------------  (v - v   )  |
++					 *      2  [  (u   + eps)^2       obs    (v   + eps)^2       obs    ]
++					 *              obs                        obs                      
++					 *
++					 *        dJ     \bar{v}^2
++					 * DU = - -- = ------------- (u   - u )
++					 *        du   (u   + eps)^2    obs
++					 *               obs
++					 */
++					for(i=0;i<numnodes;i++){
++						scalex=pow(meanvel/(vxobs+epsvel),2); if(vxobs==0)scalex=0;
++						scaley=pow(meanvel/(vyobs+epsvel),2); if(vyobs==0)scaley=0;
++						dux=scalex*(vxobs-vx);
++						duy=scaley*(vyobs-vy);
++						pe->values[i*2+0]+=dux*weight*Jdet*gauss->weight*basis[i]; 
++						pe->values[i*2+1]+=duy*weight*Jdet*gauss->weight*basis[i]; 
++					}
++					break;
++				case SurfaceLogVelMisfitEnum:
++					/*
++					 *                 [        vel + eps     ] 2
++					 * J = 4 \bar{v}^2 | log ( -----------  ) |  
++					 *                 [       vel   + eps    ]
++					 *                            obs
++					 *
++					 *        dJ                 2 * log(...)
++					 * DU = - -- = - 4 \bar{v}^2 -------------  u
++					 *        du                 vel^2 + eps
++					 *            
++					 */
++					for(i=0;i<numnodes;i++){
++						velocity_mag    =sqrt(pow(vx,   2)+pow(vy,   2))+epsvel;
++						obs_velocity_mag=sqrt(pow(vxobs,2)+pow(vyobs,2))+epsvel;
++						scale=-8*pow(meanvel,2)/pow(velocity_mag,2)*log(velocity_mag/obs_velocity_mag);
++						dux=scale*vx;
++						duy=scale*vy;
++						pe->values[i*2+0]+=dux*weight*Jdet*gauss->weight*basis[i]; 
++						pe->values[i*2+1]+=duy*weight*Jdet*gauss->weight*basis[i]; 
++					}
++					break;
++				case SurfaceAverageVelMisfitEnum:
++					/*
++					 *      1                    2              2
++					 * J = ---  sqrt(  (u - u   )  +  (v - v   )  )
++					 *      S                obs            obs
++					 *
++					 *        dJ      1       1 
++					 * DU = - -- = - --- ----------- * 2 (u - u   )
++					 *        du      S  2 sqrt(...)           obs
++					 */
++					for(i=0;i<numnodes;i++){
++						scale=1./(S*2*sqrt(pow(vx-vxobs,2)+pow(vy-vyobs,2))+epsvel);
++						dux=scale*(vxobs-vx);
++						duy=scale*(vyobs-vy);
++						pe->values[i*2+0]+=dux*weight*Jdet*gauss->weight*basis[i]; 
++						pe->values[i*2+1]+=duy*weight*Jdet*gauss->weight*basis[i]; 
++					}
++					break;
++				case SurfaceLogVxVyMisfitEnum:
++					/*
++					 *      1            [        |u| + eps     2          |v| + eps     2  ]
++					 * J = --- \bar{v}^2 | log ( -----------  )   +  log ( -----------  )   |  
++					 *      2            [       |u    |+ eps              |v    |+ eps     ]
++					 *                              obs                       obs
++					 *        dJ                              1      u                             1
++					 * DU = - -- = - \bar{v}^2 log(u...) --------- ----  ~ - \bar{v}^2 log(u...) ------
++					 *        du                         |u| + eps  |u|                           u + eps
++					 */
++					for(i=0;i<numnodes;i++){
++						dux = - meanvel*meanvel * log((fabs(vx)+epsvel)/(fabs(vxobs)+epsvel)) / (vx+epsvel);
++						duy = - meanvel*meanvel * log((fabs(vy)+epsvel)/(fabs(vyobs)+epsvel)) / (vy+epsvel);
++						pe->values[i*2+0]+=dux*weight*Jdet*gauss->weight*basis[i]; 
++						pe->values[i*2+1]+=duy*weight*Jdet*gauss->weight*basis[i]; 
++					}
++					break;
++				case DragCoefficientAbsGradientEnum:
++					/*Nothing in P vector*/
++					break;
++				case ThicknessAbsGradientEnum:
++					/*Nothing in P vector*/
++					break;
++				case ThicknessAlongGradientEnum:
++					/*Nothing in P vector*/
++					break;
++				case ThicknessAcrossGradientEnum:
++					/*Nothing in P vector*/
++					break;
++				case RheologyBbarAbsGradientEnum:
++					/*Nothing in P vector*/
++					break;
++				default:
++					_error_("response " << EnumToStringx(responses[resp]) << " not supported yet");
++			}
++		}
++	}
++
++	/*Transform coordinate system*/
++	basalelement->TransformLoadVectorCoord(pe,XYEnum);
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	delete gauss;
++	return pe;
++}/*}}}*/
+ void AdjointHorizAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h	(revision 16846)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h	(revision 16847)
+@@ -22,6 +22,9 @@
+ 		/*Finite element Analysis*/
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
++		ElementVector* CreatePVectorSSA(Element* element);
++		ElementVector* CreatePVectorHO(Element* element);
++		ElementVector* CreatePVectorFS(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionHoriz(IssmDouble* solution,Element* element);
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16846)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16847)
+@@ -54,6 +54,7 @@
+ 		virtual IssmDouble EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure)=0;
+ 		virtual void   FindParam(int* pvalue,int paramenum)=0;
+ 		virtual void   FindParam(IssmDouble* pvalue,int paramenum)=0;
++		virtual void   FindParam(int** pvalues,int* psize,int paramenum)=0;
+ 		virtual int    FiniteElement(void)=0;
+ 		virtual IssmDouble GetMaterialParameter(int enum_in)=0;
+ 		virtual IssmDouble MinEdgeLength(IssmDouble* xyz_list)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16846)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16847)
+@@ -849,6 +849,11 @@
+ 	this->parameters->FindParam(pvalue,paramenum);
+ }
+ /*}}}*/
++/*FUNCTION Tria::FindParam(int** pvalues,int* psize,int paramenum){{{*/
++void Tria::FindParam(int** pvalues,int* psize,int paramenum){
++	this->parameters->FindParam(pvalues,psize,paramenum);
++}
++/*}}}*/
+ /*FUNCTION Tria::FiniteElement{{{*/
+ int Tria::FiniteElement(void){
+ 	return this->element_type;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16846)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16847)
+@@ -82,6 +82,7 @@
+ 		void        EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented yet");};
+ 		void        FindParam(int* pvalue,int paramenum);
+ 		void        FindParam(IssmDouble* pvalue,int paramenum);
++		void        FindParam(int** pvalues,int* psize,int paramenum);
+ 		int         FiniteElement(void);
+ 		Element*    GetBasalElement(void){_error_("not implemented yet");};
+ 		void	      GetDofList(int** pdoflist,int approximation_enum,int setenum);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16846)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16847)
+@@ -870,6 +870,11 @@
+ 	this->parameters->FindParam(pvalue,paramenum);
+ }
+ /*}}}*/
++/*FUNCTION Penta::FindParam(int** pvalues,int* psize,int paramenum){{{*/
++void Penta::FindParam(int** pvalues,int* psize,int paramenum){
++	this->parameters->FindParam(pvalues,psize,paramenum);
++}
++/*}}}*/
+ /*FUNCTION Penta::FiniteElement{{{*/
+ int Penta::FiniteElement(void){
+ 	return this->element_type;
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16846)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16847)
+@@ -77,6 +77,7 @@
+ 		void   ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz);
+ 		void   FindParam(int* pvalue,int paramenum);
+ 		void   FindParam(IssmDouble* pvalue,int paramenum);
++		void   FindParam(int** pvalues,int* psize,int paramenum);
+ 		int    FiniteElement(void);
+ 		void   SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters);
+ 		void   SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 16846)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 16847)
+@@ -97,6 +97,11 @@
+ 	this->parameters->FindParam(pvalue,paramenum);
+ }
+ /*}}}*/
++/*FUNCTION Seg::FindParam(int** pvalues,int* psize,int paramenum){{{*/
++void Seg::FindParam(int** pvalues,int* psize,int paramenum){
++	this->parameters->FindParam(pvalues,psize,paramenum);
++}
++/*}}}*/
+ /*FUNCTION Seg::FiniteElement{{{*/
+ int Seg::FiniteElement(void){
+ 	return this->element_type;
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16846)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16847)
+@@ -89,6 +89,7 @@
+ 		IssmDouble  EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure){_error_("not implemented");};
+ 		void        FindParam(int* pvalue,int paramenum);
+ 		void        FindParam(IssmDouble* pvalue,int paramenum);
++		void        FindParam(int** pvalues,int* psize,int paramenum);
+ 		int         FiniteElement(void);
+ 		Element*    GetBasalElement(void){_error_("not implemented yet");};
+ 		void        GetDofList(int** pdoflist,int approximation_enum,int setenum){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16847-16848.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16847-16848.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16847-16848.diff	(revision 17802)
@@ -0,0 +1,353 @@
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h	(revision 16847)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h	(revision 16848)
+@@ -24,5 +24,8 @@
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++
++		/*Intermediaries*/
++		void CreateDamageFInput(Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 16847)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 16848)
+@@ -98,7 +98,63 @@
+ 	_error_("not implemented yet");
+ }/*}}}*/
+ ElementVector* DamageEvolutionAnalysis::CreatePVector(Element* element){/*{{{*/
+-_error_("not implemented yet");
++
++	/*Intermediaries*/
++	int      meshtype;
++	Element* basalelement;
++
++	/*Get basal element*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Intermediaries */
++	IssmDouble  Jdet,dt;
++	IssmDouble  f,damage;
++	IssmDouble* xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementVector* pe    = element->NewElementVector();
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	element->FindParam(&dt,TimesteppingTimeStepEnum);
++	this->CreateDamageFInput(element);
++	Input* damaged_input = element->GetMaterialInput(DamageDbarEnum); _assert_(damaged_input);
++	Input* damagef_input = element->GetMaterialInput(DamageFEnum);    _assert_(damagef_input);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctions(basis,gauss);
++
++		damaged_input->GetInputValue(&damage,gauss);
++		damagef_input->GetInputValue(&f,gauss);
++
++		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*(damage+dt*f)*basis[i];
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	delete gauss;
++	return pe;
+ }/*}}}*/
+ void DamageEvolutionAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+@@ -135,3 +191,62 @@
+ 	xDelete<IssmDouble>(values);
+ 	xDelete<int>(doflist);
+ }/*}}}*/
++
++/*Intermediaries*/
++void DamageEvolutionAnalysis::CreateDamageFInput(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	IssmDouble c1,c2,c3,healing,stress_threshold;
++	IssmDouble s_xx,s_xy,s_yy;
++	IssmDouble J2s,Xis,Psi,PosPsi,NegPsi;
++	IssmDouble damage,sigma_xx,sigma_xy,sigma_yy;
++
++	/*Fetch number of vertices and allocate output*/
++	int numvertices = element->GetNumberOfVertices();
++	IssmDouble* f   = xNew<IssmDouble>(numvertices);
++
++	/*retrieve parameters:*/
++	element->FindParam(&c1,DamageC1Enum);
++	element->FindParam(&c2,DamageC2Enum);
++	element->FindParam(&c3,DamageC3Enum);
++	element->FindParam(&healing,DamageHealingEnum);
++	element->FindParam(&stress_threshold,DamageStressThresholdEnum);
++
++	/*Compute stress tensor: */
++	element->ComputeStressTensor();
++
++	/*retrieve what we need: */
++	Input* sigma_xx_input  = element->GetInput(StressTensorxxEnum);     _assert_(sigma_xx_input);
++	Input* sigma_xy_input  = element->GetInput(StressTensorxyEnum);     _assert_(sigma_xy_input);
++	Input* sigma_yy_input  = element->GetInput(StressTensoryyEnum);     _assert_(sigma_yy_input);
++	Input* damage_input    = element->GetMaterialInput(DamageDbarEnum); _assert_(damage_input);
++
++	/*Damage evolution z mapping: */
++	Gauss* gauss=element->NewGauss();
++	for (int iv=0;iv<numvertices;iv++){
++		gauss->GaussVertex(iv);
++		
++		damage_input->GetInputValue(&damage,gauss);
++		sigma_xx_input->GetInputValue(&sigma_xx,gauss);
++		sigma_xy_input->GetInputValue(&sigma_xy,gauss);
++		sigma_yy_input->GetInputValue(&sigma_yy,gauss);
++
++		s_xx=sigma_xx/(1.-damage);
++		s_xy=sigma_xy/(1.-damage);
++		s_yy=sigma_yy/(1.-damage);
++
++		J2s=1./sqrt(2.)*sqrt(s_xx*s_xx + s_yy*s_yy + s_xy*s_xy);
++		Xis=sqrt(3.0)*J2s;
++		Psi=Xis-stress_threshold;
++		PosPsi=max(Psi,0.);
++		NegPsi=max(-Psi,0.);
++
++		f[iv]= c1*(pow(PosPsi,c2) - healing*pow(NegPsi,c2))*pow((1.-damage),-c3);
++	}
++
++	/*Add input*/
++	element->AddMaterialInput(DamageFEnum,f,P1Enum);
++	
++	/*Clean up and return*/
++	delete gauss;
++}/*}}}*/
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16847)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16848)
+@@ -160,6 +160,7 @@
+ 	MaterialsRheologyLawEnum,
+ 	MaterialsRheologyNEnum,
+ 	DamageDEnum,
++	DamageFEnum,
+ 	QmuDamageDEnum,
+ 	DamageDbarEnum,
+ 	DamageLawEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 16847)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 16848)
+@@ -168,6 +168,7 @@
+ 		case MaterialsRheologyLawEnum : return "MaterialsRheologyLaw";
+ 		case MaterialsRheologyNEnum : return "MaterialsRheologyN";
+ 		case DamageDEnum : return "DamageD";
++		case DamageFEnum : return "DamageF";
+ 		case QmuDamageDEnum : return "QmuDamageD";
+ 		case DamageDbarEnum : return "DamageDbar";
+ 		case DamageLawEnum : return "DamageLaw";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 16847)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 16848)
+@@ -171,6 +171,7 @@
+ 	      else if (strcmp(name,"MaterialsRheologyLaw")==0) return MaterialsRheologyLawEnum;
+ 	      else if (strcmp(name,"MaterialsRheologyN")==0) return MaterialsRheologyNEnum;
+ 	      else if (strcmp(name,"DamageD")==0) return DamageDEnum;
++	      else if (strcmp(name,"DamageF")==0) return DamageFEnum;
+ 	      else if (strcmp(name,"QmuDamageD")==0) return QmuDamageDEnum;
+ 	      else if (strcmp(name,"DamageDbar")==0) return DamageDbarEnum;
+ 	      else if (strcmp(name,"DamageLaw")==0) return DamageLawEnum;
+@@ -258,11 +259,11 @@
+ 	      else if (strcmp(name,"MaxIterationConvergenceFlag")==0) return MaxIterationConvergenceFlagEnum;
+ 	      else if (strcmp(name,"SteadystateMaxiter")==0) return SteadystateMaxiterEnum;
+ 	      else if (strcmp(name,"SteadystateNumRequestedOutputs")==0) return SteadystateNumRequestedOutputsEnum;
+-	      else if (strcmp(name,"SteadystateReltol")==0) return SteadystateReltolEnum;
+          else stage=3;
+    }
+    if(stage==3){
+-	      if (strcmp(name,"SteadystateRequestedOutputs")==0) return SteadystateRequestedOutputsEnum;
++	      if (strcmp(name,"SteadystateReltol")==0) return SteadystateReltolEnum;
++	      else if (strcmp(name,"SteadystateRequestedOutputs")==0) return SteadystateRequestedOutputsEnum;
+ 	      else if (strcmp(name,"Surface")==0) return SurfaceEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsPrecipitation")==0) return SurfaceforcingsPrecipitationEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsMassBalance")==0) return SurfaceforcingsMassBalanceEnum;
+@@ -381,11 +382,11 @@
+ 	      else if (strcmp(name,"DataSetParam")==0) return DataSetParamEnum;
+ 	      else if (strcmp(name,"DoubleMatArrayParam")==0) return DoubleMatArrayParamEnum;
+ 	      else if (strcmp(name,"DoubleMatParam")==0) return DoubleMatParamEnum;
+-	      else if (strcmp(name,"DoubleParam")==0) return DoubleParamEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"DoubleVecParam")==0) return DoubleVecParamEnum;
++	      if (strcmp(name,"DoubleParam")==0) return DoubleParamEnum;
++	      else if (strcmp(name,"DoubleVecParam")==0) return DoubleVecParamEnum;
+ 	      else if (strcmp(name,"Element")==0) return ElementEnum;
+ 	      else if (strcmp(name,"ExternalResult")==0) return ExternalResultEnum;
+ 	      else if (strcmp(name,"FileParam")==0) return FileParamEnum;
+@@ -504,11 +505,11 @@
+ 	      else if (strcmp(name,"TransientInput")==0) return TransientInputEnum;
+ 	      else if (strcmp(name,"Waterfraction")==0) return WaterfractionEnum;
+ 	      else if (strcmp(name,"Watercolumn")==0) return WatercolumnEnum;
+-	      else if (strcmp(name,"BasalFriction")==0) return BasalFrictionEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"ViscousHeating")==0) return ViscousHeatingEnum;
++	      if (strcmp(name,"BasalFriction")==0) return BasalFrictionEnum;
++	      else if (strcmp(name,"ViscousHeating")==0) return ViscousHeatingEnum;
+ 	      else if (strcmp(name,"QmuTemperature")==0) return QmuTemperatureEnum;
+ 	      else if (strcmp(name,"HydrologyWaterVx")==0) return HydrologyWaterVxEnum;
+ 	      else if (strcmp(name,"HydrologyWaterVy")==0) return HydrologyWaterVyEnum;
+@@ -627,11 +628,11 @@
+ 	      else if (strcmp(name,"Mumps")==0) return MumpsEnum;
+ 	      else if (strcmp(name,"Gsl")==0) return GslEnum;
+ 	      else if (strcmp(name,"Option")==0) return OptionEnum;
+-	      else if (strcmp(name,"GenericOption")==0) return GenericOptionEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"OptionCell")==0) return OptionCellEnum;
++	      if (strcmp(name,"GenericOption")==0) return GenericOptionEnum;
++	      else if (strcmp(name,"OptionCell")==0) return OptionCellEnum;
+ 	      else if (strcmp(name,"OptionStruct")==0) return OptionStructEnum;
+ 	      else if (strcmp(name,"Paterson")==0) return PatersonEnum;
+ 	      else if (strcmp(name,"Arrhenius")==0) return ArrheniusEnum;
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16847)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16848)
+@@ -106,6 +106,7 @@
+ 		virtual void   GetInputListOnVertices(IssmDouble* pvalue,int enumtype)=0;
+ 		virtual void   GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue)=0;
+ 		virtual Input* GetInput(int inputenum)=0;
++		virtual Input* GetMaterialInput(int inputenum)=0;
+ 		virtual void   GetInputValue(IssmDouble* pvalue,Node* node,int enumtype)=0;
+ 		virtual void   GetInputValue(bool* pvalue,int enum_type)=0;
+ 		virtual void   GetInputValue(int* pvalue,int enum_type)=0;
+@@ -121,6 +122,7 @@
+ 		virtual void   InputChangeName(int enum_type,int enum_type_old)=0;
+ 		virtual void   ComputeBasalStress(Vector<IssmDouble>* sigma_b)=0;
+ 		virtual void   ComputeStrainRate(Vector<IssmDouble>* eps)=0;
++		virtual void   ComputeStressTensor(void)=0;
+ 		virtual void   ResultInterpolation(int* pinterpolation,int output_enum)=0;
+ 		virtual void   ResultToVector(Vector<IssmDouble>* vector,int output_enum)=0;
+ 		virtual void   Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finite_element)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16847)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16848)
+@@ -1343,6 +1343,11 @@
+ 	return inputs->GetInput(inputenum);
+ }
+ /*}}}*/
++/*FUNCTION Tria::GetMaterialInput(int inputenum) {{{*/
++Input* Tria::GetMaterialInput(int inputenum){
++	return this->material->inputs->GetInput(inputenum);
++}
++/*}}}*/
+ /*FUNCTION Tria::GetInputListOnVertices(IssmDouble* pvalue,int enumtype) {{{*/
+ void Tria::GetInputListOnVertices(IssmDouble* pvalue,int enumtype){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16847)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16848)
+@@ -264,6 +264,7 @@
+ 		void           NormalBase(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		IssmDouble     GetMaterialParameter(int enum_in);
+ 		Input*         GetInput(int inputenum);
++		Input*         GetMaterialInput(int inputenum);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue,int index); //TO BE REMOVED
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16847)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16848)
+@@ -1313,6 +1313,11 @@
+ 	return inputs->GetInput(inputenum);
+ }
+ /*}}}*/
++/*FUNCTION Penta::GetMaterialInput(int inputenum) {{{*/
++Input* Penta::GetMaterialInput(int inputenum){
++	return this->material->inputs->GetInput(inputenum);
++}
++/*}}}*/
+ /*FUNCTION Penta::GetInputListOnVertices(IssmDouble* pvalue,int enumtype) {{{*/
+ void Penta::GetInputListOnVertices(IssmDouble* pvalue,int enumtype){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16847)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16848)
+@@ -223,6 +223,7 @@
+ 		IssmDouble     GetGroundedPortion(IssmDouble* xyz_list);
+ 		int            GetElementType(void);
+ 		Input*         GetInput(int inputenum);
++		Input*         GetMaterialInput(int inputenum);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue);
+ 		void           GetInputListOnNodes(IssmDouble* pvalue,int enumtype);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16847)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16848)
+@@ -136,6 +136,7 @@
+ 		int         PressureInterpolation(void){_error_("not implemented yet");};
+ 		int         VelocityInterpolation(void){_error_("not implemented yet");};
+ 		Input*      GetInput(int inputenum){_error_("not implemented yet");};
++		Input*      GetMaterialInput(int inputenum){_error_("not implemented yet");};
+ 		void        GetInputListOnVertices(IssmDouble* pvalue,int enumtype){_error_("not implemented yet");};
+ 		void        GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){_error_("not implemented yet");};
+ 		void        GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/m/enum/DamageFEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/DamageFEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/DamageFEnum.m	(revision 16848)
+@@ -0,0 +1,11 @@
++function macro=DamageFEnum()
++%DAMAGEFENUM - Enum of DamageF
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=DamageFEnum()
++
++macro=StringToEnum('DamageF');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 16847)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 16848)
+@@ -160,6 +160,7 @@
+ def MaterialsRheologyLawEnum(): return StringToEnum("MaterialsRheologyLaw")[0]
+ def MaterialsRheologyNEnum(): return StringToEnum("MaterialsRheologyN")[0]
+ def DamageDEnum(): return StringToEnum("DamageD")[0]
++def DamageFEnum(): return StringToEnum("DamageF")[0]
+ def QmuDamageDEnum(): return StringToEnum("QmuDamageD")[0]
+ def DamageDbarEnum(): return StringToEnum("DamageDbar")[0]
+ def DamageLawEnum(): return StringToEnum("DamageLaw")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-16848-16849.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16848-16849.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16848-16849.diff	(revision 17802)
@@ -0,0 +1,213 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h	(revision 16848)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h	(revision 16849)
+@@ -22,6 +22,8 @@
+ 		/*Finite element Analysis*/
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
++		ElementVector* CreatePVector2D(Element* element);
++		ElementVector* CreatePVector3D(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 16848)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 16849)
+@@ -138,8 +138,73 @@
+ 	_error_("not implemented yet");
+ }/*}}}*/
+ ElementVector* StressbalanceSIAAnalysis::CreatePVector(Element* element){/*{{{*/
+-_error_("not implemented yet");
++
++	int meshtype;
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			return CreatePVector2D(element);
++		case Mesh3DEnum:
++			return CreatePVector3D(element);
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
+ }/*}}}*/
++ElementVector* StressbalanceSIAAnalysis::CreatePVector2D(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	IssmDouble ub,vb,slope2,drag,thickness,connectivity;
++	IssmDouble slope[2];
++
++	/*Fetch number vertices for this element*/
++	int numvertices = element->GetNumberOfVertices();
++
++	/*Initialize Element vector*/
++	ElementVector* pe=element->NewElementVector();
++
++	/*Retrieve all inputs and parameters*/
++	IssmDouble  rho_ice    = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	IssmDouble  gravity    = element->GetMaterialParameter(ConstantsGEnum);
++	IssmDouble  n          = element->GetMaterialParameter(MaterialsRheologyNEnum);
++	IssmDouble  B          = element->GetMaterialParameter(MaterialsRheologyBbarEnum);
++	Input* slopex_input    = element->GetInput(SurfaceSlopeXEnum);        _assert_(slopex_input);
++	Input* slopey_input    = element->GetInput(SurfaceSlopeYEnum);        _assert_(slopey_input);
++	Input* thickness_input = element->GetInput(ThicknessEnum);            _assert_(thickness_input);
++	Input* drag_input      = element->GetInput(FrictionCoefficientEnum);  _assert_(drag_input);
++
++	Gauss* gauss=element->NewGauss();
++	for(int iv=0;iv<numvertices;iv++){
++		gauss->GaussVertex(iv);
++
++		connectivity=(IssmDouble)element->VertexConnectivity(iv);
++
++		thickness_input->GetInputValue(&thickness,gauss);
++		drag_input->GetInputValue(&drag,gauss);
++		slopex_input->GetInputValue(&slope[0],gauss);
++		slopey_input->GetInputValue(&slope[1],gauss);
++		slope2=slope[0]*slope[0]+slope[1]*slope[1];
++
++		/*Payne 1995 (m = 1, B = 5e-3/yts = 1.58e-10  m/s/Pa*/
++		ub=-1.58*1.e-10*rho_ice*gravity*thickness*slope[0];
++		vb=-1.58*1.e-10*rho_ice*gravity*thickness*slope[1];
++		///*Ritz et al. 1996*/
++		//ub=drag*(rho_ice*gravity*thickness)*(rho_ice*gravity*thickness)*slope[0]/sqrt(slope2);
++		//vb=drag*(rho_ice*gravity*thickness)*(rho_ice*gravity*thickness)*slope[1]/sqrt(slope2);
++		///*Rutt et al. 2009*/
++		//ub=-drag*rho_ice*gravity*thickness*slope[0];
++		//vb=-drag*rho_ice*gravity*thickness*slope[1];
++
++		pe->values[2*iv+0]=(ub-2.*pow(rho_ice*gravity,n)*pow(slope2,((n-1.)/2.))*pow(thickness,n)/(pow(B,n)*(n+1))*slope[0])/connectivity;
++		pe->values[2*iv+1]=(vb-2.*pow(rho_ice*gravity,n)*pow(slope2,((n-1.)/2.))*pow(thickness,n)/(pow(B,n)*(n+1))*slope[1])/connectivity;
++	}
++
++	/*Clean up and return*/
++	delete gauss;
++	return pe;
++}/*}}}*/
++ElementVector* StressbalanceSIAAnalysis::CreatePVector3D(Element* element){/*{{{*/
++
++	_error_("not implemented");
++}/*}}}*/
+ void StressbalanceSIAAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 
+ 	IssmDouble vx,vy;
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16848)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16849)
+@@ -182,6 +182,7 @@
+ 		virtual IssmDouble IceVolumeAboveFloatation(void)=0;
+ 		virtual IssmDouble TotalSmb(void)=0;
+ 		virtual IssmDouble Misfit(int modelenum,int observationenum,int weightsenum)=0;
++		virtual int    VertexConnectivity(int vertexindex)=0;
+ 		#endif
+ 
+ 		#ifdef _HAVE_GIA_
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16848)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16849)
+@@ -1159,7 +1159,16 @@
+ IssmDouble Tria::GetMaterialParameter(int enum_in){
+ 
+ 	_assert_(this->matpar);
+-	return this->matpar->GetMaterialParameter(enum_in);
++	switch(enum_in){ // FIXME: change this to material
++		case MaterialsRheologyNEnum:
++			return this->material->GetN();
++		case MaterialsRheologyBEnum:
++			return this->material->GetB();
++		case MaterialsRheologyBbarEnum:
++			return this->material->GetBbar();
++		default:
++			return this->matpar->GetMaterialParameter(enum_in);
++	}
+ }
+ /*}}}*/
+ /*FUNCTION Tria::GetVerticesCoordinates(IssmDouble** pxyz_list){{{*/
+@@ -2938,6 +2947,12 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Tria::VertexConnectivity{{{*/
++int Tria::VertexConnectivity(int vertexindex){
++	_assert_(this->vertices);
++	return this->vertices[vertexindex]->Connectivity();
++}
++/*}}}*/
+ /*FUNCTION Tria::ViscosityFS{{{*/
+ void Tria::ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16848)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16849)
+@@ -136,6 +136,7 @@
+ 		IssmDouble  SurfaceArea(void);
+ 		void        Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement);
+ 		IssmDouble  TimeAdapt();
++		int         VertexConnectivity(int vertexindex);
+ 		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum);
+ 		bool        IsZeroLevelset(int levelset_enum);
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16848)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16849)
+@@ -1021,14 +1021,13 @@
+ IssmDouble Penta::GetMaterialParameter(int enum_in){
+ 
+ 	_assert_(this->matpar);
+-	
+ 	switch(enum_in){ // FIXME: change this to material
+-	case MaterialsRheologyNEnum:
+-		return this->material->GetN();
+-	case MaterialsRheologyBEnum:
+-		return this->material->GetB();
+-	default:
+-		return this->matpar->GetMaterialParameter(enum_in);
++		case MaterialsRheologyNEnum:
++			return this->material->GetN();
++		case MaterialsRheologyBEnum:
++			return this->material->GetB();
++		default:
++			return this->matpar->GetMaterialParameter(enum_in);
+ 	}
+ }
+ /*}}}*/
+@@ -3462,6 +3461,12 @@
+ 	}
+ }
+ /*}}}*/
++/*FUNCTION Penta::VertexConnectivity{{{*/
++int Penta::VertexConnectivity(int vertexindex){
++	_assert_(this->vertices);
++	return this->vertices[vertexindex]->Connectivity();
++}
++/*}}}*/
+ /*FUNCTION Penta::ViscousHeatingCreateInput {{{*/
+ void Penta::ViscousHeatingCreateInput(void){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16848)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16849)
+@@ -129,6 +129,7 @@
+ 		void   Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement);
+ 		int    NodalValue(IssmDouble* pvalue, int index, int natureofdataenum);
+ 		IssmDouble TimeAdapt();
++		int    VertexConnectivity(int vertexindex);
+ 		void   ViscousHeatingCreateInput(void);
+ 		void   ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16848)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16849)
+@@ -153,6 +153,7 @@
+ 		Gauss*      NewGaussTop(int order){_error_("not implemented yet");};
+ 		ElementVector* NewElementVector(int approximation_enum){_error_("not implemented yet");};
+ 		ElementMatrix* NewElementMatrix(int approximation_enum){_error_("not implemented yet");};
++		int         VertexConnectivity(int vertexindex){_error_("not implemented yet");};
+ 		void        ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
+ 		void        ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented");};
+ 		void        ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16849-16850.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16849-16850.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16849-16850.diff	(revision 17802)
@@ -0,0 +1,284 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 16849)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 16850)
+@@ -203,7 +203,93 @@
+ }/*}}}*/
+ ElementVector* StressbalanceSIAAnalysis::CreatePVector3D(Element* element){/*{{{*/
+ 
+-	_error_("not implemented");
++	/*Intermediaries */
++	int         nodeup,nodedown,numsegments;
++	IssmDouble  ub,vb,slope2,drag,surface,thickness,constant_part,z,Jdet;
++	IssmDouble  slope[2],connectivity[2],xyz_list_line[2][3];
++	IssmDouble *xyz_list = NULL;
++	int        *pairindices = NULL;
++
++	/*Fetch number vertices for this element*/
++	int numvertices = element->GetNumberOfVertices();
++
++	/*Initialize Element vector*/
++	ElementVector* pe=element->NewElementVector();
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	IssmDouble  rho_ice    = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	IssmDouble  gravity    = element->GetMaterialParameter(ConstantsGEnum);
++	IssmDouble  n          = element->GetMaterialParameter(MaterialsRheologyNEnum);
++	IssmDouble  B          = element->GetMaterialParameter(MaterialsRheologyBEnum);
++	Input* surface_input   = element->GetInput(SurfaceEnum);              _assert_(surface_input);
++	Input* slopex_input    = element->GetInput(SurfaceSlopeXEnum);        _assert_(slopex_input);
++	Input* slopey_input    = element->GetInput(SurfaceSlopeYEnum);        _assert_(slopey_input);
++	Input* thickness_input = element->GetInput(ThicknessEnum);            _assert_(thickness_input);
++	Input* drag_input      = element->GetInput(FrictionCoefficientEnum);  _assert_(drag_input);
++
++	/*Get Vertical segment indices*/
++	element->VerticalSegmentIndices(&pairindices,&numsegments);
++	for(int is=0;is<numsegments;is++){
++		nodedown = pairindices[is*2+0];
++		nodeup   = pairindices[is*2+1];
++		connectivity[0]=(IssmDouble)element->VertexConnectivity(nodedown);
++		connectivity[1]=(IssmDouble)element->VertexConnectivity(nodeup);
++		for(int i=0;i<3;i++){
++			xyz_list_line[0][i]=xyz_list[nodedown*3+i];
++			xyz_list_line[1][i]=xyz_list[nodeup*3+i];
++		}
++
++		Gauss* gauss=element->NewGaussLine(nodedown,nodeup,3);
++		for(int ig=gauss->begin();ig<gauss->end();ig++){
++			gauss->GaussPoint(ig);
++
++			slopex_input->GetInputValue(&slope[0],gauss);
++			slopey_input->GetInputValue(&slope[1],gauss);
++			surface_input->GetInputValue(&surface,gauss);
++			thickness_input->GetInputValue(&thickness,gauss);
++
++			slope2=slope[0]*slope[0]+slope[1]*slope[1];
++			constant_part=-2.*pow(rho_ice*gravity,n)*pow(slope2,((n-1.)/2.));
++
++			z = element->GetZcoord(gauss);
++			element->JacobianDeterminantLine(&Jdet,&xyz_list_line[0][0],gauss);
++
++			if(element->IsOnSurface()){
++				pe->values[2*nodeup+0]+=constant_part*pow((surface-z)/B,n)*slope[0]*Jdet*gauss->weight/connectivity[1];
++				pe->values[2*nodeup+1]+=constant_part*pow((surface-z)/B,n)*slope[1]*Jdet*gauss->weight/connectivity[1];
++			}
++			else{/*connectivity is too large, should take only half on it*/
++				pe->values[2*nodeup+0]+=constant_part*pow((surface-z)/B,n)*slope[0]*Jdet*gauss->weight*2./connectivity[1];
++				pe->values[2*nodeup+1]+=constant_part*pow((surface-z)/B,n)*slope[1]*Jdet*gauss->weight*2./connectivity[1];
++			}
++		}
++
++		/*Deal with basal velocities*/
++		if(element->IsOnBed()){
++			drag_input->GetInputValue(&drag,gauss);
++
++			/*Payne 1995 (m = 1, B = 5e-3/yts = 1.58e-10  m/s/Pa*/
++			ub=-1.58*1.e-10*rho_ice*gravity*thickness*slope[0];
++			vb=-1.58*1.e-10*rho_ice*gravity*thickness*slope[1];
++			///*Ritz et al. 1996*/
++			//ub=drag*(rho_ice*gravity*thickness)*(rho_ice*gravity*thickness)*slope[0]/sqrt(slope2);
++			//vb=drag*(rho_ice*gravity*thickness)*(rho_ice*gravity*thickness)*slope[1]/sqrt(slope2);
++			///*Rutt et al. 2009*/
++			//ub=-drag*rho_ice*gravity*thickness*slope[0];
++			//vb=-drag*rho_ice*gravity*thickness*slope[1];
++
++			pe->values[2*nodedown+0]+=ub/connectivity[0];
++			pe->values[2*nodedown+1]+=vb/connectivity[0];
++		}
++		delete gauss;
++	}
++
++	/*Clean up and return*/
++	xDelete<int>(pairindices);
++	xDelete<IssmDouble>(xyz_list);
++	return pe;
++
+ }/*}}}*/
+ void StressbalanceSIAAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16849)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16850)
+@@ -815,6 +815,8 @@
+ 	int approximation;
+ 	element->GetInputValue(&approximation,ApproximationEnum);
+ 	switch(approximation){
++		case SIAApproximationEnum:
++			return NULL;
+ 		case SSAApproximationEnum: 
+ 			return CreateKMatrixSSA(element);
+ 		case HOApproximationEnum: 
+@@ -832,6 +834,8 @@
+ 	int approximation;
+ 	element->GetInputValue(&approximation,ApproximationEnum);
+ 	switch(approximation){
++		case SIAApproximationEnum:
++			return NULL;
+ 		case SSAApproximationEnum: 
+ 			return CreatePVectorSSA(element);
+ 		case HOApproximationEnum: 
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16849)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16850)
+@@ -84,6 +84,7 @@
+ 		virtual void	GetDofListVelocity(int** pdoflist,int setenum)=0;
+ 		virtual void	GetDofListPressure(int** pdoflist,int setenum)=0;
+ 		virtual void   JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss)=0;
++		virtual void   JacobianDeterminantLine(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss)=0;
+ 		virtual void   JacobianDeterminantSurface(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss)=0;
+ 		virtual void   JacobianDeterminantBase(IssmDouble* Jdet,IssmDouble* xyz_list_base,Gauss* gauss)=0;
+ 		virtual void   JacobianDeterminantTop(IssmDouble* Jdet,IssmDouble* xyz_list_base,Gauss* gauss)=0;
+@@ -139,6 +140,7 @@
+       virtual Gauss* NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order)=0;
+       virtual Gauss* NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert)=0;
+ 		virtual Gauss* NewGaussBase(int order)=0;
++		virtual Gauss* NewGaussLine(int vertex1,int vertex2,int order)=0;
+ 		virtual Gauss* NewGaussTop(int order)=0;
+ 		virtual ElementVector*  NewElementVector(int approximation_enum=NoneApproximationEnum)=0;
+ 		virtual ElementMatrix*  NewElementMatrix(int approximation_enum=NoneApproximationEnum)=0;
+@@ -183,6 +185,7 @@
+ 		virtual IssmDouble TotalSmb(void)=0;
+ 		virtual IssmDouble Misfit(int modelenum,int observationenum,int weightsenum)=0;
+ 		virtual int    VertexConnectivity(int vertexindex)=0;
++		virtual void   VerticalSegmentIndices(int** pindices,int* pnumseg)=0;
+ 		#endif
+ 
+ 		#ifdef _HAVE_GIA_
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16849)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16850)
+@@ -137,6 +137,7 @@
+ 		void        Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement);
+ 		IssmDouble  TimeAdapt();
+ 		int         VertexConnectivity(int vertexindex);
++		void   VerticalSegmentIndices(int** pindices,int* pnumseg){_error_("not implemented yet");};
+ 		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum);
+ 		bool        IsZeroLevelset(int levelset_enum);
+ 
+@@ -282,6 +283,7 @@
+ 		void	         InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solution,int enum_type){_error_("not implemented yet");};
+ 		bool	         IsInput(int name);
+ 		void           JacobianDeterminant(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss);
++		void           JacobianDeterminantLine(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void           JacobianDeterminantSurface(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss);
+ 		void           JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
+ 		void           JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
+@@ -291,6 +293,7 @@
+       Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order);
+       Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){_error_("not implemented yet");};
+ 		Gauss*         NewGaussBase(int order){_error_("not implemented yet");};
++		Gauss*         NewGaussLine(int vertex1,int vertex2,int order){_error_("not implemented yet");};
+ 		Gauss*         NewGaussTop(int order){_error_("not implemented yet");};
+ 		ElementVector* NewElementVector(int approximation_enum);
+ 		ElementMatrix* NewElementMatrix(int approximation_enum);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16849)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16850)
+@@ -2466,6 +2466,14 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Penta::JacobianDeterminantLine{{{*/
++void Penta::JacobianDeterminantLine(IssmDouble* pJdet,IssmDouble* xyz_list_line,Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussPentaEnum);
++	this->GetSegmentJacobianDeterminant(pJdet,xyz_list_line,(GaussPenta*)gauss);
++
++}
++/*}}}*/
+ /*FUNCTION Penta::JacobianDeterminantTop{{{*/
+ void Penta::JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_top,Gauss* gauss){
+ 
+@@ -2575,6 +2583,11 @@
+ 	return new GaussPenta(0,1,2,order);
+ }
+ /*}}}*/
++/*FUNCTION Penta::NewGaussLine(int vertex1,int vertex2,int order){{{*/
++Gauss* Penta::NewGaussLine(int vertex1,int vertex2,int order){
++	return new GaussPenta(vertex1,vertex2,order);
++}
++/*}}}*/
+ /*FUNCTION Penta::NewGaussTop(int order){{{*/
+ Gauss* Penta::NewGaussTop(int order){
+ 	return new GaussPenta(3,4,5,order);
+@@ -3467,6 +3480,20 @@
+ 	return this->vertices[vertexindex]->Connectivity();
+ }
+ /*}}}*/
++/*FUNCTION Penta::VerticalSegmentIndices{{{*/
++void Penta::VerticalSegmentIndices(int** pindices,int* pnumseg){
++
++	/*output*/
++	int *indices = xNew<int>(3*2);
++	indices[0*2 + 0] = 0; indices[0*2 + 1] = 3;
++	indices[1*2 + 0] = 1; indices[1*2 + 1] = 4;
++	indices[2*2 + 0] = 2; indices[2*2 + 1] = 5;
++
++	/*Assign output pointers*/
++	*pindices = indices;
++	*pnumseg  = 3;
++}
++/*}}}*/
+ /*FUNCTION Penta::ViscousHeatingCreateInput {{{*/
+ void Penta::ViscousHeatingCreateInput(void){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16849)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16850)
+@@ -130,6 +130,7 @@
+ 		int    NodalValue(IssmDouble* pvalue, int index, int natureofdataenum);
+ 		IssmDouble TimeAdapt();
+ 		int    VertexConnectivity(int vertexindex);
++		void   VerticalSegmentIndices(int** pindices,int* pnumseg);
+ 		void   ViscousHeatingCreateInput(void);
+ 		void   ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+ 
+@@ -249,6 +250,7 @@
+ 		bool           IsFloating(void); 
+ 		bool           IsNodeOnShelfFromFlags(IssmDouble* flags);
+ 		void           JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss);
++		void           JacobianDeterminantLine(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss);
+ 		void           JacobianDeterminantSurface(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss);
+ 		void           JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss);
+ 		void           JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss);
+@@ -258,6 +260,7 @@
+       Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){_error_("not implemented yet");};
+       Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert);
+ 		Gauss*         NewGaussBase(int order);
++		Gauss*         NewGaussLine(int vertex1,int vertex2,int order);
+ 		Gauss*         NewGaussTop(int order);
+ 		ElementVector* NewElementVector(int approximation_enum);
+ 		ElementMatrix* NewElementMatrix(int approximation_enum);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16849)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16850)
+@@ -115,7 +115,8 @@
+ 		bool        IsFloating(){_error_("not implemented yet");};
+ 		bool        IsNodeOnShelfFromFlags(IssmDouble* flags){_error_("not implemented yet");};
+ 		void        JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+-		void           JacobianDeterminantSurface(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
++		void        JacobianDeterminantLine(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
++		void        JacobianDeterminantSurface(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void        JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
+ 		void        JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
+ 		IssmDouble  MinEdgeLength(IssmDouble* xyz_list){_error_("not implemented yet");};
+@@ -150,10 +151,12 @@
+       Gauss*      NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){_error_("not implemented yet");};
+       Gauss*      NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){_error_("not implemented yet");};
+ 		Gauss*      NewGaussBase(int order){_error_("not implemented yet");};
++		Gauss*      NewGaussLine(int vertex1,int vertex2,int order){_error_("not implemented yet");};
+ 		Gauss*      NewGaussTop(int order){_error_("not implemented yet");};
+ 		ElementVector* NewElementVector(int approximation_enum){_error_("not implemented yet");};
+ 		ElementMatrix* NewElementMatrix(int approximation_enum){_error_("not implemented yet");};
+ 		int         VertexConnectivity(int vertexindex){_error_("not implemented yet");};
++		void        VerticalSegmentIndices(int** pindices,int* pnumseg){_error_("not implemented yet");};
+ 		void        ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
+ 		void        ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented");};
+ 		void        ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16850-16851.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16850-16851.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16850-16851.diff	(revision 17802)
@@ -0,0 +1,112 @@
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16850)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16851)
+@@ -109,7 +109,8 @@
+ 	HydrologydcSedimentTransmitivityEnum,
+ 	HydrologydcWaterCompressibilityEnum,
+ 	HydrologydcSpceplHeadEnum,
+-	HydrologydcMaskEplactiveEnum,
++	HydrologydcMaskEplactiveNodeEnum,
++	HydrologydcMaskEplactiveEltEnum,
+ 	HydrologydcEplCompressibilityEnum,
+ 	HydrologydcEplPorosityEnum,
+ 	HydrologydcEplInitialThicknessEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 16850)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 16851)
+@@ -117,7 +117,8 @@
+ 		case HydrologydcSedimentTransmitivityEnum : return "HydrologydcSedimentTransmitivity";
+ 		case HydrologydcWaterCompressibilityEnum : return "HydrologydcWaterCompressibility";
+ 		case HydrologydcSpceplHeadEnum : return "HydrologydcSpceplHead";
+-		case HydrologydcMaskEplactiveEnum : return "HydrologydcMaskEplactive";
++		case HydrologydcMaskEplactiveNodeEnum : return "HydrologydcMaskEplactiveNode";
++		case HydrologydcMaskEplactiveEltEnum : return "HydrologydcMaskEplactiveElt";
+ 		case HydrologydcEplCompressibilityEnum : return "HydrologydcEplCompressibility";
+ 		case HydrologydcEplPorosityEnum : return "HydrologydcEplPorosity";
+ 		case HydrologydcEplInitialThicknessEnum : return "HydrologydcEplInitialThickness";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 16850)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 16851)
+@@ -117,7 +117,8 @@
+ 	      else if (strcmp(name,"HydrologydcSedimentTransmitivity")==0) return HydrologydcSedimentTransmitivityEnum;
+ 	      else if (strcmp(name,"HydrologydcWaterCompressibility")==0) return HydrologydcWaterCompressibilityEnum;
+ 	      else if (strcmp(name,"HydrologydcSpceplHead")==0) return HydrologydcSpceplHeadEnum;
+-	      else if (strcmp(name,"HydrologydcMaskEplactive")==0) return HydrologydcMaskEplactiveEnum;
++	      else if (strcmp(name,"HydrologydcMaskEplactiveNode")==0) return HydrologydcMaskEplactiveNodeEnum;
++	      else if (strcmp(name,"HydrologydcMaskEplactiveElt")==0) return HydrologydcMaskEplactiveEltEnum;
+ 	      else if (strcmp(name,"HydrologydcEplCompressibility")==0) return HydrologydcEplCompressibilityEnum;
+ 	      else if (strcmp(name,"HydrologydcEplPorosity")==0) return HydrologydcEplPorosityEnum;
+ 	      else if (strcmp(name,"HydrologydcEplInitialThickness")==0) return HydrologydcEplInitialThicknessEnum;
+@@ -135,11 +136,11 @@
+ 	      else if (strcmp(name,"HydrologySediment")==0) return HydrologySedimentEnum;
+ 	      else if (strcmp(name,"HydrologyEfficient")==0) return HydrologyEfficientEnum;
+ 	      else if (strcmp(name,"HydrologySedimentKmax")==0) return HydrologySedimentKmaxEnum;
+-	      else if (strcmp(name,"WaterTransfer")==0) return WaterTransferEnum;
+          else stage=2;
+    }
+    if(stage==2){
+-	      if (strcmp(name,"IndependentObject")==0) return IndependentObjectEnum;
++	      if (strcmp(name,"WaterTransfer")==0) return WaterTransferEnum;
++	      else if (strcmp(name,"IndependentObject")==0) return IndependentObjectEnum;
+ 	      else if (strcmp(name,"InversionControlParameters")==0) return InversionControlParametersEnum;
+ 	      else if (strcmp(name,"InversionCostFunctionThreshold")==0) return InversionCostFunctionThresholdEnum;
+ 	      else if (strcmp(name,"InversionCostFunctionsCoefficients")==0) return InversionCostFunctionsCoefficientsEnum;
+@@ -258,11 +259,11 @@
+ 	      else if (strcmp(name,"ProfilingSolutionTime")==0) return ProfilingSolutionTimeEnum;
+ 	      else if (strcmp(name,"MaxIterationConvergenceFlag")==0) return MaxIterationConvergenceFlagEnum;
+ 	      else if (strcmp(name,"SteadystateMaxiter")==0) return SteadystateMaxiterEnum;
+-	      else if (strcmp(name,"SteadystateNumRequestedOutputs")==0) return SteadystateNumRequestedOutputsEnum;
+          else stage=3;
+    }
+    if(stage==3){
+-	      if (strcmp(name,"SteadystateReltol")==0) return SteadystateReltolEnum;
++	      if (strcmp(name,"SteadystateNumRequestedOutputs")==0) return SteadystateNumRequestedOutputsEnum;
++	      else if (strcmp(name,"SteadystateReltol")==0) return SteadystateReltolEnum;
+ 	      else if (strcmp(name,"SteadystateRequestedOutputs")==0) return SteadystateRequestedOutputsEnum;
+ 	      else if (strcmp(name,"Surface")==0) return SurfaceEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsPrecipitation")==0) return SurfaceforcingsPrecipitationEnum;
+@@ -381,11 +382,11 @@
+ 	      else if (strcmp(name,"DoubleInput")==0) return DoubleInputEnum;
+ 	      else if (strcmp(name,"DataSetParam")==0) return DataSetParamEnum;
+ 	      else if (strcmp(name,"DoubleMatArrayParam")==0) return DoubleMatArrayParamEnum;
+-	      else if (strcmp(name,"DoubleMatParam")==0) return DoubleMatParamEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"DoubleParam")==0) return DoubleParamEnum;
++	      if (strcmp(name,"DoubleMatParam")==0) return DoubleMatParamEnum;
++	      else if (strcmp(name,"DoubleParam")==0) return DoubleParamEnum;
+ 	      else if (strcmp(name,"DoubleVecParam")==0) return DoubleVecParamEnum;
+ 	      else if (strcmp(name,"Element")==0) return ElementEnum;
+ 	      else if (strcmp(name,"ExternalResult")==0) return ExternalResultEnum;
+@@ -504,11 +505,11 @@
+ 	      else if (strcmp(name,"DragCoefficientAbsGradient")==0) return DragCoefficientAbsGradientEnum;
+ 	      else if (strcmp(name,"TransientInput")==0) return TransientInputEnum;
+ 	      else if (strcmp(name,"Waterfraction")==0) return WaterfractionEnum;
+-	      else if (strcmp(name,"Watercolumn")==0) return WatercolumnEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"BasalFriction")==0) return BasalFrictionEnum;
++	      if (strcmp(name,"Watercolumn")==0) return WatercolumnEnum;
++	      else if (strcmp(name,"BasalFriction")==0) return BasalFrictionEnum;
+ 	      else if (strcmp(name,"ViscousHeating")==0) return ViscousHeatingEnum;
+ 	      else if (strcmp(name,"QmuTemperature")==0) return QmuTemperatureEnum;
+ 	      else if (strcmp(name,"HydrologyWaterVx")==0) return HydrologyWaterVxEnum;
+@@ -627,11 +628,11 @@
+ 	      else if (strcmp(name,"Mpi")==0) return MpiEnum;
+ 	      else if (strcmp(name,"Mumps")==0) return MumpsEnum;
+ 	      else if (strcmp(name,"Gsl")==0) return GslEnum;
+-	      else if (strcmp(name,"Option")==0) return OptionEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"GenericOption")==0) return GenericOptionEnum;
++	      if (strcmp(name,"Option")==0) return OptionEnum;
++	      else if (strcmp(name,"GenericOption")==0) return GenericOptionEnum;
+ 	      else if (strcmp(name,"OptionCell")==0) return OptionCellEnum;
+ 	      else if (strcmp(name,"OptionStruct")==0) return OptionStructEnum;
+ 	      else if (strcmp(name,"Paterson")==0) return PatersonEnum;
Index: issm/oecreview/Archive/16554-17801/ISSM-16851-16852.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16851-16852.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16851-16852.diff	(revision 17802)
@@ -0,0 +1,66 @@
+Index: ../trunk-jpl/src/m/shp/Shp2Exp.m
+===================================================================
+--- ../trunk-jpl/src/m/shp/Shp2Exp.m	(revision 16851)
++++ ../trunk-jpl/src/m/shp/Shp2Exp.m	(revision 16852)
+@@ -27,6 +27,15 @@
+ 			exp(end).density=1;
+ 			exp(end).closed=1;
+ 			exp(end).name=num2str(shp(i).id);
++		elseif strcmpi(shp(i).Geometry,'Point'),
++				x=shp(i).X; y=shp(i).Y;
++
++				exp(end+1).x=x;
++				exp(end).y=y;
++				exp(end).nods=length(x);
++				exp(end).density=1;
++				exp(end).closed=1;
++				%exp(end).name=num2str(shp(i).id);
+ 		end
+ 	end
+ 
+Index: ../trunk-jpl/src/m/enum/HydrologydcMaskEplactiveNodeEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/HydrologydcMaskEplactiveNodeEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/HydrologydcMaskEplactiveNodeEnum.m	(revision 16852)
+@@ -0,0 +1,11 @@
++function macro=HydrologydcMaskEplactiveNodeEnum()
++%HYDROLOGYDCMASKEPLACTIVENODEENUM - Enum of HydrologydcMaskEplactiveNode
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=HydrologydcMaskEplactiveNodeEnum()
++
++macro=StringToEnum('HydrologydcMaskEplactiveNode');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 16851)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 16852)
+@@ -109,7 +109,8 @@
+ def HydrologydcSedimentTransmitivityEnum(): return StringToEnum("HydrologydcSedimentTransmitivity")[0]
+ def HydrologydcWaterCompressibilityEnum(): return StringToEnum("HydrologydcWaterCompressibility")[0]
+ def HydrologydcSpceplHeadEnum(): return StringToEnum("HydrologydcSpceplHead")[0]
+-def HydrologydcMaskEplactiveEnum(): return StringToEnum("HydrologydcMaskEplactive")[0]
++def HydrologydcMaskEplactiveNodeEnum(): return StringToEnum("HydrologydcMaskEplactiveNode")[0]
++def HydrologydcMaskEplactiveEltEnum(): return StringToEnum("HydrologydcMaskEplactiveElt")[0]
+ def HydrologydcEplCompressibilityEnum(): return StringToEnum("HydrologydcEplCompressibility")[0]
+ def HydrologydcEplPorosityEnum(): return StringToEnum("HydrologydcEplPorosity")[0]
+ def HydrologydcEplInitialThicknessEnum(): return StringToEnum("HydrologydcEplInitialThickness")[0]
+Index: ../trunk-jpl/src/m/enum/HydrologydcMaskEplactiveEltEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/HydrologydcMaskEplactiveEltEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/HydrologydcMaskEplactiveEltEnum.m	(revision 16852)
+@@ -0,0 +1,11 @@
++function macro=HydrologydcMaskEplactiveEltEnum()
++%HYDROLOGYDCMASKEPLACTIVEELTENUM - Enum of HydrologydcMaskEplactiveElt
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=HydrologydcMaskEplactiveEltEnum()
++
++macro=StringToEnum('HydrologydcMaskEplactiveElt');
Index: issm/oecreview/Archive/16554-17801/ISSM-16852-16853.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16852-16853.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16852-16853.diff	(revision 17802)
@@ -0,0 +1,429 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 16852)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 16853)
+@@ -85,7 +85,53 @@
+ 	_error_("not implemented yet");
+ }/*}}}*/
+ ElementVector* HydrologyShreveAnalysis::CreatePVector(Element* element){/*{{{*/
+-_error_("not implemented yet");
++
++	/*Skip if water or ice shelf element*/
++	if(element->IsFloating()) return NULL;
++
++	/*Intermediaries */
++	IssmDouble  Jdet,dt;
++	IssmDouble  mb,oldw;
++	IssmDouble* xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementVector* pe    = element->NewElementVector();
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	element->FindParam(&dt,TimesteppingTimeStepEnum);
++	Input* mb_input   = element->GetInput(BasalforcingsMeltingRateEnum); _assert_(mb_input);
++	Input* oldw_input = element->GetInput(WaterColumnOldEnum);           _assert_(oldw);
++
++	/*Initialize mb_correction to 0, do not forget!:*/
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctions(basis,gauss);
++
++		mb_input->GetInputValue(&mb,gauss);
++		oldw_input->GetInputValue(&oldw,gauss);
++
++		if(dt!=0.){
++			for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*(oldw+dt*mb)*basis[i];
++		}
++		else{
++			for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*mb*basis[i];
++		}
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	return pe;
+ }/*}}}*/
+ void HydrologyShreveAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,WatercolumnEnum);
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 16852)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 16853)
+@@ -24,5 +24,8 @@
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++
++		/*Intermediaries*/
++		IssmDouble SedimentStoring(Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 16852)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 16853)
+@@ -99,7 +99,79 @@
+ 	_error_("not implemented yet");
+ }/*}}}*/
+ ElementVector* HydrologyDCEfficientAnalysis::CreatePVector(Element* element){/*{{{*/
+-_error_("not implemented yet");
++
++	/*Intermediaries*/
++	int      meshtype;
++	Element* basalelement;
++
++	/*Get basal element*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Check that all nodes are active, else return empty matrix*/
++	if(element->AllActive()) return NULL;
++
++	/*Intermediaries */
++	IssmDouble dt,scalar,water_head;
++	IssmDouble transfer,residual,epl_thickness;
++	IssmDouble Jdet;
++	IssmDouble *xyz_list     = NULL;
++	Input*      old_wh_input = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = basalelement->GetNumberOfNodes();
++
++	/*Initialize Element vector*/
++	ElementVector* pe    = basalelement->NewElementVector();
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	basalelement->GetVerticesCoordinates(&xyz_list);
++	IssmDouble epl_specificstoring = EplSpecificStoring(basalelement);
++	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
++	Input* residual_input    = element->GetInput(SedimentHeadResidualEnum);    _assert_(residual_input);
++	Input* transfer_input    = element->GetInput(WaterTransferEnum);           _assert_(transfer_input);
++	Input* thickness_input   = element->GetInput(HydrologydcEplThicknessEnum); _assert_(thickness_input);
++	if(dt!= 0.){old_wh_input = element->GetInput(EplHeadOldEnum);              _assert_(old_wh_input);}
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=basalelement->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		basalelement->NodalFunctions(basis,gauss);
++
++		/*Loading term*/
++		transfer_input->GetInputValue(&transfer,gauss);
++		scalar = Jdet*gauss->weight*(-transfer);
++		if(dt!=0.) scalar = scalar*dt;
++		for(int i=0;i<numnodes;i++) pe->values[i]+=scalar*basis[i];
++
++		/*Transient term*/
++		if(dt!=0.){
++			thickness_input->GetInputValue(&epl_thickness,gauss);
++			old_wh_input->GetInputValue(&water_head,gauss);
++			scalar = Jdet*gauss->weight*water_head*epl_specificstoring*epl_thickness;
++			for(int i=0;i<numnodes;i++) pe->values[i]+=scalar*basis[i];
++		}
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	return pe;
+ }/*}}}*/
+ void HydrologyDCEfficientAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,EplHeadEnum);
+@@ -117,3 +189,13 @@
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ }/*}}}*/
++
++/*Intermediaries*/
++IssmDouble HydrologyDCEfficientAnalysis::EplSpecificStoring(Element* element){/*{{{*/
++	IssmDouble rho_freshwater        = element->GetMaterialParameter(MaterialsRhoFreshwaterEnum);
++	IssmDouble g                     = element->GetMaterialParameter(ConstantsGEnum);
++	IssmDouble epl_porosity          = element->GetMaterialParameter(HydrologydcEplPorosityEnum);
++	IssmDouble epl_compressibility   = element->GetMaterialParameter(HydrologydcEplCompressibilityEnum);
++	IssmDouble water_compressibility = element->GetMaterialParameter(HydrologydcWaterCompressibilityEnum);
++	return rho_freshwater*g*epl_porosity*(water_compressibility+(epl_compressibility/epl_porosity));		 
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16852)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16853)
+@@ -140,7 +140,75 @@
+ 	_error_("not implemented yet");
+ }/*}}}*/
+ ElementVector* HydrologyDCInefficientAnalysis::CreatePVector(Element* element){/*{{{*/
+-_error_("not implemented yet");
++
++	/*Intermediaries*/
++	int      meshtype;
++	Element* basalelement;
++
++	/*Get basal element*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Intermediaries */
++	IssmDouble dt,scalar,water_head;
++	IssmDouble water_load,transfer;
++	IssmDouble Jdet;
++	IssmDouble *xyz_list  = NULL;
++	Input*      old_wh_input      = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = basalelement->GetNumberOfNodes();
++
++	/*Initialize Element vector*/
++	ElementVector* pe    = basalelement->NewElementVector();
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	basalelement->GetVerticesCoordinates(&xyz_list);
++	IssmDouble sediment_storing = SedimentStoring(basalelement);
++	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
++	Input* water_input       = element->GetInput(BasalforcingsMeltingRateEnum); _assert_(water_input);
++	Input* transfer_input    = element->GetInput(WaterTransferEnum);            _assert_(transfer_input);
++	if(dt!= 0.){old_wh_input = element->GetInput(SedimentHeadOldEnum);          _assert_(old_wh_input);}
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=basalelement->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		basalelement->NodalFunctions(basis,gauss);
++
++		/*Loading term*/
++		water_input->GetInputValue(&water_load,gauss);
++		transfer_input->GetInputValue(&transfer,gauss);
++		scalar = Jdet*gauss->weight*(water_load+transfer);
++		if(dt!=0.) scalar = scalar*dt;
++		for(int i=0;i<numnodes;i++) pe->values[i]+=scalar*basis[i];
++
++		/*Transient term*/
++		if(dt!=0.){
++			old_wh_input->GetInputValue(&water_head,gauss);
++			scalar = Jdet*gauss->weight*water_head*sediment_storing;
++			for(int i=0;i<numnodes;i++) pe->values[i]+=scalar*basis[i];
++		}
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	return pe;
+ }/*}}}*/
+ void HydrologyDCInefficientAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,SedimentHeadEnum);
+@@ -203,3 +271,14 @@
+ 	xDelete<int>(doflist);
+ 	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ }/*}}}*/
++
++/*Intermediaries*/
++IssmDouble HydrologyDCInefficientAnalysis::SedimentStoring(Element* element){/*{{{*/
++	IssmDouble rho_freshwater           = element->GetMaterialParameter(MaterialsRhoFreshwaterEnum);
++	IssmDouble g                        = element->GetMaterialParameter(ConstantsGEnum);
++	IssmDouble sediment_porosity        = element->GetMaterialParameter(HydrologydcSedimentPorosityEnum);
++	IssmDouble sediment_thickness       = element->GetMaterialParameter(HydrologydcSedimentThicknessEnum);
++	IssmDouble sediment_compressibility = element->GetMaterialParameter(HydrologydcSedimentCompressibilityEnum);
++	IssmDouble water_compressibility    = element->GetMaterialParameter(HydrologydcWaterCompressibilityEnum);
++	return rho_freshwater*g*sediment_porosity*sediment_thickness*(water_compressibility+(sediment_compressibility/sediment_porosity));		 
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 16852)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 16853)
+@@ -24,5 +24,8 @@
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++
++		/*Intermediaries*/
++		IssmDouble EplSpecificStoring(Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 16852)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 16853)
+@@ -73,7 +73,64 @@
+ 	_error_("not implemented yet");
+ }/*}}}*/
+ ElementVector* L2ProjectionEPLAnalysis::CreatePVector(Element* element){/*{{{*/
+-_error_("not implemented yet");
++
++	/*Intermediaries*/
++	int      meshtype;
++	Element* basalelement;
++
++	/*Get basal element*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Intermediaries */
++	int         input_enum,index;
++	IssmDouble  Jdet,slopes[2];
++	Input      *input     = NULL;
++	IssmDouble *xyz_list  = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = basalelement->GetNumberOfNodes();
++
++	/*Initialize Element vector*/
++	ElementVector* pe    = basalelement->NewElementVector();
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	basalelement->GetVerticesCoordinates(&xyz_list);
++	basalelement->FindParam(&input_enum,InputToL2ProjectEnum);
++	switch(input_enum){
++		case EplHeadSlopeXEnum: input = element->GetInput(EplHeadEnum); index = 0; _assert_(input); break;
++		case EplHeadSlopeYEnum: input = element->GetInput(EplHeadEnum); index = 1; _assert_(input); break;
++		default: _error_("not implemented");
++	}
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=basalelement->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		basalelement->NodalFunctions(basis,gauss);
++
++		input->GetInputDerivativeValue(&slopes[0],xyz_list,gauss);
++		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*slopes[index]*basis[i];
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	return pe;
+ }/*}}}*/
+ void L2ProjectionEPLAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 16852)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 16853)
+@@ -253,6 +253,12 @@
+ 		case ConstantsReferencetemperatureEnum:     return this->referencetemperature;
+ 		case MaterialsMixedLayerCapacityEnum:       return this->mixed_layer_capacity;
+ 		case MaterialsThermalExchangeVelocityEnum:  return this->thermal_exchange_velocity;
++		case HydrologydcSedimentPorosityEnum:       return this->sediment_porosity;
++		case HydrologydcSedimentThicknessEnum:      return this->sediment_thickness;
++		case HydrologydcSedimentCompressibilityEnum:return this->sediment_compressibility;
++		case HydrologydcEplPorosityEnum:            return this->epl_porosity;
++		case HydrologydcEplCompressibilityEnum:     return this->epl_compressibility;
++		case HydrologydcWaterCompressibilityEnum:   return this->water_compressibility;
+ 		case ConstantsGEnum:                        return this->g;
+ 		default: _error_("Enum "<<EnumToStringx(enum_in)<<" not supported yet");
+ 	}
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16852)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16853)
+@@ -36,6 +36,8 @@
+ 
+ 		virtual        ~Element(){};
+ 
++		virtual bool        AllActive(void)=0;
++		virtual bool        AnyActive(void)=0;
+ 		virtual IssmDouble CharacteristicLength(void)=0;
+ 		virtual void   Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters)=0;
+ 		virtual void   SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16852)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16853)
+@@ -66,6 +66,8 @@
+ 		void  InputUpdateFromIoModel(int index, IoModel* iomodel);
+ 		/*}}}*/
+ 		/*Element virtual functions definitions: {{{*/
++		bool        AllActive(void);
++		bool        AnyActive(void);
+ 		IssmDouble  CharacteristicLength(void);
+ 		void        ComputeBasalStress(Vector<IssmDouble>* sigma_b);
+ 		void        ComputeStrainRate(Vector<IssmDouble>* eps);
+@@ -374,8 +376,7 @@
+ 		void           HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
+ 		void           HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask);
+ 		void           ComputeEPLThickness(void);
+-		bool           AllActive(void);
+-		bool           AnyActive(void);
++
+ 		#endif
+ 
+ 		#ifdef _HAVE_DAMAGE_
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16852)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16853)
+@@ -67,6 +67,8 @@
+ 		void  InputUpdateFromIoModel(int index, IoModel* iomodel);
+ 		/*}}}*/
+ 		/*Element virtual functions definitions: {{{*/
++		bool        AllActive(void){_error_("not implemented yet");};
++		bool        AnyActive(void){_error_("not implemented yet");};
+ 		void   BasalFrictionCreateInput(void);
+ 		IssmDouble CharacteristicLength(void){_error_("not implemented yet");};
+ 		void   ComputeBasalStress(Vector<IssmDouble>* sigma_b);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16852)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16853)
+@@ -66,6 +66,8 @@
+ 		void  InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented yet");};
+ 		/*}}}*/
+ 		/*Element virtual functions definitions: {{{*/
++		bool        AllActive(void){_error_("not implemented yet");};
++		bool        AnyActive(void){_error_("not implemented yet");};
+ 		void        AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
+ 		void        AddInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
+ 		void        AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16853-16854.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16853-16854.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16853-16854.diff	(revision 17802)
@@ -0,0 +1,211 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16853)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16854)
+@@ -84,7 +84,7 @@
+ 	iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
+ 	iomodel->FetchDataToInput(elements,SedimentHeadEnum);
+-	if(isefficientlayer)iomodel->FetchDataToInput(elements,HydrologydcMaskEplactiveEnum);
++	if(isefficientlayer)iomodel->FetchDataToInput(elements,HydrologydcMaskEplactiveNodeEnum);
+ }/*}}}*/
+ void HydrologyDCInefficientAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16853)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16854)
+@@ -51,7 +51,6 @@
+ 	hydroconverged=false;
+ 
+ 	/*Retrieve inputs as the initial state for the non linear iteration*/
+-	//femmodel->SetCurrentConfiguration(HydrologyDCInefficientAnalysisEnum);
+ 	GetSolutionFromInputsx(&ug_sed,femmodel);
+ 
+ 	if(isefficientlayer) {
+@@ -77,6 +76,9 @@
+ 		femmodel->UpdateConstraintsx();
+ 		femmodel->parameters->SetParam(HydrologySedimentEnum,HydrologyLayerEnum);
+ 
++		/*Reset constraint on the ZigZag Lock*/
++		ResetConstraintsx(femmodel);
++		
+ 		/*Iteration on the sediment layer*/
+ 		sedconverged=false;
+ 		for(;;){
+@@ -98,8 +100,6 @@
+ 				if(VerboseConvergence()) _printf0_("   # Sediment unstable constraints = " << num_unstable_constraints << "\n");
+ 				if(num_unstable_constraints==0) sedconverged = true;
+ 				if (sedcount>=hydro_maxiter){
+-					/*Hacking to get the results of non converged runs*/
+-					//					sedconverged = true;
+ 					_error_("   maximum number of Sediment iterations (" << hydro_maxiter << ") exceeded");
+ 				}
+ 			}
+@@ -123,8 +123,6 @@
+ 			femmodel->HydrologyEPLupdateDomainx();
+ 			femmodel->parameters->SetParam(HydrologyEfficientEnum,HydrologyLayerEnum);
+ 
+-			/*Reset constraint on the ZigZag Lock*/
+-			ResetConstraintsx(femmodel);
+ 			/*Iteration on the EPL layer*/
+ 			eplconverged = false;
+ 			for(;;){
+Index: ../trunk-jpl/src/c/cores/hydrology_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/hydrology_core.cpp	(revision 16853)
++++ ../trunk-jpl/src/c/cores/hydrology_core.cpp	(revision 16854)
+@@ -93,8 +93,8 @@
+ 			if(save_results && ((i+1)%output_frequency==0 || (i+1)==nsteps || i==0)){
+ 				if(VerboseSolution()) _printf0_("   saving results \n");
+ 				if(isefficientlayer){
+-					int outputs[7] = {SedimentHeadEnum,SedimentHeadResidualEnum,EplHeadEnum,HydrologydcMaskEplactiveEnum,EplHeadSlopeXEnum,EplHeadSlopeYEnum,HydrologydcEplThicknessEnum};
+-					femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],7);
++					int outputs[8] = {SedimentHeadEnum,SedimentHeadResidualEnum,EplHeadEnum,HydrologydcMaskEplactiveNodeEnum,EplHeadSlopeXEnum,EplHeadSlopeYEnum,HydrologydcEplThicknessEnum,WaterTransferEnum};
++					femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],8);
+ 				}
+ 				else{
+ 					int outputs[2] = {SedimentHeadEnum,SedimentHeadResidualEnum};
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 16853)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 16854)
+@@ -1351,7 +1351,7 @@
+ 	delete mask;
+ 
+ 	/*Update Mask*/
+-	InputUpdateFromVectorx(this,serial_mask,HydrologydcMaskEplactiveEnum,NodeSIdEnum);
++	InputUpdateFromVectorx(this,serial_mask,HydrologydcMaskEplactiveNodeEnum,NodeSIdEnum);
+ 	xDelete<IssmDouble>(serial_mask);
+ 
+ 	/*Step 2: update node activity. If one element is connected to mask=1, all nodes are active*/
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16853)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16854)
+@@ -1978,7 +1978,7 @@
+ 				name==HydrologydcEplThicknessOldEnum ||
+ 				name==HydrologydcEplInitialThicknessEnum ||
+ 				name==HydrologydcEplThicknessEnum ||
+-				name==HydrologydcMaskEplactiveEnum ||
++				name==HydrologydcMaskEplactiveNodeEnum ||
+ 				name==MeshVertexonbedEnum ||
+ 				name==WaterTransferEnum ||
+ 				name==QmuVxEnum ||
+@@ -6672,6 +6672,7 @@
+ 		water_input->GetInputValue(&water_load,gauss);
+ 		transfer_input->GetInputValue(&transfer,gauss);
+ 		scalar = Jdet*gauss->weight*(water_load+transfer);
++		printf("are we loading: load,%e ,transfer,%e\n",water_load, transfer);
+ 		if(reCast<bool,IssmDouble>(dt)) scalar = scalar*dt;
+ 		for(int i=0;i<numnodes;i++) pe->values[i]+=scalar*basis[i];
+ 
+@@ -6952,7 +6953,10 @@
+ 			break;
+ 		case 1:
+ 
+-			GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveEnum);
++			int analysis_type;
++			parameters->FindParam(&analysis_type,AnalysisTypeEnum);
++
++			GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveNodeEnum);
+ 			GetInputListOnVertices(&sed_head[0],SedimentHeadEnum); 
+ 			GetInputListOnVertices(&epl_head[0],EplHeadEnum);
+ 			GetInputListOnVertices(&epl_thickness[0],HydrologydcEplThicknessEnum);
+@@ -6962,19 +6966,29 @@
+ 			sed_trans = matpar->GetSedimentTransmitivity();
+ 			sed_thick = matpar->GetSedimentThickness();
+ 
+-			for(int i=0;i<numdof;i++){
++			printf("Which analyse %i \n",analysis_type);
++
++			if(!this->AnyActive()){
++
++				//printf("NoneActive\n");
++
+ 				/*No transfer if the EPL is not active*/
+-				if(activeEpl[i]==0.0){
++				for(int i=0;i<numdof;i++){
+ 					wh_trans=0.0;
++					/*Assign output pointer*/
++					transfer->SetValue(doflist[i],wh_trans,INS_VAL);
+ 				}
+-				else{
++			}
++			else{
++
++				for(int i=0;i<numdof;i++){
+ 					epl_specificstoring[i]=matpar->GetEplSpecificStoring();		
+ 					sedstoring[i]=matpar->GetSedimentStoring();
+-
++					
+ 					/*EPL head higher than sediment head, transfer from the epl to the sediment*/
+ 					if(epl_head[i]>sed_head[i]){
+ 						wh_trans=epl_specificstoring[i]*epl_thickness[i]*sed_trans*(epl_head[i]-sed_head[i])/(leakage*sed_thick);				
+-
++						
+ 						/*No transfer if the sediment head is allready at the maximum*/
+ 						this->GetHydrologyDCInefficientHmax(&h_max,nodes[i]);
+ 						if(sed_head[i]>=h_max)wh_trans=0.0;
+@@ -6983,9 +6997,10 @@
+ 					else if(epl_head[i]<=sed_head[i]){
+ 						wh_trans=sedstoring[i]*sed_trans*(epl_head[i]-sed_head[i])/(leakage*sed_thick);				
+ 					}
++					/*Assign output pointer*/
++					transfer->SetValue(doflist[i],wh_trans,INS_VAL);
++					printf("Computing, %e \n",wh_trans);
+ 				}
+-				/*Assign output pointer*/
+-				transfer->SetValue(doflist[i],wh_trans,INS_VAL);
+ 			}
+ 			break;
+ 		default:
+@@ -7004,7 +7019,7 @@
+ 	IssmDouble flag     = 0.;
+ 	IssmDouble active[numnodes];
+ 
+-	GetInputListOnVertices(&active[0],HydrologydcMaskEplactiveEnum);
++	GetInputListOnVertices(&active[0],HydrologydcMaskEplactiveNodeEnum);
+ 
+ 	for(int i=0;i<numnodes;i++) flag+=active[i];
+ 
+@@ -7033,7 +7048,7 @@
+ 	IssmDouble  eplhead[numdof];
+ 	IssmDouble  residual[numdof];
+ 
+-	GetInputListOnVertices(&old_active[0],HydrologydcMaskEplactiveEnum);	
++	GetInputListOnVertices(&old_active[0],HydrologydcMaskEplactiveNodeEnum);	
+ 	GetInputListOnVertices(&epl_thickness[0],HydrologydcEplThicknessEnum);	
+ 	GetInputListOnVertices(&sedhead[0],SedimentHeadEnum);
+ 	GetInputListOnVertices(&eplhead[0],EplHeadEnum);
+@@ -7105,7 +7120,7 @@
+ 		n                = material->GetN();
+ 		A                = material->GetAbar();
+ 		
+-		GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveEnum);
++		GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveNodeEnum);
+ 		GetInputListOnVertices(&eplhead[0],EplHeadEnum);
+ 		GetInputListOnVertices(&epl_slopeX[0],EplHeadSlopeXEnum); 
+ 		GetInputListOnVertices(&epl_slopeY[0],EplHeadSlopeYEnum);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16853)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16854)
+@@ -2406,7 +2406,7 @@
+ 				name==HydrologydcEplThicknessOldEnum ||
+ 				name==HydrologydcEplInitialThicknessEnum ||
+ 				name==HydrologydcEplThicknessEnum ||
+-				name==HydrologydcMaskEplactiveEnum ||
++				name==HydrologydcMaskEplactiveNodeEnum ||
+ 				name==WaterTransferEnum
+ 
+ 				) {
+@@ -9844,7 +9844,7 @@
+ 		n                = material->GetN();
+ 		A                = material->GetA();
+ 		
+-		GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveEnum);
++		GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveNodeEnum);
+ 		GetInputListOnVertices(&eplhead[0],EplHeadEnum);
+ 		GetInputListOnVertices(&epl_slopeX[0],EplHeadSlopeXEnum); 
+ 		GetInputListOnVertices(&epl_slopeY[0],EplHeadSlopeYEnum);
Index: issm/oecreview/Archive/16554-17801/ISSM-16854-16855.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16854-16855.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16854-16855.diff	(revision 17802)
@@ -0,0 +1,40 @@
+Index: ../trunk-jpl/src/m/classes/hydrologydc.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/hydrologydc.m	(revision 16854)
++++ ../trunk-jpl/src/m/classes/hydrologydc.m	(revision 16855)
+@@ -22,7 +22,7 @@
+ 		sediment_transmitivity   = 0;
+ 
+ 		spcepl_head              = NaN;
+-		mask_eplactive           = NaN;
++		mask_eplactive_node      = NaN;
+ 		epl_compressibility      = 0;
+ 		epl_porosity             = 0;
+ 		epl_initial_thickness    = 0;
+@@ -92,7 +92,7 @@
+ 
+ 			if obj.isefficientlayer==1,
+ 				md = checkfield(md,'fieldname','hydrology.spcepl_head','forcing',1);
+-				md = checkfield(md,'fieldname','hydrology.mask_eplactive','size',[md.mesh.numberofvertices 1],'values',[0 1]);
++				md = checkfield(md,'fieldname','hydrology.mask_eplactive_node','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+ 				md = checkfield(md,'fieldname','hydrology.epl_compressibility','>',0,'numel',1);
+ 				md = checkfield(md,'fieldname','hydrology.epl_porosity','>',0,'numel',1);
+ 				md = checkfield(md,'fieldname','hydrology.epl_initial_thickness','>',0,'numel',1);
+@@ -133,7 +133,7 @@
+ 			if obj.isefficientlayer==1,
+ 				disp(sprintf('   - for the epl layer'));
+ 				fielddisplay(obj,'spcepl_head','epl water head constraints (NaN means no constraint) [m above MSL]');
+-				fielddisplay(obj,'mask_eplactive','active (1) or not (0) EPL');
++				fielddisplay(obj,'mask_eplactive_node','active (1) or not (0) EPL');
+ 				fielddisplay(obj,'epl_compressibility','epl compressibility [Pa^-1]');
+ 				fielddisplay(obj,'epl_porosity','epl [dimensionless]');
+ 				fielddisplay(obj,'epl_initial_thickness','epl initial thickness [m]');
+@@ -167,7 +167,7 @@
+ 
+ 			if obj.isefficientlayer==1,	
+ 				WriteData(fid,'object',obj,'fieldname','spcepl_head','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);	
+-				WriteData(fid,'object',obj,'fieldname','mask_eplactive','format','DoubleMat','mattype',1);
++				WriteData(fid,'object',obj,'fieldname','mask_eplactive_node','format','DoubleMat','mattype',1);
+ 				WriteData(fid,'object',obj,'fieldname','epl_compressibility','format','Double');			
+ 				WriteData(fid,'object',obj,'fieldname','epl_porosity','format','Double');			
+ 				WriteData(fid,'object',obj,'fieldname','epl_initial_thickness','format','Double');
Index: issm/oecreview/Archive/16554-17801/ISSM-16855-16856.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16855-16856.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16855-16856.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/test/NightlyRun/test333.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test333.m	(revision 16855)
++++ ../trunk-jpl/test/NightlyRun/test333.m	(revision 16856)
+@@ -14,7 +14,7 @@
+ 
+ md.initialization.epl_head=0.0*ones(md.mesh.numberofvertices,1);
+ md.hydrology.spcepl_head=NaN*ones(md.mesh.numberofvertices,1);
+-md.hydrology.mask_eplactive=0*ones(md.mesh.numberofvertices,1);
++md.hydrology.mask_eplactive_node=0*ones(md.mesh.numberofvertices,1);
+ md.basalforcings.melting_rate = 2.0*ones(md.mesh.numberofvertices,1);
+ md.hydrology.epl_conductivity=30;
+ md.hydrology.epl_initial_thickness=1;
+Index: ../trunk-jpl/test/NightlyRun/test335.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test335.m	(revision 16855)
++++ ../trunk-jpl/test/NightlyRun/test335.m	(revision 16856)
+@@ -14,7 +14,7 @@
+ 
+ md.initialization.epl_head=0.0*ones(md.mesh.numberofvertices,1);
+ md.hydrology.spcepl_head=NaN*ones(md.mesh.numberofvertices,1);
+-md.hydrology.mask_eplactive=0*ones(md.mesh.numberofvertices,1);
++md.hydrology.mask_eplactive_node=0*ones(md.mesh.numberofvertices,1);
+ md.basalforcings.melting_rate = 2.0*ones(md.mesh.numberofvertices,1);
+ md.hydrology.epl_conductivity=30;
+ md.hydrology.epl_initial_thickness=1;
Index: issm/oecreview/Archive/16554-17801/ISSM-16856-16857.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16856-16857.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16856-16857.diff	(revision 17802)
@@ -0,0 +1,31 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16856)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16857)
+@@ -6672,7 +6672,7 @@
+ 		water_input->GetInputValue(&water_load,gauss);
+ 		transfer_input->GetInputValue(&transfer,gauss);
+ 		scalar = Jdet*gauss->weight*(water_load+transfer);
+-		printf("are we loading: load,%e ,transfer,%e\n",water_load, transfer);
++		//printf("are we loading: load,%e ,transfer,%e\n",water_load, transfer);
+ 		if(reCast<bool,IssmDouble>(dt)) scalar = scalar*dt;
+ 		for(int i=0;i<numnodes;i++) pe->values[i]+=scalar*basis[i];
+ 
+@@ -6966,7 +6966,7 @@
+ 			sed_trans = matpar->GetSedimentTransmitivity();
+ 			sed_thick = matpar->GetSedimentThickness();
+ 
+-			printf("Which analyse %i \n",analysis_type);
++			//		printf("Which analyse %i \n",analysis_type);
+ 
+ 			if(!this->AnyActive()){
+ 
+@@ -6999,7 +6999,7 @@
+ 					}
+ 					/*Assign output pointer*/
+ 					transfer->SetValue(doflist[i],wh_trans,INS_VAL);
+-					printf("Computing, %e \n",wh_trans);
++					//printf("Computing, %e \n",wh_trans);
+ 				}
+ 			}
+ 			break;
Index: issm/oecreview/Archive/16554-17801/ISSM-16857-16858.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16857-16858.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16857-16858.diff	(revision 17802)
@@ -0,0 +1,28 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 16857)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 16858)
+@@ -118,7 +118,7 @@
+ 	}
+ 
+ 	/*Check that all nodes are active, else return empty matrix*/
+-	if(element->AllActive()) return NULL;
++	if(basalelement->AllActive()) return NULL;
+ 
+ 	/*Intermediaries */
+ 	IssmDouble dt,scalar,water_head;
+@@ -138,10 +138,10 @@
+ 	basalelement->GetVerticesCoordinates(&xyz_list);
+ 	IssmDouble epl_specificstoring = EplSpecificStoring(basalelement);
+ 	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
+-	Input* residual_input    = element->GetInput(SedimentHeadResidualEnum);    _assert_(residual_input);
+-	Input* transfer_input    = element->GetInput(WaterTransferEnum);           _assert_(transfer_input);
+-	Input* thickness_input   = element->GetInput(HydrologydcEplThicknessEnum); _assert_(thickness_input);
+-	if(dt!= 0.){old_wh_input = element->GetInput(EplHeadOldEnum);              _assert_(old_wh_input);}
++	Input* residual_input    = basalelement->GetInput(SedimentHeadResidualEnum);    _assert_(residual_input);
++	Input* transfer_input    = basalelement->GetInput(WaterTransferEnum);           _assert_(transfer_input);
++	Input* thickness_input   = basalelement->GetInput(HydrologydcEplThicknessEnum); _assert_(thickness_input);
++	if(dt!= 0.){old_wh_input = basalelement->GetInput(EplHeadOldEnum);              _assert_(old_wh_input);}
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	Gauss* gauss=basalelement->NewGauss(2);
Index: issm/oecreview/Archive/16554-17801/ISSM-16858-16859.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16858-16859.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16858-16859.diff	(revision 17802)
@@ -0,0 +1,172 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16858)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16859)
+@@ -37,6 +37,9 @@
+ 		void GetBSSAprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void InputUpdateFromSolutionSSA(IssmDouble* solution,Element* element);
+ 		/*L1L2*/
++		ElementVector* CreatePVectorL1L2(Element* element);
++		ElementVector* CreatePVectorL1L2DrivingStress(Element* element);
++		ElementVector* CreatePVectorL1L2Front(Element* element);
+ 		void InputUpdateFromSolutionL1L2(IssmDouble* solution,Element* element);
+ 		/*HO*/
+ 		ElementMatrix* CreateKMatrixHO(Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16858)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16859)
+@@ -838,6 +838,8 @@
+ 			return NULL;
+ 		case SSAApproximationEnum: 
+ 			return CreatePVectorSSA(element);
++		case L1L2ApproximationEnum: 
++			return CreatePVectorL1L2(element);
+ 		case HOApproximationEnum: 
+ 			return CreatePVectorHO(element);
+ 		case FSApproximationEnum: 
+@@ -1338,6 +1340,144 @@
+ }/*}}}*/
+ 
+ /*L1L2*/
++ElementVector* StressbalanceAnalysis::CreatePVectorL1L2(Element* element){/*{{{*/
++
++	/*Intermediaries*/
++	int      meshtype;
++	Element* basalelement;
++
++	/*Get basal element*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*compute all load vectors for this element*/
++	ElementVector* pe1=CreatePVectorL1L2DrivingStress(basalelement);
++	ElementVector* pe2=CreatePVectorL1L2Front(basalelement);
++	ElementVector* pe =new ElementVector(pe1,pe2);
++
++	/*clean-up and return*/
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	delete pe1;
++	delete pe2;
++	return pe;
++}/*}}}*/
++ElementVector* StressbalanceAnalysis::CreatePVectorL1L2DrivingStress(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	IssmDouble  thickness,Jdet,slope[2];
++	IssmDouble* xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and vectors*/
++	ElementVector* pe    = element->NewElementVector(L1L2ApproximationEnum);
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	Input*     thickness_input=element->GetInput(ThicknessEnum); _assert_(thickness_input); 
++	Input*     surface_input  =element->GetInput(SurfaceEnum);   _assert_(surface_input);
++	IssmDouble rhog = element->GetMaterialParameter(MaterialsRhoIceEnum)*element->GetMaterialParameter(ConstantsGEnum);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctions(basis, gauss);
++
++		thickness_input->GetInputValue(&thickness,gauss);
++		surface_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
++
++		for(int i=0;i<numnodes;i++){
++			pe->values[i*2+0]+=-rhog*thickness*slope[0]*Jdet*gauss->weight*basis[i];
++			pe->values[i*2+1]+=-rhog*thickness*slope[1]*Jdet*gauss->weight*basis[i];
++		}
++	}
++
++	/*Transform coordinate system*/
++	element->TransformLoadVectorCoord(pe,XYEnum);
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	return pe;
++}/*}}}*/
++ElementVector* StressbalanceAnalysis::CreatePVectorL1L2Front(Element* element){/*{{{*/
++
++	/*If no front, return NULL*/
++	if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
++
++	/*Intermediaries*/
++	IssmDouble  Jdet,thickness,bed,water_pressure,ice_pressure;
++	IssmDouble  surface_under_water,base_under_water,pressure;
++	IssmDouble *xyz_list = NULL;
++	IssmDouble *xyz_list_front = NULL;
++	IssmDouble  normal[2];
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementVector* pe    = element->NewElementVector(L1L2ApproximationEnum);
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	Input* thickness_input = element->GetInput(ThicknessEnum); _assert_(thickness_input);
++	Input* bed_input       = element->GetInput(BedEnum);       _assert_(bed_input);
++	IssmDouble rho_water   = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble rho_ice     = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	IssmDouble gravity     = element->GetMaterialParameter(ConstantsGEnum);
++	element->GetVerticesCoordinates(&xyz_list);
++	element->ZeroLevelsetCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
++	element->NormalSection(&normal[0],xyz_list_front);
++
++	/*Start looping on Gaussian points*/
++	Gauss* gauss=element->NewGauss(xyz_list,xyz_list_front,3);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++		thickness_input->GetInputValue(&thickness,gauss);
++		bed_input->GetInputValue(&bed,gauss);
++		element->JacobianDeterminantSurface(&Jdet,xyz_list_front,gauss);
++		element->NodalFunctions(basis,gauss);
++
++		surface_under_water = min(0.,thickness+bed); // 0 if the top of the glacier is above water level
++		base_under_water    = min(0.,bed);           // 0 if the bottom of the glacier is above water level
++		water_pressure = 1.0/2.0*gravity*rho_water*(surface_under_water*surface_under_water - base_under_water*base_under_water);
++		ice_pressure   = 1.0/2.0*gravity*rho_ice*thickness*thickness;
++		pressure = ice_pressure + water_pressure;
++
++		for (int i=0;i<numnodes;i++){
++			pe->values[2*i+0]+= pressure*Jdet*gauss->weight*normal[0]*basis[i];
++			pe->values[2*i+1]+= pressure*Jdet*gauss->weight*normal[1]*basis[i];
++		}
++	}
++
++	/*Transform coordinate system*/
++	element->TransformLoadVectorCoord(pe,XYEnum);
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(xyz_list_front);
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	return pe;
++	return NULL;
++}/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionL1L2(IssmDouble* solution,Element* element){/*{{{*/
+ 
+ 	int         i,meshtype;
Index: issm/oecreview/Archive/16554-17801/ISSM-16859-16860.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16859-16860.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16859-16860.diff	(revision 17802)
@@ -0,0 +1,357 @@
+Index: ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 16859)
++++ ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 16860)
+@@ -62,7 +62,97 @@
+ 	_error_("not implemented yet");
+ }/*}}}*/
+ ElementVector* BalancevelocityAnalysis::CreatePVector(Element* element){/*{{{*/
+-_error_("not implemented yet");
++
++	/*Intermediaries*/
++	int      meshtype;
++	Element* basalelement;
++
++	/*Get basal element*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Intermediaries */
++	IssmDouble dhdt,mb,ms,Jdet;
++	IssmDouble gamma,thickness;
++	IssmDouble hnx,hny,dhnx[2],dhny[2];
++	IssmDouble *xyz_list  = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = basalelement->GetNumberOfNodes();
++
++	/*Initialize Element vector*/
++	ElementVector* pe    = basalelement->NewElementVector();
++	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
++	IssmDouble*    dbasis = xNew<IssmDouble>(numnodes*2);
++	IssmDouble*    H      = xNew<IssmDouble>(numnodes);
++	IssmDouble*    Nx     = xNew<IssmDouble>(numnodes);
++	IssmDouble*    Ny     = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	basalelement->GetVerticesCoordinates(&xyz_list);
++	Input* ms_input   = basalelement->GetInput(SurfaceforcingsMassBalanceEnum);     _assert_(ms_input);
++	Input* mb_input   = basalelement->GetInput(BasalforcingsMeltingRateEnum);       _assert_(mb_input);
++	Input* dhdt_input = basalelement->GetInput(BalancethicknessThickeningRateEnum); _assert_(dhdt_input);
++	Input* H_input    = basalelement->GetInput(ThicknessEnum);                      _assert_(H_input);
++	IssmDouble h = basalelement->CharacteristicLength();
++
++	/*Get vector N for all nodes*/
++	basalelement->GetInputListOnNodes(Nx,SurfaceSlopeXEnum);
++	basalelement->GetInputListOnNodes(Ny,SurfaceSlopeYEnum);
++	basalelement->GetInputListOnNodes(H,ThicknessEnum);
++	for(int i=0;i<numnodes;i++){
++		IssmDouble norm=sqrt(Nx[i]*Nx[i]+Ny[i]*Ny[i]+1.e-10);
++		Nx[i] = -H[i]*Nx[i]/norm;
++		Ny[i] = -H[i]*Ny[i]/norm;
++	}
++
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=basalelement->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		basalelement->NodalFunctions(basis,gauss);
++		basalelement->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++		element->ValueP1DerivativesOnGauss(&dhnx[0],Nx,xyz_list,gauss);
++		element->ValueP1DerivativesOnGauss(&dhny[0],Ny,xyz_list,gauss);
++		element->ValueP1OnGauss(&hnx,Nx,gauss);
++		element->ValueP1OnGauss(&hny,Ny,gauss);
++
++		ms_input->GetInputValue(&ms,gauss);
++		mb_input->GetInputValue(&mb,gauss);
++		dhdt_input->GetInputValue(&dhdt,gauss);
++		H_input->GetInputValue(&thickness,gauss);
++		if(thickness<50.) thickness=50.;
++
++		gamma=h/(2.*thickness+1.e-10);
++
++		for(int i=0;i<numnodes;i++){
++			pe->values[i]+=Jdet*gauss->weight*(ms-mb-dhdt)*( basis[i] + gamma*(basis[i]*(dhnx[0]+dhny[1])+hnx*dbasis[0*numnodes+i] + hny*dbasis[1*numnodes+i]));
++		}
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(dbasis);
++	xDelete<IssmDouble>(H);
++	xDelete<IssmDouble>(Nx);
++	xDelete<IssmDouble>(Ny);
++	delete gauss;
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	return pe;
+ }/*}}}*/
+ void BalancevelocityAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 16859)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 16860)
+@@ -48,7 +48,74 @@
+ 	_error_("not implemented yet");
+ }/*}}}*/
+ ElementVector* SmoothedSurfaceSlopeXAnalysis::CreatePVector(Element* element){/*{{{*/
+-_error_("not implemented yet");
++
++	/*Intermediaries*/
++	int      meshtype;
++	Element* basalelement;
++
++	/*Get basal element*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Intermediaries */
++	int         input_enum;
++	IssmDouble  Jdet,thickness,slope[2];
++	IssmDouble  taud_x,norms,normv,vx,vy;
++	IssmDouble *xyz_list  = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = basalelement->GetNumberOfNodes();
++
++	/*Initialize Element vector*/
++	ElementVector* pe    = basalelement->NewElementVector();
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	basalelement->GetVerticesCoordinates(&xyz_list);
++	IssmDouble rho_ice   = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	IssmDouble gravity   = element->GetMaterialParameter(ConstantsGEnum);
++	Input* H_input       = basalelement->GetInput(ThicknessEnum); _assert_(H_input);
++	Input* surface_input = basalelement->GetInput(SurfaceEnum);   _assert_(surface_input);
++	Input* vx_input      = basalelement->GetInput(VxEnum);
++	Input* vy_input      = basalelement->GetInput(VyEnum);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=basalelement->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		basalelement->NodalFunctions(basis,gauss);
++
++		H_input->GetInputValue(&thickness,gauss);
++		surface_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
++		if(vx_input && vy_input){
++			vx_input->GetInputValue(&vx,gauss);
++			vy_input->GetInputValue(&vy,gauss);
++			norms = sqrt(slope[0]*slope[0]+slope[1]*slope[1]+1.e-10);
++			normv = sqrt(vx*vx + vy*vy);
++			if(normv>15./(365.*24.*3600.)) slope[0] = -vx/normv*norms;
++		}
++		taud_x = rho_ice*gravity*thickness*slope[0];
++
++		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*taud_x*basis[i];
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	return pe;
+ }/*}}}*/
+ void SmoothedSurfaceSlopeXAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 16859)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 16860)
+@@ -48,7 +48,74 @@
+ 	_error_("not implemented yet");
+ }/*}}}*/
+ ElementVector* SmoothedSurfaceSlopeYAnalysis::CreatePVector(Element* element){/*{{{*/
+-_error_("not implemented yet");
++
++	/*Intermediaries*/
++	int      meshtype;
++	Element* basalelement;
++
++	/*Get basal element*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Intermediaries */
++	int         input_enum;
++	IssmDouble  Jdet,thickness,slope[2];
++	IssmDouble  taud_y,norms,normv,vx,vy;
++	IssmDouble *xyz_list  = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = basalelement->GetNumberOfNodes();
++
++	/*Initialize Element vector*/
++	ElementVector* pe    = basalelement->NewElementVector();
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	basalelement->GetVerticesCoordinates(&xyz_list);
++	IssmDouble rho_ice   = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	IssmDouble gravity   = element->GetMaterialParameter(ConstantsGEnum);
++	Input* H_input       = basalelement->GetInput(ThicknessEnum); _assert_(H_input);
++	Input* surface_input = basalelement->GetInput(SurfaceEnum);   _assert_(surface_input);
++	Input* vx_input      = basalelement->GetInput(VxEnum);
++	Input* vy_input      = basalelement->GetInput(VyEnum);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=basalelement->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		basalelement->NodalFunctions(basis,gauss);
++
++		H_input->GetInputValue(&thickness,gauss);
++		surface_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
++		if(vx_input && vy_input){
++			vx_input->GetInputValue(&vx,gauss);
++			vy_input->GetInputValue(&vy,gauss);
++			norms = sqrt(slope[0]*slope[0]+slope[1]*slope[1]+1.e-10);
++			normv = sqrt(vx*vx + vy*vy);
++			if(normv>15./(365.*24.*3600.)) slope[1] = -vy/normv*norms;
++		}
++		taud_y = rho_ice*gravity*thickness*slope[1];
++
++		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*taud_y*basis[i];
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	return pe;
+ }/*}}}*/
+ void SmoothedSurfaceSlopeYAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16859)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16860)
+@@ -157,6 +157,8 @@
+ 		virtual void   ReduceMatrices(ElementMatrix* Ke,ElementVector* pe)=0;
+ 		virtual void   ResetCoordinateSystem()=0;
+ 		virtual IssmDouble StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa)=0;
++		virtual void   ValueP1OnGauss(IssmDouble* pvalue,IssmDouble* values,Gauss* gauss)=0;
++		virtual void   ValueP1DerivativesOnGauss(IssmDouble* dvalue,IssmDouble* values,IssmDouble* xyz_list,Gauss* gauss)=0;
+ 		virtual void   ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input)=0;
+ 		virtual void   ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input)=0;
+ 		virtual void   ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16859)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16860)
+@@ -2947,6 +2947,16 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Tria::ValueP1OnGauss{{{*/
++void Tria::ValueP1OnGauss(IssmDouble* pvalue,IssmDouble* values,Gauss* gauss){
++	TriaRef::GetInputValue(pvalue,values,gauss);
++}
++/*}}}*/
++/*FUNCTION Tria::ValueP1DerivativesOnGauss{{{*/
++void Tria::ValueP1DerivativesOnGauss(IssmDouble* dvalue,IssmDouble* values,IssmDouble* xyz_list,Gauss* gauss){
++	TriaRef::GetInputDerivativeValue(dvalue,values,xyz_list,gauss);
++}
++/*}}}*/
+ /*FUNCTION Tria::VertexConnectivity{{{*/
+ int Tria::VertexConnectivity(int vertexindex){
+ 	_assert_(this->vertices);
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16859)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16860)
+@@ -138,6 +138,8 @@
+ 		IssmDouble  SurfaceArea(void);
+ 		void        Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement);
+ 		IssmDouble  TimeAdapt();
++		void   ValueP1OnGauss(IssmDouble* pvalue,IssmDouble* values,Gauss* gauss);
++		void   ValueP1DerivativesOnGauss(IssmDouble* dvalue,IssmDouble* values,IssmDouble* xyz_list,Gauss* gauss);
+ 		int         VertexConnectivity(int vertexindex);
+ 		void   VerticalSegmentIndices(int** pindices,int* pnumseg){_error_("not implemented yet");};
+ 		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16859)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16860)
+@@ -3474,6 +3474,16 @@
+ 	}
+ }
+ /*}}}*/
++/*FUNCTION Penta::ValueP1OnGauss{{{*/
++void Penta::ValueP1OnGauss(IssmDouble* pvalue,IssmDouble* values,Gauss* gauss){
++	PentaRef::GetInputValue(pvalue,values,gauss);
++}
++/*}}}*/
++/*FUNCTION Penta::ValueP1DerivativesOnGauss{{{*/
++void Penta::ValueP1DerivativesOnGauss(IssmDouble* dvalue,IssmDouble* values,IssmDouble* xyz_list,Gauss* gauss){
++	PentaRef::GetInputDerivativeValue(dvalue,values,xyz_list,gauss);
++}
++/*}}}*/
+ /*FUNCTION Penta::VertexConnectivity{{{*/
+ int Penta::VertexConnectivity(int vertexindex){
+ 	_assert_(this->vertices);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16859)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16860)
+@@ -131,6 +131,8 @@
+ 		void   Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement);
+ 		int    NodalValue(IssmDouble* pvalue, int index, int natureofdataenum);
+ 		IssmDouble TimeAdapt();
++		void   ValueP1OnGauss(IssmDouble* pvalue,IssmDouble* values,Gauss* gauss);
++		void   ValueP1DerivativesOnGauss(IssmDouble* dvalue,IssmDouble* values,IssmDouble* xyz_list,Gauss* gauss);
+ 		int    VertexConnectivity(int vertexindex);
+ 		void   VerticalSegmentIndices(int** pindices,int* pnumseg);
+ 		void   ViscousHeatingCreateInput(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16859)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16860)
+@@ -137,6 +137,8 @@
+ 		IssmDouble  StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa){_error_("not implemented yet");};
+ 		IssmDouble  PureIceEnthalpy(IssmDouble pressure){_error_("not implemented yet");};
+ 		int         PressureInterpolation(void){_error_("not implemented yet");};
++		void        ValueP1OnGauss(IssmDouble* pvalue,IssmDouble* values,Gauss* gauss){_error_("not implemented yet");};
++		void        ValueP1DerivativesOnGauss(IssmDouble* dvalue,IssmDouble* values,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		int         VelocityInterpolation(void){_error_("not implemented yet");};
+ 		Input*      GetInput(int inputenum){_error_("not implemented yet");};
+ 		Input*      GetMaterialInput(int inputenum){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16860-16861.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16860-16861.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16860-16861.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 16860)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 16861)
+@@ -724,7 +724,7 @@
+ 			if isa(md.hydrology,'hydrologydc');
+ 				md.hydrology.spcsediment_head=project3d(md,'vector',md.hydrology.spcsediment_head,'type','node','layer',1);
+ 				md.hydrology.spcepl_head=project3d(md,'vector',md.hydrology.spcepl_head,'type','node','layer',1);
+-				md.hydrology.mask_eplactive=project3d(md,'vector',md.hydrology.mask_eplactive,'type','node','layer',1);
++				md.hydrology.mask_eplactive_node=project3d(md,'vector',md.hydrology.mask_eplactive_node,'type','node','layer',1);
+ 	    end
+ 
+ 			%connectivity
Index: issm/oecreview/Archive/16554-17801/ISSM-16861-16862.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16861-16862.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16861-16862.diff	(revision 17802)
@@ -0,0 +1,364 @@
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 16861)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 16862)
+@@ -121,6 +121,10 @@
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
++		case Mesh2DverticalEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			break;
+ 		case Mesh3DEnum:
+ 			if(!element->IsOnBed()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16861)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16862)
+@@ -2053,11 +2053,14 @@
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
++	IssmDouble  rho_ice =element->GetMaterialParameter(MaterialsRhoIceEnum);
++	IssmDouble  gravity =element->GetMaterialParameter(ConstantsGEnum);
+ 	Input*      loadingforcex_input=element->GetInput(LoadingforceXEnum);  _assert_(loadingforcex_input);
+ 	Input*      loadingforcey_input=element->GetInput(LoadingforceYEnum);  _assert_(loadingforcey_input);
+-	Input*      loadingforcez_input=element->GetInput(LoadingforceZEnum);  _assert_(loadingforcez_input);
+-	IssmDouble  rho_ice =element->GetMaterialParameter(MaterialsRhoIceEnum);
+-	IssmDouble  gravity =element->GetMaterialParameter(ConstantsGEnum);
++	Input*      loadingforcez_input=NULL;
++	if(dim==3){
++		loadingforcez_input=element->GetInput(LoadingforceZEnum);  _assert_(loadingforcez_input);
++	}
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	Gauss* gauss=element->NewGauss(5);
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 16861)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 16862)
+@@ -40,7 +40,7 @@
+ 	_error_("not implemented yet");
+ }/*}}}*/
+ ElementVector* ExtrudeFromBaseAnalysis::CreatePVector(Element* element){/*{{{*/
+-_error_("not implemented yet");
++	return NULL;
+ }/*}}}*/
+ void ExtrudeFromBaseAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+Index: ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 16861)
++++ ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 16862)
+@@ -29,7 +29,104 @@
+ 	_error_("not implemented yet");
+ }/*}}}*/
+ ElementVector* AdjointBalancethicknessAnalysis::CreatePVector(Element* element){/*{{{*/
+-_error_("not implemented yet");
++
++	/*Intermediaries*/
++	int      meshtype;
++	Element* basalelement;
++
++	/*Get basal element*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Intermediaries */
++	int         num_responses,i;
++	IssmDouble  dH[2];
++	IssmDouble  vx,vy,vel,Jdet;
++	IssmDouble  thickness,thicknessobs,weight;
++	int        *responses = NULL;
++	IssmDouble *xyz_list  = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = basalelement->GetNumberOfNodes();
++
++	/*Initialize Element vector and vectors*/
++	ElementVector* pe     = basalelement->NewElementVector(SSAApproximationEnum);
++	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
++	IssmDouble*    dbasis = xNew<IssmDouble>(2*numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	basalelement->GetVerticesCoordinates(&xyz_list);
++	basalelement->FindParam(&num_responses,InversionNumCostFunctionsEnum);
++	basalelement->FindParam(&responses,NULL,InversionCostFunctionsEnum);
++	Input* thickness_input    = basalelement->GetInput(ThicknessEnum);                          _assert_(thickness_input);
++	Input* thicknessobs_input = basalelement->GetInput(InversionThicknessObsEnum);              _assert_(thicknessobs_input);
++	Input* weights_input      = basalelement->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
++	Input* vx_input           = basalelement->GetInput(VxEnum);                                 _assert_(vx_input);
++	Input* vy_input           = basalelement->GetInput(VyEnum);                                 _assert_(vy_input);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=basalelement->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		basalelement->NodalFunctions(basis,gauss);
++		basalelement->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++		thickness_input->GetInputValue(&thickness, gauss);
++		thickness_input->GetInputDerivativeValue(&dH[0],xyz_list,gauss);
++		thicknessobs_input->GetInputValue(&thicknessobs, gauss);
++
++		/*Loop over all requested responses*/
++		for(int resp=0;resp<num_responses;resp++){
++			weights_input->GetInputValue(&weight,gauss,responses[resp]);
++
++			switch(responses[resp]){
++				case ThicknessAbsMisfitEnum:
++					for(i=0;i<numnodes;i++) pe->values[i]+=(thicknessobs-thickness)*weight*Jdet*gauss->weight*basis[i];
++					break;
++				case ThicknessAbsGradientEnum:
++					for(i=0;i<numnodes;i++) pe->values[i]+= - weight*dH[0]*dbasis[0*numnodes+i]*Jdet*gauss->weight;
++					for(i=0;i<numnodes;i++) pe->values[i]+= - weight*dH[1]*dbasis[1*numnodes+i]*Jdet*gauss->weight;
++					break;
++				case ThicknessAlongGradientEnum:
++					vx_input->GetInputValue(&vx,gauss);
++					vy_input->GetInputValue(&vy,gauss);
++					vel = sqrt(vx*vx+vy*vy);
++					vx  = vx/(vel+1.e-9);
++					vy  = vy/(vel+1.e-9);
++					for(i=0;i<numnodes;i++) pe->values[i]+= - weight*(dH[0]*vx+dH[1]*vy)*(dbasis[0*numnodes+i]*vx+dbasis[1*numnodes+i]*vy)*Jdet*gauss->weight;
++					break;
++				case ThicknessAcrossGradientEnum:
++					vx_input->GetInputValue(&vx,gauss);
++					vy_input->GetInputValue(&vy,gauss);
++					vel = sqrt(vx*vx+vy*vy);
++					vx  = vx/(vel+1.e-9);
++					vy  = vy/(vel+1.e-9);
++					for(i=0;i<numnodes;i++) pe->values[i]+= - weight*(dH[0]*(-vy)+dH[1]*vx)*(dbasis[0*numnodes+i]*(-vy)+dbasis[1*numnodes+i]*vx)*Jdet*gauss->weight;
++					break;
++				default:
++					_error_("response " << EnumToStringx(responses[resp]) << " not supported yet");
++			}
++		}
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(dbasis);
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	delete gauss;
++	return pe;
+ }/*}}}*/
+ void AdjointBalancethicknessAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	_error_("not implemented yet");
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16861)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16862)
+@@ -2248,6 +2248,14 @@
+ 	return new GaussTria(area_coordinates,order);
+ }
+ /*}}}*/
++/*FUNCTION Tria::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){{{*/
++Gauss* Tria::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){
++
++	IssmDouble  area_coordinates[4][3];
++	GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,xyz_list,4);
++	return new GaussTria(area_coordinates,order_vert);
++}
++/*}}}*/
+ /*FUNCTION Tria::NewElementVector{{{*/
+ ElementVector* Tria::NewElementVector(int approximation_enum){
+ 	return new ElementVector(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
+@@ -2676,15 +2684,20 @@
+ /*FUNCTION Tria::SpawnBasalElement{{{*/
+ Element*  Tria::SpawnBasalElement(void){
+ 
++	int index1,index2;
+ 	int meshtype;
+ 
+-	/*go into parameters and get the analysis_counter: */
+ 	this->parameters->FindParam(&meshtype,MeshTypeEnum);
+-
+-	if(meshtype==Mesh2DhorizontalEnum){
+-		return this;
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			return this;
++		case Mesh2DverticalEnum:
++			_assert_(HasEdgeOnBed());
++			this->EdgeOnBedIndices(&index1,&index2);
++			return SpawnSeg(index1,index2);
++		default:
++			_error_("not implemented yet");
+ 	}
+-	else _error_("not implemented yet");
+ }
+ /*}}}*/
+ /*FUNCTION Tria::SurfaceArea {{{*/
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16861)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16862)
+@@ -295,7 +295,7 @@
+ 		Gauss*         NewGauss(void);
+ 		Gauss*         NewGauss(int order);
+       Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order);
+-      Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){_error_("not implemented yet");};
++      Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert);
+ 		Gauss*         NewGaussBase(int order){_error_("not implemented yet");};
+ 		Gauss*         NewGaussLine(int vertex1,int vertex2,int order){_error_("not implemented yet");};
+ 		Gauss*         NewGaussTop(int order){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 16861)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 16862)
+@@ -513,3 +513,67 @@
+ 	return pe;
+ }
+ /*}}}*/
++/*FUNCTION Seg::DeleteMaterials{{{*/
++void Seg::DeleteMaterials(void){
++	delete this->material;
++}
++/*}}}*/
++/*FUNCTION Seg::GetInput(int inputenum) {{{*/
++Input* Seg::GetInput(int inputenum){
++	return inputs->GetInput(inputenum);
++}
++/*}}}*/
++/*FUNCTION Seg::GetNumberOfNodes;{{{*/
++int Seg::GetNumberOfNodes(void){
++	return this->NumberofNodes();
++}
++/*}}}*/
++/*FUNCTION Seg::GetVerticesCoordinates(IssmDouble** pxyz_list){{{*/
++void Seg::GetVerticesCoordinates(IssmDouble** pxyz_list){
++
++	IssmDouble* xyz_list = xNew<IssmDouble>(NUMVERTICES*3);
++	::GetVerticesCoordinates(xyz_list,this->vertices,NUMVERTICES);
++
++	/*Assign output pointer*/
++	*pxyz_list = xyz_list;
++
++}/*}}}*/
++/*FUNCTION Seg::JacobianDeterminant{{{*/
++void Seg::JacobianDeterminant(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussSegEnum);
++	this->GetJacobianDeterminant(pJdet,xyz_list,(GaussSeg*)gauss);
++
++}
++/*}}}*/
++/*FUNCTION Seg::NewGauss(int order){{{*/
++Gauss* Seg::NewGauss(int order){
++	return new GaussSeg(order);
++}
++/*}}}*/
++/*FUNCTION Seg::NewElementVector{{{*/
++ElementVector* Seg::NewElementVector(int approximation_enum){
++	return new ElementVector(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
++}
++/*}}}*/
++/*FUNCTION Seg::NewElementMatrix{{{*/
++ElementMatrix* Seg::NewElementMatrix(int approximation_enum){
++	return new ElementMatrix(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
++}
++/*}}}*/
++/*FUNCTION Seg::NodalFunctions{{{*/
++void Seg::NodalFunctions(IssmDouble* basis, Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussSegEnum);
++	this->GetNodalFunctions(basis,(GaussSeg*)gauss);
++
++}
++/*}}}*/
++/*FUNCTION Seg::NodalFunctionsDerivatives{{{*/
++void Seg::NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussSegEnum);
++	this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussSeg*)gauss);
++
++}
++/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16861)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16862)
+@@ -76,7 +76,7 @@
+ 		void        ComputeStrainRate(Vector<IssmDouble>* eps){_error_("not implemented yet");};
+ 		void        ComputeStressTensor(){_error_("not implemented yet");};
+ 		void        Configure(Elements* elements,Loads* loads,Nodes* nodesin,Vertices* verticesin,Materials* materials,Parameters* parameters){_error_("not implemented yet");};
+-		void        DeleteMaterials(void){_error_("not implemented yet");};
++		void        DeleteMaterials(void);
+ 		void        SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters){_error_("not implemented yet");};
+ 		void        SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum){_error_("not implemented yet");};
+ 		ElementMatrix* CreateKMatrix(void){_error_("not implemented yet");};
+@@ -103,11 +103,11 @@
+ 		int         GetNodeIndex(Node* node){_error_("not implemented yet");};
+ 		void        GetNodesSidList(int* sidlist){_error_("not implemented yet");};
+ 		void        GetNodesLidList(int* lidlist){_error_("not implemented yet");};
+-		int         GetNumberOfNodes(void){_error_("not implemented yet");};
++		int         GetNumberOfNodes(void);
+ 		int         GetNumberOfNodesVelocity(void){_error_("not implemented yet");};
+ 		int         GetNumberOfNodesPressure(void){_error_("not implemented yet");};
+ 		int         GetNumberOfVertices(void){_error_("not implemented yet");};
+-		void        GetVerticesCoordinates(IssmDouble** pxyz_list){_error_("not implemented yet");};
++		void        GetVerticesCoordinates(IssmDouble** pxyz_list);
+ 		void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list){_error_("not implemented yet");};
+ 		void        GetVerticesCoordinatesTop(IssmDouble** pxyz_list){_error_("not implemented yet");};
+ 		int         Sid(){_error_("not implemented yet");};
+@@ -116,16 +116,16 @@
+ 		bool        IsOnSurface(){_error_("not implemented yet");};
+ 		bool        IsFloating(){_error_("not implemented yet");};
+ 		bool        IsNodeOnShelfFromFlags(IssmDouble* flags){_error_("not implemented yet");};
+-		void        JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
++		void        JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss);
+ 		void        JacobianDeterminantLine(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void        JacobianDeterminantSurface(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void        JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
+ 		void        JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
+ 		IssmDouble  MinEdgeLength(IssmDouble* xyz_list){_error_("not implemented yet");};
+-		void        NodalFunctions(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
++		void        NodalFunctions(IssmDouble* basis,Gauss* gauss);
+ 		void        NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+-		void        NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
++		void        NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+ 		void        NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		bool        NoIceInElement(){_error_("not implemented yet");};
+ 		void        NormalSection(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+@@ -140,7 +140,7 @@
+ 		void        ValueP1OnGauss(IssmDouble* pvalue,IssmDouble* values,Gauss* gauss){_error_("not implemented yet");};
+ 		void        ValueP1DerivativesOnGauss(IssmDouble* dvalue,IssmDouble* values,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		int         VelocityInterpolation(void){_error_("not implemented yet");};
+-		Input*      GetInput(int inputenum){_error_("not implemented yet");};
++		Input*      GetInput(int inputenum);
+ 		Input*      GetMaterialInput(int inputenum){_error_("not implemented yet");};
+ 		void        GetInputListOnVertices(IssmDouble* pvalue,int enumtype){_error_("not implemented yet");};
+ 		void        GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){_error_("not implemented yet");};
+@@ -151,14 +151,14 @@
+ 		void        GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");};
+ 		IssmDouble  GetZcoord(Gauss* gauss){_error_("not implemented yet");};
+ 		Gauss*      NewGauss(void){_error_("not implemented yet");};
+-		Gauss*      NewGauss(int order){_error_("not implemented yet");};
++		Gauss*      NewGauss(int order);
+       Gauss*      NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){_error_("not implemented yet");};
+       Gauss*      NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){_error_("not implemented yet");};
+ 		Gauss*      NewGaussBase(int order){_error_("not implemented yet");};
+ 		Gauss*      NewGaussLine(int vertex1,int vertex2,int order){_error_("not implemented yet");};
+ 		Gauss*      NewGaussTop(int order){_error_("not implemented yet");};
+-		ElementVector* NewElementVector(int approximation_enum){_error_("not implemented yet");};
+-		ElementMatrix* NewElementMatrix(int approximation_enum){_error_("not implemented yet");};
++		ElementVector* NewElementVector(int approximation_enum);
++		ElementMatrix* NewElementMatrix(int approximation_enum);
+ 		int         VertexConnectivity(int vertexindex){_error_("not implemented yet");};
+ 		void        VerticalSegmentIndices(int** pindices,int* pnumseg){_error_("not implemented yet");};
+ 		void        ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16862-16863.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16862-16863.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16862-16863.diff	(revision 17802)
@@ -0,0 +1,154 @@
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 16862)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 16863)
+@@ -118,17 +118,22 @@
+ 	if(!element->IsOnBed()) return NULL;
+ 	Element* basalelement = element->SpawnBasalElement();
+ 
+-	int meshtype;
+-	element->FindParam(&meshtype,MeshTypeEnum);
+-
++	ElementMatrix* Ke = NULL;
+ 	switch(element->FiniteElement()){
+ 		case P1Enum: case P2Enum:
+-			return CreateKMatrixCG(basalelement);
++			Ke = CreateKMatrixCG(basalelement);
++			break;
+ 		case P1DGEnum:
+-			return CreateKMatrixDG(basalelement);
++			Ke = CreateKMatrixDG(basalelement);
++			break;
+ 		default:
+ 			_error_("Element type " << EnumToStringx(element->FiniteElement()) << " not supported yet");
+ 	}
++
++	int meshtype;
++	element->FindParam(&meshtype,MeshTypeEnum);
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	return Ke;
+ }/*}}}*/
+ ElementMatrix* BalancethicknessAnalysis::CreateKMatrixCG(Element* element){/*{{{*/
+ 
+@@ -305,15 +310,22 @@
+ 	if(!element->IsOnBed()) return NULL;
+ 	Element* basalelement = element->SpawnBasalElement();
+ 
++	ElementVector* pe = NULL;
+ 	switch(element->FiniteElement()){
+ 		case P1Enum: case P2Enum:
+-			return CreatePVectorCG(basalelement);
++			pe = CreatePVectorCG(basalelement);
++			break;
+ 		case P1DGEnum:
+-			return CreatePVectorDG(basalelement);
++			pe = CreatePVectorDG(basalelement);
++			break;
+ 		default:
+ 			_error_("Element type " << EnumToStringx(element->FiniteElement()) << " not supported yet");
+ 	}
+ 
++	int meshtype;
++	element->FindParam(&meshtype,MeshTypeEnum);
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	return pe;
+ }/*}}}*/
+ ElementVector* BalancethicknessAnalysis::CreatePVectorCG(Element* element){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 16862)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 16863)
+@@ -237,6 +237,7 @@
+ 
+ 	/*Clean up and return*/
+ 	xDelete<int>(cs_list);
++	xDelete<int>(responses);
+ 	xDelete<IssmDouble>(xyz_list_top);
+ 	xDelete<IssmDouble>(vbasis);
+ 	delete gauss;
+@@ -420,6 +421,7 @@
+ 	element->TransformLoadVectorCoord(pe,XYEnum);
+ 
+ 	/*Clean up and return*/
++	xDelete<int>(responses);
+ 	xDelete<IssmDouble>(xyz_list_top);
+ 	xDelete<IssmDouble>(basis);
+ 	delete gauss;
+@@ -617,6 +619,7 @@
+ 	basalelement->TransformLoadVectorCoord(pe,XYEnum);
+ 
+ 	/*Clean up and return*/
++	xDelete<int>(responses);
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+ 	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+Index: ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 16862)
++++ ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 16863)
+@@ -121,6 +121,7 @@
+ 	}
+ 
+ 	/*Clean up and return*/
++	xDelete<int>(responses);
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+ 	xDelete<IssmDouble>(dbasis);
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16862)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16863)
+@@ -216,17 +216,22 @@
+ 	if(!element->IsOnBed()) return NULL;
+ 	Element* basalelement = element->SpawnBasalElement();
+ 
+-	int meshtype;
+-	element->FindParam(&meshtype,MeshTypeEnum);
+-
++	ElementMatrix* Ke = NULL;
+ 	switch(element->FiniteElement()){
+ 		case P1Enum: case P2Enum:
+-			return CreateKMatrixCG(basalelement);
++			Ke = CreateKMatrixCG(basalelement);
++			break;
+ 		case P1DGEnum:
+-			return CreateKMatrixDG(basalelement);
++			Ke = CreateKMatrixDG(basalelement);
++			break;
+ 		default:
+ 			_error_("Element type " << EnumToStringx(element->FiniteElement()) << " not supported yet");
+ 	}
++
++	int meshtype;
++	element->FindParam(&meshtype,MeshTypeEnum);
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	return Ke;
+ }/*}}}*/
+ ElementMatrix* MasstransportAnalysis::CreateKMatrixCG(Element* element){/*{{{*/
+ 
+@@ -422,15 +427,22 @@
+ 	if(!element->IsOnBed()) return NULL;
+ 	Element* basalelement = element->SpawnBasalElement();
+ 
++	ElementVector* pe = NULL;
+ 	switch(element->FiniteElement()){
+ 		case P1Enum: case P2Enum:
+-			return CreatePVectorCG(basalelement);
++			pe = CreatePVectorCG(basalelement);
++			break;
+ 		case P1DGEnum:
+-			return CreatePVectorDG(basalelement);
++			pe = CreatePVectorDG(basalelement);
++			break;
+ 		default:
+ 			_error_("Element type " << EnumToStringx(element->FiniteElement()) << " not supported yet");
+ 	}
+ 
++	int meshtype;
++	element->FindParam(&meshtype,MeshTypeEnum);
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	return pe;
+ }/*}}}*/
+ ElementVector* MasstransportAnalysis::CreatePVectorCG(Element* element){/*{{{*/
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16863-16864.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16863-16864.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16863-16864.diff	(revision 17802)
@@ -0,0 +1,174 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 16863)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 16864)
+@@ -27,5 +27,6 @@
+ 
+ 		/*Intermediaries*/
+ 		IssmDouble SedimentStoring(Element* element);
++		void ElementizeEplMask(FemModel* femmodel);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16863)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16864)
+@@ -282,3 +282,19 @@
+ 	IssmDouble water_compressibility    = element->GetMaterialParameter(HydrologydcWaterCompressibilityEnum);
+ 	return rho_freshwater*g*sediment_porosity*sediment_thickness*(water_compressibility+(sediment_compressibility/sediment_porosity));		 
+ }/*}}}*/
++void HydrologyDCInefficientAnalysis::ElementizeEplMask(FemModel* femmodel){/*{{{*/
++
++	bool     element_active;
++	Element* element=NULL;
++
++	for(int i=0;i<femmodel->elements->Size();i++){
++		element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++
++		int numvertices = element->GetNumberOfVertices();
++		Input* node_mask_input = element->GetInput(HydrologydcMaskEplactiveNodeEnum);
++		if(node_mask_input->Max()>0.) element_active = true;
++		else                          element_active = false;
++
++		element->AddInput(new BoolInput(HydrologydcMaskEplactiveEltEnum,element_active));
++	}
++}/*}}}*/
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16863)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16864)
+@@ -82,6 +82,11 @@
+ 		/*Iteration on the sediment layer*/
+ 		sedconverged=false;
+ 		for(;;){
++			/*Updating Nodal Mask*/
++			HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
++			analysis->ElementizeEplMask(femmodel);
++			delete analysis;
++
+ 			femmodel->HydrologyTransferx();
+ 			SystemMatricesx(&Kff,&Kfs,&pf,&df,&sediment_kmax,femmodel);
+ 			CreateNodalConstraintsx(&ys,femmodel->nodes,HydrologyDCInefficientAnalysisEnum);
+@@ -142,6 +147,10 @@
+ 				//				femmodel->HydrologyEPLThicknessx();
+ 				//updating mask after the computation of the epl thickness (Allow to close too thin EPL)
+ 				femmodel->HydrologyEPLupdateDomainx();
++				/*Updating Nodal Mask*/
++				HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
++				analysis->ElementizeEplMask(femmodel);
++				delete analysis;
+ 
+ 				femmodel->HydrologyTransferx();
+ 				SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16863)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16864)
+@@ -44,6 +44,7 @@
+ 		virtual void   SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum)=0;
+ 		virtual void   AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
+ 		virtual void   AddInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
++		virtual void   AddInput(Input* input_in)=0;
+ 		virtual void   AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
+ 		virtual ElementMatrix* CreateKMatrix(void)=0;
+ 		virtual void   CreateDVector(Vector<IssmDouble>* df)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16863)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16864)
+@@ -190,6 +190,14 @@
+ 	this->inputs->AddInput(new TriaInput(input_enum,values,interpolation_enum));
+ }
+ /*}}}*/
++/*FUNCTION Tria::AddInput{{{*/
++void  Tria::AddInput(Input* input_in){
++
++	/*Call inputs method*/
++	_assert_(this->inputs);
++	this->inputs->AddInput(input_in);
++}
++/*}}}*/
+ /*FUNCTION Tria::AddMaterialInput{{{*/
+ void  Tria::AddMaterialInput(int input_enum,IssmDouble* values, int interpolation_enum){
+ 
+@@ -6960,6 +6968,8 @@
+ 	IssmDouble epl_specificstoring[numdof],sedstoring[numdof];
+ 	IssmDouble epl_head[numdof],sed_head[numdof];
+ 
++	Input* active_element=NULL;
++
+ 	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+ 
+ 	/*Get the flag to know if the efficient layer is present*/
+@@ -6978,6 +6988,7 @@
+ 
+ 			int analysis_type;
+ 			parameters->FindParam(&analysis_type,AnalysisTypeEnum);
++			active_element=inputs->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element);
+ 
+ 			GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveNodeEnum);
+ 			GetInputListOnVertices(&sed_head[0],SedimentHeadEnum); 
+@@ -6991,7 +7002,7 @@
+ 
+ 			//		printf("Which analyse %i \n",analysis_type);
+ 
+-			if(!this->AnyActive()){
++			if(!active_element){
+ 
+ 				//printf("NoneActive\n");
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16863)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16864)
+@@ -216,6 +216,7 @@
+ 		/*Tria specific routines:{{{*/
+ 		void           AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		void           AddInput(int input_enum, IssmDouble* values, int interpolation_enum);
++		void           AddInput(Input* input_in);
+ 		void           AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		ElementMatrix* CreateKMatrix(void);
+ 		ElementMatrix* CreateKMatrixBalancethickness(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16863)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16864)
+@@ -127,6 +127,14 @@
+ 	this->inputs->AddInput(new PentaInput(input_enum,values,interpolation_enum));
+ }
+ /*}}}*/
++/*FUNCTION Tria::AddInput{{{*/
++void  Penta::AddInput(Input* input_in){
++
++	/*Call inputs method*/
++	_assert_(this->inputs);
++	this->inputs->AddInput(input_in);
++}
++/*}}}*/
+ /*FUNCTION Penta::AddBasalInput{{{*/
+ void  Penta::AddBasalInput(int input_enum,IssmDouble* values, int interpolation_enum){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16863)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16864)
+@@ -204,6 +204,7 @@
+ 		/*Penta specific routines:{{{*/
+ 		void           AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		void           AddInput(int input_enum, IssmDouble* values, int interpolation_enum);
++		void           AddInput(Input* input_in);
+ 		void           AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		void	         NormalBase(IssmDouble* bed_normal, IssmDouble* xyz_list);
+ 		void           NormalSection(IssmDouble* normal,IssmDouble* xyz_list);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16863)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16864)
+@@ -70,6 +70,7 @@
+ 		bool        AnyActive(void){_error_("not implemented yet");};
+ 		void        AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
+ 		void        AddInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
++		void        AddInput(Input* input_in){_error_("not implemented yet");};
+ 		void        AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
+ 		IssmDouble  CharacteristicLength(void){_error_("not implemented yet");};
+ 		void        ComputeBasalStress(Vector<IssmDouble>* sigma_b){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16864-16865.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16864-16865.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16864-16865.diff	(revision 17802)
@@ -0,0 +1,11 @@
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 16864)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 16865)
+@@ -248,5 +248,6 @@
+ 	element->AddMaterialInput(DamageFEnum,f,P1Enum);
+ 	
+ 	/*Clean up and return*/
++	xDelete<IssmDouble>(f);
+ 	delete gauss;
+ }/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16865-16866.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16865-16866.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16865-16866.diff	(revision 17802)
@@ -0,0 +1,199 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16865)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16866)
+@@ -2227,7 +2227,8 @@
+ 		element->JacobianDeterminantSurface(&Jdet,xyz_list_front,gauss);
+ 		element->NodalFunctionsVelocity(vbasis,gauss);
+ 		surface_input->GetInputValue(&surface,gauss);
+-		z=element->GetZcoord(gauss);
++		if(dim==3) z=element->GetZcoord(gauss);
++		else       z=element->GetYcoord(gauss);
+ 		pressure = rho_water*gravity*min(0.,z);//0 if the gaussian point is above water level
+ 
+ 		for (int i=0;i<vnumnodes;i++){
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16865)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16866)
+@@ -119,6 +119,7 @@
+ 		virtual void   GetVerticesCoordinatesBase(IssmDouble** xyz_list)=0;
+ 		virtual void   GetVerticesCoordinatesTop(IssmDouble** xyz_list)=0;
+ 		virtual IssmDouble GetZcoord(Gauss* gauss)=0;
++		virtual IssmDouble GetYcoord(Gauss* gauss)=0;
+ 		virtual void   GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype)=0;
+ 
+ 		virtual IssmDouble SurfaceArea(void)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16865)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16866)
+@@ -1189,6 +1189,24 @@
+ 	*pxyz_list = xyz_list;
+ 
+ }/*}}}*/
++/*FUNCTION Tria::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){{{*/
++void Tria::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){
++
++	int        indices[2];
++	IssmDouble xyz_list[NUMVERTICES][3];
++
++	/*Element XYZ list*/
++	::GetVerticesCoordinates(&xyz_list[0][0],this->vertices,NUMVERTICES);
++
++	/*Allocate Output*/
++	IssmDouble* xyz_list_edge = xNew<IssmDouble>(2*3);
++	this->EdgeOnBedIndices(&indices[0],&indices[1]);
++	for(int i=0;i<2;i++) for(int j=0;j<2;j++) xyz_list_edge[i*3+j]=xyz_list[indices[i]][j];
++
++	/*Assign output pointer*/
++	*pxyz_list = xyz_list_edge;
++
++}/*}}}*/
+ /*FUNCTION Tria::NormalSection{{{*/
+ void Tria::NormalSection(IssmDouble* normal,IssmDouble* xyz_list){
+ 
+@@ -1578,6 +1596,23 @@
+ 	input->GetVectorFromInputs(vector,&vertexpidlist[0]);
+ }
+ /*}}}*/
++/*FUNCTION Tria::GetYcoord {{{*/
++IssmDouble Tria::GetYcoord(Gauss* gauss){
++
++	IssmDouble y;
++	IssmDouble xyz_list[NUMVERTICES][3];
++	IssmDouble y_list[NUMVERTICES];
++
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	for(int i=0;i<NUMVERTICES;i++) y_list[i]=xyz_list[i][1];
++	int backup = this->element_type;
++	this->element_type = P1Enum;
++	TriaRef::GetInputValue(&y,y_list,gauss);
++	this->element_type = backup;
++
++	return y;
++}
++/*}}}*/
+ /*FUNCTION Tria::Id {{{*/
+ int    Tria::Id(){
+ 
+@@ -2043,6 +2078,14 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Tria::JacobianDeterminantBase{{{*/
++void Tria::JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussTriaEnum);
++	this->GetSegmentJacobianDeterminant(pJdet,xyz_list_base,(GaussTria*)gauss);
++
++}
++/*}}}*/
+ /*FUNCTION Tria::JacobianDeterminantSurface{{{*/
+ void Tria::JacobianDeterminantSurface(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){
+ 
+@@ -2264,6 +2307,14 @@
+ 	return new GaussTria(area_coordinates,order_vert);
+ }
+ /*}}}*/
++/*FUNCTION Tria::NewGaussBase(int order){{{*/
++Gauss* Tria::NewGaussBase(int order){
++
++	int indices[2];
++	this->EdgeOnBedIndices(&indices[0],&indices[1]);
++	return new GaussTria(indices[0],indices[1],order);
++}
++/*}}}*/
+ /*FUNCTION Tria::NewElementVector{{{*/
+ ElementVector* Tria::NewElementVector(int approximation_enum){
+ 	return new ElementVector(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
+@@ -2361,6 +2412,22 @@
+ 	return found;
+ }
+ /*}}}*/
++/*FUNCTION Tria::NormalBase {{{*/
++void Tria::NormalBase(IssmDouble* bed_normal,IssmDouble* xyz_list){
++
++	/*Build unit outward pointing vector*/
++	IssmDouble vector[2];
++	IssmDouble norm;
++
++	vector[0]=xyz_list[1*3+0] - xyz_list[0*3+0];
++	vector[1]=xyz_list[1*3+1] - xyz_list[0*3+1];
++
++	norm=sqrt(vector[0]*vector[0] + vector[1]*vector[1]);
++
++	bed_normal[0]= + vector[1]/norm;
++	bed_normal[1]= - vector[0]/norm;
++}
++/*}}}*/
+ /*FUNCTION Tria::VelocityInterpolation{{{*/
+ int Tria::VelocityInterpolation(void){
+ 	return TriaRef::VelocityInterpolation();
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16865)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16866)
+@@ -116,7 +116,7 @@
+ 		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
+ 		void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum);
+ 		void        GetVerticesCoordinates(IssmDouble** pxyz_list);
+-		void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list){_error_("not implemented yet");};
++		void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list);
+ 		void        GetVerticesCoordinatesTop(IssmDouble** pxyz_list){_error_("not implemented yet");};
+ 		void        InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);
+ 		void        InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum=MeshElementsEnum);
+@@ -265,10 +265,11 @@
+ 		void           GetConnectivityList(int* connectivity);
+ 		void           GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating);
+ 		IssmDouble     GetGroundedPortion(IssmDouble* xyz_list);
++		IssmDouble     GetYcoord(Gauss* gauss);
+ 		IssmDouble     GetZcoord(Gauss* gauss){_error_("not implemented");};
+ 		void           NormalSection(IssmDouble* normal,IssmDouble* xyz_list);
+ 		void           NormalTop(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+-		void           NormalBase(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
++		void           NormalBase(IssmDouble* normal,IssmDouble* xyz_list);
+ 		IssmDouble     GetMaterialParameter(int enum_in);
+ 		Input*         GetInput(int inputenum);
+ 		Input*         GetMaterialInput(int inputenum);
+@@ -290,14 +291,14 @@
+ 		void           JacobianDeterminant(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss);
+ 		void           JacobianDeterminantLine(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void           JacobianDeterminantSurface(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss);
+-		void           JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
++		void           JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss);
+ 		void           JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
+ 		IssmDouble     MinEdgeLength(IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		Gauss*         NewGauss(void);
+ 		Gauss*         NewGauss(int order);
+       Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order);
+       Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert);
+-		Gauss*         NewGaussBase(int order){_error_("not implemented yet");};
++		Gauss*         NewGaussBase(int order);
+ 		Gauss*         NewGaussLine(int vertex1,int vertex2,int order){_error_("not implemented yet");};
+ 		Gauss*         NewGaussTop(int order){_error_("not implemented yet");};
+ 		ElementVector* NewElementVector(int approximation_enum);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16865)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16866)
+@@ -101,6 +101,7 @@
+ 		IssmDouble GetMaterialParameter(int enum_in);
+ 		void   GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
+ 		IssmDouble GetZcoord(Gauss* gauss);
++		IssmDouble GetYcoord(Gauss* gauss){_error_("Not implemented");};
+ 		void   GetVectorFromInputs(Vector<IssmDouble>* vector,int name_enum);
+ 		void   GetVerticesCoordinates(IssmDouble** pxyz_list);
+ 		void   GetVerticesCoordinatesBase(IssmDouble** pxyz_list);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16865)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16866)
+@@ -150,6 +150,7 @@
+ 		void        GetInputValue(int* pvalue,int enum_type){_error_("not implemented yet");};
+ 		void        GetInputValue(IssmDouble* pvalue,int enum_type){_error_("not implemented yet");};
+ 		void        GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");};
++		IssmDouble  GetYcoord(Gauss* gauss){_error_("Not implemented");};
+ 		IssmDouble  GetZcoord(Gauss* gauss){_error_("not implemented yet");};
+ 		Gauss*      NewGauss(void){_error_("not implemented yet");};
+ 		Gauss*      NewGauss(int order);
Index: issm/oecreview/Archive/16554-17801/ISSM-16866-16867.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16866-16867.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16866-16867.diff	(revision 17802)
@@ -0,0 +1,36 @@
+Index: ../trunk-jpl/test/NightlyRun/runme.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/runme.m	(revision 16866)
++++ ../trunk-jpl/test/NightlyRun/runme.m	(revision 16867)
+@@ -23,6 +23,7 @@
+ %      'procedure'     'check' :   run the test (default)
+ %                      'update':   update the archive
+ %                      'valgrind': check for memory leaks (default value of md.debug.valgrind needs to be changed manually)
++%      'stoponerror'   1 or 0
+ %
+ %   Usage:
+ %      runme(varargin);
+@@ -221,6 +222,7 @@
+ 					if (error_diff>tolerance);
+ 						disp(sprintf(['ERROR   difference: %-7.2g > %7.2g test id: %i test name: %s field: %s'],...
+ 							error_diff,tolerance,id,id_string,fieldname));
++						if(getfieldvalue(options,'stoponerror',0)), disp('STOP'); return; end
+ 					else
+ 						disp(sprintf(['SUCCESS difference: %-7.2g < %7.2g test id: %i test name: %s field: %s'],...
+ 							error_diff,tolerance,id,id_string,fieldname));
+@@ -246,6 +248,7 @@
+ 					else
+ 						disp(sprintf(['FAILURE difference: N/A test id: %i test name: %s field: %s'],id,id_string,fieldname));
+ 						rethrow(me2);
++						if(getfieldvalue(options,'stoponerror',0)), disp('STOP'); return; end
+ 					end
+ 				end
+ 			end
+@@ -273,6 +276,7 @@
+ 		else
+ 			disp(sprintf(['FAILURE difference: N/A test id: %i test name: %s field: %s'],id,id_string,'N/A'));
+ 			rethrow(me);
++			if(getfieldvalue(options,'stoponerror',0)), disp('STOP'); return; end
+ 		end
+ 		disp(sprintf('%s%i%s','----------------finished:',id,'-----------------------'));
+ 	end
Index: issm/oecreview/Archive/16554-17801/ISSM-16867-16868.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16867-16868.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16867-16868.diff	(revision 17802)
@@ -0,0 +1,55 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16867)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16868)
+@@ -7027,6 +7027,7 @@
+ 	const int  numdof   = NDOF1 *NUMVERTICES;
+ 	int        *doflist = NULL;
+ 	bool       isefficientlayer;
++	bool       active_element;
+ 	int        transfermethod;
+ 	IssmDouble sed_trans,sed_thick;
+ 	IssmDouble leakage,h_max;
+@@ -7035,7 +7036,7 @@
+ 	IssmDouble epl_specificstoring[numdof],sedstoring[numdof];
+ 	IssmDouble epl_head[numdof],sed_head[numdof];
+ 
+-	Input* active_element=NULL;
++	Input* active_element_input=NULL;
+ 
+ 	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+ 
+@@ -7053,9 +7054,8 @@
+ 			break;
+ 		case 1:
+ 
+-			int analysis_type;
+-			parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-			active_element=inputs->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element);
++			active_element_input=inputs->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);
++			active_element_input->GetInputValue(&active_element);
+ 
+ 			GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveNodeEnum);
+ 			GetInputListOnVertices(&sed_head[0],SedimentHeadEnum); 
+@@ -7067,12 +7067,8 @@
+ 			sed_trans = matpar->GetSedimentTransmitivity();
+ 			sed_thick = matpar->GetSedimentThickness();
+ 
+-			//		printf("Which analyse %i \n",analysis_type);
+-
+ 			if(!active_element){
+ 
+-				//printf("NoneActive\n");
+-
+ 				/*No transfer if the EPL is not active*/
+ 				for(int i=0;i<numdof;i++){
+ 					wh_trans=0.0;
+@@ -7100,7 +7096,7 @@
+ 					}
+ 					/*Assign output pointer*/
+ 					transfer->SetValue(doflist[i],wh_trans,INS_VAL);
+-					//printf("Computing, %e \n",wh_trans);
++
+ 				}
+ 			}
+ 			break;
Index: issm/oecreview/Archive/16554-17801/ISSM-16868-16869.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16868-16869.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16868-16869.diff	(revision 17802)
@@ -0,0 +1,132 @@
+Index: ../trunk-jpl/jenkins/windows.sh
+===================================================================
+--- ../trunk-jpl/jenkins/windows.sh	(revision 0)
++++ ../trunk-jpl/jenkins/windows.sh	(revision 16869)
+@@ -0,0 +1,121 @@
++#
++########### Configuration file for Eric Larour's Jenkins run on Windows ############
++
++#-------------------------------#
++# 1: ISSM general configuration #
++#-------------------------------#
++
++#Nightly run name
++NAME="ISSM matlab tests on Windows"
++
++#ISSM Architecture
++ISSM_ARCH="linux-gnu-amd64"
++
++#ISSM CONFIGURATION 
++ISSM_CONFIG='--prefix=$ISSM_DIR\
++	--with-matlab-dir=$MATLAB_DIR \
++	--with-triangle-dir=$ISSM_DIR/externalpackages/triangle/install \
++	--with-metis-dir=$ISSM_DIR/externalpackages/metis/install \
++	--with-mpi-include=$ISSM_DIR/externalpackages/mpich/install/include  \
++	--with-mpi-libflags="-L$ISSM_DIR/externalpackages/mpich/install/lib/ -lmpich" \
++	--with-petsc-dir=$ISSM_DIR/externalpackages/petsc/install \
++	--with-petsc-arch=$ISSM_ARCH \
++	--with-python-dir=$ISSM_DIR/externalpackages/python/install\
++	--with-python-numpy-dir=$ISSM_DIR/externalpackages/python/install/lib/python2.7/site-packages/numpy/core/include/numpy\
++	--with-mumps-dir=$ISSM_DIR/externalpackages/petsc/install/ \
++	--with-blas-lapack-dir=$ISSM_DIR/externalpackages/petsc/install \
++	--with-chaco-dir="$ISSM_DIR/externalpackages/chaco/install" \
++	--with-numthreads=18 \
++	--with-cxxoptflags="-mtune=barcelona -ffast-math -O3 -msse4.2 -Wno-write-strings "\
++	--with-graphics-lib="/usr/lib/x86_64-linux-gnu/libX11.so" \
++	--with-dakota-dir=$ISSM_DIR/externalpackages/dakota/install \
++	--with-boost-dir=$ISSM_DIR/externalpackages/boost/install/ \
++	--with-tao-dir=$ISSM_DIR/externalpackages/tao/install \
++	--enable-debugging '
++
++#MATLAB path
++MATLAB_PATH="/usr/local/matlab80/"
++
++#PYTHON and MATLAB testing
++MATLAB_TEST=1
++PYTHON_TEST=1
++
++#execution path used for parallel runs
++EXECUTION_PATH=$ISSM_DIR/execution
++
++#-----------------------------------#
++# 3: External packages installation #
++#-----------------------------------#
++
++#ISSM_EXTERNALPACKAGES can have 3 values:
++# - "install" install all external packages listed below
++# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
++# - "none"    leave external packages as is
++#             ->skip to section 4
++ISSM_EXTERNALPACKAGES="install"
++EXTERNALPACKAGESDIR=$ISSM_DIR/externalpackages
++
++#List of external pakages to be installed and their installation scripts
++EXTERNALPACKAGES="autotools install.sh                
++						matlab    install.sh                
++						mpich     install-3.0-linux64.sh    
++						cmake     install.sh                
++						petsc     install-3.4-linux64.sh    
++						triangle  install-linux64.sh        
++						boost     install.sh                
++						dakota    install-5.3.1-linux64.sh  
++						tao       install-2.2.sh
++						chaco     install.sh 
++						python        install-2.7.3-linux64.sh    
++						nose          install-linux64-python2.sh  
++						blas          install-linux64.sh          
++						lapack        install-linux64.sh          
++						git           install.sh                  
++						numpy         install-linux64.sh          
++						scipy         install-linux64.sh          
++						hdf5          install.sh                  
++						netcdf        install.sh                  
++						netcdf-python install.sh
++						shell2junit install.sh"
++
++
++#---------------------#
++# 4: ISSM Compilation #
++#---------------------#
++
++#ISSM_COMPILATION can have 2 values:
++# - "yes" compile ISSM
++# - "no"  do not compile ISSM
++ISSM_COMPILATION="yes"
++
++#----------------------#
++# 5: Mail notification #
++#----------------------#
++
++#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
++#sent to the adresses present in $ISSM_DIR/cron/mailinglist.
++SKIPMAIL="no"
++
++#Sender email address
++EMAIL_ADRESS="eric.larour@jpl.nasa.gov"
++
++#Mailing list
++MAILINGLIST="eric.larour@jpl.nasa.gov"
++
++#------------------------#
++# 6: Nightly run options #
++#------------------------#
++
++#number of cpus used in ISSM installation and compilation (one is usually
++#safer as some packages are very sensitive to parallel compilation)
++NUMCPUS_INSTALL=8
++
++#number of cpus used in the nightly runs.
++NUMCPUS_RUN=8
++
++#Nightly run options. The matlab routine runme.m will be called
++#as follows: runme($MATLAB_NROPTIONS). The options must be understandable
++#by Matlab and runme.m
++#ex: "'id',[101 102 103]"
++MATLAB_NROPTIONS=""
++PYTHON_NROPTIONS=""
+
+Property changes on: ../trunk-jpl/jenkins/windows.sh
+___________________________________________________________________
+Name: svn:executable
+   + *
+
Index: issm/oecreview/Archive/16554-17801/ISSM-16869-16870.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16869-16870.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16869-16870.diff	(revision 17802)
@@ -0,0 +1,39 @@
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16869)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16870)
+@@ -82,12 +82,14 @@
+ 		/*Iteration on the sediment layer*/
+ 		sedconverged=false;
+ 		for(;;){
+-			/*Updating Nodal Mask*/
+-			HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
+-			analysis->ElementizeEplMask(femmodel);
+-			delete analysis;
++			if(isefficientlayer){
++				/*Updating Nodal Mask*/
++				HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
++				analysis->ElementizeEplMask(femmodel);
++				delete analysis;
++			}
++			femmodel->HydrologyTransferx();
+ 
+-			femmodel->HydrologyTransferx();
+ 			SystemMatricesx(&Kff,&Kfs,&pf,&df,&sediment_kmax,femmodel);
+ 			CreateNodalConstraintsx(&ys,femmodel->nodes,HydrologyDCInefficientAnalysisEnum);
+ 			Reduceloadx(pf,Kfs,ys); delete Kfs;
+Index: ../trunk-jpl/src/c/cores/hydrology_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/hydrology_core.cpp	(revision 16869)
++++ ../trunk-jpl/src/c/cores/hydrology_core.cpp	(revision 16870)
+@@ -93,8 +93,8 @@
+ 			if(save_results && ((i+1)%output_frequency==0 || (i+1)==nsteps || i==0)){
+ 				if(VerboseSolution()) _printf0_("   saving results \n");
+ 				if(isefficientlayer){
+-					int outputs[8] = {SedimentHeadEnum,SedimentHeadResidualEnum,EplHeadEnum,HydrologydcMaskEplactiveNodeEnum,EplHeadSlopeXEnum,EplHeadSlopeYEnum,HydrologydcEplThicknessEnum,WaterTransferEnum};
+-					femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],8);
++					int outputs[9] = {SedimentHeadEnum,SedimentHeadResidualEnum,EplHeadEnum,HydrologydcMaskEplactiveNodeEnum,HydrologydcMaskEplactiveEltEnum,EplHeadSlopeXEnum,EplHeadSlopeYEnum,HydrologydcEplThicknessEnum,WaterTransferEnum};
++					femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],9);
+ 				}
+ 				else{
+ 					int outputs[2] = {SedimentHeadEnum,SedimentHeadResidualEnum};
Index: issm/oecreview/Archive/16554-17801/ISSM-16870-16871.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16870-16871.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16870-16871.diff	(revision 17802)
@@ -0,0 +1,258 @@
+Index: ../trunk-jpl/jenkins/windows.sh
+===================================================================
+--- ../trunk-jpl/jenkins/windows.sh	(revision 16870)
++++ ../trunk-jpl/jenkins/windows.sh	(revision 16871)
+@@ -1,121 +0,0 @@
+-#
+-########### Configuration file for Eric Larour's Jenkins run on Windows ############
+-
+-#-------------------------------#
+-# 1: ISSM general configuration #
+-#-------------------------------#
+-
+-#Nightly run name
+-NAME="ISSM matlab tests on Windows"
+-
+-#ISSM Architecture
+-ISSM_ARCH="linux-gnu-amd64"
+-
+-#ISSM CONFIGURATION 
+-ISSM_CONFIG='--prefix=$ISSM_DIR\
+-	--with-matlab-dir=$MATLAB_DIR \
+-	--with-triangle-dir=$ISSM_DIR/externalpackages/triangle/install \
+-	--with-metis-dir=$ISSM_DIR/externalpackages/metis/install \
+-	--with-mpi-include=$ISSM_DIR/externalpackages/mpich/install/include  \
+-	--with-mpi-libflags="-L$ISSM_DIR/externalpackages/mpich/install/lib/ -lmpich" \
+-	--with-petsc-dir=$ISSM_DIR/externalpackages/petsc/install \
+-	--with-petsc-arch=$ISSM_ARCH \
+-	--with-python-dir=$ISSM_DIR/externalpackages/python/install\
+-	--with-python-numpy-dir=$ISSM_DIR/externalpackages/python/install/lib/python2.7/site-packages/numpy/core/include/numpy\
+-	--with-mumps-dir=$ISSM_DIR/externalpackages/petsc/install/ \
+-	--with-blas-lapack-dir=$ISSM_DIR/externalpackages/petsc/install \
+-	--with-chaco-dir="$ISSM_DIR/externalpackages/chaco/install" \
+-	--with-numthreads=18 \
+-	--with-cxxoptflags="-mtune=barcelona -ffast-math -O3 -msse4.2 -Wno-write-strings "\
+-	--with-graphics-lib="/usr/lib/x86_64-linux-gnu/libX11.so" \
+-	--with-dakota-dir=$ISSM_DIR/externalpackages/dakota/install \
+-	--with-boost-dir=$ISSM_DIR/externalpackages/boost/install/ \
+-	--with-tao-dir=$ISSM_DIR/externalpackages/tao/install \
+-	--enable-debugging '
+-
+-#MATLAB path
+-MATLAB_PATH="/usr/local/matlab80/"
+-
+-#PYTHON and MATLAB testing
+-MATLAB_TEST=1
+-PYTHON_TEST=1
+-
+-#execution path used for parallel runs
+-EXECUTION_PATH=$ISSM_DIR/execution
+-
+-#-----------------------------------#
+-# 3: External packages installation #
+-#-----------------------------------#
+-
+-#ISSM_EXTERNALPACKAGES can have 3 values:
+-# - "install" install all external packages listed below
+-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
+-# - "none"    leave external packages as is
+-#             ->skip to section 4
+-ISSM_EXTERNALPACKAGES="install"
+-EXTERNALPACKAGESDIR=$ISSM_DIR/externalpackages
+-
+-#List of external pakages to be installed and their installation scripts
+-EXTERNALPACKAGES="autotools install.sh                
+-						matlab    install.sh                
+-						mpich     install-3.0-linux64.sh    
+-						cmake     install.sh                
+-						petsc     install-3.4-linux64.sh    
+-						triangle  install-linux64.sh        
+-						boost     install.sh                
+-						dakota    install-5.3.1-linux64.sh  
+-						tao       install-2.2.sh
+-						chaco     install.sh 
+-						python        install-2.7.3-linux64.sh    
+-						nose          install-linux64-python2.sh  
+-						blas          install-linux64.sh          
+-						lapack        install-linux64.sh          
+-						git           install.sh                  
+-						numpy         install-linux64.sh          
+-						scipy         install-linux64.sh          
+-						hdf5          install.sh                  
+-						netcdf        install.sh                  
+-						netcdf-python install.sh
+-						shell2junit install.sh"
+-
+-
+-#---------------------#
+-# 4: ISSM Compilation #
+-#---------------------#
+-
+-#ISSM_COMPILATION can have 2 values:
+-# - "yes" compile ISSM
+-# - "no"  do not compile ISSM
+-ISSM_COMPILATION="yes"
+-
+-#----------------------#
+-# 5: Mail notification #
+-#----------------------#
+-
+-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
+-#sent to the adresses present in $ISSM_DIR/cron/mailinglist.
+-SKIPMAIL="no"
+-
+-#Sender email address
+-EMAIL_ADRESS="eric.larour@jpl.nasa.gov"
+-
+-#Mailing list
+-MAILINGLIST="eric.larour@jpl.nasa.gov"
+-
+-#------------------------#
+-# 6: Nightly run options #
+-#------------------------#
+-
+-#number of cpus used in ISSM installation and compilation (one is usually
+-#safer as some packages are very sensitive to parallel compilation)
+-NUMCPUS_INSTALL=8
+-
+-#number of cpus used in the nightly runs.
+-NUMCPUS_RUN=8
+-
+-#Nightly run options. The matlab routine runme.m will be called
+-#as follows: runme($MATLAB_NROPTIONS). The options must be understandable
+-#by Matlab and runme.m
+-#ex: "'id',[101 102 103]"
+-MATLAB_NROPTIONS=""
+-PYTHON_NROPTIONS=""
+Index: ../trunk-jpl/jenkins/windows
+===================================================================
+--- ../trunk-jpl/jenkins/windows	(revision 0)
++++ ../trunk-jpl/jenkins/windows	(revision 16871)
+@@ -0,0 +1,121 @@
++#
++########### Configuration file for Eric Larour's Jenkins run on Windows ############
++
++#-------------------------------#
++# 1: ISSM general configuration #
++#-------------------------------#
++
++#Nightly run name
++NAME="ISSM matlab tests on Windows"
++
++#ISSM Architecture
++ISSM_ARCH="linux-gnu-amd64"
++
++#ISSM CONFIGURATION 
++ISSM_CONFIG='--prefix=$ISSM_DIR\
++	--with-matlab-dir=$MATLAB_DIR \
++	--with-triangle-dir=$ISSM_DIR/externalpackages/triangle/install \
++	--with-metis-dir=$ISSM_DIR/externalpackages/metis/install \
++	--with-mpi-include=$ISSM_DIR/externalpackages/mpich/install/include  \
++	--with-mpi-libflags="-L$ISSM_DIR/externalpackages/mpich/install/lib/ -lmpich" \
++	--with-petsc-dir=$ISSM_DIR/externalpackages/petsc/install \
++	--with-petsc-arch=$ISSM_ARCH \
++	--with-python-dir=$ISSM_DIR/externalpackages/python/install\
++	--with-python-numpy-dir=$ISSM_DIR/externalpackages/python/install/lib/python2.7/site-packages/numpy/core/include/numpy\
++	--with-mumps-dir=$ISSM_DIR/externalpackages/petsc/install/ \
++	--with-blas-lapack-dir=$ISSM_DIR/externalpackages/petsc/install \
++	--with-chaco-dir="$ISSM_DIR/externalpackages/chaco/install" \
++	--with-numthreads=18 \
++	--with-cxxoptflags="-mtune=barcelona -ffast-math -O3 -msse4.2 -Wno-write-strings "\
++	--with-graphics-lib="/usr/lib/x86_64-linux-gnu/libX11.so" \
++	--with-dakota-dir=$ISSM_DIR/externalpackages/dakota/install \
++	--with-boost-dir=$ISSM_DIR/externalpackages/boost/install/ \
++	--with-tao-dir=$ISSM_DIR/externalpackages/tao/install \
++	--enable-debugging '
++
++#MATLAB path
++MATLAB_PATH="/usr/local/matlab80/"
++
++#PYTHON and MATLAB testing
++MATLAB_TEST=1
++PYTHON_TEST=1
++
++#execution path used for parallel runs
++EXECUTION_PATH=$ISSM_DIR/execution
++
++#-----------------------------------#
++# 3: External packages installation #
++#-----------------------------------#
++
++#ISSM_EXTERNALPACKAGES can have 3 values:
++# - "install" install all external packages listed below
++# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
++# - "none"    leave external packages as is
++#             ->skip to section 4
++ISSM_EXTERNALPACKAGES="install"
++EXTERNALPACKAGESDIR=$ISSM_DIR/externalpackages
++
++#List of external pakages to be installed and their installation scripts
++EXTERNALPACKAGES="autotools install.sh                
++						matlab    install.sh                
++						mpich     install-3.0-linux64.sh    
++						cmake     install.sh                
++						petsc     install-3.4-linux64.sh    
++						triangle  install-linux64.sh        
++						boost     install.sh                
++						dakota    install-5.3.1-linux64.sh  
++						tao       install-2.2.sh
++						chaco     install.sh 
++						python        install-2.7.3-linux64.sh    
++						nose          install-linux64-python2.sh  
++						blas          install-linux64.sh          
++						lapack        install-linux64.sh          
++						git           install.sh                  
++						numpy         install-linux64.sh          
++						scipy         install-linux64.sh          
++						hdf5          install.sh                  
++						netcdf        install.sh                  
++						netcdf-python install.sh
++						shell2junit install.sh"
++
++
++#---------------------#
++# 4: ISSM Compilation #
++#---------------------#
++
++#ISSM_COMPILATION can have 2 values:
++# - "yes" compile ISSM
++# - "no"  do not compile ISSM
++ISSM_COMPILATION="yes"
++
++#----------------------#
++# 5: Mail notification #
++#----------------------#
++
++#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
++#sent to the adresses present in $ISSM_DIR/cron/mailinglist.
++SKIPMAIL="no"
++
++#Sender email address
++EMAIL_ADRESS="eric.larour@jpl.nasa.gov"
++
++#Mailing list
++MAILINGLIST="eric.larour@jpl.nasa.gov"
++
++#------------------------#
++# 6: Nightly run options #
++#------------------------#
++
++#number of cpus used in ISSM installation and compilation (one is usually
++#safer as some packages are very sensitive to parallel compilation)
++NUMCPUS_INSTALL=8
++
++#number of cpus used in the nightly runs.
++NUMCPUS_RUN=8
++
++#Nightly run options. The matlab routine runme.m will be called
++#as follows: runme($MATLAB_NROPTIONS). The options must be understandable
++#by Matlab and runme.m
++#ex: "'id',[101 102 103]"
++MATLAB_NROPTIONS=""
++PYTHON_NROPTIONS=""
+
+Property changes on: ../trunk-jpl/jenkins/windows
+___________________________________________________________________
+Name: svn:executable
+   + *
+
Index: issm/oecreview/Archive/16554-17801/ISSM-16871-16872.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16871-16872.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16871-16872.diff	(revision 17802)
@@ -0,0 +1,269 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16871)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16872)
+@@ -34,6 +34,7 @@
+ 		ElementVector* CreatePVectorSSADrivingStress(Element* element);
+ 		ElementVector* CreatePVectorSSAFront(Element* element);
+ 		void GetBSSA(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBSSAFriction(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetBSSAprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void InputUpdateFromSolutionSSA(IssmDouble* solution,Element* element);
+ 		/*L1L2*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16871)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16872)
+@@ -973,6 +973,87 @@
+ 	delete Ke2;
+ 	return Ke;
+ }/*}}}*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSAFriction(Element* element){/*{{{*/
++	/*Intermediaries*/
++	bool       mainlyfloating;
++	int        analysis_type,migration_style,point1;
++	IssmDouble alpha2,Jdet,fraction1,fraction2;
++	IssmDouble phi=1.0;
++	IssmDouble D_scalar,gllevelset;
++	IssmDouble *xyz_list = NULL;
++	Friction   *friction = NULL;
++	Gauss*     gauss     = NULL;
++
++	/*Return if element is inactive*/
++	if(element->IsFloating()) return NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++	int numdof   = numnodes*2;
++
++	/*Initialize Element matrix and vectors*/
++	ElementMatrix* Ke     = element->NewElementMatrix(SSAApproximationEnum);
++	IssmDouble*    B      = xNew<IssmDouble>(2*numdof);
++	IssmDouble*    D      = xNewZeroInit<IssmDouble>(2*2);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	element->FindParam(&migration_style,GroundinglineMigrationEnum);
++	Input* surface_input=element->GetInput(SurfaceEnum); _assert_(surface_input);
++	Input* vx_input=element->GetInput(VxEnum);           _assert_(vx_input);
++	Input* vy_input=element->GetInput(VyEnum);           _assert_(vy_input);
++	Input* gllevelset_input=NULL;
++	element->FindParam(&analysis_type,AnalysisTypeEnum);
++
++	/*build friction object, used later on: */
++	//friction=new Friction("2d",inputs,matpar,analysis_type);
++
++	/*Recover portion of element that is grounded*/
++	if(migration_style==SubelementMigrationEnum) phi=element->GetGroundedPortion(xyz_list);
++	if(migration_style==SubelementMigration2Enum){
++		gllevelset_input=element->GetInput(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input);
++		element->GetGroundedPart(&point1,&fraction1,&fraction2,&mainlyfloating);
++	   gauss = element->NewGauss(point1,fraction1,fraction2,mainlyfloating,2);
++	}
++	else{
++		gauss = element->NewGauss(2);
++	}
++
++	/* Start  looping on the number of gaussian points: */
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++
++		//friction->GetAlpha2(&alpha2, gauss,VxEnum,VyEnum,VzEnum);
++		alpha2=1.0;
++		if(migration_style==SubelementMigrationEnum) alpha2=phi*alpha2;
++		if(migration_style==SubelementMigration2Enum){
++			gllevelset_input->GetInputValue(&gllevelset, gauss);
++			if(gllevelset<0) alpha2=0;
++		}
++
++		this->GetBSSAFriction(B, element, xyz_list, gauss);
++		element->JacobianDeterminant(&Jdet, xyz_list,gauss);
++		D_scalar=alpha2*gauss->weight*Jdet;
++		for(int i=0;i<2;i++) D[i*2+i]=D_scalar;
++
++		TripleMultiply(B,2,numdof,1,
++					D,2,2,0,
++					B,2,numdof,0,
++					&Ke->values[0],1);
++	}
++
++	/*Transform Coordinate System*/
++	element->TransformStiffnessMatrixCoord(Ke,XYEnum);
++
++	/*Clean up and return*/
++	delete gauss;
++	delete friction;
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(D);
++	xDelete<IssmDouble>(B);
++	return Ke;
++}/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSAViscous(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+@@ -1034,9 +1115,6 @@
+ 	xDelete<IssmDouble>(B);
+ 	return Ke;
+ }/*}}}*/
+-ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSAFriction(Element* element){/*{{{*/
+-	return NULL;
+-}/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorSSA(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+@@ -1207,6 +1285,35 @@
+ 	/*Clean-up*/
+ 	xDelete<IssmDouble>(dbasis);
+ }/*}}}*/
++void StressbalanceAnalysis::GetBSSAFriction(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B  matrix. B=[B1 B2 B3] where Bi is square and of size 2. 
++	 * For node i, Bi can be expressed in the actual coordinate system
++	 * by: 
++	 *                 Bi=[ N   0 ]
++	 *                    [ 0   N ]
++	 * where N is the finiteelement function for node i.
++	 *
++	 * We assume B has been allocated already, of size: 2 x (numdof*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* basis=xNew<IssmDouble>(numnodes);
++	element->NodalFunctions(basis,gauss);
++
++	/*Build L: */
++	for(int i=0;i<numnodes;i++){
++		B[2*numnodes*0+2*i+0] = basis[i];
++		B[2*numnodes*0+2*i+1] = 0.;
++		B[2*numnodes*1+2*i+0] = 0.;
++		B[2*numnodes*1+2*i+1] = basis[i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(basis);
++}/*}}}*/
+ void StressbalanceAnalysis::GetBSSAprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 
+ 	 * For node i, Bi' can be expressed in the actual coordinate system
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16871)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16872)
+@@ -105,6 +105,8 @@
+ 		virtual bool   IsNodeOnShelfFromFlags(IssmDouble* flags)=0; 
+ 		virtual bool   IsOnBed()=0;
+ 		virtual bool   IsOnSurface()=0;
++		virtual void   GetGroundedPart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* mainlyfloating)=0;
++		virtual IssmDouble GetGroundedPortion(IssmDouble* xyz_list)=0;
+ 		virtual void   GetInputListOnNodes(IssmDouble* pvalue,int enumtype)=0;
+ 		virtual void   GetInputListOnNodes(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue)=0;
+ 		virtual void   GetInputListOnVertices(IssmDouble* pvalue,int enumtype)=0;
+@@ -143,6 +145,7 @@
+ 		virtual Gauss* NewGauss(int order)=0;
+       virtual Gauss* NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order)=0;
+       virtual Gauss* NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert)=0;
++      virtual Gauss* NewGauss(int point1,IssmDouble fraction1,IssmDouble fraction2,bool mainlyfloating,int order)=0;
+ 		virtual Gauss* NewGaussBase(int order)=0;
+ 		virtual Gauss* NewGaussLine(int vertex1,int vertex2,int order)=0;
+ 		virtual Gauss* NewGaussTop(int order)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16871)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16872)
+@@ -2299,6 +2299,12 @@
+ 	return new GaussTria(area_coordinates,order);
+ }
+ /*}}}*/
++/*FUNCTION Tria::NewGauss(int point1,IssmDouble fraction1,IssmDouble fraction2,bool mainlyfloating){{{*/
++Gauss* Tria::NewGauss(int point1,IssmDouble fraction1,IssmDouble fraction2,bool mainlyfloating,int order){
++
++	return new GaussTria(point1,fraction1,fraction2,mainlyfloating,order);
++}
++/*}}}*/
+ /*FUNCTION Tria::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){{{*/
+ Gauss* Tria::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16871)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16872)
+@@ -90,6 +90,8 @@
+ 		void	      GetDofList(int** pdoflist,int approximation_enum,int setenum);
+ 		void	      GetDofListVelocity(int** pdoflist,int setenum);
+ 		void	      GetDofListPressure(int** pdoflist,int setenum);
++		void        GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating);
++		IssmDouble  GetGroundedPortion(IssmDouble* xyz_list);
+ 		int         GetNodeIndex(Node* node);
+ 		void        GetNodesSidList(int* sidlist);
+ 		void        GetNodesLidList(int* lidlist);
+@@ -263,8 +265,6 @@
+ 		void	         GetVertexPidList(int* doflist);
+ 		void           GetVertexSidList(int* sidlist);
+ 		void           GetConnectivityList(int* connectivity);
+-		void           GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating);
+-		IssmDouble     GetGroundedPortion(IssmDouble* xyz_list);
+ 		IssmDouble     GetYcoord(Gauss* gauss);
+ 		IssmDouble     GetZcoord(Gauss* gauss){_error_("not implemented");};
+ 		void           NormalSection(IssmDouble* normal,IssmDouble* xyz_list);
+@@ -297,6 +297,7 @@
+ 		Gauss*         NewGauss(void);
+ 		Gauss*         NewGauss(int order);
+       Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order);
++      Gauss*         NewGauss(int point1,IssmDouble fraction1,IssmDouble fraction2,bool mainlyfloating,int order);
+       Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert);
+ 		Gauss*         NewGaussBase(int order);
+ 		Gauss*         NewGaussLine(int vertex1,int vertex2,int order){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16871)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16872)
+@@ -91,6 +91,8 @@
+ 		void	 GetDofList(int** pdoflist,int approximation_enum,int setenum);
+ 		void	 GetDofListVelocity(int** pdoflist,int setenum);
+ 		void	 GetDofListPressure(int** pdoflist,int setenum);
++		void   GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating);
++		IssmDouble GetGroundedPortion(IssmDouble* xyz_list);
+ 		int    GetNodeIndex(Node* node);
+ 		void   GetNodesSidList(int* sidlist);
+ 		void   GetNodesLidList(int* lidlist);
+@@ -227,8 +229,6 @@
+ 		void	         GetVertexPidList(int* doflist);
+ 		void           GetVertexSidList(int* sidlist);
+ 		void           GetConnectivityList(int* connectivity);
+-		void           GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating);
+-		IssmDouble     GetGroundedPortion(IssmDouble* xyz_list);
+ 		int            GetElementType(void);
+ 		Input*         GetInput(int inputenum);
+ 		Input*         GetMaterialInput(int inputenum);
+@@ -265,6 +265,7 @@
+ 		Gauss*         NewGauss(int order);
+       Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){_error_("not implemented yet");};
+       Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert);
++      Gauss*         NewGauss(int point1,IssmDouble fraction1,IssmDouble fraction2,bool mainlyfloating,int order){_error_("not implemented yet");};
+ 		Gauss*         NewGaussBase(int order);
+ 		Gauss*         NewGaussLine(int vertex1,int vertex2,int order);
+ 		Gauss*         NewGaussTop(int order);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16871)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16872)
+@@ -141,6 +141,8 @@
+ 		void        ValueP1OnGauss(IssmDouble* pvalue,IssmDouble* values,Gauss* gauss){_error_("not implemented yet");};
+ 		void        ValueP1DerivativesOnGauss(IssmDouble* dvalue,IssmDouble* values,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		int         VelocityInterpolation(void){_error_("not implemented yet");};
++		void        GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating){_error_("not implemented yet");};
++		IssmDouble  GetGroundedPortion(IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		Input*      GetInput(int inputenum);
+ 		Input*      GetMaterialInput(int inputenum){_error_("not implemented yet");};
+ 		void        GetInputListOnVertices(IssmDouble* pvalue,int enumtype){_error_("not implemented yet");};
+@@ -156,6 +158,7 @@
+ 		Gauss*      NewGauss(int order);
+       Gauss*      NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){_error_("not implemented yet");};
+       Gauss*      NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){_error_("not implemented yet");};
++      Gauss*      NewGauss(int point1,IssmDouble fraction1,IssmDouble fraction2,bool mainlyfloating,int order){_error_("not implemented yet");};
+ 		Gauss*      NewGaussBase(int order){_error_("not implemented yet");};
+ 		Gauss*      NewGaussLine(int vertex1,int vertex2,int order){_error_("not implemented yet");};
+ 		Gauss*      NewGaussTop(int order){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16872-16873.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16872-16873.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16872-16873.diff	(revision 17802)
@@ -0,0 +1,792 @@
+Index: ../trunk-jpl/src/c/classes/Loads/Friction.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Friction.h	(revision 16872)
++++ ../trunk-jpl/src/c/classes/Loads/Friction.h	(revision 16873)
+@@ -18,23 +18,17 @@
+ 	public:
+ 		int analysis_type;
+ 
+-		char* element_type;
+-		Inputs* inputs;
+-		Matpar* matpar;
++		Element* element;
++		int      dim;
+ 
+ 		/*methods: */
+ 		Friction();
+-		Friction(const char* element_type, Inputs* inputs,Matpar* matpar, int analysis_type);
++		Friction(Element* element_in,int dim_in);
+ 		~Friction();
+ 
+ 		void  Echo(void);
+-		void  GetAlpha2(IssmDouble* palpha2, GaussTria* gauss,int vxenum,int vyenum,int vzenum);
+-		void  GetAlpha2(IssmDouble* palpha2, GaussPenta* gauss,int vxenum,int vyenum,int vzenum);
+-		void  GetAlphaComplement(IssmDouble* alpha_complement, GaussTria* gauss,int vxenum,int vyenum,int vzenum);
+-		void  GetAlphaComplement(IssmDouble* alpha_complement, GaussPenta* gauss,int vxenum,int vyenum,int vzenum);
+-		void  GetInputValue(IssmDouble* pvalue,GaussTria* gauss,int enum_type);
+-		void  GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,int enum_type);
+-
++		void  GetAlpha2(IssmDouble* palpha2, Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
++		void  GetAlphaComplement(IssmDouble* alpha_complement,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+ };
+ 
+ #endif  /* _FRICTION_H_ */
+Index: ../trunk-jpl/src/c/classes/Loads/Friction.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Friction.cpp	(revision 16872)
++++ ../trunk-jpl/src/c/classes/Loads/Friction.cpp	(revision 16873)
+@@ -17,25 +17,19 @@
+ /*Constructors/destructors*/
+ /*FUNCTION Friction::Friction() {{{*/
+ Friction::Friction(){
+-	this->element_type=NULL;
+-	this->inputs=NULL;
+-	this->matpar=NULL;
++	this->element=NULL;
++	this->dim=0;
+ }
+ /*}}}*/
+-/*FUNCTION Friction::Friction(const char* element_type, Inputs* inputs,Matpar* matpar,int analysis_type){{{*/
+-Friction::Friction(const char* element_type_in,Inputs* inputs_in,Matpar* matpar_in, int in_analysis_type){
++/*FUNCTION Friction::Friction(Element* element,int dim){{{*/
++Friction::Friction(Element* element_in,int dim_in){
+ 
+-	this->analysis_type=in_analysis_type;
+-	this->inputs=inputs_in;
+-	this->element_type=xNew<char>(strlen(element_type_in)+1);
+-	xMemCpy<char>(this->element_type,element_type_in,(strlen(element_type_in)+1));
+-
+-	this->matpar=matpar_in;
++	this->element=element_in;
++	this->dim=dim_in;
+ }
+ /*}}}*/
+ /*FUNCTION Friction::~Friction() {{{*/
+ Friction::~Friction(){
+-	xDelete<char>(element_type);
+ }
+ /*}}}*/
+ 
+@@ -43,14 +37,11 @@
+ /*FUNCTION Friction::Echo {{{*/
+ void Friction::Echo(void){
+ 	_printf_("Friction:\n");
+-	_printf_("   analysis_type: " << EnumToStringx(analysis_type) << "\n");
+-	_printf_("   element_type: " << this->element_type << "\n");
+-	inputs->Echo();
+-	matpar->Echo();
++	_printf_("   dim: " << this->dim<< "\n");
+ }
+ /*}}}*/
+-/*FUNCTION Friction::GetAlpha2(IssmDouble* palpha2, GaussTria* gauss,int vxenum,int vyenum,int vzenum){{{*/
+-void Friction::GetAlpha2(IssmDouble* palpha2, GaussTria* gauss,int vxenum,int vyenum,int vzenum){
++/*FUNCTION Friction::GetAlpha2{{{*/
++void Friction::GetAlpha2(IssmDouble* palpha2, Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){
+ 
+ 	/*This routine calculates the basal friction coefficient 
+ 	  alpha2= drag^2 * Neff ^r * vel ^s, with Neff=rho_ice*g*thickness+rho_ice*g*bed, r=q/p and s=1/p**/
+@@ -58,7 +49,6 @@
+ 	/*diverse: */
+ 	IssmDouble  r,s;
+ 	IssmDouble  drag_p, drag_q;
+-	IssmDouble  gravity,rho_ice,rho_water;
+ 	IssmDouble  Neff;
+ 	IssmDouble  thickness,bed;
+ 	IssmDouble  vx,vy,vz,vmag;
+@@ -66,124 +56,56 @@
+ 	IssmDouble  alpha2;
+ 
+ 	/*Recover parameters: */
+-	inputs->GetInputValue(&drag_p,FrictionPEnum);
+-	inputs->GetInputValue(&drag_q,FrictionQEnum);
+-	this->GetInputValue(&thickness, gauss,ThicknessEnum);
+-	this->GetInputValue(&bed, gauss,BedEnum);
+-	this->GetInputValue(&drag_coefficient, gauss,FrictionCoefficientEnum);
++	element->GetInputValue(&drag_p,FrictionPEnum);
++	element->GetInputValue(&drag_q,FrictionQEnum);
++	element->GetInputValue(&thickness, gauss,ThicknessEnum);
++	element->GetInputValue(&bed, gauss,BedEnum);
++	element->GetInputValue(&drag_coefficient, gauss,FrictionCoefficientEnum);
++	IssmDouble rho_water   = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble rho_ice     = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	IssmDouble gravity     = element->GetMaterialParameter(ConstantsGEnum);
+ 
+-	/*Get material parameters: */
+-	gravity=matpar->GetG();
+-	rho_ice=matpar->GetRhoIce();
+-	rho_water=matpar->GetRhoWater();
+-
+ 	//compute r and q coefficients: */
+ 	r=drag_q/drag_p;
+ 	s=1./drag_p;
+ 
+ 	//From bed and thickness, compute effective pressure when drag is viscous:
+ 	Neff=gravity*(rho_ice*thickness+rho_water*bed);
++	if(Neff<0)Neff=0;
+ 
+-	/*If effective pressure becomes negative, sliding becomes unstable (Paterson 4th edition p 148). This is because 
+-	  the water pressure is so high, the ice sheet elevates over its ice bumps and slides. But the limit behaviour 
+-	  for friction should be an ice shelf sliding (no basal drag). Therefore, for any effective pressure Neff < 0, we should 
+-	  replace it by Neff=0 (ie, equival it to an ice shelf)*/
+-	if (Neff<0)Neff=0;
+-
+-	if(strcmp(element_type,"1d")==0){
+-		this->GetInputValue(&vx, gauss,vxenum);
+-		vmag=sqrt(vx*vx);
++	switch(dim){
++		case 1:
++			vx_input->GetInputValue(&vx,gauss);
++			vmag=sqrt(vx*vx);
++			break;
++		case 2:
++			vx_input->GetInputValue(&vx,gauss);
++			vy_input->GetInputValue(&vy,gauss);
++			vmag=sqrt(vx*vx+vy*vy);
++			break;
++		case 3:
++			vx_input->GetInputValue(&vx,gauss);
++			vy_input->GetInputValue(&vy,gauss);
++			vz_input->GetInputValue(&vz,gauss);
++			vmag=sqrt(vx*vx+vy*vy+vz*vz);
++			break;
++		default:
++			_error_("not supported");
+ 	}
+-	else if(strcmp(element_type,"2d")==0){
+-		this->GetInputValue(&vx, gauss,vxenum);
+-		this->GetInputValue(&vy, gauss,vyenum);
+-		vmag=sqrt(pow(vx,2)+pow(vy,2));
+-	}
+-	else if (strcmp(element_type,"3d")==0){
+-		this->GetInputValue(&vx, gauss,vxenum);
+-		this->GetInputValue(&vy, gauss,vyenum);
+-		this->GetInputValue(&vz, gauss,vzenum);
+-		vmag=sqrt(pow(vx,2)+pow(vy,2)+pow(vz,2));
+-	}
+-	else _error_("element_type "<< element_type << " not supported yet");
+ 
+ 	/*Checks that s-1>0 if v=0*/
+-        if(vmag==0 && (s-1)<0) _error_("velocity is 0 and (s-1)=" << (s-1) << "<0, alpha2 is Inf");
++	if(vmag==0. && (s-1.)<0.) _error_("velocity is 0 and (s-1)=" << (s-1.) << "<0, alpha2 is Inf");
+ 
+-	alpha2=pow(drag_coefficient,2)*pow(Neff,r)*pow(vmag,(s-1));
++	alpha2=drag_coefficient*drag_coefficient*pow(Neff,r)*pow(vmag,(s-1.));
+ 	_assert_(!xIsNan<IssmDouble>(alpha2));
+ 
+ 	/*Assign output pointers:*/
+ 	*palpha2=alpha2;
+ }
+ /*}}}*/
+-/*FUNCTION Friction::GetAlpha2(IssmDouble* palpha2, GaussPenta* gauss,int vxenum,int vyenum,int vzenum){{{*/
+-void Friction::GetAlpha2(IssmDouble* palpha2, GaussPenta* gauss,int vxenum,int vyenum,int vzenum){
++/*FUNCTION Friction::GetAlphaComplement(IssmDouble* palpha_complement, Gauss* gauss,int vxenum,int vyenum,int vzenum) {{{*/
++void Friction::GetAlphaComplement(IssmDouble* palpha_complement, Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){
+ 
+-	/*This routine calculates the basal friction coefficient 
+-	  alpha2= drag^2 * Neff ^r * vel ^s, with Neff=rho_ice*g*thickness+rho_ice*g*bed, r=q/p and s=1/p**/
+-
+-	/*diverse: */
+-	IssmDouble  r,s;
+-	IssmDouble  drag_p, drag_q;
+-	IssmDouble  gravity,rho_ice,rho_water;
+-	IssmDouble  Neff;
+-	IssmDouble  thickness,bed;
+-	IssmDouble  vx,vy,vz,vmag;
+-	IssmDouble  drag_coefficient;
+-	IssmDouble  alpha2;
+-
+-	/*Recover parameters: */
+-	inputs->GetInputValue(&drag_p,FrictionPEnum);
+-	inputs->GetInputValue(&drag_q,FrictionQEnum);
+-	this->GetInputValue(&thickness, gauss,ThicknessEnum);
+-	this->GetInputValue(&bed, gauss,BedEnum);
+-	this->GetInputValue(&drag_coefficient, gauss,FrictionCoefficientEnum);
+-
+-	/*Get material parameters: */
+-	gravity=matpar->GetG();
+-	rho_ice=matpar->GetRhoIce();
+-	rho_water=matpar->GetRhoWater();
+-
+-	//compute r and q coefficients: */
+-	r=drag_q/drag_p;
+-	s=1./drag_p;
+-
+-	//From bed and thickness, compute effective pressure when drag is viscous:
+-	Neff=gravity*(rho_ice*thickness+rho_water*bed);
+-
+-	/*If effective pressure becomes negative, sliding becomes unstable (Paterson 4th edition p 148). This is because 
+-	  the water pressure is so high, the ice sheet elevates over its ice bumps and slides. But the limit behaviour 
+-	  for friction should be an ice shelf sliding (no basal drag). Therefore, for any effective pressure Neff < 0, we should 
+-	  replace it by Neff=0 (ie, equival it to an ice shelf)*/
+-	if (Neff<0)Neff=0;
+-
+-	if(strcmp(element_type,"2d")==0){
+-		this->GetInputValue(&vx, gauss,vxenum);
+-		this->GetInputValue(&vy, gauss,vyenum);
+-		vmag=sqrt(pow(vx,2)+pow(vy,2));
+-	}
+-	else if (strcmp(element_type,"3d")==0){
+-		this->GetInputValue(&vx, gauss,vxenum);
+-		this->GetInputValue(&vy, gauss,vyenum);
+-		this->GetInputValue(&vz, gauss,vzenum);
+-		vmag=sqrt(pow(vx,2)+pow(vy,2)+pow(vz,2));
+-	}
+-	else _error_("element_type "<< element_type << " not supported yet");
+-
+-	/*Checks that s-1>0 if v=0*/
+-	if(vmag==0 && (s-1)<0) _error_("velocity is 0 and (s-1)=" << (s-1) << "<0, alpha_complement is Inf");
+-
+-	alpha2=pow(drag_coefficient,2)*pow(Neff,r)*pow(vmag,(s-1));
+-	_assert_(!xIsNan<IssmDouble>(alpha2));
+-
+-	/*Assign output pointers:*/
+-	*palpha2=alpha2;
+-}
+-/*}}}*/
+-/*FUNCTION Friction::GetAlphaComplement(IssmDouble* palpha_complement, GaussTria* gauss,int vxenum,int vyenum,int vzenum) {{{*/
+-void Friction::GetAlphaComplement(IssmDouble* palpha_complement, GaussTria* gauss,int vxenum,int vyenum,int vzenum){
+-
+ 	/* FrictionGetAlpha2 computes alpha2= drag^2 * Neff ^r * vel ^s, with Neff=rho_ice*g*thickness+rho_ice*g*bed, r=q/p and s=1/p. 
+ 	 * FrictionGetAlphaComplement is used in control methods on drag, and it computes: 
+ 	 * alpha_complement= Neff ^r * vel ^s*/
+@@ -195,137 +117,53 @@
+ 	IssmDouble  Neff;
+ 	IssmDouble  drag_coefficient;
+ 	IssmDouble  bed,thickness;
+-	IssmDouble  gravity,rho_ice,rho_water;
+ 	IssmDouble  alpha_complement;
+ 
+ 	/*Recover parameters: */
+-	inputs->GetInputValue(&drag_p,FrictionPEnum);
+-	inputs->GetInputValue(&drag_q,FrictionQEnum);
+-	this->GetInputValue(&thickness, gauss,ThicknessEnum);
+-	this->GetInputValue(&bed, gauss,BedEnum);
+-	this->GetInputValue(&drag_coefficient, gauss,FrictionCoefficientEnum);
++	element->GetInputValue(&drag_p,FrictionPEnum);
++	element->GetInputValue(&drag_q,FrictionQEnum);
++	element->GetInputValue(&thickness, gauss,ThicknessEnum);
++	element->GetInputValue(&bed, gauss,BedEnum);
++	element->GetInputValue(&drag_coefficient, gauss,FrictionCoefficientEnum);
++	IssmDouble rho_water   = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble rho_ice     = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	IssmDouble gravity     = element->GetMaterialParameter(ConstantsGEnum);
+ 
+-	/*Get material parameters: */
+-	gravity=matpar->GetG();
+-	rho_ice=matpar->GetRhoIce();
+-	rho_water=matpar->GetRhoWater();
+-
+ 	//compute r and q coefficients: */
+ 	r=drag_q/drag_p;
+ 	s=1./drag_p;
+ 
+ 	//From bed and thickness, compute effective pressure when drag is viscous:
+ 	Neff=gravity*(rho_ice*thickness+rho_water*bed);
++	if(Neff<0)Neff=0;
+ 
+-	/*If effective pressure becomes negative, sliding becomes unstable (Paterson 4th edition p 148). This is because 
+-	  the water pressure is so high, the ice sheet elevates over its ice bumps and slides. But the limit behaviour 
+-	  for friction should be an ice shelf sliding (no basal drag). Therefore, for any effective pressure Neff < 0, we should 
+-	  replace it by Neff=0 (ie, equival it to an ice shelf)*/
+-	if (Neff<0)Neff=0;
+-
+ 	//We need the velocity magnitude to evaluate the basal stress:
+-	if(strcmp(element_type,"2d")==0){
+-		this->GetInputValue(&vx, gauss,vxenum);
+-		this->GetInputValue(&vy, gauss,vyenum);
+-		vmag=sqrt(pow(vx,2)+pow(vy,2));
++	switch(dim){
++		case 1:
++			vx_input->GetInputValue(&vx,gauss);
++			vmag=sqrt(vx*vx);
++			break;
++		case 2:
++			vx_input->GetInputValue(&vx,gauss);
++			vy_input->GetInputValue(&vy,gauss);
++			vmag=sqrt(vx*vx+vy*vy);
++			break;
++		case 3:
++			vx_input->GetInputValue(&vx,gauss);
++			vy_input->GetInputValue(&vy,gauss);
++			vz_input->GetInputValue(&vz,gauss);
++			vmag=sqrt(vx*vx+vy*vy+vz*vz);
++			break;
++		default:
++			_error_("not supported");
+ 	}
+-	else if (strcmp(element_type,"3d")==0){
+-		this->GetInputValue(&vx, gauss,vxenum);
+-		this->GetInputValue(&vy, gauss,vyenum);
+-		this->GetInputValue(&vz, gauss,vzenum);
+-		vmag=sqrt(pow(vx,2)+pow(vy,2)+pow(vz,2));
+-	}
+-	else _error_("element_type "<< element_type << " not supported yet");
+ 
+ 	/*Checks that s-1>0 if v=0*/
+-	if(vmag==0 && (s-1)<0) _error_("velocity is 0 and (s-1)=" << (s-1) << "<0, alpha_complement is Inf");
++	if(vmag==0. && (s-1.)<0.) _error_("velocity is 0 and (s-1)=" << (s-1.) << "<0, alpha2 is Inf");
+ 
+-	alpha_complement=pow(Neff,r)*pow(vmag,(s-1));            _assert_(!xIsNan<IssmDouble>(alpha_complement));
++	alpha_complement=pow(Neff,r)*pow(vmag,(s-1));_assert_(!xIsNan<IssmDouble>(alpha_complement));
+ 
+ 	/*Assign output pointers:*/
+ 	*palpha_complement=alpha_complement;
+ }
+ /*}}}*/
+-/*FUNCTION Friction::GetAlphaComplement(IssmDouble* palpha_complement, GaussPenta* gauss,int vxenum,int vyenum,int vzenum) {{{*/
+-void Friction::GetAlphaComplement(IssmDouble* palpha_complement, GaussPenta* gauss,int vxenum,int vyenum,int vzenum){
+-
+-	/* FrictionGetAlpha2 computes alpha2= drag^2 * Neff ^r * vel ^s, with Neff=rho_ice*g*thickness+rho_ice*g*bed, r=q/p and s=1/p. 
+-	 * FrictionGetAlphaComplement is used in control methods on drag, and it computes: 
+-	 * alpha_complement= Neff ^r * vel ^s*/
+-
+-	/*diverse: */
+-	IssmDouble  r,s;
+-	IssmDouble  vx,vy,vz,vmag;
+-	IssmDouble  drag_p,drag_q;
+-	IssmDouble  Neff;
+-	IssmDouble  drag_coefficient;
+-	IssmDouble  bed,thickness;
+-	IssmDouble  gravity,rho_ice,rho_water;
+-	IssmDouble  alpha_complement;
+-
+-	/*Recover parameters: */
+-	inputs->GetInputValue(&drag_p,FrictionPEnum);
+-	inputs->GetInputValue(&drag_q,FrictionQEnum);
+-	this->GetInputValue(&thickness, gauss,ThicknessEnum);
+-	this->GetInputValue(&bed, gauss,BedEnum);
+-	this->GetInputValue(&drag_coefficient, gauss,FrictionCoefficientEnum);
+-
+-	/*Get material parameters: */
+-	gravity=matpar->GetG();
+-	rho_ice=matpar->GetRhoIce();
+-	rho_water=matpar->GetRhoWater();
+-
+-	//compute r and q coefficients: */
+-	r=drag_q/drag_p;
+-	s=1./drag_p;
+-
+-	//From bed and thickness, compute effective pressure when drag is viscous:
+-	Neff=gravity*(rho_ice*thickness+rho_water*bed);
+-
+-	/*If effective pressure becomes negative, sliding becomes unstable (Paterson 4th edition p 148). This is because 
+-	  the water pressure is so high, the ice sheet elevates over its ice bumps and slides. But the limit behaviour 
+-	  for friction should be an ice shelf sliding (no basal drag). Therefore, for any effective pressure Neff < 0, we should 
+-	  replace it by Neff=0 (ie, equival it to an ice shelf)*/
+-	if (Neff<0)Neff=0;
+-
+-	//We need the velocity magnitude to evaluate the basal stress:
+-	if(strcmp(element_type,"2d")==0){
+-		this->GetInputValue(&vx, gauss,vxenum);
+-		this->GetInputValue(&vy, gauss,vyenum);
+-		vmag=sqrt(pow(vx,2)+pow(vy,2));
+-	}
+-	else if (strcmp(element_type,"3d")==0){
+-		this->GetInputValue(&vx, gauss,vxenum);
+-		this->GetInputValue(&vy, gauss,vyenum);
+-		this->GetInputValue(&vz, gauss,vzenum);
+-		vmag=sqrt(pow(vx,2)+pow(vy,2)+pow(vz,2));
+-	}
+-	else _error_("element_type "<< element_type << " not supported yet");
+-
+-	/*Checks that s-1>0 if v=0*/
+-	if(vmag==0 && (s-1)<0) _error_("velocity is 0 and (s-1)=" << (s-1) << "<0, alpha_complement is Inf");
+-
+-	alpha_complement=pow(Neff,r)*pow(vmag,(s-1));            _assert_(!xIsNan<IssmDouble>(alpha_complement));
+-
+-	/*Assign output pointers:*/
+-	*palpha_complement=alpha_complement;
+-}
+-/*}}}*/
+-/*FUNCTION Friction::GetInputValue{{{*/
+-void Friction::GetInputValue(IssmDouble* pvalue,GaussTria* gauss,int enum_type){
+-
+-	Input* input=inputs->GetInput(enum_type);
+-	if(!input) _error_("input " << EnumToStringx(enum_type) << " not found");
+-	input->GetInputValue(pvalue,gauss);
+-
+-}
+-/*}}}*/
+-/*FUNCTION Friction::GetInputValue{{{*/
+-void Friction::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,int enum_type){
+-
+-	Input* input=inputs->GetInput(enum_type);
+-	if(!input) _error_("input " << EnumToStringx(enum_type) << " not found");
+-	input->GetInputValue(pvalue,gauss);
+-
+-}
+-/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16872)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16873)
+@@ -117,6 +117,7 @@
+ 		virtual void   GetInputValue(bool* pvalue,int enum_type)=0;
+ 		virtual void   GetInputValue(int* pvalue,int enum_type)=0;
+ 		virtual void   GetInputValue(IssmDouble* pvalue,int enum_type)=0;
++		virtual void   GetInputValue(IssmDouble* pvalue,Gauss* gauss,int enum_type)=0;
+ 		virtual void   GetVerticesCoordinates(IssmDouble** xyz_list)=0;
+ 		virtual void   GetVerticesCoordinatesBase(IssmDouble** xyz_list)=0;
+ 		virtual void   GetVerticesCoordinatesTop(IssmDouble** xyz_list)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16872)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16873)
+@@ -1525,6 +1525,14 @@
+ 	input->GetInputValue(pvalue);
+ 
+ }/*}}}*/
++/*FUNCTION Tria::GetInputValue(IssmDouble* pvalue,Gauss* gauss,int inputenum) {{{*/
++void Tria::GetInputValue(IssmDouble* pvalue,Gauss* gauss,int inputenum){
++
++	Input* input=inputs->GetInput(inputenum);
++	if(!input) _error_("Input " << EnumToStringx(inputenum) << " not found in element");
++	input->GetInputValue(pvalue,gauss);
++
++}/*}}}*/
+ /*FUNCTION Tria::GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype) {{{*/
+ void Tria::GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype){
+ 
+@@ -3804,7 +3812,7 @@
+ 	for(i=0;i<NUMVERTICES1D;i++) for(j=0;j<2;j++) xyz_list_seg[i][j]=xyz_list[indices[i]][j];
+ 
+ 	/*build friction object, used later on: */
+-	friction=new Friction("1d",inputs,matpar,analysis_type);
++	friction=new Friction(this,1);
+ 
+ 	/* Start looping on the number of gauss 1d (nodes on the bedrock) */
+ 	GaussTria* gauss=new GaussTria(indices[0],indices[1],2);
+@@ -3815,7 +3823,7 @@
+ 		GetSegmentJacobianDeterminant(&Jdet,&xyz_list_seg[0][0],gauss);
+ 		GetLFS(BFriction,gauss);
+ 
+-		friction->GetAlpha2(&alpha2,gauss,VxEnum,VyEnum,VzEnum);
++		friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,NULL);
+ 		D = +alpha2*gauss->weight*Jdet; //taub_x = -alpha2 vx
+ 
+ 		TripleMultiply(BFriction,1,numdof,1,
+@@ -3953,7 +3961,7 @@
+ 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+ 
+ 	/*build friction object, used later on: */
+-	friction=new Friction("2d",inputs,matpar,analysis_type);
++	friction=new Friction(this,2);
+ 
+ 	/*Recover portion of element that is grounded*/
+ 	if(migration_style==SubelementMigrationEnum) phi=this->GetGroundedPortion(&xyz_list[0][0]);
+@@ -3971,7 +3979,7 @@
+ 
+ 		gauss->GaussPoint(ig);
+ 
+-		friction->GetAlpha2(&alpha2, gauss,VxEnum,VyEnum,VzEnum);
++		friction->GetAlpha2(&alpha2, gauss,vx_input,vy_input,NULL);
+ 		if(migration_style==SubelementMigrationEnum) alpha2=phi*alpha2;
+ 		if(migration_style==SubelementMigration2Enum){
+ 			gllevelset_input->GetInputValue(&gllevelset, gauss);
+@@ -4960,7 +4968,7 @@
+ 	this->GetConnectivityList(&connectivity[0]);
+ 
+ 	/*Build frictoin element, needed later: */
+-	friction=new Friction("2d",inputs,matpar,analysis_type);
++	friction=new Friction(this,2);
+ 
+ 	/*Retrieve all inputs we will be needing: */
+ 	Input* adjointx_input=inputs->GetInput(AdjointxEnum);                   _assert_(adjointx_input);
+@@ -4979,7 +4987,7 @@
+ 		GetNodalFunctions(basis, gauss);
+ 
+ 		/*Build alpha_complement_list: */
+-		friction->GetAlphaComplement(&alpha_complement, gauss,VxEnum,VyEnum,VzEnum);
++		friction->GetAlphaComplement(&alpha_complement,gauss,vx_input,vy_input,NULL);
+ 
+ 		dragcoefficient_input->GetInputValue(&drag, gauss);
+ 		adjointx_input->GetInputValue(&lambda, gauss);
+@@ -5004,7 +5012,7 @@
+ 	//gauss=new GaussTria();
+ 	//for (int iv=0;iv<NUMVERTICES;iv++){
+ 	//	gauss->GaussVertex(iv);
+-	//	friction->GetAlphaComplement(&alpha_complement, gauss,VxEnum,VyEnum,VzEnum);
++	//	friction->GetAlphaComplement(&alpha_complement,gauss,vx_input,vy_input,vz_input);
+ 	//	dragcoefficient_input->GetInputValue(&drag, gauss);
+ 	//	adjointx_input->GetInputValue(&lambda, gauss);
+ 	//	adjointy_input->GetInputValue(&mu, gauss);
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16872)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16873)
+@@ -282,6 +282,7 @@
+ 		void           GetInputValue(bool* pvalue,int enum_type);
+ 		void           GetInputValue(int* pvalue,int enum_type);
+ 		void           GetInputValue(IssmDouble* pvalue,int enum_type);
++		void           GetInputValue(IssmDouble* pvalue,Gauss* gauss,int enum_type);
+ 		void           GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype);
+ 		void           GetStrainRate2d(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss, Input* vx_input, Input* vy_input);
+ 		void	         InputChangeName(int enum_type,int enum_type_old);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16872)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16873)
+@@ -192,7 +192,7 @@
+ 	Input* vz_input=inputs->GetInput(VzEnum);                         _assert_(vz_input);
+ 
+ 	/*Build friction element, needed later: */
+-	friction=new Friction("3d",inputs,matpar,StressbalanceAnalysisEnum);
++	friction=new Friction(this,3);
+ 
+ 	/* Start looping on the number of gauss 2d (nodes on the bedrock) */
+ 	gauss=new GaussPenta(0,1,2,2);
+@@ -201,7 +201,7 @@
+ 
+ 		gauss->GaussPoint(ig);
+ 
+-		friction->GetAlpha2(&alpha2,gauss,VxEnum,VyEnum,VzEnum);
++		friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input);
+ 		vx_input->GetInputValue(&vx,gauss);
+ 		vy_input->GetInputValue(&vy,gauss);
+ 		basalfriction[count]=alpha2*(pow(vx,2.0)+pow(vy,2.0));
+@@ -1446,6 +1446,14 @@
+ 	input->GetInputValue(pvalue);
+ 
+ }/*}}}*/
++/*FUNCTION Penta::GetInputValue(IssmDouble* pvalue,Gauss* gauss,int inputenum) {{{*/
++void Penta::GetInputValue(IssmDouble* pvalue,Gauss* gauss,int inputenum){
++
++	Input* input=inputs->GetInput(inputenum);
++	if(!input) _error_("Input " << EnumToStringx(inputenum) << " not found in element");
++	input->GetInputValue(pvalue,gauss);
++
++}/*}}}*/
+ /*FUNCTION Penta::GetVerticesCoordinates(IssmDouble** pxyz_list){{{*/
+ void Penta::GetVerticesCoordinates(IssmDouble** pxyz_list){
+ 
+@@ -4579,7 +4587,7 @@
+ 	Input* watercolumn_input=inputs->GetInput(WatercolumnEnum);       _assert_(watercolumn_input);
+ 
+ 	/*Build friction element, needed later: */
+-	friction=new Friction("3d",inputs,matpar,analysis_type);
++	friction=new Friction(this,3);
+ 
+ 	/* Start looping on the number of gauss 2d (nodes on the bedrock) */
+ 	gauss=new GaussPenta(0,1,2,2);
+@@ -4602,7 +4610,7 @@
+ 			 NOT ((watercolumn>0.) AND (enthalpy<PIE)) AND (enthalpy<PIE)*/
+ 			geothermalflux_input->GetInputValue(&geothermalflux_value,gauss);
+ 
+-			friction->GetAlpha2(&alpha2,gauss,VxEnum,VyEnum,VzEnum);
++			friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input);
+ 			vx_input->GetInputValue(&vx,gauss);
+ 			vy_input->GetInputValue(&vy,gauss);
+ 			vz_input->GetInputValue(&vz,gauss);
+@@ -4838,7 +4846,7 @@
+ 	Input* geothermalflux_input=inputs->GetInput(BasalforcingsGeothermalfluxEnum); _assert_(geothermalflux_input);
+ 
+ 	/*Build frictoin element, needed later: */
+-	friction=new Friction("3d",inputs,matpar,analysis_type);
++	friction=new Friction(this,3);
+ 
+ 	/* Start looping on the number of gauss 2d (nodes on the bedrock) */
+ 	gauss=new GaussPenta(0,1,2,2);
+@@ -4850,7 +4858,7 @@
+ 		GetNodalFunctionsP1(&basis[0], gauss);
+ 
+ 			geothermalflux_input->GetInputValue(&geothermalflux_value,gauss);
+-			friction->GetAlpha2(&alpha2,gauss,VxEnum,VyEnum,VzEnum);
++			friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input);
+ 			vx_input->GetInputValue(&vx,gauss);
+ 			vy_input->GetInputValue(&vy,gauss);
+ 			basalfriction=alpha2*(pow(vx,2.0)+pow(vy,2.0));
+@@ -4984,13 +4992,16 @@
+ 	GetInputListOnVertices(&basalmeltingrate[0],BasalforcingsMeltingRateEnum);
+ 	GetInputListOnVertices(&geothermalflux[0],BasalforcingsGeothermalfluxEnum);
+ 	Input* enthalpy_input=inputs->GetInput(EnthalpyEnum); _assert_(enthalpy_input);
++	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
++	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
++	Input* vz_input=inputs->GetInput(VzEnum); _assert_(vz_input);
+ 
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+ 
+ 	/*Build friction element, needed later: */
+ 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-	friction=new Friction("3d",inputs,matpar,analysis_type);
++	friction=new Friction(this,3);
+ 
+ 	/******** MELTING RATES  ************************************/
+ 	GaussPenta* gauss=new GaussPenta();
+@@ -5031,7 +5042,7 @@
+ 			for(i=0;i<3;i++) heatflux+=(vec_heatflux[i])*normal_base[i];
+ 
+ 			/*basal friction*/
+-			friction->GetAlpha2(&alpha2,gauss,VxEnum,VyEnum,VzEnum);
++			friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input);
+ 			basalfriction=alpha2*(pow(vx[iv],2.0)+pow(vy[iv],2.0)+pow(vz[iv],2.0));
+ 
+ 			matpar->EnthalpyToThermal(&temperature, &waterfraction, enthalpy[iv],pressure[iv]);
+@@ -6027,7 +6038,7 @@
+ 	Input* dragcoefficient_input=inputs->GetInput(FrictionCoefficientEnum); _assert_(dragcoefficient_input);
+ 
+ 	/*Build frictoin element, needed later: */
+-	friction=new Friction("2d",inputs,matpar,analysis_type);
++	friction=new Friction(this,2);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	gauss=new GaussPenta(0,1,2,4);
+@@ -6039,7 +6050,7 @@
+ 		GetNodalFunctionsP1(basis,gauss);
+ 
+ 		/*Build alpha_complement_list: */
+-		friction->GetAlphaComplement(&alpha_complement, gauss,VxEnum,VyEnum,VzEnum);
++		friction->GetAlphaComplement(&alpha_complement,gauss,vx_input,vy_input,NULL);
+ 
+ 		dragcoefficient_input->GetInputValue(&drag, gauss);
+ 		adjointx_input->GetInputValue(&lambda, gauss);
+@@ -6102,7 +6113,7 @@
+ 	Input* adjointz_input=inputs->GetInput(AdjointzEnum);            _assert_(adjointz_input);
+ 
+ 	/*Build frictoin element, needed later: */
+-	friction=new Friction("3d",inputs,matpar,analysis_type);
++	friction=new Friction(this,3);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	gauss=new GaussPenta(0,1,2,4);
+@@ -6111,7 +6122,7 @@
+ 		gauss->GaussPoint(ig);
+ 
+ 		/*Recover alpha_complement and drag: */
+-		friction->GetAlphaComplement(&alpha_complement, gauss,VxEnum,VyEnum,VzEnum);
++		friction->GetAlphaComplement(&alpha_complement,gauss,vx_input,vy_input,vz_input);
+ 		drag_input->GetInputValue(&drag,gauss);
+ 
+ 		/*recover lambda mu and xi: */
+@@ -6904,7 +6915,7 @@
+ 	Input* vz_input=inputs->GetInput(VzEnum);           _assert_(vz_input);
+ 
+ 	/*build friction object, used later on: */
+-	friction=new Friction("2d",inputs,matpar,analysis_type);
++	friction=new Friction(this,2);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	gauss=new GaussPenta(0,1,2,2);
+@@ -6913,7 +6924,7 @@
+ 		gauss->GaussPoint(ig);
+ 
+ 		/*Friction: */
+-		friction->GetAlpha2(&alpha2, gauss,VxEnum,VyEnum,VzEnum);
++		friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input);
+ 
+ 		GetTriaJacobianDeterminant(&Jdet2d, &xyz_list_tria[0][0],gauss);
+ 		GetBHOFriction(&L[0][0],gauss);
+@@ -7138,7 +7149,7 @@
+ 	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+ 
+ 	/*build friction object, used later on: */
+-	friction=new Friction("3d",inputs,matpar,analysis_type);
++	friction=new Friction(this,3);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	gauss=new GaussPenta(0,1,2,2);
+@@ -7156,7 +7167,7 @@
+ 		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+ 
+ 		NormalBase(&bed_normal[0],&xyz_list_tria[0][0]);
+-		friction->GetAlpha2(&alpha2_gauss, gauss,VxEnum,VyEnum,VzEnum);
++		friction->GetAlpha2(&alpha2_gauss, gauss,vx_input,vy_input,vz_input);
+ 
+ 		DLSSAFS[0][0]=alpha2_gauss*gauss->weight*Jdet2d;
+ 		DLSSAFS[1][1]=alpha2_gauss*gauss->weight*Jdet2d;
+@@ -7761,7 +7772,7 @@
+ 	Input* gllevelset_input=NULL;
+ 
+ 	/*build friction object, used later on: */
+-	friction=new Friction("2d",inputs,matpar,analysis_type);
++	friction=new Friction(this,2);
+ 
+ 	/*Recover portion of element that is grounded*/
+ 	if(migration_style==SubelementMigrationEnum) phi=this->GetGroundedPortion(&xyz_list_tria[0][0]);
+@@ -7783,7 +7794,7 @@
+ 		GetTriaJacobianDeterminant(&Jdet,&xyz_list_tria[0][0],gauss);
+ 		GetBHOFriction(&B[0],gauss);
+ 
+-		friction->GetAlpha2(&alpha2, gauss,VxEnum,VyEnum,VzEnum); 
++		friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input); 
+ 		if(migration_style==SubelementMigrationEnum) alpha2=phi*alpha2;
+ 		if(migration_style==SubelementMigration2Enum){
+ 			gllevelset_input->GetInputValue(&gllevelset, gauss);
+@@ -8065,7 +8076,7 @@
+ 	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+ 
+ 	/*build friction object, used later on: */
+-	friction=new Friction("3d",inputs,matpar,analysis_type);
++	friction=new Friction(this,3);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	gauss=new GaussPenta(0,1,2,2);
+@@ -8076,7 +8087,7 @@
+ 		GetTriaJacobianDeterminant(&Jdet2d, &xyz_list_tria[0][0],gauss);
+ 		GetLFS(BFriction,gauss);
+ 
+-		friction->GetAlpha2(&alpha2,gauss,VxEnum,VyEnum,VzEnum);
++		friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input);
+ 
+ 		D[0*2+0] = +alpha2*gauss->weight*Jdet2d; //taub_x = -alpha2 vx
+ 		D[1*2+1] = +alpha2*gauss->weight*Jdet2d; //taub_y = -alpha2 vy
+@@ -8323,7 +8334,7 @@
+ 	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+ 
+ 	/*build friction object, used later on: */
+-	friction=new Friction("3d",inputs,matpar,analysis_type);
++	friction=new Friction(this,3);
+ 
+ 	/* Start looping on the number of gauss 2d (nodes on the bedrock) */
+ 	gauss=new GaussPenta(0,1,2,2);
+@@ -8340,7 +8351,7 @@
+ 		NormalBase(&bed_normal[0],&xyz_list_tria[0][0]);
+ 		this->GetStrainRate3d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+ 		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+-		friction->GetAlpha2(&alpha2_gauss, gauss,VxEnum,VyEnum,VzEnum);
++		friction->GetAlpha2(&alpha2_gauss, gauss,vx_input,vy_input,vz_input);
+ 
+ 		for(i=0;i<NUMVERTICES2D;i++){
+ 			pe->values[i*NDOF3+0]+=Jdet2d*gauss->weight*(alpha2_gauss*w*bed_normal[0]*bed_normal[2]+2*viscosity*dw[2]*bed_normal[0])*basis[i];
+@@ -8488,7 +8499,7 @@
+ 	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+ 
+ 	/*build friction object, used later on: */
+-	friction=new Friction("3d",inputs,matpar,analysis_type);
++	friction=new Friction(this,3);
+ 
+ 	/* Start looping on the number of gauss 2d (nodes on the bedrock) */
+ 	gauss=new GaussPenta(0,1,2,2);
+@@ -8505,7 +8516,7 @@
+ 		NormalBase(&bed_normal[0],&xyz_list_tria[0][0]);
+ 		this->GetStrainRate3d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+ 		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+-		friction->GetAlpha2(&alpha2_gauss, gauss,VxEnum,VyEnum,VzEnum);
++		friction->GetAlpha2(&alpha2_gauss, gauss,vx_input,vy_input,vz_input);
+ 
+ 		for(i=0;i<NUMVERTICES2D;i++){
+ 			pe->values[i*NDOF3+0]+=Jdet2d*gauss->weight*(alpha2_gauss*w*bed_normal[0]*bed_normal[2]+2*viscosity*dw[2]*bed_normal[0])*basis[i];
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16872)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16873)
+@@ -240,6 +240,7 @@
+ 		void           GetInputValue(bool* pvalue,int enum_type);
+ 		void           GetInputValue(int* pvalue,int enum_type);
+ 		void           GetInputValue(IssmDouble* pvalue,int enum_type);
++		void           GetInputValue(IssmDouble* pvalue,Gauss* gauss,int enum_type);
+ 		void           GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype);
+ 		void	         GetPhi(IssmDouble* phi, IssmDouble*  epsilon, IssmDouble viscosity);
+ 		void           GetStrainRate3dHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss, Input* vx_input, Input* vy_input);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16872)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16873)
+@@ -151,6 +151,7 @@
+ 		void        GetInputValue(bool* pvalue,int enum_type){_error_("not implemented yet");};
+ 		void        GetInputValue(int* pvalue,int enum_type){_error_("not implemented yet");};
+ 		void        GetInputValue(IssmDouble* pvalue,int enum_type){_error_("not implemented yet");};
++		void        GetInputValue(IssmDouble* pvalue,Gauss* gauss,int enum_type){_error_("not implemented yet");};
+ 		void        GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");};
+ 		IssmDouble  GetYcoord(Gauss* gauss){_error_("Not implemented");};
+ 		IssmDouble  GetZcoord(Gauss* gauss){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16873-16874.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16873-16874.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16873-16874.diff	(revision 17802)
@@ -0,0 +1,105 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16873)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16874)
+@@ -974,39 +974,37 @@
+ 	return Ke;
+ }/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSAFriction(Element* element){/*{{{*/
+-	/*Intermediaries*/
+-	bool       mainlyfloating;
+-	int        analysis_type,migration_style,point1;
+-	IssmDouble alpha2,Jdet,fraction1,fraction2;
+-	IssmDouble phi=1.0;
+-	IssmDouble D_scalar,gllevelset;
+-	IssmDouble *xyz_list = NULL;
+-	Friction   *friction = NULL;
+-	Gauss*     gauss     = NULL;
+ 
+ 	/*Return if element is inactive*/
+ 	if(element->IsFloating()) return NULL;
+ 
++	/*Intermediaries*/
++	bool       mainlyfloating;
++	int         migration_style,point1;
++	IssmDouble  alpha2,Jdet,fraction1,fraction2;
++	IssmDouble  gllevelset,phi=1.;
++	IssmDouble *xyz_list  = NULL;
++	Gauss*      gauss     = NULL;
++
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+ 	int numdof   = numnodes*2;
+ 
+ 	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke     = element->NewElementMatrix(SSAApproximationEnum);
+-	IssmDouble*    B      = xNew<IssmDouble>(2*numdof);
+-	IssmDouble*    D      = xNewZeroInit<IssmDouble>(2*2);
++	ElementMatrix* Ke      = element->NewElementMatrix(SSAApproximationEnum);
++	IssmDouble*    B       = xNew<IssmDouble>(2*numdof);
++	IssmDouble     D[2][2] = {0.};
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+ 	element->FindParam(&migration_style,GroundinglineMigrationEnum);
+-	Input* surface_input=element->GetInput(SurfaceEnum); _assert_(surface_input);
+-	Input* vx_input=element->GetInput(VxEnum);           _assert_(vx_input);
+-	Input* vy_input=element->GetInput(VyEnum);           _assert_(vy_input);
+-	Input* gllevelset_input=NULL;
+-	element->FindParam(&analysis_type,AnalysisTypeEnum);
++	Input* surface_input    = element->GetInput(SurfaceEnum); _assert_(surface_input);
++	Input* vx_input         = element->GetInput(VxEnum);      _assert_(vx_input);
++	Input* vy_input         = element->GetInput(VyEnum);      _assert_(vy_input);
++	Input* gllevelset_input = NULL;
+ 
+ 	/*build friction object, used later on: */
+-	//friction=new Friction("2d",inputs,matpar,analysis_type);
++	Friction* friction=new Friction(element,2);
+ 
+ 	/*Recover portion of element that is grounded*/
+ 	if(migration_style==SubelementMigrationEnum) phi=element->GetGroundedPortion(xyz_list);
+@@ -1021,24 +1019,21 @@
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+ 		gauss->GaussPoint(ig);
+ 
+-		//friction->GetAlpha2(&alpha2, gauss,VxEnum,VyEnum,VzEnum);
+-		alpha2=1.0;
++		friction->GetAlpha2(&alpha2, gauss,vx_input,vy_input,NULL);
+ 		if(migration_style==SubelementMigrationEnum) alpha2=phi*alpha2;
+ 		if(migration_style==SubelementMigration2Enum){
+ 			gllevelset_input->GetInputValue(&gllevelset, gauss);
+-			if(gllevelset<0) alpha2=0;
++			if(gllevelset<0.) alpha2=0.;
+ 		}
+ 
+ 		this->GetBSSAFriction(B, element, xyz_list, gauss);
+ 		element->JacobianDeterminant(&Jdet, xyz_list,gauss);
+-		D_scalar=alpha2*gauss->weight*Jdet;
+-		for(int i=0;i<2;i++) D[i*2+i]=D_scalar;
++		for(int i=0;i<2;i++) D[i][i]=alpha2*gauss->weight*Jdet;
+ 
+ 		TripleMultiply(B,2,numdof,1,
+-					D,2,2,0,
++					&D[0][0],2,2,0,
+ 					B,2,numdof,0,
+ 					&Ke->values[0],1);
+ 	}
+@@ -1050,7 +1045,6 @@
+ 	delete gauss;
+ 	delete friction;
+ 	xDelete<IssmDouble>(xyz_list);
+-	xDelete<IssmDouble>(D);
+ 	xDelete<IssmDouble>(B);
+ 	return Ke;
+ }/*}}}*/
+@@ -1251,7 +1245,6 @@
+ 	xDelete<IssmDouble>(basis);
+ 	delete gauss;
+ 	return pe;
+-	return NULL;
+ }/*}}}*/
+ void StressbalanceAnalysis::GetBSSA(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
Index: issm/oecreview/Archive/16554-17801/ISSM-16874-16875.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16874-16875.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16874-16875.diff	(revision 17802)
@@ -0,0 +1,215 @@
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h	(revision 16874)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h	(revision 16875)
+@@ -22,6 +22,8 @@
+ 		/*Finite element Analysis*/
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
++		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ 
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 16874)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 16875)
+@@ -95,7 +95,134 @@
+ 
+ /*Finite Element Analysis*/
+ ElementMatrix* DamageEvolutionAnalysis::CreateKMatrix(Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	/*Intermediaries*/
++	int      meshtype;
++	Element* basalelement;
++
++	/*Get basal element*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Intermediaries */
++	int         stabilization;
++	IssmDouble  Jdet,dt,D_scalar;
++	IssmDouble  vel,vx,vy,dvxdx,dvydy,dvx[2],dvy[2];
++	IssmDouble *xyz_list  = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = basalelement->GetNumberOfNodes();
++
++	/*Initialize Element vector*/
++	ElementMatrix* Ke     = basalelement->NewElementMatrix(NoneApproximationEnum);
++	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
++	IssmDouble*    B      = xNew<IssmDouble>(2*numnodes);
++	IssmDouble*    Bprime = xNew<IssmDouble>(2*numnodes);
++	IssmDouble     D[2][2]={0.};
++
++	/*Retrieve all inputs and parameters*/
++	basalelement->GetVerticesCoordinates(&xyz_list);
++	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
++	basalelement->FindParam(&stabilization,DamageStabilizationEnum);
++	Input* vxaverage_input=NULL;
++	Input* vyaverage_input=NULL;
++	if(meshtype==Mesh2DhorizontalEnum){
++		vxaverage_input=basalelement->GetInput(VxEnum); _assert_(vxaverage_input);
++		vyaverage_input=basalelement->GetInput(VyEnum); _assert_(vyaverage_input);
++	}
++	else{
++		vxaverage_input=basalelement->GetInput(VxAverageEnum); _assert_(vxaverage_input);
++		vyaverage_input=basalelement->GetInput(VyAverageEnum); _assert_(vyaverage_input);
++	}
++	IssmDouble h=basalelement->CharacteristicLength();
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=basalelement->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		basalelement->NodalFunctions(basis,gauss);
++		D_scalar=gauss->weight*Jdet;
++
++		vxaverage_input->GetInputValue(&vx,gauss);
++		vyaverage_input->GetInputValue(&vy,gauss);
++		vxaverage_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
++		vyaverage_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
++
++		TripleMultiply(basis,1,numnodes,1,
++					&D_scalar,1,1,0,
++					basis,1,numnodes,0,
++					&Ke->values[0],1);
++
++		GetB(B,element,xyz_list,gauss);
++		GetBprime(Bprime,element,xyz_list,gauss);
++
++		dvxdx=dvx[0];
++		dvydy=dvy[1];
++		D_scalar=dt*gauss->weight*Jdet;
++
++		D[0][0]=D_scalar*dvxdx;
++		D[1][1]=D_scalar*dvydy;
++		TripleMultiply(B,2,numnodes,1,
++					&D[0][0],2,2,0,
++					B,2,numnodes,0,
++					&Ke->values[0],1);
++
++		D[0][0]=D_scalar*vx;
++		D[1][1]=D_scalar*vy;
++		TripleMultiply(B,2,numnodes,1,
++					&D[0][0],2,2,0,
++					Bprime,2,numnodes,0,
++					&Ke->values[0],1);
++
++		if(stabilization==2){
++			/*Streamline upwinding*/
++			vel=sqrt(vx*vx+vy*vy)+1.e-8;
++			D[0][0]=h/(2*vel)*vx*vx;
++			D[1][0]=h/(2*vel)*vy*vx;
++			D[0][1]=h/(2*vel)*vx*vy;
++			D[1][1]=h/(2*vel)*vy*vy;
++		}
++		else if(stabilization==1){
++			/*SSA*/
++			vxaverage_input->GetInputAverage(&vx);
++			vyaverage_input->GetInputAverage(&vy);
++			D[0][0]=h/2.0*fabs(vx);
++			D[0][1]=0.;
++			D[1][0]=0.;
++			D[1][1]=h/2.0*fabs(vy);
++		}
++		if(stabilization==1 || stabilization==2){
++			D[0][0]=D_scalar*D[0][0];
++			D[1][0]=D_scalar*D[1][0];
++			D[0][1]=D_scalar*D[0][1];
++			D[1][1]=D_scalar*D[1][1];
++			TripleMultiply(Bprime,2,numnodes,1,
++						&D[0][0],2,2,0,
++						Bprime,2,numnodes,0,
++						&Ke->values[0],1);
++		}
++
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(B);
++	xDelete<IssmDouble>(Bprime);
++	delete gauss;
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	return Ke;
+ }/*}}}*/
+ ElementVector* DamageEvolutionAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+@@ -156,6 +283,61 @@
+ 	delete gauss;
+ 	return pe;
+ }/*}}}*/
++void DamageEvolutionAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
++	 * For node i, Bi can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi=[ N ]
++	 *          [ N ]
++	 * where N is the finiteelement function for node i.
++	 *
++	 * We assume B_prog has been allocated already, of size: 2x(NDOF1*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions*/
++	IssmDouble* basis=xNew<IssmDouble>(numnodes);
++	element->NodalFunctions(basis,gauss);
++
++	/*Build B: */
++	for(int i=0;i<numnodes;i++){
++		B[numnodes*0+i] = basis[i];
++		B[numnodes*1+i] = basis[i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(basis);
++}/*}}}*/
++void DamageEvolutionAnalysis::GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 
++	 * For node i, Bi' can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi_prime=[ dN/dx ]
++	 *                [ dN/dy ]
++	 * where N is the finiteelement function for node i.
++	 *
++	 * We assume B' has been allocated already, of size: 3x(NDOF2*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Build B': */
++	for(int i=0;i<numnodes;i++){
++		Bprime[numnodes*0+i] = dbasis[0*numnodes+i];
++		Bprime[numnodes*1+i] = dbasis[1*numnodes+i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(dbasis);
++
++}/*}}}*/
+ void DamageEvolutionAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16875-16876.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16875-16876.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16875-16876.diff	(revision 17802)
@@ -0,0 +1,531 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h	(revision 16875)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h	(revision 16876)
+@@ -21,6 +21,8 @@
+ 
+ 		/*Finite element Analysis*/
+ 		ElementMatrix* CreateKMatrix(Element* element);
++		ElementMatrix* CreateKMatrix2D(Element* element);
++		ElementMatrix* CreateKMatrix3D(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+ 		ElementVector* CreatePVector2D(Element* element);
+ 		ElementVector* CreatePVector3D(Element* element);
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 16875)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 16876)
+@@ -26,8 +26,111 @@
+ 
+ /*Finite Element Analysis*/
+ ElementMatrix* AdjointHorizAnalysis::CreateKMatrix(Element* element){/*{{{*/
+-	_error_("not implemented yet");
++	int approximation;
++	element->GetInputValue(&approximation,ApproximationEnum);
++	switch(approximation){
++		case SSAApproximationEnum: 
++			return CreateKMatrixSSA(element);
++		case HOApproximationEnum: 
++			return CreateKMatrixHO(element);
++		case FSApproximationEnum: 
++			return CreateKMatrixFS(element);
++		case NoneApproximationEnum:
++			return NULL;
++		default:
++			_error_("Approximation "<<EnumToStringx(approximation)<<" not supported");
++	}
+ }/*}}}*/
++ElementMatrix* AdjointHorizAnalysis::CreateKMatrixSSA(Element* element){/*{{{*/
++
++	/*Intermediaries*/
++	int      meshtype;
++	Element* basalelement;
++
++	/*Get basal element*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Intermediaries */
++	bool        incomplete_adjoint;
++	IssmDouble  Jdet,thickness,mu_prime;
++	IssmDouble  eps1dotdphii,eps1dotdphij,eps2dotdphii,eps2dotdphij;
++	IssmDouble  eps1[2],eps2[2],epsilon[3];
++	IssmDouble *xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = basalelement->GetNumberOfNodes();
++
++	/*Initialize Jacobian with regular SSA (first part of the Gateau derivative)*/
++	basalelement->FindParam(&incomplete_adjoint,InversionIncompleteAdjointEnum);
++	StressbalanceAnalysis* analysis = new StressbalanceAnalysis();
++	ElementMatrix* Ke=analysis->CreateKMatrix(element);
++	delete analysis;
++	if(incomplete_adjoint) return Ke;
++
++	/*Retrieve all inputs and parameters*/
++	basalelement->GetVerticesCoordinates(&xyz_list);
++	Input* vx_input        = basalelement->GetInput(VxEnum);       _assert_(vx_input);
++	Input* vy_input        = basalelement->GetInput(VyEnum);       _assert_(vy_input);
++	Input* thickness_input = basalelement->GetInput(ThicknessEnum); _assert_(thickness_input);
++
++	/*Allocate dbasis*/
++	IssmDouble* dbasis = xNew<IssmDouble>(2*numnodes);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=basalelement->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		basalelement->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++		thickness_input->GetInputValue(&thickness, gauss);
++		basalelement->StrainRateSSA(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
++		basalelement->ViscositySSADerivativeEpsSquare(&mu_prime,&epsilon[0]);
++		eps1[0]=2.*epsilon[0]+epsilon[1]; eps2[0]=epsilon[2];
++		eps1[1]=epsilon[2];               eps2[1]=epsilon[0]+2*epsilon[1];
++
++		for(int i=0;i<numnodes;i++){
++			for(int j=0;j<numnodes;j++){
++				eps1dotdphii=eps1[0]*dbasis[0*numnodes+i]+eps1[1]*dbasis[1*numnodes+i];
++				eps1dotdphij=eps1[0]*dbasis[0*numnodes+j]+eps1[1]*dbasis[1*numnodes+j];
++				eps2dotdphii=eps2[0]*dbasis[0*numnodes+i]+eps2[1]*dbasis[1*numnodes+i];
++				eps2dotdphij=eps2[0]*dbasis[0*numnodes+j]+eps2[1]*dbasis[1*numnodes+j];
++
++				Ke->values[2*numnodes*(2*i+0)+2*j+0]+=gauss->weight*Jdet*2*mu_prime*thickness*eps1dotdphij*eps1dotdphii;
++				Ke->values[2*numnodes*(2*i+0)+2*j+1]+=gauss->weight*Jdet*2*mu_prime*thickness*eps2dotdphij*eps1dotdphii;
++				Ke->values[2*numnodes*(2*i+1)+2*j+0]+=gauss->weight*Jdet*2*mu_prime*thickness*eps1dotdphij*eps2dotdphii;
++				Ke->values[2*numnodes*(2*i+1)+2*j+1]+=gauss->weight*Jdet*2*mu_prime*thickness*eps2dotdphij*eps2dotdphii;
++			}
++		}
++	}
++
++	/*Transform Coordinate System*/
++	basalelement->TransformStiffnessMatrixCoord(Ke,XYEnum);
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<IssmDouble>(dbasis);
++	xDelete<IssmDouble>(xyz_list);
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	return Ke;
++}/*}}}*/
++ElementMatrix* AdjointHorizAnalysis::CreateKMatrixHO(Element* element){/*{{{*/
++	_error_("S");
++}/*}}}*/
++ElementMatrix* AdjointHorizAnalysis::CreateKMatrixFS(Element* element){/*{{{*/
++	_error_("S");
++}/*}}}*/
+ ElementVector* AdjointHorizAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+ 	int approximation;
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 16875)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 16876)
+@@ -135,8 +135,98 @@
+ 
+ /*Finite Element Analysis*/
+ ElementMatrix* StressbalanceSIAAnalysis::CreateKMatrix(Element* element){/*{{{*/
+-	_error_("not implemented yet");
++	int meshtype;
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			return CreateKMatrix2D(element);
++		case Mesh3DEnum:
++			return CreateKMatrix3D(element);
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
+ }/*}}}*/
++ElementMatrix* StressbalanceSIAAnalysis::CreateKMatrix2D(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	IssmDouble connectivity;
++
++	/*Fetch number vertices for this element*/
++	int numvertices = element->GetNumberOfVertices();
++
++	/*Initialize Element vector*/
++	ElementMatrix* Ke=element->NewElementMatrix();
++	for(int iv=0;iv<numvertices;iv++){
++		connectivity=(IssmDouble)element->VertexConnectivity(iv);
++		Ke->values[(2*iv+0)*2*numvertices+(2*iv+0)]=1./connectivity;
++		Ke->values[(2*iv+1)*2*numvertices+(2*iv+1)]=1./connectivity;
++	}
++
++	/*Clean up and return*/
++	return Ke;
++}/*}}}*/
++ElementMatrix* StressbalanceSIAAnalysis::CreateKMatrix3D(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	int         i0,i1,j0,j1,nodeup,nodedown,numsegments;
++	IssmDouble  slope[2],connectivity[2],one0,one1;
++	int        *pairindices = NULL;
++
++	/*Fetch number vertices for this element*/
++	int numvertices = element->GetNumberOfVertices();
++	int numdof      = 2*numvertices;
++
++	/*Initialize Element vector*/
++	ElementMatrix* Ke=element->NewElementMatrix();
++
++	element->VerticalSegmentIndices(&pairindices,&numsegments);
++	for(int is=0;is<numsegments;is++){
++		nodedown = pairindices[is*2+0];
++		nodeup   = pairindices[is*2+1];
++		connectivity[0]=(IssmDouble)element->VertexConnectivity(nodedown);
++		connectivity[1]=(IssmDouble)element->VertexConnectivity(nodeup);
++		one0=1./connectivity[0];
++		one1=1./connectivity[1];
++
++		/*2 dofs of first node*/
++		i0=2*nodedown;  i1=2*nodedown+1;
++		/*2 dofs of second node*/
++		j0=2*nodeup;    j1=2*nodeup+1;
++
++		/*Create matrix for these two nodes*/
++		if(element->IsOnBed() && element->IsOnSurface()){
++			Ke->values[i0*numdof+i0] = +one0;
++			Ke->values[i1*numdof+i1] = +one0;
++			Ke->values[j0*numdof+i0] = -one1;
++			Ke->values[j0*numdof+j0] = +one1;
++			Ke->values[j1*numdof+i1] = -one1;
++			Ke->values[j1*numdof+j1] = +one1;
++		}
++		else if(element->IsOnBed()){
++			Ke->values[i0*numdof+i0] = one0;
++			Ke->values[i1*numdof+i1] = one0;
++			Ke->values[j0*numdof+i0] = -2.*one1;
++			Ke->values[j0*numdof+j0] = +2.*one1;
++			Ke->values[j1*numdof+i1] = -2.*one1;
++			Ke->values[j1*numdof+j1] = +2.*one1;
++		}
++		else if(element->IsOnSurface()){
++			Ke->values[j0*numdof+i0] = -one1;
++			Ke->values[j0*numdof+j0] = +one1;
++			Ke->values[j1*numdof+i1] = -one1;
++			Ke->values[j1*numdof+j1] = +one1;
++		}
++		else{ //node is on two horizontal layers and beams include the values only once, so the have to use half of the connectivity
++			Ke->values[j0*numdof+i0] = -2.*one1;
++			Ke->values[j0*numdof+j0] = +2.*one1;
++			Ke->values[j1*numdof+i1] = -2.*one1;
++			Ke->values[j1*numdof+j1] = +2.*one1;
++		}
++	}
++
++	/*Clean up and return*/
++	xDelete<int>(pairindices);
++	return Ke;
++}/*}}}*/
+ ElementVector* StressbalanceSIAAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+ 	int meshtype;
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h	(revision 16875)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h	(revision 16876)
+@@ -21,6 +21,9 @@
+ 
+ 		/*Finite element Analysis*/
+ 		ElementMatrix* CreateKMatrix(Element* element);
++		ElementMatrix* CreateKMatrixSSA(Element* element);
++		ElementMatrix* CreateKMatrixHO(Element* element);
++		ElementMatrix* CreateKMatrixFS(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+ 		ElementVector* CreatePVectorSSA(Element* element);
+ 		ElementVector* CreatePVectorHO(Element* element);
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16875)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16876)
+@@ -55,6 +55,7 @@
+ 		virtual void   EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure)=0;
+ 		virtual IssmDouble EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure)=0;
+ 		virtual IssmDouble EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure)=0;
++		virtual void   FindParam(bool* pvalue,int paramenum)=0;
+ 		virtual void   FindParam(int* pvalue,int paramenum)=0;
+ 		virtual void   FindParam(IssmDouble* pvalue,int paramenum)=0;
+ 		virtual void   FindParam(int** pvalues,int* psize,int paramenum)=0;
+@@ -169,6 +170,8 @@
+ 		virtual void   ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input)=0;
+ 		virtual void   ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input)=0;
+ 		virtual void   ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input)=0;
++		virtual void   ViscositySSADerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon)=0;
++		virtual void   StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input)=0;
+ 		virtual int    VelocityInterpolation()=0;
+ 		virtual int    PressureInterpolation()=0;
+ 		virtual bool   IsZeroLevelset(int levelset_enum)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16875)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16876)
+@@ -662,7 +662,7 @@
+ 		gauss->GaussVertex(iv);
+ 
+ 		/*Compute strain rate viscosity and pressure: */
+-		this->GetStrainRate2d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
++		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+ 		material->GetViscosity2d(&viscosity,&epsilon[0]);
+ 		pressure_input->GetInputValue(&pressure,gauss);
+ 
+@@ -847,6 +847,11 @@
+ 	else _printf_("inputs=NULL\n");
+ }
+ /*}}}*/
++/*FUNCTION Tria::FindParam(bool* pvalue,int paramenum){{{*/
++void Tria::FindParam(bool* pvalue,int paramenum){
++	this->parameters->FindParam(pvalue,paramenum);
++}
++/*}}}*/
+ /*FUNCTION Tria::FindParam(int* pvalue,int paramenum){{{*/
+ void Tria::FindParam(int* pvalue,int paramenum){
+ 	this->parameters->FindParam(pvalue,paramenum);
+@@ -1563,28 +1568,6 @@
+ 	for(int i=0;i<NUMVERTICES;i++) connectivity[i]=vertices[i]->Connectivity();
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetStrainRate2d(IssmDouble* epsilon,IssmDouble* xyz_list, Gauss* gauss, Input* vx_input, Input* vy_input){{{*/
+-void Tria::GetStrainRate2d(IssmDouble* epsilon,IssmDouble* xyz_list, Gauss* gauss, Input* vx_input, Input* vy_input){
+-	/*Compute the 2d Strain Rate (3 components):
+-	 * epsilon=[exx eyy exy] */
+-
+-	int i;
+-	IssmDouble epsilonvx[3];
+-	IssmDouble epsilonvy[3];
+-
+-	/*Check that both inputs have been found*/
+-	if (!vx_input || !vy_input){
+-		_error_("Input missing. Here are the input pointers we have for vx: " << vx_input << ", vy: " << vy_input << "\n");
+-	}
+-
+-	/*Get strain rate assuming that epsilon has been allocated*/
+-	vx_input->GetVxStrainRate2d(epsilonvx,xyz_list,gauss);
+-	vy_input->GetVyStrainRate2d(epsilonvy,xyz_list,gauss);
+-
+-	/*Sum all contributions*/
+-	for(i=0;i<3;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i];
+-}
+-/*}}}*/
+ /*FUNCTION Tria::GetVectorFromInputs{{{*/
+ void  Tria::GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum){
+ 
+@@ -3072,7 +3055,7 @@
+ 	IssmDouble viscosity;
+ 	IssmDouble epsilon[3];/* epsilon=[exx,eyy,exy];    */
+ 
+-	this->GetStrainRate2d(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
++	this->StrainRateSSA(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
+ 	material->GetViscosity2dvertical(&viscosity, &epsilon[0]);
+ 
+ 	/*Assign output pointer*/
+@@ -3086,13 +3069,38 @@
+ 	IssmDouble viscosity;
+ 	IssmDouble epsilon[3];/* epsilon=[exx,eyy,exy];    */
+ 
+-	this->GetStrainRate2d(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
++	this->StrainRateSSA(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
+ 	material->GetViscosity2d(&viscosity, &epsilon[0]);
+ 
+ 	/*Assign output pointer*/
+ 	*pviscosity=viscosity;
+ }
+ /*}}}*/
++/*FUNCTION Tria::ViscositySSADerivativeEpsSquare{{{*/
++void Tria::ViscositySSADerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){
++	this->material->GetViscosity2dDerivativeEpsSquare(pmu_prime,epsilon);
++}
++/*}}}*/
++/*FUNCTION Tria::StrainRateSSA{{{*/
++void Tria::StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){
++
++	int i;
++	IssmDouble epsilonvx[3];
++	IssmDouble epsilonvy[3];
++
++	/*Check that both inputs have been found*/
++	if (!vx_input || !vy_input){
++		_error_("Input missing. Here are the input pointers we have for vx: " << vx_input << ", vy: " << vy_input << "\n");
++	}
++
++	/*Get strain rate assuming that epsilon has been allocated*/
++	vx_input->GetVxStrainRate2d(epsilonvx,xyz_list,gauss);
++	vy_input->GetVyStrainRate2d(epsilonvy,xyz_list,gauss);
++
++	/*Sum all contributions*/
++	for(i=0;i<3;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i];
++}
++/*}}}*/
+ /*FUNCTION Tria::IsZeroLevelset{{{*/
+ bool Tria::IsZeroLevelset(int levelset_enum){
+ 
+@@ -3746,7 +3754,7 @@
+ 		GetBFS(B,&xyz_list[0][0],gauss); 
+ 		GetBprimeFS(Bprime,&xyz_list[0][0],gauss); 
+ 
+-		this->GetStrainRate2d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
++		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+ 		material->GetViscosity2dvertical(&viscosity,&epsilon[0]);
+ 
+ 		D_scalar=gauss->weight*Jdet;
+@@ -3896,8 +3904,8 @@
+ 		GetBSSA(&B[0], &xyz_list[0][0], gauss);
+ 		GetBprimeSSA(&Bprime[0], &xyz_list[0][0], gauss);
+ 
+-		this->GetStrainRate2d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+-		this->GetStrainRate2d(&oldepsilon[0],&xyz_list[0][0],gauss,vxold_input,vyold_input);
++		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
++		this->StrainRateSSA(&oldepsilon[0],&xyz_list[0][0],gauss,vxold_input,vyold_input);
+ 		material->GetViscosity2d(&viscosity, &epsilon[0]);
+ 		material->GetViscosity2d(&oldviscosity, &oldepsilon[0]);
+ 		thickness_input->GetInputValue(&thickness, gauss);
+@@ -4485,7 +4493,7 @@
+ 		GetNodalFunctionsDerivatives(dbasis,&xyz_list[0][0],gauss);
+ 
+ 		thickness_input->GetInputValue(&thickness, gauss);
+-		this->GetStrainRate2d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
++		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+ 		material->GetViscosity2dDerivativeEpsSquare(&mu_prime,&epsilon[0]);
+ 		eps1[0]=2*epsilon[0]+epsilon[1];   eps2[0]=epsilon[2];
+ 		eps1[1]=epsilon[2];                eps2[1]=epsilon[0]+2*epsilon[1];
+@@ -4868,7 +4876,7 @@
+ 		adjointx_input->GetInputDerivativeValue(&dadjx[0],&xyz_list[0][0],gauss);
+ 		adjointy_input->GetInputDerivativeValue(&dadjy[0],&xyz_list[0][0],gauss);
+ 
+-		this->GetStrainRate2d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
++		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+ 		material->GetViscosityComplement(&viscosity_complement,&epsilon[0]);
+ 
+ 		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+@@ -4924,7 +4932,7 @@
+ 		adjointx_input->GetInputDerivativeValue(&dadjx[0],&xyz_list[0][0],gauss);
+ 		adjointy_input->GetInputDerivativeValue(&dadjy[0],&xyz_list[0][0],gauss);
+ 
+-		this->GetStrainRate2d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
++		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+ 		material->GetViscosityDComplement(&viscosity_complement,&epsilon[0]);
+ 
+ 		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+@@ -6202,7 +6210,7 @@
+ 		GetNodalFunctionsDerivatives(dbasis,&xyz_list[0][0],gauss);
+ 
+ 		thickness_input->GetInputValue(&thickness, gauss);
+-		this->GetStrainRate2d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
++		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+ 		material->GetViscosity2dDerivativeEpsSquare(&mu_prime,&epsilon[0]);
+ 		eps1[0]=2*epsilon[0]+epsilon[1];   eps2[0]=epsilon[2];
+ 		eps1[1]=epsilon[2];                eps2[1]=epsilon[0]+2*epsilon[1];
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16875)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16876)
+@@ -82,6 +82,7 @@
+ 		void        Delta18oParameterization(void);
+ 		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){_error_("not implemented yet");};
+ 		void        EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented yet");};
++		void        FindParam(bool* pvalue,int paramenum);
+ 		void        FindParam(int* pvalue,int paramenum);
+ 		void        FindParam(IssmDouble* pvalue,int paramenum);
+ 		void        FindParam(int** pvalues,int* psize,int paramenum);
+@@ -284,7 +285,6 @@
+ 		void           GetInputValue(IssmDouble* pvalue,int enum_type);
+ 		void           GetInputValue(IssmDouble* pvalue,Gauss* gauss,int enum_type);
+ 		void           GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype);
+-		void           GetStrainRate2d(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss, Input* vx_input, Input* vy_input);
+ 		void	         InputChangeName(int enum_type,int enum_type_old);
+ 		void	         InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type);
+ 		void	         InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solution,int enum_type){_error_("not implemented yet");};
+@@ -329,6 +329,8 @@
+ 		void           ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+ 		void           ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented yet");};
+ 		void           ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
++		void           ViscositySSADerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon);
++		void           StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 
+ 		#ifdef _HAVE_STRESSBALANCE_
+ 		ElementMatrix* CreateKMatrixStressbalanceSSA(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16875)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16876)
+@@ -868,6 +868,11 @@
+ 	return matpar->GetEnthalpyDiffusionParameterVolume(numvertices,enthalpy,pressure);
+ }
+ /*}}}*/
++/*FUNCTION Penta::FindParam(bool* pvalue,int paramenum){{{*/
++void Penta::FindParam(bool* pvalue,int paramenum){
++	this->parameters->FindParam(pvalue,paramenum);
++}
++/*}}}*/
+ /*FUNCTION Penta::FindParam(int* pvalue,int paramenum){{{*/
+ void Penta::FindParam(int* pvalue,int paramenum){
+ 	this->parameters->FindParam(pvalue,paramenum);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16875)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16876)
+@@ -77,6 +77,7 @@
+ 		void   Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
+ 		void   DeleteMaterials(void){_error_("not implemented yet");};
+ 		void   ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz);
++		void   FindParam(bool* pvalue,int paramenum);
+ 		void   FindParam(int* pvalue,int paramenum);
+ 		void   FindParam(IssmDouble* pvalue,int paramenum);
+ 		void   FindParam(int** pvalues,int* psize,int paramenum);
+@@ -296,6 +297,8 @@
+ 		void           ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+ 		void           ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 		void           ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
++		void           ViscositySSADerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){_error_("not implemented");};
++		void           StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
+ 
+ 		#ifdef _HAVE_STRESSBALANCE_
+ 		ElementMatrix* CreateKMatrixCouplingSSAHO(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 16875)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 16876)
+@@ -87,6 +87,11 @@
+ 	else _printf_("inputs=NULL\n");
+ }
+ /*}}}*/
++/*FUNCTION Seg::FindParam(bool* pvalue,int paramenum){{{*/
++void Seg::FindParam(bool* pvalue,int paramenum){
++	this->parameters->FindParam(pvalue,paramenum);
++}
++/*}}}*/
+ /*FUNCTION Seg::FindParam(int* pvalue,int paramenum){{{*/
+ void Seg::FindParam(int* pvalue,int paramenum){
+ 	this->parameters->FindParam(pvalue,paramenum);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16875)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16876)
+@@ -90,6 +90,7 @@
+ 		void        EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented yet");};
+ 		IssmDouble  EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented");};
+ 		IssmDouble  EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure){_error_("not implemented");};
++		void        FindParam(bool* pvalue,int paramenum);
+ 		void        FindParam(int* pvalue,int paramenum);
+ 		void        FindParam(IssmDouble* pvalue,int paramenum);
+ 		void        FindParam(int** pvalues,int* psize,int paramenum);
+@@ -171,6 +172,8 @@
+ 		void        ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented");};
+ 		void        ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
+ 		void        ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
++		void        ViscositySSADerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){_error_("not implemented");};
++		void        StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
+ 		bool        IsZeroLevelset(int levelset_enum){_error_("not implemented");};
+ 		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented");};
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16876-16877.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16876-16877.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16876-16877.diff	(revision 17802)
@@ -0,0 +1,101 @@
+Index: ../trunk-jpl/jenkins/linux64_murdo
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo	(revision 16876)
++++ ../trunk-jpl/jenkins/linux64_murdo	(revision 16877)
+@@ -43,6 +43,9 @@
+ #execution path used for parallel runs
+ EXECUTION_PATH=$ISSM_DIR/execution
+ 
++#repo:
++REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
++
+ #-----------------------------------#
+ # 3: External packages installation #
+ #-----------------------------------#
+Index: ../trunk-jpl/jenkins/linux64_murdo_ad
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo_ad	(revision 16876)
++++ ../trunk-jpl/jenkins/linux64_murdo_ad	(revision 16877)
+@@ -29,6 +29,9 @@
+ #execution path used for parallel runs
+ EXECUTION_PATH=$ISSM_DIR/execution
+ 
++#repo:
++REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
++
+ #-----------------------------------#
+ # 3: External packages installation #
+ #-----------------------------------#
+Index: ../trunk-jpl/jenkins/linux64_murdo_ampi
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo_ampi	(revision 16876)
++++ ../trunk-jpl/jenkins/linux64_murdo_ampi	(revision 16877)
+@@ -39,6 +39,9 @@
+ #execution path used for parallel runs
+ EXECUTION_PATH=$ISSM_DIR/execution
+ 
++#repo:
++REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
++
+ #-----------------------------------#
+ # 3: External packages installation #
+ #-----------------------------------#
+Index: ../trunk-jpl/jenkins/imac-012301-gil
+===================================================================
+--- ../trunk-jpl/jenkins/imac-012301-gil	(revision 16876)
++++ ../trunk-jpl/jenkins/imac-012301-gil	(revision 16877)
+@@ -40,6 +40,9 @@
+ #execution path used for parallel runs
+ EXECUTION_PATH=$ISSM_DIR/execution
+ 
++#repo:
++REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
++
+ #-----------------------------------#
+ # 3: External packages installation #
+ #-----------------------------------#
+Index: ../trunk-jpl/jenkins/jenkins.sh
+===================================================================
+--- ../trunk-jpl/jenkins/jenkins.sh	(revision 16876)
++++ ../trunk-jpl/jenkins/jenkins.sh	(revision 16877)
+@@ -64,8 +64,11 @@
+ #}}}
+ #Initialize variables {{{
+ TODAY=$(todaydate);
++OS=$(uname -s)
++if [[ $OS == "CYGWIN_NT-6.1-WOW64" ]]; then 
++	OS="win7";
++fi
+ HOST_NAME=$(host_name $OS);
+-OS=$(uname -s)
+ START_TIME=$(timer);
+ ISSM_RELEASE=$(basename $(echo $REPOSITORY));
+ USER=$(whoami);
+Index: ../trunk-jpl/jenkins/windows
+===================================================================
+--- ../trunk-jpl/jenkins/windows	(revision 16876)
++++ ../trunk-jpl/jenkins/windows	(revision 16877)
+@@ -43,6 +43,9 @@
+ #execution path used for parallel runs
+ EXECUTION_PATH=$ISSM_DIR/execution
+ 
++#repo:
++REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
++
+ #-----------------------------------#
+ # 3: External packages installation #
+ #-----------------------------------#
+Index: ../trunk-jpl/jenkins/linux64_larsen
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_larsen	(revision 16876)
++++ ../trunk-jpl/jenkins/linux64_larsen	(revision 16877)
+@@ -41,6 +41,9 @@
+ #execution path used for parallel runs
+ EXECUTION_PATH=$ISSM_DIR/execution
+ 
++#repo:
++REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
++
+ #-----------------------------------#
+ # 3: External packages installation #
+ #-----------------------------------#
Index: issm/oecreview/Archive/16554-17801/ISSM-16877-16878.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16877-16878.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16877-16878.diff	(revision 17802)
@@ -0,0 +1,91 @@
+Index: ../trunk-jpl/jenkins/windows
+===================================================================
+--- ../trunk-jpl/jenkins/windows	(revision 16877)
++++ ../trunk-jpl/jenkins/windows	(revision 16878)
+@@ -9,36 +9,28 @@
+ NAME="ISSM matlab tests on Windows"
+ 
+ #ISSM Architecture
+-ISSM_ARCH="linux-gnu-amd64"
++ISSM_ARCH="cygwin-intel"
+ 
+ #ISSM CONFIGURATION 
+-ISSM_CONFIG='--prefix=$ISSM_DIR\
+-	--with-matlab-dir=$MATLAB_DIR \
+-	--with-triangle-dir=$ISSM_DIR/externalpackages/triangle/install \
+-	--with-metis-dir=$ISSM_DIR/externalpackages/metis/install \
+-	--with-mpi-include=$ISSM_DIR/externalpackages/mpich/install/include  \
+-	--with-mpi-libflags="-L$ISSM_DIR/externalpackages/mpich/install/lib/ -lmpich" \
+-	--with-petsc-dir=$ISSM_DIR/externalpackages/petsc/install \
+-	--with-petsc-arch=$ISSM_ARCH \
+-	--with-python-dir=$ISSM_DIR/externalpackages/python/install\
+-	--with-python-numpy-dir=$ISSM_DIR/externalpackages/python/install/lib/python2.7/site-packages/numpy/core/include/numpy\
+-	--with-mumps-dir=$ISSM_DIR/externalpackages/petsc/install/ \
+-	--with-blas-lapack-dir=$ISSM_DIR/externalpackages/petsc/install \
+-	--with-chaco-dir="$ISSM_DIR/externalpackages/chaco/install" \
+-	--with-numthreads=18 \
+-	--with-cxxoptflags="-mtune=barcelona -ffast-math -O3 -msse4.2 -Wno-write-strings "\
+-	--with-graphics-lib="/usr/lib/x86_64-linux-gnu/libX11.so" \
+-	--with-dakota-dir=$ISSM_DIR/externalpackages/dakota/install \
+-	--with-boost-dir=$ISSM_DIR/externalpackages/boost/install/ \
+-	--with-tao-dir=$ISSM_DIR/externalpackages/tao/install \
+-	--enable-debugging '
++ISSM_CONFIG='--prefix=$ISSM_DIR \
++   --disable-static \
++	--with-vendor=intel-win7-64  \
++	--with-matlab-dir=""$ISSM_DIR/externalpackages/matlab/install"" \
++	--with-triangle-dir="$ISSM_DIR/externalpackages/triangle/install" \
++	--with-metis-dir="$ISSM_DIR/externalpackages/metis/install" \
++	--with-petsc-dir="$ISSM_DIR/externalpackages/petsc/install" \
++	--with-petsc-arch=$ISSM_ARCH  \
++	--with-blas-lapack-dir=$ISSM_DIR/externalpackages/petsc/install/lib/  \
++	--with-mpi-libflags-dir="$ISSM_DIR/externalpackages/petsc/install/lib" \
++	--with-mpi-libflagss="-Wl,libpetsc.lib" \
++	--with-mpi-include-dir="$ISSM_DIR/externalpackages/petsc/install/include/mpiuni"'
+ 
+ #MATLAB path
+-MATLAB_PATH="/usr/local/matlab80/"
++MATLAB_PATH="C:/MATLAB/R2013a/"
+ 
+ #PYTHON and MATLAB testing
+ MATLAB_TEST=1
+-PYTHON_TEST=1
++PYTHON_TEST=0
+ 
+ #execution path used for parallel runs
+ EXECUTION_PATH=$ISSM_DIR/execution
+@@ -59,29 +51,13 @@
+ EXTERNALPACKAGESDIR=$ISSM_DIR/externalpackages
+ 
+ #List of external pakages to be installed and their installation scripts
+-EXTERNALPACKAGES="autotools install.sh                
+-						matlab    install.sh                
+-						mpich     install-3.0-linux64.sh    
+-						cmake     install.sh                
+-						petsc     install-3.4-linux64.sh    
+-						triangle  install-linux64.sh        
+-						boost     install.sh                
+-						dakota    install-5.3.1-linux64.sh  
+-						tao       install-2.2.sh
+-						chaco     install.sh 
+-						python        install-2.7.3-linux64.sh    
+-						nose          install-linux64-python2.sh  
+-						blas          install-linux64.sh          
+-						lapack        install-linux64.sh          
+-						git           install.sh                  
+-						numpy         install-linux64.sh          
+-						scipy         install-linux64.sh          
+-						hdf5          install.sh                  
+-						netcdf        install.sh                  
+-						netcdf-python install.sh
++EXTERNALPACKAGES="autotools install-win.sh                
++						petsc     install-3.1-win7.sh
++						triangle  install-win7.sh        
++						metis install-4.0-win7.sh
++						cccl install-win7.sh
+ 						shell2junit install.sh"
+ 
+-
+ #---------------------#
+ # 4: ISSM Compilation #
+ #---------------------#
Index: issm/oecreview/Archive/16554-17801/ISSM-16878-16879.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16878-16879.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16878-16879.diff	(revision 17802)
@@ -0,0 +1,16 @@
+Index: ../trunk-jpl/jenkins/windows
+===================================================================
+--- ../trunk-jpl/jenkins/windows	(revision 16878)
++++ ../trunk-jpl/jenkins/windows	(revision 16879)
+@@ -52,10 +52,10 @@
+ 
+ #List of external pakages to be installed and their installation scripts
+ EXTERNALPACKAGES="autotools install-win.sh                
++						cccl install-win7.sh
+ 						petsc     install-3.1-win7.sh
+ 						triangle  install-win7.sh        
+ 						metis install-4.0-win7.sh
+-						cccl install-win7.sh
+ 						shell2junit install.sh"
+ 
+ #---------------------#
Index: issm/oecreview/Archive/16554-17801/ISSM-16879-16880.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16879-16880.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16879-16880.diff	(revision 17802)
@@ -0,0 +1,21 @@
+Index: ../trunk-jpl/externalpackages/petsc/install-3.1-win7.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/petsc/install-3.1-win7.sh	(revision 16879)
++++ ../trunk-jpl/externalpackages/petsc/install-3.1-win7.sh	(revision 16880)
+@@ -13,13 +13,15 @@
+ mv petsc-3.1-p7/* src/
+ rm -rf petsc-3.1-p7
+ 
++export PETSC_DIR=`cygpath -u "$ISSM_DIR/externalpackages/petsc/src"`
++
+ #configure
+ cd src
+ ./config/configure.py  \
+ 	--with-parallel-no \
+ 	--prefix="$ISSM_DIR/externalpackages/petsc/install" \
+ 	--PETSC_ARCH=cygwin-intel \
+-	--PETSC_DIR="$ISSM_DIR/externalpackages/petsc/src" \
++	--PETSC_DIR=$PETSC_DIR \
+ 	--with-debugging=0 \
+ 	--with-mpi=0 \
+ 	--download-c-blas-lapack=yes \
Index: issm/oecreview/Archive/16554-17801/ISSM-16880-16881.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16880-16881.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16880-16881.diff	(revision 17802)
@@ -0,0 +1,19 @@
+Index: ../trunk-jpl/externalpackages/petsc/install-3.1-win7.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/petsc/install-3.1-win7.sh	(revision 16880)
++++ ../trunk-jpl/externalpackages/petsc/install-3.1-win7.sh	(revision 16881)
+@@ -14,12 +14,13 @@
+ rm -rf petsc-3.1-p7
+ 
+ export PETSC_DIR=`cygpath -u "$ISSM_DIR/externalpackages/petsc/src"`
++export PREFIX_DIR=`cygpath -u "$ISSM_DIR/externalpackages/petsc/install"`
+ 
+ #configure
+ cd src
+ ./config/configure.py  \
+ 	--with-parallel-no \
+-	--prefix="$ISSM_DIR/externalpackages/petsc/install" \
++	--prefix=$PREFIX_DIR \
+ 	--PETSC_ARCH=cygwin-intel \
+ 	--PETSC_DIR=$PETSC_DIR \
+ 	--with-debugging=0 \
Index: issm/oecreview/Archive/16554-17801/ISSM-16881-16882.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16881-16882.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16881-16882.diff	(revision 17802)
@@ -0,0 +1,312 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16881)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16882)
+@@ -34,8 +34,8 @@
+ 		ElementVector* CreatePVectorSSADrivingStress(Element* element);
+ 		ElementVector* CreatePVectorSSAFront(Element* element);
+ 		void GetBSSA(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBSSAprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetBSSAFriction(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+-		void GetBSSAprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void InputUpdateFromSolutionSSA(IssmDouble* solution,Element* element);
+ 		/*L1L2*/
+ 		ElementVector* CreatePVectorL1L2(Element* element);
+@@ -51,6 +51,7 @@
+ 		ElementVector* CreatePVectorHOFront(Element* element);
+ 		void GetBHO(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetBHOprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBHOFriction(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void InputUpdateFromSolutionHO(IssmDouble* solution,Element* element);
+ 		/*FS*/
+ 		ElementMatrix* CreateKMatrixFS(Element* element);
+@@ -62,6 +63,7 @@
+ 		ElementVector* CreatePVectorFSFront(Element* element);
+ 		void GetBFS(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetBFSprime(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBFSFriction(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputsFS(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolutionFS(IssmDouble* solution,Element* element);
+ 		/*Coupling*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16881)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16882)
+@@ -979,7 +979,7 @@
+ 	if(element->IsFloating()) return NULL;
+ 
+ 	/*Intermediaries*/
+-	bool       mainlyfloating;
++	bool        mainlyfloating;
+ 	int         migration_style,point1;
+ 	IssmDouble  alpha2,Jdet,fraction1,fraction2;
+ 	IssmDouble  gllevelset,phi=1.;
+@@ -1754,7 +1754,76 @@
+ 
+ 	if(element->IsFloating() || !element->IsOnBed()) return NULL;
+ 
+-	return NULL;
++	/*Intermediaries*/
++	bool        mainlyfloating;
++	int         migration_style,point1;
++	IssmDouble  alpha2,Jdet,fraction1,fraction2;
++	IssmDouble  gllevelset,phi=1.;
++	IssmDouble *xyz_list_base = NULL;
++	Gauss*      gauss         = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++	int numdof   = numnodes*2;
++
++	/*Initialize Element matrix and vectors*/
++	ElementMatrix* Ke      = element->NewElementMatrix(HOApproximationEnum);
++	IssmDouble*    B       = xNew<IssmDouble>(2*numdof);
++	IssmDouble     D[2][2] = {0.};
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinatesBase(&xyz_list_base);
++	element->FindParam(&migration_style,GroundinglineMigrationEnum);
++	Input* vx_input         = element->GetInput(VxEnum);      _assert_(vx_input);
++	Input* vy_input         = element->GetInput(VyEnum);      _assert_(vy_input);
++	Input* vz_input         = element->GetInput(VzEnum);      _assert_(vz_input);
++	Input* gllevelset_input = NULL;
++
++	/*build friction object, used later on: */
++	Friction* friction=new Friction(element,2);
++
++	/*Recover portion of element that is grounded*/
++	if(migration_style==SubelementMigrationEnum) phi=element->GetGroundedPortion(xyz_list_base);
++	if(migration_style==SubelementMigration2Enum){
++		gllevelset_input=element->GetInput(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input);
++		element->GetGroundedPart(&point1,&fraction1,&fraction2,&mainlyfloating);
++		//gauss = element->NewGauss(point1,fraction1,fraction2,mainlyfloating,2);
++		gauss=element->NewGaussBase(2);
++	}
++	else{
++		gauss=element->NewGaussBase(2);
++	}
++
++	/* Start  looping on the number of gaussian points: */
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input);
++		if(migration_style==SubelementMigrationEnum) alpha2=phi*alpha2;
++		if(migration_style==SubelementMigration2Enum){
++			gllevelset_input->GetInputValue(&gllevelset, gauss);
++			if(gllevelset<0.) alpha2=0.;
++		}
++
++		this->GetBHOFriction(B,element,xyz_list_base,gauss);
++		element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
++		for(int i=0;i<2;i++) D[i][i]=alpha2*gauss->weight*Jdet;
++
++		TripleMultiply(B,2,numdof,1,
++					&D[0][0],2,2,0,
++					B,2,numdof,0,
++					&Ke->values[0],1);
++	}
++
++	/*Transform Coordinate System*/
++	element->TransformStiffnessMatrixCoord(Ke,XYEnum);
++
++	/*Clean up and return*/
++	delete gauss;
++	delete friction;
++	xDelete<IssmDouble>(xyz_list_base);
++	xDelete<IssmDouble>(B);
++	return Ke;
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorHO(Element* element){/*{{{*/
+ 
+@@ -1949,6 +2018,35 @@
+ 	/*Clean-up*/
+ 	xDelete<IssmDouble>(dbasis);
+ }/*}}}*/
++void StressbalanceAnalysis::GetBHOFriction(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B  matrix. B=[B1 B2 B3] where Bi is square and of size 2. 
++	 * For node i, Bi can be expressed in the actual coordinate system
++	 * by: 
++	 *                 Bi=[ N   0 ]
++	 *                    [ 0   N ]
++	 * where N is the finiteelement function for node i.
++	 *
++	 * We assume B has been allocated already, of size: 2 x (numdof*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* basis=xNew<IssmDouble>(numnodes);
++	element->NodalFunctions(basis,gauss);
++
++	/*Build L: */
++	for(int i=0;i<numnodes;i++){
++		B[2*numnodes*0+2*i+0] = basis[i];
++		B[2*numnodes*0+2*i+1] = 0.;
++		B[2*numnodes*1+2*i+0] = 0.;
++		B[2*numnodes*1+2*i+1] = basis[i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(basis);
++}/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionHO(IssmDouble* solution,Element* element){/*{{{*/
+ 
+ 	int         i;
+@@ -2107,7 +2205,95 @@
+ 	return Ke;
+ }/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixFSFriction(Element* element){/*{{{*/
+-	return NULL;
++
++	if(element->IsFloating() || !element->IsOnBed()) return NULL;
++
++	/*If on water or not FS, skip stiffness: */
++	int approximation;
++	element->GetInputValue(&approximation,ApproximationEnum);
++	if(approximation!=FSApproximationEnum && approximation!=SSAFSApproximationEnum && approximation!=HOFSApproximationEnum) return NULL;
++
++	/*Intermediaries*/
++	bool        mainlyfloating;
++	int         i,meshtype,dim,epssize;
++	int         migration_style,point1;
++	IssmDouble  alpha2,Jdet,fraction1,fraction2;
++	IssmDouble  gllevelset,phi=1.;
++	IssmDouble *xyz_list_base = NULL;
++	Gauss*      gauss         = NULL;
++
++	/*Get problem dimension*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2;break;
++		case Mesh3DEnum:         dim = 3;break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int vnumnodes = element->GetNumberOfNodesVelocity();
++	int pnumnodes = element->GetNumberOfNodesPressure();
++	int numdof    = vnumnodes*dim + pnumnodes;
++
++	/*Initialize Element matrix and vectors*/
++	ElementMatrix* Ke      = element->NewElementMatrix(FSvelocityEnum);
++	IssmDouble*    B       = xNew<IssmDouble>((dim-1)*numdof);
++	IssmDouble*    D       = xNewZeroInit<IssmDouble>((dim-1)*(dim-1));
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinatesBase(&xyz_list_base);
++	element->FindParam(&migration_style,GroundinglineMigrationEnum);
++	Input* vx_input         = element->GetInput(VxEnum);      _assert_(vx_input);
++	Input* vy_input         = element->GetInput(VyEnum);      _assert_(vy_input);
++	Input* vz_input         = NULL;
++	if(dim==3){    vz_input = element->GetInput(VzEnum);      _assert_(vz_input);}
++	Input* gllevelset_input = NULL;
++
++	/*build friction object, used later on: */
++	Friction* friction=new Friction(element,dim==3?3:1);
++
++	/*Recover portion of element that is grounded*/
++	if(migration_style==SubelementMigrationEnum) phi=element->GetGroundedPortion(xyz_list_base);
++	if(migration_style==SubelementMigration2Enum){
++		gllevelset_input=element->GetInput(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input);
++		element->GetGroundedPart(&point1,&fraction1,&fraction2,&mainlyfloating);
++		//gauss = element->NewGauss(point1,fraction1,fraction2,mainlyfloating,2);
++		gauss=element->NewGaussBase(3);
++	}
++	else{
++		gauss=element->NewGaussBase(3);
++	}
++
++	/* Start  looping on the number of gaussian points: */
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input);
++		if(migration_style==SubelementMigrationEnum) alpha2=phi*alpha2;
++		if(migration_style==SubelementMigration2Enum){
++			gllevelset_input->GetInputValue(&gllevelset, gauss);
++			if(gllevelset<0.) alpha2=0.;
++		}
++
++		this->GetBFSFriction(B,element,dim,xyz_list_base,gauss);
++		element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
++		for(int i=0;i<2;i++) D[i*(dim-1)+i] = alpha2*gauss->weight*Jdet; //taub_x = -alpha2 v_x (same for y)
++
++		TripleMultiply(B,dim-1,numdof,1,
++					D,dim-1,dim-1,0,
++					B,dim-1,numdof,0,
++					&Ke->values[0],1);
++	}
++
++	/*DO NOT Transform Coordinate System: this stiffness matrix is already expressed in tangential coordinates*/
++
++	/*Clean up and return*/
++	delete gauss;
++	delete friction;
++	xDelete<IssmDouble>(xyz_list_base);
++	xDelete<IssmDouble>(B);
++	xDelete<IssmDouble>(D);
++	return Ke;
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorFS(Element* element){/*{{{*/
+ 
+@@ -2574,6 +2760,57 @@
+ 	xDelete<IssmDouble>(vdbasis);
+ 	xDelete<IssmDouble>(pbasis);
+ }/*}}}*/
++void StressbalanceAnalysis::GetBFSFriction(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/* Compute L  matrix. L=[L1 L2 L3] where Li is square and of size numdof. 
++	 * For node i, Li can be expressed in the actual coordinate system
++	 * by in 3d 
++	 *       Li=[ h 0 0 0 ]
++	 *	 	      [ 0 h 0 0 ]
++	 *	in 2d:
++	 *       Li=[ h 0 0 ]
++	 * where h is the interpolation function for node i.
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int pnumnodes = element->GetNumberOfNodesPressure();
++	int vnumnodes = element->GetNumberOfNodesVelocity();
++	int pnumdof   = pnumnodes;
++	int vnumdof   = vnumnodes*dim;
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* vbasis=xNew<IssmDouble>(vnumnodes);
++	element->NodalFunctionsVelocity(vbasis,gauss);
++
++	/*Build B: */
++	if(dim==3){
++		for(int i=0;i<vnumnodes;i++){
++			B[(vnumdof+pnumdof)*0+3*i+0] = vbasis[i];
++			B[(vnumdof+pnumdof)*0+3*i+1] = 0.;
++			B[(vnumdof+pnumdof)*0+3*i+2] = 0.;
++
++			B[(vnumdof+pnumdof)*1+3*i+0] = 0.;
++			B[(vnumdof+pnumdof)*1+3*i+1] = vbasis[i];
++			B[(vnumdof+pnumdof)*1+3*i+2] = 0.;
++		}
++		for(int i=0;i<pnumnodes;i++){
++			B[(vnumdof+pnumdof)*0+i+vnumdof+0] = 0.;
++			B[(vnumdof+pnumdof)*1+i+vnumdof+0] = 0.;
++		}
++	}
++	else{
++		for(int i=0;i<vnumnodes;i++){
++			B[2*i+0] = vbasis[i];
++			B[2*i+1] = 0.;
++		}
++
++		for(int i=0;i<pnumnodes;i++){
++			B[i+vnumdof+0] = 0.;
++		}
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(vbasis);
++}/*}}}*/
+ void StressbalanceAnalysis::GetSolutionFromInputsFS(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 
+ 	int*         vdoflist=NULL;
Index: issm/oecreview/Archive/16554-17801/ISSM-16882-16883.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16882-16883.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16882-16883.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/jenkins/windows
+===================================================================
+--- ../trunk-jpl/jenkins/windows	(revision 16882)
++++ ../trunk-jpl/jenkins/windows	(revision 16883)
+@@ -55,6 +55,7 @@
+ 						cccl install-win7.sh
+ 						petsc     install-3.1-win7.sh
+ 						triangle  install-win7.sh        
++						matlab install.sh
+ 						metis install-4.0-win7.sh
+ 						shell2junit install.sh"
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16883-16884.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16883-16884.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16883-16884.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/jenkins/windows
+===================================================================
+--- ../trunk-jpl/jenkins/windows	(revision 16883)
++++ ../trunk-jpl/jenkins/windows	(revision 16884)
+@@ -22,7 +22,7 @@
+ 	--with-petsc-arch=$ISSM_ARCH  \
+ 	--with-blas-lapack-dir=$ISSM_DIR/externalpackages/petsc/install/lib/  \
+ 	--with-mpi-libflags-dir="$ISSM_DIR/externalpackages/petsc/install/lib" \
+-	--with-mpi-libflagss="-Wl,libpetsc.lib" \
++	--with-mpi-libflags="-Wl,libpetsc.lib" \
+ 	--with-mpi-include-dir="$ISSM_DIR/externalpackages/petsc/install/include/mpiuni"'
+ 
+ #MATLAB path
Index: issm/oecreview/Archive/16554-17801/ISSM-16884-16885.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16884-16885.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16884-16885.diff	(revision 17802)
@@ -0,0 +1,16 @@
+Index: ../trunk-jpl/jenkins/windows
+===================================================================
+--- ../trunk-jpl/jenkins/windows	(revision 16884)
++++ ../trunk-jpl/jenkins/windows	(revision 16885)
+@@ -21,9 +21,9 @@
+ 	--with-petsc-dir="$ISSM_DIR/externalpackages/petsc/install" \
+ 	--with-petsc-arch=$ISSM_ARCH  \
+ 	--with-blas-lapack-dir=$ISSM_DIR/externalpackages/petsc/install/lib/  \
+-	--with-mpi-libflags-dir="$ISSM_DIR/externalpackages/petsc/install/lib" \
++	--with-mpi-libdir="$ISSM_DIR/externalpackages/petsc/install/lib" \
+ 	--with-mpi-libflags="-Wl,libpetsc.lib" \
+-	--with-mpi-include-dir="$ISSM_DIR/externalpackages/petsc/install/include/mpiuni"'
++	--with-mpi-include="$ISSM_DIR/externalpackages/petsc/install/include/mpiuni"'
+ 
+ #MATLAB path
+ MATLAB_PATH="C:/MATLAB/R2013a/"
Index: issm/oecreview/Archive/16554-17801/ISSM-16885-16886.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16885-16886.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16885-16886.diff	(revision 17802)
@@ -0,0 +1,615 @@
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 16885)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 16886)
+@@ -126,10 +126,146 @@
+ 	return Ke;
+ }/*}}}*/
+ ElementMatrix* AdjointHorizAnalysis::CreateKMatrixHO(Element* element){/*{{{*/
+-	_error_("S");
++
++	/*Intermediaries */
++	bool        incomplete_adjoint;
++	IssmDouble  Jdet,mu_prime;
++	IssmDouble  eps1dotdphii,eps1dotdphij,eps2dotdphii,eps2dotdphij;
++	IssmDouble  eps1[3],eps2[3],epsilon[5];/* epsilon=[exx,eyy,exy,exz,eyz];*/
++	IssmDouble *xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Jacobian with regular HO (first part of the Gateau derivative)*/
++	element->FindParam(&incomplete_adjoint,InversionIncompleteAdjointEnum);
++	StressbalanceAnalysis* analysis = new StressbalanceAnalysis();
++	ElementMatrix* Ke=analysis->CreateKMatrix(element);
++	delete analysis;
++	if(incomplete_adjoint) return Ke;
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	Input* vx_input = element->GetInput(VxEnum); _assert_(vx_input);
++	Input* vy_input = element->GetInput(VyEnum); _assert_(vy_input);
++
++	/*Allocate dbasis*/
++	IssmDouble* dbasis = xNew<IssmDouble>(3*numnodes);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(5);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++		element->StrainRateHO(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
++		element->ViscosityHODerivativeEpsSquare(&mu_prime,&epsilon[0]);
++		eps1[0]=2.*epsilon[0]+epsilon[1];   eps2[0]=epsilon[2];
++		eps1[1]=epsilon[2];                 eps2[1]=epsilon[0]+2.*epsilon[1];
++		eps1[2]=epsilon[3];                 eps2[2]=epsilon[4];
++
++		for(int i=0;i<numnodes;i++){
++			for(int j=0;j<numnodes;j++){
++				eps1dotdphii=eps1[0]*dbasis[0*numnodes+i]+eps1[1]*dbasis[1*numnodes+i]+eps1[2]*dbasis[2*numnodes+i];
++				eps1dotdphij=eps1[0]*dbasis[0*numnodes+j]+eps1[1]*dbasis[1*numnodes+j]+eps1[2]*dbasis[2*numnodes+j];
++				eps2dotdphii=eps2[0]*dbasis[0*numnodes+i]+eps2[1]*dbasis[1*numnodes+i]+eps2[2]*dbasis[2*numnodes+i];
++				eps2dotdphij=eps2[0]*dbasis[0*numnodes+j]+eps2[1]*dbasis[1*numnodes+j]+eps2[2]*dbasis[2*numnodes+j];
++
++				Ke->values[2*numnodes*(2*i+0)+2*j+0]+=gauss->weight*Jdet*2*mu_prime*eps1dotdphij*eps1dotdphii;
++				Ke->values[2*numnodes*(2*i+0)+2*j+1]+=gauss->weight*Jdet*2*mu_prime*eps2dotdphij*eps1dotdphii;
++				Ke->values[2*numnodes*(2*i+1)+2*j+0]+=gauss->weight*Jdet*2*mu_prime*eps1dotdphij*eps2dotdphii;
++				Ke->values[2*numnodes*(2*i+1)+2*j+1]+=gauss->weight*Jdet*2*mu_prime*eps2dotdphij*eps2dotdphii;
++			}
++		}
++	}
++
++	/*Transform Coordinate System*/
++	element->TransformStiffnessMatrixCoord(Ke,XYEnum);
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<IssmDouble>(dbasis);
++	xDelete<IssmDouble>(xyz_list);
++	return Ke;
+ }/*}}}*/
+ ElementMatrix* AdjointHorizAnalysis::CreateKMatrixFS(Element* element){/*{{{*/
+-	_error_("S");
++
++	/*Intermediaries */
++	bool        incomplete_adjoint;
++	IssmDouble  Jdet,mu_prime;
++	IssmDouble  eps1dotdphii,eps1dotdphij,eps2dotdphii,eps2dotdphij,eps3dotdphii,eps3dotdphij;
++	IssmDouble  eps1[3],eps2[3],eps3[3],epsilon[5];/* epsilon=[exx,eyy,exy,exz,eyz];*/
++	IssmDouble *xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int vnumnodes = element->GetNumberOfNodesVelocity();
++	int pnumnodes = element->GetNumberOfNodesPressure();
++	int numdof    = vnumnodes*3 + pnumnodes;
++
++	/*Initialize Jacobian with regular FS (first part of the Gateau derivative)*/
++	element->FindParam(&incomplete_adjoint,InversionIncompleteAdjointEnum);
++	StressbalanceAnalysis* analysis = new StressbalanceAnalysis();
++	ElementMatrix* Ke=analysis->CreateKMatrix(element);
++	delete analysis;
++	if(incomplete_adjoint) return Ke;
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	Input* vx_input = element->GetInput(VxEnum);_assert_(vx_input);
++	Input* vy_input = element->GetInput(VyEnum);_assert_(vy_input);
++	Input* vz_input = element->GetInput(VzEnum);_assert_(vz_input);
++
++	/*Allocate dbasis*/
++	IssmDouble* dbasis = xNew<IssmDouble>(3*vnumnodes);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(5);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++		element->StrainRateHO(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
++		element->ViscosityFSDerivativeEpsSquare(&mu_prime,&epsilon[0]);
++		eps1[0]=epsilon[0];   eps2[0]=epsilon[2];   eps3[0]=epsilon[3];
++		eps1[1]=epsilon[2];   eps2[1]=epsilon[1];   eps3[1]=epsilon[4];
++		eps1[2]=epsilon[3];   eps2[2]=epsilon[4];   eps3[2]= -epsilon[0] -epsilon[1];
++
++		for(int i=0;i<vnumnodes;i++){
++			for(int j=0;j<vnumnodes;j++){
++				eps1dotdphii=eps1[0]*dbasis[0*vnumnodes+i]+eps1[1]*dbasis[1*vnumnodes+i]+eps1[2]*dbasis[2*vnumnodes+i];
++				eps1dotdphij=eps1[0]*dbasis[0*vnumnodes+j]+eps1[1]*dbasis[1*vnumnodes+j]+eps1[2]*dbasis[2*vnumnodes+j];
++				eps2dotdphii=eps2[0]*dbasis[0*vnumnodes+i]+eps2[1]*dbasis[1*vnumnodes+i]+eps2[2]*dbasis[2*vnumnodes+i];
++				eps2dotdphij=eps2[0]*dbasis[0*vnumnodes+j]+eps2[1]*dbasis[1*vnumnodes+j]+eps2[2]*dbasis[2*vnumnodes+j];
++				eps3dotdphii=eps3[0]*dbasis[0*vnumnodes+i]+eps3[1]*dbasis[1*vnumnodes+i]+eps3[2]*dbasis[2*vnumnodes+i];
++				eps3dotdphij=eps3[0]*dbasis[0*vnumnodes+j]+eps3[1]*dbasis[1*vnumnodes+j]+eps3[2]*dbasis[2*vnumnodes+j];
++
++				Ke->values[numdof*(4*i+0)+4*j+0]+=gauss->weight*Jdet*2*mu_prime*eps1dotdphij*eps1dotdphii;
++				Ke->values[numdof*(4*i+0)+4*j+1]+=gauss->weight*Jdet*2*mu_prime*eps2dotdphij*eps1dotdphii;
++				Ke->values[numdof*(4*i+0)+4*j+2]+=gauss->weight*Jdet*2*mu_prime*eps3dotdphij*eps1dotdphii;
++
++				Ke->values[numdof*(4*i+1)+4*j+0]+=gauss->weight*Jdet*2*mu_prime*eps1dotdphij*eps2dotdphii;
++				Ke->values[numdof*(4*i+1)+4*j+1]+=gauss->weight*Jdet*2*mu_prime*eps2dotdphij*eps2dotdphii;
++				Ke->values[numdof*(4*i+1)+4*j+2]+=gauss->weight*Jdet*2*mu_prime*eps3dotdphij*eps2dotdphii;
++
++				Ke->values[numdof*(4*i+2)+4*j+0]+=gauss->weight*Jdet*2*mu_prime*eps1dotdphij*eps3dotdphii;
++				Ke->values[numdof*(4*i+2)+4*j+1]+=gauss->weight*Jdet*2*mu_prime*eps2dotdphij*eps3dotdphii;
++				Ke->values[numdof*(4*i+2)+4*j+2]+=gauss->weight*Jdet*2*mu_prime*eps3dotdphij*eps3dotdphii;
++			}
++		}
++	}
++
++	/*Transform Coordinate System*/
++	element->TransformStiffnessMatrixCoord(Ke,XYZEnum);
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<IssmDouble>(dbasis);
++	xDelete<IssmDouble>(xyz_list);
++	return Ke;
+ }/*}}}*/
+ ElementVector* AdjointHorizAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+@@ -155,7 +291,7 @@
+ 
+ 	/*Intermediaries */
+ 	int        num_responses,i,meshtype,dim;
+-	IssmDouble thickness,Jdet,obs_velocity_mag,velocity_mag;
++	IssmDouble Jdet,obs_velocity_mag,velocity_mag;
+ 	IssmDouble vx,vy,vxobs,vyobs,dux,duy,weight;
+ 	IssmDouble scalex,scaley,scale,S;
+ 	int        *responses    = NULL;
+@@ -354,7 +490,7 @@
+ 
+ 	/*Intermediaries */
+ 	int        num_responses,i;
+-	IssmDouble thickness,Jdet,obs_velocity_mag,velocity_mag;
++	IssmDouble Jdet,obs_velocity_mag,velocity_mag;
+ 	IssmDouble vx,vy,vxobs,vyobs,dux,duy,weight;
+ 	IssmDouble scalex,scaley,scale,S;
+ 	int        *responses    = NULL;
+@@ -552,7 +688,7 @@
+ 
+ 	/*Intermediaries */
+ 	int         num_responses,i;
+-	IssmDouble  thickness,Jdet,obs_velocity_mag,velocity_mag;
++	IssmDouble  Jdet,obs_velocity_mag,velocity_mag;
+ 	IssmDouble  vx,vy,vxobs,vyobs,dux,duy,weight;
+ 	IssmDouble scalex,scaley,scale,S;
+ 	int        *responses = NULL;
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16885)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16886)
+@@ -171,7 +171,11 @@
+ 		virtual void   ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input)=0;
+ 		virtual void   ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input)=0;
+ 		virtual void   ViscositySSADerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon)=0;
++		virtual void   ViscosityHODerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon)=0;
++		virtual void   ViscosityFSDerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon)=0;
+ 		virtual void   StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input)=0;
++		virtual void   StrainRateHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input)=0;
++		virtual void   StrainRateFS(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input)=0;
+ 		virtual int    VelocityInterpolation()=0;
+ 		virtual int    PressureInterpolation()=0;
+ 		virtual bool   IsZeroLevelset(int levelset_enum)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16885)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16886)
+@@ -329,7 +329,11 @@
+ 		void           ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+ 		void           ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented yet");};
+ 		void           ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
++		void           ViscosityHODerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){_error_("not implemented");};
++		void           ViscosityFSDerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){_error_("not implemented");};
+ 		void           ViscositySSADerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon);
++		void           StrainRateFS(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented");};
++		void           StrainRateHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
+ 		void           StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 
+ 		#ifdef _HAVE_STRESSBALANCE_
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16885)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16886)
+@@ -274,7 +274,7 @@
+ 		gauss->GaussPoint(ig);
+ 
+ 		/*Compute strain rate viscosity and pressure: */
+-		this->GetStrainRate3d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
++		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+ 		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+ 		pressure_input->GetInputValue(&pressure,gauss);
+ 
+@@ -340,7 +340,7 @@
+ 		gauss->GaussVertex(iv);
+ 
+ 		/*Compute strain rate viscosity and pressure: */
+-		this->GetStrainRate3d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
++		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+ 		material->GetViscosity3d(&viscosity,&epsilon[0]);
+ 		pressure_input->GetInputValue(&pressure,gauss);
+ 
+@@ -1579,60 +1579,6 @@
+ 	return tau_parameter;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetStrainRate3dHO{{{*/
+-void Penta::GetStrainRate3dHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss, Input* vx_input, Input* vy_input){
+-	/*Compute the 3d Blatter/HOStrain Rate (5 components):
+-	 *
+-	 * epsilon=[exx eyy exy exz eyz]
+-	 *
+-	 * with exz=1/2 du/dz
+-	 *      eyz=1/2 dv/dz
+-	 *
+-	 * the contribution of vz is neglected
+-	 */
+-
+-	int i;
+-	IssmDouble epsilonvx[5];
+-	IssmDouble epsilonvy[5];
+-
+-	/*Check that both inputs have been found*/
+-	if (!vx_input || !vy_input){
+-		_error_("Input missing. Here are the input pointers we have for vx: " << vx_input << ", vy: " << vy_input << "\n");
+-	}
+-
+-	/*Get strain rate assuming that epsilon has been allocated*/
+-	vx_input->GetVxStrainRate3dHO(epsilonvx,xyz_list,gauss);
+-	vy_input->GetVyStrainRate3dHO(epsilonvy,xyz_list,gauss);
+-
+-	/*Sum all contributions*/
+-	for(i=0;i<5;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i];
+-}
+-/*}}}*/
+-/*FUNCTION Penta::GetStrainRate3d{{{*/
+-void Penta::GetStrainRate3d(IssmDouble* epsilon,IssmDouble* xyz_list, Gauss* gauss, Input* vx_input, Input* vy_input, Input* vz_input){
+-	/*Compute the 3d Strain Rate (6 components):
+-	 *
+-	 * epsilon=[exx eyy ezz exy exz eyz]
+-	 */
+-
+-	IssmDouble epsilonvx[6];
+-	IssmDouble epsilonvy[6];
+-	IssmDouble epsilonvz[6];
+-
+-	/*Check that both inputs have been found*/
+-	if (!vx_input || !vy_input || !vz_input){
+-		_error_("Input missing. Here are the input pointers we have for vx: " << vx_input << ", vy: " << vy_input << ", vz: " << vz_input << "\n");
+-	}
+-
+-	/*Get strain rate assuming that epsilon has been allocated*/
+-	vx_input->GetVxStrainRate3d(epsilonvx,xyz_list,gauss);
+-	vy_input->GetVyStrainRate3d(epsilonvy,xyz_list,gauss);
+-	vz_input->GetVzStrainRate3d(epsilonvz,xyz_list,gauss);
+-
+-	/*Sum all contributions*/
+-	for(int i=0;i<6;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i]+epsilonvz[i];
+-}
+-/*}}}*/
+ /*FUNCTION Penta::GetUpperElement{{{*/
+ Penta* Penta::GetUpperElement(void){
+ 
+@@ -3550,7 +3496,7 @@
+ 
+ 		thickness_input->GetInputValue(&thickness,gauss);
+ 
+-		this->GetStrainRate3d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
++		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+ 		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+ 		GetPhi(&phi, &epsilon[0], viscosity);
+ 
+@@ -3573,7 +3519,7 @@
+ 	IssmDouble epsilon[6];
+ 
+ 	_assert_(gauss->Enum()==GaussPentaEnum);
+-	this->GetStrainRate3d(&epsilon[0],xyz_list,(GaussPenta*)gauss,vx_input,vy_input,vz_input);
++	this->StrainRateFS(&epsilon[0],xyz_list,(GaussPenta*)gauss,vx_input,vy_input,vz_input);
+ 	material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+ 	GetPhi(&phi,&epsilon[0],viscosity);
+ 
+@@ -3588,7 +3534,7 @@
+ 	IssmDouble viscosity;
+ 	IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
+ 
+-	this->GetStrainRate3d(&epsilon[0],xyz_list,gauss,vx_input,vy_input,vz_input);
++	this->StrainRateFS(&epsilon[0],xyz_list,gauss,vx_input,vy_input,vz_input);
+ 	material->GetViscosity3dFS(&viscosity, &epsilon[0]);
+ 
+ 	/*Assign output pointer*/
+@@ -3602,13 +3548,77 @@
+ 	IssmDouble viscosity;
+ 	IssmDouble epsilon[5];/* epsilon=[exx,eyy,exy,exz,eyz];*/
+ 
+-	this->GetStrainRate3dHO(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
++	this->StrainRateHO(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
+ 	material->GetViscosity3d(&viscosity, &epsilon[0]);
+ 
+ 	/*Assign output pointer*/
+ 	*pviscosity=viscosity;
+ }
+ /*}}}*/
++/*FUNCTION Penta::ViscosityHODerivativeEpsSquare{{{*/
++void Penta::ViscosityHODerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){
++	this->material->GetViscosityDerivativeEpsSquare(pmu_prime,epsilon);
++}
++/*}}}*/
++/*FUNCTION Penta::StrainRateHO{{{*/
++void Penta::StrainRateHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){
++	/*Compute the 3d Blatter/HOStrain Rate (5 components):
++	 *
++	 * epsilon=[exx eyy exy exz eyz]
++	 *
++	 * with exz=1/2 du/dz
++	 *      eyz=1/2 dv/dz
++	 *
++	 * the contribution of vz is neglected
++	 */
++
++	int i;
++	IssmDouble epsilonvx[5];
++	IssmDouble epsilonvy[5];
++
++	/*Check that both inputs have been found*/
++	if (!vx_input || !vy_input){
++		_error_("Input missing. Here are the input pointers we have for vx: " << vx_input << ", vy: " << vy_input << "\n");
++	}
++
++	/*Get strain rate assuming that epsilon has been allocated*/
++	vx_input->GetVxStrainRate3dHO(epsilonvx,xyz_list,gauss);
++	vy_input->GetVyStrainRate3dHO(epsilonvy,xyz_list,gauss);
++
++	/*Sum all contributions*/
++	for(i=0;i<5;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i];
++}
++/*}}}*/
++/*FUNCTION Penta::ViscosityFSDerivativeEpsSquare{{{*/
++void Penta::ViscosityFSDerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){
++	this->material->GetViscosityDerivativeEpsSquare(pmu_prime,epsilon);
++}
++/*}}}*/
++/*FUNCTION Penta::StrainRateFS{{{*/
++void Penta::StrainRateFS(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){
++	/*Compute the 3d Strain Rate (6 components):
++	 *
++	 * epsilon=[exx eyy ezz exy exz eyz]
++	 */
++
++	IssmDouble epsilonvx[6];
++	IssmDouble epsilonvy[6];
++	IssmDouble epsilonvz[6];
++
++	/*Check that both inputs have been found*/
++	if (!vx_input || !vy_input || !vz_input){
++		_error_("Input missing. Here are the input pointers we have for vx: " << vx_input << ", vy: " << vy_input << ", vz: " << vz_input << "\n");
++	}
++
++	/*Get strain rate assuming that epsilon has been allocated*/
++	vx_input->GetVxStrainRate3d(epsilonvx,xyz_list,gauss);
++	vy_input->GetVyStrainRate3d(epsilonvy,xyz_list,gauss);
++	vz_input->GetVzStrainRate3d(epsilonvz,xyz_list,gauss);
++
++	/*Sum all contributions*/
++	for(int i=0;i<6;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i]+epsilonvz[i];
++}
++/*}}}*/
+ /*FUNCTION Penta::VelocityInterpolation{{{*/
+ int Penta::VelocityInterpolation(void){
+ 	return PentaRef::VelocityInterpolation();
+@@ -4449,7 +4459,7 @@
+ 		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+ 		GetNodalFunctionsP1(&L[0], gauss);
+ 
+-		this->GetStrainRate3d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
++		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+ 		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+ 		GetPhi(&phi, &epsilon[0], viscosity);
+ 
+@@ -4719,7 +4729,7 @@
+ 		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+ 		GetNodalFunctionsP1(&L[0], gauss);
+ 
+-		this->GetStrainRate3d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
++		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+ 		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+ 		GetPhi(&phi, &epsilon[0], viscosity);
+ 
+@@ -5360,7 +5370,7 @@
+ 		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+ 		GetNodalFunctionsP1Derivatives(&dphi[0][0],&xyz_list[0][0],gauss);
+ 
+-		this->GetStrainRate3dHO(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
++		this->StrainRateHO(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+ 		material->GetViscosityDerivativeEpsSquare(&mu_prime,&epsilon[0]);
+ 		eps1[0]=2*epsilon[0]+epsilon[1];   eps2[0]=epsilon[2];
+ 		eps1[1]=epsilon[2];                eps2[1]=epsilon[0]+2*epsilon[1];
+@@ -5431,7 +5441,7 @@
+ 		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+ 		GetNodalFunctionsP1Derivatives(&dphi[0][0],&xyz_list[0][0],gauss);
+ 
+-		this->GetStrainRate3dHO(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
++		this->StrainRateHO(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+ 		material->GetViscosityDerivativeEpsSquare(&mu_prime,&epsilon[0]);
+ 		eps1[0]=epsilon[0];   eps2[0]=epsilon[2];   eps3[0]=epsilon[3];
+ 		eps1[1]=epsilon[2];   eps2[1]=epsilon[1];   eps3[1]=epsilon[4];
+@@ -6844,8 +6854,8 @@
+ 		GetBSSAHO(&B[0][0], &xyz_list[0][0], gauss);
+ 		tria->GetBprimeSSA(&Bprime[0][0], &xyz_list[0][0], gauss_tria);
+ 
+-		this->GetStrainRate3dHO(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+-		this->GetStrainRate3dHO(&oldepsilon[0],&xyz_list[0][0],gauss,vxold_input,vyold_input);
++		this->StrainRateHO(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
++		this->StrainRateHO(&oldepsilon[0],&xyz_list[0][0],gauss,vxold_input,vyold_input);
+ 		material->GetViscosity3d(&viscosity, &epsilon[0]);
+ 		material->GetViscosity3d(&oldviscosity, &oldepsilon[0]);
+ 
+@@ -7051,7 +7061,7 @@
+ 		tria->GetBSSAFS(&B2[0][0], &xyz_list[0][0], gauss_tria);
+ 		GetBprimeSSAFS(&Bprime2[0][0], &xyz_list[0][0], gauss);
+ 
+-		this->GetStrainRate3d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
++		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+ 		material->GetViscosity3dFS(&viscosity, &epsilon[0]);
+ 
+ 		D_scalar=2*viscosity*gauss->weight*Jdet;
+@@ -7168,7 +7178,7 @@
+ 		GetLFSSSA(&LFSSSA[0][0], gauss);
+ 		GetLprimeFSSSA(&LprimeFSSSA[0][0], &xyz_list[0][0], gauss);
+ 
+-		this->GetStrainRate3d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
++		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+ 		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+ 
+ 		NormalBase(&bed_normal[0],&xyz_list_tria[0][0]);
+@@ -7466,15 +7476,15 @@
+ 		tria->GetBprimeSSA(&Bprime[0][0], &xyz_list[0][0], gauss_tria);
+ 
+ 		if(approximation==SSAHOApproximationEnum){
+-			this->GetStrainRate3dHO(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+-			this->GetStrainRate3dHO(&oldepsilon[0],&xyz_list[0][0],gauss,vxold_input,vyold_input);
++			this->StrainRateHO(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
++			this->StrainRateHO(&oldepsilon[0],&xyz_list[0][0],gauss,vxold_input,vyold_input);
+ 			material->GetViscosity3d(&viscosity, &epsilon[0]);
+ 			material->GetViscosity3d(&oldviscosity, &oldepsilon[0]);
+ 
+ 			newviscosity=viscosity+viscosity_overshoot*(viscosity-oldviscosity);
+ 		}
+ 		else if (approximation==SSAFSApproximationEnum){
+-			this->GetStrainRate3d(&epsilons[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
++			this->StrainRateFS(&epsilons[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+ 			material->GetViscosity3dFS(&newviscosity,&epsilons[0]);
+ 		}
+ 		else _error_("approximation " << approximation << " (" << EnumToStringx(approximation) << ") not supported yet");
+@@ -7709,8 +7719,8 @@
+ 		GetBHO(&B[0], &xyz_list[0][0], gauss);
+ 		GetBprimeHO(&Bprime[0], &xyz_list[0][0], gauss);
+ 
+-		this->GetStrainRate3dHO(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+-		this->GetStrainRate3dHO(&oldepsilon[0],&xyz_list[0][0],gauss,vxold_input,vyold_input);
++		this->StrainRateHO(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
++		this->StrainRateHO(&oldepsilon[0],&xyz_list[0][0],gauss,vxold_input,vyold_input);
+ 		material->GetViscosity3d(&viscosity, &epsilon[0]);
+ 		material->GetViscosity3d(&oldviscosity, &oldepsilon[0]);
+ 		newviscosity=viscosity+viscosity_overshoot*(viscosity-oldviscosity);
+@@ -7920,7 +7930,7 @@
+ 
+ 		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+ 
+-		this->GetStrainRate3d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
++		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+ 		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+ 
+ 		D_scalar=gauss->weight*Jdet;
+@@ -8018,7 +8028,7 @@
+ 		GetBFS(B,&xyz_list[0][0],gauss); 
+ 		GetBprimeFS(Bprime,&xyz_list[0][0],gauss); 
+ 
+-		this->GetStrainRate3d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
++		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+ 		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+ 
+ 		D_scalar=gauss->weight*Jdet;
+@@ -8276,7 +8286,7 @@
+ 
+ 		vzSSA_input->GetInputDerivativeValue(&dw[0],&xyz_list[0][0],gauss);
+ 
+-		this->GetStrainRate3d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
++		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+ 		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+ 
+ 		for(i=0;i<NUMVERTICES;i++){
+@@ -8354,7 +8364,7 @@
+ 		vzSSA_input->GetInputDerivativeValue(&dw[0],&xyz_list[0][0],gauss);
+ 
+ 		NormalBase(&bed_normal[0],&xyz_list_tria[0][0]);
+-		this->GetStrainRate3d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
++		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+ 		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+ 		friction->GetAlpha2(&alpha2_gauss, gauss,vx_input,vy_input,vz_input);
+ 
+@@ -8438,7 +8448,7 @@
+ 
+ 		vzHO_input->GetInputDerivativeValue(&dw[0],&xyz_list[0][0],gauss);
+ 
+-		this->GetStrainRate3d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
++		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+ 		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+ 
+ 		for(i=0;i<NUMVERTICES;i++){
+@@ -8519,7 +8529,7 @@
+ 		vzHO_input->GetInputDerivativeValue(&dw[0],&xyz_list[0][0],gauss);
+ 
+ 		NormalBase(&bed_normal[0],&xyz_list_tria[0][0]);
+-		this->GetStrainRate3d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
++		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+ 		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+ 		friction->GetAlpha2(&alpha2_gauss, gauss,vx_input,vy_input,vz_input);
+ 
+@@ -9041,7 +9051,7 @@
+ 		gauss->GaussPoint(ig);
+ 
+ 		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		this->GetStrainRate3d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
++		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+ 		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+ 
+ 		GetNodalFunctionsP1Derivatives(&dbasis[0][0],&xyz_list[0][0],gauss);
+@@ -9445,7 +9455,7 @@
+ 		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+ 		GetNodalFunctionsP1Derivatives(&dphi[0][0],&xyz_list[0][0],gauss);
+ 
+-		this->GetStrainRate3dHO(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
++		this->StrainRateHO(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+ 		material->GetViscosityDerivativeEpsSquare(&mu_prime,&epsilon[0]);
+ 		eps1[0]=2*epsilon[0]+epsilon[1];   eps2[0]=epsilon[2];
+ 		eps1[1]=epsilon[2];                eps2[1]=epsilon[0]+2*epsilon[1];
+@@ -9522,12 +9532,12 @@
+ 		GetJacobianDeterminant(&Jdet,&xyz_list[0][0],gauss);
+ 		GetNodalFunctionsDerivativesVelocity(dbasis,&xyz_list[0][0],gauss);
+ 
+-		//this->GetStrainRate3d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
++		//this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+ 		//material->GetViscosityDerivativeEpsSquareFS(&mu_prime,&epsilon[0]);
+ 		//eps1[0]=epsilon[0];   eps2[0]=epsilon[3];   eps3[0]=epsilon[4];
+ 		//eps1[1]=epsilon[3];   eps2[1]=epsilon[1];   eps3[1]=epsilon[5];
+ 		//eps1[2]=epsilon[4];   eps2[2]=epsilon[5];   eps3[2]=epsilon[2];
+-		this->GetStrainRate3dHO(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
++		this->StrainRateHO(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+ 		material->GetViscosityDerivativeEpsSquare(&mu_prime,&epsilon[0]);
+ 		eps1[0]=epsilon[0];   eps2[0]=epsilon[2];   eps3[0]=epsilon[3];
+ 		eps1[1]=epsilon[2];   eps2[1]=epsilon[1];   eps3[1]=epsilon[4];
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16885)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16886)
+@@ -297,7 +297,11 @@
+ 		void           ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+ 		void           ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 		void           ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
++		void           ViscosityHODerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon);
++		void           ViscosityFSDerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon);
+ 		void           ViscositySSADerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){_error_("not implemented");};
++		void           StrainRateFS(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
++		void           StrainRateHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 		void           StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
+ 
+ 		#ifdef _HAVE_STRESSBALANCE_
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16885)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16886)
+@@ -172,7 +172,11 @@
+ 		void        ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented");};
+ 		void        ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
+ 		void        ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
++		void        ViscosityHODerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){_error_("not implemented");};
++		void        ViscosityFSDerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){_error_("not implemented");};
+ 		void        ViscositySSADerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){_error_("not implemented");};
++		void        StrainRateFS(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented");};
++		void        StrainRateHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
+ 		void        StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
+ 		bool        IsZeroLevelset(int levelset_enum){_error_("not implemented");};
+ 		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16886-16887.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16886-16887.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16886-16887.diff	(revision 17802)
@@ -0,0 +1,15 @@
+Index: ../trunk-jpl/src/c/cores/hydrology_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/hydrology_core.cpp	(revision 16886)
++++ ../trunk-jpl/src/c/cores/hydrology_core.cpp	(revision 16887)
+@@ -93,8 +93,8 @@
+ 			if(save_results && ((i+1)%output_frequency==0 || (i+1)==nsteps || i==0)){
+ 				if(VerboseSolution()) _printf0_("   saving results \n");
+ 				if(isefficientlayer){
+-					int outputs[9] = {SedimentHeadEnum,SedimentHeadResidualEnum,EplHeadEnum,HydrologydcMaskEplactiveNodeEnum,HydrologydcMaskEplactiveEltEnum,EplHeadSlopeXEnum,EplHeadSlopeYEnum,HydrologydcEplThicknessEnum,WaterTransferEnum};
+-					femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],9);
++					int outputs[8] = {SedimentHeadEnum,SedimentHeadResidualEnum,EplHeadEnum,HydrologydcMaskEplactiveNodeEnum,EplHeadSlopeXEnum,EplHeadSlopeYEnum,HydrologydcEplThicknessEnum,WaterTransferEnum};
++					femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],8);
+ 				}
+ 				else{
+ 					int outputs[2] = {SedimentHeadEnum,SedimentHeadResidualEnum};
Index: issm/oecreview/Archive/16554-17801/ISSM-16887-16888.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16887-16888.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16887-16888.diff	(revision 17802)
@@ -0,0 +1,521 @@
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h	(revision 16887)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h	(revision 16888)
+@@ -21,11 +21,22 @@
+ 
+ 		/*Finite element Analysis*/
+ 		ElementMatrix* CreateKMatrix(Element* element);
++		ElementMatrix* CreateKMatrixVolume(Element* element);
++		ElementMatrix* CreateKMatrixShelf(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+ 		ElementVector* CreatePVectorVolume(Element* element);
+ 		ElementVector* CreatePVectorSheet(Element* element);
+ 		ElementVector* CreatePVectorShelf(Element* element);
++		void GetBConduct(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBAdvec(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBAdvecprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++
++		/*Intermediaries*/
++		IssmDouble EnthalpyDiffusionParameter(Element* element,IssmDouble enthalpy,IssmDouble pressure);
++		IssmDouble EnthalpyDiffusionParameterVolume(Element* element);
++		IssmDouble PureIceEnthalpy(Element* element,IssmDouble pressure);
++		IssmDouble TMeltingPoint(Element* element,IssmDouble pressure);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16887)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16888)
+@@ -184,8 +184,199 @@
+ 
+ /*Finite Element Analysis*/
+ ElementMatrix* EnthalpyAnalysis::CreateKMatrix(Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	/*compute all stiffness matrices for this element*/
++	ElementMatrix* Ke1=CreateKMatrixVolume(element);
++	ElementMatrix* Ke2=CreateKMatrixShelf(element);
++	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
++
++	/*clean-up and return*/
++	delete Ke1;
++	delete Ke2;
++	return Ke;
+ }/*}}}*/
++ElementMatrix* EnthalpyAnalysis::CreateKMatrixVolume(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	int         stabilization;
++	IssmDouble  Jdet,dt,u,v,w,um,vm,wm,vel;
++	IssmDouble  h,hx,hy,hz,vx,vy,vz;
++	IssmDouble  tau_parameter,diameter;
++	IssmDouble  D_scalar;
++	IssmDouble* xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes    = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementMatrix* Ke       = element->NewElementMatrix();
++	IssmDouble*    basis    = xNew<IssmDouble>(numnodes);
++	IssmDouble*    dbasis   = xNew<IssmDouble>(3*numnodes);
++	IssmDouble*    B        = xNew<IssmDouble>(3*numnodes);
++	IssmDouble*    Bprime   = xNew<IssmDouble>(3*numnodes);
++	IssmDouble     D[3][3]  = {0.};
++	IssmDouble     K[3][3];
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	element->FindParam(&dt,TimesteppingTimeStepEnum);
++	element->FindParam(&stabilization,ThermalStabilizationEnum);
++	IssmDouble  rho_water           = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble  rho_ice             = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	IssmDouble  gravity             = element->GetMaterialParameter(ConstantsGEnum);
++	IssmDouble  heatcapacity        = element->GetMaterialParameter(MaterialsHeatcapacityEnum);
++	IssmDouble  thermalconductivity = element->GetMaterialParameter(MaterialsThermalconductivityEnum);
++	Input* vx_input  = element->GetInput(VxEnum);     _assert_(vx_input);
++	Input* vy_input  = element->GetInput(VyEnum);     _assert_(vy_input);
++	Input* vz_input  = element->GetInput(VzEnum);     _assert_(vz_input);
++	Input* vxm_input = element->GetInput(VxMeshEnum); _assert_(vxm_input);
++	Input* vym_input = element->GetInput(VyMeshEnum); _assert_(vym_input);
++	Input* vzm_input = element->GetInput(VzMeshEnum); _assert_(vzm_input);
++	if(stabilization==2) diameter=element->MinEdgeLength(xyz_list);
++
++	/*Enthalpy diffusion parameter*/
++	IssmDouble kappa=this->EnthalpyDiffusionParameterVolume(element); _assert_(kappa>0.);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		D_scalar=gauss->weight*Jdet;
++		if(dt!=0.) D_scalar=D_scalar*dt;
++
++		/*Conduction: */
++		GetBConduct(B,element,xyz_list,gauss); 
++		D[0][0]=D_scalar*kappa/rho_ice;
++		D[1][1]=D_scalar*kappa/rho_ice;
++		D[2][2]=D_scalar*kappa/rho_ice;
++		TripleMultiply(B,3,numnodes,1,
++					&D[0][0],3,3,0,
++					B,3,numnodes,0,
++					&Ke->values[0],1);
++
++		/*Advection: */
++		GetBAdvec(B,element,xyz_list,gauss); 
++		GetBAdvecprime(Bprime,element,xyz_list,gauss); 
++		vx_input->GetInputValue(&u,gauss); vxm_input->GetInputValue(&um,gauss); vx=u-um;
++		vy_input->GetInputValue(&v,gauss); vym_input->GetInputValue(&vm,gauss); vy=v-vm;
++		vz_input->GetInputValue(&w,gauss); vzm_input->GetInputValue(&wm,gauss); vz=w-wm;
++		D[0][0]=D_scalar*vx;
++		D[1][1]=D_scalar*vy;
++		D[2][2]=D_scalar*vz;
++		TripleMultiply(B,3,numnodes,1,
++					&D[0][0],3,3,0,
++					Bprime,3,numnodes,0,
++					&Ke->values[0],1);
++
++		/*Transient: */
++		if(dt!=0.){
++			D_scalar=gauss->weight*Jdet;
++			element->NodalFunctions(basis,gauss);
++			TripleMultiply(basis,numnodes,1,0,
++						&D_scalar,1,1,0,
++						basis,1,numnodes,0,
++						&Ke->values[0],1);
++			D_scalar=D_scalar*dt;
++		}
++
++		/*Artifficial diffusivity*/
++		if(stabilization==1){
++			element->ElementSizes(&hx,&hy,&hz);
++			vel=sqrt(vx*vx + vy*vy + vz*vz)+1.e-14;
++			h=sqrt( pow(hx*vx/vel,2) + pow(hy*vy/vel,2) + pow(hz*vz/vel,2));
++			K[0][0]=h/(2.*vel)*fabs(vx*vx);  K[0][1]=h/(2.*vel)*fabs(vx*vy); K[0][2]=h/(2.*vel)*fabs(vx*vz);
++			K[1][0]=h/(2.*vel)*fabs(vy*vx);  K[1][1]=h/(2.*vel)*fabs(vy*vy); K[1][2]=h/(2.*vel)*fabs(vy*vz);
++			K[2][0]=h/(2.*vel)*fabs(vz*vx);  K[2][1]=h/(2.*vel)*fabs(vz*vy); K[2][2]=h/(2.*vel)*fabs(vz*vz);
++			for(int i=0;i<3;i++) for(int j=0;j<3;j++) K[i][j] = D_scalar*K[i][j];
++
++			GetBAdvecprime(Bprime,element,xyz_list,gauss); 
++
++			TripleMultiply(Bprime,3,numnodes,1,
++						&K[0][0],3,3,0,
++						Bprime,3,numnodes,0,
++						&Ke->values[0],1);
++		}
++		else if(stabilization==2){
++			element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++			tau_parameter=element->StabilizationParameter(u-um,v-vm,w-wm,diameter,kappa/rho_ice);
++			for(int i=0;i<numnodes;i++){
++				for(int j=0;j<numnodes;j++){
++					Ke->values[i*numnodes+j]+=tau_parameter*D_scalar*
++					  ((u-um)*dbasis[0*3+i]+(v-vm)*dbasis[1*3+i]+(w-wm)*dbasis[2*3+i])*((u-um)*dbasis[0*3+j]+(v-vm)*dbasis[1*3+j]+(w-wm)*dbasis[2*3+j]);
++				}
++			}
++			if(dt!=0.){
++				for(int i=0;i<numnodes;i++){
++					for(int j=0;j<numnodes;j++){
++						Ke->values[i*numnodes+j]+=tau_parameter*D_scalar*basis[j]*((u-um)*dbasis[0*3+i]+(v-vm)*dbasis[1*3+i]+(w-wm)*dbasis[2*3+i]);
++					}
++				}
++			}
++		}
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(dbasis);
++	xDelete<IssmDouble>(B);
++	xDelete<IssmDouble>(Bprime);
++	delete gauss;
++	return Ke;
++}/*}}}*/
++ElementMatrix* EnthalpyAnalysis::CreateKMatrixShelf(Element* element){/*{{{*/
++
++	/*Initialize Element matrix and return if necessary*/
++	if(!element->IsOnBed() || !element->IsFloating()) return NULL;
++
++	IssmDouble  dt,Jdet,D;
++	IssmDouble *xyz_list_base = NULL;
++
++	/*Get basal element*/
++	if(!element->IsOnBed() || !element->IsFloating()) return NULL;
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize vectors*/
++	ElementMatrix* Ke    = element->NewElementMatrix();
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinatesBase(&xyz_list_base);
++	element->FindParam(&dt,TimesteppingTimeStepEnum);
++	IssmDouble  gravity             = element->GetMaterialParameter(ConstantsGEnum);
++	IssmDouble  rho_water           = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble  rho_ice             = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	IssmDouble  heatcapacity        = element->GetMaterialParameter(MaterialsHeatcapacityEnum);
++	IssmDouble  mixed_layer_capacity= element->GetMaterialParameter(MaterialsMixedLayerCapacityEnum);
++	IssmDouble  thermal_exchange_vel= element->GetMaterialParameter(MaterialsThermalExchangeVelocityEnum);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGaussBase(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
++		element->NodalFunctions(basis,gauss);
++
++		D=gauss->weight*Jdet*rho_water*mixed_layer_capacity*thermal_exchange_vel/(heatcapacity*rho_ice);
++		if(reCast<bool,IssmDouble>(dt)) D=dt*D;
++		TripleMultiply(basis,numnodes,1,0,
++					&D,1,1,0,
++					basis,1,numnodes,0,
++					&Ke->values[0],1);
++
++	}
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(xyz_list_base);
++	return Ke;
++}/*}}}*/
+ ElementVector* EnthalpyAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+ 	/*compute all load vectors for this element*/
+@@ -288,16 +479,100 @@
+ 
+ }/*}}}*/
+ ElementVector* EnthalpyAnalysis::CreatePVectorSheet(Element* element){/*{{{*/
+-	return NULL;
++
++	/* Geothermal flux on ice sheet base and basal friction */
++	if(!element->IsOnBed() || element->IsFloating()) return NULL;
++
++	IssmDouble  dt,Jdet,enthalpy,pressure,watercolumn,geothermalflux,vx,vy,vz;
++	IssmDouble  enthalpyup,pressureup,alpha2,scalar,basalfriction,heatflux;
++	IssmDouble *xyz_list_base = NULL;
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize vectors*/
++	ElementVector* pe    = element->NewElementVector();
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinatesBase(&xyz_list_base);
++	element->FindParam(&dt,TimesteppingTimeStepEnum);
++	Input* vx_input             = element->GetInput(VxEnum);                          _assert_(vx_input);
++	Input* vy_input             = element->GetInput(VyEnum);                          _assert_(vy_input);
++	Input* vz_input             = element->GetInput(VzEnum);                          _assert_(vz_input);
++	Input* enthalpy_input       = element->GetInput(EnthalpyPicardEnum);              _assert_(enthalpy_input);
++	Input* pressure_input       = element->GetInput(PressureEnum);                    _assert_(pressure_input);
++	Input* geothermalflux_input = element->GetInput(BasalforcingsGeothermalfluxEnum); _assert_(geothermalflux_input);
++	Input* watercolumn_input    = element->GetInput(WatercolumnEnum);                 _assert_(watercolumn_input);
++	IssmDouble  rho_ice             = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	IssmDouble  heatcapacity        = element->GetMaterialParameter(MaterialsHeatcapacityEnum);
++
++	/*Build friction element, needed later: */
++	Friction* friction=new Friction(element,3);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss   = element->NewGaussBase(2);
++	Gauss* gaussup = element->NewGaussTop(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
++		element->NodalFunctions(basis,gauss);
++
++		enthalpy_input->GetInputValue(&enthalpy,gauss);
++		pressure_input->GetInputValue(&pressure,gauss);
++		watercolumn_input->GetInputValue(&watercolumn,gauss);
++
++		if((watercolumn<=0.) && (enthalpy < PureIceEnthalpy(element,pressure))){
++			/* the above check is equivalent to 
++			 NOT ((watercolumn>0.) AND (enthalpy<PIE)) AND (enthalpy<PIE)*/
++			geothermalflux_input->GetInputValue(&geothermalflux,gauss);
++
++			friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input);
++			vx_input->GetInputValue(&vx,gauss);
++			vy_input->GetInputValue(&vy,gauss);
++			vz_input->GetInputValue(&vz,gauss);
++			basalfriction = alpha2*(vx*vx + vy*vy + vz*vz);
++			heatflux      = (basalfriction+geothermalflux)/(rho_ice);
++
++			scalar = gauss->weight*Jdet*heatflux;
++			if(dt!=0.) scalar=dt*scalar;
++
++			for(int i=0;i<numnodes;i++) pe->values[i]+=scalar*basis[i];
++		}
++		else if(enthalpy >= PureIceEnthalpy(element,pressure)){
++			/* check positive thickness of temperate basal ice layer */
++			enthalpy_input->GetInputValue(&enthalpyup,gaussup);
++			pressure_input->GetInputValue(&pressureup,gaussup);
++			if(enthalpyup >= PureIceEnthalpy(element,pressureup)){
++				// TODO: temperate ice has positive thickness: grad enthalpy*n=0.
++			}
++			else{
++				// only base temperate, set Dirichlet BCs in Penta::UpdateBasalConstraintsEnthalpy()
++			}
++		}
++		else{
++			// base cold, but watercolumn positive. Set base to h_pmp.
++		}
++	}
++
++	/*Clean up and return*/
++	delete gauss;
++	delete gaussup;
++	delete friction;
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(xyz_list_base);
++	return pe;
++
+ }/*}}}*/
+ ElementVector* EnthalpyAnalysis::CreatePVectorShelf(Element* element){/*{{{*/
+ 
++	/*Get basal element*/
++	if(!element->IsOnBed() || !element->IsFloating()) return NULL;
++
+ 	IssmDouble  h_pmp,dt,Jdet,scalar_ocean,pressure;
+ 	IssmDouble *xyz_list_base = NULL;
+ 
+-	/*Get basal element*/
+-	if(!element->IsOnBed() || !element->IsFloating()) return NULL;
+-
+ 	/*Fetch number of nodes for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+ 
+@@ -339,6 +614,93 @@
+ 	xDelete<IssmDouble>(xyz_list_base);
+ 	return pe;
+ }/*}}}*/
++void EnthalpyAnalysis::GetBConduct(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF1. 
++	 * For node i, Bi' can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi_conduct=[ dh/dx ]
++	 *                  [ dh/dy ]
++	 *                  [ dh/dz ]
++	 * where h is the interpolation function for node i.
++	 *
++	 * We assume B has been allocated already, of size: 3x(NDOF1*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* dbasis=xNew<IssmDouble>(3*numnodes);
++	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Build B: */
++	for(int i=0;i<numnodes;i++){
++		B[numnodes*0+i] = dbasis[0*numnodes+i];
++		B[numnodes*1+i] = dbasis[1*numnodes+i];
++		B[numnodes*2+i] = dbasis[2*numnodes+i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(dbasis);
++}/*}}}*/
++void EnthalpyAnalysis::GetBAdvec(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF1. 
++	 * For node i, Bi' can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi_advec =[ h ]
++	 *                 [ h ]
++	 *                 [ h ]
++	 * where h is the interpolation function for node i.
++	 *
++	 * We assume B has been allocated already, of size: 3x(NDOF1*NUMNODESP1)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions*/
++	IssmDouble* basis=xNew<IssmDouble>(numnodes);
++	element->NodalFunctions(basis,gauss);
++
++	/*Build B: */
++	for(int i=0;i<numnodes;i++){
++		B[numnodes*0+i] = basis[i];
++		B[numnodes*1+i] = basis[i];
++		B[numnodes*2+i] = basis[i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(basis);
++}/*}}}*/
++void EnthalpyAnalysis::GetBAdvecprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF1. 
++	 * For node i, Bi' can be expressed in the actual coordinate system
++	 * by: 
++	 *       Biprime_advec=[ dh/dx ]
++	 *                     [ dh/dy ]
++	 *                     [ dh/dz ]
++	 * where h is the interpolation function for node i.
++	 *
++	 * We assume B has been allocated already, of size: 3x(NDOF1*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* dbasis=xNew<IssmDouble>(3*numnodes);
++	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Build B: */
++	for(int i=0;i<numnodes;i++){
++		B[numnodes*0+i] = dbasis[0*numnodes+i];
++		B[numnodes*1+i] = dbasis[1*numnodes+i];
++		B[numnodes*2+i] = dbasis[2*numnodes+i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(dbasis);
++}/*}}}*/
+ void EnthalpyAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,EnthalpyEnum);
+ }/*}}}*/
+@@ -421,3 +783,89 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<int>(doflist);
+ }/*}}}*/
++
++/*Intermediaries*/
++IssmDouble EnthalpyAnalysis::EnthalpyDiffusionParameter(Element* element,IssmDouble enthalpy,IssmDouble pressure){/*{{{*/
++
++	IssmDouble heatcapacity             = element->GetMaterialParameter(MaterialsHeatcapacityEnum);
++	IssmDouble temperateiceconductivity = element->GetMaterialParameter(MaterialsTemperateiceconductivityEnum);
++	IssmDouble thermalconductivity      = element->GetMaterialParameter(MaterialsThermalconductivityEnum);
++
++	if(enthalpy < PureIceEnthalpy(element,pressure)){
++		return thermalconductivity/heatcapacity;
++	}
++	else{
++		return temperateiceconductivity/heatcapacity;
++	}
++}/*}}}*/
++IssmDouble EnthalpyAnalysis::EnthalpyDiffusionParameterVolume(Element* element){/*{{{*/
++
++	int         iv;
++	IssmDouble  lambda;                   /* fraction of cold ice    */
++	IssmDouble  kappa   ,kappa_c,kappa_t; /* enthalpy conductivities */
++	IssmDouble  Hc,Ht;
++
++
++	/*Get pressures and enthalpies on vertices*/
++	int         numvertices = element->GetNumberOfVertices();
++	IssmDouble* pressures   = xNew<IssmDouble>(numvertices);
++	IssmDouble* enthalpies  = xNew<IssmDouble>(numvertices);
++	IssmDouble* PIE         = xNew<IssmDouble>(numvertices);
++	IssmDouble* dHpmp       = xNew<IssmDouble>(numvertices);
++	element->GetInputListOnVertices(pressures,PressureEnum);
++	element->GetInputListOnVertices(enthalpies,EnthalpyEnum);
++	for(iv=0;iv<numvertices;iv++){
++		PIE[iv]   = PureIceEnthalpy(element,pressures[iv]);
++		dHpmp[iv] = enthalpies[iv]-PIE[iv];
++	}
++
++	bool allequalsign = true;
++	if(dHpmp[0]<0.){
++		for(iv=1; iv<numvertices;iv++) allequalsign=(allequalsign && (dHpmp[iv]<0.));
++	}
++	else{
++		for(iv=1; iv<numvertices;iv++) allequalsign=(allequalsign && (dHpmp[iv]>=0.));
++	}
++
++	if(allequalsign){
++		kappa = EnthalpyDiffusionParameter(element,enthalpies[0],pressures[0]);
++	}
++	else{
++		/* return harmonic mean of thermal conductivities, weighted by fraction of cold/temperate ice,
++			cf Patankar 1980, pp44 */
++		kappa_c = EnthalpyDiffusionParameter(element,PureIceEnthalpy(element,0.)-1.,0.);
++		kappa_t = EnthalpyDiffusionParameter(element,PureIceEnthalpy(element,0.)+1.,0.);
++		Hc=0.; Ht=0.;
++		for(iv=0; iv<numvertices;iv++){
++			if(enthalpies[iv]<PIE[iv])
++			 Hc+=(PIE[iv]-enthalpies[iv]);
++			else
++			 Ht+=(enthalpies[iv]-PIE[iv]);
++		}
++		_assert_((Hc+Ht)>0.);
++		lambda = Hc/(Hc+Ht);
++		kappa  = 1./(lambda/kappa_c + (1.-lambda)/kappa_t);
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(PIE);
++	xDelete<IssmDouble>(dHpmp);
++	xDelete<IssmDouble>(pressures);
++	xDelete<IssmDouble>(enthalpies);
++	return kappa;
++}
++/*}}}*/
++IssmDouble EnthalpyAnalysis::PureIceEnthalpy(Element* element,IssmDouble pressure){/*{{{*/
++
++	IssmDouble heatcapacity         = element->GetMaterialParameter(MaterialsHeatcapacityEnum);
++	IssmDouble referencetemperature = element->GetMaterialParameter(ConstantsReferencetemperatureEnum);
++
++	return heatcapacity*(TMeltingPoint(element,pressure)-referencetemperature);
++}/*}}}*/
++IssmDouble EnthalpyAnalysis::TMeltingPoint(Element* element,IssmDouble pressure){/*{{{*/
++
++	IssmDouble meltingpoint = element->GetMaterialParameter(MaterialsMeltingpointEnum);
++	IssmDouble beta         = element->GetMaterialParameter(MaterialsBetaEnum);
++
++	return meltingpoint-beta*pressure;
++}/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16888-16889.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16888-16889.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16888-16889.diff	(revision 17802)
@@ -0,0 +1,202 @@
+Index: ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 16888)
++++ ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 16889)
+@@ -59,7 +59,82 @@
+ 
+ /*Finite Element Analysis*/
+ ElementMatrix* BalancevelocityAnalysis::CreateKMatrix(Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	/*Intermediaries */
++	IssmDouble  dhdt,mb,ms,Jdet;
++	IssmDouble  h,gamma,thickness;
++	IssmDouble  hnx,hny,dhnx[2],dhny[2];
++	IssmDouble *xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element matrix and vectors*/
++	ElementMatrix* Ke     = element->NewElementMatrix();
++	IssmDouble*    B      = xNew<IssmDouble>(2*numnodes);
++	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
++	IssmDouble*    dbasis = xNew<IssmDouble>(2*numnodes);
++	IssmDouble*    HNx    = xNew<IssmDouble>(numnodes);
++	IssmDouble*    HNy    = xNew<IssmDouble>(numnodes);
++	IssmDouble*    H      = xNew<IssmDouble>(numnodes);
++	IssmDouble*    Nx     = xNew<IssmDouble>(numnodes);
++	IssmDouble*    Ny     = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all Inputs and parameters: */
++	element->GetVerticesCoordinates(&xyz_list);
++	Input* H_input = element->GetInput(ThicknessEnum); _assert_(H_input);
++	h = element->CharacteristicLength();
++
++	/*Get vector N for all nodes and build HNx and HNy*/
++	element->GetInputListOnNodes(Nx,SurfaceSlopeXEnum);
++	element->GetInputListOnNodes(Ny,SurfaceSlopeYEnum);
++	element->GetInputListOnNodes(H,ThicknessEnum);
++	for(int i=0;i<numnodes;i++){
++		IssmDouble norm=sqrt(Nx[i]*Nx[i]+Ny[i]*Ny[i]+1.e-10);
++		HNx[i] = -H[i]*Nx[i]/norm;
++		HNy[i] = -H[i]*Ny[i]/norm;
++	}
++
++	/*Start looping on the number of gaussian points:*/
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		H_input->GetInputValue(&thickness,gauss);
++		if(thickness<50.) thickness=50.;
++		element->ValueP1DerivativesOnGauss(&dhnx[0],HNx,xyz_list,gauss);
++		element->ValueP1DerivativesOnGauss(&dhny[0],HNy,xyz_list,gauss);
++		element->ValueP1OnGauss(&hnx,HNx,gauss);
++		element->ValueP1OnGauss(&hny,HNy,gauss);
++
++		gamma=h/(2.*thickness+1.e-10);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctions(basis,gauss);
++		element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++		for(int i=0;i<numnodes;i++){
++			for(int j=0;j<numnodes;j++){
++				Ke->values[i*numnodes+j] += gauss->weight*Jdet*(
++							(basis[i]+gamma*(basis[i]*(dhnx[0]+dhny[1]) + dbasis[0*numnodes+i]*hnx + dbasis[1*numnodes+i]*hny))*
++							(basis[j]*(dhnx[0]+dhny[1])  + dbasis[0*numnodes+j]*hnx + dbasis[1*numnodes+j]*hny)
++							);
++			}
++		}
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(dbasis);
++	xDelete<IssmDouble>(H);
++	xDelete<IssmDouble>(Nx);
++	xDelete<IssmDouble>(Ny);
++	xDelete<IssmDouble>(HNx);
++	xDelete<IssmDouble>(HNy);
++	xDelete<IssmDouble>(B);
++	delete gauss;
++	return Ke;
+ }/*}}}*/
+ ElementVector* BalancevelocityAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 16888)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 16889)
+@@ -45,7 +45,51 @@
+ 
+ /*Finite Element Analysis*/
+ ElementMatrix* SmoothedSurfaceSlopeXAnalysis::CreateKMatrix(Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	/* Intermediaries */
++	IssmDouble  Jdet,thickness,l=8.;
++	IssmDouble *xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element matrix and vectors*/
++	ElementMatrix* Ke     = element->NewElementMatrix();
++	IssmDouble*    dbasis = xNew<IssmDouble>(2*numnodes);
++	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	Input* thickness_input = element->GetInput(ThicknessEnum); _assert_(thickness_input);
++
++	/* Start looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		thickness_input->GetInputValue(&thickness,gauss);
++		if(thickness<50.) thickness=50.;
++
++		element->NodalFunctions(basis,gauss);
++		element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++		for(int i=0;i<numnodes;i++){
++			for(int j=0;j<numnodes;j++){
++				Ke->values[i*numnodes+j] += gauss->weight*Jdet*(
++							basis[i]*basis[j]
++							+(l*thickness)*(l*thickness)*(dbasis[0*numnodes+i]*dbasis[0*numnodes+j] + dbasis[1*numnodes+i]*dbasis[1*numnodes+j])
++							);
++			}
++		}
++	}
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<IssmDouble>(dbasis);
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(xyz_list);
++	return Ke;
+ }/*}}}*/
+ ElementVector* SmoothedSurfaceSlopeXAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 16888)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 16889)
+@@ -45,7 +45,51 @@
+ 
+ /*Finite Element Analysis*/
+ ElementMatrix* SmoothedSurfaceSlopeYAnalysis::CreateKMatrix(Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	/* Intermediaries */
++	IssmDouble  Jdet,thickness,l=8.;
++	IssmDouble *xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element matrix and vectors*/
++	ElementMatrix* Ke     = element->NewElementMatrix();
++	IssmDouble*    dbasis = xNew<IssmDouble>(2*numnodes);
++	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	Input* thickness_input = element->GetInput(ThicknessEnum); _assert_(thickness_input);
++
++	/* Start looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		thickness_input->GetInputValue(&thickness,gauss);
++		if(thickness<50.) thickness=50.;
++
++		element->NodalFunctions(basis,gauss);
++		element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++		for(int i=0;i<numnodes;i++){
++			for(int j=0;j<numnodes;j++){
++				Ke->values[i*numnodes+j] += gauss->weight*Jdet*(
++							basis[i]*basis[j]
++							+(l*thickness)*(l*thickness)*(dbasis[0*numnodes+i]*dbasis[0*numnodes+j] + dbasis[1*numnodes+i]*dbasis[1*numnodes+j])
++							);
++			}
++		}
++	}
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<IssmDouble>(dbasis);
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(xyz_list);
++	return Ke;
+ }/*}}}*/
+ ElementVector* SmoothedSurfaceSlopeYAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16889-16890.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16889-16890.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16889-16890.diff	(revision 17802)
@@ -0,0 +1,344 @@
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h	(revision 16889)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h	(revision 16890)
+@@ -21,7 +21,11 @@
+ 
+ 		/*Finite element Analysis*/
+ 		ElementMatrix* CreateKMatrix(Element* element);
++		ElementMatrix* CreateKMatrixVolume(Element* element);
++		ElementMatrix* CreateKMatrixSurface(Element* element);
++		ElementMatrix* CreateKMatrixBed(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
++		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 16889)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 16890)
+@@ -66,6 +66,10 @@
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
++		case Mesh2DverticalEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			break;
+ 		case Mesh3DEnum:
+ 			if(!element->IsOnBed()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 16889)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 16890)
+@@ -37,11 +37,165 @@
+ 
+ /*Finite Element Analysis*/
+ ElementMatrix* ExtrudeFromBaseAnalysis::CreateKMatrix(Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	/*compute all stiffness matrices for this element*/
++	ElementMatrix* Ke1=CreateKMatrixVolume(element);
++	ElementMatrix* Ke2=CreateKMatrixSurface(element);
++	ElementMatrix* Ke3=CreateKMatrixBed(element);
++	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2,Ke3);
++
++	/*clean-up and return*/
++	delete Ke1;
++	delete Ke2;
++	delete Ke3;
++	return Ke;
+ }/*}}}*/
++ElementMatrix* ExtrudeFromBaseAnalysis::CreateKMatrixVolume(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	IssmDouble  Jdet,D;
++	IssmDouble *xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementMatrix* Ke     = element->NewElementMatrix();
++	IssmDouble*    B      = xNew<IssmDouble>(numnodes);
++	IssmDouble*    Bprime = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctions(Bprime,gauss);
++		GetB(B,element,xyz_list,gauss);
++		D=gauss->weight*Jdet;
++
++		TripleMultiply(B,1,numnodes,1,
++					&D,1,1,0,
++					Bprime,1,numnodes,0,
++					&Ke->values[0],1);
++	} 
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(B);
++	xDelete<IssmDouble>(Bprime);
++	delete gauss;
++	return Ke;
++}
++/*}}}*/
++ElementMatrix* ExtrudeFromBaseAnalysis::CreateKMatrixSurface(Element* element){/*{{{*/
++
++	if(!element->IsOnSurface()) return NULL;
++
++	/*Intermediaries */
++	IssmDouble  Jdet,D,normal[2];
++	IssmDouble *xyz_list_top = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementMatrix* Ke    = element->NewElementMatrix();
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinatesTop(&xyz_list_top);
++	element->NormalTop(&normal[0],xyz_list_top);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGaussTop(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminantTop(&Jdet,xyz_list_top,gauss);
++		element->NodalFunctions(basis,gauss);
++		D = - gauss->weight*Jdet*normal[1]; 
++
++		TripleMultiply(basis,1,numnodes,1,
++					&D,1,1,0,
++					basis,1,numnodes,0,
++					&Ke->values[0],1);
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list_top);
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	return Ke;
++}
++/*}}}*/
++ElementMatrix* ExtrudeFromBaseAnalysis::CreateKMatrixBed(Element* element){/*{{{*/
++
++	if(!element->IsOnBed()) return NULL;
++
++	/*Intermediaries */
++	IssmDouble  Jdet,D,normal[2];
++	IssmDouble *xyz_list_base = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementMatrix* Ke    = element->NewElementMatrix();
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinatesBase(&xyz_list_base);
++	element->NormalBase(&normal[0],xyz_list_base);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGaussBase(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
++		element->NodalFunctions(basis,gauss);
++		D = - gauss->weight*Jdet*normal[1]; 
++
++		TripleMultiply(basis,1,numnodes,1,
++					&D,1,1,0,
++					basis,1,numnodes,0,
++					&Ke->values[0],1);
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list_base);
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	return Ke;
++}
++/*}}}*/
+ ElementVector* ExtrudeFromBaseAnalysis::CreatePVector(Element* element){/*{{{*/
+ 	return NULL;
+ }/*}}}*/
++void ExtrudeFromBaseAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*	Compute B  matrix. B=[dh1/dz dh2/dz dh3/dz dh4/dz dh5/dz dh6/dz];
++		where hi is the interpolation function for node i.*/
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Build B: */
++	for(int i=0;i<numnodes;i++){
++		B[i] = dbasis[1*numnodes+i];  
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(dbasis);
++}
++/*}}}*/
+ void ExtrudeFromBaseAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 16889)
++++ ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 16890)
+@@ -26,7 +26,14 @@
+ 
+ /*Finite Element Analysis*/
+ ElementMatrix* AdjointBalancethicknessAnalysis::CreateKMatrix(Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	BalancethicknessAnalysis* analysis = new BalancethicknessAnalysis();
++	ElementMatrix* Ke = analysis->CreateKMatrix(element);
++	delete analysis;
++
++	/*Transpose and return Ke*/
++	Ke->Transpose();
++	return Ke;
+ }/*}}}*/
+ ElementVector* AdjointBalancethicknessAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16889)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16890)
+@@ -1212,6 +1212,24 @@
+ 	*pxyz_list = xyz_list_edge;
+ 
+ }/*}}}*/
++/*FUNCTION Tria::GetVerticesCoordinatesTop(IssmDouble** pxyz_list){{{*/
++void Tria::GetVerticesCoordinatesTop(IssmDouble** pxyz_list){
++
++	int        indices[2];
++	IssmDouble xyz_list[NUMVERTICES][3];
++
++	/*Element XYZ list*/
++	::GetVerticesCoordinates(&xyz_list[0][0],this->vertices,NUMVERTICES);
++
++	/*Allocate Output*/
++	IssmDouble* xyz_list_edge = xNew<IssmDouble>(2*3);
++	this->EdgeOnSurfaceIndices(&indices[0],&indices[1]);
++	for(int i=0;i<2;i++) for(int j=0;j<2;j++) xyz_list_edge[i*3+j]=xyz_list[indices[i]][j];
++
++	/*Assign output pointer*/
++	*pxyz_list = xyz_list_edge;
++
++}/*}}}*/
+ /*FUNCTION Tria::NormalSection{{{*/
+ void Tria::NormalSection(IssmDouble* normal,IssmDouble* xyz_list){
+ 
+@@ -2085,6 +2103,14 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Tria::JacobianDeterminantTop{{{*/
++void Tria::JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_top,Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussTriaEnum);
++	this->GetSegmentJacobianDeterminant(pJdet,xyz_list_top,(GaussTria*)gauss);
++
++}
++/*}}}*/
+ /*FUNCTION Tria::HasEdgeOnBed {{{*/
+ bool Tria::HasEdgeOnBed(){
+ 
+@@ -2312,6 +2338,14 @@
+ 	return new GaussTria(indices[0],indices[1],order);
+ }
+ /*}}}*/
++/*FUNCTION Tria::NewGaussTop(int order){{{*/
++Gauss* Tria::NewGaussTop(int order){
++
++	int indices[2];
++	this->EdgeOnSurfaceIndices(&indices[0],&indices[1]);
++	return new GaussTria(indices[0],indices[1],order);
++}
++/*}}}*/
+ /*FUNCTION Tria::NewElementVector{{{*/
+ ElementVector* Tria::NewElementVector(int approximation_enum){
+ 	return new ElementVector(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
+@@ -2425,6 +2459,22 @@
+ 	bed_normal[1]= - vector[0]/norm;
+ }
+ /*}}}*/
++/*FUNCTION Tria::NormalTop {{{*/
++void Tria::NormalTop(IssmDouble* bed_normal,IssmDouble* xyz_list){
++
++	/*Build unit outward pointing vector*/
++	IssmDouble vector[2];
++	IssmDouble norm;
++
++	vector[0]=xyz_list[1*3+0] - xyz_list[0*3+0];
++	vector[1]=xyz_list[1*3+1] - xyz_list[0*3+1];
++
++	norm=sqrt(vector[0]*vector[0] + vector[1]*vector[1]);
++
++	bed_normal[0]= + vector[1]/norm;
++	bed_normal[1]= - vector[0]/norm;
++}
++/*}}}*/
+ /*FUNCTION Tria::VelocityInterpolation{{{*/
+ int Tria::VelocityInterpolation(void){
+ 	return TriaRef::VelocityInterpolation();
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16889)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16890)
+@@ -120,7 +120,7 @@
+ 		void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum);
+ 		void        GetVerticesCoordinates(IssmDouble** pxyz_list);
+ 		void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list);
+-		void        GetVerticesCoordinatesTop(IssmDouble** pxyz_list){_error_("not implemented yet");};
++		void        GetVerticesCoordinatesTop(IssmDouble** pxyz_list);
+ 		void        InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);
+ 		void        InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum=MeshElementsEnum);
+ 		void        InputDuplicate(int original_enum,int new_enum);
+@@ -269,7 +269,7 @@
+ 		IssmDouble     GetYcoord(Gauss* gauss);
+ 		IssmDouble     GetZcoord(Gauss* gauss){_error_("not implemented");};
+ 		void           NormalSection(IssmDouble* normal,IssmDouble* xyz_list);
+-		void           NormalTop(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
++		void           NormalTop(IssmDouble* normal,IssmDouble* xyz_list);
+ 		void           NormalBase(IssmDouble* normal,IssmDouble* xyz_list);
+ 		IssmDouble     GetMaterialParameter(int enum_in);
+ 		Input*         GetInput(int inputenum);
+@@ -293,7 +293,7 @@
+ 		void           JacobianDeterminantLine(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void           JacobianDeterminantSurface(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss);
+ 		void           JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss);
+-		void           JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
++		void           JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss);
+ 		IssmDouble     MinEdgeLength(IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		Gauss*         NewGauss(void);
+ 		Gauss*         NewGauss(int order);
+@@ -302,7 +302,7 @@
+       Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert);
+ 		Gauss*         NewGaussBase(int order);
+ 		Gauss*         NewGaussLine(int vertex1,int vertex2,int order){_error_("not implemented yet");};
+-		Gauss*         NewGaussTop(int order){_error_("not implemented yet");};
++		Gauss*         NewGaussTop(int order);
+ 		ElementVector* NewElementVector(int approximation_enum);
+ 		ElementMatrix* NewElementMatrix(int approximation_enum);
+ 		void           NodalFunctions(IssmDouble* basis,Gauss* gauss);
Index: issm/oecreview/Archive/16554-17801/ISSM-16890-16891.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16890-16891.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16890-16891.diff	(revision 17802)
@@ -0,0 +1,25 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16890)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16891)
+@@ -2310,9 +2310,7 @@
+ Gauss* Tria::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){
+ 
+ 	IssmDouble  area_coordinates[2][3];
+-
+ 	GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,xyz_list,2);
+-
+ 	return new GaussTria(area_coordinates,order);
+ }
+ /*}}}*/
+@@ -2325,8 +2323,8 @@
+ /*FUNCTION Tria::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){{{*/
+ Gauss* Tria::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){
+ 
+-	IssmDouble  area_coordinates[4][3];
+-	GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,xyz_list,4);
++	IssmDouble  area_coordinates[2][3];
++	GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,xyz_list,2);
+ 	return new GaussTria(area_coordinates,order_vert);
+ }
+ /*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16891-16892.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16891-16892.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16891-16892.diff	(revision 17802)
@@ -0,0 +1,464 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16891)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16892)
+@@ -38,6 +38,9 @@
+ 		void GetBSSAFriction(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void InputUpdateFromSolutionSSA(IssmDouble* solution,Element* element);
+ 		/*L1L2*/
++		ElementMatrix* CreateKMatrixL1L2(Element* element);
++		ElementMatrix* CreateKMatrixL1L2Viscous(Element* element);
++		ElementMatrix* CreateKMatrixL1L2Friction(Element* element);
+ 		ElementVector* CreatePVectorL1L2(Element* element);
+ 		ElementVector* CreatePVectorL1L2DrivingStress(Element* element);
+ 		ElementVector* CreatePVectorL1L2Front(Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16891)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16892)
+@@ -819,6 +819,8 @@
+ 			return NULL;
+ 		case SSAApproximationEnum: 
+ 			return CreateKMatrixSSA(element);
++		case L1L2ApproximationEnum: 
++			return CreateKMatrixL1L2(element);
+ 		case HOApproximationEnum: 
+ 			return CreateKMatrixHO(element);
+ 		case FSApproximationEnum: 
+@@ -1440,6 +1442,88 @@
+ }/*}}}*/
+ 
+ /*L1L2*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixL1L2(Element* element){/*{{{*/
++
++	/*compute all stiffness matrices for this element*/
++	ElementMatrix* Ke1=CreateKMatrixL1L2Viscous(element);
++	ElementMatrix* Ke2=CreateKMatrixL1L2Friction(element);
++	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
++
++	/*clean-up and return*/
++	delete Ke1;
++	delete Ke2;
++	return Ke;
++}/*}}}*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixL1L2Friction(Element* element){/*{{{*/
++
++	if(!element->IsOnBed() || !element->IsFloating()) return NULL;
++	Element* basalelement = element->SpawnBasalElement();
++	ElementMatrix* Ke = CreateKMatrixSSAFriction(basalelement);
++
++	/*clean-up and return*/
++	basalelement->DeleteMaterials(); delete basalelement;
++	return Ke;
++}/*}}}*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixL1L2Viscous(Element* element){/*{{{*/
++
++	/*Intermediaries*/
++	IssmDouble  viscosity,Jdet;
++	IssmDouble *xyz_list = NULL;
++
++	/*Get element on base*/
++	Element* basalelement = element->GetBasalElement()->SpawnBasalElement();
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = basalelement->GetNumberOfNodes();
++	int numdof   = numnodes*2;
++
++	/*Initialize Element matrix and vectors*/
++	ElementMatrix* Ke     = basalelement->NewElementMatrix(L1L2ApproximationEnum);
++	IssmDouble*    B      = xNew<IssmDouble>(3*numdof);
++	IssmDouble*    Bprime = xNew<IssmDouble>(3*numdof);
++	IssmDouble*    D      = xNewZeroInit<IssmDouble>(3*3);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	Input* surface_input = element->GetInput(SurfaceEnum); _assert_(surface_input);
++	Input* vx_input      = element->GetInput(VxEnum);      _assert_(vx_input);
++	Input* vy_input      = element->GetInput(VyEnum);      _assert_(vy_input);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss      = element->NewGauss(5);
++	Gauss* gauss_base = basalelement->NewGauss();
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++		gauss->SynchronizeGaussBase(gauss_base);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		this->GetBSSA(B,basalelement,xyz_list,gauss_base);
++		this->GetBSSAprime(Bprime,basalelement,xyz_list,gauss_base);
++
++		element->ViscosityL1L2(&viscosity,xyz_list,gauss,vx_input,vy_input,surface_input);
++
++		for(int i=0;i<3;i++) D[i*3+i]=2*viscosity*gauss->weight*Jdet;
++
++		TripleMultiply(B,3,numdof,1,
++					D,3,3,0,
++					Bprime,3,numdof,0,
++					&Ke->values[0],1);
++	}
++
++	/*Transform Coordinate System*/
++	basalelement->TransformStiffnessMatrixCoord(Ke,XYEnum);
++
++	/*Clean up and return*/
++	delete gauss;
++	delete gauss_base;
++	basalelement->DeleteMaterials(); delete basalelement;
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(D);
++	xDelete<IssmDouble>(Bprime);
++	xDelete<IssmDouble>(B);
++	return Ke;
++}/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorL1L2(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16891)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16892)
+@@ -169,6 +169,7 @@
+ 		virtual void   ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input)=0;
+ 		virtual void   ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input)=0;
+ 		virtual void   ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input)=0;
++		virtual void   ViscosityL1L2(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* surf)=0;
+ 		virtual void   ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input)=0;
+ 		virtual void   ViscositySSADerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon)=0;
+ 		virtual void   ViscosityHODerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16891)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16892)
+@@ -328,6 +328,7 @@
+ 		void           ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
+ 		void           ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+ 		void           ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented yet");};
++		void           ViscosityL1L2(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* surf){_error_("not implemented yet");};
+ 		void           ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 		void           ViscosityHODerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){_error_("not implemented");};
+ 		void           ViscosityFSDerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){_error_("not implemented");};
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16891)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16892)
+@@ -3541,6 +3541,74 @@
+ 	*pviscosity=viscosity;
+ }
+ /*}}}*/
++/*FUNCTION Penta::ViscosityL1L2{{{*/
++void Penta::ViscosityL1L2(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* surface_input){
++	/*Compute the L1L2 viscosity
++	 *
++	 *      1
++	 * mu = - A^-1 (sigma'_e)^(1-n)
++	 *      2
++	 *
++	 * sigma'_e^2 = |sigma'_//|^2 + |sigma'_perp|^2 (see Perego 2012 eq. 17,18)
++	 *
++	 * L1L2 assumptions:
++	 *
++	 * (1) |eps_b|_// = A (|sigma'_//|^2 + |sigma'_perp|^2)^((n-1)/2) |sigma'_//|
++	 * (2) |sigma'_perp|^2 = |rho g (s-z) grad(s)|^2
++	 *
++	 * Assuming that n = 3, we have a polynom of degree 3 to solve (the only unkown is X=|sigma'_//|)
++	 *
++	 * A X^3 + A |rho g (s-z) grad(s)|^2 X - |eps_b|_// = 0     */
++
++	int        i;
++	IssmDouble z,s,viscosity,p,q,delta;
++	IssmDouble tau_perp,tau_par,eps_b,A;
++	IssmDouble epsilonvx[5]; /*exx eyy exy exz eyz*/
++	IssmDouble epsilonvy[5]; /*exx eyy exy exz eyz*/
++	IssmDouble epsilon[5];   /*exx eyy exy exz eyz*/
++	IssmDouble z_list[NUMVERTICES];
++	IssmDouble slope[3];
++
++	/*Check that both inputs have been found*/
++	if (!vx_input || !vy_input || !surface_input) _error_("Input missing");
++
++	/*Get tau_perp*/
++	for(i=0;i<NUMVERTICES;i++) z_list[i]=xyz_list[3*i+2];
++	surface_input->GetInputValue(&s,gauss);
++	surface_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
++	PentaRef::GetInputValue(&z,&z_list[0],gauss);
++	tau_perp = matpar->GetRhoIce() * matpar->GetG() * fabs(s-z)*sqrt(slope[0]*slope[0]+slope[1]*slope[1]);
++
++	/* Get eps_b*/
++	vx_input->GetVxStrainRate3dHO(epsilonvx,xyz_list,gauss);
++	vy_input->GetVyStrainRate3dHO(epsilonvy,xyz_list,gauss);
++	for(i=0;i<5;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i];
++	eps_b = sqrt(epsilon[0]*epsilon[0] + epsilon[1]*epsilon[1] + epsilon[0]*epsilon[1] + epsilon[2]*epsilon[2]);
++	if(eps_b==0.){
++		*pviscosity = 2.5e+17;
++		return;
++	}
++
++	/*Get A*/
++	_assert_(material->GetN()==3.0);
++	A=material->GetA();
++
++	/*Solve for tau_perp (http://fr.wikipedia.org/wiki/Méthode_de_Cardan)*/
++	p     = tau_perp *tau_perp;
++	q     = - eps_b/A;
++	delta = q *q + p*p*p*4./27.;
++	_assert_(delta>0);
++	tau_par = pow(0.5*(-q+sqrt(delta)),1./3.) - pow(0.5*(q+sqrt(delta)),1./3.);
++
++	/*Viscosity*/
++	viscosity = 1./(2.*A*(tau_par*tau_par + tau_perp*tau_perp));
++	_assert_(!xIsNan(viscosity));
++	_assert_(viscosity > 0.);
++
++	/*Assign output pointer*/
++	*pviscosity = viscosity;
++}
++/*}}}*/
+ /*FUNCTION Penta::ViscosityHO{{{*/
+ void Penta::ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){
+ 
+@@ -6848,7 +6916,7 @@
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 
+ 		gauss->GaussPoint(ig);
+-		gauss->SynchronizeGaussTria(gauss_tria);
++		gauss->SynchronizeGaussBase(gauss_tria);
+ 
+ 		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+ 		GetBSSAHO(&B[0][0], &xyz_list[0][0], gauss);
+@@ -7053,7 +7121,7 @@
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 
+ 		gauss->GaussPoint(ig);
+-		gauss->SynchronizeGaussTria(gauss_tria);
++		gauss->SynchronizeGaussBase(gauss_tria);
+ 
+ 		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+ 		GetBSSAFS(&B[0][0], &xyz_list[0][0], gauss);
+@@ -7469,7 +7537,7 @@
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 
+ 		gauss->GaussPoint(ig);
+-		gauss->SynchronizeGaussTria(gauss_tria);
++		gauss->SynchronizeGaussBase(gauss_tria);
+ 
+ 		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+ 		tria->GetBSSA(&B[0][0], &xyz_list[0][0], gauss_tria);
+@@ -7617,14 +7685,14 @@
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 
+ 		gauss->GaussPoint(ig);
+-		gauss->SynchronizeGaussTria(gauss_tria);
++		gauss->SynchronizeGaussBase(gauss_tria);
+ 
+ 		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+ 		tria->GetBSSA(&B[0][0], &xyz_list[0][0], gauss_tria);
+ 		tria->GetBprimeSSA(&Bprime[0][0], &xyz_list[0][0], gauss_tria);
+ 
+ 		/*Get viscosity for L1L2 model*/
+-		GetL1L2Viscosity(&viscosity,&xyz_list[0][0],gauss,vx_input,vy_input,surf_input);
++		ViscosityL1L2(&viscosity,&xyz_list[0][0],gauss,vx_input,vy_input,surf_input);
+ 
+ 		for(i=0;i<3;i++) D[i][i]=2*viscosity*gauss->weight*Jdet;
+ 
+@@ -9577,75 +9645,6 @@
+ 	return Ke;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetL1L2Viscosity{{{*/
+-void Penta::GetL1L2Viscosity(IssmDouble* pviscosity,IssmDouble* xyz_list, GaussPenta* gauss, Input* vx_input, Input* vy_input,Input* surface_input){
+-	/*Compute the L1L2 viscosity
+-	 *
+-	 *      1
+-	 * mu = - A^-1 (sigma'_e)^(1-n)
+-	 *      2
+-	 *
+-	 * sigma'_e^2 = |sigma'_//|^2 + |sigma'_perp|^2 (see Perego 2012 eq. 17,18)
+-	 *
+-	 * L1L2 assumptions:
+-	 *
+-	 * (1) |eps_b|_// = A (|sigma'_//|^2 + |sigma'_perp|^2)^((n-1)/2) |sigma'_//|
+-	 * (2) |sigma'_perp|^2 = |rho g (s-z) grad(s)|^2
+-	 *
+-	 * Assuming that n = 3, we have a polynom of degree 3 to solve (the only unkown is X=|sigma'_//|)
+-	 *
+-	 * A X^3 + A |rho g (s-z) grad(s)|^2 X - |eps_b|_// = 0     */
+-
+-	int        i;
+-	IssmDouble z,s,viscosity,p,q,delta;
+-	IssmDouble tau_perp,tau_par,eps_b,A;
+-	IssmDouble epsilonvx[5]; /*exx eyy exy exz eyz*/
+-	IssmDouble epsilonvy[5]; /*exx eyy exy exz eyz*/
+-	IssmDouble epsilon[5];   /*exx eyy exy exz eyz*/
+-	IssmDouble z_list[NUMVERTICES];
+-	IssmDouble slope[3];
+-
+-	/*Check that both inputs have been found*/
+-	if (!vx_input || !vy_input || !surface_input) _error_("Input missing");
+-
+-	/*Get tau_perp*/
+-	for(i=0;i<NUMVERTICES;i++) z_list[i]=xyz_list[3*i+2];
+-	surface_input->GetInputValue(&s,gauss);
+-	surface_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
+-	PentaRef::GetInputValue(&z,&z_list[0],gauss);
+-	tau_perp = matpar->GetRhoIce() * matpar->GetG() * fabs(s-z)*sqrt(slope[0]*slope[0]+slope[1]*slope[1]);
+-
+-	/* Get eps_b*/
+-	vx_input->GetVxStrainRate3dHO(epsilonvx,xyz_list,gauss);
+-	vy_input->GetVyStrainRate3dHO(epsilonvy,xyz_list,gauss);
+-	for(i=0;i<5;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i];
+-	eps_b = sqrt(epsilon[0]*epsilon[0] + epsilon[1]*epsilon[1] + epsilon[0]*epsilon[1] + epsilon[2]*epsilon[2]);
+-	if(eps_b==0.){
+-		*pviscosity = 2.5e+17;
+-		return;
+-	}
+-
+-	/*Get A*/
+-	_assert_(material->GetN()==3.0);
+-	A=material->GetA();
+-
+-	/*Solve for tau_perp (http://fr.wikipedia.org/wiki/Méthode_de_Cardan)*/
+-	p     = tau_perp *tau_perp;
+-	q     = - eps_b/A;
+-	delta = q *q + p*p*p*4./27.;
+-	_assert_(delta>0);
+-	tau_par = pow(0.5*(-q+sqrt(delta)),1./3.) - pow(0.5*(q+sqrt(delta)),1./3.);
+-
+-	/*Viscosity*/
+-	viscosity = 1./(2.*A*(tau_par*tau_par + tau_perp*tau_perp));
+-	_assert_(!xIsNan(viscosity));
+-	_assert_(viscosity > 0.);
+-
+-	/*Assign output pointer*/
+-	*pviscosity = viscosity;
+-	return; 
+-}
+-/*}}}*/
+ #endif
+ 
+ #ifdef _HAVE_BALANCED_
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16891)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16892)
+@@ -296,6 +296,7 @@
+ 		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int* transformenum_list){_error_("not implemented yet");};
+ 		void           ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+ 		void           ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
++		void           ViscosityL1L2(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* surf);
+ 		void           ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
+ 		void           ViscosityHODerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon);
+ 		void           ViscosityFSDerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon);
+@@ -365,7 +366,6 @@
+ 		ElementVector* CreatePVectorStressbalanceVert(void);
+ 		ElementVector* CreatePVectorStressbalanceVertVolume(void);
+ 		ElementVector* CreatePVectorStressbalanceVertBase(void);
+-		void           GetL1L2Viscosity(IssmDouble*, IssmDouble*, GaussPenta*, Input*, Input*, Input*);
+ 		#endif
+ 
+ 		#ifdef _HAVE_CONTROL_
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16891)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16892)
+@@ -171,6 +171,7 @@
+ 		void        ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
+ 		void        ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented");};
+ 		void        ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
++		void        ViscosityL1L2(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* surf){_error_("not implemented yet");};
+ 		void        ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
+ 		void        ViscosityHODerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){_error_("not implemented");};
+ 		void        ViscosityFSDerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){_error_("not implemented");};
+Index: ../trunk-jpl/src/c/classes/gauss/GaussPenta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussPenta.h	(revision 16891)
++++ ../trunk-jpl/src/c/classes/gauss/GaussPenta.h	(revision 16892)
+@@ -47,6 +47,6 @@
+ 		void GaussVertex(int iv);
+ 		void GaussNode(int finitelement,int iv);
+ 		void GaussFaceTria(int index1, int index2, int index3, int order);
+-		void SynchronizeGaussTria(GaussTria* gauss_tria);
++		void SynchronizeGaussBase(Gauss* gauss);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/classes/gauss/GaussSeg.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussSeg.cpp	(revision 16891)
++++ ../trunk-jpl/src/c/classes/gauss/GaussSeg.cpp	(revision 16892)
+@@ -122,3 +122,9 @@
+ 	return numgauss;
+ }
+ /*}}}*/
++/*FUNCTION GaussSeg::SynchronizeGaussBase{{{*/
++void GaussSeg::SynchronizeGaussBase(Gauss* gauss){
++
++	_error_("not supported");
++}
++/*}}}*/
+Index: ../trunk-jpl/src/c/classes/gauss/GaussTria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussTria.cpp	(revision 16891)
++++ ../trunk-jpl/src/c/classes/gauss/GaussTria.cpp	(revision 16892)
+@@ -502,3 +502,9 @@
+ 	return numgauss;
+ }
+ /*}}}*/
++/*FUNCTION GaussTria::SynchronizeGaussBase{{{*/
++void GaussTria::SynchronizeGaussBase(Gauss* gauss){
++
++	_error_("not supported");
++}
++/*}}}*/
+Index: ../trunk-jpl/src/c/classes/gauss/GaussSeg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussSeg.h	(revision 16891)
++++ ../trunk-jpl/src/c/classes/gauss/GaussSeg.h	(revision 16892)
+@@ -33,5 +33,6 @@
+ 		void GaussPoint(int ig);
+ 		void GaussVertex(int iv);
+ 		void GaussNode(int finitelement,int iv);
++		void SynchronizeGaussBase(Gauss* gauss);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/classes/gauss/Gauss.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/Gauss.h	(revision 16891)
++++ ../trunk-jpl/src/c/classes/gauss/Gauss.h	(revision 16892)
+@@ -18,6 +18,7 @@
+ 		virtual void GaussPoint(int ig)=0;
+ 		virtual void GaussVertex(int iv)=0;
+ 		virtual void GaussNode(int finitelement,int iv)=0;
++		virtual void SynchronizeGaussBase(Gauss* gauss)=0;
+ 
+ };
+ #endif
+Index: ../trunk-jpl/src/c/classes/gauss/GaussTria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussTria.h	(revision 16891)
++++ ../trunk-jpl/src/c/classes/gauss/GaussTria.h	(revision 16892)
+@@ -43,5 +43,6 @@
+ 		void GaussVertex(int iv);
+ 		void GaussNode(int finitelement,int iv);
+ 		void GaussEdgeCenter(int index1,int index2);
++		void SynchronizeGaussBase(Gauss* gauss);
+ };
+ #endif  /* _GAUSSTRIA_H_ */
+Index: ../trunk-jpl/src/c/classes/gauss/GaussPenta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussPenta.cpp	(revision 16891)
++++ ../trunk-jpl/src/c/classes/gauss/GaussPenta.cpp	(revision 16892)
+@@ -673,9 +673,12 @@
+ 	return numgauss;
+ }
+ /*}}}*/
+-/*FUNCTION GaussPenta::SynchronizeGaussTria{{{*/
+-void GaussPenta::SynchronizeGaussTria(GaussTria* gauss_tria){
++/*FUNCTION GaussPenta::SynchronizeGaussBase{{{*/
++void GaussPenta::SynchronizeGaussBase(Gauss* gauss){
+ 
++	_assert_(gauss->Enum()==GaussTriaEnum);
++	GaussTria* gauss_tria = dynamic_cast<GaussTria*>(gauss);
++
+ 	gauss_tria->coord1=this->coord1;
+ 	gauss_tria->coord2=this->coord2;
+ 	gauss_tria->coord3=this->coord3;
Index: issm/oecreview/Archive/16554-17801/ISSM-16892-16893.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16892-16893.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16892-16893.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16892)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16893)
+@@ -1448,6 +1448,12 @@
+ 	ElementMatrix* Ke1=CreateKMatrixL1L2Viscous(element);
+ 	ElementMatrix* Ke2=CreateKMatrixL1L2Friction(element);
+ 	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
++	//if(element->Id()==62){
++	//Ke->Echo();
++	//Ke=element->CreateKMatrix();
++	//Ke->Echo();
++	//_error_("S");
++	//}
+ 
+ 	/*clean-up and return*/
+ 	delete Ke1;
+@@ -1456,7 +1462,7 @@
+ }/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixL1L2Friction(Element* element){/*{{{*/
+ 
+-	if(!element->IsOnBed() || !element->IsFloating()) return NULL;
++	if(!element->IsOnBed() || element->IsFloating()) return NULL;
+ 	Element* basalelement = element->SpawnBasalElement();
+ 	ElementMatrix* Ke = CreateKMatrixSSAFriction(basalelement);
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16893-16894.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16893-16894.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16893-16894.diff	(revision 17802)
@@ -0,0 +1,38 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16893)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16894)
+@@ -1448,12 +1448,6 @@
+ 	ElementMatrix* Ke1=CreateKMatrixL1L2Viscous(element);
+ 	ElementMatrix* Ke2=CreateKMatrixL1L2Friction(element);
+ 	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
+-	//if(element->Id()==62){
+-	//Ke->Echo();
+-	//Ke=element->CreateKMatrix();
+-	//Ke->Echo();
+-	//_error_("S");
+-	//}
+ 
+ 	/*clean-up and return*/
+ 	delete Ke1;
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16893)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16894)
+@@ -286,13 +286,12 @@
+ 			element->ElementSizes(&hx,&hy,&hz);
+ 			vel=sqrt(vx*vx + vy*vy + vz*vz)+1.e-14;
+ 			h=sqrt( pow(hx*vx/vel,2) + pow(hy*vy/vel,2) + pow(hz*vz/vel,2));
+-			K[0][0]=h/(2.*vel)*fabs(vx*vx);  K[0][1]=h/(2.*vel)*fabs(vx*vy); K[0][2]=h/(2.*vel)*fabs(vx*vz);
+-			K[1][0]=h/(2.*vel)*fabs(vy*vx);  K[1][1]=h/(2.*vel)*fabs(vy*vy); K[1][2]=h/(2.*vel)*fabs(vy*vz);
+-			K[2][0]=h/(2.*vel)*fabs(vz*vx);  K[2][1]=h/(2.*vel)*fabs(vz*vy); K[2][2]=h/(2.*vel)*fabs(vz*vz);
++			K[0][0]=h/(2.*vel)*vx*vx;  K[0][1]=h/(2.*vel)*vx*vy; K[0][2]=h/(2.*vel)*vx*vz;
++			K[1][0]=h/(2.*vel)*vy*vx;  K[1][1]=h/(2.*vel)*vy*vy; K[1][2]=h/(2.*vel)*vy*vz;
++			K[2][0]=h/(2.*vel)*vz*vx;  K[2][1]=h/(2.*vel)*vz*vy; K[2][2]=h/(2.*vel)*vz*vz;
+ 			for(int i=0;i<3;i++) for(int j=0;j<3;j++) K[i][j] = D_scalar*K[i][j];
+ 
+ 			GetBAdvecprime(Bprime,element,xyz_list,gauss); 
+-
+ 			TripleMultiply(Bprime,3,numnodes,1,
+ 						&K[0][0],3,3,0,
+ 						Bprime,3,numnodes,0,
Index: issm/oecreview/Archive/16554-17801/ISSM-16894-16895.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16894-16895.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16894-16895.diff	(revision 17802)
@@ -0,0 +1,121 @@
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h	(revision 16894)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h	(revision 16895)
+@@ -35,7 +35,7 @@
+ 
+ 		/*Intermediaries*/
+ 		IssmDouble EnthalpyDiffusionParameter(Element* element,IssmDouble enthalpy,IssmDouble pressure);
+-		IssmDouble EnthalpyDiffusionParameterVolume(Element* element);
++		IssmDouble EnthalpyDiffusionParameterVolume(Element* element,int enthalpy_enum);
+ 		IssmDouble PureIceEnthalpy(Element* element,IssmDouble pressure);
+ 		IssmDouble TMeltingPoint(Element* element,IssmDouble pressure);
+ };
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16894)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16895)
+@@ -235,7 +235,7 @@
+ 	if(stabilization==2) diameter=element->MinEdgeLength(xyz_list);
+ 
+ 	/*Enthalpy diffusion parameter*/
+-	IssmDouble kappa=this->EnthalpyDiffusionParameterVolume(element); _assert_(kappa>0.);
++	IssmDouble kappa=this->EnthalpyDiffusionParameterVolume(element,EnthalpyEnum); _assert_(kappa>0.);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	Gauss* gauss=element->NewGauss(2);
+@@ -303,13 +303,13 @@
+ 			for(int i=0;i<numnodes;i++){
+ 				for(int j=0;j<numnodes;j++){
+ 					Ke->values[i*numnodes+j]+=tau_parameter*D_scalar*
+-					  ((u-um)*dbasis[0*3+i]+(v-vm)*dbasis[1*3+i]+(w-wm)*dbasis[2*3+i])*((u-um)*dbasis[0*3+j]+(v-vm)*dbasis[1*3+j]+(w-wm)*dbasis[2*3+j]);
++					  ((u-um)*dbasis[0*numnodes+i]+(v-vm)*dbasis[1*numnodes+i]+(w-wm)*dbasis[2*numnodes+i])*((u-um)*dbasis[0*numnodes+j]+(v-vm)*dbasis[1*numnodes+j]+(w-wm)*dbasis[2*numnodes+j]);
+ 				}
+ 			}
+ 			if(dt!=0.){
+ 				for(int i=0;i<numnodes;i++){
+ 					for(int j=0;j<numnodes;j++){
+-						Ke->values[i*numnodes+j]+=tau_parameter*D_scalar*basis[j]*((u-um)*dbasis[0*3+i]+(v-vm)*dbasis[1*3+i]+(w-wm)*dbasis[2*3+i]);
++						Ke->values[i*numnodes+j]+=tau_parameter*D_scalar*basis[j]*((u-um)*dbasis[0*numnodes+i]+(v-vm)*dbasis[1*numnodes+i]+(w-wm)*dbasis[2*numnodes+i]);
+ 					}
+ 				}
+ 			}
+@@ -409,8 +409,6 @@
+ 	ElementVector* pe             = element->NewElementVector();
+ 	IssmDouble*    basis          = xNew<IssmDouble>(numnodes);
+ 	IssmDouble*    dbasis         = xNew<IssmDouble>(3*numnodes);
+-	IssmDouble*    pressure       = xNew<IssmDouble>(numvertices);
+-	IssmDouble*    enthalpypicard = xNew<IssmDouble>(numvertices);
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+@@ -424,13 +422,12 @@
+ 	Input* enthalpy_input = NULL;
+ 	if(reCast<bool,IssmDouble>(dt)){enthalpy_input = element->GetInput(EnthalpyEnum); _assert_(enthalpy_input);}
+ 	if(stabilization==2){
+-		element->GetInputListOnVertices(enthalpypicard,EnthalpyPicardEnum);
+-		element->GetInputListOnVertices(pressure,PressureEnum);
+ 		diameter=element->MinEdgeLength(xyz_list);
++		kappa=this->EnthalpyDiffusionParameterVolume(element,EnthalpyPicardEnum); _assert_(kappa>0.);
+ 	}
+ 
+ 	/* Start  looping on the number of gaussian points: */
+-	Gauss* gauss=element->NewGauss(3);
++	Gauss* gauss=element->NewGauss(2);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		gauss->GaussPoint(ig);
+ 
+@@ -439,7 +436,7 @@
+ 		element->ViscousHeating(&phi,xyz_list,gauss,vx_input,vy_input,vz_input);
+ 
+ 		scalar_def=phi/rho_ice*Jdet*gauss->weight;
+-		if(reCast<bool,IssmDouble>(dt)) scalar_def=scalar_def*dt;
++		if(dt!=0.) scalar_def=scalar_def*dt;
+ 
+ 		/*TODO: add -beta*laplace T_m(p)*/
+ 		for(int i=0;i<numnodes;i++) pe->values[i]+=scalar_def*basis[i];
+@@ -457,12 +454,12 @@
+ 			vx_input->GetInputValue(&u,gauss);
+ 			vy_input->GetInputValue(&v,gauss);
+ 			vz_input->GetInputValue(&w,gauss);
+-			kappa          = element->EnthalpyDiffusionParameterVolume(numvertices,enthalpypicard,pressure) / rho_ice;
+-			tau_parameter  = element->StabilizationParameter(u,v,w,diameter,kappa);
++			tau_parameter=element->StabilizationParameter(u,v,w,diameter,kappa/rho_ice);
+ 
+-			for(int i=0;i<numnodes;i++) pe->values[i]+=tau_parameter*scalar_def*(u*dbasis[0*3+i]+v*dbasis[1*3+i]+w*dbasis[2*3+i]);
+-			if(reCast<bool,IssmDouble>(dt)){
+-				for(int i=0;i<numnodes;i++) pe->values[i]+=tau_parameter*scalar_transient*(u*dbasis[0*3+i]+v*dbasis[1*3+i]+w*dbasis[2*3+i]);
++			for(int i=0;i<numnodes;i++) pe->values[i]+=tau_parameter*scalar_def*(u*dbasis[0*numnodes+i]+v*dbasis[1*numnodes+i]+w*dbasis[2*numnodes+i]);
++
++			if(dt!=0.){
++				for(int i=0;i<numnodes;i++) pe->values[i]+=tau_parameter*scalar_transient*(u*dbasis[0*numnodes+i]+v*dbasis[1*numnodes+i]+w*dbasis[2*numnodes+i]);
+ 			}
+ 		}
+ 	}
+@@ -470,8 +467,6 @@
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(basis);
+ 	xDelete<IssmDouble>(dbasis);
+-	xDelete<IssmDouble>(pressure);
+-	xDelete<IssmDouble>(enthalpypicard);
+ 	xDelete<IssmDouble>(xyz_list);
+ 	delete gauss;
+ 	return pe;
+@@ -797,7 +792,7 @@
+ 		return temperateiceconductivity/heatcapacity;
+ 	}
+ }/*}}}*/
+-IssmDouble EnthalpyAnalysis::EnthalpyDiffusionParameterVolume(Element* element){/*{{{*/
++IssmDouble EnthalpyAnalysis::EnthalpyDiffusionParameterVolume(Element* element,int enthalpy_enum){/*{{{*/
+ 
+ 	int         iv;
+ 	IssmDouble  lambda;                   /* fraction of cold ice    */
+@@ -812,7 +807,7 @@
+ 	IssmDouble* PIE         = xNew<IssmDouble>(numvertices);
+ 	IssmDouble* dHpmp       = xNew<IssmDouble>(numvertices);
+ 	element->GetInputListOnVertices(pressures,PressureEnum);
+-	element->GetInputListOnVertices(enthalpies,EnthalpyEnum);
++	element->GetInputListOnVertices(enthalpies,enthalpy_enum);
+ 	for(iv=0;iv<numvertices;iv++){
+ 		PIE[iv]   = PureIceEnthalpy(element,pressures[iv]);
+ 		dHpmp[iv] = enthalpies[iv]-PIE[iv];
Index: issm/oecreview/Archive/16554-17801/ISSM-16895-16896.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16895-16896.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16895-16896.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16895)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16896)
+@@ -307,6 +307,7 @@
+ 				}
+ 			}
+ 			if(dt!=0.){
++				D_scalar=gauss->weight*Jdet;
+ 				for(int i=0;i<numnodes;i++){
+ 					for(int j=0;j<numnodes;j++){
+ 						Ke->values[i*numnodes+j]+=tau_parameter*D_scalar*basis[j]*((u-um)*dbasis[0*numnodes+i]+(v-vm)*dbasis[1*numnodes+i]+(w-wm)*dbasis[2*numnodes+i]);
Index: issm/oecreview/Archive/16554-17801/ISSM-16896-16897.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16896-16897.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16896-16897.diff	(revision 17802)
@@ -0,0 +1,97 @@
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16896)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16897)
+@@ -230,13 +230,13 @@
+ 			for(int i=0;i<numnodes;i++){
+ 				for(int j=0;j<numnodes;j++){
+ 					Ke->values[i*numnodes+j]+=tau_parameter*D_scalar*
+-					  ((u-um)*dbasis[0*3+i]+(v-vm)*dbasis[1*3+i]+(w-wm)*dbasis[2*3+i])*((u-um)*dbasis[0*3+j]+(v-vm)*dbasis[1*3+j]+(w-wm)*dbasis[2*3+j]);
++					  ((u-um)*dbasis[0*numnodes+i]+(v-vm)*dbasis[1*numnodes+i]+(w-wm)*dbasis[2*numnodes+i])*((u-um)*dbasis[0*numnodes+j]+(v-vm)*dbasis[1*numnodes+j]+(w-wm)*dbasis[2*numnodes+j]);
+ 				}
+ 			}
+ 			if(dt!=0.){
+ 				for(int i=0;i<numnodes;i++){
+ 					for(int j=0;j<numnodes;j++){
+-						Ke->values[i*numnodes+j]+=tau_parameter*D_scalar*basis[j]*((u-um)*dbasis[0*3+i]+(v-vm)*dbasis[1*3+i]+(w-wm)*dbasis[2*3+i]);
++						Ke->values[i*numnodes+j]+=tau_parameter*D_scalar*basis[j]*((u-um)*dbasis[0*numnodes+i]+(v-vm)*dbasis[1*numnodes+i]+(w-wm)*dbasis[2*numnodes+i]);
+ 					}
+ 				}
+ 			}
+@@ -376,9 +376,9 @@
+ 
+ 			tau_parameter=element->StabilizationParameter(u,v,w,diameter,kappa);
+ 
+-			for(int i=0;i<numnodes;i++) pe->values[i]+=tau_parameter*scalar_def*(u*dbasis[0*3+i]+v*dbasis[1*3+i]+w*dbasis[2*3+i]);
++			for(int i=0;i<numnodes;i++) pe->values[i]+=tau_parameter*scalar_def*(u*dbasis[0*numnodes+i]+v*dbasis[1*numnodes+i]+w*dbasis[2*numnodes+i]);
+ 			if(reCast<bool,IssmDouble>(dt)){
+-				for(int i=0;i<numnodes;i++) pe->values[i]+=tau_parameter*scalar_transient*(u*dbasis[0*3+i]+v*dbasis[1*3+i]+w*dbasis[2*3+i]);
++				for(int i=0;i<numnodes;i++) pe->values[i]+=tau_parameter*scalar_transient*(u*dbasis[0*numnodes+i]+v*dbasis[1*numnodes+i]+w*dbasis[2*numnodes+i]);
+ 			}
+ 		}
+ 	}
+@@ -392,7 +392,63 @@
+ 
+ }/*}}}*/
+ ElementVector* ThermalAnalysis::CreatePVectorSheet(Element* element){/*{{{*/
+-	return NULL;
++
++	/* Geothermal flux on ice sheet base and basal friction */
++	if(!element->IsOnBed() || element->IsFloating()) return NULL;
++
++	IssmDouble  dt,Jdet,geothermalflux,vx,vy,vz;
++	IssmDouble  alpha2,scalar,basalfriction,heatflux;
++	IssmDouble *xyz_list_base = NULL;
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize vectors*/
++	ElementVector* pe    = element->NewElementVector();
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinatesBase(&xyz_list_base);
++	element->FindParam(&dt,TimesteppingTimeStepEnum);
++	Input* vx_input             = element->GetInput(VxEnum);                          _assert_(vx_input);
++	Input* vy_input             = element->GetInput(VyEnum);                          _assert_(vy_input);
++	Input* vz_input             = element->GetInput(VzEnum);                          _assert_(vz_input);
++	Input* geothermalflux_input = element->GetInput(BasalforcingsGeothermalfluxEnum); _assert_(geothermalflux_input);
++	IssmDouble  rho_ice             = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	IssmDouble  heatcapacity        = element->GetMaterialParameter(MaterialsHeatcapacityEnum);
++
++	/*Build friction element, needed later: */
++	Friction* friction=new Friction(element,3);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss   = element->NewGaussBase(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
++		element->NodalFunctions(basis,gauss);
++
++		geothermalflux_input->GetInputValue(&geothermalflux,gauss);
++		friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input);
++		vx_input->GetInputValue(&vx,gauss);
++		vy_input->GetInputValue(&vy,gauss);
++		vz_input->GetInputValue(&vz,gauss);
++		vz = 0.;//FIXME
++		basalfriction = alpha2*(vx*vx + vy*vy + vz*vz);
++		heatflux      = (basalfriction+geothermalflux)/(rho_ice*heatcapacity);
++
++		scalar = gauss->weight*Jdet*heatflux;
++		if(dt!=0.) scalar=dt*scalar;
++
++		for(int i=0;i<numnodes;i++) pe->values[i]+=scalar*basis[i];
++	}
++
++	/*Clean up and return*/
++	delete gauss;
++	delete friction;
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(xyz_list_base);
++	return pe;
+ }/*}}}*/
+ ElementVector* ThermalAnalysis::CreatePVectorShelf(Element* element){/*{{{*/
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16897-16898.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16897-16898.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16897-16898.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16897)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16898)
+@@ -234,6 +234,7 @@
+ 				}
+ 			}
+ 			if(dt!=0.){
++				D_scalar=gauss->weight*Jdet;
+ 				for(int i=0;i<numnodes;i++){
+ 					for(int j=0;j<numnodes;j++){
+ 						Ke->values[i*numnodes+j]+=tau_parameter*D_scalar*basis[j]*((u-um)*dbasis[0*numnodes+i]+(v-vm)*dbasis[1*numnodes+i]+(w-wm)*dbasis[2*numnodes+i]);
Index: issm/oecreview/Archive/16554-17801/ISSM-16898-16899.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16898-16899.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16898-16899.diff	(revision 17802)
@@ -0,0 +1,225 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 16898)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 16899)
+@@ -26,6 +26,7 @@
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ 
+ 		/*Intermediaries*/
++		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		IssmDouble SedimentStoring(Element* element);
+ 		void ElementizeEplMask(FemModel* femmodel);
+ };
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16898)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16899)
+@@ -137,7 +137,79 @@
+ 
+ /*Finite Element Analysis*/
+ ElementMatrix* HydrologyDCInefficientAnalysis::CreateKMatrix(Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	/*Intermediaries*/
++	int      meshtype;
++	Element* basalelement;
++
++	/*Get basal element*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Intermediaries */
++	IssmDouble  D_scalar,Jdet,dt;
++	IssmDouble *xyz_list  = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = basalelement->GetNumberOfNodes();
++
++	/*Initialize Element vector*/
++	ElementMatrix* Ke     = basalelement->NewElementMatrix();
++	IssmDouble*    B      = xNew<IssmDouble>(2*numnodes);
++	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
++	IssmDouble     D[2][2]={0.};
++
++	/*Retrieve all inputs and parameters*/
++	basalelement->GetVerticesCoordinates(&xyz_list);
++	IssmDouble sediment_storing       = SedimentStoring(basalelement);
++	IssmDouble sediment_transmitivity = basalelement->GetMaterialParameter(HydrologydcSedimentTransmitivityEnum);
++	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=basalelement->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++
++		/*Diffusivity*/
++		D_scalar=sediment_transmitivity*gauss->weight*Jdet;
++		if(dt!=0.) D_scalar=D_scalar*dt;
++		D[0][0]=D_scalar;
++		D[1][1]=D_scalar;
++		GetB(B,element,xyz_list,gauss); 
++		TripleMultiply(B,2,numnodes,1,
++					&D[0][0],2,2,0,
++					B,2,numnodes,0,
++					&Ke->values[0],1);
++
++		/*Transient*/
++		if(dt!=0.){
++			basalelement->NodalFunctions(&basis[0],gauss);
++			D_scalar=sediment_storing*gauss->weight*Jdet;
++			TripleMultiply(basis,numnodes,1,0,
++						&D_scalar,1,1,0,
++						basis,1,numnodes,0,
++						&Ke->values[0],1);
++		}
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(B);
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	return Ke;
+ }/*}}}*/
+ ElementVector* HydrologyDCInefficientAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+@@ -210,6 +282,33 @@
+ 	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
++void HydrologyDCInefficientAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
++	 * For node i, Bi can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi=[ dN/dx ]
++	 *          [ dN/dy ]
++	 * where N is the finiteelement function for node i.
++	 *
++	 * We assume B has been allocated already, of size: 3x(NDOF2*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Build B: */
++	for(int i=0;i<numnodes;i++){
++		B[numnodes*0+i] = dbasis[0*numnodes+i];
++		B[numnodes*1+i] = dbasis[1*numnodes+i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(dbasis);
++}/*}}}*/
+ void HydrologyDCInefficientAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,SedimentHeadEnum);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 16898)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 16899)
+@@ -70,7 +70,63 @@
+ 
+ /*Finite Element Analysis*/
+ ElementMatrix* L2ProjectionEPLAnalysis::CreateKMatrix(Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	/*Intermediaries*/
++	int      meshtype;
++	Element* basalelement;
++
++	/*Get basal element*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			break;
++		case Mesh2DverticalEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Intermediaries */
++	IssmDouble  D,Jdet;
++	IssmDouble *xyz_list  = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = basalelement->GetNumberOfNodes();
++
++	/*Initialize Element vector*/
++	ElementMatrix* Ke    = basalelement->NewElementMatrix(NoneApproximationEnum);
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	basalelement->GetVerticesCoordinates(&xyz_list);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=basalelement->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		basalelement->NodalFunctions(basis,gauss);
++		D=gauss->weight*Jdet;
++
++		TripleMultiply(basis,1,numnodes,1,
++					&D,1,1,0,
++					basis,1,numnodes,0,
++					&Ke->values[0],1);
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	return Ke;
+ }/*}}}*/
+ ElementVector* L2ProjectionEPLAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 16898)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 16899)
+@@ -259,6 +259,7 @@
+ 		case HydrologydcEplPorosityEnum:            return this->epl_porosity;
+ 		case HydrologydcEplCompressibilityEnum:     return this->epl_compressibility;
+ 		case HydrologydcWaterCompressibilityEnum:   return this->water_compressibility;
++		case HydrologydcSedimentTransmitivityEnum:  return this->sediment_transmitivity;
+ 		case ConstantsGEnum:                        return this->g;
+ 		default: _error_("Enum "<<EnumToStringx(enum_in)<<" not supported yet");
+ 	}
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16898)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16899)
+@@ -4789,7 +4789,7 @@
+ 	if(stabilization==2) diameter=MinEdgeLength(&xyz_list[0][0]);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(2,3);
++	gauss=new GaussPenta(3,3);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 
+ 		gauss->GaussPoint(ig);
Index: issm/oecreview/Archive/16554-17801/ISSM-16899-16900.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16899-16900.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16899-16900.diff	(revision 17802)
@@ -0,0 +1,105 @@
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16899)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16900)
+@@ -56,6 +56,11 @@
+ 	if(isefficientlayer) {
+ 		femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
+ 		GetSolutionFromInputsx(&ug_epl,femmodel);
++		/*Initialize the transfer input*/
++		HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
++		analysis->ElementizeEplMask(femmodel);
++		delete analysis;
++		femmodel->HydrologyTransferx();
+ 	}
+ 
+ 	/*Iteration on the two layers*/
+@@ -82,14 +87,6 @@
+ 		/*Iteration on the sediment layer*/
+ 		sedconverged=false;
+ 		for(;;){
+-			if(isefficientlayer){
+-				/*Updating Nodal Mask*/
+-				HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
+-				analysis->ElementizeEplMask(femmodel);
+-				delete analysis;
+-			}
+-			femmodel->HydrologyTransferx();
+-
+ 			SystemMatricesx(&Kff,&Kfs,&pf,&df,&sediment_kmax,femmodel);
+ 			CreateNodalConstraintsx(&ys,femmodel->nodes,HydrologyDCInefficientAnalysisEnum);
+ 			Reduceloadx(pf,Kfs,ys); delete Kfs;
+@@ -103,6 +100,7 @@
+ 			Mergesolutionfromftogx(&ug_sed,uf_sed,ys,femmodel->nodes,femmodel->parameters); delete ys;
+ 			InputUpdateFromSolutionx(femmodel,ug_sed);
+ 			ConstraintsStatex(&constraints_converged,&num_unstable_constraints,femmodel);
++
+ 			if (!sedconverged){
+ 				if(VerboseConvergence()) _printf0_("   # Sediment unstable constraints = " << num_unstable_constraints << "\n");
+ 				if(num_unstable_constraints==0) sedconverged = true;
+@@ -113,6 +111,13 @@
+ 			sedcount++;
+ 
+ 			if(sedconverged){
++				if(isefficientlayer){
++				 	/*Updating Nodal Mask*/
++					HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
++					analysis->ElementizeEplMask(femmodel);
++					delete analysis;
++					femmodel->HydrologyTransferx();
++				}
+ 				femmodel->parameters->SetParam(sediment_kmax,HydrologySedimentKmaxEnum);
+ 				InputUpdateFromConstantx(femmodel,sedconverged,ConvergedEnum);
+ 				InputUpdateFromSolutionx(femmodel,ug_sed);
+@@ -146,15 +151,10 @@
+ 				femmodel->HydrologyEPLThicknessx();
+ 
+ 				femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
+-				//				femmodel->HydrologyEPLThicknessx();
++
+ 				//updating mask after the computation of the epl thickness (Allow to close too thin EPL)
+ 				femmodel->HydrologyEPLupdateDomainx();
+-				/*Updating Nodal Mask*/
+-				HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
+-				analysis->ElementizeEplMask(femmodel);
+-				delete analysis;
+ 
+-				femmodel->HydrologyTransferx();
+ 				SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
+ 				CreateNodalConstraintsx(&ys,femmodel->nodes,HydrologyDCEfficientAnalysisEnum);
+ 				Reduceloadx(pf,Kfs,ys); delete Kfs;
+@@ -182,6 +182,13 @@
+ 				eplcount++;
+ 
+ 				if(eplconverged){
++
++					Updating Nodal Mask
++					HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
++					analysis->ElementizeEplMask(femmodel);
++					delete analysis;
++					femmodel->HydrologyTransferx();
++
+ 					InputUpdateFromConstantx(femmodel,eplconverged,ConvergedEnum);
+ 					InputUpdateFromConstantx(femmodel,sediment_kmax,MeltingOffsetEnum);
+ 					InputUpdateFromSolutionx(femmodel,ug_epl);
+@@ -189,6 +196,8 @@
+ 				}
+ 			}
+ 		}
++		
++		
+ 		/*System convergence check*/
+ 		if(!hydroconverged){
+ 			//compute norm(du)/norm(u)
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16899)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16900)
+@@ -7166,7 +7166,6 @@
+ 					}
+ 					/*Assign output pointer*/
+ 					transfer->SetValue(doflist[i],wh_trans,INS_VAL);
+-
+ 				}
+ 			}
+ 			break;
Index: issm/oecreview/Archive/16554-17801/ISSM-16900-16901.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16900-16901.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16900-16901.diff	(revision 17802)
@@ -0,0 +1,3447 @@
+Index: ../trunk-jpl/src/m/solvers/lcdjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/lcdjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/lcdjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=lcdjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','lcd');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'jacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/bicghypreoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/bicghypreoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/bicghypreoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=bicghypreoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','bicg');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'hypre');
++end
+Index: ../trunk-jpl/src/m/solvers/bcgsasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/bcgsasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/bcgsasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=bcgsasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','bcgs');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'asm');
++end
+Index: ../trunk-jpl/src/m/solvers/dgmresasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/dgmresasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/dgmresasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=dgmresasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','dgmres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'asm');
++end
+Index: ../trunk-jpl/src/m/solvers/ibcgsgamgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/ibcgsgamgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/ibcgsgamgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=ibcgsgamgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','ibcgs');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gamg');
++end
+Index: ../trunk-jpl/src/m/solvers/bcgslpbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/bcgslpbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/bcgslpbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=bcgslpbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','bcgsl');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'pbjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/cgsjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/cgsjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/cgsjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=cgsjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cgs');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'jacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/stcgmgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/stcgmgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/stcgmgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=stcgmgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','stcg');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'mg');
++end
+Index: ../trunk-jpl/src/m/solvers/lcdsoroptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/lcdsoroptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/lcdsoroptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=lcdsoroptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','lcd');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'sor');
++end
+Index: ../trunk-jpl/src/m/solvers/richardsongamgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/richardsongamgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/richardsongamgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=richardsongamgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','richardson');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gamg');
++end
+Index: ../trunk-jpl/src/m/solvers/dgmresjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/dgmresjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/dgmresjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=dgmresjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','dgmres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'jacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/symmlqjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/symmlqjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/symmlqjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=symmlqjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','symmlq');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'jacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/fgmresjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/fgmresjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/fgmresjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=fgmresjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','fgmres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'jacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/fgmreshypreoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/fgmreshypreoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/fgmreshypreoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=fgmreshypreoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','fgmres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'hypre');
++end
+Index: ../trunk-jpl/src/m/solvers/lsqrbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/lsqrbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/lsqrbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=lsqrbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','lsqr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'bjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/minresasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/minresasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/minresasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=minresasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','minres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'asm');
++end
+Index: ../trunk-jpl/src/m/solvers/tfqmrhypreoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/tfqmrhypreoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/tfqmrhypreoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=tfqmrhypreoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','tfqmr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'hypre');
++end
+Index: ../trunk-jpl/src/m/solvers/bcgsmgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/bcgsmgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/bcgsmgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=bcgsmgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','bcgs');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'mg');
++end
+Index: ../trunk-jpl/src/m/solvers/cgbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/cgbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/cgbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=cgbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cg');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'bjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/lsqrsoroptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/lsqrsoroptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/lsqrsoroptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=lsqrsoroptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','lsqr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'sor');
++end
+Index: ../trunk-jpl/src/m/solvers/symmlqsoroptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/symmlqsoroptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/symmlqsoroptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=symmlqsoroptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','symmlq');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'sor');
++end
+Index: ../trunk-jpl/src/m/solvers/cgsgamgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/cgsgamgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/cgsgamgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=cgsgamgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cgs');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gamg');
++end
+Index: ../trunk-jpl/src/m/solvers/stcgbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/stcgbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/stcgbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=stcgbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','stcg');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'bjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/lcdhypreoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/lcdhypreoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/lcdhypreoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=lcdhypreoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','lcd');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'hypre');
++end
+Index: ../trunk-jpl/src/m/solvers/dgmrespbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/dgmrespbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/dgmrespbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=dgmrespbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','dgmres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'pbjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/bicgjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/bicgjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/bicgjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=bicgjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','bicg');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'jacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/cgsoroptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/cgsoroptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/cgsoroptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=cgsoroptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cg');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'sor');
++end
+Index: ../trunk-jpl/src/m/solvers/crbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/crbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/crbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=crbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'bjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/gmresasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gmresasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/gmresasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=gmresasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gmres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'asm');
++end
+Index: ../trunk-jpl/src/m/solvers/richardsonmgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/richardsonmgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/richardsonmgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=richardsonmgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','richardson');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'mg');
++end
+Index: ../trunk-jpl/src/m/solvers/cgnebjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/cgnebjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/cgnebjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=cgnebjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cgne');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'bjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/lcdmgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/lcdmgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/lcdmgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=lcdmgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','lcd');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'mg');
++end
+Index: ../trunk-jpl/src/m/solvers/dgmresgasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/dgmresgasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/dgmresgasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=dgmresgasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','dgmres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gasm');
++end
+Index: ../trunk-jpl/src/m/solvers/symmlqhypreoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/symmlqhypreoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/symmlqhypreoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=symmlqhypreoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','symmlq');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'hypre');
++end
+Index: ../trunk-jpl/src/m/solvers/crpbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/crpbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/crpbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=crpbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'pbjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/ibcgshypreoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/ibcgshypreoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/ibcgshypreoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=ibcgshypreoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','ibcgs');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'hypre');
++end
+Index: ../trunk-jpl/src/m/solvers/bicggamgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/bicggamgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/bicggamgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=bicggamgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','bicg');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gamg');
++end
+Index: ../trunk-jpl/src/m/solvers/cgsmgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/cgsmgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/cgsmgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=cgsmgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cgs');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'mg');
++end
+Index: ../trunk-jpl/src/m/solvers/stcgasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/stcgasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/stcgasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=stcgasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','stcg');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'asm');
++end
+Index: ../trunk-jpl/src/m/solvers/tfqmrbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/tfqmrbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/tfqmrbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=tfqmrbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','tfqmr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'bjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/bcgslbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/bcgslbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/bcgslbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=bcgslbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','bcgsl');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'bjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/gcrpbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gcrpbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/gcrpbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=gcrpbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gcr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'pbjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/crasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/crasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/crasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=crasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'asm');
++end
+Index: ../trunk-jpl/src/m/solvers/cgnepbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/cgnepbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/cgnepbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=cgnepbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cgne');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'pbjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/symmlqmgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/symmlqmgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/symmlqmgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=symmlqmgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','symmlq');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'mg');
++end
+Index: ../trunk-jpl/src/m/solvers/bcgspbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/bcgspbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/bcgspbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=bcgspbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','bcgs');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'pbjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/stcggasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/stcggasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/stcggasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=stcggasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','stcg');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gasm');
++end
+Index: ../trunk-jpl/src/m/solvers/stcghypreoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/stcghypreoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/stcghypreoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=stcghypreoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','stcg');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'hypre');
++end
+Index: ../trunk-jpl/src/m/solvers/crhypreoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/crhypreoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/crhypreoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=crhypreoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'hypre');
++end
+Index: ../trunk-jpl/src/m/solvers/cgneasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/cgneasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/cgneasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=cgneasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cgne');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'asm');
++end
+Index: ../trunk-jpl/src/m/solvers/tfqmrsoroptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/tfqmrsoroptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/tfqmrsoroptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=tfqmrsoroptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','tfqmr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'sor');
++end
+Index: ../trunk-jpl/src/m/solvers/richardsonsoroptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/richardsonsoroptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/richardsonsoroptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=richardsonsoroptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','richardson');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'sor');
++end
+Index: ../trunk-jpl/src/m/solvers/ibcgspbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/ibcgspbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/ibcgspbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=ibcgspbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','ibcgs');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'pbjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/minresmgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/minresmgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/minresmgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=minresmgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','minres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'mg');
++end
+Index: ../trunk-jpl/src/m/solvers/gcrgasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gcrgasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/gcrgasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=gcrgasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gcr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gasm');
++end
+Index: ../trunk-jpl/src/m/solvers/fgmresasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/fgmresasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/fgmresasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=fgmresasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','fgmres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'asm');
++end
+Index: ../trunk-jpl/src/m/solvers/cgnehypreoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/cgnehypreoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/cgnehypreoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=cgnehypreoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cgne');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'hypre');
++end
+Index: ../trunk-jpl/src/m/solvers/gcrbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gcrbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/gcrbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=gcrbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gcr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'bjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/bcgslgamgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/bcgslgamgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/bcgslgamgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=bcgslgamgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','bcgsl');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gamg');
++end
+Index: ../trunk-jpl/src/m/solvers/bicgmgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/bicgmgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/bicgmgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=bicgmgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','bicg');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'mg');
++end
+Index: ../trunk-jpl/src/m/solvers/dgmreshypreoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/dgmreshypreoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/dgmreshypreoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=dgmreshypreoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','dgmres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'hypre');
++end
+Index: ../trunk-jpl/src/m/solvers/bcgslasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/bcgslasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/bcgslasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=bcgslasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','bcgsl');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'asm');
++end
+Index: ../trunk-jpl/src/m/solvers/lcdpbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/lcdpbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/lcdpbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=lcdpbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','lcd');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'pbjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/gltrsoroptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gltrsoroptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/gltrsoroptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=gltrsoroptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gltr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'sor');
++end
+Index: ../trunk-jpl/src/m/solvers/gcrmgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gcrmgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/gcrmgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=gcrmgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gcr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'mg');
++end
+Index: ../trunk-jpl/src/m/solvers/gcrsoroptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gcrsoroptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/gcrsoroptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=gcrsoroptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gcr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'sor');
++end
+Index: ../trunk-jpl/src/m/solvers/ibcgsgasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/ibcgsgasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/ibcgsgasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=ibcgsgasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','ibcgs');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gasm');
++end
+Index: ../trunk-jpl/src/m/solvers/cgssoroptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/cgssoroptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/cgssoroptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=cgssoroptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cgs');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'sor');
++end
+Index: ../trunk-jpl/src/m/solvers/gmresmgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gmresmgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/gmresmgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=gmresmgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gmres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'mg');
++end
+Index: ../trunk-jpl/src/m/solvers/gltrpbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gltrpbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/gltrpbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=gltrpbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gltr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'pbjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/richardsongasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/richardsongasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/richardsongasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=richardsongasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','richardson');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gasm');
++end
+Index: ../trunk-jpl/src/m/solvers/minreshypreoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/minreshypreoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/minreshypreoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=minreshypreoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','minres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'hypre');
++end
+Index: ../trunk-jpl/src/m/solvers/lsqrmgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/lsqrmgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/lsqrmgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=lsqrmgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','lsqr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'mg');
++end
+Index: ../trunk-jpl/src/m/solvers/ibcgsmgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/ibcgsmgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/ibcgsmgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=ibcgsmgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','ibcgs');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'mg');
++end
+Index: ../trunk-jpl/src/m/solvers/symmlqpbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/symmlqpbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/symmlqpbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=symmlqpbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','symmlq');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'pbjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/crjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/crjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/crjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=crjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'jacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/cgmgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/cgmgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/cgmgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=cgmgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cg');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'mg');
++end
+Index: ../trunk-jpl/src/m/solvers/fgmresgamgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/fgmresgamgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/fgmresgamgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=fgmresgamgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','fgmres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gamg');
++end
+Index: ../trunk-jpl/src/m/solvers/cgsgasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/cgsgasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/cgsgasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=cgsgasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cgs');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gasm');
++end
+Index: ../trunk-jpl/src/m/solvers/cgnejacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/cgnejacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/cgnejacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=cgnejacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cgne');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'jacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/gmreshypreoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gmreshypreoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/gmreshypreoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=gmreshypreoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gmres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'hypre');
++end
+Index: ../trunk-jpl/src/m/solvers/bicgsoroptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/bicgsoroptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/bicgsoroptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=bicgsoroptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','bicg');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'sor');
++end
+Index: ../trunk-jpl/src/m/solvers/ibcgsasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/ibcgsasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/ibcgsasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=ibcgsasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','ibcgs');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'asm');
++end
+Index: ../trunk-jpl/src/m/solvers/minresgamgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/minresgamgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/minresgamgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=minresgamgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','minres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gamg');
++end
+Index: ../trunk-jpl/src/m/solvers/dgmresbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/dgmresbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/dgmresbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=dgmresbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','dgmres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'bjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/crgamgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/crgamgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/crgamgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=crgamgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gamg');
++end
+Index: ../trunk-jpl/src/m/solvers/bcgssoroptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/bcgssoroptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/bcgssoroptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=bcgssoroptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','bcgs');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'sor');
++end
+Index: ../trunk-jpl/src/m/solvers/dgmressoroptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/dgmressoroptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/dgmressoroptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=dgmressoroptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','dgmres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'sor');
++end
+Index: ../trunk-jpl/src/m/solvers/minresbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/minresbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/minresbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=minresbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','minres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'bjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/cgnegamgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/cgnegamgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/cgnegamgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=cgnegamgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cgne');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gamg');
++end
+Index: ../trunk-jpl/src/m/solvers/gmresgamgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gmresgamgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/gmresgamgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=gmresgamgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gmres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gamg');
++end
+Index: ../trunk-jpl/src/m/solvers/bcgsgamgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/bcgsgamgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/bcgsgamgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=bcgsgamgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','bcgs');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gamg');
++end
+Index: ../trunk-jpl/src/m/solvers/lcdbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/lcdbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/lcdbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=lcdbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','lcd');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'bjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/bicggasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/bicggasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/bicggasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=bicggasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','bicg');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gasm');
++end
+Index: ../trunk-jpl/src/m/solvers/tfqmrmgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/tfqmrmgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/tfqmrmgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=tfqmrmgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','tfqmr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'mg');
++end
+Index: ../trunk-jpl/src/m/solvers/lsqrgamgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/lsqrgamgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/lsqrgamgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=lsqrgamgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','lsqr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gamg');
++end
+Index: ../trunk-jpl/src/m/solvers/gltrjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gltrjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/gltrjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=gltrjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gltr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'jacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/minressoroptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/minressoroptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/minressoroptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=minressoroptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','minres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'sor');
++end
+Index: ../trunk-jpl/src/m/solvers/cggamgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/cggamgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/cggamgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=cggamgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cg');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gamg');
++end
+Index: ../trunk-jpl/src/m/solvers/bcgshypreoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/bcgshypreoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/bcgshypreoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=bcgshypreoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','bcgs');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'hypre');
++end
+Index: ../trunk-jpl/src/m/solvers/gmresbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gmresbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/gmresbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=gmresbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gmres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'bjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/crmgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/crmgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/crmgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=crmgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'mg');
++end
+Index: ../trunk-jpl/src/m/solvers/symmlqbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/symmlqbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/symmlqbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=symmlqbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','symmlq');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'bjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/lcdgamgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/lcdgamgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/lcdgamgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=lcdgamgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','lcd');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gamg');
++end
+Index: ../trunk-jpl/src/m/solvers/conditionnumberoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/conditionnumberoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/conditionnumberoptions.m	(revision 16901)
+@@ -0,0 +1,22 @@
++function cn=conditionnumberoptions(varargin)
++%MULTIGRIDOPTIONS - use Multigrid 
++%
++%   Usage:
++%      options=mgoptions;
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++cn=struct();
++cn..toolkit='petsc';
++
++%default  options
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++	cn.mat_type=getfieldvalue(options,'mat_type','mpiaij');
++	cn.ksp_type=getfieldvalue(options,'ksp_type','gmres');
++	cn.pc_type=getfieldvalue(options,'pc_type','none');
++	cn.ksp_monitor_singular_value=getfieldvalue(options,'ksp_monitor_singular_value','');
++	cn.ksp_gmres_restart=getfieldvalue(options,'ksp_gmres_restart',1000);
++	cn.info=getfieldvalue(options,'info','');
++	cn.log_summary=getfieldvalue(options,'log_summary','');
++end
+Index: ../trunk-jpl/src/m/solvers/cgnemgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/cgnemgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/cgnemgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=cgnemgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cgne');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'mg');
++end
+Index: ../trunk-jpl/src/m/solvers/gmressoroptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gmressoroptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/gmressoroptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=gmressoroptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gmres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'sor');
++end
+Index: ../trunk-jpl/src/m/solvers/bcgslgasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/bcgslgasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/bcgslgasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=bcgslgasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','bcgsl');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gasm');
++end
+Index: ../trunk-jpl/src/m/solvers/lcdasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/lcdasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/lcdasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=lcdasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','lcd');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'asm');
++end
+Index: ../trunk-jpl/src/m/solvers/gltrgamgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gltrgamgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/gltrgamgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=gltrgamgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gltr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gamg');
++end
+Index: ../trunk-jpl/src/m/solvers/minresjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/minresjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/minresjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=minresjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','minres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'jacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/fgmrespbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/fgmrespbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/fgmrespbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=fgmrespbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','fgmres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'pbjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/symmlqgamgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/symmlqgamgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/symmlqgamgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=symmlqgamgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','symmlq');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gamg');
++end
+Index: ../trunk-jpl/src/m/solvers/lsqrasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/lsqrasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/lsqrasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=lsqrasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','lsqr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'asm');
++end
+Index: ../trunk-jpl/src/m/solvers/gcrjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gcrjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/gcrjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=gcrjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gcr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'jacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/gcrhypreoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gcrhypreoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/gcrhypreoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=gcrhypreoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gcr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'hypre');
++end
+Index: ../trunk-jpl/src/m/solvers/symmlqasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/symmlqasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/symmlqasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=symmlqasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','symmlq');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'asm');
++end
+Index: ../trunk-jpl/src/m/solvers/stcgsoroptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/stcgsoroptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/stcgsoroptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=stcgsoroptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','stcg');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'sor');
++end
+Index: ../trunk-jpl/src/m/solvers/gmresjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gmresjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/gmresjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=gmresjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gmres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'jacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/tfqmrgamgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/tfqmrgamgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/tfqmrgamgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=tfqmrgamgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','tfqmr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gamg');
++end
+Index: ../trunk-jpl/src/m/solvers/minrespbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/minrespbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/minrespbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=minrespbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','minres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'pbjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/crsoroptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/crsoroptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/crsoroptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=crsoroptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'sor');
++end
+Index: ../trunk-jpl/src/m/solvers/lsqrjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/lsqrjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/lsqrjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=lsqrjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','lsqr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'jacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/cgasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/cgasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/cgasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=cgasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cg');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'asm');
++end
+Index: ../trunk-jpl/src/m/solvers/stcgpbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/stcgpbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/stcgpbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=stcgpbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','stcg');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'pbjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/fgmresgasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/fgmresgasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/fgmresgasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=fgmresgasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','fgmres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gasm');
++end
+Index: ../trunk-jpl/src/m/solvers/gltrmgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gltrmgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/gltrmgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=gltrmgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gltr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'mg');
++end
+Index: ../trunk-jpl/src/m/solvers/fgmresbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/fgmresbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/fgmresbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=fgmresbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','fgmres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'bjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/ibcgsjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/ibcgsjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/ibcgsjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=ibcgsjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','ibcgs');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'jacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/cgnesoroptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/cgnesoroptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/cgnesoroptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=cgnesoroptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cgne');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'sor');
++end
+Index: ../trunk-jpl/src/m/solvers/cgjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/cgjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/cgjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=cgjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cg');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'jacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/bcgsljacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/bcgsljacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/bcgsljacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=bcgsljacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','bcgsl');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'jacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/dgmresmgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/dgmresmgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/dgmresmgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=dgmresmgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','dgmres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'mg');
++end
+Index: ../trunk-jpl/src/m/solvers/minresgasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/minresgasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/minresgasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=minresgasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','minres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gasm');
++end
+Index: ../trunk-jpl/src/m/solvers/richardsonbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/richardsonbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/richardsonbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=richardsonbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','richardson');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'bjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/gmrespbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gmrespbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/gmrespbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=gmrespbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gmres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'pbjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/fgmressoroptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/fgmressoroptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/fgmressoroptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=fgmressoroptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','fgmres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'sor');
++end
+Index: ../trunk-jpl/src/m/solvers/fgmresmgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/fgmresmgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/fgmresmgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=fgmresmgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','fgmres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'mg');
++end
+Index: ../trunk-jpl/src/m/solvers/lsqrpbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/lsqrpbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/lsqrpbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=lsqrpbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','lsqr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'pbjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/crgasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/crgasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/crgasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=crgasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gasm');
++end
+Index: ../trunk-jpl/src/m/solvers/bcgslsoroptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/bcgslsoroptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/bcgslsoroptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=bcgslsoroptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','bcgsl');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'sor');
++end
+Index: ../trunk-jpl/src/m/solvers/gltrbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gltrbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/gltrbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=gltrbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gltr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'bjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/cgpbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/cgpbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/cgpbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=cgpbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cg');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'pbjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/cgnegasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/cgnegasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/cgnegasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=cgnegasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cgne');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gasm');
++end
+Index: ../trunk-jpl/src/m/solvers/gmresgasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gmresgasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/gmresgasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=gmresgasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gmres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gasm');
++end
+Index: ../trunk-jpl/src/m/solvers/bcgsgasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/bcgsgasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/bcgsgasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=bcgsgasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','bcgs');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gasm');
++end
+Index: ../trunk-jpl/src/m/solvers/cgsbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/cgsbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/cgsbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=cgsbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cgs');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'bjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/richardsonpbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/richardsonpbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/richardsonpbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=richardsonpbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','richardson');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'pbjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/lsqrgasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/lsqrgasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/lsqrgasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=lsqrgasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','lsqr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gasm');
++end
+Index: ../trunk-jpl/src/m/solvers/tfqmrasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/tfqmrasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/tfqmrasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=tfqmrasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','tfqmr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'asm');
++end
+Index: ../trunk-jpl/src/m/solvers/richardsonasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/richardsonasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/richardsonasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=richardsonasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','richardson');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'asm');
++end
+Index: ../trunk-jpl/src/m/solvers/ibcgsbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/ibcgsbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/ibcgsbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=ibcgsbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','ibcgs');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'bjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/cggasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/cggasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/cggasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=cggasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cg');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gasm');
++end
+Index: ../trunk-jpl/src/m/solvers/tfqmrjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/tfqmrjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/tfqmrjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=tfqmrjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','tfqmr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'jacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/bcgslhypreoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/bcgslhypreoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/bcgslhypreoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=bcgslhypreoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','bcgsl');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'hypre');
++end
+Index: ../trunk-jpl/src/m/solvers/richardsonhypreoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/richardsonhypreoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/richardsonhypreoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=richardsonhypreoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','richardson');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'hypre');
++end
+Index: ../trunk-jpl/src/m/solvers/cgspbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/cgspbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/cgspbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=cgspbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cgs');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'pbjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/stcgjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/stcgjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/stcgjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=stcgjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','stcg');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'jacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/gltrasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gltrasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/gltrasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=gltrasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gltr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'asm');
++end
+Index: ../trunk-jpl/src/m/solvers/lcdgasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/lcdgasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/lcdgasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=lcdgasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','lcd');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gasm');
++end
+Index: ../trunk-jpl/src/m/solvers/ibcgssoroptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/ibcgssoroptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/ibcgssoroptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=ibcgssoroptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','ibcgs');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'sor');
++end
+Index: ../trunk-jpl/src/m/solvers/gcrasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gcrasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/gcrasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=gcrasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gcr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'asm');
++end
+Index: ../trunk-jpl/src/m/solvers/dgmresgamgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/dgmresgamgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/dgmresgamgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=dgmresgamgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','dgmres');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gamg');
++end
+Index: ../trunk-jpl/src/m/solvers/cgsasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/cgsasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/cgsasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=cgsasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cgs');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'asm');
++end
+Index: ../trunk-jpl/src/m/solvers/bicgbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/bicgbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/bicgbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=bicgbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','bicg');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'bjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/bcgslmgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/bcgslmgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/bcgslmgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=bcgslmgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','bcgsl');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'mg');
++end
+Index: ../trunk-jpl/src/m/solvers/gltrhypreoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gltrhypreoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/gltrhypreoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=gltrhypreoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gltr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'hypre');
++end
+Index: ../trunk-jpl/src/m/solvers/gltrgasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gltrgasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/gltrgasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=gltrgasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gltr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gasm');
++end
+Index: ../trunk-jpl/src/m/solvers/tfqmrpbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/tfqmrpbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/tfqmrpbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=tfqmrpbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','tfqmr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'pbjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/cgshypreoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/cgshypreoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/cgshypreoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=cgshypreoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cgs');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'hypre');
++end
+Index: ../trunk-jpl/src/m/solvers/bcgsjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/bcgsjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/bcgsjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=bcgsjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','bcgs');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'jacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/bcgsbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/bcgsbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/bcgsbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=bcgsbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','bcgs');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'bjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/lsqrhypreoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/lsqrhypreoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/lsqrhypreoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=lsqrhypreoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','lsqr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'hypre');
++end
+Index: ../trunk-jpl/src/m/solvers/symmlqgasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/symmlqgasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/symmlqgasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=symmlqgasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','symmlq');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gasm');
++end
+Index: ../trunk-jpl/src/m/solvers/stcggamgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/stcggamgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/stcggamgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=stcggamgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','stcg');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gamg');
++end
+Index: ../trunk-jpl/src/m/solvers/bicgpbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/bicgpbjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/bicgpbjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=bicgpbjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','bicg');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'pbjacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/cghypreoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/cghypreoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/cghypreoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=cghypreoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','cg');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'hypre');
++end
+Index: ../trunk-jpl/src/m/solvers/tfqmrgasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/tfqmrgasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/tfqmrgasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=tfqmrgasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','tfqmr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gasm');
++end
+Index: ../trunk-jpl/src/m/solvers/richardsonjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/richardsonjacobioptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/richardsonjacobioptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=richardsonjacobioptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','richardson');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'jacobi');
++end
+Index: ../trunk-jpl/src/m/solvers/bicgasmoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/bicgasmoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/bicgasmoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=bicgasmoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','bicg');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'asm');
++end
+Index: ../trunk-jpl/src/m/solvers/gcrgamgoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gcrgamgoptions.m	(revision 0)
++++ ../trunk-jpl/src/m/solvers/gcrgamgoptions.m	(revision 16901)
+@@ -0,0 +1,14 @@
++function solverOptions=gcrgamgoptions(varargin)
++
++%retrieve options provided in varargin
++options=pairoptions(varargin{:});
++solverOptions=struct();
++solverOptions.toolkit='petsc';
++
++
++PETSC_VERSION=petscversion();
++if PETSC_VERSION==3,
++   solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
++   solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gcr');
++   solverOptions.pc_type=getfieldvalue(options, 'pc_type',  'gamg');
++end
Index: issm/oecreview/Archive/16554-17801/ISSM-16901-16902.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16901-16902.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16901-16902.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16901)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16902)
+@@ -183,7 +183,7 @@
+ 
+ 				if(eplconverged){
+ 
+-					Updating Nodal Mask
++					/*Updating Nodal Mask*/
+ 					HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
+ 					analysis->ElementizeEplMask(femmodel);
+ 					delete analysis;
Index: issm/oecreview/Archive/16554-17801/ISSM-16902-16903.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16902-16903.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16902-16903.diff	(revision 17802)
@@ -0,0 +1,323 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 16902)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 16903)
+@@ -82,7 +82,94 @@
+ 
+ /*Finite Element Analysis*/
+ ElementMatrix* HydrologyShreveAnalysis::CreateKMatrix(Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	/*Intermediaries */
++	IssmDouble diffusivity;
++	IssmDouble Jdet,D_scalar,dt,h;
++	IssmDouble vx,vy,vel,dvxdx,dvydy;
++	IssmDouble dvx[2],dvy[2];
++	IssmDouble* xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementMatrix* Ke     = element->NewElementMatrix();
++	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
++	IssmDouble*    B      = xNew<IssmDouble>(2*numnodes);
++	IssmDouble*    Bprime = xNew<IssmDouble>(2*numnodes);
++	IssmDouble     D[2][2]={0.};
++
++	/*Create water velocity vx and vy from current inputs*/
++	CreateHydrologyWaterVelocityInput(element);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	element->FindParam(&dt,TimesteppingTimeStepEnum);
++	Input* vx_input=element->GetInput(HydrologyWaterVxEnum); _assert_(vx_input);
++	Input* vy_input=element->GetInput(HydrologyWaterVyEnum); _assert_(vy_input);
++	h = element->CharacteristicLength();
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctions(basis,gauss);
++
++		vx_input->GetInputValue(&vx,gauss);
++		vy_input->GetInputValue(&vy,gauss);
++		vx_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
++		vy_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
++
++		D_scalar=gauss->weight*Jdet;
++
++		TripleMultiply(basis,1,numnodes,1,
++					&D_scalar,1,1,0,
++					basis,1,numnodes,0,
++					Ke->values,1);
++
++		GetB(B,element,xyz_list,gauss);
++		GetBprime(Bprime,element,xyz_list,gauss);
++
++		dvxdx=dvx[0];
++		dvydy=dvy[1];
++		D_scalar=dt*gauss->weight*Jdet;
++
++		D[0][0]=D_scalar*dvxdx;
++		D[1][1]=D_scalar*dvydy;
++		TripleMultiply(B,2,numnodes,1,
++					&D[0][0],2,2,0,
++					B,2,numnodes,0,
++					&Ke->values[0],1);
++
++		D[0][0]=D_scalar*vx;
++		D[1][1]=D_scalar*vy;
++		TripleMultiply(B,2,numnodes,1,
++					&D[0][0],2,2,0,
++					Bprime,2,numnodes,0,
++					&Ke->values[0],1);
++
++		/*Artificial diffusivity*/
++		vel=sqrt(vx*vx+vy*vy);
++		D[0][0]=D_scalar*diffusivity*h/(2*vel)*vx*vx;
++		D[1][0]=D_scalar*diffusivity*h/(2*vel)*vy*vx;
++		D[0][1]=D_scalar*diffusivity*h/(2*vel)*vx*vy;
++		D[1][1]=D_scalar*diffusivity*h/(2*vel)*vy*vy;
++		TripleMultiply(Bprime,2,numnodes,1,
++					&D[0][0],2,2,0,
++					Bprime,2,numnodes,0,
++					&Ke->values[0],1);
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(B);
++	xDelete<IssmDouble>(Bprime);
++	delete gauss;
++	return Ke;
+ }/*}}}*/
+ ElementVector* HydrologyShreveAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+@@ -133,6 +220,61 @@
+ 	delete gauss;
+ 	return pe;
+ }/*}}}*/
++void HydrologyShreveAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
++	 * For node i, Bi can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi=[ N ]
++	 *          [ N ]
++	 * where N is the finiteelement function for node i.
++	 *
++	 * We assume B_prog has been allocated already, of size: 2x(NDOF1*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions*/
++	IssmDouble* basis=xNew<IssmDouble>(numnodes);
++	element->NodalFunctions(basis,gauss);
++
++	/*Build B: */
++	for(int i=0;i<numnodes;i++){
++		B[numnodes*0+i] = basis[i];
++		B[numnodes*1+i] = basis[i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(basis);
++}/*}}}*/
++void HydrologyShreveAnalysis::GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 
++	 * For node i, Bi' can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi_prime=[ dN/dx ]
++	 *                [ dN/dy ]
++	 * where N is the finiteelement function for node i.
++	 *
++	 * We assume B' has been allocated already, of size: 3x(NDOF2*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Build B': */
++	for(int i=0;i<numnodes;i++){
++		Bprime[numnodes*0+i] = dbasis[0*numnodes+i];
++		Bprime[numnodes*1+i] = dbasis[1*numnodes+i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(dbasis);
++
++}/*}}}*/
+ void HydrologyShreveAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,WatercolumnEnum);
+ }/*}}}*/
+@@ -162,3 +304,56 @@
+ 	xDelete<IssmDouble>(values);
+ 	xDelete<int>(doflist);
+ }/*}}}*/
++
++/*Intermediaries*/
++void HydrologyShreveAnalysis::CreateHydrologyWaterVelocityInput(Element* element){/*{{{*/
++
++	/*Intermediaries*/
++	IssmDouble dsdx,dsdy,dbdx,dbdy,w;
++
++	/*Retrieve all inputs and parameters*/
++	IssmDouble  rho_ice   = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	IssmDouble  rho_water = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble  g         = element->GetMaterialParameter(ConstantsGEnum);
++	IssmDouble  CR        = element->GetMaterialParameter(HydrologyshreveCREnum);
++	IssmDouble  n_man     = element->GetMaterialParameter(HydrologyshreveNEnum);
++	IssmDouble  mu_water  = element->GetMaterialParameter(MaterialsMuWaterEnum);
++	Input* surfaceslopex_input = element->GetInput(SurfaceSlopeXEnum); _assert_(surfaceslopex_input);
++	Input* surfaceslopey_input = element->GetInput(SurfaceSlopeYEnum); _assert_(surfaceslopey_input);
++	Input* bedslopex_input     = element->GetInput(BedSlopeXEnum);     _assert_(bedslopex_input);
++	Input* bedslopey_input     = element->GetInput(BedSlopeYEnum);     _assert_(bedslopey_input);
++	Input* watercolumn_input   = element->GetInput(WatercolumnEnum);   _assert_(watercolumn_input);
++
++	/* compute VelocityFactor */
++	IssmDouble VelocityFactor = n_man*CR*CR*rho_water*g/mu_water;
++
++	/*Fetch number of vertices and allocate output*/
++	int numvertices = element->GetNumberOfVertices();
++	IssmDouble* vx  = xNew<IssmDouble>(numvertices);
++	IssmDouble* vy  = xNew<IssmDouble>(numvertices);
++
++	Gauss* gauss=element->NewGauss();
++	for(int iv=0;iv<numvertices;iv++){
++		gauss->GaussVertex(iv);
++		surfaceslopex_input->GetInputValue(&dsdx,gauss);
++		surfaceslopey_input->GetInputValue(&dsdy,gauss);
++		bedslopex_input->GetInputValue(&dbdx,gauss);
++		bedslopey_input->GetInputValue(&dbdy,gauss);
++		watercolumn_input->GetInputValue(&w,gauss);
++
++		/* Water velocity x and y components */
++	//	vx[iv]= - w*w/(12 * mu_water)*(rho_ice*g*dsdx+(rho_water-rho_ice)*g*dbdx);
++	//	vy[iv]= - w*w/(12 * mu_water)*(rho_ice*g*dsdy+(rho_water-rho_ice)*g*dbdy);
++		vx[iv]= - w*w/(VelocityFactor* mu_water)*(rho_ice*g*dsdx+(rho_water-rho_ice)*g*dbdx);
++		vy[iv]= - w*w/(VelocityFactor* mu_water)*(rho_ice*g*dsdy+(rho_water-rho_ice)*g*dbdy);
++	}
++
++	/*clean-up*/
++	delete gauss;
++
++	/*Add to inputs*/
++	element->AddInput(HydrologyWaterVxEnum,vx,P1Enum);
++	element->AddInput(HydrologyWaterVyEnum,vy,P1Enum);
++	xDelete<IssmDouble>(vx);
++	xDelete<IssmDouble>(vy);
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h	(revision 16902)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h	(revision 16903)
+@@ -24,5 +24,10 @@
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++
++		/*Intermediaries*/
++		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void CreateHydrologyWaterVelocityInput(Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16902)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16903)
+@@ -251,7 +251,7 @@
+ 	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+ 	IssmDouble*    B      = xNew<IssmDouble>(2*numnodes);
+ 	IssmDouble*    Bprime = xNew<IssmDouble>(2*numnodes);
+-	IssmDouble     D[2][2];
++	IssmDouble     D[2][2]={0.};
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+@@ -297,8 +297,6 @@
+ 		D_scalar=dt*gauss->weight*Jdet;
+ 
+ 		D[0][0]=D_scalar*dvxdx;
+-		D[0][1]=0.;
+-		D[1][0]=0.;
+ 		D[1][1]=D_scalar*dvydy;
+ 		TripleMultiply(B,2,numnodes,1,
+ 					&D[0][0],2,2,0,
+@@ -325,8 +323,6 @@
+ 			vxaverage_input->GetInputAverage(&vx);
+ 			vyaverage_input->GetInputAverage(&vy);
+ 			D[0][0]=h/2.0*fabs(vx);
+-			D[0][1]=0.;
+-			D[1][0]=0.;
+ 			D[1][1]=h/2.0*fabs(vy);
+ 		}
+ 		if(stabilization==1 || stabilization==2){
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 16902)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 16903)
+@@ -240,27 +240,32 @@
+ IssmDouble Matpar::GetMaterialParameter(int enum_in){
+ 
+ 	switch(enum_in){
+-		case MaterialsRhoIceEnum:                   return this->rho_ice;
+-		case MaterialsRhoWaterEnum:                 return this->rho_water;
+-		case MaterialsRhoFreshwaterEnum:            return this->rho_freshwater;
+-		case MaterialsMuWaterEnum:                  return this->mu_water;
+-		case MaterialsHeatcapacityEnum:             return this->heatcapacity;
+-		case MaterialsThermalconductivityEnum:      return this->thermalconductivity;
+-		case MaterialsTemperateiceconductivityEnum: return this->temperateiceconductivity;
+-		case MaterialsLatentheatEnum:               return this->latentheat;
+-		case MaterialsBetaEnum:                     return this->beta;
+-		case MaterialsMeltingpointEnum:             return this->meltingpoint;
+-		case ConstantsReferencetemperatureEnum:     return this->referencetemperature;
+-		case MaterialsMixedLayerCapacityEnum:       return this->mixed_layer_capacity;
+-		case MaterialsThermalExchangeVelocityEnum:  return this->thermal_exchange_velocity;
+-		case HydrologydcSedimentPorosityEnum:       return this->sediment_porosity;
+-		case HydrologydcSedimentThicknessEnum:      return this->sediment_thickness;
+-		case HydrologydcSedimentCompressibilityEnum:return this->sediment_compressibility;
+-		case HydrologydcEplPorosityEnum:            return this->epl_porosity;
+-		case HydrologydcEplCompressibilityEnum:     return this->epl_compressibility;
+-		case HydrologydcWaterCompressibilityEnum:   return this->water_compressibility;
+-		case HydrologydcSedimentTransmitivityEnum:  return this->sediment_transmitivity;
+-		case ConstantsGEnum:                        return this->g;
++		case MaterialsRhoIceEnum:                    return this->rho_ice;
++		case MaterialsRhoWaterEnum:                  return this->rho_water;
++		case MaterialsRhoFreshwaterEnum:             return this->rho_freshwater;
++		case MaterialsMuWaterEnum:                   return this->mu_water;
++		case MaterialsHeatcapacityEnum:              return this->heatcapacity;
++		case MaterialsThermalconductivityEnum:       return this->thermalconductivity;
++		case MaterialsTemperateiceconductivityEnum:  return this->temperateiceconductivity;
++		case MaterialsLatentheatEnum:                return this->latentheat;
++		case MaterialsBetaEnum:                      return this->beta;
++		case MaterialsMeltingpointEnum:              return this->meltingpoint;
++		case ConstantsReferencetemperatureEnum:      return this->referencetemperature;
++		case MaterialsMixedLayerCapacityEnum:        return this->mixed_layer_capacity;
++		case MaterialsThermalExchangeVelocityEnum:   return this->thermal_exchange_velocity;
++		case HydrologydcSedimentPorosityEnum:        return this->sediment_porosity;
++		case HydrologydcSedimentThicknessEnum:       return this->sediment_thickness;
++		case HydrologydcSedimentCompressibilityEnum: return this->sediment_compressibility;
++		case HydrologydcEplPorosityEnum:             return this->epl_porosity;
++		case HydrologydcEplCompressibilityEnum:      return this->epl_compressibility;
++		case HydrologydcWaterCompressibilityEnum:    return this->water_compressibility;
++		case HydrologydcSedimentTransmitivityEnum:   return this->sediment_transmitivity;
++		case HydrologyshreveCREnum:                  return this->hydro_CR;
++		case HydrologyshreveKnEnum:                  return this->hydro_kn;
++		case HydrologyshreveNEnum:                   return this->hydro_n;
++		case HydrologyshrevePEnum:                   return this->hydro_p;
++		case HydrologyshreveQEnum:                   return this->hydro_q;
++		case ConstantsGEnum:                         return this->g;
+ 		default: _error_("Enum "<<EnumToStringx(enum_in)<<" not supported yet");
+ 	}
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16903-16904.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16903-16904.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16903-16904.diff	(revision 17802)
@@ -0,0 +1,149 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 16903)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 16904)
+@@ -96,7 +96,87 @@
+ 
+ /*Finite Element Analysis*/
+ ElementMatrix* HydrologyDCEfficientAnalysis::CreateKMatrix(Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	/*Intermediaries*/
++	int      meshtype;
++	Element* basalelement;
++
++	/*Get basal element*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Check that all nodes are active, else return empty matrix*/
++	if(!basalelement->AllActive()) return NULL;
++
++	/* Intermediaries */
++	IssmDouble  D_scalar,Jdet,dt;
++	IssmDouble  epl_thickness;
++	IssmDouble *xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = basalelement->GetNumberOfNodes();
++
++	/*Initialize Element vector*/
++	ElementMatrix* Ke     = element->NewElementMatrix();
++	IssmDouble*    B      = xNew<IssmDouble>(2*numnodes);
++	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
++	IssmDouble     D[2][2]={0.};
++
++	/*Retrieve all inputs and parameters*/
++	basalelement->GetVerticesCoordinates(&xyz_list);
++	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
++	Input* thickness_input=element->GetInput(HydrologydcEplThicknessEnum); _assert_(thickness_input);
++	IssmDouble epl_specificstoring = EplSpecificStoring(basalelement);
++	IssmDouble epl_conductivity    = element->GetMaterialParameter(HydrologydcEplConductivityEnum);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		thickness_input->GetInputValue(&epl_thickness,gauss);
++
++		/*Diffusivity*/
++		D_scalar=epl_conductivity*epl_thickness*gauss->weight*Jdet;
++		if(dt!=0.) D_scalar=D_scalar*dt;
++		D[0][0]=D_scalar;
++		D[1][1]=D_scalar;
++		GetB(B,element,xyz_list,gauss); 
++		TripleMultiply(B,2,numnodes,1,
++					&D[0][0],2,2,0,
++					B,2,numnodes,0,
++					&Ke->values[0],1);
++
++		/*Transient*/
++		if(dt!=0.){
++			element->NodalFunctions(basis,gauss);
++			D_scalar=epl_specificstoring*epl_thickness*gauss->weight*Jdet;
++
++			TripleMultiply(basis,numnodes,1,0,
++						&D_scalar,1,1,0,
++						basis,1,numnodes,0,
++						&Ke->values[0],1);
++		}
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(B);
++	delete gauss;
++	return Ke;
++
++
+ }/*}}}*/
+ ElementVector* HydrologyDCEfficientAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+@@ -199,3 +279,30 @@
+ 	IssmDouble water_compressibility = element->GetMaterialParameter(HydrologydcWaterCompressibilityEnum);
+ 	return rho_freshwater*g*epl_porosity*(water_compressibility+(epl_compressibility/epl_porosity));		 
+ }/*}}}*/
++void HydrologyDCEfficientAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
++	 * For node i, Bi can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi=[ dN/dx ]
++	 *          [ dN/dy ]
++	 * where N is the finiteelement function for node i.
++	 *
++	 * We assume B has been allocated already, of size: 3x(NDOF2*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Build B: */
++	for(int i=0;i<numnodes;i++){
++		B[numnodes*0+i] = dbasis[0*numnodes+i];
++		B[numnodes*1+i] = dbasis[1*numnodes+i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(dbasis);
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 16903)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 16904)
+@@ -26,6 +26,7 @@
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ 
+ 		/*Intermediaries*/
++		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		IssmDouble EplSpecificStoring(Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 16903)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 16904)
+@@ -258,6 +258,8 @@
+ 		case HydrologydcSedimentCompressibilityEnum: return this->sediment_compressibility;
+ 		case HydrologydcEplPorosityEnum:             return this->epl_porosity;
+ 		case HydrologydcEplCompressibilityEnum:      return this->epl_compressibility;
++		case HydrologydcEplConductivityEnum:         return this->epl_conductivity;
++		case HydrologydcEplInitialThicknessEnum:     return this->epl_init_thickness;
+ 		case HydrologydcWaterCompressibilityEnum:    return this->water_compressibility;
+ 		case HydrologydcSedimentTransmitivityEnum:   return this->sediment_transmitivity;
+ 		case HydrologyshreveCREnum:                  return this->hydro_CR;
Index: issm/oecreview/Archive/16554-17801/ISSM-16904-16905.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16904-16905.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16904-16905.diff	(revision 17802)
@@ -0,0 +1,19 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16904)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16905)
+@@ -2585,10 +2585,10 @@
+ 	IssmDouble  gravity   = element->GetMaterialParameter(ConstantsGEnum);
+ 
+ 	/*Initialize gauss points*/
+-	IssmDouble zmax=xyz_list[0*3+2]; for(int i=1;i<numvertices;i++) if(xyz_list[i*3+2]>zmax) zmax=xyz_list[i*3+2];
+-	IssmDouble zmin=xyz_list[0*3+2]; for(int i=1;i<numvertices;i++) if(xyz_list[i*3+2]<zmin) zmin=xyz_list[i*3+2];
+-	if(zmax>0 && zmin<0) gauss=element->NewGauss(xyz_list,xyz_list_front,3,30);//refined in vertical because of the sea level discontinuity
+-	else                 gauss=element->NewGauss(xyz_list,xyz_list_front,3,3);
++	IssmDouble zmax=xyz_list[0*3+(dim-1)]; for(int i=1;i<numvertices;i++) if(xyz_list[i*3+(dim-1)]>zmax) zmax=xyz_list[i*3+(dim-1)];
++	IssmDouble zmin=xyz_list[0*3+(dim-1)]; for(int i=1;i<numvertices;i++) if(xyz_list[i*3+(dim-1)]<zmin) zmin=xyz_list[i*3+(dim-1)];
++	if(zmax>0. && zmin<0.) gauss=element->NewGauss(xyz_list,xyz_list_front,3,30);//refined in vertical because of the sea level discontinuity
++	else                   gauss=element->NewGauss(xyz_list,xyz_list_front,3,3);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
Index: issm/oecreview/Archive/16554-17801/ISSM-16905-16906.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16905-16906.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16905-16906.diff	(revision 17802)
@@ -0,0 +1,17 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16905)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16906)
+@@ -2320,9 +2320,9 @@
+ 	int numdof    = vnumnodes*dim + pnumnodes;
+ 
+ 	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke      = element->NewElementMatrix(FSvelocityEnum);
+-	IssmDouble*    B       = xNew<IssmDouble>((dim-1)*numdof);
+-	IssmDouble*    D       = xNewZeroInit<IssmDouble>((dim-1)*(dim-1));
++	ElementMatrix* Ke = element->NewElementMatrix(FSvelocityEnum);
++	IssmDouble*    B  = xNew<IssmDouble>((dim-1)*numdof);
++	IssmDouble*    D  = xNewZeroInit<IssmDouble>((dim-1)*(dim-1));
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinatesBase(&xyz_list_base);
Index: issm/oecreview/Archive/16554-17801/ISSM-16906-16907.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16906-16907.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16906-16907.diff	(revision 17802)
@@ -0,0 +1,315 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16906)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16907)
+@@ -70,6 +70,12 @@
+ 		void GetSolutionFromInputsFS(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolutionFS(IssmDouble* solution,Element* element);
+ 		/*Coupling*/
++		ElementMatrix* CreateKMatrixSSAHO(Element* element);
++		ElementMatrix* CreateKMatrixCouplingSSAHO(Element* element);
++		ElementMatrix* CreateKMatrixCouplingSSAHOFriction(Element* element);
++		ElementMatrix* CreateKMatrixCouplingSSAHOViscous(Element* element);
++		ElementVector* CreatePVectorSSAHO(Element* element);
++		void GetBSSAHO(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void InputUpdateFromSolutionHOFS(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionSSAFS(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionSSAHO(IssmDouble* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16906)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16907)
+@@ -825,6 +825,8 @@
+ 			return CreateKMatrixHO(element);
+ 		case FSApproximationEnum: 
+ 			return CreateKMatrixFS(element);
++		case SSAHOApproximationEnum: 
++			return CreateKMatrixSSAHO(element);
+ 		case NoneApproximationEnum:
+ 			return NULL;
+ 		default:
+@@ -846,6 +848,8 @@
+ 			return CreatePVectorHO(element);
+ 		case FSApproximationEnum: 
+ 			return CreatePVectorFS(element);
++		case SSAHOApproximationEnum: 
++			return CreatePVectorSSAHO(element);
+ 		case NoneApproximationEnum:
+ 			return NULL;
+ 		default:
+@@ -3058,6 +3062,165 @@
+ }/*}}}*/
+ 
+ /*Coupling (Tiling)*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSAHO(Element* element){/*{{{*/
++
++	/*compute all stiffness matrices for this element*/
++	ElementMatrix* Ke1=CreateKMatrixSSA(element);
++	ElementMatrix* Ke2=CreateKMatrixHO(element);
++	ElementMatrix* Ke3=CreateKMatrixCouplingSSAHO(element);
++	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2,Ke3);
++
++	/*clean-up and return*/
++	delete Ke1;
++	delete Ke2;
++	delete Ke3;
++	return Ke;
++}/*}}}*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixCouplingSSAHO(Element* element){/*{{{*/
++
++	/*compute all stiffness matrices for this element*/
++	ElementMatrix* Ke1=CreateKMatrixCouplingSSAHOViscous(element);
++	ElementMatrix* Ke2=CreateKMatrixCouplingSSAHOFriction(element);
++	ElementMatrix* Ke=new ElementMatrix(Ke1,Ke2);
++
++	/*clean-up and return*/
++	delete Ke1;
++	delete Ke2;
++	return Ke;
++}/*}}}*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixCouplingSSAHOFriction(Element* element){/*{{{*/
++	return NULL;
++
++}/*}}}*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixCouplingSSAHOViscous(Element* element){/*{{{*/
++
++	/*Constants*/
++	int numnodes = 2*element->GetNumberOfNodes();
++	int numdofm     = 1 *numnodes; //*2/2
++	int numdofp     = 2 *numnodes;
++	int numdoftotal = 2 *2 *numnodes;//2 dof per nodes and 2 sets of nodes for HO and SSA
++
++	/*Intermediaries */
++	int         i,j;
++	IssmDouble  Jdet,viscosity,oldviscosity,newviscosity,viscosity_overshoot; //viscosity
++	IssmDouble  *xyz_list      = NULL;
++	IssmDouble* B              = xNew<IssmDouble>(3*numdofp);
++	IssmDouble* Bprime         = xNew<IssmDouble>(3*numdofm);
++	IssmDouble  D[3][3]={0.0}; // material matrix, simple scalar matrix.
++	IssmDouble  D_scalar;
++	IssmDouble* Ke_gg          = xNewZeroInit<IssmDouble>(numdofp*numdofm);
++	IssmDouble* Ke_gg_gaussian = xNew<IssmDouble>(numdofp*numdofm);
++	Node        *node_list[numnodes];
++	int         cs_list[numnodes];
++
++	/*Find penta on bed as HO must be coupled to the dofs on the bed: */
++	Element* pentabase=element->GetBasalElement();
++	Element* basaltria=pentabase->SpawnBasalElement();
++
++	/*prepare node list*/
++	for(i=0;i<numnodes;i++){
++		node_list[i+0*numnodes] = pentabase->GetNode(i);
++		node_list[i+1*numnodes] = element  ->GetNode(i);
++		cs_list[i+0*numnodes] = XYEnum;
++		cs_list[i+1*numnodes] = XYEnum;
++	}
++
++	/*Initialize Element matrix*/
++	ElementMatrix* Ke1= pentabase->NewElementMatrix(SSAApproximationEnum);
++	ElementMatrix* Ke2= element  ->NewElementMatrix(HOApproximationEnum);
++	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
++	delete Ke1; delete Ke2;
++
++	/* Get node coordinates and dof list: */
++	element->GetVerticesCoordinates(&xyz_list);
++	element->FindParam(&viscosity_overshoot,StressbalanceViscosityOvershootEnum);
++	Input* vx_input   =element->GetInput(VxEnum);       _assert_(vx_input);
++	Input* vy_input   =element->GetInput(VyEnum);       _assert_(vy_input);
++	Input* vxold_input=element->GetInput(VxPicardEnum); _assert_(vxold_input);
++	Input* vyold_input=element->GetInput(VyPicardEnum); _assert_(vyold_input);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(5);
++	Gauss* gauss_tria=new GaussTria();
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++		gauss->SynchronizeGaussBase(gauss_tria);
++
++		element->JacobianDeterminant(&Jdet, xyz_list,gauss);
++		this->GetBSSAHO(B, element,xyz_list, gauss);
++		//basaltria->GetBprimeSSA(Bprime, xyz_list, gauss_tria); /FIXME
++		this->GetBSSAprime(Bprime, basaltria,xyz_list, gauss_tria); 
++		element->ViscosityHO(&viscosity,xyz_list,gauss,vx_input,vy_input);
++		element->ViscosityHO(&oldviscosity,xyz_list,gauss,vxold_input,vyold_input);
++
++		newviscosity=viscosity+viscosity_overshoot*(viscosity-oldviscosity);
++		D_scalar=2*newviscosity*gauss->weight*Jdet;
++		for (i=0;i<3;i++) D[i][i]=D_scalar;
++
++		TripleMultiply( B,3,numdofp,1,
++					&D[0][0],3,3,0,
++					Bprime,3,numdofm,0,
++					Ke_gg_gaussian,0);
++
++		for( i=0; i<numdofp; i++) for(j=0;j<numdofm; j++) Ke_gg[i*numdofp+j]+=Ke_gg_gaussian[i*numdofp+j];
++	} 
++	for(i=0;i<numdofp;i++) for(j=0;j<numdofm;j++) Ke->values[(i+2*numdofm)*numdoftotal+j]+=Ke_gg[i*numdofp+j];
++	for(i=0;i<numdofm;i++) for(j=0;j<numdofp;j++) Ke->values[i*numdoftotal+(j+2*numdofm)]+=Ke_gg[j*numdofp+i];
++
++	/*Transform Coordinate System*/
++	element->TransformStiffnessMatrixCoord(Ke,node_list,numnodes,cs_list);
++
++	/*Clean-up and return*/
++	basaltria->DeleteMaterials(); delete basaltria;
++	delete gauss;
++	delete gauss_tria;
++	return Ke;
++
++}/*}}}*/
++ElementVector* StressbalanceAnalysis::CreatePVectorSSAHO(Element* element){/*{{{*/
++
++	/*compute all load vectors for this element*/
++	ElementVector* pe1=CreatePVectorSSA(element);
++	ElementVector* pe2=CreatePVectorHO(element);
++	ElementVector* pe =new ElementVector(pe1,pe2);
++
++	/*clean-up and return*/
++	delete pe1;
++	delete pe2;
++	return pe;
++}/*}}}*/
++void StressbalanceAnalysis::GetBSSAHO(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 3*NDOF2. 
++	 * For node i, Bi can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi=[ dh/dx          0      ]
++	 *          [   0           dh/dy   ]
++	 *          [ 1/2*dh/dy  1/2*dh/dx  ]
++	 * where h is the interpolation function for node i.
++	 *
++	 * We assume B has been allocated already, of size: 5x(NDOF2*NUMNODESP1)
++	 */
++
++	int numnodes = element->GetNumberOfNodes();
++	IssmDouble* dbasis=xNew<IssmDouble>(3*numnodes);
++
++	/*Get dbasis in actual coordinate system: */
++	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Build B: */
++	for(int i=0;i<numnodes;i++){
++		B[2*numnodes*0+2*i+0] = dbasis[0*3+i];
++		B[2*numnodes*0+2*i+1] = 0.;
++		B[2*numnodes*1+2*i+0] = 0.;
++		B[2*numnodes*1+2*i+1] = dbasis[1*3+i];
++		B[2*numnodes*2+2*i+0] = .5*dbasis[1*3+i];
++		B[2*numnodes*2+2*i+1] = .5*dbasis[0*3+i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(dbasis);
++}/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionHOFS(IssmDouble* solution,Element* element){/*{{{*/
+ 
+ 	int         i;
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16906)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16907)
+@@ -83,6 +83,7 @@
+ 		virtual void   TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* transformenum_list)=0;
+ 		virtual void   TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int transformenum)=0;
+ 		virtual void   TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int* transformenum_list)=0;
++		virtual void   TransformStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes_list,int numnodes,int* transformenum_list)=0;
+ 		virtual Element* GetBasalElement(void)=0;
+ 		virtual void	GetDofList(int** pdoflist,int approximation_enum,int setenum)=0;
+ 		virtual void	GetDofListVelocity(int** pdoflist,int setenum)=0;
+@@ -119,6 +120,7 @@
+ 		virtual void   GetInputValue(int* pvalue,int enum_type)=0;
+ 		virtual void   GetInputValue(IssmDouble* pvalue,int enum_type)=0;
+ 		virtual void   GetInputValue(IssmDouble* pvalue,Gauss* gauss,int enum_type)=0;
++		virtual Node*  GetNode(int node_number)=0;
+ 		virtual void   GetVerticesCoordinates(IssmDouble** xyz_list)=0;
+ 		virtual void   GetVerticesCoordinatesBase(IssmDouble** xyz_list)=0;
+ 		virtual void   GetVerticesCoordinatesTop(IssmDouble** xyz_list)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16906)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16907)
+@@ -285,6 +285,7 @@
+ 		void           GetInputValue(IssmDouble* pvalue,int enum_type);
+ 		void           GetInputValue(IssmDouble* pvalue,Gauss* gauss,int enum_type);
+ 		void           GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype);
++		Node*          GetNode(int node_number){_error_("not implemented yet");};
+ 		void	         InputChangeName(int enum_type,int enum_type_old);
+ 		void	         InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type);
+ 		void	         InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solution,int enum_type){_error_("not implemented yet");};
+@@ -325,6 +326,7 @@
+ 		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* transformenum_list);
+ 		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int transformenum){_error_("not implemented yet");};
+ 		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int* transformenum_list){_error_("not implemented yet");};
++		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes_list,int numnodes,int* transformenum_list){_error_("not implemented yet");};
+ 		void           ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
+ 		void           ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+ 		void           ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16906)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16907)
+@@ -1325,6 +1325,11 @@
+ 	return inputs->GetInput(inputenum);
+ }
+ /*}}}*/
++/*FUNCTION Penta::GetNode(int node_number) {{{*/
++Node* Penta::GetNode(int node_number){
++	return this->nodes[node_number];
++}
++/*}}}*/
+ /*FUNCTION Penta::GetMaterialInput(int inputenum) {{{*/
+ Input* Penta::GetMaterialInput(int inputenum){
+ 	return this->material->inputs->GetInput(inputenum);
+@@ -3231,6 +3236,13 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Penta::TransformStiffnessMatrixCoord(ElementMatrix* pe,Node** nodes_list,int numnodesint* transformenum_list){{{*/
++void Penta::TransformStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes_list,int numnodes,int* transformenum_list){
++
++	::TransformStiffnessMatrixCoord(Ke,nodes_list,numnodes,transformenum_list);
++
++}
++/*}}}*/
+ /*FUNCTION Penta::Update {{{*/
+ void Penta::Update(int index,IoModel* iomodel,int analysis_counter,int analysis_type,int finiteelement_type){ 
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16906)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16907)
+@@ -243,6 +243,7 @@
+ 		void           GetInputValue(IssmDouble* pvalue,int enum_type);
+ 		void           GetInputValue(IssmDouble* pvalue,Gauss* gauss,int enum_type);
+ 		void           GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype);
++		Node*          GetNode(int node_number);
+ 		void	         GetPhi(IssmDouble* phi, IssmDouble*  epsilon, IssmDouble viscosity);
+ 		void           GetStrainRate3dHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss, Input* vx_input, Input* vy_input);
+ 		void           GetStrainRate3d(IssmDouble* epsilon,IssmDouble* xyz_list, Gauss* gauss, Input* vx_input, Input* vy_input, Input* vz_input);
+@@ -294,6 +295,7 @@
+ 		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* transformenum_list);
+ 		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int transformenum){_error_("not implemented yet");};
+ 		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int* transformenum_list){_error_("not implemented yet");};
++		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes_list,int numnodes,int* transformenum_list);
+ 		void           ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+ 		void           ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 		void           ViscosityL1L2(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* surf);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16906)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16907)
+@@ -154,6 +154,7 @@
+ 		void        GetInputValue(IssmDouble* pvalue,int enum_type){_error_("not implemented yet");};
+ 		void        GetInputValue(IssmDouble* pvalue,Gauss* gauss,int enum_type){_error_("not implemented yet");};
+ 		void        GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");};
++		Node*       GetNode(int node_number){_error_("Not implemented");};
+ 		IssmDouble  GetYcoord(Gauss* gauss){_error_("Not implemented");};
+ 		IssmDouble  GetZcoord(Gauss* gauss){_error_("not implemented yet");};
+ 		Gauss*      NewGauss(void){_error_("not implemented yet");};
+@@ -225,6 +226,7 @@
+ 		void        TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* transformenum_list){_error_("not implemented yet");};
+ 		void        TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int transformenum){_error_("not implemented yet");};
+ 		void        TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int* transformenum_list){_error_("not implemented yet");};
++		void        TransformStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes_list,int numnodes,int* transformenum_list){_error_("not implemented yet");};
+ 		void UpdateConstraintsExtrudeFromBase(){_error_("not implemented");};
+ 		void UpdateConstraintsExtrudeFromTop(){_error_("not implemented");};
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16907-16908.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16907-16908.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16907-16908.diff	(revision 17802)
@@ -0,0 +1,89 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16907)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16908)
+@@ -3095,7 +3095,7 @@
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixCouplingSSAHOViscous(Element* element){/*{{{*/
+ 
+ 	/*Constants*/
+-	int numnodes = 2*element->GetNumberOfNodes();
++	int numnodes    = element->GetNumberOfNodes();
+ 	int numdofm     = 1 *numnodes; //*2/2
+ 	int numdofp     = 2 *numnodes;
+ 	int numdoftotal = 2 *2 *numnodes;//2 dof per nodes and 2 sets of nodes for HO and SSA
+@@ -3110,8 +3110,8 @@
+ 	IssmDouble  D_scalar;
+ 	IssmDouble* Ke_gg          = xNewZeroInit<IssmDouble>(numdofp*numdofm);
+ 	IssmDouble* Ke_gg_gaussian = xNew<IssmDouble>(numdofp*numdofm);
+-	Node        *node_list[numnodes];
+-	int         cs_list[numnodes];
++	Node        *node_list[2*numnodes];
++	int*         cs_list= xNew<int>(2*numnodes);
+ 
+ 	/*Find penta on bed as HO must be coupled to the dofs on the bed: */
+ 	Element* pentabase=element->GetBasalElement();
+@@ -3149,7 +3149,6 @@
+ 
+ 		element->JacobianDeterminant(&Jdet, xyz_list,gauss);
+ 		this->GetBSSAHO(B, element,xyz_list, gauss);
+-		//basaltria->GetBprimeSSA(Bprime, xyz_list, gauss_tria); /FIXME
+ 		this->GetBSSAprime(Bprime, basaltria,xyz_list, gauss_tria); 
+ 		element->ViscosityHO(&viscosity,xyz_list,gauss,vx_input,vy_input);
+ 		element->ViscosityHO(&oldviscosity,xyz_list,gauss,vxold_input,vyold_input);
+@@ -3163,18 +3162,22 @@
+ 					Bprime,3,numdofm,0,
+ 					Ke_gg_gaussian,0);
+ 
+-		for( i=0; i<numdofp; i++) for(j=0;j<numdofm; j++) Ke_gg[i*numdofp+j]+=Ke_gg_gaussian[i*numdofp+j];
++		for( i=0; i<numdofp; i++) for(j=0;j<numdofm; j++) Ke_gg[i*numdofm+j]+=Ke_gg_gaussian[i*numdofm+j];
+ 	} 
+-	for(i=0;i<numdofp;i++) for(j=0;j<numdofm;j++) Ke->values[(i+2*numdofm)*numdoftotal+j]+=Ke_gg[i*numdofp+j];
+-	for(i=0;i<numdofm;i++) for(j=0;j<numdofp;j++) Ke->values[i*numdoftotal+(j+2*numdofm)]+=Ke_gg[j*numdofp+i];
++	for(i=0;i<numdofp;i++) for(j=0;j<numdofm;j++) Ke->values[(i+2*numdofm)*numdoftotal+j]+=Ke_gg[i*numdofm+j];
++	for(i=0;i<numdofm;i++) for(j=0;j<numdofp;j++) Ke->values[i*numdoftotal+(j+2*numdofm)]+=Ke_gg[j*numdofm+i];
+ 
+ 	/*Transform Coordinate System*/
+-	element->TransformStiffnessMatrixCoord(Ke,node_list,numnodes,cs_list);
++	element->TransformStiffnessMatrixCoord(Ke,node_list,2*numnodes,cs_list);
+ 
+ 	/*Clean-up and return*/
+ 	basaltria->DeleteMaterials(); delete basaltria;
++	
+ 	delete gauss;
+ 	delete gauss_tria;
++	xDelete<IssmDouble>(Ke_gg);
++	xDelete<IssmDouble>(Ke_gg_gaussian);
++	xDelete<int>(cs_list);
+ 	return Ke;
+ 
+ }/*}}}*/
+@@ -3210,12 +3213,12 @@
+ 
+ 	/*Build B: */
+ 	for(int i=0;i<numnodes;i++){
+-		B[2*numnodes*0+2*i+0] = dbasis[0*3+i];
++		B[2*numnodes*0+2*i+0] = dbasis[0*numnodes+i];
+ 		B[2*numnodes*0+2*i+1] = 0.;
+ 		B[2*numnodes*1+2*i+0] = 0.;
+-		B[2*numnodes*1+2*i+1] = dbasis[1*3+i];
+-		B[2*numnodes*2+2*i+0] = .5*dbasis[1*3+i];
+-		B[2*numnodes*2+2*i+1] = .5*dbasis[0*3+i];
++		B[2*numnodes*1+2*i+1] = dbasis[1*numnodes+i];
++		B[2*numnodes*2+2*i+0] = .5*dbasis[1*numnodes+i];
++		B[2*numnodes*2+2*i+1] = .5*dbasis[0*numnodes+i];
+ 	}
+ 
+ 	/*Clean-up*/
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16907)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16908)
+@@ -1327,6 +1327,8 @@
+ /*}}}*/
+ /*FUNCTION Penta::GetNode(int node_number) {{{*/
+ Node* Penta::GetNode(int node_number){
++	_assert_(node_number>=0); 
++	_assert_(node_number<this->NumberofNodes()); 
+ 	return this->nodes[node_number];
+ }
+ /*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16908-16909.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16908-16909.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16908-16909.diff	(revision 17802)
@@ -0,0 +1,116 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16908)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16909)
+@@ -3089,8 +3089,82 @@
+ 	return Ke;
+ }/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixCouplingSSAHOFriction(Element* element){/*{{{*/
+-	return NULL;
+ 
++	if(element->IsFloating() || !element->IsOnBed()) return NULL;
++
++	/*Constants*/
++	int numnodes    = element->GetNumberOfNodes();
++	int numdof      = 2*numnodes;
++	int numdoftotal = 4*numnodes;
++
++	/*Intermediaries */
++	int         i,j;
++	IssmDouble  Jdet2d,alpha2;
++	IssmDouble *xyz_list_tria=NULL;
++	IssmDouble* L           = xNewZeroInit<IssmDouble>(2*numdof);
++	IssmDouble  DL[2][2]     ={{ 0,0 },{0,0}}; //for basal drag
++	IssmDouble  DL_scalar;
++	IssmDouble* Ke_gg       = xNewZeroInit<IssmDouble>(numdof*numdof);
++	Node       *node_list[2*numnodes];
++	int*        cs_list= xNew<int>(2*numnodes);
++
++	/*Initialize Element matrix and return if necessary*/
++	ElementMatrix* Ke1=element->NewElementMatrix(SSAApproximationEnum);
++	ElementMatrix* Ke2=element->NewElementMatrix(HOApproximationEnum);
++	ElementMatrix* Ke=new ElementMatrix(Ke1,Ke2);
++	delete Ke1; delete Ke2;
++
++	/*Prepare node list*/
++	for(i=0;i<numnodes;i++){
++		node_list[i+0*numnodes] = element->GetNode(i);
++		node_list[i+1*numnodes] = element->GetNode(i);
++		cs_list[i+0*numnodes] = XYEnum;
++		cs_list[i+1*numnodes] = XYEnum;
++	}
++
++	/*retrieve inputs :*/
++	element->GetVerticesCoordinatesBase(&xyz_list_tria);
++	Input* vx_input=element->GetInput(VxEnum);  _assert_(vx_input);
++	Input* vy_input=element->GetInput(VyEnum);  _assert_(vy_input);
++	Input* vz_input=element->GetInput(VzEnum);  _assert_(vz_input);
++
++	/*build friction object, used later on: */
++	Friction* friction=new Friction(element,2);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGaussBase(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++
++		/*Friction: */
++		friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input);
++		element->JacobianDeterminantBase(&Jdet2d, xyz_list_tria,gauss);
++		this->GetBHOFriction(L,element,xyz_list_tria,gauss);
++
++		DL_scalar=alpha2*gauss->weight*Jdet2d;
++		for (i=0;i<2;i++) DL[i][i]=DL_scalar; 
++
++		/*  Do the triple producte tL*D*L: */
++		TripleMultiply( L,2,numdof,1,
++					&DL[0][0],2,2,0,
++					L,2,numdof,0,
++					Ke_gg,1);
++	}
++
++	for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke->values[i*numdoftotal+(numdof+j)]+=Ke_gg[i*numdof+j];
++	for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke->values[(i+numdof)*numdoftotal+j]+=Ke_gg[i*numdof+j];
++
++	/*Transform Coordinate System*/
++	element->TransformStiffnessMatrixCoord(Ke,node_list,2*numnodes,cs_list);
++
++	/*Clean up and return*/
++	delete gauss;
++	delete friction;
++	xDelete<int>(cs_list);
++	xDelete<IssmDouble>(xyz_list_tria);
++	xDelete<IssmDouble>(Ke_gg);
++	return Ke;
+ }/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixCouplingSSAHOViscous(Element* element){/*{{{*/
+ 
+@@ -3109,7 +3183,6 @@
+ 	IssmDouble  D[3][3]={0.0}; // material matrix, simple scalar matrix.
+ 	IssmDouble  D_scalar;
+ 	IssmDouble* Ke_gg          = xNewZeroInit<IssmDouble>(numdofp*numdofm);
+-	IssmDouble* Ke_gg_gaussian = xNew<IssmDouble>(numdofp*numdofm);
+ 	Node        *node_list[2*numnodes];
+ 	int*         cs_list= xNew<int>(2*numnodes);
+ 
+@@ -3160,9 +3233,7 @@
+ 		TripleMultiply( B,3,numdofp,1,
+ 					&D[0][0],3,3,0,
+ 					Bprime,3,numdofm,0,
+-					Ke_gg_gaussian,0);
+-
+-		for( i=0; i<numdofp; i++) for(j=0;j<numdofm; j++) Ke_gg[i*numdofm+j]+=Ke_gg_gaussian[i*numdofm+j];
++					Ke_gg,1);
+ 	} 
+ 	for(i=0;i<numdofp;i++) for(j=0;j<numdofm;j++) Ke->values[(i+2*numdofm)*numdoftotal+j]+=Ke_gg[i*numdofm+j];
+ 	for(i=0;i<numdofm;i++) for(j=0;j<numdofp;j++) Ke->values[i*numdoftotal+(j+2*numdofm)]+=Ke_gg[j*numdofm+i];
+@@ -3176,7 +3247,7 @@
+ 	delete gauss;
+ 	delete gauss_tria;
+ 	xDelete<IssmDouble>(Ke_gg);
+-	xDelete<IssmDouble>(Ke_gg_gaussian);
++	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<int>(cs_list);
+ 	return Ke;
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16909-16910.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16909-16910.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16909-16910.diff	(revision 17802)
@@ -0,0 +1,414 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16909)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16910)
+@@ -22,6 +22,7 @@
+ class Materials;
+ class Matpar;
+ class Input;
++class Inputs;
+ class Gauss;
+ class ElementVector;
+ template <class doublematrix> class Matrix;
+@@ -32,20 +33,29 @@
+ 
+ class Element: public Object,public Update{
+ 
++	public:
++		Inputs   *inputs;
++		Node    **nodes;
++
+ 	public: 
++		/*Constructors/Destructores*/
++		Element();
++		~Element();
+ 
+-		virtual        ~Element(){};
++		/*Functions*/
++		void   AddInput(Input* input_in);
++		bool   AllActive(void);
++		bool   AnyActive(void);
++		Input* GetInput(int inputenum);
+ 
+-		virtual bool        AllActive(void)=0;
+-		virtual bool        AnyActive(void)=0;
++		/*Virtual functions*/
++		virtual void   AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
++		virtual void   AddInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
++		virtual void   AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
+ 		virtual IssmDouble CharacteristicLength(void)=0;
+ 		virtual void   Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters)=0;
+ 		virtual void   SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters)=0;
+ 		virtual void   SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum)=0;
+-		virtual void   AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
+-		virtual void   AddInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
+-		virtual void   AddInput(Input* input_in)=0;
+-		virtual void   AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
+ 		virtual ElementMatrix* CreateKMatrix(void)=0;
+ 		virtual void   CreateDVector(Vector<IssmDouble>* df)=0;
+ 		virtual ElementVector* CreatePVector(void)=0;
+@@ -113,7 +123,6 @@
+ 		virtual void   GetInputListOnNodes(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue)=0;
+ 		virtual void   GetInputListOnVertices(IssmDouble* pvalue,int enumtype)=0;
+ 		virtual void   GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue)=0;
+-		virtual Input* GetInput(int inputenum)=0;
+ 		virtual Input* GetMaterialInput(int inputenum)=0;
+ 		virtual void   GetInputValue(IssmDouble* pvalue,Node* node,int enumtype)=0;
+ 		virtual void   GetInputValue(bool* pvalue,int enum_type)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16909)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16910)
+@@ -25,13 +25,11 @@
+ /*Constructors/destructor/copy*/
+ /*FUNCTION Tria::Tria(){{{*/
+ Tria::Tria(){
+-	this->nodes      = NULL;
+ 	this->vertices   = NULL;
+ 	this->material   = NULL;
+ 	this->matpar     = NULL;
+ 	this->inputs     = NULL;
+ 	this->parameters = NULL;
+-
+ }
+ /*}}}*/
+ /*FUNCTION Tria::Tria(int id, int sid,int index, IoModel* iomodel,int nummodels){{{*/
+@@ -53,12 +51,10 @@
+ 		this->vertices = NULL;
+ 		this->material = NULL;
+ 		this->matpar   = NULL;
+-
+ }
+ /*}}}*/
+ /*FUNCTION Tria::~Tria(){{{*/
+ Tria::~Tria(){
+-	delete inputs;
+ 	this->parameters=NULL;
+ }
+ /*}}}*/
+@@ -190,14 +186,6 @@
+ 	this->inputs->AddInput(new TriaInput(input_enum,values,interpolation_enum));
+ }
+ /*}}}*/
+-/*FUNCTION Tria::AddInput{{{*/
+-void  Tria::AddInput(Input* input_in){
+-
+-	/*Call inputs method*/
+-	_assert_(this->inputs);
+-	this->inputs->AddInput(input_in);
+-}
+-/*}}}*/
+ /*FUNCTION Tria::AddMaterialInput{{{*/
+ void  Tria::AddMaterialInput(int input_enum,IssmDouble* values, int interpolation_enum){
+ 
+@@ -1396,11 +1384,6 @@
+ 	return NUMVERTICES;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetInput(int inputenum) {{{*/
+-Input* Tria::GetInput(int inputenum){
+-	return inputs->GetInput(inputenum);
+-}
+-/*}}}*/
+ /*FUNCTION Tria::GetMaterialInput(int inputenum) {{{*/
+ Input* Tria::GetMaterialInput(int inputenum){
+ 	return this->material->inputs->GetInput(inputenum);
+@@ -6399,31 +6382,6 @@
+ #endif
+ 
+ #ifdef _HAVE_HYDROLOGY_
+-/*FUNCTION Tria::AllActive{{{*/
+-bool Tria::AllActive(void){
+-
+-	/*Intermediaries*/
+-	const int  numnodes = NUMVERTICES;
+-
+-	for(int i=0;i<numnodes;i++){
+-		if(!this->nodes[i]->IsActive()) return false;
+-	}
+-
+-	return true;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::AnyActive{{{*/
+-bool Tria::AnyActive(void){
+-
+-	/*Intermediaries*/
+-	const int  numnodes = NUMVERTICES;
+-
+-	for(int i=0;i<numnodes;i++){
+-		if(this->nodes[i]->IsActive()) return true;
+-	}
+-
+-	return false;
+-}/*}}}*/
+ /*FUNCTION Tria::CreateHydrologyWaterVelocityInput {{{*/
+ void Tria::CreateHydrologyWaterVelocityInput(void){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16909)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16910)
+@@ -34,13 +34,11 @@
+ 		int          id;
+ 		int          sid;
+ 
+-		Node       **nodes;                       // nodes
+ 		Vertex     **vertices;                    // 3 vertices
+ 		Material    *material;                    // 1 material ice
+ 		Matpar      *matpar;                      // 1 material parameter
+ 
+ 		Parameters  *parameters;                  //pointer to solution parameters
+-		Inputs      *inputs;
+ 
+ 		/*Tria constructors, destructors {{{*/
+ 		Tria();
+@@ -66,8 +64,6 @@
+ 		void  InputUpdateFromIoModel(int index, IoModel* iomodel);
+ 		/*}}}*/
+ 		/*Element virtual functions definitions: {{{*/
+-		bool        AllActive(void);
+-		bool        AnyActive(void);
+ 		IssmDouble  CharacteristicLength(void);
+ 		void        ComputeBasalStress(Vector<IssmDouble>* sigma_b);
+ 		void        ComputeStrainRate(Vector<IssmDouble>* eps);
+@@ -219,7 +215,6 @@
+ 		/*Tria specific routines:{{{*/
+ 		void           AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		void           AddInput(int input_enum, IssmDouble* values, int interpolation_enum);
+-		void           AddInput(Input* input_in);
+ 		void           AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		ElementMatrix* CreateKMatrix(void);
+ 		ElementMatrix* CreateKMatrixBalancethickness(void);
+@@ -272,7 +267,6 @@
+ 		void           NormalTop(IssmDouble* normal,IssmDouble* xyz_list);
+ 		void           NormalBase(IssmDouble* normal,IssmDouble* xyz_list);
+ 		IssmDouble     GetMaterialParameter(int enum_in);
+-		Input*         GetInput(int inputenum);
+ 		Input*         GetMaterialInput(int inputenum);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16909)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16910)
+@@ -21,8 +21,6 @@
+ /*Constructors/destructor/copy*/
+ /*FUNCTION Penta::Penta(){{{*/
+ Penta::Penta(){
+-
+-	this->nodes             = NULL;
+ 	this->vertices          = NULL;
+ 	this->material          = NULL;
+ 	this->matpar            = NULL;
+@@ -33,7 +31,6 @@
+ /*}}}*/
+ /*FUNCTION Penta::~Penta(){{{*/
+ Penta::~Penta(){
+-	delete inputs;
+ 	this->parameters=NULL;
+ }
+ /*}}}*/
+@@ -127,14 +124,6 @@
+ 	this->inputs->AddInput(new PentaInput(input_enum,values,interpolation_enum));
+ }
+ /*}}}*/
+-/*FUNCTION Tria::AddInput{{{*/
+-void  Penta::AddInput(Input* input_in){
+-
+-	/*Call inputs method*/
+-	_assert_(this->inputs);
+-	this->inputs->AddInput(input_in);
+-}
+-/*}}}*/
+ /*FUNCTION Penta::AddBasalInput{{{*/
+ void  Penta::AddBasalInput(int input_enum,IssmDouble* values, int interpolation_enum){
+ 
+@@ -1320,11 +1309,6 @@
+ 	return NUMVERTICES; 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetInput(int inputenum) {{{*/
+-Input* Penta::GetInput(int inputenum){
+-	return inputs->GetInput(inputenum);
+-}
+-/*}}}*/
+ /*FUNCTION Penta::GetNode(int node_number) {{{*/
+ Node* Penta::GetNode(int node_number){
+ 	_assert_(node_number>=0); 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16909)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16910)
+@@ -34,14 +34,12 @@
+ 		int          id;
+ 		int          sid;
+ 
+-		Node       **nodes;                       // set of nodes
+ 		Vertex     **vertices;                    // 6 vertices
+ 		Material    *material;                    // 1 material ice
+ 		Matpar      *matpar;                      // 1 material parameter
+ 		Penta      **verticalneighbors;           // 2 neighbors: first one under, second one above
+ 
+ 		Parameters  *parameters;                  //pointer to solution parameters
+-		Inputs      *inputs;
+ 
+ 		/*Penta constructors and destructor: {{{*/
+ 		Penta();
+@@ -67,8 +65,6 @@
+ 		void  InputUpdateFromIoModel(int index, IoModel* iomodel);
+ 		/*}}}*/
+ 		/*Element virtual functions definitions: {{{*/
+-		bool        AllActive(void){_error_("not implemented yet");};
+-		bool        AnyActive(void){_error_("not implemented yet");};
+ 		void   BasalFrictionCreateInput(void);
+ 		IssmDouble CharacteristicLength(void){_error_("not implemented yet");};
+ 		void   ComputeBasalStress(Vector<IssmDouble>* sigma_b);
+@@ -208,7 +204,6 @@
+ 		/*Penta specific routines:{{{*/
+ 		void           AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		void           AddInput(int input_enum, IssmDouble* values, int interpolation_enum);
+-		void           AddInput(Input* input_in);
+ 		void           AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		void	         NormalBase(IssmDouble* bed_normal, IssmDouble* xyz_list);
+ 		void           NormalSection(IssmDouble* normal,IssmDouble* xyz_list);
+@@ -231,7 +226,6 @@
+ 		void           GetVertexSidList(int* sidlist);
+ 		void           GetConnectivityList(int* connectivity);
+ 		int            GetElementType(void);
+-		Input*         GetInput(int inputenum);
+ 		Input*         GetMaterialInput(int inputenum);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 16909)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 16910)
+@@ -20,7 +20,6 @@
+ /*Constructors/destructor/copy*/
+ /*FUNCTION Seg::Seg(){{{*/
+ Seg::Seg(){
+-	this->nodes      = NULL;
+ 	this->vertices   = NULL;
+ 	this->material   = NULL;
+ 	this->matpar     = NULL;
+@@ -47,12 +46,10 @@
+ 			this->vertices = NULL;
+ 			this->material = NULL;
+ 			this->matpar   = NULL;
+-
+ 		}
+ /*}}}*/
+ /*FUNCTION Seg::~Seg(){{{*/
+ Seg::~Seg(){
+-	delete inputs;
+ 	this->parameters=NULL;
+ }
+ /*}}}*/
+@@ -523,11 +520,6 @@
+ 	delete this->material;
+ }
+ /*}}}*/
+-/*FUNCTION Seg::GetInput(int inputenum) {{{*/
+-Input* Seg::GetInput(int inputenum){
+-	return inputs->GetInput(inputenum);
+-}
+-/*}}}*/
+ /*FUNCTION Seg::GetNumberOfNodes;{{{*/
+ int Seg::GetNumberOfNodes(void){
+ 	return this->NumberofNodes();
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16909)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16910)
+@@ -32,13 +32,11 @@
+ 		int          id;
+ 		int          sid;
+ 
+-		Node       **nodes;                       // nodes
+ 		Vertex     **vertices;                    // 3 vertices
+ 		Material    *material;                    // 1 material ice
+ 		Matpar      *matpar;                      // 1 material parameter
+ 
+ 		Parameters  *parameters;                  //pointer to solution parameters
+-		Inputs      *inputs;
+ 
+ 		/*Seg constructors, destructors {{{*/
+ 		Seg();
+@@ -66,11 +64,8 @@
+ 		void  InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented yet");};
+ 		/*}}}*/
+ 		/*Element virtual functions definitions: {{{*/
+-		bool        AllActive(void){_error_("not implemented yet");};
+-		bool        AnyActive(void){_error_("not implemented yet");};
+ 		void        AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
+ 		void        AddInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
+-		void        AddInput(Input* input_in){_error_("not implemented yet");};
+ 		void        AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
+ 		IssmDouble  CharacteristicLength(void){_error_("not implemented yet");};
+ 		void        ComputeBasalStress(Vector<IssmDouble>* sigma_b){_error_("not implemented yet");};
+@@ -144,7 +139,6 @@
+ 		int         VelocityInterpolation(void){_error_("not implemented yet");};
+ 		void        GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating){_error_("not implemented yet");};
+ 		IssmDouble  GetGroundedPortion(IssmDouble* xyz_list){_error_("not implemented yet");};
+-		Input*      GetInput(int inputenum);
+ 		Input*      GetMaterialInput(int inputenum){_error_("not implemented yet");};
+ 		void        GetInputListOnVertices(IssmDouble* pvalue,int enumtype){_error_("not implemented yet");};
+ 		void        GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 0)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 16910)
+@@ -0,0 +1,52 @@
++/*!\file Element.cpp
++ * \brief: implementation of the Element object
++ */
++/*Headers:*/
++/*{{{*/
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#else
++#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
++#endif
++#include <stdio.h>
++#include <string.h>
++#include "../classes.h"
++#include "../../shared/shared.h"
++/*}}}*/
++
++/*Constructors/destructor/copy*/
++Element::Element(){/*{{{*/
++	this->inputs     = NULL;
++	this->nodes      = NULL;
++}/*}}}*/
++Element::~Element(){/*{{{*/
++	delete inputs;
++}
++/*}}}*/
++
++/*Other*/
++void Element::AddInput(Input* input_in){/*{{{*/
++
++	/*Call inputs method*/
++	_assert_(this->inputs);
++	this->inputs->AddInput(input_in);
++}/*}}}*/
++bool Element::AllActive(void){/*{{{*/
++
++	int numnodes = this->GetNumberOfNodes();
++	for(int i=0;i<numnodes;i++){
++		if(!this->nodes[i]->IsActive()) return false;
++	}
++	return true;
++}/*}}}*/
++bool Element::AnyActive(void){/*{{{*/
++
++	int numnodes = this->GetNumberOfNodes();
++	for(int i=0;i<numnodes;i++){
++		if(this->nodes[i]->IsActive()) return true;
++	}
++	return false;
++}/*}}}*/
++Input* Element::GetInput(int inputenum){/*{{{*/
++	return inputs->GetInput(inputenum);
++}/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16910-16911.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16910-16911.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16910-16911.diff	(revision 17802)
@@ -0,0 +1,21 @@
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 16910)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 16911)
+@@ -30,7 +30,6 @@
+ 					./classes/gauss/GaussTria.h\
+ 					./classes/gauss/GaussTria.cpp\
+ 					./classes/Update.h\
+-					./classes/Element.h\
+ 					./classes/FemModel.h\
+ 					./classes/FemModel.cpp\
+ 					./classes/Material.h\
+@@ -67,6 +66,8 @@
+ 					./classes/ExternalResults/Results.cpp\
+ 					./classes/ExternalResults/ExternalResult.h\
+ 					./classes/ExternalResults/GenericExternalResult.h\
++					./classes/Elements/Element.h\
++					./classes/Elements/Element.cpp\
+ 					./classes/Elements/Elements.h\
+ 					./classes/Elements/Elements.cpp\
+ 					./classes/Elements/ElementHook.h\
Index: issm/oecreview/Archive/16554-17801/ISSM-16911-16912.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16911-16912.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16911-16912.diff	(revision 17802)
@@ -0,0 +1,418 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16911)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16912)
+@@ -14,15 +14,18 @@
+ #include "../Update.h"
+ class DataSet;
+ class Parameters;
++class Parameter;
+ class Elements;
+ class Loads;
++class Nodes;
+ class Node;
+-class Nodes;
+ class Vertices;
++class Vertex;
+ class Materials;
++class Material;
+ class Matpar;
++class Inputs;
+ class Input;
+-class Inputs;
+ class Gauss;
+ class ElementVector;
+ template <class doublematrix> class Matrix;
+@@ -34,8 +37,12 @@
+ class Element: public Object,public Update{
+ 
+ 	public:
+-		Inputs   *inputs;
+-		Node    **nodes;
++		Inputs      *inputs;
++		Node       **nodes;
++		Vertex     **vertices;
++		Material    *material;
++		Matpar      *matpar;
++		Parameters  *parameters;
+ 
+ 	public: 
+ 		/*Constructors/Destructores*/
+@@ -46,29 +53,30 @@
+ 		void   AddInput(Input* input_in);
+ 		bool   AllActive(void);
+ 		bool   AnyActive(void);
++		void   DeleteMaterials(void);
++		void   FindParam(bool* pvalue,int paramenum);
++		void   FindParam(int* pvalue,int paramenum);
++		void   FindParam(IssmDouble* pvalue,int paramenum);
++		void   FindParam(int** pvalues,int* psize,int paramenum);
+ 		Input* GetInput(int inputenum);
+ 
+ 		/*Virtual functions*/
+-		virtual void   AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
+-		virtual void   AddInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
+-		virtual void   AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
++		virtual void       AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
++		virtual void       AddInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
++		virtual void       AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
+ 		virtual IssmDouble CharacteristicLength(void)=0;
+-		virtual void   Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters)=0;
+-		virtual void   SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters)=0;
+-		virtual void   SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum)=0;
++		virtual void       Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters)=0;
++		virtual void       SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters)=0;
++		virtual void       SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum)=0;
+ 		virtual ElementMatrix* CreateKMatrix(void)=0;
+ 		virtual void   CreateDVector(Vector<IssmDouble>* df)=0;
+ 		virtual ElementVector* CreatePVector(void)=0;
+ 		virtual void   CreateJacobianMatrix(Matrix<IssmDouble>* Jff)=0;
+-		virtual void   DeleteMaterials(void)=0;
+ 		virtual void   ElementSizes(IssmDouble* phx,IssmDouble* phy,IssmDouble* phz)=0;
+ 		virtual void   EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure)=0;
+ 		virtual IssmDouble EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure)=0;
+ 		virtual IssmDouble EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure)=0;
+-		virtual void   FindParam(bool* pvalue,int paramenum)=0;
+-		virtual void   FindParam(int* pvalue,int paramenum)=0;
+-		virtual void   FindParam(IssmDouble* pvalue,int paramenum)=0;
+-		virtual void   FindParam(int** pvalues,int* psize,int paramenum)=0;
++
+ 		virtual int    FiniteElement(void)=0;
+ 		virtual IssmDouble GetMaterialParameter(int enum_in)=0;
+ 		virtual IssmDouble MinEdgeLength(IssmDouble* xyz_list)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16911)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16912)
+@@ -23,15 +23,6 @@
+ #define NUMVERTICES1D 2
+ 
+ /*Constructors/destructor/copy*/
+-/*FUNCTION Tria::Tria(){{{*/
+-Tria::Tria(){
+-	this->vertices   = NULL;
+-	this->material   = NULL;
+-	this->matpar     = NULL;
+-	this->inputs     = NULL;
+-	this->parameters = NULL;
+-}
+-/*}}}*/
+ /*FUNCTION Tria::Tria(int id, int sid,int index, IoModel* iomodel,int nummodels){{{*/
+ Tria::Tria(int tria_id, int tria_sid, int index, IoModel* iomodel,int nummodels)
+ 	:TriaRef(nummodels),ElementHook(nummodels,index+1,3,iomodel){
+@@ -733,11 +724,6 @@
+ 	return;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::DeleteMaterials{{{*/
+-void Tria::DeleteMaterials(void){
+-	delete this->material;
+-}
+-/*}}}*/
+ /*FUNCTION Tria::Delta18oParameterization{{{*/
+ void  Tria::Delta18oParameterization(void){
+ 
+@@ -835,26 +821,6 @@
+ 	else _printf_("inputs=NULL\n");
+ }
+ /*}}}*/
+-/*FUNCTION Tria::FindParam(bool* pvalue,int paramenum){{{*/
+-void Tria::FindParam(bool* pvalue,int paramenum){
+-	this->parameters->FindParam(pvalue,paramenum);
+-}
+-/*}}}*/
+-/*FUNCTION Tria::FindParam(int* pvalue,int paramenum){{{*/
+-void Tria::FindParam(int* pvalue,int paramenum){
+-	this->parameters->FindParam(pvalue,paramenum);
+-}
+-/*}}}*/
+-/*FUNCTION Tria::FindParam(IssmDouble* pvalue,int paramenum){{{*/
+-void Tria::FindParam(IssmDouble* pvalue,int paramenum){
+-	this->parameters->FindParam(pvalue,paramenum);
+-}
+-/*}}}*/
+-/*FUNCTION Tria::FindParam(int** pvalues,int* psize,int paramenum){{{*/
+-void Tria::FindParam(int** pvalues,int* psize,int paramenum){
+-	this->parameters->FindParam(pvalues,psize,paramenum);
+-}
+-/*}}}*/
+ /*FUNCTION Tria::FiniteElement{{{*/
+ int Tria::FiniteElement(void){
+ 	return this->element_type;
+@@ -6285,7 +6251,7 @@
+ 
+ 	/*Get input (either in element or material)*/
+ 	if(control_enum==MaterialsRheologyBbarEnum || control_enum==DamageDbarEnum){
+-		input=(Input*)material->inputs->GetInput(control_enum); _assert_(input);
++		input=(Input*)this->material->inputs->GetInput(control_enum); _assert_(input);
+ 	}
+ 	else{
+ 		input=(Input*)this->inputs->GetInput(control_enum);   _assert_(input);
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16911)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16912)
+@@ -31,17 +31,11 @@
+ 
+ 	public:
+ 
+-		int          id;
+-		int          sid;
++		int id;
++		int sid;
+ 
+-		Vertex     **vertices;                    // 3 vertices
+-		Material    *material;                    // 1 material ice
+-		Matpar      *matpar;                      // 1 material parameter
+-
+-		Parameters  *parameters;                  //pointer to solution parameters
+-
+ 		/*Tria constructors, destructors {{{*/
+-		Tria();
++		Tria(){};
+ 		Tria(int tria_id,int tria_sid,int i, IoModel* iomodel,int nummodels);
+ 		~Tria();
+ 		/*}}}*/
+@@ -74,14 +68,9 @@
+ 		void        SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum);
+ 		void        CreateDVector(Vector<IssmDouble>* df);
+ 		void        CreateJacobianMatrix(Matrix<IssmDouble>* Jff);
+-		void        DeleteMaterials(void);
+ 		void        Delta18oParameterization(void);
+ 		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){_error_("not implemented yet");};
+ 		void        EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented yet");};
+-		void        FindParam(bool* pvalue,int paramenum);
+-		void        FindParam(int* pvalue,int paramenum);
+-		void        FindParam(IssmDouble* pvalue,int paramenum);
+-		void        FindParam(int** pvalues,int* psize,int paramenum);
+ 		int         FiniteElement(void);
+ 		Element*    GetBasalElement(void){_error_("not implemented yet");};
+ 		void	      GetDofList(int** pdoflist,int approximation_enum,int setenum);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16911)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16912)
+@@ -19,16 +19,6 @@
+ #define NUMVERTICES2D 3
+ 
+ /*Constructors/destructor/copy*/
+-/*FUNCTION Penta::Penta(){{{*/
+-Penta::Penta(){
+-	this->vertices          = NULL;
+-	this->material          = NULL;
+-	this->matpar            = NULL;
+-	this->verticalneighbors = NULL;
+-	this->inputs            = NULL;
+-	this->parameters        = NULL;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::~Penta(){{{*/
+ Penta::~Penta(){
+ 	this->parameters=NULL;
+@@ -857,26 +847,6 @@
+ 	return matpar->GetEnthalpyDiffusionParameterVolume(numvertices,enthalpy,pressure);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::FindParam(bool* pvalue,int paramenum){{{*/
+-void Penta::FindParam(bool* pvalue,int paramenum){
+-	this->parameters->FindParam(pvalue,paramenum);
+-}
+-/*}}}*/
+-/*FUNCTION Penta::FindParam(int* pvalue,int paramenum){{{*/
+-void Penta::FindParam(int* pvalue,int paramenum){
+-	this->parameters->FindParam(pvalue,paramenum);
+-}
+-/*}}}*/
+-/*FUNCTION Penta::FindParam(IssmDouble* pvalue,int paramenum){{{*/
+-void Penta::FindParam(IssmDouble* pvalue,int paramenum){
+-	this->parameters->FindParam(pvalue,paramenum);
+-}
+-/*}}}*/
+-/*FUNCTION Penta::FindParam(int** pvalues,int* psize,int paramenum){{{*/
+-void Penta::FindParam(int** pvalues,int* psize,int paramenum){
+-	this->parameters->FindParam(pvalues,psize,paramenum);
+-}
+-/*}}}*/
+ /*FUNCTION Penta::FiniteElement{{{*/
+ int Penta::FiniteElement(void){
+ 	return this->element_type;
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16911)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16912)
+@@ -31,18 +31,13 @@
+ 
+ 	public:
+ 
+-		int          id;
+-		int          sid;
++		int id;
++		int sid;
+ 
+-		Vertex     **vertices;                    // 6 vertices
+-		Material    *material;                    // 1 material ice
+-		Matpar      *matpar;                      // 1 material parameter
+ 		Penta      **verticalneighbors;           // 2 neighbors: first one under, second one above
+ 
+-		Parameters  *parameters;                  //pointer to solution parameters
+-
+ 		/*Penta constructors and destructor: {{{*/
+-		Penta();
++		Penta(){};
+ 		Penta(int penta_id,int penta_sid,int i, IoModel* iomodel,int nummodels);
+ 		~Penta();
+ 		/*}}}*/
+@@ -71,12 +66,7 @@
+ 		void   ComputeStrainRate(Vector<IssmDouble>* eps);
+ 		void   ComputeStressTensor();
+ 		void   Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
+-		void   DeleteMaterials(void){_error_("not implemented yet");};
+ 		void   ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz);
+-		void   FindParam(bool* pvalue,int paramenum);
+-		void   FindParam(int* pvalue,int paramenum);
+-		void   FindParam(IssmDouble* pvalue,int paramenum);
+-		void   FindParam(int** pvalues,int* psize,int paramenum);
+ 		int    FiniteElement(void);
+ 		void   SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters);
+ 		void   SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 16911)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 16912)
+@@ -18,15 +18,6 @@
+ /*Element macros*/
+ #define NUMVERTICES 2
+ /*Constructors/destructor/copy*/
+-/*FUNCTION Seg::Seg(){{{*/
+-Seg::Seg(){
+-	this->vertices   = NULL;
+-	this->material   = NULL;
+-	this->matpar     = NULL;
+-	this->inputs     = NULL;
+-	this->parameters = NULL;
+-}
+-/*}}}*/
+ /*FUNCTION Seg::Seg(int id, int sid,int index, IoModel* iomodel,int nummodels){{{*/
+ Seg::Seg(int seg_id, int seg_sid, int index, IoModel* iomodel,int nummodels)
+ 		:SegRef(nummodels),ElementHook(nummodels,index+1,2,iomodel){
+@@ -84,26 +75,6 @@
+ 	else _printf_("inputs=NULL\n");
+ }
+ /*}}}*/
+-/*FUNCTION Seg::FindParam(bool* pvalue,int paramenum){{{*/
+-void Seg::FindParam(bool* pvalue,int paramenum){
+-	this->parameters->FindParam(pvalue,paramenum);
+-}
+-/*}}}*/
+-/*FUNCTION Seg::FindParam(int* pvalue,int paramenum){{{*/
+-void Seg::FindParam(int* pvalue,int paramenum){
+-	this->parameters->FindParam(pvalue,paramenum);
+-}
+-/*}}}*/
+-/*FUNCTION Seg::FindParam(IssmDouble* pvalue,int paramenum){{{*/
+-void Seg::FindParam(IssmDouble* pvalue,int paramenum){
+-	this->parameters->FindParam(pvalue,paramenum);
+-}
+-/*}}}*/
+-/*FUNCTION Seg::FindParam(int** pvalues,int* psize,int paramenum){{{*/
+-void Seg::FindParam(int** pvalues,int* psize,int paramenum){
+-	this->parameters->FindParam(pvalues,psize,paramenum);
+-}
+-/*}}}*/
+ /*FUNCTION Seg::FiniteElement{{{*/
+ int Seg::FiniteElement(void){
+ 	return this->element_type;
+@@ -515,11 +486,6 @@
+ 	return pe;
+ }
+ /*}}}*/
+-/*FUNCTION Seg::DeleteMaterials{{{*/
+-void Seg::DeleteMaterials(void){
+-	delete this->material;
+-}
+-/*}}}*/
+ /*FUNCTION Seg::GetNumberOfNodes;{{{*/
+ int Seg::GetNumberOfNodes(void){
+ 	return this->NumberofNodes();
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16911)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16912)
+@@ -29,17 +29,11 @@
+ 
+ 	public:
+ 
+-		int          id;
+-		int          sid;
++		int id;
++		int sid;
+ 
+-		Vertex     **vertices;                    // 3 vertices
+-		Material    *material;                    // 1 material ice
+-		Matpar      *matpar;                      // 1 material parameter
+-
+-		Parameters  *parameters;                  //pointer to solution parameters
+-
+ 		/*Seg constructors, destructors {{{*/
+-		Seg();
++		Seg(){};
+ 		Seg(int seg_id,int seg_sid,int i, IoModel* iomodel,int nummodels);
+ 		~Seg();
+ 		/*}}}*/
+@@ -72,7 +66,6 @@
+ 		void        ComputeStrainRate(Vector<IssmDouble>* eps){_error_("not implemented yet");};
+ 		void        ComputeStressTensor(){_error_("not implemented yet");};
+ 		void        Configure(Elements* elements,Loads* loads,Nodes* nodesin,Vertices* verticesin,Materials* materials,Parameters* parameters){_error_("not implemented yet");};
+-		void        DeleteMaterials(void);
+ 		void        SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters){_error_("not implemented yet");};
+ 		void        SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum){_error_("not implemented yet");};
+ 		ElementMatrix* CreateKMatrix(void){_error_("not implemented yet");};
+@@ -85,10 +78,6 @@
+ 		void        EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented yet");};
+ 		IssmDouble  EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented");};
+ 		IssmDouble  EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure){_error_("not implemented");};
+-		void        FindParam(bool* pvalue,int paramenum);
+-		void        FindParam(int* pvalue,int paramenum);
+-		void        FindParam(IssmDouble* pvalue,int paramenum);
+-		void        FindParam(int** pvalues,int* psize,int paramenum);
+ 		int         FiniteElement(void);
+ 		Element*    GetBasalElement(void){_error_("not implemented yet");};
+ 		void        GetDofList(int** pdoflist,int approximation_enum,int setenum){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 16911)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 16912)
+@@ -18,6 +18,11 @@
+ Element::Element(){/*{{{*/
+ 	this->inputs     = NULL;
+ 	this->nodes      = NULL;
++	this->vertices   = NULL;
++	this->material   = NULL;
++	this->matpar     = NULL;
++	this->inputs     = NULL;
++	this->parameters = NULL;
+ }/*}}}*/
+ Element::~Element(){/*{{{*/
+ 	delete inputs;
+@@ -47,6 +52,21 @@
+ 	}
+ 	return false;
+ }/*}}}*/
++void Element::DeleteMaterials(void){/*{{{*/
++	delete this->material;
++}/*}}}*/
++void Element::FindParam(bool* pvalue,int paramenum){/*{{{*/
++	this->parameters->FindParam(pvalue,paramenum);
++}/*}}}*/
++void Element::FindParam(int* pvalue,int paramenum){/*{{{*/
++	this->parameters->FindParam(pvalue,paramenum);
++}/*}}}*/
++void Element::FindParam(IssmDouble* pvalue,int paramenum){/*{{{*/
++	this->parameters->FindParam(pvalue,paramenum);
++}/*}}}*/
++void Element::FindParam(int** pvalues,int* psize,int paramenum){/*{{{*/
++	this->parameters->FindParam(pvalues,psize,paramenum);
++}/*}}}*/
+ Input* Element::GetInput(int inputenum){/*{{{*/
+ 	return inputs->GetInput(inputenum);
+ }/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16912-16913.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16912-16913.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16912-16913.diff	(revision 17802)
@@ -0,0 +1,285 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16912)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16913)
+@@ -50,15 +50,17 @@
+ 		~Element();
+ 
+ 		/*Functions*/
+-		void   AddInput(Input* input_in);
+-		bool   AllActive(void);
+-		bool   AnyActive(void);
+-		void   DeleteMaterials(void);
+-		void   FindParam(bool* pvalue,int paramenum);
+-		void   FindParam(int* pvalue,int paramenum);
+-		void   FindParam(IssmDouble* pvalue,int paramenum);
+-		void   FindParam(int** pvalues,int* psize,int paramenum);
+-		Input* GetInput(int inputenum);
++		void       AddInput(Input* input_in);
++		bool       AllActive(void);
++		bool       AnyActive(void);
++		void       DeleteMaterials(void);
++		void       FindParam(bool* pvalue,int paramenum);
++		void       FindParam(int* pvalue,int paramenum);
++		void       FindParam(IssmDouble* pvalue,int paramenum);
++		void       FindParam(int** pvalues,int* psize,int paramenum);
++		Input*     GetInput(int inputenum);
++		IssmDouble GetMaterialParameter(int enum_in);
++		bool       IsFloating(); 
+ 
+ 		/*Virtual functions*/
+ 		virtual void       AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
+@@ -69,16 +71,14 @@
+ 		virtual void       SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters)=0;
+ 		virtual void       SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum)=0;
+ 		virtual ElementMatrix* CreateKMatrix(void)=0;
+-		virtual void   CreateDVector(Vector<IssmDouble>* df)=0;
+ 		virtual ElementVector* CreatePVector(void)=0;
++		virtual void   CreateDVector(Vector<IssmDouble>* df)=0;
+ 		virtual void   CreateJacobianMatrix(Matrix<IssmDouble>* Jff)=0;
+ 		virtual void   ElementSizes(IssmDouble* phx,IssmDouble* phy,IssmDouble* phz)=0;
+ 		virtual void   EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure)=0;
+ 		virtual IssmDouble EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure)=0;
+ 		virtual IssmDouble EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure)=0;
+-
+ 		virtual int    FiniteElement(void)=0;
+-		virtual IssmDouble GetMaterialParameter(int enum_in)=0;
+ 		virtual IssmDouble MinEdgeLength(IssmDouble* xyz_list)=0;
+ 		virtual void   NodalFunctions(IssmDouble* basis,Gauss* gauss)=0;
+ 		virtual void   NodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss)=0;
+@@ -121,7 +121,6 @@
+ 		virtual void   GetNodesLidList(int* sidlist)=0;
+ 
+ 		virtual int    Sid()=0;
+-		virtual bool   IsFloating()=0; 
+ 		virtual bool   IsNodeOnShelfFromFlags(IssmDouble* flags)=0; 
+ 		virtual bool   IsOnBed()=0;
+ 		virtual bool   IsOnSurface()=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16912)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16913)
+@@ -1122,22 +1122,6 @@
+ 	return phi;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetMaterialParameter{{{*/
+-IssmDouble Tria::GetMaterialParameter(int enum_in){
+-
+-	_assert_(this->matpar);
+-	switch(enum_in){ // FIXME: change this to material
+-		case MaterialsRheologyNEnum:
+-			return this->material->GetN();
+-		case MaterialsRheologyBEnum:
+-			return this->material->GetB();
+-		case MaterialsRheologyBbarEnum:
+-			return this->material->GetBbar();
+-		default:
+-			return this->matpar->GetMaterialParameter(enum_in);
+-	}
+-}
+-/*}}}*/
+ /*FUNCTION Tria::GetVerticesCoordinates(IssmDouble** pxyz_list){{{*/
+ void Tria::GetVerticesCoordinates(IssmDouble** pxyz_list){
+ 
+@@ -2210,26 +2194,6 @@
+ 	_error_("Could not find 2 vertices on surface");
+ }
+ /*}}}*/
+-/*FUNCTION Tria::IsFloating {{{*/
+-bool   Tria::IsFloating(){
+-
+-	bool shelf;
+-	int  migration_style;
+-	parameters->FindParam(&migration_style,GroundinglineMigrationEnum);
+-
+-	if(migration_style==SubelementMigrationEnum || migration_style==SubelementMigration2Enum){ //Floating if all nodes are floating
+-		if(this->inputs->Max(MaskGroundediceLevelsetEnum) <= 0.) shelf=true;
+-		else shelf=false;
+-	}
+-	else if(migration_style==NoneEnum || migration_style==AgressiveMigrationEnum || migration_style==SoftMigrationEnum){ //Floating if all nodes are floating
+-		if(this->inputs->Min(MaskGroundediceLevelsetEnum) > 0.) shelf=false;
+-		else shelf=true;
+-	}
+-	else _error_("migration_style not implemented yet");
+-
+-	return shelf;
+-}
+-/*}}}*/
+ /*FUNCTION Tria::IsNodeOnShelfFromFlags {{{*/
+ bool   Tria::IsNodeOnShelfFromFlags(IssmDouble* flags){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16912)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16913)
+@@ -96,7 +96,6 @@
+ 		void        EdgeOnBedIndices(int* pindex1,int* pindex);
+ 		int         EdgeOnBedIndex();
+ 		int         EdgeOnSurfaceIndex();
+-		bool        IsFloating();
+ 		bool        IsNodeOnShelfFromFlags(IssmDouble* flags);
+ 		int         NumberofNodesVelocity(void);
+ 		int         NumberofNodesPressure(void);
+@@ -255,7 +254,6 @@
+ 		void           NormalSection(IssmDouble* normal,IssmDouble* xyz_list);
+ 		void           NormalTop(IssmDouble* normal,IssmDouble* xyz_list);
+ 		void           NormalBase(IssmDouble* normal,IssmDouble* xyz_list);
+-		IssmDouble     GetMaterialParameter(int enum_in);
+ 		Input*         GetMaterialInput(int inputenum);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16912)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16913)
+@@ -989,20 +989,6 @@
+ 	*pdoflist=doflist;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetMaterialParameter{{{*/
+-IssmDouble Penta::GetMaterialParameter(int enum_in){
+-
+-	_assert_(this->matpar);
+-	switch(enum_in){ // FIXME: change this to material
+-		case MaterialsRheologyNEnum:
+-			return this->material->GetN();
+-		case MaterialsRheologyBEnum:
+-			return this->material->GetB();
+-		default:
+-			return this->matpar->GetMaterialParameter(enum_in);
+-	}
+-}
+-/*}}}*/
+ /*FUNCTION Penta::GetGroundedPart{{{*/
+ void Penta::GetGroundedPart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* mainlyfloating){
+ 	/*Computeportion of the element that is grounded*/ 
+@@ -2343,26 +2329,6 @@
+ 	else return false;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::IsFloating{{{*/
+-bool   Penta::IsFloating(){
+-
+-	bool shelf;
+-	int  migration_style;
+-	parameters->FindParam(&migration_style,GroundinglineMigrationEnum);
+-
+-	if(migration_style==SubelementMigrationEnum || migration_style==SubelementMigration2Enum){ //Floating if all nodes are floating
+-		if(this->inputs->Max(MaskGroundediceLevelsetEnum) <= 0.) shelf=true;
+-		else shelf=false;
+-	}
+-	else if(migration_style==NoneEnum || migration_style==AgressiveMigrationEnum || migration_style==SoftMigrationEnum){ //Floating if all nodes are floating
+-		if(this->inputs->Min(MaskGroundediceLevelsetEnum) > 0.) shelf=false;
+-		else shelf=true;
+-	}
+-	else _error_("migration_style not implemented yet");
+-
+-	return shelf;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::IsNodeOnShelfFromFlags {{{*/
+ bool   Penta::IsNodeOnShelfFromFlags(IssmDouble* flags){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16912)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16913)
+@@ -87,7 +87,6 @@
+ 		int    GetNumberOfNodesPressure(void);
+ 		int    GetNumberOfNodesVelocity(void);
+ 		int    GetNumberOfVertices(void);
+-		IssmDouble GetMaterialParameter(int enum_in);
+ 		void   GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
+ 		IssmDouble GetZcoord(Gauss* gauss);
+ 		IssmDouble GetYcoord(Gauss* gauss){_error_("Not implemented");};
+@@ -240,7 +239,6 @@
+ 		bool	         IsInput(int name);
+ 		bool	         IsOnSurface(void);
+ 		bool	         IsOnBed(void);
+-		bool           IsFloating(void); 
+ 		bool           IsNodeOnShelfFromFlags(IssmDouble* flags);
+ 		void           JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss);
+ 		void           JacobianDeterminantLine(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 16912)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 16913)
+@@ -123,13 +123,6 @@
+ }
+ /*}}}*/
+ 
+-/*FUNCTION Seg::GetMaterialParameter{{{*/
+-IssmDouble Seg::GetMaterialParameter(int enum_in){
+-
+-	_assert_(this->matpar);
+-	return this->matpar->GetMaterialParameter(enum_in);
+-}
+-/*}}}*/
+ /*FUNCTION Seg::GetSize{{{*/
+ IssmDouble Seg::GetSize(void){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16912)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16913)
+@@ -85,7 +85,6 @@
+ 		void        GetDofListPressure(int** pdoflist,int setenum){_error_("not implemented yet");};
+ 		void        GetInputListOnNodes(IssmDouble* pvalue,int enumtype){_error_("not implemented yet");};
+ 		void        GetInputListOnNodes(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){_error_("not implemented yet");};
+-		IssmDouble  GetMaterialParameter(int enum_in);
+ 		int         GetNodeIndex(Node* node){_error_("not implemented yet");};
+ 		void        GetNodesSidList(int* sidlist){_error_("not implemented yet");};
+ 		void        GetNodesLidList(int* lidlist){_error_("not implemented yet");};
+@@ -100,7 +99,6 @@
+ 		void        InputChangeName(int input_enum, int enum_type_old){_error_("not implemented yet");};
+ 		bool        IsOnBed(){_error_("not implemented yet");};
+ 		bool        IsOnSurface(){_error_("not implemented yet");};
+-		bool        IsFloating(){_error_("not implemented yet");};
+ 		bool        IsNodeOnShelfFromFlags(IssmDouble* flags){_error_("not implemented yet");};
+ 		void        JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss);
+ 		void        JacobianDeterminantLine(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 16912)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 16913)
+@@ -67,6 +67,39 @@
+ void Element::FindParam(int** pvalues,int* psize,int paramenum){/*{{{*/
+ 	this->parameters->FindParam(pvalues,psize,paramenum);
+ }/*}}}*/
++IssmDouble Element::GetMaterialParameter(int enum_in){/*{{{*/
++
++	_assert_(this->matpar);
++	switch(enum_in){ // FIXME: change this to material
++		case MaterialsRheologyNEnum:
++			return this->material->GetN();
++		case MaterialsRheologyBEnum:
++			return this->material->GetB();
++		case MaterialsRheologyBbarEnum:
++			return this->material->GetBbar();
++		default:
++			return this->matpar->GetMaterialParameter(enum_in);
++	}
++}
++/*}}}*/
+ Input* Element::GetInput(int inputenum){/*{{{*/
+ 	return inputs->GetInput(inputenum);
+ }/*}}}*/
++bool Element::IsFloating(){/*{{{*/
++
++	bool shelf;
++	int  migration_style;
++	parameters->FindParam(&migration_style,GroundinglineMigrationEnum);
++
++	if(migration_style==SubelementMigrationEnum || migration_style==SubelementMigration2Enum){ //Floating if all nodes are floating
++		if(this->inputs->Max(MaskGroundediceLevelsetEnum) <= 0.) shelf=true;
++		else shelf=false;
++	}
++	else if(migration_style==NoneEnum || migration_style==AgressiveMigrationEnum || migration_style==SoftMigrationEnum){ //Floating if all nodes are floating
++		if(this->inputs->Min(MaskGroundediceLevelsetEnum) > 0.) shelf=false;
++		else shelf=true;
++	}
++	else _error_("migration_style not implemented yet");
++
++	return shelf;
++}/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16913-16914.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16913-16914.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16913-16914.diff	(revision 17802)
@@ -0,0 +1,106 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16913)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16914)
+@@ -61,6 +61,7 @@
+ 		Input*     GetInput(int inputenum);
+ 		IssmDouble GetMaterialParameter(int enum_in);
+ 		bool       IsFloating(); 
++		IssmDouble TMeltingPoint(IssmDouble pressure);
+ 
+ 		/*Virtual functions*/
+ 		virtual void       AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
+@@ -178,7 +179,6 @@
+ 		virtual void   Delta18oParameterization(void)=0;
+ 		virtual void   SmbGradients(void)=0;
+ 	   virtual Element*   SpawnBasalElement(void)=0;
+-		virtual IssmDouble TMeltingPoint(IssmDouble pressure)=0;
+ 		virtual void   ReduceMatrices(ElementMatrix* Ke,ElementVector* pe)=0;
+ 		virtual void   ResetCoordinateSystem()=0;
+ 		virtual IssmDouble StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16913)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16914)
+@@ -2660,14 +2660,6 @@
+ 	  this->inputs->AddInput(new TriaInput(SurfaceforcingsMassBalanceEnum,&smb[0],P1Enum));
+ }
+ /*}}}*/
+-/*FUNCTION Tria::TMeltingPoint{{{*/
+-IssmDouble Tria::TMeltingPoint(IssmDouble pressure){
+-
+-	_assert_(matpar);
+-	return this->matpar->TMeltingPoint(pressure);
+-
+-}
+-/*}}}*/
+ /*FUNCTION Tria::SetCurrentConfiguration {{{*/
+ void  Tria::SetCurrentConfiguration(Elements* elementsin, Loads* loadsin, Nodes* nodesin, Materials* materialsin, Parameters* parametersin){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16913)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16914)
+@@ -118,7 +118,6 @@
+ 		void        ResetCoordinateSystem(void);
+ 		void	      SmbGradients();
+ 	   Element*    SpawnBasalElement(void);
+-		IssmDouble  TMeltingPoint(IssmDouble pressure);
+ 		int         VelocityInterpolation();
+ 		IssmDouble  PureIceEnthalpy(IssmDouble pressure){_error_("not implemented yet");};
+ 		int         PressureInterpolation();
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16913)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16914)
+@@ -3013,14 +3013,6 @@
+ 	  this->inputs->AddInput(new PentaInput(SurfaceforcingsMassBalanceEnum,&smb[0],P1Enum));
+ }
+ /*}}}*/
+-/*FUNCTION Penta::TMeltingPoint{{{*/
+-IssmDouble Penta::TMeltingPoint(IssmDouble pressure){
+-
+-	_assert_(matpar);
+-	return this->matpar->TMeltingPoint(pressure);
+-
+-}
+-/*}}}*/
+ /*FUNCTION Penta::SurfaceArea {{{*/
+ IssmDouble Penta::SurfaceArea(void){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16913)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16914)
+@@ -115,7 +115,6 @@
+ 		void   ResetCoordinateSystem(void);
+ 		void   SmbGradients();
+ 	   Element* SpawnBasalElement(void);
+-		IssmDouble  TMeltingPoint(IssmDouble pressure);
+ 		IssmDouble SurfaceArea(void);
+ 		void   Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement);
+ 		int    NodalValue(IssmDouble* pvalue, int index, int natureofdataenum);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16913)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16914)
+@@ -191,7 +191,6 @@
+ 		void        ResetCoordinateSystem(void){_error_("not implemented yet");};
+ 		void        ReduceMatrices(ElementMatrix* Ke,ElementVector* pe){_error_("not implemented yet");};
+ 		void	      SmbGradients(){_error_("not implemented yet");};
+-		IssmDouble  TMeltingPoint(IssmDouble pressure){_error_("not implemented yet");};
+ 		IssmDouble  SurfaceArea(void){_error_("not implemented yet");};
+ 		void        Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement){_error_("not implemented yet");};
+ 		IssmDouble  TimeAdapt(){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 16913)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 16914)
+@@ -103,3 +103,7 @@
+ 
+ 	return shelf;
+ }/*}}}*/
++IssmDouble Element::TMeltingPoint(IssmDouble pressure){/*{{{*/
++	_assert_(matpar);
++	return this->matpar->TMeltingPoint(pressure);
++}/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16914-16915.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16914-16915.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16914-16915.diff	(revision 17802)
@@ -0,0 +1,534 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16914)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16915)
+@@ -61,7 +61,17 @@
+ 		Input*     GetInput(int inputenum);
+ 		IssmDouble GetMaterialParameter(int enum_in);
+ 		bool       IsFloating(); 
++		void       StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
++		void       StrainRateHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
++		void       StrainRateFS(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+ 		IssmDouble TMeltingPoint(IssmDouble pressure);
++		void       ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
++		void       ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
++		void       ViscosityL1L2(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* surf);
++		void       ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
++		void       ViscositySSADerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon);
++		void       ViscosityHODerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon);
++		void       ViscosityFSDerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon);
+ 
+ 		/*Virtual functions*/
+ 		virtual void       AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
+@@ -185,16 +195,7 @@
+ 		virtual void   ValueP1OnGauss(IssmDouble* pvalue,IssmDouble* values,Gauss* gauss)=0;
+ 		virtual void   ValueP1DerivativesOnGauss(IssmDouble* dvalue,IssmDouble* values,IssmDouble* xyz_list,Gauss* gauss)=0;
+ 		virtual void   ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input)=0;
+-		virtual void   ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input)=0;
+-		virtual void   ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input)=0;
+-		virtual void   ViscosityL1L2(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* surf)=0;
+-		virtual void   ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input)=0;
+-		virtual void   ViscositySSADerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon)=0;
+-		virtual void   ViscosityHODerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon)=0;
+-		virtual void   ViscosityFSDerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon)=0;
+-		virtual void   StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input)=0;
+-		virtual void   StrainRateHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input)=0;
+-		virtual void   StrainRateFS(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input)=0;
++
+ 		virtual int    VelocityInterpolation()=0;
+ 		virtual int    PressureInterpolation()=0;
+ 		virtual bool   IsZeroLevelset(int levelset_enum)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16914)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16915)
+@@ -3001,59 +3001,6 @@
+ 	return this->vertices[vertexindex]->Connectivity();
+ }
+ /*}}}*/
+-/*FUNCTION Tria::ViscosityFS{{{*/
+-void Tria::ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){
+-
+-	/*Intermediaries*/
+-	IssmDouble viscosity;
+-	IssmDouble epsilon[3];/* epsilon=[exx,eyy,exy];    */
+-
+-	this->StrainRateSSA(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
+-	material->GetViscosity2dvertical(&viscosity, &epsilon[0]);
+-
+-	/*Assign output pointer*/
+-	*pviscosity=viscosity;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::ViscositySSA{{{*/
+-void Tria::ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){
+-
+-	/*Intermediaries*/
+-	IssmDouble viscosity;
+-	IssmDouble epsilon[3];/* epsilon=[exx,eyy,exy];    */
+-
+-	this->StrainRateSSA(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
+-	material->GetViscosity2d(&viscosity, &epsilon[0]);
+-
+-	/*Assign output pointer*/
+-	*pviscosity=viscosity;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::ViscositySSADerivativeEpsSquare{{{*/
+-void Tria::ViscositySSADerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){
+-	this->material->GetViscosity2dDerivativeEpsSquare(pmu_prime,epsilon);
+-}
+-/*}}}*/
+-/*FUNCTION Tria::StrainRateSSA{{{*/
+-void Tria::StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){
+-
+-	int i;
+-	IssmDouble epsilonvx[3];
+-	IssmDouble epsilonvy[3];
+-
+-	/*Check that both inputs have been found*/
+-	if (!vx_input || !vy_input){
+-		_error_("Input missing. Here are the input pointers we have for vx: " << vx_input << ", vy: " << vy_input << "\n");
+-	}
+-
+-	/*Get strain rate assuming that epsilon has been allocated*/
+-	vx_input->GetVxStrainRate2d(epsilonvx,xyz_list,gauss);
+-	vy_input->GetVyStrainRate2d(epsilonvy,xyz_list,gauss);
+-
+-	/*Sum all contributions*/
+-	for(i=0;i<3;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i];
+-}
+-/*}}}*/
+ /*FUNCTION Tria::IsZeroLevelset{{{*/
+ bool Tria::IsZeroLevelset(int levelset_enum){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16914)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16915)
+@@ -308,16 +308,6 @@
+ 		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int* transformenum_list){_error_("not implemented yet");};
+ 		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes_list,int numnodes,int* transformenum_list){_error_("not implemented yet");};
+ 		void           ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
+-		void           ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+-		void           ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented yet");};
+-		void           ViscosityL1L2(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* surf){_error_("not implemented yet");};
+-		void           ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+-		void           ViscosityHODerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){_error_("not implemented");};
+-		void           ViscosityFSDerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){_error_("not implemented");};
+-		void           ViscositySSADerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon);
+-		void           StrainRateFS(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented");};
+-		void           StrainRateHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
+-		void           StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 
+ 		#ifdef _HAVE_STRESSBALANCE_
+ 		ElementMatrix* CreateKMatrixStressbalanceSSA(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16914)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16915)
+@@ -3453,166 +3453,6 @@
+ 	*pphi = phi;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::ViscosityFS{{{*/
+-void Penta::ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){
+-
+-	/*Intermediaries*/
+-	IssmDouble viscosity;
+-	IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
+-
+-	this->StrainRateFS(&epsilon[0],xyz_list,gauss,vx_input,vy_input,vz_input);
+-	material->GetViscosity3dFS(&viscosity, &epsilon[0]);
+-
+-	/*Assign output pointer*/
+-	*pviscosity=viscosity;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::ViscosityL1L2{{{*/
+-void Penta::ViscosityL1L2(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* surface_input){
+-	/*Compute the L1L2 viscosity
+-	 *
+-	 *      1
+-	 * mu = - A^-1 (sigma'_e)^(1-n)
+-	 *      2
+-	 *
+-	 * sigma'_e^2 = |sigma'_//|^2 + |sigma'_perp|^2 (see Perego 2012 eq. 17,18)
+-	 *
+-	 * L1L2 assumptions:
+-	 *
+-	 * (1) |eps_b|_// = A (|sigma'_//|^2 + |sigma'_perp|^2)^((n-1)/2) |sigma'_//|
+-	 * (2) |sigma'_perp|^2 = |rho g (s-z) grad(s)|^2
+-	 *
+-	 * Assuming that n = 3, we have a polynom of degree 3 to solve (the only unkown is X=|sigma'_//|)
+-	 *
+-	 * A X^3 + A |rho g (s-z) grad(s)|^2 X - |eps_b|_// = 0     */
+-
+-	int        i;
+-	IssmDouble z,s,viscosity,p,q,delta;
+-	IssmDouble tau_perp,tau_par,eps_b,A;
+-	IssmDouble epsilonvx[5]; /*exx eyy exy exz eyz*/
+-	IssmDouble epsilonvy[5]; /*exx eyy exy exz eyz*/
+-	IssmDouble epsilon[5];   /*exx eyy exy exz eyz*/
+-	IssmDouble z_list[NUMVERTICES];
+-	IssmDouble slope[3];
+-
+-	/*Check that both inputs have been found*/
+-	if (!vx_input || !vy_input || !surface_input) _error_("Input missing");
+-
+-	/*Get tau_perp*/
+-	for(i=0;i<NUMVERTICES;i++) z_list[i]=xyz_list[3*i+2];
+-	surface_input->GetInputValue(&s,gauss);
+-	surface_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
+-	PentaRef::GetInputValue(&z,&z_list[0],gauss);
+-	tau_perp = matpar->GetRhoIce() * matpar->GetG() * fabs(s-z)*sqrt(slope[0]*slope[0]+slope[1]*slope[1]);
+-
+-	/* Get eps_b*/
+-	vx_input->GetVxStrainRate3dHO(epsilonvx,xyz_list,gauss);
+-	vy_input->GetVyStrainRate3dHO(epsilonvy,xyz_list,gauss);
+-	for(i=0;i<5;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i];
+-	eps_b = sqrt(epsilon[0]*epsilon[0] + epsilon[1]*epsilon[1] + epsilon[0]*epsilon[1] + epsilon[2]*epsilon[2]);
+-	if(eps_b==0.){
+-		*pviscosity = 2.5e+17;
+-		return;
+-	}
+-
+-	/*Get A*/
+-	_assert_(material->GetN()==3.0);
+-	A=material->GetA();
+-
+-	/*Solve for tau_perp (http://fr.wikipedia.org/wiki/Méthode_de_Cardan)*/
+-	p     = tau_perp *tau_perp;
+-	q     = - eps_b/A;
+-	delta = q *q + p*p*p*4./27.;
+-	_assert_(delta>0);
+-	tau_par = pow(0.5*(-q+sqrt(delta)),1./3.) - pow(0.5*(q+sqrt(delta)),1./3.);
+-
+-	/*Viscosity*/
+-	viscosity = 1./(2.*A*(tau_par*tau_par + tau_perp*tau_perp));
+-	_assert_(!xIsNan(viscosity));
+-	_assert_(viscosity > 0.);
+-
+-	/*Assign output pointer*/
+-	*pviscosity = viscosity;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::ViscosityHO{{{*/
+-void Penta::ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){
+-
+-	/*Intermediaries*/
+-	IssmDouble viscosity;
+-	IssmDouble epsilon[5];/* epsilon=[exx,eyy,exy,exz,eyz];*/
+-
+-	this->StrainRateHO(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
+-	material->GetViscosity3d(&viscosity, &epsilon[0]);
+-
+-	/*Assign output pointer*/
+-	*pviscosity=viscosity;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::ViscosityHODerivativeEpsSquare{{{*/
+-void Penta::ViscosityHODerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){
+-	this->material->GetViscosityDerivativeEpsSquare(pmu_prime,epsilon);
+-}
+-/*}}}*/
+-/*FUNCTION Penta::StrainRateHO{{{*/
+-void Penta::StrainRateHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){
+-	/*Compute the 3d Blatter/HOStrain Rate (5 components):
+-	 *
+-	 * epsilon=[exx eyy exy exz eyz]
+-	 *
+-	 * with exz=1/2 du/dz
+-	 *      eyz=1/2 dv/dz
+-	 *
+-	 * the contribution of vz is neglected
+-	 */
+-
+-	int i;
+-	IssmDouble epsilonvx[5];
+-	IssmDouble epsilonvy[5];
+-
+-	/*Check that both inputs have been found*/
+-	if (!vx_input || !vy_input){
+-		_error_("Input missing. Here are the input pointers we have for vx: " << vx_input << ", vy: " << vy_input << "\n");
+-	}
+-
+-	/*Get strain rate assuming that epsilon has been allocated*/
+-	vx_input->GetVxStrainRate3dHO(epsilonvx,xyz_list,gauss);
+-	vy_input->GetVyStrainRate3dHO(epsilonvy,xyz_list,gauss);
+-
+-	/*Sum all contributions*/
+-	for(i=0;i<5;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i];
+-}
+-/*}}}*/
+-/*FUNCTION Penta::ViscosityFSDerivativeEpsSquare{{{*/
+-void Penta::ViscosityFSDerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){
+-	this->material->GetViscosityDerivativeEpsSquare(pmu_prime,epsilon);
+-}
+-/*}}}*/
+-/*FUNCTION Penta::StrainRateFS{{{*/
+-void Penta::StrainRateFS(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){
+-	/*Compute the 3d Strain Rate (6 components):
+-	 *
+-	 * epsilon=[exx eyy ezz exy exz eyz]
+-	 */
+-
+-	IssmDouble epsilonvx[6];
+-	IssmDouble epsilonvy[6];
+-	IssmDouble epsilonvz[6];
+-
+-	/*Check that both inputs have been found*/
+-	if (!vx_input || !vy_input || !vz_input){
+-		_error_("Input missing. Here are the input pointers we have for vx: " << vx_input << ", vy: " << vy_input << ", vz: " << vz_input << "\n");
+-	}
+-
+-	/*Get strain rate assuming that epsilon has been allocated*/
+-	vx_input->GetVxStrainRate3d(epsilonvx,xyz_list,gauss);
+-	vy_input->GetVyStrainRate3d(epsilonvy,xyz_list,gauss);
+-	vz_input->GetVzStrainRate3d(epsilonvz,xyz_list,gauss);
+-
+-	/*Sum all contributions*/
+-	for(int i=0;i<6;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i]+epsilonvz[i];
+-}
+-/*}}}*/
+ /*FUNCTION Penta::VelocityInterpolation{{{*/
+ int Penta::VelocityInterpolation(void){
+ 	return PentaRef::VelocityInterpolation();
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16914)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16915)
+@@ -277,16 +277,6 @@
+ 		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int transformenum){_error_("not implemented yet");};
+ 		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int* transformenum_list){_error_("not implemented yet");};
+ 		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes_list,int numnodes,int* transformenum_list);
+-		void           ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+-		void           ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+-		void           ViscosityL1L2(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* surf);
+-		void           ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
+-		void           ViscosityHODerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon);
+-		void           ViscosityFSDerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon);
+-		void           ViscositySSADerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){_error_("not implemented");};
+-		void           StrainRateFS(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+-		void           StrainRateHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+-		void           StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
+ 
+ 		#ifdef _HAVE_STRESSBALANCE_
+ 		ElementMatrix* CreateKMatrixCouplingSSAHO(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16914)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16915)
+@@ -151,16 +151,6 @@
+ 		int         VertexConnectivity(int vertexindex){_error_("not implemented yet");};
+ 		void        VerticalSegmentIndices(int** pindices,int* pnumseg){_error_("not implemented yet");};
+ 		void        ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
+-		void        ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented");};
+-		void        ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
+-		void        ViscosityL1L2(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* surf){_error_("not implemented yet");};
+-		void        ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
+-		void        ViscosityHODerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){_error_("not implemented");};
+-		void        ViscosityFSDerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){_error_("not implemented");};
+-		void        ViscositySSADerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){_error_("not implemented");};
+-		void        StrainRateFS(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented");};
+-		void        StrainRateHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
+-		void        StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not implemented");};
+ 		bool        IsZeroLevelset(int levelset_enum){_error_("not implemented");};
+ 		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented");};
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 16914)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 16915)
+@@ -107,3 +107,191 @@
+ 	_assert_(matpar);
+ 	return this->matpar->TMeltingPoint(pressure);
+ }/*}}}*/
++
++void Element::ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){/*{{{*/
++
++	/*Intermediaries*/
++	IssmDouble viscosity;
++	IssmDouble epsilon3d[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
++	IssmDouble epsilon2d[3]; /* epsilon=[exx,eyy,exy];            */
++
++	if(vz_input){
++		/*3D*/
++		this->StrainRateFS(&epsilon3d[0],xyz_list,gauss,vx_input,vy_input,vz_input);
++		material->GetViscosity3dFS(&viscosity, &epsilon3d[0]);
++	}
++	else{
++		/*2D*/
++		this->StrainRateSSA(&epsilon2d[0],xyz_list,gauss,vx_input,vy_input);
++		material->GetViscosity2dvertical(&viscosity,&epsilon2d[0]);
++	}
++
++	/*Assign output pointer*/
++	*pviscosity=viscosity;
++}
++/*}}}*/
++void Element::ViscosityL1L2(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* surface_input){/*{{{*/
++	/*Compute the L1L2 viscosity
++	 *
++	 *      1
++	 * mu = - A^-1 (sigma'_e)^(1-n)
++	 *      2
++	 *
++	 * sigma'_e^2 = |sigma'_//|^2 + |sigma'_perp|^2 (see Perego 2012 eq. 17,18)
++	 *
++	 * L1L2 assumptions:
++	 *
++	 * (1) |eps_b|_// = A (|sigma'_//|^2 + |sigma'_perp|^2)^((n-1)/2) |sigma'_//|
++	 * (2) |sigma'_perp|^2 = |rho g (s-z) grad(s)|^2
++	 *
++	 * Assuming that n = 3, we have a polynom of degree 3 to solve (the only unkown is X=|sigma'_//|)
++	 *
++	 * A X^3 + A |rho g (s-z) grad(s)|^2 X - |eps_b|_// = 0     */
++
++	int        i;
++	IssmDouble z,s,viscosity,p,q,delta;
++	IssmDouble tau_perp,tau_par,eps_b,A;
++	IssmDouble epsilonvx[5]; /*exx eyy exy exz eyz*/
++	IssmDouble epsilonvy[5]; /*exx eyy exy exz eyz*/
++	IssmDouble epsilon[5];   /*exx eyy exy exz eyz*/
++	IssmDouble slope[3];
++
++	/*Check that both inputs have been found*/
++	if (!vx_input || !vy_input || !surface_input) _error_("Input missing");
++
++	/*Get tau_perp*/
++	surface_input->GetInputValue(&s,gauss);
++	surface_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
++	z=GetZcoord(gauss);
++	tau_perp = matpar->GetRhoIce() * matpar->GetG() * fabs(s-z)*sqrt(slope[0]*slope[0]+slope[1]*slope[1]);
++
++	/* Get eps_b*/
++	vx_input->GetVxStrainRate3dHO(epsilonvx,xyz_list,gauss);
++	vy_input->GetVyStrainRate3dHO(epsilonvy,xyz_list,gauss);
++	for(i=0;i<5;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i];
++	eps_b = sqrt(epsilon[0]*epsilon[0] + epsilon[1]*epsilon[1] + epsilon[0]*epsilon[1] + epsilon[2]*epsilon[2]);
++	if(eps_b==0.){
++		*pviscosity = 2.5e+17;
++		return;
++	}
++
++	/*Get A*/
++	_assert_(material->GetN()==3.0);
++	A=material->GetA();
++
++	/*Solve for tau_perp (http://fr.wikipedia.org/wiki/Méthode_de_Cardan)*/
++	p     = tau_perp *tau_perp;
++	q     = - eps_b/A;
++	delta = q *q + p*p*p*4./27.;
++	_assert_(delta>0);
++	tau_par = pow(0.5*(-q+sqrt(delta)),1./3.) - pow(0.5*(q+sqrt(delta)),1./3.);
++
++	/*Viscosity*/
++	viscosity = 1./(2.*A*(tau_par*tau_par + tau_perp*tau_perp));
++	_assert_(!xIsNan(viscosity));
++	_assert_(viscosity > 0.);
++
++	/*Assign output pointer*/
++	*pviscosity = viscosity;
++}/*}}}*/
++void Element::ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
++
++	/*Intermediaries*/
++	IssmDouble viscosity;
++	IssmDouble epsilon[5];/* epsilon=[exx,eyy,exy,exz,eyz];*/
++
++	this->StrainRateHO(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
++	material->GetViscosity3d(&viscosity, &epsilon[0]);
++
++	/*Assign output pointer*/
++	*pviscosity=viscosity;
++}/*}}}*/
++void Element::ViscosityHODerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){/*{{{*/
++	this->material->GetViscosityDerivativeEpsSquare(pmu_prime,epsilon);
++}/*}}}*/
++void Element::StrainRateHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
++	/*Compute the 3d Blatter/HOStrain Rate (5 components):
++	 *
++	 * epsilon=[exx eyy exy exz eyz]
++	 *
++	 * with exz=1/2 du/dz
++	 *      eyz=1/2 dv/dz
++	 *
++	 * the contribution of vz is neglected
++	 */
++
++	int i;
++	IssmDouble epsilonvx[5];
++	IssmDouble epsilonvy[5];
++
++	/*Check that both inputs have been found*/
++	if (!vx_input || !vy_input){
++		_error_("Input missing. Here are the input pointers we have for vx: " << vx_input << ", vy: " << vy_input << "\n");
++	}
++
++	/*Get strain rate assuming that epsilon has been allocated*/
++	vx_input->GetVxStrainRate3dHO(epsilonvx,xyz_list,gauss);
++	vy_input->GetVyStrainRate3dHO(epsilonvy,xyz_list,gauss);
++
++	/*Sum all contributions*/
++	for(i=0;i<5;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i];
++}/*}}}*/
++void Element::ViscosityFSDerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){/*{{{*/
++	this->material->GetViscosityDerivativeEpsSquare(pmu_prime,epsilon);
++}/*}}}*/
++void Element::StrainRateFS(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){/*{{{*/
++	/*Compute the 3d Strain Rate (6 components):
++	 *
++	 * epsilon=[exx eyy ezz exy exz eyz]
++	 */
++
++	IssmDouble epsilonvx[6];
++	IssmDouble epsilonvy[6];
++	IssmDouble epsilonvz[6];
++
++	/*Check that both inputs have been found*/
++	if (!vx_input || !vy_input || !vz_input){
++		_error_("Input missing. Here are the input pointers we have for vx: " << vx_input << ", vy: " << vy_input << ", vz: " << vz_input << "\n");
++	}
++
++	/*Get strain rate assuming that epsilon has been allocated*/
++	vx_input->GetVxStrainRate3d(epsilonvx,xyz_list,gauss);
++	vy_input->GetVyStrainRate3d(epsilonvy,xyz_list,gauss);
++	vz_input->GetVzStrainRate3d(epsilonvz,xyz_list,gauss);
++
++	/*Sum all contributions*/
++	for(int i=0;i<6;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i]+epsilonvz[i];
++}/*}}}*/
++void Element::ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
++
++	/*Intermediaries*/
++	IssmDouble viscosity;
++	IssmDouble epsilon[3];/* epsilon=[exx,eyy,exy];    */
++
++	this->StrainRateSSA(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
++	material->GetViscosity2d(&viscosity, &epsilon[0]);
++
++	/*Assign output pointer*/
++	*pviscosity=viscosity;
++}/*}}}*/
++void Element::ViscositySSADerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){/*{{{*/
++	this->material->GetViscosity2dDerivativeEpsSquare(pmu_prime,epsilon);
++}/*}}}*/
++void Element::StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
++
++	int i;
++	IssmDouble epsilonvx[3];
++	IssmDouble epsilonvy[3];
++
++	/*Check that both inputs have been found*/
++	if (!vx_input || !vy_input){
++		_error_("Input missing. Here are the input pointers we have for vx: " << vx_input << ", vy: " << vy_input << "\n");
++	}
++
++	/*Get strain rate assuming that epsilon has been allocated*/
++	vx_input->GetVxStrainRate2d(epsilonvx,xyz_list,gauss);
++	vy_input->GetVyStrainRate2d(epsilonvy,xyz_list,gauss);
++
++	/*Sum all contributions*/
++	for(i=0;i<3;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i];
++}/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16915-16916.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16915-16916.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16915-16916.diff	(revision 17802)
@@ -0,0 +1,279 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16915)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16916)
+@@ -72,6 +72,19 @@
+ 		void       ViscositySSADerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon);
+ 		void       ViscosityHODerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon);
+ 		void       ViscosityFSDerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon);
++		void       TransformLoadVectorCoord(ElementVector* pe,int transformenum);
++		void       TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list);
++		void       TransformLoadVectorCoord(ElementVector* pe,int numnodes,int transformenum){_error_("not implemented yet");};      /*Tiling only*/
++		void       TransformLoadVectorCoord(ElementVector* pe,int numnodes,int* transformenum_list){_error_("not implemented yet");};      /*Tiling only*/
++		void       TransformSolutionCoord(IssmDouble* values,int transformenum);
++		void       TransformSolutionCoord(IssmDouble* values,int* transformenum_list);
++		void       TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum);
++		void       TransformSolutionCoord(IssmDouble* values,int numnodes,int* transformenum_list);
++		void       TransformStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum);
++		void       TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* transformenum_list);
++		void       TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int transformenum);
++		void       TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int* transformenum_list){_error_("not implemented yet");};      /*Tiling only*/
++		void       TransformStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes_list,int numnodes,int* transformenum_list);
+ 
+ 		/*Virtual functions*/
+ 		virtual void       AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
+@@ -100,19 +113,7 @@
+ 		virtual void   NormalTop(IssmDouble* normal,IssmDouble* xyz_list)=0;
+ 		virtual void   NormalBase(IssmDouble* normal,IssmDouble* xyz_list)=0;
+ 		virtual IssmDouble PureIceEnthalpy(IssmDouble pressure)=0;
+-		virtual void   TransformLoadVectorCoord(ElementVector* pe,int transformenum)=0;
+-		virtual void   TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list)=0;
+-		virtual void   TransformLoadVectorCoord(ElementVector* pe,int numnodes,int transformenum)=0;
+-		virtual void   TransformLoadVectorCoord(ElementVector* pe,int numnodes,int* transformenum_list)=0;
+-		virtual void   TransformSolutionCoord(IssmDouble* values,int transformenum)=0;
+-		virtual void   TransformSolutionCoord(IssmDouble* values,int* transformenum_list)=0;
+-		virtual void   TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum)=0;
+-		virtual void   TransformSolutionCoord(IssmDouble* values,int numnodes,int* transformenum_list)=0;
+-		virtual void   TransformStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum)=0;
+-		virtual void   TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* transformenum_list)=0;
+-		virtual void   TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int transformenum)=0;
+-		virtual void   TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int* transformenum_list)=0;
+-		virtual void   TransformStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes_list,int numnodes,int* transformenum_list)=0;
++
+ 		virtual Element* GetBasalElement(void)=0;
+ 		virtual void	GetDofList(int** pdoflist,int approximation_enum,int setenum)=0;
+ 		virtual void	GetDofListVelocity(int** pdoflist,int setenum)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16915)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16916)
+@@ -2799,48 +2799,6 @@
+ 	return dt;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::TransformSolutionCoord(IssmDouble* values,int transformenum){{{*/
+-void Tria::TransformSolutionCoord(IssmDouble* values,int transformenum){
+-
+-	::TransformSolutionCoord(values,this->nodes,this->NumberofNodes(),transformenum);
+-
+-}
+-/*}}}*/
+-/*FUNCTION Tria::TransformSolutionCoord(IssmDouble* values,int* transformenum_list){{{*/
+-void Tria::TransformSolutionCoord(IssmDouble* values,int* transformenum_list){
+-
+-	::TransformSolutionCoord(values,this->nodes,this->NumberofNodes(),transformenum_list);
+-
+-}
+-/*}}}*/
+-/*FUNCTION Tria::TransformLoadVectorCoord(ElementVector* pe,int transformenum){{{*/
+-void Tria::TransformLoadVectorCoord(ElementVector* pe,int transformenum){
+-
+-	::TransformLoadVectorCoord(pe,this->nodes,this->NumberofNodes(),transformenum);
+-
+-}
+-/*}}}*/
+-/*FUNCTION Tria::TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list){{{*/
+-void Tria::TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list){
+-
+-	::TransformLoadVectorCoord(pe,this->nodes,this->NumberofNodes(),transformenum_list);
+-
+-}
+-/*}}}*/
+-/*FUNCTION Tria::TransformStiffnessMatrixCoord(ElementMatrix* pe,int transformenum){{{*/
+-void Tria::TransformStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum){
+-
+-	::TransformStiffnessMatrixCoord(Ke,this->nodes,this->NumberofNodes(),transformenum);
+-
+-}
+-/*}}}*/
+-/*FUNCTION Tria::TransformStiffnessMatrixCoord(ElementMatrix* pe,int* transformenum_list){{{*/
+-void Tria::TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* transformenum_list){
+-
+-	::TransformStiffnessMatrixCoord(Ke,this->nodes,this->NumberofNodes(),transformenum_list);
+-
+-}
+-/*}}}*/
+ /*FUNCTION Tria::Update{{{*/
+ void Tria::Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finiteelement_type){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16915)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16916)
+@@ -294,19 +294,6 @@
+ 		void	         SetClone(int* minranks);
+ 		Seg*	         SpawnSeg(int index1,int index2);
+ 		IssmDouble     StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa){_error_("not implemented yet");};
+-		void           TransformLoadVectorCoord(ElementVector* pe,int transformenum);
+-		void           TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list);
+-		void           TransformLoadVectorCoord(ElementVector* pe,int numnodes,int transformenum){_error_("not implemented yet");};
+-		void           TransformLoadVectorCoord(ElementVector* pe,int numnodes,int* transformenum_list){_error_("not implemented yet");};
+-		void           TransformSolutionCoord(IssmDouble* values,int transformenum);
+-		void           TransformSolutionCoord(IssmDouble* values,int* transformenum_list);
+-		void           TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum){_error_("not implemented yet");};
+-		void           TransformSolutionCoord(IssmDouble* values,int numnodes,int* transformenum_list){_error_("not implemented yet");};
+-		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum);
+-		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* transformenum_list);
+-		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int transformenum){_error_("not implemented yet");};
+-		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int* transformenum_list){_error_("not implemented yet");};
+-		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes_list,int numnodes,int* transformenum_list){_error_("not implemented yet");};
+ 		void           ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
+ 
+ 		#ifdef _HAVE_STRESSBALANCE_
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16915)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16916)
+@@ -3094,69 +3094,6 @@
+ 
+ 	return dt;
+ }/*}}}*/
+-/*FUNCTION Penta::TransformLoadVectorCoord(ElementVector* pe,int transformenum){{{*/
+-void Penta::TransformLoadVectorCoord(ElementVector* pe,int transformenum){
+-
+-	::TransformLoadVectorCoord(pe,this->nodes,this->NumberofNodes(),transformenum);
+-
+-}
+-/*}}}*/
+-/*FUNCTION Penta::TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list){{{*/
+-void Penta::TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list){
+-
+-	::TransformLoadVectorCoord(pe,this->nodes,this->NumberofNodes(),transformenum_list);
+-
+-}
+-/*}}}*/
+-/*FUNCTION Penta::TransformSolutionCoord(IssmDouble* values,int transformenum){{{*/
+-void Penta::TransformSolutionCoord(IssmDouble* values,int transformenum){
+-
+-	::TransformSolutionCoord(values,this->nodes,this->NumberofNodes(),transformenum);
+-
+-}
+-/*}}}*/
+-/*FUNCTION Penta::TransformSolutionCoord(IssmDouble* values,int* transformenum_list){{{*/
+-void Penta::TransformSolutionCoord(IssmDouble* values,int* transformenum_list){
+-
+-	::TransformSolutionCoord(values,this->nodes,this->NumberofNodes(),transformenum_list);
+-
+-}
+-/*}}}*/
+-/*FUNCTION Penta::TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum){{{*/
+-void Penta::TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum){
+-
+-	::TransformSolutionCoord(values,this->nodes,numnodes,transformenum);
+-
+-}
+-/*}}}*/
+-/*FUNCTION Penta::TransformSolutionCoord(IssmDouble* values,int numnodes,int* transformenum_list){{{*/
+-void Penta::TransformSolutionCoord(IssmDouble* values,int numnodes,int* transformenum_list){
+-
+-	::TransformSolutionCoord(values,this->nodes,numnodes,transformenum_list);
+-
+-}
+-/*}}}*/
+-/*FUNCTION Penta::TransformStiffnessMatrixCoord(ElementMatrix* pe,int transformenum){{{*/
+-void Penta::TransformStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum){
+-
+-	::TransformStiffnessMatrixCoord(Ke,this->nodes,this->NumberofNodes(),transformenum);
+-
+-}
+-/*}}}*/
+-/*FUNCTION Penta::TransformStiffnessMatrixCoord(ElementMatrix* pe,int* transformenum_list){{{*/
+-void Penta::TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* transformenum_list){
+-
+-	::TransformStiffnessMatrixCoord(Ke,this->nodes,this->NumberofNodes(),transformenum_list);
+-
+-}
+-/*}}}*/
+-/*FUNCTION Penta::TransformStiffnessMatrixCoord(ElementMatrix* pe,Node** nodes_list,int numnodesint* transformenum_list){{{*/
+-void Penta::TransformStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes_list,int numnodes,int* transformenum_list){
+-
+-	::TransformStiffnessMatrixCoord(Ke,nodes_list,numnodes,transformenum_list);
+-
+-}
+-/*}}}*/
+ /*FUNCTION Penta::Update {{{*/
+ void Penta::Update(int index,IoModel* iomodel,int analysis_counter,int analysis_type,int finiteelement_type){ 
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16915)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16916)
+@@ -264,19 +264,6 @@
+ 		void	         SetClone(int* minranks);
+ 		Tria*	         SpawnTria(int location);
+ 		IssmDouble     StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa);
+-		void           TransformLoadVectorCoord(ElementVector* pe,int transformenum);
+-		void           TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list);
+-		void           TransformLoadVectorCoord(ElementVector* pe,int numnodes,int transformenum){_error_("not implemented yet");};      /*Tiling only*/
+-		void           TransformLoadVectorCoord(ElementVector* pe,int numnodes,int* transformenum_list){_error_("not implemented yet");};/*Tiling only*/
+-		void           TransformSolutionCoord(IssmDouble* values,int transformenum);
+-		void           TransformSolutionCoord(IssmDouble* values,int* transformenum_list);
+-		void           TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum);      /*Tiling only*/
+-		void           TransformSolutionCoord(IssmDouble* values,int numnodes,int* transformenum_list);/*Tiling only*/
+-		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum);
+-		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* transformenum_list);
+-		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int transformenum){_error_("not implemented yet");};
+-		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int* transformenum_list){_error_("not implemented yet");};
+-		void           TransformStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes_list,int numnodes,int* transformenum_list);
+ 
+ 		#ifdef _HAVE_STRESSBALANCE_
+ 		ElementMatrix* CreateKMatrixCouplingSSAHO(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16915)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16916)
+@@ -184,19 +184,6 @@
+ 		IssmDouble  SurfaceArea(void){_error_("not implemented yet");};
+ 		void        Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement){_error_("not implemented yet");};
+ 		IssmDouble  TimeAdapt(){_error_("not implemented yet");};
+-		void        TransformLoadVectorCoord(ElementVector* pe,int transformenum){_error_("not implemented yet");};
+-		void        TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list){_error_("not implemented yet");};
+-		void        TransformLoadVectorCoord(ElementVector* pe,int numnodes,int transformenum){_error_("not implemented yet");};
+-		void        TransformLoadVectorCoord(ElementVector* pe,int numnodes,int* transformenum_list){_error_("not implemented yet");};
+-		void        TransformSolutionCoord(IssmDouble* values,int transformenum){_error_("not implemented yet");};
+-		void        TransformSolutionCoord(IssmDouble* values,int* transformenum_list){_error_("not implemented yet");};
+-		void        TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum){_error_("not implemented yet");};
+-		void        TransformSolutionCoord(IssmDouble* values,int numnodes,int* transformenum_list){_error_("not implemented yet");};
+-		void        TransformStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum){_error_("not implemented yet");};
+-		void        TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* transformenum_list){_error_("not implemented yet");};
+-		void        TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int transformenum){_error_("not implemented yet");};
+-		void        TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int* transformenum_list){_error_("not implemented yet");};
+-		void        TransformStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes_list,int numnodes,int* transformenum_list){_error_("not implemented yet");};
+ 		void UpdateConstraintsExtrudeFromBase(){_error_("not implemented");};
+ 		void UpdateConstraintsExtrudeFromTop(){_error_("not implemented");};
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 16915)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 16916)
+@@ -295,3 +295,30 @@
+ 	/*Sum all contributions*/
+ 	for(i=0;i<3;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i];
+ }/*}}}*/
++void Element::TransformLoadVectorCoord(ElementVector* pe,int transformenum){/*{{{*/
++	::TransformLoadVectorCoord(pe,this->nodes,this->GetNumberOfNodes(),transformenum);
++}/*}}}*/
++void Element::TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list){/*{{{*/
++	::TransformLoadVectorCoord(pe,this->nodes,this->GetNumberOfNodes(),transformenum_list);
++}/*}}}*/
++void Element::TransformSolutionCoord(IssmDouble* values,int transformenum){/*{{{*/
++	::TransformSolutionCoord(values,this->nodes,this->GetNumberOfNodes(),transformenum);
++}/*}}}*/
++void Element::TransformSolutionCoord(IssmDouble* values,int* transformenum_list){/*{{{*/
++	::TransformSolutionCoord(values,this->nodes,this->GetNumberOfNodes(),transformenum_list);
++}/*}}}*/
++void Element::TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum){/*{{{*/
++	::TransformSolutionCoord(values,this->nodes,numnodes,transformenum);
++}/*}}}*/
++void Element::TransformSolutionCoord(IssmDouble* values,int numnodes,int* transformenum_list){/*{{{*/
++	::TransformSolutionCoord(values,this->nodes,numnodes,transformenum_list);
++}/*}}}*/
++void Element::TransformStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum){/*{{{*/
++	::TransformStiffnessMatrixCoord(Ke,this->nodes,this->GetNumberOfNodes(),transformenum);
++}/*}}}*/
++void Element::TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* transformenum_list){/*{{{*/
++	::TransformStiffnessMatrixCoord(Ke,this->nodes,this->GetNumberOfNodes(),transformenum_list);
++}/*}}}*/
++void Element::TransformStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes_list,int numnodes,int* transformenum_list){/*{{{*/
++	::TransformStiffnessMatrixCoord(Ke,nodes_list,numnodes,transformenum_list);
++}/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16916-16917.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16916-16917.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16916-16917.diff	(revision 17802)
@@ -0,0 +1,29 @@
+Index: ../trunk-jpl/etc/environment.sh
+===================================================================
+--- ../trunk-jpl/etc/environment.sh	(revision 16916)
++++ ../trunk-jpl/etc/environment.sh	(revision 16917)
+@@ -2,12 +2,22 @@
+ 
+ pathprepend(){ #{{{
+ 	if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then
+-		export PATH="$1:$PATH"
++		name=$1
++		if [[ "$ISSM_ARCH" == "cygwin-intel" ]]; then
++			#export path using the cygwin convention
++			name=`cygpath -u $1`
++		fi
++		export PATH="$name:$PATH"
+ 	fi
+ } #}}}
+ pathappend(){ #{{{
+ 	if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then
+-		export PATH="$PATH:$1"
++		name=$1
++		if [[ "$ISSM_ARCH" == "cygwin-intel" ]]; then
++			#export path in cygwin convention
++			name=`cygpath -u $1`
++		fi
++		export PATH="$PATH:$name"
+ 	fi
+ } #}}}
+ libpathprepend(){ #{{{
Index: issm/oecreview/Archive/16554-17801/ISSM-16917-16918.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16917-16918.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16917-16918.diff	(revision 17802)
@@ -0,0 +1,15 @@
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16917)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16918)
+@@ -60,8 +60,9 @@
+ 		HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
+ 		analysis->ElementizeEplMask(femmodel);
+ 		delete analysis;
+-		femmodel->HydrologyTransferx();
+ 	}
++	/*For the initialization we compute the transfer without the mask if the EPL is not present*/
++	femmodel->HydrologyTransferx();
+ 
+ 	/*Iteration on the two layers*/
+ 	for(;;){
Index: issm/oecreview/Archive/16554-17801/ISSM-16918-16919.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16918-16919.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16918-16919.diff	(revision 17802)
@@ -0,0 +1,112 @@
+Index: ../trunk-jpl/test/Archives/Archive111.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive232.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive515.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive509.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive510.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive209.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive210.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive224.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive513.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive507.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive233.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive207.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive415.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive227.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive410.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive505.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive317.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive211.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive225.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive508.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive315.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive416.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive329.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive411.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive324.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive506.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive237.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive318.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-16919-16920.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16919-16920.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16919-16920.diff	(revision 17802)
@@ -0,0 +1,14 @@
+Index: ../trunk-jpl/jenkins/windows
+===================================================================
+--- ../trunk-jpl/jenkins/windows	(revision 16919)
++++ ../trunk-jpl/jenkins/windows	(revision 16920)
+@@ -51,8 +51,7 @@
+ EXTERNALPACKAGESDIR=$ISSM_DIR/externalpackages
+ 
+ #List of external pakages to be installed and their installation scripts
+-EXTERNALPACKAGES="autotools install-win.sh                
+-						cccl install-win7.sh
++EXTERNALPACKAGES=" cccl install-win7.sh
+ 						petsc     install-3.1-win7.sh
+ 						triangle  install-win7.sh        
+ 						matlab install.sh
Index: issm/oecreview/Archive/16554-17801/ISSM-16920-16921.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16920-16921.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16920-16921.diff	(revision 17802)
@@ -0,0 +1,82 @@
+Index: ../trunk-jpl/test/Archives/Archive333.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive327.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive432.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive325.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive426.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive516.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive409.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive455.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive121.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive326.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive427.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive285.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive335.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive122.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive431.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16920)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16921)
+@@ -4222,7 +4222,7 @@
+ 	}
+ 
+ 	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(2,3);
++	gauss=new GaussPenta(3,3);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 
+ 		gauss->GaussPoint(ig);
+@@ -8579,7 +8579,7 @@
+ 	Input* surface_input=inputs->GetInput(SurfaceEnum);     _assert_(surface_input);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(2,3);
++	gauss=new GaussPenta(3,3);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 
+ 		gauss->GaussPoint(ig);
Index: issm/oecreview/Archive/16554-17801/ISSM-16921-16922.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16921-16922.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16921-16922.diff	(revision 17802)
@@ -0,0 +1,143 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16921)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16922)
+@@ -2270,7 +2270,7 @@
+ 		this->GetBFS(B,element,dim,xyz_list,gauss);
+ 		this->GetBFSprime(Bprime,element,dim,xyz_list,gauss);
+ 
+-		element->ViscosityFS(&viscosity,xyz_list,gauss,vx_input,vy_input,vz_input);
++		element->ViscosityFS(&viscosity,dim,xyz_list,gauss,vx_input,vy_input,vz_input);
+ 		for(i=0;i<epssize;i++)     D[i*bsize+i] = + 2.*viscosity*gauss->weight*Jdet;
+ 		for(i=epssize;i<bsize;i++) D[i*bsize+i] = - FSreconditioning*gauss->weight*Jdet;
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16921)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16922)
+@@ -65,7 +65,7 @@
+ 		void       StrainRateHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 		void       StrainRateFS(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+ 		IssmDouble TMeltingPoint(IssmDouble pressure);
+-		void       ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
++		void       ViscosityFS(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+ 		void       ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 		void       ViscosityL1L2(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* surf);
+ 		void       ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 16921)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 16922)
+@@ -108,14 +108,14 @@
+ 	return this->matpar->TMeltingPoint(pressure);
+ }/*}}}*/
+ 
+-void Element::ViscosityFS(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){/*{{{*/
++void Element::ViscosityFS(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){/*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble viscosity;
+ 	IssmDouble epsilon3d[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
+ 	IssmDouble epsilon2d[3]; /* epsilon=[exx,eyy,exy];            */
+ 
+-	if(vz_input){
++	if(dim==3){
+ 		/*3D*/
+ 		this->StrainRateFS(&epsilon3d[0],xyz_list,gauss,vx_input,vy_input,vz_input);
+ 		material->GetViscosity3dFS(&viscosity, &epsilon3d[0]);
+@@ -206,36 +206,24 @@
+ 	/*Assign output pointer*/
+ 	*pviscosity=viscosity;
+ }/*}}}*/
+-void Element::ViscosityHODerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){/*{{{*/
+-	this->material->GetViscosityDerivativeEpsSquare(pmu_prime,epsilon);
+-}/*}}}*/
+-void Element::StrainRateHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
+-	/*Compute the 3d Blatter/HOStrain Rate (5 components):
+-	 *
+-	 * epsilon=[exx eyy exy exz eyz]
+-	 *
+-	 * with exz=1/2 du/dz
+-	 *      eyz=1/2 dv/dz
+-	 *
+-	 * the contribution of vz is neglected
+-	 */
++void Element::ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
+ 
+-	int i;
+-	IssmDouble epsilonvx[5];
+-	IssmDouble epsilonvy[5];
++	/*Intermediaries*/
++	IssmDouble viscosity;
++	IssmDouble epsilon[3];/* epsilon=[exx,eyy,exy];    */
+ 
+-	/*Check that both inputs have been found*/
+-	if (!vx_input || !vy_input){
+-		_error_("Input missing. Here are the input pointers we have for vx: " << vx_input << ", vy: " << vy_input << "\n");
+-	}
++	this->StrainRateSSA(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
++	material->GetViscosity2d(&viscosity, &epsilon[0]);
+ 
+-	/*Get strain rate assuming that epsilon has been allocated*/
+-	vx_input->GetVxStrainRate3dHO(epsilonvx,xyz_list,gauss);
+-	vy_input->GetVyStrainRate3dHO(epsilonvy,xyz_list,gauss);
+-
+-	/*Sum all contributions*/
+-	for(i=0;i<5;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i];
++	/*Assign output pointer*/
++	*pviscosity=viscosity;
+ }/*}}}*/
++void Element::ViscositySSADerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){/*{{{*/
++	this->material->GetViscosity2dDerivativeEpsSquare(pmu_prime,epsilon);
++}/*}}}*/
++void Element::ViscosityHODerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){/*{{{*/
++	this->material->GetViscosityDerivativeEpsSquare(pmu_prime,epsilon);
++}/*}}}*/
+ void Element::ViscosityFSDerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){/*{{{*/
+ 	this->material->GetViscosityDerivativeEpsSquare(pmu_prime,epsilon);
+ }/*}}}*/
+@@ -262,21 +250,33 @@
+ 	/*Sum all contributions*/
+ 	for(int i=0;i<6;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i]+epsilonvz[i];
+ }/*}}}*/
+-void Element::ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
++void Element::StrainRateHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
++	/*Compute the 3d Blatter/HOStrain Rate (5 components):
++	 *
++	 * epsilon=[exx eyy exy exz eyz]
++	 *
++	 * with exz=1/2 du/dz
++	 *      eyz=1/2 dv/dz
++	 *
++	 * the contribution of vz is neglected
++	 */
+ 
+-	/*Intermediaries*/
+-	IssmDouble viscosity;
+-	IssmDouble epsilon[3];/* epsilon=[exx,eyy,exy];    */
++	int i;
++	IssmDouble epsilonvx[5];
++	IssmDouble epsilonvy[5];
+ 
+-	this->StrainRateSSA(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
+-	material->GetViscosity2d(&viscosity, &epsilon[0]);
++	/*Check that both inputs have been found*/
++	if (!vx_input || !vy_input){
++		_error_("Input missing. Here are the input pointers we have for vx: " << vx_input << ", vy: " << vy_input << "\n");
++	}
+ 
+-	/*Assign output pointer*/
+-	*pviscosity=viscosity;
++	/*Get strain rate assuming that epsilon has been allocated*/
++	vx_input->GetVxStrainRate3dHO(epsilonvx,xyz_list,gauss);
++	vy_input->GetVyStrainRate3dHO(epsilonvy,xyz_list,gauss);
++
++	/*Sum all contributions*/
++	for(i=0;i<5;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i];
+ }/*}}}*/
+-void Element::ViscositySSADerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){/*{{{*/
+-	this->material->GetViscosity2dDerivativeEpsSquare(pmu_prime,epsilon);
+-}/*}}}*/
+ void Element::StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
+ 
+ 	int i;
Index: issm/oecreview/Archive/16554-17801/ISSM-16922-16923.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16922-16923.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16922-16923.diff	(revision 17802)
@@ -0,0 +1,9 @@
+Index: ../trunk-jpl/externalpackages/cccl/install-win7.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/cccl/install-win7.sh	(revision 16922)
++++ ../trunk-jpl/externalpackages/cccl/install-win7.sh	(revision 16923)
+@@ -8,3 +8,4 @@
+ 
+ #Move cccl into install directory
+ cp issm/cccl install/bin
++chmod a+x install/bin/cccl
Index: issm/oecreview/Archive/16554-17801/ISSM-16923-16924.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16923-16924.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16923-16924.diff	(revision 17802)
@@ -0,0 +1,10 @@
+Index: ../trunk-jpl/externalpackages/cccl/install-win7.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/cccl/install-win7.sh	(revision 16923)
++++ ../trunk-jpl/externalpackages/cccl/install-win7.sh	(revision 16924)
+@@ -8,4 +8,4 @@
+ 
+ #Move cccl into install directory
+ cp issm/cccl install/bin
+-chmod a+x install/bin/cccl
++chmod 755 install/bin/cccl
Index: issm/oecreview/Archive/16554-17801/ISSM-16924-16925.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16924-16925.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16924-16925.diff	(revision 17802)
@@ -0,0 +1,15 @@
+Index: ../trunk-jpl/jenkins/jenkins.sh
+===================================================================
+--- ../trunk-jpl/jenkins/jenkins.sh	(revision 16924)
++++ ../trunk-jpl/jenkins/jenkins.sh	(revision 16925)
+@@ -196,6 +196,10 @@
+ 	else
+ 		make install
+ 	fi
++	if [ $? -ne 0 ]; then 
++		echo "ISSM_COMPILATION failed!"
++		exit 1
++	fi
+ elif [ "$ISSM_COMPILATION" == "no" ]
+ then
+ 	echo "Skipping ISSM compilation"
Index: issm/oecreview/Archive/16554-17801/ISSM-16925-16926.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16925-16926.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16925-16926.diff	(revision 17802)
@@ -0,0 +1,442 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16925)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16926)
+@@ -75,6 +75,10 @@
+ 		ElementMatrix* CreateKMatrixCouplingSSAHOFriction(Element* element);
+ 		ElementMatrix* CreateKMatrixCouplingSSAHOViscous(Element* element);
+ 		ElementVector* CreatePVectorSSAHO(Element* element);
++		ElementVector* CreatePVectorHOFS(Element* element);
++		ElementVector* CreatePVectorCouplingHOFS(Element* element);
++		ElementVector* CreatePVectorCouplingHOFSFriction(Element* element);
++		ElementVector* CreatePVectorCouplingHOFSViscous(Element* element);
+ 		void GetBSSAHO(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void InputUpdateFromSolutionHOFS(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionSSAFS(IssmDouble* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16925)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16926)
+@@ -850,6 +850,8 @@
+ 			return CreatePVectorFS(element);
+ 		case SSAHOApproximationEnum: 
+ 			return CreatePVectorSSAHO(element);
++		case HOFSApproximationEnum: 
++			return CreatePVectorHOFS(element);
+ 		case NoneApproximationEnum:
+ 			return NULL;
+ 		default:
+@@ -3100,13 +3102,13 @@
+ 	/*Intermediaries */
+ 	int         i,j;
+ 	IssmDouble  Jdet2d,alpha2;
+-	IssmDouble *xyz_list_tria=NULL;
+-	IssmDouble* L           = xNewZeroInit<IssmDouble>(2*numdof);
+-	IssmDouble  DL[2][2]     ={{ 0,0 },{0,0}}; //for basal drag
++	IssmDouble *xyz_list_tria = NULL;
++	IssmDouble* L             = xNewZeroInit<IssmDouble>(2*numdof);
++	IssmDouble  DL[2][2]      = {{ 0,0 },{0,0}}; //for basal drag
+ 	IssmDouble  DL_scalar;
+-	IssmDouble* Ke_gg       = xNewZeroInit<IssmDouble>(numdof*numdof);
+-	Node       *node_list[2*numnodes];
+-	int*        cs_list= xNew<int>(2*numnodes);
++	IssmDouble* Ke_gg         = xNewZeroInit<IssmDouble>(numdof*numdof);
++	Node      **node_list     = xNew<Node*>(2*numnodes);
++	int*        cs_list       = xNew<int>(2*numnodes);
+ 
+ 	/*Initialize Element matrix and return if necessary*/
+ 	ElementMatrix* Ke1=element->NewElementMatrix(SSAApproximationEnum);
+@@ -3162,6 +3164,7 @@
+ 	delete gauss;
+ 	delete friction;
+ 	xDelete<int>(cs_list);
++	xDelete<Node*>(node_list);
+ 	xDelete<IssmDouble>(xyz_list_tria);
+ 	xDelete<IssmDouble>(Ke_gg);
+ 	return Ke;
+@@ -3183,7 +3186,7 @@
+ 	IssmDouble  D[3][3]={0.0}; // material matrix, simple scalar matrix.
+ 	IssmDouble  D_scalar;
+ 	IssmDouble* Ke_gg          = xNewZeroInit<IssmDouble>(numdofp*numdofm);
+-	Node        *node_list[2*numnodes];
++	Node       **node_list     = xNew<Node*>(2*numnodes);
+ 	int*         cs_list= xNew<int>(2*numnodes);
+ 
+ 	/*Find penta on bed as HO must be coupled to the dofs on the bed: */
+@@ -3248,6 +3251,7 @@
+ 	delete gauss_tria;
+ 	xDelete<IssmDouble>(Ke_gg);
+ 	xDelete<IssmDouble>(xyz_list);
++	xDelete<Node*>(node_list);
+ 	xDelete<int>(cs_list);
+ 	return Ke;
+ 
+@@ -3264,6 +3268,194 @@
+ 	delete pe2;
+ 	return pe;
+ }/*}}}*/
++ElementVector* StressbalanceAnalysis::CreatePVectorHOFS(Element* element){/*{{{*/
++
++	/*compute all load vectors for this element*/
++	int init = element->FiniteElement();
++	element->SetTemporaryElementType(P1Enum);
++	ElementVector* pe1=CreatePVectorHO(element);
++	element->SetTemporaryElementType(init);
++	ElementVector* pe2=CreatePVectorFS(element);
++	int indices[3]={18,19,20};
++	element->SetTemporaryElementType(MINIcondensedEnum);
++	ElementMatrix* Ke = CreateKMatrixFS(element);
++	element->SetTemporaryElementType(init);
++	pe2->StaticCondensation(Ke,3,&indices[0]);
++	delete Ke;
++	ElementVector* pe3=CreatePVectorCouplingHOFS(element);
++	ElementVector* pe =new ElementVector(pe1,pe2,pe3);
++
++	/*clean-up and return*/
++	delete pe1;
++	delete pe2;
++	delete pe3;
++	return pe;
++}/*}}}*/
++ElementVector* StressbalanceAnalysis::CreatePVectorCouplingHOFS(Element* element){/*{{{*/
++
++	/*compute all load vectors for this element*/
++	ElementVector* pe1=CreatePVectorCouplingHOFSViscous(element);
++	ElementVector* pe2=CreatePVectorCouplingHOFSFriction(element);
++	ElementVector* pe =new ElementVector(pe1,pe2);
++
++	/*clean-up and return*/
++	delete pe1;
++	delete pe2;
++	return pe;
++}/*}}}*/
++ElementVector* StressbalanceAnalysis::CreatePVectorCouplingHOFSFriction(Element* element){/*{{{*/
++
++	/*Intermediaries*/
++	int         i,j,approximation;
++	IssmDouble  Jdet,Jdet2d,FSreconditioning;
++	IssmDouble	bed_normal[3];
++	IssmDouble  viscosity, w, alpha2_gauss;
++	IssmDouble  dw[3];
++	IssmDouble	*xyz_list_tria = NULL;
++	IssmDouble  *xyz_list      = NULL;
++	IssmDouble  basis[6]; //for the six nodes of the penta
++
++	/*Initialize Element vector and return if necessary*/
++	if(!element->IsOnBed() || element->IsFloating()) return NULL;
++	element->GetInputValue(&approximation,ApproximationEnum);
++	if(approximation!=HOFSApproximationEnum) return NULL;
++
++	int vnumnodes = element->GetNumberOfNodesVelocity();
++	int pnumnodes = element->GetNumberOfNodesPressure();
++	int numnodes  = vnumnodes+pnumnodes;
++
++	/*Prepare coordinate system list*/
++	int*   cs_list   = xNew<int>(vnumnodes+pnumnodes);
++	Node **node_list = xNew<Node*>(vnumnodes+pnumnodes);
++	for(i=0;i<vnumnodes;i++){
++		cs_list[i]           = XYZEnum;
++		node_list[i]           = element->GetNode(i);
++	}
++	for(i=0;i<pnumnodes;i++){
++		cs_list[vnumnodes+i] = PressureEnum;
++		node_list[vnumnodes+i] = element->GetNode(vnumnodes+i);
++	}
++
++	ElementVector* pe=element->NewElementVector(FSvelocityEnum);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	element->GetVerticesCoordinatesBase(&xyz_list_tria);
++	element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
++	Input* vx_input=  element->GetInput(VxEnum);   _assert_(vx_input);
++	Input* vy_input=  element->GetInput(VyEnum);   _assert_(vy_input);
++	Input* vz_input=  element->GetInput(VzEnum);   _assert_(vz_input);
++	Input* vzHO_input=element->GetInput(VzHOEnum); _assert_(vzHO_input);
++
++	/*build friction object, used later on: */
++	Friction* friction=new Friction(element,3);
++
++	/* Start looping on the number of gauss 2d (nodes on the bedrock) */
++	Gauss* gauss=element->NewGaussBase(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminantBase(&Jdet2d,xyz_list_tria,gauss);
++		element->NodalFunctionsP1(basis, gauss);
++
++		vzHO_input->GetInputValue(&w, gauss);
++		vzHO_input->GetInputDerivativeValue(&dw[0],xyz_list,gauss);
++
++		element->NormalBase(&bed_normal[0],xyz_list_tria);
++		element->ViscosityFS(&viscosity,xyz_list,gauss,vx_input,vy_input,vz_input);
++		friction->GetAlpha2(&alpha2_gauss, gauss,vx_input,vy_input,vz_input);
++
++		for(i=0;i<3;i++){
++			pe->values[i*3+0]+=Jdet2d*gauss->weight*(alpha2_gauss*w*bed_normal[0]*bed_normal[2]+2*viscosity*dw[2]*bed_normal[0])*basis[i];
++			pe->values[i*3+1]+=Jdet2d*gauss->weight*(alpha2_gauss*w*bed_normal[1]*bed_normal[2]+2*viscosity*dw[2]*bed_normal[1])*basis[i];
++			pe->values[i*3+2]+=Jdet2d*gauss->weight*2*viscosity*(dw[0]*bed_normal[0]+dw[1]*bed_normal[1]+dw[2]*bed_normal[2])*basis[i];
++		}
++	}
++
++	/*Transform coordinate system*/
++	element->TransformLoadVectorCoord(pe,node_list,vnumnodes+pnumnodes,cs_list);
++
++	pe->Echo();
++	element->CreatePVector();
++	/*Clean up and return*/
++	xDelete<int>(cs_list);
++	xDelete<Node*>(node_list);
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(xyz_list_tria);
++	delete gauss;
++	delete friction;
++	return pe;
++}/*}}}*/
++ElementVector* StressbalanceAnalysis::CreatePVectorCouplingHOFSViscous(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	int         i,approximation;
++	IssmDouble  viscosity,Jdet,FSreconditioning;
++	IssmDouble  dw[3];
++	IssmDouble  *xyz_list = NULL;
++	IssmDouble  basis[6]; //for the six nodes of the penta
++	IssmDouble  dbasis[3][6]; //for the six nodes of the penta
++
++	/*Initialize Element vector and return if necessary*/
++	element->GetInputValue(&approximation,ApproximationEnum);
++	if(approximation!=HOFSApproximationEnum) return NULL;
++	int   vnumnodes = element->GetNumberOfNodesVelocity();
++	int   pnumnodes = element->GetNumberOfNodesPressure();
++
++	/*Prepare coordinate system list*/
++	int*   cs_list   = xNew<int>(vnumnodes+pnumnodes);
++	Node **node_list = xNew<Node*>(vnumnodes+pnumnodes);
++	for(i=0;i<vnumnodes;i++){
++		cs_list[i]             = XYZEnum;
++		node_list[i]           = element->GetNode(i);
++	}
++	for(i=0;i<pnumnodes;i++){
++		cs_list[vnumnodes+i]   = PressureEnum;
++		node_list[vnumnodes+i] = element->GetNode(vnumnodes+i);
++	}
++	ElementVector* pe = element->NewElementVector(FSvelocityEnum);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
++	Input* vx_input   =element->GetInput(VxEnum);   _assert_(vx_input);
++	Input* vy_input   =element->GetInput(VyEnum);   _assert_(vy_input);
++	Input* vz_input   =element->GetInput(VzEnum);   _assert_(vz_input);
++	Input* vzHO_input=element->GetInput(VzHOEnum);  _assert_(vzHO_input);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(5);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet, xyz_list,gauss);
++		element->NodalFunctionsP1(&basis[0],gauss);
++		element->NodalFunctionsP1Derivatives(&dbasis[0][0],xyz_list,gauss);
++		
++		element->ViscosityFS(&viscosity,xyz_list,gauss,vx_input,vy_input,vz_input);
++		vzHO_input->GetInputDerivativeValue(&dw[0],xyz_list,gauss);
++
++		for(i=0;i<vnumnodes;i++){
++			pe->values[i*3+0]+=-Jdet*gauss->weight*viscosity*dw[0]*dbasis[2][i];
++			pe->values[i*3+1]+=-Jdet*gauss->weight*viscosity*dw[1]*dbasis[2][i];
++			pe->values[i*3+2]+=-Jdet*gauss->weight*viscosity*(dw[0]*dbasis[0][i]+dw[1]*dbasis[1][i]+2*dw[2]*dbasis[2][i]);
++			pe->values[3*vnumnodes+i]+=Jdet*gauss->weight*FSreconditioning*dw[2]*basis[i];
++		}
++	}
++
++	/*Transform coordinate system*/
++	element->TransformLoadVectorCoord(pe,node_list,vnumnodes+pnumnodes,cs_list);
++
++	/*Clean up and return*/
++	xDelete<int>(cs_list);
++	xDelete<Node*>(node_list);
++	xDelete<IssmDouble>(xyz_list);
++	delete gauss;
++	return pe;
++}/*}}}*/
++
+ void StressbalanceAnalysis::GetBSSAHO(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 3*NDOF2. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16925)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16926)
+@@ -76,6 +76,7 @@
+ 		void       TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list);
+ 		void       TransformLoadVectorCoord(ElementVector* pe,int numnodes,int transformenum){_error_("not implemented yet");};      /*Tiling only*/
+ 		void       TransformLoadVectorCoord(ElementVector* pe,int numnodes,int* transformenum_list){_error_("not implemented yet");};      /*Tiling only*/
++		void       TransformLoadVectorCoord(ElementVector* pe,Node** nodes_list,int numnodes,int* transformenum_list);
+ 		void       TransformSolutionCoord(IssmDouble* values,int transformenum);
+ 		void       TransformSolutionCoord(IssmDouble* values,int* transformenum_list);
+ 		void       TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum);
+@@ -105,9 +106,11 @@
+ 		virtual int    FiniteElement(void)=0;
+ 		virtual IssmDouble MinEdgeLength(IssmDouble* xyz_list)=0;
+ 		virtual void   NodalFunctions(IssmDouble* basis,Gauss* gauss)=0;
++		virtual void   NodalFunctionsP1(IssmDouble* basis,Gauss* gauss)=0;
+ 		virtual void   NodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss)=0;
+ 		virtual void   NodalFunctionsPressure(IssmDouble* basis, Gauss* gauss)=0;
+ 		virtual void   NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss)=0;
++		virtual void   NodalFunctionsP1Derivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss)=0;
+ 		virtual void   NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss)=0;
+ 		virtual void   NormalSection(IssmDouble* normal,IssmDouble* xyz_list)=0;
+ 		virtual void   NormalTop(IssmDouble* normal,IssmDouble* xyz_list)=0;
+@@ -192,6 +195,7 @@
+ 	   virtual Element*   SpawnBasalElement(void)=0;
+ 		virtual void   ReduceMatrices(ElementMatrix* Ke,ElementVector* pe)=0;
+ 		virtual void   ResetCoordinateSystem()=0;
++		virtual void   SetTemporaryElementType(int element_type_in)=0;
+ 		virtual IssmDouble StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa)=0;
+ 		virtual void   ValueP1OnGauss(IssmDouble* pvalue,IssmDouble* values,Gauss* gauss)=0;
+ 		virtual void   ValueP1DerivativesOnGauss(IssmDouble* dvalue,IssmDouble* values,IssmDouble* xyz_list,Gauss* gauss)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16925)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16926)
+@@ -287,11 +287,14 @@
+ 		ElementVector* NewElementVector(int approximation_enum);
+ 		ElementMatrix* NewElementMatrix(int approximation_enum);
+ 		void           NodalFunctions(IssmDouble* basis,Gauss* gauss);
++		void           NodalFunctionsP1(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+ 		void           NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
++		void           NodalFunctionsP1Derivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void           NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+ 		void           NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss);
+ 		void           NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss);
+ 		void	         SetClone(int* minranks);
++		void           SetTemporaryElementType(int element_type_in){_error_("not implemented yet");};
+ 		Seg*	         SpawnSeg(int index1,int index2);
+ 		IssmDouble     StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa){_error_("not implemented yet");};
+ 		void           ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16925)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16926)
+@@ -2505,6 +2505,14 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Penta::NodalFunctionsP1{{{*/
++void Penta::NodalFunctionsP1(IssmDouble* basis, Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussPentaEnum);
++	this->GetNodalFunctionsP1(basis,(GaussPenta*)gauss);
++
++}
++/*}}}*/
+ /*FUNCTION Penta::NodalFunctionsDerivatives{{{*/
+ void Penta::NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){
+ 
+@@ -2513,6 +2521,14 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Penta::NodalFunctionsP1Derivatives{{{*/
++void Penta::NodalFunctionsP1Derivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussPentaEnum);
++	this->GetNodalFunctionsP1Derivatives(dbasis,xyz_list,(GaussPenta*)gauss);
++
++}
++/*}}}*/
+ /*FUNCTION Penta::NodalFunctionsDerivativesVelocity{{{*/
+ void Penta::NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){
+ 
+@@ -2848,6 +2864,11 @@
+ 	else this->nodes=NULL;
+ }
+ /*}}}*/
++/*FUNCTION Penta::SetTemporaryElementType{{{*/
++void Penta::SetTemporaryElementType(int element_type_in){
++	this->element_type=element_type_in;
++}
++/*}}}*/
+ /*FUNCTION Penta::SetwiseNodeConnectivity{{{*/
+ void Penta::SetwiseNodeConnectivity(int* pd_nz,int* po_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum){
+ 
+@@ -8233,6 +8254,8 @@
+ 	/*Transform coordinate system*/
+ 	::TransformLoadVectorCoord(pe,nodes,vnumnodes+pnumnodes,cs_list);
+ 
++	pe->Echo();
++	_error_("stop");
+ 	/*Clean up and return*/
+ 	xDelete<int>(cs_list);
+ 	delete gauss;
+@@ -8395,6 +8418,7 @@
+ 
+ 	/*compute all load vectors for this element*/
+ 	int init = this->element_type;
++	printf("init init %i\n",init);
+ 	this->element_type=P1Enum;
+ 	ElementVector* pe1=CreatePVectorStressbalanceHO();
+ 	this->element_type=init;
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16925)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16926)
+@@ -114,6 +114,7 @@
+ 		void   ReduceMatrices(ElementMatrix* Ke,ElementVector* pe);
+ 		void   ResetCoordinateSystem(void);
+ 		void   SmbGradients();
++		void   SetTemporaryElementType(int element_type_in);
+ 	   Element* SpawnBasalElement(void);
+ 		IssmDouble SurfaceArea(void);
+ 		void   Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement);
+@@ -256,7 +257,9 @@
+ 		ElementVector* NewElementVector(int approximation_enum);
+ 		ElementMatrix* NewElementMatrix(int approximation_enum);
+ 		void           NodalFunctions(IssmDouble* basis,Gauss* gauss);
++		void           NodalFunctionsP1(IssmDouble* basis,Gauss* gauss);
+ 		void           NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
++		void           NodalFunctionsP1Derivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+ 		void           NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+ 		void           NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss);
+ 		void           NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16925)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16926)
+@@ -107,9 +107,11 @@
+ 		void        JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
+ 		IssmDouble  MinEdgeLength(IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		void        NodalFunctions(IssmDouble* basis,Gauss* gauss);
++		void        NodalFunctionsP1(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
++		void        NodalFunctionsP1Derivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		bool        NoIceInElement(){_error_("not implemented yet");};
+ 		void        NormalSection(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+@@ -180,6 +182,7 @@
+ 		void        ResultToVector(Vector<IssmDouble>* vector,int output_enum){_error_("not implemented");};
+ 		void        ResetCoordinateSystem(void){_error_("not implemented yet");};
+ 		void        ReduceMatrices(ElementMatrix* Ke,ElementVector* pe){_error_("not implemented yet");};
++		void        SetTemporaryElementType(int element_type_in){_error_("not implemented yet");};
+ 		void	      SmbGradients(){_error_("not implemented yet");};
+ 		IssmDouble  SurfaceArea(void){_error_("not implemented yet");};
+ 		void        Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 16925)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 16926)
+@@ -313,6 +313,9 @@
+ void Element::TransformSolutionCoord(IssmDouble* values,int numnodes,int* transformenum_list){/*{{{*/
+ 	::TransformSolutionCoord(values,this->nodes,numnodes,transformenum_list);
+ }/*}}}*/
++void Element::TransformLoadVectorCoord(ElementVector* Ke,Node** nodes_list,int numnodes,int* transformenum_list){/*{{{*/
++	::TransformLoadVectorCoord(Ke,nodes_list,numnodes,transformenum_list);
++}/*}}}*/
+ void Element::TransformStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum){/*{{{*/
+ 	::TransformStiffnessMatrixCoord(Ke,this->nodes,this->GetNumberOfNodes(),transformenum);
+ }/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16926-16927.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16926-16927.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16926-16927.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/jenkins/windows
+===================================================================
+--- ../trunk-jpl/jenkins/windows	(revision 16926)
++++ ../trunk-jpl/jenkins/windows	(revision 16927)
+@@ -87,7 +87,7 @@
+ 
+ #number of cpus used in ISSM installation and compilation (one is usually
+ #safer as some packages are very sensitive to parallel compilation)
+-NUMCPUS_INSTALL=8
++NUMCPUS_INSTALL=16
+ 
+ #number of cpus used in the nightly runs.
+ NUMCPUS_RUN=8
Index: issm/oecreview/Archive/16554-17801/ISSM-16927-16928.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16927-16928.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16927-16928.diff	(revision 17802)
@@ -0,0 +1,30 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16927)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16928)
+@@ -3363,7 +3363,7 @@
+ 		vzHO_input->GetInputDerivativeValue(&dw[0],xyz_list,gauss);
+ 
+ 		element->NormalBase(&bed_normal[0],xyz_list_tria);
+-		element->ViscosityFS(&viscosity,xyz_list,gauss,vx_input,vy_input,vz_input);
++		element->ViscosityFS(&viscosity,3,xyz_list,gauss,vx_input,vy_input,vz_input);
+ 		friction->GetAlpha2(&alpha2_gauss, gauss,vx_input,vy_input,vz_input);
+ 
+ 		for(i=0;i<3;i++){
+@@ -3434,7 +3434,7 @@
+ 		element->NodalFunctionsP1(&basis[0],gauss);
+ 		element->NodalFunctionsP1Derivatives(&dbasis[0][0],xyz_list,gauss);
+ 		
+-		element->ViscosityFS(&viscosity,xyz_list,gauss,vx_input,vy_input,vz_input);
++		element->ViscosityFS(&viscosity,3,xyz_list,gauss,vx_input,vy_input,vz_input);
+ 		vzHO_input->GetInputDerivativeValue(&dw[0],xyz_list,gauss);
+ 
+ 		for(i=0;i<vnumnodes;i++){
+@@ -3455,7 +3455,6 @@
+ 	delete gauss;
+ 	return pe;
+ }/*}}}*/
+-
+ void StressbalanceAnalysis::GetBSSAHO(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 3*NDOF2. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
Index: issm/oecreview/Archive/16554-17801/ISSM-16928-16929.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16928-16929.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16928-16929.diff	(revision 17802)
@@ -0,0 +1,38 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16928)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16929)
+@@ -3307,6 +3307,7 @@
+ 
+ 	/*Intermediaries*/
+ 	int         i,j,approximation;
++	int         dim=3;
+ 	IssmDouble  Jdet,Jdet2d,FSreconditioning;
+ 	IssmDouble	bed_normal[3];
+ 	IssmDouble  viscosity, w, alpha2_gauss;
+@@ -3363,7 +3364,7 @@
+ 		vzHO_input->GetInputDerivativeValue(&dw[0],xyz_list,gauss);
+ 
+ 		element->NormalBase(&bed_normal[0],xyz_list_tria);
+-		element->ViscosityFS(&viscosity,3,xyz_list,gauss,vx_input,vy_input,vz_input);
++		element->ViscosityFS(&viscosity,dim,xyz_list,gauss,vx_input,vy_input,vz_input);
+ 		friction->GetAlpha2(&alpha2_gauss, gauss,vx_input,vy_input,vz_input);
+ 
+ 		for(i=0;i<3;i++){
+@@ -3391,6 +3392,7 @@
+ 
+ 	/*Intermediaries */
+ 	int         i,approximation;
++	int         dim=3;
+ 	IssmDouble  viscosity,Jdet,FSreconditioning;
+ 	IssmDouble  dw[3];
+ 	IssmDouble  *xyz_list = NULL;
+@@ -3434,7 +3436,7 @@
+ 		element->NodalFunctionsP1(&basis[0],gauss);
+ 		element->NodalFunctionsP1Derivatives(&dbasis[0][0],xyz_list,gauss);
+ 		
+-		element->ViscosityFS(&viscosity,3,xyz_list,gauss,vx_input,vy_input,vz_input);
++		element->ViscosityFS(&viscosity,dim,xyz_list,gauss,vx_input,vy_input,vz_input);
+ 		vzHO_input->GetInputDerivativeValue(&dw[0],xyz_list,gauss);
+ 
+ 		for(i=0;i<vnumnodes;i++){
Index: issm/oecreview/Archive/16554-17801/ISSM-16929-16930.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16929-16930.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16929-16930.diff	(revision 17802)
@@ -0,0 +1,12 @@
+
+Property changes on: ../trunk-jpl/externalpackages/shell2junit
+___________________________________________________________________
+Name: svn:ignore
+   - install
+src
+
+   + compil.log
+install
+src
+
+
Index: issm/oecreview/Archive/16554-17801/ISSM-16930-16931.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16930-16931.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16930-16931.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16930)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16931)
+@@ -8254,8 +8254,6 @@
+ 	/*Transform coordinate system*/
+ 	::TransformLoadVectorCoord(pe,nodes,vnumnodes+pnumnodes,cs_list);
+ 
+-	pe->Echo();
+-	_error_("stop");
+ 	/*Clean up and return*/
+ 	xDelete<int>(cs_list);
+ 	delete gauss;
Index: issm/oecreview/Archive/16554-17801/ISSM-16931-16932.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16931-16932.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16931-16932.diff	(revision 17802)
@@ -0,0 +1,25 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16931)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16932)
+@@ -3377,8 +3377,6 @@
+ 	/*Transform coordinate system*/
+ 	element->TransformLoadVectorCoord(pe,node_list,vnumnodes+pnumnodes,cs_list);
+ 
+-	pe->Echo();
+-	element->CreatePVector();
+ 	/*Clean up and return*/
+ 	xDelete<int>(cs_list);
+ 	xDelete<Node*>(node_list);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16931)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16932)
+@@ -8416,7 +8416,6 @@
+ 
+ 	/*compute all load vectors for this element*/
+ 	int init = this->element_type;
+-	printf("init init %i\n",init);
+ 	this->element_type=P1Enum;
+ 	ElementVector* pe1=CreatePVectorStressbalanceHO();
+ 	this->element_type=init;
Index: issm/oecreview/Archive/16554-17801/ISSM-16932-16933.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16932-16933.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16932-16933.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/jenkins/windows
+===================================================================
+--- ../trunk-jpl/jenkins/windows	(revision 16932)
++++ ../trunk-jpl/jenkins/windows	(revision 16933)
+@@ -87,7 +87,7 @@
+ 
+ #number of cpus used in ISSM installation and compilation (one is usually
+ #safer as some packages are very sensitive to parallel compilation)
+-NUMCPUS_INSTALL=16
++NUMCPUS_INSTALL=8
+ 
+ #number of cpus used in the nightly runs.
+ NUMCPUS_RUN=8
Index: issm/oecreview/Archive/16554-17801/ISSM-16933-16934.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16933-16934.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16933-16934.diff	(revision 17802)
@@ -0,0 +1,25 @@
+Index: ../trunk-jpl/jenkins/execute_shell
+===================================================================
+--- ../trunk-jpl/jenkins/execute_shell	(revision 16933)
++++ ../trunk-jpl/jenkins/execute_shell	(revision 16934)
+@@ -3,14 +3,18 @@
+ #some exports required
+ export ISSM_DIR="$WORKSPACE"
+ 
+-#which configuration are we using? 
+-case $Platform in 
++#which configuration are we using?
++case $Platform in
+ 	master )
+ 		configfile=linux64_murdo ;;
+ 	imac-012301-gil )
+ 		configfile=imac-012301-gil ;;
+ 	larsen )
+ 		configfile=linux64_larsen ;;
++	windows )
++		configfile=windows
++		export PATH=/cygdrive/c/Cygwin/usr/bin:/cygdrive/c/Cygwin/bin:$PATH ;;
++
+ esac
+ 
+ #run
Index: issm/oecreview/Archive/16554-17801/ISSM-16934-16935.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16934-16935.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16934-16935.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/jenkins/windows
+===================================================================
+--- ../trunk-jpl/jenkins/windows	(revision 16934)
++++ ../trunk-jpl/jenkins/windows	(revision 16935)
+@@ -90,7 +90,7 @@
+ NUMCPUS_INSTALL=8
+ 
+ #number of cpus used in the nightly runs.
+-NUMCPUS_RUN=8
++NUMCPUS_RUN=1
+ 
+ #Nightly run options. The matlab routine runme.m will be called
+ #as follows: runme($MATLAB_NROPTIONS). The options must be understandable
Index: issm/oecreview/Archive/16554-17801/ISSM-16935-16936.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16935-16936.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16935-16936.diff	(revision 17802)
@@ -0,0 +1,173 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16935)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16936)
+@@ -70,7 +70,9 @@
+ 		void GetSolutionFromInputsFS(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolutionFS(IssmDouble* solution,Element* element);
+ 		/*Coupling*/
++		ElementMatrix* CreateKMatrixHOFS(Element* element);
+ 		ElementMatrix* CreateKMatrixSSAHO(Element* element);
++		ElementMatrix* CreateKMatrixCouplingHOFS(Element* element);
+ 		ElementMatrix* CreateKMatrixCouplingSSAHO(Element* element);
+ 		ElementMatrix* CreateKMatrixCouplingSSAHOFriction(Element* element);
+ 		ElementMatrix* CreateKMatrixCouplingSSAHOViscous(Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16935)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16936)
+@@ -827,6 +827,8 @@
+ 			return CreateKMatrixFS(element);
+ 		case SSAHOApproximationEnum: 
+ 			return CreateKMatrixSSAHO(element);
++		case HOFSApproximationEnum: 
++			return CreateKMatrixHOFS(element);
+ 		case NoneApproximationEnum:
+ 			return NULL;
+ 		default:
+@@ -3064,6 +3066,25 @@
+ }/*}}}*/
+ 
+ /*Coupling (Tiling)*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixHOFS(Element* element){/*{{{*/
++
++	/*compute all stiffness matrices for this element*/
++	ElementMatrix* Ke1=CreateKMatrixFS(element);
++	int indices[3]={18,19,20};
++	Ke1->StaticCondensation(3,&indices[0]);
++	int init = element->FiniteElement();
++	element->SetTemporaryElementType(P1Enum); // P1 needed for HO
++	ElementMatrix* Ke2=CreateKMatrixHO(element);
++	element->SetTemporaryElementType(init); // P1 needed for HO
++	ElementMatrix* Ke3=CreateKMatrixCouplingHOFS(element);
++	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2,Ke3);
++
++	/*clean-up and return*/
++	delete Ke1;
++	delete Ke2;
++	delete Ke3;
++	return Ke;
++}/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSAHO(Element* element){/*{{{*/
+ 
+ 	/*compute all stiffness matrices for this element*/
+@@ -3078,6 +3099,72 @@
+ 	delete Ke3;
+ 	return Ke;
+ }/*}}}*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixCouplingHOFS(Element* element){/*{{{*/
++
++	/*Constants*/
++	int numnodes       = 3*6+1;
++	int numdofp        = 2*6;
++	int numdofs        = 4*6 + 3;
++	int numdoftotal    = (2+4)*6+ 3;
++
++	/*Intermediaries*/
++	int   i,j,init;
++	int*   cs_list   = xNew<int>(6*3+1);
++	int*   cs_list2  = xNew<int>(6*2+1);
++	Node  **node_list = xNew<Node*>(6*3+1);
++
++	/*Some parameters needed*/
++	init = element->FiniteElement();
++
++	/*prepare node list*/
++	for(i=0;i<6+1;i++){
++		node_list[i+6] = element->GetNode(i);
++		cs_list[i+6]   = XYZEnum;
++		cs_list2[i]    = XYZEnum;
++	}
++	for(i=0;i<6;i++){
++		node_list[i]       = element->GetNode(i);
++		node_list[i+2*6+1] = element->GetNode(i+6*1);
++		cs_list[i]         = XYEnum;
++		cs_list[i+2*6+1]   = PressureEnum;
++		cs_list2[i+6+1]    = PressureEnum;
++	}
++
++	/*compute all stiffness matrices for this element*/
++	ElementMatrix* Ke1=element->NewElementMatrix(FSvelocityEnum);
++	ElementMatrix* Ke2=element->NewElementMatrix(HOApproximationEnum);
++	ElementMatrix* Ke=new ElementMatrix(Ke1,Ke2);
++	delete Ke1; delete Ke2;
++
++	/*Compute HO Matrix with P1 element type\n");*/
++	Ke1=CreateKMatrixFS(element); element->TransformInvStiffnessMatrixCoord(Ke1,node_list,2*6+1,cs_list2);
++	int indices[3]={18,19,20};
++	Ke1->StaticCondensation(3,&indices[0]);
++	element->SetTemporaryElementType(P1Enum); // P1 needed for HO
++	Ke2=CreateKMatrixHO(element); element->TransformInvStiffnessMatrixCoord(Ke2,XYEnum);
++	element->SetTemporaryElementType(init); // P1 needed for HO
++	/*Compute FS Matrix and condense it \n");*/
++
++	for(i=0;i<numdofs;i++) for(j=0;j<6;j++){
++		Ke->values[i*numdoftotal+numdofs+2*j+0]+=Ke1->values[i*numdofs+3*j+0];
++		Ke->values[i*numdoftotal+numdofs+2*j+1]+=Ke1->values[i*numdofs+3*j+1];
++	}
++	for(i=0;i<numdofp;i++) for(j=0;j<6;j++){
++		Ke->values[(i+numdofs)*numdoftotal+3*j+0]+=Ke2->values[i*numdofp+2*j+0];
++		Ke->values[(i+numdofs)*numdoftotal+3*j+1]+=Ke2->values[i*numdofp+2*j+1];
++	}
++
++	/*Transform Coordinate System*/ //Do not transform, already done in the matrices
++	element->TransformStiffnessMatrixCoord(Ke,node_list,numnodes,cs_list);
++
++	/*clean-up and return*/
++	xDelete<int>(cs_list);
++	xDelete<int>(cs_list2);
++	xDelete<Node*>(node_list);
++	delete Ke1;
++	delete Ke2;
++	return Ke;
++}/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixCouplingSSAHO(Element* element){/*{{{*/
+ 
+ 	/*compute all stiffness matrices for this element*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16935)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16936)
+@@ -72,6 +72,8 @@
+ 		void       ViscositySSADerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon);
+ 		void       ViscosityHODerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon);
+ 		void       ViscosityFSDerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon);
++		void       TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum);
++		void       TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes_list,int numnodes,int* transformenum_list);
+ 		void       TransformLoadVectorCoord(ElementVector* pe,int transformenum);
+ 		void       TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list);
+ 		void       TransformLoadVectorCoord(ElementVector* pe,int numnodes,int transformenum){_error_("not implemented yet");};      /*Tiling only*/
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16935)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16936)
+@@ -7053,10 +7053,10 @@
+ 
+ 	/*Compute HO Matrix with P1 element type\n");*/
+ 	this->element_type=P1Enum;
+-	Ke1=CreateKMatrixStressbalanceHO(); TransformInvStiffnessMatrixCoord(Ke1,this->nodes,NUMVERTICES,XYEnum);
++	Ke1=CreateKMatrixStressbalanceHO(); TransformInvStiffnessMatrixCoord(Ke1,XYEnum);
+ 	this->element_type=init;
+ 	/*Compute FS Matrix and condense it \n");*/
+-	Ke2=CreateKMatrixStressbalanceFS(); TransformInvStiffnessMatrixCoord(Ke2,this->nodes,2*NUMVERTICES+1,cs_list2);
++	Ke2=CreateKMatrixStressbalanceFS(); TransformInvStiffnessMatrixCoord(Ke2,node_list,2*NUMVERTICES+1,cs_list2);
+ 	int indices[3]={18,19,20};
+ 	Ke2->StaticCondensation(3,&indices[0]);
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 16935)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 16936)
+@@ -295,6 +295,12 @@
+ 	/*Sum all contributions*/
+ 	for(i=0;i<3;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i];
+ }/*}}}*/
++void Element::TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum){/*{{{*/
++	::TransformInvStiffnessMatrixCoord(Ke,this->nodes,this->GetNumberOfNodes(),transformenum);
++}/*}}}*/
++void Element::TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes_list,int numnodes,int* transformenum_list){/*{{{*/
++	::TransformInvStiffnessMatrixCoord(Ke,nodes_list,numnodes,transformenum_list);
++}/*}}}*/
+ void Element::TransformLoadVectorCoord(ElementVector* pe,int transformenum){/*{{{*/
+ 	::TransformLoadVectorCoord(pe,this->nodes,this->GetNumberOfNodes(),transformenum);
+ }/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16936-16937.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16936-16937.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16936-16937.diff	(revision 17802)
@@ -0,0 +1,20 @@
+Index: ../trunk-jpl/test/NightlyRun/runme.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/runme.m	(revision 16936)
++++ ../trunk-jpl/test/NightlyRun/runme.m	(revision 16937)
+@@ -231,7 +231,6 @@
+ 				catch me2
+ 
+ 					%something went wrong, print failure message:
+-					directory=strsplit(pwd,'/');
+ 					message=getReport(me2);
+ 					if strcmpi(output,'nightly')
+ 						fid=fopen([ISSM_DIR '/nightlylog/matlaberror.log'], 'at');
+@@ -259,7 +258,6 @@
+ 	catch me,
+ 
+ 		%something went wrong, print failure message:
+-		directory=strsplit(pwd,'/');
+ 		message=getReport(me);
+ 		if strcmpi(output,'nightly')
+ 			fid=fopen([ISSM_DIR '/nightlylog/matlaberror.log'], 'at');
Index: issm/oecreview/Archive/16554-17801/ISSM-16937-16938.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16937-16938.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16937-16938.diff	(revision 17802)
@@ -0,0 +1,390 @@
+Index: ../trunk-jpl/test/NightlyRun/test511.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test511.py	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test511.py	(revision 16938)
+@@ -38,7 +38,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Gradient','Misfits','MaterialsRheologyB','Pressure','Vel','Vx','Vy']
+-field_tolerances=[1e-11,1e-12,1e-12,1e-09,1e-12,1e-12,1e-12,1e-12,1e-12,1e-12]
++field_tolerances=[1e-11,5e-12,1e-11,1e-09,2e-12,5e-12,2e-12]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Gradient1,\
+ 	md.results.StressbalanceSolution.J,\
+Index: ../trunk-jpl/test/NightlyRun/test426.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test426.m	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test426.m	(revision 16938)
+@@ -23,8 +23,8 @@
+ 	'Bed2','Surface2','Thickness2','Floatingice2','IceVolume2','IceVolumeAboveFloatation2',...
+ 	'Bed3','Surface3','Thickness3','Floatingice3','IceVolume3','IceVolumeAboveFloatation3'};
+ field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+-	1e-11,1e-10,1e-11,1.25e-11,1e-13,1e-13,...
+-	1e-10,1e-10,1e-10,1.15e-11,1e-13,1e-13};
++	1e-11,1e-10,1e-11,1.25e-11,5e-13,2e-12,...
++	1e-10,1e-10,1e-10,2e-11,5e-13,2e-12};
+ field_values={...
+ 	(md.results.TransientSolution(1).Bed),...
+ 	(md.results.TransientSolution(1).Surface),...
+Index: ../trunk-jpl/test/NightlyRun/test410.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test410.m	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test410.m	(revision 16938)
+@@ -9,7 +9,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure','Temperature','BasalforcingsMeltingRate'};
+-field_tolerances={1e-09,1e-09,1e-08,2e-10,1e-13,1e-10,1e-06};
++field_tolerances={1e-09,1e-09,1e-08,2e-10,1e-13,2e-10,1e-06};
+ field_values={...
+ 	(md.results.SteadystateSolution.Vx),...
+ 	(md.results.SteadystateSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test610.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test610.py	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test610.py	(revision 16938)
+@@ -18,7 +18,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Thickness']
+-field_tolerances=[1e-13]
++field_tolerances=[1e-12]
+ field_values=[\
+ 	md.results.BalancethicknessSolution.Thickness,\
+ 	]
+Index: ../trunk-jpl/test/NightlyRun/test215.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test215.m	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test215.m	(revision 16938)
+@@ -22,7 +22,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Gradient','Misfits','MaterialsRheologyBbar','Pressure','Vel','Vx','Vy'};
+-field_tolerances={1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,3e-09,1e-09};
++field_tolerances={1e-08,1e-09,2e-09,1e-09,2e-09,5e-09,2e-09};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Gradient1),...
+ 	(md.results.StressbalanceSolution.J),...
+Index: ../trunk-jpl/test/NightlyRun/test501.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test501.m	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test501.m	(revision 16938)
+@@ -7,7 +7,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vel','Pressure'};
+-field_tolerances={1e-13,1e-13,1e-13,1e-13};
++field_tolerances={1e-12,2e-12,2e-12,1e-13};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test119.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test119.py	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test119.py	(revision 16938)
+@@ -22,7 +22,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['x1','y1','x2','y2','nbelements','elapsed time']
+-field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1.5]
++field_tolerances=[2e-9,2e-9,1e-13,1e-13,1e-13,1.5]
+ field_values=[\
+ 	x1, y1,\
+ 	x2, y2,\
+Index: ../trunk-jpl/test/NightlyRun/test322.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test322.m	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test322.m	(revision 16938)
+@@ -22,7 +22,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Gradient','Misfits','FrictionCoefficient','Pressure','Vel','Vx','Vy'};
+-field_tolerances={1e-06,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09};
++field_tolerances={1e-06,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,2e-09,2e-09,2e-09};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Gradient1),...
+ 	(md.results.StressbalanceSolution.J),...
+Index: ../trunk-jpl/test/NightlyRun/test504.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test504.py	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test504.py	(revision 16938)
+@@ -16,7 +16,7 @@
+ 
+ # Fields and tolerances to track changes
+ field_names     =['Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2']
+-field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
++field_tolerances=[1e-12,2e-12,2e-12,1e-13,1e-13,1e-13,1e-13,1e-12,1e-12,1e-12,1e-13,1e-13,1e-13,1e-13]
+ field_values=[\
+ 	md.results.TransientSolution[0].Vx,\
+ 	md.results.TransientSolution[0].Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test423.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test423.py	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test423.py	(revision 16938)
+@@ -57,5 +57,5 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['ElementOnIceShelfAgressive','VelAgressive','ElementOnIceShelfSoft','VelSoft','ElementOnIceShelfSubelement','VelSubelement','ElementOnIceShelfSubelement2','VelSubelement2']
+-field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
++field_tolerances=[1e-13,2e-13,1e-13,2e-13,1e-13,2e-13,1e-13,2e-13]
+ field_values=[element_on_iceshelf_agressive,vel_agressive,element_on_iceshelf_soft,vel_soft,element_on_iceshelf_subelement,vel_subelement,element_on_iceshelf_subelement2,vel_subelement2]
+Index: ../trunk-jpl/test/NightlyRun/test608.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test608.py	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test608.py	(revision 16938)
+@@ -17,7 +17,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Thickness']
+-field_tolerances=[1e-13]
++field_tolerances=[1e-12]
+ field_values=[\
+ 	md.results.BalancethicknessSolution.Thickness,\
+ 	]
+Index: ../trunk-jpl/test/NightlyRun/test608.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test608.m	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test608.m	(revision 16938)
+@@ -7,7 +7,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Thickness'};
+-field_tolerances={1e-13};
++field_tolerances={1e-12};
+ field_values={...
+ 	(md.results.BalancethicknessSolution.Thickness),...
+ 	};
+Index: ../trunk-jpl/test/NightlyRun/test415.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test415.py	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test415.py	(revision 16938)
+@@ -35,7 +35,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Gradient','Misfits','FrictionCoefficient','Pressure','Vel','Vx','Vy','Vz','Temperature','BasalforcingsMeltingRate']
+-field_tolerances=[1e-10,1e-9,1e-10,1e-13,1e-09,1e-09,1e-09,1e-8,1e-09,1e-6]
++field_tolerances=[5e-10,1e-9,1e-10,1e-13,1e-09,1e-09,1e-09,1e-8,1e-09,1e-6]
+ field_values=[\
+ 	md.results.SteadystateSolution.Gradient1,\
+ 	md.results.SteadystateSolution.J,\
+Index: ../trunk-jpl/test/NightlyRun/test511.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test511.m	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test511.m	(revision 16938)
+@@ -27,7 +27,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Gradient','Misfits','MaterialsRheologyB','Pressure','Vel','Vx','Vy'};
+-field_tolerances={1e-11,1e-12,1e-12,1e-09,1e-12,1e-12,1e-12,1e-12,1e-12,1e-12};
++field_tolerances={1e-11,5e-12,1e-11,1e-09,2e-12,5e-12,2e-12};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Gradient1),...
+ 	(md.results.StressbalanceSolution.J),...
+Index: ../trunk-jpl/test/NightlyRun/test119.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test119.m	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test119.m	(revision 16938)
+@@ -17,7 +17,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'x1','y1','x2','y2','nbelements','elapsed time'};
+-field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1.5};
++field_tolerances={2e-9,2e-9,1e-13,1e-13,1e-13,1.5};
+ field_values={...
+ 	x1, y1,...
+ 	x2, y2,...
+Index: ../trunk-jpl/test/NightlyRun/test410.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test410.py	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test410.py	(revision 16938)
+@@ -19,7 +19,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Vx','Vy','Vz','Vel','Pressure','Temperature','BasalforcingsMeltingRate']
+-field_tolerances=[1e-09,1e-09,1e-08,1e-09,1e-13,1e-10,1e-06]
++field_tolerances=[1e-09,1e-09,1e-08,1e-09,1e-13,2e-10,1e-06]
+ field_values=[\
+ 	md.results.SteadystateSolution.Vx,\
+ 	md.results.SteadystateSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test514.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test514.py	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test514.py	(revision 16938)
+@@ -54,7 +54,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['x1','y1','x2','y2','x3','y3','x4','y4','x5','y5','x6','y6','x7','y7']
+-field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
++field_tolerances = [2e-10,7e-10,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
+ field_values=[\
+ 	x1, y1,\
+ 	y2, y2,\
+Index: ../trunk-jpl/test/NightlyRun/test610.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test610.m	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test610.m	(revision 16938)
+@@ -8,7 +8,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Thickness'};
+-field_tolerances={1e-13};
++field_tolerances={1e-12};
+ field_values={...
+ 	(md.results.BalancethicknessSolution.Thickness),...
+ 	};
+Index: ../trunk-jpl/test/NightlyRun/test423.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test423.m	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test423.m	(revision 16938)
+@@ -46,5 +46,5 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'ElementOnIceShelfAgressive','VelAgressive','ElementOnIceShelfSoft','VelSoft','ElementOnIceShelfSubelement','VelSubelement','ElementOnIceShelfSubelement2','VelSubelement2'};
+-field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
++field_tolerances={1e-13,2e-13,1e-13,2e-13,1e-13,2e-13,1e-13,2e-13};
+ field_values={element_on_iceshelf_agressive,vel_agressive,element_on_iceshelf_soft,vel_soft,element_on_iceshelf_subelement,vel_subelement,element_on_iceshelf_subelement2,vel_subelement2};
+Index: ../trunk-jpl/test/NightlyRun/test504.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test504.m	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test504.m	(revision 16938)
+@@ -7,7 +7,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2'};
+-field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
++field_tolerances={1e-12,2e-12,2e-12,1e-13,1e-13,1e-13,1e-13,1e-12,1e-12,1e-12,1e-13,1e-13,1e-13,1e-13};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
+ 	(md.results.TransientSolution(1).Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test415.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test415.m	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test415.m	(revision 16938)
+@@ -23,7 +23,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Gradient','Misfits','FrictionCoefficient','Pressure','Vel','Vx','Vy','Vz','Temperature','BasalforcingsMeltingRate'};
+-field_tolerances={1e-10,1e-9,1e-10,1e-13,1e-09,1e-09,1e-09,1e-8,1e-09,1e-6};
++field_tolerances={5e-10,1e-9,1e-10,1e-13,1e-09,1e-09,1e-09,1e-8,1e-09,1e-6};
+ field_values={...
+ 	(md.results.SteadystateSolution.Gradient1),...
+ 	md.results.SteadystateSolution.J,...
+Index: ../trunk-jpl/test/NightlyRun/test501.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test501.py	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test501.py	(revision 16938)
+@@ -16,7 +16,7 @@
+ 
+ # Fields and tolerances to track changes
+ field_names     =['Vx','Vy','Vel','Pressure']
+-field_tolerances=[1e-13,1e-13,1e-13,1e-13]
++field_tolerances=[1e-12,2e-12,2e-12,1e-13]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Vx,\
+ 	md.results.StressbalanceSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test515.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test515.py	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test515.py	(revision 16938)
+@@ -23,7 +23,7 @@
+ # Fields and tolerances to track changes
+ field_names     =['Temperature1','BasalforcingsMeltingRate1', \
+ 				      'Temperature2','BasalforcingsMeltingRate2']
+-field_tolerances=[1e-13,1e-8,1e-13,1e-8]
++field_tolerances=[1e-13,1e-8,1e-13,2e-8]
+ field_values=[\
+ 	md.results.TransientSolution[0].Temperature,\
+ 	md.results.TransientSolution[0].BasalforcingsMeltingRate,\
+Index: ../trunk-jpl/test/NightlyRun/test701.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test701.m	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test701.m	(revision 16938)
+@@ -50,7 +50,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vel','Pressure'};
+-field_tolerances={1e-13,1e-13,1e-13,1e-13};
++field_tolerances={5e-10,2e-9,2e-9,1e-10};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test322.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test322.py	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test322.py	(revision 16938)
+@@ -34,7 +34,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Gradient','Misfits','FrictionCoefficient','Pressure','Vel','Vx','Vy']
+-field_tolerances=[1e-06,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09]
++field_tolerances=[1e-06,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,2e-09,2e-09,2e-09]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Gradient1,\
+ 	md.results.StressbalanceSolution.J,\
+Index: ../trunk-jpl/test/NightlyRun/test215.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test215.py	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test215.py	(revision 16938)
+@@ -38,7 +38,7 @@
+ # Fields and tolerances to track changes
+ 
+ field_names     =['Gradient','Misfits','MaterialsRheologyBbar','Pressure','Vel','Vx','Vy']
+-field_tolerances=[1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,3e-09,1e-09]
++field_tolerances=[1e-08,1e-09,1e-09,1e-09,2e-09,5e-09,2e-09]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Gradient1,\
+ 	md.results.StressbalanceSolution.J,\
+Index: ../trunk-jpl/test/NightlyRun/test514.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test514.m	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test514.m	(revision 16938)
+@@ -44,5 +44,5 @@
+ 
+ %Fields and tolerances to track changes
+ field_names      = {'x1' ,'y1' ,'x2' ,'y2' ,'x3' ,'y3' ,'x4' ,'y4' ,'x5' ,'y5' ,'x6' ,'y6' ,'x7' ,'y7' };
+-field_tolerances = {1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
++field_tolerances = {2e-10,7e-10,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
+ field_values     = { x1  ,y1   ,y2   ,y2   ,y3   ,y3   ,y4   ,y4   ,y5   ,y5   ,y6   ,y6   ,y7   ,y7   };
+Index: ../trunk-jpl/test/NightlyRun/test426.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test426.py	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test426.py	(revision 16938)
+@@ -34,9 +34,10 @@
+ 	'Bed3','Surface3','Thickness3','Floatingice3','IceVolume3','IceVolumeAboveFloatation3',]
+ 
+ field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
+-	1e-11,1e-10,1e-11,1.25e-11,1e-13,1e-13,\
+-	1e-10,1e-10,1e-10,1.15e-11,1e-13,1e-13]
++	1e-11,1e-10,1e-11,1.25e-11,5e-13,2e-12,\
++	1e-10,1e-10,1e-10,2e-11,5e-13,2e-12]
+ 
++
+ field_values=[\
+ 	md.results.TransientSolution[0].Bed,\
+ 	md.results.TransientSolution[0].Surface,\
+Index: ../trunk-jpl/test/NightlyRun/test702.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test702.m	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test702.m	(revision 16938)
+@@ -45,7 +45,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vel','Pressure'};
+-field_tolerances={1e-09,1e-09,1e-09,1e-09};
++field_tolerances={2e-09,2e-09,2e-09,1e-08};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test515.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test515.m	(revision 16937)
++++ ../trunk-jpl/test/NightlyRun/test515.m	(revision 16938)
+@@ -14,7 +14,7 @@
+ %Fields and tolerances to track changes
+ field_names     ={'Temperature1','BasalforcingsMeltingRate1', ...
+ 				      'Temperature2','BasalforcingsMeltingRate2'};
+-field_tolerances={1e-13,1e-8,1e-13,1e-8};
++field_tolerances={1e-13,1e-8,1e-13,2e-8};
+ field_values={...
+ 	(md.results.TransientSolution(1).Temperature),...
+ 	(md.results.TransientSolution(1).BasalforcingsMeltingRate),...
Index: issm/oecreview/Archive/16554-17801/ISSM-16938-16939.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16938-16939.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16938-16939.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 16938)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 16939)
+@@ -192,7 +192,7 @@
+ 	element->GetVerticesCoordinates(&xyz_list);
+ 	element->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	Input* mb_input   = element->GetInput(BasalforcingsMeltingRateEnum); _assert_(mb_input);
+-	Input* oldw_input = element->GetInput(WaterColumnOldEnum);           _assert_(oldw);
++	Input* oldw_input = element->GetInput(WaterColumnOldEnum);           _assert_(oldw_input);
+ 
+ 	/*Initialize mb_correction to 0, do not forget!:*/
+ 	/* Start  looping on the number of gaussian points: */
Index: issm/oecreview/Archive/16554-17801/ISSM-16939-16940.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16939-16940.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16939-16940.diff	(revision 17802)
@@ -0,0 +1,222 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16939)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16940)
+@@ -77,6 +77,10 @@
+ 		ElementMatrix* CreateKMatrixCouplingSSAHOFriction(Element* element);
+ 		ElementMatrix* CreateKMatrixCouplingSSAHOViscous(Element* element);
+ 		ElementVector* CreatePVectorSSAHO(Element* element);
++		ElementVector* CreatePVectorSSAFS(Element* element);
++		ElementVector* CreatePVectorCouplingSSAFS(Element* element);
++		ElementVector* CreatePVectorCouplingSSAFSFriction(Element* element);
++		ElementVector* CreatePVectorCouplingSSAFSViscous(Element* element);
+ 		ElementVector* CreatePVectorHOFS(Element* element);
+ 		ElementVector* CreatePVectorCouplingHOFS(Element* element);
+ 		ElementVector* CreatePVectorCouplingHOFSFriction(Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16939)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16940)
+@@ -854,6 +854,8 @@
+ 			return CreatePVectorSSAHO(element);
+ 		case HOFSApproximationEnum: 
+ 			return CreatePVectorHOFS(element);
++		case SSAFSApproximationEnum: 
++			return CreatePVectorSSAFS(element);
+ 		case NoneApproximationEnum:
+ 			return NULL;
+ 		default:
+@@ -3355,6 +3357,29 @@
+ 	delete pe2;
+ 	return pe;
+ }/*}}}*/
++ElementVector* StressbalanceAnalysis::CreatePVectorSSAFS(Element* element){/*{{{*/
++
++	/*compute all load vectors for this element*/
++	int init = element->FiniteElement();
++	element->SetTemporaryElementType(P1Enum); // P1 needed for HO
++	ElementVector* pe1=CreatePVectorSSA(element);
++	element->SetTemporaryElementType(init); // P1 needed for HO
++	ElementVector* pe2=CreatePVectorFS(element);
++	int indices[3]={18,19,20};
++	element->SetTemporaryElementType(MINIcondensedEnum); // P1 needed for HO
++	ElementMatrix* Ke = CreateKMatrixFS(element);
++	element->SetTemporaryElementType(init); // P1 needed for HO
++	pe2->StaticCondensation(Ke,3,&indices[0]);
++	delete Ke;
++	ElementVector* pe3=CreatePVectorCouplingSSAFS(element);
++	ElementVector* pe =new ElementVector(pe1,pe2,pe3);
++
++	/*clean-up and return*/
++	delete pe1;
++	delete pe2;
++	delete pe3;
++	return pe;
++}/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorHOFS(Element* element){/*{{{*/
+ 
+ 	/*compute all load vectors for this element*/
+@@ -3542,6 +3567,163 @@
+ 	delete gauss;
+ 	return pe;
+ }/*}}}*/
++ElementVector* StressbalanceAnalysis::CreatePVectorCouplingSSAFS(Element* element){/*{{{*/
++
++	/*compute all load vectors for this element*/
++	ElementVector* pe1=CreatePVectorCouplingSSAFSViscous(element);
++	ElementVector* pe2=CreatePVectorCouplingSSAFSFriction(element);
++	ElementVector* pe =new ElementVector(pe1,pe2);
++
++	/*clean-up and return*/
++	delete pe1;
++	delete pe2;
++	return pe;
++}/*}}}*/
++ElementVector* StressbalanceAnalysis::CreatePVectorCouplingSSAFSFriction(Element* element){/*{{{*/
++
++	/*Intermediaries*/
++	int         i,j,approximation;
++	int         dim=3;
++	IssmDouble  Jdet,Jdet2d,FSreconditioning;
++	IssmDouble	bed_normal[3];
++	IssmDouble  viscosity, w, alpha2_gauss;
++	IssmDouble  dw[3];
++	IssmDouble  basis[6]; //for the six nodes of the penta
++	IssmDouble	*xyz_list_tria = NULL;
++	IssmDouble  *xyz_list      = NULL;
++
++	/*Initialize Element vector and return if necessary*/
++	if(!element->IsOnBed() || element->IsFloating()) return NULL;
++	element->GetInputValue(&approximation,ApproximationEnum);
++	if(approximation!=SSAFSApproximationEnum) return NULL;
++	int vnumnodes = element->GetNumberOfNodesVelocity();
++	int pnumnodes = element->GetNumberOfNodesPressure();
++
++	/*Prepare coordinate system list*/
++	int* cs_list     = xNew<int>(vnumnodes+pnumnodes);
++	Node **node_list = xNew<Node*>(vnumnodes+pnumnodes);
++	for(i=0;i<vnumnodes;i++){
++		cs_list[i]             = XYZEnum;
++		node_list[i]           = element->GetNode(i);
++	}
++	for(i=0;i<pnumnodes;i++){
++		cs_list[vnumnodes+i]   = PressureEnum;
++		node_list[vnumnodes+i] = element->GetNode(vnumnodes+i);
++	}
++	ElementVector* pe=element->NewElementVector(FSvelocityEnum);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	element->GetVerticesCoordinatesBase(&xyz_list_tria);
++	element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
++	Input* vx_input=   element->GetInput(VxEnum);    _assert_(vx_input);
++	Input* vy_input=   element->GetInput(VyEnum);    _assert_(vy_input);
++	Input* vz_input=   element->GetInput(VzEnum);    _assert_(vz_input);
++	Input* vzSSA_input=element->GetInput(VzSSAEnum); _assert_(vzSSA_input);
++
++	/*build friction object, used later on: */
++	Friction* friction=new Friction(element,3);
++
++	/* Start looping on the number of gauss 2d (nodes on the bedrock) */
++	Gauss* gauss=element->NewGaussBase(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminantBase(&Jdet2d,xyz_list_tria,gauss);
++		element->NodalFunctionsP1(basis, gauss);
++
++		vzSSA_input->GetInputValue(&w, gauss);
++		vzSSA_input->GetInputDerivativeValue(&dw[0],xyz_list,gauss);
++
++		element->NormalBase(&bed_normal[0],xyz_list_tria);
++		element->ViscosityFS(&viscosity,dim,xyz_list,gauss,vx_input,vy_input,vz_input);
++		friction->GetAlpha2(&alpha2_gauss, gauss,vx_input,vy_input,vz_input);
++
++		for(i=0;i<3;i++){
++			pe->values[i*3+0]+=Jdet2d*gauss->weight*(alpha2_gauss*w*bed_normal[0]*bed_normal[2]+2*viscosity*dw[2]*bed_normal[0])*basis[i];
++			pe->values[i*3+1]+=Jdet2d*gauss->weight*(alpha2_gauss*w*bed_normal[1]*bed_normal[2]+2*viscosity*dw[2]*bed_normal[1])*basis[i];
++			pe->values[i*3+2]+=Jdet2d*gauss->weight*2*viscosity*(dw[0]*bed_normal[0]+dw[1]*bed_normal[1]+dw[2]*bed_normal[2])*basis[i];
++		}
++	}
++
++	/*Transform coordinate system*/
++	element->TransformLoadVectorCoord(pe,node_list,vnumnodes+pnumnodes,cs_list);
++
++	/*Clean up and return*/
++	xDelete<int>(cs_list);
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(xyz_list_tria);
++	xDelete<Node*>(node_list);
++	delete gauss;
++	delete friction;
++	return pe;
++}/*}}}*/
++ElementVector* StressbalanceAnalysis::CreatePVectorCouplingSSAFSViscous(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	int         i,approximation;
++	IssmDouble  viscosity,Jdet,FSreconditioning;
++	IssmDouble  dw[3];
++	IssmDouble  *xyz_list = NULL;
++	IssmDouble  basis[6]; //for the six nodes of the penta
++	IssmDouble  dbasis[3][6]; //for the six nodes of the penta
++
++	/*Initialize Element vector and return if necessary*/
++	element->GetInputValue(&approximation,ApproximationEnum);
++	if(approximation!=SSAFSApproximationEnum) return NULL;
++	int vnumnodes = element->GetNumberOfNodesVelocity();
++	int pnumnodes = element->GetNumberOfNodesPressure();
++
++	/*Prepare coordinate system list*/
++	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
++	Node **node_list = xNew<Node*>(vnumnodes+pnumnodes);
++	for(i=0;i<vnumnodes;i++){
++		cs_list[i]             = XYZEnum;
++		node_list[i]           = element->GetNode(i);
++	}
++	for(i=0;i<pnumnodes;i++){
++		cs_list[vnumnodes+i]   = PressureEnum;
++		node_list[vnumnodes+i] = element->GetNode(vnumnodes+i);
++	}
++	ElementVector* pe=element->NewElementVector(FSvelocityEnum);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
++	Input* vx_input   =element->GetInput(VxEnum);      _assert_(vx_input);
++	Input* vy_input   =element->GetInput(VyEnum);      _assert_(vy_input);
++	Input* vz_input   =element->GetInput(VzEnum);      _assert_(vz_input);
++	Input* vzSSA_input=element->GetInput(VzSSAEnum);   _assert_(vzSSA_input);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(5);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctionsP1(&basis[0], gauss);
++		element->NodalFunctionsP1Derivatives(&dbasis[0][0],xyz_list, gauss);
++
++		vzSSA_input->GetInputDerivativeValue(&dw[0],xyz_list,gauss);
++		element->ViscosityFS(&viscosity,3,xyz_list,gauss,vx_input,vy_input,vz_input);
++
++		for(i=0;i<6;i++){
++			pe->values[i*3+0]+=-Jdet*gauss->weight*viscosity*dw[0]*dbasis[2][i];
++			pe->values[i*3+1]+=-Jdet*gauss->weight*viscosity*dw[1]*dbasis[2][i];
++			pe->values[i*3+2]+=-Jdet*gauss->weight*viscosity*(dw[0]*dbasis[0][i]+dw[1]*dbasis[1][i]+2*dw[2]*dbasis[2][i]);
++			pe->values[3*vnumnodes+i]+=Jdet*gauss->weight*FSreconditioning*dw[2]*basis[i];
++		}
++	}
++
++	/*Transform coordinate system*/
++	element->TransformLoadVectorCoord(pe,node_list,vnumnodes+pnumnodes,cs_list);
++
++	/*Clean up and return*/
++	xDelete<int>(cs_list);
++	delete gauss;
++	return pe;
++}/*}}}*/
+ void StressbalanceAnalysis::GetBSSAHO(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 3*NDOF2. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
Index: issm/oecreview/Archive/16554-17801/ISSM-16940-16941.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16940-16941.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16940-16941.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/test/NightlyRun/test508.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test508.py	(revision 16940)
++++ ../trunk-jpl/test/NightlyRun/test508.py	(revision 16941)
+@@ -18,7 +18,7 @@
+ 
+ # Fields and tolerances to track changes
+ field_names     =['Vx','Vy','Vz','Vel','Pressure','Temperature','BasalforcingsMeltingRate']
+-field_tolerances=[5e-08,8.15e-09,5e-08,8.5e-09,1e-09,2e-09,3e-07]
++field_tolerances=[5e-08,8.15e-09,5e-08,8.5e-09,1e-09,3e-09,3e-07]
+ field_values=[\
+ 	md.results.SteadystateSolution.Vx,\
+ 	md.results.SteadystateSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test215.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test215.py	(revision 16940)
++++ ../trunk-jpl/test/NightlyRun/test215.py	(revision 16941)
+@@ -38,7 +38,7 @@
+ # Fields and tolerances to track changes
+ 
+ field_names     =['Gradient','Misfits','MaterialsRheologyBbar','Pressure','Vel','Vx','Vy']
+-field_tolerances=[1e-08,1e-09,1e-09,1e-09,2e-09,5e-09,2e-09]
++field_tolerances=[1e-08,1e-09,2e-09,1e-09,2e-09,5e-09,2e-09]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Gradient1,\
+ 	md.results.StressbalanceSolution.J,\
Index: issm/oecreview/Archive/16554-17801/ISSM-16941-16942.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16941-16942.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16941-16942.diff	(revision 17802)
@@ -0,0 +1,145 @@
+
+Property changes on: ../trunk-jpl/src/c/analyses
+___________________________________________________________________
+Name: svn:ignore
+   - .deps
+.dirstamp
+
+   + *.obj
+.deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/c/toolkits/mpi/commops
+___________________________________________________________________
+Name: svn:ignore
+   - .deps
+.dirstamp
+
+   + *.obj
+.deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/c/toolkits/petsc/patches
+___________________________________________________________________
+Name: svn:ignore
+   - .deps
+.dirstamp
+
+   + *.obj
+.deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/c/toolkits/petsc/objects
+___________________________________________________________________
+Name: svn:ignore
+   - .deps
+.dirstamp
+
+   + *.obj
+.deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/c/cores
+___________________________________________________________________
+Name: svn:ignore
+   - .deps
+.dirstamp
+
+   + *.obj
+.deps
+.dirstamp
+
+
+
+Property changes on: ../trunk-jpl/src/c
+___________________________________________________________________
+Name: svn:ignore
+   - Makefile
+Makefile.in
+.ignore.txt
+*.o
+*.obj
+*.exe
+appscan.*
+ouncemake*
+list
+*.ppf_cache
+.deps
+config
+g++results
+probe.results
+stXXXX*
+.deps
+.dirstamp
+
+   + Makefile
+Makefile.in
+.ignore.txt
+*.o
+*.obj
+*.exe
+appscan.*
+ouncemake*
+list
+*.ppf_cache
+.deps
+config
+g++results
+probe.results
+stXXXX*
+.deps
+.dirstamp
+.libs
+
+
+
+Property changes on: ../trunk-jpl/src/wrappers/matlab
+___________________________________________________________________
+Name: svn:ignore
+   - *.obj
+Makefile
+*.lib
+*.mexmaci64
+*.mexa64
+*.mexw64
+*.manifest
+*.exp
+.deps
+Makefile.in
+
+   + .libs
+*.obj
+Makefile
+*.lib
+*.mexmaci64
+*.mexa64
+*.mexw64
+*.manifest
+*.exp
+.deps
+Makefile.in
+
+
+
+Property changes on: ../trunk-jpl/lib
+___________________________________________________________________
+Name: svn:ignore
+   - *.mexa64
+*.mexmaci64
+*.so
+
+   + *.lib
+*.mexw64
+*.mexa64
+*.mexmaci64
+*.so
+
+
Index: issm/oecreview/Archive/16554-17801/ISSM-16942-16943.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16942-16943.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16942-16943.diff	(revision 17802)
@@ -0,0 +1,14 @@
+Index: ../trunk-jpl/src/m/classes/clusters/generic.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/clusters/generic.m	(revision 16942)
++++ ../trunk-jpl/src/m/classes/clusters/generic.m	(revision 16943)
+@@ -114,6 +114,9 @@
+ 				fid=fopen([modelname '.bat'],'w');
+ 				fprintf(fid,'@echo off\n');
+ 
++				warning('parallel runs not allowed yet in Windows. Defaulting to 1 cpus');
++				cluster.np=1;
++
+ 				if cluster.np>1,
+ 					fprintf(fid,'"C:\\Program Files\\MPICH2\\bin\\mpiexec.exe" -n %i "%s/issm.exe" %s ./ %s ',cluster.np,cluster.codepath,EnumToString(solution),modelname);
+ 				else
Index: issm/oecreview/Archive/16554-17801/ISSM-16943-16944.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16943-16944.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16943-16944.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/test/NightlyRun/test508.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test508.py	(revision 16943)
++++ ../trunk-jpl/test/NightlyRun/test508.py	(revision 16944)
+@@ -18,7 +18,7 @@
+ 
+ # Fields and tolerances to track changes
+ field_names     =['Vx','Vy','Vz','Vel','Pressure','Temperature','BasalforcingsMeltingRate']
+-field_tolerances=[5e-08,8.15e-09,5e-08,8.5e-09,1e-09,3e-09,3e-07]
++field_tolerances=[5e-08,8.15e-09,5e-08,8.5e-09,1e-09,3e-08,3e-07]
+ field_values=[\
+ 	md.results.SteadystateSolution.Vx,\
+ 	md.results.SteadystateSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test508.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test508.m	(revision 16943)
++++ ../trunk-jpl/test/NightlyRun/test508.m	(revision 16944)
+@@ -9,7 +9,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure','Temperature','BasalforcingsMeltingRate'};
+-field_tolerances={5e-08,8.15e-09,5e-08,8.5e-09,1e-09,2e-07,3e-07};
++field_tolerances={5e-08,2e-08,5e-08,2e-08,1e-09,2e-07,5e-07};
+ field_values={...
+ 	(md.results.SteadystateSolution.Vx),...
+ 	(md.results.SteadystateSolution.Vy),...
Index: issm/oecreview/Archive/16554-17801/ISSM-16944-16945.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16944-16945.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16944-16945.diff	(revision 17802)
@@ -0,0 +1,134 @@
+Index: ../trunk-jpl/test/NightlyRun/test426.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test426.m	(revision 16944)
++++ ../trunk-jpl/test/NightlyRun/test426.m	(revision 16945)
+@@ -23,8 +23,8 @@
+ 	'Bed2','Surface2','Thickness2','Floatingice2','IceVolume2','IceVolumeAboveFloatation2',...
+ 	'Bed3','Surface3','Thickness3','Floatingice3','IceVolume3','IceVolumeAboveFloatation3'};
+ field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+-	1e-11,1e-10,1e-11,1.25e-11,5e-13,2e-12,...
+-	1e-10,1e-10,1e-10,2e-11,5e-13,2e-12};
++	1e-11,1e-10,1e-11,3e-11,2e-12,5e-12,...
++	1e-10,1e-10,1e-10,5e-11,2e-12,5e-12};
+ field_values={...
+ 	(md.results.TransientSolution(1).Bed),...
+ 	(md.results.TransientSolution(1).Surface),...
+Index: ../trunk-jpl/test/NightlyRun/test507.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test507.m	(revision 16944)
++++ ../trunk-jpl/test/NightlyRun/test507.m	(revision 16945)
+@@ -9,7 +9,7 @@
+ %Fields and tolerances to track changes
+ field_names     ={'Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Temperature1','BasalforcingsMeltingRate1', ...
+ 				      'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsMeltingRate2'};
+-field_tolerances={1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-06,1e-06,1e-06,1e-06,1e-06,1e-06,1e-06,1e-06,1e-06,1e-06};
++field_tolerances={1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-06,1e-06,1e-06,1e-06,1e-06,1e-06,1e-06,1e-06,3e-06,1e-06};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
+ 	(md.results.TransientSolution(1).Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test206.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test206.m	(revision 16944)
++++ ../trunk-jpl/test/NightlyRun/test206.m	(revision 16945)
+@@ -9,7 +9,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Temperature','BasalforcingsMeltingRate'};
+-field_tolerances={1e-13,1.35e-6};
++field_tolerances={1e-13,2.6e-6};
+ field_values={...
+ 	(md.results.ThermalSolution.Temperature),...
+ 	(md.results.ThermalSolution.BasalforcingsMeltingRate),...
+Index: ../trunk-jpl/test/NightlyRun/test427.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test427.m	(revision 16944)
++++ ../trunk-jpl/test/NightlyRun/test427.m	(revision 16945)
+@@ -22,8 +22,8 @@
+ 	'Bed2','Surface2','Thickness2','Floatingice2',...
+ 	'Bed3','Surface3','Thickness3','Floatingice3'};
+ field_tolerances={1e-13,1e-13,1e-13,1e-13,...
+-	1e-13,1e-13,1e-13,1e-13,...
+-	1e-10,1e-11,1e-10,1e-13};
++	4e-12,2e-12,6e-12,2e-11,...
++	1e-10,3e-11,1e-10,7e-11};
+ field_values={...
+ 	(md.results.TransientSolution(1).Bed),...
+ 	(md.results.TransientSolution(1).Surface),...
+Index: ../trunk-jpl/test/NightlyRun/test101.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test101.m	(revision 16944)
++++ ../trunk-jpl/test/NightlyRun/test101.m	(revision 16945)
+@@ -20,7 +20,7 @@
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vel','Pressure',...
+ 	'StressTensorxx','StressTensoryy','StressTensorxy','MassFlux1','MassFlux2','MassFlux3','MassFlux4','MassFlux5','MassFlux6'};
+-field_tolerances={1e-13,1e-13,1e-13,1e-13,...
++field_tolerances={2e-13,1e-13,1e-13,1e-13,...
+ 	1e-13,1e-13,1e-13,...
+ 	1e-13, 1e-13, 1e-13, 1e-13, 1e-13, 1e-13 };
+ field_values={...
+Index: ../trunk-jpl/test/NightlyRun/test209.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test209.m	(revision 16944)
++++ ../trunk-jpl/test/NightlyRun/test209.m	(revision 16945)
+@@ -12,8 +12,8 @@
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3'};
+ field_tolerances={...
+ 	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-8,...
+-	1e-13,1e-13,2e-9,1e-13,3.8e-11,3.85e-11,3.85e-11,3.85e-11,1e-13,1.55e-8,...
+-	2.65e-11,2.55e-12,1e-08,2.4e-12,3.9e-11,1e-10,1e-10,1e-10,7.4e-12,1.85e-8};
++	1e-13,1e-13,3e-9,1e-13,3.8e-11,3.85e-11,3.85e-11,3.85e-11,1e-13,1.9e-8,...
++	5e-11,6e-12,1e-08,6e-12,3.9e-11,1e-10,1e-10,1e-10,9e-12,1.85e-8};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
+ 	(md.results.TransientSolution(1).Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test415.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test415.m	(revision 16944)
++++ ../trunk-jpl/test/NightlyRun/test415.m	(revision 16945)
+@@ -23,7 +23,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Gradient','Misfits','FrictionCoefficient','Pressure','Vel','Vx','Vy','Vz','Temperature','BasalforcingsMeltingRate'};
+-field_tolerances={5e-10,1e-9,1e-10,1e-13,1e-09,1e-09,1e-09,1e-8,1e-09,1e-6};
++field_tolerances={9e-10,1e-9,1e-10,1e-13,1e-09,1e-09,1e-09,1e-8,1e-09,1e-6};
+ field_values={...
+ 	(md.results.SteadystateSolution.Gradient1),...
+ 	md.results.SteadystateSolution.J,...
+Index: ../trunk-jpl/test/NightlyRun/test203.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test203.m	(revision 16944)
++++ ../trunk-jpl/test/NightlyRun/test203.m	(revision 16945)
+@@ -8,7 +8,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure'};
+-field_tolerances={1e-09,1e-09,1e-09,1e-09,1e-09};
++field_tolerances={2e-09,1e-09,1e-09,1e-09,1e-09};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test515.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test515.m	(revision 16944)
++++ ../trunk-jpl/test/NightlyRun/test515.m	(revision 16945)
+@@ -14,7 +14,7 @@
+ %Fields and tolerances to track changes
+ field_names     ={'Temperature1','BasalforcingsMeltingRate1', ...
+ 				      'Temperature2','BasalforcingsMeltingRate2'};
+-field_tolerances={1e-13,1e-8,1e-13,2e-8};
++field_tolerances={1e-13,1e-8,1e-13,3e-8};
+ field_values={...
+ 	(md.results.TransientSolution(1).Temperature),...
+ 	(md.results.TransientSolution(1).BasalforcingsMeltingRate),...
+Index: ../trunk-jpl/jenkins/imac-012301-gil
+===================================================================
+--- ../trunk-jpl/jenkins/imac-012301-gil	(revision 16944)
++++ ../trunk-jpl/jenkins/imac-012301-gil	(revision 16945)
+@@ -104,5 +104,5 @@
+ #as follows: runme($MATLAB_NROPTIONS). The options must be understandable
+ #by Matlab and runme.m
+ #ex: "'id',[101 102 103]"
+-MATLAB_NROPTIONS=""
++MATLAB_NROPTIONS="'exclude',[218 234 235 412 413 414 417 418 420]"
+ PYTHON_NROPTIONS=""
Index: issm/oecreview/Archive/16554-17801/ISSM-16945-16946.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16945-16946.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16945-16946.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/test/NightlyRun/test508.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test508.py	(revision 16945)
++++ ../trunk-jpl/test/NightlyRun/test508.py	(revision 16946)
+@@ -18,7 +18,7 @@
+ 
+ # Fields and tolerances to track changes
+ field_names     =['Vx','Vy','Vz','Vel','Pressure','Temperature','BasalforcingsMeltingRate']
+-field_tolerances=[5e-08,8.15e-09,5e-08,8.5e-09,1e-09,3e-08,3e-07]
++field_tolerances=[5e-08,1.6e-08,5e-08,1.6e-08,1e-09,6e-08,5e-07]
+ field_values=[\
+ 	md.results.SteadystateSolution.Vx,\
+ 	md.results.SteadystateSolution.Vy,\
Index: issm/oecreview/Archive/16554-17801/ISSM-16946-16947.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16946-16947.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16946-16947.diff	(revision 17802)
@@ -0,0 +1,668 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16946)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16947)
+@@ -60,11 +60,17 @@
+ 		void       FindParam(int** pvalues,int* psize,int paramenum);
+ 		Input*     GetInput(int inputenum);
+ 		IssmDouble GetMaterialParameter(int enum_in);
++		void       GetPhi(IssmDouble* phi, IssmDouble*  epsilon, IssmDouble viscosity);
++		void       GetVerticesSidList(int* sidlist);
++		void       GetVerticesConnectivityList(int* connectivitylist);
+ 		bool       IsFloating(); 
++		void       ResultInterpolation(int* pinterpolation,int output_enum);
++		void       ResultToVector(Vector<IssmDouble>* vector,int output_enum);
+ 		void       StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 		void       StrainRateHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 		void       StrainRateFS(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+ 		IssmDouble TMeltingPoint(IssmDouble pressure);
++		void       ViscousHeatingCreateInput(void);
+ 		void       ViscosityFS(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+ 		void       ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 		void       ViscosityL1L2(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* surf);
+@@ -76,8 +82,8 @@
+ 		void       TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes_list,int numnodes,int* transformenum_list);
+ 		void       TransformLoadVectorCoord(ElementVector* pe,int transformenum);
+ 		void       TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list);
+-		void       TransformLoadVectorCoord(ElementVector* pe,int numnodes,int transformenum){_error_("not implemented yet");};      /*Tiling only*/
+-		void       TransformLoadVectorCoord(ElementVector* pe,int numnodes,int* transformenum_list){_error_("not implemented yet");};      /*Tiling only*/
++		void       TransformLoadVectorCoord(ElementVector* pe,int numnodes,int transformenum){_error_("not implemented yet");};/*Tiling only*/
++		void       TransformLoadVectorCoord(ElementVector* pe,int numnodes,int* transformenum_list){_error_("not implemented yet");};/*Tiling only*/
+ 		void       TransformLoadVectorCoord(ElementVector* pe,Node** nodes_list,int numnodes,int* transformenum_list);
+ 		void       TransformSolutionCoord(IssmDouble* values,int transformenum);
+ 		void       TransformSolutionCoord(IssmDouble* values,int* transformenum_list);
+@@ -86,7 +92,7 @@
+ 		void       TransformStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum);
+ 		void       TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* transformenum_list);
+ 		void       TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int transformenum);
+-		void       TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int* transformenum_list){_error_("not implemented yet");};      /*Tiling only*/
++		void       TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int* transformenum_list){_error_("not implemented yet");};/*Tiling only*/
+ 		void       TransformStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes_list,int numnodes,int* transformenum_list);
+ 
+ 		/*Virtual functions*/
+@@ -167,8 +173,7 @@
+ 		virtual void   ComputeBasalStress(Vector<IssmDouble>* sigma_b)=0;
+ 		virtual void   ComputeStrainRate(Vector<IssmDouble>* eps)=0;
+ 		virtual void   ComputeStressTensor(void)=0;
+-		virtual void   ResultInterpolation(int* pinterpolation,int output_enum)=0;
+-		virtual void   ResultToVector(Vector<IssmDouble>* vector,int output_enum)=0;
++
+ 		virtual void   Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finite_element)=0;
+ 		virtual void   InputDuplicate(int original_enum,int new_enum)=0;
+ 		virtual void   InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16946)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16947)
+@@ -1509,16 +1509,6 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetVertexSidList {{{*/
+-void  Tria::GetVertexSidList(int* sidlist){
+-	for(int i=0;i<NUMVERTICES;i++) sidlist[i]=vertices[i]->Sid();
+-}
+-/*}}}*/
+-/*FUNCTION Tria::GetConnectivityList {{{*/
+-void  Tria::GetConnectivityList(int* connectivity){
+-	for(int i=0;i<NUMVERTICES;i++) connectivity[i]=vertices[i]->Connectivity();
+-}
+-/*}}}*/
+ /*FUNCTION Tria::GetVectorFromInputs{{{*/
+ void  Tria::GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum){
+ 
+@@ -2536,78 +2526,6 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::ResultInterpolation{{{*/
+-void Tria::ResultInterpolation(int* pinterpolation,int output_enum){
+-
+-	Input* input=this->inputs->GetInput(output_enum);
+-
+-	/*If this input is not already in Inputs, maybe it needs to be computed?*/
+-	if(!input){
+-		switch(output_enum){
+-			case StressTensorxxEnum: 
+-				this->ComputeStressTensor();
+-				input=this->inputs->GetInput(output_enum);
+-				break;
+-			case StressTensorxyEnum: 
+-				this->ComputeStressTensor();
+-				input=this->inputs->GetInput(output_enum);
+-				break;
+-			case StressTensorxzEnum: 
+-				this->ComputeStressTensor();
+-				input=this->inputs->GetInput(output_enum);
+-				break;
+-			case StressTensoryyEnum: 
+-				this->ComputeStressTensor();
+-				input=this->inputs->GetInput(output_enum);
+-				break;
+-			case StressTensoryzEnum: 
+-				this->ComputeStressTensor();
+-				input=this->inputs->GetInput(output_enum);
+-				break;
+-			case StressTensorzzEnum: 
+-				this->ComputeStressTensor();
+-				input=this->inputs->GetInput(output_enum);
+-				break;
+-			default:
+-				_error_("input "<<EnumToStringx(output_enum)<<" not found in element");
+-		}
+-	}
+-
+-	/*Assign output pointer*/
+-	*pinterpolation = input->GetResultInterpolation();
+-
+-}
+-/*}}}*/
+-/*FUNCTION Tria::ResultToVector{{{*/
+-void Tria::ResultToVector(Vector<IssmDouble>* vector,int output_enum){
+-
+-	Input* input=this->inputs->GetInput(output_enum);
+-	if(!input) _error_("input "<<EnumToStringx(output_enum)<<" not found in element");
+-
+-	switch(input->GetResultInterpolation()){
+-		case P0Enum:
+-			_error_("not implemented...");
+-			break;
+-		case P1Enum:{
+-			IssmDouble  values[NUMVERTICES];
+-			int         connectivity[NUMVERTICES];
+-			int         sidlist[NUMVERTICES];
+-
+-			this->GetVertexSidList(&sidlist[0]);
+-			this->GetConnectivityList(&connectivity[0]);
+-			this->GetInputListOnVertices(&values[0],output_enum);
+-			for(int i=0;i<NUMVERTICES;i++) values[i] = values[i]/reCast<IssmDouble>(connectivity[i]);
+-
+-			vector->SetValues(NUMVERTICES,&sidlist[0],&values[0],ADD_VAL);
+-			break;
+-					}
+-		default:
+-			_error_("interpolation "<<EnumToStringx(input->GetResultInterpolation())<<" not supported yet");
+-	}
+-
+-
+-}
+-/*}}}*/
+ /*FUNCTION Tria::SetClone {{{*/
+ void  Tria::SetClone(int* minranks){
+ 
+@@ -2996,7 +2914,7 @@
+ 	area=this->GetArea();
+ 
+ 	/*Figure out the average for this element: */
+-	this->GetVertexSidList(&offsetsid[0]);
++	this->GetVerticesSidList(&offsetsid[0]);
+ 	this->GetVertexPidList(&offsetdof[0]);
+ 	mean=0;
+ 	for(i=0;i<NUMVERTICES;i++){
+@@ -4568,8 +4486,8 @@
+ 	IssmPDouble gradients[NUMVERTICES]; 
+ 	IssmDouble  value,gradient;
+ 
+-	this->GetConnectivityList(&connectivity[0]);
+-	this->GetVertexSidList(&sidlist[0]);
++	this->GetVerticesConnectivityList(&connectivity[0]);
++	this->GetVerticesSidList(&sidlist[0]);
+ 
+ 	GaussTria* gauss=new GaussTria();
+ 	for (int iv=0;iv<NUMVERTICES;iv++){
+@@ -4831,7 +4749,7 @@
+ 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	GradientIndexing(&vertexpidlist[0],control_index);
+-	this->GetConnectivityList(&connectivity[0]);
++	this->GetVerticesConnectivityList(&connectivity[0]);
+ 
+ 	/*Build frictoin element, needed later: */
+ 	friction=new Friction(this,2);
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16946)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16947)
+@@ -112,8 +112,6 @@
+ 		void        MaterialUpdateFromTemperature(void){_error_("not implemented yet");};
+ 		int         NodalValue(IssmDouble* pvalue, int index, int natureofdataenum);
+ 		void        PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm);
+-		void        ResultInterpolation(int* pinterpolation,int output_enum);
+-		void        ResultToVector(Vector<IssmDouble>* vector,int output_enum);
+ 		void        ReduceMatrices(ElementMatrix* Ke,ElementVector* pe);
+ 		void        ResetCoordinateSystem(void);
+ 		void	      SmbGradients();
+@@ -246,8 +244,6 @@
+ 		int            GetElementType(void);
+ 
+ 		void	         GetVertexPidList(int* doflist);
+-		void           GetVertexSidList(int* sidlist);
+-		void           GetConnectivityList(int* connectivity);
+ 		IssmDouble     GetYcoord(Gauss* gauss);
+ 		IssmDouble     GetZcoord(Gauss* gauss){_error_("not implemented");};
+ 		void           NormalSection(IssmDouble* normal,IssmDouble* xyz_list);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16946)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16947)
+@@ -1152,18 +1152,6 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetVertexSidList{{{*/
+-void  Penta::GetVertexSidList(int* sidlist){
+-
+-	for(int i=0;i<NUMVERTICES;i++) sidlist[i]=vertices[i]->Sid();
+-
+-}
+-/*}}}*/
+-/*FUNCTION Penta::GetConnectivityList {{{*/
+-void  Penta::GetConnectivityList(int* connectivity){
+-	for(int i=0;i<NUMVERTICES;i++) connectivity[i]=vertices[i]->Connectivity();
+-}
+-/*}}}*/
+ /*FUNCTION Penta::GetElementType {{{*/
+ int Penta::GetElementType(){
+ 
+@@ -1449,44 +1437,6 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetPhi {{{*/
+-void Penta::GetPhi(IssmDouble* phi, IssmDouble*  epsilon, IssmDouble viscosity){
+-	/*Compute deformational heating from epsilon and viscosity */
+-
+-	IssmDouble epsilon_matrix[3][3];
+-	IssmDouble epsilon_eff;
+-	IssmDouble epsilon_sqr[3][3];
+-
+-	/* Build epsilon matrix */
+-	epsilon_matrix[0][0]=*(epsilon+0);
+-	epsilon_matrix[1][0]=*(epsilon+3);
+-	epsilon_matrix[2][0]=*(epsilon+4);
+-	epsilon_matrix[0][1]=*(epsilon+3);
+-	epsilon_matrix[1][1]=*(epsilon+1);
+-	epsilon_matrix[2][1]=*(epsilon+5);
+-	epsilon_matrix[0][2]=*(epsilon+4);
+-	epsilon_matrix[1][2]=*(epsilon+5);
+-	epsilon_matrix[2][2]=*(epsilon+2);
+-
+-	/* Effective value of epsilon_matrix */
+-	epsilon_sqr[0][0]=pow(epsilon_matrix[0][0],2);
+-	epsilon_sqr[1][0]=pow(epsilon_matrix[1][0],2);
+-	epsilon_sqr[2][0]=pow(epsilon_matrix[2][0],2);
+-	epsilon_sqr[0][1]=pow(epsilon_matrix[0][1],2);
+-	epsilon_sqr[1][1]=pow(epsilon_matrix[1][1],2);
+-	epsilon_sqr[2][1]=pow(epsilon_matrix[2][1],2);
+-	epsilon_sqr[0][2]=pow(epsilon_matrix[0][2],2);
+-	epsilon_sqr[1][2]=pow(epsilon_matrix[1][2],2);
+-	epsilon_sqr[2][2]=pow(epsilon_matrix[2][2],2);
+-	epsilon_eff=1/pow(2,0.5)*pow((epsilon_sqr[0][0]+epsilon_sqr[0][1]+ epsilon_sqr[0][2]+ epsilon_sqr[1][0]+ epsilon_sqr[1][1]+ epsilon_sqr[1][2]+ epsilon_sqr[2][0]+ epsilon_sqr[2][1]+ epsilon_sqr[2][2]),0.5);
+-
+-	/*Phi = Tr(sigma * eps) 
+-	 *    = Tr(sigma'* eps)
+-	 *    = 2 * eps_eff * sigma'_eff
+-	 *    = 4 * mu * eps_eff ^2*/
+-	*phi=4*pow(epsilon_eff,2.0)*viscosity;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::NormalSection{{{*/
+ void Penta::NormalSection(IssmDouble* normal,IssmDouble* xyz_list){
+ 
+@@ -2725,82 +2675,6 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Penta::ResultInterpolation{{{*/
+-void Penta::ResultInterpolation(int* pinterpolation,int output_enum){
+-
+-	Input* input=this->inputs->GetInput(output_enum);
+-
+-	/*If this input is not already in Inputs, maybe it needs to be computed?*/
+-	if(!input){
+-		switch(output_enum){
+-			case ViscousHeatingEnum:
+-				this->ViscousHeatingCreateInput();
+-				input=this->inputs->GetInput(output_enum);
+-				break;
+-			case StressTensorxxEnum: 
+-				this->ComputeStressTensor();
+-				input=this->inputs->GetInput(output_enum);
+-				break;
+-			case StressTensorxyEnum: 
+-				this->ComputeStressTensor();
+-				input=this->inputs->GetInput(output_enum);
+-				break;
+-			case StressTensorxzEnum: 
+-				this->ComputeStressTensor();
+-				input=this->inputs->GetInput(output_enum);
+-				break;
+-			case StressTensoryyEnum: 
+-				this->ComputeStressTensor();
+-				input=this->inputs->GetInput(output_enum);
+-				break;
+-			case StressTensoryzEnum: 
+-				this->ComputeStressTensor();
+-				input=this->inputs->GetInput(output_enum);
+-				break;
+-			case StressTensorzzEnum: 
+-				this->ComputeStressTensor();
+-				input=this->inputs->GetInput(output_enum);
+-				break;
+-			default:
+-				_error_("input "<<EnumToStringx(output_enum)<<" not found in element");
+-		}
+-	}
+-
+-	/*Assign output pointer*/
+-	*pinterpolation = input->GetResultInterpolation();
+-
+-}
+-/*}}}*/
+-/*FUNCTION Penta::ResultToVector{{{*/
+-void Penta::ResultToVector(Vector<IssmDouble>* vector,int output_enum){
+-
+-	Input* input=this->inputs->GetInput(output_enum);
+-	if(!input) _error_("input "<<EnumToStringx(output_enum)<<" not found in element");
+-
+-	switch(input->GetResultInterpolation()){
+-		case P0Enum:
+-			_error_("P0 not implemented yet for input "<<EnumToStringx(output_enum));
+-			break;
+-		case P1Enum:{
+-			IssmDouble  values[NUMVERTICES];
+-			int         connectivity[NUMVERTICES];
+-			int         sidlist[NUMVERTICES];
+-
+-			this->GetVertexSidList(&sidlist[0]);
+-			this->GetConnectivityList(&connectivity[0]);
+-			this->GetInputListOnVertices(&values[0],output_enum);
+-			for(int i=0;i<NUMVERTICES;i++) values[i] = values[i]/reCast<IssmDouble>(connectivity[i]);
+-
+-			vector->SetValues(NUMVERTICES,&sidlist[0],&values[0],ADD_VAL);
+-			break;
+-					}
+-		default:
+-			_error_("interpolation "<<EnumToStringx(input->GetResultInterpolation())<<" not supported yet");
+-	}
+-
+-
+-}
+-/*}}}*/
+ /*FUNCTION Penta::ResetCoordinateSystem{{{*/
+ void  Penta::ResetCoordinateSystem(void){
+ 
+@@ -3355,45 +3229,6 @@
+ 	*pnumseg  = 3;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::ViscousHeatingCreateInput {{{*/
+-void Penta::ViscousHeatingCreateInput(void){
+-
+-	/*Intermediaries*/
+-	IssmDouble phi;
+-	IssmDouble viscosity;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble epsilon[6];
+-	IssmDouble viscousheating[NUMVERTICES];
+-	IssmDouble thickness;
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+-	Input* vz_input=inputs->GetInput(VzEnum); _assert_(vz_input);
+-	Input* thickness_input=inputs->GetInput(ThicknessEnum); _assert_(thickness_input);
+-
+-	/*loop over vertices: */
+-	GaussPenta* gauss=new GaussPenta();
+-	for (int iv=0;iv<NUMVERTICES;iv++){
+-		gauss->GaussVertex(iv);
+-
+-		thickness_input->GetInputValue(&thickness,gauss);
+-
+-		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+-		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+-		GetPhi(&phi, &epsilon[0], viscosity);
+-
+-		viscousheating[iv]=phi*thickness;
+-	}
+-
+-	/*Create PentaVertex input, which will hold the basal friction:*/
+-	this->inputs->AddInput(new PentaInput(ViscousHeatingEnum,&viscousheating[0],P1Enum));
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::ViscousHeating{{{*/
+ void Penta::ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){
+ 
+@@ -5057,8 +4892,8 @@
+ 	IssmPDouble gradients[NUMVERTICES]; 
+ 	IssmDouble  value,gradient;
+ 
+-	this->GetConnectivityList(&connectivity[0]);
+-	this->GetVertexSidList(&sidlist[0]);
++	this->GetVerticesConnectivityList(&connectivity[0]);
++	this->GetVerticesSidList(&sidlist[0]);
+ 
+ 	GaussPenta* gauss=new GaussPenta();
+ 	for (int iv=0;iv<NUMVERTICES;iv++){
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16946)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16947)
+@@ -107,9 +107,6 @@
+ 		int    PressureInterpolation();
+ 		bool   IsZeroLevelset(int levelset_enum);
+ 		void   ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum);
+-
+-		void   ResultInterpolation(int* pinterpolation,int output_enum);
+-		void   ResultToVector(Vector<IssmDouble>* vector,int output_enum);
+ 		void   PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm);
+ 		void   ReduceMatrices(ElementMatrix* Ke,ElementVector* pe);
+ 		void   ResetCoordinateSystem(void);
+@@ -124,7 +121,6 @@
+ 		void   ValueP1DerivativesOnGauss(IssmDouble* dvalue,IssmDouble* values,IssmDouble* xyz_list,Gauss* gauss);
+ 		int    VertexConnectivity(int vertexindex);
+ 		void   VerticalSegmentIndices(int** pindices,int* pnumseg);
+-		void   ViscousHeatingCreateInput(void);
+ 		void   ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+ 
+ 		 #ifdef _HAVE_RESPONSES_
+@@ -212,8 +208,6 @@
+ 		void           GetAreaCoordinates(IssmDouble *area_coordinates,IssmDouble* xyz_zero,IssmDouble* xyz_list,int numpoints);
+ 
+ 		void	         GetVertexPidList(int* doflist);
+-		void           GetVertexSidList(int* sidlist);
+-		void           GetConnectivityList(int* connectivity);
+ 		int            GetElementType(void);
+ 		Input*         GetMaterialInput(int inputenum);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype);
+@@ -227,7 +221,6 @@
+ 		void           GetInputValue(IssmDouble* pvalue,Gauss* gauss,int enum_type);
+ 		void           GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype);
+ 		Node*          GetNode(int node_number);
+-		void	         GetPhi(IssmDouble* phi, IssmDouble*  epsilon, IssmDouble viscosity);
+ 		void           GetStrainRate3dHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss, Input* vx_input, Input* vy_input);
+ 		void           GetStrainRate3d(IssmDouble* epsilon,IssmDouble* xyz_list, Gauss* gauss, Input* vx_input, Input* vy_input, Input* vz_input);
+ 		Penta*         GetUpperElement(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16946)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16947)
+@@ -178,8 +178,6 @@
+ 		void        MaterialUpdateFromTemperature(void){_error_("not implemented yet");};
+ 		int         NodalValue(IssmDouble* pvalue, int index, int natureofdataenum){_error_("not implemented yet");};
+ 		void        PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm){_error_("not implemented yet");};
+-		void        ResultInterpolation(int* pinterpolation,int output_enum){_error_("not implemented");};
+-		void        ResultToVector(Vector<IssmDouble>* vector,int output_enum){_error_("not implemented");};
+ 		void        ResetCoordinateSystem(void){_error_("not implemented yet");};
+ 		void        ReduceMatrices(ElementMatrix* Ke,ElementVector* pe){_error_("not implemented yet");};
+ 		void        SetTemporaryElementType(int element_type_in){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 16946)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 16947)
+@@ -82,9 +82,58 @@
+ 	}
+ }
+ /*}}}*/
++void Element::GetPhi(IssmDouble* phi, IssmDouble*  epsilon, IssmDouble viscosity){/*{{{*/
++	/*Compute deformational heating from epsilon and viscosity */
++
++	IssmDouble epsilon_matrix[3][3];
++	IssmDouble epsilon_eff;
++	IssmDouble epsilon_sqr[3][3];
++
++	/* Build epsilon matrix */
++	epsilon_matrix[0][0]=epsilon[0];
++	epsilon_matrix[1][0]=epsilon[3];
++	epsilon_matrix[2][0]=epsilon[4];
++	epsilon_matrix[0][1]=epsilon[3];
++	epsilon_matrix[1][1]=epsilon[1];
++	epsilon_matrix[2][1]=epsilon[5];
++	epsilon_matrix[0][2]=epsilon[4];
++	epsilon_matrix[1][2]=epsilon[5];
++	epsilon_matrix[2][2]=epsilon[2];
++
++	/* Effective value of epsilon_matrix */
++	epsilon_sqr[0][0]=epsilon_matrix[0][0]*epsilon_matrix[0][0];
++	epsilon_sqr[1][0]=epsilon_matrix[1][0]*epsilon_matrix[1][0];
++	epsilon_sqr[2][0]=epsilon_matrix[2][0]*epsilon_matrix[2][0];
++	epsilon_sqr[0][1]=epsilon_matrix[0][1]*epsilon_matrix[0][1];
++	epsilon_sqr[1][1]=epsilon_matrix[1][1]*epsilon_matrix[1][1];
++	epsilon_sqr[2][1]=epsilon_matrix[2][1]*epsilon_matrix[2][1];
++	epsilon_sqr[0][2]=epsilon_matrix[0][2]*epsilon_matrix[0][2];
++	epsilon_sqr[1][2]=epsilon_matrix[1][2]*epsilon_matrix[1][2];
++	epsilon_sqr[2][2]=epsilon_matrix[2][2]*epsilon_matrix[2][2];
++	epsilon_eff=1/sqrt(2.)*sqrt(epsilon_sqr[0][0]+epsilon_sqr[0][1]+ epsilon_sqr[0][2]+ epsilon_sqr[1][0]+ epsilon_sqr[1][1]+ epsilon_sqr[1][2]+ epsilon_sqr[2][0]+ epsilon_sqr[2][1]+ epsilon_sqr[2][2]);
++
++	/*Phi = Tr(sigma * eps) 
++	 *    = Tr(sigma'* eps)
++	 *    = 2 * eps_eff * sigma'_eff
++	 *    = 4 * mu * eps_eff ^2*/
++	*phi=4.*epsilon_eff*epsilon_eff*viscosity;
++}
++/*}}}*/
+ Input* Element::GetInput(int inputenum){/*{{{*/
+ 	return inputs->GetInput(inputenum);
+ }/*}}}*/
++void Element::GetVerticesSidList(int* sidlist){/*{{{*/
++
++	int numvertices = this->GetNumberOfVertices();
++	for(int i=0;i<numvertices;i++) sidlist[i]=this->vertices[i]->Sid();
++}
++/*}}}*/
++void Element::GetVerticesConnectivityList(int* connectivity){/*{{{*/
++
++	int numvertices = this->GetNumberOfVertices();
++	for(int i=0;i<numvertices;i++) connectivity[i]=this->vertices[i]->Connectivity();
++}
++/*}}}*/
+ bool Element::IsFloating(){/*{{{*/
+ 
+ 	bool shelf;
+@@ -103,11 +152,141 @@
+ 
+ 	return shelf;
+ }/*}}}*/
++void Element::ResultInterpolation(int* pinterpolation,int output_enum){/*{{{*/
++
++	Input* input=this->inputs->GetInput(output_enum);
++
++	/*If this input is not already in Inputs, maybe it needs to be computed?*/
++	if(!input){
++		switch(output_enum){
++			case ViscousHeatingEnum:
++				this->ViscousHeatingCreateInput();
++				input=this->inputs->GetInput(output_enum);
++				break;
++			case StressTensorxxEnum: 
++				this->ComputeStressTensor();
++				input=this->inputs->GetInput(output_enum);
++				break;
++			case StressTensorxyEnum: 
++				this->ComputeStressTensor();
++				input=this->inputs->GetInput(output_enum);
++				break;
++			case StressTensorxzEnum: 
++				this->ComputeStressTensor();
++				input=this->inputs->GetInput(output_enum);
++				break;
++			case StressTensoryyEnum: 
++				this->ComputeStressTensor();
++				input=this->inputs->GetInput(output_enum);
++				break;
++			case StressTensoryzEnum: 
++				this->ComputeStressTensor();
++				input=this->inputs->GetInput(output_enum);
++				break;
++			case StressTensorzzEnum: 
++				this->ComputeStressTensor();
++				input=this->inputs->GetInput(output_enum);
++				break;
++			default:
++				_error_("input "<<EnumToStringx(output_enum)<<" not found in element");
++		}
++	}
++
++	/*Assign output pointer*/
++	*pinterpolation = input->GetResultInterpolation();
++}/*}}}*/
++void Element::ResultToVector(Vector<IssmDouble>* vector,int output_enum){/*{{{*/
++
++	Input* input=this->inputs->GetInput(output_enum);
++	if(!input) _error_("input "<<EnumToStringx(output_enum)<<" not found in element");
++
++	switch(input->GetResultInterpolation()){
++		case P0Enum:{
++			IssmDouble  value;
++			bool        bvalue;
++			Input*      input = this->GetInput(output_enum); _assert_(input);
++			switch(input->ObjectEnum()){
++				case DoubleInputEnum:
++					input->GetInputValue(&value);
++					break;
++				case BoolInputEnum:
++					input->GetInputValue(&bvalue);
++					value=reCast<IssmDouble>(bvalue);
++					break;
++				default:
++					_error_("Input of type "<<EnumToStringx(input->GetResultInterpolation())<<" not supported");
++			}
++			vector->SetValue(this->Sid(),value,INS_VAL);
++			break;
++		}
++		case P1Enum:{
++			int         numvertices = this->GetNumberOfVertices();
++			IssmDouble *values      = xNew<IssmDouble>(numvertices);
++			int        *connectivity= xNew<int>(numvertices);
++			int        *sidlist     = xNew<int>(numvertices);
++
++			this->GetVerticesSidList(sidlist);
++			this->GetVerticesConnectivityList(connectivity);
++			this->GetInputListOnVertices(values,output_enum);
++			for(int i=0;i<numvertices;i++) values[i] = values[i]/reCast<IssmDouble>(connectivity[i]);
++
++			vector->SetValues(numvertices,sidlist,values,ADD_VAL);
++
++			xDelete<IssmDouble>(values);
++			xDelete<int>(connectivity);
++			xDelete<int>(sidlist);
++			break;
++		}
++		default:
++					 _error_("interpolation "<<EnumToStringx(input->GetResultInterpolation())<<" not supported yet");
++	}
++} /*}}}*/
+ IssmDouble Element::TMeltingPoint(IssmDouble pressure){/*{{{*/
+ 	_assert_(matpar);
+ 	return this->matpar->TMeltingPoint(pressure);
+ }/*}}}*/
++void Element::ViscousHeatingCreateInput(void){/*{{{*/
+ 
++	/*Intermediaries*/
++	IssmDouble phi;
++	IssmDouble viscosity;
++	IssmDouble epsilon[6];
++	IssmDouble thickness;
++	IssmDouble *xyz_list = NULL;
++
++	/*Fetch number vertices and allocate memory*/
++	int         numvertices    = this->GetNumberOfVertices();
++	IssmDouble* viscousheating = xNew<IssmDouble>(numvertices);
++
++	/*Retrieve all inputs and parameters*/
++	this->GetVerticesCoordinatesBase(&xyz_list);
++	Input* vx_input        = this->GetInput(VxEnum); _assert_(vx_input);
++	Input* vy_input        = this->GetInput(VyEnum); _assert_(vy_input);
++	Input* vz_input        = this->GetInput(VzEnum); _assert_(vz_input);
++	Input* thickness_input = this->GetInput(ThicknessEnum); _assert_(thickness_input);
++
++	/*loop over vertices: */
++	Gauss* gauss=this->NewGauss();
++	for (int iv=0;iv<numvertices;iv++){
++		gauss->GaussVertex(iv);
++
++		thickness_input->GetInputValue(&thickness,gauss);
++
++		this->StrainRateFS(&epsilon[0],xyz_list,gauss,vx_input,vy_input,vz_input);
++		this->material->GetViscosity3dFS(&viscosity,&epsilon[0]);
++		this->GetPhi(&phi,&epsilon[0],viscosity);
++
++		viscousheating[iv]=phi*thickness;
++	}
++
++	/*Create PentaVertex input, which will hold the basal friction:*/
++	this->AddInput(ViscousHeatingEnum,viscousheating,P1Enum);
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(viscousheating);
++	delete gauss;
++}
++/*}}}*/
+ void Element::ViscosityFS(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){/*{{{*/
+ 
+ 	/*Intermediaries*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16947-16948.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16947-16948.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16947-16948.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 16947)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 16948)
+@@ -551,7 +551,7 @@
+ 						default:     _error_("Interpolation "<<EnumToStringx(interpolation)<<" not supported yet");
+ 
+ 					}
+-					Vector<IssmDouble> *vector_result = new Vector<IssmDouble>(this->vertices->NumberOfVertices());
++					Vector<IssmDouble> *vector_result = new Vector<IssmDouble>(size);
+ 
+ 					/*Fill in vector*/
+ 					for(int j=0;j<elements->Size();j++){
Index: issm/oecreview/Archive/16554-17801/ISSM-16948-16949.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16948-16949.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16948-16949.diff	(revision 17802)
@@ -0,0 +1,557 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16948)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16949)
+@@ -70,12 +70,19 @@
+ 		void GetSolutionFromInputsFS(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolutionFS(IssmDouble* solution,Element* element);
+ 		/*Coupling*/
++		ElementMatrix* CreateKMatrixSSA3d(Element* element);
++		ElementMatrix* CreateKMatrixSSA3dFriction(Element* element);
++		ElementMatrix* CreateKMatrixSSA3dViscous(Element* element);
+ 		ElementMatrix* CreateKMatrixHOFS(Element* element);
+ 		ElementMatrix* CreateKMatrixSSAHO(Element* element);
++		ElementMatrix* CreateKMatrixSSAFS(Element* element);
+ 		ElementMatrix* CreateKMatrixCouplingHOFS(Element* element);
+ 		ElementMatrix* CreateKMatrixCouplingSSAHO(Element* element);
+ 		ElementMatrix* CreateKMatrixCouplingSSAHOFriction(Element* element);
+ 		ElementMatrix* CreateKMatrixCouplingSSAHOViscous(Element* element);
++		ElementMatrix* CreateKMatrixCouplingSSAFS(Element* element);
++		ElementMatrix* CreateKMatrixCouplingSSAFSFriction(Element* element);
++		ElementMatrix* CreateKMatrixCouplingSSAFSViscous(Element* element);
+ 		ElementVector* CreatePVectorSSAHO(Element* element);
+ 		ElementVector* CreatePVectorSSAFS(Element* element);
+ 		ElementVector* CreatePVectorCouplingSSAFS(Element* element);
+@@ -86,6 +93,10 @@
+ 		ElementVector* CreatePVectorCouplingHOFSFriction(Element* element);
+ 		ElementVector* CreatePVectorCouplingHOFSViscous(Element* element);
+ 		void GetBSSAHO(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBSSAFS(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBprimeSSAFS(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBSSAFSTria(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBprimeSSAFSTria(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void InputUpdateFromSolutionHOFS(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionSSAFS(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionSSAHO(IssmDouble* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16948)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16949)
+@@ -829,6 +829,8 @@
+ 			return CreateKMatrixSSAHO(element);
+ 		case HOFSApproximationEnum: 
+ 			return CreateKMatrixHOFS(element);
++		case SSAFSApproximationEnum: 
++			return CreateKMatrixSSAFS(element);
+ 		case NoneApproximationEnum:
+ 			return NULL;
+ 		default:
+@@ -3068,6 +3070,102 @@
+ }/*}}}*/
+ 
+ /*Coupling (Tiling)*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSA3d(Element* element){/*{{{*/
++
++	/*compute all stiffness matrices for this element*/
++	ElementMatrix* Ke1=CreateKMatrixSSA3dViscous(element);
++	ElementMatrix* Ke2=CreateKMatrixSSA3dFriction(element);
++	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
++
++	/*clean-up and return*/
++	delete Ke1;
++	delete Ke2;
++	return Ke;
++}/*}}}*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSA3dFriction(Element* element){/*{{{*/
++
++	return NULL;
++}/*}}}*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSA3dViscous(Element* element){/*{{{*/
++
++	/*Constants*/
++	const int    numdof2d=2*3;
++
++	/*Intermediaries */
++	int         i,j,approximation;
++	int         dim=3;
++	IssmDouble  Jdet,viscosity,oldviscosity,newviscosity,viscosity_overshoot;
++	IssmDouble  epsilon[5],oldepsilon[5];       /* epsilon=[exx,eyy,exy,exz,eyz];*/
++	IssmDouble  epsilons[6];                    //6 for FS
++	IssmDouble  B[3][numdof2d];
++	IssmDouble  Bprime[3][numdof2d];
++	IssmDouble  D[3][3]= {0.0};                 // material matrix, simple scalar matrix.
++	IssmDouble  D_scalar;
++	IssmDouble  Ke_gg_gaussian[numdof2d][numdof2d];
++	IssmDouble  *xyz_list  = NULL;
++
++	/*Find penta on bed as this is a SSA elements: */
++	Element* pentabase=element->GetBasalElement();
++	Element* basaltria=pentabase->SpawnBasalElement();
++
++	/*Initialize Element matrix*/
++	ElementMatrix* Ke=basaltria->NewElementMatrix(SSAApproximationEnum);
++	element->GetInputValue(&approximation,ApproximationEnum);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	element->FindParam(&viscosity_overshoot,StressbalanceViscosityOvershootEnum);
++	Input* vx_input   =element->GetInput(VxEnum);       _assert_(vx_input);
++	Input* vy_input   =element->GetInput(VyEnum);       _assert_(vy_input);
++	Input* vxold_input=element->GetInput(VxPicardEnum); _assert_(vxold_input);
++	Input* vyold_input=element->GetInput(VyPicardEnum); _assert_(vyold_input);
++	Input* vz_input   =element->GetInput(VzEnum);       _assert_(vz_input);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(5);
++	Gauss* gauss_tria=new GaussTria();
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++		gauss->SynchronizeGaussBase(gauss_tria);
++
++		element->JacobianDeterminant(&Jdet, xyz_list,gauss);
++		this->GetBSSA(&B[0][0],basaltria, xyz_list, gauss_tria);
++		this->GetBSSAprime(&Bprime[0][0], basaltria,xyz_list, gauss_tria);
++
++		if(approximation==SSAHOApproximationEnum){
++			element->ViscosityHO(&viscosity,xyz_list,gauss,vx_input,vy_input);
++			element->ViscosityHO(&oldviscosity,xyz_list,gauss,vxold_input,vyold_input);
++			newviscosity=viscosity+viscosity_overshoot*(viscosity-oldviscosity);
++		}
++		else if (approximation==SSAFSApproximationEnum){
++			element->ViscosityFS(&newviscosity,dim,xyz_list,gauss,vx_input,vy_input,vz_input);
++		}
++		else _error_("approximation " << approximation << " (" << EnumToStringx(approximation) << ") not supported yet");
++
++		D_scalar=2*newviscosity*gauss->weight*Jdet;
++		for (i=0;i<3;i++) D[i][i]=D_scalar;
++
++		TripleMultiply( &B[0][0],3,numdof2d,1,
++					&D[0][0],3,3,0,
++					&Bprime[0][0],3,numdof2d,0,
++					&Ke_gg_gaussian[0][0],0);
++
++		for(i=0;i<numdof2d;i++) for(j=0;j<numdof2d;j++) Ke->values[i*numdof2d+j]+=Ke_gg_gaussian[i][j];
++	}
++
++	/*Transform Coordinate System*/
++	basaltria->TransformStiffnessMatrixCoord(Ke,XYEnum);
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	delete basaltria->material;
++	delete basaltria;
++	delete gauss_tria;
++	delete gauss;
++	return Ke;
++
++}/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixHOFS(Element* element){/*{{{*/
+ 
+ 	/*compute all stiffness matrices for this element*/
+@@ -3101,6 +3199,25 @@
+ 	delete Ke3;
+ 	return Ke;
+ }/*}}}*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSAFS(Element* element){/*{{{*/
++
++	/*compute all stiffness matrices for this element*/
++	ElementMatrix* Ke1=CreateKMatrixFS(element);
++	int indices[3]={18,19,20};
++	Ke1->StaticCondensation(3,&indices[0]);
++	int init = element->FiniteElement();
++	element->SetTemporaryElementType(P1Enum); 
++	ElementMatrix* Ke2=CreateKMatrixSSA3d(element);
++	element->SetTemporaryElementType(init); 
++	ElementMatrix* Ke3=CreateKMatrixCouplingSSAFS(element);
++	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2,Ke3);
++
++	/*clean-up and return*/
++	delete Ke1;
++	delete Ke2;
++	delete Ke3;
++	return Ke;
++}/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixCouplingHOFS(Element* element){/*{{{*/
+ 
+ 	/*Constants*/
+@@ -3345,6 +3462,131 @@
+ 	return Ke;
+ 
+ }/*}}}*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixCouplingSSAFS(Element* element){/*{{{*/
++
++	/*compute all stiffness matrices for this element*/
++	ElementMatrix* Ke1=CreateKMatrixCouplingSSAFSViscous(element);
++	ElementMatrix* Ke2=CreateKMatrixCouplingSSAFSFriction(element);
++	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
++
++	/*clean-up and return*/
++	delete Ke1;
++	delete Ke2;
++	return Ke;
++}/*}}}*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixCouplingSSAFSFriction(Element* element){/*{{{*/
++	return NULL;
++
++}/*}}}*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixCouplingSSAFSViscous(Element* element){/*{{{*/
++
++	/*Constants*/
++	const int numdofm     = 2 *3;
++	const int numdofs     = 4 *6+ 3;
++	const int numdoftotal = 2 *numdofm+numdofs;
++
++	/*Intermediaries */
++	int        i,j;
++	int        dim=3;
++	IssmDouble Jdet,viscosity,FSreconditioning,D_scalar;
++	IssmDouble B[4][numdofs];
++	IssmDouble Bprime[4][numdofm];
++	IssmDouble B2[3][numdofm];
++	IssmDouble Bprime2[3][numdofs];
++	IssmDouble D[4][4]={0.0};            // material matrix, simple scalar matrix.
++	IssmDouble D2[3][3]={0.0};            // material matrix, simple scalar matrix.
++	IssmDouble Ke_gg[numdofs][numdofm]={0.0}; //local element stiffness matrix 
++	IssmDouble Ke_gg2[numdofm][numdofs]={0.0}; //local element stiffness matrix 
++	IssmDouble Ke_gg_gaussian[numdofs][numdofm]; //stiffness matrix evaluated at the gaussian point.
++	IssmDouble Ke_gg_gaussian2[numdofm][numdofs]; //stiffness matrix evaluated at the gaussian point.
++	IssmDouble *xyz_list    = NULL;
++	Node       *node_list[20];
++
++	/*Find penta on bed as FS must be coupled to the dofs on the bed: */
++	Element* pentabase=element->GetBasalElement();
++	Element* basaltria=pentabase->SpawnBasalElement();
++
++	int vnumnodes = element->GetNumberOfNodesVelocity();
++	int pnumnodes = element->GetNumberOfNodesPressure();
++	int numnodes  = 2*vnumnodes-1+pnumnodes;
++
++	/*Prepare node list*/
++	int* cs_list = xNew<int>(2*vnumnodes+pnumnodes);
++	for(i=0;i<vnumnodes-1;i++){
++		node_list[i] = pentabase->GetNode(i);
++		cs_list[i]   = XYEnum;
++	}
++	for(i=0;i<vnumnodes;i++){
++		node_list[i+vnumnodes-1] = element->GetNode(i);
++		cs_list[i+vnumnodes-1]   = XYZEnum;
++	}
++	for(i=0;i<pnumnodes;i++){
++		node_list[2*vnumnodes-1+i] = element->GetNode(vnumnodes+i);
++		cs_list[2*vnumnodes-1+i]   = PressureEnum;
++	}
++
++	/*Initialize Element matrix and return if necessary*/
++	ElementMatrix* Ke1=element  ->NewElementMatrix(FSvelocityEnum);
++	ElementMatrix* Ke2=pentabase->NewElementMatrix(SSAApproximationEnum);
++	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
++	delete Ke1; delete Ke2;
++
++	/* Get node coordinates and dof list: */
++	element->GetVerticesCoordinates(&xyz_list);
++	element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
++	Input* vx_input=element->GetInput(VxEnum); _assert_(vx_input);
++	Input* vy_input=element->GetInput(VyEnum); _assert_(vy_input);
++	Input* vz_input=element->GetInput(VzEnum); _assert_(vz_input);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(5);
++	Gauss* gauss_tria=new GaussTria();
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++		gauss->SynchronizeGaussBase(gauss_tria);
++
++		element->JacobianDeterminant(&Jdet, xyz_list,gauss);
++		this->GetBSSAFS(&B[0][0],element,xyz_list, gauss);
++		this->GetBprimeSSAFSTria(&Bprime[0][0], basaltria,xyz_list, gauss_tria);
++		this->GetBSSAFSTria(&B2[0][0], basaltria,xyz_list, gauss_tria);
++		this->GetBprimeSSAFS(&Bprime2[0][0], element,xyz_list, gauss);
++
++		element->ViscosityFS(&viscosity,dim,xyz_list,gauss,vx_input,vy_input,vz_input);
++
++		D_scalar=2*viscosity*gauss->weight*Jdet;
++		for (i=0;i<3;i++) D[i][i]=D_scalar;
++		D[3][3]=-gauss->weight*Jdet*FSreconditioning;
++		for (i=0;i<3;i++) D2[i][i]=D_scalar;
++
++		TripleMultiply( &B[0][0],4,numdofs,1,
++					&D[0][0],4,4,0,
++					&Bprime[0][0],4,numdofm,0,
++					&Ke_gg_gaussian[0][0],0);
++
++		TripleMultiply( &B2[0][0],3,numdofm,1,
++					&D2[0][0],3,3,0,
++					&Bprime2[0][0],3,numdofs,0,
++					&Ke_gg_gaussian2[0][0],0);
++
++		for( i=0; i<numdofs; i++) for(j=0;j<numdofm; j++) Ke_gg[i][j]+=Ke_gg_gaussian[i][j];
++		for( i=0; i<numdofm; i++) for(j=0;j<numdofs; j++) Ke_gg2[i][j]+=Ke_gg_gaussian2[i][j];
++	} 
++	for(i=0;i<numdofs;i++) for(j=0;j<numdofm;j++) Ke->values[i*numdoftotal+j+numdofs]+=Ke_gg[i][j];
++	for(i=0;i<numdofm;i++) for(j=0;j<numdofs;j++) Ke->values[(i+numdofs)*numdoftotal+j]+=Ke_gg2[i][j];
++
++	/*Transform Coordinate System*/
++	element->TransformStiffnessMatrixCoord(Ke,node_list,numnodes,cs_list);
++
++	/*Clean-up and return*/
++	xDelete<int>(cs_list);
++	xDelete<IssmDouble>(xyz_list);
++	delete basaltria->material; delete basaltria;
++	delete gauss;
++	delete gauss_tria;
++	return Ke;
++
++}/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorSSAHO(Element* element){/*{{{*/
+ 
+ 	/*compute all load vectors for this element*/
+@@ -3755,6 +3997,180 @@
+ 	/*Clean-up*/
+ 	xDelete<IssmDouble>(dbasis);
+ }/*}}}*/
++void StressbalanceAnalysis::GetBSSAFS(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF2. 
++	 * For node i, Bi can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi=[ dh/dx          0       0   0 ]
++	 *          [   0           dh/dy    0   0 ]
++	 *          [ 1/2*dh/dy  1/2*dh/dx   0   0 ]
++	 *          [   0            0       0   h ]
++	 * where h is the interpolation function for node i.
++	 *
++	 * We assume B has been allocated already, of size: 5x(NDOF2*NUMNODESP1)
++	 */
++
++	int i;
++	IssmDouble dbasismini[3][7];
++	IssmDouble basis[6];
++
++	/*Get dbasis in actual coordinate system: */
++	element->NodalFunctionsMINIDerivatives(&dbasismini[0][0],xyz_list, gauss);
++	element->NodalFunctionsP1(basis,gauss);
++
++	/*Build B: */
++	for(i=0;i<6;i++){
++		B[(3*7+6)*0+3*i+0] = dbasismini[0][i];
++		B[(3*7+6)*0+3*i+1] = 0.;
++		B[(3*7+6)*0+3*i+2] = 0.;
++		B[(3*7+6)*1+3*i+0] = 0.;
++		B[(3*7+6)*1+3*i+1] = dbasismini[1][i];
++		B[(3*7+6)*1+3*i+2] = 0.;
++		B[(3*7+6)*2+3*i+0] = 0.5*dbasismini[1][i];
++		B[(3*7+6)*2+3*i+1] = 0.5*dbasismini[0][i];
++		B[(3*7+6)*2+3*i+2] = 0.;
++		B[(3*7+6)*3+3*i+0] = 0.;
++		B[(3*7+6)*3+3*i+1] = 0.;
++		B[(3*7+6)*3+3*i+2] = 0.;
++	}
++	for(i=0;i<1;i++){
++		B[(3*7+6)*0+3*(6+i)+0] = 0.;
++		B[(3*7+6)*0+3*(6+i)+1] = 0.;
++		B[(3*7+6)*0+3*(6+i)+2] = 0.;
++		B[(3*7+6)*1+3*(6+i)+0] = 0.;
++		B[(3*7+6)*1+3*(6+i)+1] = 0.;
++		B[(3*7+6)*1+3*(6+i)+2] = 0.;
++		B[(3*7+6)*2+3*(6+i)+0] = 0.;
++		B[(3*7+6)*2+3*(6+i)+1] = 0.;
++		B[(3*7+6)*2+3*(6+i)+2] = 0.;
++		B[(3*7+6)*3+3*(6+i)+0] = 0.;
++		B[(3*7+6)*3+3*(6+i)+1] = 0.;
++		B[(3*7+6)*3+3*(6+i)+2] = 0.;
++	}
++
++	for(i=0;i<6;i++){ //last column not for the bubble function
++		B[(3*7+6)*0+7*3+i] = 0;
++		B[(3*7+6)*1+7*3+i] = 0;
++		B[(3*7+6)*2+7*3+i] = 0;
++		B[(3*7+6)*3+7*3+i] = basis[i];
++	}
++}/*}}}*/
++void StressbalanceAnalysis::GetBprimeSSAFS(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute Bprime  matrix. Bprime=[Bprime1 Bprime2 Bprime3 Bprime4 Bprime5 Bprime6] where Bprimei is of size 5*NDOF2. 
++	 * For node i, Bprimei can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bprimei=[ 2*dh/dx    dh/dy   0   0 ]
++	 *               [  dh/dx    2*dh/dy  0   0 ]
++	 *               [  dh/dy     dh/dx   0   0 ]
++	 * where h is the interpolation function for node i.
++	 *
++	 * We assume Bprime has been allocated already, of size: 5x(NDOF2*NUMNODESP1)
++	 */
++
++	int    i;
++	IssmDouble dbasismini[3][7];
++
++	/*Get dbasis in actual coordinate system: */
++	element->NodalFunctionsMINIDerivatives(&dbasismini[0][0],xyz_list, gauss);
++
++	/*Build Bprime: */
++	for(i=0;i<6;i++){
++		Bprime[(3*7+6)*0+3*i+0] = 2.*dbasismini[0][i];
++		Bprime[(3*7+6)*0+3*i+1] = dbasismini[1][i];
++		Bprime[(3*7+6)*0+3*i+2] = 0.;
++		Bprime[(3*7+6)*1+3*i+0] = dbasismini[0][i];
++		Bprime[(3*7+6)*1+3*i+1] = 2.*dbasismini[1][i];
++		Bprime[(3*7+6)*1+3*i+2] = 0.;
++		Bprime[(3*7+6)*2+3*i+0] = dbasismini[1][i];
++		Bprime[(3*7+6)*2+3*i+1] = dbasismini[0][i];
++		Bprime[(3*7+6)*2+3*i+2] = 0.;
++	}
++
++	for(i=0;i<1;i++){ //Add zeros for the bubble function
++		Bprime[(3*7+6)*0+3*(6+i)+0] = 0.;
++		Bprime[(3*7+6)*0+3*(6+i)+1] = 0.;
++		Bprime[(3*7+6)*0+3*(6+i)+2] = 0.;
++		Bprime[(3*7+6)*1+3*(6+i)+0] = 0.;
++		Bprime[(3*7+6)*1+3*(6+i)+1] = 0.;
++		Bprime[(3*7+6)*1+3*(6+i)+2] = 0.;
++		Bprime[(3*7+6)*2+3*(6+i)+0] = 0.;
++		Bprime[(3*7+6)*2+3*(6+i)+1] = 0.;
++		Bprime[(3*7+6)*2+3*(6+i)+2] = 0.;
++	}
++
++	for(i=0;i<6;i++){ //last column not for the bubble function
++		Bprime[(3*7+6)*0+7*3+i] = 0.;
++		Bprime[(3*7+6)*1+7*3+i] = 0.;
++		Bprime[(3*7+6)*2+7*3+i] = 0.;
++	}
++}/*}}}*/
++void StressbalanceAnalysis::GetBSSAFSTria(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
++	 * For node i, Bi can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi=[   dN/dx         0     ]
++	 *          [       0       dN/dy   ]
++	 *          [  1/2*dN/dy  1/2*dN/dx ]
++	 * where N is the finiteelement function for node i.
++	 *
++	 * We assume B has been allocated already, of size: 3x(NDOF2*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Build B': */
++	for(int i=0;i<numnodes;i++){
++		B[2*numnodes*0+2*i+0] = dbasis[0*numnodes+i];
++		B[2*numnodes*0+2*i+1] = 0.;
++		B[2*numnodes*1+2*i+0] = 0.;
++		B[2*numnodes*1+2*i+1] = dbasis[1*numnodes+i];
++		B[2*numnodes*2+2*i+0] = 0.5*dbasis[1*numnodes+i];
++		B[2*numnodes*2+2*i+1] = 0.5*dbasis[0*numnodes+i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(dbasis);
++}/*}}}*/
++void StressbalanceAnalysis::GetBprimeSSAFSTria(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute Bprime  matrix. Bprime=[Bprime1 Bprime2 Bprime3] where Bprimei is of size 3*NDOF2. 
++	 * For node i, Bprimei can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bprimei=[  dN/dx    0   ]
++	 *               [    0    dN/dy ]
++	 *               [  dN/dy  dN/dx ]
++	 N               [  dN/dx  dN/dy ]
++	 * where N is the finiteelement function for node i.
++	 *
++	 * We assume Bprime has been allocated already, of size: 3x(NDOF2*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions*/
++	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Build Bprime: */
++	for(int i=0;i<numnodes;i++){
++		Bprime[2*numnodes*0+2*i+0] = dbasis[0*numnodes+i];
++		Bprime[2*numnodes*0+2*i+1] = 0.;
++		Bprime[2*numnodes*1+2*i+0] = 0.;
++		Bprime[2*numnodes*1+2*i+1] = dbasis[1*numnodes+i];
++		Bprime[2*numnodes*2+2*i+0] = dbasis[1*numnodes+i];
++		Bprime[2*numnodes*2+2*i+1] = dbasis[0*numnodes+i];
++		Bprime[2*numnodes*3+2*i+0] = dbasis[0*numnodes+i];
++		Bprime[2*numnodes*3+2*i+1] = dbasis[1*numnodes+i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(dbasis);
++}/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionHOFS(IssmDouble* solution,Element* element){/*{{{*/
+ 
+ 	int         i;
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16948)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16949)
+@@ -119,6 +119,7 @@
+ 		virtual void   NodalFunctionsPressure(IssmDouble* basis, Gauss* gauss)=0;
+ 		virtual void   NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss)=0;
+ 		virtual void   NodalFunctionsP1Derivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss)=0;
++		virtual void   NodalFunctionsMINIDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss)=0;
+ 		virtual void   NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss)=0;
+ 		virtual void   NormalSection(IssmDouble* normal,IssmDouble* xyz_list)=0;
+ 		virtual void   NormalTop(IssmDouble* normal,IssmDouble* xyz_list)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16948)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16949)
+@@ -286,6 +286,7 @@
+ 		void           NodalFunctionsP1(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+ 		void           NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+ 		void           NodalFunctionsP1Derivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
++		void           NodalFunctionsMINIDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void           NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+ 		void           NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss);
+ 		void           NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16948)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16949)
+@@ -2479,6 +2479,14 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Penta::NodalFunctionsMINIDerivatives{{{*/
++void Penta::NodalFunctionsMINIDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussPentaEnum);
++	this->GetNodalFunctionsMINIDerivatives(dbasis,xyz_list,(GaussPenta*)gauss);
++
++}
++/*}}}*/
+ /*FUNCTION Penta::NodalFunctionsDerivativesVelocity{{{*/
+ void Penta::NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16948)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16949)
+@@ -253,6 +253,7 @@
+ 		void           NodalFunctionsP1(IssmDouble* basis,Gauss* gauss);
+ 		void           NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+ 		void           NodalFunctionsP1Derivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
++		void           NodalFunctionsMINIDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+ 		void           NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+ 		void           NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss);
+ 		void           NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16948)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16949)
+@@ -112,6 +112,7 @@
+ 		void        NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+ 		void        NodalFunctionsP1Derivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
++		void        NodalFunctionsMINIDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		bool        NoIceInElement(){_error_("not implemented yet");};
+ 		void        NormalSection(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16949-16950.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16949-16950.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16949-16950.diff	(revision 17802)
@@ -0,0 +1,53 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16949)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16950)
+@@ -3101,7 +3101,7 @@
+ 	IssmDouble  Bprime[3][numdof2d];
+ 	IssmDouble  D[3][3]= {0.0};                 // material matrix, simple scalar matrix.
+ 	IssmDouble  D_scalar;
+-	IssmDouble  Ke_gg_gaussian[numdof2d][numdof2d];
++	IssmDouble  Ke_gg[numdof2d][numdof2d]={0.0};
+ 	IssmDouble  *xyz_list  = NULL;
+ 
+ 	/*Find penta on bed as this is a SSA elements: */
+@@ -3149,10 +3149,10 @@
+ 		TripleMultiply( &B[0][0],3,numdof2d,1,
+ 					&D[0][0],3,3,0,
+ 					&Bprime[0][0],3,numdof2d,0,
+-					&Ke_gg_gaussian[0][0],0);
++					&Ke_gg[0][0],1);
+ 
+-		for(i=0;i<numdof2d;i++) for(j=0;j<numdof2d;j++) Ke->values[i*numdof2d+j]+=Ke_gg_gaussian[i][j];
+ 	}
++	for(i=0;i<numdof2d;i++) for(j=0;j<numdof2d;j++) Ke->values[i*numdof2d+j]+=Ke_gg[i][j];
+ 
+ 	/*Transform Coordinate System*/
+ 	basaltria->TransformStiffnessMatrixCoord(Ke,XYEnum);
+@@ -3497,8 +3497,6 @@
+ 	IssmDouble D2[3][3]={0.0};            // material matrix, simple scalar matrix.
+ 	IssmDouble Ke_gg[numdofs][numdofm]={0.0}; //local element stiffness matrix 
+ 	IssmDouble Ke_gg2[numdofm][numdofs]={0.0}; //local element stiffness matrix 
+-	IssmDouble Ke_gg_gaussian[numdofs][numdofm]; //stiffness matrix evaluated at the gaussian point.
+-	IssmDouble Ke_gg_gaussian2[numdofm][numdofs]; //stiffness matrix evaluated at the gaussian point.
+ 	IssmDouble *xyz_list    = NULL;
+ 	Node       *node_list[20];
+ 
+@@ -3562,15 +3560,13 @@
+ 		TripleMultiply( &B[0][0],4,numdofs,1,
+ 					&D[0][0],4,4,0,
+ 					&Bprime[0][0],4,numdofm,0,
+-					&Ke_gg_gaussian[0][0],0);
++					&Ke_gg[0][0],1);
+ 
+ 		TripleMultiply( &B2[0][0],3,numdofm,1,
+ 					&D2[0][0],3,3,0,
+ 					&Bprime2[0][0],3,numdofs,0,
+-					&Ke_gg_gaussian2[0][0],0);
++					&Ke_gg2[0][0],1);
+ 
+-		for( i=0; i<numdofs; i++) for(j=0;j<numdofm; j++) Ke_gg[i][j]+=Ke_gg_gaussian[i][j];
+-		for( i=0; i<numdofm; i++) for(j=0;j<numdofs; j++) Ke_gg2[i][j]+=Ke_gg_gaussian2[i][j];
+ 	} 
+ 	for(i=0;i<numdofs;i++) for(j=0;j<numdofm;j++) Ke->values[i*numdoftotal+j+numdofs]+=Ke_gg[i][j];
+ 	for(i=0;i<numdofm;i++) for(j=0;j<numdofs;j++) Ke->values[(i+numdofs)*numdoftotal+j]+=Ke_gg2[i][j];
Index: issm/oecreview/Archive/16554-17801/ISSM-16950-16951.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16950-16951.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16950-16951.diff	(revision 17802)
@@ -0,0 +1,402 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16950)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16951)
+@@ -97,6 +97,10 @@
+ 		void GetBprimeSSAFS(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetBSSAFSTria(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetBprimeSSAFSTria(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetLFSSSA(IssmDouble* L,Element* element,Gauss* gauss);
++		void GetLSSAFS(IssmDouble* L,Element* element,Gauss* gauss);
++		void GetLprimeFSSSA(IssmDouble* Lprime,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetLprimeSSAFS(IssmDouble* Lprime,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void InputUpdateFromSolutionHOFS(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionSSAFS(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionSSAHO(IssmDouble* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16950)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16951)
+@@ -3085,6 +3085,18 @@
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSA3dFriction(Element* element){/*{{{*/
+ 
+ 	return NULL;
++	/*Initialize Element matrix and return if necessary*/
++	if(element->IsFloating() || !element->IsOnBed()) return NULL;
++
++	/*Build a tria element using the 3 nodes of the base of the penta. Then use 
++	 * the tria functionality to build a friction stiffness matrix on these 3
++	 * nodes: */
++	Element* basalelement = element->SpawnBasalElement();
++	ElementMatrix* Ke=CreateKMatrixSSAFriction(element);
++	basalelement->DeleteMaterials(); delete basalelement;
++
++	/*clean-up and return*/
++	return Ke;
+ }/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSA3dViscous(Element* element){/*{{{*/
+ 
+@@ -3475,11 +3487,129 @@
+ 	return Ke;
+ }/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixCouplingSSAFSFriction(Element* element){/*{{{*/
+-	return NULL;
+ 
++	/*Constants*/
++	const int numdofs   = (6+1)*3 + 6*1;
++	const int numdofm   = 6 *2;
++	const int numdof2d  = 3 *3;
++	const int numdof2dm = 3 *2;
++	const int numdoftot = 6*2 + (6+1)*3 +6; // HO + FS vel + FS Pressure
++
++	/*Intermediaries */
++	int        i,j,approximation;
++	int        dim=3;
++	IssmDouble FSreconditioning,viscosity,alpha2_gauss,Jdet2d;
++	IssmDouble bed_normal[3];
++	IssmDouble LSSAFS[8][numdof2dm];
++	IssmDouble LprimeSSAFS[8][numdofs];
++	IssmDouble DLSSAFS[8][8]={0.0};
++	IssmDouble LFSSSA[4][numdof2d];
++	IssmDouble LprimeFSSSA[4][numdof2dm];
++	IssmDouble DLFSSSA[4][4]={0.0};
++	IssmDouble Ke_drag_gaussian[numdof2dm][numdofs];
++	IssmDouble Ke_drag_gaussian2[numdof2d][numdof2dm];
++	IssmDouble *xyz_list      = NULL;
++	IssmDouble *xyz_list_tria = NULL;
++
++	/*If on water or not FS, skip stiffness: */
++	element->GetInputValue(&approximation,ApproximationEnum);
++	if(element->IsFloating() || !element->IsOnBed()) return NULL;
++
++	int vnumnodes = element->GetNumberOfNodesVelocity();
++	int pnumnodes = element->GetNumberOfNodesPressure();
++	int numnodes  = 2*vnumnodes-1+pnumnodes;
++
++	/*Prepare node list*/
++	int* cs_list = xNew<int>(2*vnumnodes+pnumnodes);
++	Node **node_list = xNew<Node*>(2*vnumnodes+pnumnodes);
++	for(i=0;i<vnumnodes-1;i++){
++		node_list[i] = element->GetNode(i);
++		cs_list[i]   = XYEnum;
++	}
++	for(i=0;i<vnumnodes;i++){
++		node_list[i+vnumnodes-1] = element->GetNode(i);
++		cs_list[i+vnumnodes-1]   = XYZEnum;
++	}
++	for(i=0;i<pnumnodes;i++){
++		node_list[2*vnumnodes-1+i] = element->GetNode(vnumnodes+i);
++		cs_list[2*vnumnodes-1+i]   = PressureEnum;
++	}
++
++	ElementMatrix* Ke1=element->NewElementMatrix(SSAApproximationEnum);
++	ElementMatrix* Ke2=element->NewElementMatrix(FSvelocityEnum);
++	ElementMatrix* Ke=new ElementMatrix(Ke1,Ke2);
++	delete Ke1; delete Ke2;
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	element->GetVerticesCoordinatesBase(&xyz_list_tria);
++	element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
++	Input* vx_input=element->GetInput(VxEnum); _assert_(vx_input);
++	Input* vy_input=element->GetInput(VyEnum); _assert_(vy_input);
++	Input* vz_input=element->GetInput(VzEnum); _assert_(vz_input);
++
++	/*build friction object, used later on: */
++	Friction* friction=new Friction(element,3);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGaussBase(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminantBase(&Jdet2d,xyz_list_tria,gauss);
++		this->GetLSSAFS(&LSSAFS[0][0], element,gauss);
++		this->GetLprimeSSAFS(&LprimeSSAFS[0][0], element,xyz_list, gauss);
++		this->GetLFSSSA(&LFSSSA[0][0],element, gauss);
++		this->GetLprimeFSSSA(&LprimeFSSSA[0][0], element,xyz_list, gauss);
++
++		element->ViscosityFS(&viscosity,dim,xyz_list,gauss,vx_input,vy_input,vz_input);
++
++		element->NormalBase(&bed_normal[0],xyz_list_tria);
++		friction->GetAlpha2(&alpha2_gauss, gauss,vx_input,vy_input,vz_input);
++
++		DLSSAFS[0][0]=alpha2_gauss*gauss->weight*Jdet2d;
++		DLSSAFS[1][1]=alpha2_gauss*gauss->weight*Jdet2d;
++		DLSSAFS[2][2]=-alpha2_gauss*gauss->weight*Jdet2d*bed_normal[0]*bed_normal[2];
++		DLSSAFS[3][3]=-alpha2_gauss*gauss->weight*Jdet2d*bed_normal[1]*bed_normal[2];
++		DLSSAFS[4][4]=-2*viscosity*gauss->weight*Jdet2d*bed_normal[0];
++		DLSSAFS[5][5]=-2*viscosity*gauss->weight*Jdet2d*bed_normal[1];
++		DLSSAFS[6][6]=FSreconditioning*gauss->weight*Jdet2d*bed_normal[0];
++		DLSSAFS[7][7]=FSreconditioning*gauss->weight*Jdet2d*bed_normal[1];
++
++		DLFSSSA[0][0]=alpha2_gauss*gauss->weight*Jdet2d;
++		DLFSSSA[1][1]=alpha2_gauss*gauss->weight*Jdet2d;
++		DLFSSSA[2][2]=-alpha2_gauss*gauss->weight*Jdet2d*bed_normal[0]*bed_normal[2];
++		DLFSSSA[3][3]=-alpha2_gauss*gauss->weight*Jdet2d*bed_normal[1]*bed_normal[2];
++
++		TripleMultiply( &LSSAFS[0][0],8,numdof2dm,1,
++					&DLSSAFS[0][0],8,8,0,
++					&LprimeSSAFS[0][0],8,numdofs,0,
++					&Ke_drag_gaussian[0][0],0);
++
++		TripleMultiply( &LFSSSA[0][0],4,numdof2d,1,
++					&DLFSSSA[0][0],4,4,0,
++					&LprimeFSSSA[0][0],4,numdof2dm,0,
++					&Ke_drag_gaussian2[0][0],0);
++		for(i=0;i<numdof2dm;i++) for(j=0;j<numdofs;j++) Ke->values[i*numdoftot+j+numdofm]+=Ke_drag_gaussian[i][j];
++		for(i=0;i<numdof2d;i++) for(j=0;j<numdof2dm;j++) Ke->values[(i+numdofm)*numdoftot+j]+=Ke_drag_gaussian2[i][j];
++	}
++
++	/*Transform Coordinate System*/
++	element->TransformStiffnessMatrixCoord(Ke,node_list,numnodes,cs_list);
++
++	/*Clean up and return*/
++	xDelete<int>(cs_list);
++	xDelete<Node*>(node_list);
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(xyz_list_tria);
++	delete gauss;
++	delete friction;
++	return Ke;
+ }/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixCouplingSSAFSViscous(Element* element){/*{{{*/
+ 
++	printf("CouplingSSAFSviscous\n");
+ 	/*Constants*/
+ 	const int numdofm     = 2 *3;
+ 	const int numdofs     = 4 *6+ 3;
+@@ -4167,6 +4297,232 @@
+ 	/*Clean-up*/
+ 	xDelete<IssmDouble>(dbasis);
+ }/*}}}*/
++void StressbalanceAnalysis::GetLSSAFS(IssmDouble* LFS,Element* element,Gauss* gauss_in){/*{{{*/
++	/*
++	 * Compute L  matrix. L=[L1 L2 L3] where Li is square and of size numdof. 
++	 * For node i, Li can be expressed in the actual coordinate system
++	 * by: 
++	 *       Li=[ h    0 ]
++	 *	 	      [ 0    h ]
++	 *	 	      [ h    0 ]
++	 *	 	      [ 0    h ]
++	 *	 	      [ h    0 ]
++	 *	 	      [ 0    h ]
++	 *	 	      [ h    0 ]
++	 *	 	      [ 0    h ]
++	 * where h is the interpolation function for node i.
++	 */
++
++	int num_dof=2;
++	IssmDouble L1L2l3[3];
++
++	/*Cast gauss to GaussPenta*/
++	_assert_(gauss_in->Enum()==GaussPentaEnum);
++	GaussPenta* gauss = dynamic_cast<GaussPenta*>(gauss_in);
++
++	/*Get L1L2l3 in actual coordinate system: */
++	L1L2l3[0]=gauss->coord1*(1-gauss->coord4)/2.0;
++	L1L2l3[1]=gauss->coord2*(1-gauss->coord4)/2.0;
++	L1L2l3[2]=gauss->coord3*(1-gauss->coord4)/2.0;
++
++	/*Build LFS: */
++	for(int i=0;i<3;i++){
++		LFS[num_dof*3*0+num_dof*i+0] = L1L2l3[i];
++		LFS[num_dof*3*0+num_dof*i+1] = 0;
++		LFS[num_dof*3*1+num_dof*i+0] = 0;
++		LFS[num_dof*3*1+num_dof*i+1] = L1L2l3[i];
++		LFS[num_dof*3*2+num_dof*i+0] = L1L2l3[i];
++		LFS[num_dof*3*2+num_dof*i+1] = 0;
++		LFS[num_dof*3*3+num_dof*i+0] = 0;
++		LFS[num_dof*3*3+num_dof*i+1] = L1L2l3[i];
++		LFS[num_dof*3*4+num_dof*i+0] = L1L2l3[i];
++		LFS[num_dof*3*4+num_dof*i+1] = 0;
++		LFS[num_dof*3*5+num_dof*i+0] = 0;
++		LFS[num_dof*3*5+num_dof*i+1] = L1L2l3[i];
++		LFS[num_dof*3*6+num_dof*i+0] = L1L2l3[i];
++		LFS[num_dof*3*6+num_dof*i+1] = 0;
++		LFS[num_dof*3*7+num_dof*i+0] = 0;
++		LFS[num_dof*3*7+num_dof*i+1] = L1L2l3[i];
++	}
++}/*}}}*/
++void StressbalanceAnalysis::GetLprimeSSAFS(IssmDouble* LprimeFS,Element* element,IssmDouble* xyz_list,Gauss* gauss_in){/*{{{*/
++	/* Compute Lprime  matrix. Lprime=[Lp1 Lp2 Lp3] where Lpi is square and of size numdof. 
++	 * For node i, Lpi can be expressed in the actual coordinate system
++	 * by: 
++	 *       Lpi=[ h    0    0   0]
++	 *		       [ 0    h    0   0]
++	 *		       [ 0    0    h   0]
++	 *		       [ 0    0    h   0]
++	 *		       [ 0    0  dh/dz 0]
++	 *		       [ 0    0  dh/dz 0]
++	 *           [ 0    0    0   h]
++	 *           [ 0    0    0   h]
++	 * where h is the interpolation function for node i.
++	 */
++	int num_dof=3;
++	int num_dof_vel=3*7;
++	int num_dof_total=3*7+1*6;
++	IssmDouble L1L2l3[3];
++	IssmDouble dbasis[3][6];
++
++	/*Cast gauss to GaussPenta*/
++	_assert_(gauss_in->Enum()==GaussPentaEnum);
++	GaussPenta* gauss = dynamic_cast<GaussPenta*>(gauss_in);
++
++	/*Get L1L2l3 in actual coordinate system: */
++	L1L2l3[0]=gauss->coord1*(1-gauss->coord4)/2.0;
++	L1L2l3[1]=gauss->coord2*(1-gauss->coord4)/2.0;
++	L1L2l3[2]=gauss->coord3*(1-gauss->coord4)/2.0;
++
++	element->NodalFunctionsP1Derivatives(&dbasis[0][0],xyz_list,gauss);
++
++	/*Build LprimeFS: */
++	for(int i=0;i<3;i++){
++		LprimeFS[num_dof_total*0+num_dof*i+0] = L1L2l3[i];
++		LprimeFS[num_dof_total*0+num_dof*i+1] = 0.;
++		LprimeFS[num_dof_total*0+num_dof*i+2] = 0.;
++		LprimeFS[num_dof_total*1+num_dof*i+0] = 0.;
++		LprimeFS[num_dof_total*1+num_dof*i+1] = L1L2l3[i];
++		LprimeFS[num_dof_total*1+num_dof*i+2] = 0.;
++		LprimeFS[num_dof_total*2+num_dof*i+0] = 0.;
++		LprimeFS[num_dof_total*2+num_dof*i+1] = 0.;
++		LprimeFS[num_dof_total*2+num_dof*i+2] = L1L2l3[i];
++		LprimeFS[num_dof_total*3+num_dof*i+0] = 0.;
++		LprimeFS[num_dof_total*3+num_dof*i+1] = 0.;
++		LprimeFS[num_dof_total*3+num_dof*i+2] = L1L2l3[i];
++		LprimeFS[num_dof_total*4+num_dof*i+0] = 0.;
++		LprimeFS[num_dof_total*4+num_dof*i+1] = 0.;
++		LprimeFS[num_dof_total*4+num_dof*i+2] = dbasis[2][i];
++		LprimeFS[num_dof_total*5+num_dof*i+0] = 0.;
++		LprimeFS[num_dof_total*5+num_dof*i+1] = 0.;
++		LprimeFS[num_dof_total*5+num_dof*i+2] = dbasis[2][i];
++		LprimeFS[num_dof_total*6+num_dof*i+0] = 0.;
++		LprimeFS[num_dof_total*6+num_dof*i+1] = 0.;
++		LprimeFS[num_dof_total*6+num_dof*i+2] = 0.;
++		LprimeFS[num_dof_total*7+num_dof*i+0] = 0.;
++		LprimeFS[num_dof_total*7+num_dof*i+1] = 0.;
++		LprimeFS[num_dof_total*7+num_dof*i+2] = 0.;
++	}
++	for(int i=3;i<7;i++){
++		LprimeFS[num_dof_total*0+num_dof*i+0] = 0.;
++		LprimeFS[num_dof_total*0+num_dof*i+1] = 0.;
++		LprimeFS[num_dof_total*0+num_dof*i+2] = 0.;
++		LprimeFS[num_dof_total*1+num_dof*i+0] = 0.;
++		LprimeFS[num_dof_total*1+num_dof*i+1] = 0.;
++		LprimeFS[num_dof_total*1+num_dof*i+2] = 0.;
++		LprimeFS[num_dof_total*2+num_dof*i+0] = 0.;
++		LprimeFS[num_dof_total*2+num_dof*i+1] = 0.;
++		LprimeFS[num_dof_total*2+num_dof*i+2] = 0.;
++		LprimeFS[num_dof_total*3+num_dof*i+0] = 0.;
++		LprimeFS[num_dof_total*3+num_dof*i+1] = 0.;
++		LprimeFS[num_dof_total*3+num_dof*i+2] = 0.;
++		LprimeFS[num_dof_total*4+num_dof*i+0] = 0.;
++		LprimeFS[num_dof_total*4+num_dof*i+1] = 0.;
++		LprimeFS[num_dof_total*4+num_dof*i+2] = 0.;
++		LprimeFS[num_dof_total*5+num_dof*i+0] = 0.;
++		LprimeFS[num_dof_total*5+num_dof*i+1] = 0.;
++		LprimeFS[num_dof_total*5+num_dof*i+2] = 0.;
++		LprimeFS[num_dof_total*6+num_dof*i+0] = 0.;
++		LprimeFS[num_dof_total*6+num_dof*i+1] = 0.;
++		LprimeFS[num_dof_total*6+num_dof*i+2] = 0.;
++		LprimeFS[num_dof_total*7+num_dof*i+0] = 0.;
++		LprimeFS[num_dof_total*7+num_dof*i+1] = 0.;
++		LprimeFS[num_dof_total*7+num_dof*i+2] = 0.;
++	}
++	for(int i=0;i<3;i++){
++		LprimeFS[num_dof_total*0+num_dof_vel+i] = 0.;
++		LprimeFS[num_dof_total*1+num_dof_vel+i] = 0.;
++		LprimeFS[num_dof_total*2+num_dof_vel+i] = 0.;
++		LprimeFS[num_dof_total*3+num_dof_vel+i] = 0.;
++		LprimeFS[num_dof_total*4+num_dof_vel+i] = 0.;
++		LprimeFS[num_dof_total*5+num_dof_vel+i] = 0.;
++		LprimeFS[num_dof_total*6+num_dof_vel+i] = L1L2l3[i];
++		LprimeFS[num_dof_total*7+num_dof_vel+i] = L1L2l3[i];
++	}
++	for(int i=3;i<6;i++){
++		LprimeFS[num_dof_total*0+num_dof_vel+i] = 0.;
++		LprimeFS[num_dof_total*1+num_dof_vel+i] = 0.;
++		LprimeFS[num_dof_total*2+num_dof_vel+i] = 0.;
++		LprimeFS[num_dof_total*3+num_dof_vel+i] = 0.;
++		LprimeFS[num_dof_total*4+num_dof_vel+i] = 0.;
++		LprimeFS[num_dof_total*5+num_dof_vel+i] = 0.;
++		LprimeFS[num_dof_total*6+num_dof_vel+i] = 0.;
++		LprimeFS[num_dof_total*7+num_dof_vel+i] = 0.;
++	}
++}/*}}}*/
++void StressbalanceAnalysis::GetLFSSSA(IssmDouble* LFS,Element* element,Gauss* gauss_in){/*{{{*/
++	/* Compute L  matrix. L=[L1 L2 L3] where Li is square and of size numdof. 
++	 * For node i, Li can be expressed in the actual coordinate system
++	 * by: 
++	 *       Li=[ h    0    0 ]
++	 *	 	      [ 0    h    0 ]
++	 *		      [ 0    0    h ]
++	 *		      [ 0    0    h ]
++	 * where h is the interpolation function for node i.
++	 */
++
++	int num_dof=3;
++	IssmDouble L1L2l3[3];
++
++	/*Cast gauss to GaussPenta*/
++	_assert_(gauss_in->Enum()==GaussPentaEnum);
++	GaussPenta* gauss = dynamic_cast<GaussPenta*>(gauss_in);
++
++	/*Get L1L2l3 in actual coordinate system: */
++	L1L2l3[0]=gauss->coord1*(1-gauss->coord4)/2.0;
++	L1L2l3[1]=gauss->coord2*(1-gauss->coord4)/2.0;
++	L1L2l3[2]=gauss->coord3*(1-gauss->coord4)/2.0;
++
++	/*Build LFS: */
++	for(int i=0;i<3;i++){
++		LFS[num_dof*3*0+num_dof*i+0] = L1L2l3[i];
++		LFS[num_dof*3*0+num_dof*i+1] = 0.;
++		LFS[num_dof*3*0+num_dof*i+2] = 0.;
++		LFS[num_dof*3*1+num_dof*i+0] = 0.;
++		LFS[num_dof*3*1+num_dof*i+1] = L1L2l3[i];
++		LFS[num_dof*3*1+num_dof*i+2] = 0.;
++		LFS[num_dof*3*2+num_dof*i+0] = 0.;
++		LFS[num_dof*3*2+num_dof*i+1] = 0.;
++		LFS[num_dof*3*2+num_dof*i+2] = L1L2l3[i];
++		LFS[num_dof*3*3+num_dof*i+0] = 0.;
++		LFS[num_dof*3*3+num_dof*i+1] = 0.;
++		LFS[num_dof*3*3+num_dof*i+2] = L1L2l3[i];
++	}
++}/*}}}*/
++void StressbalanceAnalysis::GetLprimeFSSSA(IssmDouble* LprimeFS,Element* element,IssmDouble* xyz_list,Gauss* gauss_in){/*{{{*/
++	/* Compute Lprime  matrix. Lprime=[Lp1 Lp2 Lp3] where Lpi is square and of size numdof. 
++	 * For node i, Lpi can be expressed in the actual coordinate system
++	 * by: 
++	 *       Lpi=[ h    0 ]
++	 *		       [ 0    h ]
++	 *		       [ h    0 ]
++	 *		       [ 0    h ]
++	 * where h is the interpolation function for node i.
++	 */
++	int num_dof=2;
++	IssmDouble L1L2l3[3];
++
++	/*Cast gauss to GaussPenta*/
++	_assert_(gauss_in->Enum()==GaussPentaEnum);
++	GaussPenta* gauss = dynamic_cast<GaussPenta*>(gauss_in);
++
++	/*Get L1L2l3 in actual coordinate system: */
++	L1L2l3[0]=gauss->coord1*(1-gauss->coord4)/2.0;
++	L1L2l3[1]=gauss->coord2*(1-gauss->coord4)/2.0;
++	L1L2l3[2]=gauss->coord3*(1-gauss->coord4)/2.0;
++
++	/*Build LprimeFS: */
++	for(int i=0;i<3;i++){
++		LprimeFS[num_dof*3*0+num_dof*i+0] = L1L2l3[i];
++		LprimeFS[num_dof*3*0+num_dof*i+1] = 0.;
++		LprimeFS[num_dof*3*1+num_dof*i+0] = 0.;
++		LprimeFS[num_dof*3*1+num_dof*i+1] = L1L2l3[i];
++		LprimeFS[num_dof*3*2+num_dof*i+0] = L1L2l3[i];
++		LprimeFS[num_dof*3*2+num_dof*i+1] = 0.;
++		LprimeFS[num_dof*3*3+num_dof*i+0] = 0.;
++		LprimeFS[num_dof*3*3+num_dof*i+1] = L1L2l3[i];
++	}
++}/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionHOFS(IssmDouble* solution,Element* element){/*{{{*/
+ 
+ 	int         i;
Index: issm/oecreview/Archive/16554-17801/ISSM-16951-16952.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16951-16952.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16951-16952.diff	(revision 17802)
@@ -0,0 +1,39 @@
+Index: ../trunk-jpl/test/NightlyRun/test508.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test508.m	(revision 16951)
++++ ../trunk-jpl/test/NightlyRun/test508.m	(revision 16952)
+@@ -9,7 +9,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure','Temperature','BasalforcingsMeltingRate'};
+-field_tolerances={5e-08,2e-08,5e-08,2e-08,1e-09,2e-07,5e-07};
++field_tolerances={5e-08,3e-08,5e-08,3e-08,1e-09,2e-07,8e-07};
+ field_values={...
+ 	(md.results.SteadystateSolution.Vx),...
+ 	(md.results.SteadystateSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test513.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test513.py	(revision 16951)
++++ ../trunk-jpl/test/NightlyRun/test513.py	(revision 16952)
+@@ -35,7 +35,7 @@
+ 
+ # Fields and tolerances to track changes
+ field_names     =['Gradient','Misfits','FrictionCoefficient','Pressure','Vel','Vx','Vy','Vz','Temperature','BasalforcingsMeltingRate']
+-field_tolerances=[2e-10,2e-10,1e-10,1e-10,1e-6,1e-6,1e-6,1e-6,1e-6,2e-06]
++field_tolerances=[2e-10,2e-10,1e-10,1e-10,1e-6,1e-6,1e-6,1.5e-6,1e-6,2e-06]
+ field_values=[\
+ 	md.results.SteadystateSolution.Gradient1,\
+ 	md.results.SteadystateSolution.J,\
+Index: ../trunk-jpl/test/NightlyRun/test290.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test290.py	(revision 16951)
++++ ../trunk-jpl/test/NightlyRun/test290.py	(revision 16952)
+@@ -19,7 +19,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Vx', 'Vy', 'Vz', 'Vel','Pressure'];
+-field_tolerances=[1e-7,1e-7,2e-7,1e-7,1e-7];
++field_tolerances=[1e-7,1e-7,2.5e-7,1e-7,1e-7];
+ field_values=[\
+ 	md.results.StressbalanceSolution.Vx,\
+ 	md.results.StressbalanceSolution.Vy,\
Index: issm/oecreview/Archive/16554-17801/ISSM-16952-16953.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16952-16953.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16952-16953.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/src/m/plot/radarpower.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/radarpower.m	(revision 16952)
++++ ../trunk-jpl/src/m/plot/radarpower.m	(revision 16953)
+@@ -120,7 +120,7 @@
+ 		%Read in temp.tif:
+ 		im=imread('temp.tif','TIFF');
+ 		%adjust contrast and brightness
+-		im=imadjust(im,[a b],[c d]);
++		%im=imadjust(im,[a b],[c d]);
+ 		pixelskip=max(1,ceil(posting/((x1-x0)/(size(im,2)))));
+ 		md.radaroverlay.pwr=double(flipud(im(1:pixelskip:end,1:pixelskip:end)));
+ 		md.radaroverlay.x=(x0:(x1-x0)/(size(md.radaroverlay.pwr,2)-1):x1);
+Index: ../trunk-jpl/src/m/plot/plot_section.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_section.m	(revision 16952)
++++ ../trunk-jpl/src/m/plot/plot_section.m	(revision 16953)
+@@ -60,6 +60,8 @@
+ 
+ 		if getfieldvalue(options,'sectionmean',0)==1,
+ 			disp(['Mean value of data along section: ' num2str(mean(data_s))])
++			disp(['Median value of data along section: ' num2str(median(data_s))])
++			disp(['Standard deviation of data along section: ' num2str(std(data_s))])
+ 		end
+ 
+ 		%units
Index: issm/oecreview/Archive/16554-17801/ISSM-16953-16954.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16953-16954.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16953-16954.diff	(revision 17802)
@@ -0,0 +1,414 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16953)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16954)
+@@ -391,9 +391,12 @@
+ 
+ 		int numvertices = element->GetNumberOfVertices();
+ 		Input* node_mask_input = element->GetInput(HydrologydcMaskEplactiveNodeEnum);
+-		if(node_mask_input->Max()>0.) element_active = true;
+-		else                          element_active = false;
+-
++		if(node_mask_input->Max()>0.) {
++			element_active = true;
++		}
++		else{
++			element_active = false;
++		}
+ 		element->AddInput(new BoolInput(HydrologydcMaskEplactiveEltEnum,element_active));
+ 	}
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16953)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16954)
+@@ -19,11 +19,16 @@
+ 	Vector<IssmDouble>* ug_epl=NULL; 
+ 	Vector<IssmDouble>* uf_epl=NULL;
+ 	Vector<IssmDouble>* uf_epl_sub_iter=NULL; 
++	Vector<IssmDouble>* ug_epl_sub_iter=NULL;
+ 	Vector<IssmDouble>* ug_epl_main_iter=NULL;
+ 
++
+ 	Vector<IssmDouble>* ys=NULL; 
+ 	Vector<IssmDouble>* dug=NULL;
+ 
++	//testing stuff
++	Vector<IssmDouble>* duf=NULL;
++
+ 	Matrix<IssmDouble>* Kff=NULL;
+ 	Matrix<IssmDouble>* Kfs=NULL;
+ 	Vector<IssmDouble>* pf=NULL;
+@@ -51,11 +56,18 @@
+ 	hydroconverged=false;
+ 
+ 	/*Retrieve inputs as the initial state for the non linear iteration*/
+-	GetSolutionFromInputsx(&ug_sed,femmodel);
++	GetSolutionFromInputsx(&ug_sed,femmodel);	
+ 
++	//test
++	GetSolutionFromInputsx(&uf_sed,femmodel);_assert_(uf_sed);
++
+ 	if(isefficientlayer) {
+ 		femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
+ 		GetSolutionFromInputsx(&ug_epl,femmodel);
++
++		//test
++		GetSolutionFromInputsx(&uf_epl,femmodel);_assert_(uf_epl);
++
+ 		/*Initialize the transfer input*/
+ 		HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
+ 		analysis->ElementizeEplMask(femmodel);
+@@ -71,9 +83,18 @@
+ 		//save pointer to old velocity
+ 		ug_sed_main_iter=ug_sed->Duplicate();
+ 		ug_sed->Copy(ug_sed_main_iter);
++		
++		//test
++		uf_sed_sub_iter=uf_sed->Duplicate();
++		uf_sed->Copy(uf_sed_sub_iter);
++
+ 		if(isefficientlayer){
+ 			ug_epl_main_iter=ug_epl->Duplicate();
+ 			ug_epl->Copy(ug_epl_main_iter);
++			//test
++			ug_epl_sub_iter=ug_epl->Duplicate();
++			ug_epl->Copy(ug_epl_sub_iter);
++
+ 		}
+ 
+ 		femmodel->SetCurrentConfiguration(HydrologyDCInefficientAnalysisEnum);
+@@ -94,9 +115,9 @@
+ 			delete uf_sed;
+ 			Solverx(&uf_sed,Kff,pf,uf_sed_sub_iter,df,femmodel->parameters);
+ 			delete Kff; delete pf; delete df;
+-			delete uf_sed_sub_iter;
+-			uf_sed_sub_iter=uf_sed->Duplicate();
+-			uf_sed->Copy(uf_sed_sub_iter);
++			/* delete uf_sed_sub_iter; */
++			/* uf_sed_sub_iter=uf_sed->Duplicate(); */
++			/* uf_sed->Copy(uf_sed_sub_iter); */
+ 			delete ug_sed;
+ 			Mergesolutionfromftogx(&ug_sed,uf_sed,ys,femmodel->nodes,femmodel->parameters); delete ys;
+ 			InputUpdateFromSolutionx(femmodel,ug_sed);
+@@ -109,9 +130,30 @@
+ 					_error_("   maximum number of Sediment iterations (" << hydro_maxiter << ") exceeded");
+ 				}
+ 			}
++
+ 			sedcount++;
+ 
++			//testing stuff
+ 			if(sedconverged){
++				sedconverged=false;
++				duf=uf_sed_sub_iter->Duplicate();_assert_(duf);
++				uf_sed_sub_iter->Copy(duf);_assert_(uf_sed_sub_iter);
++				duf->AYPX(uf_sed,-1.0);
++				ndu_sed=duf->Norm(NORM_TWO);
++				delete duf;
++				nu_sed=uf_sed_sub_iter->Norm(NORM_TWO);
++				if (xIsNan<IssmDouble>(ndu_sed) || xIsNan<IssmDouble>(nu_sed)) _error_("convergence criterion is NaN!");
++				if((ndu_sed/nu_sed)<eps_hyd){
++				if(VerboseConvergence()) _printf0_("   # Inner sediment convergence achieve \n");
++					sedconverged=true;
++				}
++			}
++			delete uf_sed_sub_iter;
++			uf_sed_sub_iter=uf_sed->Duplicate();_assert_(uf_sed_sub_iter);
++			uf_sed->Copy(uf_sed_sub_iter);_assert_(uf_sed);
++			//end of the crap
++
++			if(sedconverged){
+ 				if(isefficientlayer){
+ 				 	/*Updating Nodal Mask*/
+ 					HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
+@@ -162,7 +204,7 @@
+ 				delete uf_epl;
+ 				Solverx(&uf_epl,Kff,pf,uf_epl_sub_iter,df,femmodel->parameters);
+ 				delete Kff; delete pf; delete df;
+-				delete uf_epl_sub_iter; 
++				delete uf_epl_sub_iter;
+ 				uf_epl_sub_iter=uf_epl->Duplicate();
+ 				uf_epl->Copy(uf_epl_sub_iter);
+ 				delete ug_epl; 
+@@ -170,6 +212,11 @@
+ 				InputUpdateFromSolutionx(femmodel,ug_epl);
+ 				ConstraintsStatex(&constraints_converged,&num_unstable_constraints,femmodel);
+ 				femmodel->HydrologyEPLupdateDomainx();			
++					/* /\*Updating Nodal Mask*\/ */
++					/* HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis(); */
++					/* analysis->ElementizeEplMask(femmodel); */
++					/* delete analysis; */
++					/* femmodel->HydrologyTransferx(); */
+ 
+ 				if (!eplconverged){
+ 					if(VerboseConvergence()) _printf0_("   # EPL unstable constraints = " << num_unstable_constraints << "\n");
+@@ -182,8 +229,27 @@
+ 				}
+ 				eplcount++;
+ 
++				//testing stuff
+ 				if(eplconverged){
++					eplconverged=false;
++					dug=ug_epl_sub_iter->Duplicate();_assert_(dug);
++					ug_epl_sub_iter->Copy(dug);_assert_(ug_epl_sub_iter);
++					dug->AYPX(ug_epl,-1.0);
++					ndu_epl=dug->Norm(NORM_TWO);
++					delete dug;
++					nu_epl=ug_epl_sub_iter->Norm(NORM_TWO);
++					
++					if (xIsNan<IssmDouble>(ndu_epl) || xIsNan<IssmDouble>(nu_epl)) _error_("convergence criterion is NaN!");
++					if (ndu_epl==0.0 && nu_epl==0.0) nu_epl=1.0e-6; /*Hacking the case where the EPL is used but empty*/
++					if((ndu_epl/nu_epl)<eps_hyd)eplconverged=true;
++				}
++				delete ug_epl_sub_iter;
++				ug_epl_sub_iter=ug_epl->Duplicate();_assert_(ug_epl_sub_iter);
++				ug_epl->Copy(ug_epl_sub_iter);_assert_(ug_epl);
++				//end of the crap
+ 
++				if(eplconverged){
++
+ 					/*Updating Nodal Mask*/
+ 					HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
+ 					analysis->ElementizeEplMask(femmodel);
+Index: ../trunk-jpl/src/c/cores/hydrology_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/hydrology_core.cpp	(revision 16953)
++++ ../trunk-jpl/src/c/cores/hydrology_core.cpp	(revision 16954)
+@@ -93,8 +93,8 @@
+ 			if(save_results && ((i+1)%output_frequency==0 || (i+1)==nsteps || i==0)){
+ 				if(VerboseSolution()) _printf0_("   saving results \n");
+ 				if(isefficientlayer){
+-					int outputs[8] = {SedimentHeadEnum,SedimentHeadResidualEnum,EplHeadEnum,HydrologydcMaskEplactiveNodeEnum,EplHeadSlopeXEnum,EplHeadSlopeYEnum,HydrologydcEplThicknessEnum,WaterTransferEnum};
+-					femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],8);
++					int outputs[9] = {SedimentHeadEnum,SedimentHeadResidualEnum,EplHeadEnum,HydrologydcMaskEplactiveNodeEnum,HydrologydcMaskEplactiveEltEnum,EplHeadSlopeXEnum,EplHeadSlopeYEnum,HydrologydcEplThicknessEnum,WaterTransferEnum};
++					femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],9);
+ 				}
+ 				else{
+ 					int outputs[2] = {SedimentHeadEnum,SedimentHeadResidualEnum};
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16953)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16954)
+@@ -275,8 +275,8 @@
+ 		#endif
+ 
+ 		#ifdef _HAVE_HYDROLOGY_
++		virtual void GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index)=0;
+ 		virtual void GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode)=0;
+-		virtual void GetHydrologyDCInefficientHmax(IssmDouble* ph_max, int index)=0;
+ 		virtual void GetHydrologyTransfer(Vector<IssmDouble>* transfer)=0; 
+ 		virtual void HydrologyEPLGetMask(Vector<IssmDouble>* mask)=0;
+ 		virtual void HydrologyEPLGetActive(Vector<IssmDouble>* active)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16953)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16954)
+@@ -6543,7 +6543,6 @@
+ 		water_input->GetInputValue(&water_load,gauss);
+ 		transfer_input->GetInputValue(&transfer,gauss);
+ 		scalar = Jdet*gauss->weight*(water_load+transfer);
+-		//printf("are we loading: load,%e ,transfer,%e\n",water_load, transfer);
+ 		if(reCast<bool,IssmDouble>(dt)) scalar = scalar*dt;
+ 		for(int i=0;i<numnodes;i++) pe->values[i]+=scalar*basis[i];
+ 
+@@ -6725,70 +6724,70 @@
+ }
+ /*}}}*/
+ /*FUNCTION Tria::GetHydrologyDCInefficientHmax{{{*/
+-void  Tria::GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode){
+-
+-		int        hmax_flag;
+-		IssmDouble h_max;
+-		IssmDouble rho_ice,rho_water;
+-		IssmDouble thickness,bed;
+-		/*Get the flag to the limitation method*/
+-		this->parameters->FindParam(&hmax_flag,HydrologydcSedimentlimitFlagEnum);
+-
+-		/*Switch between the different cases*/
+-		switch(hmax_flag){
+-			case 0:
+-				h_max=1.0e+10;
+-				break;
+-			case 1:
+-				parameters->FindParam(&h_max,HydrologydcSedimentlimitEnum);
+-				break;
+-			case 2:
+-				rho_ice=matpar->GetRhoIce();
+-				rho_water=matpar->GetRhoFreshwater();
+-				this->GetInputValue(&thickness,innode,ThicknessEnum);
+-				this->GetInputValue(&bed,innode,BedEnum);
+-				h_max=((rho_ice*thickness)/rho_water)+bed;
+-				break;
+-			case 3:
+-				_error_("Using normal stress  not supported yet");
+-				break;
+-			default:
+-				_error_("no case higher than 3 for SedimentlimitFlag");
+-		}
+-		/*Assign output pointer*/
+-		*ph_max=h_max;
++void  Tria::GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index){
++	
++	int        hmax_flag;
++	IssmDouble h_max;
++	IssmDouble rho_ice,rho_water;
++	IssmDouble thickness,bed;
++	/*Get the flag to the limitation method*/
++	this->parameters->FindParam(&hmax_flag,HydrologydcSedimentlimitFlagEnum);
++	
++	/*Switch between the different cases*/
++	switch(hmax_flag){
++	case 0:
++		h_max=1.0e+10;
++		break;
++	case 1:
++		parameters->FindParam(&h_max,HydrologydcSedimentlimitEnum);
++		break;
++	case 2:
++		rho_ice=matpar->GetRhoIce();
++		rho_water=matpar->GetRhoFreshwater();
++		this->GetInputValue(&thickness,this->nodes[index],ThicknessEnum);
++		this->GetInputValue(&bed,this->nodes[index],BedEnum);
++		h_max=((rho_ice*thickness)/rho_water)+bed;
++		break;
++	case 3:
++		_error_("Using normal stress  not supported yet");
++		break;
++	default:
++		_error_("no case higher than 3 for SedimentlimitFlag");
++	}
++	/*Assign output pointer*/
++	*ph_max=h_max;
+ }
+ /*}}}*/
+ /*FUNCTION Tria::GetHydrologyDCInefficientHmax{{{*/
+-void  Tria::GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index){
+-
++void  Tria::GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode){
++	
+ 	int        hmax_flag;
+ 	IssmDouble h_max;
+ 	IssmDouble rho_ice,rho_water;
+ 	IssmDouble thickness,bed;
+ 	/*Get the flag to the limitation method*/
+ 	this->parameters->FindParam(&hmax_flag,HydrologydcSedimentlimitFlagEnum);
+-
++	
+ 	/*Switch between the different cases*/
+ 	switch(hmax_flag){
+-		case 0:
+-			h_max=1.0e+10;
+-			break;
+-		case 1:
+-			parameters->FindParam(&h_max,HydrologydcSedimentlimitEnum);
+-			break;
+-		case 2:
+-			rho_ice=matpar->GetRhoIce();
+-			rho_water=matpar->GetRhoFreshwater();
+-			this->GetInputValue(&thickness,this->nodes[index],ThicknessEnum);
+-			this->GetInputValue(&bed,this->nodes[index],BedEnum);
+-			h_max=((rho_ice*thickness)/rho_water)+bed;
+-			break;
+-		case 3:
+-			_error_("Using normal stress  not supported yet");
+-			break;
+-		default:
+-			_error_("no case higher than 3 for SedimentlimitFlag");
++	case 0:
++		h_max=1.0e+10;
++		break;
++	case 1:
++		parameters->FindParam(&h_max,HydrologydcSedimentlimitEnum);
++		break;
++	case 2:
++		rho_ice=matpar->GetRhoIce();
++		rho_water=matpar->GetRhoFreshwater();
++		this->GetInputValue(&thickness,innode,ThicknessEnum);
++		this->GetInputValue(&bed,innode,BedEnum);
++		h_max=((rho_ice*thickness)/rho_water)+bed;
++		break;
++	case 3:
++		_error_("Using normal stress  not supported yet");
++		break;
++	default:
++		_error_("no case higher than 3 for SedimentlimitFlag");
+ 	}
+ 	/*Assign output pointer*/
+ 	*ph_max=h_max;
+@@ -6830,7 +6829,6 @@
+ 			active_element_input=inputs->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);
+ 			active_element_input->GetInputValue(&active_element);
+ 
+-			GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveNodeEnum);
+ 			GetInputListOnVertices(&sed_head[0],SedimentHeadEnum); 
+ 			GetInputListOnVertices(&epl_head[0],EplHeadEnum);
+ 			GetInputListOnVertices(&epl_thickness[0],HydrologydcEplThicknessEnum);
+@@ -6860,7 +6858,7 @@
+ 						wh_trans=epl_specificstoring[i]*epl_thickness[i]*sed_trans*(epl_head[i]-sed_head[i])/(leakage*sed_thick);				
+ 						
+ 						/*No transfer if the sediment head is allready at the maximum*/
+-						this->GetHydrologyDCInefficientHmax(&h_max,nodes[i]);
++						this->GetHydrologyDCInefficientHmax(&h_max,i);
+ 						if(sed_head[i]>=h_max)wh_trans=0.0;
+ 					}
+ 					/*EPL head lower than sediment head, transfer from the sediment to the epl*/
+@@ -6869,6 +6867,11 @@
+ 					}
+ 					/*Assign output pointer*/
+ 					transfer->SetValue(doflist[i],wh_trans,INS_VAL);
++					/* if(nodes[i]->id>=54){ */
++					/* 	printf("%i %e %e %e \n",nodes[i]->id-54,wh_trans,sed_head[i],epl_head[i]); */
++					/* } */
++					/* else{*/
++					/* 	printf("%i %e %e %e \n",nodes[i]->id,wh_trans,sed_head[i],epl_head[i]); */
+ 				}
+ 			}
+ 			break;
+@@ -6889,7 +6892,7 @@
+ 	IssmDouble active[numnodes];
+ 
+ 	GetInputListOnVertices(&active[0],HydrologydcMaskEplactiveNodeEnum);
+-
++	
+ 	for(int i=0;i<numnodes;i++) flag+=active[i];
+ 
+ 	if(flag>0.){
+@@ -6900,7 +6903,6 @@
+ 	else{
+ 		/*Do not do anything: at least one node is active for this element but this element is not solved for*/
+ 	}
+-
+ }
+ /*}}}*/
+ /*FUNCTION Tria::HydrologyEPLGetMask{{{*/
+@@ -6938,11 +6940,11 @@
+ 			vec_mask->SetValue(nodes[i]->Sid(),1.,INS_VAL);
+ 		}
+ 		/*If epl thickness gets under 0, close the layer*/
+-		else if(epl_thickness[i]<0.0){
+-			vec_mask->SetValue(nodes[i]->Sid(),0.,INS_VAL);
+-		}
++		/* else if(epl_thickness[i]<0.0){ */
++		/* 	vec_mask->SetValue(nodes[i]->Sid(),0.,INS_VAL); */
++		/* } */
+ 		/*Increase of the efficient system is needed if the epl head reach the maximum value (sediment max value for now)*/
+-		this->GetHydrologyDCInefficientHmax(&h_max,nodes[i]);
++		this->GetHydrologyDCInefficientHmax(&h_max,i);
+ 		if(eplhead[i]>=h_max && this->AnyActive()){
+ 			for(j=0;j<numdof;j++){
+ 				if(old_active[j]>0.){
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16953)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16954)
+@@ -342,8 +342,8 @@
+ 		ElementVector* CreatePVectorHydrologyDCEfficient(void);
+ 		ElementVector* CreatePVectorL2ProjectionEPL(void);
+ 		void           CreateHydrologyWaterVelocityInput(void);
++		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index);
+ 		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode);
+-		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index);
+ 		void           GetHydrologyTransfer(Vector<IssmDouble>* transfer);
+ 		void           HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
+ 		void           HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask);
Index: issm/oecreview/Archive/16554-17801/ISSM-16954-16955.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16954-16955.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16954-16955.diff	(revision 17802)
@@ -0,0 +1,65 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16954)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16955)
+@@ -3520,8 +3520,8 @@
+ 	int numnodes  = 2*vnumnodes-1+pnumnodes;
+ 
+ 	/*Prepare node list*/
+-	int* cs_list = xNew<int>(2*vnumnodes+pnumnodes);
+-	Node **node_list = xNew<Node*>(2*vnumnodes+pnumnodes);
++	int* cs_list = xNew<int>(2*vnumnodes-1+pnumnodes);
++	Node **node_list = xNew<Node*>(2*vnumnodes-1+pnumnodes);
+ 	for(i=0;i<vnumnodes-1;i++){
+ 		node_list[i] = element->GetNode(i);
+ 		cs_list[i]   = XYEnum;
+@@ -3609,7 +3609,6 @@
+ }/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixCouplingSSAFSViscous(Element* element){/*{{{*/
+ 
+-	printf("CouplingSSAFSviscous\n");
+ 	/*Constants*/
+ 	const int numdofm     = 2 *3;
+ 	const int numdofs     = 4 *6+ 3;
+@@ -3628,7 +3627,6 @@
+ 	IssmDouble Ke_gg[numdofs][numdofm]={0.0}; //local element stiffness matrix 
+ 	IssmDouble Ke_gg2[numdofm][numdofs]={0.0}; //local element stiffness matrix 
+ 	IssmDouble *xyz_list    = NULL;
+-	Node       *node_list[20];
+ 
+ 	/*Find penta on bed as FS must be coupled to the dofs on the bed: */
+ 	Element* pentabase=element->GetBasalElement();
+@@ -3639,23 +3637,24 @@
+ 	int numnodes  = 2*vnumnodes-1+pnumnodes;
+ 
+ 	/*Prepare node list*/
+-	int* cs_list = xNew<int>(2*vnumnodes+pnumnodes);
++	int* cs_list     = xNew<int>(2*vnumnodes-1+pnumnodes);
++	Node **node_list = xNew<Node*>(2*vnumnodes-1+pnumnodes);
+ 	for(i=0;i<vnumnodes-1;i++){
+-		node_list[i] = pentabase->GetNode(i);
+-		cs_list[i]   = XYEnum;
++		node_list[vnumnodes+pnumnodes+i] = pentabase->GetNode(i);
++		cs_list[vnumnodes+pnumnodes+i]   = XYEnum;
+ 	}
+ 	for(i=0;i<vnumnodes;i++){
+-		node_list[i+vnumnodes-1] = element->GetNode(i);
+-		cs_list[i+vnumnodes-1]   = XYZEnum;
++		node_list[i] = element->GetNode(i);
++		cs_list[i]   = XYZEnum;
+ 	}
+ 	for(i=0;i<pnumnodes;i++){
+-		node_list[2*vnumnodes-1+i] = element->GetNode(vnumnodes+i);
+-		cs_list[2*vnumnodes-1+i]   = PressureEnum;
++		node_list[vnumnodes+i] = element->GetNode(vnumnodes+i);
++		cs_list[vnumnodes+i]   = PressureEnum;
+ 	}
+ 
+ 	/*Initialize Element matrix and return if necessary*/
+-	ElementMatrix* Ke1=element  ->NewElementMatrix(FSvelocityEnum);
+-	ElementMatrix* Ke2=pentabase->NewElementMatrix(SSAApproximationEnum);
++	ElementMatrix* Ke1=element->NewElementMatrix(FSvelocityEnum);
++	ElementMatrix* Ke2=pentabase->NewElementMatrixCoupling(6,SSAApproximationEnum);
+ 	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
+ 	delete Ke1; delete Ke2;
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16955-16956.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16955-16956.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16955-16956.diff	(revision 17802)
@@ -0,0 +1,64 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16955)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16956)
+@@ -194,6 +194,7 @@
+ 		virtual Gauss* NewGaussTop(int order)=0;
+ 		virtual ElementVector*  NewElementVector(int approximation_enum=NoneApproximationEnum)=0;
+ 		virtual ElementMatrix*  NewElementMatrix(int approximation_enum=NoneApproximationEnum)=0;
++		virtual ElementMatrix*  NewElementMatrixCoupling(int number_nodes,int approximation_enum=NoneApproximationEnum)=0;
+ 		virtual void   InputScale(int enum_type,IssmDouble scale_factor)=0;
+ 		virtual void   GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum)=0;
+ 		virtual IssmDouble TimeAdapt()=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16955)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16956)
+@@ -282,6 +282,7 @@
+ 		Gauss*         NewGaussTop(int order);
+ 		ElementVector* NewElementVector(int approximation_enum);
+ 		ElementMatrix* NewElementMatrix(int approximation_enum);
++		ElementMatrix* NewElementMatrixCoupling(int number_nodes,int approximation_enum){_error_("not implemented yet");};
+ 		void           NodalFunctions(IssmDouble* basis,Gauss* gauss);
+ 		void           NodalFunctionsP1(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+ 		void           NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16955)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16956)
+@@ -2447,6 +2447,11 @@
+ 	return new ElementMatrix(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
+ }
+ /*}}}*/
++/*FUNCTION Penta::NewElementMatrixCoupling{{{*/
++ElementMatrix* Penta::NewElementMatrixCoupling(int number_nodes,int approximation_enum){
++	return new ElementMatrix(nodes,number_nodes,this->parameters,approximation_enum);
++}
++/*}}}*/
+ /*FUNCTION Penta::NodalFunctions{{{*/
+ void Penta::NodalFunctions(IssmDouble* basis, Gauss* gauss){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16955)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16956)
+@@ -249,6 +249,7 @@
+ 		Gauss*         NewGaussTop(int order);
+ 		ElementVector* NewElementVector(int approximation_enum);
+ 		ElementMatrix* NewElementMatrix(int approximation_enum);
++		ElementMatrix* NewElementMatrixCoupling(int number_nodes,int approximation_enum);
+ 		void           NodalFunctions(IssmDouble* basis,Gauss* gauss);
+ 		void           NodalFunctionsP1(IssmDouble* basis,Gauss* gauss);
+ 		void           NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16955)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16956)
+@@ -151,6 +151,7 @@
+ 		Gauss*      NewGaussTop(int order){_error_("not implemented yet");};
+ 		ElementVector* NewElementVector(int approximation_enum);
+ 		ElementMatrix* NewElementMatrix(int approximation_enum);
++		ElementMatrix* NewElementMatrixCoupling(int number_nodes,int approximation_enum){_error_("not implemented yet");};
+ 		int         VertexConnectivity(int vertexindex){_error_("not implemented yet");};
+ 		void        VerticalSegmentIndices(int** pindices,int* pnumseg){_error_("not implemented yet");};
+ 		void        ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-16956-16957.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16956-16957.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16956-16957.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/src/m/os/oshostname.m
+===================================================================
+--- ../trunk-jpl/src/m/os/oshostname.m	(revision 16956)
++++ ../trunk-jpl/src/m/os/oshostname.m	(revision 16957)
+@@ -6,16 +6,18 @@
+ %
+ 
+ if ispc(),
+-	[status,hostname]=system('hostname');
++	[status,hostname]=system('hostname < /dev/null');
+ 	if status, 
+ 		error('oshostname error message: could not run hostname command on windows os');
+ 	end
+ else
+-	[status,hostname]=system(['hostname -s | sed ''s/-//g''']);
++	%See http://www.mathworks.com/help/matlab/ref/system.html "tips" section
++	%We need to add < /dev/null otherwise what is in the clipboard is added
++	[status,hostname]=system('hostname < /dev/null');
++	hostname = strrep(hostname,'-','')
+ 	if status, 
+ 		error('oshostname error message: could not run hostname command on *nix os');
+ 	end
+-
+ end
+ 
+ %remove carriage return and blank spaces
Index: issm/oecreview/Archive/16554-17801/ISSM-16957-16958.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16957-16958.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16957-16958.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/os/oshostname.m
+===================================================================
+--- ../trunk-jpl/src/m/os/oshostname.m	(revision 16957)
++++ ../trunk-jpl/src/m/os/oshostname.m	(revision 16958)
+@@ -14,7 +14,7 @@
+ 	%See http://www.mathworks.com/help/matlab/ref/system.html "tips" section
+ 	%We need to add < /dev/null otherwise what is in the clipboard is added
+ 	[status,hostname]=system('hostname < /dev/null');
+-	hostname = strrep(hostname,'-','')
++	hostname = strrep(hostname,'-','');
+ 	if status, 
+ 		error('oshostname error message: could not run hostname command on *nix os');
+ 	end
Index: issm/oecreview/Archive/16554-17801/ISSM-16958-16959.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16958-16959.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16958-16959.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/os/oshostname.m
+===================================================================
+--- ../trunk-jpl/src/m/os/oshostname.m	(revision 16958)
++++ ../trunk-jpl/src/m/os/oshostname.m	(revision 16959)
+@@ -6,7 +6,7 @@
+ %
+ 
+ if ispc(),
+-	[status,hostname]=system('hostname < /dev/null');
++	[status,hostname]=system('hostname');
+ 	if status, 
+ 		error('oshostname error message: could not run hostname command on windows os');
+ 	end
Index: issm/oecreview/Archive/16554-17801/ISSM-16959-16960.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16959-16960.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16959-16960.diff	(revision 17802)
@@ -0,0 +1,65 @@
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16959)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16960)
+@@ -94,7 +94,6 @@
+ 			//test
+ 			ug_epl_sub_iter=ug_epl->Duplicate();
+ 			ug_epl->Copy(ug_epl_sub_iter);
+-
+ 		}
+ 
+ 		femmodel->SetCurrentConfiguration(HydrologyDCInefficientAnalysisEnum);
+@@ -138,15 +137,16 @@
+ 				sedconverged=false;
+ 				duf=uf_sed_sub_iter->Duplicate();_assert_(duf);
+ 				uf_sed_sub_iter->Copy(duf);_assert_(uf_sed_sub_iter);
+-				duf->AYPX(uf_sed,-1.0);
++				duf->AYPX(uf_sed,-1.0);_assert_(duf);
+ 				ndu_sed=duf->Norm(NORM_TWO);
+-				delete duf;
+ 				nu_sed=uf_sed_sub_iter->Norm(NORM_TWO);
+ 				if (xIsNan<IssmDouble>(ndu_sed) || xIsNan<IssmDouble>(nu_sed)) _error_("convergence criterion is NaN!");
++				if (ndu_sed==0.0 && nu_sed==0.0) nu_sed=1.0e-6; /*Hacking the case where the EPL is used but empty*/
+ 				if((ndu_sed/nu_sed)<eps_hyd){
+ 				if(VerboseConvergence()) _printf0_("   # Inner sediment convergence achieve \n");
+ 					sedconverged=true;
+ 				}
++				delete duf;
+ 			}
+ 			delete uf_sed_sub_iter;
+ 			uf_sed_sub_iter=uf_sed->Duplicate();_assert_(uf_sed_sub_iter);
+@@ -165,6 +165,7 @@
+ 				InputUpdateFromConstantx(femmodel,sedconverged,ConvergedEnum);
+ 				InputUpdateFromSolutionx(femmodel,ug_sed);
+ 				InputUpdateFromConstantx(femmodel,sediment_kmax,HydrologySedimentKmaxEnum);
++				delete uf_sed_sub_iter;
+ 				break;
+ 			}
+ 		}
+@@ -259,6 +260,7 @@
+ 					InputUpdateFromConstantx(femmodel,eplconverged,ConvergedEnum);
+ 					InputUpdateFromConstantx(femmodel,sediment_kmax,MeltingOffsetEnum);
+ 					InputUpdateFromSolutionx(femmodel,ug_epl);
++					delete ug_epl_sub_iter;
+ 					break;
+ 				}
+ 			}
+@@ -319,7 +321,7 @@
+ 		hydrocount++;
+ 		if(hydroconverged)break;
+ 	}
+-
++	
+ 	InputUpdateFromSolutionx(femmodel,ug_sed);
+ 	if(isefficientlayer)InputUpdateFromSolutionx(femmodel,ug_epl);
+ 
+@@ -328,7 +330,6 @@
+ 	delete ug_sed;
+ 	delete uf_sed;
+ 	delete uf_epl;
+-	delete uf_sed_sub_iter;
+ 	delete uf_epl_sub_iter;
+-	//delete dug;
++
+ }
Index: issm/oecreview/Archive/16554-17801/ISSM-16960-16961.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16960-16961.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16960-16961.diff	(revision 17802)
@@ -0,0 +1,46 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16960)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16961)
+@@ -3506,8 +3506,8 @@
+ 	IssmDouble LFSSSA[4][numdof2d];
+ 	IssmDouble LprimeFSSSA[4][numdof2dm];
+ 	IssmDouble DLFSSSA[4][4]={0.0};
+-	IssmDouble Ke_drag_gaussian[numdof2dm][numdofs];
+-	IssmDouble Ke_drag_gaussian2[numdof2d][numdof2dm];
++	IssmDouble Ke_drag[numdof2dm][numdofs];
++	IssmDouble Ke_drag2[numdof2d][numdof2dm];
+ 	IssmDouble *xyz_list      = NULL;
+ 	IssmDouble *xyz_list_tria = NULL;
+ 
+@@ -3585,16 +3585,17 @@
+ 		TripleMultiply( &LSSAFS[0][0],8,numdof2dm,1,
+ 					&DLSSAFS[0][0],8,8,0,
+ 					&LprimeSSAFS[0][0],8,numdofs,0,
+-					&Ke_drag_gaussian[0][0],0);
++					&Ke_drag[0][0],1);
+ 
+ 		TripleMultiply( &LFSSSA[0][0],4,numdof2d,1,
+ 					&DLFSSSA[0][0],4,4,0,
+ 					&LprimeFSSSA[0][0],4,numdof2dm,0,
+-					&Ke_drag_gaussian2[0][0],0);
+-		for(i=0;i<numdof2dm;i++) for(j=0;j<numdofs;j++) Ke->values[i*numdoftot+j+numdofm]+=Ke_drag_gaussian[i][j];
+-		for(i=0;i<numdof2d;i++) for(j=0;j<numdof2dm;j++) Ke->values[(i+numdofm)*numdoftot+j]+=Ke_drag_gaussian2[i][j];
++					&Ke_drag2[0][0],1);
+ 	}
+ 
++	for(i=0;i<numdof2dm;i++) for(j=0;j<numdofs;j++) Ke->values[i*numdoftot+j+numdofm]+=Ke_drag[i][j];
++	for(i=0;i<numdof2d;i++) for(j=0;j<numdof2dm;j++) Ke->values[(i+numdofm)*numdoftot+j]+=Ke_drag2[i][j];
++		
+ 	/*Transform Coordinate System*/
+ 	element->TransformStiffnessMatrixCoord(Ke,node_list,numnodes,cs_list);
+ 
+@@ -3916,7 +3917,7 @@
+ 		element->ViscosityFS(&viscosity,dim,xyz_list,gauss,vx_input,vy_input,vz_input);
+ 		vzHO_input->GetInputDerivativeValue(&dw[0],xyz_list,gauss);
+ 
+-		for(i=0;i<vnumnodes;i++){
++		for(i=0;i<6;i++){
+ 			pe->values[i*3+0]+=-Jdet*gauss->weight*viscosity*dw[0]*dbasis[2][i];
+ 			pe->values[i*3+1]+=-Jdet*gauss->weight*viscosity*dw[1]*dbasis[2][i];
+ 			pe->values[i*3+2]+=-Jdet*gauss->weight*viscosity*(dw[0]*dbasis[0][i]+dw[1]*dbasis[1][i]+2*dw[2]*dbasis[2][i]);
Index: issm/oecreview/Archive/16554-17801/ISSM-16961-16962.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16961-16962.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16961-16962.diff	(revision 17802)
@@ -0,0 +1,23 @@
+Index: ../trunk-jpl/src/m/mesh/bamg.py
+===================================================================
+--- ../trunk-jpl/src/m/mesh/bamg.py	(revision 16961)
++++ ../trunk-jpl/src/m/mesh/bamg.py	(revision 16962)
+@@ -244,13 +244,14 @@
+ 		if options.exist('RequiredVertices'):
+ 
+ 			#recover RequiredVertices
+-			requiredvertices=float(options.getfieldvalue('RequiredVertices'))    #for some reason, it is of class "single"
++			requiredvertices=options.getfieldvalue('RequiredVertices')    #for some reason, it is of class "single"
+ 			if numpy.size(requiredvertices,axis=1)==2:
+ 				requiredvertices=numpy.hstack((requiredvertices,4.*numpy.ones((numpy.size(requiredvertices,axis=0),1))))
+-	
++			
++
+ 			#only keep those inside
+-			flags=ContourToNodes(requiredvertices[:,0],domain[0],0)
+-			requiredvertices=requiredvertices[numpy.nonzero(flags),:]
++			flags=ContourToNodes(requiredvertices[:,0],requiredvertices[:,1],domainfile,0)[0]
++			requiredvertices=requiredvertices[numpy.nonzero(flags)[0],:]
+ 
+ 			#Add all points to bamg_geometry
+ 			nods=numpy.size(requiredvertices,axis=0)
Index: issm/oecreview/Archive/16554-17801/ISSM-16962-16963.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16962-16963.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16962-16963.diff	(revision 17802)
@@ -0,0 +1,166 @@
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16962)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 16963)
+@@ -57,17 +57,12 @@
+ 
+ 	/*Retrieve inputs as the initial state for the non linear iteration*/
+ 	GetSolutionFromInputsx(&ug_sed,femmodel);	
++	Reducevectorgtofx(&uf_sed, ug_sed, femmodel->nodes,femmodel->parameters);
+ 
+-	//test
+-	GetSolutionFromInputsx(&uf_sed,femmodel);_assert_(uf_sed);
+-
+ 	if(isefficientlayer) {
+ 		femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
+ 		GetSolutionFromInputsx(&ug_epl,femmodel);
+ 
+-		//test
+-		GetSolutionFromInputsx(&uf_epl,femmodel);_assert_(uf_epl);
+-
+ 		/*Initialize the transfer input*/
+ 		HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
+ 		analysis->ElementizeEplMask(femmodel);
+@@ -85,8 +80,8 @@
+ 		ug_sed->Copy(ug_sed_main_iter);
+ 		
+ 		//test
+-		uf_sed_sub_iter=uf_sed->Duplicate();
+-		uf_sed->Copy(uf_sed_sub_iter);
++		/* uf_sed_sub_iter=uf_sed->Duplicate(); */
++		/* uf_sed->Copy(uf_sed_sub_iter); */
+ 
+ 		if(isefficientlayer){
+ 			ug_epl_main_iter=ug_epl->Duplicate();
+@@ -108,15 +103,14 @@
+ 		/*Iteration on the sediment layer*/
+ 		sedconverged=false;
+ 		for(;;){
++			uf_sed_sub_iter=uf_sed->Duplicate();_assert_(uf_sed_sub_iter);
++			uf_sed->Copy(uf_sed_sub_iter);
+ 			SystemMatricesx(&Kff,&Kfs,&pf,&df,&sediment_kmax,femmodel);
+ 			CreateNodalConstraintsx(&ys,femmodel->nodes,HydrologyDCInefficientAnalysisEnum);
+ 			Reduceloadx(pf,Kfs,ys); delete Kfs;
+ 			delete uf_sed;
+ 			Solverx(&uf_sed,Kff,pf,uf_sed_sub_iter,df,femmodel->parameters);
+ 			delete Kff; delete pf; delete df;
+-			/* delete uf_sed_sub_iter; */
+-			/* uf_sed_sub_iter=uf_sed->Duplicate(); */
+-			/* uf_sed->Copy(uf_sed_sub_iter); */
+ 			delete ug_sed;
+ 			Mergesolutionfromftogx(&ug_sed,uf_sed,ys,femmodel->nodes,femmodel->parameters); delete ys;
+ 			InputUpdateFromSolutionx(femmodel,ug_sed);
+@@ -132,26 +126,22 @@
+ 
+ 			sedcount++;
+ 
+-			//testing stuff
+ 			if(sedconverged){
+ 				sedconverged=false;
+ 				duf=uf_sed_sub_iter->Duplicate();_assert_(duf);
+-				uf_sed_sub_iter->Copy(duf);_assert_(uf_sed_sub_iter);
+-				duf->AYPX(uf_sed,-1.0);_assert_(duf);
++				uf_sed_sub_iter->Copy(duf);
++				duf->AYPX(uf_sed,-1.0);
+ 				ndu_sed=duf->Norm(NORM_TWO);
++				delete duf;
+ 				nu_sed=uf_sed_sub_iter->Norm(NORM_TWO);
+ 				if (xIsNan<IssmDouble>(ndu_sed) || xIsNan<IssmDouble>(nu_sed)) _error_("convergence criterion is NaN!");
+ 				if (ndu_sed==0.0 && nu_sed==0.0) nu_sed=1.0e-6; /*Hacking the case where the EPL is used but empty*/
+ 				if((ndu_sed/nu_sed)<eps_hyd){
+-				if(VerboseConvergence()) _printf0_("   # Inner sediment convergence achieve \n");
++					if(VerboseConvergence()) _printf0_("   # Inner sediment convergence achieve \n");
+ 					sedconverged=true;
+ 				}
+-				delete duf;
+ 			}
+ 			delete uf_sed_sub_iter;
+-			uf_sed_sub_iter=uf_sed->Duplicate();_assert_(uf_sed_sub_iter);
+-			uf_sed->Copy(uf_sed_sub_iter);_assert_(uf_sed);
+-			//end of the crap
+ 
+ 			if(sedconverged){
+ 				if(isefficientlayer){
+@@ -165,7 +155,6 @@
+ 				InputUpdateFromConstantx(femmodel,sedconverged,ConvergedEnum);
+ 				InputUpdateFromSolutionx(femmodel,ug_sed);
+ 				InputUpdateFromConstantx(femmodel,sediment_kmax,HydrologySedimentKmaxEnum);
+-				delete uf_sed_sub_iter;
+ 				break;
+ 			}
+ 		}
+@@ -198,7 +187,9 @@
+ 
+ 				//updating mask after the computation of the epl thickness (Allow to close too thin EPL)
+ 				femmodel->HydrologyEPLupdateDomainx();
+-
++				ug_epl_sub_iter=ug_epl->Duplicate();_assert_(ug_epl_sub_iter);
++				ug_epl->Copy(ug_epl_sub_iter);_assert_(ug_epl);
++				
+ 				SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
+ 				CreateNodalConstraintsx(&ys,femmodel->nodes,HydrologyDCEfficientAnalysisEnum);
+ 				Reduceloadx(pf,Kfs,ys); delete Kfs;
+@@ -213,11 +204,6 @@
+ 				InputUpdateFromSolutionx(femmodel,ug_epl);
+ 				ConstraintsStatex(&constraints_converged,&num_unstable_constraints,femmodel);
+ 				femmodel->HydrologyEPLupdateDomainx();			
+-					/* /\*Updating Nodal Mask*\/ */
+-					/* HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis(); */
+-					/* analysis->ElementizeEplMask(femmodel); */
+-					/* delete analysis; */
+-					/* femmodel->HydrologyTransferx(); */
+ 
+ 				if (!eplconverged){
+ 					if(VerboseConvergence()) _printf0_("   # EPL unstable constraints = " << num_unstable_constraints << "\n");
+@@ -230,11 +216,11 @@
+ 				}
+ 				eplcount++;
+ 
+-				//testing stuff
++
+ 				if(eplconverged){
+ 					eplconverged=false;
+ 					dug=ug_epl_sub_iter->Duplicate();_assert_(dug);
+-					ug_epl_sub_iter->Copy(dug);_assert_(ug_epl_sub_iter);
++					ug_epl_sub_iter->Copy(dug);
+ 					dug->AYPX(ug_epl,-1.0);
+ 					ndu_epl=dug->Norm(NORM_TWO);
+ 					delete dug;
+@@ -245,9 +231,6 @@
+ 					if((ndu_epl/nu_epl)<eps_hyd)eplconverged=true;
+ 				}
+ 				delete ug_epl_sub_iter;
+-				ug_epl_sub_iter=ug_epl->Duplicate();_assert_(ug_epl_sub_iter);
+-				ug_epl->Copy(ug_epl_sub_iter);_assert_(ug_epl);
+-				//end of the crap
+ 
+ 				if(eplconverged){
+ 
+@@ -260,7 +243,6 @@
+ 					InputUpdateFromConstantx(femmodel,eplconverged,ConvergedEnum);
+ 					InputUpdateFromConstantx(femmodel,sediment_kmax,MeltingOffsetEnum);
+ 					InputUpdateFromSolutionx(femmodel,ug_epl);
+-					delete ug_epl_sub_iter;
+ 					break;
+ 				}
+ 			}
+@@ -270,7 +252,7 @@
+ 		/*System convergence check*/
+ 		if(!hydroconverged){
+ 			//compute norm(du)/norm(u)
+-			dug=ug_sed->Duplicate(); _assert_(dug);
++			dug=ug_sed_main_iter->Duplicate(); _assert_(dug);
+ 			ug_sed_main_iter->Copy(dug);	
+ 			dug->AYPX(ug_sed,-1.0);
+ 			ndu_sed=dug->Norm(NORM_TWO); 
+@@ -291,8 +273,8 @@
+ 					}
+ 				}
+ 				else{
+-					dug=ug_epl->Duplicate();_assert_(dug); 
+-					ug_epl_main_iter->Copy(dug);_assert_(ug_epl_main_iter); 
++					dug=ug_epl_main_iter->Duplicate();_assert_(dug); 
++					ug_epl_main_iter->Copy(dug); 
+ 					dug->AYPX(ug_epl,-1.0);
+ 					ndu_epl=dug->Norm(NORM_TWO); 
+ 					delete dug;
Index: issm/oecreview/Archive/16554-17801/ISSM-16963-16964.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16963-16964.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16963-16964.diff	(revision 17802)
@@ -0,0 +1,37 @@
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 16963)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 16964)
+@@ -97,5 +97,6 @@
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+ void FreeSurfaceTopAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	element->InputUpdateFromSolutionOneDof(solution,SurfaceEnum);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 16963)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 16964)
+@@ -99,5 +99,5 @@
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+ void FreeSurfaceBaseAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	_error_("not implemented yet");
++	element->InputUpdateFromSolutionOneDof(solution,BedEnum);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 16963)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 16964)
+@@ -46,5 +46,8 @@
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+ void ExtrudeFromTopAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	int inputenum;
++	element->FindParam(&inputenum,InputToExtrudeEnum);
++	element->InputUpdateFromSolutionOneDof(solution,inputenum);
+ }/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16964-16965.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16964-16965.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16964-16965.diff	(revision 17802)
@@ -0,0 +1,42 @@
+Index: ../trunk-jpl/src/c/shared/Bamg/BigPrimeNumber.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Bamg/BigPrimeNumber.cpp	(revision 16964)
++++ ../trunk-jpl/src/c/shared/Bamg/BigPrimeNumber.cpp	(revision 16965)
+@@ -6,27 +6,27 @@
+ 	long BigPrimeNumber(long n){
+ 		/*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/AGoodNumberPrimeWith)*/
+ 
+-		//list of big prime numbers
++		/*list of big prime numbers*/
+ 		const long BigPrimeNumber[] ={ 567890359L,
+ 			567890431L,  567890437L,  567890461L,  567890471L,
+ 			567890483L,  567890489L,  567890497L,  567890507L,
+ 			567890591L,  567890599L,  567890621L,  567890629L , 0};
+ 
+-		//initialize o and pi
+-		long o =0;
+-		long pi=BigPrimeNumber[1];
++		/*initialize o and pi*/
++		long o  = 0;
++		long pi = BigPrimeNumber[1];
+ 
+-		//loop until BigPrimeNumber[i]==0 (end of BigPrimeNumber)
++		/*loop until BigPrimeNumber[i]==0 (end of BigPrimeNumber)*/
+ 		for (int i=0; BigPrimeNumber[i]; i++){
+ 
+-			//compute r, rest of the remainder of the division of BigPrimeNumber[i] by n
++			/*compute r, remainder of the division of BigPrimeNumber[i] by n*/
+ 			long r = BigPrimeNumber[i] % n;
+ 
+ 			/*compute oo = min ( r , n-r , |n - 2r|, |n-3r|)*/
+-			long oo =Min(Min(r,n-r),Min(Abs(n-2*r),Abs(n-3*r)));
+-			if ( o < oo){
+-				o=oo;
+-				pi=BigPrimeNumber[i];
++			long oo = Min(Min(r,n-r),Min(Abs(n-2*r),Abs(n-3*r)));
++			if(o < oo){
++				o  = oo;
++				pi = BigPrimeNumber[i];
+ 			}
+ 		}
+ 		return pi; 
Index: issm/oecreview/Archive/16554-17801/ISSM-16965-16966.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16965-16966.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16965-16966.diff	(revision 17802)
@@ -0,0 +1,84 @@
+Index: ../trunk-jpl/test/NightlyRun/runme.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/runme.m	(revision 16965)
++++ ../trunk-jpl/test/NightlyRun/runme.m	(revision 16966)
+@@ -12,7 +12,7 @@
+ %      'id'            followed by the list of ids requested
+ %      'exclude'       ids to be excluded from the test
+ %      'benchmark'     'all' (all of them)
+-%                      'nightly' (nightly run/ daily run)
++%                      'nightly' (nightly run)
+ %                      'ismip'  : validation of ismip-hom tests
+ %                      'eismint': validation of eismint tests
+ %                      'thermal': validation of thermal tests
+@@ -64,7 +64,7 @@
+ % }}}
+ %GET output {{{
+ output=getfieldvalue(options,'output','none');
+-if ~ismember(output,{'nightly','daily','none'})
++if ~ismember(output,{'nightly','none'})
+ 	disp('runme warning: output not supported, defaulting to test ''none''')
+ 	output='none';
+ end
+@@ -238,17 +238,12 @@
+ 						fprintf(fid,'\n------------------------------------------------------------------\n');
+ 						fclose(fid);
+ 						disp(sprintf(['FAILURE difference: N/A test id: %i test name: %s field: %s'],id,id_string,fieldname));
+-					elseif strcmpi(output,'daily');
+-						fid=fopen([ISSM_DIR '/dailylog/matlaberror.log'], 'at');
+-						fprintf(fid,'%s',message);
+-						fprintf(fid,'\n------------------------------------------------------------------\n');
+-						fclose(fid);
+-						disp(sprintf(['FAILURE difference: N/A test id: %i test name: %s field: %s'],id,id_string,fieldname));
+ 					else
+ 						disp(sprintf(['FAILURE difference: N/A test id: %i test name: %s field: %s'],id,id_string,fieldname));
+-						rethrow(me2);
++						fprintf('%s',message);
+ 						if(getfieldvalue(options,'stoponerror',0)), disp('STOP'); return; end
+ 					end
++					continue;
+ 				end
+ 			end
+ 		end
+@@ -265,12 +260,6 @@
+ 			fprintf(fid,'\n------------------------------------------------------------------\n');
+ 			fclose(fid);
+ 			disp(sprintf(['FAILURE difference: N/A test id: %i test name: %s field: %s'],id,id_string,'N/A'));
+-		elseif strcmpi(output,'daily');
+-			fid=fopen([ISSM_DIR '/dailylog/matlaberror.log'], 'at');
+-			fprintf(fid,'%s',message);
+-			fprintf(fid,'\n------------------------------------------------------------------\n');
+-			fclose(fid);
+-			disp(sprintf(['FAILURE difference: N/A test id: %i test name: %s field: %s'],id,id_string,'N/A'));
+ 		else
+ 			disp(sprintf(['FAILURE difference: N/A test id: %i test name: %s field: %s'],id,id_string,'N/A'));
+ 			rethrow(me);
+Index: ../trunk-jpl/test/NightlyRun/test119.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test119.m	(revision 16965)
++++ ../trunk-jpl/test/NightlyRun/test119.m	(revision 16966)
+@@ -1,17 +1,17 @@
+ 
+ %Simple mesh
+-md=bamg(model(),'domain','../Exp/Square.exp','hmax',100000.);
++md=bamg(model(),'domain','../Exp/Square.exp','hmax',100000.,'rand',false);
+ x1=md.mesh.x;
+ y1=md.mesh.y;
+ 
+ %hVertices
+-md=bamg(model(),'domain','../Exp/Square.exp','hmax',300000.,'hVertices',[10000. 100000. 400000. 100000.]');
++md=bamg(model(),'domain','../Exp/Square.exp','hmax',300000.,'hVertices',[10000. 100000. 400000. 100000.]','rand',false);
+ x2=md.mesh.x;
+ y2=md.mesh.y;
+ 
+ %big mesh
+ t0=clock;
+-md=bamg(model(),'domain','../Exp/Square.exp','hmax',3000.);
++md=bamg(model(),'domain','../Exp/Square.exp','hmax',3000.,'rand',false);
+ nbelements=md.mesh.numberofelements;
+ elapsedtime=etime(clock,t0);
+ 
+Index: ../trunk-jpl/test/Archives/Archive119.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-16966-16967.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16966-16967.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16966-16967.diff	(revision 17802)
@@ -0,0 +1,180 @@
+Index: ../trunk-jpl/src/c/bamg/BamgOpts.cpp
+===================================================================
+--- ../trunk-jpl/src/c/bamg/BamgOpts.cpp	(revision 16966)
++++ ../trunk-jpl/src/c/bamg/BamgOpts.cpp	(revision 16967)
+@@ -19,6 +19,7 @@
+ 	this->nbsmooth=0;
+ 	this->omega=0;
+ 	this->power=0;
++	this->random=0;
+ 	this->verbose=0;
+ 
+ 	this->Crack=0;
+Index: ../trunk-jpl/src/c/bamg/Mesh.h
+===================================================================
+--- ../trunk-jpl/src/c/bamg/Mesh.h	(revision 16966)
++++ ../trunk-jpl/src/c/bamg/Mesh.h	(revision 16967)
+@@ -76,7 +76,7 @@
+ 			I2 R2ToI2(const R2 & P) const;
+ 			R2 I2ToR2(const I2 & P) const;
+ 			void AddVertex(BamgVertex & s,Triangle * t,Icoor2 *  =0) ;
+-			void Insert();
++			void Insert(bool random);
+ 			void Echo(void);
+ 			void ForceBoundary();
+ 			void FindSubDomain(int OutSide=0);
+@@ -91,7 +91,7 @@
+ 			void MakeQuadrangles(double costheta);
+ 			void MakeBamgQuadtree();
+ 			void NewPoints(Mesh &,BamgOpts* bamgopts,int KeepVertices=1);
+-			long InsertNewPoints(long nbvold,long & NbTSwap) ; 
++			long InsertNewPoints(long nbvold,long & NbTSwap,bool random); 
+ 			void TrianglesRenumberBySubDomain(bool justcompress=false);
+ 			void SmoothingVertex(int =3,double=0.3);
+ 			Metric MetricAt (const R2 &) const;
+Index: ../trunk-jpl/src/c/bamg/BamgOpts.h
+===================================================================
+--- ../trunk-jpl/src/c/bamg/BamgOpts.h	(revision 16966)
++++ ../trunk-jpl/src/c/bamg/BamgOpts.h	(revision 16967)
+@@ -24,6 +24,7 @@
+ 		int     nbsmooth;
+ 		double  omega;
+ 		double  power;
++		bool    random;
+ 		int     verbose;
+ 
+ 		/*Flags*/
+Index: ../trunk-jpl/src/c/bamg/Mesh.cpp
+===================================================================
+--- ../trunk-jpl/src/c/bamg/Mesh.cpp	(revision 16966)
++++ ../trunk-jpl/src/c/bamg/Mesh.cpp	(revision 16967)
+@@ -2774,7 +2774,7 @@
+ 	}
+ 	/*}}}*/
+ 	/*FUNCTION Mesh::Insert{{{*/
+-	void Mesh::Insert() {
++	void Mesh::Insert(bool random) {
+ 		/*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/Insert)*/
+ 
+ 		/*Insert points in the existing Geometry*/
+@@ -2821,7 +2821,8 @@
+ 
+ 		//Get Prime number
+ 		const long PrimeNumber= BigPrimeNumber(nbv);
+-		int   k0=rand()%nbv; 
++		int temp = rand(); if(random) temp = 756804110;
++		int  k0=temp%nbv; 
+ 
+ 		//Build orderedvertices
+ 		for (i=0; i<nbv; i++){
+@@ -2903,30 +2904,10 @@
+ 			_printf_("      NbSwap of insertion: " << NbSwap << "\n");
+ 			_printf_("      NbSwap/nbv:          " << NbSwap/nbv << "\n");
+ 		}
+-
+-#ifdef NBLOOPOPTIM
+-
+-		k0 = rand()%nbv ; 
+-		for (int is4=0; is4<nbv; is4++) 
+-		 orderedvertices[is4]= &vertices[k0 = (k0 + PrimeNumber)% nbv];
+-
+-		for(int Nbloop=0;Nbloop<NBLOOPOPTIM;Nbloop++){
+-			long  NbSwap = 0;
+-			for (int is1=0; is1<nbv; is1++) 
+-			 NbSwap += orderedvertices[is1]->Optim(0,0);
+-			if (verbose>3) {
+-				_printf_("      Optim Loop: " << Nbloop << "\n");
+-				_printf_("      NbSwap/nbv:          " << NbSwap/nbv << "\n");
+-			}
+-			if(!NbSwap) break;
+-		}
+-		CreateSingleVertexToTriangleConnectivity(); 
+-		// because we break the TriangleContainingTheVertex
+-#endif
+ 	}
+ 	/*}}}*/
+ 	/*FUNCTION Mesh::InsertNewPoints{{{*/
+-	long Mesh::InsertNewPoints(long nbvold,long & NbTSwap) {
++	long Mesh::InsertNewPoints(long nbvold,long & NbTSwap,bool random) {
+ 		/*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/InsertNewPoints)*/
+ 
+ 		long int verbose=0;
+@@ -2947,7 +2928,8 @@
+ 		/*construction of a random order*/
+ 		const long PrimeNumber= BigPrimeNumber(nbv)  ;
+ 		//remainder of the division of rand() by nbvnew
+-		long k3 = rand()%nbvnew;
++		int  temp = rand(); if(!random) temp = 1098566905;
++		long k3 = temp%nbvnew;
+ 		//loop over the new points
+ 		for (int is3=0; is3<nbvnew; is3++){
+ 			register long j=nbvold +(k3 = (k3+PrimeNumber)%nbvnew);
+@@ -3211,7 +3193,7 @@
+ 				}
+ 			}
+ 			Bh.CreateSingleVertexToTriangleConnectivity();     
+-			InsertNewPoints(nbvold,NbTSwap)   ;            
++			InsertNewPoints(nbvold,NbTSwap,bamgopts->random);
+ 		}  
+ 		else Bh.CreateSingleVertexToTriangleConnectivity();     
+ 
+@@ -3269,7 +3251,7 @@
+ 				  } // end loop for each edge 
+ 			  }// for triangle   
+ 
+-			if (!InsertNewPoints(nbvold,NbTSwap)) break;
++			if (!InsertNewPoints(nbvold,NbTSwap,bamgopts->random)) break;
+ 			for (i=nbtold;i<nbt;i++) first_np_or_next_t[i]=iter;
+ 			Headt = nbt; // empty list 
+ 
+@@ -4230,7 +4212,7 @@
+ 	maxnbt=2*maxnbv-2; // for filling The Holes and quadrilaterals 
+ 
+ 	/*Insert Vertices*/
+-	Insert();
++	Insert(true);
+ }
+ /*}}}*/
+ 	/*FUNCTION Mesh::TriangulateFromGeom0{{{*/
+@@ -4533,7 +4515,7 @@
+ 		if (verbose>4) _printf_("      -- current number of vertices = " << nbv << "\n");
+ 		if (verbose>3) _printf_("      Creating initial Constrained Delaunay Triangulation...\n");
+ 		if (verbose>3) _printf_("         Inserting boundary points\n");
+-		Insert();
++		Insert(bamgopts->random);
+ 
+ 		//Force the boundary
+ 		if (verbose>3) _printf_("         Forcing boundaries\n");
+@@ -4861,7 +4843,7 @@
+ 		if (verbose>4) _printf_("      -- current number of vertices = " << nbv << "\n");
+ 		if (verbose>3) _printf_("      Creating initial Constrained Delaunay Triangulation...\n");
+ 		if (verbose>3) _printf_("         Inserting boundary points\n");
+-		Insert();
++		Insert(bamgopts->random);
+ 
+ 		//Force the boundary
+ 		if (verbose>3) _printf_("         Forcing boundaries\n");
+Index: ../trunk-jpl/src/m/mesh/bamg.py
+===================================================================
+--- ../trunk-jpl/src/m/mesh/bamg.py	(revision 16966)
++++ ../trunk-jpl/src/m/mesh/bamg.py	(revision 16967)
+@@ -308,6 +308,7 @@
+ 	bamg_options['power']=options.getfieldvalue('power',1.)
+ 	bamg_options['splitcorners']=options.getfieldvalue('splitcorners',1)
+ 	bamg_options['geometricalmetric']=options.getfieldvalue('geometricalmetric',0)
++	bamg_options['random']=options.getfieldvalue('rand',True)
+ 	bamg_options['verbose']=options.getfieldvalue('verbose',1)
+ 	#}}}
+ 
+Index: ../trunk-jpl/src/m/mesh/bamg.m
+===================================================================
+--- ../trunk-jpl/src/m/mesh/bamg.m	(revision 16966)
++++ ../trunk-jpl/src/m/mesh/bamg.m	(revision 16967)
+@@ -324,6 +324,7 @@
+ bamg_options.power=getfieldvalue(options,'power',1.);
+ bamg_options.splitcorners=getfieldvalue(options,'splitcorners',1);
+ bamg_options.geometricalmetric=getfieldvalue(options,'geometricalmetric',0);
++bamg_options.random=getfieldvalue(options,'rand',true);
+ bamg_options.verbose=getfieldvalue(options,'verbose',1);
+ %}}}
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16967-16968.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16967-16968.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16967-16968.diff	(revision 17802)
@@ -0,0 +1,24 @@
+Index: ../trunk-jpl/src/wrappers/python/io/FetchPythonData.cpp
+===================================================================
+--- ../trunk-jpl/src/wrappers/python/io/FetchPythonData.cpp	(revision 16967)
++++ ../trunk-jpl/src/wrappers/python/io/FetchPythonData.cpp	(revision 16968)
+@@ -688,6 +688,7 @@
+ 	FetchData(&bamgopts->nbsmooth,PyDict_GetItemString(py_dict,"nbsmooth"));
+ 	FetchData(&bamgopts->omega,PyDict_GetItemString(py_dict,"omega"));
+ 	FetchData(&bamgopts->power,PyDict_GetItemString(py_dict,"power"));
++	FetchData(&bamgopts->random,PyDict_GetItemString(py_dict,"random"));
+ 	FetchData(&bamgopts->verbose,PyDict_GetItemString(py_dict,"verbose"));
+ 
+ 	FetchData(&bamgopts->Crack,PyDict_GetItemString(py_dict,"Crack"));
+Index: ../trunk-jpl/src/wrappers/matlab/io/FetchMatlabData.cpp
+===================================================================
+--- ../trunk-jpl/src/wrappers/matlab/io/FetchMatlabData.cpp	(revision 16967)
++++ ../trunk-jpl/src/wrappers/matlab/io/FetchMatlabData.cpp	(revision 16968)
+@@ -544,6 +544,7 @@
+ 	FetchData(&bamgopts->nbsmooth,mxGetField(dataref,0,"nbsmooth"));
+ 	FetchData(&bamgopts->omega,mxGetField(dataref,0,"omega"));
+ 	FetchData(&bamgopts->power,mxGetField(dataref,0,"power"));
++	FetchData(&bamgopts->random,mxGetField(dataref,0,"random"));
+ 	FetchData(&bamgopts->verbose,mxGetField(dataref,0,"verbose"));
+ 
+ 	FetchData(&bamgopts->Crack,mxGetField(dataref,0,"Crack"));
Index: issm/oecreview/Archive/16554-17801/ISSM-16968-16969.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16968-16969.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16968-16969.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/bamg/Mesh.cpp
+===================================================================
+--- ../trunk-jpl/src/c/bamg/Mesh.cpp	(revision 16968)
++++ ../trunk-jpl/src/c/bamg/Mesh.cpp	(revision 16969)
+@@ -2821,7 +2821,7 @@
+ 
+ 		//Get Prime number
+ 		const long PrimeNumber= BigPrimeNumber(nbv);
+-		int temp = rand(); if(random) temp = 756804110;
++		int temp = rand(); if(!random) temp = 756804110;
+ 		int  k0=temp%nbv; 
+ 
+ 		//Build orderedvertices
Index: issm/oecreview/Archive/16554-17801/ISSM-16969-16970.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16969-16970.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16969-16970.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/test/NightlyRun/test119.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test119.py	(revision 16969)
++++ ../trunk-jpl/test/NightlyRun/test119.py	(revision 16970)
+@@ -5,18 +5,18 @@
+ from MatlabFuncs import *
+ 
+ #Simple mesh
+-md=bamg(model(),'domain','../Exp/Square.exp','hmax',100000.)
++md=bamg(model(),'domain','../Exp/Square.exp','hmax',100000.,'rand',False)
+ x1=md.mesh.x
+ y1=md.mesh.y
+ 
+ #hVertices
+-md=bamg(model(),'domain','../Exp/Square.exp','hmax',300000.,'hVertices',numpy.array([10000.,100000.,400000.,100000.]).reshape(-1,1))
++md=bamg(model(),'domain','../Exp/Square.exp','hmax',300000.,'hVertices',numpy.array([10000.,100000.,400000.,100000.]).reshape(-1,1),'rand',False)
+ x2=md.mesh.x
+ y2=md.mesh.y
+ 
+ #big mesh
+ t0=time.time()
+-md=bamg(model(),'domain','../Exp/Square.exp','hmax',3000.)
++md=bamg(model(),'domain','../Exp/Square.exp','hmax',3000.,'rand',False)
+ nbelements=md.mesh.numberofelements
+ elapsedtime=time.time()-t0
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16970-16971.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16970-16971.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16970-16971.diff	(revision 17802)
@@ -0,0 +1,10 @@
+Index: ../trunk-jpl/test/NightlyRun/test334.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test334.m	(revision 16970)
++++ ../trunk-jpl/test/NightlyRun/test334.m	(revision 16971)
+@@ -25,4 +25,4 @@
+ %analitic=(md.mesh.y.^2-2*md.mesh.y*1.0e6)*(-2.0/(2*md.constants.yts*md.hydrology.sediment_transmitivity))
+ field_names     ={'SedimentWaterHead','SedimentHeadResidual'};
+ field_tolerances={1e-13, 2.5e-10};
+-field_values={md.results.HydrologySolution.SedimentHead,md.results.HydrologySolution.SedimentHeadResidual}
++field_values={md.results.HydrologySolution.SedimentHead,md.results.HydrologySolution.SedimentHeadResidual};
Index: issm/oecreview/Archive/16554-17801/ISSM-16971-16972.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16971-16972.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16971-16972.diff	(revision 17802)
@@ -0,0 +1,86 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 16971)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 16972)
+@@ -126,7 +126,7 @@
+ 	int numnodes = basalelement->GetNumberOfNodes();
+ 
+ 	/*Initialize Element vector*/
+-	ElementMatrix* Ke     = element->NewElementMatrix();
++	ElementMatrix* Ke     = basalelement->NewElementMatrix();
+ 	IssmDouble*    B      = xNew<IssmDouble>(2*numnodes);
+ 	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+ 	IssmDouble     D[2][2]={0.};
+@@ -134,16 +134,16 @@
+ 	/*Retrieve all inputs and parameters*/
+ 	basalelement->GetVerticesCoordinates(&xyz_list);
+ 	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
+-	Input* thickness_input=element->GetInput(HydrologydcEplThicknessEnum); _assert_(thickness_input);
++	Input* thickness_input=basalelement->GetInput(HydrologydcEplThicknessEnum); _assert_(thickness_input);
+ 	IssmDouble epl_specificstoring = EplSpecificStoring(basalelement);
+-	IssmDouble epl_conductivity    = element->GetMaterialParameter(HydrologydcEplConductivityEnum);
++	IssmDouble epl_conductivity    = basalelement->GetMaterialParameter(HydrologydcEplConductivityEnum);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+-	Gauss* gauss=element->NewGauss(2);
++	Gauss* gauss=basalelement->NewGauss(2);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		gauss->GaussPoint(ig);
+ 
+-		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
+ 		thickness_input->GetInputValue(&epl_thickness,gauss);
+ 
+ 		/*Diffusivity*/
+@@ -151,7 +151,7 @@
+ 		if(dt!=0.) D_scalar=D_scalar*dt;
+ 		D[0][0]=D_scalar;
+ 		D[1][1]=D_scalar;
+-		GetB(B,element,xyz_list,gauss); 
++		GetB(B,basalelement,xyz_list,gauss); 
+ 		TripleMultiply(B,2,numnodes,1,
+ 					&D[0][0],2,2,0,
+ 					B,2,numnodes,0,
+@@ -159,7 +159,7 @@
+ 
+ 		/*Transient*/
+ 		if(dt!=0.){
+-			element->NodalFunctions(basis,gauss);
++			basalelement->NodalFunctions(basis,gauss);
+ 			D_scalar=epl_specificstoring*epl_thickness*gauss->weight*Jdet;
+ 
+ 			TripleMultiply(basis,numnodes,1,0,
+@@ -176,7 +176,6 @@
+ 	delete gauss;
+ 	return Ke;
+ 
+-
+ }/*}}}*/
+ ElementVector* HydrologyDCEfficientAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16971)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16972)
+@@ -186,7 +186,7 @@
+ 		if(dt!=0.) D_scalar=D_scalar*dt;
+ 		D[0][0]=D_scalar;
+ 		D[1][1]=D_scalar;
+-		GetB(B,element,xyz_list,gauss); 
++		GetB(B,basalelement,xyz_list,gauss); 
+ 		TripleMultiply(B,2,numnodes,1,
+ 					&D[0][0],2,2,0,
+ 					B,2,numnodes,0,
+@@ -248,9 +248,9 @@
+ 	basalelement->GetVerticesCoordinates(&xyz_list);
+ 	IssmDouble sediment_storing = SedimentStoring(basalelement);
+ 	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
+-	Input* water_input       = element->GetInput(BasalforcingsMeltingRateEnum); _assert_(water_input);
+-	Input* transfer_input    = element->GetInput(WaterTransferEnum);            _assert_(transfer_input);
+-	if(dt!= 0.){old_wh_input = element->GetInput(SedimentHeadOldEnum);          _assert_(old_wh_input);}
++	Input* water_input       = basalelement->GetInput(BasalforcingsMeltingRateEnum); _assert_(water_input);
++	Input* transfer_input    = basalelement->GetInput(WaterTransferEnum);            _assert_(transfer_input);
++	if(dt!= 0.){old_wh_input = basalelement->GetInput(SedimentHeadOldEnum);          _assert_(old_wh_input);}
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	Gauss* gauss=basalelement->NewGauss(2);
Index: issm/oecreview/Archive/16554-17801/ISSM-16972-16973.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16972-16973.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16972-16973.diff	(revision 17802)
@@ -0,0 +1,45 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16972)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16973)
+@@ -3240,9 +3240,9 @@
+ 
+ 	/*Intermediaries*/
+ 	int   i,j,init;
+-	int*   cs_list   = xNew<int>(6*3+1);
+-	int*   cs_list2  = xNew<int>(6*2+1);
+-	Node  **node_list = xNew<Node*>(6*3+1);
++	int*   cs_list     = xNew<int>(6*3+1);
++	int*   cs_list2    = xNew<int>(6*2+1);
++	Node  **node_list  = xNew<Node*>(6*3+1);
+ 
+ 	/*Some parameters needed*/
+ 	init = element->FiniteElement();
+@@ -3262,8 +3262,8 @@
+ 	}
+ 
+ 	/*compute all stiffness matrices for this element*/
+-	ElementMatrix* Ke1=element->NewElementMatrix(FSvelocityEnum);
+-	ElementMatrix* Ke2=element->NewElementMatrix(HOApproximationEnum);
++	ElementMatrix* Ke1=element->NewElementMatrixCoupling(6,HOApproximationEnum);
++	ElementMatrix* Ke2=element->NewElementMatrix(FSvelocityEnum);
+ 	ElementMatrix* Ke=new ElementMatrix(Ke1,Ke2);
+ 	delete Ke1; delete Ke2;
+ 
+@@ -3277,12 +3277,12 @@
+ 	/*Compute FS Matrix and condense it \n");*/
+ 
+ 	for(i=0;i<numdofs;i++) for(j=0;j<6;j++){
+-		Ke->values[i*numdoftotal+numdofs+2*j+0]+=Ke1->values[i*numdofs+3*j+0];
+-		Ke->values[i*numdoftotal+numdofs+2*j+1]+=Ke1->values[i*numdofs+3*j+1];
++		Ke->values[(i+numdofp)*numdoftotal+2*j+0]+=Ke1->values[i*numdofs+3*j+0];
++		Ke->values[(i+numdofp)*numdoftotal+2*j+1]+=Ke1->values[i*numdofs+3*j+1];
+ 	}
+ 	for(i=0;i<numdofp;i++) for(j=0;j<6;j++){
+-		Ke->values[(i+numdofs)*numdoftotal+3*j+0]+=Ke2->values[i*numdofp+2*j+0];
+-		Ke->values[(i+numdofs)*numdoftotal+3*j+1]+=Ke2->values[i*numdofp+2*j+1];
++		Ke->values[i*numdoftotal+numdofp+3*j+0]+=Ke2->values[i*numdofp+2*j+0];
++		Ke->values[i*numdoftotal+numdofp+3*j+1]+=Ke2->values[i*numdofp+2*j+1];
+ 	}
+ 
+ 	/*Transform Coordinate System*/ //Do not transform, already done in the matrices
Index: issm/oecreview/Archive/16554-17801/ISSM-16973-16974.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16973-16974.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16973-16974.diff	(revision 17802)
@@ -0,0 +1,84 @@
+Index: ../trunk-jpl/test/Archives/Archive510.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive322.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive204.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive290.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive507.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive421.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive404.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive702.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive422.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive503.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16973)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16974)
+@@ -3599,7 +3599,7 @@
+ 	friction=new Friction(this,1);
+ 
+ 	/* Start looping on the number of gauss 1d (nodes on the bedrock) */
+-	GaussTria* gauss=new GaussTria(indices[0],indices[1],2);
++	GaussTria* gauss=new GaussTria(indices[0],indices[1],3);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 
+ 		gauss->GaussPoint(ig);
+@@ -4011,7 +4011,7 @@
+ 	for(i=0;i<NUMVERTICES1D;i++) for(j=0;j<2;j++) xyz_list_seg[i][j]=xyz_list[indices[i]][j];
+ 
+ 	/* Start looping on the number of gauss 1d (nodes on the bedrock) */
+-	GaussTria* gauss=new GaussTria(indices[0],indices[1],2);
++	GaussTria* gauss=new GaussTria(indices[0],indices[1],5);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 
+ 		gauss->GaussPoint(ig);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16973)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16974)
+@@ -7734,7 +7734,7 @@
+ 	friction=new Friction(this,3);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(0,1,2,2);
++	gauss=new GaussPenta(0,1,2,3);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 
+ 		gauss->GaussPoint(ig);
+@@ -8840,7 +8840,7 @@
+ 	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+ 
+ 	/* Start looping on the number of gauss 2d (nodes on the bedrock) */
+-	gauss=new GaussPenta(0,1,2,2);
++	gauss=new GaussPenta(0,1,2,5);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 
+ 		gauss->GaussPoint(ig);
Index: issm/oecreview/Archive/16554-17801/ISSM-16974-16975.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16974-16975.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16974-16975.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16974)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16975)
+@@ -428,7 +428,7 @@
+ 	}
+ 
+ 	/* Start  looping on the number of gaussian points: */
+-	Gauss* gauss=element->NewGauss(2);
++	Gauss* gauss=element->NewGauss(3);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		gauss->GaussPoint(ig);
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16975-16976.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16975-16976.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16975-16976.diff	(revision 17802)
@@ -0,0 +1,75 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16975)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16976)
+@@ -3214,14 +3214,20 @@
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSAFS(Element* element){/*{{{*/
+ 
+ 	/*compute all stiffness matrices for this element*/
++	printf("-------------- file: StressbalanceAnalysis.cpp line: %i\n",__LINE__); 
+ 	ElementMatrix* Ke1=CreateKMatrixFS(element);
++	printf("-------------- file: StressbalanceAnalysis.cpp line: %i\n",__LINE__); 
+ 	int indices[3]={18,19,20};
+ 	Ke1->StaticCondensation(3,&indices[0]);
++	printf("-------------- file: StressbalanceAnalysis.cpp line: %i\n",__LINE__); 
+ 	int init = element->FiniteElement();
+ 	element->SetTemporaryElementType(P1Enum); 
++	printf("-------------- file: StressbalanceAnalysis.cpp line: %i\n",__LINE__); 
+ 	ElementMatrix* Ke2=CreateKMatrixSSA3d(element);
++	printf("-------------- file: StressbalanceAnalysis.cpp line: %i\n",__LINE__); 
+ 	element->SetTemporaryElementType(init); 
+ 	ElementMatrix* Ke3=CreateKMatrixCouplingSSAFS(element);
++	printf("-------------- file: StressbalanceAnalysis.cpp line: %i\n",__LINE__); 
+ 	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2,Ke3);
+ 
+ 	/*clean-up and return*/
+@@ -3535,7 +3541,7 @@
+ 		cs_list[2*vnumnodes-1+i]   = PressureEnum;
+ 	}
+ 
+-	ElementMatrix* Ke1=element->NewElementMatrix(SSAApproximationEnum);
++	ElementMatrix* Ke1=element->NewElementMatrixCoupling(6,SSAApproximationEnum);
+ 	ElementMatrix* Ke2=element->NewElementMatrix(FSvelocityEnum);
+ 	ElementMatrix* Ke=new ElementMatrix(Ke1,Ke2);
+ 	delete Ke1; delete Ke2;
+@@ -3641,21 +3647,21 @@
+ 	int* cs_list     = xNew<int>(2*vnumnodes-1+pnumnodes);
+ 	Node **node_list = xNew<Node*>(2*vnumnodes-1+pnumnodes);
+ 	for(i=0;i<vnumnodes-1;i++){
+-		node_list[vnumnodes+pnumnodes+i] = pentabase->GetNode(i);
+-		cs_list[vnumnodes+pnumnodes+i]   = XYEnum;
++		node_list[i] = pentabase->GetNode(i);
++		cs_list[i]   = XYEnum;
+ 	}
+ 	for(i=0;i<vnumnodes;i++){
+-		node_list[i] = element->GetNode(i);
+-		cs_list[i]   = XYZEnum;
++		node_list[i+vnumnodes-1] = element->GetNode(i);
++		cs_list[i+vnumnodes-1]   = XYZEnum;
+ 	}
+ 	for(i=0;i<pnumnodes;i++){
+-		node_list[vnumnodes+i] = element->GetNode(vnumnodes+i);
+-		cs_list[vnumnodes+i]   = PressureEnum;
++		node_list[2*vnumnodes-1+i] = element->GetNode(vnumnodes+i);
++		cs_list[2*vnumnodes-1+i]   = PressureEnum;
+ 	}
+ 
+ 	/*Initialize Element matrix and return if necessary*/
+-	ElementMatrix* Ke1=element->NewElementMatrix(FSvelocityEnum);
+-	ElementMatrix* Ke2=pentabase->NewElementMatrixCoupling(6,SSAApproximationEnum);
++	ElementMatrix* Ke1=pentabase->NewElementMatrixCoupling(6,SSAApproximationEnum);
++	ElementMatrix* Ke2=element->NewElementMatrix(FSvelocityEnum);
+ 	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
+ 	delete Ke1; delete Ke2;
+ 
+@@ -3698,8 +3704,8 @@
+ 					&Ke_gg2[0][0],1);
+ 
+ 	} 
+-	for(i=0;i<numdofs;i++) for(j=0;j<numdofm;j++) Ke->values[i*numdoftotal+j+numdofs]+=Ke_gg[i][j];
+-	for(i=0;i<numdofm;i++) for(j=0;j<numdofs;j++) Ke->values[(i+numdofs)*numdoftotal+j]+=Ke_gg2[i][j];
++	for(i=0;i<numdofs;i++) for(j=0;j<numdofm;j++) Ke->values[(i+2*numdofm)*numdoftotal+j]+=Ke_gg[i][j];
++	for(i=0;i<numdofm;i++) for(j=0;j<numdofs;j++) Ke->values[i*numdoftotal+(j+2*numdofm)]+=Ke_gg2[i][j];
+ 
+ 	/*Transform Coordinate System*/
+ 	element->TransformStiffnessMatrixCoord(Ke,node_list,numnodes,cs_list);
Index: issm/oecreview/Archive/16554-17801/ISSM-16976-16977.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16976-16977.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16976-16977.diff	(revision 17802)
@@ -0,0 +1,15 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16976)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16977)
+@@ -3512,8 +3512,8 @@
+ 	IssmDouble LFSSSA[4][numdof2d];
+ 	IssmDouble LprimeFSSSA[4][numdof2dm];
+ 	IssmDouble DLFSSSA[4][4]={0.0};
+-	IssmDouble Ke_drag[numdof2dm][numdofs];
+-	IssmDouble Ke_drag2[numdof2d][numdof2dm];
++	IssmDouble Ke_drag[numdof2dm][numdofs]={0.0};
++	IssmDouble Ke_drag2[numdof2d][numdof2dm]={0.0};
+ 	IssmDouble *xyz_list      = NULL;
+ 	IssmDouble *xyz_list_tria = NULL;
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16977-16978.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16977-16978.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16977-16978.diff	(revision 17802)
@@ -0,0 +1,42 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16977)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16978)
+@@ -3214,20 +3214,14 @@
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSAFS(Element* element){/*{{{*/
+ 
+ 	/*compute all stiffness matrices for this element*/
+-	printf("-------------- file: StressbalanceAnalysis.cpp line: %i\n",__LINE__); 
+ 	ElementMatrix* Ke1=CreateKMatrixFS(element);
+-	printf("-------------- file: StressbalanceAnalysis.cpp line: %i\n",__LINE__); 
+ 	int indices[3]={18,19,20};
+ 	Ke1->StaticCondensation(3,&indices[0]);
+-	printf("-------------- file: StressbalanceAnalysis.cpp line: %i\n",__LINE__); 
+ 	int init = element->FiniteElement();
+ 	element->SetTemporaryElementType(P1Enum); 
+-	printf("-------------- file: StressbalanceAnalysis.cpp line: %i\n",__LINE__); 
+ 	ElementMatrix* Ke2=CreateKMatrixSSA3d(element);
+-	printf("-------------- file: StressbalanceAnalysis.cpp line: %i\n",__LINE__); 
+ 	element->SetTemporaryElementType(init); 
+ 	ElementMatrix* Ke3=CreateKMatrixCouplingSSAFS(element);
+-	printf("-------------- file: StressbalanceAnalysis.cpp line: %i\n",__LINE__); 
+ 	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2,Ke3);
+ 
+ 	/*clean-up and return*/
+@@ -3712,6 +3706,7 @@
+ 
+ 	/*Clean-up and return*/
+ 	xDelete<int>(cs_list);
++	xDelete<Node*>(node_list);
+ 	xDelete<IssmDouble>(xyz_list);
+ 	delete basaltria->material; delete basaltria;
+ 	delete gauss;
+@@ -4095,6 +4090,8 @@
+ 
+ 	/*Clean up and return*/
+ 	xDelete<int>(cs_list);
++	xDelete<Node*>(node_list);
++	xDelete<IssmDouble>(xyz_list);
+ 	delete gauss;
+ 	return pe;
+ }/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16978-16979.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16978-16979.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16978-16979.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16978)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16979)
+@@ -3467,6 +3467,8 @@
+ 	
+ 	delete gauss;
+ 	delete gauss_tria;
++	xDelete<IssmDouble>(B);
++	xDelete<IssmDouble>(Bprime);
+ 	xDelete<IssmDouble>(Ke_gg);
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<Node*>(node_list);
Index: issm/oecreview/Archive/16554-17801/ISSM-16979-16980.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16979-16980.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16979-16980.diff	(revision 17802)
@@ -0,0 +1,15 @@
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 16979)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 16980)
+@@ -164,8 +164,8 @@
+ 	basalelement->GetVerticesCoordinates(&xyz_list);
+ 	basalelement->FindParam(&input_enum,InputToL2ProjectEnum);
+ 	switch(input_enum){
+-		case EplHeadSlopeXEnum: input = element->GetInput(EplHeadEnum); index = 0; _assert_(input); break;
+-		case EplHeadSlopeYEnum: input = element->GetInput(EplHeadEnum); index = 1; _assert_(input); break;
++		case EplHeadSlopeXEnum: input = basalelement->GetInput(EplHeadEnum); index = 0; _assert_(input); break;
++		case EplHeadSlopeYEnum: input = basalelement->GetInput(EplHeadEnum); index = 1; _assert_(input); break;
+ 		default: _error_("not implemented");
+ 	}
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16980-16981.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16980-16981.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16980-16981.diff	(revision 17802)
@@ -0,0 +1,53 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 16980)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 16981)
+@@ -161,7 +161,6 @@
+ 		if(dt!=0.){
+ 			basalelement->NodalFunctions(basis,gauss);
+ 			D_scalar=epl_specificstoring*epl_thickness*gauss->weight*Jdet;
+-
+ 			TripleMultiply(basis,numnodes,1,0,
+ 						&D_scalar,1,1,0,
+ 						basis,1,numnodes,0,
+@@ -197,17 +196,18 @@
+ 	}
+ 
+ 	/*Check that all nodes are active, else return empty matrix*/
+-	if(basalelement->AllActive()) return NULL;
++	if(!basalelement->AllActive()) return NULL;
+ 
+ 	/*Intermediaries */
+-	IssmDouble dt,scalar,water_head;
++	IssmDouble dt,scalar,water_head,connectivity;
+ 	IssmDouble transfer,residual,epl_thickness;
+ 	IssmDouble Jdet;
+ 	IssmDouble *xyz_list     = NULL;
+ 	Input*      old_wh_input = NULL;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = basalelement->GetNumberOfNodes();
++	int numnodes    = basalelement->GetNumberOfNodes();
++	int numvertices = basalelement->GetNumberOfVertices();
+ 
+ 	/*Initialize Element vector*/
+ 	ElementVector* pe    = basalelement->NewElementVector();
+@@ -244,7 +244,18 @@
+ 			for(int i=0;i<numnodes;i++) pe->values[i]+=scalar*basis[i];
+ 		}
+ 	}
++	delete gauss;
+ 
++	/*	Add residual if necessary*/
++	gauss=basalelement->NewGauss();
++	for(int iv=0;iv<numvertices;iv++){
++		gauss->GaussVertex(iv);
++
++		connectivity = IssmDouble(basalelement->VertexConnectivity(iv));
++		residual_input->GetInputValue(&residual,gauss);
++		pe->values[iv]+=residual/connectivity;
++	}
++
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
Index: issm/oecreview/Archive/16554-17801/ISSM-16981-16982.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16981-16982.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16981-16982.diff	(revision 17802)
@@ -0,0 +1,4457 @@
+Index: ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 16981)
++++ ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 16982)
+@@ -41,7 +41,8 @@
+ 		for (i=0;i<femmodel->elements->Size();i++){
+ 			element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+ 			ElementMatrix* Ke = element->CreateKMatrix();
+-			ElementVector* pe = element->CreatePVector();
++			//ElementVector* pe = element->CreatePVector();
++			ElementVector* pe = analysis->CreatePVector(element);
+ 			element->ReduceMatrices(Ke,pe);
+ 			if(Ke) Ke->AddToGlobal(Kff_temp,NULL);
+ 			delete Ke;
+@@ -71,10 +72,10 @@
+ 	/*Fill stiffness matrix and load vector from elements*/
+ 	for (i=0;i<femmodel->elements->Size();i++){
+ 		element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+-		//ElementVector* pe = analysis->CreatePVector(element);
++		ElementMatrix* Ke = element->CreateKMatrix();
+ 		//ElementMatrix* Ke = analysis->CreateKMatrix(element);
+-		ElementVector* pe = element->CreatePVector();
+-		ElementMatrix* Ke = element->CreateKMatrix();
++		//ElementVector* pe = element->CreatePVector();
++		ElementVector* pe = analysis->CreatePVector(element);
+ 		element->ReduceMatrices(Ke,pe);
+ 		if(Ke) Ke->AddToGlobal(Kff,Kfs);
+ 		if(pe) pe->AddToGlobal(pf);
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16981)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16982)
+@@ -104,7 +104,6 @@
+ 		virtual void       SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters)=0;
+ 		virtual void       SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum)=0;
+ 		virtual ElementMatrix* CreateKMatrix(void)=0;
+-		virtual ElementVector* CreatePVector(void)=0;
+ 		virtual void   CreateDVector(Vector<IssmDouble>* df)=0;
+ 		virtual void   CreateJacobianMatrix(Matrix<IssmDouble>* Jff)=0;
+ 		virtual void   ElementSizes(IssmDouble* phx,IssmDouble* phy,IssmDouble* phz)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16981)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16982)
+@@ -373,203 +373,6 @@
+ 	/*Nothing done yet*/
+ }
+ /*}}}*/
+-/*FUNCTION Tria::CreatePVector(void){{{*/
+-ElementVector* Tria::CreatePVector(void){
+-
+-	/*retrive parameters: */
+-	int meshtype;
+-	int analysis_type;
+-	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-
+-	/*asserts: {{{*/
+-	/*if debugging mode, check that all pointers exist*/
+-	_assert_(this->nodes && this->material && this->matpar && this->parameters && this->inputs);
+-	/*}}}*/
+-
+-	/*Skip if water element*/
+-	if(NoIceInElement()) return NULL;
+-
+-	/*Just branch to the correct load generator, according to the type of analysis we are carrying out: */
+-	switch(analysis_type){
+-		#ifdef _HAVE_STRESSBALANCE_
+-		case StressbalanceAnalysisEnum:
+-			int approximation;
+-			inputs->GetInputValue(&approximation,ApproximationEnum);
+-			switch(approximation){
+-				case SSAApproximationEnum:
+-					return CreatePVectorStressbalanceSSA();
+-				case FSApproximationEnum:
+-					return CreatePVectorStressbalanceFS();
+-				case SIAApproximationEnum:
+-					return NULL;
+-				case NoneApproximationEnum:
+-					return NULL;
+-				default:
+-					_error_("Approximation " << EnumToStringx(approximation) << " not supported yet");
+-			}
+-			break;
+-		case StressbalanceSIAAnalysisEnum:
+-			return CreatePVectorStressbalanceSIA();
+-			break;
+-		#endif
+-	 	#ifdef _HAVE_DAMAGE_
+-		case DamageEvolutionAnalysisEnum:
+-			return CreatePVectorDamageEvolution();
+-			break;
+-		#endif
+-		case L2ProjectionBaseAnalysisEnum:
+-			parameters->FindParam(&meshtype,MeshTypeEnum);
+-			if(meshtype==Mesh2DverticalEnum){
+-				return CreatePVectorL2ProjectionBase();
+-			}
+-			else{
+-				return CreatePVectorL2Projection();
+-			}
+-			break;
+-	 	#ifdef _HAVE_MASSTRANSPORT_
+-		case MasstransportAnalysisEnum:
+-			return CreatePVectorMasstransport();
+-			break;
+-		case FreeSurfaceTopAnalysisEnum:
+-			parameters->FindParam(&meshtype,MeshTypeEnum);
+-			switch(meshtype){
+-				case Mesh2DverticalEnum:
+-					return CreatePVectorFreeSurfaceTop1D();
+-				case Mesh3DEnum:
+-					return CreatePVectorFreeSurfaceTop();
+-				default:
+-					_error_("Mesh not supported yet");
+-			}
+-			break;
+-		case FreeSurfaceBaseAnalysisEnum:
+-			parameters->FindParam(&meshtype,MeshTypeEnum);
+-			switch(meshtype){
+-				case Mesh2DverticalEnum:
+-					return CreatePVectorFreeSurfaceBase1D();
+-				case Mesh3DEnum:
+-					return CreatePVectorFreeSurfaceBase();
+-				default:
+-					_error_("Mesh not supported yet");
+-			}
+-			break;
+-		case ExtrudeFromBaseAnalysisEnum: case ExtrudeFromTopAnalysisEnum:
+-			return NULL;
+-			break;
+-		#endif
+-		#ifdef _HAVE_HYDROLOGY_
+-		case HydrologyShreveAnalysisEnum:
+-			return CreatePVectorHydrologyShreve();
+-			break;
+-		case HydrologyDCInefficientAnalysisEnum:
+-			return CreatePVectorHydrologyDCInefficient();
+-			break;
+-		case HydrologyDCEfficientAnalysisEnum:
+-			return CreatePVectorHydrologyDCEfficient();
+-			break;
+-	  case L2ProjectionEPLAnalysisEnum:
+-			return CreatePVectorL2ProjectionEPL();
+-			break;
+-		#endif
+-		#ifdef _HAVE_BALANCED_
+-		case BalancethicknessAnalysisEnum:
+-			return CreatePVectorBalancethickness();
+-			break;
+-		case BalancevelocityAnalysisEnum:
+-			return CreatePVectorBalancevelocity();
+-			break;
+-		case SmoothedSurfaceSlopeXAnalysisEnum:
+-			return CreatePVectorSmoothedSlopeX();
+-			break;
+-		case SmoothedSurfaceSlopeYAnalysisEnum:
+-			return CreatePVectorSmoothedSlopeY();
+-			break;
+-		#endif
+-		#ifdef _HAVE_CONTROL_
+-		case AdjointBalancethicknessAnalysisEnum:
+-			return CreatePVectorAdjointBalancethickness();
+-			break;
+-		case AdjointHorizAnalysisEnum:
+-			return CreatePVectorAdjointHoriz();
+-			break;
+-	 	#endif
+-		default:
+-			_error_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet");
+-	}
+-
+-	/*make compiler happy*/
+-	return NULL;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreatePVectorL2ProjectionBase{{{*/
+-ElementVector* Tria::CreatePVectorL2ProjectionBase(void){
+-
+-	if(!HasEdgeOnBed()) return NULL;
+-
+-	int index1,index2;
+-	this->EdgeOnBedIndices(&index1,&index2);
+-
+-	Seg* seg=(Seg*)SpawnSeg(index1,index2); 
+-	ElementVector* pe=seg->CreatePVectorL2Projection();
+-	delete seg->material; delete seg;
+-
+-	/*clean up and return*/
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreatePVectorL2Projection {{{*/
+-ElementVector* Tria::CreatePVectorL2Projection(void){
+-
+-	/*Intermediaries */
+-	int        i,input_enum;
+-	IssmDouble Jdet,value;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble slopes[2];
+-	Input*     input  = NULL;
+-	Input*     input2 = NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element vector*/
+-	ElementVector* pe    = new ElementVector(nodes,numnodes,this->parameters);
+-	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&input_enum,InputToL2ProjectEnum);
+-	switch(input_enum){
+-		case SurfaceSlopeXEnum: input2 = inputs->GetInput(SurfaceEnum); _assert_(input2); break;
+-		case SurfaceSlopeYEnum: input2 = inputs->GetInput(SurfaceEnum); _assert_(input2); break;
+-		case BedSlopeXEnum:     input2 = inputs->GetInput(BedEnum);     _assert_(input2); break;
+-		case BedSlopeYEnum:     input2 = inputs->GetInput(BedEnum);     _assert_(input2); break;
+-		default: input = inputs->GetInput(input_enum);
+-	}
+-
+-	/* Start  looping on the number of gaussian points: */
+-	GaussTria* gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis,gauss);
+-
+-		if(input2) input2->GetInputDerivativeValue(&slopes[0],&xyz_list[0][0],gauss);
+-		switch(input_enum){
+-			case SurfaceSlopeXEnum: case BedSlopeXEnum: value = slopes[0]; break;
+-			case SurfaceSlopeYEnum: case BedSlopeYEnum: value = slopes[1]; break;
+-			default: input->GetInputValue(&value,gauss);
+-		}
+-
+-		for(i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*value*basis[i];
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+ /*FUNCTION Tria::CreateJacobianMatrix{{{*/
+ void  Tria::CreateJacobianMatrix(Matrix<IssmDouble>* Jff){
+ 
+@@ -3816,422 +3619,6 @@
+ 	return Ke;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::CreatePVectorStressbalanceFS {{{*/
+-ElementVector* Tria::CreatePVectorStressbalanceFS(void){
+-
+-	ElementVector* pe1;
+-	ElementVector* pe2;
+-	ElementVector* pe3;
+-	ElementVector* pe;
+-
+-	/*compute all stiffness matrices for this element*/
+-	pe1=CreatePVectorStressbalanceFSViscous();
+-	pe2=CreatePVectorStressbalanceFSShelf();
+-	pe3=CreatePVectorStressbalanceFSFront();
+-	pe =new ElementVector(pe1,pe2,pe3);
+-
+-	/*clean-up and return*/
+-	delete pe1;
+-	delete pe2;
+-	delete pe3;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreatePVectorStressbalanceFSFront{{{*/
+-ElementVector* Tria::CreatePVectorStressbalanceFSFront(void){
+-
+-	/*If no front, return NULL*/
+-	if(!IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
+-
+-	/*Intermediaries*/
+-	int         i;
+-	IssmDouble  rho_ice,rho_water,gravity,y_g;
+-	IssmDouble  Jdet,water_pressure,air_pressure,pressure;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble* xyz_list_front = NULL;
+-	IssmDouble  area_coordinates[2][3];
+-	IssmDouble  normal[2];
+-	GaussTria*  gauss = NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumnodes = this->NumberofNodesPressure();
+-
+-	/*Prepare coordinate system list*/
+-	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+-	for(i=0;i<vnumnodes;i++) cs_list[i]           = XYEnum;
+-	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
+-
+-	/*Initialize Element matrix and vectors*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	ElementVector* pe     = new ElementVector(nodes,vnumnodes+pnumnodes,this->parameters,FSvelocityEnum);
+-	IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	rho_water = matpar->GetRhoWater();
+-	rho_ice = matpar->GetRhoIce();
+-	gravity   = matpar->GetG();
+-	ZeroLevelsetCoordinates(&xyz_list_front,&xyz_list[0][0],MaskIceLevelsetEnum);
+-	GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,&xyz_list[0][0],2);
+-	NormalSection(&normal[0],xyz_list_front);
+-
+-	/*Start looping on Gaussian points*/
+-	IssmDouble ymax=max(xyz_list_front[0*3+1],xyz_list_front[1*3+1]);
+-	IssmDouble ymin=min(xyz_list_front[0*3+1],xyz_list_front[1*3+1]);
+-	if(ymax>0. && ymin<0.) gauss=new GaussTria(area_coordinates,30); //refined in vertical because of the sea level discontinuity
+-	else                   gauss=new GaussTria(area_coordinates,3);
+-
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-		y_g=GetYcoord(gauss);
+-		GetNodalFunctionsVelocity(vbasis,gauss);
+-		GetSegmentJacobianDeterminant(&Jdet,xyz_list_front,gauss);
+-
+-		water_pressure = rho_water*gravity*min(0.,y_g); //0 if the gaussian point is above water level
+-		air_pressure   = 0.;
+-		pressure       = water_pressure + air_pressure;
+-
+-		for(i=0;i<vnumnodes;i++){
+-			pe->values[2*i+0]+= pressure*Jdet*gauss->weight*normal[0]*vbasis[i];
+-			pe->values[2*i+1]+= pressure*Jdet*gauss->weight*normal[1]*vbasis[i];
+-		}
+-	}
+-
+-	/*Transform coordinate system*/
+-	::TransformLoadVectorCoord(pe,nodes,(vnumnodes+pnumnodes),cs_list);
+-
+-	/*Clean up and return*/
+-	xDelete<int>(cs_list);
+-	xDelete<IssmDouble>(xyz_list_front);
+-	xDelete<IssmDouble>(vbasis);
+-	delete gauss;
+-	return pe;
+-
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreatePVectorStressbalanceFSViscous {{{*/
+-ElementVector* Tria::CreatePVectorStressbalanceFSViscous(void){
+-
+-	/*Intermediaries*/
+-	int        i;
+-	int        approximation;
+-	IssmDouble Jdet,gravity,rho_ice;
+-	IssmDouble forcex,forcey;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	GaussTria *gauss=NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumnodes = this->NumberofNodesPressure();
+-
+-	/*Prepare coordinate system list*/
+-	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+-	for(i=0;i<vnumnodes;i++) cs_list[i]           = XYEnum;
+-	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementVector* pe     = new ElementVector(nodes,vnumnodes+pnumnodes,this->parameters,FSvelocityEnum);
+-	IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* loadingforcex_input=inputs->GetInput(LoadingforceXEnum);  _assert_(loadingforcex_input);
+-	Input* loadingforcey_input=inputs->GetInput(LoadingforceYEnum);  _assert_(loadingforcey_input);
+-	rho_ice = matpar->GetRhoIce();
+-	gravity = matpar->GetG();
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussTria(5);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctionsVelocity(vbasis, gauss);
+-
+-		loadingforcex_input->GetInputValue(&forcex,gauss);
+-		loadingforcey_input->GetInputValue(&forcey,gauss);
+-
+-		for(i=0;i<vnumnodes;i++){
+-			pe->values[i*NDOF2+1] += -rho_ice*gravity*Jdet*gauss->weight*vbasis[i];
+-			pe->values[i*NDOF2+0] += +rho_ice*forcex *Jdet*gauss->weight*vbasis[i];
+-			pe->values[i*NDOF2+1] += +rho_ice*forcey *Jdet*gauss->weight*vbasis[i];
+-		}
+-	}
+-
+-	/*Transform coordinate system*/
+-	::TransformLoadVectorCoord(pe,nodes,vnumnodes+pnumnodes,cs_list);
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	xDelete<int>(cs_list);
+-	xDelete<IssmDouble>(vbasis);
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreatePVectorStressbalanceFSShelf{{{*/
+-ElementVector* Tria::CreatePVectorStressbalanceFSShelf(void){
+-
+-	/*Intermediaries*/
+-	int         i,j;
+-	int         indices[2];
+-	IssmDouble  gravity,rho_water,bed,water_pressure;
+-	IssmDouble  normal_vel,vx,vy,dt;
+-	IssmDouble	xyz_list_seg[NUMVERTICES1D][3];
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble	normal[2];
+-	IssmDouble  Jdet;
+-
+-	/*Initialize Element vector and return if necessary*/
+-	if(!HasEdgeOnBed() || !IsFloating()) return NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumnodes = this->NumberofNodesPressure();
+-
+-	/*Prepare coordinate system list*/
+-	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+-	for(i=0;i<vnumnodes;i++) cs_list[i]           = XYEnum;
+-	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementVector* pe     = new ElementVector(nodes,vnumnodes+pnumnodes,this->parameters,FSvelocityEnum);
+-	IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	rho_water=matpar->GetRhoWater();
+-	gravity=matpar->GetG();
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* bed_input=inputs->GetInput(BedEnum); _assert_(bed_input);
+-
+-	/*Get vertex indices that lie on bed*/
+-	this->EdgeOnBedIndices(&indices[0],&indices[1]);
+-
+-	for(i=0;i<NUMVERTICES1D;i++) for(j=0;j<2;j++) xyz_list_seg[i][j]=xyz_list[indices[i]][j];
+-
+-	/* Start looping on the number of gauss 1d (nodes on the bedrock) */
+-	GaussTria* gauss=new GaussTria(indices[0],indices[1],5);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetSegmentJacobianDeterminant(&Jdet,&xyz_list_seg[0][0],gauss);
+-		GetNodalFunctionsVelocity(vbasis, gauss);
+-
+-		NormalSection(&normal[0],&xyz_list_seg[0][0]);
+-		_assert_(normal[1]<0.);
+-		bed_input->GetInputValue(&bed, gauss);
+-		water_pressure=gravity*rho_water*bed;
+-
+-		for(i=0;i<vnumnodes;i++){
+-			pe->values[2*i+0]+=(water_pressure)*gauss->weight*Jdet*vbasis[i]*normal[0];
+-			pe->values[2*i+1]+=(water_pressure)*gauss->weight*Jdet*vbasis[i]*normal[1];
+-		}
+-	}
+-
+-	/*Transform coordinate system*/
+-	::TransformLoadVectorCoord(pe,nodes,(vnumnodes+pnumnodes),cs_list);
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	xDelete<int>(cs_list);
+-	xDelete<IssmDouble>(vbasis);
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreatePVectorStressbalanceSSA {{{*/
+-ElementVector* Tria::CreatePVectorStressbalanceSSA(){
+-
+-	/*compute all load vectors for this element*/
+-	ElementVector* pe1=CreatePVectorStressbalanceSSADrivingStress();
+-	ElementVector* pe2=CreatePVectorStressbalanceSSAFront();
+-	ElementVector* pe =new ElementVector(pe1,pe2);
+-
+-	/*clean-up and return*/
+-	delete pe1;
+-	delete pe2;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreatePVectorStressbalanceSSADrivingStress {{{*/
+-ElementVector* Tria::CreatePVectorStressbalanceSSADrivingStress(){
+-
+-	/*Intermediaries */
+-	int        i;
+-	IssmDouble driving_stress_baseline,thickness;
+-	IssmDouble Jdet;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble slope[2];
+-	IssmDouble icefrontlevel[3];
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element vector and vectors*/
+-	ElementVector* pe=new ElementVector(nodes,numnodes,this->parameters,SSAApproximationEnum);
+-	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* thickness_input=inputs->GetInput(ThicknessEnum); _assert_(thickness_input); 
+-	Input* surface_input=inputs->GetInput(SurfaceEnum);     _assert_(surface_input);
+-	Input* drag_input=inputs->GetInput(FrictionCoefficientEnum);_assert_(drag_input);
+-	GetInputListOnVertices(&icefrontlevel[0],BedEnum);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	GaussTria*     gauss  = new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis, gauss);
+-
+-		thickness_input->GetInputValue(&thickness,gauss);
+-		surface_input->GetInputDerivativeValue(&slope[0],&xyz_list[0][0],gauss);
+-		driving_stress_baseline=matpar->GetRhoIce()*matpar->GetG()*thickness;
+-
+-		/*Build load vector: */
+-		for(i=0;i<numnodes;i++){
+-			pe->values[i*NDOF2+0]+=-driving_stress_baseline*slope[0]*Jdet*gauss->weight*basis[i];
+-			pe->values[i*NDOF2+1]+=-driving_stress_baseline*slope[1]*Jdet*gauss->weight*basis[i];
+-		}
+-	}
+-
+-	/*Transform coordinate system*/
+-	::TransformLoadVectorCoord(pe,nodes,numnodes,XYEnum);
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreatePVectorStressbalanceSSAFront {{{*/
+-ElementVector* Tria::CreatePVectorStressbalanceSSAFront(){
+-
+-	/*If no front, return NULL*/
+-	if(!IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
+-
+-	/*Intermediaries*/
+-	IssmDouble  rho_ice,rho_water,gravity;
+-	IssmDouble  Jdet,thickness,bed,water_pressure,ice_pressure,air_pressure;
+-	IssmDouble  surface_under_water,base_under_water,pressure;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble  *xyz_list_front = NULL;
+-	IssmDouble  area_coordinates[2][3];
+-	IssmDouble  normal[2];
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element vector and other vectors*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	ElementVector* pe    = new ElementVector(nodes,numnodes,this->parameters,SSAApproximationEnum);
+-	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	Input* thickness_input=inputs->GetInput(ThicknessEnum); _assert_(thickness_input);
+-	Input* bed_input      =inputs->GetInput(BedEnum);       _assert_(bed_input);
+-	rho_water = matpar->GetRhoWater();
+-	rho_ice   = matpar->GetRhoIce();
+-	gravity   = matpar->GetG();
+-	ZeroLevelsetCoordinates(&xyz_list_front,&xyz_list[0][0],MaskIceLevelsetEnum);
+-	GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,&xyz_list[0][0],2);
+-	NormalSection(&normal[0],xyz_list_front);
+-
+-	/*Start looping on Gaussian points*/
+-	GaussTria* gauss=new GaussTria(area_coordinates,3);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-		thickness_input->GetInputValue(&thickness,gauss);
+-		bed_input->GetInputValue(&bed,gauss);
+-		GetSegmentJacobianDeterminant(&Jdet,xyz_list_front,gauss);
+-		GetNodalFunctions(basis,gauss);
+-
+-		surface_under_water = min(0.,thickness+bed); // 0 if the top of the glacier is above water level
+-		base_under_water    = min(0.,bed);           // 0 if the bottom of the glacier is above water level
+-		water_pressure = 1.0/2.0*gravity*rho_water*(pow(surface_under_water,2) - pow(base_under_water,2));
+-		ice_pressure   = 1.0/2.0*gravity*rho_ice*pow(thickness,2);
+-		air_pressure   = 0;
+-		pressure = ice_pressure + water_pressure + air_pressure;
+-
+-		for (int i=0;i<numnodes;i++){
+-			pe->values[2*i+0]+= pressure*Jdet*gauss->weight*normal[0]*basis[i];
+-			pe->values[2*i+1]+= pressure*Jdet*gauss->weight*normal[1]*basis[i];
+-		}
+-	}
+-
+-	/*Transform coordinate system*/
+-	::TransformLoadVectorCoord(pe,nodes,numnodes,XYEnum);
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	xDelete<IssmDouble>(xyz_list_front);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreatePVectorStressbalanceSIA{{{*/
+-ElementVector* Tria::CreatePVectorStressbalanceSIA(void){
+-
+-	/*Intermediaries */
+-	IssmDouble ub,vb;
+-	IssmDouble rho_ice,gravity,n,B,drag;
+-	IssmDouble slope2,thickness,connectivity;
+-	IssmDouble slope[2];
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes(); _assert_(numnodes==3); 
+-
+-	/*Initialize Element vector*/
+-	ElementVector* pe=new ElementVector(nodes,numnodes,this->parameters);
+-
+-	/*Retrieve all inputs and parameters*/
+-	rho_ice=matpar->GetRhoIce();
+-	gravity=matpar->GetG();
+-	n=material->GetN();
+-	B=material->GetBbar();
+-	Input* slopex_input=inputs->GetInput(SurfaceSlopeXEnum); _assert_(slopex_input);
+-	Input* slopey_input=inputs->GetInput(SurfaceSlopeYEnum); _assert_(slopey_input);
+-	Input* thickness_input=inputs->GetInput(ThicknessEnum);  _assert_(thickness_input);
+-	Input* drag_input=inputs->GetInput(FrictionCoefficientEnum);  _assert_(drag_input);
+-
+-	/*Spawn 3 sing elements: */
+-	GaussTria* gauss=new GaussTria();
+-	for(int i=0;i<numnodes;i++){
+-
+-		gauss->GaussVertex(i);
+-
+-		connectivity=(IssmDouble)vertices[i]->Connectivity();
+-
+-		thickness_input->GetInputValue(&thickness,gauss);
+-		drag_input->GetInputValue(&drag,gauss);
+-		slopex_input->GetInputValue(&slope[0],gauss);
+-		slopey_input->GetInputValue(&slope[1],gauss);
+-		slope2=slope[0]*slope[0]+slope[1]*slope[1];
+-
+-		/*Payne 1995 (m = 1, B = 5e-3/yts = 1.58e-10  m/s/Pa*/
+-		ub=-1.58*1.e-10*rho_ice*gravity*thickness*slope[0];
+-		vb=-1.58*1.e-10*rho_ice*gravity*thickness*slope[1];
+-		///*Ritz et al. 1996*/
+-		//ub=drag*(rho_ice*gravity*thickness)*(rho_ice*gravity*thickness)*slope[0]/sqrt(slope2);
+-		//vb=drag*(rho_ice*gravity*thickness)*(rho_ice*gravity*thickness)*slope[1]/sqrt(slope2);
+-		///*Rutt et al. 2009*/
+-		//ub=-drag*rho_ice*gravity*thickness*slope[0];
+-		//vb=-drag*rho_ice*gravity*thickness*slope[1];
+-
+-		pe->values[2*i+0]=(ub-2.*pow(rho_ice*gravity,n)*pow(slope2,((n-1.)/2.))*pow(thickness,n)/(pow(B,n)*(n+1))*slope[0])/connectivity;
+-		pe->values[2*i+1]=(vb-2.*pow(rho_ice*gravity,n)*pow(slope2,((n-1.)/2.))*pow(thickness,n)/(pow(B,n)*(n+1))*slope[1])/connectivity;
+-	}
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+ /*FUNCTION Tria::CreateJacobianStressbalanceSSA{{{*/
+ ElementMatrix* Tria::CreateJacobianStressbalanceSSA(void){
+ 
+@@ -5606,279 +4993,6 @@
+ 	return Jelem;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::CreatePVectorAdjointBalancethickness{{{*/
+-ElementVector* Tria::CreatePVectorAdjointBalancethickness(void){
+-
+-	/*Intermediaries */
+-	int        i,resp;
+-	IssmDouble Jdet;
+-	IssmDouble thickness,thicknessobs,weight;
+-	int        num_responses;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble dH[2];
+-	IssmDouble vx,vy,vel;
+-	int       *responses = NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element vector and vectors*/
+-	ElementVector* pe     = new ElementVector(nodes,numnodes,this->parameters);
+-	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+-	IssmDouble*    dbasis = xNew<IssmDouble>(2*numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&num_responses,InversionNumCostFunctionsEnum);
+-	this->parameters->FindParam(&responses,NULL,InversionCostFunctionsEnum);
+-	Input* thickness_input    = inputs->GetInput(ThicknessEnum);                          _assert_(thickness_input);
+-	Input* thicknessobs_input = inputs->GetInput(InversionThicknessObsEnum);              _assert_(thicknessobs_input);
+-	Input* weights_input      = inputs->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
+-	Input* vx_input           = inputs->GetInput(VxEnum);                                 _assert_(vx_input);
+-	Input* vy_input           = inputs->GetInput(VyEnum);                                 _assert_(vy_input);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	GaussTria* gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis, gauss);
+-		GetNodalFunctionsDerivatives(dbasis,&xyz_list[0][0],gauss);
+-
+-		thickness_input->GetInputValue(&thickness, gauss);
+-		thickness_input->GetInputDerivativeValue(&dH[0],&xyz_list[0][0],gauss);
+-		thicknessobs_input->GetInputValue(&thicknessobs, gauss);
+-
+-		/*Loop over all requested responses*/
+-		for(resp=0;resp<num_responses;resp++){
+-
+-			weights_input->GetInputValue(&weight,gauss,responses[resp]);
+-
+-			switch(responses[resp]){
+-				case ThicknessAbsMisfitEnum:
+-					for(i=0;i<numnodes;i++) pe->values[i]+=(thicknessobs-thickness)*weight*Jdet*gauss->weight*basis[i];
+-					break;
+-				case ThicknessAbsGradientEnum:
+-					for(i=0;i<numnodes;i++) pe->values[i]+= - weight*dH[0]*dbasis[0*numnodes+i]*Jdet*gauss->weight;
+-					for(i=0;i<numnodes;i++) pe->values[i]+= - weight*dH[1]*dbasis[1*numnodes+i]*Jdet*gauss->weight;
+-					break;
+-				case ThicknessAlongGradientEnum:
+-					vx_input->GetInputValue(&vx,gauss);
+-					vy_input->GetInputValue(&vy,gauss);
+-					vel = sqrt(vx*vx+vy*vy);
+-					vx  = vx/(vel+1.e-9);
+-					vy  = vy/(vel+1.e-9);
+-					for(i=0;i<numnodes;i++) pe->values[i]+= - weight*(dH[0]*vx+dH[1]*vy)*(dbasis[0*numnodes+i]*vx+dbasis[1*numnodes+i]*vy)*Jdet*gauss->weight;
+-					break;
+-				case ThicknessAcrossGradientEnum:
+-					vx_input->GetInputValue(&vx,gauss);
+-					vy_input->GetInputValue(&vy,gauss);
+-					vel = sqrt(vx*vx+vy*vy);
+-					vx  = vx/(vel+1.e-9);
+-					vy  = vy/(vel+1.e-9);
+-					for(i=0;i<numnodes;i++) pe->values[i]+= - weight*(dH[0]*(-vy)+dH[1]*vx)*(dbasis[0*numnodes+i]*(-vy)+dbasis[1*numnodes+i]*vx)*Jdet*gauss->weight;
+-					break;
+-				default:
+-					_error_("response " << EnumToStringx(responses[resp]) << " not supported yet");
+-			}
+-		}
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	xDelete<IssmDouble>(dbasis);
+-	xDelete<int>(responses);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreatePVectorAdjointHoriz{{{*/
+-ElementVector* Tria::CreatePVectorAdjointHoriz(void){
+-
+-	/*Intermediaries */
+-	int        i,resp;
+-	int       *responses=NULL;
+-	int        num_responses;
+-	IssmDouble Jdet;
+-	IssmDouble obs_velocity_mag,velocity_mag;
+-	IssmDouble dux,duy;
+-	IssmDouble epsvel=2.220446049250313e-16;
+-	IssmDouble meanvel=3.170979198376458e-05; /*1000 m/yr*/
+-	IssmDouble scalex=0.,scaley=0.,scale=0.,S=0.;
+-	IssmDouble vx,vy,vxobs,vyobs,weight;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element vector*/
+-	ElementVector* pe    = new ElementVector(nodes,numnodes,this->parameters);
+-	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&num_responses,InversionNumCostFunctionsEnum);
+-	this->parameters->FindParam(&responses,NULL,InversionCostFunctionsEnum);
+-	Input* weights_input=inputs->GetInput(InversionCostFunctionsCoefficientsEnum);   _assert_(weights_input);
+-	Input* vx_input     =inputs->GetInput(VxEnum);        _assert_(vx_input);
+-	Input* vy_input     =inputs->GetInput(VyEnum);        _assert_(vy_input);
+-	Input* vxobs_input  =inputs->GetInput(InversionVxObsEnum);     _assert_(vxobs_input);
+-	Input* vyobs_input  =inputs->GetInput(InversionVyObsEnum);     _assert_(vyobs_input);
+-
+-	/*Get Surface if required by one response*/
+-	for(resp=0;resp<num_responses;resp++){
+-		if(responses[resp]==SurfaceAverageVelMisfitEnum){
+-			inputs->GetInputValue(&S,SurfaceAreaEnum); break;
+-		}
+-	}
+-
+-	/* Start  looping on the number of gaussian points: */
+-	GaussTria* gauss=new GaussTria(4);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		/* Get Jacobian determinant: */
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-
+-		/*Get all parameters at gaussian point*/
+-		vx_input->GetInputValue(&vx,gauss);
+-		vy_input->GetInputValue(&vy,gauss);
+-		vxobs_input->GetInputValue(&vxobs,gauss);
+-		vyobs_input->GetInputValue(&vyobs,gauss);
+-		GetNodalFunctions(basis, gauss);
+-
+-		/*Loop over all requested responses*/
+-		for(resp=0;resp<num_responses;resp++){
+-
+-			weights_input->GetInputValue(&weight,gauss,responses[resp]);
+-
+-			switch(responses[resp]){
+-				case SurfaceAbsVelMisfitEnum:
+-					/*
+-					 *      1  [           2              2 ]
+-					 * J = --- | (u - u   )  +  (v - v   )  |
+-					 *      2  [       obs            obs   ]
+-					 *
+-					 *        dJ
+-					 * DU = - -- = (u   - u )
+-					 *        du     obs
+-					 */
+-					for(i=0;i<numnodes;i++){
+-						dux=vxobs-vx;
+-						duy=vyobs-vy;
+-						pe->values[i*NDOF2+0]+=dux*weight*Jdet*gauss->weight*basis[i]; 
+-						pe->values[i*NDOF2+1]+=duy*weight*Jdet*gauss->weight*basis[i]; 
+-					}
+-					break;
+-				case SurfaceRelVelMisfitEnum:
+-					/*
+-					 *      1  [     \bar{v}^2             2   \bar{v}^2              2 ]
+-					 * J = --- | -------------  (u - u   ) + -------------  (v - v   )  |
+-					 *      2  [  (u   + eps)^2       obs    (v   + eps)^2       obs    ]
+-					 *              obs                        obs                      
+-					 *
+-					 *        dJ     \bar{v}^2
+-					 * DU = - -- = ------------- (u   - u )
+-					 *        du   (u   + eps)^2    obs
+-					 *               obs
+-					 */
+-					for(i=0;i<numnodes;i++){
+-						scalex=pow(meanvel/(vxobs+epsvel),2); if(vxobs==0)scalex=0;
+-						scaley=pow(meanvel/(vyobs+epsvel),2); if(vyobs==0)scaley=0;
+-						dux=scalex*(vxobs-vx);
+-						duy=scaley*(vyobs-vy);
+-						pe->values[i*NDOF2+0]+=dux*weight*Jdet*gauss->weight*basis[i]; 
+-						pe->values[i*NDOF2+1]+=duy*weight*Jdet*gauss->weight*basis[i]; 
+-					}
+-					break;
+-				case SurfaceLogVelMisfitEnum:
+-					/*
+-					 *                 [        vel + eps     ] 2
+-					 * J = 4 \bar{v}^2 | log ( -----------  ) |  
+-					 *                 [       vel   + eps    ]
+-					 *                            obs
+-					 *
+-					 *        dJ                 2 * log(...)
+-					 * DU = - -- = - 4 \bar{v}^2 -------------  u
+-					 *        du                 vel^2 + eps
+-					 *            
+-					 */
+-					for(i=0;i<numnodes;i++){
+-						velocity_mag    =sqrt(pow(vx,   2)+pow(vy,   2))+epsvel;
+-						obs_velocity_mag=sqrt(pow(vxobs,2)+pow(vyobs,2))+epsvel;
+-						scale=-8*pow(meanvel,2)/pow(velocity_mag,2)*log(velocity_mag/obs_velocity_mag);
+-						dux=scale*vx;
+-						duy=scale*vy;
+-						pe->values[i*NDOF2+0]+=dux*weight*Jdet*gauss->weight*basis[i]; 
+-						pe->values[i*NDOF2+1]+=duy*weight*Jdet*gauss->weight*basis[i]; 
+-					}
+-					break;
+-				case SurfaceAverageVelMisfitEnum:
+-					/*
+-					 *      1                    2              2
+-					 * J = ---  sqrt(  (u - u   )  +  (v - v   )  )
+-					 *      S                obs            obs
+-					 *
+-					 *        dJ      1       1 
+-					 * DU = - -- = - --- ----------- * 2 (u - u   )
+-					 *        du      S  2 sqrt(...)           obs
+-					 */
+-					for(i=0;i<numnodes;i++){
+-						scale=1./(S*2*sqrt(pow(vx-vxobs,2)+pow(vy-vyobs,2))+epsvel);
+-						dux=scale*(vxobs-vx);
+-						duy=scale*(vyobs-vy);
+-						pe->values[i*NDOF2+0]+=dux*weight*Jdet*gauss->weight*basis[i]; 
+-						pe->values[i*NDOF2+1]+=duy*weight*Jdet*gauss->weight*basis[i]; 
+-					}
+-					break;
+-				case SurfaceLogVxVyMisfitEnum:
+-					/*
+-					 *      1            [        |u| + eps     2          |v| + eps     2  ]
+-					 * J = --- \bar{v}^2 | log ( -----------  )   +  log ( -----------  )   |  
+-					 *      2            [       |u    |+ eps              |v    |+ eps     ]
+-					 *                              obs                       obs
+-					 *        dJ                              1      u                             1
+-					 * DU = - -- = - \bar{v}^2 log(u...) --------- ----  ~ - \bar{v}^2 log(u...) ------
+-					 *        du                         |u| + eps  |u|                           u + eps
+-					 */
+-					for(i=0;i<numnodes;i++){
+-						dux = - meanvel*meanvel * log((fabs(vx)+epsvel)/(fabs(vxobs)+epsvel)) / (vx+epsvel);
+-						duy = - meanvel*meanvel * log((fabs(vy)+epsvel)/(fabs(vyobs)+epsvel)) / (vy+epsvel);
+-						pe->values[i*NDOF2+0]+=dux*weight*Jdet*gauss->weight*basis[i]; 
+-						pe->values[i*NDOF2+1]+=duy*weight*Jdet*gauss->weight*basis[i]; 
+-					}
+-					break;
+-				case DragCoefficientAbsGradientEnum:
+-					/*Nothing in P vector*/
+-					break;
+-				case ThicknessAbsGradientEnum:
+-					/*Nothing in P vector*/
+-					break;
+-				case ThicknessAlongGradientEnum:
+-					/*Nothing in P vector*/
+-					break;
+-				case ThicknessAcrossGradientEnum:
+-					/*Nothing in P vector*/
+-					break;
+-				case RheologyBbarAbsGradientEnum:
+-					/*Nothing in P vector*/
+-					break;
+-				default:
+-					_error_("response " << EnumToStringx(responses[resp]) << " not supported yet");
+-			}
+-		}
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	xDelete<int>(responses);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+ /*FUNCTION Tria::DragCoefficientAbsGradient{{{*/
+ IssmDouble Tria::DragCoefficientAbsGradient(void){
+ 
+@@ -6450,246 +5564,6 @@
+ 	return Ke;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::CreatePVectorHydrologyShreve {{{*/
+-ElementVector* Tria::CreatePVectorHydrologyShreve(void){
+-
+-	/*Intermediaries */
+-	int        i;
+-	IssmDouble Jdet,dt;
+-	IssmDouble basal_melting_g;
+-	IssmDouble old_watercolumn_g;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-
+-	/*Skip if water or ice shelf element*/
+-	if(NoIceInElement() || IsFloating()) return NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element vector*/
+-	ElementVector* pe=new ElementVector(nodes,numnodes,this->parameters);
+-	IssmDouble*    basis = xNewZeroInit<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	Input* basal_melting_input=inputs->GetInput(BasalforcingsMeltingRateEnum); _assert_(basal_melting_input);
+-	Input* old_watercolumn_input=inputs->GetInput(WaterColumnOldEnum);         _assert_(old_watercolumn_input);
+-	/*Initialize basal_melting_correction_g to 0, do not forget!:*/
+-	/* Start  looping on the number of gaussian points: */
+-	GaussTria* gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis, gauss);
+-
+-		basal_melting_input->GetInputValue(&basal_melting_g,gauss);
+-		old_watercolumn_input->GetInputValue(&old_watercolumn_g,gauss);
+-
+-		if(reCast<int,IssmDouble>(dt)){
+-			for(i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*(old_watercolumn_g+dt*basal_melting_g)*basis[i];
+-		}
+-		else{
+-			for(i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*basal_melting_g*basis[i];
+-		}
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreatePVectorHydrologyDCInefficient {{{*/
+-ElementVector* Tria::CreatePVectorHydrologyDCInefficient(void){
+-
+-	/*Intermediaries */
+-	IssmDouble Jdet;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble dt,scalar,water_head;
+-	IssmDouble water_load,transfer;
+-	IssmDouble sediment_storing;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element vector and other vectors*/
+-	ElementVector* pe    = new ElementVector(nodes,numnodes,this->parameters);
+-	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	sediment_storing = matpar->GetSedimentStoring();
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	Input* water_input=inputs->GetInput(BasalforcingsMeltingRateEnum);  _assert_(water_input);
+-	Input* transfer_input=inputs->GetInput(WaterTransferEnum);  _assert_(transfer_input);
+-	Input* old_wh_input=NULL; 
+-
+-	if(reCast<bool,IssmDouble>(dt)){
+-		old_wh_input=inputs->GetInput(SedimentHeadOldEnum); _assert_(old_wh_input);
+-	}
+-
+-	/* Start  looping on the number of gaussian points: */
+-	GaussTria* gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis, gauss);
+-
+-		/*Loading term*/
+-		water_input->GetInputValue(&water_load,gauss);
+-		transfer_input->GetInputValue(&transfer,gauss);
+-		scalar = Jdet*gauss->weight*(water_load+transfer);
+-		if(reCast<bool,IssmDouble>(dt)) scalar = scalar*dt;
+-		for(int i=0;i<numnodes;i++) pe->values[i]+=scalar*basis[i];
+-
+-		/*Transient term*/
+-		if(reCast<bool,IssmDouble>(dt)){
+-			old_wh_input->GetInputValue(&water_head,gauss);
+-			scalar = Jdet*gauss->weight*water_head*sediment_storing;
+-			for(int i=0;i<numnodes;i++) pe->values[i]+=scalar*basis[i];
+-		}
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreatePVectorHydrologyDCEfficient {{{*/
+-ElementVector* Tria::CreatePVectorHydrologyDCEfficient(void){
+-
+-	/*Intermediaries */
+-	IssmDouble connectivity;
+-	IssmDouble Jdet;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble dt,scalar,water_head;
+-	IssmDouble transfer,residual;
+-	IssmDouble epl_thickness;
+-	IssmDouble epl_specificstoring;
+-	GaussTria* gauss = NULL;
+-
+-	/*Check that all nodes are active, else return empty matrix*/
+-	if(!this->AllActive()){
+-		return NULL;
+-	}
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element vector and other vectors*/
+-	ElementVector* pe    = new ElementVector(nodes,numnodes,this->parameters);
+-	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	epl_specificstoring = matpar->GetEplSpecificStoring();
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	Input* residual_input=inputs->GetInput(SedimentHeadResidualEnum);     _assert_(residual_input);
+-	Input* transfer_input=inputs->GetInput(WaterTransferEnum);            _assert_(transfer_input);
+-	Input* thickness_input=inputs->GetInput(HydrologydcEplThicknessEnum); _assert_(thickness_input);
+-	Input* old_wh_input=NULL; 
+-
+-	if(reCast<bool,IssmDouble>(dt)){
+-		old_wh_input=inputs->GetInput(EplHeadOldEnum); _assert_(old_wh_input);
+-	}
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis,gauss);
+-
+-		/*Loading term*/
+-		transfer_input->GetInputValue(&transfer,gauss);
+-		scalar = Jdet*gauss->weight*(-transfer);
+-		if(reCast<bool,IssmDouble>(dt)) scalar = scalar*dt;
+-		for(int i=0;i<numnodes;i++) pe->values[i]+=scalar*basis[i];
+-
+-		/*Transient term*/
+-		if(reCast<bool,IssmDouble>(dt)){
+-			thickness_input->GetInputValue(&epl_thickness,gauss);
+-			old_wh_input->GetInputValue(&water_head,gauss);
+-			scalar = Jdet*gauss->weight*water_head*epl_specificstoring*epl_thickness;
+-			for(int i=0;i<numnodes;i++) pe->values[i]+=scalar*basis[i];
+-		}
+-	}
+-	delete gauss;
+-
+-	/*	Add residual if necessary*/
+-	gauss=new GaussTria();
+-	for(int iv=0;iv<NUMVERTICES;iv++){
+-		gauss->GaussVertex(iv);
+-
+-		connectivity = IssmDouble(vertices[iv]->Connectivity());
+-		residual_input->GetInputValue(&residual,gauss);
+-		pe->values[iv]+=residual/connectivity;
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreatePVectorL2ProjectionEPL {{{*/
+-ElementVector* Tria::CreatePVectorL2ProjectionEPL(void){
+-
+-	/*Intermediaries */
+-	int        i,input_enum;
+-	IssmDouble Jdet,value;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble slopes[2];
+-	Input*     input  = NULL;
+-	Input*     input2 = NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element vector*/
+-	ElementVector* pe    = new ElementVector(nodes,numnodes,this->parameters);
+-	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&input_enum,InputToL2ProjectEnum);
+-	switch(input_enum){
+-		case EplHeadSlopeXEnum: input2 = inputs->GetInput(EplHeadEnum); _assert_(input2); break;
+-		case EplHeadSlopeYEnum: input2 = inputs->GetInput(EplHeadEnum); _assert_(input2); break;
+-	default: input = inputs->GetInput(input_enum);
+-	}
+-
+-	/* Start  looping on the number of gaussian points: */
+-	GaussTria* gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis,gauss);
+-
+-		if(input2) input2->GetInputDerivativeValue(&slopes[0],&xyz_list[0][0],gauss);
+-		switch(input_enum){
+-			case EplHeadSlopeXEnum: value = slopes[0]; break;
+-			case EplHeadSlopeYEnum: value = slopes[1]; break;
+-			default: input->GetInputValue(&value,gauss);
+-		}
+-
+-		for(i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*value*basis[i];
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+ /*FUNCTION Tria::GetSolutionFromInputsOneDof{{{*/
+ void  Tria::GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution, int enum_type){
+ 
+@@ -7615,240 +6489,6 @@
+ 	return Ke;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::CreatePVectorMasstransport{{{*/
+-ElementVector* Tria::CreatePVectorMasstransport(void){
+-
+-	switch(GetElementType()){
+-		case P1Enum: case P2Enum:
+-			return CreatePVectorMasstransport_CG();
+-		case P1DGEnum:
+-			return CreatePVectorMasstransport_DG();
+-		default:
+-			_error_("Element type " << EnumToStringx(GetElementType()) << " not supported yet");
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreatePVectorMasstransport_CG {{{*/
+-ElementVector* Tria::CreatePVectorMasstransport_CG(void){
+-
+-	/*Intermediaries */
+-	IssmDouble Jdet,dt;
+-	IssmDouble ms,mb,mb_correction,thickness;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element vector and other vectors*/
+-	ElementVector* pe    = new ElementVector(nodes,numnodes,this->parameters);
+-	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	Input* ms_input     = inputs->GetInput(SurfaceforcingsMassBalanceEnum);      _assert_(ms_input);
+-	Input* mb_input     = inputs->GetInput(BasalforcingsMeltingRateEnum); _assert_(mb_input);
+-	Input* mb_correction_input = inputs->GetInput(BasalforcingsMeltingRateCorrectionEnum);
+-	Input* thickness_input  = inputs->GetInput(ThicknessEnum);     _assert_(thickness_input);
+-
+-	/*Initialize mb_correction to 0, do not forget!:*/
+-	/* Start  looping on the number of gaussian points: */
+-	GaussTria* gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis,gauss);
+-
+-		ms_input->GetInputValue(&ms,gauss);
+-		mb_input->GetInputValue(&mb,gauss);
+-		thickness_input->GetInputValue(&thickness,gauss);
+-		if(mb_correction_input)
+-		 mb_correction_input->GetInputValue(&mb_correction,gauss);
+-		else
+-		 mb_correction=0.;
+-
+-		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*(thickness+dt*(ms-mb-mb_correction))*basis[i];
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreatePVectorMasstransport_DG {{{*/
+-ElementVector* Tria::CreatePVectorMasstransport_DG(void){
+-
+-	/*Intermediaries */
+-	IssmDouble Jdet,dt;
+-	IssmDouble ms,mb,thickness;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element vector and other vectors*/
+-	ElementVector* pe    = new ElementVector(nodes,numnodes,this->parameters);
+-	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* ms_input=inputs->GetInput(SurfaceforcingsMassBalanceEnum); _assert_(ms_input);
+-	Input* mb_input=inputs->GetInput(BasalforcingsMeltingRateEnum);   _assert_(mb_input);
+-	Input* thickness_input=inputs->GetInput(ThicknessEnum);           _assert_(thickness_input);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	GaussTria* gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis,gauss);
+-
+-		ms_input->GetInputValue(&ms,gauss);
+-		mb_input->GetInputValue(&mb,gauss);
+-		thickness_input->GetInputValue(&thickness,gauss);
+-
+-		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*(thickness+dt*(ms-mb))*basis[i];
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreatePVectorFreeSurfaceTop {{{*/
+-ElementVector* Tria::CreatePVectorFreeSurfaceTop(void){
+-
+-	/*Intermediaries */
+-	IssmDouble Jdet,dt;
+-	IssmDouble ms,surface,vz;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element vector and other vectors*/
+-	ElementVector* pe    = new ElementVector(nodes,numnodes,this->parameters);
+-	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	Input* vz_input     = inputs->GetInput(VzEnum);                         _assert_(vz_input);
+-	Input* ms_input     = inputs->GetInput(SurfaceforcingsMassBalanceEnum); _assert_(ms_input);
+-	Input* surface_input= inputs->GetInput(SurfaceEnum);                    _assert_(surface_input);
+-
+-	/*Initialize mb_correction to 0, do not forget!:*/
+-	/* Start  looping on the number of gaussian points: */
+-	GaussTria* gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis,gauss);
+-
+-		vz_input->GetInputValue(&vz,gauss);
+-		ms_input->GetInputValue(&ms,gauss);
+-		surface_input->GetInputValue(&surface,gauss);
+-
+-		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*(surface + dt*ms + dt*vz)*basis[i];
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreatePVectorFreeSurfaceTop1D {{{*/
+-ElementVector* Tria::CreatePVectorFreeSurfaceTop1D(void){
+-
+-	if(!HasEdgeOnSurface()) return NULL;
+-
+-	int index1,index2;
+-	this->EdgeOnSurfaceIndices(&index1,&index2);
+-
+-	Seg* seg=(Seg*)SpawnSeg(index1,index2); 
+-	ElementVector* pe=seg->CreatePVectorFreeSurfaceTop();
+-	delete seg->material; delete seg;
+-
+-	/*clean up and return*/
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreatePVectorFreeSurfaceBase {{{*/
+-ElementVector* Tria::CreatePVectorFreeSurfaceBase(void){
+-
+-	/*Intermediaries */
+-	IssmDouble Jdet,dt;
+-	IssmDouble mb,mb_correction,bed,vz;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element vector and other vectors*/
+-	ElementVector* pe    = new ElementVector(nodes,numnodes,this->parameters);
+-	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	Input* vz_input  = inputs->GetInput(VzEnum);                         _assert_(vz_input);
+-	Input* mb_input  = inputs->GetInput(BasalforcingsMeltingRateEnum);   _assert_(mb_input);
+-	Input* mb_correction_input = inputs->GetInput(BasalforcingsMeltingRateCorrectionEnum);
+-	Input* bed_input = inputs->GetInput(BedEnum);                        _assert_(bed_input);
+-
+-	/*Initialize mb_correction to 0, do not forget!:*/
+-	/* Start  looping on the number of gaussian points: */
+-	GaussTria* gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis,gauss);
+-
+-		vz_input->GetInputValue(&vz,gauss);
+-		mb_input->GetInputValue(&mb,gauss);
+-		bed_input->GetInputValue(&bed,gauss);
+-		if(mb_correction_input)
+-		 mb_correction_input->GetInputValue(&mb_correction,gauss);
+-		else
+-		 mb_correction=0.;
+-
+-		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*(bed+dt*(mb-mb_correction) + dt*vz)*basis[i];
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreatePVectorFreeSurfaceBase1D {{{*/
+-ElementVector* Tria::CreatePVectorFreeSurfaceBase1D(void){
+-
+-	if(!HasEdgeOnBed()) return NULL;
+-
+-	int index1,index2;
+-	this->EdgeOnBedIndices(&index1,&index2);
+-
+-	Seg* seg=(Seg*)SpawnSeg(index1,index2); 
+-	ElementVector* pe=seg->CreatePVectorFreeSurfaceBase();
+-	delete seg->material; delete seg;
+-
+-	/*clean up and return*/
+-	return pe;
+-}
+-/*}}}*/
+ #endif
+ 
+ #ifdef _HAVE_DAMAGE_
+@@ -7983,66 +6623,6 @@
+ 	return Ke;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::CreatePVectorDamageEvolution{{{*/
+-ElementVector* Tria::CreatePVectorDamageEvolution(void){
+-
+-	switch(GetElementType()){
+-		case P1Enum: case P2Enum:
+-			return CreatePVectorDamageEvolution_CG();
+-		case P1DGEnum:
+-			_error_("DG not implemented yet");
+-		default:
+-			_error_("Element type " << EnumToStringx(GetElementType()) << " not supported yet");
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreatePVectorDamageEvolution_CG {{{*/
+-ElementVector* Tria::CreatePVectorDamageEvolution_CG(void){
+-
+-	/*Intermediaries */
+-	IssmDouble  Jdet ,dt;
+-	IssmDouble  f,damage;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble  f_list[NUMVERTICES];
+-	Input      *damage_input             = NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element vector and other vectors*/
+-	ElementVector* pe    = new ElementVector(nodes,numnodes,this->parameters);
+-	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	damage_input  = this->material->inputs->GetInput(DamageDbarEnum);     _assert_(damage_input);
+-	
+-	/*retrieve damage evolution forcing function: */
+-	this->DamageEvolutionF(&f_list[0]);
+-
+-	/*Initialize forcing function f to 0, do not forget!:*/
+-	/* Start  looping on the number of gaussian points: */
+-	GaussTria* gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis,gauss);
+-
+-		TriaRef::GetInputValue(&f,f_list,gauss);
+-		damage_input->GetInputValue(&damage,gauss);
+-
+-		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*(damage+dt*f)*basis[i];
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+ /*FUNCTION Tria::DamageEvolutionF{{{*/
+ void Tria::DamageEvolutionF(IssmDouble* f){
+ 
+@@ -8551,286 +7131,6 @@
+ 	return Ke;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::CreatePVectorBalancethickness{{{*/
+-ElementVector* Tria::CreatePVectorBalancethickness(void){
+-
+-	switch(GetElementType()){
+-		case P1Enum:
+-			return CreatePVectorBalancethickness_CG();
+-			break;
+-		case P1DGEnum:
+-			return CreatePVectorBalancethickness_DG();
+-		default:
+-			_error_("Element type " << EnumToStringx(GetElementType()) << " not supported yet");
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreatePVectorBalancethickness_CG{{{*/
+-ElementVector* Tria::CreatePVectorBalancethickness_CG(void){
+-
+-	/*Intermediaries */
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble dhdt_g,mb_g,ms_g,Jdet;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element vector and other vectors*/
+-	ElementVector* pe    = new ElementVector(nodes,numnodes,this->parameters);
+-	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* ms_input=inputs->GetInput(SurfaceforcingsMassBalanceEnum); _assert_(ms_input);
+-	Input* mb_input=inputs->GetInput(BasalforcingsMeltingRateEnum);   _assert_(mb_input);
+-	Input* dhdt_input=inputs->GetInput(BalancethicknessThickeningRateEnum); _assert_(dhdt_input);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	GaussTria* gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		ms_input->GetInputValue(&ms_g,gauss);
+-		mb_input->GetInputValue(&mb_g,gauss);
+-		dhdt_input->GetInputValue(&dhdt_g,gauss);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis,gauss);
+-
+-		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*(ms_g-mb_g-dhdt_g)*basis[i];
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreatePVectorBalancethickness_DG {{{*/
+-ElementVector* Tria::CreatePVectorBalancethickness_DG(void){
+-
+-	/*Intermediaries */
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble mb_g,ms_g,dhdt_g,Jdet;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element vector and other vectors*/
+-	ElementVector* pe    = new ElementVector(nodes,numnodes,this->parameters);
+-	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* ms_input=inputs->GetInput(SurfaceforcingsMassBalanceEnum); _assert_(ms_input);
+-	Input* mb_input=inputs->GetInput(BasalforcingsMeltingRateEnum);   _assert_(mb_input);
+-	Input* dhdt_input=inputs->GetInput(BalancethicknessThickeningRateEnum);_assert_(dhdt_input);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	GaussTria* gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		ms_input->GetInputValue(&ms_g,gauss);
+-		mb_input->GetInputValue(&mb_g,gauss);
+-		dhdt_input->GetInputValue(&dhdt_g,gauss);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis,gauss);
+-
+-		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*(ms_g-mb_g-dhdt_g)*basis[i];
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreatePVectorBalancevelocity{{{*/
+-ElementVector* Tria::CreatePVectorBalancevelocity(void){
+-
+-	/*Intermediaries */
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble dhdt_g,mb_g,ms_g,Jdet;
+-	IssmDouble h,gamma,thickness;
+-	IssmDouble hnx,hny,dhnx[2],dhny[2];
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element vector and other vectors*/
+-	ElementVector* pe    = new ElementVector(nodes,numnodes,this->parameters);
+-	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+-	IssmDouble*    dbasis = xNew<IssmDouble>(numnodes*2);
+-	IssmDouble*    H      = xNew<IssmDouble>(numnodes);
+-	IssmDouble*    Nx     = xNew<IssmDouble>(numnodes);
+-	IssmDouble*    Ny     = xNew<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* ms_input=inputs->GetInput(SurfaceforcingsMassBalanceEnum); _assert_(ms_input);
+-	Input* mb_input=inputs->GetInput(BasalforcingsMeltingRateEnum);   _assert_(mb_input);
+-	Input* dhdt_input=inputs->GetInput(BalancethicknessThickeningRateEnum); _assert_(dhdt_input);
+-	Input* H_input=inputs->GetInput(ThicknessEnum); _assert_(H_input);
+-	h=sqrt(2.*this->GetArea());
+-
+-	/*Get vector N for all nodes*/
+-	GetInputListOnNodes(Nx,SurfaceSlopeXEnum);
+-	GetInputListOnNodes(Ny,SurfaceSlopeYEnum);
+-	GetInputListOnNodes(H,ThicknessEnum);
+-	for(int i=0;i<numnodes;i++){
+-		IssmDouble norm=sqrt(Nx[i]*Nx[i]+Ny[i]*Ny[i]+1.e-10);
+-		Nx[i] = -H[i]*Nx[i]/norm;
+-		Ny[i] = -H[i]*Ny[i]/norm;
+-	}
+-
+-	/* Start  looping on the number of gaussian points: */
+-	GaussTria* gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		ms_input->GetInputValue(&ms_g,gauss);
+-		mb_input->GetInputValue(&mb_g,gauss);
+-		dhdt_input->GetInputValue(&dhdt_g,gauss);
+-		H_input->GetInputValue(&thickness,gauss);
+-		if(thickness<50.) thickness=50.;
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis,gauss);
+-		GetNodalFunctionsDerivatives(dbasis,&xyz_list[0][0],gauss);
+-
+-		TriaRef::GetInputDerivativeValue(&dhnx[0],Nx,&xyz_list[0][0],gauss);
+-		TriaRef::GetInputDerivativeValue(&dhny[0],Ny,&xyz_list[0][0],gauss);
+-		TriaRef::GetInputValue(&hnx,Nx,gauss);
+-		TriaRef::GetInputValue(&hny,Ny,gauss);
+-
+-		gamma=h/(2.*thickness+1.e-10);
+-
+-		for(int i=0;i<numnodes;i++){
+-			pe->values[i]+=Jdet*gauss->weight*(ms_g-mb_g-dhdt_g)*(
+-						basis[i] + gamma*(basis[i]*(dhnx[0]+dhny[1])+hnx*dbasis[0*numnodes+i] + hny*dbasis[1*numnodes+i])
+-						);
+-		}
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	xDelete<IssmDouble>(dbasis);
+-	xDelete<IssmDouble>(H);
+-	xDelete<IssmDouble>(Nx);
+-	xDelete<IssmDouble>(Ny);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreatePVectorSmoothedSlopeX{{{*/
+-ElementVector* Tria::CreatePVectorSmoothedSlopeX(void){
+-
+-	/*Intermediaries */
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble Jdet;
+-	IssmDouble thickness,slope[2];
+-	IssmDouble taud_x,norms,normv,vx,vy;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element vector and other vectors*/
+-	ElementVector* pe    = new ElementVector(nodes,numnodes,this->parameters);
+-	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* H_input       = inputs->GetInput(ThicknessEnum); _assert_(H_input);
+-	Input* surface_input = inputs->GetInput(SurfaceEnum);   _assert_(surface_input);
+-	Input* vx_input      = inputs->GetInput(VxEnum);
+-	Input* vy_input      = inputs->GetInput(VyEnum);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	GaussTria* gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		H_input->GetInputValue(&thickness,gauss);
+-		surface_input->GetInputDerivativeValue(&slope[0],&xyz_list[0][0],gauss);
+-		if(vx_input && vy_input){
+-			vx_input->GetInputValue(&vx,gauss);
+-			vy_input->GetInputValue(&vy,gauss);
+-			norms = sqrt(slope[0]*slope[0]+slope[1]*slope[1]+1.e-10);
+-			normv = sqrt(vx*vx + vy*vy);
+-			if(normv>15./(365.*24.*3600.)) slope[0] = -vx/normv*norms;
+-		}
+-		taud_x = matpar->GetRhoIce()*matpar->GetG()*thickness*slope[0];
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis,gauss);
+-
+-		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*taud_x*basis[i];
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreatePVectorSmoothedSlopeY{{{*/
+-ElementVector* Tria::CreatePVectorSmoothedSlopeY(void){
+-
+-	/*Intermediaries */
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble Jdet;
+-	IssmDouble thickness,slope[2];
+-	IssmDouble taud_y,norms,normv,vx,vy;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element vector and other vectors*/
+-	ElementVector* pe    = new ElementVector(nodes,numnodes,this->parameters);
+-	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* H_input       = inputs->GetInput(ThicknessEnum); _assert_(H_input);
+-	Input* surface_input = inputs->GetInput(SurfaceEnum);   _assert_(surface_input);
+-	Input* vx_input      = inputs->GetInput(VxEnum);
+-	Input* vy_input      = inputs->GetInput(VyEnum);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	GaussTria* gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		H_input->GetInputValue(&thickness,gauss);
+-		surface_input->GetInputDerivativeValue(&slope[0],&xyz_list[0][0],gauss);
+-		if(vx_input && vy_input){
+-			vx_input->GetInputValue(&vx,gauss);
+-			vy_input->GetInputValue(&vy,gauss);
+-			norms = sqrt(slope[0]*slope[0]+slope[1]*slope[1]+1.e-10);
+-			normv = sqrt(vx*vx + vy*vy);
+-			if(normv>15./(365.*24.*3600.)) slope[1] = -vy/normv*norms;
+-		}
+-		taud_y = matpar->GetRhoIce()*matpar->GetG()*thickness*slope[1];
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis,gauss);
+-
+-		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*taud_y*basis[i];
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+ #endif
+ 
+ #ifdef _HAVE_GROUNDINGLINE_
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16981)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16982)
+@@ -221,22 +221,6 @@
+ 		ElementMatrix* CreateKMatrixFreeSurfaceBase1D(void);
+ 		ElementMatrix* CreateMassMatrix(void);
+ 		ElementMatrix* CreateBasalMassMatrix(void);
+-		ElementVector* CreatePVector(void);
+-		ElementVector* CreatePVectorBalancethickness(void);
+-		ElementVector* CreatePVectorBalancethickness_DG(void);
+-		ElementVector* CreatePVectorBalancethickness_CG(void);
+-		ElementVector* CreatePVectorBalancevelocity(void);
+-		ElementVector* CreatePVectorSmoothedSlopeX(void);
+-		ElementVector* CreatePVectorSmoothedSlopeY(void);
+-		ElementVector* CreatePVectorMasstransport(void);
+-		ElementVector* CreatePVectorMasstransport_CG(void);
+-		ElementVector* CreatePVectorMasstransport_DG(void);
+-		ElementVector* CreatePVectorFreeSurfaceTop(void);
+-		ElementVector* CreatePVectorFreeSurfaceTop1D(void);
+-		ElementVector* CreatePVectorFreeSurfaceBase(void);
+-		ElementVector* CreatePVectorFreeSurfaceBase1D(void);
+-		ElementVector* CreatePVectorL2Projection(void);
+-		ElementVector* CreatePVectorL2ProjectionBase(void);
+ 		IssmDouble     EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented");};
+ 		IssmDouble     EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure){_error_("not implemented");};
+ 		IssmDouble     GetArea(void);
+@@ -305,15 +289,7 @@
+ 		ElementMatrix* CreateKMatrixStressbalanceFS(void);
+ 		ElementMatrix* CreateKMatrixStressbalanceFSViscous(void);
+ 		ElementMatrix* CreateKMatrixStressbalanceFSFriction(void);
+-		ElementVector* CreatePVectorStressbalanceSSA(void);
+-		ElementVector* CreatePVectorStressbalanceSSADrivingStress(void);
+-		ElementVector* CreatePVectorStressbalanceSSAFront(void);
+-		ElementVector* CreatePVectorStressbalanceSIA(void);
+-		ElementVector* CreatePVectorStressbalanceFS(void);
+-		ElementVector* CreatePVectorStressbalanceFSFront(void);
+-		ElementVector* CreatePVectorStressbalanceFSViscous(void);
+ 		void           PVectorGLSstabilization(ElementVector* pe);
+-		ElementVector* CreatePVectorStressbalanceFSShelf(void);
+ 		ElementMatrix* CreateJacobianStressbalanceSSA(void);
+ 		IssmDouble     GetYcoord(GaussTria* gauss);
+ 		#endif
+@@ -321,8 +297,6 @@
+ 		#ifdef _HAVE_CONTROL_
+ 		ElementMatrix* CreateKMatrixAdjointBalancethickness(void);
+ 		ElementMatrix* CreateKMatrixAdjointSSA(void);
+-		ElementVector* CreatePVectorAdjointHoriz(void);
+-		ElementVector* CreatePVectorAdjointBalancethickness(void);
+ 		#endif
+ 
+ 		void UpdateConstraintsExtrudeFromBase(void);
+@@ -338,10 +312,6 @@
+ 		ElementMatrix* CreateKMatrixHydrologyDCInefficient(void);
+ 		ElementMatrix* CreateKMatrixHydrologyDCEfficient(void);
+ 		ElementMatrix* CreateEPLDomainMassMatrix(void);
+-		ElementVector* CreatePVectorHydrologyShreve(void);
+-		ElementVector* CreatePVectorHydrologyDCInefficient(void);
+-		ElementVector* CreatePVectorHydrologyDCEfficient(void);
+-		ElementVector* CreatePVectorL2ProjectionEPL(void);
+ 		void           CreateHydrologyWaterVelocityInput(void);
+ 		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index);
+ 		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode);
+@@ -355,8 +325,6 @@
+ 		#ifdef _HAVE_DAMAGE_
+ 		ElementMatrix* CreateKMatrixDamageEvolution(void);
+ 		ElementMatrix* CreateKMatrixDamageEvolution_CG(void);
+-		ElementVector* CreatePVectorDamageEvolution(void);
+-		ElementVector* CreatePVectorDamageEvolution_CG(void);
+ 		void           DamageEvolutionF(IssmDouble* flist);
+ 		#endif
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16981)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16982)
+@@ -541,149 +541,6 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Penta::CreatePVector(void) {{{*/
+-ElementVector* Penta::CreatePVector(void){
+-
+-	/*retrieve parameters: */
+-	int analysis_type;
+-	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-
+-	/*if debugging mode, check that all pointers exist {{{*/
+-	_assert_(this->nodes && this->material && this->matpar && this->verticalneighbors && this->parameters && this->inputs);
+-	/*}}}*/
+-
+-	/*Skip if water element*/
+-	if(NoIceInElement()) return NULL;
+-
+-	/*Just branch to the correct element stiffness matrix generator, according to the type of analysis we are carrying out: */
+-	switch(analysis_type){
+-		#ifdef _HAVE_STRESSBALANCE_
+-		case StressbalanceAnalysisEnum:
+-			return CreatePVectorStressbalanceHoriz();
+-			break;
+-		case StressbalanceSIAAnalysisEnum:
+-			return CreatePVectorStressbalanceSIA();
+-			break;
+-		case StressbalanceVerticalAnalysisEnum:
+-			return CreatePVectorStressbalanceVert();
+-			break;
+-		#endif
+-	 	#ifdef _HAVE_CONTROL_
+-		case AdjointHorizAnalysisEnum:
+-			return CreatePVectorAdjointHoriz();
+-			break;
+-		#endif
+-		#ifdef _HAVE_THERMAL_
+-		case ThermalAnalysisEnum:
+-			return CreatePVectorThermal();
+-			break;
+-		case EnthalpyAnalysisEnum:
+-			return CreatePVectorEnthalpy();
+-			break;
+-		case MeltingAnalysisEnum:
+-			return CreatePVectorMelting();
+-			break;
+-		#endif
+-		case L2ProjectionBaseAnalysisEnum:
+-			return CreatePVectorL2ProjectionBase();
+-			break;
+-		case MasstransportAnalysisEnum:
+-			return CreatePVectorMasstransport();
+-			break;
+-		case FreeSurfaceTopAnalysisEnum:
+-			return CreatePVectorFreeSurfaceTop();
+-			break;
+-		case FreeSurfaceBaseAnalysisEnum:
+-			return CreatePVectorFreeSurfaceBase();
+-			break;
+-		#ifdef _HAVE_BALANCED_
+-		case BalancethicknessAnalysisEnum:
+-			return CreatePVectorBalancethickness();
+-			break;
+-		#endif
+-		#ifdef _HAVE_HYDROLOGY_
+-	  case HydrologyDCInefficientAnalysisEnum:
+-			return CreatePVectorHydrologyDCInefficient();
+-			break;
+-	  case HydrologyDCEfficientAnalysisEnum:
+-			return CreatePVectorHydrologyDCEfficient();
+-			break;
+-	  case L2ProjectionEPLAnalysisEnum:
+-			return CreatePVectorL2ProjectionEPL();
+-			break;
+-		#endif
+-		default:
+-			_error_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet");
+-	}
+-
+-	/*make compiler happy*/
+-	return NULL;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorMasstransport {{{*/
+-ElementVector* Penta::CreatePVectorMasstransport(void){
+-
+-	if (!IsOnBed()) return NULL;
+-
+-	/*Depth Averaging Vx and Vy*/
+-	this->InputDepthAverageAtBase(VxEnum,VxAverageEnum);
+-	this->InputDepthAverageAtBase(VyEnum,VyAverageEnum);
+-
+-	/*Call Tria function*/
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	ElementVector* pe=tria->CreatePVectorMasstransport();
+-	delete tria->material; delete tria;
+-
+-	/*Delete Vx and Vy averaged*/
+-	this->inputs->DeleteInput(VxAverageEnum);
+-	this->inputs->DeleteInput(VyAverageEnum);
+-
+-	/*Clean up and return*/
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorFreeSurfaceTop {{{*/
+-ElementVector* Penta::CreatePVectorFreeSurfaceTop(void){
+-
+-	if(!IsOnSurface()) return NULL;
+-
+-	/*Call Tria function*/
+-	Tria* tria=(Tria*)SpawnTria(1); //lower face is 0, upper face is 1.
+-	ElementVector* pe=tria->CreatePVectorFreeSurfaceTop();
+-	delete tria->material; delete tria;
+-
+-	/*Clean up and return*/
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorFreeSurfaceBase {{{*/
+-ElementVector* Penta::CreatePVectorFreeSurfaceBase(void){
+-
+-	if(!IsOnBed()) return NULL;
+-
+-	/*Call Tria function*/
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	ElementVector* pe=tria->CreatePVectorFreeSurfaceBase();
+-	delete tria->material; delete tria;
+-
+-	/*Clean up and return*/
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorL2ProjectionBase {{{*/
+-ElementVector* Penta::CreatePVectorL2ProjectionBase(void){
+-
+-	if (!IsOnBed()) return NULL;
+-
+-	/*Call Tria function*/
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	ElementVector* pe=tria->CreatePVectorL2Projection();
+-	delete tria->material; delete tria;
+-
+-	/*clean up and return*/
+-	return pe;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::CreateJacobianMatrix{{{*/
+ void  Penta::CreateJacobianMatrix(Matrix<IssmDouble>* Jff){
+ 
+@@ -4030,506 +3887,6 @@
+ 	return Ke;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::CreatePVectorEnthalpy {{{*/
+-ElementVector* Penta::CreatePVectorEnthalpy(void){
+-
+-	/*compute all load vectors for this element*/
+-	ElementVector* pe1=CreatePVectorEnthalpyVolume();
+-	ElementVector* pe2=CreatePVectorEnthalpySheet();
+-	ElementVector* pe3=CreatePVectorEnthalpyShelf();
+-	ElementVector* pe =new ElementVector(pe1,pe2,pe3);
+-
+-	/*clean-up and return*/
+-	delete pe1;
+-	delete pe2;
+-	delete pe3;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorEnthalpyVolume {{{*/
+-ElementVector* Penta::CreatePVectorEnthalpyVolume(void){
+-
+-	/*Constants*/
+-	const int  numdof=NUMVERTICES*NDOF1;
+-
+-	/*Intermediaries*/
+-	int        i;
+-	int        stabilization;
+-	IssmDouble Jdet,phi,dt;
+-	IssmDouble rho_ice,heatcapacity;
+-	IssmDouble thermalconductivity,kappa;
+-	IssmDouble viscosity,pressure,enthalpy;
+-	IssmDouble enthalpypicard[NUMVERTICES], pressure_p[NUMVERTICES];
+-	IssmDouble tau_parameter,diameter;
+-	IssmDouble u,v,w;
+-	IssmDouble scalar_def,scalar_transient;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble L[numdof];
+-	IssmDouble dbasis[3][6];
+-	IssmDouble epsilon[6];
+-	GaussPenta *gauss=NULL;
+-
+-	/*Initialize Element vector*/
+-	ElementVector* pe=new ElementVector(nodes,NUMVERTICES,this->parameters);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	rho_ice=matpar->GetRhoIce();
+-	heatcapacity=matpar->GetHeatCapacity();
+-	thermalconductivity=matpar->GetThermalConductivity();
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	this->parameters->FindParam(&stabilization,ThermalStabilizationEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum);                                  _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);                                  _assert_(vy_input);
+-	Input* vz_input=inputs->GetInput(VzEnum);                                  _assert_(vz_input);
+-	Input* enthalpy_input=NULL; 
+-	if(reCast<bool,IssmDouble>(dt)){
+-		enthalpy_input=inputs->GetInput(EnthalpyEnum); _assert_(enthalpy_input);
+-	}
+-	if (stabilization==2){
+-		diameter=MinEdgeLength(&xyz_list[0][0]);
+-	}
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(3,3);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctionsP1(&L[0], gauss);
+-
+-		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+-		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+-		GetPhi(&phi, &epsilon[0], viscosity);
+-
+-		scalar_def=phi/rho_ice*Jdet*gauss->weight;
+-		if(reCast<bool,IssmDouble>(dt)) scalar_def=scalar_def*dt;
+-		
+-		/*TODO: add -beta*laplace T_m(p)*/
+-		for(i=0;i<NUMVERTICES;i++)  pe->values[i]+=scalar_def*L[i];
+-
+-		/* Build transient now */
+-		if(reCast<bool,IssmDouble>(dt)){
+-			enthalpy_input->GetInputValue(&enthalpy, gauss);
+-			scalar_transient=enthalpy*Jdet*gauss->weight;
+-			for(i=0;i<NUMVERTICES;i++)  pe->values[i]+=scalar_transient*L[i];
+-		}
+-
+-		if(stabilization==2){
+-			GetNodalFunctionsP1Derivatives(&dbasis[0][0],&xyz_list[0][0], gauss);
+-
+-			vx_input->GetInputValue(&u, gauss);
+-			vy_input->GetInputValue(&v, gauss);
+-			vz_input->GetInputValue(&w, gauss);
+-			GetInputListOnVertices(&enthalpypicard[0],EnthalpyPicardEnum);
+-			GetInputListOnVertices(&pressure_p[0],PressureEnum);
+-			kappa=matpar->GetEnthalpyDiffusionParameterVolume(NUMVERTICES,enthalpypicard,pressure_p);
+-			kappa/=rho_ice;
+-			tau_parameter=StabilizationParameter(u,v,w,diameter,kappa); 
+-
+-			for(i=0;i<NUMVERTICES;i++)  pe->values[i]+=tau_parameter*scalar_def*(u*dbasis[0][i]+v*dbasis[1][i]+w*dbasis[2][i]);
+-			if(reCast<bool,IssmDouble>(dt)){
+-				for(i=0;i<NUMVERTICES;i++)  pe->values[i]+=tau_parameter*scalar_transient*(u*dbasis[0][i]+v*dbasis[1][i]+w*dbasis[2][i]);
+-			}
+-		}
+-	}
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorEnthalpyShelf {{{*/
+-ElementVector* Penta::CreatePVectorEnthalpyShelf(void){
+-
+-	/*Constants*/
+-	const int  numdof=NUMVERTICES*NDOF1;
+-
+-	/*Intermediaries */
+-	int        i,j;
+-	IssmDouble Jdet2d;
+-	IssmDouble heatcapacity,h_pmp;
+-	IssmDouble mixed_layer_capacity,thermal_exchange_velocity;
+-	IssmDouble rho_ice,rho_water,pressure,dt,scalar_ocean;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble xyz_list_tria[NUMVERTICES2D][3];
+-	IssmDouble basis[NUMVERTICES];
+-	GaussPenta* gauss=NULL;
+-
+-	/* Ice/ocean heat exchange flux on ice shelf base */
+-	if (!IsOnBed() || !IsFloating()) return NULL;
+-
+-	/*Initialize Element vector*/
+-	ElementVector* pe=new ElementVector(nodes,NUMVERTICES,this->parameters);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+-	mixed_layer_capacity=matpar->GetMixedLayerCapacity();
+-	thermal_exchange_velocity=matpar->GetThermalExchangeVelocity();
+-	rho_water=matpar->GetRhoWater();
+-	rho_ice=matpar->GetRhoIce();
+-	heatcapacity=matpar->GetHeatCapacity();
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	Input* pressure_input=inputs->GetInput(PressureEnum); _assert_(pressure_input);
+-
+-	/* Start looping on the number of gauss 2d (nodes on the bedrock) */
+-	gauss=new GaussPenta(0,1,2,2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetTriaJacobianDeterminant(&Jdet2d, &xyz_list_tria[0][0], gauss);
+-		GetNodalFunctionsP1(&basis[0], gauss);
+-
+-		pressure_input->GetInputValue(&pressure,gauss);
+-		h_pmp=matpar->PureIceEnthalpy(pressure);
+-
+-		scalar_ocean=gauss->weight*Jdet2d*rho_water*mixed_layer_capacity*thermal_exchange_velocity*(h_pmp)/(rho_ice*heatcapacity);
+-		if(reCast<bool,IssmDouble>(dt)) scalar_ocean=dt*scalar_ocean;
+-
+-		for(i=0;i<numdof;i++) pe->values[i]+=scalar_ocean*basis[i];
+-	}
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorEnthalpySheet {{{*/
+-ElementVector* Penta::CreatePVectorEnthalpySheet(void){
+-
+-	/*Constants*/
+-	const int  numdof=NUMVERTICES*NDOF1;
+-
+-	/*Intermediaries */
+-	int        i,j;
+-	int        analysis_type;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble xyz_list_tria[NUMVERTICES2D][3]={0.0};
+-	IssmDouble Jdet2d,dt;
+-	IssmDouble rho_ice,heatcapacity;
+-	IssmDouble geothermalflux_value, heatflux_value;
+-	IssmDouble basalfriction,alpha2,vx,vy,vz;
+-	IssmDouble scalar,enthalpy,enthalpyup;
+-	IssmDouble pressure,pressureup;
+-	IssmDouble watercolumn;
+-	IssmDouble basis[NUMVERTICES];
+-	Friction*  friction=NULL;
+-	GaussPenta* gauss=NULL;
+-	GaussPenta* gaussup=NULL;
+-
+-	/* Geothermal flux on ice sheet base and basal friction */
+-	if (!IsOnBed() || IsFloating()) return NULL;
+-
+-	/*Initialize Element vector*/
+-	ElementVector* pe=new ElementVector(nodes,NUMVERTICES,this->parameters);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+-	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-	rho_ice=matpar->GetRhoIce();
+-	heatcapacity=matpar->GetHeatCapacity();
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum);                         _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);                         _assert_(vy_input);
+-	Input* vz_input=inputs->GetInput(VzEnum);                         _assert_(vz_input);
+-	Input* enthalpy_input=inputs->GetInput(EnthalpyPicardEnum);       _assert_(enthalpy_input);
+-	Input* pressure_input=inputs->GetInput(PressureEnum);             _assert_(pressure_input);
+-	Input* geothermalflux_input=inputs->GetInput(BasalforcingsGeothermalfluxEnum); _assert_(geothermalflux_input);
+-	Input* watercolumn_input=inputs->GetInput(WatercolumnEnum);       _assert_(watercolumn_input);
+-
+-	/*Build friction element, needed later: */
+-	friction=new Friction(this,3);
+-
+-	/* Start looping on the number of gauss 2d (nodes on the bedrock) */
+-	gauss=new GaussPenta(0,1,2,2);
+-	gaussup=new GaussPenta(3,4,5,2);
+-
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-		gaussup->GaussPoint(ig);
+-
+-		GetTriaJacobianDeterminant(&Jdet2d, &xyz_list_tria[0][0], gauss);
+-		GetNodalFunctionsP1(&basis[0], gauss);
+-
+-		enthalpy_input->GetInputValue(&enthalpy,gauss);
+-		pressure_input->GetInputValue(&pressure,gauss);
+-		watercolumn_input->GetInputValue(&watercolumn,gauss);
+-
+-		if((watercolumn<=0.) && (enthalpy<matpar->PureIceEnthalpy(pressure))){
+-			/* the above check is equivalent to 
+-			 NOT ((watercolumn>0.) AND (enthalpy<PIE)) AND (enthalpy<PIE)*/
+-			geothermalflux_input->GetInputValue(&geothermalflux_value,gauss);
+-
+-			friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input);
+-			vx_input->GetInputValue(&vx,gauss);
+-			vy_input->GetInputValue(&vy,gauss);
+-			vz_input->GetInputValue(&vz,gauss);
+-			basalfriction=alpha2*(pow(vx,2.0)+pow(vy,2.0)+pow(vz,2.0));
+-
+-			heatflux_value=(basalfriction+geothermalflux_value)/(rho_ice);
+-			scalar=gauss->weight*Jdet2d*heatflux_value;
+-			if(reCast<bool,IssmDouble>(dt)) scalar=dt*scalar;
+-			for(i=0;i<numdof;i++) pe->values[i]+=scalar*basis[i];
+-		}
+-		else if(enthalpy>=matpar->PureIceEnthalpy(pressure)){
+-			/* check positive thickness of temperate basal ice layer */
+-			enthalpy_input->GetInputValue(&enthalpyup,gaussup);
+-			pressure_input->GetInputValue(&pressureup,gaussup);
+-			if(enthalpyup>=matpar->PureIceEnthalpy(pressureup)){
+-				// TODO: temperate ice has positive thickness: grad enthalpy*n=0.
+-			}
+-			else{
+-				// only base temperate, set Dirichlet BCs in Penta::UpdateBasalConstraintsEnthalpy()
+-			}
+-		}
+-		else {
+-			// base cold, but watercolumn positive. Set base to h_pmp.
+-		}
+-	}
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	delete gaussup;
+-	delete friction;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorMelting {{{*/
+-ElementVector* Penta::CreatePVectorMelting(void){
+-	return NULL;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorThermal {{{*/
+-ElementVector* Penta::CreatePVectorThermal(void){
+-
+-	/*compute all load vectors for this element*/
+-	ElementVector* pe1=CreatePVectorThermalVolume();
+-	ElementVector* pe2=CreatePVectorThermalSheet();
+-	ElementVector* pe3=CreatePVectorThermalShelf();
+-	ElementVector* pe =new ElementVector(pe1,pe2,pe3);
+-
+-	/*clean-up and return*/
+-	delete pe1;
+-	delete pe2;
+-	delete pe3;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorThermalVolume {{{*/
+-ElementVector* Penta::CreatePVectorThermalVolume(void){
+-
+-	/*Constants*/
+-	const int  numdof=NUMVERTICES*NDOF1;
+-
+-	/*Intermediaries*/
+-	int        i;
+-	int        stabilization;
+-	IssmDouble Jdet,phi,dt;
+-	IssmDouble rho_ice,heatcapacity;
+-	IssmDouble thermalconductivity,kappa;
+-	IssmDouble viscosity,temperature;
+-	IssmDouble tau_parameter,diameter;
+-	IssmDouble u,v,w;
+-	IssmDouble scalar_def,scalar_transient;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble L[numdof];
+-	IssmDouble dbasis[3][6];
+-	IssmDouble epsilon[6];
+-	GaussPenta *gauss=NULL;
+-
+-	/*Initialize Element vector*/
+-	ElementVector* pe=new ElementVector(nodes,NUMVERTICES,this->parameters);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	rho_ice=matpar->GetRhoIce();
+-	heatcapacity=matpar->GetHeatCapacity();
+-	thermalconductivity=matpar->GetThermalConductivity();
+-	kappa=thermalconductivity/(rho_ice*heatcapacity);
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	this->parameters->FindParam(&stabilization,ThermalStabilizationEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+-	Input* vz_input=inputs->GetInput(VzEnum); _assert_(vz_input);
+-	Input* temperature_input=NULL;
+-	if(reCast<bool,IssmDouble>(dt)) temperature_input=inputs->GetInput(TemperatureEnum); _assert_(inputs);
+-	if(stabilization==2) diameter=MinEdgeLength(&xyz_list[0][0]);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(3,3);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctionsP1(&L[0], gauss);
+-
+-		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+-		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+-		GetPhi(&phi, &epsilon[0], viscosity);
+-
+-		scalar_def=phi/(rho_ice*heatcapacity)*Jdet*gauss->weight;
+-		if(reCast<bool,IssmDouble>(dt)) scalar_def=scalar_def*dt;
+-
+-		for(i=0;i<NUMVERTICES;i++)  pe->values[i]+=scalar_def*L[i];
+-
+-		/* Build transient now */
+-		if(reCast<bool,IssmDouble>(dt)){
+-			temperature_input->GetInputValue(&temperature, gauss);
+-			scalar_transient=temperature*Jdet*gauss->weight;
+-			for(i=0;i<NUMVERTICES;i++)  pe->values[i]+=scalar_transient*L[i];
+-		}
+-
+-		if(stabilization==2){
+-			GetNodalFunctionsP1Derivatives(&dbasis[0][0],&xyz_list[0][0], gauss);
+-
+-			vx_input->GetInputValue(&u, gauss);
+-			vy_input->GetInputValue(&v, gauss);
+-			vz_input->GetInputValue(&w, gauss);
+-
+-			tau_parameter=StabilizationParameter(u,v,w,diameter,kappa);
+-
+-			for(i=0;i<NUMVERTICES;i++)  pe->values[i]+=tau_parameter*scalar_def*(u*dbasis[0][i]+v*dbasis[1][i]+w*dbasis[2][i]);
+-			if(reCast<bool,IssmDouble>(dt)){
+-				for(i=0;i<NUMVERTICES;i++)  pe->values[i]+=tau_parameter*scalar_transient*(u*dbasis[0][i]+v*dbasis[1][i]+w*dbasis[2][i]);
+-			}
+-		}
+-	}
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorThermalShelf {{{*/
+-ElementVector* Penta::CreatePVectorThermalShelf(void){
+-
+-	/*Constants*/
+-	const int  numdof=NUMVERTICES*NDOF1;
+-
+-	/*Intermediaries */
+-	int        i,j;
+-	IssmDouble Jdet2d;
+-	IssmDouble mixed_layer_capacity,thermal_exchange_velocity;
+-	IssmDouble rho_ice,rho_water,pressure,dt,scalar_ocean;
+-	IssmDouble heatcapacity,t_pmp;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble xyz_list_tria[NUMVERTICES2D][3];
+-	IssmDouble basis[NUMVERTICES];
+-	GaussPenta* gauss=NULL;
+-
+-	/* Ice/ocean heat exchange flux on ice shelf base */
+-	if (!IsOnBed() || !IsFloating()) return NULL;
+-
+-	/*Initialize Element vector*/
+-	ElementVector* pe=new ElementVector(nodes,NUMVERTICES,this->parameters);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+-	mixed_layer_capacity=matpar->GetMixedLayerCapacity();
+-	thermal_exchange_velocity=matpar->GetThermalExchangeVelocity();
+-	rho_water=matpar->GetRhoWater();
+-	rho_ice=matpar->GetRhoIce();
+-	heatcapacity=matpar->GetHeatCapacity();
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	Input* pressure_input=inputs->GetInput(PressureEnum); _assert_(pressure_input);
+-
+-	/* Start looping on the number of gauss 2d (nodes on the bedrock) */
+-	gauss=new GaussPenta(0,1,2,2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetTriaJacobianDeterminant(&Jdet2d, &xyz_list_tria[0][0], gauss);
+-		GetNodalFunctionsP1(&basis[0], gauss);
+-
+-		pressure_input->GetInputValue(&pressure,gauss);
+-		t_pmp=matpar->TMeltingPoint(pressure);
+-
+-		scalar_ocean=gauss->weight*Jdet2d*rho_water*mixed_layer_capacity*thermal_exchange_velocity*(t_pmp)/(heatcapacity*rho_ice);
+-		if(reCast<bool,IssmDouble>(dt)) scalar_ocean=dt*scalar_ocean;
+-
+-		for(i=0;i<numdof;i++) pe->values[i]+=scalar_ocean*basis[i];
+-	}
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorThermalSheet {{{*/
+-ElementVector* Penta::CreatePVectorThermalSheet(void){
+-
+-	/*Constants*/
+-	const int  numdof=NUMVERTICES*NDOF1;
+-
+-	/*Intermediaries */
+-	int         i,j;
+-	int         analysis_type;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble  xyz_list_tria[NUMVERTICES2D][3]={0.0};
+-	IssmDouble  Jdet2d,dt;
+-	IssmDouble  rho_ice,heatcapacity,geothermalflux_value;
+-	IssmDouble  basalfriction,alpha2,vx,vy;
+-	IssmDouble  basis[NUMVERTICES];
+-	IssmDouble  scalar;
+-	Friction*   friction=NULL;
+-	GaussPenta* gauss=NULL;
+-
+-	/* Geothermal flux on ice sheet base and basal friction */
+-	if (!IsOnBed() || IsFloating()) return NULL;
+-
+-	/*Initialize Element vector*/
+-	ElementVector* pe=new ElementVector(nodes,NUMVERTICES,this->parameters);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+-	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-	rho_ice=matpar->GetRhoIce();
+-	heatcapacity=matpar->GetHeatCapacity();
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum);                         _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);                         _assert_(vy_input);
+-	Input* vz_input=inputs->GetInput(VzEnum);                         _assert_(vz_input);
+-	Input* geothermalflux_input=inputs->GetInput(BasalforcingsGeothermalfluxEnum); _assert_(geothermalflux_input);
+-
+-	/*Build frictoin element, needed later: */
+-	friction=new Friction(this,3);
+-
+-	/* Start looping on the number of gauss 2d (nodes on the bedrock) */
+-	gauss=new GaussPenta(0,1,2,2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetTriaJacobianDeterminant(&Jdet2d, &xyz_list_tria[0][0], gauss);
+-		GetNodalFunctionsP1(&basis[0], gauss);
+-
+-			geothermalflux_input->GetInputValue(&geothermalflux_value,gauss);
+-			friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input);
+-			vx_input->GetInputValue(&vx,gauss);
+-			vy_input->GetInputValue(&vy,gauss);
+-			basalfriction=alpha2*(pow(vx,2.0)+pow(vy,2.0));
+-
+-			scalar=gauss->weight*Jdet2d*(basalfriction+geothermalflux_value)/(heatcapacity*rho_ice);
+-			if(reCast<bool,IssmDouble>(dt)) scalar=dt*scalar;
+-
+-			for(i=0;i<numdof;i++) pe->values[i]+=scalar*basis[i];
+-	}
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	delete friction;
+-	return pe;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::UpdateBasalConstraintsEnthalpy{{{*/
+ void  Penta::UpdateBasalConstraintsEnthalpy(void){
+ 
+@@ -5119,429 +4476,6 @@
+ 	return Ke;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::CreatePVectorAdjointHoriz{{{*/
+-ElementVector* Penta::CreatePVectorAdjointHoriz(void){
+-
+-	int approximation;
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-
+-	switch(approximation){
+-		case SSAApproximationEnum:
+-			return CreatePVectorAdjointSSA();
+-		case HOApproximationEnum:
+-			return CreatePVectorAdjointHO();
+-		case NoneApproximationEnum:
+-			return NULL;
+-		case FSApproximationEnum:
+-			return CreatePVectorAdjointFS();
+-		default:
+-			_error_("Approximation " << EnumToStringx(approximation) << " not supported yet");
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorAdjointSSA{{{*/
+-ElementVector* Penta::CreatePVectorAdjointSSA(){
+-
+-	if (!IsOnBed()) return NULL;
+-
+-	/*Call Tria function*/
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	ElementVector* pe=tria->CreatePVectorAdjointHoriz();
+-	delete tria->material; delete tria;
+-
+-	/*clean up and return*/
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorAdjointHO{{{*/
+-ElementVector* Penta::CreatePVectorAdjointHO(void){
+-
+-	/*Nothing to be done if not on surface*/
+-	if (!IsOnSurface()) return NULL;
+-
+-	/*Intermediaries */
+-	int        i,j,resp;
+-	int       *responses=NULL;
+-	int        num_responses;
+-	IssmDouble Jdet2d;
+-	IssmDouble obs_velocity_mag,velocity_mag;
+-	IssmDouble dux,duy;
+-	IssmDouble epsvel=2.220446049250313e-16;
+-	IssmDouble meanvel=3.170979198376458e-05; /*1000 m/yr*/
+-	IssmDouble scalex=0.,scaley=0.,scale=0.,S=0.;
+-	IssmDouble vx,vy,vxobs,vyobs,weight;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble xyz_list_tria[NUMVERTICES2D][3];
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element vector*/
+-	ElementVector* pe    = new ElementVector(nodes,numnodes,this->parameters);
+-	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&num_responses,InversionNumCostFunctionsEnum);
+-	this->parameters->FindParam(&responses,NULL,InversionCostFunctionsEnum);
+-	Input* weights_input=inputs->GetInput(InversionCostFunctionsCoefficientsEnum);   _assert_(weights_input);
+-	Input* vx_input     =inputs->GetInput(VxEnum);        _assert_(vx_input);
+-	Input* vy_input     =inputs->GetInput(VyEnum);        _assert_(vy_input);
+-	Input* vxobs_input  =inputs->GetInput(InversionVxObsEnum);     _assert_(vxobs_input);
+-	Input* vyobs_input  =inputs->GetInput(InversionVyObsEnum);     _assert_(vyobs_input);
+-
+-	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+-
+-	/*Get Surface if required by one response*/
+-	for(resp=0;resp<num_responses;resp++){
+-		if(responses[resp]==SurfaceAverageVelMisfitEnum){
+-			inputs->GetInputValue(&S,SurfaceAreaEnum); break;
+-		}
+-	}
+-
+-	/* Start  looping on the number of gaussian points: */
+-	GaussPenta* gauss=new GaussPenta(3,4,5,4);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		/* Get Jacobian determinant: */
+-		GetTriaJacobianDeterminant(&Jdet2d,&xyz_list_tria[0][0],gauss);
+-
+-		/*Get all parameters at gaussian point*/
+-		vx_input->GetInputValue(&vx,gauss);
+-		vy_input->GetInputValue(&vy,gauss);
+-		vxobs_input->GetInputValue(&vxobs,gauss);
+-		vyobs_input->GetInputValue(&vyobs,gauss);
+-		GetNodalFunctions(basis, gauss);
+-
+-		/*Loop over all requested responses*/
+-		for(resp=0;resp<num_responses;resp++){
+-
+-			weights_input->GetInputValue(&weight,gauss,responses[resp]);
+-
+-			switch(responses[resp]){
+-				case SurfaceAbsVelMisfitEnum:
+-					/*
+-					 *      1  [           2              2 ]
+-					 * J = --- | (u - u   )  +  (v - v   )  |
+-					 *      2  [       obs            obs   ]
+-					 *
+-					 *        dJ
+-					 * DU = - -- = (u   - u )
+-					 *        du     obs
+-					 */
+-					for(i=0;i<numnodes;i++){
+-						dux=vxobs-vx;
+-						duy=vyobs-vy;
+-						pe->values[i*NDOF2+0]+=dux*weight*Jdet2d*gauss->weight*basis[i]; 
+-						pe->values[i*NDOF2+1]+=duy*weight*Jdet2d*gauss->weight*basis[i]; 
+-					}
+-					break;
+-				case SurfaceRelVelMisfitEnum:
+-					/*
+-					 *      1  [     \bar{v}^2             2   \bar{v}^2              2 ]
+-					 * J = --- | -------------  (u - u   ) + -------------  (v - v   )  |
+-					 *      2  [  (u   + eps)^2       obs    (v   + eps)^2       obs    ]
+-					 *              obs                        obs                      
+-					 *
+-					 *        dJ     \bar{v}^2
+-					 * DU = - -- = ------------- (u   - u )
+-					 *        du   (u   + eps)^2    obs
+-					 *               obs
+-					 */
+-					for(i=0;i<numnodes;i++){
+-						scalex=pow(meanvel/(vxobs+epsvel),2); if(vxobs==0)scalex=0;
+-						scaley=pow(meanvel/(vyobs+epsvel),2); if(vyobs==0)scaley=0;
+-						dux=scalex*(vxobs-vx);
+-						duy=scaley*(vyobs-vy);
+-						pe->values[i*NDOF2+0]+=dux*weight*Jdet2d*gauss->weight*basis[i]; 
+-						pe->values[i*NDOF2+1]+=duy*weight*Jdet2d*gauss->weight*basis[i]; 
+-					}
+-					break;
+-				case SurfaceLogVelMisfitEnum:
+-					/*
+-					 *                 [        vel + eps     ] 2
+-					 * J = 4 \bar{v}^2 | log ( -----------  ) |  
+-					 *                 [       vel   + eps    ]
+-					 *                            obs
+-					 *
+-					 *        dJ                 2 * log(...)
+-					 * DU = - -- = - 4 \bar{v}^2 -------------  u
+-					 *        du                 vel^2 + eps
+-					 *            
+-					 */
+-					for(i=0;i<numnodes;i++){
+-						velocity_mag    =sqrt(pow(vx,   2)+pow(vy,   2))+epsvel;
+-						obs_velocity_mag=sqrt(pow(vxobs,2)+pow(vyobs,2))+epsvel;
+-						scale=-8*pow(meanvel,2)/pow(velocity_mag,2)*log(velocity_mag/obs_velocity_mag);
+-						dux=scale*vx;
+-						duy=scale*vy;
+-						pe->values[i*NDOF2+0]+=dux*weight*Jdet2d*gauss->weight*basis[i]; 
+-						pe->values[i*NDOF2+1]+=duy*weight*Jdet2d*gauss->weight*basis[i]; 
+-					}
+-					break;
+-				case SurfaceAverageVelMisfitEnum:
+-					/*
+-					 *      1                    2              2
+-					 * J = ---  sqrt(  (u - u   )  +  (v - v   )  )
+-					 *      S                obs            obs
+-					 *
+-					 *        dJ      1       1 
+-					 * DU = - -- = - --- ----------- * 2 (u - u   )
+-					 *        du      S  2 sqrt(...)           obs
+-					 */
+-					for(i=0;i<numnodes;i++){
+-						scale=1./(S*2*sqrt(pow(vx-vxobs,2)+pow(vy-vyobs,2))+epsvel);
+-						dux=scale*(vxobs-vx);
+-						duy=scale*(vyobs-vy);
+-						pe->values[i*NDOF2+0]+=dux*weight*Jdet2d*gauss->weight*basis[i]; 
+-						pe->values[i*NDOF2+1]+=duy*weight*Jdet2d*gauss->weight*basis[i]; 
+-					}
+-					break;
+-				case SurfaceLogVxVyMisfitEnum:
+-					/*
+-					 *      1            [        |u| + eps     2          |v| + eps     2  ]
+-					 * J = --- \bar{v}^2 | log ( -----------  )   +  log ( -----------  )   |  
+-					 *      2            [       |u    |+ eps              |v    |+ eps     ]
+-					 *                              obs                       obs
+-					 *        dJ                              1      u                             1
+-					 * DU = - -- = - \bar{v}^2 log(u...) --------- ----  ~ - \bar{v}^2 log(u...) ------
+-					 *        du                         |u| + eps  |u|                           u + eps
+-					 */
+-					for(i=0;i<numnodes;i++){
+-						dux = - meanvel*meanvel * log((fabs(vx)+epsvel)/(fabs(vxobs)+epsvel)) / (vx+epsvel);
+-						duy = - meanvel*meanvel * log((fabs(vy)+epsvel)/(fabs(vyobs)+epsvel)) / (vy+epsvel);
+-						pe->values[i*NDOF2+0]+=dux*weight*Jdet2d*gauss->weight*basis[i]; 
+-						pe->values[i*NDOF2+1]+=duy*weight*Jdet2d*gauss->weight*basis[i]; 
+-					}
+-					break;
+-				case DragCoefficientAbsGradientEnum:
+-					/*Nothing in P vector*/
+-					break;
+-				case ThicknessAbsGradientEnum:
+-					/*Nothing in P vector*/
+-					break;
+-				case ThicknessAlongGradientEnum:
+-					/*Nothing in P vector*/
+-					break;
+-				case ThicknessAcrossGradientEnum:
+-					/*Nothing in P vector*/
+-					break;
+-				case RheologyBbarAbsGradientEnum:
+-					/*Nothing in P vector*/
+-					break;
+-				default:
+-					_error_("response " << EnumToStringx(responses[resp]) << " not supported yet");
+-			}
+-		}
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	xDelete<int>(responses);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorAdjointFS{{{*/
+-ElementVector* Penta::CreatePVectorAdjointFS(void){
+-
+-	if(!IsOnSurface()) return NULL;
+-
+-	/*Intermediaries */
+-	int         i,j,resp;
+-	int        *responses= NULL;
+-	int         num_responses;
+-	IssmDouble  Jdet2d;
+-	IssmDouble  obs_velocity_mag,velocity_mag;
+-	IssmDouble  dux,duy;
+-	IssmDouble  epsvel  = 2.220446049250313e-16;
+-	IssmDouble  meanvel = 3.170979198376458e-05;  /*1000 m/yr */
+-	IssmDouble  scalex  = 0,scaley=0,scale=0,S=0;
+-	IssmDouble  vx,vy,vxobs,vyobs,weight;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble	xyz_list_tria[NUMVERTICES2D][3];
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumnodes = this->NumberofNodesPressure();
+-
+-	/*Prepare coordinate system list*/
+-	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+-	for(i=0;i<vnumnodes;i++) cs_list[i]           = XYZEnum;
+-	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementVector* pe     = new ElementVector(nodes,vnumnodes+pnumnodes,this->parameters,FSApproximationEnum);
+-	IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&num_responses,InversionNumCostFunctionsEnum);
+-	this->parameters->FindParam(&responses,NULL,InversionCostFunctionsEnum);
+-	Input* weights_input = inputs->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
+-	Input* vx_input      = inputs->GetInput(VxEnum);                                 _assert_(vx_input);
+-	Input* vy_input      = inputs->GetInput(VyEnum);                                 _assert_(vy_input);
+-	Input* vxobs_input   = inputs->GetInput(InversionVxObsEnum);                     _assert_(vxobs_input);
+-	Input* vyobs_input   = inputs->GetInput(InversionVyObsEnum);                     _assert_(vyobs_input);
+-
+-	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+-
+-	/*Get Surface if required by one response*/
+-	for(resp=0;resp<num_responses;resp++){
+-		if(responses[resp]==SurfaceAverageVelMisfitEnum){
+-			inputs->GetInputValue(&S,SurfaceAreaEnum); break;
+-		}
+-	}
+-
+-	/* Start  looping on the number of gaussian points: */
+-	GaussPenta* gauss=new GaussPenta(3,4,5,4);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		/* Get Jacobian determinant: */
+-		GetTriaJacobianDeterminant(&Jdet2d,&xyz_list_tria[0][0],gauss);
+-
+-		/*Get all parameters at gaussian point*/
+-		vx_input->GetInputValue(&vx,gauss);
+-		vy_input->GetInputValue(&vy,gauss);
+-		vxobs_input->GetInputValue(&vxobs,gauss);
+-		vyobs_input->GetInputValue(&vyobs,gauss);
+-		GetNodalFunctionsVelocity(vbasis,gauss);
+-
+-		/*Loop over all requested responses*/
+-		for(resp=0;resp<num_responses;resp++){
+-
+-			weights_input->GetInputValue(&weight,gauss,responses[resp]);
+-
+-			switch(responses[resp]){
+-
+-				case SurfaceAbsVelMisfitEnum:
+-					/*
+-					 *      1  [           2              2 ]
+-					 * J = --- | (u - u   )  +  (v - v   )  |
+-					 *      2  [       obs            obs   ]
+-					 *
+-					 *        dJ
+-					 * DU = - -- = (u   - u )
+-					 *        du     obs
+-					 */
+-					for(i=0;i<vnumnodes;i++){
+-						dux=vxobs-vx;
+-						duy=vyobs-vy;
+-						pe->values[i*NDOF3+0]+=dux*weight*Jdet2d*gauss->weight*vbasis[i]; 
+-						pe->values[i*NDOF3+1]+=duy*weight*Jdet2d*gauss->weight*vbasis[i]; 
+-					}
+-					break;
+-				case SurfaceRelVelMisfitEnum:
+-					/*
+-					 *      1  [     \bar{v}^2             2   \bar{v}^2              2 ]
+-					 * J = --- | -------------  (u - u   ) + -------------  (v - v   )  |
+-					 *      2  [  (u   + eps)^2       obs    (v   + eps)^2       obs    ]
+-					 *              obs                        obs                      
+-					 *
+-					 *        dJ     \bar{v}^2
+-					 * DU = - -- = ------------- (u   - u )
+-					 *        du   (u   + eps)^2    obs
+-					 *               obs
+-					 */
+-					for(i=0;i<vnumnodes;i++){
+-						scalex=pow(meanvel/(vxobs+epsvel),2); if(vxobs==0)scalex=0;
+-						scaley=pow(meanvel/(vyobs+epsvel),2); if(vyobs==0)scaley=0;
+-						dux=scalex*(vxobs-vx);
+-						duy=scaley*(vyobs-vy);
+-						pe->values[i*NDOF3+0]+=dux*weight*Jdet2d*gauss->weight*vbasis[i]; 
+-						pe->values[i*NDOF3+1]+=duy*weight*Jdet2d*gauss->weight*vbasis[i]; 
+-					}
+-					break;
+-				case SurfaceLogVelMisfitEnum:
+-					/*
+-					 *                 [        vel + eps     ] 2
+-					 * J = 4 \bar{v}^2 | log ( -----------  ) |  
+-					 *                 [       vel   + eps    ]
+-					 *                            obs
+-					 *
+-					 *        dJ                 2 * log(...)
+-					 * DU = - -- = - 4 \bar{v}^2 -------------  u
+-					 *        du                 vel^2 + eps
+-					 *            
+-					 */
+-					for(i=0;i<vnumnodes;i++){
+-						velocity_mag    =sqrt(pow(vx,   2)+pow(vy,   2))+epsvel;
+-						obs_velocity_mag=sqrt(pow(vxobs,2)+pow(vyobs,2))+epsvel;
+-						scale=-8*pow(meanvel,2)/pow(velocity_mag,2)*log(velocity_mag/obs_velocity_mag);
+-						dux=scale*vx;
+-						duy=scale*vy;
+-						pe->values[i*NDOF3+0]+=dux*weight*Jdet2d*gauss->weight*vbasis[i]; 
+-						pe->values[i*NDOF3+1]+=duy*weight*Jdet2d*gauss->weight*vbasis[i]; 
+-					}
+-					break;
+-				case SurfaceAverageVelMisfitEnum:
+-					/*
+-					 *      1                    2              2
+-					 * J = ---  sqrt(  (u - u   )  +  (v - v   )  )
+-					 *      S                obs            obs
+-					 *
+-					 *        dJ      1       1 
+-					 * DU = - -- = - --- ----------- * 2 (u - u   )
+-					 *        du      S  2 sqrt(...)           obs
+-					 */
+-					for(i=0;i<vnumnodes;i++){
+-						scale=1./(S*2*sqrt(pow(vx-vxobs,2)+pow(vy-vyobs,2))+epsvel);
+-						dux=scale*(vxobs-vx);
+-						duy=scale*(vyobs-vy);
+-						pe->values[i*NDOF3+0]+=dux*weight*Jdet2d*gauss->weight*vbasis[i]; 
+-						pe->values[i*NDOF3+1]+=duy*weight*Jdet2d*gauss->weight*vbasis[i]; 
+-					}
+-					break;
+-				case SurfaceLogVxVyMisfitEnum:
+-					/*
+-					 *      1            [        |u| + eps     2          |v| + eps     2  ]
+-					 * J = --- \bar{v}^2 | log ( -----------  )   +  log ( -----------  )   |  
+-					 *      2            [       |u    |+ eps              |v    |+ eps     ]
+-					 *                              obs                       obs
+-					 *        dJ                              1      u                             1
+-					 * DU = - -- = - \bar{v}^2 log(u...) --------- ----  ~ - \bar{v}^2 log(u...) ------
+-					 *        du                         |u| + eps  |u|                           u + eps
+-					 */
+-					for(i=0;i<vnumnodes;i++){
+-						dux = - meanvel*meanvel * log((fabs(vx)+epsvel)/(fabs(vxobs)+epsvel)) / (vx+epsvel);
+-						duy = - meanvel*meanvel * log((fabs(vy)+epsvel)/(fabs(vyobs)+epsvel)) / (vy+epsvel);
+-						pe->values[i*NDOF3+0]+=dux*weight*Jdet2d*gauss->weight*vbasis[i]; 
+-						pe->values[i*NDOF3+1]+=duy*weight*Jdet2d*gauss->weight*vbasis[i]; 
+-					}
+-					break;
+-				case DragCoefficientAbsGradientEnum:
+-					/*Nothing in P vector*/
+-					break;
+-				case ThicknessAbsGradientEnum:
+-					/*Nothing in P vector*/
+-					break;
+-				case ThicknessAcrossGradientEnum:
+-					/*Nothing in P vector*/
+-					break;
+-				case ThicknessAlongGradientEnum:
+-					/*Nothing in P vector*/
+-					break;
+-				case RheologyBbarAbsGradientEnum:
+-					/*Nothing in P vector*/
+-					break;
+-				default:
+-					_error_("response " << EnumToStringx(responses[resp]) << " not supported yet");
+-			}
+-		}
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<int>(responses);
+-	xDelete<int>(cs_list);
+-	xDelete<IssmDouble>(vbasis);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::GradientIndexing{{{*/
+ void Penta::GradientIndexing(int* indexing,int control_index){
+ 
+@@ -7866,1152 +6800,6 @@
+ 	return Ke;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::CreatePVectorCouplingSSAFS {{{*/
+-ElementVector* Penta::CreatePVectorCouplingSSAFS(void){
+-
+-	/*compute all load vectors for this element*/
+-	ElementVector* pe1=CreatePVectorCouplingSSAFSViscous();
+-	ElementVector* pe2=CreatePVectorCouplingSSAFSFriction();
+-	ElementVector* pe =new ElementVector(pe1,pe2);
+-
+-	/*clean-up and return*/
+-	delete pe1;
+-	delete pe2;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorCouplingSSAFSViscous {{{*/
+-ElementVector* Penta::CreatePVectorCouplingSSAFSViscous(void){
+-
+-	/*Intermediaries */
+-	int         i,approximation;
+-	IssmDouble  viscosity,Jdet;
+-	IssmDouble  FSreconditioning;
+-	IssmDouble  epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
+-	IssmDouble  dw[3];
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble  basis[6]; //for the six nodes of the penta
+-	IssmDouble  dbasis[3][6]; //for the six nodes of the penta
+-	GaussPenta *gauss=NULL;
+-
+-	/*Initialize Element vector and return if necessary*/
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-	if(approximation!=SSAFSApproximationEnum) return NULL;
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumnodes = this->NumberofNodesPressure();
+-
+-	/*Prepare coordinate system list*/
+-	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+-	for(i=0;i<vnumnodes;i++) cs_list[i]           = XYZEnum;
+-	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
+-	ElementVector* pe=new ElementVector(nodes,vnumnodes+pnumnodes,this->parameters,FSvelocityEnum);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum);               _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);               _assert_(vy_input);
+-	Input* vz_input=inputs->GetInput(VzEnum);               _assert_(vz_input);
+-	Input* vzSSA_input=inputs->GetInput(VzSSAEnum);   _assert_(vzSSA_input);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(5,5);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctionsP1(&basis[0], gauss);
+-		GetNodalFunctionsP1Derivatives(&dbasis[0][0],&xyz_list[0][0], gauss);
+-
+-		vzSSA_input->GetInputDerivativeValue(&dw[0],&xyz_list[0][0],gauss);
+-
+-		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+-		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+-
+-		for(i=0;i<NUMVERTICES;i++){
+-			pe->values[i*NDOF3+0]+=-Jdet*gauss->weight*viscosity*dw[0]*dbasis[2][i];
+-			pe->values[i*NDOF3+1]+=-Jdet*gauss->weight*viscosity*dw[1]*dbasis[2][i];
+-			pe->values[i*NDOF3+2]+=-Jdet*gauss->weight*viscosity*(dw[0]*dbasis[0][i]+dw[1]*dbasis[1][i]+2*dw[2]*dbasis[2][i]);
+-			pe->values[NDOF3*vnumnodes+i]+=Jdet*gauss->weight*FSreconditioning*dw[2]*basis[i];
+-		}
+-	}
+-
+-	/*Transform coordinate system*/
+-	::TransformLoadVectorCoord(pe,nodes,vnumnodes+pnumnodes,cs_list);
+-
+-	/*Clean up and return*/
+-	xDelete<int>(cs_list);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorCouplingSSAFSFriction{{{*/
+-ElementVector* Penta::CreatePVectorCouplingSSAFSFriction(void){
+-
+-	/*Intermediaries*/
+-	int         i,j;
+-	int         approximation,analysis_type;
+-	IssmDouble  Jdet,Jdet2d;
+-	IssmDouble  FSreconditioning;
+-	IssmDouble	bed_normal[3];
+-	IssmDouble  epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
+-	IssmDouble  viscosity, w, alpha2_gauss;
+-	IssmDouble  dw[3];
+-	IssmDouble	xyz_list_tria[NUMVERTICES2D][3];
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble  basis[6]; //for the six nodes of the penta
+-	Friction*   friction=NULL;
+-	GaussPenta  *gauss=NULL;
+-
+-	/*Initialize Element vector and return if necessary*/
+-	if(!IsOnBed() || IsFloating()) return NULL;
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-	if(approximation!=SSAFSApproximationEnum) return NULL;
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumnodes = this->NumberofNodesPressure();
+-
+-	/*Prepare coordinate system list*/
+-	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+-	for(i=0;i<vnumnodes;i++) cs_list[i]           = XYZEnum;
+-	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
+-	ElementVector* pe=new ElementVector(nodes,vnumnodes+pnumnodes,this->parameters,FSvelocityEnum);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-	this->parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum);        _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);        _assert_(vy_input);
+-	Input* vz_input=inputs->GetInput(VzEnum);        _assert_(vz_input);
+-	Input* vzSSA_input=inputs->GetInput(VzSSAEnum);  _assert_(vzSSA_input);
+-
+-	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+-
+-	/*build friction object, used later on: */
+-	friction=new Friction(this,3);
+-
+-	/* Start looping on the number of gauss 2d (nodes on the bedrock) */
+-	gauss=new GaussPenta(0,1,2,2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetTriaJacobianDeterminant(&Jdet2d, &xyz_list_tria[0][0], gauss);
+-		GetNodalFunctionsP1(basis, gauss);
+-
+-		vzSSA_input->GetInputValue(&w, gauss);
+-		vzSSA_input->GetInputDerivativeValue(&dw[0],&xyz_list[0][0],gauss);
+-
+-		NormalBase(&bed_normal[0],&xyz_list_tria[0][0]);
+-		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+-		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+-		friction->GetAlpha2(&alpha2_gauss, gauss,vx_input,vy_input,vz_input);
+-
+-		for(i=0;i<NUMVERTICES2D;i++){
+-			pe->values[i*NDOF3+0]+=Jdet2d*gauss->weight*(alpha2_gauss*w*bed_normal[0]*bed_normal[2]+2*viscosity*dw[2]*bed_normal[0])*basis[i];
+-			pe->values[i*NDOF3+1]+=Jdet2d*gauss->weight*(alpha2_gauss*w*bed_normal[1]*bed_normal[2]+2*viscosity*dw[2]*bed_normal[1])*basis[i];
+-			pe->values[i*NDOF3+2]+=Jdet2d*gauss->weight*2*viscosity*(dw[0]*bed_normal[0]+dw[1]*bed_normal[1]+dw[2]*bed_normal[2])*basis[i];
+-		}
+-	}
+-
+-	/*Transform coordinate system*/
+-	::TransformLoadVectorCoord(pe,nodes,(vnumnodes+pnumnodes),cs_list);
+-
+-	/*Clean up and return*/
+-	xDelete<int>(cs_list);
+-	delete gauss;
+-	delete friction;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorCouplingHOFS {{{*/
+-ElementVector* Penta::CreatePVectorCouplingHOFS(void){
+-
+-	/*compute all load vectors for this element*/
+-	ElementVector* pe1=CreatePVectorCouplingHOFSViscous();
+-	ElementVector* pe2=CreatePVectorCouplingHOFSFriction();
+-	ElementVector* pe =new ElementVector(pe1,pe2);
+-
+-	/*clean-up and return*/
+-	delete pe1;
+-	delete pe2;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorCouplingHOFSViscous {{{*/
+-ElementVector* Penta::CreatePVectorCouplingHOFSViscous(void){
+-
+-	/*Intermediaries */
+-	int         i;
+-	int         approximation;
+-	IssmDouble  viscosity,Jdet;
+-	IssmDouble  FSreconditioning;
+-	IssmDouble  epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
+-	IssmDouble  dw[3];
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble  basis[6]; //for the six nodes of the penta
+-	IssmDouble  dbasis[3][6]; //for the six nodes of the penta
+-	GaussPenta *gauss=NULL;
+-
+-	/*Initialize Element vector and return if necessary*/
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-	if(approximation!=HOFSApproximationEnum) return NULL;
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumnodes = this->NumberofNodesPressure();
+-
+-	/*Prepare coordinate system list*/
+-	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+-	for(i=0;i<vnumnodes;i++) cs_list[i]           = XYZEnum;
+-	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementVector* pe=new ElementVector(nodes,vnumnodes+pnumnodes,this->parameters,FSvelocityEnum);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum);       _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);       _assert_(vy_input);
+-	Input* vz_input=inputs->GetInput(VzEnum);       _assert_(vz_input);
+-	Input* vzHO_input=inputs->GetInput(VzHOEnum);   _assert_(vzHO_input);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(5,5);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctionsP1(&basis[0], gauss);
+-		GetNodalFunctionsP1Derivatives(&dbasis[0][0],&xyz_list[0][0], gauss);
+-
+-		vzHO_input->GetInputDerivativeValue(&dw[0],&xyz_list[0][0],gauss);
+-
+-		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+-		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+-
+-		for(i=0;i<NUMVERTICES;i++){
+-			pe->values[i*NDOF3+0]+=-Jdet*gauss->weight*viscosity*dw[0]*dbasis[2][i];
+-			pe->values[i*NDOF3+1]+=-Jdet*gauss->weight*viscosity*dw[1]*dbasis[2][i];
+-			pe->values[i*NDOF3+2]+=-Jdet*gauss->weight*viscosity*(dw[0]*dbasis[0][i]+dw[1]*dbasis[1][i]+2*dw[2]*dbasis[2][i]);
+-			pe->values[NDOF3*vnumnodes+i]+=Jdet*gauss->weight*FSreconditioning*dw[2]*basis[i];
+-		}
+-	}
+-
+-	/*Transform coordinate system*/
+-	::TransformLoadVectorCoord(pe,nodes,vnumnodes+pnumnodes,cs_list);
+-
+-	/*Clean up and return*/
+-	xDelete<int>(cs_list);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorCouplingHOFSFriction{{{*/
+-ElementVector* Penta::CreatePVectorCouplingHOFSFriction(void){
+-
+-	/*Intermediaries*/
+-	int         i,j;
+-	int         approximation,analysis_type;
+-	IssmDouble  Jdet,Jdet2d;
+-	IssmDouble  FSreconditioning;
+-	IssmDouble	bed_normal[3];
+-	IssmDouble  epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
+-	IssmDouble  viscosity, w, alpha2_gauss;
+-	IssmDouble  dw[3];
+-	IssmDouble	xyz_list_tria[NUMVERTICES2D][3];
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble  basis[6]; //for the six nodes of the penta
+-	Friction*   friction=NULL;
+-	GaussPenta  *gauss=NULL;
+-
+-	/*Initialize Element vector and return if necessary*/
+-	if(!IsOnBed() || IsFloating()) return NULL;
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-	if(approximation!=HOFSApproximationEnum) return NULL;
+-
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumnodes = this->NumberofNodesPressure();
+-	int numnodes  = vnumnodes+pnumnodes;
+-
+-	/*Prepare coordinate system list*/
+-	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+-	for(i=0;i<vnumnodes;i++) cs_list[i]           = XYZEnum;
+-	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
+-
+-	ElementVector* pe=new ElementVector(nodes,numnodes,this->parameters,FSvelocityEnum);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-	this->parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum);               _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);               _assert_(vy_input);
+-	Input* vz_input=inputs->GetInput(VzEnum);               _assert_(vz_input);
+-	Input* vzHO_input=inputs->GetInput(VzHOEnum);   _assert_(vzHO_input);
+-
+-	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+-
+-	/*build friction object, used later on: */
+-	friction=new Friction(this,3);
+-
+-	/* Start looping on the number of gauss 2d (nodes on the bedrock) */
+-	gauss=new GaussPenta(0,1,2,2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetTriaJacobianDeterminant(&Jdet2d, &xyz_list_tria[0][0], gauss);
+-		GetNodalFunctionsP1(basis, gauss);
+-
+-		vzHO_input->GetInputValue(&w, gauss);
+-		vzHO_input->GetInputDerivativeValue(&dw[0],&xyz_list[0][0],gauss);
+-
+-		NormalBase(&bed_normal[0],&xyz_list_tria[0][0]);
+-		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+-		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+-		friction->GetAlpha2(&alpha2_gauss, gauss,vx_input,vy_input,vz_input);
+-
+-		for(i=0;i<NUMVERTICES2D;i++){
+-			pe->values[i*NDOF3+0]+=Jdet2d*gauss->weight*(alpha2_gauss*w*bed_normal[0]*bed_normal[2]+2*viscosity*dw[2]*bed_normal[0])*basis[i];
+-			pe->values[i*NDOF3+1]+=Jdet2d*gauss->weight*(alpha2_gauss*w*bed_normal[1]*bed_normal[2]+2*viscosity*dw[2]*bed_normal[1])*basis[i];
+-			pe->values[i*NDOF3+2]+=Jdet2d*gauss->weight*2*viscosity*(dw[0]*bed_normal[0]+dw[1]*bed_normal[1]+dw[2]*bed_normal[2])*basis[i];
+-		}
+-	}
+-
+-	/*Transform coordinate system*/
+-	::TransformLoadVectorCoord(pe,nodes,vnumnodes+pnumnodes,cs_list);
+-
+-	/*Clean up and return*/
+-	xDelete<int>(cs_list);
+-	delete gauss;
+-	delete friction;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorStressbalanceHoriz{{{*/
+-ElementVector* Penta::CreatePVectorStressbalanceHoriz(void){
+-
+-	int approximation;
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-
+-	switch(approximation){
+-		case SSAApproximationEnum:
+-			return CreatePVectorStressbalanceSSA();
+-		case HOApproximationEnum:
+-			return CreatePVectorStressbalanceHO();
+-		case L1L2ApproximationEnum:
+-			return CreatePVectorStressbalanceL1L2();
+-		case SIAApproximationEnum:
+-			return NULL;
+-		case NoneApproximationEnum:
+-			return NULL;
+-		case FSApproximationEnum:
+-			return CreatePVectorStressbalanceFS();
+-		case SSAHOApproximationEnum:
+-			return CreatePVectorStressbalanceSSAHO();
+-		case SSAFSApproximationEnum:
+-			return CreatePVectorStressbalanceSSAFS();
+-		case HOFSApproximationEnum:
+-			return CreatePVectorStressbalanceHOFS();
+-		default:
+-			_error_("Approximation " << EnumToStringx(approximation) << " not supported yet");
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorStressbalanceSSAHO{{{*/
+-ElementVector* Penta::CreatePVectorStressbalanceSSAHO(void){
+-
+-	/*compute all load vectors for this element*/
+-	ElementVector* pe1=CreatePVectorStressbalanceSSA();
+-	ElementVector* pe2=CreatePVectorStressbalanceHO();
+-	ElementVector* pe =new ElementVector(pe1,pe2);
+-
+-	/*clean-up and return*/
+-	delete pe1;
+-	delete pe2;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorStressbalanceSSAFS{{{*/
+-ElementVector* Penta::CreatePVectorStressbalanceSSAFS(void){
+-
+-	/*compute all load vectors for this element*/
+-	int init = this->element_type;
+-	this->element_type=P1Enum;
+-	ElementVector* pe1=CreatePVectorStressbalanceSSA();
+-	this->element_type=init;
+-	ElementVector* pe2=CreatePVectorStressbalanceFS();
+-	int indices[3]={18,19,20};
+-	this->element_type=MINIcondensedEnum;
+-	ElementMatrix* Ke = CreateKMatrixStressbalanceFS();
+-	this->element_type=init;
+-	pe2->StaticCondensation(Ke,3,&indices[0]);
+-	delete Ke;
+-	ElementVector* pe3=CreatePVectorCouplingSSAFS();
+-	ElementVector* pe =new ElementVector(pe1,pe2,pe3);
+-
+-	/*clean-up and return*/
+-	delete pe1;
+-	delete pe2;
+-	delete pe3;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorStressbalanceHOFS{{{*/
+-ElementVector* Penta::CreatePVectorStressbalanceHOFS(void){
+-
+-	/*compute all load vectors for this element*/
+-	int init = this->element_type;
+-	this->element_type=P1Enum;
+-	ElementVector* pe1=CreatePVectorStressbalanceHO();
+-	this->element_type=init;
+-	ElementVector* pe2=CreatePVectorStressbalanceFS();
+-	int indices[3]={18,19,20};
+-	this->element_type=MINIcondensedEnum;
+-	ElementMatrix* Ke = CreateKMatrixStressbalanceFS();
+-	this->element_type=init;
+-	pe2->StaticCondensation(Ke,3,&indices[0]);
+-	delete Ke;
+-	ElementVector* pe3=CreatePVectorCouplingHOFS();
+-	ElementVector* pe =new ElementVector(pe1,pe2,pe3);
+-
+-	/*clean-up and return*/
+-	delete pe1;
+-	delete pe2;
+-	delete pe3;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorStressbalanceSIA{{{*/
+-ElementVector* Penta::CreatePVectorStressbalanceSIA(void){
+-
+-	/*Intermediaries*/
+-	int         i,j;
+-	int         node0,node1;
+-	IssmDouble  connectivity[2];
+-	IssmDouble  Jdet;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble  xyz_list_segment[2][3];
+-	IssmDouble  z_list[NUMVERTICES];
+-	IssmDouble  slope[2];
+-	IssmDouble  slope2,constant_part,drag;
+-	IssmDouble  rho_ice,gravity,n,B;
+-	IssmDouble  ub,vb,z_g,surface,thickness;
+-	GaussPenta* gauss=NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes(); _assert_(numnodes==6); 
+-
+-	/*Initialize Element vector*/
+-	ElementVector* pe=new ElementVector(nodes,numnodes,this->parameters);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	rho_ice=matpar->GetRhoIce();
+-	gravity=matpar->GetG();
+-	n=material->GetN();
+-	B=material->GetB();
+-	Input* thickness_input=inputs->GetInput(ThicknessEnum);  _assert_(thickness_input);
+-	Input* surface_input=inputs->GetInput(SurfaceEnum);      _assert_(surface_input);
+-	Input* slopex_input=inputs->GetInput(SurfaceSlopeXEnum); _assert_(slopex_input);
+-	Input* slopey_input=inputs->GetInput(SurfaceSlopeYEnum); _assert_(slopey_input);
+-	Input* drag_input=inputs->GetInput(FrictionCoefficientEnum);  _assert_(drag_input);
+-	for(i=0;i<NUMVERTICES;i++)z_list[i]=xyz_list[i][2];
+-
+-	/*Loop on the three segments*/
+-	for(i=0;i<3;i++){
+-
+-		node0=i; node1=i+3;
+-
+-		for(j=0;j<3;j++){
+-			xyz_list_segment[0][j]=xyz_list[node0][j];
+-			xyz_list_segment[1][j]=xyz_list[node1][j];
+-		}
+-
+-		connectivity[0]=(IssmDouble)vertices[node0]->Connectivity();
+-		connectivity[1]=(IssmDouble)vertices[node1]->Connectivity();
+-
+-		/*Loop on the Gauss points: */
+-		gauss=new GaussPenta(node0,node1,3);
+-		for(int ig=gauss->begin();ig<gauss->end();ig++){
+-			gauss->GaussPoint(ig);
+-
+-			slopex_input->GetInputValue(&slope[0],gauss);
+-			slopey_input->GetInputValue(&slope[1],gauss);
+-			surface_input->GetInputValue(&surface,gauss);
+-			thickness_input->GetInputValue(&thickness,gauss);
+-
+-			slope2=pow(slope[0],2)+pow(slope[1],2);
+-			constant_part=-2.*pow(rho_ice*gravity,n)*pow(slope2,((n-1.)/2.));
+-
+-			PentaRef::GetInputValue(&z_g,&z_list[0],gauss);
+-			GetSegmentJacobianDeterminant(&Jdet,&xyz_list_segment[0][0],gauss);
+-
+-			if(IsOnSurface()){
+-				pe->values[2*node1+0]+=constant_part*pow((surface-z_g)/B,n)*slope[0]*Jdet*gauss->weight/connectivity[1];
+-				pe->values[2*node1+1]+=constant_part*pow((surface-z_g)/B,n)*slope[1]*Jdet*gauss->weight/connectivity[1];
+-			}
+-			else{/*connectivity is too large, should take only half on it*/
+-				pe->values[2*node1+0]+=constant_part*pow((surface-z_g)/B,n)*slope[0]*Jdet*gauss->weight*2./connectivity[1];
+-				pe->values[2*node1+1]+=constant_part*pow((surface-z_g)/B,n)*slope[1]*Jdet*gauss->weight*2./connectivity[1];
+-			}
+-		}
+-
+-		/*Deal with lower surface*/
+-		if(IsOnBed()){
+-			drag_input->GetInputValue(&drag,gauss);
+-
+-			/*Payne 1995 (m = 1, B = 5e-3/yts = 1.58e-10  m/s/Pa*/
+-			ub=-1.58*1.e-10*rho_ice*gravity*thickness*slope[0];
+-			vb=-1.58*1.e-10*rho_ice*gravity*thickness*slope[1];
+-			///*Ritz et al. 1996*/
+-			//ub=drag*(rho_ice*gravity*thickness)*(rho_ice*gravity*thickness)*slope[0]/sqrt(slope2);
+-			//vb=drag*(rho_ice*gravity*thickness)*(rho_ice*gravity*thickness)*slope[1]/sqrt(slope2);
+-			///*Rutt et al. 2009*/
+-			//ub=-drag*rho_ice*gravity*thickness*slope[0];
+-			//vb=-drag*rho_ice*gravity*thickness*slope[1];
+-
+-			pe->values[2*node0+0]+=ub/connectivity[0];
+-			pe->values[2*node0+1]+=vb/connectivity[0];
+-		}
+-		delete gauss;
+-	}
+-
+-	/*Clean up and return*/
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorStressbalanceSSA{{{*/
+-ElementVector* Penta::CreatePVectorStressbalanceSSA(void){
+-
+-	if (!IsOnBed()) return NULL;
+-
+-	/*Call Tria function*/
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	ElementVector* pe=tria->CreatePVectorStressbalanceSSA();
+-	delete tria->material; delete tria;
+-
+-	/*Clean up and return*/
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorStressbalanceL1L2{{{*/
+-ElementVector* Penta::CreatePVectorStressbalanceL1L2(void){
+-
+-	if (!IsOnBed()) return NULL;
+-
+-	/*Call Tria function*/
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	ElementVector* pe=tria->CreatePVectorStressbalanceSSA();
+-	delete tria->material; delete tria;
+-
+-	/*Clean up and return*/
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorStressbalanceHO{{{*/
+-ElementVector* Penta::CreatePVectorStressbalanceHO(void){
+-
+-	/*compute all load vectors for this element*/
+-	ElementVector* pe1=CreatePVectorStressbalanceHODrivingStress();
+-	ElementVector* pe2=CreatePVectorStressbalanceHOFront();
+-	ElementVector* pe =new ElementVector(pe1,pe2);
+-
+-	/*clean-up and return*/
+-	delete pe1;
+-	delete pe2;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorStressbalanceHODrivingStress{{{*/
+-ElementVector* Penta::CreatePVectorStressbalanceHODrivingStress(void){
+-
+-	/*Intermediaries*/
+-	IssmDouble  Jdet;
+-	IssmDouble  slope[3]; //do not put 2! this goes into GetInputDerivativeValue, which addresses slope[3] also!
+-	IssmDouble  driving_stress_baseline,thickness;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	GaussPenta  *gauss=NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize vector*/
+-	ElementVector* pe    = new ElementVector(nodes,numnodes,this->parameters,HOApproximationEnum);
+-	IssmDouble*    basis = xNewZeroInit<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* thickness_input=inputs->GetInput(ThicknessEnum); _assert_(thickness_input);
+-	Input* surface_input=inputs->GetInput(SurfaceEnum);     _assert_(surface_input);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(3,3);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis,gauss);
+-
+-		thickness_input->GetInputValue(&thickness, gauss);
+-		surface_input->GetInputDerivativeValue(&slope[0],&xyz_list[0][0],gauss);
+-
+-		driving_stress_baseline=matpar->GetRhoIce()*matpar->GetG();
+-
+-		for(int i=0;i<numnodes;i++){
+-			pe->values[i*NDOF2+0]+= -driving_stress_baseline*slope[0]*Jdet*gauss->weight*basis[i];
+-			pe->values[i*NDOF2+1]+= -driving_stress_baseline*slope[1]*Jdet*gauss->weight*basis[i];
+-		}
+-	}
+-
+-	/*Transform coordinate system*/
+-	::TransformLoadVectorCoord(pe,nodes,numnodes,XYEnum);
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorStressbalanceHOFront{{{*/
+-ElementVector* Penta::CreatePVectorStressbalanceHOFront(void){
+-
+-	/*If no front, return NULL*/
+-	if(!IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
+-
+-	/*Intermediaries*/
+-	IssmDouble  rho_ice,rho_water,gravity;
+-	IssmDouble  Jdet,surface,z_g,water_pressure,ice_pressure,air_pressure;
+-	IssmDouble  surface_under_water,base_under_water,pressure;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble* xyz_list_front = NULL;
+-	IssmDouble  area_coordinates[4][3];
+-	IssmDouble  normal[3];
+-	GaussPenta* gauss;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element vector and other vectors*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	ElementVector* pe    = new ElementVector(nodes,numnodes,this->parameters,HOApproximationEnum);
+-	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	Input* surface_input=inputs->GetInput(SurfaceEnum); _assert_(surface_input);
+-	rho_water=matpar->GetRhoWater();
+-	rho_ice  =matpar->GetRhoIce();
+-	gravity  =matpar->GetG();
+-	ZeroLevelsetCoordinates(&xyz_list_front,&xyz_list[0][0],MaskIceLevelsetEnum);
+-	GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,&xyz_list[0][0],4);
+-	NormalSection(&normal[0],xyz_list_front);
+-
+-	/*Initialize gauss points*/
+-	IssmDouble zmax=xyz_list[0][2]; for(int i=1;i<6;i++) if(xyz_list[i][2]>zmax) zmax=xyz_list[i][2];
+-	IssmDouble zmin=xyz_list[0][2]; for(int i=1;i<6;i++) if(xyz_list[i][2]<zmin) zmin=xyz_list[i][2];
+-	if(zmax>0 && zmin<0) gauss=new GaussPenta(area_coordinates,3,10); //refined in vertical because of the sea level discontinuity
+-	else                 gauss=new GaussPenta(area_coordinates,3,3);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-		surface_input->GetInputValue(&surface,gauss);
+-		z_g=GetZcoord(gauss);
+-		GetNodalFunctions(basis,gauss);
+-		GetQuadJacobianDeterminant(&Jdet,xyz_list_front,gauss);
+-
+-		water_pressure = rho_water*gravity*min(0.,z_g);//0 if the gaussian point is above water level
+-		ice_pressure   = rho_ice*gravity*(surface-z_g);
+-		air_pressure   = 0;
+-		pressure       = ice_pressure + water_pressure + air_pressure;
+-
+-		for (int i=0;i<numnodes;i++){
+-			pe->values[2*i+0]+= pressure*Jdet*gauss->weight*normal[0]*basis[i];
+-			pe->values[2*i+1]+= pressure*Jdet*gauss->weight*normal[1]*basis[i];
+-		}
+-	}
+-
+-	/*Transform coordinate system*/
+-	::TransformLoadVectorCoord(pe,nodes,numnodes,XYEnum);
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	xDelete<IssmDouble>(xyz_list_front);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorStressbalanceFS {{{*/
+-ElementVector* Penta::CreatePVectorStressbalanceFS(void){
+-
+-	ElementVector* pe1;
+-	ElementVector* pe2;
+-	ElementVector* pe3;
+-	ElementVector* pe;
+-
+-	/*compute all stiffness matrices for this element*/
+-	pe1=CreatePVectorStressbalanceFSViscous();
+-	pe2=CreatePVectorStressbalanceFSShelf();
+-	pe3=CreatePVectorStressbalanceFSFront();
+-	pe =new ElementVector(pe1,pe2,pe3);
+-
+-	/*clean-up and return*/
+-	delete pe1;
+-	delete pe2;
+-	delete pe3;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorStressbalanceFSFront{{{*/
+-ElementVector* Penta::CreatePVectorStressbalanceFSFront(void){
+-
+-	/*If no front, return NULL*/
+-	if(!IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int         i;
+-	IssmDouble  rho_ice,rho_water,gravity;
+-	IssmDouble  Jdet,z_g,water_pressure,air_pressure;
+-	IssmDouble  surface_under_water,base_under_water,pressure;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble* xyz_list_front = NULL;
+-	IssmDouble  area_coordinates[4][3];
+-	IssmDouble  normal[3];
+-	GaussPenta* gauss;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumnodes = this->NumberofNodesPressure();
+-
+-	/*Prepare coordinate system list*/
+-	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+-	for(i=0;i<vnumnodes;i++) cs_list[i]           = XYZEnum;
+-	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
+-
+-	/*Initialize Element matrix and vectors*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	ElementVector* pe     = new ElementVector(nodes,vnumnodes+pnumnodes,this->parameters,FSvelocityEnum);
+-	IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	rho_water=matpar->GetRhoWater();
+-	rho_ice  =matpar->GetRhoIce();
+-	gravity  =matpar->GetG();
+-	ZeroLevelsetCoordinates(&xyz_list_front,&xyz_list[0][0],MaskIceLevelsetEnum);
+-	GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,&xyz_list[0][0],4);
+-	NormalSection(&normal[0],xyz_list_front);
+-
+-	/*Start looping on Gaussian points*/
+-	IssmDouble zmax=xyz_list[0][2]; for(int i=1;i<6;i++) if(xyz_list[i][2]>zmax) zmax=xyz_list[i][2];
+-	IssmDouble zmin=xyz_list[0][2]; for(int i=1;i<6;i++) if(xyz_list[i][2]<zmin) zmin=xyz_list[i][2];
+-	if(zmax>0 && zmin<0) gauss=new GaussPenta(area_coordinates,3,30); //refined in vertical because of the sea level discontinuity
+-	else                 gauss=new GaussPenta(area_coordinates,3,3);
+-
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-		z_g=GetZcoord(gauss);
+-		GetNodalFunctionsVelocity(vbasis,gauss);
+-		GetQuadJacobianDeterminant(&Jdet,xyz_list_front,gauss);
+-
+-		water_pressure=rho_water*gravity*min(0.,z_g);//0 if the gaussian point is above water level
+-		air_pressure=0;
+-		pressure = water_pressure + air_pressure;
+-
+-		for(i=0;i<vnumnodes;i++){
+-			pe->values[3*i+0]+= pressure*Jdet*gauss->weight*normal[0]*vbasis[i];
+-			pe->values[3*i+1]+= pressure*Jdet*gauss->weight*normal[1]*vbasis[i];
+-			pe->values[3*i+2]+= pressure*Jdet*gauss->weight*normal[2]*vbasis[i];
+-		}
+-	}
+-
+-	/*Transform coordinate system*/
+-	::TransformLoadVectorCoord(pe,nodes,(vnumnodes+pnumnodes),cs_list);
+-
+-	/*Clean up and return*/
+-	xDelete<int>(cs_list);
+-	xDelete<IssmDouble>(xyz_list_front);
+-	xDelete<IssmDouble>(vbasis);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::PVectorGLSstabilization{{{*/
+-void Penta::PVectorGLSstabilization(ElementVector* pe){
+-
+-	/*Intermediaries*/
+-	int        i,j;
+-	IssmDouble Jdet,gravity,rho_ice,B,D_scalar_stab,viscosity;
+-	IssmDouble forcex,forcey,forcez,diameter,FSreconditioning;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
+-	GaussPenta *gauss=NULL;
+-
+-	/*Stabilization*/
+-	IssmDouble dbasis[3][6];
+-	IssmDouble dmu[3];
+-	IssmDouble mu;
+-	IssmDouble dnodalbasis[6][6][3];
+-	IssmDouble SW[6][4][4];
+-	int p,ii;
+-	int c=3; //index of pressure
+-
+-	/*Retrieve all inputs and parameters*/
+-	rho_ice=matpar->GetRhoIce();
+-	gravity=matpar->GetG();
+-	B=material->GetB();
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+-	Input* vz_input=inputs->GetInput(VzEnum); _assert_(vz_input);
+-
+-	/*Find minimal length*/
+-	diameter=MinEdgeLength(&xyz_list[0][0]);
+-
+-		gauss=new GaussPenta();
+-		for(int iv=0;iv<6;iv++){
+-			gauss->GaussVertex(iv);
+-			GetNodalFunctionsP1Derivatives(&dbasis[0][0],&xyz_list[0][0],gauss);
+-			for(i=0;i<6;i++){
+-				for(j=0;j<3;j++){
+-					dnodalbasis[i][iv][j] = dbasis[j][i];
+-				}
+-			}
+-		}
+-		delete gauss;
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(5,5);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+-		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+-
+-		GetNodalFunctionsP1Derivatives(&dbasis[0][0],&xyz_list[0][0],gauss);
+-		dmu[0]=0.; dmu[1]=0.; dmu[2]=0.;
+-		mu = 2.*viscosity;
+-		for(p=0;p<6;p++) for(i=0;i<4;i++) for(j=0;j<4;j++){
+-			SW[p][i][j]=0.;
+-		}
+-		for(p=0;p<6;p++){
+-			for(i=0;i<3;i++){
+-				SW[p][c][i] += dbasis[i][p];
+-				for(j=0;j<3;j++){
+-					SW[p][i][i] += -dmu[j]*dbasis[j][p];
+-					SW[p][j][i] += -dmu[j]*dbasis[i][p];
+-					for(ii=0;ii<6;ii++){
+-						SW[p][i][i] += -mu*dnodalbasis[p][ii][j]*dbasis[j][ii];
+-						SW[p][j][i] += -mu*dnodalbasis[p][ii][i]*dbasis[j][ii];
+-					}
+-				}
+-			}
+-		}
+-		IssmDouble tau = 1./3.*pow(diameter,2)/(8.*2.*viscosity);
+-		for(p=0;p<6;p++){
+-			for(j=0;j<4;j++){
+-				pe->values[p*4+j] += gauss->weight*Jdet*tau*rho_ice*forcex*SW[p][j][0];
+-				pe->values[p*4+j] += gauss->weight*Jdet*tau*rho_ice*forcey*SW[p][j][1];
+-				pe->values[p*4+j] += gauss->weight*Jdet*tau*rho_ice*(forcez-gravity)*SW[p][j][2];
+-			}
+-		}
+-	}
+-
+-	/*Clean up*/
+-	delete gauss;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorStressbalanceFSViscous {{{*/
+-ElementVector* Penta::CreatePVectorStressbalanceFSViscous(void){
+-
+-	/*Intermediaries*/
+-	int        i;
+-	int        approximation;
+-	IssmDouble Jdet,gravity,rho_ice;
+-	IssmDouble forcex,forcey,forcez;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	GaussPenta *gauss=NULL;
+-
+-	/*Initialize Element vector and return if necessary*/
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-	if(approximation!=FSApproximationEnum && approximation!=SSAFSApproximationEnum && approximation!=HOFSApproximationEnum) return NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumnodes = this->NumberofNodesPressure();
+-
+-	/*Prepare coordinate system list*/
+-	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+-	for(i=0;i<vnumnodes;i++) cs_list[i]           = XYZEnum;
+-	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementVector* pe     = new ElementVector(nodes,vnumnodes+pnumnodes,this->parameters,FSvelocityEnum);
+-	IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* loadingforcex_input=inputs->GetInput(LoadingforceXEnum);  _assert_(loadingforcex_input);
+-	Input* loadingforcey_input=inputs->GetInput(LoadingforceYEnum);  _assert_(loadingforcey_input);
+-	Input* loadingforcez_input=inputs->GetInput(LoadingforceZEnum);  _assert_(loadingforcez_input);
+-	rho_ice = matpar->GetRhoIce();
+-	gravity = matpar->GetG();
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(5,5);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctionsVelocity(vbasis, gauss);
+-
+-		loadingforcex_input->GetInputValue(&forcex,gauss);
+-		loadingforcey_input->GetInputValue(&forcey,gauss);
+-		loadingforcez_input->GetInputValue(&forcez,gauss);
+-
+-		for(i=0;i<vnumnodes;i++){
+-			pe->values[i*NDOF3+2] += -rho_ice*gravity*Jdet*gauss->weight*vbasis[i];
+-			pe->values[i*NDOF3+0] += +rho_ice*forcex *Jdet*gauss->weight*vbasis[i];
+-			pe->values[i*NDOF3+1] += +rho_ice*forcey *Jdet*gauss->weight*vbasis[i];
+-			pe->values[i*NDOF3+2] += +rho_ice*forcez *Jdet*gauss->weight*vbasis[i];
+-		}
+-	}
+-
+-	/*Transform coordinate system*/
+-	::TransformLoadVectorCoord(pe,nodes,vnumnodes+pnumnodes,cs_list);
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	xDelete<int>(cs_list);
+-	xDelete<IssmDouble>(vbasis);
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorStressbalanceFSShelf{{{*/
+-ElementVector* Penta::CreatePVectorStressbalanceFSShelf(void){
+-
+-	/*Intermediaries*/
+-	int         i,j;
+-	int         approximation,shelf_dampening;
+-	IssmDouble  gravity,rho_water,bed,water_pressure;
+-	IssmDouble  damper,normal_vel,vx,vy,vz,dt;
+-	IssmDouble	xyz_list_tria[NUMVERTICES2D][3];
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble	bed_normal[3];
+-	IssmDouble  dz[3];
+-	IssmDouble  Jdet2d;
+-	GaussPenta  *gauss=NULL;
+-
+-	/*Initialize Element vector and return if necessary*/
+-	if(!IsOnBed() || !IsFloating()) return NULL;
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-	if(approximation!=FSApproximationEnum && approximation!=SSAFSApproximationEnum && approximation!=HOFSApproximationEnum) return NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumnodes = this->NumberofNodesPressure();
+-
+-	/*Prepare coordinate system list*/
+-	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+-	for(i=0;i<vnumnodes;i++) cs_list[i]           = XYZEnum;
+-	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementVector* pe     = new ElementVector(nodes,vnumnodes+pnumnodes,this->parameters,FSvelocityEnum);
+-	IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	this->parameters->FindParam(&shelf_dampening,StressbalanceShelfDampeningEnum);
+-	rho_water=matpar->GetRhoWater();
+-	gravity=matpar->GetG();
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* bed_input=inputs->GetInput(BedEnum); _assert_(bed_input);
+-	Input* vx_input=inputs->GetInput(VxEnum);   _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);   _assert_(vy_input);
+-	Input* vz_input=inputs->GetInput(VzEnum);   _assert_(vz_input);
+-
+-	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+-
+-	/* Start looping on the number of gauss 2d (nodes on the bedrock) */
+-	gauss=new GaussPenta(0,1,2,5);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetTriaJacobianDeterminant(&Jdet2d, &xyz_list_tria[0][0], gauss);
+-		GetNodalFunctionsVelocity(vbasis, gauss);
+-
+-		NormalBase(&bed_normal[0],&xyz_list_tria[0][0]);
+-		bed_input->GetInputValue(&bed, gauss);
+-		if(shelf_dampening){ //add dampening to avoid too high vertical velocities when not in hydrostatic equilibrium
+-			bed_input->GetInputDerivativeValue(&dz[0],&xyz_list[0][0],gauss);
+-			vx_input->GetInputValue(&vx, gauss);
+-			vy_input->GetInputValue(&vy, gauss);
+-			vz_input->GetInputValue(&vz, gauss);
+-			dt=0.;
+-			normal_vel=bed_normal[0]*vx+bed_normal[1]*vy+bed_normal[2]*vz;
+-			damper=gravity*rho_water*pow(1+pow(dz[0],2)+pow(dz[1],2),0.5)*normal_vel*dt;
+-		}
+-		else damper=0.;
+-		water_pressure=gravity*rho_water*bed;
+-
+-		for(i=0;i<vnumnodes;i++){
+-			pe->values[3*i+0]+=(water_pressure+damper)*gauss->weight*Jdet2d*vbasis[i]*bed_normal[0];
+-			pe->values[3*i+1]+=(water_pressure+damper)*gauss->weight*Jdet2d*vbasis[i]*bed_normal[1];
+-			pe->values[3*i+2]+=(water_pressure+damper)*gauss->weight*Jdet2d*vbasis[i]*bed_normal[2];
+-		}
+-	}
+-
+-	/*Transform coordinate system*/
+-	::TransformLoadVectorCoord(pe,nodes,(vnumnodes+pnumnodes),cs_list);
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	xDelete<int>(cs_list);
+-	xDelete<IssmDouble>(vbasis);
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorStressbalanceVert {{{*/
+-ElementVector* Penta::CreatePVectorStressbalanceVert(void){
+-
+-	/*compute all load vectors for this element*/
+-	ElementVector* pe1=CreatePVectorStressbalanceVertVolume();
+-	ElementVector* pe2=CreatePVectorStressbalanceVertBase();
+-	ElementVector* pe =new ElementVector(pe1,pe2);
+-
+-	/*clean-up and return*/
+-	delete pe1;
+-	delete pe2;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorStressbalanceVertVolume {{{*/
+-ElementVector* Penta::CreatePVectorStressbalanceVertVolume(void){
+-
+-	/*Constants*/
+-	const int  numdof=NDOF1*NUMVERTICES;
+-
+-	/*Intermediaries*/
+-	int        approximation;
+-	IssmDouble     Jdet;
+-	IssmDouble     xyz_list[NUMVERTICES][3];
+-	IssmDouble     dudx,dvdy,dwdz;
+-	IssmDouble     du[3],dv[3],dw[3];
+-	IssmDouble     basis[6];
+-	GaussPenta *gauss=NULL;
+-
+-	/*Initialize Element vector*/
+-	ElementVector* pe=new ElementVector(nodes,NUMVERTICES,this->parameters);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+-	Input* vzFS_input=NULL;
+-	if(approximation==HOFSApproximationEnum || approximation==SSAFSApproximationEnum){
+-		vzFS_input=inputs->GetInput(VzFSEnum); _assert_(vzFS_input);
+-	}
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(2,2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctionsP1(basis, gauss);
+-
+-		vx_input->GetInputDerivativeValue(&du[0],&xyz_list[0][0],gauss);
+-		vy_input->GetInputDerivativeValue(&dv[0],&xyz_list[0][0],gauss);
+-		if(approximation==HOFSApproximationEnum || approximation==SSAFSApproximationEnum){
+-			vzFS_input->GetInputDerivativeValue(&dw[0],&xyz_list[0][0],gauss);
+-			dwdz=dw[2];
+-		}
+-		else dwdz=0;
+-		dudx=du[0];
+-		dvdy=dv[1];
+-
+-		for(int i=0;i<numdof;i++) pe->values[i] += (dudx+dvdy+dwdz)*Jdet*gauss->weight*basis[i];
+-	}
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorStressbalanceVertBase {{{*/
+-ElementVector* Penta::CreatePVectorStressbalanceVertBase(void){
+-
+-	/*Constants*/
+-	const int    numdof=NDOF1*NUMVERTICES;
+-
+-	/*Intermediaries */
+-	int        i,j;
+-	int        approximation;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble xyz_list_tria[NUMVERTICES2D][3];
+-	IssmDouble Jdet2d;
+-	IssmDouble vx,vy,vz,dbdx,dbdy,basalmeltingvalue;
+-	IssmDouble slope[3];
+-	IssmDouble basis[NUMVERTICES];
+-	GaussPenta* gauss=NULL;
+-
+-	if (!IsOnBed()) return NULL;
+-
+-	/*Initialize Element vector*/
+-	ElementVector* pe=new ElementVector(nodes,NUMVERTICES,this->parameters);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-	Input* bed_input=inputs->GetInput(BedEnum);                                _assert_(bed_input);
+-	Input* basal_melting_input=inputs->GetInput(BasalforcingsMeltingRateEnum); _assert_(basal_melting_input);
+-	Input* vx_input=inputs->GetInput(VxEnum);                                  _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);                                  _assert_(vy_input);
+-	Input* vzFS_input=NULL;
+-	if(approximation==HOFSApproximationEnum || approximation==SSAFSApproximationEnum){
+-		vzFS_input=inputs->GetInput(VzFSEnum);       _assert_(vzFS_input);
+-	}
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(0,1,2,2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		basal_melting_input->GetInputValue(&basalmeltingvalue, gauss);
+-		bed_input->GetInputDerivativeValue(&slope[0],&xyz_list[0][0],gauss);
+-		vx_input->GetInputValue(&vx, gauss);
+-		vy_input->GetInputValue(&vy, gauss);
+-		if(approximation==HOFSApproximationEnum || approximation==SSAFSApproximationEnum){
+-			vzFS_input->GetInputValue(&vz, gauss);
+-		}
+-		else vz=0;
+-
+-		dbdx=slope[0];
+-		dbdy=slope[1];
+-
+-		GetTriaJacobianDeterminant(&Jdet2d, &xyz_list_tria[0][0],gauss);
+-		GetNodalFunctionsP1(&basis[0], gauss);
+-
+-		for(i=0;i<numdof;i++) pe->values[i]+=-Jdet2d*gauss->weight*(vx*dbdx+vy*dbdy-vz-basalmeltingvalue)*basis[i];
+-	}
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::CreateJacobianStressbalanceHoriz{{{*/
+ ElementMatrix* Penta::CreateJacobianStressbalanceHoriz(void){
+ 
+@@ -9245,28 +7033,6 @@
+ 	return Ke;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::CreatePVectorBalancethickness {{{*/
+-ElementVector* Penta::CreatePVectorBalancethickness(void){
+-
+-	if (!IsOnBed()) return NULL;
+-
+-	/*Depth Averaging Vx and Vy*/
+-	this->InputDepthAverageAtBase(VxEnum,VxAverageEnum);
+-	this->InputDepthAverageAtBase(VyEnum,VyAverageEnum);
+-
+-	/*Call Tria function*/
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	ElementVector* pe=tria->CreatePVectorBalancethickness();
+-	delete tria->material; delete tria;
+-
+-	/*Delete Vx and Vy averaged*/
+-	this->inputs->DeleteInput(VxAverageEnum);
+-	this->inputs->DeleteInput(VyAverageEnum);
+-
+-	/*Clean up and return*/
+-	return pe;
+-}
+-/*}}}*/
+ #endif
+ 
+ #ifdef _HAVE_HYDROLOGY_
+@@ -9309,48 +7075,6 @@
+ 	return Ke;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::CreatePVectorHydrologyDCInefficient {{{*/
+-ElementVector* Penta::CreatePVectorHydrologyDCInefficient(void){
+-
+-	if (!IsOnBed()) return NULL;
+-
+-	/*Call Tria function*/
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	ElementVector* pe=tria->CreatePVectorHydrologyDCInefficient();
+-	delete tria->material; delete tria;
+-
+-	/*Clean up and return*/
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorHydrologyDCEfficient {{{*/
+-ElementVector* Penta::CreatePVectorHydrologyDCEfficient(void){
+-
+-	if (!IsOnBed()) return NULL;
+-
+-	/*Call Tria function*/
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	ElementVector* pe=tria->CreatePVectorHydrologyDCEfficient();
+-	delete tria->material; delete tria;
+-
+-	/*Clean up and return*/
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreatePVectorL@ProjectionEPL {{{*/
+-ElementVector* Penta::CreatePVectorL2ProjectionEPL(void){
+-
+-	if (!IsOnBed()) return NULL;
+-
+-	/*Call Tria function*/
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	ElementVector* pe=tria->CreatePVectorL2ProjectionEPL();
+-	delete tria->material; delete tria;
+-
+-	/*Clean up and return*/
+-	return pe;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::GetHydrologyDCInefficientHmax{{{*/
+ void  Penta::GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16981)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16982)
+@@ -198,11 +198,6 @@
+ 		ElementMatrix* CreateKMatrixMasstransport(void);
+ 		ElementMatrix* CreateKMatrixFreeSurfaceTop(void);
+ 		ElementMatrix* CreateKMatrixFreeSurfaceBase(void);
+-		ElementVector* CreatePVector(void);
+-		ElementVector* CreatePVectorMasstransport(void);
+-		ElementVector* CreatePVectorFreeSurfaceTop(void);
+-		ElementVector* CreatePVectorFreeSurfaceBase(void);
+-		ElementVector* CreatePVectorL2ProjectionBase(void);
+ 		IssmDouble     EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure);
+ 		IssmDouble     EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure);
+ 		void           GetAreaCoordinates(IssmDouble *area_coordinates,IssmDouble* xyz_zero,IssmDouble* xyz_list,int numpoints);
+@@ -300,49 +295,18 @@
+ 		ElementMatrix* CreateJacobianStressbalanceSSA2d(void);
+ 		ElementMatrix* CreateJacobianStressbalanceHO(void);
+ 		ElementMatrix* CreateJacobianStressbalanceFS(void);
+-		ElementVector* CreatePVectorCouplingSSAFS(void);
+-		ElementVector* CreatePVectorCouplingSSAFSViscous(void);
+-		ElementVector* CreatePVectorCouplingSSAFSFriction(void);
+-		ElementVector* CreatePVectorCouplingHOFS(void);
+-		ElementVector* CreatePVectorCouplingHOFSViscous(void);
+-		ElementVector* CreatePVectorCouplingHOFSFriction(void);
+-		ElementVector* CreatePVectorStressbalanceHoriz(void);
+-		ElementVector* CreatePVectorStressbalanceSIA(void);
+-		ElementVector* CreatePVectorStressbalanceSSA(void);
+-		ElementVector* CreatePVectorStressbalanceSSAHO(void);
+-		ElementVector* CreatePVectorStressbalanceSSAFS(void);
+-		ElementVector* CreatePVectorStressbalanceL1L2(void);
+-		ElementVector* CreatePVectorStressbalanceHO(void);
+-		ElementVector* CreatePVectorStressbalanceHODrivingStress(void);
+-		ElementVector* CreatePVectorStressbalanceHOFront(void);
+-		ElementVector* CreatePVectorStressbalanceHOFS(void);
+-		ElementVector* CreatePVectorStressbalanceFS(void);
+-		ElementVector* CreatePVectorStressbalanceFSFront(void);
+-		ElementVector* CreatePVectorStressbalanceFSViscous(void);
+-		void           PVectorGLSstabilization(ElementVector* pe);
+-		ElementVector* CreatePVectorStressbalanceFSShelf(void);
+-		ElementVector* CreatePVectorStressbalanceVert(void);
+-		ElementVector* CreatePVectorStressbalanceVertVolume(void);
+-		ElementVector* CreatePVectorStressbalanceVertBase(void);
+ 		#endif
+ 
+ 		#ifdef _HAVE_CONTROL_
+-		ElementVector* CreatePVectorAdjointHoriz(void);
+ 		ElementMatrix* CreateKMatrixAdjointSSA2d(void);
+ 		ElementMatrix* CreateKMatrixAdjointHO(void);
+ 		ElementMatrix* CreateKMatrixAdjointFS(void);
+-		ElementVector* CreatePVectorAdjointSSA(void);
+-		ElementVector* CreatePVectorAdjointHO(void);
+-		ElementVector* CreatePVectorAdjointFS(void);
+ 		#endif
+ 
+ 		#ifdef _HAVE_HYDROLOGY_
+ 		ElementMatrix* CreateKMatrixHydrologyDCInefficient(void);
+ 		ElementMatrix* CreateKMatrixHydrologyDCEfficient(void);
+ 		ElementMatrix* CreateEPLDomainMassMatrix(void);
+-		ElementVector* CreatePVectorHydrologyDCInefficient(void);
+-		ElementVector* CreatePVectorHydrologyDCEfficient(void);
+-		ElementVector* CreatePVectorL2ProjectionEPL(void);
+ 		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode);
+ 		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index){_error_("not implemented yet");};
+ 		void           GetHydrologyTransfer(Vector<IssmDouble>* transfer);
+@@ -361,15 +325,6 @@
+ 		ElementMatrix* CreateKMatrixMelting(void);
+ 		ElementMatrix* CreateKMatrixThermalVolume(void);
+ 		ElementMatrix* CreateKMatrixThermalShelf(void);
+-		ElementVector* CreatePVectorEnthalpy(void);
+-		ElementVector* CreatePVectorEnthalpyVolume(void);
+-		ElementVector* CreatePVectorEnthalpyShelf(void);
+-		ElementVector* CreatePVectorEnthalpySheet(void);
+-		ElementVector* CreatePVectorMelting(void);
+-		ElementVector* CreatePVectorThermal(void);
+-		ElementVector* CreatePVectorThermalVolume(void);
+-		ElementVector* CreatePVectorThermalShelf(void);
+-		ElementVector* CreatePVectorThermalSheet(void);
+ 		void           UpdateBasalConstraintsEnthalpy(void);
+ 		void           ComputeBasalMeltingrate(void);
+ 		void           DrainWaterfraction(IssmDouble* drainrate_element);
+@@ -377,7 +332,6 @@
+ 
+ 		#ifdef _HAVE_BALANCED_
+ 		ElementMatrix* CreateKMatrixBalancethickness(void);
+-		ElementVector* CreatePVectorBalancethickness(void);
+ 		#endif
+ 		/*}}}*/
+ };
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 16981)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 16982)
+@@ -332,153 +332,6 @@
+ 	return Ke;
+ }
+ /*}}}*/
+-/*FUNCTION Seg::CreatePVectorL2Projection {{{*/
+-ElementVector* Seg::CreatePVectorL2Projection(void){
+-
+-	/*Intermediaries */
+-	int        i,input_enum;
+-	IssmDouble Jdet;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble value;
+-	Input*     input  = NULL;
+-	Input*     input2 = NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element vector*/
+-	ElementVector* pe    = new ElementVector(nodes,numnodes,this->parameters);
+-	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&input_enum,InputToL2ProjectEnum);
+-	switch(input_enum){
+-		case SurfaceSlopeXEnum: input2 = inputs->GetInput(SurfaceEnum); _assert_(input2); break;
+-		case BedSlopeXEnum:     input2 = inputs->GetInput(BedEnum);     _assert_(input2); break;
+-		default: input = inputs->GetInput(input_enum);
+-	}
+-
+-	/* Start  looping on the number of gaussian points: */
+-	GaussSeg* gauss=new GaussSeg(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis,gauss);
+-
+-		if(input2){
+-			input2->GetInputDerivativeValue(&value,&xyz_list[0][0],gauss);
+-		}
+-		else{
+-			input->GetInputValue(&value,gauss);
+-		}
+-
+-		for(i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*value*basis[i];
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Seg::CreatePVectorFreeSurfaceTop {{{*/
+-ElementVector* Seg::CreatePVectorFreeSurfaceTop(void){
+-
+-	/*Intermediaries */
+-	IssmDouble Jdet,dt;
+-	IssmDouble ms,surface,vy;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element vector and other vectors*/
+-	ElementVector* pe    = new ElementVector(nodes,numnodes,this->parameters);
+-	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	Input* vy_input     = inputs->GetInput(VyEnum);                         _assert_(vy_input);
+-	Input* ms_input     = inputs->GetInput(SurfaceforcingsMassBalanceEnum); _assert_(ms_input);
+-	Input* surface_input= inputs->GetInput(SurfaceEnum);                    _assert_(surface_input);
+-
+-	/*Initialize mb_correction to 0, do not forget!:*/
+-	/* Start  looping on the number of gaussian points: */
+-	GaussSeg* gauss=new GaussSeg(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis,gauss);
+-
+-		vy_input->GetInputValue(&vy,gauss);
+-		ms_input->GetInputValue(&ms,gauss);
+-		surface_input->GetInputValue(&surface,gauss);
+-
+-		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*(surface + dt*ms + dt*vy)*basis[i];
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+-/*FUNCTION Seg::CreatePVectorFreeSurfaceBase {{{*/
+-ElementVector* Seg::CreatePVectorFreeSurfaceBase(void){
+-
+-	/*Intermediaries */
+-	IssmDouble Jdet,dt;
+-	IssmDouble mb,mb_correction,bed,vy;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element vector and other vectors*/
+-	ElementVector* pe    = new ElementVector(nodes,numnodes,this->parameters);
+-	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	Input* vy_input            = inputs->GetInput(VyEnum);                         _assert_(vy_input);
+-	Input* mb_input            = inputs->GetInput(BasalforcingsMeltingRateEnum);   _assert_(mb_input);
+-	Input* mb_correction_input = inputs->GetInput(BasalforcingsMeltingRateCorrectionEnum);
+-	Input* bed_input           = inputs->GetInput(BedEnum);                        _assert_(bed_input);
+-
+-	/*Initialize mb_correction to 0, do not forget!:*/
+-	/* Start  looping on the number of gaussian points: */
+-	GaussSeg* gauss=new GaussSeg(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis,gauss);
+-
+-		vy_input->GetInputValue(&vy,gauss);
+-		mb_input->GetInputValue(&mb,gauss);
+-		bed_input->GetInputValue(&bed,gauss);
+-		if(mb_correction_input)
+-		 mb_correction_input->GetInputValue(&mb_correction,gauss);
+-		else
+-		 mb_correction=0.;
+-
+-		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*(bed+dt*(mb-mb_correction) + dt*vy)*basis[i];
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	delete gauss;
+-	return pe;
+-}
+-/*}}}*/
+ /*FUNCTION Seg::GetNumberOfNodes;{{{*/
+ int Seg::GetNumberOfNodes(void){
+ 	return this->NumberofNodes();
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16981)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16982)
+@@ -70,8 +70,6 @@
+ 		void        SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum){_error_("not implemented yet");};
+ 		ElementMatrix* CreateKMatrix(void){_error_("not implemented yet");};
+ 		void        CreateDVector(Vector<IssmDouble>* df){_error_("not implemented yet");};
+-		ElementVector* CreatePVector(void){_error_("not implemented yet");};
+-		ElementVector* CreatePVectorL2Projection(void);
+ 		void        CreateJacobianMatrix(Matrix<IssmDouble>* Jff){_error_("not implemented yet");};
+ 		void        Delta18oParameterization(void){_error_("not implemented yet");};
+ 		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){_error_("not implemented yet");};
+@@ -261,8 +259,6 @@
+ 		ElementMatrix* CreateMassMatrix(void);
+ 		ElementMatrix* CreateKMatrixFreeSurfaceTop(void);
+ 		ElementMatrix* CreateKMatrixFreeSurfaceBase(void);
+-		ElementVector* CreatePVectorFreeSurfaceTop(void);
+-		ElementVector* CreatePVectorFreeSurfaceBase(void);
+ 		IssmDouble     GetSize(void);
+ };
+ #endif  /* _SEG_H */
Index: issm/oecreview/Archive/16554-17801/ISSM-16982-16983.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16982-16983.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16982-16983.diff	(revision 17802)
@@ -0,0 +1,8 @@
+Index: ../trunk-jpl/test/Archives/Archive511.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive512.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-16983-16984.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16983-16984.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16983-16984.diff	(revision 17802)
@@ -0,0 +1,52 @@
+Index: ../trunk-jpl/test/NightlyRun/test3104.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test3104.py	(revision 16983)
++++ ../trunk-jpl/test/NightlyRun/test3104.py	(revision 16984)
+@@ -19,7 +19,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Vx','Vy','Vz','Vel','Pressure']
+-field_tolerances=[1e-08,1e-08,1e-07,1e-08,1e-08]
++field_tolerances=[1e-08,1e-08,2e-07,1e-08,1e-08]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Vx,\
+ 	md.results.StressbalanceSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test3004.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test3004.m	(revision 16983)
++++ ../trunk-jpl/test/NightlyRun/test3004.m	(revision 16984)
+@@ -11,7 +11,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure'};
+-field_tolerances={1e-08,1e-08,1e-07,1e-08,1e-08};
++field_tolerances={1e-08,1e-08,3e-07,1e-08,1e-08};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test3104.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test3104.m	(revision 16983)
++++ ../trunk-jpl/test/NightlyRun/test3104.m	(revision 16984)
+@@ -11,7 +11,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure'};
+-field_tolerances={1e-08,1e-08,1e-07,1e-08,1e-08};
++field_tolerances={1e-08,1e-08,2e-07,1e-08,1e-08};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test3004.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test3004.py	(revision 16983)
++++ ../trunk-jpl/test/NightlyRun/test3004.py	(revision 16984)
+@@ -19,7 +19,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Vx','Vy','Vz','Vel','Pressure']
+-field_tolerances=[1e-08,1e-08,1e-07,1e-08,1e-08]
++field_tolerances=[1e-08,1e-08,3e-07,1e-08,1e-08]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Vx,\
+ 	md.results.StressbalanceSolution.Vy,\
Index: issm/oecreview/Archive/16554-17801/ISSM-16984-16985.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16984-16985.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16984-16985.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/test/NightlyRun/temp291.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/temp291.m	(revision 0)
++++ ../trunk-jpl/test/NightlyRun/temp291.m	(revision 16985)
+@@ -0,0 +1,8 @@
++md=triangle(model(),'../Exp/Square.exp',150000.);
++md=setmask(md,'all','');
++md=parameterize(md,'../Par/SquareShelf.par');
++md=extrude(md,2,1.);
++md=setflowequation(md,'FS','all');
++md.flowequation.fe_FS='FINITELEMENTNAME';
++md.cluster=generic('name',oshostname(),'np',1);
++md=solve(md,StressbalanceSolutionEnum());
Index: issm/oecreview/Archive/16554-17801/ISSM-16985-16986.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16985-16986.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16985-16986.diff	(revision 17802)
@@ -0,0 +1,27 @@
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16985)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16986)
+@@ -235,7 +235,7 @@
+ 	if(stabilization==2) diameter=element->MinEdgeLength(xyz_list);
+ 
+ 	/*Enthalpy diffusion parameter*/
+-	IssmDouble kappa=this->EnthalpyDiffusionParameterVolume(element,EnthalpyEnum); _assert_(kappa>0.);
++	IssmDouble kappa=this->EnthalpyDiffusionParameterVolume(element,EnthalpyPicardEnum); _assert_(kappa>0.);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	Gauss* gauss=element->NewGauss(2);
+@@ -331,12 +331,10 @@
+ 	/*Initialize Element matrix and return if necessary*/
+ 	if(!element->IsOnBed() || !element->IsFloating()) return NULL;
+ 
++	/*Intermediaries*/
+ 	IssmDouble  dt,Jdet,D;
+ 	IssmDouble *xyz_list_base = NULL;
+ 
+-	/*Get basal element*/
+-	if(!element->IsOnBed() || !element->IsFloating()) return NULL;
+-
+ 	/*Fetch number of nodes for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16986-16987.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16986-16987.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16986-16987.diff	(revision 17802)
@@ -0,0 +1,20 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16986)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16987)
+@@ -1672,7 +1672,6 @@
+ 	xDelete<IssmDouble>(basis);
+ 	delete gauss;
+ 	return pe;
+-	return NULL;
+ }/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionL1L2(IssmDouble* solution,Element* element){/*{{{*/
+ 
+@@ -3084,7 +3083,6 @@
+ }/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSA3dFriction(Element* element){/*{{{*/
+ 
+-	return NULL;
+ 	/*Initialize Element matrix and return if necessary*/
+ 	if(element->IsFloating() || !element->IsOnBed()) return NULL;
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-16987-16988.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16987-16988.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16987-16988.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16987)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16988)
+@@ -3090,7 +3090,7 @@
+ 	 * the tria functionality to build a friction stiffness matrix on these 3
+ 	 * nodes: */
+ 	Element* basalelement = element->SpawnBasalElement();
+-	ElementMatrix* Ke=CreateKMatrixSSAFriction(element);
++	ElementMatrix* Ke=CreateKMatrixSSAFriction(basalelement);
+ 	basalelement->DeleteMaterials(); delete basalelement;
+ 
+ 	/*clean-up and return*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16988-16989.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16988-16989.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16988-16989.diff	(revision 17802)
@@ -0,0 +1,98 @@
+Index: ../trunk-jpl/src/c/bamg/Mesh.cpp
+===================================================================
+--- ../trunk-jpl/src/c/bamg/Mesh.cpp	(revision 16988)
++++ ../trunk-jpl/src/c/bamg/Mesh.cpp	(revision 16989)
+@@ -4100,7 +4100,7 @@
+ 	jj=0;
+ 	detop = det(*(*t)(VerticesOfTriangularEdge[jj][0]),*(*t)(VerticesOfTriangularEdge[jj][1]),B);
+ 
+-	while(t->det>0) { 
++	while(t->det>0){
+ 
+ 		/*Increase counter*/
+ 		if (++counter>=10000) _error_("Maximum number of iteration reached (threshold = " << counter << ").");
+Index: ../trunk-jpl/src/c/modules/Krigingx/pKrigingx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/Krigingx/pKrigingx.cpp	(revision 16988)
++++ ../trunk-jpl/src/c/modules/Krigingx/pKrigingx.cpp	(revision 16989)
+@@ -21,6 +21,7 @@
+ 
+ 	/*Intermediaries*/
+ 	int           mindata,maxdata;
++	double        dmindata,dmaxdata;
+ 	double        radius;
+ 	char         *output       = NULL;
+ 	Variogram    *variogram    = NULL;
+@@ -38,9 +39,10 @@
+ 	/*Get some Options*/
+ 	ISSM_MPI_Barrier(ISSM_MPI_COMM_WORLD); start=ISSM_MPI_Wtime();
+ 	options->Get(&radius,"searchradius",0.);
+-	options->Get(&mindata,"mindata",1);
+-	options->Get(&maxdata,"maxdata",50);
+ 
++	options->Get(&dmindata,"mindata",1.);  mindata=int(dmindata);//FIXME (Options come as double but we want to retrive integers)
++	options->Get(&dmaxdata,"maxdata",50.); maxdata=int(dmaxdata);//FIXME (Options come as double but we want to retrive integers)
++
+ 	/*Process observation dataset*/
+ 	ISSM_MPI_Barrier(ISSM_MPI_COMM_WORLD); start_init=ISSM_MPI_Wtime();
+ 	observations=new Observations(obs_list,obs_x,obs_y,obs_length,options);
+Index: ../trunk-jpl/src/c/classes/kriging/Quadtree.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/kriging/Quadtree.cpp	(revision 16988)
++++ ../trunk-jpl/src/c/classes/kriging/Quadtree.cpp	(revision 16989)
+@@ -236,12 +236,12 @@
+ 		}
+ 
+ 		/*We found the closest observation, now average observation (do not change xi and yi to avoid round off errors*/
+-		box->obs[index]->x = (box->obs[index]->weight*box->obs[index]->x + x)/(box->obs[index]->weight+1);
+-		box->obs[index]->y = (box->obs[index]->weight*box->obs[index]->y + y)/(box->obs[index]->weight+1);
+-		box->obs[index]->xi= int((box->obs[index]->weight*double(box->obs[index]->xi) + double(xi))/(box->obs[index]->weight+1));
+-		box->obs[index]->yi= int((box->obs[index]->weight*double(box->obs[index]->yi) + double(yi))/(box->obs[index]->weight+1));
+-		box->obs[index]->value   = (box->obs[index]->weight*box->obs[index]->value + value)/(box->obs[index]->weight+1);
+-		box->obs[index]->weight += 1;
++		box->obs[index]->x = (box->obs[index]->weight*box->obs[index]->x + x)/(box->obs[index]->weight+1.);
++		box->obs[index]->y = (box->obs[index]->weight*box->obs[index]->y + y)/(box->obs[index]->weight+1.);
++		box->obs[index]->xi= int((box->obs[index]->weight*double(box->obs[index]->xi) + double(xi))/(box->obs[index]->weight+1.));
++		box->obs[index]->yi= int((box->obs[index]->weight*double(box->obs[index]->yi) + double(yi))/(box->obs[index]->weight+1.));
++		box->obs[index]->value   = (box->obs[index]->weight*box->obs[index]->value + value)/(box->obs[index]->weight+1.);
++		box->obs[index]->weight += 1.;
+ 	}
+ 	else{
+ 		_error_("Box is not full");
+Index: ../trunk-jpl/src/c/classes/kriging/Observations.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/kriging/Observations.cpp	(revision 16988)
++++ ../trunk-jpl/src/c/classes/kriging/Observations.cpp	(revision 16989)
+@@ -201,7 +201,7 @@
+ 	Observation *observation  = NULL;
+ 
+ 	/*If radius is not provided or is 0, return all observations*/
+-	if(radius==0) radius=this->quadtree->root->length;
++	if(radius==0.) radius=this->quadtree->root->length;
+ 
+ 	/*Compute radius square*/
+ 	radius2 = radius*radius;
+@@ -213,12 +213,12 @@
+ 		dists   = xNew<IssmPDouble>(tempnobs);
+ 	}
+ 	nobs = 0;
+-	for (i=0;i<tempnobs;i++){
++	for(i=0;i<tempnobs;i++){
+ 		observation=dynamic_cast<Observation*>(this->GetObjectByOffset(tempindices[i]));
+ 		h2 = (observation->x-x_interp)*(observation->x-x_interp) + (observation->y-y_interp)*(observation->y-y_interp);
+ 
+ 		if(nobs==maxdata && h2>radius2) continue;
+-		if(nobs<=maxdata){
++		if(nobs<maxdata){
+ 			indices[nobs]   = tempindices[i];
+ 			dists[nobs]     = h2;
+ 			nobs++;
+@@ -255,7 +255,7 @@
+ 		obs = xNew<IssmPDouble>(nobs);
+ 
+ 		/*Loop over all observations and fill in x, y and obs*/
+-		for (i=0;i<nobs;i++){
++		for(i=0;i<nobs;i++){
+ 			observation=dynamic_cast<Observation*>(this->GetObjectByOffset(indices[i]));
+ 			observation->WriteXYObs(&x[i],&y[i],&obs[i]);
+ 		}
Index: issm/oecreview/Archive/16554-17801/ISSM-16989-16990.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16989-16990.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16989-16990.diff	(revision 17802)
@@ -0,0 +1,29 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16989)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16990)
+@@ -3198,11 +3198,23 @@
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSAHO(Element* element){/*{{{*/
+ 
+ 	/*compute all stiffness matrices for this element*/
+-	ElementMatrix* Ke1=CreateKMatrixSSA(element);
++	ElementMatrix* Ke1=CreateKMatrixSSA3d(element);
+ 	ElementMatrix* Ke2=CreateKMatrixHO(element);
+ 	ElementMatrix* Ke3=CreateKMatrixCouplingSSAHO(element);
+ 	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2,Ke3);
+ 
++	//Ke2=element->CreateKMatrix();
++	//for(int i=0;i<12;i++){
++	//	for(int j=0;j<12;j++){
++	//		if(Ke->values[i*12+j] != Ke2->values[i*12+j]){
++	//			Ke->Echo();
++	//			Ke2->Echo();
++	//			printf("ID = %i\n",element->Id());
++	//			_error_("S");
++	//		}
++	//	}
++	//}
++
+ 	/*clean-up and return*/
+ 	delete Ke1;
+ 	delete Ke2;
Index: issm/oecreview/Archive/16554-17801/ISSM-16990-16991.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16990-16991.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16990-16991.diff	(revision 17802)
@@ -0,0 +1,23 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16990)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16991)
+@@ -3203,18 +3203,6 @@
+ 	ElementMatrix* Ke3=CreateKMatrixCouplingSSAHO(element);
+ 	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2,Ke3);
+ 
+-	//Ke2=element->CreateKMatrix();
+-	//for(int i=0;i<12;i++){
+-	//	for(int j=0;j<12;j++){
+-	//		if(Ke->values[i*12+j] != Ke2->values[i*12+j]){
+-	//			Ke->Echo();
+-	//			Ke2->Echo();
+-	//			printf("ID = %i\n",element->Id());
+-	//			_error_("S");
+-	//		}
+-	//	}
+-	//}
+-
+ 	/*clean-up and return*/
+ 	delete Ke1;
+ 	delete Ke2;
Index: issm/oecreview/Archive/16554-17801/ISSM-16991-16992.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16991-16992.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16991-16992.diff	(revision 17802)
@@ -0,0 +1,700 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h	(revision 16992)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix2D(Element* element);
+ 		ElementMatrix* CreateKMatrix3D(Element* element);
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 16992)
+@@ -81,6 +81,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementMatrix* HydrologyShreveAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
+ ElementMatrix* HydrologyShreveAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries */
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp	(revision 16992)
+@@ -25,6 +25,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementMatrix* BalancethicknessSoftAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
+ ElementMatrix* BalancethicknessSoftAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 	_error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16992)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 16992)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 16992)
+@@ -113,6 +113,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementMatrix* BalancethicknessAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
+ ElementMatrix* BalancethicknessAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	if(!element->IsOnBed()) return NULL;
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.h	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.h	(revision 16992)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrixVolume(Element* element);
+ 		ElementMatrix* CreateKMatrixShelf(Element* element);
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 16992)
+@@ -95,6 +95,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementMatrix* HydrologyDCEfficientAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
+ ElementMatrix* HydrologyDCEfficientAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h	(revision 16992)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrixVolume(Element* element);
+ 		ElementMatrix* CreateKMatrixSurface(Element* element);
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 16992)
+@@ -25,6 +25,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementMatrix* AdjointHorizAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
+ ElementMatrix* AdjointHorizAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 	int approximation;
+ 	element->GetInputValue(&approximation,ApproximationEnum);
+Index: ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 16992)
+@@ -58,6 +58,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementMatrix* BalancevelocityAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
+ ElementMatrix* BalancevelocityAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries */
+Index: ../trunk-jpl/src/c/analyses/MeltingAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeltingAnalysis.h	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/MeltingAnalysis.h	(revision 16992)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/GiaAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/GiaAnalysis.h	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/GiaAnalysis.h	(revision 16992)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 16992)
+@@ -54,6 +54,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementMatrix* L2ProjectionBaseAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
+ ElementMatrix* L2ProjectionBaseAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 16992)
+@@ -87,6 +87,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementMatrix* FreeSurfaceTopAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
+ ElementMatrix* FreeSurfaceTopAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 	_error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h	(revision 16992)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h	(revision 16992)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 16992)
+@@ -95,6 +95,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementMatrix* StressbalanceVerticalAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
+ ElementMatrix* StressbalanceVerticalAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/*compute all stiffness matrices for this element*/
+Index: ../trunk-jpl/src/c/analyses/Analysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/Analysis.h	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/Analysis.h	(revision 16992)
+@@ -32,6 +32,7 @@
+ 		virtual void CreateLoads(Loads* loads, IoModel* iomodel)=0;
+ 
+ 		/*Finite element Analysis*/
++		virtual ElementMatrix* CreateJacobianMatrix(Element* element)=0;
+ 		virtual ElementMatrix* CreateKMatrix(Element* element)=0;
+ 		virtual ElementVector* CreatePVector(Element* element)=0;
+ 		virtual void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element)=0;
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h	(revision 16992)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrixCG(Element* element);
+ 		ElementMatrix* CreateKMatrixDG(Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 16992)
+@@ -134,6 +134,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementMatrix* StressbalanceSIAAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
+ ElementMatrix* StressbalanceSIAAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 	int meshtype;
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h	(revision 16992)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16992)
+@@ -811,6 +811,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementMatrix* StressbalanceAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 	int approximation;
+ 	element->GetInputValue(&approximation,ApproximationEnum);
+Index: ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h	(revision 16992)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h	(revision 16992)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrixVolume(Element* element);
+ 		ElementMatrix* CreateKMatrixShelf(Element* element);
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h	(revision 16992)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h	(revision 16992)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16992)
+@@ -136,6 +136,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementMatrix* HydrologyDCInefficientAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
+ ElementMatrix* HydrologyDCInefficientAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16992)
+@@ -111,6 +111,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementMatrix* ThermalAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
+ ElementMatrix* ThermalAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/*compute all stiffness matrices for this element*/
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h	(revision 16992)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h	(revision 16992)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 16992)
+@@ -36,6 +36,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementMatrix* ExtrudeFromBaseAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
+ ElementMatrix* ExtrudeFromBaseAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/*compute all stiffness matrices for this element*/
+Index: ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 16992)
+@@ -71,6 +71,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementMatrix* MeltingAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
+ ElementMatrix* MeltingAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/*Get basal element*/
+Index: ../trunk-jpl/src/c/analyses/GiaAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/GiaAnalysis.cpp	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/GiaAnalysis.cpp	(revision 16992)
+@@ -37,6 +37,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementMatrix* GiaAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
+ ElementMatrix* GiaAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 	_error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h	(revision 16992)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h	(revision 16992)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h	(revision 16992)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrixCG(Element* element);
+ 		ElementMatrix* CreateKMatrixDG(Element* element);
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 16992)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h	(revision 16992)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrixSSA(Element* element);
+ 		ElementMatrix* CreateKMatrixHO(Element* element);
+Index: ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h	(revision 16992)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 16992)
+@@ -25,6 +25,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementMatrix* AdjointBalancethicknessAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
+ ElementMatrix* AdjointBalancethicknessAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	BalancethicknessAnalysis* analysis = new BalancethicknessAnalysis();
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h	(revision 16992)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 16992)
+@@ -69,6 +69,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementMatrix* L2ProjectionEPLAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
+ ElementMatrix* L2ProjectionEPLAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+Index: ../trunk-jpl/src/c/analyses/EnumToAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnumToAnalysis.h	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/EnumToAnalysis.h	(revision 16992)
+@@ -15,6 +15,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16992)
+@@ -211,6 +211,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementMatrix* MasstransportAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
+ ElementMatrix* MasstransportAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	if(!element->IsOnBed()) return NULL;
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h	(revision 16992)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 16992)
+@@ -94,6 +94,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementMatrix* DamageEvolutionAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
+ ElementMatrix* DamageEvolutionAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16992)
+@@ -183,6 +183,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementMatrix* EnthalpyAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
+ ElementMatrix* EnthalpyAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/*compute all stiffness matrices for this element*/
+Index: ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp	(revision 16992)
+@@ -25,6 +25,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementMatrix* MeshdeformationAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
+ ElementMatrix* MeshdeformationAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 	_error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 16992)
+@@ -89,6 +89,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementMatrix* FreeSurfaceBaseAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
+ ElementMatrix* FreeSurfaceBaseAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 	_error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 16992)
+@@ -44,6 +44,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementMatrix* SmoothedSurfaceSlopeXAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
+ ElementMatrix* SmoothedSurfaceSlopeXAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/* Intermediaries */
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 16992)
+@@ -36,6 +36,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementMatrix* ExtrudeFromTopAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
+ ElementMatrix* ExtrudeFromTopAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 	_error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 16992)
+@@ -44,6 +44,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementMatrix* SmoothedSurfaceSlopeYAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
+ ElementMatrix* SmoothedSurfaceSlopeYAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/* Intermediaries */
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h	(revision 16991)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h	(revision 16992)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrixVolume(Element* element);
+ 		ElementMatrix* CreateKMatrixSurface(Element* element);
Index: issm/oecreview/Archive/16554-17801/ISSM-16992-16993.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16992-16993.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16992-16993.diff	(revision 17802)
@@ -0,0 +1,5384 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16992)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16993)
+@@ -28,6 +28,7 @@
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ 
+ 		/*SSA*/
++		ElementMatrix* CreateJacobianMatrixSSA(Element* element);
+ 		ElementMatrix* CreateKMatrixSSA(Element* element);
+ 		ElementMatrix* CreateKMatrixSSAViscous(Element* element);
+ 		ElementMatrix* CreateKMatrixSSAFriction(Element* element);
+@@ -47,6 +48,7 @@
+ 		ElementVector* CreatePVectorL1L2Front(Element* element);
+ 		void InputUpdateFromSolutionL1L2(IssmDouble* solution,Element* element);
+ 		/*HO*/
++		ElementMatrix* CreateJacobianMatrixHO(Element* element);
+ 		ElementMatrix* CreateKMatrixHO(Element* element);
+ 		ElementMatrix* CreateKMatrixHOViscous(Element* element);
+ 		ElementMatrix* CreateKMatrixHOFriction(Element* element);
+@@ -58,6 +60,7 @@
+ 		void GetBHOFriction(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void InputUpdateFromSolutionHO(IssmDouble* solution,Element* element);
+ 		/*FS*/
++		ElementMatrix* CreateJacobianMatrixFS(Element* element);
+ 		ElementMatrix* CreateKMatrixFS(Element* element);
+ 		ElementMatrix* CreateKMatrixFSViscous(Element* element);
+ 		ElementMatrix* CreateKMatrixFSFriction(Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16992)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16993)
+@@ -812,7 +812,21 @@
+ 
+ /*Finite Element Analysis*/
+ ElementMatrix* StressbalanceAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+-_error_("Not implemented");
++
++	int approximation;
++	element->GetInputValue(&approximation,ApproximationEnum);
++	switch(approximation){
++		case SSAApproximationEnum: 
++			return CreateJacobianMatrixSSA(element);
++		case HOApproximationEnum: 
++			return CreateJacobianMatrixHO(element);
++		case FSApproximationEnum: 
++			return CreateJacobianMatrixFS(element);
++		case NoneApproximationEnum:
++			return NULL;
++		default:
++			_error_("Approximation "<<EnumToStringx(approximation)<<" not supported");
++	}
+ }/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 	int approximation;
+@@ -960,6 +974,89 @@
+ }/*}}}*/
+ 
+ /*SSA*/
++ElementMatrix* StressbalanceAnalysis::CreateJacobianMatrixSSA(Element* element){/*{{{*/
++
++	/*Intermediaries*/
++	int      meshtype;
++	Element* basalelement;
++
++	/*Get basal element*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Intermediaries */
++	IssmDouble Jdet,thickness;
++	IssmDouble eps1dotdphii,eps1dotdphij;
++	IssmDouble eps2dotdphii,eps2dotdphij;
++	IssmDouble mu_prime;
++	IssmDouble epsilon[3];/* epsilon=[exx,eyy,exy];*/
++	IssmDouble eps1[2],eps2[2];
++	IssmDouble *xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = basalelement->GetNumberOfNodes();
++
++	/*Initialize Element matrix, vectors and Gaussian points*/
++	ElementMatrix* Ke=this->CreateKMatrixSSA(element); //Initialize Jacobian with regular SSA (first part of the Gateau derivative)
++	IssmDouble*    dbasis = xNew<IssmDouble>(2*numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	Input* thickness_input = basalelement->GetInput(ThicknessEnum);_assert_(thickness_input);
++	Input* vx_input        = basalelement->GetInput(VxEnum);       _assert_(vx_input);
++	Input* vy_input        = basalelement->GetInput(VyEnum);       _assert_(vy_input);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss = basalelement->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		basalelement->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++		thickness_input->GetInputValue(&thickness, gauss);
++		basalelement->StrainRateSSA(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
++		basalelement->ViscositySSADerivativeEpsSquare(&mu_prime,&epsilon[0]);
++		eps1[0]=2*epsilon[0]+epsilon[1];   eps2[0]=epsilon[2];
++		eps1[1]=epsilon[2];                eps2[1]=epsilon[0]+2*epsilon[1];
++
++		for(int i=0;i<numnodes;i++){
++			for(int j=0;j<numnodes;j++){
++				eps1dotdphii=eps1[0]*dbasis[0*numnodes+i]+eps1[1]*dbasis[1*numnodes+i];
++				eps1dotdphij=eps1[0]*dbasis[0*numnodes+j]+eps1[1]*dbasis[1*numnodes+j];
++				eps2dotdphii=eps2[0]*dbasis[0*numnodes+i]+eps2[1]*dbasis[1*numnodes+i];
++				eps2dotdphij=eps2[0]*dbasis[0*numnodes+j]+eps2[1]*dbasis[1*numnodes+j];
++
++				Ke->values[2*numnodes*(2*i+0)+2*j+0]+=gauss->weight*Jdet*2.*mu_prime*thickness*eps1dotdphij*eps1dotdphii;
++				Ke->values[2*numnodes*(2*i+0)+2*j+1]+=gauss->weight*Jdet*2.*mu_prime*thickness*eps2dotdphij*eps1dotdphii;
++				Ke->values[2*numnodes*(2*i+1)+2*j+0]+=gauss->weight*Jdet*2.*mu_prime*thickness*eps1dotdphij*eps2dotdphii;
++				Ke->values[2*numnodes*(2*i+1)+2*j+1]+=gauss->weight*Jdet*2.*mu_prime*thickness*eps2dotdphij*eps2dotdphii;
++			}
++		}
++	}
++
++	/*Transform Coordinate System*/
++	basalelement->TransformStiffnessMatrixCoord(Ke,XYEnum);
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(dbasis);
++
++	/*clean-up and return*/
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	return Ke;
++
++}/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSA(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+@@ -1777,6 +1874,67 @@
+ }/*}}}*/
+ 
+ /*HO*/
++ElementMatrix* StressbalanceAnalysis::CreateJacobianMatrixHO(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	IssmDouble Jdet;
++	IssmDouble eps1dotdphii,eps1dotdphij;
++	IssmDouble eps2dotdphii,eps2dotdphij;
++	IssmDouble mu_prime;
++	IssmDouble epsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/
++	IssmDouble eps1[3],eps2[3];
++	IssmDouble *xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element matrix, vectors and Gaussian points*/
++	ElementMatrix* Ke=this->CreateKMatrixHO(element); //Initialize Jacobian with regular HO (first part of the Gateau derivative)
++	IssmDouble*    dbasis = xNew<IssmDouble>(3*numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	Input* vx_input = element->GetInput(VxEnum); _assert_(vx_input);
++	Input* vy_input = element->GetInput(VyEnum); _assert_(vy_input);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss = element->NewGauss(5);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++		element->StrainRateHO(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
++		element->ViscosityHODerivativeEpsSquare(&mu_prime,&epsilon[0]);
++		eps1[0]=2*epsilon[0]+epsilon[1];   eps2[0]=epsilon[2];
++		eps1[1]=epsilon[2];                eps2[1]=epsilon[0]+2*epsilon[1];
++		eps1[2]=epsilon[3];                eps2[2]=epsilon[4];
++
++		for(int i=0;i<numnodes;i++){
++			for(int j=0;j<numnodes;j++){
++				eps1dotdphii=eps1[0]*dbasis[0*numnodes+i]+eps1[1]*dbasis[1*numnodes+i]+eps1[2]*dbasis[2*numnodes+i];
++				eps1dotdphij=eps1[0]*dbasis[0*numnodes+j]+eps1[1]*dbasis[1*numnodes+j]+eps1[2]*dbasis[2*numnodes+j];
++				eps2dotdphii=eps2[0]*dbasis[0*numnodes+i]+eps2[1]*dbasis[1*numnodes+i]+eps2[2]*dbasis[2*numnodes+i];
++				eps2dotdphij=eps2[0]*dbasis[0*numnodes+j]+eps2[1]*dbasis[1*numnodes+j]+eps2[2]*dbasis[2*numnodes+j];
++
++				Ke->values[2*numnodes*(2*i+0)+2*j+0]+=gauss->weight*Jdet*2.*mu_prime*eps1dotdphij*eps1dotdphii;
++				Ke->values[2*numnodes*(2*i+0)+2*j+1]+=gauss->weight*Jdet*2.*mu_prime*eps2dotdphij*eps1dotdphii;
++				Ke->values[2*numnodes*(2*i+1)+2*j+0]+=gauss->weight*Jdet*2.*mu_prime*eps1dotdphij*eps2dotdphii;
++				Ke->values[2*numnodes*(2*i+1)+2*j+1]+=gauss->weight*Jdet*2.*mu_prime*eps2dotdphij*eps2dotdphii;
++			}
++		}
++	}
++
++	/*Transform Coordinate System*/
++	element->TransformStiffnessMatrixCoord(Ke,XYEnum);
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(dbasis);
++	return Ke;
++}/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixHO(Element* element){/*{{{*/
+ 
+ 	/*compute all stiffness matrices for this element*/
+@@ -2218,6 +2376,91 @@
+ }/*}}}*/
+ 
+ /*FS*/
++ElementMatrix* StressbalanceAnalysis::CreateJacobianMatrixFS(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	int        i,j;
++	IssmDouble Jdet;
++	IssmDouble eps1dotdphii,eps1dotdphij;
++	IssmDouble eps2dotdphii,eps2dotdphij;
++	IssmDouble eps3dotdphii,eps3dotdphij;
++	IssmDouble mu_prime;
++	IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
++	IssmDouble eps1[3],eps2[3],eps3[3];
++	IssmDouble *xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int vnumnodes = element->GetNumberOfNodesVelocity();
++	int pnumnodes = element->GetNumberOfNodesPressure();
++	int numdof    = vnumnodes*NDOF3 + pnumnodes*NDOF1;
++
++	/*Prepare coordinate system list*/
++	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
++	for(i=0;i<vnumnodes;i++) cs_list[i]           = XYZEnum;
++	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
++
++	/*Initialize Element matrix, vectors and Gaussian points*/
++	ElementMatrix* Ke=this->CreateKMatrixFS(element); //Initialize Jacobian with regular FS (first part of the Gateau derivative)
++	IssmDouble*    dbasis = xNew<IssmDouble>(3*vnumnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	Input* vx_input = element->GetInput(VxEnum); _assert_(vx_input);
++	Input* vy_input = element->GetInput(VyEnum); _assert_(vy_input);
++	Input* vz_input = element->GetInput(VzEnum); _assert_(vz_input);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss = element->NewGauss(5);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctionsDerivativesVelocity(dbasis,xyz_list,gauss);
++
++		//element->StrainRateFS(&epsilon[0],xyz_list,gauss,vx_input,vy_input,vz_input);
++		//eps1[0]=epsilon[0];   eps2[0]=epsilon[3];   eps3[0]=epsilon[4];
++		//eps1[1]=epsilon[3];   eps2[1]=epsilon[1];   eps3[1]=epsilon[5];
++		//eps1[2]=epsilon[4];   eps2[2]=epsilon[5];   eps3[2]=epsilon[2];
++		element->StrainRateHO(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
++		eps1[0]=epsilon[0];   eps2[0]=epsilon[2];   eps3[0]=epsilon[3];
++		eps1[1]=epsilon[2];   eps2[1]=epsilon[1];   eps3[1]=epsilon[4];
++		eps1[2]=epsilon[3];   eps2[2]=epsilon[4];   eps3[2]= -epsilon[0] -epsilon[1];
++		element->ViscosityFSDerivativeEpsSquare(&mu_prime,&epsilon[0]);
++
++		for(i=0;i<vnumnodes;i++){
++			for(j=0;j<vnumnodes;j++){
++				eps1dotdphii=eps1[0]*dbasis[0*vnumnodes+i]+eps1[1]*dbasis[1*vnumnodes+i]+eps1[2]*dbasis[2*vnumnodes+i];
++				eps1dotdphij=eps1[0]*dbasis[0*vnumnodes+j]+eps1[1]*dbasis[1*vnumnodes+j]+eps1[2]*dbasis[2*vnumnodes+j];
++				eps2dotdphii=eps2[0]*dbasis[0*vnumnodes+i]+eps2[1]*dbasis[1*vnumnodes+i]+eps2[2]*dbasis[2*vnumnodes+i];
++				eps2dotdphij=eps2[0]*dbasis[0*vnumnodes+j]+eps2[1]*dbasis[1*vnumnodes+j]+eps2[2]*dbasis[2*vnumnodes+j];
++				eps3dotdphii=eps3[0]*dbasis[0*vnumnodes+i]+eps3[1]*dbasis[1*vnumnodes+i]+eps3[2]*dbasis[2*vnumnodes+i];
++				eps3dotdphij=eps3[0]*dbasis[0*vnumnodes+j]+eps3[1]*dbasis[1*vnumnodes+j]+eps3[2]*dbasis[2*vnumnodes+j];
++
++				Ke->values[numdof*(3*i+0)+3*j+0]+=gauss->weight*Jdet*2*mu_prime*eps1dotdphij*eps1dotdphii;
++				Ke->values[numdof*(3*i+0)+3*j+1]+=gauss->weight*Jdet*2*mu_prime*eps2dotdphij*eps1dotdphii;
++				Ke->values[numdof*(3*i+0)+3*j+2]+=gauss->weight*Jdet*2*mu_prime*eps3dotdphij*eps1dotdphii;
++
++				Ke->values[numdof*(3*i+1)+3*j+0]+=gauss->weight*Jdet*2*mu_prime*eps1dotdphij*eps2dotdphii;
++				Ke->values[numdof*(3*i+1)+3*j+1]+=gauss->weight*Jdet*2*mu_prime*eps2dotdphij*eps2dotdphii;
++				Ke->values[numdof*(3*i+1)+3*j+2]+=gauss->weight*Jdet*2*mu_prime*eps3dotdphij*eps2dotdphii;
++
++				Ke->values[numdof*(3*i+2)+3*j+0]+=gauss->weight*Jdet*2*mu_prime*eps1dotdphij*eps3dotdphii;
++				Ke->values[numdof*(3*i+2)+3*j+1]+=gauss->weight*Jdet*2*mu_prime*eps2dotdphij*eps3dotdphii;
++				Ke->values[numdof*(3*i+2)+3*j+2]+=gauss->weight*Jdet*2*mu_prime*eps3dotdphij*eps3dotdphii;
++			}
++		}
++	}
++
++	/*Transform Coordinate System*/
++	element->TransformStiffnessMatrixCoord(Ke,cs_list);
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(dbasis);
++	xDelete<int>(cs_list);
++	return Ke;
++}/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixFS(Element* element){/*{{{*/
+ 
+ 	/*compute all stiffness matrices for this element*/
+Index: ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 16992)
++++ ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 16993)
+@@ -40,8 +40,7 @@
+ 		/*Get complete stiffness matrix without penalties*/
+ 		for (i=0;i<femmodel->elements->Size();i++){
+ 			element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+-			ElementMatrix* Ke = element->CreateKMatrix();
+-			//ElementVector* pe = element->CreatePVector();
++			ElementMatrix* Ke = analysis->CreateKMatrix(element);
+ 			ElementVector* pe = analysis->CreatePVector(element);
+ 			element->ReduceMatrices(Ke,pe);
+ 			if(Ke) Ke->AddToGlobal(Kff_temp,NULL);
+@@ -72,9 +71,7 @@
+ 	/*Fill stiffness matrix and load vector from elements*/
+ 	for (i=0;i<femmodel->elements->Size();i++){
+ 		element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+-		ElementMatrix* Ke = element->CreateKMatrix();
+-		//ElementMatrix* Ke = analysis->CreateKMatrix(element);
+-		//ElementVector* pe = element->CreatePVector();
++		ElementMatrix* Ke = analysis->CreateKMatrix(element);
+ 		ElementVector* pe = analysis->CreatePVector(element);
+ 		element->ReduceMatrices(Ke,pe);
+ 		if(Ke) Ke->AddToGlobal(Kff,Kfs);
+Index: ../trunk-jpl/src/c/modules/CreateJacobianMatrixx/CreateJacobianMatrixx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/CreateJacobianMatrixx/CreateJacobianMatrixx.cpp	(revision 16992)
++++ ../trunk-jpl/src/c/modules/CreateJacobianMatrixx/CreateJacobianMatrixx.cpp	(revision 16993)
+@@ -9,8 +9,8 @@
+ 
+ void CreateJacobianMatrixx(Matrix<IssmDouble>** pJff,FemModel* femmodel,IssmDouble kmax){
+ 
+-	int      i,connectivity;
+-	int      configuration_type;
++	int      i;
++	int      configuration_type,analysisenum;
+ 	Element *element = NULL;
+ 	Load    *load    = NULL;
+ 	Matrix<IssmDouble>* Jff = NULL;
+@@ -20,7 +20,8 @@
+ 
+ 	/*Recover some parameters*/
+ 	femmodel->parameters->FindParam(&configuration_type,ConfigurationTypeEnum);
+-	femmodel->parameters->FindParam(&connectivity,MeshAverageVertexConnectivityEnum);
++	femmodel->parameters->FindParam(&analysisenum,AnalysisTypeEnum);
++	Analysis* analysis = EnumToAnalysis(analysisenum);
+ 
+ 	/*Initialize Jacobian Matrix*/
+ 	AllocateSystemMatricesx(&Jff,NULL,NULL,NULL,femmodel);
+@@ -28,7 +29,9 @@
+ 	/*Create and assemble matrix*/
+ 	for(i=0;i<femmodel->elements->Size();i++){
+ 		element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+-		element->CreateJacobianMatrix(Jff);
++		ElementMatrix* Je = analysis->CreateJacobianMatrix(element);
++		if(Je) Je->AddToGlobal(Jff);
++		delete Je;
+ 	}
+ 	for (i=0;i<femmodel->loads->Size();i++){
+ 		load=(Load*)femmodel->loads->GetObjectByOffset(i);
+@@ -38,6 +41,7 @@
+ 	Jff->Assemble();
+ 
+ 	/*Assign output pointer*/
++	delete analysis;
+ 	*pJff=Jff;
+ 
+ }
+Index: ../trunk-jpl/src/c/modules/CreateJacobianMatrixx/CreateJacobianMatrixx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/CreateJacobianMatrixx/CreateJacobianMatrixx.h	(revision 16992)
++++ ../trunk-jpl/src/c/modules/CreateJacobianMatrixx/CreateJacobianMatrixx.h	(revision 16993)
+@@ -5,6 +5,7 @@
+ #define _CREATEJACOBIANMATRIXX_H
+ 
+ #include "../../classes/classes.h"
++#include "../../analyses/analyses.h"
+ 
+ /* local prototypes: */
+ void CreateJacobianMatrixx(Matrix<IssmDouble>** pJff,FemModel* femmodel,IssmDouble kmax);
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16992)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 16993)
+@@ -103,9 +103,7 @@
+ 		virtual void       Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters)=0;
+ 		virtual void       SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters)=0;
+ 		virtual void       SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum)=0;
+-		virtual ElementMatrix* CreateKMatrix(void)=0;
+ 		virtual void   CreateDVector(Vector<IssmDouble>* df)=0;
+-		virtual void   CreateJacobianMatrix(Matrix<IssmDouble>* Jff)=0;
+ 		virtual void   ElementSizes(IssmDouble* phx,IssmDouble* phy,IssmDouble* phz)=0;
+ 		virtual void   EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure)=0;
+ 		virtual IssmDouble EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16992)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16993)
+@@ -190,222 +190,12 @@
+ 	return sqrt(2*this->GetArea());
+ }
+ /*}}}*/
+-/*FUNCTION Tria::CreateKMatrix(void) {{{*/
+-ElementMatrix* Tria::CreateKMatrix(void){
+-
+-	/*retreive parameters: */
+-	int analysis_type;
+-	int meshtype;
+-	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-
+-	/*Checks in debugging mode{{{*/
+-	_assert_(this->nodes && this->material && this->matpar && this->parameters && this->inputs);
+-	/*}}}*/
+-
+-	/*Skip if water element*/
+-	if(NoIceInElement()) return NULL;
+-
+-	/*Just branch to the correct element stiffness matrix generator, according to the type of analysis we are carrying out: */
+-	switch(analysis_type){
+-		#ifdef _HAVE_STRESSBALANCE_
+-		case StressbalanceAnalysisEnum:
+-			int approximation;
+-			inputs->GetInputValue(&approximation,ApproximationEnum);
+-			switch(approximation){
+-				case SSAApproximationEnum:
+-					return CreateKMatrixStressbalanceSSA();
+-				case FSApproximationEnum:
+-					return CreateKMatrixStressbalanceFS();
+-				case SIAApproximationEnum:
+-					return NULL;
+-				case NoneApproximationEnum:
+-					return NULL;
+-				default:
+-					_error_("Approximation " << EnumToStringx(approximation) << " not supported yet");
+-			}
+-			break;
+-		case StressbalanceSIAAnalysisEnum:
+-			return CreateKMatrixStressbalanceSIA();
+-			break;
+-		#endif
+-	 	#ifdef _HAVE_DAMAGE_
+-		case DamageEvolutionAnalysisEnum:
+-			return CreateKMatrixDamageEvolution();
+-			break;
+-		#endif
+-		case L2ProjectionBaseAnalysisEnum:
+-			parameters->FindParam(&meshtype,MeshTypeEnum);
+-			if(meshtype==Mesh2DverticalEnum){
+-				return CreateBasalMassMatrix();
+-			}
+-			else{
+-				return CreateMassMatrix();
+-			}
+-			break;
+-		#ifdef _HAVE_MASSTRANSPORT_
+-		case MasstransportAnalysisEnum:
+-			return CreateKMatrixMasstransport();
+-			break;
+-		case FreeSurfaceTopAnalysisEnum:
+-			parameters->FindParam(&meshtype,MeshTypeEnum);
+-			switch(meshtype){
+-				case Mesh2DverticalEnum:
+-					return CreateKMatrixFreeSurfaceTop1D();
+-				case Mesh3DEnum:
+-					return CreateKMatrixFreeSurfaceTop();
+-				default:
+-					_error_("Mesh not supported yet");
+-			}
+-			break;
+-		case FreeSurfaceBaseAnalysisEnum:
+-			parameters->FindParam(&meshtype,MeshTypeEnum);
+-			switch(meshtype){
+-				case Mesh2DverticalEnum:
+-					return CreateKMatrixFreeSurfaceBase1D();
+-				case Mesh3DEnum:
+-					return CreateKMatrixFreeSurfaceBase();
+-				default:
+-					_error_("Mesh not supported yet");
+-			}
+-			break;
+-		case ExtrudeFromBaseAnalysisEnum: case ExtrudeFromTopAnalysisEnum:
+-			return CreateKMatrixExtrusion();
+-		#endif
+-		#ifdef _HAVE_HYDROLOGY_
+-		case HydrologyShreveAnalysisEnum:
+-			return CreateKMatrixHydrologyShreve();
+-			break;
+-		case HydrologyDCInefficientAnalysisEnum:
+-			return CreateKMatrixHydrologyDCInefficient();
+-			break;
+-		case HydrologyDCEfficientAnalysisEnum:
+-			return CreateKMatrixHydrologyDCEfficient();
+-			break;
+-	  case L2ProjectionEPLAnalysisEnum:
+-			return CreateEPLDomainMassMatrix();
+-			break;
+-		#endif
+-		#ifdef _HAVE_BALANCED_
+-		case BalancethicknessAnalysisEnum:
+-			return CreateKMatrixBalancethickness();
+-			break;
+-		case BalancevelocityAnalysisEnum:
+-			return CreateKMatrixBalancevelocity();
+-			break;
+-		case SmoothedSurfaceSlopeXAnalysisEnum: case SmoothedSurfaceSlopeYAnalysisEnum:
+-			return CreateKMatrixSmoothedSlope();
+-			break;
+-		#endif
+-		#ifdef _HAVE_CONTROL_
+-		case AdjointBalancethicknessAnalysisEnum:
+-			return CreateKMatrixAdjointBalancethickness();
+-			break;
+-		case AdjointHorizAnalysisEnum:
+-			return CreateKMatrixAdjointSSA();
+-			break;
+-		#endif
+-		default:
+-			_error_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet");
+-	}
+-
+-	/*Make compiler happy*/
+-	return NULL;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreateMassMatrix {{{*/
+-ElementMatrix* Tria::CreateMassMatrix(void){
+-
+-	/* Intermediaries */
+-	IssmDouble  D,Jdet;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke    = new ElementMatrix(nodes,numnodes,this->parameters,NoneApproximationEnum);
+-	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-
+-	/* Start looping on the number of gaussian points: */
+-	GaussTria* gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetNodalFunctions(basis,gauss);
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		D=gauss->weight*Jdet;
+-
+-		TripleMultiply(basis,1,numnodes,1,
+-					&D,1,1,0,
+-					basis,1,numnodes,0,
+-					&Ke->values[0],1);
+-	}
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	xDelete<IssmDouble>(basis);
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreateBasalMassMatrix{{{*/
+-ElementMatrix* Tria::CreateBasalMassMatrix(void){
+-
+-	if(!HasEdgeOnBed()) return NULL;
+-
+-	int index1,index2;
+-	this->EdgeOnBedIndices(&index1,&index2);
+-
+-	Seg* seg=(Seg*)SpawnSeg(index1,index2); 
+-	ElementMatrix* Ke=seg->CreateMassMatrix();
+-	delete seg->material; delete seg;
+-
+-	/*clean up and return*/
+-	return Ke;
+-}
+-/*}}}*/
+ /*FUNCTION Tria::CreateDVector {{{*/
+ void  Tria::CreateDVector(Vector<IssmDouble>* df){
+ 
+ 	/*Nothing done yet*/
+ }
+ /*}}}*/
+-/*FUNCTION Tria::CreateJacobianMatrix{{{*/
+-void  Tria::CreateJacobianMatrix(Matrix<IssmDouble>* Jff){
+-
+-	/*retrieve parameters: */
+-	ElementMatrix* Ke=NULL;
+-	int analysis_type;
+-	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-
+-	/*Checks in debugging {{{*/
+-	_assert_(this->nodes && this->material && this->matpar && this->parameters && this->inputs);
+-	/*}}}*/
+-
+-	/*Skip if water element*/
+-	if(NoIceInElement()) return;
+-
+-	/*Just branch to the correct element stiffness matrix generator, according to the type of analysis we are carrying out: */
+-	switch(analysis_type){
+-#ifdef _HAVE_STRESSBALANCE_
+-		case StressbalanceAnalysisEnum:
+-			Ke=CreateJacobianStressbalanceSSA();
+-			break;
+-#endif
+-		default:
+-			_error_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet");
+-	}
+-
+-	/*Add to global matrix*/
+-	if(Ke){
+-		Ke->AddToGlobal(Jff);
+-		delete Ke;
+-	}
+-}
+-/*}}}*/
+ /*FUNCTION Tria::ComputeBasalStress {{{*/
+ void  Tria::ComputeBasalStress(Vector<IssmDouble>* eps){
+ 	_error_("Not Implemented yet");
+@@ -3272,419 +3062,6 @@
+ #endif
+ 
+ #ifdef _HAVE_STRESSBALANCE_
+-/*FUNCTION Tria::CreateKMatrixStressbalanceFS{{{*/
+-ElementMatrix* Tria::CreateKMatrixStressbalanceFS(void){
+-
+-	ElementMatrix* Ke1 = NULL;
+-	ElementMatrix* Ke2 = NULL;
+-	ElementMatrix* Ke  = NULL;
+-
+-	/*compute all stiffness matrices for this element*/
+-	Ke1=CreateKMatrixStressbalanceFSViscous();
+-	Ke2=CreateKMatrixStressbalanceFSFriction();
+-	Ke =new ElementMatrix(Ke1,Ke2);
+-
+-	/*clean-up and return*/
+-	delete Ke1;
+-	delete Ke2;
+-	return Ke;
+-
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreateKMatrixStressbalanceFSViscous {{{*/
+-ElementMatrix* Tria::CreateKMatrixStressbalanceFSViscous(void){
+-
+-	/*Intermediaries */
+-	int        i,approximation;
+-	IssmDouble Jdet,viscosity,FSreconditioning,D_scalar;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble epsilon[3]; /* epsilon=[exx,eyy,exy];*/
+-	GaussTria *gauss=NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumnodes = this->NumberofNodesPressure();
+-	int numdof    = vnumnodes*NDOF2 + pnumnodes*NDOF1;
+-
+-	/*Prepare coordinate system list*/
+-	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+-	for(i=0;i<vnumnodes;i++) cs_list[i]           = XYEnum;
+-	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke     = new ElementMatrix(nodes,vnumnodes+pnumnodes,this->parameters,FSvelocityEnum);
+-	IssmDouble*    B      = xNew<IssmDouble>(5*numdof);
+-	IssmDouble*    Bprime = xNew<IssmDouble>(5*numdof);
+-	IssmDouble*    D      = xNewZeroInit<IssmDouble>(5*5);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussTria(5);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetBFS(B,&xyz_list[0][0],gauss); 
+-		GetBprimeFS(Bprime,&xyz_list[0][0],gauss); 
+-
+-		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+-		material->GetViscosity2dvertical(&viscosity,&epsilon[0]);
+-
+-		D_scalar=gauss->weight*Jdet;
+-		for(i=0;i<3;i++) D[i*5+i] = +D_scalar*2.*viscosity;
+-		for(i=3;i<5;i++) D[i*5+i] = -D_scalar*FSreconditioning;
+-
+-		TripleMultiply(B,5,numdof,1,
+-					D,5,5,0,
+-					Bprime,5,numdof,0,
+-					Ke->values,1);
+-	}
+-
+-	/*Transform Coordinate System*/
+-	::TransformStiffnessMatrixCoord(Ke,nodes,(vnumnodes+pnumnodes),cs_list);
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	xDelete<int>(cs_list);
+-	xDelete<IssmDouble>(B);
+-	xDelete<IssmDouble>(Bprime);
+-	xDelete<IssmDouble>(D);
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreateKMatrixStressbalanceFSFriction{{{*/
+-ElementMatrix* Tria::CreateKMatrixStressbalanceFSFriction(void){
+-
+-	/*Intermediaries */
+-	int         i,j;
+-	int         analysis_type;
+-	int         indices[2];
+-	IssmDouble  alpha2,Jdet;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble  xyz_list_seg[NUMVERTICES1D][3];
+-	Friction   *friction = NULL;
+-
+-	/*Initialize Element matrix and return if necessary*/
+-	if(IsFloating() || !HasEdgeOnBed()) return NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumnodes = this->NumberofNodesPressure();
+-	int  numdof   = vnumnodes*NDOF2 + pnumnodes*NDOF1;
+-
+-	/*Prepare coordinate system list*/
+-	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+-	for(i=0;i<vnumnodes;i++) cs_list[i]           = XYEnum;
+-	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke        = new ElementMatrix(nodes,vnumnodes+pnumnodes,this->parameters,FSvelocityEnum);
+-	IssmDouble*    BFriction = xNew<IssmDouble>(1*numdof);
+-	IssmDouble     D;
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+-
+-	/*Get vertex indices that lie on bed*/
+-	this->EdgeOnBedIndices(&indices[0],&indices[1]);
+-	for(i=0;i<NUMVERTICES1D;i++) for(j=0;j<2;j++) xyz_list_seg[i][j]=xyz_list[indices[i]][j];
+-
+-	/*build friction object, used later on: */
+-	friction=new Friction(this,1);
+-
+-	/* Start looping on the number of gauss 1d (nodes on the bedrock) */
+-	GaussTria* gauss=new GaussTria(indices[0],indices[1],3);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetSegmentJacobianDeterminant(&Jdet,&xyz_list_seg[0][0],gauss);
+-		GetLFS(BFriction,gauss);
+-
+-		friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,NULL);
+-		D = +alpha2*gauss->weight*Jdet; //taub_x = -alpha2 vx
+-
+-		TripleMultiply(BFriction,1,numdof,1,
+-					&D,1,1,0,
+-					BFriction,1,numdof,0,
+-					Ke->values,1);
+-	}
+-
+-	/*DO NOT Transform Coordinate System: this stiffness matrix is already expressed in tangential coordinates*/
+-	//::TransformStiffnessMatrixCoord(Ke,nodes,(vnumnodes+pnumnodes),cs_list);
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	delete friction;
+-	xDelete<IssmDouble>(BFriction);
+-	xDelete<int>(cs_list);
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreateKMatrixStressbalanceSSA {{{*/
+-ElementMatrix* Tria::CreateKMatrixStressbalanceSSA(void){
+-
+-	/*compute all stiffness matrices for this element*/
+-	ElementMatrix* Ke1=CreateKMatrixStressbalanceSSAViscous();
+-	ElementMatrix* Ke2=CreateKMatrixStressbalanceSSAFriction();
+-	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
+-
+-	/*clean-up and return*/
+-	delete Ke1;
+-	delete Ke2;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreateKMatrixStressbalanceSSAViscous{{{*/
+-ElementMatrix* Tria::CreateKMatrixStressbalanceSSAViscous(void){
+-
+-	/*Intermediaries*/
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble viscosity,newviscosity,oldviscosity;
+-	IssmDouble viscosity_overshoot,thickness,Jdet;
+-	IssmDouble epsilon[3],oldepsilon[3];    /* epsilon=[exx,eyy,exy];    */
+-	IssmDouble D_scalar;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-	int numdof   = numnodes*NDOF2;
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke     = new ElementMatrix(nodes,numnodes,this->parameters,SSAApproximationEnum);
+-	IssmDouble*    B      = xNew<IssmDouble>(3*numdof);
+-	IssmDouble*    Bprime = xNew<IssmDouble>(3*numdof);
+-	IssmDouble*    D      = xNewZeroInit<IssmDouble>(3*3);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* thickness_input=inputs->GetInput(ThicknessEnum); _assert_(thickness_input);
+-	Input* vx_input=inputs->GetInput(VxEnum);               _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);               _assert_(vy_input);
+-	Input* vxold_input=inputs->GetInput(VxPicardEnum);      _assert_(vxold_input);
+-	Input* vyold_input=inputs->GetInput(VyPicardEnum);      _assert_(vyold_input);
+-	this->parameters->FindParam(&viscosity_overshoot,StressbalanceViscosityOvershootEnum);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	GaussTria* gauss  = new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetBSSA(&B[0], &xyz_list[0][0], gauss);
+-		GetBprimeSSA(&Bprime[0], &xyz_list[0][0], gauss);
+-
+-		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+-		this->StrainRateSSA(&oldepsilon[0],&xyz_list[0][0],gauss,vxold_input,vyold_input);
+-		material->GetViscosity2d(&viscosity, &epsilon[0]);
+-		material->GetViscosity2d(&oldviscosity, &oldepsilon[0]);
+-		thickness_input->GetInputValue(&thickness, gauss);
+-
+-		newviscosity=viscosity+viscosity_overshoot*(viscosity-oldviscosity);
+-		D_scalar=2.*newviscosity*thickness*gauss->weight*Jdet;
+-		for(int i=0;i<3;i++) D[i*3+i]=D_scalar;
+-
+-		TripleMultiply(B,3,numdof,1,
+-					D,3,3,0,
+-					Bprime,3,numdof,0,
+-					&Ke->values[0],1);
+-	}
+-
+-	/*Transform Coordinate System*/
+-	::TransformStiffnessMatrixCoord(Ke,nodes,numnodes,XYEnum);
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	xDelete<IssmDouble>(D);
+-	xDelete<IssmDouble>(Bprime);
+-	xDelete<IssmDouble>(B);
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreateKMatrixStressbalanceSSAFriction {{{*/
+-ElementMatrix* Tria::CreateKMatrixStressbalanceSSAFriction(void){
+-
+-	/*Intermediaries*/
+-	bool       mainlyfloating;
+-	int        analysis_type,migration_style;
+-	int        point1;
+-	IssmDouble alpha2,Jdet;
+-	IssmDouble fraction1,fraction2;
+-	IssmDouble phi=1.0;
+-	IssmDouble D_scalar;
+-	IssmDouble gllevelset;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	Friction  *friction = NULL;
+-	GaussTria *gauss    = NULL;
+-
+-	/*Return if element is inactive*/
+-	if(IsFloating()) return NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-	int numdof   = numnodes*NDOF2;
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke     = new ElementMatrix(nodes,numnodes,this->parameters,SSAApproximationEnum);
+-	IssmDouble*    B      = xNew<IssmDouble>(2*numdof);
+-	IssmDouble*    D      = xNewZeroInit<IssmDouble>(2*2);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	parameters->FindParam(&migration_style,GroundinglineMigrationEnum);
+-	Input* surface_input=inputs->GetInput(SurfaceEnum);       _assert_(surface_input);
+-	Input* vx_input=inputs->GetInput(VxEnum);                 _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);                 _assert_(vy_input);
+-	Input* gllevelset_input=NULL;
+-	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-
+-	/*build friction object, used later on: */
+-	friction=new Friction(this,2);
+-
+-	/*Recover portion of element that is grounded*/
+-	if(migration_style==SubelementMigrationEnum) phi=this->GetGroundedPortion(&xyz_list[0][0]);
+-	if(migration_style==SubelementMigration2Enum){
+-		gllevelset_input=inputs->GetInput(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input);
+-		this->GetGroundedPart(&point1,&fraction1,&fraction2,&mainlyfloating);
+-		gauss=new GaussTria(point1,fraction1,fraction2,mainlyfloating,2);
+-	}
+-	else{
+-		gauss=new GaussTria(2);
+-	}
+-
+-	/* Start  looping on the number of gaussian points: */
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		friction->GetAlpha2(&alpha2, gauss,vx_input,vy_input,NULL);
+-		if(migration_style==SubelementMigrationEnum) alpha2=phi*alpha2;
+-		if(migration_style==SubelementMigration2Enum){
+-			gllevelset_input->GetInputValue(&gllevelset, gauss);
+-			if(gllevelset<0) alpha2=0;
+-		}
+-
+-		GetBSSAFriction(&B[0], &xyz_list[0][0], gauss);
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		D_scalar=alpha2*gauss->weight*Jdet;
+-		for(int i=0;i<2;i++) D[i*2+i]=D_scalar;
+-
+-		TripleMultiply(B,2,numdof,1,
+-					D,2,2,0,
+-					B,2,numdof,0,
+-					&Ke->values[0],1);
+-	}
+-
+-	/*Transform Coordinate System*/
+-	::TransformStiffnessMatrixCoord(Ke,nodes,numnodes,XYEnum);
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	delete friction;
+-	xDelete<IssmDouble>(D);
+-	xDelete<IssmDouble>(B);
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreateKMatrixStressbalanceSIA{{{*/
+-ElementMatrix* Tria::CreateKMatrixStressbalanceSIA(void){
+-
+-	/*Intermediaries*/
+-	IssmDouble connectivity;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes(); _assert_(numnodes==3); 
+-	int numdof   = numnodes*NDOF2;
+-
+-	/*Initialize Element matrix*/
+-	ElementMatrix* Ke=new ElementMatrix(nodes,numnodes,this->parameters,NoneApproximationEnum);
+-
+-	/*Create Element matrix*/
+-	for(int i=0;i<numnodes;i++){
+-		connectivity=(IssmDouble)vertices[i]->Connectivity();
+-		Ke->values[(2*i+0)*numdof+(2*i+0)]=1./connectivity;
+-		Ke->values[(2*i+1)*numdof+(2*i+1)]=1./connectivity;
+-	}
+-
+-	/*Clean up and return*/
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreateJacobianStressbalanceSSA{{{*/
+-ElementMatrix* Tria::CreateJacobianStressbalanceSSA(void){
+-
+-	/*Intermediaries */
+-	int        i,j;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble Jdet,thickness;
+-	IssmDouble eps1dotdphii,eps1dotdphij;
+-	IssmDouble eps2dotdphii,eps2dotdphij;
+-	IssmDouble mu_prime;
+-	IssmDouble epsilon[3];/* epsilon=[exx,eyy,exy];*/
+-	IssmDouble eps1[2],eps2[2];
+-	GaussTria* gauss = NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element matrix, vectors and Gaussian points*/
+-	ElementMatrix* Ke=CreateKMatrixStressbalanceSSA(); //Initialize Jacobian with regular SSA (first part of the Gateau derivative)
+-	IssmDouble*    dbasis = xNew<IssmDouble>(2*numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* vx_input=inputs->GetInput(VxEnum);       _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);       _assert_(vy_input);
+-	Input* thickness_input=inputs->GetInput(ThicknessEnum); _assert_(thickness_input);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctionsDerivatives(dbasis,&xyz_list[0][0],gauss);
+-
+-		thickness_input->GetInputValue(&thickness, gauss);
+-		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+-		material->GetViscosity2dDerivativeEpsSquare(&mu_prime,&epsilon[0]);
+-		eps1[0]=2*epsilon[0]+epsilon[1];   eps2[0]=epsilon[2];
+-		eps1[1]=epsilon[2];                eps2[1]=epsilon[0]+2*epsilon[1];
+-
+-		for(i=0;i<numnodes;i++){
+-			for(j=0;j<numnodes;j++){
+-				eps1dotdphii=eps1[0]*dbasis[0*numnodes+i]+eps1[1]*dbasis[1*numnodes+i];
+-				eps1dotdphij=eps1[0]*dbasis[0*numnodes+j]+eps1[1]*dbasis[1*numnodes+j];
+-				eps2dotdphii=eps2[0]*dbasis[0*numnodes+i]+eps2[1]*dbasis[1*numnodes+i];
+-				eps2dotdphij=eps2[0]*dbasis[0*numnodes+j]+eps2[1]*dbasis[1*numnodes+j];
+-
+-				Ke->values[2*numnodes*(2*i+0)+2*j+0]+=gauss->weight*Jdet*2*mu_prime*thickness*eps1dotdphij*eps1dotdphii;
+-				Ke->values[2*numnodes*(2*i+0)+2*j+1]+=gauss->weight*Jdet*2*mu_prime*thickness*eps2dotdphij*eps1dotdphii;
+-				Ke->values[2*numnodes*(2*i+1)+2*j+0]+=gauss->weight*Jdet*2*mu_prime*thickness*eps1dotdphij*eps2dotdphii;
+-				Ke->values[2*numnodes*(2*i+1)+2*j+1]+=gauss->weight*Jdet*2*mu_prime*thickness*eps2dotdphij*eps2dotdphii;
+-			}
+-		}
+-	}
+-
+-	/*Transform Coordinate System*/
+-	::TransformStiffnessMatrixCoord(Ke,nodes,numnodes,XYEnum);
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(dbasis);
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+ /*FUNCTION Tria::GetYcoord {{{*/
+ IssmDouble Tria::GetYcoord(GaussTria* gauss){
+ 
+@@ -5036,100 +4413,6 @@
+ 	return Jelem;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::CreateKMatrixAdjointBalancethickness {{{*/
+-ElementMatrix* Tria::CreateKMatrixAdjointBalancethickness(void){
+-
+-	ElementMatrix* Ke=NULL;
+-
+-	/*Get Element Matrix of the forward model*/
+-	switch(GetElementType()){
+-		case P1Enum:
+-			Ke=CreateKMatrixBalancethickness_CG();
+-			break;
+-		case P1DGEnum:
+-			Ke=CreateKMatrixBalancethickness_DG();
+-			break;
+-		default:
+-			_error_("Element type " << EnumToStringx(GetElementType()) << " not supported yet");
+-	}
+-
+-	/*Transpose and return Ke*/
+-	Ke->Transpose();
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreateKMatrixAdjointSSA{{{*/
+-ElementMatrix* Tria::CreateKMatrixAdjointSSA(void){
+-
+-	/*Intermediaries */
+-	int         i,j;
+-	bool        incomplete_adjoint;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble  Jdet,thickness;
+-	IssmDouble  eps1dotdphii,eps1dotdphij;
+-	IssmDouble  eps2dotdphii,eps2dotdphij;
+-	IssmDouble  mu_prime;
+-	IssmDouble  epsilon[3];/* epsilon=[exx,eyy,exy];*/
+-	IssmDouble  eps1[2],eps2[2];
+-	GaussTria  *gauss=NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Jacobian with regular SSA (first part of the Gateau derivative)*/
+-	parameters->FindParam(&incomplete_adjoint,InversionIncompleteAdjointEnum);
+-	ElementMatrix* Ke=CreateKMatrixStressbalanceSSA();
+-	if(incomplete_adjoint) return Ke;
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* vx_input=inputs->GetInput(VxEnum);       _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);       _assert_(vy_input);
+-	Input* thickness_input=inputs->GetInput(ThicknessEnum); _assert_(thickness_input);
+-
+-	/*Allocate dbasis*/
+-	IssmDouble* dbasis = xNew<IssmDouble>(2*numnodes);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctionsDerivatives(dbasis,&xyz_list[0][0],gauss);
+-
+-		thickness_input->GetInputValue(&thickness, gauss);
+-		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+-		material->GetViscosity2dDerivativeEpsSquare(&mu_prime,&epsilon[0]);
+-		eps1[0]=2*epsilon[0]+epsilon[1];   eps2[0]=epsilon[2];
+-		eps1[1]=epsilon[2];                eps2[1]=epsilon[0]+2*epsilon[1];
+-
+-		for(i=0;i<numnodes;i++){
+-			for(j=0;j<numnodes;j++){
+-				eps1dotdphii=eps1[0]*dbasis[0*numnodes+i]+eps1[1]*dbasis[1*numnodes+i];
+-				eps1dotdphij=eps1[0]*dbasis[0*numnodes+j]+eps1[1]*dbasis[1*numnodes+j];
+-				eps2dotdphii=eps2[0]*dbasis[0*numnodes+i]+eps2[1]*dbasis[1*numnodes+i];
+-				eps2dotdphij=eps2[0]*dbasis[0*numnodes+j]+eps2[1]*dbasis[1*numnodes+j];
+-
+-				Ke->values[2*numnodes*(2*i+0)+2*j+0]+=gauss->weight*Jdet*2*mu_prime*thickness*eps1dotdphij*eps1dotdphii;
+-				Ke->values[2*numnodes*(2*i+0)+2*j+1]+=gauss->weight*Jdet*2*mu_prime*thickness*eps2dotdphij*eps1dotdphii;
+-				Ke->values[2*numnodes*(2*i+1)+2*j+0]+=gauss->weight*Jdet*2*mu_prime*thickness*eps1dotdphij*eps2dotdphii;
+-				Ke->values[2*numnodes*(2*i+1)+2*j+1]+=gauss->weight*Jdet*2*mu_prime*thickness*eps2dotdphij*eps2dotdphii;
+-			}
+-		}
+-	}
+-
+-	/*Transform Coordinate System*/
+-	::TransformStiffnessMatrixCoord(Ke,nodes,numnodes,XYEnum);
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	xDelete<IssmDouble>(dbasis);
+-	//Ke->Transpose();
+-	return Ke;
+-}
+-/*}}}*/
+ /*FUNCTION Tria::GetVectorFromControlInputs{{{*/
+ void  Tria::GetVectorFromControlInputs(Vector<IssmDouble>* vector,int control_enum,int control_index,const char* data){
+ 
+@@ -5194,52 +4477,6 @@
+ /*}}}*/
+ #endif
+ 
+-#ifdef _HAVE_THERMAL_
+-/*FUNCTION Tria::CreateKMatrixMelting {{{*/
+-ElementMatrix* Tria::CreateKMatrixMelting(void){
+-
+-	/*Intermediaries */
+-	IssmDouble heatcapacity,latentheat;
+-	IssmDouble Jdet,D_scalar;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element vector and vectors*/
+-	ElementMatrix* Ke=new ElementMatrix(nodes,numnodes,this->parameters,NoneApproximationEnum);
+-	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	latentheat   = matpar->GetLatentHeat();
+-	heatcapacity = matpar->GetHeatCapacity();
+-
+-	/* Start looping on the number of gauss  (nodes on the bedrock) */
+-	GaussTria* gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetNodalFunctions(&basis[0],gauss);
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0], gauss);
+-
+-		D_scalar=latentheat/heatcapacity*gauss->weight*Jdet;
+-
+-		TripleMultiply(basis,numnodes,1,0,
+-					&D_scalar,1,1,0,
+-					basis,1,numnodes,0,
+-					&Ke->values[0],1);
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+-#endif
+-
+ #ifdef _HAVE_HYDROLOGY_
+ /*FUNCTION Tria::CreateHydrologyWaterVelocityInput {{{*/
+ void Tria::CreateHydrologyWaterVelocityInput(void){
+@@ -5295,236 +4532,6 @@
+ 	this->inputs->AddInput(new TriaInput(HydrologyWaterVyEnum,vy,P1Enum));
+ }
+ /*}}}*/
+-/*FUNCTION Tria::CreateKMatrixHydrologyShreve{{{*/
+-ElementMatrix* Tria::CreateKMatrixHydrologyShreve(void){
+-
+-	/*Intermediaries */
+-	IssmDouble diffusivity;
+-	IssmDouble Jdet,D_scalar,dt,h;
+-	IssmDouble vx,vy,vel,dvxdx,dvydy;
+-	IssmDouble dvx[2],dvy[2];
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-
+-	/*Skip if water or ice shelf element*/
+-	if(NoIceInElement() || IsFloating()) return NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke     = new ElementMatrix(nodes,numnodes,this->parameters,NoneApproximationEnum);
+-	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+-	IssmDouble*    B      = xNew<IssmDouble>(2*numnodes);
+-	IssmDouble*    Bprime = xNew<IssmDouble>(2*numnodes);
+-	IssmDouble     D[2][2];
+-
+-	/*Create water velocity vx and vy from current inputs*/
+-	CreateHydrologyWaterVelocityInput();
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	this->parameters->FindParam(&diffusivity,HydrologyshreveStabilizationEnum);
+-	Input* vx_input=inputs->GetInput(HydrologyWaterVxEnum); _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(HydrologyWaterVyEnum); _assert_(vy_input);
+-	h=sqrt(2*this->GetArea());
+-
+-	/* Start  looping on the number of gaussian points: */
+-	GaussTria* gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis,gauss);
+-
+-		vx_input->GetInputValue(&vx,gauss);
+-		vy_input->GetInputValue(&vy,gauss);
+-		vx_input->GetInputDerivativeValue(&dvx[0],&xyz_list[0][0],gauss);
+-		vy_input->GetInputDerivativeValue(&dvy[0],&xyz_list[0][0],gauss);
+-
+-		D_scalar=gauss->weight*Jdet;
+-
+-		TripleMultiply(basis,1,numnodes,1,
+-					&D_scalar,1,1,0,
+-					basis,1,numnodes,0,
+-					Ke->values,1);
+-
+-		GetBMasstransport(B,&xyz_list[0][0], gauss);
+-		GetBprimeMasstransport(Bprime,&xyz_list[0][0], gauss);
+-
+-		dvxdx=dvx[0];
+-		dvydy=dvy[1];
+-		D_scalar=dt*gauss->weight*Jdet;
+-
+-		D[0][0]=D_scalar*dvxdx;
+-		D[0][1]=0.;
+-		D[1][0]=0.;
+-		D[1][1]=D_scalar*dvydy;
+-		TripleMultiply(B,2,numnodes,1,
+-					&D[0][0],2,2,0,
+-					B,2,numnodes,0,
+-					&Ke->values[0],1);
+-
+-		D[0][0]=D_scalar*vx;
+-		D[1][1]=D_scalar*vy;
+-		TripleMultiply(B,2,numnodes,1,
+-					&D[0][0],2,2,0,
+-					Bprime,2,numnodes,0,
+-					&Ke->values[0],1);
+-
+-		/*Artificial diffusivity*/
+-		vel=sqrt(vx*vx+vy*vy);
+-		D[0][0]=D_scalar*diffusivity*h/(2*vel)*vx*vx;
+-		D[1][0]=D_scalar*diffusivity*h/(2*vel)*vy*vx;
+-		D[0][1]=D_scalar*diffusivity*h/(2*vel)*vx*vy;
+-		D[1][1]=D_scalar*diffusivity*h/(2*vel)*vy*vy;
+-		TripleMultiply(Bprime,2,numnodes,1,
+-					&D[0][0],2,2,0,
+-					Bprime,2,numnodes,0,
+-					&Ke->values[0],1);
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	xDelete<IssmDouble>(B);
+-	xDelete<IssmDouble>(Bprime);
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreateKMatrixHydrologyDCInefficient{{{*/
+-ElementMatrix* Tria::CreateKMatrixHydrologyDCInefficient(void){
+-
+-	/* Intermediaries */
+-	IssmDouble  D_scalar,Jdet;
+-	IssmDouble 	sediment_transmitivity,dt;
+-	IssmDouble  sediment_storing;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke     = new ElementMatrix(nodes,numnodes,this->parameters);
+-	IssmDouble*    B      = xNew<IssmDouble>(5*numnodes);
+-	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+-	IssmDouble     D[2][2];
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	sediment_storing       = matpar->GetSedimentStoring();
+-	sediment_transmitivity = matpar->GetSedimentTransmitivity();
+-
+-	/* Start looping on the number of gaussian points: */
+-	GaussTria* gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-
+-		/*Diffusivity*/
+-		D_scalar=sediment_transmitivity*gauss->weight*Jdet;
+-		if(reCast<bool,IssmDouble>(dt)) D_scalar=D_scalar*dt;
+-		D[0][0]=D_scalar; D[0][1]=0.;
+-		D[1][0]=0.;       D[1][1]=D_scalar;
+-		GetBHydro(B,&xyz_list[0][0],gauss); 
+-		TripleMultiply(B,2,numnodes,1,
+-					&D[0][0],2,2,0,
+-					B,2,numnodes,0,
+-					&Ke->values[0],1);
+-
+-		/*Transient*/
+-		if(reCast<bool,IssmDouble>(dt)){
+-			GetNodalFunctions(&basis[0],gauss);
+-			D_scalar=sediment_storing*gauss->weight*Jdet;
+-
+-			TripleMultiply(basis,numnodes,1,0,
+-						&D_scalar,1,1,0,
+-						basis,1,numnodes,0,
+-						&Ke->values[0],1);
+-		}
+-	}
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	xDelete<IssmDouble>(B);
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreateKMatrixHydrologyDCEfficient{{{*/
+-ElementMatrix* Tria::CreateKMatrixHydrologyDCEfficient(void){
+-
+-	/* Intermediaries */
+-	IssmDouble  D_scalar,Jdet,dt;
+-	IssmDouble  epl_thickness;
+-	IssmDouble 	epl_conductivity;
+-	IssmDouble  epl_specificstoring;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-
+-	/*Check that all nodes are active, else return empty matrix*/
+-	if(!this->AllActive()){
+-		return NULL;
+-	}
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke     = new ElementMatrix(nodes,numnodes,this->parameters);
+-	IssmDouble*    B      = xNew<IssmDouble>(5*numnodes);
+-	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+-	IssmDouble     D[2][2];
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* thickness_input=inputs->GetInput(HydrologydcEplThicknessEnum); _assert_(thickness_input);
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	epl_specificstoring = matpar->GetEplSpecificStoring();
+-	epl_conductivity    = matpar->GetEplConductivity();
+-
+-
+-	/* Start looping on the number of gaussian points: */
+-	GaussTria* gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-		
+-		
+-		gauss->GaussPoint(ig);
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		thickness_input->GetInputValue(&epl_thickness,gauss);
+-
+-		/*Diffusivity*/
+-		D_scalar=epl_conductivity*epl_thickness*gauss->weight*Jdet;
+-		if(reCast<bool,IssmDouble>(dt)) D_scalar=D_scalar*dt;
+-		D[0][0]=D_scalar; D[0][1]=0.;
+-		D[1][0]=0.;       D[1][1]=D_scalar;
+-		GetBHydro(B,&xyz_list[0][0],gauss); 
+-		TripleMultiply(B,2,numnodes,1,
+-					&D[0][0],2,2,0,
+-					B,2,numnodes,0,
+-					&Ke->values[0],1);
+-
+-		/*Transient*/
+-		if(reCast<bool,IssmDouble>(dt)){
+-			GetNodalFunctions(basis,gauss);
+-			D_scalar=epl_specificstoring*epl_thickness*gauss->weight*Jdet;
+-
+-			TripleMultiply(basis,numnodes,1,0,
+-						&D_scalar,1,1,0,
+-						basis,1,numnodes,0,
+-						&Ke->values[0],1);
+-		}
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	xDelete<IssmDouble>(B);
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+ /*FUNCTION Tria::CreatEPLDomainMassMatrix {{{*/
+ ElementMatrix* Tria::CreateEPLDomainMassMatrix(void){
+ 
+@@ -5897,732 +4904,7 @@
+ /*}}}*/
+ #endif
+ 
+-#ifdef _HAVE_MASSTRANSPORT_
+-/*FUNCTION Tria::CreateKMatrixExtrusion {{{*/
+-ElementMatrix* Tria::CreateKMatrixExtrusion(void){
+-
+-	/*compute all stiffness matrices for this element*/
+-	ElementMatrix* Ke1=CreateKMatrixExtrusionVolume();
+-	ElementMatrix* Ke2=CreateKMatrixExtrusionSurface();
+-	ElementMatrix* Ke3=CreateKMatrixExtrusionBed();
+-	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2,Ke3);
+-
+-	/*clean-up and return*/
+-	delete Ke1;
+-	delete Ke2;
+-	delete Ke3;
+-	return Ke;
+-
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreateKMatrixExtrusionVolume {{{*/
+-ElementMatrix* Tria::CreateKMatrixExtrusionVolume(void){
+-
+-	/*Intermediaries */
+-	IssmDouble  Jdet;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble  B[NDOF1][NUMVERTICES];
+-	IssmDouble  Bprime[NDOF1][NUMVERTICES];
+-	IssmDouble  DL_scalar;
+-	GaussTria  *gauss=NULL;
+-
+-	/*Initialize Element matrix*/
+-	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetBExtrusion(&B[0][0], &xyz_list[0][0], gauss);
+-		GetNodalFunctions(&Bprime[0][0],gauss);
+-
+-		DL_scalar=gauss->weight*Jdet;
+-
+-		TripleMultiply(&B[0][0],1,NUMVERTICES,1,
+-					&DL_scalar,1,1,0,
+-					&Bprime[0][0],1,NUMVERTICES,0,
+-					&Ke->values[0],1);
+-	} 
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreateKMatrixExtrusionSurface {{{*/
+-ElementMatrix* Tria::CreateKMatrixExtrusionSurface(void){
+-
+-	if (!HasEdgeOnSurface()) return NULL;
+-
+-	/*Constants*/
+-	const int numdof=NDOF1*NUMVERTICES;
+-
+-	/*Intermediaries */
+-	int indices[2];
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble xyz_list_seg[NUMVERTICES1D][3];
+-	IssmDouble normal[3];
+-	IssmDouble Jdet,DL_scalar;
+-	IssmDouble basis[NUMVERTICES];
+-	GaussTria *gauss=NULL;
+-
+-	/*Initialize Element matrix*/
+-	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-
+-	/*Get vertex indices that lie on bed*/
+-	this->EdgeOnSurfaceIndices(&indices[0],&indices[1]);
+-	for(int i=0;i<NUMVERTICES1D;i++) for(int j=0;j<2;j++) xyz_list_seg[i][j]=xyz_list[indices[i]][j];
+-	NormalSection(&normal[0],&xyz_list_seg[0][0]);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussTria(indices[0],indices[1],2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetSegmentJacobianDeterminant(&Jdet,&xyz_list_seg[0][0],gauss);
+-		GetNodalFunctions(&basis[0], gauss);
+-
+-		DL_scalar= - gauss->weight*Jdet*normal[1]; 
+-
+-		TripleMultiply( basis,1,numdof,1,
+-					&DL_scalar,1,1,0,
+-					basis,1,numdof,0,
+-					&Ke->values[0],1);
+-	}
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreateKMatrixExtrusionBed {{{*/
+-ElementMatrix* Tria::CreateKMatrixExtrusionBed(void){
+-
+-	if (!HasEdgeOnBed()) return NULL;
+-
+-	/*Constants*/
+-	const int numdof=NDOF1*NUMVERTICES;
+-
+-	/*Intermediaries */
+-	int indices[2];
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble xyz_list_seg[NUMVERTICES1D][3];
+-	IssmDouble normal[3];
+-	IssmDouble Jdet,DL_scalar;
+-	IssmDouble basis[NUMVERTICES];
+-	GaussTria *gauss=NULL;
+-
+-	/*Initialize Element matrix*/
+-	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-
+-	/*Get vertex indices that lie on bed*/
+-	this->EdgeOnBedIndices(&indices[0],&indices[1]);
+-	for(int i=0;i<NUMVERTICES1D;i++) for(int j=0;j<2;j++) xyz_list_seg[i][j]=xyz_list[indices[i]][j];
+-	NormalSection(&normal[0],&xyz_list_seg[0][0]);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussTria(indices[0],indices[1],2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetSegmentJacobianDeterminant(&Jdet,&xyz_list_seg[0][0],gauss);
+-		GetNodalFunctions(&basis[0], gauss);
+-
+-		DL_scalar= - gauss->weight*Jdet*normal[1]; 
+-
+-		TripleMultiply( basis,1,numdof,1,
+-					&DL_scalar,1,1,0,
+-					basis,1,numdof,0,
+-					&Ke->values[0],1);
+-	}
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreateKMatrixMasstransport {{{*/
+-ElementMatrix* Tria::CreateKMatrixMasstransport(void){
+-
+-	switch(GetElementType()){
+-		case P1Enum: case P2Enum:
+-			return CreateKMatrixMasstransport_CG();
+-		case P1DGEnum:
+-			return CreateKMatrixMasstransport_DG();
+-		default:
+-			_error_("Element type " << EnumToStringx(GetElementType()) << " not supported yet");
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreateKMatrixMasstransport_CG {{{*/
+-ElementMatrix* Tria::CreateKMatrixMasstransport_CG(void){
+-
+-	/*Intermediaries */
+-	int        stabilization;
+-	int        meshtype;
+-	IssmDouble Jdet,D_scalar,dt,h;
+-	IssmDouble vel,vx,vy,dvxdx,dvydy;
+-	IssmDouble dvx[2],dvy[2];
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke     = new ElementMatrix(nodes,numnodes,this->parameters,NoneApproximationEnum);
+-	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+-	IssmDouble*    B      = xNew<IssmDouble>(2*numnodes);
+-	IssmDouble*    Bprime = xNew<IssmDouble>(2*numnodes);
+-	IssmDouble     D[2][2];
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	this->parameters->FindParam(&meshtype,MeshTypeEnum);
+-	this->parameters->FindParam(&stabilization,MasstransportStabilizationEnum);
+-	Input* vxaverage_input=NULL;
+-	Input* vyaverage_input=NULL;
+-	if(meshtype==Mesh2DhorizontalEnum){
+-		vxaverage_input=inputs->GetInput(VxEnum); _assert_(vxaverage_input);
+-		vyaverage_input=inputs->GetInput(VyEnum); _assert_(vyaverage_input);
+-	}
+-	else{
+-		vxaverage_input=inputs->GetInput(VxAverageEnum); _assert_(vxaverage_input);
+-		vyaverage_input=inputs->GetInput(VyAverageEnum); _assert_(vyaverage_input);
+-	}
+-	h=sqrt(2*this->GetArea());
+-
+-	/* Start  looping on the number of gaussian points: */
+-	GaussTria *gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis,gauss);
+-
+-		vxaverage_input->GetInputValue(&vx,gauss);
+-		vyaverage_input->GetInputValue(&vy,gauss);
+-		vxaverage_input->GetInputDerivativeValue(&dvx[0],&xyz_list[0][0],gauss);
+-		vyaverage_input->GetInputDerivativeValue(&dvy[0],&xyz_list[0][0],gauss);
+-
+-		D_scalar=gauss->weight*Jdet;
+-
+-		TripleMultiply(basis,1,numnodes,1,
+-					&D_scalar,1,1,0,
+-					basis,1,numnodes,0,
+-					&Ke->values[0],1);
+-
+-		GetBMasstransport(B,&xyz_list[0][0],gauss);
+-		GetBprimeMasstransport(Bprime,&xyz_list[0][0],gauss);
+-
+-		dvxdx=dvx[0];
+-		dvydy=dvy[1];
+-		D_scalar=dt*gauss->weight*Jdet;
+-
+-		D[0][0]=D_scalar*dvxdx;
+-		D[0][1]=0.;
+-		D[1][0]=0.;
+-		D[1][1]=D_scalar*dvydy;
+-		TripleMultiply(B,2,numnodes,1,
+-					&D[0][0],2,2,0,
+-					B,2,numnodes,0,
+-					&Ke->values[0],1);
+-
+-		D[0][0]=D_scalar*vx;
+-		D[1][1]=D_scalar*vy;
+-		TripleMultiply(B,2,numnodes,1,
+-					&D[0][0],2,2,0,
+-					Bprime,2,numnodes,0,
+-					&Ke->values[0],1);
+-
+-		if(stabilization==2){
+-			/*Streamline upwinding*/
+-			vel=sqrt(vx*vx+vy*vy)+1.e-8;
+-			D[0][0]=h/(2*vel)*vx*vx;
+-			D[1][0]=h/(2*vel)*vy*vx;
+-			D[0][1]=h/(2*vel)*vx*vy;
+-			D[1][1]=h/(2*vel)*vy*vy;
+-		}
+-		else if(stabilization==1){
+-			/*SSA*/
+-			vxaverage_input->GetInputAverage(&vx);
+-			vyaverage_input->GetInputAverage(&vy);
+-			D[0][0]=h/2.0*fabs(vx);
+-			D[0][1]=0.;
+-			D[1][0]=0.;
+-			D[1][1]=h/2.0*fabs(vy);
+-		}
+-		if(stabilization==1 || stabilization==2){
+-			D[0][0]=D_scalar*D[0][0];
+-			D[1][0]=D_scalar*D[1][0];
+-			D[0][1]=D_scalar*D[0][1];
+-			D[1][1]=D_scalar*D[1][1];
+-			TripleMultiply(Bprime,2,numnodes,1,
+-						&D[0][0],2,2,0,
+-						Bprime,2,numnodes,0,
+-						&Ke->values[0],1);
+-		}
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	xDelete<IssmDouble>(B);
+-	xDelete<IssmDouble>(Bprime);
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreateKMatrixMasstransport_DG {{{*/
+-ElementMatrix* Tria::CreateKMatrixMasstransport_DG(void){
+-
+-	/*Intermediaries */
+-	int        meshtype;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble Jdet,D_scalar,dt,vx,vy;
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke     = new ElementMatrix(nodes,numnodes,this->parameters,NoneApproximationEnum);
+-	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+-	IssmDouble*    B      = xNew<IssmDouble>(2*numnodes);
+-	IssmDouble*    Bprime = xNew<IssmDouble>(2*numnodes);
+-	IssmDouble     D[2][2];
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	this->parameters->FindParam(&meshtype,MeshTypeEnum);
+-	Input* vxaverage_input=NULL;
+-	Input* vyaverage_input=NULL;
+-	if(meshtype==Mesh2DhorizontalEnum){
+-		vxaverage_input=inputs->GetInput(VxEnum); _assert_(vxaverage_input);
+-		vyaverage_input=inputs->GetInput(VyEnum); _assert_(vyaverage_input);
+-	}
+-	else{
+-		vxaverage_input=inputs->GetInput(VxAverageEnum); _assert_(vxaverage_input);
+-		vyaverage_input=inputs->GetInput(VyAverageEnum); _assert_(vyaverage_input);
+-	}
+-
+-	/* Start  looping on the number of gaussian points: */
+-	GaussTria* gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		vxaverage_input->GetInputValue(&vx,gauss);
+-		vyaverage_input->GetInputValue(&vy,gauss);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis,gauss);
+-
+-		D_scalar=gauss->weight*Jdet;
+-
+-		TripleMultiply(basis,1,numnodes,1,
+-					&D_scalar,1,1,0,
+-					basis,1,numnodes,0,
+-					&Ke->values[0],1);
+-
+-		/*WARNING: B and Bprime are inverted compared to usual masstransport!!!!*/
+-		GetBMasstransport(Bprime, &xyz_list[0][0], gauss);
+-		GetBprimeMasstransport(B, &xyz_list[0][0], gauss);
+-
+-		D_scalar=-dt*gauss->weight*Jdet;
+-		D[0][0]=D_scalar*vx;
+-		D[0][1]=0.;
+-		D[1][0]=0.;
+-		D[1][1]=D_scalar*vy;
+-
+-		TripleMultiply(B,2,numnodes,1,
+-					&D[0][0],2,2,0,
+-					Bprime,2,numnodes,0,
+-					&Ke->values[0],1);
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	xDelete<IssmDouble>(B);
+-	xDelete<IssmDouble>(Bprime);
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreateKMatrixFreeSurfaceTop {{{*/
+-ElementMatrix* Tria::CreateKMatrixFreeSurfaceTop(void){
+-
+-	/*Intermediaries */
+-	int        stabilization;
+-	IssmDouble Jdet,D_scalar,dt,h;
+-	IssmDouble vel,vx,vy;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke     = new ElementMatrix(nodes,numnodes,this->parameters,NoneApproximationEnum);
+-	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+-	IssmDouble*    B      = xNew<IssmDouble>(2*numnodes);
+-	IssmDouble*    Bprime = xNew<IssmDouble>(2*numnodes);
+-	IssmDouble     D[2][2];
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	this->parameters->FindParam(&stabilization,MasstransportStabilizationEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+-	h=sqrt(2*this->GetArea());
+-
+-	/* Start  looping on the number of gaussian points: */
+-	GaussTria *gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis,gauss);
+-
+-		vx_input->GetInputValue(&vx,gauss);
+-		vy_input->GetInputValue(&vy,gauss);
+-
+-		D_scalar=gauss->weight*Jdet;
+-
+-		TripleMultiply(basis,1,numnodes,1,
+-					&D_scalar,1,1,0,
+-					basis,1,numnodes,0,
+-					&Ke->values[0],1);
+-
+-		GetBMasstransport(B,&xyz_list[0][0],gauss);
+-		GetBprimeMasstransport(Bprime,&xyz_list[0][0],gauss);
+-
+-		D_scalar=dt*gauss->weight*Jdet;
+-
+-		D[0][0]=D_scalar*vx;
+-		D[0][1]=0.;
+-		D[1][0]=0.;
+-		D[1][1]=D_scalar*vy;
+-		TripleMultiply(B,2,numnodes,1,
+-					&D[0][0],2,2,0,
+-					Bprime,2,numnodes,0,
+-					&Ke->values[0],1);
+-
+-		if(stabilization==2){
+-			/*Streamline upwinding*/
+-			vel=sqrt(vx*vx+vy*vy)+1.e-8;
+-			D[0][0]=h/(2*vel)*vx*vx;
+-			D[1][0]=h/(2*vel)*vy*vx;
+-			D[0][1]=h/(2*vel)*vx*vy;
+-			D[1][1]=h/(2*vel)*vy*vy;
+-		}
+-		else if(stabilization==1){
+-			/*SSA*/
+-			vx_input->GetInputAverage(&vx);
+-			vy_input->GetInputAverage(&vy);
+-			D[0][0]=h/2.0*fabs(vx);
+-			D[0][1]=0.;
+-			D[1][0]=0.;
+-			D[1][1]=h/2.0*fabs(vy);
+-		}
+-		if(stabilization==1 || stabilization==2){
+-			D[0][0]=D_scalar*D[0][0];
+-			D[1][0]=D_scalar*D[1][0];
+-			D[0][1]=D_scalar*D[0][1];
+-			D[1][1]=D_scalar*D[1][1];
+-			TripleMultiply(Bprime,2,numnodes,1,
+-						&D[0][0],2,2,0,
+-						Bprime,2,numnodes,0,
+-						&Ke->values[0],1);
+-		}
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	xDelete<IssmDouble>(B);
+-	xDelete<IssmDouble>(Bprime);
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreateKMatrixFreeSurfaceTop1D {{{*/
+-ElementMatrix* Tria::CreateKMatrixFreeSurfaceTop1D(void){
+-
+-	if(!HasEdgeOnSurface()) return NULL;
+-
+-	int index1,index2;
+-	this->EdgeOnSurfaceIndices(&index1,&index2);
+-
+-	Seg* seg=(Seg*)SpawnSeg(index1,index2); 
+-	ElementMatrix* Ke=seg->CreateKMatrixFreeSurfaceTop();
+-	delete seg->material; delete seg;
+-
+-	/*clean up and return*/
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreateKMatrixFreeSurfaceBase {{{*/
+-ElementMatrix* Tria::CreateKMatrixFreeSurfaceBase(void){
+-
+-	/*Intermediaries */
+-	int        stabilization;
+-	IssmDouble Jdet,D_scalar,dt,h;
+-	IssmDouble vel,vx,vy;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke     = new ElementMatrix(nodes,numnodes,this->parameters,NoneApproximationEnum);
+-	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+-	IssmDouble*    B      = xNew<IssmDouble>(2*numnodes);
+-	IssmDouble*    Bprime = xNew<IssmDouble>(2*numnodes);
+-	IssmDouble     D[2][2];
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	this->parameters->FindParam(&stabilization,MasstransportStabilizationEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+-	h=sqrt(2*this->GetArea());
+-
+-	/* Start  looping on the number of gaussian points: */
+-	GaussTria *gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis,gauss);
+-
+-		vx_input->GetInputValue(&vx,gauss);
+-		vy_input->GetInputValue(&vy,gauss);
+-
+-		D_scalar=gauss->weight*Jdet;
+-
+-		TripleMultiply(basis,1,numnodes,1,
+-					&D_scalar,1,1,0,
+-					basis,1,numnodes,0,
+-					&Ke->values[0],1);
+-
+-		GetBMasstransport(B,&xyz_list[0][0],gauss);
+-		GetBprimeMasstransport(Bprime,&xyz_list[0][0],gauss);
+-
+-		D_scalar=dt*gauss->weight*Jdet;
+-
+-		D[0][0]=D_scalar*vx;
+-		D[0][1]=0.;
+-		D[1][0]=0.;
+-		D[1][1]=D_scalar*vy;
+-		TripleMultiply(B,2,numnodes,1,
+-					&D[0][0],2,2,0,
+-					Bprime,2,numnodes,0,
+-					&Ke->values[0],1);
+-
+-		if(stabilization==2){
+-			/*Streamline upwinding*/
+-			vel=sqrt(vx*vx+vy*vy)+1.e-8;
+-			D[0][0]=h/(2*vel)*vx*vx;
+-			D[1][0]=h/(2*vel)*vy*vx;
+-			D[0][1]=h/(2*vel)*vx*vy;
+-			D[1][1]=h/(2*vel)*vy*vy;
+-		}
+-		else if(stabilization==1){
+-			/*SSA*/
+-			vx_input->GetInputAverage(&vx);
+-			vy_input->GetInputAverage(&vy);
+-			D[0][0]=h/2.0*fabs(vx);
+-			D[0][1]=0.;
+-			D[1][0]=0.;
+-			D[1][1]=h/2.0*fabs(vy);
+-		}
+-		if(stabilization==1 || stabilization==2){
+-			D[0][0]=D_scalar*D[0][0];
+-			D[1][0]=D_scalar*D[1][0];
+-			D[0][1]=D_scalar*D[0][1];
+-			D[1][1]=D_scalar*D[1][1];
+-			TripleMultiply(Bprime,2,numnodes,1,
+-						&D[0][0],2,2,0,
+-						Bprime,2,numnodes,0,
+-						&Ke->values[0],1);
+-		}
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	xDelete<IssmDouble>(B);
+-	xDelete<IssmDouble>(Bprime);
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreateKMatrixFreeSurfaceBase1D {{{*/
+-ElementMatrix* Tria::CreateKMatrixFreeSurfaceBase1D(void){
+-
+-	if(!HasEdgeOnBed()) return NULL;
+-
+-	int index1,index2;
+-	this->EdgeOnBedIndices(&index1,&index2);
+-
+-	Seg* seg=(Seg*)SpawnSeg(index1,index2); 
+-	ElementMatrix* Ke=seg->CreateKMatrixFreeSurfaceBase();
+-	delete seg->material; delete seg;
+-
+-	/*clean up and return*/
+-	return Ke;
+-}
+-/*}}}*/
+-#endif
+-
+ #ifdef _HAVE_DAMAGE_
+-/*FUNCTION Tria::CreateKMatrixDamageEvolution {{{*/
+-ElementMatrix* Tria::CreateKMatrixDamageEvolution(void){
+-
+-	switch(GetElementType()){
+-		case P1Enum: case P2Enum:
+-			return CreateKMatrixDamageEvolution_CG();
+-		case P1DGEnum:
+-			_error_("DG not implemented yet!");break;
+-		default:
+-			_error_("Element type " << EnumToStringx(GetElementType()) << " not supported yet");
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreateKMatrixDamageEvolution_CG {{{*/
+-ElementMatrix* Tria::CreateKMatrixDamageEvolution_CG(void){
+-
+-	/*Intermediaries */
+-	int        stabilization;
+-	int        meshtype;
+-	IssmDouble Jdet,D_scalar,dt,h;
+-	IssmDouble vel,vx,vy,dvxdx,dvydy;
+-	IssmDouble dvx[2],dvy[2];
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke     = new ElementMatrix(nodes,numnodes,this->parameters,NoneApproximationEnum);
+-	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+-	IssmDouble*    B      = xNew<IssmDouble>(2*numnodes);
+-	IssmDouble*    Bprime = xNew<IssmDouble>(2*numnodes);
+-	IssmDouble     D[2][2];
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	this->parameters->FindParam(&meshtype,MeshTypeEnum);
+-	this->parameters->FindParam(&stabilization,DamageStabilizationEnum);
+-	Input* vxaverage_input=NULL;
+-	Input* vyaverage_input=NULL;
+-	if(meshtype==Mesh2DhorizontalEnum){
+-		vxaverage_input=inputs->GetInput(VxEnum); _assert_(vxaverage_input);
+-		vyaverage_input=inputs->GetInput(VyEnum); _assert_(vyaverage_input);
+-	}
+-	else{
+-		vxaverage_input=inputs->GetInput(VxAverageEnum); _assert_(vxaverage_input);
+-		vyaverage_input=inputs->GetInput(VyAverageEnum); _assert_(vyaverage_input);
+-	}
+-	h=sqrt(2*this->GetArea());
+-
+-	/* Start  looping on the number of gaussian points: */
+-	GaussTria *gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis,gauss);
+-
+-		vxaverage_input->GetInputValue(&vx,gauss);
+-		vyaverage_input->GetInputValue(&vy,gauss);
+-		vxaverage_input->GetInputDerivativeValue(&dvx[0],&xyz_list[0][0],gauss);
+-		vyaverage_input->GetInputDerivativeValue(&dvy[0],&xyz_list[0][0],gauss);
+-
+-		D_scalar=gauss->weight*Jdet;
+-
+-		TripleMultiply(basis,1,numnodes,1,
+-					&D_scalar,1,1,0,
+-					basis,1,numnodes,0,
+-					&Ke->values[0],1);
+-		GetBMasstransport(B,&xyz_list[0][0],gauss);
+-		GetBprimeMasstransport(Bprime,&xyz_list[0][0],gauss);
+-
+-		dvxdx=dvx[0];
+-		dvydy=dvy[1];
+-		D_scalar=dt*gauss->weight*Jdet;
+-
+-		D[0][0]=D_scalar*dvxdx;
+-		D[0][1]=0.;
+-		D[1][0]=0.;
+-		D[1][1]=D_scalar*dvydy;
+-		TripleMultiply(B,2,numnodes,1,
+-					&D[0][0],2,2,0,
+-					B,2,numnodes,0,
+-					&Ke->values[0],1);
+-
+-		D[0][0]=D_scalar*vx;
+-		D[1][1]=D_scalar*vy;
+-		TripleMultiply(B,2,numnodes,1,
+-					&D[0][0],2,2,0,
+-					Bprime,2,numnodes,0,
+-					&Ke->values[0],1);
+-
+-		if(stabilization==2){
+-			/*Streamline upwinding*/
+-			vel=sqrt(vx*vx+vy*vy)+1.e-8;
+-			D[0][0]=h/(2*vel)*vx*vx;
+-			D[1][0]=h/(2*vel)*vy*vx;
+-			D[0][1]=h/(2*vel)*vx*vy;
+-			D[1][1]=h/(2*vel)*vy*vy;
+-		}
+-		else if(stabilization==1){
+-			/*SSA*/
+-			vxaverage_input->GetInputAverage(&vx);
+-			vyaverage_input->GetInputAverage(&vy);
+-			D[0][0]=h/2.0*fabs(vx);
+-			D[0][1]=0.;
+-			D[1][0]=0.;
+-			D[1][1]=h/2.0*fabs(vy);
+-		}
+-		if(stabilization==1 || stabilization==2){
+-			D[0][0]=D_scalar*D[0][0];
+-			D[1][0]=D_scalar*D[1][0];
+-			D[0][1]=D_scalar*D[0][1];
+-			D[1][1]=D_scalar*D[1][1];
+-			TripleMultiply(Bprime,2,numnodes,1,
+-						&D[0][0],2,2,0,
+-						Bprime,2,numnodes,0,
+-						&Ke->values[0],1);
+-		}
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	xDelete<IssmDouble>(B);
+-	xDelete<IssmDouble>(Bprime);
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+ /*FUNCTION Tria::DamageEvolutionF{{{*/
+ void Tria::DamageEvolutionF(IssmDouble* f){
+ 
+@@ -6822,317 +5104,6 @@
+ /*}}}*/
+ #endif
+ 
+-#ifdef _HAVE_BALANCED_
+-/*FUNCTION Tria::CreateKMatrixBalancethickness {{{*/
+-ElementMatrix* Tria::CreateKMatrixBalancethickness(void){
+-
+-	switch(GetElementType()){
+-		case P1Enum:
+-			return CreateKMatrixBalancethickness_CG();
+-		case P1DGEnum:
+-			return CreateKMatrixBalancethickness_DG();
+-		default:
+-			_error_("Element type " << EnumToStringx(GetElementType()) << " not supported yet");
+-	}
+-
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreateKMatrixBalancethickness_CG {{{*/
+-ElementMatrix* Tria::CreateKMatrixBalancethickness_CG(void){
+-
+-	/*Intermediaries */
+-	int        stabilization,meshtype;
+-	IssmDouble Jdet,vx,vy,dvxdx,dvydy,vel,h;
+-	IssmDouble D_scalar;
+-	IssmDouble dvx[2],dvy[2];
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke     = new ElementMatrix(nodes,numnodes,this->parameters,NoneApproximationEnum);
+-	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+-	IssmDouble*    B      = xNew<IssmDouble>(2*numnodes);
+-	IssmDouble*    Bprime = xNew<IssmDouble>(2*numnodes);
+-	IssmDouble     D[2][2];
+-
+-	/*Retrieve all Inputs and parameters: */
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&stabilization,BalancethicknessStabilizationEnum);
+-	this->parameters->FindParam(&meshtype,MeshTypeEnum);
+-	Input* vxaverage_input=NULL;
+-	Input* vyaverage_input=NULL;
+-	if(meshtype==Mesh2DhorizontalEnum){
+-		vxaverage_input=inputs->GetInput(VxEnum); _assert_(vxaverage_input);
+-		vyaverage_input=inputs->GetInput(VyEnum); _assert_(vyaverage_input);
+-	}
+-	else{
+-		vxaverage_input=inputs->GetInput(VxAverageEnum); _assert_(vxaverage_input);
+-		vyaverage_input=inputs->GetInput(VyAverageEnum); _assert_(vyaverage_input);
+-	}
+-	h=sqrt(2.*this->GetArea());
+-
+-	/*Start looping on the number of gaussian points:*/
+-	GaussTria* gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetBMasstransport(B,&xyz_list[0][0],gauss);
+-		GetBprimeMasstransport(Bprime,&xyz_list[0][0],gauss);
+-
+-		vxaverage_input->GetInputValue(&vx,gauss);
+-		vyaverage_input->GetInputValue(&vy,gauss);
+-		vxaverage_input->GetInputDerivativeValue(&dvx[0],&xyz_list[0][0],gauss);
+-		vyaverage_input->GetInputDerivativeValue(&dvy[0],&xyz_list[0][0],gauss);
+-
+-		dvxdx=dvx[0];
+-		dvydy=dvy[1];
+-		D_scalar=gauss->weight*Jdet;
+-
+-		D[0][0]=D_scalar*dvxdx;
+-		D[0][1]=0.;
+-		D[1][0]=0.;
+-		D[1][1]=D_scalar*dvydy;
+-		TripleMultiply(B,2,numnodes,1,
+-					&D[0][0],2,2,0,
+-					B,2,numnodes,0,
+-					&Ke->values[0],1);
+-
+-		D[0][0]=D_scalar*vx;
+-		D[1][1]=D_scalar*vy;
+-		TripleMultiply(B,2,numnodes,1,
+-					&D[0][0],2,2,0,
+-					Bprime,2,numnodes,0,
+-					&Ke->values[0],1);
+-
+-		if(stabilization==1){
+-			/*Streamline upwinding*/
+-			vel=sqrt(vx*vx+vy*vy);
+-			D[0][0]=h/(2*vel)*vx*vx;
+-			D[1][0]=h/(2*vel)*vy*vx;
+-			D[0][1]=h/(2*vel)*vx*vy;
+-			D[1][1]=h/(2*vel)*vy*vy;
+-		}
+-		else if(stabilization==2){
+-			/*SSA*/
+-			vxaverage_input->GetInputAverage(&vx);
+-			vyaverage_input->GetInputAverage(&vy);
+-			D[0][0]=h/2.0*fabs(vx);
+-			D[0][1]=0.;
+-			D[1][0]=0.;
+-			D[1][1]=h/2.0*fabs(vy);
+-		}
+-		if(stabilization==1 || stabilization==2){
+-			D[0][0]=D_scalar*D[0][0];
+-			D[1][0]=D_scalar*D[1][0];
+-			D[0][1]=D_scalar*D[0][1];
+-			D[1][1]=D_scalar*D[1][1];
+-			TripleMultiply(Bprime,2,numnodes,1,
+-						&D[0][0],2,2,0,
+-						Bprime,2,numnodes,0,
+-						&Ke->values[0],1);
+-		}
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	xDelete<IssmDouble>(B);
+-	xDelete<IssmDouble>(Bprime);
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreateKMatrixBalancethickness_DG {{{*/
+-ElementMatrix* Tria::CreateKMatrixBalancethickness_DG(void){
+-
+-	/*Intermediaries*/
+-	IssmDouble vx,vy,D_scalar,Jdet;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke     = new ElementMatrix(nodes,numnodes,this->parameters,NoneApproximationEnum);
+-	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+-	IssmDouble*    B      = xNew<IssmDouble>(2*numnodes);
+-	IssmDouble*    Bprime = xNew<IssmDouble>(2*numnodes);
+-	IssmDouble     D[2][2];
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+-
+-	/*Start looping on the number of gaussian points:*/
+-	GaussTria* gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		/*WARNING: B and Bprime are inverted compared to usual masstransport!!!!*/
+-		GetBMasstransport(Bprime,&xyz_list[0][0],gauss);
+-		GetBprimeMasstransport(B,&xyz_list[0][0],gauss);
+-
+-		vx_input->GetInputValue(&vx,gauss);
+-		vy_input->GetInputValue(&vy,gauss);
+-
+-		D_scalar=-gauss->weight*Jdet;
+-		D[0][0]=D_scalar*vx;
+-		D[0][1]=0.;
+-		D[1][0]=0.;
+-		D[1][1]=D_scalar*vy;
+-
+-		TripleMultiply(B,2,numnodes,1,
+-					&D[0][0],2,2,0,
+-					Bprime,2,numnodes,0,
+-					&Ke->values[0],1);
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	xDelete<IssmDouble>(B);
+-	xDelete<IssmDouble>(Bprime);
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreateKMatrixBalancevelocity{{{*/
+-ElementMatrix* Tria::CreateKMatrixBalancevelocity(void){
+-
+-	/*Intermediaries */
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble dhdt_g,mb_g,ms_g,Jdet;
+-	IssmDouble h,gamma,thickness;
+-	IssmDouble hnx,hny,dhnx[2],dhny[2];
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke     = new ElementMatrix(nodes,numnodes,this->parameters,NoneApproximationEnum);
+-	IssmDouble*    B      = xNew<IssmDouble>(2*numnodes);
+-	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+-	IssmDouble*    dbasis = xNew<IssmDouble>(2*numnodes);
+-	IssmDouble*    HNx    = xNew<IssmDouble>(numnodes);
+-	IssmDouble*    HNy    = xNew<IssmDouble>(numnodes);
+-	IssmDouble*    H      = xNew<IssmDouble>(numnodes);
+-	IssmDouble*    Nx     = xNew<IssmDouble>(numnodes);
+-	IssmDouble*    Ny     = xNew<IssmDouble>(numnodes);
+-
+-	/*Retrieve all Inputs and parameters: */
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* H_input =inputs->GetInput(ThicknessEnum); _assert_(H_input);
+-	h=sqrt(2.*this->GetArea());
+-
+-	/*Get vector N for all nodes and build HNx and HNy*/
+-	GetInputListOnNodes(Nx,SurfaceSlopeXEnum);
+-	GetInputListOnNodes(Ny,SurfaceSlopeYEnum);
+-	GetInputListOnNodes(H,ThicknessEnum);
+-	for(int i=0;i<numnodes;i++){
+-		IssmDouble norm=sqrt(Nx[i]*Nx[i]+Ny[i]*Ny[i]+1.e-10);
+-		HNx[i] = -H[i]*Nx[i]/norm;
+-		HNy[i] = -H[i]*Ny[i]/norm;
+-	}
+-
+-	/*Start looping on the number of gaussian points:*/
+-	GaussTria* gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		H_input->GetInputValue(&thickness,gauss);
+-		if(thickness<50.) thickness=50.;
+-		TriaRef::GetInputDerivativeValue(&dhnx[0],HNx,&xyz_list[0][0],gauss);
+-		TriaRef::GetInputDerivativeValue(&dhny[0],HNy,&xyz_list[0][0],gauss);
+-		TriaRef::GetInputValue(&hnx,HNx,gauss);
+-		TriaRef::GetInputValue(&hny,HNy,gauss);
+-
+-		gamma=h/(2.*thickness+1.e-10);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis,gauss);
+-		GetNodalFunctionsDerivatives(dbasis,&xyz_list[0][0],gauss);
+-
+-		for(int i=0;i<numnodes;i++){
+-			for(int j=0;j<numnodes;j++){
+-				Ke->values[i*numnodes+j] += gauss->weight*Jdet*(
+-							(basis[i]+gamma*(basis[i]*(dhnx[0]+dhny[1]) + dbasis[0*numnodes+i]*hnx + dbasis[1*numnodes+i]*hny))*
+-							(basis[j]*(dhnx[0]+dhny[1])  + dbasis[0*numnodes+j]*hnx + dbasis[1*numnodes+j]*hny)
+-							);
+-			}
+-		}
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	xDelete<IssmDouble>(dbasis);
+-	xDelete<IssmDouble>(H);
+-	xDelete<IssmDouble>(Nx);
+-	xDelete<IssmDouble>(Ny);
+-	xDelete<IssmDouble>(HNx);
+-	xDelete<IssmDouble>(HNy);
+-	xDelete<IssmDouble>(B);
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::CreateKMatrixSmoothedSlope {{{*/
+-ElementMatrix* Tria::CreateKMatrixSmoothedSlope(void){
+-
+-	/* Intermediaries */
+-	IssmDouble D_scalar,Jdet,thickness;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble l=8.;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke     = new ElementMatrix(nodes,numnodes,this->parameters);
+-	IssmDouble*    dbasis = xNew<IssmDouble>(2*numnodes);
+-	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* thickness_input=inputs->GetInput(ThicknessEnum); _assert_(thickness_input);
+-
+-	/* Start looping on the number of gaussian points: */
+-	GaussTria* gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		thickness_input->GetInputValue(&thickness,gauss);
+-		if(thickness<50.) thickness=50.;
+-
+-		GetNodalFunctions(basis,gauss);
+-		GetNodalFunctionsDerivatives(dbasis,&xyz_list[0][0],gauss);
+-
+-		for(int i=0;i<numnodes;i++){
+-			for(int j=0;j<numnodes;j++){
+-				Ke->values[i*numnodes+j] += gauss->weight*Jdet*(
+-							basis[i]*basis[j]
+-							+(l*thickness)*(l*thickness)*(dbasis[0*numnodes+i]*dbasis[0*numnodes+j] + dbasis[1*numnodes+i]*dbasis[1*numnodes+j])
+-							);
+-			}
+-		}
+-	}
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	xDelete<IssmDouble>(dbasis);
+-	xDelete<IssmDouble>(basis);
+-	return Ke;
+-}
+-/*}}}*/
+-#endif
+-
+ #ifdef _HAVE_GROUNDINGLINE_
+ /*FUNCTION Tria::MigrateGroundingLine{{{*/
+ void  Tria::MigrateGroundingLine(IssmDouble* phi_ungrounding){
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16992)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16993)
+@@ -67,7 +67,6 @@
+ 		void        SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters);
+ 		void        SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum);
+ 		void        CreateDVector(Vector<IssmDouble>* df);
+-		void        CreateJacobianMatrix(Matrix<IssmDouble>* Jff);
+ 		void        Delta18oParameterization(void);
+ 		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){_error_("not implemented yet");};
+ 		void        EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented yet");};
+@@ -201,26 +200,6 @@
+ 		void           AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		void           AddInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		void           AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum);
+-		ElementMatrix* CreateKMatrix(void);
+-		ElementMatrix* CreateKMatrixBalancethickness(void);
+-		ElementMatrix* CreateKMatrixBalancethickness_DG(void);
+-		ElementMatrix* CreateKMatrixBalancethickness_CG(void);
+-		ElementMatrix* CreateKMatrixBalancevelocity(void);
+-		ElementMatrix* CreateKMatrixSmoothedSlope(void);
+-		ElementMatrix* CreateKMatrixMelting(void);
+-		ElementMatrix* CreateKMatrixMasstransport(void);
+-		ElementMatrix* CreateKMatrixMasstransport_CG(void);
+-		ElementMatrix* CreateKMatrixMasstransport_DG(void);
+-		ElementMatrix* CreateKMatrixExtrusion(void);
+-		ElementMatrix* CreateKMatrixExtrusionVolume(void);
+-		ElementMatrix* CreateKMatrixExtrusionSurface(void);
+-		ElementMatrix* CreateKMatrixExtrusionBed(void);
+-		ElementMatrix* CreateKMatrixFreeSurfaceTop(void);
+-		ElementMatrix* CreateKMatrixFreeSurfaceTop1D(void);
+-		ElementMatrix* CreateKMatrixFreeSurfaceBase(void);
+-		ElementMatrix* CreateKMatrixFreeSurfaceBase1D(void);
+-		ElementMatrix* CreateMassMatrix(void);
+-		ElementMatrix* CreateBasalMassMatrix(void);
+ 		IssmDouble     EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented");};
+ 		IssmDouble     EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure){_error_("not implemented");};
+ 		IssmDouble     GetArea(void);
+@@ -282,23 +261,10 @@
+ 		void           ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
+ 
+ 		#ifdef _HAVE_STRESSBALANCE_
+-		ElementMatrix* CreateKMatrixStressbalanceSSA(void);
+-		ElementMatrix* CreateKMatrixStressbalanceSSAViscous(void);
+-		ElementMatrix* CreateKMatrixStressbalanceSSAFriction(void);
+-		ElementMatrix* CreateKMatrixStressbalanceSIA(void);
+-		ElementMatrix* CreateKMatrixStressbalanceFS(void);
+-		ElementMatrix* CreateKMatrixStressbalanceFSViscous(void);
+-		ElementMatrix* CreateKMatrixStressbalanceFSFriction(void);
+ 		void           PVectorGLSstabilization(ElementVector* pe);
+-		ElementMatrix* CreateJacobianStressbalanceSSA(void);
+ 		IssmDouble     GetYcoord(GaussTria* gauss);
+ 		#endif
+ 
+-		#ifdef _HAVE_CONTROL_
+-		ElementMatrix* CreateKMatrixAdjointBalancethickness(void);
+-		ElementMatrix* CreateKMatrixAdjointSSA(void);
+-		#endif
+-
+ 		void UpdateConstraintsExtrudeFromBase(void);
+ 		void UpdateConstraintsExtrudeFromTop(void);
+ 		#ifdef _HAVE_THERMAL_
+@@ -308,9 +274,6 @@
+ 		#endif
+ 
+ 		#ifdef _HAVE_HYDROLOGY_
+-		ElementMatrix* CreateKMatrixHydrologyShreve(void);
+-		ElementMatrix* CreateKMatrixHydrologyDCInefficient(void);
+-		ElementMatrix* CreateKMatrixHydrologyDCEfficient(void);
+ 		ElementMatrix* CreateEPLDomainMassMatrix(void);
+ 		void           CreateHydrologyWaterVelocityInput(void);
+ 		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index);
+@@ -323,8 +286,6 @@
+ 		#endif
+ 
+ 		#ifdef _HAVE_DAMAGE_
+-		ElementMatrix* CreateKMatrixDamageEvolution(void);
+-		ElementMatrix* CreateKMatrixDamageEvolution_CG(void);
+ 		void           DamageEvolutionF(IssmDouble* flist);
+ 		#endif
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16992)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16993)
+@@ -378,143 +378,6 @@
+ 	this->inputs->Configure(parameters);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::CreateKMatrix(void){{{*/
+-ElementMatrix* Penta::CreateKMatrix(void){
+-
+-	/*retrieve parameters: */
+-	int analysis_type;
+-	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-
+-	/*Checks in debugging {{{*/
+-	_assert_(this->nodes && this->material && this->matpar && this->verticalneighbors && this->parameters && this->inputs);
+-	/*}}}*/
+-
+-	/*Skip if water element*/
+-	if(NoIceInElement()) return NULL;
+-
+-	/*Just branch to the correct element stiffness matrix generator, according to the type of analysis we are carrying out: */
+-	switch(analysis_type){
+-		#ifdef _HAVE_STRESSBALANCE_
+-		case StressbalanceAnalysisEnum:
+-			return CreateKMatrixStressbalanceHoriz();
+-			break;
+-		case AdjointHorizAnalysisEnum:
+-			return CreateKMatrixAdjointHoriz();
+-			break;
+-		case StressbalanceSIAAnalysisEnum:
+-			return CreateKMatrixStressbalanceSIA();
+-			break;
+-		case StressbalanceVerticalAnalysisEnum:
+-			return CreateKMatrixStressbalanceVert();
+-			break;
+-		#endif
+-		case L2ProjectionBaseAnalysisEnum:
+-			return CreateBasalMassMatrix();
+-			break;
+-		case MasstransportAnalysisEnum:
+-			return CreateKMatrixMasstransport();
+-			break;
+-		case FreeSurfaceTopAnalysisEnum:
+-			return CreateKMatrixFreeSurfaceTop();
+-			break;
+-		case FreeSurfaceBaseAnalysisEnum:
+-			return CreateKMatrixFreeSurfaceBase();
+-			break;
+-		#ifdef _HAVE_BALANCED_
+-		case BalancethicknessAnalysisEnum:
+-			return CreateKMatrixBalancethickness();
+-			break;
+-		#endif
+-		#ifdef _HAVE_THERMAL_
+-		case ThermalAnalysisEnum:
+-			return CreateKMatrixThermal();
+-			break;
+-		case EnthalpyAnalysisEnum:
+-			return CreateKMatrixEnthalpy();
+-			break;
+-		case MeltingAnalysisEnum:
+-			return CreateKMatrixMelting();
+-			break;
+-		#endif
+-		#ifdef _HAVE_HYDROLOGY_
+-	  case HydrologyDCInefficientAnalysisEnum:
+-			return CreateKMatrixHydrologyDCInefficient();
+-			break;
+-	  case HydrologyDCEfficientAnalysisEnum:
+-			return CreateKMatrixHydrologyDCEfficient();
+-			break;
+-	  case L2ProjectionEPLAnalysisEnum:
+-			return CreateEPLDomainMassMatrix();
+-			break;
+-		#endif
+-		default:
+-			_error_("analysis " << EnumToStringx(analysis_type) << " not supported yet");
+-	}
+-
+-	/*Make compiler happy*/
+-	return NULL;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixMasstransport {{{*/
+-ElementMatrix* Penta::CreateKMatrixMasstransport(void){
+-
+-	if (!IsOnBed()) return NULL;
+-
+-	/*Depth Averaging Vx and Vy*/
+-	this->InputDepthAverageAtBase(VxEnum,VxAverageEnum);
+-	this->InputDepthAverageAtBase(VyEnum,VyAverageEnum);
+-
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	ElementMatrix* Ke=tria->CreateKMatrixMasstransport();
+-	delete tria->material; delete tria;
+-
+-	/*Delete Vx and Vy averaged*/
+-	this->inputs->DeleteInput(VxAverageEnum);
+-	this->inputs->DeleteInput(VyAverageEnum);
+-
+-	/*clean up and return*/
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixFreeSurfaceTop {{{*/
+-ElementMatrix* Penta::CreateKMatrixFreeSurfaceTop(void){
+-
+-	if(!IsOnSurface()) return NULL;
+-
+-	Tria* tria=(Tria*)SpawnTria(1); //lower face is 0, upper face is 1.
+-	ElementMatrix* Ke=tria->CreateKMatrixFreeSurfaceTop();
+-	delete tria->material; delete tria;
+-
+-	/*clean up and return*/
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixFreeSurfaceBase {{{*/
+-ElementMatrix* Penta::CreateKMatrixFreeSurfaceBase(void){
+-
+-	if(!IsOnBed()) return NULL;
+-
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	ElementMatrix* Ke=tria->CreateKMatrixFreeSurfaceBase();
+-	delete tria->material; delete tria;
+-
+-	/*clean up and return*/
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateBasalMassMatrix{{{*/
+-ElementMatrix* Penta::CreateBasalMassMatrix(void){
+-
+-	if (!IsOnBed()) return NULL;
+-
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	ElementMatrix* Ke=tria->CreateMassMatrix();
+-	delete tria->material; delete tria;
+-
+-	/*clean up and return*/
+-	return Ke;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::CreateDVector {{{*/
+ void  Penta::CreateDVector(Vector<IssmDouble>* df){
+ 
+@@ -541,54 +404,6 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Penta::CreateJacobianMatrix{{{*/
+-void  Penta::CreateJacobianMatrix(Matrix<IssmDouble>* Jff){
+-
+-	/*retrieve parameters: */
+-	ElementMatrix* Ke=NULL;
+-	int analysis_type;
+-	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-
+-	/*Checks in debugging {{{*/
+-	_assert_(this->nodes && this->material && this->matpar && this->verticalneighbors && this->parameters && this->inputs);
+-	/*}}}*/
+-
+-	/*Skip if water element*/
+-	if(NoIceInElement()) return;
+-
+-	/*Just branch to the correct element stiffness matrix generator, according to the type of analysis we are carrying out: */
+-	switch(analysis_type){
+-#ifdef _HAVE_STRESSBALANCE_
+-		case StressbalanceAnalysisEnum:
+-			Ke=CreateJacobianStressbalanceHoriz();
+-			break;
+-#endif
+-		default:
+-			_error_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet");
+-	}
+-
+-	/*Add to global matrix*/
+-	if(Ke){
+-		/*Condense if requested*/
+-		if(this->element_type==MINIcondensedEnum){
+-			int indices[3]={18,19,20};
+-			Ke->StaticCondensation(3,&indices[0]);
+-		}
+-		else if(this->element_type==P1bubblecondensedEnum){
+-			int size   = nodes[6]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
+-			int offset = 0;
+-			for(int i=0;i<6;i++) offset+=nodes[i]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
+-			int* indices=xNew<int>(size);
+-			for(int i=0;i<size;i++) indices[i] = offset+i;
+-			Ke->StaticCondensation(size,indices);
+-			xDelete<int>(indices);
+-		}
+-
+-		Ke->AddToGlobal(Jff);
+-		delete Ke;
+-	}
+-}
+-/*}}}*/
+ /*FUNCTION Penta::DeepEcho{{{*/
+ void Penta::DeepEcho(void){
+ 
+@@ -3436,457 +3251,6 @@
+ #endif
+ 
+ #ifdef _HAVE_THERMAL_
+-/*FUNCTION Penta::CreateKMatrixEnthalpy {{{*/
+-ElementMatrix* Penta::CreateKMatrixEnthalpy(void){
+-
+-	/*compute all stiffness matrices for this element*/
+-	ElementMatrix* Ke1=CreateKMatrixEnthalpyVolume();
+-	ElementMatrix* Ke2=CreateKMatrixEnthalpyShelf();
+-	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
+-
+-	/*clean-up and return*/
+-	delete Ke1;
+-	delete Ke2;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixEnthalpyVolume {{{*/
+-ElementMatrix* Penta::CreateKMatrixEnthalpyVolume(void){
+-
+-	/*Constants*/
+-	const int    numdof=NDOF1*NUMVERTICES;
+-
+-	/*Intermediaries */
+-	int        stabilization;
+-	int        i,j;
+-	IssmDouble Jdet,u,v,w,um,vm,wm;
+-	IssmDouble h,hx,hy,hz,vx,vy,vz,vel;
+-	IssmDouble gravity,rho_ice,rho_water;
+-	IssmDouble epsvel=2.220446049250313e-16;
+-	IssmDouble heatcapacity,thermalconductivity,dt;
+-	IssmDouble enthalpy[NUMVERTICES], pressure[NUMVERTICES];
+-	IssmDouble latentheat,kappa;
+-	IssmDouble tau_parameter,diameter;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble B_conduct[3][numdof];
+-	IssmDouble B_advec[3][numdof];
+-	IssmDouble Bprime_advec[3][numdof];
+-	IssmDouble L[numdof];
+-	IssmDouble dbasis[3][6];
+-	IssmDouble D_scalar_conduct,D_scalar_advec;
+-	IssmDouble D_scalar_trans,D_scalar_stab;
+-	IssmDouble D[3][3];
+-	IssmDouble K[3][3]={0.0};
+-	GaussPenta *gauss=NULL;
+-
+-	/*Initialize Element matrix*/
+-	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	rho_water=matpar->GetRhoWater();
+-	rho_ice=matpar->GetRhoIce();
+-	gravity=matpar->GetG();
+-	heatcapacity=matpar->GetHeatCapacity();
+-	latentheat=matpar->GetLatentHeat();
+-	thermalconductivity=matpar->GetThermalConductivity();
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	this->parameters->FindParam(&stabilization,ThermalStabilizationEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum);                  _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);                  _assert_(vy_input);
+-	Input* vz_input=inputs->GetInput(VzEnum);                  _assert_(vz_input);
+-	Input* vxm_input=inputs->GetInput(VxMeshEnum);             _assert_(vxm_input);
+-	Input* vym_input=inputs->GetInput(VyMeshEnum);             _assert_(vym_input);
+-	Input* vzm_input=inputs->GetInput(VzMeshEnum);             _assert_(vzm_input);
+-	if (stabilization==2) diameter=MinEdgeLength(&xyz_list[0][0]);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(2,2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-
+-		/*Conduction: */  
+-		GetBConduct(&B_conduct[0][0],&xyz_list[0][0],gauss); 
+-		GetInputListOnVertices(&enthalpy[0],EnthalpyPicardEnum);
+-		GetInputListOnVertices(&pressure[0],PressureEnum);
+-		kappa=matpar->GetEnthalpyDiffusionParameterVolume(NUMVERTICES,enthalpy,pressure); _assert_(kappa>0.);
+-
+-		D_scalar_conduct=gauss->weight*Jdet*kappa/rho_ice;
+-		if(reCast<bool,IssmDouble>(dt)) D_scalar_conduct=D_scalar_conduct*dt;
+-
+-		D[0][0]=D_scalar_conduct; D[0][1]=0; D[0][2]=0;
+-		D[1][0]=0; D[1][1]=D_scalar_conduct; D[1][2]=0;
+-		D[2][0]=0; D[2][1]=0; D[2][2]=D_scalar_conduct;
+-
+-		TripleMultiply(&B_conduct[0][0],3,numdof,1,
+-					&D[0][0],3,3,0,
+-					&B_conduct[0][0],3,numdof,0,
+-					&Ke->values[0],1);
+-
+-		/*Advection: */
+-		GetBAdvec(&B_advec[0][0],&xyz_list[0][0],gauss); 
+-		GetBprimeAdvec(&Bprime_advec[0][0],&xyz_list[0][0],gauss); 
+-
+-		vx_input->GetInputValue(&u, gauss); vxm_input->GetInputValue(&um,gauss); vx=u-um; 
+-		vy_input->GetInputValue(&v, gauss); vym_input->GetInputValue(&vm,gauss); vy=v-vm; 
+-		vz_input->GetInputValue(&w, gauss); vzm_input->GetInputValue(&wm,gauss); vz=w-wm;
+-
+-		D_scalar_advec=gauss->weight*Jdet;
+-		if(reCast<bool,IssmDouble>(dt)) D_scalar_advec=D_scalar_advec*dt;
+-
+-		D[0][0]=D_scalar_advec*vx;D[0][1]=0;                D[0][2]=0;
+-		D[1][0]=0;                D[1][1]=D_scalar_advec*vy;D[1][2]=0;
+-		D[2][0]=0;                D[2][1]=0;                D[2][2]=D_scalar_advec*vz;
+-
+-		TripleMultiply(&B_advec[0][0],3,numdof,1,
+-					&D[0][0],3,3,0,
+-					&Bprime_advec[0][0],3,numdof,0,
+-					&Ke->values[0],1);
+-
+-		/*Transient: */
+-		if(reCast<bool,IssmDouble>(dt)){
+-			GetNodalFunctionsP1(&L[0], gauss);
+-			D_scalar_trans=gauss->weight*Jdet;
+-
+-			TripleMultiply(&L[0],numdof,1,0,
+-						&D_scalar_trans,1,1,0,
+-						&L[0],1,numdof,0,
+-						&Ke->values[0],1);
+-		}
+-
+-		/*Artificial diffusivity*/
+-		if(stabilization==1){
+-			/*Build K: */
+-			ElementSizes(&hx,&hy,&hz);
+-			vel=sqrt(vx*vx + vy*vy + vz*vz)+1.e-14;
+-			h=sqrt( pow(hx*vx/vel,2) + pow(hy*vy/vel,2) + pow(hz*vz/vel,2));
+-
+-			K[0][0]=h/(2*vel)*vx*vx;  K[0][1]=h/(2*vel)*vx*vy; K[0][2]=h/(2*vel)*vx*vz;
+-			K[1][0]=h/(2*vel)*vy*vx;  K[1][1]=h/(2*vel)*vy*vy; K[1][2]=h/(2*vel)*vy*vz;
+-			K[2][0]=h/(2*vel)*vz*vx;  K[2][1]=h/(2*vel)*vz*vy; K[2][2]=h/(2*vel)*vz*vz;
+-
+-			D_scalar_stab=gauss->weight*Jdet;
+-			if(reCast<bool,IssmDouble>(dt)) D_scalar_stab=D_scalar_stab*dt;
+-			for(i=0;i<3;i++) for(j=0;j<3;j++) K[i][j] = D_scalar_stab*K[i][j];
+-
+-			GetBprimeAdvec(&Bprime_advec[0][0],&xyz_list[0][0],gauss); 
+-
+-			TripleMultiply(&Bprime_advec[0][0],3,numdof,1,
+-						&K[0][0],3,3,0,
+-						&Bprime_advec[0][0],3,numdof,0,
+-						&Ke->values[0],1);
+-		}
+-		else if(stabilization==2){
+-			GetNodalFunctionsP1Derivatives(&dbasis[0][0],&xyz_list[0][0], gauss);
+-			tau_parameter=StabilizationParameter(u-um,v-vm,w-wm,diameter,kappa/rho_ice);
+-
+-			for(i=0;i<numdof;i++){
+-				for(j=0;j<numdof;j++){
+-					Ke->values[i*numdof+j]+=tau_parameter*D_scalar_advec*
+-					  ((u-um)*dbasis[0][i]+(v-vm)*dbasis[1][i]+(w-wm)*dbasis[2][i])*((u-um)*dbasis[0][j]+(v-vm)*dbasis[1][j]+(w-wm)*dbasis[2][j]);
+-				}
+-			}
+-			if(reCast<bool,IssmDouble>(dt)){
+-				for(i=0;i<numdof;i++){
+-					for(j=0;j<numdof;j++){
+-						Ke->values[i*numdof+j]+=tau_parameter*D_scalar_trans*L[j]*((u-um)*dbasis[0][i]+(v-vm)*dbasis[1][i]+(w-wm)*dbasis[2][i]);
+-					}
+-				}
+-			}
+-		}
+-	}
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixEnthalpyShelf {{{*/
+-ElementMatrix* Penta::CreateKMatrixEnthalpyShelf(void){
+-
+-	/*Constants*/
+-	const int    numdof=NDOF1*NUMVERTICES;
+-
+-	/*Intermediaries */
+-	int        i,j;
+-	IssmDouble mixed_layer_capacity,thermal_exchange_velocity;
+-	IssmDouble rho_ice,rho_water,heatcapacity;
+-	IssmDouble Jdet2d,dt;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble xyz_list_tria[NUMVERTICES2D][3];
+-	IssmDouble basis[NUMVERTICES];
+-	IssmDouble D_scalar;
+-	GaussPenta *gauss=NULL;
+-
+-	/*Initialize Element matrix and return if necessary*/
+-	if (!IsOnBed() || !IsFloating()) return NULL;
+-	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+-
+-	/*Retrieve all inputs and parameters*/
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	mixed_layer_capacity=matpar->GetMixedLayerCapacity();
+-	thermal_exchange_velocity=matpar->GetThermalExchangeVelocity();
+-	rho_water=matpar->GetRhoWater();
+-	rho_ice=matpar->GetRhoIce();
+-	heatcapacity=matpar->GetHeatCapacity();
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+-
+-	/* Start looping on the number of gauss (nodes on the bedrock) */
+-	gauss=new GaussPenta(0,1,2,2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetTriaJacobianDeterminant(&Jdet2d, &xyz_list_tria[0][0], gauss);
+-		GetNodalFunctionsP1(&basis[0], gauss);
+-
+-		D_scalar=gauss->weight*Jdet2d*rho_water*mixed_layer_capacity*thermal_exchange_velocity/(rho_ice*heatcapacity);
+-		if(reCast<bool,IssmDouble>(dt)) D_scalar=dt*D_scalar;
+-
+-		TripleMultiply(&basis[0],numdof,1,0,
+-					&D_scalar,1,1,0,
+-					&basis[0],1,numdof,0,
+-					&Ke->values[0],1);
+-	}
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixMelting {{{*/
+-ElementMatrix* Penta::CreateKMatrixMelting(void){
+-
+-	if (!IsOnBed()) return NULL;
+-
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	ElementMatrix* Ke=tria->CreateKMatrixMelting();
+-
+-	delete tria->material; delete tria;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixThermal {{{*/
+-ElementMatrix* Penta::CreateKMatrixThermal(void){
+-
+-	/*compute all stiffness matrices for this element*/
+-	ElementMatrix* Ke1=CreateKMatrixThermalVolume();
+-	ElementMatrix* Ke2=CreateKMatrixThermalShelf();
+-	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
+-
+-	/*clean-up and return*/
+-	delete Ke1;
+-	delete Ke2;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixThermalVolume {{{*/
+-ElementMatrix* Penta::CreateKMatrixThermalVolume(void){
+-
+-	/*Constants*/
+-	const int    numdof=NDOF1*NUMVERTICES;
+-
+-	/*Intermediaries */
+-	int        stabilization;
+-	int        i,j;
+-	IssmDouble Jdet,u,v,w,um,vm,wm,vel;
+-	IssmDouble h,hx,hy,hz,vx,vy,vz;
+-	IssmDouble gravity,rho_ice,rho_water,kappa;
+-	IssmDouble heatcapacity,thermalconductivity,dt;
+-	IssmDouble tau_parameter,diameter;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble B_conduct[3][numdof];
+-	IssmDouble B_advec[3][numdof];
+-	IssmDouble Bprime_advec[3][numdof];
+-	IssmDouble L[numdof];
+-	IssmDouble dbasis[3][6];
+-	IssmDouble D_scalar_conduct,D_scalar_advec;
+-	IssmDouble D_scalar_trans,D_scalar_stab;
+-	IssmDouble D[3][3];
+-	IssmDouble K[3][3]={0.0};
+-	GaussPenta *gauss=NULL;
+-
+-	/*Initialize Element matrix*/
+-	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	rho_water=matpar->GetRhoWater();
+-	rho_ice=matpar->GetRhoIce();
+-	gravity=matpar->GetG();
+-	heatcapacity=matpar->GetHeatCapacity();
+-	thermalconductivity=matpar->GetThermalConductivity();
+-	kappa=thermalconductivity/(rho_ice*heatcapacity);
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	this->parameters->FindParam(&stabilization,ThermalStabilizationEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum);      _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);      _assert_(vy_input);
+-	Input* vz_input=inputs->GetInput(VzEnum);      _assert_(vz_input);
+-	Input* vxm_input=inputs->GetInput(VxMeshEnum); _assert_(vxm_input);
+-	Input* vym_input=inputs->GetInput(VyMeshEnum); _assert_(vym_input);
+-	Input* vzm_input=inputs->GetInput(VzMeshEnum); _assert_(vzm_input);
+-	if (stabilization==2) diameter=MinEdgeLength(&xyz_list[0][0]);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(2,2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-
+-		/*Conduction: */
+-
+-		GetBConduct(&B_conduct[0][0],&xyz_list[0][0],gauss); 
+-
+-		D_scalar_conduct=gauss->weight*Jdet*kappa;
+-		if(reCast<bool,IssmDouble>(dt)) D_scalar_conduct=D_scalar_conduct*dt;
+-
+-		D[0][0]=D_scalar_conduct; D[0][1]=0; D[0][2]=0;
+-		D[1][0]=0; D[1][1]=D_scalar_conduct; D[1][2]=0;
+-		D[2][0]=0; D[2][1]=0; D[2][2]=D_scalar_conduct;
+-
+-		TripleMultiply(&B_conduct[0][0],3,numdof,1,
+-					&D[0][0],3,3,0,
+-					&B_conduct[0][0],3,numdof,0,
+-					&Ke->values[0],1);
+-
+-		/*Advection: */
+-		GetBAdvec(&B_advec[0][0],&xyz_list[0][0],gauss); 
+-		GetBprimeAdvec(&Bprime_advec[0][0],&xyz_list[0][0],gauss); 
+-
+-		vx_input->GetInputValue(&u, gauss); vxm_input->GetInputValue(&um,gauss); vx=u-um;
+-		vy_input->GetInputValue(&v, gauss); vym_input->GetInputValue(&vm,gauss); vy=v-vm;
+-		vz_input->GetInputValue(&w, gauss); vzm_input->GetInputValue(&wm,gauss); vz=w-wm;
+-
+-		D_scalar_advec=gauss->weight*Jdet;
+-		if(reCast<bool,IssmDouble>(dt)) D_scalar_advec=D_scalar_advec*dt;
+-
+-		D[0][0]=D_scalar_advec*vx;    D[0][1]=0;                    D[0][2]=0;
+-		D[1][0]=0;                    D[1][1]=D_scalar_advec*vy;    D[1][2]=0;
+-		D[2][0]=0;                    D[2][1]=0;                    D[2][2]=D_scalar_advec*vz;
+-
+-		TripleMultiply(&B_advec[0][0],3,numdof,1,
+-					&D[0][0],3,3,0,
+-					&Bprime_advec[0][0],3,numdof,0,
+-					&Ke->values[0],1);
+-
+-		/*Transient: */
+-		if(reCast<bool,IssmDouble>(dt)){
+-			GetNodalFunctionsP1(&L[0], gauss);
+-			D_scalar_trans=gauss->weight*Jdet;
+-
+-			TripleMultiply(&L[0],numdof,1,0,
+-						&D_scalar_trans,1,1,0,
+-						&L[0],1,numdof,0,
+-						&Ke->values[0],1);
+-		}
+-
+-		/*Artifficial diffusivity*/
+-		if(stabilization==1){
+-			/*Build K: */
+-			ElementSizes(&hx,&hy,&hz);
+-			vel=sqrt(vx*vx + vy*vy + vz*vz)+1.e-14;
+-			h=sqrt( pow(hx*vx/vel,2) + pow(hy*vy/vel,2) + pow(hz*vz/vel,2));
+-
+-			K[0][0]=h/(2*vel)*fabs(vx*vx);  K[0][1]=h/(2*vel)*fabs(vx*vy); K[0][2]=h/(2*vel)*fabs(vx*vz);
+-			K[1][0]=h/(2*vel)*fabs(vy*vx);  K[1][1]=h/(2*vel)*fabs(vy*vy); K[1][2]=h/(2*vel)*fabs(vy*vz);
+-			K[2][0]=h/(2*vel)*fabs(vz*vx);  K[2][1]=h/(2*vel)*fabs(vz*vy); K[2][2]=h/(2*vel)*fabs(vz*vz);
+-
+-			D_scalar_stab=gauss->weight*Jdet;
+-			if(reCast<bool,IssmDouble>(dt)) D_scalar_stab=D_scalar_stab*dt;
+-			for(i=0;i<3;i++) for(j=0;j<3;j++) K[i][j] = D_scalar_stab*K[i][j];
+-
+-			GetBprimeAdvec(&Bprime_advec[0][0],&xyz_list[0][0],gauss); 
+-
+-			TripleMultiply(&Bprime_advec[0][0],3,numdof,1,
+-						&K[0][0],3,3,0,
+-						&Bprime_advec[0][0],3,numdof,0,
+-						&Ke->values[0],1);
+-		}
+-		else if(stabilization==2){
+-			GetNodalFunctionsP1Derivatives(&dbasis[0][0],&xyz_list[0][0], gauss);
+-			tau_parameter=StabilizationParameter(u-um,v-vm,w-wm,diameter,kappa);
+-
+-			for(i=0;i<numdof;i++){
+-				for(j=0;j<numdof;j++){
+-					Ke->values[i*numdof+j]+=tau_parameter*D_scalar_advec*
+-					  ((u-um)*dbasis[0][i]+(v-vm)*dbasis[1][i]+(w-wm)*dbasis[2][i])*((u-um)*dbasis[0][j]+(v-vm)*dbasis[1][j]+(w-wm)*dbasis[2][j]);
+-				}
+-			}
+-			if(reCast<bool,IssmDouble>(dt)){
+-				for(i=0;i<numdof;i++){
+-					for(j=0;j<numdof;j++){
+-						Ke->values[i*numdof+j]+=tau_parameter*D_scalar_trans*L[j]*((u-um)*dbasis[0][i]+(v-vm)*dbasis[1][i]+(w-wm)*dbasis[2][i]);
+-					}
+-				}
+-			}
+-		}
+-	}
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixThermalShelf {{{*/
+-ElementMatrix* Penta::CreateKMatrixThermalShelf(void){
+-
+-	/*Constants*/
+-	const int    numdof=NDOF1*NUMVERTICES;
+-
+-	/*Intermediaries */
+-	int       i,j;
+-	IssmDouble mixed_layer_capacity,thermal_exchange_velocity;
+-	IssmDouble rho_ice,rho_water,heatcapacity;
+-	IssmDouble Jdet2d,dt;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble xyz_list_tria[NUMVERTICES2D][3];
+-	IssmDouble basis[NUMVERTICES];
+-	IssmDouble D_scalar;
+-	GaussPenta *gauss=NULL;
+-
+-	/*Initialize Element matrix and return if necessary*/
+-	if (!IsOnBed() || !IsFloating()) return NULL;
+-	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+-
+-	/*Retrieve all inputs and parameters*/
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	mixed_layer_capacity=matpar->GetMixedLayerCapacity();
+-	thermal_exchange_velocity=matpar->GetThermalExchangeVelocity();
+-	rho_water=matpar->GetRhoWater();
+-	rho_ice=matpar->GetRhoIce();
+-	heatcapacity=matpar->GetHeatCapacity();
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+-
+-	/* Start looping on the number of gauss (nodes on the bedrock) */
+-	gauss=new GaussPenta(0,1,2,2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetTriaJacobianDeterminant(&Jdet2d, &xyz_list_tria[0][0], gauss);
+-		GetNodalFunctionsP1(&basis[0], gauss);
+-
+-		D_scalar=gauss->weight*Jdet2d*rho_water*mixed_layer_capacity*thermal_exchange_velocity/(heatcapacity*rho_ice);
+-		if(reCast<bool,IssmDouble>(dt)) D_scalar=dt*D_scalar;
+-
+-		TripleMultiply(&basis[0],numdof,1,0,
+-					&D_scalar,1,1,0,
+-					&basis[0],1,numdof,0,
+-					&Ke->values[0],1);
+-	}
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::UpdateBasalConstraintsEnthalpy{{{*/
+ void  Penta::UpdateBasalConstraintsEnthalpy(void){
+ 
+@@ -4281,201 +3645,6 @@
+ 	vector_gradient->SetValues(NUMVERTICES,&sidlist[0],&gradients[0],ADD_VAL);
+ 
+ }/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixAdjointHoriz{{{*/
+-ElementMatrix* Penta::CreateKMatrixAdjointHoriz(void){
+-
+-	int approximation;
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-
+-	switch(approximation){
+-		case SSAApproximationEnum:
+-			return CreateKMatrixAdjointSSA2d();
+-		case HOApproximationEnum:
+-			return CreateKMatrixAdjointHO();
+-		case FSApproximationEnum:
+-			return CreateKMatrixAdjointFS();
+-		case NoneApproximationEnum:
+-			return NULL;
+-		default:
+-			_error_("Approximation " << EnumToStringx(approximation) << " not supported yet");
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixAdjointSSA2d{{{*/
+-ElementMatrix* Penta::CreateKMatrixAdjointSSA2d(void){
+-
+-	/*Figure out if this penta is collapsed. If so, then bailout, except if it is at the 
+-	  bedrock, in which case we spawn a tria element using the 3 first nodes, and use it to build 
+-	  the stiffness matrix. */
+-	if (!IsOnBed()) return NULL;
+-
+-	/*Depth average some fields*/
+-	switch(this->material->ObjectEnum()){
+-		case MaticeEnum:
+-			this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum,MaterialsEnum);
+-			this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum,MaterialsEnum);
+-			break;
+-		default:
+-			_error_("material "<<EnumToStringx(this->material->ObjectEnum())<<" not supported");
+-	}
+-
+-	/*Call Tria function*/
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	ElementMatrix* Ke=tria->CreateKMatrixAdjointSSA();
+-	delete tria->material; delete tria;
+-
+-	/*Delete averaged fields*/
+-	this->material->inputs->DeleteInput(MaterialsRheologyBbarEnum);
+-	this->material->inputs->DeleteInput(DamageDbarEnum);
+-
+-	/*clean up and return*/
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixAdjointHO{{{*/
+-ElementMatrix* Penta::CreateKMatrixAdjointHO(void){
+-
+-	/*Intermediaries */
+-	int        i,j;
+-	bool       incomplete_adjoint;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble Jdet;
+-	IssmDouble eps1dotdphii,eps1dotdphij;
+-	IssmDouble eps2dotdphii,eps2dotdphij;
+-	IssmDouble mu_prime;
+-	IssmDouble epsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/
+-	IssmDouble eps1[3],eps2[3];
+-	IssmDouble dphi[3][NUMVERTICES];
+-	GaussPenta *gauss=NULL;
+-
+-	/*Initialize Jacobian with regular HO (first part of the Gateau derivative)*/
+-	parameters->FindParam(&incomplete_adjoint,InversionIncompleteAdjointEnum);
+-	ElementMatrix* Ke=CreateKMatrixStressbalanceHO();
+-	if(incomplete_adjoint) return Ke;
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* vx_input=inputs->GetInput(VxEnum);       _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);       _assert_(vy_input);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(5,5);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctionsP1Derivatives(&dphi[0][0],&xyz_list[0][0],gauss);
+-
+-		this->StrainRateHO(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+-		material->GetViscosityDerivativeEpsSquare(&mu_prime,&epsilon[0]);
+-		eps1[0]=2*epsilon[0]+epsilon[1];   eps2[0]=epsilon[2];
+-		eps1[1]=epsilon[2];                eps2[1]=epsilon[0]+2*epsilon[1];
+-		eps1[2]=epsilon[3];                eps2[2]=epsilon[4];
+-
+-		for(i=0;i<6;i++){
+-			for(j=0;j<6;j++){
+-				eps1dotdphii=eps1[0]*dphi[0][i]+eps1[1]*dphi[1][i]+eps1[2]*dphi[2][i];
+-				eps1dotdphij=eps1[0]*dphi[0][j]+eps1[1]*dphi[1][j]+eps1[2]*dphi[2][j];
+-				eps2dotdphii=eps2[0]*dphi[0][i]+eps2[1]*dphi[1][i]+eps2[2]*dphi[2][i];
+-				eps2dotdphij=eps2[0]*dphi[0][j]+eps2[1]*dphi[1][j]+eps2[2]*dphi[2][j];
+-
+-				Ke->values[12*(2*i+0)+2*j+0]+=gauss->weight*Jdet*2*mu_prime*eps1dotdphij*eps1dotdphii;
+-				Ke->values[12*(2*i+0)+2*j+1]+=gauss->weight*Jdet*2*mu_prime*eps2dotdphij*eps1dotdphii;
+-				Ke->values[12*(2*i+1)+2*j+0]+=gauss->weight*Jdet*2*mu_prime*eps1dotdphij*eps2dotdphii;
+-				Ke->values[12*(2*i+1)+2*j+1]+=gauss->weight*Jdet*2*mu_prime*eps2dotdphij*eps2dotdphii;
+-			}
+-		}
+-	}
+-
+-	/*Transform Coordinate System*/
+-	::TransformStiffnessMatrixCoord(Ke,nodes,NUMVERTICES,XYEnum);
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixAdjointFS{{{*/
+-ElementMatrix* Penta::CreateKMatrixAdjointFS(void){
+-
+-	/*Intermediaries */
+-	int        i,j;
+-	bool       incomplete_adjoint;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble Jdet;
+-	IssmDouble eps1dotdphii,eps1dotdphij;
+-	IssmDouble eps2dotdphii,eps2dotdphij;
+-	IssmDouble eps3dotdphii,eps3dotdphij;
+-	IssmDouble mu_prime;
+-	IssmDouble epsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/
+-	IssmDouble eps1[3],eps2[3],eps3[3];
+-	IssmDouble dphi[3][NUMVERTICES];
+-	GaussPenta *gauss=NULL;
+-
+-	/*Initialize Jacobian with regular FS (first part of the Gateau derivative)*/
+-	parameters->FindParam(&incomplete_adjoint,InversionIncompleteAdjointEnum);
+-	ElementMatrix* Ke=CreateKMatrixStressbalanceFS();
+-	if(incomplete_adjoint) return Ke;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumnodes = this->NumberofNodesPressure();
+-	int numdof    = vnumnodes*NDOF3 + pnumnodes*NDOF1;
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* vx_input=inputs->GetInput(VxEnum);       _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);       _assert_(vy_input);
+-	Input* vz_input=inputs->GetInput(VzEnum);       _assert_(vz_input);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(5,5);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctionsP1Derivatives(&dphi[0][0],&xyz_list[0][0],gauss);
+-
+-		this->StrainRateHO(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+-		material->GetViscosityDerivativeEpsSquare(&mu_prime,&epsilon[0]);
+-		eps1[0]=epsilon[0];   eps2[0]=epsilon[2];   eps3[0]=epsilon[3];
+-		eps1[1]=epsilon[2];   eps2[1]=epsilon[1];   eps3[1]=epsilon[4];
+-		eps1[2]=epsilon[3];   eps2[2]=epsilon[4];   eps3[2]= -epsilon[0] -epsilon[1];
+-
+-		for(i=0;i<6;i++){
+-			for(j=0;j<6;j++){
+-				eps1dotdphii=eps1[0]*dphi[0][i]+eps1[1]*dphi[1][i]+eps1[2]*dphi[2][i];
+-				eps1dotdphij=eps1[0]*dphi[0][j]+eps1[1]*dphi[1][j]+eps1[2]*dphi[2][j];
+-				eps2dotdphii=eps2[0]*dphi[0][i]+eps2[1]*dphi[1][i]+eps2[2]*dphi[2][i];
+-				eps2dotdphij=eps2[0]*dphi[0][j]+eps2[1]*dphi[1][j]+eps2[2]*dphi[2][j];
+-				eps3dotdphii=eps3[0]*dphi[0][i]+eps3[1]*dphi[1][i]+eps3[2]*dphi[2][i];
+-				eps3dotdphij=eps3[0]*dphi[0][j]+eps3[1]*dphi[1][j]+eps3[2]*dphi[2][j];
+-
+-				Ke->values[numdof*(4*i+0)+4*j+0]+=gauss->weight*Jdet*2*mu_prime*eps1dotdphij*eps1dotdphii;
+-				Ke->values[numdof*(4*i+0)+4*j+1]+=gauss->weight*Jdet*2*mu_prime*eps2dotdphij*eps1dotdphii;
+-				Ke->values[numdof*(4*i+0)+4*j+2]+=gauss->weight*Jdet*2*mu_prime*eps3dotdphij*eps1dotdphii;
+-
+-				Ke->values[numdof*(4*i+1)+4*j+0]+=gauss->weight*Jdet*2*mu_prime*eps1dotdphij*eps2dotdphii;
+-				Ke->values[numdof*(4*i+1)+4*j+1]+=gauss->weight*Jdet*2*mu_prime*eps2dotdphij*eps2dotdphii;
+-				Ke->values[numdof*(4*i+1)+4*j+2]+=gauss->weight*Jdet*2*mu_prime*eps3dotdphij*eps2dotdphii;
+-
+-				Ke->values[numdof*(4*i+2)+4*j+0]+=gauss->weight*Jdet*2*mu_prime*eps1dotdphij*eps3dotdphii;
+-				Ke->values[numdof*(4*i+2)+4*j+1]+=gauss->weight*Jdet*2*mu_prime*eps2dotdphij*eps3dotdphii;
+-				Ke->values[numdof*(4*i+2)+4*j+2]+=gauss->weight*Jdet*2*mu_prime*eps3dotdphij*eps3dotdphii;
+-			}
+-		}
+-	}
+-
+-	/*Transform Coordinate System*/
+-	::TransformStiffnessMatrixCoord(Ke,nodes,NUMVERTICES,XYZEnum);
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::GradientIndexing{{{*/
+ void Penta::GradientIndexing(int* indexing,int control_index){
+ 
+@@ -5350,1106 +4519,6 @@
+ 	return De;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::CreateKMatrixCouplingSSAHO{{{*/
+-ElementMatrix* Penta::CreateKMatrixCouplingSSAHO(void){
+-
+-	/*compute all stiffness matrices for this element*/
+-	ElementMatrix* Ke1=CreateKMatrixCouplingSSAHOViscous();
+-	ElementMatrix* Ke2=CreateKMatrixCouplingSSAHOFriction();
+-	ElementMatrix* Ke=new ElementMatrix(Ke1,Ke2);
+-
+-	/*clean-up and return*/
+-	delete Ke1;
+-	delete Ke2;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixCouplingSSAHOViscous{{{*/
+-ElementMatrix* Penta::CreateKMatrixCouplingSSAHOViscous(void){
+-
+-	/*Constants*/
+-	const int numnodes    = 2 *NUMVERTICES;
+-	const int numdofm     = NDOF2 *NUMVERTICES2D;
+-	const int numdofp     = NDOF2 *NUMVERTICES;
+-	const int numdoftotal = 2 *NDOF2*NUMVERTICES;
+-
+-	/*Intermediaries */
+-	int         i,j;
+-	IssmDouble  Jdet;
+-	IssmDouble  viscosity,oldviscosity,newviscosity,viscosity_overshoot; //viscosity
+-	IssmDouble  epsilon[5],oldepsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble  B[3][numdofp];
+-	IssmDouble  Bprime[3][numdofm];
+-	IssmDouble  D[3][3]={0.0};            // material matrix, simple scalar matrix.
+-	IssmDouble  D_scalar;
+-	IssmDouble  Ke_gg[numdofp][numdofm]={0.0}; //local element stiffness matrix 
+-	IssmDouble  Ke_gg_gaussian[numdofp][numdofm]; //stiffness matrix evaluated at the gaussian point.
+-	GaussPenta *gauss=NULL;
+-	GaussTria  *gauss_tria=NULL;
+-	Node       *node_list[numnodes];
+-	int         cs_list[numnodes];
+-
+-	/*Find penta on bed as HO must be coupled to the dofs on the bed: */
+-	Penta* pentabase=(Penta*)GetBasalElement();
+-	Tria*  tria=pentabase->SpawnTria(0); //lower face is 0, upper face is 1.
+-
+-	/*prepare node list*/
+-	for(i=0;i<NUMVERTICES;i++){
+-		node_list[i+0*NUMVERTICES] = pentabase->nodes[i];
+-		node_list[i+1*NUMVERTICES] = this->nodes[i];
+-		cs_list[i+0*NUMVERTICES] = XYEnum;
+-		cs_list[i+1*NUMVERTICES] = XYEnum;
+-	}
+-
+-	/*Initialize Element matrix*/
+-	ElementMatrix* Ke1=new ElementMatrix(pentabase->nodes,NUMVERTICES,this->parameters,SSAApproximationEnum);
+-	ElementMatrix* Ke2=new ElementMatrix(this->nodes     ,NUMVERTICES,this->parameters,HOApproximationEnum);
+-	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
+-	delete Ke1; delete Ke2;
+-
+-	/* Get node coordinates and dof list: */
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&viscosity_overshoot,StressbalanceViscosityOvershootEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum);       _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);       _assert_(vy_input);
+-	Input* vxold_input=inputs->GetInput(VxPicardEnum); _assert_(vxold_input);
+-	Input* vyold_input=inputs->GetInput(VyPicardEnum); _assert_(vyold_input);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(5,5);
+-	gauss_tria=new GaussTria();
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-		gauss->SynchronizeGaussBase(gauss_tria);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetBSSAHO(&B[0][0], &xyz_list[0][0], gauss);
+-		tria->GetBprimeSSA(&Bprime[0][0], &xyz_list[0][0], gauss_tria);
+-
+-		this->StrainRateHO(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+-		this->StrainRateHO(&oldepsilon[0],&xyz_list[0][0],gauss,vxold_input,vyold_input);
+-		material->GetViscosity3d(&viscosity, &epsilon[0]);
+-		material->GetViscosity3d(&oldviscosity, &oldepsilon[0]);
+-
+-		newviscosity=viscosity+viscosity_overshoot*(viscosity-oldviscosity);
+-		D_scalar=2*newviscosity*gauss->weight*Jdet;
+-		for (i=0;i<3;i++) D[i][i]=D_scalar;
+-
+-		TripleMultiply( &B[0][0],3,numdofp,1,
+-					&D[0][0],3,3,0,
+-					&Bprime[0][0],3,numdofm,0,
+-					&Ke_gg_gaussian[0][0],0);
+-
+-		for( i=0; i<numdofp; i++) for(j=0;j<numdofm; j++) Ke_gg[i][j]+=Ke_gg_gaussian[i][j];
+-	} 
+-	for(i=0;i<numdofp;i++) for(j=0;j<numdofm;j++) Ke->values[(i+2*numdofm)*numdoftotal+j]+=Ke_gg[i][j];
+-	for(i=0;i<numdofm;i++) for(j=0;j<numdofp;j++) Ke->values[i*numdoftotal+(j+2*numdofm)]+=Ke_gg[j][i];
+-
+-	/*Transform Coordinate System*/
+-	::TransformStiffnessMatrixCoord(Ke,node_list,numnodes,cs_list);
+-
+-	/*Clean-up and return*/
+-	delete tria->material; delete tria;
+-	delete gauss;
+-	delete gauss_tria;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixCouplingSSAHOFriction{{{*/
+-ElementMatrix* Penta::CreateKMatrixCouplingSSAHOFriction(void){
+-
+-	/*Constants*/
+-	const int numnodes    = 2 *NUMVERTICES;
+-	const int numdof      = NDOF2 *NUMVERTICES;
+-	const int numdoftotal = NDOF4 *NUMVERTICES;
+-
+-	/*Intermediaries */
+-	int       i,j,analysis_type;
+-	IssmDouble Jdet2d,alpha2;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble xyz_list_tria[NUMVERTICES2D][3]={0.0};
+-	IssmDouble L[2][numdof];
+-	IssmDouble DL[2][2]                  ={{ 0,0 },{0,0}}; //for basal drag
+-	IssmDouble DL_scalar;
+-	IssmDouble Ke_gg[numdof][numdof]     ={0.0};
+-	IssmDouble Ke_gg_gaussian[numdof][numdof]; //stiffness matrix contribution from drag
+-	Friction  *friction = NULL;
+-	GaussPenta *gauss=NULL;
+-	Node       *node_list[numnodes];
+-	int         cs_list[numnodes];
+-
+-	/*Initialize Element matrix and return if necessary*/
+-	if(IsFloating() || !IsOnBed()) return NULL;
+-	ElementMatrix* Ke1=new ElementMatrix(nodes,NUMVERTICES,this->parameters,SSAApproximationEnum);
+-	ElementMatrix* Ke2=new ElementMatrix(nodes,NUMVERTICES,this->parameters,HOApproximationEnum);
+-	ElementMatrix* Ke=new ElementMatrix(Ke1,Ke2);
+-	delete Ke1; delete Ke2;
+-
+-	/*Prepare node list*/
+-	for(i=0;i<NUMVERTICES;i++){
+-		node_list[i+0*NUMVERTICES] = this->nodes[i];
+-		node_list[i+1*NUMVERTICES] = this->nodes[i];
+-		cs_list[i+0*NUMVERTICES] = XYEnum;
+-		cs_list[i+1*NUMVERTICES] = XYEnum;
+-	}
+-
+-	/*retrieve inputs :*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+-	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum);           _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);           _assert_(vy_input);
+-	Input* vz_input=inputs->GetInput(VzEnum);           _assert_(vz_input);
+-
+-	/*build friction object, used later on: */
+-	friction=new Friction(this,2);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(0,1,2,2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		/*Friction: */
+-		friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input);
+-
+-		GetTriaJacobianDeterminant(&Jdet2d, &xyz_list_tria[0][0],gauss);
+-		GetBHOFriction(&L[0][0],gauss);
+-
+-		DL_scalar=alpha2*gauss->weight*Jdet2d;
+-		for (i=0;i<2;i++) DL[i][i]=DL_scalar; 
+-
+-		/*  Do the triple producte tL*D*L: */
+-		TripleMultiply( &L[0][0],2,numdof,1,
+-					&DL[0][0],2,2,0,
+-					&L[0][0],2,numdof,0,
+-					&Ke_gg_gaussian[0][0],0);
+-
+-		for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke_gg[i][j]+=Ke_gg_gaussian[i][j];
+-	}
+-
+-	for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke->values[i*numdoftotal+(numdof+j)]+=Ke_gg[i][j];
+-	for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke->values[(i+numdof)*numdoftotal+j]+=Ke_gg[i][j];
+-
+-	/*Transform Coordinate System*/
+-	::TransformStiffnessMatrixCoord(Ke,node_list,numnodes,cs_list);
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	delete friction;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixCouplingSSAFS{{{*/
+-ElementMatrix* Penta::CreateKMatrixCouplingSSAFS(void){
+-
+-	/*compute all stiffness matrices for this element*/
+-	ElementMatrix* Ke1=CreateKMatrixCouplingSSAFSViscous();
+-	ElementMatrix* Ke2=CreateKMatrixCouplingSSAFSFriction();
+-	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
+-
+-	/*clean-up and return*/
+-	delete Ke1;
+-	delete Ke2;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixCouplingSSAFSViscous{{{*/
+-ElementMatrix* Penta::CreateKMatrixCouplingSSAFSViscous(void){
+-
+-	/*Constants*/
+-	const int numdofm     = NDOF2 *NUMVERTICES2D;
+-	const int numdofs     = NDOF4 *NUMVERTICES + NDOF3;
+-	const int numdoftotal = 2 *numdofm+numdofs;
+-
+-	/*Intermediaries */
+-	int        i,j;
+-	IssmDouble Jdet;
+-	IssmDouble viscosity,FSreconditioning; //viscosity
+-	IssmDouble epsilon[6]; /* epsilon=[exx,eyy,exy,exz,eyz];*/
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble B[4][numdofs];
+-	IssmDouble Bprime[4][numdofm];
+-	IssmDouble B2[3][numdofm];
+-	IssmDouble Bprime2[3][numdofs];
+-	IssmDouble D[4][4]={0.0};            // material matrix, simple scalar matrix.
+-	IssmDouble D2[3][3]={0.0};            // material matrix, simple scalar matrix.
+-	IssmDouble D_scalar;
+-	IssmDouble Ke_gg[numdofs][numdofm]={0.0}; //local element stiffness matrix 
+-	IssmDouble Ke_gg2[numdofm][numdofs]={0.0}; //local element stiffness matrix 
+-	IssmDouble Ke_gg_gaussian[numdofs][numdofm]; //stiffness matrix evaluated at the gaussian point.
+-	IssmDouble Ke_gg_gaussian2[numdofm][numdofs]; //stiffness matrix evaluated at the gaussian point.
+-	GaussPenta *gauss=NULL;
+-	GaussTria  *gauss_tria=NULL;
+-	Node       *node_list[20];
+-
+-	/*Find penta on bed as FS must be coupled to the dofs on the bed: */
+-	Penta* pentabase=(Penta*)GetBasalElement();
+-	Tria* tria=pentabase->SpawnTria(0); //lower face is 0, upper face is 1.
+-
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumnodes = this->NumberofNodesPressure();
+-	int numnodes  = 2*vnumnodes-1+pnumnodes;
+-
+-	/*Prepare node list*/
+-	int* cs_list = xNew<int>(2*vnumnodes+pnumnodes);
+-	for(i=0;i<vnumnodes-1;i++){
+-		node_list[i] = pentabase->nodes[i];
+-		cs_list[i] = XYEnum;
+-	}
+-	for(i=0;i<vnumnodes;i++){
+-		node_list[i+vnumnodes-1] = this->nodes[i];
+-		cs_list[i+vnumnodes-1] = XYZEnum;
+-	}
+-	for(i=0;i<pnumnodes;i++){
+-		node_list[2*vnumnodes-1+i] = this->nodes[vnumnodes+i];
+-		cs_list[2*vnumnodes-1+i] = PressureEnum;
+-	}
+-
+-	/*Initialize Element matrix and return if necessary*/
+-	ElementMatrix* Ke1=new ElementMatrix(pentabase->nodes,NUMVERTICES,    this->parameters,SSAApproximationEnum);
+-	ElementMatrix* Ke2=new ElementMatrix(this->nodes     ,2*NUMVERTICES+1,this->parameters,FSvelocityEnum);
+-	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
+-	delete Ke1; delete Ke2;
+-
+-	/* Get node coordinates and dof list: */
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum);       _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);       _assert_(vy_input);
+-	Input* vz_input=inputs->GetInput(VzEnum);       _assert_(vz_input);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(5,5);
+-	gauss_tria=new GaussTria();
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-		gauss->SynchronizeGaussBase(gauss_tria);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetBSSAFS(&B[0][0], &xyz_list[0][0], gauss);
+-		tria->GetBprimeSSAFS(&Bprime[0][0], &xyz_list[0][0], gauss_tria);
+-		tria->GetBSSAFS(&B2[0][0], &xyz_list[0][0], gauss_tria);
+-		GetBprimeSSAFS(&Bprime2[0][0], &xyz_list[0][0], gauss);
+-
+-		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+-		material->GetViscosity3dFS(&viscosity, &epsilon[0]);
+-
+-		D_scalar=2*viscosity*gauss->weight*Jdet;
+-		for (i=0;i<3;i++) D[i][i]=D_scalar;
+-		D[3][3]=-gauss->weight*Jdet*FSreconditioning;
+-		for (i=0;i<3;i++) D2[i][i]=D_scalar;
+-
+-		TripleMultiply( &B[0][0],4,numdofs,1,
+-					&D[0][0],4,4,0,
+-					&Bprime[0][0],4,numdofm,0,
+-					&Ke_gg_gaussian[0][0],0);
+-
+-		TripleMultiply( &B2[0][0],3,numdofm,1,
+-					&D2[0][0],3,3,0,
+-					&Bprime2[0][0],3,numdofs,0,
+-					&Ke_gg_gaussian2[0][0],0);
+-
+-		for( i=0; i<numdofs; i++) for(j=0;j<numdofm; j++)      Ke_gg[i][j]+=Ke_gg_gaussian[i][j];
+-		for( i=0; i<numdofm; i++)      for(j=0;j<numdofs; j++) Ke_gg2[i][j]+=Ke_gg_gaussian2[i][j];
+-	} 
+-	for(i=0;i<numdofs;i++) for(j=0;j<numdofm;j++)      Ke->values[(i+2*numdofm)*numdoftotal+j]+=Ke_gg[i][j];
+-	for(i=0;i<numdofm;i++)      for(j=0;j<numdofs;j++) Ke->values[i*numdoftotal+(j+2*numdofm)]+=Ke_gg2[i][j];
+-
+-	/*Transform Coordinate System*/
+-	::TransformStiffnessMatrixCoord(Ke,node_list,numnodes,cs_list);
+-
+-	/*Clean-up and return*/
+-	xDelete<int>(cs_list);
+-	delete tria->material; delete tria;
+-	delete gauss;
+-	delete gauss_tria;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixCouplingSSAFSFriction {{{*/
+-ElementMatrix* Penta::CreateKMatrixCouplingSSAFSFriction(void){
+-	/*Constants*/
+-	const int numdofs   = (NUMVERTICES+1)*NDOF3 + NUMVERTICES*NDOF1;
+-	const int numdofm   = NUMVERTICES *NDOF2;
+-	const int numdof2d  = NUMVERTICES2D *NDOF3;
+-	const int numdof2dm = NUMVERTICES2D *NDOF2;
+-	const int numdoftot = NUMVERTICES*2 + (NUMVERTICES+1)*3 +NUMVERTICES; // HO + FS vel + FS Pressure
+-
+-	/*Intermediaries */
+-	int        i,j;
+-	int        analysis_type,approximation;
+-	IssmDouble FSreconditioning;
+-	IssmDouble viscosity,alpha2_gauss,Jdet2d;
+-	IssmDouble bed_normal[3];
+-	IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble xyz_list_tria[NUMVERTICES2D][3];
+-	IssmDouble LSSAFS[8][numdof2dm];
+-	IssmDouble LprimeSSAFS[8][numdofs];
+-	IssmDouble DLSSAFS[8][8]={0.0};
+-	IssmDouble LFSSSA[4][numdof2d];
+-	IssmDouble LprimeFSSSA[4][numdof2dm];
+-	IssmDouble DLFSSSA[4][4]={0.0};
+-	IssmDouble Ke_drag_gaussian[numdof2dm][numdofs];
+-	IssmDouble Ke_drag_gaussian2[numdof2d][numdof2dm];
+-	Friction*  friction=NULL;
+-	GaussPenta *gauss=NULL;
+-	Node       *node_list[20];
+-
+-	/*If on water or not FS, skip stiffness: */
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-	if(IsFloating() || !IsOnBed()) return NULL;
+-
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumnodes = this->NumberofNodesPressure();
+-	int numnodes  = 2*vnumnodes-1+pnumnodes;
+-
+-	/*Prepare node list*/
+-	int* cs_list = xNew<int>(2*vnumnodes+pnumnodes);
+-	for(i=0;i<vnumnodes-1;i++){
+-		node_list[i] = this->nodes[i];
+-		cs_list[i] = XYEnum;
+-	}
+-	for(i=0;i<vnumnodes;i++){
+-		node_list[i+vnumnodes-1] = this->nodes[i];
+-		cs_list[i+vnumnodes-1] = XYZEnum;
+-	}
+-	for(i=0;i<pnumnodes;i++){
+-		node_list[2*vnumnodes-1+i] = this->nodes[vnumnodes+i];
+-		cs_list[2*vnumnodes-1+i] = PressureEnum;
+-	}
+-
+-	ElementMatrix* Ke1=new ElementMatrix(this->nodes,NUMVERTICES,        this->parameters,SSAApproximationEnum);
+-	ElementMatrix* Ke2=new ElementMatrix(this->nodes,vnumnodes+pnumnodes,this->parameters,FSvelocityEnum);
+-	ElementMatrix* Ke=new ElementMatrix(Ke1,Ke2);
+-	delete Ke1; delete Ke2;
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-	parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+-	Input* vz_input=inputs->GetInput(VzEnum); _assert_(vz_input);
+-	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+-
+-	/*build friction object, used later on: */
+-	friction=new Friction(this,3);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(0,1,2,2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetTriaJacobianDeterminant(&Jdet2d, &xyz_list_tria[0][0],gauss);
+-		GetLSSAFS(&LSSAFS[0][0], gauss);
+-		GetLprimeSSAFS(&LprimeSSAFS[0][0], &xyz_list[0][0], gauss);
+-		GetLFSSSA(&LFSSSA[0][0], gauss);
+-		GetLprimeFSSSA(&LprimeFSSSA[0][0], &xyz_list[0][0], gauss);
+-
+-		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+-		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+-
+-		NormalBase(&bed_normal[0],&xyz_list_tria[0][0]);
+-		friction->GetAlpha2(&alpha2_gauss, gauss,vx_input,vy_input,vz_input);
+-
+-		DLSSAFS[0][0]=alpha2_gauss*gauss->weight*Jdet2d;
+-		DLSSAFS[1][1]=alpha2_gauss*gauss->weight*Jdet2d;
+-		DLSSAFS[2][2]=-alpha2_gauss*gauss->weight*Jdet2d*bed_normal[0]*bed_normal[2];
+-		DLSSAFS[3][3]=-alpha2_gauss*gauss->weight*Jdet2d*bed_normal[1]*bed_normal[2];
+-		DLSSAFS[4][4]=-2*viscosity*gauss->weight*Jdet2d*bed_normal[0];
+-		DLSSAFS[5][5]=-2*viscosity*gauss->weight*Jdet2d*bed_normal[1];
+-		DLSSAFS[6][6]=FSreconditioning*gauss->weight*Jdet2d*bed_normal[0];
+-		DLSSAFS[7][7]=FSreconditioning*gauss->weight*Jdet2d*bed_normal[1];
+-
+-		DLFSSSA[0][0]=alpha2_gauss*gauss->weight*Jdet2d;
+-		DLFSSSA[1][1]=alpha2_gauss*gauss->weight*Jdet2d;
+-		DLFSSSA[2][2]=-alpha2_gauss*gauss->weight*Jdet2d*bed_normal[0]*bed_normal[2];
+-		DLFSSSA[3][3]=-alpha2_gauss*gauss->weight*Jdet2d*bed_normal[1]*bed_normal[2];
+-
+-		TripleMultiply( &LSSAFS[0][0],8,numdof2dm,1,
+-					&DLSSAFS[0][0],8,8,0,
+-					&LprimeSSAFS[0][0],8,numdofs,0,
+-					&Ke_drag_gaussian[0][0],0);
+-
+-		TripleMultiply( &LFSSSA[0][0],4,numdof2d,1,
+-					&DLFSSSA[0][0],4,4,0,
+-					&LprimeFSSSA[0][0],4,numdof2dm,0,
+-					&Ke_drag_gaussian2[0][0],0);
+-		for(i=0;i<numdof2dm;i++) for(j=0;j<numdofs;j++) Ke->values[i*numdoftot+j+numdofm]+=Ke_drag_gaussian[i][j];
+-		for(i=0;i<numdof2d;i++) for(j=0;j<numdof2dm;j++) Ke->values[(i+numdofm)*numdoftot+j]+=Ke_drag_gaussian2[i][j];
+-	}
+-
+-	/*Transform Coordinate System*/
+-	::TransformStiffnessMatrixCoord(Ke,node_list,numnodes,cs_list);
+-
+-	/*Clean up and return*/
+-	xDelete<int>(cs_list);
+-	delete gauss;
+-	delete friction;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixCouplingHOFS{{{*/
+-ElementMatrix* Penta::CreateKMatrixCouplingHOFS(void){
+-
+-	/*Constants*/
+-	const int numnodes       = 3 *NUMVERTICES+1;
+-	const int numdofp        = NDOF2 *NUMVERTICES;
+-	const int numdofs        = NDOF4 * 6 + NDOF3;
+-	const int numdoftotal    = (NDOF2+NDOF4) *NUMVERTICES + NDOF3;
+-
+-	/*Intermediaries*/
+-	int   i,j,init;
+-	Node  *node_list[NUMVERTICES*3+1];
+-	int   cs_list[NUMVERTICES*3+1];
+-	int   cs_list2[NUMVERTICES*2+1];
+-
+-	/*Some parameters needed*/
+-	init=this->element_type;
+-
+-	/*prepare node list*/
+-	for(i=0;i<NUMVERTICES+1;i++){
+-		node_list[i+NUMVERTICES] = this->nodes[i];
+-		cs_list[i+NUMVERTICES]   = XYZEnum;
+-		cs_list2[i]              = XYZEnum;
+-	}
+-	for(i=0;i<NUMVERTICES;i++){
+-		node_list[i]                 = this->nodes[i];
+-		node_list[i+2*NUMVERTICES+1] = this->nodes[i+NUMVERTICES+1];
+-		cs_list[i]                   = XYEnum;
+-		cs_list[i+2*NUMVERTICES+1]   = PressureEnum;
+-		cs_list2[i+NUMVERTICES+1]    = PressureEnum;
+-	}
+-
+-	/*compute all stiffness matrices for this element*/
+-	ElementMatrix* Ke1=new ElementMatrix(this->nodes,NUMVERTICES,this->parameters,HOApproximationEnum);
+-	ElementMatrix* Ke2=new ElementMatrix(this->nodes,2*NUMVERTICES+1,this->parameters,FSvelocityEnum);
+-	ElementMatrix* Ke=new ElementMatrix(Ke1,Ke2);
+-	delete Ke1; delete Ke2;
+-
+-	/*Compute HO Matrix with P1 element type\n");*/
+-	this->element_type=P1Enum;
+-	Ke1=CreateKMatrixStressbalanceHO(); TransformInvStiffnessMatrixCoord(Ke1,XYEnum);
+-	this->element_type=init;
+-	/*Compute FS Matrix and condense it \n");*/
+-	Ke2=CreateKMatrixStressbalanceFS(); TransformInvStiffnessMatrixCoord(Ke2,node_list,2*NUMVERTICES+1,cs_list2);
+-	int indices[3]={18,19,20};
+-	Ke2->StaticCondensation(3,&indices[0]);
+-
+-	for(i=0;i<numdofs;i++) for(j=0;j<NUMVERTICES;j++){
+-		Ke->values[(i+numdofp)*numdoftotal+NDOF2*j+0]+=Ke2->values[i*numdofs+NDOF3*j+0];
+-		Ke->values[(i+numdofp)*numdoftotal+NDOF2*j+1]+=Ke2->values[i*numdofs+NDOF3*j+1];
+-	}
+-	for(i=0;i<numdofp;i++) for(j=0;j<NUMVERTICES;j++){
+-		Ke->values[i*numdoftotal+numdofp+NDOF3*j+0]+=Ke1->values[i*numdofp+NDOF2*j+0];
+-		Ke->values[i*numdoftotal+numdofp+NDOF3*j+1]+=Ke1->values[i*numdofp+NDOF2*j+1];
+-	}
+-
+-	/*Transform Coordinate System*/ //Do not transform, already done in the matrices
+-	::TransformStiffnessMatrixCoord(Ke,node_list,numnodes,cs_list);
+-
+-	/*clean-up and return*/
+-	delete Ke1;
+-	delete Ke2;
+-	return Ke;
+-}
+-//*}}}*/
+-/*FUNCTION Penta::CreateKMatrixStressbalanceHoriz {{{*/
+-ElementMatrix* Penta::CreateKMatrixStressbalanceHoriz(void){
+-
+-	int approximation;
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-	switch(approximation){
+-		case SSAApproximationEnum:
+-			return CreateKMatrixStressbalanceSSA2d();
+-		case L1L2ApproximationEnum:
+-			return CreateKMatrixStressbalanceL1L2();
+-		case HOApproximationEnum:
+-			return CreateKMatrixStressbalanceHO();
+-		case FSApproximationEnum:
+-			return CreateKMatrixStressbalanceFS();
+-		case SIAApproximationEnum:
+-			return NULL;
+-		case NoneApproximationEnum:
+-			return NULL;
+-		case SSAHOApproximationEnum:
+-			return CreateKMatrixStressbalanceSSAHO();
+-		case SSAFSApproximationEnum:
+-			return CreateKMatrixStressbalanceSSAFS();
+-		case HOFSApproximationEnum:
+-			return CreateKMatrixStressbalanceHOFS();
+-		default:
+-			_error_("Approximation " << EnumToStringx(approximation) << " not supported yet");
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixStressbalanceSIA{{{*/
+-ElementMatrix* Penta::CreateKMatrixStressbalanceSIA(void){
+-
+-	/*Intermediaries*/
+-	IssmDouble connectivity[2];
+-	IssmDouble one0,one1;
+-	int        i,i0,i1,j0,j1;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes(); _assert_(numnodes==6); 
+-	int numdof   = numnodes*NDOF2;
+-
+-	/*Initialize Element matrix*/
+-	ElementMatrix* Ke=new ElementMatrix(nodes,numnodes,this->parameters,NoneApproximationEnum);
+-
+-	/*3 vertical edges*/
+-	for(i=0;i<3;i++){
+-
+-		/*2 dofs of first node*/
+-		i0=2*i;     i1=2*i+1;
+-		/*2 dofs of second node*/
+-		j0=2*(i+3); j1=2*(i+3)+1;
+-
+-		/*Find connectivity for the two nodes*/
+-		connectivity[0]=(IssmDouble)vertices[i]->Connectivity();
+-		connectivity[1]=(IssmDouble)vertices[i+3]->Connectivity();
+-		one0=1./connectivity[0];
+-		one1=1./connectivity[1];
+-
+-		/*Create matrix for these two nodes*/
+-		if (IsOnBed() && IsOnSurface()){
+-			Ke->values[i0*numdof+i0] = +one0;
+-			Ke->values[i1*numdof+i1] = +one0;
+-			Ke->values[j0*numdof+i0] = -one1;
+-			Ke->values[j0*numdof+j0] = +one1;
+-			Ke->values[j1*numdof+i1] = -one1;
+-			Ke->values[j1*numdof+j1] = +one1;
+-		}
+-		else if (IsOnBed()){
+-			Ke->values[i0*numdof+i0] = one0;
+-			Ke->values[i1*numdof+i1] = one0;
+-			Ke->values[j0*numdof+i0] = -2.*one1;
+-			Ke->values[j0*numdof+j0] = +2.*one1;
+-			Ke->values[j1*numdof+i1] = -2.*one1;
+-			Ke->values[j1*numdof+j1] = +2.*one1;
+-		}
+-		else if (IsOnSurface()){
+-			Ke->values[j0*numdof+i0] = -one1;
+-			Ke->values[j0*numdof+j0] = +one1;
+-			Ke->values[j1*numdof+i1] = -one1;
+-			Ke->values[j1*numdof+j1] = +one1;
+-		}
+-		else{ //node is on two horizontal layers and beams include the values only once, so the have to use half of the connectivity
+-			Ke->values[j0*numdof+i0] = -2.*one1;
+-			Ke->values[j0*numdof+j0] = +2.*one1;
+-			Ke->values[j1*numdof+i1] = -2.*one1;
+-			Ke->values[j1*numdof+j1] = +2.*one1;
+-		}
+-	}
+-
+-	/*Clean up and return*/
+-	return Ke;
+-}/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixStressbalanceSSA2d{{{*/
+-ElementMatrix* Penta::CreateKMatrixStressbalanceSSA2d(void){
+-
+-	/*Figure out if this penta is collapsed. If so, then bailout, except if it is at the 
+-	  bedrock, in which case we spawn a tria element using the 3 first nodes, and use it to build 
+-	  the stiffness matrix. */
+-	if (!IsOnBed()) return NULL;
+-
+-	/*Depth average some fields*/
+-	switch(this->material->ObjectEnum()){
+-		case MaticeEnum:
+-			this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum,MaterialsEnum);
+-			this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum,MaterialsEnum);
+-			break;
+-		default:
+-			_error_("material "<<EnumToStringx(this->material->ObjectEnum())<<" not supported");
+-	}
+-
+-	/*Call Tria function*/
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	ElementMatrix* Ke=tria->CreateKMatrixStressbalanceSSA();
+-	delete tria->material; delete tria;
+-
+-	/*Delete averaged fields*/
+-	this->material->inputs->DeleteInput(MaterialsRheologyBbarEnum);
+-	this->material->inputs->DeleteInput(DamageDbarEnum);
+-
+-	/*clean up and return*/
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixStressbalanceSSA3d{{{*/
+-ElementMatrix* Penta::CreateKMatrixStressbalanceSSA3d(void){
+-
+-	/*compute all stiffness matrices for this element*/
+-	ElementMatrix* Ke1=CreateKMatrixStressbalanceSSA3dViscous();
+-	ElementMatrix* Ke2=CreateKMatrixStressbalanceSSA3dFriction();
+-	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
+-
+-	/*clean-up and return*/
+-	delete Ke1;
+-	delete Ke2;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixStressbalanceSSA3dViscous{{{*/
+-ElementMatrix* Penta::CreateKMatrixStressbalanceSSA3dViscous(void){
+-
+-	/*Constants*/
+-	const int    numdof2d=2*NUMVERTICES2D;
+-
+-	/*Intermediaries */
+-	int         i,j,approximation;
+-	IssmDouble  Jdet;
+-	IssmDouble  viscosity , oldviscosity, newviscosity, viscosity_overshoot;
+-	IssmDouble  epsilon[5],oldepsilon[5];       /* epsilon=[exx,eyy,exy,exz,eyz];*/
+-	IssmDouble  epsilons[6];                    //6 for FS
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble  B[3][numdof2d];
+-	IssmDouble  Bprime[3][numdof2d];
+-	IssmDouble  D[3][3]= {0.0};                 // material matrix, simple scalar matrix.
+-	IssmDouble  D_scalar;
+-	IssmDouble  Ke_gg_gaussian[numdof2d][numdof2d];
+-	Tria       *tria       = NULL;
+-	Penta      *pentabase  = NULL;
+-	GaussPenta *gauss      = NULL;
+-	GaussTria  *gauss_tria = NULL;
+-
+-	/*Find penta on bed as this is a SSA elements: */
+-	pentabase=(Penta*)GetBasalElement();
+-	tria=pentabase->SpawnTria(0); //lower face is 0, upper face is 1.
+-
+-	/*Initialize Element matrix*/
+-	ElementMatrix* Ke=new ElementMatrix(tria->nodes,NUMVERTICES2D,this->parameters,SSAApproximationEnum);
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&viscosity_overshoot,StressbalanceViscosityOvershootEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum);       _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);       _assert_(vy_input);
+-	Input* vxold_input=inputs->GetInput(VxPicardEnum); _assert_(vxold_input);
+-	Input* vyold_input=inputs->GetInput(VyPicardEnum); _assert_(vyold_input);
+-	Input* vz_input=inputs->GetInput(VzEnum);       _assert_(vz_input);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(5,5);
+-	gauss_tria=new GaussTria();
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-		gauss->SynchronizeGaussBase(gauss_tria);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		tria->GetBSSA(&B[0][0], &xyz_list[0][0], gauss_tria);
+-		tria->GetBprimeSSA(&Bprime[0][0], &xyz_list[0][0], gauss_tria);
+-
+-		if(approximation==SSAHOApproximationEnum){
+-			this->StrainRateHO(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+-			this->StrainRateHO(&oldepsilon[0],&xyz_list[0][0],gauss,vxold_input,vyold_input);
+-			material->GetViscosity3d(&viscosity, &epsilon[0]);
+-			material->GetViscosity3d(&oldviscosity, &oldepsilon[0]);
+-
+-			newviscosity=viscosity+viscosity_overshoot*(viscosity-oldviscosity);
+-		}
+-		else if (approximation==SSAFSApproximationEnum){
+-			this->StrainRateFS(&epsilons[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+-			material->GetViscosity3dFS(&newviscosity,&epsilons[0]);
+-		}
+-		else _error_("approximation " << approximation << " (" << EnumToStringx(approximation) << ") not supported yet");
+-
+-		D_scalar=2*newviscosity*gauss->weight*Jdet;
+-		for (i=0;i<3;i++) D[i][i]=D_scalar;
+-
+-		TripleMultiply( &B[0][0],3,numdof2d,1,
+-					&D[0][0],3,3,0,
+-					&Bprime[0][0],3,numdof2d,0,
+-					&Ke_gg_gaussian[0][0],0);
+-
+-		for(i=0;i<numdof2d;i++) for(j=0;j<numdof2d;j++) Ke->values[i*numdof2d+j]+=Ke_gg_gaussian[i][j];
+-	}
+-
+-	/*Transform Coordinate System*/
+-	::TransformStiffnessMatrixCoord(Ke,tria->nodes,NUMVERTICES2D,XYEnum);
+-
+-	/*Clean up and return*/
+-	delete tria->material;
+-	delete tria;
+-	delete gauss_tria;
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixStressbalanceSSA3dFriction{{{*/
+-ElementMatrix* Penta::CreateKMatrixStressbalanceSSA3dFriction(void){
+-
+-	/*Initialize Element matrix and return if necessary*/
+-	if(IsFloating() || !IsOnBed()) return NULL;
+-
+-	/*Build a tria element using the 3 nodes of the base of the penta. Then use 
+-	 * the tria functionality to build a friction stiffness matrix on these 3
+-	 * nodes: */
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	ElementMatrix* Ke=tria->CreateKMatrixStressbalanceSSAFriction();
+-	delete tria->material; delete tria;
+-
+-	/*clean-up and return*/
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixStressbalanceSSAHO{{{*/
+-ElementMatrix* Penta::CreateKMatrixStressbalanceSSAHO(void){
+-
+-	/*compute all stiffness matrices for this element*/
+-	ElementMatrix* Ke1=CreateKMatrixStressbalanceSSA3d();
+-	ElementMatrix* Ke2=CreateKMatrixStressbalanceHO();
+-	ElementMatrix* Ke3=CreateKMatrixCouplingSSAHO();
+-	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2,Ke3);
+-
+-	/*clean-up and return*/
+-	delete Ke1;
+-	delete Ke2;
+-	delete Ke3;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixStressbalanceSSAFS{{{*/
+-ElementMatrix* Penta::CreateKMatrixStressbalanceSSAFS(void){
+-
+-	/*compute all stiffness matrices for this element*/
+-	ElementMatrix* Ke1=CreateKMatrixStressbalanceFS();
+-	int indices[3]={18,19,20};
+-	Ke1->StaticCondensation(3,&indices[0]);
+-	int init = this->element_type;
+-	this->element_type=P1Enum; //P1 needed for HO 
+-	ElementMatrix* Ke2=CreateKMatrixStressbalanceSSA3d();
+-	this->element_type=init;
+-	ElementMatrix* Ke3=CreateKMatrixCouplingSSAFS();
+-	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2,Ke3);
+-
+-	/*clean-up and return*/
+-	delete Ke1;
+-	delete Ke2;
+-	delete Ke3;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixStressbalanceL1L2{{{*/
+-ElementMatrix* Penta::CreateKMatrixStressbalanceL1L2(void){
+-
+-	/*compute all stiffness matrices for this element*/
+-	ElementMatrix* Ke1=CreateKMatrixStressbalanceL1L2Viscous();
+-	ElementMatrix* Ke2=CreateKMatrixStressbalanceL1L2Friction();
+-	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
+-
+-	/*clean-up and return*/
+-	delete Ke1;
+-	delete Ke2;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixStressbalanceL1L2Viscous{{{*/
+-ElementMatrix* Penta::CreateKMatrixStressbalanceL1L2Viscous(void){
+-
+-	/*Constants*/
+-	const int    numdof2d=2*NUMVERTICES2D;
+-
+-	/*Intermediaries */
+-	int         i,j;
+-	IssmDouble  Jdet,viscosity;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble  B[3][numdof2d];
+-	IssmDouble  Bprime[3][numdof2d];
+-	IssmDouble  Ke_gg_gaussian[numdof2d][numdof2d];
+-	IssmDouble  D[3][3]= {0.0};                 // material matrix, simple scalar matrix.
+-	Tria       *tria       = NULL;
+-	Penta      *pentabase  = NULL;
+-	GaussPenta *gauss      = NULL;
+-	GaussTria  *gauss_tria = NULL;
+-
+-	/*Find penta on bed as this is a SSA elements: */
+-	pentabase=(Penta*)GetBasalElement();
+-	tria=pentabase->SpawnTria(0); //lower face is 0, upper face is 1.
+-
+-	/*Initialize Element matrix*/
+-	ElementMatrix* Ke=new ElementMatrix(tria->nodes,NUMVERTICES2D,this->parameters,L1L2ApproximationEnum);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* vx_input=inputs->GetInput(VxEnum);        _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);        _assert_(vy_input);
+-	Input* surf_input=inputs->GetInput(SurfaceEnum); _assert_(surf_input);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(5,5);
+-	gauss_tria=new GaussTria();
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-		gauss->SynchronizeGaussBase(gauss_tria);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		tria->GetBSSA(&B[0][0], &xyz_list[0][0], gauss_tria);
+-		tria->GetBprimeSSA(&Bprime[0][0], &xyz_list[0][0], gauss_tria);
+-
+-		/*Get viscosity for L1L2 model*/
+-		ViscosityL1L2(&viscosity,&xyz_list[0][0],gauss,vx_input,vy_input,surf_input);
+-
+-		for(i=0;i<3;i++) D[i][i]=2*viscosity*gauss->weight*Jdet;
+-
+-		TripleMultiply( &B[0][0],3,numdof2d,1,
+-					&D[0][0],3,3,0,
+-					&Bprime[0][0],3,numdof2d,0,
+-					&Ke_gg_gaussian[0][0],0);
+-		for(i=0;i<numdof2d;i++) for(j=0;j<numdof2d;j++) Ke->values[i*numdof2d+j]+=Ke_gg_gaussian[i][j];
+-	}
+-
+-	/*Transform Coordinate System*/
+-	::TransformStiffnessMatrixCoord(Ke,tria->nodes,NUMVERTICES2D,XYEnum);
+-
+-	/*Clean up and return*/
+-	delete tria->material;
+-	delete tria;
+-	delete gauss_tria;
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixStressbalanceL1L2Friction{{{*/
+-ElementMatrix* Penta::CreateKMatrixStressbalanceL1L2Friction(void){
+-
+-	/*Initialize Element matrix and return if necessary*/
+-	if(IsFloating() || !IsOnBed()) return NULL;
+-
+-	/*Build a tria element using the 3 nodes of the base of the penta. Then use 
+-	 * the tria functionality to build a friction stiffness matrix on these 3
+-	 * nodes: */
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	ElementMatrix* Ke=tria->CreateKMatrixStressbalanceSSAFriction();
+-	delete tria->material; delete tria;
+-
+-	/*clean-up and return*/
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixStressbalanceHO{{{*/
+-ElementMatrix* Penta::CreateKMatrixStressbalanceHO(void){
+-
+-	/*compute all stiffness matrices for this element*/
+-	ElementMatrix* Ke1=CreateKMatrixStressbalanceHOViscous();
+-	ElementMatrix* Ke2=CreateKMatrixStressbalanceHOFriction();
+-	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
+-
+-	/*clean-up and return*/
+-	delete Ke1;
+-	delete Ke2;
+-	return Ke;
+-
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixStressbalanceHOViscous{{{*/
+-ElementMatrix* Penta::CreateKMatrixStressbalanceHOViscous(void){
+-
+-	/*Intermediaries */
+-	int         approximation;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble  Jdet;
+-	IssmDouble  viscosity,oldviscosity,newviscosity,viscosity_overshoot; //viscosity
+-	IssmDouble  epsilon[5],oldepsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/
+-	IssmDouble  D_scalar;
+-	GaussPenta *gauss=NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-	int numdof   = numnodes*NDOF2;
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke     = new ElementMatrix(nodes,numnodes,this->parameters,HOApproximationEnum);
+-	IssmDouble*    B      = xNew<IssmDouble>(5*numdof);
+-	IssmDouble*    Bprime = xNew<IssmDouble>(5*numdof);
+-	IssmDouble*    D      = xNewZeroInit<IssmDouble>(5*5);
+-
+-	/*Retrieve all inputs and parameters*/
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&viscosity_overshoot,StressbalanceViscosityOvershootEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum);       _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);       _assert_(vy_input);
+-	Input* vxold_input=inputs->GetInput(VxPicardEnum); _assert_(vxold_input);
+-	Input* vyold_input=inputs->GetInput(VyPicardEnum); _assert_(vyold_input);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(5,5);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetBHO(&B[0], &xyz_list[0][0], gauss);
+-		GetBprimeHO(&Bprime[0], &xyz_list[0][0], gauss);
+-
+-		this->StrainRateHO(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+-		this->StrainRateHO(&oldepsilon[0],&xyz_list[0][0],gauss,vxold_input,vyold_input);
+-		material->GetViscosity3d(&viscosity, &epsilon[0]);
+-		material->GetViscosity3d(&oldviscosity, &oldepsilon[0]);
+-		newviscosity=viscosity+viscosity_overshoot*(viscosity-oldviscosity);
+-
+-		D_scalar=2*newviscosity*gauss->weight*Jdet;
+-		for(int i=0;i<5;i++) D[i*5+i]=D_scalar;
+-
+-		TripleMultiply(B,5,numdof,1,
+-					D,5,5,0,
+-					Bprime,5,numdof,0,
+-					&Ke->values[0],1);
+-	}
+-
+-	/*Transform Coordinate System*/
+-	::TransformStiffnessMatrixCoord(Ke,nodes,numnodes,XYEnum);
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	xDelete<IssmDouble>(D);
+-	xDelete<IssmDouble>(Bprime);
+-	xDelete<IssmDouble>(B);
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixStressbalanceHOFriction{{{*/
+-ElementMatrix* Penta::CreateKMatrixStressbalanceHOFriction(void){
+-
+-	/*Intermediaries */
+-	bool       mainlyfloating;
+-	int         i,j;
+-	int         analysis_type,migration_style;
+-	int         point1;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble  xyz_list_tria[NUMVERTICES2D][3];
+-	IssmDouble  alpha2,Jdet;
+-	IssmDouble fraction1,fraction2;
+-	IssmDouble gllevelset;
+-	IssmDouble  phi=1.0;
+-	IssmDouble  DL_scalar;
+-	Friction   *friction = NULL;
+-	GaussPenta *gauss    = NULL;
+-
+-	/*Initialize Element matrix and return if necessary*/
+-	if(IsFloating() || !IsOnBed()) return NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-	int numdof   = numnodes*NDOF2;
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke     = new ElementMatrix(nodes,numnodes,this->parameters,HOApproximationEnum);
+-	IssmDouble*    B      = xNew<IssmDouble>(2*numdof);
+-	IssmDouble*    D      = xNewZeroInit<IssmDouble>(2*2);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+-	parameters->FindParam(&migration_style,GroundinglineMigrationEnum);
+-	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-	Input* surface_input=inputs->GetInput(SurfaceEnum); _assert_(surface_input);
+-	Input* vx_input=inputs->GetInput(VxEnum);           _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);           _assert_(vy_input);
+-	Input* vz_input=inputs->GetInput(VzEnum);           _assert_(vz_input);
+-	Input* gllevelset_input=NULL;
+-
+-	/*build friction object, used later on: */
+-	friction=new Friction(this,2);
+-
+-	/*Recover portion of element that is grounded*/
+-	if(migration_style==SubelementMigrationEnum) phi=this->GetGroundedPortion(&xyz_list_tria[0][0]);
+-	if(migration_style==SubelementMigration2Enum){
+-		gllevelset_input=inputs->GetInput(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input);
+-		this->GetGroundedPart(&point1,&fraction1,&fraction2,&mainlyfloating);
+-		//gauss=new GaussPenta(point1,fraction1,fraction2,mainlyfloating,2);
+-		gauss=new GaussPenta(0,1,2,2);
+-	}
+-	else{
+-		gauss=new GaussPenta(0,1,2,2);
+-	}
+-
+-	/* Start  looping on the number of gaussian points: */
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetTriaJacobianDeterminant(&Jdet,&xyz_list_tria[0][0],gauss);
+-		GetBHOFriction(&B[0],gauss);
+-
+-		friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input); 
+-		if(migration_style==SubelementMigrationEnum) alpha2=phi*alpha2;
+-		if(migration_style==SubelementMigration2Enum){
+-			gllevelset_input->GetInputValue(&gllevelset, gauss);
+-			if(gllevelset<0) alpha2=0;
+-		}
+-
+-		DL_scalar=alpha2*gauss->weight*Jdet;
+-		for (i=0;i<2;i++) D[i*2+i]=DL_scalar;
+-
+-		TripleMultiply(B,2,numdof,1,
+-					D,2,2,0,
+-					B,2,numdof,0,
+-					&Ke->values[0],1);
+-	}
+-
+-	/*Transform Coordinate System*/
+-	::TransformStiffnessMatrixCoord(Ke,nodes,numnodes,XYEnum);
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	xDelete<IssmDouble>(D);
+-	xDelete<IssmDouble>(B);
+-	delete friction;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixStressbalanceHOFS{{{*/
+-ElementMatrix* Penta::CreateKMatrixStressbalanceHOFS(void){
+-
+-	/*compute all stiffness matrices for this element*/
+-	ElementMatrix* Ke1=CreateKMatrixStressbalanceFS();
+-	int indices[3]={18,19,20};
+-	Ke1->StaticCondensation(3,&indices[0]);
+-	int init = this->element_type;
+-	this->element_type=P1Enum; //P1 needed for HO 
+-	ElementMatrix* Ke2=CreateKMatrixStressbalanceHO();
+-	this->element_type=init;
+-	ElementMatrix* Ke3=CreateKMatrixCouplingHOFS();
+-	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2,Ke3);
+-
+-	/*clean-up and return*/
+-	delete Ke1;
+-	delete Ke2;
+-	delete Ke3;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixStressbalanceFS{{{*/
+-ElementMatrix* Penta::CreateKMatrixStressbalanceFS(void){
+-
+-	ElementMatrix* Ke1 = NULL;
+-	ElementMatrix* Ke2 = NULL;
+-	ElementMatrix* Ke  = NULL;
+-
+-	/*compute all stiffness matrices for this element*/
+-	Ke1=CreateKMatrixStressbalanceFSViscous();
+-	Ke2=CreateKMatrixStressbalanceFSFriction();
+-	Ke =new ElementMatrix(Ke1,Ke2);
+-
+-	/*clean-up and return*/
+-	delete Ke1;
+-	delete Ke2;
+-	return Ke;
+-
+-}
+-/*}}}*/
+ /*FUNCTION Penta::KMatrixGLSstabilization{{{*/
+ void Penta::KMatrixGLSstabilization(ElementMatrix* Ke){
+ 
+@@ -6555,513 +4624,9 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::CreateKMatrixStressbalanceFSViscous {{{*/
+-ElementMatrix* Penta::CreateKMatrixStressbalanceFSViscous(void){
+-
+-	/*Intermediaries */
+-	int        i,approximation;
+-	IssmDouble Jdet,viscosity,FSreconditioning,D_scalar;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
+-	GaussPenta *gauss=NULL;
+-
+-	/*If on water or not FS, skip stiffness: */
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-	if(approximation!=FSApproximationEnum && approximation!=SSAFSApproximationEnum && approximation!=HOFSApproximationEnum) return NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumnodes = this->NumberofNodesPressure();
+-	int numdof    = vnumnodes*NDOF3 + pnumnodes*NDOF1;
+-
+-	/*Prepare coordinate system list*/
+-	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+-	for(i=0;i<vnumnodes;i++) cs_list[i]           = XYZEnum;
+-	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke     = new ElementMatrix(nodes,vnumnodes+pnumnodes,this->parameters,FSvelocityEnum);
+-	IssmDouble*    B      = xNew<IssmDouble>(8*numdof);
+-	IssmDouble*    Bprime = xNew<IssmDouble>(8*numdof);
+-	IssmDouble*    D      = xNewZeroInit<IssmDouble>(8*8);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+-	Input* vz_input=inputs->GetInput(VzEnum); _assert_(vz_input);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(5,5);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetBFS(B,&xyz_list[0][0],gauss); 
+-		GetBprimeFS(Bprime,&xyz_list[0][0],gauss); 
+-
+-		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+-		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+-
+-		D_scalar=gauss->weight*Jdet;
+-		for(i=0;i<6;i++) D[i*8+i] = +D_scalar*2.*viscosity;
+-		for(i=6;i<8;i++) D[i*8+i] = -D_scalar*FSreconditioning;
+-
+-		TripleMultiply(B,8,numdof,1,
+-					D,8,8,0,
+-					Bprime,8,numdof,0,
+-					Ke->values,1);
+-	}
+-
+-	/*Transform Coordinate System*/
+-	::TransformStiffnessMatrixCoord(Ke,nodes,(vnumnodes+pnumnodes),cs_list);
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	xDelete<int>(cs_list);
+-	xDelete<IssmDouble>(B);
+-	xDelete<IssmDouble>(Bprime);
+-	xDelete<IssmDouble>(D);
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixStressbalanceFSFriction{{{*/
+-ElementMatrix* Penta::CreateKMatrixStressbalanceFSFriction(void){
+-
+-	/*Intermediaries */
+-	int         i,j;
+-	int         analysis_type,approximation;
+-	IssmDouble  alpha2,Jdet2d;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble  xyz_list_tria[NUMVERTICES2D][3];
+-	Friction   *friction = NULL;
+-	GaussPenta *gauss    = NULL;
+-
+-	/*Initialize Element matrix and return if necessary*/
+-	if(IsFloating() || !IsOnBed()) return NULL;
+-
+-	/*If on water or not FS, skip stiffness: */
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-	if(approximation!=FSApproximationEnum && approximation!=SSAFSApproximationEnum && approximation!=HOFSApproximationEnum) return NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumnodes = this->NumberofNodesPressure();
+-	int  numdof   = vnumnodes*NDOF3 + pnumnodes*NDOF1;
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke        = new ElementMatrix(nodes,vnumnodes+pnumnodes,this->parameters,FSvelocityEnum);
+-	IssmDouble*    BFriction = xNew<IssmDouble>(2*numdof);
+-	IssmDouble*    D         = xNewZeroInit<IssmDouble>(2*2);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+-	Input* vz_input=inputs->GetInput(VzEnum); _assert_(vz_input);
+-	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+-
+-	/*build friction object, used later on: */
+-	friction=new Friction(this,3);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(0,1,2,3);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetTriaJacobianDeterminant(&Jdet2d, &xyz_list_tria[0][0],gauss);
+-		GetLFS(BFriction,gauss);
+-
+-		friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input);
+-
+-		D[0*2+0] = +alpha2*gauss->weight*Jdet2d; //taub_x = -alpha2 vx
+-		D[1*2+1] = +alpha2*gauss->weight*Jdet2d; //taub_y = -alpha2 vy
+-
+-		TripleMultiply(BFriction,2,numdof,1,
+-					D,2,2,0,
+-					BFriction,2,numdof,0,
+-					Ke->values,1);
+-	}
+-
+-	/*DO NOT Transform Coordinate System: this stiffness matrix is already expressed in tangential coordinates*/
+-	//::TransformStiffnessMatrixCoord(Ke,nodes,NUMVERTICES,XYZEnum);
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	delete friction;
+-	xDelete<IssmDouble>(BFriction);
+-	xDelete<IssmDouble>(D);
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixStressbalanceVert {{{*/
+-ElementMatrix* Penta::CreateKMatrixStressbalanceVert(void){
+-
+-	/*compute all stiffness matrices for this element*/
+-	ElementMatrix* Ke1=CreateKMatrixStressbalanceVertVolume();
+-	ElementMatrix* Ke2=CreateKMatrixStressbalanceVertSurface();
+-	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
+-
+-	/*clean-up and return*/
+-	delete Ke1;
+-	delete Ke2;
+-	return Ke;
+-
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixStressbalanceVertVolume {{{*/
+-ElementMatrix* Penta::CreateKMatrixStressbalanceVertVolume(void){
+-
+-	/*Intermediaries */
+-	IssmDouble  Jdet;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble  B[NDOF1][NUMVERTICES];
+-	IssmDouble  Bprime[NDOF1][NUMVERTICES];
+-	IssmDouble  DL_scalar;
+-	GaussPenta  *gauss=NULL;
+-
+-	/*Initialize Element matrix*/
+-	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(2,2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetBVert(&B[0][0], &xyz_list[0][0], gauss);
+-		GetBprimeVert(&Bprime[0][0], &xyz_list[0][0], gauss);
+-
+-		DL_scalar=gauss->weight*Jdet;
+-
+-		TripleMultiply( &B[0][0],1,NUMVERTICES,1,
+-					&DL_scalar,1,1,0,
+-					&Bprime[0][0],1,NUMVERTICES,0,
+-					&Ke->values[0],1);
+-	} 
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixStressbalanceVertSurface {{{*/
+-ElementMatrix* Penta::CreateKMatrixStressbalanceVertSurface(void){
+-
+-	if (!IsOnSurface()) return NULL;
+-
+-	/*Constants*/
+-	const int numdof=NDOF1*NUMVERTICES;
+-
+-	/*Intermediaries */
+-	int       i,j;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble xyz_list_tria[NUMVERTICES2D][3];
+-	IssmDouble surface_normal[3];
+-	IssmDouble Jdet2d,DL_scalar;
+-	IssmDouble basis[NUMVERTICES];
+-	GaussPenta *gauss=NULL;
+-
+-	/*Initialize Element matrix*/
+-	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i+3][j];
+-	NormalTop(&surface_normal[0],&xyz_list_tria[0][0]);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(3,4,5,2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetTriaJacobianDeterminant(&Jdet2d, &xyz_list_tria[0][0],gauss);
+-		GetNodalFunctionsP1(&basis[0], gauss);
+-
+-		DL_scalar= - gauss->weight*Jdet2d*surface_normal[2]; 
+-
+-		TripleMultiply( basis,1,numdof,1,
+-					&DL_scalar,1,1,0,
+-					basis,1,numdof,0,
+-					&Ke->values[0],1);
+-	}
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateJacobianStressbalanceHoriz{{{*/
+-ElementMatrix* Penta::CreateJacobianStressbalanceHoriz(void){
+-
+-	int approximation;
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-
+-	switch(approximation){
+-		case SSAApproximationEnum:
+-			return CreateJacobianStressbalanceSSA2d();
+-		case HOApproximationEnum:
+-			return CreateJacobianStressbalanceHO();
+-		case FSApproximationEnum:
+-			return CreateJacobianStressbalanceFS();
+-		case NoneApproximationEnum:
+-			return NULL;
+-		default:
+-			_error_("Approximation " << EnumToStringx(approximation) << " not supported yet");
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateJacobianStressbalanceSSA2d{{{*/
+-ElementMatrix* Penta::CreateJacobianStressbalanceSSA2d(void){
+-
+-	/*Figure out if this penta is collapsed. If so, then bailout, except if it is at the 
+-	  bedrock, in which case we spawn a tria element using the 3 first nodes, and use it to build 
+-	  the stiffness matrix. */
+-	if (!IsOnBed()) return NULL;
+-
+-	/*Depth average some fields*/
+-	switch(this->material->ObjectEnum()){
+-		case MaticeEnum:
+-			this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum,MaterialsEnum);
+-			this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum,MaterialsEnum);
+-			break;
+-		default:
+-			_error_("material "<<EnumToStringx(this->material->ObjectEnum())<<" not supported");
+-	}
+-
+-	/*Call Tria function*/
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	ElementMatrix* Ke=tria->CreateJacobianStressbalanceSSA();
+-	delete tria->material; delete tria;
+-
+-	/*Delete averaged inputs*/
+-	this->material->inputs->DeleteInput(MaterialsRheologyBbarEnum);
+-	this->material->inputs->DeleteInput(DamageDbarEnum);
+-
+-	/*clean up and return*/
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateJacobianStressbalanceHO{{{*/
+-ElementMatrix* Penta::CreateJacobianStressbalanceHO(void){
+-
+-	/*Intermediaries */
+-	int        i,j;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble Jdet;
+-	IssmDouble eps1dotdphii,eps1dotdphij;
+-	IssmDouble eps2dotdphii,eps2dotdphij;
+-	IssmDouble mu_prime;
+-	IssmDouble epsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/
+-	IssmDouble eps1[3],eps2[3];
+-	IssmDouble dphi[3][NUMVERTICES];
+-	GaussPenta *gauss=NULL;
+-
+-	/*Initialize Jacobian with regular HO (first part of the Gateau derivative)*/
+-	ElementMatrix* Ke=CreateKMatrixStressbalanceHO();
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* vx_input=inputs->GetInput(VxEnum);       _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);       _assert_(vy_input);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(5,5);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctionsP1Derivatives(&dphi[0][0],&xyz_list[0][0],gauss);
+-
+-		this->StrainRateHO(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+-		material->GetViscosityDerivativeEpsSquare(&mu_prime,&epsilon[0]);
+-		eps1[0]=2*epsilon[0]+epsilon[1];   eps2[0]=epsilon[2];
+-		eps1[1]=epsilon[2];                eps2[1]=epsilon[0]+2*epsilon[1];
+-		eps1[2]=epsilon[3];                eps2[2]=epsilon[4];
+-
+-		for(i=0;i<6;i++){
+-			for(j=0;j<6;j++){
+-				eps1dotdphii=eps1[0]*dphi[0][i]+eps1[1]*dphi[1][i]+eps1[2]*dphi[2][i];
+-				eps1dotdphij=eps1[0]*dphi[0][j]+eps1[1]*dphi[1][j]+eps1[2]*dphi[2][j];
+-				eps2dotdphii=eps2[0]*dphi[0][i]+eps2[1]*dphi[1][i]+eps2[2]*dphi[2][i];
+-				eps2dotdphij=eps2[0]*dphi[0][j]+eps2[1]*dphi[1][j]+eps2[2]*dphi[2][j];
+-
+-				Ke->values[12*(2*i+0)+2*j+0]+=gauss->weight*Jdet*2*mu_prime*eps1dotdphij*eps1dotdphii;
+-				Ke->values[12*(2*i+0)+2*j+1]+=gauss->weight*Jdet*2*mu_prime*eps2dotdphij*eps1dotdphii;
+-				Ke->values[12*(2*i+1)+2*j+0]+=gauss->weight*Jdet*2*mu_prime*eps1dotdphij*eps2dotdphii;
+-				Ke->values[12*(2*i+1)+2*j+1]+=gauss->weight*Jdet*2*mu_prime*eps2dotdphij*eps2dotdphii;
+-			}
+-		}
+-	}
+-
+-	/*Transform Coordinate System*/
+-	::TransformStiffnessMatrixCoord(Ke,nodes,NUMVERTICES,XYEnum);
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateJacobianStressbalanceFS{{{*/
+-ElementMatrix* Penta::CreateJacobianStressbalanceFS(void){
+-
+-	/*Intermediaries */
+-	int        i,j;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble Jdet;
+-	IssmDouble eps1dotdphii,eps1dotdphij;
+-	IssmDouble eps2dotdphii,eps2dotdphij;
+-	IssmDouble eps3dotdphii,eps3dotdphij;
+-	IssmDouble mu_prime;
+-	IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
+-	IssmDouble eps1[3],eps2[3],eps3[3];
+-	GaussPenta *gauss=NULL;
+-
+-	/*If on water or not FS, skip stiffness: */
+-	//inputs->GetInputValue(&approximation,ApproximationEnum);
+-	//if(approximation!=FSApproximationEnum && approximation!=SSAFSApproximationEnum && approximation!=HOFSApproximationEnum) return NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumnodes = this->NumberofNodesPressure();
+-	int numdof    = vnumnodes*NDOF3 + pnumnodes*NDOF1;
+-
+-	/*Prepare coordinate system list*/
+-	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+-	for(i=0;i<vnumnodes;i++) cs_list[i]           = XYZEnum;
+-	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
+-
+-	/*Initialize Jacobian with regular FS (first part of the Gateau derivative)*/
+-	ElementMatrix* Ke=CreateKMatrixStressbalanceFS();
+-	IssmDouble*    dbasis = xNew<IssmDouble>(3*vnumnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+-	Input* vz_input=inputs->GetInput(VzEnum); _assert_(vz_input);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(5,5);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet,&xyz_list[0][0],gauss);
+-		GetNodalFunctionsDerivativesVelocity(dbasis,&xyz_list[0][0],gauss);
+-
+-		//this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+-		//material->GetViscosityDerivativeEpsSquareFS(&mu_prime,&epsilon[0]);
+-		//eps1[0]=epsilon[0];   eps2[0]=epsilon[3];   eps3[0]=epsilon[4];
+-		//eps1[1]=epsilon[3];   eps2[1]=epsilon[1];   eps3[1]=epsilon[5];
+-		//eps1[2]=epsilon[4];   eps2[2]=epsilon[5];   eps3[2]=epsilon[2];
+-		this->StrainRateHO(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+-		material->GetViscosityDerivativeEpsSquare(&mu_prime,&epsilon[0]);
+-		eps1[0]=epsilon[0];   eps2[0]=epsilon[2];   eps3[0]=epsilon[3];
+-		eps1[1]=epsilon[2];   eps2[1]=epsilon[1];   eps3[1]=epsilon[4];
+-		eps1[2]=epsilon[3];   eps2[2]=epsilon[4];   eps3[2]= -epsilon[0] -epsilon[1];
+-
+-		for(i=0;i<vnumnodes-1;i++){
+-			for(j=0;j<vnumnodes-1;j++){
+-				eps1dotdphii=eps1[0]*dbasis[0*vnumnodes+i]+eps1[1]*dbasis[1*vnumnodes+i]+eps1[2]*dbasis[2*vnumnodes+i];
+-				eps1dotdphij=eps1[0]*dbasis[0*vnumnodes+j]+eps1[1]*dbasis[1*vnumnodes+j]+eps1[2]*dbasis[2*vnumnodes+j];
+-				eps2dotdphii=eps2[0]*dbasis[0*vnumnodes+i]+eps2[1]*dbasis[1*vnumnodes+i]+eps2[2]*dbasis[2*vnumnodes+i];
+-				eps2dotdphij=eps2[0]*dbasis[0*vnumnodes+j]+eps2[1]*dbasis[1*vnumnodes+j]+eps2[2]*dbasis[2*vnumnodes+j];
+-				eps3dotdphii=eps3[0]*dbasis[0*vnumnodes+i]+eps3[1]*dbasis[1*vnumnodes+i]+eps3[2]*dbasis[2*vnumnodes+i];
+-				eps3dotdphij=eps3[0]*dbasis[0*vnumnodes+j]+eps3[1]*dbasis[1*vnumnodes+j]+eps3[2]*dbasis[2*vnumnodes+j];
+-
+-				Ke->values[numdof*(3*i+0)+3*j+0]+=gauss->weight*Jdet*2*mu_prime*eps1dotdphij*eps1dotdphii;
+-				Ke->values[numdof*(3*i+0)+3*j+1]+=gauss->weight*Jdet*2*mu_prime*eps2dotdphij*eps1dotdphii;
+-				Ke->values[numdof*(3*i+0)+3*j+2]+=gauss->weight*Jdet*2*mu_prime*eps3dotdphij*eps1dotdphii;
+-
+-				Ke->values[numdof*(3*i+1)+3*j+0]+=gauss->weight*Jdet*2*mu_prime*eps1dotdphij*eps2dotdphii;
+-				Ke->values[numdof*(3*i+1)+3*j+1]+=gauss->weight*Jdet*2*mu_prime*eps2dotdphij*eps2dotdphii;
+-				Ke->values[numdof*(3*i+1)+3*j+2]+=gauss->weight*Jdet*2*mu_prime*eps3dotdphij*eps2dotdphii;
+-
+-				Ke->values[numdof*(3*i+2)+3*j+0]+=gauss->weight*Jdet*2*mu_prime*eps1dotdphij*eps3dotdphii;
+-				Ke->values[numdof*(3*i+2)+3*j+1]+=gauss->weight*Jdet*2*mu_prime*eps2dotdphij*eps3dotdphii;
+-				Ke->values[numdof*(3*i+2)+3*j+2]+=gauss->weight*Jdet*2*mu_prime*eps3dotdphij*eps3dotdphii;
+-			}
+-		}
+-	}
+-
+-	/*Transform Coordinate System*/
+-	::TransformStiffnessMatrixCoord(Ke,nodes,(vnumnodes+pnumnodes),cs_list);
+-
+-	/*Clean up and return*/
+-	xDelete<int>(cs_list);
+-	xDelete<IssmDouble>(dbasis);
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+ #endif
+ 
+-#ifdef _HAVE_BALANCED_
+-/*FUNCTION Penta::CreateKMatrixBalancethickness {{{*/
+-ElementMatrix* Penta::CreateKMatrixBalancethickness(void){
+-
+-	/*Figure out if this penta is collapsed. If so, then bailout, except if it is at the 
+-	  bedrock, in which case we spawn a tria element using the 3 first nodes, and use it to build 
+-	  the stiffness matrix. */
+-	if (!IsOnBed()) return NULL;
+-
+-	/*Depth Averaging Vx and Vy*/
+-	this->InputDepthAverageAtBase(VxEnum,VxAverageEnum);
+-	this->InputDepthAverageAtBase(VyEnum,VyAverageEnum);
+-
+-	/*Spawn Tria element from the base of the Penta: */
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	ElementMatrix* Ke=tria->CreateKMatrixBalancethickness();
+-	delete tria->material; delete tria;
+-
+-	/*Delete Vx and Vy averaged*/
+-	this->inputs->DeleteInput(VxAverageEnum);
+-	this->inputs->DeleteInput(VyAverageEnum);
+-
+-	/*clean up and return*/
+-	return Ke;
+-}
+-/*}}}*/
+-#endif
+-
+ #ifdef _HAVE_HYDROLOGY_
+-/*FUNCTION Penta::CreateKMatrixHydrologyDCInefficient {{{*/
+-ElementMatrix* Penta::CreateKMatrixHydrologyDCInefficient(void){
+-
+-	if (!IsOnBed()) return NULL;
+-
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	ElementMatrix* Ke=tria->CreateKMatrixHydrologyDCInefficient();
+-	delete tria->material; delete tria;
+-
+-	/*clean up and return*/
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateKMatrixHydrologyDCEfficient {{{*/
+-ElementMatrix* Penta::CreateKMatrixHydrologyDCEfficient(void){
+-
+-	if (!IsOnBed()) return NULL;
+-
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	ElementMatrix* Ke=tria->CreateKMatrixHydrologyDCEfficient();
+-	delete tria->material; delete tria;
+-
+-	/*clean up and return*/
+-	return Ke;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::CreateEPLDomainMassMatrix {{{*/
+ ElementMatrix* Penta::CreateEPLDomainMassMatrix(void){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16992)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16993)
+@@ -71,7 +71,6 @@
+ 		void   SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters);
+ 		void   SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum);
+ 		void   CreateDVector(Vector<IssmDouble>* df);
+-		void   CreateJacobianMatrix(Matrix<IssmDouble>* Jff);
+ 		void   Delta18oParameterization(void);
+ 		void   EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure);
+ 		Element* GetBasalElement(void);
+@@ -194,10 +193,6 @@
+ 		void           NormalSection(IssmDouble* normal,IssmDouble* xyz_list);
+ 		void	         NormalTop(IssmDouble* bed_normal, IssmDouble* xyz_list);
+ 		ElementMatrix* CreateBasalMassMatrix(void);
+-		ElementMatrix* CreateKMatrix(void);
+-		ElementMatrix* CreateKMatrixMasstransport(void);
+-		ElementMatrix* CreateKMatrixFreeSurfaceTop(void);
+-		ElementMatrix* CreateKMatrixFreeSurfaceBase(void);
+ 		IssmDouble     EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure);
+ 		IssmDouble     EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure);
+ 		void           GetAreaCoordinates(IssmDouble *area_coordinates,IssmDouble* xyz_zero,IssmDouble* xyz_list,int numpoints);
+@@ -259,53 +254,12 @@
+ 		IssmDouble     StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa);
+ 
+ 		#ifdef _HAVE_STRESSBALANCE_
+-		ElementMatrix* CreateKMatrixCouplingSSAHO(void);
+-		ElementMatrix* CreateKMatrixCouplingSSAHOViscous(void);
+-		ElementMatrix* CreateKMatrixCouplingSSAHOFriction(void);
+-		ElementMatrix* CreateKMatrixCouplingSSAFS(void);
+-		ElementMatrix* CreateKMatrixCouplingSSAFSViscous(void);
+-		ElementMatrix* CreateKMatrixCouplingSSAFSFriction(void);
+-		ElementMatrix* CreateKMatrixCouplingHOFS(void);
+-		ElementMatrix* CreateKMatrixStressbalanceHoriz(void);
+-		ElementMatrix* CreateKMatrixAdjointHoriz(void);
+ 		ElementVector* CreateDVectorStressbalanceHoriz(void);
+ 		ElementVector* CreateDVectorStressbalanceFS(void);
+-		ElementMatrix* CreateKMatrixStressbalanceSIA(void);
+-		ElementMatrix* CreateKMatrixStressbalanceSSA2d(void);
+-		ElementMatrix* CreateKMatrixStressbalanceSSA3d(void);
+-		ElementMatrix* CreateKMatrixStressbalanceSSA3dViscous(void);
+-		ElementMatrix* CreateKMatrixStressbalanceSSA3dFriction(void);
+-		ElementMatrix* CreateKMatrixStressbalanceSSAHO(void);
+-		ElementMatrix* CreateKMatrixStressbalanceSSAFS(void);
+-		ElementMatrix* CreateKMatrixStressbalanceL1L2(void);
+-		ElementMatrix* CreateKMatrixStressbalanceL1L2Viscous(void);
+-		ElementMatrix* CreateKMatrixStressbalanceL1L2Friction(void);
+-		ElementMatrix* CreateKMatrixStressbalanceHO(void);
+-		ElementMatrix* CreateKMatrixStressbalanceHOViscous(void);
+-		ElementMatrix* CreateKMatrixStressbalanceHOFriction(void);
+-		ElementMatrix* CreateKMatrixStressbalanceHOFS(void);
+-		ElementMatrix* CreateKMatrixStressbalanceFS(void);
+-		ElementMatrix* CreateKMatrixStressbalanceFSViscous(void);
+ 		void           KMatrixGLSstabilization(ElementMatrix* Ke);
+-		ElementMatrix* CreateKMatrixStressbalanceFSFriction(void);
+-		ElementMatrix* CreateKMatrixStressbalanceVert(void);
+-		ElementMatrix* CreateKMatrixStressbalanceVertVolume(void);
+-		ElementMatrix* CreateKMatrixStressbalanceVertSurface(void);
+-		ElementMatrix* CreateJacobianStressbalanceHoriz(void);
+-		ElementMatrix* CreateJacobianStressbalanceSSA2d(void);
+-		ElementMatrix* CreateJacobianStressbalanceHO(void);
+-		ElementMatrix* CreateJacobianStressbalanceFS(void);
+ 		#endif
+ 
+-		#ifdef _HAVE_CONTROL_
+-		ElementMatrix* CreateKMatrixAdjointSSA2d(void);
+-		ElementMatrix* CreateKMatrixAdjointHO(void);
+-		ElementMatrix* CreateKMatrixAdjointFS(void);
+-		#endif
+-
+ 		#ifdef _HAVE_HYDROLOGY_
+-		ElementMatrix* CreateKMatrixHydrologyDCInefficient(void);
+-		ElementMatrix* CreateKMatrixHydrologyDCEfficient(void);
+ 		ElementMatrix* CreateEPLDomainMassMatrix(void);
+ 		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode);
+ 		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index){_error_("not implemented yet");};
+@@ -318,21 +272,10 @@
+ 		void           UpdateConstraintsExtrudeFromBase(void){_error_("not implemented yet");};
+ 		void           UpdateConstraintsExtrudeFromTop(void){_error_("not implemented yet");};
+ 		#ifdef _HAVE_THERMAL_
+-		ElementMatrix* CreateKMatrixEnthalpy(void);
+-		ElementMatrix* CreateKMatrixEnthalpyVolume(void);
+-		ElementMatrix* CreateKMatrixEnthalpyShelf(void);
+-		ElementMatrix* CreateKMatrixThermal(void);
+-		ElementMatrix* CreateKMatrixMelting(void);
+-		ElementMatrix* CreateKMatrixThermalVolume(void);
+-		ElementMatrix* CreateKMatrixThermalShelf(void);
+ 		void           UpdateBasalConstraintsEnthalpy(void);
+ 		void           ComputeBasalMeltingrate(void);
+ 		void           DrainWaterfraction(IssmDouble* drainrate_element);
+ 		#endif
+-
+-		#ifdef _HAVE_BALANCED_
+-		ElementMatrix* CreateKMatrixBalancethickness(void);
+-		#endif
+ 		/*}}}*/
+ };
+ #endif  /* _PENTA_H */
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 16992)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 16993)
+@@ -137,201 +137,6 @@
+ 	return sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
+ }
+ /*}}}*/
+-/*FUNCTION Seg::CreateKMatrixFreeSurfaceTop {{{*/
+-ElementMatrix* Seg::CreateKMatrixFreeSurfaceTop(void){
+-
+-	/*Intermediaries */
+-	int        stabilization;
+-	IssmDouble Jdet,D_scalar,dt,h;
+-	IssmDouble vx,vel;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke     = new ElementMatrix(nodes,numnodes,this->parameters,NoneApproximationEnum);
+-	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+-	IssmDouble*    B      = xNew<IssmDouble>(1*numnodes);
+-	IssmDouble*    Bprime = xNew<IssmDouble>(1*numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	this->parameters->FindParam(&stabilization,MasstransportStabilizationEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+-	h=this->GetSize();
+-
+-	/* Start  looping on the number of gaussian points: */
+-	GaussSeg *gauss=new GaussSeg(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis,gauss);
+-
+-		vx_input->GetInputValue(&vx,gauss);
+-
+-		D_scalar=gauss->weight*Jdet;
+-
+-		TripleMultiply(basis,1,numnodes,1,
+-					&D_scalar,1,1,0,
+-					basis,1,numnodes,0,
+-					&Ke->values[0],1);
+-
+-		GetNodalFunctions(B,gauss);
+-		GetBprimeMasstransport(Bprime,&xyz_list[0][0],gauss);
+-
+-		D_scalar=dt*gauss->weight*Jdet*vx;
+-		TripleMultiply(B,1,numnodes,1,
+-					&D_scalar,1,1,0,
+-					Bprime,1,numnodes,0,
+-					&Ke->values[0],1);
+-
+-		if(stabilization==2){
+-			/*Streamline upwinding*/
+-			vel=fabs(vx)+1.e-8;
+-			D_scalar=dt*gauss->weight*Jdet*h/(2.*vel)*vx;
+-		}
+-		else if(stabilization==1){
+-			/*SSA*/
+-			vx_input->GetInputAverage(&vx);
+-			D_scalar=dt*gauss->weight*Jdet*h/2.*fabs(vx);
+-		}
+-		if(stabilization==1 || stabilization==2){
+-			TripleMultiply(Bprime,1,numnodes,1,
+-						&D_scalar,1,1,0,
+-						Bprime,1,numnodes,0,
+-						&Ke->values[0],1);
+-		}
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	xDelete<IssmDouble>(B);
+-	xDelete<IssmDouble>(Bprime);
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Seg::CreateKMatrixFreeSurfaceBase {{{*/
+-ElementMatrix* Seg::CreateKMatrixFreeSurfaceBase(void){
+-
+-	/*Intermediaries */
+-	int        stabilization;
+-	IssmDouble Jdet,D_scalar,dt,h;
+-	IssmDouble vx,vel;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke     = new ElementMatrix(nodes,numnodes,this->parameters,NoneApproximationEnum);
+-	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+-	IssmDouble*    B      = xNew<IssmDouble>(1*numnodes);
+-	IssmDouble*    Bprime = xNew<IssmDouble>(1*numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	this->parameters->FindParam(&stabilization,MasstransportStabilizationEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+-	h=this->GetSize();
+-
+-	/* Start  looping on the number of gaussian points: */
+-	GaussSeg *gauss=new GaussSeg(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		GetNodalFunctions(basis,gauss);
+-
+-		vx_input->GetInputValue(&vx,gauss);
+-
+-		D_scalar=gauss->weight*Jdet;
+-
+-		TripleMultiply(basis,1,numnodes,1,
+-					&D_scalar,1,1,0,
+-					basis,1,numnodes,0,
+-					&Ke->values[0],1);
+-
+-		GetNodalFunctions(B,gauss);
+-		GetBprimeMasstransport(Bprime,&xyz_list[0][0],gauss);
+-
+-		D_scalar=dt*gauss->weight*Jdet*vx;
+-		TripleMultiply(B,1,numnodes,1,
+-					&D_scalar,1,1,0,
+-					Bprime,1,numnodes,0,
+-					&Ke->values[0],1);
+-
+-		if(stabilization==2){
+-			/*Streamline upwinding*/
+-			vel=fabs(vx)+1.e-8;
+-			D_scalar=dt*gauss->weight*Jdet*h/(2.*vel)*vx;
+-		}
+-		else if(stabilization==1){
+-			/*SSA*/
+-			vx_input->GetInputAverage(&vx);
+-			D_scalar=dt*gauss->weight*Jdet*h/2.*fabs(vx);
+-		}
+-		if(stabilization==1 || stabilization==2){
+-			TripleMultiply(Bprime,1,numnodes,1,
+-						&D_scalar,1,1,0,
+-						Bprime,1,numnodes,0,
+-						&Ke->values[0],1);
+-		}
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(basis);
+-	xDelete<IssmDouble>(B);
+-	xDelete<IssmDouble>(Bprime);
+-	delete gauss;
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Seg::CreateMassMatrix {{{*/
+-ElementMatrix* Seg::CreateMassMatrix(void){
+-
+-	/* Intermediaries */
+-	IssmDouble  D,Jdet;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke    = new ElementMatrix(nodes,numnodes,this->parameters,NoneApproximationEnum);
+-	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-
+-	/* Start looping on the number of gaussian points: */
+-	GaussSeg* gauss=new GaussSeg(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetNodalFunctions(basis,gauss);
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		D=gauss->weight*Jdet;
+-
+-		TripleMultiply(basis,1,numnodes,1,
+-					&D,1,1,0,
+-					basis,1,numnodes,0,
+-					&Ke->values[0],1);
+-	}
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	xDelete<IssmDouble>(basis);
+-	return Ke;
+-}
+-/*}}}*/
+ /*FUNCTION Seg::GetNumberOfNodes;{{{*/
+ int Seg::GetNumberOfNodes(void){
+ 	return this->NumberofNodes();
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16992)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16993)
+@@ -68,9 +68,7 @@
+ 		void        Configure(Elements* elements,Loads* loads,Nodes* nodesin,Vertices* verticesin,Materials* materials,Parameters* parameters){_error_("not implemented yet");};
+ 		void        SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters){_error_("not implemented yet");};
+ 		void        SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum){_error_("not implemented yet");};
+-		ElementMatrix* CreateKMatrix(void){_error_("not implemented yet");};
+ 		void        CreateDVector(Vector<IssmDouble>* df){_error_("not implemented yet");};
+-		void        CreateJacobianMatrix(Matrix<IssmDouble>* Jff){_error_("not implemented yet");};
+ 		void        Delta18oParameterization(void){_error_("not implemented yet");};
+ 		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){_error_("not implemented yet");};
+ 		void        EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented yet");};
+@@ -256,9 +254,6 @@
+ #endif
+ 		/*}}}*/
+ 		/*Seg specific routines:*/
+-		ElementMatrix* CreateMassMatrix(void);
+-		ElementMatrix* CreateKMatrixFreeSurfaceTop(void);
+-		ElementMatrix* CreateKMatrixFreeSurfaceBase(void);
+ 		IssmDouble     GetSize(void);
+ };
+ #endif  /* _SEG_H */
Index: issm/oecreview/Archive/16554-17801/ISSM-16993-16994.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16993-16994.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16993-16994.diff	(revision 17802)
@@ -0,0 +1,16 @@
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16993)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16994)
+@@ -248,6 +248,11 @@
+ 	}
+ 
+ 	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(B);
++	xDelete<IssmDouble>(Bprime);
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(dbasis);
+ 	delete gauss;
+ 	return Ke;
+ }/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16994-16995.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16994-16995.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16994-16995.diff	(revision 17802)
@@ -0,0 +1,16 @@
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 16994)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 16995)
+@@ -78,7 +78,10 @@
+ 	StressbalanceAnalysis* analysis = new StressbalanceAnalysis();
+ 	ElementMatrix* Ke=analysis->CreateKMatrix(element);
+ 	delete analysis;
+-	if(incomplete_adjoint) return Ke;
++	if(incomplete_adjoint){
++		if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++		return Ke;
++	}
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	basalelement->GetVerticesCoordinates(&xyz_list);
Index: issm/oecreview/Archive/16554-17801/ISSM-16995-16996.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16995-16996.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16995-16996.diff	(revision 17802)
@@ -0,0 +1,272 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16995)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16996)
+@@ -3061,23 +3061,6 @@
+ /*}}}*/
+ #endif
+ 
+-#ifdef _HAVE_STRESSBALANCE_
+-/*FUNCTION Tria::GetYcoord {{{*/
+-IssmDouble Tria::GetYcoord(GaussTria* gauss){
+-
+-	IssmDouble y;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble y_list[NUMVERTICES];
+-
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	for(int i=0;i<NUMVERTICES;i++) y_list[i]=xyz_list[i][1];
+-	TriaRef::GetInputValue(&y,&y_list[0],gauss,P1Enum);
+-
+-	return y;
+-}
+-/*}}}*/
+-#endif
+-
+ #ifdef _HAVE_CONTROL_
+ /*FUNCTION Tria::BalancethicknessMisfit{{{*/
+ IssmDouble Tria::BalancethicknessMisfit(void){
+@@ -4904,75 +4887,6 @@
+ /*}}}*/
+ #endif
+ 
+-#ifdef _HAVE_DAMAGE_
+-/*FUNCTION Tria::DamageEvolutionF{{{*/
+-void Tria::DamageEvolutionF(IssmDouble* f){
+-
+-	/*Intermediaries */
+-	IssmDouble c1,c2,c3,healing,stress_threshold;
+-	IssmDouble s_xx,s_xy,s_yy;
+-	IssmDouble J2s;
+-	IssmDouble Xis;
+-	IssmDouble Psi;
+-	IssmDouble PosPsi;
+-	IssmDouble NegPsi;
+-	Input* damage_input=NULL;
+-	Input* sigma_xx_input  = NULL;
+-	Input* sigma_xy_input  = NULL;
+-	Input* sigma_yy_input  = NULL;
+-	GaussTria* gauss=NULL;
+-	IssmDouble damage,sigma_xx,sigma_xy,sigma_yy;
+-
+-	/*retrieve parameters:*/
+-	this->parameters->FindParam(&c1,DamageC1Enum);
+-	this->parameters->FindParam(&c2,DamageC2Enum);
+-	this->parameters->FindParam(&c3,DamageC3Enum);
+-	this->parameters->FindParam(&healing,DamageHealingEnum);
+-	this->parameters->FindParam(&stress_threshold,DamageStressThresholdEnum);
+-
+-	/*Compute stress tensor: */
+-	this->ComputeStressTensor();
+-
+-	/*retrieve what we need: */
+-	sigma_xx_input  = inputs->GetInput(StressTensorxxEnum);  _assert_(sigma_xx_input);
+-	sigma_xy_input  = inputs->GetInput(StressTensorxyEnum);  _assert_(sigma_xy_input);
+-	sigma_yy_input  = inputs->GetInput(StressTensoryyEnum);  _assert_(sigma_yy_input);
+-	damage_input  = this->material->inputs->GetInput(DamageDbarEnum);        _assert_(damage_input);
+-
+-	/*Damage evolution z mapping: */
+-	gauss=new GaussTria();
+-	J2s=0;
+-	for (int iv=0;iv<NUMVERTICES;iv++){
+-		gauss->GaussVertex(iv);
+-		
+-		damage_input->GetInputValue(&damage,gauss);
+-		sigma_xx_input->GetInputValue(&sigma_xx,gauss);
+-		sigma_xy_input->GetInputValue(&sigma_xy,gauss);
+-		sigma_yy_input->GetInputValue(&sigma_yy,gauss);
+-
+-		s_xx=sigma_xx/(1-damage);
+-		s_xy=sigma_xy/(1-damage);
+-		s_yy=sigma_yy/(1-damage);
+-
+-		J2s=1.0/sqrt(2.0)*sqrt(pow(s_xx,2)+pow(s_yy,2)+2*pow(s_xy,2));
+-		
+-		Xis=sqrt(3.0)*J2s;
+-
+-		Psi=Xis-stress_threshold;
+-
+-		PosPsi=max(Psi,0.0);
+-		NegPsi=max(-Psi,0.0);
+-
+-		f[iv]= c1* ( pow(PosPsi,c2)   -  healing * pow(NegPsi,c2) )  *   pow((1 - damage),-c3);
+-
+-	}
+-	
+-	/*Clean up and return*/
+-	delete gauss;
+-}
+-/*}}}*/
+-#endif
+-
+ #ifdef _HAVE_DAKOTA_
+ /*FUNCTION Tria::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type);{{{*/
+ void  Tria::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16995)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16996)
+@@ -260,11 +260,6 @@
+ 		IssmDouble     StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa){_error_("not implemented yet");};
+ 		void           ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
+ 
+-		#ifdef _HAVE_STRESSBALANCE_
+-		void           PVectorGLSstabilization(ElementVector* pe);
+-		IssmDouble     GetYcoord(GaussTria* gauss);
+-		#endif
+-
+ 		void UpdateConstraintsExtrudeFromBase(void);
+ 		void UpdateConstraintsExtrudeFromTop(void);
+ 		#ifdef _HAVE_THERMAL_
+@@ -282,14 +277,7 @@
+ 		void           HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
+ 		void           HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask);
+ 		void           ComputeEPLThickness(void);
+-
+ 		#endif
+-
+-		#ifdef _HAVE_DAMAGE_
+-		void           DamageEvolutionF(IssmDouble* flist);
+-		#endif
+-
+-
+ 		/*}}}*/
+ 
+ };
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16995)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16996)
+@@ -4519,111 +4519,6 @@
+ 	return De;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::KMatrixGLSstabilization{{{*/
+-void Penta::KMatrixGLSstabilization(ElementMatrix* Ke){
+-
+-	int        numdof  = NUMVERTICES*NDOF4;
+-
+-	/*Intermediaries */
+-	int        i,j;
+-	IssmDouble Jdet,viscosity,FSreconditioning,diameter,rigidity;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
+-	GaussPenta *gauss=NULL;
+-
+-	/*Stabilization*/
+-	IssmDouble D_scalar;
+-	IssmDouble dbasis[3][6];
+-	IssmDouble dmu[3];
+-	IssmDouble mu;
+-	IssmDouble dnodalbasis[6][6][3];
+-	IssmDouble SU[6][4][4];
+-	IssmDouble SW[6][4][4];
+-	int p,q,ii;
+-	int c=3; //index of pressure
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+-	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+-	Input* vz_input=inputs->GetInput(VzEnum); _assert_(vz_input);
+-
+-	/*Find minimal length and B*/
+-	rigidity=material->GetB();
+-	diameter=MinEdgeLength(&xyz_list[0][0]);
+-
+-		gauss=new GaussPenta();
+-		for(int iv=0;iv<6;iv++){
+-			gauss->GaussVertex(iv);
+-			GetNodalFunctionsP1Derivatives(&dbasis[0][0],&xyz_list[0][0],gauss);
+-			for(i=0;i<6;i++){
+-				for(j=0;j<3;j++){
+-					dnodalbasis[i][iv][j] = dbasis[j][i];
+-				}
+-			}
+-		}
+-		delete gauss;
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussPenta(5,5);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-
+-		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+-		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
+-
+-		D_scalar=gauss->weight*Jdet;
+-
+-		/*Add stabilization*/
+-		GetNodalFunctionsP1Derivatives(&dbasis[0][0],&xyz_list[0][0],gauss);
+-		dmu[0]=0.; dmu[1]=0.; dmu[2]=0.;
+-		mu = 2.*viscosity;
+-		for(p=0;p<6;p++) for(i=0;i<4;i++) for(j=0;j<4;j++){
+-			SU[p][i][j]=0.;
+-			SW[p][i][j]=0.;
+-		}
+-		for(p=0;p<6;p++){
+-			for(i=0;i<3;i++){
+-				SU[p][i][c] += dbasis[i][p];
+-				SW[p][c][i] += dbasis[i][p];
+-				for(j=0;j<3;j++){
+-					SU[p][i][i] += -dmu[j]*dbasis[j][p];
+-					SU[p][i][j] += -dmu[i]*dbasis[i][p];
+-					for(ii=0;ii<6;ii++){
+-						SU[p][i][i] += -mu*dnodalbasis[p][ii][j]*dbasis[j][ii];
+-						SU[p][i][j] += -mu*dnodalbasis[p][ii][i]*dbasis[j][ii];
+-					}
+-					SW[p][i][i] += -dmu[j]*dbasis[j][p];
+-					SW[p][j][i] += -dmu[j]*dbasis[i][p];
+-					for(ii=0;ii<6;ii++){
+-						SW[p][i][i] += -mu*dnodalbasis[p][ii][j]*dbasis[j][ii];
+-						SW[p][j][i] += -mu*dnodalbasis[p][ii][i]*dbasis[j][ii];
+-					}
+-				}
+-			}
+-		}
+-		IssmDouble tau = 1./3.*pow(diameter,2)/(8.*2.*viscosity);
+-		for(p=0;p<6;p++){
+-			for(q=0;q<6;q++){
+-				for(i=0;i<4;i++){
+-					for(j=0;j<4;j++){
+-						Ke->values[(p*4+i)*numdof+q*4+j] += gauss->weight*Jdet*tau*SW[p][i][0]*SU[q][0][j];
+-						Ke->values[(p*4+i)*numdof+q*4+j] += gauss->weight*Jdet*tau*SW[p][i][1]*SU[q][1][j];
+-						Ke->values[(p*4+i)*numdof+q*4+j] += gauss->weight*Jdet*tau*SW[p][i][2]*SU[q][2][j];
+-					}
+-				}
+-			}
+-		}
+-	}
+-
+-	/*Clean up*/
+-	delete gauss;
+-}
+-/*}}}*/
+ #endif
+ 
+ #ifdef _HAVE_HYDROLOGY_
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16995)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16996)
+@@ -211,8 +211,6 @@
+ 		void           GetInputValue(IssmDouble* pvalue,Gauss* gauss,int enum_type);
+ 		void           GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype);
+ 		Node*          GetNode(int node_number);
+-		void           GetStrainRate3dHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss, Input* vx_input, Input* vy_input);
+-		void           GetStrainRate3d(IssmDouble* epsilon,IssmDouble* xyz_list, Gauss* gauss, Input* vx_input, Input* vy_input, Input* vz_input);
+ 		Penta*         GetUpperElement(void);
+ 		Penta*         GetLowerElement(void);
+ 		void           InputChangeName(int input_enum, int enum_type_old);
+@@ -256,7 +254,6 @@
+ 		#ifdef _HAVE_STRESSBALANCE_
+ 		ElementVector* CreateDVectorStressbalanceHoriz(void);
+ 		ElementVector* CreateDVectorStressbalanceFS(void);
+-		void           KMatrixGLSstabilization(ElementMatrix* Ke);
+ 		#endif
+ 
+ 		#ifdef _HAVE_HYDROLOGY_
Index: issm/oecreview/Archive/16554-17801/ISSM-16996-16997.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16996-16997.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16996-16997.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16996)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16997)
+@@ -3629,6 +3629,7 @@
+ 	xDelete<Node*>(node_list);
+ 	xDelete<IssmDouble>(xyz_list_tria);
+ 	xDelete<IssmDouble>(Ke_gg);
++	xDelete<IssmDouble>(L);
+ 	return Ke;
+ }/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixCouplingSSAHOViscous(Element* element){/*{{{*/
Index: issm/oecreview/Archive/16554-17801/ISSM-16997-16998.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16997-16998.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16997-16998.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/test/NightlyRun/test3104.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test3104.m	(revision 16997)
++++ ../trunk-jpl/test/NightlyRun/test3104.m	(revision 16998)
+@@ -11,7 +11,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure'};
+-field_tolerances={1e-08,1e-08,2e-07,1e-08,1e-08};
++field_tolerances={1e-08,1e-08,2.2e-07,1e-08,1e-08};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
Index: issm/oecreview/Archive/16554-17801/ISSM-16998-16999.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16998-16999.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16998-16999.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16998)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16999)
+@@ -2618,7 +2618,7 @@
+ 
+ 		this->GetBFSFriction(B,element,dim,xyz_list_base,gauss);
+ 		element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
+-		for(int i=0;i<2;i++) D[i*(dim-1)+i] = alpha2*gauss->weight*Jdet; //taub_x = -alpha2 v_x (same for y)
++		for(int i=0;i<dim-1;i++) D[i*(dim-1)+i] = alpha2*gauss->weight*Jdet; //taub_x = -alpha2 v_x (same for y)
+ 
+ 		TripleMultiply(B,dim-1,numdof,1,
+ 					D,dim-1,dim-1,0,
Index: issm/oecreview/Archive/16554-17801/ISSM-16999-17000.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-16999-17000.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-16999-17000.diff	(revision 17802)
@@ -0,0 +1,726 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h	(revision 17000)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix2D(Element* element);
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 17000)
+@@ -81,6 +81,10 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementVector* HydrologyShreveAnalysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
+ ElementMatrix* HydrologyShreveAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp	(revision 17000)
+@@ -25,6 +25,10 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementVector* BalancethicknessSoftAnalysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
+ ElementMatrix* BalancethicknessSoftAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17000)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 17000)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 17000)
+@@ -113,6 +113,10 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementVector* BalancethicknessAnalysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
+ ElementMatrix* BalancethicknessAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.h	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.h	(revision 17000)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrixVolume(Element* element);
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17000)
+@@ -95,6 +95,10 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementVector* HydrologyDCEfficientAnalysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
+ ElementMatrix* HydrologyDCEfficientAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h	(revision 17000)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrixVolume(Element* element);
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 17000)
+@@ -25,6 +25,10 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementVector* AdjointHorizAnalysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
+ ElementMatrix* AdjointHorizAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 17000)
+@@ -58,6 +58,10 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementVector* BalancevelocityAnalysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
+ ElementMatrix* BalancevelocityAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/MeltingAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeltingAnalysis.h	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/MeltingAnalysis.h	(revision 17000)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+Index: ../trunk-jpl/src/c/analyses/GiaAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/GiaAnalysis.h	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/GiaAnalysis.h	(revision 17000)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 17000)
+@@ -54,6 +54,10 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementVector* L2ProjectionBaseAnalysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
+ ElementMatrix* L2ProjectionBaseAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17000)
+@@ -87,6 +87,10 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementVector* FreeSurfaceTopAnalysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
+ ElementMatrix* FreeSurfaceTopAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h	(revision 17000)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h	(revision 17000)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 17000)
+@@ -95,6 +95,10 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementVector* StressbalanceVerticalAnalysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
+ ElementMatrix* StressbalanceVerticalAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/Analysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/Analysis.h	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/Analysis.h	(revision 17000)
+@@ -32,6 +32,7 @@
+ 		virtual void CreateLoads(Loads* loads, IoModel* iomodel)=0;
+ 
+ 		/*Finite element Analysis*/
++		virtual ElementVector* CreateDVector(Element* element)=0;
+ 		virtual ElementMatrix* CreateJacobianMatrix(Element* element)=0;
+ 		virtual ElementMatrix* CreateKMatrix(Element* element)=0;
+ 		virtual ElementVector* CreatePVector(Element* element)=0;
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h	(revision 17000)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrixCG(Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 17000)
+@@ -134,6 +134,10 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementVector* StressbalanceSIAAnalysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
+ ElementMatrix* StressbalanceSIAAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h	(revision 17000)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17000)
+@@ -811,6 +811,10 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementVector* StressbalanceAnalysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ 
+ 	int approximation;
+Index: ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h	(revision 17000)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h	(revision 17000)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrixVolume(Element* element);
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h	(revision 17000)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h	(revision 17000)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17000)
+@@ -136,6 +136,10 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementVector* HydrologyDCInefficientAnalysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
+ ElementMatrix* HydrologyDCInefficientAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17000)
+@@ -111,6 +111,10 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementVector* ThermalAnalysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
+ ElementMatrix* ThermalAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h	(revision 17000)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h	(revision 17000)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 17000)
+@@ -36,6 +36,10 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementVector* ExtrudeFromBaseAnalysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
+ ElementMatrix* ExtrudeFromBaseAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 17000)
+@@ -71,6 +71,10 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementVector* MeltingAnalysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
+ ElementMatrix* MeltingAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/GiaAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/GiaAnalysis.cpp	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/GiaAnalysis.cpp	(revision 17000)
+@@ -37,6 +37,10 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementVector* GiaAnalysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
+ ElementMatrix* GiaAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h	(revision 17000)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h	(revision 17000)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h	(revision 17000)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrixCG(Element* element);
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 17000)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h	(revision 17000)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrixSSA(Element* element);
+Index: ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h	(revision 17000)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+Index: ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 17000)
+@@ -25,6 +25,10 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementVector* AdjointBalancethicknessAnalysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
+ ElementMatrix* AdjointBalancethicknessAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h	(revision 17000)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 17000)
+@@ -69,6 +69,10 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementVector* L2ProjectionEPLAnalysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
+ ElementMatrix* L2ProjectionEPLAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/EnumToAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnumToAnalysis.h	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/EnumToAnalysis.h	(revision 17000)
+@@ -15,6 +15,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17000)
+@@ -211,6 +211,10 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementVector* MasstransportAnalysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
+ ElementMatrix* MasstransportAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h	(revision 17000)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17000)
+@@ -94,6 +94,10 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementVector* DamageEvolutionAnalysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
+ ElementMatrix* DamageEvolutionAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17000)
+@@ -183,6 +183,10 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementVector* EnthalpyAnalysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
+ ElementMatrix* EnthalpyAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp	(revision 17000)
+@@ -25,6 +25,10 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementVector* MeshdeformationAnalysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
+ ElementMatrix* MeshdeformationAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17000)
+@@ -89,6 +89,10 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementVector* FreeSurfaceBaseAnalysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
+ ElementMatrix* FreeSurfaceBaseAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 17000)
+@@ -44,6 +44,10 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementVector* SmoothedSurfaceSlopeXAnalysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
+ ElementMatrix* SmoothedSurfaceSlopeXAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 17000)
+@@ -36,6 +36,10 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementVector* ExtrudeFromTopAnalysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
+ ElementMatrix* ExtrudeFromTopAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 17000)
+@@ -44,6 +44,10 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++ElementVector* SmoothedSurfaceSlopeYAnalysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
+ ElementMatrix* SmoothedSurfaceSlopeYAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h	(revision 16999)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h	(revision 17000)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrixVolume(Element* element);
Index: issm/oecreview/Archive/16554-17801/ISSM-17000-17001.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17000-17001.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17000-17001.diff	(revision 17802)
@@ -0,0 +1,259 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17000)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17001)
+@@ -61,6 +61,7 @@
+ 		void GetBHOFriction(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void InputUpdateFromSolutionHO(IssmDouble* solution,Element* element);
+ 		/*FS*/
++		ElementVector* CreateDVectorFS(Element* element);
+ 		ElementMatrix* CreateJacobianMatrixFS(Element* element);
+ 		ElementMatrix* CreateKMatrixFS(Element* element);
+ 		ElementMatrix* CreateKMatrixFSViscous(Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17000)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17001)
+@@ -812,8 +812,17 @@
+ 
+ /*Finite Element Analysis*/
+ ElementVector* StressbalanceAnalysis::CreateDVector(Element* element){/*{{{*/
+-	/*Default, return NULL*/
++
++	int approximation;
++	element->GetInputValue(&approximation,ApproximationEnum);
++	switch(approximation){
++		case FSApproximationEnum: 
++			return CreateDVectorFS(element);
++		default:
++			return NULL; //no need for doftypes outside of FS approximation
++	}
+ 	return NULL;
++
+ }/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ 
+@@ -2380,6 +2389,35 @@
+ }/*}}}*/
+ 
+ /*FS*/
++ElementVector* StressbalanceAnalysis::CreateDVectorFS(Element* element){/*{{{*/
++
++	int         meshtype,dim;
++
++	/*Get problem dimension*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; break;
++		case Mesh3DEnum:         dim = 3; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int vnumnodes = element->GetNumberOfNodesVelocity();
++	int pnumnodes = element->GetNumberOfNodesPressure();
++
++	/*Initialize output vector*/
++	ElementVector* de = element->NewElementVector(FSvelocityEnum);
++
++	for(int i=0;i<vnumnodes;i++){
++		for(int j=0;j<dim;j++) de->values[i*dim+j]=VelocityEnum;
++	}
++	for(int i=0;i<pnumnodes;i++){
++		de->values[vnumnodes*dim+i]=PressureEnum;
++	}
++
++	return de;
++
++}/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateJacobianMatrixFS(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries */
+Index: ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 17000)
++++ ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 17001)
+@@ -101,9 +101,13 @@
+ 	}
+ 
+ 	/*Create dof vector for stiffness matrix preconditioning*/
+-	for (i=0;i<femmodel->elements->Size();i++){
+-		element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+-		element->CreateDVector(df);
++	if(pdf){
++		for(i=0;i<femmodel->elements->Size();i++){
++			element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++			ElementVector* de=analysis->CreateDVector(element);
++			if(de) de->InsertIntoGlobal(df);
++			delete de;
++		}
+ 	}
+ 
+ 	/*Assemble matrices and vector*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17000)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17001)
+@@ -103,7 +103,6 @@
+ 		virtual void       Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters)=0;
+ 		virtual void       SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters)=0;
+ 		virtual void       SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum)=0;
+-		virtual void   CreateDVector(Vector<IssmDouble>* df)=0;
+ 		virtual void   ElementSizes(IssmDouble* phx,IssmDouble* phy,IssmDouble* phz)=0;
+ 		virtual void   EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure)=0;
+ 		virtual IssmDouble EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17000)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17001)
+@@ -190,12 +190,6 @@
+ 	return sqrt(2*this->GetArea());
+ }
+ /*}}}*/
+-/*FUNCTION Tria::CreateDVector {{{*/
+-void  Tria::CreateDVector(Vector<IssmDouble>* df){
+-
+-	/*Nothing done yet*/
+-}
+-/*}}}*/
+ /*FUNCTION Tria::ComputeBasalStress {{{*/
+ void  Tria::ComputeBasalStress(Vector<IssmDouble>* eps){
+ 	_error_("Not Implemented yet");
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17000)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17001)
+@@ -66,7 +66,6 @@
+ 		void        Configure(Elements* elements,Loads* loads,Nodes* nodesin,Vertices* verticesin,Materials* materials,Parameters* parameters);
+ 		void        SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters);
+ 		void        SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum);
+-		void        CreateDVector(Vector<IssmDouble>* df);
+ 		void        Delta18oParameterization(void);
+ 		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){_error_("not implemented yet");};
+ 		void        EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17000)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17001)
+@@ -378,32 +378,6 @@
+ 	this->inputs->Configure(parameters);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::CreateDVector {{{*/
+-void  Penta::CreateDVector(Vector<IssmDouble>* df){
+-
+-	/*retrieve parameters: */
+-	ElementVector* De=NULL;
+-	int analysis_type;
+-	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-
+-	/*Checks in debugging*/
+-	_assert_(this->nodes && this->material && this->matpar && this->verticalneighbors && this->parameters && this->inputs);
+-
+-	switch(analysis_type){
+-		#ifdef _HAVE_STRESSBALANCE_
+-		case StressbalanceAnalysisEnum:
+-			De=CreateDVectorStressbalanceHoriz();
+-			break;
+-		#endif
+-	}
+-
+-	/*Add to global Vector*/
+-	if(De){
+-		De->InsertIntoGlobal(df);
+-		delete De;
+-	}
+-}
+-/*}}}*/
+ /*FUNCTION Penta::DeepEcho{{{*/
+ void Penta::DeepEcho(void){
+ 
+@@ -4475,52 +4449,6 @@
+ /*}}}*/
+ #endif
+ 
+-#ifdef _HAVE_STRESSBALANCE_
+-/*FUNCTION Penta::CreateDVectorStressbalanceHoriz {{{*/
+-ElementVector* Penta::CreateDVectorStressbalanceHoriz(void){
+-
+-	int approximation;
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-
+-	switch(approximation){
+-		case FSApproximationEnum:
+-			return CreateDVectorStressbalanceFS();
+-		default:
+-			return NULL; //no need for doftypes outside of FS approximation
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION Penta::CreateDVectorStressbalanceFS{{{*/
+-ElementVector* Penta::CreateDVectorStressbalanceFS(void){
+-
+-	/*output: */
+-	ElementVector* De=NULL;
+-
+-	/*Initialize Element vector and return if necessary*/
+-	int approximation;
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-	if(approximation!=FSApproximationEnum) return NULL;
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumnodes = this->NumberofNodesPressure();
+-
+-	De=new ElementVector(nodes,vnumnodes+pnumnodes,this->parameters,FSvelocityEnum);
+-
+-	for(int i=0;i<vnumnodes;i++){
+-		De->values[i*3+0]=VelocityEnum;
+-		De->values[i*3+1]=VelocityEnum;
+-		De->values[i*3+2]=VelocityEnum;
+-	}
+-	for(int i=0;i<pnumnodes;i++){
+-		De->values[vnumnodes*3+i]=PressureEnum;
+-	}
+-
+-	return De;
+-}
+-/*}}}*/
+-#endif
+-
+ #ifdef _HAVE_HYDROLOGY_
+ /*FUNCTION Penta::CreateEPLDomainMassMatrix {{{*/
+ ElementMatrix* Penta::CreateEPLDomainMassMatrix(void){
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17000)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17001)
+@@ -70,7 +70,6 @@
+ 		int    FiniteElement(void);
+ 		void   SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters);
+ 		void   SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum);
+-		void   CreateDVector(Vector<IssmDouble>* df);
+ 		void   Delta18oParameterization(void);
+ 		void   EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure);
+ 		Element* GetBasalElement(void);
+@@ -251,11 +250,6 @@
+ 		Tria*	         SpawnTria(int location);
+ 		IssmDouble     StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa);
+ 
+-		#ifdef _HAVE_STRESSBALANCE_
+-		ElementVector* CreateDVectorStressbalanceHoriz(void);
+-		ElementVector* CreateDVectorStressbalanceFS(void);
+-		#endif
+-
+ 		#ifdef _HAVE_HYDROLOGY_
+ 		ElementMatrix* CreateEPLDomainMassMatrix(void);
+ 		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17000)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17001)
+@@ -68,7 +68,6 @@
+ 		void        Configure(Elements* elements,Loads* loads,Nodes* nodesin,Vertices* verticesin,Materials* materials,Parameters* parameters){_error_("not implemented yet");};
+ 		void        SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters){_error_("not implemented yet");};
+ 		void        SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum){_error_("not implemented yet");};
+-		void        CreateDVector(Vector<IssmDouble>* df){_error_("not implemented yet");};
+ 		void        Delta18oParameterization(void){_error_("not implemented yet");};
+ 		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){_error_("not implemented yet");};
+ 		void        EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-17001-17002.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17001-17002.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17001-17002.diff	(revision 17802)
@@ -0,0 +1,60 @@
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h	(revision 17001)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h	(revision 17002)
+@@ -35,6 +35,12 @@
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ 
++		/*Modules*/
++		static void PostProcessing(FemModel* femmodel);
++		static void ComputeBasalMeltingrate(Element* element);
++		static void DrainWaterfraction(Element* element);
++		static void UpdateBasalConstraints(Element* element);
++
+ 		/*Intermediaries*/
+ 		IssmDouble EnthalpyDiffusionParameter(Element* element,IssmDouble enthalpy,IssmDouble pressure);
+ 		IssmDouble EnthalpyDiffusionParameterVolume(Element* element,int enthalpy_enum);
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17001)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17002)
+@@ -784,6 +784,38 @@
+ 	xDelete<int>(doflist);
+ }/*}}}*/
+ 
++
++/*Modules*/
++void EnthalpyAnalysis::PostProcessing(FemModel* femmodel){/*{{{*/
++
++	/*Compute basal melting rates: */
++	for(int i=0;i<femmodel->elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++		ComputeBasalMeltingrate(element);
++	}
++
++	/*drain excess water fraction: */
++	//for(int i=0;i<femmodel->elements->Size();i++){
++	//	element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++	//	element->DrainWaterfraction();
++	//}
++
++	/*Update basal dirichlet BCs for enthalpy: */
++	for(int i=0;i<femmodel->elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++		UpdateBasalConstraints(element);
++	}
++}/*}}}*/
++void EnthalpyAnalysis::ComputeBasalMeltingrate(Element* element){/*{{{*/
++
++}/*}}}*/
++void EnthalpyAnalysis::DrainWaterfraction(Element* element){/*{{{*/
++
++}/*}}}*/
++void EnthalpyAnalysis::UpdateBasalConstraints(Element* element){/*{{{*/
++
++}/*}}}*/
++
+ /*Intermediaries*/
+ IssmDouble EnthalpyAnalysis::EnthalpyDiffusionParameter(Element* element,IssmDouble enthalpy,IssmDouble pressure){/*{{{*/
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17002-17003.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17002-17003.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17002-17003.diff	(revision 17802)
@@ -0,0 +1,21 @@
+Index: ../trunk-jpl/src/m/interp/export_geotif.m
+===================================================================
+--- ../trunk-jpl/src/m/interp/export_geotif.m	(revision 0)
++++ ../trunk-jpl/src/m/interp/export_geotif.m	(revision 17003)
+@@ -0,0 +1,16 @@
++function export_geotif(filename,ref)
++%EXPORT_GEOTIF - export geotiff 
++%
++%
++% Usage: export_geotif('Articles/figures/figure','EPSG:3411');
++%
++
++
++	%first export the figure
++	export_fig([filename '.jpg']);
++
++	%call gdal on this: 
++	system(sprintf('gdal_translate -a_srs %s -of GTiff -co "INTERLEAVE=PIXEL" -a_ullr %g %g %g %g %s.jpg %s.tif', ref, min(xlim), max(ylim),max(xlim),min(ylim),filename,filename));
++	system(['rm -rf ' filename '.jpg']);
++
++end
Index: issm/oecreview/Archive/16554-17801/ISSM-17003-17004.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17003-17004.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17003-17004.diff	(revision 17802)
@@ -0,0 +1,50 @@
+Index: ../trunk-jpl/src/m/print/export_geotiff.m
+===================================================================
+--- ../trunk-jpl/src/m/print/export_geotiff.m	(revision 0)
++++ ../trunk-jpl/src/m/print/export_geotiff.m	(revision 17004)
+@@ -0,0 +1,24 @@
++function export_geotiff(filename,ref)
++%EXPORT_GEOTIF - export geotiff 
++%
++%   Usage:
++%      export_geotif(filename,ref);
++%
++%      This function must be called after plotmodel
++%      filname: no extension
++%      ref:     UPS Greenland  EPSG:3413 (http://www.spatialreference.org/ref/epsg/3413/)
++%               UPS Antarctica EPSG:3031 (http://www.spatialreference.org/ref/epsg/3031/)
++%
++%   Example:
++%      export_geotif('Greenland','EPSG:3413');
++
++%Get axis limits and convert to strings
++XLIM = xlim(); x0 = num2str(XLIM(1)); x1 = num2str(XLIM(2));
++YLIM = ylim(); y0 = num2str(YLIM(1)); y1 = num2str(YLIM(2));
++
++%first export the figure
++export_fig([filename '.jpg']);
++
++%call gdal on this: 
++system(['gdal_translate -a_srs ' ref ' -of GTiff -co "INTERLEAVE=PIXEL" -a_ullr ' x0 ' ' y1 ' ' x1 ' ' y0 ' ' filename '.jpg ' filename '.tif']);
++system(['rm -rf ' filename '.jpg']);
+Index: ../trunk-jpl/src/m/interp/export_geotif.m
+===================================================================
+--- ../trunk-jpl/src/m/interp/export_geotif.m	(revision 17003)
++++ ../trunk-jpl/src/m/interp/export_geotif.m	(revision 17004)
+@@ -1,16 +0,0 @@
+-function export_geotif(filename,ref)
+-%EXPORT_GEOTIF - export geotiff 
+-%
+-%
+-% Usage: export_geotif('Articles/figures/figure','EPSG:3411');
+-%
+-
+-
+-	%first export the figure
+-	export_fig([filename '.jpg']);
+-
+-	%call gdal on this: 
+-	system(sprintf('gdal_translate -a_srs %s -of GTiff -co "INTERLEAVE=PIXEL" -a_ullr %g %g %g %g %s.jpg %s.tif', ref, min(xlim), max(ylim),max(xlim),min(ylim),filename,filename));
+-	system(['rm -rf ' filename '.jpg']);
+-
+-end
Index: issm/oecreview/Archive/16554-17801/ISSM-17004-17005.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17004-17005.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17004-17005.diff	(revision 17802)
@@ -0,0 +1,688 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h	(revision 17005)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
+ 		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 17005)
+@@ -81,6 +81,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++void           HydrologyShreveAnalysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented");
++}/*}}}*/
+ ElementVector* HydrologyShreveAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp	(revision 17005)
+@@ -25,6 +25,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++void           BalancethicknessSoftAnalysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented");
++}/*}}}*/
+ ElementVector* BalancethicknessSoftAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17005)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
+ 		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 17005)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
+ 		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 17005)
+@@ -113,6 +113,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++void           BalancethicknessAnalysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented");
++}/*}}}*/
+ ElementVector* BalancethicknessAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.h	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.h	(revision 17005)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
+ 		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17005)
+@@ -95,6 +95,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++void           HydrologyDCEfficientAnalysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented");
++}/*}}}*/
+ ElementVector* HydrologyDCEfficientAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h	(revision 17005)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
+ 		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 17005)
+@@ -25,6 +25,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++void           AdjointHorizAnalysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented");
++}/*}}}*/
+ ElementVector* AdjointHorizAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+Index: ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 17005)
+@@ -58,6 +58,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++void           BalancevelocityAnalysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented");
++}/*}}}*/
+ ElementVector* BalancevelocityAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+Index: ../trunk-jpl/src/c/analyses/MeltingAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeltingAnalysis.h	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/MeltingAnalysis.h	(revision 17005)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
+ 		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+Index: ../trunk-jpl/src/c/analyses/GiaAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/GiaAnalysis.h	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/GiaAnalysis.h	(revision 17005)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
+ 		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 17005)
+@@ -54,6 +54,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++void           L2ProjectionBaseAnalysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented");
++}/*}}}*/
+ ElementVector* L2ProjectionBaseAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17005)
+@@ -87,6 +87,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++void           FreeSurfaceTopAnalysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented");
++}/*}}}*/
+ ElementVector* FreeSurfaceTopAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+Index: ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h	(revision 17005)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
+ 		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h	(revision 17005)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
+ 		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 17005)
+@@ -95,6 +95,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++void           StressbalanceVerticalAnalysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented");
++}/*}}}*/
+ ElementVector* StressbalanceVerticalAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h	(revision 17005)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
+ 		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 17005)
+@@ -134,6 +134,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++void           StressbalanceSIAAnalysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented");
++}/*}}}*/
+ ElementVector* StressbalanceSIAAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h	(revision 17005)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
+ 		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17005)
+@@ -811,6 +811,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++void           StressbalanceAnalysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented");
++}/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreateDVector(Element* element){/*{{{*/
+ 
+ 	int approximation;
+Index: ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h	(revision 17005)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
+ 		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h	(revision 17005)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
+ 		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h	(revision 17005)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
+ 		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h	(revision 17005)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
+ 		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17005)
+@@ -136,6 +136,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++void           HydrologyDCInefficientAnalysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented");
++}/*}}}*/
+ ElementVector* HydrologyDCInefficientAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17005)
+@@ -111,6 +111,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++void           ThermalAnalysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented");
++}/*}}}*/
+ ElementVector* ThermalAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h	(revision 17005)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
+ 		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h	(revision 17005)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
+ 		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 17005)
+@@ -36,6 +36,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++void           ExtrudeFromBaseAnalysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented");
++}/*}}}*/
+ ElementVector* ExtrudeFromBaseAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+Index: ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 17005)
+@@ -71,6 +71,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++void           MeltingAnalysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented");
++}/*}}}*/
+ ElementVector* MeltingAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+Index: ../trunk-jpl/src/c/analyses/GiaAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/GiaAnalysis.cpp	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/GiaAnalysis.cpp	(revision 17005)
+@@ -37,6 +37,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++void           GiaAnalysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented");
++}/*}}}*/
+ ElementVector* GiaAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h	(revision 17005)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
+ 		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h	(revision 17005)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
+ 		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h	(revision 17005)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
+ 		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 17005)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
+ 		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h	(revision 17005)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
+ 		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+Index: ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h	(revision 17005)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
+ 		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+Index: ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 17005)
+@@ -25,6 +25,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++void           AdjointBalancethicknessAnalysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented");
++}/*}}}*/
+ ElementVector* AdjointBalancethicknessAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h	(revision 17005)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
+ 		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 17005)
+@@ -69,6 +69,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++void           L2ProjectionEPLAnalysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented");
++}/*}}}*/
+ ElementVector* L2ProjectionEPLAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+Index: ../trunk-jpl/src/c/analyses/EnumToAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnumToAnalysis.h	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/EnumToAnalysis.h	(revision 17005)
+@@ -15,6 +15,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
+ 		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17005)
+@@ -211,6 +211,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++void           MasstransportAnalysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented");
++}/*}}}*/
+ ElementVector* MasstransportAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h	(revision 17005)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
+ 		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17005)
+@@ -94,6 +94,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++void           DamageEvolutionAnalysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented");
++}/*}}}*/
+ ElementVector* DamageEvolutionAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17005)
+@@ -183,6 +183,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++void           EnthalpyAnalysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented");
++}/*}}}*/
+ ElementVector* EnthalpyAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+Index: ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp	(revision 17005)
+@@ -25,6 +25,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++void           MeshdeformationAnalysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented");
++}/*}}}*/
+ ElementVector* MeshdeformationAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17005)
+@@ -89,6 +89,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++void           FreeSurfaceBaseAnalysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented");
++}/*}}}*/
+ ElementVector* FreeSurfaceBaseAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 17005)
+@@ -44,6 +44,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++void           SmoothedSurfaceSlopeXAnalysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented");
++}/*}}}*/
+ ElementVector* SmoothedSurfaceSlopeXAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 17005)
+@@ -36,6 +36,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++void           ExtrudeFromTopAnalysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented");
++}/*}}}*/
+ ElementVector* ExtrudeFromTopAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 17005)
+@@ -44,6 +44,9 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
++void           SmoothedSurfaceSlopeYAnalysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented");
++}/*}}}*/
+ ElementVector* SmoothedSurfaceSlopeYAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h	(revision 17004)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h	(revision 17005)
+@@ -20,6 +20,7 @@
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+ 		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
+ 		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
Index: issm/oecreview/Archive/16554-17801/ISSM-17005-17006.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17005-17006.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17005-17006.diff	(revision 17802)
@@ -0,0 +1,294 @@
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17005)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17006)
+@@ -79,16 +79,9 @@
+ 		ug_sed_main_iter=ug_sed->Duplicate();
+ 		ug_sed->Copy(ug_sed_main_iter);
+ 		
+-		//test
+-		/* uf_sed_sub_iter=uf_sed->Duplicate(); */
+-		/* uf_sed->Copy(uf_sed_sub_iter); */
+-
+ 		if(isefficientlayer){
+ 			ug_epl_main_iter=ug_epl->Duplicate();
+ 			ug_epl->Copy(ug_epl_main_iter);
+-			//test
+-			ug_epl_sub_iter=ug_epl->Duplicate();
+-			ug_epl->Copy(ug_epl_sub_iter);
+ 		}
+ 
+ 		femmodel->SetCurrentConfiguration(HydrologyDCInefficientAnalysisEnum);
+@@ -103,6 +96,7 @@
+ 		/*Iteration on the sediment layer*/
+ 		sedconverged=false;
+ 		for(;;){
++
+ 			uf_sed_sub_iter=uf_sed->Duplicate();_assert_(uf_sed_sub_iter);
+ 			uf_sed->Copy(uf_sed_sub_iter);
+ 			SystemMatricesx(&Kff,&Kfs,&pf,&df,&sediment_kmax,femmodel);
+@@ -120,6 +114,7 @@
+ 				if(VerboseConvergence()) _printf0_("   # Sediment unstable constraints = " << num_unstable_constraints << "\n");
+ 				if(num_unstable_constraints==0) sedconverged = true;
+ 				if (sedcount>=hydro_maxiter){
++					//sedconverged=true;
+ 					_error_("   maximum number of Sediment iterations (" << hydro_maxiter << ") exceeded");
+ 				}
+ 			}
+@@ -127,7 +122,15 @@
+ 			sedcount++;
+ 
+ 			if(sedconverged){
+-				sedconverged=false;
++				if(isefficientlayer){ 
++					/*Updating Elemental Mask*/
++					HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
++					analysis->ElementizeEplMask(femmodel);
++					delete analysis;
++					femmodel->HydrologyTransferx();
++				}
++				sedconverged=false;	
++				/*Checking convegence on the value of the sediment head*/
+ 				duf=uf_sed_sub_iter->Duplicate();_assert_(duf);
+ 				uf_sed_sub_iter->Copy(duf);
+ 				duf->AYPX(uf_sed,-1.0);
+@@ -136,6 +139,7 @@
+ 				nu_sed=uf_sed_sub_iter->Norm(NORM_TWO);
+ 				if (xIsNan<IssmDouble>(ndu_sed) || xIsNan<IssmDouble>(nu_sed)) _error_("convergence criterion is NaN!");
+ 				if (ndu_sed==0.0 && nu_sed==0.0) nu_sed=1.0e-6; /*Hacking the case where the EPL is used but empty*/
++				if(VerboseConvergence()) _printf0_(setw(50) << left << "   Inner Sediment Convergence criterion:" << ndu_sed/nu_sed*100 << " aiming lower than " << eps_hyd*100 << " %\n");
+ 				if((ndu_sed/nu_sed)<eps_hyd){
+ 					if(VerboseConvergence()) _printf0_("   # Inner sediment convergence achieve \n");
+ 					sedconverged=true;
+@@ -144,13 +148,6 @@
+ 			delete uf_sed_sub_iter;
+ 
+ 			if(sedconverged){
+-				if(isefficientlayer){
+-				 	/*Updating Nodal Mask*/
+-					HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
+-					analysis->ElementizeEplMask(femmodel);
+-					delete analysis;
+-					femmodel->HydrologyTransferx();
+-				}
+ 				femmodel->parameters->SetParam(sediment_kmax,HydrologySedimentKmaxEnum);
+ 				InputUpdateFromConstantx(femmodel,sedconverged,ConvergedEnum);
+ 				InputUpdateFromSolutionx(femmodel,ug_sed);
+@@ -165,7 +162,6 @@
+ 			femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
+ 			InputUpdateFromConstantx(femmodel,true,ResetPenaltiesEnum);
+ 			InputUpdateFromConstantx(femmodel,false,ConvergedEnum);
+-			femmodel->HydrologyEPLupdateDomainx();
+ 			femmodel->parameters->SetParam(HydrologyEfficientEnum,HydrologyLayerEnum);
+ 
+ 			/*Iteration on the EPL layer*/
+@@ -187,9 +183,9 @@
+ 
+ 				//updating mask after the computation of the epl thickness (Allow to close too thin EPL)
+ 				femmodel->HydrologyEPLupdateDomainx();
++					
+ 				ug_epl_sub_iter=ug_epl->Duplicate();_assert_(ug_epl_sub_iter);
+-				ug_epl->Copy(ug_epl_sub_iter);_assert_(ug_epl);
+-				
++				ug_epl->Copy(ug_epl_sub_iter);
+ 				SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
+ 				CreateNodalConstraintsx(&ys,femmodel->nodes,HydrologyDCEfficientAnalysisEnum);
+ 				Reduceloadx(pf,Kfs,ys); delete Kfs;
+@@ -203,14 +199,13 @@
+ 				Mergesolutionfromftogx(&ug_epl,uf_epl,ys,femmodel->nodes,femmodel->parameters); delete ys;
+ 				InputUpdateFromSolutionx(femmodel,ug_epl);
+ 				ConstraintsStatex(&constraints_converged,&num_unstable_constraints,femmodel);
+-				femmodel->HydrologyEPLupdateDomainx();			
+ 
++
+ 				if (!eplconverged){
+ 					if(VerboseConvergence()) _printf0_("   # EPL unstable constraints = " << num_unstable_constraints << "\n");
+ 					if(num_unstable_constraints==0) eplconverged = true;
+ 					if (eplcount>=hydro_maxiter){
+-					/*Hacking to get the results of non converged runs*/
+-					//eplconverged = true;
++						//eplconverged =true;
+ 						_error_("   maximum number of EPL iterations (" << hydro_maxiter << ") exceeded");
+ 					}
+ 				}
+@@ -219,6 +214,7 @@
+ 
+ 				if(eplconverged){
+ 					eplconverged=false;
++				
+ 					dug=ug_epl_sub_iter->Duplicate();_assert_(dug);
+ 					ug_epl_sub_iter->Copy(dug);
+ 					dug->AYPX(ug_epl,-1.0);
+@@ -228,18 +224,18 @@
+ 					
+ 					if (xIsNan<IssmDouble>(ndu_epl) || xIsNan<IssmDouble>(nu_epl)) _error_("convergence criterion is NaN!");
+ 					if (ndu_epl==0.0 && nu_epl==0.0) nu_epl=1.0e-6; /*Hacking the case where the EPL is used but empty*/
++					if(VerboseConvergence()) _printf0_(setw(50) << left << "   Inner EPL Convergence criterion:" << ndu_epl/nu_epl*100 << " aiming lower than " << eps_hyd*100 << " %\n");
+ 					if((ndu_epl/nu_epl)<eps_hyd)eplconverged=true;
+ 				}
+ 				delete ug_epl_sub_iter;
+ 
+ 				if(eplconverged){
+-
+-					/*Updating Nodal Mask*/
++					/*Updating Elemental Mask*/
+ 					HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
+ 					analysis->ElementizeEplMask(femmodel);
+ 					delete analysis;
+ 					femmodel->HydrologyTransferx();
+-
++					
+ 					InputUpdateFromConstantx(femmodel,eplconverged,ConvergedEnum);
+ 					InputUpdateFromConstantx(femmodel,sediment_kmax,MeltingOffsetEnum);
+ 					InputUpdateFromSolutionx(femmodel,ug_epl);
+@@ -248,7 +244,6 @@
+ 			}
+ 		}
+ 		
+-		
+ 		/*System convergence check*/
+ 		if(!hydroconverged){
+ 			//compute norm(du)/norm(u)
+@@ -302,7 +297,7 @@
+ 		}
+ 		hydrocount++;
+ 		if(hydroconverged)break;
+-	}
++}
+ 	
+ 	InputUpdateFromSolutionx(femmodel,ug_sed);
+ 	if(isefficientlayer)InputUpdateFromSolutionx(femmodel,ug_epl);
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 17005)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 17006)
+@@ -381,14 +381,14 @@
+ /*}}}*/ 
+ /*FUNCTION Matpar::GetSedimentStoring {{{*/
+ IssmDouble Matpar::GetSedimentStoring(){
+-	return this->rho_freshwater* this->g* this->sediment_porosity* this->sediment_thickness*
+-    ( this->water_compressibility+( this->sediment_compressibility/ this->sediment_porosity));		 
++	return this->rho_freshwater * this->g * this->sediment_porosity * this->sediment_thickness *
++    (this->water_compressibility + (this->sediment_compressibility / this->sediment_porosity));		 
+ }		 
+ /*}}}*/ 
+ /*FUNCTION Matpar::GetEplSpecificStoring {{{*/
+ IssmDouble Matpar::GetEplSpecificStoring(){
+-	return this->rho_freshwater* this->g* this->epl_porosity* 
+-    ( this->water_compressibility+( this->epl_compressibility/ this->epl_porosity));		 
++	return this->rho_freshwater * this->g * this->epl_porosity * 
++    (this->water_compressibility + (this->epl_compressibility / this->epl_porosity));		 
+ }		 
+ /*}}}*/ 
+ /*FUNCTION Matpar::GetSedimentTransitivity {{{*/
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17005)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17006)
+@@ -4658,21 +4658,25 @@
+ 	int        *doflist = NULL;
+ 	bool       isefficientlayer;
+ 	bool       active_element;
+-	int        transfermethod;
++	int        transfermethod,step;
+ 	IssmDouble sed_trans,sed_thick;
+ 	IssmDouble leakage,h_max;
+ 	IssmDouble wh_trans;
+ 	IssmDouble activeEpl[numdof],epl_thickness[numdof];
+ 	IssmDouble epl_specificstoring[numdof],sedstoring[numdof];
+ 	IssmDouble epl_head[numdof],sed_head[numdof];
++	IssmDouble old_transfer[numdof];
+ 
+ 	Input* active_element_input=NULL;
+ 
++		
+ 	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+ 
+ 	/*Get the flag to know if the efficient layer is present*/
+ 	this->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);
+ 
++	this->parameters->FindParam(&step,StepEnum);
++
+ 	if(isefficientlayer){
+ 		/*Also get the flag to the transfer method*/
+ 		this->parameters->FindParam(&transfermethod,HydrologydcTransferFlagEnum);
+@@ -4684,6 +4688,7 @@
+ 			break;
+ 		case 1:
+ 
++	
+ 			active_element_input=inputs->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);
+ 			active_element_input->GetInputValue(&active_element);
+ 
+@@ -4697,39 +4702,41 @@
+ 			sed_thick = matpar->GetSedimentThickness();
+ 
+ 			if(!active_element){
+-
+ 				/*No transfer if the EPL is not active*/
+-				for(int i=0;i<numdof;i++){
+-					wh_trans=0.0;
+-					/*Assign output pointer*/
+-					transfer->SetValue(doflist[i],wh_trans,INS_VAL);
+-				}
++				/* for(int i=0;i<numdof;i++){ */
++				/* 	wh_trans=0.0; */
++				/* 	/\*Assign output pointer*\/ */
++				/* 	transfer->SetValue(doflist[i],wh_trans,INS_VAL); */
++				/* } */
+ 			}
+ 			else{
+-
++			
++				//GetInputListOnVertices(&old_transfer[0],WaterTransferEnum);
++			
+ 				for(int i=0;i<numdof;i++){
+ 					epl_specificstoring[i]=matpar->GetEplSpecificStoring();		
+ 					sedstoring[i]=matpar->GetSedimentStoring();
+-					
++					this->GetHydrologyDCInefficientHmax(&h_max,i);
++						
+ 					/*EPL head higher than sediment head, transfer from the epl to the sediment*/
+ 					if(epl_head[i]>sed_head[i]){
+ 						wh_trans=epl_specificstoring[i]*epl_thickness[i]*sed_trans*(epl_head[i]-sed_head[i])/(leakage*sed_thick);				
+-						
++
+ 						/*No transfer if the sediment head is allready at the maximum*/
+-						this->GetHydrologyDCInefficientHmax(&h_max,i);
+-						if(sed_head[i]>=h_max)wh_trans=0.0;
++						if(sed_head[i]>=h_max){
++							wh_trans=0.0;
++						}
+ 					}
+ 					/*EPL head lower than sediment head, transfer from the sediment to the epl*/
+ 					else if(epl_head[i]<=sed_head[i]){
+-						wh_trans=sedstoring[i]*sed_trans*(epl_head[i]-sed_head[i])/(leakage*sed_thick);				
++						wh_trans=sedstoring[i]*sed_trans*(epl_head[i]-sed_head[i])/(leakage*sed_thick);
+ 					}
++
++					/*Introduce relaxation*/
++					//wh_trans=old_transfer[i]+0.9*(wh_trans-old_transfer[i]);
++				
+ 					/*Assign output pointer*/
+ 					transfer->SetValue(doflist[i],wh_trans,INS_VAL);
+-					/* if(nodes[i]->id>=54){ */
+-					/* 	printf("%i %e %e %e \n",nodes[i]->id-54,wh_trans,sed_head[i],epl_head[i]); */
+-					/* } */
+-					/* else{*/
+-					/* 	printf("%i %e %e %e \n",nodes[i]->id,wh_trans,sed_head[i],epl_head[i]); */
+ 				}
+ 			}
+ 			break;
+@@ -4798,9 +4805,9 @@
+ 			vec_mask->SetValue(nodes[i]->Sid(),1.,INS_VAL);
+ 		}
+ 		/*If epl thickness gets under 0, close the layer*/
+-		/* else if(epl_thickness[i]<0.0){ */
+-		/* 	vec_mask->SetValue(nodes[i]->Sid(),0.,INS_VAL); */
+-		/* } */
++		else if(epl_thickness[i]<0.0){
++			vec_mask->SetValue(nodes[i]->Sid(),0.,INS_VAL);
++		}
+ 		/*Increase of the efficient system is needed if the epl head reach the maximum value (sediment max value for now)*/
+ 		this->GetHydrologyDCInefficientHmax(&h_max,i);
+ 		if(eplhead[i]>=h_max && this->AnyActive()){
Index: issm/oecreview/Archive/16554-17801/ISSM-17006-17007.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17006-17007.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17006-17007.diff	(revision 17802)
@@ -0,0 +1,45 @@
+Index: ../trunk-jpl/src/c/classes/Vertex.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Vertex.cpp	(revision 17006)
++++ ../trunk-jpl/src/c/classes/Vertex.cpp	(revision 17007)
+@@ -131,20 +131,27 @@
+ 	parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+ 
+ 	/*sigma remains constant. z=bed+sigma*thickness*/
+-	if(this->meshtype==Mesh2DverticalEnum){
+-		oldy = this->y;
+-		newy = bed[this->pid]+sigma*(surface[this->pid] - bed[this->pid]);
+-		vely = (newy-oldy)/dt;
+-		this->y = newy;
+-		vy->SetValue(this->pid,vely,INS_VAL);
++	switch(this->meshtype){
++		case Mesh2DhorizontalEnum:
++			/*Nothing*/
++			return;
++		case Mesh2DverticalEnum:
++			oldy = this->y;
++			newy = bed[this->pid]+sigma*(surface[this->pid] - bed[this->pid]);
++			vely = (newy-oldy)/dt;
++			this->y = newy;
++			vy->SetValue(this->pid,vely,INS_VAL);
++			return;
++		case Mesh3DEnum:
++			oldz = this->z;
++			newz = bed[this->pid]+sigma*(surface[this->pid] - bed[this->pid]);
++			velz = (newz-oldz)/dt;
++			this->z = newz;
++			vz->SetValue(this->pid,velz,INS_VAL);
++			return;
++		default:
++			_error_("not implemented");
+ 	}
+-	else{
+-		oldz = this->z;
+-		newz = bed[this->pid]+sigma*(surface[this->pid] - bed[this->pid]);
+-		velz = (newz-oldz)/dt;
+-		this->z = newz;
+-		vz->SetValue(this->pid,velz,INS_VAL);
+-	}
+ }
+ /*}}}*/
+ /*FUNCTION Vertex::DistributePids{{{*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17007-17008.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17007-17008.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17007-17008.diff	(revision 17802)
@@ -0,0 +1,28 @@
+Index: ../trunk-jpl/test/NightlyRun/test209.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test209.py	(revision 17007)
++++ ../trunk-jpl/test/NightlyRun/test209.py	(revision 17008)
+@@ -24,8 +24,8 @@
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3']
+ field_tolerances=[\
+ 	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-8,\
+-	1e-13,1e-13,2e-9,1e-13,3.8e-11,3.85e-11,3.85e-11,3.85e-11,1e-13,1.55e-8,\
+-	2.65e-11,2.55e-12,1e-08,2.4e-12,3.9e-11,1e-10,1e-10,1e-10,7.4e-12,1.85e-8]
++	1e-13,1e-13,3e-9,1e-13,3.8e-11,3.85e-11,3.85e-11,3.85e-11,1e-13,1.9e-8,\
++	5e-11,6e-12,1e-08,6e-12,3.9e-11,1e-10,1e-10,1e-10,9e-12,1.85e-8]
+ 
+ field_values=[\
+ 	md.results.TransientSolution[0].Vx,\
+Index: ../trunk-jpl/test/NightlyRun/test290.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test290.py	(revision 17007)
++++ ../trunk-jpl/test/NightlyRun/test290.py	(revision 17008)
+@@ -19,7 +19,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Vx', 'Vy', 'Vz', 'Vel','Pressure'];
+-field_tolerances=[1e-7,1e-7,2.5e-7,1e-7,1e-7];
++field_tolerances=[1e-7,1e-7,1e-6,1e-7,1e-7];
+ field_values=[\
+ 	md.results.StressbalanceSolution.Vx,\
+ 	md.results.StressbalanceSolution.Vy,\
Index: issm/oecreview/Archive/16554-17801/ISSM-17008-17009.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17008-17009.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17008-17009.diff	(revision 17802)
@@ -0,0 +1,197 @@
+Index: ../trunk-jpl/src/c/analyses/Analysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/Analysis.h	(revision 17008)
++++ ../trunk-jpl/src/c/analyses/Analysis.h	(revision 17009)
+@@ -32,6 +32,7 @@
+ 		virtual void CreateLoads(Loads* loads, IoModel* iomodel)=0;
+ 
+ 		/*Finite element Analysis*/
++		virtual void           Core(FemModel* femmodel)=0;
+ 		virtual ElementVector* CreateDVector(Element* element)=0;
+ 		virtual ElementMatrix* CreateJacobianMatrix(Element* element)=0;
+ 		virtual ElementMatrix* CreateKMatrix(Element* element)=0;
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 17008)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 17009)
+@@ -3,6 +3,7 @@
+ #include "../classes/classes.h"
+ #include "../shared/shared.h"
+ #include "../modules/modules.h"
++#include "../solutionsequences/solutionsequences.h"
+ 
+ /*Model processing*/
+ int  StressbalanceSIAAnalysis::DofsPerNode(int** doflist,int meshtype,int approximation){/*{{{*/
+@@ -135,7 +136,10 @@
+ 
+ /*Finite Element Analysis*/
+ void           StressbalanceSIAAnalysis::Core(FemModel* femmodel){/*{{{*/
+-	_error_("not implemented");
++
++		if(VerboseSolution()) _printf0_("   computing SIA velocities\n");
++		femmodel->SetCurrentConfiguration(StressbalanceSIAAnalysisEnum);
++		solutionsequence_linear(femmodel);
+ }/*}}}*/
+ ElementVector* StressbalanceSIAAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17008)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17009)
+@@ -3,6 +3,7 @@
+ #include "../classes/classes.h"
+ #include "../shared/shared.h"
+ #include "../modules/modules.h"
++#include "../solutionsequences/solutionsequences.h"
+ 
+ /*Model processing*/
+ int  StressbalanceAnalysis::DofsPerNode(int** pdoftype,int meshtype,int approximation){/*{{{*/
+@@ -812,7 +813,42 @@
+ 
+ /*Finite Element Analysis*/
+ void           StressbalanceAnalysis::Core(FemModel* femmodel){/*{{{*/
+-	_error_("not implemented");
++
++	/*Intermediaries*/
++	bool isSIA,isSSA,isL1L2,isHO,isFS;
++	bool conserve_loads = true;
++	int  meshtype,newton;
++
++	/* recover parameters:*/
++	femmodel->parameters->FindParam(&isSIA,FlowequationIsSIAEnum);
++	femmodel->parameters->FindParam(&isSSA,FlowequationIsSSAEnum);
++	femmodel->parameters->FindParam(&isL1L2,FlowequationIsL1L2Enum);
++	femmodel->parameters->FindParam(&isHO,FlowequationIsHOEnum);
++	femmodel->parameters->FindParam(&isFS,FlowequationIsFSEnum);
++	femmodel->parameters->FindParam(&newton,StressbalanceIsnewtonEnum);
++	femmodel->parameters->FindParam(&meshtype,MeshTypeEnum);
++
++	if((isSSA || isHO || isL1L2) ^ isFS){ // ^ = xor
++		if(VerboseSolution()) _printf0_("   computing velocities\n");
++
++		femmodel->SetCurrentConfiguration(StressbalanceAnalysisEnum);
++		if(newton>0)
++		 solutionsequence_newton(femmodel);
++		else
++		 solutionsequence_nonlinear(femmodel,conserve_loads); 
++	}
++
++	if ((isSSA || isL1L2 || isHO) && isFS){
++		if(VerboseSolution()) _printf0_("   computing coupling between lower order models and FS\n");
++		solutionsequence_FScoupling_nonlinear(femmodel,conserve_loads);
++	}
++
++	if (meshtype==Mesh3DEnum && (isSIA || isSSA || isL1L2 || isHO)){
++		if(VerboseSolution()) _printf0_("   computing vertical velocities\n");
++		femmodel->SetCurrentConfiguration(StressbalanceVerticalAnalysisEnum);
++		solutionsequence_linear(femmodel);
++	}
++
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreateDVector(Element* element){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/cores/stressbalance_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/stressbalance_core.cpp	(revision 17008)
++++ ../trunk-jpl/src/c/cores/stressbalance_core.cpp	(revision 17009)
+@@ -5,6 +5,7 @@
+ #include "./cores.h"
+ #include "../toolkits/toolkits.h"
+ #include "../classes/classes.h"
++#include "../analyses/analyses.h"
+ #include "../shared/shared.h"
+ #include "../modules/modules.h"
+ #include "../solutionsequences/solutionsequences.h"
+@@ -12,18 +13,15 @@
+ void stressbalance_core(FemModel* femmodel){
+ 
+ 	/*parameters: */
+-	bool  dakota_analysis;
+-	int   meshtype;
+-	bool  isSIA,isSSA,isL1L2,isHO,isFS;
+-	bool  conserve_loads    = true;
+-	bool  save_results;
+-	int   newton;
+-	int   solution_type;
+-	int   numoutputs        = 0;
+-	char** requested_outputs = NULL;
+-	int    i;
++	bool       dakota_analysis;
++	int        meshtype;
++	bool       isSIA,isSSA,isL1L2,isHO,isFS;
++	bool       save_results;
++	int        solution_type;
++	int        numoutputs        = 0;
++	char     **requested_outputs = NULL;
++	Analysis  *analysis          = NULL;
+ 
+-
+ 	/* recover parameters:*/
+ 	femmodel->parameters->FindParam(&meshtype,MeshTypeEnum);
+ 	femmodel->parameters->FindParam(&isSIA,FlowequationIsSIAEnum);
+@@ -31,7 +29,6 @@
+ 	femmodel->parameters->FindParam(&isL1L2,FlowequationIsL1L2Enum);
+ 	femmodel->parameters->FindParam(&isHO,FlowequationIsHOEnum);
+ 	femmodel->parameters->FindParam(&isFS,FlowequationIsFSEnum);
+-	femmodel->parameters->FindParam(&newton,StressbalanceIsnewtonEnum);
+ 	femmodel->parameters->FindParam(&dakota_analysis,QmuIsdakotaEnum);
+ 	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
+ 	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
+@@ -46,7 +43,7 @@
+ 		if(isFS) InputDuplicatex(femmodel,QmuPressureEnum,PressureEnum);
+ 	}
+ 
+-	/*Compute slopes: */
++	/*Compute slopes if necessary */
+ 	if(isSIA || (isFS && meshtype==Mesh2DverticalEnum)) surfaceslope_core(femmodel);
+ 	if(isFS){
+ 		bedslope_core(femmodel);
+@@ -54,37 +51,27 @@
+ 		ResetCoordinateSystemx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
+ 	}
+ 
++	/*Compute SIA velocities*/
+ 	if(isSIA){
+-		if(VerboseSolution()) _printf0_("   computing SIA velocities\n");
+ 
+ 		/*Take the last velocity into account so that the velocity on the SSA domain is not zero*/
+ 		if(isSSA || isL1L2 || isHO ) ResetBoundaryConditions(femmodel,StressbalanceSIAAnalysisEnum);
+-		femmodel->SetCurrentConfiguration(StressbalanceSIAAnalysisEnum);
+-		solutionsequence_linear(femmodel);
+-		if(isSSA || isL1L2 || isHO) ResetBoundaryConditions(femmodel,StressbalanceAnalysisEnum);
+-	}
+ 
+-	if ((isSSA || isHO || isL1L2) ^ isFS){ // ^ = xor
+-		if(VerboseSolution()) _printf0_("   computing velocities\n");
++		analysis = new StressbalanceSIAAnalysis();
++		analysis->Core(femmodel);
++		delete analysis;
+ 
+-		femmodel->SetCurrentConfiguration(StressbalanceAnalysisEnum);
+-		if(newton>0)
+-		 solutionsequence_newton(femmodel);
+-		else
+-		 solutionsequence_nonlinear(femmodel,conserve_loads); 
++		/*Reset velocities for other ice flow models*/
++		if(isSSA || isL1L2 || isHO) ResetBoundaryConditions(femmodel,StressbalanceAnalysisEnum);
+ 	}
+ 
+-	if ((isSSA || isL1L2 || isHO) && isFS){
+-		if(VerboseSolution()) _printf0_("   computing coupling betweem lower order models and full-FS\n");
+-		solutionsequence_FScoupling_nonlinear(femmodel,conserve_loads);
++	/*Compute stressbalance for SSA L1L2 HO and FS*/
++	if(isSSA || isL1L2 || isHO || isFS){
++		analysis = new StressbalanceAnalysis();
++		analysis->Core(femmodel);
++		delete analysis;
+ 	}
+ 
+-	if (meshtype==Mesh3DEnum && (isSIA || isSSA || isL1L2 || isHO)){
+-		if(VerboseSolution()) _printf0_("   computing vertical velocities\n");
+-		femmodel->SetCurrentConfiguration(StressbalanceVerticalAnalysisEnum);
+-		solutionsequence_linear(femmodel);
+-	}
+-
+ 	if(save_results){
+ 		if(VerboseSolution()) _printf0_("   saving results\n");
+ 		femmodel->RequestedOutputsx(&femmodel->results,requested_outputs,numoutputs);
Index: issm/oecreview/Archive/16554-17801/ISSM-17009-17010.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17009-17010.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17009-17010.diff	(revision 17802)
@@ -0,0 +1,81 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 17009)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 17010)
+@@ -3,6 +3,7 @@
+ #include "../classes/classes.h"
+ #include "../shared/shared.h"
+ #include "../modules/modules.h"
++#include "../solutionsequences/solutionsequences.h"
+ 
+ /*Model processing*/
+ int  StressbalanceVerticalAnalysis::DofsPerNode(int** doflist,int meshtype,int approximation){/*{{{*/
+@@ -96,7 +97,10 @@
+ 
+ /*Finite Element Analysis*/
+ void           StressbalanceVerticalAnalysis::Core(FemModel* femmodel){/*{{{*/
+-	_error_("not implemented");
++
++		if(VerboseSolution()) _printf0_("   computing vertical velocities\n");
++		femmodel->SetCurrentConfiguration(StressbalanceVerticalAnalysisEnum);
++		solutionsequence_linear(femmodel);
+ }/*}}}*/
+ ElementVector* StressbalanceVerticalAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17009)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17010)
+@@ -815,18 +815,16 @@
+ void           StressbalanceAnalysis::Core(FemModel* femmodel){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	bool isSIA,isSSA,isL1L2,isHO,isFS;
++	bool isSSA,isL1L2,isHO,isFS;
+ 	bool conserve_loads = true;
+-	int  meshtype,newton;
++	int  newton;
+ 
+ 	/* recover parameters:*/
+-	femmodel->parameters->FindParam(&isSIA,FlowequationIsSIAEnum);
+ 	femmodel->parameters->FindParam(&isSSA,FlowequationIsSSAEnum);
+ 	femmodel->parameters->FindParam(&isL1L2,FlowequationIsL1L2Enum);
+ 	femmodel->parameters->FindParam(&isHO,FlowequationIsHOEnum);
+ 	femmodel->parameters->FindParam(&isFS,FlowequationIsFSEnum);
+ 	femmodel->parameters->FindParam(&newton,StressbalanceIsnewtonEnum);
+-	femmodel->parameters->FindParam(&meshtype,MeshTypeEnum);
+ 
+ 	if((isSSA || isHO || isL1L2) ^ isFS){ // ^ = xor
+ 		if(VerboseSolution()) _printf0_("   computing velocities\n");
+@@ -843,12 +841,6 @@
+ 		solutionsequence_FScoupling_nonlinear(femmodel,conserve_loads);
+ 	}
+ 
+-	if (meshtype==Mesh3DEnum && (isSIA || isSSA || isL1L2 || isHO)){
+-		if(VerboseSolution()) _printf0_("   computing vertical velocities\n");
+-		femmodel->SetCurrentConfiguration(StressbalanceVerticalAnalysisEnum);
+-		solutionsequence_linear(femmodel);
+-	}
+-
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreateDVector(Element* element){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/cores/stressbalance_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/stressbalance_core.cpp	(revision 17009)
++++ ../trunk-jpl/src/c/cores/stressbalance_core.cpp	(revision 17010)
+@@ -72,6 +72,14 @@
+ 		delete analysis;
+ 	}
+ 
++	/*Compute vertical velocities*/
++	if (meshtype==Mesh3DEnum && (isSIA || isSSA || isL1L2 || isHO)){
++		analysis = new StressbalanceVerticalAnalysis();
++		analysis->Core(femmodel);
++		delete analysis;
++	}
++
++
+ 	if(save_results){
+ 		if(VerboseSolution()) _printf0_("   saving results\n");
+ 		femmodel->RequestedOutputsx(&femmodel->results,requested_outputs,numoutputs);
Index: issm/oecreview/Archive/16554-17801/ISSM-17010-17011.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17010-17011.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17010-17011.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/test/NightlyRun/test119.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test119.py	(revision 17010)
++++ ../trunk-jpl/test/NightlyRun/test119.py	(revision 17011)
+@@ -22,7 +22,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['x1','y1','x2','y2','nbelements','elapsed time']
+-field_tolerances=[2e-9,2e-9,1e-13,1e-13,1e-13,1.5]
++field_tolerances=[2e-9,2e-9,1e-13,1e-13,1e-13,4.0]
+ field_values=[\
+ 	x1, y1,\
+ 	x2, y2,\
+Index: ../trunk-jpl/test/NightlyRun/test119.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test119.m	(revision 17010)
++++ ../trunk-jpl/test/NightlyRun/test119.m	(revision 17011)
+@@ -17,7 +17,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'x1','y1','x2','y2','nbelements','elapsed time'};
+-field_tolerances={2e-9,2e-9,1e-13,1e-13,1e-13,1.5};
++field_tolerances={2e-9,2e-9,1e-13,1e-13,1e-13,4.};
+ field_values={...
+ 	x1, y1,...
+ 	x2, y2,...
Index: issm/oecreview/Archive/16554-17801/ISSM-17011-17012.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17011-17012.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17011-17012.diff	(revision 17802)
@@ -0,0 +1,68 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17011)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17012)
+@@ -58,6 +58,8 @@
+ 	iomodel->FetchDataToInput(elements,EplHeadEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcEplInitialThicknessEnum);
+ 	
++	elements->InputDuplicate(HydrologydcEplInitialThicknessEnum,HydrologydcEplThicknessEnum);
++
+ }/*}}}*/
+ void HydrologyDCEfficientAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17011)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17012)
+@@ -177,6 +177,7 @@
+ 				femmodel->parameters->SetParam(EplHeadSlopeYEnum,InputToL2ProjectEnum);
+ 				solutionsequence_linear(femmodel);
+ 
++				
+ 				femmodel->HydrologyEPLThicknessx();
+ 
+ 				femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
+Index: ../trunk-jpl/src/c/cores/hydrology_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/hydrology_core.cpp	(revision 17011)
++++ ../trunk-jpl/src/c/cores/hydrology_core.cpp	(revision 17012)
+@@ -83,8 +83,7 @@
+ 			femmodel->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);
+ 			if (isefficientlayer){
+ 				InputDuplicatex(femmodel,EplHeadEnum,EplHeadOldEnum);
+-				InputDuplicatex(femmodel,HydrologydcEplInitialThicknessEnum,HydrologydcEplThicknessEnum);
+-				InputDuplicatex(femmodel,HydrologydcEplInitialThicknessEnum,HydrologydcEplThicknessOldEnum);
++				InputDuplicatex(femmodel,HydrologydcEplThicknessEnum,HydrologydcEplThicknessOldEnum);
+ 			}
+ 			
+ 			/*Proceed now to heads computations*/
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17011)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17012)
+@@ -4833,7 +4833,7 @@
+ 	bool        isefficientlayer;
+ 	IssmDouble  n,A,dt,init_thick;
+ 	IssmDouble  rho_water,rho_ice;
+-	IssmDouble  gravity,latentheat,EPLgrad;
++	IssmDouble  gravity,latentheat,EPLgrad2;
+ 	IssmDouble  EPL_N,epl_conductivity;
+ 	IssmDouble  activeEpl[numdof],thickness[numdof];
+ 	IssmDouble  eplhead[numdof], old_thickness[numdof];
+@@ -4875,11 +4875,12 @@
+ 					/*Compute first the effective pressure in the EPL*/
+ 					EPL_N=gravity*((rho_ice*ice_thickness[i])-(rho_water*(eplhead[i]-bed[i])));
+ 					if(EPL_N<0.0)EPL_N=0.0;
+-					/*Get then the square of th gradient of EPL heads*/
+-					EPLgrad = (epl_slopeX[i]*epl_slopeX[i]+epl_slopeY[i]*epl_slopeY[i]);
++					/*Get then the square of the gradient of EPL heads*/
++					EPLgrad2 = (epl_slopeX[i]*epl_slopeX[i]+epl_slopeY[i]*epl_slopeY[i]);
+ 					
+ 					/*And proceed to the real thing*/
+-					thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*EPLgrad-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
++					thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*EPLgrad2-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
++
+ 			}
+ 		}
+ 		this->inputs->AddInput(new TriaInput(HydrologydcEplThicknessEnum,thickness,P1Enum));
Index: issm/oecreview/Archive/16554-17801/ISSM-17012-17013.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17012-17013.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17012-17013.diff	(revision 17802)
@@ -0,0 +1,8 @@
+Index: ../trunk-jpl/test/Archives/Archive333.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive335.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17013-17014.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17013-17014.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17013-17014.diff	(revision 17802)
@@ -0,0 +1,797 @@
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h	(revision 17013)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h	(revision 17014)
+@@ -39,13 +39,13 @@
+ 		/*Modules*/
+ 		static void PostProcessing(FemModel* femmodel);
+ 		static void ComputeBasalMeltingrate(Element* element);
+-		static void DrainWaterfraction(Element* element);
++		static void DrainWaterfraction(Element* element, IssmDouble* pdrainrate_element);
+ 		static void UpdateBasalConstraints(Element* element);
+ 
+ 		/*Intermediaries*/
+-		IssmDouble EnthalpyDiffusionParameter(Element* element,IssmDouble enthalpy,IssmDouble pressure);
+-		IssmDouble EnthalpyDiffusionParameterVolume(Element* element,int enthalpy_enum);
+-		IssmDouble PureIceEnthalpy(Element* element,IssmDouble pressure);
+-		IssmDouble TMeltingPoint(Element* element,IssmDouble pressure);
++		static IssmDouble EnthalpyDiffusionParameter(Element* element,IssmDouble enthalpy,IssmDouble pressure);
++		static IssmDouble EnthalpyDiffusionParameterVolume(Element* element,int enthalpy_enum);
++		static IssmDouble PureIceEnthalpy(Element* element,IssmDouble pressure);
++		static IssmDouble TMeltingPoint(Element* element,IssmDouble pressure);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17013)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17014)
+@@ -402,13 +402,17 @@
+ ElementVector* EnthalpyAnalysis::CreatePVectorVolume(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int         stabilization;
++	int         i, stabilization;
+ 	IssmDouble  Jdet,phi,dt;
+-	IssmDouble  enthalpy;
+-	IssmDouble  kappa,tau_parameter,diameter;
++	IssmDouble  enthalpy, Hpmp;
++	IssmDouble  enthalpypicard, d1enthalpypicard[3];
++	IssmDouble  pressure, d1pressure[3], d2pressure;
++	IssmDouble  waterfractionpicard;
++	IssmDouble  kappa,tau_parameter,diameter,kappa_w;
+ 	IssmDouble  u,v,w;
+-	IssmDouble  scalar_def,scalar_transient;
++	IssmDouble  scalar_def, scalar_sens ,scalar_transient;
+ 	IssmDouble* xyz_list = NULL;
++	IssmDouble  d1H_d1P, d1P2;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes    = element->GetNumberOfNodes();
+@@ -422,13 +426,19 @@
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+ 	IssmDouble  rho_ice             = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	IssmDouble  heatcapacity        = element->GetMaterialParameter(MaterialsHeatcapacityEnum);
+ 	IssmDouble  thermalconductivity = element->GetMaterialParameter(MaterialsThermalconductivityEnum);
++	IssmDouble  temperateiceconductivity = element->GetMaterialParameter(MaterialsTemperateiceconductivityEnum);
++	IssmDouble  beta                = element->GetMaterialParameter(MaterialsBetaEnum);
++	IssmDouble  latentheat          = element->GetMaterialParameter(MaterialsLatentheatEnum);
+ 	element->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	element->FindParam(&stabilization,ThermalStabilizationEnum);
+ 	Input* vx_input=element->GetInput(VxEnum); _assert_(vx_input);
+ 	Input* vy_input=element->GetInput(VyEnum); _assert_(vy_input);
+ 	Input* vz_input=element->GetInput(VzEnum); _assert_(vz_input);
+-	Input* enthalpy_input = NULL;
++	Input* enthalpypicard_input=element->GetInput(EnthalpyPicardEnum); _assert_(enthalpypicard_input);
++	Input* pressure_input=element->GetInput(PressureEnum); _assert_(pressure_input);
++	Input* enthalpy_input=NULL;
+ 	if(reCast<bool,IssmDouble>(dt)){enthalpy_input = element->GetInput(EnthalpyEnum); _assert_(enthalpy_input);}
+ 	if(stabilization==2){
+ 		diameter=element->MinEdgeLength(xyz_list);
+@@ -442,19 +452,40 @@
+ 
+ 		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+ 		element->NodalFunctions(basis,gauss);
++		
++		/*viscous dissipation*/
+ 		element->ViscousHeating(&phi,xyz_list,gauss,vx_input,vy_input,vz_input);
+ 
+ 		scalar_def=phi/rho_ice*Jdet*gauss->weight;
+ 		if(dt!=0.) scalar_def=scalar_def*dt;
+ 
+-		/*TODO: add -beta*laplace T_m(p)*/
+-		for(int i=0;i<numnodes;i++) pe->values[i]+=scalar_def*basis[i];
++		for(i=0;i<numnodes;i++) pe->values[i]+=scalar_def*basis[i];
+ 
++		/*sensible heat flux in temperate ice*/
++		enthalpypicard_input->GetInputValue(&enthalpypicard,gauss);
++		pressure_input->GetInputValue(&pressure,gauss);
++		Hpmp=this->PureIceEnthalpy(element, pressure);
++
++		if(enthalpypicard>=Hpmp){
++			enthalpypicard_input->GetInputDerivativeValue(&d1enthalpypicard[0],xyz_list,gauss);
++			pressure_input->GetInputDerivativeValue(&d1pressure[0],xyz_list,gauss);
++			d2pressure=0.; // for linear elements, 2nd derivative is zero
++			
++			d1H_d1P=0.;
++			for(i=0;i<3;i++) d1H_d1P+=d1enthalpypicard[i]*d1pressure[i];
++			d1P2=0.;
++			for(i=0;i<3;i++) d1P2+=pow(d1pressure[i],2.);
++
++			scalar_sens=-beta*((temperateiceconductivity - thermalconductivity)/latentheat*(d1H_d1P + beta*heatcapacity*d1P2))/rho_ice;
++			if(dt!=0.) scalar_sens=scalar_sens*dt;
++			for(i=0;i<numnodes;i++) pe->values[i]+=scalar_sens*basis[i];
++		}		
++
+ 		/* Build transient now */
+ 		if(reCast<bool,IssmDouble>(dt)){
+ 			enthalpy_input->GetInputValue(&enthalpy, gauss);
+ 			scalar_transient=enthalpy*Jdet*gauss->weight;
+-			for(int i=0;i<numnodes;i++) pe->values[i]+=scalar_transient*basis[i];
++			for(i=0;i<numnodes;i++) pe->values[i]+=scalar_transient*basis[i];
+ 		}
+ 
+ 		if(stabilization==2){
+@@ -465,10 +496,10 @@
+ 			vz_input->GetInputValue(&w,gauss);
+ 			tau_parameter=element->StabilizationParameter(u,v,w,diameter,kappa/rho_ice);
+ 
+-			for(int i=0;i<numnodes;i++) pe->values[i]+=tau_parameter*scalar_def*(u*dbasis[0*numnodes+i]+v*dbasis[1*numnodes+i]+w*dbasis[2*numnodes+i]);
++			for(i=0;i<numnodes;i++) pe->values[i]+=tau_parameter*scalar_def*(u*dbasis[0*numnodes+i]+v*dbasis[1*numnodes+i]+w*dbasis[2*numnodes+i]);
+ 
+ 			if(dt!=0.){
+-				for(int i=0;i<numnodes;i++) pe->values[i]+=tau_parameter*scalar_transient*(u*dbasis[0*numnodes+i]+v*dbasis[1*numnodes+i]+w*dbasis[2*numnodes+i]);
++				for(i=0;i<numnodes;i++) pe->values[i]+=tau_parameter*scalar_transient*(u*dbasis[0*numnodes+i]+v*dbasis[1*numnodes+i]+w*dbasis[2*numnodes+i]);
+ 			}
+ 		}
+ 	}
+@@ -483,7 +514,7 @@
+ }/*}}}*/
+ ElementVector* EnthalpyAnalysis::CreatePVectorSheet(Element* element){/*{{{*/
+ 
+-	/* Geothermal flux on ice sheet base and basal friction */
++	/* implementation of the basal condition decision chart of Aschwanden 2012, Fig.5 */
+ 	if(!element->IsOnBed() || element->IsFloating()) return NULL;
+ 
+ 	IssmDouble  dt,Jdet,enthalpy,pressure,watercolumn,geothermalflux,vx,vy,vz;
+@@ -526,9 +557,9 @@
+ 		pressure_input->GetInputValue(&pressure,gauss);
+ 		watercolumn_input->GetInputValue(&watercolumn,gauss);
+ 
+-		if((watercolumn<=0.) && (enthalpy < PureIceEnthalpy(element,pressure))){
++		if((watercolumn<=0.) && (enthalpy<PureIceEnthalpy(element,pressure))){
+ 			/* the above check is equivalent to 
+-			 NOT ((watercolumn>0.) AND (enthalpy<PIE)) AND (enthalpy<PIE)*/
++			 NOT [(watercolumn>0.) AND (enthalpy<PIE)] AND (enthalpy<PIE)*/
+ 			geothermalflux_input->GetInputValue(&geothermalflux,gauss);
+ 
+ 			friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input);
+@@ -548,14 +579,14 @@
+ 			enthalpy_input->GetInputValue(&enthalpyup,gaussup);
+ 			pressure_input->GetInputValue(&pressureup,gaussup);
+ 			if(enthalpyup >= PureIceEnthalpy(element,pressureup)){
+-				// TODO: temperate ice has positive thickness: grad enthalpy*n=0.
++				// do nothing, set grad enthalpy*n=0.
+ 			}
+ 			else{
+ 				// only base temperate, set Dirichlet BCs in Penta::UpdateBasalConstraintsEnthalpy()
+ 			}
+ 		}
+ 		else{
+-			// base cold, but watercolumn positive. Set base to h_pmp.
++			// base cold, but watercolumn positive. Set base to pressure melting point enthalpy
+ 		}
+ 	}
+ 
+@@ -809,16 +840,317 @@
+ 		UpdateBasalConstraints(element);
+ 	}
+ }/*}}}*/
++
++
++
++
++
++
+ void EnthalpyAnalysis::ComputeBasalMeltingrate(Element* element){/*{{{*/
++	/*Calculate the basal melt rates of the enthalpy model after Aschwanden 2012*/
++	/* melting rate is positive when melting, negative when refreezing*/
+ 
++	/* Intermediaries */
++	int         i,is,vertexdown,vertexup,dim=3,numvertices,numsegments;
++	IssmDouble  heatflux;
++	IssmDouble  vec_heatflux[dim],normal_base[dim],d1enthalpy[dim];
++	IssmDouble  temperature, waterfraction;
++	IssmDouble  basalfriction,alpha2;
++	IssmDouble  dt,yts;
++	IssmDouble  melting_overshoot,lambda;
++	IssmDouble  geothermalflux;
++	IssmDouble  vx,vy,vz;
++	IssmDouble *xyz_list      = NULL;
++	IssmDouble *xyz_list_base = NULL;
++	int        *pairindices   = NULL;
++
++	/* Only compute melt rates at the base of grounded ice*/
++	if(!element->IsOnBed() || element->IsFloating()) return;
++
++	/*Fetch parameters and inputs */
++	element->GetVerticesCoordinates(&xyz_list);
++	element->GetVerticesCoordinatesBase(&xyz_list_base);
++	IssmDouble latentheat = element->GetMaterialParameter(MaterialsLatentheatEnum);
++	IssmDouble rho_ice    = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	//Input* watercolumn_input      = inputs->GetInput(WatercolumnEnum);                 _assert_(watercolumn_input);
++	Input* enthalpy_input         = element->GetInput(EnthalpyEnum);                    _assert_(enthalpy_input);
++	//  Input* pressure_input         = inputs->GetInput(PressureEnum);                    _assert_(pressure_input);
++	//	Input* basalmeltingrate_input = inputs->GetInput(BasalforcingsMeltingRateEnum);    _assert_(basalmeltingrate_input);
++	Input* geothermalflux_input   = element->GetInput(BasalforcingsGeothermalfluxEnum); _assert_(geothermalflux_input);
++	Input* vx_input               = element->GetInput(VxEnum);                          _assert_(vx_input);
++	Input* vy_input               = element->GetInput(VyEnum);                          _assert_(vy_input);
++	Input* vz_input               = element->GetInput(VzEnum);                          _assert_(vz_input);
++	IssmDouble kappa=EnthalpyDiffusionParameterVolume(element,EnthalpyEnum);     _assert_(kappa>0.);
++	element->NormalBase(&normal_base[0],xyz_list_base);
++	element->VerticalSegmentIndices(&pairindices,&numsegments);
++	IssmDouble* meltingrate_enthalpy = xNew<IssmDouble>(numsegments);
++	IssmDouble* heating = xNew<IssmDouble>(numsegments);	
++
++	/*Build friction element, needed later: */
++	Friction* friction=new Friction(element,dim);
++
++	/******** MELTING RATES  ************************************/
++	numvertices=element->GetNumberOfVertices();
++	IssmDouble* enthalpy = xNew<IssmDouble>(numvertices);
++	IssmDouble* pressure = xNew<IssmDouble>(numvertices);
++	IssmDouble* watercolumn = xNew<IssmDouble>(numvertices);
++	IssmDouble* basalmeltingrate = xNew<IssmDouble>(numvertices);
++	element->GetInputListOnVertices(enthalpy,EnthalpyEnum);
++	element->GetInputListOnVertices(pressure,PressureEnum);
++	element->GetInputListOnVertices(watercolumn,WatercolumnEnum);
++	element->GetInputListOnVertices(basalmeltingrate,BasalforcingsMeltingRateEnum);
++
++	Gauss* gauss=element->NewGauss();
++	
++	for(int is=0;is<numsegments;is++){
++		vertexdown = pairindices[is*2+0];
++		vertexup   = pairindices[is*2+1];
++		gauss->GaussVertex(vertexdown);
++		
++		bool checkpositivethickness=true;
++		_assert_(watercolumn>=0.);
++
++		/*Calculate basal meltingrate after Fig.5 of A.Aschwanden 2012*/
++		meltingrate_enthalpy[is]=0.;
++		heating[is]=0.;
++		if((watercolumn[vertexdown]>0.) && (enthalpy[vertexdown]<PureIceEnthalpy(element,pressure[vertexdown]))){
++			/*ensure that no ice is at T<Tm(p), if water layer present*/
++			enthalpy[vertexdown]=element->PureIceEnthalpy(pressure[vertexdown]); 
++		}
++		else if(enthalpy[vertexdown]<element->PureIceEnthalpy(pressure[vertexdown])){
++			/*cold base: set q*n=q_geo*n+frictionheating as Neumann BC in Penta::CreatePVectorEnthalpySheet*/
++			checkpositivethickness=false; // cold base, skip next test
++		}
++		else{/*we have a temperate base, go to next test*/}
++
++		if(checkpositivethickness){
++			/*From here on all basal ice is temperate. Check for positive thickness of layer of temperate ice. */
++			bool istemperatelayer=false;
++			if(enthalpy[vertexup]>=element->PureIceEnthalpy(pressure[vertexup])) istemperatelayer=true;
++			if(istemperatelayer) for(i=0;i<dim;i++) vec_heatflux[i]=0.; // TODO: add -k*nabla T_pmp
++			else{
++				enthalpy_input->GetInputDerivativeValue(&d1enthalpy[0],xyz_list,gauss);
++				for(i=0;i<3;i++) vec_heatflux[i]=-kappa*d1enthalpy[i];
++			}
++
++			/*heat flux along normal*/
++			heatflux=0.;
++			for(i=0;i<3;i++) heatflux+=(vec_heatflux[i])*normal_base[i];
++
++			/*basal friction*/
++			friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input);
++			vx_input->GetInputValue(&vx,gauss);
++			vy_input->GetInputValue(&vy,gauss);
++			vz_input->GetInputValue(&vz,gauss);
++			basalfriction=alpha2*(vx*vx + vy*vy + vz*vz);
++
++			element->EnthalpyToThermal(&temperature,&waterfraction,enthalpy[vertexdown],pressure[vertexdown]);
++			geothermalflux_input->GetInputValue(&geothermalflux,gauss);
++			// -Mb= Fb-(q-q_geo)/((1-w)*L), cf Aschwanden 2012, eq.66
++			heating[is]=(heatflux+basalfriction+geothermalflux);
++			meltingrate_enthalpy[is]=heating[is]/((1-waterfraction)*latentheat*rho_ice); // m/s water equivalent //????
++		}
++	}
++	// enthalpy might have been changed, update 
++	//element->AddInput(EnthalpyEnum,enthalpy,P1Enum);
++
++	/******** DRAINAGE *****************************************/
++	IssmDouble* drainrate_column = xNew<IssmDouble>(numsegments); //TODO: xDelete?
++	IssmDouble* drainrate_element = xNew<IssmDouble>(numsegments);
++	for(is=0;is<numsegments;is++)	drainrate_column[is]=0.;
++	Element* elementi = element;
++	for(;;){
++		for(is=0;is<numsegments;is++)	drainrate_element[is]=0.;
++		DrainWaterfraction(elementi,drainrate_element); // TODO: make sure every vertex is only drained once
++		for(is=0;is<numsegments;is++)	drainrate_column[is]+=drainrate_element[is];
++
++		if(elementi->IsOnSurface()) break;
++		elementi=elementi->GetUpperElement();			
++	}
++	// add drained water to melting rate
++	for(is=0;is<numsegments;is++) meltingrate_enthalpy[is]+=drainrate_column[is];
++
++	/******** UPDATE MELTINGRATES AND WATERCOLUMN **************/
++	element->FindParam(&dt,TimesteppingTimeStepEnum);
++	for(is=0;is<numsegments;is++){
++		vertexdown = pairindices[is*2+0];
++		vertexup   = pairindices[is*2+1];
++		if(reCast<bool,IssmDouble>(dt)){
++			if(watercolumn[vertexdown]+meltingrate_enthalpy[is]*dt<0.){	// prevent too much freeze on			
++				melting_overshoot=watercolumn[vertexdown]+meltingrate_enthalpy[is]*dt;
++				lambda=melting_overshoot/(meltingrate_enthalpy[is]*dt); _assert_(lambda>0); _assert_(lambda<1);
++				basalmeltingrate[vertexdown]=(1.-lambda)*meltingrate_enthalpy[is];
++				watercolumn[vertexdown]=0.;
++				yts=365*24*60*60;
++				enthalpy[vertexdown]+=dt/yts*lambda*heating[is];
++			}
++			else{
++				basalmeltingrate[vertexdown]=meltingrate_enthalpy[is];
++				watercolumn[vertexdown]+=dt*meltingrate_enthalpy[is]; 
++			}
++		}
++		else{
++			basalmeltingrate[vertexdown]=meltingrate_enthalpy[is];
++			watercolumn[vertexdown]+=meltingrate_enthalpy[is];
++		}		
++		_assert_(watercolumn[vertexdown]>=0.);
++	}
++
++	/*feed updated variables back into model*/
++	element->AddInput(EnthalpyEnum,enthalpy,P1Enum);
++	element->AddInput(WatercolumnEnum,watercolumn,P1Enum);
++	element->AddInput(BasalforcingsMeltingRateEnum,basalmeltingrate,P1Enum);
++
++	/*Clean up and return*/
++	delete gauss;
++	delete friction;
++  	xDelete<IssmDouble>(enthalpy);
++  	xDelete<IssmDouble>(pressure);
++  	xDelete<IssmDouble>(watercolumn);
++  	xDelete<IssmDouble>(basalmeltingrate);
++	xDelete<IssmDouble>(meltingrate_enthalpy);
++	xDelete<IssmDouble>(heating);
++	xDelete<IssmDouble>(drainrate_column);
++	xDelete<IssmDouble>(drainrate_element);
+ }/*}}}*/
+-void EnthalpyAnalysis::DrainWaterfraction(Element* element){/*{{{*/
+ 
++void EnthalpyAnalysis::DrainWaterfraction(Element* element, IssmDouble* pdrainrate_element){/*{{{*/
++
++	/*Intermediaries*/
++	int iv,is,vertexdown,vertexup,numsegments;	
++	IssmDouble dt, height_element;
++	IssmDouble rho_water, rho_ice;
++	int numvertices = element->GetNumberOfVertices();
++
++	IssmDouble* xyz_list = NULL;
++	IssmDouble* enthalpies = xNew<IssmDouble>(numvertices);
++	IssmDouble* pressures = xNew<IssmDouble>(numvertices);
++	IssmDouble* temperatures = xNew<IssmDouble>(numvertices);
++	IssmDouble* waterfractions = xNew<IssmDouble>(numvertices);
++	IssmDouble* deltawaterfractions = xNew<IssmDouble>(numvertices);
++	int        *pairindices   = NULL;
++	
++	rho_ice=element->GetMaterialParameter(MaterialsRhoIceEnum);
++	rho_water=element->GetMaterialParameter(MaterialsRhoWaterEnum);
++
++	element->GetVerticesCoordinates(&xyz_list);
++	element->GetInputListOnVertices(enthalpies,EnthalpyEnum);
++	element->GetInputListOnVertices(pressures,PressureEnum);
++
++	element->FindParam(&dt,TimesteppingTimeStepEnum);
++	for(iv=0;iv<numvertices;iv++){ 
++		element->EnthalpyToThermal(&temperatures[iv],&waterfractions[iv], enthalpies[iv],pressures[iv]); 
++		deltawaterfractions[iv]=DrainageFunctionWaterfraction(waterfractions[iv], dt);
++	}
++	
++	/*drain waterfraction, feed updated variables back into model*/
++	for(iv=0;iv<numvertices;iv++){
++		if(reCast<bool,IssmDouble>(dt))
++			waterfractions[iv]-=deltawaterfractions[iv]*dt;
++		else
++			waterfractions[iv]-=deltawaterfractions[iv];
++		element->ThermalToEnthalpy(&enthalpies[iv], temperatures[iv], waterfractions[iv], pressures[iv]);
++	}
++	element->AddInput(EnthalpyEnum,enthalpies,P1Enum);
++  	element->AddInput(WaterfractionEnum,waterfractions,P1Enum);
++
++	/*return meltwater column equivalent to drained water*/
++	element->VerticalSegmentIndices(&pairindices,&numsegments);
++	for(is=0;is<numsegments;is++){
++		vertexdown = pairindices[is*2+0];
++		vertexup   = pairindices[is*2+1];
++		height_element=fabs(xyz_list[vertexup*3+2]-xyz_list[vertexdown*3+2]);
++		pdrainrate_element[is]=(deltawaterfractions[vertexdown]+deltawaterfractions[vertexup])/2.*rho_water/rho_ice*height_element;
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(enthalpies);
++	xDelete<IssmDouble>(pressures);
++	xDelete<IssmDouble>(temperatures);
++	xDelete<IssmDouble>(waterfractions);
++	xDelete<IssmDouble>(deltawaterfractions);
+ }/*}}}*/
++
++
++
++
++
+ void EnthalpyAnalysis::UpdateBasalConstraints(Element* element){/*{{{*/
+ 
++	/* /\*Intermediary*\/ */
++	/* bool        isdynamicbasalspc,setspc; */
++	/* int         numindices, numindicesup; */
++	/* IssmDouble  pressure, pressureup; */
++	/* IssmDouble  h_pmp, enthalpy, enthalpyup; */
++	/* IssmDouble  watercolumn; */
++	/* int        *indices = NULL, *indicesup = NULL; */
++	
++	/* /\* Only update Constraints at the base of grounded ice*\/ */
++	/* if(!IsOnBed() || IsFloating()) return; */
++
++	/* /\*Check wether dynamic basal boundary conditions are activated *\/ */
++	/* element->FindParam(&isdynamicbasalspc,ThermalIsdynamicbasalspcEnum); */
++	/* if(!isdynamicbasalspc) return; */
++
++	/* /\*Fetch indices of basal & surface nodes for this finite element*\/ */
++	/* // BasalNodeIndices(&numindices,&indices,this->element_type); */
++	/* // SurfaceNodeIndices(&numindicesup,&indicesup,this->element_type); */
++	/* //	_assert_(numindices==numindicesup); */
++
++	/* /\*Get parameters and inputs: *\/ */
++	/* Input* pressure_input=inputs->GetInput(PressureEnum); _assert_(pressure_input); */
++	/* Input* enthalpy_input=inputs->GetInput(EnthalpyEnum); _assert_(enthalpy_input); */
++	/* Input* watercolumn_input=inputs->GetInput(WatercolumnEnum); _assert_(watercolumn_input); */
++
++	/* /\*if there is a temperate layer of zero thickness, set spc enthalpy=h_pmp at that node*\/ */
++	/* GaussPenta* gauss=new GaussPenta(); */
++	/* GaussPenta* gaussup=new GaussPenta(); */
++	/* for(int i=0;i<numindices;i++){ */
++	/* 	gauss->GaussNode(this->element_type,indices[i]); */
++	/* 	gaussup->GaussNode(this->element_type,indicesup[i]); */
++
++	/* 	/\*Check wether there is a temperate layer at the base or not *\/ */
++	/* 	/\*check if node is temperate, if not, continue*\/ */
++	/* 	enthalpy_input->GetInputValue(&enthalpy, gauss); */
++	/* 	pressure_input->GetInputValue(&pressure, gauss); */
++	/* 	watercolumn_input->GetInputValue(&watercolumn,gauss); */
++	/* 	setspc = false; */
++	/* 	// TODO: add case H<Hpmp && watercolumn>0.; */
++	/* 	if (enthalpy>=element->PureIceEnthalpy(pressure)){ */
++	/* 		/\*check if upper node is temperate, too. */
++	/* 			if yes, then we have a temperate layer of positive thickness and reset the spc. */
++	/* 			if not, apply dirichlet BC.*\/ */
++	/* 		enthalpy_input->GetInputValue(&enthalpyup, gaussup); */
++	/* 		pressure_input->GetInputValue(&pressureup, gaussup); */
++	/* 		setspc=((enthalpyup<element->PureIceEnthalpy(pressureup)) && (watercolumn>=0.))?true:false; */
++	/* 	} */
++
++	/* 	if (setspc) { */
++	/* 		/\*Calculate enthalpy at pressure melting point *\/ */
++	/* 		h_pmp=matpar->PureIceEnthalpy(pressure); */
++	/* 		/\*Apply Dirichlet condition (dof = 0 here, since there is only one degree of freedom per node)*\/ */
++	/* 		//element->ApplyConstraint(indices[i],1,h_pmp); */
++	/* 		//nodes[indices[i]]->ApplyConstraint(1,h_pmp); */
++	/* 	} */
++	/* 	else { */
++	/* 		/\*remove spc*\/ */
++	/* 		//element->RemoveConstraint(indices[i],0); */
++	/* 		//nodes[indices[i]]->DofInFSet(0); */
++	/* 	} */
++	/* } */
++
++	/* /\*Free ressources:*\/ */
++	/* xDelete<int>(indices); */
++	/* xDelete<int>(indicesup); */
++	/* delete gauss; */
++	/* delete gaussup; */
+ }/*}}}*/
+ 
++
++
++
++
+ /*Intermediaries*/
+ IssmDouble EnthalpyAnalysis::EnthalpyDiffusionParameter(Element* element,IssmDouble enthalpy,IssmDouble pressure){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17013)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17014)
+@@ -104,6 +104,7 @@
+ 		virtual void       SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters)=0;
+ 		virtual void       SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum)=0;
+ 		virtual void   ElementSizes(IssmDouble* phx,IssmDouble* phy,IssmDouble* phz)=0;
++		virtual void   ThermalToEnthalpy(IssmDouble* penthalpy,IssmDouble temperature,IssmDouble waterfraction,IssmDouble pressure)=0;
+ 		virtual void   EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure)=0;
+ 		virtual IssmDouble EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure)=0;
+ 		virtual IssmDouble EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure)=0;
+@@ -122,6 +123,9 @@
+ 		virtual void   NormalBase(IssmDouble* normal,IssmDouble* xyz_list)=0;
+ 		virtual IssmDouble PureIceEnthalpy(IssmDouble pressure)=0;
+ 
++		virtual Element* GetUpperElement(void)=0;
++		virtual Element* GetLowerElement(void)=0;
++		virtual Element* GetSurfaceElement(void)=0;
+ 		virtual Element* GetBasalElement(void)=0;
+ 		virtual void	GetDofList(int** pdoflist,int approximation_enum,int setenum)=0;
+ 		virtual void	GetDofListVelocity(int** pdoflist,int setenum)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17013)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17014)
+@@ -68,8 +68,12 @@
+ 		void        SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum);
+ 		void        Delta18oParameterization(void);
+ 		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){_error_("not implemented yet");};
++		void        ThermalToEnthalpy(IssmDouble* penthalpy,IssmDouble temperature,IssmDouble waterfraction,IssmDouble pressure){_error_("not implemented yet");};
+ 		void        EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented yet");};
+ 		int         FiniteElement(void);
++		Element*    GetUpperElement(void){_error_("not implemented yet");};
++	  	Element*    GetLowerElement(void){_error_("not implemented yet");};
++	  	Element*    GetSurfaceElement(void){_error_("not implemented yet");};
+ 		Element*    GetBasalElement(void){_error_("not implemented yet");};
+ 		void	      GetDofList(int** pdoflist,int approximation_enum,int setenum);
+ 		void	      GetDofListVelocity(int** pdoflist,int setenum);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17013)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17014)
+@@ -133,7 +133,7 @@
+ 			for(;;){
+ 				penta->inputs->AddInput(new PentaInput(input_enum,&extrudedvalues[0],P1Enum));
+ 				if (penta->IsOnSurface()) break;
+-				penta=penta->GetUpperElement(); _assert_(penta->Id()!=this->id);
++				penta=penta->GetUpperPenta(); _assert_(penta->Id()!=this->id);
+ 			}
+ 		}
+ 		else _error_("not implemented yet");
+@@ -147,7 +147,6 @@
+ 	this->material->inputs->AddInput(new PentaInput(input_enum,values,interpolation_enum));
+ }
+ /*}}}*/
+-
+ /*FUNCTION Penta::BasalFrictionCreateInput {{{*/
+ void Penta::BasalFrictionCreateInput(void){
+ 
+@@ -478,6 +477,11 @@
+ 	this->DeepEcho();
+ }
+ /*}}}*/
++/*FUNCTION Penta::ThermalToEnthalpy{{{*/
++void Penta::ThermalToEnthalpy(IssmDouble* penthalpy,IssmDouble temperature,IssmDouble waterfraction,IssmDouble pressure){
++	matpar->ThermalToEnthalpy(penthalpy,temperature,waterfraction,pressure);
++}
++/*}}}*/
+ /*FUNCTION Penta::EnthalpyToThermal{{{*/
+ void Penta::EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){
+ 	matpar->EnthalpyToThermal(ptemperature,pwaterfraction,enthalpy,pressure);
+@@ -541,20 +545,61 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetBasalElement{{{*/
+-Element* Penta::GetBasalElement(void){
++/*FUNCTION Penta::GetUpperPenta{{{*/
++Penta* Penta::GetUpperPenta(void){
+ 
++	Penta* upper_penta=NULL;
++
++	upper_penta=(Penta*)verticalneighbors[1]; //first one (0) under, second one (1) above
++
++	return upper_penta;
++}
++/*}}}*/
++/*FUNCTION Penta::GetLowerPenta{{{*/
++Penta* Penta::GetLowerPenta(void){
++
++	Penta* lower_penta=NULL;
++
++	lower_penta=(Penta*)verticalneighbors[0]; //first one (0) under, second one (1) above
++
++	return lower_penta;
++}
++/*}}}*/
++/*FUNCTION Penta::GetSurfacePenta{{{*/
++Penta* Penta::GetSurfacePenta(void){
++
+ 	/*Output*/
+ 	Penta* penta=NULL;
+ 
+-	/*Go through all elements till the bed is reached*/
++	/*Go through all pentas till the surface is reached*/
+ 	penta=this;
+ 	for(;;){
++		/*Stop if we have reached the surface, else, take upper penta*/
++		if (penta->IsOnSurface()) break;
++
++		/* get upper Penta*/
++		penta=penta->GetUpperPenta();
++		_assert_(penta->Id()!=this->id);
++	}
++
++	/*return output*/
++	return penta;
++}
++/*}}}*/
++/*FUNCTION Penta::GetBasalPenta{{{*/
++Penta* Penta::GetBasalPenta(void){
++
++	/*Output*/
++	Penta* penta=NULL;
++
++	/*Go through all pentas till the bed is reached*/
++	penta=this;
++	for(;;){
+ 		/*Stop if we have reached the surface, else, take lower penta*/
+ 		if (penta->IsOnBed()) break;
+ 
+ 		/* get lower Penta*/
+-		penta=penta->GetLowerElement();
++		penta=penta->GetLowerPenta();
+ 		_assert_(penta->Id()!=this->id);
+ 	}
+ 
+@@ -562,6 +607,38 @@
+ 	return penta;
+ }
+ /*}}}*/
++/*FUNCTION Penta::GetUpperElement{{{*/
++Element* Penta::GetUpperElement(void){
++
++	/*Output*/
++	Element* upper_element=this->GetUpperPenta();
++	return upper_element;
++}
++/*}}}*/
++/*FUNCTION Penta::GetLowerElement{{{*/
++Element* Penta::GetLowerElement(void){
++
++	/*Output*/
++	Element* lower_element=this->GetLowerPenta();
++	return lower_element;
++}
++/*}}}*/
++/*FUNCTION Penta::GetSurfaceElement{{{*/
++Element* Penta::GetSurfaceElement(void){
++
++	/*Output*/
++	Element* element=this->GetSurfacePenta();
++	return element;
++}
++/*}}}*/
++/*FUNCTION Penta::GetBasalElement{{{*/
++Element* Penta::GetBasalElement(void){
++
++	/*Output*/
++	Element* element=this->GetBasalPenta();
++	return element;
++}
++/*}}}*/
+ /*FUNCTION Penta::GetDofList {{{*/
+ void  Penta::GetDofList(int** pdoflist,int approximation_enum,int setenum){
+ 
+@@ -832,16 +909,6 @@
+ 	*hz=zmax-zmin;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetLowerElement{{{*/
+-Penta* Penta::GetLowerElement(void){
+-
+-	Penta* upper_penta=NULL;
+-
+-	upper_penta=(Penta*)verticalneighbors[0]; //first one (0) under, second one (1) above
+-
+-	return upper_penta;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::GetNodeIndex {{{*/
+ int Penta::GetNodeIndex(Node* node){
+ 
+@@ -1122,16 +1189,6 @@
+ 	return tau_parameter;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetUpperElement{{{*/
+-Penta* Penta::GetUpperElement(void){
+-
+-	Penta* upper_penta=NULL;
+-
+-	upper_penta=(Penta*)verticalneighbors[1]; //first one under, second one above
+-
+-	return upper_penta;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::GetVectorFromInputs{{{*/
+ void  Penta::GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum){
+ 
+@@ -1485,7 +1542,7 @@
+ 		if (penta->IsOnSurface()) break;
+ 
+ 		/* get upper Penta*/
+-		penta=penta->GetUpperElement();
++		penta=penta->GetUpperPenta();
+ 		_assert_(penta->Id()!=this->id);
+ 
+ 		/*increase couter*/
+@@ -1554,7 +1611,7 @@
+ 	penta=this;
+ 	for(;;){
+ 		/* get upper Penta*/
+-		penta=penta->GetUpperElement();
++		penta=penta->GetUpperPenta();
+ 		_assert_(penta->Id()!=this->id);
+ 
+ 		/*Add input of the basal element to penta->inputs*/
+@@ -1777,7 +1834,7 @@
+ 		if (penta->IsOnSurface()) break;
+ 
+ 		/* get upper Penta*/
+-		penta=penta->GetUpperElement(); _assert_(penta->Id()!=this->id);
++		penta=penta->GetUpperPenta(); _assert_(penta->Id()!=this->id);
+ 	}
+ 
+ 	/*Free ressources:*/
+@@ -3415,7 +3472,7 @@
+ 		for(iv=0; iv<NUMVERTICES2D; iv++)	drainrate_column[iv]+=drainrate_element[iv];
+ 
+ 		if(penta->IsOnSurface()) break;
+-		penta=penta->GetUpperElement();			
++		penta=penta->GetUpperPenta();			
+ 	}
+ 	// add drained water to melting rate
+ 	for(iv=0; iv<NUMVERTICES2D;iv++)
+@@ -3459,7 +3516,7 @@
+ /*FUNCTION Penta::DrainWaterfraction{{{*/
+ void Penta::DrainWaterfraction(IssmDouble* drainrate_element){
+ 
+-    /*Intermediaries*/
++  /*Intermediaries*/
+ 	bool isenthalpy;
+ 	int iv, index0;
+ 	IssmDouble waterfraction[NUMVERTICES], temperature[NUMVERTICES];
+@@ -4608,7 +4665,7 @@
+ 			if (penta->IsOnSurface()) break;
+ 			
+ 			/* get upper Penta*/
+-			penta=penta->GetUpperElement(); _assert_(penta->Id()!=this->id);
++			penta=penta->GetUpperPenta(); _assert_(penta->Id()!=this->id);
+ 		}
+ 	}
+ }
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17013)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17014)
+@@ -71,7 +71,15 @@
+ 		void   SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters);
+ 		void   SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum);
+ 		void   Delta18oParameterization(void);
++		void   ThermalToEnthalpy(IssmDouble* penthalpy,IssmDouble temperature,IssmDouble waterfraction,IssmDouble pressure);
+ 		void   EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure);
++		Penta* GetUpperPenta(void);
++		Penta* GetLowerPenta(void);
++		Penta* GetSurfacePenta(void);
++		Penta* GetBasalPenta(void);
++		Element* GetUpperElement(void);
++		Element* GetLowerElement(void);
++		Element* GetSurfaceElement(void);
+ 		Element* GetBasalElement(void);
+ 		void	 GetDofList(int** pdoflist,int approximation_enum,int setenum);
+ 		void	 GetDofListVelocity(int** pdoflist,int setenum);
+@@ -210,8 +218,6 @@
+ 		void           GetInputValue(IssmDouble* pvalue,Gauss* gauss,int enum_type);
+ 		void           GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype);
+ 		Node*          GetNode(int node_number);
+-		Penta*         GetUpperElement(void);
+-		Penta*         GetLowerElement(void);
+ 		void           InputChangeName(int input_enum, int enum_type_old);
+ 		void	         InputExtrude(int enum_type,int object_type);
+ 		void           InputUpdateFromSolutionOneDof(IssmDouble* solutiong,int enum_type);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17013)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17014)
+@@ -70,10 +70,14 @@
+ 		void        SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum){_error_("not implemented yet");};
+ 		void        Delta18oParameterization(void){_error_("not implemented yet");};
+ 		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){_error_("not implemented yet");};
++		void        ThermalToEnthalpy(IssmDouble* penthalpy,IssmDouble temperature,IssmDouble waterfraction,IssmDouble pressure){_error_("not implemented yet");};
+ 		void        EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented yet");};
+ 		IssmDouble  EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented");};
+ 		IssmDouble  EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure){_error_("not implemented");};
+ 		int         FiniteElement(void);
++		Element*    GetUpperElement(void){_error_("not implemented yet");};
++	  	Element*    GetLowerElement(void){_error_("not implemented yet");};
++	  	Element*    GetSurfaceElement(void){_error_("not implemented yet");};
+ 		Element*    GetBasalElement(void){_error_("not implemented yet");};
+ 		void        GetDofList(int** pdoflist,int approximation_enum,int setenum){_error_("not implemented yet");};
+ 		void        GetDofListVelocity(int** pdoflist,int setenum){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-17014-17015.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17014-17015.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17014-17015.diff	(revision 17802)
@@ -0,0 +1,69 @@
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17014)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17015)
+@@ -872,10 +872,7 @@
+ 	element->GetVerticesCoordinatesBase(&xyz_list_base);
+ 	IssmDouble latentheat = element->GetMaterialParameter(MaterialsLatentheatEnum);
+ 	IssmDouble rho_ice    = element->GetMaterialParameter(MaterialsRhoIceEnum);
+-	//Input* watercolumn_input      = inputs->GetInput(WatercolumnEnum);                 _assert_(watercolumn_input);
+ 	Input* enthalpy_input         = element->GetInput(EnthalpyEnum);                    _assert_(enthalpy_input);
+-	//  Input* pressure_input         = inputs->GetInput(PressureEnum);                    _assert_(pressure_input);
+-	//	Input* basalmeltingrate_input = inputs->GetInput(BasalforcingsMeltingRateEnum);    _assert_(basalmeltingrate_input);
+ 	Input* geothermalflux_input   = element->GetInput(BasalforcingsGeothermalfluxEnum); _assert_(geothermalflux_input);
+ 	Input* vx_input               = element->GetInput(VxEnum);                          _assert_(vx_input);
+ 	Input* vy_input               = element->GetInput(VyEnum);                          _assert_(vy_input);
+@@ -908,7 +905,7 @@
+ 		gauss->GaussVertex(vertexdown);
+ 		
+ 		bool checkpositivethickness=true;
+-		_assert_(watercolumn>=0.);
++		_assert_(watercolumn[vertexdown]>=0.);
+ 
+ 		/*Calculate basal meltingrate after Fig.5 of A.Aschwanden 2012*/
+ 		meltingrate_enthalpy[is]=0.;
+@@ -946,16 +943,16 @@
+ 
+ 			element->EnthalpyToThermal(&temperature,&waterfraction,enthalpy[vertexdown],pressure[vertexdown]);
+ 			geothermalflux_input->GetInputValue(&geothermalflux,gauss);
+-			// -Mb= Fb-(q-q_geo)/((1-w)*L), cf Aschwanden 2012, eq.66
++			/* -Mb= Fb-(q-q_geo)/((1-w)*L), cf Aschwanden 2012, eq.66*/
+ 			heating[is]=(heatflux+basalfriction+geothermalflux);
+ 			meltingrate_enthalpy[is]=heating[is]/((1-waterfraction)*latentheat*rho_ice); // m/s water equivalent //????
+ 		}
+ 	}
+-	// enthalpy might have been changed, update 
++	/* enthalpy might have been changed, update */
+ 	//element->AddInput(EnthalpyEnum,enthalpy,P1Enum);
+ 
+ 	/******** DRAINAGE *****************************************/
+-	IssmDouble* drainrate_column = xNew<IssmDouble>(numsegments); //TODO: xDelete?
++	IssmDouble* drainrate_column  = xNew<IssmDouble>(numsegments); //TODO: xDelete?
+ 	IssmDouble* drainrate_element = xNew<IssmDouble>(numsegments);
+ 	for(is=0;is<numsegments;is++)	drainrate_column[is]=0.;
+ 	Element* elementi = element;
+@@ -967,7 +964,7 @@
+ 		if(elementi->IsOnSurface()) break;
+ 		elementi=elementi->GetUpperElement();			
+ 	}
+-	// add drained water to melting rate
++	/* add drained water to melting rate*/
+ 	for(is=0;is<numsegments;is++) meltingrate_enthalpy[is]+=drainrate_column[is];
+ 
+ 	/******** UPDATE MELTINGRATES AND WATERCOLUMN **************/
+@@ -975,13 +972,13 @@
+ 	for(is=0;is<numsegments;is++){
+ 		vertexdown = pairindices[is*2+0];
+ 		vertexup   = pairindices[is*2+1];
+-		if(reCast<bool,IssmDouble>(dt)){
++		if(dt!=0.){
+ 			if(watercolumn[vertexdown]+meltingrate_enthalpy[is]*dt<0.){	// prevent too much freeze on			
+ 				melting_overshoot=watercolumn[vertexdown]+meltingrate_enthalpy[is]*dt;
+ 				lambda=melting_overshoot/(meltingrate_enthalpy[is]*dt); _assert_(lambda>0); _assert_(lambda<1);
+ 				basalmeltingrate[vertexdown]=(1.-lambda)*meltingrate_enthalpy[is];
+ 				watercolumn[vertexdown]=0.;
+-				yts=365*24*60*60;
++				yts=365.*24.*60.*60.;
+ 				enthalpy[vertexdown]+=dt/yts*lambda*heating[is];
+ 			}
+ 			else{
Index: issm/oecreview/Archive/16554-17801/ISSM-17017-17018.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17017-17018.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17017-17018.diff	(revision 17802)
@@ -0,0 +1,45 @@
+Index: ../trunk-jpl/src/m/enum/P1xP3Enum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/P1xP3Enum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/P1xP3Enum.m	(revision 17018)
+@@ -0,0 +1,11 @@
++function macro=P1xP3Enum()
++%P1XP3ENUM - Enum of P1xP3
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=P1xP3Enum()
++
++macro=StringToEnum('P1xP3');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17017)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17018)
+@@ -512,6 +512,8 @@
+ def P2Enum(): return StringToEnum("P2")[0]
+ def P2xP1Enum(): return StringToEnum("P2xP1")[0]
+ def P1xP2Enum(): return StringToEnum("P1xP2")[0]
++def P1xP3Enum(): return StringToEnum("P1xP3")[0]
++def P2xP4Enum(): return StringToEnum("P2xP4")[0]
+ def P1P1Enum(): return StringToEnum("P1P1")[0]
+ def P1P1GLSEnum(): return StringToEnum("P1P1GLS")[0]
+ def MINIEnum(): return StringToEnum("MINI")[0]
+Index: ../trunk-jpl/src/m/enum/P2xP4Enum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/P2xP4Enum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/P2xP4Enum.m	(revision 17018)
+@@ -0,0 +1,11 @@
++function macro=P2xP4Enum()
++%P2XP4ENUM - Enum of P2xP4
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=P2xP4Enum()
++
++macro=StringToEnum('P2xP4');
Index: issm/oecreview/Archive/16554-17801/ISSM-17018-17019.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17018-17019.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17018-17019.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/test/NightlyRun/test3104.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test3104.m	(revision 17018)
++++ ../trunk-jpl/test/NightlyRun/test3104.m	(revision 17019)
+@@ -11,7 +11,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure'};
+-field_tolerances={1e-08,1e-08,2.2e-07,1e-08,1e-08};
++field_tolerances={1e-08,1e-08,2.9e-07,1e-08,1e-08};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
Index: issm/oecreview/Archive/16554-17801/ISSM-17019-17020.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17019-17020.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17019-17020.diff	(revision 17802)
@@ -0,0 +1,16 @@
+Index: ../trunk-jpl/src/m/enum/HydrologydcMaskEplactiveEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/HydrologydcMaskEplactiveEnum.m	(revision 17019)
++++ ../trunk-jpl/src/m/enum/HydrologydcMaskEplactiveEnum.m	(revision 17020)
+@@ -1,11 +0,0 @@
+-function macro=HydrologydcMaskEplactiveEnum()
+-%HYDROLOGYDCMASKEPLACTIVEENUM - Enum of HydrologydcMaskEplactive
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=HydrologydcMaskEplactiveEnum()
+-
+-macro=StringToEnum('HydrologydcMaskEplactive');
Index: issm/oecreview/Archive/16554-17801/ISSM-17020-17021.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17020-17021.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17020-17021.diff	(revision 17802)
@@ -0,0 +1,340 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17020)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17021)
+@@ -246,14 +246,16 @@
+ 		transfer_input->GetInputValue(&transfer,gauss);
+ 		scalar = Jdet*gauss->weight*(-transfer);
+ 		if(dt!=0.) scalar = scalar*dt;
+-		for(int i=0;i<numnodes;i++) pe->values[i]+=scalar*basis[i];
+-
++		
++		for(int i=0;i<numnodes;i++)pe->values[i]+=scalar*basis[i];
++		
+ 		/*Transient term*/
+ 		if(dt!=0.){
+ 			thickness_input->GetInputValue(&epl_thickness,gauss);
+ 			old_wh_input->GetInputValue(&water_head,gauss);
+ 			scalar = Jdet*gauss->weight*water_head*epl_specificstoring*epl_thickness;
+-			for(int i=0;i<numnodes;i++) pe->values[i]+=scalar*basis[i];
++			
++			for(int i=0;i<numnodes;i++)pe->values[i]+=scalar*basis[i];
+ 		}
+ 	}
+ 	delete gauss;
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17020)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17021)
+@@ -84,6 +84,8 @@
+ 	iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
+ 	iomodel->FetchDataToInput(elements,SedimentHeadEnum);
++	iomodel->FetchDataToInput(elements,HydrologydcSedimentTransmitivityEnum);
++
+ 	if(isefficientlayer)iomodel->FetchDataToInput(elements,HydrologydcMaskEplactiveNodeEnum);
+ }/*}}}*/
+ void HydrologyDCInefficientAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+@@ -167,6 +169,7 @@
+ 
+ 	/*Intermediaries */
+ 	IssmDouble  D_scalar,Jdet,dt;
++	IssmDouble  sediment_transmitivity;
+ 	IssmDouble *xyz_list  = NULL;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -176,21 +179,21 @@
+ 	ElementMatrix* Ke     = basalelement->NewElementMatrix();
+ 	IssmDouble*    B      = xNew<IssmDouble>(2*numnodes);
+ 	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+-	IssmDouble     D[2][2]={0.};
++	IssmDouble     D[2][2]= {0.};
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	basalelement->GetVerticesCoordinates(&xyz_list);
+-	IssmDouble sediment_storing       = SedimentStoring(basalelement);
+-	IssmDouble sediment_transmitivity = basalelement->GetMaterialParameter(HydrologydcSedimentTransmitivityEnum);
+-	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
++	basalelement                       ->GetVerticesCoordinates(&xyz_list);
++	IssmDouble sediment_storing        = SedimentStoring(basalelement);
++	Input* SedTrans_input=basalelement ->GetInput(HydrologydcSedimentTransmitivityEnum); _assert_(SedTrans_input);
++	basalelement                       ->FindParam(&dt,TimesteppingTimeStepEnum);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	Gauss* gauss=basalelement->NewGauss(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-		gauss->GaussPoint(ig);
++	for(int ig=gauss -> begin();ig<gauss->end();ig++){
++		gauss          -> GaussPoint(ig);
++		basalelement   -> JacobianDeterminant(&Jdet,xyz_list,gauss);
++		SedTrans_input -> GetInputValue(&sediment_transmitivity,gauss);
+ 
+-		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
+-
+ 		/*Diffusivity*/
+ 		D_scalar=sediment_transmitivity*gauss->weight*Jdet;
+ 		if(dt!=0.) D_scalar=D_scalar*dt;
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17020)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17021)
+@@ -96,7 +96,13 @@
+ 		/*Iteration on the sediment layer*/
+ 		sedconverged=false;
+ 		for(;;){
+-
++			/* if(isefficientlayer){  */
++			/* 	/\*Updating Elemental Mask*\/ */
++			/* 	HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis(); */
++			/* 	analysis->ElementizeEplMask(femmodel); */
++			/* 	delete analysis; */
++			/* 	femmodel->HydrologyTransferx(); */
++			/* } */
+ 			uf_sed_sub_iter=uf_sed->Duplicate();_assert_(uf_sed_sub_iter);
+ 			uf_sed->Copy(uf_sed_sub_iter);
+ 			SystemMatricesx(&Kff,&Kfs,&pf,&df,&sediment_kmax,femmodel);
+@@ -122,13 +128,6 @@
+ 			sedcount++;
+ 
+ 			if(sedconverged){
+-				if(isefficientlayer){ 
+-					/*Updating Elemental Mask*/
+-					HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
+-					analysis->ElementizeEplMask(femmodel);
+-					delete analysis;
+-					femmodel->HydrologyTransferx();
+-				}
+ 				sedconverged=false;	
+ 				/*Checking convegence on the value of the sediment head*/
+ 				duf=uf_sed_sub_iter->Duplicate();_assert_(duf);
+@@ -148,6 +147,13 @@
+ 			delete uf_sed_sub_iter;
+ 
+ 			if(sedconverged){
++				if(isefficientlayer){
++					/*Updating Elemental Mask*/
++					HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
++					analysis->ElementizeEplMask(femmodel);
++					delete analysis;
++					femmodel->HydrologyTransferx();
++				}
+ 				femmodel->parameters->SetParam(sediment_kmax,HydrologySedimentKmaxEnum);
+ 				InputUpdateFromConstantx(femmodel,sedconverged,ConvergedEnum);
+ 				InputUpdateFromSolutionx(femmodel,ug_sed);
+@@ -158,17 +164,21 @@
+ 
+ 		/*Second layer*/
+ 		if(isefficientlayer){
+-
++			
+ 			femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
+ 			InputUpdateFromConstantx(femmodel,true,ResetPenaltiesEnum);
+ 			InputUpdateFromConstantx(femmodel,false,ConvergedEnum);
+ 			femmodel->parameters->SetParam(HydrologyEfficientEnum,HydrologyLayerEnum);
++			
++				
+ 
+ 			/*Iteration on the EPL layer*/
+ 			eplconverged = false;
+ 			for(;;){
+-
+-			/*Start by retrieving the EPL head slopes*/
++				
++				//updating mask after the computation of the epl thickness (Allow to close too thin EPL)
++				femmodel->HydrologyEPLupdateDomainx();
++				/*Start by retrieving the EPL head slopes and compute EPL Thickness*/
+ 				if(VerboseSolution()) _printf0_("computing EPL Head slope...\n");
+ 				femmodel->SetCurrentConfiguration(L2ProjectionEPLAnalysisEnum);
+ 				femmodel->UpdateConstraintsL2ProjectionEPLx();
+@@ -176,17 +186,19 @@
+ 				solutionsequence_linear(femmodel);
+ 				femmodel->parameters->SetParam(EplHeadSlopeYEnum,InputToL2ProjectEnum);
+ 				solutionsequence_linear(femmodel);
+-
++				femmodel->HydrologyEPLThicknessx();
+ 				
+-				femmodel->HydrologyEPLThicknessx();
+-
+ 				femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
+-
+-				//updating mask after the computation of the epl thickness (Allow to close too thin EPL)
+-				femmodel->HydrologyEPLupdateDomainx();
++			
++				/*Updating Elemental Mask*/
++				HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
++				analysis->ElementizeEplMask(femmodel);
++				delete analysis;
++				femmodel->HydrologyTransferx();
+ 					
+ 				ug_epl_sub_iter=ug_epl->Duplicate();_assert_(ug_epl_sub_iter);
+ 				ug_epl->Copy(ug_epl_sub_iter);
++				
+ 				SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
+ 				CreateNodalConstraintsx(&ys,femmodel->nodes,HydrologyDCEfficientAnalysisEnum);
+ 				Reduceloadx(pf,Kfs,ys); delete Kfs;
+@@ -212,7 +224,6 @@
+ 				}
+ 				eplcount++;
+ 
+-
+ 				if(eplconverged){
+ 					eplconverged=false;
+ 				
+@@ -231,12 +242,7 @@
+ 				delete ug_epl_sub_iter;
+ 
+ 				if(eplconverged){
+-					/*Updating Elemental Mask*/
+-					HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
+-					analysis->ElementizeEplMask(femmodel);
+-					delete analysis;
+-					femmodel->HydrologyTransferx();
+-					
++				
+ 					InputUpdateFromConstantx(femmodel,eplconverged,ConvergedEnum);
+ 					InputUpdateFromConstantx(femmodel,sediment_kmax,MeltingOffsetEnum);
+ 					InputUpdateFromSolutionx(femmodel,ug_epl);
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 17020)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 17021)
+@@ -58,7 +58,6 @@
+ 		iomodel->Constant(&this->sediment_compressibility,HydrologydcSedimentCompressibilityEnum);
+ 		iomodel->Constant(&this->sediment_porosity,HydrologydcSedimentPorosityEnum);
+ 		iomodel->Constant(&this->sediment_thickness,HydrologydcSedimentThicknessEnum);
+-		iomodel->Constant(&this->sediment_transmitivity,HydrologydcSedimentTransmitivityEnum);
+ 		iomodel->Constant(&this->water_compressibility,HydrologydcWaterCompressibilityEnum);
+ 		iomodel->Constant(&isefficientlayer,HydrologydcIsefficientlayerEnum);
+ 
+@@ -261,7 +260,6 @@
+ 		case HydrologydcEplConductivityEnum:         return this->epl_conductivity;
+ 		case HydrologydcEplInitialThicknessEnum:     return this->epl_init_thickness;
+ 		case HydrologydcWaterCompressibilityEnum:    return this->water_compressibility;
+-		case HydrologydcSedimentTransmitivityEnum:   return this->sediment_transmitivity;
+ 		case HydrologyshreveCREnum:                  return this->hydro_CR;
+ 		case HydrologyshreveKnEnum:                  return this->hydro_kn;
+ 		case HydrologyshreveNEnum:                   return this->hydro_n;
+@@ -389,13 +387,8 @@
+ IssmDouble Matpar::GetEplSpecificStoring(){
+ 	return this->rho_freshwater * this->g * this->epl_porosity * 
+     (this->water_compressibility + (this->epl_compressibility / this->epl_porosity));		 
+-}		 
++}		 	 
+ /*}}}*/ 
+-/*FUNCTION Matpar::GetSedimentTransitivity {{{*/
+-IssmDouble Matpar::GetSedimentTransmitivity(){
+-	return sediment_transmitivity;		 
+-}		 
+-/*}}}*/ 
+ /*FUNCTION Matpar::GetSedimentThickness {{{*/
+ IssmDouble Matpar::GetSedimentThickness(){
+ 	return sediment_thickness;		 
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 17020)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 17021)
+@@ -43,7 +43,6 @@
+ 		IssmDouble  sediment_compressibility;
+ 		IssmDouble  sediment_porosity;	 
+ 		IssmDouble  sediment_thickness;
+-		IssmDouble  sediment_transmitivity;	 
+ 		IssmDouble  water_compressibility;
+ 
+ 		IssmDouble  epl_compressibility;
+@@ -121,7 +120,6 @@
+ 		IssmDouble GetHydrologyN();
+ 		IssmDouble GetSedimentStoring();
+ 		IssmDouble GetEplSpecificStoring();
+-		IssmDouble GetSedimentTransmitivity();
+ 		IssmDouble GetSedimentThickness();
+ 		IssmDouble GetEplConductivity();
+ 		IssmDouble GetEplInitialThickness();
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17020)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17021)
+@@ -4659,13 +4659,12 @@
+ 	bool       isefficientlayer;
+ 	bool       active_element;
+ 	int        transfermethod,step;
+-	IssmDouble sed_trans,sed_thick;
+ 	IssmDouble leakage,h_max;
+-	IssmDouble wh_trans;
++	IssmDouble wh_trans,sed_thick;
+ 	IssmDouble activeEpl[numdof],epl_thickness[numdof];
+ 	IssmDouble epl_specificstoring[numdof],sedstoring[numdof];
+ 	IssmDouble epl_head[numdof],sed_head[numdof];
+-	IssmDouble old_transfer[numdof];
++	IssmDouble old_transfer[numdof],sed_trans[numdof];
+ 
+ 	Input* active_element_input=NULL;
+ 
+@@ -4693,35 +4692,31 @@
+ 			active_element_input->GetInputValue(&active_element);
+ 
+ 			GetInputListOnVertices(&sed_head[0],SedimentHeadEnum); 
++			GetInputListOnVertices(&sed_trans[0],HydrologydcSedimentTransmitivityEnum);
+ 			GetInputListOnVertices(&epl_head[0],EplHeadEnum);
+ 			GetInputListOnVertices(&epl_thickness[0],HydrologydcEplThicknessEnum);
+ 
+ 			this->parameters->FindParam(&leakage,HydrologydcLeakageFactorEnum);
+ 
+-			sed_trans = matpar->GetSedimentTransmitivity();
+ 			sed_thick = matpar->GetSedimentThickness();
+ 
+ 			if(!active_element){
+ 				/*No transfer if the EPL is not active*/
+-				/* for(int i=0;i<numdof;i++){ */
+-				/* 	wh_trans=0.0; */
+-				/* 	/\*Assign output pointer*\/ */
+-				/* 	transfer->SetValue(doflist[i],wh_trans,INS_VAL); */
+-				/* } */
+ 			}
+ 			else{
+ 			
+-				//GetInputListOnVertices(&old_transfer[0],WaterTransferEnum);
++				GetInputListOnVertices(&old_transfer[0],WaterTransferEnum);
+ 			
+ 				for(int i=0;i<numdof;i++){
+ 					epl_specificstoring[i]=matpar->GetEplSpecificStoring();		
+ 					sedstoring[i]=matpar->GetSedimentStoring();
+ 					this->GetHydrologyDCInefficientHmax(&h_max,i);
+-						
++										
++					//avoiding transfer at first time
++					if(epl_head[i]==0.0)epl_head[i]=sed_head[i];
+ 					/*EPL head higher than sediment head, transfer from the epl to the sediment*/
+ 					if(epl_head[i]>sed_head[i]){
+-						wh_trans=epl_specificstoring[i]*epl_thickness[i]*sed_trans*(epl_head[i]-sed_head[i])/(leakage*sed_thick);				
+-
++						wh_trans=epl_specificstoring[i]*epl_thickness[i]*sed_trans[i]*(epl_head[i]-sed_head[i])/(leakage*sed_thick);				
+ 						/*No transfer if the sediment head is allready at the maximum*/
+ 						if(sed_head[i]>=h_max){
+ 							wh_trans=0.0;
+@@ -4729,14 +4724,16 @@
+ 					}
+ 					/*EPL head lower than sediment head, transfer from the sediment to the epl*/
+ 					else if(epl_head[i]<=sed_head[i]){
+-						wh_trans=sedstoring[i]*sed_trans*(epl_head[i]-sed_head[i])/(leakage*sed_thick);
++						wh_trans=sedstoring[i]*sed_trans[i]*(epl_head[i]-sed_head[i])/(leakage*sed_thick);
+ 					}
+ 
+ 					/*Introduce relaxation*/
+-					//wh_trans=old_transfer[i]+0.9*(wh_trans-old_transfer[i]);
++					wh_trans=old_transfer[i]+0.66*(wh_trans-old_transfer[i]);
+ 				
+ 					/*Assign output pointer*/
+ 					transfer->SetValue(doflist[i],wh_trans,INS_VAL);
++
++					
+ 				}
+ 			}
+ 			break;
+@@ -4880,7 +4877,6 @@
+ 					
+ 					/*And proceed to the real thing*/
+ 					thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*EPLgrad2-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
+-
+ 			}
+ 		}
+ 		this->inputs->AddInput(new TriaInput(HydrologydcEplThicknessEnum,thickness,P1Enum));
Index: issm/oecreview/Archive/16554-17801/ISSM-17021-17022.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17021-17022.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17021-17022.diff	(revision 17802)
@@ -0,0 +1,48 @@
+Index: ../trunk-jpl/src/m/classes/hydrologydc.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/hydrologydc.m	(revision 17021)
++++ ../trunk-jpl/src/m/classes/hydrologydc.m	(revision 17022)
+@@ -16,11 +16,12 @@
+ 		leakage_factor           = 0;
+ 
+ 		spcsediment_head         = NaN;
++		sediment_transmitivity   = NaN;
+ 		sediment_compressibility = 0;
+ 		sediment_porosity        = 0;
+ 		sediment_thickness       = 0;
+-		sediment_transmitivity   = 0;
+ 
++
+ 		spcepl_head              = NaN;
+ 		mask_eplactive_node      = NaN;
+ 		epl_compressibility      = 0;
+@@ -88,7 +89,7 @@
+ 			md = checkfield(md,'fieldname','hydrology.sediment_compressibility','>',0,'numel',1);
+ 			md = checkfield(md,'fieldname','hydrology.sediment_porosity','>',0,'numel',1);
+ 			md = checkfield(md,'fieldname','hydrology.sediment_thickness','>',0,'numel',1);
+-			md = checkfield(md,'fieldname','hydrology.sediment_transmitivity','>',0,'numel',1);
++			md = checkfield(md,'fieldname','hydrology.sediment_transmitivity','>=',0,'size',[md.mesh.numberofvertices 1]);
+ 
+ 			if obj.isefficientlayer==1,
+ 				md = checkfield(md,'fieldname','hydrology.spcepl_head','forcing',1);
+@@ -163,7 +164,7 @@
+ 			WriteData(fid,'object',obj,'fieldname','sediment_compressibility','format','Double');			
+ 			WriteData(fid,'object',obj,'fieldname','sediment_porosity','format','Double');			
+ 			WriteData(fid,'object',obj,'fieldname','sediment_thickness','format','Double');
+-			WriteData(fid,'object',obj,'fieldname','sediment_transmitivity','format','Double');		
++			WriteData(fid,'object',obj,'fieldname','sediment_transmitivity','format','DoubleMat','mattype',1');		
+ 
+ 			if obj.isefficientlayer==1,	
+ 				WriteData(fid,'object',obj,'fieldname','spcepl_head','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);	
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17021)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17022)
+@@ -725,6 +725,7 @@
+ 				md.hydrology.spcsediment_head=project3d(md,'vector',md.hydrology.spcsediment_head,'type','node','layer',1);
+ 				md.hydrology.spcepl_head=project3d(md,'vector',md.hydrology.spcepl_head,'type','node','layer',1);
+ 				md.hydrology.mask_eplactive_node=project3d(md,'vector',md.hydrology.mask_eplactive_node,'type','node','layer',1);
++				md.hydrology.sediment_transmitivity=project3d(md,'vector',md.hydrology.sediment_transmitivity,'type','node','layer',1);
+ 	    end
+ 
+ 			%connectivity
Index: issm/oecreview/Archive/16554-17801/ISSM-17022-17023.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17022-17023.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17022-17023.diff	(revision 17802)
@@ -0,0 +1,52 @@
+Index: ../trunk-jpl/test/NightlyRun/test332.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test332.m	(revision 17022)
++++ ../trunk-jpl/test/NightlyRun/test332.m	(revision 17023)
+@@ -12,7 +12,7 @@
+ pos=find(md.mesh.y==0);
+ md.hydrology.spcsediment_head(pos)=0.0;
+ md.basalforcings.melting_rate = 2.0*ones(md.mesh.numberofvertices,1);
+-md.hydrology.sediment_transmitivity=3;
++md.hydrology.sediment_transmitivity=3*ones(md.mesh.numberofvertices,1);
+ md.timestepping.time_step=0;
+ md.timestepping.final_time=1.0;
+ md=solve(md,HydrologySolutionEnum());
+Index: ../trunk-jpl/test/NightlyRun/test333.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test333.m	(revision 17022)
++++ ../trunk-jpl/test/NightlyRun/test333.m	(revision 17023)
+@@ -10,7 +10,7 @@
+ md.initialization.sediment_head=0.0*ones(md.mesh.numberofvertices,1);
+ md.hydrology.spcsediment_head=NaN*ones(md.mesh.numberofvertices,1);
+ md.basalforcings.melting_rate = 2.0*ones(md.mesh.numberofvertices,1);
+-md.hydrology.sediment_transmitivity=3;
++md.hydrology.sediment_transmitivity=3*ones(md.mesh.numberofvertices,1);
+ 
+ md.initialization.epl_head=0.0*ones(md.mesh.numberofvertices,1);
+ md.hydrology.spcepl_head=NaN*ones(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/test/NightlyRun/test334.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test334.m	(revision 17022)
++++ ../trunk-jpl/test/NightlyRun/test334.m	(revision 17023)
+@@ -12,7 +12,7 @@
+ pos=find(md.mesh.y==0);
+ md.hydrology.spcsediment_head(pos)=0.0;
+ md.basalforcings.melting_rate = 2.0*ones(md.mesh.numberofvertices,1);
+-md.hydrology.sediment_transmitivity=3;
++md.hydrology.sediment_transmitivity= 3.0*ones(md.mesh.numberofvertices,1);
+ md.timestepping.time_step=0;
+ md.timestepping.final_time=1.0;
+ %md.verbose=verbose('1111111');
+Index: ../trunk-jpl/test/NightlyRun/test335.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test335.m	(revision 17022)
++++ ../trunk-jpl/test/NightlyRun/test335.m	(revision 17023)
+@@ -10,7 +10,7 @@
+ md.initialization.sediment_head=0.0*ones(md.mesh.numberofvertices,1);
+ md.hydrology.spcsediment_head=NaN*ones(md.mesh.numberofvertices,1);
+ md.basalforcings.melting_rate = 2.0*ones(md.mesh.numberofvertices,1);
+-md.hydrology.sediment_transmitivity=3;
++md.hydrology.sediment_transmitivity=3*ones(md.mesh.numberofvertices,1);
+ 
+ md.initialization.epl_head=0.0*ones(md.mesh.numberofvertices,1);
+ md.hydrology.spcepl_head=NaN*ones(md.mesh.numberofvertices,1);
Index: issm/oecreview/Archive/16554-17801/ISSM-17023-17024.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17023-17024.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17023-17024.diff	(revision 17802)
@@ -0,0 +1,470 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17023)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17024)
+@@ -127,8 +127,13 @@
+ 	}
+ 
+ 	/*Check that all nodes are active, else return empty matrix*/
+-	if(!basalelement->AllActive()) return NULL;
+-
++	if(!basalelement->AllActive()) {
++		if(meshtype!=Mesh2DhorizontalEnum){
++			basalelement->DeleteMaterials(); 
++			delete basalelement;
++		}
++		return NULL;
++	}
+ 	/* Intermediaries */
+ 	IssmDouble  D_scalar,Jdet,dt;
+ 	IssmDouble  epl_thickness;
+@@ -185,6 +190,7 @@
+ 	xDelete<IssmDouble>(basis);
+ 	xDelete<IssmDouble>(B);
+ 	delete gauss;
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return Ke;
+ 
+ }/*}}}*/
+@@ -208,8 +214,13 @@
+ 	}
+ 
+ 	/*Check that all nodes are active, else return empty matrix*/
+-	if(!basalelement->AllActive()) return NULL;
+-
++	if(!basalelement->AllActive()){
++		if(meshtype!=Mesh2DhorizontalEnum){
++			basalelement->DeleteMaterials(); 
++			delete basalelement;
++		}
++		return NULL;
++	}
+ 	/*Intermediaries */
+ 	IssmDouble dt,scalar,water_head,connectivity;
+ 	IssmDouble transfer,residual,epl_thickness;
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17023)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17024)
+@@ -22,15 +22,13 @@
+ 	Vector<IssmDouble>* ug_epl_sub_iter=NULL;
+ 	Vector<IssmDouble>* ug_epl_main_iter=NULL;
+ 
+-
+ 	Vector<IssmDouble>* ys=NULL; 
+ 	Vector<IssmDouble>* dug=NULL;
+-
+-	//testing stuff
+ 	Vector<IssmDouble>* duf=NULL;
+ 
+ 	Matrix<IssmDouble>* Kff=NULL;
+ 	Matrix<IssmDouble>* Kfs=NULL;
++
+ 	Vector<IssmDouble>* pf=NULL;
+ 	Vector<IssmDouble>* df=NULL;
+ 
+@@ -50,10 +48,14 @@
+ 	femmodel->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);
+ 	femmodel->parameters->FindParam(&eps_hyd,HydrologydcRelTolEnum);
+ 	femmodel->parameters->FindParam(&time,TimeEnum);
++
+ 	/*FIXME, hardcoded, put on an enum*/
+ 	hydro_maxiter=150;
++
+ 	hydrocount=1;
+ 	hydroconverged=false;
++	/*We don't need the outer loop if only one layer is used*/
++	if(!isefficientlayer) hydroconverged=true;
+ 
+ 	/*Retrieve inputs as the initial state for the non linear iteration*/
+ 	GetSolutionFromInputsx(&ug_sed,femmodel);	
+@@ -62,8 +64,8 @@
+ 	if(isefficientlayer) {
+ 		femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
+ 		GetSolutionFromInputsx(&ug_epl,femmodel);
+-
+-		/*Initialize the transfer input*/
++		
++		/*Initialize the element mask*/
+ 		HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
+ 		analysis->ElementizeEplMask(femmodel);
+ 		delete analysis;
+@@ -71,89 +73,82 @@
+ 	/*For the initialization we compute the transfer without the mask if the EPL is not present*/
+ 	femmodel->HydrologyTransferx();
+ 
+-	/*Iteration on the two layers*/
++	/*The real computation starts here, outermost loop is on the two layer system*/
+ 	for(;;){
+ 		sedcount=1;
+ 		eplcount=1;
+-		//save pointer to old velocity
+-		ug_sed_main_iter=ug_sed->Duplicate();
+-		ug_sed->Copy(ug_sed_main_iter);
+-		
++
++		/*If there is two layers we need an outer loop value to compute convergence*/
+ 		if(isefficientlayer){
++			ug_sed_main_iter=ug_sed->Duplicate();
++			ug_sed->Copy(ug_sed_main_iter);
+ 			ug_epl_main_iter=ug_epl->Duplicate();
+ 			ug_epl->Copy(ug_epl_main_iter);
+ 		}
+-
++		/*Loop on sediment layer to deal with transfer and head value*/
+ 		femmodel->SetCurrentConfiguration(HydrologyDCInefficientAnalysisEnum);
+ 		InputUpdateFromConstantx(femmodel,true,ResetPenaltiesEnum);
+ 		InputUpdateFromConstantx(femmodel,false,ConvergedEnum);
+ 		femmodel->UpdateConstraintsx();
+ 		femmodel->parameters->SetParam(HydrologySedimentEnum,HydrologyLayerEnum);
+-
+-		/*Reset constraint on the ZigZag Lock*/
+-		ResetConstraintsx(femmodel);
+ 		
+-		/*Iteration on the sediment layer*/
++		/*Reset constraint on the ZigZag Lock, this thing doesn't work, it have to disapear*/
++		ResetConstraintsx(femmodel);
+ 		sedconverged=false;
++		/* {{{ *//*Treating the sediment*/
+ 		for(;;){
+-			/* if(isefficientlayer){  */
+-			/* 	/\*Updating Elemental Mask*\/ */
+-			/* 	HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis(); */
+-			/* 	analysis->ElementizeEplMask(femmodel); */
+-			/* 	delete analysis; */
+-			/* 	femmodel->HydrologyTransferx(); */
+-			/* } */
+ 			uf_sed_sub_iter=uf_sed->Duplicate();_assert_(uf_sed_sub_iter);
+ 			uf_sed->Copy(uf_sed_sub_iter);
+-			SystemMatricesx(&Kff,&Kfs,&pf,&df,&sediment_kmax,femmodel);
+-			CreateNodalConstraintsx(&ys,femmodel->nodes,HydrologyDCInefficientAnalysisEnum);
+-			Reduceloadx(pf,Kfs,ys); delete Kfs;
+-			delete uf_sed;
+-			Solverx(&uf_sed,Kff,pf,uf_sed_sub_iter,df,femmodel->parameters);
+-			delete Kff; delete pf; delete df;
+-			delete ug_sed;
+-			Mergesolutionfromftogx(&ug_sed,uf_sed,ys,femmodel->nodes,femmodel->parameters); delete ys;
+-			InputUpdateFromSolutionx(femmodel,ug_sed);
+-			ConstraintsStatex(&constraints_converged,&num_unstable_constraints,femmodel);
+-
+-			if (!sedconverged){
+-				if(VerboseConvergence()) _printf0_("   # Sediment unstable constraints = " << num_unstable_constraints << "\n");
+-				if(num_unstable_constraints==0) sedconverged = true;
+-				if (sedcount>=hydro_maxiter){
+-					//sedconverged=true;
+-					_error_("   maximum number of Sediment iterations (" << hydro_maxiter << ") exceeded");
++			/* {{{ *//*Loop on the sediment layer to deal with the penalization*/
++			for(;;){
++				/* {{{ *//*Core of the computation*/
++				SystemMatricesx(&Kff,&Kfs,&pf,&df,&sediment_kmax,femmodel);
++				CreateNodalConstraintsx(&ys,femmodel->nodes,HydrologyDCInefficientAnalysisEnum);
++				Reduceloadx(pf,Kfs,ys); delete Kfs;
++				delete uf_sed;
++				Solverx(&uf_sed,Kff,pf,uf_sed_sub_iter,df,femmodel->parameters);
++				delete Kff; delete pf; delete df;
++				delete ug_sed;
++				Mergesolutionfromftogx(&ug_sed,uf_sed,ys,femmodel->nodes,femmodel->parameters); delete ys;
++				InputUpdateFromSolutionx(femmodel,ug_sed);
++				ConstraintsStatex(&constraints_converged,&num_unstable_constraints,femmodel);
++				/* }}} */
++				if (!sedconverged){
++					if(VerboseConvergence()) _printf0_("   # Sediment unstable constraints = " << num_unstable_constraints << "\n");
++					if(num_unstable_constraints==0) sedconverged = true;
++					if (sedcount>=hydro_maxiter){
++						_error_("   maximum number of Sediment iterations (" << hydro_maxiter << ") exceeded");
++					}
+ 				}
++				/*Add an iteration and get out of the loop if the penalisation is converged*/
++				sedcount++;
++				if(sedconverged)break;
+ 			}
+-
+-			sedcount++;
+-
+-			if(sedconverged){
+-				sedconverged=false;	
+-				/*Checking convegence on the value of the sediment head*/
+-				duf=uf_sed_sub_iter->Duplicate();_assert_(duf);
+-				uf_sed_sub_iter->Copy(duf);
+-				duf->AYPX(uf_sed,-1.0);
+-				ndu_sed=duf->Norm(NORM_TWO);
+-				delete duf;
+-				nu_sed=uf_sed_sub_iter->Norm(NORM_TWO);
+-				if (xIsNan<IssmDouble>(ndu_sed) || xIsNan<IssmDouble>(nu_sed)) _error_("convergence criterion is NaN!");
+-				if (ndu_sed==0.0 && nu_sed==0.0) nu_sed=1.0e-6; /*Hacking the case where the EPL is used but empty*/
+-				if(VerboseConvergence()) _printf0_(setw(50) << left << "   Inner Sediment Convergence criterion:" << ndu_sed/nu_sed*100 << " aiming lower than " << eps_hyd*100 << " %\n");
+-				if((ndu_sed/nu_sed)<eps_hyd){
+-					if(VerboseConvergence()) _printf0_("   # Inner sediment convergence achieve \n");
+-					sedconverged=true;
+-				}
++			/* }}} *//*End of the sediment penalization loop*/
++			sedconverged=false;
++			/*Update Elemental Mask and compute transfer*/
++			if(isefficientlayer){
++				HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
++				analysis->ElementizeEplMask(femmodel);
++				delete analysis;
++				femmodel->HydrologyTransferx();
+ 			}
++			/*Checking convegence on the value of the sediment head*/
++			duf=uf_sed_sub_iter->Duplicate();_assert_(duf);
++			uf_sed_sub_iter->Copy(duf);
++			duf->AYPX(uf_sed,-1.0);
++			ndu_sed=duf->Norm(NORM_TWO);
++			delete duf;
++			nu_sed=uf_sed_sub_iter->Norm(NORM_TWO);
++			if (xIsNan<IssmDouble>(ndu_sed) || xIsNan<IssmDouble>(nu_sed)) _error_("convergence criterion is NaN!");
++			if (ndu_sed==0.0 && nu_sed==0.0) nu_sed=1.0e-6; /*Hacking the case where the layer is empty*/
++			if(VerboseConvergence()) _printf0_(setw(50) << left << "   Inner Sediment Convergence criterion:" << ndu_sed/nu_sed*100 << " aiming lower than " << eps_hyd*100 << " %\n");
++			if((ndu_sed/nu_sed)<eps_hyd){
++				if(VerboseConvergence()) _printf0_("   # Inner sediment convergence achieve \n");
++				sedconverged=true;
++			}
+ 			delete uf_sed_sub_iter;
+-
+ 			if(sedconverged){
+-				if(isefficientlayer){
+-					/*Updating Elemental Mask*/
+-					HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
+-					analysis->ElementizeEplMask(femmodel);
+-					delete analysis;
+-					femmodel->HydrologyTransferx();
+-				}
+ 				femmodel->parameters->SetParam(sediment_kmax,HydrologySedimentKmaxEnum);
+ 				InputUpdateFromConstantx(femmodel,sedconverged,ConvergedEnum);
+ 				InputUpdateFromSolutionx(femmodel,ug_sed);
+@@ -161,24 +156,25 @@
+ 				break;
+ 			}
+ 		}
++		/* }}} *//*End of the global sediment loop*/
+ 
+-		/*Second layer*/
++		/* {{{ *//*Now dealing with the EPL in the same way*/
+ 		if(isefficientlayer){
+-			
++		
+ 			femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
++			/*updating mask*/
++			femmodel->HydrologyEPLupdateDomainx();
+ 			InputUpdateFromConstantx(femmodel,true,ResetPenaltiesEnum);
+ 			InputUpdateFromConstantx(femmodel,false,ConvergedEnum);
+ 			femmodel->parameters->SetParam(HydrologyEfficientEnum,HydrologyLayerEnum);
+-			
+-				
+-
+-			/*Iteration on the EPL layer*/
++		
+ 			eplconverged = false;
++			
+ 			for(;;){
+-				
+-				//updating mask after the computation of the epl thickness (Allow to close too thin EPL)
+-				femmodel->HydrologyEPLupdateDomainx();
+-				/*Start by retrieving the EPL head slopes and compute EPL Thickness*/
++				ug_epl_sub_iter=ug_epl->Duplicate();_assert_(ug_epl_sub_iter);
++				ug_epl->Copy(ug_epl_sub_iter);
++					
++				/* {{{ *//*Start by retrieving the EPL head slopes and compute EPL Thickness*/
+ 				if(VerboseSolution()) _printf0_("computing EPL Head slope...\n");
+ 				femmodel->SetCurrentConfiguration(L2ProjectionEPLAnalysisEnum);
+ 				femmodel->UpdateConstraintsL2ProjectionEPLx();
+@@ -187,62 +183,60 @@
+ 				femmodel->parameters->SetParam(EplHeadSlopeYEnum,InputToL2ProjectEnum);
+ 				solutionsequence_linear(femmodel);
+ 				femmodel->HydrologyEPLThicknessx();
+-				
++				//updating mask after the computation of the epl thickness (Allow to close too thin EPL)
++				femmodel->HydrologyEPLupdateDomainx();
++				/* }}} */
+ 				femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
+-			
+-				/*Updating Elemental Mask*/
++				
++				/* {{{ *//*Loop on the epl layer to deal with the penalization*/
++				for(;;){
++					SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
++					CreateNodalConstraintsx(&ys,femmodel->nodes,HydrologyDCEfficientAnalysisEnum);
++					Reduceloadx(pf,Kfs,ys); delete Kfs;
++					delete uf_epl;
++					Solverx(&uf_epl,Kff,pf,uf_epl_sub_iter,df,femmodel->parameters);
++					delete Kff; delete pf; delete df;
++					delete uf_epl_sub_iter;
++					uf_epl_sub_iter=uf_epl->Duplicate();
++					uf_epl->Copy(uf_epl_sub_iter);
++					delete ug_epl; 
++					Mergesolutionfromftogx(&ug_epl,uf_epl,ys,femmodel->nodes,femmodel->parameters); delete ys;
++					InputUpdateFromSolutionx(femmodel,ug_epl);
++					ConstraintsStatex(&constraints_converged,&num_unstable_constraints,femmodel);
++				
++					if (!eplconverged){
++						if(VerboseConvergence()) _printf0_("   # EPL unstable constraints = " << num_unstable_constraints << "\n");
++						if(num_unstable_constraints==0) eplconverged = true;
++						if (eplcount>=hydro_maxiter){
++							_error_("   maximum number of EPL iterations (" << hydro_maxiter << ") exceeded");
++						}
++					}
++					/*Add an iteration and get out of the loop if the penalisation is converged*/
++					eplcount++;
++					if(eplconverged) break;
++				}
++				/* }}} */ /*End of the EPL penalization loop*/
++
++				eplconverged=false;
++				/*Update Elemental Mask and compute transfer*/
+ 				HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
+ 				analysis->ElementizeEplMask(femmodel);
+ 				delete analysis;
+ 				femmodel->HydrologyTransferx();
+-					
+-				ug_epl_sub_iter=ug_epl->Duplicate();_assert_(ug_epl_sub_iter);
+-				ug_epl->Copy(ug_epl_sub_iter);
+-				
+-				SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
+-				CreateNodalConstraintsx(&ys,femmodel->nodes,HydrologyDCEfficientAnalysisEnum);
+-				Reduceloadx(pf,Kfs,ys); delete Kfs;
+-				delete uf_epl;
+-				Solverx(&uf_epl,Kff,pf,uf_epl_sub_iter,df,femmodel->parameters);
+-				delete Kff; delete pf; delete df;
+-				delete uf_epl_sub_iter;
+-				uf_epl_sub_iter=uf_epl->Duplicate();
+-				uf_epl->Copy(uf_epl_sub_iter);
+-				delete ug_epl; 
+-				Mergesolutionfromftogx(&ug_epl,uf_epl,ys,femmodel->nodes,femmodel->parameters); delete ys;
+-				InputUpdateFromSolutionx(femmodel,ug_epl);
+-				ConstraintsStatex(&constraints_converged,&num_unstable_constraints,femmodel);
+ 
+-
+-				if (!eplconverged){
+-					if(VerboseConvergence()) _printf0_("   # EPL unstable constraints = " << num_unstable_constraints << "\n");
+-					if(num_unstable_constraints==0) eplconverged = true;
+-					if (eplcount>=hydro_maxiter){
+-						//eplconverged =true;
+-						_error_("   maximum number of EPL iterations (" << hydro_maxiter << ") exceeded");
+-					}
+-				}
+-				eplcount++;
+-
+-				if(eplconverged){
+-					eplconverged=false;
+-				
+-					dug=ug_epl_sub_iter->Duplicate();_assert_(dug);
+-					ug_epl_sub_iter->Copy(dug);
+-					dug->AYPX(ug_epl,-1.0);
+-					ndu_epl=dug->Norm(NORM_TWO);
+-					delete dug;
+-					nu_epl=ug_epl_sub_iter->Norm(NORM_TWO);
+-					
+-					if (xIsNan<IssmDouble>(ndu_epl) || xIsNan<IssmDouble>(nu_epl)) _error_("convergence criterion is NaN!");
+-					if (ndu_epl==0.0 && nu_epl==0.0) nu_epl=1.0e-6; /*Hacking the case where the EPL is used but empty*/
+-					if(VerboseConvergence()) _printf0_(setw(50) << left << "   Inner EPL Convergence criterion:" << ndu_epl/nu_epl*100 << " aiming lower than " << eps_hyd*100 << " %\n");
+-					if((ndu_epl/nu_epl)<eps_hyd)eplconverged=true;
+-				}
++				dug=ug_epl_sub_iter->Duplicate();_assert_(dug);
++				ug_epl_sub_iter->Copy(dug);
++				dug->AYPX(ug_epl,-1.0);
++				ndu_epl=dug->Norm(NORM_TWO);
++				delete dug;
++				nu_epl=ug_epl_sub_iter->Norm(NORM_TWO);
++				if (xIsNan<IssmDouble>(ndu_epl) || xIsNan<IssmDouble>(nu_epl)) _error_("convergence criterion is NaN!");
++				if (ndu_epl==0.0 && nu_epl==0.0) nu_epl=1.0e-6; /*Hacking the case where the EPL is used but empty*/
++				if(VerboseConvergence()) _printf0_(setw(50) << left << "   Inner EPL Convergence criterion:" << ndu_epl/nu_epl*100 << " aiming lower than " << eps_hyd*100 << " %\n");
++				if((ndu_epl/nu_epl)<eps_hyd) eplconverged=true;
++			
+ 				delete ug_epl_sub_iter;
+-
+ 				if(eplconverged){
+-				
+ 					InputUpdateFromConstantx(femmodel,eplconverged,ConvergedEnum);
+ 					InputUpdateFromConstantx(femmodel,sediment_kmax,MeltingOffsetEnum);
+ 					InputUpdateFromSolutionx(femmodel,ug_epl);
+@@ -250,8 +244,9 @@
+ 				}
+ 			}
+ 		}
+-		
+-		/*System convergence check*/
++		/* }}} */ /*End of the global EPL loop*/
++
++		/* {{{ */ /*Now dealing with the convergence of the whole system*/
+ 		if(!hydroconverged){
+ 			//compute norm(du)/norm(u)
+ 			dug=ug_sed_main_iter->Duplicate(); _assert_(dug);
+@@ -263,57 +258,42 @@
+ 			delete ug_sed_main_iter;
+ 			if (xIsNan<IssmDouble>(ndu_sed) || xIsNan<IssmDouble>(nu_sed)) _error_("Sed convergence criterion is NaN!");
+ 			if (ndu_sed==0.0 && nu_sed==0.0) nu_sed=1.0e-6; /*Hacking the case where the Sediment is used but empty*/
++			dug=ug_epl_main_iter->Duplicate();_assert_(dug); 
++			ug_epl_main_iter->Copy(dug); 
++			dug->AYPX(ug_epl,-1.0);
++			ndu_epl=dug->Norm(NORM_TWO); 
++			delete dug;
++			nu_epl=ug_epl_main_iter->Norm(NORM_TWO);
++			delete ug_epl_main_iter;
++			if (xIsNan<IssmDouble>(ndu_epl) || xIsNan<IssmDouble>(nu_epl)) _error_("EPL convergence criterion is NaN!");
++			if (ndu_epl==0.0 && nu_epl==0.0) nu_epl=1.0e-6; /*Hacking the case where the EPL is used but empty*/
+ 			if (!xIsNan<IssmDouble>(eps_hyd)){
+-				if (!isefficientlayer){
+-					if ((ndu_sed/nu_sed)<eps_hyd){
+-						if(VerboseConvergence()) _printf0_(setw(50) << left << "   Converged after, " << hydrocount << " iterations \n");
+-						hydroconverged=true;
+-					}
+-					else{ 
+-						if(VerboseConvergence()) _printf0_(setw(50) << left << "   Sediment Convergence criterion:" << ndu_sed/nu_sed*100 << " > " << eps_hyd*100 << " %\n");
+-						hydroconverged=false;
+-					}
++				if ((ndu_epl/nu_epl)<eps_hyd && (ndu_sed/nu_sed)<(eps_hyd*10)){
++					if (VerboseConvergence()) _printf0_(setw(50) << left << "   Converged after, " << hydrocount << " iterations \n");
++					hydroconverged=true;
+ 				}
+-				else{
+-					dug=ug_epl_main_iter->Duplicate();_assert_(dug); 
+-					ug_epl_main_iter->Copy(dug); 
+-					dug->AYPX(ug_epl,-1.0);
+-					ndu_epl=dug->Norm(NORM_TWO); 
+-					delete dug;
+-					nu_epl=ug_epl_main_iter->Norm(NORM_TWO);
+-					delete ug_epl_main_iter;
+-					if (xIsNan<IssmDouble>(ndu_epl) || xIsNan<IssmDouble>(nu_epl)) _error_("EPL convergence criterion is NaN!");
+-					if (ndu_epl==0.0 && nu_epl==0.0) nu_epl=1.0e-6; /*Hacking the case where the EPL is used but empty*/
+-					if ((ndu_epl/nu_epl)<eps_hyd && (ndu_sed/nu_sed)<(eps_hyd*10)){
+-						if (VerboseConvergence()) _printf0_(setw(50) << left << "   Converged after, " << hydrocount << " iterations \n");
+-						hydroconverged=true;
+-					}
+-					else{ 
+-						if(VerboseConvergence()) _printf0_(setw(50) << left << "   Sediment Convergence criterion:" << ndu_sed/nu_sed*100 << " aiming lower than " << eps_hyd*100 << " %\n");
+-						if(VerboseConvergence()) _printf0_(setw(50) << left << "   EPL Convergence criterion:" << ndu_epl/nu_epl*100 << " aiming lower than " << eps_hyd*100 << " %\n");
+-						hydroconverged=false;
+-					}
++				else{ 
++					if(VerboseConvergence()) _printf0_(setw(50) << left << "   Sediment Convergence criterion:" << ndu_sed/nu_sed*100 << " aiming lower than " << eps_hyd*100 << " %\n");
++					if(VerboseConvergence()) _printf0_(setw(50) << left << "   EPL Convergence criterion:" << ndu_epl/nu_epl*100 << " aiming lower than " << eps_hyd*100 << " %\n");
++					hydroconverged=false;
+ 				}
+ 			}
+ 			else _printf0_(setw(50) << left << "   Convergence criterion:" << ndu_sed/nu_sed*100 << " %\n");
+ 			if (hydrocount>=hydro_maxiter){
+-					/*Hacking to get the results of non converged runs*/
+-					//hydroconverged = true;
+-					_error_("   maximum number for hydrological global iterations (" << hydro_maxiter << ") exceeded");
++				_error_("   maximum number for hydrological global iterations (" << hydro_maxiter << ") exceeded");
+ 			}
+ 		}
+ 		hydrocount++;
+ 		if(hydroconverged)break;
+-}
+-	
++	}
++	/* }}} */
+ 	InputUpdateFromSolutionx(femmodel,ug_sed);
+ 	if(isefficientlayer)InputUpdateFromSolutionx(femmodel,ug_epl);
+-
+ 	/*Free ressources: */
+ 	delete ug_epl;
+ 	delete ug_sed;
+ 	delete uf_sed;
+ 	delete uf_epl;
+ 	delete uf_epl_sub_iter;
+-
++	
+ }
Index: issm/oecreview/Archive/16554-17801/ISSM-17024-17025.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17024-17025.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17024-17025.diff	(revision 17802)
@@ -0,0 +1,8 @@
+Index: ../trunk-jpl/test/Archives/Archive333.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive335.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17025-17026.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17025-17026.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17025-17026.diff	(revision 17802)
@@ -0,0 +1,58 @@
+Index: ../trunk-jpl/src/m/shp/Shp2Exp.m
+===================================================================
+--- ../trunk-jpl/src/m/shp/Shp2Exp.m	(revision 17025)
++++ ../trunk-jpl/src/m/shp/Shp2Exp.m	(revision 17026)
+@@ -14,29 +14,36 @@
+ 	end
+ 	shp=shaperead(shapefilename);
+ 
+-	exp=struct([]);
++	expstruct=struct([]);
+ 	for i=1:length(shp),
+ 		if strcmpi(shp(i).Geometry,'Polygon'),
+ 			x=shp(i).X; y=shp(i).Y;
+ 			ids=find(isnan(x));
+ 			x(ids)=[]; y(ids)=[];
+-
+-			exp(end+1).x=x;
+-			exp(end).y=y;
+-			exp(end).nods=length(x);
+-			exp(end).density=1;
+-			exp(end).closed=1;
+-			exp(end).name=num2str(shp(i).id);
++			expstruct(end+1).x=x;
++			expstruct(end).y=y;
++			expstruct(end).nods=length(x);
++			expstruct(end).density=1;
++			expstruct(end).closed=1;
++			expstruct(end).name=num2str(shp(i).id);
+ 		elseif strcmpi(shp(i).Geometry,'Point'),
+-				x=shp(i).X; y=shp(i).Y;
+-
+-				exp(end+1).x=x;
+-				exp(end).y=y;
+-				exp(end).nods=length(x);
+-				exp(end).density=1;
+-				exp(end).closed=1;
+-				%exp(end).name=num2str(shp(i).id);
++			x=shp(i).X; y=shp(i).Y;
++			expstruct(end+1).x=x;
++			expstruct(end).y=y;
++			expstruct(end).nods=length(x);
++			expstruct(end).density=1;
++			expstruct(end).closed=1;
++			%exp(end).name=num2str(shp(i).id);
++		elseif strcmpi(shp(i).Geometry,'Line'),
++			x=shp(i).X; y=shp(i).Y;
++			expstruct(end+1).x=x;
++			expstruct(end).y=y;
++			expstruct.x(end)=x(1);
++			expstruct.y(end)=y(1);
++			expstruct(end).nods=length(x);
++			expstruct(end).density=1;
++			expstruct(end).closed=1;
+ 		end
+ 	end
+ 
+-	expwrite(exp,expfilename);
++	expwrite(expstruct,expfilename);
Index: issm/oecreview/Archive/16554-17801/ISSM-17026-17027.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17026-17027.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17026-17027.diff	(revision 17802)
@@ -0,0 +1,388 @@
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17026)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17027)
+@@ -245,7 +245,7 @@
+ 	if(stabilization==2) diameter=element->MinEdgeLength(xyz_list);
+ 
+ 	/*Enthalpy diffusion parameter*/
+-	IssmDouble kappa=this->EnthalpyDiffusionParameterVolume(element,EnthalpyPicardEnum); _assert_(kappa>0.);
++	IssmDouble kappa=this->EnthalpyDiffusionParameterVolume(element,EnthalpyPicardEnum); _assert_(kappa>=0.);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	Gauss* gauss=element->NewGauss(2);
+@@ -442,7 +442,7 @@
+ 	if(reCast<bool,IssmDouble>(dt)){enthalpy_input = element->GetInput(EnthalpyEnum); _assert_(enthalpy_input);}
+ 	if(stabilization==2){
+ 		diameter=element->MinEdgeLength(xyz_list);
+-		kappa=this->EnthalpyDiffusionParameterVolume(element,EnthalpyPicardEnum); _assert_(kappa>0.);
++		kappa=this->EnthalpyDiffusionParameterVolume(element,EnthalpyPicardEnum); _assert_(kappa>=0.);
+ 	}
+ 
+ 	/* Start  looping on the number of gaussian points: */
+@@ -828,12 +828,6 @@
+ 		ComputeBasalMeltingrate(element);
+ 	}
+ 
+-	/*drain excess water fraction: */
+-	//for(int i=0;i<femmodel->elements->Size();i++){
+-	//	element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+-	//	element->DrainWaterfraction();
+-	//}
+-
+ 	/*Update basal dirichlet BCs for enthalpy: */
+ 	for(int i=0;i<femmodel->elements->Size();i++){
+ 		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+@@ -841,11 +835,6 @@
+ 	}
+ }/*}}}*/
+ 
+-
+-
+-
+-
+-
+ void EnthalpyAnalysis::ComputeBasalMeltingrate(Element* element){/*{{{*/
+ 	/*Calculate the basal melt rates of the enthalpy model after Aschwanden 2012*/
+ 	/* melting rate is positive when melting, negative when refreezing*/
+@@ -877,7 +866,7 @@
+ 	Input* vx_input               = element->GetInput(VxEnum);                          _assert_(vx_input);
+ 	Input* vy_input               = element->GetInput(VyEnum);                          _assert_(vy_input);
+ 	Input* vz_input               = element->GetInput(VzEnum);                          _assert_(vz_input);
+-	IssmDouble kappa=EnthalpyDiffusionParameterVolume(element,EnthalpyEnum);     _assert_(kappa>0.);
++	IssmDouble kappa=EnthalpyDiffusionParameterVolume(element,EnthalpyEnum);     _assert_(kappa>=0.);
+ 	element->NormalBase(&normal_base[0],xyz_list_base);
+ 	element->VerticalSegmentIndices(&pairindices,&numsegments);
+ 	IssmDouble* meltingrate_enthalpy = xNew<IssmDouble>(numsegments);
+@@ -989,7 +978,7 @@
+ 		else{
+ 			basalmeltingrate[vertexdown]=meltingrate_enthalpy[is];
+ 			watercolumn[vertexdown]+=meltingrate_enthalpy[is];
+-		}		
++		}	
+ 		_assert_(watercolumn[vertexdown]>=0.);
+ 	}
+ 
+@@ -1001,14 +990,15 @@
+ 	/*Clean up and return*/
+ 	delete gauss;
+ 	delete friction;
+-  	xDelete<IssmDouble>(enthalpy);
+-  	xDelete<IssmDouble>(pressure);
+-  	xDelete<IssmDouble>(watercolumn);
+-  	xDelete<IssmDouble>(basalmeltingrate);
++	xDelete<IssmDouble>(enthalpy);
++	xDelete<IssmDouble>(pressure);
++	xDelete<IssmDouble>(watercolumn);
++	xDelete<IssmDouble>(basalmeltingrate);
+ 	xDelete<IssmDouble>(meltingrate_enthalpy);
+ 	xDelete<IssmDouble>(heating);
+ 	xDelete<IssmDouble>(drainrate_column);
+ 	xDelete<IssmDouble>(drainrate_element);
++	xDelete<IssmDouble>(xyz_list);
+ }/*}}}*/
+ 
+ void EnthalpyAnalysis::DrainWaterfraction(Element* element, IssmDouble* pdrainrate_element){/*{{{*/
+@@ -1069,85 +1059,75 @@
+ 	xDelete<IssmDouble>(deltawaterfractions);
+ }/*}}}*/
+ 
+-
+-
+-
+-
+ void EnthalpyAnalysis::UpdateBasalConstraints(Element* element){/*{{{*/
+ 
+-	/* /\*Intermediary*\/ */
+-	/* bool        isdynamicbasalspc,setspc; */
+-	/* int         numindices, numindicesup; */
+-	/* IssmDouble  pressure, pressureup; */
+-	/* IssmDouble  h_pmp, enthalpy, enthalpyup; */
+-	/* IssmDouble  watercolumn; */
+-	/* int        *indices = NULL, *indicesup = NULL; */
++	/*Intermediary*/
++	bool        isdynamicbasalspc,setspc;
++	int         numindices, numindicesup;
++	IssmDouble  pressure, pressureup;
++	IssmDouble  h_pmp, enthalpy, enthalpyup;
++	IssmDouble  watercolumn;
++	int        *indices = NULL, *indicesup = NULL;
++	Node*       node = NULL;
+ 	
+-	/* /\* Only update Constraints at the base of grounded ice*\/ */
+-	/* if(!IsOnBed() || IsFloating()) return; */
++	/* Only update Constraints at the base of grounded ice*/
++	if(!(element->IsOnBed()) || element->IsFloating()) return;
+ 
+-	/* /\*Check wether dynamic basal boundary conditions are activated *\/ */
+-	/* element->FindParam(&isdynamicbasalspc,ThermalIsdynamicbasalspcEnum); */
+-	/* if(!isdynamicbasalspc) return; */
++	/*Check wether dynamic basal boundary conditions are activated */
++	element->FindParam(&isdynamicbasalspc,ThermalIsdynamicbasalspcEnum);
++	if(!isdynamicbasalspc) return;
+ 
+-	/* /\*Fetch indices of basal & surface nodes for this finite element*\/ */
+-	/* // BasalNodeIndices(&numindices,&indices,this->element_type); */
+-	/* // SurfaceNodeIndices(&numindicesup,&indicesup,this->element_type); */
+-	/* //	_assert_(numindices==numindicesup); */
++	/*Fetch indices of basal & surface nodes for this finite element*/
++	Penta *penta =  (Penta *) element; // TODO: add Basal-/SurfaceNodeIndices to element.h, and change this to Element*
++	penta->BasalNodeIndices(&numindices,&indices,element->GetElementType());
++	penta->SurfaceNodeIndices(&numindicesup,&indicesup,element->GetElementType());
++	_assert_(numindices==numindicesup);
+ 
+-	/* /\*Get parameters and inputs: *\/ */
+-	/* Input* pressure_input=inputs->GetInput(PressureEnum); _assert_(pressure_input); */
+-	/* Input* enthalpy_input=inputs->GetInput(EnthalpyEnum); _assert_(enthalpy_input); */
+-	/* Input* watercolumn_input=inputs->GetInput(WatercolumnEnum); _assert_(watercolumn_input); */
++	/*Get parameters and inputs: */
++	Input* pressure_input=element->GetInput(PressureEnum); _assert_(pressure_input);
++	Input* enthalpy_input=element->GetInput(EnthalpyEnum); _assert_(enthalpy_input);
++	Input* watercolumn_input=element->GetInput(WatercolumnEnum); _assert_(watercolumn_input);
+ 
+-	/* /\*if there is a temperate layer of zero thickness, set spc enthalpy=h_pmp at that node*\/ */
+-	/* GaussPenta* gauss=new GaussPenta(); */
+-	/* GaussPenta* gaussup=new GaussPenta(); */
+-	/* for(int i=0;i<numindices;i++){ */
+-	/* 	gauss->GaussNode(this->element_type,indices[i]); */
+-	/* 	gaussup->GaussNode(this->element_type,indicesup[i]); */
++	/*if there is a temperate layer of zero thickness, set spc enthalpy=h_pmp at that node*/
++	GaussPenta* gauss=new GaussPenta();
++	GaussPenta* gaussup=new GaussPenta();
++	for(int i=0;i<numindices;i++){
++		gauss->GaussNode(element->GetElementType(),indices[i]);
++		gaussup->GaussNode(element->GetElementType(),indicesup[i]);
+ 
+-	/* 	/\*Check wether there is a temperate layer at the base or not *\/ */
+-	/* 	/\*check if node is temperate, if not, continue*\/ */
+-	/* 	enthalpy_input->GetInputValue(&enthalpy, gauss); */
+-	/* 	pressure_input->GetInputValue(&pressure, gauss); */
+-	/* 	watercolumn_input->GetInputValue(&watercolumn,gauss); */
+-	/* 	setspc = false; */
+-	/* 	// TODO: add case H<Hpmp && watercolumn>0.; */
+-	/* 	if (enthalpy>=element->PureIceEnthalpy(pressure)){ */
+-	/* 		/\*check if upper node is temperate, too. */
+-	/* 			if yes, then we have a temperate layer of positive thickness and reset the spc. */
+-	/* 			if not, apply dirichlet BC.*\/ */
+-	/* 		enthalpy_input->GetInputValue(&enthalpyup, gaussup); */
+-	/* 		pressure_input->GetInputValue(&pressureup, gaussup); */
+-	/* 		setspc=((enthalpyup<element->PureIceEnthalpy(pressureup)) && (watercolumn>=0.))?true:false; */
+-	/* 	} */
++		/*Check wether there is a temperate layer at the base or not */
++		/*check if node is temperate, else continue*/
++		enthalpy_input->GetInputValue(&enthalpy, gauss);
++		pressure_input->GetInputValue(&pressure, gauss);
++		watercolumn_input->GetInputValue(&watercolumn,gauss);
++		h_pmp=PureIceEnthalpy(element,pressure);
++		if (enthalpy>=h_pmp){
++			/*check if upper node is temperate, too.
++				if yes, then we have a temperate layer of positive thickness and reset the spc.
++				if not, apply dirichlet BC.*/
++			enthalpy_input->GetInputValue(&enthalpyup, gaussup);
++			pressure_input->GetInputValue(&pressureup, gaussup);
++			setspc=((enthalpyup<PureIceEnthalpy(element,pressureup)) && (watercolumn>=0.))?true:false;
++		}
++		else if(watercolumn>0.) // case H<Hpmp && watercolumn>0.
++			setspc=true;
++		else
++			setspc = false;
+ 
+-	/* 	if (setspc) { */
+-	/* 		/\*Calculate enthalpy at pressure melting point *\/ */
+-	/* 		h_pmp=matpar->PureIceEnthalpy(pressure); */
+-	/* 		/\*Apply Dirichlet condition (dof = 0 here, since there is only one degree of freedom per node)*\/ */
+-	/* 		//element->ApplyConstraint(indices[i],1,h_pmp); */
+-	/* 		//nodes[indices[i]]->ApplyConstraint(1,h_pmp); */
+-	/* 	} */
+-	/* 	else { */
+-	/* 		/\*remove spc*\/ */
+-	/* 		//element->RemoveConstraint(indices[i],0); */
+-	/* 		//nodes[indices[i]]->DofInFSet(0); */
+-	/* 	} */
+-	/* } */
++		node=element->GetNode(indices[i]);
++		if (setspc) 
++			node->ApplyConstraint(1,h_pmp); /*apply spc*/ //nodes[indices[i]]->ApplyConstraint(1,h_pmp);
++		else			
++			node->DofInFSet(0); /*remove spc*/ //nodes[indices[i]]->DofInFSet(0);
++	}
+ 
+-	/* /\*Free ressources:*\/ */
+-	/* xDelete<int>(indices); */
+-	/* xDelete<int>(indicesup); */
+-	/* delete gauss; */
+-	/* delete gaussup; */
++	/*Free ressources:*/
++	xDelete<int>(indices);
++	xDelete<int>(indicesup);
++	delete gauss;
++	delete gaussup;
+ }/*}}}*/
+ 
+-
+-
+-
+-
+ /*Intermediaries*/
+ IssmDouble EnthalpyAnalysis::EnthalpyDiffusionParameter(Element* element,IssmDouble enthalpy,IssmDouble pressure){/*{{{*/
+ 
+@@ -1166,10 +1146,9 @@
+ 
+ 	int         iv;
+ 	IssmDouble  lambda;                   /* fraction of cold ice    */
+-	IssmDouble  kappa   ,kappa_c,kappa_t; /* enthalpy conductivities */
++	IssmDouble  kappa,kappa_c,kappa_t; /* enthalpy conductivities */
+ 	IssmDouble  Hc,Ht;
+ 
+-
+ 	/*Get pressures and enthalpies on vertices*/
+ 	int         numvertices = element->GetNumberOfVertices();
+ 	IssmDouble* pressures   = xNew<IssmDouble>(numvertices);
+@@ -1208,8 +1187,8 @@
+ 		}
+ 		_assert_((Hc+Ht)>0.);
+ 		lambda = Hc/(Hc+Ht);
+-		kappa  = 1./(lambda/kappa_c + (1.-lambda)/kappa_t);
+-	}
++		kappa  = kappa_c*kappa_t/(lambda*kappa_t+(1.-lambda)*kappa_c); // ==(lambda/kappa_c + (1.-lambda)/kappa_t)^-1
++	}	
+ 
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(PIE);
+@@ -1217,8 +1196,7 @@
+ 	xDelete<IssmDouble>(pressures);
+ 	xDelete<IssmDouble>(enthalpies);
+ 	return kappa;
+-}
+-/*}}}*/
++}/*}}}*/
+ IssmDouble EnthalpyAnalysis::PureIceEnthalpy(Element* element,IssmDouble pressure){/*{{{*/
+ 
+ 	IssmDouble heatcapacity         = element->GetMaterialParameter(MaterialsHeatcapacityEnum);
+Index: ../trunk-jpl/src/c/shared/Elements/LliboutryDuval.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Elements/LliboutryDuval.cpp	(revision 17026)
++++ ../trunk-jpl/src/c/shared/Elements/LliboutryDuval.cpp	(revision 17027)
+@@ -52,7 +52,7 @@
+   H_sp=heatcapacity*(Tpmp - referencetemperature);
+   if (enthalpy < H_sp){
+     Tstar = referencetemperature + enthalpy/heatcapacity - betaCC*pressure;	
+-    waterfraction = 0;
++    waterfraction = 0.;
+   }
+   else{
+     Tstar=Tpmp;
+@@ -62,16 +62,15 @@
+   }
+ 
+   /*Get A*/
+-  if(Tstar<263.15){
+-    A=3.61*pow(10.,-13.) * exp(  -6.*pow(10.,4.)/(R*Tstar));
++  if(Tstar<=263.15){
++    A=3.61e-13 * exp(  -6.e+4/(R*Tstar));
+   }
+   else{
+-    A=1.73*pow(10.,  3.) * exp(-13.9*pow(10.,4.)/(R*Tstar));
++    A=1.73e3   * exp(-13.9e+4/(R*Tstar));
+   }
+-  A*=(1 + 181.25*waterfraction);
++  A*=(1. + 181.25*waterfraction);
+ 
+   /*Convert to B*/
+-  _assert_(n>0);
+   B=pow(A,-1./n);
+ 
+   return B;
+Index: ../trunk-jpl/src/c/cores/thermal_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/thermal_core.cpp	(revision 17026)
++++ ../trunk-jpl/src/c/cores/thermal_core.cpp	(revision 17027)
+@@ -5,6 +5,7 @@
+ #include "./cores.h"
+ #include "../toolkits/toolkits.h"
+ #include "../classes/classes.h"
++#include "../analyses/analyses.h"
+ #include "../shared/shared.h"
+ #include "../modules/modules.h"
+ #include "../solutionsequences/solutionsequences.h"
+@@ -16,6 +17,7 @@
+ 	bool   dakota_analysis;
+ 	int    solution_type,numoutputs;
+ 	char** requested_outputs = NULL;
++	EnthalpyAnalysis * enthalpy_analysis = NULL;
+ 
+ 	/*first recover parameters common to all solutions*/
+ 	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
+@@ -46,7 +48,9 @@
+ 		InputDuplicatex(femmodel,EnthalpyEnum,EnthalpyPicardEnum);
+ 
+ 		/*Post process*/
+-		if(solution_type!=SteadystateSolutionEnum) PostprocessingEnthalpyx(femmodel);
++		enthalpy_analysis = new EnthalpyAnalysis();
++		enthalpy_analysis->PostProcessing(femmodel);
++		delete enthalpy_analysis;
+ 	}
+ 	else{
+ 		if(VerboseSolution()) _printf0_("   computing temperatures\n");
+@@ -65,4 +69,5 @@
+ 
+ 	/*Free ressources:*/	
+ 	if(numoutputs){for(int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs);}
++
+ }
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17026)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17027)
+@@ -167,6 +167,7 @@
+ 		virtual IssmDouble GetZcoord(Gauss* gauss)=0;
+ 		virtual IssmDouble GetYcoord(Gauss* gauss)=0;
+ 		virtual void   GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype)=0;
++		virtual int    GetElementType(void)=0;
+ 
+ 		virtual IssmDouble SurfaceArea(void)=0;
+ 		virtual void   InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17026)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17027)
+@@ -140,6 +140,7 @@
+ 		Node*       GetNode(int node_number){_error_("Not implemented");};
+ 		IssmDouble  GetYcoord(Gauss* gauss){_error_("Not implemented");};
+ 		IssmDouble  GetZcoord(Gauss* gauss){_error_("not implemented yet");};
++		int         GetElementType(void){_error_("not implemented yet");};
+ 		Gauss*      NewGauss(void){_error_("not implemented yet");};
+ 		Gauss*      NewGauss(int order);
+       Gauss*      NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/m/materials/arrhenius.m
+===================================================================
+--- ../trunk-jpl/src/m/materials/arrhenius.m	(revision 17026)
++++ ../trunk-jpl/src/m/materials/arrhenius.m	(revision 17027)
+@@ -30,11 +30,15 @@
+     error('waterfraction is negative');
+ end
+ 
+-wf_max=.1;
+-if(waterfraction>wf_max)
++wf_max=1.;
++if(any(waterfraction>wf_max))
+     error(['waterfraction exceeds permitted maximum of ' num2str(wf_max) '.']);
+ end
+ 
++%limit waterfraction to 1%
++pos1p=find(waterfraction>0.01);
++waterfraction(pos1p)=0.01;
++
+ pos=find((temperature<TMeltingPoint(pressure)) & (waterfraction>0)); % cold, wet ice
+ if (length(pos)>0)
+     error('cold ice with positive waterfraction detected.');
+@@ -70,6 +74,9 @@
+     function A=GetA(T, w)
+         Qa=GetQa(T); 
+         A0=GetA0(T);
++        if(w>0.01)
++           w=0.01;
++        end
+         A=A0.*exp(-Qa./(R*T)).*(1+181.25*w);        
+     end
+     
Index: issm/oecreview/Archive/16554-17801/ISSM-17027-17028.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17027-17028.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17027-17028.diff	(revision 17802)
@@ -0,0 +1,386 @@
+Index: ../trunk-jpl/src/c/modules/modules.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/modules.h	(revision 17027)
++++ ../trunk-jpl/src/c/modules/modules.h	(revision 17028)
+@@ -75,7 +75,6 @@
+ #include "./ConstraintsStatex/ConstraintsStatex.h"
+ #include "./PointCloudFindNeighborsx/PointCloudFindNeighborsx.h"
+ #include "./PositiveDegreeDayx/PositiveDegreeDayx.h"
+-#include "./PostprocessingEnthalpyx/PostprocessingEnthalpyx.h"
+ #include "./PropagateFlagsFromConnectivityx/PropagateFlagsFromConnectivityx.h"
+ #include "./Reduceloadx/Reduceloadx.h"
+ #include "./Reducevectorgtosx/Reducevectorgtosx.h"
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17027)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17028)
+@@ -390,9 +390,7 @@
+ 
+ #}}}
+ #Thermal sources  {{{
+-thermal_sources = ./modules/PostprocessingEnthalpyx/PostprocessingEnthalpyx.h\
+-					   ./modules/PostprocessingEnthalpyx/PostprocessingEnthalpyx.cpp\
+-						./analyses/ThermalAnalysis.h\
++thermal_sources = ./analyses/ThermalAnalysis.h\
+ 						./analyses/ThermalAnalysis.cpp\
+ 						./analyses/EnthalpyAnalysis.h\
+ 						./analyses/EnthalpyAnalysis.cpp\
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17027)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17028)
+@@ -270,12 +270,6 @@
+ 		virtual void UpdateConstraintsExtrudeFromBase(void)=0;
+ 		virtual void UpdateConstraintsExtrudeFromTop(void)=0;
+ 
+-		#ifdef _HAVE_THERMAL_
+-		virtual void UpdateBasalConstraintsEnthalpy(void)=0;
+-		virtual void ComputeBasalMeltingrate(void)=0;
+-		virtual void DrainWaterfraction(IssmDouble* drainrate_element)=0;
+-		#endif
+-
+ 		#ifdef _HAVE_HYDROLOGY_
+ 		virtual void GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index)=0;
+ 		virtual void GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17027)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17028)
+@@ -265,11 +265,6 @@
+ 
+ 		void UpdateConstraintsExtrudeFromBase(void);
+ 		void UpdateConstraintsExtrudeFromTop(void);
+-		#ifdef _HAVE_THERMAL_
+-		void UpdateBasalConstraintsEnthalpy(void){_error_("not implemented yet");};
+-		void ComputeBasalMeltingrate(void){_error_("not implemented yet");};
+-		void DrainWaterfraction(IssmDouble* drainrate_element){_error_("not implemented yet");};
+-		#endif
+ 
+ 		#ifdef _HAVE_HYDROLOGY_
+ 		ElementMatrix* CreateEPLDomainMassMatrix(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17027)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17028)
+@@ -3281,289 +3281,6 @@
+ /*}}}*/
+ #endif
+ 
+-#ifdef _HAVE_THERMAL_
+-/*FUNCTION Penta::UpdateBasalConstraintsEnthalpy{{{*/
+-void  Penta::UpdateBasalConstraintsEnthalpy(void){
+-
+-	/*Intermediary*/
+-	bool        isenthalpy,isdynamicbasalspc,setspc;
+-	int         numindices, numindicesup;
+-	IssmDouble  pressure, pressureup;
+-	IssmDouble  h_pmp, enthalpy, enthalpyup;
+-	IssmDouble  watercolumn;
+-	int        *indices = NULL, *indicesup = NULL;
+-
+-	/* Only update Constraints at the base of grounded ice*/
+-	if(!IsOnBed() || IsFloating()) return;
+-
+-	/*Check wether dynamic basal boundary conditions are activated */
+-	parameters->FindParam(&isenthalpy,ThermalIsenthalpyEnum);
+-	if(!isenthalpy) return;
+-	parameters->FindParam(&isdynamicbasalspc,ThermalIsdynamicbasalspcEnum);
+-	if(!isdynamicbasalspc) return;
+-
+-	/*Fetch indices of basal & surface nodes for this finite element*/
+-	BasalNodeIndices(&numindices,&indices,this->element_type);
+-	SurfaceNodeIndices(&numindicesup,&indicesup,this->element_type);
+-	_assert_(numindices==numindicesup);
+-
+-	/*Get parameters and inputs: */
+-	Input* pressure_input=inputs->GetInput(PressureEnum); _assert_(pressure_input);
+-	Input* enthalpy_input=inputs->GetInput(EnthalpyEnum); _assert_(enthalpy_input);
+-	Input* watercolumn_input=inputs->GetInput(WatercolumnEnum); //_assert_(watercolumn_input);
+-
+-	/*if there is a temperate layer of zero thickness, set spc enthalpy=h_pmp at that node*/
+-	GaussPenta* gauss=new GaussPenta();
+-	GaussPenta* gaussup=new GaussPenta();
+-	for(int i=0;i<numindices;i++){
+-		gauss->GaussNode(this->element_type,indices[i]);
+-		gaussup->GaussNode(this->element_type,indicesup[i]); 
+-
+-		/*Check wether there is a temperate layer at the base or not */
+-		/*check if node is temperate, if not, continue*/
+-		enthalpy_input->GetInputValue(&enthalpy, gauss);
+-		pressure_input->GetInputValue(&pressure, gauss);
+-		watercolumn_input->GetInputValue(&watercolumn,gauss);
+-		setspc = false;
+-		if (enthalpy>=matpar->PureIceEnthalpy(pressure)){		
+-			/*check if upper node is temperate, too. 
+-				if yes, then we have a temperate layer of positive thickness and reset the spc. 
+-				if not, apply dirichlet BC.*/
+-			enthalpy_input->GetInputValue(&enthalpyup, gaussup);
+-			pressure_input->GetInputValue(&pressureup, gaussup);    
+-			setspc=((enthalpyup<matpar->PureIceEnthalpy(pressureup)) && (watercolumn>=0.))?true:false;
+-		}
+-
+-		if (setspc) {
+-			/*Calculate enthalpy at pressure melting point */
+-			h_pmp=matpar->PureIceEnthalpy(pressure);
+-			/*Apply Dirichlet condition (dof = 0 here, since there is only one degree of freedom per node)*/
+-			nodes[indices[i]]->ApplyConstraint(1,h_pmp);
+-		}
+-		else {
+-			/*remove spc*/
+-			nodes[indices[i]]->DofInFSet(0);
+-		}
+-	}
+-
+-	/*Free ressources:*/
+-	xDelete<int>(indices);
+-	xDelete<int>(indicesup);
+-	delete gauss;
+-	delete gaussup;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::ComputeBasalMeltingrate{{{*/
+-void Penta::ComputeBasalMeltingrate(void){
+-	/*Calculate the basal melt rates of the enthalpy model after Aschwanden 2012*/
+-	/* melting rate is positive when melting, negative when refreezing*/
+-
+-	/* Intermediaries */
+-	bool        isenthalpy, checkpositivethickness, istemperatelayer;
+-	int         i,j,iv,analysis_type;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble  xyz_list_tria[NUMVERTICES2D][3];
+-	IssmDouble  heatflux,kappa;
+-	IssmDouble  vec_heatflux[3];
+-	IssmDouble  normal_base[3], d1enthalpy[3];
+-	IssmDouble  basalmeltingrate[NUMVERTICES], watercolumn[NUMVERTICES];
+-	IssmDouble  enthalpy[NUMVERTICES],pressure[NUMVERTICES];
+-	IssmDouble  temperature, waterfraction;
+-	IssmDouble  latentheat, rho_ice;
+-	IssmDouble  basalfriction, alpha2;
+-	IssmDouble  vx[NUMVERTICES],vy[NUMVERTICES],vz[NUMVERTICES];
+-	IssmDouble  geothermalflux[NUMVERTICES];
+-	IssmDouble  dt, yts;
+-	IssmDouble  melting_overshoot,meltingrate_enthalpy[NUMVERTICES2D];
+-	IssmDouble  drainrate_element[NUMVERTICES2D],drainrate_column[NUMVERTICES2D];
+-	IssmDouble  lambda,heating[NUMVERTICES2D];
+-	Friction   *friction  = NULL;
+-	Penta      *penta = NULL;
+-
+-	/* Only compute melt rates at the base of grounded ice*/
+-	if(!IsOnBed() || IsFloating()) return;
+-
+-	/*Check wether enthalpy is activated*/
+-	parameters->FindParam(&isenthalpy,ThermalIsenthalpyEnum);
+-	if(!isenthalpy) return;
+-
+-	/*Fetch parameters and inputs */
+-	latentheat=matpar->GetLatentHeat();
+-	rho_ice=matpar->GetRhoIce();
+-	GetInputListOnVertices(&vx[0],VxEnum);
+-	GetInputListOnVertices(&vy[0],VyEnum);
+-	GetInputListOnVertices(&vz[0],VzEnum);
+-	GetInputListOnVertices(&enthalpy[0],EnthalpyEnum);
+-	GetInputListOnVertices(&pressure[0],PressureEnum);
+-	GetInputListOnVertices(&watercolumn[0],WatercolumnEnum);
+-	GetInputListOnVertices(&basalmeltingrate[0],BasalforcingsMeltingRateEnum);
+-	GetInputListOnVertices(&geothermalflux[0],BasalforcingsGeothermalfluxEnum);
+-	Input* enthalpy_input=inputs->GetInput(EnthalpyEnum); _assert_(enthalpy_input);
+-	Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+-	Input* vz_input=inputs->GetInput(VzEnum); _assert_(vz_input);
+-
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
+-
+-	/*Build friction element, needed later: */
+-	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-	friction=new Friction(this,3);
+-
+-	/******** MELTING RATES  ************************************/
+-	GaussPenta* gauss=new GaussPenta();
+-	for(iv=0;iv<NUMVERTICES2D;iv++){
+-
+-		gauss->GaussVertex(iv);
+-		checkpositivethickness=true;
+-
+-		_assert_(watercolumn[iv]>=0.);
+-
+-		/*Calculate basal meltingrate after Fig.5 of A.Aschwanden 2012*/
+-		meltingrate_enthalpy[iv]=0.;
+-		heating[iv]=0.;
+-		if((watercolumn[iv]>0.) && (enthalpy[iv]<matpar->PureIceEnthalpy(pressure[iv]))){
+-			/*ensure that no ice is at T<Tm(p), if water layer present*/
+-			enthalpy[iv]=matpar->PureIceEnthalpy(pressure[iv]); 
+-		}
+-		else if(enthalpy[iv]<matpar->PureIceEnthalpy(pressure[iv])){
+-			/*cold base: set q*n=q_geo*n+frictionheating as Neumann BC in Penta::CreatePVectorEnthalpySheet*/
+-			checkpositivethickness=false; // cold base, skip next test
+-		}
+-		else {/*we have a temperate base, go to next test*/}
+-
+-		if(checkpositivethickness){
+-			/*ok, from here on all basal ice is temperate. Check for positive thickness of layer of temperate ice. */
+-			istemperatelayer=false;
+-			if(enthalpy[iv+NUMVERTICES2D]>=matpar->PureIceEnthalpy(pressure[iv+NUMVERTICES2D])) istemperatelayer=true;
+-			if(istemperatelayer) for(i=0;i<3;i++) vec_heatflux[i]=0.; // TODO: add -k*nabla T_pmp
+-			else{
+-				enthalpy_input->GetInputDerivativeValue(&d1enthalpy[0],&xyz_list[0][0],gauss);
+-				kappa=matpar->GetEnthalpyDiffusionParameterVolume(NUMVERTICES,&enthalpy[0],&pressure[0]); _assert_(kappa>0.);
+-				for(i=0;i<3;i++) vec_heatflux[i]=-kappa*d1enthalpy[i];
+-			}
+-
+-			/*geothermal heatflux*/
+-			NormalBase(&normal_base[0],&xyz_list_tria[0][0]);
+-			heatflux=0.;
+-			for(i=0;i<3;i++) heatflux+=(vec_heatflux[i])*normal_base[i];
+-
+-			/*basal friction*/
+-			friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input);
+-			basalfriction=alpha2*(pow(vx[iv],2.0)+pow(vy[iv],2.0)+pow(vz[iv],2.0));
+-
+-			matpar->EnthalpyToThermal(&temperature, &waterfraction, enthalpy[iv],pressure[iv]);
+-			// -Mb= Fb-(q-q_geo)/((1-w)*L), cf Aschwanden 2012, eq.66
+-			heating[iv]=(heatflux+basalfriction+geothermalflux[iv]);
+-			meltingrate_enthalpy[iv]=heating[iv]/((1-waterfraction)*latentheat*rho_ice); // m/s water equivalent 
+-		}		
+-	}
+-	// enthalpy might have been changed, update
+-	this->inputs->AddInput(new PentaInput(EnthalpyEnum,enthalpy,P1Enum));
+-
+-	/******** DRAINAGE *****************************************/
+-	for(iv=0; iv<NUMVERTICES2D; iv++)	
+-		drainrate_column[iv]=0.;
+-	penta=this;
+-
+-	for(;;){
+-		for(iv=0; iv<NUMVERTICES2D; iv++)	drainrate_element[iv]=0.;
+-		penta->DrainWaterfraction(&drainrate_element[0]); // TODO: make sure every vertex is only drained once
+-		for(iv=0; iv<NUMVERTICES2D; iv++)	drainrate_column[iv]+=drainrate_element[iv];
+-
+-		if(penta->IsOnSurface()) break;
+-		penta=penta->GetUpperPenta();			
+-	}
+-	// add drained water to melting rate
+-	for(iv=0; iv<NUMVERTICES2D;iv++)
+-		meltingrate_enthalpy[iv]+=drainrate_column[iv];
+-
+-	/******** UPDATE MELTINGRATES AND WATERCOLUMN **************/
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	for(iv=0;iv<NUMVERTICES2D;iv++){
+-		if(reCast<bool,IssmDouble>(dt)){
+-			if(watercolumn[iv]+meltingrate_enthalpy[iv]*dt<0.){				
+-				melting_overshoot=watercolumn[iv]+meltingrate_enthalpy[iv]*dt;
+-				lambda=melting_overshoot/(meltingrate_enthalpy[iv]*dt); _assert_(lambda>0); _assert_(lambda<1);
+-				basalmeltingrate[iv]=(1.-lambda)*meltingrate_enthalpy[iv];
+-				watercolumn[iv]=0.;
+-				yts=365*24*60*60;
+-				enthalpy[iv]+=dt/yts*lambda*heating[iv];
+-			}
+-			else{
+-				basalmeltingrate[iv]=meltingrate_enthalpy[iv];
+-				watercolumn[iv]+=dt*meltingrate_enthalpy[iv]; 
+-			}
+-		}
+-		else{
+-			basalmeltingrate[iv]=meltingrate_enthalpy[iv];
+-			watercolumn[iv]+=meltingrate_enthalpy[iv];
+-		}	  
+-		
+-		_assert_(watercolumn[iv]>=0.);
+-	}
+-
+-	/*feed updated variables back into model*/
+-	this->inputs->AddInput(new PentaInput(EnthalpyEnum,enthalpy,P1Enum));
+-	this->inputs->AddInput(new PentaInput(WatercolumnEnum,watercolumn,P1Enum));
+-	this->inputs->AddInput(new PentaInput(BasalforcingsMeltingRateEnum,basalmeltingrate,P1Enum));
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	delete friction;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::DrainWaterfraction{{{*/
+-void Penta::DrainWaterfraction(IssmDouble* drainrate_element){
+-
+-  /*Intermediaries*/
+-	bool isenthalpy;
+-	int iv, index0;
+-	IssmDouble waterfraction[NUMVERTICES], temperature[NUMVERTICES];
+-	IssmDouble dw[NUMVERTICES];
+-	IssmDouble enthalpy[NUMVERTICES], pressure[NUMVERTICES]; 
+-	IssmDouble dt, height_element;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble rho_water, rho_ice;
+-
+-	/*Check wether enthalpy is activated*/
+-	parameters->FindParam(&isenthalpy,ThermalIsenthalpyEnum);
+-	if(!isenthalpy) return;       
+-	
+-	rho_ice=matpar->GetRhoIce();
+-	rho_water=matpar->GetRhoFreshwater();
+-
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	this->GetInputListOnVertices(&enthalpy[0],EnthalpyEnum);
+-	this->GetInputListOnVertices(&pressure[0],PressureEnum);
+-
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+-	for(iv=0;iv<NUMVERTICES;iv++){ 
+-		matpar->EnthalpyToThermal(&temperature[iv],&waterfraction[iv], enthalpy[iv],pressure[iv]); 
+-		dw[iv]=DrainageFunctionWaterfraction(waterfraction[iv], dt);
+-	}
+-	
+-	/*drain waterfraction, feed updated variables back into model*/
+-	for(iv=0;iv<NUMVERTICES;iv++){
+-		if(reCast<bool,IssmDouble>(dt))
+-			waterfraction[iv]-=dw[iv]*dt;
+-		else
+-			waterfraction[iv]-=dw[iv];
+-		matpar->ThermalToEnthalpy(&enthalpy[iv], temperature[iv], waterfraction[iv], pressure[iv]);
+-	}
+-	this->inputs->AddInput(new PentaInput(EnthalpyEnum,enthalpy,P1Enum));
+-	this->inputs->AddInput(new PentaInput(WaterfractionEnum,waterfraction,P1Enum));
+-
+-	/*return meltwater column equivalent to drained water*/
+-	for(iv=0;iv<NUMVERTICES2D;iv++){
+-		index0=(iv+NUMVERTICES2D);
+-		height_element=fabs(xyz_list[index0][2]-xyz_list[iv][2]);
+-		drainrate_element[iv]=(dw[iv]+dw[index0])/2.*rho_water/rho_ice*height_element;
+-	}
+-}
+-/*}}}*/
+-#endif
+-
+ #ifdef _HAVE_CONTROL_
+ /*FUNCTION Penta::ControlInputGetGradient{{{*/
+ void Penta::ControlInputGetGradient(Vector<IssmDouble>* gradient,int enum_type,int control_index){
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17027)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17028)
+@@ -268,11 +268,6 @@
+ 
+ 		void           UpdateConstraintsExtrudeFromBase(void){_error_("not implemented yet");};
+ 		void           UpdateConstraintsExtrudeFromTop(void){_error_("not implemented yet");};
+-		#ifdef _HAVE_THERMAL_
+-		void           UpdateBasalConstraintsEnthalpy(void);
+-		void           ComputeBasalMeltingrate(void);
+-		void           DrainWaterfraction(IssmDouble* drainrate_element);
+-		#endif
+ 		/*}}}*/
+ };
+ #endif  /* _PENTA_H */
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17027)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17028)
+@@ -158,11 +158,6 @@
+ 		bool        IsZeroLevelset(int levelset_enum){_error_("not implemented");};
+ 		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented");};
+ 
+-		#ifdef _HAVE_THERMAL_
+-		void UpdateBasalConstraintsEnthalpy(void){_error_("not implemented yet");};
+-		void ComputeBasalMeltingrate(void){_error_("not implemented yet");};
+-		void DrainWaterfraction(IssmDouble* drainrate_element){_error_("not implemented yet");};
+-		#endif
+ 		#ifdef _HAVE_HYDROLOGY_
+ 		void    GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode){_error_("not implemented yet");};
+ 		void    GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-17028-17029.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17028-17029.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17028-17029.diff	(revision 17802)
@@ -0,0 +1,43 @@
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17028)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17029)
+@@ -183,7 +183,7 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
+-void           EnthalpyAnalysis::Core(FemModel* femmodel){/*{{{*/
++void EnthalpyAnalysis::Core(FemModel* femmodel){/*{{{*/
+ 	_error_("not implemented");
+ }/*}}}*/
+ ElementVector* EnthalpyAnalysis::CreateDVector(Element* element){/*{{{*/
+@@ -820,7 +820,10 @@
+ 
+ 
+ /*Modules*/
+-void EnthalpyAnalysis::PostProcessing(FemModel* femmodel){/*{{{*/
++/*{{{*/
++void EnthalpyAnalysis::PostProcessing(FemModel* femmodel){
++	/*Intermediaries*/
++	int solution_type;
+ 
+ 	/*Compute basal melting rates: */
+ 	for(int i=0;i<femmodel->elements->Size();i++){
+@@ -828,10 +831,13 @@
+ 		ComputeBasalMeltingrate(element);
+ 	}
+ 
+-	/*Update basal dirichlet BCs for enthalpy: */
+-	for(int i=0;i<femmodel->elements->Size();i++){
+-		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+-		UpdateBasalConstraints(element);
++	/*Update basal dirichlet BCs for enthalpy in transient runs: */
++	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
++	if(solution_type==TransientSolutionEnum){
++		for(int i=0;i<femmodel->elements->Size();i++){
++			Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++			UpdateBasalConstraints(element);
++		}
+ 	}
+ }/*}}}*/
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17029-17030.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17029-17030.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17029-17030.diff	(revision 17802)
@@ -0,0 +1,409 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17029)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17030)
+@@ -57,6 +57,8 @@
+ 	iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
+ 	iomodel->FetchDataToInput(elements,EplHeadEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcEplInitialThicknessEnum);
++
++	//	iomodel->FetchDataToInput(elements,HydrologydcMaskEplactiveNodeEnum);
+ 	
+ 	elements->InputDuplicate(HydrologydcEplInitialThicknessEnum,HydrologydcEplThicknessEnum);
+ 
+@@ -97,21 +99,26 @@
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
+-void           HydrologyDCEfficientAnalysis::Core(FemModel* femmodel){/*{{{*/
++void HydrologyDCEfficientAnalysis::Core(FemModel* femmodel){/*{{{*/
+ 	_error_("not implemented");
+ }/*}}}*/
++
+ ElementVector* HydrologyDCEfficientAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+ }/*}}}*/
++
+ ElementMatrix* HydrologyDCEfficientAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
++
+ ElementMatrix* HydrologyDCEfficientAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	int      meshtype;
++	bool     active_element;
+ 	Element* basalelement;
++	Input*   active_element_input=NULL;
+ 
+ 	/*Get basal element*/
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+@@ -126,9 +133,13 @@
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
++	/* active_element_input=basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input); */
++	/* active_element_input->GetInputValue(&active_element); */
++
+ 	/*Check that all nodes are active, else return empty matrix*/
+ 	if(!basalelement->AllActive()) {
+-		if(meshtype!=Mesh2DhorizontalEnum){
++		//if(!active_element){
++	if(meshtype!=Mesh2DhorizontalEnum){
+ 			basalelement->DeleteMaterials(); 
+ 			delete basalelement;
+ 		}
+@@ -198,8 +209,11 @@
+ 
+ 	/*Intermediaries*/
+ 	int      meshtype;
++	bool       active_element;
+ 	Element* basalelement;
++	Input*   active_element_input=NULL;
+ 
++
+ 	/*Get basal element*/
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+ 	switch(meshtype){
+@@ -212,10 +226,13 @@
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
++	/* active_element_input=basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input); */
++	/* active_element_input->GetInputValue(&active_element); */
+ 
+ 	/*Check that all nodes are active, else return empty matrix*/
+-	if(!basalelement->AllActive()){
+-		if(meshtype!=Mesh2DhorizontalEnum){
++	if(!basalelement->AllActive()) {
++		//if(!active_element){
++	if(meshtype!=Mesh2DhorizontalEnum){
+ 			basalelement->DeleteMaterials(); 
+ 			delete basalelement;
+ 		}
+@@ -288,9 +305,11 @@
+ 	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
++
+ void HydrologyDCEfficientAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,EplHeadEnum);
+ }/*}}}*/
++
+ void HydrologyDCEfficientAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 	int meshtype;
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+@@ -314,6 +333,7 @@
+ 	IssmDouble water_compressibility = element->GetMaterialParameter(HydrologydcWaterCompressibilityEnum);
+ 	return rho_freshwater*g*epl_porosity*(water_compressibility+(epl_compressibility/epl_porosity));		 
+ }/*}}}*/
++
+ void HydrologyDCEfficientAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17029)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17030)
+@@ -295,6 +295,7 @@
+ 	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
++
+ void HydrologyDCInefficientAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
+@@ -322,9 +323,11 @@
+ 	/*Clean-up*/
+ 	xDelete<IssmDouble>(dbasis);
+ }/*}}}*/
++
+ void HydrologyDCInefficientAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,SedimentHeadEnum);
+ }/*}}}*/
++
+ void HydrologyDCInefficientAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 
+ 	int        meshtype;
+@@ -394,6 +397,7 @@
+ 	IssmDouble water_compressibility    = element->GetMaterialParameter(HydrologydcWaterCompressibilityEnum);
+ 	return rho_freshwater*g*sediment_porosity*sediment_thickness*(water_compressibility+(sediment_compressibility/sediment_porosity));		 
+ }/*}}}*/
++
+ void HydrologyDCInefficientAnalysis::ElementizeEplMask(FemModel* femmodel){/*{{{*/
+ 
+ 	bool     element_active;
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 17029)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 17030)
+@@ -72,18 +72,23 @@
+ void           L2ProjectionEPLAnalysis::Core(FemModel* femmodel){/*{{{*/
+ 	_error_("not implemented");
+ }/*}}}*/
++
+ ElementVector* L2ProjectionEPLAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+ }/*}}}*/
++
+ ElementMatrix* L2ProjectionEPLAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
++
+ ElementMatrix* L2ProjectionEPLAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	int      meshtype;
++	bool     active_element;
+ 	Element* basalelement;
++	Input*   active_element_input=NULL;
+ 
+ 	/*Get basal element*/
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+@@ -102,6 +107,19 @@
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
++	/* active_element_input=basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input); */
++	/* active_element_input->GetInputValue(&active_element); */
++
++	/* Check that all nodes are active, else return empty matrix */
++	if(!basalelement->AllActive()) {
++		//	if(!active_element){
++	if(meshtype!=Mesh2DhorizontalEnum){
++			basalelement->DeleteMaterials();
++			delete basalelement;
++		}
++		return NULL;
++	}
++
+ 	/*Intermediaries */
+ 	IssmDouble  D,Jdet;
+ 	IssmDouble *xyz_list  = NULL;
+@@ -142,7 +160,9 @@
+ 
+ 	/*Intermediaries*/
+ 	int      meshtype;
++	bool     active_element;
+ 	Element* basalelement;
++	Input*   active_element_input=NULL;
+ 
+ 	/*Get basal element*/
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+@@ -157,6 +177,19 @@
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
++	/* active_element_input=basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input); */
++	/* active_element_input->GetInputValue(&active_element); */
++
++	/*Check that all nodes are active, else return empty matrix*/
++	if(!basalelement->AllActive()) {
++		/* if(!active_element){ */
++		if(meshtype!=Mesh2DhorizontalEnum){
++			basalelement->DeleteMaterials();
++			delete basalelement;
++		}
++		return NULL;
++	}
++	
+ 	/*Intermediaries */
+ 	int         input_enum,index;
+ 	IssmDouble  Jdet,slopes[2];
+@@ -198,9 +231,11 @@
+ 	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
++
+ void L2ProjectionEPLAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
++
+ void L2ProjectionEPLAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 	int inputenum,meshtype;
+ 
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17029)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17030)
+@@ -168,12 +168,27 @@
+ 			InputUpdateFromConstantx(femmodel,false,ConvergedEnum);
+ 			femmodel->parameters->SetParam(HydrologyEfficientEnum,HydrologyLayerEnum);
+ 		
+-			eplconverged = false;
+-			
++			eplconverged=false;
+ 			for(;;){
+ 				ug_epl_sub_iter=ug_epl->Duplicate();_assert_(ug_epl_sub_iter);
+ 				ug_epl->Copy(ug_epl_sub_iter);
+-					
++				
++				/*Loop on the epl layer to deal with the penalization, have been removed TO CHECK*/
++												
++				SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
++				CreateNodalConstraintsx(&ys,femmodel->nodes,HydrologyDCEfficientAnalysisEnum);
++				Reduceloadx(pf,Kfs,ys); delete Kfs;
++				delete uf_epl;
++				Solverx(&uf_epl,Kff,pf,uf_epl_sub_iter,df,femmodel->parameters);
++				delete Kff; delete pf; delete df;
++				delete uf_epl_sub_iter;
++				uf_epl_sub_iter=uf_epl->Duplicate();
++				uf_epl->Copy(uf_epl_sub_iter);
++				delete ug_epl; 
++				Mergesolutionfromftogx(&ug_epl,uf_epl,ys,femmodel->nodes,femmodel->parameters); delete ys;
++				InputUpdateFromSolutionx(femmodel,ug_epl);
++				ConstraintsStatex(&constraints_converged,&num_unstable_constraints,femmodel);
++				
+ 				/* {{{ *//*Start by retrieving the EPL head slopes and compute EPL Thickness*/
+ 				if(VerboseSolution()) _printf0_("computing EPL Head slope...\n");
+ 				femmodel->SetCurrentConfiguration(L2ProjectionEPLAnalysisEnum);
+@@ -182,48 +197,19 @@
+ 				solutionsequence_linear(femmodel);
+ 				femmodel->parameters->SetParam(EplHeadSlopeYEnum,InputToL2ProjectEnum);
+ 				solutionsequence_linear(femmodel);
++				femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
+ 				femmodel->HydrologyEPLThicknessx();
++				
+ 				//updating mask after the computation of the epl thickness (Allow to close too thin EPL)
+ 				femmodel->HydrologyEPLupdateDomainx();
+ 				/* }}} */
+-				femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
+ 				
+-				/* {{{ *//*Loop on the epl layer to deal with the penalization*/
+-				for(;;){
+-					SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
+-					CreateNodalConstraintsx(&ys,femmodel->nodes,HydrologyDCEfficientAnalysisEnum);
+-					Reduceloadx(pf,Kfs,ys); delete Kfs;
+-					delete uf_epl;
+-					Solverx(&uf_epl,Kff,pf,uf_epl_sub_iter,df,femmodel->parameters);
+-					delete Kff; delete pf; delete df;
+-					delete uf_epl_sub_iter;
+-					uf_epl_sub_iter=uf_epl->Duplicate();
+-					uf_epl->Copy(uf_epl_sub_iter);
+-					delete ug_epl; 
+-					Mergesolutionfromftogx(&ug_epl,uf_epl,ys,femmodel->nodes,femmodel->parameters); delete ys;
+-					InputUpdateFromSolutionx(femmodel,ug_epl);
+-					ConstraintsStatex(&constraints_converged,&num_unstable_constraints,femmodel);
+-				
+-					if (!eplconverged){
+-						if(VerboseConvergence()) _printf0_("   # EPL unstable constraints = " << num_unstable_constraints << "\n");
+-						if(num_unstable_constraints==0) eplconverged = true;
+-						if (eplcount>=hydro_maxiter){
+-							_error_("   maximum number of EPL iterations (" << hydro_maxiter << ") exceeded");
+-						}
+-					}
+-					/*Add an iteration and get out of the loop if the penalisation is converged*/
+-					eplcount++;
+-					if(eplconverged) break;
+-				}
+-				/* }}} */ /*End of the EPL penalization loop*/
+-
+-				eplconverged=false;
+ 				/*Update Elemental Mask and compute transfer*/
+ 				HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
+ 				analysis->ElementizeEplMask(femmodel);
+ 				delete analysis;
+ 				femmodel->HydrologyTransferx();
+-
++				
+ 				dug=ug_epl_sub_iter->Duplicate();_assert_(dug);
+ 				ug_epl_sub_iter->Copy(dug);
+ 				dug->AYPX(ug_epl,-1.0);
+@@ -234,7 +220,11 @@
+ 				if (ndu_epl==0.0 && nu_epl==0.0) nu_epl=1.0e-6; /*Hacking the case where the EPL is used but empty*/
+ 				if(VerboseConvergence()) _printf0_(setw(50) << left << "   Inner EPL Convergence criterion:" << ndu_epl/nu_epl*100 << " aiming lower than " << eps_hyd*100 << " %\n");
+ 				if((ndu_epl/nu_epl)<eps_hyd) eplconverged=true;
+-			
++				if (eplcount>=hydro_maxiter){
++					_error_("   maximum number of EPL iterations (" << hydro_maxiter << ") exceeded");
++				}
++				eplcount++;
++				
+ 				delete ug_epl_sub_iter;
+ 				if(eplconverged){
+ 					InputUpdateFromConstantx(femmodel,eplconverged,ConvergedEnum);
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17029)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17030)
+@@ -4728,7 +4728,11 @@
+ 					}
+ 
+ 					/*Introduce relaxation*/
+-					wh_trans=old_transfer[i]+0.66*(wh_trans-old_transfer[i]);
++					//					wh_trans=old_transfer[i]+0.66*(wh_trans-old_transfer[i]);
++
++					if(this->Id()==27){
++						printf("old %e, transfer is %e ,eplhead %e, sedhead %e, factor %e \n",old_transfer[i],wh_trans,epl_head[i],sed_head[i],epl_specificstoring[i]*epl_thickness[i]*sed_trans[i]);
++					}
+ 				
+ 					/*Assign output pointer*/
+ 					transfer->SetValue(doflist[i],wh_trans,INS_VAL);
+@@ -4781,6 +4785,12 @@
+ 	IssmDouble  eplhead[numdof];
+ 	IssmDouble  residual[numdof];
+ 
++	bool       active_element;
++	Input* active_element_input=NULL;
++
++	active_element_input=inputs->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);
++	active_element_input->GetInputValue(&active_element);
++
+ 	GetInputListOnVertices(&old_active[0],HydrologydcMaskEplactiveNodeEnum);	
+ 	GetInputListOnVertices(&epl_thickness[0],HydrologydcEplThicknessEnum);	
+ 	GetInputListOnVertices(&sedhead[0],SedimentHeadEnum);
+@@ -4807,7 +4817,8 @@
+ 		}
+ 		/*Increase of the efficient system is needed if the epl head reach the maximum value (sediment max value for now)*/
+ 		this->GetHydrologyDCInefficientHmax(&h_max,i);
+-		if(eplhead[i]>=h_max && this->AnyActive()){
++		//if(eplhead[i]>=h_max && this->AnyActive()){
++		if(eplhead[i]>=h_max && active_element){
+ 			for(j=0;j<numdof;j++){
+ 				if(old_active[j]>0.){
+ 					vec_mask->SetValue(nodes[i]->Sid(),1.,INS_VAL);
+@@ -4837,6 +4848,8 @@
+ 	IssmDouble  epl_slopeX[numdof],epl_slopeY[numdof];
+ 	IssmDouble  ice_thickness[numdof],bed[numdof];
+ 
++	bool       active_element;
++	Input* active_element_input=NULL;
+ 
+ 	/*Get the flag to know if the efficient layer is present*/
+ 	this->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);
+@@ -4853,7 +4866,11 @@
+ 		n                = material->GetN();
+ 		A                = material->GetAbar();
+ 		
+-		GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveNodeEnum);
++		//	GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveNodeEnum);
++
++		active_element_input=inputs->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);
++		active_element_input->GetInputValue(&active_element);
++			
+ 		GetInputListOnVertices(&eplhead[0],EplHeadEnum);
+ 		GetInputListOnVertices(&epl_slopeX[0],EplHeadSlopeXEnum); 
+ 		GetInputListOnVertices(&epl_slopeY[0],EplHeadSlopeYEnum);
+@@ -4861,7 +4878,8 @@
+ 		GetInputListOnVertices(&ice_thickness[0],ThicknessEnum);
+ 		GetInputListOnVertices(&bed[0],BedEnum);
+ 		
+-		if(!this->AnyActive()){
++		//if(!this->AnyActive()){
++		if(!active_element){
+ 			/*Keeping thickness to initial value if EPL is not active*/
+ 			for(int i=0;i<numdof;i++){ 
+ 				thickness[i]=init_thick;
+@@ -4877,6 +4895,10 @@
+ 					
+ 					/*And proceed to the real thing*/
+ 					thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*EPLgrad2-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
++					//					thickness[i] = old_thickness[i]+0.66*(thickness[i]-old_thickness[i]);
++					if(this->Id()==27){
++						printf("old %e, thickness is %e ,eplhead %e, slopeX %e, slopeY %e\n",old_thickness[i],thickness[i],eplhead[i],epl_slopeX[i],epl_slopeY[i]);
++					}
+ 			}
+ 		}
+ 		this->inputs->AddInput(new TriaInput(HydrologydcEplThicknessEnum,thickness,P1Enum));
Index: issm/oecreview/Archive/16554-17801/ISSM-17030-17031.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17030-17031.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17030-17031.diff	(revision 17802)
@@ -0,0 +1,17 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17030)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17031)
+@@ -4730,9 +4730,9 @@
+ 					/*Introduce relaxation*/
+ 					//					wh_trans=old_transfer[i]+0.66*(wh_trans-old_transfer[i]);
+ 
+-					if(this->Id()==27){
+-						printf("old %e, transfer is %e ,eplhead %e, sedhead %e, factor %e \n",old_transfer[i],wh_trans,epl_head[i],sed_head[i],epl_specificstoring[i]*epl_thickness[i]*sed_trans[i]);
+-					}
++					/* if(this->Id()==27){ */
++					/* 	printf("old %e, transfer is %e ,eplhead %e, sedhead %e, factor %e \n",old_transfer[i],wh_trans,epl_head[i],sed_head[i],epl_specificstoring[i]*epl_thickness[i]*sed_trans[i]); */
++					/* } */
+ 				
+ 					/*Assign output pointer*/
+ 					transfer->SetValue(doflist[i],wh_trans,INS_VAL);
Index: issm/oecreview/Archive/16554-17801/ISSM-17031-17032.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17031-17032.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17031-17032.diff	(revision 17802)
@@ -0,0 +1,24 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17031)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17032)
+@@ -4731,7 +4731,7 @@
+ 					//					wh_trans=old_transfer[i]+0.66*(wh_trans-old_transfer[i]);
+ 
+ 					/* if(this->Id()==27){ */
+-					/* 	printf("old %e, transfer is %e ,eplhead %e, sedhead %e, factor %e \n",old_transfer[i],wh_trans,epl_head[i],sed_head[i],epl_specificstoring[i]*epl_thickness[i]*sed_trans[i]); */
++						/* printf("old %e, transfer is %e ,eplhead %e, sedhead %e, factor %e \n",old_transfer[i],wh_trans,epl_head[i],sed_head[i],epl_specificstoring[i]*epl_thickness[i]*sed_trans[i]); */
+ 					/* } */
+ 				
+ 					/*Assign output pointer*/
+@@ -4896,8 +4896,8 @@
+ 					/*And proceed to the real thing*/
+ 					thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*EPLgrad2-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
+ 					//					thickness[i] = old_thickness[i]+0.66*(thickness[i]-old_thickness[i]);
+-					if(this->Id()==27){
+-						printf("old %e, thickness is %e ,eplhead %e, slopeX %e, slopeY %e\n",old_thickness[i],thickness[i],eplhead[i],epl_slopeX[i],epl_slopeY[i]);
++					/* if(this->Id()==27){ */
++					/* 	printf("old %e, thickness is %e ,eplhead %e, slopeX %e, slopeY %e\n",old_thickness[i],thickness[i],eplhead[i],epl_slopeX[i],epl_slopeY[i]); */
+ 					}
+ 			}
+ 		}
Index: issm/oecreview/Archive/16554-17801/ISSM-17032-17033.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17032-17033.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17032-17033.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17032)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17033)
+@@ -4898,7 +4898,7 @@
+ 					//					thickness[i] = old_thickness[i]+0.66*(thickness[i]-old_thickness[i]);
+ 					/* if(this->Id()==27){ */
+ 					/* 	printf("old %e, thickness is %e ,eplhead %e, slopeX %e, slopeY %e\n",old_thickness[i],thickness[i],eplhead[i],epl_slopeX[i],epl_slopeY[i]); */
+-					}
++					/*}*/
+ 			}
+ 		}
+ 		this->inputs->AddInput(new TriaInput(HydrologydcEplThicknessEnum,thickness,P1Enum));
Index: issm/oecreview/Archive/16554-17801/ISSM-17033-17034.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17033-17034.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17033-17034.diff	(revision 17802)
@@ -0,0 +1,23 @@
+Index: ../trunk-jpl/test/NightlyRun/temp291.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/temp291.py	(revision 0)
++++ ../trunk-jpl/test/NightlyRun/temp291.py	(revision 17034)
+@@ -0,0 +1,18 @@
++from model import *
++from triangle import *
++from setmask import *
++from parameterize import *
++from setflowequation import *
++from EnumDefinitions import *
++from solve import *
++from MatlabFuncs import *
++from ContourToMesh import *
++
++md=triangle(model(),'../Exp/Square.exp',150000.)
++md=setmask(md,'all','')
++md=parameterize(md,'../Par/SquareShelf.py')
++md.extrude(2,1.)
++md=setflowequation(md,'FS','all')
++md.flowequation.fe_FS='FINITELEMENTNAME'
++md.cluster=generic('name',oshostname(),'np',1)
++md=solve(md,StressbalanceSolutionEnum())
Index: issm/oecreview/Archive/16554-17801/ISSM-17034-17035.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17034-17035.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17034-17035.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/src/m/classes/groundingline.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/groundingline.py	(revision 17034)
++++ ../trunk-jpl/src/m/classes/groundingline.py	(revision 17035)
+@@ -49,7 +49,7 @@
+ 			pos=numpy.nonzero(md.mask.groundedice_levelset>0.)[0]
+ 			if any(numpy.abs(md.geometry.bed[pos]-md.geometry.bathymetry[pos])>10**-10):
+ 				md.checkmessage("bathymetry not equal to bed on grounded ice!")
+-			pos=numpy.nonzero(md.mask.groundedice_levelset<0.)[0]
++			pos=numpy.nonzero(md.mask.groundedice_levelset<0. & md.mask.ice_levelset>=0)[0]
+ 			if any(md.geometry.bathymetry[pos]-md.geometry.bed[pos]>10**-9):
+ 				md.checkmessage("bathymetry superior to bed on floating ice!")
+ 
+Index: ../trunk-jpl/src/m/classes/groundingline.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/groundingline.m	(revision 17034)
++++ ../trunk-jpl/src/m/classes/groundingline.m	(revision 17035)
+@@ -38,7 +38,7 @@
+ 				if any(abs(md.geometry.bed(pos)-md.geometry.bathymetry(pos))>10^-10),
+ 					md = checkmessage(md,['bathymetry not equal to bed on grounded ice!']);
+ 				end
+-				pos=find(md.mask.groundedice_levelset<0.);
++				pos=find(md.mask.groundedice_levelset<0. & md.mask.ice_levelset>=0);
+ 				if any(md.geometry.bathymetry(pos)-md.geometry.bed(pos)>10^-9),
+ 					md = checkmessage(md,['bathymetry superior to bed on floating ice!']);
+ 				end
Index: issm/oecreview/Archive/16554-17801/ISSM-17035-17036.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17035-17036.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17035-17036.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/classes/groundingline.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/groundingline.py	(revision 17035)
++++ ../trunk-jpl/src/m/classes/groundingline.py	(revision 17036)
+@@ -49,7 +49,7 @@
+ 			pos=numpy.nonzero(md.mask.groundedice_levelset>0.)[0]
+ 			if any(numpy.abs(md.geometry.bed[pos]-md.geometry.bathymetry[pos])>10**-10):
+ 				md.checkmessage("bathymetry not equal to bed on grounded ice!")
+-			pos=numpy.nonzero(md.mask.groundedice_levelset<0. & md.mask.ice_levelset>=0)[0]
++			pos=numpy.nonzero(numpy.logical_and(md.mask.groundedice_levelset<0,md.mask.ice_levelset>=0))[0]
+ 			if any(md.geometry.bathymetry[pos]-md.geometry.bed[pos]>10**-9):
+ 				md.checkmessage("bathymetry superior to bed on floating ice!")
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17036-17037.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17036-17037.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17036-17037.diff	(revision 17802)
@@ -0,0 +1,28 @@
+Index: ../trunk-jpl/src/m/classes/groundingline.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/groundingline.py	(revision 17036)
++++ ../trunk-jpl/src/m/classes/groundingline.py	(revision 17037)
+@@ -49,8 +49,7 @@
+ 			pos=numpy.nonzero(md.mask.groundedice_levelset>0.)[0]
+ 			if any(numpy.abs(md.geometry.bed[pos]-md.geometry.bathymetry[pos])>10**-10):
+ 				md.checkmessage("bathymetry not equal to bed on grounded ice!")
+-			pos=numpy.nonzero(numpy.logical_and(md.mask.groundedice_levelset<0,md.mask.ice_levelset>=0))[0]
+-			if any(md.geometry.bathymetry[pos]-md.geometry.bed[pos]>10**-9):
++			if any(md.geometry.bathymetry - md.geometry.bed > 10**-9):
+ 				md.checkmessage("bathymetry superior to bed on floating ice!")
+ 
+ 		return md
+Index: ../trunk-jpl/src/m/classes/groundingline.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/groundingline.m	(revision 17036)
++++ ../trunk-jpl/src/m/classes/groundingline.m	(revision 17037)
+@@ -38,8 +38,7 @@
+ 				if any(abs(md.geometry.bed(pos)-md.geometry.bathymetry(pos))>10^-10),
+ 					md = checkmessage(md,['bathymetry not equal to bed on grounded ice!']);
+ 				end
+-				pos=find(md.mask.groundedice_levelset<0. & md.mask.ice_levelset>=0);
+-				if any(md.geometry.bathymetry(pos)-md.geometry.bed(pos)>10^-9),
++				if any(md.geometry.bathymetry - md.geometry.bed > 10^-9),
+ 					md = checkmessage(md,['bathymetry superior to bed on floating ice!']);
+ 				end
+ 			end
Index: issm/oecreview/Archive/16554-17801/ISSM-17037-17038.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17037-17038.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17037-17038.diff	(revision 17802)
@@ -0,0 +1,78 @@
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17037)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17038)
+@@ -535,6 +535,7 @@
+ 	MINIEnum,
+ 	MINIcondensedEnum,
+ 	TaylorHoodEnum,
++	OneLayerP4zEnum,
+ 	/*}}}*/
+ 	/*Results{{{*/
+ 	SaveResultsEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17037)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17038)
+@@ -527,6 +527,7 @@
+ 		case MINIEnum : return "MINI";
+ 		case MINIcondensedEnum : return "MINIcondensed";
+ 		case TaylorHoodEnum : return "TaylorHood";
++		case OneLayerP4zEnum : return "OneLayerP4z";
+ 		case SaveResultsEnum : return "SaveResults";
+ 		case BoolExternalResultEnum : return "BoolExternalResult";
+ 		case DoubleExternalResultEnum : return "DoubleExternalResult";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17037)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17038)
+@@ -539,6 +539,7 @@
+ 	      else if (strcmp(name,"MINI")==0) return MINIEnum;
+ 	      else if (strcmp(name,"MINIcondensed")==0) return MINIcondensedEnum;
+ 	      else if (strcmp(name,"TaylorHood")==0) return TaylorHoodEnum;
++	      else if (strcmp(name,"OneLayerP4z")==0) return OneLayerP4zEnum;
+ 	      else if (strcmp(name,"SaveResults")==0) return SaveResultsEnum;
+ 	      else if (strcmp(name,"BoolExternalResult")==0) return BoolExternalResultEnum;
+ 	      else if (strcmp(name,"DoubleExternalResult")==0) return DoubleExternalResultEnum;
+@@ -627,11 +628,11 @@
+ 	      else if (strcmp(name,"MpiDense")==0) return MpiDenseEnum;
+ 	      else if (strcmp(name,"MpiSparse")==0) return MpiSparseEnum;
+ 	      else if (strcmp(name,"Seq")==0) return SeqEnum;
+-	      else if (strcmp(name,"Mpi")==0) return MpiEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"Mumps")==0) return MumpsEnum;
++	      if (strcmp(name,"Mpi")==0) return MpiEnum;
++	      else if (strcmp(name,"Mumps")==0) return MumpsEnum;
+ 	      else if (strcmp(name,"Gsl")==0) return GslEnum;
+ 	      else if (strcmp(name,"Option")==0) return OptionEnum;
+ 	      else if (strcmp(name,"GenericOption")==0) return GenericOptionEnum;
+Index: ../trunk-jpl/src/m/enum/OneLayerP4zEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/OneLayerP4zEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/OneLayerP4zEnum.m	(revision 17038)
+@@ -0,0 +1,11 @@
++function macro=OneLayerP4zEnum()
++%ONELAYERP4ZENUM - Enum of OneLayerP4z
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=OneLayerP4zEnum()
++
++macro=StringToEnum('OneLayerP4z');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17037)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17038)
+@@ -519,6 +519,7 @@
+ def MINIEnum(): return StringToEnum("MINI")[0]
+ def MINIcondensedEnum(): return StringToEnum("MINIcondensed")[0]
+ def TaylorHoodEnum(): return StringToEnum("TaylorHood")[0]
++def OneLayerP4zEnum(): return StringToEnum("OneLayerP4z")[0]
+ def SaveResultsEnum(): return StringToEnum("SaveResults")[0]
+ def BoolExternalResultEnum(): return StringToEnum("BoolExternalResult")[0]
+ def DoubleExternalResultEnum(): return StringToEnum("DoubleExternalResult")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17038-17039.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17038-17039.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17038-17039.diff	(revision 17802)
@@ -0,0 +1,37 @@
+Index: ../trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim
+===================================================================
+--- ../trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim	(revision 17038)
++++ ../trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim	(revision 17039)
+@@ -640,7 +640,8 @@
+ syn keyword cConstant HydrologydcSedimentTransmitivityEnum
+ syn keyword cConstant HydrologydcWaterCompressibilityEnum
+ syn keyword cConstant HydrologydcSpceplHeadEnum
+-syn keyword cConstant HydrologydcMaskEplactiveEnum
++syn keyword cConstant HydrologydcMaskEplactiveNodeEnum
++syn keyword cConstant HydrologydcMaskEplactiveEltEnum
+ syn keyword cConstant HydrologydcEplCompressibilityEnum
+ syn keyword cConstant HydrologydcEplPorosityEnum
+ syn keyword cConstant HydrologydcEplInitialThicknessEnum
+@@ -691,6 +692,7 @@
+ syn keyword cConstant MaterialsRheologyLawEnum
+ syn keyword cConstant MaterialsRheologyNEnum
+ syn keyword cConstant DamageDEnum
++syn keyword cConstant DamageFEnum
+ syn keyword cConstant QmuDamageDEnum
+ syn keyword cConstant DamageDbarEnum
+ syn keyword cConstant DamageLawEnum
+@@ -1041,11 +1043,14 @@
+ syn keyword cConstant P2Enum
+ syn keyword cConstant P2xP1Enum
+ syn keyword cConstant P1xP2Enum
++syn keyword cConstant P1xP3Enum
++syn keyword cConstant P2xP4Enum
+ syn keyword cConstant P1P1Enum
+ syn keyword cConstant P1P1GLSEnum
+ syn keyword cConstant MINIEnum
+ syn keyword cConstant MINIcondensedEnum
+ syn keyword cConstant TaylorHoodEnum
++syn keyword cConstant OneLayerP4zEnum
+ syn keyword cConstant SaveResultsEnum
+ syn keyword cConstant BoolExternalResultEnum
+ syn keyword cConstant DoubleExternalResultEnum
Index: issm/oecreview/Archive/16554-17801/ISSM-17039-17040.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17039-17040.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17039-17040.diff	(revision 17802)
@@ -0,0 +1,50 @@
+Index: ../trunk-jpl/test/NightlyRun/temp291.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/temp291.m	(revision 17039)
++++ ../trunk-jpl/test/NightlyRun/temp291.m	(revision 17040)
+@@ -3,6 +3,6 @@
+ md=parameterize(md,'../Par/SquareShelf.par');
+ md=extrude(md,2,1.);
+ md=setflowequation(md,'FS','all');
+-md.flowequation.fe_FS='FINITELEMENTNAME';
++md.flowequation.fe_FS='OneLayerP4z';
+ md.cluster=generic('name',oshostname(),'np',1);
+ md=solve(md,StressbalanceSolutionEnum());
+Index: ../trunk-jpl/test/NightlyRun/temp291.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/temp291.py	(revision 17039)
++++ ../trunk-jpl/test/NightlyRun/temp291.py	(revision 17040)
+@@ -13,6 +13,6 @@
+ md=parameterize(md,'../Par/SquareShelf.py')
+ md.extrude(2,1.)
+ md=setflowequation(md,'FS','all')
+-md.flowequation.fe_FS='FINITELEMENTNAME'
++md.flowequation.fe_FS='OneLayerP4z'
+ md.cluster=generic('name',oshostname(),'np',1)
+ md=solve(md,StressbalanceSolutionEnum())
+Index: ../trunk-jpl/src/m/classes/flowequation.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/flowequation.py	(revision 17039)
++++ ../trunk-jpl/src/m/classes/flowequation.py	(revision 17040)
+@@ -74,7 +74,7 @@
+ 			md = checkfield(md,'fieldname','flowequation.isFS','numel',[1],'values',[0,1])
+ 			md = checkfield(md,'fieldname','flowequation.fe_SSA','values',['P1','P1bubble','P1bubblecondensed','P2'])
+ 			md = checkfield(md,'fieldname','flowequation.fe_HO' ,'values',['P1','P1bubble','P1bubblecondensed','P1xP2','P2xP1','P2'])
+-			md = checkfield(md,'fieldname','flowequation.fe_FS' ,'values',['P1P1','P1P1GLS','MINIcondensed','MINI','TaylorHood'])
++			md = checkfield(md,'fieldname','flowequation.fe_FS' ,'values',['P1P1','P1P1GLS','MINIcondensed','MINI','TaylorHood','OneLayerP4z'])
+ 			md = checkfield(md,'fieldname','flowequation.borderSSA','size',[md.mesh.numberofvertices],'values',[0,1])
+ 			md = checkfield(md,'fieldname','flowequation.borderHO','size',[md.mesh.numberofvertices],'values',[0,1])
+ 			md = checkfield(md,'fieldname','flowequation.borderFS','size',[md.mesh.numberofvertices],'values',[0,1])
+Index: ../trunk-jpl/src/m/classes/flowequation.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/flowequation.m	(revision 17039)
++++ ../trunk-jpl/src/m/classes/flowequation.m	(revision 17040)
+@@ -86,7 +86,7 @@
+ 				md = checkfield(md,'fieldname','flowequation.isFS','numel',[1],'values',[0 1]);
+ 				md = checkfield(md,'fieldname','flowequation.fe_SSA','values',{'P1','P1bubble','P1bubblecondensed','P2'});
+ 				md = checkfield(md,'fieldname','flowequation.fe_HO' ,'values',{'P1','P1bubble','P1bubblecondensed','P1xP2','P2xP1','P2'});
+-				md = checkfield(md,'fieldname','flowequation.fe_FS' ,'values',{'P1P1','P1P1GLS','MINIcondensed','MINI','TaylorHood'});
++				md = checkfield(md,'fieldname','flowequation.fe_FS' ,'values',{'P1P1','P1P1GLS','MINIcondensed','MINI','TaylorHood','OneLayerP4z'});
+ 				md = checkfield(md,'fieldname','flowequation.borderSSA','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+ 				md = checkfield(md,'fieldname','flowequation.borderHO','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+ 				md = checkfield(md,'fieldname','flowequation.borderFS','size',[md.mesh.numberofvertices 1],'values',[0 1]);
Index: issm/oecreview/Archive/16554-17801/ISSM-17040-17041.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17040-17041.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17040-17041.diff	(revision 17802)
@@ -0,0 +1,185 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17040)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17041)
+@@ -84,6 +84,29 @@
+ 				}
+ 			}
+ 			break;
++
++		case P1xP3Enum:
++			EdgesPartitioning(&my_edges,iomodel);
++			for(i=0;i<iomodel->numberofvertices;i++){
++				if(iomodel->my_vertices[i]){
++					nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,lid++,i,iomodel,analysis,approximation));
++				}
++			}
++
++			counter = iomodel->numberofvertices;
++			for(i=0;i<iomodel->numberofedges;i++){
++				if(iomodel->edges[i*3+2]==2){
++					if(my_edges[i]){
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+2*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
++						nodes->AddObject(node);
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+2*i+2,counter+2,lid++,0,iomodel,analysis,approximation);
++						nodes->AddObject(node);
++					}
++					counter=counter+2;
++				}
++			}
++			break;
++
+ 		case P2xP1Enum:
+ 			EdgesPartitioning(&my_edges,iomodel);
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+@@ -213,6 +236,13 @@
+ 				}
+ 			}
+ 			break;
++		case OneLayerP4zEnum:
++			_assert_(approximation==FSApproximationEnum);
++			/*P2xP4 velocity*/
++			EdgesPartitioning(&my_edges,iomodel);
++			/*P1xP3 pressure*/
++			_error_("Not supported");
++			break;
+ 
+ 		default:
+ 			_error_("Finite element "<<EnumToStringx(finite_element)<<" not supported yet");
+Index: ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17040)
++++ ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17041)
+@@ -60,12 +60,18 @@
+ 		case P1xP2Enum:
+ 			EdgesPartitioning(&my_edges,iomodel);
+ 			break;
++		case P1xP3Enum:
++			EdgesPartitioning(&my_edges,iomodel);
++			break;
+ 		case P2xP1Enum:
+ 			EdgesPartitioning(&my_edges,iomodel);
+ 			break;
+ 		case P2Enum:
+ 			EdgesPartitioning(&my_edges,iomodel);
+ 			break;
++		case P2xP4Enum:
++			EdgesPartitioning(&my_edges,iomodel);
++			break;
+ 		default:
+ 			_error_("Finite element "<<EnumToStringx(finite_element)<<" not supported yet");
+ 	}
+@@ -159,6 +165,31 @@
+ 					}
+ 				}
+ 				break;
++			case P1xP3Enum:
++				for(i=0;i<iomodel->numberofvertices;i++){
++					if((iomodel->my_vertices[i])){
++						if (!xIsNan<IssmDouble>(spcdata[i])){
++							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,dof,spcdata[i],analysis_type));
++							count++;
++						}
++					}
++				}
++				for(i=0;i<iomodel->numberofedges;i++){
++					if(iomodel->edges[i*3+2]==2){
++						if(my_edges[i]){
++							v1 = iomodel->edges[3*i+0]-1;
++							v2 = iomodel->edges[3*i+1]-1;
++							if(!xIsNan<IssmDouble>(spcdata[v1]) && !xIsNan<IssmDouble>(spcdata[v2])){
++								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+2*count+1,iomodel->nodecounter+iomodel->numberofvertices+2*i+1,
++												dof,2./3.*spcdata[v1]+1./3.*spcdata[v2],analysis_type));
++								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+2*count+2,iomodel->nodecounter+iomodel->numberofvertices+2*i+2,
++												dof,1./3.*spcdata[v1]+2./3.*spcdata[v2],analysis_type));
++								count=count+2;
++							}
++						}
++					}
++				}
++				break;
+ 			case P2xP1Enum:
+ 				for(i=0;i<iomodel->numberofvertices;i++){
+ 					if((iomodel->my_vertices[i])){
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17040)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17041)
+@@ -2768,6 +2768,22 @@
+ 			penta_node_ids[ 7]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[9*index+1]+1;
+ 			penta_node_ids[ 8]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[9*index+2]+1;
+ 			break;
++		case P1xP3Enum:
++			numnodes         = 12;
++			penta_node_ids   = xNew<int>(numnodes);
++			penta_node_ids[ 0]=iomodel->nodecounter+iomodel->elements[6*index+0];
++			penta_node_ids[ 1]=iomodel->nodecounter+iomodel->elements[6*index+1];
++			penta_node_ids[ 2]=iomodel->nodecounter+iomodel->elements[6*index+2];
++			penta_node_ids[ 3]=iomodel->nodecounter+iomodel->elements[6*index+3];
++			penta_node_ids[ 4]=iomodel->nodecounter+iomodel->elements[6*index+4];
++			penta_node_ids[ 5]=iomodel->nodecounter+iomodel->elements[6*index+5];
++			penta_node_ids[ 6]=iomodel->nodecounter+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+0]+1;
++			penta_node_ids[ 7]=iomodel->nodecounter+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+1]+1;
++			penta_node_ids[ 8]=iomodel->nodecounter+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+2]+1;
++			penta_node_ids[ 9]=iomodel->nodecounter+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+0]+2;
++			penta_node_ids[10]=iomodel->nodecounter+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+1]+2;
++			penta_node_ids[11]=iomodel->nodecounter+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+2]+2;
++			break;
+ 		case P2xP1Enum:
+ 			numnodes         = 12;
+ 			penta_node_ids   = xNew<int>(numnodes);
+Index: ../trunk-jpl/src/c/classes/gauss/GaussPenta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussPenta.cpp	(revision 17040)
++++ ../trunk-jpl/src/c/classes/gauss/GaussPenta.cpp	(revision 17041)
+@@ -586,6 +586,24 @@
+ 				default: _error_("node index should be in [0 8]");
+ 			}
+ 			break;
++		case P1xP3Enum: 
++			switch(iv){
++				case 0 : coord1=1.; coord2=0.; coord3=0.; coord4=-1.; break;
++				case 1 : coord1=0.; coord2=1.; coord3=0.; coord4=-1.; break;
++				case 2 : coord1=0.; coord2=0.; coord3=1.; coord4=-1.; break;
++				case 3 : coord1=1.; coord2=0.; coord3=0.; coord4=+1.; break;
++				case 4 : coord1=0.; coord2=1.; coord3=0.; coord4=+1.; break;
++				case 5 : coord1=0.; coord2=0.; coord3=1.; coord4=+1.; break;
++
++				case 6 : coord1=1.; coord2=0.; coord3=0.; coord4=-1./3.; break;
++				case 7 : coord1=0.; coord2=1.; coord3=0.; coord4=-1./3.; break;
++				case 8 : coord1=0.; coord2=0.; coord3=1.; coord4=-1./3.; break;
++				case 9 : coord1=1.; coord2=0.; coord3=0.; coord4=+1./3.; break;
++				case 10: coord1=0.; coord2=1.; coord3=0.; coord4=+1./3.; break;
++				case 11: coord1=0.; coord2=0.; coord3=1.; coord4=+1./3.; break;
++				default: _error_("node index should be in [0 11]");
++			}
++			break;
+ 		case P2xP1Enum: 
+ 			switch(iv){
+ 				case 0: coord1=1.; coord2=0.; coord3=0.; coord4=-1.; break;
+Index: ../trunk-jpl/src/m/classes/flowequation.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/flowequation.py	(revision 17040)
++++ ../trunk-jpl/src/m/classes/flowequation.py	(revision 17041)
+@@ -74,7 +74,7 @@
+ 			md = checkfield(md,'fieldname','flowequation.isFS','numel',[1],'values',[0,1])
+ 			md = checkfield(md,'fieldname','flowequation.fe_SSA','values',['P1','P1bubble','P1bubblecondensed','P2'])
+ 			md = checkfield(md,'fieldname','flowequation.fe_HO' ,'values',['P1','P1bubble','P1bubblecondensed','P1xP2','P2xP1','P2'])
+-			md = checkfield(md,'fieldname','flowequation.fe_FS' ,'values',['P1P1','P1P1GLS','MINIcondensed','MINI','TaylorHood','OneLayerP4z'])
++			md = checkfield(md,'fieldname','flowequation.fe_FS' ,'values',['P1P1','P1P1GLS','MINIcondensed','MINI','TaylorHood','OneLayerP4z','P1xP3','P2xP4'])
+ 			md = checkfield(md,'fieldname','flowequation.borderSSA','size',[md.mesh.numberofvertices],'values',[0,1])
+ 			md = checkfield(md,'fieldname','flowequation.borderHO','size',[md.mesh.numberofvertices],'values',[0,1])
+ 			md = checkfield(md,'fieldname','flowequation.borderFS','size',[md.mesh.numberofvertices],'values',[0,1])
+Index: ../trunk-jpl/src/m/classes/flowequation.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/flowequation.m	(revision 17040)
++++ ../trunk-jpl/src/m/classes/flowequation.m	(revision 17041)
+@@ -85,7 +85,7 @@
+ 				md = checkfield(md,'fieldname','flowequation.isHO','numel',[1],'values',[0 1]);
+ 				md = checkfield(md,'fieldname','flowequation.isFS','numel',[1],'values',[0 1]);
+ 				md = checkfield(md,'fieldname','flowequation.fe_SSA','values',{'P1','P1bubble','P1bubblecondensed','P2'});
+-				md = checkfield(md,'fieldname','flowequation.fe_HO' ,'values',{'P1','P1bubble','P1bubblecondensed','P1xP2','P2xP1','P2'});
++				md = checkfield(md,'fieldname','flowequation.fe_HO' ,'values',{'P1','P1bubble','P1bubblecondensed','P1xP2','P2xP1','P2','P1xP3','P2xP4'});
+ 				md = checkfield(md,'fieldname','flowequation.fe_FS' ,'values',{'P1P1','P1P1GLS','MINIcondensed','MINI','TaylorHood','OneLayerP4z'});
+ 				md = checkfield(md,'fieldname','flowequation.borderSSA','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+ 				md = checkfield(md,'fieldname','flowequation.borderHO','size',[md.mesh.numberofvertices 1],'values',[0 1]);
Index: issm/oecreview/Archive/16554-17801/ISSM-17041-17042.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17041-17042.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17041-17042.diff	(revision 17802)
@@ -0,0 +1,16 @@
+Index: ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17041)
++++ ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17042)
+@@ -180,9 +180,9 @@
+ 							v1 = iomodel->edges[3*i+0]-1;
+ 							v2 = iomodel->edges[3*i+1]-1;
+ 							if(!xIsNan<IssmDouble>(spcdata[v1]) && !xIsNan<IssmDouble>(spcdata[v2])){
+-								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+2*count+1,iomodel->nodecounter+iomodel->numberofvertices+2*i+1,
++								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+2*i+1,
+ 												dof,2./3.*spcdata[v1]+1./3.*spcdata[v2],analysis_type));
+-								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+2*count+2,iomodel->nodecounter+iomodel->numberofvertices+2*i+2,
++								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+2,iomodel->nodecounter+iomodel->numberofvertices+2*i+2,
+ 												dof,1./3.*spcdata[v1]+2./3.*spcdata[v2],analysis_type));
+ 								count=count+2;
+ 							}
Index: issm/oecreview/Archive/16554-17801/ISSM-17042-17043.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17042-17043.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17042-17043.diff	(revision 17802)
@@ -0,0 +1,64 @@
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17042)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17043)
+@@ -20,10 +20,10 @@
+ #define NUMNODESP1_2d 3
+ #define NUMNODESP1b   7
+ #define NUMNODESP1xP2 9
++#define NUMNODESP1xP3 12
+ #define NUMNODESP2xP1 12
+ #define NUMNODESP2    15
+ #define NUMNODESP2xP4 30
+-#define NUMNODESP1xP3 12
+ 
+ /*Object constructors and destructor*/
+ /*FUNCTION PentaRef::PentaRef(){{{*/
+@@ -1952,7 +1952,7 @@
+ 			dbasis[NUMNODESP1xP3*2+1 ] =- (9./16.)*gauss->coord2 *( 2.* zeta* ( zeta -1. ) + ( zeta - (1./3.) )*( zeta + (1./3.) ));
+ 			/*Nodal function 3*/
+ 			dbasis[NUMNODESP1xP3*0+2 ] =  0.;
+-			dbasis[NUMNODESP1xP3*1+2 ] = - ((3.*SQRT3)/32.)*(zeta-1)*(zeta-1./3.)*(zeta+1./3.);
++			dbasis[NUMNODESP1xP3*1+2 ] = - ((3.*SQRT3)/16.)*(zeta-1)*(zeta-1./3.)*(zeta+1./3.);
+ 			dbasis[NUMNODESP1xP3*2+2 ] = - (9./16.)* gauss->coord3* ( 2. *zeta *( zeta -1. ) + ( zeta - (1./3.) )*( zeta + (1./3.) ));
+ 			/*Nodal function 4*/	 
+ 			dbasis[NUMNODESP1xP3*0+3 ] = -  (9./32.)*(zeta-1./3.)*(zeta+1./3.)*(zeta+1.);
+@@ -1968,28 +1968,28 @@
+ 			dbasis[NUMNODESP1xP3*2+5 ] =  (9./16.)* gauss->coord3 *( 2.* zeta * ( zeta  + 1. ) + ( zeta - (1./3.) )*( zeta + (1./3.) ));
+ 			/*Nodal function 7*/	
+ 			dbasis[NUMNODESP1xP3*0+6 ] = -  (27./32.) *(zeta-1)*(zeta-1./3.)*(zeta+1.);
+-			dbasis[NUMNODESP1xP3*1+6 ] = -  (27./32.) *(zeta-1)*(zeta-1./3.)*(zeta+1.);
++			dbasis[NUMNODESP1xP3*1+6 ] = -  (9.*SQRT3/32.) *(zeta-1)*(zeta-1./3.)*(zeta+1.);
+ 			dbasis[NUMNODESP1xP3*2+6 ] =  gauss->coord1*(27./16.)*( 2.* zeta *( zeta - (1./3.)) + ( zeta - 1. )*( zeta + 1. ));
+ 			/*Nodal function 8*/	
+ 			dbasis[NUMNODESP1xP3*0+7 ] =  (27./32.) *(zeta-1)*(zeta-1./3.)*(zeta+1.);
+-			dbasis[NUMNODESP1xP3*1+7 ] = -(27./32.) *(zeta-1)*(zeta-1./3.)*(zeta+1.);
++			dbasis[NUMNODESP1xP3*1+7 ] = -((9.*SQRT3)/32.) *(zeta-1)*(zeta-1./3.)*(zeta+1.);
+ 			dbasis[NUMNODESP1xP3*2+7 ] =  gauss->coord2*(27./16.)*( 2.* zeta *( zeta - (1./3.)) + ( zeta - 1. )*( zeta + 1. ));
+ 			/*Nodal function 9*/	
+ 			dbasis[NUMNODESP1xP3*0+8 ] = 0.;
+ 			dbasis[NUMNODESP1xP3*1+8 ] =  ((9.*SQRT3)/16.) *(zeta-1.)*(zeta-1./3.)*(zeta+1.);
+ 			dbasis[NUMNODESP1xP3*2+8 ] =  gauss->coord3*(27./16.)*( 2. *zeta *( zeta - (1./3.)) + ( zeta - 1. )*( zeta + 1. ));
+ 			/*Nodal function 10*/	
+-			dbasis[NUMNODESP1xP3*0+9 ] = - (27./32.) *(zeta-1.)*(zeta+1./3.)*(zeta+1.);
+-			dbasis[NUMNODESP1xP3*1+9 ] = - ((9.*SQRT3)/32.) *(zeta-1.)*(zeta+1./3.)*(zeta+1.);
+-			dbasis[NUMNODESP1xP3*2+9 ] =  gauss->coord1 *(27./16.)*( 2* zeta *( zeta + (1./3.)) + ( zeta - 1. )*( zeta + 1. ));
++			dbasis[NUMNODESP1xP3*0+9 ] = (27./32.) *(zeta-1.)*(zeta+1./3.)*(zeta+1.);
++			dbasis[NUMNODESP1xP3*1+9 ] = ((9.*SQRT3)/32.) *(zeta-1.)*(zeta+1./3.)*(zeta+1.);
++			dbasis[NUMNODESP1xP3*2+9 ] =  -gauss->coord1 *(27./16.)*( 2* zeta *( zeta + (1./3.)) + ( zeta - 1. )*( zeta + 1. ));
+ 			/*Nodal function 11*/	
+-			dbasis[NUMNODESP1xP3*0+10] =  (27./32.) *(zeta-1)*(zeta+1./3.)*(zeta+1);
+-			dbasis[NUMNODESP1xP3*1+10] = - ((9.*SQRT3)/32.)  *(zeta-1.)*(zeta+1./3.)*(zeta+1);
+-			dbasis[NUMNODESP1xP3*2+10] =  gauss->coord2 *(27./16.) * 2.* zeta *( zeta + (1./3.) + ( zeta - 1. )*( zeta + 1. ));
++			dbasis[NUMNODESP1xP3*0+10] = - (27./32.) *(zeta-1)*(zeta+1./3.)*(zeta+1);
++			dbasis[NUMNODESP1xP3*1+10] = -((9.*SQRT3)/32.)  *(zeta-1.)*(zeta+1./3.)*(zeta+1);
++			dbasis[NUMNODESP1xP3*2+10] = -gauss->coord2 *(27./16.) * 2.* zeta *( zeta + (1./3.) + ( zeta - 1. )*( zeta + 1. ));
+ 			/*Nodal function 12*/	
+ 			dbasis[NUMNODESP1xP3*0+11] = 0.;
+-			dbasis[NUMNODESP1xP3*1+11] =  ((9.*SQRT3)/16.) *(zeta-1.)*(zeta+1./3.)*(zeta+1);
+-			dbasis[NUMNODESP1xP3*2+11] =  gauss->coord3 *(27./16.)* 2.* zeta *( zeta + (1./3.) + ( zeta - 1. )*( zeta + 1. ));
++			dbasis[NUMNODESP1xP3*1+11] = -((9.*SQRT3)/16.) *(zeta-1.)*(zeta+1./3.)*(zeta+1);
++			dbasis[NUMNODESP1xP3*2+11] = -gauss->coord3 *(27./16.)* 2.* zeta *( zeta + (1./3.) + ( zeta - 1. )*( zeta + 1. ));
+ 			return;
+ 		default:
+ 			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
Index: issm/oecreview/Archive/16554-17801/ISSM-17043-17044.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17043-17044.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17043-17044.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17043)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17044)
+@@ -1984,7 +1984,7 @@
+ 			dbasis[NUMNODESP1xP3*2+9 ] =  -gauss->coord1 *(27./16.)*( 2* zeta *( zeta + (1./3.)) + ( zeta - 1. )*( zeta + 1. ));
+ 			/*Nodal function 11*/	
+ 			dbasis[NUMNODESP1xP3*0+10] = - (27./32.) *(zeta-1)*(zeta+1./3.)*(zeta+1);
+-			dbasis[NUMNODESP1xP3*1+10] = -((9.*SQRT3)/32.)  *(zeta-1.)*(zeta+1./3.)*(zeta+1);
++			dbasis[NUMNODESP1xP3*1+10] = ((9.*SQRT3)/32.)  *(zeta-1.)*(zeta+1./3.)*(zeta+1);
+ 			dbasis[NUMNODESP1xP3*2+10] = -gauss->coord2 *(27./16.) * 2.* zeta *( zeta + (1./3.) + ( zeta - 1. )*( zeta + 1. ));
+ 			/*Nodal function 12*/	
+ 			dbasis[NUMNODESP1xP3*0+11] = 0.;
Index: issm/oecreview/Archive/16554-17801/ISSM-17044-17045.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17044-17045.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17044-17045.diff	(revision 17802)
@@ -0,0 +1,57 @@
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17044)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17045)
+@@ -773,7 +773,7 @@
+ 		for(i=0;i<numnodes;i++){
+ 			element->EnthalpyToThermal(&temperature[i],&waterfraction[i],values[i],pressure[i]);
+ 			if(waterfraction[i]<0.) _error_("Negative water fraction found in solution vector");
+-			if(waterfraction[i]>1.) _error_("Water fraction >1 found in solution vector");
++			//if(waterfraction[i]>1.) _error_("Water fraction >1 found in solution vector");
+ 		}
+ 		element->AddInput(EnthalpyEnum,values,P1Enum);
+ 		element->AddInput(WaterfractionEnum,waterfraction,P1Enum);
+@@ -947,7 +947,7 @@
+ 	//element->AddInput(EnthalpyEnum,enthalpy,P1Enum);
+ 
+ 	/******** DRAINAGE *****************************************/
+-	IssmDouble* drainrate_column  = xNew<IssmDouble>(numsegments); //TODO: xDelete?
++	IssmDouble* drainrate_column  = xNew<IssmDouble>(numsegments);
+ 	IssmDouble* drainrate_element = xNew<IssmDouble>(numsegments);
+ 	for(is=0;is<numsegments;is++)	drainrate_column[is]=0.;
+ 	Element* elementi = element;
+@@ -1115,11 +1115,11 @@
+ 			pressure_input->GetInputValue(&pressureup, gaussup);
+ 			setspc=((enthalpyup<PureIceEnthalpy(element,pressureup)) && (watercolumn>=0.))?true:false;
+ 		}
+-		else if(watercolumn>0.) // case H<Hpmp && watercolumn>0.
+-			setspc=true;
+ 		else
+ 			setspc = false;
+ 
++
++
+ 		node=element->GetNode(indices[i]);
+ 		if (setspc) 
+ 			node->ApplyConstraint(1,h_pmp); /*apply spc*/ //nodes[indices[i]]->ApplyConstraint(1,h_pmp);
+Index: ../trunk-jpl/src/c/cores/thermal_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/thermal_core.cpp	(revision 17044)
++++ ../trunk-jpl/src/c/cores/thermal_core.cpp	(revision 17045)
+@@ -47,10 +47,12 @@
+ 		/*transfer enthalpy to enthalpy picard for the next step: */
+ 		InputDuplicatex(femmodel,EnthalpyEnum,EnthalpyPicardEnum);
+ 
+-		/*Post process*/
+-		enthalpy_analysis = new EnthalpyAnalysis();
+-		enthalpy_analysis->PostProcessing(femmodel);
+-		delete enthalpy_analysis;
++		if(solution_type!=SteadystateSolutionEnum){
++			/*Post process*/
++			enthalpy_analysis = new EnthalpyAnalysis();
++			enthalpy_analysis->PostProcessing(femmodel);
++			delete enthalpy_analysis;
++		}
+ 	}
+ 	else{
+ 		if(VerboseSolution()) _printf0_("   computing temperatures\n");
Index: issm/oecreview/Archive/16554-17801/ISSM-17045-17046.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17045-17046.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17045-17046.diff	(revision 17802)
@@ -0,0 +1,14 @@
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17045)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17046)
+@@ -846,7 +846,8 @@
+ 	/* melting rate is positive when melting, negative when refreezing*/
+ 
+ 	/* Intermediaries */
+-	int         i,is,vertexdown,vertexup,dim=3,numvertices,numsegments;
++	const int   dim=3;
++	int         i,is,vertexdown,vertexup,numvertices,numsegments;
+ 	IssmDouble  heatflux;
+ 	IssmDouble  vec_heatflux[dim],normal_base[dim],d1enthalpy[dim];
+ 	IssmDouble  temperature, waterfraction;
Index: issm/oecreview/Archive/16554-17801/ISSM-17046-17047.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17046-17047.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17046-17047.diff	(revision 17802)
@@ -0,0 +1,118 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17046)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17047)
+@@ -236,6 +236,7 @@
+ 		virtual IssmDouble IceVolumeAboveFloatation(void)=0;
+ 		virtual IssmDouble TotalSmb(void)=0;
+ 		virtual IssmDouble Misfit(int modelenum,int observationenum,int weightsenum)=0;
++		virtual IssmDouble MisfitArea(int weightsenum)=0;
+ 		virtual int    VertexConnectivity(int vertexindex)=0;
+ 		virtual void   VerticalSegmentIndices(int** pindices,int* pnumseg)=0;
+ 		#endif
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17046)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17047)
+@@ -2239,7 +2239,10 @@
+ 	IssmDouble xyz_list[NUMVERTICES][3];
+ 
+ 	/*If on water, return 0: */
+-	if(NoIceInElement())return 0;
++	if(NoIceInElement()){
++		printf("no ice in element!\n");
++		return 0;
++	}
+ 
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+@@ -2882,6 +2885,44 @@
+ 	return Total_Smb;
+ }
+ /*}}}*/
++/*FUNCTION Tria::MisfitArea{{{*/
++IssmDouble Tria::MisfitArea(int weightsenum){
++
++	/*Intermediaries*/
++	IssmDouble weight;
++	IssmDouble Jdet;
++	IssmDouble Jelem = 0;
++	IssmDouble xyz_list[NUMVERTICES][3];
++	GaussTria *gauss = NULL;
++
++	/*If on water, return 0: */
++	if(NoIceInElement())return 0;
++
++	/*Retrieve all inputs we will be needing: */
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	Input* weights_input     =inputs->GetInput(weightsenum);     _assert_(weights_input);
++
++	/* Start  looping on the number of gaussian points: */
++	gauss=new GaussTria(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++
++		/* Get Jacobian determinant: */
++		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
++
++		/*Get parameters at gauss point*/
++		weights_input->GetInputValue(&weight,gauss);
++
++		/*compute misfit between model and observation */
++		Jelem+=Jdet*weight*gauss->weight;
++	}
++
++	/* clean up and Return: */
++	delete gauss;
++	return Jelem;
++}
++/*}}}*/
+ /*FUNCTION Tria::Misfit{{{*/
+ IssmDouble Tria::Misfit(int modelenum,int observationenum,int weightsenum){
+ 
+@@ -2916,7 +2957,7 @@
+ 		weights_input->GetInputValue(&weight,gauss);
+ 
+ 		/*compute misfit between model and observation */
+-		Jelem+=0.5*(model-observation)*(model-observation)*weight*Jdet*gauss->weight;
++		Jelem+=0.5*(model-observation)*(model-observation)*Jdet*weight*gauss->weight;
+ 	}
+ 
+ 	/* clean up and Return: */
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17046)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17047)
+@@ -151,6 +151,7 @@
+ 		void       MaxVy(IssmDouble* pmaxvy);
+ 		void       MaxVz(IssmDouble* pmaxvz);
+ 		IssmDouble Misfit(int modelenum,int observationenum,int weightsenum);
++		IssmDouble MisfitArea(int weightsenum);
+ 		#endif
+ 
+ 		#ifdef _HAVE_GIA_
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17046)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17047)
+@@ -183,6 +183,7 @@
+ 		IssmDouble BalancethicknessMisfit(void){_error_("not supported");};
+ 		void   InputControlUpdate(IssmDouble scalar,bool save_parameter);
+ 		IssmDouble Misfit(int modelenum,int observationenum,int weightsenum){_error_("not implemented yet");};
++		IssmDouble MisfitArea(int weightsenum){_error_("not implemented yet");};
+ 		#endif
+ 
+ 		#ifdef _HAVE_GROUNDINGLINE_
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17046)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17047)
+@@ -205,6 +205,7 @@
+ 		void       MaxVy(IssmDouble* pmaxvy){_error_("not implemented yet");};
+ 		void       MaxVz(IssmDouble* pmaxvz){_error_("not implemented yet");};
+ 		IssmDouble Misfit(int modelenum,int observationenum,int weightsenum){_error_("not implemented yet");};
++		IssmDouble MisfitArea(int weightsenum){_error_("not implemented yet");};
+ #endif
+ 
+ #ifdef _HAVE_GIA_
Index: issm/oecreview/Archive/16554-17801/ISSM-17047-17048.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17047-17048.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17047-17048.diff	(revision 17802)
@@ -0,0 +1,37 @@
+Index: ../trunk-jpl/src/c/classes/Misfit.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Misfit.h	(revision 17047)
++++ ../trunk-jpl/src/c/classes/Misfit.h	(revision 17048)
+@@ -115,7 +115,8 @@
+ 			 IssmDouble misfit_t=0;
+ 			 IssmDouble all_misfit_t=0;
+ 			 IssmDouble dt;
+-			 IssmDouble area;
++			 IssmDouble area_t;
++			 IssmDouble all_area_t;
+ 			 IssmDouble time,starttime,finaltime;
+ 
+ 			 femmodel->parameters->FindParam(&starttime,TimesteppingStartTimeEnum);
+@@ -125,17 +126,20 @@
+ 			 /*If we are locked, return time average: */
+ 			 if(this->lock)return misfit/(time-starttime);
+ 
++
+ 			 for(i=0;i<femmodel->elements->Size();i++){
+ 				 Element* element=(Element*)femmodel->elements->GetObjectByOffset(i);
+ 				 misfit_t+=element->Misfit(model_enum,observation_enum,weights_enum);
++				 area_t+=element->MisfitArea(weights_enum);
+ 			 }
+ 
+ 			 ISSM_MPI_Allreduce ( (void*)&misfit_t,(void*)&all_misfit_t,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,IssmComm::GetComm());
++			 ISSM_MPI_Allreduce ( (void*)&area_t,(void*)&all_area_t,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,IssmComm::GetComm());
++			 area_t=all_area_t;
+ 			 misfit_t=all_misfit_t;
+ 			 
+ 			 /*Divide by surface area: */
+-			 SurfaceAreax(&area,femmodel);
+-			 misfit_t=misfit_t/area;
++			 misfit_t=misfit_t/area_t;
+ 
+ 			 /*Recover delta_t: */
+ 			 femmodel->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
Index: issm/oecreview/Archive/16554-17801/ISSM-17048-17049.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17048-17049.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17048-17049.diff	(revision 17802)
@@ -0,0 +1,23 @@
+Index: ../trunk-jpl/src/m/solve/waitonlock.m
+===================================================================
+--- ../trunk-jpl/src/m/solve/waitonlock.m	(revision 17048)
++++ ../trunk-jpl/src/m/solve/waitonlock.m	(revision 17049)
+@@ -15,9 +15,16 @@
+ executionpath = md.cluster.executionpath;
+ timelimit     = md.settings.waitonlock;
+ cluster       = md.cluster;
+-lockfilename  = [executionpath '/' md.private.runtimename '/' md.miscellaneous.name '.lock'];
+-logfilename   = [executionpath '/' md.private.runtimename '/' md.miscellaneous.name '.outlog'];
+ 
++if ~isa(cluster,'generic') & cluster.interactive,
++	lockfilename  = [executionpath '/Interactive' num2str(cluster.interactive) '/' md.miscellaneous.name '.lock'];
++	logfilename   = [executionpath '/Interactive' num2str(cluster.interactive) '/' md.miscellaneous.name '.outlog'];
++else
++	lockfilename  = [executionpath '/' md.private.runtimename '/' md.miscellaneous.name '.lock'];
++	logfilename   = [executionpath '/' md.private.runtimename '/' md.miscellaneous.name '.outlog'];
++end
++
++
+ %If we are using the generic cluster in interactive mode, job is already complete
+ if isa(cluster,'generic') & cluster.interactive
+ 	%We are in interactive mode, no need to check for job completion
Index: issm/oecreview/Archive/16554-17801/ISSM-17049-17050.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17049-17050.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17049-17050.diff	(revision 17802)
@@ -0,0 +1,65 @@
+Index: ../trunk-jpl/src/m/solve/solve.m
+===================================================================
+--- ../trunk-jpl/src/m/solve/solve.m	(revision 17049)
++++ ../trunk-jpl/src/m/solve/solve.m	(revision 17050)
+@@ -32,7 +32,9 @@
+ cluster=md.cluster;
+ 
+ %check model consistency
+-disp('checking model consistency');
++if md.verbose.solution,
++	disp('checking model consistency');
++end
+ if (solutionenum == FlaimSolutionEnum())
+ 	md.private.isconsistent=true;
+ 	md=checkconsistency(md.mesh,md,solutionenum);
+@@ -74,8 +76,10 @@
+ 
+ %Stop here if batch mode
+ if strcmpi(options.batch,'yes')
+-	disp('batch mode requested: not launching job interactively');
+-	disp('launch solution sequence on remote cluster by hand');
++	if md.verbose.solution,
++		disp('batch mode requested: not launching job interactively');
++		disp('launch solution sequence on remote cluster by hand');
++	end
+ 	return;
+ end
+ 
+@@ -95,7 +99,9 @@
+ 
+ %did we even try to run? if so, wait on lock
+ if strcmpi(options.upload,'on'),
+-	disp('solve done uploading test decks');
++	if md.verbose.solution,
++		disp('solve done uploading test decks');
++	end
+ 	return;
+ end
+ 
+@@ -112,7 +118,9 @@
+ elseif md.settings.waitonlock>0,
+ 	%we wait for the done file
+ 	done=waitonlock(md);
+-	disp('loading results from cluster');
++	if md.verbose.solution,
++		disp('loading results from cluster');
++	end
+ 	md=loadresultsfromcluster(md);
+ elseif md.settings.waitonlock==0,
+ 	 disp('Model results must be loaded manually with md=loadresultsfromcluster(md);');
+Index: ../trunk-jpl/src/m/solve/marshall.m
+===================================================================
+--- ../trunk-jpl/src/m/solve/marshall.m	(revision 17049)
++++ ../trunk-jpl/src/m/solve/marshall.m	(revision 17050)
+@@ -7,7 +7,9 @@
+ %   Usage:
+ %      marshall(md)
+ 
+-disp(['marshalling file ' md.miscellaneous.name '.bin']);
++if md.verbose.solution,
++	disp(['marshalling file ' md.miscellaneous.name '.bin']);
++end
+ 
+ %open file for binary writing
+ fid=fopen([ md.miscellaneous.name '.bin'],'wb');
Index: issm/oecreview/Archive/16554-17801/ISSM-17050-17051.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17050-17051.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17050-17051.diff	(revision 17802)
@@ -0,0 +1,43 @@
+Index: ../trunk-jpl/src/m/classes/friction.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/friction.py	(revision 17050)
++++ ../trunk-jpl/src/m/classes/friction.py	(revision 17051)
+@@ -37,7 +37,7 @@
+ 		if StressbalanceAnalysisEnum() not in analyses and ThermalAnalysisEnum() not in analyses:
+ 			return md
+ 
+-		md = checkfield(md,'fieldname','friction.coefficient','NaN',1,'size',[md.mesh.numberofvertices])
++		md = checkfield(md,'fieldname','friction.coefficient','forcing',1,'NaN',1)
+ 		md = checkfield(md,'fieldname','friction.q','NaN',1,'size',[md.mesh.numberofelements])
+ 		md = checkfield(md,'fieldname','friction.p','NaN',1,'size',[md.mesh.numberofelements])
+ 
+Index: ../trunk-jpl/src/m/classes/friction.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/friction.m	(revision 17050)
++++ ../trunk-jpl/src/m/classes/friction.m	(revision 17051)
+@@ -25,8 +25,7 @@
+ 
+ 			%Early return
+ 			if ~ismember(StressbalanceAnalysisEnum(),analyses) & ~ismember(ThermalAnalysisEnum(),analyses), return; end
+-
+-			md = checkfield(md,'fieldname','friction.coefficient','NaN',1,'size',[md.mesh.numberofvertices 1]);
++			md = checkfield(md,'fieldname','friction.coefficient','forcing',1,'NaN',1);
+ 			md = checkfield(md,'fieldname','friction.q','NaN',1,'size',[md.mesh.numberofelements 1]);
+ 			md = checkfield(md,'fieldname','friction.p','NaN',1,'size',[md.mesh.numberofelements 1]);
+ 		end % }}}
+@@ -37,9 +36,14 @@
+ 			fielddisplay(obj,'q','q exponent');
+ 		end % }}}
+ 		function marshall(obj,md,fid) % {{{
+-			WriteData(fid,'object',obj,'fieldname','coefficient','format','DoubleMat','mattype',1);
++			yts=365.0*24.0*3600.0;
++
++			WriteData(fid,'object',obj,'fieldname','coefficient','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
++			%WriteData(fid,'object',obj,'fieldname','coefficient','format','DoubleMat','mattype',1);
+ 			WriteData(fid,'object',obj,'fieldname','p','format','DoubleMat','mattype',2);
+ 			WriteData(fid,'object',obj,'fieldname','q','format','DoubleMat','mattype',2);
++			
++
+ 		end % }}}
+ 	end
+ end
Index: issm/oecreview/Archive/16554-17801/ISSM-17051-17052.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17051-17052.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17051-17052.diff	(revision 17802)
@@ -0,0 +1,33 @@
+Index: ../trunk-jpl/src/m/classes/clusters/generic.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/clusters/generic.m	(revision 17051)
++++ ../trunk-jpl/src/m/classes/clusters/generic.m	(revision 17052)
+@@ -18,6 +18,7 @@
+ 		valgrind=[issmdir() '/externalpackages/valgrind/install/bin/valgrind'];
+ 		valgrindlib=[issmdir() '/externalpackages/valgrind/install/lib/libmpidebug.so'];
+ 		valgrindsup=[issmdir() '/externalpackages/valgrind/issm.supp'];
++		verbose=1;
+ 		%}}}
+ 	end
+ 	methods
+@@ -49,6 +50,7 @@
+ 			disp(sprintf('    valgrind: %s',cluster.valgrind));
+ 			disp(sprintf('    valgrindlib: %s',cluster.valgrindlib));
+ 			disp(sprintf('    valgrindsup: %s',cluster.valgrindsup));
++			disp(sprintf('    verbose: %s',cluster.verbose));
+ 		end
+ 		%}}}
+ 		function md = checkconsistency(cluster,md,solution,analyses) % {{{
+@@ -191,10 +193,10 @@
+ 				end
+ 				system(compressstring);
+ 
+-				disp('uploading input file and queueing script');
++				if cluster.verbose, disp('uploading input file and queueing script'); end
+ 				issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
+ 
+-				disp('launching solution sequence on remote cluster');
++				if cluster.verbose, disp('launching solution sequence on remote cluster'); end
+ 				launchcommand=['source ' cluster.etcpath '/environment.sh && cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
+ 					' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && source  ' modelname '.queue '];
+ 				issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
Index: issm/oecreview/Archive/16554-17801/ISSM-17052-17053.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17052-17053.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17052-17053.diff	(revision 17802)
@@ -0,0 +1,37 @@
+Index: ../trunk-jpl/src/m/classes/misfit.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/misfit.m	(revision 17052)
++++ ../trunk-jpl/src/m/classes/misfit.m	(revision 17053)
+@@ -17,11 +17,12 @@
+ 		%misfit
+ 		name              = '';
+ 		model_enum        = NaN; %enum for field that is modeled
+-		observation      = NaN; %observed field that we compare the model against
+-		observation_enum = NaN; %enum for observed field.
++		observation       = NaN; %observed field that we compare the model against
++		observation_enum  = NaN; %enum for observed field.
+ 		timeinterpolation = '';
+ 		weights           = NaN; %weight coefficients for every vertex
+ 		weights_enum      = NaN; %enum to identify this particular set of weights
++		cumulated         = NaN; %do we cumulate misfit through time?
+ 	end
+ 	
+ 	methods
+@@ -57,7 +58,7 @@
+ 			end
+ 			md = checkfield(md,'fieldname','obj.observation','field',obj.observation,'forcing',1,'NaN',1);
+ 			md = checkfield(md,'fieldname','obj.timeinterpolation','field',obj.timeinterpolation,'values',{'nearestneighbor'});
+-			md = checkfield(md,'fieldname','obj.weights','field',obj.weights,'size',[md.mesh.numberofvertices 1],'>=',0,'<=',1);
++			md = checkfield(md,'fieldname','obj.weights','field',obj.weights,'forcing',1,'NaN',1);
+ 
+ 		end % }}}
+ 		function md = disp(obj) % {{{
+@@ -80,7 +81,7 @@
+ 		WriteData(fid,'object',obj,'fieldname','observation','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
+ 		WriteData(fid,'object',obj,'fieldname','observation_enum','format','Integer');
+ 		WriteData(fid,'object',obj,'fieldname','timeinterpolation','format','String');
+-		WriteData(fid,'object',obj,'fieldname','weights','format','DoubleMat','mattype',1);
++		WriteData(fid,'object',obj,'fieldname','weights','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
+ 		WriteData(fid,'object',obj,'fieldname','weights_enum','format','Integer');
+ 
+ 		end % }}}
Index: issm/oecreview/Archive/16554-17801/ISSM-17053-17054.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17053-17054.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17053-17054.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/solvers/gcrbjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gcrbjacobioptions.m	(revision 17053)
++++ ../trunk-jpl/src/m/solvers/gcrbjacobioptions.m	(revision 17054)
+@@ -6,7 +6,7 @@
+ solverOptions.toolkit='petsc';
+ 
+ 
+-PETSC_VERSION=petscversion();
++PETSC_VERSION=IssmConfig('_PETSC_MAJOR_');
+ if PETSC_VERSION==3,
+    solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
+    solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gcr');
Index: issm/oecreview/Archive/16554-17801/ISSM-17054-17055.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17054-17055.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17054-17055.diff	(revision 17802)
@@ -0,0 +1,168 @@
+Index: ../trunk-jpl/src/c/modules/OutputResultsx/OutputResultsx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/OutputResultsx/OutputResultsx.cpp	(revision 17054)
++++ ../trunk-jpl/src/c/modules/OutputResultsx/OutputResultsx.cpp	(revision 17055)
+@@ -41,7 +41,7 @@
+ 	if(my_rank==0){
+ 		femmodel->parameters->FindParam(&solutiontype,SolutionTypeEnum);
+ 		EnumToStringx(&solutiontypestring,solutiontype);
+-		femmodel->results->AddResult(new GenericExternalResult<char*>(femmodel->results->Size()+1,SolutionTypeEnum,solutiontypestring,1,0));
++		femmodel->results->AddResult(new GenericExternalResult<char*>(femmodel->results->Size()+1,SolutionTypeEnum,solutiontypestring,1));
+ 		xDelete<char>(solutiontypestring);
+ 	}
+ 
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17054)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17055)
+@@ -116,8 +116,8 @@
+ 	parameters->AddObject(new IntParam(SolutionTypeEnum,solution_type));
+ 
+ 	iomodel->Constant(&time,TimesteppingStartTimeEnum);
+-	parameters->AddObject(new DoubleParam(TimeEnum,time));  //start at time 0 by default for all solutions FIXME: to be deleted
+-	parameters->AddObject(new IntParam(StepEnum,1));  //start at time 0 by default for all solutions FIXME: to be deleted
++	parameters->AddObject(new DoubleParam(TimeEnum,time));  
++	parameters->AddObject(new IntParam(StepEnum,1));  
+ 
+ 	/*By default, save all results*/
+ 	parameters->AddObject(new BoolParam(SaveResultsEnum,true));
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_newton.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_newton.cpp	(revision 17054)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_newton.cpp	(revision 17055)
+@@ -85,18 +85,20 @@
+ 		convergence(&converged,Kff,pf,uf,old_uf,femmodel->parameters); 
+ 		delete Kff; delete pf;
+ 		if(converged==true){	
++			int step; IssmDouble time;
+ 			bool max_iteration_state=false;
+-			int tempStep=1;
+-			IssmDouble tempTime=1.0;
+-			femmodel->results->AddObject(new GenericExternalResult<bool>(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, tempStep, tempTime));
++			femmodel->parameters->FindParam(&time,TimeEnum);
++			femmodel->parameters->FindParam(&step,StepEnum);
++			femmodel->results->AddObject(new GenericExternalResult<bool>(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, step,time));
+ 			break;
+ 		}
+ 		if(count>=max_nonlinear_iterations){
+ 			_printf0_("   maximum number of Newton iterations (" << max_nonlinear_iterations << ") exceeded\n"); 
++			int step; IssmDouble time;
+ 			bool max_iteration_state=true;
+-			int tempStep=1;
+-			IssmDouble tempTime=1.0;
+-			femmodel->results->AddObject(new GenericExternalResult<bool>(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, tempStep, tempTime));
++			femmodel->parameters->FindParam(&time,TimeEnum);
++			femmodel->parameters->FindParam(&step,StepEnum);
++			femmodel->results->AddObject(new GenericExternalResult<bool>(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, step, time));
+ 			break;
+ 		}
+ 
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_nonlinear.cpp	(revision 17054)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_nonlinear.cpp	(revision 17055)
+@@ -84,9 +84,10 @@
+ 		count++;
+ 		if(converged==true){
+ 			bool max_iteration_state=false;
+-			int tempStep=1;
+-			IssmDouble tempTime=1.0;
+-			femmodel->results->AddObject(new GenericExternalResult<bool>(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, tempStep, tempTime));
++			int step; IssmDouble time;
++			femmodel->parameters->FindParam(&time,TimeEnum);
++			femmodel->parameters->FindParam(&step,StepEnum);
++			femmodel->results->AddObject(new GenericExternalResult<bool>(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, step, time));
+ 			break;
+ 		}
+ 		if(count>=max_nonlinear_iterations){
+@@ -95,9 +96,10 @@
+ 			InputUpdateFromConstantx(femmodel,converged,ConvergedEnum);
+ 			InputUpdateFromSolutionx(femmodel,ug);		
+ 			bool max_iteration_state=true;
+-			int tempStep=1;
+-			IssmDouble tempTime=1.0;
+-			femmodel->results->AddObject(new GenericExternalResult<bool>(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, tempStep, tempTime));
++			int step; IssmDouble time;
++			femmodel->parameters->FindParam(&time,TimeEnum);
++			femmodel->parameters->FindParam(&step,StepEnum);
++			femmodel->results->AddObject(new GenericExternalResult<bool>(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, step, time));
+ 			break;
+ 		}
+ 	}
+Index: ../trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h	(revision 17054)
++++ ../trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h	(revision 17055)
+@@ -82,6 +82,16 @@
+ 			EnumToStringx(&this->result_name,in_enum_type);
+ 		}
+ 		/*}}}*/
++		GenericExternalResult(int in_id, int in_enum_type,ResultType in_value,int in_step){ /*{{{*/
++			id        = in_id;
++			value     = in_value;
++			step      = in_step;
++			time      = UNDEF;
++
++			/*Convert enum to name*/
++			EnumToStringx(&this->result_name,in_enum_type);
++		}
++		/*}}}*/
+ 		GenericExternalResult(int in_id,const char* in_result_name,ResultType in_value,int in_step, IssmDouble in_time){ /*{{{*/
+ 			id        = in_id;
+ 			value     = in_value;
+@@ -211,6 +221,18 @@
+ 	EnumToStringx(&this->result_name,in_enum_type);
+ 
+ } /*}}}*/
++template <> inline GenericExternalResult<char*>::GenericExternalResult(int in_id, int in_enum_type,char* in_value,int in_step){ /*{{{*/
++
++	id = in_id;
++	value = xNew<char>(strlen(in_value)+1);
++	xMemCpy<char>(value,in_value,(strlen(in_value)+1));
++	step  = in_step;
++	time  = UNDEF;
++
++	/*Convert enum to name*/
++	EnumToStringx(&this->result_name,in_enum_type);
++
++} /*}}}*/
+ template <> inline GenericExternalResult<char*>::~GenericExternalResult(){ /*{{{*/
+ 	xDelete<char>(result_name);
+ 	xDelete<char>(value);
+Index: ../trunk-jpl/src/m/solve/parseresultsfromdisk.m
+===================================================================
+--- ../trunk-jpl/src/m/solve/parseresultsfromdisk.m	(revision 17054)
++++ ../trunk-jpl/src/m/solve/parseresultsfromdisk.m	(revision 17055)
+@@ -44,7 +44,9 @@
+ 		index = counter;
+ 	end
+ 	results(index).step=result.step;
+-	results(index).time=result.time; 
++	if result.time~=-9999,
++		results(index).time=result.time; 
++	end
+ 	results(index).(result.fieldname)=result.field;
+ 
+ 	%read next result
+@@ -79,7 +81,9 @@
+ 
+ 	%Get time and step
+ 	results(result.step).step=result.step;
+-	results(result.step).time=result.time; 
++	if result.time~=-9999,
++		results(result.step).time=result.time; 
++	end
+ 
+ 	%Add result
+ 	results(result.step).(result.fieldname)=NaN;
+@@ -103,7 +107,9 @@
+ 
+ 	%Get time and step
+ 	results(result.step).step=result.step;
+-	results(result.step).time=result.time; 
++	if result.time~=-9999,
++		results(result.step).time=result.time; 
++	end
+ 
+ 	%Add result
+ 	results(result.step).(result.fieldname)=result.field;
Index: issm/oecreview/Archive/16554-17801/ISSM-17055-17056.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17055-17056.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17055-17056.diff	(revision 17802)
@@ -0,0 +1,18 @@
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17055)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17056)
+@@ -1985,11 +1985,11 @@
+ 			/*Nodal function 11*/	
+ 			dbasis[NUMNODESP1xP3*0+10] = - (27./32.) *(zeta-1)*(zeta+1./3.)*(zeta+1);
+ 			dbasis[NUMNODESP1xP3*1+10] = ((9.*SQRT3)/32.)  *(zeta-1.)*(zeta+1./3.)*(zeta+1);
+-			dbasis[NUMNODESP1xP3*2+10] = -gauss->coord2 *(27./16.) * 2.* zeta *( zeta + (1./3.) + ( zeta - 1. )*( zeta + 1. ));
++			dbasis[NUMNODESP1xP3*2+10] = -gauss->coord2 *(27./16.) *( 2.* zeta *( zeta + (1./3.)) + ( zeta - 1. )*( zeta + 1. ));
+ 			/*Nodal function 12*/	
+ 			dbasis[NUMNODESP1xP3*0+11] = 0.;
+ 			dbasis[NUMNODESP1xP3*1+11] = -((9.*SQRT3)/16.) *(zeta-1.)*(zeta+1./3.)*(zeta+1);
+-			dbasis[NUMNODESP1xP3*2+11] = -gauss->coord3 *(27./16.)* 2.* zeta *( zeta + (1./3.) + ( zeta - 1. )*( zeta + 1. ));
++			dbasis[NUMNODESP1xP3*2+11] = -gauss->coord3 *(27./16.)*( 2.* zeta *( zeta + (1./3.)) + ( zeta - 1. )*( zeta + 1. ));
+ 			return;
+ 		default:
+ 			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
Index: issm/oecreview/Archive/16554-17801/ISSM-17056-17057.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17056-17057.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17056-17057.diff	(revision 17802)
@@ -0,0 +1,171 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17056)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17057)
+@@ -140,6 +140,49 @@
+ 				}
+ 			}
+ 			break;
++		case P2xP4Enum:
++			EdgesPartitioning(&my_edges,iomodel);
++			for(i=0;i<iomodel->numberofvertices;i++){
++				if(iomodel->my_vertices[i]){
++					nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,lid++,i,iomodel,analysis,approximation));
++				}
++			}
++			counter = iomodel->numberofvertices;
++			for(i=0;i<iomodel->numberofedges;i++){
++				if(iomodel->edges[i*3+2]==2){/*Vertical edges*/
++					if(my_edges[i]){
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
++						nodes->AddObject(node);
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+2,counter+2,lid++,0,iomodel,analysis,approximation);
++						nodes->AddObject(node);
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+3,counter+3,lid++,0,iomodel,analysis,approximation);
++						nodes->AddObject(node);
++					}
++				}
++				else if(iomodel->edges[i*3+2]==1){/*Basal edges*/
++					if(my_edges[i]){
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
++						nodes->AddObject(node);
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+2,counter+1,lid++,0,iomodel,analysis,approximation);
++						nodes->AddObject(node);
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+3,counter+1,lid++,0,iomodel,analysis,approximation);
++						nodes->AddObject(node);
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+4,counter+1,lid++,0,iomodel,analysis,approximation);
++						nodes->AddObject(node);
++					}
++				}
++				else if(iomodel->edges[i*3+2]==3){/*Top edges*/
++					if(my_edges[i]){
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
++						nodes->AddObject(node);
++					}
++				}
++				else{
++					_error_("not supported");
++				}
++				counter=counter+4;
++			}
++			break;
+ 
+ 		/*Stokes elements*/
+ 		case P1P1Enum:
+Index: ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17056)
++++ ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17057)
+@@ -110,6 +110,17 @@
+ 					}
+ 				}
+ 				break;
++			case P2xP4Enum:
++				for(i=0;i<iomodel->numberofvertices;i++){
++					if((iomodel->my_vertices[i])){
++						if (!xIsNan<IssmDouble>(spcdata[i])){
++							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,dof,spcdata[i],analysis_type));
++							count++;
++						}
++					}
++				}
++				_printf0_("WARNING: Skipping constraints along edges\n");
++				break;
+ 			case P1bubbleEnum:
+ 				for(i=0;i<iomodel->numberofvertices;i++){
+ 					if((iomodel->my_vertices[i])){
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17056)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17057)
+@@ -2800,6 +2800,40 @@
+ 			penta_node_ids[10]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[9*index+7]+1;
+ 			penta_node_ids[11]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[9*index+8]+1;
+ 			break;
++		case P2xP4Enum:
++			numnodes         = 30;
++			penta_node_ids   = xNew<int>(numnodes);
++			penta_node_ids[ 0]=iomodel->nodecounter+iomodel->elements[6*index+0];
++			penta_node_ids[ 1]=iomodel->nodecounter+iomodel->elements[6*index+1];
++			penta_node_ids[ 2]=iomodel->nodecounter+iomodel->elements[6*index+2];
++			penta_node_ids[ 3]=iomodel->nodecounter+iomodel->elements[6*index+3];
++			penta_node_ids[ 4]=iomodel->nodecounter+iomodel->elements[6*index+4];
++			penta_node_ids[ 5]=iomodel->nodecounter+iomodel->elements[6*index+5];
++			penta_node_ids[ 6]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+0]+1;
++			penta_node_ids[ 7]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+1]+1;
++			penta_node_ids[ 8]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+2]+1;
++			penta_node_ids[ 9]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+3]+1;
++			penta_node_ids[10]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+4]+1;
++			penta_node_ids[11]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+5]+1;
++			penta_node_ids[12]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+6]+1;
++			penta_node_ids[13]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+7]+1;
++			penta_node_ids[14]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+8]+1;
++			penta_node_ids[15]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+0]+2;
++			penta_node_ids[16]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+1]+2;
++			penta_node_ids[17]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+2]+2;
++			penta_node_ids[18]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+0]+3;
++			penta_node_ids[19]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+1]+3;
++			penta_node_ids[20]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+2]+3;
++			penta_node_ids[21]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+3]+2;
++			penta_node_ids[22]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+4]+2;
++			penta_node_ids[23]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+5]+2;
++			penta_node_ids[24]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+3]+3;
++			penta_node_ids[25]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+4]+3;
++			penta_node_ids[26]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+5]+3;
++			penta_node_ids[27]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+3]+4;
++			penta_node_ids[28]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+4]+4;
++			penta_node_ids[29]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+5]+4;
++			break;
+ 		case P2Enum:
+ 			numnodes         = 15;
+ 			penta_node_ids   = xNew<int>(numnodes);
+Index: ../trunk-jpl/src/c/classes/gauss/GaussPenta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussPenta.cpp	(revision 17056)
++++ ../trunk-jpl/src/c/classes/gauss/GaussPenta.cpp	(revision 17057)
+@@ -656,6 +656,45 @@
+ 				default: _error_("node index should be in [0 14]");
+ 			}
+ 			break;
++		case P2xP4Enum:
++			switch(iv){
++				case 0: coord1=1.; coord2=0.; coord3=0.; coord4=-1.; break;
++				case 1: coord1=0.; coord2=1.; coord3=0.; coord4=-1.; break;
++				case 2: coord1=0.; coord2=0.; coord3=1.; coord4=-1.; break;
++				case 3: coord1=1.; coord2=0.; coord3=0.; coord4=+1.; break;
++				case 4: coord1=0.; coord2=1.; coord3=0.; coord4=+1.; break;
++				case 5: coord1=0.; coord2=0.; coord3=1.; coord4=+1.; break;
++
++				case 6: coord1=1.; coord2=0.; coord3=0.; coord4=0.; break;
++				case 7: coord1=0.; coord2=1.; coord3=0.; coord4=0.; break;
++				case 8: coord1=0.; coord2=0.; coord3=1.; coord4=0.; break;
++
++				case  9: coord1=0.; coord2=.5; coord3=.5; coord4=-1.;break;
++				case 10: coord1=.5; coord2=0.; coord3=.5; coord4=-1.;break;
++				case 11: coord1=.5; coord2=.5; coord3=0.; coord4=-1.;break;
++				case 12: coord1=0.; coord2=.5; coord3=.5; coord4=+1.;break;
++				case 13: coord1=.5; coord2=0.; coord3=.5; coord4=+1.;break;
++				case 14: coord1=.5; coord2=.5; coord3=0.; coord4=+1.;break;
++
++				case 15: coord1=1.; coord2=0.; coord3=0.; coord4=-.5; break;
++				case 16: coord1=0.; coord2=1.; coord3=0.; coord4=-.5; break;
++				case 17: coord1=0.; coord2=0.; coord3=1.; coord4=-.5; break;
++				case 18: coord1=1.; coord2=0.; coord3=0.; coord4=+.5; break;
++				case 19: coord1=0.; coord2=1.; coord3=0.; coord4=+.5; break;
++				case 20: coord1=0.; coord2=0.; coord3=1.; coord4=+.5; break;
++
++				case 21: coord1=0.; coord2=.5; coord3=.5; coord4=-.5;break;
++				case 22: coord1=.5; coord2=0.; coord3=.5; coord4=-.5;break;
++				case 23: coord1=.5; coord2=.5; coord3=0.; coord4=-.5;break;
++				case 24: coord1=0.; coord2=.5; coord3=.5; coord4=0.;break;
++				case 25: coord1=.5; coord2=0.; coord3=.5; coord4=0.;break;
++				case 26: coord1=.5; coord2=.5; coord3=0.; coord4=0.;break;
++				case 27: coord1=0.; coord2=.5; coord3=.5; coord4=+.5;break;
++				case 28: coord1=.5; coord2=0.; coord3=.5; coord4=+.5;break;
++				case 29: coord1=.5; coord2=.5; coord3=0.; coord4=+.5;break;
++				default: _error_("node index should be in [0 14]");
++			}
++			break;
+ 		default: _error_("Finite element "<<EnumToStringx(finiteelement)<<" not supported");
+ 	}
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17057-17058.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17057-17058.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17057-17058.diff	(revision 17802)
@@ -0,0 +1,171 @@
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17057)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17058)
+@@ -1372,35 +1372,35 @@
+ 			basis[ 4]=(2./3.)*gauss->coord2*(2.*gauss->coord2-1.)*(zeta-0.5)*(zeta)*(zeta+0.5)*(zeta +1.);
+ 			basis[ 5]=(2./3.)*gauss->coord3*(2.*gauss->coord3-1.)*(zeta-0.5)*(zeta)*(zeta+0.5)*(zeta +1.);
+ 			/*mid-sides of quads*/
+-			basis[ 6]=4.*gauss->coord1*(zeta-1.)*(zeta-0.5)*(zeta+0.5)*(zeta+1.);
+-			basis[ 7]=4.*gauss->coord2*(zeta-1.)*(zeta-0.5)*(zeta+0.5)*(zeta+1.);
+-			basis[ 8]=4.*gauss->coord3*(zeta-1.)*(zeta-0.5)*(zeta+0.5)*(zeta+1.);
++			basis[ 6]=4.*gauss->coord1*(2.*gauss->coord1-1)*(zeta-1.)*(zeta-0.5)*(zeta+0.5)*(zeta+1.);
++			basis[ 7]=4.*gauss->coord2*(2.*gauss->coord2-1)*(zeta-1.)*(zeta-0.5)*(zeta+0.5)*(zeta+1.);
++			basis[ 8]=4.*gauss->coord3*(2.*gauss->coord3-1)*(zeta-1.)*(zeta-0.5)*(zeta+0.5)*(zeta+1.);
+ 			/*mid-sides of triangles*/
+-			basis[ 9]=(2./3.)*gauss->coord2*gauss->coord3*(zeta-1.)*(zeta-0.5)*zeta*(zeta+0.5);
+-			basis[10]=(2./3.)*gauss->coord1*gauss->coord3*(zeta-1.)*(zeta-0.5)*zeta*(zeta+0.5);
+-			basis[11]=(2./3.)*gauss->coord1*gauss->coord2*(zeta-1.)*(zeta-0.5)*zeta*(zeta+0.5);
+-			basis[12]=(2./3.)*gauss->coord2*gauss->coord3*(zeta-0.5)*zeta*(zeta+0.5)*(zeta+1.);
+-			basis[13]=(2./3.)*gauss->coord1*gauss->coord3*(zeta-0.5)*zeta*(zeta+0.5)*(zeta+1.);
+-			basis[14]=(2./3.)*gauss->coord1*gauss->coord2*(zeta-0.5)*zeta*(zeta+0.5)*(zeta+1.);
++			basis[ 9]=(8./3.)*gauss->coord2*gauss->coord3*(zeta-1.)*(zeta-0.5)*zeta*(zeta+0.5);
++			basis[10]=(8./3.)*gauss->coord1*gauss->coord3*(zeta-1.)*(zeta-0.5)*zeta*(zeta+0.5);
++			basis[11]=(8./3.)*gauss->coord1*gauss->coord2*(zeta-1.)*(zeta-0.5)*zeta*(zeta+0.5);
++			basis[12]=(8./3.)*gauss->coord2*gauss->coord3*(zeta-0.5)*zeta*(zeta+0.5)*(zeta+1.);
++			basis[13]=(8./3.)*gauss->coord1*gauss->coord3*(zeta-0.5)*zeta*(zeta+0.5)*(zeta+1.);
++			basis[14]=(8./3.)*gauss->coord1*gauss->coord2*(zeta-0.5)*zeta*(zeta+0.5)*(zeta+1.);
+ 			/*quarter-sides of quads*/
+-			basis[15]=-(2./3.)*gauss->coord1*(zeta-1.0)*(zeta-0.5)*zeta*(zeta+1.);
+-			basis[16]=-(2./3.)*gauss->coord2*(zeta-1.0)*(zeta-0.5)*zeta*(zeta+1.);
+-			basis[17]=-(2./3.)*gauss->coord3*(zeta-1.0)*(zeta-0.5)*zeta*(zeta+1.);
+-			basis[18]=-(2./3.)*gauss->coord1*(zeta-1.0)*zeta*(zeta+0.5)*(zeta+1.);
+-			basis[19]=-(2./3.)*gauss->coord2*(zeta-1.0)*zeta*(zeta+0.5)*(zeta+1.);
+-			basis[20]=-(2./3.)*gauss->coord3*(zeta-1.0)*zeta*(zeta+0.5)*(zeta+1.);
++			basis[15]=-(8./3.)*gauss->coord1*(2.*gauss->coord1-1.)*(zeta-1.0)*(zeta-0.5)*zeta*(zeta+1.);
++			basis[16]=-(8./3.)*gauss->coord2*(2.*gauss->coord2-1.)*(zeta-1.0)*(zeta-0.5)*zeta*(zeta+1.);
++			basis[17]=-(8./3.)*gauss->coord3*(2.*gauss->coord3-1.)*(zeta-1.0)*(zeta-0.5)*zeta*(zeta+1.);
++			basis[18]=-(8./3.)*gauss->coord1*(2.*gauss->coord1-1.)*(zeta-1.0)*zeta*(zeta+0.5)*(zeta+1.);
++			basis[19]=-(8./3.)*gauss->coord2*(2.*gauss->coord2-1.)*(zeta-1.0)*zeta*(zeta+0.5)*(zeta+1.);
++			basis[20]=-(8./3.)*gauss->coord3*(2.*gauss->coord3-1.)*(zeta-1.0)*zeta*(zeta+0.5)*(zeta+1.);
+ 			/* mid-sides of interior triangles*/
+-			basis[21]=-(8./3.)*gauss->coord2*gauss->coord3*(zeta-1.0)*(zeta-0.5)*zeta*(zeta+1.);
+-			basis[22]=-(8./3.)*gauss->coord1*gauss->coord3*(zeta-1.0)*(zeta-0.5)*zeta*(zeta+1.);
+-			basis[23]=-(8./3.)*gauss->coord1*gauss->coord2*(zeta-1.0)*(zeta-0.5)*zeta*(zeta+1.);
++			basis[21]=-(32./3.)*gauss->coord2*gauss->coord3*(zeta-1.0)*(zeta-0.5)*zeta*(zeta+1.);
++			basis[22]=-(32./3.)*gauss->coord1*gauss->coord3*(zeta-1.0)*(zeta-0.5)*zeta*(zeta+1.);
++			basis[23]=-(32./3.)*gauss->coord1*gauss->coord2*(zeta-1.0)*(zeta-0.5)*zeta*(zeta+1.);
+ 			basis[24]=16.*gauss->coord2*gauss->coord3*(zeta-1.0)*(zeta-0.5)*(zeta+0.5)*(zeta+1.);
+ 			basis[25]=16.*gauss->coord1*gauss->coord3*(zeta-1.0)*(zeta-0.5)*(zeta+0.5)*(zeta+1.);
+ 			basis[26]=16.*gauss->coord1*gauss->coord2*(zeta-1.0)*(zeta-0.5)*(zeta+0.5)*(zeta+1.);
+-			basis[27]=-(8./3.)*gauss->coord2*gauss->coord3*(zeta-1.0)*zeta*(zeta+0.5)*(zeta+1.);
+-			basis[28]=-(8./3.)*gauss->coord1*gauss->coord3*(zeta-1.0)*zeta*(zeta+0.5)*(zeta+1.);
+-			basis[29]=-(8./3.)*gauss->coord1*gauss->coord2*(zeta-1.0)*zeta*(zeta+0.5)*(zeta+1.);
++			basis[27]=-(32./3.)*gauss->coord2*gauss->coord3*(zeta-1.0)*zeta*(zeta+0.5)*(zeta+1.);
++			basis[28]=-(32./3.)*gauss->coord1*gauss->coord3*(zeta-1.0)*zeta*(zeta+0.5)*(zeta+1.);
++			basis[29]=-(32./3.)*gauss->coord1*gauss->coord2*(zeta-1.0)*zeta*(zeta+0.5)*(zeta+1.);
+ 			return;
+-		case P1xP3Enum :
++					case P1xP3Enum :
+ 			/*Corner nodes*/
+ 			basis[ 0]=-(9.)/(16.)*gauss->coord1*(zeta-1)*(zeta-1./3.)*(zeta+1./3.);	
+ 			basis[ 1]=-(9.)/(16.)*gauss->coord2*(zeta-1)*(zeta-1./3.)*(zeta+1./3.);	
+@@ -1838,24 +1838,24 @@
+ 			dbasis[NUMNODESP2xP4*2+3 ] = (2./3.)*gauss->coord1*(2.*gauss->coord1 -1.)*( (2.*zeta+1.)*(zeta -0.5)*(zeta +0.5) + 2.*zeta *zeta*(zeta +1.)); 
+ 			/*Nodal function 5*/
+ 			dbasis[NUMNODESP2xP4*0+4 ] = (2*gauss->coord2 - 0.5 ) *(2./3.) *(zeta - 0.5)*(zeta)*(zeta+0.5)*(zeta +1. ); 
+-			dbasis[NUMNODESP2xP4*1+4 ] = -((2.*SQRT3)/(3.)) *gauss->coord2 + (SQRT3/(6.))*(2./3.)*(zeta - 0.5)*(zeta)*(zeta+0.5)*(zeta +1. );
++			dbasis[NUMNODESP2xP4*1+4 ] = (-((2.*SQRT3)/(3.)) *gauss->coord2 + (SQRT3/6.))*(2./3.)*(zeta - 0.5)*(zeta)*(zeta+0.5)*(zeta +1. );
+ 			dbasis[NUMNODESP2xP4*2+4 ] = (2./3.)*gauss->coord2 *(2.*gauss->coord2 -1.)*( (2.*zeta+1.)*(zeta -0.5)*(zeta +0.5) + 2.*zeta *zeta*(zeta +1.)); 
+ 			/*Nodal function 6*/
+ 			dbasis[NUMNODESP2xP4*0+5 ] = 0. ; 
+ 			dbasis[NUMNODESP2xP4*1+5 ] = (((4.*SQRT3)/(3.))*gauss->coord3 - SQRT3/3. ) *(2./3.) *(zeta - 0.5)*(zeta)*(zeta+0.5)*(zeta +1. ); 
+ 			dbasis[NUMNODESP2xP4*2+5 ] = (2./3.)*gauss->coord3 *(2.*gauss->coord3 -1.)*( (2.*zeta+1.)*(zeta -0.5)*(zeta +0.5) + 2.*zeta *zeta*(zeta +1)); 
+ 			/*Nodal function 7*/
+-			dbasis[NUMNODESP2xP4*0+6 ] =  -2. *(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*1+6 ] =  (-4.*SQRT3)/(6.) *(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1.)  ; 
+-			dbasis[NUMNODESP2xP4*2+6 ] =  4.*gauss->coord1*( 4.*zeta *zeta*zeta - (5./2.)*zeta ); 
++			dbasis[NUMNODESP2xP4*0+6 ] =  4.*(-2.* gauss->coord1 + 0.5 ) *(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*1+6 ] =  4.*(-((2.*SQRT3)/(3.)) *gauss->coord1 + (SQRT3)/(6.) )*(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1.)  ; 
++			dbasis[NUMNODESP2xP4*2+6 ] =  4.*gauss->coord1*(2.*gauss->coord1-1)*( 4.*zeta *zeta*zeta - (5./2.)*zeta ); 
+ 			/*Nodal function 8*/
+-			dbasis[NUMNODESP2xP4*0+7 ] =  2.*(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*1+7 ] =  ((-4.*SQRT3)/(6.)) *(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. )  ; 
+-			dbasis[NUMNODESP2xP4*2+7 ] =  4.* gauss->coord2*( 4.*zeta *zeta*zeta - (5./2.)*zeta ); 
++			dbasis[NUMNODESP2xP4*0+7 ] =  4.*(2*gauss->coord2 - 0.5 )*(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*1+7 ] =  4.*(-((2.*SQRT3)/(3.)) *gauss->coord2 + (SQRT3)/(6.)) *(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. )  ; 
++			dbasis[NUMNODESP2xP4*2+7 ] =  4.*gauss->coord2*(2.*gauss->coord2-1)*( 4.*zeta *zeta*zeta - (5./2.)*zeta ); 
+ 			/*Nodal function 9*/
+ 			dbasis[NUMNODESP2xP4*0+8 ] = 0. ; 
+-			dbasis[NUMNODESP2xP4*1+8 ] = ((4.*SQRT3)/(3.)) *(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. )  ; 
+-			dbasis[NUMNODESP2xP4*2+8 ] =  4.*gauss->coord3*( 4.*zeta *zeta*zeta - (5./2.)*zeta ); 
++			dbasis[NUMNODESP2xP4*1+8 ] = 4.*(((4.*SQRT3)/(3.))*gauss->coord3 - SQRT3/3. ) *(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. )  ; 
++			dbasis[NUMNODESP2xP4*2+8 ] =  4.*gauss->coord3*(2.*gauss->coord3-1)*( 4.*zeta *zeta*zeta - (5./2.)*zeta ); 
+ 			/*Nodal function 10*/
+ 			dbasis[NUMNODESP2xP4*0+9 ] = (4./3.)*(gauss->coord3 )*(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta+0.5) ; 
+ 			dbasis[NUMNODESP2xP4*1+9 ] =  4.* (((- SQRT3)/6.)* gauss->coord3+ (SQRT3/3.) *gauss->coord2) *(2./3.) *(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta+0.5);
+@@ -1874,36 +1874,36 @@
+ 			dbasis[NUMNODESP2xP4*2+12] = 4.* gauss->coord2*gauss->coord3 *(2./3.)*( (2.*zeta+1.)*(zeta -0.5)*(zeta +0.5) + 2*zeta*zeta*(zeta +1.)); 
+ 			/*Nodal function 14*/
+ 			dbasis[NUMNODESP2xP4*0+13] = (- 4./3.) *gauss->coord3*(zeta - 0.5)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*1+13] =  4.* ((SQRT3/3.)*gauss->coord1- (SQRT3/6.)*gauss->coord3) *(2./3.) *(zeta - 0.5)*(zeta)*(zeta+0.5)*(zeta +1. );
++			dbasis[NUMNODESP2xP4*1+13] = 4.* ((SQRT3/3.)*gauss->coord1- (SQRT3/6.)*gauss->coord3) *(2./3.) *(zeta - 0.5)*(zeta)*(zeta+0.5)*(zeta +1. );
+ 			dbasis[NUMNODESP2xP4*2+13] = 4.* gauss->coord3*gauss->coord1 *(2./3.)*( (2.*zeta+1.)*(zeta -0.5)*(zeta +0.5) + 2.*zeta *zeta*(zeta +1.)); 
+ 			/*Nodal function 15*/
+ 			dbasis[NUMNODESP2xP4*0+14] = 4.* ( gauss->coord1*0.5- gauss->coord2*0.5) *(2./3.) *(zeta - 0.5)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*1+14] =  4.* (- (SQRT3/6.)*gauss->coord2 - (SQRT3/6.)*gauss->coord1) *(2./3.) *(zeta - 0.5)*(zeta)*(zeta+0.5)*(zeta +1. );
++			dbasis[NUMNODESP2xP4*1+14] = 4.* (- (SQRT3/6.)*gauss->coord2 - (SQRT3/6.)*gauss->coord1) *(2./3.) *(zeta - 0.5)*(zeta)*(zeta+0.5)*(zeta +1. );
+ 			dbasis[NUMNODESP2xP4*2+14] = 4.* gauss->coord1*gauss->coord2 *(2./3.)*( (2.*zeta+1.)*(zeta -0.5)*(zeta +0.5) + 2* zeta *zeta*(zeta +1.)); 
+ 			/*Nodal function 16*/
+-			dbasis[NUMNODESP2xP4*0+15] =  (8./6.) *(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*1+15] =  (8./3.) *(SQRT3/6.) *(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*2+15] =  -(8./3.) *gauss->coord1 *((2.*zeta -1. )*(zeta-0.5)*(zeta +1.) +  zeta*(zeta -1.)*( 2.*zeta + 0.5)); 
++			dbasis[NUMNODESP2xP4*0+15] =  -(8./3.) *(-2.* gauss->coord1 + 0.5 )*(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*1+15] =  -(8./3.) *(-((2.*SQRT3)/(3.)) *gauss->coord1 + (SQRT3)/(6.) ) *(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*2+15] =  -(8./3.) *gauss->coord1*(2.*gauss->coord1-1) *((2.*zeta -1. )*(zeta-0.5)*(zeta +1.) +  zeta*(zeta -1.)*( 2.*zeta + 0.5)); 
+ 			/*Nodal function 17*/
+-			dbasis[NUMNODESP2xP4*0+16] = - (8./6.) *(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*1+16] =  (8./3.) * (SQRT3/6.) *(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*2+16] =  -(8./3.)*gauss->coord2 *((2.*zeta -1. )*(zeta-0.5)*(zeta +1.) +  zeta *(zeta -1.)*( 2.*zeta + 0.5)); 
++			dbasis[NUMNODESP2xP4*0+16] = - (8./3.) *(2*gauss->coord2 - 0.5 )*(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*1+16] = - (8./3.)*(-((2.*SQRT3)/(3.)) *gauss->coord2 + (SQRT3/6.))*(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*2+16] = - (8./3.)*gauss->coord2*(2.*gauss->coord2-1) *((2.*zeta -1. )*(zeta-0.5)*(zeta +1.) +  zeta *(zeta -1.)*( 2.*zeta + 0.5)); 
+ 			/*Nodal function 18*/
+ 			dbasis[NUMNODESP2xP4*0+17] = 0. ; 
+-			dbasis[NUMNODESP2xP4*1+17] =  (8./3.) *(SQRT3/3.) *(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*2+17] =  -(8./3.)*gauss->coord3 *((2.* zeta -1. ) *(zeta-0.5)* (zeta +1.) +  zeta *(zeta -1.)*( 2.*zeta + 0.5));
++			dbasis[NUMNODESP2xP4*1+17] =  -(8./3.) *(((4.*SQRT3)/(3.))*gauss->coord3 - SQRT3/3. )*(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*2+17] =  -(8./3.)*gauss->coord3*(2*gauss->coord3-1) *((2.* zeta -1. ) *(zeta-0.5)* (zeta +1.) +  zeta *(zeta -1.)*( 2.*zeta + 0.5));
+ 			/*Nodal function 19*/
+-			dbasis[NUMNODESP2xP4*0+18] =  (4./3.) *(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*1+18] =  (8./3.)* (SQRT3/6.)*(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*2+18] =  -(8./3.)*gauss->coord1*((2.*zeta -1. ) *(zeta+0.5)* (zeta +1.) +  zeta* (zeta -1.)*( 2.*zeta + 3./2.));
++			dbasis[NUMNODESP2xP4*0+18] =  -(8./3.)*(-2.* gauss->coord1 + 0.5 ) *(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*1+18] =  -(8./3.)* (-((2.*SQRT3)/(3.)) *gauss->coord1 + (SQRT3)/(6.) )*(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*2+18] =  -(8./3.)*gauss->coord1*(2.*gauss->coord1-1) *((2.*zeta -1. ) *(zeta+0.5)* (zeta +1.) +  zeta* (zeta -1.)*( 2.*zeta + 3./2.));
+ 			/*Nodal function 20*/
+-			dbasis[NUMNODESP2xP4*0+19] =  (8./6.) *(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*1+19] =  (8./3.)*(SQRT3/6) *(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*2+19] =  -(8./3.)*gauss->coord2*((2.*zeta -1. )*(zeta+0.5)*(zeta +1.) +  zeta*(zeta -1.)*( 2.*zeta + 3./2.)); 
++			dbasis[NUMNODESP2xP4*0+19] =  -(8./3.)*(2*gauss->coord2 - 0.5 )*(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*1+19] =  -(8./3.)*(-((2.*SQRT3)/(3.)) *gauss->coord2 + (SQRT3/6.)) *(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*2+19] =  -(8./3.)*gauss->coord2*(2.*gauss->coord2-1)*((2.*zeta -1. )*(zeta+0.5)*(zeta +1.) +  zeta*(zeta -1.)*( 2.*zeta + 3./2.)); 
+ 			/*Nodal function 21*/
+ 			dbasis[NUMNODESP2xP4*0+20] = 0 ; 
+-			dbasis[NUMNODESP2xP4*1+20] =  -(8./3.)* (SQRT3/3) *(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*2+20] =  -(8./3.)*gauss->coord3 *(2. *zeta -1. )*(zeta+0.5)*(zeta +1.) +  zeta*(zeta -1.)*( 2.*zeta + 3./2.);
++			dbasis[NUMNODESP2xP4*1+20] =  -(8./3.)* (((4.*SQRT3)/(3.))*gauss->coord3 - SQRT3/3. ) *(zeta - 1.)*(zeta + 0.5)*(zeta)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*2+20] =  -(8./3.)*gauss->coord3*(2*gauss->coord3-1) *((2. *zeta -1. )*(zeta+0.5)*(zeta +1.) +  zeta*(zeta -1.)*( 2.*zeta + 3./2.));
+ 			/*Nodal function 22*/
+ 			dbasis[NUMNODESP2xP4*0+21] = -(32./6.) *gauss->coord3 *(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ); 
+ 			dbasis[NUMNODESP2xP4*1+21] = -(32./3.)*(- (SQRT3/6.)*gauss->coord3+ (SQRT3/3.)*gauss->coord2 ) *(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ) ; 
+@@ -1921,8 +1921,8 @@
+ 			dbasis[NUMNODESP2xP4*1+24] = 16.*(- (SQRT3/6.)*gauss->coord3 + (SQRT3/3.) *gauss->coord2) *(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. ) ; 
+ 			dbasis[NUMNODESP2xP4*2+24] = 16.* gauss->coord2 * gauss->coord3* ( 4.* zeta*zeta*zeta - (5./2.) *zeta ); 
+ 			/*Nodal function 26*/
+-			dbasis[NUMNODESP2xP4*0+25] = 8. *gauss->coord3*(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. ); 
+-			dbasis[NUMNODESP2xP4*1+25] = -16.*((SQRT3/3.)*gauss->coord1- (SQRT3/6.)*gauss->coord3 )*(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*0+25] = -8. *gauss->coord3*(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. ); 
++			dbasis[NUMNODESP2xP4*1+25] = 16.*((SQRT3/3.)*gauss->coord1- (SQRT3/6.)*gauss->coord3 )*(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. ) ; 
+ 			dbasis[NUMNODESP2xP4*2+25] = 16. * gauss->coord1 * gauss->coord3 *( 4. *zeta*zeta*zeta - (5./2.)* zeta );
+ 			/*Nodal function 27*/
+ 			dbasis[NUMNODESP2xP4*0+26] = 16.*( gauss->coord1*0.5-gauss->coord2*0.5) *(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. ); 
+@@ -1940,7 +1940,7 @@
+ 			dbasis[NUMNODESP2xP4*0+29] = -(32./3.)*( gauss->coord1*0.5- gauss->coord2*0.5)*(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ); 
+ 			dbasis[NUMNODESP2xP4*1+29] = -(32./3.)*(- (SQRT3/6.)*gauss->coord2- (SQRT3/6.)*gauss->coord1 ) *(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
+ 			dbasis[NUMNODESP2xP4*2+29] = -(32./3.)* gauss->coord1*gauss->coord2 *((2.*zeta -1. )*(zeta+0.5)*(zeta +1) +   zeta*(zeta -1.)*( 2.*zeta + (3./2.))); 
+-			return;
++			return;			return;
+ 		case P1xP3Enum :
+ 			/*Nodal function 1*/
+ 			dbasis[NUMNODESP1xP3*0+0 ] =  (9./32.)*(zeta-1)*(zeta-1./3.)*(zeta+1./3.);
Index: issm/oecreview/Archive/16554-17801/ISSM-17058-17059.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17058-17059.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17058-17059.diff	(revision 17802)
@@ -0,0 +1,50 @@
+Index: ../trunk-jpl/test/NightlyRun/test332.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test332.m	(revision 17058)
++++ ../trunk-jpl/test/NightlyRun/test332.m	(revision 17059)
+@@ -22,5 +22,5 @@
+ %only if no limits are applied
+ %analitic=(md.mesh.y.^2-2*md.mesh.y*1.0e6)*(-2.0/(2*md.constants.yts*md.hydrology.sediment_transmitivity))
+ field_names     ={'SedimentWaterHead','SedimentHeadResidual'};
+-field_tolerances={1e-13, 2.5e-10};
++field_tolerances={1e-13, 3e-10};
+ field_values={md.results.HydrologySolution.SedimentHead,md.results.HydrologySolution.SedimentHeadResidual};
+Index: ../trunk-jpl/test/NightlyRun/test334.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test334.m	(revision 17058)
++++ ../trunk-jpl/test/NightlyRun/test334.m	(revision 17059)
+@@ -24,5 +24,5 @@
+ %only if no limits are applied
+ %analitic=(md.mesh.y.^2-2*md.mesh.y*1.0e6)*(-2.0/(2*md.constants.yts*md.hydrology.sediment_transmitivity))
+ field_names     ={'SedimentWaterHead','SedimentHeadResidual'};
+-field_tolerances={1e-13, 2.5e-10};
++field_tolerances={1e-13, 3e-10};
+ field_values={md.results.HydrologySolution.SedimentHead,md.results.HydrologySolution.SedimentHeadResidual};
+Index: ../trunk-jpl/src/m/solvers/gmresjacobioptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/gmresjacobioptions.m	(revision 17058)
++++ ../trunk-jpl/src/m/solvers/gmresjacobioptions.m	(revision 17059)
+@@ -6,7 +6,7 @@
+ solverOptions.toolkit='petsc';
+ 
+ 
+-PETSC_VERSION=petscversion();
++PETSC_VERSION=IssmConfig('_PETSC_MAJOR_');
+ if PETSC_VERSION==3,
+    solverOptions.mat_type=getfieldvalue(options, 'mat_type','mpiaij');
+    solverOptions.ksp_type=getfieldvalue(options, 'ksp_type','gmres');
+Index: ../trunk-jpl/jenkins/windows
+===================================================================
+--- ../trunk-jpl/jenkins/windows	(revision 17058)
++++ ../trunk-jpl/jenkins/windows	(revision 17059)
+@@ -96,5 +96,9 @@
+ #as follows: runme($MATLAB_NROPTIONS). The options must be understandable
+ #by Matlab and runme.m
+ #ex: "'id',[101 102 103]"
+-MATLAB_NROPTIONS=""
++
++#In Windows, we don't yet have MUMPS, can't do full stokes, so exclude all FS runs.
++MATLAB_NROPTIONS="'exclude',[104, 204, 211, 215, 220, 221, 290, 308, 322, 404, 421, 422, 503, 507, 510, 511, 701, 702]"
+ PYTHON_NROPTIONS=""
++
++
Index: issm/oecreview/Archive/16554-17801/ISSM-17059-17060.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17059-17060.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17059-17060.diff	(revision 17802)
@@ -0,0 +1,214 @@
+Index: ../trunk-jpl/test/NightlyRun/test328.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test328.m	(revision 17059)
++++ ../trunk-jpl/test/NightlyRun/test328.m	(revision 17060)
+@@ -13,7 +13,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx1','Vy1','Vel1','Bed1','Surface1','Thickness1','SMB1','TotalSmb1','Vx2','Vy2','Vel2','Bed2','Surface2','Thickness2','SMB2','TotalSmb2','Vx3','Vy3','Vel3','Bed3','Surface3','Thickness3','SMB3','TotalSmb3'};
+-field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
++field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1.5e-13,1e-13};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
+ 	(md.results.TransientSolution(1).Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test410.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test410.m	(revision 17059)
++++ ../trunk-jpl/test/NightlyRun/test410.m	(revision 17060)
+@@ -9,7 +9,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure','Temperature','BasalforcingsMeltingRate'};
+-field_tolerances={1e-09,1e-09,1e-08,2e-10,1e-13,2e-10,1e-06};
++field_tolerances={1e-09,1e-09,1e-08,3e-10,1e-13,2e-10,1e-06};
+ field_values={...
+ 	(md.results.SteadystateSolution.Vx),...
+ 	(md.results.SteadystateSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test314.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test314.m	(revision 17059)
++++ ../trunk-jpl/test/NightlyRun/test314.m	(revision 17060)
+@@ -7,7 +7,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3'};
+-field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-10,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-10,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
++field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-10,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-10,1.5e-13,1.5e-13,1e-13,1e-13,1e-13,1e-13};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
+ 	(md.results.TransientSolution(1).Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test216.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test216.m	(revision 17059)
++++ ../trunk-jpl/test/NightlyRun/test216.m	(revision 17060)
+@@ -15,7 +15,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vel','Pressure'};
+-field_tolerances={4e-11,2e-11,4e-11,2e-11};
++field_tolerances={8e-7,5e-8,7e-8,2e-11};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test315.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test315.m	(revision 17059)
++++ ../trunk-jpl/test/NightlyRun/test315.m	(revision 17060)
+@@ -12,7 +12,7 @@
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3'};
+ field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...,
+ 	1e-10,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+-	1e-10,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
++	1e-10,1.5e-13,1.5e-13,1.5e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
+ 	(md.results.TransientSolution(1).Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test324.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test324.m	(revision 17059)
++++ ../trunk-jpl/test/NightlyRun/test324.m	(revision 17060)
+@@ -13,8 +13,8 @@
+ 	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsMeltingRate2'};
+ 	%'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3'};
+ field_tolerances={1e-13,  1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...,
+-	5*1e-11,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+-	1e-10,  1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
++	5*1e-11,1e-13,1.5e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
++	%1e-10,  1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
+ 	(md.results.TransientSolution(1).Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test333.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test333.m	(revision 17059)
++++ ../trunk-jpl/test/NightlyRun/test333.m	(revision 17060)
+@@ -46,8 +46,8 @@
+ 								 'SedimentWaterHead9','EplWaterHead9','SedimentHeadResidual9'};
+ field_tolerances={1e-13, 1e-13, 1e-13,...
+ 								 1e-13, 1e-13, 1e-13,...
+-								 1e-13, 1e-13, 1e-13,...
+-								 1e-13, 1e-13, 1e-13};
++								 1e-13, 6e-13, 8e-12,...
++								 1e-13, 9e-13, 1e-11};
+ field_values={md.results.HydrologySolution(1).SedimentHead, ...
+ 							md.results.HydrologySolution(1).EplHead,...
+ 							md.results.HydrologySolution(1).SedimentHeadResidual,...
+Index: ../trunk-jpl/test/NightlyRun/test423.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test423.m	(revision 17059)
++++ ../trunk-jpl/test/NightlyRun/test423.m	(revision 17060)
+@@ -46,5 +46,5 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'ElementOnIceShelfAgressive','VelAgressive','ElementOnIceShelfSoft','VelSoft','ElementOnIceShelfSubelement','VelSubelement','ElementOnIceShelfSubelement2','VelSubelement2'};
+-field_tolerances={1e-13,2e-13,1e-13,2e-13,1e-13,2e-13,1e-13,2e-13};
++field_tolerances={1e-13,2e-12,1e-13,2e-12,1e-13,3e-12,1e-13,2e-12};
+ field_values={element_on_iceshelf_agressive,vel_agressive,element_on_iceshelf_soft,vel_soft,element_on_iceshelf_subelement,vel_subelement,element_on_iceshelf_subelement2,vel_subelement2};
+Index: ../trunk-jpl/test/NightlyRun/test505.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test505.m	(revision 17059)
++++ ../trunk-jpl/test/NightlyRun/test505.m	(revision 17060)
+@@ -9,8 +9,8 @@
+ %Fields and tolerances to track changes
+ field_names     ={'Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Temperature1','BasalforcingsMeltingRate1', ...
+ 				      'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsMeltingRate2'};
+-field_tolerances={1e-12,1e-12,1e-10,1e-12,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+-						1e-13,1e-12,1e-10,1e-12,1e-13,1e-11,1e-11,2e-12,1e-11,1e-8};
++field_tolerances={1e-12,1e-12,3e-10,1e-12,1e-13,1e-11,5e-12,9e-12,1e-13,5e-9,...
++						5e-11,5e-11,1e-10,2e-11,7e-12,1e-11,1e-11,5e-12,1e-11,2e-8};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
+ 	(md.results.TransientSolution(1).Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test335.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test335.m	(revision 17059)
++++ ../trunk-jpl/test/NightlyRun/test335.m	(revision 17060)
+@@ -46,8 +46,8 @@
+ 								 'SedimentWaterHead9','EplWaterHead9','SedimentHeadResidual9'};
+ field_tolerances={1e-13, 1e-13, 1e-13,...
+ 								 1e-13, 1e-13, 1e-13,...
+-								 1e-13, 1e-13, 1e-13,...
+-								 1e-13, 1e-13, 1e-13};
++								 1e-13, 6e-13, 9e-12,...
++								 1e-13, 9e-13, 1e-11};
+ field_values={md.results.HydrologySolution(1).SedimentHead, ...
+ 							md.results.HydrologySolution(1).EplHead,...
+ 							md.results.HydrologySolution(1).SedimentHeadResidual,...
+Index: ../trunk-jpl/test/NightlyRun/test318.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test318.m	(revision 17059)
++++ ../trunk-jpl/test/NightlyRun/test318.m	(revision 17060)
+@@ -9,7 +9,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure','Temperature','BasalforcingsMeltingRate'};
+-field_tolerances={1e-13,1e-13,1.5e-10,1e-10,1e-13,1e-11,1e-6};
++field_tolerances={1e-13,1e-13,4e-10,1e-10,1e-13,1e-11,1e-6};
+ field_values={...
+ 	(md.results.SteadystateSolution.Vx),...
+ 	(md.results.SteadystateSolution.Vy),...
+Index: ../trunk-jpl/packagers/win7/package32.sh
+===================================================================
+--- ../trunk-jpl/packagers/win7/package32.sh	(revision 17059)
++++ ../trunk-jpl/packagers/win7/package32.sh	(revision 17060)
+@@ -15,7 +15,7 @@
+ SetPackageName "ISSM.msi"
+ END
+ 
+-ls $ISSM_DIR_WIN/scripts/*.bat startup.m $ISSM_DIR_WIN/bin/*.h | awk '{printf("AddFile APPDIR %s\n",$1);}' | sed 's/\//\\/g' >> ISSM.aic
++ls $ISSM_DIR_WIN/scripts/*.bat startup.m  | awk '{printf("AddFile APPDIR %s\n",$1);}' | sed 's/\//\\/g' >> ISSM.aic
+ 
+ cat << END >> ISSM.aic
+ AddFolder PersonalFolder $ISSM_DIR_WIN\test
+@@ -32,7 +32,7 @@
+ #DelEnvironment ISSM_DIR_WIN
+ 
+ #Run installer: 
+-"C:/Program Files (x86)/Caphyon/Advanced Installer 10.1/bin/x86/AdvancedInstaller.com" /execute  ./ISSM.aip ./ISSM.aic
++"C:/Program Files (x86)/Caphyon/Advanced Installer 10.8/bin/x86/AdvancedInstaller.com" /execute  ./ISSM.aip ./ISSM.aic
+ 
+ #Get rid of temporary files: 
+ cp ISSM-SetupFiles/ISSM.msi ./
+Index: ../trunk-jpl/packagers/win7/package64.sh
+===================================================================
+--- ../trunk-jpl/packagers/win7/package64.sh	(revision 17059)
++++ ../trunk-jpl/packagers/win7/package64.sh	(revision 17060)
+@@ -18,7 +18,7 @@
+ SetPackageName "ISSM.msi"
+ END
+ 
+-ls $ISSM_DIR_WIN/scripts/*.bat startup.m $ISSM_DIR_WIN/bin/*.h | awk '{printf("AddFile APPDIR %s\n",$1);}' | sed 's/\//\\/g' >> ISSM.aic
++ls $ISSM_DIR_WIN/scripts/*.bat startup.m | awk '{printf("AddFile APPDIR %s\n",$1);}' | sed 's/\//\\/g' >> ISSM.aic
+ 
+ cat << END >> ISSM.aic
+ AddFolder PersonalFolder $ISSM_DIR_WIN\test
+@@ -37,12 +37,11 @@
+ #DelEnvironment ISSM_DIR_WIN
+ 
+ #Run installer: 
+-"C:/Program Files (x86)/Caphyon/Advanced Installer 10.1/bin/x86/AdvancedInstaller.com" /execute  ./ISSM.aip ./ISSM.aic
++"C:/Program Files (x86)/Caphyon/Advanced Installer 10.8/bin/x86/AdvancedInstaller.com" /execute  ./ISSM.aip ./ISSM.aic
+ 
+ #Get rid of temporary files: 
+ cp ISSM-SetupFiles/ISSM.msi ./
+ rm -rf ISSM.aip ISSM-SetupFiles ISSM.aic
+ 
+-#Upload?: 
++#To upload to website: 
+ #scp ISSM.msi websites:/home/larour/files/ISSM64.msi
+-#cp  ISSM.msi /cygrdive/z/Desktop/ISSM64.msi
+Index: ../trunk-jpl/jenkins/windows
+===================================================================
+--- ../trunk-jpl/jenkins/windows	(revision 17059)
++++ ../trunk-jpl/jenkins/windows	(revision 17060)
+@@ -97,8 +97,8 @@
+ #by Matlab and runme.m
+ #ex: "'id',[101 102 103]"
+ 
+-#In Windows, we don't yet have MUMPS, can't do full stokes, so exclude all FS runs.
+-MATLAB_NROPTIONS="'exclude',[104, 204, 211, 215, 220, 221, 290, 308, 322, 404, 421, 422, 503, 507, 510, 511, 701, 702]"
++#In Windows, we don't yet have MUMPS, can't do full stokes, so exclude all FS runs. Also exclude all runs with Dakota.
++MATLAB_NROPTIONS="'exclude',[104, 204, 211, 215, 220, 221, 285, 290, 308, 322, 404, 421, 422, 503, 507, 510, 511, 701, 702, 218, 234, 235, 412, 413, 414, 417, 418, 420]"
+ PYTHON_NROPTIONS=""
+ 
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17060-17061.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17060-17061.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17060-17061.diff	(revision 17802)
@@ -0,0 +1,15 @@
+Index: ../trunk-jpl/jenkins/windows
+===================================================================
+--- ../trunk-jpl/jenkins/windows	(revision 17060)
++++ ../trunk-jpl/jenkins/windows	(revision 17061)
+@@ -97,8 +97,8 @@
+ #by Matlab and runme.m
+ #ex: "'id',[101 102 103]"
+ 
+-#In Windows, we don't yet have MUMPS, can't do full stokes, so exclude all FS runs. Also exclude all runs with Dakota.
+-MATLAB_NROPTIONS="'exclude',[104, 204, 211, 215, 220, 221, 285, 290, 308, 322, 404, 421, 422, 503, 507, 510, 511, 701, 702, 218, 234, 235, 412, 413, 414, 417, 418, 420]"
++#In Windows, we don't yet have MUMPS, can't do full stokes, so exclude all FS runs. Also exclude all runs with Dakota. And exclude higher order runs that have penalties.
++MATLAB_NROPTIONS="'exclude',[104, 204, 211, 215, 220, 221, 285, 290, 308, 322, 404, 421, 422, 503, 507, 510, 511, 701, 702, 218, 234, 235, 412, 413, 414, 417, 418, 420, 205, 274, 331, 405, 409, 455]"
+ PYTHON_NROPTIONS=""
+ 
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17061-17062.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17061-17062.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17061-17062.diff	(revision 17802)
@@ -0,0 +1,76 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17061)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17062)
+@@ -163,11 +163,11 @@
+ 					if(my_edges[i]){
+ 						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
+ 						nodes->AddObject(node);
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+2,counter+1,lid++,0,iomodel,analysis,approximation);
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+2,counter+2,lid++,0,iomodel,analysis,approximation);
+ 						nodes->AddObject(node);
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+3,counter+1,lid++,0,iomodel,analysis,approximation);
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+3,counter+3,lid++,0,iomodel,analysis,approximation);
+ 						nodes->AddObject(node);
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+4,counter+1,lid++,0,iomodel,analysis,approximation);
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+4,counter+4,lid++,0,iomodel,analysis,approximation);
+ 						nodes->AddObject(node);
+ 					}
+ 				}
+Index: ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17061)
++++ ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17062)
+@@ -119,7 +119,51 @@
+ 						}
+ 					}
+ 				}
+-				_printf0_("WARNING: Skipping constraints along edges\n");
++				for(i=0;i<iomodel->numberofedges;i++){
++					if(iomodel->edges[i*3+2]==2){/*Vertical edges*/
++						if(my_edges[i]){
++							v1 = iomodel->edges[3*i+0]-1;
++							v2 = iomodel->edges[3*i+1]-1;
++							if(!xIsNan<IssmDouble>(spcdata[v1]) && !xIsNan<IssmDouble>(spcdata[v2])){
++								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+4*i+1,
++												dof,1./2.*spcdata[v1]+1./2.*spcdata[v2],analysis_type));
++								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+2,iomodel->nodecounter+iomodel->numberofvertices+4*i+2,
++												dof,1./2.*spcdata[v1]+1./2.*spcdata[v2],analysis_type));
++								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+3,iomodel->nodecounter+iomodel->numberofvertices+4*i+3,
++												dof,1./2.*spcdata[v1]+1./2.*spcdata[v2],analysis_type));
++								count=count+3;
++							}
++						}
++					}
++					if(iomodel->edges[i*3+2]==1){/*Basal edges*/
++						if(my_edges[i]){
++							v1 = iomodel->edges[3*i+0]-1;
++							v2 = iomodel->edges[3*i+1]-1;
++							if(!xIsNan<IssmDouble>(spcdata[v1]) && !xIsNan<IssmDouble>(spcdata[v2])){
++								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+4*i+1,
++												dof,1./2.*spcdata[v1]+1./2.*spcdata[v2],analysis_type));
++								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+2,iomodel->nodecounter+iomodel->numberofvertices+4*i+2,
++												dof,1./2.*spcdata[v1]+1./2.*spcdata[v2],analysis_type));
++								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+3,iomodel->nodecounter+iomodel->numberofvertices+4*i+3,
++												dof,1./2.*spcdata[v1]+1./2.*spcdata[v2],analysis_type));
++								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+4,iomodel->nodecounter+iomodel->numberofvertices+4*i+4,
++												dof,1./2.*spcdata[v1]+1./2.*spcdata[v2],analysis_type));
++								count=count+4;
++							}
++						}
++					}
++					if(iomodel->edges[i*3+2]==3){/*Top edges*/
++						if(my_edges[i]){
++							v1 = iomodel->edges[3*i+0]-1;
++							v2 = iomodel->edges[3*i+1]-1;
++							if(!xIsNan<IssmDouble>(spcdata[v1]) && !xIsNan<IssmDouble>(spcdata[v2])){
++								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+4*i+1,
++												dof,1./2.*spcdata[v1]+1./2.*spcdata[v2],analysis_type));
++								count=count+1;
++							}
++						}
++					}
++				}
+ 				break;
+ 			case P1bubbleEnum:
+ 				for(i=0;i<iomodel->numberofvertices;i++){
Index: issm/oecreview/Archive/16554-17801/ISSM-17062-17063.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17062-17063.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17062-17063.diff	(revision 17802)
@@ -0,0 +1,142 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17062)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17063)
+@@ -11,7 +11,7 @@
+ void CreateNodes(Nodes* nodes, IoModel* iomodel,int analysis,int finite_element,int approximation){
+ 
+ 	/*Intermediaries*/
+-	int   i,j,counter,lid=0;
++	int   i,j,counter,vnodes,lid=0;
+ 	bool *my_edges = NULL;
+ 	bool *my_nodes = NULL;
+ 	Node *node     = NULL;
+@@ -194,9 +194,10 @@
+ 				}
+ 			}
+ 			/*P1 pressure*/
++			vnodes = iomodel->nodecounter+iomodel->numberofvertices;
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+-					nodes->AddObject(new Node(iomodel->nodecounter+iomodel->numberofvertices+i+1,iomodel->numberofvertices+i,lid++,i,iomodel,analysis,FSpressureEnum));
++					nodes->AddObject(new Node(vnodes+i+1,iomodel->numberofvertices+i,lid++,i,iomodel,analysis,FSpressureEnum));
+ 				}
+ 			}
+ 			break;
+@@ -209,9 +210,10 @@
+ 				}
+ 			}
+ 			/*P1 pressure*/
++			vnodes = iomodel->nodecounter+iomodel->numberofvertices;
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+-					nodes->AddObject(new Node(iomodel->nodecounter+iomodel->numberofvertices+i+1,iomodel->numberofvertices+i,lid++,i,iomodel,analysis,FSpressureEnum));
++					nodes->AddObject(new Node(vnodes+i+1,iomodel->numberofvertices+i,lid++,i,iomodel,analysis,FSpressureEnum));
+ 				}
+ 			}
+ 			break;
+@@ -231,9 +233,10 @@
+ 				}
+ 			}
+ 			/*P1 pressure*/
++			vnodes = iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofelements;
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+-					nodes->AddObject(new Node(iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofelements+i+1,iomodel->numberofvertices+iomodel->numberofelements+i,lid++,i,iomodel,analysis,FSpressureEnum));
++					nodes->AddObject(new Node(vnodes+i+1,iomodel->numberofvertices+iomodel->numberofelements+i,lid++,i,iomodel,analysis,FSpressureEnum));
+ 				}
+ 			}
+ 			break;
+@@ -251,9 +254,10 @@
+ 				}
+ 			}
+ 			/*P1 pressure*/
++			vnodes = iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofelements;
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+-					nodes->AddObject(new Node(iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofelements+i+1,iomodel->numberofvertices+iomodel->numberofelements+i,lid++,i,iomodel,analysis,FSpressureEnum));
++					nodes->AddObject(new Node(vnodes+i+1,iomodel->numberofvertices+iomodel->numberofelements+i,lid++,i,iomodel,analysis,FSpressureEnum));
+ 				}
+ 			}
+ 			break;
+@@ -273,18 +277,77 @@
+ 			}
+ 
+ 			/*P1 pressure*/
++			vnodes = iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofedges;
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+-					nodes->AddObject(new Node(iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofedges+i+1,iomodel->numberofvertices+iomodel->numberofedges+i,lid++,i,iomodel,analysis,FSpressureEnum));
++					nodes->AddObject(new Node(vnodes+i+1,iomodel->numberofvertices+iomodel->numberofedges+i,lid++,i,iomodel,analysis,FSpressureEnum));
+ 				}
+ 			}
+ 			break;
+ 		case OneLayerP4zEnum:
+ 			_assert_(approximation==FSApproximationEnum);
++			EdgesPartitioning(&my_edges,iomodel);
+ 			/*P2xP4 velocity*/
+-			EdgesPartitioning(&my_edges,iomodel);
++			for(i=0;i<iomodel->numberofvertices;i++){
++				if(iomodel->my_vertices[i]){
++					nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,lid++,i,iomodel,analysis,approximation));
++				}
++			}
++			counter = iomodel->numberofvertices;
++			for(i=0;i<iomodel->numberofedges;i++){
++				if(iomodel->edges[i*3+2]==2){/*Vertical edges*/
++					if(my_edges[i]){
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
++						nodes->AddObject(node);
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+2,counter+2,lid++,0,iomodel,analysis,approximation);
++						nodes->AddObject(node);
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+3,counter+3,lid++,0,iomodel,analysis,approximation);
++						nodes->AddObject(node);
++					}
++				}
++				else if(iomodel->edges[i*3+2]==1){/*Basal edges*/
++					if(my_edges[i]){
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
++						nodes->AddObject(node);
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+2,counter+2,lid++,0,iomodel,analysis,approximation);
++						nodes->AddObject(node);
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+3,counter+3,lid++,0,iomodel,analysis,approximation);
++						nodes->AddObject(node);
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+4,counter+4,lid++,0,iomodel,analysis,approximation);
++						nodes->AddObject(node);
++					}
++				}
++				else if(iomodel->edges[i*3+2]==3){/*Top edges*/
++					if(my_edges[i]){
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
++						nodes->AddObject(node);
++					}
++				}
++				else{
++					_error_("not supported");
++				}
++				counter=counter+4;
++			}
+ 			/*P1xP3 pressure*/
+-			_error_("Not supported");
++			vnodes = iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->numberofedges;
++			for(i=0;i<iomodel->numberofvertices;i++){
++				if(iomodel->my_vertices[i]){
++					nodes->AddObject(new Node(vnodes+i+1,i,lid++,i,iomodel,analysis,approximation));
++				}
++			}
++
++			counter = iomodel->numberofvertices;
++			for(i=0;i<iomodel->numberofedges;i++){
++				if(iomodel->edges[i*3+2]==2){
++					if(my_edges[i]){
++						node = new Node(vnodes+iomodel->numberofvertices+2*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
++						nodes->AddObject(node);
++						node = new Node(vnodes+iomodel->numberofvertices+2*i+2,counter+2,lid++,0,iomodel,analysis,approximation);
++						nodes->AddObject(node);
++					}
++					counter=counter+2;
++				}
++			}
+ 			break;
+ 
+ 		default:
Index: issm/oecreview/Archive/16554-17801/ISSM-17063-17064.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17063-17064.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17063-17064.diff	(revision 17802)
@@ -0,0 +1,117 @@
+Index: ../trunk-jpl/src/c/cores/transient_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17063)
++++ ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17064)
+@@ -105,7 +105,7 @@
+ 		femmodel->parameters->SetParam(step,StepEnum);
+ 
+ 		if(VerboseSolution()) _printf0_("iteration " << step << "/" << floor((finaltime-time)/dt)+step << "  time [yr]: " << time/yts << " (time step: " << dt/yts << ")\n");
+-		if(step%output_frequency==0 || time==finaltime || step==1)
++		if(step%output_frequency==0 || (time >= finaltime - (yts*DBL_EPSILON)) || step==1)
+ 		 save_results=true;
+ 		else
+ 		 save_results=false;
+@@ -159,17 +159,18 @@
+ 		}
+ 
+ 		/*unload results*/
++		if(VerboseSolution()) _printf0_("   computing requested outputs\n");
++		femmodel->RequestedOutputsx(&femmodel->results,requested_outputs,numoutputs,save_results);
++		if(isdelta18o){
++			int outputs[2] = {SurfaceforcingsMonthlytemperaturesEnum,SurfaceforcingsPrecipitationEnum};
++			femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],2,save_results);
++		}
++		if(isgroundingline && (groundingline_migration==SubelementMigrationEnum || groundingline_migration==SubelementMigration2Enum)){
++			int outputs[1] = {MaskGroundediceLevelsetEnum};
++			femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],1,save_results);
++		}
++
+ 		if(save_results){
+-			if(VerboseSolution()) _printf0_("   saving transient results\n");
+-			femmodel->RequestedOutputsx(&femmodel->results,requested_outputs,numoutputs);
+-			if(isdelta18o){
+-				int outputs[2] = {SurfaceforcingsMonthlytemperaturesEnum,SurfaceforcingsPrecipitationEnum};
+-				femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],2);
+-			}
+-			if(isgroundingline && (groundingline_migration==SubelementMigrationEnum || groundingline_migration==SubelementMigration2Enum)){
+-				int outputs[1] = {MaskGroundediceLevelsetEnum};
+-				femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],1);
+-			}
+ 			if(VerboseSolution()) _printf0_("   saving temporary results\n");
+ 			OutputResultsx(femmodel);
+ 		}
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17063)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17064)
+@@ -467,7 +467,7 @@
+ 
+ }
+ /*}}}*/
+-void FemModel::RequestedOutputsx(Results **presults,char** requested_outputs, int numoutputs){/*{{{*/
++void FemModel::RequestedOutputsx(Results **presults,char** requested_outputs, int numoutputs, bool save_results){/*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	bool        isvec;
+@@ -494,6 +494,10 @@
+ 		/*If string is not an enum, it is defined in output definitions*/
+ 		if(output_enum<0){
+ 			double_result = OutputDefinitionsResponsex(this,output_string);
++			if(save_results){
++				results->AddResult(new GenericExternalResult<IssmPDouble>(results->Size()+1,output_string,reCast<IssmPDouble>(double_result),step,time));
++				continue;
++			}
+ 		}
+ 		else{
+ 			switch(output_enum){
+@@ -560,7 +564,7 @@
+ 					}
+ 					vector_result->Assemble();
+ 
+-					results->AddResult(new GenericExternalResult<Vector<IssmDouble>*>(results->Size()+1,output_enum,vector_result,step,time));
++					if (save_results)results->AddResult(new GenericExternalResult<Vector<IssmDouble>*>(results->Size()+1,output_enum,vector_result,step,time));
+ 					isvec = true;
+ 					break;
+ 
+@@ -571,7 +575,7 @@
+ 		}
+ 
+ 		/*Add result to Results*/
+-		if(!isvec){
++		if(!isvec && save_results){
+ 			results->AddResult(new GenericExternalResult<IssmPDouble>(results->Size()+1,output_string,reCast<IssmPDouble>(double_result),step,time));
+ 		}
+ 	}
+@@ -580,7 +584,7 @@
+ 	*presults = results;
+ }
+ /*}}}*/
+-void FemModel::RequestedOutputsx(Results **presults,int* requested_outputs, int numoutputs){/*{{{*/
++void FemModel::RequestedOutputsx(Results **presults,int* requested_outputs, int numoutputs,bool save_results){/*{{{*/
+ 
+ 	/*Convert list of enums to list of string*/
+ 	char** enumlist = xNew<char*>(numoutputs);
+@@ -589,7 +593,7 @@
+ 	}
+ 
+ 	/*Call main module*/
+-	this->RequestedOutputsx(presults,enumlist,numoutputs);
++	this->RequestedOutputsx(presults,enumlist,numoutputs,save_results);
+ 
+ 	/*clean up and return*/
+ 	for(int i=0;i<numoutputs;i++) xDelete<char>(enumlist[i]);
+Index: ../trunk-jpl/src/c/classes/FemModel.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.h	(revision 17063)
++++ ../trunk-jpl/src/c/classes/FemModel.h	(revision 17064)
+@@ -80,8 +80,8 @@
+ 		#ifdef  _HAVE_DAKOTA_
+ 		void DakotaResponsesx(double* d_responses,char** responses_descriptors,int numresponsedescriptors,int d_numresponses);
+ 		#endif
+-		void RequestedOutputsx(Results **presults,char** requested_outputs, int numoutputs);
+-		void RequestedOutputsx(Results **presults,int* requested_outputs, int numoutputs);
++		void RequestedOutputsx(Results **presults,char** requested_outputs, int numoutputs,bool save_results=true);
++		void RequestedOutputsx(Results **presults,int* requested_outputs, int numoutputs,bool save_results=true);
+ 		void RequestedDependentsx(void);
+ 		void Responsex(IssmDouble* presponse,int response_descriptor_enum);
+ 		void Responsex(IssmDouble* presponse,const char* response_descriptor);
Index: issm/oecreview/Archive/16554-17801/ISSM-17064-17065.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17064-17065.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17064-17065.diff	(revision 17802)
@@ -0,0 +1,231 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17064)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17065)
+@@ -371,6 +371,7 @@
+ 				case MINIcondensedEnum : finiteelement = P1bubbleEnum; break;
+ 				case MINIEnum          : finiteelement = P1bubbleEnum; break;
+ 				case TaylorHoodEnum    : finiteelement = P2Enum;       break;
++				case OneLayerP4zEnum   : finiteelement = P2xP4Enum;    break;
+ 				default: _error_("finite element "<<finiteelement<<" not supported");
+ 			}
+ 		}
+@@ -461,6 +462,9 @@
+ 						}
+ 					}
+ 					break;
++				case P2xP4Enum:
++					//Nothing yet
++					break;
+ 				default:
+ 					_error_("not implemented yet");
+ 			}
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17064)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17065)
+@@ -290,36 +290,36 @@
+ 			/*P2xP4 velocity*/
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+-					nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,lid++,i,iomodel,analysis,approximation));
++					nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,lid++,i,iomodel,analysis,FSvelocityEnum));
+ 				}
+ 			}
+ 			counter = iomodel->numberofvertices;
+ 			for(i=0;i<iomodel->numberofedges;i++){
+ 				if(iomodel->edges[i*3+2]==2){/*Vertical edges*/
+ 					if(my_edges[i]){
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 						nodes->AddObject(node);
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+2,counter+2,lid++,0,iomodel,analysis,approximation);
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+2,counter+2,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 						nodes->AddObject(node);
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+3,counter+3,lid++,0,iomodel,analysis,approximation);
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+3,counter+3,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 						nodes->AddObject(node);
+ 					}
+ 				}
+ 				else if(iomodel->edges[i*3+2]==1){/*Basal edges*/
+ 					if(my_edges[i]){
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 						nodes->AddObject(node);
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+2,counter+2,lid++,0,iomodel,analysis,approximation);
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+2,counter+2,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 						nodes->AddObject(node);
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+3,counter+3,lid++,0,iomodel,analysis,approximation);
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+3,counter+3,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 						nodes->AddObject(node);
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+4,counter+4,lid++,0,iomodel,analysis,approximation);
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+4,counter+4,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 						nodes->AddObject(node);
+ 					}
+ 				}
+ 				else if(iomodel->edges[i*3+2]==3){/*Top edges*/
+ 					if(my_edges[i]){
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
++						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 						nodes->AddObject(node);
+ 					}
+ 				}
+@@ -332,7 +332,7 @@
+ 			vnodes = iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->numberofedges;
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+-					nodes->AddObject(new Node(vnodes+i+1,i,lid++,i,iomodel,analysis,approximation));
++					nodes->AddObject(new Node(vnodes+i+1,i,lid++,i,iomodel,analysis,FSpressureEnum));
+ 				}
+ 			}
+ 
+@@ -340,9 +340,9 @@
+ 			for(i=0;i<iomodel->numberofedges;i++){
+ 				if(iomodel->edges[i*3+2]==2){
+ 					if(my_edges[i]){
+-						node = new Node(vnodes+iomodel->numberofvertices+2*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
++						node = new Node(vnodes+iomodel->numberofvertices+2*i+1,counter+1,lid++,0,iomodel,analysis,FSpressureEnum);
+ 						nodes->AddObject(node);
+-						node = new Node(vnodes+iomodel->numberofvertices+2*i+2,counter+2,lid++,0,iomodel,analysis,approximation);
++						node = new Node(vnodes+iomodel->numberofvertices+2*i+2,counter+2,lid++,0,iomodel,analysis,FSpressureEnum);
+ 						nodes->AddObject(node);
+ 					}
+ 					counter=counter+2;
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17064)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17065)
+@@ -1451,6 +1451,11 @@
+ 			this->GetNodalFunctions(basis,gauss);
+ 			this->element_type = TaylorHoodEnum;
+ 			return;
++		case OneLayerP4zEnum:
++			this->element_type = P2xP4Enum;
++			this->GetNodalFunctions(basis,gauss);
++			this->element_type = OneLayerP4zEnum;
++			return;
+ 		default:
+ 			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+ 	}
+@@ -1486,6 +1491,11 @@
+ 			this->GetNodalFunctions(basis,gauss);
+ 			this->element_type = TaylorHoodEnum;
+ 			return;
++		case OneLayerP4zEnum:
++			this->element_type = P1xP3Enum;
++			this->GetNodalFunctions(basis,gauss);
++			this->element_type = OneLayerP4zEnum;
++			return;
+ 		default:
+ 			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+ 	}
+@@ -1554,6 +1564,11 @@
+ 			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+ 			this->element_type = TaylorHoodEnum;
+ 			return;
++		case OneLayerP4zEnum:
++			this->element_type = P2xP4Enum;
++			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++			this->element_type = OneLayerP4zEnum;
++			return;
+ 		default:
+ 			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+ 	}
+@@ -2251,6 +2266,7 @@
+ 		case MINIcondensedEnum:     return NUMNODESP1b+NUMNODESP1;
+ 		case MINIEnum:              return NUMNODESP1b+NUMNODESP1;
+ 		case TaylorHoodEnum:        return NUMNODESP2+NUMNODESP1;
++		case OneLayerP4zEnum:       return NUMNODESP2xP4+NUMNODESP1xP3;
+ 		case P2xP4Enum:             return NUMNODESP2xP4;
+ 		case P1xP3Enum:             return NUMNODESP1xP3;
+ 		default:       _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+@@ -2268,6 +2284,7 @@
+ 		case MINIcondensedEnum: return NUMNODESP1;
+ 		case MINIEnum:          return NUMNODESP1;
+ 		case TaylorHoodEnum:    return NUMNODESP1;
++		case OneLayerP4zEnum:   return NUMNODESP1xP3;
+ 		default: _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+ 	}
+ 
+@@ -2283,6 +2300,7 @@
+ 		case MINIcondensedEnum: return NUMNODESP1b;
+ 		case MINIEnum:          return NUMNODESP1b;
+ 		case TaylorHoodEnum:    return NUMNODESP2;
++		case OneLayerP4zEnum:   return NUMNODESP2xP4;
+ 		default:       _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+ 	}
+ 
+@@ -2298,6 +2316,7 @@
+ 		case MINIcondensedEnum: return P1bubbleEnum;
+ 		case MINIEnum:          return P1bubbleEnum;
+ 		case TaylorHoodEnum:    return P2Enum;
++		case OneLayerP4zEnum:   return P2xP4Enum;
+ 		default:       _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+ 	}
+ 
+@@ -2313,6 +2332,7 @@
+ 		case MINIcondensedEnum: return P1Enum;
+ 		case MINIEnum:          return P1Enum;
+ 		case TaylorHoodEnum:    return P1Enum;
++		case OneLayerP4zEnum:   return P1xP3Enum;
+ 		default:       _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+ 	}
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17064)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17065)
+@@ -2914,6 +2914,53 @@
+ 			penta_node_ids[19]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofedges+iomodel->elements[6*index+4];
+ 			penta_node_ids[20]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofedges+iomodel->elements[6*index+5];
+ 			break;
++		case OneLayerP4zEnum:
++			numnodes         = 30+12;
++			penta_node_ids   = xNew<int>(numnodes);
++			penta_node_ids[ 0]=iomodel->nodecounter+iomodel->elements[6*index+0];
++			penta_node_ids[ 1]=iomodel->nodecounter+iomodel->elements[6*index+1];
++			penta_node_ids[ 2]=iomodel->nodecounter+iomodel->elements[6*index+2];
++			penta_node_ids[ 3]=iomodel->nodecounter+iomodel->elements[6*index+3];
++			penta_node_ids[ 4]=iomodel->nodecounter+iomodel->elements[6*index+4];
++			penta_node_ids[ 5]=iomodel->nodecounter+iomodel->elements[6*index+5];
++			penta_node_ids[ 6]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+0]+1;
++			penta_node_ids[ 7]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+1]+1;
++			penta_node_ids[ 8]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+2]+1;
++			penta_node_ids[ 9]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+3]+1;
++			penta_node_ids[10]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+4]+1;
++			penta_node_ids[11]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+5]+1;
++			penta_node_ids[12]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+6]+1;
++			penta_node_ids[13]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+7]+1;
++			penta_node_ids[14]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+8]+1;
++			penta_node_ids[15]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+0]+2;
++			penta_node_ids[16]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+1]+2;
++			penta_node_ids[17]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+2]+2;
++			penta_node_ids[18]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+0]+3;
++			penta_node_ids[19]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+1]+3;
++			penta_node_ids[20]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+2]+3;
++			penta_node_ids[21]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+3]+2;
++			penta_node_ids[22]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+4]+2;
++			penta_node_ids[23]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+5]+2;
++			penta_node_ids[24]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+3]+3;
++			penta_node_ids[25]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+4]+3;
++			penta_node_ids[26]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+5]+3;
++			penta_node_ids[27]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+3]+4;
++			penta_node_ids[28]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+4]+4;
++			penta_node_ids[29]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+5]+4;
++
++			penta_node_ids[30]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->numberofedges+iomodel->elements[6*index+0];
++			penta_node_ids[31]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->numberofedges+iomodel->elements[6*index+1];
++			penta_node_ids[32]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->numberofedges+iomodel->elements[6*index+2];
++			penta_node_ids[33]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->numberofedges+iomodel->elements[6*index+3];
++			penta_node_ids[34]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->numberofedges+iomodel->elements[6*index+4];
++			penta_node_ids[35]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->numberofedges+iomodel->elements[6*index+5];
++			penta_node_ids[36]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->numberofedges+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+0]+1;
++			penta_node_ids[37]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->numberofedges+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+1]+1;
++			penta_node_ids[38]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->numberofedges+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+2]+1;
++			penta_node_ids[39]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->numberofedges+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+0]+2;
++			penta_node_ids[40]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->numberofedges+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+1]+2;
++			penta_node_ids[41]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->numberofedges+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+2]+2;
++			break;
+ 		default:
+ 			_error_("Finite element "<<EnumToStringx(finiteelement_type)<<" not supported yet");
+ 	}
Index: issm/oecreview/Archive/16554-17801/ISSM-17065-17066.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17065-17066.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17065-17066.diff	(revision 17802)
@@ -0,0 +1,66 @@
+Index: ../trunk-jpl/externalpackages/cython/install.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/cython/install.sh	(revision 17065)
++++ ../trunk-jpl/externalpackages/cython/install.sh	(revision 17066)
+@@ -1,13 +0,0 @@
+-#!/bin/bash
+-set -eu
+-
+-#clean up
+-rm -rf Cython-0.18
+-
+-#download numpy first
+-$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/Cython-0.18.tar.gz' 'cython.tar.gz'
+-
+-#install numpy
+-tar -zxvf cython.tar.gz
+-cd Cython-0.18
+-python setup.py install
+Index: ../trunk-jpl/externalpackages/cython/install-18.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/cython/install-18.sh	(revision 0)
++++ ../trunk-jpl/externalpackages/cython/install-18.sh	(revision 17066)
+@@ -0,0 +1,13 @@
++#!/bin/bash
++set -eu
++
++#clean up
++rm -rf Cython-0.18
++
++#download numpy first
++$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/Cython-0.18.tar.gz' 'cython.tar.gz'
++
++#install numpy
++tar -zxvf cython.tar.gz
++cd Cython-0.18
++python setup.py install
+
+Property changes on: ../trunk-jpl/externalpackages/cython/install-18.sh
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/externalpackages/cython/install-19.2.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/cython/install-19.2.sh	(revision 0)
++++ ../trunk-jpl/externalpackages/cython/install-19.2.sh	(revision 17066)
+@@ -0,0 +1,13 @@
++#!/bin/bash
++set -eu
++
++#clean up
++rm -rf Cython-0.19.2
++
++#download numpy first
++$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/Cython-0.19.2.tar.gz' 'cython.tar.gz'
++
++#install numpy
++tar -zxvf cython.tar.gz
++cd Cython-0.19.2
++python setup.py install
+
+Property changes on: ../trunk-jpl/externalpackages/cython/install-19.2.sh
+___________________________________________________________________
+Name: svn:executable
+   + *
+
Index: issm/oecreview/Archive/16554-17801/ISSM-17066-17067.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17066-17067.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17066-17067.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/jenkins/windows
+===================================================================
+--- ../trunk-jpl/jenkins/windows	(revision 17066)
++++ ../trunk-jpl/jenkins/windows	(revision 17067)
+@@ -98,7 +98,7 @@
+ #ex: "'id',[101 102 103]"
+ 
+ #In Windows, we don't yet have MUMPS, can't do full stokes, so exclude all FS runs. Also exclude all runs with Dakota. And exclude higher order runs that have penalties.
+-MATLAB_NROPTIONS="'exclude',[104, 204, 211, 215, 220, 221, 285, 290, 308, 322, 404, 421, 422, 503, 507, 510, 511, 701, 702, 218, 234, 235, 412, 413, 414, 417, 418, 420, 205, 274, 331, 405, 409, 455]"
++MATLAB_NROPTIONS="'exclude',[104, 204, 211, 215, 220, 221, 285, 290, 308, 322, 404, 421, 422, 503, 507, 510, 511, 701, 702, 218, 234, 235, 412, 413, 414, 417, 418, 420, 205, 274, 331, 405, 409, 455, 612, 514 ]"
+ PYTHON_NROPTIONS=""
+ 
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17067-17068.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17067-17068.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17067-17068.diff	(revision 17802)
@@ -0,0 +1,15 @@
+Index: ../trunk-jpl/src/c/classes/Misfit.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Misfit.h	(revision 17067)
++++ ../trunk-jpl/src/c/classes/Misfit.h	(revision 17068)
+@@ -138,8 +138,8 @@
+ 			 area_t=all_area_t;
+ 			 misfit_t=all_misfit_t;
+ 			 
+-			 /*Divide by surface area: */
+-			 misfit_t=misfit_t/area_t;
++			 /*Divide by surface area if not nill!: */
++			 if (area_t!=0) misfit_t=misfit_t/area_t;
+ 
+ 			 /*Recover delta_t: */
+ 			 femmodel->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
Index: issm/oecreview/Archive/16554-17801/ISSM-17068-17069.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17068-17069.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17068-17069.diff	(revision 17802)
@@ -0,0 +1,43 @@
+Index: ../trunk-jpl/examples/SquareIceShelf/Square.par
+===================================================================
+--- ../trunk-jpl/examples/SquareIceShelf/Square.par	(revision 17068)
++++ ../trunk-jpl/examples/SquareIceShelf/Square.par	(revision 17069)
+@@ -24,6 +24,7 @@
+ disp('      creating flow law parameter');
+ md.materials.rheology_B=paterson((273-20)*ones(md.mesh.numberofvertices,1));
+ md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
++md.damage.D=zeros(md.mesh.numberofvertices,1);
+ 
+ disp('      creating boundary conditions');
+ md=SetIceShelfBC(md,'Front.exp');
+Index: ../trunk-jpl/examples/Jakobshavn/runme.m
+===================================================================
+--- ../trunk-jpl/examples/Jakobshavn/runme.m	(revision 17068)
++++ ../trunk-jpl/examples/Jakobshavn/runme.m	(revision 17069)
+@@ -1,4 +1,4 @@
+-steps=[1];
++steps=[2:3];
+ 
+ if any(steps==1)
+ 	disp('	Step 1: Mesh creation'); 
+@@ -51,7 +51,7 @@
+ 	md.verbose=verbose('solution',true,'control',true);
+ 
+ 	%Cost functions
+-	md.inversion.cost_functions=[101*ones(md.inversion.nsteps,1) 103*ones(md.inversion.nsteps,1)];
++	md.inversion.cost_functions=[101 103];
+ 	md.inversion.cost_functions_coefficients=ones(md.mesh.numberofvertices,2);
+ 	md.inversion.cost_functions_coefficients(:,1)=40;
+ 	md.inversion.cost_functions_coefficients(:,2)=1;
+Index: ../trunk-jpl/examples/Jakobshavn/Jks.par
+===================================================================
+--- ../trunk-jpl/examples/Jakobshavn/Jks.par	(revision 17068)
++++ ../trunk-jpl/examples/Jakobshavn/Jks.par	(revision 17069)
+@@ -50,6 +50,7 @@
+ disp('   Construct ice rheological properties');
+ md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
+ md.materials.rheology_B=paterson(md.initialization.temperature);
++md.damage.D=zeros(md.mesh.numberofvertices,1);
+ %Reduce viscosity along the shear margins
+ weakb=ContourToMesh(md.mesh.elements,md.mesh.x,md.mesh.y,'WeakB.exp','node',2);
+ pos=find(weakb);md.materials.rheology_B(pos)=.3*md.materials.rheology_B(pos);
Index: issm/oecreview/Archive/16554-17801/ISSM-17069-17070.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17069-17070.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17069-17070.diff	(revision 17802)
@@ -0,0 +1,30 @@
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17069)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17070)
+@@ -1400,7 +1400,7 @@
+ 			basis[28]=-(32./3.)*gauss->coord1*gauss->coord3*(zeta-1.0)*zeta*(zeta+0.5)*(zeta+1.);
+ 			basis[29]=-(32./3.)*gauss->coord1*gauss->coord2*(zeta-1.0)*zeta*(zeta+0.5)*(zeta+1.);
+ 			return;
+-					case P1xP3Enum :
++		case P1xP3Enum :
+ 			/*Corner nodes*/
+ 			basis[ 0]=-(9.)/(16.)*gauss->coord1*(zeta-1)*(zeta-1./3.)*(zeta+1./3.);	
+ 			basis[ 1]=-(9.)/(16.)*gauss->coord2*(zeta-1)*(zeta-1./3.)*(zeta+1./3.);	
+@@ -1833,7 +1833,6 @@
+ 			dbasis[NUMNODESP2*1+14] = .5*zeta*(zeta+1.)*(-2.*SQRT3/3.*(gauss->coord1+gauss->coord2));
+ 			dbasis[NUMNODESP2*2+14] = 2.*gauss->coord1*gauss->coord2*(2.*zeta+1.);
+ 			return;
+-
+ 		case P2xP4Enum :
+ 			/*Nodal function 1*/
+ 			dbasis[NUMNODESP2xP4*0+0 ] = (-2* gauss->coord1 + 0.5 ) *(2./3.) *(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta+0.5) ; 
+@@ -1955,7 +1954,7 @@
+ 			dbasis[NUMNODESP2xP4*0+29] = -(32./3.)*( gauss->coord1*0.5- gauss->coord2*0.5)*(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ); 
+ 			dbasis[NUMNODESP2xP4*1+29] = -(32./3.)*(- (SQRT3/6.)*gauss->coord2- (SQRT3/6.)*gauss->coord1 ) *(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
+ 			dbasis[NUMNODESP2xP4*2+29] = -(32./3.)* gauss->coord1*gauss->coord2 *((2.*zeta -1. )*(zeta+0.5)*(zeta +1) +   zeta*(zeta -1.)*( 2.*zeta + (3./2.))); 
+-			return;			return;
++			return;
+ 		case P1xP3Enum :
+ 			/*Nodal function 1*/
+ 			dbasis[NUMNODESP1xP3*0+0 ] =  (9./32.)*(zeta-1)*(zeta-1./3.)*(zeta+1./3.);
Index: issm/oecreview/Archive/16554-17801/ISSM-17070-17071.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17070-17071.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17070-17071.diff	(revision 17802)
@@ -0,0 +1,262 @@
+Index: ../trunk-jpl/src/m/boundaryconditions/SetIceSheetBC.py
+===================================================================
+--- ../trunk-jpl/src/m/boundaryconditions/SetIceSheetBC.py	(revision 17070)
++++ ../trunk-jpl/src/m/boundaryconditions/SetIceSheetBC.py	(revision 17071)
+@@ -33,20 +33,14 @@
+ 
+ 	#No ice front -> do nothing
+ 
+-	#Create zeros basal melting rate and surface mass balance if not specified
+-	if numpy.all(numpy.isnan(md.surfaceforcings.precipitation)) and (md.surfaceforcings.ispdd==1):
+-		md.surfaceforcings.precipitation=numpy.zeros((md.mesh.numberofvertices,1))
+-		print "      no surfaceforcings.precipitation specified: values set as zero"
+-	if numpy.all(numpy.isnan(md.surfaceforcings.mass_balance)) and (md.surfaceforcings.ispdd==0):
+-		md.surfaceforcings.mass_balance=numpy.zeros((md.mesh.numberofvertices,1))
+-		print "      no surfaceforcings.mass_balance specified: values set as zero"
+-	if numpy.all(numpy.isnan(md.basalforcings.melting_rate)):
+-		md.basalforcings.melting_rate=numpy.zeros((md.mesh.numberofvertices,1))
+-		print "      no basalforcings.melting_rate specified: values set as zero"
++	#Create zeros basalforcings and surfaceforcings
++	md.surfaceforcings.initialize(md)
++	md.basalforcings.initialize(md)
++
++	#Deal with other boundary conditions
+ 	if numpy.all(numpy.isnan(md.balancethickness.thickening_rate)):
+ 		md.balancethickness.thickening_rate=numpy.zeros((md.mesh.numberofvertices,1))
+ 		print "      no balancethickness.thickening_rate specified: values set as zero"
+-
+ 	md.masstransport.spcthickness=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
+ 	md.balancethickness.spcthickness=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
+ 	md.damage.spcdamage=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
+Index: ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.m
+===================================================================
+--- ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.m	(revision 17070)
++++ ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.m	(revision 17071)
+@@ -77,19 +77,11 @@
+ pos=find(md.mesh.vertexonboundary);
+ md.hydrology.spcwatercolumn(pos,1)=1;
+ 
+-%Create zeros basalforcings and surfaceforcings
+-if (isnan(md.surfaceforcings.precipitation) & (md.surfaceforcings.ispdd==1)),
+-	md.surfaceforcings.precipitation=zeros(md.mesh.numberofvertices,1);
+-	disp('      no surfaceforcings.precipitation specified: values set as zero');
+-end
+-if (isnan(md.surfaceforcings.mass_balance) & (md.surfaceforcings.ispdd==0)),
+-	md.surfaceforcings.mass_balance=zeros(md.mesh.numberofvertices,1);
+-	disp('      no surfaceforcings.mass_balance specified: values set as zero');
+-end
+-if isnan(md.basalforcings.melting_rate),
+-	md.basalforcings.melting_rate=zeros(md.mesh.numberofvertices,1);
+-	disp('      no basalforcings.melting_rate specified: values set as zero');
+-end
++%Initialize surface and basal forcings
++md.surfaceforcings = initialize(md.surfaceforcings,md);
++md.basalforcings   = initialize(md.basalforcings,md);
++
++%Deal with other boundary conditions
+ if isnan(md.balancethickness.thickening_rate),
+ 	md.balancethickness.thickening_rate=zeros(md.mesh.numberofvertices,1);
+ 	disp('      no balancethickness.thickening_rate specified: values set as zero');
+Index: ../trunk-jpl/src/m/boundaryconditions/SetIceSheetBC.m
+===================================================================
+--- ../trunk-jpl/src/m/boundaryconditions/SetIceSheetBC.m	(revision 17070)
++++ ../trunk-jpl/src/m/boundaryconditions/SetIceSheetBC.m	(revision 17071)
+@@ -28,24 +28,15 @@
+ 
+ %No ice front: do nothing
+ 
+-%Create zeros basal melting rate and surface mass balance if not specified
+-if (isnan(md.surfaceforcings.precipitation) & (md.surfaceforcings.ispdd==1)),
+-	md.surfaceforcings.precipitation=zeros(md.mesh.numberofvertices,1);
+-	disp('      no surfaceforcings.precipitation specified: values set as zero');
+-end
+-if (isnan(md.surfaceforcings.mass_balance) & (md.surfaceforcings.ispdd==0)),
+-	md.surfaceforcings.mass_balance=zeros(md.mesh.numberofvertices,1);
+-	disp('      no surfaceforcings.mass_balance specified: values set as zero');
+-end
+-if isnan(md.basalforcings.melting_rate),
+-	md.basalforcings.melting_rate=zeros(md.mesh.numberofvertices,1);
+-	disp('      no basalforcings.melting_rate specified: values set as zero');
+-end
++%Initialize surface and basal forcings
++md.surfaceforcings = initialize(md.surfaceforcings,md);
++md.basalforcings   = initialize(md.basalforcings,md);
++
++%Deal with other boundary conditions
+ if isnan(md.balancethickness.thickening_rate),
+ 	md.balancethickness.thickening_rate=zeros(md.mesh.numberofvertices,1);
+ 	disp('      no balancethickness.thickening_rate specified: values set as zero');
+ end
+-
+ md.masstransport.spcthickness=NaN*ones(md.mesh.numberofvertices,1);
+ md.balancethickness.spcthickness=NaN*ones(md.mesh.numberofvertices,1);
+ md.damage.spcdamage=NaN*ones(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py
+===================================================================
+--- ../trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py	(revision 17070)
++++ ../trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py	(revision 17071)
+@@ -76,19 +76,13 @@
+ 		print "      boundary conditions for stressbalance model: spc set as zero"
+ 
+ 	#Create zeros basalforcings and surfaceforcings
+-	if numpy.all(numpy.isnan(md.surfaceforcings.precipitation)) and (md.surfaceforcings.ispdd==1):
+-		md.surfaceforcings.precipitation=numpy.zeros((md.mesh.numberofvertices,1))
+-		print "      no surfaceforcings.precipitation specified: values set as zero"
+-	if numpy.all(numpy.isnan(md.surfaceforcings.mass_balance)) and (md.surfaceforcings.ispdd==0):
+-		md.surfaceforcings.mass_balance=numpy.zeros((md.mesh.numberofvertices,1))
+-		print "      no surfaceforcings.mass_balance specified: values set as zero"
+-	if numpy.all(numpy.isnan(md.basalforcings.melting_rate)):
+-		md.basalforcings.melting_rate=numpy.zeros((md.mesh.numberofvertices,1))
+-		print "      no basalforcings.melting_rate specified: values set as zero"
++	md.surfaceforcings.initialize(md)
++	md.basalforcings.initialize(md)
++
++	#Deal with other boundary conditions
+ 	if numpy.all(numpy.isnan(md.balancethickness.thickening_rate)):
+ 		md.balancethickness.thickening_rate=numpy.zeros((md.mesh.numberofvertices,1))
+ 		print "      no balancethickness.thickening_rate specified: values set as zero"
+-
+ 	md.masstransport.spcthickness=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
+ 	md.balancethickness.spcthickness=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
+ 	md.damage.spcdamage=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
+Index: ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py
+===================================================================
+--- ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py	(revision 17070)
++++ ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py	(revision 17071)
+@@ -81,15 +81,10 @@
+ 	md.hydrology.spcwatercolumn[pos,0]=1
+ 
+ 	#Create zeros basalforcings and surfaceforcings
+-	if numpy.all(numpy.isnan(md.surfaceforcings.precipitation)) and (md.surfaceforcings.ispdd==1):
+-		md.surfaceforcings.precipitation=numpy.zeros((md.mesh.numberofvertices,1))
+-		print "      no surfaceforcings.precipitation specified: values set as zero"
+-	if numpy.all(numpy.isnan(md.surfaceforcings.mass_balance)) and (md.surfaceforcings.ispdd==0):
+-		md.surfaceforcings.mass_balance=numpy.zeros((md.mesh.numberofvertices,1))
+-		print "      no surfaceforcings.mass_balance specified: values set as zero"
+-	if numpy.all(numpy.isnan(md.basalforcings.melting_rate)):
+-		md.basalforcings.melting_rate=numpy.zeros((md.mesh.numberofvertices,1))
+-		print "      no basalforcings.melting_rate specified: values set as zero"
++	md.surfaceforcings.initialize(md)
++	md.basalforcings.initialize(md)
++
++	#Deal with other boundary conditions
+ 	if numpy.all(numpy.isnan(md.balancethickness.thickening_rate)):
+ 		md.balancethickness.thickening_rate=numpy.zeros((md.mesh.numberofvertices,1))
+ 		print "      no balancethickness.thickening_rate specified: values set as zero"
+Index: ../trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.m
+===================================================================
+--- ../trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.m	(revision 17070)
++++ ../trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.m	(revision 17071)
+@@ -61,24 +61,15 @@
+ 	disp('      boundary conditions for stressbalance model: spc set as zero');
+ end
+ 
+-%Create zeros basalforcings and surfaceforcings
+-if (isnan(md.surfaceforcings.precipitation) & (md.surfaceforcings.ispdd==1)),
+-	md.surfaceforcings.precipitation=zeros(md.mesh.numberofvertices,1);
+-	disp('      no surfaceforcings.precipitation specified: values set as zero');
+-end
+-if (isnan(md.surfaceforcings.mass_balance) & (md.surfaceforcings.ispdd==0)),
+-	        md.surfaceforcings.mass_balance=zeros(md.mesh.numberofvertices,1);
+-		disp('      no surfaceforcings.mass_balance specified: values set as zero');
+-end
+-if isnan(md.basalforcings.melting_rate),
+-	md.basalforcings.melting_rate=zeros(md.mesh.numberofvertices,1);
+-	disp('      no basalforcings.melting_rate specified: values set as zero');
+-end
++%Initialize surface and basal forcings
++md.surfaceforcings = initialize(md.surfaceforcings,md);
++md.basalforcings   = initialize(md.basalforcings,md);
++
++%Deal with other boundary conditions
+ if isnan(md.balancethickness.thickening_rate),
+ 	md.balancethickness.thickening_rate=zeros(md.mesh.numberofvertices,1);
+ 	disp('      no balancethickness.thickening_rate specified: values set as zero');
+ end
+-
+ md.masstransport.spcthickness=NaN*ones(md.mesh.numberofvertices,1);
+ md.balancethickness.spcthickness=NaN*ones(md.mesh.numberofvertices,1);
+ md.damage.spcdamage=NaN*ones(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/src/m/classes/surfaceforcings.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/surfaceforcings.py	(revision 17070)
++++ ../trunk-jpl/src/m/classes/surfaceforcings.py	(revision 17071)
+@@ -58,6 +58,17 @@
+ 
+ 		return string
+ 		#}}}
++	def initialize(self,md): # {{{
++
++		if numpy.all(numpy.isnan(self.precipitation)) and (self.ispdd==1):
++			self.precipitation=numpy.zeros((md.mesh.numberofvertices,1))
++			print "      no surfaceforcings.precipitation specified: values set as zero"
++		if numpy.all(numpy.isnan(self.mass_balance)) and (self.ispdd==0):
++			self.mass_balance=numpy.zeros((md.mesh.numberofvertices,1))
++			print "      no surfaceforcings.mass_balance specified: values set as zero"
++
++		return self
++	#}}}
+ 	def setdefaultparameters(self): # {{{
+ 		  
+ 		#pdd method not used in default mode
+Index: ../trunk-jpl/src/m/classes/surfaceforcings.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/surfaceforcings.m	(revision 17070)
++++ ../trunk-jpl/src/m/classes/surfaceforcings.m	(revision 17071)
+@@ -32,6 +32,18 @@
+ 					error('constructor not supported');
+ 			end
+ 		end % }}}
++		function self = initialize(self,md) % {{{
++
++			if (isnan(self.precipitation) & (self.ispdd==1)),
++				self.precipitation=zeros(md.mesh.numberofvertices,1);
++				disp('      no surfaceforcings.precipitation specified: values set as zero');
++			end
++			if (isnan(self.mass_balance) & (self.ispdd==0)),
++				self.mass_balance=zeros(md.mesh.numberofvertices,1);
++				disp('      no surfaceforcings.mass_balance specified: values set as zero');
++			end
++
++		end % }}}
+ 		function obj = setdefaultparameters(obj) % {{{
+ 
+ 		  %pdd method not used in default mode
+Index: ../trunk-jpl/src/m/classes/basalforcings.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/basalforcings.py	(revision 17070)
++++ ../trunk-jpl/src/m/classes/basalforcings.py	(revision 17071)
+@@ -29,6 +29,14 @@
+ 		string="%s\n%s"%(string,fielddisplay(self,"geothermalflux","geothermal heat flux [W/m^2]"))
+ 		return string
+ 		#}}}
++	def initialize(self,md): # {{{
++
++		if numpy.all(numpy.isnan(self.melting_rate)):
++			self.melting_rate=numpy.zeros((md.mesh.numberofvertices,1))
++			print "      no basalforcings.melting_rate specified: values set as zero"
++
++		return self
++	#}}}
+ 	def setdefaultparameters(self): # {{{
+ 		return self
+ 	#}}}
+Index: ../trunk-jpl/src/m/classes/basalforcings.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/basalforcings.m	(revision 17070)
++++ ../trunk-jpl/src/m/classes/basalforcings.m	(revision 17071)
+@@ -18,6 +18,14 @@
+ 					error('constructor not supported');
+ 			end
+ 		end % }}}
++		function self = initialize(self,md) % {{{
++
++			if isnan(self.melting_rate),
++				self.melting_rate=zeros(md.mesh.numberofvertices,1);
++				disp('      no basalforcings.melting_rate specified: values set as zero');
++			end
++
++		end % }}}
+ 		function obj = setdefaultparameters(obj) % {{{
+ 
+ 		end % }}}
Index: issm/oecreview/Archive/16554-17801/ISSM-17071-17072.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17071-17072.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17071-17072.diff	(revision 17802)
@@ -0,0 +1,667 @@
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17071)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17072)
+@@ -29,7 +29,7 @@
+ }/*}}}*/
+ void MasstransportAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+ 
+-	int    stabilization,finiteelement;
++	int    stabilization,finiteelement,smb_model;
+ 	bool   dakota_analysis;
+ 	bool   issmbgradients;
+ 	bool   ispdd;
+@@ -39,9 +39,7 @@
+ 	/*Fetch data needed: */
+ 	iomodel->Constant(&stabilization,MasstransportStabilizationEnum);
+ 	iomodel->Constant(&dakota_analysis,QmuIsdakotaEnum);
+-	iomodel->Constant(&ispdd,SurfaceforcingsIspddEnum);
+-	iomodel->Constant(&isdelta18o,SurfaceforcingsIsdelta18oEnum);
+-	iomodel->Constant(&issmbgradients,SurfaceforcingsIssmbgradientsEnum);
++	iomodel->Constant(&smb_model,SurfaceforcingsEnum);
+ 	iomodel->Constant(&isgroundingline,TransientIsgroundinglineEnum);
+ 
+ 	/*Finite element type*/
+@@ -87,27 +85,40 @@
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
+ 
+-	if(issmbgradients){
+-		iomodel->FetchDataToInput(elements,SurfaceforcingsHrefEnum);
+-		iomodel->FetchDataToInput(elements,SurfaceforcingsSmbrefEnum);
+-		iomodel->FetchDataToInput(elements,SurfaceforcingsBPosEnum);
+-		iomodel->FetchDataToInput(elements,SurfaceforcingsBNegEnum);
++	switch(smb_model){
++		case SMBEnum:
++			iomodel->FetchDataToInput(elements,SurfaceforcingsMassBalanceEnum,0.);
++			break;
++		case SurfaceforcingsEnum: /*To Be REMOVED*/
++			iomodel->Constant(&ispdd,SurfaceforcingsIspddEnum);
++			iomodel->Constant(&isdelta18o,SurfaceforcingsIsdelta18oEnum);
++			iomodel->Constant(&issmbgradients,SurfaceforcingsIssmbgradientsEnum);
++			if(issmbgradients){
++				iomodel->FetchDataToInput(elements,SurfaceforcingsHrefEnum);
++				iomodel->FetchDataToInput(elements,SurfaceforcingsSmbrefEnum);
++				iomodel->FetchDataToInput(elements,SurfaceforcingsBPosEnum);
++				iomodel->FetchDataToInput(elements,SurfaceforcingsBNegEnum);
++			}
++			if(ispdd){
++				iomodel->FetchDataToInput(elements,ThermalSpctemperatureEnum);
++				if(isdelta18o){
++					iomodel->FetchDataToInput(elements,SurfaceforcingsTemperaturesLgmEnum);
++					iomodel->FetchDataToInput(elements,SurfaceforcingsTemperaturesPresentdayEnum);
++					iomodel->FetchDataToInput(elements,SurfaceforcingsPrecipitationsPresentdayEnum);
++				}
++				else{
++					iomodel->FetchDataToInput(elements,SurfaceforcingsPrecipitationEnum);
++					iomodel->FetchDataToInput(elements,SurfaceforcingsMonthlytemperaturesEnum);
++				}
++			}
++			if(~ispdd && ~issmbgradients){
++				iomodel->FetchDataToInput(elements,SurfaceforcingsMassBalanceEnum,0.);
++			}
++			break;
++		default:
++			_error_("Surface mass balance model "<<EnumToStringx(smb_model)<<" not supported yet");
+ 	}
+-	if(ispdd){
+-		iomodel->FetchDataToInput(elements,ThermalSpctemperatureEnum);
+-		if(isdelta18o){
+-			iomodel->FetchDataToInput(elements,SurfaceforcingsTemperaturesLgmEnum);
+-			iomodel->FetchDataToInput(elements,SurfaceforcingsTemperaturesPresentdayEnum);
+-			iomodel->FetchDataToInput(elements,SurfaceforcingsPrecipitationsPresentdayEnum);
+-		}
+-		else{
+-			iomodel->FetchDataToInput(elements,SurfaceforcingsPrecipitationEnum);
+-			iomodel->FetchDataToInput(elements,SurfaceforcingsMonthlytemperaturesEnum);
+-		}
+-	}
+-	if(~ispdd && ~issmbgradients){
+-		iomodel->FetchDataToInput(elements,SurfaceforcingsMassBalanceEnum,0.);
+-	}
++
+ }/*}}}*/
+ void MasstransportAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17071)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17072)
+@@ -236,12 +236,7 @@
+ 	SettingsLowmemEnum,
+ 	SettingsOutputFrequencyEnum,
+ 	SettingsWaitonlockEnum,
+-	SurfaceforcingsDelta18oEnum,
+-	SurfaceforcingsDelta18oSurfaceEnum,
+-	SurfaceforcingsIsdelta18oEnum,
+-	SurfaceforcingsPrecipitationsPresentdayEnum,
+-	SurfaceforcingsTemperaturesPresentdayEnum,
+-	SurfaceforcingsTemperaturesLgmEnum,
++
+ 	DebugProfilingEnum,
+ 	ProfilingCurrentMemEnum,
+ 	ProfilingCurrentFlopsEnum,
+@@ -252,17 +247,7 @@
+ 	SteadystateReltolEnum,
+ 	SteadystateRequestedOutputsEnum,
+ 	SurfaceEnum,
+-	SurfaceforcingsPrecipitationEnum,
+-	SurfaceforcingsMassBalanceEnum,
+-	SurfaceforcingsIspddEnum,
+-	SurfaceforcingsDesfacEnum,
+-	SurfaceforcingsS0pEnum,
+-	SurfaceforcingsIssmbgradientsEnum,
+-	SurfaceforcingsMonthlytemperaturesEnum,
+-	SurfaceforcingsHrefEnum,
+-	SurfaceforcingsSmbrefEnum,
+-	SurfaceforcingsBPosEnum,
+-	SurfaceforcingsBNegEnum,
++
+ 	ThermalIsenthalpyEnum,
+ 	ThermalIsdynamicbasalspcEnum,
+ 	ThermalMaxiterEnum,
+@@ -290,6 +275,28 @@
+ 	TransientNumRequestedOutputsEnum,
+ 	TransientRequestedOutputsEnum,
+ 	/*}}}*/
++	/*Surfaceforcings{{{*/
++	SurfaceforcingsEnum,
++	SMBEnum,
++	SurfaceforcingsMassBalanceEnum,
++
++	SurfaceforcingsDelta18oEnum,
++	SurfaceforcingsDelta18oSurfaceEnum,
++	SurfaceforcingsIsdelta18oEnum,
++	SurfaceforcingsPrecipitationsPresentdayEnum,
++	SurfaceforcingsTemperaturesPresentdayEnum,
++	SurfaceforcingsTemperaturesLgmEnum,
++	SurfaceforcingsPrecipitationEnum,
++	SurfaceforcingsIspddEnum,
++	SurfaceforcingsDesfacEnum,
++	SurfaceforcingsS0pEnum,
++	SurfaceforcingsIssmbgradientsEnum,
++	SurfaceforcingsMonthlytemperaturesEnum,
++	SurfaceforcingsHrefEnum,
++	SurfaceforcingsSmbrefEnum,
++	SurfaceforcingsBPosEnum,
++	SurfaceforcingsBNegEnum,
++	/*}}}*/
+ 	/*Solutions and Analyses{{{ */
+ 	SolutionTypeEnum,
+ 	AnalysisTypeEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17071)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17072)
+@@ -244,12 +244,6 @@
+ 		case SettingsLowmemEnum : return "SettingsLowmem";
+ 		case SettingsOutputFrequencyEnum : return "SettingsOutputFrequency";
+ 		case SettingsWaitonlockEnum : return "SettingsWaitonlock";
+-		case SurfaceforcingsDelta18oEnum : return "SurfaceforcingsDelta18o";
+-		case SurfaceforcingsDelta18oSurfaceEnum : return "SurfaceforcingsDelta18oSurface";
+-		case SurfaceforcingsIsdelta18oEnum : return "SurfaceforcingsIsdelta18o";
+-		case SurfaceforcingsPrecipitationsPresentdayEnum : return "SurfaceforcingsPrecipitationsPresentday";
+-		case SurfaceforcingsTemperaturesPresentdayEnum : return "SurfaceforcingsTemperaturesPresentday";
+-		case SurfaceforcingsTemperaturesLgmEnum : return "SurfaceforcingsTemperaturesLgm";
+ 		case DebugProfilingEnum : return "DebugProfiling";
+ 		case ProfilingCurrentMemEnum : return "ProfilingCurrentMem";
+ 		case ProfilingCurrentFlopsEnum : return "ProfilingCurrentFlops";
+@@ -260,17 +254,6 @@
+ 		case SteadystateReltolEnum : return "SteadystateReltol";
+ 		case SteadystateRequestedOutputsEnum : return "SteadystateRequestedOutputs";
+ 		case SurfaceEnum : return "Surface";
+-		case SurfaceforcingsPrecipitationEnum : return "SurfaceforcingsPrecipitation";
+-		case SurfaceforcingsMassBalanceEnum : return "SurfaceforcingsMassBalance";
+-		case SurfaceforcingsIspddEnum : return "SurfaceforcingsIspdd";
+-		case SurfaceforcingsDesfacEnum : return "SurfaceforcingsDesfac";
+-		case SurfaceforcingsS0pEnum : return "SurfaceforcingsS0p";
+-		case SurfaceforcingsIssmbgradientsEnum : return "SurfaceforcingsIssmbgradients";
+-		case SurfaceforcingsMonthlytemperaturesEnum : return "SurfaceforcingsMonthlytemperatures";
+-		case SurfaceforcingsHrefEnum : return "SurfaceforcingsHref";
+-		case SurfaceforcingsSmbrefEnum : return "SurfaceforcingsSmbref";
+-		case SurfaceforcingsBPosEnum : return "SurfaceforcingsBPos";
+-		case SurfaceforcingsBNegEnum : return "SurfaceforcingsBNeg";
+ 		case ThermalIsenthalpyEnum : return "ThermalIsenthalpy";
+ 		case ThermalIsdynamicbasalspcEnum : return "ThermalIsdynamicbasalspc";
+ 		case ThermalMaxiterEnum : return "ThermalMaxiter";
+@@ -297,6 +280,25 @@
+ 		case TransientIsdamageEnum : return "TransientIsdamage";
+ 		case TransientNumRequestedOutputsEnum : return "TransientNumRequestedOutputs";
+ 		case TransientRequestedOutputsEnum : return "TransientRequestedOutputs";
++		case SurfaceforcingsEnum : return "Surfaceforcings";
++		case SMBEnum : return "SMB";
++		case SurfaceforcingsMassBalanceEnum : return "SurfaceforcingsMassBalance";
++		case SurfaceforcingsDelta18oEnum : return "SurfaceforcingsDelta18o";
++		case SurfaceforcingsDelta18oSurfaceEnum : return "SurfaceforcingsDelta18oSurface";
++		case SurfaceforcingsIsdelta18oEnum : return "SurfaceforcingsIsdelta18o";
++		case SurfaceforcingsPrecipitationsPresentdayEnum : return "SurfaceforcingsPrecipitationsPresentday";
++		case SurfaceforcingsTemperaturesPresentdayEnum : return "SurfaceforcingsTemperaturesPresentday";
++		case SurfaceforcingsTemperaturesLgmEnum : return "SurfaceforcingsTemperaturesLgm";
++		case SurfaceforcingsPrecipitationEnum : return "SurfaceforcingsPrecipitation";
++		case SurfaceforcingsIspddEnum : return "SurfaceforcingsIspdd";
++		case SurfaceforcingsDesfacEnum : return "SurfaceforcingsDesfac";
++		case SurfaceforcingsS0pEnum : return "SurfaceforcingsS0p";
++		case SurfaceforcingsIssmbgradientsEnum : return "SurfaceforcingsIssmbgradients";
++		case SurfaceforcingsMonthlytemperaturesEnum : return "SurfaceforcingsMonthlytemperatures";
++		case SurfaceforcingsHrefEnum : return "SurfaceforcingsHref";
++		case SurfaceforcingsSmbrefEnum : return "SurfaceforcingsSmbref";
++		case SurfaceforcingsBPosEnum : return "SurfaceforcingsBPos";
++		case SurfaceforcingsBNegEnum : return "SurfaceforcingsBNeg";
+ 		case SolutionTypeEnum : return "SolutionType";
+ 		case AnalysisTypeEnum : return "AnalysisType";
+ 		case ConfigurationTypeEnum : return "ConfigurationType";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17071)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17072)
+@@ -247,39 +247,22 @@
+ 	      else if (strcmp(name,"SettingsLowmem")==0) return SettingsLowmemEnum;
+ 	      else if (strcmp(name,"SettingsOutputFrequency")==0) return SettingsOutputFrequencyEnum;
+ 	      else if (strcmp(name,"SettingsWaitonlock")==0) return SettingsWaitonlockEnum;
+-	      else if (strcmp(name,"SurfaceforcingsDelta18o")==0) return SurfaceforcingsDelta18oEnum;
+-	      else if (strcmp(name,"SurfaceforcingsDelta18oSurface")==0) return SurfaceforcingsDelta18oSurfaceEnum;
+-	      else if (strcmp(name,"SurfaceforcingsIsdelta18o")==0) return SurfaceforcingsIsdelta18oEnum;
+-	      else if (strcmp(name,"SurfaceforcingsPrecipitationsPresentday")==0) return SurfaceforcingsPrecipitationsPresentdayEnum;
+-	      else if (strcmp(name,"SurfaceforcingsTemperaturesPresentday")==0) return SurfaceforcingsTemperaturesPresentdayEnum;
+-	      else if (strcmp(name,"SurfaceforcingsTemperaturesLgm")==0) return SurfaceforcingsTemperaturesLgmEnum;
+ 	      else if (strcmp(name,"DebugProfiling")==0) return DebugProfilingEnum;
+ 	      else if (strcmp(name,"ProfilingCurrentMem")==0) return ProfilingCurrentMemEnum;
+ 	      else if (strcmp(name,"ProfilingCurrentFlops")==0) return ProfilingCurrentFlopsEnum;
+ 	      else if (strcmp(name,"ProfilingSolutionTime")==0) return ProfilingSolutionTimeEnum;
+ 	      else if (strcmp(name,"MaxIterationConvergenceFlag")==0) return MaxIterationConvergenceFlagEnum;
+ 	      else if (strcmp(name,"SteadystateMaxiter")==0) return SteadystateMaxiterEnum;
+-         else stage=3;
+-   }
+-   if(stage==3){
+-	      if (strcmp(name,"SteadystateNumRequestedOutputs")==0) return SteadystateNumRequestedOutputsEnum;
++	      else if (strcmp(name,"SteadystateNumRequestedOutputs")==0) return SteadystateNumRequestedOutputsEnum;
+ 	      else if (strcmp(name,"SteadystateReltol")==0) return SteadystateReltolEnum;
+ 	      else if (strcmp(name,"SteadystateRequestedOutputs")==0) return SteadystateRequestedOutputsEnum;
+ 	      else if (strcmp(name,"Surface")==0) return SurfaceEnum;
+-	      else if (strcmp(name,"SurfaceforcingsPrecipitation")==0) return SurfaceforcingsPrecipitationEnum;
+-	      else if (strcmp(name,"SurfaceforcingsMassBalance")==0) return SurfaceforcingsMassBalanceEnum;
+-	      else if (strcmp(name,"SurfaceforcingsIspdd")==0) return SurfaceforcingsIspddEnum;
+-	      else if (strcmp(name,"SurfaceforcingsDesfac")==0) return SurfaceforcingsDesfacEnum;
+-	      else if (strcmp(name,"SurfaceforcingsS0p")==0) return SurfaceforcingsS0pEnum;
+-	      else if (strcmp(name,"SurfaceforcingsIssmbgradients")==0) return SurfaceforcingsIssmbgradientsEnum;
+-	      else if (strcmp(name,"SurfaceforcingsMonthlytemperatures")==0) return SurfaceforcingsMonthlytemperaturesEnum;
+-	      else if (strcmp(name,"SurfaceforcingsHref")==0) return SurfaceforcingsHrefEnum;
+-	      else if (strcmp(name,"SurfaceforcingsSmbref")==0) return SurfaceforcingsSmbrefEnum;
+-	      else if (strcmp(name,"SurfaceforcingsBPos")==0) return SurfaceforcingsBPosEnum;
+-	      else if (strcmp(name,"SurfaceforcingsBNeg")==0) return SurfaceforcingsBNegEnum;
+ 	      else if (strcmp(name,"ThermalIsenthalpy")==0) return ThermalIsenthalpyEnum;
+ 	      else if (strcmp(name,"ThermalIsdynamicbasalspc")==0) return ThermalIsdynamicbasalspcEnum;
+-	      else if (strcmp(name,"ThermalMaxiter")==0) return ThermalMaxiterEnum;
++         else stage=3;
++   }
++   if(stage==3){
++	      if (strcmp(name,"ThermalMaxiter")==0) return ThermalMaxiterEnum;
+ 	      else if (strcmp(name,"ThermalPenaltyFactor")==0) return ThermalPenaltyFactorEnum;
+ 	      else if (strcmp(name,"ThermalPenaltyLock")==0) return ThermalPenaltyLockEnum;
+ 	      else if (strcmp(name,"ThermalPenaltyThreshold")==0) return ThermalPenaltyThresholdEnum;
+@@ -303,6 +286,25 @@
+ 	      else if (strcmp(name,"TransientIsdamage")==0) return TransientIsdamageEnum;
+ 	      else if (strcmp(name,"TransientNumRequestedOutputs")==0) return TransientNumRequestedOutputsEnum;
+ 	      else if (strcmp(name,"TransientRequestedOutputs")==0) return TransientRequestedOutputsEnum;
++	      else if (strcmp(name,"Surfaceforcings")==0) return SurfaceforcingsEnum;
++	      else if (strcmp(name,"SMB")==0) return SMBEnum;
++	      else if (strcmp(name,"SurfaceforcingsMassBalance")==0) return SurfaceforcingsMassBalanceEnum;
++	      else if (strcmp(name,"SurfaceforcingsDelta18o")==0) return SurfaceforcingsDelta18oEnum;
++	      else if (strcmp(name,"SurfaceforcingsDelta18oSurface")==0) return SurfaceforcingsDelta18oSurfaceEnum;
++	      else if (strcmp(name,"SurfaceforcingsIsdelta18o")==0) return SurfaceforcingsIsdelta18oEnum;
++	      else if (strcmp(name,"SurfaceforcingsPrecipitationsPresentday")==0) return SurfaceforcingsPrecipitationsPresentdayEnum;
++	      else if (strcmp(name,"SurfaceforcingsTemperaturesPresentday")==0) return SurfaceforcingsTemperaturesPresentdayEnum;
++	      else if (strcmp(name,"SurfaceforcingsTemperaturesLgm")==0) return SurfaceforcingsTemperaturesLgmEnum;
++	      else if (strcmp(name,"SurfaceforcingsPrecipitation")==0) return SurfaceforcingsPrecipitationEnum;
++	      else if (strcmp(name,"SurfaceforcingsIspdd")==0) return SurfaceforcingsIspddEnum;
++	      else if (strcmp(name,"SurfaceforcingsDesfac")==0) return SurfaceforcingsDesfacEnum;
++	      else if (strcmp(name,"SurfaceforcingsS0p")==0) return SurfaceforcingsS0pEnum;
++	      else if (strcmp(name,"SurfaceforcingsIssmbgradients")==0) return SurfaceforcingsIssmbgradientsEnum;
++	      else if (strcmp(name,"SurfaceforcingsMonthlytemperatures")==0) return SurfaceforcingsMonthlytemperaturesEnum;
++	      else if (strcmp(name,"SurfaceforcingsHref")==0) return SurfaceforcingsHrefEnum;
++	      else if (strcmp(name,"SurfaceforcingsSmbref")==0) return SurfaceforcingsSmbrefEnum;
++	      else if (strcmp(name,"SurfaceforcingsBPos")==0) return SurfaceforcingsBPosEnum;
++	      else if (strcmp(name,"SurfaceforcingsBNeg")==0) return SurfaceforcingsBNegEnum;
+ 	      else if (strcmp(name,"SolutionType")==0) return SolutionTypeEnum;
+ 	      else if (strcmp(name,"AnalysisType")==0) return AnalysisTypeEnum;
+ 	      else if (strcmp(name,"ConfigurationType")==0) return ConfigurationTypeEnum;
+@@ -380,12 +382,12 @@
+ 	      else if (strcmp(name,"ControlInput")==0) return ControlInputEnum;
+ 	      else if (strcmp(name,"DatasetInput")==0) return DatasetInputEnum;
+ 	      else if (strcmp(name,"DoubleInput")==0) return DoubleInputEnum;
+-	      else if (strcmp(name,"DataSetParam")==0) return DataSetParamEnum;
+-	      else if (strcmp(name,"DoubleMatArrayParam")==0) return DoubleMatArrayParamEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"DoubleMatParam")==0) return DoubleMatParamEnum;
++	      if (strcmp(name,"DataSetParam")==0) return DataSetParamEnum;
++	      else if (strcmp(name,"DoubleMatArrayParam")==0) return DoubleMatArrayParamEnum;
++	      else if (strcmp(name,"DoubleMatParam")==0) return DoubleMatParamEnum;
+ 	      else if (strcmp(name,"DoubleParam")==0) return DoubleParamEnum;
+ 	      else if (strcmp(name,"DoubleVecParam")==0) return DoubleVecParamEnum;
+ 	      else if (strcmp(name,"Element")==0) return ElementEnum;
+@@ -503,12 +505,12 @@
+ 	      else if (strcmp(name,"IntMatParam")==0) return IntMatParamEnum;
+ 	      else if (strcmp(name,"RheologyBbarAbsGradient")==0) return RheologyBbarAbsGradientEnum;
+ 	      else if (strcmp(name,"DragCoefficientAbsGradient")==0) return DragCoefficientAbsGradientEnum;
+-	      else if (strcmp(name,"TransientInput")==0) return TransientInputEnum;
+-	      else if (strcmp(name,"Waterfraction")==0) return WaterfractionEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"Watercolumn")==0) return WatercolumnEnum;
++	      if (strcmp(name,"TransientInput")==0) return TransientInputEnum;
++	      else if (strcmp(name,"Waterfraction")==0) return WaterfractionEnum;
++	      else if (strcmp(name,"Watercolumn")==0) return WatercolumnEnum;
+ 	      else if (strcmp(name,"BasalFriction")==0) return BasalFrictionEnum;
+ 	      else if (strcmp(name,"ViscousHeating")==0) return ViscousHeatingEnum;
+ 	      else if (strcmp(name,"QmuTemperature")==0) return QmuTemperatureEnum;
+@@ -626,12 +628,12 @@
+ 	      else if (strcmp(name,"XYZ")==0) return XYZEnum;
+ 	      else if (strcmp(name,"Dense")==0) return DenseEnum;
+ 	      else if (strcmp(name,"MpiDense")==0) return MpiDenseEnum;
+-	      else if (strcmp(name,"MpiSparse")==0) return MpiSparseEnum;
+-	      else if (strcmp(name,"Seq")==0) return SeqEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"Mpi")==0) return MpiEnum;
++	      if (strcmp(name,"MpiSparse")==0) return MpiSparseEnum;
++	      else if (strcmp(name,"Seq")==0) return SeqEnum;
++	      else if (strcmp(name,"Mpi")==0) return MpiEnum;
+ 	      else if (strcmp(name,"Mumps")==0) return MumpsEnum;
+ 	      else if (strcmp(name,"Gsl")==0) return GslEnum;
+ 	      else if (strcmp(name,"Option")==0) return OptionEnum;
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17071)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17072)
+@@ -18,7 +18,7 @@
+ void CreateParameters(Parameters* parameters,IoModel* iomodel,char* rootpath,FILE* toolkitsoptionsfid,const int solution_type){
+ 
+ 	int         i,j,m,k;
+-	int         numoutputs,meshtype;
++	int         numoutputs,meshtype,smb_model;
+ 	char**      requestedoutputs = NULL;
+ 	IssmDouble  time;
+ 	bool        ispdd,isdelta18o;
+@@ -71,9 +71,6 @@
+ 	parameters->AddObject(iomodel->CopyConstantObject(QmuIsdakotaEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(InversionIscontrolEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(InversionTaoEnum));
+-	parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsIspddEnum));
+-	parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsIsdelta18oEnum));
+-	parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsIssmbgradientsEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(GiaCrossSectionShapeEnum));
+ 
+ 	/*For stress balance only*/
+@@ -86,30 +83,41 @@
+ 	if(iomodel->meshtype==Mesh3DEnum)
+ 	 parameters->AddObject(iomodel->CopyConstantObject(MeshNumberoflayersEnum));
+ 
+-	iomodel->Constant(&ispdd,SurfaceforcingsIspddEnum);
+-	if(ispdd){
++	/*Surface mass balance parameters*/
++	parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsEnum));
++	iomodel->Constant(&smb_model,SurfaceforcingsEnum);
++	switch(smb_model){
++		case SMBEnum:
++			/*Nothing to add to parameters*/
++			break;
++		case SurfaceforcingsEnum: /*To Be REMOVED*/
++			parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsIspddEnum));
++			parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsIsdelta18oEnum));
++			parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsIssmbgradientsEnum));
++			iomodel->Constant(&ispdd,SurfaceforcingsIspddEnum);
++			if(ispdd){
++				parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsDesfacEnum));
++				parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsS0pEnum));
++				iomodel->Constant(&isdelta18o,SurfaceforcingsIsdelta18oEnum);
++				if(isdelta18o){
++					IssmDouble *temp = NULL;
++					IssmDouble  yts;
++					int         N,M;
++					iomodel->Constant(&yts,ConstantsYtsEnum);
++					iomodel->FetchData(&temp,&N,&M,SurfaceforcingsDelta18oEnum); _assert_(N==2);
++					for(i=0;i<M;i++) temp[M+i]=yts*temp[M+i];
++					parameters->AddObject(new TransientParam(SurfaceforcingsDelta18oEnum,&temp[0],&temp[M],M));
++					iomodel->DeleteData(temp,SurfaceforcingsDelta18oEnum);
+ 
+-		parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsDesfacEnum));
+-		parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsS0pEnum));
+-
+-		iomodel->Constant(&isdelta18o,SurfaceforcingsIsdelta18oEnum);
+-		if(isdelta18o){
+-			IssmDouble *temp = NULL;
+-			IssmDouble  yts;
+-			int         N,M;
+-
+-			iomodel->Constant(&yts,ConstantsYtsEnum);
+-
+-			iomodel->FetchData(&temp,&N,&M,SurfaceforcingsDelta18oEnum); _assert_(N==2);
+-			for(i=0;i<M;i++) temp[M+i]=yts*temp[M+i];
+-			parameters->AddObject(new TransientParam(SurfaceforcingsDelta18oEnum,&temp[0],&temp[M],M));
+-			iomodel->DeleteData(temp,SurfaceforcingsDelta18oEnum);
+-
+-			iomodel->FetchData(&temp,&N,&M,SurfaceforcingsDelta18oSurfaceEnum); _assert_(N==2);
+-			for(i=0;i<M;i++) temp[M+i]=yts*temp[M+i];
+-			parameters->AddObject(new TransientParam(SurfaceforcingsDelta18oSurfaceEnum,&temp[0],&temp[M],M));
+-			iomodel->DeleteData(temp,SurfaceforcingsDelta18oSurfaceEnum);
+-		}
++					iomodel->FetchData(&temp,&N,&M,SurfaceforcingsDelta18oSurfaceEnum); _assert_(N==2);
++					for(i=0;i<M;i++) temp[M+i]=yts*temp[M+i];
++					parameters->AddObject(new TransientParam(SurfaceforcingsDelta18oSurfaceEnum,&temp[0],&temp[M],M));
++					iomodel->DeleteData(temp,SurfaceforcingsDelta18oSurfaceEnum);
++				}
++			}
++			break;
++		default:
++			_error_("Surface mass balance model "<<EnumToStringx(smb_model)<<" not supported yet");
+ 	}
+ 
+ 	/*some parameters that did not come with the iomodel: */
+Index: ../trunk-jpl/src/c/cores/masstransport_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/masstransport_core.cpp	(revision 17071)
++++ ../trunk-jpl/src/c/cores/masstransport_core.cpp	(revision 17072)
+@@ -13,7 +13,7 @@
+ 
+ 	/*parameters: */
+ 	int    i;
+-	int    numoutputs,meshtype;
++	int    numoutputs,meshtype,smb_model;
+ 	bool   save_results;
+ 	bool   issmbgradients,ispdd,isdelta18o,isFS,isfreesurface,dakota_analysis;
+ 	int    solution_type;
+@@ -24,9 +24,7 @@
+ 
+ 	/*recover parameters: */
+ 	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
+-	femmodel->parameters->FindParam(&issmbgradients,SurfaceforcingsIssmbgradientsEnum);
+-	femmodel->parameters->FindParam(&ispdd,SurfaceforcingsIspddEnum);
+-	femmodel->parameters->FindParam(&isdelta18o,SurfaceforcingsIsdelta18oEnum);
++	femmodel->parameters->FindParam(&smb_model,SurfaceforcingsEnum);
+ 	femmodel->parameters->FindParam(&isFS,FlowequationIsFSEnum);
+ 	femmodel->parameters->FindParam(&isfreesurface,MasstransportIsfreesurfaceEnum);
+ 	femmodel->parameters->FindParam(&dakota_analysis,QmuIsdakotaEnum);
+@@ -42,18 +40,30 @@
+ 		InputDuplicatex(femmodel,QmuBedEnum,BedEnum);
+ 	}
+ 
+-	if(issmbgradients){
+-	  if(VerboseSolution())_printf_("	call smb gradients module\n\n");
+-	  SmbGradientsx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
++	switch(smb_model){
++		case SMBEnum:
++			/*Nothing to be done*/
++			break;
++		case SurfaceforcingsEnum: /*To Be REMOVED*/
++			femmodel->parameters->FindParam(&issmbgradients,SurfaceforcingsIssmbgradientsEnum);
++			femmodel->parameters->FindParam(&ispdd,SurfaceforcingsIspddEnum);
++			femmodel->parameters->FindParam(&isdelta18o,SurfaceforcingsIsdelta18oEnum);
++			if(issmbgradients){
++				if(VerboseSolution())_printf_("	call smb gradients module\n\n");
++				SmbGradientsx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
++			}
++			if(ispdd){
++				if(isdelta18o){
++					if(VerboseSolution()) _printf0_("   call Delta18oParametrization module\n");
++					Delta18oParameterizationx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
++				} 
++				if(VerboseSolution()) _printf0_("   call positive degree day module\n");
++				PositiveDegreeDayx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
++			}
++			break;
++		default:
++			_error_("Surface mass balance model "<<EnumToStringx(smb_model)<<" not supported yet");
+ 	}
+-	if(ispdd){
+-		if(isdelta18o){
+-			if(VerboseSolution()) _printf0_("   call Delta18oParametrization module\n");
+-			Delta18oParameterizationx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
+-		} 
+-		if(VerboseSolution()) _printf0_("   call positive degree day module\n");
+-		PositiveDegreeDayx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
+-	}
+ 
+ 	if(isFS && isfreesurface){
+ 		if(VerboseSolution()) _printf0_("   call free surface computational core\n");
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 17071)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 17072)
+@@ -22,9 +22,9 @@
+ 
+ 	bool ispdd;
+ 	bool isefficientlayer;
+-	int  hydrology_model;
++	int  hydrology_model,smb_model;
+ 	iomodel->Constant(&hydrology_model,HydrologyModelEnum);
+-	iomodel->Constant(&ispdd,SurfaceforcingsIspddEnum);
++	iomodel->Constant(&smb_model,SurfaceforcingsEnum);
+ 
+ 	this->mid = matpar_mid;
+ 	iomodel->Constant(&this->rho_ice,MaterialsRhoIceEnum);
+@@ -42,9 +42,19 @@
+ 	iomodel->Constant(&this->thermal_exchange_velocity,MaterialsThermalExchangeVelocityEnum);
+ 	iomodel->Constant(&this->g,ConstantsGEnum);
+ 
+-	if(ispdd){
+-		iomodel->Constant(&this->desfac,SurfaceforcingsDesfacEnum);
+-		iomodel->Constant(&this->s0p,SurfaceforcingsS0pEnum);
++	switch(smb_model){
++		case SMBEnum:
++			/*Nothing to add*/
++			break;
++		case SurfaceforcingsEnum: /*To Be REMOVED*/
++			iomodel->Constant(&ispdd,SurfaceforcingsIspddEnum);
++			if(ispdd){
++				iomodel->Constant(&this->desfac,SurfaceforcingsDesfacEnum);
++				iomodel->Constant(&this->s0p,SurfaceforcingsS0pEnum);
++			}
++			break;
++		default:
++			_error_("Surface mass balance model "<<EnumToStringx(smb_model)<<" not supported yet");
+ 	}
+ 
+ 	if(hydrology_model==HydrologyshreveEnum){
+Index: ../trunk-jpl/src/m/classes/surfaceforcings.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/surfaceforcings.py	(revision 17071)
++++ ../trunk-jpl/src/m/classes/surfaceforcings.py	(revision 17072)
+@@ -114,6 +114,8 @@
+ 
+ 		yts=365.0*24.0*3600.0
+ 
++		WriteData(fid,'enum',SurfaceforcingsEnum(),'data',SurfaceforcingsEnum(),'format','Integer');
++
+ 		WriteData(fid,'object',self,'fieldname','precipitation','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1)
+ 		WriteData(fid,'object',self,'fieldname','mass_balance','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1)
+ 		WriteData(fid,'object',self,'fieldname','ispdd','format','Boolean')
+Index: ../trunk-jpl/src/m/classes/SMB.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/SMB.m	(revision 0)
++++ ../trunk-jpl/src/m/classes/SMB.m	(revision 17072)
+@@ -0,0 +1,47 @@
++%SURFACEFORCING Class definition
++%
++%   Usage:
++%      SMB=SMB();
++
++classdef SMB
++	properties (SetAccess=public) 
++		mass_balance = NaN;
++	end
++	methods
++		function obj = SMB(varargin) % {{{
++			switch nargin
++				case 0
++				otherwise
++					error('constructor not supported');
++			end
++		end % }}}
++		function self = initialize(self,md) % {{{
++
++			if isnan(self.mass_balance)
++				self.mass_balance=zeros(md.mesh.numberofvertices,1);
++				disp('      no surfaceforcings.mass_balance specified: values set as zero');
++			end
++
++		end % }}}
++		function md = checkconsistency(obj,md,solution,analyses) % {{{
++
++			if ismember(MasstransportAnalysisEnum(),analyses),
++				md = checkfield(md,'fieldname','surfaceforcings.mass_balance','forcing',1,'NaN',1);
++			end
++			if ismember(BalancethicknessAnalysisEnum(),analyses),
++				md = checkfield(md,'fieldname','surfaceforcings.mass_balance','size',[md.mesh.numberofvertices 1],'NaN',1);
++			end
++		end % }}}
++		function disp(obj) % {{{
++			disp(sprintf('   surface forcings parameters:'));
++			fielddisplay(obj,'mass_balance','surface mass balance [m/yr ice eq]');
++		end % }}}
++		function marshall(obj,md,fid) % {{{
++
++			yts=365.0*24.0*3600.0;
++
++			WriteData(fid,'enum',SurfaceforcingsEnum(),'data',SMBEnum(),'format','Integer');
++			WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','mass_balance','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1);
++		end % }}}
++	end
++end
+Index: ../trunk-jpl/src/m/classes/surfaceforcings.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/surfaceforcings.m	(revision 17071)
++++ ../trunk-jpl/src/m/classes/surfaceforcings.m	(revision 17072)
+@@ -115,6 +115,8 @@
+ 
+ 			yts=365.0*24.0*3600.0;
+ 
++			WriteData(fid,'enum',SurfaceforcingsEnum(),'data',SurfaceforcingsEnum(),'format','Integer');
++
+ 			WriteData(fid,'object',obj,'fieldname','precipitation','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1);
+ 			WriteData(fid,'object',obj,'fieldname','mass_balance','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1);
+ 			WriteData(fid,'object',obj,'fieldname','ispdd','format','Boolean');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17071)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17072)
+@@ -236,12 +236,6 @@
+ def SettingsLowmemEnum(): return StringToEnum("SettingsLowmem")[0]
+ def SettingsOutputFrequencyEnum(): return StringToEnum("SettingsOutputFrequency")[0]
+ def SettingsWaitonlockEnum(): return StringToEnum("SettingsWaitonlock")[0]
+-def SurfaceforcingsDelta18oEnum(): return StringToEnum("SurfaceforcingsDelta18o")[0]
+-def SurfaceforcingsDelta18oSurfaceEnum(): return StringToEnum("SurfaceforcingsDelta18oSurface")[0]
+-def SurfaceforcingsIsdelta18oEnum(): return StringToEnum("SurfaceforcingsIsdelta18o")[0]
+-def SurfaceforcingsPrecipitationsPresentdayEnum(): return StringToEnum("SurfaceforcingsPrecipitationsPresentday")[0]
+-def SurfaceforcingsTemperaturesPresentdayEnum(): return StringToEnum("SurfaceforcingsTemperaturesPresentday")[0]
+-def SurfaceforcingsTemperaturesLgmEnum(): return StringToEnum("SurfaceforcingsTemperaturesLgm")[0]
+ def DebugProfilingEnum(): return StringToEnum("DebugProfiling")[0]
+ def ProfilingCurrentMemEnum(): return StringToEnum("ProfilingCurrentMem")[0]
+ def ProfilingCurrentFlopsEnum(): return StringToEnum("ProfilingCurrentFlops")[0]
+@@ -252,17 +246,6 @@
+ def SteadystateReltolEnum(): return StringToEnum("SteadystateReltol")[0]
+ def SteadystateRequestedOutputsEnum(): return StringToEnum("SteadystateRequestedOutputs")[0]
+ def SurfaceEnum(): return StringToEnum("Surface")[0]
+-def SurfaceforcingsPrecipitationEnum(): return StringToEnum("SurfaceforcingsPrecipitation")[0]
+-def SurfaceforcingsMassBalanceEnum(): return StringToEnum("SurfaceforcingsMassBalance")[0]
+-def SurfaceforcingsIspddEnum(): return StringToEnum("SurfaceforcingsIspdd")[0]
+-def SurfaceforcingsDesfacEnum(): return StringToEnum("SurfaceforcingsDesfac")[0]
+-def SurfaceforcingsS0pEnum(): return StringToEnum("SurfaceforcingsS0p")[0]
+-def SurfaceforcingsIssmbgradientsEnum(): return StringToEnum("SurfaceforcingsIssmbgradients")[0]
+-def SurfaceforcingsMonthlytemperaturesEnum(): return StringToEnum("SurfaceforcingsMonthlytemperatures")[0]
+-def SurfaceforcingsHrefEnum(): return StringToEnum("SurfaceforcingsHref")[0]
+-def SurfaceforcingsSmbrefEnum(): return StringToEnum("SurfaceforcingsSmbref")[0]
+-def SurfaceforcingsBPosEnum(): return StringToEnum("SurfaceforcingsBPos")[0]
+-def SurfaceforcingsBNegEnum(): return StringToEnum("SurfaceforcingsBNeg")[0]
+ def ThermalIsenthalpyEnum(): return StringToEnum("ThermalIsenthalpy")[0]
+ def ThermalIsdynamicbasalspcEnum(): return StringToEnum("ThermalIsdynamicbasalspc")[0]
+ def ThermalMaxiterEnum(): return StringToEnum("ThermalMaxiter")[0]
+@@ -289,6 +272,25 @@
+ def TransientIsdamageEnum(): return StringToEnum("TransientIsdamage")[0]
+ def TransientNumRequestedOutputsEnum(): return StringToEnum("TransientNumRequestedOutputs")[0]
+ def TransientRequestedOutputsEnum(): return StringToEnum("TransientRequestedOutputs")[0]
++def SurfaceforcingsEnum(): return StringToEnum("Surfaceforcings")[0]
++def SMBEnum(): return StringToEnum("SMB")[0]
++def SurfaceforcingsMassBalanceEnum(): return StringToEnum("SurfaceforcingsMassBalance")[0]
++def SurfaceforcingsDelta18oEnum(): return StringToEnum("SurfaceforcingsDelta18o")[0]
++def SurfaceforcingsDelta18oSurfaceEnum(): return StringToEnum("SurfaceforcingsDelta18oSurface")[0]
++def SurfaceforcingsIsdelta18oEnum(): return StringToEnum("SurfaceforcingsIsdelta18o")[0]
++def SurfaceforcingsPrecipitationsPresentdayEnum(): return StringToEnum("SurfaceforcingsPrecipitationsPresentday")[0]
++def SurfaceforcingsTemperaturesPresentdayEnum(): return StringToEnum("SurfaceforcingsTemperaturesPresentday")[0]
++def SurfaceforcingsTemperaturesLgmEnum(): return StringToEnum("SurfaceforcingsTemperaturesLgm")[0]
++def SurfaceforcingsPrecipitationEnum(): return StringToEnum("SurfaceforcingsPrecipitation")[0]
++def SurfaceforcingsIspddEnum(): return StringToEnum("SurfaceforcingsIspdd")[0]
++def SurfaceforcingsDesfacEnum(): return StringToEnum("SurfaceforcingsDesfac")[0]
++def SurfaceforcingsS0pEnum(): return StringToEnum("SurfaceforcingsS0p")[0]
++def SurfaceforcingsIssmbgradientsEnum(): return StringToEnum("SurfaceforcingsIssmbgradients")[0]
++def SurfaceforcingsMonthlytemperaturesEnum(): return StringToEnum("SurfaceforcingsMonthlytemperatures")[0]
++def SurfaceforcingsHrefEnum(): return StringToEnum("SurfaceforcingsHref")[0]
++def SurfaceforcingsSmbrefEnum(): return StringToEnum("SurfaceforcingsSmbref")[0]
++def SurfaceforcingsBPosEnum(): return StringToEnum("SurfaceforcingsBPos")[0]
++def SurfaceforcingsBNegEnum(): return StringToEnum("SurfaceforcingsBNeg")[0]
+ def SolutionTypeEnum(): return StringToEnum("SolutionType")[0]
+ def AnalysisTypeEnum(): return StringToEnum("AnalysisType")[0]
+ def ConfigurationTypeEnum(): return StringToEnum("ConfigurationType")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17072-17073.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17072-17073.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17072-17073.diff	(revision 17802)
@@ -0,0 +1,32 @@
+Index: ../trunk-jpl/src/m/enum/SMBEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/SMBEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/SMBEnum.m	(revision 17073)
+@@ -0,0 +1,11 @@
++function macro=SMBEnum()
++%SMBENUM - Enum of SMB
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=SMBEnum()
++
++macro=StringToEnum('SMB');
+Index: ../trunk-jpl/src/m/enum/SurfaceforcingsEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/SurfaceforcingsEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/SurfaceforcingsEnum.m	(revision 17073)
+@@ -0,0 +1,11 @@
++function macro=SurfaceforcingsEnum()
++%SURFACEFORCINGSENUM - Enum of Surfaceforcings
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=SurfaceforcingsEnum()
++
++macro=StringToEnum('Surfaceforcings');
Index: issm/oecreview/Archive/16554-17801/ISSM-17073-17074.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17073-17074.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17073-17074.diff	(revision 17802)
@@ -0,0 +1,73 @@
+Index: ../trunk-jpl/src/m/classes/SMB.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/SMB.py	(revision 0)
++++ ../trunk-jpl/src/m/classes/SMB.py	(revision 17074)
+@@ -0,0 +1,46 @@
++from fielddisplay import fielddisplay
++from EnumDefinitions import *
++from checkfield import *
++from WriteData import *
++
++class SMB(object):
++	"""
++	SMB Class definition
++
++	   Usage:
++	      SMB=SMB();
++	"""
++
++	def __init__(self): # {{{
++		self.mass_balance = float('NaN')
++		#}}}
++	def __repr__(self): # {{{
++		string="   surface forcings parameters:"
++		string="%s\n%s"%(string,fielddisplay(self,'mass_balance','surface mass balance [m/yr ice eq]'))
++		return string
++		#}}}
++	def initialize(self,md): # {{{
++
++		if numpy.all(numpy.isnan(self.mass_balance)):
++			self.mass_balance=numpy.zeros((md.mesh.numberofvertices,1))
++			print "      no SMB.mass_balance specified: values set as zero"
++
++		return self
++	#}}}
++	def checkconsistency(self,md,solution,analyses):    # {{{
++
++		if MasstransportAnalysisEnum() in analyses:
++			md = checkfield(md,'fieldname','surfaceforcings.mass_balance','forcing',1,'NaN',1)
++
++		if BalancethicknessAnalysisEnum() in analyses:
++			md = checkfield(md,'fieldname','surfaceforcings.mass_balance','size',[md.mesh.numberofvertices],'NaN',1)
++
++		return md
++	# }}}
++	def marshall(self,md,fid):    # {{{
++
++		yts=365.0*24.0*3600.0
++
++		WriteData(fid,'enum',SurfaceforcingsEnum(),'data',SMBEnum(),'format','Integer');
++		WriteData(fid,'object',self,'class','surfaceforcings','fieldname','mass_balance','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1)
++	# }}}
+Index: ../trunk-jpl/src/m/classes/SMB.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/SMB.m	(revision 17073)
++++ ../trunk-jpl/src/m/classes/SMB.m	(revision 17074)
+@@ -1,4 +1,4 @@
+-%SURFACEFORCING Class definition
++%SMB Class definition
+ %
+ %   Usage:
+ %      SMB=SMB();
+Index: ../trunk-jpl/src/m/classes/model.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.py	(revision 17073)
++++ ../trunk-jpl/src/m/classes/model.py	(revision 17074)
+@@ -7,6 +7,7 @@
+ from geometry import geometry
+ from constants import constants
+ from surfaceforcings import surfaceforcings
++from SMB import SMB
+ from basalforcings import basalforcings
+ from matice import matice
+ from damage import damage
Index: issm/oecreview/Archive/16554-17801/ISSM-17074-17075.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17074-17075.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17074-17075.diff	(revision 17802)
@@ -0,0 +1,414 @@
+Index: ../trunk-jpl/externalpackages/python/install-2.7.3-linux64.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/python/install-2.7.3-linux64.sh	(revision 17074)
++++ ../trunk-jpl/externalpackages/python/install-2.7.3-linux64.sh	(revision 17075)
+@@ -18,6 +18,7 @@
+ cd src 
+ ./configure \
+  --prefix="$ISSM_DIR/externalpackages/python/install" \
++ --with-zlib \
+  --enable-shared
+ 
+ if [ $# -eq 0 ]; then
+Index: ../trunk-jpl/externalpackages/scipy/install-linux64.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/scipy/install-linux64.sh	(revision 17074)
++++ ../trunk-jpl/externalpackages/scipy/install-linux64.sh	(revision 17075)
+@@ -7,12 +7,15 @@
+ export FC="gfortran -fPIC"
+ export FFLAGS=-ff2c
+ 
++if [ -d "scipy" ]; then
+ #clean up
+-rm -rf scipy
+-
++#rm -rf scipy
++echo "hello"
++else
+ #download scipy
+-export GIT_SSL_NO_VERIFY=true 
+-git clone https://github.com/scipy/scipy.git
++    export GIT_SSL_NO_VERIFY=true 
++    git clone https://github.com/scipy/scipy.git
++fi
+ 
+ #install scipy
+ cd scipy
+Index: ../trunk-jpl/externalpackages/nose/install-linux64-python2.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/nose/install-linux64-python2.sh	(revision 17074)
++++ ../trunk-jpl/externalpackages/nose/install-linux64-python2.sh	(revision 17075)
+@@ -10,6 +10,8 @@
+ rm -rf nose-1.1.2
+ 
+ cd src
++export python=$ISSM_DIR/externalpackages/python/install/bin/python
++
+ python ./setup.py build
+ python ./setup.py install
+ 
+Index: ../trunk-jpl/externalpackages/git/install.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/git/install.sh	(revision 17074)
++++ ../trunk-jpl/externalpackages/git/install.sh	(revision 17075)
+@@ -17,8 +17,8 @@
+ 
+ #install
+ cd src 
+-./configure  --prefix="$ISSM_DIR/externalpackages/git/install"
+-#--with-python="$ISSM_DIR/externalpackages/python/install/bin/python" #Do we really need this line?
++./configure  --prefix="$ISSM_DIR/externalpackages/git/install" \
++    --with-python="$ISSM_DIR/externalpackages/python/install/bin/python" #Do we really need this line?
+ 	
+ #Compile
+ make install
+Index: ../trunk-jpl/externalpackages/cython/install-19.2.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/cython/install-19.2.sh	(revision 17074)
++++ ../trunk-jpl/externalpackages/cython/install-19.2.sh	(revision 17075)
+@@ -3,6 +3,7 @@
+ 
+ #clean up
+ rm -rf Cython-0.19.2
++rm -rf cython.tar.gz
+ 
+ #download numpy first
+ $ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/Cython-0.19.2.tar.gz' 'cython.tar.gz'
+Index: ../trunk-jpl/externalpackages/petsc/install-3.4-linux64.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/petsc/install-3.4-linux64.sh	(revision 17074)
++++ ../trunk-jpl/externalpackages/petsc/install-3.4-linux64.sh	(revision 17075)
+@@ -20,7 +20,7 @@
+ 	--with-mpi-dir="$ISSM_DIR/externalpackages/mpich/install" \
+ 	--PETSC_ARCH=linux-gnu-amd64 \
+ 	--PETSC_DIR="$ISSM_DIR/externalpackages/petsc/src" \
+-	--with-debugging=0 \
++	--with-debugging=1 \
+ 	--with-shared-libraries=1 \
+ 	--download-parmetis=yes \
+ 	--download-metis=yes \
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17074)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17075)
+@@ -10,7 +10,7 @@
+ 
+ class StressbalanceAnalysis: public Analysis{
+ 
+-	public:
++  public:
+ 		/*Model processing*/
+ 		int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+Index: ../trunk-jpl/src/c/analyses/EnumToAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnumToAnalysis.cpp	(revision 17074)
++++ ../trunk-jpl/src/c/analyses/EnumToAnalysis.cpp	(revision 17075)
+@@ -35,6 +35,7 @@
+ 		case ExtrudeFromBaseAnalysisEnum : return new ExtrudeFromBaseAnalysis();
+ 		case ExtrudeFromTopAnalysisEnum : return new ExtrudeFromTopAnalysis();
+ 		case ThermalAnalysisEnum : return new ThermalAnalysis();
++	  case LevelsetAnalysisEnum : return new LevelsetAnalysis();
+ 		#ifdef _HAVE_GIA_
+ 		case GiaAnalysisEnum : return new GiaAnalysis();
+ 		#endif
+Index: ../trunk-jpl/src/c/analyses/analyses.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/analyses.h	(revision 17074)
++++ ../trunk-jpl/src/c/analyses/analyses.h	(revision 17075)
+@@ -22,6 +22,7 @@
+ #include "./HydrologyDCEfficientAnalysis.h"
+ #include "./HydrologyDCInefficientAnalysis.h"
+ #include "./HydrologyShreveAnalysis.h"
++#include "./LevelsetAnalysis.h"
+ #include "./MasstransportAnalysis.h"
+ #include "./MeltingAnalysis.h"
+ #include "./MeshdeformationAnalysis.h"
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17074)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17075)
+@@ -272,6 +272,7 @@
+ 	TransientIsthermalEnum,
+ 	TransientIsgiaEnum,
+ 	TransientIsdamageEnum,
++	TransientIslevelsetEnum,
+ 	TransientNumRequestedOutputsEnum,
+ 	TransientRequestedOutputsEnum,
+ 	/*}}}*/
+@@ -316,6 +317,7 @@
+ 	BedSlopeSolutionEnum,
+ 	DamageEvolutionSolutionEnum,
+ 	DamageEvolutionAnalysisEnum,
++	LevelsetAnalysisEnum,
+ 	StressbalanceAnalysisEnum,
+ 	StressbalanceSIAAnalysisEnum,
+ 	StressbalanceSolutionEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17074)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17075)
+@@ -278,6 +278,7 @@
+ 		case TransientIsthermalEnum : return "TransientIsthermal";
+ 		case TransientIsgiaEnum : return "TransientIsgia";
+ 		case TransientIsdamageEnum : return "TransientIsdamage";
++		case TransientIslevelsetEnum : return "TransientIslevelset";
+ 		case TransientNumRequestedOutputsEnum : return "TransientNumRequestedOutputs";
+ 		case TransientRequestedOutputsEnum : return "TransientRequestedOutputs";
+ 		case SurfaceforcingsEnum : return "Surfaceforcings";
+@@ -317,6 +318,7 @@
+ 		case BedSlopeSolutionEnum : return "BedSlopeSolution";
+ 		case DamageEvolutionSolutionEnum : return "DamageEvolutionSolution";
+ 		case DamageEvolutionAnalysisEnum : return "DamageEvolutionAnalysis";
++		case LevelsetAnalysisEnum : return "LevelsetAnalysis";
+ 		case StressbalanceAnalysisEnum : return "StressbalanceAnalysis";
+ 		case StressbalanceSIAAnalysisEnum : return "StressbalanceSIAAnalysis";
+ 		case StressbalanceSolutionEnum : return "StressbalanceSolution";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17074)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17075)
+@@ -284,6 +284,7 @@
+ 	      else if (strcmp(name,"TransientIsthermal")==0) return TransientIsthermalEnum;
+ 	      else if (strcmp(name,"TransientIsgia")==0) return TransientIsgiaEnum;
+ 	      else if (strcmp(name,"TransientIsdamage")==0) return TransientIsdamageEnum;
++	      else if (strcmp(name,"TransientIslevelset")==0) return TransientIslevelsetEnum;
+ 	      else if (strcmp(name,"TransientNumRequestedOutputs")==0) return TransientNumRequestedOutputsEnum;
+ 	      else if (strcmp(name,"TransientRequestedOutputs")==0) return TransientRequestedOutputsEnum;
+ 	      else if (strcmp(name,"Surfaceforcings")==0) return SurfaceforcingsEnum;
+@@ -323,6 +324,7 @@
+ 	      else if (strcmp(name,"BedSlopeSolution")==0) return BedSlopeSolutionEnum;
+ 	      else if (strcmp(name,"DamageEvolutionSolution")==0) return DamageEvolutionSolutionEnum;
+ 	      else if (strcmp(name,"DamageEvolutionAnalysis")==0) return DamageEvolutionAnalysisEnum;
++	      else if (strcmp(name,"LevelsetAnalysis")==0) return LevelsetAnalysisEnum;
+ 	      else if (strcmp(name,"StressbalanceAnalysis")==0) return StressbalanceAnalysisEnum;
+ 	      else if (strcmp(name,"StressbalanceSIAAnalysis")==0) return StressbalanceSIAAnalysisEnum;
+ 	      else if (strcmp(name,"StressbalanceSolution")==0) return StressbalanceSolutionEnum;
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp	(revision 17074)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp	(revision 17075)
+@@ -15,7 +15,7 @@
+ void ModelProcessorx(Elements** pelements, Nodes** pnodes, Vertices** pvertices, Materials** pmaterials, Constraints** pconstraints, Loads** ploads, Parameters** pparameters, FILE* IOMODEL,FILE* toolkitfile, char* rootpath,const int solution_enum,const int nummodels,const int* analysis_enum_list){
+ 
+ 	int   i,analysis_enum,verbose;
+-	bool  isthermal,ismasstransport,isstressbalance,isgroundingline,isenthalpy;
++	bool  isthermal,ismasstransport,isstressbalance,isgroundingline,isenthalpy,islevelset;
+ 
+ 	/*Initialize datasets*/
+ 	Elements    *elements    = new Elements();
+@@ -33,6 +33,7 @@
+ 	iomodel->Constant(&verbose,VerboseEnum);
+ 	iomodel->Constant(&isthermal,TransientIsthermalEnum);
+ 	iomodel->Constant(&isenthalpy,ThermalIsenthalpyEnum);
++	iomodel->Constant(&islevelset,TransientIslevelsetEnum);
+ 	iomodel->Constant(&ismasstransport,TransientIsmasstransportEnum);
+ 	iomodel->Constant(&isstressbalance,TransientIsstressbalanceEnum);
+ 	iomodel->Constant(&isgroundingline,TransientIsgroundinglineEnum);
+@@ -72,7 +73,9 @@
+ 		if(solution_enum==SteadystateSolutionEnum && analysis_enum==ThermalAnalysisEnum && isenthalpy==true) continue;
+ 		if(solution_enum==SteadystateSolutionEnum && analysis_enum==MeltingAnalysisEnum && isenthalpy==true) continue;
+ 		if(solution_enum==SteadystateSolutionEnum && analysis_enum==EnthalpyAnalysisEnum && isenthalpy==false) continue;
++		if(solution_enum==TransientSolutionEnum && analysis_enum==LevelsetAnalysisEnum && islevelset==false) continue;
+ 
++
+ 		if(VerboseMProcessor()) _printf0_("   creating datasets for analysis " << EnumToStringx(analysis_enum) << "\n");
+ 		Analysis* analysis = EnumToAnalysis(analysis_enum);
+ 		analysis->UpdateParameters(parameters,iomodel,solution_enum,analysis_enum);
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17074)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17075)
+@@ -368,7 +368,9 @@
+ #}}}
+ #Transient sources  {{{
+ transient_sources  = ./modules/ModelProcessorx/Transient/UpdateElementsTransient.cpp \
+-							./cores/transient_core.cpp
++							./cores/transient_core.cpp\
++              ./analyses/LevelsetAnalysis.h\
++              ./analyses/LevelsetAnalysis.cpp
+ #}}}
+ #Steadystate sources  {{{
+ steadystate_sources = ./cores/steadystate_core.cpp
+Index: ../trunk-jpl/src/c/cores/transient_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17074)
++++ ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17075)
+@@ -21,12 +21,13 @@
+ 	/*parameters: */
+ 	int    i;
+ 	IssmDouble starttime,finaltime,dt,yts;
+-	bool   isstressbalance,ismasstransport,isFS,isthermal,isgroundingline,isdelta18o,isgia;
++	bool   isstressbalance,ismasstransport,isFS,isthermal,isgroundingline,isdelta18o,isgia,islevelset;
+ 	bool   save_results,dakota_analysis;
+ 	bool   time_adapt=false;
+ 	int    output_frequency;
+ 	int    meshtype,groundingline_migration;
+ 	int    numoutputs         = 0;
++  Analysis *analysis = NULL;
+ 	char** requested_outputs = NULL;
+ 
+ 
+@@ -158,6 +159,13 @@
+ 
+ 		}
+ 
++		if(islevelset){
++			if(VerboseSolution()) _printf0_("   computing movement of ice boundaries\n");
++			//analysis = new LevelsetAnalysis();
++			//analysis->Core(femmodel);
++			//delete analysis;
++		}
++
+ 		/*unload results*/
+ 		if(VerboseSolution()) _printf0_("   computing requested outputs\n");
+ 		femmodel->RequestedOutputsx(&femmodel->results,requested_outputs,numoutputs,save_results);
+Index: ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp	(revision 17074)
++++ ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp	(revision 17075)
+@@ -115,7 +115,7 @@
+ 			break;
+ 
+ 		case TransientSolutionEnum:
+-			numanalyses=12;
++			numanalyses=13;
+ 			analyses=xNew<int>(numanalyses);
+ 			analyses[ 0]=StressbalanceAnalysisEnum;
+ 			analyses[ 1]=StressbalanceVerticalAnalysisEnum;
+@@ -129,6 +129,7 @@
+ 			analyses[ 9]=FreeSurfaceTopAnalysisEnum;
+ 			analyses[10]=ExtrudeFromBaseAnalysisEnum;
+ 			analyses[11]=ExtrudeFromTopAnalysisEnum;
++			analyses[12]=LevelsetAnalysisEnum;
+ 			break;
+ 
+ 		default:
+Index: ../trunk-jpl/src/m/dev/devpath.py
+===================================================================
+--- ../trunk-jpl/src/m/dev/devpath.py	(revision 17074)
++++ ../trunk-jpl/src/m/dev/devpath.py	(revision 17075)
+@@ -24,10 +24,10 @@
+ #Manual imports for commonly used functions
+ from plotmodel import plotmodel
+ 
+-c = get_ipython().config
+-c.InteractiveShellApp.exec_lines = []
+-c.InteractiveShellApp.exec_lines.append('%load_ext autoreload')
+-c.InteractiveShellApp.exec_lines.append('%autoreload 2')
+-c.InteractiveShellApp.exec_lines.append('print "Warning: disable autoreload in startup.py to improve performance." ')
++#c = get_ipython().config
++#c.InteractiveShellApp.exec_lines = []
++#c.InteractiveShellApp.exec_lines.append('%load_ext autoreload')
++#c.InteractiveShellApp.exec_lines.append('%autoreload 2')
++#c.InteractiveShellApp.exec_lines.append('print "Warning: disable autoreload in startup.py to improve performance." ')
+ 
+ print("\n  ISSM development path correctly loaded\n\n")
+Index: ../trunk-jpl/src/m/classes/transient.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/transient.py	(revision 17074)
++++ ../trunk-jpl/src/m/classes/transient.py	(revision 17075)
+@@ -17,6 +17,7 @@
+ 		self.isthermal         = False
+ 		self.isgroundingline   = False
+ 		self.isgia             = False
++		self.islevelset        = False
+ 		self.requested_outputs = []
+ 
+ 		#set defaults
+@@ -30,6 +31,7 @@
+ 		string="%s\n%s"%(string,fielddisplay(self,'isthermal','indicates if a thermal solution is used in the transient'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'isgroundingline','indicates if a groundingline migration is used in the transient'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'isgia','indicates if a postglacial rebound is used in the transient'))
++		string="%s\n%s"%(string,fielddisplay(self,'islevelset','LEVELSET METHOD DESCRIPTION'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'requested_outputs','list of additional outputs requested'))
+ 		return string
+ 		#}}}
+@@ -46,6 +48,7 @@
+ 		self.isthermal       = True
+ 		self.isgroundingline = False
+ 		self.isgia           = False
++		self.islevelset           = False
+ 
+ 		#default output
+ 		self.requested_outputs=['default']
+@@ -62,6 +65,7 @@
+ 		md = checkfield(md,'fieldname','transient.isthermal','numel',[1],'values',[0,1])
+ 		md = checkfield(md,'fieldname','transient.isgroundingline','numel',[1],'values',[0,1])
+ 		md = checkfield(md,'fieldname','transient.isgia','numel',[1],'values',[0,1])
++		md = checkfield(md,'fieldname','transient.islevelset','numel',[1],'values',[0,1])
+ 		md = checkfield(md,'fieldname','transient.requested_outputs','stringrow',1)
+ 
+ 		return md
+@@ -72,6 +76,7 @@
+ 		WriteData(fid,'object',self,'fieldname','isthermal','format','Boolean')
+ 		WriteData(fid,'object',self,'fieldname','isgroundingline','format','Boolean')
+ 		WriteData(fid,'object',self,'fieldname','isgia','format','Boolean')
++		WriteData(fid,'object',self,'fieldname','islevelset','format','Boolean')
+ 
+ 		#process requested outputs
+ 		outputs = self.requested_outputs
+Index: ../trunk-jpl/src/m/classes/transient.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/transient.m	(revision 17074)
++++ ../trunk-jpl/src/m/classes/transient.m	(revision 17075)
+@@ -11,6 +11,7 @@
+ 		isgroundingline   = 0;
+ 		isgia             = 0;
+ 		isdamage             = 0;
++                islevelset = 0;
+ 		requested_outputs = {};
+ 	end
+ 	methods
+@@ -31,6 +32,7 @@
+ 			obj.isgroundingline = 0;
+ 			obj.isgia           = 0;
+ 			obj.isdamage        = 0;
++			obj.islevelset      = 0;
+ 
+ 			%default output
+ 			obj.requested_outputs={'default'};
+@@ -51,6 +53,7 @@
+ 			md = checkfield(md,'fieldname','transient.isgroundingline','numel',[1],'values',[0 1]);
+ 			md = checkfield(md,'fieldname','transient.isgia','numel',[1],'values',[0 1]);
+ 			md = checkfield(md,'fieldname','transient.isdamage','numel',[1],'values',[0 1]);
++			md = checkfield(md,'fieldname','transient.islevelset','numel',[1],'values',[0 1]);
+ 			md = checkfield(md,'fieldname','transient.requested_outputs','stringrow',1);
+ 
+ 		end % }}}
+@@ -63,6 +66,7 @@
+ 			fielddisplay(obj,'isgroundingline','indicates whether a groundingline migration is used in the transient');
+ 			fielddisplay(obj,'isgia','indicates whether a postglacial rebound model is used in the transient');
+ 			fielddisplay(obj,'isdamage','indicates whether damage evolution is used in the transient');
++			fielddisplay(obj,'islevelset','LEVEL SET DESCRIPTION...');
+ 			fielddisplay(obj,'requested_outputs','list of additional outputs requested');
+ 
+ 		end % }}}
+@@ -73,6 +77,7 @@
+ 			WriteData(fid,'object',obj,'fieldname','isgroundingline','format','Boolean');
+ 			WriteData(fid,'object',obj,'fieldname','isgia','format','Boolean');
+ 			WriteData(fid,'object',obj,'fieldname','isdamage','format','Boolean');
++			WriteData(fid,'object',obj,'fieldname','islevelset','format','Boolean');
+ 
+ 			%process requested outputs
+ 			outputs = obj.requested_outputs;
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17074)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17075)
+@@ -270,6 +270,7 @@
+ def TransientIsthermalEnum(): return StringToEnum("TransientIsthermal")[0]
+ def TransientIsgiaEnum(): return StringToEnum("TransientIsgia")[0]
+ def TransientIsdamageEnum(): return StringToEnum("TransientIsdamage")[0]
++def TransientIslevelsetEnum(): return StringToEnum("TransientIslevelset")[0]
+ def TransientNumRequestedOutputsEnum(): return StringToEnum("TransientNumRequestedOutputs")[0]
+ def TransientRequestedOutputsEnum(): return StringToEnum("TransientRequestedOutputs")[0]
+ def SurfaceforcingsEnum(): return StringToEnum("Surfaceforcings")[0]
+@@ -309,6 +310,7 @@
+ def BedSlopeSolutionEnum(): return StringToEnum("BedSlopeSolution")[0]
+ def DamageEvolutionSolutionEnum(): return StringToEnum("DamageEvolutionSolution")[0]
+ def DamageEvolutionAnalysisEnum(): return StringToEnum("DamageEvolutionAnalysis")[0]
++def LevelsetAnalysisEnum(): return StringToEnum("LevelsetAnalysis")[0]
+ def StressbalanceAnalysisEnum(): return StringToEnum("StressbalanceAnalysis")[0]
+ def StressbalanceSIAAnalysisEnum(): return StringToEnum("StressbalanceSIAAnalysis")[0]
+ def StressbalanceSolutionEnum(): return StringToEnum("StressbalanceSolution")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17075-17076.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17075-17076.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17075-17076.diff	(revision 17802)
@@ -0,0 +1,94 @@
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 0)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17076)
+@@ -0,0 +1,53 @@
++#include "./LevelsetAnalysis.h"
++#include "../toolkits/toolkits.h"
++#include "../classes/classes.h"
++#include "../shared/shared.h"
++#include "../modules/modules.h"
++#include "../solutionsequences/solutionsequences.h"
++
++int LevelsetAnalysis::DofsPerNode(int** doflist,int meshtype,int approximation){/*{{{*/
++	_error_("not implemented yet");
++}
++/*}}}*/
++void LevelsetAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
++	_error_("not implemented yet");
++}
++/*}}}*/
++void LevelsetAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
++	_error_("not implemented yet");
++}
++/*}}}*/
++void LevelsetAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
++	_error_("not implemented yet");
++}
++/*}}}*/
++void LevelsetAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
++	_error_("not implemented yet");
++}
++/*}}}*/
++void LevelsetAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++
++/*Finite element Analysis*/
++void LevelsetAnalysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* LevelsetAnalysis::CreateDVector(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementMatrix* LevelsetAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementMatrix* LevelsetAnalysis::CreateKMatrix(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* LevelsetAnalysis::CreatePVector(Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++void LevelsetAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++void LevelsetAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h	(revision 0)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h	(revision 17076)
+@@ -0,0 +1,31 @@
++/*! \file LevelsetAnalysis.h 
++ *  \brief: header file for generic external result object
++ */
++
++#ifndef _LevelsetAnalysis_
++#define _LevelsetAnalysis_
++
++/*Headers*/
++#include "./Analysis.h"
++
++class LevelsetAnalysis: public Analysis{
++	
++ public:
++	/*Model processing*/
++	int  DofsPerNode(int** doflist,int meshtype,int approximation);
++	void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
++	void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
++	void CreateNodes(Nodes* nodes,IoModel* iomodel);
++	void CreateConstraints(Constraints* constraints,IoModel* iomodel);
++	void CreateLoads(Loads* loads, IoModel* iomodel);
++
++	/*Finite element Analysis*/
++	void           Core(FemModel* femmodel);
++	ElementVector* CreateDVector(Element* element);
++	ElementMatrix* CreateJacobianMatrix(Element* element);
++	ElementMatrix* CreateKMatrix(Element* element);
++	ElementVector* CreatePVector(Element* element);
++	void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++	void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++};
++#endif
Index: issm/oecreview/Archive/16554-17801/ISSM-17076-17077.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17076-17077.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17076-17077.diff	(revision 17802)
@@ -0,0 +1,88 @@
+Index: ../trunk-jpl/externalpackages/python/install-2.7.3-linux64.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/python/install-2.7.3-linux64.sh	(revision 17076)
++++ ../trunk-jpl/externalpackages/python/install-2.7.3-linux64.sh	(revision 17077)
+@@ -18,7 +18,6 @@
+ cd src 
+ ./configure \
+  --prefix="$ISSM_DIR/externalpackages/python/install" \
+- --with-zlib \
+  --enable-shared
+ 
+ if [ $# -eq 0 ]; then
+Index: ../trunk-jpl/externalpackages/scipy/install-linux64.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/scipy/install-linux64.sh	(revision 17076)
++++ ../trunk-jpl/externalpackages/scipy/install-linux64.sh	(revision 17077)
+@@ -7,15 +7,11 @@
+ export FC="gfortran -fPIC"
+ export FFLAGS=-ff2c
+ 
+-if [ -d "scipy" ]; then
+ #clean up
+-#rm -rf scipy
+-echo "hello"
+-else
++rm -rf scipy
+ #download scipy
+-    export GIT_SSL_NO_VERIFY=true 
+-    git clone https://github.com/scipy/scipy.git
+-fi
++export GIT_SSL_NO_VERIFY=true 
++git clone https://github.com/scipy/scipy.git
+ 
+ #install scipy
+ cd scipy
+Index: ../trunk-jpl/externalpackages/nose/install-linux64-python2.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/nose/install-linux64-python2.sh	(revision 17076)
++++ ../trunk-jpl/externalpackages/nose/install-linux64-python2.sh	(revision 17077)
+@@ -10,8 +10,6 @@
+ rm -rf nose-1.1.2
+ 
+ cd src
+-export python=$ISSM_DIR/externalpackages/python/install/bin/python
+-
+ python ./setup.py build
+ python ./setup.py install
+ 
+Index: ../trunk-jpl/externalpackages/git/install.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/git/install.sh	(revision 17076)
++++ ../trunk-jpl/externalpackages/git/install.sh	(revision 17077)
+@@ -17,8 +17,8 @@
+ 
+ #install
+ cd src 
+-./configure  --prefix="$ISSM_DIR/externalpackages/git/install" \
+-    --with-python="$ISSM_DIR/externalpackages/python/install/bin/python" #Do we really need this line?
++./configure  --prefix="$ISSM_DIR/externalpackages/git/install" 
++#--with-python="$ISSM_DIR/externalpackages/python/install/bin/python" #Do we really need this line?
+ 	
+ #Compile
+ make install
+Index: ../trunk-jpl/externalpackages/cython/install-19.2.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/cython/install-19.2.sh	(revision 17076)
++++ ../trunk-jpl/externalpackages/cython/install-19.2.sh	(revision 17077)
+@@ -3,7 +3,6 @@
+ 
+ #clean up
+ rm -rf Cython-0.19.2
+-rm -rf cython.tar.gz
+ 
+ #download numpy first
+ $ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/Cython-0.19.2.tar.gz' 'cython.tar.gz'
+Index: ../trunk-jpl/externalpackages/petsc/install-3.4-linux64.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/petsc/install-3.4-linux64.sh	(revision 17076)
++++ ../trunk-jpl/externalpackages/petsc/install-3.4-linux64.sh	(revision 17077)
+@@ -20,7 +20,7 @@
+ 	--with-mpi-dir="$ISSM_DIR/externalpackages/mpich/install" \
+ 	--PETSC_ARCH=linux-gnu-amd64 \
+ 	--PETSC_DIR="$ISSM_DIR/externalpackages/petsc/src" \
+-	--with-debugging=1 \
++	--with-debugging=0 \
+ 	--with-shared-libraries=1 \
+ 	--download-parmetis=yes \
+ 	--download-metis=yes \
Index: issm/oecreview/Archive/16554-17801/ISSM-17077-17078.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17077-17078.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17077-17078.diff	(revision 17802)
@@ -0,0 +1,740 @@
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17077)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17078)
+@@ -89,6 +89,25 @@
+ 		case SMBEnum:
+ 			iomodel->FetchDataToInput(elements,SurfaceforcingsMassBalanceEnum,0.);
+ 			break;
++		case SMBpddEnum:
++			iomodel->Constant(&isdelta18o,SurfaceforcingsIsdelta18oEnum);
++			iomodel->FetchDataToInput(elements,ThermalSpctemperatureEnum);
++			if(isdelta18o){
++				iomodel->FetchDataToInput(elements,SurfaceforcingsTemperaturesLgmEnum);
++				iomodel->FetchDataToInput(elements,SurfaceforcingsTemperaturesPresentdayEnum);
++				iomodel->FetchDataToInput(elements,SurfaceforcingsPrecipitationsPresentdayEnum);
++			}
++			else{
++				iomodel->FetchDataToInput(elements,SurfaceforcingsPrecipitationEnum);
++				iomodel->FetchDataToInput(elements,SurfaceforcingsMonthlytemperaturesEnum);
++			}
++			break;
++		case SMBgradientsEnum:
++			iomodel->FetchDataToInput(elements,SurfaceforcingsHrefEnum);
++			iomodel->FetchDataToInput(elements,SurfaceforcingsSmbrefEnum);
++			iomodel->FetchDataToInput(elements,SurfaceforcingsBPosEnum);
++			iomodel->FetchDataToInput(elements,SurfaceforcingsBNegEnum);
++			break;
+ 		case SurfaceforcingsEnum: /*To Be REMOVED*/
+ 			iomodel->Constant(&ispdd,SurfaceforcingsIspddEnum);
+ 			iomodel->Constant(&isdelta18o,SurfaceforcingsIsdelta18oEnum);
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17077)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17078)
+@@ -280,7 +280,7 @@
+ 	SurfaceforcingsEnum,
+ 	SMBEnum,
+ 	SurfaceforcingsMassBalanceEnum,
+-
++	SMBpddEnum,
+ 	SurfaceforcingsDelta18oEnum,
+ 	SurfaceforcingsDelta18oSurfaceEnum,
+ 	SurfaceforcingsIsdelta18oEnum,
+@@ -288,15 +288,18 @@
+ 	SurfaceforcingsTemperaturesPresentdayEnum,
+ 	SurfaceforcingsTemperaturesLgmEnum,
+ 	SurfaceforcingsPrecipitationEnum,
+-	SurfaceforcingsIspddEnum,
+ 	SurfaceforcingsDesfacEnum,
+ 	SurfaceforcingsS0pEnum,
+-	SurfaceforcingsIssmbgradientsEnum,
++	SMBgradientsEnum,
+ 	SurfaceforcingsMonthlytemperaturesEnum,
+ 	SurfaceforcingsHrefEnum,
+ 	SurfaceforcingsSmbrefEnum,
+ 	SurfaceforcingsBPosEnum,
+ 	SurfaceforcingsBNegEnum,
++	SMBlapserate,
++	/*TO BE REMOVED*/
++	SurfaceforcingsIspddEnum,
++	SurfaceforcingsIssmbgradientsEnum,
+ 	/*}}}*/
+ 	/*Solutions and Analyses{{{ */
+ 	SolutionTypeEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17077)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17078)
+@@ -284,6 +284,7 @@
+ 		case SurfaceforcingsEnum : return "Surfaceforcings";
+ 		case SMBEnum : return "SMB";
+ 		case SurfaceforcingsMassBalanceEnum : return "SurfaceforcingsMassBalance";
++		case SMBpddEnum : return "SMBpdd";
+ 		case SurfaceforcingsDelta18oEnum : return "SurfaceforcingsDelta18o";
+ 		case SurfaceforcingsDelta18oSurfaceEnum : return "SurfaceforcingsDelta18oSurface";
+ 		case SurfaceforcingsIsdelta18oEnum : return "SurfaceforcingsIsdelta18o";
+@@ -291,15 +292,16 @@
+ 		case SurfaceforcingsTemperaturesPresentdayEnum : return "SurfaceforcingsTemperaturesPresentday";
+ 		case SurfaceforcingsTemperaturesLgmEnum : return "SurfaceforcingsTemperaturesLgm";
+ 		case SurfaceforcingsPrecipitationEnum : return "SurfaceforcingsPrecipitation";
+-		case SurfaceforcingsIspddEnum : return "SurfaceforcingsIspdd";
+ 		case SurfaceforcingsDesfacEnum : return "SurfaceforcingsDesfac";
+ 		case SurfaceforcingsS0pEnum : return "SurfaceforcingsS0p";
+-		case SurfaceforcingsIssmbgradientsEnum : return "SurfaceforcingsIssmbgradients";
++		case SMBgradientsEnum : return "SMBgradients";
+ 		case SurfaceforcingsMonthlytemperaturesEnum : return "SurfaceforcingsMonthlytemperatures";
+ 		case SurfaceforcingsHrefEnum : return "SurfaceforcingsHref";
+ 		case SurfaceforcingsSmbrefEnum : return "SurfaceforcingsSmbref";
+ 		case SurfaceforcingsBPosEnum : return "SurfaceforcingsBPos";
+ 		case SurfaceforcingsBNegEnum : return "SurfaceforcingsBNeg";
++		case SurfaceforcingsIspddEnum : return "SurfaceforcingsIspdd";
++		case SurfaceforcingsIssmbgradientsEnum : return "SurfaceforcingsIssmbgradients";
+ 		case SolutionTypeEnum : return "SolutionType";
+ 		case AnalysisTypeEnum : return "AnalysisType";
+ 		case ConfigurationTypeEnum : return "ConfigurationType";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17077)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17078)
+@@ -290,6 +290,7 @@
+ 	      else if (strcmp(name,"Surfaceforcings")==0) return SurfaceforcingsEnum;
+ 	      else if (strcmp(name,"SMB")==0) return SMBEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsMassBalance")==0) return SurfaceforcingsMassBalanceEnum;
++	      else if (strcmp(name,"SMBpdd")==0) return SMBpddEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsDelta18o")==0) return SurfaceforcingsDelta18oEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsDelta18oSurface")==0) return SurfaceforcingsDelta18oSurfaceEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsIsdelta18o")==0) return SurfaceforcingsIsdelta18oEnum;
+@@ -297,15 +298,16 @@
+ 	      else if (strcmp(name,"SurfaceforcingsTemperaturesPresentday")==0) return SurfaceforcingsTemperaturesPresentdayEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsTemperaturesLgm")==0) return SurfaceforcingsTemperaturesLgmEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsPrecipitation")==0) return SurfaceforcingsPrecipitationEnum;
+-	      else if (strcmp(name,"SurfaceforcingsIspdd")==0) return SurfaceforcingsIspddEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsDesfac")==0) return SurfaceforcingsDesfacEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsS0p")==0) return SurfaceforcingsS0pEnum;
+-	      else if (strcmp(name,"SurfaceforcingsIssmbgradients")==0) return SurfaceforcingsIssmbgradientsEnum;
++	      else if (strcmp(name,"SMBgradients")==0) return SMBgradientsEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsMonthlytemperatures")==0) return SurfaceforcingsMonthlytemperaturesEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsHref")==0) return SurfaceforcingsHrefEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsSmbref")==0) return SurfaceforcingsSmbrefEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsBPos")==0) return SurfaceforcingsBPosEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsBNeg")==0) return SurfaceforcingsBNegEnum;
++	      else if (strcmp(name,"SurfaceforcingsIspdd")==0) return SurfaceforcingsIspddEnum;
++	      else if (strcmp(name,"SurfaceforcingsIssmbgradients")==0) return SurfaceforcingsIssmbgradientsEnum;
+ 	      else if (strcmp(name,"SolutionType")==0) return SolutionTypeEnum;
+ 	      else if (strcmp(name,"AnalysisType")==0) return AnalysisTypeEnum;
+ 	      else if (strcmp(name,"ConfigurationType")==0) return ConfigurationTypeEnum;
+@@ -380,14 +382,14 @@
+ 	      else if (strcmp(name,"AdolcParam")==0) return AdolcParamEnum;
+ 	      else if (strcmp(name,"BoolInput")==0) return BoolInputEnum;
+ 	      else if (strcmp(name,"BoolParam")==0) return BoolParamEnum;
+-	      else if (strcmp(name,"Contour")==0) return ContourEnum;
++         else stage=4;
++   }
++   if(stage==4){
++	      if (strcmp(name,"Contour")==0) return ContourEnum;
+ 	      else if (strcmp(name,"ControlInput")==0) return ControlInputEnum;
+ 	      else if (strcmp(name,"DatasetInput")==0) return DatasetInputEnum;
+ 	      else if (strcmp(name,"DoubleInput")==0) return DoubleInputEnum;
+-         else stage=4;
+-   }
+-   if(stage==4){
+-	      if (strcmp(name,"DataSetParam")==0) return DataSetParamEnum;
++	      else if (strcmp(name,"DataSetParam")==0) return DataSetParamEnum;
+ 	      else if (strcmp(name,"DoubleMatArrayParam")==0) return DoubleMatArrayParamEnum;
+ 	      else if (strcmp(name,"DoubleMatParam")==0) return DoubleMatParamEnum;
+ 	      else if (strcmp(name,"DoubleParam")==0) return DoubleParamEnum;
+@@ -503,14 +505,14 @@
+ 	      else if (strcmp(name,"EnthalpyPicard")==0) return EnthalpyPicardEnum;
+ 	      else if (strcmp(name,"ThicknessAbsGradient")==0) return ThicknessAbsGradientEnum;
+ 	      else if (strcmp(name,"ThicknessAlongGradient")==0) return ThicknessAlongGradientEnum;
+-	      else if (strcmp(name,"ThicknessAcrossGradient")==0) return ThicknessAcrossGradientEnum;
++         else stage=5;
++   }
++   if(stage==5){
++	      if (strcmp(name,"ThicknessAcrossGradient")==0) return ThicknessAcrossGradientEnum;
+ 	      else if (strcmp(name,"IntMatParam")==0) return IntMatParamEnum;
+ 	      else if (strcmp(name,"RheologyBbarAbsGradient")==0) return RheologyBbarAbsGradientEnum;
+ 	      else if (strcmp(name,"DragCoefficientAbsGradient")==0) return DragCoefficientAbsGradientEnum;
+-         else stage=5;
+-   }
+-   if(stage==5){
+-	      if (strcmp(name,"TransientInput")==0) return TransientInputEnum;
++	      else if (strcmp(name,"TransientInput")==0) return TransientInputEnum;
+ 	      else if (strcmp(name,"Waterfraction")==0) return WaterfractionEnum;
+ 	      else if (strcmp(name,"Watercolumn")==0) return WatercolumnEnum;
+ 	      else if (strcmp(name,"BasalFriction")==0) return BasalFrictionEnum;
+@@ -626,14 +628,14 @@
+ 	      else if (strcmp(name,"TriangleInterp")==0) return TriangleInterpEnum;
+ 	      else if (strcmp(name,"BilinearInterp")==0) return BilinearInterpEnum;
+ 	      else if (strcmp(name,"NearestInterp")==0) return NearestInterpEnum;
+-	      else if (strcmp(name,"XY")==0) return XYEnum;
++         else stage=6;
++   }
++   if(stage==6){
++	      if (strcmp(name,"XY")==0) return XYEnum;
+ 	      else if (strcmp(name,"XYZ")==0) return XYZEnum;
+ 	      else if (strcmp(name,"Dense")==0) return DenseEnum;
+ 	      else if (strcmp(name,"MpiDense")==0) return MpiDenseEnum;
+-         else stage=6;
+-   }
+-   if(stage==6){
+-	      if (strcmp(name,"MpiSparse")==0) return MpiSparseEnum;
++	      else if (strcmp(name,"MpiSparse")==0) return MpiSparseEnum;
+ 	      else if (strcmp(name,"Seq")==0) return SeqEnum;
+ 	      else if (strcmp(name,"Mpi")==0) return MpiEnum;
+ 	      else if (strcmp(name,"Mumps")==0) return MumpsEnum;
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17077)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17078)
+@@ -90,6 +90,30 @@
+ 		case SMBEnum:
+ 			/*Nothing to add to parameters*/
+ 			break;
++		case SMBpddEnum:
++			parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsIsdelta18oEnum));
++			parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsDesfacEnum));
++			parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsS0pEnum));
++			iomodel->Constant(&isdelta18o,SurfaceforcingsIsdelta18oEnum);
++			if(isdelta18o){
++				IssmDouble *temp = NULL;
++				IssmDouble  yts;
++				int         N,M;
++				iomodel->Constant(&yts,ConstantsYtsEnum);
++				iomodel->FetchData(&temp,&N,&M,SurfaceforcingsDelta18oEnum); _assert_(N==2);
++				for(i=0;i<M;i++) temp[M+i]=yts*temp[M+i];
++				parameters->AddObject(new TransientParam(SurfaceforcingsDelta18oEnum,&temp[0],&temp[M],M));
++				iomodel->DeleteData(temp,SurfaceforcingsDelta18oEnum);
++
++				iomodel->FetchData(&temp,&N,&M,SurfaceforcingsDelta18oSurfaceEnum); _assert_(N==2);
++				for(i=0;i<M;i++) temp[M+i]=yts*temp[M+i];
++				parameters->AddObject(new TransientParam(SurfaceforcingsDelta18oSurfaceEnum,&temp[0],&temp[M],M));
++				iomodel->DeleteData(temp,SurfaceforcingsDelta18oSurfaceEnum);
++			}
++			break;
++		case SMBgradientsEnum:
++			/*Nothing to add to parameters*/
++			break;
+ 		case SurfaceforcingsEnum: /*To Be REMOVED*/
+ 			parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsIspddEnum));
+ 			parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsIsdelta18oEnum));
+Index: ../trunk-jpl/src/c/cores/transient_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17077)
++++ ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17078)
+@@ -21,11 +21,11 @@
+ 	/*parameters: */
+ 	int    i;
+ 	IssmDouble starttime,finaltime,dt,yts;
+-	bool   isstressbalance,ismasstransport,isFS,isthermal,isgroundingline,isdelta18o,isgia,islevelset;
++	bool   isstressbalance,ismasstransport,isFS,isthermal,isgroundingline,isgia,islevelset;
+ 	bool   save_results,dakota_analysis;
+ 	bool   time_adapt=false;
+ 	int    output_frequency;
+-	int    meshtype,groundingline_migration;
++	int    meshtype,groundingline_migration,smb_model;
+ 	int    numoutputs         = 0;
+   Analysis *analysis = NULL;
+ 	char** requested_outputs = NULL;
+@@ -53,7 +53,6 @@
+ 	if(isgroundingline) femmodel->parameters->FindParam(&groundingline_migration,GroundinglineMigrationEnum);
+ 	femmodel->parameters->FindParam(&numoutputs,TransientNumRequestedOutputsEnum);
+ 	if(numoutputs) femmodel->parameters->FindParam(&requested_outputs,&numoutputs,TransientRequestedOutputsEnum);
+-	femmodel->parameters->FindParam(&isdelta18o,SurfaceforcingsIsdelta18oEnum);
+ 
+ 	/*initialize: */
+ 	step=0;
+@@ -169,10 +168,6 @@
+ 		/*unload results*/
+ 		if(VerboseSolution()) _printf0_("   computing requested outputs\n");
+ 		femmodel->RequestedOutputsx(&femmodel->results,requested_outputs,numoutputs,save_results);
+-		if(isdelta18o){
+-			int outputs[2] = {SurfaceforcingsMonthlytemperaturesEnum,SurfaceforcingsPrecipitationEnum};
+-			femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],2,save_results);
+-		}
+ 		if(isgroundingline && (groundingline_migration==SubelementMigrationEnum || groundingline_migration==SubelementMigration2Enum)){
+ 			int outputs[1] = {MaskGroundediceLevelsetEnum};
+ 			femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],1,save_results);
+Index: ../trunk-jpl/src/c/cores/masstransport_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/masstransport_core.cpp	(revision 17077)
++++ ../trunk-jpl/src/c/cores/masstransport_core.cpp	(revision 17078)
+@@ -44,6 +44,19 @@
+ 		case SMBEnum:
+ 			/*Nothing to be done*/
+ 			break;
++		case SMBpddEnum:
++			femmodel->parameters->FindParam(&isdelta18o,SurfaceforcingsIsdelta18oEnum);
++			if(isdelta18o){
++				if(VerboseSolution()) _printf0_("   call Delta18oParametrization module\n");
++				Delta18oParameterizationx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
++			} 
++			if(VerboseSolution()) _printf0_("   call positive degree day module\n");
++			PositiveDegreeDayx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
++			break;
++		case SMBgradientsEnum:
++			if(VerboseSolution())_printf_("	call smb gradients module\n\n");
++			SmbGradientsx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
++			break;
+ 		case SurfaceforcingsEnum: /*To Be REMOVED*/
+ 			femmodel->parameters->FindParam(&issmbgradients,SurfaceforcingsIssmbgradientsEnum);
+ 			femmodel->parameters->FindParam(&ispdd,SurfaceforcingsIspddEnum);
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 17077)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 17078)
+@@ -46,6 +46,13 @@
+ 		case SMBEnum:
+ 			/*Nothing to add*/
+ 			break;
++		case SMBpddEnum:
++			iomodel->Constant(&this->desfac,SurfaceforcingsDesfacEnum);
++			iomodel->Constant(&this->s0p,SurfaceforcingsS0pEnum);
++			break;
++		case SMBgradientsEnum:
++			/*Nothing to add*/
++			break;
+ 		case SurfaceforcingsEnum: /*To Be REMOVED*/
+ 			iomodel->Constant(&ispdd,SurfaceforcingsIspddEnum);
+ 			if(ispdd){
+Index: ../trunk-jpl/src/m/classes/SMBpdd.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/SMBpdd.py	(revision 0)
++++ ../trunk-jpl/src/m/classes/SMBpdd.py	(revision 17078)
+@@ -0,0 +1,97 @@
++from fielddisplay import fielddisplay
++from EnumDefinitions import *
++from checkfield import *
++from WriteData import *
++
++class SMBpdd(object):
++	"""
++	SMBpdd Class definition
++
++	   Usage:
++	      SMBpdd=SMBpdd();
++	"""
++
++	def __init__(self): # {{{
++		self.precipitation             = float('NaN')
++		self.monthlytemperatures       = float('NaN')
++		self.desfac                    = 0.
++		self.s0p                       = 0.
++		self.isdelta18o                = 0
++		self.delta18o                  = float('NaN')
++		self.delta18o_surface          = float('NaN')
++		self.temperatures_presentday   = float('NaN')
++		self.temperatures_lgm          = float('NaN')
++		self.precipitations_presentday = float('NaN')
++
++		#set defaults
++		self.setdefaultparameters()
++		#}}}
++	def __repr__(self): # {{{
++		string="   surface forcings parameters:"
++
++		string="%s\n%s"%(string,fielddisplay(self,'precipitation','surface precipitation [m/yr water eq]'))
++		string="%s\n%s"%(string,fielddisplay(self,'desfac','desertification elevation factor (between 0 and 1, default is 0.5) [m]'))
++		string="%s\n%s"%(string,fielddisplay(self,'isdelta18o','is temperature and precipitation delta18o parametrisation activated (0 or 1, default is 0)'))
++		string="%s\n%s"%(string,fielddisplay(self,'s0p','should be set to elevation from precip source (between 0 and a few 1000s m, default is 0) [m]'))
++		string="%s\n%s"%(string,fielddisplay(self,'monthlytemperatures','monthly surface temperatures [K], required if pdd is activated and delta18o not activated'))
++		string="%s\n%s"%(string,fielddisplay(self,'temperatures_presentday','monthly present day surface temperatures [K], required if pdd is activated and delta18o activated'))
++		string="%s\n%s"%(string,fielddisplay(self,'temperatures_lgm','monthly LGM surface temperatures [K], required if pdd is activated and delta18o activated'))
++		string="%s\n%s"%(string,fielddisplay(self,'precipitations_presentday','monthly surface precipitation [m/yr water eq], required if pdd is activated and delta18o activated'))
++		string="%s\n%s"%(string,fielddisplay(self,'delta18o','delta18o, required if pdd is activated and delta18o activated'))
++		string="%s\n%s"%(string,fielddisplay(self,'delta18o_surface','surface elevation of the delta18o site, required if pdd is activated and delta18o activated'))
++
++		return string
++		#}}}
++	def initialize(self,md): # {{{
++
++		if numpy.all(numpy.isnan(self.precipitation)):
++			self.precipitation=numpy.zeros((md.mesh.numberofvertices,1))
++			print "      no SMBpdd.precipitation specified: values set as zero"
++
++		return self
++	#}}}
++	def setdefaultparameters(self): # {{{
++		  
++		#pdd method not used in default mode
++		self.isdelta18o = 0
++		self.desfac     = 0.5
++		self.s0p        = 0.
++
++		return self
++	#}}}
++	def checkconsistency(self,md,solution,analyses):    # {{{
++
++		if MasstransportAnalysisEnum() in analyses:
++			md = checkfield(md,'fieldname','surfaceforcings.desfac','<=',1,'numel',[1]);
++			md = checkfield(md,'fieldname','surfaceforcings.s0p','>=',0,'numel',[1]);
++			if not self.isdelta18o:
++				md = checkfield(md,'fieldname','surfaceforcings.monthlytemperatures','forcing',1,'NaN',1)
++				md = checkfield(md,'fieldname','surfaceforcings.precipitation','forcing',1,'NaN',1)
++			else:
++				md = checkfield(md,'fieldname','surfaceforcings.delta18o','NaN',1)
++				md = checkfield(md,'fieldname','surfaceforcings.delta18o_surface','NaN',1)
++				md = checkfield(md,'fieldname','surfaceforcings.temperatures_presentday','size',[md.mesh.numberofvertices+1,12],'NaN',1)
++				md = checkfield(md,'fieldname','surfaceforcings.temperatures_lgm','size',[md.mesh.numberofvertices+1,12],'NaN',1)
++				md = checkfield(md,'fieldname','surfaceforcings.precipitations_presentday','size',[md.mesh.numberofvertices+1,12],'NaN',1)
++
++		return md
++	# }}}
++	def marshall(self,md,fid):    # {{{
++
++		yts=365.0*24.0*3600.0
++
++		WriteData(fid,'enum',SurfaceforcingsEnum(),'data',SMBpddEnum(),'format','Integer');
++
++		WriteData(fid,'object',self,'class','surfaceforcings','fieldname','precipitation','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1)
++		WriteData(fid,'object',self,'class','surfaceforcings','fieldname','isdelta18o','format','Boolean')
++		WriteData(fid,'object',self,'class','surfaceforcings','fieldname','desfac','format','Double');
++		WriteData(fid,'object',self,'class','surfaceforcings','fieldname','s0p','format','Double');
++		if self.isdelta18o:
++			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','temperatures_presentday','format','DoubleMat','mattype',1)
++			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','temperatures_lgm','format','DoubleMat','mattype',1)
++			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','precipitations_presentday','format','DoubleMat','mattype',1)
++			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','delta18o_surface','format','DoubleMat','mattype',1)
++			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','delta18o','format','DoubleMat','mattype',1)
++		else:
++			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','monthlytemperatures','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1)
++	# }}}
+Index: ../trunk-jpl/src/m/classes/SMBpdd.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/SMBpdd.m	(revision 0)
++++ ../trunk-jpl/src/m/classes/SMBpdd.m	(revision 17078)
+@@ -0,0 +1,96 @@
++%SMBpdd Class definition
++%
++%   Usage:
++%      SMBpdd=SMBpdd();
++
++classdef SMBpdd
++	properties (SetAccess=public) 
++		precipitation             = NaN;
++		monthlytemperatures       = NaN;
++		desfac                    = 0.5;
++		s0p                       = 0;
++		isdelta18o                = 0;
++		delta18o                  = NaN;
++		delta18o_surface          = NaN;
++		temperatures_presentday   = NaN;
++		temperatures_lgm          = NaN;
++		precipitations_presentday = NaN;
++	end
++	methods
++		function obj = SMBpdd(varargin) % {{{
++			switch nargin
++				case 0
++					obj=setdefaultparameters(obj);
++				otherwise
++					error('constructor not supported');
++			end
++		end % }}}
++		function self = initialize(self,md) % {{{
++
++			if isnan(self.precipitation),
++				self.precipitation=zeros(md.mesh.numberofvertices,1);
++				disp('      no SMBpdd.precipitation specified: values set as zero');
++			end
++
++		end % }}}
++		function obj = setdefaultparameters(obj) % {{{
++
++		  obj.isdelta18o = 0;
++		  obj.desfac     = 0.5;
++		  obj.s0p        = 0;
++		end % }}}
++		function md = checkconsistency(obj,md,solution,analyses) % {{{
++
++			if ismember(MasstransportAnalysisEnum(),analyses),
++				md = checkfield(md,'fieldname','surfaceforcings.desfac','<=',1,'numel',1);
++				md = checkfield(md,'fieldname','surfaceforcings.s0p','>=',0,'numel',1);
++				if(obj.isdelta18o==0)
++					md = checkfield(md,'fieldname','surfaceforcings.monthlytemperatures','forcing',1,'NaN',1);
++					md = checkfield(md,'fieldname','surfaceforcings.precipitation','forcing',1,'NaN',1);
++				else
++					md = checkfield(md,'fieldname','surfaceforcings.delta18o','NaN',1);
++					md = checkfield(md,'fieldname','surfaceforcings.delta18o_surface','NaN',1);
++					md = checkfield(md,'fieldname','surfaceforcings.temperatures_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1);
++					md = checkfield(md,'fieldname','surfaceforcings.temperatures_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1);
++					md = checkfield(md,'fieldname','surfaceforcings.precipitations_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1);
++				end
++			end
++		end % }}}
++		function disp(obj) % {{{
++			disp(sprintf('   surface forcings parameters:'));
++
++			disp(sprintf('\n   PDD and deltaO18 parameters:'));
++			fielddisplay(obj,'isdelta18o','is temperature and precipitation delta18o parametrisation activated (0 or 1, default is 0)');
++			fielddisplay(obj,'desfac','desertification elevation factor (between 0 and 1, default is 0.5) [m]');
++			fielddisplay(obj,'s0p','should be set to elevation from precip source (between 0 and a few 1000s m, default is 0) [m]');
++			fielddisplay(obj,'monthlytemperatures','monthly surface temperatures [K], required if pdd is activated and delta18o not activated');
++			fielddisplay(obj,'precipitation','surface precipitation [m/yr water eq]');
++			fielddisplay(obj,'temperatures_presentday','monthly present day surface temperatures [K], required if pdd is activated and delta18o activated');
++			fielddisplay(obj,'temperatures_lgm','monthly LGM surface temperatures [K], required if pdd is activated and delta18o activated');
++			fielddisplay(obj,'precipitations_presentday','monthly surface precipitation [m/yr water eq], required if pdd is activated and delta18o activated');
++			fielddisplay(obj,'delta18o','delta18o, required if pdd is activated and delta18o activated');
++			fielddisplay(obj,'delta18o_surface','surface elevation of the delta18o site, required if pdd is activated and delta18o activated');
++
++		end % }}}
++		function marshall(obj,md,fid) % {{{
++
++			yts=365.0*24.0*3600.0;
++
++			WriteData(fid,'enum',SurfaceforcingsEnum(),'data',SMBpddEnum(),'format','Integer');
++
++			WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','precipitation','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1);
++			WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','desfac','format','Double');
++			WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','s0p','format','Double');
++			WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','isdelta18o','format','Boolean');
++			if obj.isdelta18o
++				WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','temperatures_presentday','format','DoubleMat','mattype',1);
++				WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','temperatures_lgm','format','DoubleMat','mattype',1);
++				WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','precipitations_presentday','format','DoubleMat','mattype',1);
++				WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','delta18o_surface','format','DoubleMat','mattype',1);
++				WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','delta18o','format','DoubleMat','mattype',1);
++			else
++				WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','monthlytemperatures','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
++			end
++		end % }}}
++	end
++end
+Index: ../trunk-jpl/src/m/classes/SMBgradients.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/SMBgradients.m	(revision 0)
++++ ../trunk-jpl/src/m/classes/SMBgradients.m	(revision 17078)
+@@ -0,0 +1,63 @@
++%SMBgradients Class definition
++%
++%   Usage:
++%      SMBgradients=SMBgradients();
++
++classdef SMBgradients
++	properties (SetAccess=public) 
++		href   = NaN;
++		smbref = NaN;
++		b_pos  = NaN;
++		b_neg  = NaN;
++	end
++	methods
++		function obj = SMBgradients(varargin) % {{{
++			switch nargin
++				case 0
++					obj=setdefaultparameters(obj);
++				otherwise
++					error('constructor not supported');
++			end
++		end % }}}
++		function self = initialize(self,md) % {{{
++
++			%Nothing done for now
++
++		end % }}}
++		function obj = setdefaultparameters(obj) % {{{
++
++			%Nothing for now
++
++		end % }}}
++		function md = checkconsistency(obj,md,solution,analyses) % {{{
++
++			if ismember(MasstransportAnalysisEnum(),analyses),
++				md = checkfield(md,'fieldname','surfaceforcings.href','forcing',1,'NaN',1);
++				md = checkfield(md,'fieldname','surfaceforcings.smbref','forcing',1,'NaN',1);
++				md = checkfield(md,'fieldname','surfaceforcings.b_pos','forcing',1,'NaN',1);
++				md = checkfield(md,'fieldname','surfaceforcings.b_neg','forcing',1,'NaN',1);
++			end
++		end % }}}
++		function disp(obj) % {{{
++			disp(sprintf('   surface forcings parameters:'));
++
++			disp(sprintf('\n   SMB gradients parameters:'));
++			fielddisplay(obj,'href',' reference elevation from which deviation is used to calculate SMB adjustment in smb gradients method');
++			fielddisplay(obj,'smbref',' reference smb from which deviation is calculated in smb gradients method');
++			fielddisplay(obj,'b_pos',' slope of hs - smb regression line for accumulation regime required if smb gradients is activated');
++			fielddisplay(obj,'b_neg',' slope of hs - smb regression line for ablation regime required if smb gradients is activated');
++
++		end % }}}
++		function marshall(obj,md,fid) % {{{
++
++			yts=365.0*24.0*3600.0;
++
++			WriteData(fid,'enum',SurfaceforcingsEnum(),'data',SMBgradientsEnum(),'format','Integer');
++			WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','href','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
++			WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','smbref','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1);
++			WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','b_pos','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1);
++			WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','b_neg','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1);
++
++		end % }}}
++	end
++end
+Index: ../trunk-jpl/src/m/classes/model.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.py	(revision 17077)
++++ ../trunk-jpl/src/m/classes/model.py	(revision 17078)
+@@ -8,6 +8,8 @@
+ from constants import constants
+ from surfaceforcings import surfaceforcings
+ from SMB import SMB
++from SMBpdd import SMBpdd
++from SMBgradients import SMBgradients
+ from basalforcings import basalforcings
+ from matice import matice
+ from damage import damage
+Index: ../trunk-jpl/src/m/classes/SMBgradients.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/SMBgradients.py	(revision 0)
++++ ../trunk-jpl/src/m/classes/SMBgradients.py	(revision 17078)
+@@ -0,0 +1,56 @@
++from fielddisplay import fielddisplay
++from EnumDefinitions import *
++from checkfield import *
++from WriteData import *
++
++class SMBgradients(object):
++	"""
++	SMBgradients Class definition
++
++	   Usage:
++	      SMBgradients=SMBgradients();
++	"""
++
++	def __init__(self): # {{{
++		self.href    = float('NaN')
++		self.smbref  = float('NaN')
++		self.b_pos   = float('NaN')
++		self.b_neg   = float('NaN')
++		#}}}
++	def __repr__(self): # {{{
++		string="   surface forcings parameters:"
++
++		string="%s\n%s"%(string,fielddisplay(self,'issmbgradients','is smb gradients method activated (0 or 1, default is 0)'))
++		string="%s\n%s"%(string,fielddisplay(self,'href',' reference elevation from which deviation is used to calculate SMB adjustment in smb gradients method'))
++		string="%s\n%s"%(string,fielddisplay(self,'smbref',' reference smb from which deviation is calculated in smb gradients method'))
++		string="%s\n%s"%(string,fielddisplay(self,'b_pos',' slope of hs - smb regression line for accumulation regime required if smb gradients is activated'))
++		string="%s\n%s"%(string,fielddisplay(self,'b_neg',' slope of hs - smb regression line for ablation regime required if smb gradients is activated'))
++
++		return string
++		#}}}
++	def initialize(self,md): # {{{
++
++		#Nothing for now
++
++		return self
++	#}}}
++	def checkconsistency(self,md,solution,analyses):    # {{{
++
++		if MasstransportAnalysisEnum() in analyses:
++			md = checkfield(md,'fieldname','surfaceforcings.href','forcing',1,'NaN',1)
++			md = checkfield(md,'fieldname','surfaceforcings.smbref','forcing',1,'NaN',1)
++			md = checkfield(md,'fieldname','surfaceforcings.b_pos','forcing',1,'NaN',1)
++			md = checkfield(md,'fieldname','surfaceforcings.b_neg','forcing',1,'NaN',1)
++
++		return md
++	# }}}
++	def marshall(self,md,fid):    # {{{
++
++		yts=365.0*24.0*3600.0
++
++		WriteData(fid,'enum',SurfaceforcingsEnum(),'data',SMBgradientsEnum(),'format','Integer');
++		WriteData(fid,'object',self,'class','surfaceforcings','fieldname','href','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1)
++		WriteData(fid,'object',self,'class','surfaceforcings','fieldname','smbref','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1)
++		WriteData(fid,'object',self,'class','surfaceforcings','fieldname','b_pos','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1)
++		WriteData(fid,'object',self,'class','surfaceforcings','fieldname','b_neg','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1)
++	# }}}
+Index: ../trunk-jpl/src/m/enum/SMBpddEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/SMBpddEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/SMBpddEnum.m	(revision 17078)
+@@ -0,0 +1,11 @@
++function macro=SMBpddEnum()
++%SMBPDDENUM - Enum of SMBpdd
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=SMBpddEnum()
++
++macro=StringToEnum('SMBpdd');
+Index: ../trunk-jpl/src/m/enum/SMBgradientsEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/SMBgradientsEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/SMBgradientsEnum.m	(revision 17078)
+@@ -0,0 +1,11 @@
++function macro=SMBgradientsEnum()
++%SMBGRADIENTSENUM - Enum of SMBgradients
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=SMBgradientsEnum()
++
++macro=StringToEnum('SMBgradients');
+Index: ../trunk-jpl/src/m/enum/LevelsetAnalysisEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/LevelsetAnalysisEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/LevelsetAnalysisEnum.m	(revision 17078)
+@@ -0,0 +1,11 @@
++function macro=LevelsetAnalysisEnum()
++%LEVELSETANALYSISENUM - Enum of LevelsetAnalysis
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=LevelsetAnalysisEnum()
++
++macro=StringToEnum('LevelsetAnalysis');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17077)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17078)
+@@ -276,6 +276,7 @@
+ def SurfaceforcingsEnum(): return StringToEnum("Surfaceforcings")[0]
+ def SMBEnum(): return StringToEnum("SMB")[0]
+ def SurfaceforcingsMassBalanceEnum(): return StringToEnum("SurfaceforcingsMassBalance")[0]
++def SMBpddEnum(): return StringToEnum("SMBpdd")[0]
+ def SurfaceforcingsDelta18oEnum(): return StringToEnum("SurfaceforcingsDelta18o")[0]
+ def SurfaceforcingsDelta18oSurfaceEnum(): return StringToEnum("SurfaceforcingsDelta18oSurface")[0]
+ def SurfaceforcingsIsdelta18oEnum(): return StringToEnum("SurfaceforcingsIsdelta18o")[0]
+@@ -283,15 +284,16 @@
+ def SurfaceforcingsTemperaturesPresentdayEnum(): return StringToEnum("SurfaceforcingsTemperaturesPresentday")[0]
+ def SurfaceforcingsTemperaturesLgmEnum(): return StringToEnum("SurfaceforcingsTemperaturesLgm")[0]
+ def SurfaceforcingsPrecipitationEnum(): return StringToEnum("SurfaceforcingsPrecipitation")[0]
+-def SurfaceforcingsIspddEnum(): return StringToEnum("SurfaceforcingsIspdd")[0]
+ def SurfaceforcingsDesfacEnum(): return StringToEnum("SurfaceforcingsDesfac")[0]
+ def SurfaceforcingsS0pEnum(): return StringToEnum("SurfaceforcingsS0p")[0]
+-def SurfaceforcingsIssmbgradientsEnum(): return StringToEnum("SurfaceforcingsIssmbgradients")[0]
++def SMBgradientsEnum(): return StringToEnum("SMBgradients")[0]
+ def SurfaceforcingsMonthlytemperaturesEnum(): return StringToEnum("SurfaceforcingsMonthlytemperatures")[0]
+ def SurfaceforcingsHrefEnum(): return StringToEnum("SurfaceforcingsHref")[0]
+ def SurfaceforcingsSmbrefEnum(): return StringToEnum("SurfaceforcingsSmbref")[0]
+ def SurfaceforcingsBPosEnum(): return StringToEnum("SurfaceforcingsBPos")[0]
+ def SurfaceforcingsBNegEnum(): return StringToEnum("SurfaceforcingsBNeg")[0]
++def SurfaceforcingsIspddEnum(): return StringToEnum("SurfaceforcingsIspdd")[0]
++def SurfaceforcingsIssmbgradientsEnum(): return StringToEnum("SurfaceforcingsIssmbgradients")[0]
+ def SolutionTypeEnum(): return StringToEnum("SolutionType")[0]
+ def AnalysisTypeEnum(): return StringToEnum("AnalysisType")[0]
+ def ConfigurationTypeEnum(): return StringToEnum("ConfigurationType")[0]
+Index: ../trunk-jpl/src/m/enum/TransientIslevelsetEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/TransientIslevelsetEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/TransientIslevelsetEnum.m	(revision 17078)
+@@ -0,0 +1,11 @@
++function macro=TransientIslevelsetEnum()
++%TRANSIENTISLEVELSETENUM - Enum of TransientIslevelset
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=TransientIslevelsetEnum()
++
++macro=StringToEnum('TransientIslevelset');
Index: issm/oecreview/Archive/16554-17801/ISSM-17078-17079.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17078-17079.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17078-17079.diff	(revision 17802)
@@ -0,0 +1,848 @@
+Index: ../trunk-jpl/src/m/classes/surfaceforcings.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/surfaceforcings.py	(revision 17078)
++++ ../trunk-jpl/src/m/classes/surfaceforcings.py	(revision 17079)
+@@ -1,143 +0,0 @@
+-from fielddisplay import fielddisplay
+-from EnumDefinitions import *
+-from checkfield import *
+-from WriteData import *
+-
+-class surfaceforcings(object):
+-	"""
+-	SURFACEFORCING Class definition
+-
+-	   Usage:
+-	      surfaceforcings=surfaceforcings();
+-	"""
+-
+-	def __init__(self): # {{{
+-		self.precipitation             = float('NaN')
+-		self.mass_balance              = float('NaN')
+-		self.ispdd                     = 0
+-		self.issmbgradients            = 0
+-		self.isdelta18o                = 0
+-		self.href                      = float('NaN')
+-		self.smbref                    = float('NaN')
+-		self.b_pos                     = float('NaN')
+-		self.b_neg                     = float('NaN')
+-		self.monthlytemperatures       = float('NaN')
+-		self.delta18o                  = float('NaN')
+-		self.delta18o_surface          = float('NaN')
+-		self.temperatures_presentday   = float('NaN')
+-		self.temperatures_lgm          = float('NaN')
+-		self.precipitations_presentday = float('NaN')
+-		self.desfac                    = 0.
+-		self.s0p                       = 0.
+-
+-		#set defaults
+-		self.setdefaultparameters()
+-
+-		#}}}
+-	def __repr__(self): # {{{
+-		string="   surface forcings parameters:"
+-
+-		string="%s\n%s"%(string,fielddisplay(self,'precipitation','surface precipitation [m/yr water eq]'))
+-		string="%s\n%s"%(string,fielddisplay(self,'mass_balance','surface mass balance [m/yr ice eq]'))
+-		string="%s\n%s"%(string,fielddisplay(self,'ispdd','is pdd activated (0 or 1, default is 0)'))
+-		string="%s\n%s"%(string,fielddisplay(self,'desfac','desertification elevation factor (between 0 and 1, default is 0.5) [m]'))
+-		string="%s\n%s"%(string,fielddisplay(self,'isdelta18o','is temperature and precipitation delta18o parametrisation activated (0 or 1, default is 0)'))
+-		string="%s\n%s"%(string,fielddisplay(self,'s0p','should be set to elevation from precip source (between 0 and a few 1000s m, default is 0) [m]'))
+-		string="%s\n%s"%(string,fielddisplay(self,'monthlytemperatures','monthly surface temperatures [K], required if pdd is activated and delta18o not activated'))
+-		string="%s\n%s"%(string,fielddisplay(self,'precipitation','surface precipitation [m/yr water eq]'))
+-		string="%s\n%s"%(string,fielddisplay(self,'temperatures_presentday','monthly present day surface temperatures [K], required if pdd is activated and delta18o activated'))
+-		string="%s\n%s"%(string,fielddisplay(self,'temperatures_lgm','monthly LGM surface temperatures [K], required if pdd is activated and delta18o activated'))
+-		string="%s\n%s"%(string,fielddisplay(self,'precipitations_presentday','monthly surface precipitation [m/yr water eq], required if pdd is activated and delta18o activated'))
+-		string="%s\n%s"%(string,fielddisplay(self,'delta18o','delta18o, required if pdd is activated and delta18o activated'))
+-		string="%s\n%s"%(string,fielddisplay(self,'delta18o_surface','surface elevation of the delta18o site, required if pdd is activated and delta18o activated'))
+-		string="%s\n%s"%(string,fielddisplay(self,'issmbgradients','is smb gradients method activated (0 or 1, default is 0)'))
+-		string="%s\n%s"%(string,fielddisplay(self,'href',' reference elevation from which deviation is used to calculate SMB adjustment in smb gradients method'))
+-		string="%s\n%s"%(string,fielddisplay(self,'smbref',' reference smb from which deviation is calculated in smb gradients method'))
+-		string="%s\n%s"%(string,fielddisplay(self,'b_pos',' slope of hs - smb regression line for accumulation regime required if smb gradients is activated'))
+-		string="%s\n%s"%(string,fielddisplay(self,'b_neg',' slope of hs - smb regression line for ablation regime required if smb gradients is activated'))
+-
+-		return string
+-		#}}}
+-	def initialize(self,md): # {{{
+-
+-		if numpy.all(numpy.isnan(self.precipitation)) and (self.ispdd==1):
+-			self.precipitation=numpy.zeros((md.mesh.numberofvertices,1))
+-			print "      no surfaceforcings.precipitation specified: values set as zero"
+-		if numpy.all(numpy.isnan(self.mass_balance)) and (self.ispdd==0):
+-			self.mass_balance=numpy.zeros((md.mesh.numberofvertices,1))
+-			print "      no surfaceforcings.mass_balance specified: values set as zero"
+-
+-		return self
+-	#}}}
+-	def setdefaultparameters(self): # {{{
+-		  
+-		#pdd method not used in default mode
+-		self.ispdd=0
+-		self.issmbgradients=0
+-		self.isdelta18o=0
+-		self.desfac=0.5
+-		self.s0p=0.
+-
+-		return self
+-	#}}}
+-	def checkconsistency(self,md,solution,analyses):    # {{{
+-
+-		if MasstransportAnalysisEnum() in analyses:
+-			md = checkfield(md,'fieldname','surfaceforcings.ispdd','numel',[1],'values',[0,1])
+-			md = checkfield(md,'fieldname','surfaceforcings.issmbgradients','numel',[1],'values',[0,1])
+-			if   self.ispdd:
+-				md = checkfield(md,'fieldname','surfaceforcings.desfac','<=',1,'numel',[1]);
+-				md = checkfield(md,'fieldname','surfaceforcings.s0p','>=',0,'numel',[1]);
+-				if not self.isdelta18o:
+-					md = checkfield(md,'fieldname','surfaceforcings.monthlytemperatures','forcing',1,'NaN',1)
+-					md = checkfield(md,'fieldname','surfaceforcings.precipitation','forcing',1,'NaN',1)
+-				else:
+-					md = checkfield(md,'fieldname','surfaceforcings.delta18o','NaN',1)
+-					md = checkfield(md,'fieldname','surfaceforcings.delta18o_surface','NaN',1)
+-					md = checkfield(md,'fieldname','surfaceforcings.temperatures_presentday','size',[md.mesh.numberofvertices+1,12],'NaN',1)
+-					md = checkfield(md,'fieldname','surfaceforcings.temperatures_lgm','size',[md.mesh.numberofvertices+1,12],'NaN',1)
+-					md = checkfield(md,'fieldname','surfaceforcings.precipitations_presentday','size',[md.mesh.numberofvertices+1,12],'NaN',1)
+-			elif self.issmbgradients:
+-				md = checkfield(md,'fieldname','surfaceforcings.href','forcing',1,'NaN',1)
+-				md = checkfield(md,'fieldname','surfaceforcings.smbref','forcing',1,'NaN',1)
+-				md = checkfield(md,'fieldname','surfaceforcings.b_pos','forcing',1,'NaN',1)
+-				md = checkfield(md,'fieldname','surfaceforcings.b_neg','forcing',1,'NaN',1)
+-			else:
+-				md = checkfield(md,'fieldname','surfaceforcings.mass_balance','forcing',1,'NaN',1)
+-
+-		if BalancethicknessAnalysisEnum() in analyses:
+-			md = checkfield(md,'fieldname','surfaceforcings.mass_balance','size',[md.mesh.numberofvertices],'NaN',1)
+-
+-		return md
+-	# }}}
+-	def marshall(self,md,fid):    # {{{
+-
+-		yts=365.0*24.0*3600.0
+-
+-		WriteData(fid,'enum',SurfaceforcingsEnum(),'data',SurfaceforcingsEnum(),'format','Integer');
+-
+-		WriteData(fid,'object',self,'fieldname','precipitation','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1)
+-		WriteData(fid,'object',self,'fieldname','mass_balance','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1)
+-		WriteData(fid,'object',self,'fieldname','ispdd','format','Boolean')
+-		WriteData(fid,'object',self,'fieldname','isdelta18o','format','Boolean')
+-
+-		if self.ispdd:
+-			WriteData(fid,'object',self,'fieldname','desfac','format','Double');
+-			WriteData(fid,'object',self,'fieldname','s0p','format','Double');
+-			if self.isdelta18o:
+-				WriteData(fid,'object',self,'fieldname','temperatures_presentday','format','DoubleMat','mattype',1)
+-				WriteData(fid,'object',self,'fieldname','temperatures_lgm','format','DoubleMat','mattype',1)
+-				WriteData(fid,'object',self,'fieldname','precipitations_presentday','format','DoubleMat','mattype',1)
+-				WriteData(fid,'object',self,'fieldname','delta18o_surface','format','DoubleMat','mattype',1)
+-				WriteData(fid,'object',self,'fieldname','delta18o','format','DoubleMat','mattype',1)
+-			else:
+-				WriteData(fid,'object',self,'fieldname','monthlytemperatures','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1)
+-
+-		WriteData(fid,'object',self,'fieldname','issmbgradients','format','Boolean')
+-
+-		if self.issmbgradients:
+-			WriteData(fid,'object',self,'fieldname','href','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1)
+-			WriteData(fid,'object',self,'fieldname','smbref','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1)
+-			WriteData(fid,'object',self,'fieldname','b_pos','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1)
+-			WriteData(fid,'object',self,'fieldname','b_neg','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1)
+-	# }}}
+Index: ../trunk-jpl/src/m/classes/surfaceforcings.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/surfaceforcings.m	(revision 17078)
++++ ../trunk-jpl/src/m/classes/surfaceforcings.m	(revision 17079)
+@@ -1,147 +0,0 @@
+-%SURFACEFORCING Class definition
+-%
+-%   Usage:
+-%      surfaceforcings=surfaceforcings();
+-
+-classdef surfaceforcings
+-	properties (SetAccess=public) 
+-		precipitation             = NaN;
+-		mass_balance              = NaN;
+-		ispdd                     = 0;
+-		issmbgradients            = 0;
+-		isdelta18o                = 0;
+-		href                      = NaN;
+-		smbref                    = NaN;
+-		b_pos                     = NaN;
+-		b_neg                     = NaN;
+-		monthlytemperatures       = NaN;
+-		delta18o                  = NaN;
+-		delta18o_surface          = NaN;
+-		temperatures_presentday   = NaN;
+-		temperatures_lgm          = NaN;
+-		precipitations_presentday = NaN;
+-		desfac                    = 0.5;
+-		s0p                       = 0;
+-	end
+-	methods
+-		function obj = surfaceforcings(varargin) % {{{
+-			switch nargin
+-				case 0
+-					obj=setdefaultparameters(obj);
+-				otherwise
+-					error('constructor not supported');
+-			end
+-		end % }}}
+-		function self = initialize(self,md) % {{{
+-
+-			if (isnan(self.precipitation) & (self.ispdd==1)),
+-				self.precipitation=zeros(md.mesh.numberofvertices,1);
+-				disp('      no surfaceforcings.precipitation specified: values set as zero');
+-			end
+-			if (isnan(self.mass_balance) & (self.ispdd==0)),
+-				self.mass_balance=zeros(md.mesh.numberofvertices,1);
+-				disp('      no surfaceforcings.mass_balance specified: values set as zero');
+-			end
+-
+-		end % }}}
+-		function obj = setdefaultparameters(obj) % {{{
+-
+-		  %pdd method not used in default mode
+-		  obj.ispdd=0;
+-		  obj.issmbgradients=0;
+-		  obj.isdelta18o=0;
+-		  obj.desfac=0.5;
+-		  obj.s0p=0;
+-		end % }}}
+-		function md = checkconsistency(obj,md,solution,analyses) % {{{
+-
+-			if ismember(MasstransportAnalysisEnum(),analyses),
+-				md = checkfield(md,'fieldname','surfaceforcings.ispdd','numel',[1],'values',[0 1]);
+-				md = checkfield(md,'fieldname','surfaceforcings.issmbgradients','numel',[1],'values',[0 1]);
+-				if(obj.ispdd)
+-				  md = checkfield(md,'fieldname','surfaceforcings.desfac','<=',1,'numel',1);
+-				  md = checkfield(md,'fieldname','surfaceforcings.s0p','>=',0,'numel',1);
+-					if(obj.isdelta18o==0)
+-						md = checkfield(md,'fieldname','surfaceforcings.monthlytemperatures','forcing',1,'NaN',1);
+-						md = checkfield(md,'fieldname','surfaceforcings.precipitation','forcing',1,'NaN',1);
+-					else
+-						md = checkfield(md,'fieldname','surfaceforcings.delta18o','NaN',1);
+-						md = checkfield(md,'fieldname','surfaceforcings.delta18o_surface','NaN',1);
+-						md = checkfield(md,'fieldname','surfaceforcings.temperatures_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1);
+-						md = checkfield(md,'fieldname','surfaceforcings.temperatures_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1);
+-						md = checkfield(md,'fieldname','surfaceforcings.precipitations_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1);
+-					end
+-				elseif(obj.issmbgradients)
+-					md = checkfield(md,'fieldname','surfaceforcings.href','forcing',1,'NaN',1);
+-					md = checkfield(md,'fieldname','surfaceforcings.smbref','forcing',1,'NaN',1);
+-					md = checkfield(md,'fieldname','surfaceforcings.b_pos','forcing',1,'NaN',1);
+-					md = checkfield(md,'fieldname','surfaceforcings.b_neg','forcing',1,'NaN',1);
+-				else
+-					md = checkfield(md,'fieldname','surfaceforcings.mass_balance','forcing',1,'NaN',1);
+-				end
+-			end
+-			if ismember(BalancethicknessAnalysisEnum(),analyses),
+-				md = checkfield(md,'fieldname','surfaceforcings.mass_balance','size',[md.mesh.numberofvertices 1],'NaN',1);
+-			end
+-		end % }}}
+-		function disp(obj) % {{{
+-			disp(sprintf('   surface forcings parameters:'));
+-
+-			disp(sprintf('\n   General parameters:'));
+-			fielddisplay(obj,'mass_balance','surface mass balance [m/yr ice eq]');
+-
+-			disp(sprintf('\n   PDD and deltaO18 parameters:'));
+-			fielddisplay(obj,'ispdd','is pdd activated (0 or 1, default is 0)');
+-			fielddisplay(obj,'isdelta18o','is temperature and precipitation delta18o parametrisation activated (0 or 1, default is 0)');
+-			fielddisplay(obj,'desfac','desertification elevation factor (between 0 and 1, default is 0.5) [m]');
+-			fielddisplay(obj,'s0p','should be set to elevation from precip source (between 0 and a few 1000s m, default is 0) [m]');
+-			fielddisplay(obj,'monthlytemperatures','monthly surface temperatures [K], required if pdd is activated and delta18o not activated');
+-			fielddisplay(obj,'precipitation','surface precipitation [m/yr water eq]');
+-			fielddisplay(obj,'temperatures_presentday','monthly present day surface temperatures [K], required if pdd is activated and delta18o activated');
+-			fielddisplay(obj,'temperatures_lgm','monthly LGM surface temperatures [K], required if pdd is activated and delta18o activated');
+-			fielddisplay(obj,'precipitations_presentday','monthly surface precipitation [m/yr water eq], required if pdd is activated and delta18o activated');
+-			fielddisplay(obj,'delta18o','delta18o, required if pdd is activated and delta18o activated');
+-			fielddisplay(obj,'delta18o_surface','surface elevation of the delta18o site, required if pdd is activated and delta18o activated');
+-
+-			disp(sprintf('\n   SMB gradients parameters:'));
+-			fielddisplay(obj,'issmbgradients','is smb gradients method activated (0 or 1, default is 0)');
+-			fielddisplay(obj,'href',' reference elevation from which deviation is used to calculate SMB adjustment in smb gradients method');
+-			fielddisplay(obj,'smbref',' reference smb from which deviation is calculated in smb gradients method');
+-			fielddisplay(obj,'b_pos',' slope of hs - smb regression line for accumulation regime required if smb gradients is activated');
+-			fielddisplay(obj,'b_neg',' slope of hs - smb regression line for ablation regime required if smb gradients is activated');
+-
+-		end % }}}
+-		function marshall(obj,md,fid) % {{{
+-
+-			yts=365.0*24.0*3600.0;
+-
+-			WriteData(fid,'enum',SurfaceforcingsEnum(),'data',SurfaceforcingsEnum(),'format','Integer');
+-
+-			WriteData(fid,'object',obj,'fieldname','precipitation','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1);
+-			WriteData(fid,'object',obj,'fieldname','mass_balance','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1);
+-			WriteData(fid,'object',obj,'fieldname','ispdd','format','Boolean');
+-			WriteData(fid,'object',obj,'fieldname','isdelta18o','format','Boolean');
+-			if obj.ispdd,
+-				WriteData(fid,'object',obj,'fieldname','desfac','format','Double');
+-				WriteData(fid,'object',obj,'fieldname','s0p','format','Double');
+-				if obj.isdelta18o
+-					WriteData(fid,'object',obj,'fieldname','temperatures_presentday','format','DoubleMat','mattype',1);
+-					WriteData(fid,'object',obj,'fieldname','temperatures_lgm','format','DoubleMat','mattype',1);
+-					WriteData(fid,'object',obj,'fieldname','precipitations_presentday','format','DoubleMat','mattype',1);
+-					WriteData(fid,'object',obj,'fieldname','delta18o_surface','format','DoubleMat','mattype',1);
+-					WriteData(fid,'object',obj,'fieldname','delta18o','format','DoubleMat','mattype',1);
+-				else
+-					WriteData(fid,'object',obj,'fieldname','monthlytemperatures','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
+-				end
+-			end
+-			WriteData(fid,'object',obj,'fieldname','issmbgradients','format','Boolean');
+-			if obj.issmbgradients,
+-				WriteData(fid,'object',obj,'fieldname','href','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
+-				WriteData(fid,'object',obj,'fieldname','smbref','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1);
+-				WriteData(fid,'object',obj,'fieldname','b_pos','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1);
+-				WriteData(fid,'object',obj,'fieldname','b_neg','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1);
+-			end
+-
+-		end % }}}
+-	end
+-end
+Index: ../trunk-jpl/src/m/classes/transient.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/transient.py	(revision 17078)
++++ ../trunk-jpl/src/m/classes/transient.py	(revision 17079)
+@@ -12,8 +12,8 @@
+ 	"""
+ 
+ 	def __init__(self): # {{{
+-		self.ismasstransport      = False
+-		self.isstressbalance      = False
++		self.ismasstransport   = False
++		self.isstressbalance   = False
+ 		self.isthermal         = False
+ 		self.isgroundingline   = False
+ 		self.isgia             = False
+Index: ../trunk-jpl/src/m/classes/SMBpdd.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/SMBpdd.py	(revision 17078)
++++ ../trunk-jpl/src/m/classes/SMBpdd.py	(revision 17079)
+@@ -1,6 +1,7 @@
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+ from checkfield import *
++from project3d import *
+ from WriteData import *
+ 
+ class SMBpdd(object):
+@@ -42,6 +43,15 @@
+ 
+ 		return string
+ 		#}}}
++	def extrude(self,md): # {{{
++
++		self.precipitation=project3d(md,'vector',self.precipitation,'type','node');
++		self.monthlytemperatures=project3d(md,'vector',self.monthlytemperatures,'type','node');
++		if self.isdelta18o: self.temperatures_lgm=project3d(md,'vector',self.temperatures_lgm,'type','node')
++		if self.isdelta18o: self.temperatures_presentday=project3d(md,'vector',self.temperatures_presentday,'type','node')
++		if self.isdelta18o: self.precipitations_presentday=project3d(md,'vector',self.precipitations_presentday,'type','node')
++		return self
++	#}}}
+ 	def initialize(self,md): # {{{
+ 
+ 		if numpy.all(numpy.isnan(self.precipitation)):
+Index: ../trunk-jpl/src/m/classes/SMBpdd.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/SMBpdd.m	(revision 17078)
++++ ../trunk-jpl/src/m/classes/SMBpdd.m	(revision 17079)
+@@ -25,6 +25,16 @@
+ 					error('constructor not supported');
+ 			end
+ 		end % }}}
++		function self = extrude(self,md) % {{{
++
++			self.precipitation=project3d(md,'vector',self.precipitation,'type','node');
++			self.monthlytemperatures=project3d(md,'vector',self.monthlytemperatures,'type','node');
++			if(self.isdelta18o),self.temperatures_lgm=project3d(md,'vector',self.temperatures_lgm,'type','node');end
++			if(self.isdelta18o),self.temperatures_presentday=project3d(md,'vector',self.temperatures_presentday,'type','node');end
++			if(self.isdelta18o),self.precipitations_presentday=project3d(md,'vector',self.precipitations_presentday,'type','node');end
++
++
++		end % }}}
+ 		function self = initialize(self,md) % {{{
+ 
+ 			if isnan(self.precipitation),
+Index: ../trunk-jpl/src/m/classes/SMB.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/SMB.py	(revision 17078)
++++ ../trunk-jpl/src/m/classes/SMB.py	(revision 17079)
+@@ -1,6 +1,7 @@
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+ from checkfield import *
++from project3d import *
+ from WriteData import *
+ 
+ class SMB(object):
+@@ -19,6 +20,11 @@
+ 		string="%s\n%s"%(string,fielddisplay(self,'mass_balance','surface mass balance [m/yr ice eq]'))
+ 		return string
+ 		#}}}
++	def extrude(self,md): # {{{
++
++		self.mass_balance=project3d(md,'vector',self.mass_balance,'type','node');
++		return self
++	#}}}
+ 	def initialize(self,md): # {{{
+ 
+ 		if numpy.all(numpy.isnan(self.mass_balance)):
+Index: ../trunk-jpl/src/m/classes/SMB.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/SMB.m	(revision 17078)
++++ ../trunk-jpl/src/m/classes/SMB.m	(revision 17079)
+@@ -15,6 +15,11 @@
+ 					error('constructor not supported');
+ 			end
+ 		end % }}}
++		function self = extrude(self,md) % {{{
++
++			self.mass_balance=project3d(md,'vector',self.mass_balance,'type','node');
++
++		end % }}}
+ 		function self = initialize(self,md) % {{{
+ 
+ 			if isnan(self.mass_balance)
+Index: ../trunk-jpl/src/m/classes/SMBgradients.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/SMBgradients.m	(revision 17078)
++++ ../trunk-jpl/src/m/classes/SMBgradients.m	(revision 17079)
+@@ -19,6 +19,11 @@
+ 					error('constructor not supported');
+ 			end
+ 		end % }}}
++		function self = extrude(self,md) % {{{
++
++			%Nothing for now
++
++		end % }}}
+ 		function self = initialize(self,md) % {{{
+ 
+ 			%Nothing done for now
+Index: ../trunk-jpl/src/m/classes/model.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.py	(revision 17078)
++++ ../trunk-jpl/src/m/classes/model.py	(revision 17079)
+@@ -59,7 +59,7 @@
+ 		self.mask             = mask()
+ 		self.geometry         = geometry()
+ 		self.constants        = constants()
+-		self.surfaceforcings  = surfaceforcings()
++		self.surfaceforcings  = SMB()
+ 		self.basalforcings    = basalforcings()
+ 		self.materials        = matice()
+ 		self.damage           = damage()
+@@ -575,10 +575,8 @@
+ 		md.inversion.vy_obs=project3d(md,'vector',md.inversion.vy_obs,'type','node')
+ 		md.inversion.vel_obs=project3d(md,'vector',md.inversion.vel_obs,'type','node')
+ 		md.inversion.thickness_obs=project3d(md,'vector',md.inversion.thickness_obs,'type','node')
+-		md.surfaceforcings.mass_balance=project3d(md,'vector',md.surfaceforcings.mass_balance,'type','node')
+-		md.surfaceforcings.precipitation=project3d(md,'vector',md.surfaceforcings.precipitation,'type','node')
++		md.surfaceforcings.extrude(md)
+ 		md.balancethickness.thickening_rate=project3d(md,'vector',md.balancethickness.thickening_rate,'type','node')
+-		md.surfaceforcings.monthlytemperatures=project3d(md,'vector',md.surfaceforcings.monthlytemperatures,'type','node')
+ 
+ 		#results
+ 		if not numpy.any(numpy.isnan(md.initialization.vx)):
+@@ -661,12 +659,6 @@
+ 			md.inversion.max_parameters=project3d(md,'vector',md.inversion.max_parameters,'type','node')
+ 		if not numpy.any(numpy.isnan(md.qmu.partition)):
+ 			md.qmu.partition=project3d(md,'vector',numpy.transpose(md.qmu.partition),'type','node')
+-		if(md.surfaceforcings.isdelta18o):
+-			md.surfaceforcings.temperatures_lgm=project3d(md,'vector',md.surfaceforcings.temperatures_lgm,'type','node')
+-		if(md.surfaceforcings.isdelta18o):
+-			md.surfaceforcings.temperatures_presentday=project3d(md,'vector',md.surfaceforcings.temperatures_presentday,'type','node')
+-		if(md.surfaceforcings.isdelta18o):
+-			md.surfaceforcings.precipitations_presentday=project3d(md,'vector',md.surfaceforcings.precipitations_presentday,'type','node')
+ 
+ 		#Put lithostatic pressure if there is an existing pressure
+ 		if not numpy.any(numpy.isnan(md.initialization.pressure)):
+Index: ../trunk-jpl/src/m/classes/oldclasses/diagnostic.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/oldclasses/diagnostic.m	(revision 17078)
++++ ../trunk-jpl/src/m/classes/oldclasses/diagnostic.m	(revision 17079)
+@@ -25,108 +25,4 @@
+ 		loadingforce             = NaN;
+ 		requested_outputs        = NaN;
+ 	end
+-	methods
+-		function obj = diagnostic(varargin) % {{{
+-			switch nargin
+-				case 0
+-					obj=setdefaultparameters(obj);
+-				otherwise
+-					error('constructor not supported');
+-			end
+-		end % }}}
+-		function obj = setdefaultparameters(obj) % {{{
+-
+-			 %maximum of non-linear iterations.
+-			 obj.maxiter=100;
+-
+-			 %Convergence criterion: absolute, relative and residual
+-			 obj.restol=10^-4; 
+-			 obj.reltol=0.01;
+-			 obj.abstol=10;
+-
+-			 obj.FSreconditioning=10^13;
+-			 obj.shelf_dampening=0;
+-
+-			 %Penalty factor applied kappa=max(stiffness matrix)*10^penalty_factor
+-			 obj.penalty_factor=3;
+-
+-			 %coefficient to update the viscosity between each iteration of
+-			 %a diagnostic according to the following formula
+-			 %viscosity(n)=viscosity(n)+viscosity_overshoot(viscosity(n)-viscosity(n-1))
+-			 obj.viscosity_overshoot=0;
+-
+-			 %Stop the iterations of rift if below a threshold
+-			 obj.rift_penalty_threshold=0;
+-
+-			 %in some solutions, it might be needed to stop a run when only
+-			 %a few constraints remain unstable. For thermal computation, this
+-			 %parameter is often used.
+-			 obj.rift_penalty_lock=10;
+-
+-		end % }}}
+-		function disp(obj) % {{{
+-
+-			disp(sprintf('   Stressbalance solution parameters:'));
+-
+-			disp(sprintf('\n      %s','Convergence criteria:'));
+-			fielddisplay(obj,'restol','mechanical equilibrium residual convergence criterion');
+-			fielddisplay(obj,'reltol','velocity relative convergence criterion, NaN: not applied');
+-			fielddisplay(obj,'abstol','velocity absolute convergence criterion, NaN: not applied');
+-			fielddisplay(obj,'isnewton','0: Picard''s fixed point, 1: Newton''s method, 2: hybrid');
+-			fielddisplay(obj,'maxiter','maximum number of nonlinear iterations');
+-			fielddisplay(obj,'viscosity_overshoot','over-shooting constant new=new+C*(new-old)');
+-
+-			disp(sprintf('\n      %s','boundary conditions:'));
+-			fielddisplay(obj,'spcvx','x-axis velocity constraint (NaN means no constraint) [m/yr]');
+-			fielddisplay(obj,'spcvy','y-axis velocity constraint (NaN means no constraint) [m/yr]');
+-			fielddisplay(obj,'spcvz','z-axis velocity constraint (NaN means no constraint) [m/yr]');
+-			fielddisplay(obj,'icefront','segments on ice front list (last column 0: Air, 1: Water, 2: Ice)');
+-
+-			disp(sprintf('\n      %s','Rift options:'));
+-			fielddisplay(obj,'rift_penalty_threshold','threshold for instability of mechanical constraints');
+-			fielddisplay(obj,'rift_penalty_lock','number of iterations before rift penalties are locked');
+-
+-			disp(sprintf('\n      %s','Penalty options:'));
+-			fielddisplay(obj,'penalty_factor','offset used by penalties: penalty = Kmax*10^offset');
+-			fielddisplay(obj,'vertex_pairing','pairs of vertices that are penalized');
+-
+-			disp(sprintf('\n      %s','Other:'));
+-			fielddisplay(obj,'shelf_dampening','use dampening for floating ice ? Only for FS model');
+-			fielddisplay(obj,'FSreconditioning','multiplier for incompressibility equation. Only for FS model');
+-			fielddisplay(obj,'referential','local referential');
+-			fielddisplay(obj,'loadingforce','loading force applied on each point [N/m^3]');
+-			fielddisplay(obj,'requested_outputs','additional outputs requested');
+-
+-		end % }}}
+-
+-		function marshall(obj,md,fid) % {{{
+-			WriteData(fid,'object',obj,'fieldname','spcvx','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
+-			WriteData(fid,'object',obj,'fieldname','spcvy','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
+-			WriteData(fid,'object',obj,'fieldname','spcvz','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
+-			WriteData(fid,'object',obj,'fieldname','restol','format','Double');
+-			WriteData(fid,'object',obj,'fieldname','reltol','format','Double');
+-			WriteData(fid,'object',obj,'fieldname','abstol','format','Double');
+-			WriteData(fid,'object',obj,'fieldname','isnewton','format','Integer');
+-			WriteData(fid,'object',obj,'fieldname','FSreconditioning','format','Double');
+-			WriteData(fid,'object',obj,'fieldname','viscosity_overshoot','format','Double');
+-			WriteData(fid,'object',obj,'fieldname','maxiter','format','Integer');
+-			WriteData(fid,'object',obj,'fieldname','shelf_dampening','format','Integer');
+-			WriteData(fid,'object',obj,'fieldname','vertex_pairing','format','DoubleMat','mattype',3);
+-			WriteData(fid,'object',obj,'fieldname','penalty_factor','format','Double');
+-			WriteData(fid,'object',obj,'fieldname','rift_penalty_lock','format','Integer');
+-			WriteData(fid,'object',obj,'fieldname','rift_penalty_threshold','format','Integer');
+-			WriteData(fid,'object',obj,'fieldname','referential','format','DoubleMat','mattype',1);
+-			WriteData(fid,'data',obj.loadingforce(:,1),'format','DoubleMat','mattype',1,'enum',LoadingforceXEnum);
+-			WriteData(fid,'data',obj.loadingforce(:,2),'format','DoubleMat','mattype',1,'enum',LoadingforceYEnum);
+-			WriteData(fid,'data',obj.loadingforce(:,3),'format','DoubleMat','mattype',1,'enum',LoadingforceZEnum);
+-			WriteData(fid,'object',obj,'fieldname','requested_outputs','format','DoubleMat','mattype',3);
+-
+-			%marshall ice front
+-			data=obj.icefront;
+-			pos=find(data(:,end)==0); data(pos,end)=AirEnum();
+-			pos=find(data(:,end)==1); data(pos,end)=WaterEnum();
+-			pos=find(data(:,end)==2); data(pos,end)=IceEnum();
+-			WriteData(fid,'data',data,'enum',StressbalanceIcefrontEnum(),'format','DoubleMat','mattype',3);
+-		end % }}}
+-	end
+ end
+Index: ../trunk-jpl/src/m/classes/oldclasses/prognostic.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/oldclasses/prognostic.m	(revision 17078)
++++ ../trunk-jpl/src/m/classes/oldclasses/prognostic.m	(revision 17079)
+@@ -13,64 +13,4 @@
+ 		 penalty_factor         = 0;
+ 		 requested_outputs      = NaN;
+ 	end
+-	methods
+-		function obj = prognostic(varargin) % {{{
+-			switch nargin
+-				case 0
+-					obj=setdefaultparameters(obj);
+-				otherwise
+-					error('constructor not supported');
+-			end
+-		end % }}}
+-		function obj = setdefaultparameters(obj) % {{{
+-
+-			%Type of stabilization to use 0:nothing 1:artificial_diffusivity 3:Discontinuous Galerkin
+-			obj.stabilization=1;
+-
+-			%Factor applied to compute the penalties kappa=max(stiffness matrix)*10^penalty_factor
+-			obj.penalty_factor=3;
+-
+-			%Minimum ice thickness that can be used
+-			obj.min_thickness=1;
+-
+-			%Hydrostatic adjustment
+-			obj.hydrostatic_adjustment='Absolute';
+-		end % }}}
+-		function md = checkconsistency(obj,md,solution,analyses) % {{{
+-
+-			%Early return
+-			if ~ismember(PrognosticAnalysisEnum(),analyses) |  (solution==TransientSolutionEnum() & md.transient.isprognostic==0), return; end
+-
+-			md = checkfield(md,'prognostic.spcthickness','forcing',1);
+-			md = checkfield(md,'prognostic.hydrostatic_adjustment','values',{'Absolute' 'Incremental'});
+-			md = checkfield(md,'prognostic.stabilization','values',[0 1 2 3]);
+-			md = checkfield(md,'prognostic.min_thickness','>',0);
+-			if ~isempty(md.prognostic.requested_outputs),
+-				md = checkfield(md,'prognostic.requested_outputs','size',[NaN 1]);
+-			end
+-
+-		end % }}}
+-		function disp(obj) % {{{
+-			disp(sprintf('   Prognostic solution parameters:'));
+-			fielddisplay(obj,'spcthickness','thickness constraints (NaN means no constraint) [m]');
+-			fielddisplay(obj,'min_thickness','minimum ice thickness allowed [m]');
+-			fielddisplay(obj,'hydrostatic_adjustment','adjustment of ice shelves surface and bed elevations: ''Incremental'' or ''Absolute'' ');
+-			fielddisplay(obj,'stabilization','0: no, 1: artificial_diffusivity, 2: streamline upwinding, 3: discontinuous Galerkin');
+-
+-			disp(sprintf('\n      %s','Penalty options:'));
+-			fielddisplay(obj,'penalty_factor','offset used by penalties: penalty = Kmax*10^offset');
+-			fielddisplay(obj,'vertex_pairing','pairs of vertices that are penalized');
+-			fielddisplay(obj,'requested_outputs','additional outputs requested');
+-
+-		end % }}}
+-		function marshall(obj,md,fid) % {{{
+-			WriteData(fid,'object',obj,'fieldname','spcthickness','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
+-			WriteData(fid,'object',obj,'fieldname','min_thickness','format','Double');
+-			WriteData(fid,'data',StringToEnum(obj.hydrostatic_adjustment),'format','Integer','enum',PrognosticHydrostaticAdjustmentEnum());
+-			WriteData(fid,'object',obj,'fieldname','stabilization','format','Integer');
+-			WriteData(fid,'object',obj,'fieldname','vertex_pairing','format','DoubleMat','mattype',3);
+-			WriteData(fid,'object',obj,'fieldname','penalty_factor','format','Double');
+-			WriteData(fid,'object',obj,'fieldname','requested_outputs','format','DoubleMat','mattype',3);
+-		end % }}}
+-	end
+ end
+Index: ../trunk-jpl/src/m/classes/oldclasses/hydrology.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/oldclasses/hydrology.m	(revision 17078)
++++ ../trunk-jpl/src/m/classes/oldclasses/hydrology.m	(revision 17079)
+@@ -13,55 +13,4 @@
+ 		kn             = 0;
+ 		stabilization  = 0;
+ 	end
+-	methods
+-		function obj = hydrology(varargin) % {{{
+-			switch nargin
+-				case 0
+-					obj=setdefaultparameters(obj);
+-				otherwise
+-					error('constructor not supported');
+-			end
+-		end % }}}
+-		function obj = setdefaultparameters(obj) % {{{
+-
+-			%Parameters from Johnson's 2002 thesis, section 3.5.4			 
+-			obj.n=.02;			 
+-			obj.CR=.01;
+-			obj.p=2;		 
+-			obj.q=1;		 
+-			obj.kn=0;
+-
+-			%Type of stabilization to use 0:nothing 1:artificial_diffusivity
+-			obj.stabilization=1;
+-		end % }}}
+-		function md = checkconsistency(obj,md,solution,analyses) % {{{
+-
+-			%Early return
+-			if ~ismember(HydrologyAnalysisEnum(),analyses), return; end
+-
+-			md = checkfield(md,'hydrology.spcwatercolumn','forcing',1);
+-			md = checkfield(md,'hydrology.stabilization','>=',0);
+-		end % }}}
+-		function disp(obj) % {{{
+-			disp(sprintf('   hydrology solution parameters:'));
+-
+-			fielddisplay(obj,'spcwatercolumn','water thickness constraints (NaN means no constraint)');
+-			fielddisplay(obj,'n','Manning roughness coefficient');
+-			fielddisplay(obj,'CR','tortuosity parameter');
+-			fielddisplay(obj,'p','dimensionless exponent in Manning velocity formula');
+-			fielddisplay(obj,'q','dimensionless exponent in Manning velocity formula');
+-			fielddisplay(obj,'kn','parameter in effective pressure formula');
+-			fielddisplay(obj,'stabilization','artificial diffusivity (default is 1). can be more than 1 to increase diffusivity.');
+-
+-		end % }}}
+-		function marshall(obj,md,fid) % {{{
+-			WriteData(fid,'object',obj,'fieldname','spcwatercolumn','format','DoubleMat','mattype',1);
+-			WriteData(fid,'object',obj,'fieldname','n','format','Double');
+-			WriteData(fid,'object',obj,'fieldname','CR','format','Double');
+-			WriteData(fid,'object',obj,'fieldname','p','format','Double');
+-			WriteData(fid,'object',obj,'fieldname','q','format','Double');
+-			WriteData(fid,'object',obj,'fieldname','kn','format','Double');
+-			WriteData(fid,'object',obj,'fieldname','stabilization','format','Double');
+-		end % }}}
+-	end
+ end
+Index: ../trunk-jpl/src/m/classes/oldclasses/README
+===================================================================
+--- ../trunk-jpl/src/m/classes/oldclasses/README	(revision 17078)
++++ ../trunk-jpl/src/m/classes/oldclasses/README	(revision 17079)
+@@ -1,3 +1,4 @@
+ We put here all old classes so that matlab can still load old models
+ When an object is renamed or deleted, matlab is not able to load it
+-anymore. We keep it here so that matlab can load the object
++anymore. We keep it here so that matlab can load the object (just remove all
++methods)
+Index: ../trunk-jpl/src/m/classes/oldclasses/surfaceforcings.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/oldclasses/surfaceforcings.m	(revision 0)
++++ ../trunk-jpl/src/m/classes/oldclasses/surfaceforcings.m	(revision 17079)
+@@ -0,0 +1,26 @@
++%SURFACEFORCING Class definition
++%
++%   Usage:
++%      surfaceforcings=surfaceforcings();
++
++classdef surfaceforcings
++	properties (SetAccess=public) 
++		precipitation             = NaN;
++		mass_balance              = NaN;
++		ispdd                     = 0;
++		issmbgradients            = 0;
++		isdelta18o                = 0;
++		href                      = NaN;
++		smbref                    = NaN;
++		b_pos                     = NaN;
++		b_neg                     = NaN;
++		monthlytemperatures       = NaN;
++		delta18o                  = NaN;
++		delta18o_surface          = NaN;
++		temperatures_presentday   = NaN;
++		temperatures_lgm          = NaN;
++		precipitations_presentday = NaN;
++		desfac                    = 0.5;
++		s0p                       = 0;
++	end
++end
+Index: ../trunk-jpl/src/m/classes/transient.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/transient.m	(revision 17078)
++++ ../trunk-jpl/src/m/classes/transient.m	(revision 17079)
+@@ -5,13 +5,13 @@
+ 
+ classdef transient
+ 	properties (SetAccess=public) 
+-		ismasstransport      = 0;
+-		isstressbalance      = 0;
++		ismasstransport   = 0;
++		isstressbalance   = 0;
+ 		isthermal         = 0;
+ 		isgroundingline   = 0;
+ 		isgia             = 0;
+-		isdamage             = 0;
+-                islevelset = 0;
++		isdamage          = 0;
++		islevelset        = 0;
+ 		requested_outputs = {};
+ 	end
+ 	methods
+Index: ../trunk-jpl/src/m/classes/SMBgradients.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/SMBgradients.py	(revision 17078)
++++ ../trunk-jpl/src/m/classes/SMBgradients.py	(revision 17079)
+@@ -1,6 +1,7 @@
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+ from checkfield import *
++from project3d import *
+ from WriteData import *
+ 
+ class SMBgradients(object):
+@@ -28,6 +29,11 @@
+ 
+ 		return string
+ 		#}}}
++	def extrude(self,md): # {{{
++
++		#Nothing for now
++		return self
++	#}}}
+ 	def initialize(self,md): # {{{
+ 
+ 		#Nothing for now
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17078)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17079)
+@@ -103,6 +103,13 @@
+ 			if ~isa(md.outputdefinition,'outputdefinition'),
+ 				md.outputdefinition=outputdefinition();
+ 			end
++			%2014 January 9th
++			if isa(md.surfaceforcings,'surfaceforcings'),
++				disp('Recovering old surfaceforcings class');
++				mass_balance=md.surfaceforcings.mass_balance;
++				md.surfaceforcings=SMB();
++				md.surfaceforcings.mass_balance=mass_balance;
++			end
+ 		end% }}}
+ 	end
+ 	methods
+@@ -672,10 +679,8 @@
+ 			md.inversion.vy_obs=project3d(md,'vector',md.inversion.vy_obs,'type','node');
+ 			md.inversion.vel_obs=project3d(md,'vector',md.inversion.vel_obs,'type','node');
+ 			md.inversion.thickness_obs=project3d(md,'vector',md.inversion.thickness_obs,'type','node');
+-			md.surfaceforcings.mass_balance=project3d(md,'vector',md.surfaceforcings.mass_balance,'type','node');
+-			md.surfaceforcings.precipitation=project3d(md,'vector',md.surfaceforcings.precipitation,'type','node');
++			md.surfaceforcings = extrude(md.surfaceforcings,md);
+ 			md.balancethickness.thickening_rate=project3d(md,'vector',md.balancethickness.thickening_rate,'type','node');
+-			md.surfaceforcings.monthlytemperatures=project3d(md,'vector',md.surfaceforcings.monthlytemperatures,'type','node');
+ 
+ 			%results
+ 			if ~isnan(md.initialization.vx),md.initialization.vx=project3d(md,'vector',md.initialization.vx,'type','node');end;
+@@ -759,9 +764,6 @@
+ 			if ~isnan(md.inversion.min_parameters),md.inversion.min_parameters=project3d(md,'vector',md.inversion.min_parameters,'type','node');end;
+ 			if ~isnan(md.inversion.max_parameters),md.inversion.max_parameters=project3d(md,'vector',md.inversion.max_parameters,'type','node');end;
+ 			if ~isnan(md.qmu.partition),md.qmu.partition=project3d(md,'vector',md.qmu.partition','type','node');end
+-			if(md.surfaceforcings.isdelta18o),md.surfaceforcings.temperatures_lgm=project3d(md,'vector',md.surfaceforcings.temperatures_lgm,'type','node');end
+-			if(md.surfaceforcings.isdelta18o),md.surfaceforcings.temperatures_presentday=project3d(md,'vector',md.surfaceforcings.temperatures_presentday,'type','node');end
+-			if(md.surfaceforcings.isdelta18o),md.surfaceforcings.precipitations_presentday=project3d(md,'vector',md.surfaceforcings.precipitations_presentday,'type','node');end
+ 
+ 			%Put lithostatic pressure if there is an existing pressure
+ 			if ~isnan(md.initialization.pressure),
+@@ -1063,7 +1065,7 @@
+ 			md.constants        = constants();
+ 			md.geometry         = geometry();
+ 			md.initialization   = initialization();
+-			md.surfaceforcings  = surfaceforcings();
++			md.surfaceforcings  = SMB();
+ 			md.basalforcings    = basalforcings();
+ 			md.friction         = friction();
+ 			md.rifts            = rifts();
+@@ -1078,9 +1080,9 @@
+ 			md.toolkits         = toolkits();
+ 			md.cluster          = generic();
+ 			md.balancethickness = balancethickness();
+-			md.stressbalance       = stressbalance();
++			md.stressbalance    = stressbalance();
+ 			md.hydrology        = hydrologyshreve();
+-			md.masstransport       = masstransport();
++			md.masstransport    = masstransport();
+ 			md.thermal          = thermal();
+ 			md.steadystate      = steadystate();
+ 			md.transient        = transient();
Index: issm/oecreview/Archive/16554-17801/ISSM-17079-17080.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17079-17080.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17079-17080.diff	(revision 17802)
@@ -0,0 +1,120 @@
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17079)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17080)
+@@ -108,32 +108,6 @@
+ 			iomodel->FetchDataToInput(elements,SurfaceforcingsBPosEnum);
+ 			iomodel->FetchDataToInput(elements,SurfaceforcingsBNegEnum);
+ 			break;
+-		case SurfaceforcingsEnum: /*To Be REMOVED*/
+-			iomodel->Constant(&ispdd,SurfaceforcingsIspddEnum);
+-			iomodel->Constant(&isdelta18o,SurfaceforcingsIsdelta18oEnum);
+-			iomodel->Constant(&issmbgradients,SurfaceforcingsIssmbgradientsEnum);
+-			if(issmbgradients){
+-				iomodel->FetchDataToInput(elements,SurfaceforcingsHrefEnum);
+-				iomodel->FetchDataToInput(elements,SurfaceforcingsSmbrefEnum);
+-				iomodel->FetchDataToInput(elements,SurfaceforcingsBPosEnum);
+-				iomodel->FetchDataToInput(elements,SurfaceforcingsBNegEnum);
+-			}
+-			if(ispdd){
+-				iomodel->FetchDataToInput(elements,ThermalSpctemperatureEnum);
+-				if(isdelta18o){
+-					iomodel->FetchDataToInput(elements,SurfaceforcingsTemperaturesLgmEnum);
+-					iomodel->FetchDataToInput(elements,SurfaceforcingsTemperaturesPresentdayEnum);
+-					iomodel->FetchDataToInput(elements,SurfaceforcingsPrecipitationsPresentdayEnum);
+-				}
+-				else{
+-					iomodel->FetchDataToInput(elements,SurfaceforcingsPrecipitationEnum);
+-					iomodel->FetchDataToInput(elements,SurfaceforcingsMonthlytemperaturesEnum);
+-				}
+-			}
+-			if(~ispdd && ~issmbgradients){
+-				iomodel->FetchDataToInput(elements,SurfaceforcingsMassBalanceEnum,0.);
+-			}
+-			break;
+ 		default:
+ 			_error_("Surface mass balance model "<<EnumToStringx(smb_model)<<" not supported yet");
+ 	}
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17079)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17080)
+@@ -114,32 +114,6 @@
+ 		case SMBgradientsEnum:
+ 			/*Nothing to add to parameters*/
+ 			break;
+-		case SurfaceforcingsEnum: /*To Be REMOVED*/
+-			parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsIspddEnum));
+-			parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsIsdelta18oEnum));
+-			parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsIssmbgradientsEnum));
+-			iomodel->Constant(&ispdd,SurfaceforcingsIspddEnum);
+-			if(ispdd){
+-				parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsDesfacEnum));
+-				parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsS0pEnum));
+-				iomodel->Constant(&isdelta18o,SurfaceforcingsIsdelta18oEnum);
+-				if(isdelta18o){
+-					IssmDouble *temp = NULL;
+-					IssmDouble  yts;
+-					int         N,M;
+-					iomodel->Constant(&yts,ConstantsYtsEnum);
+-					iomodel->FetchData(&temp,&N,&M,SurfaceforcingsDelta18oEnum); _assert_(N==2);
+-					for(i=0;i<M;i++) temp[M+i]=yts*temp[M+i];
+-					parameters->AddObject(new TransientParam(SurfaceforcingsDelta18oEnum,&temp[0],&temp[M],M));
+-					iomodel->DeleteData(temp,SurfaceforcingsDelta18oEnum);
+-
+-					iomodel->FetchData(&temp,&N,&M,SurfaceforcingsDelta18oSurfaceEnum); _assert_(N==2);
+-					for(i=0;i<M;i++) temp[M+i]=yts*temp[M+i];
+-					parameters->AddObject(new TransientParam(SurfaceforcingsDelta18oSurfaceEnum,&temp[0],&temp[M],M));
+-					iomodel->DeleteData(temp,SurfaceforcingsDelta18oSurfaceEnum);
+-				}
+-			}
+-			break;
+ 		default:
+ 			_error_("Surface mass balance model "<<EnumToStringx(smb_model)<<" not supported yet");
+ 	}
+Index: ../trunk-jpl/src/c/cores/masstransport_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/masstransport_core.cpp	(revision 17079)
++++ ../trunk-jpl/src/c/cores/masstransport_core.cpp	(revision 17080)
+@@ -57,23 +57,6 @@
+ 			if(VerboseSolution())_printf_("	call smb gradients module\n\n");
+ 			SmbGradientsx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
+ 			break;
+-		case SurfaceforcingsEnum: /*To Be REMOVED*/
+-			femmodel->parameters->FindParam(&issmbgradients,SurfaceforcingsIssmbgradientsEnum);
+-			femmodel->parameters->FindParam(&ispdd,SurfaceforcingsIspddEnum);
+-			femmodel->parameters->FindParam(&isdelta18o,SurfaceforcingsIsdelta18oEnum);
+-			if(issmbgradients){
+-				if(VerboseSolution())_printf_("	call smb gradients module\n\n");
+-				SmbGradientsx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
+-			}
+-			if(ispdd){
+-				if(isdelta18o){
+-					if(VerboseSolution()) _printf0_("   call Delta18oParametrization module\n");
+-					Delta18oParameterizationx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
+-				} 
+-				if(VerboseSolution()) _printf0_("   call positive degree day module\n");
+-				PositiveDegreeDayx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
+-			}
+-			break;
+ 		default:
+ 			_error_("Surface mass balance model "<<EnumToStringx(smb_model)<<" not supported yet");
+ 	}
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 17079)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 17080)
+@@ -53,13 +53,6 @@
+ 		case SMBgradientsEnum:
+ 			/*Nothing to add*/
+ 			break;
+-		case SurfaceforcingsEnum: /*To Be REMOVED*/
+-			iomodel->Constant(&ispdd,SurfaceforcingsIspddEnum);
+-			if(ispdd){
+-				iomodel->Constant(&this->desfac,SurfaceforcingsDesfacEnum);
+-				iomodel->Constant(&this->s0p,SurfaceforcingsS0pEnum);
+-			}
+-			break;
+ 		default:
+ 			_error_("Surface mass balance model "<<EnumToStringx(smb_model)<<" not supported yet");
+ 	}
Index: issm/oecreview/Archive/16554-17801/ISSM-17080-17081.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17080-17081.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17080-17081.diff	(revision 17802)
@@ -0,0 +1,104 @@
+Index: ../trunk-jpl/test/NightlyRun/test328.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test328.m	(revision 17080)
++++ ../trunk-jpl/test/NightlyRun/test328.m	(revision 17081)
+@@ -2,7 +2,7 @@
+ md=setmask(md,'','');
+ md=parameterize(md,'../Par/SquareSheetConstrained.par');
+ md=setflowequation(md,'SSA','all');
+-md.surfaceforcings.issmbgradients=1;
++md.surfaceforcings = SMBgradients();
+ md.surfaceforcings.b_pos=-100. + 0.00005*md.mesh.x - 0.0001*md.mesh.y;
+ md.surfaceforcings.b_neg=250. + 0.000051*md.mesh.x - 0.00011*md.mesh.y;
+ md.surfaceforcings.href=md.geometry.surface;
+Index: ../trunk-jpl/test/NightlyRun/test329.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test329.py	(revision 17080)
++++ ../trunk-jpl/test/NightlyRun/test329.py	(revision 17081)
+@@ -14,7 +14,7 @@
+ md=parameterize(md,'../Par/SquareSheetConstrained.py')
+ md.extrude(3,1)
+ md=setflowequation(md,'HO','all')
+-md.surfaceforcings.issmbgradients=1
++md.surfaceforcings = SMBgradients();
+ md.surfaceforcings.b_pos=-100. + 0.00005*md.mesh.x - 0.0001*md.mesh.y
+ md.surfaceforcings.b_neg=250. + 0.000051*md.mesh.x - 0.00011*md.mesh.y
+ md.surfaceforcings.href=copy.deepcopy(md.geometry.surface).reshape(-1)
+Index: ../trunk-jpl/test/NightlyRun/test329.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test329.m	(revision 17080)
++++ ../trunk-jpl/test/NightlyRun/test329.m	(revision 17081)
+@@ -3,7 +3,7 @@
+ md=parameterize(md,'../Par/SquareSheetConstrained.par');
+ md=extrude(md,3,1.);
+ md=setflowequation(md,'HO','all');
+-md.surfaceforcings.issmbgradients=1;
++md.surfaceforcings = SMBgradients();
+ md.surfaceforcings.b_pos=-100. + 0.00005*md.mesh.x - 0.0001*md.mesh.y;
+ md.surfaceforcings.b_neg=250. + 0.000051*md.mesh.x - 0.00011*md.mesh.y;
+ md.surfaceforcings.href=md.geometry.surface;
+Index: ../trunk-jpl/test/NightlyRun/test236.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test236.py	(revision 17080)
++++ ../trunk-jpl/test/NightlyRun/test236.py	(revision 17081)
+@@ -12,7 +12,7 @@
+ md=setmask(md,'all','')
+ 
+ # Use of ispdd and isdelta18o methods
+-md.surfaceforcings.ispdd=1
++md.surfaceforcings = SMBpdd();
+ md.surfaceforcings.isdelta18o=1
+ 
+ md=parameterize(md,'../Par/SquareShelf.py')
+Index: ../trunk-jpl/test/NightlyRun/test237.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test237.py	(revision 17080)
++++ ../trunk-jpl/test/NightlyRun/test237.py	(revision 17081)
+@@ -12,7 +12,7 @@
+ md=setmask(md,'all','')
+ 
+ # Use of ispdd and isdelta18o methods
+-md.surfaceforcings.ispdd=1
++md.surfaceforcings = SMBpdd();
+ md.surfaceforcings.isdelta18o=1
+ 
+ md=parameterize(md,'../Par/SquareShelf.py')
+Index: ../trunk-jpl/test/NightlyRun/test236.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test236.m	(revision 17080)
++++ ../trunk-jpl/test/NightlyRun/test236.m	(revision 17081)
+@@ -2,7 +2,7 @@
+ md=setmask(md,'all','');
+ 
+ % Use of ispdd and isdelta18o methods
+-md.surfaceforcings.ispdd=1;
++md.surfaceforcings = SMBpdd();
+ md.surfaceforcings.isdelta18o=1;
+ 
+ md=parameterize(md,'../Par/SquareShelf.par');
+Index: ../trunk-jpl/test/NightlyRun/test237.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test237.m	(revision 17080)
++++ ../trunk-jpl/test/NightlyRun/test237.m	(revision 17081)
+@@ -2,7 +2,7 @@
+ md=setmask(md,'all','');
+ 
+ % Use of ispdd and isdelta18o methods
+-md.surfaceforcings.ispdd=1;
++md.surfaceforcings = SMBpdd();
+ md.surfaceforcings.isdelta18o=1;
+ 
+ md=parameterize(md,'../Par/SquareShelf.par');
+Index: ../trunk-jpl/test/NightlyRun/test328.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test328.py	(revision 17080)
++++ ../trunk-jpl/test/NightlyRun/test328.py	(revision 17081)
+@@ -13,7 +13,7 @@
+ md=setmask(md,'','')
+ md=parameterize(md,'../Par/SquareSheetConstrained.py')
+ md=setflowequation(md,'SSA','all')
+-md.surfaceforcings.issmbgradients=1
++md.surfaceforcings = SMBgradients();
+ md.surfaceforcings.b_pos=-100. + 0.00005*md.mesh.x - 0.0001*md.mesh.y
+ md.surfaceforcings.b_neg=250. + 0.000051*md.mesh.x - 0.00011*md.mesh.y
+ md.transient.requested_outputs=['default','TotalSmb']
Index: issm/oecreview/Archive/16554-17801/ISSM-17081-17082.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17081-17082.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17081-17082.diff	(revision 17802)
@@ -0,0 +1,53 @@
+Index: ../trunk-jpl/test/NightlyRun/test236.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test236.py	(revision 17081)
++++ ../trunk-jpl/test/NightlyRun/test236.py	(revision 17082)
+@@ -10,13 +10,12 @@
+ 
+ md=triangle(model(),'../Exp/Square.exp',150000.)
+ md=setmask(md,'all','')
++md=parameterize(md,'../Par/SquareShelf.py')
+ 
+ # Use of ispdd and isdelta18o methods
+ md.surfaceforcings = SMBpdd();
+ md.surfaceforcings.isdelta18o=1
+ 
+-md=parameterize(md,'../Par/SquareShelf.py')
+-
+ # Add temperature, precipitation and delta18o needed to measure the surface mass balance
+ # creating delta18o
+ delta18o=numpy.loadtxt('../Data/delta18o.data')
+@@ -56,6 +55,7 @@
+ md.timestepping.final_time=60.
+ 
+ # 
++md.transient.requested_outputs=['default','SurfaceforcingsMonthlytemperatures']
+ md=setflowequation(md,'SSA','all')
+ md.cluster=generic('name',oshostname(),'np',3)
+ md=solve(md,TransientSolutionEnum())
+Index: ../trunk-jpl/test/NightlyRun/test236.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test236.m	(revision 17081)
++++ ../trunk-jpl/test/NightlyRun/test236.m	(revision 17082)
+@@ -1,12 +1,11 @@
+ md=triangle(model(),'../Exp/Square.exp',150000.);
+ md=setmask(md,'all','');
++md=parameterize(md,'../Par/SquareShelf.par');
+ 
+ % Use of ispdd and isdelta18o methods
+ md.surfaceforcings = SMBpdd();
+ md.surfaceforcings.isdelta18o=1;
+ 
+-md=parameterize(md,'../Par/SquareShelf.par');
+-
+ % Add temperature, precipitation and delta18o needed to measure the surface mass balance
+ % creating delta18o
+ load '../Data/delta18o.data'
+@@ -45,6 +44,7 @@
+ md.timestepping.final_time=60;
+ 
+ % 
++md.transient.requested_outputs={'default','SurfaceforcingsMonthlytemperatures'};
+ md=setflowequation(md,'SSA','all');
+ md.cluster=generic('name',oshostname(),'np',3);
+ md=solve(md,TransientSolutionEnum());
Index: issm/oecreview/Archive/16554-17801/ISSM-17082-17083.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17082-17083.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17082-17083.diff	(revision 17802)
@@ -0,0 +1,40 @@
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17082)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17083)
+@@ -15,8 +15,12 @@
+ 	/*Now, is the model 3d? otherwise, do nothing: */
+ 	if (iomodel->meshtype==Mesh2DhorizontalEnum)return;
+ 
++	int smb_model;
+ 	int finiteelement = P1Enum;
+ 
++	/*Fetch data needed: */
++	iomodel->Constant(&smb_model,SurfaceforcingsEnum);
++
+ 	/*Update elements: */
+ 	int counter=0;
+ 	for(int i=0;i<iomodel->numberofelements;i++){
+@@ -29,7 +33,6 @@
+ 
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+-	iomodel->FetchDataToInput(elements,SurfaceforcingsMassBalanceEnum,0.);
+ 	iomodel->FetchDataToInput(elements,VxEnum);
+ 	iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+ 	if(iomodel->meshtype==Mesh3DEnum){
+@@ -37,6 +40,14 @@
+ 		iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
++	switch(smb_model){
++		case SMBEnum:
++			iomodel->FetchDataToInput(elements,SurfaceforcingsMassBalanceEnum,0.);
++			break;
++		default:
++			/*Nothing for now*/
++			;
++	}
+ }/*}}}*/
+ void FreeSurfaceTopAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17083-17084.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17083-17084.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17083-17084.diff	(revision 17802)
@@ -0,0 +1,24 @@
+Index: ../trunk-jpl/test/NightlyRun/test237.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test237.py	(revision 17083)
++++ ../trunk-jpl/test/NightlyRun/test237.py	(revision 17084)
+@@ -57,6 +57,7 @@
+ md.timestepping.final_time=60.
+ 
+ #
++md.transient.requested_outputs=['default','SurfaceforcingsMonthlytemperatures']
+ md.extrude(3,1.)
+ md=setflowequation(md,'SSA','all')
+ md.cluster=generic('name',oshostname(),'np',1)
+Index: ../trunk-jpl/test/NightlyRun/test237.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test237.m	(revision 17083)
++++ ../trunk-jpl/test/NightlyRun/test237.m	(revision 17084)
+@@ -46,6 +46,7 @@
+ md.timestepping.final_time=60;
+ 
+ %
++md.transient.requested_outputs={'default','SurfaceforcingsMonthlytemperatures'};
+ md=extrude(md,3,1.);
+ md=setflowequation(md,'SSA','all');
+ md.cluster=generic('name',oshostname(),'np',1);
Index: issm/oecreview/Archive/16554-17801/ISSM-17084-17085.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17084-17085.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17084-17085.diff	(revision 17802)
@@ -0,0 +1,1820 @@
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17084)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17085)
+@@ -108,6 +108,9 @@
+ 			iomodel->FetchDataToInput(elements,SurfaceforcingsBPosEnum);
+ 			iomodel->FetchDataToInput(elements,SurfaceforcingsBNegEnum);
+ 			break;
++		case SMBhenningEnum:
++			iomodel->FetchDataToInput(elements,SurfaceforcingsMassBalanceEnum,0.);
++			break;
+ 		default:
+ 			_error_("Surface mass balance model "<<EnumToStringx(smb_model)<<" not supported yet");
+ 	}
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17084)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17085)
+@@ -296,7 +296,7 @@
+ 	SurfaceforcingsSmbrefEnum,
+ 	SurfaceforcingsBPosEnum,
+ 	SurfaceforcingsBNegEnum,
+-	SMBlapserate,
++	SMBhenningEnum,
+ 	/*TO BE REMOVED*/
+ 	SurfaceforcingsIspddEnum,
+ 	SurfaceforcingsIssmbgradientsEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17084)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17085)
+@@ -300,6 +300,7 @@
+ 		case SurfaceforcingsSmbrefEnum : return "SurfaceforcingsSmbref";
+ 		case SurfaceforcingsBPosEnum : return "SurfaceforcingsBPos";
+ 		case SurfaceforcingsBNegEnum : return "SurfaceforcingsBNeg";
++		case SMBhenningEnum : return "SMBhenning";
+ 		case SurfaceforcingsIspddEnum : return "SurfaceforcingsIspdd";
+ 		case SurfaceforcingsIssmbgradientsEnum : return "SurfaceforcingsIssmbgradients";
+ 		case SolutionTypeEnum : return "SolutionType";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17084)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17085)
+@@ -306,6 +306,7 @@
+ 	      else if (strcmp(name,"SurfaceforcingsSmbref")==0) return SurfaceforcingsSmbrefEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsBPos")==0) return SurfaceforcingsBPosEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsBNeg")==0) return SurfaceforcingsBNegEnum;
++	      else if (strcmp(name,"SMBhenning")==0) return SMBhenningEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsIspdd")==0) return SurfaceforcingsIspddEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsIssmbgradients")==0) return SurfaceforcingsIssmbgradientsEnum;
+ 	      else if (strcmp(name,"SolutionType")==0) return SolutionTypeEnum;
+@@ -381,11 +382,11 @@
+ 	      else if (strcmp(name,"GenericParam")==0) return GenericParamEnum;
+ 	      else if (strcmp(name,"AdolcParam")==0) return AdolcParamEnum;
+ 	      else if (strcmp(name,"BoolInput")==0) return BoolInputEnum;
+-	      else if (strcmp(name,"BoolParam")==0) return BoolParamEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"Contour")==0) return ContourEnum;
++	      if (strcmp(name,"BoolParam")==0) return BoolParamEnum;
++	      else if (strcmp(name,"Contour")==0) return ContourEnum;
+ 	      else if (strcmp(name,"ControlInput")==0) return ControlInputEnum;
+ 	      else if (strcmp(name,"DatasetInput")==0) return DatasetInputEnum;
+ 	      else if (strcmp(name,"DoubleInput")==0) return DoubleInputEnum;
+@@ -504,11 +505,11 @@
+ 	      else if (strcmp(name,"Enthalpy")==0) return EnthalpyEnum;
+ 	      else if (strcmp(name,"EnthalpyPicard")==0) return EnthalpyPicardEnum;
+ 	      else if (strcmp(name,"ThicknessAbsGradient")==0) return ThicknessAbsGradientEnum;
+-	      else if (strcmp(name,"ThicknessAlongGradient")==0) return ThicknessAlongGradientEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"ThicknessAcrossGradient")==0) return ThicknessAcrossGradientEnum;
++	      if (strcmp(name,"ThicknessAlongGradient")==0) return ThicknessAlongGradientEnum;
++	      else if (strcmp(name,"ThicknessAcrossGradient")==0) return ThicknessAcrossGradientEnum;
+ 	      else if (strcmp(name,"IntMatParam")==0) return IntMatParamEnum;
+ 	      else if (strcmp(name,"RheologyBbarAbsGradient")==0) return RheologyBbarAbsGradientEnum;
+ 	      else if (strcmp(name,"DragCoefficientAbsGradient")==0) return DragCoefficientAbsGradientEnum;
+@@ -627,11 +628,11 @@
+ 	      else if (strcmp(name,"Verbose")==0) return VerboseEnum;
+ 	      else if (strcmp(name,"TriangleInterp")==0) return TriangleInterpEnum;
+ 	      else if (strcmp(name,"BilinearInterp")==0) return BilinearInterpEnum;
+-	      else if (strcmp(name,"NearestInterp")==0) return NearestInterpEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"XY")==0) return XYEnum;
++	      if (strcmp(name,"NearestInterp")==0) return NearestInterpEnum;
++	      else if (strcmp(name,"XY")==0) return XYEnum;
+ 	      else if (strcmp(name,"XYZ")==0) return XYZEnum;
+ 	      else if (strcmp(name,"Dense")==0) return DenseEnum;
+ 	      else if (strcmp(name,"MpiDense")==0) return MpiDenseEnum;
+Index: ../trunk-jpl/src/c/modules/modules.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/modules.h	(revision 17084)
++++ ../trunk-jpl/src/c/modules/modules.h	(revision 17085)
+@@ -23,7 +23,6 @@
+ #include "./ControlInputScaleGradientx/ControlInputScaleGradientx.h"
+ #include "./CreateNodalConstraintsx/CreateNodalConstraintsx.h"
+ #include "./CreateJacobianMatrixx/CreateJacobianMatrixx.h"
+-#include "./Delta18oParameterizationx/Delta18oParameterizationx.h"
+ #include "./DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.h"
+ #include "./ElementConnectivityx/ElementConnectivityx.h"
+ #include "./EdgeDetectionx/EdgeDetectionx.h"
+@@ -74,7 +73,6 @@
+ #include "./OutputResultsx/OutputResultsx.h"
+ #include "./ConstraintsStatex/ConstraintsStatex.h"
+ #include "./PointCloudFindNeighborsx/PointCloudFindNeighborsx.h"
+-#include "./PositiveDegreeDayx/PositiveDegreeDayx.h"
+ #include "./PropagateFlagsFromConnectivityx/PropagateFlagsFromConnectivityx.h"
+ #include "./Reduceloadx/Reduceloadx.h"
+ #include "./Reducevectorgtosx/Reducevectorgtosx.h"
+@@ -84,7 +82,7 @@
+ #include "./RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.h"
+ #include "./Scotchx/Scotchx.h"
+ #include "./Shp2Kmlx/Shp2Kmlx.h"
+-#include "./SmbGradientsx/SmbGradientsx.h"
++#include "./SurfaceMassBalancex/SurfaceMassBalancex.h"
+ #include "./Solverx/Solverx.h"
+ #include "./SystemMatricesx/SystemMatricesx.h"
+ #include "./SpcNodesx/SpcNodesx.h"
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17084)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17085)
+@@ -114,6 +114,9 @@
+ 		case SMBgradientsEnum:
+ 			/*Nothing to add to parameters*/
+ 			break;
++		case SMBhenningEnum:
++			/*Nothing to add to parameters*/
++			break;
+ 		default:
+ 			_error_("Surface mass balance model "<<EnumToStringx(smb_model)<<" not supported yet");
+ 	}
+Index: ../trunk-jpl/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.h	(revision 0)
++++ ../trunk-jpl/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.h	(revision 17085)
+@@ -0,0 +1,17 @@
++/*!\file:  SurfaceMassBalancex.h
++ * \brief header file for SMB
++ */ 
++
++#ifndef _SurfaceMassBalancex_H
++#define _SurfaceMassBalancex_H
++
++#include "../../classes/classes.h"
++
++/* local prototypes: */
++void SurfaceMassBalancex(FemModel* femmodel);
++void SmbGradientsx(FemModel* femmodel);
++void Delta18oParameterizationx(FemModel* femmodel);
++void PositiveDegreeDayx(FemModel* femmodel);
++void SmbHenningx(FemModel* femmodel);
++
++#endif  /* _SurfaceMassBalancex_H*/
+Index: ../trunk-jpl/src/c/modules/SurfaceMassBalancex/.deps/libISSMCore_a-SurfaceMassBalancex.Po
+===================================================================
+--- ../trunk-jpl/src/c/modules/SurfaceMassBalancex/.deps/libISSMCore_a-SurfaceMassBalancex.Po	(revision 0)
++++ ../trunk-jpl/src/c/modules/SurfaceMassBalancex/.deps/libISSMCore_a-SurfaceMassBalancex.Po	(revision 17085)
+@@ -0,0 +1,1384 @@
++modules/SurfaceMassBalancex/libISSMCore_a-SurfaceMassBalancex.o: \
++ modules/SurfaceMassBalancex/SurfaceMassBalancex.cpp \
++ modules/SurfaceMassBalancex/./SurfaceMassBalancex.h \
++ modules/SurfaceMassBalancex/./../../classes/classes.h \
++ modules/SurfaceMassBalancex/./../../classes/./Contour.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/shared.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./MemOps/MemOps.h \
++ /usr/include/c++/4.6/cassert /usr/include/assert.h \
++ /usr/include/features.h /usr/include/x86_64-linux-gnu/bits/predefs.h \
++ /usr/include/x86_64-linux-gnu/sys/cdefs.h \
++ /usr/include/x86_64-linux-gnu/bits/wordsize.h \
++ /usr/include/x86_64-linux-gnu/gnu/stubs.h \
++ /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Bamg/shared.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Bamg/Abs.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Bamg/BigPrimeNumber.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Bamg/BinaryRand.h \
++ /usr/include/c++/4.6/cstdlib \
++ /usr/include/c++/4.6/x86_64-linux-gnu/./bits/c++config.h \
++ /usr/include/c++/4.6/x86_64-linux-gnu/./bits/os_defines.h \
++ /usr/include/c++/4.6/x86_64-linux-gnu/./bits/cpu_defines.h \
++ /usr/include/stdlib.h /usr/lib/gcc/x86_64-linux-gnu/4.6/include/stddef.h \
++ /usr/include/x86_64-linux-gnu/bits/waitflags.h \
++ /usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \
++ /usr/include/x86_64-linux-gnu/bits/endian.h \
++ /usr/include/x86_64-linux-gnu/bits/byteswap.h /usr/include/xlocale.h \
++ /usr/include/x86_64-linux-gnu/sys/types.h \
++ /usr/include/x86_64-linux-gnu/bits/types.h \
++ /usr/include/x86_64-linux-gnu/bits/typesizes.h /usr/include/time.h \
++ /usr/include/x86_64-linux-gnu/sys/select.h \
++ /usr/include/x86_64-linux-gnu/bits/select.h \
++ /usr/include/x86_64-linux-gnu/bits/sigset.h \
++ /usr/include/x86_64-linux-gnu/bits/time.h \
++ /usr/include/x86_64-linux-gnu/bits/select2.h \
++ /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
++ /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \
++ /usr/include/x86_64-linux-gnu/bits/stdlib.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Bamg/Exchange.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Bamg/extrema.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Bamg/HeapSort.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Bamg/OppositeAngle.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Bamg/../Numerics/constants.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Elements/elements.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Elements/../Numerics/types.h \
++ ../.././config.h /usr/include/stdio.h /usr/include/libio.h \
++ /usr/include/_G_config.h /usr/include/wchar.h \
++ /usr/lib/gcc/x86_64-linux-gnu/4.6/include/stdarg.h \
++ /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \
++ /usr/include/x86_64-linux-gnu/bits/sys_errlist.h \
++ /usr/include/x86_64-linux-gnu/bits/stdio.h \
++ /usr/include/x86_64-linux-gnu/bits/stdio2.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Enum/Enum.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Enum/./EnumDefinitions.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Exceptions/exceptions.h \
++ /usr/include/c++/4.6/exception /usr/include/c++/4.6/string \
++ /usr/include/c++/4.6/bits/stringfwd.h \
++ /usr/include/c++/4.6/bits/char_traits.h \
++ /usr/include/c++/4.6/bits/stl_algobase.h \
++ /usr/include/c++/4.6/bits/functexcept.h \
++ /usr/include/c++/4.6/bits/exception_defines.h \
++ /usr/include/c++/4.6/bits/cpp_type_traits.h \
++ /usr/include/c++/4.6/ext/type_traits.h \
++ /usr/include/c++/4.6/ext/numeric_traits.h \
++ /usr/include/c++/4.6/bits/stl_pair.h /usr/include/c++/4.6/bits/move.h \
++ /usr/include/c++/4.6/bits/concept_check.h \
++ /usr/include/c++/4.6/bits/stl_iterator_base_types.h \
++ /usr/include/c++/4.6/bits/stl_iterator_base_funcs.h \
++ /usr/include/c++/4.6/bits/stl_iterator.h \
++ /usr/include/c++/4.6/debug/debug.h /usr/include/c++/4.6/bits/postypes.h \
++ /usr/include/c++/4.6/cwchar /usr/include/x86_64-linux-gnu/bits/wchar.h \
++ /usr/include/x86_64-linux-gnu/bits/wchar2.h \
++ /usr/include/c++/4.6/bits/allocator.h \
++ /usr/include/c++/4.6/x86_64-linux-gnu/./bits/c++allocator.h \
++ /usr/include/c++/4.6/ext/new_allocator.h /usr/include/c++/4.6/new \
++ /usr/include/c++/4.6/bits/localefwd.h \
++ /usr/include/c++/4.6/x86_64-linux-gnu/./bits/c++locale.h \
++ /usr/include/c++/4.6/clocale /usr/include/locale.h \
++ /usr/include/x86_64-linux-gnu/bits/locale.h /usr/include/c++/4.6/iosfwd \
++ /usr/include/c++/4.6/cctype /usr/include/ctype.h \
++ /usr/include/c++/4.6/bits/ostream_insert.h \
++ /usr/include/c++/4.6/bits/cxxabi_forced.h \
++ /usr/include/c++/4.6/bits/stl_function.h \
++ /usr/include/c++/4.6/backward/binders.h \
++ /usr/include/c++/4.6/bits/range_access.h \
++ /usr/include/c++/4.6/bits/basic_string.h \
++ /usr/include/c++/4.6/ext/atomicity.h \
++ /usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr.h \
++ /usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr-default.h \
++ /usr/include/pthread.h /usr/include/sched.h \
++ /usr/include/x86_64-linux-gnu/bits/sched.h \
++ /usr/include/x86_64-linux-gnu/bits/timex.h \
++ /usr/include/x86_64-linux-gnu/bits/setjmp.h /usr/include/unistd.h \
++ /usr/include/x86_64-linux-gnu/bits/posix_opt.h \
++ /usr/include/x86_64-linux-gnu/bits/environments.h \
++ /usr/include/x86_64-linux-gnu/bits/confname.h /usr/include/getopt.h \
++ /usr/include/x86_64-linux-gnu/bits/unistd.h \
++ /usr/include/c++/4.6/x86_64-linux-gnu/./bits/atomic_word.h \
++ /usr/include/c++/4.6/initializer_list \
++ /usr/include/c++/4.6/bits/basic_string.tcc /usr/include/c++/4.6/iostream \
++ /usr/include/c++/4.6/ostream /usr/include/c++/4.6/ios \
++ /usr/include/c++/4.6/bits/ios_base.h \
++ /usr/include/c++/4.6/bits/locale_classes.h \
++ /usr/include/c++/4.6/bits/locale_classes.tcc \
++ /usr/include/c++/4.6/streambuf /usr/include/c++/4.6/bits/streambuf.tcc \
++ /usr/include/c++/4.6/bits/basic_ios.h \
++ /usr/include/c++/4.6/bits/locale_facets.h /usr/include/c++/4.6/cwctype \
++ /usr/include/wctype.h \
++ /usr/include/c++/4.6/x86_64-linux-gnu/./bits/ctype_base.h \
++ /usr/include/c++/4.6/bits/streambuf_iterator.h \
++ /usr/include/c++/4.6/x86_64-linux-gnu/./bits/ctype_inline.h \
++ /usr/include/c++/4.6/bits/locale_facets.tcc \
++ /usr/include/c++/4.6/bits/basic_ios.tcc \
++ /usr/include/c++/4.6/bits/ostream.tcc /usr/include/c++/4.6/istream \
++ /usr/include/c++/4.6/bits/istream.tcc /usr/include/c++/4.6/sstream \
++ /usr/include/c++/4.6/bits/sstream.tcc /usr/include/c++/4.6/iomanip \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./io/io.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./io/./Disk/diskio.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./io/./Print/Print.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./io/./Comm/IssmComm.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./io/./Comm/../../../toolkits/mpi/issmmpi.h \
++ /usr/include/c++/4.6/cstddef \
++ /u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/mpich/install/include/mpi.h \
++ /u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/mpich/install/include/mpio.h \
++ /u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/mpich/install/include/mpi.h \
++ /u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/mpich/install/include/mpicxx.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./io/./Comm/../../../toolkits/mpi/./commops/commops.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./io/./Comm/../../../toolkits/mpi/./commops/../../../shared/Numerics/types.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./io/./Comm/../../../toolkits/mpi/./commops/../../../shared/io/Comm/IssmComm.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./io/./Comm/../../../toolkits/mpi/./commops/../../mpi/issmmpi.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Exp/exp.h \
++ /usr/include/c++/4.6/cstring /usr/include/string.h \
++ /usr/include/x86_64-linux-gnu/bits/string3.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Exp/../Numerics/recast.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Exp/../Exceptions/exceptions.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Exp/../MemOps/MemOps.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Matrix/matrix.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Matrix/../Numerics/types.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Numerics/numerics.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Numerics/./Verbosity.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Numerics/./GaussPoints.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Numerics/./../../shared/Numerics/types.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Numerics/./isnan.h \
++ /usr/include/math.h /usr/include/x86_64-linux-gnu/bits/huge_val.h \
++ /usr/include/x86_64-linux-gnu/bits/huge_valf.h \
++ /usr/include/x86_64-linux-gnu/bits/huge_vall.h \
++ /usr/include/x86_64-linux-gnu/bits/inf.h \
++ /usr/include/x86_64-linux-gnu/bits/nan.h \
++ /usr/include/x86_64-linux-gnu/bits/mathdef.h \
++ /usr/include/x86_64-linux-gnu/bits/mathcalls.h \
++ /usr/include/x86_64-linux-gnu/bits/mathinline.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Numerics/./recast.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Numerics/./types.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Numerics/./constants.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Numerics/./OptArgs.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Numerics/./OptPars.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Numerics/././types.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Sorting/sorting.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./String/sharedstring.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./Threads/issm_threads.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./TriMesh/trimesh.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/./LatLong/latlong.h \
++ modules/SurfaceMassBalancex/./../../classes/./../datastructures/datastructures.h \
++ modules/SurfaceMassBalancex/./../../classes/./../datastructures/./DataSet.h \
++ /usr/include/c++/4.6/vector /usr/include/c++/4.6/bits/stl_construct.h \
++ /usr/include/c++/4.6/bits/stl_uninitialized.h \
++ /usr/include/c++/4.6/bits/stl_vector.h \
++ /usr/include/c++/4.6/bits/stl_bvector.h \
++ /usr/include/c++/4.6/bits/vector.tcc \
++ modules/SurfaceMassBalancex/./../../classes/./../datastructures/./Object.h \
++ modules/SurfaceMassBalancex/./../../classes/./Vertices.h \
++ modules/SurfaceMassBalancex/./../../classes/./Vertex.h \
++ modules/SurfaceMassBalancex/./../../classes/././classes.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/Exceptions/exceptions.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/toolkits.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./petsc/petscincludes.h \
++ /u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscmat.h \
++ /u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscvec.h \
++ /u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscis.h \
++ /u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscsys.h \
++ /u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscconf.h \
++ /u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscfix.h \
++ /u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscversion.h \
++ /u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscmath.h \
++ /u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscerror.h \
++ /u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscviewertypes.h \
++ /u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscoptions.h \
++ /u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petsclog.h \
++ /u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscsys.h \
++ /usr/include/memory.h \
++ /usr/lib/gcc/x86_64-linux-gnu/4.6/include/xmmintrin.h \
++ /usr/lib/gcc/x86_64-linux-gnu/4.6/include/mmintrin.h \
++ /usr/lib/gcc/x86_64-linux-gnu/4.6/include/mm_malloc.h \
++ /usr/lib/gcc/x86_64-linux-gnu/4.6/include/emmintrin.h \
++ /usr/lib/gcc/x86_64-linux-gnu/4.6/include/stdint.h /usr/include/stdint.h \
++ /usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed/limits.h \
++ /usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed/syslimits.h \
++ /usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \
++ /usr/include/x86_64-linux-gnu/bits/local_lim.h \
++ /usr/include/linux/limits.h \
++ /usr/include/x86_64-linux-gnu/bits/posix2_lim.h \
++ /usr/include/x86_64-linux-gnu/bits/xopen_lim.h \
++ /usr/include/x86_64-linux-gnu/sys/param.h /usr/include/linux/param.h \
++ /usr/include/x86_64-linux-gnu/asm/param.h \
++ /usr/include/asm-generic/param.h \
++ /u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscsftypes.h \
++ /u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscviewer.h \
++ /u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscksp.h \
++ /u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscpc.h \
++ /u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscdmtypes.h \
++ /u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscdrawtypes.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./petsc/patches/petscpatches.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./petsc/patches/./SolverEnum.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./petsc/patches/../../toolkitsenums.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./petsc/patches/../../../shared/io/Comm/IssmComm.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./petsc/objects/petscobjects.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./petsc/objects/./PetscMat.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./petsc/objects/./../petscincludes.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./petsc/objects/./../../../shared/Numerics/types.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./petsc/objects/./PetscVec.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./petsc/objects/./PetscSolver.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./mpi/issmmpi.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./metis/metisincludes.h \
++ /u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/metis.h \
++ /usr/include/inttypes.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./metis/patches/metispatches.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./triangle/triangleincludes.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/toolkitobjects.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./Vector.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../../shared/Enum/Enum.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../petsc/petscincludes.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/issmtoolkit.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./IssmAbsMat.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./../toolkitsenums.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./../../shared/Numerics/types.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./IssmAbsVec.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./IssmDenseMat.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/././IssmSeqVec.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/././../../shared/shared.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./../../shared/shared.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./../gsl/gslincludes.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./../gsl/../../shared/Numerics/types.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./IssmMat.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./../ToolkitOptions.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/././IssmToolkitUtils.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./IssmSeqVec.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./IssmVec.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./../../shared/Enum/Enum.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./../../shared/Exceptions/exceptions.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./../../shared/MemOps/MemOps.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./IssmSolver.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./IssmMpiDenseMat.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./../../datastructures/datastructures.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./../mumps/mumpsincludes.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./../mumps/../../shared/Numerics/types.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/././Bucket.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/././../../datastructures/datastructures.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/././../toolkitsenums.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/././IssmMpiVec.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/././../../shared/Exceptions/exceptions.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/././../../shared/MemOps/MemOps.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/././../../shared/io/io.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/././../mpi/issmmpi.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./IssmMpiSparseMat.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/././SparseRow.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./IssmMpiVec.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./Matrix.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./Solver.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/././Matrix.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/././Vector.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./toolkitsenums.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./issm/issmtoolkit.h \
++ modules/SurfaceMassBalancex/./../../classes/./../toolkits/./ToolkitOptions.h \
++ modules/SurfaceMassBalancex/./../../classes/./Nodes.h \
++ modules/SurfaceMassBalancex/./../../classes/./Contours.h \
++ modules/SurfaceMassBalancex/./../../classes/././Contour.h \
++ modules/SurfaceMassBalancex/./../../classes/./Node.h \
++ modules/SurfaceMassBalancex/./../../classes/././DofIndexing.h \
++ modules/SurfaceMassBalancex/./../../classes/././../shared/Numerics/types.h \
++ modules/SurfaceMassBalancex/./../../classes/././Update.h \
++ modules/SurfaceMassBalancex/./../../classes/././../shared/shared.h \
++ modules/SurfaceMassBalancex/./../../classes/./Profiler.h \
++ modules/SurfaceMassBalancex/./../../classes/./DependentObject.h \
++ modules/SurfaceMassBalancex/./../../classes/./IndependentObject.h \
++ modules/SurfaceMassBalancex/./../../classes/./Segment.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/Numerics/constants.h \
++ modules/SurfaceMassBalancex/./../../classes/./Massfluxatgate.h \
++ modules/SurfaceMassBalancex/./../../classes/././Definition.h \
++ modules/SurfaceMassBalancex/./../../classes/././Elements/Element.h \
++ modules/SurfaceMassBalancex/./../../classes/././Elements/../../datastructures/datastructures.h \
++ modules/SurfaceMassBalancex/./../../classes/././Elements/../../toolkits/toolkits.h \
++ modules/SurfaceMassBalancex/./../../classes/././Elements/../Update.h \
++ modules/SurfaceMassBalancex/./../../classes/././Elements/Elements.h \
++ modules/SurfaceMassBalancex/./../../classes/././FemModel.h \
++ modules/SurfaceMassBalancex/./../../classes/././../toolkits/toolkits.h \
++ modules/SurfaceMassBalancex/./../../classes/./Misfit.h \
++ modules/SurfaceMassBalancex/./../../classes/./../modules/SurfaceAreax/SurfaceAreax.h \
++ modules/SurfaceMassBalancex/./../../classes/./../modules/SurfaceAreax/../../shared/shared.h \
++ modules/SurfaceMassBalancex/./../../classes/./../classes/Params/Parameters.h \
++ modules/SurfaceMassBalancex/./../../classes/./../classes/Params/../../datastructures/datastructures.h \
++ modules/SurfaceMassBalancex/./../../classes/./../classes/Params/../../shared/shared.h \
++ modules/SurfaceMassBalancex/./../../classes/./Constraints/Constraints.h \
++ modules/SurfaceMassBalancex/./../../classes/./Constraints/../../datastructures/datastructures.h \
++ modules/SurfaceMassBalancex/./../../classes/./Constraints/../../shared/shared.h \
++ modules/SurfaceMassBalancex/./../../classes/./Constraints/Constraint.h \
++ modules/SurfaceMassBalancex/./../../classes/./Constraints/../../toolkits/toolkits.h \
++ modules/SurfaceMassBalancex/./../../classes/./Constraints/SpcStatic.h \
++ modules/SurfaceMassBalancex/./../../classes/./Constraints/SpcTransient.h \
++ modules/SurfaceMassBalancex/./../../classes/./Constraints/SpcDynamic.h \
++ modules/SurfaceMassBalancex/./../../classes/./Loads/Loads.h \
++ modules/SurfaceMassBalancex/./../../classes/./Loads/../../datastructures/datastructures.h \
++ modules/SurfaceMassBalancex/./../../classes/./Loads/Load.h \
++ modules/SurfaceMassBalancex/./../../classes/./Loads/../Update.h \
++ modules/SurfaceMassBalancex/./../../classes/./Loads/Friction.h \
++ modules/SurfaceMassBalancex/./../../classes/./Loads/Numericalflux.h \
++ modules/SurfaceMassBalancex/./../../classes/./Loads/./Load.h \
++ modules/SurfaceMassBalancex/./../../classes/./Loads/Riftfront.h \
++ modules/SurfaceMassBalancex/./../../classes/./Loads/Penpair.h \
++ modules/SurfaceMassBalancex/./../../classes/./Loads/../Node.h \
++ modules/SurfaceMassBalancex/./../../classes/./Loads/../Elements/Element.h \
++ modules/SurfaceMassBalancex/./../../classes/./Loads/Pengrid.h \
++ modules/SurfaceMassBalancex/./../../classes/./Elements/Elements.h \
++ modules/SurfaceMassBalancex/./../../classes/./Elements/Element.h \
++ modules/SurfaceMassBalancex/./../../classes/./Elements/Penta.h \
++ modules/SurfaceMassBalancex/./../../classes/./Elements/./Element.h \
++ modules/SurfaceMassBalancex/./../../classes/./Elements/./ElementHook.h \
++ modules/SurfaceMassBalancex/./../../classes/./Elements/./PentaRef.h \
++ modules/SurfaceMassBalancex/./../../classes/./Elements/../../shared/Exceptions/exceptions.h \
++ modules/SurfaceMassBalancex/./../../classes/./Elements/../../shared/Enum/Enum.h \
++ modules/SurfaceMassBalancex/./../../classes/./Elements/PentaRef.h \
++ modules/SurfaceMassBalancex/./../../classes/./Elements/Seg.h \
++ modules/SurfaceMassBalancex/./../../classes/./Elements/./SegRef.h \
++ modules/SurfaceMassBalancex/./../../classes/./Elements/SegRef.h \
++ modules/SurfaceMassBalancex/./../../classes/./Elements/Tria.h \
++ modules/SurfaceMassBalancex/./../../classes/./Elements/./TriaRef.h \
++ modules/SurfaceMassBalancex/./../../classes/./Elements/TriaRef.h \
++ modules/SurfaceMassBalancex/./../../classes/./Elements/ElementHook.h \
++ modules/SurfaceMassBalancex/./../../classes/./Options/Option.h \
++ modules/SurfaceMassBalancex/./../../classes/./Options/../../shared/shared.h \
++ modules/SurfaceMassBalancex/./../../classes/./Options/../../datastructures/datastructures.h \
++ modules/SurfaceMassBalancex/./../../classes/./Options/Options.h \
++ modules/SurfaceMassBalancex/./../../classes/./Options/./GenericOption.h \
++ modules/SurfaceMassBalancex/./../../classes/./Options/./../../shared/shared.h \
++ modules/SurfaceMassBalancex/./../../classes/./Options/./../../datastructures/datastructures.h \
++ modules/SurfaceMassBalancex/./../../classes/./Options/././OptionUtilities.h \
++ modules/SurfaceMassBalancex/./../../classes/./Options/././../../shared/Exceptions/exceptions.h \
++ modules/SurfaceMassBalancex/./../../classes/./Options/././../../shared/Enum/Enum.h \
++ modules/SurfaceMassBalancex/./../../classes/./Options/./././Option.h \
++ modules/SurfaceMassBalancex/./../../classes/./Options/GenericOption.h \
++ modules/SurfaceMassBalancex/./../../classes/./Options/OptionUtilities.h \
++ modules/SurfaceMassBalancex/./../../classes/./Inputs/Inputs.h \
++ modules/SurfaceMassBalancex/./../../classes/./Inputs/../../datastructures/datastructures.h \
++ modules/SurfaceMassBalancex/./../../classes/./Inputs/../../shared/shared.h \
++ modules/SurfaceMassBalancex/./../../classes/./Inputs/Input.h \
++ modules/SurfaceMassBalancex/./../../classes/./Inputs/BoolInput.h \
++ modules/SurfaceMassBalancex/./../../classes/./Inputs/./Input.h \
++ modules/SurfaceMassBalancex/./../../classes/./Inputs/DoubleInput.h \
++ modules/SurfaceMassBalancex/./../../classes/./Inputs/IntInput.h \
++ modules/SurfaceMassBalancex/./../../classes/./Inputs/PentaInput.h \
++ modules/SurfaceMassBalancex/./../../classes/./Inputs/../Elements/PentaRef.h \
++ modules/SurfaceMassBalancex/./../../classes/./Inputs/TriaInput.h \
++ modules/SurfaceMassBalancex/./../../classes/./Inputs/../Elements/TriaRef.h \
++ modules/SurfaceMassBalancex/./../../classes/./Inputs/SegInput.h \
++ modules/SurfaceMassBalancex/./../../classes/./Inputs/../Elements/SegRef.h \
++ modules/SurfaceMassBalancex/./../../classes/./Inputs/ControlInput.h \
++ modules/SurfaceMassBalancex/./../../classes/./Inputs/DatasetInput.h \
++ modules/SurfaceMassBalancex/./../../classes/./Inputs/TransientInput.h \
++ modules/SurfaceMassBalancex/./../../classes/./ExternalResults/Results.h \
++ modules/SurfaceMassBalancex/./../../classes/./ExternalResults/../../datastructures/datastructures.h \
++ modules/SurfaceMassBalancex/./../../classes/./ExternalResults/ExternalResult.h \
++ modules/SurfaceMassBalancex/./../../classes/./ExternalResults/../Node.h \
++ modules/SurfaceMassBalancex/./../../classes/./ExternalResults/GenericExternalResult.h \
++ modules/SurfaceMassBalancex/./../../classes/./ExternalResults/./ExternalResult.h \
++ modules/SurfaceMassBalancex/./../../classes/./ExternalResults/../../shared/shared.h \
++ modules/SurfaceMassBalancex/./../../classes/./Materials/Materials.h \
++ modules/SurfaceMassBalancex/./../../classes/./Materials/../../datastructures/datastructures.h \
++ modules/SurfaceMassBalancex/./../../classes/./Materials/Material.h \
++ modules/SurfaceMassBalancex/./../../classes/./Materials/../Update.h \
++ modules/SurfaceMassBalancex/./../../classes/./Materials/Matice.h \
++ modules/SurfaceMassBalancex/./../../classes/./Materials/./Material.h \
++ modules/SurfaceMassBalancex/./../../classes/./Materials/../Hook.h \
++ modules/SurfaceMassBalancex/./../../classes/./Materials/../../datastructures/datastructures.h \
++ modules/SurfaceMassBalancex/./../../classes/./Materials/Matpar.h \
++ modules/SurfaceMassBalancex/./../../classes/./Params/GenericParam.h \
++ modules/SurfaceMassBalancex/./../../classes/./Params/./Param.h \
++ modules/SurfaceMassBalancex/./../../classes/./Params/./../../datastructures/datastructures.h \
++ modules/SurfaceMassBalancex/./../../classes/./Params/./../Node.h \
++ modules/SurfaceMassBalancex/./../../classes/./Params/../../shared/shared.h \
++ modules/SurfaceMassBalancex/./../../classes/./Params/BoolParam.h \
++ modules/SurfaceMassBalancex/./../../classes/./Params/DoubleMatParam.h \
++ modules/SurfaceMassBalancex/./../../classes/./Params/DoubleTransientMatParam.h \
++ modules/SurfaceMassBalancex/./../../classes/./Params/DoubleMatArrayParam.h \
++ modules/SurfaceMassBalancex/./../../classes/./Params/DoubleParam.h \
++ modules/SurfaceMassBalancex/./../../classes/./Params/DoubleVecParam.h \
++ modules/SurfaceMassBalancex/./../../classes/./Params/IntParam.h \
++ modules/SurfaceMassBalancex/./../../classes/./Params/IntVecParam.h \
++ modules/SurfaceMassBalancex/./../../classes/./Params/IntMatParam.h \
++ modules/SurfaceMassBalancex/./../../classes/./Params/FileParam.h \
++ modules/SurfaceMassBalancex/./../../classes/./Params/Parameters.h \
++ modules/SurfaceMassBalancex/./../../classes/./Params/Param.h \
++ modules/SurfaceMassBalancex/./../../classes/./Params/MatrixParam.h \
++ modules/SurfaceMassBalancex/./../../classes/./Params/VectorParam.h \
++ modules/SurfaceMassBalancex/./../../classes/./Params/StringArrayParam.h \
++ modules/SurfaceMassBalancex/./../../classes/./Params/StringParam.h \
++ modules/SurfaceMassBalancex/./../../classes/./Params/TransientParam.h \
++ modules/SurfaceMassBalancex/./../../classes/./Params/DataSetParam.h \
++ modules/SurfaceMassBalancex/./../../classes/./matrix/matrixobjects.h \
++ modules/SurfaceMassBalancex/./../../classes/./matrix/./ElementMatrix.h \
++ modules/SurfaceMassBalancex/./../../classes/./matrix/./../../datastructures/datastructures.h \
++ modules/SurfaceMassBalancex/./../../classes/./matrix/./../../toolkits/toolkits.h \
++ modules/SurfaceMassBalancex/./../../classes/./matrix/./../../shared/shared.h \
++ modules/SurfaceMassBalancex/./../../classes/./matrix/./ElementVector.h \
++ modules/SurfaceMassBalancex/./../../classes/./gauss/gaussobjects.h \
++ modules/SurfaceMassBalancex/./../../classes/./gauss/./Gauss.h \
++ modules/SurfaceMassBalancex/./../../classes/./gauss/./GaussSeg.h \
++ modules/SurfaceMassBalancex/./../../classes/./gauss/./../../shared/Numerics/types.h \
++ modules/SurfaceMassBalancex/./../../classes/./gauss/././Gauss.h \
++ modules/SurfaceMassBalancex/./../../classes/./gauss/./GaussTria.h \
++ modules/SurfaceMassBalancex/./../../classes/./gauss/./GaussPenta.h \
++ modules/SurfaceMassBalancex/./../../classes/./kriging/krigingobjects.h \
++ modules/SurfaceMassBalancex/./../../classes/./kriging/./Variogram.h \
++ modules/SurfaceMassBalancex/./../../classes/./kriging/./../../datastructures/datastructures.h \
++ modules/SurfaceMassBalancex/./../../classes/./kriging/./GaussianVariogram.h \
++ modules/SurfaceMassBalancex/./../../classes/./kriging/././Variogram.h \
++ modules/SurfaceMassBalancex/./../../classes/./kriging/./ExponentialVariogram.h \
++ modules/SurfaceMassBalancex/./../../classes/./kriging/./SphericalVariogram.h \
++ modules/SurfaceMassBalancex/./../../classes/./kriging/./PowerVariogram.h \
++ modules/SurfaceMassBalancex/./../../classes/./kriging/./Quadtree.h \
++ modules/SurfaceMassBalancex/./../../classes/./kriging/./Observation.h \
++ modules/SurfaceMassBalancex/./../../classes/./kriging/./Observations.h \
++ modules/SurfaceMassBalancex/./../../classes/./kriging/./../../shared/shared.h \
++ modules/SurfaceMassBalancex/./../../classes/./Hook.h \
++ modules/SurfaceMassBalancex/./../../classes/./DofIndexing.h \
++ modules/SurfaceMassBalancex/./../../classes/./IoModel.h \
++ modules/SurfaceMassBalancex/./../../classes/./../shared/Enum/Enum.h \
++ modules/SurfaceMassBalancex/./../../classes/./Update.h \
++ modules/SurfaceMassBalancex/./../../classes/./FemModel.h \
++ modules/SurfaceMassBalancex/./../../classes/./GiaDeflectionCoreArgs.h \
++ modules/SurfaceMassBalancex/./../../classes/./RiftStruct.h \
++ modules/SurfaceMassBalancex/../../shared/shared.h \
++ modules/SurfaceMassBalancex/../../toolkits/toolkits.h
++
++modules/SurfaceMassBalancex/./SurfaceMassBalancex.h:
++
++modules/SurfaceMassBalancex/./../../classes/classes.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Contour.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/shared.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./MemOps/MemOps.h:
++
++/usr/include/c++/4.6/cassert:
++
++/usr/include/assert.h:
++
++/usr/include/features.h:
++
++/usr/include/x86_64-linux-gnu/bits/predefs.h:
++
++/usr/include/x86_64-linux-gnu/sys/cdefs.h:
++
++/usr/include/x86_64-linux-gnu/bits/wordsize.h:
++
++/usr/include/x86_64-linux-gnu/gnu/stubs.h:
++
++/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Bamg/shared.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Bamg/Abs.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Bamg/BigPrimeNumber.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Bamg/BinaryRand.h:
++
++/usr/include/c++/4.6/cstdlib:
++
++/usr/include/c++/4.6/x86_64-linux-gnu/./bits/c++config.h:
++
++/usr/include/c++/4.6/x86_64-linux-gnu/./bits/os_defines.h:
++
++/usr/include/c++/4.6/x86_64-linux-gnu/./bits/cpu_defines.h:
++
++/usr/include/stdlib.h:
++
++/usr/lib/gcc/x86_64-linux-gnu/4.6/include/stddef.h:
++
++/usr/include/x86_64-linux-gnu/bits/waitflags.h:
++
++/usr/include/x86_64-linux-gnu/bits/waitstatus.h:
++
++/usr/include/endian.h:
++
++/usr/include/x86_64-linux-gnu/bits/endian.h:
++
++/usr/include/x86_64-linux-gnu/bits/byteswap.h:
++
++/usr/include/xlocale.h:
++
++/usr/include/x86_64-linux-gnu/sys/types.h:
++
++/usr/include/x86_64-linux-gnu/bits/types.h:
++
++/usr/include/x86_64-linux-gnu/bits/typesizes.h:
++
++/usr/include/time.h:
++
++/usr/include/x86_64-linux-gnu/sys/select.h:
++
++/usr/include/x86_64-linux-gnu/bits/select.h:
++
++/usr/include/x86_64-linux-gnu/bits/sigset.h:
++
++/usr/include/x86_64-linux-gnu/bits/time.h:
++
++/usr/include/x86_64-linux-gnu/bits/select2.h:
++
++/usr/include/x86_64-linux-gnu/sys/sysmacros.h:
++
++/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:
++
++/usr/include/alloca.h:
++
++/usr/include/x86_64-linux-gnu/bits/stdlib.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Bamg/Exchange.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Bamg/extrema.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Bamg/HeapSort.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Bamg/OppositeAngle.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Bamg/../Numerics/constants.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Elements/elements.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Elements/../Numerics/types.h:
++
++../.././config.h:
++
++/usr/include/stdio.h:
++
++/usr/include/libio.h:
++
++/usr/include/_G_config.h:
++
++/usr/include/wchar.h:
++
++/usr/lib/gcc/x86_64-linux-gnu/4.6/include/stdarg.h:
++
++/usr/include/x86_64-linux-gnu/bits/stdio_lim.h:
++
++/usr/include/x86_64-linux-gnu/bits/sys_errlist.h:
++
++/usr/include/x86_64-linux-gnu/bits/stdio.h:
++
++/usr/include/x86_64-linux-gnu/bits/stdio2.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Enum/Enum.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Enum/./EnumDefinitions.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Exceptions/exceptions.h:
++
++/usr/include/c++/4.6/exception:
++
++/usr/include/c++/4.6/string:
++
++/usr/include/c++/4.6/bits/stringfwd.h:
++
++/usr/include/c++/4.6/bits/char_traits.h:
++
++/usr/include/c++/4.6/bits/stl_algobase.h:
++
++/usr/include/c++/4.6/bits/functexcept.h:
++
++/usr/include/c++/4.6/bits/exception_defines.h:
++
++/usr/include/c++/4.6/bits/cpp_type_traits.h:
++
++/usr/include/c++/4.6/ext/type_traits.h:
++
++/usr/include/c++/4.6/ext/numeric_traits.h:
++
++/usr/include/c++/4.6/bits/stl_pair.h:
++
++/usr/include/c++/4.6/bits/move.h:
++
++/usr/include/c++/4.6/bits/concept_check.h:
++
++/usr/include/c++/4.6/bits/stl_iterator_base_types.h:
++
++/usr/include/c++/4.6/bits/stl_iterator_base_funcs.h:
++
++/usr/include/c++/4.6/bits/stl_iterator.h:
++
++/usr/include/c++/4.6/debug/debug.h:
++
++/usr/include/c++/4.6/bits/postypes.h:
++
++/usr/include/c++/4.6/cwchar:
++
++/usr/include/x86_64-linux-gnu/bits/wchar.h:
++
++/usr/include/x86_64-linux-gnu/bits/wchar2.h:
++
++/usr/include/c++/4.6/bits/allocator.h:
++
++/usr/include/c++/4.6/x86_64-linux-gnu/./bits/c++allocator.h:
++
++/usr/include/c++/4.6/ext/new_allocator.h:
++
++/usr/include/c++/4.6/new:
++
++/usr/include/c++/4.6/bits/localefwd.h:
++
++/usr/include/c++/4.6/x86_64-linux-gnu/./bits/c++locale.h:
++
++/usr/include/c++/4.6/clocale:
++
++/usr/include/locale.h:
++
++/usr/include/x86_64-linux-gnu/bits/locale.h:
++
++/usr/include/c++/4.6/iosfwd:
++
++/usr/include/c++/4.6/cctype:
++
++/usr/include/ctype.h:
++
++/usr/include/c++/4.6/bits/ostream_insert.h:
++
++/usr/include/c++/4.6/bits/cxxabi_forced.h:
++
++/usr/include/c++/4.6/bits/stl_function.h:
++
++/usr/include/c++/4.6/backward/binders.h:
++
++/usr/include/c++/4.6/bits/range_access.h:
++
++/usr/include/c++/4.6/bits/basic_string.h:
++
++/usr/include/c++/4.6/ext/atomicity.h:
++
++/usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr.h:
++
++/usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr-default.h:
++
++/usr/include/pthread.h:
++
++/usr/include/sched.h:
++
++/usr/include/x86_64-linux-gnu/bits/sched.h:
++
++/usr/include/x86_64-linux-gnu/bits/timex.h:
++
++/usr/include/x86_64-linux-gnu/bits/setjmp.h:
++
++/usr/include/unistd.h:
++
++/usr/include/x86_64-linux-gnu/bits/posix_opt.h:
++
++/usr/include/x86_64-linux-gnu/bits/environments.h:
++
++/usr/include/x86_64-linux-gnu/bits/confname.h:
++
++/usr/include/getopt.h:
++
++/usr/include/x86_64-linux-gnu/bits/unistd.h:
++
++/usr/include/c++/4.6/x86_64-linux-gnu/./bits/atomic_word.h:
++
++/usr/include/c++/4.6/initializer_list:
++
++/usr/include/c++/4.6/bits/basic_string.tcc:
++
++/usr/include/c++/4.6/iostream:
++
++/usr/include/c++/4.6/ostream:
++
++/usr/include/c++/4.6/ios:
++
++/usr/include/c++/4.6/bits/ios_base.h:
++
++/usr/include/c++/4.6/bits/locale_classes.h:
++
++/usr/include/c++/4.6/bits/locale_classes.tcc:
++
++/usr/include/c++/4.6/streambuf:
++
++/usr/include/c++/4.6/bits/streambuf.tcc:
++
++/usr/include/c++/4.6/bits/basic_ios.h:
++
++/usr/include/c++/4.6/bits/locale_facets.h:
++
++/usr/include/c++/4.6/cwctype:
++
++/usr/include/wctype.h:
++
++/usr/include/c++/4.6/x86_64-linux-gnu/./bits/ctype_base.h:
++
++/usr/include/c++/4.6/bits/streambuf_iterator.h:
++
++/usr/include/c++/4.6/x86_64-linux-gnu/./bits/ctype_inline.h:
++
++/usr/include/c++/4.6/bits/locale_facets.tcc:
++
++/usr/include/c++/4.6/bits/basic_ios.tcc:
++
++/usr/include/c++/4.6/bits/ostream.tcc:
++
++/usr/include/c++/4.6/istream:
++
++/usr/include/c++/4.6/bits/istream.tcc:
++
++/usr/include/c++/4.6/sstream:
++
++/usr/include/c++/4.6/bits/sstream.tcc:
++
++/usr/include/c++/4.6/iomanip:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./io/io.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./io/./Disk/diskio.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./io/./Print/Print.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./io/./Comm/IssmComm.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./io/./Comm/../../../toolkits/mpi/issmmpi.h:
++
++/usr/include/c++/4.6/cstddef:
++
++/u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/mpich/install/include/mpi.h:
++
++/u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/mpich/install/include/mpio.h:
++
++/u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/mpich/install/include/mpi.h:
++
++/u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/mpich/install/include/mpicxx.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./io/./Comm/../../../toolkits/mpi/./commops/commops.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./io/./Comm/../../../toolkits/mpi/./commops/../../../shared/Numerics/types.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./io/./Comm/../../../toolkits/mpi/./commops/../../../shared/io/Comm/IssmComm.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./io/./Comm/../../../toolkits/mpi/./commops/../../mpi/issmmpi.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Exp/exp.h:
++
++/usr/include/c++/4.6/cstring:
++
++/usr/include/string.h:
++
++/usr/include/x86_64-linux-gnu/bits/string3.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Exp/../Numerics/recast.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Exp/../Exceptions/exceptions.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Exp/../MemOps/MemOps.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Matrix/matrix.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Matrix/../Numerics/types.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Numerics/numerics.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Numerics/./Verbosity.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Numerics/./GaussPoints.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Numerics/./../../shared/Numerics/types.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Numerics/./isnan.h:
++
++/usr/include/math.h:
++
++/usr/include/x86_64-linux-gnu/bits/huge_val.h:
++
++/usr/include/x86_64-linux-gnu/bits/huge_valf.h:
++
++/usr/include/x86_64-linux-gnu/bits/huge_vall.h:
++
++/usr/include/x86_64-linux-gnu/bits/inf.h:
++
++/usr/include/x86_64-linux-gnu/bits/nan.h:
++
++/usr/include/x86_64-linux-gnu/bits/mathdef.h:
++
++/usr/include/x86_64-linux-gnu/bits/mathcalls.h:
++
++/usr/include/x86_64-linux-gnu/bits/mathinline.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Numerics/./recast.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Numerics/./types.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Numerics/./constants.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Numerics/./OptArgs.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Numerics/./OptPars.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Numerics/././types.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Sorting/sorting.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./String/sharedstring.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./Threads/issm_threads.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./TriMesh/trimesh.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/./LatLong/latlong.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../datastructures/datastructures.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../datastructures/./DataSet.h:
++
++/usr/include/c++/4.6/vector:
++
++/usr/include/c++/4.6/bits/stl_construct.h:
++
++/usr/include/c++/4.6/bits/stl_uninitialized.h:
++
++/usr/include/c++/4.6/bits/stl_vector.h:
++
++/usr/include/c++/4.6/bits/stl_bvector.h:
++
++/usr/include/c++/4.6/bits/vector.tcc:
++
++modules/SurfaceMassBalancex/./../../classes/./../datastructures/./Object.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Vertices.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Vertex.h:
++
++modules/SurfaceMassBalancex/./../../classes/././classes.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/Exceptions/exceptions.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/toolkits.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./petsc/petscincludes.h:
++
++/u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscmat.h:
++
++/u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscvec.h:
++
++/u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscis.h:
++
++/u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscsys.h:
++
++/u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscconf.h:
++
++/u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscfix.h:
++
++/u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscversion.h:
++
++/u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscmath.h:
++
++/u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscerror.h:
++
++/u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscviewertypes.h:
++
++/u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscoptions.h:
++
++/u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petsclog.h:
++
++/u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscsys.h:
++
++/usr/include/memory.h:
++
++/usr/lib/gcc/x86_64-linux-gnu/4.6/include/xmmintrin.h:
++
++/usr/lib/gcc/x86_64-linux-gnu/4.6/include/mmintrin.h:
++
++/usr/lib/gcc/x86_64-linux-gnu/4.6/include/mm_malloc.h:
++
++/usr/lib/gcc/x86_64-linux-gnu/4.6/include/emmintrin.h:
++
++/usr/lib/gcc/x86_64-linux-gnu/4.6/include/stdint.h:
++
++/usr/include/stdint.h:
++
++/usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed/limits.h:
++
++/usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed/syslimits.h:
++
++/usr/include/limits.h:
++
++/usr/include/x86_64-linux-gnu/bits/posix1_lim.h:
++
++/usr/include/x86_64-linux-gnu/bits/local_lim.h:
++
++/usr/include/linux/limits.h:
++
++/usr/include/x86_64-linux-gnu/bits/posix2_lim.h:
++
++/usr/include/x86_64-linux-gnu/bits/xopen_lim.h:
++
++/usr/include/x86_64-linux-gnu/sys/param.h:
++
++/usr/include/linux/param.h:
++
++/usr/include/x86_64-linux-gnu/asm/param.h:
++
++/usr/include/asm-generic/param.h:
++
++/u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscsftypes.h:
++
++/u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscviewer.h:
++
++/u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscksp.h:
++
++/u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscpc.h:
++
++/u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscdmtypes.h:
++
++/u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/petscdrawtypes.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./petsc/patches/petscpatches.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./petsc/patches/./SolverEnum.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./petsc/patches/../../toolkitsenums.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./petsc/patches/../../../shared/io/Comm/IssmComm.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./petsc/objects/petscobjects.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./petsc/objects/./PetscMat.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./petsc/objects/./../petscincludes.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./petsc/objects/./../../../shared/Numerics/types.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./petsc/objects/./PetscVec.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./petsc/objects/./PetscSolver.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./mpi/issmmpi.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./metis/metisincludes.h:
++
++/u/astrid-r1b/morlighe/issmjpl/cron/trunk-jpl/externalpackages/petsc/install/include/metis.h:
++
++/usr/include/inttypes.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./metis/patches/metispatches.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./triangle/triangleincludes.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/toolkitobjects.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./Vector.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../../shared/Enum/Enum.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../petsc/petscincludes.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/issmtoolkit.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./IssmAbsMat.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./../toolkitsenums.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./../../shared/Numerics/types.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./IssmAbsVec.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./IssmDenseMat.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/././IssmSeqVec.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/././../../shared/shared.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./../../shared/shared.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./../gsl/gslincludes.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./../gsl/../../shared/Numerics/types.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./IssmMat.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./../ToolkitOptions.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/././IssmToolkitUtils.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./IssmSeqVec.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./IssmVec.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./../../shared/Enum/Enum.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./../../shared/Exceptions/exceptions.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./../../shared/MemOps/MemOps.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./IssmSolver.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./IssmMpiDenseMat.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./../../datastructures/datastructures.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./../mumps/mumpsincludes.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./../mumps/../../shared/Numerics/types.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/././Bucket.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/././../../datastructures/datastructures.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/././../toolkitsenums.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/././IssmMpiVec.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/././../../shared/Exceptions/exceptions.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/././../../shared/MemOps/MemOps.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/././../../shared/io/io.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/././../mpi/issmmpi.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./IssmMpiSparseMat.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/././SparseRow.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./../issm/./IssmMpiVec.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./Matrix.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/./Solver.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/././Matrix.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./objects/././Vector.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./toolkitsenums.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./issm/issmtoolkit.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../toolkits/./ToolkitOptions.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Nodes.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Contours.h:
++
++modules/SurfaceMassBalancex/./../../classes/././Contour.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Node.h:
++
++modules/SurfaceMassBalancex/./../../classes/././DofIndexing.h:
++
++modules/SurfaceMassBalancex/./../../classes/././../shared/Numerics/types.h:
++
++modules/SurfaceMassBalancex/./../../classes/././Update.h:
++
++modules/SurfaceMassBalancex/./../../classes/././../shared/shared.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Profiler.h:
++
++modules/SurfaceMassBalancex/./../../classes/./DependentObject.h:
++
++modules/SurfaceMassBalancex/./../../classes/./IndependentObject.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Segment.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/Numerics/constants.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Massfluxatgate.h:
++
++modules/SurfaceMassBalancex/./../../classes/././Definition.h:
++
++modules/SurfaceMassBalancex/./../../classes/././Elements/Element.h:
++
++modules/SurfaceMassBalancex/./../../classes/././Elements/../../datastructures/datastructures.h:
++
++modules/SurfaceMassBalancex/./../../classes/././Elements/../../toolkits/toolkits.h:
++
++modules/SurfaceMassBalancex/./../../classes/././Elements/../Update.h:
++
++modules/SurfaceMassBalancex/./../../classes/././Elements/Elements.h:
++
++modules/SurfaceMassBalancex/./../../classes/././FemModel.h:
++
++modules/SurfaceMassBalancex/./../../classes/././../toolkits/toolkits.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Misfit.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../modules/SurfaceAreax/SurfaceAreax.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../modules/SurfaceAreax/../../shared/shared.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../classes/Params/Parameters.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../classes/Params/../../datastructures/datastructures.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../classes/Params/../../shared/shared.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Constraints/Constraints.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Constraints/../../datastructures/datastructures.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Constraints/../../shared/shared.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Constraints/Constraint.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Constraints/../../toolkits/toolkits.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Constraints/SpcStatic.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Constraints/SpcTransient.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Constraints/SpcDynamic.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Loads/Loads.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Loads/../../datastructures/datastructures.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Loads/Load.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Loads/../Update.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Loads/Friction.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Loads/Numericalflux.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Loads/./Load.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Loads/Riftfront.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Loads/Penpair.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Loads/../Node.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Loads/../Elements/Element.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Loads/Pengrid.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Elements/Elements.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Elements/Element.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Elements/Penta.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Elements/./Element.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Elements/./ElementHook.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Elements/./PentaRef.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Elements/../../shared/Exceptions/exceptions.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Elements/../../shared/Enum/Enum.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Elements/PentaRef.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Elements/Seg.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Elements/./SegRef.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Elements/SegRef.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Elements/Tria.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Elements/./TriaRef.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Elements/TriaRef.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Elements/ElementHook.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Options/Option.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Options/../../shared/shared.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Options/../../datastructures/datastructures.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Options/Options.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Options/./GenericOption.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Options/./../../shared/shared.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Options/./../../datastructures/datastructures.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Options/././OptionUtilities.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Options/././../../shared/Exceptions/exceptions.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Options/././../../shared/Enum/Enum.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Options/./././Option.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Options/GenericOption.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Options/OptionUtilities.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Inputs/Inputs.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Inputs/../../datastructures/datastructures.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Inputs/../../shared/shared.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Inputs/Input.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Inputs/BoolInput.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Inputs/./Input.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Inputs/DoubleInput.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Inputs/IntInput.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Inputs/PentaInput.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Inputs/../Elements/PentaRef.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Inputs/TriaInput.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Inputs/../Elements/TriaRef.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Inputs/SegInput.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Inputs/../Elements/SegRef.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Inputs/ControlInput.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Inputs/DatasetInput.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Inputs/TransientInput.h:
++
++modules/SurfaceMassBalancex/./../../classes/./ExternalResults/Results.h:
++
++modules/SurfaceMassBalancex/./../../classes/./ExternalResults/../../datastructures/datastructures.h:
++
++modules/SurfaceMassBalancex/./../../classes/./ExternalResults/ExternalResult.h:
++
++modules/SurfaceMassBalancex/./../../classes/./ExternalResults/../Node.h:
++
++modules/SurfaceMassBalancex/./../../classes/./ExternalResults/GenericExternalResult.h:
++
++modules/SurfaceMassBalancex/./../../classes/./ExternalResults/./ExternalResult.h:
++
++modules/SurfaceMassBalancex/./../../classes/./ExternalResults/../../shared/shared.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Materials/Materials.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Materials/../../datastructures/datastructures.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Materials/Material.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Materials/../Update.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Materials/Matice.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Materials/./Material.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Materials/../Hook.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Materials/../../datastructures/datastructures.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Materials/Matpar.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Params/GenericParam.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Params/./Param.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Params/./../../datastructures/datastructures.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Params/./../Node.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Params/../../shared/shared.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Params/BoolParam.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Params/DoubleMatParam.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Params/DoubleTransientMatParam.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Params/DoubleMatArrayParam.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Params/DoubleParam.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Params/DoubleVecParam.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Params/IntParam.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Params/IntVecParam.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Params/IntMatParam.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Params/FileParam.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Params/Parameters.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Params/Param.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Params/MatrixParam.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Params/VectorParam.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Params/StringArrayParam.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Params/StringParam.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Params/TransientParam.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Params/DataSetParam.h:
++
++modules/SurfaceMassBalancex/./../../classes/./matrix/matrixobjects.h:
++
++modules/SurfaceMassBalancex/./../../classes/./matrix/./ElementMatrix.h:
++
++modules/SurfaceMassBalancex/./../../classes/./matrix/./../../datastructures/datastructures.h:
++
++modules/SurfaceMassBalancex/./../../classes/./matrix/./../../toolkits/toolkits.h:
++
++modules/SurfaceMassBalancex/./../../classes/./matrix/./../../shared/shared.h:
++
++modules/SurfaceMassBalancex/./../../classes/./matrix/./ElementVector.h:
++
++modules/SurfaceMassBalancex/./../../classes/./gauss/gaussobjects.h:
++
++modules/SurfaceMassBalancex/./../../classes/./gauss/./Gauss.h:
++
++modules/SurfaceMassBalancex/./../../classes/./gauss/./GaussSeg.h:
++
++modules/SurfaceMassBalancex/./../../classes/./gauss/./../../shared/Numerics/types.h:
++
++modules/SurfaceMassBalancex/./../../classes/./gauss/././Gauss.h:
++
++modules/SurfaceMassBalancex/./../../classes/./gauss/./GaussTria.h:
++
++modules/SurfaceMassBalancex/./../../classes/./gauss/./GaussPenta.h:
++
++modules/SurfaceMassBalancex/./../../classes/./kriging/krigingobjects.h:
++
++modules/SurfaceMassBalancex/./../../classes/./kriging/./Variogram.h:
++
++modules/SurfaceMassBalancex/./../../classes/./kriging/./../../datastructures/datastructures.h:
++
++modules/SurfaceMassBalancex/./../../classes/./kriging/./GaussianVariogram.h:
++
++modules/SurfaceMassBalancex/./../../classes/./kriging/././Variogram.h:
++
++modules/SurfaceMassBalancex/./../../classes/./kriging/./ExponentialVariogram.h:
++
++modules/SurfaceMassBalancex/./../../classes/./kriging/./SphericalVariogram.h:
++
++modules/SurfaceMassBalancex/./../../classes/./kriging/./PowerVariogram.h:
++
++modules/SurfaceMassBalancex/./../../classes/./kriging/./Quadtree.h:
++
++modules/SurfaceMassBalancex/./../../classes/./kriging/./Observation.h:
++
++modules/SurfaceMassBalancex/./../../classes/./kriging/./Observations.h:
++
++modules/SurfaceMassBalancex/./../../classes/./kriging/./../../shared/shared.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Hook.h:
++
++modules/SurfaceMassBalancex/./../../classes/./DofIndexing.h:
++
++modules/SurfaceMassBalancex/./../../classes/./IoModel.h:
++
++modules/SurfaceMassBalancex/./../../classes/./../shared/Enum/Enum.h:
++
++modules/SurfaceMassBalancex/./../../classes/./Update.h:
++
++modules/SurfaceMassBalancex/./../../classes/./FemModel.h:
++
++modules/SurfaceMassBalancex/./../../classes/./GiaDeflectionCoreArgs.h:
++
++modules/SurfaceMassBalancex/./../../classes/./RiftStruct.h:
++
++modules/SurfaceMassBalancex/../../shared/shared.h:
++
++modules/SurfaceMassBalancex/../../toolkits/toolkits.h:
+Index: ../trunk-jpl/src/c/modules/SurfaceMassBalancex/.deps/SurfaceMassBalancex.Plo
+===================================================================
+--- ../trunk-jpl/src/c/modules/SurfaceMassBalancex/.deps/SurfaceMassBalancex.Plo	(revision 0)
++++ ../trunk-jpl/src/c/modules/SurfaceMassBalancex/.deps/SurfaceMassBalancex.Plo	(revision 17085)
+@@ -0,0 +1 @@
++# dummy
+Index: ../trunk-jpl/src/c/modules/SurfaceMassBalancex/.deps/libISSMRose_a-SurfaceMassBalancex.r2cpp.Po
+===================================================================
+--- ../trunk-jpl/src/c/modules/SurfaceMassBalancex/.deps/libISSMRose_a-SurfaceMassBalancex.r2cpp.Po	(revision 0)
++++ ../trunk-jpl/src/c/modules/SurfaceMassBalancex/.deps/libISSMRose_a-SurfaceMassBalancex.r2cpp.Po	(revision 17085)
+@@ -0,0 +1 @@
++# dummy
+Index: ../trunk-jpl/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.cpp	(revision 0)
++++ ../trunk-jpl/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.cpp	(revision 17085)
+@@ -0,0 +1,171 @@
++/*!\file SurfaceMassBalancex
++ * \brief: calculates SMB 
++ */
++
++#include "./SurfaceMassBalancex.h"
++#include "../../shared/shared.h"
++#include "../../toolkits/toolkits.h"
++
++void SurfaceMassBalancex(FemModel* femmodel){/*{{{*/
++
++	/*Intermediaties*/
++	int  smb_model;
++	bool isdelta18o;
++
++	/*First, get SMB model from parameters*/
++	femmodel->parameters->FindParam(&smb_model,SurfaceforcingsEnum);
++
++	/*branch to correct module*/
++	switch(smb_model){
++		case SMBEnum:
++			/*Nothing to be done*/
++			break;
++		case SMBpddEnum:
++			femmodel->parameters->FindParam(&isdelta18o,SurfaceforcingsIsdelta18oEnum);
++			if(isdelta18o){
++				if(VerboseSolution()) _printf0_("   call Delta18oParametrization module\n");
++				Delta18oParameterizationx(femmodel);
++			} 
++			if(VerboseSolution()) _printf0_("   call positive degree day module\n");
++			PositiveDegreeDayx(femmodel);
++			break;
++		case SMBgradientsEnum:
++			if(VerboseSolution())_printf_("	call smb gradients module\n");
++			SmbGradientsx(femmodel);
++			break;
++		case SMBhenningEnum:
++			if(VerboseSolution())_printf_("  call smb Henning module\n");
++			SmbHenningx(femmodel);
++		default:
++			_error_("Surface mass balance model "<<EnumToStringx(smb_model)<<" not supported yet");
++	}
++
++}/*}}}*/
++
++void SmbGradientsx(FemModel* femmodel){/*{{{*/
++
++	// void SurfaceMassBalancex(hd,agd,ni){
++	//    INPUT parameters: ni: working size of arrays
++	//    INPUT: surface elevation (m): hd(NA)
++	//    OUTPUT: mass-balance (m/yr ice): agd(NA)
++
++	for(int i=0;i<femmodel->elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++		element->SmbGradients();
++	}
++
++}/*}}}*/
++void Delta18oParameterizationx(FemModel* femmodel){/*{{{*/
++
++	for(int i=0;i<femmodel->elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++		element->Delta18oParameterization();
++	}
++
++}/*}}}*/
++void PositiveDegreeDayx(FemModel* femmodel){/*{{{*/
++
++	// void PositiveDegreeDayx(hd,vTempsea,vPrec,agd,Tsurf,ni){
++	//    note "v" prefix means 12 monthly means, ie time dimension
++	//    INPUT parameters: ni: working size of arrays
++	//    INPUT: surface elevation (m): hd(NA)
++	//    monthly mean surface sealevel temperature (degrees C): vTempsea(NA
++	//    ,NTIME) 
++	//    monthly mean precip rate (m/yr water equivalent): vPrec(NA,NTIME)
++	//    OUTPUT: mass-balance (m/yr ice): agd(NA)
++	//    mean annual surface temperature (degrees C): Tsurf(NA)
++
++	int    i, it, jj, itm;
++	IssmDouble DT = 0.02, sigfac, snormfac;
++	IssmDouble signorm = 5.5;      // signorm : sigma of the temperature distribution for a normal day 
++	IssmDouble siglim;       // sigma limit for the integration which is equal to 2.5 sigmanorm
++	IssmDouble signormc = signorm - 0.5;     // sigma of the temperature distribution for cloudy day
++	IssmDouble siglimc, siglim0, siglim0c;
++	IssmDouble tstep, tsint, tint, tstepc;
++	int    NPDMAX = 1504, NPDCMAX = 1454;
++	//IssmDouble pdds[NPDMAX]={0}; 
++	//IssmDouble pds[NPDCMAX]={0};
++	IssmDouble pddt, pd ; // pd : snow/precip fraction, precipitation falling as snow
++	IssmDouble PDup, PDCUT = 2.0;    // PDcut: rain/snow cutoff temperature (C)
++	IssmDouble tstar; // monthly mean surface temp
++
++	IssmDouble *pdds    = NULL;
++	IssmDouble *pds     = NULL;
++	Element    *element = NULL;
++
++	pdds=xNew<IssmDouble>(NPDMAX+1); 
++	pds=xNew<IssmDouble>(NPDCMAX+1); 
++
++	/* initialize PDD (creation of a lookup table)*/
++	tstep    = 0.1;
++	tsint    = tstep*0.5;
++	sigfac   = -1.0/(2.0*pow(signorm,2));
++	snormfac = 1.0/(signorm*sqrt(2.0*acos(-1.0)));
++	siglim   = 2.5*signorm;
++	siglimc  = 2.5*signormc;
++	siglim0  = siglim/DT + 0.5;
++	siglim0c = siglimc/DT + 0.5;
++	PDup     = siglimc+PDCUT;
++
++	itm = reCast<int,IssmDouble>((2*siglim/DT + 1.5));
++
++	if(itm >= NPDMAX) _error_("increase NPDMAX in massBalance.cpp");
++	for(it = 0; it < itm; it++){  
++		//    tstar = REAL(it)*DT-siglim;
++		tstar = it*DT-siglim;
++		tint = tsint;
++		pddt = 0.;
++		for ( jj = 0; jj < 600; jj++){
++			if (tint > (tstar+siglim)){break;}
++			pddt = pddt + tint*exp(sigfac*(pow((tint-tstar),2)))*tstep;
++			tint = tint+tstep;
++		}
++		pdds[it] = pddt*snormfac;
++	}
++	pdds[itm+1] = siglim + DT;
++
++	//*********compute PD(T) : snow/precip fraction. precipitation falling as snow
++	tstepc   = 0.1;
++	tsint    = PDCUT-tstepc*0.5;
++	signormc = signorm - 0.5;
++	sigfac   = -1.0/(2.0*pow(signormc,2));
++	snormfac = 1.0/(signormc*sqrt(2.0*acos(-1.0)));
++	siglimc  = 2.5*signormc ;
++	itm = reCast<int,IssmDouble>((PDCUT+2.*siglimc)/DT + 1.5);
++	if(itm >= NPDCMAX) _error_("increase NPDCMAX in p35com");
++	for(it = 0; it < itm; it++ ){
++		tstar = it*DT-siglimc;
++		//    tstar = REAL(it)*DT-siglimc;
++		tint = tsint;          // start against upper bound
++		pd = 0.;
++		for (jj = 0; jj < 600; jj++){
++			if (tint<(tstar-siglimc)) {break;}
++			pd = pd + exp(sigfac*(pow((tint-tstar),2)))*tstepc;
++			tint = tint-tstepc;
++		}
++		pds[it] = pd*snormfac;  // gaussian integral lookup table for snow fraction
++	}
++	pds[itm+1] = 0.;
++	//     *******END initialize PDD
++
++	for(i=0;i<femmodel->elements->Size();i++){
++		element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++		element->PositiveDegreeDay(pdds,pds,signorm);
++	}
++
++	/*free ressouces: */
++	xDelete<IssmDouble>(pdds);
++	xDelete<IssmDouble>(pds);
++}/*}}}*/
++void SmbHenningx(FemModel* femmodel){/*{{{*/
++
++	// void SurfaceMassBalancex(hd,agd,ni){
++	//    INPUT parameters: ni: working size of arrays
++	//    INPUT: surface elevation (m): hd(NA)
++	//    OUTPUT: mass-balance (m/yr ice): agd(NA)
++
++	for(int i=0;i<femmodel->elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++	}
++
++}/*}}}*/
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17084)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17085)
+@@ -303,12 +303,8 @@
+ 					./modules/ComputeStrainRatex/ComputeStrainRatex.cpp\
+ 					./modules/SpcNodesx/SpcNodesx.h\
+ 					./modules/SpcNodesx/SpcNodesx.cpp\
+-					./modules/PositiveDegreeDayx/PositiveDegreeDayx.h\
+-					./modules/PositiveDegreeDayx/PositiveDegreeDayx.cpp\
+-					./modules/Delta18oParameterizationx/Delta18oParameterizationx.h\
+-					./modules/Delta18oParameterizationx/Delta18oParameterizationx.cpp\
+-					./modules/SmbGradientsx/SmbGradientsx.h\
+-					./modules/SmbGradientsx/SmbGradientsx.cpp\
++					./modules/SurfaceMassBalancex/SurfaceMassBalancex.h\
++					./modules/SurfaceMassBalancex/SurfaceMassBalancex.cpp\
+ 					./modules/MeshPartitionx/MeshPartitionx.h\
+ 					./modules/Reducevectorgtofx/Reducevectorgtofx.cpp\
+ 					./modules/Reducevectorgtofx/Reducevectorgtofx.h\
+Index: ../trunk-jpl/src/c/cores/masstransport_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/masstransport_core.cpp	(revision 17084)
++++ ../trunk-jpl/src/c/cores/masstransport_core.cpp	(revision 17085)
+@@ -13,7 +13,7 @@
+ 
+ 	/*parameters: */
+ 	int    i;
+-	int    numoutputs,meshtype,smb_model;
++	int    numoutputs,meshtype;
+ 	bool   save_results;
+ 	bool   issmbgradients,ispdd,isdelta18o,isFS,isfreesurface,dakota_analysis;
+ 	int    solution_type;
+@@ -24,7 +24,6 @@
+ 
+ 	/*recover parameters: */
+ 	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
+-	femmodel->parameters->FindParam(&smb_model,SurfaceforcingsEnum);
+ 	femmodel->parameters->FindParam(&isFS,FlowequationIsFSEnum);
+ 	femmodel->parameters->FindParam(&isfreesurface,MasstransportIsfreesurfaceEnum);
+ 	femmodel->parameters->FindParam(&dakota_analysis,QmuIsdakotaEnum);
+@@ -40,27 +39,10 @@
+ 		InputDuplicatex(femmodel,QmuBedEnum,BedEnum);
+ 	}
+ 
+-	switch(smb_model){
+-		case SMBEnum:
+-			/*Nothing to be done*/
+-			break;
+-		case SMBpddEnum:
+-			femmodel->parameters->FindParam(&isdelta18o,SurfaceforcingsIsdelta18oEnum);
+-			if(isdelta18o){
+-				if(VerboseSolution()) _printf0_("   call Delta18oParametrization module\n");
+-				Delta18oParameterizationx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
+-			} 
+-			if(VerboseSolution()) _printf0_("   call positive degree day module\n");
+-			PositiveDegreeDayx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
+-			break;
+-		case SMBgradientsEnum:
+-			if(VerboseSolution())_printf_("	call smb gradients module\n\n");
+-			SmbGradientsx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
+-			break;
+-		default:
+-			_error_("Surface mass balance model "<<EnumToStringx(smb_model)<<" not supported yet");
+-	}
++	/*Calculate new Surface Mass Balance (SMB)*/
++	SurfaceMassBalancex(femmodel);
+ 
++	/*Transport mass or free surface*/
+ 	if(isFS && isfreesurface){
+ 		if(VerboseSolution()) _printf0_("   call free surface computational core\n");
+ 		femmodel->SetCurrentConfiguration(FreeSurfaceBaseAnalysisEnum);
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 17084)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 17085)
+@@ -53,6 +53,9 @@
+ 		case SMBgradientsEnum:
+ 			/*Nothing to add*/
+ 			break;
++		case SMBhenningEnum:
++			/*Nothing to add*/
++			break;
+ 		default:
+ 			_error_("Surface mass balance model "<<EnumToStringx(smb_model)<<" not supported yet");
+ 	}
Index: issm/oecreview/Archive/16554-17801/ISSM-17085-17086.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17085-17086.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17085-17086.diff	(revision 17802)
@@ -0,0 +1,85 @@
+Index: ../trunk-jpl/src/m/classes/SMBhenning.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/SMBhenning.m	(revision 0)
++++ ../trunk-jpl/src/m/classes/SMBhenning.m	(revision 17086)
+@@ -0,0 +1,52 @@
++%SMBhenning Class definition
++%
++%   Usage:
++%      SMBhenning=SMBhenning();
++
++classdef SMBhenning
++	properties (SetAccess=public) 
++		mass_balance = NaN;
++	end
++	methods
++		function obj = SMBhenning(varargin) % {{{
++			switch nargin
++				case 0
++				otherwise
++					error('constructor not supported');
++			end
++		end % }}}
++		function self = extrude(self,md) % {{{
++
++			self.mass_balance=project3d(md,'vector',self.mass_balance,'type','node');
++
++		end % }}}
++		function self = initialize(self,md) % {{{
++
++			if isnan(self.mass_balance)
++				self.mass_balance=zeros(md.mesh.numberofvertices,1);
++				disp('      no surfaceforcings.mass_balance specified: values set as zero');
++			end
++
++		end % }}}
++		function md = checkconsistency(obj,md,solution,analyses) % {{{
++
++			if ismember(MasstransportAnalysisEnum(),analyses),
++				md = checkfield(md,'fieldname','surfaceforcings.mass_balance','forcing',1,'NaN',1);
++			end
++			if ismember(BalancethicknessAnalysisEnum(),analyses),
++				md = checkfield(md,'fieldname','surfaceforcings.mass_balance','size',[md.mesh.numberofvertices 1],'NaN',1);
++			end
++		end % }}}
++		function disp(obj) % {{{
++			disp(sprintf('   surface forcings parameters:'));
++			fielddisplay(obj,'mass_balance','surface mass balance [m/yr ice eq]');
++		end % }}}
++		function marshall(obj,md,fid) % {{{
++
++			yts=365.0*24.0*3600.0;
++
++			WriteData(fid,'enum',SurfaceforcingsEnum(),'data',SMBhenningEnum(),'format','Integer');
++			WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','mass_balance','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1);
++		end % }}}
++	end
++end
+Index: ../trunk-jpl/src/m/enum/SMBhenningEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/SMBhenningEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/SMBhenningEnum.m	(revision 17086)
+@@ -0,0 +1,11 @@
++function macro=SMBhenningEnum()
++%SMBHENNINGENUM - Enum of SMBhenning
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=SMBhenningEnum()
++
++macro=StringToEnum('SMBhenning');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17085)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17086)
+@@ -292,6 +292,7 @@
+ def SurfaceforcingsSmbrefEnum(): return StringToEnum("SurfaceforcingsSmbref")[0]
+ def SurfaceforcingsBPosEnum(): return StringToEnum("SurfaceforcingsBPos")[0]
+ def SurfaceforcingsBNegEnum(): return StringToEnum("SurfaceforcingsBNeg")[0]
++def SMBhenningEnum(): return StringToEnum("SMBhenning")[0]
+ def SurfaceforcingsIspddEnum(): return StringToEnum("SurfaceforcingsIspdd")[0]
+ def SurfaceforcingsIssmbgradientsEnum(): return StringToEnum("SurfaceforcingsIssmbgradients")[0]
+ def SolutionTypeEnum(): return StringToEnum("SolutionType")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17086-17087.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17086-17087.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17086-17087.diff	(revision 17802)
@@ -0,0 +1,137 @@
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17086)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17087)
+@@ -109,7 +109,7 @@
+ 			iomodel->FetchDataToInput(elements,SurfaceforcingsBNegEnum);
+ 			break;
+ 		case SMBhenningEnum:
+-			iomodel->FetchDataToInput(elements,SurfaceforcingsMassBalanceEnum,0.);
++			iomodel->FetchDataToInput(elements,SurfaceforcingsSmbrefEnum,0.);
+ 			break;
+ 		default:
+ 			_error_("Surface mass balance model "<<EnumToStringx(smb_model)<<" not supported yet");
+Index: ../trunk-jpl/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.cpp	(revision 17086)
++++ ../trunk-jpl/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.cpp	(revision 17087)
+@@ -36,6 +36,7 @@
+ 		case SMBhenningEnum:
+ 			if(VerboseSolution())_printf_("  call smb Henning module\n");
+ 			SmbHenningx(femmodel);
++			break;
+ 		default:
+ 			_error_("Surface mass balance model "<<EnumToStringx(smb_model)<<" not supported yet");
+ 	}
+@@ -159,13 +160,49 @@
+ }/*}}}*/
+ void SmbHenningx(FemModel* femmodel){/*{{{*/
+ 
+-	// void SurfaceMassBalancex(hd,agd,ni){
+-	//    INPUT parameters: ni: working size of arrays
+-	//    INPUT: surface elevation (m): hd(NA)
+-	//    OUTPUT: mass-balance (m/yr ice): agd(NA)
++	/*Intermediaries*/
++	IssmDouble  z_critical = 200.;
++	IssmDouble  a = 2.;
++	IssmDouble  b = 3.;
++	IssmDouble  smb,smbref,z;
+ 
++	/*Loop over all the elements of this partition*/
+ 	for(int i=0;i<femmodel->elements->Size();i++){
+ 		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++
++		/*Get reference SMB (uncorrected) and allocate all arrays*/
++		int         numvertices = element->GetNumberOfVertices();
++		IssmDouble* surfacelist = xNew<IssmDouble>(numvertices);
++		IssmDouble* smblistref  = xNew<IssmDouble>(numvertices);
++		IssmDouble* smblist     = xNew<IssmDouble>(numvertices);
++		element->GetInputListOnVertices(surfacelist,SurfaceEnum);
++		element->GetInputListOnVertices(smblistref,SurfaceforcingsSmbrefEnum);
++
++		/*Loop over all vertices of element and correct SMB as a function of altitude z*/
++		for(int v=0;v<numvertices;v++){
++
++			/*Get vertex elevation, reference smb*/
++			z      = surfacelist[v];
++			smbref = smblistref[v];
++
++			/*Compute corrected smb*/
++			if(z<z_critical){
++				smb = smbref;
++			}
++			else{
++				smb = a*smbref*smbref+b+z;
++			}
++
++			/*Update array accordingly*/
++			smblist[v] = smb;
++
++		}
++
++		/*Add input to element and Free memory*/
++		element->AddInput(SurfaceforcingsMassBalanceEnum,smblist,P1Enum);
++		xDelete<IssmDouble>(surfacelist);
++		xDelete<IssmDouble>(smblistref);
++		xDelete<IssmDouble>(smblist);
+ 	}
+ 
+ }/*}}}*/
+Index: ../trunk-jpl/src/m/classes/SMBhenning.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/SMBhenning.m	(revision 17086)
++++ ../trunk-jpl/src/m/classes/SMBhenning.m	(revision 17087)
+@@ -5,7 +5,7 @@
+ 
+ classdef SMBhenning
+ 	properties (SetAccess=public) 
+-		mass_balance = NaN;
++		smbref = NaN;
+ 	end
+ 	methods
+ 		function obj = SMBhenning(varargin) % {{{
+@@ -17,36 +17,36 @@
+ 		end % }}}
+ 		function self = extrude(self,md) % {{{
+ 
+-			self.mass_balance=project3d(md,'vector',self.mass_balance,'type','node');
++			self.smbref=project3d(md,'vector',self.smbref,'type','node');
+ 
+ 		end % }}}
+ 		function self = initialize(self,md) % {{{
+ 
+-			if isnan(self.mass_balance)
+-				self.mass_balance=zeros(md.mesh.numberofvertices,1);
+-				disp('      no surfaceforcings.mass_balance specified: values set as zero');
++			if isnan(self.smbref)
++				self.smbref=zeros(md.mesh.numberofvertices,1);
++				disp('      no surfaceforcings.smbref specified: values set as zero');
+ 			end
+ 
+ 		end % }}}
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+ 
+ 			if ismember(MasstransportAnalysisEnum(),analyses),
+-				md = checkfield(md,'fieldname','surfaceforcings.mass_balance','forcing',1,'NaN',1);
++				md = checkfield(md,'fieldname','surfaceforcings.smbref','forcing',1,'NaN',1);
+ 			end
+ 			if ismember(BalancethicknessAnalysisEnum(),analyses),
+-				md = checkfield(md,'fieldname','surfaceforcings.mass_balance','size',[md.mesh.numberofvertices 1],'NaN',1);
++				md = checkfield(md,'fieldname','surfaceforcings.smbref','size',[md.mesh.numberofvertices 1],'NaN',1);
+ 			end
+ 		end % }}}
+ 		function disp(obj) % {{{
+ 			disp(sprintf('   surface forcings parameters:'));
+-			fielddisplay(obj,'mass_balance','surface mass balance [m/yr ice eq]');
++			fielddisplay(obj,'smbref','reference smb from which deviation is calculated [m/yr ice eq]');
+ 		end % }}}
+ 		function marshall(obj,md,fid) % {{{
+ 
+ 			yts=365.0*24.0*3600.0;
+ 
+ 			WriteData(fid,'enum',SurfaceforcingsEnum(),'data',SMBhenningEnum(),'format','Integer');
+-			WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','mass_balance','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1);
++			WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','smbref','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1);
+ 		end % }}}
+ 	end
+ end
Index: issm/oecreview/Archive/16554-17801/ISSM-17087-17088.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17087-17088.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17087-17088.diff	(revision 17802)
@@ -0,0 +1,49 @@
+Index: ../trunk-jpl/test/NightlyRun/test119.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test119.py	(revision 17087)
++++ ../trunk-jpl/test/NightlyRun/test119.py	(revision 17088)
+@@ -19,6 +19,10 @@
+ md=bamg(model(),'domain','../Exp/Square.exp','hmax',3000.,'rand',False)
+ nbelements=md.mesh.numberofelements
+ elapsedtime=time.time()-t0
++if nbelements>267895-50 and nbelements<267895+50:
++	nbewithinrange = 1.
++else:
++	nbewithinrange = 0.
+ 
+ #Fields and tolerances to track changes
+ field_names     =['x1','y1','x2','y2','nbelements','elapsed time']
+@@ -26,5 +30,5 @@
+ field_values=[\
+ 	x1, y1,\
+ 	x2, y2,\
+-	nbelements,elapsedtime,\
++	nbewithinrange,elapsedtime,\
+ 	]
+Index: ../trunk-jpl/test/NightlyRun/test119.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test119.m	(revision 17087)
++++ ../trunk-jpl/test/NightlyRun/test119.m	(revision 17088)
+@@ -13,6 +13,11 @@
+ t0=clock;
+ md=bamg(model(),'domain','../Exp/Square.exp','hmax',3000.,'rand',false);
+ nbelements=md.mesh.numberofelements;
++if nbelements>267895-50 & nbelements<267895+50
++	nbewithinrange = 1.;
++else
++	nbewithinrange = 0.;
++end
+ elapsedtime=etime(clock,t0);
+ 
+ %Fields and tolerances to track changes
+@@ -21,5 +26,5 @@
+ field_values={...
+ 	x1, y1,...
+ 	x2, y2,...
+-	nbelements,elapsedtime...
++	nbewithinrange,elapsedtime...
+ 	};
+Index: ../trunk-jpl/test/Archives/Archive119.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17088-17089.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17088-17089.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17088-17089.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/m/classes/model.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.py	(revision 17088)
++++ ../trunk-jpl/src/m/classes/model.py	(revision 17089)
+@@ -6,7 +6,6 @@
+ from mask import mask
+ from geometry import geometry
+ from constants import constants
+-from surfaceforcings import surfaceforcings
+ from SMB import SMB
+ from SMBpdd import SMBpdd
+ from SMBgradients import SMBgradients
Index: issm/oecreview/Archive/16554-17801/ISSM-17089-17090.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17089-17090.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17089-17090.diff	(revision 17802)
@@ -0,0 +1,204 @@
+Index: ../trunk-jpl/test/NightlyRun/test331.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test331.m	(revision 17089)
++++ ../trunk-jpl/test/NightlyRun/test331.m	(revision 17090)
+@@ -1,25 +0,0 @@
+-md=triangle(model(),'../Exp/Square.exp',150000.);
+-md=setmask(md,'','');
+-md=parameterize(md,'../Par/SquareSheetConstrained.par');
+-md=setflowequation(md,'SSA','all');
+-md.cluster=generic('name',oshostname(),'np',3);
+-md.initialization.watercolumn=10^-3*ones(md.mesh.numberofvertices,1);
+-md.hydrology.spcwatercolumn=NaN*ones(md.mesh.numberofvertices,1);
+-pos=find(md.mesh.y==0 | md.mesh.x==0);
+-md.hydrology.spcwatercolumn(pos)=2*10^-3;
+-md=solve(md,HydrologySolutionEnum());
+-
+-%Fields and tolerances to track changes
+-field_names     ={'HydrologyWaterVx1','HydrologyWaterVy1','WaterColumn1', 'HydrologyWaterVx2','HydrologyWaterVy2','WaterColumn2', 'HydrologyWaterVx3','HydrologyWaterVy3','WaterColumn3'};
+-field_tolerances={1e-09,1e-01,1e-09, 1e-09,1e-01,1e-09, 1e-09,1e-01,1e-09};
+-field_values={...
+-	(md.results.HydrologySolution(1).HydrologyWaterVx),...
+-	(md.results.HydrologySolution(1).HydrologyWaterVy),...
+-	(md.results.HydrologySolution(1).Watercolumn),...
+-	(md.results.HydrologySolution(2).HydrologyWaterVx),...
+-	(md.results.HydrologySolution(2).HydrologyWaterVy),...
+-	(md.results.HydrologySolution(2).Watercolumn),...
+-	(md.results.HydrologySolution(3).HydrologyWaterVx),...
+-	(md.results.HydrologySolution(3).HydrologyWaterVy),...
+-	(md.results.HydrologySolution(3).Watercolumn),...
+-	};
+Index: ../trunk-jpl/test/NightlyRun/test612.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test612.py	(revision 17089)
++++ ../trunk-jpl/test/NightlyRun/test612.py	(revision 17090)
+@@ -1,43 +0,0 @@
+-import numpy
+-from model import *
+-from EnumDefinitions import *
+-from MatlabFuncs import *
+-from triangle import *
+-from meshconvert import *
+-from setmask import *
+-from parameterize import *
+-from setflowequation import *
+-from solve import *
+-
+-md=triangle(model(),'../Exp/79North.exp',10000.)
+-md=meshconvert(md)
+-md=setmask(md,'../Exp/79NorthShelf.exp','')
+-md=parameterize(md,'../Par/79North.py')
+-md=setflowequation(md,'SSA','all')
+-
+-#control parameters
+-md.inversion.nsteps=2
+-md.balancethickness.stabilization=3
+-md.inversion.iscontrol=1
+-md.inversion.control_parameters=['BalancethicknessThickeningRate']
+-md.inversion.thickness_obs=md.geometry.thickness
+-md.inversion.min_parameters=-50.*numpy.ones((md.mesh.numberofvertices,1))
+-md.inversion.max_parameters=50.*numpy.ones((md.mesh.numberofvertices,1))
+-md.inversion.cost_functions=[201]
+-md.inversion.cost_functions_coefficients=numpy.ones((md.mesh.numberofvertices,1))
+-md.inversion.gradient_scaling=10./md.constants.yts*numpy.ones((md.inversion.nsteps,1))
+-md.inversion.maxiter_per_step=4*numpy.ones((md.inversion.nsteps,1))
+-md.inversion.step_threshold=0.99*numpy.ones((md.inversion.nsteps,1))
+-
+-md.cluster=generic('name',oshostname(),'np',3)
+-md=solve(md,BalancethicknessSolutionEnum())
+-
+-#Fields and tolerances to track changes
+-field_names     =['Gradient','Misfits','BalancethicknessThickeningRate','Thickness']
+-field_tolerances=[1e-12,1e-12,1e-12,1e-12,1e-12,1e-12]
+-field_values=[\
+-	md.results.BalancethicknessSolution.Gradient1,\
+-	md.results.BalancethicknessSolution.J,\
+-	md.results.BalancethicknessSolution.BalancethicknessThickeningRate,\
+-	md.results.BalancethicknessSolution.Thickness
+-]
+Index: ../trunk-jpl/test/NightlyRun/test612.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test612.m	(revision 17089)
++++ ../trunk-jpl/test/NightlyRun/test612.m	(revision 17090)
+@@ -1,32 +0,0 @@
+-md=triangle(model(),'../Exp/79North.exp',10000.);
+-md=meshconvert(md);
+-md=setmask(md,'../Exp/79NorthShelf.exp','');
+-md=parameterize(md,'../Par/79North.par');
+-md=setflowequation(md,'SSA','all');
+-
+-%control parameters
+-md.inversion.nsteps=2;
+-md.balancethickness.stabilization=3;
+-md.inversion.iscontrol=1;
+-md.inversion.control_parameters={'BalancethicknessThickeningRate'};
+-md.inversion.thickness_obs=md.geometry.thickness;
+-md.inversion.min_parameters=-50.*ones(md.mesh.numberofvertices,1);
+-md.inversion.max_parameters=50.*ones(md.mesh.numberofvertices,1);
+-md.inversion.cost_functions=201;
+-md.inversion.cost_functions_coefficients=ones(md.mesh.numberofvertices,1);
+-md.inversion.gradient_scaling=10./md.constants.yts*ones(md.inversion.nsteps,1);
+-md.inversion.maxiter_per_step=4*ones(md.inversion.nsteps,1);
+-md.inversion.step_threshold=0.99*ones(md.inversion.nsteps,1);
+-
+-md.cluster=generic('name',oshostname(),'np',3);
+-md=solve(md,BalancethicknessSolutionEnum());
+-
+-%Fields and tolerances to track changes
+-field_names     ={'Gradient','Misfits','BalancethicknessThickeningRate','Thickness'};
+-field_tolerances={1e-12,1e-12,1e-12,1e-12,1e-12,1e-12};
+-field_values={...
+-	(md.results.BalancethicknessSolution.Gradient1),...
+-	md.results.BalancethicknessSolution.J,...
+-	(md.results.BalancethicknessSolution.BalancethicknessThickeningRate),...
+-	(md.results.BalancethicknessSolution.Thickness)
+-};
+Index: ../trunk-jpl/test/NightlyRun/test331.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test331.py	(revision 17089)
++++ ../trunk-jpl/test/NightlyRun/test331.py	(revision 17090)
+@@ -1,36 +0,0 @@
+-import numpy
+-import copy
+-from model import *
+-from triangle import *
+-from setmask import *
+-from parameterize import *
+-from setflowequation import *
+-from EnumDefinitions import *
+-from solve import *
+-from MatlabFuncs import *
+-
+-md=triangle(model(),'../Exp/Square.exp',150000.)
+-md=setmask(md,'','')
+-md=parameterize(md,'../Par/SquareSheetConstrained.py')
+-md=setflowequation(md,'SSA','all')
+-md.cluster=generic('name',oshostname(),'np',3)
+-md.initialization.watercolumn=1e-3*numpy.ones((md.mesh.numberofvertices,1))
+-md.hydrology.spcwatercolumn=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
+-pos=numpy.nonzero(numpy.logical_or(md.mesh.y==0.,md.mesh.x==0.))[0]
+-md.hydrology.spcwatercolumn[pos]=2e-3
+-md=solve(md,HydrologySolutionEnum())
+-
+-#Fields and tolerances to track changes
+-field_names     =['HydrologyWaterVx1','HydrologyWaterVy1','WaterColumn1','HydrologyWaterVx2','HydrologyWaterVy2','WaterColumn2','HydrologyWaterVx3','HydrologyWaterVy3','WaterColumn3']
+-field_tolerances=[1e-09,1e-01,1e-09,1e-09,1e-01,1e-09,1e-09,1e-01,1e-09]
+-field_values=[\
+-	md.results.HydrologySolution[0].HydrologyWaterVx,\
+-	md.results.HydrologySolution[0].HydrologyWaterVy,\
+-	md.results.HydrologySolution[0].Watercolumn,\
+-	md.results.HydrologySolution[1].HydrologyWaterVx,\
+-	md.results.HydrologySolution[1].HydrologyWaterVy,\
+-	md.results.HydrologySolution[1].Watercolumn,\
+-	md.results.HydrologySolution[2].HydrologyWaterVx,\
+-	md.results.HydrologySolution[2].HydrologyWaterVy,\
+-	md.results.HydrologySolution[2].Watercolumn,\
+-	]
+Index: ../trunk-jpl/test/NightlyRun/IdToName.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/IdToName.m	(revision 17089)
++++ ../trunk-jpl/test/NightlyRun/IdToName.m	(revision 17090)
+@@ -101,7 +101,6 @@
+ 	case 327, name='SquareSheetConstrainedTransHOEnth';
+ 	case 328, name='SquareSheetConstrainedSmbGradients2d';
+ 	case 329, name='SquareSheetConstrainedSmbGradients3d';
+-	case 331, name='SquareSheetConstrainedHydrologyShreve';
+ 	case 332, name='SquareSheetConstrainedHydrologyDC';
+ 	case 333, name='SquareSheetHydrologyDCTwoLayers';
+ 	case 334, name='SquareSheetConstrainedExtrudedHydrologyDC';
+@@ -170,7 +169,6 @@
+ 	case 609, name='79NorthBalThic2dDG';
+ 	case 610, name='79NorthBalThic3d';
+ 	case 611, name='79NorthCMBalThic2dCG';
+-	case 612, name='79NorthCMBalThic2dDG';
+ 	case 613, name='79NorthCMBalThicVxVy';
+ 	case 701, name='FlowbandFSshelf';
+ 	case 702, name='FlowbandFSsheetshelf';
+Index: ../trunk-jpl/test/NightlyRun/IdToName.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/IdToName.py	(revision 17089)
++++ ../trunk-jpl/test/NightlyRun/IdToName.py	(revision 17090)
+@@ -103,7 +103,6 @@
+ 	327  : 'SquareSheetConstrainedTransHOEnth',
+ 	328  : 'SquareSheetConstrainedSmbGradients2d',
+ 	329  : 'SquareSheetConstrainedSmbGradients3d',
+-	331  : 'SquareSheetConstrainedHydrologyShreve',
+ 	332  : 'SquareSheetConstrainedHydrologyDC',
+ 	333  : 'SquareSheetHydrologyDCTwoLayers',
+ 	401  : 'SquareSheetShelfStressSSA2d',
+@@ -170,7 +169,6 @@
+ 	609  : '79NorthBalThic2dDG',
+ 	610  : '79NorthBalThic3d',
+ 	611  : '79NorthCMBalThic2dCG',
+-	612  : '79NorthCMBalThic2dDG',
+ 	613  : '79NorthCMBalThicVxVy',
+ 	1101 : 'ISMIPAHO',
+ 	1102 : 'ISMIPAFS',
+Index: ../trunk-jpl/test/Archives/Archive331.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive612.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17090-17091.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17090-17091.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17090-17091.diff	(revision 17802)
@@ -0,0 +1,20 @@
+Index: ../trunk-jpl/test/NightlyRun/runme.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/runme.m	(revision 17090)
++++ ../trunk-jpl/test/NightlyRun/runme.m	(revision 17091)
+@@ -232,6 +232,7 @@
+ 
+ 					%something went wrong, print failure message:
+ 					message=getReport(me2);
++					fprintf('%s',message);
+ 					if strcmpi(output,'nightly')
+ 						fid=fopen([ISSM_DIR '/nightlylog/matlaberror.log'], 'at');
+ 						fprintf(fid,'%s',message);
+@@ -254,6 +255,7 @@
+ 
+ 		%something went wrong, print failure message:
+ 		message=getReport(me);
++		fprintf('%s',message);
+ 		if strcmpi(output,'nightly')
+ 			fid=fopen([ISSM_DIR '/nightlylog/matlaberror.log'], 'at');
+ 			fprintf(fid,'%s',message);
Index: issm/oecreview/Archive/16554-17801/ISSM-17091-17092.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17091-17092.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17091-17092.diff	(revision 17802)
@@ -0,0 +1,8 @@
+
+Property changes on: ../trunk-jpl/src/c/modules/SurfaceMassBalancex
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
Index: issm/oecreview/Archive/16554-17801/ISSM-17092-17093.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17092-17093.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17092-17093.diff	(revision 17802)
@@ -0,0 +1,98 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17092)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17093)
+@@ -412,9 +412,10 @@
+ 	 * epsilon=[exx eyy ezz exy exz eyz]
+ 	 */
+ 
+-	IssmDouble epsilonvx[6];
+-	IssmDouble epsilonvy[6];
+-	IssmDouble epsilonvz[6];
++	/*Intermediaries*/
++	IssmDouble dvx[3];
++	IssmDouble dvy[3];
++	IssmDouble dvz[3];
+ 
+ 	/*Check that both inputs have been found*/
+ 	if (!vx_input || !vy_input || !vz_input){
+@@ -422,12 +423,16 @@
+ 	}
+ 
+ 	/*Get strain rate assuming that epsilon has been allocated*/
+-	vx_input->GetVxStrainRate3d(epsilonvx,xyz_list,gauss);
+-	vy_input->GetVyStrainRate3d(epsilonvy,xyz_list,gauss);
+-	vz_input->GetVzStrainRate3d(epsilonvz,xyz_list,gauss);
++	vx_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
++	vy_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
++	vz_input->GetInputDerivativeValue(&dvz[0],xyz_list,gauss);
++	epsilon[0] = dvx[0];
++	epsilon[1] = dvy[1];
++	epsilon[2] = dvz[2];
++	epsilon[3] = 0.5*(dvx[1] + dvy[0]);
++	epsilon[4] = 0.5*(dvx[2] + dvz[0]);
++	epsilon[5] = 0.5*(dvy[2] + dvz[1]);
+ 
+-	/*Sum all contributions*/
+-	for(int i=0;i<6;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i]+epsilonvz[i];
+ }/*}}}*/
+ void Element::StrainRateHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
+ 	/*Compute the 3d Blatter/HOStrain Rate (5 components):
+@@ -440,9 +445,9 @@
+ 	 * the contribution of vz is neglected
+ 	 */
+ 
+-	int i;
+-	IssmDouble epsilonvx[5];
+-	IssmDouble epsilonvy[5];
++	/*Intermediaries*/
++	IssmDouble dvx[3];
++	IssmDouble dvy[3];
+ 
+ 	/*Check that both inputs have been found*/
+ 	if (!vx_input || !vy_input){
+@@ -450,17 +455,20 @@
+ 	}
+ 
+ 	/*Get strain rate assuming that epsilon has been allocated*/
+-	vx_input->GetVxStrainRate3dHO(epsilonvx,xyz_list,gauss);
+-	vy_input->GetVyStrainRate3dHO(epsilonvy,xyz_list,gauss);
++	vx_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
++	vy_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
++	epsilon[0] = dvx[0];
++	epsilon[1] = dvy[1];
++	epsilon[2] = 0.5*(dvx[1] + dvy[0]);
++	epsilon[3] = 0.5*dvx[2];
++	epsilon[4] = 0.5*dvy[2];
+ 
+-	/*Sum all contributions*/
+-	for(i=0;i<5;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i];
+ }/*}}}*/
+ void Element::StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
+ 
+-	int i;
+-	IssmDouble epsilonvx[3];
+-	IssmDouble epsilonvy[3];
++	/*Intermediaries*/
++	IssmDouble dvx[3];
++	IssmDouble dvy[3];
+ 
+ 	/*Check that both inputs have been found*/
+ 	if (!vx_input || !vy_input){
+@@ -468,11 +476,12 @@
+ 	}
+ 
+ 	/*Get strain rate assuming that epsilon has been allocated*/
+-	vx_input->GetVxStrainRate2d(epsilonvx,xyz_list,gauss);
+-	vy_input->GetVyStrainRate2d(epsilonvy,xyz_list,gauss);
++	vx_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
++	vy_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
++	epsilon[0] = dvx[0];
++	epsilon[1] = dvy[1];
++	epsilon[2] = 0.5*(dvx[1] + dvy[0]);
+ 
+-	/*Sum all contributions*/
+-	for(i=0;i<3;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i];
+ }/*}}}*/
+ void Element::TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum){/*{{{*/
+ 	::TransformInvStiffnessMatrixCoord(Ke,this->nodes,this->GetNumberOfNodes(),transformenum);
Index: issm/oecreview/Archive/16554-17801/ISSM-17093-17094.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17093-17094.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17093-17094.diff	(revision 17802)
@@ -0,0 +1,471 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17093)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17094)
+@@ -327,11 +327,8 @@
+ 	 *
+ 	 * A X^3 + A |rho g (s-z) grad(s)|^2 X - |eps_b|_// = 0     */
+ 
+-	int        i;
+ 	IssmDouble z,s,viscosity,p,q,delta;
+ 	IssmDouble tau_perp,tau_par,eps_b,A;
+-	IssmDouble epsilonvx[5]; /*exx eyy exy exz eyz*/
+-	IssmDouble epsilonvy[5]; /*exx eyy exy exz eyz*/
+ 	IssmDouble epsilon[5];   /*exx eyy exy exz eyz*/
+ 	IssmDouble slope[3];
+ 
+@@ -345,9 +342,7 @@
+ 	tau_perp = matpar->GetRhoIce() * matpar->GetG() * fabs(s-z)*sqrt(slope[0]*slope[0]+slope[1]*slope[1]);
+ 
+ 	/* Get eps_b*/
+-	vx_input->GetVxStrainRate3dHO(epsilonvx,xyz_list,gauss);
+-	vy_input->GetVyStrainRate3dHO(epsilonvy,xyz_list,gauss);
+-	for(i=0;i<5;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i];
++	this->StrainRateHO(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
+ 	eps_b = sqrt(epsilon[0]*epsilon[0] + epsilon[1]*epsilon[1] + epsilon[0]*epsilon[1] + epsilon[2]*epsilon[2]);
+ 	if(eps_b==0.){
+ 		*pviscosity = 2.5e+17;
+Index: ../trunk-jpl/src/c/classes/Inputs/DoubleInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/DoubleInput.h	(revision 17093)
++++ ../trunk-jpl/src/c/classes/Inputs/DoubleInput.h	(revision 17094)
+@@ -52,13 +52,6 @@
+ 		void GetInputAverage(IssmDouble* pvalue);
+ 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
+ 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
+-		void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss);
+-		void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss);
+-		void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss);
+-		void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss);
+-		void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, Gauss* gauss);
+-		void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss);
+-		void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss);
+ 		void ChangeEnum(int newenumtype);
+ 		void SquareMin(IssmDouble* psquaremin,Parameters* parameters);
+ 		void ConstrainMin(IssmDouble minimum);
+Index: ../trunk-jpl/src/c/classes/Inputs/SegInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/SegInput.h	(revision 17093)
++++ ../trunk-jpl/src/c/classes/Inputs/SegInput.h	(revision 17094)
+@@ -53,15 +53,7 @@
+ 		void GetInputAverage(IssmDouble* pvalue);
+ 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
+ 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
+-		void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+ 		void ChangeEnum(int newenumtype){_error_("not implemented yet");};
+-
+ 		void SquareMin(IssmDouble* psquaremin,Parameters* parameters){_error_("not implemented yet");};
+ 		void ConstrainMin(IssmDouble minimum){_error_("not implemented yet");};
+ 		void Set(IssmDouble setvalue){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/Input.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/Input.h	(revision 17093)
++++ ../trunk-jpl/src/c/classes/Inputs/Input.h	(revision 17094)
+@@ -35,13 +35,6 @@
+ 		virtual void GetInputAverage(IssmDouble* pvalue)=0;
+ 		virtual void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes)=0;
+ 		virtual void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime)=0;
+-		virtual void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss)=0;
+-		virtual void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss)=0;
+-		virtual void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss)=0;
+-		virtual void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss)=0;
+-		virtual void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, Gauss* gauss)=0;
+-		virtual void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss)=0;
+-		virtual void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss)=0;
+ 		virtual void ChangeEnum(int newenumtype)=0;
+ 		virtual void Configure(Parameters* parameters)=0;
+ 
+Index: ../trunk-jpl/src/c/classes/Inputs/ControlInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/ControlInput.h	(revision 17093)
++++ ../trunk-jpl/src/c/classes/Inputs/ControlInput.h	(revision 17094)
+@@ -58,13 +58,6 @@
+ 		void GetInputAverage(IssmDouble* pvalue);
+ 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
+ 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
+-		void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+ 		void ChangeEnum(int newenumtype){_error_("not implemented yet");};
+ 		void SquareMin(IssmDouble* psquaremin,Parameters* parameters){_error_("not implemented yet");};
+ 		void ConstrainMin(IssmDouble minimum){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/DatasetInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/DatasetInput.h	(revision 17093)
++++ ../trunk-jpl/src/c/classes/Inputs/DatasetInput.h	(revision 17094)
+@@ -54,13 +54,6 @@
+ 		void GetInputAverage(IssmDouble* pvalue){_error_("not implemented yet");};
+ 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
+ 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
+-		void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+ 		void ChangeEnum(int newenumtype){_error_("not implemented yet");};
+ 		void SquareMin(IssmDouble* psquaremin,Parameters* parameters){_error_("not implemented yet");};
+ 		void ConstrainMin(IssmDouble minimum){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 17093)
++++ ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 17094)
+@@ -140,58 +140,6 @@
+ 	TriaRef::GetInputDerivativeValue(p,&values[0],xyz_list,(GaussTria*)gauss);
+ }
+ /*}}}*/
+-/*FUNCTION TriaInput::GetVxStrainRate2d{{{*/
+-void TriaInput::GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){
+-
+-	/*Intermediary*/
+-	int numnodes=this->NumberofNodes();
+-	IssmDouble* B=xNew<IssmDouble>(numnodes*(NDOF2*numnodes));
+-	IssmDouble* velocity=xNew<IssmDouble>(numnodes*NDOF2);
+-
+-	/*Get B matrix: */
+-	GetBSSA(&B[0],xyz_list,gauss);
+-
+-	/*Here, we are computing the strain rate of (vx,0)*/
+-	for(int i=0;i<numnodes;i++){
+-		velocity[2*i+0]=this->values[i];
+-		velocity[2*i+1]=0.;
+-	}
+-	/*Get epsilon(vx) = B*velocity*/
+-	MatrixMultiply(&B[0],numnodes,NDOF2*numnodes,0,
+-				&velocity[0],NDOF2*numnodes,1,0,
+-				epsilonvx,0);
+-
+-	/*clean up*/
+-	xDelete<IssmDouble>(B);
+-	xDelete<IssmDouble>(velocity);
+-}
+-/*}}}*/
+-/*FUNCTION TriaInput::GetVyStrainRate2d{{{*/
+-void TriaInput::GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){
+-
+-	/*Intermediary*/
+-	int numnodes=this->NumberofNodes();
+-	IssmDouble* B=xNew<IssmDouble>(numnodes*(NDOF2*numnodes));
+-	IssmDouble* velocity=xNew<IssmDouble>(numnodes*NDOF2);
+-
+-	/*Get B matrix: */
+-	GetBSSA(&B[0],xyz_list,gauss);
+-
+-	/*Here, we are computing the strain rate of (0,vy)*/
+-	for(int i=0;i<numnodes;i++){
+-		velocity[2*i+0]=0.;
+-		velocity[2*i+1]=this->values[i];
+-	}
+-	/*Get epsilon(vy) = B*velocity*/
+-	MatrixMultiply(&B[0],numnodes,NDOF2*numnodes,0,
+-				&velocity[0],NDOF2*numnodes,1,0,
+-				epsilonvy,0);
+-
+-	/*clean up*/
+-	xDelete<IssmDouble>(B);
+-	xDelete<IssmDouble>(velocity);
+-}
+-/*}}}*/
+ /*FUNCTION TriaInput::ChangeEnum{{{*/
+ void TriaInput::ChangeEnum(int newenumtype){
+ 	this->enum_type=newenumtype;
+Index: ../trunk-jpl/src/c/classes/Inputs/IntInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/IntInput.h	(revision 17093)
++++ ../trunk-jpl/src/c/classes/Inputs/IntInput.h	(revision 17094)
+@@ -53,14 +53,6 @@
+ 		void GetInputAverage(IssmDouble* pvalue){_error_("not implemented yet");};
+ 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
+ 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
+-
+-		void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+ 		void ChangeEnum(int newenumtype);
+ 		void SquareMin(IssmDouble* psquaremin,Parameters* parameters);
+ 		void ConstrainMin(IssmDouble minimum){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/BoolInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/BoolInput.h	(revision 17093)
++++ ../trunk-jpl/src/c/classes/Inputs/BoolInput.h	(revision 17094)
+@@ -49,13 +49,6 @@
+ 		void GetInputAverage(IssmDouble* pvalue){_error_("not implemented yet");};
+ 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
+ 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
+-		void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+ 		void ChangeEnum(int newenumtype);
+ 		void SquareMin(IssmDouble* psquaremin, Parameters* parameters);
+ 		void ConstrainMin(IssmDouble minimum){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/TriaInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TriaInput.h	(revision 17093)
++++ ../trunk-jpl/src/c/classes/Inputs/TriaInput.h	(revision 17094)
+@@ -53,15 +53,7 @@
+ 		void GetInputAverage(IssmDouble* pvalue);
+ 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes);
+ 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime);
+-		void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss);
+-		void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss);
+-		void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+ 		void ChangeEnum(int newenumtype);
+-
+ 		void SquareMin(IssmDouble* psquaremin,Parameters* parameters);
+ 		void ConstrainMin(IssmDouble minimum);
+ 		void Set(IssmDouble setvalue);
+Index: ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 17093)
++++ ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 17094)
+@@ -153,133 +153,6 @@
+ 	PentaRef::GetInputDerivativeValue(p,&values[0],xyz_list,(GaussPenta*)gauss);
+ }
+ /*}}}*/
+-/*FUNCTION PentaInput::GetVxStrainRate3d{{{*/
+-void PentaInput::GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){
+-
+-	/*Intermediary*/
+-	int         numnodes=this->NumberofNodes();
+-	IssmDouble* B=xNew<IssmDouble>(numnodes*(NDOF3*numnodes));
+-	IssmDouble* velocity=xNew<IssmDouble>(numnodes*NDOF3);
+-
+-	/*Get B matrix: */
+-	GetBFSstrainrate(B,xyz_list,gauss);
+-
+-	/*Here, we are computing the strain rate of (vx,0,0)*/
+-	for(int i=0;i<numnodes;i++){
+-		velocity[NDOF3*i+0]=this->values[i];
+-		velocity[NDOF3*i+1]=0.;
+-		velocity[NDOF3*i+2]=0.;
+-	}
+-	/*Multiply B by velocity, to get strain rate: */
+-	MatrixMultiply(B,numnodes,NDOF3*numnodes,0,velocity,NDOF3*numnodes,1,0,epsilonvx,0);
+-
+-	/*Clean-up*/
+-	xDelete<IssmDouble>(B);
+-	xDelete<IssmDouble>(velocity);
+-
+-}
+-/*}}}*/
+-/*FUNCTION PentaInput::GetVyStrainRate3d{{{*/
+-void PentaInput::GetVyStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){
+-
+-	/*Intermediary*/
+-	int         numnodes=this->NumberofNodes();
+-	IssmDouble* B=xNew<IssmDouble>(numnodes*(NDOF3*numnodes));
+-	IssmDouble* velocity=xNew<IssmDouble>(numnodes*NDOF3);
+-
+-	/*Get B matrix: */
+-	GetBFSstrainrate(B,xyz_list,gauss);
+-
+-	/*Here, we are computing the strain rate of (0,vy,0)*/
+-	for(int i=0;i<numnodes;i++){
+-		velocity[NDOF3*i+0]=0.;
+-		velocity[NDOF3*i+1]=this->values[i];
+-		velocity[NDOF3*i+2]=0.;
+-	}
+-	/*Multiply B by velocity, to get strain rate: */
+-	MatrixMultiply(B,numnodes,NDOF3*numnodes,0,velocity,NDOF3*numnodes,1,0,epsilonvx,0);
+-
+-	/*Clean-up*/
+-	xDelete<IssmDouble>(B);
+-	xDelete<IssmDouble>(velocity);
+-}
+-/*}}}*/
+-/*FUNCTION PentaInput::GetVzStrainRate3d{{{*/
+-void PentaInput::GetVzStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){
+-
+-	/*Intermediary*/
+-	int         numnodes=this->NumberofNodes();
+-	IssmDouble* B=xNew<IssmDouble>(numnodes*(NDOF3*numnodes));
+-	IssmDouble* velocity=xNew<IssmDouble>(numnodes*NDOF3);
+-
+-	/*Get B matrix: */
+-	GetBFSstrainrate(B,xyz_list,gauss);
+-
+-	/*Here, we are computing the strain rate of (0,0,vz)*/
+-	for(int i=0;i<numnodes;i++){
+-		velocity[NDOF3*i+0]=0.;
+-		velocity[NDOF3*i+1]=0.;
+-		velocity[NDOF3*i+2]=this->values[i];
+-	}
+-	/*Multiply B by velocity, to get strain rate: */
+-	MatrixMultiply(B,numnodes,NDOF3*numnodes,0,velocity,NDOF3*numnodes,1,0,epsilonvx,0);
+-
+-	/*Clean-up*/
+-	xDelete<IssmDouble>(B);
+-	xDelete<IssmDouble>(velocity);
+-}
+-/*}}}*/
+-/*FUNCTION PentaInput::GetVxStrainRate3dHO{{{*/
+-void PentaInput::GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){
+-
+-	int i;
+-	const int numnodes=6;
+-	IssmDouble B[5][NDOF2*numnodes];
+-	IssmDouble velocity[numnodes][NDOF2];
+-
+-	/*Get B matrix: */
+-	GetBHO(&B[0][0], xyz_list, gauss);
+-
+-	_assert_(this->NumberofNodes()==6); //Check Tria too
+-
+-	/*Here, we are computing the strain rate of (vx,0)*/
+-	for(i=0;i<numnodes;i++){
+-		velocity[i][0]=this->values[i];
+-		velocity[i][1]=0.0;
+-	}
+-
+-	/*Multiply B by velocity, to get strain rate: */
+-	MatrixMultiply( &B[0][0],5,NDOF2*numnodes,0,
+-				&velocity[0][0],NDOF2*numnodes,1,0,
+-				epsilonvx,0);
+-
+-}
+-/*}}}*/
+-/*FUNCTION PentaInput::GetVyStrainRate3dHO{{{*/
+-void PentaInput::GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){
+-
+-	int i;
+-	const int numnodes=6;
+-	IssmDouble B[5][NDOF2*numnodes];
+-	IssmDouble velocity[numnodes][NDOF2];
+-
+-	/*Get B matrix: */
+-	GetBHO(&B[0][0], xyz_list, gauss);
+-	_assert_(this->NumberofNodes()==6); //Check Tria too
+-
+-	/*Here, we are computing the strain rate of (0,vy)*/
+-	for(i=0;i<numnodes;i++){
+-		velocity[i][0]=0.0;
+-		velocity[i][1]=this->values[i];
+-	}
+-
+-	/*Multiply B by velocity, to get strain rate: */
+-	MatrixMultiply( &B[0][0],5,NDOF2*numnodes,0,
+-				&velocity[0][0],NDOF2*numnodes,1,0,
+-				epsilonvy,0);
+-
+-}
+-/*}}}*/
+ /*FUNCTION PentaInput::ChangeEnum{{{*/
+ void PentaInput::ChangeEnum(int newenumtype){
+ 	this->enum_type=newenumtype;
+Index: ../trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp	(revision 17093)
++++ ../trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp	(revision 17094)
+@@ -122,48 +122,6 @@
+ /*FUNCTION DoubleInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){{{*/
+ void DoubleInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){*pvalue=this->value;}
+ /*}}}*/
+-/*FUNCTION DoubleInput::GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){{{*/
+-void DoubleInput::GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){
+-	/*Epsilon is zero as vx is constant over the element*/
+-	for(int i=0;i<3;i++) epsilonvx[i]=0;
+-}
+-/*}}}*/
+-/*FUNCTION DoubleInput::GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){{{*/
+-void DoubleInput::GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){
+-	/*Epsilon is zero as vy is constant over the element*/
+-	for(int i=0;i<3;i++) epsilonvy[i]=0;
+-}
+-/*}}}*/
+-/*FUNCTION DoubleInput::GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){{{*/
+-void DoubleInput::GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){
+-	/*Epsilon is zero as vx is constant over the element*/
+-	for(int i=0;i<6;i++) epsilonvx[i]=0;
+-}
+-/*}}}*/
+-/*FUNCTION DoubleInput::GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){{{*/
+-void DoubleInput::GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){
+-	/*Epsilon is zero as vy is constant over the element*/
+-	for(int i=0;i<6;i++) epsilonvy[i]=0;
+-}
+-/*}}}*/
+-/*FUNCTION DoubleInput::GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, Gauss* gauss){{{*/
+-void DoubleInput::GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, Gauss* gauss){
+-	/*Epsilon is zero as vz is constant over the element*/
+-	for(int i=0;i<6;i++) epsilonvz[i]=0;
+-}
+-/*}}}*/
+-/*FUNCTION DoubleInput::GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){{{*/
+-void DoubleInput::GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){
+-	/*Epsilon is zero as vx is constant over the element*/
+-	for(int i=0;i<5;i++) epsilonvx[i]=0;
+-}
+-/*}}}*/
+-/*FUNCTION DoubleInput::GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){{{*/
+-void DoubleInput::GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){
+-	/*Epsilon is zero as vy is constant over the element*/
+-	for(int i=0;i<5;i++) epsilonvy[i]=0;
+-}
+-/*}}}*/
+ /*FUNCTION DoubleInput::ChangeEnum{{{*/
+ void DoubleInput::ChangeEnum(int newenumtype){
+ 	this->enum_type=newenumtype;
+Index: ../trunk-jpl/src/c/classes/Inputs/PentaInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/PentaInput.h	(revision 17093)
++++ ../trunk-jpl/src/c/classes/Inputs/PentaInput.h	(revision 17094)
+@@ -52,16 +52,7 @@
+ 		void GetInputAverage(IssmDouble* pvalue);
+ 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
+ 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
+-
+-		void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss);
+-		void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss);
+-		void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, Gauss* gauss);
+-		void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss);
+-		void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss);
+ 		void ChangeEnum(int newenumtype);
+-
+ 		void SquareMin(IssmDouble* psquaremin,Parameters* parameters);
+ 		void ConstrainMin(IssmDouble minimum);
+ 		void Set(IssmDouble setvalue){_error_("Set not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/TransientInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TransientInput.h	(revision 17093)
++++ ../trunk-jpl/src/c/classes/Inputs/TransientInput.h	(revision 17094)
+@@ -58,15 +58,7 @@
+ 		void GetInputAverage(IssmDouble* pvalue);
+ 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes);
+ 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime);
+-		void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVxStrainRate3dHO(IssmDouble* epsilonvx,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+-		void GetVyStrainRate3dHO(IssmDouble* epsilonvy,IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
+ 		void ChangeEnum(int newenumtype);
+-
+ 		void SquareMin(IssmDouble* psquaremin,Parameters* parameters);
+ 		void ConstrainMin(IssmDouble minimum){_error_("not implemented yet");};
+ 		void Set(IssmDouble setvalue){_error_("Set not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-17094-17095.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17094-17095.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17094-17095.diff	(revision 17802)
@@ -0,0 +1,1617 @@
+Index: ../trunk-jpl/src/c/classes/Elements/TriaRef.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TriaRef.h	(revision 17094)
++++ ../trunk-jpl/src/c/classes/Elements/TriaRef.h	(revision 17095)
+@@ -22,22 +22,10 @@
+ 		void SetElementType(int type,int type_counter);
+ 
+ 		/*Numerics*/
+-		void GetBExtrusion(IssmDouble* B_prime, IssmDouble* xyz_list, Gauss* gauss);
+-		void GetBFS(IssmDouble* B_prime, IssmDouble* xyz_list, Gauss* gauss);
+-		void GetBSSA(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss);
+-		void GetBSSAFS(IssmDouble* B , IssmDouble* xyz_list, Gauss* gauss);
+-		void GetBprimeFS(IssmDouble* B_prime, IssmDouble* xyz_list, Gauss* gauss);
+-		void GetBprimeSSA(IssmDouble* Bprime, IssmDouble* xyz_list, Gauss* gauss);
+-		void GetBprimeSSAFS(IssmDouble* Bprime, IssmDouble* xyz_list, Gauss* gauss);
+-		void GetBprimeMasstransport(IssmDouble* Bprime, IssmDouble* xyz_list, Gauss* gauss);
+-		void GetBMasstransport(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss);
+-		void GetBHydro(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss);
+-		void GetBSSAFriction(IssmDouble* L, IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetJacobian(IssmDouble* J, IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSegmentJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetJacobianInvert(IssmDouble*  Jinv, IssmDouble* xyz_list,Gauss* gauss);
+-		void GetLFS(IssmDouble* LFS, Gauss* gauss);
+ 		void GetNodalFunctions(IssmDouble* basis,Gauss* gauss);
+ 		void GetNodalFunctions(IssmDouble* basis,Gauss* gauss,int finiteelement);
+ 		void GetNodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss);
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17094)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17095)
+@@ -55,1112 +55,6 @@
+ /*}}}*/
+ 
+ /*Reference Element numerics*/
+-/*FUNCTION PentaRef::GetBSSAHO {{{*/
+-void PentaRef::GetBSSAHO(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss){
+-	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF2. 
+-	 * For node i, Bi can be expressed in the actual coordinate system
+-	 * by: 
+-	 *       Bi=[ dh/dx          0      ]
+-	 *          [   0           dh/dy   ]
+-	 *          [ 1/2*dh/dy  1/2*dh/dx  ]
+-	 * where h is the interpolation function for node i.
+-	 *
+-	 * We assume B has been allocated already, of size: 5x(NDOF2*NUMNODESP1)
+-	 */
+-
+-	IssmDouble dbasis[3][NUMNODESP1];
+-
+-	/*Get dbasis in actual coordinate system: */
+-	GetNodalFunctionsP1Derivatives(&dbasis[0][0],xyz_list, gauss);
+-
+-	/*Build B: */
+-	for(int i=0;i<NUMNODESP1;i++){
+-		B[NDOF2*NUMNODESP1*0+NDOF2*i+0] = dbasis[0][i];
+-		B[NDOF2*NUMNODESP1*0+NDOF2*i+1] = 0.;
+-
+-		B[NDOF2*NUMNODESP1*1+NDOF2*i+0] = 0.;
+-		B[NDOF2*NUMNODESP1*1+NDOF2*i+1] = dbasis[1][i];
+-
+-		B[NDOF2*NUMNODESP1*2+NDOF2*i+0] = .5*dbasis[1][i];
+-		B[NDOF2*NUMNODESP1*2+NDOF2*i+1] = .5*dbasis[0][i];
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION PentaRef::GetBSSAFS{{{*/
+-void PentaRef::GetBSSAFS(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss){
+-	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF2. 
+-	 * For node i, Bi can be expressed in the actual coordinate system
+-	 * by: 
+-	 *       Bi=[ dh/dx          0       0   0 ]
+-	 *          [   0           dh/dy    0   0 ]
+-	 *          [ 1/2*dh/dy  1/2*dh/dx   0   0 ]
+-	 *          [   0            0       0   h ]
+-	 * where h is the interpolation function for node i.
+-	 *
+-	 * We assume B has been allocated already, of size: 5x(NDOF2*NUMNODESP1)
+-	 */
+-
+-	int i;
+-	IssmDouble dbasismini[3][NUMNODESP1b];
+-	IssmDouble basis[NUMNODESP1];
+-
+-	/*Get dbasis in actual coordinate system: */
+-	GetNodalFunctionsMINIDerivatives(&dbasismini[0][0],xyz_list, gauss);
+-	GetNodalFunctionsP1(basis,gauss);
+-
+-	/*Build B: */
+-	for(i=0;i<NUMNODESP1;i++){
+-		B[(NDOF3*NUMNODESP1b+NUMNODESP1)*0+NDOF3*i+0] = dbasismini[0][i];
+-		B[(NDOF3*NUMNODESP1b+NUMNODESP1)*0+NDOF3*i+1] = 0.;
+-		B[(NDOF3*NUMNODESP1b+NUMNODESP1)*0+NDOF3*i+2] = 0.;
+-		B[(NDOF3*NUMNODESP1b+NUMNODESP1)*1+NDOF3*i+0] = 0.;
+-		B[(NDOF3*NUMNODESP1b+NUMNODESP1)*1+NDOF3*i+1] = dbasismini[1][i];
+-		B[(NDOF3*NUMNODESP1b+NUMNODESP1)*1+NDOF3*i+2] = 0.;
+-		B[(NDOF3*NUMNODESP1b+NUMNODESP1)*2+NDOF3*i+0] = 0.5*dbasismini[1][i];
+-		B[(NDOF3*NUMNODESP1b+NUMNODESP1)*2+NDOF3*i+1] = 0.5*dbasismini[0][i];
+-		B[(NDOF3*NUMNODESP1b+NUMNODESP1)*2+NDOF3*i+2] = 0.;
+-		B[(NDOF3*NUMNODESP1b+NUMNODESP1)*3+NDOF3*i+0] = 0.;
+-		B[(NDOF3*NUMNODESP1b+NUMNODESP1)*3+NDOF3*i+1] = 0.;
+-		B[(NDOF3*NUMNODESP1b+NUMNODESP1)*3+NDOF3*i+2] = 0.;
+-	}
+-	for(i=0;i<1;i++){
+-		B[(NDOF3*NUMNODESP1b+NUMNODESP1)*0+NDOF3*(NUMNODESP1+i)+0] = 0.;
+-		B[(NDOF3*NUMNODESP1b+NUMNODESP1)*0+NDOF3*(NUMNODESP1+i)+1] = 0.;
+-		B[(NDOF3*NUMNODESP1b+NUMNODESP1)*0+NDOF3*(NUMNODESP1+i)+2] = 0.;
+-		B[(NDOF3*NUMNODESP1b+NUMNODESP1)*1+NDOF3*(NUMNODESP1+i)+0] = 0.;
+-		B[(NDOF3*NUMNODESP1b+NUMNODESP1)*1+NDOF3*(NUMNODESP1+i)+1] = 0.;
+-		B[(NDOF3*NUMNODESP1b+NUMNODESP1)*1+NDOF3*(NUMNODESP1+i)+2] = 0.;
+-		B[(NDOF3*NUMNODESP1b+NUMNODESP1)*2+NDOF3*(NUMNODESP1+i)+0] = 0.;
+-		B[(NDOF3*NUMNODESP1b+NUMNODESP1)*2+NDOF3*(NUMNODESP1+i)+1] = 0.;
+-		B[(NDOF3*NUMNODESP1b+NUMNODESP1)*2+NDOF3*(NUMNODESP1+i)+2] = 0.;
+-		B[(NDOF3*NUMNODESP1b+NUMNODESP1)*3+NDOF3*(NUMNODESP1+i)+0] = 0.;
+-		B[(NDOF3*NUMNODESP1b+NUMNODESP1)*3+NDOF3*(NUMNODESP1+i)+1] = 0.;
+-		B[(NDOF3*NUMNODESP1b+NUMNODESP1)*3+NDOF3*(NUMNODESP1+i)+2] = 0.;
+-	}
+-
+-	for(i=0;i<NUMNODESP1;i++){ //last column not for the bubble function
+-		B[(NDOF3*NUMNODESP1b+NUMNODESP1)*0+NUMNODESP1b*NDOF3+i] = 0;
+-		B[(NDOF3*NUMNODESP1b+NUMNODESP1)*1+NUMNODESP1b*NDOF3+i] = 0;
+-		B[(NDOF3*NUMNODESP1b+NUMNODESP1)*2+NUMNODESP1b*NDOF3+i] = 0;
+-		B[(NDOF3*NUMNODESP1b+NUMNODESP1)*3+NUMNODESP1b*NDOF3+i] = basis[i];
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION PentaRef::GetBHO {{{*/
+-void PentaRef::GetBHO(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss){
+-	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF2. 
+-	 * For node i, Bi can be expressed in the actual coordinate system
+-	 * by: 
+-	 *       Bi=[ dh/dx          0      ]
+-	 *          [   0           dh/dy   ]
+-	 *          [ 1/2*dh/dy  1/2*dh/dx  ]
+-	 *          [ 1/2*dh/dz      0      ]
+-	 *          [  0         1/2*dh/dz  ]
+-	 * where h is the interpolation function for node i.
+-	 *
+-	 * We assume B has been allocated already, of size: 5x(NDOF2*numnodes)
+-	 */
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Get nodal functions derivatives*/
+-	IssmDouble* dbasis=xNew<IssmDouble>(3*numnodes);
+-	GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-
+-	/*Build B: */
+-	for(int i=0;i<numnodes;i++){
+-		B[NDOF2*numnodes*0+NDOF2*i+0] = dbasis[0*numnodes+i];
+-		B[NDOF2*numnodes*0+NDOF2*i+1] = 0.;
+-		B[NDOF2*numnodes*1+NDOF2*i+0] = 0.;
+-		B[NDOF2*numnodes*1+NDOF2*i+1] = dbasis[1*numnodes+i];
+-		B[NDOF2*numnodes*2+NDOF2*i+0] = .5*dbasis[1*numnodes+i];
+-		B[NDOF2*numnodes*2+NDOF2*i+1] = .5*dbasis[0*numnodes+i];
+-		B[NDOF2*numnodes*3+NDOF2*i+0] = .5*dbasis[2*numnodes+i];
+-		B[NDOF2*numnodes*3+NDOF2*i+1] = 0.;
+-		B[NDOF2*numnodes*4+NDOF2*i+0] = 0.;
+-		B[NDOF2*numnodes*4+NDOF2*i+1] = .5*dbasis[2*numnodes+i];
+-	}
+-
+-	/*Clean-up*/
+-	xDelete<IssmDouble>(dbasis);
+-}
+-/*}}}*/
+-/*FUNCTION PentaRef::GetBprimeHO {{{*/
+-void PentaRef::GetBprimeHO(IssmDouble* B,IssmDouble* xyz_list,Gauss* gauss){
+-	/*Compute B  prime matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF2. 
+-	 * For node i, Bi can be expressed in the actual coordinate system
+-	 * by: 
+-	 *       Bi=[ 2*dh/dx     dh/dy   ]
+-	 *          [   dh/dx    2*dh/dy  ]
+-	 *          [ dh/dy      dh/dx    ]
+-	 *          [ dh/dz         0     ]
+-	 *          [  0         dh/dz    ]
+-	 * where h is the interpolation function for node i.
+-	 *
+-	 * We assume B has been allocated already, of size: 5x(NDOF2*numnodes)
+-	 */
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Get nodal functions derivatives*/
+-	IssmDouble* dbasis=xNew<IssmDouble>(3*numnodes);
+-	GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-
+-	/*Build BPrime: */
+-	for(int i=0;i<numnodes;i++){
+-		B[NDOF2*numnodes*0+NDOF2*i+0]=2.*dbasis[0*numnodes+i]; 
+-		B[NDOF2*numnodes*0+NDOF2*i+1]=dbasis[1*numnodes+i];
+-		B[NDOF2*numnodes*1+NDOF2*i+0]=dbasis[0*numnodes+i];
+-		B[NDOF2*numnodes*1+NDOF2*i+1]=2.*dbasis[1*numnodes+i];
+-		B[NDOF2*numnodes*2+NDOF2*i+0]=dbasis[1*numnodes+i]; 
+-		B[NDOF2*numnodes*2+NDOF2*i+1]=dbasis[0*numnodes+i]; 
+-		B[NDOF2*numnodes*3+NDOF2*i+0]=dbasis[2*numnodes+i]; 
+-		B[NDOF2*numnodes*3+NDOF2*i+1]=0.;
+-		B[NDOF2*numnodes*4+NDOF2*i+0]=0.;
+-		B[NDOF2*numnodes*4+NDOF2*i+1]=dbasis[2*numnodes+i]; 
+-	}
+-
+-	/*Clean-up*/
+-	xDelete<IssmDouble>(dbasis);
+-}
+-/*}}}*/
+-/*FUNCTION PentaRef::GetBprimeSSAFS{{{*/
+-void PentaRef::GetBprimeSSAFS(IssmDouble* Bprime, IssmDouble* xyz_list, Gauss* gauss){
+-	/*Compute Bprime  matrix. Bprime=[Bprime1 Bprime2 Bprime3 Bprime4 Bprime5 Bprime6] where Bprimei is of size 5*NDOF2. 
+-	 * For node i, Bprimei can be expressed in the actual coordinate system
+-	 * by: 
+-	 *       Bprimei=[ 2*dh/dx    dh/dy   0   0 ]
+-	 *               [  dh/dx    2*dh/dy  0   0 ]
+-	 *               [  dh/dy     dh/dx   0   0 ]
+-	 * where h is the interpolation function for node i.
+-	 *
+-	 * We assume Bprime has been allocated already, of size: 5x(NDOF2*NUMNODESP1)
+-	 */
+-
+-	int    i;
+-	IssmDouble dbasismini[3][NUMNODESP1b];
+-
+-	/*Get dbasis in actual coordinate system: */
+-	GetNodalFunctionsMINIDerivatives(&dbasismini[0][0],xyz_list, gauss);
+-
+-	/*Build Bprime: */
+-	for(i=0;i<NUMNODESP1;i++){
+-		Bprime[(NDOF3*NUMNODESP1b+NUMNODESP1)*0+NDOF3*i+0] = 2.*dbasismini[0][i];
+-		Bprime[(NDOF3*NUMNODESP1b+NUMNODESP1)*0+NDOF3*i+1] = dbasismini[1][i];
+-		Bprime[(NDOF3*NUMNODESP1b+NUMNODESP1)*0+NDOF3*i+2] = 0.;
+-		Bprime[(NDOF3*NUMNODESP1b+NUMNODESP1)*1+NDOF3*i+0] = dbasismini[0][i];
+-		Bprime[(NDOF3*NUMNODESP1b+NUMNODESP1)*1+NDOF3*i+1] = 2.*dbasismini[1][i];
+-		Bprime[(NDOF3*NUMNODESP1b+NUMNODESP1)*1+NDOF3*i+2] = 0.;
+-		Bprime[(NDOF3*NUMNODESP1b+NUMNODESP1)*2+NDOF3*i+0] = dbasismini[1][i];
+-		Bprime[(NDOF3*NUMNODESP1b+NUMNODESP1)*2+NDOF3*i+1] = dbasismini[0][i];
+-		Bprime[(NDOF3*NUMNODESP1b+NUMNODESP1)*2+NDOF3*i+2] = 0.;
+-	}
+-
+-	for(i=0;i<1;i++){ //Add zeros for the bubble function
+-		Bprime[(NDOF3*NUMNODESP1b+NUMNODESP1)*0+NDOF3*(NUMNODESP1+i)+0] = 0.;
+-		Bprime[(NDOF3*NUMNODESP1b+NUMNODESP1)*0+NDOF3*(NUMNODESP1+i)+1] = 0.;
+-		Bprime[(NDOF3*NUMNODESP1b+NUMNODESP1)*0+NDOF3*(NUMNODESP1+i)+2] = 0.;
+-		Bprime[(NDOF3*NUMNODESP1b+NUMNODESP1)*1+NDOF3*(NUMNODESP1+i)+0] = 0.;
+-		Bprime[(NDOF3*NUMNODESP1b+NUMNODESP1)*1+NDOF3*(NUMNODESP1+i)+1] = 0.;
+-		Bprime[(NDOF3*NUMNODESP1b+NUMNODESP1)*1+NDOF3*(NUMNODESP1+i)+2] = 0.;
+-		Bprime[(NDOF3*NUMNODESP1b+NUMNODESP1)*2+NDOF3*(NUMNODESP1+i)+0] = 0.;
+-		Bprime[(NDOF3*NUMNODESP1b+NUMNODESP1)*2+NDOF3*(NUMNODESP1+i)+1] = 0.;
+-		Bprime[(NDOF3*NUMNODESP1b+NUMNODESP1)*2+NDOF3*(NUMNODESP1+i)+2] = 0.;
+-	}
+-
+-	for(i=0;i<NUMNODESP1;i++){ //last column not for the bubble function
+-		Bprime[(NDOF3*NUMNODESP1b+NUMNODESP1)*0+NUMNODESP1b*NDOF3+i] = 0.;
+-		Bprime[(NDOF3*NUMNODESP1b+NUMNODESP1)*1+NUMNODESP1b*NDOF3+i] = 0.;
+-		Bprime[(NDOF3*NUMNODESP1b+NUMNODESP1)*2+NUMNODESP1b*NDOF3+i] = 0.;
+-	}
+-
+-}
+-/*}}}*/
+-/*FUNCTION PentaRef::GetBFSstrainrate {{{*/
+-void PentaRef::GetBFSstrainrate(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss){
+-
+-	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 3*NDOF4. 
+-	 * For node i, Bi can be expressed in the actual coordinate system
+-	 * by: 		Bi=[ dh/dx          0              0     ]
+-	 *					[   0           dh/dy           0     ]
+-	 *					[   0             0           dh/dy   ]
+-	 *					[ 1/2*dh/dy    1/2*dh/dx        0     ]
+-	 *					[ 1/2*dh/dz       0         1/2*dh/dx ]
+-	 *					[   0          1/2*dh/dz    1/2*dh/dy ]
+-	 *	where h is the interpolation function for node i.
+-	 *	Same thing for Bb except the last column that does not exist.
+-	 */
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Get nodal functions derivatives*/
+-	IssmDouble* dbasis=xNew<IssmDouble>(3*numnodes);
+-	GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-
+-	/*Build B: */
+-	for(int i=0;i<numnodes;i++){
+-		B[3*numnodes*0+3*i+0] = dbasis[0*numnodes+i+0];
+-		B[3*numnodes*0+3*i+1] = 0.;
+-		B[3*numnodes*0+3*i+2] = 0.;
+-
+-		B[3*numnodes*1+3*i+0] = 0.;
+-		B[3*numnodes*1+3*i+1] = dbasis[1*numnodes+i+0];
+-		B[3*numnodes*1+3*i+2] = 0.;
+-
+-		B[3*numnodes*2+3*i+0] = 0.;
+-		B[3*numnodes*2+3*i+1] = 0.;
+-		B[3*numnodes*2+3*i+2] = dbasis[2*numnodes+i+0];
+-
+-		B[3*numnodes*3+3*i+0] = .5*dbasis[1*numnodes+i+0];
+-		B[3*numnodes*3+3*i+1] = .5*dbasis[0*numnodes+i+0];
+-		B[3*numnodes*3+3*i+2] = 0.;
+-
+-		B[3*numnodes*4+3*i+0] = .5*dbasis[2*numnodes+i+0];
+-		B[3*numnodes*4+3*i+1] = 0.;
+-		B[3*numnodes*4+3*i+2] = .5*dbasis[0*numnodes+i+0];
+-
+-		B[3*numnodes*5+3*i+0] = 0.;
+-		B[3*numnodes*5+3*i+1] = .5*dbasis[2*numnodes+i+0];
+-		B[3*numnodes*5+3*i+2] = .5*dbasis[1*numnodes+i+0];
+-	}
+-
+-	/*Clean up*/
+-	xDelete<IssmDouble>(dbasis);
+-}
+-/*}}}*/
+-/*FUNCTION PentaRef::GetBFS {{{*/
+-void PentaRef::GetBFS(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss){
+-
+-	/*Compute B  matrix. B=[Bv1 Bv2 ... Bp1 Bp2 ...] where Bvi is of size 3*NDOF3. 
+-	 * For node i, Bvi can be expressed in the actual coordinate system
+-	 * by: 	   Bvi=[ dh/dx          0             0      ]
+-	 *					[   0           dh/dy           0      ]
+-	 *					[   0             0           dh/dz    ]
+-	 *					[ 1/2*dh/dy    1/2*dh/dx        0      ]
+-	 *					[ 1/2*dh/dz       0         1/2*dh/dx  ]
+-	 *					[   0          1/2*dh/dz    1/2*dh/dy  ]
+-	 *					[   0             0             0      ]
+-	 *					[ dh/dx         dh/dy         dh/dz    ]
+-	 *
+-	 * by: 	  Bpi=[ 0 ]
+-	 *					[ 0 ]
+-	 *					[ 0 ]
+-	 *					[ 0 ]
+-	 *					[ 0 ]
+-	 *					[ 0 ]
+-	 *					[ h ]
+-	 *					[ 0 ]
+-	 *	where h is the interpolation function for node i.
+-	 *	Same thing for Bb except the last column that does not exist.
+-	 */
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int pnumnodes = this->NumberofNodesPressure();
+-	int vnumnodes = this->NumberofNodesVelocity();
+-
+-	/*Get nodal functions derivatives*/
+-	IssmDouble* vdbasis=xNew<IssmDouble>(3*vnumnodes);
+-	IssmDouble* pbasis =xNew<IssmDouble>(pnumnodes);
+-	GetNodalFunctionsDerivativesVelocity(vdbasis,xyz_list,gauss);
+-	GetNodalFunctionsPressure(pbasis,gauss);
+-
+-	/*Build B: */
+-	for(int i=0;i<vnumnodes;i++){
+-		B[(3*vnumnodes+pnumnodes)*0+3*i+0] = vdbasis[0*vnumnodes+i];
+-		B[(3*vnumnodes+pnumnodes)*0+3*i+1] = 0.;
+-		B[(3*vnumnodes+pnumnodes)*0+3*i+2] = 0.;
+-		B[(3*vnumnodes+pnumnodes)*1+3*i+0] = 0.;
+-		B[(3*vnumnodes+pnumnodes)*1+3*i+1] = vdbasis[1*vnumnodes+i];
+-		B[(3*vnumnodes+pnumnodes)*1+3*i+2] = 0.;
+-		B[(3*vnumnodes+pnumnodes)*2+3*i+0] = 0.;
+-		B[(3*vnumnodes+pnumnodes)*2+3*i+1] = 0.;
+-		B[(3*vnumnodes+pnumnodes)*2+3*i+2] = vdbasis[2*vnumnodes+i];
+-		B[(3*vnumnodes+pnumnodes)*3+3*i+0] = .5*vdbasis[1*vnumnodes+i];
+-		B[(3*vnumnodes+pnumnodes)*3+3*i+1] = .5*vdbasis[0*vnumnodes+i];
+-		B[(3*vnumnodes+pnumnodes)*3+3*i+2] = 0.;
+-		B[(3*vnumnodes+pnumnodes)*4+3*i+0] = .5*vdbasis[2*vnumnodes+i];
+-		B[(3*vnumnodes+pnumnodes)*4+3*i+1] = 0.;
+-		B[(3*vnumnodes+pnumnodes)*4+3*i+2] = .5*vdbasis[0*vnumnodes+i];
+-		B[(3*vnumnodes+pnumnodes)*5+3*i+0] = 0.;
+-		B[(3*vnumnodes+pnumnodes)*5+3*i+1] = .5*vdbasis[2*vnumnodes+i];
+-		B[(3*vnumnodes+pnumnodes)*5+3*i+2] = .5*vdbasis[1*vnumnodes+i];
+-		B[(3*vnumnodes+pnumnodes)*6+3*i+0] = 0.;
+-		B[(3*vnumnodes+pnumnodes)*6+3*i+1] = 0.;
+-		B[(3*vnumnodes+pnumnodes)*6+3*i+2] = 0.;
+-		B[(3*vnumnodes+pnumnodes)*7+3*i+0] = vdbasis[0*vnumnodes+i];
+-		B[(3*vnumnodes+pnumnodes)*7+3*i+1] = vdbasis[1*vnumnodes+i];
+-		B[(3*vnumnodes+pnumnodes)*7+3*i+2] = vdbasis[2*vnumnodes+i];
+-	}
+-	for(int i=0;i<pnumnodes;i++){
+-		B[(3*vnumnodes+pnumnodes)*0+(3*vnumnodes)+i] = 0.;
+-		B[(3*vnumnodes+pnumnodes)*1+(3*vnumnodes)+i] = 0.;
+-		B[(3*vnumnodes+pnumnodes)*2+(3*vnumnodes)+i] = 0.;
+-		B[(3*vnumnodes+pnumnodes)*3+(3*vnumnodes)+i] = 0.;
+-		B[(3*vnumnodes+pnumnodes)*4+(3*vnumnodes)+i] = 0.;
+-		B[(3*vnumnodes+pnumnodes)*5+(3*vnumnodes)+i] = 0.;
+-		B[(3*vnumnodes+pnumnodes)*6+(3*vnumnodes)+i] = pbasis[i];
+-		B[(3*vnumnodes+pnumnodes)*7+(3*vnumnodes)+i] = 0.;
+-	}
+-
+-	/*Clean up*/
+-	xDelete<IssmDouble>(vdbasis);
+-	xDelete<IssmDouble>(pbasis);
+-}
+-/*}}}*/
+-/*FUNCTION PentaRef::GetBFSGLS {{{*/
+-void PentaRef::GetBFSGLS(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss){
+-
+-	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 3*NDOF4. 
+-	 * For node i, Bi can be expressed in the actual coordinate system
+-	 * by: 		Bi=[ dh/dx          0              0       0  ]
+-	 *					[   0           dh/dy           0       0  ]
+-	 *					[   0             0           dh/dy     0  ]
+-	 *					[ 1/2*dh/dy    1/2*dh/dx        0       0  ]
+-	 *					[ 1/2*dh/dz       0         1/2*dh/dx   0  ]
+-	 *					[   0          1/2*dh/dz    1/2*dh/dy   0  ]
+-	 *					[   0             0             0       h  ]
+-	 *					[ dh/dx         dh/dy         dh/dz     0  ]
+-	 *	where h is the interpolation function for node i.
+-	 *	Same thing for Bb except the last column that does not exist.
+-	 */
+-
+-	int i;
+-	IssmDouble dbasis[3][NUMNODESP1];
+-	IssmDouble basis[NUMNODESP1];
+-
+-	/*Get dbasismini in actual coordinate system: */
+-	GetNodalFunctionsP1Derivatives(&dbasis[0][0],xyz_list, gauss);
+-	GetNodalFunctionsP1(&basis[0], gauss);
+-
+-	/*Build B: */
+-	for(i=0;i<NUMNODESP1;i++){
+-		B[(NDOF4*NUMNODESP1)*0+NDOF4*i+0] = dbasis[0][i];
+-		B[(NDOF4*NUMNODESP1)*0+NDOF4*i+1] = 0.;
+-		B[(NDOF4*NUMNODESP1)*0+NDOF4*i+2] = 0.;
+-		B[(NDOF4*NUMNODESP1)*1+NDOF4*i+0] = 0.;
+-		B[(NDOF4*NUMNODESP1)*1+NDOF4*i+1] = dbasis[1][i];
+-		B[(NDOF4*NUMNODESP1)*1+NDOF4*i+2] = 0.;
+-		B[(NDOF4*NUMNODESP1)*2+NDOF4*i+0] = 0.;
+-		B[(NDOF4*NUMNODESP1)*2+NDOF4*i+1] = 0.;
+-		B[(NDOF4*NUMNODESP1)*2+NDOF4*i+2] = dbasis[2][i];
+-		B[(NDOF4*NUMNODESP1)*3+NDOF4*i+0] = .5*dbasis[1][i];
+-		B[(NDOF4*NUMNODESP1)*3+NDOF4*i+1] = .5*dbasis[0][i];
+-		B[(NDOF4*NUMNODESP1)*3+NDOF4*i+2] = 0.;
+-		B[(NDOF4*NUMNODESP1)*4+NDOF4*i+0] = .5*dbasis[2][i];
+-		B[(NDOF4*NUMNODESP1)*4+NDOF4*i+1] = 0.;
+-		B[(NDOF4*NUMNODESP1)*4+NDOF4*i+2] = .5*dbasis[0][i];
+-		B[(NDOF4*NUMNODESP1)*5+NDOF4*i+0] = 0.;
+-		B[(NDOF4*NUMNODESP1)*5+NDOF4*i+1] = .5*dbasis[2][i];
+-		B[(NDOF4*NUMNODESP1)*5+NDOF4*i+2] = .5*dbasis[1][i];
+-		B[(NDOF4*NUMNODESP1)*6+NDOF4*i+0] = 0.;
+-		B[(NDOF4*NUMNODESP1)*6+NDOF4*i+1] = 0.;
+-		B[(NDOF4*NUMNODESP1)*6+NDOF4*i+2] = 0.;
+-		B[(NDOF4*NUMNODESP1)*7+NDOF4*i+0] = dbasis[0][i];
+-		B[(NDOF4*NUMNODESP1)*7+NDOF4*i+1] = dbasis[1][i];
+-		B[(NDOF4*NUMNODESP1)*7+NDOF4*i+2] = dbasis[2][i];
+-	}
+-
+-	for(i=0;i<NUMNODESP1;i++){ //last column not for the bubble function
+-		B[(NDOF4*NUMNODESP1)*0+NDOF4*i+3] = 0.;
+-		B[(NDOF4*NUMNODESP1)*1+NDOF4*i+3] = 0.;
+-		B[(NDOF4*NUMNODESP1)*2+NDOF4*i+3] = 0.;
+-		B[(NDOF4*NUMNODESP1)*3+NDOF4*i+3] = 0.;
+-		B[(NDOF4*NUMNODESP1)*4+NDOF4*i+3] = 0.;
+-		B[(NDOF4*NUMNODESP1)*5+NDOF4*i+3] = 0.;
+-		B[(NDOF4*NUMNODESP1)*6+NDOF4*i+3] = basis[i];
+-		B[(NDOF4*NUMNODESP1)*7+NDOF4*i+3] = 0.;
+-	}
+-
+-}
+-/*}}}*/
+-/*FUNCTION PentaRef::GetBprimeFS {{{*/
+-void PentaRef::GetBprimeFS(IssmDouble* B_prime, IssmDouble* xyz_list, Gauss* gauss){
+-	/*	Compute B'  matrix. B'=[B1' B2' B3' B4' B5' B6' Bb'] where Bi' is of size 3*NDOF2. 
+-	 *	For node i, Bi' can be expressed in the actual coordinate system
+-	 *	by: 
+-	 *			Bvi' = [  dh/dx   0          0    ]
+-	 *					 [   0      dh/dy      0    ]
+-	 *					 [   0      0         dh/dz ]
+-	 *					 [  dh/dy   dh/dx      0    ]
+-	 *					 [  dh/dz   0        dh/dx  ]
+-	 *					 [   0      dh/dz    dh/dy  ]
+-	 *					 [  dh/dx   dh/dy    dh/dz  ]
+-	 *					 [   0      0          0    ]
+-	 *
+-	 * by: 	  Bpi=[ 0 ]
+-	 *					[ 0 ]
+-	 *					[ 0 ]
+-	 *					[ 0 ]
+-	 *					[ 0 ]
+-	 *					[ 0 ]
+-	 *					[ 0 ]
+-	 *					[ h ]
+-	 *	where h is the interpolation function for node i.
+-	 */
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int pnumnodes = this->NumberofNodesPressure();
+-	int vnumnodes = this->NumberofNodesVelocity();
+-
+-	/*Get nodal functions derivatives*/
+-	IssmDouble* vdbasis=xNew<IssmDouble>(3*vnumnodes);
+-	IssmDouble* pbasis =xNew<IssmDouble>(pnumnodes);
+-	GetNodalFunctionsDerivativesVelocity(vdbasis,xyz_list,gauss);
+-	GetNodalFunctionsPressure(pbasis,gauss);
+-
+-	/*Build B_prime: */
+-	for(int i=0;i<vnumnodes;i++){
+-		B_prime[(3*vnumnodes+pnumnodes)*0+3*i+0] = vdbasis[0*vnumnodes+i];
+-		B_prime[(3*vnumnodes+pnumnodes)*0+3*i+1] = 0.;
+-		B_prime[(3*vnumnodes+pnumnodes)*0+3*i+2] = 0.;
+-		B_prime[(3*vnumnodes+pnumnodes)*1+3*i+0] = 0.;
+-		B_prime[(3*vnumnodes+pnumnodes)*1+3*i+1] = vdbasis[1*vnumnodes+i];
+-		B_prime[(3*vnumnodes+pnumnodes)*1+3*i+2] = 0.;
+-		B_prime[(3*vnumnodes+pnumnodes)*2+3*i+0] = 0.;
+-		B_prime[(3*vnumnodes+pnumnodes)*2+3*i+1] = 0.;
+-		B_prime[(3*vnumnodes+pnumnodes)*2+3*i+2] = vdbasis[2*vnumnodes+i];
+-		B_prime[(3*vnumnodes+pnumnodes)*3+3*i+0] = vdbasis[1*vnumnodes+i];
+-		B_prime[(3*vnumnodes+pnumnodes)*3+3*i+1] = vdbasis[0*vnumnodes+i];
+-		B_prime[(3*vnumnodes+pnumnodes)*3+3*i+2] = 0.;
+-		B_prime[(3*vnumnodes+pnumnodes)*4+3*i+0] = vdbasis[2*vnumnodes+i];
+-		B_prime[(3*vnumnodes+pnumnodes)*4+3*i+1] = 0.;
+-		B_prime[(3*vnumnodes+pnumnodes)*4+3*i+2] = vdbasis[0*vnumnodes+i];
+-		B_prime[(3*vnumnodes+pnumnodes)*5+3*i+0] = 0.;
+-		B_prime[(3*vnumnodes+pnumnodes)*5+3*i+1] = vdbasis[2*vnumnodes+i];
+-		B_prime[(3*vnumnodes+pnumnodes)*5+3*i+2] = vdbasis[1*vnumnodes+i];
+-		B_prime[(3*vnumnodes+pnumnodes)*6+3*i+0] = vdbasis[0*vnumnodes+i];
+-		B_prime[(3*vnumnodes+pnumnodes)*6+3*i+1] = vdbasis[1*vnumnodes+i];
+-		B_prime[(3*vnumnodes+pnumnodes)*6+3*i+2] = vdbasis[2*vnumnodes+i];
+-		B_prime[(3*vnumnodes+pnumnodes)*7+3*i+0] = 0.;
+-		B_prime[(3*vnumnodes+pnumnodes)*7+3*i+1] = 0.;
+-		B_prime[(3*vnumnodes+pnumnodes)*7+3*i+2] = 0.;
+-	}
+-	for(int i=0;i<pnumnodes;i++){
+-		B_prime[(3*vnumnodes+pnumnodes)*0+(3*vnumnodes)+i] = 0.;
+-		B_prime[(3*vnumnodes+pnumnodes)*1+(3*vnumnodes)+i] = 0.;
+-		B_prime[(3*vnumnodes+pnumnodes)*2+(3*vnumnodes)+i] = 0.;
+-		B_prime[(3*vnumnodes+pnumnodes)*3+(3*vnumnodes)+i] = 0.;
+-		B_prime[(3*vnumnodes+pnumnodes)*4+(3*vnumnodes)+i] = 0.;
+-		B_prime[(3*vnumnodes+pnumnodes)*5+(3*vnumnodes)+i] = 0.;
+-		B_prime[(3*vnumnodes+pnumnodes)*6+(3*vnumnodes)+i] = 0.;
+-		B_prime[(3*vnumnodes+pnumnodes)*7+(3*vnumnodes)+i] = pbasis[i];
+-	}
+-
+-	/*Clean up*/
+-	xDelete<IssmDouble>(vdbasis);
+-	xDelete<IssmDouble>(pbasis);
+-}
+-/*}}}*/
+-/*FUNCTION PentaRef::GetBprimeFSGLS {{{*/
+-void PentaRef::GetBprimeFSGLS(IssmDouble* B_prime, IssmDouble* xyz_list, Gauss* gauss){
+-	/*	Compute B'  matrix. B'=[B1' B2' B3' B4' B5' B6' Bb'] where Bi' is of size 3*NDOF2. 
+-	 *	For node i, Bi' can be expressed in the actual coordinate system
+-	 *	by: 
+-	 *				Bi'=[  dh/dx   0          0       0]
+-	 *					 [   0      dh/dy      0       0]
+-	 *					 [   0      0         dh/dz    0]
+-	 *					 [  dh/dy   dh/dx      0       0]
+-	 *					 [  dh/dz   0        dh/dx     0]
+-	 *					 [   0      dh/dz    dh/dy     0]
+-	 *					 [  dh/dx   dh/dy    dh/dz     0]
+-	 *					 [   0      0          0       h]
+-	 *	where h is the interpolation function for node i.
+-	 *
+-	 * 	Same thing for the bubble fonction except that there is no fourth column
+-	 */
+-
+-	int i;
+-	IssmDouble dbasis[3][NUMNODESP1];
+-	IssmDouble basis[NUMNODESP1];
+-
+-	/*Get dbasismini in actual coordinate system: */
+-	GetNodalFunctionsP1Derivatives(&dbasis[0][0],xyz_list, gauss);
+-	GetNodalFunctionsP1(basis, gauss);
+-
+-	/*B_primeuild B_prime: */
+-	for(i=0;i<NUMNODESP1;i++){
+-		B_prime[(NDOF4*NUMNODESP1)*0+NDOF4*i+0] = dbasis[0][i];
+-		B_prime[(NDOF4*NUMNODESP1)*0+NDOF4*i+1] = 0.;
+-		B_prime[(NDOF4*NUMNODESP1)*0+NDOF4*i+2] = 0.;
+-		B_prime[(NDOF4*NUMNODESP1)*1+NDOF4*i+0] = 0.;
+-		B_prime[(NDOF4*NUMNODESP1)*1+NDOF4*i+1] = dbasis[1][i];
+-		B_prime[(NDOF4*NUMNODESP1)*1+NDOF4*i+2] = 0.;
+-		B_prime[(NDOF4*NUMNODESP1)*2+NDOF4*i+0] = 0.;
+-		B_prime[(NDOF4*NUMNODESP1)*2+NDOF4*i+1] = 0.;
+-		B_prime[(NDOF4*NUMNODESP1)*2+NDOF4*i+2] = dbasis[2][i];
+-		B_prime[(NDOF4*NUMNODESP1)*3+NDOF4*i+0] = dbasis[1][i];
+-		B_prime[(NDOF4*NUMNODESP1)*3+NDOF4*i+1] = dbasis[0][i];
+-		B_prime[(NDOF4*NUMNODESP1)*3+NDOF4*i+2] = 0.;
+-		B_prime[(NDOF4*NUMNODESP1)*4+NDOF4*i+0] = dbasis[2][i];
+-		B_prime[(NDOF4*NUMNODESP1)*4+NDOF4*i+1] = 0.;
+-		B_prime[(NDOF4*NUMNODESP1)*4+NDOF4*i+2] = dbasis[0][i];
+-		B_prime[(NDOF4*NUMNODESP1)*5+NDOF4*i+0] = 0.;
+-		B_prime[(NDOF4*NUMNODESP1)*5+NDOF4*i+1] = dbasis[2][i];
+-		B_prime[(NDOF4*NUMNODESP1)*5+NDOF4*i+2] = dbasis[1][i];
+-		B_prime[(NDOF4*NUMNODESP1)*6+NDOF4*i+0] = dbasis[0][i];
+-		B_prime[(NDOF4*NUMNODESP1)*6+NDOF4*i+1] = dbasis[1][i];
+-		B_prime[(NDOF4*NUMNODESP1)*6+NDOF4*i+2] = dbasis[2][i];
+-		B_prime[(NDOF4*NUMNODESP1)*7+NDOF4*i+0] = 0.;
+-		B_prime[(NDOF4*NUMNODESP1)*7+NDOF4*i+1] = 0.;
+-		B_prime[(NDOF4*NUMNODESP1)*7+NDOF4*i+2] = 0.;
+-	}
+-
+-	for(i=0;i<NUMNODESP1;i++){ //last column 
+-		B_prime[(NDOF4*NUMNODESP1)*0+NDOF4*i+3] = 0.;
+-		B_prime[(NDOF4*NUMNODESP1)*1+NDOF4*i+3] = 0.;
+-		B_prime[(NDOF4*NUMNODESP1)*2+NDOF4*i+3] = 0.;
+-		B_prime[(NDOF4*NUMNODESP1)*3+NDOF4*i+3] = 0.;
+-		B_prime[(NDOF4*NUMNODESP1)*4+NDOF4*i+3] = 0.;
+-		B_prime[(NDOF4*NUMNODESP1)*5+NDOF4*i+3] = 0.;
+-		B_prime[(NDOF4*NUMNODESP1)*6+NDOF4*i+3] = 0.;
+-		B_prime[(NDOF4*NUMNODESP1)*7+NDOF4*i+3] = - basis[i];
+-	}
+-
+-}
+-/*}}}*/
+-/*FUNCTION PentaRef::GetBAdvec{{{*/
+-void PentaRef::GetBAdvec(IssmDouble* B_advec, IssmDouble* xyz_list, Gauss* gauss){
+-	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF1. 
+-	 * For node i, Bi' can be expressed in the actual coordinate system
+-	 * by: 
+-	 *       Bi_advec =[ h ]
+-	 *                 [ h ]
+-	 *                 [ h ]
+-	 * where h is the interpolation function for node i.
+-	 *
+-	 * We assume B has been allocated already, of size: 3x(NDOF1*NUMNODESP1)
+-	 */
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Get nodal functions derivatives*/
+-	IssmDouble* basis=xNew<IssmDouble>(numnodes);
+-	GetNodalFunctions(basis,gauss);
+-
+-	/*Build B: */
+-	for(int i=0;i<numnodes;i++){
+-		B_advec[numnodes*0+i] = basis[i];
+-		B_advec[numnodes*1+i] = basis[i];
+-		B_advec[numnodes*2+i] = basis[i];
+-	}
+-
+-	/*Clean-up*/
+-	xDelete<IssmDouble>(basis);
+-}
+-/*}}}*/
+-/*FUNCTION PentaRef::GetBConduct{{{*/
+-void PentaRef::GetBConduct(IssmDouble* B_conduct, IssmDouble* xyz_list, Gauss* gauss){
+-	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF1. 
+-	 * For node i, Bi' can be expressed in the actual coordinate system
+-	 * by: 
+-	 *       Bi_conduct=[ dh/dx ]
+-	 *                  [ dh/dy ]
+-	 *                  [ dh/dz ]
+-	 * where h is the interpolation function for node i.
+-	 *
+-	 * We assume B has been allocated already, of size: 3x(NDOF1*numnodes)
+-	 */
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Get nodal functions derivatives*/
+-	IssmDouble* dbasis=xNew<IssmDouble>(3*numnodes);
+-	GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-
+-	/*Build B: */
+-	for(int i=0;i<numnodes;i++){
+-		B_conduct[numnodes*0+i] = dbasis[0*numnodes+i];
+-		B_conduct[numnodes*1+i] = dbasis[1*numnodes+i];
+-		B_conduct[numnodes*2+i] = dbasis[2*numnodes+i];
+-	}
+-
+-	/*Clean-up*/
+-	xDelete<IssmDouble>(dbasis);
+-}
+-/*}}}*/
+-/*FUNCTION PentaRef::GetBVert{{{*/
+-void PentaRef::GetBVert(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss){
+-	/*	Compute B  matrix. B=[dh1/dz dh2/dz dh3/dz dh4/dz dh5/dz dh6/dz];
+-		where hi is the interpolation function for node i.*/
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Get nodal functions derivatives*/
+-	IssmDouble* dbasis=xNew<IssmDouble>(3*numnodes);
+-	GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-
+-	/*Build B: */
+-	for(int i=0;i<numnodes;i++){
+-		B[i] = dbasis[2*numnodes+i];  
+-	}
+-
+-	/*Clean-up*/
+-	xDelete<IssmDouble>(dbasis);
+-}
+-/*}}}*/
+-/*FUNCTION PentaRef::GetBprimeAdvec{{{*/
+-void PentaRef::GetBprimeAdvec(IssmDouble* Bprime_advec, IssmDouble* xyz_list, Gauss* gauss){
+-	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF1. 
+-	 * For node i, Bi' can be expressed in the actual coordinate system
+-	 * by: 
+-	 *       Biprime_advec=[ dh/dx ]
+-	 *                     [ dh/dy ]
+-	 *                     [ dh/dz ]
+-	 * where h is the interpolation function for node i.
+-	 *
+-	 * We assume B has been allocated already, of size: 3x(NDOF1*numnodes)
+-	 */
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Get nodal functions derivatives*/
+-	IssmDouble* dbasis=xNew<IssmDouble>(3*numnodes);
+-	GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-
+-	/*Build B': */
+-	for(int i=0;i<numnodes;i++){
+-		Bprime_advec[numnodes*0+i] = dbasis[0*numnodes+i];
+-		Bprime_advec[numnodes*1+i] = dbasis[1*numnodes+i];
+-		Bprime_advec[numnodes*2+i] = dbasis[2*numnodes+i];
+-	}
+-
+-	/*Clean-up*/
+-	xDelete<IssmDouble>(dbasis);
+-}
+-/*}}}*/
+-/*FUNCTION PentaRef::GetBprimeVert{{{*/
+-void PentaRef::GetBprimeVert(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss){
+-
+-	GetNodalFunctions(B,gauss);
+-
+-}
+-/*}}}*/
+-/*FUNCTION PentaRef::GetBHOFriction{{{*/
+-void PentaRef::GetBHOFriction(IssmDouble* B, Gauss* gauss){
+-	/*Compute B  matrix. B=[B1 B2 B3] where Bi is square and of size 2x2. 
+-	 ** For node i, Bi can be expressed in the actual coordinate system
+-	 ** by: 
+-	 **                 Bi=[ N   0 ]
+-	 **                    [ 0   N ]
+-	 ** where N is the interpolation function for node i.
+-	 **
+-	 ** We assume B has been allocated already, of size: 2 (2 x numnodes)
+-	 **/
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Get nodal functions derivatives*/
+-	IssmDouble* basis=xNew<IssmDouble>(numnodes);
+-	GetNodalFunctions(basis,gauss);
+-
+-	for(int i=0;i<numnodes;i++){
+-		B[2*numnodes*0+2*i+0] = basis[i];
+-		B[2*numnodes*0+2*i+1] = 0.;
+-		B[2*numnodes*1+2*i+0] = 0.;
+-		B[2*numnodes*1+2*i+1] = basis[i];
+-	}
+-
+-	/*Clean-up*/
+-	xDelete<IssmDouble>(basis);
+-} 
+-/*}}}*/
+-/*FUNCTION PentaRef::GetLFS{{{*/
+-void PentaRef::GetLFS(IssmDouble* LFS, Gauss* gauss){
+-	/* Compute L  matrix. L=[L1 L2 L3] where Li is square and of size numdof. 
+-	 * For node i, Li can be expressed in the actual coordinate system
+-	 * by: 
+-	 *       Li=[ h 0 0 0 ]
+-	 *	 	      [ 0 h 0 0 ]
+-	 * where h is the interpolation function for node i.
+-	 */
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int pnumnodes = this->NumberofNodesPressure();
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumdof   = pnumnodes;
+-	int vnumdof   = vnumnodes*NDOF3;
+-
+-	/*Get nodal functions derivatives*/
+-	IssmDouble* vbasis=xNew<IssmDouble>(vnumnodes);
+-	GetNodalFunctionsVelocity(vbasis,gauss);
+-
+-	/*Build LFS: */
+-	for(int i=0;i<vnumnodes;i++){
+-		LFS[(vnumdof+pnumdof)*0+3*i+0] = vbasis[i];
+-		LFS[(vnumdof+pnumdof)*0+3*i+1] = 0.;
+-		LFS[(vnumdof+pnumdof)*0+3*i+2] = 0.;
+-
+-		LFS[(vnumdof+pnumdof)*1+3*i+0] = 0.;
+-		LFS[(vnumdof+pnumdof)*1+3*i+1] = vbasis[i];
+-		LFS[(vnumdof+pnumdof)*1+3*i+2] = 0.;
+-	}
+-
+-	for(int i=0;i<pnumnodes;i++){
+-		LFS[(vnumdof+pnumdof)*0+i+vnumdof+0] = 0.;
+-		LFS[(vnumdof+pnumdof)*1+i+vnumdof+0] = 0.;
+-	}
+-
+-	/*Clean-up*/
+-	xDelete<IssmDouble>(vbasis);
+-}
+-/*}}}*/
+-/*FUNCTION PentaRef::GetLprimeFS {{{*/
+-void PentaRef::GetLprimeFS(IssmDouble* LprimeFS, IssmDouble* xyz_list, Gauss* gauss_in){
+-	/* Compute Lprime  matrix. Lprime=[Lp1 Lp2 Lp3] where Lpi is square and of size numdof. 
+-	 * For node i, Lpi can be expressed in the actual coordinate system
+-	 * by: 
+-	 *       Lpi=[ h    0    0   0]1
+-	 *		       [ 0    h    0   0]2
+-	 *		       [ h    0    0   0]3
+-	 *		       [ 0    h    0   0]4
+-	 *		       [ 0    0    h   0]5
+-	 *		       [ 0    0    h   0]6
+-	 *		       [ 0    0  dh/dz 0]7
+-	 *		       [ 0    0  dh/dz 0]8
+-	 *		       [ 0    0  dh/dz 0]9
+-	 *		       [dh/dz 0  dh/dx 0]0
+-	 *		       [ 0 dh/dz dh/dy 0]1
+-	 *           [ 0    0    0   h]2
+-	 *           [ 0    0    0   h]3
+-	 *           [ 0    0    0   h]4
+-	 *
+-	 *       Li=[ h    0    0   0]1
+-	 *	 	      [ 0    h    0   0]2
+-	 *		      [ 0    0    h   0]3
+-	 *		      [ 0    0    h   0]4
+-	 *	 	      [ h    0    0   0]5
+-	 *	 	      [ 0    h    0   0]6
+-	 *	 	      [ h    0    0   0]7
+-	 *	 	      [ 0    h    0   0]8
+-	 *		      [ 0    0    h   0]9
+-	 *		      [ 0    0    h   0]0
+-	 *		      [ 0    0    h   0]1
+-	 *	 	      [ h    0    0   0]2
+-	 *	 	      [ 0    h    0   0]3
+-	 *		      [ 0    0    h   0]4
+-	 * where h is the interpolation function for node i.
+-	 */
+-
+-	int        num_dof=4;
+-	IssmDouble L1L2l3[NUMNODESP1_2d];
+-	IssmDouble dbasis[3][NUMNODESP1];
+-
+-	/*Cast gauss to GaussPenta*/
+-	_assert_(gauss_in->Enum()==GaussPentaEnum);
+-	GaussPenta* gauss = dynamic_cast<GaussPenta*>(gauss_in);
+-
+-	/*Get L1L2l3 in actual coordinate system: */
+-	L1L2l3[0]=gauss->coord1*(1-gauss->coord4)/2.0;
+-	L1L2l3[1]=gauss->coord2*(1-gauss->coord4)/2.0;
+-	L1L2l3[2]=gauss->coord3*(1-gauss->coord4)/2.0;
+-
+-	GetNodalFunctionsP1Derivatives(&dbasis[0][0],xyz_list,gauss);
+-
+-	/*Build LprimeFS: */
+-	for(int i=0;i<3;i++){
+-		LprimeFS[num_dof*NUMNODESP1_2d*0+num_dof*i+0]  = L1L2l3[i];
+-		LprimeFS[num_dof*NUMNODESP1_2d*0+num_dof*i+1]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*0+num_dof*i+2]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*0+num_dof*i+3]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*1+num_dof*i+0]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*1+num_dof*i+1]  = L1L2l3[i];
+-		LprimeFS[num_dof*NUMNODESP1_2d*1+num_dof*i+2]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*1+num_dof*i+3]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*2+num_dof*i+0]  = L1L2l3[i];
+-		LprimeFS[num_dof*NUMNODESP1_2d*2+num_dof*i+1]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*2+num_dof*i+2]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*2+num_dof*i+3]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*3+num_dof*i+0]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*3+num_dof*i+1]  = L1L2l3[i];
+-		LprimeFS[num_dof*NUMNODESP1_2d*3+num_dof*i+2]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*3+num_dof*i+3]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*4+num_dof*i+0]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*4+num_dof*i+1]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*4+num_dof*i+2]  = L1L2l3[i];
+-		LprimeFS[num_dof*NUMNODESP1_2d*4+num_dof*i+3]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*5+num_dof*i+0]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*5+num_dof*i+1]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*5+num_dof*i+2]  = L1L2l3[i];
+-		LprimeFS[num_dof*NUMNODESP1_2d*5+num_dof*i+3]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*6+num_dof*i+0]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*6+num_dof*i+1]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*6+num_dof*i+2]  = dbasis[2][i];
+-		LprimeFS[num_dof*NUMNODESP1_2d*6+num_dof*i+3]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*7+num_dof*i+0]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*7+num_dof*i+1]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*7+num_dof*i+2]  = dbasis[2][i];
+-		LprimeFS[num_dof*NUMNODESP1_2d*7+num_dof*i+3]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*8+num_dof*i+0]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*8+num_dof*i+1]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*8+num_dof*i+2]  = dbasis[2][i];
+-		LprimeFS[num_dof*NUMNODESP1_2d*8+num_dof*i+3]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*9+num_dof*i+0]  = dbasis[2][i];
+-		LprimeFS[num_dof*NUMNODESP1_2d*9+num_dof*i+1]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*9+num_dof*i+2]  = dbasis[0][i];
+-		LprimeFS[num_dof*NUMNODESP1_2d*9+num_dof*i+3]  = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*10+num_dof*i+0] = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*10+num_dof*i+1] = dbasis[2][i];
+-		LprimeFS[num_dof*NUMNODESP1_2d*10+num_dof*i+2] = dbasis[1][i];
+-		LprimeFS[num_dof*NUMNODESP1_2d*10+num_dof*i+3] = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*11+num_dof*i+0] = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*11+num_dof*i+1] = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*11+num_dof*i+2] = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*11+num_dof*i+3] = L1L2l3[i];
+-		LprimeFS[num_dof*NUMNODESP1_2d*12+num_dof*i+0] = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*12+num_dof*i+1] = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*12+num_dof*i+2] = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*12+num_dof*i+3] = L1L2l3[i];
+-		LprimeFS[num_dof*NUMNODESP1_2d*13+num_dof*i+0] = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*13+num_dof*i+1] = 0;
+-		LprimeFS[num_dof*NUMNODESP1_2d*13+num_dof*i+2] = 0;
+-		LprimeFS[num_dof*NUMNODESP1_2d*13+num_dof*i+3] = L1L2l3[i];
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION PentaRef::GetLSSAFS {{{*/
+-void PentaRef::GetLSSAFS(IssmDouble* LFS, Gauss* gauss_in){
+-	/*
+-	 * Compute L  matrix. L=[L1 L2 L3] where Li is square and of size numdof. 
+-	 * For node i, Li can be expressed in the actual coordinate system
+-	 * by: 
+-	 *       Li=[ h    0 ]
+-	 *	 	      [ 0    h ]
+-	 *	 	      [ h    0 ]
+-	 *	 	      [ 0    h ]
+-	 *	 	      [ h    0 ]
+-	 *	 	      [ 0    h ]
+-	 *	 	      [ h    0 ]
+-	 *	 	      [ 0    h ]
+-	 * where h is the interpolation function for node i.
+-	 */
+-
+-	int num_dof=2;
+-	IssmDouble L1L2l3[NUMNODESP1_2d];
+-
+-	/*Cast gauss to GaussPenta*/
+-	_assert_(gauss_in->Enum()==GaussPentaEnum);
+-	GaussPenta* gauss = dynamic_cast<GaussPenta*>(gauss_in);
+-
+-	/*Get L1L2l3 in actual coordinate system: */
+-	L1L2l3[0]=gauss->coord1*(1-gauss->coord4)/2.0;
+-	L1L2l3[1]=gauss->coord2*(1-gauss->coord4)/2.0;
+-	L1L2l3[2]=gauss->coord3*(1-gauss->coord4)/2.0;
+-
+-	/*Build LFS: */
+-	for(int i=0;i<3;i++){
+-		LFS[num_dof*NUMNODESP1_2d*0+num_dof*i+0] = L1L2l3[i];
+-		LFS[num_dof*NUMNODESP1_2d*0+num_dof*i+1] = 0;
+-		LFS[num_dof*NUMNODESP1_2d*1+num_dof*i+0] = 0;
+-		LFS[num_dof*NUMNODESP1_2d*1+num_dof*i+1] = L1L2l3[i];
+-		LFS[num_dof*NUMNODESP1_2d*2+num_dof*i+0] = L1L2l3[i];
+-		LFS[num_dof*NUMNODESP1_2d*2+num_dof*i+1] = 0;
+-		LFS[num_dof*NUMNODESP1_2d*3+num_dof*i+0] = 0;
+-		LFS[num_dof*NUMNODESP1_2d*3+num_dof*i+1] = L1L2l3[i];
+-		LFS[num_dof*NUMNODESP1_2d*4+num_dof*i+0] = L1L2l3[i];
+-		LFS[num_dof*NUMNODESP1_2d*4+num_dof*i+1] = 0;
+-		LFS[num_dof*NUMNODESP1_2d*5+num_dof*i+0] = 0;
+-		LFS[num_dof*NUMNODESP1_2d*5+num_dof*i+1] = L1L2l3[i];
+-		LFS[num_dof*NUMNODESP1_2d*6+num_dof*i+0] = L1L2l3[i];
+-		LFS[num_dof*NUMNODESP1_2d*6+num_dof*i+1] = 0;
+-		LFS[num_dof*NUMNODESP1_2d*7+num_dof*i+0] = 0;
+-		LFS[num_dof*NUMNODESP1_2d*7+num_dof*i+1] = L1L2l3[i];
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION PentaRef::GetLprimeSSAFS {{{*/
+-void PentaRef::GetLprimeSSAFS(IssmDouble* LprimeFS, IssmDouble* xyz_list, Gauss* gauss_in){
+-	/* Compute Lprime  matrix. Lprime=[Lp1 Lp2 Lp3] where Lpi is square and of size numdof. 
+-	 * For node i, Lpi can be expressed in the actual coordinate system
+-	 * by: 
+-	 *       Lpi=[ h    0    0   0]
+-	 *		       [ 0    h    0   0]
+-	 *		       [ 0    0    h   0]
+-	 *		       [ 0    0    h   0]
+-	 *		       [ 0    0  dh/dz 0]
+-	 *		       [ 0    0  dh/dz 0]
+-	 *           [ 0    0    0   h]
+-	 *           [ 0    0    0   h]
+-	 * where h is the interpolation function for node i.
+-	 */
+-	int num_dof=3;
+-	int num_dof_vel=3*NUMNODESP1b;
+-	int num_dof_total=3*NUMNODESP1b+1*NUMNODESP1;
+-	IssmDouble L1L2l3[NUMNODESP1_2d];
+-	IssmDouble dbasis[3][NUMNODESP1];
+-
+-	/*Cast gauss to GaussPenta*/
+-	_assert_(gauss_in->Enum()==GaussPentaEnum);
+-	GaussPenta* gauss = dynamic_cast<GaussPenta*>(gauss_in);
+-
+-	/*Get L1L2l3 in actual coordinate system: */
+-	L1L2l3[0]=gauss->coord1*(1-gauss->coord4)/2.0;
+-	L1L2l3[1]=gauss->coord2*(1-gauss->coord4)/2.0;
+-	L1L2l3[2]=gauss->coord3*(1-gauss->coord4)/2.0;
+-
+-	GetNodalFunctionsP1Derivatives(&dbasis[0][0],xyz_list,gauss);
+-
+-	/*Build LprimeFS: */
+-	for(int i=0;i<3;i++){
+-		LprimeFS[num_dof_total*0+num_dof*i+0] = L1L2l3[i];
+-		LprimeFS[num_dof_total*0+num_dof*i+1] = 0.;
+-		LprimeFS[num_dof_total*0+num_dof*i+2] = 0.;
+-		LprimeFS[num_dof_total*1+num_dof*i+0] = 0.;
+-		LprimeFS[num_dof_total*1+num_dof*i+1] = L1L2l3[i];
+-		LprimeFS[num_dof_total*1+num_dof*i+2] = 0.;
+-		LprimeFS[num_dof_total*2+num_dof*i+0] = 0.;
+-		LprimeFS[num_dof_total*2+num_dof*i+1] = 0.;
+-		LprimeFS[num_dof_total*2+num_dof*i+2] = L1L2l3[i];
+-		LprimeFS[num_dof_total*3+num_dof*i+0] = 0.;
+-		LprimeFS[num_dof_total*3+num_dof*i+1] = 0.;
+-		LprimeFS[num_dof_total*3+num_dof*i+2] = L1L2l3[i];
+-		LprimeFS[num_dof_total*4+num_dof*i+0] = 0.;
+-		LprimeFS[num_dof_total*4+num_dof*i+1] = 0.;
+-		LprimeFS[num_dof_total*4+num_dof*i+2] = dbasis[2][i];
+-		LprimeFS[num_dof_total*5+num_dof*i+0] = 0.;
+-		LprimeFS[num_dof_total*5+num_dof*i+1] = 0.;
+-		LprimeFS[num_dof_total*5+num_dof*i+2] = dbasis[2][i];
+-		LprimeFS[num_dof_total*6+num_dof*i+0] = 0.;
+-		LprimeFS[num_dof_total*6+num_dof*i+1] = 0.;
+-		LprimeFS[num_dof_total*6+num_dof*i+2] = 0.;
+-		LprimeFS[num_dof_total*7+num_dof*i+0] = 0.;
+-		LprimeFS[num_dof_total*7+num_dof*i+1] = 0.;
+-		LprimeFS[num_dof_total*7+num_dof*i+2] = 0.;
+-	}
+-	for(int i=3;i<7;i++){
+-		LprimeFS[num_dof_total*0+num_dof*i+0] = 0.;
+-		LprimeFS[num_dof_total*0+num_dof*i+1] = 0.;
+-		LprimeFS[num_dof_total*0+num_dof*i+2] = 0.;
+-		LprimeFS[num_dof_total*1+num_dof*i+0] = 0.;
+-		LprimeFS[num_dof_total*1+num_dof*i+1] = 0.;
+-		LprimeFS[num_dof_total*1+num_dof*i+2] = 0.;
+-		LprimeFS[num_dof_total*2+num_dof*i+0] = 0.;
+-		LprimeFS[num_dof_total*2+num_dof*i+1] = 0.;
+-		LprimeFS[num_dof_total*2+num_dof*i+2] = 0.;
+-		LprimeFS[num_dof_total*3+num_dof*i+0] = 0.;
+-		LprimeFS[num_dof_total*3+num_dof*i+1] = 0.;
+-		LprimeFS[num_dof_total*3+num_dof*i+2] = 0.;
+-		LprimeFS[num_dof_total*4+num_dof*i+0] = 0.;
+-		LprimeFS[num_dof_total*4+num_dof*i+1] = 0.;
+-		LprimeFS[num_dof_total*4+num_dof*i+2] = 0.;
+-		LprimeFS[num_dof_total*5+num_dof*i+0] = 0.;
+-		LprimeFS[num_dof_total*5+num_dof*i+1] = 0.;
+-		LprimeFS[num_dof_total*5+num_dof*i+2] = 0.;
+-		LprimeFS[num_dof_total*6+num_dof*i+0] = 0.;
+-		LprimeFS[num_dof_total*6+num_dof*i+1] = 0.;
+-		LprimeFS[num_dof_total*6+num_dof*i+2] = 0.;
+-		LprimeFS[num_dof_total*7+num_dof*i+0] = 0.;
+-		LprimeFS[num_dof_total*7+num_dof*i+1] = 0.;
+-		LprimeFS[num_dof_total*7+num_dof*i+2] = 0.;
+-	}
+-	for(int i=0;i<3;i++){
+-		LprimeFS[num_dof_total*0+num_dof_vel+i] = 0.;
+-		LprimeFS[num_dof_total*1+num_dof_vel+i] = 0.;
+-		LprimeFS[num_dof_total*2+num_dof_vel+i] = 0.;
+-		LprimeFS[num_dof_total*3+num_dof_vel+i] = 0.;
+-		LprimeFS[num_dof_total*4+num_dof_vel+i] = 0.;
+-		LprimeFS[num_dof_total*5+num_dof_vel+i] = 0.;
+-		LprimeFS[num_dof_total*6+num_dof_vel+i] = L1L2l3[i];
+-		LprimeFS[num_dof_total*7+num_dof_vel+i] = L1L2l3[i];
+-	}
+-	for(int i=3;i<6;i++){
+-		LprimeFS[num_dof_total*0+num_dof_vel+i] = 0.;
+-		LprimeFS[num_dof_total*1+num_dof_vel+i] = 0.;
+-		LprimeFS[num_dof_total*2+num_dof_vel+i] = 0.;
+-		LprimeFS[num_dof_total*3+num_dof_vel+i] = 0.;
+-		LprimeFS[num_dof_total*4+num_dof_vel+i] = 0.;
+-		LprimeFS[num_dof_total*5+num_dof_vel+i] = 0.;
+-		LprimeFS[num_dof_total*6+num_dof_vel+i] = 0.;
+-		LprimeFS[num_dof_total*7+num_dof_vel+i] = 0.;
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION PentaRef::GetLFSSSA {{{*/
+-void PentaRef::GetLFSSSA(IssmDouble* LFS, Gauss* gauss_in){
+-	/* Compute L  matrix. L=[L1 L2 L3] where Li is square and of size numdof. 
+-	 * For node i, Li can be expressed in the actual coordinate system
+-	 * by: 
+-	 *       Li=[ h    0    0 ]
+-	 *	 	      [ 0    h    0 ]
+-	 *		      [ 0    0    h ]
+-	 *		      [ 0    0    h ]
+-	 * where h is the interpolation function for node i.
+-	 */
+-
+-	int num_dof=3;
+-	IssmDouble L1L2l3[NUMNODESP1_2d];
+-
+-	/*Cast gauss to GaussPenta*/
+-	_assert_(gauss_in->Enum()==GaussPentaEnum);
+-	GaussPenta* gauss = dynamic_cast<GaussPenta*>(gauss_in);
+-
+-	/*Get L1L2l3 in actual coordinate system: */
+-	L1L2l3[0]=gauss->coord1*(1-gauss->coord4)/2.0;
+-	L1L2l3[1]=gauss->coord2*(1-gauss->coord4)/2.0;
+-	L1L2l3[2]=gauss->coord3*(1-gauss->coord4)/2.0;
+-
+-	/*Build LFS: */
+-	for(int i=0;i<3;i++){
+-		LFS[num_dof*NUMNODESP1_2d*0+num_dof*i+0] = L1L2l3[i];
+-		LFS[num_dof*NUMNODESP1_2d*0+num_dof*i+1] = 0.;
+-		LFS[num_dof*NUMNODESP1_2d*0+num_dof*i+2] = 0.;
+-		LFS[num_dof*NUMNODESP1_2d*1+num_dof*i+0] = 0.;
+-		LFS[num_dof*NUMNODESP1_2d*1+num_dof*i+1] = L1L2l3[i];
+-		LFS[num_dof*NUMNODESP1_2d*1+num_dof*i+2] = 0.;
+-		LFS[num_dof*NUMNODESP1_2d*2+num_dof*i+0] = 0.;
+-		LFS[num_dof*NUMNODESP1_2d*2+num_dof*i+1] = 0.;
+-		LFS[num_dof*NUMNODESP1_2d*2+num_dof*i+2] = L1L2l3[i];
+-		LFS[num_dof*NUMNODESP1_2d*3+num_dof*i+0] = 0.;
+-		LFS[num_dof*NUMNODESP1_2d*3+num_dof*i+1] = 0.;
+-		LFS[num_dof*NUMNODESP1_2d*3+num_dof*i+2] = L1L2l3[i];
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION PentaRef::GetLprimeFSSSA {{{*/
+-void PentaRef::GetLprimeFSSSA(IssmDouble* LprimeFS, IssmDouble* xyz_list, Gauss* gauss_in){
+-	/* Compute Lprime  matrix. Lprime=[Lp1 Lp2 Lp3] where Lpi is square and of size numdof. 
+-	 * For node i, Lpi can be expressed in the actual coordinate system
+-	 * by: 
+-	 *       Lpi=[ h    0 ]
+-	 *		       [ 0    h ]
+-	 *		       [ h    0 ]
+-	 *		       [ 0    h ]
+-	 * where h is the interpolation function for node i.
+-	 */
+-	int num_dof=2;
+-	IssmDouble L1L2l3[NUMNODESP1_2d];
+-	IssmDouble dbasis[3][NUMNODESP1];
+-
+-	/*Cast gauss to GaussPenta*/
+-	_assert_(gauss_in->Enum()==GaussPentaEnum);
+-	GaussPenta* gauss = dynamic_cast<GaussPenta*>(gauss_in);
+-
+-	/*Get L1L2l3 in actual coordinate system: */
+-	L1L2l3[0]=gauss->coord1*(1-gauss->coord4)/2.0;
+-	L1L2l3[1]=gauss->coord2*(1-gauss->coord4)/2.0;
+-	L1L2l3[2]=gauss->coord3*(1-gauss->coord4)/2.0;
+-	GetNodalFunctionsP1Derivatives(&dbasis[0][0],xyz_list,gauss);
+-
+-	/*Build LprimeFS: */
+-	for(int i=0;i<3;i++){
+-		LprimeFS[num_dof*NUMNODESP1_2d*0+num_dof*i+0] = L1L2l3[i];
+-		LprimeFS[num_dof*NUMNODESP1_2d*0+num_dof*i+1] = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*1+num_dof*i+0] = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*1+num_dof*i+1] = L1L2l3[i];
+-		LprimeFS[num_dof*NUMNODESP1_2d*2+num_dof*i+0] = L1L2l3[i];
+-		LprimeFS[num_dof*NUMNODESP1_2d*2+num_dof*i+1] = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*3+num_dof*i+0] = 0.;
+-		LprimeFS[num_dof*NUMNODESP1_2d*3+num_dof*i+1] = L1L2l3[i];
+-	}
+-}
+-/*}}}*/
+ /*FUNCTION PentaRef::GetJacobian {{{*/
+ void PentaRef::GetJacobian(IssmDouble* J, IssmDouble* xyz_list,Gauss* gauss_in){
+ 	/*The Jacobian is constant over the element, discard the gaussian points. 
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.h	(revision 17094)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.h	(revision 17095)
+@@ -40,27 +40,6 @@
+ 		void GetTriaJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSegmentJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetJacobianInvert(IssmDouble*  Jinv, IssmDouble* xyz_list,Gauss* gauss);
+-		void GetBSSAHO(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss);
+-		void GetBSSAFS(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss);
+-		void GetBHO(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss);
+-		void GetBFSstrainrate(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss);
+-		void GetBFS(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss);
+-		void GetBFSGLS(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss);
+-		void GetBprimeSSAFS(IssmDouble* Bprime, IssmDouble* xyz_list, Gauss* gauss);
+-		void GetBprimeHO(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss);
+-		void GetBprimeFS(IssmDouble* B_prime, IssmDouble* xyz_list, Gauss* gauss);
+-		void GetBprimeFSGLS(IssmDouble* B_prime, IssmDouble* xyz_list, Gauss* gauss);
+-		void GetBprimeVert(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss);
+-		void GetBAdvec(IssmDouble* B_advec, IssmDouble* xyz_list, Gauss* gauss);
+-		void GetBConduct(IssmDouble* B_conduct, IssmDouble* xyz_list, Gauss* gauss);
+-		void GetBVert(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss);
+-		void GetBprimeAdvec(IssmDouble* Bprime_advec, IssmDouble* xyz_list, Gauss* gauss);
+-		void GetBHOFriction(IssmDouble* L, Gauss* gauss);
+-		void GetLFS(IssmDouble* LFS, Gauss* gauss);
+-		void GetLprimeFS(IssmDouble* LprimeFS, IssmDouble* xyz_list, Gauss* gauss);
+-		void GetLSSAFS(IssmDouble* LSSAFS, Gauss* gauss);
+-		void GetLprimeSSAFS(IssmDouble* LprimeSSAFS, IssmDouble* xyz_list, Gauss* gauss);
+-		void GetLFSSSA(IssmDouble* LFSSSA, Gauss* gauss);
+ 		void GetLprimeFSSSA(IssmDouble* LprimeFSSSA, IssmDouble* xyz_list, Gauss* gauss);
+ 		void GetInputValue(IssmDouble* pvalue,IssmDouble* plist, Gauss* gauss);
+ 		void GetInputDerivativeValue(IssmDouble* pvalues, IssmDouble* plist,IssmDouble* xyz_list, Gauss* gauss);
+Index: ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp	(revision 17094)
++++ ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp	(revision 17095)
+@@ -50,104 +50,6 @@
+ /*}}}*/
+ 
+ /*Reference Element numerics*/
+-/*FUNCTION TriaRef::GetBHydro {{{*/
+-void TriaRef::GetBHydro(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss){
+-	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
+-	 * For node i, Bi can be expressed in the actual coordinate system
+-	 * by: 
+-	 *       Bi=[ dN/dx ]
+-	 *          [ dN/dy ]
+-	 * where N is the finiteelement function for node i.
+-	 *
+-	 * We assume B has been allocated already, of size: 3x(NDOF2*numnodes)
+-	 */
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Get nodal functions derivatives*/
+-	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
+-	GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-
+-	/*Build B: */
+-	for(int i=0;i<numnodes;i++){
+-		B[numnodes*0+i] = dbasis[0*numnodes+i];
+-		B[numnodes*1+i] = dbasis[1*numnodes+i];
+-	}
+-
+-	/*Clean-up*/
+-	xDelete<IssmDouble>(dbasis);
+-}
+-/*}}}*/
+-/*FUNCTION TriaRef::GetBSSA {{{*/
+-void TriaRef::GetBSSA(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss){
+-	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
+-	 * For node i, Bi can be expressed in the actual coordinate system
+-	 * by: 
+-	 *       Bi=[ dN/dx           0    ]
+-	 *          [   0           dN/dy  ]
+-	 *          [ 1/2*dN/dy  1/2*dN/dx ]
+-	 * where N is the finiteelement function for node i.
+-	 *
+-	 * We assume B has been allocated already, of size: 3x(NDOF2*numnodes)
+-	 */
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Get nodal functions derivatives*/
+-	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
+-	GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-
+-	/*Build B: */
+-	for(int i=0;i<numnodes;i++){
+-		B[NDOF2*numnodes*0+NDOF2*i+0] = dbasis[0*numnodes+i];
+-		B[NDOF2*numnodes*0+NDOF2*i+1] = 0.;
+-		B[NDOF2*numnodes*1+NDOF2*i+0] = 0.;
+-		B[NDOF2*numnodes*1+NDOF2*i+1] = dbasis[1*numnodes+i];
+-		B[NDOF2*numnodes*2+NDOF2*i+0] = .5*dbasis[1*numnodes+i];
+-		B[NDOF2*numnodes*2+NDOF2*i+1] = .5*dbasis[0*numnodes+i];
+-	}
+-
+-	/*Clean-up*/
+-	xDelete<IssmDouble>(dbasis);
+-}
+-/*}}}*/
+-/*FUNCTION TriaRef::GetBSSAFS {{{*/
+-void TriaRef::GetBSSAFS(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss){
+-
+-	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
+-	 * For node i, Bi can be expressed in the actual coordinate system
+-	 * by: 
+-	 *       Bi=[   dN/dx         0     ]
+-	 *          [       0       dN/dy   ]
+-	 *          [  1/2*dN/dy  1/2*dN/dx ]
+-	 * where N is the finiteelement function for node i.
+-	 *
+-	 * We assume B has been allocated already, of size: 3x(NDOF2*numnodes)
+-	 */
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Get nodal functions derivatives*/
+-	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
+-	GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-
+-	/*Build B': */
+-	for(int i=0;i<numnodes;i++){
+-		B[NDOF2*numnodes*0+NDOF2*i+0] = dbasis[0*numnodes+i];
+-		B[NDOF2*numnodes*0+NDOF2*i+1] = 0.;
+-		B[NDOF2*numnodes*1+NDOF2*i+0] = 0.;
+-		B[NDOF2*numnodes*1+NDOF2*i+1] = dbasis[1*numnodes+i];
+-		B[NDOF2*numnodes*2+NDOF2*i+0] = 0.5*dbasis[1*numnodes+i];
+-		B[NDOF2*numnodes*2+NDOF2*i+1] = 0.5*dbasis[0*numnodes+i];
+-	}
+-
+-	/*Clean-up*/
+-	xDelete<IssmDouble>(dbasis);
+-}
+-/*}}}*/
+ /*FUNCTION TriaRef::GetSegmentBFlux{{{*/
+ void TriaRef::GetSegmentBFlux(IssmDouble* B,Gauss* gauss, int index1,int index2){
+ 	/*Compute B  matrix. B=[phi1 phi2 -phi3 -phi4]
+@@ -200,331 +102,6 @@
+ 	xDelete<IssmDouble>(basis);
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::GetBExtrusion{{{*/
+-void TriaRef::GetBExtrusion(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss){
+-	/*	Compute B  matrix. B=[dh1/dz dh2/dz dh3/dz dh4/dz dh5/dz dh6/dz];
+-		where hi is the interpolation function for node i.*/
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Get nodal functions derivatives*/
+-	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
+-	GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-
+-	/*Build B: */
+-	for(int i=0;i<numnodes;i++){
+-		B[i] = dbasis[1*numnodes+i];  
+-	}
+-
+-	/*Clean-up*/
+-	xDelete<IssmDouble>(dbasis);
+-}
+-/*}}}*/
+-/*FUNCTION TriaRef::GetBFS {{{*/
+-void TriaRef::GetBFS(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss){
+-	/*Compute B  matrix. B=[Bv1 Bv2 ... Bp1 Bp2 ...] where Bvi is of size 3*NDOF3. 
+-	 * For node i, Bvi can be expressed in the actual coordinate system
+-	 * by: 	   Bvi=[ dphi/dx          0        ]
+-	 *					 [   0           dphi/dy     ]
+-	 *					 [ 1/2*dphi/dy    1/2*dphi/dx]
+-	 *					 [   0             0         ]
+-	 *					 [ dphi/dx         dphi/dy   ]
+-	 *
+-	 * by: 	  Bpi=[  0    ]
+-	 *					[  0    ]
+-	 *					[  0    ]
+-	 *					[ phi_p ]
+-	 *					[  0    ]
+-	 *	where phi is the finiteelement function for node i.
+-	 *	Same thing for Bb except the last column that does not exist.
+-	 */
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int pnumnodes = this->NumberofNodesPressure();
+-	int vnumnodes = this->NumberofNodesVelocity();
+-
+-	/*Get nodal functions derivatives*/
+-	IssmDouble* vdbasis=xNew<IssmDouble>(2*vnumnodes);
+-	IssmDouble* pbasis =xNew<IssmDouble>(pnumnodes);
+-	GetNodalFunctionsDerivativesVelocity(vdbasis,xyz_list,gauss);
+-	GetNodalFunctionsPressure(pbasis,gauss);
+-
+-	/*Build B: */
+-	for(int i=0;i<vnumnodes;i++){
+-		B[(2*vnumnodes+pnumnodes)*0+2*i+0] = vdbasis[0*vnumnodes+i];
+-		B[(2*vnumnodes+pnumnodes)*0+2*i+1] = 0.;
+-		B[(2*vnumnodes+pnumnodes)*1+2*i+0] = 0.;
+-		B[(2*vnumnodes+pnumnodes)*1+2*i+1] = vdbasis[1*vnumnodes+i];
+-		B[(2*vnumnodes+pnumnodes)*2+2*i+0] = .5*vdbasis[1*vnumnodes+i];
+-		B[(2*vnumnodes+pnumnodes)*2+2*i+1] = .5*vdbasis[0*vnumnodes+i];
+-		B[(2*vnumnodes+pnumnodes)*3+2*i+0] = 0.;
+-		B[(2*vnumnodes+pnumnodes)*3+2*i+1] = 0.;
+-		B[(2*vnumnodes+pnumnodes)*4+2*i+0] = vdbasis[0*vnumnodes+i];
+-		B[(2*vnumnodes+pnumnodes)*4+2*i+1] = vdbasis[1*vnumnodes+i];
+-	}
+-	for(int i=0;i<pnumnodes;i++){
+-		B[(2*vnumnodes+pnumnodes)*0+(2*vnumnodes)+i] = 0.;
+-		B[(2*vnumnodes+pnumnodes)*1+(2*vnumnodes)+i] = 0.;
+-		B[(2*vnumnodes+pnumnodes)*2+(2*vnumnodes)+i] = 0.;
+-		B[(2*vnumnodes+pnumnodes)*3+(2*vnumnodes)+i] = pbasis[i];
+-		B[(2*vnumnodes+pnumnodes)*4+(2*vnumnodes)+i] = 0.;
+-	}
+-
+-	/*Clean up*/
+-	xDelete<IssmDouble>(vdbasis);
+-	xDelete<IssmDouble>(pbasis);
+-}
+-/*}}}*/
+-/*FUNCTION TriaRef::GetBprimeFS {{{*/
+-void TriaRef::GetBprimeFS(IssmDouble* B_prime, IssmDouble* xyz_list, Gauss* gauss){
+-	/*	Compute B'  matrix. B'=[B1' B2' B3' B4' B5' B6' Bb'] where Bi' is of size 3*NDOF2. 
+-	 *	For node i, Bi' can be expressed in the actual coordinate system
+-	 *	by: 
+-	 *			Bvi' = [  dphi/dx     0     ]
+-	 *					 [     0      dphi/dy ]
+-	 *					 [  dphi/dy   dphi/dx ]
+-	 *					 [  dphi/dx   dphi/dy ]
+-	 *					 [     0      0       ]
+-	 *
+-	 * by: 	  Bpi=[  0  ]
+-	 *					[  0  ]
+-	 *					[  0  ]
+-	 *					[  0  ]
+-	 *					[ phi ]
+-	 *	where phi is the finiteelement function for node i.
+-	 */
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int pnumnodes = this->NumberofNodesPressure();
+-	int vnumnodes = this->NumberofNodesVelocity();
+-
+-	/*Get nodal functions derivatives*/
+-	IssmDouble* vdbasis=xNew<IssmDouble>(2*vnumnodes);
+-	IssmDouble* pbasis =xNew<IssmDouble>(pnumnodes);
+-	GetNodalFunctionsDerivativesVelocity(vdbasis,xyz_list,gauss);
+-	GetNodalFunctionsPressure(pbasis,gauss);
+-
+-	/*Build B_prime: */
+-	for(int i=0;i<vnumnodes;i++){
+-		B_prime[(2*vnumnodes+pnumnodes)*0+2*i+0] = vdbasis[0*vnumnodes+i];
+-		B_prime[(2*vnumnodes+pnumnodes)*0+2*i+1] = 0.;
+-		B_prime[(2*vnumnodes+pnumnodes)*1+2*i+0] = 0.;
+-		B_prime[(2*vnumnodes+pnumnodes)*1+2*i+1] = vdbasis[1*vnumnodes+i];
+-		B_prime[(2*vnumnodes+pnumnodes)*2+2*i+0] = vdbasis[1*vnumnodes+i];
+-		B_prime[(2*vnumnodes+pnumnodes)*2+2*i+1] = vdbasis[0*vnumnodes+i];
+-		B_prime[(2*vnumnodes+pnumnodes)*3+2*i+0] = vdbasis[0*vnumnodes+i];
+-		B_prime[(2*vnumnodes+pnumnodes)*3+2*i+1] = vdbasis[1*vnumnodes+i];
+-		B_prime[(2*vnumnodes+pnumnodes)*4+2*i+0] = 0.;
+-		B_prime[(2*vnumnodes+pnumnodes)*4+2*i+1] = 0.;
+-	}
+-	for(int i=0;i<pnumnodes;i++){
+-		B_prime[(2*vnumnodes+pnumnodes)*0+(2*vnumnodes)+i] = 0.;
+-		B_prime[(2*vnumnodes+pnumnodes)*1+(2*vnumnodes)+i] = 0.;
+-		B_prime[(2*vnumnodes+pnumnodes)*2+(2*vnumnodes)+i] = 0.;
+-		B_prime[(2*vnumnodes+pnumnodes)*3+(2*vnumnodes)+i] = 0.;
+-		B_prime[(2*vnumnodes+pnumnodes)*4+(2*vnumnodes)+i] = pbasis[i];
+-	}
+-
+-	/*Clean up*/
+-	xDelete<IssmDouble>(vdbasis);
+-	xDelete<IssmDouble>(pbasis);
+-}
+-/*}}}*/
+-/*FUNCTION TriaRef::GetBMasstransport{{{*/
+-void TriaRef::GetBMasstransport(IssmDouble* B, IssmDouble* xyz_list, Gauss* gauss){
+-	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
+-	 * For node i, Bi can be expressed in the actual coordinate system
+-	 * by: 
+-	 *       Bi=[ N ]
+-	 *          [ N ]
+-	 * where N is the finiteelement function for node i.
+-	 *
+-	 * We assume B_prog has been allocated already, of size: 2x(NDOF1*numnodes)
+-	 */
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Get nodal functions*/
+-	IssmDouble* basis=xNew<IssmDouble>(numnodes);
+-	GetNodalFunctions(basis,gauss);
+-
+-	/*Build B: */
+-	for(int i=0;i<numnodes;i++){
+-		B[numnodes*0+i] = basis[i];
+-		B[numnodes*1+i] = basis[i];
+-	}
+-
+-	/*Clean-up*/
+-	xDelete<IssmDouble>(basis);
+-}
+-/*}}}*/
+-/*FUNCTION TriaRef::GetBprimeSSA {{{*/
+-void TriaRef::GetBprimeSSA(IssmDouble* Bprime, IssmDouble* xyz_list, Gauss* gauss){
+-
+-	/*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 
+-	 * For node i, Bi' can be expressed in the actual coordinate system
+-	 * by: 
+-	 *       Bi_prime=[ 2*dN/dx    dN/dy ]
+-	 *                [   dN/dx  2*dN/dy ]
+-	 *                [   dN/dy    dN/dx ]
+-	 * where hNis the finiteelement function for node i.
+-	 *
+-	 * We assume B' has been allocated already, of size: 3x(NDOF2*numnodes)
+-	 */
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Get nodal functions derivatives*/
+-	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
+-	GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-
+-	/*Build B': */
+-	for(int i=0;i<numnodes;i++){
+-		Bprime[NDOF2*numnodes*0+NDOF2*i+0] = 2.*dbasis[0*numnodes+i];
+-		Bprime[NDOF2*numnodes*0+NDOF2*i+1] =    dbasis[1*numnodes+i];
+-		Bprime[NDOF2*numnodes*1+NDOF2*i+0] =    dbasis[0*numnodes+i];
+-		Bprime[NDOF2*numnodes*1+NDOF2*i+1] = 2.*dbasis[1*numnodes+i];
+-		Bprime[NDOF2*numnodes*2+NDOF2*i+0] =    dbasis[1*numnodes+i];
+-		Bprime[NDOF2*numnodes*2+NDOF2*i+1] =    dbasis[0*numnodes+i];
+-	}
+-
+-	/*Clean-up*/
+-	xDelete<IssmDouble>(dbasis);
+-}
+-/*}}}*/
+-/*FUNCTION TriaRef::GetBprimeSSAFS {{{*/
+-void TriaRef::GetBprimeSSAFS(IssmDouble* Bprime, IssmDouble* xyz_list, Gauss* gauss){
+-	/*Compute Bprime  matrix. Bprime=[Bprime1 Bprime2 Bprime3] where Bprimei is of size 3*NDOF2. 
+-	 * For node i, Bprimei can be expressed in the actual coordinate system
+-	 * by: 
+-	 *       Bprimei=[  dN/dx    0   ]
+-	 *               [    0    dN/dy ]
+-	 *               [  dN/dy  dN/dx ]
+-	 N               [  dN/dx  dN/dy ]
+-	 * where N is the finiteelement function for node i.
+-	 *
+-	 * We assume Bprime has been allocated already, of size: 3x(NDOF2*numnodes)
+-	 */
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Get nodal functions*/
+-	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
+-	GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-
+-	/*Build Bprime: */
+-	for(int i=0;i<numnodes;i++){
+-		Bprime[NDOF2*numnodes*0+NDOF2*i+0] = dbasis[0*numnodes+i];
+-		Bprime[NDOF2*numnodes*0+NDOF2*i+1] = 0.;
+-		Bprime[NDOF2*numnodes*1+NDOF2*i+0] = 0.;
+-		Bprime[NDOF2*numnodes*1+NDOF2*i+1] = dbasis[1*numnodes+i];
+-		Bprime[NDOF2*numnodes*2+NDOF2*i+0] = dbasis[1*numnodes+i];
+-		Bprime[NDOF2*numnodes*2+NDOF2*i+1] = dbasis[0*numnodes+i];
+-		Bprime[NDOF2*numnodes*3+NDOF2*i+0] = dbasis[0*numnodes+i];
+-		Bprime[NDOF2*numnodes*3+NDOF2*i+1] = dbasis[1*numnodes+i];
+-	}
+-
+-	/*Clean-up*/
+-	xDelete<IssmDouble>(dbasis);
+-}
+-/*}}}*/
+-/*FUNCTION TriaRef::GetBprimeMasstransport{{{*/
+-void TriaRef::GetBprimeMasstransport(IssmDouble* Bprime, IssmDouble* xyz_list, Gauss* gauss){
+-	/*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 
+-	 * For node i, Bi' can be expressed in the actual coordinate system
+-	 * by: 
+-	 *       Bi_prime=[ dN/dx ]
+-	 *                [ dN/dy ]
+-	 * where N is the finiteelement function for node i.
+-	 *
+-	 * We assume B' has been allocated already, of size: 3x(NDOF2*numnodes)
+-	 */
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Get nodal functions derivatives*/
+-	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
+-	GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-
+-	/*Build B': */
+-	for(int i=0;i<numnodes;i++){
+-		Bprime[numnodes*0+i] = dbasis[0*numnodes+i];
+-		Bprime[numnodes*1+i] = dbasis[1*numnodes+i];
+-	}
+-
+-	/*Clean-up*/
+-	xDelete<IssmDouble>(dbasis);
+-}
+-/*}}}*/
+-/*FUNCTION TriaRef::GetBSSAFriction{{{*/
+-void TriaRef::GetBSSAFriction(IssmDouble* B, IssmDouble* xyz_list,Gauss* gauss){
+-	/*Compute B  matrix. B=[B1 B2 B3] where Bi is square and of size 2. 
+-	 * For node i, Bi can be expressed in the actual coordinate system
+-	 * by: 
+-	 *                 Bi=[ N   0 ]
+-	 *                    [ 0   N ]
+-	 * where N is the finiteelement function for node i.
+-	 *
+-	 * We assume B has been allocated already, of size: 2 x (numdof*numnodes)
+-	 */
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Get nodal functions derivatives*/
+-	IssmDouble* basis=xNew<IssmDouble>(numnodes);
+-	GetNodalFunctions(basis,gauss);
+-
+-	/*Build L: */
+-	for(int i=0;i<numnodes;i++){
+-		B[2*numnodes*0+2*i+0] = basis[i];
+-		B[2*numnodes*0+2*i+1] = 0.;
+-		B[2*numnodes*1+2*i+0] = 0.;
+-		B[2*numnodes*1+2*i+1] = basis[i];
+-	}
+-
+-	/*Clean-up*/
+-	xDelete<IssmDouble>(basis);
+-}
+-/*}}}*/
+-/*FUNCTION TriaRef::GetLFS{{{*/
+-void TriaRef::GetLFS(IssmDouble* LFS, Gauss* gauss){
+-	/* Compute L  matrix. L=[L1 L2 L3] where Li is square and of size numdof. 
+-	 * For node i, Li can be expressed in the actual coordinate system
+-	 * by: 
+-	 *       Li=[ h 0 0 ]
+-	 * where h is the interpolation function for node i.
+-	 */
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int pnumnodes = this->NumberofNodesPressure();
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumdof   = pnumnodes;
+-	int vnumdof   = vnumnodes*NDOF2;
+-
+-	/*Get nodal functions derivatives*/
+-	IssmDouble* vbasis=xNew<IssmDouble>(vnumnodes);
+-	GetNodalFunctionsVelocity(vbasis,gauss);
+-
+-	/*Build LFS: */
+-	for(int i=0;i<vnumnodes;i++){
+-		LFS[2*i+0] = vbasis[i];
+-		LFS[2*i+1] = 0.;
+-	}
+-
+-	for(int i=0;i<pnumnodes;i++){
+-		LFS[i+vnumdof+0] = 0.;
+-	}
+-
+-	/*Clean-up*/
+-	xDelete<IssmDouble>(vbasis);
+-}
+-/*}}}*/
+ /*FUNCTION TriaRef::GetJacobian{{{*/
+ void TriaRef::GetJacobian(IssmDouble* J, IssmDouble* xyz_list,Gauss* gauss){
+ 	/*The Jacobian is constant over the element, discard the gaussian points. 
Index: issm/oecreview/Archive/16554-17801/ISSM-17095-17096.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17095-17096.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17095-17096.diff	(revision 17802)
@@ -0,0 +1,32 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17095)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17096)
+@@ -2408,10 +2408,13 @@
+ 	element->InputChangeName(VyEnum,VyPicardEnum);
+ 	element->InputChangeName(PressureEnum,PressurePicardEnum);
+ 
+-	/*Add vx and vy as inputs to the tria element: */
++	/*Add vx and vy as inputs to the element: */
++	//element->AddInput(VxEnum,  vx,element->GetElementType());
++	//element->AddInput(VyEnum,  vy,element->GetElementType());
++	//element->AddInput(VelEnum,vel,element->GetElementType());
+ 	element->AddInput(VxEnum,vx,P1Enum);
+ 	element->AddInput(VyEnum,vy,P1Enum);
+-	element->AddBasalInput(VelEnum,vel,P1Enum);
++	element->AddInput(VelEnum,vel,P1Enum);
+ 
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(vel);
+@@ -3373,6 +3376,11 @@
+ 	if(dim==3) element->InputChangeName(VzEnum,VzPicardEnum);
+ 
+ 	/*Add vx and vy as inputs to the tria element: */
++	//element->AddInput(VxEnum,      vx,      element->VelocityInterpolation());
++	//element->AddInput(VyEnum,      vy,      element->VelocityInterpolation());
++	//element->AddInput(VelEnum,     vel,     element->VelocityInterpolation());
++	//element->AddInput(PressureEnum,pressure,element->PressureInterpolation());
++	//if(dim==3) element->AddInput(VzEnum,vz, element->VelocityInterpolation());
+ 	element->AddInput(VxEnum,vx,P1Enum);
+ 	element->AddInput(VyEnum,vy,P1Enum);
+ 	element->AddInput(VelEnum,vel,P1Enum);
Index: issm/oecreview/Archive/16554-17801/ISSM-17096-17097.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17096-17097.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17096-17097.diff	(revision 17802)
@@ -0,0 +1,63 @@
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17096)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17097)
+@@ -1246,14 +1246,14 @@
+ 			indices[0] = 0;
+ 			indices[1] = 1;
+ 			indices[2] = 2;
+-			break;
++			return;
+ 		case P1bubbleEnum: case P1bubblecondensedEnum:
+ 			numindices = 3;
+ 			indices    = xNew<int>(numindices);
+ 			indices[0] = 0;
+ 			indices[1] = 1;
+ 			indices[2] = 2;
+-			break;
++			return;
+ 		case P2xP1Enum:
+ 			numindices = 6;
+ 			indices    = xNew<int>(numindices);
+@@ -1263,7 +1263,7 @@
+ 			indices[3] = 6;
+ 			indices[4] = 7;
+ 			indices[5] = 8;
+-			break;
++			return;
+ 		case P1xP2Enum:
+ 			numindices = 3;
+ 			indices    = xNew<int>(numindices);
+@@ -1271,6 +1271,13 @@
+ 			indices[1] = 1;
+ 			indices[2] = 2;
+ 			return;
++		case P1xP3Enum:
++			numindices = 3;
++			indices    = xNew<int>(numindices);
++			indices[0] = 0;
++			indices[1] = 1;
++			indices[2] = 2;
++			return;
+ 		case P2Enum:
+ 			numindices = 6;
+ 			indices    = xNew<int>(numindices);
+@@ -1280,7 +1287,17 @@
+ 			indices[3] = 9;
+ 			indices[4] = 10;
+ 			indices[5] = 11;
+-			break;
++			return;
++		case P2xP4Enum:
++			numindices = 6;
++			indices    = xNew<int>(numindices);
++			indices[0] = 0;
++			indices[1] = 1;
++			indices[2] = 2;
++			indices[3] = 9;
++			indices[4] = 10;
++			indices[5] = 11;
++			return;
+ 		default:
+ 			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+ 	}
Index: issm/oecreview/Archive/16554-17801/ISSM-17097-17098.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17097-17098.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17097-17098.diff	(revision 17802)
@@ -0,0 +1,440 @@
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17097)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17098)
+@@ -6,27 +6,54 @@
+ #include "../solutionsequences/solutionsequences.h"
+ 
+ int LevelsetAnalysis::DofsPerNode(int** doflist,int meshtype,int approximation){/*{{{*/
+-	_error_("not implemented yet");
++	return 1;
+ }
+ /*}}}*/
+ void LevelsetAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+-	_error_("not implemented yet");
++	// parameters->AddObject(iomodel->CopyConstantObject(FlowequationIsSIAEnum));
+ }
+ /*}}}*/
+ void LevelsetAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+-	_error_("not implemented yet");
++	int    stabilization,finiteelement;
++
++	/*Finite element type*/
++	finiteelement = P1Enum;
++
++	/*Update elements: */
++	int counter=0;
++	for(int i=0;i<iomodel->numberofelements;i++){
++		if(iomodel->my_elements[i]){
++			Element* element=(Element*)elements->GetObjectByOffset(counter);
++			element->Update(i,iomodel,analysis_counter,analysis_type,finiteelement);
++			counter++;
++		}
++	}
++
++	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
++	iomodel->FetchDataToInput(elements,VxEnum);
++	iomodel->FetchDataToInput(elements,VyEnum);
++	
+ }
+ /*}}}*/
+ void LevelsetAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+-	_error_("not implemented yet");
++	int finiteelement=P1Enum;
++	::CreateNodes(nodes,iomodel,LevelsetAnalysisEnum,finiteelement);
+ }
+ /*}}}*/
+ void LevelsetAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+-	_error_("not implemented yet");
++
++	/*Intermediary*/
++
++	/*Fetch parameters: */
++
+ }
+ /*}}}*/
+ void LevelsetAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+-	_error_("not implemented yet");
++	
++	/*Intermediary*/
++
++	/*Fetch parameters: */
++
+ }/*}}}*/
+ 
+ /*Finite element Analysis*/
+@@ -34,16 +61,134 @@
+ 	_error_("not implemented yet");
+ }/*}}}*/
+ ElementVector* LevelsetAnalysis::CreateDVector(Element* element){/*{{{*/
+-	_error_("not implemented yet");
++	/*Default, return NULL*/
++	return NULL;
+ }/*}}}*/
+ ElementMatrix* LevelsetAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++	/* Jacobian required for the Newton solver */
+ 	_error_("not implemented yet");
+ }/*}}}*/
+ ElementMatrix* LevelsetAnalysis::CreateKMatrix(Element* element){/*{{{*/
+-	_error_("not implemented yet");
++	/*Intermediaries */
++
++	int dim = 2; // solve for LSF in horizontal plane only
++	IssmDouble kappa;
++	IssmDouble Jdet, dt, D_scalar;
++	IssmDouble u,v,um,vm,ub,vb,vx,vy;
++	IssmDouble* xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes    = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementMatrix* Ke       = element->NewElementMatrix();
++	IssmDouble*    basis    = xNew<IssmDouble>(numnodes);
++	IssmDouble*    B        = xNew<IssmDouble>(dim*numnodes);
++	IssmDouble*    Bprime   = xNew<IssmDouble>(dim*numnodes);
++	IssmDouble     D[dim][dim];
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	element->FindParam(&dt,TimesteppingTimeStepEnum);
++	Input* vx_input  = element->GetInput(VxEnum);     _assert_(vx_input);
++	Input* vy_input  = element->GetInput(VyEnum);     _assert_(vy_input);
++	Input* vxm_input = element->GetInput(VxMeshEnum); _assert_(vxm_input);
++	Input* vym_input = element->GetInput(VyMeshEnum); _assert_(vym_input);
++	
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		D_scalar=gauss->weight*Jdet;
++
++		/* Transient */
++		if(dt!=0.){
++			element->NodalFunctions(basis,gauss);
++			TripleMultiply(basis,numnodes,1,0,
++						&D_scalar,1,1,0,
++						basis,1,numnodes,0,
++						&Ke->values[0],1);
++			D_scalar*=dt;
++		}
++
++		/* Advection */
++		GetB(B,element,xyz_list,gauss); 
++		GetBprime(Bprime,element,xyz_list,gauss); 
++		vx_input->GetInputValue(&u,gauss); vxm_input->GetInputValue(&um,gauss); vx=u-um;
++		vy_input->GetInputValue(&v,gauss); vym_input->GetInputValue(&vm,gauss); vy=v-vm;
++		ub=0.; // horizontal mass change velocities (melt/refreeze/calving) FIXME: insert values from model here
++		vb=0.;
++		D[0][0]=D_scalar*(vx+ub);
++		D[0][1]=0.;
++		D[1][0]=0.;
++		D[1][1]=D_scalar*(vy+vb);
++		TripleMultiply(B,dim,numnodes,1,
++					&D[0][0],dim,dim,0,
++					Bprime,dim,numnodes,0,
++					&Ke->values[0],1);
++
++		/* Artificial Diffusion */
++		kappa=0.; //FIXME: insert suitable value for kappa
++		GetBprime(Bprime,element,xyz_list,gauss); // recalculation of Bprime needed?
++		D[0][0]=D_scalar*kappa;
++		D[1][1]=D_scalar*kappa;
++		TripleMultiply(Bprime,dim,numnodes,1,
++					&D[0][0],dim,dim,0,
++					Bprime,dim,numnodes,0,
++					&Ke->values[0],1);
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(B);
++	xDelete<IssmDouble>(Bprime);
++	delete gauss;
++	return Ke;
+ }/*}}}*/
+ ElementVector* LevelsetAnalysis::CreatePVector(Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	/*Intermediaries */
++	int i, ig;
++	IssmDouble  Jdet,dt;
++	IssmDouble  phi;
++	IssmDouble* xyz_list = NULL;
++	
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector*/
++	ElementVector* pe    = element->NewElementVector();
++	element->FindParam(&dt,TimesteppingTimeStepEnum);
++	
++	if(dt!=0.){
++		/*Initialize basis vector*/
++		IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++		/*Retrieve all inputs and parameters*/
++		element->GetVerticesCoordinates(&xyz_list);
++		Input* levelset_input     = element->GetInput(MaskIceLevelsetEnum);                    _assert_(levelset_input);
++
++		/* Start  looping on the number of gaussian points: */
++		Gauss* gauss=element->NewGauss(2);
++		for(ig=gauss->begin();ig<gauss->end();ig++){
++			gauss->GaussPoint(ig);
++
++			element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++			element->NodalFunctions(basis,gauss);
++			levelset_input->GetInputValue(&phi,gauss);
++			for(i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*phi*basis[i];
++		}
++
++		/*Clean up and return*/
++		xDelete<IssmDouble>(xyz_list);
++		xDelete<IssmDouble>(basis);
++		delete gauss;
++	}
++	else{for(i=0;i<numnodes;i++) pe->values[i]=0.;} 
++	return pe;
+ }/*}}}*/
+ void LevelsetAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	_error_("not implemented yet");
+@@ -51,3 +196,59 @@
+ void LevelsetAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 	_error_("not implemented yet");
+ }/*}}}*/
++void LevelsetAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
++	 * For node i, Bi can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi=[ N ]
++	 *          [ N ]
++	 * where N is the finiteelement function for node i.
++	 *
++	 * We assume B_prog has been allocated already, of size: 2x(NDOF1*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions*/
++	IssmDouble* basis=xNew<IssmDouble>(numnodes);
++	element->NodalFunctions(basis,gauss);
++
++	/*Build B: */
++	for(int i=0;i<numnodes;i++){
++		B[numnodes*0+i] = basis[i];
++		B[numnodes*1+i] = basis[i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(basis);
++}/*}}}*/
++void LevelsetAnalysis::GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 
++	 * For node i, Bi' can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi_prime=[ dN/dx ]
++	 *                [ dN/dy ]
++	 * where N is the finiteelement function for node i.
++	 *
++	 * We assume B' has been allocated already, of size: 3x(NDOF2*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Build B': */
++	for(int i=0;i<numnodes;i++){
++		Bprime[numnodes*0+i] = dbasis[0*numnodes+i];
++		Bprime[numnodes*1+i] = dbasis[1*numnodes+i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(dbasis);
++
++}/*}}}*/
++
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h	(revision 17097)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h	(revision 17098)
+@@ -27,5 +27,8 @@
+ 	ElementVector* CreatePVector(Element* element);
+ 	void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 	void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++	void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++	void GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++
+ };
+ #endif
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17097)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17098)
+@@ -272,7 +272,6 @@
+ 	TransientIsthermalEnum,
+ 	TransientIsgiaEnum,
+ 	TransientIsdamageEnum,
+-	TransientIslevelsetEnum,
+ 	TransientNumRequestedOutputsEnum,
+ 	TransientRequestedOutputsEnum,
+ 	/*}}}*/
+@@ -320,7 +319,6 @@
+ 	BedSlopeSolutionEnum,
+ 	DamageEvolutionSolutionEnum,
+ 	DamageEvolutionAnalysisEnum,
+-	LevelsetAnalysisEnum,
+ 	StressbalanceAnalysisEnum,
+ 	StressbalanceSIAAnalysisEnum,
+ 	StressbalanceSolutionEnum,
+@@ -673,6 +671,10 @@
+ 	ArrheniusEnum,
+ 	LliboutryDuvalEnum,
+ 	/*}}}*/
++	/*Levelset related enums (will be moved to appropriate place when finished){{{*/
++	LevelsetAnalysisEnum,
++	TransientIslevelsetEnum,
++	/*}}}*/
+ 	MaximumNumberOfDefinitionsEnum
+ };
+ 
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17097)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17098)
+@@ -278,7 +278,6 @@
+ 		case TransientIsthermalEnum : return "TransientIsthermal";
+ 		case TransientIsgiaEnum : return "TransientIsgia";
+ 		case TransientIsdamageEnum : return "TransientIsdamage";
+-		case TransientIslevelsetEnum : return "TransientIslevelset";
+ 		case TransientNumRequestedOutputsEnum : return "TransientNumRequestedOutputs";
+ 		case TransientRequestedOutputsEnum : return "TransientRequestedOutputs";
+ 		case SurfaceforcingsEnum : return "Surfaceforcings";
+@@ -321,7 +320,6 @@
+ 		case BedSlopeSolutionEnum : return "BedSlopeSolution";
+ 		case DamageEvolutionSolutionEnum : return "DamageEvolutionSolution";
+ 		case DamageEvolutionAnalysisEnum : return "DamageEvolutionAnalysis";
+-		case LevelsetAnalysisEnum : return "LevelsetAnalysis";
+ 		case StressbalanceAnalysisEnum : return "StressbalanceAnalysis";
+ 		case StressbalanceSIAAnalysisEnum : return "StressbalanceSIAAnalysis";
+ 		case StressbalanceSolutionEnum : return "StressbalanceSolution";
+@@ -633,6 +631,8 @@
+ 		case PatersonEnum : return "Paterson";
+ 		case ArrheniusEnum : return "Arrhenius";
+ 		case LliboutryDuvalEnum : return "LliboutryDuval";
++		case LevelsetAnalysisEnum : return "LevelsetAnalysis";
++		case TransientIslevelsetEnum : return "TransientIslevelset";
+ 		case MaximumNumberOfDefinitionsEnum : return "MaximumNumberOfDefinitions";
+ 		default : return "unknown";
+ 
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17097)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17098)
+@@ -284,7 +284,6 @@
+ 	      else if (strcmp(name,"TransientIsthermal")==0) return TransientIsthermalEnum;
+ 	      else if (strcmp(name,"TransientIsgia")==0) return TransientIsgiaEnum;
+ 	      else if (strcmp(name,"TransientIsdamage")==0) return TransientIsdamageEnum;
+-	      else if (strcmp(name,"TransientIslevelset")==0) return TransientIslevelsetEnum;
+ 	      else if (strcmp(name,"TransientNumRequestedOutputs")==0) return TransientNumRequestedOutputsEnum;
+ 	      else if (strcmp(name,"TransientRequestedOutputs")==0) return TransientRequestedOutputsEnum;
+ 	      else if (strcmp(name,"Surfaceforcings")==0) return SurfaceforcingsEnum;
+@@ -327,7 +326,6 @@
+ 	      else if (strcmp(name,"BedSlopeSolution")==0) return BedSlopeSolutionEnum;
+ 	      else if (strcmp(name,"DamageEvolutionSolution")==0) return DamageEvolutionSolutionEnum;
+ 	      else if (strcmp(name,"DamageEvolutionAnalysis")==0) return DamageEvolutionAnalysisEnum;
+-	      else if (strcmp(name,"LevelsetAnalysis")==0) return LevelsetAnalysisEnum;
+ 	      else if (strcmp(name,"StressbalanceAnalysis")==0) return StressbalanceAnalysisEnum;
+ 	      else if (strcmp(name,"StressbalanceSIAAnalysis")==0) return StressbalanceSIAAnalysisEnum;
+ 	      else if (strcmp(name,"StressbalanceSolution")==0) return StressbalanceSolutionEnum;
+@@ -382,12 +380,12 @@
+ 	      else if (strcmp(name,"GenericParam")==0) return GenericParamEnum;
+ 	      else if (strcmp(name,"AdolcParam")==0) return AdolcParamEnum;
+ 	      else if (strcmp(name,"BoolInput")==0) return BoolInputEnum;
++	      else if (strcmp(name,"BoolParam")==0) return BoolParamEnum;
++	      else if (strcmp(name,"Contour")==0) return ContourEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"BoolParam")==0) return BoolParamEnum;
+-	      else if (strcmp(name,"Contour")==0) return ContourEnum;
+-	      else if (strcmp(name,"ControlInput")==0) return ControlInputEnum;
++	      if (strcmp(name,"ControlInput")==0) return ControlInputEnum;
+ 	      else if (strcmp(name,"DatasetInput")==0) return DatasetInputEnum;
+ 	      else if (strcmp(name,"DoubleInput")==0) return DoubleInputEnum;
+ 	      else if (strcmp(name,"DataSetParam")==0) return DataSetParamEnum;
+@@ -505,12 +503,12 @@
+ 	      else if (strcmp(name,"Enthalpy")==0) return EnthalpyEnum;
+ 	      else if (strcmp(name,"EnthalpyPicard")==0) return EnthalpyPicardEnum;
+ 	      else if (strcmp(name,"ThicknessAbsGradient")==0) return ThicknessAbsGradientEnum;
++	      else if (strcmp(name,"ThicknessAlongGradient")==0) return ThicknessAlongGradientEnum;
++	      else if (strcmp(name,"ThicknessAcrossGradient")==0) return ThicknessAcrossGradientEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"ThicknessAlongGradient")==0) return ThicknessAlongGradientEnum;
+-	      else if (strcmp(name,"ThicknessAcrossGradient")==0) return ThicknessAcrossGradientEnum;
+-	      else if (strcmp(name,"IntMatParam")==0) return IntMatParamEnum;
++	      if (strcmp(name,"IntMatParam")==0) return IntMatParamEnum;
+ 	      else if (strcmp(name,"RheologyBbarAbsGradient")==0) return RheologyBbarAbsGradientEnum;
+ 	      else if (strcmp(name,"DragCoefficientAbsGradient")==0) return DragCoefficientAbsGradientEnum;
+ 	      else if (strcmp(name,"TransientInput")==0) return TransientInputEnum;
+@@ -628,12 +626,12 @@
+ 	      else if (strcmp(name,"Verbose")==0) return VerboseEnum;
+ 	      else if (strcmp(name,"TriangleInterp")==0) return TriangleInterpEnum;
+ 	      else if (strcmp(name,"BilinearInterp")==0) return BilinearInterpEnum;
++	      else if (strcmp(name,"NearestInterp")==0) return NearestInterpEnum;
++	      else if (strcmp(name,"XY")==0) return XYEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"NearestInterp")==0) return NearestInterpEnum;
+-	      else if (strcmp(name,"XY")==0) return XYEnum;
+-	      else if (strcmp(name,"XYZ")==0) return XYZEnum;
++	      if (strcmp(name,"XYZ")==0) return XYZEnum;
+ 	      else if (strcmp(name,"Dense")==0) return DenseEnum;
+ 	      else if (strcmp(name,"MpiDense")==0) return MpiDenseEnum;
+ 	      else if (strcmp(name,"MpiSparse")==0) return MpiSparseEnum;
+@@ -648,6 +646,8 @@
+ 	      else if (strcmp(name,"Paterson")==0) return PatersonEnum;
+ 	      else if (strcmp(name,"Arrhenius")==0) return ArrheniusEnum;
+ 	      else if (strcmp(name,"LliboutryDuval")==0) return LliboutryDuvalEnum;
++	      else if (strcmp(name,"LevelsetAnalysis")==0) return LevelsetAnalysisEnum;
++	      else if (strcmp(name,"TransientIslevelset")==0) return TransientIslevelsetEnum;
+ 	      else if (strcmp(name,"MaximumNumberOfDefinitions")==0) return MaximumNumberOfDefinitionsEnum;
+          else stage=7;
+    }
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17097)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17098)
+@@ -270,7 +270,6 @@
+ def TransientIsthermalEnum(): return StringToEnum("TransientIsthermal")[0]
+ def TransientIsgiaEnum(): return StringToEnum("TransientIsgia")[0]
+ def TransientIsdamageEnum(): return StringToEnum("TransientIsdamage")[0]
+-def TransientIslevelsetEnum(): return StringToEnum("TransientIslevelset")[0]
+ def TransientNumRequestedOutputsEnum(): return StringToEnum("TransientNumRequestedOutputs")[0]
+ def TransientRequestedOutputsEnum(): return StringToEnum("TransientRequestedOutputs")[0]
+ def SurfaceforcingsEnum(): return StringToEnum("Surfaceforcings")[0]
+@@ -313,7 +312,6 @@
+ def BedSlopeSolutionEnum(): return StringToEnum("BedSlopeSolution")[0]
+ def DamageEvolutionSolutionEnum(): return StringToEnum("DamageEvolutionSolution")[0]
+ def DamageEvolutionAnalysisEnum(): return StringToEnum("DamageEvolutionAnalysis")[0]
+-def LevelsetAnalysisEnum(): return StringToEnum("LevelsetAnalysis")[0]
+ def StressbalanceAnalysisEnum(): return StringToEnum("StressbalanceAnalysis")[0]
+ def StressbalanceSIAAnalysisEnum(): return StringToEnum("StressbalanceSIAAnalysis")[0]
+ def StressbalanceSolutionEnum(): return StringToEnum("StressbalanceSolution")[0]
+@@ -625,4 +623,6 @@
+ def PatersonEnum(): return StringToEnum("Paterson")[0]
+ def ArrheniusEnum(): return StringToEnum("Arrhenius")[0]
+ def LliboutryDuvalEnum(): return StringToEnum("LliboutryDuval")[0]
++def LevelsetAnalysisEnum(): return StringToEnum("LevelsetAnalysis")[0]
++def TransientIslevelsetEnum(): return StringToEnum("TransientIslevelset")[0]
+ def MaximumNumberOfDefinitionsEnum(): return StringToEnum("MaximumNumberOfDefinitions")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17098-17099.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17098-17099.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17098-17099.diff	(revision 17802)
@@ -0,0 +1,64 @@
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17098)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17099)
+@@ -1246,14 +1246,14 @@
+ 			indices[0] = 0;
+ 			indices[1] = 1;
+ 			indices[2] = 2;
+-			return;
++			break;
+ 		case P1bubbleEnum: case P1bubblecondensedEnum:
+ 			numindices = 3;
+ 			indices    = xNew<int>(numindices);
+ 			indices[0] = 0;
+ 			indices[1] = 1;
+ 			indices[2] = 2;
+-			return;
++			break;
+ 		case P2xP1Enum:
+ 			numindices = 6;
+ 			indices    = xNew<int>(numindices);
+@@ -1263,21 +1263,21 @@
+ 			indices[3] = 6;
+ 			indices[4] = 7;
+ 			indices[5] = 8;
+-			return;
++			break;
+ 		case P1xP2Enum:
+ 			numindices = 3;
+ 			indices    = xNew<int>(numindices);
+ 			indices[0] = 0;
+ 			indices[1] = 1;
+ 			indices[2] = 2;
+-			return;
++			break;
+ 		case P1xP3Enum:
+ 			numindices = 3;
+ 			indices    = xNew<int>(numindices);
+ 			indices[0] = 0;
+ 			indices[1] = 1;
+ 			indices[2] = 2;
+-			return;
++			break;
+ 		case P2Enum:
+ 			numindices = 6;
+ 			indices    = xNew<int>(numindices);
+@@ -1287,7 +1287,7 @@
+ 			indices[3] = 9;
+ 			indices[4] = 10;
+ 			indices[5] = 11;
+-			return;
++			break;
+ 		case P2xP4Enum:
+ 			numindices = 6;
+ 			indices    = xNew<int>(numindices);
+@@ -1297,7 +1297,7 @@
+ 			indices[3] = 9;
+ 			indices[4] = 10;
+ 			indices[5] = 11;
+-			return;
++			break;
+ 		default:
+ 			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+ 	}
Index: issm/oecreview/Archive/16554-17801/ISSM-17099-17100.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17099-17100.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17099-17100.diff	(revision 17802)
@@ -0,0 +1,597 @@
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17099)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17100)
+@@ -232,6 +232,7 @@
+ 	QmuMaterialsRheologyBEnum,
+ 	RiftsNumriftsEnum,
+ 	RiftsRiftstructEnum,
++	SettingsResultsOnNodesEnum,
+ 	SettingsIoGatherEnum,
+ 	SettingsLowmemEnum,
+ 	SettingsOutputFrequencyEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17099)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17100)
+@@ -240,6 +240,7 @@
+ 		case QmuMaterialsRheologyBEnum : return "QmuMaterialsRheologyB";
+ 		case RiftsNumriftsEnum : return "RiftsNumrifts";
+ 		case RiftsRiftstructEnum : return "RiftsRiftstruct";
++		case SettingsResultsOnNodesEnum : return "SettingsResultsOnNodes";
+ 		case SettingsIoGatherEnum : return "SettingsIoGather";
+ 		case SettingsLowmemEnum : return "SettingsLowmem";
+ 		case SettingsOutputFrequencyEnum : return "SettingsOutputFrequency";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17099)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17100)
+@@ -243,6 +243,7 @@
+ 	      else if (strcmp(name,"QmuMaterialsRheologyB")==0) return QmuMaterialsRheologyBEnum;
+ 	      else if (strcmp(name,"RiftsNumrifts")==0) return RiftsNumriftsEnum;
+ 	      else if (strcmp(name,"RiftsRiftstruct")==0) return RiftsRiftstructEnum;
++	      else if (strcmp(name,"SettingsResultsOnNodes")==0) return SettingsResultsOnNodesEnum;
+ 	      else if (strcmp(name,"SettingsIoGather")==0) return SettingsIoGatherEnum;
+ 	      else if (strcmp(name,"SettingsLowmem")==0) return SettingsLowmemEnum;
+ 	      else if (strcmp(name,"SettingsOutputFrequency")==0) return SettingsOutputFrequencyEnum;
+@@ -258,11 +259,11 @@
+ 	      else if (strcmp(name,"SteadystateRequestedOutputs")==0) return SteadystateRequestedOutputsEnum;
+ 	      else if (strcmp(name,"Surface")==0) return SurfaceEnum;
+ 	      else if (strcmp(name,"ThermalIsenthalpy")==0) return ThermalIsenthalpyEnum;
+-	      else if (strcmp(name,"ThermalIsdynamicbasalspc")==0) return ThermalIsdynamicbasalspcEnum;
+          else stage=3;
+    }
+    if(stage==3){
+-	      if (strcmp(name,"ThermalMaxiter")==0) return ThermalMaxiterEnum;
++	      if (strcmp(name,"ThermalIsdynamicbasalspc")==0) return ThermalIsdynamicbasalspcEnum;
++	      else if (strcmp(name,"ThermalMaxiter")==0) return ThermalMaxiterEnum;
+ 	      else if (strcmp(name,"ThermalPenaltyFactor")==0) return ThermalPenaltyFactorEnum;
+ 	      else if (strcmp(name,"ThermalPenaltyLock")==0) return ThermalPenaltyLockEnum;
+ 	      else if (strcmp(name,"ThermalPenaltyThreshold")==0) return ThermalPenaltyThresholdEnum;
+@@ -381,11 +382,11 @@
+ 	      else if (strcmp(name,"AdolcParam")==0) return AdolcParamEnum;
+ 	      else if (strcmp(name,"BoolInput")==0) return BoolInputEnum;
+ 	      else if (strcmp(name,"BoolParam")==0) return BoolParamEnum;
+-	      else if (strcmp(name,"Contour")==0) return ContourEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"ControlInput")==0) return ControlInputEnum;
++	      if (strcmp(name,"Contour")==0) return ContourEnum;
++	      else if (strcmp(name,"ControlInput")==0) return ControlInputEnum;
+ 	      else if (strcmp(name,"DatasetInput")==0) return DatasetInputEnum;
+ 	      else if (strcmp(name,"DoubleInput")==0) return DoubleInputEnum;
+ 	      else if (strcmp(name,"DataSetParam")==0) return DataSetParamEnum;
+@@ -504,11 +505,11 @@
+ 	      else if (strcmp(name,"EnthalpyPicard")==0) return EnthalpyPicardEnum;
+ 	      else if (strcmp(name,"ThicknessAbsGradient")==0) return ThicknessAbsGradientEnum;
+ 	      else if (strcmp(name,"ThicknessAlongGradient")==0) return ThicknessAlongGradientEnum;
+-	      else if (strcmp(name,"ThicknessAcrossGradient")==0) return ThicknessAcrossGradientEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"IntMatParam")==0) return IntMatParamEnum;
++	      if (strcmp(name,"ThicknessAcrossGradient")==0) return ThicknessAcrossGradientEnum;
++	      else if (strcmp(name,"IntMatParam")==0) return IntMatParamEnum;
+ 	      else if (strcmp(name,"RheologyBbarAbsGradient")==0) return RheologyBbarAbsGradientEnum;
+ 	      else if (strcmp(name,"DragCoefficientAbsGradient")==0) return DragCoefficientAbsGradientEnum;
+ 	      else if (strcmp(name,"TransientInput")==0) return TransientInputEnum;
+@@ -627,11 +628,11 @@
+ 	      else if (strcmp(name,"TriangleInterp")==0) return TriangleInterpEnum;
+ 	      else if (strcmp(name,"BilinearInterp")==0) return BilinearInterpEnum;
+ 	      else if (strcmp(name,"NearestInterp")==0) return NearestInterpEnum;
+-	      else if (strcmp(name,"XY")==0) return XYEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"XYZ")==0) return XYZEnum;
++	      if (strcmp(name,"XY")==0) return XYEnum;
++	      else if (strcmp(name,"XYZ")==0) return XYZEnum;
+ 	      else if (strcmp(name,"Dense")==0) return DenseEnum;
+ 	      else if (strcmp(name,"MpiDense")==0) return MpiDenseEnum;
+ 	      else if (strcmp(name,"MpiSparse")==0) return MpiSparseEnum;
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17099)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17100)
+@@ -59,6 +59,7 @@
+ 	parameters->AddObject(iomodel->CopyConstantObject(SettingsWaitonlockEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(MeshNumberofelementsEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(MeshNumberofverticesEnum));
++	parameters->AddObject(iomodel->CopyConstantObject(SettingsResultsOnNodesEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(SettingsIoGatherEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(GroundinglineMigrationEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(TransientIsstressbalanceEnum));
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17099)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17100)
+@@ -21,7 +21,6 @@
+ #include "../modules/SpcNodesx/SpcNodesx.h"
+ #include "../modules/ConfigureObjectsx/ConfigureObjectsx.h"
+ #include "../modules/ParseToolkitsOptionsx/ParseToolkitsOptionsx.h"
+-#include "../modules/OutputResultsx/OutputResultsx.h"
+ #include "../modules/GetVectorFromInputsx/GetVectorFromInputsx.h"
+ #include "../modules/InputUpdateFromVectorx/InputUpdateFromVectorx.h"
+ #include "../modules/NodesDofx/NodesDofx.h"
+@@ -470,7 +469,7 @@
+ void FemModel::RequestedOutputsx(Results **presults,char** requested_outputs, int numoutputs, bool save_results){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	bool        isvec;
++	bool        isvec,results_on_nodes;
+ 	int         step,output_enum;
+ 	IssmDouble  time;
+ 	IssmDouble  double_result;
+@@ -483,6 +482,7 @@
+ 	/*Get time and step*/
+ 	parameters->FindParam(&step,StepEnum);
+ 	parameters->FindParam(&time,TimeEnum);
++	parameters->FindParam(&results_on_nodes,SettingsResultsOnNodesEnum);
+ 
+ 	/*Go through all requested output*/
+ 	for(int i=0;i<numoutputs;i++){
+@@ -540,31 +540,54 @@
+ 				default:
+ 
+ 					/*Vector layout*/
+-					int interpolation,size;
++					int interpolation,nodesperelement,size;
+ 
+ 					/*Get interpolation (and compute input if necessary)*/
+ 					for(int j=0;j<elements->Size();j++){
+ 						Element* element=dynamic_cast<Element*>(this->elements->GetObjectByOffset(j));
+-						element->ResultInterpolation(&interpolation,output_enum);
++						element->ResultInterpolation(&interpolation,&nodesperelement,output_enum);
+ 					}
+ 
+-					/*Allocate vector depending on interpolation*/
+-					switch(interpolation){
+-						case P0Enum: size = this->elements->NumberOfElements(); break;
+-						case P1Enum: size = this->vertices->NumberOfVertices(); break;
+-						default:     _error_("Interpolation "<<EnumToStringx(interpolation)<<" not supported yet");
++					if(results_on_nodes){
+ 
++						/*Allocate matrices*/
++						int         nbe       = this->elements->NumberOfElements();
++						IssmDouble* values    = xNew<IssmDouble>(nbe*nodesperelement);
++						IssmDouble* allvalues = xNew<IssmDouble>(nbe*nodesperelement);
++
++						/*Fill-in matrix*/
++						for(int j=0;j<elements->Size();j++){
++							Element* element=dynamic_cast<Element*>(this->elements->GetObjectByOffset(j));
++							element->ResultToPatch(values,nodesperelement,output_enum);
++						}
++
++						/*Gather from all cpus*/
++						MPI_Allreduce((void*)values,(void*)allvalues,nbe*nodesperelement,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD);
++						xDelete<IssmDouble>(values);
++
++						if(save_results)results->AddResult(new GenericExternalResult<IssmDouble*>(results->Size()+1,output_enum,allvalues,nbe,nodesperelement,step,time));
++
+ 					}
+-					Vector<IssmDouble> *vector_result = new Vector<IssmDouble>(size);
++					else{
+ 
+-					/*Fill in vector*/
+-					for(int j=0;j<elements->Size();j++){
+-						Element* element=(Element*)elements->GetObjectByOffset(j);
+-						element->ResultToVector(vector_result,output_enum);
++						/*Allocate vector depending on interpolation*/
++						switch(interpolation){
++							case P0Enum: size = this->elements->NumberOfElements(); break;
++							case P1Enum: size = this->vertices->NumberOfVertices(); break;
++							default:     _error_("Interpolation "<<EnumToStringx(interpolation)<<" not supported yet");
++
++						}
++						Vector<IssmDouble> *vector_result = new Vector<IssmDouble>(size);
++
++						/*Fill in vector*/
++						for(int j=0;j<elements->Size();j++){
++							Element* element=(Element*)elements->GetObjectByOffset(j);
++							element->ResultToVector(vector_result,output_enum);
++						}
++						vector_result->Assemble();
++
++						if(save_results)results->AddResult(new GenericExternalResult<Vector<IssmDouble>*>(results->Size()+1,output_enum,vector_result,step,time));
+ 					}
+-					vector_result->Assemble();
+-
+-					if (save_results)results->AddResult(new GenericExternalResult<Vector<IssmDouble>*>(results->Size()+1,output_enum,vector_result,step,time));
+ 					isvec = true;
+ 					break;
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17099)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17100)
+@@ -64,8 +64,9 @@
+ 		void       GetVerticesSidList(int* sidlist);
+ 		void       GetVerticesConnectivityList(int* connectivitylist);
+ 		bool       IsFloating(); 
+-		void       ResultInterpolation(int* pinterpolation,int output_enum);
++		void       ResultInterpolation(int* pinterpolation,int*nodesperelement,int output_enum);
+ 		void       ResultToVector(Vector<IssmDouble>* vector,int output_enum);
++		void       ResultToPatch(IssmDouble* values,int nodesperelement,int output_enum);
+ 		void       StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 		void       StrainRateHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 		void       StrainRateFS(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17099)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17100)
+@@ -152,7 +152,7 @@
+ 
+ 	return shelf;
+ }/*}}}*/
+-void Element::ResultInterpolation(int* pinterpolation,int output_enum){/*{{{*/
++void Element::ResultInterpolation(int* pinterpolation,int* pnodesperelement,int output_enum){/*{{{*/
+ 
+ 	Input* input=this->inputs->GetInput(output_enum);
+ 
+@@ -193,7 +193,8 @@
+ 	}
+ 
+ 	/*Assign output pointer*/
+-	*pinterpolation = input->GetResultInterpolation();
++	*pinterpolation   = input->GetResultInterpolation();
++	*pnodesperelement = input->GetResultNumberOfNodes();
+ }/*}}}*/
+ void Element::ResultToVector(Vector<IssmDouble>* vector,int output_enum){/*{{{*/
+ 
+@@ -241,6 +242,14 @@
+ 					 _error_("interpolation "<<EnumToStringx(input->GetResultInterpolation())<<" not supported yet");
+ 	}
+ } /*}}}*/
++void Element::ResultToPatch(IssmDouble* values,int nodesperelement,int output_enum){/*{{{*/
++
++	Input* input=this->inputs->GetInput(output_enum);
++	if(!input) _error_("input "<<EnumToStringx(output_enum)<<" not found in element");
++
++	input->ResultToPatch(values,nodesperelement,this->Sid());
++
++} /*}}}*/
+ IssmDouble Element::TMeltingPoint(IssmDouble pressure){/*{{{*/
+ 	_assert_(matpar);
+ 	return this->matpar->TMeltingPoint(pressure);
+Index: ../trunk-jpl/src/c/classes/Inputs/DoubleInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/DoubleInput.h	(revision 17099)
++++ ../trunk-jpl/src/c/classes/Inputs/DoubleInput.h	(revision 17100)
+@@ -38,6 +38,8 @@
+ 		Input* PointwiseMin(Input* inputB);
+ 		Input* PointwiseMax(Input* inputB);
+ 		int  GetResultInterpolation(void){return P0Enum;};
++		int  GetResultNumberOfNodes(void){return 1;};
++		void ResultToPatch(IssmDouble* values,int nodesperelement,int sid){_error_("not supported yet");};
+ 		void AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error_("not supported yet");};
+ 		void Configure(Parameters* parameters);
+ 		/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Inputs/ControlInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/ControlInput.cpp	(revision 17099)
++++ ../trunk-jpl/src/c/classes/Inputs/ControlInput.cpp	(revision 17100)
+@@ -145,6 +145,13 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION ControlInput::GetResultNumberOfNodes{{{*/
++int  ControlInput::GetResultNumberOfNodes(void){
++
++	return values->GetResultNumberOfNodes();
++
++}
++/*}}}*/
+ /*FUNCTION ControlInput::GetGradient{{{*/
+ void ControlInput::GetGradient(Vector<IssmDouble>* gradient_vec,int* doflist){
+ 	if(gradient) gradient->GetVectorFromInputs(gradient_vec,doflist);
+Index: ../trunk-jpl/src/c/classes/Inputs/SegInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/SegInput.h	(revision 17099)
++++ ../trunk-jpl/src/c/classes/Inputs/SegInput.h	(revision 17100)
+@@ -39,6 +39,8 @@
+ 		Input* PointwiseMin(Input* inputB){_error_("not supported yet");};
+ 		Input* PointwiseMax(Input* inputB){_error_("not supported yet");};
+ 		int  GetResultInterpolation(void){_error_("not implemented");};
++		int  GetResultNumberOfNodes(void){_error_("not implemented");};
++		void ResultToPatch(IssmDouble* values,int nodesperelement,int sid){_error_("not supported yet");};
+ 		void   AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error_("not supported yet");};
+ 		void   Configure(Parameters* parameters);
+ 
+Index: ../trunk-jpl/src/c/classes/Inputs/Input.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/Input.h	(revision 17099)
++++ ../trunk-jpl/src/c/classes/Inputs/Input.h	(revision 17100)
+@@ -45,7 +45,7 @@
+ 		virtual IssmDouble MinAbs(void)=0;
+ 		virtual IssmDouble Max(void)=0;
+ 		virtual IssmDouble Min(void)=0;
+-		virtual void Set(IssmDouble setvalue)=0;
++		virtual void   Set(IssmDouble setvalue)=0;
+ 		virtual void   Scale(IssmDouble scale_factor)=0;
+ 		virtual void   AXPY(Input* xinput,IssmDouble scalar)=0;
+ 		virtual void   Constrain(IssmDouble cm_min, IssmDouble cm_max)=0;
+@@ -58,6 +58,8 @@
+ 		virtual Input* PointwiseDivide(Input* inputB)=0;
+ 		virtual Input* PointwiseMax(Input* inputmax)=0;
+ 		virtual Input* PointwiseMin(Input* inputmin)=0;
+-		virtual int GetResultInterpolation(void)=0;
++		virtual int  GetResultInterpolation(void)=0;
++		virtual int  GetResultNumberOfNodes(void)=0;
++		virtual void ResultToPatch(IssmDouble* values,int nodesperelement,int sid){_error_("not supported yet");};
+ };
+ #endif
+Index: ../trunk-jpl/src/c/classes/Inputs/ControlInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/ControlInput.h	(revision 17099)
++++ ../trunk-jpl/src/c/classes/Inputs/ControlInput.h	(revision 17100)
+@@ -76,6 +76,8 @@
+ 		void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist,const char* data);
+ 		void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist);
+ 		int  GetResultInterpolation(void);
++		int  GetResultNumberOfNodes(void);
++		void ResultToPatch(IssmDouble* values,int nodesperelement,int sid){_error_("not supported yet");};
+ 		void GetGradient(Vector<IssmDouble>* gradient_vec,int* doflist);
+ 		void ScaleGradient(IssmDouble scale);
+ 		void SetGradient(Input* gradient_in);
+Index: ../trunk-jpl/src/c/classes/Inputs/DatasetInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/DatasetInput.h	(revision 17099)
++++ ../trunk-jpl/src/c/classes/Inputs/DatasetInput.h	(revision 17100)
+@@ -71,6 +71,8 @@
+ 		void VerticallyIntegrate(Input* thickness_input){_error_("not implemented yet");};
+ 		void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist){_error_("not implemented yet");};
+ 		int GetResultInterpolation(void){_error_("not implemented yet");};
++		int GetResultNumberOfNodes(void){_error_("not implemented yet");};
++		void ResultToPatch(IssmDouble* values,int nodesperelement,int sid){_error_("not supported yet");};
+ 		void GetGradient(Vector<IssmDouble>* gradient_vec,int* doflist){_error_("not implemented yet");};
+ 		void ScaleGradient(IssmDouble scale){_error_("not implemented yet");};
+ 		void SetGradient(Input* gradient_in){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 17099)
++++ ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 17100)
+@@ -121,7 +121,32 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION TriaInput::GetResultNumberOfNodes{{{*/
++int  TriaInput::GetResultNumberOfNodes(void){
+ 
++	return this->NumberofNodes();
++
++}
++/*}}}*/
++/*FUNCTION TriaInput::ResultToPatch{{{*/
++void TriaInput::ResultToPatch(IssmDouble* values,int nodesperelement,int sid){
++
++	int numnodes = this->NumberofNodes();
++
++	/*Some checks*/
++	_assert_(values);
++	_assert_(numnodes==nodesperelement);
++
++	/*Fill in arrays*/
++	for(int i=0;i<numnodes;i++){
++		values[sid*numnodes + i] = this->values[i];
++	}
++
++
++
++}
++/*}}}*/
++
+ /*Object functions*/
+ /*FUNCTION TriaInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){{{*/
+ void TriaInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){
+Index: ../trunk-jpl/src/c/classes/Inputs/IntInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/IntInput.h	(revision 17099)
++++ ../trunk-jpl/src/c/classes/Inputs/IntInput.h	(revision 17100)
+@@ -39,6 +39,8 @@
+ 		Input* PointwiseMin(Input* inputB){_error_("not implemented yet");};
+ 		Input* PointwiseMax(Input* inputB){_error_("not implemented yet");};
+ 		int  GetResultInterpolation(void){return P0Enum;};
++		int  GetResultNumberOfNodes(void){return 1;};
++		void ResultToPatch(IssmDouble* values,int nodesperelement,int sid){_error_("not supported yet");};
+ 		void AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error_("not supported yet");};
+ 		void Configure(Parameters* parameters);
+ 		/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Inputs/BoolInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/BoolInput.h	(revision 17099)
++++ ../trunk-jpl/src/c/classes/Inputs/BoolInput.h	(revision 17100)
+@@ -35,6 +35,8 @@
+ 		Input* PointwiseMin(Input* inputB){_error_("not implemented yet");};
+ 		Input* PointwiseMax(Input* inputB){_error_("not implemented yet");};
+ 		int  GetResultInterpolation(void){return P0Enum;};
++		int  GetResultNumberOfNodes(void){return 1;};
++		void ResultToPatch(IssmDouble* values,int nodesperelement,int sid){_error_("not supported yet");};
+ 		void Configure(Parameters* parameters);
+ 		void AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error_("not supported yet");};
+ 		/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Inputs/TriaInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TriaInput.h	(revision 17099)
++++ ../trunk-jpl/src/c/classes/Inputs/TriaInput.h	(revision 17100)
+@@ -39,6 +39,8 @@
+ 		Input* PointwiseMin(Input* inputB);
+ 		Input* PointwiseMax(Input* inputB);
+ 		int    GetResultInterpolation(void);
++		int    GetResultNumberOfNodes(void);
++		void   ResultToPatch(IssmDouble* values,int nodesperelement,int sid);
+ 		void   AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error_("not supported yet");};
+ 		void   Configure(Parameters* parameters);
+ 
+Index: ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 17099)
++++ ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 17100)
+@@ -134,7 +134,14 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION PentaInput::GetResultNumberOfNodes{{{*/
++int  PentaInput::GetResultNumberOfNodes(void){
+ 
++	return this->NumberofNodes();;
++
++}
++/*}}}*/
++
+ /*Object functions*/
+ /*FUNCTION PentaInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){{{*/
+ void PentaInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){
+Index: ../trunk-jpl/src/c/classes/Inputs/TransientInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TransientInput.cpp	(revision 17099)
++++ ../trunk-jpl/src/c/classes/Inputs/TransientInput.cpp	(revision 17100)
+@@ -351,6 +351,22 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION TransientInput::GetResultNumberOfNodes{{{*/
++int TransientInput::GetResultNumberOfNodes(void){
++
++	IssmDouble time;
++	int        output;
++
++	parameters->FindParam(&time,TimeEnum);
++	Input* input=GetTimeInput(time);
++	output = input->GetResultNumberOfNodes();
++
++	/*Clean up and return*/
++	delete input;
++	return output;
++
++}
++/*}}}*/
+ /*FUNCTION TransientInput::Extrude{{{*/
+ void TransientInput::Extrude(void){
+ 
+Index: ../trunk-jpl/src/c/classes/Inputs/PentaInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/PentaInput.h	(revision 17099)
++++ ../trunk-jpl/src/c/classes/Inputs/PentaInput.h	(revision 17100)
+@@ -39,6 +39,8 @@
+ 		Input* PointwiseMin(Input* inputB);
+ 		Input* PointwiseMax(Input* inputB);
+ 		int  GetResultInterpolation(void);
++		int  GetResultNumberOfNodes(void);
++		void ResultToPatch(IssmDouble* values,int nodesperelement,int sid){_error_("not supported yet");};
+ 		void AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error_("not supported yet");};
+ 		void Configure(Parameters* parameters);
+ 		/*numerics*/
+Index: ../trunk-jpl/src/c/classes/Inputs/TransientInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TransientInput.h	(revision 17099)
++++ ../trunk-jpl/src/c/classes/Inputs/TransientInput.h	(revision 17100)
+@@ -45,6 +45,8 @@
+ 		Input* PointwiseMin(Input* forcingB){_error_("not implemented yet");};
+ 		Input* PointwiseMax(Input* forcingB){_error_("not implemented yet");};
+ 		int  GetResultInterpolation(void);
++		int  GetResultNumberOfNodes(void);
++		void ResultToPatch(IssmDouble* values,int nodesperelement,int sid){_error_("not supported yet");};
+ 		void Configure(Parameters* parameters);
+ 		/*}}}*/
+ 		/*numerics: {{{*/
+Index: ../trunk-jpl/src/m/classes/settings.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/settings.py	(revision 17099)
++++ ../trunk-jpl/src/m/classes/settings.py	(revision 17100)
+@@ -12,6 +12,7 @@
+ 	"""
+ 
+ 	def __init__(self): # {{{
++		self.results_on_nodes    = 0
+ 		self.io_gather           = 0
+ 		self.lowmem              = 0
+ 		self.output_frequency    = 0
+@@ -24,6 +25,7 @@
+ 	def __repr__(self): # {{{
+ 		string="   general settings parameters:"
+ 
++		string="%s\n%s"%(string,fielddisplay(self,"results_on_nodes","results are output for all the nodes of each element"))
+ 		string="%s\n%s"%(string,fielddisplay(self,"io_gather","I/O gathering strategy for result outputs (default 1)"))
+ 		string="%s\n%s"%(string,fielddisplay(self,"lowmem","is the memory limited ? (0 or 1)"))
+ 		string="%s\n%s"%(string,fielddisplay(self,"output_frequency","frequency at which results are saved in all solutions with multiple time_steps"))
+@@ -50,6 +52,7 @@
+ 		return self
+ 	#}}}
+ 	def checkconsistency(self,md,solution,analyses):    # {{{
++		md = checkfield(md,'fieldname','settings.results_on_nodes','numel',[1],'values',[0,1])
+ 		md = checkfield(md,'fieldname','settings.io_gather','numel',[1],'values',[0,1])
+ 		md = checkfield(md,'fieldname','settings.lowmem','numel',[1],'values',[0,1])
+ 		md = checkfield(md,'fieldname','settings.output_frequency','numel',[1],'>=',1)
+@@ -58,6 +61,7 @@
+ 		return md
+ 	# }}}
+ 	def marshall(self,md,fid):    # {{{
++		WriteData(fid,'object',self,'fieldname','results_on_nodes','format','Boolean')
+ 		WriteData(fid,'object',self,'fieldname','io_gather','format','Boolean')
+ 		WriteData(fid,'object',self,'fieldname','lowmem','format','Boolean')
+ 		WriteData(fid,'object',self,'fieldname','output_frequency','format','Integer')
+Index: ../trunk-jpl/src/m/classes/settings.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/settings.m	(revision 17099)
++++ ../trunk-jpl/src/m/classes/settings.m	(revision 17100)
+@@ -5,6 +5,7 @@
+ 
+ classdef settings
+ 	properties (SetAccess=public) 
++		results_on_nodes    = 0;
+ 		io_gather           = 0;
+ 		lowmem              = 0;
+ 		output_frequency    = 0;
+@@ -48,6 +49,7 @@
+ 		end % }}}
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+ 
++			md = checkfield(md,'fieldname','settings.results_on_nodes','numel',[1],'values',[0 1]);
+ 			md = checkfield(md,'fieldname','settings.io_gather','numel',[1],'values',[0 1]);
+ 			md = checkfield(md,'fieldname','settings.lowmem','numel',[1],'values',[0 1]);
+ 			md = checkfield(md,'fieldname','settings.output_frequency','numel',[1],'>=',1);
+@@ -57,6 +59,7 @@
+ 		function disp(obj) % {{{
+ 			disp(sprintf('   general settings parameters:'));
+ 
++			fielddisplay(obj,'results_on_nodes','results are output for all the nodes of each element');
+ 			fielddisplay(obj,'io_gather','I/O gathering strategy for result outputs (default 1)');
+ 			fielddisplay(obj,'lowmem','is the memory limited ? (0 or 1)');
+ 			fielddisplay(obj,'output_frequency','frequency at which results are saved in all solutions with multiple time_steps');
+@@ -69,6 +72,7 @@
+ 
+ 		end % }}}
+ 		function marshall(obj,md,fid) % {{{
++			WriteData(fid,'object',obj,'fieldname','results_on_nodes','format','Boolean');
+ 			WriteData(fid,'object',obj,'fieldname','io_gather','format','Boolean');
+ 			WriteData(fid,'object',obj,'fieldname','lowmem','format','Boolean');
+ 			WriteData(fid,'object',obj,'fieldname','output_frequency','format','Integer');
+Index: ../trunk-jpl/src/m/enum/SettingsResultsOnNodesEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/SettingsResultsOnNodesEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/SettingsResultsOnNodesEnum.m	(revision 17100)
+@@ -0,0 +1,11 @@
++function macro=SettingsResultsOnNodesEnum()
++%SETTINGSRESULTSONNODESENUM - Enum of SettingsResultsOnNodes
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=SettingsResultsOnNodesEnum()
++
++macro=StringToEnum('SettingsResultsOnNodes');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17099)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17100)
+@@ -232,6 +232,7 @@
+ def QmuMaterialsRheologyBEnum(): return StringToEnum("QmuMaterialsRheologyB")[0]
+ def RiftsNumriftsEnum(): return StringToEnum("RiftsNumrifts")[0]
+ def RiftsRiftstructEnum(): return StringToEnum("RiftsRiftstruct")[0]
++def SettingsResultsOnNodesEnum(): return StringToEnum("SettingsResultsOnNodes")[0]
+ def SettingsIoGatherEnum(): return StringToEnum("SettingsIoGather")[0]
+ def SettingsLowmemEnum(): return StringToEnum("SettingsLowmem")[0]
+ def SettingsOutputFrequencyEnum(): return StringToEnum("SettingsOutputFrequency")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17100-17101.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17100-17101.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17100-17101.diff	(revision 17802)
@@ -0,0 +1,23 @@
+Index: ../trunk-jpl/externalpackages/cython/install.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/cython/install.sh	(revision 0)
++++ ../trunk-jpl/externalpackages/cython/install.sh	(revision 17101)
+@@ -0,0 +1,12 @@
++#!/bin/bash
++set -eu
++
++#clean up
++rm -rf cython
++
++#download cython first
++git clone https://github.com/cython/cython.git
++
++#install cython
++cd cython
++python setup.py install
+
+Property changes on: ../trunk-jpl/externalpackages/cython/install.sh
+___________________________________________________________________
+Name: svn:executable
+   + *
+
Index: issm/oecreview/Archive/16554-17801/ISSM-17101-17102.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17101-17102.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17101-17102.diff	(revision 17802)
@@ -0,0 +1,77 @@
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17101)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17102)
+@@ -552,7 +552,7 @@
+ 
+ 						/*Allocate matrices*/
+ 						int         nbe       = this->elements->NumberOfElements();
+-						IssmDouble* values    = xNew<IssmDouble>(nbe*nodesperelement);
++						IssmDouble* values    = xNewZeroInit<IssmDouble>(nbe*nodesperelement);
+ 						IssmDouble* allvalues = xNew<IssmDouble>(nbe*nodesperelement);
+ 
+ 						/*Fill-in matrix*/
+@@ -566,6 +566,7 @@
+ 						xDelete<IssmDouble>(values);
+ 
+ 						if(save_results)results->AddResult(new GenericExternalResult<IssmDouble*>(results->Size()+1,output_enum,allvalues,nbe,nodesperelement,step,time));
++						xDelete<IssmDouble>(allvalues);
+ 
+ 					}
+ 					else{
+Index: ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 17101)
++++ ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 17102)
+@@ -138,12 +138,7 @@
+ 	_assert_(numnodes==nodesperelement);
+ 
+ 	/*Fill in arrays*/
+-	for(int i=0;i<numnodes;i++){
+-		values[sid*numnodes + i] = this->values[i];
+-	}
+-
+-
+-
++	for(int i=0;i<numnodes;i++) values[sid*numnodes + i] = this->values[i];
+ }
+ /*}}}*/
+ 
+Index: ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 17101)
++++ ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 17102)
+@@ -141,7 +141,20 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION PentaInput::ResultToPatch{{{*/
++void PentaInput::ResultToPatch(IssmDouble* values,int nodesperelement,int sid){
+ 
++	int numnodes = this->NumberofNodes();
++
++	/*Some checks*/
++	_assert_(values);
++	_assert_(numnodes==nodesperelement);
++
++	/*Fill in arrays*/
++	for(int i=0;i<numnodes;i++) values[sid*numnodes + i] = this->values[i];
++}
++/*}}}*/
++
+ /*Object functions*/
+ /*FUNCTION PentaInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){{{*/
+ void PentaInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){
+Index: ../trunk-jpl/src/c/classes/Inputs/PentaInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/PentaInput.h	(revision 17101)
++++ ../trunk-jpl/src/c/classes/Inputs/PentaInput.h	(revision 17102)
+@@ -40,7 +40,7 @@
+ 		Input* PointwiseMax(Input* inputB);
+ 		int  GetResultInterpolation(void);
+ 		int  GetResultNumberOfNodes(void);
+-		void ResultToPatch(IssmDouble* values,int nodesperelement,int sid){_error_("not supported yet");};
++		void ResultToPatch(IssmDouble* values,int nodesperelement,int sid);
+ 		void AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error_("not supported yet");};
+ 		void Configure(Parameters* parameters);
+ 		/*numerics*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17102-17103.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17102-17103.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17102-17103.diff	(revision 17802)
@@ -0,0 +1,51 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17102)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17103)
+@@ -3302,6 +3302,7 @@
+ }/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionFS(IssmDouble* solution,Element* element){/*{{{*/
+ 
++	bool         results_on_nodes;
+ 	int          i,dim,meshtype;
+ 	int*         vdoflist=NULL;
+ 	int*         pdoflist=NULL;
+@@ -3309,6 +3310,7 @@
+ 
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+ 	element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
++	element->FindParam(&results_on_nodes,SettingsResultsOnNodesEnum);
+ 	switch(meshtype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+@@ -3376,16 +3378,20 @@
+ 	if(dim==3) element->InputChangeName(VzEnum,VzPicardEnum);
+ 
+ 	/*Add vx and vy as inputs to the tria element: */
+-	//element->AddInput(VxEnum,      vx,      element->VelocityInterpolation());
+-	//element->AddInput(VyEnum,      vy,      element->VelocityInterpolation());
+-	//element->AddInput(VelEnum,     vel,     element->VelocityInterpolation());
+-	//element->AddInput(PressureEnum,pressure,element->PressureInterpolation());
+-	//if(dim==3) element->AddInput(VzEnum,vz, element->VelocityInterpolation());
+-	element->AddInput(VxEnum,vx,P1Enum);
+-	element->AddInput(VyEnum,vy,P1Enum);
+-	element->AddInput(VelEnum,vel,P1Enum);
+-	element->AddInput(PressureEnum,pressure,P1Enum);
+-	if(dim==3) element->AddInput(VzEnum,vz,P1Enum);
++	if(results_on_nodes){
++		element->AddInput(VxEnum,      vx,      element->VelocityInterpolation());
++		element->AddInput(VyEnum,      vy,      element->VelocityInterpolation());
++		element->AddInput(VelEnum,     vel,     element->VelocityInterpolation());
++		element->AddInput(PressureEnum,pressure,element->PressureInterpolation());
++		if(dim==3) element->AddInput(VzEnum,vz, element->VelocityInterpolation());
++	}
++	else{
++		element->AddInput(VxEnum,vx,P1Enum);
++		element->AddInput(VyEnum,vy,P1Enum);
++		element->AddInput(VelEnum,vel,P1Enum);
++		element->AddInput(PressureEnum,pressure,P1Enum);
++		if(dim==3) element->AddInput(VzEnum,vz,P1Enum);
++	}
+ 
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(pressure);
Index: issm/oecreview/Archive/16554-17801/ISSM-17103-17104.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17103-17104.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17103-17104.diff	(revision 17802)
@@ -0,0 +1,72 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17103)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17104)
+@@ -158,6 +158,7 @@
+ 						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+3,counter+3,lid++,0,iomodel,analysis,approximation);
+ 						nodes->AddObject(node);
+ 					}
++					counter=counter+3;
+ 				}
+ 				else if(iomodel->edges[i*3+2]==1){/*Basal edges*/
+ 					if(my_edges[i]){
+@@ -170,17 +171,18 @@
+ 						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+4,counter+4,lid++,0,iomodel,analysis,approximation);
+ 						nodes->AddObject(node);
+ 					}
++					counter=counter+4;
+ 				}
+ 				else if(iomodel->edges[i*3+2]==3){/*Top edges*/
+ 					if(my_edges[i]){
+ 						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
+ 						nodes->AddObject(node);
+ 					}
++					counter=counter+1;
+ 				}
+ 				else{
+ 					_error_("not supported");
+ 				}
+-				counter=counter+4;
+ 			}
+ 			break;
+ 
+@@ -304,6 +306,7 @@
+ 						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+3,counter+3,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 						nodes->AddObject(node);
+ 					}
++					counter=counter+3;
+ 				}
+ 				else if(iomodel->edges[i*3+2]==1){/*Basal edges*/
+ 					if(my_edges[i]){
+@@ -316,27 +319,27 @@
+ 						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+4,counter+4,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 						nodes->AddObject(node);
+ 					}
++					counter=counter+4;
+ 				}
+ 				else if(iomodel->edges[i*3+2]==3){/*Top edges*/
+ 					if(my_edges[i]){
+ 						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 						nodes->AddObject(node);
+ 					}
++					counter=counter+1;
+ 				}
+ 				else{
+ 					_error_("not supported");
+ 				}
+-				counter=counter+4;
+ 			}
+ 			/*P1xP3 pressure*/
+ 			vnodes = iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->numberofedges;
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+-					nodes->AddObject(new Node(vnodes+i+1,i,lid++,i,iomodel,analysis,FSpressureEnum));
++					nodes->AddObject(new Node(vnodes+i+1,counter+1,lid++,i,iomodel,analysis,FSpressureEnum));
+ 				}
++				counter++;
+ 			}
+-
+-			counter = iomodel->numberofvertices;
+ 			for(i=0;i<iomodel->numberofedges;i++){
+ 				if(iomodel->edges[i*3+2]==2){
+ 					if(my_edges[i]){
Index: issm/oecreview/Archive/16554-17801/ISSM-17104-17105.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17104-17105.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17104-17105.diff	(revision 17802)
@@ -0,0 +1,15 @@
+Index: ../trunk-jpl/src/m/classes/model.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.py	(revision 17104)
++++ ../trunk-jpl/src/m/classes/model.py	(revision 17105)
+@@ -590,7 +590,10 @@
+ 			md.initialization.temperature=project3d(md,'vector',md.initialization.temperature,'type','node')
+ 		if not numpy.any(numpy.isnan(md.initialization.waterfraction)):
+ 			md.initialization.waterfraction=project3d(md,'vector',md.initialization.waterfraction,'type','node')
++		if not numpy.any(numpy.isnan(md.initialization.watercolumn)):
++			md.initialization.watercolumn=project3d(md,'vector',md.initialization.watercolumn,'type','node')
+ 
++
+ 		#bedinfo and surface info
+ 		md.mesh.elementonbed=project3d(md,'vector',numpy.ones(md.mesh.numberofelements2d,bool),'type','element','layer',1)
+ 		md.mesh.elementonsurface=project3d(md,'vector',numpy.ones(md.mesh.numberofelements2d,bool),'type','element','layer',md.mesh.numberoflayers-1)
Index: issm/oecreview/Archive/16554-17801/ISSM-17105-17106.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17105-17106.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17105-17106.diff	(revision 17802)
@@ -0,0 +1,384 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17105)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17106)
+@@ -2595,7 +2595,7 @@
+ 	if(dim==3){vz_input=element->GetInput(VzEnum); _assert_(vz_input);}
+ 
+ 	/* Start  looping on the number of gaussian points: */
+-	Gauss* gauss = element->NewGauss(5);
++	Gauss* gauss = element->NewGauss(10);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		gauss->GaussPoint(ig);
+ 
+@@ -2679,10 +2679,10 @@
+ 		gllevelset_input=element->GetInput(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input);
+ 		element->GetGroundedPart(&point1,&fraction1,&fraction2,&mainlyfloating);
+ 		//gauss = element->NewGauss(point1,fraction1,fraction2,mainlyfloating,2);
+-		gauss=element->NewGaussBase(3);
++		gauss=element->NewGaussBase(10);
+ 	}
+ 	else{
+-		gauss=element->NewGaussBase(3);
++		gauss=element->NewGaussBase(10);
+ 	}
+ 
+ 	/* Start  looping on the number of gaussian points: */
+@@ -2770,7 +2770,7 @@
+ 	}
+ 
+ 	/* Start  looping on the number of gaussian points: */
+-	Gauss* gauss=element->NewGauss(5);
++	Gauss* gauss=element->NewGauss(10);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		gauss->GaussPoint(ig);
+ 
+@@ -2843,7 +2843,7 @@
+ 	IssmDouble  gravity  =element->GetMaterialParameter(ConstantsGEnum);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+-	Gauss* gauss=element->NewGaussBase(5);
++	Gauss* gauss=element->NewGaussBase(10);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		gauss->GaussPoint(ig);
+ 
+Index: ../trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp	(revision 17105)
++++ ../trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp	(revision 17106)
+@@ -44,6 +44,7 @@
+ 	memcpy(function_name,what_function.c_str(),len);
+ 
+ 	file_line= what_line;
++	this->Report();
+ 
+ }/*}}}*/
+ ErrorException::~ErrorException() throw(){/*{{{*/
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17105)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17106)
+@@ -12,6 +12,7 @@
+ 
+ 	/*Intermediaries*/
+ 	int   i,j,counter,vnodes,lid=0;
++	int   id0 = iomodel->nodecounter;
+ 	bool *my_edges = NULL;
+ 	bool *my_nodes = NULL;
+ 	Node *node     = NULL;
+@@ -20,7 +21,7 @@
+ 		case P1Enum:
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+-					nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,lid++,i,iomodel,analysis,approximation));
++					nodes->AddObject(new Node(id0+i+1,i,lid++,i,iomodel,analysis,approximation));
+ 				}
+ 			}
+ 			break;
+@@ -30,7 +31,7 @@
+ 			for(i=0;i<iomodel->numberofelements;i++){
+ 				for(j=0;j<3;j++){
+ 					if(my_nodes[3*i+j]){ 
+-						nodes->AddObject(new Node(iomodel->nodecounter+3*i+j+1,iomodel->nodecounter+3*i+j,lid++,iomodel->elements[+3*i+j]-1,iomodel,analysis,approximation));
++						nodes->AddObject(new Node(id0+3*i+j+1,id0+3*i+j,lid++,iomodel->elements[+3*i+j]-1,iomodel,analysis,approximation));
+ 
+ 					}
+ 				}
+@@ -40,12 +41,12 @@
+ 		case P1bubbleEnum:
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+-					nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,lid++,i,iomodel,analysis,approximation));
++					nodes->AddObject(new Node(id0+i+1,i,lid++,i,iomodel,analysis,approximation));
+ 				}
+ 			}
+ 			for(i=0;i<iomodel->numberofelements;i++){
+ 				if(iomodel->my_elements[i]){
+-					nodes->AddObject(new Node(iomodel->nodecounter+iomodel->numberofvertices+i+1,iomodel->numberofvertices+i,lid++,0,iomodel,analysis,approximation));
++					nodes->AddObject(new Node(id0+iomodel->numberofvertices+i+1,iomodel->numberofvertices+i,lid++,0,iomodel,analysis,approximation));
+ 				}
+ 			}
+ 			break;
+@@ -53,12 +54,12 @@
+ 		case P1bubblecondensedEnum:
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+-					nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,lid++,i,iomodel,analysis,approximation));
++					nodes->AddObject(new Node(id0+i+1,i,lid++,i,iomodel,analysis,approximation));
+ 				}
+ 			}
+ 			for(i=0;i<iomodel->numberofelements;i++){
+ 				if(iomodel->my_elements[i]){
+-					node = new Node(iomodel->nodecounter+iomodel->numberofvertices+i+1,iomodel->numberofvertices+i,lid++,0,iomodel,analysis,approximation);
++					node = new Node(id0+iomodel->numberofvertices+i+1,iomodel->numberofvertices+i,lid++,0,iomodel,analysis,approximation);
+ 					node->Deactivate();
+ 					nodes->AddObject(node);
+ 				}
+@@ -69,7 +70,7 @@
+ 			EdgesPartitioning(&my_edges,iomodel);
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+-					nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,lid++,i,iomodel,analysis,approximation));
++					nodes->AddObject(new Node(id0+i+1,i,lid++,i,iomodel,analysis,approximation));
+ 				}
+ 			}
+ 
+@@ -77,7 +78,7 @@
+ 			for(i=0;i<iomodel->numberofedges;i++){
+ 				if(iomodel->edges[i*3+2]==2){
+ 					if(my_edges[i]){
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+i+1,counter+1,lid++,0,iomodel,analysis,approximation);
++						node = new Node(id0+iomodel->numberofvertices+i+1,counter+1,lid++,0,iomodel,analysis,approximation);
+ 						nodes->AddObject(node);
+ 					}
+ 					counter++;
+@@ -89,7 +90,7 @@
+ 			EdgesPartitioning(&my_edges,iomodel);
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+-					nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,lid++,i,iomodel,analysis,approximation));
++					nodes->AddObject(new Node(id0+i+1,i,lid++,i,iomodel,analysis,approximation));
+ 				}
+ 			}
+ 
+@@ -97,9 +98,9 @@
+ 			for(i=0;i<iomodel->numberofedges;i++){
+ 				if(iomodel->edges[i*3+2]==2){
+ 					if(my_edges[i]){
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+2*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
++						node = new Node(id0+iomodel->numberofvertices+2*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
+ 						nodes->AddObject(node);
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+2*i+2,counter+2,lid++,0,iomodel,analysis,approximation);
++						node = new Node(id0+iomodel->numberofvertices+2*i+2,counter+2,lid++,0,iomodel,analysis,approximation);
+ 						nodes->AddObject(node);
+ 					}
+ 					counter=counter+2;
+@@ -111,7 +112,7 @@
+ 			EdgesPartitioning(&my_edges,iomodel);
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+-					nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,lid++,i,iomodel,analysis,approximation));
++					nodes->AddObject(new Node(id0+i+1,i,lid++,i,iomodel,analysis,approximation));
+ 				}
+ 			}
+ 
+@@ -119,7 +120,7 @@
+ 			for(i=0;i<iomodel->numberofedges;i++){
+ 				if(iomodel->edges[i*3+2]!=2){
+ 					if(my_edges[i]){
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+i+1,counter+1,lid++,0,iomodel,analysis,approximation);
++						node = new Node(id0+iomodel->numberofvertices+i+1,counter+1,lid++,0,iomodel,analysis,approximation);
+ 						nodes->AddObject(node);
+ 					}
+ 					counter++;
+@@ -131,12 +132,12 @@
+ 			EdgesPartitioning(&my_edges,iomodel);
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+-					nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,lid++,i,iomodel,analysis,approximation));
++					nodes->AddObject(new Node(id0+i+1,i,lid++,i,iomodel,analysis,approximation));
+ 				}
+ 			}
+ 			for(i=0;i<iomodel->numberofedges;i++){
+ 				if(my_edges[i]){
+-					nodes->AddObject(new Node(iomodel->nodecounter+iomodel->numberofvertices+i+1,iomodel->numberofvertices+i,lid++,0,iomodel,analysis,approximation));
++					nodes->AddObject(new Node(id0+iomodel->numberofvertices+i+1,iomodel->numberofvertices+i,lid++,0,iomodel,analysis,approximation));
+ 				}
+ 			}
+ 			break;
+@@ -144,38 +145,38 @@
+ 			EdgesPartitioning(&my_edges,iomodel);
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+-					nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,lid++,i,iomodel,analysis,approximation));
++					nodes->AddObject(new Node(id0+i+1,i,lid++,i,iomodel,analysis,approximation));
+ 				}
+ 			}
+ 			counter = iomodel->numberofvertices;
+ 			for(i=0;i<iomodel->numberofedges;i++){
+ 				if(iomodel->edges[i*3+2]==2){/*Vertical edges*/
+ 					if(my_edges[i]){
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
++						node = new Node(id0+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
+ 						nodes->AddObject(node);
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+2,counter+2,lid++,0,iomodel,analysis,approximation);
++						node = new Node(id0+iomodel->numberofvertices+4*i+2,counter+2,lid++,0,iomodel,analysis,approximation);
+ 						nodes->AddObject(node);
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+3,counter+3,lid++,0,iomodel,analysis,approximation);
++						node = new Node(id0+iomodel->numberofvertices+4*i+3,counter+3,lid++,0,iomodel,analysis,approximation);
+ 						nodes->AddObject(node);
+ 					}
+ 					counter=counter+3;
+ 				}
+ 				else if(iomodel->edges[i*3+2]==1){/*Basal edges*/
+ 					if(my_edges[i]){
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
++						node = new Node(id0+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
+ 						nodes->AddObject(node);
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+2,counter+2,lid++,0,iomodel,analysis,approximation);
++						node = new Node(id0+iomodel->numberofvertices+4*i+2,counter+2,lid++,0,iomodel,analysis,approximation);
+ 						nodes->AddObject(node);
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+3,counter+3,lid++,0,iomodel,analysis,approximation);
++						node = new Node(id0+iomodel->numberofvertices+4*i+3,counter+3,lid++,0,iomodel,analysis,approximation);
+ 						nodes->AddObject(node);
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+4,counter+4,lid++,0,iomodel,analysis,approximation);
++						node = new Node(id0+iomodel->numberofvertices+4*i+4,counter+4,lid++,0,iomodel,analysis,approximation);
+ 						nodes->AddObject(node);
+ 					}
+ 					counter=counter+4;
+ 				}
+ 				else if(iomodel->edges[i*3+2]==3){/*Top edges*/
+ 					if(my_edges[i]){
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
++						node = new Node(id0+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
+ 						nodes->AddObject(node);
+ 					}
+ 					counter=counter+1;
+@@ -192,11 +193,11 @@
+ 			/*P1 velocity*/
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+-					nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,lid++,i,iomodel,analysis,FSvelocityEnum));
++					nodes->AddObject(new Node(id0+i+1,i,lid++,i,iomodel,analysis,FSvelocityEnum));
+ 				}
+ 			}
+ 			/*P1 pressure*/
+-			vnodes = iomodel->nodecounter+iomodel->numberofvertices;
++			vnodes = id0+iomodel->numberofvertices;
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+ 					nodes->AddObject(new Node(vnodes+i+1,iomodel->numberofvertices+i,lid++,i,iomodel,analysis,FSpressureEnum));
+@@ -208,11 +209,11 @@
+ 			/*P1 velocity*/
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+-					nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,lid++,i,iomodel,analysis,FSvelocityEnum));
++					nodes->AddObject(new Node(id0+i+1,i,lid++,i,iomodel,analysis,FSvelocityEnum));
+ 				}
+ 			}
+ 			/*P1 pressure*/
+-			vnodes = iomodel->nodecounter+iomodel->numberofvertices;
++			vnodes = id0+iomodel->numberofvertices;
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+ 					nodes->AddObject(new Node(vnodes+i+1,iomodel->numberofvertices+i,lid++,i,iomodel,analysis,FSpressureEnum));
+@@ -224,18 +225,18 @@
+ 			/*P1+ velocity (bubble statically condensed)*/
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+-					nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,lid++,i,iomodel,analysis,FSvelocityEnum));
++					nodes->AddObject(new Node(id0+i+1,i,lid++,i,iomodel,analysis,FSvelocityEnum));
+ 				}
+ 			}
+ 			for(i=0;i<iomodel->numberofelements;i++){
+ 				if(iomodel->my_elements[i]){
+-					node = new Node(iomodel->nodecounter+iomodel->numberofvertices+i+1,iomodel->numberofvertices+i,lid++,0,iomodel,analysis,FSvelocityEnum);
++					node = new Node(id0+iomodel->numberofvertices+i+1,iomodel->numberofvertices+i,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 					node->Deactivate();
+ 					nodes->AddObject(node);
+ 				}
+ 			}
+ 			/*P1 pressure*/
+-			vnodes = iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofelements;
++			vnodes = id0+iomodel->numberofvertices+iomodel->numberofelements;
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+ 					nodes->AddObject(new Node(vnodes+i+1,iomodel->numberofvertices+iomodel->numberofelements+i,lid++,i,iomodel,analysis,FSpressureEnum));
+@@ -247,16 +248,16 @@
+ 			/*P1+ velocity*/
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+-					nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,lid++,i,iomodel,analysis,FSvelocityEnum));
++					nodes->AddObject(new Node(id0+i+1,i,lid++,i,iomodel,analysis,FSvelocityEnum));
+ 				}
+ 			}
+ 			for(i=0;i<iomodel->numberofelements;i++){
+ 				if(iomodel->my_elements[i]){
+-					nodes->AddObject(new Node(iomodel->nodecounter+iomodel->numberofvertices+i+1,iomodel->numberofvertices+i,lid++,0,iomodel,analysis,FSvelocityEnum));
++					nodes->AddObject(new Node(id0+iomodel->numberofvertices+i+1,iomodel->numberofvertices+i,lid++,0,iomodel,analysis,FSvelocityEnum));
+ 				}
+ 			}
+ 			/*P1 pressure*/
+-			vnodes = iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofelements;
++			vnodes = id0+iomodel->numberofvertices+iomodel->numberofelements;
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+ 					nodes->AddObject(new Node(vnodes+i+1,iomodel->numberofvertices+iomodel->numberofelements+i,lid++,i,iomodel,analysis,FSpressureEnum));
+@@ -269,17 +270,17 @@
+ 			EdgesPartitioning(&my_edges,iomodel);
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+-					nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,lid++,i,iomodel,analysis,FSvelocityEnum));
++					nodes->AddObject(new Node(id0+i+1,i,lid++,i,iomodel,analysis,FSvelocityEnum));
+ 				}
+ 			}
+ 			for(i=0;i<iomodel->numberofedges;i++){
+ 				if(my_edges[i]){
+-					nodes->AddObject(new Node(iomodel->nodecounter+iomodel->numberofvertices+i+1,iomodel->numberofvertices+i,lid++,0,iomodel,analysis,FSvelocityEnum));
++					nodes->AddObject(new Node(id0+iomodel->numberofvertices+i+1,iomodel->numberofvertices+i,lid++,0,iomodel,analysis,FSvelocityEnum));
+ 				}
+ 			}
+ 
+ 			/*P1 pressure*/
+-			vnodes = iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofedges;
++			vnodes = id0+iomodel->numberofvertices+iomodel->numberofedges;
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+ 					nodes->AddObject(new Node(vnodes+i+1,iomodel->numberofvertices+iomodel->numberofedges+i,lid++,i,iomodel,analysis,FSpressureEnum));
+@@ -292,38 +293,38 @@
+ 			/*P2xP4 velocity*/
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+-					nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,lid++,i,iomodel,analysis,FSvelocityEnum));
++					nodes->AddObject(new Node(id0+i+1,i,lid++,i,iomodel,analysis,FSvelocityEnum));
+ 				}
+ 			}
+ 			counter = iomodel->numberofvertices;
+ 			for(i=0;i<iomodel->numberofedges;i++){
+ 				if(iomodel->edges[i*3+2]==2){/*Vertical edges*/
+ 					if(my_edges[i]){
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,FSvelocityEnum);
++						node = new Node(id0+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 						nodes->AddObject(node);
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+2,counter+2,lid++,0,iomodel,analysis,FSvelocityEnum);
++						node = new Node(id0+iomodel->numberofvertices+4*i+2,counter+2,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 						nodes->AddObject(node);
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+3,counter+3,lid++,0,iomodel,analysis,FSvelocityEnum);
++						node = new Node(id0+iomodel->numberofvertices+4*i+3,counter+3,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 						nodes->AddObject(node);
+ 					}
+ 					counter=counter+3;
+ 				}
+ 				else if(iomodel->edges[i*3+2]==1){/*Basal edges*/
+ 					if(my_edges[i]){
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,FSvelocityEnum);
++						node = new Node(id0+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 						nodes->AddObject(node);
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+2,counter+2,lid++,0,iomodel,analysis,FSvelocityEnum);
++						node = new Node(id0+iomodel->numberofvertices+4*i+2,counter+2,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 						nodes->AddObject(node);
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+3,counter+3,lid++,0,iomodel,analysis,FSvelocityEnum);
++						node = new Node(id0+iomodel->numberofvertices+4*i+3,counter+3,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 						nodes->AddObject(node);
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+4,counter+4,lid++,0,iomodel,analysis,FSvelocityEnum);
++						node = new Node(id0+iomodel->numberofvertices+4*i+4,counter+4,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 						nodes->AddObject(node);
+ 					}
+ 					counter=counter+4;
+ 				}
+ 				else if(iomodel->edges[i*3+2]==3){/*Top edges*/
+ 					if(my_edges[i]){
+-						node = new Node(iomodel->nodecounter+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,FSvelocityEnum);
++						node = new Node(id0+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 						nodes->AddObject(node);
+ 					}
+ 					counter=counter+1;
+@@ -333,7 +334,7 @@
+ 				}
+ 			}
+ 			/*P1xP3 pressure*/
+-			vnodes = iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->numberofedges;
++			vnodes = id0+iomodel->numberofvertices+4*iomodel->numberofedges;
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+ 					nodes->AddObject(new Node(vnodes+i+1,counter+1,lid++,i,iomodel,analysis,FSpressureEnum));
Index: issm/oecreview/Archive/16554-17801/ISSM-17106-17107.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17106-17107.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17106-17107.diff	(revision 17802)
@@ -0,0 +1,103 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17106)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17107)
+@@ -2595,7 +2595,7 @@
+ 	if(dim==3){vz_input=element->GetInput(VzEnum); _assert_(vz_input);}
+ 
+ 	/* Start  looping on the number of gaussian points: */
+-	Gauss* gauss = element->NewGauss(10);
++	Gauss* gauss = element->NewGauss(5);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		gauss->GaussPoint(ig);
+ 
+@@ -2679,10 +2679,10 @@
+ 		gllevelset_input=element->GetInput(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input);
+ 		element->GetGroundedPart(&point1,&fraction1,&fraction2,&mainlyfloating);
+ 		//gauss = element->NewGauss(point1,fraction1,fraction2,mainlyfloating,2);
+-		gauss=element->NewGaussBase(10);
++		gauss=element->NewGaussBase(3);
+ 	}
+ 	else{
+-		gauss=element->NewGaussBase(10);
++		gauss=element->NewGaussBase(3);
+ 	}
+ 
+ 	/* Start  looping on the number of gaussian points: */
+@@ -2770,7 +2770,7 @@
+ 	}
+ 
+ 	/* Start  looping on the number of gaussian points: */
+-	Gauss* gauss=element->NewGauss(10);
++	Gauss* gauss=element->NewGauss(5);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		gauss->GaussPoint(ig);
+ 
+@@ -2843,7 +2843,7 @@
+ 	IssmDouble  gravity  =element->GetMaterialParameter(ConstantsGEnum);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+-	Gauss* gauss=element->NewGaussBase(10);
++	Gauss* gauss=element->NewGaussBase(5);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		gauss->GaussPoint(ig);
+ 
+@@ -3302,7 +3302,6 @@
+ }/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionFS(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	bool         results_on_nodes;
+ 	int          i,dim,meshtype;
+ 	int*         vdoflist=NULL;
+ 	int*         pdoflist=NULL;
+@@ -3310,7 +3309,6 @@
+ 
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+ 	element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+-	element->FindParam(&results_on_nodes,SettingsResultsOnNodesEnum);
+ 	switch(meshtype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+@@ -3378,20 +3376,16 @@
+ 	if(dim==3) element->InputChangeName(VzEnum,VzPicardEnum);
+ 
+ 	/*Add vx and vy as inputs to the tria element: */
+-	if(results_on_nodes){
+-		element->AddInput(VxEnum,      vx,      element->VelocityInterpolation());
+-		element->AddInput(VyEnum,      vy,      element->VelocityInterpolation());
+-		element->AddInput(VelEnum,     vel,     element->VelocityInterpolation());
+-		element->AddInput(PressureEnum,pressure,element->PressureInterpolation());
+-		if(dim==3) element->AddInput(VzEnum,vz, element->VelocityInterpolation());
+-	}
+-	else{
+-		element->AddInput(VxEnum,vx,P1Enum);
+-		element->AddInput(VyEnum,vy,P1Enum);
+-		element->AddInput(VelEnum,vel,P1Enum);
+-		element->AddInput(PressureEnum,pressure,P1Enum);
+-		if(dim==3) element->AddInput(VzEnum,vz,P1Enum);
+-	}
++	//element->AddInput(VxEnum,      vx,      element->VelocityInterpolation());
++	//element->AddInput(VyEnum,      vy,      element->VelocityInterpolation());
++	//element->AddInput(VelEnum,     vel,     element->VelocityInterpolation());
++	//element->AddInput(PressureEnum,pressure,element->PressureInterpolation());
++	//if(dim==3) element->AddInput(VzEnum,vz, element->VelocityInterpolation());
++	element->AddInput(VxEnum,vx,P1Enum);
++	element->AddInput(VyEnum,vy,P1Enum);
++	element->AddInput(VelEnum,vel,P1Enum);
++	element->AddInput(PressureEnum,pressure,P1Enum);
++	if(dim==3) element->AddInput(VzEnum,vz,P1Enum);
+ 
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(pressure);
+Index: ../trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp	(revision 17106)
++++ ../trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp	(revision 17107)
+@@ -44,7 +44,6 @@
+ 	memcpy(function_name,what_function.c_str(),len);
+ 
+ 	file_line= what_line;
+-	this->Report();
+ 
+ }/*}}}*/
+ ErrorException::~ErrorException() throw(){/*{{{*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17107-17108.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17107-17108.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17107-17108.diff	(revision 17802)
@@ -0,0 +1,51 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17107)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17108)
+@@ -3302,6 +3302,7 @@
+ }/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionFS(IssmDouble* solution,Element* element){/*{{{*/
+ 
++	bool         results_on_nodes;
+ 	int          i,dim,meshtype;
+ 	int*         vdoflist=NULL;
+ 	int*         pdoflist=NULL;
+@@ -3309,6 +3310,7 @@
+ 
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+ 	element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
++	element->FindParam(&results_on_nodes,SettingsResultsOnNodesEnum);
+ 	switch(meshtype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+@@ -3376,16 +3378,20 @@
+ 	if(dim==3) element->InputChangeName(VzEnum,VzPicardEnum);
+ 
+ 	/*Add vx and vy as inputs to the tria element: */
+-	//element->AddInput(VxEnum,      vx,      element->VelocityInterpolation());
+-	//element->AddInput(VyEnum,      vy,      element->VelocityInterpolation());
+-	//element->AddInput(VelEnum,     vel,     element->VelocityInterpolation());
+-	//element->AddInput(PressureEnum,pressure,element->PressureInterpolation());
+-	//if(dim==3) element->AddInput(VzEnum,vz, element->VelocityInterpolation());
+-	element->AddInput(VxEnum,vx,P1Enum);
+-	element->AddInput(VyEnum,vy,P1Enum);
+-	element->AddInput(VelEnum,vel,P1Enum);
+-	element->AddInput(PressureEnum,pressure,P1Enum);
+-	if(dim==3) element->AddInput(VzEnum,vz,P1Enum);
++	if(results_on_nodes){
++		element->AddInput(VxEnum,      vx,      element->VelocityInterpolation());
++		element->AddInput(VyEnum,      vy,      element->VelocityInterpolation());
++		element->AddInput(VelEnum,     vel,     element->VelocityInterpolation());
++		element->AddInput(PressureEnum,pressure,element->PressureInterpolation());
++		if(dim==3) element->AddInput(VzEnum,vz, element->VelocityInterpolation());
++	}
++	else{
++		element->AddInput(VxEnum,vx,P1Enum);
++		element->AddInput(VyEnum,vy,P1Enum);
++		element->AddInput(VelEnum,vel,P1Enum);
++		element->AddInput(PressureEnum,pressure,P1Enum);
++		if(dim==3) element->AddInput(VzEnum,vz,P1Enum);
++	}
+ 
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(pressure);
Index: issm/oecreview/Archive/16554-17801/ISSM-17108-17109.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17108-17109.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17108-17109.diff	(revision 17802)
@@ -0,0 +1,217 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17108)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17109)
+@@ -68,6 +68,7 @@
+ 		ElementMatrix* CreateKMatrixFSViscous(Element* element);
+ 		ElementMatrix* CreateKMatrixFSFriction(Element* element);
+ 		ElementVector* CreatePVectorFS(Element* element);
++		ElementVector* CreatePVectorFSAnalytical(Element* element);
+ 		ElementVector* CreatePVectorFSViscous(Element* element);
+ 		ElementVector* CreatePVectorFSShelf(Element* element);
+ 		ElementVector* CreatePVectorFSFront(Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17108)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17109)
+@@ -5,6 +5,8 @@
+ #include "../modules/modules.h"
+ #include "../solutionsequences/solutionsequences.h"
+ 
++#define FSANALYTICAL 1
++
+ /*Model processing*/
+ int  StressbalanceAnalysis::DofsPerNode(int** pdoftype,int meshtype,int approximation){/*{{{*/
+ 
+@@ -2718,6 +2720,10 @@
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorFS(Element* element){/*{{{*/
+ 
++	#ifdef FSANALYTICAL
++	ElementVector* pe=CreatePVectorFSAnalytical(element);
++
++	#else
+ 	/*compute all load vectors for this element*/
+ 	ElementVector* pe1=CreatePVectorFSViscous(element);
+ 	ElementVector* pe2=CreatePVectorFSShelf(element);
+@@ -2728,8 +2734,72 @@
+ 	delete pe1;
+ 	delete pe2;
+ 	delete pe3;
++	#endif
++
+ 	return pe;
+ }/*}}}*/
++ElementVector* StressbalanceAnalysis::CreatePVectorFSAnalytical(Element* element){/*{{{*/
++
++	bool        analytical_solution=0;
++	int         i,meshtype,dim;
++	IssmDouble  x_coord,y_coord,z_coord;
++	IssmDouble  Jdet,forcex,forcey,forcez;
++	IssmDouble *xyz_list = NULL;
++
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh3DEnum:         dim = 3; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int vnumnodes = element->GetNumberOfNodesVelocity();
++	int pnumnodes = element->GetNumberOfNodesPressure();
++
++	/*Prepare coordinate system list*/
++	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
++	if(dim==2) for(i=0;i<vnumnodes;i++) cs_list[i] = XYEnum;
++	else       for(i=0;i<vnumnodes;i++) cs_list[i] = XYZEnum;
++	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
++
++	/*Initialize vectors*/
++	ElementVector* pe     = element->NewElementVector(FSvelocityEnum);
++	IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	IssmDouble  rho_ice =element->GetMaterialParameter(MaterialsRhoIceEnum);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(5);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctionsVelocity(vbasis,gauss);
++
++		forcex=1.0; forcey=1.0; forcez=1.0;
++//		forcex->fx(x_coord,y_coord,z_coord);
++//		forcex->fy(x_coord,y_coord,z_coord);
++//		forcex->fz(x_coord,y_coord,z_coord);
++
++		for(i=0;i<vnumnodes;i++){
++			pe->values[i*dim+0] += +rho_ice*forcex *Jdet*gauss->weight*vbasis[i];
++			pe->values[i*dim+1] += +rho_ice*forcey *Jdet*gauss->weight*vbasis[i];
++			pe->values[i*dim+2] += +rho_ice*forcez *Jdet*gauss->weight*vbasis[i];
++		}
++	}
++
++	/*Transform coordinate system*/
++	element->TransformLoadVectorCoord(pe,cs_list);
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<int>(cs_list);
++	xDelete<IssmDouble>(vbasis);
++	xDelete<IssmDouble>(xyz_list);
++	return pe;
++}/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorFSViscous(Element* element){/*{{{*/
+ 
+ 	int         i,meshtype,dim;
+Index: ../trunk-jpl/src/c/toolkits/petsc/objects/PetscMat.cpp
+===================================================================
+--- ../trunk-jpl/src/c/toolkits/petsc/objects/PetscMat.cpp	(revision 17108)
++++ ../trunk-jpl/src/c/toolkits/petsc/objects/PetscMat.cpp	(revision 17109)
+@@ -46,7 +46,7 @@
+ 	MatSetSizes(this->matrix,m,n,M,N);
+ 	MatSetFromOptions(this->matrix);
+ 	MatMPIAIJSetPreallocation(this->matrix,0,d_nnz,0,o_nnz);
+-	//MatSetOption(this->matrix,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_FALSE);
++	MatSetOption(this->matrix,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_FALSE);
+ 
+ }
+ /*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17108)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17109)
+@@ -165,8 +165,9 @@
+ 		virtual void   GetVerticesCoordinates(IssmDouble** xyz_list)=0;
+ 		virtual void   GetVerticesCoordinatesBase(IssmDouble** xyz_list)=0;
+ 		virtual void   GetVerticesCoordinatesTop(IssmDouble** xyz_list)=0;
++		virtual IssmDouble GetXcoord(Gauss* gauss)=0;
++		virtual IssmDouble GetYcoord(Gauss* gauss)=0;
+ 		virtual IssmDouble GetZcoord(Gauss* gauss)=0;
+-		virtual IssmDouble GetYcoord(Gauss* gauss)=0;
+ 		virtual void   GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype)=0;
+ 		virtual int    GetElementType(void)=0;
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17108)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17109)
+@@ -211,6 +211,7 @@
+ 		int            GetElementType(void);
+ 
+ 		void	         GetVertexPidList(int* doflist);
++		IssmDouble     GetXcoord(Gauss* gauss){_error_("not implemented");};
+ 		IssmDouble     GetYcoord(Gauss* gauss);
+ 		IssmDouble     GetZcoord(Gauss* gauss){_error_("not implemented");};
+ 		void           NormalSection(IssmDouble* normal,IssmDouble* xyz_list);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17108)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17109)
+@@ -1208,6 +1208,36 @@
+ 	input->GetVectorFromInputs(vector,&vertexpidlist[0]);
+ }
+ /*}}}*/
++/*FUNCTION Penta::GetXcoord {{{*/
++IssmDouble Penta::GetXcoord(Gauss* gauss){
++
++	int    i;
++	IssmDouble x;
++	IssmDouble xyz_list[NUMVERTICES][3];
++	IssmDouble x_list[NUMVERTICES];
++
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	for(i=0;i<NUMVERTICES;i++) x_list[i]=xyz_list[i][0];
++	PentaRef::GetInputValue(&x,x_list,gauss);
++
++	return x;
++}
++/*}}}*/
++/*FUNCTION Penta::GetYcoord {{{*/
++IssmDouble Penta::GetYcoord(Gauss* gauss){
++
++	int    i;
++	IssmDouble y;
++	IssmDouble xyz_list[NUMVERTICES][3];
++	IssmDouble y_list[NUMVERTICES];
++
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	for(i=0;i<NUMVERTICES;i++) y_list[i]=xyz_list[i][1];
++	PentaRef::GetInputValue(&y,y_list,gauss);
++
++	return y;
++}
++/*}}}*/
+ /*FUNCTION Penta::GetZcoord {{{*/
+ IssmDouble Penta::GetZcoord(Gauss* gauss){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17108)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17109)
+@@ -94,8 +94,9 @@
+ 		int    GetNumberOfNodesVelocity(void);
+ 		int    GetNumberOfVertices(void);
+ 		void   GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
++		IssmDouble GetXcoord(Gauss* gauss);
++		IssmDouble GetYcoord(Gauss* gauss);
+ 		IssmDouble GetZcoord(Gauss* gauss);
+-		IssmDouble GetYcoord(Gauss* gauss){_error_("Not implemented");};
+ 		void   GetVectorFromInputs(Vector<IssmDouble>* vector,int name_enum);
+ 		void   GetVerticesCoordinates(IssmDouble** pxyz_list);
+ 		void   GetVerticesCoordinatesBase(IssmDouble** pxyz_list);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17108)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17109)
+@@ -138,6 +138,7 @@
+ 		void        GetInputValue(IssmDouble* pvalue,Gauss* gauss,int enum_type){_error_("not implemented yet");};
+ 		void        GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");};
+ 		Node*       GetNode(int node_number){_error_("Not implemented");};
++		IssmDouble  GetXcoord(Gauss* gauss){_error_("Not implemented");};
+ 		IssmDouble  GetYcoord(Gauss* gauss){_error_("Not implemented");};
+ 		IssmDouble  GetZcoord(Gauss* gauss){_error_("not implemented yet");};
+ 		int         GetElementType(void){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-17109-17110.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17109-17110.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17109-17110.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/toolkits/petsc/objects/PetscMat.cpp
+===================================================================
+--- ../trunk-jpl/src/c/toolkits/petsc/objects/PetscMat.cpp	(revision 17109)
++++ ../trunk-jpl/src/c/toolkits/petsc/objects/PetscMat.cpp	(revision 17110)
+@@ -46,7 +46,7 @@
+ 	MatSetSizes(this->matrix,m,n,M,N);
+ 	MatSetFromOptions(this->matrix);
+ 	MatMPIAIJSetPreallocation(this->matrix,0,d_nnz,0,o_nnz);
+-	MatSetOption(this->matrix,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_FALSE);
++//	MatSetOption(this->matrix,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_FALSE);
+ 
+ }
+ /*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17110-17111.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17110-17111.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17110-17111.diff	(revision 17802)
@@ -0,0 +1,204 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17110)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17111)
+@@ -68,7 +68,6 @@
+ 		ElementMatrix* CreateKMatrixFSViscous(Element* element);
+ 		ElementMatrix* CreateKMatrixFSFriction(Element* element);
+ 		ElementVector* CreatePVectorFS(Element* element);
+-		ElementVector* CreatePVectorFSAnalytical(Element* element);
+ 		ElementVector* CreatePVectorFSViscous(Element* element);
+ 		ElementVector* CreatePVectorFSShelf(Element* element);
+ 		ElementVector* CreatePVectorFSFront(Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17110)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17111)
+@@ -2718,28 +2718,9 @@
+ 	xDelete<IssmDouble>(D);
+ 	return Ke;
+ }/*}}}*/
++#ifdef FSANALYTICAL
+ ElementVector* StressbalanceAnalysis::CreatePVectorFS(Element* element){/*{{{*/
+ 
+-	#ifdef FSANALYTICAL
+-	ElementVector* pe=CreatePVectorFSAnalytical(element);
+-
+-	#else
+-	/*compute all load vectors for this element*/
+-	ElementVector* pe1=CreatePVectorFSViscous(element);
+-	ElementVector* pe2=CreatePVectorFSShelf(element);
+-	ElementVector* pe3=CreatePVectorFSFront(element);
+-	ElementVector* pe =new ElementVector(pe1,pe2,pe3);
+-
+-	/*clean-up and return*/
+-	delete pe1;
+-	delete pe2;
+-	delete pe3;
+-	#endif
+-
+-	return pe;
+-}/*}}}*/
+-ElementVector* StressbalanceAnalysis::CreatePVectorFSAnalytical(Element* element){/*{{{*/
+-
+ 	bool        analytical_solution=0;
+ 	int         i,meshtype,dim;
+ 	IssmDouble  x_coord,y_coord,z_coord;
+@@ -2778,11 +2759,14 @@
+ 		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+ 		element->NodalFunctionsVelocity(vbasis,gauss);
+ 
+-		forcex=1.0; forcey=1.0; forcez=1.0;
+-//		forcex->fx(x_coord,y_coord,z_coord);
+-//		forcex->fy(x_coord,y_coord,z_coord);
+-//		forcex->fz(x_coord,y_coord,z_coord);
++		x_coord=element->GetXcoord(gauss);
++		y_coord=element->GetYcoord(gauss);
++		z_coord=element->GetZcoord(gauss);
+ 
++		forcex=fx(x_coord,y_coord,z_coord);
++		forcey=fy(x_coord,y_coord,z_coord);
++		forcez=fz(x_coord,y_coord,z_coord);
++
+ 		for(i=0;i<vnumnodes;i++){
+ 			pe->values[i*dim+0] += +rho_ice*forcex *Jdet*gauss->weight*vbasis[i];
+ 			pe->values[i*dim+1] += +rho_ice*forcey *Jdet*gauss->weight*vbasis[i];
+@@ -2800,6 +2784,23 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	return pe;
+ }/*}}}*/
++#else
++ElementVector* StressbalanceAnalysis::CreatePVectorFS(Element* element){/*{{{*/
++
++	/*compute all load vectors for this element*/
++	ElementVector* pe1=CreatePVectorFSViscous(element);
++	ElementVector* pe2=CreatePVectorFSShelf(element);
++	ElementVector* pe3=CreatePVectorFSFront(element);
++	ElementVector* pe =new ElementVector(pe1,pe2,pe3);
++
++	/*clean-up and return*/
++	delete pe1;
++	delete pe2;
++	delete pe3;
++
++	return pe;
++}/*}}}*/
++#endif
+ ElementVector* StressbalanceAnalysis::CreatePVectorFSViscous(Element* element){/*{{{*/
+ 
+ 	int         i,meshtype,dim;
+Index: ../trunk-jpl/src/c/shared/shared.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/shared.h	(revision 17110)
++++ ../trunk-jpl/src/c/shared/shared.h	(revision 17111)
+@@ -5,6 +5,7 @@
+ #ifndef _SHARED_H_
+ #define _SHARED_H_
+ 
++#include "./FSanalyticals/fsanalyticals.h"
+ #include "./MemOps/MemOps.h"
+ #include "./Bamg/shared.h"
+ #include "./Elements/elements.h"
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/fy.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/fy.cpp	(revision 0)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/fy.cpp	(revision 17111)
+@@ -0,0 +1,18 @@
++/*!\file fy.cpp
++ * \brief: analytical fonction for FS
++ */
++
++#include <math.h>
++#include "../Numerics/types.h"
++
++IssmDouble fy(IssmDouble x,IssmDouble y,IssmDouble z){   
++	IssmDouble p = 2.0;  
++	IssmDouble q = 2.0;   
++	IssmDouble cst = 1.0;  
++	IssmDouble n   = 1.0;
++	IssmDouble functiony;
++
++	functiony=x+y+z;
++
++	return functiony;
++}
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/fz.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/fz.cpp	(revision 0)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/fz.cpp	(revision 17111)
+@@ -0,0 +1,18 @@
++/*!\file fz.cpp
++ * \brief: analytical fonction for FS
++ */
++
++#include <math.h>
++#include "../Numerics/types.h"
++
++IssmDouble fz(IssmDouble x,IssmDouble y,IssmDouble z){   
++	IssmDouble p = 2.0;  
++	IssmDouble q = 2.0;   
++	IssmDouble cst = 1.0;  
++	IssmDouble n   = 1.0;
++	IssmDouble functionz;
++
++	functionz=x+y+z;
++
++	return functionz;
++}
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h	(revision 0)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h	(revision 17111)
+@@ -0,0 +1,14 @@
++/*!\file: elements.h
++ * \brief prototypes for elements.h
++ */ 
++
++#ifndef _SHARED_ANALYTICALS_H_
++#define _SHARED_ANALYTICALS_H_
++
++#include "../Numerics/types.h"
++
++IssmDouble fx(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
++IssmDouble fy(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
++IssmDouble fz(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
++
++#endif //ifndef _SHARED_ANALYTICALS_H_
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/fx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/fx.cpp	(revision 0)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/fx.cpp	(revision 17111)
+@@ -0,0 +1,18 @@
++/*!\file fx.cpp
++ * \brief: analytical fonction for FS
++ */
++
++#include <math.h>
++#include "../Numerics/types.h"
++
++IssmDouble fx(IssmDouble x,IssmDouble y,IssmDouble z){   
++	IssmDouble p = 2.0;  
++	IssmDouble q = 2.0;   
++	IssmDouble cst = 1.0;  
++	IssmDouble n   = 1.0;
++	IssmDouble functionx;
++
++	functionx=1.0;
++
++	return functionx;
++}
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17110)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17111)
+@@ -176,6 +176,10 @@
+ 					./shared/io/Comm/IssmComm.cpp\
+ 					./shared/LatLong/Ll2xyx.cpp\
+ 					./shared/LatLong/Xy2llx.cpp\
++					./shared/FSanalyticals/fsanalyticals.h\
++					./shared/FSanalyticals/fx.cpp\
++					./shared/FSanalyticals/fy.cpp\
++					./shared/FSanalyticals/fz.cpp\
+ 					./shared/Enum/Enum.h\
+ 					./shared/Enum/EnumDefinitions.h\
+ 					./shared/Enum/EnumToStringx.cpp\
Index: issm/oecreview/Archive/16554-17801/ISSM-17111-17112.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17111-17112.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17111-17112.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17111)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17112)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ #include "../solutionsequences/solutionsequences.h"
+ 
+-#define FSANALYTICAL 1
++//#define FSANALYTICAL 1
+ 
+ /*Model processing*/
+ int  StressbalanceAnalysis::DofsPerNode(int** pdoftype,int meshtype,int approximation){/*{{{*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17112-17113.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17112-17113.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17112-17113.diff	(revision 17802)
@@ -0,0 +1,141 @@
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/fy.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/fy.cpp	(revision 17112)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/fy.cpp	(revision 17113)
+@@ -1,18 +0,0 @@
+-/*!\file fy.cpp
+- * \brief: analytical fonction for FS
+- */
+-
+-#include <math.h>
+-#include "../Numerics/types.h"
+-
+-IssmDouble fy(IssmDouble x,IssmDouble y,IssmDouble z){   
+-	IssmDouble p = 2.0;  
+-	IssmDouble q = 2.0;   
+-	IssmDouble cst = 1.0;  
+-	IssmDouble n   = 1.0;
+-	IssmDouble functiony;
+-
+-	functiony=x+y+z;
+-
+-	return functiony;
+-}
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/fz.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/fz.cpp	(revision 17112)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/fz.cpp	(revision 17113)
+@@ -1,18 +0,0 @@
+-/*!\file fz.cpp
+- * \brief: analytical fonction for FS
+- */
+-
+-#include <math.h>
+-#include "../Numerics/types.h"
+-
+-IssmDouble fz(IssmDouble x,IssmDouble y,IssmDouble z){   
+-	IssmDouble p = 2.0;  
+-	IssmDouble q = 2.0;   
+-	IssmDouble cst = 1.0;  
+-	IssmDouble n   = 1.0;
+-	IssmDouble functionz;
+-
+-	functionz=x+y+z;
+-
+-	return functionz;
+-}
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/fx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/fx.cpp	(revision 17112)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/fx.cpp	(revision 17113)
+@@ -1,18 +0,0 @@
+-/*!\file fx.cpp
+- * \brief: analytical fonction for FS
+- */
+-
+-#include <math.h>
+-#include "../Numerics/types.h"
+-
+-IssmDouble fx(IssmDouble x,IssmDouble y,IssmDouble z){   
+-	IssmDouble p = 2.0;  
+-	IssmDouble q = 2.0;   
+-	IssmDouble cst = 1.0;  
+-	IssmDouble n   = 1.0;
+-	IssmDouble functionx;
+-
+-	functionx=1.0;
+-
+-	return functionx;
+-}
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h	(revision 17112)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h	(revision 17113)
+@@ -7,8 +7,8 @@
+ 
+ #include "../Numerics/types.h"
+ 
+-IssmDouble fx(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+-IssmDouble fy(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+-IssmDouble fz(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
++IssmDouble fx1(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
++IssmDouble fy1(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
++IssmDouble fz1(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+ 
+ #endif //ifndef _SHARED_ANALYTICALS_H_
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical1.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical1.cpp	(revision 0)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical1.cpp	(revision 17113)
+@@ -0,0 +1,36 @@
++/*!\file fx.cpp
++ * \brief: analytical fonction for FS 
++ * test case for a cube with Dirichlet conditions on all faces
++ */
++
++#include <math.h>
++#include "../Numerics/types.h"
++#include "../Numerics/constants.h"
++
++IssmDouble fx1(IssmDouble x,IssmDouble y,IssmDouble z){   
++	IssmDouble p = 2.0;  
++	IssmDouble q = 2.0;   
++	IssmDouble functionx;
++
++	functionx =  4. * PI*PI * p*p * (cos(p*PI*x)-1) * sin(p*PI*y) * sin(p*PI*z)+ 2. * PI*PI*p*p*  sin(p*PI*y)    * sin(p*PI*z) * cos(p*PI*x) + q * PI * cos(q*PI*x) * sin(q*PI*y) * sin(q*PI*z);
++
++	return functionx;
++}
++IssmDouble fy1(IssmDouble x,IssmDouble y,IssmDouble z){   
++	IssmDouble p = 2.0;  
++	IssmDouble q = 2.0;   
++	IssmDouble functiony;
++
++	functiony = - 4. * PI*PI * p*p * (cos(p*PI*y)-1) * sin(p*PI*x) * sin(p*PI*z)-  2. * PI*PI * p*p *  sin(p*PI*x)    * cos(p*PI*y) * sin(p*PI*z)+ q * PI * sin(q*PI*x) * cos(q*PI*y) * sin(q*PI*z);
++
++	return functiony;
++}
++IssmDouble fz1(IssmDouble x,IssmDouble y,IssmDouble z){   
++	IssmDouble p = 2.0;  
++	IssmDouble q = 2.0;   
++	IssmDouble functionz;
++
++	functionz = - 2. * PI*PI * p*p * (cos(p*PI*z)-1) * sin(p*PI*x) * sin(p*PI*y)-PI*PI * p*p *  sin(p*PI*x)    * sin(p*PI*y) * cos(p*PI*z)+ q * PI * sin(q*PI*x) * sin(q*PI*y) * cos(q*PI*z);
++
++	return functionz;
++}
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17112)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17113)
+@@ -177,9 +177,7 @@
+ 					./shared/LatLong/Ll2xyx.cpp\
+ 					./shared/LatLong/Xy2llx.cpp\
+ 					./shared/FSanalyticals/fsanalyticals.h\
+-					./shared/FSanalyticals/fx.cpp\
+-					./shared/FSanalyticals/fy.cpp\
+-					./shared/FSanalyticals/fz.cpp\
++					./shared/FSanalyticals/FSanalytical1.cpp\
+ 					./shared/Enum/Enum.h\
+ 					./shared/Enum/EnumDefinitions.h\
+ 					./shared/Enum/EnumToStringx.cpp\
Index: issm/oecreview/Archive/16554-17801/ISSM-17113-17114.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17113-17114.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17113-17114.diff	(revision 17802)
@@ -0,0 +1,374 @@
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17113)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17114)
+@@ -58,7 +58,24 @@
+ 
+ /*Finite element Analysis*/
+ void LevelsetAnalysis::Core(FemModel* femmodel){/*{{{*/
+-	_error_("not implemented yet");
++
++	/*parameters: */
++	bool save_results;
++
++	/*activate formulation: */
++	femmodel->SetCurrentConfiguration(LevelsetAnalysisEnum);
++
++	/*recover parameters: */
++	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
++
++	if(VerboseSolution()) _printf0_("call computational core:\n");
++	solutionsequence_linear(femmodel);
++
++	if(save_results){
++		if(VerboseSolution()) _printf0_("   saving results\n");
++		int outputs = MaskIceLevelsetEnum;
++		femmodel->RequestedOutputsx(&femmodel->results,&outputs,1);
++	}
+ }/*}}}*/
+ ElementVector* LevelsetAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+@@ -69,12 +86,13 @@
+ 	_error_("not implemented yet");
+ }/*}}}*/
+ ElementMatrix* LevelsetAnalysis::CreateKMatrix(Element* element){/*{{{*/
++
+ 	/*Intermediaries */
+-
+-	int dim = 2; // solve for LSF in horizontal plane only
++	int i,j,dim = 2; // solve for LSF in horizontal plane only
+ 	IssmDouble kappa;
+ 	IssmDouble Jdet, dt, D_scalar;
+-	IssmDouble u,v,um,vm,ub,vb,vx,vy;
++	IssmDouble h,hx,hy,hz;
++	IssmDouble vel,vx,vy,bx,by;
+ 	IssmDouble* xyz_list = NULL;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -85,15 +103,13 @@
+ 	IssmDouble*    basis    = xNew<IssmDouble>(numnodes);
+ 	IssmDouble*    B        = xNew<IssmDouble>(dim*numnodes);
+ 	IssmDouble*    Bprime   = xNew<IssmDouble>(dim*numnodes);
+-	IssmDouble     D[dim][dim];
++	IssmDouble     D[dim][dim], K[dim][dim];
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+ 	element->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	Input* vx_input  = element->GetInput(VxEnum);     _assert_(vx_input);
+ 	Input* vy_input  = element->GetInput(VyEnum);     _assert_(vy_input);
+-	Input* vxm_input = element->GetInput(VxMeshEnum); _assert_(vxm_input);
+-	Input* vym_input = element->GetInput(VyMeshEnum); _assert_(vym_input);
+ 	
+ 	/* Start  looping on the number of gaussian points: */
+ 	Gauss* gauss=element->NewGauss(2);
+@@ -116,28 +132,60 @@
+ 		/* Advection */
+ 		GetB(B,element,xyz_list,gauss); 
+ 		GetBprime(Bprime,element,xyz_list,gauss); 
+-		vx_input->GetInputValue(&u,gauss); vxm_input->GetInputValue(&um,gauss); vx=u-um;
+-		vy_input->GetInputValue(&v,gauss); vym_input->GetInputValue(&vm,gauss); vy=v-vm;
+-		ub=0.; // horizontal mass change velocities (melt/refreeze/calving) FIXME: insert values from model here
+-		vb=0.;
+-		D[0][0]=D_scalar*(vx+ub);
++		vx_input->GetInputValue(&vx,gauss); // in 3D case, add mesh velocity 
++		vy_input->GetInputValue(&vy,gauss); 
++		bx=0.; // horizontal mass change velocities (melt/refreeze/calving) FIXME: insert values from model here
++		by=0.;
++		D[0][0]=D_scalar*(vx+bx);
+ 		D[0][1]=0.;
+ 		D[1][0]=0.;
+-		D[1][1]=D_scalar*(vy+vb);
++		D[1][1]=D_scalar*(vy+by);
+ 		TripleMultiply(B,dim,numnodes,1,
+ 					&D[0][0],dim,dim,0,
+ 					Bprime,dim,numnodes,0,
+ 					&Ke->values[0],1);
+ 
+-		/* Artificial Diffusion */
+-		kappa=0.; //FIXME: insert suitable value for kappa
+-		GetBprime(Bprime,element,xyz_list,gauss); // recalculation of Bprime needed?
+-		D[0][0]=D_scalar*kappa;
+-		D[1][1]=D_scalar*kappa;
+-		TripleMultiply(Bprime,dim,numnodes,1,
+-					&D[0][0],dim,dim,0,
+-					Bprime,dim,numnodes,0,
+-					&Ke->values[0],1);
++		/* Stabilization */
++		int stabilization=1;
++		switch(stabilization){
++			case 0:
++				// no stabilization, do nothing
++				break;
++			case 1:
++				/* Artificial Diffusion */
++				element->ElementSizes(&hx,&hy,&hz);
++				vel=sqrt(vx*vx + vy*vy );
++				h=sqrt( pow(hx*vx/vel,2) + pow(hy*vy/vel,2) ); //FIXME: is this correct?
++
++				kappa=h*vel/2.; //FIXME: insert suitable value for kappa
++				//GetBprime(Bprime,element,xyz_list,gauss); // recalculation of Bprime needed?
++				D[0][0]=D_scalar*kappa;
++				D[0][1]=0.;
++				D[1][0]=0.;
++				D[1][1]=D_scalar*kappa;
++				TripleMultiply(Bprime,dim,numnodes,1,
++							&D[0][0],dim,dim,0,
++							Bprime,dim,numnodes,0,
++							&Ke->values[0],1);
++				break;	
++			case 2:
++				/* Streamline Upwinding */
++				element->ElementSizes(&hx,&hy,&hz);
++				vel=sqrt(vx*vx + vy*vy )+1.e-14;
++				h=sqrt( pow(hx*vx/vel,2) + pow(hy*vy/vel,2) );
++				K[0][0]=h/(2.*vel)*vx*vx;  K[0][1]=h/(2.*vel)*vx*vy;
++				K[1][0]=h/(2.*vel)*vy*vx;  K[1][1]=h/(2.*vel)*vy*vy; 
++				for(i=0;i<dim;i++) for(j=0;j<dim;j++) K[i][j] = D_scalar*K[i][j];
++
++				//GetBprime(Bprime,element,xyz_list,gauss); 
++				TripleMultiply(Bprime,dim,numnodes,1,
++							&K[0][0],dim,dim,0,
++							Bprime,dim,numnodes,0,
++							&Ke->values[0],1);
++				break;
++			default:
++				_error_("unknown type of stabilization in LevelsetAnalysis.cpp");
++		}
+ 	}
+ 
+ 	/*Clean up and return*/
+@@ -160,7 +208,7 @@
+ 	int numnodes = element->GetNumberOfNodes();
+ 
+ 	/*Initialize Element vector*/
+-	ElementVector* pe    = element->NewElementVector();
++	ElementVector* pe = element->NewElementVector();
+ 	element->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	
+ 	if(dt!=0.){
+@@ -187,14 +235,27 @@
+ 		xDelete<IssmDouble>(basis);
+ 		delete gauss;
+ 	}
+-	else{for(i=0;i<numnodes;i++) pe->values[i]=0.;} 
++	else
++		for(i=0;i<numnodes;i++) 
++			pe->values[i]=0.; 
+ 	return pe;
+ }/*}}}*/
+ void LevelsetAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	_error_("not implemented yet");
+ }/*}}}*/
+ void LevelsetAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	int meshtype;
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			element->InputUpdateFromSolutionOneDof(solution,MaskIceLevelsetEnum);
++			break;
++		case Mesh3DEnum:
++			element->InputUpdateFromSolutionOneDofCollapsed(solution,MaskIceLevelsetEnum);
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
+ }/*}}}*/
+ void LevelsetAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17113)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17114)
+@@ -67,6 +67,7 @@
+ 	parameters->AddObject(iomodel->CopyConstantObject(TransientIsthermalEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(TransientIsgroundinglineEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(TransientIsgiaEnum));
++	parameters->AddObject(iomodel->CopyConstantObject(TransientIslevelsetEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(MaterialsRheologyLawEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(AutodiffIsautodiffEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(QmuIsdakotaEnum));
+Index: ../trunk-jpl/src/c/cores/transient_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17113)
++++ ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17114)
+@@ -49,6 +49,7 @@
+ 	femmodel->parameters->FindParam(&isthermal,TransientIsthermalEnum);
+ 	femmodel->parameters->FindParam(&isgia,TransientIsgiaEnum);
+ 	femmodel->parameters->FindParam(&isgroundingline,TransientIsgroundinglineEnum);
++	femmodel->parameters->FindParam(&islevelset,TransientIslevelsetEnum);
+ 	femmodel->parameters->FindParam(&isFS,FlowequationIsFSEnum);
+ 	if(isgroundingline) femmodel->parameters->FindParam(&groundingline_migration,GroundinglineMigrationEnum);
+ 	femmodel->parameters->FindParam(&numoutputs,TransientNumRequestedOutputsEnum);
+@@ -160,9 +161,9 @@
+ 
+ 		if(islevelset){
+ 			if(VerboseSolution()) _printf0_("   computing movement of ice boundaries\n");
+-			//analysis = new LevelsetAnalysis();
+-			//analysis->Core(femmodel);
+-			//delete analysis;
++			analysis = new LevelsetAnalysis();
++			analysis->Core(femmodel);
++			delete analysis;
+ 		}
+ 
+ 		/*unload results*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17113)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17114)
+@@ -145,6 +145,7 @@
+ 		virtual void   GetNodesSidList(int* sidlist)=0;
+ 		virtual void   GetNodesLidList(int* sidlist)=0;
+ 
++		virtual int    Id()=0;
+ 		virtual int    Sid()=0;
+ 		virtual bool   IsNodeOnShelfFromFlags(IssmDouble* flags)=0; 
+ 		virtual bool   IsOnBed()=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17113)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17114)
+@@ -382,6 +382,30 @@
+ 	delete gauss;
+ }
+ /*}}}*/
++/*FUNCTION Tria::ElementSizes{{{*/
++void Tria::ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){
++
++	IssmDouble xyz_list[NUMVERTICES][3];
++	IssmDouble xmin,ymin;
++	IssmDouble xmax,ymax;
++
++	/*Get xyz list: */
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	xmin=xyz_list[0][0]; xmax=xyz_list[0][0];
++	ymin=xyz_list[0][1]; ymax=xyz_list[0][1];
++
++	for(int i=1;i<NUMVERTICES;i++){
++		if(xyz_list[i][0]<xmin) xmin=xyz_list[i][0];
++		if(xyz_list[i][0]>xmax) xmax=xyz_list[i][0];
++		if(xyz_list[i][1]<ymin) ymin=xyz_list[i][1];
++		if(xyz_list[i][1]>ymax) ymax=xyz_list[i][1];
++	}
++
++	*hx=xmax-xmin;
++	*hy=ymax-ymin;
++	*hz=0.;
++}
++/*}}}*/
+ /*FUNCTION Tria::Echo{{{*/
+ void Tria::Echo(void){
+ 	_printf_("Tria:\n");
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17113)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17114)
+@@ -67,7 +67,7 @@
+ 		void        SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters);
+ 		void        SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum);
+ 		void        Delta18oParameterization(void);
+-		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){_error_("not implemented yet");};
++		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz);
+ 		void        ThermalToEnthalpy(IssmDouble* penthalpy,IssmDouble temperature,IssmDouble waterfraction,IssmDouble pressure){_error_("not implemented yet");};
+ 		void        EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented yet");};
+ 		int         FiniteElement(void);
+Index: ../trunk-jpl/src/m/classes/mask.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mask.m	(revision 17113)
++++ ../trunk-jpl/src/m/classes/mask.m	(revision 17114)
+@@ -24,10 +24,10 @@
+ 
+ 			md = checkfield(md,'fieldname','mask.groundedice_levelset','size',[md.mesh.numberofvertices 1]);
+ 			md = checkfield(md,'fieldname','mask.ice_levelset'        ,'size',[md.mesh.numberofvertices 1]);
+-			isice=(md.mask.ice_levelset>0);
+-			if any(sum(isice(md.mesh.elements),2)==0),
+-				warning('elements with no ice not implemented yet, each element should have at least one vertex with md.mask.ice_levelset > 0');
+-			end
++			%isice=(md.mask.ice_levelset>0);
++			%if any(sum(isice(md.mesh.elements),2)==0),
++		%		warning('elements with no ice not implemented yet, each element should have at least one vertex with md.mask.ice_levelset > 0');
++		%	end
+ 		end % }}}
+ 		function disp(obj) % {{{
+ 			disp(sprintf('   masks:'));
+Index: ../trunk-jpl/src/m/classes/transient.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/transient.py	(revision 17113)
++++ ../trunk-jpl/src/m/classes/transient.py	(revision 17114)
+@@ -37,7 +37,10 @@
+ 		#}}}
+ 	def defaultoutputs(self,md): # {{{
+ 
+-		return ['SurfaceforcingsMassBalance']
++		if self.ismasstransport:
++			return ['SurfaceforcingsMassBalance']
++		else:
++			return []
+ 
+ 	#}}}
+ 	def setdefaultparameters(self): # {{{
+Index: ../trunk-jpl/src/m/classes/mask.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/mask.py	(revision 17113)
++++ ../trunk-jpl/src/m/classes/mask.py	(revision 17114)
+@@ -32,10 +32,10 @@
+ 	def checkconsistency(self,md,solution,analyses):    # {{{
+ 
+ 		md = checkfield(md,'fieldname','mask.ice_levelset'        ,'size',[md.mesh.numberofvertices])
+-		isice=numpy.array(md.mask.ice_levelset>0,int)
+-		totallyicefree=(numpy.sum(isice[md.mesh.elements-1],axis=1)==0).astype(int)
+-		if any(totallyicefree):
+-			raise TypeError("elements with no ice not implemented yet, each element should have at least one vertex with md.mask.ice_levelset > 0")
++		#isice=numpy.array(md.mask.ice_levelset<0,int)
++		#totallyicefree=(numpy.sum(isice[md.mesh.elements-1],axis=1)==0).astype(int)
++		#if any(totallyicefree):
++		#	raise TypeError("elements with no ice not implemented yet, each element should have at least one vertex with md.mask.ice_levelset > 0")
+ 
+ 		return md
+ 	# }}}
+Index: ../trunk-jpl/src/m/classes/transient.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/transient.m	(revision 17113)
++++ ../trunk-jpl/src/m/classes/transient.m	(revision 17114)
+@@ -38,9 +38,11 @@
+ 			obj.requested_outputs={'default'};
+ 		end % }}}
+ 		function list = defaultoutputs(self,md) % {{{
+-
+-			list = {'SurfaceforcingsMassBalance'};
+-
++			if(self.ismasstransport)
++				list = {'SurfaceforcingsMassBalance'};
++			else
++				list = {};
++			end
+ 		end % }}}
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+ 
+Index: ../trunk-jpl/src/m/parameterization/setmask.m
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/setmask.m	(revision 17113)
++++ ../trunk-jpl/src/m/parameterization/setmask.m	(revision 17114)
+@@ -41,6 +41,6 @@
+ %}}}
+ 
+ %level sets
+-md.mask.ice_levelset=ones(md.mesh.numberofvertices,1);
++md.mask.ice_levelset=-1.*ones(md.mesh.numberofvertices,1);
+ md.mask.groundedice_levelset=vertexongroundedice;
+ md.mask.groundedice_levelset(find(vertexongroundedice==0.))=-1.;
+Index: ../trunk-jpl/src/m/parameterization/setmask.py
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/setmask.py	(revision 17113)
++++ ../trunk-jpl/src/m/parameterization/setmask.py	(revision 17114)
+@@ -41,7 +41,7 @@
+ 	#}}}
+ 
+ 	#level sets
+-	md.mask.ice_levelset         = numpy.ones(md.mesh.numberofvertices,bool)
++	md.mask.ice_levelset         = -1.*numpy.ones((md.mesh.numberofvertices,1))
+ 	md.mask.groundedice_levelset = -1.*numpy.ones((md.mesh.numberofvertices,1))
+ 	md.mask.groundedice_levelset[md.mesh.elements[numpy.nonzero(elementongroundedice),:]-1]=1.
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17114-17115.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17114-17115.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17114-17115.diff	(revision 17802)
@@ -0,0 +1,25 @@
+Index: ../trunk-jpl/src/m/parameterization/setmask.m
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/setmask.m	(revision 17114)
++++ ../trunk-jpl/src/m/parameterization/setmask.m	(revision 17115)
+@@ -41,6 +41,6 @@
+ %}}}
+ 
+ %level sets
+-md.mask.ice_levelset=-1.*ones(md.mesh.numberofvertices,1);
++md.mask.ice_levelset=+1.*ones(md.mesh.numberofvertices,1);
+ md.mask.groundedice_levelset=vertexongroundedice;
+ md.mask.groundedice_levelset(find(vertexongroundedice==0.))=-1.;
+Index: ../trunk-jpl/src/m/parameterization/setmask.py
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/setmask.py	(revision 17114)
++++ ../trunk-jpl/src/m/parameterization/setmask.py	(revision 17115)
+@@ -41,7 +41,7 @@
+ 	#}}}
+ 
+ 	#level sets
+-	md.mask.ice_levelset         = -1.*numpy.ones((md.mesh.numberofvertices,1))
++	md.mask.ice_levelset         = +1.*numpy.ones((md.mesh.numberofvertices,1))
+ 	md.mask.groundedice_levelset = -1.*numpy.ones((md.mesh.numberofvertices,1))
+ 	md.mask.groundedice_levelset[md.mesh.elements[numpy.nonzero(elementongroundedice),:]-1]=1.
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17115-17116.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17115-17116.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17115-17116.diff	(revision 17802)
@@ -0,0 +1,33 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17115)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17116)
+@@ -2749,7 +2749,6 @@
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+-	IssmDouble  rho_ice =element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	Gauss* gauss=element->NewGauss(5);
+@@ -2763,14 +2762,14 @@
+ 		y_coord=element->GetYcoord(gauss);
+ 		z_coord=element->GetZcoord(gauss);
+ 
+-		forcex=fx(x_coord,y_coord,z_coord);
+-		forcey=fy(x_coord,y_coord,z_coord);
+-		forcez=fz(x_coord,y_coord,z_coord);
++		forcex=fx1(x_coord,y_coord,z_coord);
++		forcey=fy1(x_coord,y_coord,z_coord);
++		forcez=fz1(x_coord,y_coord,z_coord);
+ 
+ 		for(i=0;i<vnumnodes;i++){
+-			pe->values[i*dim+0] += +rho_ice*forcex *Jdet*gauss->weight*vbasis[i];
+-			pe->values[i*dim+1] += +rho_ice*forcey *Jdet*gauss->weight*vbasis[i];
+-			pe->values[i*dim+2] += +rho_ice*forcez *Jdet*gauss->weight*vbasis[i];
++			pe->values[i*dim+0] += forcex *Jdet*gauss->weight*vbasis[i];
++			pe->values[i*dim+1] += forcey *Jdet*gauss->weight*vbasis[i];
++			pe->values[i*dim+2] += forcez *Jdet*gauss->weight*vbasis[i];
+ 		}
+ 	}
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17116-17117.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17116-17117.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17116-17117.diff	(revision 17802)
@@ -0,0 +1,23 @@
+Index: ../trunk-jpl/src/m/plot/plot_elementnumbering.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_elementnumbering.m	(revision 17116)
++++ ../trunk-jpl/src/m/plot/plot_elementnumbering.m	(revision 17117)
+@@ -38,12 +38,12 @@
+ 
+ 	%highlight
+ 	pos=getfieldvalue(options,'highlight',[]);
+-	A=elements(pos,1); B=elements(pos,2); C=elements(pos,3);
+-	patch( 'Faces', [A B C],  'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','none','EdgeColor','black');
+-	patch( 'Faces', [D E F],  'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','none','EdgeColor','black');
+-	patch( 'Faces', [A B E D],'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','none','EdgeColor','black');
+-	patch( 'Faces', [B E F C],'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','none','EdgeColor','black');
+-	patch( 'Faces', [C A D F],'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','none','EdgeColor','black');
++	A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); D=elements(pos,4); E=elements(pos,5); F=elements(pos,6);
++	patch( 'Faces', [A B C],  'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
++	patch( 'Faces', [D E F],  'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
++	patch( 'Faces', [A B E D],'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
++	patch( 'Faces', [B E F C],'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
++	patch( 'Faces', [C A D F],'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
+ 
+ 	%numbering
+ 	text(sum(x(elements(:,1:6)),2)/6,sum(y(elements(:,1:6)),2)/6,sum(z(elements(:,1:6)),2)/6,...
Index: issm/oecreview/Archive/16554-17801/ISSM-17117-17118.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17117-17118.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17117-17118.diff	(revision 17802)
@@ -0,0 +1,563 @@
+Index: ../trunk-jpl/src/c/classes/Loads/Numericalflux.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Numericalflux.cpp	(revision 17117)
++++ ../trunk-jpl/src/c/classes/Loads/Numericalflux.cpp	(revision 17118)
+@@ -475,7 +475,7 @@
+ 
+ 	/*Initialize Element matrix and return if necessary*/
+ 	Tria*  tria=(Tria*)element;
+-	if(tria->NoIceInElement()) return NULL;
++	if(!tria->IsIceInElement()) return NULL;
+ 	ElementMatrix* Ke=new ElementMatrix(nodes,NUMNODES_INTERNAL,this->parameters);
+ 
+ 	/*Retrieve all inputs and parameters*/
+@@ -539,7 +539,7 @@
+ 	/*Initialize Element matrix and return if necessary*/
+ 	ElementMatrix* Ke = NULL;
+ 	Tria*  tria=(Tria*)element;
+-	if(tria->NoIceInElement()) return NULL;
++	if(!tria->IsIceInElement()) return NULL;
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+@@ -628,7 +628,7 @@
+ 
+ 	/*Initialize Element matrix and return if necessary*/
+ 	Tria*  tria=(Tria*)element;
+-	if(tria->NoIceInElement()) return NULL;
++	if(!tria->IsIceInElement()) return NULL;
+ 	ElementMatrix* Ke=new ElementMatrix(nodes,NUMNODES_INTERNAL,this->parameters);
+ 
+ 	/*Retrieve all inputs and parameters*/
+@@ -691,7 +691,7 @@
+ 	/*Initialize Element matrix and return if necessary*/
+ 	ElementMatrix* Ke = NULL;
+ 	Tria*  tria=(Tria*)element;
+-	if(tria->NoIceInElement()) return NULL;
++	if(!tria->IsIceInElement()) return NULL;
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+@@ -817,7 +817,7 @@
+ 	/*Initialize Load Vector and return if necessary*/
+ 	ElementVector* pe = NULL;
+ 	Tria*  tria=(Tria*)element;
+-	if(tria->NoIceInElement()) return NULL;
++	if(!tria->IsIceInElement()) return NULL;
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+@@ -911,7 +911,7 @@
+ 	/*Initialize Load Vector and return if necessary*/
+ 	ElementVector* pe = NULL;
+ 	Tria*  tria=(Tria*)element;
+-	if(tria->NoIceInElement()) return NULL;
++	if(!tria->IsIceInElement()) return NULL;
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17117)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17118)
+@@ -150,6 +150,7 @@
+ 		virtual bool   IsNodeOnShelfFromFlags(IssmDouble* flags)=0; 
+ 		virtual bool   IsOnBed()=0;
+ 		virtual bool   IsOnSurface()=0;
++		virtual bool   IsIceInElement()=0;
+ 		virtual void   GetGroundedPart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* mainlyfloating)=0;
+ 		virtual IssmDouble GetGroundedPortion(IssmDouble* xyz_list)=0;
+ 		virtual void   GetInputListOnNodes(IssmDouble* pvalue,int enumtype)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17117)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17118)
+@@ -811,7 +811,7 @@
+ 		s1=levelset[2]/(levelset[2]-levelset[1]);
+ 		s2=levelset[2]/(levelset[2]-levelset[0]);
+ 
+-		if(levelset[2]>0.) normal_orientation=1;
++		if(levelset[2]<0.) normal_orientation=1; //orientation of quadrangle depending on distribution of levelsetfunction
+ 		/*New point 1*/
+ 		xyz_zero[3*normal_orientation+0]=xyz_list[2*3+0]+s1*(xyz_list[1*3+0]-xyz_list[2*3+0]);
+ 		xyz_zero[3*normal_orientation+1]=xyz_list[2*3+1]+s1*(xyz_list[1*3+1]-xyz_list[2*3+1]);
+@@ -827,7 +827,7 @@
+ 		s1=levelset[0]/(levelset[0]-levelset[2]);
+ 		s2=levelset[0]/(levelset[0]-levelset[1]);
+ 
+-		if(levelset[0]>0.) normal_orientation=1;
++		if(levelset[0]<0.) normal_orientation=1;
+ 		/*New point 1*/
+ 		xyz_zero[3*normal_orientation+0]=xyz_list[0*3+0]+s1*(xyz_list[2*3+0]-xyz_list[0*3+0]);
+ 		xyz_zero[3*normal_orientation+1]=xyz_list[0*3+1]+s1*(xyz_list[2*3+1]-xyz_list[0*3+1]);
+@@ -843,7 +843,7 @@
+ 		s1=levelset[1]/(levelset[1]-levelset[0]);
+ 		s2=levelset[1]/(levelset[1]-levelset[2]);
+ 
+-		if(levelset[1]>0.) normal_orientation=1;
++		if(levelset[1]<0.) normal_orientation=1;
+ 		/*New point 0*/
+ 		xyz_zero[3*normal_orientation+0]=xyz_list[1*3+0]+s1*(xyz_list[0*3+0]-xyz_list[1*3+0]);
+ 		xyz_zero[3*normal_orientation+1]=xyz_list[1*3+1]+s1*(xyz_list[0*3+1]-xyz_list[1*3+1]);
+@@ -1868,18 +1868,18 @@
+ 	return new ElementMatrix(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
+ }
+ /*}}}*/
+-/*FUNCTION Tria::NoIceInElement {{{*/
+-bool   Tria::NoIceInElement(){
++/*FUNCTION Tria::IsIceInElement {{{*/
++bool   Tria::IsIceInElement(){
+ 
+ 	/*Get levelset*/
+ 	IssmDouble ls[NUMVERTICES];
+ 	GetInputListOnVertices(&ls[0],MaskIceLevelsetEnum);
+ 
+-	/*If the level set is >0, ice is present in this element*/
+-	if(ls[0]>0. || ls[1]>0. || ls[2]>0.) return false;
+-
+-	/*If the level set is awlays <=0, there is no ice here*/
+-	return true;
++	/*If the level set on one of the nodes is <0, ice is present in this element*/
++	if(ls[0]<0. || ls[1]<0. || ls[2]<0.) 
++		return true;
++	else
++		return false;
+ }
+ /*}}}*/
+ /*FUNCTION Tria::NodalFunctions{{{*/
+@@ -2263,7 +2263,7 @@
+ 	IssmDouble xyz_list[NUMVERTICES][3];
+ 
+ 	/*If on water, return 0: */
+-	if(NoIceInElement()){
++	if(!IsIceInElement()){
+ 		printf("no ice in element!\n");
+ 		return 0;
+ 	}
+@@ -2502,7 +2502,7 @@
+ 
+ 	/*If the level set is awlays <0, there is no ice front here*/
+ 	iszerols= false;
+-	if(ls[0]>0. || ls[1]>0. || ls[2]>0.){
++	if(IsIceInElement()){
+ 		if(ls[0]*ls[1]<0. || ls[0]*ls[2]<0. || (ls[0]*ls[1]+ls[0]*ls[2]+ls[1]*ls[2]==0.)){
+ 			iszerols= true;
+ 		}
+@@ -2559,7 +2559,7 @@
+ 	IssmDouble base,surface,bed;
+ 	IssmDouble xyz_list[NUMVERTICES][3];
+ 
+-	if(NoIceInElement())return 0;
++	if(!IsIceInElement())return 0;
+ 
+ 	/*First get back the area of the base*/
+ 	base=this->GetArea();
+@@ -2589,7 +2589,7 @@
+ 	IssmDouble base,surface,bed,bathymetry;
+ 	IssmDouble xyz_list[NUMVERTICES][3];
+ 
+-	if(NoIceInElement() || IsFloating())return 0;
++	if(!IsIceInElement() || IsFloating())return 0;
+ 
+ 	rho_ice=matpar->GetRhoIce();
+ 	rho_water=matpar->GetRhoWater();
+@@ -2891,7 +2891,7 @@
+ 	/*Get material parameters :*/
+ 	rho_ice=matpar->GetRhoIce();
+ 
+-   if(NoIceInElement())return 0;
++   if(!IsIceInElement())return 0;
+ 
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+@@ -2920,7 +2920,7 @@
+ 	GaussTria *gauss = NULL;
+ 
+ 	/*If on water, return 0: */
+-	if(NoIceInElement())return 0;
++	if(!IsIceInElement())return 0;
+ 
+ 	/*Retrieve all inputs we will be needing: */
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+@@ -2958,7 +2958,7 @@
+ 	GaussTria *gauss = NULL;
+ 
+ 	/*If on water, return 0: */
+-	if(NoIceInElement())return 0;
++	if(!IsIceInElement())return 0;
+ 
+ 	/*Retrieve all inputs we will be needing: */
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+@@ -3136,7 +3136,7 @@
+ 	GaussTria *gauss = NULL;
+ 
+ 	/*If on water, return 0: */
+-	if(NoIceInElement()) return 0;
++	if(!IsIceInElement()) return 0;
+ 
+ 	/*Retrieve all inputs we will be needing: */
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+@@ -3316,7 +3316,7 @@
+ 	/*dJ/dalpha = ∂L/∂alpha = ∂J/∂alpha + ∂/∂alpha(KU-F)*/
+ 
+ 	/*If on water, grad = 0: */
+-	if(NoIceInElement()) return;
++	if(!IsIceInElement()) return;
+ 
+ 	/*First deal with ∂/∂alpha(KU-F)*/
+ 	switch(control_type){
+@@ -3901,7 +3901,7 @@
+ 	/*retrieve parameters and inputs*/
+ 
+ 	/*If on water, return 0: */
+-	if(NoIceInElement()) return 0;
++	if(!IsIceInElement()) return 0;
+ 
+ 	/*Retrieve all inputs we will be needing: */
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+@@ -3940,7 +3940,7 @@
+ 	GaussTria *gauss=NULL;
+ 
+ 	/*If on water, return 0: */
+-	if(NoIceInElement())return 0;
++	if(!IsIceInElement())return 0;
+ 
+ 	/* Get node coordinates and dof list: */
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+@@ -3999,7 +3999,7 @@
+ 	GaussTria *gauss=NULL;
+ 
+ 	/*If on water, return 0: */
+-	if(NoIceInElement())return 0;
++	if(!IsIceInElement())return 0;
+ 
+ 	/* Get node coordinates and dof list: */
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+@@ -4058,7 +4058,7 @@
+ 	GaussTria *gauss=NULL;
+ 
+ 	/*If on water, return 0: */
+-	if(NoIceInElement())return 0;
++	if(!IsIceInElement())return 0;
+ 
+ 	/* Get node coordinates and dof list: */
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+@@ -4116,7 +4116,7 @@
+ 	GaussTria *gauss=NULL;
+ 
+ 	/*If on water, return 0: */
+-	if(NoIceInElement())return 0;
++	if(!IsIceInElement())return 0;
+ 
+ 	/* Get node coordinates and dof list: */
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+@@ -4175,7 +4175,7 @@
+ 	GaussTria *gauss=NULL;
+ 
+ 	/*If on water, return 0: */
+-	if(NoIceInElement())return 0;
++	if(!IsIceInElement())return 0;
+ 
+ 	/* Get node coordinates and dof list: */
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+@@ -4237,7 +4237,7 @@
+ 	/*retrieve parameters and inputs*/
+ 
+ 	/*If on water, return 0: */
+-	if(NoIceInElement()) return 0;
++	if(!IsIceInElement()) return 0;
+ 
+ 	/*Retrieve all inputs we will be needing: */
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+@@ -4281,7 +4281,7 @@
+ 	/*retrieve parameters and inputs*/
+ 
+ 	/*If on water, return 0: */
+-	if(NoIceInElement()) return 0;
++	if(!IsIceInElement()) return 0;
+ 
+ 	/*Retrieve all inputs we will be needing: */
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+@@ -4332,7 +4332,7 @@
+ 	/*retrieve parameters and inputs*/
+ 
+ 	/*If on water, return 0: */
+-	if(NoIceInElement()) return 0;
++	if(!IsIceInElement()) return 0;
+ 
+ 	/*Retrieve all inputs we will be needing: */
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+@@ -4380,7 +4380,7 @@
+ 	IssmDouble dH[2];
+ 
+ 	/*If on water, return 0: */
+-	if(NoIceInElement())return 0;
++	if(!IsIceInElement())return 0;
+ 
+ 	/*Retrieve all inputs we will be needing: */
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+@@ -4426,7 +4426,7 @@
+ 	/*retrieve parameters and inputs*/
+ 
+ 	/*If on water, return 0: */
+-	if(NoIceInElement()) return 0;
++	if(!IsIceInElement()) return 0;
+ 
+ 	/*Retrieve all inputs we will be needing: */
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17117)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17118)
+@@ -101,7 +101,7 @@
+ 		bool        IsNodeOnShelfFromFlags(IssmDouble* flags);
+ 		int         NumberofNodesVelocity(void);
+ 		int         NumberofNodesPressure(void);
+-		bool        NoIceInElement();
++		bool        IsIceInElement();
+ 		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
+ 		void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum);
+ 		void        GetVerticesCoordinates(IssmDouble** pxyz_list);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17117)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17118)
+@@ -1255,7 +1255,7 @@
+ /*}}}*/
+ /*FUNCTION Penta::ZeroLevelsetCoordinates{{{*/
+ void Penta::ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){
+-	/*Computeportion of the element that is grounded*/ 
++	/*Compute portion of the element that is grounded*/ 
+ 
+ 	int         normal_orientation=0;
+ 	IssmDouble  s1,s2;
+@@ -1270,7 +1270,7 @@
+ 		s1=levelset[2]/(levelset[2]-levelset[1]);
+ 		s2=levelset[2]/(levelset[2]-levelset[0]);
+ 
+-		if(levelset[2]>0.) normal_orientation=1;
++		if(levelset[2]<0.) normal_orientation=1; //orientation of quadrangle at base and top, depending on distribution of levelsetfunction
+ 		/*New point 1*/
+ 		xyz_zero[3*normal_orientation+0]=xyz_list[2*3+0]+s1*(xyz_list[1*3+0]-xyz_list[2*3+0]);
+ 		xyz_zero[3*normal_orientation+1]=xyz_list[2*3+1]+s1*(xyz_list[1*3+1]-xyz_list[2*3+1]);
+@@ -1296,7 +1296,7 @@
+ 		s1=levelset[0]/(levelset[0]-levelset[2]);
+ 		s2=levelset[0]/(levelset[0]-levelset[1]);
+ 
+-		if(levelset[0]>0.) normal_orientation=1;
++		if(levelset[0]<0.) normal_orientation=1;
+ 		/*New point 1*/
+ 		xyz_zero[3*normal_orientation+0]=xyz_list[0*3+0]+s1*(xyz_list[2*3+0]-xyz_list[0*3+0]);
+ 		xyz_zero[3*normal_orientation+1]=xyz_list[0*3+1]+s1*(xyz_list[2*3+1]-xyz_list[0*3+1]);
+@@ -1322,7 +1322,7 @@
+ 		s1=levelset[1]/(levelset[1]-levelset[0]);
+ 		s2=levelset[1]/(levelset[1]-levelset[2]);
+ 
+-		if(levelset[1]>0.) normal_orientation=1;
++		if(levelset[1]<0.) normal_orientation=1;
+ 		/*New point 0*/
+ 		xyz_zero[3*normal_orientation+0]=xyz_list[1*3+0]+s1*(xyz_list[0*3+0]-xyz_list[1*3+0]);
+ 		xyz_zero[3*normal_orientation+1]=xyz_list[1*3+1]+s1*(xyz_list[0*3+1]-xyz_list[1*3+1]);
+@@ -2067,18 +2067,18 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::NoIceInElement {{{*/
+-bool   Penta::NoIceInElement(){
++/*FUNCTION Penta::IsIceInElement {{{*/
++bool   Penta::IsIceInElement(){
+ 
+ 	/*Get levelset*/
+ 	IssmDouble ls[NUMVERTICES];
+ 	GetInputListOnVertices(&ls[0],MaskIceLevelsetEnum);
+ 
+-	/*If the level set is >0, ice is present in this element*/
+-	if(ls[0]>0. || ls[1]>0. || ls[2]>0.) return false;
+-
+-	/*If the level set is awlays <=0, there is no ice here*/
+-	return true;
++	/*If the level set one one of the nodes is <0, ice is present in this element*/
++	if(ls[0]<0. || ls[1]<0. || ls[2]<0.) 
++		return true;
++	else
++		return false;
+ }
+ /*}}}*/
+ /*FUNCTION Penta::MinEdgeLength{{{*/
+@@ -2665,7 +2665,7 @@
+ 	inputs->GetInputValue(&approximation,ApproximationEnum);
+ 
+ 	/*If on water, return 0: */
+-	if(NoIceInElement())return 0;
++	if(!IsIceInElement())return 0;
+ 
+ 	/*Bail out if this element if:
+ 	 * -> Non SSA not on the surface
+@@ -3110,7 +3110,7 @@
+ 
+ 	/*If the level set is awlays <=0, there is no ice front here*/
+ 	iszerols = false;
+-	if(ls[0]>0. || ls[1]>0. || ls[2]>0.){
++	if(IsIceInElement()){
+ 		if(ls[0]*ls[1]<0. || ls[0]*ls[2]<0. || (ls[0]*ls[1]+ls[0]*ls[2]+ls[1]*ls[2]==0.)){
+ 			iszerols = true;
+ 		}
+@@ -3132,7 +3132,7 @@
+ 	IssmDouble base,height;
+ 	IssmDouble xyz_list[NUMVERTICES][3];
+ 
+-	if(NoIceInElement())return 0;
++	if(!IsIceInElement())return 0;
+ 
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+@@ -3156,7 +3156,7 @@
+ 	IssmDouble base,bed,surface,bathymetry;
+ 	IssmDouble xyz_list[NUMVERTICES][3];
+ 
+-	if(NoIceInElement() || IsFloating() || !IsOnBed())return 0;
++	if(!IsIceInElement() || IsFloating() || !IsOnBed())return 0;
+ 
+ 	rho_ice=matpar->GetRhoIce();
+ 	rho_water=matpar->GetRhoWater();
+@@ -3379,7 +3379,7 @@
+ 	/*Get material parameters :*/
+ 	rho_ice=matpar->GetRhoIce();
+ 
+-	if(NoIceInElement() || !IsOnSurface()) return 0.;
++	if(!IsIceInElement() || !IsOnSurface()) return 0.;
+ 
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+@@ -3542,7 +3542,7 @@
+ 	Tria* tria=NULL;
+ 
+ 	/*If on water, skip grad (=0): */
+-	if(NoIceInElement())return;
++	if(!IsIceInElement())return;
+ 					
+ 	/*First deal with ∂/∂alpha(KU-F)*/
+ 	switch(control_type){
+@@ -3916,7 +3916,7 @@
+ 	inputs->GetInputValue(&approximation,ApproximationEnum);
+ 
+ 	/*If on water, return 0: */
+-	if(NoIceInElement())return 0;
++	if(!IsIceInElement())return 0;
+ 
+ 	/*Bail out if this element if:
+ 	 * -> Non SSA and not on the surface
+@@ -3953,7 +3953,7 @@
+ 	inputs->GetInputValue(&approximation,ApproximationEnum);
+ 
+ 	/*If on water, return 0: */
+-	if(NoIceInElement())return 0;
++	if(!IsIceInElement())return 0;
+ 
+ 	/*Bail out if this element if:
+ 	 * -> Non SSA and not on the surface
+@@ -3990,7 +3990,7 @@
+ 	inputs->GetInputValue(&approximation,ApproximationEnum);
+ 
+ 	/*If on water, return 0: */
+-	if(NoIceInElement())return 0;
++	if(!IsIceInElement())return 0;
+ 
+ 	/*Bail out if this element if:
+ 	 * -> Non SSA and not on the surface
+@@ -4029,7 +4029,7 @@
+ 	inputs->GetInputValue(&approximation,ApproximationEnum);
+ 
+ 	/*If on water, return 0: */
+-	if(NoIceInElement())return 0;
++	if(!IsIceInElement())return 0;
+ 
+ 	/*Bail out if this element if:
+ 	 * -> Non SSA and not on the surface
+@@ -4066,7 +4066,7 @@
+ 	inputs->GetInputValue(&approximation,ApproximationEnum);
+ 
+ 	/*If on water, return 0: */
+-	if(NoIceInElement())return 0;
++	if(!IsIceInElement())return 0;
+ 
+ 	/*Bail out if this element if:
+ 	 * -> Non SSA and not on the surface
+@@ -4109,7 +4109,7 @@
+ 	inputs->GetInputValue(&approximation,ApproximationEnum);
+ 
+ 	/*If on water, return 0: */
+-	if(NoIceInElement())return 0;
++	if(!IsIceInElement())return 0;
+ 	_error_("Not implemented yet");
+ 
+ 	tria=(Tria*)SpawnTria(0);
+@@ -4125,7 +4125,7 @@
+ 	Tria*  tria=NULL;
+ 
+ 	/*If on water, on shelf or not on bed, skip: */
+-	if(NoIceInElement()|| IsFloating() || !IsOnBed()) return 0;
++	if(!IsIceInElement()|| IsFloating() || !IsOnBed()) return 0;
+ 
+ 	tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1
+ 	J=tria->DragCoefficientAbsGradient();
+@@ -4140,7 +4140,7 @@
+ 	Tria*  tria=NULL;
+ 
+ 	/*If on water, on shelf or not on bed, skip: */
+-	if(NoIceInElement() || !IsOnBed()) return 0;
++	if(!IsIceInElement() || !IsOnBed()) return 0;
+ 
+ 	tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1
+ 	J=tria->RheologyBbarAbsGradient();
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17117)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17118)
+@@ -233,7 +233,7 @@
+ 		void           JacobianDeterminantSurface(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss);
+ 		void           JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss);
+ 		void           JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss);
+-		bool           NoIceInElement(void); 
++		bool           IsIceInElement(void); 
+ 		Gauss*         NewGauss(void);
+ 		Gauss*         NewGauss(int order);
+       Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17117)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17118)
+@@ -113,7 +113,7 @@
+ 		void        NodalFunctionsP1Derivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsMINIDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+-		bool        NoIceInElement(){_error_("not implemented yet");};
++		bool        IsIceInElement(){_error_("not implemented yet");};
+ 		void        NormalSection(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		void        NormalTop(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		void        NormalBase(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/m/parameterization/setmask.m
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/setmask.m	(revision 17117)
++++ ../trunk-jpl/src/m/parameterization/setmask.m	(revision 17118)
+@@ -41,6 +41,6 @@
+ %}}}
+ 
+ %level sets
+-md.mask.ice_levelset=+1.*ones(md.mesh.numberofvertices,1);
++md.mask.ice_levelset=-1.*ones(md.mesh.numberofvertices,1);
+ md.mask.groundedice_levelset=vertexongroundedice;
+ md.mask.groundedice_levelset(find(vertexongroundedice==0.))=-1.;
+Index: ../trunk-jpl/src/m/parameterization/setmask.py
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/setmask.py	(revision 17117)
++++ ../trunk-jpl/src/m/parameterization/setmask.py	(revision 17118)
+@@ -41,7 +41,7 @@
+ 	#}}}
+ 
+ 	#level sets
+-	md.mask.ice_levelset         = +1.*numpy.ones((md.mesh.numberofvertices,1))
++	md.mask.ice_levelset         = -1.*numpy.ones((md.mesh.numberofvertices,1))
+ 	md.mask.groundedice_levelset = -1.*numpy.ones((md.mesh.numberofvertices,1))
+ 	md.mask.groundedice_levelset[md.mesh.elements[numpy.nonzero(elementongroundedice),:]-1]=1.
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17118-17119.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17118-17119.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17118-17119.diff	(revision 17802)
@@ -0,0 +1,52 @@
+Index: ../trunk-jpl/test/NightlyRun/test217.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test217.py	(revision 17118)
++++ ../trunk-jpl/test/NightlyRun/test217.py	(revision 17119)
+@@ -65,7 +65,7 @@
+ nodeonicefront=zeros(md.mesh.numberofvertices)
+ pos=numpy.nonzero(md.mesh.y==ymax)
+ nodeonicefront[pos]=1
+-md.mask.ice_levelset=1-nodeonicefront
++md.mask.ice_levelset=-1+nodeonicefront
+ 
+ md=solve(md,StressbalanceSolutionEnum())
+ 
+Index: ../trunk-jpl/test/NightlyRun/test217.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test217.m	(revision 17118)
++++ ../trunk-jpl/test/NightlyRun/test217.m	(revision 17119)
+@@ -53,7 +53,7 @@
+ %icefront
+ nodeonicefront=zeros(md.mesh.numberofvertices,1);
+ pos=find(md.mesh.y==ymax); nodeonicefront(pos)=1;
+-md.mask.ice_levelset=1-nodeonicefront;
++md.mask.ice_levelset=-1+nodeonicefront;
+ 
+ md=solve(md,StressbalanceSolutionEnum());
+ 
+Index: ../trunk-jpl/test/NightlyRun/test701.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test701.m	(revision 17118)
++++ ../trunk-jpl/test/NightlyRun/test701.m	(revision 17119)
+@@ -10,7 +10,7 @@
+ md.geometry.thickness = md.geometry.surface-md.geometry.bed;
+ 
+ %mask
+-md.mask.ice_levelset  = ones(md.mesh.numberofvertices,1);
++md.mask.ice_levelset  = - ones(md.mesh.numberofvertices,1);
+ md.mask.ice_levelset(find(vertexflags(md.mesh,2))) = 0;
+ md.mask.groundedice_levelset = double(md.mesh.x<0)-.5;
+ 
+Index: ../trunk-jpl/test/NightlyRun/test702.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test702.m	(revision 17118)
++++ ../trunk-jpl/test/NightlyRun/test702.m	(revision 17119)
+@@ -12,7 +12,7 @@
+ md.geometry.surface   = interp1(x,b+h,md.mesh.x);
+ md.geometry.bed       = interp1(x,b,md.mesh.x);
+ md.geometry.thickness = md.geometry.surface-md.geometry.bed;
+-md.mask.ice_levelset = ones(md.mesh.numberofvertices,1);
++md.mask.ice_levelset = - ones(md.mesh.numberofvertices,1);
+ md.mask.ice_levelset(find(vertexflags(md.mesh,2))) = 0;
+ md.mask.groundedice_levelset = double(md.mesh.x<0)-.5;
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17119-17120.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17119-17120.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17119-17120.diff	(revision 17802)
@@ -0,0 +1,22 @@
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17119)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17120)
+@@ -88,7 +88,7 @@
+ ElementMatrix* LevelsetAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries */
+-	int i,j,dim = 2; // solve for LSF in horizontal plane only
++	const int  dim = 2; // solve for LSF in horizontal plane only
+ 	IssmDouble kappa;
+ 	IssmDouble Jdet, dt, D_scalar;
+ 	IssmDouble h,hx,hy,hz;
+@@ -175,7 +175,7 @@
+ 				h=sqrt( pow(hx*vx/vel,2) + pow(hy*vy/vel,2) );
+ 				K[0][0]=h/(2.*vel)*vx*vx;  K[0][1]=h/(2.*vel)*vx*vy;
+ 				K[1][0]=h/(2.*vel)*vy*vx;  K[1][1]=h/(2.*vel)*vy*vy; 
+-				for(i=0;i<dim;i++) for(j=0;j<dim;j++) K[i][j] = D_scalar*K[i][j];
++				for(int i=0;i<dim;i++) for(int j=0;j<dim;j++) K[i][j] = D_scalar*K[i][j];
+ 
+ 				//GetBprime(Bprime,element,xyz_list,gauss); 
+ 				TripleMultiply(Bprime,dim,numnodes,1,
Index: issm/oecreview/Archive/16554-17801/ISSM-17120-17121.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17120-17121.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17120-17121.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/src/m/mesh/triangle2dvertical.m
+===================================================================
+--- ../trunk-jpl/src/m/mesh/triangle2dvertical.m	(revision 17120)
++++ ../trunk-jpl/src/m/mesh/triangle2dvertical.m	(revision 17121)
+@@ -53,7 +53,7 @@
+ md.mesh.segmentmarkers=segmentmarkers;
+ 
+ %Fill in rest of fields:
+-md.mesh.numberofelements=length(md.mesh.elements);
++md.mesh.numberofelements=size(md.mesh.elements,1);
+ md.mesh.numberofvertices=length(md.mesh.x);
+ md.mesh.vertexonboundary=zeros(md.mesh.numberofvertices,1); md.mesh.vertexonboundary(md.mesh.segments(:,1:2))=1;
+ 
+Index: ../trunk-jpl/src/m/mesh/triangle.m
+===================================================================
+--- ../trunk-jpl/src/m/mesh/triangle.m	(revision 17120)
++++ ../trunk-jpl/src/m/mesh/triangle.m	(revision 17121)
+@@ -65,7 +65,7 @@
+ md.mesh.segmentmarkers=segmentmarkers;
+ 
+ %Fill in rest of fields:
+-md.mesh.numberofelements=length(md.mesh.elements);
++md.mesh.numberofelements=size(md.mesh.elements,1);
+ md.mesh.numberofvertices=length(md.mesh.x);
+ md.mesh.z=zeros(md.mesh.numberofvertices,1);
+ md.mesh.vertexonboundary=zeros(md.mesh.numberofvertices,1); md.mesh.vertexonboundary(md.mesh.segments(:,1:2))=1;
Index: issm/oecreview/Archive/16554-17801/ISSM-17121-17122.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17121-17122.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17121-17122.diff	(revision 17802)
@@ -0,0 +1,280 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp	(revision 17121)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp	(revision 17122)
+@@ -4,17 +4,29 @@
+ 
+ #include "../../classes/classes.h"
+ #include "../../shared/shared.h"
++#include "./ModelProcessorx.h"
+ 
+-void CreateFaces(IoModel* iomodel){
++void CreateFaces(IoModel* iomodel){/*{{{*/
+ 
+ 	/*If faces are already present, exit*/
+ 	if(iomodel->faces) return;
+ 
+-	/*Check Iomodel properties*/
+-	if(iomodel->meshtype!=Mesh2DhorizontalEnum)             _error_("only 2d model are supported");
++	/*Some checks*/
+ 	if(iomodel->numberofvertices<3) _error_("not enough elements in mesh");
+ 	_assert_(iomodel->elements);
+ 
++	/*Check Iomodel properties*/
++	if(iomodel->meshtype==Mesh2DhorizontalEnum){
++		/*Keep going*/
++	}
++	else if(iomodel->meshtype==Mesh3DEnum){
++		CreateFaces3d(iomodel);
++		return;
++	}
++	else{
++		_error_("mesh dimension not supported yet");
++	}
++
+ 	/*Intermediaries*/
+ 	bool exist;
+ 	int  i,j,v1,v2,v3;
+@@ -30,7 +42,7 @@
+ 
+ 	/*Initialize chain*/
+ 	int* head_minv = xNew<int>(iomodel->numberofvertices);
+-	int* next_edge = xNew<int>(maxnbf);
++	int* next_face = xNew<int>(maxnbf);
+ 	for(i=0;i<iomodel->numberofvertices;i++) head_minv[i]=-1;
+ 
+ 	/*Initialize number of faces*/
+@@ -56,7 +68,7 @@
+ 
+ 			/*Go through all processed faces connected to v1 and check whether we have seen this edge yet*/
+ 			_assert_(v1>=0 && v1<iomodel->numberofvertices);
+-			for(int e=head_minv[v1]; e!=-1; e=next_edge[e]){
++			for(int e=head_minv[v1]; e!=-1; e=next_face[e]){
+ 				if(facestemp[e*4+1]==v2){
+ 					exist = true;
+ 					facestemp[e*4+3]=i+1;
+@@ -75,7 +87,7 @@
+ 				if(v1!=iomodel->elements[i*3+j]) exchange[nbf]=true;
+ 
+ 				/*Update chain*/
+-				next_edge[nbf] = head_minv[v1];
++				next_face[nbf] = head_minv[v1];
+ 				head_minv[v1]  = nbf;
+ 
+ 				/*Increase number of faces*/
+@@ -86,7 +98,7 @@
+ 
+ 	/*Clean up*/
+ 	xDelete<int>(head_minv);
+-	xDelete<int>(next_edge);
++	xDelete<int>(next_face);
+ 
+ 	/*Create final faces*/
+ 	int* faces = xNew<int>(nbf*4); /*vertex1 vertex2 element1 element2*/
+@@ -108,4 +120,119 @@
+ 	/*Assign output pointers*/
+ 	iomodel->faces         = faces;
+ 	iomodel->numberoffaces = nbf;
+-}
++}/*}}}*/
++void CreateFaces3d(IoModel* iomodel){/*{{{*/
++
++	/*Intermediaries*/
++	bool exist;
++	int  i,j,k,v0,cols;
++	int  maxnbf,nbf,elementnbf,elementnbv,facemaxnbv;
++	int *elementfaces         = NULL;
++	int *elementfaces_markers = NULL;
++
++	/*Maximum number of faces*/
++	maxnbf = 6*iomodel->numberofelements;
++
++	/*Initialize intermediaries*/
++	int*  facestemp = xNew<int>(maxnbf*6);         /*format: [vertex1 vertex2 vertex3 element1 element2 marker]    */
++	for(i=0;i<maxnbf;i++) facestemp[i*6+4]=-1;     /*Initialize last column of faces as -1 (boundary face)         */
++
++	/*Initialize chain*/
++	int* head_minv = xNew<int>(iomodel->numberofvertices);
++	int* next_face = xNew<int>(maxnbf);
++	for(i=0;i<iomodel->numberofvertices;i++) head_minv[i]=-1;
++
++	/*Mesh specific face indexing per element*/
++	if(iomodel->meshtype==Mesh3DEnum){
++		elementnbv = 6; /*Number of vertices per element*/
++		elementnbf = 5; /*Number of faces per element*/
++		facemaxnbv = 4; /*Maximum number of vertices per face*/
++		cols       = facemaxnbv + 1;
++		elementfaces         = xNew<int>(elementnbf*cols);
++		elementfaces_markers = xNew<int>(elementnbf);
++		/*2 triangles*/
++		elementfaces_markers[0] = 1;
++		elementfaces_markers[1] = 1;
++		elementfaces[cols*0+0] = 3; elementfaces[cols*0+1] = 0;  elementfaces[cols*0+2] = 1; elementfaces[cols*0+3] = 2;
++		elementfaces[cols*1+0] = 3; elementfaces[cols*1+1] = 3;  elementfaces[cols*1+2] = 4; elementfaces[cols*1+3] = 5;
++		/*3 quads*/
++		elementfaces_markers[2] = 2;
++		elementfaces_markers[3] = 2;
++		elementfaces_markers[4] = 2;
++		elementfaces[cols*2+0] = 4; elementfaces[cols*2+1] = 0;  elementfaces[cols*2+2] = 1; elementfaces[cols*2+3] = 4;  elementfaces[cols*2+4] = 3;
++		elementfaces[cols*3+0] = 4; elementfaces[cols*3+1] = 1;  elementfaces[cols*3+2] = 2; elementfaces[cols*3+3] = 5;  elementfaces[cols*3+4] = 4;
++		elementfaces[cols*4+0] = 4; elementfaces[cols*4+1] = 2;  elementfaces[cols*4+2] = 0; elementfaces[cols*4+3] = 3;  elementfaces[cols*4+4] = 5;
++	}
++	else{
++		_error_("mesh dimension not supported yet");
++	}
++	int *element_face_connectivity = xNewZeroInit<int>(iomodel->numberofelements*elementnbf); /*format: [face1 face2 ...] */
++
++	/*Initialize number of faces and list of vertex indices*/
++	nbf = 0;
++	int* v = xNew<int>(facemaxnbv);
++
++	for(i=0;i<iomodel->numberofelements;i++){
++		for(j=0;j<elementnbf;j++){
++
++			/*Get indices of current face*/
++			for(k=0;k<elementfaces[cols*j+0];k++){
++				v[k] = iomodel->elements[i*elementnbv + elementfaces[cols*j+k+1]] - 1;
++			}
++
++			/*Sort list of vertices*/
++			HeapSort(v,elementfaces[cols*j+0]);
++			v0 = v[0];
++
++			/*This face a priori has not been processed yet*/
++			exist = false;
++
++			/*Go through all processed faces connected to v1 and check whether we have seen this edge yet*/
++			_assert_(v0>=0 && v0<iomodel->numberofvertices);
++			for(int e=head_minv[v0]; e!=-1; e=next_face[e]){
++				if(facestemp[e*6+1]==v[1]+1 && facestemp[e*6+2]==v[2]+1){
++					exist = true;
++					facestemp[e*6+4]=i+1;
++					element_face_connectivity[i*elementnbf+j]=e;
++					break;
++				}
++			}
++
++			/*If this face is new, add it to the lists*/
++			if(!exist){
++				_assert_(nbf<maxnbf);
++
++				/*Update faces*/
++				facestemp[nbf*6+0] = v[0]+1;
++				facestemp[nbf*6+1] = v[1]+1;
++				facestemp[nbf*6+2] = v[2]+1;
++				facestemp[nbf*6+3] = i+1;
++				facestemp[nbf*6+5] = elementfaces_markers[j];
++
++				/*Update Connectivity*/
++				element_face_connectivity[i*elementnbf+j]=nbf;
++
++				/*Update chain*/
++				next_face[nbf] = head_minv[v0];
++				head_minv[v0]  = nbf;
++
++				/*Increase number of faces*/
++				nbf++;
++			}
++		}
++	}
++
++	/*Clean up*/
++	xDelete<int>(head_minv);
++	xDelete<int>(next_face);
++
++	/*Create final faces (now that we have the correct size)*/
++	int* faces = xNew<int>(nbf*6); /*vertex1 vertex2 vertex3 element1 element2 marker*/
++	xMemCpy<int>(faces,facestemp,nbf*6);
++	xDelete<int>(facestemp);
++
++	/*Assign output pointers*/
++	iomodel->faces                     = faces;
++	iomodel->numberoffaces             = nbf;
++	iomodel->elementtofaceconnectivity = element_face_connectivity;
++}/*}}}*/
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/FacesPartitioning.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/FacesPartitioning.cpp	(revision 17121)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/FacesPartitioning.cpp	(revision 17122)
+@@ -10,31 +10,36 @@
+ void FacesPartitioning(bool** pmy_faces,IoModel* iomodel){
+ 
+ 	/*Intermediaries*/
+-	int  el1,el2;
+-	bool my_face;
++	int elementnbf;
+ 
+-	/*Check Iomodel properties*/
+-	if(iomodel->meshtype!=Mesh2DhorizontalEnum) _error_("only 2d model are supported");
+-
+ 	/*Get faces and elements*/
+ 	CreateFaces(iomodel);
++	_assert_(iomodel->elementtofaceconnectivity);
+ 
++	/*Mesh dependent variables*/
++	if(iomodel->meshtype==Mesh2DhorizontalEnum){
++		elementnbf = 3;
++	}
++	else if(iomodel->meshtype==Mesh2DverticalEnum){
++		elementnbf = 3;
++	}
++	else if(iomodel->meshtype==Mesh3DEnum){
++		elementnbf = 5;
++	}
++	else{
++		_error_("mesh dimension not supported yet");
++	}
+ 	/*output: */
+-	bool* my_faces=xNew<bool>(iomodel->numberoffaces);
++	bool* my_faces=xNewZeroInit<bool>(iomodel->numberoffaces);
+ 
+-	for(int i=0;i<iomodel->numberoffaces;i++){
+-
+-		/*Get left and right elements*/
+-		el1=iomodel->faces[4*i+2]-1; //faces are [node1 node2 elem1 elem2]
+-		el2=iomodel->faces[4*i+3]-1; //faces are [node1 node2 elem1 elem2]
+-
+-		/*Check whether we should include this face (el2 is -2 for boundary faces)*/
+-		my_face = iomodel->my_elements[el1];
+-		if(!my_face && el2>=0){
+-			my_face = iomodel->my_elements[el2];
++	for(int i=0;i<iomodel->numberofelements;i++){
++		if(iomodel->my_elements[i]){
++			for(int j=0;j<elementnbf;j++){
++				_assert_(iomodel->elementtofaceconnectivity[i*elementnbf+j] >= 0);
++				_assert_(iomodel->elementtofaceconnectivity[i*elementnbf+j] <  iomodel->numberoffaces);
++				my_faces[iomodel->elementtofaceconnectivity[i*elementnbf+j]] = true;
++			}
+ 		}
+-
+-		my_faces[i] = my_face;
+ 	}
+ 
+ 	/*Free data and assign output pointers */
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.h	(revision 17121)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.h	(revision 17122)
+@@ -29,8 +29,9 @@
+ void EdgesPartitioning(bool** pmy_edges,IoModel* iomodel);
+ 
+ /*Mesh properties*/
++void CreateEdges(IoModel* iomodel);
+ void CreateFaces(IoModel* iomodel);
+-void CreateEdges(IoModel* iomodel);
++void CreateFaces3d(IoModel* iomodel);
+ 
+ /*Connectivity*/
+ void CreateSingleNodeToElementConnectivity(IoModel* iomodel);
+Index: ../trunk-jpl/src/c/classes/IoModel.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/IoModel.h	(revision 17121)
++++ ../trunk-jpl/src/c/classes/IoModel.h	(revision 17122)
+@@ -39,6 +39,7 @@
+ 		int *faces;
+ 		int *edges;
+ 		int *elementtoedgeconnectivity;
++		int *elementtofaceconnectivity;
+ 		int *singlenodetoelementconnectivity;
+ 		int *numbernodetoelementconnectivity;
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17122-17123.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17122-17123.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17122-17123.diff	(revision 17802)
@@ -0,0 +1,66 @@
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h	(revision 17122)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h	(revision 17123)
+@@ -10,5 +10,8 @@
+ IssmDouble fx1(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+ IssmDouble fy1(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+ IssmDouble fz1(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
++IssmDouble fx2(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
++IssmDouble fy2(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
++IssmDouble fz2(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+ 
+ #endif //ifndef _SHARED_ANALYTICALS_H_
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical2.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical2.cpp	(revision 0)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical2.cpp	(revision 17123)
+@@ -0,0 +1,36 @@
++/*!\file fx.cpp
++ * \brief: analytical fonction for FS 
++ * test case for a cube with Dirichlet conditions on all faces
++ */
++
++#include <math.h>
++#include "../Numerics/types.h"
++#include "../Numerics/constants.h"
++
++IssmDouble fx2(IssmDouble x,IssmDouble y,IssmDouble z){   
++	IssmDouble p = 2.0;  
++	IssmDouble q = 2.0;   
++	IssmDouble functionx;
++
++	functionx = 2.*(cos(PI*p*x) - 1)*PI*PI*p*p*sin(PI*p*y) + 3*PI*PI*p*p*sin(PI*p*y)*cos(PI*p*x) + PI*q*sin(PI*q*y)*cos(PI*q*x);
++
++	return functionx;
++}
++IssmDouble fy2(IssmDouble x,IssmDouble y,IssmDouble z){   
++	IssmDouble p = 2.0;  
++	IssmDouble q = 2.0;   
++	IssmDouble functiony;
++
++	functiony = -(cos(PI*p*y) - 1)*PI*PI*p*p*sin(PI*p*x) + PI*q*sin(PI*q*x)*cos(PI*q*y);
++
++	return functiony;
++}
++IssmDouble fz2(IssmDouble x,IssmDouble y,IssmDouble z){   
++	IssmDouble p = 2.0;  
++	IssmDouble q = 2.0;   
++	IssmDouble functionz;
++
++	functionz = 2*PI*PI*p*p*sin(PI*p*x)*sin(PI*p*y);
++
++	return functionz;
++}
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17122)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17123)
+@@ -178,6 +178,7 @@
+ 					./shared/LatLong/Xy2llx.cpp\
+ 					./shared/FSanalyticals/fsanalyticals.h\
+ 					./shared/FSanalyticals/FSanalytical1.cpp\
++					./shared/FSanalyticals/FSanalytical2.cpp\
+ 					./shared/Enum/Enum.h\
+ 					./shared/Enum/EnumDefinitions.h\
+ 					./shared/Enum/EnumToStringx.cpp\
Index: issm/oecreview/Archive/16554-17801/ISSM-17123-17124.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17123-17124.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17123-17124.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical2.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical2.cpp	(revision 17123)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical2.cpp	(revision 17124)
+@@ -1,6 +1,6 @@
+ /*!\file fx.cpp
+  * \brief: analytical fonction for FS 
+- * test case for a cube with Dirichlet conditions on all faces
++ * test case for a cube with Dirichlet conditions on all faces and no variation in z
+  */
+ 
+ #include <math.h>
Index: issm/oecreview/Archive/16554-17801/ISSM-17124-17125.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17124-17125.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17124-17125.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp	(revision 17124)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp	(revision 17125)
+@@ -166,7 +166,7 @@
+ 	else{
+ 		_error_("mesh dimension not supported yet");
+ 	}
+-	int *element_face_connectivity = xNewZeroInit<int>(iomodel->numberofelements*elementnbf); /*format: [face1 face2 ...] */
++	int *element_face_connectivity = xNew<int>(iomodel->numberofelements*elementnbf); /*format: [face1 face2 ...] */
+ 
+ 	/*Initialize number of faces and list of vertex indices*/
+ 	nbf = 0;
Index: issm/oecreview/Archive/16554-17801/ISSM-17125-17126.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17125-17126.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17125-17126.diff	(revision 17802)
@@ -0,0 +1,19 @@
+Index: ../trunk-jpl/src/m/os/issmscpout.py
+===================================================================
+--- ../trunk-jpl/src/m/os/issmscpout.py	(revision 17125)
++++ ../trunk-jpl/src/m/os/issmscpout.py	(revision 17126)
+@@ -1,4 +1,4 @@
+-import socket
++from socket  import gethostname
+ import subprocess
+ import os
+ from MatlabFuncs import *
+@@ -11,7 +11,7 @@
+ 	"""
+ 
+ 	#get hostname
+-	hostname=socket.gethostname().lower().split('.')[0]
++	hostname=gethostname();
+ 
+ 	#if hostname and host are the same, do a simple copy
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17126-17127.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17126-17127.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17126-17127.diff	(revision 17802)
@@ -0,0 +1,38 @@
+Index: ../trunk-jpl/src/m/os/issmssh.py
+===================================================================
+--- ../trunk-jpl/src/m/os/issmssh.py	(revision 17126)
++++ ../trunk-jpl/src/m/os/issmssh.py	(revision 17127)
+@@ -1,4 +1,4 @@
+-import socket
++from socket import gethostname
+ import subprocess
+ import os
+ from MatlabFuncs import *
+@@ -12,7 +12,7 @@
+ 	"""
+ 
+ 	#first get hostname 
+-	hostname=socket.gethostname().lower().split('.')[0]
++	hostname=gethostname()
+ 
+ 	#if same as host, just run the command. 
+ 	if strcmpi(host,hostname):
+Index: ../trunk-jpl/src/m/os/issmscpin.py
+===================================================================
+--- ../trunk-jpl/src/m/os/issmscpin.py	(revision 17126)
++++ ../trunk-jpl/src/m/os/issmscpin.py	(revision 17127)
+@@ -1,4 +1,4 @@
+-import socket
++from socket import gethostname
+ import subprocess
+ import os
+ import shutil
+@@ -12,7 +12,7 @@
+ 	"""
+ 
+ 	#first get hostname
+-	hostname=socket.gethostname().lower().split('.')[0]
++	hostname=gethostname()
+ 
+ 	#first be sure packages are not in the current directory, this could conflict with pscp on windows. 
+ 	#remove warnings in case the files do not exist
Index: issm/oecreview/Archive/16554-17801/ISSM-17127-17128.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17127-17128.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17127-17128.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17127)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17128)
+@@ -2721,7 +2721,6 @@
+ #ifdef FSANALYTICAL
+ ElementVector* StressbalanceAnalysis::CreatePVectorFS(Element* element){/*{{{*/
+ 
+-	bool        analytical_solution=0;
+ 	int         i,meshtype,dim;
+ 	IssmDouble  x_coord,y_coord,z_coord;
+ 	IssmDouble  Jdet,forcex,forcey,forcez;
Index: issm/oecreview/Archive/16554-17801/ISSM-17128-17129.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17128-17129.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17128-17129.diff	(revision 17802)
@@ -0,0 +1,54 @@
+Index: ../trunk-jpl/src/wrappers/python/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/wrappers/python/Makefile.am	(revision 17128)
++++ ../trunk-jpl/src/wrappers/python/Makefile.am	(revision 17129)
+@@ -53,6 +53,7 @@
+ 						EnumToString.la\
+ 						InterpFromMeshToMesh2d.la\
+ 						InterpFromGridToMesh.la\
++						InterpFromMeshToGrid.la\
+ 						IssmConfig.la\
+ 						MeshProfileIntersection.la\
+ 						NodeConnectivity.la\
+@@ -146,6 +147,11 @@
+ 												../InterpFromGridToMesh/InterpFromGridToMesh.h
+ InterpFromGridToMesh_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(MULTITHREADINGLIB) $(GSLLIB)
+ 
++InterpFromMeshToGrid_la_SOURCES = ../InterpFromMeshToGrid/InterpFromMeshToGrid.cpp\
++												../InterpFromMeshToGrid/InterpFromMeshToGrid.h
++InterpFromMeshToGrid_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(MULTITHREADINGLIB) $(GSLLIB)
++
++
+ IssmConfig_la_SOURCES = ../IssmConfig/IssmConfig.cpp\
+ 											 ../IssmConfig/IssmConfig.h
+ IssmConfig_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+Index: ../trunk-jpl/src/wrappers/InterpFromMeshToGrid/InterpFromMeshToGrid.h
+===================================================================
+--- ../trunk-jpl/src/wrappers/InterpFromMeshToGrid/InterpFromMeshToGrid.h	(revision 17128)
++++ ../trunk-jpl/src/wrappers/InterpFromMeshToGrid/InterpFromMeshToGrid.h	(revision 17129)
+@@ -18,8 +18,11 @@
+ 
+ #include "../bindings.h"
+ #include "../../c/main/globals.h"
++#include "../../c/toolkits/toolkits.h"
+ #include "../../c/modules/modules.h"
+ #include "../../c/shared/shared.h"
++#include "../../c/shared/io/io.h"
++#include "../../c/shared/Enum/Enum.h"
+ 
+ #undef __FUNCT__ 
+ #define __FUNCT__  "InterpFromMeshToGrid"
+Index: ../trunk-jpl/src/wrappers/InterpFromMeshToGrid/InterpFromMeshToGrid.cpp
+===================================================================
+--- ../trunk-jpl/src/wrappers/InterpFromMeshToGrid/InterpFromMeshToGrid.cpp	(revision 17128)
++++ ../trunk-jpl/src/wrappers/InterpFromMeshToGrid/InterpFromMeshToGrid.cpp	(revision 17129)
+@@ -45,7 +45,9 @@
+ 	MODULEBOOT();
+ 
+ 	/*checks on arguments on the matlab side: */
++	#ifdef _HAVE_MATLAB_MODULES_
+ 	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&InterpFromMeshToGridUsage);
++	#endif
+ 
+ 	/*Input datasets: */
+ 	FetchData(&index,&nel,NULL,INDEX);
Index: issm/oecreview/Archive/16554-17801/ISSM-17129-17130.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17129-17130.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17129-17130.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17129)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17130)
+@@ -562,7 +562,7 @@
+ 						}
+ 
+ 						/*Gather from all cpus*/
+-						MPI_Allreduce((void*)values,(void*)allvalues,nbe*nodesperelement,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD);
++						ISSM_MPI_Allreduce((void*)values,(void*)allvalues,nbe*nodesperelement,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD);
+ 						xDelete<IssmDouble>(values);
+ 
+ 						if(save_results)results->AddResult(new GenericExternalResult<IssmDouble*>(results->Size()+1,output_enum,allvalues,nbe,nodesperelement,step,time));
Index: issm/oecreview/Archive/16554-17801/ISSM-17130-17131.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17130-17131.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17130-17131.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/jenkins/linux64_murdo
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo	(revision 17130)
++++ ../trunk-jpl/jenkins/linux64_murdo	(revision 17131)
+@@ -120,5 +120,5 @@
+ #as follows: runme($MATLAB_NROPTIONS). The options must be understandable
+ #by Matlab and runme.m
+ #ex: "'id',[101 102 103]"
+-MATLAB_NROPTIONS=""
+-PYTHON_NROPTIONS=""
++MATLAB_NROPTIONS="'exclude',[514,701,702]"
++PYTHON_NROPTIONS="--exclude=119"
Index: issm/oecreview/Archive/16554-17801/ISSM-17131-17132.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17131-17132.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17131-17132.diff	(revision 17802)
@@ -0,0 +1,18 @@
+Index: ../trunk-jpl/externalpackages/petsc/install-3.4-acenet.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/petsc/install-3.4-acenet.sh	(revision 17131)
++++ ../trunk-jpl/externalpackages/petsc/install-3.4-acenet.sh	(revision 17132)
+@@ -23,12 +23,10 @@
+  --with-shared-libraries=1 \
+  --known-mpi-shared-libraries=1 \
+  --with-mpi-dir=$OPENMPI \
++ --with-blas-lapack-dir=/usr/local/intel/composer_xe_2011_sp1.13.367/mkl/ \
+  --download-scalapack=yes \
+- --download-blacs=yes \
+  --download-mumps=yes \
+  --download-metis=yes \
+- --download-blas=yes \
+- --download-f-blas-lapack=yes \
+  --download-parmetis=yes 
+ 
+ make
Index: issm/oecreview/Archive/16554-17801/ISSM-17132-17133.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17132-17133.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17132-17133.diff	(revision 17802)
@@ -0,0 +1,25 @@
+Index: ../trunk-jpl/m4/issm_options.m4
+===================================================================
+--- ../trunk-jpl/m4/issm_options.m4	(revision 17132)
++++ ../trunk-jpl/m4/issm_options.m4	(revision 17133)
+@@ -117,6 +117,11 @@
+ 			export CXX=icpc
+ 			export CXXFLAGS=" -O3 -D_INTEL_LINUX_ "
+ 			export CFLAGS=" -O3 -D_INTEL_LINUX_ "
++		elif test $VENDOR = intel-acenet; then
++			export CC=icc
++			export CXX=icpc
++			export CXXFLAGS=" -D_INTEL_LINUX_ "
++			export CFLAGS=" -D_INTEL_LINUX_ "
+ 		elif test $VENDOR = intel-pleiades-gcc; then
+ 			export CC=gcc
+ 			export CXX=g++
+@@ -1070,6 +1075,8 @@
+ 		MKLINCL=""
+ 		if test x$VENDOR = xintel-pleiades; then
+ 			MKLLIB=-L"$MKL_ROOT -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread"
++		elif test x$VENDOR = xintel-acenet; then
++			MKLLIB=-L"$MKL_ROOT -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm"
+ 		else
+ 			MKLLIB=-L"$MKL_ROOT -lmkl -lmkl_lapack -lmkl_scalapack_ilp64 -lmkl_blacs_sgimpt_ilp64 -lguide -lpthread"
+ 		fi
Index: issm/oecreview/Archive/16554-17801/ISSM-17133-17134.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17133-17134.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17133-17134.diff	(revision 17802)
@@ -0,0 +1,11 @@
+Index: ../trunk-jpl/jenkins/linux64_murdo
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo	(revision 17133)
++++ ../trunk-jpl/jenkins/linux64_murdo	(revision 17134)
+@@ -120,5 +120,5 @@
+ #as follows: runme($MATLAB_NROPTIONS). The options must be understandable
+ #by Matlab and runme.m
+ #ex: "'id',[101 102 103]"
+-MATLAB_NROPTIONS="'exclude',[514,701,702]"
++MATLAB_NROPTIONS="'exclude',[119,514,701,702]"
+ PYTHON_NROPTIONS="--exclude=119"
Index: issm/oecreview/Archive/16554-17801/ISSM-17134-17135.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17134-17135.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17134-17135.diff	(revision 17802)
@@ -0,0 +1,283 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp	(revision 17134)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp	(revision 17135)
+@@ -159,9 +159,9 @@
+ 		elementfaces_markers[2] = 2;
+ 		elementfaces_markers[3] = 2;
+ 		elementfaces_markers[4] = 2;
+-		elementfaces[cols*2+0] = 4; elementfaces[cols*2+1] = 0;  elementfaces[cols*2+2] = 1; elementfaces[cols*2+3] = 4;  elementfaces[cols*2+4] = 3;
+-		elementfaces[cols*3+0] = 4; elementfaces[cols*3+1] = 1;  elementfaces[cols*3+2] = 2; elementfaces[cols*3+3] = 5;  elementfaces[cols*3+4] = 4;
+-		elementfaces[cols*4+0] = 4; elementfaces[cols*4+1] = 2;  elementfaces[cols*4+2] = 0; elementfaces[cols*4+3] = 3;  elementfaces[cols*4+4] = 5;
++		elementfaces[cols*2+0] = 4; elementfaces[cols*2+1] = 1;  elementfaces[cols*2+2] = 2; elementfaces[cols*2+3] = 5;  elementfaces[cols*2+4] = 4;
++		elementfaces[cols*3+0] = 4; elementfaces[cols*3+1] = 2;  elementfaces[cols*3+2] = 0; elementfaces[cols*3+3] = 3;  elementfaces[cols*3+4] = 5;
++		elementfaces[cols*4+0] = 4; elementfaces[cols*4+1] = 0;  elementfaces[cols*4+2] = 1; elementfaces[cols*4+3] = 4;  elementfaces[cols*4+4] = 3;
+ 	}
+ 	else{
+ 		_error_("mesh dimension not supported yet");
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp	(revision 17134)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp	(revision 17135)
+@@ -51,9 +51,9 @@
+ 		elementedges[2*3+0] = 1; elementedges[2*3+1] = 2; elementedges_markers[3] = 1;
+ 		elementedges[2*4+0] = 2; elementedges[2*4+1] = 0; elementedges_markers[4] = 1;
+ 		elementedges[2*5+0] = 0; elementedges[2*5+1] = 1; elementedges_markers[5] = 1;
+-		elementedges[2*6+0] = 4; elementedges[2*6+1] = 5; elementedges_markers[6] = 3;
+-		elementedges[2*7+0] = 5; elementedges[2*7+1] = 3; elementedges_markers[7] = 3;
+-		elementedges[2*8+0] = 3; elementedges[2*8+1] = 4; elementedges_markers[8] = 3;
++		elementedges[2*6+0] = 4; elementedges[2*6+1] = 5; elementedges_markers[6] = 1;
++		elementedges[2*7+0] = 5; elementedges[2*7+1] = 3; elementedges_markers[7] = 1;
++		elementedges[2*8+0] = 3; elementedges[2*8+1] = 4; elementedges_markers[8] = 1;
+ 	}
+ 	else{
+ 		_error_("mesh dimension not supported yet");
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17134)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17135)
+@@ -13,6 +13,7 @@
+ 	/*Intermediaries*/
+ 	int   i,j,counter,vnodes,lid=0;
+ 	int   id0 = iomodel->nodecounter;
++	bool *my_faces = NULL;
+ 	bool *my_edges = NULL;
+ 	bool *my_nodes = NULL;
+ 	Node *node     = NULL;
+@@ -143,6 +144,7 @@
+ 			break;
+ 		case P2xP4Enum:
+ 			EdgesPartitioning(&my_edges,iomodel);
++			FacesPartitioning(&my_faces,iomodel);
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+ 					nodes->AddObject(new Node(id0+i+1,i,lid++,i,iomodel,analysis,approximation));
+@@ -152,34 +154,41 @@
+ 			for(i=0;i<iomodel->numberofedges;i++){
+ 				if(iomodel->edges[i*3+2]==2){/*Vertical edges*/
+ 					if(my_edges[i]){
+-						node = new Node(id0+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
++						node = new Node(id0+iomodel->numberofvertices+3*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
+ 						nodes->AddObject(node);
+-						node = new Node(id0+iomodel->numberofvertices+4*i+2,counter+2,lid++,0,iomodel,analysis,approximation);
++						node = new Node(id0+iomodel->numberofvertices+3*i+2,counter+2,lid++,0,iomodel,analysis,approximation);
+ 						nodes->AddObject(node);
+-						node = new Node(id0+iomodel->numberofvertices+4*i+3,counter+3,lid++,0,iomodel,analysis,approximation);
++						node = new Node(id0+iomodel->numberofvertices+3*i+3,counter+3,lid++,0,iomodel,analysis,approximation);
+ 						nodes->AddObject(node);
+ 					}
+ 					counter=counter+3;
+ 				}
+-				else if(iomodel->edges[i*3+2]==1){/*Basal edges*/
++				else if(iomodel->edges[i*3+2]==1){/*Horizontal edges*/
+ 					if(my_edges[i]){
+-						node = new Node(id0+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
++						node = new Node(id0+iomodel->numberofvertices+3*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
+ 						nodes->AddObject(node);
+-						node = new Node(id0+iomodel->numberofvertices+4*i+2,counter+2,lid++,0,iomodel,analysis,approximation);
++					}
++					counter=counter+1;
++				}
++				else{
++					_error_("not supported");
++				}
++			}
++			id0 = id0+iomodel->numberofvertices+3*iomodel->numberofedges;
++			for(i=0;i<iomodel->numberoffaces;i++){
++				if(iomodel->faces[i*6+5]==2){/*Vertical quads*/
++					if(my_faces[i]){
++						node = new Node(id0+3*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
+ 						nodes->AddObject(node);
+-						node = new Node(id0+iomodel->numberofvertices+4*i+3,counter+3,lid++,0,iomodel,analysis,approximation);
++						node = new Node(id0+3*i+2,counter+2,lid++,0,iomodel,analysis,approximation);
+ 						nodes->AddObject(node);
+-						node = new Node(id0+iomodel->numberofvertices+4*i+4,counter+4,lid++,0,iomodel,analysis,approximation);
++						node = new Node(id0+3*i+3,counter+3,lid++,0,iomodel,analysis,approximation);
+ 						nodes->AddObject(node);
+ 					}
+-					counter=counter+4;
++					counter=counter+3;
+ 				}
+-				else if(iomodel->edges[i*3+2]==3){/*Top edges*/
+-					if(my_edges[i]){
+-						node = new Node(id0+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
+-						nodes->AddObject(node);
+-					}
+-					counter=counter+1;
++				else if(iomodel->faces[i*6+5]==1){/*Triangular base/top*/
++					/*Nothing*/
+ 				}
+ 				else{
+ 					_error_("not supported");
+@@ -290,6 +299,7 @@
+ 		case OneLayerP4zEnum:
+ 			_assert_(approximation==FSApproximationEnum);
+ 			EdgesPartitioning(&my_edges,iomodel);
++			FacesPartitioning(&my_faces,iomodel);
+ 			/*P2xP4 velocity*/
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+@@ -359,6 +369,7 @@
+ 	}
+ 
+ 	/*Clean up*/
++	xDelete<bool>(my_faces);
+ 	xDelete<bool>(my_edges);
+ 	xDelete<bool>(my_nodes);
+ }
+Index: ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17134)
++++ ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17135)
+@@ -38,9 +38,10 @@
+ 	IssmDouble *values           = NULL;
+ 	bool        spcpresent       = false;
+ 
+-	/*P2 finite elements*/
+-	int   v1,v2;
++	/*Higher-order finite elements*/
++	int   v1,v2,v3,v4;
+ 	bool *my_edges = NULL;
++	bool *my_faces = NULL;
+ 
+ 	switch(finite_element){
+ 		case P1Enum: 
+@@ -71,6 +72,7 @@
+ 			break;
+ 		case P2xP4Enum:
+ 			EdgesPartitioning(&my_edges,iomodel);
++			FacesPartitioning(&my_faces,iomodel);
+ 			break;
+ 		default:
+ 			_error_("Finite element "<<EnumToStringx(finite_element)<<" not supported yet");
+@@ -125,41 +127,41 @@
+ 							v1 = iomodel->edges[3*i+0]-1;
+ 							v2 = iomodel->edges[3*i+1]-1;
+ 							if(!xIsNan<IssmDouble>(spcdata[v1]) && !xIsNan<IssmDouble>(spcdata[v2])){
+-								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+4*i+1,
++								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+3*i+1,
+ 												dof,1./2.*spcdata[v1]+1./2.*spcdata[v2],analysis_type));
+-								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+2,iomodel->nodecounter+iomodel->numberofvertices+4*i+2,
++								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+2,iomodel->nodecounter+iomodel->numberofvertices+3*i+2,
+ 												dof,1./2.*spcdata[v1]+1./2.*spcdata[v2],analysis_type));
+-								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+3,iomodel->nodecounter+iomodel->numberofvertices+4*i+3,
++								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+3,iomodel->nodecounter+iomodel->numberofvertices+3*i+3,
+ 												dof,1./2.*spcdata[v1]+1./2.*spcdata[v2],analysis_type));
+ 								count=count+3;
+ 							}
+ 						}
+ 					}
+-					if(iomodel->edges[i*3+2]==1){/*Basal edges*/
++					if(iomodel->edges[i*3+2]==1){/*Horizontal edges*/
+ 						if(my_edges[i]){
+ 							v1 = iomodel->edges[3*i+0]-1;
+ 							v2 = iomodel->edges[3*i+1]-1;
+ 							if(!xIsNan<IssmDouble>(spcdata[v1]) && !xIsNan<IssmDouble>(spcdata[v2])){
+-								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+4*i+1,
++								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+3*i+1,
+ 												dof,1./2.*spcdata[v1]+1./2.*spcdata[v2],analysis_type));
+-								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+2,iomodel->nodecounter+iomodel->numberofvertices+4*i+2,
+-												dof,1./2.*spcdata[v1]+1./2.*spcdata[v2],analysis_type));
+-								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+3,iomodel->nodecounter+iomodel->numberofvertices+4*i+3,
+-												dof,1./2.*spcdata[v1]+1./2.*spcdata[v2],analysis_type));
+-								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+4,iomodel->nodecounter+iomodel->numberofvertices+4*i+4,
+-												dof,1./2.*spcdata[v1]+1./2.*spcdata[v2],analysis_type));
+-								count=count+4;
++								count=count+1;
+ 							}
+ 						}
+ 					}
+-					if(iomodel->edges[i*3+2]==3){/*Top edges*/
+-						if(my_edges[i]){
+-							v1 = iomodel->edges[3*i+0]-1;
+-							v2 = iomodel->edges[3*i+1]-1;
++				}
++				for(i=0;i<iomodel->numberoffaces;i++){
++					if(iomodel->faces[i*6+5]==2){/*Vertical quads*/
++						if(my_faces[i]){
++							v1 = iomodel->faces[6*i+0]-1;
++							v2 = iomodel->faces[6*i+1]-1;
+ 							if(!xIsNan<IssmDouble>(spcdata[v1]) && !xIsNan<IssmDouble>(spcdata[v2])){
+-								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+4*i+1,
++								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*i+1,
+ 												dof,1./2.*spcdata[v1]+1./2.*spcdata[v2],analysis_type));
+-								count=count+1;
++								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+2,iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*i+2,
++												dof,1./2.*spcdata[v1]+1./2.*spcdata[v2],analysis_type));
++								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+3,iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*i+3,
++												dof,1./2.*spcdata[v1]+1./2.*spcdata[v2],analysis_type));
++								count=count+3;
+ 							}
+ 						}
+ 					}
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17134)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17135)
+@@ -2833,36 +2833,36 @@
+ 		case P2xP4Enum:
+ 			numnodes         = 30;
+ 			penta_node_ids   = xNew<int>(numnodes);
+-			penta_node_ids[ 0]=iomodel->nodecounter+iomodel->elements[6*index+0];
+-			penta_node_ids[ 1]=iomodel->nodecounter+iomodel->elements[6*index+1];
+-			penta_node_ids[ 2]=iomodel->nodecounter+iomodel->elements[6*index+2];
+-			penta_node_ids[ 3]=iomodel->nodecounter+iomodel->elements[6*index+3];
+-			penta_node_ids[ 4]=iomodel->nodecounter+iomodel->elements[6*index+4];
+-			penta_node_ids[ 5]=iomodel->nodecounter+iomodel->elements[6*index+5];
+-			penta_node_ids[ 6]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+0]+1;
+-			penta_node_ids[ 7]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+1]+1;
+-			penta_node_ids[ 8]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+2]+1;
+-			penta_node_ids[ 9]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+3]+1;
+-			penta_node_ids[10]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+4]+1;
+-			penta_node_ids[11]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+5]+1;
+-			penta_node_ids[12]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+6]+1;
+-			penta_node_ids[13]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+7]+1;
+-			penta_node_ids[14]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+8]+1;
+-			penta_node_ids[15]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+0]+2;
+-			penta_node_ids[16]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+1]+2;
+-			penta_node_ids[17]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+2]+2;
+-			penta_node_ids[18]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+0]+3;
+-			penta_node_ids[19]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+1]+3;
+-			penta_node_ids[20]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+2]+3;
+-			penta_node_ids[21]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+3]+2;
+-			penta_node_ids[22]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+4]+2;
+-			penta_node_ids[23]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+5]+2;
+-			penta_node_ids[24]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+3]+3;
+-			penta_node_ids[25]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+4]+3;
+-			penta_node_ids[26]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+5]+3;
+-			penta_node_ids[27]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+3]+4;
+-			penta_node_ids[28]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+4]+4;
+-			penta_node_ids[29]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+5]+4;
++			penta_node_ids[ 0]=iomodel->nodecounter+iomodel->elements[6*index+0]; /*Vertex 1*/
++			penta_node_ids[ 1]=iomodel->nodecounter+iomodel->elements[6*index+1]; /*Vertex 2*/
++			penta_node_ids[ 2]=iomodel->nodecounter+iomodel->elements[6*index+2]; /*Vertex 3*/
++			penta_node_ids[ 3]=iomodel->nodecounter+iomodel->elements[6*index+3]; /*Vertex 4*/
++			penta_node_ids[ 4]=iomodel->nodecounter+iomodel->elements[6*index+4]; /*Vertex 5*/
++			penta_node_ids[ 5]=iomodel->nodecounter+iomodel->elements[6*index+5]; /*Vertex 6*/
++			penta_node_ids[ 6]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+0]+1; /*mid vertical edge 1*/
++			penta_node_ids[ 7]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+1]+1; /*mid vertical edge 2*/
++			penta_node_ids[ 8]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+2]+1; /*mid vertical edge 3*/
++			penta_node_ids[ 9]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+3]+1; /*mid basal edge 1*/
++			penta_node_ids[10]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+4]+1; /*mid basal edge 2*/
++			penta_node_ids[11]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+5]+1; /*mid basal edge 3*/
++			penta_node_ids[12]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+6]+1; /*mid top edge 1*/
++			penta_node_ids[13]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+7]+1; /*mid top edge 2*/
++			penta_node_ids[14]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+8]+1; /*mid top edge 3*/
++			penta_node_ids[15]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+0]+2; /* 1/4 vertical edge 1*/
++			penta_node_ids[16]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+1]+2; /* 1/4 vertical edge 2*/
++			penta_node_ids[17]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+2]+2; /* 1/4 vertical edge 3*/
++			penta_node_ids[18]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+0]+3; /* 2/4 vertical edge 1*/
++			penta_node_ids[19]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+1]+3; /* 2/4 vertical edge 2*/
++			penta_node_ids[20]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+2]+3; /* 2/4 vertical edge 3*/
++			penta_node_ids[21]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->elementtofaceconnectivity[5*index+2]+1; /* 1/4 vertical face 1*/
++			penta_node_ids[22]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->elementtofaceconnectivity[5*index+3]+1; /* 1/4 vertical face 2*/
++			penta_node_ids[23]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->elementtofaceconnectivity[5*index+4]+1; /* 1/4 vertical face 3*/
++			penta_node_ids[24]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->elementtofaceconnectivity[5*index+2]+2; /* 2/4 vertical face 1*/
++			penta_node_ids[25]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->elementtofaceconnectivity[5*index+3]+2; /* 2/4 vertical face 2*/
++			penta_node_ids[26]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->elementtofaceconnectivity[5*index+4]+2; /* 2/4 vertical face 3*/
++			penta_node_ids[27]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->elementtofaceconnectivity[5*index+2]+3; /* 3/4 vertical face 1*/
++			penta_node_ids[28]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->elementtofaceconnectivity[5*index+3]+3; /* 3/4 vertical face 2*/
++			penta_node_ids[29]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->elementtofaceconnectivity[5*index+4]+3; /* 3/4 vertical face 3*/
+ 			break;
+ 		case P2Enum:
+ 			numnodes         = 15;
Index: issm/oecreview/Archive/16554-17801/ISSM-17135-17136.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17135-17136.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17135-17136.diff	(revision 17802)
@@ -0,0 +1,60 @@
+Index: ../trunk-jpl/test/NightlyRun/test455.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test455.py	(revision 17135)
++++ ../trunk-jpl/test/NightlyRun/test455.py	(revision 17136)
+@@ -18,7 +18,7 @@
+ field_names=[]
+ field_tolerances=[]
+ field_values=[]
+-for i in ['P1bubble','P1bubblecondensed','P1xP2','P2xP1','P2']:
++for i in ['P1bubble','P1bubblecondensed','P1xP2','P2xP1','P2','P1xP3','P2xP4']:
+ 	md.flowequation.fe_HO=i
+ 	md=solve(md,StressbalanceSolutionEnum())
+ 	field_names     =field_names+['Vx'+i,'Vy'+i,'Vz'+i,'Vel'+i,'Pressure'+i]
+Index: ../trunk-jpl/test/NightlyRun/test455.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test455.m	(revision 17135)
++++ ../trunk-jpl/test/NightlyRun/test455.m	(revision 17136)
+@@ -8,7 +8,7 @@
+ field_names={};
+ field_tolerances={};
+ field_values={};
+-for i={'P1bubble','P1bubblecondensed','P1xP2','P2xP1','P2'}
++for i={'P1bubble','P1bubblecondensed','P1xP2','P2xP1','P2','P1xP3','P2xP4'}
+ 	md.flowequation.fe_HO=i{1};
+ 	md=solve(md,StressbalanceSolutionEnum());
+ 	field_names     ={field_names{:},['Vx' i{1}],['Vy' i{1}],['Vz' i{1}],['Vel' i{1}],['Pressure' i{1}]};
+Index: ../trunk-jpl/test/NightlyRun/test285.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test285.m	(revision 17135)
++++ ../trunk-jpl/test/NightlyRun/test285.m	(revision 17136)
+@@ -8,7 +8,7 @@
+ field_names={};
+ field_tolerances={};
+ field_values={};
+-for i={'P1bubble','P1bubblecondensed','P1xP2','P2xP1','P2'}
++for i={'P1bubble','P1bubblecondensed','P1xP2','P2xP1','P2','P1xP3','P2xP4'}
+ 	md.flowequation.fe_HO=i{1};
+ 	md=solve(md,StressbalanceSolutionEnum());
+ 	field_names     ={field_names{:},['Vx' i{1}],['Vy' i{1}],['Vz' i{1}],['Vel' i{1}],['Pressure' i{1}]};
+Index: ../trunk-jpl/test/NightlyRun/test285.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test285.py	(revision 17135)
++++ ../trunk-jpl/test/NightlyRun/test285.py	(revision 17136)
+@@ -18,7 +18,7 @@
+ field_names=[]
+ field_tolerances=[]
+ field_values=[]
+-for i in ['P1bubble','P1bubblecondensed','P1xP2','P2xP1','P2']:
++for i in ['P1bubble','P1bubblecondensed','P1xP2','P2xP1','P2','P1xP3','P2xP4']:
+ 	md.flowequation.fe_HO=i
+ 	md=solve(md,StressbalanceSolutionEnum())
+ 	field_names     =field_names+['Vx'+i,'Vy'+i,'Vz'+i,'Vel'+i,'Pressure'+i]
+Index: ../trunk-jpl/test/Archives/Archive455.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive285.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17136-17137.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17136-17137.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17136-17137.diff	(revision 17802)
@@ -0,0 +1,166 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17136)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17137)
+@@ -310,41 +310,49 @@
+ 			for(i=0;i<iomodel->numberofedges;i++){
+ 				if(iomodel->edges[i*3+2]==2){/*Vertical edges*/
+ 					if(my_edges[i]){
+-						node = new Node(id0+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,FSvelocityEnum);
++						node = new Node(id0+iomodel->numberofvertices+3*i+1,counter+1,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 						nodes->AddObject(node);
+-						node = new Node(id0+iomodel->numberofvertices+4*i+2,counter+2,lid++,0,iomodel,analysis,FSvelocityEnum);
++						node = new Node(id0+iomodel->numberofvertices+3*i+2,counter+2,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 						nodes->AddObject(node);
+-						node = new Node(id0+iomodel->numberofvertices+4*i+3,counter+3,lid++,0,iomodel,analysis,FSvelocityEnum);
++						node = new Node(id0+iomodel->numberofvertices+3*i+3,counter+3,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 						nodes->AddObject(node);
+ 					}
+ 					counter=counter+3;
+ 				}
+-				else if(iomodel->edges[i*3+2]==1){/*Basal edges*/
++				else if(iomodel->edges[i*3+2]==1){/*Horizontal edges*/
+ 					if(my_edges[i]){
+-						node = new Node(id0+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,FSvelocityEnum);
++						node = new Node(id0+iomodel->numberofvertices+3*i+1,counter+1,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 						nodes->AddObject(node);
+-						node = new Node(id0+iomodel->numberofvertices+4*i+2,counter+2,lid++,0,iomodel,analysis,FSvelocityEnum);
++					}
++					counter=counter+1;
++				}
++				else{
++					_error_("not supported");
++				}
++			}
++			id0 = id0+iomodel->numberofvertices+3*iomodel->numberofedges;
++			for(i=0;i<iomodel->numberoffaces;i++){
++				if(iomodel->faces[i*6+5]==2){/*Vertical quads*/
++					if(my_faces[i]){
++						node = new Node(id0+3*i+1,counter+1,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 						nodes->AddObject(node);
+-						node = new Node(id0+iomodel->numberofvertices+4*i+3,counter+3,lid++,0,iomodel,analysis,FSvelocityEnum);
++						node = new Node(id0+3*i+2,counter+2,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 						nodes->AddObject(node);
+-						node = new Node(id0+iomodel->numberofvertices+4*i+4,counter+4,lid++,0,iomodel,analysis,FSvelocityEnum);
++						node = new Node(id0+3*i+3,counter+3,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 						nodes->AddObject(node);
+ 					}
+-					counter=counter+4;
++					counter=counter+3;
+ 				}
+-				else if(iomodel->edges[i*3+2]==3){/*Top edges*/
+-					if(my_edges[i]){
+-						node = new Node(id0+iomodel->numberofvertices+4*i+1,counter+1,lid++,0,iomodel,analysis,FSvelocityEnum);
+-						nodes->AddObject(node);
+-					}
+-					counter=counter+1;
++				else if(iomodel->faces[i*6+5]==1){/*Triangular base/top*/
++					/*Nothing*/
+ 				}
+ 				else{
+ 					_error_("not supported");
+ 				}
+ 			}
++
+ 			/*P1xP3 pressure*/
+-			vnodes = id0+iomodel->numberofvertices+4*iomodel->numberofedges;
++			vnodes = id0+3*iomodel->numberoffaces;
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+ 					nodes->AddObject(new Node(vnodes+i+1,counter+1,lid++,i,iomodel,analysis,FSpressureEnum));
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17136)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17137)
+@@ -2947,49 +2947,49 @@
+ 		case OneLayerP4zEnum:
+ 			numnodes         = 30+12;
+ 			penta_node_ids   = xNew<int>(numnodes);
+-			penta_node_ids[ 0]=iomodel->nodecounter+iomodel->elements[6*index+0];
+-			penta_node_ids[ 1]=iomodel->nodecounter+iomodel->elements[6*index+1];
+-			penta_node_ids[ 2]=iomodel->nodecounter+iomodel->elements[6*index+2];
+-			penta_node_ids[ 3]=iomodel->nodecounter+iomodel->elements[6*index+3];
+-			penta_node_ids[ 4]=iomodel->nodecounter+iomodel->elements[6*index+4];
+-			penta_node_ids[ 5]=iomodel->nodecounter+iomodel->elements[6*index+5];
+-			penta_node_ids[ 6]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+0]+1;
+-			penta_node_ids[ 7]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+1]+1;
+-			penta_node_ids[ 8]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+2]+1;
+-			penta_node_ids[ 9]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+3]+1;
+-			penta_node_ids[10]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+4]+1;
+-			penta_node_ids[11]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+5]+1;
+-			penta_node_ids[12]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+6]+1;
+-			penta_node_ids[13]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+7]+1;
+-			penta_node_ids[14]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+8]+1;
+-			penta_node_ids[15]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+0]+2;
+-			penta_node_ids[16]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+1]+2;
+-			penta_node_ids[17]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+2]+2;
+-			penta_node_ids[18]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+0]+3;
+-			penta_node_ids[19]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+1]+3;
+-			penta_node_ids[20]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+2]+3;
+-			penta_node_ids[21]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+3]+2;
+-			penta_node_ids[22]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+4]+2;
+-			penta_node_ids[23]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+5]+2;
+-			penta_node_ids[24]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+3]+3;
+-			penta_node_ids[25]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+4]+3;
+-			penta_node_ids[26]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+5]+3;
+-			penta_node_ids[27]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+3]+4;
+-			penta_node_ids[28]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+4]+4;
+-			penta_node_ids[29]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->elementtoedgeconnectivity[9*index+5]+4;
++			penta_node_ids[ 0]=iomodel->nodecounter+iomodel->elements[6*index+0]; /*Vertex 1*/
++			penta_node_ids[ 1]=iomodel->nodecounter+iomodel->elements[6*index+1]; /*Vertex 2*/
++			penta_node_ids[ 2]=iomodel->nodecounter+iomodel->elements[6*index+2]; /*Vertex 3*/
++			penta_node_ids[ 3]=iomodel->nodecounter+iomodel->elements[6*index+3]; /*Vertex 4*/
++			penta_node_ids[ 4]=iomodel->nodecounter+iomodel->elements[6*index+4]; /*Vertex 5*/
++			penta_node_ids[ 5]=iomodel->nodecounter+iomodel->elements[6*index+5]; /*Vertex 6*/
++			penta_node_ids[ 6]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+0]+1; /*mid vertical edge 1*/
++			penta_node_ids[ 7]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+1]+1; /*mid vertical edge 2*/
++			penta_node_ids[ 8]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+2]+1; /*mid vertical edge 3*/
++			penta_node_ids[ 9]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+3]+1; /*mid basal edge 1*/
++			penta_node_ids[10]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+4]+1; /*mid basal edge 2*/
++			penta_node_ids[11]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+5]+1; /*mid basal edge 3*/
++			penta_node_ids[12]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+6]+1; /*mid top edge 1*/
++			penta_node_ids[13]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+7]+1; /*mid top edge 2*/
++			penta_node_ids[14]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+8]+1; /*mid top edge 3*/
++			penta_node_ids[15]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+0]+2; /* 1/4 vertical edge 1*/
++			penta_node_ids[16]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+1]+2; /* 1/4 vertical edge 2*/
++			penta_node_ids[17]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+2]+2; /* 1/4 vertical edge 3*/
++			penta_node_ids[18]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+0]+3; /* 2/4 vertical edge 1*/
++			penta_node_ids[19]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+1]+3; /* 2/4 vertical edge 2*/
++			penta_node_ids[20]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->elementtoedgeconnectivity[9*index+2]+3; /* 2/4 vertical edge 3*/
++			penta_node_ids[21]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->elementtofaceconnectivity[5*index+2]+1; /* 1/4 vertical face 1*/
++			penta_node_ids[22]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->elementtofaceconnectivity[5*index+3]+1; /* 1/4 vertical face 2*/
++			penta_node_ids[23]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->elementtofaceconnectivity[5*index+4]+1; /* 1/4 vertical face 3*/
++			penta_node_ids[24]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->elementtofaceconnectivity[5*index+2]+2; /* 2/4 vertical face 1*/
++			penta_node_ids[25]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->elementtofaceconnectivity[5*index+3]+2; /* 2/4 vertical face 2*/
++			penta_node_ids[26]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->elementtofaceconnectivity[5*index+4]+2; /* 2/4 vertical face 3*/
++			penta_node_ids[27]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->elementtofaceconnectivity[5*index+2]+3; /* 3/4 vertical face 1*/
++			penta_node_ids[28]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->elementtofaceconnectivity[5*index+3]+3; /* 3/4 vertical face 2*/
++			penta_node_ids[29]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->elementtofaceconnectivity[5*index+4]+3; /* 3/4 vertical face 3*/
+ 
+-			penta_node_ids[30]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->numberofedges+iomodel->elements[6*index+0];
+-			penta_node_ids[31]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->numberofedges+iomodel->elements[6*index+1];
+-			penta_node_ids[32]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->numberofedges+iomodel->elements[6*index+2];
+-			penta_node_ids[33]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->numberofedges+iomodel->elements[6*index+3];
+-			penta_node_ids[34]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->numberofedges+iomodel->elements[6*index+4];
+-			penta_node_ids[35]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->numberofedges+iomodel->elements[6*index+5];
+-			penta_node_ids[36]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->numberofedges+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+0]+1;
+-			penta_node_ids[37]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->numberofedges+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+1]+1;
+-			penta_node_ids[38]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->numberofedges+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+2]+1;
+-			penta_node_ids[39]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->numberofedges+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+0]+2;
+-			penta_node_ids[40]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->numberofedges+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+1]+2;
+-			penta_node_ids[41]=iomodel->nodecounter+iomodel->numberofvertices+4*iomodel->numberofedges+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+2]+2;
++			penta_node_ids[30]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->numberoffaces+iomodel->elements[6*index+0];
++			penta_node_ids[31]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->numberoffaces+iomodel->elements[6*index+1];
++			penta_node_ids[32]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->numberoffaces+iomodel->elements[6*index+2];
++			penta_node_ids[33]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->numberoffaces+iomodel->elements[6*index+3];
++			penta_node_ids[34]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->numberoffaces+iomodel->elements[6*index+4];
++			penta_node_ids[35]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->numberoffaces+iomodel->elements[6*index+5];
++			penta_node_ids[36]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->numberoffaces+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+0]+1;
++			penta_node_ids[37]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->numberoffaces+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+1]+1;
++			penta_node_ids[38]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->numberoffaces+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+2]+1;
++			penta_node_ids[39]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->numberoffaces+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+0]+2;
++			penta_node_ids[40]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->numberoffaces+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+1]+2;
++			penta_node_ids[41]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->numberoffaces+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+2]+2;
+ 			break;
+ 		default:
+ 			_error_("Finite element "<<EnumToStringx(finiteelement_type)<<" not supported yet");
Index: issm/oecreview/Archive/16554-17801/ISSM-17137-17138.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17137-17138.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17137-17138.diff	(revision 17802)
@@ -0,0 +1,36 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp	(revision 17137)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp	(revision 17138)
+@@ -225,6 +225,9 @@
+ 	/*Clean up*/
+ 	xDelete<int>(head_minv);
+ 	xDelete<int>(next_face);
++	xDelete<int>(v);
++	xDelete<int>(elementfaces);
++	xDelete<int>(elementfaces_markers);
+ 
+ 	/*Create final faces (now that we have the correct size)*/
+ 	int* faces = xNew<int>(nbf*6); /*vertex1 vertex2 vertex3 element1 element2 marker*/
+Index: ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17137)
++++ ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17138)
+@@ -433,4 +433,5 @@
+ 	xDelete<IssmDouble>(times);
+ 	xDelete<IssmDouble>(values);
+ 	xDelete<bool>(my_edges);
++	xDelete<bool>(my_faces);
+ }
+Index: ../trunk-jpl/src/c/classes/IoModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 17137)
++++ ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 17138)
+@@ -124,6 +124,7 @@
+ 	xDelete<int>(this->elements);
+ 	xDelete<int>(this->faces);
+ 	xDelete<int>(this->edges);
++	xDelete<int>(this->elementtofaceconnectivity);
+ 	xDelete<int>(this->elementtoedgeconnectivity);
+ 	xDelete<int>(this->singlenodetoelementconnectivity);
+ 	xDelete<int>(this->numbernodetoelementconnectivity);
Index: issm/oecreview/Archive/16554-17801/ISSM-17138-17139.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17138-17139.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17138-17139.diff	(revision 17802)
@@ -0,0 +1,366 @@
+Index: ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.h	(revision 0)
++++ ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.h	(revision 17139)
+@@ -0,0 +1,34 @@
++/*! \file ExtrapolationAnalysis.h 
++ *  \brief: header file for generic external result object
++ */
++
++#ifndef _ExtrapolationAnalysis_
++#define _ExtrapolationAnalysis_
++
++/*Headers*/
++#include "./Analysis.h"
++
++class ExtrapolationAnalysis: public Analysis{
++	
++ public:
++	/*Model processing*/
++	int  DofsPerNode(int** doflist,int meshtype,int approximation);
++	void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
++	void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
++	void CreateNodes(Nodes* nodes,IoModel* iomodel);
++	void CreateConstraints(Constraints* constraints,IoModel* iomodel);
++	void CreateLoads(Loads* loads, IoModel* iomodel);
++
++	/*Finite element Analysis*/
++	void           Core(FemModel* femmodel);
++	ElementVector* CreateDVector(Element* element);
++	ElementMatrix* CreateJacobianMatrix(Element* element);
++	ElementMatrix* CreateKMatrix(Element* element);
++	ElementVector* CreatePVector(Element* element);
++	void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++	void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++	void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++	void GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++
++};
++#endif
+Index: ../trunk-jpl/src/c/analyses/analyses.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/analyses.h	(revision 17138)
++++ ../trunk-jpl/src/c/analyses/analyses.h	(revision 17139)
+@@ -16,6 +16,7 @@
+ #include "./EnthalpyAnalysis.h"
+ #include "./ExtrudeFromBaseAnalysis.h"
+ #include "./ExtrudeFromTopAnalysis.h"
++#include "./ExtrapolationAnalysis.h"
+ #include "./FreeSurfaceBaseAnalysis.h"
+ #include "./FreeSurfaceTopAnalysis.h"
+ #include "./GiaAnalysis.h"
+Index: ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 0)
++++ ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17139)
+@@ -0,0 +1,232 @@
++#include "./ExtrapolationAnalysis.h"
++#include "../toolkits/toolkits.h"
++#include "../classes/classes.h"
++#include "../shared/shared.h"
++#include "../modules/modules.h"
++#include "../solutionsequences/solutionsequences.h"
++
++int ExtrapolationAnalysis::DofsPerNode(int** doflist,int meshtype,int approximation){/*{{{*/
++	return 1;
++}
++/*}}}*/
++void ExtrapolationAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
++	_error_("not implemented yet");
++}
++/*}}}*/
++void ExtrapolationAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
++	int    stabilization,finiteelement;
++
++	/*Finite element type*/
++	finiteelement = P1Enum;
++
++	/*Update elements: */
++	int counter=0;
++	for(int i=0;i<iomodel->numberofelements;i++){
++		if(iomodel->my_elements[i]){
++			Element* element=(Element*)elements->GetObjectByOffset(counter);
++			element->Update(i,iomodel,analysis_counter,analysis_type,finiteelement);
++			counter++;
++		}
++	}
++	iomodel->FetchDataToInput(elements,ExtrapolationVariableEnum);//FIXME: is this the correct way?
++}
++/*}}}*/
++void ExtrapolationAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
++	int finiteelement=P1Enum;
++	::CreateNodes(nodes,iomodel,ExtrapolationAnalysisEnum,finiteelement);
++}
++/*}}}*/
++void ExtrapolationAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
++
++	_error_("not implemented yet");
++
++}
++/*}}}*/
++void ExtrapolationAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
++	
++	_error_("not implemented yet");
++
++}/*}}}*/
++
++/*Finite element Analysis*/
++void ExtrapolationAnalysis::Core(FemModel* femmodel){/*{{{*/
++
++	/*activate formulation: */
++	femmodel->SetCurrentConfiguration(ExtrapolationAnalysisEnum);
++
++	if(VerboseSolution()) _printf0_("extrapolation: call computational core:\n");
++	solutionsequence_linear(femmodel);
++
++}/*}}}*/
++ElementVector* ExtrapolationAnalysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
++ElementMatrix* ExtrapolationAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++	/* Jacobian required for the Newton solver */
++	_error_("not implemented yet");
++}/*}}}*/
++ElementMatrix* ExtrapolationAnalysis::CreateKMatrix(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	const int dim = 2;
++	int        i,row,col,stabilization;
++	IssmDouble Jdet,D_scalar,h;
++	IssmDouble dlevelset[dim],normal[dim];
++	IssmDouble norm_dlevelset;
++	IssmDouble* xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementMatrix* Ke     = element->NewElementMatrix();
++	IssmDouble*    B      = xNew<IssmDouble>(dim*numnodes);
++	IssmDouble*    Bprime = xNew<IssmDouble>(dim*numnodes);
++	IssmDouble     D[dim][dim];
++
++	/*Retrieve all inputs and parameters*/
++	Input* levelset_input=element->GetInput(MaskIceLevelsetEnum); _assert_(levelset_input);
++	element->GetVerticesCoordinates(&xyz_list);
++	h = element->CharacteristicLength();
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		GetB(B,element,xyz_list,gauss);
++		GetBprime(Bprime,element,xyz_list,gauss);
++
++		/* Get normal on node */
++		levelset_input->GetInputDerivativeValue(&dlevelset[0],xyz_list,gauss);
++		norm_dlevelset=0.;
++		for(i=0;i<dim;i++) norm_dlevelset+=dlevelset[i]*dlevelset[i]; 
++		norm_dlevelset=sqrt(norm_dlevelset)+1.e-14;
++		for(i=0;i<dim;i++) normal[i]=dlevelset[i]/norm_dlevelset;
++
++		D_scalar=gauss->weight*Jdet;
++
++		for(row=0;row<dim;row++)
++			for(col=0;col<dim;col++)
++				if(row==col)
++					D[row][col]=D_scalar*normal[row];
++				else
++					D[row][col]=0.;
++		TripleMultiply(B,dim,numnodes,1,
++					&D[0][0],dim,dim,0,
++					Bprime,dim,numnodes,0,
++					&Ke->values[0],1);
++
++		stabilization=1;
++		if (stabilization==0){/* no stabilization, do nothing*/}
++		else if(stabilization==1){
++			/*Streamline upwinding*/
++			for(row=0;row<dim;row++)
++				for(col=0;col<dim;col++)
++					D[row][col]=h/(2.*1.)*normal[row]*normal[col];
++
++			TripleMultiply(Bprime,dim,numnodes,1,
++						&D[0][0],dim,dim,0,
++						Bprime,dim,numnodes,0,
++						&Ke->values[0],1);
++		}
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(B);
++	xDelete<IssmDouble>(Bprime);
++	delete gauss;
++	return Ke;
++
++	}/*}}}*/
++ElementVector* ExtrapolationAnalysis::CreatePVector(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	int i;
++	
++	/*Fetch number of nodes */
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector*/
++	ElementVector* pe = element->NewElementVector();
++	for(i=0;i<numnodes;i++) 
++		pe->values[i]=0.; 
++	return pe;
++}/*}}}*/
++void ExtrapolationAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++void ExtrapolationAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++
++	int meshtype, extrapolationvariable;
++	element->FindParam(&meshtype,MeshTypeEnum);
++	element->FindParam(&extrapolationvariable, ExtrapolationVariableEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			element->InputUpdateFromSolutionOneDof(solution,extrapolationvariable);
++			break;
++		case Mesh3DEnum:
++			element->InputUpdateFromSolutionOneDofCollapsed(solution,extrapolationvariable);
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++}/*}}}*/
++void ExtrapolationAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
++	 * For node i, Bi can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi=[ N ]
++	 *          [ N ]
++	 * where N is the finiteelement function for node i.
++	 *
++	 * We assume B_prog has been allocated already, of size: 2x(NDOF1*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions*/
++	IssmDouble* basis=xNew<IssmDouble>(numnodes);
++	element->NodalFunctions(basis,gauss);
++
++	/*Build B: */
++	for(int i=0;i<numnodes;i++){
++		B[numnodes*0+i] = basis[i];
++		B[numnodes*1+i] = basis[i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(basis);
++}/*}}}*/
++void ExtrapolationAnalysis::GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 
++	 * For node i, Bi' can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi_prime=[ dN/dx ]
++	 *                [ dN/dy ]
++	 * where N is the finiteelement function for node i.
++	 *
++	 * We assume B' has been allocated already, of size: 3x(NDOF2*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Build B': */
++	for(int i=0;i<numnodes;i++){
++		Bprime[numnodes*0+i] = dbasis[0*numnodes+i];
++		Bprime[numnodes*1+i] = dbasis[1*numnodes+i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(dbasis);
++
++}/*}}}*/
++
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17138)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17139)
+@@ -675,6 +675,8 @@
+ 	/*Levelset related enums (will be moved to appropriate place when finished){{{*/
+ 	LevelsetAnalysisEnum,
+ 	TransientIslevelsetEnum,
++	ExtrapolationAnalysisEnum,
++	ExtrapolationVariableEnum,
+ 	/*}}}*/
+ 	MaximumNumberOfDefinitionsEnum
+ };
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17138)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17139)
+@@ -634,6 +634,8 @@
+ 		case LliboutryDuvalEnum : return "LliboutryDuval";
+ 		case LevelsetAnalysisEnum : return "LevelsetAnalysis";
+ 		case TransientIslevelsetEnum : return "TransientIslevelset";
++		case ExtrapolationAnalysisEnum : return "ExtrapolationAnalysis";
++		case ExtrapolationVariableEnum : return "ExtrapolationVariable";
+ 		case MaximumNumberOfDefinitionsEnum : return "MaximumNumberOfDefinitions";
+ 		default : return "unknown";
+ 
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17138)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17139)
+@@ -649,6 +649,8 @@
+ 	      else if (strcmp(name,"LliboutryDuval")==0) return LliboutryDuvalEnum;
+ 	      else if (strcmp(name,"LevelsetAnalysis")==0) return LevelsetAnalysisEnum;
+ 	      else if (strcmp(name,"TransientIslevelset")==0) return TransientIslevelsetEnum;
++	      else if (strcmp(name,"ExtrapolationAnalysis")==0) return ExtrapolationAnalysisEnum;
++	      else if (strcmp(name,"ExtrapolationVariable")==0) return ExtrapolationVariableEnum;
+ 	      else if (strcmp(name,"MaximumNumberOfDefinitions")==0) return MaximumNumberOfDefinitionsEnum;
+          else stage=7;
+    }
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17138)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17139)
+@@ -369,7 +369,9 @@
+ transient_sources  = ./modules/ModelProcessorx/Transient/UpdateElementsTransient.cpp \
+ 							./cores/transient_core.cpp\
+               ./analyses/LevelsetAnalysis.h\
+-              ./analyses/LevelsetAnalysis.cpp
++              ./analyses/LevelsetAnalysis.cpp\
++			  ./analyses/ExtrapolationAnalysis.h\
++			  ./analyses/ExtrapolationAnalysis.cpp
+ #}}}
+ #Steadystate sources  {{{
+ steadystate_sources = ./cores/steadystate_core.cpp
+Index: ../trunk-jpl/src/c/cores/transient_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17138)
++++ ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17139)
+@@ -113,7 +113,7 @@
+ 		femmodel->parameters->SetParam(save_results,SaveResultsEnum);
+ 
+ 		if(isthermal && meshtype==Mesh3DEnum){
+-			if(VerboseSolution()) _printf0_("   computing temperatures\n");
++			if(VerboseSolution()) _printf0_("   computing thermal regime\n");
+ 			#ifdef _HAVE_THERMAL_
+ 			thermal_core(femmodel);
+ 			#else
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17138)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17139)
+@@ -626,4 +626,6 @@
+ def LliboutryDuvalEnum(): return StringToEnum("LliboutryDuval")[0]
+ def LevelsetAnalysisEnum(): return StringToEnum("LevelsetAnalysis")[0]
+ def TransientIslevelsetEnum(): return StringToEnum("TransientIslevelset")[0]
++def ExtrapolationAnalysisEnum(): return StringToEnum("ExtrapolationAnalysis")[0]
++def ExtrapolationVariableEnum(): return StringToEnum("ExtrapolationVariable")[0]
+ def MaximumNumberOfDefinitionsEnum(): return StringToEnum("MaximumNumberOfDefinitions")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17139-17140.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17139-17140.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17139-17140.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17139)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17140)
+@@ -562,7 +562,7 @@
+ 						}
+ 
+ 						/*Gather from all cpus*/
+-						ISSM_MPI_Allreduce((void*)values,(void*)allvalues,nbe*nodesperelement,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD);
++						ISSM_MPI_Allreduce((void*)values,(void*)allvalues,nbe*nodesperelement,ISSM_MPI_PDOUBLE,ISSM_MPI_SUM,IssmComm::GetComm());
+ 						xDelete<IssmDouble>(values);
+ 
+ 						if(save_results)results->AddResult(new GenericExternalResult<IssmDouble*>(results->Size()+1,output_enum,allvalues,nbe,nodesperelement,step,time));
Index: issm/oecreview/Archive/16554-17801/ISSM-17140-17141.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17140-17141.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17140-17141.diff	(revision 17802)
@@ -0,0 +1,67 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17140)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17141)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ #include "../solutionsequences/solutionsequences.h"
+ 
+-//#define FSANALYTICAL 1
++//#define FSANALYTICAL 2
+ 
+ /*Model processing*/
+ int  StressbalanceAnalysis::DofsPerNode(int** pdoftype,int meshtype,int approximation){/*{{{*/
+@@ -2761,9 +2761,17 @@
+ 		y_coord=element->GetYcoord(gauss);
+ 		z_coord=element->GetZcoord(gauss);
+ 
+-		forcex=fx1(x_coord,y_coord,z_coord);
+-		forcey=fy1(x_coord,y_coord,z_coord);
+-		forcez=fz1(x_coord,y_coord,z_coord);
++		#if FSANALYTICAL == 1
++			forcex=fx1(x_coord,y_coord,z_coord);
++			forcey=fy1(x_coord,y_coord,z_coord);
++			forcez=fz1(x_coord,y_coord,z_coord);
++		#elseif FSANALYTICAL == 2
++			forcex=fx2(x_coord,y_coord,z_coord);
++			forcey=fy2(x_coord,y_coord,z_coord);
++			forcez=fz2(x_coord,y_coord,z_coord);
++		#else 
++			_error_("FS analytical not implemented yet");
++		#endif
+ 
+ 		for(i=0;i<vnumnodes;i++){
+ 			pe->values[i*dim+0] += forcex *Jdet*gauss->weight*vbasis[i];
+@@ -3154,14 +3162,14 @@
+ 	 *					[ phi ]
+ 	 *
+ 	 *	In 3d
+-	 *     	   Bvi=[ dh/dx          0             0      ]
+-	 *					[   0           dh/dy           0      ]
+-	 *					[   0             0           dh/dz    ]
+-	 *					[ 1/2*dh/dy    1/2*dh/dx        0      ]
+-	 *					[ 1/2*dh/dz       0         1/2*dh/dx  ]
+-	 *					[   0          1/2*dh/dz    1/2*dh/dy  ]
+-	 *					[   0             0             0      ]
+-	 *					[ dh/dx         dh/dy         dh/dz    ]
++	 *     	   Bvi=[ dh/dx     0        0    ]
++	 *					[   0      dh/dy      0    ]
++	 *					[   0        0      dh/dz  ]
++	 *					[ dh/dy    dh/dx      0    ]
++	 *					[ dh/dz      0      dh/dx  ]
++	 *					[   0      dh/dz    dh/dy  ]
++	 *					[ dh/dx    dh/dy    dh/dz  ]
++	 *					[   0        0        0    ]
+ 	 *
+ 	 *         Bpi=[ 0 ]
+ 	 *					[ 0 ]
+@@ -3169,8 +3177,8 @@
+ 	 *					[ 0 ]
+ 	 *					[ 0 ]
+ 	 *					[ 0 ]
++	 *					[ 0 ]
+ 	 *					[ h ]
+-	 *					[ 0 ]
+ 	 *	where phi is the finiteelement function for node i.
+ 	 *	In 3d:
+ 	 */
Index: issm/oecreview/Archive/16554-17801/ISSM-17141-17142.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17141-17142.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17141-17142.diff	(revision 17802)
@@ -0,0 +1,180 @@
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17141)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17142)
+@@ -319,80 +319,22 @@
+ void PentaRef::GetNodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss){
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+ 
+-	switch(this->element_type){
+-		case P1P1Enum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = P1P1Enum;
+-			return;
+-		case P1P1GLSEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = P1P1GLSEnum;
+-			return;
+-		case MINIcondensedEnum:
+-			this->element_type = P1bubbleEnum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = MINIcondensedEnum;
+-			return;
+-		case MINIEnum:
+-			this->element_type = P1bubbleEnum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = MINIEnum;
+-			return;
+-		case TaylorHoodEnum:
+-			this->element_type = P2Enum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = TaylorHoodEnum;
+-			return;
+-		case OneLayerP4zEnum:
+-			this->element_type = P2xP4Enum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = OneLayerP4zEnum;
+-			return;
+-		default:
+-			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+-	}
++	int save = this->element_type;
++	this->element_type = VelocityInterpolation();
++	this->GetNodalFunctions(basis,gauss);
++	this->element_type = save;
++
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetNodalFunctionsPressure{{{*/
+ void PentaRef::GetNodalFunctionsPressure(IssmDouble* basis,Gauss* gauss){
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+ 
+-	switch(this->element_type){
+-		case P1P1Enum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = P1P1Enum;
+-			return;
+-		case P1P1GLSEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = P1P1GLSEnum;
+-			return;
+-		case MINIcondensedEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = MINIcondensedEnum;
+-			return;
+-		case MINIEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = MINIEnum;
+-			return;
+-		case TaylorHoodEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = TaylorHoodEnum;
+-			return;
+-		case OneLayerP4zEnum:
+-			this->element_type = P1xP3Enum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = OneLayerP4zEnum;
+-			return;
+-		default:
+-			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+-	}
++	int save = this->element_type;
++	this->element_type = PressureInterpolation();
++	this->GetNodalFunctions(basis,gauss);
++	this->element_type = save;
++
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetNodalFunctionsDerivatives{{{*/
+@@ -432,73 +374,21 @@
+ /*}}}*/
+ /*FUNCTION PentaRef::GetNodalFunctionsDerivativesVelocity{{{*/
+ void PentaRef::GetNodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){
+-	switch(this->element_type){
+-		case P1P1Enum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = P1P1Enum;
+-			return;
+-		case P1P1GLSEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = P1P1GLSEnum;
+-			return;
+-		case MINIcondensedEnum:
+-			this->element_type = P1bubbleEnum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = MINIcondensedEnum;
+-			return;
+-		case MINIEnum:
+-			this->element_type = P1bubbleEnum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = MINIEnum;
+-			return;
+-		case TaylorHoodEnum:
+-			this->element_type = P2Enum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = TaylorHoodEnum;
+-			return;
+-		case OneLayerP4zEnum:
+-			this->element_type = P2xP4Enum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = OneLayerP4zEnum;
+-			return;
+-		default:
+-			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+-	}
++
++	int save = this->element_type;
++	this->element_type = VelocityInterpolation();
++	this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++	this->element_type = save;
++
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetNodalFunctionsDerivativesPressure{{{*/
+ void PentaRef::GetNodalFunctionsDerivativesPressure(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){
+-	switch(this->element_type){
+-		case P1P1Enum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = P1P1Enum;
+-			return;
+-		case P1P1GLSEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = P1P1GLSEnum;
+-			return;
+-		case MINIcondensedEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = MINIcondensedEnum;
+-			return;
+-		case MINIEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = MINIEnum;
+-			return;
+-		case TaylorHoodEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = TaylorHoodEnum;
+-			return;
+-		default:
+-			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+-	}
++
++	int save = this->element_type;
++	this->element_type = PressureInterpolation();
++	this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++	this->element_type = save;
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetNodalFunctionsDerivativesReference{{{*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17142-17143.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17142-17143.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17142-17143.diff	(revision 17802)
@@ -0,0 +1,16 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17142)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17143)
+@@ -2263,10 +2263,7 @@
+ 	IssmDouble xyz_list[NUMVERTICES][3];
+ 
+ 	/*If on water, return 0: */
+-	if(!IsIceInElement()){
+-		printf("no ice in element!\n");
+-		return 0;
+-	}
++	if(!IsIceInElement()) return 0.;
+ 
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17143-17144.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17143-17144.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17143-17144.diff	(revision 17802)
@@ -0,0 +1,69 @@
+Index: ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.h	(revision 17143)
++++ ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.h	(revision 17144)
+@@ -29,6 +29,7 @@
+ 	void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ 	void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 	void GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+-
++	void UpdateConstraints(Elements* elements);
++	void SetConstraintsOnIce(Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17143)
++++ ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17144)
+@@ -55,6 +55,7 @@
+ 	femmodel->SetCurrentConfiguration(ExtrapolationAnalysisEnum);
+ 
+ 	if(VerboseSolution()) _printf0_("extrapolation: call computational core:\n");
++	UpdateConstraints(femmodel->elements);
+ 	solutionsequence_linear(femmodel);
+ 
+ }/*}}}*/
+@@ -229,4 +230,43 @@
+ 	xDelete<IssmDouble>(dbasis);
+ 
+ }/*}}}*/
++void ExtrapolationAnalysis::UpdateConstraints(Elements* elements){/*{{{*/
+ 
++	for(int i=0;i<elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
++		this->SetConstraintsOnIce(element);
++	}
++
++}/*}}}*/
++void ExtrapolationAnalysis::SetConstraintsOnIce(Element* element){/*{{{*/
++
++	int numnodes=element->GetNumberOfNodes();	
++
++	/* Intermediaries */
++	int extvar_enum;
++	IssmDouble phi,value;
++	Node* node = NULL;
++
++	/* Get further parameters */
++	element->FindParam(&extvar_enum, ExtrapolationVariableEnum);
++	
++	Input* levelset_input=element->GetInput(MaskIceLevelsetEnum); _assert_(levelset_input);
++	Input* extvar_input=element->GetInput(extvar_enum); _assert_(extvar_input);
++	
++	GaussPenta* gauss=new GaussPenta();
++	for(int in=0;in<numnodes;in++){
++		gauss->GaussNode(element->GetElementType(),in);
++		node=element->GetNode(in);
++		levelset_input->GetInputValue(&phi,gauss);
++		extvar_input->GetInputValue(&value,gauss);
++		if(phi<=0.){
++			/* if ice, set dirichlet BC */
++			node->ApplyConstraint(1,value);
++		}
++		else {
++			/* no ice, set no spc */
++			node->DofInFSet(0); 
++		}
++	}
++	delete gauss;
++}/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17144-17145.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17144-17145.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17144-17145.diff	(revision 17802)
@@ -0,0 +1,58 @@
+Index: ../trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h	(revision 17144)
++++ ../trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h	(revision 17145)
+@@ -367,6 +367,53 @@
+ 	return DoubleMatExternalResultEnum;
+ } /*}}}*/
+ 
++/*Specific instantiations for IssmDouble*: */
++#if defined(_HAVE_ADOLC_) && !defined(_WRAPPERS_)  //We hook off this specific specialization when not running ADOLC, otherwise we get a redeclaration with the next specialization. 
++template <> inline void GenericExternalResult<IssmDouble*>::WriteData(FILE* fid,bool io_gather){ /*{{{*/
++
++	int     i;
++	int     my_rank;
++	int     type;
++	int     rows,cols;
++	char   *name    = NULL;
++	IssmPDouble passiveDouble;
++	IssmPDouble* passiveDoubles;
++
++	/*recover my_rank:*/
++	my_rank=IssmComm::GetRank();
++
++	if(io_gather){
++		/*we are gathering the data on cpu 0, don't write on other cpus: */
++		if(my_rank) return;
++	}
++
++	/*First write enum: */
++	int length=(strlen(this->result_name)+1)*sizeof(char);
++	fwrite(&length,sizeof(int),1,fid);
++	fwrite(this->result_name,length,1,fid);
++
++	/*Now write time and step: */
++	passiveDouble=reCast<IssmPDouble>(time);
++	fwrite(&passiveDouble,sizeof(IssmPDouble),1,fid);
++	fwrite(&step,sizeof(int),1,fid);
++
++	/*writing a IssmDouble array, type is 3:*/
++	type=3;
++	fwrite(&type,sizeof(int),1,fid);
++	rows=this->M;
++	fwrite(&rows,sizeof(int),1,fid);
++	cols=this->N;
++	fwrite(&cols,sizeof(int),1,fid);
++
++	passiveDoubles=xNew<IssmPDouble>(this->M*this->N);
++	for (i=0;i<this->M*this->N;i++)passiveDoubles[i]=reCast<IssmPDouble>(value[i]);
++	fwrite(passiveDoubles,cols*rows*sizeof(IssmPDouble),1,fid);
++	xDelete<IssmPDouble>(passiveDoubles);
++
++}
++/*}}}*/
++#endif
++
+ /*Specifics instantiations for Vector*/
+ template <> inline GenericExternalResult<Vector<IssmPDouble>*>::GenericExternalResult(int in_id, int in_enum_type,Vector<IssmPDouble>* in_values, int in_M,int in_N,int in_step,IssmDouble in_time){/*{{{*/
+ 	_error_("instanciation not correct");
Index: issm/oecreview/Archive/16554-17801/ISSM-17145-17146.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17145-17146.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17145-17146.diff	(revision 17802)
@@ -0,0 +1,32 @@
+Index: ../trunk-jpl/src/m/contrib/paraview/exportVTK.m
+===================================================================
+--- ../trunk-jpl/src/m/contrib/paraview/exportVTK.m	(revision 17145)
++++ ../trunk-jpl/src/m/contrib/paraview/exportVTK.m	(revision 17146)
+@@ -101,8 +101,11 @@
+ 			if ((numel(sol_struct{j}(timestep).(fieldnames{k})))== ...
+ 					num_of_points);
+ 				%paraview does not like NaN, replacing
+-				pos=find(isnan(sol_struct{j}(timestep).(fieldnames{k})));
+-				sol_struct{j}(timestep).(fieldnames{k})(pos)=-9999;
++				nanval=find(isnan(sol_struct{j}(timestep).(fieldnames{k})));
++				sol_struct{j}(timestep).(fieldnames{k})(nanval)=-9999;
++				%also checking for verry small value that mess up
++				smallval=(abs(sol_struct{j}(timestep).(fieldnames{k}))<1.0e-20);
++				sol_struct{j}(timestep).(fieldnames{k})(smallval)=0.0;
+ 				fprintf(FID,'SCALARS %s float 1 \n',fieldnames{k});
+ 				fprintf(FID,'LOOKUP_TABLE default\n');
+ 				s='%e\n';
+@@ -120,8 +123,11 @@
+ 		for k=1:num_of_fields
+ 			if ((numel(res_struct.(fieldnames{k})))==num_of_points);
+ 				%paraview does not like NaN, replacing
+-				pos=find(isnan(res_struct.(fieldnames{k})));
+-				res_struct.(fieldnames{k})(pos)=-9999;
++				nanval=find(isnan(res_struct.(fieldnames{k})));
++				res_struct.(fieldnames{k})(nanval)=-9999;
++				%also checking for verry small value that mess up
++				smallval=(abs(res_struct.(fieldnames{k}))<1.0e-20);
++				res_struct.(fieldnames{k})(smallval)=0.0;
+ 				fprintf(FID,'SCALARS %s float 1 \n',fieldnames{k});
+ 				fprintf(FID,'LOOKUP_TABLE default\n');
+ 				s='%e\n';
Index: issm/oecreview/Archive/16554-17801/ISSM-17146-17147.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17146-17147.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17146-17147.diff	(revision 17802)
@@ -0,0 +1,88 @@
+Index: ../trunk-jpl/src/m/inversions/misfit.m
+===================================================================
+--- ../trunk-jpl/src/m/inversions/misfit.m	(revision 17146)
++++ ../trunk-jpl/src/m/inversions/misfit.m	(revision 17147)
+@@ -1,39 +0,0 @@
+-function J=misfit(md)
+-%MISFIT - compute misfit
+-%
+-%   Usage:
+-%      J=misfit(md)
+-%
+-%   Example:
+-%      J=misfit(md)
+-%
+-
+-if md.mesh.dimension==2,
+-	elements=md.mesh.elements;
+-	x=md.mesh.x;
+-	y=md.mesh.y;
+-	%vx=md.initialization.vx;
+-	%vy=md.initialization.vy;
+-	vx=md.results.StressbalanceSolution.Vx;
+-	vy=md.results.StressbalanceSolution.Vy;
+-	vx_obs=md.inversion.vx_obs;
+-	vy_obs=md.inversion.vy_obs;
+-else
+-	elements=md.mesh.elements2d;
+-	x=md.mesh.x2d;
+-	y=md.mesh.y2d;
+-	vx=project2d(md,md.initialization.vx,md.mesh.numberoflayers);
+-	vy=project2d(md,md.initialization.vy,md.mesh.numberoflayers);
+-	vx_obs=project2d(md,md.inversion.vx_obs,md.mesh.numberoflayers);
+-	vy_obs=project2d(md,md.inversion.vy_obs,md.mesh.numberoflayers);
+-end
+-
+-%compute areas;
+-areas=GetAreas(elements,x,y);
+-
+-%compute delta v on elements
+-deltav=1/2*(   (vx-vx_obs).^2+(vy-vy_obs).^2)/md.constants.yts^2;
+-deltav_elem=deltav(elements)*[1;1;1]/3;
+-
+-%compute misfit
+-J=sum(deltav_elem.*areas);
+Index: ../trunk-jpl/src/m/inversions/velocitymisfit.m
+===================================================================
+--- ../trunk-jpl/src/m/inversions/velocitymisfit.m	(revision 0)
++++ ../trunk-jpl/src/m/inversions/velocitymisfit.m	(revision 17147)
+@@ -0,0 +1,39 @@
++function J=misfit(md)
++%MISFIT - compute misfit
++%
++%   Usage:
++%      J=misfit(md)
++%
++%   Example:
++%      J=misfit(md)
++%
++
++if md.mesh.dimension==2,
++	elements=md.mesh.elements;
++	x=md.mesh.x;
++	y=md.mesh.y;
++	%vx=md.initialization.vx;
++	%vy=md.initialization.vy;
++	vx=md.results.StressbalanceSolution.Vx;
++	vy=md.results.StressbalanceSolution.Vy;
++	vx_obs=md.inversion.vx_obs;
++	vy_obs=md.inversion.vy_obs;
++else
++	elements=md.mesh.elements2d;
++	x=md.mesh.x2d;
++	y=md.mesh.y2d;
++	vx=project2d(md,md.initialization.vx,md.mesh.numberoflayers);
++	vy=project2d(md,md.initialization.vy,md.mesh.numberoflayers);
++	vx_obs=project2d(md,md.inversion.vx_obs,md.mesh.numberoflayers);
++	vy_obs=project2d(md,md.inversion.vy_obs,md.mesh.numberoflayers);
++end
++
++%compute areas;
++areas=GetAreas(elements,x,y);
++
++%compute delta v on elements
++deltav=1/2*(   (vx-vx_obs).^2+(vy-vy_obs).^2)/md.constants.yts^2;
++deltav_elem=deltav(elements)*[1;1;1]/3;
++
++%compute misfit
++J=sum(deltav_elem.*areas);
Index: issm/oecreview/Archive/16554-17801/ISSM-17147-17148.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17147-17148.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17147-17148.diff	(revision 17802)
@@ -0,0 +1,48 @@
+Index: ../trunk-jpl/test/NightlyRun/test336.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test336.py	(revision 0)
++++ ../trunk-jpl/test/NightlyRun/test336.py	(revision 17148)
+@@ -0,0 +1,31 @@
++from model import *
++from triangle import *
++from setmask import *
++from parameterize import *
++from setflowequation import *
++from EnumDefinitions import *
++from solve import *
++from MatlabFuncs import *
++
++md=triangle(model(),'../Exp/Square.exp',150000.)
++md=setmask(md,'','')
++md=parameterize(md,'../Par/SquareSheetLevelset.py') 
++md=setflowequation(md,'SSA','all')
++md.cluster=generic('name',oshostname(),'np',3)
++md=solve(md,TransientSolutionEnum())
++
++#Fields and tolerances to track changes
++field_names     =['Vx','Vy','Vel','Pressure','MaskIceLevelset']
++field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
++field_values=[\
++	md.results.TransientSolution[0].Vx,\
++	md.results.TransientSolution[0].Vy,\
++	md.results.TransientSolution[0].Vel,\
++	md.results.TransientSolution[0].Pressure,\
++	md.results.TransientSolution[0].MaskIceLevelset,\
++	md.results.TransientSolution[1].Vx,\
++	md.results.TransientSolution[1].Vy,\
++	md.results.TransientSolution[1].Vel,\
++	md.results.TransientSolution[1].Pressure,\
++	md.results.TransientSolution[1].MaskIceLevelset,\
++	]
+Index: ../trunk-jpl/test/NightlyRun/IdToName.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/IdToName.py	(revision 17147)
++++ ../trunk-jpl/test/NightlyRun/IdToName.py	(revision 17148)
+@@ -105,6 +105,7 @@
+ 	329  : 'SquareSheetConstrainedSmbGradients3d',
+ 	332  : 'SquareSheetConstrainedHydrologyDC',
+ 	333  : 'SquareSheetHydrologyDCTwoLayers',
++	336  : 'SquareSheetLevelsetSSA2d',
+ 	401  : 'SquareSheetShelfStressSSA2d',
+ 	402  : 'SquareSheetShelfStressSSA3d',
+ 	403  : 'SquareSheetShelfStressHO',
Index: issm/oecreview/Archive/16554-17801/ISSM-17148-17149.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17148-17149.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17148-17149.diff	(revision 17802)
@@ -0,0 +1,35 @@
+Index: ../trunk-jpl/test/NightlyRun/test336.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test336.py	(revision 17148)
++++ ../trunk-jpl/test/NightlyRun/test336.py	(revision 17149)
+@@ -9,9 +9,29 @@
+ 
+ md=triangle(model(),'../Exp/Square.exp',150000.)
+ md=setmask(md,'','')
+-md=parameterize(md,'../Par/SquareSheetLevelset.py') 
++md=parameterize(md,'../Par/SquareSheetConstrained.py') 
+ md=setflowequation(md,'SSA','all')
+ md.cluster=generic('name',oshostname(),'np',3)
++
++# parameters
++md.transient.isstressbalance=True
++md.transient.ismasstransport=False
++md.transient.isthermal=False
++md.transient.isgroundingline=False
++md.transient.isgia=False
++md.transient.islevelset=True
++
++# init levelset function
++ymin=numpy.min(md.mesh.y)
++ymax=numpy.max(md.mesh.y)
++xmin=min(md.mesh.x)
++xmax=max(md.mesh.x)
++xmed=(xmax+xmin)/2
++ymed=(ymax+ymin)/2
++distx=numpy.absolute(md.mesh.x.reshape(-1,1)-xmed)
++disty=numpy.absolute(md.mesh.y.reshape(-1,1)-ymed)
++md.mask.ice_levelset=numpy.maximum(distx,disty)-1.e5
++
+ md=solve(md,TransientSolutionEnum())
+ 
+ #Fields and tolerances to track changes
Index: issm/oecreview/Archive/16554-17801/ISSM-17149-17150.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17149-17150.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17149-17150.diff	(revision 17802)
@@ -0,0 +1,10 @@
+Index: ../trunk-jpl/test/Archives/Archive336.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/test/Archives/Archive336.nc
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+
Index: issm/oecreview/Archive/16554-17801/ISSM-17150-17151.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17150-17151.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17150-17151.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/classes/flowequation.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/flowequation.py	(revision 17150)
++++ ../trunk-jpl/src/m/classes/flowequation.py	(revision 17151)
+@@ -73,7 +73,7 @@
+ 			md = checkfield(md,'fieldname','flowequation.isHO','numel',[1],'values',[0,1])
+ 			md = checkfield(md,'fieldname','flowequation.isFS','numel',[1],'values',[0,1])
+ 			md = checkfield(md,'fieldname','flowequation.fe_SSA','values',['P1','P1bubble','P1bubblecondensed','P2'])
+-			md = checkfield(md,'fieldname','flowequation.fe_HO' ,'values',['P1','P1bubble','P1bubblecondensed','P1xP2','P2xP1','P2'])
++			md = checkfield(md,'fieldname','flowequation.fe_HO' ,'values',['P1','P1bubble','P1bubblecondensed','P1xP2','P2xP1','P2','P1xP3','P2xP4'])
+ 			md = checkfield(md,'fieldname','flowequation.fe_FS' ,'values',['P1P1','P1P1GLS','MINIcondensed','MINI','TaylorHood','OneLayerP4z','P1xP3','P2xP4'])
+ 			md = checkfield(md,'fieldname','flowequation.borderSSA','size',[md.mesh.numberofvertices],'values',[0,1])
+ 			md = checkfield(md,'fieldname','flowequation.borderHO','size',[md.mesh.numberofvertices],'values',[0,1])
Index: issm/oecreview/Archive/16554-17801/ISSM-17151-17152.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17151-17152.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17151-17152.diff	(revision 17802)
@@ -0,0 +1,52 @@
+Index: ../trunk-jpl/test/NightlyRun/test325.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test325.py	(revision 17151)
++++ ../trunk-jpl/test/NightlyRun/test325.py	(revision 17152)
+@@ -24,7 +24,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Enthalpy','Waterfraction','Temperature']
+-field_tolerances=[1e-13,1e-13,1e-13]
++field_tolerances=[1e-13,5e-13,1e-13]
+ field_values=[\
+ 	md.results.ThermalSolution.Enthalpy,\
+ 	md.results.ThermalSolution.Waterfraction,\
+Index: ../trunk-jpl/test/NightlyRun/test285.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test285.m	(revision 17151)
++++ ../trunk-jpl/test/NightlyRun/test285.m	(revision 17152)
+@@ -12,7 +12,7 @@
+ 	md.flowequation.fe_HO=i{1};
+ 	md=solve(md,StressbalanceSolutionEnum());
+ 	field_names     ={field_names{:},['Vx' i{1}],['Vy' i{1}],['Vz' i{1}],['Vel' i{1}],['Pressure' i{1}]};
+-	field_tolerances={field_tolerances{:},1e-08,1e-08,1e-08,1e-08,1e-13};
++	field_tolerances={field_tolerances{:},2e-08,2e-08,2e-08,2e-08,1e-13};
+ 	field_values={field_values{:},...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test285.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test285.py	(revision 17151)
++++ ../trunk-jpl/test/NightlyRun/test285.py	(revision 17152)
+@@ -22,7 +22,7 @@
+ 	md.flowequation.fe_HO=i
+ 	md=solve(md,StressbalanceSolutionEnum())
+ 	field_names     =field_names+['Vx'+i,'Vy'+i,'Vz'+i,'Vel'+i,'Pressure'+i]
+-	field_tolerances=field_tolerances+[1e-08,1e-08,1e-08,1e-08,1e-13]
++	field_tolerances=field_tolerances+[2e-08,2e-08,2e-08,2e-08,1e-13]
+ 	field_values=field_values+[\
+ 		md.results.StressbalanceSolution.Vx,\
+ 		md.results.StressbalanceSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test325.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test325.m	(revision 17151)
++++ ../trunk-jpl/test/NightlyRun/test325.m	(revision 17152)
+@@ -14,7 +14,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Enthalpy','Waterfraction','Temperature'};
+-field_tolerances={1e-13,1e-13,1e-13};
++field_tolerances={1e-13,5e-13,1e-13};
+ field_values={...
+ 	(md.results.ThermalSolution.Enthalpy),...
+ 	(md.results.ThermalSolution.Waterfraction),...
Index: issm/oecreview/Archive/16554-17801/ISSM-17152-17153.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17152-17153.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17152-17153.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/test/NightlyRun/test203.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test203.py	(revision 17152)
++++ ../trunk-jpl/test/NightlyRun/test203.py	(revision 17153)
+@@ -20,7 +20,7 @@
+ # Fields and tolerances to track changes
+ 
+ field_names     =['Vx','Vy','Vz','Vel','Pressure']
+-field_tolerances=[1e-09,1e-09,1e-09,1e-09,1e-09]
++field_tolerances=[2e-09,1e-09,1e-09,1e-09,1e-09]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Vx,\
+ 	md.results.StressbalanceSolution.Vy,\
Index: issm/oecreview/Archive/16554-17801/ISSM-17153-17154.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17153-17154.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17153-17154.diff	(revision 17802)
@@ -0,0 +1,14 @@
+Index: ../trunk-jpl/m4/issm_options.m4
+===================================================================
+--- ../trunk-jpl/m4/issm_options.m4	(revision 17153)
++++ ../trunk-jpl/m4/issm_options.m4	(revision 17154)
+@@ -38,6 +38,9 @@
+ 		[enable_development=no])                                      dnl action if not given
+ 
+ 	AC_MSG_CHECKING(for development support)
++	if test "x$enable_debugging" = xyes; then
++		AC_DEFINE([_DEVELOPMENT_],[1],[Macro to enable development version in ISSM])
++	fi
+ 	AM_CONDITIONAL([DEVELOPMENT], [test x$enable_development = xyes])
+ 	AC_MSG_RESULT($enable_development)
+ 	 dnl }}}
Index: issm/oecreview/Archive/16554-17801/ISSM-17154-17155.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17154-17155.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17154-17155.diff	(revision 17802)
@@ -0,0 +1,15 @@
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17154)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17155)
+@@ -59,6 +59,10 @@
+ /*Finite element Analysis*/
+ void LevelsetAnalysis::Core(FemModel* femmodel){/*{{{*/
+ 
++	#if !define(_DEVELOPEMENT_)
++	_error_("Not implemented yet");
++	#endif
++
+ 	/*parameters: */
+ 	bool save_results;
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17155-17156.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17155-17156.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17155-17156.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17155)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17156)
+@@ -59,7 +59,7 @@
+ /*Finite element Analysis*/
+ void LevelsetAnalysis::Core(FemModel* femmodel){/*{{{*/
+ 
+-	#if !define(_DEVELOPEMENT_)
++	#if !defined(_DEVELOPEMENT_)
+ 	_error_("Not implemented yet");
+ 	#endif
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17156-17157.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17156-17157.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17156-17157.diff	(revision 17802)
@@ -0,0 +1,42 @@
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17156)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17157)
+@@ -868,6 +868,7 @@
+ 	element->GetVerticesCoordinatesBase(&xyz_list_base);
+ 	IssmDouble latentheat = element->GetMaterialParameter(MaterialsLatentheatEnum);
+ 	IssmDouble rho_ice    = element->GetMaterialParameter(MaterialsRhoIceEnum);
++	IssmDouble rho_water  = element->GetMaterialParameter(MaterialsRhoWaterEnum);
+ 	Input* enthalpy_input         = element->GetInput(EnthalpyEnum);                    _assert_(enthalpy_input);
+ 	Input* geothermalflux_input   = element->GetInput(BasalforcingsGeothermalfluxEnum); _assert_(geothermalflux_input);
+ 	Input* vx_input               = element->GetInput(VxEnum);                          _assert_(vx_input);
+@@ -941,11 +942,9 @@
+ 			geothermalflux_input->GetInputValue(&geothermalflux,gauss);
+ 			/* -Mb= Fb-(q-q_geo)/((1-w)*L), cf Aschwanden 2012, eq.66*/
+ 			heating[is]=(heatflux+basalfriction+geothermalflux);
+-			meltingrate_enthalpy[is]=heating[is]/((1-waterfraction)*latentheat*rho_ice); // m/s water equivalent //????
++			meltingrate_enthalpy[is]=heating[is]/((1-waterfraction)*latentheat*rho_water); // m/s water equivalent
+ 		}
+ 	}
+-	/* enthalpy might have been changed, update */
+-	//element->AddInput(EnthalpyEnum,enthalpy,P1Enum);
+ 
+ 	/******** DRAINAGE *****************************************/
+ 	IssmDouble* drainrate_column  = xNew<IssmDouble>(numsegments);
+@@ -986,6 +985,7 @@
+ 			basalmeltingrate[vertexdown]=meltingrate_enthalpy[is];
+ 			watercolumn[vertexdown]+=meltingrate_enthalpy[is];
+ 		}	
++		basalmeltingrate[vertexdown]*=rho_water/rho_ice; // convert meltingrate from water to ice equivalent
+ 		_assert_(watercolumn[vertexdown]>=0.);
+ 	}
+ 
+@@ -1054,7 +1054,7 @@
+ 		vertexdown = pairindices[is*2+0];
+ 		vertexup   = pairindices[is*2+1];
+ 		height_element=fabs(xyz_list[vertexup*3+2]-xyz_list[vertexdown*3+2]);
+-		pdrainrate_element[is]=(deltawaterfractions[vertexdown]+deltawaterfractions[vertexup])/2.*rho_water/rho_ice*height_element;
++		pdrainrate_element[is]=(deltawaterfractions[vertexdown]+deltawaterfractions[vertexup])/2.*height_element; // return water equivalent of drainage
+ 	}
+ 
+ 	/*Clean up and return*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17157-17158.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17157-17158.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17157-17158.diff	(revision 17802)
@@ -0,0 +1,30 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17157)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17158)
+@@ -1113,6 +1113,12 @@
+ 	delete gauss;
+ }
+ /*}}}*/
++Node* Tria::GetNode(int node_number){/*{{{*/
++	_assert_(node_number>=0); 
++	_assert_(node_number<this->NumberofNodes()); 
++	return this->nodes[node_number];
++
++}/*}}}*/
+ /*FUNCTION Tria::GetVertexPidList {{{*/
+ void  Tria::GetVertexPidList(int* doflist){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17157)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17158)
+@@ -229,7 +229,7 @@
+ 		void           GetInputValue(IssmDouble* pvalue,int enum_type);
+ 		void           GetInputValue(IssmDouble* pvalue,Gauss* gauss,int enum_type);
+ 		void           GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype);
+-		Node*          GetNode(int node_number){_error_("not implemented yet");};
++		Node*          GetNode(int node_number);
+ 		void	         InputChangeName(int enum_type,int enum_type_old);
+ 		void	         InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type);
+ 		void	         InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solution,int enum_type){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-17158-17159.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17158-17159.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17158-17159.diff	(revision 17802)
@@ -0,0 +1,299 @@
+Index: ../trunk-jpl/src/c/analyses/EnumToAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnumToAnalysis.cpp	(revision 17158)
++++ ../trunk-jpl/src/c/analyses/EnumToAnalysis.cpp	(revision 17159)
+@@ -35,7 +35,8 @@
+ 		case ExtrudeFromBaseAnalysisEnum : return new ExtrudeFromBaseAnalysis();
+ 		case ExtrudeFromTopAnalysisEnum : return new ExtrudeFromTopAnalysis();
+ 		case ThermalAnalysisEnum : return new ThermalAnalysis();
+-	  case LevelsetAnalysisEnum : return new LevelsetAnalysis();
++		case LevelsetAnalysisEnum : return new LevelsetAnalysis();
++		case ExtrapolationAnalysisEnum : return new ExtrapolationAnalysis();
+ 		#ifdef _HAVE_GIA_
+ 		case GiaAnalysisEnum : return new GiaAnalysis();
+ 		#endif
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17158)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17159)
+@@ -59,13 +59,19 @@
+ /*Finite element Analysis*/
+ void LevelsetAnalysis::Core(FemModel* femmodel){/*{{{*/
+ 
+-	#if !defined(_DEVELOPEMENT_)
++	#if !defined(_DEVELOPMENT_)
+ 	_error_("Not implemented yet");
+ 	#endif
+ 
+ 	/*parameters: */
+ 	bool save_results;
+ 
++	/* extrapolate */
++	Analysis* analysis = new ExtrapolationAnalysis();
++	femmodel->parameters->SetParam(VxEnum,ExtrapolationVariableEnum);
++	analysis->Core(femmodel);
++	delete analysis;
++
+ 	/*activate formulation: */
+ 	femmodel->SetCurrentConfiguration(LevelsetAnalysisEnum);
+ 
+Index: ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17158)
++++ ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17159)
+@@ -10,7 +10,7 @@
+ }
+ /*}}}*/
+ void ExtrapolationAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+-	_error_("not implemented yet");
++	//do nothing for now
+ }
+ /*}}}*/
+ void ExtrapolationAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+@@ -28,7 +28,6 @@
+ 			counter++;
+ 		}
+ 	}
+-	iomodel->FetchDataToInput(elements,ExtrapolationVariableEnum);//FIXME: is this the correct way?
+ }
+ /*}}}*/
+ void ExtrapolationAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+@@ -37,20 +36,18 @@
+ }
+ /*}}}*/
+ void ExtrapolationAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+-
+-	_error_("not implemented yet");
+-
++	// do nothing for now
+ }
+ /*}}}*/
+ void ExtrapolationAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+-	
+-	_error_("not implemented yet");
+-
++// 	do nothing for now
+ }/*}}}*/
+ 
+ /*Finite element Analysis*/
+ void ExtrapolationAnalysis::Core(FemModel* femmodel){/*{{{*/
+ 
++	/* Intermediaries */
++	bool save_results;
+ 	/*activate formulation: */
+ 	femmodel->SetCurrentConfiguration(ExtrapolationAnalysisEnum);
+ 
+@@ -58,6 +55,16 @@
+ 	UpdateConstraints(femmodel->elements);
+ 	solutionsequence_linear(femmodel);
+ 
++	/*recover parameters: */
++	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
++	if(save_results){
++		if(VerboseSolution()) _printf0_("   Warning: Adding extrapolated variable to results\n");
++		
++		int outputs; 
++		femmodel->parameters->FindParam(&outputs, ExtrapolationVariableEnum);
++		femmodel->RequestedOutputsx(&femmodel->results,&outputs,1);
++	}
++
+ }/*}}}*/
+ ElementVector* ExtrapolationAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+@@ -247,20 +254,20 @@
+ 	IssmDouble phi,value;
+ 	Node* node = NULL;
+ 
+-	/* Get further parameters */
++	/* Get parameters */
+ 	element->FindParam(&extvar_enum, ExtrapolationVariableEnum);
+ 	
+ 	Input* levelset_input=element->GetInput(MaskIceLevelsetEnum); _assert_(levelset_input);
+ 	Input* extvar_input=element->GetInput(extvar_enum); _assert_(extvar_input);
+-	
+-	GaussPenta* gauss=new GaussPenta();
++
++	Gauss* gauss=element->NewGauss();
+ 	for(int in=0;in<numnodes;in++){
+ 		gauss->GaussNode(element->GetElementType(),in);
+ 		node=element->GetNode(in);
+ 		levelset_input->GetInputValue(&phi,gauss);
+-		extvar_input->GetInputValue(&value,gauss);
+ 		if(phi<=0.){
+ 			/* if ice, set dirichlet BC */
++			extvar_input->GetInputValue(&value,gauss);
+ 			node->ApplyConstraint(1,value);
+ 		}
+ 		else {
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17158)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17159)
+@@ -351,6 +351,8 @@
+ 	GiaAnalysisEnum,
+ 	MeshdeformationSolutionEnum,
+ 	MeshdeformationAnalysisEnum,
++	LevelsetAnalysisEnum,
++	ExtrapolationAnalysisEnum,
+ 	/*}}}*/
+ 	/*Approximations {{{*/
+ 	ApproximationEnum,
+@@ -673,9 +675,7 @@
+ 	LliboutryDuvalEnum,
+ 	/*}}}*/
+ 	/*Levelset related enums (will be moved to appropriate place when finished){{{*/
+-	LevelsetAnalysisEnum,
+ 	TransientIslevelsetEnum,
+-	ExtrapolationAnalysisEnum,
+ 	ExtrapolationVariableEnum,
+ 	/*}}}*/
+ 	MaximumNumberOfDefinitionsEnum
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17158)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17159)
+@@ -352,6 +352,8 @@
+ 		case GiaAnalysisEnum : return "GiaAnalysis";
+ 		case MeshdeformationSolutionEnum : return "MeshdeformationSolution";
+ 		case MeshdeformationAnalysisEnum : return "MeshdeformationAnalysis";
++		case LevelsetAnalysisEnum : return "LevelsetAnalysis";
++		case ExtrapolationAnalysisEnum : return "ExtrapolationAnalysis";
+ 		case ApproximationEnum : return "Approximation";
+ 		case NoneApproximationEnum : return "NoneApproximation";
+ 		case SIAApproximationEnum : return "SIAApproximation";
+@@ -632,9 +634,7 @@
+ 		case PatersonEnum : return "Paterson";
+ 		case ArrheniusEnum : return "Arrhenius";
+ 		case LliboutryDuvalEnum : return "LliboutryDuval";
+-		case LevelsetAnalysisEnum : return "LevelsetAnalysis";
+ 		case TransientIslevelsetEnum : return "TransientIslevelset";
+-		case ExtrapolationAnalysisEnum : return "ExtrapolationAnalysis";
+ 		case ExtrapolationVariableEnum : return "ExtrapolationVariable";
+ 		case MaximumNumberOfDefinitionsEnum : return "MaximumNumberOfDefinitions";
+ 		default : return "unknown";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17158)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17159)
+@@ -358,6 +358,8 @@
+ 	      else if (strcmp(name,"GiaAnalysis")==0) return GiaAnalysisEnum;
+ 	      else if (strcmp(name,"MeshdeformationSolution")==0) return MeshdeformationSolutionEnum;
+ 	      else if (strcmp(name,"MeshdeformationAnalysis")==0) return MeshdeformationAnalysisEnum;
++	      else if (strcmp(name,"LevelsetAnalysis")==0) return LevelsetAnalysisEnum;
++	      else if (strcmp(name,"ExtrapolationAnalysis")==0) return ExtrapolationAnalysisEnum;
+ 	      else if (strcmp(name,"Approximation")==0) return ApproximationEnum;
+ 	      else if (strcmp(name,"NoneApproximation")==0) return NoneApproximationEnum;
+ 	      else if (strcmp(name,"SIAApproximation")==0) return SIAApproximationEnum;
+@@ -380,12 +382,12 @@
+ 	      else if (strcmp(name,"Results")==0) return ResultsEnum;
+ 	      else if (strcmp(name,"GenericParam")==0) return GenericParamEnum;
+ 	      else if (strcmp(name,"AdolcParam")==0) return AdolcParamEnum;
+-	      else if (strcmp(name,"BoolInput")==0) return BoolInputEnum;
+-	      else if (strcmp(name,"BoolParam")==0) return BoolParamEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"Contour")==0) return ContourEnum;
++	      if (strcmp(name,"BoolInput")==0) return BoolInputEnum;
++	      else if (strcmp(name,"BoolParam")==0) return BoolParamEnum;
++	      else if (strcmp(name,"Contour")==0) return ContourEnum;
+ 	      else if (strcmp(name,"ControlInput")==0) return ControlInputEnum;
+ 	      else if (strcmp(name,"DatasetInput")==0) return DatasetInputEnum;
+ 	      else if (strcmp(name,"DoubleInput")==0) return DoubleInputEnum;
+@@ -503,12 +505,12 @@
+ 	      else if (strcmp(name,"VzMesh")==0) return VzMeshEnum;
+ 	      else if (strcmp(name,"Enthalpy")==0) return EnthalpyEnum;
+ 	      else if (strcmp(name,"EnthalpyPicard")==0) return EnthalpyPicardEnum;
+-	      else if (strcmp(name,"ThicknessAbsGradient")==0) return ThicknessAbsGradientEnum;
+-	      else if (strcmp(name,"ThicknessAlongGradient")==0) return ThicknessAlongGradientEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"ThicknessAcrossGradient")==0) return ThicknessAcrossGradientEnum;
++	      if (strcmp(name,"ThicknessAbsGradient")==0) return ThicknessAbsGradientEnum;
++	      else if (strcmp(name,"ThicknessAlongGradient")==0) return ThicknessAlongGradientEnum;
++	      else if (strcmp(name,"ThicknessAcrossGradient")==0) return ThicknessAcrossGradientEnum;
+ 	      else if (strcmp(name,"IntMatParam")==0) return IntMatParamEnum;
+ 	      else if (strcmp(name,"RheologyBbarAbsGradient")==0) return RheologyBbarAbsGradientEnum;
+ 	      else if (strcmp(name,"DragCoefficientAbsGradient")==0) return DragCoefficientAbsGradientEnum;
+@@ -626,12 +628,12 @@
+ 	      else if (strcmp(name,"Sset")==0) return SsetEnum;
+ 	      else if (strcmp(name,"Verbose")==0) return VerboseEnum;
+ 	      else if (strcmp(name,"TriangleInterp")==0) return TriangleInterpEnum;
+-	      else if (strcmp(name,"BilinearInterp")==0) return BilinearInterpEnum;
+-	      else if (strcmp(name,"NearestInterp")==0) return NearestInterpEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"XY")==0) return XYEnum;
++	      if (strcmp(name,"BilinearInterp")==0) return BilinearInterpEnum;
++	      else if (strcmp(name,"NearestInterp")==0) return NearestInterpEnum;
++	      else if (strcmp(name,"XY")==0) return XYEnum;
+ 	      else if (strcmp(name,"XYZ")==0) return XYZEnum;
+ 	      else if (strcmp(name,"Dense")==0) return DenseEnum;
+ 	      else if (strcmp(name,"MpiDense")==0) return MpiDenseEnum;
+@@ -647,9 +649,7 @@
+ 	      else if (strcmp(name,"Paterson")==0) return PatersonEnum;
+ 	      else if (strcmp(name,"Arrhenius")==0) return ArrheniusEnum;
+ 	      else if (strcmp(name,"LliboutryDuval")==0) return LliboutryDuvalEnum;
+-	      else if (strcmp(name,"LevelsetAnalysis")==0) return LevelsetAnalysisEnum;
+ 	      else if (strcmp(name,"TransientIslevelset")==0) return TransientIslevelsetEnum;
+-	      else if (strcmp(name,"ExtrapolationAnalysis")==0) return ExtrapolationAnalysisEnum;
+ 	      else if (strcmp(name,"ExtrapolationVariable")==0) return ExtrapolationVariableEnum;
+ 	      else if (strcmp(name,"MaximumNumberOfDefinitions")==0) return MaximumNumberOfDefinitionsEnum;
+          else stage=7;
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp	(revision 17158)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp	(revision 17159)
+@@ -74,6 +74,7 @@
+ 		if(solution_enum==SteadystateSolutionEnum && analysis_enum==MeltingAnalysisEnum && isenthalpy==true) continue;
+ 		if(solution_enum==SteadystateSolutionEnum && analysis_enum==EnthalpyAnalysisEnum && isenthalpy==false) continue;
+ 		if(solution_enum==TransientSolutionEnum && analysis_enum==LevelsetAnalysisEnum && islevelset==false) continue;
++		if(solution_enum==TransientSolutionEnum && analysis_enum==ExtrapolationAnalysisEnum && islevelset==false) continue;
+ 
+ 
+ 		if(VerboseMProcessor()) _printf0_("   creating datasets for analysis " << EnumToStringx(analysis_enum) << "\n");
+Index: ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp	(revision 17158)
++++ ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp	(revision 17159)
+@@ -115,7 +115,7 @@
+ 			break;
+ 
+ 		case TransientSolutionEnum:
+-			numanalyses=13;
++			numanalyses=14;
+ 			analyses=xNew<int>(numanalyses);
+ 			analyses[ 0]=StressbalanceAnalysisEnum;
+ 			analyses[ 1]=StressbalanceVerticalAnalysisEnum;
+@@ -130,6 +130,7 @@
+ 			analyses[10]=ExtrudeFromBaseAnalysisEnum;
+ 			analyses[11]=ExtrudeFromTopAnalysisEnum;
+ 			analyses[12]=LevelsetAnalysisEnum;
++			analyses[13]=ExtrapolationAnalysisEnum;
+ 			break;
+ 
+ 		default:
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17158)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17159)
+@@ -344,6 +344,8 @@
+ def GiaAnalysisEnum(): return StringToEnum("GiaAnalysis")[0]
+ def MeshdeformationSolutionEnum(): return StringToEnum("MeshdeformationSolution")[0]
+ def MeshdeformationAnalysisEnum(): return StringToEnum("MeshdeformationAnalysis")[0]
++def LevelsetAnalysisEnum(): return StringToEnum("LevelsetAnalysis")[0]
++def ExtrapolationAnalysisEnum(): return StringToEnum("ExtrapolationAnalysis")[0]
+ def ApproximationEnum(): return StringToEnum("Approximation")[0]
+ def NoneApproximationEnum(): return StringToEnum("NoneApproximation")[0]
+ def SIAApproximationEnum(): return StringToEnum("SIAApproximation")[0]
+@@ -624,8 +626,6 @@
+ def PatersonEnum(): return StringToEnum("Paterson")[0]
+ def ArrheniusEnum(): return StringToEnum("Arrhenius")[0]
+ def LliboutryDuvalEnum(): return StringToEnum("LliboutryDuval")[0]
+-def LevelsetAnalysisEnum(): return StringToEnum("LevelsetAnalysis")[0]
+ def TransientIslevelsetEnum(): return StringToEnum("TransientIslevelset")[0]
+-def ExtrapolationAnalysisEnum(): return StringToEnum("ExtrapolationAnalysis")[0]
+ def ExtrapolationVariableEnum(): return StringToEnum("ExtrapolationVariable")[0]
+ def MaximumNumberOfDefinitionsEnum(): return StringToEnum("MaximumNumberOfDefinitions")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17159-17160.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17159-17160.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17159-17160.diff	(revision 17802)
@@ -0,0 +1,21 @@
+Index: ../trunk-jpl/src/m/plot/applyoptions.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/applyoptions.py	(revision 17159)
++++ ../trunk-jpl/src/m/plot/applyoptions.py	(revision 17160)
+@@ -1,5 +1,7 @@
+ try:
+ 	from matplotlib.ticker import MaxNLocator
++	from mpl_toolkits.axes_grid1 import make_axes_locatable
++	import matplotlib as mpl
+ 	import pylab as p
+ except ImportError:
+ 	print "could not import pylab, matplotlib has not been installed, no plotting capabilities enabled"
+@@ -175,7 +177,7 @@
+ 			fig = p.gcf()
+ 			ax = p.gca()
+ 			divider = make_axes_locatable(ax)
+-			cax = divider.new_horizontal("5%", pad=0.05, axes_class=maxes.Axes)
++			cax = divider.new_horizontal("5%", pad=0.05, axes_class=mpl.axes.Axes)
+ 			fig.add_axes(cax) 
+ 			cmap = mpl.cm.jet
+ 			norm = mpl.colors.Normalize(vmin=lims[0], vmax=lims[1])
Index: issm/oecreview/Archive/16554-17801/ISSM-17160-17161.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17160-17161.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17160-17161.diff	(revision 17802)
@@ -0,0 +1,52 @@
+Index: ../trunk-jpl/test/NightlyRun/test404.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test404.py	(revision 17160)
++++ ../trunk-jpl/test/NightlyRun/test404.py	(revision 17161)
+@@ -18,7 +18,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Vx','Vy','Vz','Vel','Pressure']
+-field_tolerances=[1.5e-07,1e-07,1e-06,1e-07,1e-07]
++field_tolerances=[1.5e-07,1e-07,1.4e-06,1e-07,1e-07]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Vx,\
+ 	md.results.StressbalanceSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test404.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test404.m	(revision 17160)
++++ ../trunk-jpl/test/NightlyRun/test404.m	(revision 17161)
+@@ -8,7 +8,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure'};
+-field_tolerances={1.5e-07,1e-07,1e-06,1e-07,1e-07};
++field_tolerances={1.5e-07,1e-07,1.4e-06,1e-07,1e-07};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test285.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test285.m	(revision 17160)
++++ ../trunk-jpl/test/NightlyRun/test285.m	(revision 17161)
+@@ -12,7 +12,7 @@
+ 	md.flowequation.fe_HO=i{1};
+ 	md=solve(md,StressbalanceSolutionEnum());
+ 	field_names     ={field_names{:},['Vx' i{1}],['Vy' i{1}],['Vz' i{1}],['Vel' i{1}],['Pressure' i{1}]};
+-	field_tolerances={field_tolerances{:},2e-08,2e-08,2e-08,2e-08,1e-13};
++	field_tolerances={field_tolerances{:},2.5e-08,2e-08,2e-08,2e-08,1e-13};
+ 	field_values={field_values{:},...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test285.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test285.py	(revision 17160)
++++ ../trunk-jpl/test/NightlyRun/test285.py	(revision 17161)
+@@ -22,7 +22,7 @@
+ 	md.flowequation.fe_HO=i
+ 	md=solve(md,StressbalanceSolutionEnum())
+ 	field_names     =field_names+['Vx'+i,'Vy'+i,'Vz'+i,'Vel'+i,'Pressure'+i]
+-	field_tolerances=field_tolerances+[2e-08,2e-08,2e-08,2e-08,1e-13]
++	field_tolerances=field_tolerances+[2.5e-08,2e-08,2e-08,2e-08,1e-13]
+ 	field_values=field_values+[\
+ 		md.results.StressbalanceSolution.Vx,\
+ 		md.results.StressbalanceSolution.Vy,\
Index: issm/oecreview/Archive/16554-17801/ISSM-17161-17162.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17161-17162.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17161-17162.diff	(revision 17802)
@@ -0,0 +1,572 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17161)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17162)
+@@ -116,9 +116,7 @@
+ 
+ 	/*Intermediaries*/
+ 	int      meshtype;
+-	bool     active_element;
+ 	Element* basalelement;
+-	Input*   active_element_input=NULL;
+ 
+ 	/*Get basal element*/
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+@@ -133,12 +131,8 @@
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+-	/* active_element_input=basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input); */
+-	/* active_element_input->GetInputValue(&active_element); */
+-
+ 	/*Check that all nodes are active, else return empty matrix*/
+ 	if(!basalelement->AllActive()) {
+-		//if(!active_element){
+ 	if(meshtype!=Mesh2DhorizontalEnum){
+ 			basalelement->DeleteMaterials(); 
+ 			delete basalelement;
+@@ -209,11 +203,8 @@
+ 
+ 	/*Intermediaries*/
+ 	int      meshtype;
+-	bool       active_element;
+ 	Element* basalelement;
+-	Input*   active_element_input=NULL;
+ 
+-
+ 	/*Get basal element*/
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+ 	switch(meshtype){
+@@ -226,12 +217,8 @@
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+-	/* active_element_input=basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input); */
+-	/* active_element_input->GetInputValue(&active_element); */
+-
+ 	/*Check that all nodes are active, else return empty matrix*/
+ 	if(!basalelement->AllActive()) {
+-		//if(!active_element){
+ 	if(meshtype!=Mesh2DhorizontalEnum){
+ 			basalelement->DeleteMaterials(); 
+ 			delete basalelement;
+@@ -311,19 +298,56 @@
+ }/*}}}*/
+ 
+ void HydrologyDCEfficientAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	int meshtype;
++
++	int meshtype,i;
++	Element*   basalelement=NULL;
++
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+-	switch(meshtype){
+-		case Mesh2DhorizontalEnum:
+-			element->InputUpdateFromSolutionOneDof(solution,EplHeadEnum);
+-			break;
+-		case Mesh3DEnum:
+-			element->InputUpdateFromSolutionOneDofCollapsed(solution,EplHeadEnum);
+-			break;
+-		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++
++	if(meshtype!=Mesh2DhorizontalEnum){
++		if(!element->IsOnBed()) return;
++		basalelement=element->SpawnBasalElement();
+ 	}
+-}/*}}}*/
++	else{
++		basalelement = element;
++	}
++	
++	/*Intermediary*/
++	int* doflist = NULL;
+ 
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = basalelement->GetNumberOfNodes();
++
++	/*Fetch dof list and allocate solution vector*/
++	basalelement->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
++	
++	IssmDouble* eplHeads    = xNew<IssmDouble>(numnodes);
++	IssmDouble* eplOldHeads    = xNew<IssmDouble>(numnodes);
++	IssmDouble  Stepping;
++
++
++	/*Use the dof list to index into the solution vector: */
++	for(i=0;i<numnodes;i++){
++		eplHeads[i]=solution[doflist[i]];
++		if(xIsNan<IssmDouble>(eplHeads[i])) _error_("NaN found in solution vector");
++	}
++
++	/*Get previous water head*/
++	basalelement->GetInputListOnNodes(&eplOldHeads[0],EplHeadOldEnum);
++	
++	for(i=0;i<numnodes;i++) {
++		eplHeads[i] = eplOldHeads[i]+0.8*(eplHeads[i]-eplOldHeads[i]);
++	}
++	/*Add input to the element: */
++	element->AddBasalInput(EplHeadEnum,eplHeads,P1Enum);
++
++	/*Free ressources:*/
++	xDelete<IssmDouble>(eplHeads);
++	xDelete<IssmDouble>(eplOldHeads);
++	xDelete<int>(doflist);
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++} /*}}}*/
++
+ /*Intermediaries*/
+ IssmDouble HydrologyDCEfficientAnalysis::EplSpecificStoring(Element* element){/*{{{*/
+ 	IssmDouble rho_freshwater        = element->GetMaterialParameter(MaterialsRhoFreshwaterEnum);
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17161)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17162)
+@@ -33,6 +33,7 @@
+ 	Vector<IssmDouble>* df=NULL;
+ 
+ 	bool       sedconverged,eplconverged,hydroconverged;
++	bool       transfered;
+ 	bool       isefficientlayer;
+ 	int        constraints_converged;
+ 	int        num_unstable_constraints;
+@@ -42,6 +43,7 @@
+ 	IssmDouble eps_hyd;
+ 	IssmDouble ndu_sed,nu_sed;
+ 	IssmDouble ndu_epl,nu_epl;
++	IssmDouble SedConv,EplConv;
+ 
+ 	/*Recover parameters: */
+ 	femmodel->SetCurrentConfiguration(HydrologyDCInefficientAnalysisEnum);
+@@ -50,7 +52,7 @@
+ 	femmodel->parameters->FindParam(&time,TimeEnum);
+ 
+ 	/*FIXME, hardcoded, put on an enum*/
+-	hydro_maxiter=150;
++	hydro_maxiter=100;
+ 
+ 	hydrocount=1;
+ 	hydroconverged=false;
+@@ -77,6 +79,8 @@
+ 	for(;;){
+ 		sedcount=1;
+ 		eplcount=1;
++		SedConv=1.0;
++		EplConv=1.0;
+ 
+ 		/*If there is two layers we need an outer loop value to compute convergence*/
+ 		if(isefficientlayer){
+@@ -128,10 +132,16 @@
+ 			sedconverged=false;
+ 			/*Update Elemental Mask and compute transfer*/
+ 			if(isefficientlayer){
+-				HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
+-				analysis->ElementizeEplMask(femmodel);
+-				delete analysis;
+-				femmodel->HydrologyTransferx();
++				if(SedConv<0.3){
++					HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
++					analysis->ElementizeEplMask(femmodel);
++					delete analysis;
++					femmodel->HydrologyTransferx();
++					transfered=true;
++				}
++				else{
++					transfered=false;
++				}
+ 			}
+ 			/*Checking convegence on the value of the sediment head*/
+ 			duf=uf_sed_sub_iter->Duplicate();_assert_(duf);
+@@ -143,12 +153,13 @@
+ 			if (xIsNan<IssmDouble>(ndu_sed) || xIsNan<IssmDouble>(nu_sed)) _error_("convergence criterion is NaN!");
+ 			if (ndu_sed==0.0 && nu_sed==0.0) nu_sed=1.0e-6; /*Hacking the case where the layer is empty*/
+ 			if(VerboseConvergence()) _printf0_(setw(50) << left << "   Inner Sediment Convergence criterion:" << ndu_sed/nu_sed*100 << " aiming lower than " << eps_hyd*100 << " %\n");
++			SedConv = ndu_sed/nu_sed*100;
+ 			if((ndu_sed/nu_sed)<eps_hyd){
+ 				if(VerboseConvergence()) _printf0_("   # Inner sediment convergence achieve \n");
+ 				sedconverged=true;
+ 			}
+ 			delete uf_sed_sub_iter;
+-			if(sedconverged){
++			if(sedconverged && transfered){
+ 				femmodel->parameters->SetParam(sediment_kmax,HydrologySedimentKmaxEnum);
+ 				InputUpdateFromConstantx(femmodel,sedconverged,ConvergedEnum);
+ 				InputUpdateFromSolutionx(femmodel,ug_sed);
+@@ -160,7 +171,6 @@
+ 
+ 		/* {{{ *//*Now dealing with the EPL in the same way*/
+ 		if(isefficientlayer){
+-		
+ 			femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
+ 			/*updating mask*/
+ 			femmodel->HydrologyEPLupdateDomainx();
+@@ -169,12 +179,39 @@
+ 			femmodel->parameters->SetParam(HydrologyEfficientEnum,HydrologyLayerEnum);
+ 		
+ 			eplconverged=false;
++
+ 			for(;;){
++
+ 				ug_epl_sub_iter=ug_epl->Duplicate();_assert_(ug_epl_sub_iter);
+ 				ug_epl->Copy(ug_epl_sub_iter);
++
++				if(EplConv<0.3){
++					/* {{{ *//*Retriev the EPL head slopes and compute EPL Thickness*/
++					if(VerboseSolution()) _printf0_("computing EPL Head slope...\n");
++					femmodel->SetCurrentConfiguration(L2ProjectionEPLAnalysisEnum);
++					femmodel->UpdateConstraintsL2ProjectionEPLx();
++					femmodel->parameters->SetParam(EplHeadSlopeXEnum,InputToL2ProjectEnum);
++					solutionsequence_linear(femmodel);
++					femmodel->parameters->SetParam(EplHeadSlopeYEnum,InputToL2ProjectEnum);
++					solutionsequence_linear(femmodel);
++					femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
++					femmodel->HydrologyEPLThicknessx();
++					
++					//updating mask after the computation of the epl thickness (Allow to close too thin EPL)
++					femmodel->HydrologyEPLupdateDomainx();
++					/* }}} */
+ 				
+-				/*Loop on the epl layer to deal with the penalization, have been removed TO CHECK*/
+-												
++					/*Update Elemental Mask and compute transfer*/
++					HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
++					analysis->ElementizeEplMask(femmodel);
++					delete analysis;
++					femmodel->HydrologyTransferx();
++					transfered=true;
++				}
++				else{
++					transfered=false;
++				}
++				
+ 				SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
+ 				CreateNodalConstraintsx(&ys,femmodel->nodes,HydrologyDCEfficientAnalysisEnum);
+ 				Reduceloadx(pf,Kfs,ys); delete Kfs;
+@@ -188,28 +225,7 @@
+ 				Mergesolutionfromftogx(&ug_epl,uf_epl,ys,femmodel->nodes,femmodel->parameters); delete ys;
+ 				InputUpdateFromSolutionx(femmodel,ug_epl);
+ 				ConstraintsStatex(&constraints_converged,&num_unstable_constraints,femmodel);
+-				
+-				/* {{{ *//*Start by retrieving the EPL head slopes and compute EPL Thickness*/
+-				if(VerboseSolution()) _printf0_("computing EPL Head slope...\n");
+-				femmodel->SetCurrentConfiguration(L2ProjectionEPLAnalysisEnum);
+-				femmodel->UpdateConstraintsL2ProjectionEPLx();
+-				femmodel->parameters->SetParam(EplHeadSlopeXEnum,InputToL2ProjectEnum);
+-				solutionsequence_linear(femmodel);
+-				femmodel->parameters->SetParam(EplHeadSlopeYEnum,InputToL2ProjectEnum);
+-				solutionsequence_linear(femmodel);
+-				femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
+-				femmodel->HydrologyEPLThicknessx();
+-				
+-				//updating mask after the computation of the epl thickness (Allow to close too thin EPL)
+-				femmodel->HydrologyEPLupdateDomainx();
+-				/* }}} */
+-				
+-				/*Update Elemental Mask and compute transfer*/
+-				HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
+-				analysis->ElementizeEplMask(femmodel);
+-				delete analysis;
+-				femmodel->HydrologyTransferx();
+-				
++						
+ 				dug=ug_epl_sub_iter->Duplicate();_assert_(dug);
+ 				ug_epl_sub_iter->Copy(dug);
+ 				dug->AYPX(ug_epl,-1.0);
+@@ -219,14 +235,17 @@
+ 				if (xIsNan<IssmDouble>(ndu_epl) || xIsNan<IssmDouble>(nu_epl)) _error_("convergence criterion is NaN!");
+ 				if (ndu_epl==0.0 && nu_epl==0.0) nu_epl=1.0e-6; /*Hacking the case where the EPL is used but empty*/
+ 				if(VerboseConvergence()) _printf0_(setw(50) << left << "   Inner EPL Convergence criterion:" << ndu_epl/nu_epl*100 << " aiming lower than " << eps_hyd*100 << " %\n");
++				EplConv=ndu_epl/nu_epl*100;
+ 				if((ndu_epl/nu_epl)<eps_hyd) eplconverged=true;
+ 				if (eplcount>=hydro_maxiter){
+ 					_error_("   maximum number of EPL iterations (" << hydro_maxiter << ") exceeded");
+ 				}
++				
+ 				eplcount++;
+ 				
+ 				delete ug_epl_sub_iter;
+-				if(eplconverged){
++				if(eplconverged && transfered){
++					if(VerboseSolution()) _printf0_("eplconverged...\n");
+ 					InputUpdateFromConstantx(femmodel,eplconverged,ConvergedEnum);
+ 					InputUpdateFromConstantx(femmodel,sediment_kmax,MeltingOffsetEnum);
+ 					InputUpdateFromSolutionx(femmodel,ug_epl);
+@@ -258,7 +277,7 @@
+ 			if (xIsNan<IssmDouble>(ndu_epl) || xIsNan<IssmDouble>(nu_epl)) _error_("EPL convergence criterion is NaN!");
+ 			if (ndu_epl==0.0 && nu_epl==0.0) nu_epl=1.0e-6; /*Hacking the case where the EPL is used but empty*/
+ 			if (!xIsNan<IssmDouble>(eps_hyd)){
+-				if ((ndu_epl/nu_epl)<eps_hyd && (ndu_sed/nu_sed)<(eps_hyd*10)){
++				if ((ndu_epl/nu_epl)<eps_hyd && (ndu_sed/nu_sed)<(eps_hyd)){
+ 					if (VerboseConvergence()) _printf0_(setw(50) << left << "   Converged after, " << hydrocount << " iterations \n");
+ 					hydroconverged=true;
+ 				}
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17161)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17162)
+@@ -1422,12 +1422,13 @@
+ /*}}}*/
+ void FemModel::HydrologyTransferx(void){ /*{{{*/
+ 
+-	Vector<IssmDouble>* transferg=NULL; 
++	Vector<IssmDouble>* transferg=NULL;
+ 
+ 	/*Vector allocation*/
+ 	transferg=new Vector<IssmDouble>(nodes->NumberOfNodes());
+ 
+ 	for (int i=0;i<elements->Size();i++){
++
+ 		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+ 		element->GetHydrologyTransfer(transferg);
+ 	}
+@@ -1439,6 +1440,7 @@
+ 	delete transferg;
+ }
+ /*}}}*/
++
+ void FemModel::HydrologyEPLThicknessx(void){ /*{{{*/
+ 
+ 	for (int i=0;i<elements->Size();i++){
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17161)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17162)
+@@ -1565,8 +1565,8 @@
+ 				name==ConvergedEnum ||
+ 				name==SedimentHeadOldEnum ||
+ 				name==SedimentHeadEnum ||
+-				name==EplHeadOldEnum ||
+ 				name==EplHeadEnum ||
++				name==EplHeadOldEnum ||
+ 				name==HydrologydcEplThicknessOldEnum ||
+ 				name==HydrologydcEplInitialThicknessEnum ||
+ 				name==HydrologydcEplThicknessEnum ||
+@@ -4724,42 +4724,41 @@
+ 
+ 	const int  numdof   = NDOF1 *NUMVERTICES;
+ 	int        *doflist = NULL;
++	int        analysis_type;
+ 	bool       isefficientlayer;
+ 	bool       active_element;
+-	int        transfermethod,step;
++	int        transfermethod;
+ 	IssmDouble leakage,h_max;
+ 	IssmDouble wh_trans,sed_thick;
++	IssmDouble epl_specificstoring,sedstoring;
+ 	IssmDouble activeEpl[numdof],epl_thickness[numdof];
+-	IssmDouble epl_specificstoring[numdof],sedstoring[numdof];
+ 	IssmDouble epl_head[numdof],sed_head[numdof];
+-	IssmDouble old_transfer[numdof],sed_trans[numdof];
++	IssmDouble preceding_transfer[numdof],sed_trans[numdof];
+ 
+ 	Input* active_element_input=NULL;
+ 
++	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+ 		
+ 	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+ 
+ 	/*Get the flag to know if the efficient layer is present*/
+ 	this->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);
+ 
+-	this->parameters->FindParam(&step,StepEnum);
+-
+ 	if(isefficientlayer){
+ 		/*Also get the flag to the transfer method*/
+ 		this->parameters->FindParam(&transfermethod,HydrologydcTransferFlagEnum);
+-
++		
+ 		/*Switch between the different transfer methods cases*/
+ 		switch(transfermethod){
+ 		case 0:
+ 			/*Just keepping the transfer to zero, should be OK with the initial value of transfer*/
+ 			break;
+ 		case 1:
+-
+ 	
+ 			active_element_input=inputs->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);
+ 			active_element_input->GetInputValue(&active_element);
+ 
+-			GetInputListOnVertices(&sed_head[0],SedimentHeadEnum); 
++			GetInputListOnVertices(&sed_head[0],SedimentHeadEnum);
+ 			GetInputListOnVertices(&sed_trans[0],HydrologydcSedimentTransmitivityEnum);
+ 			GetInputListOnVertices(&epl_head[0],EplHeadEnum);
+ 			GetInputListOnVertices(&epl_thickness[0],HydrologydcEplThicknessEnum);
+@@ -4772,40 +4771,31 @@
+ 				/*No transfer if the EPL is not active*/
+ 			}
+ 			else{
+-			
+-				GetInputListOnVertices(&old_transfer[0],WaterTransferEnum);
+-			
++				GetInputListOnVertices(&preceding_transfer[0],WaterTransferEnum);
++				sedstoring=matpar->GetSedimentStoring();
++				epl_specificstoring=matpar->GetEplSpecificStoring();
++					
+ 				for(int i=0;i<numdof;i++){
+-					epl_specificstoring[i]=matpar->GetEplSpecificStoring();		
+-					sedstoring[i]=matpar->GetSedimentStoring();
+ 					this->GetHydrologyDCInefficientHmax(&h_max,i);
+-										
+-					//avoiding transfer at first time
+-					if(epl_head[i]==0.0)epl_head[i]=sed_head[i];
++			
+ 					/*EPL head higher than sediment head, transfer from the epl to the sediment*/
+ 					if(epl_head[i]>sed_head[i]){
+-						wh_trans=epl_specificstoring[i]*epl_thickness[i]*sed_trans[i]*(epl_head[i]-sed_head[i])/(leakage*sed_thick);				
++						wh_trans=epl_specificstoring*epl_thickness[i]*sed_trans[i]*(epl_head[i]-sed_head[i])/(leakage*sed_thick);
+ 						/*No transfer if the sediment head is allready at the maximum*/
+ 						if(sed_head[i]>=h_max){
+ 							wh_trans=0.0;
+ 						}
+ 					}
+-					/*EPL head lower than sediment head, transfer from the sediment to the epl*/
++					/* EPL head lower than sediment head, transfer from the sediment to the epl */
+ 					else if(epl_head[i]<=sed_head[i]){
+-						wh_trans=sedstoring[i]*sed_trans[i]*(epl_head[i]-sed_head[i])/(leakage*sed_thick);
++						wh_trans=sedstoring*sed_trans[i]*(epl_head[i]-sed_head[i])/(leakage*sed_thick);
+ 					}
+-
+-					/*Introduce relaxation*/
+-					//					wh_trans=old_transfer[i]+0.66*(wh_trans-old_transfer[i]);
+-
+-					/* if(this->Id()==27){ */
+-						/* printf("old %e, transfer is %e ,eplhead %e, sedhead %e, factor %e \n",old_transfer[i],wh_trans,epl_head[i],sed_head[i],epl_specificstoring[i]*epl_thickness[i]*sed_trans[i]); */
+-					/* } */
+-				
++					
++					/*Relaxation stuff*/
++					wh_trans=preceding_transfer[i]+0.8*(wh_trans-preceding_transfer[i]);
++					
+ 					/*Assign output pointer*/
+ 					transfer->SetValue(doflist[i],wh_trans,INS_VAL);
+-
+-					
+ 				}
+ 			}
+ 			break;
+@@ -4845,6 +4835,7 @@
+ 	/*Intermediaries*/
+ 	int         i,j;
+ 	const int   numdof         = NDOF1 *NUMVERTICES;
++	IssmDouble  init_thick;
+ 	IssmDouble  h_max;
+ 	IssmDouble  sedheadmin;
+ 	IssmDouble  epl_thickness[numdof];
+@@ -4856,6 +4847,8 @@
+ 	bool       active_element;
+ 	Input* active_element_input=NULL;
+ 
++	init_thick = matpar->GetEplInitialThickness();
++
+ 	active_element_input=inputs->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);
+ 	active_element_input->GetInputValue(&active_element);
+ 
+@@ -4875,17 +4868,16 @@
+ 			vec_mask->SetValue(nodes[i]->Sid(),1.,INS_VAL);
+ 		}
+ 
+-		/*If mask was alread one, keep one*/
++		/*If mask was already one, keep one*/
+ 		else if(old_active[i]>0.){
+ 			vec_mask->SetValue(nodes[i]->Sid(),1.,INS_VAL);
++			/*If epl thickness gets under , close the layer*/
++			if(epl_thickness[i]<0.001*init_thick){
++				vec_mask->SetValue(nodes[i]->Sid(),0.,INS_VAL);
++			}
+ 		}
+-		/*If epl thickness gets under 0, close the layer*/
+-		else if(epl_thickness[i]<0.0){
+-			vec_mask->SetValue(nodes[i]->Sid(),0.,INS_VAL);
+-		}
+ 		/*Increase of the efficient system is needed if the epl head reach the maximum value (sediment max value for now)*/
+ 		this->GetHydrologyDCInefficientHmax(&h_max,i);
+-		//if(eplhead[i]>=h_max && this->AnyActive()){
+ 		if(eplhead[i]>=h_max && active_element){
+ 			for(j=0;j<numdof;j++){
+ 				if(old_active[j]>0.){
+@@ -4894,7 +4886,6 @@
+ 				/*Increase of the domain is on the downstream node in term of sediment head*/
+ 				if(sedhead[j] == sedheadmin){
+ 					vec_mask->SetValue(nodes[j]->Sid(),1.,INS_VAL);
+-					//	break;
+ 				}
+ 			}
+ 		}
+@@ -4907,16 +4898,17 @@
+ 	int         i;
+ 	const int   numdof         = NDOF1 *NUMVERTICES;
+ 	bool        isefficientlayer;
++	bool        active_element;
+ 	IssmDouble  n,A,dt,init_thick;
+ 	IssmDouble  rho_water,rho_ice;
+ 	IssmDouble  gravity,latentheat,EPLgrad2;
+ 	IssmDouble  EPL_N,epl_conductivity;
+ 	IssmDouble  activeEpl[numdof],thickness[numdof];
+-	IssmDouble  eplhead[numdof], old_thickness[numdof];
++	IssmDouble  eplhead[numdof],old_eplhead[numdof];
+ 	IssmDouble  epl_slopeX[numdof],epl_slopeY[numdof];
++	IssmDouble  preceding_thickness[numdof],old_thickness[numdof];
+ 	IssmDouble  ice_thickness[numdof],bed[numdof];
+ 
+-	bool       active_element;
+ 	Input* active_element_input=NULL;
+ 
+ 	/*Get the flag to know if the efficient layer is present*/
+@@ -4924,6 +4916,7 @@
+ 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+ 
+ 	if(isefficientlayer){
++
+ 		/*For now, assuming just one way to compute EPL thickness*/
+ 		rho_water        = matpar->GetRhoWater();
+ 		rho_ice          = matpar->GetRhoIce();
+@@ -4934,8 +4927,6 @@
+ 		n                = material->GetN();
+ 		A                = material->GetAbar();
+ 		
+-		//	GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveNodeEnum);
+-
+ 		active_element_input=inputs->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);
+ 		active_element_input->GetInputValue(&active_element);
+ 			
+@@ -4946,27 +4937,27 @@
+ 		GetInputListOnVertices(&ice_thickness[0],ThicknessEnum);
+ 		GetInputListOnVertices(&bed[0],BedEnum);
+ 		
+-		//if(!this->AnyActive()){
+ 		if(!active_element){
+ 			/*Keeping thickness to initial value if EPL is not active*/
+-			for(int i=0;i<numdof;i++){ 
++			for(int i=0;i<numdof;i++){
+ 				thickness[i]=init_thick;
+ 			}
+ 		}
+ 		else{
+-			for(int i=0;i<numdof;i++){ 
+-					/*Compute first the effective pressure in the EPL*/
+-					EPL_N=gravity*((rho_ice*ice_thickness[i])-(rho_water*(eplhead[i]-bed[i])));
+-					if(EPL_N<0.0)EPL_N=0.0;
+-					/*Get then the square of the gradient of EPL heads*/
+-					EPLgrad2 = (epl_slopeX[i]*epl_slopeX[i]+epl_slopeY[i]*epl_slopeY[i]);
++			GetInputListOnVertices(&preceding_thickness[0],HydrologydcEplThicknessEnum);
++			for(int i=0;i<numdof;i++){
++				
++				/*Compute first the effective pressure in the EPL*/
++				EPL_N=gravity*((rho_ice*ice_thickness[i])-(rho_water*(eplhead[i]-bed[i])));
++				if(EPL_N<0.0)EPL_N=0.0;
++				/*Get then the square of the gradient of EPL heads*/
++				EPLgrad2 = (epl_slopeX[i]*epl_slopeX[i]+epl_slopeY[i]*epl_slopeY[i]);
++				
++				/*And proceed to the real thing*/
++				thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*EPLgrad2-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
+ 					
+-					/*And proceed to the real thing*/
+-					thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*EPLgrad2-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
+-					//					thickness[i] = old_thickness[i]+0.66*(thickness[i]-old_thickness[i]);
+-					/* if(this->Id()==27){ */
+-					/* 	printf("old %e, thickness is %e ,eplhead %e, slopeX %e, slopeY %e\n",old_thickness[i],thickness[i],eplhead[i],epl_slopeX[i],epl_slopeY[i]); */
+-					/*}*/
++				/*Relaxation stuff*/
++				thickness[i] = preceding_thickness[i]+0.8*(thickness[i]-preceding_thickness[i]);
+ 			}
+ 		}
+ 		this->inputs->AddInput(new TriaInput(HydrologydcEplThicknessEnum,thickness,P1Enum));
Index: issm/oecreview/Archive/16554-17801/ISSM-17162-17163.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17162-17163.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17162-17163.diff	(revision 17802)
@@ -0,0 +1,15 @@
+Index: ../trunk-jpl/src/m/solve/WriteData.m
+===================================================================
+--- ../trunk-jpl/src/m/solve/WriteData.m	(revision 17162)
++++ ../trunk-jpl/src/m/solve/WriteData.m	(revision 17163)
+@@ -151,7 +151,9 @@
+ 	end
+ 
+ 	%first write length of record
+-	fwrite(fid,4+4+8*s(1)*s(2)+4+4,'int');  %2 integers (32 bits) + the double matrix + code + matrix type
++	recordlength=4+4+8*s(1)*s(2)+4+4; %2 integers (32 bits) + the double matrix + code + matrix type
++	if recordlength>2^31; error(['field ' EnumToString(enum) ' cannot be marshalled because it is larger than 2^31 bytes!']); end
++	fwrite(fid,recordlength,'int');
+ 
+ 	%write data code and matrix type: 
+ 	fwrite(fid,FormatToCode(format),'int'); 
Index: issm/oecreview/Archive/16554-17801/ISSM-17163-17164.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17163-17164.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17163-17164.diff	(revision 17802)
@@ -0,0 +1,32 @@
+Index: ../trunk-jpl/src/m/enum/ExtrapolationVariableEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/ExtrapolationVariableEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/ExtrapolationVariableEnum.m	(revision 17164)
+@@ -0,0 +1,11 @@
++function macro=ExtrapolationVariableEnum()
++%EXTRAPOLATIONVARIABLEENUM - Enum of ExtrapolationVariable
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=ExtrapolationVariableEnum()
++
++macro=StringToEnum('ExtrapolationVariable');
+Index: ../trunk-jpl/src/m/enum/ExtrapolationAnalysisEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/ExtrapolationAnalysisEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/ExtrapolationAnalysisEnum.m	(revision 17164)
+@@ -0,0 +1,11 @@
++function macro=ExtrapolationAnalysisEnum()
++%EXTRAPOLATIONANALYSISENUM - Enum of ExtrapolationAnalysis
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=ExtrapolationAnalysisEnum()
++
++macro=StringToEnum('ExtrapolationAnalysis');
Index: issm/oecreview/Archive/16554-17801/ISSM-17164-17165.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17164-17165.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17164-17165.diff	(revision 17802)
@@ -0,0 +1,14 @@
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17164)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17165)
+@@ -143,6 +143,9 @@
+ 					transfered=false;
+ 				}
+ 			}
++			else{
++				transfered=true;
++			}
+ 			/*Checking convegence on the value of the sediment head*/
+ 			duf=uf_sed_sub_iter->Duplicate();_assert_(duf);
+ 			uf_sed_sub_iter->Copy(duf);
Index: issm/oecreview/Archive/16554-17801/ISSM-17165-17166.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17165-17166.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17165-17166.diff	(revision 17802)
@@ -0,0 +1,192 @@
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h	(revision 17165)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h	(revision 17166)
+@@ -39,6 +39,7 @@
+ 		/*Modules*/
+ 		static void PostProcessing(FemModel* femmodel);
+ 		static void ComputeBasalMeltingrate(Element* element);
++		static void DrainWaterfractionIcecolumn(Element* element);
+ 		static void DrainWaterfraction(Element* element, IssmDouble* pdrainrate_element);
+ 		static void UpdateBasalConstraints(Element* element);
+ 
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17165)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17166)
+@@ -820,27 +820,41 @@
+ 
+ 
+ /*Modules*/
+-/*{{{*/
+-void EnthalpyAnalysis::PostProcessing(FemModel* femmodel){
++void EnthalpyAnalysis::PostProcessing(FemModel* femmodel){/*{{{*/
++
+ 	/*Intermediaries*/
+-	int solution_type;
++	int solution_type, i;
++	bool computebasalmeltingrates=true;
++	bool isdrainage=true;
++	bool updatebasalconstraints=true;
+ 
+-	/*Compute basal melting rates: */
+-	for(int i=0;i<femmodel->elements->Size();i++){
+-		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+-		ComputeBasalMeltingrate(element);
++	if(isdrainage){
++		/*Drain excess water fraction in ice column: */
++		for(i=0;i<femmodel->elements->Size();i++){
++			Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++			DrainWaterfractionIcecolumn(element);
++		}
+ 	}
+ 
+-	/*Update basal dirichlet BCs for enthalpy in transient runs: */
+-	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
+-	if(solution_type==TransientSolutionEnum){
+-		for(int i=0;i<femmodel->elements->Size();i++){
++	if(computebasalmeltingrates){
++		/*Compute basal melting rates: */
++		for(i=0;i<femmodel->elements->Size();i++){
+ 			Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+-			UpdateBasalConstraints(element);
++			ComputeBasalMeltingrate(element);
+ 		}
+ 	}
++
++	if(updatebasalconstraints){
++		/*Update basal dirichlet BCs for enthalpy in transient runs: */
++		femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
++		if(solution_type==TransientSolutionEnum){
++			for(i=0;i<femmodel->elements->Size();i++){
++				Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++				UpdateBasalConstraints(element);
++			}
++		}
++	}
+ }/*}}}*/
+-
+ void EnthalpyAnalysis::ComputeBasalMeltingrate(Element* element){/*{{{*/
+ 	/*Calculate the basal melt rates of the enthalpy model after Aschwanden 2012*/
+ 	/* melting rate is positive when melting, negative when refreezing*/
+@@ -945,23 +959,6 @@
+ 			meltingrate_enthalpy[is]=heating[is]/((1-waterfraction)*latentheat*rho_water); // m/s water equivalent
+ 		}
+ 	}
+-
+-	/******** DRAINAGE *****************************************/
+-	IssmDouble* drainrate_column  = xNew<IssmDouble>(numsegments);
+-	IssmDouble* drainrate_element = xNew<IssmDouble>(numsegments);
+-	for(is=0;is<numsegments;is++)	drainrate_column[is]=0.;
+-	Element* elementi = element;
+-	for(;;){
+-		for(is=0;is<numsegments;is++)	drainrate_element[is]=0.;
+-		DrainWaterfraction(elementi,drainrate_element); // TODO: make sure every vertex is only drained once
+-		for(is=0;is<numsegments;is++)	drainrate_column[is]+=drainrate_element[is];
+-
+-		if(elementi->IsOnSurface()) break;
+-		elementi=elementi->GetUpperElement();			
+-	}
+-	/* add drained water to melting rate*/
+-	for(is=0;is<numsegments;is++) meltingrate_enthalpy[is]+=drainrate_column[is];
+-
+ 	/******** UPDATE MELTINGRATES AND WATERCOLUMN **************/
+ 	element->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	for(is=0;is<numsegments;is++){
+@@ -969,12 +966,10 @@
+ 		vertexup   = pairindices[is*2+1];
+ 		if(dt!=0.){
+ 			if(watercolumn[vertexdown]+meltingrate_enthalpy[is]*dt<0.){	// prevent too much freeze on			
+-				melting_overshoot=watercolumn[vertexdown]+meltingrate_enthalpy[is]*dt;
+-				lambda=melting_overshoot/(meltingrate_enthalpy[is]*dt); _assert_(lambda>0); _assert_(lambda<1);
+-				basalmeltingrate[vertexdown]=(1.-lambda)*meltingrate_enthalpy[is];
++				lambda = -watercolumn[vertexdown]/(dt*meltingrate_enthalpy[is]); _assert_(lambda>=0.); _assert_(lambda<1.);
+ 				watercolumn[vertexdown]=0.;
+-				yts=365.*24.*60.*60.;
+-				enthalpy[vertexdown]+=dt/yts*lambda*heating[is];
++				basalmeltingrate[vertexdown]=lambda*meltingrate_enthalpy[is]; // restrict freeze on only to size of watercolumn
++				enthalpy[vertexdown]+=(1.-lambda)*meltingrate_enthalpy[is]*dt*latentheat; // use rest of energy to cool down base
+ 			}
+ 			else{
+ 				basalmeltingrate[vertexdown]=meltingrate_enthalpy[is];
+@@ -1003,11 +998,46 @@
+ 	xDelete<IssmDouble>(basalmeltingrate);
+ 	xDelete<IssmDouble>(meltingrate_enthalpy);
+ 	xDelete<IssmDouble>(heating);
++	xDelete<IssmDouble>(xyz_list);
++}/*}}}*/
++void EnthalpyAnalysis::DrainWaterfractionIcecolumn(Element* element){/*{{{*/
++
++	/* Only drain waterfraction of ice column from element at base*/
++	if(!element->IsOnBed()) return; //FIXME: allow freeze on for floating elements
++
++	/* Intermediaries*/
++	int is, numvertices, numsegments;
++	int *pairindices   = NULL;
++
++	numvertices=element->GetNumberOfVertices();
++	element->VerticalSegmentIndices(&pairindices,&numsegments);
++
++	IssmDouble* watercolumn = xNew<IssmDouble>(numvertices);
++	IssmDouble* drainrate_column  = xNew<IssmDouble>(numsegments);
++	IssmDouble* drainrate_element = xNew<IssmDouble>(numsegments);
++
++	element->GetInputListOnVertices(watercolumn,WatercolumnEnum);
++
++	for(is=0;is<numsegments;is++)	drainrate_column[is]=0.;
++	Element* elementi = element;
++	for(;;){
++		for(is=0;is<numsegments;is++)	drainrate_element[is]=0.;
++		DrainWaterfraction(elementi,drainrate_element); // TODO: make sure every vertex is only drained once
++		for(is=0;is<numsegments;is++)	drainrate_column[is]+=drainrate_element[is];
++
++		if(elementi->IsOnSurface()) break;
++		elementi=elementi->GetUpperElement();			
++	}
++	/* add drained water to water column*/
++	for(is=0;is<numsegments;is++) watercolumn[is]+=drainrate_column[is];
++	/* Feed updated water column back into model */
++	element->AddInput(WatercolumnEnum,watercolumn,P1Enum);
++
++	delete pairindices;
+ 	xDelete<IssmDouble>(drainrate_column);
+ 	xDelete<IssmDouble>(drainrate_element);
+-	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(watercolumn);
+ }/*}}}*/
+-
+ void EnthalpyAnalysis::DrainWaterfraction(Element* element, IssmDouble* pdrainrate_element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+@@ -1055,6 +1085,7 @@
+ 		vertexup   = pairindices[is*2+1];
+ 		height_element=fabs(xyz_list[vertexup*3+2]-xyz_list[vertexdown*3+2]);
+ 		pdrainrate_element[is]=(deltawaterfractions[vertexdown]+deltawaterfractions[vertexup])/2.*height_element; // return water equivalent of drainage
++		_assert_(pdrainrate_element[is]>=0.);
+ 	}
+ 
+ 	/*Clean up and return*/
+@@ -1065,7 +1096,6 @@
+ 	xDelete<IssmDouble>(waterfractions);
+ 	xDelete<IssmDouble>(deltawaterfractions);
+ }/*}}}*/
+-
+ void EnthalpyAnalysis::UpdateBasalConstraints(Element* element){/*{{{*/
+ 
+ 	/*Intermediary*/
+@@ -1119,13 +1149,11 @@
+ 		else
+ 			setspc = false;
+ 
+-
+-
+ 		node=element->GetNode(indices[i]);
+ 		if (setspc) 
+-			node->ApplyConstraint(1,h_pmp); /*apply spc*/ //nodes[indices[i]]->ApplyConstraint(1,h_pmp);
++			node->ApplyConstraint(1,h_pmp); /*apply spc*/ 
+ 		else			
+-			node->DofInFSet(0); /*remove spc*/ //nodes[indices[i]]->DofInFSet(0);
++			node->DofInFSet(0); /*remove spc*/ 
+ 	}
+ 
+ 	/*Free ressources:*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17166-17167.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17166-17167.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17166-17167.diff	(revision 17802)
@@ -0,0 +1,18 @@
+Index: ../trunk-jpl/src/m/solve/WriteData.py
+===================================================================
+--- ../trunk-jpl/src/m/solve/WriteData.py	(revision 17166)
++++ ../trunk-jpl/src/m/solve/WriteData.py	(revision 17167)
+@@ -200,8 +200,12 @@
+ 			s=(0,0)
+ 
+ 		#first write length of record
+-		fid.write(struct.pack('i',4+4+8*s[0]*s[1]+4+4))    #2 integers (32 bits) + the double matrix + code + matrix type
++		recordlength=4+4+8*s[0]*s[1]+4+4; #2 integers (32 bits) + the double matrix + code + matrix type
++		if recordlength > 2^31 :
++			raise ValueError('field %s cannot be marshalled because it is larger than 4^31 bytes!' % EnumToString(enum)[1])
+ 
++		fid.write(struct.pack('i',recordlength))  #2 integers (32 bits) + the double matrix + code + matrix type
++
+ 		#write data code and matrix type: 
+ 		fid.write(struct.pack('i',FormatToCode(format))) 
+ 		fid.write(struct.pack('i',mattype))
Index: issm/oecreview/Archive/16554-17801/ISSM-17167-17168.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17167-17168.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17167-17168.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/test/NightlyRun/runme.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/runme.py	(revision 17167)
++++ ../trunk-jpl/test/NightlyRun/runme.py	(revision 17168)
+@@ -261,7 +261,7 @@
+ 
+ 	parser = argparse.ArgumentParser(description='RUNME - test deck for ISSM nightly runs')
+ 	parser.add_argument('-i','--id', nargs='*', type=int, help='followed by the list of ids requested', default=[])
+-	parser.add_argument('-e','--exclude', nargs='*', type=int, help='ids to be excluded from the test', default=[])
++	parser.add_argument('-e','--exclude', nargs='+', type=int, help='ids to be excluded from the test', default=[])
+ 	parser.add_argument('-b','--benchmark', help='nightly/ismip/eismint/thermal/mesh/...', default='nightly')
+ 	parser.add_argument('-p','--procedure', help='check/update', default='check')
+ 	parser.add_argument('-o','--output', help='nightly/daily/none', default='none')
Index: issm/oecreview/Archive/16554-17801/ISSM-17168-17169.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17168-17169.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17168-17169.diff	(revision 17802)
@@ -0,0 +1,15 @@
+Index: ../trunk-jpl/src/m/solve/WriteData.py
+===================================================================
+--- ../trunk-jpl/src/m/solve/WriteData.py	(revision 17168)
++++ ../trunk-jpl/src/m/solve/WriteData.py	(revision 17169)
+@@ -201,8 +201,8 @@
+ 
+ 		#first write length of record
+ 		recordlength=4+4+8*s[0]*s[1]+4+4; #2 integers (32 bits) + the double matrix + code + matrix type
+-		if recordlength > 2^31 :
+-			raise ValueError('field %s cannot be marshalled because it is larger than 4^31 bytes!' % EnumToString(enum)[1])
++		if recordlength > 2**31 :
++			raise ValueError('field %s cannot be marshalled because it is larger than 4^31 bytes!' % EnumToString(enum)[0])
+ 
+ 		fid.write(struct.pack('i',recordlength))  #2 integers (32 bits) + the double matrix + code + matrix type
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17169-17170.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17169-17170.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17169-17170.diff	(revision 17802)
@@ -0,0 +1,10 @@
+Index: ../trunk-jpl/jenkins/linux64_murdo
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo	(revision 17169)
++++ ../trunk-jpl/jenkins/linux64_murdo	(revision 17170)
+@@ -121,4 +121,4 @@
+ #by Matlab and runme.m
+ #ex: "'id',[101 102 103]"
+ MATLAB_NROPTIONS="'exclude',[119,514,701,702]"
+-PYTHON_NROPTIONS="--exclude=119"
++PYTHON_NROPTIONS="--exclude 119 514 701 702"
Index: issm/oecreview/Archive/16554-17801/ISSM-17170-17171.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17170-17171.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17170-17171.diff	(revision 17802)
@@ -0,0 +1,77 @@
+Index: ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17170)
++++ ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17171)
+@@ -14,7 +14,7 @@
+ }
+ /*}}}*/
+ void ExtrapolationAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+-	int    stabilization,finiteelement;
++	int    finiteelement;
+ 
+ 	/*Finite element type*/
+ 	finiteelement = P1Enum;
+@@ -82,6 +82,7 @@
+ 	IssmDouble Jdet,D_scalar,h;
+ 	IssmDouble dlevelset[dim],normal[dim];
+ 	IssmDouble norm_dlevelset;
++	IssmDouble hx,hy,hz,kappa;
+ 	IssmDouble* xyz_list = NULL;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -100,7 +101,7 @@
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	Gauss* gauss=element->NewGauss(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
++	for(int ig=gauss->begin();ig<gauss->end();ig++){/*{{{*/
+ 		gauss->GaussPoint(ig);
+ 
+ 		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+@@ -127,10 +128,25 @@
+ 					Bprime,dim,numnodes,0,
+ 					&Ke->values[0],1);
+ 
++		/* Stabilization *//*{{{*/
+ 		stabilization=1;
+ 		if (stabilization==0){/* no stabilization, do nothing*/}
+ 		else if(stabilization==1){
+-			/*Streamline upwinding*/
++			/* Artificial Diffusion */
++			element->ElementSizes(&hx,&hy,&hz);
++			h=sqrt( pow(hx*normal[0],2) + pow(hy*normal[1],2));
++			kappa=h/2.; 
++			D[0][0]=D_scalar*kappa;
++			D[0][1]=0.;
++			D[1][0]=0.;
++			D[1][1]=D_scalar*kappa;
++			TripleMultiply(Bprime,dim,numnodes,1,
++						&D[0][0],dim,dim,0,
++						Bprime,dim,numnodes,0,
++						&Ke->values[0],1);
++		}
++		else if(stabilization==2){
++			/*Streamline upwinding - do not use this for extrapolation: yields oscillating results due to smoothing along normal, not across */
+ 			for(row=0;row<dim;row++)
+ 				for(col=0;col<dim;col++)
+ 					D[row][col]=h/(2.*1.)*normal[row]*normal[col];
+@@ -139,8 +155,8 @@
+ 						&D[0][0],dim,dim,0,
+ 						Bprime,dim,numnodes,0,
+ 						&Ke->values[0],1);
+-		}
+-	}
++		}/*}}}*/
++	}/*}}}*/
+ 
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(xyz_list);
+@@ -149,7 +165,7 @@
+ 	delete gauss;
+ 	return Ke;
+ 
+-	}/*}}}*/
++}/*}}}*/
+ ElementVector* ExtrapolationAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries */
Index: issm/oecreview/Archive/16554-17801/ISSM-17171-17172.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17171-17172.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17171-17172.diff	(revision 17802)
@@ -0,0 +1,684 @@
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17171)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17172)
+@@ -109,11 +109,264 @@
+ _error_("Not implemented");
+ }/*}}}*/
+ ElementMatrix* FreeSurfaceTopAnalysis::CreateKMatrix(Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	/*Intermediaries*/
++	int         meshtype,dim,stabilization;
++	Element*    topelement = NULL;
++	IssmDouble *xyz_list  = NULL;
++	IssmDouble  Jdet,D_scalar,dt,h;
++	IssmDouble  vel,vx,vy;
++
++	/*Get top element*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			topelement = element;
++			dim = 2;
++			break;
++		case Mesh2DverticalEnum:
++			if(!element->IsOnSurface()) return NULL;
++			topelement = element->SpawnTopElement();
++			dim = 1;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnSurface()) return NULL;
++			topelement = element->SpawnTopElement();
++			dim = 2;
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = topelement->GetNumberOfNodes();
++
++	/*Initialize Element vector*/
++	ElementMatrix* Ke     = topelement->NewElementMatrix(NoneApproximationEnum);
++	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
++	IssmDouble*    B      = xNew<IssmDouble>(dim*numnodes);
++	IssmDouble*    Bprime = xNew<IssmDouble>(dim*numnodes);
++	IssmDouble*    D      = xNew<IssmDouble>(dim*dim);
++
++	/*Retrieve all inputs and parameters*/
++	topelement->GetVerticesCoordinates(&xyz_list);
++	topelement->FindParam(&dt,TimesteppingTimeStepEnum);
++	topelement->FindParam(&stabilization,MasstransportStabilizationEnum);
++	Input* vx_input=topelement->GetInput(VxEnum); _assert_(vx_input);
++	Input* vy_input=NULL;
++	if(dim>1) topelement->GetInput(VyEnum); _assert_(vy_input);
++	h = topelement->CharacteristicLength();
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=topelement->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		topelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		topelement->NodalFunctions(basis,gauss);
++
++		vx_input->GetInputValue(&vx,gauss);
++		if(dim==2) vy_input->GetInputValue(&vy,gauss);
++
++		D_scalar=gauss->weight*Jdet;
++		TripleMultiply(basis,1,numnodes,1,
++					&D_scalar,1,1,0,
++					basis,1,numnodes,0,
++					&Ke->values[0],1);
++
++		GetB(B,element,dim,xyz_list,gauss);
++		GetBprime(Bprime,element,dim,xyz_list,gauss);
++
++		D_scalar=dt*gauss->weight*Jdet;
++
++		for(int i=0;i<dim*dim;i++) D[i]=0.;
++		D[0] = D_scalar*vx;
++		if(dim==2) D[1*dim+1] = D_scalar*vy;
++		TripleMultiply(B,dim,numnodes,1,
++					D,dim,dim,0,
++					B,dim,numnodes,0,
++					&Ke->values[0],1);
++
++		D[0*dim+0]=D_scalar*vx;
++		if(dim==2) D[1*dim+1]=D_scalar*vy;
++		TripleMultiply(B,dim,numnodes,1,
++					D,dim,dim,0,
++					Bprime,dim,numnodes,0,
++					&Ke->values[0],1);
++
++		if(stabilization==2){
++			/*Streamline upwinding*/
++			if(dim==1){
++				vel=fabs(vx)+1.e-8;
++				D[0] = h/(2.*vel)*vx;
++			}
++			else{
++				vel=sqrt(vx*vx+vy*vy)+1.e-8;
++				D[0*dim+0]=h/(2*vel)*vx*vx;
++				D[1*dim+0]=h/(2*vel)*vy*vx;
++				D[0*dim+1]=h/(2*vel)*vx*vy;
++				D[1*dim+1]=h/(2*vel)*vy*vy;
++			}
++		}
++		else if(stabilization==1){
++			/*SSA*/
++			if(dim==1){
++				vx_input->GetInputAverage(&vx);
++				D[0]=h/2.*fabs(vx);
++			}
++			else{
++				vx_input->GetInputAverage(&vx);
++				vy_input->GetInputAverage(&vy);
++				D[0*dim+0]=h/2.0*fabs(vx);
++				D[1*dim+1]=h/2.0*fabs(vy);
++			}
++		}
++		if(stabilization==1 || stabilization==2){
++			for(int i=0;i<dim*dim;i++) D[i]=D_scalar*D[i];
++			TripleMultiply(Bprime,dim,numnodes,1,
++						D,dim,dim,0,
++						Bprime,dim,numnodes,0,
++						&Ke->values[0],1);
++		}
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(B);
++	xDelete<IssmDouble>(Bprime);
++	xDelete<IssmDouble>(D);
++	delete gauss;
++	if(meshtype!=Mesh2DhorizontalEnum){topelement->DeleteMaterials(); delete topelement;};
++	return Ke;
+ }/*}}}*/
+ ElementVector* FreeSurfaceTopAnalysis::CreatePVector(Element* element){/*{{{*/
+-_error_("not implemented yet");
++	/*Intermediaries*/
++	int         meshtype,dim;
++	IssmDouble  Jdet,dt;
++	IssmDouble  ms,surface,vz;
++	Element*    topelement = NULL;
++	IssmDouble *xyz_list  = NULL;
++
++	/*Get top element*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			topelement = element;
++			dim = 2;
++			break;
++		case Mesh2DverticalEnum:
++			if(!element->IsOnSurface()) return NULL;
++			topelement = element->SpawnTopElement();
++			dim = 1;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnSurface()) return NULL;
++			topelement = element->SpawnTopElement();
++			dim = 2;
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = topelement->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementVector* pe    = topelement->NewElementVector();
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	topelement->GetVerticesCoordinates(&xyz_list);
++	topelement->FindParam(&dt,TimesteppingTimeStepEnum);
++	Input* ms_input      = topelement->GetInput(SurfaceforcingsMassBalanceEnum);  _assert_(ms_input);
++	Input* surface_input = topelement->GetInput(SurfaceEnum);                     _assert_(surface_input);
++	Input* vz_input      = NULL;
++	switch(dim){
++		case 1: vz_input = topelement->GetInput(VyEnum); _assert_(vz_input); break;
++		case 2: vz_input = topelement->GetInput(VzEnum); _assert_(vz_input); break;
++		default: _error_("not implemented");
++	}
++
++	/*Initialize mb_correction to 0, do not forget!:*/
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=topelement->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		topelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		topelement->NodalFunctions(basis,gauss);
++
++		ms_input->GetInputValue(&ms,gauss);
++		vz_input->GetInputValue(&vz,gauss);
++		surface_input->GetInputValue(&surface,gauss);
++
++		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*(surface + dt*ms + dt*vz)*basis[i];
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	if(meshtype!=Mesh2DhorizontalEnum){topelement->DeleteMaterials(); delete topelement;};
++	return pe;
++
+ }/*}}}*/
++void FreeSurfaceTopAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
++	 * For node i, Bi can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi=[ N ]
++	 *          [ N ]
++	 * where N is the finiteelement function for node i.
++	 *
++	 * We assume B_prog has been allocated already, of size: 2x(NDOF1*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions*/
++	IssmDouble* basis=xNew<IssmDouble>(numnodes);
++	element->NodalFunctions(basis,gauss);
++
++	/*Build B: */
++	for(int i=0;i<numnodes;i++){
++		for(int j=0;j<dim;i++){
++			B[numnodes*j+i] = basis[i];
++		}
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(basis);
++}/*}}}*/
++void FreeSurfaceTopAnalysis::GetBprime(IssmDouble* Bprime,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 
++	 * For node i, Bi' can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi_prime=[ dN/dx ]
++	 *                [ dN/dy ]
++	 * where N is the finiteelement function for node i.
++	 *
++	 * We assume B' has been allocated already, of size: 3x(NDOF2*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Build B': */
++	for(int i=0;i<numnodes;i++){
++		for(int j=0;j<dim;j++){
++			Bprime[numnodes*j+i] = dbasis[j*numnodes+i];
++		}
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(dbasis);
++
++}/*}}}*/
+ void FreeSurfaceTopAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h	(revision 17171)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h	(revision 17172)
+@@ -25,6 +25,8 @@
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
++		void GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBprime(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h	(revision 17171)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h	(revision 17172)
+@@ -25,6 +25,8 @@
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
++		void GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBprime(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17171)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17172)
+@@ -100,11 +100,269 @@
+ _error_("Not implemented");
+ }/*}}}*/
+ ElementMatrix* FreeSurfaceBaseAnalysis::CreateKMatrix(Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	/*Intermediaries*/
++	int         meshtype,dim,stabilization;
++	Element*    basalelement = NULL;
++	IssmDouble *xyz_list  = NULL;
++	IssmDouble  Jdet,D_scalar,dt,h;
++	IssmDouble  vel,vx,vy;
++
++	/*Get basal element*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			dim = 2;
++			break;
++		case Mesh2DverticalEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			dim = 1;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			dim = 2;
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = basalelement->GetNumberOfNodes();
++
++	/*Initialize Element vector*/
++	ElementMatrix* Ke     = basalelement->NewElementMatrix(NoneApproximationEnum);
++	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
++	IssmDouble*    B      = xNew<IssmDouble>(dim*numnodes);
++	IssmDouble*    Bprime = xNew<IssmDouble>(dim*numnodes);
++	IssmDouble*    D      = xNew<IssmDouble>(dim*dim);
++
++	/*Retrieve all inputs and parameters*/
++	basalelement->GetVerticesCoordinates(&xyz_list);
++	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
++	basalelement->FindParam(&stabilization,MasstransportStabilizationEnum);
++	Input* vx_input=basalelement->GetInput(VxEnum); _assert_(vx_input);
++	Input* vy_input=NULL;
++	if(dim>1) basalelement->GetInput(VyEnum); _assert_(vy_input);
++	h = basalelement->CharacteristicLength();
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=basalelement->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		basalelement->NodalFunctions(basis,gauss);
++
++		vx_input->GetInputValue(&vx,gauss);
++		if(dim==2) vy_input->GetInputValue(&vy,gauss);
++
++		D_scalar=gauss->weight*Jdet;
++		TripleMultiply(basis,1,numnodes,1,
++					&D_scalar,1,1,0,
++					basis,1,numnodes,0,
++					&Ke->values[0],1);
++
++		GetB(B,element,dim,xyz_list,gauss);
++		GetBprime(Bprime,element,dim,xyz_list,gauss);
++
++		D_scalar=dt*gauss->weight*Jdet;
++
++		for(int i=0;i<dim*dim;i++) D[i]=0.;
++		D[0] = D_scalar*vx;
++		if(dim==2) D[1*dim+1] = D_scalar*vy;
++		TripleMultiply(B,dim,numnodes,1,
++					D,dim,dim,0,
++					B,dim,numnodes,0,
++					&Ke->values[0],1);
++
++		D[0*dim+0]=D_scalar*vx;
++		if(dim==2) D[1*dim+1]=D_scalar*vy;
++		TripleMultiply(B,dim,numnodes,1,
++					D,dim,dim,0,
++					Bprime,dim,numnodes,0,
++					&Ke->values[0],1);
++
++		if(stabilization==2){
++			/*Streamline upwinding*/
++			if(dim==1){
++			 vel=fabs(vx)+1.e-8;
++			 D[0] = h/(2.*vel)*vx;
++			}
++			else{
++			 vel=sqrt(vx*vx+vy*vy)+1.e-8;
++			 D[0*dim+0]=h/(2*vel)*vx*vx;
++			 D[1*dim+0]=h/(2*vel)*vy*vx;
++			 D[0*dim+1]=h/(2*vel)*vx*vy;
++			 D[1*dim+1]=h/(2*vel)*vy*vy;
++			}
++		}
++		else if(stabilization==1){
++			/*SSA*/
++			if(dim==1){
++				vx_input->GetInputAverage(&vx);
++				D[0]=h/2.*fabs(vx);
++			}
++			else{
++				vx_input->GetInputAverage(&vx);
++				vy_input->GetInputAverage(&vy);
++				D[0*dim+0]=h/2.0*fabs(vx);
++				D[1*dim+1]=h/2.0*fabs(vy);
++			}
++		}
++		if(stabilization==1 || stabilization==2){
++			for(int i=0;i<dim*dim;i++) D[i]=D_scalar*D[i];
++			TripleMultiply(Bprime,dim,numnodes,1,
++						D,dim,dim,0,
++						Bprime,dim,numnodes,0,
++						&Ke->values[0],1);
++		}
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(B);
++	xDelete<IssmDouble>(Bprime);
++	xDelete<IssmDouble>(D);
++	delete gauss;
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	return Ke;
+ }/*}}}*/
+ ElementVector* FreeSurfaceBaseAnalysis::CreatePVector(Element* element){/*{{{*/
+-_error_("not implemented yet");
++	/*Intermediaries*/
++	int         meshtype,dim;
++	IssmDouble  Jdet,dt;
++	IssmDouble  mb,mb_correction,bed,vz;
++	Element*    basalelement = NULL;
++	IssmDouble *xyz_list  = NULL;
++
++	/*Get basal element*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			dim = 2;
++			break;
++		case Mesh2DverticalEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			dim = 1;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			dim = 2;
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = basalelement->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementVector* pe    = basalelement->NewElementVector();
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	basalelement->GetVerticesCoordinates(&xyz_list);
++	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
++	Input* mb_input            = basalelement->GetInput(BasalforcingsMeltingRateEnum);   _assert_(mb_input);
++	Input* mb_correction_input = basalelement->GetInput(BasalforcingsMeltingRateCorrectionEnum);
++	Input* bed_input           = basalelement->GetInput(BedEnum);                        _assert_(bed_input);
++	Input* vz_input      = NULL;
++	switch(dim){
++		case 1: vz_input = basalelement->GetInput(VyEnum); _assert_(vz_input); break;
++		case 2: vz_input = basalelement->GetInput(VzEnum); _assert_(vz_input); break;
++		default: _error_("not implemented");
++	}
++
++	/*Initialize mb_correction to 0, do not forget!:*/
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=basalelement->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		basalelement->NodalFunctions(basis,gauss);
++
++		vz_input->GetInputValue(&vz,gauss);
++		mb_input->GetInputValue(&mb,gauss);
++		bed_input->GetInputValue(&bed,gauss);
++		if(mb_correction_input)
++		 mb_correction_input->GetInputValue(&mb_correction,gauss);
++		else
++		 mb_correction=0.;
++
++		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*(bed+dt*(mb-mb_correction) + dt*vz)*basis[i];
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	return pe;
++
+ }/*}}}*/
++void FreeSurfaceBaseAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
++	 * For node i, Bi can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi=[ N ]
++	 *          [ N ]
++	 * where N is the finiteelement function for node i.
++	 *
++	 * We assume B_prog has been allocated already, of size: 2x(NDOF1*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions*/
++	IssmDouble* basis=xNew<IssmDouble>(numnodes);
++	element->NodalFunctions(basis,gauss);
++
++	/*Build B: */
++	for(int i=0;i<numnodes;i++){
++		for(int j=0;j<dim;i++){
++			B[numnodes*j+i] = basis[i];
++		}
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(basis);
++}/*}}}*/
++void FreeSurfaceBaseAnalysis::GetBprime(IssmDouble* Bprime,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 
++	 * For node i, Bi' can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi_prime=[ dN/dx ]
++	 *                [ dN/dy ]
++	 * where N is the finiteelement function for node i.
++	 *
++	 * We assume B' has been allocated already, of size: 3x(NDOF2*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Build B': */
++	for(int i=0;i<numnodes;i++){
++		for(int j=0;j<dim;j++){
++			Bprime[numnodes*j+i] = dbasis[j*numnodes+i];
++		}
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(dbasis);
++
++}/*}}}*/
+ void FreeSurfaceBaseAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp	(revision 17171)
++++ ../trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp	(revision 17172)
+@@ -44,6 +44,7 @@
+ 	memcpy(function_name,what_function.c_str(),len);
+ 
+ 	file_line= what_line;
++	this->Report();
+ 
+ }/*}}}*/
+ ErrorException::~ErrorException() throw(){/*{{{*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17171)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17172)
+@@ -207,6 +207,7 @@
+ 		virtual void   Delta18oParameterization(void)=0;
+ 		virtual void   SmbGradients(void)=0;
+ 	   virtual Element*   SpawnBasalElement(void)=0;
++		virtual Element*   SpawnTopElement(void)=0;
+ 		virtual void   ReduceMatrices(ElementMatrix* Ke,ElementVector* pe)=0;
+ 		virtual void   ResetCoordinateSystem()=0;
+ 		virtual void   SetTemporaryElementType(int element_type_in)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17171)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17172)
+@@ -2260,6 +2260,25 @@
+ 	}
+ }
+ /*}}}*/
++/*FUNCTION Tria::SpawnTopElement{{{*/
++Element*  Tria::SpawnTopElement(void){
++
++	int index1,index2;
++	int meshtype;
++
++	this->parameters->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			return this;
++		case Mesh2DverticalEnum:
++			_assert_(HasEdgeOnSurface());
++			this->EdgeOnSurfaceIndices(&index1,&index2);
++			return SpawnSeg(index1,index2);
++		default:
++			_error_("not implemented yet");
++	}
++}
++/*}}}*/
+ /*FUNCTION Tria::SurfaceArea {{{*/
+ IssmDouble Tria::SurfaceArea(void){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17171)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17172)
+@@ -118,6 +118,7 @@
+ 		void        ResetCoordinateSystem(void);
+ 		void	      SmbGradients();
+ 	   Element*    SpawnBasalElement(void);
++		Element*    SpawnTopElement(void);
+ 		int         VelocityInterpolation();
+ 		IssmDouble  PureIceEnthalpy(IssmDouble pressure){_error_("not implemented yet");};
+ 		int         PressureInterpolation();
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17171)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17172)
+@@ -2608,6 +2608,16 @@
+ 	return tria;
+ }
+ /*}}}*/
++/*FUNCTION Penta::SpawnTopElement{{{*/
++Element*  Penta::SpawnTopElement(void){
++
++	_assert_(this->IsOnSurface());
++
++	Tria* tria=(Tria*)SpawnTria(1); //lower face is 0, upper face is 1.
++
++	return tria;
++}
++/*}}}*/
+ /*FUNCTION Penta::SmbGradients{{{*/
+ void Penta::SmbGradients(void){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17171)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17172)
+@@ -120,6 +120,7 @@
+ 		void   SmbGradients();
+ 		void   SetTemporaryElementType(int element_type_in);
+ 	   Element* SpawnBasalElement(void);
++		Element* SpawnTopElement(void);
+ 		IssmDouble SurfaceArea(void);
+ 		void   Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement);
+ 		int    NodalValue(IssmDouble* pvalue, int index, int natureofdataenum);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17171)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17172)
+@@ -120,6 +120,7 @@
+ 		int         NumberofNodesVelocity(void){_error_("not implemented yet");};
+ 		int         NumberofNodesPressure(void){_error_("not implemented yet");};
+ 	   Element*    SpawnBasalElement(void){_error_("not implemented yet");};
++		Element*    SpawnTopElement(void){_error_("not implemented yet");};
+ 		IssmDouble  StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa){_error_("not implemented yet");};
+ 		IssmDouble  PureIceEnthalpy(IssmDouble pressure){_error_("not implemented yet");};
+ 		int         PressureInterpolation(void){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-17172-17173.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17172-17173.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17172-17173.diff	(revision 17802)
@@ -0,0 +1,14 @@
+Index: ../trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp	(revision 17172)
++++ ../trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp	(revision 17173)
+@@ -44,7 +44,8 @@
+ 	memcpy(function_name,what_function.c_str(),len);
+ 
+ 	file_line= what_line;
+-	this->Report();
++	/*When error messages are not shown properly, uncomment the following line*/
++	//this->Report();
+ 
+ }/*}}}*/
+ ErrorException::~ErrorException() throw(){/*{{{*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17173-17174.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17173-17174.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17173-17174.diff	(revision 17802)
@@ -0,0 +1,8 @@
+
+Property changes on: ../trunk-jpl/src/c/shared/FSanalyticals
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirtamp
+
+
Index: issm/oecreview/Archive/16554-17801/ISSM-17174-17175.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17174-17175.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17174-17175.diff	(revision 17802)
@@ -0,0 +1,20 @@
+Index: ../trunk-jpl/src/c/classes/IoModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 17174)
++++ ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 17175)
+@@ -37,6 +37,7 @@
+ 	this->elements=NULL;
+ 	this->faces=NULL;
+ 	this->edges=NULL;
++	this->elementtofaceconnectivity      =NULL;
+ 	this->elementtoedgeconnectivity      =NULL;
+ 	this->singlenodetoelementconnectivity=NULL;
+ 	this->numbernodetoelementconnectivity=NULL;
+@@ -79,6 +80,7 @@
+ 	FetchData(&this->elements,NULL,NULL,MeshElementsEnum);
+ 	this->faces                           = NULL;
+ 	this->edges                           = NULL;
++	this->elementtofaceconnectivity       = NULL;
+ 	this->elementtoedgeconnectivity       = NULL;
+ 	this->singlenodetoelementconnectivity = NULL;
+ 	this->numbernodetoelementconnectivity = NULL;
Index: issm/oecreview/Archive/16554-17801/ISSM-17175-17176.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17175-17176.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17175-17176.diff	(revision 17802)
@@ -0,0 +1,42 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17175)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17176)
+@@ -333,11 +333,11 @@
+ 	}
+ 
+ 	/*Get previous water head*/
+-	basalelement->GetInputListOnNodes(&eplOldHeads[0],EplHeadOldEnum);
++	/* basalelement->GetInputListOnNodes(&eplOldHeads[0],EplHeadEnum); */
+ 	
+-	for(i=0;i<numnodes;i++) {
+-		eplHeads[i] = eplOldHeads[i]+0.8*(eplHeads[i]-eplOldHeads[i]);
+-	}
++	/* for(i=0;i<numnodes;i++) { */
++	/* 	eplHeads[i] = eplOldHeads[i]+0.8*(eplHeads[i]-eplOldHeads[i]); */
++	/* } */
+ 	/*Add input to the element: */
+ 	element->AddBasalInput(EplHeadEnum,eplHeads,P1Enum);
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17175)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17176)
+@@ -4811,7 +4811,7 @@
+ 					}
+ 					
+ 					/*Relaxation stuff*/
+-					wh_trans=preceding_transfer[i]+0.8*(wh_trans-preceding_transfer[i]);
++					//					wh_trans=preceding_transfer[i]+0.8*(wh_trans-preceding_transfer[i]);
+ 					
+ 					/*Assign output pointer*/
+ 					transfer->SetValue(doflist[i],wh_trans,INS_VAL);
+@@ -4976,7 +4976,7 @@
+ 				thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*EPLgrad2-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
+ 					
+ 				/*Relaxation stuff*/
+-				thickness[i] = preceding_thickness[i]+0.8*(thickness[i]-preceding_thickness[i]);
++				//				thickness[i] = preceding_thickness[i]+0.8*(thickness[i]-preceding_thickness[i]);
+ 			}
+ 		}
+ 		this->inputs->AddInput(new TriaInput(HydrologydcEplThicknessEnum,thickness,P1Enum));
Index: issm/oecreview/Archive/16554-17801/ISSM-17176-17177.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17176-17177.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17176-17177.diff	(revision 17802)
@@ -0,0 +1,119 @@
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17176)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17177)
+@@ -173,8 +173,8 @@
+ 					basis,1,numnodes,0,
+ 					&Ke->values[0],1);
+ 
+-		GetB(B,element,dim,xyz_list,gauss);
+-		GetBprime(Bprime,element,dim,xyz_list,gauss);
++		GetB(B,topelement,dim,xyz_list,gauss);
++		GetBprime(Bprime,topelement,dim,xyz_list,gauss);
+ 
+ 		D_scalar=dt*gauss->weight*Jdet;
+ 
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17176)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17177)
+@@ -144,7 +144,7 @@
+ 	basalelement->FindParam(&stabilization,MasstransportStabilizationEnum);
+ 	Input* vx_input=basalelement->GetInput(VxEnum); _assert_(vx_input);
+ 	Input* vy_input=NULL;
+-	if(dim>1) basalelement->GetInput(VyEnum); _assert_(vy_input);
++	if(dim>1){basalelement->GetInput(VyEnum); _assert_(vy_input);}
+ 	h = basalelement->CharacteristicLength();
+ 
+ 	/* Start  looping on the number of gaussian points: */
+@@ -164,8 +164,8 @@
+ 					basis,1,numnodes,0,
+ 					&Ke->values[0],1);
+ 
+-		GetB(B,element,dim,xyz_list,gauss);
+-		GetBprime(Bprime,element,dim,xyz_list,gauss);
++		GetB(B,basalelement,dim,xyz_list,gauss);
++		GetBprime(Bprime,basalelement,dim,xyz_list,gauss);
+ 
+ 		D_scalar=dt*gauss->weight*Jdet;
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17176)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17177)
+@@ -184,7 +184,7 @@
+ 	this->material->inputs->AddInput(new TriaInput(input_enum,values,interpolation_enum));
+ }
+ /*}}}*/
+-/*FUNCTION Tria::AddInput{{{*/
++/*FUNCTION Tria::CharacteristicLength{{{*/
+ IssmDouble Tria::CharacteristicLength(void){
+ 
+ 	return sqrt(2*this->GetArea());
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 17176)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 17177)
+@@ -50,6 +50,20 @@
+ }
+ /*}}}*/
+ 
++/*FUNCTION Seg::CharacteristicLength{{{*/
++IssmDouble Seg::CharacteristicLength(void){
++
++	IssmDouble xyz_list[NUMVERTICES][3];
++	IssmDouble x1,y1,x2,y2;
++
++	/*Get xyz list: */
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	x1=xyz_list[0][0]; y1=xyz_list[0][1];
++	x2=xyz_list[1][0]; y2=xyz_list[1][1];
++
++	return sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
++}
++/*}}}*/
+ /*FUNCTION Seg::Echo{{{*/
+ void Seg::Echo(void){
+ 	_printf_("Seg:\n");
+@@ -123,20 +137,6 @@
+ }
+ /*}}}*/
+ 
+-/*FUNCTION Seg::GetSize{{{*/
+-IssmDouble Seg::GetSize(void){
+-
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble x1,y1,x2,y2;
+-
+-	/*Get xyz list: */
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	x1=xyz_list[0][0]; y1=xyz_list[0][1];
+-	x2=xyz_list[1][0]; y2=xyz_list[1][1];
+-
+-	return sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
+-}
+-/*}}}*/
+ /*FUNCTION Seg::GetNumberOfNodes;{{{*/
+ int Seg::GetNumberOfNodes(void){
+ 	return this->NumberofNodes();
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17176)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17177)
+@@ -61,7 +61,7 @@
+ 		void        AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
+ 		void        AddInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
+ 		void        AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
+-		IssmDouble  CharacteristicLength(void){_error_("not implemented yet");};
++		IssmDouble  CharacteristicLength(void);
+ 		void        ComputeBasalStress(Vector<IssmDouble>* sigma_b){_error_("not implemented yet");};
+ 		void        ComputeStrainRate(Vector<IssmDouble>* eps){_error_("not implemented yet");};
+ 		void        ComputeStressTensor(){_error_("not implemented yet");};
+@@ -255,7 +255,5 @@
+ 		int    UpdatePotentialUngrounding(IssmDouble* vertices_potentially_ungrounding,Vector<IssmDouble>* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf){_error_("not implemented yet");};
+ #endif
+ 		/*}}}*/
+-		/*Seg specific routines:*/
+-		IssmDouble     GetSize(void);
+ };
+ #endif  /* _SEG_H */
Index: issm/oecreview/Archive/16554-17801/ISSM-17177-17178.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17177-17178.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17177-17178.diff	(revision 17802)
@@ -0,0 +1,53 @@
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17177)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17178)
+@@ -153,7 +153,7 @@
+ 	topelement->FindParam(&stabilization,MasstransportStabilizationEnum);
+ 	Input* vx_input=topelement->GetInput(VxEnum); _assert_(vx_input);
+ 	Input* vy_input=NULL;
+-	if(dim>1) topelement->GetInput(VyEnum); _assert_(vy_input);
++	if(dim>1){topelement->GetInput(VyEnum); _assert_(vy_input);}
+ 	h = topelement->CharacteristicLength();
+ 
+ 	/* Start  looping on the number of gaussian points: */
+@@ -330,7 +330,7 @@
+ 
+ 	/*Build B: */
+ 	for(int i=0;i<numnodes;i++){
+-		for(int j=0;j<dim;i++){
++		for(int j=0;j<dim;j++){
+ 			B[numnodes*j+i] = basis[i];
+ 		}
+ 	}
+@@ -353,7 +353,7 @@
+ 	int numnodes = element->GetNumberOfNodes();
+ 
+ 	/*Get nodal functions derivatives*/
+-	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	IssmDouble* dbasis=xNew<IssmDouble>(dim*numnodes);
+ 	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+ 
+ 	/*Build B': */
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17177)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17178)
+@@ -326,7 +326,7 @@
+ 
+ 	/*Build B: */
+ 	for(int i=0;i<numnodes;i++){
+-		for(int j=0;j<dim;i++){
++		for(int j=0;j<dim;j++){
+ 			B[numnodes*j+i] = basis[i];
+ 		}
+ 	}
+@@ -349,7 +349,7 @@
+ 	int numnodes = element->GetNumberOfNodes();
+ 
+ 	/*Get nodal functions derivatives*/
+-	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	IssmDouble* dbasis=xNew<IssmDouble>(dim*numnodes);
+ 	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+ 
+ 	/*Build B': */
Index: issm/oecreview/Archive/16554-17801/ISSM-17178-17179.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17178-17179.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17178-17179.diff	(revision 17802)
@@ -0,0 +1,188 @@
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h	(revision 17178)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h	(revision 17179)
+@@ -24,7 +24,11 @@
+ 		ElementVector* CreateDVector(Element* element);
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
++		ElementMatrix* CreateKMatrixVolume(Element* element);
++		ElementMatrix* CreateKMatrixSurface(Element* element);
++		ElementMatrix* CreateKMatrixBed(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
++		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 17178)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 17179)
+@@ -47,11 +47,165 @@
+ _error_("Not implemented");
+ }/*}}}*/
+ ElementMatrix* ExtrudeFromTopAnalysis::CreateKMatrix(Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	/*compute all stiffness matrices for this element*/
++	ElementMatrix* Ke1=CreateKMatrixVolume(element);
++	ElementMatrix* Ke2=CreateKMatrixSurface(element);
++	ElementMatrix* Ke3=CreateKMatrixBed(element);
++	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2,Ke3);
++
++	/*clean-up and return*/
++	delete Ke1;
++	delete Ke2;
++	delete Ke3;
++	return Ke;
+ }/*}}}*/
++ElementMatrix* ExtrudeFromTopAnalysis::CreateKMatrixVolume(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	IssmDouble  Jdet,D;
++	IssmDouble *xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementMatrix* Ke     = element->NewElementMatrix();
++	IssmDouble*    B      = xNew<IssmDouble>(numnodes);
++	IssmDouble*    Bprime = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctions(Bprime,gauss);
++		GetB(B,element,xyz_list,gauss);
++		D=gauss->weight*Jdet;
++
++		TripleMultiply(B,1,numnodes,1,
++					&D,1,1,0,
++					Bprime,1,numnodes,0,
++					&Ke->values[0],1);
++	} 
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(B);
++	xDelete<IssmDouble>(Bprime);
++	delete gauss;
++	return Ke;
++}
++/*}}}*/
++ElementMatrix* ExtrudeFromTopAnalysis::CreateKMatrixSurface(Element* element){/*{{{*/
++
++	if(!element->IsOnSurface()) return NULL;
++
++	/*Intermediaries */
++	IssmDouble  Jdet,D,normal[2];
++	IssmDouble *xyz_list_top = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementMatrix* Ke    = element->NewElementMatrix();
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinatesTop(&xyz_list_top);
++	element->NormalTop(&normal[0],xyz_list_top);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGaussTop(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminantTop(&Jdet,xyz_list_top,gauss);
++		element->NodalFunctions(basis,gauss);
++		D = - gauss->weight*Jdet*normal[1]; 
++
++		TripleMultiply(basis,1,numnodes,1,
++					&D,1,1,0,
++					basis,1,numnodes,0,
++					&Ke->values[0],1);
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list_top);
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	return Ke;
++}
++/*}}}*/
++ElementMatrix* ExtrudeFromTopAnalysis::CreateKMatrixBed(Element* element){/*{{{*/
++
++	if(!element->IsOnBed()) return NULL;
++
++	/*Intermediaries */
++	IssmDouble  Jdet,D,normal[2];
++	IssmDouble *xyz_list_base = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementMatrix* Ke    = element->NewElementMatrix();
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinatesBase(&xyz_list_base);
++	element->NormalBase(&normal[0],xyz_list_base);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGaussBase(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
++		element->NodalFunctions(basis,gauss);
++		D = - gauss->weight*Jdet*normal[1]; 
++
++		TripleMultiply(basis,1,numnodes,1,
++					&D,1,1,0,
++					basis,1,numnodes,0,
++					&Ke->values[0],1);
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list_base);
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	return Ke;
++}
++/*}}}*/
+ ElementVector* ExtrudeFromTopAnalysis::CreatePVector(Element* element){/*{{{*/
+-_error_("not implemented yet");
++	return NULL;
+ }/*}}}*/
++void ExtrudeFromTopAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*	Compute B  matrix. B=[dh1/dz dh2/dz dh3/dz dh4/dz dh5/dz dh6/dz];
++		where hi is the interpolation function for node i.*/
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Build B: */
++	for(int i=0;i<numnodes;i++){
++		B[i] = dbasis[1*numnodes+i];  
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(dbasis);
++}
++/*}}}*/
+ void ExtrudeFromTopAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17179-17180.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17179-17180.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17179-17180.diff	(revision 17802)
@@ -0,0 +1,36 @@
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17179)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17180)
+@@ -180,13 +180,7 @@
+ 
+ 		for(int i=0;i<dim*dim;i++) D[i]=0.;
+ 		D[0] = D_scalar*vx;
+-		if(dim==2) D[1*dim+1] = D_scalar*vy;
+-		TripleMultiply(B,dim,numnodes,1,
+-					D,dim,dim,0,
+-					B,dim,numnodes,0,
+-					&Ke->values[0],1);
+ 
+-		D[0*dim+0]=D_scalar*vx;
+ 		if(dim==2) D[1*dim+1]=D_scalar*vy;
+ 		TripleMultiply(B,dim,numnodes,1,
+ 					D,dim,dim,0,
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17179)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17180)
+@@ -174,13 +174,6 @@
+ 		if(dim==2) D[1*dim+1] = D_scalar*vy;
+ 		TripleMultiply(B,dim,numnodes,1,
+ 					D,dim,dim,0,
+-					B,dim,numnodes,0,
+-					&Ke->values[0],1);
+-
+-		D[0*dim+0]=D_scalar*vx;
+-		if(dim==2) D[1*dim+1]=D_scalar*vy;
+-		TripleMultiply(B,dim,numnodes,1,
+-					D,dim,dim,0,
+ 					Bprime,dim,numnodes,0,
+ 					&Ke->values[0],1);
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17180-17181.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17180-17181.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17180-17181.diff	(revision 17802)
@@ -0,0 +1,33 @@
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17180)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17181)
+@@ -177,11 +177,10 @@
+ 		GetBprime(Bprime,topelement,dim,xyz_list,gauss);
+ 
+ 		D_scalar=dt*gauss->weight*Jdet;
+-
+ 		for(int i=0;i<dim*dim;i++) D[i]=0.;
+ 		D[0] = D_scalar*vx;
+-
+ 		if(dim==2) D[1*dim+1]=D_scalar*vy;
++
+ 		TripleMultiply(B,dim,numnodes,1,
+ 					D,dim,dim,0,
+ 					Bprime,dim,numnodes,0,
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17180)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17181)
+@@ -168,10 +168,10 @@
+ 		GetBprime(Bprime,basalelement,dim,xyz_list,gauss);
+ 
+ 		D_scalar=dt*gauss->weight*Jdet;
+-
+ 		for(int i=0;i<dim*dim;i++) D[i]=0.;
+ 		D[0] = D_scalar*vx;
+ 		if(dim==2) D[1*dim+1] = D_scalar*vy;
++
+ 		TripleMultiply(B,dim,numnodes,1,
+ 					D,dim,dim,0,
+ 					Bprime,dim,numnodes,0,
Index: issm/oecreview/Archive/16554-17801/ISSM-17181-17182.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17181-17182.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17181-17182.diff	(revision 17802)
@@ -0,0 +1,119 @@
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17181)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17182)
+@@ -153,7 +153,7 @@
+ 	topelement->FindParam(&stabilization,MasstransportStabilizationEnum);
+ 	Input* vx_input=topelement->GetInput(VxEnum); _assert_(vx_input);
+ 	Input* vy_input=NULL;
+-	if(dim>1){topelement->GetInput(VyEnum); _assert_(vy_input);}
++	if(dim>1){vy_input = topelement->GetInput(VyEnum); _assert_(vy_input);}
+ 	h = topelement->CharacteristicLength();
+ 
+ 	/* Start  looping on the number of gaussian points: */
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17181)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17182)
+@@ -144,7 +144,7 @@
+ 	basalelement->FindParam(&stabilization,MasstransportStabilizationEnum);
+ 	Input* vx_input=basalelement->GetInput(VxEnum); _assert_(vx_input);
+ 	Input* vy_input=NULL;
+-	if(dim>1){basalelement->GetInput(VyEnum); _assert_(vy_input);}
++	if(dim>1){vy_input = basalelement->GetInput(VyEnum); _assert_(vy_input);}
+ 	h = basalelement->CharacteristicLength();
+ 
+ 	/* Start  looping on the number of gaussian points: */
+Index: ../trunk-jpl/src/c/cores/masstransport_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/masstransport_core.cpp	(revision 17181)
++++ ../trunk-jpl/src/c/cores/masstransport_core.cpp	(revision 17182)
+@@ -47,13 +47,13 @@
+ 		if(VerboseSolution()) _printf0_("   call free surface computational core\n");
+ 		femmodel->SetCurrentConfiguration(FreeSurfaceBaseAnalysisEnum);
+ 		solutionsequence_linear(femmodel);
+-		if(meshtype==Mesh2DverticalEnum){
++		if(meshtype!=Mesh2DhorizontalEnum){
+ 			femmodel->parameters->SetParam(BedEnum,InputToExtrudeEnum);
+ 			extrudefrombase_core(femmodel);
+ 		}
+ 		femmodel->SetCurrentConfiguration(FreeSurfaceTopAnalysisEnum);
+ 		solutionsequence_linear(femmodel);
+-		if(meshtype==Mesh2DverticalEnum){
++		if(meshtype!=Mesh2DhorizontalEnum){
+ 			femmodel->parameters->SetParam(SurfaceEnum,InputToExtrudeEnum);
+ 			extrudefromtop_core(femmodel);
+ 		}
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17181)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17182)
+@@ -3052,6 +3052,53 @@
+ 	}
+ }
+ /*}}}*/
++/*FUNCTION Penta::UpdateConstraintsExtrudeFromBase{{{*/
++void  Penta::UpdateConstraintsExtrudeFromBase(void){
++
++	if(!IsOnBed()) return;
++
++	int        extrusioninput;
++	IssmDouble value,isonbed;
++
++	this->parameters->FindParam(&extrusioninput,InputToExtrudeEnum);
++	Input* input = inputs->GetInput(extrusioninput);      _assert_(extrusioninput);
++	Input* onbed = inputs->GetInput(MeshVertexonbedEnum); _assert_(onbed);
++
++	GaussPenta* gauss=new GaussPenta();
++	for(int iv=0;iv<this->NumberofNodes();iv++){
++		gauss->GaussNode(this->element_type,iv);
++		onbed->GetInputValue(&isonbed,gauss);
++		if(isonbed==1.){
++			input->GetInputValue(&value,gauss);
++			this->nodes[iv]->ApplyConstraint(1,value);
++		}
++	}
++	delete gauss;
++
++}
++/*}}}*/
++/*FUNCTION Penta::UpdateConstraintsExtrudeFromTop{{{*/
++void  Penta::UpdateConstraintsExtrudeFromTop(void){
++
++	if(!IsOnSurface()) return;
++
++	int extrusioninput;
++	int indices[3]={3,4,5};
++	IssmDouble value;
++
++	this->parameters->FindParam(&extrusioninput,InputToExtrudeEnum);
++	Input* input = inputs->GetInput(extrusioninput); _assert_(extrusioninput);
++
++	GaussPenta* gauss=new GaussPenta();
++	for(int i=0;i<3;i++){
++		gauss->GaussNode(P1Enum,indices[i]);
++		input->GetInputValue(&value,gauss);
++		this->nodes[indices[i]]->ApplyConstraint(1,value);
++	}
++	delete gauss;
++
++}
++/*}}}*/
+ /*FUNCTION Penta::ValueP1OnGauss{{{*/
+ void Penta::ValueP1OnGauss(IssmDouble* pvalue,IssmDouble* values,Gauss* gauss){
+ 	PentaRef::GetInputValue(pvalue,values,gauss);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17181)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17182)
+@@ -269,8 +269,8 @@
+ 		void           ComputeEPLThickness(void);
+ 		#endif
+ 
+-		void           UpdateConstraintsExtrudeFromBase(void){_error_("not implemented yet");};
+-		void           UpdateConstraintsExtrudeFromTop(void){_error_("not implemented yet");};
++		void           UpdateConstraintsExtrudeFromBase(void);
++		void           UpdateConstraintsExtrudeFromTop(void);
+ 		/*}}}*/
+ };
+ #endif  /* _PENTA_H */
Index: issm/oecreview/Archive/16554-17801/ISSM-17182-17183.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17182-17183.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17182-17183.diff	(revision 17802)
@@ -0,0 +1,138 @@
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h	(revision 17182)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h	(revision 17183)
+@@ -28,7 +28,7 @@
+ 		ElementMatrix* CreateKMatrixSurface(Element* element);
+ 		ElementMatrix* CreateKMatrixBed(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+-		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h	(revision 17182)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h	(revision 17183)
+@@ -28,7 +28,7 @@
+ 		ElementMatrix* CreateKMatrixSurface(Element* element);
+ 		ElementMatrix* CreateKMatrixBed(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+-		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 17182)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 17183)
+@@ -63,9 +63,18 @@
+ ElementMatrix* ExtrudeFromBaseAnalysis::CreateKMatrixVolume(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries */
++	int         meshtype,dim;
+ 	IssmDouble  Jdet,D;
+ 	IssmDouble *xyz_list = NULL;
+ 
++	/*Get dimension*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; break;
++		case Mesh3DEnum:         dim = 3; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+ 
+@@ -84,7 +93,7 @@
+ 
+ 		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+ 		element->NodalFunctions(Bprime,gauss);
+-		GetB(B,element,xyz_list,gauss);
++		GetB(B,element,dim,xyz_list,gauss);
+ 		D=gauss->weight*Jdet;
+ 
+ 		TripleMultiply(B,1,numnodes,1,
+@@ -186,7 +195,7 @@
+ ElementVector* ExtrudeFromBaseAnalysis::CreatePVector(Element* element){/*{{{*/
+ 	return NULL;
+ }/*}}}*/
+-void ExtrudeFromBaseAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++void ExtrudeFromBaseAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*	Compute B  matrix. B=[dh1/dz dh2/dz dh3/dz dh4/dz dh5/dz dh6/dz];
+ 		where hi is the interpolation function for node i.*/
+ 
+@@ -194,12 +203,12 @@
+ 	int numnodes = element->GetNumberOfNodes();
+ 
+ 	/*Get nodal functions derivatives*/
+-	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	IssmDouble* dbasis=xNew<IssmDouble>(dim*numnodes);
+ 	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+ 
+ 	/*Build B: */
+ 	for(int i=0;i<numnodes;i++){
+-		B[i] = dbasis[1*numnodes+i];  
++		B[i] = dbasis[(dim-1)*numnodes+i];
+ 	}
+ 
+ 	/*Clean-up*/
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 17182)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 17183)
+@@ -63,9 +63,18 @@
+ ElementMatrix* ExtrudeFromTopAnalysis::CreateKMatrixVolume(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries */
++	int         meshtype,dim;
+ 	IssmDouble  Jdet,D;
+ 	IssmDouble *xyz_list = NULL;
+ 
++	/*Get dimension*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; break;
++		case Mesh3DEnum:         dim = 3; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+ 
+@@ -84,7 +93,7 @@
+ 
+ 		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+ 		element->NodalFunctions(Bprime,gauss);
+-		GetB(B,element,xyz_list,gauss);
++		GetB(B,element,dim,xyz_list,gauss);
+ 		D=gauss->weight*Jdet;
+ 
+ 		TripleMultiply(B,1,numnodes,1,
+@@ -186,7 +195,7 @@
+ ElementVector* ExtrudeFromTopAnalysis::CreatePVector(Element* element){/*{{{*/
+ 	return NULL;
+ }/*}}}*/
+-void ExtrudeFromTopAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++void ExtrudeFromTopAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*	Compute B  matrix. B=[dh1/dz dh2/dz dh3/dz dh4/dz dh5/dz dh6/dz];
+ 		where hi is the interpolation function for node i.*/
+ 
+@@ -194,12 +203,12 @@
+ 	int numnodes = element->GetNumberOfNodes();
+ 
+ 	/*Get nodal functions derivatives*/
+-	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	IssmDouble* dbasis=xNew<IssmDouble>(dim*numnodes);
+ 	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+ 
+ 	/*Build B: */
+ 	for(int i=0;i<numnodes;i++){
+-		B[i] = dbasis[1*numnodes+i];  
++		B[i] = dbasis[(dim-1)*numnodes+i];
+ 	}
+ 
+ 	/*Clean-up*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17183-17184.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17183-17184.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17183-17184.diff	(revision 17802)
@@ -0,0 +1,133 @@
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 17183)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 17184)
+@@ -63,11 +63,11 @@
+ ElementMatrix* ExtrudeFromBaseAnalysis::CreateKMatrixVolume(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries */
+-	int         meshtype,dim;
+ 	IssmDouble  Jdet,D;
+ 	IssmDouble *xyz_list = NULL;
+ 
+ 	/*Get dimension*/
++	int dim,meshtype;
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+ 	switch(meshtype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+@@ -115,9 +115,18 @@
+ 	if(!element->IsOnSurface()) return NULL;
+ 
+ 	/*Intermediaries */
+-	IssmDouble  Jdet,D,normal[2];
++	IssmDouble  Jdet,D,normal[3];
+ 	IssmDouble *xyz_list_top = NULL;
+ 
++	/*Get dimension*/
++	int dim,meshtype;
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; break;
++		case Mesh3DEnum:         dim = 3; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+ 
+@@ -136,7 +145,7 @@
+ 
+ 		element->JacobianDeterminantTop(&Jdet,xyz_list_top,gauss);
+ 		element->NodalFunctions(basis,gauss);
+-		D = - gauss->weight*Jdet*normal[1]; 
++		D = - gauss->weight*Jdet*normal[dim-1]; 
+ 
+ 		TripleMultiply(basis,1,numnodes,1,
+ 					&D,1,1,0,
+@@ -156,9 +165,18 @@
+ 	if(!element->IsOnBed()) return NULL;
+ 
+ 	/*Intermediaries */
+-	IssmDouble  Jdet,D,normal[2];
++	IssmDouble  Jdet,D,normal[3];
+ 	IssmDouble *xyz_list_base = NULL;
+ 
++	/*Get dimension*/
++	int dim,meshtype;
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; break;
++		case Mesh3DEnum:         dim = 3; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+ 
+@@ -177,7 +195,7 @@
+ 
+ 		element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
+ 		element->NodalFunctions(basis,gauss);
+-		D = - gauss->weight*Jdet*normal[1]; 
++		D = - gauss->weight*Jdet*normal[dim-1]; 
+ 
+ 		TripleMultiply(basis,1,numnodes,1,
+ 					&D,1,1,0,
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 17183)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 17184)
+@@ -118,6 +118,15 @@
+ 	IssmDouble  Jdet,D,normal[2];
+ 	IssmDouble *xyz_list_top = NULL;
+ 
++	/*Get dimension*/
++	int dim,meshtype;
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; break;
++		case Mesh3DEnum:         dim = 3; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+ 
+@@ -136,7 +145,7 @@
+ 
+ 		element->JacobianDeterminantTop(&Jdet,xyz_list_top,gauss);
+ 		element->NodalFunctions(basis,gauss);
+-		D = - gauss->weight*Jdet*normal[1]; 
++		D = - gauss->weight*Jdet*normal[dim-1]; 
+ 
+ 		TripleMultiply(basis,1,numnodes,1,
+ 					&D,1,1,0,
+@@ -156,9 +165,18 @@
+ 	if(!element->IsOnBed()) return NULL;
+ 
+ 	/*Intermediaries */
+-	IssmDouble  Jdet,D,normal[2];
++	IssmDouble  Jdet,D,normal[3];
+ 	IssmDouble *xyz_list_base = NULL;
+ 
++	/*Get dimension*/
++	int dim,meshtype;
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; break;
++		case Mesh3DEnum:         dim = 3; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+ 
+@@ -177,7 +195,7 @@
+ 
+ 		element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
+ 		element->NodalFunctions(basis,gauss);
+-		D = - gauss->weight*Jdet*normal[1]; 
++		D = - gauss->weight*Jdet*normal[dim-1]; 
+ 
+ 		TripleMultiply(basis,1,numnodes,1,
+ 					&D,1,1,0,
Index: issm/oecreview/Archive/16554-17801/ISSM-17184-17185.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17184-17185.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17184-17185.diff	(revision 17802)
@@ -0,0 +1,170 @@
+Index: ../trunk-jpl/test/NightlyRun/test124.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test124.m	(revision 0)
++++ ../trunk-jpl/test/NightlyRun/test124.m	(revision 17185)
+@@ -0,0 +1,47 @@
++md=triangle(model(),'../Exp/Square.exp',150000.);
++md=setmask(md,'all','');
++md=parameterize(md,'../Par/SquareShelfConstrained.par');
++md=extrude(md,3,1.);
++md=setflowequation(md,'FS','all');
++
++%Free surface
++md.masstransport.isfreesurface=1;
++md.timestepping.time_step=0.00001;
++md.timestepping.final_time=0.00005;
++
++%Go solve
++md.cluster=generic('name',oshostname(),'np',3);
++md=solve(md,TransientSolutionEnum());
++
++%Fields and tolerances to track changes
++field_names     ={...
++	'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1',...
++	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2',...
++	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3'};
++field_tolerances={...
++	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
++	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
++	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
++field_values={...
++	(md.results.TransientSolution(1).Vx),...
++	(md.results.TransientSolution(1).Vy),...
++	(md.results.TransientSolution(1).Vel),...
++	(md.results.TransientSolution(1).Pressure),...
++	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Surface),...
++	(md.results.TransientSolution(1).Thickness),...
++	(md.results.TransientSolution(2).Vx),...
++	(md.results.TransientSolution(2).Vy),...
++	(md.results.TransientSolution(2).Vel),...
++	(md.results.TransientSolution(2).Pressure),...
++	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Surface),...
++	(md.results.TransientSolution(2).Thickness),...
++	(md.results.TransientSolution(3).Vx),...
++	(md.results.TransientSolution(3).Vy),...
++	(md.results.TransientSolution(3).Vel),...
++	(md.results.TransientSolution(3).Pressure),...
++	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Surface),...
++	(md.results.TransientSolution(3).Thickness),...
++	};
+Index: ../trunk-jpl/test/NightlyRun/test703.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test703.m	(revision 0)
++++ ../trunk-jpl/test/NightlyRun/test703.m	(revision 17185)
+@@ -0,0 +1,93 @@
++%mesh parameters
++x =[-5:.5:5]';
++[b h sea]=NowickiProfile(x);
++x = x*10^3;
++h = h*10^3;
++b = (b-sea)*10^3;
++
++%mesh domain
++md=bamgflowband(model(),x,b+h,b,'hmax',150);
++
++%parameterize
++md.geometry.surface   = interp1(x,b+h,md.mesh.x);
++md.geometry.bed       = interp1(x,b,md.mesh.x);
++md.geometry.thickness = md.geometry.surface-md.geometry.bed;
++md.mask.ice_levelset  = - ones(md.mesh.numberofvertices,1);
++md.mask.ice_levelset(find(vertexflags(md.mesh,2))) = 0;
++md.mask.groundedice_levelset = double(md.mesh.x<0)-.5;
++
++md.initialization.temperature=(273.-20.)*ones(md.mesh.numberofvertices,1);
++md.materials.rheology_B=paterson(md.initialization.temperature);
++md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
++md.damage.D=zeros(md.mesh.numberofvertices,1);
++md.damage.spcdamage=NaN(md.mesh.numberofvertices,1);
++md.friction.coefficient=zeros(md.mesh.numberofvertices,1);
++md.friction.coefficient(find(vertexflags(md.mesh,1)))=20;
++md.friction.p=ones(md.mesh.numberofelements,1);
++md.friction.q=ones(md.mesh.numberofelements,1);
++md.stressbalance.spcvx=NaN*ones(md.mesh.numberofvertices,1);
++md.stressbalance.spcvy=NaN*ones(md.mesh.numberofvertices,1);
++md.stressbalance.spcvz=NaN*ones(md.mesh.numberofvertices,1);
++md.stressbalance.referential=NaN*ones(md.mesh.numberofvertices,6);
++md.stressbalance.loadingforce=0*ones(md.mesh.numberofvertices,3);
++md.stressbalance.spcvx(find(vertexflags(md.mesh,4)))=800;
++md.stressbalance.spcvy(find(vertexflags(md.mesh,4)))=0;
++
++%Misc
++md=setflowequation(md,'FS','all');
++md.flowequation.fe_FS='TaylorHood';
++md.stressbalance.abstol=NaN;
++md.miscellaneous.name = 'flowline';
++
++%Transient settings
++md.timestepping.time_step=0.000001;
++md.timestepping.final_time=0.000005;
++md.surfaceforcings.mass_balance=zeros(md.mesh.numberofvertices,1);
++md.basalforcings.melting_rate=zeros(md.mesh.numberofvertices,1);
++md.basalforcings.geothermalflux=zeros(md.mesh.numberofvertices,1);
++posb=find((md.mesh.x>0) & md.mesh.vertexonbed);
++md.basalforcings.melting_rate(posb)=18;
++md.initialization.vx=zeros(md.mesh.numberofvertices,1);
++md.initialization.vy=zeros(md.mesh.numberofvertices,1);
++md.initialization.pressure=zeros(md.mesh.numberofvertices,1);
++md.masstransport.spcthickness=NaN*ones(md.mesh.numberofvertices,1);
++md.thermal.spctemperature=NaN*ones(md.mesh.numberofvertices,1);
++md.transient.isthermal=0;
++md.masstransport.isfreesurface=1;
++
++%Go solve
++md.cluster=generic('np',3);
++md=solve(md,TransientSolutionEnum());
++
++%Fields and tolerances to track changes
++field_names     ={...
++	'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1',...
++	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2',...
++	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3'};
++field_tolerances={...
++	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
++	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
++	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
++field_values={...
++	(md.results.TransientSolution(1).Vx),...
++	(md.results.TransientSolution(1).Vy),...
++	(md.results.TransientSolution(1).Vel),...
++	(md.results.TransientSolution(1).Pressure),...
++	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Surface),...
++	(md.results.TransientSolution(1).Thickness),...
++	(md.results.TransientSolution(2).Vx),...
++	(md.results.TransientSolution(2).Vy),...
++	(md.results.TransientSolution(2).Vel),...
++	(md.results.TransientSolution(2).Pressure),...
++	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Surface),...
++	(md.results.TransientSolution(2).Thickness),...
++	(md.results.TransientSolution(3).Vx),...
++	(md.results.TransientSolution(3).Vy),...
++	(md.results.TransientSolution(3).Vel),...
++	(md.results.TransientSolution(3).Pressure),...
++	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Surface),...
++	(md.results.TransientSolution(3).Thickness),...
++	};
+Index: ../trunk-jpl/test/NightlyRun/IdToName.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/IdToName.m	(revision 17184)
++++ ../trunk-jpl/test/NightlyRun/IdToName.m	(revision 17185)
+@@ -28,6 +28,7 @@
+ 	case 121, name='SquareShelfConstrainedEnthalpyTran';
+ 	case 122, name='SquareShelfConstrainedTransHOEnth';
+ 	case 123, name='SquareShelfConstrainedTranMisfitSurface';
++	case 124, name='SquareShelfConstrainedTranFSFreeSurface';
+ 	case 201, name='SquareShelfStressSSA2d';
+ 	case 202, name='SquareShelfStressSSA3d';
+ 	case 203, name='SquareShelfStressHO';
+@@ -172,6 +173,7 @@
+ 	case 613, name='79NorthCMBalThicVxVy';
+ 	case 701, name='FlowbandFSshelf';
+ 	case 702, name='FlowbandFSsheetshelf';
++	case 703, name='FlowbandFSsheetshelfTrans';
+ 	case 1101, name='ISMIPAHO';
+ 	case 1102, name='ISMIPAFS';
+ 	case 1103, name='ISMIPBHO';
Index: issm/oecreview/Archive/16554-17801/ISSM-17185-17186.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17185-17186.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17185-17186.diff	(revision 17802)
@@ -0,0 +1,20 @@
+Index: ../trunk-jpl/test/Archives/Archive703.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/test/Archives/Archive703.nc
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+
+Index: ../trunk-jpl/test/Archives/Archive124.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/test/Archives/Archive124.nc
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+
Index: issm/oecreview/Archive/16554-17801/ISSM-17186-17187.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17186-17187.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17186-17187.diff	(revision 17802)
@@ -0,0 +1,8 @@
+Index: ../trunk-jpl/test/Archives/Archive325.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive122.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17187-17188.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17187-17188.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17187-17188.diff	(revision 17802)
@@ -0,0 +1,4 @@
+Index: ../trunk-jpl/test/Archives/Archive124.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17188-17189.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17188-17189.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17188-17189.diff	(revision 17802)
@@ -0,0 +1,41 @@
+Index: ../trunk-jpl/test/NightlyRun/test404.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test404.py	(revision 17188)
++++ ../trunk-jpl/test/NightlyRun/test404.py	(revision 17189)
+@@ -18,7 +18,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Vx','Vy','Vz','Vel','Pressure']
+-field_tolerances=[1.5e-07,1e-07,1.4e-06,1e-07,1e-07]
++field_tolerances=[1.5e-07,1e-07,1.4e-06,1e-06,1e-07]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Vx,\
+ 	md.results.StressbalanceSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test124.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test124.m	(revision 17188)
++++ ../trunk-jpl/test/NightlyRun/test124.m	(revision 17189)
+@@ -20,8 +20,8 @@
+ 	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3'};
+ field_tolerances={...
+ 	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+-	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+-	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
++	1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,...
++	1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
+ 	(md.results.TransientSolution(1).Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test404.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test404.m	(revision 17188)
++++ ../trunk-jpl/test/NightlyRun/test404.m	(revision 17189)
+@@ -8,7 +8,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure'};
+-field_tolerances={1.5e-07,1e-07,1.4e-06,1e-07,1e-07};
++field_tolerances={1.5e-07,1e-07,1.4e-06,1e-06,1e-07};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
Index: issm/oecreview/Archive/16554-17801/ISSM-17189-17190.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17189-17190.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17189-17190.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/test/NightlyRun/test124.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test124.m	(revision 17189)
++++ ../trunk-jpl/test/NightlyRun/test124.m	(revision 17190)
+@@ -19,7 +19,7 @@
+ 	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2',...
+ 	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3'};
+ field_tolerances={...
+-	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
++	1e-09,1e-09,1e-09,1e-09,1e-13,1e-13,1e-13,...
+ 	1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,...
+ 	1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09};
+ field_values={...
Index: issm/oecreview/Archive/16554-17801/ISSM-17190-17191.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17190-17191.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17190-17191.diff	(revision 17802)
@@ -0,0 +1,28 @@
+Index: ../trunk-jpl/src/m/enum/HydrologydcMaxIterEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/HydrologydcMaxIterEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/HydrologydcMaxIterEnum.m	(revision 17191)
+@@ -0,0 +1,11 @@
++function macro=HydrologydcMaxIterEnum()
++%HYDROLOGYDCMAXITERENUM - Enum of HydrologydcMaxIter
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=HydrologydcMaxIterEnum()
++
++macro=StringToEnum('HydrologydcMaxIter');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17190)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17191)
+@@ -101,6 +101,7 @@
+ def EplHeadOldEnum(): return StringToEnum("EplHeadOld")[0]
+ def EplHeadSlopeXEnum(): return StringToEnum("EplHeadSlopeX")[0]
+ def EplHeadSlopeYEnum(): return StringToEnum("EplHeadSlopeY")[0]
++def HydrologydcMaxIterEnum(): return StringToEnum("HydrologydcMaxIter")[0]
+ def HydrologydcRelTolEnum(): return StringToEnum("HydrologydcRelTol")[0]
+ def HydrologydcSpcsedimentHeadEnum(): return StringToEnum("HydrologydcSpcsedimentHead")[0]
+ def HydrologydcSedimentCompressibilityEnum(): return StringToEnum("HydrologydcSedimentCompressibility")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17191-17192.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17191-17192.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17191-17192.diff	(revision 17802)
@@ -0,0 +1,249 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17191)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17192)
+@@ -322,28 +322,29 @@
+ 	basalelement->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+ 	
+ 	IssmDouble* eplHeads    = xNew<IssmDouble>(numnodes);
+-	IssmDouble* eplOldHeads    = xNew<IssmDouble>(numnodes);
++	/* IssmDouble* relaxed    = xNew<IssmDouble>(numnodes); */
++	/* IssmDouble* eplOldHeads    = xNew<IssmDouble>(numnodes); */
+ 	IssmDouble  Stepping;
+ 
+ 
++	/*Get previous water head*/
++	//basalelement->GetInputListOnNodes(&eplOldHeads[0],EplHeadEnum);
++
+ 	/*Use the dof list to index into the solution vector: */
+ 	for(i=0;i<numnodes;i++){
+ 		eplHeads[i]=solution[doflist[i]];
+ 		if(xIsNan<IssmDouble>(eplHeads[i])) _error_("NaN found in solution vector");
+ 	}
+-
+-	/*Get previous water head*/
+-	/* basalelement->GetInputListOnNodes(&eplOldHeads[0],EplHeadEnum); */
+ 	
+ 	/* for(i=0;i<numnodes;i++) { */
+-	/* 	eplHeads[i] = eplOldHeads[i]+0.8*(eplHeads[i]-eplOldHeads[i]); */
++	/* 	relaxed[i] = eplOldHeads[i]+0.8*(eplHeads[i]-eplOldHeads[i]); */
+ 	/* } */
+ 	/*Add input to the element: */
+ 	element->AddBasalInput(EplHeadEnum,eplHeads,P1Enum);
+ 
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(eplHeads);
+-	xDelete<IssmDouble>(eplOldHeads);
++	//	xDelete<IssmDouble>(eplOldHeads);
+ 	xDelete<int>(doflist);
+ 	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ } /*}}}*/
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17191)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17192)
+@@ -14,6 +14,7 @@
+ 	int         sedimentlimit_flag;
+ 	int         transfer_flag;
+ 	int         penalty_lock;
++	int         hydro_maxiter;
+ 	bool        isefficientlayer;
+ 	IssmDouble  sedimentlimit;
+ 	IssmDouble  penalty_factor;
+@@ -32,6 +33,7 @@
+ 	iomodel->FetchData(&penalty_factor,HydrologydcPenaltyFactorEnum);
+ 	iomodel->FetchData(&rel_tol,HydrologydcRelTolEnum);
+ 	iomodel->FetchData(&penalty_lock,HydrologydcPenaltyLockEnum);
++	iomodel->FetchData(&hydro_maxiter,HydrologydcMaxIterEnum);
+ 
+ 	if(sedimentlimit_flag==1){
+ 		iomodel->FetchData(&sedimentlimit,HydrologydcSedimentlimitEnum);
+@@ -50,6 +52,7 @@
+ 	parameters->AddObject(new IntParam(HydrologydcTransferFlagEnum,transfer_flag));
+ 	parameters->AddObject(new DoubleParam(HydrologydcRelTolEnum,rel_tol));
+ 	parameters->AddObject(new IntParam(HydrologydcPenaltyLockEnum,penalty_lock));
++	parameters->AddObject(new IntParam(HydrologydcMaxIterEnum,hydro_maxiter));
+ 
+ }/*}}}*/
+ void HydrologyDCInefficientAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17191)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17192)
+@@ -101,6 +101,7 @@
+ 	EplHeadOldEnum,
+   EplHeadSlopeXEnum,
+ 	EplHeadSlopeYEnum,
++	HydrologydcMaxIterEnum,
+ 	HydrologydcRelTolEnum,
+ 	HydrologydcSpcsedimentHeadEnum,
+ 	HydrologydcSedimentCompressibilityEnum,
+@@ -184,7 +185,7 @@
+ 	MaterialsMuWaterEnum,
+ 	MaterialsThermalExchangeVelocityEnum,
+ 	MaterialsThermalconductivityEnum,
+-  	MaterialsTemperateiceconductivityEnum,
++	MaterialsTemperateiceconductivityEnum,
+ 	MaterialsLithosphereShearModulusEnum,
+ 	MaterialsLithosphereDensityEnum,
+ 	MaterialsMantleShearModulusEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17191)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17192)
+@@ -109,6 +109,7 @@
+ 		case EplHeadOldEnum : return "EplHeadOld";
+ 		case EplHeadSlopeXEnum : return "EplHeadSlopeX";
+ 		case EplHeadSlopeYEnum : return "EplHeadSlopeY";
++		case HydrologydcMaxIterEnum : return "HydrologydcMaxIter";
+ 		case HydrologydcRelTolEnum : return "HydrologydcRelTol";
+ 		case HydrologydcSpcsedimentHeadEnum : return "HydrologydcSpcsedimentHead";
+ 		case HydrologydcSedimentCompressibilityEnum : return "HydrologydcSedimentCompressibility";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17191)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17192)
+@@ -109,6 +109,7 @@
+ 	      else if (strcmp(name,"EplHeadOld")==0) return EplHeadOldEnum;
+ 	      else if (strcmp(name,"EplHeadSlopeX")==0) return EplHeadSlopeXEnum;
+ 	      else if (strcmp(name,"EplHeadSlopeY")==0) return EplHeadSlopeYEnum;
++	      else if (strcmp(name,"HydrologydcMaxIter")==0) return HydrologydcMaxIterEnum;
+ 	      else if (strcmp(name,"HydrologydcRelTol")==0) return HydrologydcRelTolEnum;
+ 	      else if (strcmp(name,"HydrologydcSpcsedimentHead")==0) return HydrologydcSpcsedimentHeadEnum;
+ 	      else if (strcmp(name,"HydrologydcSedimentCompressibility")==0) return HydrologydcSedimentCompressibilityEnum;
+@@ -135,11 +136,11 @@
+ 	      else if (strcmp(name,"HydrologyLayer")==0) return HydrologyLayerEnum;
+ 	      else if (strcmp(name,"HydrologySediment")==0) return HydrologySedimentEnum;
+ 	      else if (strcmp(name,"HydrologyEfficient")==0) return HydrologyEfficientEnum;
+-	      else if (strcmp(name,"HydrologySedimentKmax")==0) return HydrologySedimentKmaxEnum;
+          else stage=2;
+    }
+    if(stage==2){
+-	      if (strcmp(name,"WaterTransfer")==0) return WaterTransferEnum;
++	      if (strcmp(name,"HydrologySedimentKmax")==0) return HydrologySedimentKmaxEnum;
++	      else if (strcmp(name,"WaterTransfer")==0) return WaterTransferEnum;
+ 	      else if (strcmp(name,"IndependentObject")==0) return IndependentObjectEnum;
+ 	      else if (strcmp(name,"InversionControlParameters")==0) return InversionControlParametersEnum;
+ 	      else if (strcmp(name,"InversionCostFunctionThreshold")==0) return InversionCostFunctionThresholdEnum;
+@@ -258,11 +259,11 @@
+ 	      else if (strcmp(name,"SteadystateReltol")==0) return SteadystateReltolEnum;
+ 	      else if (strcmp(name,"SteadystateRequestedOutputs")==0) return SteadystateRequestedOutputsEnum;
+ 	      else if (strcmp(name,"Surface")==0) return SurfaceEnum;
+-	      else if (strcmp(name,"ThermalIsenthalpy")==0) return ThermalIsenthalpyEnum;
+          else stage=3;
+    }
+    if(stage==3){
+-	      if (strcmp(name,"ThermalIsdynamicbasalspc")==0) return ThermalIsdynamicbasalspcEnum;
++	      if (strcmp(name,"ThermalIsenthalpy")==0) return ThermalIsenthalpyEnum;
++	      else if (strcmp(name,"ThermalIsdynamicbasalspc")==0) return ThermalIsdynamicbasalspcEnum;
+ 	      else if (strcmp(name,"ThermalMaxiter")==0) return ThermalMaxiterEnum;
+ 	      else if (strcmp(name,"ThermalPenaltyFactor")==0) return ThermalPenaltyFactorEnum;
+ 	      else if (strcmp(name,"ThermalPenaltyLock")==0) return ThermalPenaltyLockEnum;
+@@ -381,11 +382,11 @@
+ 	      else if (strcmp(name,"Vertices")==0) return VerticesEnum;
+ 	      else if (strcmp(name,"Results")==0) return ResultsEnum;
+ 	      else if (strcmp(name,"GenericParam")==0) return GenericParamEnum;
+-	      else if (strcmp(name,"AdolcParam")==0) return AdolcParamEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"BoolInput")==0) return BoolInputEnum;
++	      if (strcmp(name,"AdolcParam")==0) return AdolcParamEnum;
++	      else if (strcmp(name,"BoolInput")==0) return BoolInputEnum;
+ 	      else if (strcmp(name,"BoolParam")==0) return BoolParamEnum;
+ 	      else if (strcmp(name,"Contour")==0) return ContourEnum;
+ 	      else if (strcmp(name,"ControlInput")==0) return ControlInputEnum;
+@@ -504,11 +505,11 @@
+ 	      else if (strcmp(name,"VyMesh")==0) return VyMeshEnum;
+ 	      else if (strcmp(name,"VzMesh")==0) return VzMeshEnum;
+ 	      else if (strcmp(name,"Enthalpy")==0) return EnthalpyEnum;
+-	      else if (strcmp(name,"EnthalpyPicard")==0) return EnthalpyPicardEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"ThicknessAbsGradient")==0) return ThicknessAbsGradientEnum;
++	      if (strcmp(name,"EnthalpyPicard")==0) return EnthalpyPicardEnum;
++	      else if (strcmp(name,"ThicknessAbsGradient")==0) return ThicknessAbsGradientEnum;
+ 	      else if (strcmp(name,"ThicknessAlongGradient")==0) return ThicknessAlongGradientEnum;
+ 	      else if (strcmp(name,"ThicknessAcrossGradient")==0) return ThicknessAcrossGradientEnum;
+ 	      else if (strcmp(name,"IntMatParam")==0) return IntMatParamEnum;
+@@ -627,11 +628,11 @@
+ 	      else if (strcmp(name,"Separate")==0) return SeparateEnum;
+ 	      else if (strcmp(name,"Sset")==0) return SsetEnum;
+ 	      else if (strcmp(name,"Verbose")==0) return VerboseEnum;
+-	      else if (strcmp(name,"TriangleInterp")==0) return TriangleInterpEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"BilinearInterp")==0) return BilinearInterpEnum;
++	      if (strcmp(name,"TriangleInterp")==0) return TriangleInterpEnum;
++	      else if (strcmp(name,"BilinearInterp")==0) return BilinearInterpEnum;
+ 	      else if (strcmp(name,"NearestInterp")==0) return NearestInterpEnum;
+ 	      else if (strcmp(name,"XY")==0) return XYEnum;
+ 	      else if (strcmp(name,"XYZ")==0) return XYZEnum;
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17191)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17192)
+@@ -48,12 +48,10 @@
+ 	/*Recover parameters: */
+ 	femmodel->SetCurrentConfiguration(HydrologyDCInefficientAnalysisEnum);
+ 	femmodel->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);
++	femmodel->parameters->FindParam(&hydro_maxiter,HydrologydcMaxIterEnum);
+ 	femmodel->parameters->FindParam(&eps_hyd,HydrologydcRelTolEnum);
+ 	femmodel->parameters->FindParam(&time,TimeEnum);
+ 
+-	/*FIXME, hardcoded, put on an enum*/
+-	hydro_maxiter=100;
+-
+ 	hydrocount=1;
+ 	hydroconverged=false;
+ 	/*We don't need the outer loop if only one layer is used*/
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17191)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17192)
+@@ -4750,7 +4750,7 @@
+ 	IssmDouble leakage,h_max;
+ 	IssmDouble wh_trans,sed_thick;
+ 	IssmDouble epl_specificstoring,sedstoring;
+-	IssmDouble activeEpl[numdof],epl_thickness[numdof];
++	IssmDouble activeEpl[numdof],epl_thickness[numdof],old_epl_thickness[numdof];
+ 	IssmDouble epl_head[numdof],sed_head[numdof];
+ 	IssmDouble preceding_transfer[numdof],sed_trans[numdof];
+ 
+@@ -4780,7 +4780,7 @@
+ 			GetInputListOnVertices(&sed_head[0],SedimentHeadEnum);
+ 			GetInputListOnVertices(&sed_trans[0],HydrologydcSedimentTransmitivityEnum);
+ 			GetInputListOnVertices(&epl_head[0],EplHeadEnum);
+-			GetInputListOnVertices(&epl_thickness[0],HydrologydcEplThicknessEnum);
++			GetInputListOnVertices(&epl_thickness[0],HydrologydcEplThicknessEnum);			
+ 
+ 			this->parameters->FindParam(&leakage,HydrologydcLeakageFactorEnum);
+ 
+@@ -4800,6 +4800,7 @@
+ 					/*EPL head higher than sediment head, transfer from the epl to the sediment*/
+ 					if(epl_head[i]>sed_head[i]){
+ 						wh_trans=epl_specificstoring*epl_thickness[i]*sed_trans[i]*(epl_head[i]-sed_head[i])/(leakage*sed_thick);
++						
+ 						/*No transfer if the sediment head is allready at the maximum*/
+ 						if(sed_head[i]>=h_max){
+ 							wh_trans=0.0;
+@@ -4811,7 +4812,7 @@
+ 					}
+ 					
+ 					/*Relaxation stuff*/
+-					//					wh_trans=preceding_transfer[i]+0.8*(wh_trans-preceding_transfer[i]);
++					wh_trans=preceding_transfer[i]+0.8*(wh_trans-preceding_transfer[i]);
+ 					
+ 					/*Assign output pointer*/
+ 					transfer->SetValue(doflist[i],wh_trans,INS_VAL);
+@@ -4976,7 +4977,7 @@
+ 				thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*EPLgrad2-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
+ 					
+ 				/*Relaxation stuff*/
+-				//				thickness[i] = preceding_thickness[i]+0.8*(thickness[i]-preceding_thickness[i]);
++				thickness[i] = preceding_thickness[i]+0.8*(thickness[i]-preceding_thickness[i]);
+ 			}
+ 		}
+ 		this->inputs->AddInput(new TriaInput(HydrologydcEplThicknessEnum,thickness,P1Enum));
Index: issm/oecreview/Archive/16554-17801/ISSM-17192-17193.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17192-17193.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17192-17193.diff	(revision 17802)
@@ -0,0 +1,63 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17192)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17193)
+@@ -1113,6 +1113,9 @@
+ 	int      meshtype;
+ 	Element* basalelement;
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*Get basal element*/
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+ 	switch(meshtype){
+@@ -1140,7 +1143,7 @@
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSAFriction(Element* element){/*{{{*/
+ 
+ 	/*Return if element is inactive*/
+-	if(element->IsFloating()) return NULL;
++	if(element->IsFloating() || !element->IsIceInElement()) return NULL;
+ 
+ 	/*Intermediaries*/
+ 	bool        mainlyfloating;
+@@ -1214,6 +1217,9 @@
+ }/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSAViscous(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*Intermediaries*/
+ 	IssmDouble  viscosity,newviscosity,oldviscosity;
+ 	IssmDouble  viscosity_overshoot,thickness,Jdet;
+@@ -1275,6 +1281,9 @@
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorSSA(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*Intermediaries*/
+ 	int      meshtype;
+ 	Element* basalelement;
+@@ -1305,6 +1314,9 @@
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorSSADrivingStress(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*Intermediaries */
+ 	IssmDouble  thickness,Jdet,slope[2];
+ 	IssmDouble* xyz_list = NULL;
+@@ -1351,6 +1363,9 @@
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorSSAFront(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*If no front, return NULL*/
+ 	if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17193-17194.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17193-17194.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17193-17194.diff	(revision 17802)
@@ -0,0 +1,139 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17193)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17194)
+@@ -220,6 +220,8 @@
+ 		virtual int    PressureInterpolation()=0;
+ 		virtual bool   IsZeroLevelset(int levelset_enum)=0;
+ 		virtual void   ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum)=0;
++		virtual void   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum)=0;
++		virtual void   GetNormalFromLSF(IssmDouble *pnormal)=0;
+ 
+ 		#ifdef _HAVE_RESPONSES_
+ 		virtual void   AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17193)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17194)
+@@ -890,6 +890,69 @@
+ 	*pxyz_zero= xyz_zero;
+ }
+ /*}}}*/
++void  Tria::GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){/*{{{*/
++	
++	/* Intermediaries */
++	int i, dir,nrfrontnodes;
++	IssmDouble  levelset[NUMVERTICES];
++
++	/*Recover parameters and values*/
++	GetInputListOnVertices(&levelset[0],levelsetenum);
++
++	int* indicesfront = xNew<int>(NUMVERTICES);
++	/* Get nodes where there is no ice */
++	nrfrontnodes=0;
++	for(i=0;i<NUMVERTICES;i++){
++		if(levelset[i]>=0.){
++			indicesfront[nrfrontnodes]=i;
++			nrfrontnodes++;
++		}
++	}
++
++	IssmDouble* xyz_front = xNew<IssmDouble>(3*nrfrontnodes);
++	/* Return nodes */
++	for(i=0;i<nrfrontnodes;i++){
++		for(dir=0;dir<3;dir++){
++			xyz_front[3*i+dir]=xyz_list[indicesfront[i]+dir];
++		}
++	}
++
++	*pxyz_front=xyz_front;
++
++	xDelete<int>(indicesfront);
++}/*}}}*/
++void  Tria::GetNormalFromLSF(IssmDouble *pnormal){/*{{{*/
++
++	/* Intermediaries */
++	const int dim=2;
++	int i,counter;
++	IssmDouble* xyz_list = NULL;
++	IssmDouble  dlevelset[dim], norm_dlevelset;
++	IssmDouble  normal[dim]={0.};
++
++	/*Retrieve all inputs and parameters*/
++	Input* levelset_input=this->GetInput(MaskIceLevelsetEnum); _assert_(levelset_input);
++	this->GetVerticesCoordinates(&xyz_list);
++	
++	counter=0;
++	Gauss* gauss = this->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		/* Get normal on node */
++		levelset_input->GetInputDerivativeValue(&dlevelset[0],xyz_list,gauss);
++		norm_dlevelset=0.;
++		for(i=0;i<dim;i++) norm_dlevelset+=dlevelset[i]*dlevelset[i]; 
++		norm_dlevelset=sqrt(norm_dlevelset)+1.e-14;
++		for(i=0;i<dim;i++) normal[i]+=dlevelset[i]/norm_dlevelset;
++		counter++;
++	}
++	_assert_(counter>0);
++	for(i=0;i<dim;i++) normal[i]/counter;
++	
++	pnormal=&normal[0];
++
++	delete gauss;
++	xDelete<IssmDouble>(xyz_list);
++}/*}}}*/
+ /*FUNCTION Tria::GetNodeIndex {{{*/
+ int Tria::GetNodeIndex(Node* node){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17193)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17194)
+@@ -130,6 +130,8 @@
+ 		int         VertexConnectivity(int vertexindex);
+ 		void   VerticalSegmentIndices(int** pindices,int* pnumseg){_error_("not implemented yet");};
+ 		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum);
++		void	    GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum);
++	    void        GetNormalFromLSF(IssmDouble *pnormal);
+ 		bool        IsZeroLevelset(int levelset_enum);
+ 
+ 		#ifdef _HAVE_RESPONSES_
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17193)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17194)
+@@ -3165,7 +3165,7 @@
+ 	/*Retrieve all inputs and parameters*/
+ 	GetInputListOnVertices(&ls[0],levelset_enum);
+ 
+-	/*If the level set is awlays <=0, there is no ice front here*/
++	/*If the level set has always same sign, there is no ice front here*/
+ 	iszerols = false;
+ 	if(IsIceInElement()){
+ 		if(ls[0]*ls[1]<0. || ls[0]*ls[2]<0. || (ls[0]*ls[1]+ls[0]*ls[2]+ls[1]*ls[2]==0.)){
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17193)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17194)
+@@ -114,6 +114,8 @@
+ 		int    PressureInterpolation();
+ 		bool   IsZeroLevelset(int levelset_enum);
+ 		void   ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum);
++		void   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented yet");};
++		void   GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
+ 		void   PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm);
+ 		void   ReduceMatrices(ElementMatrix* Ke,ElementVector* pe);
+ 		void   ResetCoordinateSystem(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17193)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17194)
+@@ -159,6 +159,8 @@
+ 		void        ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
+ 		bool        IsZeroLevelset(int levelset_enum){_error_("not implemented");};
+ 		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented");};
++		void		GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented yet");};
++		void        GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
+ 
+ 		#ifdef _HAVE_HYDROLOGY_
+ 		void    GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-17194-17195.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17194-17195.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17194-17195.diff	(revision 17802)
@@ -0,0 +1,17 @@
+Index: ../trunk-jpl/test/NightlyRun/test124.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test124.m	(revision 17194)
++++ ../trunk-jpl/test/NightlyRun/test124.m	(revision 17195)
+@@ -19,9 +19,9 @@
+ 	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2',...
+ 	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3'};
+ field_tolerances={...
+-	1e-09,1e-09,1e-09,1e-09,1e-13,1e-13,1e-13,...
+-	1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,...
+-	1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09};
++	2e-10,1e-10,1e-10,1e-11,1e-13,1e-13,1e-13,...
++	1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
++	1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
+ 	(md.results.TransientSolution(1).Vy),...
Index: issm/oecreview/Archive/16554-17801/ISSM-17195-17196.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17195-17196.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17195-17196.diff	(revision 17802)
@@ -0,0 +1,79 @@
+Index: ../trunk-jpl/src/m/materials/TMeltingPoint.py
+===================================================================
+--- ../trunk-jpl/src/m/materials/TMeltingPoint.py	(revision 0)
++++ ../trunk-jpl/src/m/materials/TMeltingPoint.py	(revision 17196)
+@@ -0,0 +1,21 @@
++import numpy as npy
++
++def TMeltingPoint(reftemp,pressure):
++	'''
++	Calculate the pressure melting point of ice at a given pressure
++
++	reftemp is the melting temperature in K at atmospheric pressure (initialized in md.materials.meltingpoint)
++
++	pressure is in Pa
++
++	Usage:
++		Tm=TMeltingPoint(md.materials.meltingpoint,pressure)
++	'''
++
++	#variables
++	beta=7.9e-8
++
++	#ensure ref is same dimension as pressure
++	ref=reftemp*npy.ones_like(pressure)
++
++	return reftemp-beta*pressure
+Index: ../trunk-jpl/src/m/materials/TMeltingPoint.m
+===================================================================
+--- ../trunk-jpl/src/m/materials/TMeltingPoint.m	(revision 0)
++++ ../trunk-jpl/src/m/materials/TMeltingPoint.m	(revision 17196)
+@@ -0,0 +1,15 @@
++function Tm=TMeltingPoint(reftemp, pressure)
++%TMELTINGPOINT- calculate pressure melting point of ice
++%
++%   reftemp is the melting temperature at atmospheric pressure (initialized in md.materials.meltingpoint)   
++%
++%   pressure is in Pa   
++%
++%   Usage:
++%   Tm=TMeltingPoint(md.materials.meltingpoint,pressure)
++
++%variables
++beta=7.9e-8; % K Pa^-1
++
++Tm=reftemp-beta*pressure;
++
+Index: ../trunk-jpl/src/m/materials/arrhenius.m
+===================================================================
+--- ../trunk-jpl/src/m/materials/arrhenius.m	(revision 17195)
++++ ../trunk-jpl/src/m/materials/arrhenius.m	(revision 17196)
+@@ -44,14 +44,6 @@
+     error('cold ice with positive waterfraction detected.');
+ end
+ 
+-    function Tm=TMeltingPoint(pressure)
+-        Tm=GetThom(T0,pressure);
+-    end
+-    
+-    function Th=GetThom(T,pressure)
+-        Th=T-beta*pressure;
+-    end
+-
+ %   values for Activation energy Q and pre-exponential constants from
+ %   Grewe/Blatter 2009, p54
+ 
+@@ -81,10 +73,10 @@
+     end
+     
+     function B=GetRigidity(T,w,pressure)
+-        Thom=GetThom(T, pressure);
++        Thom=TMeltingPoint(T, pressure);
+         A=GetA(Thom, w);
+         B=1./(A.^(1/n));
+     end
+ 
+ rigidity=GetRigidity(temperature, waterfraction, pressure);
+-end
+\ No newline at end of file
++end
Index: issm/oecreview/Archive/16554-17801/ISSM-17196-17197.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17196-17197.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17196-17197.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/test/NightlyRun/test124.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test124.m	(revision 17196)
++++ ../trunk-jpl/test/NightlyRun/test124.m	(revision 17197)
+@@ -19,7 +19,7 @@
+ 	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2',...
+ 	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3'};
+ field_tolerances={...
+-	2e-10,1e-10,1e-10,1e-11,1e-13,1e-13,1e-13,...
++	2e-10,2e-10,2e-10,1e-11,1e-13,1e-13,1e-13,...
+ 	1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
+ 	1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10};
+ field_values={...
Index: issm/oecreview/Archive/16554-17801/ISSM-17197-17198.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17197-17198.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17197-17198.diff	(revision 17802)
@@ -0,0 +1,28 @@
+Index: ../trunk-jpl/test/NightlyRun/test333.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test333.m	(revision 17197)
++++ ../trunk-jpl/test/NightlyRun/test333.m	(revision 17198)
+@@ -25,18 +25,11 @@
+ 
+ md=solve(md,HydrologySolutionEnum());
+ 
+-%store=md.constants.g*md.hydrology.sediment_porosity* ...
+-%			md.materials.rho_freshwater*((md.hydrology.sediment_compressibility/md.hydrology.sediment_porosity)+md.hydrology.water_compressibility)
+-
+-%sed=ones(1,size(md.results.HydrologySolution,2));
+-%epl=ones(1,size(md.results.HydrologySolution,2));
+-%res=ones(1,size(md.results.HydrologySolution,2));
+-%input=ones(1,size(md.results.HydrologySolution,2));
+-%for i= 1:size(md.results.HydrologySolution,2)
+-%	sed(i)=mean(md.results.HydrologySolution(i).SedimentHead);
+-%	res(i)=mean(md.results.HydrologySolution(i).SedimentHeadResidual);
+-%	epl(i)=mean(md.results.HydrologySolution(i).EplHead);
+-%	input(i)=2.0*(i*0.2);
++%store=md.constants.g*md.hydrology.sediment_porosity*md.materials.rho_freshwater*((md.hydrology.sediment_compressibility/md.hydrology.sediment_porosity)+md.hydrology.water_compressibility);
++%sedstore=20.0*store;
++%for i=1:10
++%diff=(mean(md.results.HydrologySolution(i).EplHead)*store+ ...
++%			mean(md.results.HydrologySolution(i).SedimentHead)*sedstore-0.4*i)
+ %end
+ 
+ %Fields and tolerances to track changes
Index: issm/oecreview/Archive/16554-17801/ISSM-17198-17199.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17198-17199.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17198-17199.diff	(revision 17802)
@@ -0,0 +1,68 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17198)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17199)
+@@ -5040,7 +5040,12 @@
+ 				thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*EPLgrad2-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
+ 					
+ 				/*Relaxation stuff*/
+-				thickness[i] = preceding_thickness[i]+0.8*(thickness[i]-preceding_thickness[i]);
++				if(thickness[i]<10.0*init_thick){
++					thickness[i] = preceding_thickness[i]+0.8*(thickness[i]-preceding_thickness[i]);
++				}
++				else{
++					thickness[i] = 10.0*init_thick;
++				}
+ 			}
+ 		}
+ 		this->inputs->AddInput(new TriaInput(HydrologydcEplThicknessEnum,thickness,P1Enum));
+Index: ../trunk-jpl/src/m/classes/hydrologydc.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/hydrologydc.m	(revision 17198)
++++ ../trunk-jpl/src/m/classes/hydrologydc.m	(revision 17199)
+@@ -10,6 +10,7 @@
+ 		penalty_factor           = 0;
+ 		penalty_lock             = 0;
+ 		rel_tol                  = 0;
++		max_iter                 = 0;
+ 		sedimentlimit_flag       = 0;
+ 		sedimentlimit            = 0;
+ 		transfer_flag            = 0;
+@@ -43,11 +44,12 @@
+ 		% {{{ function obj = setdefaultparameters(obj) 
+ 		function obj = setdefaultparameters(obj) 
+ 
+-		%Parameters from de Fleurian 2013
++		%Parameters from de Fleurian 2014
+ 			obj.water_compressibility    = 5.04e-10;
+ 			obj.isefficientlayer         = 1;
+ 			obj.penalty_factor           = 3;
+ 			obj.rel_tol                  = 1.0e-06;
++			obj.max_iter                 = 100;
+ 			obj.sedimentlimit_flag       = 0;
+ 			obj.sedimentlimit            = 0;
+ 			obj.transfer_flag            = 0;
+@@ -76,6 +78,7 @@
+ 			md = checkfield(md,'fieldname','hydrology.isefficientlayer','numel',[1],'values',[0 1]);
+ 			md = checkfield(md,'fieldname','hydrology.penalty_factor','>',0,'numel',1);
+ 			md = checkfield(md,'fieldname','hydrology.rel_tol','>',0,'numel',1);
++			md = checkfield(md,'fieldname','hydrology.max_iter','>',0,'numel',1);
+ 			md = checkfield(md,'fieldname','hydrology.sedimentlimit_flag','numel',[1],'values',[0 1 2 3]);
+ 			md = checkfield(md,'fieldname','hydrology.transfer_flag','numel',[1],'values',[0 1]);
+ 			if obj.sedimentlimit_flag==1,
+@@ -110,6 +113,7 @@
+ 			fielddisplay(obj,'penalty_factor','exponent of the value used in the penalisation method [dimensionless]');
+ 			fielddisplay(obj,'penalty_lock','stabilize unstable constraints that keep zigzagging after n iteration (default is 0, no stabilization)');
+ 			fielddisplay(obj,'rel_tol','tolerance of the nonlinear iteration for the transfer between layers [dimensionless]');
++			fielddisplay(obj,'max_iter','maximum number of nonlinear iteration');
+ 			fielddisplay(obj,'sedimentlimit_flag','what kind of upper limit is applied for the inefficient layer');
+ 			disp(sprintf('%55s  0: no limit',' '));
+ 			disp(sprintf('%55s  1: user defined: %s',' ','sedimentlimit'));
+@@ -151,6 +155,7 @@
+ 			WriteData(fid,'object',obj,'fieldname','penalty_factor','format','Double');
+ 			WriteData(fid,'object',obj,'fieldname','penalty_lock','format','Integer');
+ 			WriteData(fid,'object',obj,'fieldname','rel_tol','format','Double');
++			WriteData(fid,'object',obj,'fieldname','max_iter','format','Integer');
+ 			WriteData(fid,'object',obj,'fieldname','sedimentlimit_flag','format','Integer');
+ 			WriteData(fid,'object',obj,'fieldname','transfer_flag','format','Integer');
+ 			if obj.sedimentlimit_flag==1,
Index: issm/oecreview/Archive/16554-17801/ISSM-17199-17200.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17199-17200.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17199-17200.diff	(revision 17802)
@@ -0,0 +1,47 @@
+Index: ../trunk-jpl/test/NightlyRun/test124.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test124.m	(revision 17199)
++++ ../trunk-jpl/test/NightlyRun/test124.m	(revision 17200)
+@@ -19,9 +19,9 @@
+ 	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2',...
+ 	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3'};
+ field_tolerances={...
+-	2e-10,2e-10,2e-10,1e-11,1e-13,1e-13,1e-13,...
+-	1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
+-	1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10};
++	1e-09,3e-10,3e-10,1e-10,1e-13,1e-13,1e-13,...
++	1e-09,3e-10,3e-10,1e-10,1e-10,1e-10,1e-10,...
++	1e-09,3e-10,3e-10,1e-10,1e-10,1e-10,1e-10};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
+ 	(md.results.TransientSolution(1).Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test211.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.py	(revision 17199)
++++ ../trunk-jpl/test/NightlyRun/test211.py	(revision 17200)
+@@ -26,8 +26,8 @@
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3']
+ field_tolerances=[\
+ 	1e-08,1e-08,1e-06,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,\
+-	1e-08,1e-08,1e-06,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-06,\
+-	1e-07,1e-07,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-06]
++	1e-08,1e-08,1e-06,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,2e-06,\
++	1e-07,1e-07,1e-06,3e-08,1e-08,1e-08,1e-08,1e-08,1e-08,2e-06]
+ field_values=[\
+ 	md.results.TransientSolution[0].Vx,\
+ 	md.results.TransientSolution[0].Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test211.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.m	(revision 17199)
++++ ../trunk-jpl/test/NightlyRun/test211.m	(revision 17200)
+@@ -14,8 +14,8 @@
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3'};
+ field_tolerances={...
+ 	1e-08,1e-08,1e-06,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,...
+-	2e-08,1e-08,1e-06,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-06,...
+-	1e-07,1e-07,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-06};
++	2e-08,1e-08,1e-06,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,2e-06,...
++	1e-07,1e-07,1e-06,3e-08,1e-08,1e-08,1e-08,1e-08,1e-08,2e-06};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
+ 	(md.results.TransientSolution(1).Vy),...
Index: issm/oecreview/Archive/16554-17801/ISSM-17200-17201.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17200-17201.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17200-17201.diff	(revision 17802)
@@ -0,0 +1,22 @@
+Index: ../trunk-jpl/src/m/plot/plot_unit.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_unit.py	(revision 17200)
++++ ../trunk-jpl/src/m/plot/plot_unit.py	(revision 17201)
+@@ -23,7 +23,7 @@
+ 	if datatype==1:
+ 		#element plot
+ 		if is2d:
+-			p.tripcolor(x,y,elements,data,colorlevels)
++			p.tripcolor(x,y,elements,data,colorlevels,edgecolors=edgecolor)
+ 		else:
+ 			raise ValueError('plot_unit error: 3D element plot not supported yet')
+ 		return
+@@ -31,7 +31,7 @@
+ 	elif datatype==2:
+ 		#node plot
+ 		if is2d:
+-			p.tricontourf(x,y,elements,data,colorlevels)
++			p.tripcolor(x,y,elements,data,colorlevels,edgecolors=edgecolor)
+ 		else:
+ 			raise ValueError('plot_unit error: 3D node plot not supported yet')
+ 		return
Index: issm/oecreview/Archive/16554-17801/ISSM-17201-17202.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17201-17202.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17201-17202.diff	(revision 17802)
@@ -0,0 +1,14 @@
+Index: ../trunk-jpl/src/m/plot/plot_unit.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_unit.py	(revision 17201)
++++ ../trunk-jpl/src/m/plot/plot_unit.py	(revision 17202)
+@@ -31,7 +31,8 @@
+ 	elif datatype==2:
+ 		#node plot
+ 		if is2d:
+-			p.tripcolor(x,y,elements,data,colorlevels,edgecolors=edgecolor)
++			p.tricontourf(x,y,elements,data,colorlevels)
++			p.triplot(x,y,elements)
+ 		else:
+ 			raise ValueError('plot_unit error: 3D node plot not supported yet')
+ 		return
Index: issm/oecreview/Archive/16554-17801/ISSM-17202-17203.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17202-17203.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17202-17203.diff	(revision 17802)
@@ -0,0 +1,14 @@
+Index: ../trunk-jpl/src/m/plot/plot_unit.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_unit.py	(revision 17202)
++++ ../trunk-jpl/src/m/plot/plot_unit.py	(revision 17203)
+@@ -32,7 +32,8 @@
+ 		#node plot
+ 		if is2d:
+ 			p.tricontourf(x,y,elements,data,colorlevels)
+-			p.triplot(x,y,elements)
++			if edgecolor != 'None':
++				p.triplot(x,y,elements,color=edgecolor)
+ 		else:
+ 			raise ValueError('plot_unit error: 3D node plot not supported yet')
+ 		return
Index: issm/oecreview/Archive/16554-17801/ISSM-17203-17204.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17203-17204.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17203-17204.diff	(revision 17802)
@@ -0,0 +1,63 @@
+Index: ../trunk-jpl/src/m/shp/shpread.m
+===================================================================
+--- ../trunk-jpl/src/m/shp/shpread.m	(revision 17203)
++++ ../trunk-jpl/src/m/shp/shpread.m	(revision 17204)
+@@ -5,6 +5,8 @@
+ %   fields x and y corresponding to the coordinates, one for the filename of
+ %   the shp file, for the density, for the nodes, and a field closed to 
+ %   indicate if the domain is closed. 
++%   If this initial shapefile is point only, the fields closed and
++%   points are ommited
+ %   The first argument is the .shp file to be read and the second one (optional) 
+ %   indicates if the last point shall be read (1 to read it, 0 not to).
+ %
+@@ -52,6 +54,27 @@
+ 			end
+ 		end
+ 	end
++
++	if strcmpi(shp(i).Geometry,'Point'),
++		x=shp(i).X'; y=shp(i).Y';
++		ids=find(isnan(x));
++		x(ids)=[]; y(ids)=[];
++
++		Struct(end+1).x=x;
++		Struct(end).y=y;
++		Struct(end).density=1;
++		if isfield(shp,'id'),
++			Struct(end).name=num2str(shp(i).id);
++		else
++			Struct(end).name='';
++		end
++		for j=1:length(fields),
++			field=fields{j};
++			if ~(strcmpi(field,'X') | strcmpi(field,'Y') | strcmpi(field,'id')),
++				Struct(end).(field)=shp(i).(field);
++			end
++		end
++	end
+ end
+ 
+ end
+Index: ../trunk-jpl/src/m/shp/shpdisp.m
+===================================================================
+--- ../trunk-jpl/src/m/shp/shpdisp.m	(revision 17203)
++++ ../trunk-jpl/src/m/shp/shpdisp.m	(revision 17204)
+@@ -44,9 +44,14 @@
+ 
+ figure(figurenumber),hold on
+ for i=1:length(domain),
+-	if (isnumeric(linestyle))
+-		plot(domain(i).x*unitmultiplier,domain(i).y*unitmultiplier,'Color',linestyle,'linewidth',linewidth);
++	if(isfield(domain,'nods'))
++		if (isnumeric(linestyle))
++			plot(domain(i).x*unitmultiplier,domain(i).y*unitmultiplier,'Color',linestyle,'linewidth',linewidth);
++		else
++			plot(domain(i).x*unitmultiplier,domain(i).y*unitmultiplier,linestyle,'linewidth',linewidth);
++	  end
+ 	else
+-		plot(domain(i).x*unitmultiplier,domain(i).y*unitmultiplier,linestyle,'linewidth',linewidth);
++		plot(domain(i).x*unitmultiplier,domain(i).y*unitmultiplier,'ro','MarkerSize',5);
+ 	end
++	
+ end
Index: issm/oecreview/Archive/16554-17801/ISSM-17204-17205.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17204-17205.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17204-17205.diff	(revision 17802)
@@ -0,0 +1,52 @@
+Index: ../trunk-jpl/test/NightlyRun/test511.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test511.py	(revision 17204)
++++ ../trunk-jpl/test/NightlyRun/test511.py	(revision 17205)
+@@ -38,7 +38,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Gradient','Misfits','MaterialsRheologyB','Pressure','Vel','Vx','Vy']
+-field_tolerances=[1e-11,5e-12,1e-11,1e-09,2e-12,5e-12,2e-12]
++field_tolerances=[1e-11,5e-12,1e-11,1e-09,2e-12,1e-11,1e-11]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Gradient1,\
+ 	md.results.StressbalanceSolution.J,\
+Index: ../trunk-jpl/test/NightlyRun/test511.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test511.m	(revision 17204)
++++ ../trunk-jpl/test/NightlyRun/test511.m	(revision 17205)
+@@ -27,7 +27,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Gradient','Misfits','MaterialsRheologyB','Pressure','Vel','Vx','Vy'};
+-field_tolerances={1e-11,5e-12,1e-11,1e-09,2e-12,5e-12,2e-12};
++field_tolerances={1e-11,5e-12,1e-11,1e-09,2e-12,1e-11,1e-11};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Gradient1),...
+ 	(md.results.StressbalanceSolution.J),...
+Index: ../trunk-jpl/test/NightlyRun/test285.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test285.m	(revision 17204)
++++ ../trunk-jpl/test/NightlyRun/test285.m	(revision 17205)
+@@ -12,7 +12,7 @@
+ 	md.flowequation.fe_HO=i{1};
+ 	md=solve(md,StressbalanceSolutionEnum());
+ 	field_names     ={field_names{:},['Vx' i{1}],['Vy' i{1}],['Vz' i{1}],['Vel' i{1}],['Pressure' i{1}]};
+-	field_tolerances={field_tolerances{:},2.5e-08,2e-08,2e-08,2e-08,1e-13};
++	field_tolerances={field_tolerances{:},5e-08,2e-08,2e-08,2e-08,1e-13};
+ 	field_values={field_values{:},...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test285.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test285.py	(revision 17204)
++++ ../trunk-jpl/test/NightlyRun/test285.py	(revision 17205)
+@@ -22,7 +22,7 @@
+ 	md.flowequation.fe_HO=i
+ 	md=solve(md,StressbalanceSolutionEnum())
+ 	field_names     =field_names+['Vx'+i,'Vy'+i,'Vz'+i,'Vel'+i,'Pressure'+i]
+-	field_tolerances=field_tolerances+[2.5e-08,2e-08,2e-08,2e-08,1e-13]
++	field_tolerances=field_tolerances+[5e-08,2e-08,2e-08,2e-08,1e-13]
+ 	field_values=field_values+[\
+ 		md.results.StressbalanceSolution.Vx,\
+ 		md.results.StressbalanceSolution.Vy,\
Index: issm/oecreview/Archive/16554-17801/ISSM-17205-17206.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17205-17206.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17205-17206.diff	(revision 17802)
@@ -0,0 +1,11 @@
+Index: ../trunk-jpl/jenkins/imac-012301-gil
+===================================================================
+--- ../trunk-jpl/jenkins/imac-012301-gil	(revision 17205)
++++ ../trunk-jpl/jenkins/imac-012301-gil	(revision 17206)
+@@ -104,5 +104,5 @@
+ #as follows: runme($MATLAB_NROPTIONS). The options must be understandable
+ #by Matlab and runme.m
+ #ex: "'id',[101 102 103]"
+-MATLAB_NROPTIONS="'exclude',[218 234 235 412 413 414 417 418 420]"
++MATLAB_NROPTIONS="'exclude',[218 234 235 412 413 414 417 418 420 514 701 702]"
+ PYTHON_NROPTIONS=""
Index: issm/oecreview/Archive/16554-17801/ISSM-17206-17207.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17206-17207.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17206-17207.diff	(revision 17802)
@@ -0,0 +1,33 @@
+Index: ../trunk-jpl/src/c/modules/InterpFromMeshToGridx/InterpFromMeshToGridx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/InterpFromMeshToGridx/InterpFromMeshToGridx.cpp	(revision 17206)
++++ ../trunk-jpl/src/c/modules/InterpFromMeshToGridx/InterpFromMeshToGridx.cpp	(revision 17207)
+@@ -106,20 +106,20 @@
+ 
+ 		/*Get indices i and j that form a square around the currant triangle*/
+ 		if (yflip){
+-			i1=max(0,      (int)floor((y_tria_max-y_grid_max)/yposting)-1);
+-			i2=min(nlines, (int)ceil((y_tria_min-y_grid_max)/yposting));
++			i1=max(0,       (int)floor((y_tria_max-y_grid_max)/yposting)-1);
++			i2=min(nlines-1,(int)ceil((y_tria_min-y_grid_max)/yposting));
+ 		}
+ 		else{
+-			i1=max(0,      (int)floor((y_tria_min-y_grid_min)/yposting)-1);
+-			i2=min(nlines, (int)ceil((y_tria_max-y_grid_min)/yposting));
++			i1=max(0,       (int)floor((y_tria_min-y_grid_min)/yposting)-1);
++			i2=min(nlines-1,(int)ceil((y_tria_max-y_grid_min)/yposting));
+ 		}
+ 		if (xflip){
+-			j1=max(0,     (int)floor((x_tria_max-x_grid_max)/xposting)-1);
+-			j2=min(ncols, (int)ceil((x_tria_min-x_grid_max)/xposting));
++			j1=max(0,      (int)floor((x_tria_max-x_grid_max)/xposting)-1);
++			j2=min(ncols-1,(int)ceil((x_tria_min-x_grid_max)/xposting));
+ 		}
+ 		else{
+-			j1=max(0,     (int)floor((x_tria_min-x_grid_min)/xposting)-1);
+-			j2=min(ncols, (int)ceil((x_tria_max-x_grid_min)/xposting));
++			j1=max(0,      (int)floor((x_tria_min-x_grid_min)/xposting)-1);
++			j2=min(ncols-1,(int)ceil((x_tria_max-x_grid_min)/xposting));
+ 		}
+ 
+ 		/*get area of the current element (Jacobian = 2 * area)*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17207-17208.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17207-17208.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17207-17208.diff	(revision 17802)
@@ -0,0 +1,344 @@
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17207)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17208)
+@@ -66,21 +66,14 @@
+ 	/*parameters: */
+ 	bool save_results;
+ 
+-	/* extrapolate */
+-	Analysis* analysis = new ExtrapolationAnalysis();
+-	femmodel->parameters->SetParam(VxEnum,ExtrapolationVariableEnum);
+-	analysis->Core(femmodel);
+-	delete analysis;
+-
+ 	/*activate formulation: */
+ 	femmodel->SetCurrentConfiguration(LevelsetAnalysisEnum);
+ 
+-	/*recover parameters: */
+-	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
+-
+ 	if(VerboseSolution()) _printf0_("call computational core:\n");
+ 	solutionsequence_linear(femmodel);
+ 
++	/*recover parameters: */
++	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
+ 	if(save_results){
+ 		if(VerboseSolution()) _printf0_("   saving results\n");
+ 		int outputs = MaskIceLevelsetEnum;
+@@ -323,3 +316,57 @@
+ 
+ }/*}}}*/
+ 
++/* Update of constraints */
++void LevelsetAnalysis::UpdateNoIceConstraints(FemModel* femmodel){/*{{{*/
++
++	IssmDouble* mask_ice = GetMaskOfIce(femmodel->elements, femmodel->nodes); 
++
++	for (int i=0;i<femmodel->nodes->Size();i++){
++		Node* node=dynamic_cast<Node*>(femmodel->nodes->GetObjectByOffset(i));
++		if(node->InAnalysis(LevelsetAnalysisEnum)){
++			if(mask_ice[node->Sid()]==1.){//FIXME: what should be done with actual spcs to ice model?
++// 				node->DofInFSet(0); /*remove spc*/ 
++			}
++			else{
++				IssmDouble defval=0.;
++				node->ApplyConstraint(1,defval); /*apply spc*/ 
++			}
++		}
++	}
++}/*}}}*/
++IssmDouble* LevelsetAnalysis::GetMaskOfIce(Elements* elements, Nodes* nodes){/*{{{*/
++
++	int                 i;
++	IssmDouble*         mask_ice      = NULL;
++	Vector<IssmDouble>* vec_mask_ice  = NULL;
++	Element*            element       = NULL;
++
++	/*Initialize vector with number of vertices*/
++	IssmDouble numnodes=nodes->NumberOfNodes(LevelsetAnalysisEnum);
++	vec_mask_ice=new Vector<IssmDouble>(numnodes); //nodes at ice front that have ice at next time step
++	for(i=0;i<numnodes;i++)
++		vec_mask_ice[i]=0.;
++	/*Fill vector vertices that have no contact to ice: */
++	for(i=0;i<elements->Size();i++){
++		element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
++		SetMaskOfIceElement(vec_mask_ice, element);
++	}
++
++	/*Assemble vector and serialize */
++	vec_mask_ice->Assemble();
++	mask_ice=vec_mask_ice->ToMPISerial();
++	delete vec_mask_ice;
++	return mask_ice;
++
++}/*}}}*/
++void LevelsetAnalysis::SetMaskOfIceElement(Vector<IssmDouble>* vec_mask_ice, Element* element){/*{{{*/
++
++	/* Intermediaries */
++	int numnodes = element->GetNumberOfNodes();
++	
++	if(element->IsIceInElement()){
++		for(int i = 0;i<numnodes;i++){
++			vec_mask_ice->SetValue(element->nodes[i]->Sid(),1.,INS_VAL);
++		}
++	}
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17207)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17208)
+@@ -1367,7 +1367,7 @@
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+ 	/*If no front, return NULL*/
+-	if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
++	if(!element->IsIcefront()) return NULL;
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble  Jdet,thickness,bed,water_pressure,ice_pressure;
+@@ -1390,8 +1390,12 @@
+ 	IssmDouble rho_ice     = element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 	IssmDouble gravity     = element->GetMaterialParameter(ConstantsGEnum);
+ 	element->GetVerticesCoordinates(&xyz_list);
+-	element->ZeroLevelsetCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
++
++// 	element->ZeroLevelsetCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
++ 	element->GetIcefrontCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
++
+ 	element->NormalSection(&normal[0],xyz_list_front);
++// 	element->GetNormalFromLSF(&normal[0]);
+ 
+ 	/*Start looping on Gaussian points*/
+ 	Gauss* gauss=element->NewGauss(xyz_list,xyz_list_front,3);
+@@ -1780,7 +1784,7 @@
+ ElementVector* StressbalanceAnalysis::CreatePVectorL1L2Front(Element* element){/*{{{*/
+ 
+ 	/*If no front, return NULL*/
+-	if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
++	if(!element->IsIcefront()) return NULL;
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble  Jdet,thickness,bed,water_pressure,ice_pressure;
+@@ -2203,7 +2207,7 @@
+ ElementVector* StressbalanceAnalysis::CreatePVectorHOFront(Element* element){/*{{{*/
+ 
+ 	/*If no front, return NULL*/
+-	if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
++	if(!element->IsIcefront()) return NULL;
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble  Jdet,surface,z,water_pressure,ice_pressure;
+@@ -2969,7 +2973,7 @@
+ ElementVector* StressbalanceAnalysis::CreatePVectorFSFront(Element* element){/*{{{*/
+ 
+ 	/*If no front, return NULL*/
+-	if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
++	if(!element->IsIcefront()) return NULL;
+ 
+ 	/*Intermediaries*/
+ 	int         i,meshtype,dim;
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h	(revision 17207)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h	(revision 17208)
+@@ -30,5 +30,9 @@
+ 	void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 	void GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 
++	/* Updating constraints */
++	void UpdateNoIceConstraints(FemModel* femmodel);
++	IssmDouble* GetMaskOfIce(Elements* elements, Nodes* nodes);
++	void SetMaskOfIceElement(Vector<IssmDouble>* vec_mask_ice, Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/cores/transient_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17207)
++++ ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17208)
+@@ -161,9 +161,22 @@
+ 
+ 		if(islevelset){
+ 			if(VerboseSolution()) _printf0_("   computing movement of ice boundaries\n");
+-			analysis = new LevelsetAnalysis();
+-			analysis->Core(femmodel);
+-			delete analysis;
++
++			/* extrapolate */
++			Analysis* extanalysis = new ExtrapolationAnalysis();
++			int vars[2] = {VxEnum, VyEnum};
++			for(int iv=0; i<2;i++){
++				femmodel->parameters->SetParam(vars[i],ExtrapolationVariableEnum);
++				extanalysis->Core(femmodel);
++			}
++			delete extanalysis;
++
++			LevelsetAnalysis* lsanalysis = new LevelsetAnalysis();
++			/* solve level-set equation */
++			lsanalysis->Core(femmodel);
++			/* update spc boundary conditions for ice model */
++// 			lsanalysis->UpdateNoIceConstraints(femmodel);
++			delete lsanalysis;
+ 		}
+ 
+ 		/*unload results*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17207)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17208)
+@@ -219,6 +219,7 @@
+ 		virtual int    VelocityInterpolation()=0;
+ 		virtual int    PressureInterpolation()=0;
+ 		virtual bool   IsZeroLevelset(int levelset_enum)=0;
++		virtual bool   IsIcefront(void)=0;
+ 		virtual void   ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum)=0;
+ 		virtual void   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum)=0;
+ 		virtual void   GetNormalFromLSF(IssmDouble *pnormal)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17207)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17208)
+@@ -908,33 +908,50 @@
+ 			nrfrontnodes++;
+ 		}
+ 	}
+-
++	_assert_(nrfrontnodes==2);
++	
++	/* arrange order of frontnodes such that they are oriented counterclockwise */
++	if((NUMVERTICES+indicesfront[0]-indicesfront[1])%NUMVERTICES!=2){
++		int index=indicesfront[0];
++		indicesfront[0]=indicesfront[1];
++		indicesfront[1]=index;
++	}
+ 	IssmDouble* xyz_front = xNew<IssmDouble>(3*nrfrontnodes);
+ 	/* Return nodes */
+ 	for(i=0;i<nrfrontnodes;i++){
+ 		for(dir=0;dir<3;dir++){
+-			xyz_front[3*i+dir]=xyz_list[indicesfront[i]+dir];
++			xyz_front[3*i+dir]=xyz_list[3*indicesfront[i]+dir];
+ 		}
+ 	}
+ 
++// 	for(i=0;i<nrfrontnodes;i++){
++// 		_printf0_("coords frontnode " << i << " :[");
++// 		for(dir=0;dir<3;dir++){
++// 			xyz_front[3*i+dir]=xyz_list[indicesfront[i]+dir];
++// 			_printf0_(xyz_front[3*i+dir] << "; ");
++// 		}
++// 		_printf0_("]\n");
++// 	}
++
+ 	*pxyz_front=xyz_front;
+ 
+ 	xDelete<int>(indicesfront);
+ }/*}}}*/
+-void  Tria::GetNormalFromLSF(IssmDouble *pnormal){/*{{{*/
++void  Tria::GetNormalFromLSF(IssmDouble *normal){/*{{{*/
+ 
+ 	/* Intermediaries */
+ 	const int dim=2;
+ 	int i,counter;
+ 	IssmDouble* xyz_list = NULL;
+ 	IssmDouble  dlevelset[dim], norm_dlevelset;
+-	IssmDouble  normal[dim]={0.};
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	Input* levelset_input=this->GetInput(MaskIceLevelsetEnum); _assert_(levelset_input);
+ 	this->GetVerticesCoordinates(&xyz_list);
+ 	
+ 	counter=0;
++	for(i=0;i<dim;i++) normal[i]=0.;
++
+ 	Gauss* gauss = this->NewGauss(2);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		/* Get normal on node */
+@@ -946,9 +963,7 @@
+ 		counter++;
+ 	}
+ 	_assert_(counter>0);
+-	for(i=0;i<dim;i++) normal[i]/counter;
+-	
+-	pnormal=&normal[0];
++	for(i=0;i<dim;i++) normal[i]/=IssmDouble(counter);
+ 
+ 	delete gauss;
+ 	xDelete<IssmDouble>(xyz_list);
+@@ -2585,7 +2600,7 @@
+ 	/*Retrieve all inputs and parameters*/
+ 	GetInputListOnVertices(&ls[0],levelset_enum);
+ 
+-	/*If the level set is awlays <0, there is no ice front here*/
++	/* If levelset function changes sign, or is zero on at least two vertices, there is a zero level set here */
+ 	iszerols= false;
+ 	if(IsIceInElement()){
+ 		if(ls[0]*ls[1]<0. || ls[0]*ls[2]<0. || (ls[0]*ls[1]+ls[0]*ls[2]+ls[1]*ls[2]==0.)){
+@@ -2596,7 +2611,29 @@
+ 	return iszerols;
+ }
+ /*}}}*/
++/*FUNCTION Tria::IsIcefront{{{*/
++bool Tria::IsIcefront(void){
+ 
++	bool isicefront;
++	int i,nrice;
++	IssmDouble ls[NUMVERTICES];
++
++	/*Retrieve all inputs and parameters*/
++	GetInputListOnVertices(&ls[0],MaskIceLevelsetEnum);
++
++	/* If only one vertex has ice, there is an ice front here */
++	isicefront= false;
++	if(IsIceInElement()){
++		nrice=0;	
++		for(i=0;i<NUMVERTICES;i++)
++			if(ls[i]<0.) nrice++;
++		if(nrice==1) isicefront= true;
++	}
++	return isicefront;
++}
++/*}}}*/
++
++
+ #ifdef _HAVE_RESPONSES_
+ /*FUNCTION Tria::AverageOntoPartition {{{*/
+ void  Tria::AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part){
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17207)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17208)
+@@ -131,8 +131,9 @@
+ 		void   VerticalSegmentIndices(int** pindices,int* pnumseg){_error_("not implemented yet");};
+ 		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum);
+ 		void	    GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum);
+-	    void        GetNormalFromLSF(IssmDouble *pnormal);
++		void        GetNormalFromLSF(IssmDouble *normal);
+ 		bool        IsZeroLevelset(int levelset_enum);
++		bool        IsIcefront(void);
+ 
+ 		#ifdef _HAVE_RESPONSES_
+ 		void       AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17207)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17208)
+@@ -113,6 +113,7 @@
+ 		IssmDouble PureIceEnthalpy(IssmDouble pressure);
+ 		int    PressureInterpolation();
+ 		bool   IsZeroLevelset(int levelset_enum);
++		bool   IsIcefront(void){_error_("not implemented yet");};
+ 		void   ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum);
+ 		void   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented yet");};
+ 		void   GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17207)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17208)
+@@ -158,6 +158,7 @@
+ 		void        VerticalSegmentIndices(int** pindices,int* pnumseg){_error_("not implemented yet");};
+ 		void        ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
+ 		bool        IsZeroLevelset(int levelset_enum){_error_("not implemented");};
++		bool		IsIcefront(void){_error_("not implemented yet");};
+ 		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented");};
+ 		void		GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented yet");};
+ 		void        GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-17208-17209.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17208-17209.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17208-17209.diff	(revision 17802)
@@ -0,0 +1,79 @@
+Index: ../trunk-jpl/test/NightlyRun/test336.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test336.py	(revision 17208)
++++ ../trunk-jpl/test/NightlyRun/test336.py	(revision 17209)
+@@ -7,7 +7,7 @@
+ from solve import *
+ from MatlabFuncs import *
+ 
+-md=triangle(model(),'../Exp/Square.exp',150000.)
++md=triangle(model(),'../Exp/Square.exp',100000.)
+ md=setmask(md,'','')
+ md=parameterize(md,'../Par/SquareSheetConstrained.py') 
+ md=setflowequation(md,'SSA','all')
+@@ -19,33 +19,52 @@
+ md.transient.isthermal=False
+ md.transient.isgroundingline=False
+ md.transient.isgia=False
+-md.transient.islevelset=True
++md.transient.islevelset=False
+ 
+ # init levelset function
+ ymin=numpy.min(md.mesh.y)
+ ymax=numpy.max(md.mesh.y)
+ xmin=min(md.mesh.x)
+ xmax=max(md.mesh.x)
+-xmed=(xmax+xmin)/2
+-ymed=(ymax+ymin)/2
+-distx=numpy.absolute(md.mesh.x.reshape(-1,1)-xmed)
+-disty=numpy.absolute(md.mesh.y.reshape(-1,1)-ymed)
+-md.mask.ice_levelset=numpy.maximum(distx,disty)-1.e5
++xmed=(xmax+xmin)/2.
++ymed=(ymax+ymin)/2.
++md.mask.ice_levelset=numpy.sqrt(numpy.power(md.mesh.x-xmed,2.)+numpy.power(md.mesh.y-ymed,2.)) - (xmax-xmin)/3.
+ 
++# set spcs
++mask=1.*numpy.ones((md.mesh.numberofvertices,1))
++nrverts=md.mesh.elements.shape[1]
++for i in range(0,md.mesh.numberofelements):
++	elt=numpy.copy(md.mesh.elements[i])
++	elt-=1
++	isiceinelement=False
++	for iv in range(0,nrverts):
++		if(md.mask.ice_levelset[elt[iv]]<=0.):
++			isiceinelement=True
++	if(isiceinelement):
++		for iv in range(0,nrverts):
++			mask[elt[iv]]=2.
++
++v=0.
++for i in range(0,md.mesh.numberofvertices):
++	if(mask[i]==1.):
++		md.stressbalance.spcvx[i]=v
++		md.stressbalance.spcvy[i]=v
++		md.stressbalance.spcvz[i]=v
++
+ md=solve(md,TransientSolutionEnum())
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Vx','Vy','Vel','Pressure','MaskIceLevelset']
+-field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
++field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]#,1e-13,1e-13]
+ field_values=[\
+ 	md.results.TransientSolution[0].Vx,\
+ 	md.results.TransientSolution[0].Vy,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].MaskIceLevelset,\
++# 	md.results.TransientSolution[0].MaskIceLevelset,\
+ 	md.results.TransientSolution[1].Vx,\
+ 	md.results.TransientSolution[1].Vy,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].MaskIceLevelset,\
++# 	md.results.TransientSolution[1].MaskIceLevelset,\
+ 	]
+Index: ../trunk-jpl/test/Archives/Archive336.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17209-17210.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17209-17210.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17209-17210.diff	(revision 17802)
@@ -0,0 +1,525 @@
+Index: ../trunk-jpl/test/NightlyRun/test336.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test336.py	(revision 17209)
++++ ../trunk-jpl/test/NightlyRun/test336.py	(revision 17210)
+@@ -7,7 +7,7 @@
+ from solve import *
+ from MatlabFuncs import *
+ 
+-md=triangle(model(),'../Exp/Square.exp',100000.)
++md=triangle(model(),'../Exp/Square.exp',150000.)
+ md=setmask(md,'','')
+ md=parameterize(md,'../Par/SquareSheetConstrained.py') 
+ md=setflowequation(md,'SSA','all')
+@@ -19,52 +19,33 @@
+ md.transient.isthermal=False
+ md.transient.isgroundingline=False
+ md.transient.isgia=False
+-md.transient.islevelset=False
++md.transient.islevelset=True
+ 
+ # init levelset function
+ ymin=numpy.min(md.mesh.y)
+ ymax=numpy.max(md.mesh.y)
+ xmin=min(md.mesh.x)
+ xmax=max(md.mesh.x)
+-xmed=(xmax+xmin)/2.
+-ymed=(ymax+ymin)/2.
+-md.mask.ice_levelset=numpy.sqrt(numpy.power(md.mesh.x-xmed,2.)+numpy.power(md.mesh.y-ymed,2.)) - (xmax-xmin)/3.
++xmed=(xmax+xmin)/2
++ymed=(ymax+ymin)/2
++distx=numpy.absolute(md.mesh.x.reshape(-1,1)-xmed)
++disty=numpy.absolute(md.mesh.y.reshape(-1,1)-ymed)
++md.mask.ice_levelset=numpy.maximum(distx,disty)-1.e5
+ 
+-# set spcs
+-mask=1.*numpy.ones((md.mesh.numberofvertices,1))
+-nrverts=md.mesh.elements.shape[1]
+-for i in range(0,md.mesh.numberofelements):
+-	elt=numpy.copy(md.mesh.elements[i])
+-	elt-=1
+-	isiceinelement=False
+-	for iv in range(0,nrverts):
+-		if(md.mask.ice_levelset[elt[iv]]<=0.):
+-			isiceinelement=True
+-	if(isiceinelement):
+-		for iv in range(0,nrverts):
+-			mask[elt[iv]]=2.
+-
+-v=0.
+-for i in range(0,md.mesh.numberofvertices):
+-	if(mask[i]==1.):
+-		md.stressbalance.spcvx[i]=v
+-		md.stressbalance.spcvy[i]=v
+-		md.stressbalance.spcvz[i]=v
+-
+ md=solve(md,TransientSolutionEnum())
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Vx','Vy','Vel','Pressure','MaskIceLevelset']
+-field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]#,1e-13,1e-13]
++field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
+ field_values=[\
+ 	md.results.TransientSolution[0].Vx,\
+ 	md.results.TransientSolution[0].Vy,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-# 	md.results.TransientSolution[0].MaskIceLevelset,\
++	md.results.TransientSolution[0].MaskIceLevelset,\
+ 	md.results.TransientSolution[1].Vx,\
+ 	md.results.TransientSolution[1].Vy,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-# 	md.results.TransientSolution[1].MaskIceLevelset,\
++	md.results.TransientSolution[1].MaskIceLevelset,\
+ 	]
+Index: ../trunk-jpl/test/Archives/Archive336.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/externalpackages/ipython/install.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/ipython/install.sh	(revision 17209)
++++ ../trunk-jpl/externalpackages/ipython/install.sh	(revision 17210)
+@@ -6,8 +6,10 @@
+ rm -rf ipython-1.0.0
+ mkdir src 
+ 
+-#Download from ISSM server
+-$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/ipython-1.0.0.tar.gz' 'ipython-1.0.0.tar.gz'
++if [ ! -f ipython-1.0.0.tar.gz ]; then
++	#Download from ISSM server
++	$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/ipython-1.0.0.tar.gz' 'ipython-1.0.0.tar.gz'
++fi
+ 
+ #Untar 
+ tar -zxvf  ipython-1.0.0.tar.gz
+Index: ../trunk-jpl/externalpackages/vim/addons/vimrc
+===================================================================
+--- ../trunk-jpl/externalpackages/vim/addons/vimrc	(revision 17209)
++++ ../trunk-jpl/externalpackages/vim/addons/vimrc	(revision 17210)
+@@ -99,13 +99,17 @@
+ map num :set number!<CR>
+ 
+ " save & "make" the current file in all modes
+-map <F8> :w <Enter> :make <Enter><Enter>
+-map! <F8>  <ESC> :w <Enter> :make <Enter><Enter>
++map <F6> :w <Enter> :make <Enter><Enter>
++map! <F6>  <ESC> :w <Enter> :make <Enter><Enter>
+ " make update: nice for longer documents
+-map <F7> :w <Enter> :make update <Enter><Enter>
+-map! <F7> <ESC> :w <Enter> :make update <Enter><Enter>
++map <F5> :w <Enter> :make update <Enter><Enter>
++map! <F5> <ESC> :w <Enter> :make update <Enter><Enter>
+ 
++" switch between tabs
++nmap <F7> :tabp <CR>
++nmap <F8> :tabn <CR>
+ 
++
+ "use paste P: re-indent and re-format at the same time
+ :nnoremap <Esc>P P'[v']=
+ :nnoremap <Esc>p p'[v']=
+@@ -140,6 +144,15 @@
+   "scripts must be executable
+   autocmd BufWritePost   *.sh         !chmod +x %
+ 
++	" Commenting blocks of code.
++	autocmd FileType c,cpp,java,scala let b:comment_leader = '// '
++	autocmd FileType sh,ruby,python   let b:comment_leader = '# '
++	autocmd FileType conf,fstab       let b:comment_leader = '# '
++	autocmd FileType tex              let b:comment_leader = '% '
++	autocmd FileType mail             let b:comment_leader = '> '
++	autocmd FileType vim              let b:comment_leader = '" '
++	noremap <silent> ,cc :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR>
++	noremap <silent> ,cu :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR>
+ endif " has("autocmd")
+ " ----------------------------------------------------------------------}}}
+ " Matlab special {{{
+Index: ../trunk-jpl/externalpackages/matplotlib/install-linux64.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/matplotlib/install-linux64.sh	(revision 17209)
++++ ../trunk-jpl/externalpackages/matplotlib/install-linux64.sh	(revision 17210)
+@@ -7,8 +7,10 @@
+ export FC="gfortran -fPIC"
+ export FFLAGS=-ff2c
+ 
+-git clone https://github.com/matplotlib/matplotlib
+-mv matplotlib src
++if [ ! -d src ]; then
++	git clone https://github.com/matplotlib/matplotlib
++	mv matplotlib src
++fi
+ cd src
+ python setup.py build 
+ python setup.py install 
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17209)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17210)
+@@ -66,14 +66,21 @@
+ 	/*parameters: */
+ 	bool save_results;
+ 
++	/* extrapolate */
++	Analysis* analysis = new ExtrapolationAnalysis();
++	femmodel->parameters->SetParam(VxEnum,ExtrapolationVariableEnum);
++	analysis->Core(femmodel);
++	delete analysis;
++
+ 	/*activate formulation: */
+ 	femmodel->SetCurrentConfiguration(LevelsetAnalysisEnum);
+ 
++	/*recover parameters: */
++	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
++
+ 	if(VerboseSolution()) _printf0_("call computational core:\n");
+ 	solutionsequence_linear(femmodel);
+ 
+-	/*recover parameters: */
+-	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
+ 	if(save_results){
+ 		if(VerboseSolution()) _printf0_("   saving results\n");
+ 		int outputs = MaskIceLevelsetEnum;
+@@ -316,57 +323,3 @@
+ 
+ }/*}}}*/
+ 
+-/* Update of constraints */
+-void LevelsetAnalysis::UpdateNoIceConstraints(FemModel* femmodel){/*{{{*/
+-
+-	IssmDouble* mask_ice = GetMaskOfIce(femmodel->elements, femmodel->nodes); 
+-
+-	for (int i=0;i<femmodel->nodes->Size();i++){
+-		Node* node=dynamic_cast<Node*>(femmodel->nodes->GetObjectByOffset(i));
+-		if(node->InAnalysis(LevelsetAnalysisEnum)){
+-			if(mask_ice[node->Sid()]==1.){//FIXME: what should be done with actual spcs to ice model?
+-// 				node->DofInFSet(0); /*remove spc*/ 
+-			}
+-			else{
+-				IssmDouble defval=0.;
+-				node->ApplyConstraint(1,defval); /*apply spc*/ 
+-			}
+-		}
+-	}
+-}/*}}}*/
+-IssmDouble* LevelsetAnalysis::GetMaskOfIce(Elements* elements, Nodes* nodes){/*{{{*/
+-
+-	int                 i;
+-	IssmDouble*         mask_ice      = NULL;
+-	Vector<IssmDouble>* vec_mask_ice  = NULL;
+-	Element*            element       = NULL;
+-
+-	/*Initialize vector with number of vertices*/
+-	IssmDouble numnodes=nodes->NumberOfNodes(LevelsetAnalysisEnum);
+-	vec_mask_ice=new Vector<IssmDouble>(numnodes); //nodes at ice front that have ice at next time step
+-	for(i=0;i<numnodes;i++)
+-		vec_mask_ice[i]=0.;
+-	/*Fill vector vertices that have no contact to ice: */
+-	for(i=0;i<elements->Size();i++){
+-		element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+-		SetMaskOfIceElement(vec_mask_ice, element);
+-	}
+-
+-	/*Assemble vector and serialize */
+-	vec_mask_ice->Assemble();
+-	mask_ice=vec_mask_ice->ToMPISerial();
+-	delete vec_mask_ice;
+-	return mask_ice;
+-
+-}/*}}}*/
+-void LevelsetAnalysis::SetMaskOfIceElement(Vector<IssmDouble>* vec_mask_ice, Element* element){/*{{{*/
+-
+-	/* Intermediaries */
+-	int numnodes = element->GetNumberOfNodes();
+-	
+-	if(element->IsIceInElement()){
+-		for(int i = 0;i<numnodes;i++){
+-			vec_mask_ice->SetValue(element->nodes[i]->Sid(),1.,INS_VAL);
+-		}
+-	}
+-}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17209)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17210)
+@@ -1367,7 +1367,7 @@
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+ 	/*If no front, return NULL*/
+-	if(!element->IsIcefront()) return NULL;
++	if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble  Jdet,thickness,bed,water_pressure,ice_pressure;
+@@ -1390,12 +1390,8 @@
+ 	IssmDouble rho_ice     = element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 	IssmDouble gravity     = element->GetMaterialParameter(ConstantsGEnum);
+ 	element->GetVerticesCoordinates(&xyz_list);
+-
+-// 	element->ZeroLevelsetCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
+- 	element->GetIcefrontCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
+-
++	element->ZeroLevelsetCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
+ 	element->NormalSection(&normal[0],xyz_list_front);
+-// 	element->GetNormalFromLSF(&normal[0]);
+ 
+ 	/*Start looping on Gaussian points*/
+ 	Gauss* gauss=element->NewGauss(xyz_list,xyz_list_front,3);
+@@ -1784,7 +1780,7 @@
+ ElementVector* StressbalanceAnalysis::CreatePVectorL1L2Front(Element* element){/*{{{*/
+ 
+ 	/*If no front, return NULL*/
+-	if(!element->IsIcefront()) return NULL;
++	if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble  Jdet,thickness,bed,water_pressure,ice_pressure;
+@@ -2207,7 +2203,7 @@
+ ElementVector* StressbalanceAnalysis::CreatePVectorHOFront(Element* element){/*{{{*/
+ 
+ 	/*If no front, return NULL*/
+-	if(!element->IsIcefront()) return NULL;
++	if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble  Jdet,surface,z,water_pressure,ice_pressure;
+@@ -2973,7 +2969,7 @@
+ ElementVector* StressbalanceAnalysis::CreatePVectorFSFront(Element* element){/*{{{*/
+ 
+ 	/*If no front, return NULL*/
+-	if(!element->IsIcefront()) return NULL;
++	if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
+ 
+ 	/*Intermediaries*/
+ 	int         i,meshtype,dim;
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17209)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17210)
+@@ -825,7 +825,7 @@
+ 	/*Intermediaries*/
+ 	int solution_type, i;
+ 	bool computebasalmeltingrates=true;
+-	bool isdrainage=true;
++	bool isdrainage=false;
+ 	bool updatebasalconstraints=true;
+ 
+ 	if(isdrainage){
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h	(revision 17209)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h	(revision 17210)
+@@ -30,9 +30,5 @@
+ 	void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 	void GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 
+-	/* Updating constraints */
+-	void UpdateNoIceConstraints(FemModel* femmodel);
+-	IssmDouble* GetMaskOfIce(Elements* elements, Nodes* nodes);
+-	void SetMaskOfIceElement(Vector<IssmDouble>* vec_mask_ice, Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/cores/transient_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17209)
++++ ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17210)
+@@ -161,22 +161,9 @@
+ 
+ 		if(islevelset){
+ 			if(VerboseSolution()) _printf0_("   computing movement of ice boundaries\n");
+-
+-			/* extrapolate */
+-			Analysis* extanalysis = new ExtrapolationAnalysis();
+-			int vars[2] = {VxEnum, VyEnum};
+-			for(int iv=0; i<2;i++){
+-				femmodel->parameters->SetParam(vars[i],ExtrapolationVariableEnum);
+-				extanalysis->Core(femmodel);
+-			}
+-			delete extanalysis;
+-
+-			LevelsetAnalysis* lsanalysis = new LevelsetAnalysis();
+-			/* solve level-set equation */
+-			lsanalysis->Core(femmodel);
+-			/* update spc boundary conditions for ice model */
+-// 			lsanalysis->UpdateNoIceConstraints(femmodel);
+-			delete lsanalysis;
++			analysis = new LevelsetAnalysis();
++			analysis->Core(femmodel);
++			delete analysis;
+ 		}
+ 
+ 		/*unload results*/
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17209)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17210)
+@@ -406,6 +406,8 @@
+ 	/*start module: */
+ 	if(VerboseModule()) _printf0_("   Updating constraints for time: " << time << "\n");
+ 
++	// analysis->UpdateConstraints();
++	
+ 	/*Second, constraints might be time dependent: */
+ 	SpcNodesx(nodes,constraints,parameters,analysis_type); 
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17209)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17210)
+@@ -219,7 +219,6 @@
+ 		virtual int    VelocityInterpolation()=0;
+ 		virtual int    PressureInterpolation()=0;
+ 		virtual bool   IsZeroLevelset(int levelset_enum)=0;
+-		virtual bool   IsIcefront(void)=0;
+ 		virtual void   ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum)=0;
+ 		virtual void   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum)=0;
+ 		virtual void   GetNormalFromLSF(IssmDouble *pnormal)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17209)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17210)
+@@ -908,50 +908,33 @@
+ 			nrfrontnodes++;
+ 		}
+ 	}
+-	_assert_(nrfrontnodes==2);
+-	
+-	/* arrange order of frontnodes such that they are oriented counterclockwise */
+-	if((NUMVERTICES+indicesfront[0]-indicesfront[1])%NUMVERTICES!=2){
+-		int index=indicesfront[0];
+-		indicesfront[0]=indicesfront[1];
+-		indicesfront[1]=index;
+-	}
++
+ 	IssmDouble* xyz_front = xNew<IssmDouble>(3*nrfrontnodes);
+ 	/* Return nodes */
+ 	for(i=0;i<nrfrontnodes;i++){
+ 		for(dir=0;dir<3;dir++){
+-			xyz_front[3*i+dir]=xyz_list[3*indicesfront[i]+dir];
++			xyz_front[3*i+dir]=xyz_list[indicesfront[i]+dir];
+ 		}
+ 	}
+ 
+-// 	for(i=0;i<nrfrontnodes;i++){
+-// 		_printf0_("coords frontnode " << i << " :[");
+-// 		for(dir=0;dir<3;dir++){
+-// 			xyz_front[3*i+dir]=xyz_list[indicesfront[i]+dir];
+-// 			_printf0_(xyz_front[3*i+dir] << "; ");
+-// 		}
+-// 		_printf0_("]\n");
+-// 	}
+-
+ 	*pxyz_front=xyz_front;
+ 
+ 	xDelete<int>(indicesfront);
+ }/*}}}*/
+-void  Tria::GetNormalFromLSF(IssmDouble *normal){/*{{{*/
++void  Tria::GetNormalFromLSF(IssmDouble *pnormal){/*{{{*/
+ 
+ 	/* Intermediaries */
+ 	const int dim=2;
+ 	int i,counter;
+ 	IssmDouble* xyz_list = NULL;
+ 	IssmDouble  dlevelset[dim], norm_dlevelset;
++	IssmDouble  normal[dim]={0.};
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	Input* levelset_input=this->GetInput(MaskIceLevelsetEnum); _assert_(levelset_input);
+ 	this->GetVerticesCoordinates(&xyz_list);
+ 	
+ 	counter=0;
+-	for(i=0;i<dim;i++) normal[i]=0.;
+-
+ 	Gauss* gauss = this->NewGauss(2);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		/* Get normal on node */
+@@ -963,7 +946,9 @@
+ 		counter++;
+ 	}
+ 	_assert_(counter>0);
+-	for(i=0;i<dim;i++) normal[i]/=IssmDouble(counter);
++	for(i=0;i<dim;i++) normal[i]/counter;
++	
++	pnormal=&normal[0];
+ 
+ 	delete gauss;
+ 	xDelete<IssmDouble>(xyz_list);
+@@ -2600,7 +2585,7 @@
+ 	/*Retrieve all inputs and parameters*/
+ 	GetInputListOnVertices(&ls[0],levelset_enum);
+ 
+-	/* If levelset function changes sign, or is zero on at least two vertices, there is a zero level set here */
++	/*If the level set is awlays <0, there is no ice front here*/
+ 	iszerols= false;
+ 	if(IsIceInElement()){
+ 		if(ls[0]*ls[1]<0. || ls[0]*ls[2]<0. || (ls[0]*ls[1]+ls[0]*ls[2]+ls[1]*ls[2]==0.)){
+@@ -2611,29 +2596,7 @@
+ 	return iszerols;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::IsIcefront{{{*/
+-bool Tria::IsIcefront(void){
+ 
+-	bool isicefront;
+-	int i,nrice;
+-	IssmDouble ls[NUMVERTICES];
+-
+-	/*Retrieve all inputs and parameters*/
+-	GetInputListOnVertices(&ls[0],MaskIceLevelsetEnum);
+-
+-	/* If only one vertex has ice, there is an ice front here */
+-	isicefront= false;
+-	if(IsIceInElement()){
+-		nrice=0;	
+-		for(i=0;i<NUMVERTICES;i++)
+-			if(ls[i]<0.) nrice++;
+-		if(nrice==1) isicefront= true;
+-	}
+-	return isicefront;
+-}
+-/*}}}*/
+-
+-
+ #ifdef _HAVE_RESPONSES_
+ /*FUNCTION Tria::AverageOntoPartition {{{*/
+ void  Tria::AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part){
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17209)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17210)
+@@ -131,9 +131,8 @@
+ 		void   VerticalSegmentIndices(int** pindices,int* pnumseg){_error_("not implemented yet");};
+ 		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum);
+ 		void	    GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum);
+-		void        GetNormalFromLSF(IssmDouble *normal);
++	    void        GetNormalFromLSF(IssmDouble *pnormal);
+ 		bool        IsZeroLevelset(int levelset_enum);
+-		bool        IsIcefront(void);
+ 
+ 		#ifdef _HAVE_RESPONSES_
+ 		void       AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17209)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17210)
+@@ -113,7 +113,6 @@
+ 		IssmDouble PureIceEnthalpy(IssmDouble pressure);
+ 		int    PressureInterpolation();
+ 		bool   IsZeroLevelset(int levelset_enum);
+-		bool   IsIcefront(void){_error_("not implemented yet");};
+ 		void   ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum);
+ 		void   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented yet");};
+ 		void   GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17209)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17210)
+@@ -158,7 +158,6 @@
+ 		void        VerticalSegmentIndices(int** pindices,int* pnumseg){_error_("not implemented yet");};
+ 		void        ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
+ 		bool        IsZeroLevelset(int levelset_enum){_error_("not implemented");};
+-		bool		IsIcefront(void){_error_("not implemented yet");};
+ 		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented");};
+ 		void		GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented yet");};
+ 		void        GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-17210-17211.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17210-17211.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17210-17211.diff	(revision 17802)
@@ -0,0 +1,89 @@
+Index: ../trunk-jpl/externalpackages/ipython/install.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/ipython/install.sh	(revision 17210)
++++ ../trunk-jpl/externalpackages/ipython/install.sh	(revision 17211)
+@@ -6,10 +6,8 @@
+ rm -rf ipython-1.0.0
+ mkdir src 
+ 
+-if [ ! -f ipython-1.0.0.tar.gz ]; then
+-	#Download from ISSM server
+-	$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/ipython-1.0.0.tar.gz' 'ipython-1.0.0.tar.gz'
+-fi
++#Download from ISSM server
++$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/ipython-1.0.0.tar.gz' 'ipython-1.0.0.tar.gz'
+ 
+ #Untar 
+ tar -zxvf  ipython-1.0.0.tar.gz
+Index: ../trunk-jpl/externalpackages/vim/addons/vimrc
+===================================================================
+--- ../trunk-jpl/externalpackages/vim/addons/vimrc	(revision 17210)
++++ ../trunk-jpl/externalpackages/vim/addons/vimrc	(revision 17211)
+@@ -99,17 +99,13 @@
+ map num :set number!<CR>
+ 
+ " save & "make" the current file in all modes
+-map <F6> :w <Enter> :make <Enter><Enter>
+-map! <F6>  <ESC> :w <Enter> :make <Enter><Enter>
++map <F8> :w <Enter> :make <Enter><Enter>
++map! <F8>  <ESC> :w <Enter> :make <Enter><Enter>
+ " make update: nice for longer documents
+-map <F5> :w <Enter> :make update <Enter><Enter>
+-map! <F5> <ESC> :w <Enter> :make update <Enter><Enter>
++map <F7> :w <Enter> :make update <Enter><Enter>
++map! <F7> <ESC> :w <Enter> :make update <Enter><Enter>
+ 
+-" switch between tabs
+-nmap <F7> :tabp <CR>
+-nmap <F8> :tabn <CR>
+ 
+-
+ "use paste P: re-indent and re-format at the same time
+ :nnoremap <Esc>P P'[v']=
+ :nnoremap <Esc>p p'[v']=
+@@ -144,15 +140,6 @@
+   "scripts must be executable
+   autocmd BufWritePost   *.sh         !chmod +x %
+ 
+-	" Commenting blocks of code.
+-	autocmd FileType c,cpp,java,scala let b:comment_leader = '// '
+-	autocmd FileType sh,ruby,python   let b:comment_leader = '# '
+-	autocmd FileType conf,fstab       let b:comment_leader = '# '
+-	autocmd FileType tex              let b:comment_leader = '% '
+-	autocmd FileType mail             let b:comment_leader = '> '
+-	autocmd FileType vim              let b:comment_leader = '" '
+-	noremap <silent> ,cc :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR>
+-	noremap <silent> ,cu :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR>
+ endif " has("autocmd")
+ " ----------------------------------------------------------------------}}}
+ " Matlab special {{{
+Index: ../trunk-jpl/externalpackages/matplotlib/install-linux64.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/matplotlib/install-linux64.sh	(revision 17210)
++++ ../trunk-jpl/externalpackages/matplotlib/install-linux64.sh	(revision 17211)
+@@ -7,10 +7,8 @@
+ export FC="gfortran -fPIC"
+ export FFLAGS=-ff2c
+ 
+-if [ ! -d src ]; then
+-	git clone https://github.com/matplotlib/matplotlib
+-	mv matplotlib src
+-fi
++git clone https://github.com/matplotlib/matplotlib
++mv matplotlib src
+ cd src
+ python setup.py build 
+ python setup.py install 
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17210)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17211)
+@@ -825,7 +825,7 @@
+ 	/*Intermediaries*/
+ 	int solution_type, i;
+ 	bool computebasalmeltingrates=true;
+-	bool isdrainage=false;
++	bool isdrainage=true;
+ 	bool updatebasalconstraints=true;
+ 
+ 	if(isdrainage){
Index: issm/oecreview/Archive/16554-17801/ISSM-17211-17212.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17211-17212.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17211-17212.diff	(revision 17802)
@@ -0,0 +1,823 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h	(revision 17212)
+@@ -31,5 +31,6 @@
+ 		ElementVector* CreatePVector3D(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp	(revision 17212)
+@@ -47,3 +47,7 @@
+ void BalancethicknessSoftAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 	_error_("not implemented yet");
+ }/*}}}*/
++void BalancethicknessSoftAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 17212)
+@@ -314,6 +314,10 @@
+ 	xDelete<IssmDouble>(values);
+ 	xDelete<int>(doflist);
+ }/*}}}*/
++void HydrologyShreveAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+ 
+ /*Intermediaries*/
+ void HydrologyShreveAnalysis::CreateHydrologyWaterVelocityInput(Element* element){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17212)
+@@ -28,6 +28,7 @@
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void GetSolutionFromInputsHoriz(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
+ 
+ 		/*SSA*/
+ 		ElementMatrix* CreateJacobianMatrixSSA(Element* element);
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 17212)
+@@ -27,6 +27,7 @@
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
+ 
+ 		/*Intermediaries*/
+ 		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 17212)
+@@ -491,3 +491,7 @@
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ }/*}}}*/
++void BalancethicknessAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.h	(revision 17212)
+@@ -35,5 +35,6 @@
+ 		void GetBAdvecprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17212)
+@@ -102,16 +102,13 @@
+ void HydrologyDCEfficientAnalysis::Core(FemModel* femmodel){/*{{{*/
+ 	_error_("not implemented");
+ }/*}}}*/
+-
+ ElementVector* HydrologyDCEfficientAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+ }/*}}}*/
+-
+ ElementMatrix* HydrologyDCEfficientAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
+-
+ ElementMatrix* HydrologyDCEfficientAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+@@ -292,11 +289,9 @@
+ 	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
+-
+ void HydrologyDCEfficientAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,EplHeadEnum);
+ }/*}}}*/
+-
+ void HydrologyDCEfficientAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 
+ 	int meshtype,i;
+@@ -348,6 +343,10 @@
+ 	xDelete<int>(doflist);
+ 	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ } /*}}}*/
++void HydrologyDCEfficientAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+ 
+ /*Intermediaries*/
+ IssmDouble HydrologyDCEfficientAnalysis::EplSpecificStoring(Element* element){/*{{{*/
+@@ -358,7 +357,6 @@
+ 	IssmDouble water_compressibility = element->GetMaterialParameter(HydrologydcWaterCompressibilityEnum);
+ 	return rho_freshwater*g*epl_porosity*(water_compressibility+(epl_compressibility/epl_porosity));		 
+ }/*}}}*/
+-
+ void HydrologyDCEfficientAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h	(revision 17212)
+@@ -31,5 +31,6 @@
+ 		void GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 17212)
+@@ -995,3 +995,7 @@
+ 	xDelete<IssmDouble>(lambdax);
+ 	xDelete<IssmDouble>(values);
+ }/*}}}*/
++void AdjointHorizAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 17212)
+@@ -256,3 +256,7 @@
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ }/*}}}*/
++void BalancevelocityAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/MeltingAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeltingAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/MeltingAnalysis.h	(revision 17212)
+@@ -27,5 +27,6 @@
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/GiaAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/GiaAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/GiaAnalysis.h	(revision 17212)
+@@ -27,5 +27,6 @@
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 17212)
+@@ -218,3 +218,7 @@
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ }/*}}}*/
++void L2ProjectionBaseAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17212)
+@@ -367,3 +367,7 @@
+ 
+ 	element->InputUpdateFromSolutionOneDof(solution,SurfaceEnum);
+ }/*}}}*/
++void FreeSurfaceTopAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h	(revision 17212)
+@@ -27,5 +27,6 @@
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h	(revision 17212)
+@@ -27,5 +27,6 @@
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 17212)
+@@ -467,3 +467,7 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<int>(doflist);
+ }/*}}}*/
++void StressbalanceVerticalAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17212)
+@@ -267,6 +267,10 @@
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ }/*}}}*/
++void LevelsetAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+ void LevelsetAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
+Index: ../trunk-jpl/src/c/analyses/Analysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/Analysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/Analysis.h	(revision 17212)
+@@ -39,5 +39,6 @@
+ 		virtual ElementVector* CreatePVector(Element* element)=0;
+ 		virtual void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element)=0;
+ 		virtual void InputUpdateFromSolution(IssmDouble* solution,Element* element)=0;
++		virtual void UpdateConstraints(FemModel* femmodel)=0;
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h	(revision 17212)
+@@ -33,5 +33,6 @@
+ 		void GetBprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 17212)
+@@ -512,3 +512,7 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<int>(doflist);
+ }/*}}}*/
++void StressbalanceSIAAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h	(revision 17212)
+@@ -29,6 +29,7 @@
+ 		void GetBprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
+ 
+ 		/*Intermediaries*/
+ 		void CreateDamageFInput(Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17212)
+@@ -1022,6 +1022,10 @@
+ 			_error_("Approximation "<<EnumToStringx(approximation)<<" not supported");
+ 	}
+ }/*}}}*/
++void StressbalanceAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+ 
+ /*SSA*/
+ ElementMatrix* StressbalanceAnalysis::CreateJacobianMatrixSSA(Element* element){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h	(revision 17212)
+@@ -27,5 +27,6 @@
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h	(revision 17212)
+@@ -35,6 +35,7 @@
+ 		void GetBAdvecprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
+ 
+ 		/*Modules*/
+ 		static void PostProcessing(FemModel* femmodel);
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h	(revision 17212)
+@@ -29,5 +29,6 @@
+ 		void GetBprime(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h	(revision 17212)
+@@ -27,5 +27,6 @@
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17212)
+@@ -298,7 +298,6 @@
+ 	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
+-
+ void HydrologyDCInefficientAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
+@@ -326,11 +325,9 @@
+ 	/*Clean-up*/
+ 	xDelete<IssmDouble>(dbasis);
+ }/*}}}*/
+-
+ void HydrologyDCInefficientAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,SedimentHeadEnum);
+ }/*}}}*/
+-
+ void HydrologyDCInefficientAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 
+ 	int        meshtype;
+@@ -389,6 +386,10 @@
+ 	xDelete<int>(doflist);
+ 	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ }/*}}}*/
++void HydrologyDCInefficientAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+ 
+ /*Intermediaries*/
+ IssmDouble HydrologyDCInefficientAnalysis::SedimentStoring(Element* element){/*{{{*/
+@@ -400,7 +401,6 @@
+ 	IssmDouble water_compressibility    = element->GetMaterialParameter(HydrologydcWaterCompressibilityEnum);
+ 	return rho_freshwater*g*sediment_porosity*sediment_thickness*(water_compressibility+(sediment_compressibility/sediment_porosity));		 
+ }/*}}}*/
+-
+ void HydrologyDCInefficientAnalysis::ElementizeEplMask(FemModel* femmodel){/*{{{*/
+ 
+ 	bool     element_active;
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h	(revision 17212)
+@@ -27,5 +27,6 @@
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h	(revision 17212)
+@@ -31,5 +31,6 @@
+ 		void GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17212)
+@@ -681,3 +681,7 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<int>(doflist);
+ }/*}}}*/
++void ThermalAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.h	(revision 17212)
+@@ -27,9 +27,9 @@
+ 	ElementVector* CreatePVector(Element* element);
+ 	void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 	void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++	void UpdateConstraints(FemModel* femmodel);
+ 	void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 	void GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+-	void UpdateConstraints(Elements* elements);
+ 	void SetConstraintsOnIce(Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 17212)
+@@ -242,3 +242,7 @@
+ 	element->FindParam(&inputenum,InputToExtrudeEnum);
+ 	element->InputUpdateFromSolutionOneDof(solution,inputenum);
+ }/*}}}*/
++void ExtrudeFromBaseAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 17212)
+@@ -134,3 +134,7 @@
+ void MeltingAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 	element->InputUpdateFromSolutionOneDof(solution,BasalforcingsMeltingRateEnum);
+ }/*}}}*/
++void MeltingAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/GiaAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/GiaAnalysis.cpp	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/GiaAnalysis.cpp	(revision 17212)
+@@ -59,3 +59,7 @@
+ void GiaAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 	_error_("not implemented yet");
+ }/*}}}*/
++void GiaAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h	(revision 17212)
+@@ -27,5 +27,6 @@
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h	(revision 17212)
+@@ -27,6 +27,7 @@
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
+ 
+ 		/*Intermediaries*/
+ 		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h	(revision 17212)
+@@ -33,5 +33,6 @@
+ 		void GetBprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 17212)
+@@ -27,6 +27,7 @@
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
+ 
+ 		/*Intermediaries*/
+ 		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h	(revision 17212)
+@@ -33,6 +33,7 @@
+ 		ElementVector* CreatePVectorFS(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
+ 		void InputUpdateFromSolutionHoriz(IssmDouble* solution,Element* element);
+ 		void InputUpdateFromSolutionFS(IssmDouble* solution,Element* element);
+ };
+Index: ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h	(revision 17212)
+@@ -27,5 +27,6 @@
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 17212)
+@@ -163,3 +163,7 @@
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ }/*}}}*/
++void AdjointBalancethicknessAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h	(revision 17212)
+@@ -27,5 +27,6 @@
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 17212)
+@@ -72,16 +72,13 @@
+ void           L2ProjectionEPLAnalysis::Core(FemModel* femmodel){/*{{{*/
+ 	_error_("not implemented");
+ }/*}}}*/
+-
+ ElementVector* L2ProjectionEPLAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+ 	return NULL;
+ }/*}}}*/
+-
+ ElementMatrix* L2ProjectionEPLAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ _error_("Not implemented");
+ }/*}}}*/
+-
+ ElementMatrix* L2ProjectionEPLAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+@@ -231,11 +228,9 @@
+ 	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
+-
+ void L2ProjectionEPLAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+-
+ void L2ProjectionEPLAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 	int inputenum,meshtype;
+ 
+@@ -254,4 +249,8 @@
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ }/*}}}*/
++void L2ProjectionEPLAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+ 
+Index: ../trunk-jpl/src/c/analyses/EnumToAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnumToAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/EnumToAnalysis.h	(revision 17212)
+@@ -22,3 +22,4 @@
+ 		ElementVector* CreatePVector(Element* element);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17212)
+@@ -691,3 +691,7 @@
+ 	xDelete<int>(doflist);
+ 	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ }/*}}}*/
++void MasstransportAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h	(revision 17212)
+@@ -29,5 +29,6 @@
+ 		void GetBprime(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17212)
+@@ -383,6 +383,10 @@
+ 	xDelete<IssmDouble>(values);
+ 	xDelete<int>(doflist);
+ }/*}}}*/
++void DamageEvolutionAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+ 
+ /*Intermediaries*/
+ void DamageEvolutionAnalysis::CreateDamageFInput(Element* element){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17212)
+@@ -817,8 +817,11 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<int>(doflist);
+ }/*}}}*/
++void EnthalpyAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+ 
+-
+ /*Modules*/
+ void EnthalpyAnalysis::PostProcessing(FemModel* femmodel){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp	(revision 17212)
+@@ -47,3 +47,7 @@
+ void MeshdeformationAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 	_error_("not implemented yet");
+ }/*}}}*/
++void MeshdeformationAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17212)
+@@ -362,3 +362,7 @@
+ void FreeSurfaceBaseAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 	element->InputUpdateFromSolutionOneDof(solution,BedEnum);
+ }/*}}}*/
++void FreeSurfaceBaseAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 17212)
+@@ -177,3 +177,7 @@
+ void SmoothedSurfaceSlopeXAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 	element->InputUpdateFromSolutionOneDof(solution,SurfaceSlopeXEnum);
+ }/*}}}*/
++void SmoothedSurfaceSlopeXAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 17212)
+@@ -242,3 +242,7 @@
+ 	element->FindParam(&inputenum,InputToExtrudeEnum);
+ 	element->InputUpdateFromSolutionOneDof(solution,inputenum);
+ }/*}}}*/
++void ExtrudeFromTopAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 17212)
+@@ -177,3 +177,7 @@
+ void SmoothedSurfaceSlopeYAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 	element->InputUpdateFromSolutionOneDof(solution,SurfaceSlopeYEnum);
+ }/*}}}*/
++void SmoothedSurfaceSlopeYAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h	(revision 17212)
+@@ -26,7 +26,8 @@
+ 	ElementMatrix* CreateKMatrix(Element* element);
+ 	ElementVector* CreatePVector(Element* element);
+ 	void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+-	void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
+ 	void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 	void GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h	(revision 17212)
+@@ -33,5 +33,6 @@
+ 		void GetBprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17211)
++++ ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17212)
+@@ -52,7 +52,6 @@
+ 	femmodel->SetCurrentConfiguration(ExtrapolationAnalysisEnum);
+ 
+ 	if(VerboseSolution()) _printf0_("extrapolation: call computational core:\n");
+-	UpdateConstraints(femmodel->elements);
+ 	solutionsequence_linear(femmodel);
+ 
+ 	/*recover parameters: */
+@@ -253,14 +252,6 @@
+ 	xDelete<IssmDouble>(dbasis);
+ 
+ }/*}}}*/
+-void ExtrapolationAnalysis::UpdateConstraints(Elements* elements){/*{{{*/
+-
+-	for(int i=0;i<elements->Size();i++){
+-		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+-		this->SetConstraintsOnIce(element);
+-	}
+-
+-}/*}}}*/
+ void ExtrapolationAnalysis::SetConstraintsOnIce(Element* element){/*{{{*/
+ 
+ 	int numnodes=element->GetNumberOfNodes();	
+@@ -293,3 +284,11 @@
+ 	}
+ 	delete gauss;
+ }/*}}}*/
++void ExtrapolationAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++
++	for(int i=0;i<femmodel->elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++		this->SetConstraintsOnIce(element);
++	}
++
++}/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17212-17213.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17212-17213.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17212-17213.diff	(revision 17802)
@@ -0,0 +1,86 @@
+Index: ../trunk-jpl/test/NightlyRun/test703.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test703.m	(revision 17212)
++++ ../trunk-jpl/test/NightlyRun/test703.m	(revision 17213)
+@@ -65,9 +65,9 @@
+ 	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2',...
+ 	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3'};
+ field_tolerances={...
+-	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+-	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+-	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
++	1e-08,1e-08,1e-08,1e-08,1e-10,1e-10,1e-10,...
++	1e-08,1e-08,1e-08,1e-08,1e-10,1e-10,1e-10,...
++	1e-08,1e-08,1e-08,1e-08,1e-10,1e-10,1e-10};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
+ 	(md.results.TransientSolution(1).Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test211.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.py	(revision 17212)
++++ ../trunk-jpl/test/NightlyRun/test211.py	(revision 17213)
+@@ -25,7 +25,7 @@
+ 	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsMeltingRate2', \
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3']
+ field_tolerances=[\
+-	1e-08,1e-08,1e-06,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,\
++	2e-08,1e-08,1e-06,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,\
+ 	1e-08,1e-08,1e-06,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,2e-06,\
+ 	1e-07,1e-07,1e-06,3e-08,1e-08,1e-08,1e-08,1e-08,1e-08,2e-06]
+ field_values=[\
+Index: ../trunk-jpl/test/NightlyRun/test455.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test455.py	(revision 17212)
++++ ../trunk-jpl/test/NightlyRun/test455.py	(revision 17213)
+@@ -22,7 +22,7 @@
+ 	md.flowequation.fe_HO=i
+ 	md=solve(md,StressbalanceSolutionEnum())
+ 	field_names     =field_names+['Vx'+i,'Vy'+i,'Vz'+i,'Vel'+i,'Pressure'+i]
+-	field_tolerances=field_tolerances+[1e-08,1e-08,1e-08,1e-08,1e-13]
++	field_tolerances=field_tolerances+[3e-08,1e-08,1e-08,1e-08,1e-13]
+ 	field_values=field_values+[\
+ 			md.results.StressbalanceSolution.Vx,\
+ 			md.results.StressbalanceSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test455.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test455.m	(revision 17212)
++++ ../trunk-jpl/test/NightlyRun/test455.m	(revision 17213)
+@@ -12,7 +12,7 @@
+ 	md.flowequation.fe_HO=i{1};
+ 	md=solve(md,StressbalanceSolutionEnum());
+ 	field_names     ={field_names{:},['Vx' i{1}],['Vy' i{1}],['Vz' i{1}],['Vel' i{1}],['Pressure' i{1}]};
+-	field_tolerances={field_tolerances{:},1e-08,1e-08,1e-08,1e-08,1e-13};
++	field_tolerances={field_tolerances{:},3e-08,1e-08,1e-08,1e-08,1e-13};
+ 	field_values={field_values{:},...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test211.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.m	(revision 17212)
++++ ../trunk-jpl/test/NightlyRun/test211.m	(revision 17213)
+@@ -13,7 +13,7 @@
+ 	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsMeltingRate2', ...
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3'};
+ field_tolerances={...
+-	1e-08,1e-08,1e-06,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,...
++	2e-08,1e-08,1e-06,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,...
+ 	2e-08,1e-08,1e-06,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,2e-06,...
+ 	1e-07,1e-07,1e-06,3e-08,1e-08,1e-08,1e-08,1e-08,1e-08,2e-06};
+ field_values={...
+Index: ../trunk-jpl/test/NightlyRun/test426.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test426.py	(revision 17212)
++++ ../trunk-jpl/test/NightlyRun/test426.py	(revision 17213)
+@@ -34,10 +34,9 @@
+ 	'Bed3','Surface3','Thickness3','Floatingice3','IceVolume3','IceVolumeAboveFloatation3',]
+ 
+ field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
+-	1e-11,1e-10,1e-11,1.25e-11,5e-13,2e-12,\
+-	1e-10,1e-10,1e-10,2e-11,5e-13,2e-12]
++	1e-11,1e-10,1e-11,3e-11,2e-12,5e-12,\
++	1e-10,1e-10,1e-10,5e-11,2e-12,5e-12]
+ 
+-
+ field_values=[\
+ 	md.results.TransientSolution[0].Bed,\
+ 	md.results.TransientSolution[0].Surface,\
Index: issm/oecreview/Archive/16554-17801/ISSM-17213-17214.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17213-17214.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17213-17214.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/src/m/classes/mask.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mask.m	(revision 17213)
++++ ../trunk-jpl/src/m/classes/mask.m	(revision 17214)
+@@ -33,7 +33,7 @@
+ 			disp(sprintf('   masks:'));
+ 
+ 			fielddisplay(obj,'groundedice_levelset','is ice grounded ? grounded ice if > 0, grounding line position if = 0, floating ice if < 0');
+-			fielddisplay(obj,'ice_levelset','presence of ice if > 0, icefront position if = 0, no ice if < 0');
++			fielddisplay(obj,'ice_levelset','presence of ice if < 0, icefront position if = 0, no ice if > 0');
+ 		end % }}}
+ 		function marshall(obj,md,fid) % {{{
+ 			WriteData(fid,'object',obj,'fieldname','groundedice_levelset','format','DoubleMat','mattype',1);
+Index: ../trunk-jpl/src/m/classes/mask.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/mask.py	(revision 17213)
++++ ../trunk-jpl/src/m/classes/mask.py	(revision 17214)
+@@ -23,7 +23,7 @@
+ 		string="   masks:"
+ 
+ 		string="%s\n%s"%(string,fielddisplay(self,"groundedice_levelset","is ice grounded ? grounded ice if > 0, grounding line position if = 0, floating ice if < 0"))
+-		string="%s\n%s"%(string,fielddisplay(self,"ice_levelset","presence of ice if > 0, icefront position if = 0, no ice if < 0"))
++		string="%s\n%s"%(string,fielddisplay(self,"ice_levelset","presence of ice if < 0, icefront position if = 0, no ice if > 0"))
+ 		return string
+ 		#}}}
+ 	def setdefaultparameters(self): # {{{
Index: issm/oecreview/Archive/16554-17801/ISSM-17214-17215.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17214-17215.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17214-17215.diff	(revision 17802)
@@ -0,0 +1,30 @@
+Index: ../trunk-jpl/test/NightlyRun/test211.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.py	(revision 17214)
++++ ../trunk-jpl/test/NightlyRun/test211.py	(revision 17215)
+@@ -25,8 +25,8 @@
+ 	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsMeltingRate2', \
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3']
+ field_tolerances=[\
+-	2e-08,1e-08,1e-06,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,\
+-	1e-08,1e-08,1e-06,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,2e-06,\
++	2e-08,1e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,\
++	1e-08,1e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,2e-06,\
+ 	1e-07,1e-07,1e-06,3e-08,1e-08,1e-08,1e-08,1e-08,1e-08,2e-06]
+ field_values=[\
+ 	md.results.TransientSolution[0].Vx,\
+Index: ../trunk-jpl/test/NightlyRun/test211.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.m	(revision 17214)
++++ ../trunk-jpl/test/NightlyRun/test211.m	(revision 17215)
+@@ -13,8 +13,8 @@
+ 	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsMeltingRate2', ...
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3'};
+ field_tolerances={...
+-	2e-08,1e-08,1e-06,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,...
+-	2e-08,1e-08,1e-06,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,2e-06,...
++	2e-08,1e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,...
++	2e-08,1e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,2e-06,...
+ 	1e-07,1e-07,1e-06,3e-08,1e-08,1e-08,1e-08,1e-08,1e-08,2e-06};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
Index: issm/oecreview/Archive/16554-17801/ISSM-17215-17216.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17215-17216.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17215-17216.diff	(revision 17802)
@@ -0,0 +1,20 @@
+Index: ../trunk-jpl/test/NightlyRun/test333.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test333.m	(revision 17215)
++++ ../trunk-jpl/test/NightlyRun/test333.m	(revision 17216)
+@@ -37,10 +37,11 @@
+ 								 'SedimentWaterHead4','EplWaterHead4','SedimentHeadResidual4',...
+ 								 'SedimentWaterHead5','EplWaterHead5','SedimentHeadResidual5',...
+ 								 'SedimentWaterHead9','EplWaterHead9','SedimentHeadResidual9'};
+-field_tolerances={1e-13, 1e-13, 1e-13,...
+-								 1e-13, 1e-13, 1e-13,...
+-								 1e-13, 6e-13, 8e-12,...
+-								 1e-13, 9e-13, 1e-11};
++field_tolerances={...
++	1e-13, 1e-13, 1e-13,...
++	1e-13, 1e-13, 1e-13,...
++	1e-13, 1e-12, 8e-12,...
++	1e-13, 1e-12, 1e-11};
+ field_values={md.results.HydrologySolution(1).SedimentHead, ...
+ 							md.results.HydrologySolution(1).EplHead,...
+ 							md.results.HydrologySolution(1).SedimentHeadResidual,...
Index: issm/oecreview/Archive/16554-17801/ISSM-17216-17217.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17216-17217.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17216-17217.diff	(revision 17802)
@@ -0,0 +1,24 @@
+Index: ../trunk-jpl/jenkins/imac-012301-gil
+===================================================================
+--- ../trunk-jpl/jenkins/imac-012301-gil	(revision 17216)
++++ ../trunk-jpl/jenkins/imac-012301-gil	(revision 17217)
+@@ -104,5 +104,5 @@
+ #as follows: runme($MATLAB_NROPTIONS). The options must be understandable
+ #by Matlab and runme.m
+ #ex: "'id',[101 102 103]"
+-MATLAB_NROPTIONS="'exclude',[218 234 235 412 413 414 417 418 420 514 701 702]"
++MATLAB_NROPTIONS="'exclude',[218 234 235 412 413 414 417 418 420 514 701 702 703]"
+ PYTHON_NROPTIONS=""
+Index: ../trunk-jpl/jenkins/windows
+===================================================================
+--- ../trunk-jpl/jenkins/windows	(revision 17216)
++++ ../trunk-jpl/jenkins/windows	(revision 17217)
+@@ -98,7 +98,7 @@
+ #ex: "'id',[101 102 103]"
+ 
+ #In Windows, we don't yet have MUMPS, can't do full stokes, so exclude all FS runs. Also exclude all runs with Dakota. And exclude higher order runs that have penalties.
+-MATLAB_NROPTIONS="'exclude',[104, 204, 211, 215, 220, 221, 285, 290, 308, 322, 404, 421, 422, 503, 507, 510, 511, 701, 702, 218, 234, 235, 412, 413, 414, 417, 418, 420, 205, 274, 331, 405, 409, 455, 612, 514 ]"
++MATLAB_NROPTIONS="'exclude',[104, 204, 211, 215, 220, 221, 285, 290, 308, 322, 404, 421, 422, 503, 507, 510, 511, 701, 702, 703, 218, 234, 235, 412, 413, 414, 417, 418, 420, 205, 274, 331, 405, 409, 455, 612, 514 ]"
+ PYTHON_NROPTIONS=""
+ 
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17217-17218.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17217-17218.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17217-17218.diff	(revision 17802)
@@ -0,0 +1,95 @@
+Index: ../trunk-jpl/test/NightlyRun/test211.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.py	(revision 17217)
++++ ../trunk-jpl/test/NightlyRun/test211.py	(revision 17218)
+@@ -25,8 +25,8 @@
+ 	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsMeltingRate2', \
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3']
+ field_tolerances=[\
+-	2e-08,1e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,\
+-	1e-08,1e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,2e-06,\
++	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,\
++	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,2e-06,\
+ 	1e-07,1e-07,1e-06,3e-08,1e-08,1e-08,1e-08,1e-08,1e-08,2e-06]
+ field_values=[\
+ 	md.results.TransientSolution[0].Vx,\
+Index: ../trunk-jpl/test/NightlyRun/test455.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test455.py	(revision 17217)
++++ ../trunk-jpl/test/NightlyRun/test455.py	(revision 17218)
+@@ -22,7 +22,7 @@
+ 	md.flowequation.fe_HO=i
+ 	md=solve(md,StressbalanceSolutionEnum())
+ 	field_names     =field_names+['Vx'+i,'Vy'+i,'Vz'+i,'Vel'+i,'Pressure'+i]
+-	field_tolerances=field_tolerances+[3e-08,1e-08,1e-08,1e-08,1e-13]
++	field_tolerances=field_tolerances+[3e-08,2e-08,1e-08,1e-08,3e-13]
+ 	field_values=field_values+[\
+ 			md.results.StressbalanceSolution.Vx,\
+ 			md.results.StressbalanceSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test455.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test455.m	(revision 17217)
++++ ../trunk-jpl/test/NightlyRun/test455.m	(revision 17218)
+@@ -12,7 +12,7 @@
+ 	md.flowequation.fe_HO=i{1};
+ 	md=solve(md,StressbalanceSolutionEnum());
+ 	field_names     ={field_names{:},['Vx' i{1}],['Vy' i{1}],['Vz' i{1}],['Vel' i{1}],['Pressure' i{1}]};
+-	field_tolerances={field_tolerances{:},3e-08,1e-08,1e-08,1e-08,1e-13};
++	field_tolerances={field_tolerances{:},3e-08,2e-08,1e-08,1e-08,3e-13};
+ 	field_values={field_values{:},...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test285.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test285.m	(revision 17217)
++++ ../trunk-jpl/test/NightlyRun/test285.m	(revision 17218)
+@@ -12,7 +12,7 @@
+ 	md.flowequation.fe_HO=i{1};
+ 	md=solve(md,StressbalanceSolutionEnum());
+ 	field_names     ={field_names{:},['Vx' i{1}],['Vy' i{1}],['Vz' i{1}],['Vel' i{1}],['Pressure' i{1}]};
+-	field_tolerances={field_tolerances{:},5e-08,2e-08,2e-08,2e-08,1e-13};
++	field_tolerances={field_tolerances{:},6e-08,2e-08,2e-08,2e-08,1e-13};
+ 	field_values={field_values{:},...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test333.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test333.m	(revision 17217)
++++ ../trunk-jpl/test/NightlyRun/test333.m	(revision 17218)
+@@ -41,7 +41,7 @@
+ 	1e-13, 1e-13, 1e-13,...
+ 	1e-13, 1e-13, 1e-13,...
+ 	1e-13, 1e-12, 8e-12,...
+-	1e-13, 1e-12, 1e-11};
++	1e-13, 2e-12, 1e-11};
+ field_values={md.results.HydrologySolution(1).SedimentHead, ...
+ 							md.results.HydrologySolution(1).EplHead,...
+ 							md.results.HydrologySolution(1).SedimentHeadResidual,...
+Index: ../trunk-jpl/test/NightlyRun/test285.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test285.py	(revision 17217)
++++ ../trunk-jpl/test/NightlyRun/test285.py	(revision 17218)
+@@ -22,7 +22,7 @@
+ 	md.flowequation.fe_HO=i
+ 	md=solve(md,StressbalanceSolutionEnum())
+ 	field_names     =field_names+['Vx'+i,'Vy'+i,'Vz'+i,'Vel'+i,'Pressure'+i]
+-	field_tolerances=field_tolerances+[5e-08,2e-08,2e-08,2e-08,1e-13]
++	field_tolerances=field_tolerances+[6e-08,2e-08,2e-08,2e-08,1e-13]
+ 	field_values=field_values+[\
+ 		md.results.StressbalanceSolution.Vx,\
+ 		md.results.StressbalanceSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test211.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.m	(revision 17217)
++++ ../trunk-jpl/test/NightlyRun/test211.m	(revision 17218)
+@@ -13,8 +13,8 @@
+ 	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsMeltingRate2', ...
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3'};
+ field_tolerances={...
+-	2e-08,1e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,...
+-	2e-08,1e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,2e-06,...
++	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,...
++	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,2e-06,...
+ 	1e-07,1e-07,1e-06,3e-08,1e-08,1e-08,1e-08,1e-08,1e-08,2e-06};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
Index: issm/oecreview/Archive/16554-17801/ISSM-17218-17219.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17218-17219.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17218-17219.diff	(revision 17802)
@@ -0,0 +1,56 @@
+Index: ../trunk-jpl/test/NightlyRun/test211.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.py	(revision 17218)
++++ ../trunk-jpl/test/NightlyRun/test211.py	(revision 17219)
+@@ -26,8 +26,8 @@
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3']
+ field_tolerances=[\
+ 	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,\
+-	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,2e-06,\
+-	1e-07,1e-07,1e-06,3e-08,1e-08,1e-08,1e-08,1e-08,1e-08,2e-06]
++	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06,\
++	1e-07,1e-07,1e-06,3e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06]
+ field_values=[\
+ 	md.results.TransientSolution[0].Vx,\
+ 	md.results.TransientSolution[0].Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test455.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test455.py	(revision 17218)
++++ ../trunk-jpl/test/NightlyRun/test455.py	(revision 17219)
+@@ -22,7 +22,7 @@
+ 	md.flowequation.fe_HO=i
+ 	md=solve(md,StressbalanceSolutionEnum())
+ 	field_names     =field_names+['Vx'+i,'Vy'+i,'Vz'+i,'Vel'+i,'Pressure'+i]
+-	field_tolerances=field_tolerances+[3e-08,2e-08,1e-08,1e-08,3e-13]
++	field_tolerances=field_tolerances+[3e-08,2e-08,1e-08,3e-08,3e-13]
+ 	field_values=field_values+[\
+ 			md.results.StressbalanceSolution.Vx,\
+ 			md.results.StressbalanceSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test455.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test455.m	(revision 17218)
++++ ../trunk-jpl/test/NightlyRun/test455.m	(revision 17219)
+@@ -12,7 +12,7 @@
+ 	md.flowequation.fe_HO=i{1};
+ 	md=solve(md,StressbalanceSolutionEnum());
+ 	field_names     ={field_names{:},['Vx' i{1}],['Vy' i{1}],['Vz' i{1}],['Vel' i{1}],['Pressure' i{1}]};
+-	field_tolerances={field_tolerances{:},3e-08,2e-08,1e-08,1e-08,3e-13};
++	field_tolerances={field_tolerances{:},3e-08,2e-08,1e-08,3e-08,3e-13};
+ 	field_values={field_values{:},...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test211.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.m	(revision 17218)
++++ ../trunk-jpl/test/NightlyRun/test211.m	(revision 17219)
+@@ -14,8 +14,8 @@
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3'};
+ field_tolerances={...
+ 	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,...
+-	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,2e-06,...
+-	1e-07,1e-07,1e-06,3e-08,1e-08,1e-08,1e-08,1e-08,1e-08,2e-06};
++	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06,...
++	1e-07,1e-07,1e-06,3e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
+ 	(md.results.TransientSolution(1).Vy),...
Index: issm/oecreview/Archive/16554-17801/ISSM-17219-17220.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17219-17220.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17219-17220.diff	(revision 17802)
@@ -0,0 +1,52 @@
+Index: ../trunk-jpl/test/NightlyRun/test404.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test404.py	(revision 17219)
++++ ../trunk-jpl/test/NightlyRun/test404.py	(revision 17220)
+@@ -18,7 +18,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Vx','Vy','Vz','Vel','Pressure']
+-field_tolerances=[1.5e-07,1e-07,1.4e-06,1e-06,1e-07]
++field_tolerances=[2e-07,2e-07,2e-06,1e-06,1e-07]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Vx,\
+ 	md.results.StressbalanceSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test513.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test513.py	(revision 17219)
++++ ../trunk-jpl/test/NightlyRun/test513.py	(revision 17220)
+@@ -35,7 +35,7 @@
+ 
+ # Fields and tolerances to track changes
+ field_names     =['Gradient','Misfits','FrictionCoefficient','Pressure','Vel','Vx','Vy','Vz','Temperature','BasalforcingsMeltingRate']
+-field_tolerances=[2e-10,2e-10,1e-10,1e-10,1e-6,1e-6,1e-6,1.5e-6,1e-6,2e-06]
++field_tolerances=[2e-10,2e-10,1e-10,1e-10,1e-6,1e-6,1e-6,2e-6,1e-6,2e-06]
+ field_values=[\
+ 	md.results.SteadystateSolution.Gradient1,\
+ 	md.results.SteadystateSolution.J,\
+Index: ../trunk-jpl/test/NightlyRun/test404.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test404.m	(revision 17219)
++++ ../trunk-jpl/test/NightlyRun/test404.m	(revision 17220)
+@@ -8,7 +8,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure'};
+-field_tolerances={1.5e-07,1e-07,1.4e-06,1e-06,1e-07};
++field_tolerances={2e-07,2e-07,2e-06,1e-06,1e-07};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test513.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test513.m	(revision 17219)
++++ ../trunk-jpl/test/NightlyRun/test513.m	(revision 17220)
+@@ -24,7 +24,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Gradient','Misfits','FrictionCoefficient','Pressure','Vel','Vx','Vy','Vz','Temperature','BasalforcingsMeltingRate'};
+-field_tolerances={2e-10,2e-10,1e-10,1e-10,1e-6,1e-6,1e-6,1e-6,1e-6,2e-06};
++field_tolerances={2e-10,2e-10,1e-10,1e-10,1e-6,1e-6,1e-6,2e-6,1e-6,2e-06};
+ field_values={...
+ 	(md.results.SteadystateSolution.Gradient1),...
+ 	md.results.SteadystateSolution.J,...
Index: issm/oecreview/Archive/16554-17801/ISSM-17220-17221.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17220-17221.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17220-17221.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/test/NightlyRun/test422.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test422.py	(revision 17220)
++++ ../trunk-jpl/test/NightlyRun/test422.py	(revision 17221)
+@@ -19,7 +19,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Vx','Vy','Vz','Vel','Pressure']
+-field_tolerances=[2e-07,2e-07,2e-06,2e-07,5e-07]
++field_tolerances=[3e-07,2e-07,2e-06,2e-07,5e-07]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Vx,\
+ 	md.results.StressbalanceSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test422.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test422.m	(revision 17220)
++++ ../trunk-jpl/test/NightlyRun/test422.m	(revision 17221)
+@@ -9,7 +9,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure'};
+-field_tolerances={2e-07,2e-07,2e-06,2e-07,5e-07};
++field_tolerances={3e-07,2e-07,2e-06,2e-07,5e-07};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
Index: issm/oecreview/Archive/16554-17801/ISSM-17221-17222.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17221-17222.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17221-17222.diff	(revision 17802)
@@ -0,0 +1,86 @@
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17221)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17222)
+@@ -678,6 +678,7 @@
+ 	/*Levelset related enums (will be moved to appropriate place when finished){{{*/
+ 	TransientIslevelsetEnum,
+ 	ExtrapolationVariableEnum,
++	IceMaskNodeActivationEnum,
+ 	/*}}}*/
+ 	MaximumNumberOfDefinitionsEnum
+ };
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17221)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17222)
+@@ -637,6 +637,7 @@
+ 		case LliboutryDuvalEnum : return "LliboutryDuval";
+ 		case TransientIslevelsetEnum : return "TransientIslevelset";
+ 		case ExtrapolationVariableEnum : return "ExtrapolationVariable";
++		case IceMaskNodeActivationEnum : return "IceMaskNodeActivation";
+ 		case MaximumNumberOfDefinitionsEnum : return "MaximumNumberOfDefinitions";
+ 		default : return "unknown";
+ 
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17221)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17222)
+@@ -652,6 +652,7 @@
+ 	      else if (strcmp(name,"LliboutryDuval")==0) return LliboutryDuvalEnum;
+ 	      else if (strcmp(name,"TransientIslevelset")==0) return TransientIslevelsetEnum;
+ 	      else if (strcmp(name,"ExtrapolationVariable")==0) return ExtrapolationVariableEnum;
++	      else if (strcmp(name,"IceMaskNodeActivation")==0) return IceMaskNodeActivationEnum;
+ 	      else if (strcmp(name,"MaximumNumberOfDefinitions")==0) return MaximumNumberOfDefinitionsEnum;
+          else stage=7;
+    }
+Index: ../trunk-jpl/src/m/classes/mask.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mask.m	(revision 17221)
++++ ../trunk-jpl/src/m/classes/mask.m	(revision 17222)
+@@ -38,6 +38,14 @@
+ 		function marshall(obj,md,fid) % {{{
+ 			WriteData(fid,'object',obj,'fieldname','groundedice_levelset','format','DoubleMat','mattype',1);
+ 			WriteData(fid,'object',obj,'fieldname','ice_levelset','format','DoubleMat','mattype',1);
++
++			% get mask of vertices of elements with ice
++			isice=md.mask.ice_levelset<=0.;
++			vlist = zeros(md.mesh.numberofvertices,1);
++			pos=find(sum(isice(md.mesh.elements),2)>0);
++			vlist(md.mesh.elements(pos,:))=1;
++			WriteData(fid,'data',vlist,'enum',IceMaskNodeActivationEnum(),'format','DoubleMat','mattype',1);
++
+ 		end % }}}
+ 	end
+ end
+Index: ../trunk-jpl/src/m/classes/mask.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/mask.py	(revision 17221)
++++ ../trunk-jpl/src/m/classes/mask.py	(revision 17222)
+@@ -1,3 +1,4 @@
++import numpy
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+ from checkfield import *
+@@ -42,4 +43,11 @@
+ 	def marshall(self,md,fid):    # {{{
+ 		WriteData(fid,'object',self,'fieldname','groundedice_levelset','format','DoubleMat','mattype',1)
+ 		WriteData(fid,'object',self,'fieldname','ice_levelset','format','DoubleMat','mattype',1)
++
++		# get mask of vertices of elements with ice
++		isice=numpy.array(md.mask.ice_levelset<=0.,int)
++		vlist = numpy.zeros((md.mesh.numberofvertices,1), dtype=int)
++		pos=numpy.nonzero(numpy.sum(isice[md.mesh.elements-1],axis=1))[0]
++		vlist[md.mesh.elements[pos,:]-1]=1
++		WriteData(fid,'data',vlist,'enum',IceMaskNodeActivationEnum(),'format','DoubleMat','mattype',1);
+ 	# }}}
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17221)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17222)
+@@ -629,4 +629,5 @@
+ def LliboutryDuvalEnum(): return StringToEnum("LliboutryDuval")[0]
+ def TransientIslevelsetEnum(): return StringToEnum("TransientIslevelset")[0]
+ def ExtrapolationVariableEnum(): return StringToEnum("ExtrapolationVariable")[0]
++def IceMaskNodeActivationEnum(): return StringToEnum("IceMaskNodeActivation")[0]
+ def MaximumNumberOfDefinitionsEnum(): return StringToEnum("MaximumNumberOfDefinitions")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17222-17223.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17222-17223.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17222-17223.diff	(revision 17802)
@@ -0,0 +1,16 @@
+Index: ../trunk-jpl/src/m/enum/IceMaskNodeActivationEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/IceMaskNodeActivationEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/IceMaskNodeActivationEnum.m	(revision 17223)
+@@ -0,0 +1,11 @@
++function macro=IceMaskNodeActivationEnum()
++%ICEMASKNODEACTIVATIONENUM - Enum of IceMaskNodeActivation
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=IceMaskNodeActivationEnum()
++
++macro=StringToEnum('IceMaskNodeActivation');
Index: issm/oecreview/Archive/16554-17801/ISSM-17223-17224.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17223-17224.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17223-17224.diff	(revision 17802)
@@ -0,0 +1,47 @@
+Index: ../trunk-jpl/src/m/plot/radarpower.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/radarpower.m	(revision 17223)
++++ ../trunk-jpl/src/m/plot/radarpower.m	(revision 17224)
+@@ -89,9 +89,16 @@
+ 		%Read in temp.tif:
+ 		im=imread('temp.tif','TIFF');
+ 		%adjust contrast and brightness
+-		im=imadjust(im,[a b],[c d]);
++		%im=imadjust(im,[a b],[c d]);
+ 		pixelskip=max(1,ceil(posting/((x1-x0)/(size(im,2)))));
+-		md.radaroverlay.pwr=double(flipud(im(1:pixelskip:end,1:pixelskip:end)));
++		if size(im,3)==1,
++			md.radaroverlay.pwr=double(flipud(im(1:pixelskip:end,1:pixelskip:end)));
++		else
++			md.radaroverlay.pwr=double(im(1:pixelskip:end,1:pixelskip:end,1:pixelskip:end));
++			md.radaroverlay.pwr(:,:,1)=flipud(md.radaroverlay.pwr(:,:,1));
++			md.radaroverlay.pwr(:,:,2)=flipud(md.radaroverlay.pwr(:,:,2));
++			md.radaroverlay.pwr(:,:,3)=flipud(md.radaroverlay.pwr(:,:,3));
++		end
+ 		md.radaroverlay.x=(x0:(x1-x0)/(size(md.radaroverlay.pwr,2)-1):x1);
+ 		md.radaroverlay.y=(y0:(y1-y0)/(size(md.radaroverlay.pwr,1)-1):y1);
+ 
+@@ -152,7 +159,7 @@
+ 	disp('Warning: expecting coordinates in polar stereographic (Std Latitude: 70ºN Meridian: 45º)');
+ 	im=imread(overlay_image);
+ 	%adjust contrast and brightness
+-	im=imadjust(im,[a b],[c d]);
++	%im=imadjust(im,[a b],[c d]);
+ 	im=im(toplefty:toplefty+sizey,topleftx:topleftx+sizex);
+ 	md.radaroverlay.pwr=double(flipud(im));
+ 	md.radaroverlay.x=(x0:(x1-x0)/(size(md.radaroverlay.pwr,2)-1):x1);
+Index: ../trunk-jpl/src/m/plot/plot_overlay.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_overlay.m	(revision 17223)
++++ ../trunk-jpl/src/m/plot/plot_overlay.m	(revision 17224)
+@@ -42,6 +42,10 @@
+ contrast = getfieldvalue(options,'contrast',1);  
+ radar = (md.radaroverlay.pwr).^(contrast);
+ radar = radar./max(radar(:));
++if size(radar,3)>1,
++	disp('WARNING: color image converted to greyscale intensity image');
++	radar=sum(radar,3)/3;
++end
+ %radar(find(radar==0))=1; %Change background from black to white
+ 
+ %InterpFromMeshToGrid
Index: issm/oecreview/Archive/16554-17801/ISSM-17224-17225.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17224-17225.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17224-17225.diff	(revision 17802)
@@ -0,0 +1,186 @@
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17224)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17225)
+@@ -177,12 +177,21 @@
+ 	Matrix3x3Invert(Jinv,&J[0][0]);
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::GetNodalFunctions{{{*/
+-void PentaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss_in){
++/*FUNCTION PentaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss){{{*/
++void PentaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss){
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+ 
+ 	_assert_(basis);
++	GetNodalFunctions(basis,gauss,this->element_type);
+ 
++}
++/*}}}*/
++/*FUNCTION PentaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss_in,int finiteelement){{{*/
++void PentaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss_in,int finiteelement){
++	/*This routine returns the values of the nodal functions  at the gaussian point.*/
++
++	_assert_(basis);
++
+ 	/*Cast gauss to GaussPenta*/
+ 	_assert_(gauss_in->Enum()==GaussPentaEnum);
+ 	GaussPenta* gauss = dynamic_cast<GaussPenta*>(gauss_in);
+@@ -190,7 +199,10 @@
+ 	/*Get current coordinates in reference element*/
+ 	IssmDouble zeta=gauss->coord4;
+ 
+-	switch(this->element_type){
++	switch(finiteelement){
++		case P0Enum: 
++			basis[0]=1.;
++			return;
+ 		case P1Enum: case P1DGEnum:
+ 			basis[0]=gauss->coord1*(1.-zeta)/2.;
+ 			basis[1]=gauss->coord2*(1.-zeta)/2.;
+@@ -407,6 +419,12 @@
+ 	IssmDouble zeta=gauss->coord4;
+ 
+ 	switch(this->element_type){
++		case P0Enum: 
++			/*Zero derivative*/
++			dbasis[NUMNODESP0*0+0]   = 0.;
++			dbasis[NUMNODESP0*1+0]   = 0.;
++			dbasis[NUMNODESP0*2+0]   = 0.;
++			return;
+ 		case P1Enum: case P1DGEnum:
+ 			/*Nodal function 1*/
+ 			dbasis[NUMNODESP1*0+0]   = (zeta-1.)/4.;
+@@ -995,19 +1013,33 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::GetInputValue{{{*/
++/*FUNCTION PentaRef::GetInputValue(IssmDouble* pvalue,IssmDouble* plist,Gauss* gauss){{{*/
+ void PentaRef::GetInputValue(IssmDouble* pvalue,IssmDouble* plist,Gauss* gauss){
+-	/*P1 interpolation on Gauss point*/
+ 
+-	/*intermediary*/
+-	IssmDouble basis[6];
++	GetInputValue(pvalue,plist,gauss,this->element_type);
+ 
+-	/*nodal functions: */
+-	GetNodalFunctionsP1(&basis[0],gauss);
++}
++/*}}}*/
++/*FUNCTION PentaRef::GetInputValue(IssmDouble* pvalue,IssmDouble* plist,Gauss* gauss,int finiteelement){{{*/
++void PentaRef::GetInputValue(IssmDouble* pvalue,IssmDouble* plist,Gauss* gauss,int finiteelement){
+ 
+-	/*Assign output pointers:*/
+-	*pvalue=basis[0]*plist[0]+basis[1]*plist[1]+basis[2]*plist[2]+basis[3]*plist[3]+basis[4]*plist[4]+basis[5]*plist[5];
++	/*Output*/
++	IssmDouble value =0.;
+ 
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = this->NumberofNodes(finiteelement);
++
++	/*Get nodal functions*/
++	IssmDouble* basis=xNew<IssmDouble>(numnodes);
++	GetNodalFunctions(basis, gauss,finiteelement);
++
++	/*Calculate parameter for this Gauss point*/
++	for(int i=0;i<numnodes;i++) value += basis[i]*plist[i];
++
++	/*Assign output pointer*/
++	xDelete<IssmDouble>(basis);
++	*pvalue = value;
++
+ }
+ /*}}}*/
+ /*FUNCTION PentaRef::GetInputDerivativeValue{{{*/
+@@ -1021,22 +1053,42 @@
+ 	 *
+ 	 *   p is a vector of size 3x1 already allocated.
+ 	 */
+-	IssmDouble dbasis[3][NUMNODESP1];
+ 
+-	/*Get nodal funnctions derivatives in actual coordinate system: */
+-	GetNodalFunctionsP1Derivatives(&dbasis[0][0],xyz_list, gauss);
++	/*Output*/
++	IssmDouble dpx=0.;
++	IssmDouble dpy=0.;
++	IssmDouble dpz=0.;
+ 
+-	/*Assign output*/
+-	p[0]=plist[0]*dbasis[0][0]+plist[1]*dbasis[0][1]+plist[2]*dbasis[0][2]+plist[3]*dbasis[0][3]+plist[4]*dbasis[0][4]+plist[5]*dbasis[0][5];
+-	p[1]=plist[0]*dbasis[1][0]+plist[1]*dbasis[1][1]+plist[2]*dbasis[1][2]+plist[3]*dbasis[1][3]+plist[4]*dbasis[1][4]+plist[5]*dbasis[1][5];
+-	p[2]=plist[0]*dbasis[2][0]+plist[1]*dbasis[2][1]+plist[2]*dbasis[2][2]+plist[3]*dbasis[2][3]+plist[4]*dbasis[2][4]+plist[5]*dbasis[2][5];
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = this->NumberofNodes();
+ 
++	/*Get nodal functions derivatives*/
++	IssmDouble* dbasis=xNew<IssmDouble>(3*numnodes);
++	GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Calculate parameter for this Gauss point*/
++	for(int i=0;i<numnodes;i++) dpx += dbasis[0*numnodes+i]*plist[i];
++	for(int i=0;i<numnodes;i++) dpy += dbasis[1*numnodes+i]*plist[i];
++	for(int i=0;i<numnodes;i++) dpz += dbasis[2*numnodes+i]*plist[i];
++
++	/*Assign values*/
++	xDelete<IssmDouble>(dbasis);
++	p[0]=dpx;
++	p[1]=dpy;
++	p[2]=dpz;
++
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::NumberofNodes{{{*/
++/*FUNCTION PentaRef::NumberofNodes(){{{*/
+ int PentaRef::NumberofNodes(void){
+ 
+-	switch(this->element_type){
++	return this->NumberofNodes(this->element_type);
++}
++/*}}}*/
++/*FUNCTION PentaRef::NumberofNodes(int finiteelement){{{*/
++int PentaRef::NumberofNodes(int finiteelement){
++
++	switch(finiteelement){
+ 		case P0Enum:                return NUMNODESP0;
+ 		case P1Enum:                return NUMNODESP1;
+ 		case P1bubbleEnum:          return NUMNODESP1b;
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.h	(revision 17224)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.h	(revision 17225)
+@@ -22,6 +22,7 @@
+ 
+ 		/*Numerics*/
+ 		void GetNodalFunctions(IssmDouble* basis, Gauss* gauss);
++		void GetNodalFunctions(IssmDouble* basis, Gauss* gauss,int finiteelement);
+ 		void GetNodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss);
+ 		void GetNodalFunctionsPressure(IssmDouble* basis, Gauss* gauss);
+ 		void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+@@ -42,11 +43,13 @@
+ 		void GetJacobianInvert(IssmDouble*  Jinv, IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetLprimeFSSSA(IssmDouble* LprimeFSSSA, IssmDouble* xyz_list, Gauss* gauss);
+ 		void GetInputValue(IssmDouble* pvalue,IssmDouble* plist, Gauss* gauss);
++		void GetInputValue(IssmDouble* pvalue,IssmDouble* plist, Gauss* gauss,int finiteelement);
+ 		void GetInputDerivativeValue(IssmDouble* pvalues, IssmDouble* plist,IssmDouble* xyz_list, Gauss* gauss);
+ 
+ 		void BasalNodeIndices(int* pnumindices,int** pindices,int finiteelement);
+ 		void SurfaceNodeIndices(int* pnumindices,int** pindices,int finiteelement);
+ 		int  NumberofNodes(void);
++		int  NumberofNodes(int finiteelement);
+ 		int  NumberofNodesVelocity(void);
+ 		int  NumberofNodesPressure(void);
+ 		int  VelocityInterpolation(void);
+Index: ../trunk-jpl/src/c/classes/IoModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 17224)
++++ ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 17225)
+@@ -1481,7 +1481,7 @@
+ 
+ 	for(int i=0;i<elements->Size();i++){
+ 		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+-		if(!doublearray) element->InputUpdateFromConstant(default_value,vector_enum); 
++		if(!doublearray) element->AddInput(vector_enum,&default_value,P0Enum); 
+ 		else             element->InputCreate(doublearray,this,M,N,vector_layout,vector_enum,code);//we need i to index into elements.
+ 	}
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17225-17226.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17225-17226.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17225-17226.diff	(revision 17802)
@@ -0,0 +1,14 @@
+Index: ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp	(revision 17225)
++++ ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp	(revision 17226)
+@@ -184,6 +184,9 @@
+ 	GaussTria* gauss = dynamic_cast<GaussTria*>(gauss_in);
+ 
+ 	switch(finiteelement){
++		case P0Enum:
++			basis[0]=1.;
++			return;
+ 		case P1Enum: case P1DGEnum:
+ 			basis[0]=gauss->coord1;
+ 			basis[1]=gauss->coord2;
Index: issm/oecreview/Archive/16554-17801/ISSM-17226-17227.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17226-17227.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17226-17227.diff	(revision 17802)
@@ -0,0 +1,637 @@
+Index: ../trunk-jpl/test/NightlyRun/test336.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test336.py	(revision 17226)
++++ ../trunk-jpl/test/NightlyRun/test336.py	(revision 17227)
+@@ -7,7 +7,7 @@
+ from solve import *
+ from MatlabFuncs import *
+ 
+-md=triangle(model(),'../Exp/Square.exp',150000.)
++md=triangle(model(),'../Exp/Square.exp',10000.)
+ md=setmask(md,'','')
+ md=parameterize(md,'../Par/SquareSheetConstrained.py') 
+ md=setflowequation(md,'SSA','all')
+@@ -19,33 +19,52 @@
+ md.transient.isthermal=False
+ md.transient.isgroundingline=False
+ md.transient.isgia=False
+-md.transient.islevelset=True
++md.transient.islevelset=False
+ 
+ # init levelset function
+ ymin=numpy.min(md.mesh.y)
+ ymax=numpy.max(md.mesh.y)
+ xmin=min(md.mesh.x)
+ xmax=max(md.mesh.x)
+-xmed=(xmax+xmin)/2
+-ymed=(ymax+ymin)/2
+-distx=numpy.absolute(md.mesh.x.reshape(-1,1)-xmed)
+-disty=numpy.absolute(md.mesh.y.reshape(-1,1)-ymed)
+-md.mask.ice_levelset=numpy.maximum(distx,disty)-1.e5
++xmed=(xmax+xmin)/2.
++ymed=(ymax+ymin)/2.
++md.mask.ice_levelset=numpy.sqrt(numpy.power(md.mesh.x-xmed,2.)+numpy.power(md.mesh.y-ymed,2.)) - (xmax-xmin)/3.
+ 
++# set spcs
++mask=1.*numpy.ones((md.mesh.numberofvertices,1))
++nrverts=md.mesh.elements.shape[1]
++for i in range(0,md.mesh.numberofelements):
++	elt=numpy.copy(md.mesh.elements[i])
++	elt-=1
++	isiceinelement=False
++	for iv in range(0,nrverts):
++		if(md.mask.ice_levelset[elt[iv]]<=0.):
++			isiceinelement=True
++	if(isiceinelement):
++		for iv in range(0,nrverts):
++			mask[elt[iv]]=2.
++
++v=0.
++for i in range(0,md.mesh.numberofvertices):
++	if(mask[i]==1.):
++		md.stressbalance.spcvx[i]=v
++		md.stressbalance.spcvy[i]=v
++		md.stressbalance.spcvz[i]=v
++
+ md=solve(md,TransientSolutionEnum())
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Vx','Vy','Vel','Pressure','MaskIceLevelset']
+-field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
++field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]#,1e-13,1e-13]
+ field_values=[\
+ 	md.results.TransientSolution[0].Vx,\
+ 	md.results.TransientSolution[0].Vy,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].MaskIceLevelset,\
++# 	md.results.TransientSolution[0].MaskIceLevelset,\
+ 	md.results.TransientSolution[1].Vx,\
+ 	md.results.TransientSolution[1].Vy,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].MaskIceLevelset,\
++# 	md.results.TransientSolution[1].MaskIceLevelset,\
+ 	]
+Index: ../trunk-jpl/test/Archives/Archive336.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/externalpackages/vim/addons/vimrc
+===================================================================
+--- ../trunk-jpl/externalpackages/vim/addons/vimrc	(revision 17226)
++++ ../trunk-jpl/externalpackages/vim/addons/vimrc	(revision 17227)
+@@ -99,13 +99,17 @@
+ map num :set number!<CR>
+ 
+ " save & "make" the current file in all modes
+-map <F8> :w <Enter> :make <Enter><Enter>
+-map! <F8>  <ESC> :w <Enter> :make <Enter><Enter>
++map <F6> :w <Enter> :make <Enter><Enter>
++map! <F6>  <ESC> :w <Enter> :make <Enter><Enter>
+ " make update: nice for longer documents
+-map <F7> :w <Enter> :make update <Enter><Enter>
+-map! <F7> <ESC> :w <Enter> :make update <Enter><Enter>
++map <F5> :w <Enter> :make update <Enter><Enter>
++map! <F5> <ESC> :w <Enter> :make update <Enter><Enter>
+ 
++" switch between tabs
++nmap <F7> :tabp <CR>
++nmap <F8> :tabn <CR>
+ 
++
+ "use paste P: re-indent and re-format at the same time
+ :nnoremap <Esc>P P'[v']=
+ :nnoremap <Esc>p p'[v']=
+@@ -140,6 +144,15 @@
+   "scripts must be executable
+   autocmd BufWritePost   *.sh         !chmod +x %
+ 
++	" Commenting blocks of code.
++	autocmd FileType c,cpp,java,scala let b:comment_leader = '// '
++	autocmd FileType sh,ruby,python   let b:comment_leader = '# '
++	autocmd FileType conf,fstab       let b:comment_leader = '# '
++	autocmd FileType tex              let b:comment_leader = '% '
++	autocmd FileType mail             let b:comment_leader = '> '
++	autocmd FileType vim              let b:comment_leader = '" '
++	noremap <silent> ,cc :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR>
++	noremap <silent> ,cu :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR>
+ endif " has("autocmd")
+ " ----------------------------------------------------------------------}}}
+ " Matlab special {{{
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17226)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17227)
+@@ -32,7 +32,7 @@
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,VxEnum);
+ 	iomodel->FetchDataToInput(elements,VyEnum);
+-	
++	iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
+ }
+ /*}}}*/
+ void LevelsetAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+@@ -66,21 +66,14 @@
+ 	/*parameters: */
+ 	bool save_results;
+ 
+-	/* extrapolate */
+-	Analysis* analysis = new ExtrapolationAnalysis();
+-	femmodel->parameters->SetParam(VxEnum,ExtrapolationVariableEnum);
+-	analysis->Core(femmodel);
+-	delete analysis;
+-
+ 	/*activate formulation: */
+ 	femmodel->SetCurrentConfiguration(LevelsetAnalysisEnum);
+ 
+-	/*recover parameters: */
+-	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
+-
+ 	if(VerboseSolution()) _printf0_("call computational core:\n");
+ 	solutionsequence_linear(femmodel);
+ 
++	/*recover parameters: */
++	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
+ 	if(save_results){
+ 		if(VerboseSolution()) _printf0_("   saving results\n");
+ 		int outputs = MaskIceLevelsetEnum;
+@@ -327,3 +320,57 @@
+ 
+ }/*}}}*/
+ 
++/* Update of constraints */
++// void LevelsetAnalysis::UpdateNoIceConstraints(FemModel* femmodel){/*{{{*/
++// 
++// 	IssmDouble* mask_ice = GetMaskOfIce(femmodel->elements, femmodel->nodes); 
++// 
++// 	for (int i=0;i<femmodel->nodes->Size();i++){
++// 		Node* node=dynamic_cast<Node*>(femmodel->nodes->GetObjectByOffset(i));
++// 		if(node->InAnalysis(LevelsetAnalysisEnum)){
++// 			if(mask_ice[node->Sid()]==1.){//FIXME: what should be done with actual spcs to ice model?
++// // 				node->DofInFSet(0); /*remove spc*/ 
++// 			}
++// 			else{
++// 				IssmDouble defval=0.;
++// 				node->ApplyConstraint(1,defval); /*apply spc*/ 
++// 			}
++// 		}
++// 	}
++// }/*}}}*/
++// IssmDouble* LevelsetAnalysis::GetMaskOfIce(Elements* elements, Nodes* nodes){/*{{{*/
++// 
++// 	int                 i;
++// 	IssmDouble*         mask_ice      = NULL;
++// 	Vector<IssmDouble>* vec_mask_ice  = NULL;
++// 	Element*            element       = NULL;
++// 
++// 	/*Initialize vector with number of vertices*/
++// 	IssmDouble numnodes=nodes->NumberOfNodes(LevelsetAnalysisEnum);
++// 	vec_mask_ice=new Vector<IssmDouble>(numnodes); //nodes at ice front that have ice at next time step
++// 	for(i=0;i<numnodes;i++)
++// 		vec_mask_ice[i]=0.;
++// 	/*Fill vector vertices that have no contact to ice: */
++// 	for(i=0;i<elements->Size();i++){
++// 		element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
++// 		SetMaskOfIceElement(vec_mask_ice, element);
++// 	}
++// 
++// 	/*Assemble vector and serialize */
++// 	vec_mask_ice->Assemble();
++// 	mask_ice=vec_mask_ice->ToMPISerial();
++// 	delete vec_mask_ice;
++// 	return mask_ice;
++// 
++// }/*}}}*/
++// void LevelsetAnalysis::SetMaskOfIceElement(Vector<IssmDouble>* vec_mask_ice, Element* element){/*{{{*/
++// 
++// 	/* Intermediaries */
++// 	int numnodes = element->GetNumberOfNodes();
++// 	
++// 	if(element->IsIceInElement()){
++// 		for(int i = 0;i<numnodes;i++){
++// 			vec_mask_ice->SetValue(element->nodes[i]->Sid(),1.,INS_VAL);
++// 		}
++// 	}
++// }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17226)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17227)
+@@ -188,7 +188,9 @@
+ 	iomodel->FetchDataToInput(elements,LoadingforceXEnum);
+ 	iomodel->FetchDataToInput(elements,LoadingforceYEnum);
+ 	iomodel->FetchDataToInput(elements,DamageDEnum);
++	iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
+ 
++
+ 	if(iomodel->meshtype==Mesh3DEnum){
+ 		iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+@@ -1023,7 +1025,7 @@
+ 	}
+ }/*}}}*/
+ void StressbalanceAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+-	/*Default, do nothing*/
++	SetActiveNodesLSMx(femmodel->elements);
+ 	return;
+ }/*}}}*/
+ 
+@@ -1142,6 +1144,10 @@
+ 	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	delete Ke1;
+ 	delete Ke2;
++	
++	// FIXME: TESTING
++// 	_printf0_("\n element ID: " << element->Id() << ";\n");
++// 	Ke->Echo();
+ 	return Ke;
+ }/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSAFriction(Element* element){/*{{{*/
+@@ -1264,6 +1270,9 @@
+ 
+ 		newviscosity=viscosity+viscosity_overshoot*(viscosity-oldviscosity);
+ 		D_scalar=2.*newviscosity*thickness*gauss->weight*Jdet;
++		
++// 		_printf0_("element, node, weight, Jdet: " << element->Id() << "; " << ig << "; " << gauss->weight << "; " << Jdet << "\n");
++
+ 		for(int i=0;i<3;i++) D[i*3+i]=D_scalar;
+ 
+ 		TripleMultiply(B,3,numdof,1,
+@@ -1314,6 +1323,10 @@
+ 	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	delete pe1;
+ 	delete pe2;
++
++// 	_printf0_("\n element ID: " << element->Id() << ";\n");
++// 	pe->Echo();
++
+ 	return pe;
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorSSADrivingStress(Element* element){/*{{{*/
+@@ -1371,7 +1384,7 @@
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+ 	/*If no front, return NULL*/
+-	if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
++	if(!element->IsIcefront()) return NULL;
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble  Jdet,thickness,bed,water_pressure,ice_pressure;
+@@ -1394,8 +1407,12 @@
+ 	IssmDouble rho_ice     = element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 	IssmDouble gravity     = element->GetMaterialParameter(ConstantsGEnum);
+ 	element->GetVerticesCoordinates(&xyz_list);
+-	element->ZeroLevelsetCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
++
++// 	element->ZeroLevelsetCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
++ 	element->GetIcefrontCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
++
+ 	element->NormalSection(&normal[0],xyz_list_front);
++// 	element->GetNormalFromLSF(&normal[0]);
+ 
+ 	/*Start looping on Gaussian points*/
+ 	Gauss* gauss=element->NewGauss(xyz_list,xyz_list_front,3);
+@@ -1784,7 +1801,7 @@
+ ElementVector* StressbalanceAnalysis::CreatePVectorL1L2Front(Element* element){/*{{{*/
+ 
+ 	/*If no front, return NULL*/
+-	if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
++	if(!element->IsIcefront()) return NULL;
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble  Jdet,thickness,bed,water_pressure,ice_pressure;
+@@ -2207,7 +2224,7 @@
+ ElementVector* StressbalanceAnalysis::CreatePVectorHOFront(Element* element){/*{{{*/
+ 
+ 	/*If no front, return NULL*/
+-	if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
++	if(!element->IsIcefront()) return NULL;
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble  Jdet,surface,z,water_pressure,ice_pressure;
+@@ -2973,7 +2990,7 @@
+ ElementVector* StressbalanceAnalysis::CreatePVectorFSFront(Element* element){/*{{{*/
+ 
+ 	/*If no front, return NULL*/
+-	if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
++	if(!element->IsIcefront()) return NULL;
+ 
+ 	/*Intermediaries*/
+ 	int         i,meshtype,dim;
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h	(revision 17226)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h	(revision 17227)
+@@ -31,5 +31,9 @@
+ 	void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 	void GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 
++	/* Updating constraints */
++// 	void UpdateNoIceConstraints(FemModel* femmodel);
++// 	IssmDouble* GetMaskOfIce(Elements* elements, Nodes* nodes);
++// 	void SetMaskOfIceElement(Vector<IssmDouble>* vec_mask_ice, Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/modules/modules.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/modules.h	(revision 17226)
++++ ../trunk-jpl/src/c/modules/modules.h	(revision 17227)
+@@ -30,6 +30,7 @@
+ #include "./GetVectorFromInputsx/GetVectorFromInputsx.h"
+ #include "./GetVectorFromControlInputsx/GetVectorFromControlInputsx.h"
+ #include "./GiaDeflectionCorex/GiaDeflectionCorex.h"
++#include "./SetActiveNodesLSMx/SetActiveNodesLSMx.h"
+ #include "./SetControlInputsFromVectorx/SetControlInputsFromVectorx.h"
+ #include "./Gradjx/Gradjx.h"
+ #include "./GroundinglineMigrationx/GroundinglineMigrationx.h"
+Index: ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 17226)
++++ ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 17227)
+@@ -118,6 +118,19 @@
+ 	//Kff->AllocationInfo();
+ 	//Kfs->AllocationInfo();
+ 
++	// TESTING
++	IssmDouble* Kffd=Kff->ToSerial();
++	Kff->GetSize(&M,&N);
++	_printf0_(" (Kff stiffness matrix size: "<<M<<" x "<<N<<")\n");
++// 	printarray(Kffd,M,N);
++   for(int row=0;row<M;row++){
++		IssmDouble value = Kffd[row*N + row];
++		if(fabs(value)<1.)
++		 _printf0_("Kff(" << row << "," << row << ")=" << value << "\n");
++	 }
++	delete Kffd;
++	
++
+ 	/*cleanu up and assign output pointers: */
+ 	delete analysis;
+ 	if(pKff) *pKff=Kff;
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17226)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17227)
+@@ -284,6 +284,8 @@
+ 					./modules/SystemMatricesx/SystemMatricesx.cpp\
+ 					./modules/CreateNodalConstraintsx/CreateNodalConstraintsx.h\
+ 					./modules/CreateNodalConstraintsx/CreateNodalConstraintsx.cpp\
++					./modules/SetActiveNodesLSMx/SetActiveNodesLSMx.h\
++					./modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp\
+ 					./modules/UpdateDynamicConstraintsx/UpdateDynamicConstraintsx.h\
+ 					./modules/UpdateDynamicConstraintsx/UpdateDynamicConstraintsx.cpp\
+ 					./modules/IoModelToConstraintsx/IoModelToConstraintsx.h\
+Index: ../trunk-jpl/src/c/cores/transient_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17226)
++++ ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17227)
+@@ -161,9 +161,23 @@
+ 
+ 		if(islevelset){
+ 			if(VerboseSolution()) _printf0_("   computing movement of ice boundaries\n");
+-			analysis = new LevelsetAnalysis();
+-			analysis->Core(femmodel);
+-			delete analysis;
++
++			/* extrapolate */
++			Analysis* extanalysis = new ExtrapolationAnalysis();
++			int vars[2] = {VxEnum, VyEnum};
++			for(int iv=0; iv<2;iv++){
++				femmodel->parameters->SetParam(vars[iv],ExtrapolationVariableEnum);
++				extanalysis->Core(femmodel);
++			}
++			delete extanalysis;
++
++			LevelsetAnalysis* lsanalysis = new LevelsetAnalysis();
++			/* solve level-set equation */
++			lsanalysis->Core(femmodel);
++			delete lsanalysis;
++
++			/* update vertices included for next calculation */
++			GetMaskOfIceVerticesLSMx(femmodel);
+ 		}
+ 
+ 		/*unload results*/
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17226)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17227)
+@@ -405,9 +405,12 @@
+ 
+ 	/*start module: */
+ 	if(VerboseModule()) _printf0_("   Updating constraints for time: " << time << "\n");
++	if(VerboseModule()) _printf0_("   and analysis: " << EnumToStringx(analysis_type) << "\n");
++	Analysis* analysis = EnumToAnalysis(analysis_type);
++	_assert_(analysis);
++// 	analysis->UpdateConstraints(this);
++	delete analysis;
+ 
+-	// analysis->UpdateConstraints();
+-	
+ 	/*Second, constraints might be time dependent: */
+ 	SpcNodesx(nodes,constraints,parameters,analysis_type); 
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17226)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17227)
+@@ -219,6 +219,7 @@
+ 		virtual int    VelocityInterpolation()=0;
+ 		virtual int    PressureInterpolation()=0;
+ 		virtual bool   IsZeroLevelset(int levelset_enum)=0;
++		virtual bool   IsIcefront(void)=0;
+ 		virtual void   ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum)=0;
+ 		virtual void   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum)=0;
+ 		virtual void   GetNormalFromLSF(IssmDouble *pnormal)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17226)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17227)
+@@ -908,33 +908,50 @@
+ 			nrfrontnodes++;
+ 		}
+ 	}
+-
++	_assert_(nrfrontnodes==2);
++	
++	/* arrange order of frontnodes such that they are oriented counterclockwise */
++	if((NUMVERTICES+indicesfront[0]-indicesfront[1])%NUMVERTICES!=2){
++		int index=indicesfront[0];
++		indicesfront[0]=indicesfront[1];
++		indicesfront[1]=index;
++	}
+ 	IssmDouble* xyz_front = xNew<IssmDouble>(3*nrfrontnodes);
+ 	/* Return nodes */
+ 	for(i=0;i<nrfrontnodes;i++){
+ 		for(dir=0;dir<3;dir++){
+-			xyz_front[3*i+dir]=xyz_list[indicesfront[i]+dir];
++			xyz_front[3*i+dir]=xyz_list[3*indicesfront[i]+dir];
+ 		}
+ 	}
+ 
++// 	for(i=0;i<nrfrontnodes;i++){
++// 		_printf0_("coords frontnode " << i << " :[");
++// 		for(dir=0;dir<3;dir++){
++// 			xyz_front[3*i+dir]=xyz_list[indicesfront[i]+dir];
++// 			_printf0_(xyz_front[3*i+dir] << "; ");
++// 		}
++// 		_printf0_("]\n");
++// 	}
++
+ 	*pxyz_front=xyz_front;
+ 
+ 	xDelete<int>(indicesfront);
+ }/*}}}*/
+-void  Tria::GetNormalFromLSF(IssmDouble *pnormal){/*{{{*/
++void  Tria::GetNormalFromLSF(IssmDouble *normal){/*{{{*/
+ 
+ 	/* Intermediaries */
+ 	const int dim=2;
+ 	int i,counter;
+ 	IssmDouble* xyz_list = NULL;
+ 	IssmDouble  dlevelset[dim], norm_dlevelset;
+-	IssmDouble  normal[dim]={0.};
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	Input* levelset_input=this->GetInput(MaskIceLevelsetEnum); _assert_(levelset_input);
+ 	this->GetVerticesCoordinates(&xyz_list);
+ 	
+ 	counter=0;
++	for(i=0;i<dim;i++) normal[i]=0.;
++
+ 	Gauss* gauss = this->NewGauss(2);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		/* Get normal on node */
+@@ -946,9 +963,7 @@
+ 		counter++;
+ 	}
+ 	_assert_(counter>0);
+-	for(i=0;i<dim;i++) normal[i]/counter;
+-	
+-	pnormal=&normal[0];
++	for(i=0;i<dim;i++) normal[i]/=IssmDouble(counter);
+ 
+ 	delete gauss;
+ 	xDelete<IssmDouble>(xyz_list);
+@@ -1609,6 +1624,7 @@
+ 				name==BedEnum ||
+ 				name==MaskGroundediceLevelsetEnum ||
+ 				name==MaskIceLevelsetEnum ||
++				name==IceMaskNodeActivationEnum ||
+ 				name==SurfaceSlopeXEnum ||
+ 				name==SurfaceSlopeYEnum ||
+ 				name==BasalforcingsMeltingRateEnum ||
+@@ -2585,7 +2601,7 @@
+ 	/*Retrieve all inputs and parameters*/
+ 	GetInputListOnVertices(&ls[0],levelset_enum);
+ 
+-	/*If the level set is awlays <0, there is no ice front here*/
++	/* If levelset function changes sign, or is zero on at least two vertices, there is a zero level set here */
+ 	iszerols= false;
+ 	if(IsIceInElement()){
+ 		if(ls[0]*ls[1]<0. || ls[0]*ls[2]<0. || (ls[0]*ls[1]+ls[0]*ls[2]+ls[1]*ls[2]==0.)){
+@@ -2596,7 +2612,29 @@
+ 	return iszerols;
+ }
+ /*}}}*/
++/*FUNCTION Tria::IsIcefront{{{*/
++bool Tria::IsIcefront(void){
+ 
++	bool isicefront;
++	int i,nrice;
++	IssmDouble ls[NUMVERTICES];
++
++	/*Retrieve all inputs and parameters*/
++	GetInputListOnVertices(&ls[0],MaskIceLevelsetEnum);
++
++	/* If only one vertex has ice, there is an ice front here */
++	isicefront= false;
++	if(IsIceInElement()){
++		nrice=0;	
++		for(i=0;i<NUMVERTICES;i++)
++			if(ls[i]<0.) nrice++;
++		if(nrice==1) isicefront= true;
++	}
++	return isicefront;
++}
++/*}}}*/
++
++
+ #ifdef _HAVE_RESPONSES_
+ /*FUNCTION Tria::AverageOntoPartition {{{*/
+ void  Tria::AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part){
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17226)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17227)
+@@ -131,8 +131,9 @@
+ 		void   VerticalSegmentIndices(int** pindices,int* pnumseg){_error_("not implemented yet");};
+ 		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum);
+ 		void	    GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum);
+-	    void        GetNormalFromLSF(IssmDouble *pnormal);
++		void        GetNormalFromLSF(IssmDouble *normal);
+ 		bool        IsZeroLevelset(int levelset_enum);
++		bool        IsIcefront(void);
+ 
+ 		#ifdef _HAVE_RESPONSES_
+ 		void       AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17226)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17227)
+@@ -113,6 +113,7 @@
+ 		IssmDouble PureIceEnthalpy(IssmDouble pressure);
+ 		int    PressureInterpolation();
+ 		bool   IsZeroLevelset(int levelset_enum);
++		bool   IsIcefront(void){_error_("not implemented yet");};
+ 		void   ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum);
+ 		void   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented yet");};
+ 		void   GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17226)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17227)
+@@ -158,6 +158,7 @@
+ 		void        VerticalSegmentIndices(int** pindices,int* pnumseg){_error_("not implemented yet");};
+ 		void        ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
+ 		bool        IsZeroLevelset(int levelset_enum){_error_("not implemented");};
++		bool		IsIcefront(void){_error_("not implemented yet");};
+ 		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented");};
+ 		void		GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented yet");};
+ 		void        GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/m/plot/processmesh.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/processmesh.py	(revision 17226)
++++ ../trunk-jpl/src/m/plot/processmesh.py	(revision 17227)
+@@ -13,8 +13,8 @@
+ 	#some checks
+ 	if md.mesh.numberofvertices==0:
+ 		raise ValueError('processmesh error: mesh is empty')
+-	if md.mesh.numberofvertices==md.mesh.numberofelements:
+-		raise ValueError('processmesh error: the number of elements is the same as the number of nodes')
++# 	if md.mesh.numberofvertices==md.mesh.numberofelements:
++# 		raise ValueError('processmesh error: the number of elements is the same as the number of nodes')
+ 
+ 	if len(data)==0 or not isinstance(data,dict):
+ 		
+Index: ../trunk-jpl/src/m/dev/devpath.py
+===================================================================
+--- ../trunk-jpl/src/m/dev/devpath.py	(revision 17226)
++++ ../trunk-jpl/src/m/dev/devpath.py	(revision 17227)
+@@ -24,10 +24,10 @@
+ #Manual imports for commonly used functions
+ from plotmodel import plotmodel
+ 
+-#c = get_ipython().config
+-#c.InteractiveShellApp.exec_lines = []
+-#c.InteractiveShellApp.exec_lines.append('%load_ext autoreload')
+-#c.InteractiveShellApp.exec_lines.append('%autoreload 2')
+-#c.InteractiveShellApp.exec_lines.append('print "Warning: disable autoreload in startup.py to improve performance." ')
++c = get_ipython().config
++c.InteractiveShellApp.exec_lines = []
++c.InteractiveShellApp.exec_lines.append('%load_ext autoreload')
++c.InteractiveShellApp.exec_lines.append('%autoreload 2')
++c.InteractiveShellApp.exec_lines.append('print "Warning: disable autoreload in startup.py to improve performance." ')
+ 
+ print("\n  ISSM development path correctly loaded\n\n")
Index: issm/oecreview/Archive/16554-17801/ISSM-17227-17228.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17227-17228.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17227-17228.diff	(revision 17802)
@@ -0,0 +1,70 @@
+Index: ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 17227)
++++ ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 17228)
+@@ -85,38 +85,39 @@
+ 
+ 	/*output*/
+ 	TriaInput* outinput=NULL;
+-	IssmDouble newvalues[3]; //Assume P1 interpolation only for now
+ 
+-	/*Create arrow of indices depending on location (0=base 1=surface)*/
+-	int indices[3];
+-	switch(location){
+-		case 0:
+-			indices[0] = 0;
+-			indices[1] = 1;
+-			indices[2] = 2;
+-			break;
+-		case 1:
+-			indices[0] = 3;
+-			indices[1] = 4;
+-			indices[2] = 5;
+-			break;
+-		default:
+-			_error_("case "<<location<<" not supported");
++	if(this->element_type==P0Enum){
++		outinput=new TriaInput(this->enum_type,&this->values[0],P0Enum);
+ 	}
++	else{
++		/*Assume P1 interpolation only for now*/
++		IssmDouble newvalues[3]; 
+ 
+-	/*Loop over the new indices*/
+-	for(int i=0;i<3;i++){
++		/*Create arrow of indices depending on location (0=base 1=surface)*/
++		int indices[3];
++		switch(location){
++			case 0:
++				indices[0] = 0;
++				indices[1] = 1;
++				indices[2] = 2;
++				break;
++			case 1:
++				indices[0] = 3;
++				indices[1] = 4;
++				indices[2] = 5;
++				break;
++			default:
++				_error_("case "<<location<<" not supported");
++		}
+ 
+-		/*Check index value*/
+-		_assert_(indices[i]>=0 && indices[i]<6);
+-
+-		/*Assign value to new input*/
+-		newvalues[i]=this->values[indices[i]];
++		/*Create new input*/
++		for(int i=0;i<3;i++){
++			_assert_(indices[i]>=0 && indices[i]<6);
++			newvalues[i]=this->values[indices[i]];
++		}
++		outinput=new TriaInput(this->enum_type,&newvalues[0],P1Enum);
+ 	}
+ 
+-	/*Create new Tria input*/
+-	outinput=new TriaInput(this->enum_type,&newvalues[0],P1Enum);
+-
+ 	/*Assign output*/
+ 	return outinput;
+ }
Index: issm/oecreview/Archive/16554-17801/ISSM-17228-17229.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17228-17229.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17228-17229.diff	(revision 17802)
@@ -0,0 +1,45 @@
+Index: ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 17228)
++++ ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 17229)
+@@ -99,15 +99,21 @@
+ 
+ 	/*output*/
+ 	SegInput* outinput=NULL;
+-	IssmDouble newvalues[2]; //Assume P1 interpolation only for now
+ 
+-	/*Create arrow of indices depending on location (0=base 1=surface)*/
++	if(this->element_type==P0Enum){
++		outinput=new SegInput(this->enum_type,&this->values[0],P0Enum);
++	}
++	else{
++		/*Assume P1 interpolation only for now*/
++		IssmDouble newvalues[2];
+ 
+-	newvalues[0]=this->values[index1];
+-	newvalues[1]=this->values[index2];
++		/*Create array of indices depending on location (0=base 1=surface)*/
++		newvalues[0]=this->values[index1];
++		newvalues[1]=this->values[index2];
+ 
+-	/*Create new Seg input*/
+-	outinput=new SegInput(this->enum_type,&newvalues[0],P1Enum);
++		/*Create new Seg input*/
++		outinput=new SegInput(this->enum_type,&newvalues[0],P1Enum);
++	}
+ 
+ 	/*Assign output*/
+ 	return outinput;
+Index: ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 17228)
++++ ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 17229)
+@@ -93,7 +93,7 @@
+ 		/*Assume P1 interpolation only for now*/
+ 		IssmDouble newvalues[3]; 
+ 
+-		/*Create arrow of indices depending on location (0=base 1=surface)*/
++		/*Create array of indices depending on location (0=base 1=surface)*/
+ 		int indices[3];
+ 		switch(location){
+ 			case 0:
Index: issm/oecreview/Archive/16554-17801/ISSM-17229-17230.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17229-17230.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17229-17230.diff	(revision 17802)
@@ -0,0 +1,739 @@
+Index: ../trunk-jpl/test/NightlyRun/test336.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test336.py	(revision 17229)
++++ ../trunk-jpl/test/NightlyRun/test336.py	(revision 17230)
+@@ -7,7 +7,7 @@
+ from solve import *
+ from MatlabFuncs import *
+ 
+-md=triangle(model(),'../Exp/Square.exp',10000.)
++md=triangle(model(),'../Exp/Square.exp',150000.)
+ md=setmask(md,'','')
+ md=parameterize(md,'../Par/SquareSheetConstrained.py') 
+ md=setflowequation(md,'SSA','all')
+@@ -19,52 +19,33 @@
+ md.transient.isthermal=False
+ md.transient.isgroundingline=False
+ md.transient.isgia=False
+-md.transient.islevelset=False
++md.transient.islevelset=True
+ 
+ # init levelset function
+ ymin=numpy.min(md.mesh.y)
+ ymax=numpy.max(md.mesh.y)
+ xmin=min(md.mesh.x)
+ xmax=max(md.mesh.x)
+-xmed=(xmax+xmin)/2.
+-ymed=(ymax+ymin)/2.
+-md.mask.ice_levelset=numpy.sqrt(numpy.power(md.mesh.x-xmed,2.)+numpy.power(md.mesh.y-ymed,2.)) - (xmax-xmin)/3.
++xmed=(xmax+xmin)/2
++ymed=(ymax+ymin)/2
++distx=numpy.absolute(md.mesh.x.reshape(-1,1)-xmed)
++disty=numpy.absolute(md.mesh.y.reshape(-1,1)-ymed)
++md.mask.ice_levelset=numpy.maximum(distx,disty)-1.e5
+ 
+-# set spcs
+-mask=1.*numpy.ones((md.mesh.numberofvertices,1))
+-nrverts=md.mesh.elements.shape[1]
+-for i in range(0,md.mesh.numberofelements):
+-	elt=numpy.copy(md.mesh.elements[i])
+-	elt-=1
+-	isiceinelement=False
+-	for iv in range(0,nrverts):
+-		if(md.mask.ice_levelset[elt[iv]]<=0.):
+-			isiceinelement=True
+-	if(isiceinelement):
+-		for iv in range(0,nrverts):
+-			mask[elt[iv]]=2.
+-
+-v=0.
+-for i in range(0,md.mesh.numberofvertices):
+-	if(mask[i]==1.):
+-		md.stressbalance.spcvx[i]=v
+-		md.stressbalance.spcvy[i]=v
+-		md.stressbalance.spcvz[i]=v
+-
+ md=solve(md,TransientSolutionEnum())
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Vx','Vy','Vel','Pressure','MaskIceLevelset']
+-field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]#,1e-13,1e-13]
++field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
+ field_values=[\
+ 	md.results.TransientSolution[0].Vx,\
+ 	md.results.TransientSolution[0].Vy,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-# 	md.results.TransientSolution[0].MaskIceLevelset,\
++	md.results.TransientSolution[0].MaskIceLevelset,\
+ 	md.results.TransientSolution[1].Vx,\
+ 	md.results.TransientSolution[1].Vy,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-# 	md.results.TransientSolution[1].MaskIceLevelset,\
++	md.results.TransientSolution[1].MaskIceLevelset,\
+ 	]
+Index: ../trunk-jpl/test/Archives/Archive336.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/externalpackages/vim/addons/vimrc
+===================================================================
+--- ../trunk-jpl/externalpackages/vim/addons/vimrc	(revision 17229)
++++ ../trunk-jpl/externalpackages/vim/addons/vimrc	(revision 17230)
+@@ -99,17 +99,13 @@
+ map num :set number!<CR>
+ 
+ " save & "make" the current file in all modes
+-map <F6> :w <Enter> :make <Enter><Enter>
+-map! <F6>  <ESC> :w <Enter> :make <Enter><Enter>
++map <F8> :w <Enter> :make <Enter><Enter>
++map! <F8>  <ESC> :w <Enter> :make <Enter><Enter>
+ " make update: nice for longer documents
+-map <F5> :w <Enter> :make update <Enter><Enter>
+-map! <F5> <ESC> :w <Enter> :make update <Enter><Enter>
++map <F7> :w <Enter> :make update <Enter><Enter>
++map! <F7> <ESC> :w <Enter> :make update <Enter><Enter>
+ 
+-" switch between tabs
+-nmap <F7> :tabp <CR>
+-nmap <F8> :tabn <CR>
+ 
+-
+ "use paste P: re-indent and re-format at the same time
+ :nnoremap <Esc>P P'[v']=
+ :nnoremap <Esc>p p'[v']=
+@@ -144,15 +140,6 @@
+   "scripts must be executable
+   autocmd BufWritePost   *.sh         !chmod +x %
+ 
+-	" Commenting blocks of code.
+-	autocmd FileType c,cpp,java,scala let b:comment_leader = '// '
+-	autocmd FileType sh,ruby,python   let b:comment_leader = '# '
+-	autocmd FileType conf,fstab       let b:comment_leader = '# '
+-	autocmd FileType tex              let b:comment_leader = '% '
+-	autocmd FileType mail             let b:comment_leader = '> '
+-	autocmd FileType vim              let b:comment_leader = '" '
+-	noremap <silent> ,cc :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR>
+-	noremap <silent> ,cu :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR>
+ endif " has("autocmd")
+ " ----------------------------------------------------------------------}}}
+ " Matlab special {{{
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17229)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17230)
+@@ -32,7 +32,7 @@
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,VxEnum);
+ 	iomodel->FetchDataToInput(elements,VyEnum);
+-	iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
++	
+ }
+ /*}}}*/
+ void LevelsetAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+@@ -66,14 +66,21 @@
+ 	/*parameters: */
+ 	bool save_results;
+ 
++	/* extrapolate */
++	Analysis* analysis = new ExtrapolationAnalysis();
++	femmodel->parameters->SetParam(VxEnum,ExtrapolationVariableEnum);
++	analysis->Core(femmodel);
++	delete analysis;
++
+ 	/*activate formulation: */
+ 	femmodel->SetCurrentConfiguration(LevelsetAnalysisEnum);
+ 
++	/*recover parameters: */
++	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
++
+ 	if(VerboseSolution()) _printf0_("call computational core:\n");
+ 	solutionsequence_linear(femmodel);
+ 
+-	/*recover parameters: */
+-	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
+ 	if(save_results){
+ 		if(VerboseSolution()) _printf0_("   saving results\n");
+ 		int outputs = MaskIceLevelsetEnum;
+@@ -320,57 +327,3 @@
+ 
+ }/*}}}*/
+ 
+-/* Update of constraints */
+-// void LevelsetAnalysis::UpdateNoIceConstraints(FemModel* femmodel){/*{{{*/
+-// 
+-// 	IssmDouble* mask_ice = GetMaskOfIce(femmodel->elements, femmodel->nodes); 
+-// 
+-// 	for (int i=0;i<femmodel->nodes->Size();i++){
+-// 		Node* node=dynamic_cast<Node*>(femmodel->nodes->GetObjectByOffset(i));
+-// 		if(node->InAnalysis(LevelsetAnalysisEnum)){
+-// 			if(mask_ice[node->Sid()]==1.){//FIXME: what should be done with actual spcs to ice model?
+-// // 				node->DofInFSet(0); /*remove spc*/ 
+-// 			}
+-// 			else{
+-// 				IssmDouble defval=0.;
+-// 				node->ApplyConstraint(1,defval); /*apply spc*/ 
+-// 			}
+-// 		}
+-// 	}
+-// }/*}}}*/
+-// IssmDouble* LevelsetAnalysis::GetMaskOfIce(Elements* elements, Nodes* nodes){/*{{{*/
+-// 
+-// 	int                 i;
+-// 	IssmDouble*         mask_ice      = NULL;
+-// 	Vector<IssmDouble>* vec_mask_ice  = NULL;
+-// 	Element*            element       = NULL;
+-// 
+-// 	/*Initialize vector with number of vertices*/
+-// 	IssmDouble numnodes=nodes->NumberOfNodes(LevelsetAnalysisEnum);
+-// 	vec_mask_ice=new Vector<IssmDouble>(numnodes); //nodes at ice front that have ice at next time step
+-// 	for(i=0;i<numnodes;i++)
+-// 		vec_mask_ice[i]=0.;
+-// 	/*Fill vector vertices that have no contact to ice: */
+-// 	for(i=0;i<elements->Size();i++){
+-// 		element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+-// 		SetMaskOfIceElement(vec_mask_ice, element);
+-// 	}
+-// 
+-// 	/*Assemble vector and serialize */
+-// 	vec_mask_ice->Assemble();
+-// 	mask_ice=vec_mask_ice->ToMPISerial();
+-// 	delete vec_mask_ice;
+-// 	return mask_ice;
+-// 
+-// }/*}}}*/
+-// void LevelsetAnalysis::SetMaskOfIceElement(Vector<IssmDouble>* vec_mask_ice, Element* element){/*{{{*/
+-// 
+-// 	/* Intermediaries */
+-// 	int numnodes = element->GetNumberOfNodes();
+-// 	
+-// 	if(element->IsIceInElement()){
+-// 		for(int i = 0;i<numnodes;i++){
+-// 			vec_mask_ice->SetValue(element->nodes[i]->Sid(),1.,INS_VAL);
+-// 		}
+-// 	}
+-// }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17229)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17230)
+@@ -188,9 +188,7 @@
+ 	iomodel->FetchDataToInput(elements,LoadingforceXEnum);
+ 	iomodel->FetchDataToInput(elements,LoadingforceYEnum);
+ 	iomodel->FetchDataToInput(elements,DamageDEnum);
+-	iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
+ 
+-
+ 	if(iomodel->meshtype==Mesh3DEnum){
+ 		iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+@@ -1025,7 +1023,7 @@
+ 	}
+ }/*}}}*/
+ void StressbalanceAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+-	SetActiveNodesLSMx(femmodel->elements);
++	/*Default, do nothing*/
+ 	return;
+ }/*}}}*/
+ 
+@@ -1144,10 +1142,6 @@
+ 	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	delete Ke1;
+ 	delete Ke2;
+-	
+-	// FIXME: TESTING
+-// 	_printf0_("\n element ID: " << element->Id() << ";\n");
+-// 	Ke->Echo();
+ 	return Ke;
+ }/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSAFriction(Element* element){/*{{{*/
+@@ -1270,9 +1264,6 @@
+ 
+ 		newviscosity=viscosity+viscosity_overshoot*(viscosity-oldviscosity);
+ 		D_scalar=2.*newviscosity*thickness*gauss->weight*Jdet;
+-		
+-// 		_printf0_("element, node, weight, Jdet: " << element->Id() << "; " << ig << "; " << gauss->weight << "; " << Jdet << "\n");
+-
+ 		for(int i=0;i<3;i++) D[i*3+i]=D_scalar;
+ 
+ 		TripleMultiply(B,3,numdof,1,
+@@ -1323,10 +1314,6 @@
+ 	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	delete pe1;
+ 	delete pe2;
+-
+-// 	_printf0_("\n element ID: " << element->Id() << ";\n");
+-// 	pe->Echo();
+-
+ 	return pe;
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorSSADrivingStress(Element* element){/*{{{*/
+@@ -1384,7 +1371,7 @@
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+ 	/*If no front, return NULL*/
+-	if(!element->IsIcefront()) return NULL;
++	if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble  Jdet,thickness,bed,water_pressure,ice_pressure;
+@@ -1407,12 +1394,8 @@
+ 	IssmDouble rho_ice     = element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 	IssmDouble gravity     = element->GetMaterialParameter(ConstantsGEnum);
+ 	element->GetVerticesCoordinates(&xyz_list);
+-
+-// 	element->ZeroLevelsetCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
+- 	element->GetIcefrontCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
+-
++	element->ZeroLevelsetCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
+ 	element->NormalSection(&normal[0],xyz_list_front);
+-// 	element->GetNormalFromLSF(&normal[0]);
+ 
+ 	/*Start looping on Gaussian points*/
+ 	Gauss* gauss=element->NewGauss(xyz_list,xyz_list_front,3);
+@@ -1801,7 +1784,7 @@
+ ElementVector* StressbalanceAnalysis::CreatePVectorL1L2Front(Element* element){/*{{{*/
+ 
+ 	/*If no front, return NULL*/
+-	if(!element->IsIcefront()) return NULL;
++	if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble  Jdet,thickness,bed,water_pressure,ice_pressure;
+@@ -2224,7 +2207,7 @@
+ ElementVector* StressbalanceAnalysis::CreatePVectorHOFront(Element* element){/*{{{*/
+ 
+ 	/*If no front, return NULL*/
+-	if(!element->IsIcefront()) return NULL;
++	if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble  Jdet,surface,z,water_pressure,ice_pressure;
+@@ -2990,7 +2973,7 @@
+ ElementVector* StressbalanceAnalysis::CreatePVectorFSFront(Element* element){/*{{{*/
+ 
+ 	/*If no front, return NULL*/
+-	if(!element->IsIcefront()) return NULL;
++	if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
+ 
+ 	/*Intermediaries*/
+ 	int         i,meshtype,dim;
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h	(revision 17229)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h	(revision 17230)
+@@ -31,9 +31,5 @@
+ 	void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 	void GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 
+-	/* Updating constraints */
+-// 	void UpdateNoIceConstraints(FemModel* femmodel);
+-// 	IssmDouble* GetMaskOfIce(Elements* elements, Nodes* nodes);
+-// 	void SetMaskOfIceElement(Vector<IssmDouble>* vec_mask_ice, Element* element);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/modules/modules.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/modules.h	(revision 17229)
++++ ../trunk-jpl/src/c/modules/modules.h	(revision 17230)
+@@ -30,7 +30,6 @@
+ #include "./GetVectorFromInputsx/GetVectorFromInputsx.h"
+ #include "./GetVectorFromControlInputsx/GetVectorFromControlInputsx.h"
+ #include "./GiaDeflectionCorex/GiaDeflectionCorex.h"
+-#include "./SetActiveNodesLSMx/SetActiveNodesLSMx.h"
+ #include "./SetControlInputsFromVectorx/SetControlInputsFromVectorx.h"
+ #include "./Gradjx/Gradjx.h"
+ #include "./GroundinglineMigrationx/GroundinglineMigrationx.h"
+Index: ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 17229)
++++ ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 17230)
+@@ -118,19 +118,6 @@
+ 	//Kff->AllocationInfo();
+ 	//Kfs->AllocationInfo();
+ 
+-	// TESTING
+-	IssmDouble* Kffd=Kff->ToSerial();
+-	Kff->GetSize(&M,&N);
+-	_printf0_(" (Kff stiffness matrix size: "<<M<<" x "<<N<<")\n");
+-// 	printarray(Kffd,M,N);
+-   for(int row=0;row<M;row++){
+-		IssmDouble value = Kffd[row*N + row];
+-		if(fabs(value)<1.)
+-		 _printf0_("Kff(" << row << "," << row << ")=" << value << "\n");
+-	 }
+-	delete Kffd;
+-	
+-
+ 	/*cleanu up and assign output pointers: */
+ 	delete analysis;
+ 	if(pKff) *pKff=Kff;
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17229)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17230)
+@@ -284,8 +284,6 @@
+ 					./modules/SystemMatricesx/SystemMatricesx.cpp\
+ 					./modules/CreateNodalConstraintsx/CreateNodalConstraintsx.h\
+ 					./modules/CreateNodalConstraintsx/CreateNodalConstraintsx.cpp\
+-					./modules/SetActiveNodesLSMx/SetActiveNodesLSMx.h\
+-					./modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp\
+ 					./modules/UpdateDynamicConstraintsx/UpdateDynamicConstraintsx.h\
+ 					./modules/UpdateDynamicConstraintsx/UpdateDynamicConstraintsx.cpp\
+ 					./modules/IoModelToConstraintsx/IoModelToConstraintsx.h\
+Index: ../trunk-jpl/src/c/cores/transient_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17229)
++++ ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17230)
+@@ -161,23 +161,9 @@
+ 
+ 		if(islevelset){
+ 			if(VerboseSolution()) _printf0_("   computing movement of ice boundaries\n");
+-
+-			/* extrapolate */
+-			Analysis* extanalysis = new ExtrapolationAnalysis();
+-			int vars[2] = {VxEnum, VyEnum};
+-			for(int iv=0; iv<2;iv++){
+-				femmodel->parameters->SetParam(vars[iv],ExtrapolationVariableEnum);
+-				extanalysis->Core(femmodel);
+-			}
+-			delete extanalysis;
+-
+-			LevelsetAnalysis* lsanalysis = new LevelsetAnalysis();
+-			/* solve level-set equation */
+-			lsanalysis->Core(femmodel);
+-			delete lsanalysis;
+-
+-			/* update vertices included for next calculation */
+-			GetMaskOfIceVerticesLSMx(femmodel);
++			analysis = new LevelsetAnalysis();
++			analysis->Core(femmodel);
++			delete analysis;
+ 		}
+ 
+ 		/*unload results*/
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17229)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17230)
+@@ -405,12 +405,9 @@
+ 
+ 	/*start module: */
+ 	if(VerboseModule()) _printf0_("   Updating constraints for time: " << time << "\n");
+-	if(VerboseModule()) _printf0_("   and analysis: " << EnumToStringx(analysis_type) << "\n");
+-	Analysis* analysis = EnumToAnalysis(analysis_type);
+-	_assert_(analysis);
+-// 	analysis->UpdateConstraints(this);
+-	delete analysis;
+ 
++	// analysis->UpdateConstraints();
++	
+ 	/*Second, constraints might be time dependent: */
+ 	SpcNodesx(nodes,constraints,parameters,analysis_type); 
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17229)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17230)
+@@ -219,7 +219,6 @@
+ 		virtual int    VelocityInterpolation()=0;
+ 		virtual int    PressureInterpolation()=0;
+ 		virtual bool   IsZeroLevelset(int levelset_enum)=0;
+-		virtual bool   IsIcefront(void)=0;
+ 		virtual void   ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum)=0;
+ 		virtual void   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum)=0;
+ 		virtual void   GetNormalFromLSF(IssmDouble *pnormal)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17229)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17230)
+@@ -908,50 +908,33 @@
+ 			nrfrontnodes++;
+ 		}
+ 	}
+-	_assert_(nrfrontnodes==2);
+-	
+-	/* arrange order of frontnodes such that they are oriented counterclockwise */
+-	if((NUMVERTICES+indicesfront[0]-indicesfront[1])%NUMVERTICES!=2){
+-		int index=indicesfront[0];
+-		indicesfront[0]=indicesfront[1];
+-		indicesfront[1]=index;
+-	}
++
+ 	IssmDouble* xyz_front = xNew<IssmDouble>(3*nrfrontnodes);
+ 	/* Return nodes */
+ 	for(i=0;i<nrfrontnodes;i++){
+ 		for(dir=0;dir<3;dir++){
+-			xyz_front[3*i+dir]=xyz_list[3*indicesfront[i]+dir];
++			xyz_front[3*i+dir]=xyz_list[indicesfront[i]+dir];
+ 		}
+ 	}
+ 
+-// 	for(i=0;i<nrfrontnodes;i++){
+-// 		_printf0_("coords frontnode " << i << " :[");
+-// 		for(dir=0;dir<3;dir++){
+-// 			xyz_front[3*i+dir]=xyz_list[indicesfront[i]+dir];
+-// 			_printf0_(xyz_front[3*i+dir] << "; ");
+-// 		}
+-// 		_printf0_("]\n");
+-// 	}
+-
+ 	*pxyz_front=xyz_front;
+ 
+ 	xDelete<int>(indicesfront);
+ }/*}}}*/
+-void  Tria::GetNormalFromLSF(IssmDouble *normal){/*{{{*/
++void  Tria::GetNormalFromLSF(IssmDouble *pnormal){/*{{{*/
+ 
+ 	/* Intermediaries */
+ 	const int dim=2;
+ 	int i,counter;
+ 	IssmDouble* xyz_list = NULL;
+ 	IssmDouble  dlevelset[dim], norm_dlevelset;
++	IssmDouble  normal[dim]={0.};
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	Input* levelset_input=this->GetInput(MaskIceLevelsetEnum); _assert_(levelset_input);
+ 	this->GetVerticesCoordinates(&xyz_list);
+ 	
+ 	counter=0;
+-	for(i=0;i<dim;i++) normal[i]=0.;
+-
+ 	Gauss* gauss = this->NewGauss(2);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		/* Get normal on node */
+@@ -963,7 +946,9 @@
+ 		counter++;
+ 	}
+ 	_assert_(counter>0);
+-	for(i=0;i<dim;i++) normal[i]/=IssmDouble(counter);
++	for(i=0;i<dim;i++) normal[i]/counter;
++	
++	pnormal=&normal[0];
+ 
+ 	delete gauss;
+ 	xDelete<IssmDouble>(xyz_list);
+@@ -1624,7 +1609,6 @@
+ 				name==BedEnum ||
+ 				name==MaskGroundediceLevelsetEnum ||
+ 				name==MaskIceLevelsetEnum ||
+-				name==IceMaskNodeActivationEnum ||
+ 				name==SurfaceSlopeXEnum ||
+ 				name==SurfaceSlopeYEnum ||
+ 				name==BasalforcingsMeltingRateEnum ||
+@@ -2601,7 +2585,7 @@
+ 	/*Retrieve all inputs and parameters*/
+ 	GetInputListOnVertices(&ls[0],levelset_enum);
+ 
+-	/* If levelset function changes sign, or is zero on at least two vertices, there is a zero level set here */
++	/*If the level set is awlays <0, there is no ice front here*/
+ 	iszerols= false;
+ 	if(IsIceInElement()){
+ 		if(ls[0]*ls[1]<0. || ls[0]*ls[2]<0. || (ls[0]*ls[1]+ls[0]*ls[2]+ls[1]*ls[2]==0.)){
+@@ -2612,29 +2596,7 @@
+ 	return iszerols;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::IsIcefront{{{*/
+-bool Tria::IsIcefront(void){
+ 
+-	bool isicefront;
+-	int i,nrice;
+-	IssmDouble ls[NUMVERTICES];
+-
+-	/*Retrieve all inputs and parameters*/
+-	GetInputListOnVertices(&ls[0],MaskIceLevelsetEnum);
+-
+-	/* If only one vertex has ice, there is an ice front here */
+-	isicefront= false;
+-	if(IsIceInElement()){
+-		nrice=0;	
+-		for(i=0;i<NUMVERTICES;i++)
+-			if(ls[i]<0.) nrice++;
+-		if(nrice==1) isicefront= true;
+-	}
+-	return isicefront;
+-}
+-/*}}}*/
+-
+-
+ #ifdef _HAVE_RESPONSES_
+ /*FUNCTION Tria::AverageOntoPartition {{{*/
+ void  Tria::AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part){
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17229)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17230)
+@@ -131,9 +131,8 @@
+ 		void   VerticalSegmentIndices(int** pindices,int* pnumseg){_error_("not implemented yet");};
+ 		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum);
+ 		void	    GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum);
+-		void        GetNormalFromLSF(IssmDouble *normal);
++	    void        GetNormalFromLSF(IssmDouble *pnormal);
+ 		bool        IsZeroLevelset(int levelset_enum);
+-		bool        IsIcefront(void);
+ 
+ 		#ifdef _HAVE_RESPONSES_
+ 		void       AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17229)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17230)
+@@ -113,7 +113,6 @@
+ 		IssmDouble PureIceEnthalpy(IssmDouble pressure);
+ 		int    PressureInterpolation();
+ 		bool   IsZeroLevelset(int levelset_enum);
+-		bool   IsIcefront(void){_error_("not implemented yet");};
+ 		void   ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum);
+ 		void   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented yet");};
+ 		void   GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17229)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17230)
+@@ -158,7 +158,6 @@
+ 		void        VerticalSegmentIndices(int** pindices,int* pnumseg){_error_("not implemented yet");};
+ 		void        ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
+ 		bool        IsZeroLevelset(int levelset_enum){_error_("not implemented");};
+-		bool		IsIcefront(void){_error_("not implemented yet");};
+ 		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented");};
+ 		void		GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented yet");};
+ 		void        GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 17229)
++++ ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 17230)
+@@ -99,21 +99,15 @@
+ 
+ 	/*output*/
+ 	SegInput* outinput=NULL;
++	IssmDouble newvalues[2]; //Assume P1 interpolation only for now
+ 
+-	if(this->element_type==P0Enum){
+-		outinput=new SegInput(this->enum_type,&this->values[0],P0Enum);
+-	}
+-	else{
+-		/*Assume P1 interpolation only for now*/
+-		IssmDouble newvalues[2];
++	/*Create arrow of indices depending on location (0=base 1=surface)*/
+ 
+-		/*Create array of indices depending on location (0=base 1=surface)*/
+-		newvalues[0]=this->values[index1];
+-		newvalues[1]=this->values[index2];
++	newvalues[0]=this->values[index1];
++	newvalues[1]=this->values[index2];
+ 
+-		/*Create new Seg input*/
+-		outinput=new SegInput(this->enum_type,&newvalues[0],P1Enum);
+-	}
++	/*Create new Seg input*/
++	outinput=new SegInput(this->enum_type,&newvalues[0],P1Enum);
+ 
+ 	/*Assign output*/
+ 	return outinput;
+Index: ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 17229)
++++ ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 17230)
+@@ -85,39 +85,38 @@
+ 
+ 	/*output*/
+ 	TriaInput* outinput=NULL;
++	IssmDouble newvalues[3]; //Assume P1 interpolation only for now
+ 
+-	if(this->element_type==P0Enum){
+-		outinput=new TriaInput(this->enum_type,&this->values[0],P0Enum);
++	/*Create arrow of indices depending on location (0=base 1=surface)*/
++	int indices[3];
++	switch(location){
++		case 0:
++			indices[0] = 0;
++			indices[1] = 1;
++			indices[2] = 2;
++			break;
++		case 1:
++			indices[0] = 3;
++			indices[1] = 4;
++			indices[2] = 5;
++			break;
++		default:
++			_error_("case "<<location<<" not supported");
+ 	}
+-	else{
+-		/*Assume P1 interpolation only for now*/
+-		IssmDouble newvalues[3]; 
+ 
+-		/*Create array of indices depending on location (0=base 1=surface)*/
+-		int indices[3];
+-		switch(location){
+-			case 0:
+-				indices[0] = 0;
+-				indices[1] = 1;
+-				indices[2] = 2;
+-				break;
+-			case 1:
+-				indices[0] = 3;
+-				indices[1] = 4;
+-				indices[2] = 5;
+-				break;
+-			default:
+-				_error_("case "<<location<<" not supported");
+-		}
++	/*Loop over the new indices*/
++	for(int i=0;i<3;i++){
+ 
+-		/*Create new input*/
+-		for(int i=0;i<3;i++){
+-			_assert_(indices[i]>=0 && indices[i]<6);
+-			newvalues[i]=this->values[indices[i]];
+-		}
+-		outinput=new TriaInput(this->enum_type,&newvalues[0],P1Enum);
++		/*Check index value*/
++		_assert_(indices[i]>=0 && indices[i]<6);
++
++		/*Assign value to new input*/
++		newvalues[i]=this->values[indices[i]];
+ 	}
+ 
++	/*Create new Tria input*/
++	outinput=new TriaInput(this->enum_type,&newvalues[0],P1Enum);
++
+ 	/*Assign output*/
+ 	return outinput;
+ }
+Index: ../trunk-jpl/src/m/plot/processmesh.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/processmesh.py	(revision 17229)
++++ ../trunk-jpl/src/m/plot/processmesh.py	(revision 17230)
+@@ -13,8 +13,8 @@
+ 	#some checks
+ 	if md.mesh.numberofvertices==0:
+ 		raise ValueError('processmesh error: mesh is empty')
+-# 	if md.mesh.numberofvertices==md.mesh.numberofelements:
+-# 		raise ValueError('processmesh error: the number of elements is the same as the number of nodes')
++	if md.mesh.numberofvertices==md.mesh.numberofelements:
++		raise ValueError('processmesh error: the number of elements is the same as the number of nodes')
+ 
+ 	if len(data)==0 or not isinstance(data,dict):
+ 		
+Index: ../trunk-jpl/src/m/dev/devpath.py
+===================================================================
+--- ../trunk-jpl/src/m/dev/devpath.py	(revision 17229)
++++ ../trunk-jpl/src/m/dev/devpath.py	(revision 17230)
+@@ -24,10 +24,10 @@
+ #Manual imports for commonly used functions
+ from plotmodel import plotmodel
+ 
+-c = get_ipython().config
+-c.InteractiveShellApp.exec_lines = []
+-c.InteractiveShellApp.exec_lines.append('%load_ext autoreload')
+-c.InteractiveShellApp.exec_lines.append('%autoreload 2')
+-c.InteractiveShellApp.exec_lines.append('print "Warning: disable autoreload in startup.py to improve performance." ')
++#c = get_ipython().config
++#c.InteractiveShellApp.exec_lines = []
++#c.InteractiveShellApp.exec_lines.append('%load_ext autoreload')
++#c.InteractiveShellApp.exec_lines.append('%autoreload 2')
++#c.InteractiveShellApp.exec_lines.append('print "Warning: disable autoreload in startup.py to improve performance." ')
+ 
+ print("\n  ISSM development path correctly loaded\n\n")
Index: issm/oecreview/Archive/16554-17801/ISSM-17230-17231.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17230-17231.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17230-17231.diff	(revision 17802)
@@ -0,0 +1,102 @@
+Index: ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 17230)
++++ ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 17231)
+@@ -99,15 +99,21 @@
+ 
+ 	/*output*/
+ 	SegInput* outinput=NULL;
+-	IssmDouble newvalues[2]; //Assume P1 interpolation only for now
+ 
+-	/*Create arrow of indices depending on location (0=base 1=surface)*/
++	if(this->element_type==P0Enum){ 
++		outinput=new SegInput(this->enum_type,&this->values[0],P0Enum);
++	}
++	else{
++		/*Assume P1 interpolation only for now*/
++		IssmDouble newvalues[2];
+ 
+-	newvalues[0]=this->values[index1];
+-	newvalues[1]=this->values[index2];
++		/*Create array of indices depending on location (0=base 1=surface)*/
++		newvalues[0]=this->values[index1];
++		newvalues[1]=this->values[index2];
+ 
+-	/*Create new Seg input*/
+-	outinput=new SegInput(this->enum_type,&newvalues[0],P1Enum);
++		/*Create new Seg input*/
++		outinput=new SegInput(this->enum_type,&newvalues[0],P1Enum);
++	}
+ 
+ 	/*Assign output*/
+ 	return outinput;
+Index: ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 17230)
++++ ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 17231)
+@@ -85,38 +85,39 @@
+ 
+ 	/*output*/
+ 	TriaInput* outinput=NULL;
+-	IssmDouble newvalues[3]; //Assume P1 interpolation only for now
+ 
+-	/*Create arrow of indices depending on location (0=base 1=surface)*/
+-	int indices[3];
+-	switch(location){
+-		case 0:
+-			indices[0] = 0;
+-			indices[1] = 1;
+-			indices[2] = 2;
+-			break;
+-		case 1:
+-			indices[0] = 3;
+-			indices[1] = 4;
+-			indices[2] = 5;
+-			break;
+-		default:
+-			_error_("case "<<location<<" not supported");
++	if(this->element_type==P0Enum){ 
++		outinput=new TriaInput(this->enum_type,&this->values[0],P0Enum);
+ 	}
++	else{
++		/*Assume P1 interpolation only for now*/
++		IssmDouble newvalues[3]; 
+ 
+-	/*Loop over the new indices*/
+-	for(int i=0;i<3;i++){
++		/*Create array of indices depending on location (0=base 1=surface)*/
++		int indices[3];
++		switch(location){
++			case 0:
++				indices[0] = 0;
++				indices[1] = 1;
++				indices[2] = 2;
++				break;
++			case 1:
++				indices[0] = 3;
++				indices[1] = 4;
++				indices[2] = 5;
++				break;
++			default:
++				_error_("case "<<location<<" not supported");
++		}
+ 
+-		/*Check index value*/
+-		_assert_(indices[i]>=0 && indices[i]<6);
+-
+-		/*Assign value to new input*/
+-		newvalues[i]=this->values[indices[i]];
++		/*Create new input*/
++		for(int i=0;i<3;i++){
++			_assert_(indices[i]>=0 && indices[i]<6);
++			newvalues[i]=this->values[indices[i]];
++		}
++		outinput=new TriaInput(this->enum_type,&newvalues[0],P1Enum);
+ 	}
+ 
+-	/*Create new Tria input*/
+-	outinput=new TriaInput(this->enum_type,&newvalues[0],P1Enum);
+-
+ 	/*Assign output*/
+ 	return outinput;
+ }
Index: issm/oecreview/Archive/16554-17801/ISSM-17231-17232.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17231-17232.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17231-17232.diff	(revision 17802)
@@ -0,0 +1,65 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17231)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17232)
+@@ -1217,10 +1217,7 @@
+ 
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	for(int i=0;i<NUMVERTICES;i++) y_list[i]=xyz_list[i][1];
+-	int backup = this->element_type;
+-	this->element_type = P1Enum;
+-	TriaRef::GetInputValue(&y,y_list,gauss);
+-	this->element_type = backup;
++	TriaRef::GetInputValue(&y,y_list,gauss,P1Enum);
+ 
+ 	return y;
+ }
+@@ -2562,7 +2559,7 @@
+ /*}}}*/
+ /*FUNCTION Tria::ValueP1OnGauss{{{*/
+ void Tria::ValueP1OnGauss(IssmDouble* pvalue,IssmDouble* values,Gauss* gauss){
+-	TriaRef::GetInputValue(pvalue,values,gauss);
++	TriaRef::GetInputValue(pvalue,values,gauss,P1Enum);
+ }
+ /*}}}*/
+ /*FUNCTION Tria::ValueP1DerivativesOnGauss{{{*/
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17231)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17232)
+@@ -1218,7 +1218,7 @@
+ 
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	for(i=0;i<NUMVERTICES;i++) x_list[i]=xyz_list[i][0];
+-	PentaRef::GetInputValue(&x,x_list,gauss);
++	PentaRef::GetInputValue(&x,x_list,gauss,P1Enum);
+ 
+ 	return x;
+ }
+@@ -1233,7 +1233,7 @@
+ 
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	for(i=0;i<NUMVERTICES;i++) y_list[i]=xyz_list[i][1];
+-	PentaRef::GetInputValue(&y,y_list,gauss);
++	PentaRef::GetInputValue(&y,y_list,gauss,P1Enum);
+ 
+ 	return y;
+ }
+@@ -1248,7 +1248,7 @@
+ 
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	for(i=0;i<NUMVERTICES;i++) z_list[i]=xyz_list[i][2];
+-	PentaRef::GetInputValue(&z,z_list,gauss);
++	PentaRef::GetInputValue(&z,z_list,gauss,P1Enum);
+ 
+ 	return z;
+ }
+@@ -3101,7 +3101,7 @@
+ /*}}}*/
+ /*FUNCTION Penta::ValueP1OnGauss{{{*/
+ void Penta::ValueP1OnGauss(IssmDouble* pvalue,IssmDouble* values,Gauss* gauss){
+-	PentaRef::GetInputValue(pvalue,values,gauss);
++	PentaRef::GetInputValue(pvalue,values,gauss,P1Enum);
+ }
+ /*}}}*/
+ /*FUNCTION Penta::ValueP1DerivativesOnGauss{{{*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17232-17233.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17232-17233.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17232-17233.diff	(revision 17802)
@@ -0,0 +1,20 @@
+Index: ../trunk-jpl/src/c/classes/Elements/SegRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/SegRef.cpp	(revision 17232)
++++ ../trunk-jpl/src/c/classes/Elements/SegRef.cpp	(revision 17233)
+@@ -15,6 +15,7 @@
+ /*}}}*/
+ 
+ /*Element macros*/
++#define NUMNODESP0  1
+ #define NUMNODESP1  2
+ 
+ /*Object constructors and destructor*/
+@@ -269,6 +270,7 @@
+ int SegRef::NumberofNodes(int finiteelement){
+ 
+ 	switch(finiteelement){
++		case P0Enum:                return NUMNODESP1;
+ 		case P1Enum:                return NUMNODESP1;
+ 		case P1DGEnum:              return NUMNODESP1;
+ 		default: _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
Index: issm/oecreview/Archive/16554-17801/ISSM-17233-17234.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17233-17234.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17233-17234.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/packagers/win7/startup.m
+===================================================================
+--- ../trunk-jpl/packagers/win7/startup.m	(revision 17233)
++++ ../trunk-jpl/packagers/win7/startup.m	(revision 17234)
+@@ -24,6 +24,7 @@
+ %ISSM path
+ addpath(pwd); %add current path first
+ addpath([pwd '\bin']);
++addpath([pwd '\lib']);
+ 
+ %Check on any warning messages that might indicate that the paths were not correct. 
+ if ~isempty(lastwarn),
Index: issm/oecreview/Archive/16554-17801/ISSM-17234-17235.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17234-17235.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17234-17235.diff	(revision 17802)
@@ -0,0 +1,23 @@
+Index: ../trunk-jpl/src/c/classes/Elements/SegRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/SegRef.cpp	(revision 17234)
++++ ../trunk-jpl/src/c/classes/Elements/SegRef.cpp	(revision 17235)
+@@ -91,6 +91,9 @@
+ 	_assert_(basis);
+ 
+ 	switch(element_type){
++		case P0Enum:
++			basis[0]=1.;
++			return;
+ 		case P1Enum: case P1DGEnum:
+ 			basis[0]=(1.-gauss->coord1)/2.;
+ 			basis[1]=(1.+gauss->coord1)/2.;
+@@ -270,7 +273,7 @@
+ int SegRef::NumberofNodes(int finiteelement){
+ 
+ 	switch(finiteelement){
+-		case P0Enum:                return NUMNODESP1;
++		case P0Enum:                return NUMNODESP0;
+ 		case P1Enum:                return NUMNODESP1;
+ 		case P1DGEnum:              return NUMNODESP1;
+ 		default: _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
Index: issm/oecreview/Archive/16554-17801/ISSM-17235-17236.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17235-17236.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17235-17236.diff	(revision 17802)
@@ -0,0 +1,3053 @@
+Index: ../trunk-jpl/m4/issm_options.m4
+===================================================================
+--- ../trunk-jpl/m4/issm_options.m4	(revision 17235)
++++ ../trunk-jpl/m4/issm_options.m4	(revision 17236)
+@@ -1558,11 +1558,10 @@
+ 		[KML=$withval],[KML=yes]) 
+ 	AC_MSG_CHECKING(for kml capability compilation)
+ 
++	HAVE_KML=no
+ 	if test "x$KML" = "xyes"; then
+ 		HAVE_KML=yes
+ 		AC_DEFINE([_HAVE_KML_],[1],[with kml capability])
+-	else
+-		HAVE_KML=no
+ 	fi
+ 	AM_CONDITIONAL([KML], [test x$HAVE_KML = xyes])
+ 	AC_MSG_RESULT($HAVE_KML)
+@@ -1573,122 +1572,129 @@
+ 		[KRIGING=$withval],[KRIGING=yes]) 
+ 	AC_MSG_CHECKING(for kriging capability compilation)
+ 
++	HAVE_KRIGING=no
+ 	if test "x$KRIGING" = "xyes"; then
+ 		HAVE_KRIGING=yes
+ 		AC_DEFINE([_HAVE_KRIGING_],[1],[with kriging capability])
+-	else
+-		HAVE_KRIGING=no
+ 	fi
+ 	AM_CONDITIONAL([KRIGING], [test x$HAVE_KRIGING = xyes])
+ 	AC_MSG_RESULT($HAVE_KRIGING)
+ 	dnl }}}
+-	dnl with-steadystate{{{
+-	AC_ARG_WITH([steadystate],
+-		AS_HELP_STRING([--with-steadystate = YES],[compile with steadystate capabilities (default is yes)]),
+-		[STEADYSTATE=$withval],[STEADYSTATE=yes]) 
+-	AC_MSG_CHECKING(for steadystate capability compilation)
++	dnl with-gia{{{
++		AC_ARG_WITH([gia],
++		AS_HELP_STRING([--with-gia = YES], [compile with gia capabilities (default is no)]),
++		[GIA=$withval],[GIA=no]) 
++	   AC_MSG_CHECKING(for gia capability compilation)
+ 
+-	if test "x$STEADYSTATE" = "xyes"; then
++		HAVE_GIA=no
++		if test "x$GIA" = "xyes"; then
++			if test "x$HAVE_MATH77" = "xno"; then
++				 AC_MSG_ERROR([gia requires compilation of math77 library! Reconfigure with --with-math77 option on]);
++			else
++				HAVE_GIA=yes
++				AC_DEFINE([_HAVE_GIA_],[1],[with gia capability])
++		   fi
++		fi
++		AM_CONDITIONAL([GIA], [test x$HAVE_GIA = xyes])
++		AC_MSG_RESULT($HAVE_GIA)
++		dnl }}}
++	dnl with-AdjointBalancethickness{{{
++	AC_ARG_WITH([AdjointBalancethickness],
++		AS_HELP_STRING([--with-AdjointBalancethickness = YES], [compile with AdjointBalancethickness capabilities (default is yes)]),
++		[ADJOINTBALANCETHICKNESS=$withval],[ADJOINTBALANCETHICKNESS=yes]) 
++	AC_MSG_CHECKING(for AdjointBalancethickness capability compilation)
+ 
+-		dnl defaults
+-		HAVE_STEADYSTATE=yes
++	HAVE_ADJOINTBALANCETHICKNESS=no
++	if test "x$ADJOINTBALANCETHICKNESS" = "xyes"; then
++		HAVE_ADJOINTBALANCETHICKNESS=yes
++		AC_DEFINE([_HAVE_ADJOINTBALANCETHICKNESS_],[1],[with AdjointBalancethickness capability])
++	fi
++	AM_CONDITIONAL([ADJOINTBALANCETHICKNESS], [test x$HAVE_ADJOINTBALANCETHICKNESS = xyes])
++	AC_MSG_RESULT($HAVE_ADJOINTBALANCETHICKNESS)
++	dnl }}}
++	dnl with-AdjointHoriz{{{
++	AC_ARG_WITH([AdjointHoriz],
++		AS_HELP_STRING([--with-AdjointHoriz = YES], [compile with AdjointHoriz capabilities (default is yes)]),
++		[ADJOINTHORIZ=$withval],[ADJOINTHORIZ=yes]) 
++	AC_MSG_CHECKING(for AdjointHoriz capability compilation)
+ 
+-		AC_DEFINE([_HAVE_STEADYSTATE_],[1],[with steadystate capability])
+-	else
+-		HAVE_STEADYSTATE=no
++	HAVE_ADJOINTHORIZ=no
++	if test "x$ADJOINTHORIZ" = "xyes"; then
++		HAVE_ADJOINTHORIZ=yes
++		AC_DEFINE([_HAVE_ADJOINTHORIZ_],[1],[with AdjointHoriz capability])
+ 	fi
+-	AM_CONDITIONAL([STEADYSTATE], [test x$HAVE_STEADYSTATE = xyes])
+-	AC_MSG_RESULT($HAVE_STEADYSTATE)
++	AM_CONDITIONAL([ADJOINTHORIZ], [test x$HAVE_ADJOINTHORIZ = xyes])
++	AC_MSG_RESULT($HAVE_ADJOINTHORIZ)
+ 	dnl }}}
+-	dnl with-transient{{{
+-	AC_ARG_WITH([transient],
+-		AS_HELP_STRING([--with-transient = YES], [compile with transient capabilities (default is yes)]),
+-		[TRANSIENT=$withval],[TRANSIENT=yes]) 
+-	AC_MSG_CHECKING(for transient capability compilation)
++	dnl with-Balancethickness{{{
++	AC_ARG_WITH([Balancethickness],
++		AS_HELP_STRING([--with-Balancethickness = YES], [compile with Balancethickness capabilities (default is yes)]),
++		[BALANCETHICKNESS=$withval],[BALANCETHICKNESS=yes]) 
++	AC_MSG_CHECKING(for Balancethickness capability compilation)
+ 
+-	if test "x$TRANSIENT" = "xyes"; then
+-
+-		dnl defaults
+-		HAVE_TRANSIENT=yes
+-
+-		AC_DEFINE([_HAVE_TRANSIENT_],[1],[with transient capability])
+-	else
+-		HAVE_TRANSIENT=no
++	HAVE_BALANCETHICKNESS=no
++	if test "x$BALANCETHICKNESS" = "xyes"; then
++		HAVE_BALANCETHICKNESS=yes
++		AC_DEFINE([_HAVE_BALANCETHICKNESS_],[1],[with Balancethickness capability])
+ 	fi
+-	AM_CONDITIONAL([TRANSIENT], [test x$HAVE_TRANSIENT = xyes])
+-	AC_MSG_RESULT($HAVE_TRANSIENT)
++	AM_CONDITIONAL([BALANCETHICKNESS], [test x$HAVE_BALANCETHICKNESS = xyes])
++	AC_MSG_RESULT($HAVE_BALANCETHICKNESS)
+ 	dnl }}}
+-	dnl with-thermal{{{
+-	AC_ARG_WITH([thermal],
+-		AS_HELP_STRING([--with-thermal = YES], [compile with thermal capabilities (default is yes)]),
+-		[THERMAL=$withval],[THERMAL=yes]) 
+-	AC_MSG_CHECKING(for thermal capability compilation)
++	dnl with-BalancethicknessSoft{{{
++	AC_ARG_WITH([BalancethicknessSoft],
++		AS_HELP_STRING([--with-BalancethicknessSoft = YES], [compile with BalancethicknessSoft capabilities (default is yes)]),
++		[BALANCETHICKNESSSOFT=$withval],[BALANCETHICKNESSSOFT=yes]) 
++	AC_MSG_CHECKING(for BalancethicknessSoft capability compilation)
+ 
+-	if test "x$THERMAL" = "xyes"; then
+-
+-		dnl defaults
+-		HAVE_THERMAL=yes
+-
+-		AC_DEFINE([_HAVE_THERMAL_],[1],[with thermal capability])
+-	else
+-		HAVE_THERMAL=no
++	HAVE_BALANCETHICKNESSSOFT=no
++	if test "x$BALANCETHICKNESSSOFT" = "xyes"; then
++		HAVE_BALANCETHICKNESSSOFT=yes
++		AC_DEFINE([_HAVE_BALANCETHICKNESSSOFT_],[1],[with BalancethicknessSoft capability])
+ 	fi
+-	AM_CONDITIONAL([THERMAL], [test x$HAVE_THERMAL = xyes])
+-	AC_MSG_RESULT($HAVE_THERMAL)
++	AM_CONDITIONAL([BALANCETHICKNESSSOFT], [test x$HAVE_BALANCETHICKNESSSOFT = xyes])
++	AC_MSG_RESULT($HAVE_BALANCETHICKNESSSOFT)
+ 	dnl }}}
+-	dnl with-masstransport{{{
+-	AC_ARG_WITH([masstransport],
+-		AS_HELP_STRING([--with-masstransport = YES], [compile with masstransport capabilities (default is yes)]),
+-		[MASSTRANSPORT=$withval],[MASSTRANSPORT=yes]) 
+-	AC_MSG_CHECKING(for masstransport capability compilation)
++	dnl with-Balancevelocity{{{
++	AC_ARG_WITH([Balancevelocity],
++		AS_HELP_STRING([--with-Balancevelocity = YES], [compile with Balancevelocity capabilities (default is yes)]),
++		[BALANCEVELOCITY=$withval],[BALANCEVELOCITY=yes]) 
++	AC_MSG_CHECKING(for Balancevelocity capability compilation)
+ 
+-	if test "x$MASSTRANSPORT" = "xyes"; then
+-
+-		dnl defaults
+-		HAVE_MASSTRANSPORT=yes
+-
+-		AC_DEFINE([_HAVE_MASSTRANSPORT_],[1],[with masstransport capability])
+-	else
+-		HAVE_MASSTRANSPORT=no
++	HAVE_BALANCEVELOCITY=no
++	if test "x$BALANCEVELOCITY" = "xyes"; then
++		HAVE_BALANCEVELOCITY=yes
++		AC_DEFINE([_HAVE_BALANCEVELOCITY_],[1],[with Balancevelocity capability])
+ 	fi
+-	AM_CONDITIONAL([MASSTRANSPORT], [test x$HAVE_MASSTRANSPORT = xyes])
+-	AC_MSG_RESULT($HAVE_MASSTRANSPORT)
++	AM_CONDITIONAL([BALANCEVELOCITY], [test x$HAVE_BALANCEVELOCITY = xyes])
++	AC_MSG_RESULT($HAVE_BALANCEVELOCITY)
+ 	dnl }}}
+-	dnl with-control{{{
+-	AC_ARG_WITH([control],
+-		AS_HELP_STRING([--with-control = YES], [compile with control capabilities (default is yes)]),
+-		[CONTROL=$withval],[CONTROL=yes]) 
+-	AC_MSG_CHECKING(for control capability compilation)
++	dnl with-L2ProjectionBase{{{
++	AC_ARG_WITH([L2ProjectionBase],
++		AS_HELP_STRING([--with-L2ProjectionBase = YES], [compile with L2ProjectionBase capabilities (default is yes)]),
++		[L2PROJECTIONBASE=$withval],[L2PROJECTIONBASE=yes]) 
++	AC_MSG_CHECKING(for L2ProjectionBase capability compilation)
+ 
+-	if test "x$CONTROL" = "xyes"; then
+-
+-		dnl defaults
+-		HAVE_CONTROL=yes
+-
+-		AC_DEFINE([_HAVE_CONTROL_],[1],[with control capability])
+-	else
+-		HAVE_CONTROL=no
++	HAVE_L2PROJECTIONBASE=no
++	if test "x$L2PROJECTIONBASE" = "xyes"; then
++		HAVE_L2PROJECTIONBASE=yes
++		AC_DEFINE([_HAVE_L2PROJECTIONBASE_],[1],[with L2ProjectionBase capability])
+ 	fi
+-	AM_CONDITIONAL([CONTROL], [test x$HAVE_CONTROL = xyes])
+-	AC_MSG_RESULT($HAVE_CONTROL)
++	AM_CONDITIONAL([L2PROJECTIONBASE], [test x$HAVE_L2PROJECTIONBASE = xyes])
++	AC_MSG_RESULT($HAVE_L2PROJECTIONBASE)
+ 	dnl }}}
+-	dnl with-hydrology{{{
+-	AC_ARG_WITH([hydrology],
+-		AS_HELP_STRING([--with-hydrology = YES], [compile with hydrology capabilities (default is yes)]),
+-		[HYDROLOGY=$withval],[HYDROLOGY=yes]) 
+-	AC_MSG_CHECKING(for hydrology capability compilation)
++	dnl with-DamageEvolution{{{
++	AC_ARG_WITH([DamageEvolution],
++		AS_HELP_STRING([--with-DamageEvolution = YES], [compile with DamageEvolution capabilities (default is yes)]),
++		[DAMAGEEVOLUTION=$withval],[DAMAGEEVOLUTION=yes]) 
++	AC_MSG_CHECKING(for DamageEvolution capability compilation)
+ 
+-	if test "x$HYDROLOGY" = "xyes"; then
+-
+-		dnl defaults
+-		HAVE_HYDROLOGY=yes
+-
+-		AC_DEFINE([_HAVE_HYDROLOGY_],[1],[with hydrology capability])
+-	else
+-		HAVE_HYDROLOGY=no
++	HAVE_DAMAGEEVOLUTION=no
++	if test "x$DAMAGEEVOLUTION" = "xyes"; then
++		HAVE_DAMAGEEVOLUTION=yes
++		AC_DEFINE([_HAVE_DAMAGEEVOLUTION_],[1],[with DamageEvolution capability])
+ 	fi
+-	AM_CONDITIONAL([HYDROLOGY], [test x$HAVE_HYDROLOGY = xyes])
+-	AC_MSG_RESULT($HAVE_HYDROLOGY)
++	AM_CONDITIONAL([DAMAGEEVOLUTION], [test x$HAVE_DAMAGEEVOLUTION = xyes])
++	AC_MSG_RESULT($HAVE_DAMAGEEVOLUTION)
+ 	dnl }}}
+ 	dnl with-stressbalance{{{
+ 	AC_ARG_WITH([stressbalance],
+@@ -1696,167 +1702,240 @@
+ 		[STRESSBALANCE=$withval],[STRESSBALANCE=yes]) 
+ 	AC_MSG_CHECKING(for stressbalance capability compilation)
+ 
++	HAVE_STRESSBALANCE=no
+ 	if test "x$STRESSBALANCE" = "xyes"; then
+-
+-		dnl defaults
+ 		HAVE_STRESSBALANCE=yes
+-
+ 		AC_DEFINE([_HAVE_STRESSBALANCE_],[1],[with stressbalance capability])
+-	else
+-		HAVE_STRESSBALANCE=no
+ 	fi
+ 	AM_CONDITIONAL([STRESSBALANCE], [test x$HAVE_STRESSBALANCE = xyes])
+ 	AC_MSG_RESULT($HAVE_STRESSBALANCE)
+ 	dnl }}}
+-	dnl with-balanced{{{
+-	AC_ARG_WITH([balanced],
+-		AS_HELP_STRING([--with-balanced = YES], [compile with balanced capabilities (default is yes)]),
+-		[BALANCED=$withval],[BALANCED=yes]) 
+-	AC_MSG_CHECKING(for balanced capability compilation)
++	dnl with-stressbalanceSIA{{{
++		AC_ARG_WITH([stressbalanceSIA],
++					AS_HELP_STRING([--with-stressbalanceSIA = YES], [compile with stressbalanceSIA capabilities (default is yes)]),
++					[STRESSBALANCESIA=$withval],[STRESSBALANCESIA=yes]) 
++		  AC_MSG_CHECKING(for stressbalanceSIA capability compilation)
+ 
+-	if test "x$BALANCED" = "xyes"; then
++		  HAVE_STRESSBALANCESIA=no
++		  if test "x$STRESSBALANCESIA" = "xyes"; then
++			HAVE_STRESSBALANCESIA=yes
++			  AC_DEFINE([_HAVE_STRESSBALANCESIA_],[1],[with stressbalanceSIA capability])
++			  fi
++			  AM_CONDITIONAL([STRESSBALANCESIA], [test x$HAVE_STRESSBALANCESIA = xyes])
++			  AC_MSG_RESULT($HAVE_STRESSBALANCESIA)
++			  dnl }}}
++	dnl with-StressbalanceVertical{{{
++	AC_ARG_WITH([StressbalanceVertical],
++		AS_HELP_STRING([--with-StressbalanceVertical = YES], [compile with StressbalanceVertical capabilities (default is yes)]),
++		[STRESSBALANCEVERTICAL=$withval],[STRESSBALANCEVERTICAL=yes]) 
++	AC_MSG_CHECKING(for StressbalanceVertical capability compilation)
+ 
+-		dnl defaults
+-		HAVE_BALANCED=yes
++	HAVE_STRESSBALANCEVERTICAL=no
++	if test "x$STRESSBALANCEVERTICAL" = "xyes"; then
++		HAVE_STRESSBALANCEVERTICAL=yes
++		AC_DEFINE([_HAVE_STRESSBALANCEVERTICAL_],[1],[with StressbalanceVertical capability])
++	fi
++	AM_CONDITIONAL([STRESSBALANCEVERTICAL], [test x$HAVE_STRESSBALANCEVERTICAL = xyes])
++	AC_MSG_RESULT($HAVE_STRESSBALANCEVERTICAL)
++	dnl }}}
++	dnl with-Enthalpy{{{
++	AC_ARG_WITH([Enthalpy],
++		AS_HELP_STRING([--with-Enthalpy = YES], [compile with Enthalpy capabilities (default is yes)]),
++		[ENTHALPY=$withval],[ENTHALPY=yes]) 
++	AC_MSG_CHECKING(for Enthalpy capability compilation)
+ 
+-		AC_DEFINE([_HAVE_BALANCED_],[1],[with balanced capability])
+-	else
+-		HAVE_BALANCED=no
++	HAVE_ENTHALPY=no
++	if test "x$ENTHALPY" = "xyes"; then
++		HAVE_ENTHALPY=yes
++		AC_DEFINE([_HAVE_ENTHALPY_],[1],[with Enthalpy capability])
+ 	fi
+-	AM_CONDITIONAL([BALANCED], [test x$HAVE_BALANCED = xyes])
+-	AC_MSG_RESULT($HAVE_BALANCED)
++	AM_CONDITIONAL([ENTHALPY], [test x$HAVE_ENTHALPY = xyes])
++	AC_MSG_RESULT($HAVE_ENTHALPY)
+ 	dnl }}}
+-	dnl with-damage{{{
+-	AC_ARG_WITH([damage],
+-		AS_HELP_STRING([--with-damage = YES], [compile with damage capabilities (default is yes)]),
+-		[DAMAGE=$withval],[DAMAGE=yes]) 
+-	AC_MSG_CHECKING(for damage capability compilation)
++	dnl with-HydrologyShreve{{{
++	AC_ARG_WITH([HydrologyShreve],
++		AS_HELP_STRING([--with-HydrologyShreve = YES], [compile with HydrologyShreve capabilities (default is yes)]),
++		[HYDROLOGYSHREVE=$withval],[HYDROLOGYSHREVE=yes]) 
++	AC_MSG_CHECKING(for HydrologyShreve capability compilation)
+ 
+-	if test "x$DAMAGE" = "xyes"; then
++	HAVE_HYDROLOGYSHREVE=no
++	if test "x$HYDROLOGYSHREVE" = "xyes"; then
++		HAVE_HYDROLOGYSHREVE=yes
++		AC_DEFINE([_HAVE_HYDROLOGYSHREVE_],[1],[with HydrologyShreve capability])
++	fi
++	AM_CONDITIONAL([HYDROLOGYSHREVE], [test x$HAVE_HYDROLOGYSHREVE = xyes])
++	AC_MSG_RESULT($HAVE_HYDROLOGYSHREVE)
++	dnl }}}
++	dnl with-HydrologyDCInefficient{{{
++	AC_ARG_WITH([HydrologyDCInefficient],
++		AS_HELP_STRING([--with-HydrologyDCInefficient = YES], [compile with HydrologyDCInefficient capabilities (default is yes)]),
++		[HYDROLOGYDCINEFFICIENT=$withval],[HYDROLOGYDCINEFFICIENT=yes]) 
++	AC_MSG_CHECKING(for HydrologyDCInefficient capability compilation)
+ 
+-		dnl defaults
+-		HAVE_DAMAGE=yes
++	HAVE_HYDROLOGYDCINEFFICIENT=no
++	if test "x$HYDROLOGYDCINEFFICIENT" = "xyes"; then
++		HAVE_HYDROLOGYDCINEFFICIENT=yes
++		AC_DEFINE([_HAVE_HYDROLOGYDCINEFFICIENT_],[1],[with HydrologyDCInefficient capability])
++	fi
++	AM_CONDITIONAL([HYDROLOGYDCINEFFICIENT], [test x$HAVE_HYDROLOGYDCINEFFICIENT = xyes])
++	AC_MSG_RESULT($HAVE_HYDROLOGYDCINEFFICIENT)
++	dnl }}}
++	dnl with-HydrologyDCEfficient{{{
++	AC_ARG_WITH([HydrologyDCEfficient],
++		AS_HELP_STRING([--with-HydrologyDCEfficient = YES], [compile with HydrologyDCEfficient capabilities (default is yes)]),
++		[HYDROLOGYDCEFFICIENT=$withval],[HYDROLOGYDCEFFICIENT=yes]) 
++	AC_MSG_CHECKING(for HydrologyDCEfficient capability compilation)
+ 
+-		AC_DEFINE([_HAVE_DAMAGE_],[1],[with damage capability])
+-	else
+-		HAVE_DAMAGE=no
++	HAVE_HYDROLOGYDCEFFICIENT=no
++	if test "x$HYDROLOGYDCEFFICIENT" = "xyes"; then
++		HAVE_HYDROLOGYDCEFFICIENT=yes
++		AC_DEFINE([_HAVE_HYDROLOGYDCEFFICIENT_],[1],[with HydrologyDCEfficient capability])
+ 	fi
+-	AM_CONDITIONAL([DAMAGE], [test x$HAVE_DAMAGE = xyes])
+-	AC_MSG_RESULT($HAVE_DAMAGE)
++	AM_CONDITIONAL([HYDROLOGYDCEFFICIENT], [test x$HAVE_HYDROLOGYDCEFFICIENT = xyes])
++	AC_MSG_RESULT($HAVE_HYDROLOGYDCEFFICIENT)
+ 	dnl }}}
+-	dnl with-responses{{{
+-	AC_ARG_WITH([responses],
+-		AS_HELP_STRING([--with-responses = YES], [compile with responses capabilities (default is yes)]),
+-		[RESPONSES=$withval],[RESPONSES=yes]) 
+-	AC_MSG_CHECKING(for responses capability compilation)
++	dnl with-Melting{{{
++	AC_ARG_WITH([Melting],
++		AS_HELP_STRING([--with-Melting = YES], [compile with Melting capabilities (default is yes)]),
++		[MELTING=$withval],[MELTING=yes]) 
++	AC_MSG_CHECKING(for Melting capability compilation)
+ 
+-	if test "x$RESPONSES" = "xyes"; then
++	HAVE_MELTING=no
++	if test "x$MELTING" = "xyes"; then
++		HAVE_MELTING=yes
++		AC_DEFINE([_HAVE_MELTING_],[1],[with Melting capability])
++	fi
++	AM_CONDITIONAL([MELTING], [test x$HAVE_MELTING = xyes])
++	AC_MSG_RESULT($HAVE_MELTING)
++	dnl }}}
++	dnl with-Masstransport{{{
++	AC_ARG_WITH([Masstransport],
++		AS_HELP_STRING([--with-Masstransport = YES], [compile with Masstransport capabilities (default is yes)]),
++		[MASSTRANSPORT=$withval],[MASSTRANSPORT=yes]) 
++	AC_MSG_CHECKING(for Masstransport capability compilation)
+ 
+-		dnl defaults
+-		HAVE_RESPONSES=yes
++	HAVE_MASSTRANSPORT=no
++	if test "x$MASSTRANSPORT" = "xyes"; then
++		HAVE_MASSTRANSPORT=yes
++		AC_DEFINE([_HAVE_MASSTRANSPORT_],[1],[with Masstransport capability])
++	fi
++	AM_CONDITIONAL([MASSTRANSPORT], [test x$HAVE_MASSTRANSPORT = xyes])
++	AC_MSG_RESULT($HAVE_MASSTRANSPORT)
++	dnl }}}
++	dnl with-FreeSurfaceBase{{{
++	AC_ARG_WITH([FreeSurfaceBase],
++		AS_HELP_STRING([--with-FreeSurfaceBase = YES], [compile with FreeSurfaceBase capabilities (default is yes)]),
++		[FREESURFACEBASE=$withval],[FREESURFACEBASE=yes]) 
++	AC_MSG_CHECKING(for FreeSurfaceBase capability compilation)
+ 
+-		AC_DEFINE([_HAVE_RESPONSES_],[1],[with responses capability])
+-	else
+-		HAVE_RESPONSES=no
++	HAVE_FREESURFACEBASE=no
++	if test "x$FREESURFACEBASE" = "xyes"; then
++		HAVE_FREESURFACEBASE=yes
++		AC_DEFINE([_HAVE_FREESURFACEBASE_],[1],[with FreeSurfaceBase capability])
+ 	fi
+-	AM_CONDITIONAL([RESPONSES], [test x$HAVE_RESPONSES = xyes])
+-	AC_MSG_RESULT($HAVE_RESPONSES)
++	AM_CONDITIONAL([FREESURFACEBASE], [test x$HAVE_FREESURFACEBASE = xyes])
++	AC_MSG_RESULT($HAVE_FREESURFACEBASE)
+ 	dnl }}}
+-	dnl with-slope{{{
+-	AC_ARG_WITH([slope],
+-		AS_HELP_STRING([--with-slope = YES], [compile with slope capabilities (default is yes)]),
+-		[SLOPE=$withval],[SLOPE=yes]) 
+-	AC_MSG_CHECKING(for slope capability compilation)
++	dnl with-FreeSurfaceTop{{{
++		AC_ARG_WITH([FreeSurfaceTop],
++					AS_HELP_STRING([--with-FreeSurfaceTop = YES], [compile with FreeSurfaceTop capabilities (default is yes)]),
++					[FREESURFACETOP=$withval],[FREESURFACETOP=yes]) 
++		  AC_MSG_CHECKING(for FreeSurfaceTop capability compilation)
+ 
+-	if test "x$SLOPE" = "xyes"; then
++		  HAVE_FREESURFACETOP=no
++		  if test "x$FREESURFACETOP" = "xyes"; then
++			HAVE_FREESURFACETOP=yes
++			  AC_DEFINE([_HAVE_FREESURFACETOP_],[1],[with FreeSurfaceTop capability])
++			  fi
++			  AM_CONDITIONAL([FREESURFACETOP], [test x$HAVE_FREESURFACETOP = xyes])
++			  AC_MSG_RESULT($HAVE_FREESURFACETOP)
++			  dnl }}}
++	dnl with-ExtrudeFromBase{{{
++	AC_ARG_WITH([ExtrudeFromBase],
++		AS_HELP_STRING([--with-ExtrudeFromBase = YES], [compile with ExtrudeFromBase capabilities (default is yes)]),
++		[EXTRUDEFROMBASE=$withval],[EXTRUDEFROMBASE=yes]) 
++	AC_MSG_CHECKING(for ExtrudeFromBase capability compilation)
+ 
+-		dnl defaults
+-		HAVE_SLOPE=yes
+-
+-		AC_DEFINE([_HAVE_SLOPE_],[1],[with slope capability])
+-	else
+-		HAVE_SLOPE=no
++	HAVE_EXTRUDEFROMBASE=no
++	if test "x$EXTRUDEFROMBASE" = "xyes"; then
++		HAVE_EXTRUDEFROMBASE=yes
++		AC_DEFINE([_HAVE_EXTRUDEFROMBASE_],[1],[with ExtrudeFromBase capability])
+ 	fi
+-	AM_CONDITIONAL([SLOPE], [test x$HAVE_SLOPE = xyes])
+-	AC_MSG_RESULT($HAVE_SLOPE)
++	AM_CONDITIONAL([EXTRUDEFROMBASE], [test x$HAVE_EXTRUDEFROMBASE = xyes])
++	AC_MSG_RESULT($HAVE_EXTRUDEFROMBASE)
+ 	dnl }}}
+-	dnl with-meshdeformation{{{
+-		AC_ARG_WITH([meshdeformation],
+-					AS_HELP_STRING([--with-meshdeformation = YES], [compile with meshdeformation capabilities (default is yes)]),
+-					[MESHDEFORMATION=$withval],[MESHDEFORMATION=yes]) 
+-		  AC_MSG_CHECKING(for meshdeformation capability compilation)
++	dnl with-ExtrudeFromTop{{{
++		AC_ARG_WITH([ExtrudeFromTop],
++					AS_HELP_STRING([--with-ExtrudeFromTop = YES], [compile with ExtrudeFromTop capabilities (default is yes)]),
++					[EXTRUDEFROMTOP=$withval],[EXTRUDEFROMTOP=yes]) 
++		  AC_MSG_CHECKING(for ExtrudeFromTop capability compilation)
+ 
+-		  if test "x$MESHDEFORMATION" = "xyes"; then
++		  HAVE_EXTRUDEFROMTOP=no
++		  if test "x$EXTRUDEFROMTOP" = "xyes"; then
++			HAVE_EXTRUDEFROMTOP=yes
++			  AC_DEFINE([_HAVE_EXTRUDEFROMTOP_],[1],[with ExtrudeFromTop capability])
++			  fi
++			  AM_CONDITIONAL([EXTRUDEFROMTOP], [test x$HAVE_EXTRUDEFROMTOP = xyes])
++			  AC_MSG_RESULT($HAVE_EXTRUDEFROMTOP)
++			  dnl }}}
++	dnl with-Thermal{{{
++	AC_ARG_WITH([Thermal],
++		AS_HELP_STRING([--with-Thermal = YES], [compile with Thermal capabilities (default is yes)]),
++		[THERMAL=$withval],[THERMAL=yes]) 
++	AC_MSG_CHECKING(for Thermal capability compilation)
+ 
+-			dnl defaults
+-			  HAVE_MESHDEFORMATION=yes
++	HAVE_THERMAL=no
++	if test "x$THERMAL" = "xyes"; then
++		HAVE_THERMAL=yes
++		AC_DEFINE([_HAVE_THERMAL_],[1],[with Thermal capability])
++	fi
++	AM_CONDITIONAL([THERMAL], [test x$HAVE_THERMAL = xyes])
++	AC_MSG_RESULT($HAVE_THERMAL)
++	dnl }}}
++	dnl with-Meshdeformation{{{
++	AC_ARG_WITH([Meshdeformation],
++		AS_HELP_STRING([--with-Meshdeformation = YES], [compile with Meshdeformation capabilities (default is yes)]),
++		[MESHDEFORMATION=$withval],[MESHDEFORMATION=yes]) 
++	AC_MSG_CHECKING(for Meshdeformation capability compilation)
+ 
+-			  AC_DEFINE([_HAVE_MESHDEFORMATION_],[1],[with meshdeformation capability])
+-		  else
+-				HAVE_MESHDEFORMATION=no
+-		  fi
+-	  AM_CONDITIONAL([MESHDEFORMATION], [test x$HAVE_MESHDEFORMATION = xyes])
+-	  AC_MSG_RESULT($HAVE_MESHDEFORMATION)
+-	  dnl }}}
+-	dnl with-groundingline{{{
+-	AC_ARG_WITH([groundingline],
+-		AS_HELP_STRING([--with-groundingline = YES], [compile with groundingline capabilities (default is yes)]),
+-		[GROUNDINGLINE=$withval],[GROUNDINGLINE=yes]) 
+-	AC_MSG_CHECKING(for groundingline capability compilation)
+-
+-	if test "x$GROUNDINGLINE" = "xyes"; then
+-
+-		dnl defaults
+-		HAVE_GROUNDINGLINE=yes
+-
+-		AC_DEFINE([_HAVE_GROUNDINGLINE_],[1],[with groundingline capability])
+-	else
+-		HAVE_GROUNDINGLINE=no
++	HAVE_MESHDEFORMATION=no
++	if test "x$MESHDEFORMATION" = "xyes"; then
++		HAVE_MESHDEFORMATION=yes
++		AC_DEFINE([_HAVE_MESHDEFORMATION_],[1],[with Meshdeformation capability])
+ 	fi
+-	AM_CONDITIONAL([GROUNDINGLINE], [test x$HAVE_GROUNDINGLINE = xyes])
+-	AC_MSG_RESULT($HAVE_GROUNDINGLINE)
++	AM_CONDITIONAL([MESHDEFORMATION], [test x$HAVE_MESHDEFORMATION = xyes])
++	AC_MSG_RESULT($HAVE_MESHDEFORMATION)
+ 	dnl }}}
+-	dnl with-rifts{{{
+-	AC_ARG_WITH([rifts],
+-		AS_HELP_STRING([--with-rifts = YES], [compile with rifts capabilities (default is yes)]),
+-		[RIFTS=$withval],[RIFTS=yes]) 
+-	AC_MSG_CHECKING(for rifts capability compilation)
++	dnl with-Levelset{{{
++	AC_ARG_WITH([Levelset],
++		AS_HELP_STRING([--with-Levelset = YES], [compile with Levelset capabilities (default is yes)]),
++		[LEVELSET=$withval],[LEVELSET=yes]) 
++	AC_MSG_CHECKING(for Levelset capability compilation)
+ 
+-	if test "x$RIFTS" = "xyes"; then
+-
+-		dnl defaults
+-		HAVE_RIFTS=yes
+-
+-		AC_DEFINE([_HAVE_RIFTS_],[1],[with rifts capability])
+-	else
+-		HAVE_RIFTS=no
++	HAVE_LEVELSET=no
++	if test "x$LEVELSET" = "xyes"; then
++		HAVE_LEVELSET=yes
++		AC_DEFINE([_HAVE_LEVELSET_],[1],[with Levelset capability])
+ 	fi
+-	AM_CONDITIONAL([RIFTS], [test x$HAVE_RIFTS = xyes])
+-	AC_MSG_RESULT($HAVE_RIFTS)
++	AM_CONDITIONAL([LEVELSET], [test x$HAVE_LEVELSET = xyes])
++	AC_MSG_RESULT($HAVE_LEVELSET)
+ 	dnl }}}
+-	dnl with-gia{{{
+-	AC_ARG_WITH([gia],
+-		AS_HELP_STRING([--with-gia = YES], [compile with gia capabilities (default is yes)]),
+-		[GIA=$withval],[GIA=no]) 
+-	AC_MSG_CHECKING(for gia capability compilation)
++	dnl with-Extrapolation{{{
++	AC_ARG_WITH([Extrapolation],
++		AS_HELP_STRING([--with-Extrapolation = YES], [compile with Extrapolation capabilities (default is yes)]),
++		[EXTRAPOLATION=$withval],[EXTRAPOLATION=yes]) 
++	AC_MSG_CHECKING(for Extrapolation capability compilation)
+ 
+-	if test "x$GIA" = "xyes"; then
+-	  
+-	  if test "x$HAVE_MATH77" = "xno"; then
+-		  HAVE_GIA=no
+-		  AC_MSG_ERROR([gia requires compilation of math77 library! Reconfigure with --with-math77 option on]);
+-	  else
+-		dnl defaults
+-		HAVE_GIA=yes
+-		AC_DEFINE([_HAVE_GIA_],[1],[with gia capability])
+-	  fi
+-
+-	else
+-		HAVE_GIA=no
++	HAVE_EXTRAPOLATION=no
++	if test "x$EXTRAPOLATION" = "xyes"; then
++		HAVE_EXTRAPOLATION=yes
++		AC_DEFINE([_HAVE_EXTRAPOLATION_],[1],[with Extrapolation capability])
+ 	fi
+-	AM_CONDITIONAL([GIA], [test x$HAVE_GIA = xyes])
+-	AC_MSG_RESULT($HAVE_GIA)
++	AM_CONDITIONAL([EXTRAPOLATION], [test x$HAVE_EXTRAPOLATION = xyes])
++	AC_MSG_RESULT($HAVE_EXTRAPOLATION)
+ 	dnl }}}
++
++	dnl Platform specifics
+ 	dnl with-ios{{{
+ 	AC_ARG_WITH([ios],
+ 		AS_HELP_STRING([--with-ios = YES], [compile with iOS capabilities (default is no, alternatives are yes)]),
+@@ -1921,25 +2000,7 @@
+ 	fi
+ 	AC_MSG_RESULT($HAVE_ANDROID_NDK)
+ 	dnl }}}
+-	dnl with-3d{{{
+-	AC_ARG_WITH([3d],
+-		AS_HELP_STRING([--with-3d = YES], [compile with 3d capabilities (default is yes)]),
+-		[THREED=$withval],[THREED=yes]) 
+-	AC_MSG_CHECKING(for 3d capability compilation)
+ 
+-	if test "x$THREED" = "xyes"; then
+-
+-		dnl defaults
+-		HAVE_3D=yes
+-
+-		AC_DEFINE([_HAVE_3D_],[1],[with 3d capability])
+-	else
+-		HAVE_3D=no
+-	fi
+-	AM_CONDITIONAL([THREED], [test x$HAVE_3D = xyes])
+-	AC_MSG_RESULT($HAVE_3D)
+-	dnl }}}
+-
+ 	dnl other options
+ 	dnl optimization{{{
+ 	dnl bypass standard optimization -g -O2 ? 
+@@ -1999,39 +2060,34 @@
+ 
+ 		  dnl check that if petsc is requested , mpi should be specified
+ 		  if test "$HAVE_PETSC" = "yes" ; then
+-			if test "$HAVE_MPI" = "NO";  then
+-			 AC_MSG_ERROR([petsc requires mpi!]);
+-		fi
++				if test "$HAVE_MPI" = "NO";  then
++					 AC_MSG_ERROR([petsc requires mpi!]);
++				fi
+ 		  fi
+ 
+ 		  dnl check that we have either python or matlab support if we compile the modules
+ 		  if test "$MODULES_VALUE" = "yes"  && test "$HAVE_MATLAB" = "no" && test "$HAVE_PYTHON" = "no"; then
+-			AC_MSG_ERROR([need at least python or matlab support to compile modules (or use --with-modules=no)]);
+-		fi
++				AC_MSG_ERROR([need at least python or matlab support to compile modules (or use --with-modules=no)]);
++		  fi
+ 
+ 		  dnl check that if we have MPI, we have metis
+ 		  if test "$HAVE_METIS" = "yes"  && test "$HAVE_MPI" = "no" ; then
+-			AC_MSG_ERROR([need mpi if using the metis partitioner!]);
+-		fi
++				AC_MSG_ERROR([need mpi if using the metis partitioner!]);
++		  fi
+ 		
+ 		dnl check that if we run adolc, we don't compile krigging.exe
+-		  if test "$HAVE_ADOLC" = "yes"  && test "$HAVE_KRIGING" = "yes" ; then
++		if test "$HAVE_ADOLC" = "yes"  && test "$HAVE_KRIGING" = "yes" ; then
+ 			AC_MSG_ERROR([cannot compile kriging.exe under adolc conditions!]);
+ 		fi
+ 		dnl check that if we run meteoio, we have snowpack also
+-		  if test "$HAVE_METEOIO" = "yes"  && test "$HAVE_SNOWPACK" = "no" ; then
++		if test "$HAVE_METEOIO" = "yes"  && test "$HAVE_SNOWPACK" = "no" ; then
+ 			AC_MSG_ERROR([cannot compile MeteoIO package without Snowpack!]);
+ 		fi
+ 		dnl check that if we run snowpack, we have meteoio also
+-		  if test "$HAVE_METEOIO" = "no"  && test "$HAVE_SNOWPACK" = "yes" ; then
++		if test "$HAVE_METEOIO" = "no"  && test "$HAVE_SNOWPACK" = "yes" ; then
+ 			AC_MSG_ERROR([cannot compile Snowpack package without MeteoIO!]);
+ 		fi
+ 
+-
+-
+-
+-
+-
+-		  AC_MSG_RESULT(done)
+-		  dnl }}}
++		AC_MSG_RESULT(done)
++		dnl }}}
+ ])
+Index: ../trunk-jpl/src/c/analyses/EnumToAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnumToAnalysis.cpp	(revision 17235)
++++ ../trunk-jpl/src/c/analyses/EnumToAnalysis.cpp	(revision 17236)
+@@ -13,38 +13,90 @@
+ Analysis* EnumToAnalysis(int analysis_enum){
+ 
+ 	switch(analysis_enum){
++		#ifdef _HAVE_ADJOINTBALANCETHICKNESS_
+ 		case AdjointBalancethicknessAnalysisEnum : return new AdjointBalancethicknessAnalysis();
++		#endif
++		#ifdef _HAVE_ADJOINTHORIZ_
+ 		case AdjointHorizAnalysisEnum : return new AdjointHorizAnalysis();
++		#endif
++		#ifdef _HAVE_BALANCETHICKNESS_
+ 		case BalancethicknessAnalysisEnum : return new BalancethicknessAnalysis();
++		#endif
++		#ifdef _HAVE_BALANCETHICKNESSSOFT_
+ 		case BalancethicknessSoftAnalysisEnum : return new BalancethicknessSoftAnalysis();
++		#endif
++		#ifdef _HAVE_BALANCEVELOCITY_
+ 		case BalancevelocityAnalysisEnum : return new BalancevelocityAnalysis();
++		#endif
++		#ifdef _HAVE_L2PROJECTIONEPL_
++		case L2ProjectionEPLAnalysisEnum : return new L2ProjectionEPLAnalysis();
++		#endif
++		#ifdef _HAVE_L2PROJECTIONBASE_
+ 		case L2ProjectionBaseAnalysisEnum : return new L2ProjectionBaseAnalysis();
+-		case L2ProjectionEPLAnalysisEnum : return new L2ProjectionEPLAnalysis();
++		#endif
++		#ifdef _HAVE_DAMAGEEVOLUTION_
+ 		case DamageEvolutionAnalysisEnum : return new DamageEvolutionAnalysis();
++		#endif
++		#ifdef _HAVE_STRESSBALANCE_
+ 		case StressbalanceAnalysisEnum : return new StressbalanceAnalysis();
++		#endif
++		#ifdef _HAVE_STRESSBALANCESIA_
+ 		case StressbalanceSIAAnalysisEnum : return new StressbalanceSIAAnalysis();
++		#endif
++		#ifdef _HAVE_STRESSBALANCEVERTICAL_
+ 		case StressbalanceVerticalAnalysisEnum : return new StressbalanceVerticalAnalysis();
++		#endif
++		#ifdef _HAVE_ENTHALPY_
+ 		case EnthalpyAnalysisEnum : return new EnthalpyAnalysis();
++		#endif
++		#ifdef _HAVE_HYDROLOGYSHREVE_
+ 		case HydrologyShreveAnalysisEnum : return new HydrologyShreveAnalysis();
++		#endif
++		#ifdef _HAVE_HYDROLOGYDCINEFFICIENT_
+ 		case HydrologyDCInefficientAnalysisEnum : return new HydrologyDCInefficientAnalysis();
++		#endif
++		#ifdef _HAVE_HYDROLOGYDCEFFICIENT_
+ 		case HydrologyDCEfficientAnalysisEnum : return new HydrologyDCEfficientAnalysis();
++		#endif
++		#ifdef _HAVE_MELTING_
+ 		case MeltingAnalysisEnum : return new MeltingAnalysis();
++		#endif
++		#ifdef _HAVE_MASSTRANSPORT_
+ 		case MasstransportAnalysisEnum : return new MasstransportAnalysis();
++		#endif
++		#ifdef _HAVE_FREESURFACEBASE_
+ 		case FreeSurfaceBaseAnalysisEnum : return new FreeSurfaceBaseAnalysis();
++		#endif
++		#ifdef _HAVE_FREESURFACETOP_
+ 		case FreeSurfaceTopAnalysisEnum : return new FreeSurfaceTopAnalysis();
++		#endif
++		#ifdef _HAVE_EXTRUDEFROMBASE_
+ 		case ExtrudeFromBaseAnalysisEnum : return new ExtrudeFromBaseAnalysis();
++		#endif
++		#ifdef _HAVE_EXTRUDEFROMTOP_
+ 		case ExtrudeFromTopAnalysisEnum : return new ExtrudeFromTopAnalysis();
++		#endif
++		#ifdef _HAVE_SMOOTHEDSURFACESLOPEX_
++		case SmoothedSurfaceSlopeXAnalysisEnum : return new SmoothedSurfaceSlopeXAnalysis();
++		#endif
++		#ifdef _HAVE_SMOOTHEDSURFACESLOPEY_
++		case SmoothedSurfaceSlopeYAnalysisEnum : return new SmoothedSurfaceSlopeYAnalysis();
++		#endif
++		#ifdef _HAVE_THERMAL_
+ 		case ThermalAnalysisEnum : return new ThermalAnalysis();
+-		case LevelsetAnalysisEnum : return new LevelsetAnalysis();
+-		case ExtrapolationAnalysisEnum : return new ExtrapolationAnalysis();
++		#endif
+ 		#ifdef _HAVE_GIA_
+ 		case GiaAnalysisEnum : return new GiaAnalysis();
+ 		#endif
+ 		#ifdef _HAVE_MESHDEFORMATION_
+ 		case MeshdeformationAnalysisEnum : return new MeshdeformationAnalysis();
+ 		#endif
+-		case SmoothedSurfaceSlopeXAnalysisEnum: return new SmoothedSurfaceSlopeXAnalysis();
+-		case SmoothedSurfaceSlopeYAnalysisEnum: return new SmoothedSurfaceSlopeYAnalysis();
++		#ifdef _HAVE_LEVELSET_
++		case LevelsetAnalysisEnum : return new LevelsetAnalysis();
++		#endif
++		#ifdef _HAVE_EXTRAPOLATION_
++		case ExtrapolationAnalysisEnum : return new ExtrapolationAnalysis();
++		#endif
+ 		default : _error_("enum provided not supported ("<<EnumToStringx(analysis_enum)<<")");
+ 	}
+ }
+Index: ../trunk-jpl/src/c/shared/Enum/Synchronize.sh
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/Synchronize.sh	(revision 17235)
++++ ../trunk-jpl/src/c/shared/Enum/Synchronize.sh	(revision 17236)
+@@ -103,38 +103,38 @@
+ }
+ END
+ #}}}
+-##Build EnumToAnalysis.cpp {{{
+-##Header
+-#cat <<END > $ISSM_DIR/src/c/analyses/EnumToAnalysis.cpp
+-#/*
+-#* \file EnumToAnalysis.cpp
+-#* \brief: output class depending on enum
+-#*
+-#*   WARNING: DO NOT MODIFY THIS FILE
+-#*            this file has been automatically generated by Synchronize.sh
+-#*            Please read README for more information
+-#*/
+-#
+-##include "./analyses.h"
+-##include "../shared/shared.h"
+-#
+-#Analysis* EnumToAnalysis(int analysis_enum){
+-#
+-#	switch(analysis_enum){
+-#END
+-##core
+-#cat temp | grep [a-z]Analysis | \
+-#	grep -v DefaultAnalysis | grep -v FlaimAnalysis | grep -v SurfaceSlopeAnalysis | grep -v BedSlopeAnalysis | \
+-#	awk '{print "\t\t#ifdef _HAVE_"toupper(substr($1,1,length($1)-12))"_\n\t\t" "case " $1" : return new " substr($1,1,length($1)-4) "();\n\t\t#endif"}' \
+-#		>> $ISSM_DIR/src/c/analyses/EnumToAnalysis.cpp
+-#
+-##Footer
+-#cat <<END >> $ISSM_DIR/src/c/analyses/EnumToAnalysis.cpp
+-#default : _error_("enum provided not supported ("<<EnumToStringx(analysis_enum)<<")");
+-#	}
+-#}
+-#END
+-##}}}
++#Build EnumToAnalysis.cpp {{{
++#Header
++cat <<END > $ISSM_DIR/src/c/analyses/EnumToAnalysis.cpp
++/*
++* \file EnumToAnalysis.cpp
++* \brief: output class depending on enum
++*
++*   WARNING: DO NOT MODIFY THIS FILE
++*            this file has been automatically generated by Synchronize.sh
++*            Please read README for more information
++*/
++
++#include "./analyses.h"
++#include "../shared/shared.h"
++
++Analysis* EnumToAnalysis(int analysis_enum){
++
++	switch(analysis_enum){
++END
++#core
++cat temp | grep [a-zA-Z]Analysis | \
++	grep -v DefaultAnalysis | grep -v FlaimAnalysis | grep -v SurfaceSlopeAnalysis | grep -v BedSlopeAnalysis | \
++	awk '{print "\t\t#ifdef _HAVE_"toupper(substr($1,1,length($1)-12))"_\n\t\t" "case " $1" : return new " substr($1,1,length($1)-4) "();\n\t\t#endif"}' \
++		>> $ISSM_DIR/src/c/analyses/EnumToAnalysis.cpp
++
++#Footer
++cat <<END >> $ISSM_DIR/src/c/analyses/EnumToAnalysis.cpp
++		default : _error_("enum provided not supported ("<<EnumToStringx(analysis_enum)<<")");
++	}
++}
++END
++#}}}
+ #Build EnumDefinitions.py{{{
+ cat <<END > $ISSM_DIR/src/m/enum/EnumDefinitions.py
+ from StringToEnum import StringToEnum
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17235)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17236)
+@@ -341,7 +341,6 @@
+ 	ExtrudeFromBaseAnalysisEnum,
+ 	ExtrudeFromTopAnalysisEnum,
+ 	SteadystateSolutionEnum,
+-	L2ProjectionTopAnalysisEnum,
+ 	SurfaceSlopeSolutionEnum,
+ 	SmoothedSurfaceSlopeXAnalysisEnum,
+ 	SmoothedSurfaceSlopeYAnalysisEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17235)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17236)
+@@ -342,7 +342,6 @@
+ 		case ExtrudeFromBaseAnalysisEnum : return "ExtrudeFromBaseAnalysis";
+ 		case ExtrudeFromTopAnalysisEnum : return "ExtrudeFromTopAnalysis";
+ 		case SteadystateSolutionEnum : return "SteadystateSolution";
+-		case L2ProjectionTopAnalysisEnum : return "L2ProjectionTopAnalysis";
+ 		case SurfaceSlopeSolutionEnum : return "SurfaceSlopeSolution";
+ 		case SmoothedSurfaceSlopeXAnalysisEnum : return "SmoothedSurfaceSlopeXAnalysis";
+ 		case SmoothedSurfaceSlopeYAnalysisEnum : return "SmoothedSurfaceSlopeYAnalysis";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17235)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17236)
+@@ -348,7 +348,6 @@
+ 	      else if (strcmp(name,"ExtrudeFromBaseAnalysis")==0) return ExtrudeFromBaseAnalysisEnum;
+ 	      else if (strcmp(name,"ExtrudeFromTopAnalysis")==0) return ExtrudeFromTopAnalysisEnum;
+ 	      else if (strcmp(name,"SteadystateSolution")==0) return SteadystateSolutionEnum;
+-	      else if (strcmp(name,"L2ProjectionTopAnalysis")==0) return L2ProjectionTopAnalysisEnum;
+ 	      else if (strcmp(name,"SurfaceSlopeSolution")==0) return SurfaceSlopeSolutionEnum;
+ 	      else if (strcmp(name,"SmoothedSurfaceSlopeXAnalysis")==0) return SmoothedSurfaceSlopeXAnalysisEnum;
+ 	      else if (strcmp(name,"SmoothedSurfaceSlopeYAnalysis")==0) return SmoothedSurfaceSlopeYAnalysisEnum;
+@@ -382,11 +381,11 @@
+ 	      else if (strcmp(name,"Vertices")==0) return VerticesEnum;
+ 	      else if (strcmp(name,"Results")==0) return ResultsEnum;
+ 	      else if (strcmp(name,"GenericParam")==0) return GenericParamEnum;
++	      else if (strcmp(name,"AdolcParam")==0) return AdolcParamEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"AdolcParam")==0) return AdolcParamEnum;
+-	      else if (strcmp(name,"BoolInput")==0) return BoolInputEnum;
++	      if (strcmp(name,"BoolInput")==0) return BoolInputEnum;
+ 	      else if (strcmp(name,"BoolParam")==0) return BoolParamEnum;
+ 	      else if (strcmp(name,"Contour")==0) return ContourEnum;
+ 	      else if (strcmp(name,"ControlInput")==0) return ControlInputEnum;
+@@ -505,11 +504,11 @@
+ 	      else if (strcmp(name,"VyMesh")==0) return VyMeshEnum;
+ 	      else if (strcmp(name,"VzMesh")==0) return VzMeshEnum;
+ 	      else if (strcmp(name,"Enthalpy")==0) return EnthalpyEnum;
++	      else if (strcmp(name,"EnthalpyPicard")==0) return EnthalpyPicardEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"EnthalpyPicard")==0) return EnthalpyPicardEnum;
+-	      else if (strcmp(name,"ThicknessAbsGradient")==0) return ThicknessAbsGradientEnum;
++	      if (strcmp(name,"ThicknessAbsGradient")==0) return ThicknessAbsGradientEnum;
+ 	      else if (strcmp(name,"ThicknessAlongGradient")==0) return ThicknessAlongGradientEnum;
+ 	      else if (strcmp(name,"ThicknessAcrossGradient")==0) return ThicknessAcrossGradientEnum;
+ 	      else if (strcmp(name,"IntMatParam")==0) return IntMatParamEnum;
+@@ -628,11 +627,11 @@
+ 	      else if (strcmp(name,"Separate")==0) return SeparateEnum;
+ 	      else if (strcmp(name,"Sset")==0) return SsetEnum;
+ 	      else if (strcmp(name,"Verbose")==0) return VerboseEnum;
++	      else if (strcmp(name,"TriangleInterp")==0) return TriangleInterpEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"TriangleInterp")==0) return TriangleInterpEnum;
+-	      else if (strcmp(name,"BilinearInterp")==0) return BilinearInterpEnum;
++	      if (strcmp(name,"BilinearInterp")==0) return BilinearInterpEnum;
+ 	      else if (strcmp(name,"NearestInterp")==0) return NearestInterpEnum;
+ 	      else if (strcmp(name,"XY")==0) return XYEnum;
+ 	      else if (strcmp(name,"XYZ")==0) return XYZEnum;
+Index: ../trunk-jpl/src/c/modules/ResetConstraintsx/ResetConstraintsx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ResetConstraintsx/ResetConstraintsx.cpp	(revision 17235)
++++ ../trunk-jpl/src/c/modules/ResetConstraintsx/ResetConstraintsx.cpp	(revision 17236)
+@@ -23,11 +23,9 @@
+ 	femmodel->parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+ 
+ 	/*Deal with rift first*/
+-	#ifdef _HAVE_RIFTS_
+ 	if(RiftIsPresent(femmodel->loads,analysis_type)){
+ 		_error_("rift constraints reset not supported yet!");
+ 	}
+-	#endif
+ 
+ 	/*Reset pengrid to inactive mode*/
+ 	for(int i=0;i<femmodel->loads->Size();i++){
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17235)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17236)
+@@ -208,9 +208,7 @@
+ 
+ 	
+ 	/*Before returning, create parameters in case we are running Qmu or control types runs: */
+-	#ifdef _HAVE_CONTROL_
+ 	CreateParametersControl(parameters,iomodel,solution_type);
+-	#endif
+ 
+ 	#ifdef _HAVE_DAKOTA_
+ 	CreateParametersDakota(parameters,iomodel,rootpath);
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp	(revision 17235)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp	(revision 17236)
+@@ -96,17 +96,13 @@
+ 	}
+ 
+ 	/*Solution specific updates*/
+-	#ifdef _HAVE_CONTROL_
+ 	UpdateElementsAndMaterialsControl(elements,materials,iomodel);
+-	#endif
+ 	#ifdef _HAVE_DAKOTA_
+ 	UpdateElementsAndMaterialsDakota(elements,materials,iomodel);
+ 	#endif
+-	#ifdef _HAVE_TRANSIENT_
+ 	if(solution_enum==TransientSolutionEnum){
+ 		UpdateElementsTransient(elements,parameters,iomodel,analysis_enum);
+ 	}
+-	#endif
+ 
+ 	/*Output definitions dataset: */
+ 	CreateOutputDefinitions(elements,parameters,iomodel);
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp	(revision 17235)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp	(revision 17236)
+@@ -37,14 +37,12 @@
+ 				if(iomodel->my_elements[i]) elements->AddObject(new Tria(i+1,i,i,iomodel,nummodels));
+ 			}
+ 			break;
+-		#ifdef _HAVE_3D_
+ 		case Mesh3DEnum:
+ 			iomodel->FetchData(2,MeshUpperelementsEnum,MeshLowerelementsEnum);
+ 			for(i=0;i<iomodel->numberofelements;i++){
+ 				if(iomodel->my_elements[i]) elements->AddObject(new Penta(i+1,i,i,iomodel,nummodels));
+ 			}
+ 			break;
+-		#endif
+ 		default:
+ 			_error_("Mesh not supported yet");
+ 	}
+@@ -59,11 +57,9 @@
+ 					case Mesh2DhorizontalEnum:
+ 						materials->InputDuplicate(MaterialsRheologyBbarEnum,QmuMaterialsRheologyBEnum);
+ 						break;
+-				   #ifdef _HAVE_3D_
+ 					case Mesh3DEnum:
+ 						materials->InputDuplicate(MaterialsRheologyBEnum,QmuMaterialsRheologyBEnum); 
+ 						break;
+-				   #endif
+ 					default:
+ 						_error_("Mesh not supported yet");
+ 				}
+Index: ../trunk-jpl/src/c/modules/ConstraintsStatex/ConstraintsStatex.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ConstraintsStatex/ConstraintsStatex.cpp	(revision 17235)
++++ ../trunk-jpl/src/c/modules/ConstraintsStatex/ConstraintsStatex.cpp	(revision 17236)
+@@ -25,11 +25,9 @@
+ 	femmodel->parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+ 
+ 	/*Rift penalties first*/
+-	#ifdef _HAVE_RIFTS_
+ 	if(RiftIsPresent(femmodel->loads,analysis_type)){
+ 		RiftConstraintsState(&converged,&num_unstable_constraints,femmodel->loads,min_mechanical_constraints,analysis_type);
+ 	}
+-	#endif
+ 
+ 	/*Deal with pengrid*/
+ 	for(int i=0;i<femmodel->loads->Size();i++){
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17235)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17236)
+@@ -17,9 +17,9 @@
+ endif
+ #}}}
+ 
+-#sources
++#Core sources
+ #Core sources{{{
+-core_sources = ./datastructures/DataSet.h\
++issm_sources = ./datastructures/DataSet.h\
+ 					./datastructures/DataSet.cpp\
+ 					./datastructures/Object.h\
+ 					./datastructures/datastructures.h\
+@@ -348,10 +348,98 @@
+ 					./classes/Options/OptionUtilities.cpp\
+ 					./classes/Options/OptionUtilities.h\
+ 					./classes/RiftStruct.cpp\
+-					./classes/RiftStruct.h
+-#}}}
++					./classes/RiftStruct.h\
++					./modules/ModelProcessorx/Transient/UpdateElementsTransient.cpp \
++					./cores/transient_core.cpp\
++					./cores/steadystate_core.cpp\
++					./cores/masstransport_core.cpp\
++					./cores/extrudefrombase_core.cpp\
++					./cores/extrudefromtop_core.cpp\
++					./cores/thermal_core.cpp\
++					./solutionsequences/solutionsequence_thermal_nonlinear.cpp\
++					./modules/ControlInputGetGradientx/ControlInputGetGradientx.cpp\
++					./modules/ControlInputGetGradientx/ControlInputGetGradientx.h\
++					./modules/ControlInputSetGradientx/ControlInputSetGradientx.cpp\
++					./modules/ControlInputSetGradientx/ControlInputSetGradientx.h\
++					./modules/ControlInputScaleGradientx/ControlInputScaleGradientx.cpp\
++					./modules/ControlInputScaleGradientx/ControlInputScaleGradientx.h\
++					./modules/GetVectorFromControlInputsx/GetVectorFromControlInputsx.cpp\
++					./modules/GetVectorFromControlInputsx/GetVectorFromControlInputsx.h\
++					./modules/SetControlInputsFromVectorx/SetControlInputsFromVectorx.cpp\
++					./modules/SetControlInputsFromVectorx/SetControlInputsFromVectorx.h\
++					./modules/ModelProcessorx/Control/CreateParametersControl.cpp\
++					./modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp\
++					./modules/InputControlUpdatex/InputControlUpdatex.h\
++					./modules/InputControlUpdatex/InputControlUpdatex.cpp\
++					./modules/SurfaceAbsVelMisfitx/SurfaceAbsVelMisfitx.h\
++					./modules/SurfaceAbsVelMisfitx/SurfaceAbsVelMisfitx.cpp\
++					./modules/SurfaceRelVelMisfitx/SurfaceRelVelMisfitx.h\
++					./modules/SurfaceRelVelMisfitx/SurfaceRelVelMisfitx.cpp\
++					./modules/SurfaceLogVelMisfitx/SurfaceLogVelMisfitx.h\
++					./modules/SurfaceLogVelMisfitx/SurfaceLogVelMisfitx.cpp\
++					./modules/SurfaceLogVxVyMisfitx/SurfaceLogVxVyMisfitx.h\
++					./modules/SurfaceLogVxVyMisfitx/SurfaceLogVxVyMisfitx.cpp\
++					./modules/SurfaceAverageVelMisfitx/SurfaceAverageVelMisfitx.h\
++					./modules/SurfaceAverageVelMisfitx/SurfaceAverageVelMisfitx.cpp\
++					./modules/ThicknessAbsMisfitx/ThicknessAbsMisfitx.h\
++					./modules/ThicknessAbsMisfitx/ThicknessAbsMisfitx.cpp\
++					./modules/Orthx/Orthx.h\
++					./modules/Orthx/Orthx.cpp\
++					./modules/Gradjx/Gradjx.h\
++					./modules/Gradjx/Gradjx.cpp\
++					./modules/DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.cpp\
++					./modules/DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.h\
++					./modules/ThicknessAlongGradientx/ThicknessAlongGradientx.cpp\
++					./modules/ThicknessAlongGradientx/ThicknessAlongGradientx.h\
++					./modules/ThicknessAcrossGradientx/ThicknessAcrossGradientx.cpp\
++					./modules/ThicknessAcrossGradientx/ThicknessAcrossGradientx.h\
++					./modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.cpp\
++					./modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.h\
++					./classes/Inputs/ControlInput.h\
++					./classes/Inputs/ControlInput.cpp\
++					./shared/Numerics/BrentSearch.cpp\
++					./shared/Numerics/OptimalSearch.cpp \
++					./cores/control_core.cpp\
++					./cores/controltao_core.cpp\
++					./cores/objectivefunction.cpp\
++					./cores/gradient_core.cpp\
++					./cores/adjointstressbalance_core.cpp\
++					./cores/adjointbalancethickness_core.cpp\
++					./cores/AdjointCorePointerFromSolutionEnum.cpp\
++					./solutionsequences/solutionsequence_adjoint_linear.cpp\
++					./cores/hydrology_core.cpp\
++					./solutionsequences/solutionsequence_hydro_nonlinear.cpp\
++					./cores/stressbalance_core.cpp\
++					./solutionsequences/solutionsequence_stokescoupling_nonlinear.cpp\
++					./cores/balancethickness_core.cpp \
++					./cores/balancevelocity_core.cpp \
++					./cores/dummy_core.cpp\
++					./cores/surfaceslope_core.cpp\
++					./cores/bedslope_core.cpp\
++					./cores/meshdeformation_core.cpp\
++					./cores/damage_core.cpp\
++					./analyses/DamageEvolutionAnalysis.cpp\
++					./solutionsequences/solutionsequence_damage_nonlinear.cpp\
++					./modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp\
++					./classes/Loads/Riftfront.cpp\
++					./modules/ConstraintsStatex/RiftConstraintsState.cpp\
++					./classes/Massfluxatgate.h \
++					./classes/Misfit.h \
++					./modules/ModelProcessorx/CreateOutputDefinitions.cpp\
++					./modules/OutputDefinitionsResponsex/OutputDefinitionsResponsex.h\
++					./modules/OutputDefinitionsResponsex/OutputDefinitionsResponsex.cpp\
++					./classes/gauss/GaussPenta.h\
++					./classes/gauss/GaussPenta.cpp\
++					./classes/Inputs/PentaInput.h\
++					./classes/Inputs/PentaInput.cpp\
++					./classes/Elements/Penta.h\
++					./classes/Elements/Penta.cpp\
++					./classes/Elements/PentaRef.h\
++					./classes/Elements/PentaRef.cpp\
++					#}}}
+ #DAKOTA sources  {{{
+-dakota_sources = ./modules/InputUpdateFromDakotax/InputUpdateFromDakotax.h\
++if DAKOTA
++issm_sources +=  ./modules/InputUpdateFromDakotax/InputUpdateFromDakotax.h\
+ 					  ./modules/InputUpdateFromDakotax/InputUpdateFromDakotax.cpp\
+ 					  ./modules/InputUpdateFromVectorDakotax/InputUpdateFromVectorDakotax.h\
+ 					  ./modules/InputUpdateFromVectorDakotax/InputUpdateFromVectorDakotax.cpp\
+@@ -364,378 +452,11 @@
+ 					  ./cores/dakota_core.cpp\
+ 					  ./cores/DakotaSpawnCore.h\
+ 					  ./cores/DakotaSpawnCore.cpp
++endif
+ #}}}
+-#Transient sources  {{{
+-transient_sources  = ./modules/ModelProcessorx/Transient/UpdateElementsTransient.cpp \
+-							./cores/transient_core.cpp\
+-              ./analyses/LevelsetAnalysis.h\
+-              ./analyses/LevelsetAnalysis.cpp\
+-			  ./analyses/ExtrapolationAnalysis.h\
+-			  ./analyses/ExtrapolationAnalysis.cpp
+-#}}}
+-#Steadystate sources  {{{
+-steadystate_sources = ./cores/steadystate_core.cpp
+-#}}}
+-#Masstransport sources  {{{
+-masstransport_sources = ./analyses/ExtrudeFromBaseAnalysis.h\
+-								./analyses/ExtrudeFromBaseAnalysis.cpp\
+-								./analyses/ExtrudeFromTopAnalysis.h\
+-								./analyses/ExtrudeFromTopAnalysis.cpp\
+-								./analyses/MasstransportAnalysis.h\
+-								./analyses/MasstransportAnalysis.cpp\
+-								./analyses/FreeSurfaceBaseAnalysis.h\
+-								./analyses/FreeSurfaceBaseAnalysis.cpp\
+-								./analyses/FreeSurfaceTopAnalysis.h\
+-								./analyses/FreeSurfaceTopAnalysis.cpp\
+-								./cores/masstransport_core.cpp\
+-								./cores/extrudefrombase_core.cpp\
+-								./cores/extrudefromtop_core.cpp
+-
+-#}}}
+-#Thermal sources  {{{
+-thermal_sources = ./analyses/ThermalAnalysis.h\
+-						./analyses/ThermalAnalysis.cpp\
+-						./analyses/EnthalpyAnalysis.h\
+-						./analyses/EnthalpyAnalysis.cpp\
+-						./analyses/MeltingAnalysis.h\
+-						./analyses/MeltingAnalysis.cpp\
+-					   ./cores/thermal_core.cpp\
+-					   ./solutionsequences/solutionsequence_thermal_nonlinear.cpp
+-#}}}
+-#Control sources  {{{
+-control_sources= ./modules/ControlInputGetGradientx/ControlInputGetGradientx.cpp\
+-					  ./modules/ControlInputGetGradientx/ControlInputGetGradientx.h\
+-					  ./modules/ControlInputSetGradientx/ControlInputSetGradientx.cpp\
+-					  ./modules/ControlInputSetGradientx/ControlInputSetGradientx.h\
+-					  ./modules/ControlInputScaleGradientx/ControlInputScaleGradientx.cpp\
+-					  ./modules/ControlInputScaleGradientx/ControlInputScaleGradientx.h\
+-					  ./modules/GetVectorFromControlInputsx/GetVectorFromControlInputsx.cpp\
+-					  ./modules/GetVectorFromControlInputsx/GetVectorFromControlInputsx.h\
+-					  ./modules/SetControlInputsFromVectorx/SetControlInputsFromVectorx.cpp\
+-					  ./modules/SetControlInputsFromVectorx/SetControlInputsFromVectorx.h\
+-					  ./modules/ModelProcessorx/Control/CreateParametersControl.cpp\
+-					  ./modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp\
+-					  ./modules/InputControlUpdatex/InputControlUpdatex.h\
+-					  ./modules/InputControlUpdatex/InputControlUpdatex.cpp\
+-					  ./modules/SurfaceAbsVelMisfitx/SurfaceAbsVelMisfitx.h\
+-					  ./modules/SurfaceAbsVelMisfitx/SurfaceAbsVelMisfitx.cpp\
+-					  ./modules/SurfaceRelVelMisfitx/SurfaceRelVelMisfitx.h\
+-					  ./modules/SurfaceRelVelMisfitx/SurfaceRelVelMisfitx.cpp\
+-					  ./modules/SurfaceLogVelMisfitx/SurfaceLogVelMisfitx.h\
+-					  ./modules/SurfaceLogVelMisfitx/SurfaceLogVelMisfitx.cpp\
+-					  ./modules/SurfaceLogVxVyMisfitx/SurfaceLogVxVyMisfitx.h\
+-					  ./modules/SurfaceLogVxVyMisfitx/SurfaceLogVxVyMisfitx.cpp\
+-					  ./modules/SurfaceAverageVelMisfitx/SurfaceAverageVelMisfitx.h\
+-					  ./modules/SurfaceAverageVelMisfitx/SurfaceAverageVelMisfitx.cpp\
+-					  ./modules/ThicknessAbsMisfitx/ThicknessAbsMisfitx.h\
+-					  ./modules/ThicknessAbsMisfitx/ThicknessAbsMisfitx.cpp\
+-					  ./modules/Orthx/Orthx.h\
+-					  ./modules/Orthx/Orthx.cpp\
+-					  ./modules/Gradjx/Gradjx.h\
+-					  ./modules/Gradjx/Gradjx.cpp\
+-					  ./modules/DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.cpp\
+-					  ./modules/DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.h\
+-					  ./modules/ThicknessAlongGradientx/ThicknessAlongGradientx.cpp\
+-					  ./modules/ThicknessAlongGradientx/ThicknessAlongGradientx.h\
+-					  ./modules/ThicknessAcrossGradientx/ThicknessAcrossGradientx.cpp\
+-					  ./modules/ThicknessAcrossGradientx/ThicknessAcrossGradientx.h\
+-					  ./modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.cpp\
+-					  ./modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.h\
+-					  ./classes/Inputs/ControlInput.h\
+-					  ./classes/Inputs/ControlInput.cpp\
+-					  ./shared/Numerics/BrentSearch.cpp\
+-					  ./shared/Numerics/OptimalSearch.cpp \
+-					  ./cores/control_core.cpp\
+-					  ./cores/controltao_core.cpp\
+-					  ./cores/objectivefunction.cpp\
+-					  ./cores/gradient_core.cpp\
+-					  ./cores/adjointstressbalance_core.cpp\
+-					  ./cores/adjointbalancethickness_core.cpp\
+-					  ./cores/AdjointCorePointerFromSolutionEnum.cpp\
+-					  ./analyses/AdjointBalancethicknessAnalysis.h\
+-					  ./analyses/AdjointBalancethicknessAnalysis.cpp\
+-					  ./analyses/AdjointHorizAnalysis.h\
+-					  ./analyses/AdjointHorizAnalysis.cpp\
+-					  ./solutionsequences/solutionsequence_adjoint_linear.cpp
+-
+-#}}}
+-#Hydrology sources  {{{
+-hydrology_sources  = ./analyses/HydrologyDCEfficientAnalysis.h\
+-							./analyses/HydrologyDCEfficientAnalysis.cpp\
+-							./analyses/HydrologyDCInefficientAnalysis.h\
+-							./analyses/HydrologyDCInefficientAnalysis.cpp\
+-							./analyses/HydrologyShreveAnalysis.h\
+-							./analyses/HydrologyShreveAnalysis.cpp\
+-							./analyses/L2ProjectionEPLAnalysis.h\
+-					  	./analyses/L2ProjectionEPLAnalysis.cpp\
+-							./cores/hydrology_core.cpp\
+-							./solutionsequences/solutionsequence_hydro_nonlinear.cpp
+-#}}}
+-#Stressbalance sources  {{{
+-stressbalance_sources = ./analyses/StressbalanceAnalysis.h\
+-							./analyses/StressbalanceAnalysis.cpp\
+-							./analyses/StressbalanceSIAAnalysis.h\
+-							./analyses/StressbalanceSIAAnalysis.cpp\
+-							./analyses/StressbalanceVerticalAnalysis.h\
+-							./analyses/StressbalanceVerticalAnalysis.cpp\
+-							./cores/stressbalance_core.cpp\
+-							./solutionsequences/solutionsequence_stokescoupling_nonlinear.cpp
+-#}}}
+-#Balanced sources  {{{
+-balanced_sources = ./analyses/BalancevelocityAnalysis.h\
+-						 ./analyses/BalancevelocityAnalysis.cpp\
+-						 ./analyses/SmoothedSurfaceSlopeXAnalysis.h\
+-						 ./analyses/SmoothedSurfaceSlopeXAnalysis.cpp\
+-						 ./analyses/SmoothedSurfaceSlopeYAnalysis.h\
+-						 ./analyses/SmoothedSurfaceSlopeYAnalysis.cpp\
+-						 ./analyses/BalancethicknessAnalysis.h\
+-						 ./analyses/BalancethicknessAnalysis.cpp\
+-						 ./analyses/BalancethicknessSoftAnalysis.h\
+-						 ./analyses/BalancethicknessSoftAnalysis.cpp\
+-						 ./cores/balancethickness_core.cpp \
+-						 ./cores/balancevelocity_core.cpp \
+-						 ./cores/dummy_core.cpp
+-#}}}
+-#Slope sources  {{{
+-slope_sources =  ./analyses/L2ProjectionBaseAnalysis.h\
+-					  ./analyses/L2ProjectionBaseAnalysis.cpp\
+-					  ./cores/surfaceslope_core.cpp\
+-					  ./cores/bedslope_core.cpp
+-#}}}
+-#MeshDeformation sources  {{{
+-meshdeformation_sources = ./analyses/MeshdeformationAnalysis.h\
+-					  ./analyses/MeshdeformationAnalysis.cpp\
+-					  ./cores/meshdeformation_core.cpp
+-#}}}
+-#Gia sources  {{{
+-gia_sources =  ./cores/gia_core.cpp\
+-					./analyses/GiaAnalysis.h\
+-					./analyses/GiaAnalysis.cpp\
+-					./modules/GiaDeflectionCorex/GiaDeflectionCorex.cpp\
+-					./modules/GiaDeflectionCorex/GiaDeflectionCorex.h\
+-					./modules/GiaDeflectionCorex/distme.f\
+-					./modules/GiaDeflectionCorex/freed.f\
+-					./modules/GiaDeflectionCorex/ojrule.f\
+-					./modules/GiaDeflectionCorex/pwise.f\
+-					./modules/GiaDeflectionCorex/qwise.f\
+-					./modules/GiaDeflectionCorex/stot.f\
+-					./modules/GiaDeflectionCorex/what0.f\
+-					./classes/GiaDeflectionCoreArgs.h
+-
+-#}}}
+-#Damage sources  {{{
+-damage_sources =  ./cores/damage_core.cpp\
+-						./analyses/DamageEvolutionAnalysis.h\
+-						./analyses/DamageEvolutionAnalysis.cpp\
+-						./solutionsequences/solutionsequence_damage_nonlinear.cpp
+-
+-#}}}
+-#Groundingline sources  {{{
+-groundingline_sources= ./modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp\
+-					        ./modules/GroundinglineMigrationx/GroundinglineMigrationx.h
+-#}}}
+-#Rifts sources  {{{
+-rifts_sources = ./classes/Loads/Riftfront.cpp\
+-				    ./classes/Loads/Riftfront.h\
+-				    ./modules/ConstraintsStatex/RiftConstraintsState.cpp
+-#}}}
+-#Responses sources  {{{
+-responses_sources= ./classes/Massfluxatgate.h \
+-				   ./classes/Misfit.h \
+-				   ./modules/ModelProcessorx/CreateOutputDefinitions.cpp\
+-				   ./modules/OutputDefinitionsResponsex/OutputDefinitionsResponsex.h\
+-				   ./modules/OutputDefinitionsResponsex/OutputDefinitionsResponsex.cpp
+-#}}}
+-#Android sources  {{{
+-android_sources = 
+-#}}}
+-#3D sources  {{{
+-threed_sources = ./classes/gauss/GaussPenta.h\
+-				     ./classes/gauss/GaussPenta.cpp\
+-				     ./classes/Inputs/PentaInput.h\
+-				     ./classes/Inputs/PentaInput.cpp\
+-				     ./classes/Elements/Penta.h\
+-				     ./classes/Elements/Penta.cpp\
+-				     ./classes/Elements/PentaRef.h\
+-				     ./classes/Elements/PentaRef.cpp
+-#}}}
+-#Bamg sources  {{{
+-bamg_sources =  ./bamg/bamgobjects.h\
+-				./bamg/BamgGeom.h\
+-				./bamg/BamgGeom.cpp\
+-				./bamg/BamgMesh.h\
+-				./bamg/BamgMesh.cpp\
+-				./bamg/BamgOpts.h\
+-				./bamg/BamgOpts.cpp\
+-				./bamg/CrackedEdge.h\
+-				./bamg/CrackedEdge.cpp\
+-				./bamg/Curve.h\
+-				./bamg/Curve.cpp\
+-				./bamg/Direction.h\
+-				./bamg/Direction.cpp\
+-				./bamg/DoubleAndInt.h\
+-				./bamg/Edge.h\
+-				./bamg/Edge.cpp\
+-				./bamg/GeomEdge.h\
+-				./bamg/GeomEdge.cpp\
+-				./bamg/GeomSubDomain.h\
+-				./bamg/GeomSubDomain.cpp\
+-				./bamg/GeomVertex.h\
+-				./bamg/GeomVertex.cpp\
+-				./bamg/Geometry.cpp\
+-				./bamg/Geometry.h\
+-				./bamg/ListofIntersectionTriangles.cpp\
+-				./bamg/ListofIntersectionTriangles.h\
+-				./bamg/EigenMetric.cpp\
+-				./bamg/Metric.cpp\
+-				./bamg/Metric.h\
+-				./bamg/BamgQuadtree.cpp\
+-				./bamg/BamgQuadtree.h\
+-				./bamg/R2.h\
+-				./bamg/SetOfE4.cpp\
+-				./bamg/SetOfE4.h\
+-				./bamg/SubDomain.h\
+-				./bamg/SubDomain.cpp\
+-				./bamg/AdjacentTriangle.h\
+-				./bamg/AdjacentTriangle.cpp\
+-				./bamg/Triangle.cpp\
+-				./bamg/det.h \
+-				./bamg/Triangle.h\
+-				./bamg/BamgVertex.cpp\
+-				./bamg/BamgVertex.h\
+-				./bamg/VertexOnEdge.h\
+-				./bamg/VertexOnEdge.cpp\
+-				./bamg/VertexOnGeom.h\
+-				./bamg/VertexOnGeom.cpp\
+-				./bamg/VertexOnVertex.h\
+-				./bamg/VertexOnVertex.cpp\
+-				./bamg/Mesh.cpp\
+-				./bamg/Mesh.h\
+-				./shared/Bamg/Abs.h \
+-				./shared/Bamg/BigPrimeNumber.h\
+-				./shared/Bamg/BigPrimeNumber.cpp\
+-				./shared/Bamg/BinaryRand.h \
+-				./shared/Bamg/Exchange.h \
+-				./shared/Bamg/extrema.h \
+-				./shared/Bamg/HeapSort.h \
+-				./shared/Bamg/OppositeAngle.h \
+-				./modules/Bamgx/Bamgx.cpp\
+-				./modules/Bamgx/Bamgx.h\
+-				./modules/BamgConvertMeshx/BamgConvertMeshx.cpp\
+-				./modules/BamgConvertMeshx/BamgConvertMeshx.h\
+-				./modules/BamgTriangulatex/BamgTriangulatex.cpp\
+-				./modules/BamgTriangulatex/BamgTriangulatex.h
+-#}}}
+-#Kriging sources  {{{
+-kriging_sources = ./classes/kriging/Observations.h\
+-						./classes/kriging/Observations.cpp\
+-						./classes/kriging/Variogram.h \
+-						./classes/kriging/GaussianVariogram.h\
+-						./classes/kriging/GaussianVariogram.cpp\
+-						./classes/kriging/ExponentialVariogram.h\
+-						./classes/kriging/ExponentialVariogram.cpp\
+-						./classes/kriging/SphericalVariogram.h\
+-						./classes/kriging/SphericalVariogram.cpp\
+-						./classes/kriging/PowerVariogram.h\
+-						./classes/kriging/PowerVariogram.cpp\
+-						./classes/kriging/Quadtree.h\
+-						./classes/kriging/Quadtree.cpp\
+-						./classes/kriging/Observation.h\
+-						./classes/kriging/Observation.cpp\
+-						./modules/Krigingx/Krigingx.cpp\
+-						./modules/Krigingx/Krigingx.h
+-
+-#For parallel kriging, only difference is ./modules/Krigingx/pKrigingx.cpp with no multithreading
+-pkriging_sources = ./classes/kriging/Observations.h\
+-						./classes/kriging/Observations.cpp\
+-						./classes/kriging/Variogram.h \
+-						./classes/kriging/GaussianVariogram.h\
+-						./classes/kriging/GaussianVariogram.cpp\
+-						./classes/kriging/ExponentialVariogram.h\
+-						./classes/kriging/ExponentialVariogram.cpp\
+-						./classes/kriging/SphericalVariogram.h\
+-						./classes/kriging/SphericalVariogram.cpp\
+-						./classes/kriging/PowerVariogram.h\
+-						./classes/kriging/PowerVariogram.cpp\
+-						./classes/kriging/Quadtree.h\
+-						./classes/kriging/Quadtree.cpp\
+-						./classes/kriging/Observation.h\
+-						./classes/kriging/Observation.cpp\
+-						./modules/Krigingx/pKrigingx.cpp\
+-						./modules/Krigingx/Krigingx.h
+-
+-#}}}
+-#Kml sources  {{{
+-kml_sources = ./modules/Exp2Kmlx/Exp2Kmlx.h\
+-			     ./modules/Exp2Kmlx/Exp2Kmlx.cpp\
+-			     ./modules/Kml2Expx/Kml2Expx.h\
+-			     ./modules/Kml2Expx/Kml2Expx.cpp\
+-			     ./modules/Shp2Kmlx/Shp2Kmlx.h\
+-			     ./modules/Shp2Kmlx/Shp2Kmlx.cpp\
+-			     ./modules/KMLFileReadx/KMLFileReadx.h\
+-			     ./modules/KMLFileReadx/KMLFileReadx.cpp\
+-			     ./modules/KMLMeshWritex/KMLMeshWritex.h\
+-			     ./modules/KMLMeshWritex/KMLMeshWritex.cpp\
+-			     ./modules/KMLOverlayx/KMLOverlayx.h\
+-			     ./modules/KMLOverlayx/KMLOverlayx.cpp\
+-			     ./kml/kmlobjects.h\
+-			     ./kml/KML_Attribute.cpp\
+-			     ./kml/KML_Attribute.h\
+-			     ./kml/KML_Comment.cpp\
+-			     ./kml/KML_Comment.h\
+-			     ./kml/KML_ColorStyle.cpp\
+-			     ./kml/KML_ColorStyle.h\
+-			     ./kml/KML_Container.cpp\
+-			     ./kml/KML_Container.h\
+-			     ./kml/KML_Document.cpp\
+-			     ./kml/KML_Document.h\
+-			     ./kml/KML_Feature.cpp\
+-			     ./kml/KML_Feature.h\
+-			     ./kml/KML_File.cpp\
+-			     ./kml/KML_File.h\
+-			     ./kml/KML_Folder.cpp\
+-			     ./kml/KML_Folder.h\
+-			     ./kml/KML_Geometry.cpp\
+-			     ./kml/KML_Geometry.h\
+-			     ./kml/KML_GroundOverlay.cpp\
+-			     ./kml/KML_GroundOverlay.h\
+-			     ./kml/KML_Icon.cpp\
+-			     ./kml/KML_Icon.h\
+-			     ./kml/KML_LatLonBox.cpp\
+-		  	     ./kml/KML_LatLonBox.h\
+-			     ./kml/KML_LinearRing.cpp\
+-			     ./kml/KML_LinearRing.h\
+-			     ./kml/KML_LineString.cpp\
+-			     ./kml/KML_LineString.h\
+-			     ./kml/KML_LineStyle.cpp\
+-			     ./kml/KML_LineStyle.h\
+-			     ./kml/KML_MultiGeometry.cpp\
+-			     ./kml/KML_MultiGeometry.h\
+-			     ./kml/KML_Object.cpp\
+-			     ./kml/KML_Object.h\
+-			     ./kml/KML_Overlay.cpp\
+-			     ./kml/KML_Overlay.h\
+-			     ./kml/KML_Point.cpp\
+-			     ./kml/KML_Point.h\
+-			     ./kml/KML_Placemark.cpp\
+-			     ./kml/KML_Placemark.h\
+-			     ./kml/KML_Polygon.cpp\
+-			     ./kml/KML_Polygon.h\
+-			     ./kml/KML_PolyStyle.cpp\
+-			     ./kml/KML_PolyStyle.h\
+-			     ./kml/KML_Style.cpp\
+-			     ./kml/KML_Style.h\
+-			     ./kml/KML_StyleSelector.cpp\
+-			     ./kml/KML_StyleSelector.h\
+-			     ./kml/KML_SubStyle.cpp\
+-			     ./kml/KML_SubStyle.h\
+-			     ./kml/KML_Unknown.cpp\
+-			     ./kml/KML_Unknown.h\
+-			     ./kml/KMLFileReadUtils.cpp\
+-			     ./kml/KMLFileReadUtils.h
+-#}}}
+ #Petsc sources  {{{
+-petsc_sources= ./toolkits/petsc\
++if PETSC
++issm_sources += ./toolkits/petsc\
+ 					./toolkits/petsc/patches\
+ 					./toolkits/petsc/patches/SolverEnum.h\
+ 					./toolkits/petsc/patches/petscpatches.h\
+@@ -761,26 +482,283 @@
+ 					./toolkits/petsc/objects/PetscSolver.cpp\
+ 					./toolkits/petsc/objects/PetscSolver.h\
+ 					./toolkits/petsc/petscincludes.h
+-
++endif
+ #}}}
+ #Mumps sources  {{{
+-mumps_sources=      ./toolkits/mumps\
++if MUMPS
++issm_sources += ./toolkits/mumps\
+ 					./toolkits/mumps/mumpsincludes.h\
+ 					./toolkits/mumps/MumpsSolve.cpp
++endif
+ #}}}
+ #Gsl sources  {{{
+-gsl_sources=      ./toolkits/gsl\
++if GSL
++issm_sources += ./toolkits/gsl\
+ 					./toolkits/gsl/gslincludes.h\
+ 					./toolkits/gsl/DenseGslSolve.cpp
++endif
+ #}}}
++#Analyses{{{
++if ADJOINTBALANCETHICKNESS
++issm_sources += ./analyses/AdjointBalancethicknessAnalysis.cpp
++endif
++if ADJOINTHORIZ
++issm_sources += ./analyses/AdjointHorizAnalysis.cpp
++endif
++if BALANCETHICKNESS
++issm_sources += ./analyses/BalancethicknessAnalysis.cpp
++endif
++if BALANCETHICKNESSSOFT
++issm_sources += ./analyses/BalancethicknessSoftAnalysis.cpp
++endif
++if BALANCEVELOCITY
++issm_sources += ./analyses/BalancevelocityAnalysis.cpp
++endif
++if L2PROJECTIONBASE
++issm_sources += ./analyses/L2ProjectionBaseAnalysis.cpp
++endif
++if DAMAGEEVOLUTION
++issm_sources += ./analyses/DamageEvolutionAnalysis.cpp
++endif
++if STRESSBALANCE
++issm_sources += ./analyses/StressbalanceAnalysis.cpp
++endif
++if STRESSBALANCESIA
++issm_sources += ./analyses/StressbalanceSIAAnalysis.cpp
++endif
++if STRESSBALANCEVERTICAL
++issm_sources += ./analyses/StressbalanceVerticalAnalysis.cpp
++endif
++if ENTHALPY
++issm_sources += ./analyses/EnthalpyAnalysis.cpp
++endif
++if HYDROLOGYSHREVE
++issm_sources += ./analyses/HydrologyShreveAnalysis.cpp
++endif
++if HYDROLOGYDCINEFFICIENT
++issm_sources += ./analyses/HydrologyDCInefficientAnalysis.cpp
++endif
++if HYDROLOGYDCEFFICIENT
++issm_sources += ./analyses/HydrologyDCEfficientAnalysis.cpp
++endif
++if MELTING
++issm_sources += ./analyses/MeltingAnalysis.cpp
++endif
++if MASSTRANSPORT
++issm_sources += ./analyses/MasstransportAnalysis.cpp
++endif
++if FREESURFACEBASE
++issm_sources += ./analyses/FreeSurfaceBaseAnalysis.cpp
++endif
++if FREESURFACETOP
++issm_sources += ./analyses/FreeSurfaceTopAnalysis.cpp
++endif
++if EXTRUDEFROMBASE
++issm_sources += ./analyses/ExtrudeFromBaseAnalysis.cpp
++endif
++if EXTRUDEFROMTOP
++issm_sources += ./analyses/ExtrudeFromTopAnalysis.cpp
++endif
++if THERMAL
++issm_sources += ./analyses/ThermalAnalysis.cpp
++endif
++if MESHDEFORMATION
++issm_sources += ./analyses/MeshdeformationAnalysis.cpp
++endif
++if LEVELSET
++issm_sources += ./analyses/LevelsetAnalysis.cpp
++endif
++if EXTRAPOLATION
++issm_sources += ./analyses/ExtrapolationAnalysis.cpp
++endif
++#}}}
++#Gia sources  {{{
++if GIA
++issm_sources +=  ./cores/gia_core.cpp\
++					./analyses/GiaAnalysis.cpp\
++					./modules/GiaDeflectionCorex/GiaDeflectionCorex.cpp\
++					./modules/GiaDeflectionCorex/distme.f\
++					./modules/GiaDeflectionCorex/freed.f\
++					./modules/GiaDeflectionCorex/ojrule.f\
++					./modules/GiaDeflectionCorex/pwise.f\
++					./modules/GiaDeflectionCorex/qwise.f\
++					./modules/GiaDeflectionCorex/stot.f\
++					./modules/GiaDeflectionCorex/what0.f
++endif
++#}}}
+ #Mpi sources  {{{
+-mpi_sources= ./toolkits/issm/IssmMpiDenseMat.h\
+-				./toolkits/issm/IssmMpiVec.h
++if MPI
++issm_sources += ./toolkits/issm/IssmMpiDenseMat.h\
++					 ./toolkits/issm/IssmMpiVec.h
++endif
+ #}}}
+ #Metis sources  {{{
+-metis_sources= ./toolkits/metis/patches/metispatches.h\
++if METIS
++issm_sources += ./toolkits/metis/patches/metispatches.h\
+ 					./toolkits/metis/patches/METIS_PartMeshNodalPatch.cpp
++endif
+ #}}}
++
++#Wrapper sources
++#Bamg sources  {{{
++bamg_sources =  ./bamg/bamgobjects.h\
++					 ./bamg/BamgGeom.h\
++					 ./bamg/BamgGeom.cpp\
++					 ./bamg/BamgMesh.h\
++					 ./bamg/BamgMesh.cpp\
++					 ./bamg/BamgOpts.h\
++					 ./bamg/BamgOpts.cpp\
++					 ./bamg/CrackedEdge.h\
++					 ./bamg/CrackedEdge.cpp\
++					 ./bamg/Curve.h\
++					 ./bamg/Curve.cpp\
++					 ./bamg/Direction.h\
++					 ./bamg/Direction.cpp\
++					 ./bamg/DoubleAndInt.h\
++					 ./bamg/Edge.h\
++					 ./bamg/Edge.cpp\
++					 ./bamg/GeomEdge.h\
++					 ./bamg/GeomEdge.cpp\
++					 ./bamg/GeomSubDomain.h\
++					 ./bamg/GeomSubDomain.cpp\
++					 ./bamg/GeomVertex.h\
++					 ./bamg/GeomVertex.cpp\
++					 ./bamg/Geometry.cpp\
++					 ./bamg/Geometry.h\
++					 ./bamg/ListofIntersectionTriangles.cpp\
++					 ./bamg/ListofIntersectionTriangles.h\
++					 ./bamg/EigenMetric.cpp\
++					 ./bamg/Metric.cpp\
++					 ./bamg/Metric.h\
++					 ./bamg/BamgQuadtree.cpp\
++					 ./bamg/BamgQuadtree.h\
++					 ./bamg/R2.h\
++					 ./bamg/SetOfE4.cpp\
++					 ./bamg/SetOfE4.h\
++					 ./bamg/SubDomain.h\
++					 ./bamg/SubDomain.cpp\
++					 ./bamg/AdjacentTriangle.h\
++					 ./bamg/AdjacentTriangle.cpp\
++					 ./bamg/Triangle.cpp\
++					 ./bamg/det.h \
++					 ./bamg/Triangle.h\
++					 ./bamg/BamgVertex.cpp\
++					 ./bamg/BamgVertex.h\
++					 ./bamg/VertexOnEdge.h\
++					 ./bamg/VertexOnEdge.cpp\
++					 ./bamg/VertexOnGeom.h\
++					 ./bamg/VertexOnGeom.cpp\
++					 ./bamg/VertexOnVertex.h\
++					 ./bamg/VertexOnVertex.cpp\
++					 ./bamg/Mesh.cpp\
++					 ./bamg/Mesh.h\
++					 ./shared/Bamg/Abs.h \
++					 ./shared/Bamg/BigPrimeNumber.h\
++					 ./shared/Bamg/BigPrimeNumber.cpp\
++					 ./shared/Bamg/BinaryRand.h \
++					 ./shared/Bamg/Exchange.h \
++					 ./shared/Bamg/extrema.h \
++					 ./shared/Bamg/HeapSort.h \
++					 ./shared/Bamg/OppositeAngle.h \
++					 ./modules/Bamgx/Bamgx.cpp\
++					 ./modules/Bamgx/Bamgx.h\
++					 ./modules/BamgConvertMeshx/BamgConvertMeshx.cpp\
++					 ./modules/BamgConvertMeshx/BamgConvertMeshx.h\
++					 ./modules/BamgTriangulatex/BamgTriangulatex.cpp\
++					 ./modules/BamgTriangulatex/BamgTriangulatex.h
++#}}}
++#Kriging sources  {{{
++if KRIGING
++kriging_sources = ./classes/kriging/Observations.h\
++					./classes/kriging/Observations.cpp\
++					./classes/kriging/Variogram.h \
++					./classes/kriging/GaussianVariogram.h\
++					./classes/kriging/GaussianVariogram.cpp\
++					./classes/kriging/ExponentialVariogram.h\
++					./classes/kriging/ExponentialVariogram.cpp\
++					./classes/kriging/SphericalVariogram.h\
++					./classes/kriging/SphericalVariogram.cpp\
++					./classes/kriging/PowerVariogram.h\
++					./classes/kriging/PowerVariogram.cpp\
++					./classes/kriging/Quadtree.h\
++					./classes/kriging/Quadtree.cpp\
++					./classes/kriging/Observation.h\
++					./classes/kriging/Observation.cpp\
++					./modules/Krigingx/Krigingx.cpp\
++					./modules/Krigingx/Krigingx.h
++issm_sources +=$(kriging_sources)
++issm_sources +=./modules/Krigingx/pKrigingx.cpp
++endif
++#}}}
++#Kml sources  {{{
++kml_sources = ./modules/Exp2Kmlx/Exp2Kmlx.h\
++				  ./modules/Exp2Kmlx/Exp2Kmlx.cpp\
++				  ./modules/Kml2Expx/Kml2Expx.h\
++				  ./modules/Kml2Expx/Kml2Expx.cpp\
++				  ./modules/Shp2Kmlx/Shp2Kmlx.h\
++				  ./modules/Shp2Kmlx/Shp2Kmlx.cpp\
++				  ./modules/KMLFileReadx/KMLFileReadx.h\
++				  ./modules/KMLFileReadx/KMLFileReadx.cpp\
++				  ./modules/KMLMeshWritex/KMLMeshWritex.h\
++				  ./modules/KMLMeshWritex/KMLMeshWritex.cpp\
++				  ./modules/KMLOverlayx/KMLOverlayx.h\
++				  ./modules/KMLOverlayx/KMLOverlayx.cpp\
++				  ./kml/kmlobjects.h\
++				  ./kml/KML_Attribute.cpp\
++				  ./kml/KML_Attribute.h\
++				  ./kml/KML_Comment.cpp\
++				  ./kml/KML_Comment.h\
++				  ./kml/KML_ColorStyle.cpp\
++				  ./kml/KML_ColorStyle.h\
++				  ./kml/KML_Container.cpp\
++				  ./kml/KML_Container.h\
++				  ./kml/KML_Document.cpp\
++				  ./kml/KML_Document.h\
++				  ./kml/KML_Feature.cpp\
++				  ./kml/KML_Feature.h\
++				  ./kml/KML_File.cpp\
++				  ./kml/KML_File.h\
++				  ./kml/KML_Folder.cpp\
++				  ./kml/KML_Folder.h\
++				  ./kml/KML_Geometry.cpp\
++				  ./kml/KML_Geometry.h\
++				  ./kml/KML_GroundOverlay.cpp\
++				  ./kml/KML_GroundOverlay.h\
++				  ./kml/KML_Icon.cpp\
++				  ./kml/KML_Icon.h\
++				  ./kml/KML_LatLonBox.cpp\
++				  ./kml/KML_LatLonBox.h\
++				  ./kml/KML_LinearRing.cpp\
++				  ./kml/KML_LinearRing.h\
++				  ./kml/KML_LineString.cpp\
++				  ./kml/KML_LineString.h\
++				  ./kml/KML_LineStyle.cpp\
++				  ./kml/KML_LineStyle.h\
++				  ./kml/KML_MultiGeometry.cpp\
++				  ./kml/KML_MultiGeometry.h\
++				  ./kml/KML_Object.cpp\
++				  ./kml/KML_Object.h\
++				  ./kml/KML_Overlay.cpp\
++				  ./kml/KML_Overlay.h\
++				  ./kml/KML_Point.cpp\
++				  ./kml/KML_Point.h\
++				  ./kml/KML_Placemark.cpp\
++				  ./kml/KML_Placemark.h\
++				  ./kml/KML_Polygon.cpp\
++				  ./kml/KML_Polygon.h\
++				  ./kml/KML_PolyStyle.cpp\
++				  ./kml/KML_PolyStyle.h\
++				  ./kml/KML_Style.cpp\
++				  ./kml/KML_Style.h\
++				  ./kml/KML_StyleSelector.cpp\
++				  ./kml/KML_StyleSelector.h\
++				  ./kml/KML_SubStyle.cpp\
++				  ./kml/KML_SubStyle.h\
++				  ./kml/KML_Unknown.cpp\
++				  ./kml/KML_Unknown.h\
++				  ./kml/KMLFileReadUtils.cpp\
++				  ./kml/KMLFileReadUtils.h
++#}}}
+ #Modules sources{{{
+ modules_sources= ./shared/Threads/issm_threads.h\
+ 			./shared/Threads/LaunchThread.cpp\
+@@ -846,110 +824,6 @@
+ 						./modules/Scotchx/Scotchx.h
+ endif
+ #}}}
+-
+-#{{{ Conditional build-up of sources
+-#ISSM sources are a combination of core sources and sources related to specific capabilities (which can 
+-#be activated by autotools conditionals 
+-
+-#First the core
+-issm_sources  =  $(core_sources)
+-
+-#Now the optional source
+-if DAKOTA
+-issm_sources  +=  $(dakota_sources)
+-endif
+-
+-if PETSC
+-issm_sources  +=  $(petsc_sources)
+-endif
+-
+-if MUMPS
+-issm_sources  +=  $(mumps_sources)
+-endif
+-
+-if GSL
+-issm_sources  +=  $(gsl_sources)
+-endif
+-
+-if TRANSIENT
+-issm_sources  +=  $(transient_sources)
+-endif
+-
+-if STEADYSTATE
+-issm_sources  +=  $(steadystate_sources)
+-endif
+-
+-if MASSTRANSPORT
+-issm_sources  +=  $(masstransport_sources)
+-endif
+-
+-if THERMAL
+-issm_sources  +=  $(thermal_sources)
+-endif
+-
+-if GIA
+-issm_sources  +=  $(gia_sources)
+-endif
+-
+-if CONTROL
+-issm_sources  +=  $(control_sources)
+-endif
+-
+-if HYDROLOGY
+-issm_sources  +=  $(hydrology_sources)
+-endif
+-
+-if STRESSBALANCE
+-issm_sources  +=  $(stressbalance_sources)
+-endif
+-
+-if BALANCED
+-issm_sources  +=  $(balanced_sources)
+-endif
+-
+-if SLOPE
+-issm_sources  +=  $(slope_sources)
+-endif
+-
+-if MESHDEFORMATION
+-issm_sources  +=  $(meshdeformation_sources)
+-endif
+-
+-if GROUNDINGLINE
+-issm_sources +=  $(groundingline_sources)
+-endif
+-
+-if RIFTS
+-issm_sources +=  $(rifts_sources)
+-endif
+-
+-if RESPONSES
+-issm_sources +=  $(responses_sources)
+-endif
+-
+-if ANDROID
+-issm_sources +=  $(android_sources)
+-endif
+-
+-if THREED
+-issm_sources +=  $(threed_sources)
+-endif
+-
+-if MPI
+-issm_sources +=  $(mpi_sources)
+-endif
+-
+-if METIS
+-issm_sources +=  $(metis_sources)
+-endif
+-
+-if KRIGING
+-issm_sources +=  $(pkriging_sources)
+-endif
+-
+-if DAMAGE
+-issm_sources +=  $(damage_sources)
+-endif
+ #}}}
+ #Library flags and sources {{{
+ ALLCXXFLAGS= -fPIC -D_GNU_SOURCE -fno-omit-frame-pointer -pthread -D_CPP_  $(CXXFLAGS) $(CXXOPTFLAGS) 
+@@ -970,9 +844,6 @@
+ if WRAPPERS
+ libISSMModules_a_SOURCES = $(modules_sources)
+ libISSMModules_a_SOURCES += $(bamg_sources)
+-if KRIGING
+-libISSMModules_a_SOURCES += $(kriging_sources)
+-endif
+ if KML
+ libISSMModules_a_SOURCES += $(kml_sources)
+ endif
+@@ -1025,7 +896,7 @@
+ kriging_CXXFLAGS= -fPIC $(CXXFLAGS) $(CXXOPTFLAGS) $(COPTFLAGS) 
+ endif
+ #}}}
+-#Automatic differentiation: append this fold to the end of the src/c/Makefile.am to get this Makefile.am {{{
++#Automatic differentiation (must be done at the end) {{{
+ if ADIC2 
+ lib_LIBRARIES += libAD.a libISSMRose.a
+ 
+@@ -1034,21 +905,16 @@
+ libAD_a_SOURCES = 
+ libAD_a_CFLAGS = -fPIC -D_C_ $(COPTFLAGS)
+ 
+-
+ #test rose preprocessing 
+ %.r2cpp.cpp : %.cpp
+ 	testTranslator -rose:o $@ -rose:skipfinalCompileStep -DHAVE_CONFIG_H -D_C_ -I. -I../.. $(INCLUDES) $<
+ libISSMRose_a_SOURCES = $(libISSMCore_a_SOURCES:.cpp=.r2cpp.cpp)
+ libISSMRose_a_CXXFLAGS= -fPIC -D_C_ $(CXXOPTFLAGS)
+ 
+-
+-
+ #Automatic differentiation rules: 
+ %.ad.c: %.c
+ 	adic2 -mforward  $< --nary
+ 
+-
+-
+ #Executable
+ bin_PROGRAMS +=  issmRose.exe
+ issmRose_exe_LDADD = ./libISSMRose.a $(LDADD)
+Index: ../trunk-jpl/src/c/cores/CorePointerFromSolutionEnum.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/CorePointerFromSolutionEnum.cpp	(revision 17235)
++++ ../trunk-jpl/src/c/cores/CorePointerFromSolutionEnum.cpp	(revision 17236)
+@@ -23,98 +23,48 @@
+ 	switch(solutiontype){
+ 
+ 		case StressbalanceSolutionEnum:
+-			#ifdef _HAVE_STRESSBALANCE_
+ 			solutioncore=&stressbalance_core;
+-			#else
+-			_error_("ISSM was not compiled with stressbalance capabilities. Exiting");
+-			#endif
+ 			break;
+ 		case SteadystateSolutionEnum:
+-			#ifdef _HAVE_STEADYSTATE_
+ 			solutioncore=&steadystate_core;
+-			#else
+-			_error_("ISSM was not compiled with steady state capabilities. Exiting");
+-			#endif
+ 			break;
+ 		case ThermalSolutionEnum:
+-			#ifdef _HAVE_THERMAL_
+ 			solutioncore=&thermal_core;
+-			#else
+-			_error_("ISSM was not compiled with thermal capabilities. Exiting");
+-			#endif
+ 			break;
+ 		case BalancethicknessSolutionEnum:
+-			#ifdef _HAVE_BALANCED_
+ 			solutioncore=&balancethickness_core;
+-			#else
+-			_error_("ISSM was not compiled with balanced capabilities. Exiting");
+-			#endif
+ 			break;
+ 		case BalancethicknessSoftSolutionEnum:
+-			#ifdef _HAVE_BALANCED_
+ 			solutioncore=&dummy_core;
+-			#else
+-			_error_("ISSM was not compiled with balanced capabilities. Exiting");
+-			#endif
+ 			break;
+ 		case BalancevelocitySolutionEnum:
+-			#ifdef _HAVE_BALANCED_
+ 			solutioncore=&balancevelocity_core;
+-			#else
+-			_error_("ISSM was not compiled with balanced capabilities. Exiting");
+-			#endif
+ 			break;
+ 		case HydrologySolutionEnum:
+-			#ifdef _HAVE_HYDROLOGY_
+ 			solutioncore=&hydrology_core;
+-			#else
+-			_error_("ISSM was not compiled with hydrology capabilities. Exiting");
+-			#endif
+ 			break;
+ 		case SurfaceSlopeSolutionEnum:
+-			#ifdef _HAVE_SLOPE_
+ 			solutioncore=&surfaceslope_core;
+-			#else
+-			_error_("ISSM was not compiled with slope capabilities. Exiting");
+-			#endif
+ 			break;
+ 		case BedSlopeSolutionEnum:
+-			#ifdef _HAVE_SLOPE_
+ 			solutioncore=&bedslope_core;
+-			#else
+-			_error_("ISSM was not compiled with slope capabilities. Exiting");
+-			#endif
+ 			break;
+ 		case TransientSolutionEnum:
+-			#ifdef _HAVE_TRANSIENT_
+ 			solutioncore=&transient_core;
+-			#else
+-			_error_("ISSM was not compiled with transient capabilities. Exiting");
+-			#endif
+ 			break;
+ 		case MasstransportSolutionEnum:
+-			#ifdef _HAVE_MASSTRANSPORT_
+ 			solutioncore=&masstransport_core;
+-			#else
+-			_error_("ISSM was not compiled with masstransport capabilities. Exiting");
+-			#endif
+ 			break;
+-
+ 		case GiaSolutionEnum:
+-			#ifdef _HAVE_GIA_
++			#if _HAVE_GIA_
+ 			solutioncore=&gia_core;
+ 			#else
+-			_error_("ISSM was not compiled with gia capabilities. Exiting");
++			_error_("ISSM not compiled with Gia capability");
+ 			#endif
+ 			break;
+ 		case DamageEvolutionSolutionEnum:
+-			#ifdef _HAVE_DAMAGE_
+ 			solutioncore=&damage_core;
+-			#else
+-			_error_("ISSM was not compiled with damage evolution capabilities. Exiting");
+-			#endif
+ 			break;
+-
+ 		default:
+ 			_error_("solution type: " << EnumToStringx(solutiontype) << " not supported yet!");
+ 			break;
+@@ -123,5 +73,4 @@
+ 	/*Assign output pointer:*/
+ 	_assert_(psolutioncore);
+ 	*psolutioncore=solutioncore;
+-
+ }
+Index: ../trunk-jpl/src/c/cores/transient_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17235)
++++ ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17236)
+@@ -114,20 +114,12 @@
+ 
+ 		if(isthermal && meshtype==Mesh3DEnum){
+ 			if(VerboseSolution()) _printf0_("   computing thermal regime\n");
+-			#ifdef _HAVE_THERMAL_
+ 			thermal_core(femmodel);
+-			#else
+-			_error_("ISSM was not compiled with thermal capabilities. Exiting");
+-			#endif
+ 		}
+ 
+ 		if(isstressbalance){
+ 			if(VerboseSolution()) _printf0_("   computing new velocity\n");
+-			#ifdef _HAVE_STRESSBALANCE_
+ 			stressbalance_core(femmodel);
+-			#else
+-			_error_("ISSM was not compiled with stressbalance capabilities. Exiting");
+-			#endif
+ 		}
+ 
+ 		if(ismasstransport){
+@@ -139,11 +131,7 @@
+ 
+ 		if(isgroundingline){
+ 			if(VerboseSolution()) _printf0_("   computing new grounding line position\n");
+-			#ifdef _HAVE_GROUNDINGLINE_
+ 			GroundinglineMigrationx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
+-			#else
+-			_error_("ISSM was not compiled with grounding line migration capabilities. Exiting");
+-			#endif
+ 			if(save_results){
+ 				int outputs[3] = {SurfaceEnum,BedEnum,MaskGroundediceLevelsetEnum};
+ 				femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],3);
+Index: ../trunk-jpl/src/c/cores/WrapperCorePointerFromSolutionEnum.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/WrapperCorePointerFromSolutionEnum.cpp	(revision 17235)
++++ ../trunk-jpl/src/c/cores/WrapperCorePointerFromSolutionEnum.cpp	(revision 17236)
+@@ -41,12 +41,8 @@
+ 		#endif
+ 	}
+ 	else if(control_analysis){
+-		#ifdef _HAVE_CONTROL_
+ 		if(tao_analysis) solutioncore=controltao_core;
+ 		else solutioncore=control_core;
+-		#else
+-		_error_("ISSM was not compiled with control support, cannot carry out control analysis!");
+-		#endif
+ 	}
+ 	else CorePointerFromSolutionEnum(&solutioncore,parameters,solutiontype);  /*This means we retrieve a core solution that is not a wrapper*/
+ 
+Index: ../trunk-jpl/src/c/cores/steadystate_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/steadystate_core.cpp	(revision 17235)
++++ ../trunk-jpl/src/c/cores/steadystate_core.cpp	(revision 17236)
+@@ -49,13 +49,9 @@
+ 	for(;;){
+ 
+ 		if(VerboseSolution()) _printf0_("   computing temperature and velocity for step: " << step << "\n");
+-		#ifdef _HAVE_THERMAL_
+ 		thermal_core(femmodel);
+ 		if(!isenthalpy)femmodel->SetCurrentConfiguration(ThermalAnalysisEnum);/*Could be MeltingAnalysis...*/
+ 		GetSolutionFromInputsx(&tg,femmodel);
+-		#else
+-		_error_("ISSM was not compiled with thermal capabilities. Exiting");
+-		#endif
+ 
+ 		if(VerboseSolution()) _printf0_("   computing new velocity\n");
+ 		stressbalance_core(femmodel);
+Index: ../trunk-jpl/src/c/classes/Materials/Matice.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 17235)
++++ ../trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 17236)
+@@ -762,14 +762,12 @@
+ 					this->inputs->AddInput(new TriaInput(name,values,P1Enum));
+ 					return;
+ 				}
+-				#ifdef _HAVE_3D_
+ 				case PentaEnum: {
+ 					IssmDouble valuesp[6];
+ 					for (int i=0;i<6;i++) valuesp[i]=vector[((Penta*)element)->vertices[i]->Sid()]; //use sid list, to index into serial oriented vector
+ 					this->inputs->AddInput(new PentaInput(name,valuesp,P1Enum));
+ 					return;
+ 				}
+-			  	#endif
+ 				default: _error_("element " << EnumToStringx(element->ObjectEnum()) << " not implemented yet");
+ 			}
+ 		default: _error_("type " << type << " (" << EnumToStringx(type) << ") not implemented yet");
+@@ -818,14 +816,12 @@
+ 					/*}}}*/
+ 					return;
+ 				}
+-				#ifdef _HAVE_3D_
+ 				case PentaEnum:{
+ 					IssmDouble valuesp[6];
+ 					for (int i=0;i<6;i++) valuesp[i]=vector[((Penta*)element)->vertices[i]->Sid()]; //use sid list, to index into serial oriented vector
+ 					this->inputs->AddInput(new PentaInput(name,valuesp,P1Enum));
+ 					return;
+ 				}
+-				# endif
+ 				default: _error_("element " << EnumToStringx(element->ObjectEnum()) << " not implemented yet");
+ 			}
+ 		default: _error_("type " << type << " (" << EnumToStringx(type) << ") not implemented yet");
+@@ -891,7 +887,6 @@
+ 		}
+ 
+ 		/*Control Inputs*/
+-		#ifdef _HAVE_CONTROL_
+ 		if (control_analysis && iomodel->Data(InversionControlParametersEnum)){
+ 			for(i=0;i<num_control_type;i++){
+ 				switch(reCast<int>(iomodel->Data(InversionControlParametersEnum)[i])){
+@@ -916,7 +911,6 @@
+ 				}
+ 			}
+ 		}
+-		#endif
+ 	}
+ 	else if(iomodel->meshtype==Mesh2DverticalEnum){
+ 
+@@ -944,7 +938,6 @@
+ 			this->inputs->AddInput(new TriaInput(DamageDEnum,nodeinputs,P1Enum));
+ 		}
+ 	}
+-	#ifdef _HAVE_3D_
+ 	else if(iomodel->meshtype==Mesh3DEnum){
+ 
+ 		/*Intermediaries*/
+@@ -972,7 +965,6 @@
+ 		}
+ 		
+ 		/*Control Inputs*/
+-		#ifdef _HAVE_CONTROL_
+ 		if (control_analysis && iomodel->Data(InversionControlParametersEnum)){
+ 			for(i=0;i<num_control_type;i++){
+ 				switch(reCast<int>(iomodel->Data(InversionControlParametersEnum)[i])){
+@@ -998,9 +990,7 @@
+ 				}
+ 			}
+ 		}
+-		#endif
+ 	}
+-	#endif
+ 	else{
+ 		_error_("Mesh type not supported yet!");
+ 	}
+Index: ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 17235)
++++ ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 17236)
+@@ -229,24 +229,18 @@
+ 	this->parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+ 
+ 	switch(analysis_type){
+-		#ifdef _HAVE_THERMAL_
+ 		case ThermalAnalysisEnum:
+ 			Ke=PenaltyCreateKMatrixThermal(kmax);
+ 			break;
+ 		case MeltingAnalysisEnum:
+ 			Ke=PenaltyCreateKMatrixMelting(kmax);
+ 			break;
+-		#endif
+-		#ifdef _HAVE_HYDROLOGY_
+ 		case HydrologyDCInefficientAnalysisEnum:
+ 			Ke=PenaltyCreateKMatrixHydrologyDCInefficient(kmax);
+ 			break;
+-		#endif
+-		#ifdef _HAVE_DAMAGE_
+ 		case DamageEvolutionAnalysisEnum:
+ 			Ke=PenaltyCreateKMatrixDamageEvolution(kmax);
+ 			break;
+-		#endif
+ 		default:
+ 			_error_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet");
+ 	}
+@@ -267,7 +261,6 @@
+ 	this->parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+ 
+ 	switch(analysis_type){
+-		#ifdef _HAVE_THERMAL_
+ 		case ThermalAnalysisEnum:
+ 			pe=PenaltyCreatePVectorThermal(kmax);
+ 			break;
+@@ -276,18 +269,12 @@
+ 			break;
+ 		case StressbalanceAnalysisEnum: case AdjointHorizAnalysisEnum:
+ 			break;
+-		#endif
+-		#ifdef _HAVE_HYDROLOGY_
+ 		case HydrologyDCInefficientAnalysisEnum:
+ 			pe=PenaltyCreatePVectorHydrologyDCInefficient(kmax);
+ 			break;
+-		#endif
+-		#ifdef _HAVE_DAMAGE_
+ 		case DamageEvolutionAnalysisEnum:
+ 			pe=PenaltyCreatePVectorDamageEvolution(kmax);
+ 			break;
+-		#endif
+-
+ 		default:
+ 			_error_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet");
+ 	}
+@@ -420,7 +407,6 @@
+ 		/*No penalty to check*/
+ 		return;
+ 	}
+-	#ifdef _HAVE_THERMAL_
+ 	else if (analysis_type==ThermalAnalysisEnum){
+ 		ConstraintActivateThermal(punstable);
+ 	}
+@@ -428,19 +414,14 @@
+ 		/*No penalty to check*/
+ 		return;
+ 	}
+-	#endif
+-	#ifdef _HAVE_HYDROLOGY_
+ 	else if (analysis_type==HydrologyDCInefficientAnalysisEnum){
+ 		ConstraintActivateHydrologyDCInefficient(punstable);
+ 		return;
+ 	}
+-	#endif
+-	#ifdef _HAVE_DAMAGE_
+ 	else if (analysis_type==DamageEvolutionAnalysisEnum){
+ 		ConstraintActivateDamageEvolution(punstable);
+ 		return;
+ 	}
+-	#endif
+ 
+ 	else{
+ 		_error_("analysis: " << EnumToStringx(analysis_type) << " not supported yet");
+@@ -448,7 +429,6 @@
+ 
+ }
+ /*}}}*/
+-#ifdef _HAVE_THERMAL_
+ /*FUNCTION Pengrid::ConstraintActivateThermal {{{*/
+ void  Pengrid::ConstraintActivateThermal(int* punstable){
+ 
+@@ -628,8 +608,6 @@
+ 	return pe;
+ }
+ /*}}}*/
+-#endif
+-#ifdef _HAVE_HYDROLOGY_
+ /*FUNCTION Pengrid::ConstraintActivateHydrologyDCInefficient{{{*/
+ void  Pengrid::ConstraintActivateHydrologyDCInefficient(int* punstable){
+ 
+@@ -727,8 +705,6 @@
+ 	return pe;
+ }
+ /*}}}*/
+-#endif
+-#ifdef _HAVE_DAMAGE_
+ /*FUNCTION Pengrid::ConstraintActivateDamageEvolution {{{*/
+ void  Pengrid::ConstraintActivateDamageEvolution(int* punstable){
+ 
+@@ -827,8 +803,6 @@
+ 	return pe;
+ }
+ /*}}}*/
+-#endif
+-
+ /*FUNCTION Pengrid::ResetConstraint {{{*/
+ void  Pengrid::ResetConstraint(void){
+ 	active         = 0;
+Index: ../trunk-jpl/src/c/classes/Loads/Pengrid.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Pengrid.h	(revision 17235)
++++ ../trunk-jpl/src/c/classes/Loads/Pengrid.h	(revision 17236)
+@@ -82,24 +82,17 @@
+ 		bool  InAnalysis(int analysis_type);
+ 		/*}}}*/
+ 		/*Pengrid management {{{*/
+-		#ifdef _HAVE_THERMAL_
+ 		ElementMatrix* PenaltyCreateKMatrixThermal(IssmDouble kmax);
+ 		ElementMatrix* PenaltyCreateKMatrixMelting(IssmDouble kmax);
+ 		ElementVector* PenaltyCreatePVectorThermal(IssmDouble kmax);
+ 		ElementVector* PenaltyCreatePVectorMelting(IssmDouble kmax);
+ 		void           ConstraintActivateThermal(int* punstable);
+-		#endif
+-		#ifdef _HAVE_DAMAGE_
+ 		ElementMatrix* PenaltyCreateKMatrixDamageEvolution(IssmDouble kmax);
+ 		ElementVector* PenaltyCreatePVectorDamageEvolution(IssmDouble kmax);
+ 		void           ConstraintActivateDamageEvolution(int* punstable);
+-		#endif
+-
+-		#ifdef _HAVE_HYDROLOGY_
+ 		ElementMatrix* PenaltyCreateKMatrixHydrologyDCInefficient(IssmDouble kmax);
+ 		ElementVector* PenaltyCreatePVectorHydrologyDCInefficient(IssmDouble kmax);
+ 		void           ConstraintActivateHydrologyDCInefficient(int* punstable);
+-		#endif
+ 		void  ConstraintActivate(int* punstable);
+ 		void  ResetConstraint(void);
+ 		/*}}}*/
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17235)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17236)
+@@ -427,7 +427,6 @@
+ 
+ 	switch (response_descriptor_enum){
+ 
+-		#ifdef _HAVE_RESPONSES_
+ 		case IceVolumeEnum:                this->IceVolumex(responses); break;
+ 		case IceVolumeAboveFloatationEnum: this->IceVolumeAboveFloatationx(responses); break;
+ 		case MinVelEnum:                   this->MinVelx(responses); break;
+@@ -442,7 +441,6 @@
+ 		case MaxVzEnum:                    this->MaxVzx(                   responses); break;
+ 		case MaxAbsVzEnum:                 this->MaxAbsVzx(                responses); break;
+ 		case MassFluxEnum:                 this->MassFluxx(         responses); break;
+-		#ifdef _HAVE_CONTROL_
+ 		case SurfaceAbsVelMisfitEnum:      SurfaceAbsVelMisfitx(responses, elements,nodes, vertices, loads, materials,parameters); break;
+ 		case SurfaceRelVelMisfitEnum:      SurfaceRelVelMisfitx(responses, elements,nodes, vertices, loads, materials,parameters); break;
+ 		case SurfaceLogVelMisfitEnum:      SurfaceLogVelMisfitx(responses, elements,nodes, vertices, loads, materials,parameters); break;
+@@ -455,15 +453,10 @@
+ 		case RheologyBbarAbsGradientEnum:  RheologyBbarAbsGradientx(responses, elements,nodes, vertices, loads, materials, parameters); break;
+ 		case DragCoefficientAbsGradientEnum:DragCoefficientAbsGradientx(responses, elements,nodes, vertices, loads, materials, parameters); break;
+ 		case BalancethicknessMisfitEnum:   BalancethicknessMisfitx(responses); break;
+-		#endif
+ 		case TotalSmbEnum:					  this->TotalSmbx(responses); break;
+ 		case MaterialsRheologyBbarEnum:    this->ElementResponsex(responses,MaterialsRheologyBbarEnum); break;
+ 		case VelEnum:                      this->ElementResponsex(responses,VelEnum); break;
+ 		case FrictionCoefficientEnum:      NodalValuex(responses, FrictionCoefficientEnum,elements,nodes, vertices, loads, materials, parameters); break;
+-		default: _error_("response descriptor \"" << EnumToStringx(response_descriptor_enum) << "\" not supported yet!"); break;
+-		#else
+-		default: _error_("ISSM was not compiled with responses capabilities, exiting!");
+-		#endif
+ 	}
+ 
+ }
+@@ -504,7 +497,6 @@
+ 		else{
+ 			switch(output_enum){
+ 
+-				#ifdef _HAVE_RESPONSES_
+ 				/*Scalar output*/
+ 				case IceVolumeEnum:                this->IceVolumex(&double_result);                break;
+ 				case IceVolumeAboveFloatationEnum: this->IceVolumeAboveFloatationx(&double_result); break;
+@@ -523,7 +515,6 @@
+ 				case TotalSmbEnum:                 this->TotalSmbx(&double_result);                 break;
+ 
+ 			   /*Scalar control output*/
+-				#ifdef _HAVE_CONTROL_
+ 				case SurfaceAbsVelMisfitEnum:       SurfaceAbsVelMisfitx(&double_result,elements,nodes,vertices,loads,materials,parameters);        break;
+ 				case SurfaceRelVelMisfitEnum:       SurfaceRelVelMisfitx(&double_result,elements,nodes,vertices,loads,materials,parameters);        break;
+ 				case SurfaceLogVelMisfitEnum:       SurfaceLogVelMisfitx(&double_result,elements,nodes,vertices,loads,materials,parameters);        break;
+@@ -536,7 +527,6 @@
+ 				case RheologyBbarAbsGradientEnum:   RheologyBbarAbsGradientx(&double_result,elements,nodes,vertices,loads,materials,parameters);    break;
+ 				case DragCoefficientAbsGradientEnum:DragCoefficientAbsGradientx(&double_result,elements,nodes,vertices,loads,materials,parameters); break;
+ 				case BalancethicknessMisfitEnum:    BalancethicknessMisfitx(&double_result);                                                        break;
+-				#endif
+ 
+ 			   /*Vector */
+ 				default:
+@@ -593,10 +583,6 @@
+ 					}
+ 					isvec = true;
+ 					break;
+-
+-				#else
+-				default: _error_("ISSM was not compiled with responses capabilities, exiting!");
+-				#endif
+ 			}
+ 		}
+ 
+@@ -712,7 +698,6 @@
+ 
+ }
+ /*}}}*/
+-#ifdef _HAVE_RESPONSES_
+ void FemModel::MassFluxx(IssmDouble* pmass_flux){/*{{{*/
+ 
+ 	int          i,j;
+@@ -1123,8 +1108,6 @@
+ 	*presponse=response;
+ 
+ }/*}}}*/
+-#endif
+-#ifdef _HAVE_CONTROL_
+ void FemModel::BalancethicknessMisfitx(IssmDouble* presponse){/*{{{*/
+ 
+ 	IssmDouble J = 0;
+@@ -1247,7 +1230,6 @@
+ 	xDelete<int>(control_type);
+ }
+ /*}}}*/
+-#endif
+ #ifdef  _HAVE_DAKOTA_
+ void FemModel::DakotaResponsesx(double* d_responses,char** responses_descriptors,int numresponsedescriptors,int d_numresponses){/*{{{*/
+ 
+@@ -1360,7 +1342,6 @@
+ }
+ /*}}}*/
+ #endif
+-#ifdef _HAVE_HYDROLOGY_
+ void FemModel::HydrologyEPLupdateDomainx(void){ /*{{{*/
+ 
+ 	Vector<IssmDouble>* mask          = NULL;
+@@ -1442,7 +1423,6 @@
+ 	delete transferg;
+ }
+ /*}}}*/
+-
+ void FemModel::HydrologyEPLThicknessx(void){ /*{{{*/
+ 
+ 	for (int i=0;i<elements->Size();i++){
+@@ -1451,7 +1431,6 @@
+ 	}
+ }
+ /*}}}*/
+-
+ void FemModel::UpdateConstraintsL2ProjectionEPLx(void){ /*{{{*/
+ 
+ 	Vector<IssmDouble>* active        = NULL;
+@@ -1494,4 +1473,3 @@
+ 	this->UpdateConstraintsx();
+ }
+ /*}}}*/
+-#endif
+Index: ../trunk-jpl/src/c/classes/Node.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Node.h	(revision 17235)
++++ ../trunk-jpl/src/c/classes/Node.h	(revision 17236)
+@@ -55,9 +55,7 @@
+ 		void  SetCurrentConfiguration(DataSet* nodes,Vertices* vertices);
+ 		int   Sid(void); 
+ 		int   Lid(void); 
+-#ifdef _HAVE_STRESSBALANCE_
+ 		void  GetCoordinateSystem(IssmDouble* coord_system_out);
+-#endif
+ 		bool  InAnalysis(int analysis_enum);
+ 		int   GetApproximation();
+ 		int   GetNumberOfDofs(int approximation_enum,int setenum);
+@@ -90,7 +88,6 @@
+ int* GetLocalDofList(Node** nodes,int numnodes,int setenum,int approximation);
+ int* GetGlobalDofList(Node** nodes,int numnodes,int setenum,int approximation);
+ int  GetNumberOfDofs(Node** nodes,int numnodes,int setenum,int approximation);
+-#ifdef _HAVE_STRESSBALANCE_
+ void TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes,int numnodes,int cs_enum);
+ void TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes,int numnodes,int* cs_array);
+ void TransformLoadVectorCoord(ElementVector* pe,Node** nodes,int numnodes,int cs_enum);
+@@ -100,6 +97,5 @@
+ void TransformStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes,int numnodes,int cs_enum);
+ void TransformStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes,int numnodes,int* cs_array);
+ void CoordinateSystemTransform(IssmDouble** ptransform,Node** nodes,int numnodes,int* cs_array);
+-#endif
+ 
+ #endif  /* _NODE_H_ */
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17235)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17236)
+@@ -223,7 +223,6 @@
+ 		virtual void   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum)=0;
+ 		virtual void   GetNormalFromLSF(IssmDouble *pnormal)=0;
+ 
+-		#ifdef _HAVE_RESPONSES_
+ 		virtual void   AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part)=0;
+ 		virtual void   MinVel(IssmDouble* pminvel)=0;
+ 		virtual void   MaxVel(IssmDouble* pmaxvel)=0;
+@@ -246,13 +245,11 @@
+ 		virtual IssmDouble MisfitArea(int weightsenum)=0;
+ 		virtual int    VertexConnectivity(int vertexindex)=0;
+ 		virtual void   VerticalSegmentIndices(int** pindices,int* pnumseg)=0;
+-		#endif
+ 
+ 		#ifdef _HAVE_GIA_
+ 		virtual void   GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x,IssmDouble* y)=0;
+ 		#endif
+ 
+-		#ifdef _HAVE_CONTROL_
+ 		virtual void   Gradj(Vector<IssmDouble>* gradient,int control_type,int control_index)=0;
+ 		virtual IssmDouble ThicknessAbsMisfit(void)=0;
+ 		virtual IssmDouble SurfaceAbsVelMisfit(void)=0;
+@@ -273,25 +270,20 @@
+ 		virtual void   GetVectorFromControlInputs(Vector<IssmDouble>* gradient,int control_enum,int control_index,const char* data)=0;
+ 		virtual void   SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index)=0;
+ 		virtual void   InputControlUpdate(IssmDouble scalar,bool save_parameter)=0;
+-		#endif
+ 
+ 		virtual void UpdateConstraintsExtrudeFromBase(void)=0;
+ 		virtual void UpdateConstraintsExtrudeFromTop(void)=0;
+ 
+-		#ifdef _HAVE_HYDROLOGY_
+ 		virtual void GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index)=0;
+ 		virtual void GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode)=0;
+ 		virtual void GetHydrologyTransfer(Vector<IssmDouble>* transfer)=0; 
+ 		virtual void HydrologyEPLGetMask(Vector<IssmDouble>* mask)=0;
+ 		virtual void HydrologyEPLGetActive(Vector<IssmDouble>* active)=0;
+ 		virtual void ComputeEPLThickness(void)=0;
+-		#endif
+ 
+-		#ifdef _HAVE_GROUNDINGLINE_
+ 		virtual void   MigrateGroundingLine(IssmDouble* sheet_ungrounding)=0;
+ 		virtual void   PotentialUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding)=0;
+ 		virtual int    UpdatePotentialUngrounding(IssmDouble* potential_sheet_ungrounding,Vector<IssmDouble>* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf)=0;
+-		#endif
+ 
+ };
+ #endif
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17235)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17236)
+@@ -924,8 +924,8 @@
+ void  Tria::GetNormalFromLSF(IssmDouble *pnormal){/*{{{*/
+ 
+ 	/* Intermediaries */
+-	const int dim=2;
+-	int i,counter;
++	int         i;
++	const int   dim=2;
+ 	IssmDouble* xyz_list = NULL;
+ 	IssmDouble  dlevelset[dim], norm_dlevelset;
+ 	IssmDouble  normal[dim]={0.};
+@@ -934,7 +934,7 @@
+ 	Input* levelset_input=this->GetInput(MaskIceLevelsetEnum); _assert_(levelset_input);
+ 	this->GetVerticesCoordinates(&xyz_list);
+ 	
+-	counter=0;
++	IssmDouble counter=0.;
+ 	Gauss* gauss = this->NewGauss(2);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		/* Get normal on node */
+@@ -945,8 +945,8 @@
+ 		for(i=0;i<dim;i++) normal[i]+=dlevelset[i]/norm_dlevelset;
+ 		counter++;
+ 	}
+-	_assert_(counter>0);
+-	for(i=0;i<dim;i++) normal[i]/counter;
++	_assert_(counter>0.);
++	for(i=0;i<dim;i++) normal[i] = normal[i]/counter;
+ 	
+ 	pnormal=&normal[0];
+ 
+@@ -1355,7 +1355,6 @@
+ 
+ 
+ 	/*Control Inputs*/
+-	#ifdef _HAVE_CONTROL_
+ 	if (control_analysis && iomodel->Data(InversionControlParametersEnum)){
+ 		for(i=0;i<num_control_type;i++){
+ 			switch(reCast<int>(iomodel->Data(InversionControlParametersEnum)[i])){
+@@ -1407,7 +1406,6 @@
+ 			}
+ 		}
+ 	}
+-	#endif
+ 
+ 	/*DatasetInputs*/
+ 	if (control_analysis && iomodel->Data(InversionCostFunctionsCoefficientsEnum)){
+@@ -2383,12 +2381,8 @@
+ 	this->parameters->FindParam(&C,TimesteppingCflCoefficientEnum);
+ 
+ 	/*Get for Vx and Vy, the max of abs value: */
+-	#ifdef _HAVE_RESPONSES_
+ 	this->MaxAbsVx(&maxabsvx);
+ 	this->MaxAbsVy(&maxabsvy);
+-	#else
+-		_error_("ISSM was not compiled with responses compiled in, exiting!");
+-	#endif
+ 
+ 	/* Get node coordinates and dof list: */
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+@@ -2594,7 +2588,6 @@
+ }
+ /*}}}*/
+ 
+-#ifdef _HAVE_RESPONSES_
+ /*FUNCTION Tria::AverageOntoPartition {{{*/
+ void  Tria::AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part){
+ 
+@@ -3071,7 +3064,6 @@
+ 	return Jelem;
+ }
+ /*}}}*/
+-#endif
+ 
+ #ifdef _HAVE_GIA_
+ /*FUNCTION Tria::GiaDeflection {{{*/
+@@ -3202,7 +3194,6 @@
+ /*}}}*/
+ #endif
+ 
+-#ifdef _HAVE_CONTROL_
+ /*FUNCTION Tria::BalancethicknessMisfit{{{*/
+ IssmDouble Tria::BalancethicknessMisfit(void){
+ 
+@@ -4599,9 +4590,7 @@
+ 	((ControlInput*)input)->SetInput(new_input);
+ }
+ /*}}}*/
+-#endif
+ 
+-#ifdef _HAVE_HYDROLOGY_
+ /*FUNCTION Tria::CreateHydrologyWaterVelocityInput {{{*/
+ void Tria::CreateHydrologyWaterVelocityInput(void){
+ 
+@@ -5049,7 +5038,6 @@
+ 	}
+ }
+ /*}}}*/
+-#endif
+ 
+ #ifdef _HAVE_DAKOTA_
+ /*FUNCTION Tria::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type);{{{*/
+@@ -5182,7 +5170,6 @@
+ /*}}}*/
+ #endif
+ 
+-#ifdef _HAVE_GROUNDINGLINE_
+ /*FUNCTION Tria::MigrateGroundingLine{{{*/
+ void  Tria::MigrateGroundingLine(IssmDouble* phi_ungrounding){
+ 
+@@ -5331,4 +5318,3 @@
+ 	return nflipped;
+ }
+ /*}}}*/
+-#endif
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17235)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17236)
+@@ -134,7 +134,6 @@
+ 	    void        GetNormalFromLSF(IssmDouble *pnormal);
+ 		bool        IsZeroLevelset(int levelset_enum);
+ 
+-		#ifdef _HAVE_RESPONSES_
+ 		void       AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part);
+ 		IssmDouble IceVolume(void);
+ 		IssmDouble IceVolumeAboveFloatation(void);
+@@ -155,13 +154,11 @@
+ 		void       MaxVz(IssmDouble* pmaxvz);
+ 		IssmDouble Misfit(int modelenum,int observationenum,int weightsenum);
+ 		IssmDouble MisfitArea(int weightsenum);
+-		#endif
+ 
+ 		#ifdef _HAVE_GIA_
+ 		void   GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x,IssmDouble* y);
+ 		#endif
+ 
+-		#ifdef _HAVE_CONTROL_
+ 		IssmDouble DragCoefficientAbsGradient(void);
+ 		void       GradientIndexing(int* indexing,int control_index);
+ 		void       Gradj(Vector<IssmDouble>* gradient,int control_type,int control_index);
+@@ -194,13 +191,10 @@
+ 		IssmDouble SurfaceLogVxVyMisfit(void);
+ 		IssmDouble SurfaceAverageVelMisfit(void);
+ 		void       InputControlUpdate(IssmDouble scalar,bool save_parameter);
+-		#endif
+ 
+-		#ifdef _HAVE_GROUNDINGLINE_
+ 		void   PotentialUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding);
+ 		void   MigrateGroundingLine(IssmDouble* sheet_ungrounding);
+ 		int    UpdatePotentialUngrounding(IssmDouble* vertices_potentially_ungrounding,Vector<IssmDouble>* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf);
+-		#endif
+ 
+ 		/*}}}*/
+ 		/*Tria specific routines:{{{*/
+@@ -271,7 +265,6 @@
+ 		void UpdateConstraintsExtrudeFromBase(void);
+ 		void UpdateConstraintsExtrudeFromTop(void);
+ 
+-		#ifdef _HAVE_HYDROLOGY_
+ 		ElementMatrix* CreateEPLDomainMassMatrix(void);
+ 		void           CreateHydrologyWaterVelocityInput(void);
+ 		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index);
+@@ -280,7 +273,6 @@
+ 		void           HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
+ 		void           HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask);
+ 		void           ComputeEPLThickness(void);
+-		#endif
+ 		/*}}}*/
+ 
+ };
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17235)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17236)
+@@ -1738,7 +1738,6 @@
+ 	}
+ 
+ 	/*Control Inputs*/
+-	#ifdef _HAVE_CONTROL_
+ 	if (control_analysis && iomodel->Data(InversionControlParametersEnum)){
+ 		for(i=0;i<num_control_type;i++){
+ 			switch(reCast<int,IssmDouble>(iomodel->Data(InversionControlParametersEnum)[i])){
+@@ -1782,7 +1781,6 @@
+ 			}
+ 		}
+ 	}
+-	#endif
+ 
+ 	/*Need to know the type of approximation for this element*/
+ 	if(iomodel->Data(FlowequationElementEquationEnum)){
+@@ -3176,7 +3174,6 @@
+ }
+ /*}}}*/
+ 
+-#ifdef _HAVE_RESPONSES_
+ /*FUNCTION Penta::AverageOntoPartition {{{*/
+ void  Penta::AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part){
+ 	_error_("Not supported yet!");
+@@ -3455,7 +3452,6 @@
+ 	return Total_Smb;
+ }
+ /*}}}*/
+-#endif
+ 
+ #ifdef _HAVE_GIA_
+ /*FUNCTION Penta::GiaDeflection {{{*/
+@@ -3465,7 +3461,6 @@
+ /*}}}*/
+ #endif
+ 
+-#ifdef _HAVE_CONTROL_
+ /*FUNCTION Penta::ControlInputGetGradient{{{*/
+ void Penta::ControlInputGetGradient(Vector<IssmDouble>* gradient,int enum_type,int control_index){
+ 
+@@ -4262,7 +4257,6 @@
+ 	((ControlInput*)input)->SetInput(new_input);
+ }
+ /*}}}*/
+-#endif
+ 
+ #ifdef _HAVE_DAKOTA_
+ /*FUNCTION Penta::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type);{{{*/
+@@ -4407,7 +4401,6 @@
+ /*}}}*/
+ #endif
+ 
+-#ifdef _HAVE_HYDROLOGY_
+ /*FUNCTION Penta::CreateEPLDomainMassMatrix {{{*/
+ ElementMatrix* Penta::CreateEPLDomainMassMatrix(void){
+ 
+@@ -4571,9 +4564,7 @@
+ 	}
+ }
+ /*}}}*/
+-#endif
+ 
+-#ifdef _HAVE_GROUNDINGLINE_
+ /*FUNCTION Penta::MigrateGroundingLine{{{*/
+ void  Penta::MigrateGroundingLine(IssmDouble* phi_ungrounding){
+ 
+@@ -4727,4 +4718,3 @@
+ 	return nflipped;
+ }
+ /*}}}*/
+-#endif
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17235)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17236)
+@@ -133,7 +133,6 @@
+ 		void   VerticalSegmentIndices(int** pindices,int* pnumseg);
+ 		void   ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+ 
+-		 #ifdef _HAVE_RESPONSES_
+ 		void   AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part);
+ 		IssmDouble IceVolume(void);
+ 		IssmDouble IceVolumeAboveFloatation(void);
+@@ -152,13 +151,11 @@
+ 		void   MaxVx(IssmDouble* pmaxvx);
+ 		void   MaxVy(IssmDouble* pmaxvy);
+ 		void   MaxVz(IssmDouble* pmaxvz);
+-		#endif
+ 
+ 		#ifdef _HAVE_GIA_
+ 		void   GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x,IssmDouble* y);
+ 		#endif
+ 
+-		#ifdef _HAVE_CONTROL_
+ 		IssmDouble DragCoefficientAbsGradient(void);
+ 		void   GradientIndexing(int* indexing,int control_index);
+ 		void   Gradj(Vector<IssmDouble>* gradient,int control_type,int control_index);
+@@ -188,14 +185,10 @@
+ 		void   InputControlUpdate(IssmDouble scalar,bool save_parameter);
+ 		IssmDouble Misfit(int modelenum,int observationenum,int weightsenum){_error_("not implemented yet");};
+ 		IssmDouble MisfitArea(int weightsenum){_error_("not implemented yet");};
+-		#endif
+ 
+-		#ifdef _HAVE_GROUNDINGLINE_
+ 		void   MigrateGroundingLine(IssmDouble* sheet_ungrounding);
+ 		void   PotentialUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding);
+ 		int    UpdatePotentialUngrounding(IssmDouble* potential_sheet_ungrounding,Vector<IssmDouble>* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf);
+-		#endif
+-
+ 		/*}}}*/
+ 		/*Penta specific routines:{{{*/
+ 		void           AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum);
+@@ -261,7 +254,6 @@
+ 		Tria*	         SpawnTria(int location);
+ 		IssmDouble     StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa);
+ 
+-		#ifdef _HAVE_HYDROLOGY_
+ 		ElementMatrix* CreateEPLDomainMassMatrix(void);
+ 		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode);
+ 		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index){_error_("not implemented yet");};
+@@ -269,7 +261,6 @@
+ 		void           HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
+ 		void           HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask);
+ 		void           ComputeEPLThickness(void);
+-		#endif
+ 
+ 		void           UpdateConstraintsExtrudeFromBase(void);
+ 		void           UpdateConstraintsExtrudeFromTop(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17235)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17236)
+@@ -162,14 +162,12 @@
+ 		void		GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented yet");};
+ 		void        GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
+ 
+-		#ifdef _HAVE_HYDROLOGY_
+ 		void    GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode){_error_("not implemented yet");};
+ 		void    GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index){_error_("not implemented yet");};
+ 		void    GetHydrologyTransfer(Vector<IssmDouble>* transfer){_error_("not implemented yet");};
+ 		void    HydrologyEPLGetActive(Vector<IssmDouble>* active_vec){_error_("not implemented yet");};
+ 		void    HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask){_error_("not implemented yet");};
+ 		void    ComputeEPLThickness(void){_error_("not implemented yet");};
+-		#endif
+ 		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type){_error_("not implemented yet");};
+ 		void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum){_error_("not implemented yet");};
+ 		void        InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){_error_("not implemented yet");};
+@@ -189,7 +187,6 @@
+ 		void UpdateConstraintsExtrudeFromBase(){_error_("not implemented");};
+ 		void UpdateConstraintsExtrudeFromTop(){_error_("not implemented");};
+ 
+-#ifdef _HAVE_RESPONSES_
+ 		void       AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part){_error_("not implemented yet");};
+ 		IssmDouble IceVolume(void){_error_("not implemented yet");};
+ 		IssmDouble IceVolumeAboveFloatation(void){_error_("not implemented yet");};
+@@ -210,13 +207,11 @@
+ 		void       MaxVz(IssmDouble* pmaxvz){_error_("not implemented yet");};
+ 		IssmDouble Misfit(int modelenum,int observationenum,int weightsenum){_error_("not implemented yet");};
+ 		IssmDouble MisfitArea(int weightsenum){_error_("not implemented yet");};
+-#endif
+ 
+ #ifdef _HAVE_GIA_
+ 		void   GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x,IssmDouble* y){_error_("not implemented yet");};
+ #endif
+ 
+-#ifdef _HAVE_CONTROL_
+ 		IssmDouble DragCoefficientAbsGradient(void){_error_("not implemented yet");};
+ 		void       GradientIndexing(int* indexing,int control_index){_error_("not implemented yet");};
+ 		void       Gradj(Vector<IssmDouble>* gradient,int control_type,int control_index){_error_("not implemented yet");};
+@@ -249,13 +244,10 @@
+ 		IssmDouble SurfaceLogVxVyMisfit(void){_error_("not implemented yet");};
+ 		IssmDouble SurfaceAverageVelMisfit(void){_error_("not implemented yet");};
+ 		void       InputControlUpdate(IssmDouble scalar,bool save_parameter){_error_("not implemented yet");};
+-#endif
+ 
+-#ifdef _HAVE_GROUNDINGLINE_
+ 		void   PotentialUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding){_error_("not implemented yet");};
+ 		void   MigrateGroundingLine(IssmDouble* sheet_ungrounding){_error_("not implemented yet");};
+ 		int    UpdatePotentialUngrounding(IssmDouble* vertices_potentially_ungrounding,Vector<IssmDouble>* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf){_error_("not implemented yet");};
+-#endif
+ 		/*}}}*/
+ };
+ #endif  /* _SEG_H */
+Index: ../trunk-jpl/src/c/classes/Node.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Node.cpp	(revision 17235)
++++ ../trunk-jpl/src/c/classes/Node.cpp	(revision 17236)
+@@ -53,7 +53,6 @@
+ 	 this->approximation=0;
+ 
+ 	/*Stressbalance Horiz*/
+-	#ifdef _HAVE_STRESSBALANCE_
+ 	if(analysis_enum==StressbalanceAnalysisEnum){
+ 
+ 		/*Coordinate system provided, convert to coord_system matrix*/
+@@ -87,7 +86,6 @@
+ 			this->Deactivate();
+ 		}
+ 	}
+-	#endif
+ 
+ 	/*2d solutions in 3d, we need to constrain all the nodes that are not on base*/
+ 	if(
+@@ -109,8 +107,7 @@
+ 		}
+ 	}
+ 	if(
+-				analysis_enum==FreeSurfaceTopAnalysisEnum ||
+-				analysis_enum==L2ProjectionTopAnalysisEnum
++				analysis_enum==FreeSurfaceTopAnalysisEnum
+ 				){
+ 		if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh2DverticalEnum){
+ 			/*On a 3d mesh, we may have collapsed elements, hence dead nodes. Freeze them out: */
+@@ -362,7 +359,6 @@
+ 	return lid; 
+ }
+ /*}}}*/
+-#ifdef _HAVE_STRESSBALANCE_
+ /*FUNCTION Node::GetCoordinateSystem{{{*/
+ void Node::GetCoordinateSystem(IssmDouble* coord_system_out){
+ 
+@@ -371,7 +367,6 @@
+ 
+ }
+ /*}}}*/
+-#endif
+ /*FUNCTION Node::InAnalysis{{{*/
+ bool Node::InAnalysis(int in_analysis_enum){
+ 	if (in_analysis_enum==this->analysis_enum) return true;
+@@ -900,7 +895,6 @@
+ 	return numberofdofs;
+ }
+ /*}}}*/
+-#ifdef _HAVE_STRESSBALANCE_
+ void TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes,int numnodes,int cs_enum){/*{{{*/
+ 
+ 	int* cs_array=NULL;
+@@ -1172,4 +1166,3 @@
+ 	*ptransform=transform;
+ }
+ /*}}}*/
+-#endif
+Index: ../trunk-jpl/src/c/classes/FemModel.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.h	(revision 17235)
++++ ../trunk-jpl/src/c/classes/FemModel.h	(revision 17236)
+@@ -58,7 +58,6 @@
+ 		void SetCurrentConfiguration(int configuration_type,int analysis_type);
+ 
+ 		/*Modules*/ 
+-		#ifdef _HAVE_RESPONSES_
+ 		void MassFluxx(IssmDouble* presponse);
+ 		void MaxAbsVxx(IssmDouble* presponse);
+ 		void MaxAbsVyx(IssmDouble* presponse);
+@@ -76,7 +75,6 @@
+ 		void IceVolumeAboveFloatationx(IssmDouble* pV);
+ 		void ElementResponsex(IssmDouble* presponse,int response_enum);
+ 		void BalancethicknessMisfitx(IssmDouble* pV);
+-		#endif
+ 		#ifdef  _HAVE_DAKOTA_
+ 		void DakotaResponsesx(double* d_responses,char** responses_descriptors,int numresponsedescriptors,int d_numresponses);
+ 		#endif
+@@ -85,11 +83,9 @@
+ 		void RequestedDependentsx(void);
+ 		void Responsex(IssmDouble* presponse,int response_descriptor_enum);
+ 		void Responsex(IssmDouble* presponse,const char* response_descriptor);
+-		#ifdef _HAVE_CONTROL_
+ 		void OutputControlsx(Results **presults);
+ 		void CostFunctionx( IssmDouble* pJ);
+ 		void ThicknessAbsGradientx( IssmDouble* pJ);
+-		#endif
+ 		#ifdef _HAVE_GIA_
+ 		void Deflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt, IssmDouble* x, IssmDouble* y);
+ 		#endif
+@@ -98,12 +94,10 @@
+ 		int  UpdateVertexPositionsx(void);
+ 		void UpdateConstraintsExtrudeFromBasex();
+ 		void UpdateConstraintsExtrudeFromTopx();
+-		#ifdef _HAVE_HYDROLOGY_
+ 		void HydrologyTransferx(void);
+ 		void HydrologyEPLupdateDomainx(void);
+ 		void HydrologyEPLThicknessx(void);
+ 		void UpdateConstraintsL2ProjectionEPLx(void);
+-		#endif
+ };
+ 
+ #endif
Index: issm/oecreview/Archive/16554-17801/ISSM-17236-17237.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17236-17237.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17236-17237.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17236)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17237)
+@@ -457,6 +457,7 @@
+ 		case MaterialsRheologyBbarEnum:    this->ElementResponsex(responses,MaterialsRheologyBbarEnum); break;
+ 		case VelEnum:                      this->ElementResponsex(responses,VelEnum); break;
+ 		case FrictionCoefficientEnum:      NodalValuex(responses, FrictionCoefficientEnum,elements,nodes, vertices, loads, materials, parameters); break;
++		default: _error_("response descriptor \"" << EnumToStringx(response_descriptor_enum) << "\" not supported yet!"); break; 
+ 	}
+ 
+ }
Index: issm/oecreview/Archive/16554-17801/ISSM-17237-17238.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17237-17238.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17237-17238.diff	(revision 17802)
@@ -0,0 +1,14 @@
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17237)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17238)
+@@ -844,6 +844,9 @@
+ if WRAPPERS
+ libISSMModules_a_SOURCES = $(modules_sources)
+ libISSMModules_a_SOURCES += $(bamg_sources)
++if KRIGING
++libISSMModules_a_SOURCES += $(kriging_sources)
++endif
+ if KML
+ libISSMModules_a_SOURCES += $(kml_sources)
+ endif
Index: issm/oecreview/Archive/16554-17801/ISSM-17238-17239.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17238-17239.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17238-17239.diff	(revision 17802)
@@ -0,0 +1,98 @@
+Index: ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp	(revision 0)
++++ ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp	(revision 17239)
+@@ -0,0 +1,75 @@
++/*!\file GetMaskOfIceVerticesLSMx 
++ * \brief: Return a mask for all the vertices determining whether the node should be active or not. 
++ */
++
++#include "./SetActiveNodesLSMx.h"
++
++#include "../../classes/classes.h"
++#include "../../shared/shared.h"
++#include "../../toolkits/toolkits.h"
++#include "../modules.h"
++
++void SetActiveNodesLSMx(Elements* elements){/*{{{*/
++
++	// used in femmodel->UpdateConstraintsx
++	int i,in;
++	Element* element = NULL;
++	Node* node = NULL;
++
++	for(i=0;i<elements->Size();i++){
++		element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
++		int numnodes=element->GetNumberOfNodes();
++		IssmDouble* mask = xNew<IssmDouble>(numnodes);
++		element->GetInputListOnNodes(&mask[0],IceMaskNodeActivationEnum);
++		
++		for(in=0;in<numnodes;in++){
++			node=element->GetNode(in);
++			if(mask[in]==1.){
++				node->Activate();
++			}
++			else {
++				node->Deactivate();
++			}
++		}
++
++		xDelete<IssmDouble>(mask);
++	}
++}/*}}}*/
++void GetMaskOfIceVerticesLSMx(FemModel* femmodel){/*{{{*/
++
++	// use in transient core
++	int                 i;
++	IssmDouble*         mask_ice      = NULL;
++	Vector<IssmDouble>* vec_mask_ice  = NULL;
++	Element*            element       = NULL;
++
++	/*Initialize vector with number of vertices*/
++	IssmDouble numvertices=femmodel->vertices->NumberOfVertices();
++	vec_mask_ice=new Vector<IssmDouble>(numvertices); //vertices that have ice at next time step
++	for(i=0;i<numvertices;i++)
++		vec_mask_ice[i]=0.;
++	/*Fill vector with values: */
++	for(i=0;i<femmodel->elements->Size();i++){
++		element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++		SetMaskOfIceElement(vec_mask_ice, element);
++	}
++
++	/*Assemble vector and serialize */
++	vec_mask_ice->Assemble();
++	mask_ice=vec_mask_ice->ToMPISerial();
++	InputUpdateFromVectorx(femmodel,mask_ice,IceMaskNodeActivationEnum,VertexSIdEnum);
++	delete vec_mask_ice;
++	delete mask_ice;
++
++}/*}}}*/
++void SetMaskOfIceElement(Vector<IssmDouble>* vec_mask_ice, Element* element){/*{{{*/
++
++	/* Intermediaries */
++	int numvertices = element->GetNumberOfVertices();
++	
++	if(element->IsIceInElement()){
++		for(int i = 0;i<numvertices;i++){
++			vec_mask_ice->SetValue(element->vertices[i]->Sid(),1.,INS_VAL);
++		}
++	}
++}/*}}}*/
+Index: ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.h	(revision 0)
++++ ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.h	(revision 17239)
+@@ -0,0 +1,13 @@
++/*!\file:  SetActiveNodesLSMx.h
++ * \brief header file for updating single point constraints  for next time step
++ */ 
++
++#ifndef _SETACTIVENODESLSMX_H
++#define _SETACTIVENODESLSMX_H
++
++#include "../../classes/classes.h"
++
++void SetActiveNodesLSMx(Elements* elements);
++void GetMaskOfIceVerticesLSMx(FemModel* femmodel);
++void SetMaskOfIceElement(Vector<IssmDouble>* vec_mask_ice, Element* element);
++#endif  /* _UPDATESPCSX_H */
Index: issm/oecreview/Archive/16554-17801/ISSM-17239-17240.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17239-17240.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17239-17240.diff	(revision 17802)
@@ -0,0 +1,107 @@
+Index: ../trunk-jpl/m4/issm_options.m4
+===================================================================
+--- ../trunk-jpl/m4/issm_options.m4	(revision 17239)
++++ ../trunk-jpl/m4/issm_options.m4	(revision 17240)
+@@ -1668,6 +1668,20 @@
+ 	AM_CONDITIONAL([BALANCEVELOCITY], [test x$HAVE_BALANCEVELOCITY = xyes])
+ 	AC_MSG_RESULT($HAVE_BALANCEVELOCITY)
+ 	dnl }}}
++	dnl with-L2ProjectionEPL{{{
++	AC_ARG_WITH([L2ProjectionEPL],
++		AS_HELP_STRING([--with-L2ProjectionEPL = YES], [compile with L2ProjectionEPL capabilities (default is yes)]),
++		[L2PROJECTIONEPL=$withval],[L2PROJECTIONEPL=yes]) 
++	AC_MSG_CHECKING(for L2ProjectionEPL capability compilation)
++
++	HAVE_L2PROJECTIONEPL=no
++	if test "x$L2PROJECTIONEPL" = "xyes"; then
++		HAVE_L2PROJECTIONEPL=yes
++		AC_DEFINE([_HAVE_L2PROJECTIONEPL_],[1],[with L2ProjectionEPL capability])
++	fi
++	AM_CONDITIONAL([L2PROJECTIONEPL], [test x$HAVE_L2PROJECTIONEPL = xyes])
++	AC_MSG_RESULT($HAVE_L2PROJECTIONEPL)
++	dnl }}}
+ 	dnl with-L2ProjectionBase{{{
+ 	AC_ARG_WITH([L2ProjectionBase],
+ 		AS_HELP_STRING([--with-L2ProjectionBase = YES], [compile with L2ProjectionBase capabilities (default is yes)]),
+@@ -1892,6 +1906,34 @@
+ 	AM_CONDITIONAL([THERMAL], [test x$HAVE_THERMAL = xyes])
+ 	AC_MSG_RESULT($HAVE_THERMAL)
+ 	dnl }}}
++	dnl with-SmoothedSurfaceSlopeX{{{
++	AC_ARG_WITH([SmoothedSurfaceSlopeX],
++		AS_HELP_STRING([--with-SmoothedSurfaceSlopeX = YES], [compile with SmoothedSurfaceSlopeX capabilities (default is yes)]),
++		[SMOOTHEDSURFACESLOPEX=$withval],[SMOOTHEDSURFACESLOPEX=yes]) 
++	AC_MSG_CHECKING(for SmoothedSurfaceSlopeX capability compilation)
++
++	HAVE_SMOOTHEDSURFACESLOPEX=no
++	if test "x$SMOOTHEDSURFACESLOPEX" = "xyes"; then
++		HAVE_SMOOTHEDSURFACESLOPEX=yes
++		AC_DEFINE([_HAVE_SMOOTHEDSURFACESLOPEX_],[1],[with SmoothedSurfaceSlopeX capability])
++	fi
++	AM_CONDITIONAL([SMOOTHEDSURFACESLOPEX], [test x$HAVE_SMOOTHEDSURFACESLOPEX = xyes])
++	AC_MSG_RESULT($HAVE_SMOOTHEDSURFACESLOPEX)
++	dnl }}}
++	dnl with-SmoothedSurfaceSlopeY{{{
++	AC_ARG_WITH([SmoothedSurfaceSlopeY],
++		AS_HELP_STRING([--with-SmoothedSurfaceSlopeY = YES], [compile with SmoothedSurfaceSlopeY capabilities (default is yes)]),
++		[SMOOTHEDSURFACESLOPEY=$withval],[SMOOTHEDSURFACESLOPEY=yes]) 
++	AC_MSG_CHECKING(for SmoothedSurfaceSlopeY capability compilation)
++
++	HAVE_SMOOTHEDSURFACESLOPEY=no
++	if test "x$SMOOTHEDSURFACESLOPEY" = "xyes"; then
++		HAVE_SMOOTHEDSURFACESLOPEY=yes
++		AC_DEFINE([_HAVE_SMOOTHEDSURFACESLOPEY_],[1],[with SmoothedSurfaceSlopeY capability])
++	fi
++	AM_CONDITIONAL([SMOOTHEDSURFACESLOPEY], [test x$HAVE_SMOOTHEDSURFACESLOPEY = xyes])
++	AC_MSG_RESULT($HAVE_SMOOTHEDSURFACESLOPEY)
++	dnl }}}
+ 	dnl with-Meshdeformation{{{
+ 	AC_ARG_WITH([Meshdeformation],
+ 		AS_HELP_STRING([--with-Meshdeformation = YES], [compile with Meshdeformation capabilities (default is yes)]),
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17239)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17240)
+@@ -801,7 +801,6 @@
+ 	iomodel->DeleteData(penalties,StressbalanceVertexPairingEnum);
+ 
+ 	/*Create Riffront loads for rifts: */
+-#ifdef _HAVE_RIFTS_
+ 	if(numrifts){
+ 		iomodel->FetchData(&riftinfo,&numriftsegments,NULL,RiftsRiftstructEnum);
+ 		iomodel->FetchData(5,RiftsRiftstructEnum,ThicknessEnum,BedEnum,SurfaceEnum,MaskGroundediceLevelsetEnum);
+@@ -814,7 +813,6 @@
+ 		iomodel->DeleteData(5,RiftsRiftstructEnum,ThicknessEnum,BedEnum,SurfaceEnum,MaskGroundediceLevelsetEnum);
+ 		xDelete<IssmDouble>(riftinfo);
+ 	}
+-#endif
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17239)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17240)
+@@ -541,6 +541,9 @@
+ if HYDROLOGYDCEFFICIENT
+ issm_sources += ./analyses/HydrologyDCEfficientAnalysis.cpp
+ endif
++if L2PROJECTIONEPL
++issm_sources += ./analyses/L2ProjectionEPLAnalysis.cpp
++endif
+ if MELTING
+ issm_sources += ./analyses/MeltingAnalysis.cpp
+ endif
+@@ -562,6 +565,12 @@
+ if THERMAL
+ issm_sources += ./analyses/ThermalAnalysis.cpp
+ endif
++if SMOOTHEDSURFACESLOPEX
++issm_sources += ./analyses/SmoothedSurfaceSlopeXAnalysis.cpp
++endif
++if SMOOTHEDSURFACESLOPEY
++issm_sources += ./analyses/SmoothedSurfaceSlopeYAnalysis.cpp
++endif
+ if MESHDEFORMATION
+ issm_sources += ./analyses/MeshdeformationAnalysis.cpp
+ endif
Index: issm/oecreview/Archive/16554-17801/ISSM-17240-17241.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17240-17241.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17240-17241.diff	(revision 17802)
@@ -0,0 +1,78 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17240)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17241)
+@@ -188,6 +188,7 @@
+ 	iomodel->FetchDataToInput(elements,LoadingforceXEnum);
+ 	iomodel->FetchDataToInput(elements,LoadingforceYEnum);
+ 	iomodel->FetchDataToInput(elements,DamageDEnum);
++	iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
+ 
+ 	if(iomodel->meshtype==Mesh3DEnum){
+ 		iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
+@@ -1022,6 +1023,8 @@
+ }/*}}}*/
+ void StressbalanceAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+ 	/*Default, do nothing*/
++	_printf0_("Updating active and non-active nodes in Femmodel \n");
++	SetActiveNodesLSMx(femmodel->elements);
+ 	return;
+ }/*}}}*/
+ 
+@@ -1111,13 +1114,13 @@
+ }/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSA(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*Intermediaries*/
+ 	int      meshtype;
+ 	Element* basalelement;
+ 
+-	/* Check if ice in element */
+-	if(!element->IsIceInElement()) return NULL;
+-
+ 	/*Get basal element*/
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+ 	switch(meshtype){
+Index: ../trunk-jpl/src/c/modules/modules.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/modules.h	(revision 17240)
++++ ../trunk-jpl/src/c/modules/modules.h	(revision 17241)
+@@ -31,6 +31,7 @@
+ #include "./GetVectorFromControlInputsx/GetVectorFromControlInputsx.h"
+ #include "./GiaDeflectionCorex/GiaDeflectionCorex.h"
+ #include "./SetControlInputsFromVectorx/SetControlInputsFromVectorx.h"
++#include "./SetActiveNodesLSMx/SetActiveNodesLSMx.h"
+ #include "./Gradjx/Gradjx.h"
+ #include "./GroundinglineMigrationx/GroundinglineMigrationx.h"
+ #include "./HoleFillerx/HoleFillerx.h"
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17240)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17241)
+@@ -288,6 +288,8 @@
+ 					./modules/UpdateDynamicConstraintsx/UpdateDynamicConstraintsx.cpp\
+ 					./modules/IoModelToConstraintsx/IoModelToConstraintsx.h\
+ 					./modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp\
++					./modules/SetActiveNodesLSMx/SetActiveNodesLSMx.h\
++					./modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp\
+ 					./modules/InputUpdateFromConstantx/InputUpdateFromConstantx.h\
+ 					./modules/InputUpdateFromConstantx/InputUpdateFromConstantx.cpp\
+ 					./modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.h\
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17240)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17241)
+@@ -406,7 +406,9 @@
+ 	/*start module: */
+ 	if(VerboseModule()) _printf0_("   Updating constraints for time: " << time << "\n");
+ 
+-	// analysis->UpdateConstraints();
++	Analysis* analysis= EnumToAnalysis(analysis_type);
++	analysis->UpdateConstraints(this);
++	delete analysis;
+ 	
+ 	/*Second, constraints might be time dependent: */
+ 	SpcNodesx(nodes,constraints,parameters,analysis_type); 
Index: issm/oecreview/Archive/16554-17801/ISSM-17241-17242.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17241-17242.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17241-17242.diff	(revision 17802)
@@ -0,0 +1,813 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17241)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17242)
+@@ -58,9 +58,9 @@
+ 		ElementVector* CreatePVectorHO(Element* element);
+ 		ElementVector* CreatePVectorHODrivingStress(Element* element);
+ 		ElementVector* CreatePVectorHOFront(Element* element);
+-		void GetBHO(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+-		void GetBHOprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+-		void GetBHOFriction(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBHO(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBHOprime(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBHOFriction(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
+ 		void InputUpdateFromSolutionHO(IssmDouble* solution,Element* element);
+ 		/*FS*/
+ 		ElementVector* CreateDVectorFS(Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17241)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17242)
+@@ -17,7 +17,13 @@
+ 	switch(approximation){
+ 		case SSAApproximationEnum:  numdofs =2; break;
+ 		case L1L2ApproximationEnum: numdofs =2; break;
+-		case HOApproximationEnum:   numdofs =2; break;
++		case HOApproximationEnum:   
++			 switch(meshtype){
++				 case Mesh3DEnum:         numdofs=2; break;
++				 case Mesh2DverticalEnum: numdofs=1; break;
++				 default: _error_("mesh type not supported yet");
++			 }
++			 break;
+ 		case SIAApproximationEnum:  numdofs =2; break;
+ 		case FSvelocityEnum:
+ 			 switch(meshtype){
+@@ -477,7 +483,9 @@
+ 		}
+ 		else{
+ 			IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvxEnum,StressbalanceAnalysisEnum,finiteelement,1);
+-			IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvyEnum,StressbalanceAnalysisEnum,finiteelement,2);
++			if(iomodel->meshtype==Mesh3DEnum){
++				IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvyEnum,StressbalanceAnalysisEnum,finiteelement,2);
++			}
+ 		}
+ 
+ 		return;
+@@ -954,12 +962,20 @@
+ void StressbalanceAnalysis::GetSolutionFromInputsHoriz(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 
+ 	IssmDouble   vx,vy;
+-	int          approximation;
++	int          meshtype,dim,approximation;
+ 	int*         doflist = NULL;
+ 
++	/*Get some parameters*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; break;
++		case Mesh3DEnum:         dim = 3; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+-	int numdof   = numnodes*2;
++	int numdof   = numnodes*(dim-1);
+ 	element->GetInputValue(&approximation,ApproximationEnum);
+ 
+ 	/*Fetch dof list and allocate solution vector*/
+@@ -968,7 +984,8 @@
+ 
+ 	/*Get inputs*/
+ 	Input* vx_input=element->GetInput(VxEnum); _assert_(vx_input);
+-	Input* vy_input=element->GetInput(VyEnum); _assert_(vy_input);
++	Input* vy_input=NULL;
++	if(dim==3){vy_input=element->GetInput(VyEnum); _assert_(vy_input);}
+ 
+ 	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+ 	Gauss* gauss=element->NewGauss();
+@@ -977,9 +994,11 @@
+ 
+ 		/*Recover vx and vy*/
+ 		vx_input->GetInputValue(&vx,gauss);
+-		vy_input->GetInputValue(&vy,gauss);
+-		values[i*2+0]=vx;
+-		values[i*2+1]=vy;
++		values[i*(dim-1)+0]=vx;
++		if(dim==3){
++			vy_input->GetInputValue(&vy,gauss);
++			values[i*(dim-1)+1]=vy;
++		}
+ 	}
+ 
+ 	solution->SetValues(numdof,doflist,values,INS_VAL);
+@@ -2020,27 +2039,40 @@
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixHOViscous(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
++	int         dim,meshtype,bsize;
+ 	IssmDouble  viscosity,newviscosity,oldviscosity;
+ 	IssmDouble  viscosity_overshoot,thickness,Jdet;
+ 	IssmDouble  D_scalar;
+ 	IssmDouble *xyz_list = NULL;
+ 
++	/*Get problem dimension*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; bsize = 2; break;
++		case Mesh3DEnum:         dim = 3; bsize = 5; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+ 	int numdof   = numnodes*2;
+ 
+ 	/*Initialize Element matrix and vectors*/
+ 	ElementMatrix* Ke     = element->NewElementMatrix(HOApproximationEnum);
+-	IssmDouble*    B      = xNew<IssmDouble>(5*numdof);
+-	IssmDouble*    Bprime = xNew<IssmDouble>(5*numdof);
+-	IssmDouble*    D      = xNewZeroInit<IssmDouble>(5*5);
++	IssmDouble*    B      = xNew<IssmDouble>(bsize*numdof);
++	IssmDouble*    Bprime = xNew<IssmDouble>(bsize*numdof);
++	IssmDouble*    D      = xNewZeroInit<IssmDouble>(bsize*bsize);
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+-	Input* vx_input=element->GetInput(VxEnum);               _assert_(vx_input);
+-	Input* vy_input=element->GetInput(VyEnum);               _assert_(vy_input);
+-	Input* vxold_input=element->GetInput(VxPicardEnum);      _assert_(vxold_input);
+-	Input* vyold_input=element->GetInput(VyPicardEnum);      _assert_(vyold_input);
++	Input* vx_input    = element->GetInput(VxEnum);       _assert_(vx_input);
++	Input* vxold_input = element->GetInput(VxPicardEnum); _assert_(vxold_input);
++	Input* vy_input    = NULL;
++	Input* vyold_input = NULL;
++	if(dim==3){
++		vy_input=element->GetInput(VyEnum);          _assert_(vy_input);
++		vyold_input=element->GetInput(VyPicardEnum); _assert_(vyold_input);
++	}
+ 	element->FindParam(&viscosity_overshoot,StressbalanceViscosityOvershootEnum);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+@@ -2049,19 +2081,19 @@
+ 		gauss->GaussPoint(ig);
+ 
+ 		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+-		this->GetBHO(B,element,xyz_list,gauss);
+-		this->GetBHOprime(Bprime,element,xyz_list,gauss);
++		this->GetBHO(B,element,dim,xyz_list,gauss);
++		this->GetBHOprime(Bprime,element,dim,xyz_list,gauss);
+ 
+-		element->ViscosityHO(&viscosity,xyz_list,gauss,vx_input,vy_input);
+-		element->ViscosityHO(&oldviscosity,xyz_list,gauss,vxold_input,vyold_input);
++		element->ViscosityHO(&viscosity,dim,xyz_list,gauss,vx_input,vy_input);
++		element->ViscosityHO(&oldviscosity,dim,xyz_list,gauss,vxold_input,vyold_input);
+ 
+ 		newviscosity=viscosity+viscosity_overshoot*(viscosity-oldviscosity);
+ 		D_scalar=2.*newviscosity*gauss->weight*Jdet;
+-		for(int i=0;i<5;i++) D[i*5+i]=D_scalar;
++		for(int i=0;i<bsize;i++) D[i*bsize+i]=D_scalar;
+ 
+-		TripleMultiply(B,5,numdof,1,
+-					D,5,5,0,
+-					Bprime,5,numdof,0,
++		TripleMultiply(B,bsize,numdof,1,
++					D,bsize,bsize,0,
++					Bprime,bsize,numdof,0,
+ 					&Ke->values[0],1);
+ 	}
+ 
+@@ -2081,6 +2113,7 @@
+ 	if(element->IsFloating() || !element->IsOnBed()) return NULL;
+ 
+ 	/*Intermediaries*/
++	int         dim,meshtype;
+ 	bool        mainlyfloating;
+ 	int         migration_style,point1;
+ 	IssmDouble  alpha2,Jdet,fraction1,fraction2;
+@@ -2088,22 +2121,31 @@
+ 	IssmDouble *xyz_list_base = NULL;
+ 	Gauss*      gauss         = NULL;
+ 
++	/*Get problem dimension*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; break;
++		case Mesh3DEnum:         dim = 3; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+-	int numdof   = numnodes*2;
++	int numdof   = numnodes*(dim-1);
+ 
+ 	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke      = element->NewElementMatrix(HOApproximationEnum);
+-	IssmDouble*    B       = xNew<IssmDouble>(2*numdof);
+-	IssmDouble     D[2][2] = {0.};
++	ElementMatrix* Ke = element->NewElementMatrix(HOApproximationEnum);
++	IssmDouble*    B  = xNew<IssmDouble>((dim-1)*numdof);
++	IssmDouble*    D  = xNew<IssmDouble>((dim-1)*(dim-1));
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinatesBase(&xyz_list_base);
+ 	element->FindParam(&migration_style,GroundinglineMigrationEnum);
+-	Input* vx_input         = element->GetInput(VxEnum);      _assert_(vx_input);
+-	Input* vy_input         = element->GetInput(VyEnum);      _assert_(vy_input);
+-	Input* vz_input         = element->GetInput(VzEnum);      _assert_(vz_input);
++	Input* vx_input = element->GetInput(VxEnum);   _assert_(vx_input);
++	Input* vy_input = element->GetInput(VyEnum);   _assert_(vy_input);
++	Input* vz_input = NULL;
+ 	Input* gllevelset_input = NULL;
++	if(dim==3){vz_input=element->GetInput(VzEnum); _assert_(vz_input);}
+ 
+ 	/*build friction object, used later on: */
+ 	Friction* friction=new Friction(element,2);
+@@ -2131,13 +2173,13 @@
+ 			if(gllevelset<0.) alpha2=0.;
+ 		}
+ 
+-		this->GetBHOFriction(B,element,xyz_list_base,gauss);
++		this->GetBHOFriction(B,element,dim,xyz_list_base,gauss);
+ 		element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
+-		for(int i=0;i<2;i++) D[i][i]=alpha2*gauss->weight*Jdet;
++		for(int i=0;i<dim-1;i++) D[i*(dim-1)+i]=alpha2*gauss->weight*Jdet;
+ 
+-		TripleMultiply(B,2,numdof,1,
+-					&D[0][0],2,2,0,
+-					B,2,numdof,0,
++		TripleMultiply(B,dim-1,numdof,1,
++					D,dim-1,dim-1,0,
++					B,dim-1,numdof,0,
+ 					&Ke->values[0],1);
+ 	}
+ 
+@@ -2149,6 +2191,7 @@
+ 	delete friction;
+ 	xDelete<IssmDouble>(xyz_list_base);
+ 	xDelete<IssmDouble>(B);
++	xDelete<IssmDouble>(D);
+ 	return Ke;
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorHO(Element* element){/*{{{*/
+@@ -2166,9 +2209,18 @@
+ ElementVector* StressbalanceAnalysis::CreatePVectorHODrivingStress(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries */
++	int         dim,meshtype;
+ 	IssmDouble  Jdet,slope[3];
+ 	IssmDouble* xyz_list = NULL;
+ 
++	/*Get problem dimension*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; break;
++		case Mesh3DEnum:         dim = 3; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+ 
+@@ -2191,8 +2243,8 @@
+ 		surface_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
+ 
+ 		for(int i=0;i<numnodes;i++){
+-			pe->values[i*2+0]+=-rhog*slope[0]*Jdet*gauss->weight*basis[i];
+-			pe->values[i*2+1]+=-rhog*slope[1]*Jdet*gauss->weight*basis[i];
++			pe->values[i*(dim-1)+0]+=-rhog*slope[0]*Jdet*gauss->weight*basis[i];
++			if(dim==3) pe->values[i*(dim-1)+1]+=-rhog*slope[1]*Jdet*gauss->weight*basis[i];
+ 		}
+ 	}
+ 
+@@ -2211,6 +2263,7 @@
+ 	if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
+ 
+ 	/*Intermediaries*/
++	int         dim,meshtype;
+ 	IssmDouble  Jdet,surface,z,water_pressure,ice_pressure;
+ 	IssmDouble  surface_under_water,base_under_water,pressure;
+ 	IssmDouble* xyz_list       = NULL;
+@@ -2218,6 +2271,14 @@
+ 	IssmDouble  normal[3];
+ 	Gauss*      gauss = NULL;
+ 
++	/*Get problem dimension*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; break;
++		case Mesh3DEnum:         dim = 3; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes    = element->GetNumberOfNodes();
+ 	int numvertices = element->GetNumberOfVertices();
+@@ -2236,10 +2297,10 @@
+ 	element->NormalSection(&normal[0],xyz_list_front);
+ 
+ 	/*Initialize gauss points*/
+-	IssmDouble zmax=xyz_list[0*3+2]; for(int i=1;i<numvertices;i++) if(xyz_list[i*3+2]>zmax) zmax=xyz_list[i*3+2];
+-	IssmDouble zmin=xyz_list[0*3+2]; for(int i=1;i<numvertices;i++) if(xyz_list[i*3+2]<zmin) zmin=xyz_list[i*3+2];
+-	if(zmax>0 && zmin<0) gauss=element->NewGauss(xyz_list,xyz_list_front,3,10);//refined in vertical because of the sea level discontinuity
+-	else                 gauss=element->NewGauss(xyz_list,xyz_list_front,3,3);
++	IssmDouble zmax=xyz_list[0*3+(dim-1)]; for(int i=1;i<numvertices;i++) if(xyz_list[i*3+(dim-1)]>zmax) zmax=xyz_list[i*3+(dim-1)];
++	IssmDouble zmin=xyz_list[0*3+(dim-1)]; for(int i=1;i<numvertices;i++) if(xyz_list[i*3+(dim-1)]<zmin) zmin=xyz_list[i*3+(dim-1)];
++	if(zmax>0. && zmin<0.) gauss=element->NewGauss(xyz_list,xyz_list_front,3,10);//refined in vertical because of the sea level discontinuity
++	else                   gauss=element->NewGauss(xyz_list,xyz_list_front,3,3);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+@@ -2255,8 +2316,8 @@
+ 		pressure       = ice_pressure + water_pressure;
+ 
+ 		for (int i=0;i<numnodes;i++){
+-			pe->values[2*i+0]+= pressure*Jdet*gauss->weight*normal[0]*basis[i];
+-			pe->values[2*i+1]+= pressure*Jdet*gauss->weight*normal[1]*basis[i];
++			pe->values[(dim-1)*i+0]+= pressure*Jdet*gauss->weight*normal[0]*basis[i];
++			if(dim==3) pe->values[(dim-1)*i+1]+= pressure*Jdet*gauss->weight*normal[1]*basis[i];
+ 		}
+ 	}
+ 
+@@ -2270,15 +2331,17 @@
+ 	delete gauss;
+ 	return pe;
+ }/*}}}*/
+-void StressbalanceAnalysis::GetBHO(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++void StressbalanceAnalysis::GetBHO(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF2. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
+ 	 * by: 
+-	 *       Bi=[ dh/dx          0      ]
+-	 *          [   0           dh/dy   ]
+-	 *          [ 1/2*dh/dy  1/2*dh/dx  ]
+-	 *          [ 1/2*dh/dz      0      ]
+-	 *          [  0         1/2*dh/dz  ]
++	 *                   3D                        2D
++	 *
++	 *       Bi=[ dh/dx          0      ]  Bi=[ dh/dx]
++	 *          [   0           dh/dy   ]     [ dh/dy]
++	 *          [ 1/2*dh/dy  1/2*dh/dx  ]     
++	 *          [ 1/2*dh/dz      0      ]    
++	 *          [  0         1/2*dh/dz  ]   
+ 	 * where h is the interpolation function for node i.
+ 	 *
+ 	 * We assume B has been allocated already, of size: 5x(NDOF2*numnodes)
+@@ -2288,33 +2351,43 @@
+ 	int numnodes = element->GetNumberOfNodes();
+ 
+ 	/*Get nodal functions derivatives*/
+-	IssmDouble* dbasis=xNew<IssmDouble>(3*numnodes);
++	IssmDouble* dbasis=xNew<IssmDouble>(dim*numnodes);
+ 	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+ 
+ 	/*Build B: */
+-	for(int i=0;i<numnodes;i++){
+-		B[2*numnodes*0+2*i+0] = dbasis[0*numnodes+i];
+-		B[2*numnodes*0+2*i+1] = 0.;
+-		B[2*numnodes*1+2*i+0] = 0.;
+-		B[2*numnodes*1+2*i+1] = dbasis[1*numnodes+i];
+-		B[2*numnodes*2+2*i+0] = .5*dbasis[1*numnodes+i];
+-		B[2*numnodes*2+2*i+1] = .5*dbasis[0*numnodes+i];
+-		B[2*numnodes*3+2*i+0] = .5*dbasis[2*numnodes+i];
+-		B[2*numnodes*3+2*i+1] = 0.;
+-		B[2*numnodes*4+2*i+0] = 0.;
+-		B[2*numnodes*4+2*i+1] = .5*dbasis[2*numnodes+i];
++	if(dim==2){
++		for(int i=0;i<numnodes;i++){
++			B[numnodes*0+i] = dbasis[0*numnodes+i];
++			B[numnodes*1+i] = .5*dbasis[1*numnodes+i];
++		}
+ 	}
++	else{
++		for(int i=0;i<numnodes;i++){
++			B[2*numnodes*0+2*i+0] = dbasis[0*numnodes+i];
++			B[2*numnodes*0+2*i+1] = 0.;
++			B[2*numnodes*1+2*i+0] = 0.;
++			B[2*numnodes*1+2*i+1] = dbasis[1*numnodes+i];
++			B[2*numnodes*2+2*i+0] = .5*dbasis[1*numnodes+i];
++			B[2*numnodes*2+2*i+1] = .5*dbasis[0*numnodes+i];
++			B[2*numnodes*3+2*i+0] = .5*dbasis[2*numnodes+i];
++			B[2*numnodes*3+2*i+1] = 0.;
++			B[2*numnodes*4+2*i+0] = 0.;
++			B[2*numnodes*4+2*i+1] = .5*dbasis[2*numnodes+i];
++		}
++	}
+ 
++
+ 	/*Clean-up*/
+ 	xDelete<IssmDouble>(dbasis);
+ }/*}}}*/
+-void StressbalanceAnalysis::GetBHOprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++void StressbalanceAnalysis::GetBHOprime(IssmDouble* Bprime,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 
+ 	 * For node i, Bi' can be expressed in the actual coordinate system
+ 	 * by: 
+-	 *       Bi_prime=[ 2*dN/dx    dN/dy ]
+-	 *                [   dN/dx  2*dN/dy ]
+-	 *                [   dN/dy    dN/dx ]
++	 *                          3D                      2D
++	 *       Bi_prime=[ 2*dN/dx    dN/dy ] Bi_prime=[ 2*dN/dx ]
++	 *                [   dN/dx  2*dN/dy ]          [   dN/dy ]
++	 *                [   dN/dy    dN/dx ]  
+ 	 * where hNis the finiteelement function for node i.
+ 	 *
+ 	 * We assume B' has been allocated already, of size: 3x(NDOF2*numnodes)
+@@ -2324,31 +2397,40 @@
+ 	int numnodes = element->GetNumberOfNodes();
+ 
+ 	/*Get nodal functions derivatives*/
+-	IssmDouble* dbasis=xNew<IssmDouble>(3*numnodes);
++	IssmDouble* dbasis=xNew<IssmDouble>(dim*numnodes);
+ 	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+ 
+ 	/*Build B': */
+-	for(int i=0;i<numnodes;i++){
+-		Bprime[2*numnodes*0+2*i+0] = 2.*dbasis[0*numnodes+i];
+-		Bprime[2*numnodes*0+2*i+1] = dbasis[1*numnodes+i];
+-		Bprime[2*numnodes*1+2*i+0] = dbasis[0*numnodes+i];
+-		Bprime[2*numnodes*1+2*i+1] = 2.*dbasis[1*numnodes+i];
+-		Bprime[2*numnodes*2+2*i+0] = dbasis[1*numnodes+i];
+-		Bprime[2*numnodes*2+2*i+1] = dbasis[0*numnodes+i];
+-		Bprime[2*numnodes*3+2*i+0] = dbasis[2*numnodes+i];
+-		Bprime[2*numnodes*3+2*i+1] = 0.;
+-		Bprime[2*numnodes*4+2*i+0] = 0.;
+-		Bprime[2*numnodes*4+2*i+1] = dbasis[2*numnodes+i];
++	if(dim==3){
++		for(int i=0;i<numnodes;i++){
++			Bprime[2*numnodes*0+2*i+0] = 2.*dbasis[0*numnodes+i];
++			Bprime[2*numnodes*0+2*i+1] = dbasis[1*numnodes+i];
++			Bprime[2*numnodes*1+2*i+0] = dbasis[0*numnodes+i];
++			Bprime[2*numnodes*1+2*i+1] = 2.*dbasis[1*numnodes+i];
++			Bprime[2*numnodes*2+2*i+0] = dbasis[1*numnodes+i];
++			Bprime[2*numnodes*2+2*i+1] = dbasis[0*numnodes+i];
++			Bprime[2*numnodes*3+2*i+0] = dbasis[2*numnodes+i];
++			Bprime[2*numnodes*3+2*i+1] = 0.;
++			Bprime[2*numnodes*4+2*i+0] = 0.;
++			Bprime[2*numnodes*4+2*i+1] = dbasis[2*numnodes+i];
++		}
+ 	}
++	else{
++		for(int i=0;i<numnodes;i++){
++			Bprime[numnodes*0+i] = 2.*dbasis[0*numnodes+i];
++			Bprime[numnodes*1+i] = dbasis[1*numnodes+i];
++		}
++		}
+ 
+ 	/*Clean-up*/
+ 	xDelete<IssmDouble>(dbasis);
+ }/*}}}*/
+-void StressbalanceAnalysis::GetBHOFriction(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++void StressbalanceAnalysis::GetBHOFriction(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*Compute B  matrix. B=[B1 B2 B3] where Bi is square and of size 2. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
+ 	 * by: 
+-	 *                 Bi=[ N   0 ]
++	 *                       3D           2D
++	 *                 Bi=[ N   0 ]    Bi=N
+ 	 *                    [ 0   N ]
+ 	 * where N is the finiteelement function for node i.
+ 	 *
+@@ -2363,22 +2445,37 @@
+ 	element->NodalFunctions(basis,gauss);
+ 
+ 	/*Build L: */
+-	for(int i=0;i<numnodes;i++){
+-		B[2*numnodes*0+2*i+0] = basis[i];
+-		B[2*numnodes*0+2*i+1] = 0.;
+-		B[2*numnodes*1+2*i+0] = 0.;
+-		B[2*numnodes*1+2*i+1] = basis[i];
++	if(dim==3){
++		for(int i=0;i<numnodes;i++){
++			B[2*numnodes*0+2*i+0] = basis[i];
++			B[2*numnodes*0+2*i+1] = 0.;
++			B[2*numnodes*1+2*i+0] = 0.;
++			B[2*numnodes*1+2*i+1] = basis[i];
++		}
+ 	}
++	else{
++		for(int i=0;i<numnodes;i++){
++			B[i] = basis[i];
++		}
++	}
+ 
+ 	/*Clean-up*/
+ 	xDelete<IssmDouble>(basis);
+ }/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionHO(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	int         i;
++	int         i,dim,meshtype;
+ 	int*        doflist=NULL;
+ 	IssmDouble* xyz_list=NULL;
+ 
++	/*Get mesh dimension*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; break;
++		case Mesh3DEnum:         dim = 3; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
+ 	/*Deal with pressure first*/
+ 	int numvertices = element->GetNumberOfVertices();
+ 	IssmDouble* pressure  = xNew<IssmDouble>(numvertices);
+@@ -2394,15 +2491,15 @@
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+-	int numdof   = numnodes*2;
++	int numdof   = numnodes*(dim-1);
+ 
+ 	/*Fetch dof list and allocate solution vectors*/
+ 	element->GetDofList(&doflist,HOApproximationEnum,GsetEnum);
+-	IssmDouble* values    = xNew<IssmDouble>(numdof);
+-	IssmDouble* vx        = xNew<IssmDouble>(numnodes);
+-	IssmDouble* vy        = xNew<IssmDouble>(numnodes);
+-	IssmDouble* vz        = xNew<IssmDouble>(numnodes);
+-	IssmDouble* vel       = xNew<IssmDouble>(numnodes);
++	IssmDouble* values = xNew<IssmDouble>(numdof);
++	IssmDouble* vx     = xNew<IssmDouble>(numnodes);
++	IssmDouble* vy     = xNew<IssmDouble>(numnodes);
++	IssmDouble* vz     = xNew<IssmDouble>(numnodes);
++	IssmDouble* vel    = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Use the dof list to index into the solution vector: */
+ 	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+@@ -2412,30 +2509,35 @@
+ 
+ 	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+ 	for(i=0;i<numnodes;i++){
+-		vx[i]=values[i*2+0];
+-		vy[i]=values[i*2+1];
+-
+-		/*Check solution*/
++		vx[i]=values[i*(dim-1)+0];
+ 		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
+-		if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
++		if(dim==3){
++			vy[i]=values[i*(dim-1)+1];
++			if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
++		}
+ 	}
+ 
+ 	/*Get Vz and compute vel*/
+-	element->GetInputListOnNodes(&vz[0],VzEnum,0.);
+-	for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
++	if(dim==3){
++		element->GetInputListOnNodes(&vz[0],VzEnum,0.);
++		for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
++	}
++	else{
++		element->GetInputListOnNodes(&vy[0],VyEnum,0.);
++		for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i]);
++	}
+ 
+ 	/*Now, we have to move the previous Vx and Vy inputs  to old 
+ 	 * status, otherwise, we'll wipe them off: */
+ 	element->InputChangeName(VxEnum,VxPicardEnum);
+-	element->InputChangeName(VyEnum,VyPicardEnum);
+-	element->InputChangeName(PressureEnum,PressurePicardEnum);
++	if(dim==3)element->InputChangeName(VyEnum,VyPicardEnum);
+ 
+ 	/*Add vx and vy as inputs to the element: */
+ 	//element->AddInput(VxEnum,  vx,element->GetElementType());
+ 	//element->AddInput(VyEnum,  vy,element->GetElementType());
+ 	//element->AddInput(VelEnum,vel,element->GetElementType());
+ 	element->AddInput(VxEnum,vx,P1Enum);
+-	element->AddInput(VyEnum,vy,P1Enum);
++	if(dim==3)element->AddInput(VyEnum,vy,P1Enum);
+ 	element->AddInput(VelEnum,vel,P1Enum);
+ 
+ 	/*Free ressources:*/
+@@ -3578,8 +3680,8 @@
+ 		this->GetBSSAprime(&Bprime[0][0], basaltria,xyz_list, gauss_tria);
+ 
+ 		if(approximation==SSAHOApproximationEnum){
+-			element->ViscosityHO(&viscosity,xyz_list,gauss,vx_input,vy_input);
+-			element->ViscosityHO(&oldviscosity,xyz_list,gauss,vxold_input,vyold_input);
++			element->ViscosityHO(&viscosity,dim,xyz_list,gauss,vx_input,vy_input);
++			element->ViscosityHO(&oldviscosity,dim,xyz_list,gauss,vxold_input,vyold_input);
+ 			newviscosity=viscosity+viscosity_overshoot*(viscosity-oldviscosity);
+ 		}
+ 		else if (approximation==SSAFSApproximationEnum){
+@@ -3792,7 +3894,7 @@
+ 		/*Friction: */
+ 		friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input);
+ 		element->JacobianDeterminantBase(&Jdet2d, xyz_list_tria,gauss);
+-		this->GetBHOFriction(L,element,xyz_list_tria,gauss);
++		this->GetBHOFriction(L,element,3,xyz_list_tria,gauss);
+ 
+ 		DL_scalar=alpha2*gauss->weight*Jdet2d;
+ 		for (i=0;i<2;i++) DL[i][i]=DL_scalar; 
+@@ -3877,8 +3979,8 @@
+ 		element->JacobianDeterminant(&Jdet, xyz_list,gauss);
+ 		this->GetBSSAHO(B, element,xyz_list, gauss);
+ 		this->GetBSSAprime(Bprime, basaltria,xyz_list, gauss_tria); 
+-		element->ViscosityHO(&viscosity,xyz_list,gauss,vx_input,vy_input);
+-		element->ViscosityHO(&oldviscosity,xyz_list,gauss,vxold_input,vyold_input);
++		element->ViscosityHO(&viscosity,3,xyz_list,gauss,vx_input,vy_input);
++		element->ViscosityHO(&oldviscosity,3,xyz_list,gauss,vxold_input,vyold_input);
+ 
+ 		newviscosity=viscosity+viscosity_overshoot*(viscosity-oldviscosity);
+ 		D_scalar=2*newviscosity*gauss->weight*Jdet;
+Index: ../trunk-jpl/src/c/classes/Materials/Matice.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 17241)
++++ ../trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 17242)
+@@ -371,6 +371,71 @@
+ 	*pviscosity=viscosity;
+ }
+ /*}}}*/
++/*FUNCTION Matice::GetViscosity2dverticalHO {{{*/
++void  Matice::GetViscosity2dverticalHO(IssmDouble* pviscosity, IssmDouble* epsilon){
++	/*From a string tensor and a material object, return viscosity, using Glen's flow law.
++									   (1-D) B
++	  viscosity= --------------------------------------
++						  2[ 2exx^2 + 2exy^2]^[(n-1)/2n]
++
++	  where viscosity is the viscotiy, B the flow law parameter , (u,v) the velocity 
++	  vector, and n the flow law exponent.
++
++	  If epsilon is NULL, it means this is the first time SystemMatrices is being run, and we 
++	  return 10^14, initial viscosity.
++	  */
++
++	/*output: */
++	IssmDouble viscosity;
++
++	/*input strain rate: */
++	IssmDouble exx,exy;
++
++	/*Intermediary: */
++	IssmDouble A,e;
++	IssmDouble B,D,n;
++
++	/*Get B and n*/
++	B=GetB();
++	n=GetN();
++	D=GetD();
++
++	if (n==1){
++		/*Viscous behaviour! viscosity=B: */
++		viscosity=(1-D)*B/2;
++	}
++	else{
++		if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0)){
++			viscosity=0.5*pow(10.,14);
++		}
++		else{
++			/*Retrive strain rate components: */
++			exx=epsilon[0];
++			exy=epsilon[1];
++
++			/*Build viscosity: viscosity=B/(2*A^e) */
++			A=2*exx*exx+2.*exy*exy;
++			if(A==0.){
++				/*Maxiviscositym viscosity for 0 shear areas: */
++				viscosity=2.5*2.e+17;
++			}
++			else{
++				e=(n-1.)/(2.*n);
++				viscosity=(1.-D)*B/(2.*pow(A,e));
++			}
++		}
++	}
++
++	/*Checks in debugging mode*/
++	if(viscosity<=0) _error_("Negative viscosity");
++	_assert_(B>0);
++	_assert_(n>0);
++	_assert_(D>=0 && D<1);
++
++	/*Return: */
++	*pviscosity=viscosity;
++}
++/*}}}*/
+ /*FUNCTION Matice::GetViscosity3d {{{*/
+ void  Matice::GetViscosity3d(IssmDouble* pviscosity3d, IssmDouble* epsilon){
+ 
+Index: ../trunk-jpl/src/c/classes/Materials/Material.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Material.h	(revision 17241)
++++ ../trunk-jpl/src/c/classes/Materials/Material.h	(revision 17242)
+@@ -27,6 +27,7 @@
+ 		virtual void       GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum)=0;
+ 		virtual void       GetViscosity2d(IssmDouble* pviscosity, IssmDouble* pepsilon)=0;
+ 		virtual void       GetViscosity2dvertical(IssmDouble* pviscosity, IssmDouble* pepsilon)=0;
++		virtual void       GetViscosity2dverticalHO(IssmDouble* pviscosity, IssmDouble* pepsilon)=0;
+ 		virtual void       GetViscosity3d(IssmDouble* pviscosity3d, IssmDouble* pepsilon)=0;
+ 		virtual void       GetViscosity3dFS(IssmDouble* pviscosity3d, IssmDouble* epsilon)=0;
+ 		virtual void       GetViscosityComplement(IssmDouble* pviscosity_complement, IssmDouble* pepsilon)=0;
+Index: ../trunk-jpl/src/c/classes/Materials/Matice.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matice.h	(revision 17241)
++++ ../trunk-jpl/src/c/classes/Materials/Matice.h	(revision 17242)
+@@ -53,6 +53,7 @@
+ 		void       SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
+ 		void       GetViscosity2d(IssmDouble* pviscosity, IssmDouble* pepsilon);
+ 		void       GetViscosity2dvertical(IssmDouble* pviscosity, IssmDouble* pepsilon);
++		void       GetViscosity2dverticalHO(IssmDouble* pviscosity, IssmDouble* pepsilon);
+ 		void       GetViscosity3d(IssmDouble* pviscosity3d, IssmDouble* pepsilon);
+ 		void       GetViscosity3dFS(IssmDouble* pviscosity3d, IssmDouble* epsilon);
+ 		void       GetViscosityComplement(IssmDouble* pviscosity_complement, IssmDouble* pepsilon);
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 17241)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 17242)
+@@ -83,6 +83,7 @@
+ 		void       GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum){return;}
+ 		void       GetViscosity2d(IssmDouble* pviscosity, IssmDouble* pepsilon){_error_("not supported");};
+ 		void       GetViscosity2dvertical(IssmDouble* pviscosity, IssmDouble* pepsilon){_error_("not supported");};
++		void       GetViscosity2dverticalHO(IssmDouble* pviscosity, IssmDouble* pepsilon){_error_("not supported");};
+ 		void       GetViscosity3d(IssmDouble* pviscosity3d, IssmDouble* pepsilon){_error_("not supported");};
+ 		void       GetViscosity3dFS(IssmDouble* pviscosity3d, IssmDouble* epsilon){_error_("not supported");};
+ 		void       GetViscosityComplement(IssmDouble* pviscosity_complement, IssmDouble* pepsilon){_error_("not supported");};
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17241)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17242)
+@@ -69,11 +69,12 @@
+ 		void       ResultToPatch(IssmDouble* values,int nodesperelement,int output_enum);
+ 		void       StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 		void       StrainRateHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
++		void       StrainRateHO2dvertical(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 		void       StrainRateFS(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+ 		IssmDouble TMeltingPoint(IssmDouble pressure);
+ 		void       ViscousHeatingCreateInput(void);
+ 		void       ViscosityFS(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+-		void       ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
++		void       ViscosityHO(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 		void       ViscosityL1L2(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* surf);
+ 		void       ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 		void       ViscositySSADerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon);
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17241)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17242)
+@@ -377,14 +377,21 @@
+ 	/*Assign output pointer*/
+ 	*pviscosity = viscosity;
+ }/*}}}*/
+-void Element::ViscosityHO(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
++void Element::ViscosityHO(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble viscosity;
+-	IssmDouble epsilon[5];/* epsilon=[exx,eyy,exy,exz,eyz];*/
++	IssmDouble epsilon3d[5];/* epsilon=[exx,eyy,exy,exz,eyz];*/
++	IssmDouble epsilon2d[2]; /* epsilon=[exx,exy];           */
+ 
+-	this->StrainRateHO(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
+-	material->GetViscosity3d(&viscosity, &epsilon[0]);
++	if(dim==3){
++		this->StrainRateHO(&epsilon3d[0],xyz_list,gauss,vx_input,vy_input);
++		material->GetViscosity3d(&viscosity, &epsilon3d[0]);
++	}
++	else{
++		this->StrainRateHO2dvertical(&epsilon2d[0],xyz_list,gauss,vx_input,vy_input);
++		material->GetViscosity2dverticalHO(&viscosity, &epsilon2d[0]);
++	}
+ 
+ 	/*Assign output pointer*/
+ 	*pviscosity=viscosity;
+@@ -468,6 +475,30 @@
+ 	epsilon[4] = 0.5*dvy[2];
+ 
+ }/*}}}*/
++void Element::StrainRateHO2dvertical(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
++	/*Compute the 2d Blatter/HOStrain Rate (2 components):
++	 *
++	 * epsilon=[exx exz]
++	 *
++	 * with exz=1/2 du/dz
++	 *
++	 * the contribution of vz is neglected
++	 */
++
++	/*Intermediaries*/
++	IssmDouble dvx[3];
++
++	/*Check that both inputs have been found*/
++	if (!vx_input){
++		_error_("Input missing. Here are the input pointers we have for vx: " << vx_input <<"\n");
++	}
++
++	/*Get strain rate assuming that epsilon has been allocated*/
++	vx_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
++	epsilon[0] = dvx[0];
++	epsilon[1] = 0.5*dvx[1];
++
++}/*}}}*/
+ void Element::StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
+ 
+ 	/*Intermediaries*/
+Index: ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp	(revision 17241)
++++ ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp	(revision 17242)
+@@ -450,6 +450,11 @@
+ 	GaussTria* gauss = dynamic_cast<GaussTria*>(gauss_in);
+ 
+ 	switch(finiteelement){
++		case P0Enum:
++			/*Nodal function 1*/
++			dbasis[NUMNODESP0*0+0] = 0.;
++			dbasis[NUMNODESP0*1+0] = 0.;
++			return;
+ 		case P1Enum: case P1DGEnum:
+ 			/*Nodal function 1*/
+ 			dbasis[NUMNODESP1*0+0] = -0.5;
Index: issm/oecreview/Archive/16554-17801/ISSM-17242-17243.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17242-17243.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17242-17243.diff	(revision 17802)
@@ -0,0 +1,15 @@
+Index: ../trunk-jpl/src/m/classes/flowequation.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/flowequation.m	(revision 17242)
++++ ../trunk-jpl/src/m/classes/flowequation.m	(revision 17243)
+@@ -94,8 +94,8 @@
+ 					md = checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[1:2]);
+ 					md = checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[1:2]);
+ 				elseif strcmp(meshtype(md.mesh),'2Dvertical')
+-					md = checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[4]);
+-					md = checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[4]);
++					md = checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[3:4]);
++					md = checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[3:4]);
+ 				elseif strcmp(meshtype(md.mesh),'3D'),
+ 					md = checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[0:8]);
+ 					md = checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[0:8]);
Index: issm/oecreview/Archive/16554-17801/ISSM-17243-17244.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17243-17244.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17243-17244.diff	(revision 17802)
@@ -0,0 +1,81 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17243)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17244)
+@@ -2055,7 +2055,7 @@
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+-	int numdof   = numnodes*2;
++	int numdof   = numnodes*(dim-1);
+ 
+ 	/*Initialize Element matrix and vectors*/
+ 	ElementMatrix* Ke     = element->NewElementMatrix(HOApproximationEnum);
+@@ -2098,7 +2098,7 @@
+ 	}
+ 
+ 	/*Transform Coordinate System*/
+-	element->TransformStiffnessMatrixCoord(Ke,XYEnum);
++	if(dim==3) element->TransformStiffnessMatrixCoord(Ke,XYEnum);
+ 
+ 	/*Clean up and return*/
+ 	delete gauss;
+@@ -2184,7 +2184,7 @@
+ 	}
+ 
+ 	/*Transform Coordinate System*/
+-	element->TransformStiffnessMatrixCoord(Ke,XYEnum);
++	if(dim==3) element->TransformStiffnessMatrixCoord(Ke,XYEnum);
+ 
+ 	/*Clean up and return*/
+ 	delete gauss;
+@@ -2249,7 +2249,7 @@
+ 	}
+ 
+ 	/*Transform coordinate system*/
+-	element->TransformLoadVectorCoord(pe,XYEnum);
++	if(dim==3) element->TransformLoadVectorCoord(pe,XYEnum);
+ 
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(basis);
+@@ -2307,7 +2307,8 @@
+ 
+ 		gauss->GaussPoint(ig);
+ 		surface_input->GetInputValue(&surface,gauss);
+-		z=element->GetZcoord(gauss);
++		if(dim==3) z=element->GetZcoord(gauss);
++		else       z=element->GetYcoord(gauss);
+ 		element->NodalFunctions(basis,gauss);
+ 		element->JacobianDeterminantSurface(&Jdet,xyz_list_front,gauss);
+ 
+@@ -2322,7 +2323,7 @@
+ 	}
+ 
+ 	/*Transform coordinate system*/
+-	element->TransformLoadVectorCoord(pe,XYEnum);
++	if(dim==3)element->TransformLoadVectorCoord(pe,XYEnum);
+ 
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(basis);
+@@ -2505,7 +2506,7 @@
+ 	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+ 
+ 	/*Transform solution in Cartesian Space*/
+-	element->TransformSolutionCoord(&values[0],XYEnum);
++	if(dim==3) element->TransformSolutionCoord(&values[0],XYEnum);
+ 
+ 	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+ 	for(i=0;i<numnodes;i++){
+Index: ../trunk-jpl/src/c/classes/Materials/Matice.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 17243)
++++ ../trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 17244)
+@@ -405,7 +405,7 @@
+ 		viscosity=(1-D)*B/2;
+ 	}
+ 	else{
+-		if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0)){
++		if((epsilon[0]==0) && (epsilon[1]==0)){
+ 			viscosity=0.5*pow(10.,14);
+ 		}
+ 		else{
Index: issm/oecreview/Archive/16554-17801/ISSM-17244-17245.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17244-17245.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17244-17245.diff	(revision 17802)
@@ -0,0 +1,62 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17244)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17245)
+@@ -483,7 +483,7 @@
+ 		}
+ 		else{
+ 			IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvxEnum,StressbalanceAnalysisEnum,finiteelement,1);
+-			if(iomodel->meshtype==Mesh3DEnum){
++			if(iomodel->meshtype!=Mesh2DverticalEnum){
+ 				IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvyEnum,StressbalanceAnalysisEnum,finiteelement,2);
+ 			}
+ 		}
+@@ -962,20 +962,21 @@
+ void StressbalanceAnalysis::GetSolutionFromInputsHoriz(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 
+ 	IssmDouble   vx,vy;
+-	int          meshtype,dim,approximation;
++	int          meshtype,dim,approximation,dofpernode;
+ 	int*         doflist = NULL;
+ 
+ 	/*Get some parameters*/
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+ 	switch(meshtype){
+-		case Mesh2DverticalEnum: dim = 2; break;
+-		case Mesh3DEnum:         dim = 3; break;
++		case Mesh2DhorizontalEnum: dim = 2; dofpernode = 2; break;
++		case Mesh2DverticalEnum:   dim = 2; dofpernode = 1; break;
++		case Mesh3DEnum:           dim = 3; dofpernode = 2; break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+-	int numdof   = numnodes*(dim-1);
++	int numdof   = numnodes*dofpernode;
+ 	element->GetInputValue(&approximation,ApproximationEnum);
+ 
+ 	/*Fetch dof list and allocate solution vector*/
+@@ -985,7 +986,7 @@
+ 	/*Get inputs*/
+ 	Input* vx_input=element->GetInput(VxEnum); _assert_(vx_input);
+ 	Input* vy_input=NULL;
+-	if(dim==3){vy_input=element->GetInput(VyEnum); _assert_(vy_input);}
++	if(meshtype!=Mesh2DverticalEnum){vy_input=element->GetInput(VyEnum); _assert_(vy_input);}
+ 
+ 	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+ 	Gauss* gauss=element->NewGauss();
+@@ -994,10 +995,10 @@
+ 
+ 		/*Recover vx and vy*/
+ 		vx_input->GetInputValue(&vx,gauss);
+-		values[i*(dim-1)+0]=vx;
+-		if(dim==3){
++		values[i*dofpernode+0]=vx;
++		if(dofpernode==2){
+ 			vy_input->GetInputValue(&vy,gauss);
+-			values[i*(dim-1)+1]=vy;
++			values[i*dofpernode+1]=vy;
+ 		}
+ 	}
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17245-17246.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17245-17246.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17245-17246.diff	(revision 17802)
@@ -0,0 +1,15 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17245)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17246)
+@@ -1043,8 +1043,8 @@
+ }/*}}}*/
+ void StressbalanceAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+ 	/*Default, do nothing*/
+-	_printf0_("Updating active and non-active nodes in Femmodel \n");
+-	SetActiveNodesLSMx(femmodel->elements);
++	_printf0_("   Updating active and non-active nodes in Femmodel \n");
++	//SetActiveNodesLSMx(femmodel->elements);
+ 	return;
+ }/*}}}*/
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17246-17247.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17246-17247.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17246-17247.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17246)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17247)
+@@ -2137,7 +2137,7 @@
+ 	/*Initialize Element matrix and vectors*/
+ 	ElementMatrix* Ke = element->NewElementMatrix(HOApproximationEnum);
+ 	IssmDouble*    B  = xNew<IssmDouble>((dim-1)*numdof);
+-	IssmDouble*    D  = xNew<IssmDouble>((dim-1)*(dim-1));
++	IssmDouble*    D  = xNewZeroInit<IssmDouble>((dim-1)*(dim-1));
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinatesBase(&xyz_list_base);
Index: issm/oecreview/Archive/16554-17801/ISSM-17247-17248.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17247-17248.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17247-17248.diff	(revision 17802)
@@ -0,0 +1,678 @@
+Index: ../trunk-jpl/test/Archives/Archive103.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/c/classes/Materials/Matice.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 17247)
++++ ../trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 17248)
+@@ -239,350 +239,104 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Matice::GetViscosity2d {{{*/
+-void  Matice::GetViscosity2d(IssmDouble* pviscosity, IssmDouble* epsilon){
++/*FUNCTION Matice::GetViscosity {{{*/
++void  Matice::GetViscosity(IssmDouble* pviscosity,IssmDouble eps_eff){
+ 	/*From a string tensor and a material object, return viscosity, using Glen's flow law.
+-												    (1-D) B
+-	  viscosity= -------------------------------------------------------------------
+-						  2[ exx^2+eyy^2+exx*eyy+exy^2+exz^2+eyz^2 ]^[(n-1)/2n]
++								(1-D) B
++	  viscosity= -------------------------
++						  2 eps_eff ^[(n-1)/n]
+ 
+-	  where viscosity is the viscotiy, B the flow law parameter , (u,v) the velocity 
+-	  vector, and n the flow law exponent.
++	  where viscosity is the viscotiy, B the flow law parameter , eps_eff is the effective strain rate
++	  and n the flow law exponent.
+ 
+-	  If epsilon is NULL, it means this is the first time SystemMatrices is being run, and we 
++	  If eps_eff = 0 , it means this is the first time SystemMatrices is being run, and we 
+ 	  return 10^14, initial viscosity.
+ 	  */
+ 
+ 	/*output: */
+ 	IssmDouble viscosity;
+ 
+-	/*input strain rate: */
+-	IssmDouble exx,eyy,exy;
+-
+ 	/*Intermediary: */
+-	IssmDouble A,e;
+ 	IssmDouble B,D,n;
+ 
+ 	/*Get B and n*/
+-	B=GetBbar();
+-	n=GetN();
+-	D=GetDbar();
++	B=GetB(); _assert_(B>0.);
++	n=GetN(); _assert_(n>0.);
++	D=GetD(); _assert_(D>=0. && D<1.);
+ 
+-	if (n==1){
+-		/*Viscous behaviour! viscosity=B: */
+-		viscosity=(1-D)*B/2;
++	if (n==1.){
++		/*Linear Viscous behavior (Newtonian fluid) viscosity=B/2: */
++		viscosity=(1.-D)*B/2.;
+ 	}
+ 	else{
+-		if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0)){
+-			viscosity=0.5*pow(10.,14);
+-		}
+-		else{
+-			/*Retrive strain rate components: */
+-			exx=*(epsilon+0);
+-			eyy=*(epsilon+1);
+-			exy=*(epsilon+2);
+ 
+-			/*Build viscosity: viscosity=B/(2*A^e) */
+-			A=pow(exx,2)+pow(eyy,2)+pow(exy,2)+exx*eyy;
+-			if(A==0){
+-				/*Maxiviscositym viscosity for 0 shear areas: */
+-				viscosity=2.5*pow(10.,17);
+-			}
+-			else{
+-				e=(n-1)/(2*n);
+-				viscosity=(1-D)*B/(2*pow(A,e));
+-			}
++		/*if no strain rate, return maximum viscosity*/
++		if(eps_eff==0.){
++			viscosity = 1.e+14/2.;
++			//viscosity=2.5*pow(10.,17);
+ 		}
+-	}
+ 
+-	/*Checks in debugging mode*/
+-	if(viscosity<=0) _error_("Negative viscosity");
+-	_assert_(B>0);
+-	_assert_(n>0);
+-	_assert_(D>=0 && D<1);
+-
+-	/*Return: */
+-	*pviscosity=viscosity;
+-}
+-/*}}}*/
+-/*FUNCTION Matice::GetViscosity2dvertical {{{*/
+-void  Matice::GetViscosity2dvertical(IssmDouble* pviscosity, IssmDouble* epsilon){
+-	/*From a string tensor and a material object, return viscosity, using Glen's flow law.
+-									   (1-D) B
+-	  viscosity= --------------------------------------
+-						  2[ exx^2+eyy^2+ 2exy^2]^[(n-1)/2n]
+-
+-	  where viscosity is the viscotiy, B the flow law parameter , (u,v) the velocity 
+-	  vector, and n the flow law exponent.
+-
+-	  If epsilon is NULL, it means this is the first time SystemMatrices is being run, and we 
+-	  return 10^14, initial viscosity.
+-	  */
+-
+-	/*output: */
+-	IssmDouble viscosity;
+-
+-	/*input strain rate: */
+-	IssmDouble exx,eyy,exy;
+-
+-	/*Intermediary: */
+-	IssmDouble A,e;
+-	IssmDouble B,D,n;
+-
+-	/*Get B and n*/
+-	B=GetB();
+-	n=GetN();
+-	D=GetD();
+-
+-	if (n==1){
+-		/*Viscous behaviour! viscosity=B: */
+-		viscosity=(1-D)*B/2;
+-	}
+-	else{
+-		if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0)){
+-			viscosity=0.5*pow(10.,14);
+-		}
+ 		else{
+-			/*Retrive strain rate components: */
+-			exx=epsilon[0];
+-			eyy=epsilon[1];
+-			exy=epsilon[2];
+-
+-			/*Build viscosity: viscosity=B/(2*A^e) */
+-			A=exx*exx+eyy*eyy+2.*exy*exy;
+-			if(A==0.){
+-				/*Maxiviscositym viscosity for 0 shear areas: */
+-				viscosity=2.5*2.e+17;
+-			}
+-			else{
+-				e=(n-1.)/(2.*n);
+-				viscosity=(1.-D)*B/(2.*pow(A,e));
+-			}
++			viscosity=(1.-D)*B/(2.*pow(eps_eff,(n-1.)/n));
+ 		}
+ 	}
+ 
+ 	/*Checks in debugging mode*/
+ 	if(viscosity<=0) _error_("Negative viscosity");
+-	_assert_(B>0);
+-	_assert_(n>0);
+-	_assert_(D>=0 && D<1);
+ 
+ 	/*Return: */
+ 	*pviscosity=viscosity;
+ }
+ /*}}}*/
+-/*FUNCTION Matice::GetViscosity2dverticalHO {{{*/
+-void  Matice::GetViscosity2dverticalHO(IssmDouble* pviscosity, IssmDouble* epsilon){
++/*FUNCTION Matice::GetViscosityBar {{{*/
++void  Matice::GetViscosityBar(IssmDouble* pviscosity,IssmDouble eps_eff){
+ 	/*From a string tensor and a material object, return viscosity, using Glen's flow law.
+-									   (1-D) B
+-	  viscosity= --------------------------------------
+-						  2[ 2exx^2 + 2exy^2]^[(n-1)/2n]
++								(1-D) B
++	  viscosity= -------------------------
++						  2 eps_eff ^[(n-1)/n]
+ 
+-	  where viscosity is the viscotiy, B the flow law parameter , (u,v) the velocity 
+-	  vector, and n the flow law exponent.
++	  where viscosity is the viscotiy, B the flow law parameter , eps_eff is the effective strain rate
++	  and n the flow law exponent.
+ 
+-	  If epsilon is NULL, it means this is the first time SystemMatrices is being run, and we 
++	  If eps_eff = 0 , it means this is the first time SystemMatrices is being run, and we 
+ 	  return 10^14, initial viscosity.
+ 	  */
+ 
+ 	/*output: */
+ 	IssmDouble viscosity;
+ 
+-	/*input strain rate: */
+-	IssmDouble exx,exy;
+-
+ 	/*Intermediary: */
+-	IssmDouble A,e;
+ 	IssmDouble B,D,n;
+ 
+ 	/*Get B and n*/
+-	B=GetB();
+-	n=GetN();
+-	D=GetD();
++	B=GetBbar(); _assert_(B>0.);
++	n=GetN();    _assert_(n>0.);
++	D=GetDbar(); _assert_(D>=0. && D<1.);
+ 
+-	if (n==1){
+-		/*Viscous behaviour! viscosity=B: */
+-		viscosity=(1-D)*B/2;
++	if (n==1.){
++		/*Linear Viscous behavior (Newtonian fluid) viscosity=B/2: */
++		viscosity=(1.-D)*B/2.;
+ 	}
+ 	else{
+-		if((epsilon[0]==0) && (epsilon[1]==0)){
+-			viscosity=0.5*pow(10.,14);
++
++		/*if no strain rate, return maximum viscosity*/
++		if(eps_eff==0.){
++			viscosity = 1.e+14/2.;
++			//viscosity=2.5*pow(10.,17);
+ 		}
+-		else{
+-			/*Retrive strain rate components: */
+-			exx=epsilon[0];
+-			exy=epsilon[1];
+ 
+-			/*Build viscosity: viscosity=B/(2*A^e) */
+-			A=2*exx*exx+2.*exy*exy;
+-			if(A==0.){
+-				/*Maxiviscositym viscosity for 0 shear areas: */
+-				viscosity=2.5*2.e+17;
+-			}
+-			else{
+-				e=(n-1.)/(2.*n);
+-				viscosity=(1.-D)*B/(2.*pow(A,e));
+-			}
++		else{
++			viscosity=(1.-D)*B/(2.*pow(eps_eff,(n-1.)/n));
+ 		}
+ 	}
+ 
+ 	/*Checks in debugging mode*/
+ 	if(viscosity<=0) _error_("Negative viscosity");
+-	_assert_(B>0);
+-	_assert_(n>0);
+-	_assert_(D>=0 && D<1);
+ 
+ 	/*Return: */
+ 	*pviscosity=viscosity;
+ }
+ /*}}}*/
+-/*FUNCTION Matice::GetViscosity3d {{{*/
+-void  Matice::GetViscosity3d(IssmDouble* pviscosity3d, IssmDouble* epsilon){
+-
+-	/*Return viscosity accounting for steady state power law creep [Thomas and SSA, 1982]: 
+-	 *
+-	 *                                               (1-D)*B
+-	 * viscosity3d= -------------------------------------------------------------------
+-	 *                      2[ exx^2+eyy^2+exx*eyy+exy^2+exz^2+eyz^2 ]^[(n-1)/2n]
+-	 *
+-	 *     where mu is the viscotiy, B the flow law parameter , (u,v) the velocity 
+-	 *     vector, and n the flow law exponent.
+-	 *
+-	 * If epsilon is NULL, it means this is the first time Emg is being run, and we 
+-	 * return g, initial viscosity.
+-	 */
+-
+-	/*output: */
+-	IssmDouble viscosity3d;
+-
+-	/*input strain rate: */
+-	IssmDouble exx,eyy,exy,exz,eyz;
+-
+-	/*Intermediaries: */
+-	IssmDouble A,e;
+-	IssmDouble B,D,n;
+-
+-	/*Get B and n*/
+-	B=GetB();
+-	D=GetD();
+-	n=GetN();
+-
+-	if (n==1){
+-		/*Viscous behaviour! viscosity3d=B: */
+-		viscosity3d=(1-D)*B/2;
+-	}
+-	else{
+-		if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0) && 
+-				(epsilon[3]==0) && (epsilon[4]==0)){
+-			viscosity3d=0.5*pow(10.,14);
+-		}
+-		else{
+-
+-			/*Retrive strain rate components: */
+-			exx=*(epsilon+0);
+-			eyy=*(epsilon+1);
+-			exy=*(epsilon+2);
+-			exz=*(epsilon+3);
+-			eyz=*(epsilon+4);
+-
+-			/*Build viscosity: viscosity3d=2*B/(2*A^e) */
+-			A=pow(exx,2)+pow(eyy,2)+pow(exy,2)+pow(exz,2)+pow(eyz,2)+exx*eyy;
+-			if(A==0){
+-				/*Maxiviscosity3dm viscosity for 0 shear areas: */
+-				viscosity3d=2.25*pow(10.,17);
+-			}
+-			else{
+-				e=(n-1)/2/n;
+-
+-				viscosity3d=(1-D)*B/(2*pow(A,e));
+-			}
+-		}
+-	}
+-
+-	/*Checks in debugging mode*/
+-	if(viscosity3d<=0) _error_("Negative viscosity");
+-	_assert_(B>0);
+-	_assert_(n>0);
+-	_assert_(D>=0 && D<1);
+-
+-	/*Assign output pointers:*/
+-	*pviscosity3d=viscosity3d;
+-}
+-/*}}}*/
+-/*FUNCTION Matice::GetViscosity3dFS {{{*/
+-void  Matice::GetViscosity3dFS(IssmDouble* pviscosity3d, IssmDouble* epsilon){
+-	/*Return viscosity accounting for steady state power law creep [Thomas and SSA, 1982]: 
+-	 *
+-	 *                                          (1-D)*B
+-	 * viscosity3d= -------------------------------------------------------------------
+-	 *                   2[ exx^2+eyy^2+exx*eyy+exy^2+exz^2+eyz^2 ]^[(n-1)/2n]
+-	 *
+-	 *     where mu is the viscotiy, B the flow law parameter , (u,v) the velocity 
+-	 *     vector, and n the flow law exponent.
+-	 *
+-	 * If epsilon is NULL, it means this is the first time Emg is being run, and we 
+-	 * return g, initial viscosity.
+-	 */
+-
+-	/*output: */
+-	IssmDouble viscosity3d;
+-
+-	/*input strain rate: */
+-	IssmDouble exx,eyy,exy,exz,eyz,ezz;
+-
+-	/*Intermediaries: */
+-	IssmDouble A,e;
+-	IssmDouble B,D,n;
+-	IssmDouble eps0;
+-
+-	/*Get B and n*/
+-	eps0=pow(10.,-27);
+-	B=GetB();
+-	D=GetD();
+-	n=GetN();
+-
+-	if (n==1){
+-		/*Viscous behaviour! viscosity3d=B: */
+-		viscosity3d=(1-D)*B/2;
+-	}
+-	else{
+-		if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0) && 
+-				(epsilon[3]==0) && (epsilon[4]==0) && (epsilon[5]==0)){
+-			viscosity3d=0.5*pow(10.,14);
+-		}
+-		else{
+-
+-			/*Retrive strain rate components: */
+-			exx=*(epsilon+0);
+-			eyy=*(epsilon+1);
+-			ezz=*(epsilon+2); //not used
+-			exy=*(epsilon+3);
+-			exz=*(epsilon+4);
+-			eyz=*(epsilon+5);
+-
+-			/*Build viscosity: viscosity3d=B/(2*A^e) */
+-			A=pow(exx,2)+pow(eyy,2)+pow(exy,2)+pow(exz,2)+pow(eyz,2)+exx*eyy+pow(eps0,2);
+-			if(A==0){
+-				/*Maxiviscosity3dm viscosity for 0 shear areas: */
+-				viscosity3d=2.25*pow(10.,17);
+-			}
+-			else{
+-				e=(n-1)/2/n;
+-				viscosity3d=(1-D)*B/(2*pow(A,e));
+-			}
+-		}
+-	}
+-
+-	/*Checks in debugging mode*/
+-	if(viscosity3d<=0) _error_("Negative viscosity");
+-	_assert_(B>0);
+-	_assert_(n>0);
+-	_assert_(D>=0 && D<1);
+-
+-	/*Assign output pointers:*/
+-	*pviscosity3d=viscosity3d;
+-}
+-/*}}}*/
+ /*FUNCTION Matice::GetViscosityComplement {{{*/
+ void  Matice::GetViscosityComplement(IssmDouble* pviscosity_complement, IssmDouble* epsilon){
+ 	/*Return viscosity accounting for steady state power law creep [Thomas and SSA, 1982]: 
+@@ -705,15 +459,13 @@
+ 	/*input strain rate: */
+ 	IssmDouble exx,eyy,exy,exz,eyz;
+ 
+-	/*Get visocisty and n*/
+-	GetViscosity3d(&mu,epsilon);
+-	n=GetN();
+ 
+ 	if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0) && 
+ 				(epsilon[3]==0) && (epsilon[4]==0)){
+ 		mu_prime=0.5*pow(10.,14);
+ 	}
+ 	else{
++
+ 		/*Retrive strain rate components: */
+ 		exx=epsilon[0];
+ 		eyy=epsilon[1];
+@@ -722,7 +474,9 @@
+ 		eyz=epsilon[4];
+ 		eff2 = exx*exx + eyy*eyy + exx*eyy + exy*exy + exz*exz + eyz*eyz;
+ 
+-		mu_prime=(1-n)/(2*n) * mu/eff2;
++		GetViscosity(&mu,sqrt(eff2));
++		n=GetN();
++		mu_prime=(1.-n)/(2.*n) * mu/eff2;
+ 	}
+ 
+ 	/*Assign output pointers:*/
+@@ -739,10 +493,6 @@
+ 	/*input strain rate: */
+ 	IssmDouble exx,eyy,exy,exz,eyz,ezz;
+ 
+-	/*Get visocisty and n*/
+-	GetViscosity3d(&mu,epsilon);
+-	n=GetN();
+-
+ 	if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0) && 
+ 				(epsilon[3]==0) && (epsilon[4]==0) && (epsilon[5]==0)){
+ 		mu_prime=0.5*pow(10.,14);
+@@ -757,6 +507,8 @@
+ 		eyz=epsilon[5];
+ 		eff2 = exx*exx + eyy*eyy + exx*eyy + exy*exy + exz*exz + eyz*eyz;
+ 
++		GetViscosity(&mu,sqrt(eff2));
++		n=GetN();
+ 		mu_prime=(1-n)/(2*n) * mu/eff2;
+ 	}
+ 
+@@ -774,10 +526,6 @@
+ 	/*input strain rate: */
+ 	IssmDouble exx,eyy,exy;
+ 
+-	/*Get visocisty and n*/
+-	GetViscosity2d(&mu,epsilon);
+-	n=GetN();
+-
+ 	if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0)){
+ 		mu_prime=0.5*pow(10.,14);
+ 	}
+@@ -788,7 +536,9 @@
+ 		exy=epsilon[2];
+ 		eff2 = exx*exx + eyy*eyy + exx*eyy + exy*exy ;
+ 
+-		mu_prime=(1-n)/(2*n) * mu/eff2;
++		GetViscosityBar(&mu,sqrt(eff2));
++		n=GetN();
++		mu_prime=(1.-n)/(2.*n)*mu/eff2;
+ 	}
+ 
+ 	/*Assign output pointers:*/
+Index: ../trunk-jpl/src/c/classes/Materials/Material.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Material.h	(revision 17247)
++++ ../trunk-jpl/src/c/classes/Materials/Material.h	(revision 17248)
+@@ -25,11 +25,8 @@
+ 		virtual void       InputDuplicate(int original_enum,int new_enum)=0;
+ 		virtual void       Configure(Elements* elements)=0;
+ 		virtual void       GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum)=0;
+-		virtual void       GetViscosity2d(IssmDouble* pviscosity, IssmDouble* pepsilon)=0;
+-		virtual void       GetViscosity2dvertical(IssmDouble* pviscosity, IssmDouble* pepsilon)=0;
+-		virtual void       GetViscosity2dverticalHO(IssmDouble* pviscosity, IssmDouble* pepsilon)=0;
+-		virtual void       GetViscosity3d(IssmDouble* pviscosity3d, IssmDouble* pepsilon)=0;
+-		virtual void       GetViscosity3dFS(IssmDouble* pviscosity3d, IssmDouble* epsilon)=0;
++		virtual void       GetViscosity(IssmDouble* pviscosity,IssmDouble epseff)=0;
++		virtual void       GetViscosityBar(IssmDouble* pviscosity,IssmDouble epseff)=0;
+ 		virtual void       GetViscosityComplement(IssmDouble* pviscosity_complement, IssmDouble* pepsilon)=0;
+ 		virtual void       GetViscosityDComplement(IssmDouble* pviscosity_complement, IssmDouble* pepsilon)=0;
+ 		virtual void       GetViscosityDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* pepsilon)=0;
+Index: ../trunk-jpl/src/c/classes/Materials/Matice.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matice.h	(revision 17247)
++++ ../trunk-jpl/src/c/classes/Materials/Matice.h	(revision 17248)
+@@ -51,11 +51,8 @@
+ 		void   Configure(Elements* elements);
+ 		void   GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum);
+ 		void       SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
+-		void       GetViscosity2d(IssmDouble* pviscosity, IssmDouble* pepsilon);
+-		void       GetViscosity2dvertical(IssmDouble* pviscosity, IssmDouble* pepsilon);
+-		void       GetViscosity2dverticalHO(IssmDouble* pviscosity, IssmDouble* pepsilon);
+-		void       GetViscosity3d(IssmDouble* pviscosity3d, IssmDouble* pepsilon);
+-		void       GetViscosity3dFS(IssmDouble* pviscosity3d, IssmDouble* epsilon);
++		void       GetViscosity(IssmDouble* pviscosity, IssmDouble eps_eff);
++		void       GetViscosityBar(IssmDouble* pviscosity, IssmDouble eps_eff);
+ 		void       GetViscosityComplement(IssmDouble* pviscosity_complement, IssmDouble* pepsilon);
+ 		void       GetViscosityDComplement(IssmDouble*, IssmDouble*);
+ 		void       GetViscosityDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* pepsilon);
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 17247)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 17248)
+@@ -81,11 +81,8 @@
+ 		void       InputDuplicate(int original_enum,int new_enum);
+ 		void       Configure(Elements* elements);
+ 		void       GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum){return;}
+-		void       GetViscosity2d(IssmDouble* pviscosity, IssmDouble* pepsilon){_error_("not supported");};
+-		void       GetViscosity2dvertical(IssmDouble* pviscosity, IssmDouble* pepsilon){_error_("not supported");};
+-		void       GetViscosity2dverticalHO(IssmDouble* pviscosity, IssmDouble* pepsilon){_error_("not supported");};
+-		void       GetViscosity3d(IssmDouble* pviscosity3d, IssmDouble* pepsilon){_error_("not supported");};
+-		void       GetViscosity3dFS(IssmDouble* pviscosity3d, IssmDouble* epsilon){_error_("not supported");};
++		void       GetViscosity(IssmDouble* pviscosity,IssmDouble eps_eff){_error_("not supported");};
++		void       GetViscosityBar(IssmDouble* pviscosity,IssmDouble eps_eff){_error_("not supported");};
+ 		void       GetViscosityComplement(IssmDouble* pviscosity_complement, IssmDouble* pepsilon){_error_("not supported");};
+ 		void       GetViscosityDComplement(IssmDouble* pviscosity_complement, IssmDouble* pepsilon){_error_("not supported");};
+ 		void       GetViscosityDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* pepsilon){_error_("not supported");};
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17247)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17248)
+@@ -203,16 +203,16 @@
+ /*FUNCTION Tria::ComputeStressTensor {{{*/
+ void  Tria::ComputeStressTensor(){
+ 
+-	IssmDouble      xyz_list[NUMVERTICES][3];
+-	IssmDouble      pressure,viscosity;
+-	IssmDouble      epsilon[3]; /* epsilon=[exx,eyy,exy];*/
+-	IssmDouble      sigma_xx[NUMVERTICES];
+-	IssmDouble		sigma_yy[NUMVERTICES];
+-	IssmDouble		sigma_zz[NUMVERTICES]={0,0,0};
+-	IssmDouble      sigma_xy[NUMVERTICES];
+-	IssmDouble		sigma_xz[NUMVERTICES]={0,0,0};
+-	IssmDouble		sigma_yz[NUMVERTICES]={0,0,0};
+-	GaussTria* gauss=NULL;
++	IssmDouble  xyz_list[NUMVERTICES][3];
++	IssmDouble  pressure,viscosity;
++	IssmDouble  epsilon[3]; /* epsilon=[exx,eyy,exy];*/
++	IssmDouble  sigma_xx[NUMVERTICES];
++	IssmDouble	sigma_yy[NUMVERTICES];
++	IssmDouble	sigma_zz[NUMVERTICES]={0,0,0};
++	IssmDouble  sigma_xy[NUMVERTICES];
++	IssmDouble	sigma_xz[NUMVERTICES]={0,0,0};
++	IssmDouble	sigma_yz[NUMVERTICES]={0,0,0};
++	GaussTria*  gauss=NULL;
+ 
+ 	/* Get node coordinates and dof list: */
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+@@ -229,7 +229,7 @@
+ 
+ 		/*Compute strain rate viscosity and pressure: */
+ 		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+-		material->GetViscosity2d(&viscosity,&epsilon[0]);
++		this->ViscositySSA(&viscosity,&xyz_list[0][0],gauss,vx_input,vy_input);
+ 		pressure_input->GetInputValue(&pressure,gauss);
+ 
+ 		/*Compute Stress*/
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17247)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17248)
+@@ -253,7 +253,7 @@
+ 
+ 		/*Compute strain rate viscosity and pressure: */
+ 		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+-		material->GetViscosity3dFS(&viscosity,&epsilon[0]);
++		this->ViscosityFS(&viscosity,3,&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+ 		pressure_input->GetInputValue(&pressure,gauss);
+ 
+ 		/*Compute Stress*/
+@@ -319,7 +319,7 @@
+ 
+ 		/*Compute strain rate viscosity and pressure: */
+ 		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+-		material->GetViscosity3d(&viscosity,&epsilon[0]);
++		this->ViscosityFS(&viscosity,3,&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+ 		pressure_input->GetInputValue(&pressure,gauss);
+ 
+ 		/*Compute Stress*/
+@@ -3137,7 +3137,7 @@
+ 
+ 	_assert_(gauss->Enum()==GaussPentaEnum);
+ 	this->StrainRateFS(&epsilon[0],xyz_list,(GaussPenta*)gauss,vx_input,vy_input,vz_input);
+-	material->GetViscosity3dFS(&viscosity,&epsilon[0]);
++	this->ViscosityFS(&viscosity,3,xyz_list,(GaussPenta*)gauss,vx_input,vy_input,vz_input);
+ 	GetPhi(&phi,&epsilon[0],viscosity);
+ 
+ 	/*Assign output pointer*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17247)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17248)
+@@ -282,7 +282,7 @@
+ 		thickness_input->GetInputValue(&thickness,gauss);
+ 
+ 		this->StrainRateFS(&epsilon[0],xyz_list,gauss,vx_input,vy_input,vz_input);
+-		this->material->GetViscosity3dFS(&viscosity,&epsilon[0]);
++		this->ViscosityFS(&viscosity,3,xyz_list,gauss,vx_input,vy_input,vz_input);
+ 		this->GetPhi(&phi,&epsilon[0],viscosity);
+ 
+ 		viscousheating[iv]=phi*thickness;
+@@ -302,18 +302,23 @@
+ 	IssmDouble viscosity;
+ 	IssmDouble epsilon3d[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
+ 	IssmDouble epsilon2d[3]; /* epsilon=[exx,eyy,exy];            */
++	IssmDouble eps_eff;
++	IssmDouble eps0=1.e-27;
+ 
+ 	if(dim==3){
+-		/*3D*/
++		/* eps_eff^2 = exx^2 + eyy^2 + exy^2 + exz^2 + eyz^2 + exx*eyy */
+ 		this->StrainRateFS(&epsilon3d[0],xyz_list,gauss,vx_input,vy_input,vz_input);
+-		material->GetViscosity3dFS(&viscosity, &epsilon3d[0]);
++		eps_eff = sqrt(epsilon3d[0]*epsilon3d[0] + epsilon3d[1]*epsilon3d[1] + epsilon3d[3]*epsilon3d[3] +  epsilon3d[4]*epsilon3d[4] + epsilon3d[5]*epsilon3d[5] + epsilon3d[0]*epsilon3d[1]+eps0*eps0);
+ 	}
+ 	else{
+-		/*2D*/
++		/* eps_eff^2 = exx^2 + eyy^2 + 2*exy^2 */
+ 		this->StrainRateSSA(&epsilon2d[0],xyz_list,gauss,vx_input,vy_input);
+-		material->GetViscosity2dvertical(&viscosity,&epsilon2d[0]);
++		eps_eff = sqrt(epsilon2d[0]*epsilon2d[0] + epsilon2d[1]*epsilon2d[1] + 2.*epsilon2d[2]*epsilon2d[2]);
+ 	}
+ 
++	/*Get viscosity*/
++	material->GetViscosity(&viscosity,eps_eff);
++
+ 	/*Assign output pointer*/
+ 	*pviscosity=viscosity;
+ }
+@@ -383,16 +388,22 @@
+ 	IssmDouble viscosity;
+ 	IssmDouble epsilon3d[5];/* epsilon=[exx,eyy,exy,exz,eyz];*/
+ 	IssmDouble epsilon2d[2]; /* epsilon=[exx,exy];           */
++	IssmDouble eps_eff;
+ 
+ 	if(dim==3){
++		/* eps_eff^2 = exx^2 + eyy^2 + exy^2 + exz^2 + eyz^2 + exx*eyy */
+ 		this->StrainRateHO(&epsilon3d[0],xyz_list,gauss,vx_input,vy_input);
+-		material->GetViscosity3d(&viscosity, &epsilon3d[0]);
++		eps_eff = sqrt(epsilon3d[0]*epsilon3d[0] + epsilon3d[1]*epsilon3d[1] + epsilon3d[2]*epsilon3d[2] +  epsilon3d[3]*epsilon3d[3] + epsilon3d[4]*epsilon3d[4] + epsilon3d[0]*epsilon3d[1]);
+ 	}
+ 	else{
++		/* eps_eff^2 = exx^2 + exy^2 */
+ 		this->StrainRateHO2dvertical(&epsilon2d[0],xyz_list,gauss,vx_input,vy_input);
+-		material->GetViscosity2dverticalHO(&viscosity, &epsilon2d[0]);
++		eps_eff = sqrt(epsilon2d[0]*epsilon2d[0] + epsilon2d[1]*epsilon2d[1]);
+ 	}
+ 
++	/*Get viscosity*/
++	material->GetViscosity(&viscosity,eps_eff);
++
+ 	/*Assign output pointer*/
+ 	*pviscosity=viscosity;
+ }/*}}}*/
+@@ -401,10 +412,16 @@
+ 	/*Intermediaries*/
+ 	IssmDouble viscosity;
+ 	IssmDouble epsilon[3];/* epsilon=[exx,eyy,exy];    */
++	IssmDouble eps_eff;
+ 
++	/*Get effective strain rate
++	 * eps_eff^2 = exx^2 + eyy^2 + exy^2 + exx*eyy+*/
+ 	this->StrainRateSSA(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
+-	material->GetViscosity2d(&viscosity, &epsilon[0]);
++	eps_eff = sqrt(epsilon[0]*epsilon[0] + epsilon[1]*epsilon[1] + epsilon[2]*epsilon[2] + epsilon[0]*epsilon[1]);
+ 
++	/*Get viscosity*/
++	material->GetViscosityBar(&viscosity,eps_eff);
++
+ 	/*Assign output pointer*/
+ 	*pviscosity=viscosity;
+ }/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17248-17249.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17248-17249.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17248-17249.diff	(revision 17802)
@@ -0,0 +1,66 @@
+Index: ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp	(revision 17248)
++++ ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp	(revision 17249)
+@@ -11,19 +11,14 @@
+ 
+ void SetActiveNodesLSMx(Elements* elements){/*{{{*/
+ 
+-	// used in femmodel->UpdateConstraintsx
+-	int i,in;
+-	Element* element = NULL;
+-	Node* node = NULL;
+-
+-	for(i=0;i<elements->Size();i++){
+-		element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+-		int numnodes=element->GetNumberOfNodes();
+-		IssmDouble* mask = xNew<IssmDouble>(numnodes);
++	for(int i=0;i<elements->Size();i++){
++		Element    *element  = dynamic_cast<Element*>(elements->GetObjectByOffset(i));
++		int         numnodes = element->GetNumberOfNodes();
++		IssmDouble *mask     = xNew<IssmDouble>(numnodes);
+ 		element->GetInputListOnNodes(&mask[0],IceMaskNodeActivationEnum);
+ 		
+-		for(in=0;in<numnodes;in++){
+-			node=element->GetNode(in);
++		for(int in=0;in<numnodes;in++){
++			Node* node=element->GetNode(in);
+ 			if(mask[in]==1.){
+ 				node->Activate();
+ 			}
+@@ -37,27 +32,22 @@
+ }/*}}}*/
+ void GetMaskOfIceVerticesLSMx(FemModel* femmodel){/*{{{*/
+ 
+-	// use in transient core
+-	int                 i;
+-	IssmDouble*         mask_ice      = NULL;
+-	Vector<IssmDouble>* vec_mask_ice  = NULL;
+-	Element*            element       = NULL;
+-
+ 	/*Initialize vector with number of vertices*/
+-	IssmDouble numvertices=femmodel->vertices->NumberOfVertices();
+-	vec_mask_ice=new Vector<IssmDouble>(numvertices); //vertices that have ice at next time step
+-	for(i=0;i<numvertices;i++)
+-		vec_mask_ice[i]=0.;
++	int numvertices=femmodel->vertices->NumberOfVertices();
++	Vector<IssmDouble>* vec_mask_ice=new Vector<IssmDouble>(numvertices); //vertices that have ice at next time step
++
+ 	/*Fill vector with values: */
+-	for(i=0;i<femmodel->elements->Size();i++){
+-		element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++	for(int i=0;i<femmodel->elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+ 		SetMaskOfIceElement(vec_mask_ice, element);
+ 	}
+ 
+ 	/*Assemble vector and serialize */
+ 	vec_mask_ice->Assemble();
+-	mask_ice=vec_mask_ice->ToMPISerial();
++	IssmDouble* mask_ice=vec_mask_ice->ToMPISerial();
+ 	InputUpdateFromVectorx(femmodel,mask_ice,IceMaskNodeActivationEnum,VertexSIdEnum);
++
++	/*Clean up and return*/
+ 	delete vec_mask_ice;
+ 	delete mask_ice;
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17249-17250.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17249-17250.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17249-17250.diff	(revision 17802)
@@ -0,0 +1,124 @@
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17249)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17250)
+@@ -66,12 +66,6 @@
+ 	/*parameters: */
+ 	bool save_results;
+ 
+-	/* extrapolate */
+-	Analysis* analysis = new ExtrapolationAnalysis();
+-	femmodel->parameters->SetParam(VxEnum,ExtrapolationVariableEnum);
+-	analysis->Core(femmodel);
+-	delete analysis;
+-
+ 	/*activate formulation: */
+ 	femmodel->SetCurrentConfiguration(LevelsetAnalysisEnum);
+ 
+@@ -164,7 +158,7 @@
+ 			case 1:
+ 				/* Artificial Diffusion */
+ 				element->ElementSizes(&hx,&hy,&hz);
+-				vel=sqrt(vx*vx + vy*vy );
++				vel=sqrt(vx*vx + vy*vy) + 1e-14;
+ 				h=sqrt( pow(hx*vx/vel,2) + pow(hy*vy/vel,2) ); //FIXME: is this correct?
+ 
+ 				kappa=h*vel/2.; //FIXME: insert suitable value for kappa
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17249)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17250)
+@@ -1043,8 +1043,8 @@
+ }/*}}}*/
+ void StressbalanceAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+ 	/*Default, do nothing*/
+-	_printf0_("   Updating active and non-active nodes in Femmodel \n");
+-	//SetActiveNodesLSMx(femmodel->elements);
++	_printf0_("   Updating active and non-active nodes for StressbalanceAnalysis \n");
++	SetActiveNodesLSMx(femmodel->elements);
+ 	return;
+ }/*}}}*/
+ 
+Index: ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp	(revision 17249)
++++ ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp	(revision 17250)
+@@ -15,8 +15,30 @@
+ 		Element    *element  = dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+ 		int         numnodes = element->GetNumberOfNodes();
+ 		IssmDouble *mask     = xNew<IssmDouble>(numnodes);
+-		element->GetInputListOnNodes(&mask[0],IceMaskNodeActivationEnum);
+-		
++		// include switch for elements with multiple different sets of nodes
++		switch(element->GetElementType()){
++			case MINIEnum:case TaylorHoodEnum:{
++				Input* input=element->GetInput(IceMaskNodeActivationEnum);
++				if(!input) _error_("Input " << EnumToStringx(IceMaskNodeActivationEnum) << " not found in element");
++
++				/* Start looping on the number of vertices: */
++				Gauss* gauss=element->NewGauss();
++				for(int iv=0;iv<element->NumberofNodesVelocity();iv++){
++					gauss->GaussNode(element->VelocityInterpolation(),iv);
++					input->GetInputValue(&mask[iv],gauss);
++				}
++				for(int iv=0;iv<element->NumberofNodesPressure();iv++){
++					gauss->GaussNode(element->PressureInterpolation(),iv);
++					input->GetInputValue(&mask[element->NumberofNodesVelocity()+iv],gauss);
++				}
++				delete gauss;
++				break;
++			}
++			default:
++				element->GetInputListOnNodes(&mask[0],IceMaskNodeActivationEnum);
++				break;
++		}
++
+ 		for(int in=0;in<numnodes;in++){
+ 			Node* node=element->GetNode(in);
+ 			if(mask[in]==1.){
+@@ -32,12 +54,16 @@
+ }/*}}}*/
+ void GetMaskOfIceVerticesLSMx(FemModel* femmodel){/*{{{*/
+ 
++	/* Intermediaries */
++	int i;
+ 	/*Initialize vector with number of vertices*/
+ 	int numvertices=femmodel->vertices->NumberOfVertices();
+ 	Vector<IssmDouble>* vec_mask_ice=new Vector<IssmDouble>(numvertices); //vertices that have ice at next time step
+-
++	for(i=0;i<numvertices;i++){
++		vec_mask_ice->SetValue(i,0.,INS_VAL);
++	}
+ 	/*Fill vector with values: */
+-	for(int i=0;i<femmodel->elements->Size();i++){
++	for(i=0;i<femmodel->elements->Size();i++){
+ 		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+ 		SetMaskOfIceElement(vec_mask_ice, element);
+ 	}
+Index: ../trunk-jpl/src/c/cores/transient_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17249)
++++ ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17250)
+@@ -149,9 +149,22 @@
+ 
+ 		if(islevelset){
+ 			if(VerboseSolution()) _printf0_("   computing movement of ice boundaries\n");
++
++			/* extrapolate required variables */
++			Analysis* extanalysis = new ExtrapolationAnalysis();
++			int vars[2] = {VxEnum, VyEnum};
++			for(int iv=0;iv<2;iv++){
++				femmodel->parameters->SetParam(vars[iv],ExtrapolationVariableEnum); 
++				extanalysis->Core(femmodel);
++			}
++			delete extanalysis;	
++
+ 			analysis = new LevelsetAnalysis();
+ 			analysis->Core(femmodel);
+ 			delete analysis;
++
++			/* update vertices included for next calculation */
++			GetMaskOfIceVerticesLSMx(femmodel);
+ 		}
+ 
+ 		/*unload results*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17250-17251.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17250-17251.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17250-17251.diff	(revision 17802)
@@ -0,0 +1,47 @@
+Index: ../trunk-jpl/test/NightlyRun/test336.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test336.py	(revision 17250)
++++ ../trunk-jpl/test/NightlyRun/test336.py	(revision 17251)
+@@ -7,11 +7,12 @@
+ from solve import *
+ from MatlabFuncs import *
+ 
+-md=triangle(model(),'../Exp/Square.exp',150000.)
++md=triangle(model(),'../Exp/Square.exp',100000.)
+ md=setmask(md,'','')
+ md=parameterize(md,'../Par/SquareSheetConstrained.py') 
+ md=setflowequation(md,'SSA','all')
+-md.cluster=generic('name',oshostname(),'np',3)
++md.cluster=generic('name',oshostname(),'np',1)
++# md.cluster=generic('name',oshostname(),'np',3)
+ 
+ # parameters
+ md.transient.isstressbalance=True
+@@ -22,16 +23,18 @@
+ md.transient.islevelset=True
+ 
+ # init levelset function
+-ymin=numpy.min(md.mesh.y)
+-ymax=numpy.max(md.mesh.y)
+-xmin=min(md.mesh.x)
+-xmax=max(md.mesh.x)
+-xmed=(xmax+xmin)/2
+-ymed=(ymax+ymin)/2
+-distx=numpy.absolute(md.mesh.x.reshape(-1,1)-xmed)
+-disty=numpy.absolute(md.mesh.y.reshape(-1,1)-ymed)
+-md.mask.ice_levelset=numpy.maximum(distx,disty)-1.e5
++xmin, xmax=min(md.mesh.x), max(md.mesh.x)
++ymin, ymax=min(md.mesh.y), max(md.mesh.y)
++xmed, ymed=(xmax+xmin)/2.,(ymax+ymin)/2.  
+ 
++# distx=numpy.absolute(md.mesh.x.reshape(-1,1)-xmed)
++# disty=numpy.absolute(md.mesh.y.reshape(-1,1)-ymed)
++# md.mask.ice_levelset=numpy.maximum(distx,disty)-0.2*(xmax-xmin)
++
++D=numpy.sqrt(numpy.power(md.mesh.x.reshape(-1,1)-xmed,2.)+numpy.power(md.mesh.y.reshape(-1,1)-ymed,2.))
++R=0.2*(xmax-xmin)
++md.mask.ice_levelset=D-R
++
+ md=solve(md,TransientSolutionEnum())
+ 
+ #Fields and tolerances to track changes
Index: issm/oecreview/Archive/16554-17801/ISSM-17251-17252.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17251-17252.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17251-17252.diff	(revision 17802)
@@ -0,0 +1,4 @@
+Index: ../trunk-jpl/test/Archives/Archive336.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17252-17253.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17252-17253.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17252-17253.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17252)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17253)
+@@ -1044,7 +1044,7 @@
+ void StressbalanceAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+ 	/*Default, do nothing*/
+ 	_printf0_("   Updating active and non-active nodes for StressbalanceAnalysis \n");
+-	SetActiveNodesLSMx(femmodel->elements);
++	//SetActiveNodesLSMx(femmodel->elements);
+ 	return;
+ }/*}}}*/
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17253-17254.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17253-17254.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17253-17254.diff	(revision 17802)
@@ -0,0 +1,22 @@
+Index: ../trunk-jpl/src/c/toolkits/mpi/issmmpi.cpp
+===================================================================
+--- ../trunk-jpl/src/c/toolkits/mpi/issmmpi.cpp	(revision 17253)
++++ ../trunk-jpl/src/c/toolkits/mpi/issmmpi.cpp	(revision 17254)
+@@ -323,7 +323,7 @@
+ 	       datatype,
+ 	       source,
+ 	       tag,
+-	       AMPI_SEND, // as long as there are no other variants
++	       AMPI_FROM_SEND, // as long as there are no other variants
+ 	       comm,
+ 	       status);
+ # else
+@@ -463,7 +463,7 @@
+ 	       datatype,
+ 	       dest,
+ 	       tag,
+-	       AMPI_RECV, // as long as there are no other variants
++	       AMPI_TO_RECV, // as long as there are no other variants
+ 	       comm);
+ # else
+   rc=MPI_Send(buf, 
Index: issm/oecreview/Archive/16554-17801/ISSM-17254-17255.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17254-17255.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17254-17255.diff	(revision 17802)
@@ -0,0 +1,667 @@
+Index: ../trunk-jpl/src/c/classes/Node.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Node.h	(revision 17254)
++++ ../trunk-jpl/src/c/classes/Node.h	(revision 17255)
+@@ -88,14 +88,5 @@
+ int* GetLocalDofList(Node** nodes,int numnodes,int setenum,int approximation);
+ int* GetGlobalDofList(Node** nodes,int numnodes,int setenum,int approximation);
+ int  GetNumberOfDofs(Node** nodes,int numnodes,int setenum,int approximation);
+-void TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes,int numnodes,int cs_enum);
+-void TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes,int numnodes,int* cs_array);
+-void TransformLoadVectorCoord(ElementVector* pe,Node** nodes,int numnodes,int cs_enum);
+-void TransformLoadVectorCoord(ElementVector* pe,Node** nodes,int numnodes,int* cs_array);
+-void TransformSolutionCoord(IssmDouble* solution,Node** nodes,int numnodes,int cs_enum);
+-void TransformSolutionCoord(IssmDouble* solution,Node** nodes,int numnodes,int* cs_array);
+-void TransformStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes,int numnodes,int cs_enum);
+-void TransformStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes,int numnodes,int* cs_array);
+-void CoordinateSystemTransform(IssmDouble** ptransform,Node** nodes,int numnodes,int* cs_array);
+ 
+ #endif  /* _NODE_H_ */
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17254)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17255)
+@@ -53,6 +53,7 @@
+ 		void       AddInput(Input* input_in);
+ 		bool       AllActive(void);
+ 		bool       AnyActive(void);
++		void       CoordinateSystemTransform(IssmDouble** ptransform,Node** nodes,int numnodes,int* cs_array);
+ 		void       DeleteMaterials(void);
+ 		void       FindParam(bool* pvalue,int paramenum);
+ 		void       FindParam(int* pvalue,int paramenum);
+@@ -72,6 +73,23 @@
+ 		void       StrainRateHO2dvertical(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 		void       StrainRateFS(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+ 		IssmDouble TMeltingPoint(IssmDouble pressure);
++		void       TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,int cs_enum);
++		void       TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes,int numnodes,int cs_enum);
++		void       TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes,int numnodes,int* cs_array);
++		void       TransformLoadVectorCoord(ElementVector* pe,int cs_enum);
++		void       TransformLoadVectorCoord(ElementVector* pe,int* cs_array);
++		void       TransformLoadVectorCoord(ElementVector* pe,Node** nodes,int numnodes,int cs_enum);
++		void       TransformLoadVectorCoord(ElementVector* pe,Node** nodes,int numnodes,int* cs_array);
++		void       TransformSolutionCoord(IssmDouble* solution,int cs_enum);
++		void       TransformSolutionCoord(IssmDouble* solution,int* cs_array);
++		void       TransformSolutionCoord(IssmDouble* solution,int numnodes,int cs_enum);
++		void       TransformSolutionCoord(IssmDouble* solution,int numnodes,int* cs_array);
++		void       TransformSolutionCoord(IssmDouble* solution,Node** nodes,int numnodes,int cs_enum);
++		void       TransformSolutionCoord(IssmDouble* solution,Node** nodes,int numnodes,int* cs_array);
++		void       TransformStiffnessMatrixCoord(ElementMatrix* Ke,int cs_enum);
++		void       TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* cs_array);
++		void       TransformStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes,int numnodes,int cs_enum);
++		void       TransformStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes,int numnodes,int* cs_array);
+ 		void       ViscousHeatingCreateInput(void);
+ 		void       ViscosityFS(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+ 		void       ViscosityHO(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+@@ -80,22 +98,9 @@
+ 		void       ViscositySSADerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon);
+ 		void       ViscosityHODerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon);
+ 		void       ViscosityFSDerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon);
+-		void       TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum);
+-		void       TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes_list,int numnodes,int* transformenum_list);
+-		void       TransformLoadVectorCoord(ElementVector* pe,int transformenum);
+-		void       TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list);
+ 		void       TransformLoadVectorCoord(ElementVector* pe,int numnodes,int transformenum){_error_("not implemented yet");};/*Tiling only*/
+ 		void       TransformLoadVectorCoord(ElementVector* pe,int numnodes,int* transformenum_list){_error_("not implemented yet");};/*Tiling only*/
+-		void       TransformLoadVectorCoord(ElementVector* pe,Node** nodes_list,int numnodes,int* transformenum_list);
+-		void       TransformSolutionCoord(IssmDouble* values,int transformenum);
+-		void       TransformSolutionCoord(IssmDouble* values,int* transformenum_list);
+-		void       TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum);
+-		void       TransformSolutionCoord(IssmDouble* values,int numnodes,int* transformenum_list);
+-		void       TransformStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum);
+-		void       TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* transformenum_list);
+-		void       TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int transformenum);
+ 		void       TransformStiffnessMatrixCoord(ElementMatrix* Ke,int numnodes,int* transformenum_list){_error_("not implemented yet");};/*Tiling only*/
+-		void       TransformStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes_list,int numnodes,int* transformenum_list);
+ 
+ 		/*Virtual functions*/
+ 		virtual void       AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17254)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17255)
+@@ -52,6 +52,80 @@
+ 	}
+ 	return false;
+ }/*}}}*/
++void Element::CoordinateSystemTransform(IssmDouble** ptransform,Node** nodes_list,int numnodes,int* cs_array){/*{{{*/
++
++	int         i,counter;
++	int         numdofs   = 0;
++	IssmDouble  norm;
++	IssmDouble *transform = NULL;
++	IssmDouble  coord_system[3][3];
++
++	/*Some checks in debugging mode*/
++	_assert_(numnodes && nodes_list);
++
++	/*Get total number of dofs*/
++	for(i=0;i<numnodes;i++){
++		switch(cs_array[i]){
++			case PressureEnum: numdofs+=1; break;
++			case XYEnum:       numdofs+=2; break;
++			case XYZEnum:      numdofs+=3; break;
++			default: _error_("Coordinate system " << EnumToStringx(cs_array[i]) << " not supported yet");
++		}
++	}
++
++	/*Allocate and initialize transform matrix*/
++	transform=xNew<IssmDouble>(numdofs*numdofs);
++	for(i=0;i<numdofs*numdofs;i++) transform[i]=0.0;
++
++	/*Create transform matrix for all nodes (x,y for 2d and x,y,z for 3d). It is a block matrix
++	 *for 3 nodes:
++
++	 *     | T1 0  0 |
++	 * Q = | 0  T2 0 |
++	 *     | 0  0  T3|
++	 *
++	 * Where T1 is the transform matrix for node 1. It is a simple copy of the coordinate system
++	 * associated to this node*/
++	counter=0;
++	for(i=0;i<numnodes;i++){
++		nodes_list[i]->GetCoordinateSystem(&coord_system[0][0]);
++		switch(cs_array[i]){
++			case PressureEnum:
++				/*DO NOT change anything*/
++				transform[(numdofs)*(counter) + counter] = 1.;
++				counter+=1;
++				break;
++			case XYEnum:
++				/*We remove the z component, we need to renormalize x and y: x=[x1 x2 0] y=[-x2 x1 0]*/
++				norm = sqrt( coord_system[0][0]*coord_system[0][0] + coord_system[1][0]*coord_system[1][0]); _assert_(norm>1.e-4);
++				transform[(numdofs)*(counter+0) + counter+0] =   coord_system[0][0]/norm;
++				transform[(numdofs)*(counter+0) + counter+1] = - coord_system[1][0]/norm;
++				transform[(numdofs)*(counter+1) + counter+0] =   coord_system[1][0]/norm;
++				transform[(numdofs)*(counter+1) + counter+1] =   coord_system[0][0]/norm;
++				counter+=2;
++				break;
++			case XYZEnum:
++				/*The 3 coordinates are changed (x,y,z)*/
++				transform[(numdofs)*(counter+0) + counter+0] = coord_system[0][0];
++				transform[(numdofs)*(counter+0) + counter+1] = coord_system[0][1];
++				transform[(numdofs)*(counter+0) + counter+2] = coord_system[0][2];
++				transform[(numdofs)*(counter+1) + counter+0] = coord_system[1][0];
++				transform[(numdofs)*(counter+1) + counter+1] = coord_system[1][1];
++				transform[(numdofs)*(counter+1) + counter+2] = coord_system[1][2];
++				transform[(numdofs)*(counter+2) + counter+0] = coord_system[2][0];
++				transform[(numdofs)*(counter+2) + counter+1] = coord_system[2][1];
++				transform[(numdofs)*(counter+2) + counter+2] = coord_system[2][2];
++				counter+=3;
++				break;
++			default:
++				_error_("Coordinate system " << EnumToStringx(cs_array[i]) << " not supported yet");
++		}
++	}
++
++	/*Assign output pointer*/
++	*ptransform=transform;
++}
++/*}}}*/
+ void Element::DeleteMaterials(void){/*{{{*/
+ 	delete this->material;
+ }/*}}}*/
+@@ -536,38 +610,207 @@
+ 
+ }/*}}}*/
+ void Element::TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum){/*{{{*/
+-	::TransformInvStiffnessMatrixCoord(Ke,this->nodes,this->GetNumberOfNodes(),transformenum);
++
++	/*All nodes have the same Coordinate System*/
++	int numnodes  = this->GetNumberOfNodes();
++	int* cs_array = xNew<int>(numnodes);
++	for(int i=0;i<numnodes;i++) cs_array[i]=transformenum;
++
++	/*Call core*/
++	TransformInvStiffnessMatrixCoord(Ke,this->nodes,numnodes,cs_array);
++
++	/*Clean-up*/
++	xDelete<int>(cs_array);
+ }/*}}}*/
+-void Element::TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes_list,int numnodes,int* transformenum_list){/*{{{*/
+-	::TransformInvStiffnessMatrixCoord(Ke,nodes_list,numnodes,transformenum_list);
++void Element::TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes_list,int numnodes,int* cs_array){/*{{{*/
++
++	int         i,j;
++	int         numdofs   = 0;
++	IssmDouble *transform = NULL;
++	IssmDouble *values    = NULL;
++
++	/*Get total number of dofs*/
++	for(i=0;i<numnodes;i++){
++		switch(cs_array[i]){
++			case PressureEnum: numdofs+=1; break;
++			case XYEnum:       numdofs+=2; break;
++			case XYZEnum:      numdofs+=3; break;
++			default: _error_("Coordinate system " << EnumToStringx(cs_array[i]) << " not supported yet");
++		}
++	}
++
++	/*Copy current stiffness matrix*/
++	values=xNew<IssmDouble>(Ke->nrows*Ke->ncols);
++	for(i=0;i<Ke->nrows;i++) for(j=0;j<Ke->ncols;j++) values[i*Ke->ncols+j]=Ke->values[i*Ke->ncols+j];
++
++	/*Get Coordinate Systems transform matrix*/
++	CoordinateSystemTransform(&transform,nodes_list,numnodes,cs_array);
++
++	/*Transform matrix: R*Ke*R^T */
++	TripleMultiply(transform,numdofs,numdofs,0,
++				values,Ke->nrows,Ke->ncols,0,
++				transform,numdofs,numdofs,1,
++				&Ke->values[0],0);
++
++	/*Free Matrix*/
++	xDelete<IssmDouble>(transform);
++	xDelete<IssmDouble>(values);
+ }/*}}}*/
+ void Element::TransformLoadVectorCoord(ElementVector* pe,int transformenum){/*{{{*/
+-	::TransformLoadVectorCoord(pe,this->nodes,this->GetNumberOfNodes(),transformenum);
++
++	/*All nodes have the same Coordinate System*/
++	int  numnodes = this->GetNumberOfNodes();
++	int* cs_array = xNew<int>(numnodes);
++	for(int i=0;i<numnodes;i++) cs_array[i]=transformenum;
++
++	/*Call core*/
++	this->TransformLoadVectorCoord(pe,this->nodes,numnodes,cs_array);
++
++	/*Clean-up*/
++	xDelete<int>(cs_array);
+ }/*}}}*/
+-void Element::TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list){/*{{{*/
+-	::TransformLoadVectorCoord(pe,this->nodes,this->GetNumberOfNodes(),transformenum_list);
++void Element::TransformLoadVectorCoord(ElementVector* pe,int* cs_array){/*{{{*/
++
++	this->TransformLoadVectorCoord(pe,this->nodes,this->GetNumberOfNodes(),cs_array);
++
+ }/*}}}*/
++void Element::TransformLoadVectorCoord(ElementVector* pe,Node** nodes_list,int numnodes,int* cs_array){/*{{{*/
++
++	int         i;
++	int         numdofs   = 0;
++	IssmDouble *transform = NULL;
++	IssmDouble *values    = NULL;
++
++	/*Get total number of dofs*/
++	for(i=0;i<numnodes;i++){
++		switch(cs_array[i]){
++			case PressureEnum: numdofs+=1; break;
++			case XYEnum:       numdofs+=2; break;
++			case XYZEnum:      numdofs+=3; break;
++			default: _error_("Coordinate system " << EnumToStringx(cs_array[i]) << " not supported yet");
++		}
++	}
++
++	/*Copy current load vector*/
++	values=xNew<IssmDouble>(pe->nrows);
++	for(i=0;i<pe->nrows;i++) values[i]=pe->values[i];
++
++	/*Get Coordinate Systems transform matrix*/
++	CoordinateSystemTransform(&transform,nodes_list,numnodes,cs_array);
++
++	/*Transform matrix: R^T*pe */
++	MatrixMultiply(transform,numdofs,numdofs,1,
++				values,pe->nrows,1,0,
++				&pe->values[0],0);
++
++	/*Free Matrices*/
++	xDelete<IssmDouble>(transform);
++	xDelete<IssmDouble>(values);
++}/*}}}*/
+ void Element::TransformSolutionCoord(IssmDouble* values,int transformenum){/*{{{*/
+-	::TransformSolutionCoord(values,this->nodes,this->GetNumberOfNodes(),transformenum);
++
++	/*All nodes have the same Coordinate System*/
++	int  numnodes = this->GetNumberOfNodes();
++	int* cs_array = xNew<int>(numnodes);
++	for(int i=0;i<numnodes;i++) cs_array[i]=transformenum;
++
++	/*Call core*/
++	this->TransformSolutionCoord(values,this->nodes,numnodes,cs_array);
++
++	/*Clean-up*/
++	xDelete<int>(cs_array);
+ }/*}}}*/
+ void Element::TransformSolutionCoord(IssmDouble* values,int* transformenum_list){/*{{{*/
+-	::TransformSolutionCoord(values,this->nodes,this->GetNumberOfNodes(),transformenum_list);
++	this->TransformSolutionCoord(values,this->nodes,this->GetNumberOfNodes(),transformenum_list);
+ }/*}}}*/
+ void Element::TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum){/*{{{*/
+-	::TransformSolutionCoord(values,this->nodes,numnodes,transformenum);
++	this->TransformSolutionCoord(values,this->nodes,numnodes,transformenum);
+ }/*}}}*/
+-void Element::TransformSolutionCoord(IssmDouble* values,int numnodes,int* transformenum_list){/*{{{*/
+-	::TransformSolutionCoord(values,this->nodes,numnodes,transformenum_list);
++void Element::TransformSolutionCoord(IssmDouble* solution,int numnodes,int* cs_array){/*{{{*/
++	this->TransformSolutionCoord(solution,this->nodes,numnodes,cs_array);
+ }/*}}}*/
+-void Element::TransformLoadVectorCoord(ElementVector* Ke,Node** nodes_list,int numnodes,int* transformenum_list){/*{{{*/
+-	::TransformLoadVectorCoord(Ke,nodes_list,numnodes,transformenum_list);
++void Element::TransformSolutionCoord(IssmDouble* values,Node** nodes_list,int numnodes,int transformenum){/*{{{*/
++	this->TransformSolutionCoord(values,nodes_list,numnodes,transformenum);
+ }/*}}}*/
++void Element::TransformSolutionCoord(IssmDouble* solution,Node** nodes_list,int numnodes,int* cs_array){/*{{{*/
++
++	int         i;
++	int         numdofs   = 0;
++	IssmDouble *transform = NULL;
++	IssmDouble *values    = NULL;
++
++	/*Get total number of dofs*/
++	for(i=0;i<numnodes;i++){
++		switch(cs_array[i]){
++			case PressureEnum: numdofs+=1; break;
++			case XYEnum:       numdofs+=2; break;
++			case XYZEnum:      numdofs+=3; break;
++			default: _error_("Coordinate system " << EnumToStringx(cs_array[i]) << " not supported yet");
++		}
++	}
++
++	/*Copy current solution vector*/
++	values=xNew<IssmDouble>(numdofs);
++	for(i=0;i<numdofs;i++) values[i]=solution[i];
++
++	/*Get Coordinate Systems transform matrix*/
++	CoordinateSystemTransform(&transform,nodes_list,numnodes,cs_array);
++
++	/*Transform matrix: R*U */
++	MatrixMultiply(transform,numdofs,numdofs,0,
++				values,numdofs,1,0,
++				&solution[0],0);
++
++	/*Free Matrices*/
++	xDelete<IssmDouble>(transform);
++	xDelete<IssmDouble>(values);
++}/*}}}*/
+ void Element::TransformStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum){/*{{{*/
+-	::TransformStiffnessMatrixCoord(Ke,this->nodes,this->GetNumberOfNodes(),transformenum);
++
++	/*All nodes have the same Coordinate System*/
++	int  numnodes = this->GetNumberOfNodes();
++	int* cs_array = xNew<int>(numnodes);
++	for(int i=0;i<numnodes;i++) cs_array[i]=transformenum;
++
++	/*Call core*/
++	this->TransformStiffnessMatrixCoord(Ke,this->nodes,numnodes,cs_array);
++
++	/*Clean-up*/
++	xDelete<int>(cs_array);
+ }/*}}}*/
+ void Element::TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* transformenum_list){/*{{{*/
+-	::TransformStiffnessMatrixCoord(Ke,this->nodes,this->GetNumberOfNodes(),transformenum_list);
++	this->TransformStiffnessMatrixCoord(Ke,this->nodes,this->GetNumberOfNodes(),transformenum_list);
+ }/*}}}*/
+-void Element::TransformStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes_list,int numnodes,int* transformenum_list){/*{{{*/
+-	::TransformStiffnessMatrixCoord(Ke,nodes_list,numnodes,transformenum_list);
++void Element::TransformStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes_list,int numnodes,int* cs_array){/*{{{*/
++
++	int         numdofs = 0;
++	IssmDouble *transform = NULL;
++	IssmDouble *values    = NULL;
++
++	/*Get total number of dofs*/
++	for(int i=0;i<numnodes;i++){
++		switch(cs_array[i]){
++			case PressureEnum: numdofs+=1; break;
++			case XYEnum:       numdofs+=2; break;
++			case XYZEnum:      numdofs+=3; break;
++			default: _error_("Coordinate system " << EnumToStringx(cs_array[i]) << " not supported yet");
++		}
++	}
++
++	/*Copy current stiffness matrix*/
++	values=xNew<IssmDouble>(Ke->nrows*Ke->ncols);
++	for(int i=0;i<Ke->nrows*Ke->ncols;i++) values[i]=Ke->values[i];
++
++	/*Get Coordinate Systems transform matrix*/
++	CoordinateSystemTransform(&transform,nodes_list,numnodes,cs_array);
++
++	/*Transform matrix: R^T*Ke*R */
++	TripleMultiply(transform,numdofs,numdofs,1,
++				values,Ke->nrows,Ke->ncols,0,
++				transform,numdofs,numdofs,0,
++				&Ke->values[0],0);
++
++	/*Free Matrix*/
++	xDelete<IssmDouble>(transform);
++	xDelete<IssmDouble>(values);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Node.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Node.cpp	(revision 17254)
++++ ../trunk-jpl/src/c/classes/Node.cpp	(revision 17255)
+@@ -895,274 +895,3 @@
+ 	return numberofdofs;
+ }
+ /*}}}*/
+-void TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes,int numnodes,int cs_enum){/*{{{*/
+-
+-	int* cs_array=NULL;
+-
+-	/*All nodes have the same Coordinate System*/
+-	cs_array=xNew<int>(numnodes);
+-	for(int i=0;i<numnodes;i++) cs_array[i]=cs_enum;
+-
+-	/*Call core*/
+-	TransformInvStiffnessMatrixCoord(Ke,nodes,numnodes,cs_array);
+-
+-	/*Clean-up*/
+-	xDelete<int>(cs_array);
+-}
+-/*}}}*/
+-void TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes,int numnodes,int* cs_array){/*{{{*/
+-
+-	int     i,j;
+-	int     numdofs   = 0;
+-	IssmDouble *transform = NULL;
+-	IssmDouble *values    = NULL;
+-
+-	/*Get total number of dofs*/
+-	for(i=0;i<numnodes;i++){
+-		switch(cs_array[i]){
+-			case PressureEnum: numdofs+=1; break;
+-			case XYEnum:       numdofs+=2; break;
+-			case XYZEnum:      numdofs+=3; break;
+-			default: _error_("Coordinate system " << EnumToStringx(cs_array[i]) << " not supported yet");
+-		}
+-	}
+-
+-	/*Copy current stiffness matrix*/
+-	values=xNew<IssmDouble>(Ke->nrows*Ke->ncols);
+-	for(i=0;i<Ke->nrows;i++) for(j=0;j<Ke->ncols;j++) values[i*Ke->ncols+j]=Ke->values[i*Ke->ncols+j];
+-
+-	/*Get Coordinate Systems transform matrix*/
+-	CoordinateSystemTransform(&transform,nodes,numnodes,cs_array);
+-
+-	/*Transform matrix: R*Ke*R^T */
+-	TripleMultiply(transform,numdofs,numdofs,0,
+-				values,Ke->nrows,Ke->ncols,0,
+-				transform,numdofs,numdofs,1,
+-				&Ke->values[0],0);
+-
+-	/*Free Matrix*/
+-	xDelete<IssmDouble>(transform);
+-	xDelete<IssmDouble>(values);
+-}
+-/*}}}*/
+-void TransformLoadVectorCoord(ElementVector* pe,Node** nodes,int numnodes,int cs_enum){/*{{{*/
+-
+-	int* cs_array=NULL;
+-
+-	/*All nodes have the same Coordinate System*/
+-	cs_array=xNew<int>(numnodes);
+-	for(int i=0;i<numnodes;i++) cs_array[i]=cs_enum;
+-
+-	/*Call core*/
+-	TransformLoadVectorCoord(pe,nodes,numnodes,cs_array);
+-
+-	/*Clean-up*/
+-	xDelete<int>(cs_array);
+-}
+-/*}}}*/
+-void TransformLoadVectorCoord(ElementVector* pe,Node** nodes,int numnodes,int* cs_array){/*{{{*/
+-
+-	int     i;
+-	int     numdofs   = 0;
+-	IssmDouble *transform = NULL;
+-	IssmDouble *values    = NULL;
+-
+-	/*Get total number of dofs*/
+-	for(i=0;i<numnodes;i++){
+-		switch(cs_array[i]){
+-			case PressureEnum: numdofs+=1; break;
+-			case XYEnum:       numdofs+=2; break;
+-			case XYZEnum:      numdofs+=3; break;
+-			default: _error_("Coordinate system " << EnumToStringx(cs_array[i]) << " not supported yet");
+-		}
+-	}
+-
+-	/*Copy current load vector*/
+-	values=xNew<IssmDouble>(pe->nrows);
+-	for(i=0;i<pe->nrows;i++) values[i]=pe->values[i];
+-
+-	/*Get Coordinate Systems transform matrix*/
+-	CoordinateSystemTransform(&transform,nodes,numnodes,cs_array);
+-
+-	/*Transform matrix: R^T*pe */
+-	MatrixMultiply(transform,numdofs,numdofs,1,
+-				values,pe->nrows,1,0,
+-				&pe->values[0],0);
+-
+-	/*Free Matrices*/
+-	xDelete<IssmDouble>(transform);
+-	xDelete<IssmDouble>(values);
+-}
+-/*}}}*/
+-void TransformSolutionCoord(IssmDouble* solution,Node** nodes,int numnodes,int cs_enum){/*{{{*/
+-
+-	int* cs_array=NULL;
+-
+-	/*All nodes have the same Coordinate System*/
+-	cs_array=xNew<int>(numnodes);
+-	for(int i=0;i<numnodes;i++) cs_array[i]=cs_enum;
+-
+-	/*Call core*/
+-	TransformSolutionCoord(solution,nodes,numnodes,cs_array);
+-
+-	/*Clean-up*/
+-	xDelete<int>(cs_array);
+-}
+-/*}}}*/
+-void TransformSolutionCoord(IssmDouble* solution,Node** nodes,int numnodes,int* cs_array){/*{{{*/
+-
+-	int     i;
+-	int     numdofs   = 0;
+-	IssmDouble *transform = NULL;
+-	IssmDouble *values    = NULL;
+-
+-	/*Get total number of dofs*/
+-	for(i=0;i<numnodes;i++){
+-		switch(cs_array[i]){
+-			case PressureEnum: numdofs+=1; break;
+-			case XYEnum:       numdofs+=2; break;
+-			case XYZEnum:      numdofs+=3; break;
+-			default: _error_("Coordinate system " << EnumToStringx(cs_array[i]) << " not supported yet");
+-		}
+-	}
+-
+-	/*Copy current solution vector*/
+-	values=xNew<IssmDouble>(numdofs);
+-	for(i=0;i<numdofs;i++) values[i]=solution[i];
+-
+-	/*Get Coordinate Systems transform matrix*/
+-	CoordinateSystemTransform(&transform,nodes,numnodes,cs_array);
+-
+-	/*Transform matrix: R*U */
+-	MatrixMultiply(transform,numdofs,numdofs,0,
+-				values,numdofs,1,0,
+-				&solution[0],0);
+-
+-	/*Free Matrices*/
+-	xDelete<IssmDouble>(transform);
+-	xDelete<IssmDouble>(values);
+-}
+-/*}}}*/
+-void TransformStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes,int numnodes,int cs_enum){/*{{{*/
+-
+-	int* cs_array=NULL;
+-
+-	/*All nodes have the same Coordinate System*/
+-	cs_array=xNew<int>(numnodes);
+-	for(int i=0;i<numnodes;i++) cs_array[i]=cs_enum;
+-
+-	/*Call core*/
+-	TransformStiffnessMatrixCoord(Ke,nodes,numnodes,cs_array);
+-
+-	/*Clean-up*/
+-	xDelete<int>(cs_array);
+-}
+-/*}}}*/
+-void TransformStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes,int numnodes,int* cs_array){/*{{{*/
+-
+-	int         numdofs = 0;
+-	IssmDouble *transform = NULL;
+-	IssmDouble *values    = NULL;
+-
+-	/*Get total number of dofs*/
+-	for(int i=0;i<numnodes;i++){
+-		switch(cs_array[i]){
+-			case PressureEnum: numdofs+=1; break;
+-			case XYEnum:       numdofs+=2; break;
+-			case XYZEnum:      numdofs+=3; break;
+-			default: _error_("Coordinate system " << EnumToStringx(cs_array[i]) << " not supported yet");
+-		}
+-	}
+-
+-	/*Copy current stiffness matrix*/
+-	values=xNew<IssmDouble>(Ke->nrows*Ke->ncols);
+-	for(int i=0;i<Ke->nrows*Ke->ncols;i++) values[i]=Ke->values[i];
+-
+-	/*Get Coordinate Systems transform matrix*/
+-	CoordinateSystemTransform(&transform,nodes,numnodes,cs_array);
+-
+-	/*Transform matrix: R^T*Ke*R */
+-	TripleMultiply(transform,numdofs,numdofs,1,
+-				values,Ke->nrows,Ke->ncols,0,
+-				transform,numdofs,numdofs,0,
+-				&Ke->values[0],0);
+-
+-	/*Free Matrix*/
+-	xDelete<IssmDouble>(transform);
+-	xDelete<IssmDouble>(values);
+-}
+-/*}}}*/
+-void CoordinateSystemTransform(IssmDouble** ptransform,Node** nodes,int numnodes,int* cs_array){/*{{{*/
+-
+-	int         i,counter;
+-	int         numdofs   = 0;
+-	IssmDouble  norm;
+-	IssmDouble *transform = NULL;
+-	IssmDouble  coord_system[3][3];
+-
+-	/*Some checks in debugging mode*/
+-	_assert_(numnodes && nodes);
+-
+-	/*Get total number of dofs*/
+-	for(i=0;i<numnodes;i++){
+-		switch(cs_array[i]){
+-			case PressureEnum: numdofs+=1; break;
+-			case XYEnum:       numdofs+=2; break;
+-			case XYZEnum:      numdofs+=3; break;
+-			default: _error_("Coordinate system " << EnumToStringx(cs_array[i]) << " not supported yet");
+-		}
+-	}
+-
+-	/*Allocate and initialize transform matrix*/
+-	transform=xNew<IssmDouble>(numdofs*numdofs);
+-	for(i=0;i<numdofs*numdofs;i++) transform[i]=0.0;
+-
+-	/*Create transform matrix for all nodes (x,y for 2d and x,y,z for 3d). It is a block matrix
+-	 *for 3 nodes:
+-
+-	 *     | T1 0  0 |
+-	 * Q = | 0  T2 0 |
+-	 *     | 0  0  T3|
+-	 *
+-	 * Where T1 is the transform matrix for node 1. It is a simple copy of the coordinate system
+-	 * associated to this node*/
+-	counter=0;
+-	for(i=0;i<numnodes;i++){
+-		nodes[i]->GetCoordinateSystem(&coord_system[0][0]);
+-		switch(cs_array[i]){
+-			case PressureEnum:
+-				/*DO NOT change anything*/
+-				transform[(numdofs)*(counter) + counter] = 1.;
+-				counter+=1;
+-				break;
+-			case XYEnum:
+-				/*We remove the z component, we need to renormalize x and y: x=[x1 x2 0] y=[-x2 x1 0]*/
+-				norm = sqrt( coord_system[0][0]*coord_system[0][0] + coord_system[1][0]*coord_system[1][0]); _assert_(norm>1.e-4);
+-				transform[(numdofs)*(counter+0) + counter+0] =   coord_system[0][0]/norm;
+-				transform[(numdofs)*(counter+0) + counter+1] = - coord_system[1][0]/norm;
+-				transform[(numdofs)*(counter+1) + counter+0] =   coord_system[1][0]/norm;
+-				transform[(numdofs)*(counter+1) + counter+1] =   coord_system[0][0]/norm;
+-				counter+=2;
+-				break;
+-			case XYZEnum:
+-				/*The 3 coordinates are changed (x,y,z)*/
+-				transform[(numdofs)*(counter+0) + counter+0] = coord_system[0][0];
+-				transform[(numdofs)*(counter+0) + counter+1] = coord_system[0][1];
+-				transform[(numdofs)*(counter+0) + counter+2] = coord_system[0][2];
+-				transform[(numdofs)*(counter+1) + counter+0] = coord_system[1][0];
+-				transform[(numdofs)*(counter+1) + counter+1] = coord_system[1][1];
+-				transform[(numdofs)*(counter+1) + counter+2] = coord_system[1][2];
+-				transform[(numdofs)*(counter+2) + counter+0] = coord_system[2][0];
+-				transform[(numdofs)*(counter+2) + counter+1] = coord_system[2][1];
+-				transform[(numdofs)*(counter+2) + counter+2] = coord_system[2][2];
+-				counter+=3;
+-				break;
+-			default:
+-				_error_("Coordinate system " << EnumToStringx(cs_array[i]) << " not supported yet");
+-		}
+-	}
+-
+-	/*Assign output pointer*/
+-	*ptransform=transform;
+-}
+-/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17255-17256.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17255-17256.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17255-17256.diff	(revision 17802)
@@ -0,0 +1,16 @@
+Index: ../trunk-jpl/src/m/plot/applyoptions.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/applyoptions.py	(revision 17255)
++++ ../trunk-jpl/src/m/plot/applyoptions.py	(revision 17256)
+@@ -138,9 +138,9 @@
+ 	if options.exist('xlim'):
+ 		p.xlim(options.getfieldvalue('xlim'))
+ 	if options.exist('ylim'):
+-		p.xlim(options.getfieldvalue('ylim'))
++		p.ylim(options.getfieldvalue('ylim'))
+ 	if options.exist('zlim'):
+-		p.xlim(options.getfieldvalue('zlim'))
++		p.zlim(options.getfieldvalue('zlim'))
+ 	#}}}
+ 
+ 	#latlon
Index: issm/oecreview/Archive/16554-17801/ISSM-17256-17257.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17256-17257.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17256-17257.diff	(revision 17802)
@@ -0,0 +1,108 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17256)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17257)
+@@ -225,6 +225,7 @@
+ 		virtual int    VelocityInterpolation()=0;
+ 		virtual int    PressureInterpolation()=0;
+ 		virtual bool   IsZeroLevelset(int levelset_enum)=0;
++		virtual bool   IsIcefront(void)=0;
+ 		virtual void   ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum)=0;
+ 		virtual void   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum)=0;
+ 		virtual void   GetNormalFromLSF(IssmDouble *pnormal)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17256)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17257)
+@@ -909,11 +909,27 @@
+ 		}
+ 	}
+ 
++	if(nrfrontnodes!=2){
++		_printf0_("in elt nr: " << this->Id() << "\n");
++		_printf0_("nrfrontnodes: " << nrfrontnodes << "\n");
++		for(i=0;i<NUMVERTICES;i++){
++			_printf_("levelsetfunction[" << i << "]=" << levelset[i] << "; indicesfront: " << indicesfront[i] << ";\n");
++		}
++	}
++	_assert_(nrfrontnodes==2);
++
++	/* arrange order of frontnodes such that they are oriented counterclockwise */
++	if((NUMVERTICES+indicesfront[0]-indicesfront[1])%NUMVERTICES!=NUMVERTICES-1){
++		int index=indicesfront[0];
++		indicesfront[0]=indicesfront[1];
++		indicesfront[1]=index;
++	}	
++
+ 	IssmDouble* xyz_front = xNew<IssmDouble>(3*nrfrontnodes);
+ 	/* Return nodes */
+ 	for(i=0;i<nrfrontnodes;i++){
+ 		for(dir=0;dir<3;dir++){
+-			xyz_front[3*i+dir]=xyz_list[indicesfront[i]+dir];
++			xyz_front[3*i+dir]=xyz_list[3*indicesfront[i]+dir];
+ 		}
+ 	}
+ 
+@@ -2587,7 +2603,26 @@
+ 	return iszerols;
+ }
+ /*}}}*/
++bool Tria::IsIcefront(void){/*{{{*/
+ 
++	bool isicefront;
++	int i,nrice;
++   IssmDouble ls[NUMVERTICES];
++
++	/*Retrieve all inputs and parameters*/
++	GetInputListOnVertices(&ls[0],MaskIceLevelsetEnum);
++
++	/* If only one vertex has ice, there is an ice front here */
++	isicefront=false;
++	if(IsIceInElement()){
++		nrice=0;       
++		for(i=0;i<NUMVERTICES;i++)
++			if(ls[i]<0.) nrice++;
++		if(nrice==1) isicefront= true;
++	}
++	return isicefront;
++}/*}}}*/
++
+ /*FUNCTION Tria::AverageOntoPartition {{{*/
+ void  Tria::AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17256)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17257)
+@@ -133,6 +133,7 @@
+ 		void	    GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum);
+ 	    void        GetNormalFromLSF(IssmDouble *pnormal);
+ 		bool        IsZeroLevelset(int levelset_enum);
++		bool		IsIcefront(void);
+ 
+ 		void       AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part);
+ 		IssmDouble IceVolume(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17256)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17257)
+@@ -113,6 +113,7 @@
+ 		IssmDouble PureIceEnthalpy(IssmDouble pressure);
+ 		int    PressureInterpolation();
+ 		bool   IsZeroLevelset(int levelset_enum);
++		bool   IsIcefront(void){_error_("not implemented yet");};
+ 		void   ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum);
+ 		void   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented yet");};
+ 		void   GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17256)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17257)
+@@ -158,6 +158,7 @@
+ 		void        VerticalSegmentIndices(int** pindices,int* pnumseg){_error_("not implemented yet");};
+ 		void        ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
+ 		bool        IsZeroLevelset(int levelset_enum){_error_("not implemented");};
++		bool		IsIcefront(void){_error_("not implemented yet");};
+ 		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented");};
+ 		void		GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented yet");};
+ 		void        GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-17257-17258.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17257-17258.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17257-17258.diff	(revision 17802)
@@ -0,0 +1,22 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17257)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17258)
+@@ -724,7 +724,16 @@
+ 	this->TransformSolutionCoord(values,this->nodes,this->GetNumberOfNodes(),transformenum_list);
+ }/*}}}*/
+ void Element::TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum){/*{{{*/
+-	this->TransformSolutionCoord(values,this->nodes,numnodes,transformenum);
++
++	/*All nodes have the same Coordinate System*/
++	int* cs_array = xNew<int>(numnodes);
++	for(int i=0;i<numnodes;i++) cs_array[i]=transformenum;
++
++	/*Call core*/
++	this->TransformSolutionCoord(values,this->nodes,numnodes,cs_array);
++
++	/*Clean-up*/
++	xDelete<int>(cs_array);
+ }/*}}}*/
+ void Element::TransformSolutionCoord(IssmDouble* solution,int numnodes,int* cs_array){/*{{{*/
+ 	this->TransformSolutionCoord(solution,this->nodes,numnodes,cs_array);
Index: issm/oecreview/Archive/16554-17801/ISSM-17258-17259.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17258-17259.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17258-17259.diff	(revision 17802)
@@ -0,0 +1,30 @@
+Index: ../trunk-jpl/src/m/classes/organizer.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/organizer.m	(revision 17258)
++++ ../trunk-jpl/src/m/classes/organizer.m	(revision 17259)
+@@ -96,15 +96,19 @@
+ 
+ 			%figure out if the model is there
+ 			if exist(path,'file'),
+-				struc=load(path,'-mat');
+-				name=char(fieldnames(struc));
+-				md=struc.(name);
+-				if nargout,
+-					varargout{1}=md;
+-				end
++				path=path;
++			elseif exist([path '.mat'],'file'),
++				path=[path '.mat'];
+ 			else
+ 				error(['Could not find ' path ]);
+ 			end
++
++			struc=load(path,'-mat');
++			name=char(fieldnames(struc));
++			md=struc.(name);
++			if nargout,
++				varargout{1}=md;
++			end
+ 		end%}}}
+ 		function md=loadmodel(org,string),% {{{
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17259-17260.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17259-17260.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17259-17260.diff	(revision 17802)
@@ -0,0 +1,23 @@
+Index: ../trunk-jpl/src/m/classes/mask.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mask.m	(revision 17259)
++++ ../trunk-jpl/src/m/classes/mask.m	(revision 17260)
+@@ -8,6 +8,18 @@
+ 		groundedice_levelset = NaN;
+ 		ice_levelset         = NaN;
+ 	end
++	methods (Static)
++		function obj = loadobj(obj) % {{{
++			% This function is directly called by matlab when a model object is
++			% loaded. Update old properties here
++
++			%2014 February 5th
++			if numel(obj.ice_levelset)>1 & all(obj.ice_levelset>=0),
++				disp('WARNING: md.mask.ice_levelset>=0, you probably need to change the sign of this levelset');
++			end
++
++		end% }}}
++	end
+ 	methods
+ 		function obj = mask(varargin) % {{{
+ 			switch nargin
Index: issm/oecreview/Archive/16554-17801/ISSM-17260-17261.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17260-17261.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17260-17261.diff	(revision 17802)
@@ -0,0 +1,268 @@
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17260)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17261)
+@@ -65,13 +65,12 @@
+ 
+ 	/*parameters: */
+ 	bool save_results;
++	
++	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
+ 
+ 	/*activate formulation: */
+ 	femmodel->SetCurrentConfiguration(LevelsetAnalysisEnum);
+ 
+-	/*recover parameters: */
+-	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
+-
+ 	if(VerboseSolution()) _printf0_("call computational core:\n");
+ 	solutionsequence_linear(femmodel);
+ 
+@@ -198,6 +197,8 @@
+ 	xDelete<IssmDouble>(B);
+ 	xDelete<IssmDouble>(Bprime);
+ 	delete gauss;
++
++// 	Ke->Echo();
+ 	return Ke;
+ }/*}}}*/
+ ElementVector* LevelsetAnalysis::CreatePVector(Element* element){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17260)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17261)
+@@ -1044,7 +1044,7 @@
+ void StressbalanceAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+ 	/*Default, do nothing*/
+ 	_printf0_("   Updating active and non-active nodes for StressbalanceAnalysis \n");
+-	//SetActiveNodesLSMx(femmodel->elements);
++//	SetActiveNodesLSMx(femmodel->elements);
+ 	return;
+ }/*}}}*/
+ 
+@@ -1392,7 +1392,7 @@
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+ 	/*If no front, return NULL*/
+-	if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
++	if(!element->IsIcefront()) return NULL;
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble  Jdet,thickness,bed,water_pressure,ice_pressure;
+@@ -1415,7 +1415,8 @@
+ 	IssmDouble rho_ice     = element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 	IssmDouble gravity     = element->GetMaterialParameter(ConstantsGEnum);
+ 	element->GetVerticesCoordinates(&xyz_list);
+-	element->ZeroLevelsetCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
++// 	element->ZeroLevelsetCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
++	element->GetIcefrontCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
+ 	element->NormalSection(&normal[0],xyz_list_front);
+ 
+ 	/*Start looping on Gaussian points*/
+@@ -1805,7 +1806,7 @@
+ ElementVector* StressbalanceAnalysis::CreatePVectorL1L2Front(Element* element){/*{{{*/
+ 
+ 	/*If no front, return NULL*/
+-	if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
++	if(!element->IsIcefront()) return NULL;
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble  Jdet,thickness,bed,water_pressure,ice_pressure;
+@@ -2261,7 +2262,7 @@
+ ElementVector* StressbalanceAnalysis::CreatePVectorHOFront(Element* element){/*{{{*/
+ 
+ 	/*If no front, return NULL*/
+-	if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
++	if(!element->IsIcefront()) return NULL;
+ 
+ 	/*Intermediaries*/
+ 	int         dim,meshtype;
+@@ -3078,7 +3079,7 @@
+ ElementVector* StressbalanceAnalysis::CreatePVectorFSFront(Element* element){/*{{{*/
+ 
+ 	/*If no front, return NULL*/
+-	if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL;
++	if(!element->IsIcefront()) return NULL;
+ 
+ 	/*Intermediaries*/
+ 	int         i,meshtype,dim;
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17260)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17261)
+@@ -230,6 +230,9 @@
+ }/*}}}*/
+ ElementMatrix* MasstransportAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	if(!element->IsOnBed()) return NULL;
+ 	Element* basalelement = element->SpawnBasalElement();
+ 
+@@ -252,6 +255,9 @@
+ }/*}}}*/
+ ElementMatrix* MasstransportAnalysis::CreateKMatrixCG(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*Intermediaries */
+ 	int        stabilization;
+ 	int        meshtype;
+@@ -364,6 +370,9 @@
+ }/*}}}*/
+ ElementMatrix* MasstransportAnalysis::CreateKMatrixDG(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*Intermediaries */
+ 	int        meshtype;
+ 	IssmDouble Jdet,D_scalar,dt,vx,vy;
+@@ -437,6 +446,9 @@
+ }/*}}}*/
+ ElementVector* MasstransportAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	if(!element->IsOnBed()) return NULL;
+ 	Element* basalelement = element->SpawnBasalElement();
+ 
+@@ -459,6 +471,9 @@
+ }/*}}}*/
+ ElementVector* MasstransportAnalysis::CreatePVectorCG(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*Intermediaries */
+ 	IssmDouble  Jdet,dt;
+ 	IssmDouble  ms,mb,mb_correction=0.,thickness;
+@@ -505,6 +520,9 @@
+ }/*}}}*/
+ ElementVector* MasstransportAnalysis::CreatePVectorDG(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*Intermediaries */
+ 	IssmDouble  Jdet,dt;
+ 	IssmDouble  ms,mb,mb_correction=0.,thickness;
+@@ -692,6 +710,7 @@
+ 	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ }/*}}}*/
+ void MasstransportAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+-	/*Default, do nothing*/
++//	_printf0_("   Updating active and non-active nodes for MasstransportAnalysis \n");
++//	SetActiveNodesLSMx(femmodel->elements);
+ 	return;
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17260)
++++ ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17261)
+@@ -48,21 +48,15 @@
+ 
+ 	/* Intermediaries */
+ 	bool save_results;
++	int extvar_enum; 
++   femmodel->parameters->FindParam(&extvar_enum, ExtrapolationVariableEnum);
++
+ 	/*activate formulation: */
+ 	femmodel->SetCurrentConfiguration(ExtrapolationAnalysisEnum);
+ 
+-	if(VerboseSolution()) _printf0_("extrapolation: call computational core:\n");
++	if(VerboseSolution()) _printf0_("extrapolation of " << EnumToStringx(extvar_enum) << ": call computational core:\n");
+ 	solutionsequence_linear(femmodel);
+ 
+-	/*recover parameters: */
+-	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
+-	if(save_results){
+-		if(VerboseSolution()) _printf0_("   Warning: Adding extrapolated variable to results\n");
+-		
+-		int outputs; 
+-		femmodel->parameters->FindParam(&outputs, ExtrapolationVariableEnum);
+-		femmodel->RequestedOutputsx(&femmodel->results,&outputs,1);
+-	}
+ 
+ }/*}}}*/
+ ElementVector* ExtrapolationAnalysis::CreateDVector(Element* element){/*{{{*/
+Index: ../trunk-jpl/src/c/cores/transient_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17260)
++++ ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17261)
+@@ -121,14 +121,7 @@
+ 			if(VerboseSolution()) _printf0_("   computing new velocity\n");
+ 			stressbalance_core(femmodel);
+ 		}
+-
+-		if(ismasstransport){
+-			if(VerboseSolution()) _printf0_("   computing new thickness\n");
+-			masstransport_core(femmodel);
+-			if(VerboseSolution()) _printf0_("   updating vertices positions\n");
+-			femmodel->UpdateVertexPositionsx();
+-		}
+-
++		
+ 		if(isgroundingline){
+ 			if(VerboseSolution()) _printf0_("   computing new grounding line position\n");
+ 			GroundinglineMigrationx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
+@@ -152,8 +145,9 @@
+ 
+ 			/* extrapolate required variables */
+ 			Analysis* extanalysis = new ExtrapolationAnalysis();
+-			int vars[2] = {VxEnum, VyEnum};
+-			for(int iv=0;iv<2;iv++){
++			const int nvars=2;
++			int vars[nvars] = {VxEnum, VyEnum};
++			for(int iv=0;iv<nvars;iv++){
+ 				femmodel->parameters->SetParam(vars[iv],ExtrapolationVariableEnum); 
+ 				extanalysis->Core(femmodel);
+ 			}
+@@ -165,8 +159,20 @@
+ 
+ 			/* update vertices included for next calculation */
+ 			GetMaskOfIceVerticesLSMx(femmodel);
++
++			/* add computation domain mask to outputs */
++			int outputs[1] = {IceMaskNodeActivationEnum};
++			femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],1);
++
+ 		}
+ 
++		if(ismasstransport){
++			if(VerboseSolution()) _printf0_("   computing new thickness\n");
++			masstransport_core(femmodel);
++			if(VerboseSolution()) _printf0_("   updating vertices positions\n");
++			femmodel->UpdateVertexPositionsx();
++		}
++
+ 		/*unload results*/
+ 		if(VerboseSolution()) _printf0_("   computing requested outputs\n");
+ 		femmodel->RequestedOutputsx(&femmodel->results,requested_outputs,numoutputs,save_results);
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17260)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17261)
+@@ -1620,6 +1620,7 @@
+ 				name==BedEnum ||
+ 				name==MaskGroundediceLevelsetEnum ||
+ 				name==MaskIceLevelsetEnum ||
++				name==IceMaskNodeActivationEnum ||
+ 				name==SurfaceSlopeXEnum ||
+ 				name==SurfaceSlopeYEnum ||
+ 				name==BasalforcingsMeltingRateEnum ||
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17260)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17261)
+@@ -1975,6 +1975,7 @@
+ 				name==FrictionCoefficientEnum ||
+ 				name==MaskGroundediceLevelsetEnum ||
+ 				name==MaskIceLevelsetEnum ||
++				name==IceMaskNodeActivationEnum ||
+ 				name==GradientEnum ||
+ 				name==OldGradientEnum  ||
+ 				name==ConvergedEnum || 
Index: issm/oecreview/Archive/16554-17801/ISSM-17261-17262.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17261-17262.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17261-17262.diff	(revision 17802)
@@ -0,0 +1,15 @@
+Index: ../trunk-jpl/src/m/plot/plot_icefront.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_icefront.m	(revision 17261)
++++ ../trunk-jpl/src/m/plot/plot_icefront.m	(revision 17262)
+@@ -11,8 +11,8 @@
+ 
+ %process mesh and data
+ [x y z elements is2d isplanet]=processmesh(md,[],options);
+-ice=(md.mask.ice_levelset>0);
+-noice=(md.mask.ice_levelset<=0);
++ice=(md.mask.ice_levelset<0);
++noice=(md.mask.ice_levelset>=0);
+ zeroice=(md.mask.ice_levelset==0);
+ elementice=sum(ice(md.mesh.elements),2);
+ elementnoice=sum(noice(md.mesh.elements),2);
Index: issm/oecreview/Archive/16554-17801/ISSM-17262-17263.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17262-17263.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17262-17263.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/scripts/vie
+===================================================================
+--- ../trunk-jpl/scripts/vie	(revision 17262)
++++ ../trunk-jpl/scripts/vie	(revision 17263)
+@@ -2,7 +2,7 @@
+ 
+ if [ -z "$EXECUTION_DIR" ];
+ then
+-	EXECUTION_DIR=$ISSM_DIR/execution
++	EXECUTION_DIR="$ISSM_DIR/execution"
+ fi
+ 
+ DIR=$(ls -rtd1 $EXECUTION_DIR/* | tail -n1)
+Index: ../trunk-jpl/scripts/vil
+===================================================================
+--- ../trunk-jpl/scripts/vil	(revision 17262)
++++ ../trunk-jpl/scripts/vil	(revision 17263)
+@@ -1,7 +1,7 @@
+ #!/bin/bash
+ if [ -z $EXECUTION_DIR ];
+ then
+-	EXECUTION_DIR=$ISSM_DIR/execution
++	EXECUTION_DIR="$ISSM_DIR/execution"
+ fi
+ 
+ DIR=$(ls -rtd1 $EXECUTION_DIR/* | tail -n1)
Index: issm/oecreview/Archive/16554-17801/ISSM-17263-17264.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17263-17264.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17263-17264.diff	(revision 17802)
@@ -0,0 +1,104 @@
+Index: ../trunk-jpl/src/m/solve/waitonlock.py
+===================================================================
+--- ../trunk-jpl/src/m/solve/waitonlock.py	(revision 17263)
++++ ../trunk-jpl/src/m/solve/waitonlock.py	(revision 17264)
+@@ -23,7 +23,7 @@
+ 	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):
++	if not strcmpi(socket.gethostname(),cluster):
+ 
+ 		print 'solution launched on remote cluster. log in to detect job completion.'
+ 		choice=raw_input('Is the job successfully completed? (y/n) ')
+Index: ../trunk-jpl/src/m/miscellaneous/MatlabFuncs.py
+===================================================================
+--- ../trunk-jpl/src/m/miscellaneous/MatlabFuncs.py	(revision 17263)
++++ ../trunk-jpl/src/m/miscellaneous/MatlabFuncs.py	(revision 17264)
+@@ -1,7 +1,7 @@
+ def oshostname():
+ 	import socket
+ 
+-	return socket.gethostname().lower().split('.')[0]
++	return socket.gethostname()
+ 
+ def ispc():
+ 	import platform
+Index: ../trunk-jpl/src/m/classes/clusters/generic.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/clusters/generic.py	(revision 17263)
++++ ../trunk-jpl/src/m/classes/clusters/generic.py	(revision 17264)
+@@ -36,7 +36,7 @@
+ 		options=pairoptions(*args)
+ 
+ 		#get name
+-		self.name=options.getfieldvalue('name',socket.gethostname().lower().split('.')[0])
++		self.name=gethostname()
+ 
+ 		#initialize cluster using user settings if provided
+ 		if os.path.exists(self.name+'_settings.py'):
+@@ -45,7 +45,6 @@
+ 		#OK get other fields
+ 		self=options.AssignObjectFields(self)
+ 	# }}}
+-
+ 	def __repr__(self):    # {{{
+ 		#  display the object
+ 		s ="class '%s' object '%s' = \n" % (type(self),'self')
+@@ -60,7 +59,6 @@
+ 		s+="    valgrindsup: %s\n" % self.valgrindsup
+ 		return s
+ 	# }}}
+-
+ 	def checkconsistency(self,md,solution,analyses):    # {{{
+ 		if self.np<1:
+ 			md = checkmessage(md,'number of processors should be at least 1')
+@@ -69,7 +67,6 @@
+ 
+ 		return md
+ 	# }}}
+-
+ 	def BuildQueueScript(self,dirname,modelname,solution,io_gather,isvalgrind,isgprof):    # {{{
+ 
+ 		#write queuing script 
+@@ -122,7 +119,6 @@
+ 			fid=open(modelname+'.outlog','w')
+ 			fid.close()
+ 	# }}}
+-
+ 	def BuildKrigingQueueScript(self,modelname,solution,io_gather,isvalgrind,isgprof):    # {{{
+ 
+ 		#write queuing script 
+@@ -164,7 +160,6 @@
+ 			fid=open(modelname+'.outlog','w')
+ 			fid.close()
+ 	# }}}
+-
+ 	def LaunchQueueJob(self,modelname,dirname,filelist):    # {{{
+ 
+ 		#compress the files into one zip.
+@@ -183,7 +178,6 @@
+ 			(self.executionpath,dirname,dirname,dirname,dirname,dirname,modelname,modelname)
+ 		issmssh(self.name,self.login,self.port,launchcommand)
+ 	# }}}
+-
+ 	def Download(self,dirname,filelist):     # {{{
+ 
+ 		if ispc():
+@@ -194,4 +188,3 @@
+ 		directory='%s/%s/' % (self.executionpath,dirname)
+ 		issmscpin(self.name,self.login,self.port,directory,filelist)
+ 	# }}}
+-
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17263)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17264)
+@@ -334,7 +334,6 @@
+ def ExtrudeFromBaseAnalysisEnum(): return StringToEnum("ExtrudeFromBaseAnalysis")[0]
+ def ExtrudeFromTopAnalysisEnum(): return StringToEnum("ExtrudeFromTopAnalysis")[0]
+ def SteadystateSolutionEnum(): return StringToEnum("SteadystateSolution")[0]
+-def L2ProjectionTopAnalysisEnum(): return StringToEnum("L2ProjectionTopAnalysis")[0]
+ def SurfaceSlopeSolutionEnum(): return StringToEnum("SurfaceSlopeSolution")[0]
+ def SmoothedSurfaceSlopeXAnalysisEnum(): return StringToEnum("SmoothedSurfaceSlopeXAnalysis")[0]
+ def SmoothedSurfaceSlopeYAnalysisEnum(): return StringToEnum("SmoothedSurfaceSlopeYAnalysis")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17264-17265.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17264-17265.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17264-17265.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/solve/loadresultsfromcluster.py
+===================================================================
+--- ../trunk-jpl/src/m/solve/loadresultsfromcluster.py	(revision 17264)
++++ ../trunk-jpl/src/m/solve/loadresultsfromcluster.py	(revision 17265)
+@@ -44,7 +44,7 @@
+ 			os.remove(md.private.runtimename+'.tar.gz')
+ 
+ 	#erase input file if run was carried out on same platform.
+-	hostname=socket.gethostname().lower().split('.')[0]
++	hostname=socket.gethostname()
+ 	if strcmpi(hostname,cluster.name):
+ 		if md.qmu.isdakota:
+ 			os.remove(os.path.join('qmu'+str(os.getpid()),md.miscellaneous.name+'.bin'))
Index: issm/oecreview/Archive/16554-17801/ISSM-17265-17266.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17265-17266.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17265-17266.diff	(revision 17802)
@@ -0,0 +1,265 @@
+Index: ../trunk-jpl/src/c/classes/Materials/Material.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Material.h	(revision 17265)
++++ ../trunk-jpl/src/c/classes/Materials/Material.h	(revision 17266)
+@@ -18,7 +18,7 @@
+ 
+ 	public: 
+ 		Inputs*  inputs;
+-		virtual       ~Material(){};
++		virtual ~Material(){};
+ 		/*WARNING: input should not be public but it is an easy way to update B from T (using UpdateFromSolution) from Pentas*/
+ 
+ 		/*Numerics*/
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 17265)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 17266)
+@@ -209,7 +209,7 @@
+ 		case  ConstantsGEnum:
+ 			this->g=constant;
+ 			break;
+-  	        case  SurfaceforcingsDesfacEnum:
++		case  SurfaceforcingsDesfacEnum:
+ 			this->desfac=constant;
+ 			break;
+ 		case SurfaceforcingsS0pEnum:
+Index: ../trunk-jpl/src/c/classes/Loads/Numericalflux.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Numericalflux.cpp	(revision 17265)
++++ ../trunk-jpl/src/c/classes/Loads/Numericalflux.cpp	(revision 17266)
+@@ -22,7 +22,6 @@
+ /*Numericalflux constructors and destructor*/
+ /*FUNCTION Numericalflux::Numericalflux(){{{*/
+ Numericalflux::Numericalflux(){
+-	this->inputs     = NULL;
+ 	this->parameters = NULL;
+ 	this->helement   = NULL;
+ 	this->element    = NULL;
+@@ -111,16 +110,13 @@
+ 	/*Ok, we have everything to build the object: */
+ 	this->id=numericalflux_id;
+ 	this->analysis_type=in_analysis_type;
++	this->flux_type = numericalflux_type;
+ 
+ 	/*Hooks: */
+ 	this->hnodes    =new Hook(numericalflux_node_ids,num_nodes);
+ 	this->hvertices =new Hook(&numericalflux_vertex_ids[0],2);
+ 	this->helement  =new Hook(numericalflux_elem_ids,1); // take only the first element for now
+ 
+-	//intialize  and add as many inputs per element as requested: 
+-	this->inputs=new Inputs();
+-	this->inputs->AddInput(new IntInput(NumericalfluxTypeEnum,numericalflux_type));
+-
+ 	//this->parameters: we still can't point to it, it may not even exist. Configure will handle this.
+ 	this->parameters=NULL;
+ 	this->element=NULL;
+@@ -129,7 +125,6 @@
+ /*}}}*/
+ /*FUNCTION Numericalflux::~Numericalflux(){{{*/
+ Numericalflux::~Numericalflux(){
+-	delete inputs;
+ 	this->parameters=NULL;
+ 	delete helement;
+ 	delete hnodes;
+@@ -143,11 +138,11 @@
+ 	_printf_("Numericalflux:\n");
+ 	_printf_("   id: " << id << "\n");
+ 	_printf_("   analysis_type: " << EnumToStringx(analysis_type) << "\n");
++	_printf_("   flux_type: " << this->flux_type<< "\n");
+ 	hnodes->Echo();
+ 	hvertices->Echo();
+ 	helement->Echo();
+ 	_printf_("   parameters: " << parameters << "\n");
+-	_printf_("   inputs: " << inputs << "\n");
+ }
+ /*}}}*/
+ /*FUNCTION Numericalflux::DeepEcho {{{*/
+@@ -156,6 +151,7 @@
+ 	_printf_("Numericalflux:\n");
+ 	_printf_("   id: " << id << "\n");
+ 	_printf_("   analysis_type: " << EnumToStringx(analysis_type) << "\n");
++	_printf_("   flux_type: " << this->flux_type<< "\n");
+ 	hnodes->DeepEcho();
+ 	hvertices->DeepEcho();
+ 	helement->DeepEcho();
+@@ -164,9 +160,6 @@
+ 	 parameters->DeepEcho();
+ 	else
+ 	 _printf_("      NULL\n");
+-	_printf_("   inputs\n");
+-	inputs->DeepEcho();
+-
+ }		
+ /*}}}*/
+ /*FUNCTION Numericalflux::Id {{{*/
+@@ -191,12 +184,8 @@
+ 	/*copy fields: */
+ 	numericalflux->id=this->id;
+ 	numericalflux->analysis_type=this->analysis_type;
+-	if(this->inputs){
+-		numericalflux->inputs=(Inputs*)this->inputs->Copy();
+-	}
+-	else{
+-		numericalflux->inputs=new Inputs();
+-	}
++	numericalflux->flux_type=this->flux_type;
++
+ 	/*point parameters: */
+ 	numericalflux->parameters=this->parameters;
+ 
+@@ -302,12 +291,10 @@
+ /*FUNCTION Numericalflux::GetNodesSidList{{{*/
+ void Numericalflux::GetNodesSidList(int* sidlist){
+ 
+-	int type;
+-	inputs->GetInputValue(&type,NumericalfluxTypeEnum);
+ 	_assert_(sidlist);
+ 	_assert_(nodes);
+ 
+-	switch(type){
++	switch(this->flux_type){
+ 		case InternalEnum:
+ 			for(int i=0;i<NUMNODES_INTERNAL;i++) sidlist[i]=nodes[i]->Sid();
+ 			return;
+@@ -315,19 +302,17 @@
+ 			for(int i=0;i<NUMNODES_BOUNDARY;i++) sidlist[i]=nodes[i]->Sid();
+ 			return;
+ 		default:
+-			_error_("Numericalflux type " << EnumToStringx(type) << " not supported yet");
++			_error_("Numericalflux type " << EnumToStringx(this->flux_type) << " not supported yet");
+ 	}
+ }
+ /*}}}*/
+ /*FUNCTION Numericalflux::GetNodesLidList{{{*/
+ void Numericalflux::GetNodesLidList(int* lidlist){
+ 
+-	int type;
+-	inputs->GetInputValue(&type,NumericalfluxTypeEnum);
+ 	_assert_(lidlist);
+ 	_assert_(nodes);
+ 
+-	switch(type){
++	switch(this->flux_type){
+ 		case InternalEnum:
+ 			for(int i=0;i<NUMNODES_INTERNAL;i++) lidlist[i]=nodes[i]->Lid();
+ 			return;
+@@ -335,23 +320,20 @@
+ 			for(int i=0;i<NUMNODES_BOUNDARY;i++) lidlist[i]=nodes[i]->Lid();
+ 			return;
+ 		default:
+-			_error_("Numericalflux type " << EnumToStringx(type) << " not supported yet");
++			_error_("Numericalflux type " << EnumToStringx(this->flux_type) << " not supported yet");
+ 	}
+ }
+ /*}}}*/
+ /*FUNCTION Numericalflux::GetNumberOfNodes{{{*/
+ int Numericalflux::GetNumberOfNodes(void){
+ 
+-	int type;
+-	inputs->GetInputValue(&type,NumericalfluxTypeEnum);
+-
+-	switch(type){
++	switch(this->flux_type){
+ 		case InternalEnum:
+ 			return NUMNODES_INTERNAL;
+ 		case BoundaryEnum:
+ 			return NUMNODES_BOUNDARY;
+ 		default:
+-			_error_("Numericalflux type " << EnumToStringx(type) << " not supported yet");
++			_error_("Numericalflux type " << EnumToStringx(this->flux_type) << " not supported yet");
+ 	}
+ 
+ }
+@@ -443,10 +425,7 @@
+ /*FUNCTION Numericalflux::CreateKMatrixMasstransport{{{*/
+ ElementMatrix* Numericalflux::CreateKMatrixMasstransport(void){
+ 
+-	int type;
+-	inputs->GetInputValue(&type,NumericalfluxTypeEnum);
+-
+-	switch(type){
++	switch(this->flux_type){
+ 		case InternalEnum:
+ 			return CreateKMatrixMasstransportInternal();
+ 		case BoundaryEnum:
+@@ -596,10 +575,7 @@
+ /*FUNCTION Numericalflux::CreateKMatrixBalancethickness{{{*/
+ ElementMatrix* Numericalflux::CreateKMatrixBalancethickness(void){
+ 
+-	int type;
+-	inputs->GetInputValue(&type,NumericalfluxTypeEnum);
+-
+-	switch(type){
++	switch(this->flux_type){
+ 		case InternalEnum:
+ 			return CreateKMatrixBalancethicknessInternal();
+ 		case BoundaryEnum:
+@@ -747,10 +723,7 @@
+ /*FUNCTION Numericalflux::CreateKMatrixAdjointBalancethickness{{{*/
+ ElementMatrix* Numericalflux::CreateKMatrixAdjointBalancethickness(void){
+ 
+-	int type;
+-	inputs->GetInputValue(&type,NumericalfluxTypeEnum);
+-
+-	switch(type){
++	switch(this->flux_type){
+ 		case InternalEnum:
+ 			return CreateKMatrixAdjointBalancethicknessInternal();
+ 		case BoundaryEnum:
+@@ -779,10 +752,7 @@
+ /*FUNCTION Numericalflux::CreatePVectorMasstransport{{{*/
+ ElementVector* Numericalflux::CreatePVectorMasstransport(void){
+ 
+-	int type;
+-	inputs->GetInputValue(&type,NumericalfluxTypeEnum);
+-
+-	switch(type){
++	switch(this->flux_type){
+ 		case InternalEnum:
+ 			return CreatePVectorMasstransportInternal();
+ 		case BoundaryEnum:
+@@ -873,10 +843,7 @@
+ /*FUNCTION Numericalflux::CreatePVectorBalancethickness{{{*/
+ ElementVector* Numericalflux::CreatePVectorBalancethickness(void){
+ 
+-	int type;
+-	inputs->GetInputValue(&type,NumericalfluxTypeEnum);
+-
+-	switch(type){
++	switch(this->flux_type){
+ 		case InternalEnum:
+ 			return CreatePVectorBalancethicknessInternal();
+ 		case BoundaryEnum:
+Index: ../trunk-jpl/src/c/classes/Loads/Numericalflux.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Numericalflux.h	(revision 17265)
++++ ../trunk-jpl/src/c/classes/Loads/Numericalflux.h	(revision 17266)
+@@ -21,6 +21,7 @@
+ 	public: 
+ 		int id;
+ 		int analysis_type;
++		int flux_type;
+ 
+ 		/*Hooks*/
+ 		Hook *helement;
+@@ -32,7 +33,6 @@
+ 		Vertex     **vertices;
+ 		Node       **nodes;
+ 		Parameters  *parameters;
+-		Inputs      *inputs;
+ 
+ 		/*Numericalflux constructors,destructors {{{*/
+ 		Numericalflux();
+Index: ../trunk-jpl/src/c/classes/Loads/Load.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Load.h	(revision 17265)
++++ ../trunk-jpl/src/c/classes/Loads/Load.h	(revision 17266)
+@@ -23,7 +23,6 @@
+ class Load: public Object,public Update{
+ 
+ 	public: 
+-
+ 		virtual       ~Load(){};
+ 		virtual void  Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters)=0;
+ 		virtual bool  IsPenalty(void)=0;
Index: issm/oecreview/Archive/16554-17801/ISSM-17266-17267.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17266-17267.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17266-17267.diff	(revision 17802)
@@ -0,0 +1,43 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17266)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17267)
+@@ -3174,7 +3174,25 @@
+ 	return iszerols;
+ }
+ /*}}}*/
++bool  Penta::IsIcefront(void){/*{{{*/
+ 
++	bool isicefront;
++	int i,nrice;
++   IssmDouble ls[NUMVERTICES];
++
++	/*Retrieve all inputs and parameters*/
++	GetInputListOnVertices(&ls[0],MaskIceLevelsetEnum);
++
++	/* If only one vertex has ice, there is an ice front here */
++	isicefront=false;
++	if(IsIceInElement()){
++		nrice=0;       
++		for(i=0;i<NUMVERTICES2D;i++)
++			if(ls[i]<0.) nrice++;
++		if(nrice==1) isicefront= true;
++	}
++	return isicefront;
++}/*}}}*/
+ /*FUNCTION Penta::AverageOntoPartition {{{*/
+ void  Penta::AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part){
+ 	_error_("Not supported yet!");
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17266)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17267)
+@@ -113,7 +113,7 @@
+ 		IssmDouble PureIceEnthalpy(IssmDouble pressure);
+ 		int    PressureInterpolation();
+ 		bool   IsZeroLevelset(int levelset_enum);
+-		bool   IsIcefront(void){_error_("not implemented yet");};
++		bool   IsIcefront(void);
+ 		void   ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum);
+ 		void   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented yet");};
+ 		void   GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-17267-17268.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17267-17268.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17267-17268.diff	(revision 17802)
@@ -0,0 +1,122 @@
+Index: ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 17267)
++++ ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 17268)
+@@ -20,7 +20,6 @@
+ /*Pengrid constructors and destructor*/
+ /*FUNCTION Pengrid::Pengrid(){{{*/
+ Pengrid::Pengrid(){
+-	this->inputs=NULL;
+ 	this->parameters=NULL;
+ 	this->hnode=NULL;
+ 	this->node=NULL;
+@@ -61,9 +60,6 @@
+ 	this->helement=new Hook(&pengrid_element_id,1);
+ 	this->hmatpar=new Hook(&pengrid_matpar_id,1);
+ 
+-	//initialize inputs: none needed
+-	this->inputs=new Inputs();
+-
+ 	//this->parameters: we still can't point to it, it may not even exist. Configure will handle this.
+ 	this->parameters=NULL;
+ 	this->node=NULL;
+@@ -78,7 +74,6 @@
+ /*}}}*/
+ /*FUNCTION Pengrid::~Pengrid(){{{*/
+ Pengrid::~Pengrid(){
+-	delete inputs;
+ 	delete hnode;
+ 	delete helement;
+ 	delete hmatpar;
+@@ -105,8 +100,6 @@
+ 	_printf_("   zigzag_counter " << this->zigzag_counter << "\n");
+ 	_printf_("   parameters\n");
+ 	parameters->DeepEcho();
+-	_printf_("   inputs\n");
+-	inputs->DeepEcho();
+ }
+ /*}}}*/
+ /*FUNCTION Pengrid::Id {{{*/
+@@ -128,12 +121,7 @@
+ 	/*copy fields: */
+ 	pengrid->id=this->id;
+ 	pengrid->analysis_type=this->analysis_type;
+-	if(this->inputs){
+-		pengrid->inputs=(Inputs*)this->inputs->Copy();
+-	}
+-	else{
+-		pengrid->inputs=new Inputs();
+-	}
++
+ 	/*point parameters: */
+ 	pengrid->parameters=this->parameters;
+ 
+@@ -367,13 +355,7 @@
+ /*}}}*/
+ /*FUNCTION Pengrid::InputUpdateFromConstant(IssmDouble constant, int name) {{{*/
+ void  Pengrid::InputUpdateFromConstant(IssmDouble constant, int name){
+-	switch(name){
+-
+-		case MeltingOffsetEnum:
+-			inputs->AddInput(new DoubleInput(name,constant));
+-			return;
+-
+-	}
++	/*Nothing*/
+ }
+ /*}}}*/
+ /*FUNCTION Pengrid::InputUpdateFromConstant(int constant, int name) {{{*/
+@@ -505,7 +487,7 @@
+ 	if (node->IsClone()) return NULL;
+ 	ElementMatrix* Ke=new ElementMatrix(&node,1,this->parameters);
+ 
+-	/*Retrieve all inputs and parameters*/
++	/*Retrieve all parameters*/
+ 	penta->GetInputValue(&pressure,node,PressureEnum);
+ 	penta->GetInputValue(&temperature,node,TemperatureEnum);
+ 	parameters->FindParam(&penalty_factor,ThermalPenaltyFactorEnum);
+@@ -556,10 +538,10 @@
+ 	if (node->IsClone()) return NULL;
+ 	ElementVector* pe=new ElementVector(&node,NUMVERTICES,this->parameters);
+ 
+-	/*Retrieve all inputs and parameters*/
++	/*Retrieve all parameters*/
+ 	penta->GetInputValue(&pressure,node,PressureEnum);
+ 	penta->GetInputValue(&temperature,node,TemperatureEnum);
+-	inputs->GetInputValue(&melting_offset,MeltingOffsetEnum);
++	parameters->FindParam(&melting_offset,MeltingOffsetEnum);
+ 	parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	parameters->FindParam(&penalty_factor,ThermalPenaltyFactorEnum);
+ 
+@@ -595,7 +577,7 @@
+ 	if(!this->active) return NULL;
+ 	ElementVector* pe=new ElementVector(&node,1,this->parameters);
+ 
+-	/*Retrieve all inputs and parameters*/
++	/*Retrieve all parameters*/
+ 	penta->GetInputValue(&pressure,node,PressureEnum);
+ 	parameters->FindParam(&penalty_factor,ThermalPenaltyFactorEnum);
+ 
+Index: ../trunk-jpl/src/c/classes/Loads/Pengrid.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Pengrid.h	(revision 17267)
++++ ../trunk-jpl/src/c/classes/Loads/Pengrid.h	(revision 17268)
+@@ -22,8 +22,8 @@
+ 
+ 	private: 
+ 
+-		int		id;
+-		int analysis_type;
++		int        id;
++		int        analysis_type;
+ 
+ 		/*Hooks*/
+ 		Hook* hnode;  //hook to 1 node
+@@ -36,7 +36,6 @@
+ 		Matpar  *matpar;
+ 
+ 		Parameters* parameters; //pointer to solution parameters
+-		Inputs*  inputs;
+ 
+ 		/*internals: */
+ 		int active;
Index: issm/oecreview/Archive/16554-17801/ISSM-17268-17269.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17268-17269.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17268-17269.diff	(revision 17802)
@@ -0,0 +1,261 @@
+Index: ../trunk-jpl/src/c/classes/Loads/Riftfront.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Riftfront.h	(revision 17268)
++++ ../trunk-jpl/src/c/classes/Loads/Riftfront.h	(revision 17269)
+@@ -10,7 +10,6 @@
+ #include "./Load.h"
+ class Hook;
+ class Parameters;
+-class Inputs;
+ class IoModel;
+ /*}}}*/
+ 
+@@ -20,6 +19,13 @@
+ 		int		id;
+ 		int     analysis_type;
+ 
++		/*properties*/
++		int        type;
++		int        fill;
++		IssmDouble friction;
++		IssmDouble fractionincrement;
++		bool       shelf;
++
+ 		/*hooks: */
+ 		Hook* hnodes;
+ 		Hook* helements;
+@@ -43,7 +49,6 @@
+ 		int         state;
+ 
+ 		Parameters *parameters;           //pointer to solution parameters
+-		Inputs     *inputs;
+ 
+ 		/*Riftfrontconstructors,destructors: {{{*/
+ 		Riftfront();
+@@ -88,7 +93,6 @@
+ 		int   Constrain(int* punstable);
+ 		void  FreezeConstraints(void);
+ 		bool  IsFrozen(void);
+-		bool  IsInput(int name);
+ 		/*}}}*/
+ };
+ #endif  /* _RIFTFRONT_H_ */
+Index: ../trunk-jpl/src/c/classes/Loads/Numericalflux.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Numericalflux.h	(revision 17268)
++++ ../trunk-jpl/src/c/classes/Loads/Numericalflux.h	(revision 17269)
+@@ -9,7 +9,6 @@
+ #include "./Load.h"
+ class Hook;
+ class Parameters;
+-class Inputs;
+ class IoModel;
+ class Element;
+ class Vertex;
+Index: ../trunk-jpl/src/c/classes/Loads/Riftfront.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Riftfront.cpp	(revision 17268)
++++ ../trunk-jpl/src/c/classes/Loads/Riftfront.cpp	(revision 17269)
+@@ -21,7 +21,6 @@
+ /*Riftfront constructors and destructor*/
+ /*FUNCTION Riftfront::Riftfront(){{{*/
+ Riftfront::Riftfront(){
+-	this->inputs=NULL;
+ 	this->parameters=NULL;
+ 	this->hnodes=NULL;
+ 	this->helements=NULL;
+@@ -89,21 +88,13 @@
+ 	this->fraction=*(iomodel->Data(RiftsRiftstructEnum)+RIFTINFOSIZE*i+9);
+ 	this->state=reCast<int,IssmDouble>(*(iomodel->Data(RiftsRiftstructEnum)+RIFTINFOSIZE*i+11));
+ 
+-	//intialize inputs, and add as many inputs per element as requested: 
+-	this->inputs=new Inputs();
++	//intialize properties
++	this->type=SegmentRiftfrontEnum;
++	this->fill = reCast<int,IssmDouble>(*(iomodel->Data(RiftsRiftstructEnum)+RIFTINFOSIZE*i+7));
++	this->friction=*(iomodel->Data(RiftsRiftstructEnum)+RIFTINFOSIZE*i+8);
++	this->fractionincrement=*(iomodel->Data(RiftsRiftstructEnum)+RIFTINFOSIZE*i+10);
++	this->shelf=reCast<bool,IssmDouble>(iomodel->Data(MaskGroundediceLevelsetEnum)[node1-1]<0.);
+ 
+-	riftfront_type=SegmentRiftfrontEnum;
+-	riftfront_fill = reCast<int,IssmDouble>(*(iomodel->Data(RiftsRiftstructEnum)+RIFTINFOSIZE*i+7));
+-	riftfront_friction=*(iomodel->Data(RiftsRiftstructEnum)+RIFTINFOSIZE*i+8);
+-	riftfront_fractionincrement=*(iomodel->Data(RiftsRiftstructEnum)+RIFTINFOSIZE*i+10);
+-	riftfront_shelf=reCast<bool,IssmDouble>(iomodel->Data(MaskGroundediceLevelsetEnum)[node1-1]<0.);
+-
+-	this->inputs->AddInput(new IntInput(RiftfrontTypeEnum,riftfront_type));
+-	this->inputs->AddInput(new IntInput(FillEnum,riftfront_fill));
+-	this->inputs->AddInput(new DoubleInput(FrictionEnum,riftfront_friction));
+-	this->inputs->AddInput(new DoubleInput(FractionIncrementEnum,riftfront_fractionincrement));
+-	this->inputs->AddInput(new BoolInput(SegmentOnIceShelfEnum,riftfront_shelf));
+-
+ 	//parameters and hooked fields: we still can't point to them, they may not even exist. Configure will handle this.
+ 	this->parameters=NULL;
+ 	this->nodes= NULL;
+@@ -114,9 +105,7 @@
+ /*}}}*/
+ /*FUNCTION Riftfront::~Riftfront(){{{*/
+ Riftfront::~Riftfront(){
+-	delete inputs;
+ 	this->parameters=NULL;
+-
+ 	delete hnodes;
+ 	delete helements;
+ 	delete hmatpar;
+@@ -127,15 +116,6 @@
+ /*FUNCTION Riftfront::Echo {{{*/
+ void Riftfront::Echo(void){
+ 
+-	Input* input=NULL;
+-	int fill;
+-	IssmDouble friction,fractionincrement;
+-
+-	/*recover some inputs first: */
+-	input=(Input*)this->inputs->GetInput(FillEnum); input->GetInputValue(&fill);
+-	input=(Input*)this->inputs->GetInput(FrictionEnum); input->GetInputValue(&friction);
+-	input=(Input*)this->inputs->GetInput(FractionIncrementEnum); input->GetInputValue(&fractionincrement);
+-
+ 	_printf_("Riftfront:\n");
+ 	_printf_("   id: " << id << "\n");
+ 	_printf_("   analysis_type: " << EnumToStringx(analysis_type) << "\n");
+@@ -143,7 +123,6 @@
+ 	_printf_("   helements: " << helements << "\n");
+ 	_printf_("   hmatpar: " << hmatpar << "\n");
+ 	_printf_("   parameters: " << parameters << "\n");
+-	_printf_("   inputs: " << inputs << "\n");
+ 	_printf_("   internal parameters: \n");
+ 	_printf_("   normal: " << normal[0] << "|" << normal[1] << "\n");
+ 	_printf_("   length: " << length << "\n");
+@@ -172,8 +151,6 @@
+ 	hmatpar->DeepEcho();
+ 	_printf_("   parameters\n");
+ 	if(parameters)parameters->DeepEcho();
+-	_printf_("   inputs\n");
+-	if(inputs)inputs->DeepEcho();
+ }
+ /*}}}*/
+ /*FUNCTION Riftfront::Id {{{*/
+@@ -196,12 +173,12 @@
+ 	/*copy fields: */
+ 	riftfront->id=this->id;
+ 	riftfront->analysis_type=this->analysis_type;
+-	if(this->inputs){
+-		riftfront->inputs=(Inputs*)this->inputs->Copy();
+-	}
+-	else{
+-		riftfront->inputs=new Inputs();
+-	}
++	riftfront->type=this->type;
++	riftfront->fill=this->fill;
++	riftfront->friction=this->friction;
++	riftfront->fractionincrement=this->fractionincrement;
++	riftfront->shelf=this->shelf;
++
+ 	/*point parameters: */
+ 	riftfront->parameters=this->parameters;
+ 
+@@ -236,35 +213,17 @@
+ /*Update virtual functions definitions:*/
+ /*FUNCTION Riftfront::InputUpdateFromConstant(bool constant,int name) {{{*/
+ void  Riftfront::InputUpdateFromConstant(bool constant,int name){
+-
+-	/*Check that name is a Riftfront input*/
+-	if (!IsInput(name)) return;
+-
+-	/*update input*/
+-	this->inputs->AddInput(new BoolInput(name,constant));
+-
+ }
+ /*}}}*/
+ /*FUNCTION Riftfront::InputUpdateFromConstant(IssmDouble constant,int name) {{{*/
+ void  Riftfront::InputUpdateFromConstant(IssmDouble constant,int name){
+ 
+-	/*Check that name is a Riftfront input*/
+-	if (!IsInput(name)) return;
+-
+-	/*update input*/
+-	this->inputs->AddInput(new DoubleInput(name,constant));
+-
+ }
+ /*}}}*/
+ /*FUNCTION Riftfront::InputUpdateFromVector(IssmDouble* constant,int name) {{{*/
+ void    Riftfront::InputUpdateFromVector(IssmDouble* vector, int name, int type){
+ 
+-	/*Check that name is a Riftfront input*/
+-	if (!IsInput(name)) return;
+-
+-	/*update input*/
+ 	_error_("not implemented yet");
+-	//this->inputs->AddInput(new DoubleInput(name,constant));
+ 
+ }
+ /*}}}*/
+@@ -457,7 +416,6 @@
+ 	IssmDouble  thickness;
+ 	IssmDouble  h[2];
+ 	IssmDouble  penalty_offset;
+-	IssmDouble  friction;
+ 
+ 	/*Objects: */
+ 	Tria       *tria1               = NULL;
+@@ -474,7 +432,6 @@
+ 
+ 	/*Get some parameters: */
+ 	this->parameters->FindParam(&penalty_offset,StressbalancePenaltyFactorEnum);
+-	this->inputs->GetInputValue(&friction,FrictionEnum);
+ 	tria1->GetInputValue(&h[0],nodes[0],ThicknessEnum);
+ 	tria2->GetInputValue(&h[1],nodes[1],ThicknessEnum);
+ 	if (h[0]!=h[1])_error_("different thicknesses not supported for rift fronts");
+@@ -546,8 +503,6 @@
+ 	IssmDouble pressure_air;
+ 	IssmDouble pressure_melange;
+ 	IssmDouble pressure_water;
+-	int        fill;
+-	bool       shelf;
+ 
+ 	/*Objects: */
+ 	Tria *tria1 = NULL;
+@@ -563,8 +518,6 @@
+ 	ElementVector* pe=new ElementVector(nodes,NUMVERTICES,this->parameters);
+ 
+ 	/*Get some inputs: */
+-	this->inputs->GetInputValue(&fill,FillEnum);
+-	this->inputs->GetInputValue(&shelf,SegmentOnIceShelfEnum);
+ 	rho_ice=matpar->GetRhoIce();
+ 	rho_water=matpar->GetRhoWater();
+ 	gravity=matpar->GetG();
+@@ -641,7 +594,6 @@
+ 	IssmDouble  vy1;
+ 	IssmDouble  vx2;
+ 	IssmDouble  vy2;
+-	IssmDouble  fractionincrement;
+ 
+ 	/*Objects: */
+ 	Tria  *tria1 = NULL;
+@@ -671,9 +623,6 @@
+ 		return 1;
+ 	}
+ 
+-	/*recover parameters: */
+-	this->inputs->GetInputValue(&fractionincrement,FractionIncrementEnum);
+-
+ 	/*First recover velocity: */
+ 	tria1->GetInputValue(&vx1,nodes[0],VxEnum);
+ 	tria2->GetInputValue(&vx2,nodes[1],VxEnum);
+@@ -733,16 +682,3 @@
+ 	else return 0;
+ }
+ /*}}}*/
+-/*FUNCTION Riftfront::IsInput{{{*/
+-bool Riftfront::IsInput(int name){
+-	if (
+-				name==ConvergedEnum ||
+-				name==ThicknessEnum ||
+-				name==SurfaceEnum ||
+-				name==BedEnum 
+-		){
+-		return true;
+-	}
+-	else return false;
+-}
+-/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17269-17270.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17269-17270.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17269-17270.diff	(revision 17802)
@@ -0,0 +1,53 @@
+Index: ../trunk-jpl/src/c/cores/transient_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17269)
++++ ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17270)
+@@ -122,24 +122,6 @@
+ 			stressbalance_core(femmodel);
+ 		}
+ 		
+-		if(isgroundingline){
+-			if(VerboseSolution()) _printf0_("   computing new grounding line position\n");
+-			GroundinglineMigrationx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
+-			if(save_results){
+-				int outputs[3] = {SurfaceEnum,BedEnum,MaskGroundediceLevelsetEnum};
+-				femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],3);
+-			}
+-		}
+-		if(isgia){
+-			if(VerboseSolution()) _printf0_("   computing glacial isostatic adjustment\n");
+-			#ifdef _HAVE_GIA_
+-			gia_core(femmodel);
+-			#else
+-			_error_("ISSM was not compiled with gia capabilities. Exiting");
+-			#endif
+-
+-		}
+-
+ 		if(islevelset){
+ 			if(VerboseSolution()) _printf0_("   computing movement of ice boundaries\n");
+ 
+@@ -172,6 +154,23 @@
+ 			if(VerboseSolution()) _printf0_("   updating vertices positions\n");
+ 			femmodel->UpdateVertexPositionsx();
+ 		}
++		
++		if(isgroundingline){
++			if(VerboseSolution()) _printf0_("   computing new grounding line position\n");
++			GroundinglineMigrationx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
++			if(save_results){
++				int outputs[3] = {SurfaceEnum,BedEnum,MaskGroundediceLevelsetEnum};
++				femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],3);
++			}
++		}
++		if(isgia){
++			if(VerboseSolution()) _printf0_("   computing glacial isostatic adjustment\n");
++			#ifdef _HAVE_GIA_
++			gia_core(femmodel);
++			#else
++			_error_("ISSM was not compiled with gia capabilities. Exiting");
++			#endif
++		}
+ 
+ 		/*unload results*/
+ 		if(VerboseSolution()) _printf0_("   computing requested outputs\n");
Index: issm/oecreview/Archive/16554-17801/ISSM-17270-17271.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17270-17271.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17270-17271.diff	(revision 17802)
@@ -0,0 +1,25 @@
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17270)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17271)
+@@ -248,7 +248,6 @@
+ 				if(eplconverged && transfered){
+ 					if(VerboseSolution()) _printf0_("eplconverged...\n");
+ 					InputUpdateFromConstantx(femmodel,eplconverged,ConvergedEnum);
+-					InputUpdateFromConstantx(femmodel,sediment_kmax,MeltingOffsetEnum);
+ 					InputUpdateFromSolutionx(femmodel,ug_epl);
+ 					break;
+ 				}
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_thermal_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_thermal_nonlinear.cpp	(revision 17270)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_thermal_nonlinear.cpp	(revision 17271)
+@@ -73,7 +73,7 @@
+ 	}
+ 
+ 	InputUpdateFromSolutionx(femmodel,tg);
+-	InputUpdateFromConstantx(femmodel,melting_offset,MeltingOffsetEnum);
++	femmodel->parameters->SetParam(melting_offset,MeltingOffsetEnum);
+ 
+ 	/*Free ressources: */
+ 	delete tg;
Index: issm/oecreview/Archive/16554-17801/ISSM-17271-17272.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17271-17272.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17271-17272.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/externalpackages/adolc/install-withampi.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/adolc/install-withampi.sh	(revision 17271)
++++ ../trunk-jpl/externalpackages/adolc/install-withampi.sh	(revision 17272)
+@@ -1,6 +1,6 @@
+ #!/bin/bash
+ set -eu
+-
++ 
+ #Some cleanup
+ rm -rf install src
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17272-17273.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17272-17273.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17272-17273.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/externalpackages/adjoinablempi/install.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/adjoinablempi/install.sh	(revision 17272)
++++ ../trunk-jpl/externalpackages/adjoinablempi/install.sh	(revision 17273)
+@@ -1,6 +1,6 @@
+ #!/bin/bash
+ set -eu
+-
++ 
+ #Some cleanup
+ rm -rf src  install
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17273-17274.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17273-17274.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17273-17274.diff	(revision 17802)
@@ -0,0 +1,292 @@
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 17273)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 17274)
+@@ -168,6 +168,8 @@
+ 		case SurfaceSlopeYEnum: input2 = basalelement->GetInput(SurfaceEnum); _assert_(input2); break;
+ 		case BedSlopeXEnum:     input2 = basalelement->GetInput(BedEnum);     _assert_(input2); break;
+ 		case BedSlopeYEnum:     input2 = basalelement->GetInput(BedEnum);     _assert_(input2); break;
++		case LevelsetfunctionSlopeXEnum: input2 = basalelement->GetInput(MaskIceLevelsetEnum);     _assert_(input2); break;
++		case LevelsetfunctionSlopeYEnum: input2 = basalelement->GetInput(MaskIceLevelsetEnum);     _assert_(input2); break;
+ 		default: input = element->GetInput(input_enum);
+ 	}
+ 
+@@ -181,8 +183,8 @@
+ 
+ 		if(input2) input2->GetInputDerivativeValue(&slopes[0],xyz_list,gauss);
+ 		switch(input_enum){
+-			case SurfaceSlopeXEnum: case BedSlopeXEnum: value = slopes[0]; break;
+-			case SurfaceSlopeYEnum: case BedSlopeYEnum: value = slopes[1]; break;
++			case SurfaceSlopeXEnum: case BedSlopeXEnum: case LevelsetfunctionSlopeXEnum: value = slopes[0]; break;
++			case SurfaceSlopeYEnum: case BedSlopeYEnum: case LevelsetfunctionSlopeYEnum: value = slopes[1]; break;
+ 			default: input->GetInputValue(&value,gauss);
+ 		}
+ 
+Index: ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17273)
++++ ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17274)
+@@ -73,8 +73,8 @@
+ 	const int dim = 2;
+ 	int        i,row,col,stabilization;
+ 	IssmDouble Jdet,D_scalar,h;
+-	IssmDouble dlevelset[dim],normal[dim];
+-	IssmDouble norm_dlevelset;
++	IssmDouble dlsf[dim],normal[dim];
++	IssmDouble norm_dlsf;
+ 	IssmDouble hx,hy,hz,kappa;
+ 	IssmDouble* xyz_list = NULL;
+ 
+@@ -88,7 +88,8 @@
+ 	IssmDouble     D[dim][dim];
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	Input* levelset_input=element->GetInput(MaskIceLevelsetEnum); _assert_(levelset_input);
++	Input* lsf_slopex_input=element->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
++	Input* lsf_slopey_input=element->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+ 	element->GetVerticesCoordinates(&xyz_list);
+ 	h = element->CharacteristicLength();
+ 
+@@ -101,13 +102,15 @@
+ 		GetB(B,element,xyz_list,gauss);
+ 		GetBprime(Bprime,element,xyz_list,gauss);
+ 
+-		/* Get normal on node */
+-		levelset_input->GetInputDerivativeValue(&dlevelset[0],xyz_list,gauss);
+-		norm_dlevelset=0.;
+-		for(i=0;i<dim;i++) norm_dlevelset+=dlevelset[i]*dlevelset[i]; 
+-		norm_dlevelset=sqrt(norm_dlevelset)+1.e-14;
+-		for(i=0;i<dim;i++) normal[i]=dlevelset[i]/norm_dlevelset;
+-
++		/* Get normal on ice boundary */
++		lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
++		lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
++		norm_dlsf=0.;
++		for(i=0;i<dim;i++) norm_dlsf+=dlsf[i]*dlsf[i]; 
++		norm_dlsf=sqrt(norm_dlsf); _assert_(norm_dlsf>0.);
++		for(i=0;i<dim;i++)
++			normal[i]=dlsf[i]/norm_dlsf;
++		
+ 		D_scalar=gauss->weight*Jdet;
+ 
+ 		for(row=0;row<dim;row++)
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17273)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17274)
+@@ -678,6 +678,8 @@
+ 	TransientIslevelsetEnum,
+ 	ExtrapolationVariableEnum,
+ 	IceMaskNodeActivationEnum,
++	LevelsetfunctionSlopeXEnum,
++	LevelsetfunctionSlopeYEnum,
+ 	/*}}}*/
+ 	MaximumNumberOfDefinitionsEnum
+ };
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17273)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17274)
+@@ -637,6 +637,8 @@
+ 		case TransientIslevelsetEnum : return "TransientIslevelset";
+ 		case ExtrapolationVariableEnum : return "ExtrapolationVariable";
+ 		case IceMaskNodeActivationEnum : return "IceMaskNodeActivation";
++		case LevelsetfunctionSlopeXEnum : return "LevelsetfunctionSlopeX";
++		case LevelsetfunctionSlopeYEnum : return "LevelsetfunctionSlopeY";
+ 		case MaximumNumberOfDefinitionsEnum : return "MaximumNumberOfDefinitions";
+ 		default : return "unknown";
+ 
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17273)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17274)
+@@ -652,6 +652,8 @@
+ 	      else if (strcmp(name,"TransientIslevelset")==0) return TransientIslevelsetEnum;
+ 	      else if (strcmp(name,"ExtrapolationVariable")==0) return ExtrapolationVariableEnum;
+ 	      else if (strcmp(name,"IceMaskNodeActivation")==0) return IceMaskNodeActivationEnum;
++	      else if (strcmp(name,"LevelsetfunctionSlopeX")==0) return LevelsetfunctionSlopeXEnum;
++	      else if (strcmp(name,"LevelsetfunctionSlopeY")==0) return LevelsetfunctionSlopeYEnum;
+ 	      else if (strcmp(name,"MaximumNumberOfDefinitions")==0) return MaximumNumberOfDefinitionsEnum;
+          else stage=7;
+    }
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17273)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17274)
+@@ -420,6 +420,7 @@
+ 					./cores/bedslope_core.cpp\
+ 					./cores/meshdeformation_core.cpp\
+ 					./cores/damage_core.cpp\
++					./cores/levelsetfunctionslope_core.cpp\
+ 					./analyses/DamageEvolutionAnalysis.cpp\
+ 					./solutionsequences/solutionsequence_damage_nonlinear.cpp\
+ 					./modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp\
+Index: ../trunk-jpl/src/c/cores/transient_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17273)
++++ ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17274)
+@@ -124,8 +124,11 @@
+ 		
+ 		if(islevelset){
+ 			if(VerboseSolution()) _printf0_("   computing movement of ice boundaries\n");
++			
++			/* get slope of lsf for computation of normal on ice domain*/
++			levelsetfunctionslope_core(femmodel);
+ 
+-			/* extrapolate required variables */
++			/* extrapolate along normal */
+ 			Analysis* extanalysis = new ExtrapolationAnalysis();
+ 			const int nvars=2;
+ 			int vars[nvars] = {VxEnum, VyEnum};
+Index: ../trunk-jpl/src/c/cores/levelsetfunctionslope_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/levelsetfunctionslope_core.cpp	(revision 0)
++++ ../trunk-jpl/src/c/cores/levelsetfunctionslope_core.cpp	(revision 17274)
+@@ -0,0 +1,52 @@
++/*!\file: levelsetfunctionslope_core.cpp
++ * \brief: core of the slope solution 
++ */ 
++
++#include "./cores.h"
++#include "../toolkits/toolkits.h"
++#include "../classes/classes.h"
++#include "../shared/shared.h"
++#include "../solutionsequences/solutionsequences.h"
++#include "../modules/modules.h"
++
++void levelsetfunctionslope_core(FemModel* femmodel){
++
++	/*parameters: */
++	bool save_results;
++	int  meshtype;
++
++	/*Recover some parameters: */
++	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
++	femmodel->parameters->FindParam(&meshtype,MeshTypeEnum);
++
++	if(VerboseSolution()) _printf0_("computing slope of levelset function...\n");
++
++	/*Call on core computations: */
++	femmodel->SetCurrentConfiguration(L2ProjectionBaseAnalysisEnum);
++
++	femmodel->parameters->SetParam(LevelsetfunctionSlopeXEnum,InputToL2ProjectEnum);
++	solutionsequence_linear(femmodel);
++
++	if(meshtype!=Mesh2DverticalEnum){
++		femmodel->parameters->SetParam(LevelsetfunctionSlopeYEnum,InputToL2ProjectEnum);
++		solutionsequence_linear(femmodel);
++	}
++	if(meshtype==Mesh2DverticalEnum){
++	      femmodel->parameters->SetParam(LevelsetfunctionSlopeXEnum,InputToExtrudeEnum);
++		extrudefrombase_core(femmodel);
++	}
++
++	if(save_results){
++		if(VerboseSolution()) _printf0_("saving results:\n");
++		if(meshtype!=Mesh2DverticalEnum){
++			int outputs[2] = {LevelsetfunctionSlopeXEnum,LevelsetfunctionSlopeYEnum};
++			femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],2);
++
++		}
++		else{
++			int outputs = LevelsetfunctionSlopeXEnum;
++			femmodel->RequestedOutputsx(&femmodel->results,&outputs,1);
++		}
++	}
++
++}
+Index: ../trunk-jpl/src/c/cores/cores.h
+===================================================================
+--- ../trunk-jpl/src/c/cores/cores.h	(revision 17273)
++++ ../trunk-jpl/src/c/cores/cores.h	(revision 17274)
+@@ -23,6 +23,7 @@
+ void hydrology_core(FemModel* femmodel);
+ void thermal_core(FemModel* femmodel);
+ void surfaceslope_core(FemModel* femmodel);
++void levelsetfunctionslope_core(FemModel* femmodel);
+ void bedslope_core(FemModel* femmodel);
+ void meshdeformation_core(FemModel* femmodel);
+ void control_core(FemModel* femmodel);
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17273)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17274)
+@@ -909,13 +909,6 @@
+ 		}
+ 	}
+ 
+-	if(nrfrontnodes!=2){
+-		_printf0_("in elt nr: " << this->Id() << "\n");
+-		_printf0_("nrfrontnodes: " << nrfrontnodes << "\n");
+-		for(i=0;i<NUMVERTICES;i++){
+-			_printf_("levelsetfunction[" << i << "]=" << levelset[i] << "; indicesfront: " << indicesfront[i] << ";\n");
+-		}
+-	}
+ 	_assert_(nrfrontnodes==2);
+ 
+ 	/* arrange order of frontnodes such that they are oriented counterclockwise */
+@@ -1621,6 +1614,8 @@
+ 				name==MaskGroundediceLevelsetEnum ||
+ 				name==MaskIceLevelsetEnum ||
+ 				name==IceMaskNodeActivationEnum ||
++				name==LevelsetfunctionSlopeXEnum ||
++				name==LevelsetfunctionSlopeYEnum ||
+ 				name==SurfaceSlopeXEnum ||
+ 				name==SurfaceSlopeYEnum ||
+ 				name==BasalforcingsMeltingRateEnum ||
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17273)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17274)
+@@ -1976,6 +1976,8 @@
+ 				name==MaskGroundediceLevelsetEnum ||
+ 				name==MaskIceLevelsetEnum ||
+ 				name==IceMaskNodeActivationEnum ||
++				name==LevelsetfunctionSlopeXEnum ||
++				name==LevelsetfunctionSlopeYEnum ||
+ 				name==GradientEnum ||
+ 				name==OldGradientEnum  ||
+ 				name==ConvergedEnum || 
+Index: ../trunk-jpl/src/m/enum/LevelsetfunctionSlopeXEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/LevelsetfunctionSlopeXEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/LevelsetfunctionSlopeXEnum.m	(revision 17274)
+@@ -0,0 +1,11 @@
++function macro=LevelsetfunctionSlopeXEnum()
++%LEVELSETFUNCTIONSLOPEXENUM - Enum of LevelsetfunctionSlopeX
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=LevelsetfunctionSlopeXEnum()
++
++macro=StringToEnum('LevelsetfunctionSlopeX');
+Index: ../trunk-jpl/src/m/enum/LevelsetfunctionSlopeYEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/LevelsetfunctionSlopeYEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/LevelsetfunctionSlopeYEnum.m	(revision 17274)
+@@ -0,0 +1,11 @@
++function macro=LevelsetfunctionSlopeYEnum()
++%LEVELSETFUNCTIONSLOPEYENUM - Enum of LevelsetfunctionSlopeY
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=LevelsetfunctionSlopeYEnum()
++
++macro=StringToEnum('LevelsetfunctionSlopeY');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17273)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17274)
+@@ -629,4 +629,6 @@
+ def TransientIslevelsetEnum(): return StringToEnum("TransientIslevelset")[0]
+ def ExtrapolationVariableEnum(): return StringToEnum("ExtrapolationVariable")[0]
+ def IceMaskNodeActivationEnum(): return StringToEnum("IceMaskNodeActivation")[0]
++def LevelsetfunctionSlopeXEnum(): return StringToEnum("LevelsetfunctionSlopeX")[0]
++def LevelsetfunctionSlopeYEnum(): return StringToEnum("LevelsetfunctionSlopeY")[0]
+ def MaximumNumberOfDefinitionsEnum(): return StringToEnum("MaximumNumberOfDefinitions")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17274-17275.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17274-17275.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17274-17275.diff	(revision 17802)
@@ -0,0 +1,1971 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17274)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17275)
+@@ -1043,7 +1043,7 @@
+ }/*}}}*/
+ void StressbalanceAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+ 	/*Default, do nothing*/
+-	_printf0_("   Updating active and non-active nodes for StressbalanceAnalysis \n");
++	//_printf0_("   Updating active and non-active nodes for StressbalanceAnalysis \n");
+ //	SetActiveNodesLSMx(femmodel->elements);
+ 	return;
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17274)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17275)
+@@ -658,12 +658,12 @@
+ 				break;
+ 			case PatersonEnum:
+ 				for(i=0;i<numnodes;i++) B[i]=Paterson(values[i]);
+-				element->AddMaterialInput(MaterialsRheologyBEnum,&B[0],P1Enum);
++				element->AddInput(MaterialsRheologyBEnum,&B[0],P1Enum);
+ 				break;
+ 			case ArrheniusEnum:{
+ 				element->GetVerticesCoordinates(&xyz_list);
+ 				for(i=0;i<numnodes;i++) B[i]=Arrhenius(values[i],surface[i]-xyz_list[i*3+2],element->GetMaterialParameter(MaterialsRheologyNEnum));
+-				element->AddMaterialInput(MaterialsRheologyBEnum,&B[0],P1Enum);
++				element->AddInput(MaterialsRheologyBEnum,&B[0],P1Enum);
+ 				break;
+ 				}
+ 			default:
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17274)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17275)
+@@ -269,8 +269,8 @@
+ 	element->GetVerticesCoordinates(&xyz_list);
+ 	element->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	this->CreateDamageFInput(element);
+-	Input* damaged_input = element->GetMaterialInput(DamageDbarEnum); _assert_(damaged_input);
+-	Input* damagef_input = element->GetMaterialInput(DamageFEnum);    _assert_(damagef_input);
++	Input* damaged_input = element->GetInput(DamageDbarEnum); _assert_(damaged_input);
++	Input* damagef_input = element->GetInput(DamageFEnum);    _assert_(damagef_input);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	Gauss* gauss=element->NewGauss(2);
+@@ -377,7 +377,7 @@
+ 	}
+ 
+ 	/*Get all inputs and parameters*/
+-	element->AddMaterialInput(DamageDbarEnum,values,P1Enum);
++	element->AddInput(DamageDbarEnum,values,P1Enum);
+ 
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(values);
+@@ -415,7 +415,7 @@
+ 	Input* sigma_xx_input  = element->GetInput(StressTensorxxEnum);     _assert_(sigma_xx_input);
+ 	Input* sigma_xy_input  = element->GetInput(StressTensorxyEnum);     _assert_(sigma_xy_input);
+ 	Input* sigma_yy_input  = element->GetInput(StressTensoryyEnum);     _assert_(sigma_yy_input);
+-	Input* damage_input    = element->GetMaterialInput(DamageDbarEnum); _assert_(damage_input);
++	Input* damage_input    = element->GetInput(DamageDbarEnum); _assert_(damage_input);
+ 
+ 	/*Damage evolution z mapping: */
+ 	Gauss* gauss=element->NewGauss();
+@@ -441,7 +441,7 @@
+ 	}
+ 
+ 	/*Add input*/
+-	element->AddMaterialInput(DamageFEnum,f,P1Enum);
++	element->AddInput(DamageFEnum,f,P1Enum);
+ 	
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(f);
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17274)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17275)
+@@ -789,16 +789,16 @@
+ 				break;
+ 			case PatersonEnum:
+ 				for(i=0;i<numnodes;i++) B[i]=Paterson(temperature[i]);
+-				element->AddMaterialInput(MaterialsRheologyBEnum,&B[0],P1Enum);
++				element->AddInput(MaterialsRheologyBEnum,&B[0],P1Enum);
+ 				break;
+ 			case ArrheniusEnum:
+ 				element->GetVerticesCoordinates(&xyz_list);
+ 				for(i=0;i<numnodes;i++) B[i]=Arrhenius(temperature[i],surface[i]-xyz_list[i*3+2],element->GetMaterialParameter(MaterialsRheologyNEnum));
+-				element->AddMaterialInput(MaterialsRheologyBEnum,&B[0],P1Enum);
++				element->AddInput(MaterialsRheologyBEnum,&B[0],P1Enum);
+ 				break;
+ 			case LliboutryDuvalEnum:
+ 				for(i=0;i<numnodes;i++) B[i]=LliboutryDuval(values[i],pressure[i],element->GetMaterialParameter(MaterialsRheologyNEnum),element->GetMaterialParameter(MaterialsBetaEnum),element->GetMaterialParameter(ConstantsReferencetemperatureEnum),element->GetMaterialParameter(MaterialsHeatcapacityEnum),element->GetMaterialParameter(MaterialsLatentheatEnum)); 
+-				element->AddMaterialInput(MaterialsRheologyBEnum,&B[0],P1Enum); 
++				element->AddInput(MaterialsRheologyBEnum,&B[0],P1Enum); 
+ 				break; 
+ 			default: _error_("Rheology law " << EnumToStringx(rheology_law) << " not supported yet");
+ 		}
+Index: ../trunk-jpl/src/c/modules/InputDuplicatex/InputDuplicatex.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/InputDuplicatex/InputDuplicatex.cpp	(revision 17274)
++++ ../trunk-jpl/src/c/modules/InputDuplicatex/InputDuplicatex.cpp	(revision 17275)
+@@ -13,9 +13,4 @@
+ 		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+ 		element->InputDuplicate(original_enum,new_enum);
+ 	}
+-	for(int i=0;i<femmodel->materials->Size();i++){
+-		Material* material=(Material*)femmodel->materials->GetObjectByOffset(i);
+-		material->InputDuplicate(original_enum,new_enum);
+-	}
+-
+ }
+Index: ../trunk-jpl/src/c/modules/GetVectorFromInputsx/GetVectorFromInputsx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/GetVectorFromInputsx/GetVectorFromInputsx.cpp	(revision 17274)
++++ ../trunk-jpl/src/c/modules/GetVectorFromInputsx/GetVectorFromInputsx.cpp	(revision 17275)
+@@ -21,12 +21,6 @@
+ 			Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+ 			element->GetVectorFromInputs(vector,name);
+ 		}
+-
+-		/*Look up in materials*/
+-		for(i=0;i<femmodel->materials->Size();i++){
+-			Material* material=(Material*)femmodel->materials->GetObjectByOffset(i);
+-			material->GetVectorFromInputs(vector,name);
+-		}
+ 	}
+ 	else{
+ 		_error_("vector type: " << EnumToStringx(type) << " not supported yet!");
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp	(revision 17274)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp	(revision 17275)
+@@ -44,15 +44,12 @@
+ 		}
+ 	}
+ 
+-	/*Update elements and materials: */
++	/*Update elements: */
+ 	counter=0;
+ 	for (i=0;i<iomodel->numberofelements;i++){
+ 		if(iomodel->my_elements[i]){
+ 			element=(Element*)elements->GetObjectByOffset(counter);
+ 			element->InputUpdateFromIoModel(i,iomodel); //we need i to index into elements.
+-
+-			material=(Material*)materials->GetObjectByOffset(counter);
+-			material->InputUpdateFromIoModel(i,iomodel); //we need i to index into elements.
+ 			counter++;
+ 		}
+ 	}
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp	(revision 17274)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp	(revision 17275)
+@@ -27,7 +27,6 @@
+ 	if(control_analysis)iomodel->FetchData(3,InversionControlParametersEnum,InversionMinParametersEnum,InversionMaxParametersEnum);
+ 	switch(iomodel->meshtype){
+ 		case Mesh2DhorizontalEnum:
+-			materials->InputDuplicate(MaterialsRheologyBbarEnum,QmuMaterialsRheologyBEnum);
+ 			for(i=0;i<iomodel->numberofelements;i++){
+ 				if(iomodel->my_elements[i]) elements->AddObject(new Tria(i+1,i,i,iomodel,nummodels));
+ 			}
+@@ -50,19 +49,21 @@
+ 	/*Create materials*/
+ 	switch(materials_type){
+ 		case MaticeEnum:
+-			iomodel->FetchData(3,MaterialsRheologyBEnum,MaterialsRheologyNEnum,DamageDEnum);
++			iomodel->FetchDataToInput(elements,MaterialsRheologyBEnum);
++			iomodel->FetchDataToInput(elements,MaterialsRheologyNEnum);
++			iomodel->FetchDataToInput(elements,DamageDEnum);
+ 			for (i=0;i<iomodel->numberofelements;i++) if(iomodel->my_elements[i]) materials->AddObject(new Matice(i+1,i,iomodel));
+-			if(dakota_analysis){
+-				switch(iomodel->meshtype){
+-					case Mesh2DhorizontalEnum:
+-						materials->InputDuplicate(MaterialsRheologyBbarEnum,QmuMaterialsRheologyBEnum);
+-						break;
+-					case Mesh3DEnum:
+-						materials->InputDuplicate(MaterialsRheologyBEnum,QmuMaterialsRheologyBEnum); 
+-						break;
+-					default:
+-						_error_("Mesh not supported yet");
+-				}
++			switch(iomodel->meshtype){
++				case Mesh2DhorizontalEnum:
++					elements->InputDuplicate(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum);
++					elements->InputDuplicate(DamageDEnum,DamageDbarEnum);
++					if(dakota_analysis) elements->InputDuplicate(MaterialsRheologyBbarEnum,QmuMaterialsRheologyBEnum);
++					break;
++				case Mesh3DEnum:
++					if(dakota_analysis) elements->InputDuplicate(MaterialsRheologyBEnum,QmuMaterialsRheologyBEnum); 
++					break;
++				default:
++					_error_("Mesh not supported yet");
+ 			}
+ 			break;
+ 		default:
+Index: ../trunk-jpl/src/c/classes/Materials/Materials.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Materials.cpp	(revision 17274)
++++ ../trunk-jpl/src/c/classes/Materials/Materials.cpp	(revision 17275)
+@@ -46,11 +46,3 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Materials::InputDuplicate{{{*/
+-void Materials::InputDuplicate(int input_enum,int output_enum){
+-
+-	for(int i=0;i<this->Size();i++){
+-		Material* material=(Material*)this->GetObjectByOffset(i);
+-		material->InputDuplicate(input_enum,output_enum);
+-	}
+-}
+Index: ../trunk-jpl/src/c/classes/Materials/Matice.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 17274)
++++ ../trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 17275)
+@@ -28,8 +28,8 @@
+ /*Matice constructors and destructor*/
+ /*FUNCTION Matice::Matice(){{{*/
+ Matice::Matice(){
+-	this->inputs=NULL;
+ 	this->helement=NULL;
++	this->element=NULL;
+ 	return;
+ }
+ /*}}}*/
+@@ -42,15 +42,10 @@
+ 	/*Initialize id*/
+ 	this->mid=matice_mid;
+ 
+-	/*Initialize inputs*/
+-	this->inputs=new Inputs();
+-
+-	/*Initialize inputs from IoModel*/
+-	this->InputUpdateFromIoModel(index,iomodel);
+-
+ 	/*Hooks: */
+ 	matice_eid=index+1;
+ 	this->helement=new Hook(&matice_eid,1);
++	this->element=NULL;
+ 
+ 	return;
+ 
+@@ -59,7 +54,6 @@
+ /*FUNCTION Matice::~Matice(){{{*/
+ Matice::~Matice(){
+ 	delete helement;
+-	delete inputs;
+ 	return;
+ }
+ /*}}}*/
+@@ -70,8 +64,6 @@
+ 
+ 	_printf_("Matice:\n");
+ 	_printf_("   mid: " << mid << "\n");
+-	_printf_("   inputs:\n");
+-	inputs->Echo();
+ 	_printf_("   element:\n");
+ 	helement->Echo();
+ }
+@@ -81,8 +73,6 @@
+ 
+ 	_printf_("Matice:\n");
+ 	_printf_("   mid: " << mid << "\n");
+-	_printf_("   inputs:\n");
+-	inputs->DeepEcho();
+ 	_printf_("   element:\n");
+ 	helement->Echo();
+ }		
+@@ -97,7 +87,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Matice::copy {{{*/
++/*FUNCTION Matice::copy() {{{*/
+ Object* Matice::copy() {
+ 
+ 	/*Output*/
+@@ -109,13 +99,29 @@
+ 	/*copy fields: */
+ 	matice->mid=this->mid;
+ 	matice->helement=(Hook*)this->helement->copy();
+-	if(this->inputs) matice->inputs=(Inputs*)this->inputs->Copy();
+-	else  matice->inputs=new Inputs();
++	matice->element =(Element*)this->helement->delivers();
+ 
+ 	return matice;
+ }
+ /*}}}*/
++/*FUNCTION Matice::copy(Element* element) {{{*/
++Material* Matice::copy(Element* element_in) {
+ 
++	/*Output*/
++	Matice* matice=NULL;
++
++	/*Initialize output*/
++	matice=new Matice();
++
++	/*copy fields: */
++	matice->mid=this->mid;
++	matice->helement=(Hook*)this->helement->copy();
++	matice->element =element_in;
++
++	return matice;
++}
++/*}}}*/
++
+ /*Matice management*/
+ /*FUNCTION Matice::Configure {{{*/
+ void  Matice::Configure(Elements* elementsin){
+@@ -123,6 +129,7 @@
+ 	/*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 
+ 	 * datasets, using internal ids and offsets hidden in hooks: */
+ 	helement->configure((DataSet*)elementsin);
++	this->element  = (Element*)helement->delivers();
+ }
+ /*}}}*/
+ /*FUNCTION Matice::SetCurrentConfiguration {{{*/
+@@ -138,7 +145,7 @@
+ 
+ 	IssmDouble B,n;
+ 
+-	inputs->GetInputAverage(&B,MaterialsRheologyBEnum);
++	element->inputs->GetInputAverage(&B,MaterialsRheologyBEnum);
+ 	n=this->GetN();
+ 
+ 	return pow(B,-n);
+@@ -152,7 +159,7 @@
+ 
+ 	IssmDouble B,n;
+ 
+-	inputs->GetInputAverage(&B,MaterialsRheologyBbarEnum);
++	element->inputs->GetInputAverage(&B,MaterialsRheologyBbarEnum);
+ 	n=this->GetN();
+ 
+ 	return pow(B,-n);
+@@ -164,7 +171,7 @@
+ 	/*Output*/
+ 	IssmDouble B;
+ 
+-	inputs->GetInputAverage(&B,MaterialsRheologyBEnum);
++	element->inputs->GetInputAverage(&B,MaterialsRheologyBEnum);
+ 	return B;
+ }
+ /*}}}*/
+@@ -174,7 +181,7 @@
+ 	/*Output*/
+ 	IssmDouble Bbar;
+ 
+-	inputs->GetInputAverage(&Bbar,MaterialsRheologyBbarEnum);
++	element->inputs->GetInputAverage(&Bbar,MaterialsRheologyBbarEnum);
+ 	return Bbar;
+ }
+ /*}}}*/
+@@ -184,7 +191,7 @@
+ 	/*Output*/
+ 	IssmDouble n;
+ 
+-	inputs->GetInputAverage(&n,MaterialsRheologyNEnum);
++	element->inputs->GetInputAverage(&n,MaterialsRheologyNEnum);
+ 	return n;
+ }
+ /*}}}*/
+@@ -194,7 +201,7 @@
+ 	/*Output*/
+ 	IssmDouble D;
+ 
+-	inputs->GetInputAverage(&D,DamageDEnum);
++	element->inputs->GetInputAverage(&D,DamageDEnum);
+ 	return D;
+ }
+ /*}}}*/
+@@ -203,42 +210,10 @@
+ 
+ 	/*Output*/
+ 	IssmDouble Dbar;
+-	inputs->GetInputAverage(&Dbar,DamageDbarEnum);
++	element->inputs->GetInputAverage(&Dbar,DamageDbarEnum);
+ 	return Dbar;
+ }
+ /*}}}*/
+-/*FUNCTION Matice::GetVectorFromInputs{{{*/
+-void  Matice::GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum){
+-
+-	/*Intermediaries*/
+-	Element *element= NULL;
+-
+-	/*Recover element*/
+-	element=(Element*)helement->delivers();
+-
+-	/*Check that input_enum is a material input*/
+-	if (!IsInput(input_enum)) return;
+-
+-	switch(element->ObjectEnum()){
+-
+-		case TriaEnum:{
+-
+-							  /*Prepare index list*/
+-							  int vertexpidlist[3];
+-							  ((Tria*)element)->GetVertexPidList(&vertexpidlist[0]);
+-
+-								 /*Get input (either in element or material)*/
+-								 Input* input=inputs->GetInput(input_enum);
+-							  if(!input) _error_("Input " << EnumToStringx(input_enum) << " not found in material");
+-
+-							  /*We found the enum.  Use its values to fill into the vector, using the vertices ids: */
+-							  input->GetVectorFromInputs(vector,&vertexpidlist[0]);}
+-						break;
+-
+-		default: _error_("element " << EnumToStringx(element->ObjectEnum()) << " not implemented yet");
+-	}
+-}
+-/*}}}*/
+ /*FUNCTION Matice::GetViscosity {{{*/
+ void  Matice::GetViscosity(IssmDouble* pviscosity,IssmDouble eps_eff){
+ 	/*From a string tensor and a material object, return viscosity, using Glen's flow law.
+@@ -545,103 +520,14 @@
+ 	*pmu_prime=mu_prime;
+ }
+ /*}}}*/
+-/*FUNCTION Matice::InputDuplicate{{{*/
+-void  Matice::InputDuplicate(int original_enum,int new_enum){
+-
+-	/*Call inputs method*/
+-	if (IsInput(original_enum)) inputs->DuplicateInput(original_enum,new_enum);
+-
+-}
+-/*}}}*/
+ /*FUNCTION Matice::InputUpdateFromVector(IssmDouble* vector, int name, int type) {{{*/
+ void  Matice::InputUpdateFromVector(IssmDouble* vector, int name, int type){
+ 
+-	/*Intermediaries*/
+-	Element *element      = NULL;
+-
+-	/*Recover element*/
+-	element=(Element*)helement->delivers();
+-
+-	/*Check that name is an element input*/
+-	if (!IsInput(name)) return;
+-
+-	switch(type){
+-
+-		case VertexEnum:
+-
+-			switch(element->ObjectEnum()){
+-
+-				case TriaEnum: {
+-					IssmDouble values[3];
+-					for (int i=0;i<3;i++) values[i]=vector[((Tria*)element)->vertices[i]->Pid()];
+-					this->inputs->AddInput(new TriaInput(name,values,P1Enum));
+-					return;
+-				}
+-				case PentaEnum: {
+-					IssmDouble valuesp[6];
+-					for (int i=0;i<6;i++) valuesp[i]=vector[((Penta*)element)->vertices[i]->Sid()]; //use sid list, to index into serial oriented vector
+-					this->inputs->AddInput(new PentaInput(name,valuesp,P1Enum));
+-					return;
+-				}
+-				default: _error_("element " << EnumToStringx(element->ObjectEnum()) << " not implemented yet");
+-			}
+-		default: _error_("type " << type << " (" << EnumToStringx(type) << ") not implemented yet");
+-	}
+ }
+ /*}}}*/
+ /*FUNCTION Matice::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type) {{{*/
+ void  Matice::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){
+ 
+-	/*Intermediaries*/
+-	Element    *element    = NULL;
+-	Parameters *parameters = NULL;
+-	int         meshtype;
+-
+-	/*Recover element*/
+-	element=(Element*)helement->delivers();
+-
+-	/*Check that name is an element input*/
+-	if (!IsInput(name)) return;
+-
+-	switch(type){
+-
+-		case VertexEnum:
+-
+-			switch(element->ObjectEnum()){
+-
+-				case TriaEnum: {
+-					IssmDouble values[3];
+-					for (int i=0;i<3;i++) values[i]=vector[((Tria*)element)->vertices[i]->Sid()]; //index into serial oriented vector 
+-					this->inputs->AddInput(new TriaInput(name,values,P1Enum));
+-					/*Special case for rheology B in 2D: Pourave land for this solution{{{*/
+-					if(name==MaterialsRheologyBEnum){
+-						/*Are we in 2D?:*/
+-						if(element->ObjectEnum()==TriaEnum){
+-							parameters=((Tria*)(element))->parameters;
+-						}
+-						else{
+-							parameters=((Penta*)(element))->parameters;
+-						}
+-						parameters->FindParam(&meshtype,MeshTypeEnum);
+-						if(meshtype==Mesh2DhorizontalEnum){
+-							/*Duplicate rheology input: */
+-							this->inputs->AddInput(new TriaInput(MaterialsRheologyBbarEnum,values,P1Enum));
+-						}
+-					}
+-					/*}}}*/
+-					return;
+-				}
+-				case PentaEnum:{
+-					IssmDouble valuesp[6];
+-					for (int i=0;i<6;i++) valuesp[i]=vector[((Penta*)element)->vertices[i]->Sid()]; //use sid list, to index into serial oriented vector
+-					this->inputs->AddInput(new PentaInput(name,valuesp,P1Enum));
+-					return;
+-				}
+-				default: _error_("element " << EnumToStringx(element->ObjectEnum()) << " not implemented yet");
+-			}
+-		default: _error_("type " << type << " (" << EnumToStringx(type) << ") not implemented yet");
+-	}
+-
+ }
+ /*}}}*/
+ /*FUNCTION Matice::InputUpdateFromMatrixDakota(int* vector, int name, int type) {{{*/
+@@ -664,168 +550,3 @@
+ 	/*Nothing updated yet*/
+ }
+ /*}}}*/
+-/*FUNCTION Matice::InputUpdateFromIoModel{{{*/
+-void Matice::InputUpdateFromIoModel(int index, IoModel* iomodel){
+-
+-	int i,j;
+-	bool   control_analysis;
+-	int    num_control_type;
+-
+-	/*Fetch parameters: */
+-	iomodel->Constant(&control_analysis,InversionIscontrolEnum);
+-	if(control_analysis) iomodel->Constant(&num_control_type,InversionNumControlParametersEnum);
+-
+-	if(iomodel->meshtype==Mesh2DhorizontalEnum){
+-
+-		/*Intermediaries*/
+-		const int  num_vertices = 3; //Tria has 3 vertices
+-		IssmDouble nodeinputs[num_vertices];
+-		IssmDouble cmmininputs[num_vertices];
+-		IssmDouble cmmaxinputs[num_vertices];
+-
+-		/*Get B*/
+-		if (iomodel->Data(MaterialsRheologyBEnum)) {
+-			for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(MaterialsRheologyBEnum)[iomodel->elements[num_vertices*index+i]-1];
+-			this->inputs->AddInput(new TriaInput(MaterialsRheologyBbarEnum,nodeinputs,P1Enum));
+-		}
+-
+-		/*Get n*/
+-		if (iomodel->Data(MaterialsRheologyNEnum)) {
+-			for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(MaterialsRheologyNEnum)[index];
+-			this->inputs->AddInput(new TriaInput(MaterialsRheologyNEnum,nodeinputs,P1Enum));
+-		}
+-
+-		/*Get D:*/
+-		if (iomodel->Data(DamageDEnum)) {
+-			for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(DamageDEnum)[iomodel->elements[num_vertices*index+i]-1];
+-			this->inputs->AddInput(new TriaInput(DamageDbarEnum,nodeinputs,P1Enum));
+-		}
+-
+-		/*Control Inputs*/
+-		if (control_analysis && iomodel->Data(InversionControlParametersEnum)){
+-			for(i=0;i<num_control_type;i++){
+-				switch(reCast<int>(iomodel->Data(InversionControlParametersEnum)[i])){
+-					case MaterialsRheologyBbarEnum:
+-						if (iomodel->Data(MaterialsRheologyBEnum)){
+-							_assert_(iomodel->Data(MaterialsRheologyBEnum));_assert_(iomodel->Data(InversionMinParametersEnum)); _assert_(iomodel->Data(InversionMaxParametersEnum)); 
+-							for(j=0;j<num_vertices;j++)nodeinputs[j]=iomodel->Data(MaterialsRheologyBEnum)[iomodel->elements[num_vertices*index+j]-1];
+-							for(j=0;j<num_vertices;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(iomodel->elements[num_vertices*index+j]-1)*num_control_type+i];
+-							for(j=0;j<num_vertices;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(iomodel->elements[num_vertices*index+j]-1)*num_control_type+i];
+-							this->inputs->AddInput(new ControlInput(MaterialsRheologyBbarEnum,TriaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+-						}
+-						break;
+-					case DamageDbarEnum:
+-						if (iomodel->Data(DamageDEnum)){
+-							_assert_(iomodel->Data(DamageDEnum));_assert_(iomodel->Data(InversionMinParametersEnum)); _assert_(iomodel->Data(InversionMaxParametersEnum)); 
+-							for(j=0;j<num_vertices;j++)nodeinputs[j]=iomodel->Data(DamageDEnum)[iomodel->elements[num_vertices*index+j]-1];
+-							for(j=0;j<num_vertices;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(iomodel->elements[num_vertices*index+j]-1)*num_control_type+i];
+-							for(j=0;j<num_vertices;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(iomodel->elements[num_vertices*index+j]-1)*num_control_type+i];
+-							this->inputs->AddInput(new ControlInput(DamageDbarEnum,TriaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+-						}
+-						break;
+-				}
+-			}
+-		}
+-	}
+-	else if(iomodel->meshtype==Mesh2DverticalEnum){
+-
+-		/*Intermediaries*/
+-		const int num_vertices = 3; //Tria has 3 vertices
+-		IssmDouble    nodeinputs[num_vertices];
+-		IssmDouble    cmmininputs[num_vertices];
+-		IssmDouble    cmmaxinputs[num_vertices];
+-
+-		/*Get B*/
+-		if (iomodel->Data(MaterialsRheologyBEnum)) {
+-			for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(MaterialsRheologyBEnum)[iomodel->elements[num_vertices*index+i]-1];
+-			this->inputs->AddInput(new TriaInput(MaterialsRheologyBEnum,nodeinputs,P1Enum));
+-		}
+-
+-		/*Get n*/
+-		if (iomodel->Data(MaterialsRheologyNEnum)) {
+-			for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(MaterialsRheologyNEnum)[index];
+-			this->inputs->AddInput(new TriaInput(MaterialsRheologyNEnum,nodeinputs,P1Enum));
+-		}
+-
+-		/*Get D:*/
+-		if (iomodel->Data(DamageDEnum)) {
+-			for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(DamageDEnum)[iomodel->elements[num_vertices*index+i]-1];
+-			this->inputs->AddInput(new TriaInput(DamageDEnum,nodeinputs,P1Enum));
+-		}
+-	}
+-	else if(iomodel->meshtype==Mesh3DEnum){
+-
+-		/*Intermediaries*/
+-		const int  num_vertices = 6; //Penta has 6 vertices
+-		IssmDouble nodeinputs[num_vertices];
+-		IssmDouble cmmininputs[num_vertices];
+-		IssmDouble cmmaxinputs[num_vertices];
+-
+-		/*Get B*/
+-		if (iomodel->Data(MaterialsRheologyBEnum)) {
+-			for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(MaterialsRheologyBEnum)[iomodel->elements[num_vertices*index+i]-1];
+-			this->inputs->AddInput(new PentaInput(MaterialsRheologyBEnum,nodeinputs,P1Enum));
+-		}
+-
+-		/*Get n*/
+-		if (iomodel->Data(MaterialsRheologyNEnum)) {
+-			for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(MaterialsRheologyNEnum)[index];
+-			this->inputs->AddInput(new PentaInput(MaterialsRheologyNEnum,nodeinputs,P1Enum));
+-		}
+-		
+-		/*Get D*/
+-		if (iomodel->Data(DamageDEnum)) {
+-			for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(DamageDEnum)[iomodel->elements[num_vertices*index+i]-1];
+-			this->inputs->AddInput(new PentaInput(DamageDEnum,nodeinputs,P1Enum));
+-		}
+-		
+-		/*Control Inputs*/
+-		if (control_analysis && iomodel->Data(InversionControlParametersEnum)){
+-			for(i=0;i<num_control_type;i++){
+-				switch(reCast<int>(iomodel->Data(InversionControlParametersEnum)[i])){
+-					case MaterialsRheologyBbarEnum:
+-						if (iomodel->Data(MaterialsRheologyBEnum)){
+-							_assert_(iomodel->Data(MaterialsRheologyBEnum));_assert_(iomodel->Data(InversionMinParametersEnum)); _assert_(iomodel->Data(InversionMaxParametersEnum)); 
+-							for(j=0;j<num_vertices;j++)nodeinputs[j]=iomodel->Data(MaterialsRheologyBEnum)[iomodel->elements[num_vertices*index+j]-1];
+-							for(j=0;j<num_vertices;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(iomodel->elements[num_vertices*index+j]-1)*num_control_type+i];
+-							for(j=0;j<num_vertices;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(iomodel->elements[num_vertices*index+j]-1)*num_control_type+i];
+-							this->inputs->AddInput(new ControlInput(MaterialsRheologyBEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+-						}
+-						break;
+-					case DamageDbarEnum:
+-						if (iomodel->Data(DamageDEnum)){
+-							_assert_(iomodel->Data(DamageDEnum));_assert_(iomodel->Data(InversionMinParametersEnum)); _assert_(iomodel->Data(InversionMaxParametersEnum)); 
+-							for(j=0;j<num_vertices;j++)nodeinputs[j]=iomodel->Data(DamageDEnum)[iomodel->elements[num_vertices*index+j]-1];
+-							for(j=0;j<num_vertices;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(iomodel->elements[num_vertices*index+j]-1)*num_control_type+i];
+-							for(j=0;j<num_vertices;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(iomodel->elements[num_vertices*index+j]-1)*num_control_type+i];
+-							this->inputs->AddInput(new ControlInput(DamageDEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+-						}
+-						break;
+-
+-				}
+-			}
+-		}
+-	}
+-	else{
+-		_error_("Mesh type not supported yet!");
+-	}
+-
+-	return;
+-}
+-/*}}}*/
+-/*FUNCTION Matice::IsInput{{{*/
+-bool Matice::IsInput(int name){
+-	if (
+-				name==MaterialsRheologyBEnum ||
+-				name==MaterialsRheologyBbarEnum ||
+-				name==MaterialsRheologyNEnum ||
+-				name==QmuMaterialsRheologyBEnum ||
+-				name==DamageDEnum ||
+-				name==DamageDbarEnum
+-
+-		){
+-		return true;
+-	}
+-	else return false;
+-}
+-/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Materials/Material.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Material.h	(revision 17274)
++++ ../trunk-jpl/src/c/classes/Materials/Material.h	(revision 17275)
+@@ -11,20 +11,19 @@
+ template <class doubletype> class Vector;
+ #include "../../datastructures/datastructures.h"
+ #include "../Update.h"
++class Element;
+ class Elements;
+ /*}}}*/
+ 
+ class Material: public Object,public Update{
+ 
+ 	public: 
+-		Inputs*  inputs;
+ 		virtual ~Material(){};
+ 		/*WARNING: input should not be public but it is an easy way to update B from T (using UpdateFromSolution) from Pentas*/
+ 
+ 		/*Numerics*/
+-		virtual void       InputDuplicate(int original_enum,int new_enum)=0;
++		virtual Material*  copy(Element* element)=0;
+ 		virtual void       Configure(Elements* elements)=0;
+-		virtual void       GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum)=0;
+ 		virtual void       GetViscosity(IssmDouble* pviscosity,IssmDouble epseff)=0;
+ 		virtual void       GetViscosityBar(IssmDouble* pviscosity,IssmDouble epseff)=0;
+ 		virtual void       GetViscosityComplement(IssmDouble* pviscosity_complement, IssmDouble* pepsilon)=0;
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 17274)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 17275)
+@@ -90,8 +90,6 @@
+ 	iomodel->Constant(&this->lithosphere_density,MaterialsLithosphereDensityEnum);
+ 	iomodel->Constant(&this->mantle_shear_modulus,MaterialsMantleShearModulusEnum);
+ 	iomodel->Constant(&this->mantle_density,MaterialsMantleDensityEnum);
+-
+-	this->inputs=NULL; /*not used here*/
+ }
+ /*}}}*/
+ /*FUNCTION Matpar::~Matpar() {{{*/
+@@ -233,14 +231,6 @@
+ /*}}}*/
+ 
+ /*Matpar management: */
+-/*FUNCTION Matpar::InputDuplicate{{{*/
+-void  Matpar::InputDuplicate(int original_enum,int new_enum){
+-
+-	   /*Call inputs method*/
+-	   if (IsInput(original_enum)) inputs->DuplicateInput(original_enum,new_enum);
+-
+-}
+-/*}}}*/
+ /*FUNCTION Matpar::Configure {{{*/
+ void  Matpar::Configure(Elements* elementsin){
+ 
+@@ -519,7 +509,6 @@
+ 	*penthalpy=enthalpy;
+ }
+ /*}}}*/
+-
+ /*FUNCTION Matpar::GetLithosphereShearModulus {{{*/			 
+ IssmDouble Matpar::GetLithosphereShearModulus(){		 
+ 	return lithosphere_shear_modulus;			 
+@@ -540,8 +529,3 @@
+ 	return mantle_shear_modulus;			 
+ }		 
+ /*}}}*/ 
+-/*FUNCTION Matpar::IsInput{{{*/
+-bool Matpar::IsInput(int name){
+-	return false;
+-}
+-/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Materials/Materials.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Materials.h	(revision 17274)
++++ ../trunk-jpl/src/c/classes/Materials/Materials.h	(revision 17275)
+@@ -23,7 +23,6 @@
+ 
+ 		/*numerics*/
+ 		void  Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters);
+-		void  InputDuplicate(int input_enum,int output_enum);
+ 
+ };
+ 
+Index: ../trunk-jpl/src/c/classes/Materials/Matice.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matice.h	(revision 17274)
++++ ../trunk-jpl/src/c/classes/Materials/Matice.h	(revision 17275)
+@@ -11,6 +11,7 @@
+ #include "../Hook.h"
+ class IoModel;
+ class Elements;
++class Element;
+ class Loads;
+ class Nodes;
+ class Vertices;
+@@ -21,8 +22,9 @@
+ class Matice: public Material{
+ 
+ 	private: 
+-		int   mid;
+-		Hook *helement;
++		int      mid;
++		Hook    *helement;
++		Element *element;
+ 
+ 	public:
+ 		/*Matice constructors, destructors: {{{*/
+@@ -44,12 +46,11 @@
+ 		void  InputUpdateFromConstant(IssmDouble constant, int name);
+ 		void  InputUpdateFromConstant(int constant, int name);
+ 		void  InputUpdateFromConstant(bool constant, int name);
+-		void  InputUpdateFromIoModel(int index, IoModel* iomodel);
++		void  InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented");};
+ 		/*}}}*/
+ 		/*Material virtual functions resolution: {{{*/
+-		void   InputDuplicate(int original_enum,int new_enum);
+ 		void   Configure(Elements* elements);
+-		void   GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum);
++		Material*  copy(Element* element);
+ 		void       SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
+ 		void       GetViscosity(IssmDouble* pviscosity, IssmDouble eps_eff);
+ 		void       GetViscosityBar(IssmDouble* pviscosity, IssmDouble eps_eff);
+@@ -65,7 +66,6 @@
+ 		IssmDouble GetD();
+ 		IssmDouble GetDbar();
+ 		IssmDouble GetN();
+-		bool       IsInput(int name);
+ 		/*}}}*/
+ };
+ 
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 17274)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 17275)
+@@ -75,12 +75,11 @@
+ 		void   InputUpdateFromConstant(IssmDouble constant, int name);
+ 		void   InputUpdateFromConstant(int constant, int name);
+ 		void   InputUpdateFromConstant(bool constant, int name);
+-		void   InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented yet");};
++		void   InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented");};
+ 		/*}}}*/
+ 		/*Material virtual functions resolution: {{{*/
+-		void       InputDuplicate(int original_enum,int new_enum);
++		Material*  copy(Element* element){_error_("not implemented");};
+ 		void       Configure(Elements* elements);
+-		void       GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum){return;}
+ 		void       GetViscosity(IssmDouble* pviscosity,IssmDouble eps_eff){_error_("not supported");};
+ 		void       GetViscosityBar(IssmDouble* pviscosity,IssmDouble eps_eff){_error_("not supported");};
+ 		void       GetViscosityComplement(IssmDouble* pviscosity_complement, IssmDouble* pepsilon){_error_("not supported");};
+@@ -134,7 +133,6 @@
+ 		IssmDouble GetDesFac();
+ 		IssmDouble GetS0p(); 
+ 		IssmDouble GetMaterialParameter(int in_enum); 
+-		bool       IsInput(int name);
+ 		/*}}}*/
+ 
+ };
+Index: ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 17274)
++++ ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 17275)
+@@ -705,7 +705,7 @@
+ 	}
+ 
+ 	//First recover damage  using the element: */
+-	element->GetMaterialInputValue(&damage,node,DamageDbarEnum);
++	element->GetInputValue(&damage,node,DamageDbarEnum);
+ 
+ 	//Recover our data:
+ 	parameters->FindParam(&penalty_lock,DamagePenaltyLockEnum);
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17274)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17275)
+@@ -64,6 +64,7 @@
+ 		void       GetPhi(IssmDouble* phi, IssmDouble*  epsilon, IssmDouble viscosity);
+ 		void       GetVerticesSidList(int* sidlist);
+ 		void       GetVerticesConnectivityList(int* connectivitylist);
++		bool	     IsInput(int name);
+ 		bool       IsFloating(); 
+ 		void       ResultInterpolation(int* pinterpolation,int*nodesperelement,int output_enum);
+ 		void       ResultToVector(Vector<IssmDouble>* vector,int output_enum);
+@@ -105,7 +106,6 @@
+ 		/*Virtual functions*/
+ 		virtual void       AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
+ 		virtual void       AddInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
+-		virtual void       AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
+ 		virtual IssmDouble CharacteristicLength(void)=0;
+ 		virtual void       Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters)=0;
+ 		virtual void       SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters)=0;
+@@ -163,7 +163,6 @@
+ 		virtual void   GetInputListOnNodes(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue)=0;
+ 		virtual void   GetInputListOnVertices(IssmDouble* pvalue,int enumtype)=0;
+ 		virtual void   GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue)=0;
+-		virtual Input* GetMaterialInput(int inputenum)=0;
+ 		virtual void   GetInputValue(IssmDouble* pvalue,Node* node,int enumtype)=0;
+ 		virtual void   GetInputValue(bool* pvalue,int enum_type)=0;
+ 		virtual void   GetInputValue(int* pvalue,int enum_type)=0;
+@@ -176,11 +175,10 @@
+ 		virtual IssmDouble GetXcoord(Gauss* gauss)=0;
+ 		virtual IssmDouble GetYcoord(Gauss* gauss)=0;
+ 		virtual IssmDouble GetZcoord(Gauss* gauss)=0;
+-		virtual void   GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype)=0;
+ 		virtual int    GetElementType(void)=0;
+ 
+ 		virtual IssmDouble SurfaceArea(void)=0;
+-		virtual void   InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum)=0;
++		virtual void   InputDepthAverageAtBase(int enum_type,int average_enum_type)=0;
+ 		virtual void   InputChangeName(int enum_type,int enum_type_old)=0;
+ 		virtual void   ComputeBasalStress(Vector<IssmDouble>* sigma_b)=0;
+ 		virtual void   ComputeStrainRate(Vector<IssmDouble>* eps)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17274)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17275)
+@@ -177,13 +177,6 @@
+ 	this->inputs->AddInput(new TriaInput(input_enum,values,interpolation_enum));
+ }
+ /*}}}*/
+-/*FUNCTION Tria::AddMaterialInput{{{*/
+-void  Tria::AddMaterialInput(int input_enum,IssmDouble* values, int interpolation_enum){
+-
+-	_assert_(this->material);
+-	this->material->inputs->AddInput(new TriaInput(input_enum,values,interpolation_enum));
+-}
+-/*}}}*/
+ /*FUNCTION Tria::CharacteristicLength{{{*/
+ IssmDouble Tria::CharacteristicLength(void){
+ 
+@@ -1017,11 +1010,6 @@
+ 	return NUMVERTICES;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetMaterialInput(int inputenum) {{{*/
+-Input* Tria::GetMaterialInput(int inputenum){
+-	return this->material->inputs->GetInput(inputenum);
+-}
+-/*}}}*/
+ /*FUNCTION Tria::GetInputListOnVertices(IssmDouble* pvalue,int enumtype) {{{*/
+ void Tria::GetInputListOnVertices(IssmDouble* pvalue,int enumtype){
+ 
+@@ -1172,19 +1160,6 @@
+ 	input->GetInputValue(pvalue,gauss);
+ 
+ }/*}}}*/
+-/*FUNCTION Tria::GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype) {{{*/
+-void Tria::GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype){
+-
+-	Input* input=this->material->inputs->GetInput(enumtype);
+-	if(!input) _error_("No input of type " << EnumToStringx(enumtype) << " found in tria");
+-
+-	GaussTria* gauss=new GaussTria();
+-	gauss->GaussVertex(this->GetNodeIndex(node));
+-
+-	input->GetInputValue(pvalue,gauss);
+-	delete gauss;
+-}
+-/*}}}*/
+ Node* Tria::GetNode(int node_number){/*{{{*/
+ 	_assert_(node_number>=0); 
+ 	_assert_(node_number<this->NumberofNodes()); 
+@@ -1246,19 +1221,14 @@
+ }
+ /*}}}*/
+ /*FUNCTION Tria::InputDepthAverageAtBase {{{*/
+-void  Tria::InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum){
++void  Tria::InputDepthAverageAtBase(int enum_type,int average_enum_type){
+ 
+ 	/*New input*/
+ 	Input* oldinput=NULL;
+ 	Input* newinput=NULL;
+ 
+ 	/*copy input of enum_type*/
+-	if (object_enum==MeshElementsEnum)
+-	 oldinput=(Input*)this->inputs->GetInput(enum_type);
+-	else if (object_enum==MaterialsEnum)
+-	 oldinput=(Input*)this->material->inputs->GetInput(enum_type);
+-	else
+-	 _error_("object " << EnumToStringx(object_enum) << " not supported yet");
++	oldinput=(Input*)this->inputs->GetInput(enum_type);
+ 	if(!oldinput)_error_("could not find old input with enum: " << EnumToStringx(enum_type));
+ 	newinput=(Input*)oldinput->copy();
+ 
+@@ -1266,12 +1236,7 @@
+ 	newinput->ChangeEnum(average_enum_type);
+ 
+ 	/*Add new input to current element*/
+-	if (object_enum==MeshElementsEnum)
+-	 this->inputs->AddInput((Input*)newinput);
+-	else if (object_enum==MaterialsEnum)
+-	 this->material->inputs->AddInput((Input*)newinput);
+-	else
+-	 _error_("object " << EnumToStringx(object_enum) << " not supported yet");
++	this->inputs->AddInput((Input*)newinput);
+ }
+ /*}}}*/
+ /*FUNCTION Tria::InputDuplicate{{{*/
+@@ -1407,9 +1372,22 @@
+ 						this->inputs->AddInput(new ControlInput(FrictionCoefficientEnum,TriaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+ 					}
+ 					break;
+-				/*Material will take care of it*/ 
+-				case MaterialsRheologyBbarEnum:break;
+-				case DamageDbarEnum: break;
++				case MaterialsRheologyBbarEnum:
++					if(iomodel->Data(MaterialsRheologyBEnum)){
++						for(j=0;j<3;j++) nodeinputs[j]=iomodel->Data(MaterialsRheologyBEnum)[tria_vertex_ids[j]-1];
++						for(j=0;j<3;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i];
++						for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i];
++						this->inputs->AddInput(new ControlInput(MaterialsRheologyBbarEnum,TriaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
++					}
++					break;
++				case DamageDbarEnum:
++					if(iomodel->Data(DamageDEnum)){
++						for(j=0;j<3;j++) nodeinputs[j]=iomodel->Data(DamageDEnum)[tria_vertex_ids[j]-1];
++						for(j=0;j<3;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i];
++						for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i];
++						this->inputs->AddInput(new ControlInput(DamageDbarEnum,TriaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
++					}
++					break;
+ 				default:
+ 					_error_("Control " << EnumToStringx(reCast<int,IssmDouble>(iomodel->Data(InversionControlParametersEnum)[i])) << " not implemented yet");
+ 			}
+@@ -1475,12 +1453,7 @@
+ 			values[i]=vector[this->vertices[i]->Pid()];
+ 		}
+ 		/*update input*/
+-		if (name==MaterialsRheologyBbarEnum || name==MaterialsRheologyBEnum || name==DamageDEnum || name==DamageDbarEnum){
+-			material->inputs->AddInput(new TriaInput(name,values,P1Enum));
+-		}
+-		else{
+-			this->inputs->AddInput(new TriaInput(name,values,P1Enum));
+-		}
++		this->inputs->AddInput(new TriaInput(name,values,P1Enum));
+ 		break;
+ 
+ 	case VertexSIdEnum: 
+@@ -1489,12 +1462,7 @@
+ 			values[i]=vector[this->vertices[i]->Sid()];
+ 		}
+ 		/*update input*/
+-		if(name==MaterialsRheologyBbarEnum || name==MaterialsRheologyBEnum || name==DamageDEnum || name==DamageDbarEnum){
+-			material->inputs->AddInput(new TriaInput(name,values,P1Enum));
+-		}
+-		else{
+-			this->inputs->AddInput(new TriaInput(name,values,P1Enum));
+-		}
++		this->inputs->AddInput(new TriaInput(name,values,P1Enum));
+ 		break;
+ 
+ 	case NodesEnum:
+@@ -1604,63 +1572,6 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::IsInput{{{*/
+-bool Tria::IsInput(int name){
+-	if (
+-				name==ThicknessEnum ||
+-				name==SurfaceEnum ||
+-				name==BathymetryEnum ||
+-				name==BedEnum ||
+-				name==MaskGroundediceLevelsetEnum ||
+-				name==MaskIceLevelsetEnum ||
+-				name==IceMaskNodeActivationEnum ||
+-				name==LevelsetfunctionSlopeXEnum ||
+-				name==LevelsetfunctionSlopeYEnum ||
+-				name==SurfaceSlopeXEnum ||
+-				name==SurfaceSlopeYEnum ||
+-				name==BasalforcingsMeltingRateEnum ||
+-				name==WatercolumnEnum || 
+-				name==SurfaceforcingsMassBalanceEnum ||
+-				name==SurfaceAreaEnum||
+-				name==VxEnum ||
+-				name==VyEnum ||
+-				name==PressureEnum ||
+-				name==InversionVxObsEnum ||
+-				name==InversionVyObsEnum ||
+-				name==FrictionCoefficientEnum ||
+-				name==MaterialsRheologyBbarEnum ||
+-				name==DamageDbarEnum ||
+-				name==GradientEnum ||
+-				name==OldGradientEnum ||
+-				name==ConvergedEnum ||
+-				name==SedimentHeadOldEnum ||
+-				name==SedimentHeadEnum ||
+-				name==EplHeadEnum ||
+-				name==EplHeadOldEnum ||
+-				name==HydrologydcEplThicknessOldEnum ||
+-				name==HydrologydcEplInitialThicknessEnum ||
+-				name==HydrologydcEplThicknessEnum ||
+-				name==HydrologydcMaskEplactiveNodeEnum ||
+-				name==MeshVertexonbedEnum ||
+-				name==WaterTransferEnum ||
+-				name==QmuVxEnum ||
+-				name==QmuVyEnum ||
+-				name==QmuPressureEnum ||
+-				name==QmuBedEnum ||
+-				name==QmuThicknessEnum ||
+-				name==QmuSurfaceEnum ||
+-				name==QmuTemperatureEnum ||
+-				name==QmuMeltingEnum || 
+-				name==QmuMaskGroundediceLevelsetEnum ||
+-				name==QmuMaskIceLevelsetEnum ||
+-				name==GiaWEnum || 
+-				name==GiadWdtEnum
+-		){
+-		return true;
+-	}
+-	else return false;
+-}
+-/*}}}*/
+ /*FUNCTION Tria::IsOnBed {{{*/
+ bool Tria::IsOnBed(){
+ 
+@@ -2298,9 +2209,7 @@
+ 	this->SpawnSegHook(dynamic_cast<ElementHook*>(seg),index1,index2);
+ 
+ 	/*Spawn material*/
+-	seg->material=(Material*)this->material->copy();
+-	delete seg->material->inputs;
+-	seg->material->inputs=(Inputs*)this->material->inputs->SpawnSegInputs(index1,index2);
++	seg->material=(Material*)this->material->copy(seg);
+ 
+ 	/*recover nodes, material and matpar: */
+ 	seg->nodes    = (Node**)seg->hnodes[analysis_counter]->deliverp();
+@@ -3296,14 +3205,7 @@
+ 	this->parameters->FindParam(&control_type,NULL,InversionControlParametersEnum);
+ 
+ 	for(int i=0;i<num_controls;i++){
+-
+-		if(control_type[i]==MaterialsRheologyBbarEnum || control_type[i]==DamageDbarEnum){
+-			input=(Input*)material->inputs->GetInput(control_type[i]); _assert_(input);
+-		}
+-		else{
+-			input=(Input*)this->inputs->GetInput(control_type[i]);   _assert_(input);
+-		}
+-
++		input=(Input*)this->inputs->GetInput(control_type[i]);   _assert_(input);
+ 		if (input->ObjectEnum()!=ControlInputEnum){
+ 			_error_("input " << EnumToStringx(control_type[i]) << " is not a ControlInput");
+ 		}
+@@ -3322,14 +3224,8 @@
+ void Tria::ControlInputGetGradient(Vector<IssmDouble>* gradient,int enum_type,int control_index){
+ 
+ 	int vertexpidlist[NUMVERTICES];
+-	Input* input=NULL;
+ 
+-	if(enum_type==MaterialsRheologyBbarEnum || enum_type==DamageDbarEnum){
+-		input=(Input*)material->inputs->GetInput(enum_type);
+-	}
+-	else{
+-		input=inputs->GetInput(enum_type);
+-	}
++	Input* input=inputs->GetInput(enum_type);
+ 	if (!input) _error_("Input " << EnumToStringx(enum_type) << " not found");
+ 	if (input->ObjectEnum()!=ControlInputEnum) _error_("Input " << EnumToStringx(enum_type) << " is not a ControlInput");
+ 
+@@ -3340,14 +3236,7 @@
+ /*FUNCTION Tria::ControlInputScaleGradient{{{*/
+ void Tria::ControlInputScaleGradient(int enum_type,IssmDouble scale){
+ 
+-	Input* input=NULL;
+-
+-	if(enum_type==MaterialsRheologyBbarEnum || enum_type==DamageDbarEnum){
+-		input=(Input*)material->inputs->GetInput(enum_type);
+-	}
+-	else{
+-		input=inputs->GetInput(enum_type);
+-	}
++	Input* input=inputs->GetInput(enum_type);
+ 	if (!input) _error_("Input " << EnumToStringx(enum_type) << " not found");
+ 	if (input->ObjectEnum()!=ControlInputEnum) _error_("Input " << EnumToStringx(enum_type) << " is not a ControlInput");
+ 
+@@ -3359,14 +3248,8 @@
+ 	int    vertexpidlist[NUMVERTICES];
+ 	IssmDouble grad_list[NUMVERTICES];
+ 	Input* grad_input=NULL;
+-	Input* input=NULL;
+ 
+-	if(enum_type==MaterialsRheologyBbarEnum || enum_type==DamageDbarEnum){
+-		input=(Input*)material->inputs->GetInput(enum_type);
+-	}
+-	else{
+-		input=inputs->GetInput(enum_type);
+-	}
++	Input* input=inputs->GetInput(enum_type);
+ 	if (!input) _error_("Input " << EnumToStringx(enum_type) << " not found");
+ 	if (input->ObjectEnum()!=ControlInputEnum) _error_("Input " << EnumToStringx(enum_type) << " is not a ControlInput");
+ 
+@@ -3380,13 +3263,7 @@
+ /*FUNCTION Tria::ControlToVectors{{{*/
+ void Tria::ControlToVectors(Vector<IssmPDouble>* vector_control, Vector<IssmPDouble>* vector_gradient,int control_enum){
+ 
+-	Input* input=NULL;
+-	if(control_enum==MaterialsRheologyBbarEnum || control_enum==DamageDbarEnum){
+-		input=(Input*)material->inputs->GetInput(control_enum);
+-	}
+-	else{
+-		input=inputs->GetInput(control_enum);
+-	}
++	Input* input=inputs->GetInput(control_enum);
+ 	if (!input) _error_("Input " << EnumToStringx(control_enum) << " not found");
+ 	if (input->ObjectEnum()!=ControlInputEnum) _error_("Input " << EnumToStringx(control_enum) << " is not a ControlInput");
+ 
+@@ -3498,7 +3375,7 @@
+ 	/*Retrieve all inputs we will be needing: */
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	GradientIndexing(&vertexpidlist[0],control_index);
+-	Input* rheologyb_input=material->inputs->GetInput(MaterialsRheologyBbarEnum); _assert_(rheologyb_input);
++	Input* rheologyb_input=inputs->GetInput(MaterialsRheologyBbarEnum); _assert_(rheologyb_input);
+ 	Input* weights_input=inputs->GetInput(InversionCostFunctionsCoefficientsEnum);                _assert_(weights_input);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+@@ -3547,7 +3424,7 @@
+ 	Input* vy_input=inputs->GetInput(VyEnum);                                   _assert_(vy_input);
+ 	Input* adjointx_input=inputs->GetInput(AdjointxEnum);                       _assert_(adjointx_input);
+ 	Input* adjointy_input=inputs->GetInput(AdjointyEnum);                       _assert_(adjointy_input);
+-	Input* rheologyb_input=material->inputs->GetInput(MaterialsRheologyBbarEnum); _assert_(rheologyb_input);
++	Input* rheologyb_input=inputs->GetInput(MaterialsRheologyBbarEnum); _assert_(rheologyb_input);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	gauss=new GaussTria(4);
+@@ -3604,7 +3481,7 @@
+ 	Input* vy_input=inputs->GetInput(VyEnum);                                   _assert_(vy_input);
+ 	Input* adjointx_input=inputs->GetInput(AdjointxEnum);                       _assert_(adjointx_input);
+ 	Input* adjointy_input=inputs->GetInput(AdjointyEnum);                       _assert_(adjointy_input);
+-	Input* rheologyd_input=material->inputs->GetInput(DamageDbarEnum); _assert_(rheologyd_input);
++	Input* rheologyd_input=inputs->GetInput(DamageDbarEnum); _assert_(rheologyd_input);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	gauss=new GaussTria(4);
+@@ -4010,7 +3887,7 @@
+ 	/*Retrieve all inputs we will be needing: */
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 	Input* weights_input  =inputs->GetInput(InversionCostFunctionsCoefficientsEnum);              _assert_(weights_input);
+-	Input* rheologyb_input=material->inputs->GetInput(MaterialsRheologyBbarEnum); _assert_(rheologyb_input);
++	Input* rheologyb_input=inputs->GetInput(MaterialsRheologyBbarEnum); _assert_(rheologyb_input);
+ 
+ 	/* Start looping on the number of gaussian points: */
+ 	gauss=new GaussTria(2);
+@@ -4572,12 +4449,7 @@
+ 	GradientIndexing(&vertexpidlist[0],control_index);
+ 
+ 	/*Get input (either in element or material)*/
+-	if(control_enum==MaterialsRheologyBbarEnum || control_enum==DamageDbarEnum){
+-		input=(Input*)this->material->inputs->GetInput(control_enum); _assert_(input);
+-	}
+-	else{
+-		input=(Input*)this->inputs->GetInput(control_enum);   _assert_(input);
+-	}
++	input=(Input*)this->inputs->GetInput(control_enum);   _assert_(input);
+ 
+ 	/*Check that it is a ControlInput*/
+ 	if (input->ObjectEnum()!=ControlInputEnum){
+@@ -4607,13 +4479,7 @@
+ 	}
+ 	new_input = new TriaInput(control_enum,values,P1Enum);
+ 
+-	if(control_enum==MaterialsRheologyBbarEnum || control_enum==DamageDbarEnum){
+-		input=(Input*)material->inputs->GetInput(control_enum); _assert_(input);
+-	}
+-	else{
+-		input=(Input*)this->inputs->GetInput(control_enum);   _assert_(input);
+-	}
+-
++	input=(Input*)this->inputs->GetInput(control_enum);   _assert_(input);
+ 	if (input->ObjectEnum()!=ControlInputEnum){
+ 		_error_("input " << EnumToStringx(control_enum) << " is not a ControlInput");
+ 	}
+@@ -5149,6 +5015,9 @@
+ 					this->inputs->AddInput(new TriaInput(SurfaceEnum,surface,P1Enum));
+ 
+ 					break;
++				case MaterialsRheologyBEnum:
++					this->inputs->AddInput(new TriaInput(MaterialsRheologyBbarEnum,values,P1Enum));
++					break;
+ 				default:
+ 					this->inputs->AddInput(new TriaInput(name,values,P1Enum));
+ 			}
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17274)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17275)
+@@ -108,7 +108,7 @@
+ 		void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list);
+ 		void        GetVerticesCoordinatesTop(IssmDouble** pxyz_list);
+ 		void        InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);
+-		void        InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum=MeshElementsEnum);
++		void        InputDepthAverageAtBase(int enum_type,int average_enum_type);
+ 		void        InputDuplicate(int original_enum,int new_enum);
+ 		void        InputScale(int enum_type,IssmDouble scale_factor);
+ 		void        MaterialUpdateFromTemperature(void){_error_("not implemented yet");};
+@@ -201,7 +201,6 @@
+ 		/*Tria specific routines:{{{*/
+ 		void           AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		void           AddInput(int input_enum, IssmDouble* values, int interpolation_enum);
+-		void           AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		IssmDouble     EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented");};
+ 		IssmDouble     EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure){_error_("not implemented");};
+ 		IssmDouble     GetArea(void);
+@@ -215,7 +214,6 @@
+ 		void           NormalSection(IssmDouble* normal,IssmDouble* xyz_list);
+ 		void           NormalTop(IssmDouble* normal,IssmDouble* xyz_list);
+ 		void           NormalBase(IssmDouble* normal,IssmDouble* xyz_list);
+-		Input*         GetMaterialInput(int inputenum);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue,int index); //TO BE REMOVED
+@@ -231,7 +229,6 @@
+ 		void	         InputChangeName(int enum_type,int enum_type_old);
+ 		void	         InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type);
+ 		void	         InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solution,int enum_type){_error_("not implemented yet");};
+-		bool	         IsInput(int name);
+ 		void           JacobianDeterminant(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss);
+ 		void           JacobianDeterminantLine(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void           JacobianDeterminantSurface(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17274)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17275)
+@@ -140,13 +140,6 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Penta::AddMaterialInput{{{*/
+-void  Penta::AddMaterialInput(int input_enum,IssmDouble* values, int interpolation_enum){
+-
+-	_assert_(this->material);
+-	this->material->inputs->AddInput(new PentaInput(input_enum,values,interpolation_enum));
+-}
+-/*}}}*/
+ /*FUNCTION Penta::BasalFrictionCreateInput {{{*/
+ void Penta::BasalFrictionCreateInput(void){
+ 
+@@ -464,8 +457,8 @@
+ 	this->inputs->AddInput(NewTemperatureInput);
+ 	this->inputs->AddInput(NewPrecipitationInput);
+ 
+-	this->InputExtrude(SurfaceforcingsMonthlytemperaturesEnum,ElementEnum);
+-	this->InputExtrude(SurfaceforcingsPrecipitationEnum,ElementEnum);
++	this->InputExtrude(SurfaceforcingsMonthlytemperaturesEnum);
++	this->InputExtrude(SurfaceforcingsPrecipitationEnum);
+ 
+ 	/*clean-up*/
+ 	delete gauss;
+@@ -973,11 +966,6 @@
+ 	return this->nodes[node_number];
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetMaterialInput(int inputenum) {{{*/
+-Input* Penta::GetMaterialInput(int inputenum){
+-	return this->material->inputs->GetInput(inputenum);
+-}
+-/*}}}*/
+ /*FUNCTION Penta::GetInputListOnVertices(IssmDouble* pvalue,int enumtype) {{{*/
+ void Penta::GetInputListOnVertices(IssmDouble* pvalue,int enumtype){
+ 
+@@ -1137,19 +1125,6 @@
+ 	*pxyz_list = xyz_list;
+ 
+ }/*}}}*/
+-/*FUNCTION Penta::GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype) {{{*/
+-void Penta::GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype){
+-
+-	Input* input=this->material->inputs->GetInput(enumtype);
+-	if(!input) _error_("No input of type " << EnumToStringx(enumtype) << " found in tria");
+-
+-	GaussPenta* gauss=new GaussPenta();
+-	gauss->GaussVertex(this->GetNodeIndex(node));
+-
+-	input->GetInputValue(pvalue,gauss);
+-	delete gauss;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::NormalSection{{{*/
+ void Penta::NormalSection(IssmDouble* normal,IssmDouble* xyz_list){
+ 
+@@ -1499,7 +1474,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION Penta::InputDepthAverageAtBase{{{*/
+-void  Penta::InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum){
++void  Penta::InputDepthAverageAtBase(int enum_type,int average_enum_type){
+ 
+ 	int  step,i;
+ 	IssmDouble  xyz_list[NUMVERTICES][3];
+@@ -1527,12 +1502,7 @@
+ 	for(;;){
+ 
+ 		/*Step1: Get original input (to be depth avegaged): */
+-		if (object_enum==MeshElementsEnum)
+-		 original_input=(Input*)penta->inputs->GetInput(enum_type);
+-		else if (object_enum==MaterialsEnum)
+-		 original_input=(Input*)penta->material->inputs->GetInput(enum_type);
+-		else
+-		 _error_("object " << EnumToStringx(object_enum) << " not supported yet");
++		original_input=(Input*)penta->inputs->GetInput(enum_type);
+ 		if(!original_input) _error_("could not find input with enum " << EnumToStringx(enum_type));
+ 
+ 		/*If first time, initialize total_integrated_input*/
+@@ -1588,12 +1558,7 @@
+ 	delete total_integrated_input;
+ 
+ 	/*Finally, add to inputs*/
+-	if (object_enum==MeshElementsEnum)
+-	 this->inputs->AddInput((Input*)depth_averaged_input);
+-	else if (object_enum==MaterialsEnum)
+-	 this->material->inputs->AddInput((Input*)depth_averaged_input);
+-	else
+-	 _error_("object " << EnumToStringx(object_enum) << " not supported yet");
++	this->inputs->AddInput((Input*)depth_averaged_input);
+ }
+ /*}}}*/
+ /*FUNCTION Penta::InputDuplicate{{{*/
+@@ -1605,7 +1570,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION Penta::InputExtrude {{{*/
+-void  Penta::InputExtrude(int enum_type,int object_type){
++void  Penta::InputExtrude(int enum_type){
+ 
+ 	int     i,num_inputs;
+ 	Penta  *penta       = NULL;
+@@ -1616,21 +1581,11 @@
+ 	if(!IsOnBed()) return;
+ 
+ 	/*Step1: Get and Extrude original input: */
+-	if(object_type==ElementEnum){
+-		num_inputs=1;
+-		base_inputs=xNew<Input*>(num_inputs);
+-		base_inputs[0]=(Input*)this->inputs->GetInput(enum_type);
+-	}
+-	else if(object_type==MaterialsEnum){
+-		num_inputs=1;
+-		base_inputs=xNew<Input*>(num_inputs);
+-		base_inputs[0]=(Input*)material->inputs->GetInput(enum_type);
+-	}
+-	else{
+-		_error_("object of type " << EnumToStringx(object_type) << " not supported yet");
+-	}
++	num_inputs=1;
++	base_inputs=xNew<Input*>(num_inputs);
++	base_inputs[0]=(Input*)this->inputs->GetInput(enum_type);
+ 	for(i=0;i<num_inputs;i++){
+-		if(!base_inputs[i]) _error_("could not find input with enum " << EnumToStringx(enum_type) << " in object " << EnumToStringx(object_type));
++		if(!base_inputs[i]) _error_("could not find input with enum " << EnumToStringx(enum_type));
+ 		base_inputs[i]->Extrude();
+ 	}
+ 
+@@ -1647,15 +1602,7 @@
+ 		/*Add input of the basal element to penta->inputs*/
+ 		for(i=0;i<num_inputs;i++){
+ 			copy=(Input*)base_inputs[i]->copy();
+-			if (object_type==ElementEnum){
+-				penta->inputs->AddInput((Input*)copy);
+-			}
+-			else if(object_type==MaterialsEnum){
+-				penta->material->inputs->AddInput((Input*)copy);
+-			}
+-			else{
+-				_error_("object of type " << EnumToStringx(object_type) << " not supported yet");
+-			}
++			penta->inputs->AddInput((Input*)copy);
+ 		}
+ 
+ 		/*Stop if we have reached the surface*/
+@@ -1773,9 +1720,22 @@
+ 						this->inputs->AddInput(new ControlInput(FrictionCoefficientEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+ 					}
+ 					break;
+-				/*Material will take care of it*/ 
+-				case MaterialsRheologyBbarEnum: break;
+-				case DamageDbarEnum:break;
++				case MaterialsRheologyBbarEnum:
++					if(iomodel->Data(MaterialsRheologyBEnum)){
++						for(j=0;j<6;j++) nodeinputs[j]=iomodel->Data(MaterialsRheologyBEnum)[penta_vertex_ids[j]-1];
++						for(j=0;j<6;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
++						for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
++						this->inputs->AddInput(new ControlInput(MaterialsRheologyBEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
++					}
++					break;
++				case DamageDbarEnum:
++					if(iomodel->Data(DamageDEnum)){
++						for(j=0;j<6;j++) nodeinputs[j]=iomodel->Data(DamageDEnum)[penta_vertex_ids[j]-1];
++						for(j=0;j<6;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
++						for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
++						this->inputs->AddInput(new ControlInput(DamageDEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
++					}
++					break;
+ 				default:
+ 					_error_("Control " << EnumToStringx(reCast<int,IssmDouble>(iomodel->Data(InversionControlParametersEnum)[i])) << " not implemented yet");
+ 			}
+@@ -1945,74 +1905,6 @@
+ 	return onsurface;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::IsInput{{{*/
+-bool Penta::IsInput(int name){
+-	if (
+-				name==ThicknessEnum ||
+-				name==SurfaceEnum ||
+-				name==BedEnum ||
+-				name==BathymetryEnum ||
+-				name==SurfaceSlopeXEnum ||
+-				name==SurfaceSlopeYEnum ||
+-				name==SurfaceforcingsMassBalanceEnum ||
+-				name==BasalforcingsMeltingRateEnum ||
+-				name==BasalforcingsGeothermalfluxEnum ||
+-				name==SurfaceAreaEnum||
+-				name==PressureEnum ||
+-				name==VxEnum ||
+-				name==VyEnum ||
+-				name==VzEnum ||
+-				name==VxMeshEnum ||
+-				name==VyMeshEnum ||
+-				name==VzMeshEnum ||
+-				name==InversionVxObsEnum ||
+-				name==InversionVyObsEnum ||
+-				name==InversionVzObsEnum ||
+-				name==TemperatureEnum ||
+-				name==EnthalpyEnum ||
+-				name==EnthalpyPicardEnum ||
+-				name==WaterfractionEnum||
+-				name==FrictionCoefficientEnum ||
+-				name==MaskGroundediceLevelsetEnum ||
+-				name==MaskIceLevelsetEnum ||
+-				name==IceMaskNodeActivationEnum ||
+-				name==LevelsetfunctionSlopeXEnum ||
+-				name==LevelsetfunctionSlopeYEnum ||
+-				name==GradientEnum ||
+-				name==OldGradientEnum  ||
+-				name==ConvergedEnum || 
+-				name==QmuVxEnum ||
+-				name==QmuVyEnum ||
+-				name==QmuVzEnum ||
+-				name==QmuVxMeshEnum ||
+-				name==QmuVyMeshEnum ||
+-				name==QmuVzMeshEnum ||
+-				name==QmuPressureEnum ||
+-				name==QmuBedEnum ||
+-				name==QmuThicknessEnum ||
+-				name==QmuSurfaceEnum ||
+-				name==QmuTemperatureEnum ||
+-				name==QmuMeltingEnum ||
+-				name==QmuMaskGroundediceLevelsetEnum ||
+-				name==QmuMaskIceLevelsetEnum ||
+-				name==GiaWEnum || 
+-				name==GiadWdtEnum ||
+-				name==SedimentHeadEnum ||
+-				name==EplHeadEnum ||
+-				name==SedimentHeadOldEnum ||
+-				name==EplHeadOldEnum ||
+-				name==HydrologydcEplThicknessOldEnum ||
+-				name==HydrologydcEplInitialThicknessEnum ||
+-				name==HydrologydcEplThicknessEnum ||
+-				name==HydrologydcMaskEplactiveNodeEnum ||
+-				name==WaterTransferEnum
+-
+-				) {
+-		return true;
+-	}
+-	else return false;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::IsNodeOnShelfFromFlags {{{*/
+ bool   Penta::IsNodeOnShelfFromFlags(IssmDouble* flags){
+ 
+@@ -2353,7 +2245,7 @@
+    /*Update inputs*/    
+    this->inputs->AddInput(new PentaInput(SurfaceforcingsMassBalanceEnum,&agd[0],P1Enum));
+    //this->inputs->AddInput(new PentaVertexInput(ThermalSpcTemperatureEnum,&Tsurf[0]));
+-   this->InputExtrude(SurfaceforcingsMassBalanceEnum,ElementEnum);
++   this->InputExtrude(SurfaceforcingsMassBalanceEnum);
+ 
+ 	/*clean-up*/
+ 	delete gauss;
+@@ -2578,9 +2470,7 @@
+ 	this->SpawnTriaHook(dynamic_cast<ElementHook*>(tria),location);
+ 
+ 	/*Spawn material*/
+-	tria->material=(Material*)this->material->copy();
+-	delete tria->material->inputs;
+-	tria->material->inputs=(Inputs*)this->material->inputs->SpawnTriaInputs(location);
++	tria->material=(Material*)this->material->copy(tria);
+ 
+ 	/*recover nodes, material and matpar: */
+ 	tria->nodes=(Node**)tria->hnodes[analysis_counter]->deliverp();
+@@ -2596,13 +2486,13 @@
+ 
+ 	_assert_(this->IsOnBed());
+ 
+-	this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum,MaterialsEnum);
+-	this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum,MaterialsEnum);
++	this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum);
++	this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum);
+ 	if(this->inputs->GetInput(VxEnum)) this->InputDepthAverageAtBase(VxEnum,VxAverageEnum);
+ 	if(this->inputs->GetInput(VyEnum)) this->InputDepthAverageAtBase(VyEnum,VyAverageEnum);
+ 	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	this->material->inputs->DeleteInput(MaterialsRheologyBbarEnum);
+-	this->material->inputs->DeleteInput(DamageDbarEnum);
++	this->inputs->DeleteInput(MaterialsRheologyBbarEnum);
++	this->inputs->DeleteInput(DamageDbarEnum);
+ 	this->inputs->DeleteInput(VxAverageEnum);
+ 	this->inputs->DeleteInput(VyAverageEnum);
+ 
+@@ -3490,11 +3380,11 @@
+ 
+ 	if(enum_type==MaterialsRheologyBbarEnum){
+ 		if(!IsOnBed()) return;
+-		input=(Input*)material->inputs->GetInput(MaterialsRheologyBEnum);
++		input=(Input*)inputs->GetInput(MaterialsRheologyBEnum);
+ 	}
+ 	else if(enum_type==DamageDbarEnum){
+ 		if(!IsOnBed()) return;
+-		input=(Input*)material->inputs->GetInput(DamageDEnum);
++		input=(Input*)inputs->GetInput(DamageDEnum);
+ 	}
+ 	else{
+ 		input=inputs->GetInput(enum_type);
+@@ -3512,10 +3402,10 @@
+ 	Input* input=NULL;
+ 
+ 	if(enum_type==MaterialsRheologyBbarEnum){
+-		input=(Input*)material->inputs->GetInput(MaterialsRheologyBEnum);
++		input=(Input*)inputs->GetInput(MaterialsRheologyBEnum);
+ 	}
+ 	else if(enum_type==DamageDbarEnum){
+-		input=(Input*)material->inputs->GetInput(DamageDEnum);
++		input=(Input*)inputs->GetInput(DamageDEnum);
+ 	}
+ 	else{
+ 		input=inputs->GetInput(enum_type);
+@@ -3534,10 +3424,10 @@
+ 	Input* input=NULL;
+ 
+ 	if(enum_type==MaterialsRheologyBbarEnum){
+-		input=(Input*)material->inputs->GetInput(MaterialsRheologyBEnum);
++		input=(Input*)inputs->GetInput(MaterialsRheologyBEnum);
+ 	}
+ 	else if(enum_type==DamageDbarEnum){
+-		input=(Input*)material->inputs->GetInput(DamageDEnum);
++		input=(Input*)inputs->GetInput(DamageDEnum);
+ 	}
+ 	else{
+ 		input=inputs->GetInput(enum_type);
+@@ -3557,10 +3447,10 @@
+ 	Input* input=NULL;
+ 
+ 	if(control_enum==MaterialsRheologyBbarEnum){
+-		input=(Input*)material->inputs->GetInput(MaterialsRheologyBEnum);
++		input=(Input*)inputs->GetInput(MaterialsRheologyBEnum);
+ 	}
+ 	else if(control_enum==DamageDbarEnum){
+-		input=(Input*)material->inputs->GetInput(DamageDEnum);
++		input=(Input*)inputs->GetInput(DamageDEnum);
+ 	}
+ 	else{
+ 		input=inputs->GetInput(control_enum);
+@@ -3882,8 +3772,8 @@
+ 	if (!IsOnBed()) return; 
+ 
+ 	/*Depth Average B*/
+-	this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum,MaterialsEnum);
+-	this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum,MaterialsEnum);
++	this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum);
++	this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum);
+ 
+ 	/*Collapse element to the base*/
+ 	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+@@ -3891,8 +3781,8 @@
+ 	delete tria->material; delete tria;
+ 
+ 	/*delete Average B*/
+-	this->material->inputs->DeleteInput(MaterialsRheologyBbarEnum);
+-	this->material->inputs->DeleteInput(DamageDbarEnum);
++	this->inputs->DeleteInput(MaterialsRheologyBbarEnum);
++	this->inputs->DeleteInput(DamageDbarEnum);
+ 
+ } /*}}}*/
+ /*FUNCTION Penta::GradjBbarHO {{{*/
+@@ -3902,8 +3792,8 @@
+ 	if (!IsOnBed()) return;
+ 
+ 	/*Depth Average B and D*/
+-	this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum,MaterialsEnum);
+-	this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum,MaterialsEnum);
++	this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum);
++	this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum);
+ 
+ 	/*Collapse element to the base*/
+ 	Tria* tria=(Tria*)SpawnTria(0);
+@@ -3911,8 +3801,8 @@
+ 	delete tria->material; delete tria;
+ 
+ 	/*delete Average B*/
+-	this->material->inputs->DeleteInput(MaterialsRheologyBbarEnum);
+-	this->material->inputs->DeleteInput(DamageDbarEnum);
++	this->inputs->DeleteInput(MaterialsRheologyBbarEnum);
++	this->inputs->DeleteInput(DamageDbarEnum);
+ } /*}}}*/
+ /*FUNCTION Penta::GradjBbarFS {{{*/
+ void  Penta::GradjBbarFS(Vector<IssmDouble>* gradient,int control_index){
+@@ -3921,8 +3811,8 @@
+ 	if (!IsOnBed()) return;
+ 
+ 	/*Depth Average B and D*/
+-	this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum,MaterialsEnum);
+-	this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum,MaterialsEnum);
++	this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum);
++	this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum);
+ 
+ 	/*Collapse element to the base*/
+ 	Tria* tria=(Tria*)SpawnTria(0);
+@@ -3930,8 +3820,8 @@
+ 	delete tria->material; delete tria;
+ 
+ 	/*delete Average B*/
+-	this->material->inputs->DeleteInput(MaterialsRheologyBbarEnum);
+-	this->material->inputs->DeleteInput(DamageDbarEnum);
++	this->inputs->DeleteInput(MaterialsRheologyBbarEnum);
++	this->inputs->DeleteInput(DamageDbarEnum);
+ } /*}}}*/
+ /*FUNCTION Penta::InputControlUpdate{{{*/
+ void  Penta::InputControlUpdate(IssmDouble scalar,bool save_parameter){
+@@ -3949,27 +3839,26 @@
+ 
+ 		if(control_type[i]==MaterialsRheologyBbarEnum){
+ 			if (!IsOnBed()) goto cleanup_and_return;
+-			input=(Input*)material->inputs->GetInput(MaterialsRheologyBEnum); _assert_(input);
++			input=(Input*)this->inputs->GetInput(MaterialsRheologyBEnum); _assert_(input);
+ 		}
+ 		else if(control_type[i]==DamageDbarEnum){
+ 			if (!IsOnBed()) goto cleanup_and_return;
+-			input=(Input*)material->inputs->GetInput(DamageDEnum); _assert_(input);
++			input=(Input*)this->inputs->GetInput(DamageDEnum); _assert_(input);
+ 		}
+ 		else{
+ 			input=(Input*)this->inputs->GetInput(control_type[i]); _assert_(input);
+ 		}
++		if(input->ObjectEnum()!=ControlInputEnum) _error_("input " << EnumToStringx(control_type[i]) << " is not a ControlInput");
+ 
+-		if (input->ObjectEnum()!=ControlInputEnum) _error_("input " << EnumToStringx(control_type[i]) << " is not a ControlInput");
+-
+ 		((ControlInput*)input)->UpdateValue(scalar);
+ 		((ControlInput*)input)->Constrain();
+ 		if (save_parameter) ((ControlInput*)input)->SaveValue();
+ 
+ 		if(control_type[i]==MaterialsRheologyBbarEnum){
+-			this->InputExtrude(MaterialsRheologyBEnum,MaterialsEnum);
++			this->InputExtrude(MaterialsRheologyBEnum);
+ 		}
+ 		else if(control_type[i]==DamageDbarEnum){
+-			this->InputExtrude(DamageDEnum,MaterialsEnum);
++			this->InputExtrude(DamageDEnum);
+ 		}
+ 	}
+ 
+@@ -4263,14 +4152,8 @@
+ 		values[i]=vector[vertexpidlist[i]];
+ 	}
+ 	new_input = new PentaInput(control_enum,values,P1Enum);
++	input=(Input*)this->inputs->GetInput(control_enum);   _assert_(input);
+ 
+-	if(control_enum==MaterialsRheologyBbarEnum){
+-		input=(Input*)material->inputs->GetInput(control_enum); _assert_(input);
+-	}
+-	else{
+-		input=(Input*)this->inputs->GetInput(control_enum);   _assert_(input);
+-	}
+-
+ 	if (input->ObjectEnum()!=ControlInputEnum){
+ 		_error_("input " << EnumToStringx(control_enum) << " is not a ControlInput");
+ 	}
+@@ -4368,8 +4251,8 @@
+ 					this->inputs->AddInput(new PentaInput(ThicknessEnum,thickness,P1Enum));
+ 					this->inputs->AddInput(new PentaInput(BedEnum,bed,P1Enum));
+ 					this->inputs->AddInput(new PentaInput(SurfaceEnum,surface,P1Enum));
+-
+ 					break;
++
+ 				default:
+ 					this->inputs->AddInput(new PentaInput(name,values,P1Enum));
+ 			}
+@@ -4655,7 +4538,7 @@
+ 		else phi[i]=h[i]+r[i]/density;
+ 	}
+ 	this->inputs->AddInput(new PentaInput(MaskGroundediceLevelsetEnum,&phi[0],P1Enum));
+-	this->InputExtrude(MaskGroundediceLevelsetEnum,ElementEnum);
++	this->InputExtrude(MaskGroundediceLevelsetEnum);
+ 
+ 	/*SubelementMigrationEnum: if one grounded, all grounded*/
+ 	if(migration_style==SubelementMigrationEnum || migration_style==SubelementMigration2Enum){
+@@ -4687,8 +4570,8 @@
+ 	this->inputs->AddInput(new PentaInput(BedEnum,&b[0],P1Enum));
+ 
+ 	/*Extrude inputs*/
+-	this->InputExtrude(SurfaceEnum,ElementEnum);
+-	this->InputExtrude(BedEnum,ElementEnum);
++	this->InputExtrude(SurfaceEnum);
++	this->InputExtrude(BedEnum);
+ }
+ /*}}}*/
+ /*FUNCTION Penta::PotentialUngrounding{{{*/
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17274)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17275)
+@@ -104,7 +104,7 @@
+ 
+ 		int    Sid();
+ 		void   InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);
+-		void   InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum=MeshElementsEnum);
++		void   InputDepthAverageAtBase(int enum_type,int average_enum_type);
+ 		void   InputDuplicate(int original_enum,int new_enum);
+ 		void   InputScale(int enum_type,IssmDouble scale_factor);
+ 		int    NumberofNodesVelocity(void);
+@@ -194,7 +194,6 @@
+ 		/*Penta specific routines:{{{*/
+ 		void           AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		void           AddInput(int input_enum, IssmDouble* values, int interpolation_enum);
+-		void           AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		void	         NormalBase(IssmDouble* bed_normal, IssmDouble* xyz_list);
+ 		void           NormalSection(IssmDouble* normal,IssmDouble* xyz_list);
+ 		void	         NormalTop(IssmDouble* bed_normal, IssmDouble* xyz_list);
+@@ -205,7 +204,6 @@
+ 
+ 		void	         GetVertexPidList(int* doflist);
+ 		int            GetElementType(void);
+-		Input*         GetMaterialInput(int inputenum);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype);
+ 		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue);
+ 		void           GetInputListOnNodes(IssmDouble* pvalue,int enumtype);
+@@ -215,13 +213,11 @@
+ 		void           GetInputValue(int* pvalue,int enum_type);
+ 		void           GetInputValue(IssmDouble* pvalue,int enum_type);
+ 		void           GetInputValue(IssmDouble* pvalue,Gauss* gauss,int enum_type);
+-		void           GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype);
+ 		Node*          GetNode(int node_number);
+ 		void           InputChangeName(int input_enum, int enum_type_old);
+-		void	         InputExtrude(int enum_type,int object_type);
++		void	         InputExtrude(int enum_type);
+ 		void           InputUpdateFromSolutionOneDof(IssmDouble* solutiong,int enum_type);
+ 		void           InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solutiong,int enum_type);
+-		bool	         IsInput(int name);
+ 		bool	         IsOnSurface(void);
+ 		bool	         IsOnBed(void);
+ 		bool           IsNodeOnShelfFromFlags(IssmDouble* flags);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17274)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17275)
+@@ -60,7 +60,6 @@
+ 		/*Element virtual functions definitions: {{{*/
+ 		void        AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
+ 		void        AddInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
+-		void        AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
+ 		IssmDouble  CharacteristicLength(void);
+ 		void        ComputeBasalStress(Vector<IssmDouble>* sigma_b){_error_("not implemented yet");};
+ 		void        ComputeStrainRate(Vector<IssmDouble>* eps){_error_("not implemented yet");};
+@@ -129,7 +128,6 @@
+ 		int         VelocityInterpolation(void){_error_("not implemented yet");};
+ 		void        GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating){_error_("not implemented yet");};
+ 		IssmDouble  GetGroundedPortion(IssmDouble* xyz_list){_error_("not implemented yet");};
+-		Input*      GetMaterialInput(int inputenum){_error_("not implemented yet");};
+ 		void        GetInputListOnVertices(IssmDouble* pvalue,int enumtype){_error_("not implemented yet");};
+ 		void        GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){_error_("not implemented yet");};
+ 		void        GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");};
+@@ -137,7 +135,6 @@
+ 		void        GetInputValue(int* pvalue,int enum_type){_error_("not implemented yet");};
+ 		void        GetInputValue(IssmDouble* pvalue,int enum_type){_error_("not implemented yet");};
+ 		void        GetInputValue(IssmDouble* pvalue,Gauss* gauss,int enum_type){_error_("not implemented yet");};
+-		void        GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");};
+ 		Node*       GetNode(int node_number){_error_("Not implemented");};
+ 		IssmDouble  GetXcoord(Gauss* gauss){_error_("Not implemented");};
+ 		IssmDouble  GetYcoord(Gauss* gauss){_error_("Not implemented");};
+@@ -172,7 +169,7 @@
+ 		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type){_error_("not implemented yet");};
+ 		void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum){_error_("not implemented yet");};
+ 		void        InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){_error_("not implemented yet");};
+-		void        InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum=MeshElementsEnum){_error_("not implemented yet");};
++		void        InputDepthAverageAtBase(int enum_type,int average_enum_type){_error_("not implemented yet");};
+ 		void        InputDuplicate(int original_enum,int new_enum){_error_("not implemented yet");};
+ 		void        InputScale(int enum_type,IssmDouble scale_factor){_error_("not implemented yet");};
+ 		void        MaterialUpdateFromTemperature(void){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17274)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17275)
+@@ -154,8 +154,7 @@
+ 		default:
+ 			return this->matpar->GetMaterialParameter(enum_in);
+ 	}
+-}
+-/*}}}*/
++}/*}}}*/
+ void Element::GetPhi(IssmDouble* phi, IssmDouble*  epsilon, IssmDouble viscosity){/*{{{*/
+ 	/*Compute deformational heating from epsilon and viscosity */
+ 
+@@ -226,6 +225,81 @@
+ 
+ 	return shelf;
+ }/*}}}*/
++bool Element::IsInput(int name){/*{{{*/
++	if (
++				name==ThicknessEnum ||
++				name==SurfaceEnum ||
++				name==BedEnum ||
++				name==BathymetryEnum ||
++				name==SurfaceSlopeXEnum ||
++				name==SurfaceSlopeYEnum ||
++				name==SurfaceforcingsMassBalanceEnum ||
++				name==BasalforcingsMeltingRateEnum ||
++				name==BasalforcingsGeothermalfluxEnum ||
++				name==SurfaceAreaEnum||
++				name==DamageDEnum ||
++				name==DamageDbarEnum ||
++				name==PressureEnum ||
++				name==VxEnum ||
++				name==VyEnum ||
++				name==VzEnum ||
++				name==VxMeshEnum ||
++				name==VyMeshEnum ||
++				name==VzMeshEnum ||
++				name==InversionVxObsEnum ||
++				name==InversionVyObsEnum ||
++				name==InversionVzObsEnum ||
++				name==TemperatureEnum ||
++				name==EnthalpyEnum ||
++				name==EnthalpyPicardEnum ||
++				name==WaterfractionEnum||
++				name==WatercolumnEnum || 
++				name==FrictionCoefficientEnum ||
++				name==MaskGroundediceLevelsetEnum ||
++				name==MaskIceLevelsetEnum ||
++				name==IceMaskNodeActivationEnum ||
++				name==LevelsetfunctionSlopeXEnum ||
++				name==LevelsetfunctionSlopeYEnum ||
++				name==GradientEnum ||
++				name==OldGradientEnum  ||
++				name==ConvergedEnum || 
++				name==QmuVxEnum ||
++				name==QmuVyEnum ||
++				name==QmuVzEnum ||
++				name==QmuVxMeshEnum ||
++				name==QmuVyMeshEnum ||
++				name==QmuVzMeshEnum ||
++				name==QmuPressureEnum ||
++				name==QmuBedEnum ||
++				name==QmuThicknessEnum ||
++				name==QmuSurfaceEnum ||
++				name==QmuTemperatureEnum ||
++				name==QmuMeltingEnum ||
++				name==QmuMaskGroundediceLevelsetEnum ||
++				name==QmuMaskIceLevelsetEnum ||
++				name==QmuMaterialsRheologyBEnum ||
++				name==MaterialsRheologyBEnum ||
++				name==MaterialsRheologyBbarEnum ||
++				name==MaterialsRheologyNEnum ||
++				name==GiaWEnum || 
++				name==GiadWdtEnum ||
++				name==SedimentHeadEnum ||
++				name==EplHeadEnum ||
++				name==SedimentHeadOldEnum ||
++				name==EplHeadOldEnum ||
++				name==HydrologydcEplThicknessOldEnum ||
++				name==HydrologydcEplInitialThicknessEnum ||
++				name==HydrologydcEplThicknessEnum ||
++				name==HydrologydcMaskEplactiveNodeEnum ||
++				name==MeshVertexonbedEnum ||
++				name==WaterTransferEnum
++
++				) {
++					return true;
++				}
++	else return false;
++}
++/*}}}*/
+ void Element::ResultInterpolation(int* pinterpolation,int* pnodesperelement,int output_enum){/*{{{*/
+ 
+ 	Input* input=this->inputs->GetInput(output_enum);
Index: issm/oecreview/Archive/16554-17801/ISSM-17275-17276.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17275-17276.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17275-17276.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17275)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17276)
+@@ -2890,7 +2890,7 @@
+ 			forcex=fx1(x_coord,y_coord,z_coord);
+ 			forcey=fy1(x_coord,y_coord,z_coord);
+ 			forcez=fz1(x_coord,y_coord,z_coord);
+-		#elseif FSANALYTICAL == 2
++		#elif FSANALYTICAL == 2
+ 			forcex=fx2(x_coord,y_coord,z_coord);
+ 			forcey=fy2(x_coord,y_coord,z_coord);
+ 			forcez=fz2(x_coord,y_coord,z_coord);
Index: issm/oecreview/Archive/16554-17801/ISSM-17276-17277.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17276-17277.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17276-17277.diff	(revision 17802)
@@ -0,0 +1,38 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17276)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17277)
+@@ -1043,8 +1043,12 @@
+ }/*}}}*/
+ void StressbalanceAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+ 	/*Default, do nothing*/
+-	//_printf0_("   Updating active and non-active nodes for StressbalanceAnalysis \n");
+-//	SetActiveNodesLSMx(femmodel->elements);
++	bool islevelset;
++	femmodel->parameters->FindParam(&islevelset,TransientIslevelsetEnum);
++	if(islevelset){
++		_printf0_("   Updating active and non-active nodes for StressbalanceAnalysis \n");
++		SetActiveNodesLSMx(femmodel->elements);
++	}
+ 	return;
+ }/*}}}*/
+ 
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17276)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17277)
+@@ -710,7 +710,12 @@
+ 	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ }/*}}}*/
+ void MasstransportAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+-//	_printf0_("   Updating active and non-active nodes for MasstransportAnalysis \n");
+-//	SetActiveNodesLSMx(femmodel->elements);
++
++	bool islevelset;
++	femmodel->parameters->FindParam(&islevelset,TransientIslevelsetEnum);
++	if(islevelset){
++		_printf0_("   Updating active and non-active nodes for MasstransportAnalysis \n");
++		SetActiveNodesLSMx(femmodel->elements);
++	}
+ 	return;
+ }/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17277-17278.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17277-17278.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17277-17278.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp	(revision 17277)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp	(revision 17278)
+@@ -59,7 +59,7 @@
+ 					elements->InputDuplicate(DamageDEnum,DamageDbarEnum);
+ 					if(dakota_analysis) elements->InputDuplicate(MaterialsRheologyBbarEnum,QmuMaterialsRheologyBEnum);
+ 					break;
+-				case Mesh3DEnum:
++				case Mesh3DEnum: case Mesh2DverticalEnum:
+ 					if(dakota_analysis) elements->InputDuplicate(MaterialsRheologyBEnum,QmuMaterialsRheologyBEnum); 
+ 					break;
+ 				default:
Index: issm/oecreview/Archive/16554-17801/ISSM-17278-17279.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17278-17279.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17278-17279.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/cores/stressbalance_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/stressbalance_core.cpp	(revision 17278)
++++ ../trunk-jpl/src/c/cores/stressbalance_core.cpp	(revision 17279)
+@@ -39,7 +39,7 @@
+ 	if(dakota_analysis && solution_type==StressbalanceSolutionEnum){
+ 		InputDuplicatex(femmodel,QmuVxEnum,VxEnum);
+ 		InputDuplicatex(femmodel,QmuVyEnum,VyEnum);
+-		InputDuplicatex(femmodel,QmuVzEnum,VzEnum);
++		if(meshtype==Mesh3DEnum) InputDuplicatex(femmodel,QmuVzEnum,VzEnum);
+ 		if(isFS) InputDuplicatex(femmodel,QmuPressureEnum,PressureEnum);
+ 	}
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17279-17280.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17279-17280.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17279-17280.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/externalpackages/adjoinablempi/install.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/adjoinablempi/install.sh	(revision 17279)
++++ ../trunk-jpl/externalpackages/adjoinablempi/install.sh	(revision 17280)
+@@ -1,6 +1,6 @@
+ #!/bin/bash
+ set -eu
+- 
++
+ #Some cleanup
+ rm -rf src  install
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17280-17281.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17280-17281.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17280-17281.diff	(revision 17802)
@@ -0,0 +1,80 @@
+Index: ../trunk-jpl/src/c/classes/Materials/Matice.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 17280)
++++ ../trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 17281)
+@@ -104,8 +104,8 @@
+ 	return matice;
+ }
+ /*}}}*/
+-/*FUNCTION Matice::copy(Element* element) {{{*/
+-Material* Matice::copy(Element* element_in) {
++/*FUNCTION Matice::copy2(Element* element) {{{*/
++Material* Matice::copy2(Element* element_in) {
+ 
+ 	/*Output*/
+ 	Matice* matice=NULL;
+Index: ../trunk-jpl/src/c/classes/Materials/Material.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Material.h	(revision 17280)
++++ ../trunk-jpl/src/c/classes/Materials/Material.h	(revision 17281)
+@@ -22,7 +22,7 @@
+ 		/*WARNING: input should not be public but it is an easy way to update B from T (using UpdateFromSolution) from Pentas*/
+ 
+ 		/*Numerics*/
+-		virtual Material*  copy(Element* element)=0;
++		virtual Material*  copy2(Element* element)=0;
+ 		virtual void       Configure(Elements* elements)=0;
+ 		virtual void       GetViscosity(IssmDouble* pviscosity,IssmDouble epseff)=0;
+ 		virtual void       GetViscosityBar(IssmDouble* pviscosity,IssmDouble epseff)=0;
+Index: ../trunk-jpl/src/c/classes/Materials/Matice.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matice.h	(revision 17280)
++++ ../trunk-jpl/src/c/classes/Materials/Matice.h	(revision 17281)
+@@ -50,7 +50,7 @@
+ 		/*}}}*/
+ 		/*Material virtual functions resolution: {{{*/
+ 		void   Configure(Elements* elements);
+-		Material*  copy(Element* element);
++		Material*  copy2(Element* element);
+ 		void       SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
+ 		void       GetViscosity(IssmDouble* pviscosity, IssmDouble eps_eff);
+ 		void       GetViscosityBar(IssmDouble* pviscosity, IssmDouble eps_eff);
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 17280)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 17281)
+@@ -78,7 +78,7 @@
+ 		void   InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented");};
+ 		/*}}}*/
+ 		/*Material virtual functions resolution: {{{*/
+-		Material*  copy(Element* element){_error_("not implemented");};
++		Material*  copy2(Element* element){_error_("not implemented");};
+ 		void       Configure(Elements* elements);
+ 		void       GetViscosity(IssmDouble* pviscosity,IssmDouble eps_eff){_error_("not supported");};
+ 		void       GetViscosityBar(IssmDouble* pviscosity,IssmDouble eps_eff){_error_("not supported");};
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17280)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17281)
+@@ -2209,7 +2209,7 @@
+ 	this->SpawnSegHook(dynamic_cast<ElementHook*>(seg),index1,index2);
+ 
+ 	/*Spawn material*/
+-	seg->material=(Material*)this->material->copy(seg);
++	seg->material=(Material*)this->material->copy2(seg);
+ 
+ 	/*recover nodes, material and matpar: */
+ 	seg->nodes    = (Node**)seg->hnodes[analysis_counter]->deliverp();
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17280)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17281)
+@@ -2470,7 +2470,7 @@
+ 	this->SpawnTriaHook(dynamic_cast<ElementHook*>(tria),location);
+ 
+ 	/*Spawn material*/
+-	tria->material=(Material*)this->material->copy(tria);
++	tria->material=(Material*)this->material->copy2(tria);
+ 
+ 	/*recover nodes, material and matpar: */
+ 	tria->nodes=(Node**)tria->hnodes[analysis_counter]->deliverp();
Index: issm/oecreview/Archive/16554-17801/ISSM-17281-17282.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17281-17282.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17281-17282.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/test/Archives/Archive336.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17281)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17282)
+@@ -149,7 +149,7 @@
+ 					&Ke->values[0],1);
+ 
+ 		/* Stabilization */
+-		int stabilization=1;
++		int stabilization=2;
+ 		switch(stabilization){
+ 			case 0:
+ 				// no stabilization, do nothing
+@@ -197,8 +197,6 @@
+ 	xDelete<IssmDouble>(B);
+ 	xDelete<IssmDouble>(Bprime);
+ 	delete gauss;
+-
+-// 	Ke->Echo();
+ 	return Ke;
+ }/*}}}*/
+ ElementVector* LevelsetAnalysis::CreatePVector(Element* element){/*{{{*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17282-17283.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17282-17283.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17282-17283.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/classes/mask.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/mask.py	(revision 17282)
++++ ../trunk-jpl/src/m/classes/mask.py	(revision 17283)
+@@ -45,7 +45,7 @@
+ 		WriteData(fid,'object',self,'fieldname','ice_levelset','format','DoubleMat','mattype',1)
+ 
+ 		# get mask of vertices of elements with ice
+-		isice=numpy.array(md.mask.ice_levelset<=0.,int)
++		isice=numpy.array(md.mask.ice_levelset<0.,int)
+ 		vlist = numpy.zeros((md.mesh.numberofvertices,1), dtype=int)
+ 		pos=numpy.nonzero(numpy.sum(isice[md.mesh.elements-1],axis=1))[0]
+ 		vlist[md.mesh.elements[pos,:]-1]=1
Index: issm/oecreview/Archive/16554-17801/ISSM-17283-17284.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17283-17284.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17283-17284.diff	(revision 17802)
@@ -0,0 +1,16 @@
+Index: ../trunk-jpl/src/m/mech/robintemperature.m
+===================================================================
+--- ../trunk-jpl/src/m/mech/robintemperature.m	(revision 17283)
++++ ../trunk-jpl/src/m/mech/robintemperature.m	(revision 17284)
+@@ -34,9 +34,9 @@
+ rho=917; % ice density (kg m^-3)
+ 
+ %create vertical coordinate variable
+-zstar=sqrt(2*alphaT*thickness/accumrate);
++zstar=sqrt(2*alphaT*thickness./accumrate);
+ 
+-tprofile=surftemp+sqrt(2*thickness*pi/accumrate/alphaT)*(-heatflux)/2/rho/c.*(erf(z./zstar)-erf(thickness./zstar));
++tprofile=surftemp+sqrt(2*thickness*pi./accumrate/alphaT).*(-heatflux)/2/rho/c.*(erf(z./zstar)-erf(thickness./zstar));
+ 
+ % difference between surface and base temperature for check (Cuffey2010 p412):
+ % tprofile-surftemp
Index: issm/oecreview/Archive/16554-17801/ISSM-17284-17285.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17284-17285.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17284-17285.diff	(revision 17802)
@@ -0,0 +1,56 @@
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h	(revision 17284)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h	(revision 17285)
+@@ -13,5 +13,7 @@
+ IssmDouble fx2(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+ IssmDouble fy2(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+ IssmDouble fz2(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
++IssmDouble fx3(IssmDouble x_coord, IssmDouble y_coord);
++IssmDouble fy3(IssmDouble x_coord, IssmDouble y_coord);
+ 
+ #endif //ifndef _SHARED_ANALYTICALS_H_
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp	(revision 0)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp	(revision 17285)
+@@ -0,0 +1,27 @@
++/*!\file fx.cpp
++ * \brief: analytical fonction for FS 
++ * test case for a cube with Dirichlet conditions on all faces and no variation in z
++ */
++
++#include <math.h>
++#include "../Numerics/types.h"
++#include "../Numerics/constants.h"
++
++IssmDouble fx2(IssmDouble x,IssmDouble y{   
++	IssmDouble p = 2.0;  
++	IssmDouble q = 2.0;   
++	IssmDouble functionx;
++
++	functionx =  -2*(z-1)*(z-1)*(x-1)*(2*x-1)*z-4*(z-1)*(z-1)*(x-1)*x*z-2*(z-1)*(z-1)*(2*x-1)*x*z +4*(z-1)*(2*z-1)*(x-1)*(x-1)*z+16*(z-1)*(2*z-1)*(x-1)*x*z+4*(z-1)*(2*z-1)*x*x*z +4*(z-1)*(x-1)*(x-1)*x*x-2*(z-1)*(x-1)*(2*x-1)*z*z-4*(z-1)*(x-1)*x*z*z -2*(z-1)*(2*x-1)*x*z*z+2*(2*z-1)*(x-1)*(x-1)*x*x+4*(x-1)*(x-1)*x*x*z+z-1/2;
++
++	return functionx;
++}
++IssmDouble fy2(IssmDouble x,IssmDouble y){   
++	IssmDouble p = 2.0;  
++	IssmDouble q = 2.0;   
++	IssmDouble functiony;
++
++	functiony = -4*(z-1)*(z-1)*(x-1)*(2*x-1)*x-4*(z-1)*(z-1)*(x-1)*z*z-2*(z-1)*(z-1)*(2*x-1)*z*z -4*(z-1)*(z-1)*x*z*z+2*(z-1)*(2*z-1)*(x-1)*(x-1)*x+2*(z-1)*(2*z-1)*(x-1)*x*x +4*(z-1)*(x-1)*(x-1)*x*z-16*(z-1)*(x-1)*(2*x-1)*x*z+4*(z-1)*(x-1)*x*x*z +2*(2*z-1)*(x-1)*(x-1)*x*z+2*(2*z-1)*(x-1)*x*x*z -4*(x-1)*(2*x-1)*x*z*z+x-1/2;
++
++	return functiony;
++}
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17284)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17285)
+@@ -179,6 +179,7 @@
+ 					./shared/FSanalyticals/fsanalyticals.h\
+ 					./shared/FSanalyticals/FSanalytical1.cpp\
+ 					./shared/FSanalyticals/FSanalytical2.cpp\
++					./shared/FSanalyticals/FSanalytical3.cpp\
+ 					./shared/Enum/Enum.h\
+ 					./shared/Enum/EnumDefinitions.h\
+ 					./shared/Enum/EnumToStringx.cpp\
Index: issm/oecreview/Archive/16554-17801/ISSM-17285-17286.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17285-17286.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17285-17286.diff	(revision 17802)
@@ -0,0 +1,23 @@
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp	(revision 17285)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp	(revision 17286)
+@@ -12,8 +12,7 @@
+ 	IssmDouble q = 2.0;   
+ 	IssmDouble functionx;
+ 
+-	functionx =  -2*(z-1)*(z-1)*(x-1)*(2*x-1)*z-4*(z-1)*(z-1)*(x-1)*x*z-2*(z-1)*(z-1)*(2*x-1)*x*z +4*(z-1)*(2*z-1)*(x-1)*(x-1)*z+16*(z-1)*(2*z-1)*(x-1)*x*z+4*(z-1)*(2*z-1)*x*x*z +4*(z-1)*(x-1)*(x-1)*x*x-2*(z-1)*(x-1)*(2*x-1)*z*z-4*(z-1)*(x-1)*x*z*z -2*(z-1)*(2*x-1)*x*z*z+2*(2*z-1)*(x-1)*(x-1)*x*x+4*(x-1)*(x-1)*x*x*z+z-1/2;
+-
++	functionx =  -2*(y-1)*(y-1)*(x-1)*(2*x-1)*y-4*(y-1)*(y-1)*(x-1)*x*y-2*(y-1)*(y-1)*(2*x-1)*x*y +4*(y-1)*(2*y-1)*(x-1)*(x-1)*y+16*(y-1)*(2*y-1)*(x-1)*x*y+4*(y-1)*(2*y-1)*x*x*y +4*(y-1)*(x-1)*(x-1)*x*x-2*(y-1)*(x-1)*(2*x-1)*y*y-4*(y-1)*(x-1)*x*y*y -2*(y-1)*(2*x-1)*x*y*y+2*(2*y-1)*(x-1)*(x-1)*x*x+4*(x-1)*(x-1)*x*x*y+y-1/2; 
+ 	return functionx;
+ }
+ IssmDouble fy2(IssmDouble x,IssmDouble y){   
+@@ -21,7 +20,7 @@
+ 	IssmDouble q = 2.0;   
+ 	IssmDouble functiony;
+ 
+-	functiony = -4*(z-1)*(z-1)*(x-1)*(2*x-1)*x-4*(z-1)*(z-1)*(x-1)*z*z-2*(z-1)*(z-1)*(2*x-1)*z*z -4*(z-1)*(z-1)*x*z*z+2*(z-1)*(2*z-1)*(x-1)*(x-1)*x+2*(z-1)*(2*z-1)*(x-1)*x*x +4*(z-1)*(x-1)*(x-1)*x*z-16*(z-1)*(x-1)*(2*x-1)*x*z+4*(z-1)*(x-1)*x*x*z +2*(2*z-1)*(x-1)*(x-1)*x*z+2*(2*z-1)*(x-1)*x*x*z -4*(x-1)*(2*x-1)*x*z*z+x-1/2;
++	functiony = -4*(y-1)*(y-1)*(x-1)*(2*x-1)*x-4*(y-1)*(y-1)*(x-1)*y*y-2*(y-1)*(y-1)*(2*x-1)*y*y -4*(y-1)*(y-1)*x*y*y+2*(y-1)*(2*y-1)*(x-1)*(x-1)*x+2*(y-1)*(2*y-1)*(x-1)*x*x +4*(y-1)*(x-1)*(x-1)*x*y-16*(y-1)*(x-1)*(2*x-1)*x*y+4*(y-1)*(x-1)*x*x*y +2*(2*y-1)*(x-1)*(x-1)*x*y+2*(2*y-1)*(x-1)*x*x*y -4*(x-1)*(2*x-1)*x*y*y+x-1/2;
+ 
+ 	return functiony;
+ }
Index: issm/oecreview/Archive/16554-17801/ISSM-17286-17287.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17286-17287.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17286-17287.diff	(revision 17802)
@@ -0,0 +1,58 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17286)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17287)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ #include "../solutionsequences/solutionsequences.h"
+ 
+-//#define FSANALYTICAL 2
++#define FSANALYTICAL 3
+ 
+ /*Model processing*/
+ int  StressbalanceAnalysis::DofsPerNode(int** pdoftype,int meshtype,int approximation){/*{{{*/
+@@ -408,7 +408,7 @@
+ 				if(iomodel->my_vertices[i]){
+ 					if(nodeonbed[i]>0. && groundedice_ls[i]>0. && nodeonFS[i]>0.){
+ 						if(vertices_type[i] == FSApproximationEnum){
+-							for(j=0;j<Nz;j++) spcvz[i*Nz+j] = 0.;
++						//	for(j=0;j<Nz;j++) spcvz[i*Nz+j] = 0.;
+ 						}
+ 						else{
+ 							_error_("not supported");
+@@ -2858,6 +2858,7 @@
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+ 	switch(meshtype){
+ 		case Mesh3DEnum:         dim = 3; break;
++		case Mesh2DverticalEnum: dim = 2; break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+@@ -2888,7 +2889,7 @@
+ 
+ 		x_coord=element->GetXcoord(gauss);
+ 		y_coord=element->GetYcoord(gauss);
+-		z_coord=element->GetZcoord(gauss);
++		if(dim==3) z_coord=element->GetZcoord(gauss);
+ 
+ 		#if FSANALYTICAL == 1
+ 			forcex=fx1(x_coord,y_coord,z_coord);
+@@ -2898,6 +2899,9 @@
+ 			forcex=fx2(x_coord,y_coord,z_coord);
+ 			forcey=fy2(x_coord,y_coord,z_coord);
+ 			forcez=fz2(x_coord,y_coord,z_coord);
++		#elif FSANALYTICAL == 3
++			forcex=fx3(x_coord,y_coord);
++			forcey=fy3(x_coord,y_coord);
+ 		#else 
+ 			_error_("FS analytical not implemented yet");
+ 		#endif
+@@ -2905,7 +2909,7 @@
+ 		for(i=0;i<vnumnodes;i++){
+ 			pe->values[i*dim+0] += forcex *Jdet*gauss->weight*vbasis[i];
+ 			pe->values[i*dim+1] += forcey *Jdet*gauss->weight*vbasis[i];
+-			pe->values[i*dim+2] += forcez *Jdet*gauss->weight*vbasis[i];
++			if(dim==3) pe->values[i*dim+2] += forcez *Jdet*gauss->weight*vbasis[i];
+ 		}
+ 	}
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17287-17288.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17287-17288.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17287-17288.diff	(revision 17802)
@@ -0,0 +1,91 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17287)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17288)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ #include "../solutionsequences/solutionsequences.h"
+ 
+-#define FSANALYTICAL 3
++//#define FSANALYTICAL 3
+ 
+ /*Model processing*/
+ int  StressbalanceAnalysis::DofsPerNode(int** pdoftype,int meshtype,int approximation){/*{{{*/
+@@ -408,7 +408,7 @@
+ 				if(iomodel->my_vertices[i]){
+ 					if(nodeonbed[i]>0. && groundedice_ls[i]>0. && nodeonFS[i]>0.){
+ 						if(vertices_type[i] == FSApproximationEnum){
+-						//	for(j=0;j<Nz;j++) spcvz[i*Nz+j] = 0.;
++							for(j=0;j<Nz;j++) spcvz[i*Nz+j] = 0.;
+ 						}
+ 						else{
+ 							_error_("not supported");
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp	(revision 17287)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp	(revision 17288)
+@@ -7,20 +7,18 @@
+ #include "../Numerics/types.h"
+ #include "../Numerics/constants.h"
+ 
+-IssmDouble fx2(IssmDouble x,IssmDouble y{   
+-	IssmDouble p = 2.0;  
+-	IssmDouble q = 2.0;   
++IssmDouble fx3(IssmDouble x,IssmDouble y){   
+ 	IssmDouble functionx;
++	IssmDouble z=y;
+ 
+-	functionx =  -2*(y-1)*(y-1)*(x-1)*(2*x-1)*y-4*(y-1)*(y-1)*(x-1)*x*y-2*(y-1)*(y-1)*(2*x-1)*x*y +4*(y-1)*(2*y-1)*(x-1)*(x-1)*y+16*(y-1)*(2*y-1)*(x-1)*x*y+4*(y-1)*(2*y-1)*x*x*y +4*(y-1)*(x-1)*(x-1)*x*x-2*(y-1)*(x-1)*(2*x-1)*y*y-4*(y-1)*(x-1)*x*y*y -2*(y-1)*(2*x-1)*x*y*y+2*(2*y-1)*(x-1)*(x-1)*x*x+4*(x-1)*(x-1)*x*x*y+y-1/2; 
++	functionx =  4*pow(x, 2)*z*pow(x - 1, 2) + 4*pow(x, 2)*z*(z - 1)*(2*z - 1) + 4*pow(x, 2)*pow(x - 1, 2)*(z - 1) + 2*pow(x, 2)*pow(x - 1, 2)*(2*z - 1) + 16*x*z*(x - 1)*(z - 1)*(2*z - 1) - 4*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) + 6*pow(z, 2)*(6*pow(x, 2) - 6*x + 1) + 4*z*pow(x - 1, 2)*(z - 1)*(2*z - 1) - 2*z*(6*pow(x, 2) - 6*x + 1) + z - 1.0L/2.0L;
+ 	return functionx;
+ }
+-IssmDouble fy2(IssmDouble x,IssmDouble y){   
+-	IssmDouble p = 2.0;  
+-	IssmDouble q = 2.0;   
++IssmDouble fy3(IssmDouble x,IssmDouble y){   
+ 	IssmDouble functiony;
++	IssmDouble z=y;
+ 
+-	functiony = -4*(y-1)*(y-1)*(x-1)*(2*x-1)*x-4*(y-1)*(y-1)*(x-1)*y*y-2*(y-1)*(y-1)*(2*x-1)*y*y -4*(y-1)*(y-1)*x*y*y+2*(y-1)*(2*y-1)*(x-1)*(x-1)*x+2*(y-1)*(2*y-1)*(x-1)*x*x +4*(y-1)*(x-1)*(x-1)*x*y-16*(y-1)*(x-1)*(2*x-1)*x*y+4*(y-1)*(x-1)*x*x*y +2*(2*y-1)*(x-1)*(x-1)*x*y+2*(2*y-1)*(x-1)*x*x*y -4*(x-1)*(2*x-1)*x*y*y+x-1/2;
++	functiony = -8*pow(x, 3) + 4*pow(x, 2)*z*(x - 1)*(z - 1) + 2*pow(x, 2)*z*(x - 1)*(2*z - 1) + 2*pow(x, 2)*(x - 1)*(z - 1)*(2*z - 1) + 12*pow(x, 2) + 4*x*z*pow(x - 1, 2)*(z - 1) + 2*x*z*pow(x - 1, 2)*(2*z - 1) + 2*x*pow(x - 1, 2)*(z - 1)*(2*z - 1) - 3*x - 6*pow(z, 4)*(2*x - 1) + 12*pow(z, 3)*(2*x - 1) - 6*pow(z, 2)*(2*x - 1) - 24*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + 24*z*(2*pow(x, 3) - 3*pow(x, 2) + x) - 1.0L/2.0L;
+ 
+ 	return functiony;
+ }
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17287)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17288)
+@@ -1192,6 +1192,20 @@
+ 	input->GetVectorFromInputs(vector,&vertexpidlist[0]);
+ }
+ /*}}}*/
++/*FUNCTION Tria::GetXcoord {{{*/
++IssmDouble Tria::GetXcoord(Gauss* gauss){
++
++	IssmDouble x;
++	IssmDouble xyz_list[NUMVERTICES][3];
++	IssmDouble x_list[NUMVERTICES];
++
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	for(int i=0;i<NUMVERTICES;i++) x_list[i]=xyz_list[i][0];
++	TriaRef::GetInputValue(&x,x_list,gauss,P1Enum);
++
++	return x;
++}
++/*}}}*/
+ /*FUNCTION Tria::GetYcoord {{{*/
+ IssmDouble Tria::GetYcoord(Gauss* gauss){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17287)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17288)
+@@ -208,7 +208,7 @@
+ 		int            GetElementType(void);
+ 
+ 		void	         GetVertexPidList(int* doflist);
+-		IssmDouble     GetXcoord(Gauss* gauss){_error_("not implemented");};
++		IssmDouble     GetXcoord(Gauss* gauss);
+ 		IssmDouble     GetYcoord(Gauss* gauss);
+ 		IssmDouble     GetZcoord(Gauss* gauss){_error_("not implemented");};
+ 		void           NormalSection(IssmDouble* normal,IssmDouble* xyz_list);
Index: issm/oecreview/Archive/16554-17801/ISSM-17288-17289.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17288-17289.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17288-17289.diff	(revision 17802)
@@ -0,0 +1,66 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17288)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17289)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ #include "../solutionsequences/solutionsequences.h"
+ 
+-//#define FSANALYTICAL 3
++//#define FSANALYTICAL 4
+ 
+ /*Model processing*/
+ int  StressbalanceAnalysis::DofsPerNode(int** pdoftype,int meshtype,int approximation){/*{{{*/
+@@ -2902,6 +2902,10 @@
+ 		#elif FSANALYTICAL == 3
+ 			forcex=fx3(x_coord,y_coord);
+ 			forcey=fy3(x_coord,y_coord);
++		#elif FSANALYTICAL == 4
++			forcex=fx4(x_coord,y_coord,z_coord);
++			forcey=fy4(x_coord,y_coord,z_coord);
++			forcez=fz4(x_coord,y_coord,z_coord);
+ 		#else 
+ 			_error_("FS analytical not implemented yet");
+ 		#endif
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h	(revision 17288)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h	(revision 17289)
+@@ -15,5 +15,8 @@
+ IssmDouble fz2(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+ IssmDouble fx3(IssmDouble x_coord, IssmDouble y_coord);
+ IssmDouble fy3(IssmDouble x_coord, IssmDouble y_coord);
++IssmDouble fx4(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
++IssmDouble fy4(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
++IssmDouble fz4(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+ 
+ #endif //ifndef _SHARED_ANALYTICALS_H_
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp	(revision 17288)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp	(revision 17289)
+@@ -22,3 +22,24 @@
+ 
+ 	return functiony;
+ }
++IssmDouble fx4(IssmDouble x,IssmDouble y,IssmDouble z){   
++	IssmDouble functionx;
++
++	functionx = 4*pow(x, 2)*y*z*pow(x - 1, 2)*(z - 1) + 4*pow(x, 2)*y*z*(y - 1)*(2*y - 1)*(z - 1) + 2*pow(x, 2)*y*pow(x - 1, 2)*(y - 1)*(2*y - 1) + 4*pow(x, 2)*z*pow(x - 1, 2)*(y - 1)*(z - 1) + 2*pow(x, 2)*z*pow(x - 1, 2)*(2*y - 1)*(z - 1) - 4*x*pow(y, 2)*z*(x - 1)*(y - 1)*(z - 1) - 2*x*pow(y, 2)*z*(2*x - 1)*(y - 1)*(z - 1) - 4*x*y*z*(x - 1)*pow(y - 1, 2)*(z - 1) + 16*x*y*z*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 2*x*y*z*(2*x - 1)*pow(y - 1, 2)*(z - 1) - 2*pow(y, 2)*z*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 4*y*z*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 2*y*z*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1) + y - 1.0L/2.0L;
++
++	return functionx;
++}
++IssmDouble fy4(IssmDouble x,IssmDouble y,IssmDouble z){   
++	IssmDouble functiony;
++
++	functiony = 4*pow(x, 2)*y*z*(x - 1)*(y - 1)*(z - 1) + 2*pow(x, 2)*y*z*(x - 1)*(2*y - 1)*(z - 1) + 2*pow(x, 2)*z*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 4*x*pow(y, 2)*z*(x - 1)*(2*x - 1)*(z - 1) - 4*x*pow(y, 2)*z*pow(y - 1, 2)*(z - 1) - 2*x*pow(y, 2)*(x - 1)*(2*x - 1)*pow(y - 1, 2) + 4*x*y*z*pow(x - 1, 2)*(y - 1)*(z - 1) + 2*x*y*z*pow(x - 1, 2)*(2*y - 1)*(z - 1) - 16*x*y*z*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 2*x*z*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 4*x*z*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1) + x - 4*pow(y, 2)*z*(x - 1)*pow(y - 1, 2)*(z - 1) - 2*pow(y, 2)*z*(2*x - 1)*pow(y - 1, 2)*(z - 1) - 1.0L/2.0L;
++
++	return functiony;
++}
++IssmDouble fz4(IssmDouble x,IssmDouble y,IssmDouble z){   
++	IssmDouble functionz;
++
++	functionz = 2*pow(x, 2)*y*z*(x - 1)*(y - 1)*(2*y - 1) + 2*pow(x, 2)*y*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 2*x*pow(y, 2)*z*(x - 1)*(2*x - 1)*(y - 1) - 2*x*pow(y, 2)*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 2*x*y*z*pow(x - 1, 2)*(y - 1)*(2*y - 1) - 2*x*y*z*(x - 1)*(2*x - 1)*pow(y - 1, 2) + 2*x*y*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 2*x*y*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1);
++
++	return functionz;
++}
Index: issm/oecreview/Archive/16554-17801/ISSM-17289-17290.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17289-17290.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17289-17290.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/test/Archives/Archive3103.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive3019.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive3003.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17290-17291.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17290-17291.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17290-17291.diff	(revision 17802)
@@ -0,0 +1,72 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17290)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17291)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ #include "../solutionsequences/solutionsequences.h"
+ 
+-//#define FSANALYTICAL 4
++//#define FSANALYTICAL 5
+ 
+ /*Model processing*/
+ int  StressbalanceAnalysis::DofsPerNode(int** pdoftype,int meshtype,int approximation){/*{{{*/
+@@ -2906,6 +2906,10 @@
+ 			forcex=fx4(x_coord,y_coord,z_coord);
+ 			forcey=fy4(x_coord,y_coord,z_coord);
+ 			forcez=fz4(x_coord,y_coord,z_coord);
++		#elif FSANALYTICAL == 5
++			forcex=fx5(x_coord,y_coord,z_coord);
++			forcey=fy5(x_coord,y_coord,z_coord);
++			forcez=fz5(x_coord,y_coord,z_coord);
+ 		#else 
+ 			_error_("FS analytical not implemented yet");
+ 		#endif
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h	(revision 17290)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h	(revision 17291)
+@@ -18,5 +18,8 @@
+ IssmDouble fx4(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+ IssmDouble fy4(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+ IssmDouble fz4(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
++IssmDouble fx5(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
++IssmDouble fy5(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
++IssmDouble fz5(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+ 
+ #endif //ifndef _SHARED_ANALYTICALS_H_
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp	(revision 17290)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp	(revision 17291)
+@@ -43,3 +43,30 @@
+ 
+ 	return functionz;
+ }
++IssmDouble fx5(IssmDouble x,IssmDouble y,IssmDouble z){   
++	IssmDouble functionx;
++	int p=2;
++	int q=2;
++
++	functionx = 4*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*sin(PI*p*y)*sin(PI*p*z) + 2*pow(PI, 2)*pow(p, 2)*sin(PI*p*y)*sin(PI*p*z)*cos(PI*p*x) + PI*q*sin(PI*q*y)*sin(PI*q*z)*cos(PI*q*x);
++
++	return functionx;
++}
++IssmDouble fy5(IssmDouble x,IssmDouble y,IssmDouble z){   
++	IssmDouble functiony;
++	int p=2;
++	int q=2;
++
++	functiony =  -2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*sin(PI*p*x)*sin(PI*p*z) - pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*z)*cos(PI*p*y) + PI*q*sin(PI*q*x)*sin(PI*q*z)*cos(PI*q*y);
++
++	return functiony;
++}
++IssmDouble fz5(IssmDouble x,IssmDouble y,IssmDouble z){   
++	IssmDouble functionz;
++	int p=2;
++	int q=2;
++
++	functionz =  -2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*z) - 1)*sin(PI*p*x)*sin(PI*p*y) - pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*y)*cos(PI*p*z) + PI*q*sin(PI*q*x)*sin(PI*q*y)*cos(PI*q*z);
++
++	return functionz;
++}
Index: issm/oecreview/Archive/16554-17801/ISSM-17291-17292.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17291-17292.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17291-17292.diff	(revision 17802)
@@ -0,0 +1,48 @@
+Index: ../trunk-jpl/externalpackages/adolc/install-withampi.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/adolc/install-withampi.sh	(revision 17291)
++++ ../trunk-jpl/externalpackages/adolc/install-withampi.sh	(revision 17292)
+@@ -16,6 +16,7 @@
+ 	--with-mpi-root=$ISSM_DIR/externalpackages/mpich/install \
+ 	--enable-ampi \
+ 	--with-ampi=$ISSM_DIR/externalpackages/adjoinablempi/install \
++	--with-soname=adolc \
+ 	--disable-tapedoc-values
+ 
+ make clean
+Index: ../trunk-jpl/externalpackages/adolc/install-withampi-macosx64.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/adolc/install-withampi-macosx64.sh	(revision 17291)
++++ ../trunk-jpl/externalpackages/adolc/install-withampi-macosx64.sh	(revision 17292)
+@@ -19,6 +19,7 @@
+ 	--with-mpi-root=$ISSM_DIR/externalpackages/mpich/install \
+ 	--enable-ampi \
+ 	--with-ampi=$ISSM_DIR/externalpackages/adjoinablempi/install \
++        --with-soname=adolc \
+ 	--disable-tapedoc-values
+ 
+ make clean
+Index: ../trunk-jpl/externalpackages/adolc/install-withampi-pleiades.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/adolc/install-withampi-pleiades.sh	(revision 17291)
++++ ../trunk-jpl/externalpackages/adolc/install-withampi-pleiades.sh	(revision 17292)
+@@ -16,6 +16,7 @@
+ 	--with-mpi-root="/nasa/sgi/mpt/2.06rp16/" \
+ 	--enable-ampi \
+ 	--with-ampi=$ISSM_DIR/externalpackages/adjoinablempi/install \
++        --with-soname=adolc \
+ 	--disable-tapedoc-values
+ 
+ make clean
+Index: ../trunk-jpl/externalpackages/adolc/install-withampi-pleiades-gcc.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/adolc/install-withampi-pleiades-gcc.sh	(revision 17291)
++++ ../trunk-jpl/externalpackages/adolc/install-withampi-pleiades-gcc.sh	(revision 17292)
+@@ -16,6 +16,7 @@
+ 	--with-mpi-root=$ISSM_DIR/externalpackages/mpich/install \
+ 	--enable-ampi \
+ 	--with-ampi=$ISSM_DIR/externalpackages/adjoinablempi/install \
++        --with-soname=adolc \
+ 	--disable-tapedoc-values
+ 
+ make clean
Index: issm/oecreview/Archive/16554-17801/ISSM-17292-17293.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17292-17293.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17292-17293.diff	(revision 17802)
@@ -0,0 +1,24 @@
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp	(revision 17292)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp	(revision 17293)
+@@ -3,7 +3,7 @@
+  * test case for a cube with Dirichlet conditions on all faces and no variation in z
+  */
+ 
+-#include <math.h>
++#include <cmath.h>
+ #include "../Numerics/types.h"
+ #include "../Numerics/constants.h"
+ 
+
+Property changes on: ../trunk-jpl/src/c/shared/FSanalyticals
+___________________________________________________________________
+Name: svn:ignore
+   - .deps
+.dirtamp
+
+   + .deps
+.dirstamp
+
+
Index: issm/oecreview/Archive/16554-17801/ISSM-17293-17294.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17293-17294.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17293-17294.diff	(revision 17802)
@@ -0,0 +1,115 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 17293)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 17294)
+@@ -116,6 +116,7 @@
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+ 	element->FindParam(&dt,TimesteppingTimeStepEnum);
++	element->FindParam(&diffusivity,HydrologyshreveStabilizationEnum);
+ 	Input* vx_input=element->GetInput(HydrologyWaterVxEnum); _assert_(vx_input);
+ 	Input* vy_input=element->GetInput(HydrologyWaterVyEnum); _assert_(vy_input);
+ 	h = element->CharacteristicLength();
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp	(revision 17293)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp	(revision 17294)
+@@ -3,7 +3,7 @@
+  * test case for a cube with Dirichlet conditions on all faces and no variation in z
+  */
+ 
+-#include <cmath.h>
++#include <math.h>
+ #include "../Numerics/types.h"
+ #include "../Numerics/constants.h"
+ 
+Index: ../trunk-jpl/src/c/classes/Loads/Riftfront.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Riftfront.cpp	(revision 17293)
++++ ../trunk-jpl/src/c/classes/Loads/Riftfront.cpp	(revision 17294)
+@@ -588,7 +588,7 @@
+ int Riftfront::Constrain(int* punstable){
+ 
+ 	IssmDouble  penetration;
+-	int         activate;
++	bool        activate;
+ 	int         unstable;
+ 	IssmDouble  vx1;
+ 	IssmDouble  vy1;
+@@ -633,8 +633,8 @@
+ 	penetration=(vx2-vx1)*normal[0]+(vy2-vy1)*normal[1];
+ 
+ 	/*activation: */
+-	if(penetration<0)activate=1;
+-	else  activate=0;
++	if(penetration<0)activate=true;
++	else  activate=false;
+ 
+ 	/*Here, we try to avoid zigzaging. When a penalty activates and deactivates for more than penalty_lock times, 
+ 	 * we increase the fraction of melange:*/
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17293)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17294)
+@@ -116,7 +116,7 @@
+ 	/*Write lock file if requested: */
+ 	this->parameters->FindParam(&waitonlock,SettingsWaitonlockEnum);
+ 	this->parameters->FindParam(&lockfilename,LockFileNameEnum);
+-	if (waitonlock>0){
++	if(waitonlock){
+ 		_printf0_("write lock file:\n");
+ 		WriteLockFile(lockfilename);
+ 	}
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17293)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17294)
+@@ -199,7 +199,7 @@
+ 	IssmDouble  rho_ice,gravity,FSreconditioning;
+ 	IssmDouble  pressure,viscosity,Jdet2d;
+ 	IssmDouble  bed_normal[3];
+-	IssmDouble  basalforce[3];
++	IssmDouble  basalforce[3] = {0.};
+ 	IssmDouble  epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
+ 	IssmDouble  stresstensor[6]={0.0};
+ 	IssmDouble  sigma_xx,sigma_yy,sigma_zz;
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17293)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17294)
+@@ -813,7 +813,16 @@
+ 	this->TransformSolutionCoord(solution,this->nodes,numnodes,cs_array);
+ }/*}}}*/
+ void Element::TransformSolutionCoord(IssmDouble* values,Node** nodes_list,int numnodes,int transformenum){/*{{{*/
+-	this->TransformSolutionCoord(values,nodes_list,numnodes,transformenum);
++	/*NOT NEEDED*/
++	/*All nodes have the same Coordinate System*/
++	int* cs_array = xNew<int>(numnodes);
++	for(int i=0;i<numnodes;i++) cs_array[i]=transformenum;
++
++	/*Call core*/
++	this->TransformSolutionCoord(values,nodes_list,numnodes,cs_array);
++
++	/*Clean-up*/
++	xDelete<int>(cs_array);
+ }/*}}}*/
+ void Element::TransformSolutionCoord(IssmDouble* solution,Node** nodes_list,int numnodes,int* cs_array){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/classes/Misfit.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Misfit.h	(revision 17293)
++++ ../trunk-jpl/src/c/classes/Misfit.h	(revision 17294)
+@@ -112,10 +112,10 @@
+ 		 IssmDouble Response(FemModel* femmodel){
+ 
+ 			 int i;
+-			 IssmDouble misfit_t=0;
+-			 IssmDouble all_misfit_t=0;
++			 IssmDouble misfit_t=0.;
++			 IssmDouble all_misfit_t=0.;
+ 			 IssmDouble dt;
+-			 IssmDouble area_t;
++			 IssmDouble area_t=0.;
+ 			 IssmDouble all_area_t;
+ 			 IssmDouble time,starttime,finaltime;
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17294-17295.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17294-17295.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17294-17295.diff	(revision 17802)
@@ -0,0 +1,37 @@
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp	(revision 17294)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp	(revision 17295)
+@@ -45,8 +45,8 @@
+ }
+ IssmDouble fx5(IssmDouble x,IssmDouble y,IssmDouble z){   
+ 	IssmDouble functionx;
+-	int p=2;
+-	int q=2;
++	IssmDouble p=2;
++	IssmDouble q=2;
+ 
+ 	functionx = 4*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*sin(PI*p*y)*sin(PI*p*z) + 2*pow(PI, 2)*pow(p, 2)*sin(PI*p*y)*sin(PI*p*z)*cos(PI*p*x) + PI*q*sin(PI*q*y)*sin(PI*q*z)*cos(PI*q*x);
+ 
+@@ -54,8 +54,8 @@
+ }
+ IssmDouble fy5(IssmDouble x,IssmDouble y,IssmDouble z){   
+ 	IssmDouble functiony;
+-	int p=2;
+-	int q=2;
++	IssmDouble p=2;
++	IssmDouble q=2;
+ 
+ 	functiony =  -2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*sin(PI*p*x)*sin(PI*p*z) - pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*z)*cos(PI*p*y) + PI*q*sin(PI*q*x)*sin(PI*q*z)*cos(PI*q*y);
+ 
+@@ -63,8 +63,8 @@
+ }
+ IssmDouble fz5(IssmDouble x,IssmDouble y,IssmDouble z){   
+ 	IssmDouble functionz;
+-	int p=2;
+-	int q=2;
++	IssmDouble p=2;
++	IssmDouble q=2;
+ 
+ 	functionz =  -2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*z) - 1)*sin(PI*p*x)*sin(PI*p*y) - pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*y)*cos(PI*p*z) + PI*q*sin(PI*q*x)*sin(PI*q*y)*cos(PI*q*z);
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17295-17296.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17295-17296.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17295-17296.diff	(revision 17802)
@@ -0,0 +1,395 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17295)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17296)
+@@ -59,6 +59,9 @@
+ 		void       FindParam(int* pvalue,int paramenum);
+ 		void       FindParam(IssmDouble* pvalue,int paramenum);
+ 		void       FindParam(int** pvalues,int* psize,int paramenum);
++		void	     GetDofList(int** pdoflist,int approximation_enum,int setenum);
++		void	     GetDofListVelocity(int** pdoflist,int setenum);
++		void	     GetDofListPressure(int** pdoflist,int setenum);
+ 		Input*     GetInput(int inputenum);
+ 		IssmDouble GetMaterialParameter(int enum_in);
+ 		void       GetPhi(IssmDouble* phi, IssmDouble*  epsilon, IssmDouble viscosity);
+@@ -70,6 +73,7 @@
+ 		void       ResultToVector(Vector<IssmDouble>* vector,int output_enum);
+ 		void       ResultToPatch(IssmDouble* values,int nodesperelement,int output_enum);
+ 		void       StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
++		void       StrainRateSSA1d(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input);
+ 		void       StrainRateHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 		void       StrainRateHO2dvertical(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 		void       StrainRateFS(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+@@ -95,7 +99,7 @@
+ 		void       ViscosityFS(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+ 		void       ViscosityHO(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 		void       ViscosityL1L2(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* surf);
+-		void       ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
++		void       ViscositySSA(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 		void       ViscositySSADerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon);
+ 		void       ViscosityHODerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon);
+ 		void       ViscosityFSDerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon);
+@@ -134,9 +138,7 @@
+ 		virtual Element* GetLowerElement(void)=0;
+ 		virtual Element* GetSurfaceElement(void)=0;
+ 		virtual Element* GetBasalElement(void)=0;
+-		virtual void	GetDofList(int** pdoflist,int approximation_enum,int setenum)=0;
+-		virtual void	GetDofListVelocity(int** pdoflist,int setenum)=0;
+-		virtual void	GetDofListPressure(int** pdoflist,int setenum)=0;
++
+ 		virtual void   JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss)=0;
+ 		virtual void   JacobianDeterminantLine(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss)=0;
+ 		virtual void   JacobianDeterminantSurface(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17295)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17296)
+@@ -222,7 +222,7 @@
+ 
+ 		/*Compute strain rate viscosity and pressure: */
+ 		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+-		this->ViscositySSA(&viscosity,&xyz_list[0][0],gauss,vx_input,vy_input);
++		this->ViscositySSA(&viscosity,2,&xyz_list[0][0],gauss,vx_input,vy_input);
+ 		pressure_input->GetInputValue(&pressure,gauss);
+ 
+ 		/*Compute Stress*/
+@@ -489,79 +489,6 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetDofList {{{*/
+-void  Tria::GetDofList(int** pdoflist, int approximation_enum,int setenum){
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*First, figure out size of doflist and create it: */
+-	int numberofdofs=0;
+-	for(int i=0;i<numnodes;i++) numberofdofs+=nodes[i]->GetNumberOfDofs(approximation_enum,setenum);
+-
+-	/*Allocate output*/
+-	int* doflist=xNew<int>(numberofdofs);
+-
+-	/*Populate: */
+-	int count=0;
+-	for(int i=0;i<numnodes;i++){
+-		nodes[i]->GetDofList(doflist+count,approximation_enum,setenum);
+-		count+=nodes[i]->GetNumberOfDofs(approximation_enum,setenum);
+-	}
+-
+-	/*Assign output pointers:*/
+-	*pdoflist=doflist;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::GetDofListVelocity{{{*/
+-void  Tria::GetDofListVelocity(int** pdoflist,int setenum){
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodesVelocity();
+-
+-	/*First, figure out size of doflist and create it: */
+-	int numberofdofs=0;
+-	for(int i=0;i<numnodes;i++) numberofdofs+=nodes[i]->GetNumberOfDofs(FSvelocityEnum,setenum);
+-
+-	/*Allocate output*/
+-	int* doflist=xNew<int>(numberofdofs);
+-
+-	/*Populate: */
+-	int count=0;
+-	for(int i=0;i<numnodes;i++){
+-		nodes[i]->GetDofList(doflist+count,FSvelocityEnum,setenum);
+-		count+=nodes[i]->GetNumberOfDofs(FSvelocityEnum,setenum);
+-	}
+-
+-	/*Assign output pointers:*/
+-	*pdoflist=doflist;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::GetDofListPressure{{{*/
+-void  Tria::GetDofListPressure(int** pdoflist,int setenum){
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumnodes = this->NumberofNodesPressure();
+-
+-	/*First, figure out size of doflist and create it: */
+-	int numberofdofs=0;
+-	for(int i=vnumnodes;i<vnumnodes+pnumnodes;i++) numberofdofs+=nodes[i]->GetNumberOfDofs(FSApproximationEnum,setenum);
+-
+-	/*Allocate output*/
+-	int* doflist=xNew<int>(numberofdofs);
+-
+-	/*Populate: */
+-	int count=0;
+-	for(int i=vnumnodes;i<vnumnodes+pnumnodes;i++){
+-		nodes[i]->GetDofList(doflist+count,FSApproximationEnum,setenum);
+-		count+=nodes[i]->GetNumberOfDofs(FSApproximationEnum,setenum);
+-	}
+-
+-	/*Assign output pointers:*/
+-	*pdoflist=doflist;
+-}
+-/*}}}*/
+ /*FUNCTION Tria::GetElementType {{{*/
+ int Tria::GetElementType(){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17295)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17296)
+@@ -75,9 +75,6 @@
+ 	  	Element*    GetLowerElement(void){_error_("not implemented yet");};
+ 	  	Element*    GetSurfaceElement(void){_error_("not implemented yet");};
+ 		Element*    GetBasalElement(void){_error_("not implemented yet");};
+-		void	      GetDofList(int** pdoflist,int approximation_enum,int setenum);
+-		void	      GetDofListVelocity(int** pdoflist,int setenum);
+-		void	      GetDofListPressure(int** pdoflist,int setenum);
+ 		void        GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating);
+ 		IssmDouble  GetGroundedPortion(IssmDouble* xyz_list);
+ 		int         GetNodeIndex(Node* node);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17295)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17296)
+@@ -632,79 +632,6 @@
+ 	return element;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetDofList {{{*/
+-void  Penta::GetDofList(int** pdoflist,int approximation_enum,int setenum){
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*First, figure out size of doflist and create it: */
+-	int numberofdofs=0;
+-	for(int i=0;i<numnodes;i++) numberofdofs+=nodes[i]->GetNumberOfDofs(approximation_enum,setenum);
+-
+-	/*Allocate output*/
+-	int* doflist=xNew<int>(numberofdofs);
+-
+-	/*Populate: */
+-	int count=0;
+-	for(int i=0;i<numnodes;i++){
+-		nodes[i]->GetDofList(doflist+count,approximation_enum,setenum);
+-		count+=nodes[i]->GetNumberOfDofs(approximation_enum,setenum);
+-	}
+-
+-	/*Assign output pointers:*/
+-	*pdoflist=doflist;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::GetDofListVelocity{{{*/
+-void  Penta::GetDofListVelocity(int** pdoflist,int setenum){
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodesVelocity();
+-
+-	/*First, figure out size of doflist and create it: */
+-	int numberofdofs=0;
+-	for(int i=0;i<numnodes;i++) numberofdofs+=nodes[i]->GetNumberOfDofs(FSvelocityEnum,setenum);
+-
+-	/*Allocate output*/
+-	int* doflist=xNew<int>(numberofdofs);
+-
+-	/*Populate: */
+-	int count=0;
+-	for(int i=0;i<numnodes;i++){
+-		nodes[i]->GetDofList(doflist+count,FSvelocityEnum,setenum);
+-		count+=nodes[i]->GetNumberOfDofs(FSvelocityEnum,setenum);
+-	}
+-
+-	/*Assign output pointers:*/
+-	*pdoflist=doflist;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::GetDofListPressure{{{*/
+-void  Penta::GetDofListPressure(int** pdoflist,int setenum){
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = this->NumberofNodesVelocity();
+-	int pnumnodes = this->NumberofNodesPressure();
+-
+-	/*First, figure out size of doflist and create it: */
+-	int numberofdofs=0;
+-	for(int i=vnumnodes;i<vnumnodes+pnumnodes;i++) numberofdofs+=nodes[i]->GetNumberOfDofs(FSApproximationEnum,setenum);
+-
+-	/*Allocate output*/
+-	int* doflist=xNew<int>(numberofdofs);
+-
+-	/*Populate: */
+-	int count=0;
+-	for(int i=vnumnodes;i<vnumnodes+pnumnodes;i++){
+-		nodes[i]->GetDofList(doflist+count,FSApproximationEnum,setenum);
+-		count+=nodes[i]->GetNumberOfDofs(FSApproximationEnum,setenum);
+-	}
+-
+-	/*Assign output pointers:*/
+-	*pdoflist=doflist;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::GetGroundedPart{{{*/
+ void Penta::GetGroundedPart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* mainlyfloating){
+ 	/*Computeportion of the element that is grounded*/ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17295)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17296)
+@@ -81,9 +81,6 @@
+ 		Element* GetLowerElement(void);
+ 		Element* GetSurfaceElement(void);
+ 		Element* GetBasalElement(void);
+-		void	 GetDofList(int** pdoflist,int approximation_enum,int setenum);
+-		void	 GetDofListVelocity(int** pdoflist,int setenum);
+-		void	 GetDofListPressure(int** pdoflist,int setenum);
+ 		void   GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating);
+ 		IssmDouble GetGroundedPortion(IssmDouble* xyz_list);
+ 		int    GetNodeIndex(Node* node);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17295)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17296)
+@@ -78,9 +78,6 @@
+ 	  	Element*    GetLowerElement(void){_error_("not implemented yet");};
+ 	  	Element*    GetSurfaceElement(void){_error_("not implemented yet");};
+ 		Element*    GetBasalElement(void){_error_("not implemented yet");};
+-		void        GetDofList(int** pdoflist,int approximation_enum,int setenum){_error_("not implemented yet");};
+-		void        GetDofListVelocity(int** pdoflist,int setenum){_error_("not implemented yet");};
+-		void        GetDofListPressure(int** pdoflist,int setenum){_error_("not implemented yet");};
+ 		void        GetInputListOnNodes(IssmDouble* pvalue,int enumtype){_error_("not implemented yet");};
+ 		void        GetInputListOnNodes(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){_error_("not implemented yet");};
+ 		int         GetNodeIndex(Node* node){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17295)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17296)
+@@ -141,6 +141,76 @@
+ void Element::FindParam(int** pvalues,int* psize,int paramenum){/*{{{*/
+ 	this->parameters->FindParam(pvalues,psize,paramenum);
+ }/*}}}*/
++void Element::GetDofList(int** pdoflist,int approximation_enum,int setenum){/*{{{*/
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = this->GetNumberOfNodes();
++
++	/*First, figure out size of doflist and create it: */
++	int numberofdofs=0;
++	for(int i=0;i<numnodes;i++) numberofdofs+=nodes[i]->GetNumberOfDofs(approximation_enum,setenum);
++
++	/*Allocate output*/
++	int* doflist=xNew<int>(numberofdofs);
++
++	/*Populate: */
++	int count=0;
++	for(int i=0;i<numnodes;i++){
++		nodes[i]->GetDofList(doflist+count,approximation_enum,setenum);
++		count+=nodes[i]->GetNumberOfDofs(approximation_enum,setenum);
++	}
++
++	/*Assign output pointers:*/
++	*pdoflist=doflist;
++}
++/*}}}*/
++void Element::GetDofListVelocity(int** pdoflist,int setenum){/*{{{*/
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = this->GetNumberOfNodesVelocity();
++
++	/*First, figure out size of doflist and create it: */
++	int numberofdofs=0;
++	for(int i=0;i<numnodes;i++) numberofdofs+=nodes[i]->GetNumberOfDofs(FSvelocityEnum,setenum);
++
++	/*Allocate output*/
++	int* doflist=xNew<int>(numberofdofs);
++
++	/*Populate: */
++	int count=0;
++	for(int i=0;i<numnodes;i++){
++		nodes[i]->GetDofList(doflist+count,FSvelocityEnum,setenum);
++		count+=nodes[i]->GetNumberOfDofs(FSvelocityEnum,setenum);
++	}
++
++	/*Assign output pointers:*/
++	*pdoflist=doflist;
++}
++/*}}}*/
++void Element::GetDofListPressure(int** pdoflist,int setenum){/*{{{*/
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int vnumnodes = this->GetNumberOfNodesVelocity();
++	int pnumnodes = this->GetNumberOfNodesPressure();
++
++	/*First, figure out size of doflist and create it: */
++	int numberofdofs=0;
++	for(int i=vnumnodes;i<vnumnodes+pnumnodes;i++) numberofdofs+=nodes[i]->GetNumberOfDofs(FSApproximationEnum,setenum);
++
++	/*Allocate output*/
++	int* doflist=xNew<int>(numberofdofs);
++
++	/*Populate: */
++	int count=0;
++	for(int i=vnumnodes;i<vnumnodes+pnumnodes;i++){
++		nodes[i]->GetDofList(doflist+count,FSApproximationEnum,setenum);
++		count+=nodes[i]->GetNumberOfDofs(FSApproximationEnum,setenum);
++	}
++
++	/*Assign output pointers:*/
++	*pdoflist=doflist;
++}
++/*}}}*/
+ IssmDouble Element::GetMaterialParameter(int enum_in){/*{{{*/
+ 
+ 	_assert_(this->matpar);
+@@ -555,17 +625,24 @@
+ 	/*Assign output pointer*/
+ 	*pviscosity=viscosity;
+ }/*}}}*/
+-void Element::ViscositySSA(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
++void Element::ViscositySSA(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble viscosity;
+-	IssmDouble epsilon[3];/* epsilon=[exx,eyy,exy];    */
++	IssmDouble epsilon2d[3];/* epsilon=[exx,eyy,exy];    */
++	IssmDouble epsilon1d;   /* epsilon=[exx];    */
+ 	IssmDouble eps_eff;
+ 
+-	/*Get effective strain rate
+-	 * eps_eff^2 = exx^2 + eyy^2 + exy^2 + exx*eyy+*/
+-	this->StrainRateSSA(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
+-	eps_eff = sqrt(epsilon[0]*epsilon[0] + epsilon[1]*epsilon[1] + epsilon[2]*epsilon[2] + epsilon[0]*epsilon[1]);
++	 if(dim==2){
++		 /* eps_eff^2 = exx^2 + eyy^2 + exy^2 + exx*eyy+*/
++		 this->StrainRateSSA(&epsilon2d[0],xyz_list,gauss,vx_input,vy_input);
++		 eps_eff = sqrt(epsilon2d[0]*epsilon2d[0] + epsilon2d[1]*epsilon2d[1] + epsilon2d[2]*epsilon2d[2] + epsilon2d[0]*epsilon2d[1]);
++	 }
++	 else{
++		 /* eps_eff^2 = exx^2*/
++		 this->StrainRateSSA1d(&epsilon1d,xyz_list,gauss,vx_input);
++		 eps_eff = sqrt(epsilon1d*epsilon1d);
++	 }
+ 
+ 	/*Get viscosity*/
+ 	material->GetViscosityBar(&viscosity,eps_eff);
+@@ -683,6 +760,21 @@
+ 	epsilon[2] = 0.5*(dvx[1] + dvy[0]);
+ 
+ }/*}}}*/
++void Element::StrainRateSSA1d(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input){/*{{{*/
++
++	/*Intermediaries*/
++	IssmDouble dvx[3];
++
++	/*Check that both inputs have been found*/
++	if (!vx_input){
++		_error_("Input missing. Here are the input pointers we have for vx: " << vx_input << "\n");
++	}
++
++	/*Get strain rate assuming that epsilon has been allocated*/
++	vx_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
++	*epsilon = dvx[0];
++
++}/*}}}*/
+ void Element::TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum){/*{{{*/
+ 
+ 	/*All nodes have the same Coordinate System*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17296-17297.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17296-17297.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17296-17297.diff	(revision 17802)
@@ -0,0 +1,532 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17296)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17297)
+@@ -38,9 +38,9 @@
+ 		ElementVector* CreatePVectorSSA(Element* element);
+ 		ElementVector* CreatePVectorSSADrivingStress(Element* element);
+ 		ElementVector* CreatePVectorSSAFront(Element* element);
+-		void GetBSSA(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+-		void GetBSSAprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+-		void GetBSSAFriction(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBSSA(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBSSAprime(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBSSAFriction(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
+ 		void InputUpdateFromSolutionSSA(IssmDouble* solution,Element* element);
+ 		/*L1L2*/
+ 		ElementMatrix* CreateKMatrixL1L2(Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17296)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17297)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ #include "../solutionsequences/solutionsequences.h"
+ 
+-//#define FSANALYTICAL 5
++#define FSANALYTICAL 5
+ 
+ /*Model processing*/
+ int  StressbalanceAnalysis::DofsPerNode(int** pdoftype,int meshtype,int approximation){/*{{{*/
+@@ -1175,6 +1175,7 @@
+ 	if(element->IsFloating() || !element->IsIceInElement()) return NULL;
+ 
+ 	/*Intermediaries*/
++	int         dim,meshtype;
+ 	bool        mainlyfloating;
+ 	int         migration_style,point1;
+ 	IssmDouble  alpha2,Jdet,fraction1,fraction2;
+@@ -1182,22 +1183,32 @@
+ 	IssmDouble *xyz_list  = NULL;
+ 	Gauss*      gauss     = NULL;
+ 
++	/*Get problem dimension*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum:   dim = 1;break;
++		case Mesh2DhorizontalEnum: dim = 2;break;
++		case Mesh3DEnum:           dim = 2;break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+ 	int numdof   = numnodes*2;
+ 
+ 	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke      = element->NewElementMatrix(SSAApproximationEnum);
+-	IssmDouble*    B       = xNew<IssmDouble>(2*numdof);
+-	IssmDouble     D[2][2] = {0.};
++	ElementMatrix* Ke = element->NewElementMatrix(SSAApproximationEnum);
++	IssmDouble*    B  = xNew<IssmDouble>(dim*numdof);
++	IssmDouble*    D  = xNewZeroInit<IssmDouble>(dim*dim);
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+ 	element->FindParam(&migration_style,GroundinglineMigrationEnum);
+ 	Input* surface_input    = element->GetInput(SurfaceEnum); _assert_(surface_input);
+ 	Input* vx_input         = element->GetInput(VxEnum);      _assert_(vx_input);
+-	Input* vy_input         = element->GetInput(VyEnum);      _assert_(vy_input);
+ 	Input* gllevelset_input = NULL;
++	Input* vy_input         = NULL;
++	if(dim==2){vy_input     = element->GetInput(VyEnum);      _assert_(vy_input);}
+ 
+ 	/*build friction object, used later on: */
+ 	Friction* friction=new Friction(element,2);
+@@ -1224,13 +1235,13 @@
+ 			if(gllevelset<0.) alpha2=0.;
+ 		}
+ 
+-		this->GetBSSAFriction(B, element, xyz_list, gauss);
++		this->GetBSSAFriction(B,element,dim,xyz_list,gauss);
+ 		element->JacobianDeterminant(&Jdet, xyz_list,gauss);
+-		for(int i=0;i<2;i++) D[i][i]=alpha2*gauss->weight*Jdet;
++		for(int i=0;i<dim;i++) D[i*dim+i]=alpha2*gauss->weight*Jdet;
+ 
+-		TripleMultiply(B,2,numdof,1,
+-					&D[0][0],2,2,0,
+-					B,2,numdof,0,
++		TripleMultiply(B,dim,numdof,1,
++					D,dim,dim,0,
++					B,dim,numdof,0,
+ 					&Ke->values[0],1);
+ 	}
+ 
+@@ -1242,6 +1253,7 @@
+ 	delete friction;
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(B);
++	xDelete<IssmDouble>(D);
+ 	return Ke;
+ }/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSAViscous(Element* element){/*{{{*/
+@@ -1250,28 +1262,42 @@
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+ 	/*Intermediaries*/
++	int         dim,meshtype,bsize;
+ 	IssmDouble  viscosity,newviscosity,oldviscosity;
+ 	IssmDouble  viscosity_overshoot,thickness,Jdet;
+ 	IssmDouble  D_scalar;
+ 	IssmDouble *xyz_list = NULL;
+ 
++	/*Get problem dimension*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum:   dim = 1; bsize = 1; break;
++		case Mesh2DhorizontalEnum: dim = 2; bsize = 1; break;
++		case Mesh3DEnum:           dim = 2; bsize = 3; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+-	int numdof   = numnodes*2;
++	int numdof   = numnodes*dim;
+ 
+ 	/*Initialize Element matrix and vectors*/
+ 	ElementMatrix* Ke     = element->NewElementMatrix(SSAApproximationEnum);
+-	IssmDouble*    B      = xNew<IssmDouble>(3*numdof);
+-	IssmDouble*    Bprime = xNew<IssmDouble>(3*numdof);
+-	IssmDouble*    D      = xNewZeroInit<IssmDouble>(3*3);
++	IssmDouble*    B      = xNew<IssmDouble>(bsize*numdof);
++	IssmDouble*    Bprime = xNew<IssmDouble>(bsize*numdof);
++	IssmDouble*    D      = xNewZeroInit<IssmDouble>(bsize*bsize);
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+ 	Input* thickness_input=element->GetInput(ThicknessEnum); _assert_(thickness_input);
+ 	Input* vx_input=element->GetInput(VxEnum);               _assert_(vx_input);
+-	Input* vy_input=element->GetInput(VyEnum);               _assert_(vy_input);
+ 	Input* vxold_input=element->GetInput(VxPicardEnum);      _assert_(vxold_input);
+-	Input* vyold_input=element->GetInput(VyPicardEnum);      _assert_(vyold_input);
++	Input* vy_input    = NULL;
++	Input* vyold_input = NULL;
++	if(dim==3){
++		vy_input=element->GetInput(VyEnum);          _assert_(vy_input);
++		vyold_input=element->GetInput(VyPicardEnum); _assert_(vyold_input);
++	}
+ 	element->FindParam(&viscosity_overshoot,StressbalanceViscosityOvershootEnum);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+@@ -1280,25 +1306,25 @@
+ 		gauss->GaussPoint(ig);
+ 
+ 		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+-		this->GetBSSA(B,element,xyz_list,gauss);
+-		this->GetBSSAprime(Bprime,element,xyz_list,gauss);
++		this->GetBSSA(B,element,dim,xyz_list,gauss);
++		this->GetBSSAprime(Bprime,element,dim,xyz_list,gauss);
+ 
+-		element->ViscositySSA(&viscosity,xyz_list,gauss,vx_input,vy_input);
+-		element->ViscositySSA(&oldviscosity,xyz_list,gauss,vxold_input,vyold_input);
++		element->ViscositySSA(&viscosity,dim,xyz_list,gauss,vx_input,vy_input);
++		element->ViscositySSA(&oldviscosity,dim,xyz_list,gauss,vxold_input,vyold_input);
+ 		thickness_input->GetInputValue(&thickness, gauss);
+ 
+ 		newviscosity=viscosity+viscosity_overshoot*(viscosity-oldviscosity);
+ 		D_scalar=2.*newviscosity*thickness*gauss->weight*Jdet;
+ 		for(int i=0;i<3;i++) D[i*3+i]=D_scalar;
+ 
+-		TripleMultiply(B,3,numdof,1,
+-					D,3,3,0,
+-					Bprime,3,numdof,0,
++		TripleMultiply(B,bsize,numdof,1,
++					D,bsize,bsize,0,
++					Bprime,bsize,numdof,0,
+ 					&Ke->values[0],1);
+ 	}
+ 
+ 	/*Transform Coordinate System*/
+-	element->TransformStiffnessMatrixCoord(Ke,XYEnum);
++	if(dim==2) element->TransformStiffnessMatrixCoord(Ke,XYEnum);
+ 
+ 	/*Clean up and return*/
+ 	delete gauss;
+@@ -1347,9 +1373,19 @@
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+ 	/*Intermediaries */
++	int         dim,meshtype;
+ 	IssmDouble  thickness,Jdet,slope[2];
+ 	IssmDouble* xyz_list = NULL;
+ 
++	/*Get problem dimension*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum:   dim = 1;break;
++		case Mesh2DhorizontalEnum: dim = 2;break;
++		case Mesh3DEnum:           dim = 2;break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+ 
+@@ -1376,8 +1412,8 @@
+ 		surface_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
+ 
+ 		for(int i=0;i<numnodes;i++){
+-			pe->values[i*2+0]+=-rhog*thickness*slope[0]*Jdet*gauss->weight*basis[i];
+-			pe->values[i*2+1]+=-rhog*thickness*slope[1]*Jdet*gauss->weight*basis[i];
++			pe->values[i*dim+0]+=-rhog*thickness*slope[0]*Jdet*gauss->weight*basis[i];
++			if(dim==2) pe->values[i*dim+1]+=-rhog*thickness*slope[1]*Jdet*gauss->weight*basis[i];
+ 		}
+ 	}
+ 
+@@ -1399,12 +1435,22 @@
+ 	if(!element->IsIcefront()) return NULL;
+ 
+ 	/*Intermediaries*/
++	int         dim,meshtype;
+ 	IssmDouble  Jdet,thickness,bed,water_pressure,ice_pressure;
+ 	IssmDouble  surface_under_water,base_under_water,pressure;
+ 	IssmDouble *xyz_list = NULL;
+ 	IssmDouble *xyz_list_front = NULL;
+ 	IssmDouble  normal[2];
+ 
++	/*Get problem dimension*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum:   dim = 1;break;
++		case Mesh2DhorizontalEnum: dim = 2;break;
++		case Mesh3DEnum:           dim = 2;break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
+ 	/*Fetch number of nodes for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+ 
+@@ -1419,7 +1465,7 @@
+ 	IssmDouble rho_ice     = element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 	IssmDouble gravity     = element->GetMaterialParameter(ConstantsGEnum);
+ 	element->GetVerticesCoordinates(&xyz_list);
+-// 	element->ZeroLevelsetCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
++	//element->ZeroLevelsetCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
+ 	element->GetIcefrontCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
+ 	element->NormalSection(&normal[0],xyz_list_front);
+ 
+@@ -1439,9 +1485,9 @@
+ 		ice_pressure   = 1.0/2.0*gravity*rho_ice*thickness*thickness;
+ 		pressure = ice_pressure + water_pressure;
+ 
+-		for (int i=0;i<numnodes;i++){
+-			pe->values[2*i+0]+= pressure*Jdet*gauss->weight*normal[0]*basis[i];
+-			pe->values[2*i+1]+= pressure*Jdet*gauss->weight*normal[1]*basis[i];
++		for(int i=0;i<numnodes;i++){
++			pe->values[dim*i+0]+= pressure*Jdet*gauss->weight*normal[0]*basis[i];
++			if(dim==2) pe->values[dim*i+1]+= pressure*Jdet*gauss->weight*normal[1]*basis[i];
+ 		}
+ 	}
+ 
+@@ -1455,13 +1501,14 @@
+ 	delete gauss;
+ 	return pe;
+ }/*}}}*/
+-void StressbalanceAnalysis::GetBSSA(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++void StressbalanceAnalysis::GetBSSA(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
+ 	 * by: 
+-	 *       Bi=[ dN/dx           0    ]
+-	 *          [   0           dN/dy  ]
+-	 *          [ 1/2*dN/dy  1/2*dN/dx ]
++	 *                   2D                      1D
++	 *       Bi=[ dN/dx           0    ]   Bi=[ dN/dx ]
++	 *          [   0           dN/dy  ]      
++	 *          [ 1/2*dN/dy  1/2*dN/dx ]     
+ 	 * where N is the finiteelement function for node i.
+ 	 *
+ 	 * We assume B has been allocated already, of size: 3x(NDOF2*numnodes)
+@@ -1471,27 +1518,35 @@
+ 	int numnodes = element->GetNumberOfNodes();
+ 
+ 	/*Get nodal functions derivatives*/
+-	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	IssmDouble* dbasis=xNew<IssmDouble>(dim*numnodes);
+ 	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+ 
+ 	/*Build B: */
+-	for(int i=0;i<numnodes;i++){
+-		B[2*numnodes*0+2*i+0] = dbasis[0*numnodes+i];
+-		B[2*numnodes*0+2*i+1] = 0.;
+-		B[2*numnodes*1+2*i+0] = 0.;
+-		B[2*numnodes*1+2*i+1] = dbasis[1*numnodes+i];
+-		B[2*numnodes*2+2*i+0] = .5*dbasis[1*numnodes+i];
+-		B[2*numnodes*2+2*i+1] = .5*dbasis[0*numnodes+i];
++	if(dim==2){
++		for(int i=0;i<numnodes;i++){
++			B[i] = dbasis[i];
++		}
+ 	}
++	else{
++		for(int i=0;i<numnodes;i++){
++			B[2*numnodes*0+2*i+0] = dbasis[0*numnodes+i];
++			B[2*numnodes*0+2*i+1] = 0.;
++			B[2*numnodes*1+2*i+0] = 0.;
++			B[2*numnodes*1+2*i+1] = dbasis[1*numnodes+i];
++			B[2*numnodes*2+2*i+0] = .5*dbasis[1*numnodes+i];
++			B[2*numnodes*2+2*i+1] = .5*dbasis[0*numnodes+i];
++		}
++	}
+ 
+ 	/*Clean-up*/
+ 	xDelete<IssmDouble>(dbasis);
+ }/*}}}*/
+-void StressbalanceAnalysis::GetBSSAFriction(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++void StressbalanceAnalysis::GetBSSAFriction(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*Compute B  matrix. B=[B1 B2 B3] where Bi is square and of size 2. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
+ 	 * by: 
+-	 *                 Bi=[ N   0 ]
++	 *                       2D             1D
++	 *                 Bi=[ N   0 ]    Bi = N
+ 	 *                    [ 0   N ]
+ 	 * where N is the finiteelement function for node i.
+ 	 *
+@@ -1506,21 +1561,29 @@
+ 	element->NodalFunctions(basis,gauss);
+ 
+ 	/*Build L: */
+-	for(int i=0;i<numnodes;i++){
+-		B[2*numnodes*0+2*i+0] = basis[i];
+-		B[2*numnodes*0+2*i+1] = 0.;
+-		B[2*numnodes*1+2*i+0] = 0.;
+-		B[2*numnodes*1+2*i+1] = basis[i];
++	if(dim==2){
++		for(int i=0;i<numnodes;i++){
++			B[2*numnodes*0+2*i+0] = basis[i];
++			B[2*numnodes*0+2*i+1] = 0.;
++			B[2*numnodes*1+2*i+0] = 0.;
++			B[2*numnodes*1+2*i+1] = basis[i];
++		}
+ 	}
++	else{
++		for(int i=0;i<numnodes;i++){
++			B[i] = basis[i];
++		}
++	}
+ 
+ 	/*Clean-up*/
+ 	xDelete<IssmDouble>(basis);
+ }/*}}}*/
+-void StressbalanceAnalysis::GetBSSAprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++void StressbalanceAnalysis::GetBSSAprime(IssmDouble* Bprime,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 
+ 	 * For node i, Bi' can be expressed in the actual coordinate system
+ 	 * by: 
+-	 *       Bi_prime=[ 2*dN/dx    dN/dy ]
++	 *                         2D                        1D
++	 *       Bi_prime=[ 2*dN/dx    dN/dy ]     Bi_prime=[ 2*dN/dx ]
+ 	 *                [   dN/dx  2*dN/dy ]
+ 	 *                [   dN/dy    dN/dx ]
+ 	 * where hNis the finiteelement function for node i.
+@@ -1532,25 +1595,32 @@
+ 	int numnodes = element->GetNumberOfNodes();
+ 
+ 	/*Get nodal functions derivatives*/
+-	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	IssmDouble* dbasis=xNew<IssmDouble>(dim*numnodes);
+ 	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+ 
+ 	/*Build B': */
+-	for(int i=0;i<numnodes;i++){
+-		Bprime[2*numnodes*0+2*i+0] = 2.*dbasis[0*numnodes+i];
+-		Bprime[2*numnodes*0+2*i+1] =    dbasis[1*numnodes+i];
+-		Bprime[2*numnodes*1+2*i+0] =    dbasis[0*numnodes+i];
+-		Bprime[2*numnodes*1+2*i+1] = 2.*dbasis[1*numnodes+i];
+-		Bprime[2*numnodes*2+2*i+0] =    dbasis[1*numnodes+i];
+-		Bprime[2*numnodes*2+2*i+1] =    dbasis[0*numnodes+i];
++	if(dim==2){
++		for(int i=0;i<numnodes;i++){
++			Bprime[2*numnodes*0+2*i+0] = 2.*dbasis[0*numnodes+i];
++			Bprime[2*numnodes*0+2*i+1] =    dbasis[1*numnodes+i];
++			Bprime[2*numnodes*1+2*i+0] =    dbasis[0*numnodes+i];
++			Bprime[2*numnodes*1+2*i+1] = 2.*dbasis[1*numnodes+i];
++			Bprime[2*numnodes*2+2*i+0] =    dbasis[1*numnodes+i];
++			Bprime[2*numnodes*2+2*i+1] =    dbasis[0*numnodes+i];
++		}
+ 	}
++	else{
++		for(int i=0;i<numnodes;i++){
++			Bprime[i] = 2.*dbasis[i];
++		}
++	}
+ 
+ 	/*Clean-up*/
+ 	xDelete<IssmDouble>(dbasis);
+ }/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionSSA(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	int         i,meshtype;
++	int         i,dim,meshtype;
+ 	IssmDouble  rho_ice,g;
+ 	int*        doflist=NULL;
+ 	IssmDouble* xyz_list=NULL;
+@@ -1569,12 +1639,20 @@
+ 		case Mesh2DhorizontalEnum:
+ 			element->GetInputListOnVertices(thickness,ThicknessEnum);
+ 			for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*thickness[i];
++			dim=2;
+ 			break;
+ 		case Mesh3DEnum:
+ 			element->GetVerticesCoordinates(&xyz_list);
+ 			element->GetInputListOnVertices(surface,SurfaceEnum);
+ 			for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
++			dim=2;
+ 			break;
++		case Mesh2DverticalEnum:
++			element->GetVerticesCoordinates(&xyz_list);
++			element->GetInputListOnVertices(surface,SurfaceEnum);
++			for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
++			dim=1;
++			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 	element->AddInput(PressureEnum,pressure,P1Enum);
+@@ -1587,7 +1665,7 @@
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+-		case Mesh3DEnum:
++		case Mesh3DEnum: case Mesh2DverticalEnum:
+ 			if(!element->IsOnBed()){xDelete<IssmDouble>(xyz_list); return;}
+ 			basalelement=element->SpawnBasalElement();
+ 			break;
+@@ -1596,7 +1674,7 @@
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = basalelement->GetNumberOfNodes();
+-	int numdof   = numnodes*2;
++	int numdof   = numnodes*dim;
+ 
+ 	/*Fetch dof list and allocate solution vectors*/
+ 	basalelement->GetDofList(&doflist,SSAApproximationEnum,GsetEnum);
+@@ -1610,31 +1688,37 @@
+ 	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+ 
+ 	/*Transform solution in Cartesian Space*/
+-	basalelement->TransformSolutionCoord(&values[0],XYEnum);
+-	basalelement->FindParam(&meshtype,MeshTypeEnum);
++	if(dim==2) basalelement->TransformSolutionCoord(&values[0],XYEnum);
+ 
+ 	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+ 	for(i=0;i<numnodes;i++){
+ 		vx[i]=values[i*2+0];
+-		vy[i]=values[i*2+1];
++		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
+ 
+-		/*Check solution*/
+-		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
+-		if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
++		if(dim==2){
++			vy[i]=values[i*2+1];
++			if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
++		}
+ 	}
+ 
+ 	/*Get Vz and compute vel*/
+-	basalelement->GetInputListOnNodes(&vz[0],VzEnum,0.);
+-	for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
++	if(dim==2){
++		basalelement->GetInputListOnNodes(&vz[0],VzEnum,0.);
++		for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
++	}
++	else{
++		element->GetInputListOnNodes(&vy[0],VyEnum,0.);
++		for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i]);
++	}
+ 
+ 	/*Now, we have to move the previous Vx and Vy inputs  to old 
+ 	 * status, otherwise, we'll wipe them off: */
+ 	element->InputChangeName(VxEnum,VxPicardEnum);
+-	element->InputChangeName(VyEnum,VyPicardEnum);
++	if(dim==2)element->InputChangeName(VyEnum,VyPicardEnum);
+ 
+ 	/*Add vx and vy as inputs to the tria element: */
+ 	element->AddBasalInput(VxEnum,vx,P1Enum);
+-	element->AddBasalInput(VyEnum,vy,P1Enum);
++	if(dim==2)element->AddBasalInput(VyEnum,vy,P1Enum);
+ 	element->AddBasalInput(VelEnum,vel,P1Enum);
+ 
+ 	/*Free ressources:*/
+@@ -1705,8 +1789,8 @@
+ 		gauss->SynchronizeGaussBase(gauss_base);
+ 
+ 		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+-		this->GetBSSA(B,basalelement,xyz_list,gauss_base);
+-		this->GetBSSAprime(Bprime,basalelement,xyz_list,gauss_base);
++		this->GetBSSA(B,basalelement,2,xyz_list,gauss_base);
++		this->GetBSSAprime(Bprime,basalelement,2,xyz_list,gauss_base);
+ 
+ 		element->ViscosityL1L2(&viscosity,xyz_list,gauss,vx_input,vy_input,surface_input);
+ 
+@@ -2427,7 +2511,7 @@
+ 			Bprime[numnodes*0+i] = 2.*dbasis[0*numnodes+i];
+ 			Bprime[numnodes*1+i] = dbasis[1*numnodes+i];
+ 		}
+-		}
++	}
+ 
+ 	/*Clean-up*/
+ 	xDelete<IssmDouble>(dbasis);
+@@ -3695,8 +3779,8 @@
+ 		gauss->SynchronizeGaussBase(gauss_tria);
+ 
+ 		element->JacobianDeterminant(&Jdet, xyz_list,gauss);
+-		this->GetBSSA(&B[0][0],basaltria, xyz_list, gauss_tria);
+-		this->GetBSSAprime(&Bprime[0][0], basaltria,xyz_list, gauss_tria);
++		this->GetBSSA(&B[0][0],basaltria,2,xyz_list, gauss_tria);
++		this->GetBSSAprime(&Bprime[0][0],basaltria,2,xyz_list, gauss_tria);
+ 
+ 		if(approximation==SSAHOApproximationEnum){
+ 			element->ViscosityHO(&viscosity,dim,xyz_list,gauss,vx_input,vy_input);
+@@ -3997,7 +4081,7 @@
+ 
+ 		element->JacobianDeterminant(&Jdet, xyz_list,gauss);
+ 		this->GetBSSAHO(B, element,xyz_list, gauss);
+-		this->GetBSSAprime(Bprime, basaltria,xyz_list, gauss_tria); 
++		this->GetBSSAprime(Bprime,basaltria,2,xyz_list, gauss_tria); 
+ 		element->ViscosityHO(&viscosity,3,xyz_list,gauss,vx_input,vy_input);
+ 		element->ViscosityHO(&oldviscosity,3,xyz_list,gauss,vxold_input,vyold_input);
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17297-17298.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17297-17298.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17297-17298.diff	(revision 17802)
@@ -0,0 +1,80 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17297)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17298)
+@@ -1272,7 +1272,7 @@
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+ 	switch(meshtype){
+ 		case Mesh2DverticalEnum:   dim = 1; bsize = 1; break;
+-		case Mesh2DhorizontalEnum: dim = 2; bsize = 1; break;
++		case Mesh2DhorizontalEnum: dim = 2; bsize = 3; break;
+ 		case Mesh3DEnum:           dim = 2; bsize = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+@@ -1294,9 +1294,9 @@
+ 	Input* vxold_input=element->GetInput(VxPicardEnum);      _assert_(vxold_input);
+ 	Input* vy_input    = NULL;
+ 	Input* vyold_input = NULL;
+-	if(dim==3){
+-		vy_input=element->GetInput(VyEnum);          _assert_(vy_input);
+-		vyold_input=element->GetInput(VyPicardEnum); _assert_(vyold_input);
++	if(dim==2){
++		vy_input    = element->GetInput(VyEnum);       _assert_(vy_input);
++		vyold_input = element->GetInput(VyPicardEnum); _assert_(vyold_input);
+ 	}
+ 	element->FindParam(&viscosity_overshoot,StressbalanceViscosityOvershootEnum);
+ 
+@@ -1315,12 +1315,15 @@
+ 
+ 		newviscosity=viscosity+viscosity_overshoot*(viscosity-oldviscosity);
+ 		D_scalar=2.*newviscosity*thickness*gauss->weight*Jdet;
+-		for(int i=0;i<3;i++) D[i*3+i]=D_scalar;
++		for(int i=0;i<bsize;i++) D[i*bsize+i]=D_scalar;
+ 
+ 		TripleMultiply(B,bsize,numdof,1,
+ 					D,bsize,bsize,0,
+ 					Bprime,bsize,numdof,0,
+ 					&Ke->values[0],1);
++
++		for(int i=0;i<bsize*numdof;i++) if(B[i]==1.) _error_("STREAM");
++		for(int i=0;i<bsize*numdof;i++) if(Bprime[i]==1.) _error_("STREAM");
+ 	}
+ 
+ 	/*Transform Coordinate System*/
+@@ -1524,11 +1527,6 @@
+ 	/*Build B: */
+ 	if(dim==2){
+ 		for(int i=0;i<numnodes;i++){
+-			B[i] = dbasis[i];
+-		}
+-	}
+-	else{
+-		for(int i=0;i<numnodes;i++){
+ 			B[2*numnodes*0+2*i+0] = dbasis[0*numnodes+i];
+ 			B[2*numnodes*0+2*i+1] = 0.;
+ 			B[2*numnodes*1+2*i+0] = 0.;
+@@ -1537,6 +1535,11 @@
+ 			B[2*numnodes*2+2*i+1] = .5*dbasis[0*numnodes+i];
+ 		}
+ 	}
++	else{
++		for(int i=0;i<numnodes;i++){
++			B[i] = dbasis[i];
++		}
++	}
+ 
+ 	/*Clean-up*/
+ 	xDelete<IssmDouble>(dbasis);
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17297)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17298)
+@@ -748,7 +748,7 @@
+ 	IssmDouble dvy[3];
+ 
+ 	/*Check that both inputs have been found*/
+-	if (!vx_input || !vy_input){
++	if(!vx_input || !vy_input){
+ 		_error_("Input missing. Here are the input pointers we have for vx: " << vx_input << ", vy: " << vy_input << "\n");
+ 	}
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17298-17299.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17298-17299.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17298-17299.diff	(revision 17802)
@@ -0,0 +1,21 @@
+Index: ../trunk-jpl/src/m/classes/mesh2d.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh2d.m	(revision 17298)
++++ ../trunk-jpl/src/m/classes/mesh2d.m	(revision 17299)
+@@ -33,6 +33,16 @@
+ 			switch nargin
+ 				case 0
+ 					obj=setdefaultparameters(obj);
++				case 1
++					self=mesh2d;
++					object=varargin{1};
++					fields=fieldnames(object);
++					for i=1:length(fields)
++						field=fields{i};
++						if ismember(field,properties('mesh2d')),
++							bg.(field)=object.(field);
++						end
++					end
+ 				otherwise
+ 					error('constructor not supported');
+ 			end
Index: issm/oecreview/Archive/16554-17801/ISSM-17299-17300.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17299-17300.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17299-17300.diff	(revision 17802)
@@ -0,0 +1,27 @@
+Index: ../trunk-jpl/src/m/classes/mesh2d.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh2d.m	(revision 17299)
++++ ../trunk-jpl/src/m/classes/mesh2d.m	(revision 17300)
+@@ -29,18 +29,18 @@
+ 		extractedelements           = NaN
+ 	end
+ 	methods
+-		function obj = mesh2d(varargin) % {{{
++		function self = mesh2d(varargin) % {{{
+ 			switch nargin
+ 				case 0
+-					obj=setdefaultparameters(obj);
++					self=setdefaultparameters(self);
+ 				case 1
+-					self=mesh2d;
++					self=mesh2d();
+ 					object=varargin{1};
+ 					fields=fieldnames(object);
+ 					for i=1:length(fields)
+ 						field=fields{i};
+ 						if ismember(field,properties('mesh2d')),
+-							bg.(field)=object.(field);
++							self.(field)=object.(field);
+ 						end
+ 					end
+ 				otherwise
Index: issm/oecreview/Archive/16554-17801/ISSM-17300-17301.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17300-17301.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17300-17301.diff	(revision 17802)
@@ -0,0 +1,8 @@
+
+Property changes on: ../trunk-jpl/src/c/modules/SetActiveNodesLSMx
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
Index: issm/oecreview/Archive/16554-17801/ISSM-17301-17302.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17301-17302.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17301-17302.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17301)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17302)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ #include "../solutionsequences/solutionsequences.h"
+ 
+-#define FSANALYTICAL 5
++//#define FSANALYTICAL 5
+ 
+ /*Model processing*/
+ int  StressbalanceAnalysis::DofsPerNode(int** pdoftype,int meshtype,int approximation){/*{{{*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17302-17303.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17302-17303.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17302-17303.diff	(revision 17802)
@@ -0,0 +1,492 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17302)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17303)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ #include "../solutionsequences/solutionsequences.h"
+ 
+-//#define FSANALYTICAL 5
++//#define FSANALYTICAL 1
+ 
+ /*Model processing*/
+ int  StressbalanceAnalysis::DofsPerNode(int** pdoftype,int meshtype,int approximation){/*{{{*/
+@@ -2977,29 +2977,11 @@
+ 		x_coord=element->GetXcoord(gauss);
+ 		y_coord=element->GetYcoord(gauss);
+ 		if(dim==3) z_coord=element->GetZcoord(gauss);
++		else z_coord=0.;
+ 
+-		#if FSANALYTICAL == 1
+-			forcex=fx1(x_coord,y_coord,z_coord);
+-			forcey=fy1(x_coord,y_coord,z_coord);
+-			forcez=fz1(x_coord,y_coord,z_coord);
+-		#elif FSANALYTICAL == 2
+-			forcex=fx2(x_coord,y_coord,z_coord);
+-			forcey=fy2(x_coord,y_coord,z_coord);
+-			forcez=fz2(x_coord,y_coord,z_coord);
+-		#elif FSANALYTICAL == 3
+-			forcex=fx3(x_coord,y_coord);
+-			forcey=fy3(x_coord,y_coord);
+-		#elif FSANALYTICAL == 4
+-			forcex=fx4(x_coord,y_coord,z_coord);
+-			forcey=fy4(x_coord,y_coord,z_coord);
+-			forcez=fz4(x_coord,y_coord,z_coord);
+-		#elif FSANALYTICAL == 5
+-			forcex=fx5(x_coord,y_coord,z_coord);
+-			forcey=fy5(x_coord,y_coord,z_coord);
+-			forcez=fz5(x_coord,y_coord,z_coord);
+-		#else 
+-			_error_("FS analytical not implemented yet");
+-		#endif
++		forcex=fx(x_coord,y_coord,z_coord,FSANALYTICAL);
++		forcey=fy(x_coord,y_coord,z_coord,FSANALYTICAL);
++		forcez=fz(x_coord,y_coord,z_coord,FSANALYTICAL);
+ 
+ 		for(i=0;i<vnumnodes;i++){
+ 			pe->values[i*dim+0] += forcex *Jdet*gauss->weight*vbasis[i];
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical1.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical1.cpp	(revision 17302)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical1.cpp	(revision 17303)
+@@ -1,36 +0,0 @@
+-/*!\file fx.cpp
+- * \brief: analytical fonction for FS 
+- * test case for a cube with Dirichlet conditions on all faces
+- */
+-
+-#include <math.h>
+-#include "../Numerics/types.h"
+-#include "../Numerics/constants.h"
+-
+-IssmDouble fx1(IssmDouble x,IssmDouble y,IssmDouble z){   
+-	IssmDouble p = 2.0;  
+-	IssmDouble q = 2.0;   
+-	IssmDouble functionx;
+-
+-	functionx =  4. * PI*PI * p*p * (cos(p*PI*x)-1) * sin(p*PI*y) * sin(p*PI*z)+ 2. * PI*PI*p*p*  sin(p*PI*y)    * sin(p*PI*z) * cos(p*PI*x) + q * PI * cos(q*PI*x) * sin(q*PI*y) * sin(q*PI*z);
+-
+-	return functionx;
+-}
+-IssmDouble fy1(IssmDouble x,IssmDouble y,IssmDouble z){   
+-	IssmDouble p = 2.0;  
+-	IssmDouble q = 2.0;   
+-	IssmDouble functiony;
+-
+-	functiony = - 4. * PI*PI * p*p * (cos(p*PI*y)-1) * sin(p*PI*x) * sin(p*PI*z)-  2. * PI*PI * p*p *  sin(p*PI*x)    * cos(p*PI*y) * sin(p*PI*z)+ q * PI * sin(q*PI*x) * cos(q*PI*y) * sin(q*PI*z);
+-
+-	return functiony;
+-}
+-IssmDouble fz1(IssmDouble x,IssmDouble y,IssmDouble z){   
+-	IssmDouble p = 2.0;  
+-	IssmDouble q = 2.0;   
+-	IssmDouble functionz;
+-
+-	functionz = - 2. * PI*PI * p*p * (cos(p*PI*z)-1) * sin(p*PI*x) * sin(p*PI*y)-PI*PI * p*p *  sin(p*PI*x)    * sin(p*PI*y) * cos(p*PI*z)+ q * PI * sin(q*PI*x) * sin(q*PI*y) * cos(q*PI*z);
+-
+-	return functionz;
+-}
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical2.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical2.cpp	(revision 17302)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical2.cpp	(revision 17303)
+@@ -1,36 +0,0 @@
+-/*!\file fx.cpp
+- * \brief: analytical fonction for FS 
+- * test case for a cube with Dirichlet conditions on all faces and no variation in z
+- */
+-
+-#include <math.h>
+-#include "../Numerics/types.h"
+-#include "../Numerics/constants.h"
+-
+-IssmDouble fx2(IssmDouble x,IssmDouble y,IssmDouble z){   
+-	IssmDouble p = 2.0;  
+-	IssmDouble q = 2.0;   
+-	IssmDouble functionx;
+-
+-	functionx = 2.*(cos(PI*p*x) - 1)*PI*PI*p*p*sin(PI*p*y) + 3*PI*PI*p*p*sin(PI*p*y)*cos(PI*p*x) + PI*q*sin(PI*q*y)*cos(PI*q*x);
+-
+-	return functionx;
+-}
+-IssmDouble fy2(IssmDouble x,IssmDouble y,IssmDouble z){   
+-	IssmDouble p = 2.0;  
+-	IssmDouble q = 2.0;   
+-	IssmDouble functiony;
+-
+-	functiony = -(cos(PI*p*y) - 1)*PI*PI*p*p*sin(PI*p*x) + PI*q*sin(PI*q*x)*cos(PI*q*y);
+-
+-	return functiony;
+-}
+-IssmDouble fz2(IssmDouble x,IssmDouble y,IssmDouble z){   
+-	IssmDouble p = 2.0;  
+-	IssmDouble q = 2.0;   
+-	IssmDouble functionz;
+-
+-	functionz = 2*PI*PI*p*p*sin(PI*p*x)*sin(PI*p*y);
+-
+-	return functionz;
+-}
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp	(revision 17302)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp	(revision 17303)
+@@ -1,72 +0,0 @@
+-/*!\file fx.cpp
+- * \brief: analytical fonction for FS 
+- * test case for a cube with Dirichlet conditions on all faces and no variation in z
+- */
+-
+-#include <math.h>
+-#include "../Numerics/types.h"
+-#include "../Numerics/constants.h"
+-
+-IssmDouble fx3(IssmDouble x,IssmDouble y){   
+-	IssmDouble functionx;
+-	IssmDouble z=y;
+-
+-	functionx =  4*pow(x, 2)*z*pow(x - 1, 2) + 4*pow(x, 2)*z*(z - 1)*(2*z - 1) + 4*pow(x, 2)*pow(x - 1, 2)*(z - 1) + 2*pow(x, 2)*pow(x - 1, 2)*(2*z - 1) + 16*x*z*(x - 1)*(z - 1)*(2*z - 1) - 4*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) + 6*pow(z, 2)*(6*pow(x, 2) - 6*x + 1) + 4*z*pow(x - 1, 2)*(z - 1)*(2*z - 1) - 2*z*(6*pow(x, 2) - 6*x + 1) + z - 1.0L/2.0L;
+-	return functionx;
+-}
+-IssmDouble fy3(IssmDouble x,IssmDouble y){   
+-	IssmDouble functiony;
+-	IssmDouble z=y;
+-
+-	functiony = -8*pow(x, 3) + 4*pow(x, 2)*z*(x - 1)*(z - 1) + 2*pow(x, 2)*z*(x - 1)*(2*z - 1) + 2*pow(x, 2)*(x - 1)*(z - 1)*(2*z - 1) + 12*pow(x, 2) + 4*x*z*pow(x - 1, 2)*(z - 1) + 2*x*z*pow(x - 1, 2)*(2*z - 1) + 2*x*pow(x - 1, 2)*(z - 1)*(2*z - 1) - 3*x - 6*pow(z, 4)*(2*x - 1) + 12*pow(z, 3)*(2*x - 1) - 6*pow(z, 2)*(2*x - 1) - 24*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + 24*z*(2*pow(x, 3) - 3*pow(x, 2) + x) - 1.0L/2.0L;
+-
+-	return functiony;
+-}
+-IssmDouble fx4(IssmDouble x,IssmDouble y,IssmDouble z){   
+-	IssmDouble functionx;
+-
+-	functionx = 4*pow(x, 2)*y*z*pow(x - 1, 2)*(z - 1) + 4*pow(x, 2)*y*z*(y - 1)*(2*y - 1)*(z - 1) + 2*pow(x, 2)*y*pow(x - 1, 2)*(y - 1)*(2*y - 1) + 4*pow(x, 2)*z*pow(x - 1, 2)*(y - 1)*(z - 1) + 2*pow(x, 2)*z*pow(x - 1, 2)*(2*y - 1)*(z - 1) - 4*x*pow(y, 2)*z*(x - 1)*(y - 1)*(z - 1) - 2*x*pow(y, 2)*z*(2*x - 1)*(y - 1)*(z - 1) - 4*x*y*z*(x - 1)*pow(y - 1, 2)*(z - 1) + 16*x*y*z*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 2*x*y*z*(2*x - 1)*pow(y - 1, 2)*(z - 1) - 2*pow(y, 2)*z*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 4*y*z*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 2*y*z*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1) + y - 1.0L/2.0L;
+-
+-	return functionx;
+-}
+-IssmDouble fy4(IssmDouble x,IssmDouble y,IssmDouble z){   
+-	IssmDouble functiony;
+-
+-	functiony = 4*pow(x, 2)*y*z*(x - 1)*(y - 1)*(z - 1) + 2*pow(x, 2)*y*z*(x - 1)*(2*y - 1)*(z - 1) + 2*pow(x, 2)*z*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 4*x*pow(y, 2)*z*(x - 1)*(2*x - 1)*(z - 1) - 4*x*pow(y, 2)*z*pow(y - 1, 2)*(z - 1) - 2*x*pow(y, 2)*(x - 1)*(2*x - 1)*pow(y - 1, 2) + 4*x*y*z*pow(x - 1, 2)*(y - 1)*(z - 1) + 2*x*y*z*pow(x - 1, 2)*(2*y - 1)*(z - 1) - 16*x*y*z*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 2*x*z*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 4*x*z*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1) + x - 4*pow(y, 2)*z*(x - 1)*pow(y - 1, 2)*(z - 1) - 2*pow(y, 2)*z*(2*x - 1)*pow(y - 1, 2)*(z - 1) - 1.0L/2.0L;
+-
+-	return functiony;
+-}
+-IssmDouble fz4(IssmDouble x,IssmDouble y,IssmDouble z){   
+-	IssmDouble functionz;
+-
+-	functionz = 2*pow(x, 2)*y*z*(x - 1)*(y - 1)*(2*y - 1) + 2*pow(x, 2)*y*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 2*x*pow(y, 2)*z*(x - 1)*(2*x - 1)*(y - 1) - 2*x*pow(y, 2)*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 2*x*y*z*pow(x - 1, 2)*(y - 1)*(2*y - 1) - 2*x*y*z*(x - 1)*(2*x - 1)*pow(y - 1, 2) + 2*x*y*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 2*x*y*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1);
+-
+-	return functionz;
+-}
+-IssmDouble fx5(IssmDouble x,IssmDouble y,IssmDouble z){   
+-	IssmDouble functionx;
+-	IssmDouble p=2;
+-	IssmDouble q=2;
+-
+-	functionx = 4*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*sin(PI*p*y)*sin(PI*p*z) + 2*pow(PI, 2)*pow(p, 2)*sin(PI*p*y)*sin(PI*p*z)*cos(PI*p*x) + PI*q*sin(PI*q*y)*sin(PI*q*z)*cos(PI*q*x);
+-
+-	return functionx;
+-}
+-IssmDouble fy5(IssmDouble x,IssmDouble y,IssmDouble z){   
+-	IssmDouble functiony;
+-	IssmDouble p=2;
+-	IssmDouble q=2;
+-
+-	functiony =  -2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*sin(PI*p*x)*sin(PI*p*z) - pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*z)*cos(PI*p*y) + PI*q*sin(PI*q*x)*sin(PI*q*z)*cos(PI*q*y);
+-
+-	return functiony;
+-}
+-IssmDouble fz5(IssmDouble x,IssmDouble y,IssmDouble z){   
+-	IssmDouble functionz;
+-	IssmDouble p=2;
+-	IssmDouble q=2;
+-
+-	functionz =  -2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*z) - 1)*sin(PI*p*x)*sin(PI*p*y) - pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*y)*cos(PI*p*z) + PI*q*sin(PI*q*x)*sin(PI*q*y)*cos(PI*q*z);
+-
+-	return functionz;
+-}
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h	(revision 17302)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h	(revision 17303)
+@@ -7,19 +7,24 @@
+ 
+ #include "../Numerics/types.h"
+ 
+-IssmDouble fx1(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+-IssmDouble fy1(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+-IssmDouble fz1(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+-IssmDouble fx2(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+-IssmDouble fy2(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+-IssmDouble fz2(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+-IssmDouble fx3(IssmDouble x_coord, IssmDouble y_coord);
+-IssmDouble fy3(IssmDouble x_coord, IssmDouble y_coord);
++IssmDouble fx(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord, int FSANALYTICAL);
++IssmDouble fy(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord, int FSANALYTICAL);
++IssmDouble fz(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord, int FSANALYTICAL);
++IssmDouble fx1(IssmDouble x_coord, IssmDouble y_coord);
++IssmDouble fy1(IssmDouble x_coord, IssmDouble y_coord);
++IssmDouble fx2(IssmDouble x_coord, IssmDouble y_coord);
++IssmDouble fy2(IssmDouble x_coord, IssmDouble y_coord);
++IssmDouble fx3(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
++IssmDouble fy3(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
++IssmDouble fz3(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+ IssmDouble fx4(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+ IssmDouble fy4(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+ IssmDouble fz4(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+ IssmDouble fx5(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+ IssmDouble fy5(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+ IssmDouble fz5(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
++IssmDouble fx6(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
++IssmDouble fy6(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
++IssmDouble fz6(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+ 
+ #endif //ifndef _SHARED_ANALYTICALS_H_
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp	(revision 0)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp	(revision 17303)
+@@ -0,0 +1,229 @@
++/*!\file fx.cpp
++ * \brief: analytical fonction for FS 
++ * test case for a cube with Dirichlet conditions on all faces and no variation in z
++ * case 1: 2d test with quadratic functions
++ * case 2: 2d test with sinusoidal functions
++ * case 3: 3d test with quadratic functions
++ * case 4: 3d test with sinusoidal functions
++ * case 5: 3d test with sinusoidal functions, no variations with z, non homogeneous Dirichlet conditions
++ * case 6: 3d test with sinusoidal functions, non homogeneous Dirichlet conditions
++ */
++
++#include <math.h>
++#include "../Numerics/types.h"
++#include "../Numerics/constants.h"
++#include "./fsanalyticals.h"
++#include "../shared.h"
++
++IssmDouble fx(IssmDouble x,IssmDouble y,IssmDouble z,int FSANALYTICAL){ /*{{{*/ 
++	IssmDouble fx;
++
++	switch(FSANALYTICAL){
++		case 1:
++			return fx=fx1(x,y);
++		case 2: 
++			return fx=fx2(x,y);
++		case 3: 
++			return fx=fx3(x,y,z);
++		case 4: 
++			return fx=fx4(x,y,z);
++		case 5: 
++			return fx=fx5(x,y,z);
++		case 6: 
++			return fx=fx6(x,y,z);
++		default:
++			_error_("FS analytical solution"<<FSANALYTICAL<<" not implemented yet");
++	}
++}
++/*}}}*/
++IssmDouble fy(IssmDouble x,IssmDouble y,IssmDouble z,int FSANALYTICAL){ /*{{{*/ 
++	IssmDouble fy;
++
++	switch(FSANALYTICAL){
++		case 1:
++			return fy=fy1(x,y);
++		case 2: 
++			return fy=fy2(x,y);
++		case 3: 
++			return fy=fy3(x,y,z);
++		case 4: 
++			return fy=fy4(x,y,z);
++		case 5: 
++			return fy=fy5(x,y,z);
++		case 6: 
++			return fy=fy6(x,y,z);
++		default:
++			_error_("FS analytical solution"<<FSANALYTICAL<<" not implemented yet");
++	}
++}
++/*}}}*/
++IssmDouble fz(IssmDouble x,IssmDouble y,IssmDouble z,int FSANALYTICAL){ /*{{{*/ 
++	IssmDouble fz;
++
++	switch(FSANALYTICAL){
++		case 1: case 2:
++			return fz=0.;
++		case 3: 
++			return fz=fz3(x,y,z);
++		case 4: 
++			return fz=fz4(x,y,z);
++		case 5: 
++			return fz=fz5(x,y,z);
++		case 6: 
++			return fz=fz6(x,y,z);
++		default:
++			_error_("FS analytical solution"<<FSANALYTICAL<<" not implemented yet");
++	}
++}
++/*}}}*/
++IssmDouble fx1(IssmDouble x,IssmDouble y){/*{{{*/
++	IssmDouble functionx;
++	IssmDouble z=y;
++
++	functionx =  4*pow(x, 2)*z*pow(x - 1, 2) + 4*pow(x, 2)*z*(z - 1)*(2*z - 1) + 4*pow(x, 2)*pow(x - 1, 2)*(z - 1) + 2*pow(x, 2)*pow(x - 1, 2)*(2*z - 1) + 16*x*z*(x - 1)*(z - 1)*(2*z - 1) - 4*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) + 6*pow(z, 2)*(6*pow(x, 2) - 6*x + 1) + 4*z*pow(x - 1, 2)*(z - 1)*(2*z - 1) - 2*z*(6*pow(x, 2) - 6*x + 1) + z - 1.0L/2.0L;
++	return functionx;
++}
++/*}}}*/
++IssmDouble fy1(IssmDouble x,IssmDouble y){   /*{{{*/
++	IssmDouble functiony;
++	IssmDouble z=y;
++
++	functiony = -8*pow(x, 3) + 4*pow(x, 2)*z*(x - 1)*(z - 1) + 2*pow(x, 2)*z*(x - 1)*(2*z - 1) + 2*pow(x, 2)*(x - 1)*(z - 1)*(2*z - 1) + 12*pow(x, 2) + 4*x*z*pow(x - 1, 2)*(z - 1) + 2*x*z*pow(x - 1, 2)*(2*z - 1) + 2*x*pow(x - 1, 2)*(z - 1)*(2*z - 1) - 3*x - 6*pow(z, 4)*(2*x - 1) + 12*pow(z, 3)*(2*x - 1) - 6*pow(z, 2)*(2*x - 1) - 24*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + 24*z*(2*pow(x, 3) - 3*pow(x, 2) + x) - 1.0L/2.0L;
++
++	return functiony;
++}
++/*}}}*/
++IssmDouble fx2(IssmDouble x,IssmDouble y){   /*{{{*/
++	IssmDouble functionx;
++	IssmDouble z=y;
++	int p=2;
++	int q=2;
++
++	functionx = 10*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 3)*pow(sin(PI*p*z), 2)*cos(PI*p*z) - 2*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 3)*pow(cos(PI*p*z), 3) - 6*pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*pow(sin(PI*p*z), 2)*pow(cos(PI*p*x), 2)*cos(PI*p*z) + PI*q*sin(PI*q*z)*cos(PI*q*x);
++	return functionx;
++}
++/*}}}*/
++IssmDouble fy2(IssmDouble x,IssmDouble y){   /*{{{*/
++	IssmDouble functiony;
++	IssmDouble z=y;
++	int p=2;
++	int q=2;
++
++	functiony = -10*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*z), 3)*cos(PI*p*x) + 6*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*sin(PI*p*z)*cos(PI*p*x)*pow(cos(PI*p*z), 2) + 2*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*z), 3)*pow(cos(PI*p*x), 3) + PI*q*sin(PI*q*x)*cos(PI*q*z);
++	return functiony;
++}
++/*}}}*/
++IssmDouble fx3(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
++	IssmDouble functionx;
++
++	functionx = 4*pow(x, 2)*y*z*pow(x - 1, 2)*(z - 1) + 4*pow(x, 2)*y*z*(y - 1)*(2*y - 1)*(z - 1) + 2*pow(x, 2)*y*pow(x - 1, 2)*(y - 1)*(2*y - 1) + 4*pow(x, 2)*z*pow(x - 1, 2)*(y - 1)*(z - 1) + 2*pow(x, 2)*z*pow(x - 1, 2)*(2*y - 1)*(z - 1) - 4*x*pow(y, 2)*z*(x - 1)*(y - 1)*(z - 1) - 2*x*pow(y, 2)*z*(2*x - 1)*(y - 1)*(z - 1) - 4*x*y*z*(x - 1)*pow(y - 1, 2)*(z - 1) + 16*x*y*z*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 2*x*y*z*(2*x - 1)*pow(y - 1, 2)*(z - 1) - 2*pow(y, 2)*z*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 4*y*z*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 2*y*z*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1) + y - 1.0L/2.0L;
++
++	return functionx;
++}
++/*}}}*/
++IssmDouble fy3(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
++	IssmDouble functiony;
++
++	functiony = 4*pow(x, 2)*y*z*(x - 1)*(y - 1)*(z - 1) + 2*pow(x, 2)*y*z*(x - 1)*(2*y - 1)*(z - 1) + 2*pow(x, 2)*z*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 4*x*pow(y, 2)*z*(x - 1)*(2*x - 1)*(z - 1) - 4*x*pow(y, 2)*z*pow(y - 1, 2)*(z - 1) - 2*x*pow(y, 2)*(x - 1)*(2*x - 1)*pow(y - 1, 2) + 4*x*y*z*pow(x - 1, 2)*(y - 1)*(z - 1) + 2*x*y*z*pow(x - 1, 2)*(2*y - 1)*(z - 1) - 16*x*y*z*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 2*x*z*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 4*x*z*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1) + x - 4*pow(y, 2)*z*(x - 1)*pow(y - 1, 2)*(z - 1) - 2*pow(y, 2)*z*(2*x - 1)*pow(y - 1, 2)*(z - 1) - 1.0L/2.0L;
++
++	return functiony;
++}
++/*}}}*/
++IssmDouble fz3(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
++	IssmDouble functionz;
++
++	functionz = 2*pow(x, 2)*y*z*(x - 1)*(y - 1)*(2*y - 1) + 2*pow(x, 2)*y*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 2*x*pow(y, 2)*z*(x - 1)*(2*x - 1)*(y - 1) - 2*x*pow(y, 2)*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 2*x*y*z*pow(x - 1, 2)*(y - 1)*(2*y - 1) - 2*x*y*z*(x - 1)*(2*x - 1)*pow(y - 1, 2) + 2*x*y*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 2*x*y*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1);
++
++	return functionz;
++}
++/*}}}*/
++IssmDouble fx4(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
++	IssmDouble functionx;
++	IssmDouble p=2;
++	IssmDouble q=2;
++
++	functionx = 4*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*sin(PI*p*y)*sin(PI*p*z) + 2*pow(PI, 2)*pow(p, 2)*sin(PI*p*y)*sin(PI*p*z)*cos(PI*p*x) + PI*q*sin(PI*q*y)*sin(PI*q*z)*cos(PI*q*x);
++
++	return functionx;
++}
++/*}}}*/
++IssmDouble fy4(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
++	IssmDouble functiony;
++	IssmDouble p=2;
++	IssmDouble q=2;
++
++	functiony =  -2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*sin(PI*p*x)*sin(PI*p*z) - pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*z)*cos(PI*p*y) + PI*q*sin(PI*q*x)*sin(PI*q*z)*cos(PI*q*y);
++
++	return functiony;
++}
++/*}}}*/
++IssmDouble fz4(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
++	IssmDouble functionz;
++	IssmDouble p=2;
++	IssmDouble q=2;
++
++	functionz =  -2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*z) - 1)*sin(PI*p*x)*sin(PI*p*y) - pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*y)*cos(PI*p*z) + PI*q*sin(PI*q*x)*sin(PI*q*y)*cos(PI*q*z);
++
++	return functionz;
++}
++/*}}}*/
++IssmDouble fx5(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
++	IssmDouble p = 2.0;  
++	IssmDouble q = 2.0;   
++	IssmDouble functionx;
++
++	functionx = 2.*(cos(PI*p*x) - 1)*PI*PI*p*p*sin(PI*p*y) + 3*PI*PI*p*p*sin(PI*p*y)*cos(PI*p*x) + PI*q*sin(PI*q*y)*cos(PI*q*x);
++
++	return functionx;
++}
++/*}}}*/
++IssmDouble fy5(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
++	IssmDouble p = 2.0;  
++	IssmDouble q = 2.0;   
++	IssmDouble functiony;
++
++	functiony = -(cos(PI*p*y) - 1)*PI*PI*p*p*sin(PI*p*x) + PI*q*sin(PI*q*x)*cos(PI*q*y);
++
++	return functiony;
++}
++/*}}}*/
++IssmDouble fz5(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
++	IssmDouble p = 2.0;  
++	IssmDouble q = 2.0;   
++	IssmDouble functionz;
++
++	functionz = 2*PI*PI*p*p*sin(PI*p*x)*sin(PI*p*y);
++
++	return functionz;
++}
++/*}}}*/
++IssmDouble fx6(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
++	IssmDouble p = 2.0;  
++	IssmDouble q = 2.0;   
++	IssmDouble functionx;
++
++	functionx =  4. * PI*PI * p*p * (cos(p*PI*x)-1) * sin(p*PI*y) * sin(p*PI*z)+ 2. * PI*PI*p*p*  sin(p*PI*y)    * sin(p*PI*z) * cos(p*PI*x) + q * PI * cos(q*PI*x) * sin(q*PI*y) * sin(q*PI*z);
++
++	return functionx;
++}
++/*}}}*/
++IssmDouble fy6(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
++	IssmDouble p = 2.0;  
++	IssmDouble q = 2.0;   
++	IssmDouble functiony;
++
++	functiony = - 4. * PI*PI * p*p * (cos(p*PI*y)-1) * sin(p*PI*x) * sin(p*PI*z)-  2. * PI*PI * p*p *  sin(p*PI*x)    * cos(p*PI*y) * sin(p*PI*z)+ q * PI * sin(q*PI*x) * cos(q*PI*y) * sin(q*PI*z);
++
++	return functiony;
++}
++/*}}}*/
++IssmDouble fz6(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
++	IssmDouble p = 2.0;  
++	IssmDouble q = 2.0;   
++	IssmDouble functionz;
++
++	functionz = - 2. * PI*PI * p*p * (cos(p*PI*z)-1) * sin(p*PI*x) * sin(p*PI*y)-PI*PI * p*p *  sin(p*PI*x)    * sin(p*PI*y) * cos(p*PI*z)+ q * PI * sin(q*PI*x) * sin(q*PI*y) * cos(q*PI*z);
++
++	return functionz;
++}
++/*}}}*/
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17302)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17303)
+@@ -177,9 +177,7 @@
+ 					./shared/LatLong/Ll2xyx.cpp\
+ 					./shared/LatLong/Xy2llx.cpp\
+ 					./shared/FSanalyticals/fsanalyticals.h\
+-					./shared/FSanalyticals/FSanalytical1.cpp\
+-					./shared/FSanalyticals/FSanalytical2.cpp\
+-					./shared/FSanalyticals/FSanalytical3.cpp\
++					./shared/FSanalyticals/fsanalyticals.cpp\
+ 					./shared/Enum/Enum.h\
+ 					./shared/Enum/EnumDefinitions.h\
+ 					./shared/Enum/EnumToStringx.cpp\
Index: issm/oecreview/Archive/16554-17801/ISSM-17303-17304.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17303-17304.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17303-17304.diff	(revision 17802)
@@ -0,0 +1,79 @@
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h	(revision 17303)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h	(revision 17304)
+@@ -7,9 +7,9 @@
+ 
+ #include "../Numerics/types.h"
+ 
+-IssmDouble fx(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord, int FSANALYTICAL);
+-IssmDouble fy(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord, int FSANALYTICAL);
+-IssmDouble fz(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord, int FSANALYTICAL);
++IssmDouble fx(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord, int testid);
++IssmDouble fy(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord, int testid);
++IssmDouble fz(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord, int testid);
+ IssmDouble fx1(IssmDouble x_coord, IssmDouble y_coord);
+ IssmDouble fy1(IssmDouble x_coord, IssmDouble y_coord);
+ IssmDouble fx2(IssmDouble x_coord, IssmDouble y_coord);
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp	(revision 17303)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp	(revision 17304)
+@@ -15,10 +15,10 @@
+ #include "./fsanalyticals.h"
+ #include "../shared.h"
+ 
+-IssmDouble fx(IssmDouble x,IssmDouble y,IssmDouble z,int FSANALYTICAL){ /*{{{*/ 
++IssmDouble fx(IssmDouble x,IssmDouble y,IssmDouble z,int testid){ /*{{{*/ 
+ 	IssmDouble fx;
+ 
+-	switch(FSANALYTICAL){
++	switch(testid){
+ 		case 1:
+ 			return fx=fx1(x,y);
+ 		case 2: 
+@@ -32,14 +32,14 @@
+ 		case 6: 
+ 			return fx=fx6(x,y,z);
+ 		default:
+-			_error_("FS analytical solution"<<FSANALYTICAL<<" not implemented yet");
++			_error_("FS analytical solution"<<testid<<" not implemented yet");
+ 	}
+ }
+ /*}}}*/
+-IssmDouble fy(IssmDouble x,IssmDouble y,IssmDouble z,int FSANALYTICAL){ /*{{{*/ 
++IssmDouble fy(IssmDouble x,IssmDouble y,IssmDouble z,int testid){ /*{{{*/ 
+ 	IssmDouble fy;
+ 
+-	switch(FSANALYTICAL){
++	switch(testid){
+ 		case 1:
+ 			return fy=fy1(x,y);
+ 		case 2: 
+@@ -53,14 +53,14 @@
+ 		case 6: 
+ 			return fy=fy6(x,y,z);
+ 		default:
+-			_error_("FS analytical solution"<<FSANALYTICAL<<" not implemented yet");
++			_error_("FS analytical solution"<<testid<<" not implemented yet");
+ 	}
+ }
+ /*}}}*/
+-IssmDouble fz(IssmDouble x,IssmDouble y,IssmDouble z,int FSANALYTICAL){ /*{{{*/ 
++IssmDouble fz(IssmDouble x,IssmDouble y,IssmDouble z,int testid){ /*{{{*/ 
+ 	IssmDouble fz;
+ 
+-	switch(FSANALYTICAL){
++	switch(testid){
+ 		case 1: case 2:
+ 			return fz=0.;
+ 		case 3: 
+@@ -72,7 +72,7 @@
+ 		case 6: 
+ 			return fz=fz6(x,y,z);
+ 		default:
+-			_error_("FS analytical solution"<<FSANALYTICAL<<" not implemented yet");
++			_error_("FS analytical solution"<<testid<<" not implemented yet");
+ 	}
+ }
+ /*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17304-17305.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17304-17305.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17304-17305.diff	(revision 17802)
@@ -0,0 +1,287 @@
+Index: ../trunk-jpl/m4/issm_options.m4
+===================================================================
+--- ../trunk-jpl/m4/issm_options.m4	(revision 17304)
++++ ../trunk-jpl/m4/issm_options.m4	(revision 17305)
+@@ -1976,7 +1976,21 @@
+ 	AM_CONDITIONAL([EXTRAPOLATION], [test x$HAVE_EXTRAPOLATION = xyes])
+ 	AC_MSG_RESULT($HAVE_EXTRAPOLATION)
+ 	dnl }}}
++	dnl with-LsfReinitialization{{{
++	AC_ARG_WITH([LsfReinitialization],
++		AS_HELP_STRING([--with-LsfReinitialization = YES], [compile with LsfReinitialization capabilities (default is yes)]),
++		[LSFREINITIALIZATION=$withval],[LSFREINITIALIZATION=yes]) 
++	AC_MSG_CHECKING(for LsfReinitialization capability compilation)
+ 
++	HAVE_LSFREINITIALIZATION=no
++	if test "x$LSFREINITIALIZATION" = "xyes"; then
++		HAVE_LSFREINITIALIZATION=yes
++		AC_DEFINE([_HAVE_LSFREINITIALIZATION_],[1],[with LsfReinitialization capability])
++	fi
++	AM_CONDITIONAL([LSFREINITIALIZATION], [test x$HAVE_LSFREINITIALIZATION = xyes])
++	AC_MSG_RESULT($HAVE_LSFREINITIALIZATION)
++	dnl }}}
++
+ 	dnl Platform specifics
+ 	dnl with-ios{{{
+ 	AC_ARG_WITH([ios],
+Index: ../trunk-jpl/src/c/analyses/EnumToAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnumToAnalysis.cpp	(revision 17304)
++++ ../trunk-jpl/src/c/analyses/EnumToAnalysis.cpp	(revision 17305)
+@@ -97,6 +97,9 @@
+ 		#ifdef _HAVE_EXTRAPOLATION_
+ 		case ExtrapolationAnalysisEnum : return new ExtrapolationAnalysis();
+ 		#endif
++		#ifdef _HAVE_LSFREINITIALIZATION_
++		case LsfReinitializationAnalysisEnum : return new LsfReinitializationAnalysis();
++		#endif
+ 		default : _error_("enum provided not supported ("<<EnumToStringx(analysis_enum)<<")");
+ 	}
+ }
+Index: ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp	(revision 0)
++++ ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp	(revision 17305)
+@@ -0,0 +1,52 @@
++#include "./LsfReinitializationAnalysis.h"
++#include "../toolkits/toolkits.h"
++#include "../classes/classes.h"
++#include "../shared/shared.h"
++#include "../modules/modules.h"
++
++/*Model processing*/
++int  LsfReinitializationAnalysis::DofsPerNode(int** doflist,int meshtype,int approximation){
++	_error_("not implemented yet");
++}
++void LsfReinitializationAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){
++	_error_("not implemented yet");
++}
++void LsfReinitializationAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){
++	_error_("not implemented yet");
++}
++void LsfReinitializationAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){
++	_error_("not implemented yet");
++}
++void LsfReinitializationAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){
++	_error_("not implemented yet");
++}
++void LsfReinitializationAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){
++	_error_("not implemented yet");
++}
++
++/*Finite element Analysis*/
++void           LsfReinitializationAnalysis::Core(FemModel* femmodel){
++	_error_("not implemented yet");
++}
++ElementVector* LsfReinitializationAnalysis::CreateDVector(Element* element){
++	_error_("not implemented yet");
++}
++ElementMatrix* LsfReinitializationAnalysis::CreateJacobianMatrix(Element* element){
++	_error_("not implemented yet");
++}
++ElementMatrix* LsfReinitializationAnalysis::CreateKMatrix(Element* element){
++	_error_("not implemented yet");
++}
++ElementVector* LsfReinitializationAnalysis::CreatePVector(Element* element){
++	_error_("not implemented yet");
++}
++void LsfReinitializationAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){
++	_error_("not implemented yet");
++}
++void LsfReinitializationAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){
++	_error_("not implemented yet");
++}
++void LsfReinitializationAnalysis::UpdateConstraints(FemModel* femmodel){
++	_error_("not implemented yet");
++}
++
+Index: ../trunk-jpl/src/c/analyses/analyses.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/analyses.h	(revision 17304)
++++ ../trunk-jpl/src/c/analyses/analyses.h	(revision 17305)
+@@ -24,6 +24,7 @@
+ #include "./HydrologyDCInefficientAnalysis.h"
+ #include "./HydrologyShreveAnalysis.h"
+ #include "./LevelsetAnalysis.h"
++#include "./LsfReinitializationAnalysis.h"
+ #include "./MasstransportAnalysis.h"
+ #include "./MeltingAnalysis.h"
+ #include "./MeshdeformationAnalysis.h"
+Index: ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.h	(revision 0)
++++ ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.h	(revision 17305)
+@@ -0,0 +1,32 @@
++/*! \file LsfReinitializationAnalysis.h 
++ *  \brief: header file for generic external result object
++ */
++
++#ifndef _LsfReinitializationAnalysis_
++#define _LsfReinitializationAnalysis_
++
++/*Headers*/
++#include "./Analysis.h"
++
++class LsfReinitializationAnalysis: public Analysis{
++	
++public:
++	/*Model processing*/
++	int  DofsPerNode(int** doflist,int meshtype,int approximation);
++	void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
++	void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
++	void CreateNodes(Nodes* nodes,IoModel* iomodel);
++	void CreateConstraints(Constraints* constraints,IoModel* iomodel);
++	void CreateLoads(Loads* loads, IoModel* iomodel);
++
++	/*Finite element Analysis*/
++	void           Core(FemModel* femmodel);
++	ElementVector* CreateDVector(Element* element);
++	ElementMatrix* CreateJacobianMatrix(Element* element);
++	ElementMatrix* CreateKMatrix(Element* element);
++	ElementVector* CreatePVector(Element* element);
++	void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++	void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++	void UpdateConstraints(FemModel* femmodel);
++};
++#endif
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17304)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17305)
+@@ -353,6 +353,7 @@
+ 	MeshdeformationAnalysisEnum,
+ 	LevelsetAnalysisEnum,
+ 	ExtrapolationAnalysisEnum,
++	LsfReinitializationAnalysisEnum,
+ 	/*}}}*/
+ 	/*Approximations {{{*/
+ 	ApproximationEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17304)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17305)
+@@ -354,6 +354,7 @@
+ 		case MeshdeformationAnalysisEnum : return "MeshdeformationAnalysis";
+ 		case LevelsetAnalysisEnum : return "LevelsetAnalysis";
+ 		case ExtrapolationAnalysisEnum : return "ExtrapolationAnalysis";
++		case LsfReinitializationAnalysisEnum : return "LsfReinitializationAnalysis";
+ 		case ApproximationEnum : return "Approximation";
+ 		case NoneApproximationEnum : return "NoneApproximation";
+ 		case SIAApproximationEnum : return "SIAApproximation";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17304)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17305)
+@@ -360,6 +360,7 @@
+ 	      else if (strcmp(name,"MeshdeformationAnalysis")==0) return MeshdeformationAnalysisEnum;
+ 	      else if (strcmp(name,"LevelsetAnalysis")==0) return LevelsetAnalysisEnum;
+ 	      else if (strcmp(name,"ExtrapolationAnalysis")==0) return ExtrapolationAnalysisEnum;
++	      else if (strcmp(name,"LsfReinitializationAnalysis")==0) return LsfReinitializationAnalysisEnum;
+ 	      else if (strcmp(name,"Approximation")==0) return ApproximationEnum;
+ 	      else if (strcmp(name,"NoneApproximation")==0) return NoneApproximationEnum;
+ 	      else if (strcmp(name,"SIAApproximation")==0) return SIAApproximationEnum;
+@@ -381,11 +382,11 @@
+ 	      else if (strcmp(name,"Vertices")==0) return VerticesEnum;
+ 	      else if (strcmp(name,"Results")==0) return ResultsEnum;
+ 	      else if (strcmp(name,"GenericParam")==0) return GenericParamEnum;
+-	      else if (strcmp(name,"AdolcParam")==0) return AdolcParamEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"BoolInput")==0) return BoolInputEnum;
++	      if (strcmp(name,"AdolcParam")==0) return AdolcParamEnum;
++	      else if (strcmp(name,"BoolInput")==0) return BoolInputEnum;
+ 	      else if (strcmp(name,"BoolParam")==0) return BoolParamEnum;
+ 	      else if (strcmp(name,"Contour")==0) return ContourEnum;
+ 	      else if (strcmp(name,"ControlInput")==0) return ControlInputEnum;
+@@ -504,11 +505,11 @@
+ 	      else if (strcmp(name,"VyMesh")==0) return VyMeshEnum;
+ 	      else if (strcmp(name,"VzMesh")==0) return VzMeshEnum;
+ 	      else if (strcmp(name,"Enthalpy")==0) return EnthalpyEnum;
+-	      else if (strcmp(name,"EnthalpyPicard")==0) return EnthalpyPicardEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"ThicknessAbsGradient")==0) return ThicknessAbsGradientEnum;
++	      if (strcmp(name,"EnthalpyPicard")==0) return EnthalpyPicardEnum;
++	      else if (strcmp(name,"ThicknessAbsGradient")==0) return ThicknessAbsGradientEnum;
+ 	      else if (strcmp(name,"ThicknessAlongGradient")==0) return ThicknessAlongGradientEnum;
+ 	      else if (strcmp(name,"ThicknessAcrossGradient")==0) return ThicknessAcrossGradientEnum;
+ 	      else if (strcmp(name,"IntMatParam")==0) return IntMatParamEnum;
+@@ -627,11 +628,11 @@
+ 	      else if (strcmp(name,"Separate")==0) return SeparateEnum;
+ 	      else if (strcmp(name,"Sset")==0) return SsetEnum;
+ 	      else if (strcmp(name,"Verbose")==0) return VerboseEnum;
+-	      else if (strcmp(name,"TriangleInterp")==0) return TriangleInterpEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"BilinearInterp")==0) return BilinearInterpEnum;
++	      if (strcmp(name,"TriangleInterp")==0) return TriangleInterpEnum;
++	      else if (strcmp(name,"BilinearInterp")==0) return BilinearInterpEnum;
+ 	      else if (strcmp(name,"NearestInterp")==0) return NearestInterpEnum;
+ 	      else if (strcmp(name,"XY")==0) return XYEnum;
+ 	      else if (strcmp(name,"XYZ")==0) return XYZEnum;
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17304)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17305)
+@@ -582,6 +582,9 @@
+ if EXTRAPOLATION
+ issm_sources += ./analyses/ExtrapolationAnalysis.cpp
+ endif
++if LSFREINITIALIZATION
++issm_sources += ./analyses/LsfReinitializationAnalysis.cpp
++endif
+ #}}}
+ #Gia sources  {{{
+ if GIA
+Index: ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp	(revision 17304)
++++ ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp	(revision 17305)
+@@ -115,7 +115,7 @@
+ 			break;
+ 
+ 		case TransientSolutionEnum:
+-			numanalyses=14;
++			numanalyses=15;
+ 			analyses=xNew<int>(numanalyses);
+ 			analyses[ 0]=StressbalanceAnalysisEnum;
+ 			analyses[ 1]=StressbalanceVerticalAnalysisEnum;
+@@ -131,6 +131,7 @@
+ 			analyses[11]=ExtrudeFromTopAnalysisEnum;
+ 			analyses[12]=LevelsetAnalysisEnum;
+ 			analyses[13]=ExtrapolationAnalysisEnum;
++			analyses[14]=LsfReinitializationAnalysisEnum;
+ 			break;
+ 
+ 		default:
+Index: ../trunk-jpl/src/m/enum/LsfReinitializationAnalysisEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/LsfReinitializationAnalysisEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/LsfReinitializationAnalysisEnum.m	(revision 17305)
+@@ -0,0 +1,11 @@
++function macro=LsfReinitializationAnalysisEnum()
++%LSFREINITIALIZATIONANALYSISENUM - Enum of LsfReinitializationAnalysis
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=LsfReinitializationAnalysisEnum()
++
++macro=StringToEnum('LsfReinitializationAnalysis');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17304)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17305)
+@@ -346,6 +346,7 @@
+ def MeshdeformationAnalysisEnum(): return StringToEnum("MeshdeformationAnalysis")[0]
+ def LevelsetAnalysisEnum(): return StringToEnum("LevelsetAnalysis")[0]
+ def ExtrapolationAnalysisEnum(): return StringToEnum("ExtrapolationAnalysis")[0]
++def LsfReinitializationAnalysisEnum(): return StringToEnum("LsfReinitializationAnalysis")[0]
+ def ApproximationEnum(): return StringToEnum("Approximation")[0]
+ def NoneApproximationEnum(): return StringToEnum("NoneApproximation")[0]
+ def SIAApproximationEnum(): return StringToEnum("SIAApproximation")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17305-17306.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17305-17306.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17305-17306.diff	(revision 17802)
@@ -0,0 +1,68 @@
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h	(revision 17305)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h	(revision 17306)
+@@ -26,5 +26,7 @@
+ IssmDouble fx6(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+ IssmDouble fy6(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+ IssmDouble fz6(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
++IssmDouble fx7(IssmDouble x_coord, IssmDouble y_coord);
++IssmDouble fy7(IssmDouble x_coord, IssmDouble y_coord);
+ 
+ #endif //ifndef _SHARED_ANALYTICALS_H_
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp	(revision 17305)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp	(revision 17306)
+@@ -31,6 +31,10 @@
+ 			return fx=fx5(x,y,z);
+ 		case 6: 
+ 			return fx=fx6(x,y,z);
++		case 7: 
++			return fx=fx7(x,y);
++		case 8: 
++			return fx=1.0;
+ 		default:
+ 			_error_("FS analytical solution"<<testid<<" not implemented yet");
+ 	}
+@@ -52,6 +56,10 @@
+ 			return fy=fy5(x,y,z);
+ 		case 6: 
+ 			return fy=fy6(x,y,z);
++		case 7: 
++			return fy=fy7(x,y);
++		case 8: 
++			return fy=1.0;
+ 		default:
+ 			_error_("FS analytical solution"<<testid<<" not implemented yet");
+ 	}
+@@ -61,7 +69,7 @@
+ 	IssmDouble fz;
+ 
+ 	switch(testid){
+-		case 1: case 2:
++		case 1: case 2: case 7: case 8:
+ 			return fz=0.;
+ 		case 3: 
+ 			return fz=fz3(x,y,z);
+@@ -227,3 +235,20 @@
+ 	return functionz;
+ }
+ /*}}}*/
++IssmDouble fx7(IssmDouble x,IssmDouble y){/*{{{*/
++	IssmDouble functionx;
++	IssmDouble z=y;
++
++	functionx =  4*pow(x, 2)*z*pow(x - 1, 2) + 4*pow(x, 2)*z*(z - 1)*(2*z - 1) + 4*pow(x, 2)*pow(x - 1, 2)*(z - 1) + 2*pow(x, 2)*pow(x - 1, 2)*(2*z - 1) + 16*x*z*(x - 1)*(z - 1)*(2*z - 1) - 4*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) + 6*pow(z, 2)*(6*pow(x, 2) - 6*x + 1) + 4*z*pow(x - 1, 2)*(z - 1)*(2*z - 1) - 2*z*(6*pow(x, 2) - 6*x + 1) + 1;
++	return functionx;
++}
++/*}}}*/
++IssmDouble fy7(IssmDouble x,IssmDouble y){   /*{{{*/
++	IssmDouble functiony;
++	IssmDouble z=y;
++
++	functiony = -8*pow(x, 3) + 4*pow(x, 2)*z*(x - 1)*(z - 1) + 2*pow(x, 2)*z*(x - 1)*(2*z - 1) + 2*pow(x, 2)*(x - 1)*(z - 1)*(2*z - 1) + 12*pow(x, 2) + 4*x*z*pow(x - 1, 2)*(z - 1) + 2*x*z*pow(x - 1, 2)*(2*z - 1) + 2*x*pow(x - 1, 2)*(z - 1)*(2*z - 1) - 4*x - 6*pow(z, 4)*(2*x - 1) + 12*pow(z, 3)*(2*x - 1) - 6*pow(z, 2)*(2*x - 1) - 24*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + 24*z*(2*pow(x, 3) - 3*pow(x, 2) + x);
++
++	return functiony;
++}
++/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17306-17307.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17306-17307.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17306-17307.diff	(revision 17802)
@@ -0,0 +1,211 @@
+Index: ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp	(revision 17306)
++++ ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp	(revision 17307)
+@@ -5,48 +5,157 @@
+ #include "../modules/modules.h"
+ 
+ /*Model processing*/
+-int  LsfReinitializationAnalysis::DofsPerNode(int** doflist,int meshtype,int approximation){
+-	_error_("not implemented yet");
+-}
+-void LsfReinitializationAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){
+-	_error_("not implemented yet");
+-}
+-void LsfReinitializationAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){
+-	_error_("not implemented yet");
+-}
+-void LsfReinitializationAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){
+-	_error_("not implemented yet");
+-}
+-void LsfReinitializationAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){
+-	_error_("not implemented yet");
+-}
+-void LsfReinitializationAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){
+-	_error_("not implemented yet");
+-}
++int  LsfReinitializationAnalysis::DofsPerNode(int** doflist,int meshtype,int approximation){/*{{{*/
++	return 1;
++}/*}}}*/
++void LsfReinitializationAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
++	/* Do nothing for now */
++}/*}}}*/
++void LsfReinitializationAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
++	/* Do nothing for now */
++}/*}}}*/
++void LsfReinitializationAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
++	/* Do nothing for now */
++}/*}}}*/
++void LsfReinitializationAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
++	/* Do nothing for now */
++}/*}}}*/
++void LsfReinitializationAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
++	/* Do nothing for now */
++}/*}}}*/
+ 
+ /*Finite element Analysis*/
+-void           LsfReinitializationAnalysis::Core(FemModel* femmodel){
++void           LsfReinitializationAnalysis::Core(FemModel* femmodel){/*{{{*/
+ 	_error_("not implemented yet");
+-}
+-ElementVector* LsfReinitializationAnalysis::CreateDVector(Element* element){
++}/*}}}*/
++ElementVector* LsfReinitializationAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	_error_("not implemented yet");
+-}
+-ElementMatrix* LsfReinitializationAnalysis::CreateJacobianMatrix(Element* element){
++}/*}}}*/
++ElementMatrix* LsfReinitializationAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ 	_error_("not implemented yet");
+-}
+-ElementMatrix* LsfReinitializationAnalysis::CreateKMatrix(Element* element){
++}/*}}}*/
++ElementMatrix* LsfReinitializationAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 	_error_("not implemented yet");
+-}
+-ElementVector* LsfReinitializationAnalysis::CreatePVector(Element* element){
++}/*}}}*/
++ElementVector* LsfReinitializationAnalysis::CreatePVector(Element* element){/*{{{*/
+ 	_error_("not implemented yet");
+-}
+-void LsfReinitializationAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){
++}/*}}}*/
++void LsfReinitializationAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	_error_("not implemented yet");
+-}
+-void LsfReinitializationAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){
++}/*}}}*/
++void LsfReinitializationAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 	_error_("not implemented yet");
+-}
+-void LsfReinitializationAnalysis::UpdateConstraints(FemModel* femmodel){
++}/*}}}*/
++void LsfReinitializationAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+ 	_error_("not implemented yet");
+-}
++}/*}}}*/
+ 
++/* Other */
++void LsfReinitializationAnalysis::SetDistanceOnIntersectedElements(FemModel* femmodel){/*{{{*/
++
++	/* Intermediaries */
++	int i;
++
++	/*Initialize vector with number of vertices*/
++	int numvertices=femmodel->vertices->NumberOfVertices();
++	Vector<IssmDouble>* vec_dist_zerolevelset=new Vector<IssmDouble>(numvertices); //vertices that have ice at next time step
++
++	/*TODO: Fill vector with values of old level set function: */
++	for(i=0;i<numvertices;i++){
++		vec_dist_zerolevelset->SetValue(i,0.,INS_VAL);
++	}
++	for(i=0;i<femmodel->elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++		if(element->IsZeroLevelset(MaskIceLevelsetEnum))
++			SetDistanceToZeroLevelsetElement(vec_dist_zerolevelset, element);
++	}
++
++	/*Assemble vector and serialize */
++	vec_dist_zerolevelset->Assemble();
++	IssmDouble* dist_zerolevelset=vec_dist_zerolevelset->ToMPISerial();
++	InputUpdateFromVectorx(femmodel,dist_zerolevelset,MaskIceLevelsetEnum,VertexSIdEnum);
++
++	/*Clean up and return*/
++	delete vec_dist_zerolevelset;
++	delete dist_zerolevelset;
++}/*}}}*/
++void LsfReinitializationAnalysis::SetDistanceToZeroLevelsetElement(Vector<IssmDouble>* vec_signed_dist, Element* element){/*{{{*/
++
++	if(!element->IsZeroLevelset(MaskIceLevelsetEnum))
++		return;
++
++	/* Intermediaries */
++	const int dim=3;
++	int i,d;
++	int numvertices=element->GetNumberOfVertices();
++	IssmDouble s0[dim], s1[dim], v[dim];
++	IssmDouble dist,lsf_old;
++
++	IssmDouble* lsf = xNew<IssmDouble>(numvertices);
++	IssmDouble* sign_lsf = xNew<IssmDouble>(numvertices);
++	IssmDouble* signed_dist = xNew<IssmDouble>(numvertices);
++	IssmDouble* xyz_list = NULL;
++	IssmDouble* xyz_list_zero = NULL;
++
++	/* retrieve inputs and parameters */
++	element->GetVerticesCoordinates(&xyz_list);
++	element->GetInputListOnVertices(lsf,MaskIceLevelsetEnum);
++
++	/* get sign of levelset function */
++	for(i=0;i<numvertices;i++){
++		if(lsf[i]==0.)
++			sign_lsf[i]=1.;
++		else
++			sign_lsf[i]=lsf[i]/fabs(lsf[i]);
++	}
++
++	element->ZeroLevelsetCoordinates(&xyz_list_zero, xyz_list, MaskIceLevelsetEnum);
++	for(d=0;d<dim;d++){
++		s0[d]=xyz_list_zero[0+d];
++		s1[d]=xyz_list_zero[3+d];
++	}
++
++	/* get signed_distance of vertices to zero levelset straight */
++	for(i=0;i<numvertices;i++){
++		for(d=0;d<dim;d++)
++			v[d]=xyz_list[3*i+d];
++		dist=GetDistanceToStraight(&v[0],&s0[0],&s1[0]);
++		signed_dist[i]=sign_lsf[i]*dist;
++	}
++	
++	/* insert signed_distance into vec_signed_dist, if computed distance is smaller */
++	for(i=0;i<numvertices;i++){
++		vec_signed_dist->GetValue(&lsf_old, element->vertices[i]->Sid());
++		if(fabs(signed_dist[i])<fabs(lsf_old))
++			vec_signed_dist->SetValue(element->vertices[i]->Sid(),signed_dist[i],INS_VAL);
++	}
++
++	xDelete<IssmDouble>(lsf);
++	xDelete<IssmDouble>(sign_lsf);
++	xDelete<IssmDouble>(signed_dist);
++}/*}}}*/
++IssmDouble LsfReinitializationAnalysis::GetDistanceToStraight(IssmDouble* q, IssmDouble* s0, IssmDouble* s1){/*{{{*/
++	// returns distance d of point q to straight going through points s0, s1
++	// d=|a x b|/|b|
++	// with a=q-s0, b=s1-s0
++	
++	/* Intermediaries */
++	const int dim=2;
++	int i;
++	IssmDouble a[dim], b[dim];
++	IssmDouble norm_b;
++
++	for(i=0;i<dim;i++){
++		a[i]=q[i]-s0[i];
++		b[i]=s1[i]-s0[i];
++	}
++	
++	norm_b=0.;
++	for(i=0;i<dim;i++)
++		norm_b+=b[i]*b[i];
++	norm_b=sqrt(norm_b);
++	_assert_(norm_b>0.);
++
++	return fabs(a[0]*b[1]-a[1]*b[0])/norm_b;
++}/*}}}*/
++
+Index: ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.h	(revision 17306)
++++ ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.h	(revision 17307)
+@@ -28,5 +28,10 @@
+ 	void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 	void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ 	void UpdateConstraints(FemModel* femmodel);
++	
++	/* Other */
++	void SetDistanceOnIntersectedElements(FemModel* femmodel);
++	void SetDistanceToZeroLevelsetElement(Vector<IssmDouble>* vec_dist, Element* element);
++	IssmDouble GetDistanceToStraight(IssmDouble* q, IssmDouble* s0, IssmDouble* s1);
+ };
+ #endif
Index: issm/oecreview/Archive/16554-17801/ISSM-17307-17308.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17307-17308.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17307-17308.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.m
+===================================================================
+--- ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.m	(revision 17307)
++++ ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.m	(revision 17308)
+@@ -62,7 +62,7 @@
+ pos=md.mesh.segments(segments,1:numbernodesfront);
+ md.stressbalance.spcvx(pos(:))=0;
+ md.stressbalance.spcvy(pos(:))=0;
+-md.stressbalance.spcvz(pos(:))=0;
++md.stressbalance.spcvz(pos(:))=0; % FIXME probably shouldn't spc vertical velocity here
+ 
+ %Dirichlet Values
+ if (length(md.inversion.vx_obs)==md.mesh.numberofvertices & length(md.inversion.vy_obs)==md.mesh.numberofvertices)
Index: issm/oecreview/Archive/16554-17801/ISSM-17308-17309.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17308-17309.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17308-17309.diff	(revision 17802)
@@ -0,0 +1,673 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17308)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17309)
+@@ -1151,7 +1151,7 @@
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+-		case Mesh3DEnum:
++		case Mesh3DEnum: case Mesh2DverticalEnum:
+ 			if(!element->IsOnBed()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+@@ -1352,7 +1352,7 @@
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+-		case Mesh3DEnum:
++		case Mesh3DEnum: case Mesh2DverticalEnum:
+ 			if(!element->IsOnBed()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp	(revision 17308)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp	(revision 17309)
+@@ -54,12 +54,12 @@
+ 			iomodel->FetchDataToInput(elements,DamageDEnum);
+ 			for (i=0;i<iomodel->numberofelements;i++) if(iomodel->my_elements[i]) materials->AddObject(new Matice(i+1,i,iomodel));
+ 			switch(iomodel->meshtype){
+-				case Mesh2DhorizontalEnum:
++				case Mesh2DhorizontalEnum: case Mesh2DverticalEnum:
+ 					elements->InputDuplicate(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum);
+ 					elements->InputDuplicate(DamageDEnum,DamageDbarEnum);
+ 					if(dakota_analysis) elements->InputDuplicate(MaterialsRheologyBbarEnum,QmuMaterialsRheologyBEnum);
+ 					break;
+-				case Mesh3DEnum: case Mesh2DverticalEnum:
++				case Mesh3DEnum:
+ 					if(dakota_analysis) elements->InputDuplicate(MaterialsRheologyBEnum,QmuMaterialsRheologyBEnum); 
+ 					break;
+ 				default:
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17308)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17309)
+@@ -63,6 +63,10 @@
+ 		void	     GetDofListVelocity(int** pdoflist,int setenum);
+ 		void	     GetDofListPressure(int** pdoflist,int setenum);
+ 		Input*     GetInput(int inputenum);
++		void       GetInputListOnNodes(IssmDouble* pvalue,int enumtype);
++		void       GetInputListOnNodes(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue);
++		void       GetInputListOnVertices(IssmDouble* pvalue,int enumtype);
++		void       GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue);
+ 		IssmDouble GetMaterialParameter(int enum_in);
+ 		void       GetPhi(IssmDouble* phi, IssmDouble*  epsilon, IssmDouble viscosity);
+ 		void       GetVerticesSidList(int* sidlist);
+@@ -161,10 +165,6 @@
+ 		virtual bool   IsIceInElement()=0;
+ 		virtual void   GetGroundedPart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* mainlyfloating)=0;
+ 		virtual IssmDouble GetGroundedPortion(IssmDouble* xyz_list)=0;
+-		virtual void   GetInputListOnNodes(IssmDouble* pvalue,int enumtype)=0;
+-		virtual void   GetInputListOnNodes(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue)=0;
+-		virtual void   GetInputListOnVertices(IssmDouble* pvalue,int enumtype)=0;
+-		virtual void   GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue)=0;
+ 		virtual void   GetInputValue(IssmDouble* pvalue,Node* node,int enumtype)=0;
+ 		virtual void   GetInputValue(bool* pvalue,int enum_type)=0;
+ 		virtual void   GetInputValue(int* pvalue,int enum_type)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17308)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17309)
+@@ -164,6 +164,22 @@
+ 		case Mesh2DhorizontalEnum:
+ 			this->inputs->AddInput(new TriaInput(input_enum,values,interpolation_enum));
+ 			break;
++		case Mesh2DverticalEnum:{
++			if(interpolation_enum==P1Enum){
++				IssmDouble values2[NUMVERTICES]={0.};
++				int        numindices;
++				int       *indices = NULL;
++				int        index = this->EdgeOnBedIndex();
++				NodeOnEdgeIndices(&numindices,&indices,index,this->FiniteElement());
++				for(int i=0;i<numindices;i++){
++					values2[indices[i]] = values[i];
++				}
++				this->inputs->AddInput(new TriaInput(input_enum,values2,interpolation_enum));
++				xDelete<int>(indices);
++			}
++			else _error_("not implemented yet");
++			}
++			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+@@ -937,111 +953,6 @@
+ 	return NUMVERTICES;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetInputListOnVertices(IssmDouble* pvalue,int enumtype) {{{*/
+-void Tria::GetInputListOnVertices(IssmDouble* pvalue,int enumtype){
+-
+-	/*Recover input*/
+-	Input* input=inputs->GetInput(enumtype);
+-	if (!input) _error_("Input " << EnumToStringx(enumtype) << " not found in element");
+-
+-	/*Checks in debugging mode*/
+-	_assert_(pvalue);
+-
+-	/* Start looping on the number of vertices: */
+-	GaussTria* gauss=new GaussTria();
+-	for (int iv=0;iv<NUMVERTICES;iv++){
+-		gauss->GaussVertex(iv);
+-		input->GetInputValue(&pvalue[iv],gauss);
+-	}
+-
+-	/*clean-up*/
+-	delete gauss;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue) {{{*/
+-void Tria::GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){
+-
+-	Input     *input = inputs->GetInput(enumtype);
+-
+-	/*Checks in debugging mode*/
+-	_assert_(pvalue);
+-
+-	/* Start looping on the number of vertices: */
+-	if (input){
+-		GaussTria* gauss=new GaussTria();
+-		for (int iv=0;iv<NUMVERTICES;iv++){
+-			gauss->GaussVertex(iv);
+-			input->GetInputValue(&pvalue[iv],gauss);
+-		}
+-		delete gauss;
+-	}
+-	else{
+-		for (int iv=0;iv<NUMVERTICES;iv++) pvalue[iv]=defaultvalue;
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION Tria::GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue,int index) TO BE REMOVED{{{*/
+-void Tria::GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue,int index){
+-
+-	Input     *input = inputs->GetInput(enumtype);
+-
+-	/*Checks in debugging mode*/
+-	_assert_(pvalue);
+-
+-	/* Start looping on the number of vertices: */
+-	if (input){
+-		GaussTria* gauss=new GaussTria();
+-		for (int iv=0;iv<NUMVERTICES;iv++){
+-			gauss->GaussVertex(iv);
+-			input->GetInputValue(&pvalue[iv],gauss,index);
+-		}
+-		delete gauss;
+-	}
+-	else{
+-		for (int iv=0;iv<NUMVERTICES;iv++) pvalue[iv]=defaultvalue;
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION Tria::GetInputListOnNodes(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue) {{{*/
+-void Tria::GetInputListOnNodes(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){
+-
+-	_assert_(pvalue);
+-
+-	Input *input    = inputs->GetInput(enumtype);
+-	int    numnodes = this->NumberofNodes();
+-
+-	/* Start looping on the number of vertices: */
+-	if(input){
+-		GaussTria* gauss=new GaussTria();
+-		for(int iv=0;iv<this->NumberofNodes();iv++){
+-			gauss->GaussNode(this->element_type,iv);
+-			input->GetInputValue(&pvalue[iv],gauss);
+-		}
+-		delete gauss;
+-	}
+-	else{
+-		for(int iv=0;iv<numnodes;iv++) pvalue[iv]=defaultvalue;
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION Tria::GetInputListOnNodes(IssmDouble* pvalue,int enumtype) {{{*/
+-void Tria::GetInputListOnNodes(IssmDouble* pvalue,int enumtype){
+-
+-	_assert_(pvalue);
+-
+-	/*Recover input*/
+-	Input* input=inputs->GetInput(enumtype);
+-	if(!input) _error_("Input " << EnumToStringx(enumtype) << " not found in element");
+-
+-	/* Start looping on the number of vertices: */
+-	GaussTria* gauss=new GaussTria();
+-	for (int iv=0;iv<this->NumberofNodes();iv++){
+-		gauss->GaussNode(this->element_type,iv);
+-		input->GetInputValue(&pvalue[iv],gauss);
+-	}
+-	delete gauss;
+-}
+-/*}}}*/
+ /*FUNCTION Tria::GetInputValue(IssmDouble* pvalue,Node* node,int enumtype) {{{*/
+ void Tria::GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){
+ 
+@@ -2468,7 +2379,6 @@
+ 	}
+ 	return isicefront;
+ }/*}}}*/
+-
+ /*FUNCTION Tria::AverageOntoPartition {{{*/
+ void  Tria::AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part){
+ 
+@@ -4428,7 +4338,6 @@
+ 	((ControlInput*)input)->SetInput(new_input);
+ }
+ /*}}}*/
+-
+ /*FUNCTION Tria::CreateHydrologyWaterVelocityInput {{{*/
+ void Tria::CreateHydrologyWaterVelocityInput(void){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17308)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17309)
+@@ -211,11 +211,6 @@
+ 		void           NormalSection(IssmDouble* normal,IssmDouble* xyz_list);
+ 		void           NormalTop(IssmDouble* normal,IssmDouble* xyz_list);
+ 		void           NormalBase(IssmDouble* normal,IssmDouble* xyz_list);
+-		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype);
+-		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue);
+-		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue,int index); //TO BE REMOVED
+-		void           GetInputListOnNodes(IssmDouble* pvalue,int enumtype);
+-		void           GetInputListOnNodes(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue);
+ 		void           GetInputValue(IssmDouble* pvalue,Node* node,int enumtype);
+ 		void           GetInputValue(bool* pvalue,int enum_type);
+ 		void           GetInputValue(int* pvalue,int enum_type);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17308)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17309)
+@@ -893,90 +893,6 @@
+ 	return this->nodes[node_number];
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetInputListOnVertices(IssmDouble* pvalue,int enumtype) {{{*/
+-void Penta::GetInputListOnVertices(IssmDouble* pvalue,int enumtype){
+-
+-	/*Recover input*/
+-	Input* input=inputs->GetInput(enumtype);
+-	if (!input) _error_("Input " << EnumToStringx(enumtype) << " not found in element");
+-
+-	/*Checks in debugging mode*/
+-	_assert_(pvalue);
+-
+-	/* Start looping on the number of vertices: */
+-	GaussPenta *gauss=new GaussPenta();
+-	for (int iv=0;iv<NUMVERTICES;iv++){
+-		gauss->GaussVertex(iv);
+-		input->GetInputValue(&pvalue[iv],gauss);
+-	}
+-
+-	/*clean-up*/
+-	delete gauss;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue) {{{*/
+-void Penta::GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){
+-
+-	/*Recover input*/
+-	Input* input=inputs->GetInput(enumtype);
+-
+-	/*Checks in debugging mode*/
+-	_assert_(pvalue);
+-
+-	/* Start looping on the number of vertices: */
+-	if (input){
+-		GaussPenta *gauss=new GaussPenta();
+-		for (int iv=0;iv<NUMVERTICES;iv++){
+-			gauss->GaussVertex(iv);
+-			input->GetInputValue(&pvalue[iv],gauss);
+-		}
+-		delete gauss;
+-	}
+-	else{
+-		for (int iv=0;iv<NUMVERTICES;iv++) pvalue[iv]=defaultvalue;
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION Penta::GetInputListOnNodes(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue) {{{*/
+-void Penta::GetInputListOnNodes(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){
+-
+-	_assert_(pvalue);
+-
+-	Input *input    = inputs->GetInput(enumtype);
+-	int    numnodes = this->NumberofNodes();
+-
+-	/* Start looping on the number of vertices: */
+-	if(input){
+-		GaussPenta* gauss=new GaussPenta();
+-		for(int iv=0;iv<this->NumberofNodes();iv++){
+-			gauss->GaussNode(this->element_type,iv);
+-			input->GetInputValue(&pvalue[iv],gauss);
+-		}
+-		delete gauss;
+-	}
+-	else{
+-		for(int iv=0;iv<numnodes;iv++) pvalue[iv]=defaultvalue;
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION Penta::GetInputListOnNodes(IssmDouble* pvalue,int enumtype) {{{*/
+-void Penta::GetInputListOnNodes(IssmDouble* pvalue,int enumtype){
+-
+-	_assert_(pvalue);
+-
+-	/*Recover input*/
+-	Input* input=inputs->GetInput(enumtype);
+-	if(!input) _error_("Input " << EnumToStringx(enumtype) << " not found in element");
+-
+-	/* Start looping on the number of vertices: */
+-	GaussPenta* gauss=new GaussPenta();
+-	for(int iv=0;iv<this->NumberofNodes();iv++){
+-		gauss->GaussNode(this->element_type,iv);
+-		input->GetInputValue(&pvalue[iv],gauss);
+-	}
+-	delete gauss;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::GetInputValue(IssmDouble* pvalue,Node* node,int enumtype) {{{*/
+ void Penta::GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/SegRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/SegRef.cpp	(revision 17308)
++++ ../trunk-jpl/src/c/classes/Elements/SegRef.cpp	(revision 17309)
+@@ -156,6 +156,10 @@
+ 	_assert_(dbasis && gauss);
+ 
+ 	switch(finiteelement){
++		case P0Enum:
++			/*Nodal function 1*/
++			dbasis[0] = 0.;
++			break;
+ 		case P1Enum: case P1DGEnum:
+ 			/*Nodal function 1*/
+ 			dbasis[0] = -0.5;
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17308)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17309)
+@@ -201,10 +201,6 @@
+ 
+ 		void	         GetVertexPidList(int* doflist);
+ 		int            GetElementType(void);
+-		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype);
+-		void           GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue);
+-		void           GetInputListOnNodes(IssmDouble* pvalue,int enumtype);
+-		void           GetInputListOnNodes(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue);
+ 		void           GetInputValue(IssmDouble* pvalue,Node* node,int enumtype);
+ 		void           GetInputValue(bool* pvalue,int enum_type);
+ 		void           GetInputValue(int* pvalue,int enum_type);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 17308)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 17309)
+@@ -142,6 +142,11 @@
+ 	return this->NumberofNodes();
+ }
+ /*}}}*/
++/*FUNCTION Seg::GetNumberOfVertices;{{{*/
++int Seg::GetNumberOfVertices(void){
++	return NUMVERTICES;
++}
++/*}}}*/
+ /*FUNCTION Seg::GetVerticesCoordinates(IssmDouble** pxyz_list){{{*/
+ void Seg::GetVerticesCoordinates(IssmDouble** pxyz_list){
+ 
+@@ -152,6 +157,39 @@
+ 	*pxyz_list = xyz_list;
+ 
+ }/*}}}*/
++/*FUNCTION Seg::IsIceInElement {{{*/
++bool   Seg::IsIceInElement(){
++
++	/*Get levelset*/
++	IssmDouble ls[NUMVERTICES];
++	GetInputListOnVertices(&ls[0],MaskIceLevelsetEnum);
++
++	/*If the level set on one of the nodes is <0, ice is present in this element*/
++	if(ls[0]<0. || ls[1]<0.) 
++	 return true;
++	else
++	 return false;
++}
++/*}}}*/
++bool Seg::IsIcefront(void){/*{{{*/
++
++	bool isicefront;
++	int i,nrice;
++	IssmDouble ls[NUMVERTICES];
++
++	/*Retrieve all inputs and parameters*/
++	GetInputListOnVertices(&ls[0],MaskIceLevelsetEnum);
++
++	/* If only one vertex has ice, there is an ice front here */
++	isicefront=false;
++	if(IsIceInElement()){
++		nrice=0;       
++		for(i=0;i<NUMVERTICES;i++)
++		 if(ls[i]<0.) nrice++;
++		if(nrice==1) isicefront= true;
++	}
++	return isicefront;
++}/*}}}*/
+ /*FUNCTION Seg::JacobianDeterminant{{{*/
+ void Seg::JacobianDeterminant(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){
+ 
+@@ -160,6 +198,11 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Seg::NewGauss(){{{*/
++Gauss* Seg::NewGauss(void){
++	return new GaussSeg();
++}
++/*}}}*/
+ /*FUNCTION Seg::NewGauss(int order){{{*/
+ Gauss* Seg::NewGauss(int order){
+ 	return new GaussSeg(order);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17308)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17309)
+@@ -78,15 +78,13 @@
+ 	  	Element*    GetLowerElement(void){_error_("not implemented yet");};
+ 	  	Element*    GetSurfaceElement(void){_error_("not implemented yet");};
+ 		Element*    GetBasalElement(void){_error_("not implemented yet");};
+-		void        GetInputListOnNodes(IssmDouble* pvalue,int enumtype){_error_("not implemented yet");};
+-		void        GetInputListOnNodes(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){_error_("not implemented yet");};
+ 		int         GetNodeIndex(Node* node){_error_("not implemented yet");};
+ 		void        GetNodesSidList(int* sidlist){_error_("not implemented yet");};
+ 		void        GetNodesLidList(int* lidlist){_error_("not implemented yet");};
+ 		int         GetNumberOfNodes(void);
+ 		int         GetNumberOfNodesVelocity(void){_error_("not implemented yet");};
+ 		int         GetNumberOfNodesPressure(void){_error_("not implemented yet");};
+-		int         GetNumberOfVertices(void){_error_("not implemented yet");};
++		int         GetNumberOfVertices(void);
+ 		void        GetVerticesCoordinates(IssmDouble** pxyz_list);
+ 		void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list){_error_("not implemented yet");};
+ 		void        GetVerticesCoordinatesTop(IssmDouble** pxyz_list){_error_("not implemented yet");};
+@@ -109,7 +107,7 @@
+ 		void        NodalFunctionsP1Derivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsMINIDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+-		bool        IsIceInElement(){_error_("not implemented yet");};
++		bool        IsIceInElement();
+ 		void        NormalSection(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		void        NormalTop(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		void        NormalBase(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+@@ -125,8 +123,6 @@
+ 		int         VelocityInterpolation(void){_error_("not implemented yet");};
+ 		void        GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating){_error_("not implemented yet");};
+ 		IssmDouble  GetGroundedPortion(IssmDouble* xyz_list){_error_("not implemented yet");};
+-		void        GetInputListOnVertices(IssmDouble* pvalue,int enumtype){_error_("not implemented yet");};
+-		void        GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){_error_("not implemented yet");};
+ 		void        GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");};
+ 		void        GetInputValue(bool* pvalue,int enum_type){_error_("not implemented yet");};
+ 		void        GetInputValue(int* pvalue,int enum_type){_error_("not implemented yet");};
+@@ -137,7 +133,7 @@
+ 		IssmDouble  GetYcoord(Gauss* gauss){_error_("Not implemented");};
+ 		IssmDouble  GetZcoord(Gauss* gauss){_error_("not implemented yet");};
+ 		int         GetElementType(void){_error_("not implemented yet");};
+-		Gauss*      NewGauss(void){_error_("not implemented yet");};
++		Gauss*      NewGauss(void);
+ 		Gauss*      NewGauss(int order);
+       Gauss*      NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){_error_("not implemented yet");};
+       Gauss*      NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){_error_("not implemented yet");};
+@@ -152,9 +148,9 @@
+ 		void        VerticalSegmentIndices(int** pindices,int* pnumseg){_error_("not implemented yet");};
+ 		void        ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
+ 		bool        IsZeroLevelset(int levelset_enum){_error_("not implemented");};
+-		bool		IsIcefront(void){_error_("not implemented yet");};
++		bool		   IsIcefront(void);
+ 		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented");};
+-		void		GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented yet");};
++		void		   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented");};
+ 		void        GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
+ 
+ 		void    GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17308)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17309)
+@@ -265,6 +265,92 @@
+ Input* Element::GetInput(int inputenum){/*{{{*/
+ 	return inputs->GetInput(inputenum);
+ }/*}}}*/
++void Element::GetInputListOnVertices(IssmDouble* pvalue,int enumtype){/*{{{*/
++
++	/*Recover input*/
++	Input* input=this->GetInput(enumtype);
++	if (!input) _error_("Input " << EnumToStringx(enumtype) << " not found in element");
++
++	/*Fetch number vertices for this element*/
++	int numvertices = this->GetNumberOfVertices();
++
++	/*Checks in debugging mode*/
++	_assert_(pvalue);
++
++	/* Start looping on the number of vertices: */
++	Gauss*gauss=this->NewGauss();
++	for(int iv=0;iv<numvertices;iv++){
++		gauss->GaussVertex(iv);
++		input->GetInputValue(&pvalue[iv],gauss);
++	}
++
++	/*clean-up*/
++	delete gauss;
++}
++/*}}}*/
++void Element::GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){/*{{{*/
++
++	/*Recover input*/
++	Input* input=this->GetInput(enumtype);
++
++	/*Checks in debugging mode*/
++	_assert_(pvalue);
++
++	/*Fetch number vertices for this element*/
++	int numvertices = this->GetNumberOfVertices();
++
++	/* Start looping on the number of vertices: */
++	if (input){
++		Gauss* gauss=this->NewGauss();
++		for (int iv=0;iv<numvertices;iv++){
++			gauss->GaussVertex(iv);
++			input->GetInputValue(&pvalue[iv],gauss);
++		}
++		delete gauss;
++	}
++	else{
++		for(int iv=0;iv<numvertices;iv++) pvalue[iv]=defaultvalue;
++	}
++}
++/*}}}*/
++void Element::GetInputListOnNodes(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){/*{{{*/
++
++	_assert_(pvalue);
++
++	Input *input    = this->GetInput(enumtype);
++	int    numnodes = this->GetNumberOfNodes();
++
++	/* Start looping on the number of vertices: */
++	if(input){
++		Gauss* gauss=this->NewGauss();
++		for(int iv=0;iv<numnodes;iv++){
++			gauss->GaussNode(this->FiniteElement(),iv);
++			input->GetInputValue(&pvalue[iv],gauss);
++		}
++		delete gauss;
++	}
++	else{
++		for(int iv=0;iv<numnodes;iv++) pvalue[iv]=defaultvalue;
++	}
++}
++/*}}}*/
++void Element::GetInputListOnNodes(IssmDouble* pvalue,int enumtype){/*{{{*/
++
++	_assert_(pvalue);
++
++	int    numnodes = this->GetNumberOfNodes();
++	Input *input    = this->GetInput(enumtype);
++	if(!input) _error_("Input " << EnumToStringx(enumtype) << " not found in element");
++
++	/* Start looping on the number of vertices: */
++	Gauss* gauss=this->NewGauss();
++	for(int iv=0;iv<numnodes;iv++){
++		gauss->GaussNode(this->FiniteElement(),iv);
++		input->GetInputValue(&pvalue[iv],gauss);
++	}
++	delete gauss;
++}
++/*}}}*/
+ void Element::GetVerticesSidList(int* sidlist){/*{{{*/
+ 
+ 	int numvertices = this->GetNumberOfVertices();
+Index: ../trunk-jpl/src/c/classes/gauss/GaussSeg.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussSeg.cpp	(revision 17308)
++++ ../trunk-jpl/src/c/classes/gauss/GaussSeg.cpp	(revision 17309)
+@@ -11,6 +11,18 @@
+ #include "../../shared/Numerics/constants.h"
+ 
+ /*GaussSeg constructors and destructors:*/
++/*FUNCTION GaussSeg::GaussSeg() {{{*/
++GaussSeg::GaussSeg(){
++
++	numgauss=-1;
++
++	weights=NULL;
++	coords1=NULL;
++
++	weight=UNDEF;
++	coord1=UNDEF;
++}
++/*}}}*/
+ /*FUNCTION GaussSeg::GaussSeg(int order) {{{*/
+ GaussSeg::GaussSeg(int order){
+ 
+@@ -88,7 +100,15 @@
+ /*FUNCTION GaussSeg::GaussVertex{{{*/
+ void GaussSeg::GaussVertex(int iv){
+ 
+-	_error_("not supported");
++	/*in debugging mode: check that the default constructor has been called*/
++	_assert_(numgauss==-1);
++
++	/*update static arrays*/
++	switch(iv){
++		case 0: coord1=-1.; break;
++		case 1: coord1=+1.; break;
++		default: _error_("vertex index should be in [0 1]");
++	}
+ }
+ /*}}}*/
+ /*FUNCTION GaussSeg::GaussNode{{{*/
+Index: ../trunk-jpl/src/c/classes/gauss/GaussSeg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussSeg.h	(revision 17308)
++++ ../trunk-jpl/src/c/classes/gauss/GaussSeg.h	(revision 17309)
+@@ -22,6 +22,7 @@
+ 	public:
+ 
+ 		/*GaussSeg constructors, destructors*/
++		GaussSeg();
+ 		GaussSeg(int order);
+ 		~GaussSeg();
+ 
+Index: ../trunk-jpl/src/c/classes/Inputs/SegInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/SegInput.cpp	(revision 17308)
++++ ../trunk-jpl/src/c/classes/Inputs/SegInput.cpp	(revision 17309)
+@@ -117,3 +117,15 @@
+ 	/*do nothing: */
+ }
+ /*}}}*/
++/*FUNCTION SegInput::Min{{{*/
++IssmDouble SegInput::Min(void){
++
++	const int  numnodes=this->NumberofNodes();
++	IssmDouble min=values[0];
++
++	for(int i=1;i<numnodes;i++){
++		if(values[i]<min) min=values[i];
++	}
++	return min;
++}
++/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Inputs/SegInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/SegInput.h	(revision 17308)
++++ ../trunk-jpl/src/c/classes/Inputs/SegInput.h	(revision 17309)
+@@ -65,7 +65,7 @@
+ 		IssmDouble InfinityNorm(void){_error_("not implemented yet");};
+ 		IssmDouble Max(void){_error_("not implemented yet");};
+ 		IssmDouble MaxAbs(void){_error_("not implemented yet");};
+-		IssmDouble Min(void){_error_("not implemented yet");};
++		IssmDouble Min(void);
+ 		IssmDouble MinAbs(void){_error_("not implemented yet");};
+ 		void Extrude(void){_error_("not supported yet");};
+ 		void VerticallyIntegrate(Input* thickness_input){_error_("not supported yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-17309-17310.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17309-17310.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17309-17310.diff	(revision 17802)
@@ -0,0 +1,155 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 17309)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 17310)
+@@ -137,6 +137,34 @@
+ }
+ /*}}}*/
+ 
++void  Seg::GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){/*{{{*/
++	
++	/* Intermediaries */
++	int nrfrontnodes,index;
++	IssmDouble  levelset[NUMVERTICES];
++
++	/*Recover parameters and values*/
++	GetInputListOnVertices(&levelset[0],levelsetenum);
++	/* Get nodes where there is no ice */
++	nrfrontnodes=0;
++	for(int i=0;i<NUMVERTICES;i++){
++		if(levelset[i]>=0.){
++			index=i;
++			nrfrontnodes++;
++		}
++	}
++
++	_assert_(nrfrontnodes==1);
++
++	IssmDouble* xyz_front = xNew<IssmDouble>(3);
++
++	/* Return nodes */
++	for(int dir=0;dir<3;dir++){
++		xyz_front[dir]=xyz_list[3*index+dir];
++	}
++
++	*pxyz_front=xyz_front;
++}/*}}}*/
+ /*FUNCTION Seg::GetNumberOfNodes;{{{*/
+ int Seg::GetNumberOfNodes(void){
+ 	return this->NumberofNodes();
+@@ -208,6 +236,25 @@
+ 	return new GaussSeg(order);
+ }
+ /*}}}*/
++/*FUNCTION Seg::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){{{*/
++Gauss* Seg::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){
++
++	/*Output*/
++	Gauss* gauss = NULL;
++
++	if(xyz_list_front[0] == xyz_list[0]){
++		gauss = new GaussSeg(+1.);
++	}
++	else if(xyz_list_front[0] == xyz_list[3*1+0]){
++		gauss = new GaussSeg(-1.);
++	}
++	else{
++		_error_("front is not located on element edge");
++	}
++
++	return gauss;
++}
++/*}}}*/
+ /*FUNCTION Seg::NewElementVector{{{*/
+ ElementVector* Seg::NewElementVector(int approximation_enum){
+ 	return new ElementVector(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
+@@ -234,3 +281,17 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Seg::NormalSection{{{*/
++void Seg::NormalSection(IssmDouble* normal,IssmDouble* xyz_list_front){
++
++	IssmDouble* xyz_list = xNew<IssmDouble>(NUMVERTICES*3);
++	::GetVerticesCoordinates(xyz_list,this->vertices,NUMVERTICES);
++
++	if(xyz_list_front[0]>xyz_list[0])
++	 normal[0]= + 1.;
++	else
++	 normal[0]= - 1.;
++
++	xDelete<IssmDouble>(xyz_list);
++}
++/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17309)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17310)
+@@ -108,7 +108,7 @@
+ 		void        NodalFunctionsMINIDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		bool        IsIceInElement();
+-		void        NormalSection(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
++		void        NormalSection(IssmDouble* normal,IssmDouble* xyz_list);
+ 		void        NormalTop(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		void        NormalBase(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		int         NumberofNodesVelocity(void){_error_("not implemented yet");};
+@@ -135,7 +135,7 @@
+ 		int         GetElementType(void){_error_("not implemented yet");};
+ 		Gauss*      NewGauss(void);
+ 		Gauss*      NewGauss(int order);
+-      Gauss*      NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){_error_("not implemented yet");};
++      Gauss*      NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order);
+       Gauss*      NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){_error_("not implemented yet");};
+       Gauss*      NewGauss(int point1,IssmDouble fraction1,IssmDouble fraction2,bool mainlyfloating,int order){_error_("not implemented yet");};
+ 		Gauss*      NewGaussBase(int order){_error_("not implemented yet");};
+@@ -150,7 +150,7 @@
+ 		bool        IsZeroLevelset(int levelset_enum){_error_("not implemented");};
+ 		bool		   IsIcefront(void);
+ 		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented");};
+-		void		   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented");};
++		void		   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum);
+ 		void        GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
+ 
+ 		void    GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/gauss/GaussSeg.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussSeg.cpp	(revision 17309)
++++ ../trunk-jpl/src/c/classes/gauss/GaussSeg.cpp	(revision 17310)
+@@ -51,6 +51,24 @@
+ 	coord1=UNDEF;
+ }
+ /*}}}*/
++/*FUNCTION GaussSeg::GaussSeg(IssmDouble position) {{{*/
++GaussSeg::GaussSeg(IssmDouble position){
++
++	/*Get gauss points*/
++	this->numgauss = 1;
++	this->coords1=xNew<IssmDouble>(numgauss);
++	this->weights=xNew<IssmDouble>(numgauss);
++
++	/*cast : */
++	_assert_(position>=-1. && position<=+1.);
++	this->coords1[0]=position;
++	this->weights[0]=1.;
++
++	/*Initialize static fields as undefinite*/
++	weight=UNDEF;
++	coord1=UNDEF;
++}
++/*}}}*/
+ /*FUNCTION GaussSeg::~GaussSeg(){{{*/
+ GaussSeg::~GaussSeg(){
+ 	xDelete<IssmDouble>(weights);
+Index: ../trunk-jpl/src/c/classes/gauss/GaussSeg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussSeg.h	(revision 17309)
++++ ../trunk-jpl/src/c/classes/gauss/GaussSeg.h	(revision 17310)
+@@ -24,6 +24,7 @@
+ 		/*GaussSeg constructors, destructors*/
+ 		GaussSeg();
+ 		GaussSeg(int order);
++		GaussSeg(IssmDouble position);
+ 		~GaussSeg();
+ 
+ 		/*Methods*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17310-17311.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17310-17311.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17310-17311.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/test/NightlyRun/test103.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test103.m	(revision 17310)
++++ ../trunk-jpl/test/NightlyRun/test103.m	(revision 17311)
+@@ -11,7 +11,7 @@
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure',...
+ 	'StressTensorxx','StressTensoryy','StressTensorzz','StressTensorxy','StressTensorxz','StressTensoryz'};
+ field_tolerances={1e-09,1e-09,1e-09,1e-09,1e-09,...
+-	1e-09,1e-09,1e-09,1e-09,1e-09,1e-09};
++	1e-09,1e-09,1e-09,1e-09,1e-09,1e-08};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test103.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test103.py	(revision 17310)
++++ ../trunk-jpl/test/NightlyRun/test103.py	(revision 17311)
+@@ -20,7 +20,7 @@
+ field_names     =['Vx','Vy','Vz','Vel','Pressure',\
+ 	'StressTensorxx','StressTensoryy','StressTensorzz','StressTensorxy','StressTensorxz','StressTensoryz']
+ field_tolerances=[1e-09,1e-09,1e-09,1e-09,1e-09,\
+-	1e-09,1e-09,1e-09,1e-09,1e-09,1e-09]
++	1e-09,1e-09,1e-09,1e-09,1e-09,1e-08]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Vx,\
+ 	md.results.StressbalanceSolution.Vy,\
Index: issm/oecreview/Archive/16554-17801/ISSM-17311-17312.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17311-17312.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17311-17312.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/jenkins/imac-012301-gil
+===================================================================
+--- ../trunk-jpl/jenkins/imac-012301-gil	(revision 17311)
++++ ../trunk-jpl/jenkins/imac-012301-gil	(revision 17312)
+@@ -104,5 +104,6 @@
+ #as follows: runme($MATLAB_NROPTIONS). The options must be understandable
+ #by Matlab and runme.m
+ #ex: "'id',[101 102 103]"
+-MATLAB_NROPTIONS="'exclude',[218 234 235 412 413 414 417 418 420 514 701 702 703]"
++##                                                                   bamg mesh   FS
++MATLAB_NROPTIONS="'exclude',[218 234 235 412 413 414 417 418 420 514 701 702 703 422 404 421 503 507 510]"
+ PYTHON_NROPTIONS=""
Index: issm/oecreview/Archive/16554-17801/ISSM-17312-17313.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17312-17313.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17312-17313.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/test/NightlyRun/test455.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test455.py	(revision 17312)
++++ ../trunk-jpl/test/NightlyRun/test455.py	(revision 17313)
+@@ -22,7 +22,7 @@
+ 	md.flowequation.fe_HO=i
+ 	md=solve(md,StressbalanceSolutionEnum())
+ 	field_names     =field_names+['Vx'+i,'Vy'+i,'Vz'+i,'Vel'+i,'Pressure'+i]
+-	field_tolerances=field_tolerances+[3e-08,2e-08,1e-08,3e-08,3e-13]
++	field_tolerances=field_tolerances+[3e-08,2.5e-08,1e-08,3e-08,3e-13]
+ 	field_values=field_values+[\
+ 			md.results.StressbalanceSolution.Vx,\
+ 			md.results.StressbalanceSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test455.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test455.m	(revision 17312)
++++ ../trunk-jpl/test/NightlyRun/test455.m	(revision 17313)
+@@ -12,7 +12,7 @@
+ 	md.flowequation.fe_HO=i{1};
+ 	md=solve(md,StressbalanceSolutionEnum());
+ 	field_names     ={field_names{:},['Vx' i{1}],['Vy' i{1}],['Vz' i{1}],['Vel' i{1}],['Pressure' i{1}]};
+-	field_tolerances={field_tolerances{:},3e-08,2e-08,1e-08,3e-08,3e-13};
++	field_tolerances={field_tolerances{:},3e-08,2.5e-08,1e-08,3e-08,3e-13};
+ 	field_values={field_values{:},...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
Index: issm/oecreview/Archive/16554-17801/ISSM-17313-17314.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17313-17314.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17313-17314.diff	(revision 17802)
@@ -0,0 +1,15 @@
+Index: ../trunk-jpl/src/m/classes/flowequation.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/flowequation.m	(revision 17313)
++++ ../trunk-jpl/src/m/classes/flowequation.m	(revision 17314)
+@@ -94,8 +94,8 @@
+ 					md = checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[1:2]);
+ 					md = checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[1:2]);
+ 				elseif strcmp(meshtype(md.mesh),'2Dvertical')
+-					md = checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[3:4]);
+-					md = checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[3:4]);
++					md = checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[2:4]);
++					md = checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[2:4]);
+ 				elseif strcmp(meshtype(md.mesh),'3D'),
+ 					md = checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[0:8]);
+ 					md = checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[0:8]);
Index: issm/oecreview/Archive/16554-17801/ISSM-17314-17315.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17314-17315.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17314-17315.diff	(revision 17802)
@@ -0,0 +1,118 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17314)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17315)
+@@ -15,7 +15,13 @@
+ 	int  numdofs;
+ 
+ 	switch(approximation){
+-		case SSAApproximationEnum:  numdofs =2; break;
++		case SSAApproximationEnum:
++			 switch(meshtype){
++				 case Mesh3DEnum:         numdofs=2; break;
++				 case Mesh2DverticalEnum: numdofs=1; break;
++				 default: _error_("mesh type not supported yet");
++			 }
++			 break;
+ 		case L1L2ApproximationEnum: numdofs =2; break;
+ 		case HOApproximationEnum:   
+ 			 switch(meshtype){
+@@ -1421,7 +1427,7 @@
+ 	}
+ 
+ 	/*Transform coordinate system*/
+-	element->TransformLoadVectorCoord(pe,XYEnum);
++	if(dim==2) element->TransformLoadVectorCoord(pe,XYEnum);
+ 
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(xyz_list);
+@@ -1495,7 +1501,7 @@
+ 	}
+ 
+ 	/*Transform coordinate system*/
+-	element->TransformLoadVectorCoord(pe,XYEnum);
++	if(dim==2) element->TransformLoadVectorCoord(pe,XYEnum);
+ 
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(xyz_list);
+@@ -1695,11 +1701,11 @@
+ 
+ 	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+ 	for(i=0;i<numnodes;i++){
+-		vx[i]=values[i*2+0];
++		vx[i]=values[i*dim+0];
+ 		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
+ 
+ 		if(dim==2){
+-			vy[i]=values[i*2+1];
++			vy[i]=values[i*dim+1];
+ 			if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
+ 		}
+ 	}
+@@ -1710,7 +1716,7 @@
+ 		for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
+ 	}
+ 	else{
+-		element->GetInputListOnNodes(&vy[0],VyEnum,0.);
++		basalelement->GetInputListOnNodes(&vy[0],VyEnum,0.);
+ 		for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i]);
+ 	}
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 17314)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 17315)
+@@ -226,6 +226,13 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Seg::JacobianDeterminantSurface{{{*/
++void Seg::JacobianDeterminantSurface(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){
++
++	*pJdet = 1.;
++
++}
++/*}}}*/
+ /*FUNCTION Seg::NewGauss(){{{*/
+ Gauss* Seg::NewGauss(void){
+ 	return new GaussSeg();
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17314)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17315)
+@@ -95,7 +95,7 @@
+ 		bool        IsNodeOnShelfFromFlags(IssmDouble* flags){_error_("not implemented yet");};
+ 		void        JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss);
+ 		void        JacobianDeterminantLine(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+-		void        JacobianDeterminantSurface(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
++		void        JacobianDeterminantSurface(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss);
+ 		void        JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
+ 		void        JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
+ 		IssmDouble  MinEdgeLength(IssmDouble* xyz_list){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/gauss/GaussSeg.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussSeg.cpp	(revision 17314)
++++ ../trunk-jpl/src/c/classes/gauss/GaussSeg.cpp	(revision 17315)
+@@ -132,8 +132,21 @@
+ /*FUNCTION GaussSeg::GaussNode{{{*/
+ void GaussSeg::GaussNode(int finiteelement,int iv){
+ 
+-	_error_("not supported");
++	/*in debugging mode: check that the default constructor has been called*/
++	_assert_(numgauss==-1);
+ 
++	/*update static arrays*/
++	switch(finiteelement){
++		case P1Enum: case P1DGEnum:
++			switch(iv){
++				case 0: coord1=-1.; break;
++				case 1: coord1=+1.; break;
++				default: _error_("node index should be in [0 1]");
++			}
++			break;
++		default: _error_("Finite element "<<EnumToStringx(finiteelement)<<" not supported");
++	}
++
+ }
+ /*}}}*/
+ /*FUNCTION GaussSeg::begin{{{*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17315-17316.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17315-17316.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17315-17316.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/test/NightlyRun/test204.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test204.py	(revision 17315)
++++ ../trunk-jpl/test/NightlyRun/test204.py	(revision 17316)
+@@ -20,7 +20,7 @@
+ # Fields and tolerances to track changes
+ 
+ field_names     =['Vx','Vy','Vz','Vel','Pressure']
+-field_tolerances=[1e-08,1e-08,1e-07,1e-08,1e-08]
++field_tolerances=[1e-08,1e-08,2e-07,1e-08,1e-08]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Vx,\
+ 	md.results.StressbalanceSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test204.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test204.m	(revision 17315)
++++ ../trunk-jpl/test/NightlyRun/test204.m	(revision 17316)
+@@ -8,7 +8,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure'};
+-field_tolerances={1e-08,1e-08,1e-07,1e-08,1e-08};
++field_tolerances={1e-08,1e-08,2e-07,1e-08,1e-08};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
Index: issm/oecreview/Archive/16554-17801/ISSM-17316-17317.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17316-17317.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17316-17317.diff	(revision 17802)
@@ -0,0 +1,16 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17316)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17317)
+@@ -17,8 +17,9 @@
+ 	switch(approximation){
+ 		case SSAApproximationEnum:
+ 			 switch(meshtype){
+-				 case Mesh3DEnum:         numdofs=2; break;
+-				 case Mesh2DverticalEnum: numdofs=1; break;
++				 case Mesh3DEnum:           numdofs=2; break;
++				 case Mesh2DhorizontalEnum: numdofs=2; break;
++				 case Mesh2DverticalEnum:   numdofs=1; break;
+ 				 default: _error_("mesh type not supported yet");
+ 			 }
+ 			 break;
Index: issm/oecreview/Archive/16554-17801/ISSM-17317-17318.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17317-17318.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17317-17318.diff	(revision 17802)
@@ -0,0 +1,104 @@
+Index: ../trunk-jpl/test/NightlyRun/test435.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test435.m	(revision 0)
++++ ../trunk-jpl/test/NightlyRun/test435.m	(revision 17318)
+@@ -0,0 +1,77 @@
++md=triangle(model(),'../Exp/Square.exp',100000.);
++md=setmask(md,'../Exp/SquareShelf.exp','');
++md=parameterize(md,'../Par/SquareSheetShelf.par');
++md.initialization.vx(:)=1.;
++md.initialization.vy(:)=1.;
++md.geometry.thickness(:)=500-md.mesh.x/10000;
++md.geometry.bathymetry=-100-md.mesh.x/1000;
++md.geometry.bed=-md.geometry.thickness*md.materials.rho_ice/md.materials.rho_water;
++md.mask.groundedice_levelset=md.geometry.thickness+md.materials.rho_water/md.materials.rho_ice*md.geometry.bathymetry;
++pos=find(md.mask.groundedice_levelset>=0);
++md.geometry.bed(pos)=md.geometry.bathymetry(pos);
++md.geometry.surface=md.geometry.bed+md.geometry.thickness;
++md=extrude(md,4,1.);
++md=setflowequation(md,'HO','all');
++
++%Boundary conditions:
++md.mask.ice_levelset=-ones(md.mesh.numberofvertices,1);
++md.mask.ice_levelset(find(md.mesh.x==max(md.mesh.x)))=0;
++md.stressbalance.spcvx(:)=NaN;
++md.stressbalance.spcvy(:)=NaN;
++md.stressbalance.spcvz(:)=NaN;
++pos=find((md.mesh.y<1000000.1 & md.mesh.y>999999.9) | (md.mesh.y<0.1 & md.mesh.y>-0.1));
++md.stressbalance.spcvy(pos)=0;
++pos2=find(md.mesh.x<0.1 & md.mesh.x>-0.1);
++md.stressbalance.spcvx(pos2)=0;
++md.stressbalance.spcvy(pos2)=0;
++
++md.materials.rheology_B=1/((10^-25)^(1/3))*ones(md.mesh.numberofvertices,1);
++md.materials.rheology_law='None';
++md.friction.coefficient(:)=sqrt(10^7)*ones(md.mesh.numberofvertices,1);
++md.friction.p=3*ones(md.mesh.numberofelements,1);
++md.surfaceforcings.mass_balance(:)=1;
++md.basalforcings.melting_rate(:)=0;
++md.transient.isthermal=0;
++md.transient.isstressbalance=1;
++md.transient.isgroundingline=1;
++md.transient.ismasstransport=1;
++md.groundingline.migration='SubelementMigration';
++md.timestepping.final_time=30;
++md.timestepping.time_step=10;
++
++md.cluster=generic('name',oshostname(),'np',3);
++md=solve(md,TransientSolutionEnum());
++
++%Fields and tolerances to track changes
++field_names     ={'Bed1','Surface1','Thickness1','Floatingice1','Vx1','Vy1','Vz1','Pressure1',...
++	'Bed2','Surface2','Thickness2','Floatingice2','Vx2','Vy2','Vz2','Pressure2',...
++	'Bed3','Surface3','Thickness3','Floatingice3','Vx3','Vy3','Vz3','Pressure3'};
++field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
++	4e-12,2e-12,6e-12,2e-11,1e-13,1e-13,1e-13,1e-13,...
++	1e-10,3e-11,1e-10,7e-11,1e-13,1e-13,1e-13,1e-13};
++field_values={...
++	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Surface),...
++	(md.results.TransientSolution(1).Thickness),...
++	(md.results.TransientSolution(1).MaskGroundediceLevelset),...
++	(md.results.TransientSolution(1).Vx),...
++	(md.results.TransientSolution(1).Vy),...
++	(md.results.TransientSolution(1).Vz),...
++	(md.results.TransientSolution(1).Pressure),...
++	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Surface),...
++	(md.results.TransientSolution(2).Thickness),...
++	(md.results.TransientSolution(2).MaskGroundediceLevelset),...
++	(md.results.TransientSolution(2).Vx),...
++	(md.results.TransientSolution(2).Vy),...
++	(md.results.TransientSolution(2).Vz),...
++	(md.results.TransientSolution(2).Pressure),...
++	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Surface),...
++	(md.results.TransientSolution(3).Thickness),...
++	(md.results.TransientSolution(3).MaskGroundediceLevelset),...
++	(md.results.TransientSolution(3).Vx),...
++	(md.results.TransientSolution(3).Vy),...
++	(md.results.TransientSolution(3).Vz),...
++	(md.results.TransientSolution(3).Pressure),...
++	};
+Index: ../trunk-jpl/test/NightlyRun/IdToName.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/IdToName.m	(revision 17317)
++++ ../trunk-jpl/test/NightlyRun/IdToName.m	(revision 17318)
+@@ -139,6 +139,7 @@
+ 	case 432, name='SquareSheetShelfSteaEnthalpyHO';
+ 	case 433, name='RoundSheetShelfGLMigrationSSA3d';
+ 	case 434, name='SquareSheetShelfL1L2';
++	case 435, name='MISMIP3DHO';
+ 	case 450, name='SquareSheetShelfStressSSAHigherOrder';
+ 	case 455, name='SquareSheetShelfStressHOHigherOrder';
+ 	case 501, name='PigStressSSA2d';
+Index: ../trunk-jpl/test/Archives/Archive435.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/test/Archives/Archive435.nc
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+
Index: issm/oecreview/Archive/16554-17801/ISSM-17318-17319.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17318-17319.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17318-17319.diff	(revision 17802)
@@ -0,0 +1,22 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17318)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17319)
+@@ -2285,7 +2285,7 @@
+ 	IssmDouble value,isonbed;
+ 
+ 	this->parameters->FindParam(&extrusioninput,InputToExtrudeEnum);
+-	Input* input = inputs->GetInput(extrusioninput);      _assert_(extrusioninput);
++	Input* input = inputs->GetInput(extrusioninput);      _assert_(input);
+ 	Input* onbed = inputs->GetInput(MeshVertexonbedEnum); _assert_(onbed);
+ 
+ 	GaussTria* gauss=new GaussTria();
+@@ -2311,7 +2311,7 @@
+ 	IssmDouble value;
+ 
+ 	this->parameters->FindParam(&extrusioninput,InputToExtrudeEnum);
+-	Input* input = inputs->GetInput(extrusioninput); _assert_(extrusioninput);
++	Input* input = inputs->GetInput(extrusioninput); _assert_(input);
+ 	this->EdgeOnSurfaceIndices(&indices[0],&indices[1]);
+ 
+ 	GaussTria* gauss=new GaussTria();
Index: issm/oecreview/Archive/16554-17801/ISSM-17319-17320.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17319-17320.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17319-17320.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/test/NightlyRun/test513.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test513.py	(revision 17319)
++++ ../trunk-jpl/test/NightlyRun/test513.py	(revision 17320)
+@@ -35,7 +35,7 @@
+ 
+ # Fields and tolerances to track changes
+ field_names     =['Gradient','Misfits','FrictionCoefficient','Pressure','Vel','Vx','Vy','Vz','Temperature','BasalforcingsMeltingRate']
+-field_tolerances=[2e-10,2e-10,1e-10,1e-10,1e-6,1e-6,1e-6,2e-6,1e-6,2e-06]
++field_tolerances=[2e-10,2e-10,1e-10,1e-10,2e-6,1e-6,2e-6,2e-6,1e-6,2e-06]
+ field_values=[\
+ 	md.results.SteadystateSolution.Gradient1,\
+ 	md.results.SteadystateSolution.J,\
+Index: ../trunk-jpl/test/NightlyRun/test513.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test513.m	(revision 17319)
++++ ../trunk-jpl/test/NightlyRun/test513.m	(revision 17320)
+@@ -24,7 +24,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Gradient','Misfits','FrictionCoefficient','Pressure','Vel','Vx','Vy','Vz','Temperature','BasalforcingsMeltingRate'};
+-field_tolerances={2e-10,2e-10,1e-10,1e-10,1e-6,1e-6,1e-6,2e-6,1e-6,2e-06};
++field_tolerances={2e-10,2e-10,1e-10,1e-10,2e-6,1e-6,2e-6,2e-6,1e-6,2e-06};
+ field_values={...
+ 	(md.results.SteadystateSolution.Gradient1),...
+ 	md.results.SteadystateSolution.J,...
Index: issm/oecreview/Archive/16554-17801/ISSM-17320-17321.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17320-17321.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17320-17321.diff	(revision 17802)
@@ -0,0 +1,39 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17320)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17321)
+@@ -2279,7 +2279,7 @@
+ /*FUNCTION Tria::UpdateConstraintsExtrudeFromBase{{{*/
+ void  Tria::UpdateConstraintsExtrudeFromBase(void){
+ 
+-	if(!HasNodeOnBed()) return;
++	if(!HasEdgeOnBed()) return;
+ 
+ 	int        extrusioninput;
+ 	IssmDouble value,isonbed;
+Index: ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 17320)
++++ ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 17321)
+@@ -51,7 +51,7 @@
+ 
+ 	_printf_(setw(15)<<"   TriaInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" [");
+ 	for(int i=0;i<this->NumberofNodes();i++) _printf_(" "<<this->values[i]);
+-	_printf_("]\n");
++	_printf_("] ("<<EnumToStringx(this->element_type)<<")\n");
+ }
+ /*}}}*/
+ /*FUNCTION TriaInput::Id{{{*/
+Index: ../trunk-jpl/src/c/classes/Node.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Node.cpp	(revision 17320)
++++ ../trunk-jpl/src/c/classes/Node.cpp	(revision 17321)
+@@ -60,7 +60,7 @@
+ 		XZvectorsToCoordinateSystem(&this->coord_system[0][0],&iomodel->Data(StressbalanceReferentialEnum)[io_index*6]);
+ 		_assert_(sqrt( coord_system[0][0]*coord_system[0][0] + coord_system[1][0]*coord_system[1][0]) >1.e-4);
+ 
+-		if(iomodel->meshtype==Mesh3DEnum){
++		if(iomodel->meshtype!=Mesh2DhorizontalEnum){
+ 			/*We have a  3d mesh, we may have collapsed elements, hence dead nodes. Freeze them out: */
+ 			_assert_(iomodel->Data(MeshVertexonbedEnum)); 
+ 			_assert_(iomodel->Data(FlowequationVertexEquationEnum));
Index: issm/oecreview/Archive/16554-17801/ISSM-17321-17322.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17321-17322.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17321-17322.diff	(revision 17802)
@@ -0,0 +1,172 @@
+Index: ../trunk-jpl/src/c/modules/modules.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/modules.h	(revision 17321)
++++ ../trunk-jpl/src/c/modules/modules.h	(revision 17322)
+@@ -79,7 +79,7 @@
+ #include "./Reducevectorgtosx/Reducevectorgtosx.h"
+ #include "./Reducevectorgtofx/Reducevectorgtofx.h"
+ #include "./ResetConstraintsx/ResetConstraintsx.h"
+-#include "./ResetCoordinateSystemx/ResetCoordinateSystemx.h"
++#include "./ResetFSBasalBoundaryConditionx/ResetFSBasalBoundaryConditionx.h"
+ #include "./RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.h"
+ #include "./Scotchx/Scotchx.h"
+ #include "./Shp2Kmlx/Shp2Kmlx.h"
+Index: ../trunk-jpl/src/c/modules/ResetFSBasalBoundaryConditionx/ResetFSBasalBoundaryConditionx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ResetFSBasalBoundaryConditionx/ResetFSBasalBoundaryConditionx.cpp	(revision 0)
++++ ../trunk-jpl/src/c/modules/ResetFSBasalBoundaryConditionx/ResetFSBasalBoundaryConditionx.cpp	(revision 17322)
+@@ -0,0 +1,18 @@
++/*!\file ResetFSBasalBoundaryConditionx
++ * \brief: reset coordinate system for full-FS: tangential to the bedrock
++ */
++
++#include "./ResetFSBasalBoundaryConditionx.h"
++#include "../../shared/shared.h"
++#include "../../toolkits/toolkits.h"
++
++void ResetFSBasalBoundaryConditionx(Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads,Materials* materials,Parameters* parameters){
++
++	Element *element = NULL;
++
++	for (int i=0;i<elements->Size();i++){
++		element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
++		element->ResetFSBasalBoundaryCondition();
++	}
++
++}
+Index: ../trunk-jpl/src/c/modules/ResetFSBasalBoundaryConditionx/ResetFSBasalBoundaryConditionx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/ResetFSBasalBoundaryConditionx/ResetFSBasalBoundaryConditionx.h	(revision 0)
++++ ../trunk-jpl/src/c/modules/ResetFSBasalBoundaryConditionx/ResetFSBasalBoundaryConditionx.h	(revision 17322)
+@@ -0,0 +1,13 @@
++/*!\file:  ResetFSBasalBoundaryConditionx.h
++ * \brief header file for reset coordinate system module
++ */ 
++
++#ifndef _RESETFSBASALBOUNDARYCONDITIONX_H
++#define _RESETFSBASALBOUNDARYCONDITIONX_H
++
++#include "../../classes/classes.h"
++
++/* local prototypes: */
++void ResetFSBasalBoundaryConditionx(Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads,Materials* materials,  Parameters* parameters); 
++
++#endif  /* _RESETFSBASALBOUNDARYCONDITIONX_H */
+
+Property changes on: ../trunk-jpl/src/c/modules/ResetFSBasalBoundaryConditionx
+___________________________________________________________________
+Name: svn:ignore
+   + .deps
+.dirstamp
+
+
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17321)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17322)
+@@ -319,8 +319,8 @@
+ 					./modules/ConstraintsStatex/ConstraintsStateLocal.h\
+ 					./modules/ResetConstraintsx/ResetConstraintsx.h\
+ 					./modules/ResetConstraintsx/ResetConstraintsx.cpp\
+-					./modules/ResetCoordinateSystemx/ResetCoordinateSystemx.h\
+-					./modules/ResetCoordinateSystemx/ResetCoordinateSystemx.cpp\
++					./modules/ResetFSBasalBoundaryConditionx/ResetFSBasalBoundaryConditionx.h\
++					./modules/ResetFSBasalBoundaryConditionx/ResetFSBasalBoundaryConditionx.cpp\
+ 					./modules/Solverx/Solverx.cpp\
+ 					./modules/Solverx/Solverx.h\
+ 					./modules/VecMergex/VecMergex.cpp\
+Index: ../trunk-jpl/src/c/cores/stressbalance_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/stressbalance_core.cpp	(revision 17321)
++++ ../trunk-jpl/src/c/cores/stressbalance_core.cpp	(revision 17322)
+@@ -48,7 +48,7 @@
+ 	if(isFS){
+ 		bedslope_core(femmodel);
+ 		femmodel->SetCurrentConfiguration(StressbalanceAnalysisEnum);
+-		ResetCoordinateSystemx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
++		ResetFSBasalBoundaryConditionx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
+ 	}
+ 
+ 	/*Compute SIA velocities*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17321)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17322)
+@@ -215,7 +215,7 @@
+ 	   virtual Element*   SpawnBasalElement(void)=0;
+ 		virtual Element*   SpawnTopElement(void)=0;
+ 		virtual void   ReduceMatrices(ElementMatrix* Ke,ElementVector* pe)=0;
+-		virtual void   ResetCoordinateSystem()=0;
++		virtual void   ResetFSBasalBoundaryCondition()=0;
+ 		virtual void   SetTemporaryElementType(int element_type_in)=0;
+ 		virtual IssmDouble StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa)=0;
+ 		virtual void   ValueP1OnGauss(IssmDouble* pvalue,IssmDouble* values,Gauss* gauss)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17321)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17322)
+@@ -1935,8 +1935,8 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::ResetCoordinateSystem{{{*/
+-void  Tria::ResetCoordinateSystem(void){
++/*FUNCTION Tria::ResetFSBasalBoundaryCondition{{{*/
++void  Tria::ResetFSBasalBoundaryCondition(void){
+ 
+ 	int        approximation;
+ 	int        numindices;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17321)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17322)
+@@ -112,7 +112,7 @@
+ 		int         NodalValue(IssmDouble* pvalue, int index, int natureofdataenum);
+ 		void        PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm);
+ 		void        ReduceMatrices(ElementMatrix* Ke,ElementVector* pe);
+-		void        ResetCoordinateSystem(void);
++		void        ResetFSBasalBoundaryCondition(void);
+ 		void	      SmbGradients();
+ 	   Element*    SpawnBasalElement(void);
+ 		Element*    SpawnTopElement(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17321)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17322)
+@@ -2157,8 +2157,8 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Penta::ResetCoordinateSystem{{{*/
+-void  Penta::ResetCoordinateSystem(void){
++/*FUNCTION Penta::ResetFSBasalBoundaryCondition{{{*/
++void  Penta::ResetFSBasalBoundaryCondition(void){
+ 
+ 	int        approximation;
+ 	int        numindices;
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17321)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17322)
+@@ -116,7 +116,7 @@
+ 		void   GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
+ 		void   PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm);
+ 		void   ReduceMatrices(ElementMatrix* Ke,ElementVector* pe);
+-		void   ResetCoordinateSystem(void);
++		void   ResetFSBasalBoundaryCondition(void);
+ 		void   SmbGradients();
+ 		void   SetTemporaryElementType(int element_type_in);
+ 	   Element* SpawnBasalElement(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17321)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17322)
+@@ -168,7 +168,7 @@
+ 		void        MaterialUpdateFromTemperature(void){_error_("not implemented yet");};
+ 		int         NodalValue(IssmDouble* pvalue, int index, int natureofdataenum){_error_("not implemented yet");};
+ 		void        PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm){_error_("not implemented yet");};
+-		void        ResetCoordinateSystem(void){_error_("not implemented yet");};
++		void        ResetFSBasalBoundaryCondition(void){_error_("not implemented yet");};
+ 		void        ReduceMatrices(ElementMatrix* Ke,ElementVector* pe){_error_("not implemented yet");};
+ 		void        SetTemporaryElementType(int element_type_in){_error_("not implemented yet");};
+ 		void	      SmbGradients(){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-17322-17323.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17322-17323.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17322-17323.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/c/classes/Node.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Node.cpp	(revision 17322)
++++ ../trunk-jpl/src/c/classes/Node.cpp	(revision 17323)
+@@ -453,6 +453,7 @@
+ 
+ 	/*Put dof for this node into the f set (ie, this dof will NOT be constrained 
+ 	 * to a fixed value during computations. */
++	_assert_(dof<this->indexing.gsize);
+ 
+ 	if(this->indexing.f_set[dof] == 0){
+ 		this->indexingupdate = true;
Index: issm/oecreview/Archive/16554-17801/ISSM-17323-17324.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17323-17324.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17323-17324.diff	(revision 17802)
@@ -0,0 +1,51 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17323)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17324)
+@@ -4,6 +4,7 @@
+ #include "../shared/shared.h"
+ #include "../modules/modules.h"
+ #include "../solutionsequences/solutionsequences.h"
++#include "../cores/cores.h"
+ 
+ //#define FSANALYTICAL 1
+ 
+@@ -271,7 +272,7 @@
+ 			iomodel->Constant(&finiteelement,FlowequationFeFSEnum);
+ 		}
+ 		iomodel->FetchData(3,FlowequationBorderSSAEnum,FlowequationVertexEquationEnum,StressbalanceReferentialEnum);
+-		if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchData(3,MeshVertexonbedEnum,MeshVertexonsurfaceEnum,FlowequationBorderFSEnum);
++		if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(3,MeshVertexonbedEnum,MeshVertexonsurfaceEnum,FlowequationBorderFSEnum);
+ 		::CreateNodes(nodes,iomodel,StressbalanceAnalysisEnum,finiteelement,approximation);
+ 		iomodel->DeleteData(6,MeshVertexonbedEnum,MeshVertexonsurfaceEnum,FlowequationBorderSSAEnum,FlowequationBorderFSEnum,
+ 					FlowequationVertexEquationEnum,StressbalanceReferentialEnum);
+@@ -837,13 +838,14 @@
+ 	/*Intermediaries*/
+ 	bool isSSA,isL1L2,isHO,isFS;
+ 	bool conserve_loads = true;
+-	int  newton;
++	int  newton,meshtype;
+ 
+ 	/* recover parameters:*/
+ 	femmodel->parameters->FindParam(&isSSA,FlowequationIsSSAEnum);
+ 	femmodel->parameters->FindParam(&isL1L2,FlowequationIsL1L2Enum);
+ 	femmodel->parameters->FindParam(&isHO,FlowequationIsHOEnum);
+ 	femmodel->parameters->FindParam(&isFS,FlowequationIsFSEnum);
++	femmodel->parameters->FindParam(&meshtype,MeshTypeEnum);
+ 	femmodel->parameters->FindParam(&newton,StressbalanceIsnewtonEnum);
+ 
+ 	if((isSSA || isHO || isL1L2) ^ isFS){ // ^ = xor
+@@ -854,6 +856,13 @@
+ 		 solutionsequence_newton(femmodel);
+ 		else
+ 		 solutionsequence_nonlinear(femmodel,conserve_loads); 
++
++		if(meshtype==Mesh2DverticalEnum && isSSA){
++			femmodel->parameters->SetParam(VxEnum,InputToExtrudeEnum);
++			extrudefrombase_core(femmodel);
++			femmodel->parameters->SetParam(VelEnum,InputToExtrudeEnum);
++			extrudefrombase_core(femmodel);
++		}
+ 	}
+ 
+ 	if ((isSSA || isL1L2 || isHO) && isFS){
Index: issm/oecreview/Archive/16554-17801/ISSM-17324-17325.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17324-17325.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17324-17325.diff	(revision 17802)
@@ -0,0 +1,83 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17324)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17325)
+@@ -6,7 +6,7 @@
+ #include "../solutionsequences/solutionsequences.h"
+ #include "../cores/cores.h"
+ 
+-//#define FSANALYTICAL 1
++//#define FSANALYTICAL 3
+ 
+ /*Model processing*/
+ int  StressbalanceAnalysis::DofsPerNode(int** pdoftype,int meshtype,int approximation){/*{{{*/
+@@ -412,18 +412,6 @@
+ 			else{
+ 				_error_("not supported yet");
+ 			}
+-			for(i=0;i<iomodel->numberofvertices;i++){
+-				if(iomodel->my_vertices[i]){
+-					if(nodeonbed[i]>0. && groundedice_ls[i]>0. && nodeonFS[i]>0.){
+-						if(vertices_type[i] == FSApproximationEnum){
+-							for(j=0;j<Nz;j++) spcvz[i*Nz+j] = 0.;
+-						}
+-						else{
+-							_error_("not supported");
+-						}
+-					}
+-				}
+-			}
+ 			if(iomodel->meshtype==Mesh3DEnum){
+ 				IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvxEnum,StressbalanceAnalysisEnum,finiteelement,1);
+ 				IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvyEnum,StressbalanceAnalysisEnum,finiteelement,2);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17324)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17325)
+@@ -2163,7 +2163,7 @@
+ 	int        approximation;
+ 	int        numindices;
+ 	int       *indices = NULL;
+-	IssmDouble slopex,slopey;
++	IssmDouble slopex,slopey,groundedice;
+ 	IssmDouble xz_plane[6];
+ 
+ 	/*For FS only: we want the CS to be tangential to the bedrock*/
+@@ -2176,6 +2176,7 @@
+ 	/*Get inputs*/
+ 	Input* slopex_input=inputs->GetInput(BedSlopeXEnum); _assert_(slopex_input);
+ 	Input* slopey_input=inputs->GetInput(BedSlopeYEnum); _assert_(slopey_input);
++	Input* groundedicelevelset_input=inputs->GetInput(MaskGroundediceLevelsetEnum); _assert_(groundedicelevelset_input);
+ 
+ 	/*Loop over basal nodes and update their CS*/
+ 	GaussPenta* gauss = new GaussPenta();
+@@ -2184,13 +2185,25 @@
+ 
+ 		slopex_input->GetInputValue(&slopex,gauss);
+ 		slopey_input->GetInputValue(&slopey,gauss);
++		groundedicelevelset_input->GetInputValue(&groundedice,gauss);
+ 
+-		/*New X axis          New Z axis*/
+-		xz_plane[0]=1.;       xz_plane[3]=-slopex;  
+-		xz_plane[1]=0.;       xz_plane[4]=-slopey;  
+-		xz_plane[2]=slopex;   xz_plane[5]=1.;          
++		if(groundedice>0){
++			/*New X axis          New Z axis*/
++			xz_plane[0]=1.;       xz_plane[3]=-slopex;  
++			xz_plane[1]=0.;       xz_plane[4]=-slopey;  
++			xz_plane[2]=slopex;   xz_plane[5]=1.;          
++			this->nodes[indices[i]]->DofInSSet(2); //vz 
++		}
++		else{
++			/*New X axis          New Z axis*/
++			xz_plane[0]=1.;       xz_plane[3]=0;  
++			xz_plane[1]=0.;       xz_plane[4]=0;  
++			xz_plane[2]=0;        xz_plane[5]=1.;          
++			this->nodes[indices[i]]->DofInFSet(2); //vz
++		}
+ 
+ 		XZvectorsToCoordinateSystem(&this->nodes[indices[i]]->coord_system[0][0],&xz_plane[0]);
++		
+ 	}
+ 
+ 	/*cleanup*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17325-17326.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17325-17326.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17325-17326.diff	(revision 17802)
@@ -0,0 +1,21 @@
+Index: ../trunk-jpl/test/NightlyRun/test435.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test435.m	(revision 17325)
++++ ../trunk-jpl/test/NightlyRun/test435.m	(revision 17326)
+@@ -46,9 +46,9 @@
+ field_names     ={'Bed1','Surface1','Thickness1','Floatingice1','Vx1','Vy1','Vz1','Pressure1',...
+ 	'Bed2','Surface2','Thickness2','Floatingice2','Vx2','Vy2','Vz2','Pressure2',...
+ 	'Bed3','Surface3','Thickness3','Floatingice3','Vx3','Vy3','Vz3','Pressure3'};
+-field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+-	4e-12,2e-12,6e-12,2e-11,1e-13,1e-13,1e-13,1e-13,...
+-	1e-10,3e-11,1e-10,7e-11,1e-13,1e-13,1e-13,1e-13};
++field_tolerances={1e-11,1e-12,1e-11,1e-11,2e-10,1e-08,2e-10,1e-13,...
++	1e-11,3e-12,9e-12,2e-11,1e-09,1e-08,2e-10,1e-10,...
++	1e-10,3e-11,1e-10,7e-11,1e-09,1e-08,1e-09,1e-11};
+ field_values={...
+ 	(md.results.TransientSolution(1).Bed),...
+ 	(md.results.TransientSolution(1).Surface),...
+Index: ../trunk-jpl/test/Archives/Archive435.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17326-17327.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17326-17327.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17326-17327.diff	(revision 17802)
@@ -0,0 +1,32 @@
+Index: ../trunk-jpl/src/c/classes/kriging/Observations.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/kriging/Observations.cpp	(revision 17326)
++++ ../trunk-jpl/src/c/classes/kriging/Observations.cpp	(revision 17327)
+@@ -201,7 +201,7 @@
+ 	Observation *observation  = NULL;
+ 
+ 	/*If radius is not provided or is 0, return all observations*/
+-	if(radius==0.) radius=this->quadtree->root->length;
++	if(radius==0.) radius=this->quadtree->root->length*2.;
+ 
+ 	/*Compute radius square*/
+ 	radius2 = radius*radius;
+@@ -465,9 +465,6 @@
+ 	_assert_(maxdata>0);
+ 	_assert_(pprediction);
+ 
+-	/*If radius is not provided or is 0, return all observations*/
+-	if(radius==0) radius=this->quadtree->root->length;
+-
+ 	/*Get list of observations for current point*/
+ 	this->ObservationList(&x,&y,&obs,&n_obs,x_interp,y_interp,radius,maxdata);
+ 
+@@ -504,6 +501,8 @@
+ 				}
+ 				Green[i*n_obs+j] = Green[j*n_obs+i];
+ 			}
++			/*Zero diagonal (should be done already, but just in case)*/
++			Green[i*n_obs+i] = 0.;
+ 		}
+ 
+ 		/*Compute weights*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17327-17328.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17327-17328.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17327-17328.diff	(revision 17802)
@@ -0,0 +1,94 @@
+Index: ../trunk-jpl/src/c/toolkits/gsl/gslincludes.h
+===================================================================
+--- ../trunk-jpl/src/c/toolkits/gsl/gslincludes.h	(revision 17327)
++++ ../trunk-jpl/src/c/toolkits/gsl/gslincludes.h	(revision 17328)
+@@ -20,7 +20,8 @@
+ class Parameters;
+ 
+ void DenseGslSolve(IssmPDouble** pX,IssmPDouble* A,IssmPDouble* B, int n);
+-void DenseGslSolve(IssmDouble** px, IssmDouble* Kff,int Kff_M, int Kff_N, IssmDouble* pf, int pf_M, Parameters* parameters);
++void DenseGslSolve(IssmDouble** pX,IssmDouble* Kff,int Kff_M,int Kff_N,IssmDouble* pf,int pf_M,Parameters* parameters);
++void DenseGslTripleSolve(IssmPDouble** pX1,IssmPDouble** pX2,IssmPDouble** pX3,IssmPDouble* A,IssmPDouble* B1,IssmPDouble* B2,IssmPDouble* B3,int n);
+ 
+ void SolverxSeq(IssmPDouble *X, IssmPDouble *A, IssmPDouble *B,int n);
+ 
+Index: ../trunk-jpl/src/c/toolkits/gsl/DenseGslSolve.cpp
+===================================================================
+--- ../trunk-jpl/src/c/toolkits/gsl/DenseGslSolve.cpp	(revision 17327)
++++ ../trunk-jpl/src/c/toolkits/gsl/DenseGslSolve.cpp	(revision 17328)
+@@ -31,7 +31,7 @@
+ 	*pX=X;
+ }
+ /*}}}*/
+-void DenseGslSolve(/*output*/ IssmPDouble** px,/*stiffness matrix:*/ IssmPDouble* Kff, int Kff_M, int Kff_N, /*right hand side load vector: */ IssmPDouble* pf, int pf_M, Parameters* parameters){ /*{{{*/
++void DenseGslSolve(IssmPDouble** px,IssmPDouble* Kff,int Kff_M,int Kff_N,IssmPDouble* pf,int pf_M,Parameters* parameters){ /*{{{*/
+ 
+ 	/*Intermediary: */
+ 
+@@ -45,6 +45,48 @@
+ 	*px=x;
+ }
+ /*}}}*/
++void DenseGslTripleSolve(IssmPDouble** pX1,IssmPDouble** pX2,IssmPDouble** pX3,IssmPDouble* A,IssmPDouble* B1,IssmPDouble* B2,IssmPDouble* B3,int n){/*{{{*/
++
++	/*Allocate output: */
++	IssmPDouble *X1 = xNew<IssmPDouble>(n);
++	IssmPDouble *X2 = xNew<IssmPDouble>(n);
++	IssmPDouble *X3 = xNew<IssmPDouble>(n);
++
++#ifdef _HAVE_GSL_
++	/*GSL Matrices and vectors: */
++	int s;
++
++	double* Acopy = xNew<double>(n*n);
++	xMemCpy(Acopy,A,n*n);
++
++	/*Initialize gsl matrices and vectors: */
++	gsl_matrix_view a = gsl_matrix_view_array(Acopy,n,n);
++	gsl_vector_view b1= gsl_vector_view_array(B1,n);
++	gsl_vector_view b2= gsl_vector_view_array(B2,n);
++	gsl_vector_view b3= gsl_vector_view_array(B3,n);
++	gsl_vector_view x1= gsl_vector_view_array(X1,n);
++	gsl_vector_view x2= gsl_vector_view_array(X2,n);
++	gsl_vector_view x3= gsl_vector_view_array(X3,n);
++
++	/*Run LU and solve: */
++	gsl_permutation* p = gsl_permutation_alloc (n);
++	gsl_linalg_LU_decomp(&a.matrix,p,&s);
++
++	gsl_linalg_LU_solve(&a.matrix,p,&b1.vector,&x1.vector);
++	gsl_linalg_LU_solve(&a.matrix,p,&b2.vector,&x2.vector);
++	gsl_linalg_LU_solve(&a.matrix,p,&b3.vector,&x3.vector);
++
++	/*Clean up and assign output pointer*/
++	xDelete(Acopy);
++	gsl_permutation_free(p);
++#endif
++
++	/*allocate output pointers: */
++	*pX1=X1;
++	*pX2=X2;
++	*pX3=X3;
++}
++/*}}}*/
+ void SolverxSeq(IssmPDouble *X, IssmPDouble *A, IssmPDouble *B,int n){ /*{{{*/
+ #ifdef _HAVE_GSL_
+ 	/*GSL Matrices and vectors: */
+Index: ../trunk-jpl/src/c/classes/kriging/Observations.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/kriging/Observations.cpp	(revision 17327)
++++ ../trunk-jpl/src/c/classes/kriging/Observations.cpp	(revision 17328)
+@@ -400,9 +400,10 @@
+ 
+ 	/*Solve the three linear systems*/
+ #if _HAVE_GSL_
+-	DenseGslSolve(&GinvG0,Gamma,gamma0,n_obs); // Gamma^-1 gamma0
+-	DenseGslSolve(&Ginv1, Gamma,ones,n_obs);   // Gamma^-1 ones
+-	DenseGslSolve(&GinvZ, Gamma,obs,n_obs);    // Gamma^-1 Z
++	DenseGslTripleSolve(&GinvG0,&Ginv1,&GinvZ,Gamma,Gamma,ones,obs,n_obs);
++	//DenseGslSolve(&GinvG0,Gamma,gamma0,n_obs); // Gamma^-1 gamma0
++	//DenseGslSolve(&Ginv1, Gamma,ones,n_obs);   // Gamma^-1 ones
++	//DenseGslSolve(&GinvZ, Gamma,obs,n_obs);    // Gamma^-1 Z
+ #else
+ 	_error_("GSL is required");
+ #endif
Index: issm/oecreview/Archive/16554-17801/ISSM-17328-17329.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17328-17329.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17328-17329.diff	(revision 17802)
@@ -0,0 +1,53 @@
+Index: ../trunk-jpl/src/c/classes/kriging/Observations.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/kriging/Observations.cpp	(revision 17328)
++++ ../trunk-jpl/src/c/classes/kriging/Observations.cpp	(revision 17329)
+@@ -157,17 +157,16 @@
+ 	}  
+ 
+ 	/*Assign output pointer*/
+-	if(index>=0){
++	if(nobs || hmin==radius){
+ 		observation=dynamic_cast<Observation*>(this->GetObjectByOffset(index));
+-		*px=observation->x;
+-		*py=observation->y;
+-		*pobs=observation->value;
++		*px   = observation->x;
++		*py   = observation->y;
++		*pobs = observation->value;
+ 	}
+ 	else{
+-
+-		*px=UNDEF;
+-		*py=UNDEF;
+-		*pobs=UNDEF;
++		*px   = UNDEF;
++		*py   = UNDEF;
++		*pobs = UNDEF;
+ 	}
+ 	xDelete<int>(indices);
+ 
+@@ -179,10 +178,12 @@
+ 
+ 	for(int i=0;i<n;i++){
+ 		this->ClosestObservation(&xi,&yi,&obs,x[i],y[i],radius);
+-		if(xi==UNDEF && yi==UNDEF)
++		if(xi==UNDEF && yi==UNDEF){
+ 		 distances[i]=UNDEF;
+-		else
++		}
++		else{
+ 		 distances[i]=sqrt( (x[i]-xi)*(x[i]-xi) + (y[i]-yi)*(y[i]-yi) );
++		}
+ 	}
+ }/*}}}*/
+ /*FUNCTION Observations::ObservationList(IssmPDouble **px,IssmPDouble **py,IssmPDouble **pobs,int* pnobs,IssmPDouble x_interp,IssmPDouble y_interp,IssmPDouble radius,int maxdata){{{*/
+@@ -400,7 +401,7 @@
+ 
+ 	/*Solve the three linear systems*/
+ #if _HAVE_GSL_
+-	DenseGslTripleSolve(&GinvG0,&Ginv1,&GinvZ,Gamma,Gamma,ones,obs,n_obs);
++	DenseGslTripleSolve(&GinvG0,&Ginv1,&GinvZ,Gamma,gamma0,ones,obs,n_obs);
+ 	//DenseGslSolve(&GinvG0,Gamma,gamma0,n_obs); // Gamma^-1 gamma0
+ 	//DenseGslSolve(&Ginv1, Gamma,ones,n_obs);   // Gamma^-1 ones
+ 	//DenseGslSolve(&GinvZ, Gamma,obs,n_obs);    // Gamma^-1 Z
Index: issm/oecreview/Archive/16554-17801/ISSM-17329-17330.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17329-17330.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17329-17330.diff	(revision 17802)
@@ -0,0 +1,316 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17329)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17330)
+@@ -2898,6 +2898,7 @@
+ 	/*Recover portion of element that is grounded*/
+ 	if(migration_style==SubelementMigrationEnum) phi=element->GetGroundedPortion(xyz_list_base);
+ 	if(migration_style==SubelementMigration2Enum){
++		if(meshtype==Mesh2DverticalEnum) _error_("Subelement Migration 2 not implemented yet for Flowline");
+ 		gllevelset_input=element->GetInput(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input);
+ 		element->GetGroundedPart(&point1,&fraction1,&fraction2,&mainlyfloating);
+ 		//gauss = element->NewGauss(point1,fraction1,fraction2,mainlyfloating,2);
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17329)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17330)
+@@ -65,6 +65,7 @@
+ 		Input*     GetInput(int inputenum);
+ 		void       GetInputListOnNodes(IssmDouble* pvalue,int enumtype);
+ 		void       GetInputListOnNodes(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue);
++		void       GetInputListOnNodesVelocity(IssmDouble* pvalue,int enumtype);
+ 		void       GetInputListOnVertices(IssmDouble* pvalue,int enumtype);
+ 		void       GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue);
+ 		IssmDouble GetMaterialParameter(int enum_in);
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17329)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17330)
+@@ -572,12 +572,14 @@
+ 	/*Computeportion of the element that is grounded*/ 
+ 
+ 	bool              mainlyfloating = true;
++	int               meshtype,index1,index2;
+ 	const IssmPDouble epsilon        = 1.e-15;
+-	IssmDouble         phi,s1,s2,area_init,area_grounded;
+-	IssmDouble         gl[NUMVERTICES];
+-	IssmDouble         xyz_bis[3][3];
++	IssmDouble        phi,s1,s2,area_init,area_grounded;
++	IssmDouble        gl[NUMVERTICES];
++	IssmDouble        xyz_bis[3][3];
+ 
+ 	/*Recover parameters and values*/
++	parameters->FindParam(&meshtype,MeshTypeEnum);
+ 	GetInputListOnVertices(&gl[0],MaskGroundediceLevelsetEnum);
+ 
+ 	/*Be sure that values are not zero*/
+@@ -585,84 +587,99 @@
+ 	if(gl[1]==0.) gl[1]=gl[1]+epsilon;
+ 	if(gl[2]==0.) gl[2]=gl[2]+epsilon;
+ 
+-	/*Check that not all nodes are grounded or floating*/
+-	if(gl[0]>0 && gl[1]>0 && gl[2]>0){ // All grounded
+-		phi=1;
++	if(meshtype==Mesh2DverticalEnum){
++		this->EdgeOnBedIndices(&index1,&index2);
++		if(gl[index1]>0 && gl[index2]>0) phi=1; // All grounded
++		else if(gl[index1]<0 && gl[index2]<0) phi=0; // All floating
++		else if(gl[index1]<0 && gl[index2]>0){ //index2 grounded
++			phi=1./(1.-gl[index1]/gl[index2]);
++		}
++		else if(gl[index2]<0 && gl[index1]>0){ //index1 grounded
++			phi=1./(1.-gl[index2]/gl[index1]);
++		}
++
+ 	}
+-	else if(gl[0]<0 && gl[1]<0 && gl[2]<0){ //All floating
+-		phi=0;
+-	}
+-	else{
+-		/*Figure out if two nodes are floating or grounded*/
+-		if(gl[0]*gl[1]*gl[2]>0) mainlyfloating=false;
++	else if(meshtype==Mesh3DEnum){
++		/*Check that not all nodes are grounded or floating*/
++		if(gl[0]>0 && gl[1]>0 && gl[2]>0){ // All grounded
++			phi=1;
++		}
++		else if(gl[0]<0 && gl[1]<0 && gl[2]<0){ //All floating
++			phi=0;
++		}
++		else{
++			/*Figure out if two nodes are floating or grounded*/
++			if(gl[0]*gl[1]*gl[2]>0) mainlyfloating=false;
+ 
+-		if(gl[0]*gl[1]>0){ //Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2
+-			/*Coordinates of point 2: same as initial point 2*/
+-			xyz_bis[2][0]=*(xyz_list+3*2+0);
+-			xyz_bis[2][1]=*(xyz_list+3*2+1);
+-			xyz_bis[2][2]=*(xyz_list+3*2+2);
++			if(gl[0]*gl[1]>0){ //Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2
++				/*Coordinates of point 2: same as initial point 2*/
++				xyz_bis[2][0]=*(xyz_list+3*2+0);
++				xyz_bis[2][1]=*(xyz_list+3*2+1);
++				xyz_bis[2][2]=*(xyz_list+3*2+2);
+ 
+-			/*Portion of the segments*/
+-			s1=gl[2]/(gl[2]-gl[1]);
+-			s2=gl[2]/(gl[2]-gl[0]);
++				/*Portion of the segments*/
++				s1=gl[2]/(gl[2]-gl[1]);
++				s2=gl[2]/(gl[2]-gl[0]);
+ 
+-			/*New point 1*/
+-			xyz_bis[1][0]=*(xyz_list+3*2+0)+s1*(*(xyz_list+3*1+0)-*(xyz_list+3*2+0));
+-			xyz_bis[1][1]=*(xyz_list+3*2+1)+s1*(*(xyz_list+3*1+1)-*(xyz_list+3*2+1));
+-			xyz_bis[1][2]=*(xyz_list+3*2+2)+s1*(*(xyz_list+3*1+2)-*(xyz_list+3*2+2));
++				/*New point 1*/
++				xyz_bis[1][0]=*(xyz_list+3*2+0)+s1*(*(xyz_list+3*1+0)-*(xyz_list+3*2+0));
++				xyz_bis[1][1]=*(xyz_list+3*2+1)+s1*(*(xyz_list+3*1+1)-*(xyz_list+3*2+1));
++				xyz_bis[1][2]=*(xyz_list+3*2+2)+s1*(*(xyz_list+3*1+2)-*(xyz_list+3*2+2));
+ 
+-			/*New point 0*/
+-			xyz_bis[0][0]=*(xyz_list+3*2+0)+s2*(*(xyz_list+3*0+0)-*(xyz_list+3*2+0));
+-			xyz_bis[0][1]=*(xyz_list+3*2+1)+s2*(*(xyz_list+3*0+1)-*(xyz_list+3*2+1));
+-			xyz_bis[0][2]=*(xyz_list+3*2+2)+s2*(*(xyz_list+3*0+2)-*(xyz_list+3*2+2));
+-		}
+-		else if(gl[1]*gl[2]>0){ //Nodes 1 and 2 are similar, so points must be found on segment 0-1 and 0-2
+-			/*Coordinates of point 0: same as initial point 2*/
+-			xyz_bis[0][0]=*(xyz_list+3*0+0);
+-			xyz_bis[0][1]=*(xyz_list+3*0+1);
+-			xyz_bis[0][2]=*(xyz_list+3*0+2);
++				/*New point 0*/
++				xyz_bis[0][0]=*(xyz_list+3*2+0)+s2*(*(xyz_list+3*0+0)-*(xyz_list+3*2+0));
++				xyz_bis[0][1]=*(xyz_list+3*2+1)+s2*(*(xyz_list+3*0+1)-*(xyz_list+3*2+1));
++				xyz_bis[0][2]=*(xyz_list+3*2+2)+s2*(*(xyz_list+3*0+2)-*(xyz_list+3*2+2));
++			}
++			else if(gl[1]*gl[2]>0){ //Nodes 1 and 2 are similar, so points must be found on segment 0-1 and 0-2
++				/*Coordinates of point 0: same as initial point 2*/
++				xyz_bis[0][0]=*(xyz_list+3*0+0);
++				xyz_bis[0][1]=*(xyz_list+3*0+1);
++				xyz_bis[0][2]=*(xyz_list+3*0+2);
+ 
+-			/*Portion of the segments*/
+-			s1=gl[0]/(gl[0]-gl[1]);
+-			s2=gl[0]/(gl[0]-gl[2]);
++				/*Portion of the segments*/
++				s1=gl[0]/(gl[0]-gl[1]);
++				s2=gl[0]/(gl[0]-gl[2]);
+ 
+-			/*New point 1*/
+-			xyz_bis[1][0]=*(xyz_list+3*0+0)+s1*(*(xyz_list+3*1+0)-*(xyz_list+3*0+0));
+-			xyz_bis[1][1]=*(xyz_list+3*0+1)+s1*(*(xyz_list+3*1+1)-*(xyz_list+3*0+1));
+-			xyz_bis[1][2]=*(xyz_list+3*0+2)+s1*(*(xyz_list+3*1+2)-*(xyz_list+3*0+2));
++				/*New point 1*/
++				xyz_bis[1][0]=*(xyz_list+3*0+0)+s1*(*(xyz_list+3*1+0)-*(xyz_list+3*0+0));
++				xyz_bis[1][1]=*(xyz_list+3*0+1)+s1*(*(xyz_list+3*1+1)-*(xyz_list+3*0+1));
++				xyz_bis[1][2]=*(xyz_list+3*0+2)+s1*(*(xyz_list+3*1+2)-*(xyz_list+3*0+2));
+ 
+-			/*New point 2*/
+-			xyz_bis[2][0]=*(xyz_list+3*0+0)+s2*(*(xyz_list+3*2+0)-*(xyz_list+3*0+0));
+-			xyz_bis[2][1]=*(xyz_list+3*0+1)+s2*(*(xyz_list+3*2+1)-*(xyz_list+3*0+1));
+-			xyz_bis[2][2]=*(xyz_list+3*0+2)+s2*(*(xyz_list+3*2+2)-*(xyz_list+3*0+2));
+-		}
+-		else if(gl[0]*gl[2]>0){ //Nodes 0 and 2 are similar, so points must be found on segment 1-0 and 1-2
+-			/*Coordinates of point 1: same as initial point 2*/
+-			xyz_bis[1][0]=*(xyz_list+3*1+0);
+-			xyz_bis[1][1]=*(xyz_list+3*1+1);
+-			xyz_bis[1][2]=*(xyz_list+3*1+2);
++				/*New point 2*/
++				xyz_bis[2][0]=*(xyz_list+3*0+0)+s2*(*(xyz_list+3*2+0)-*(xyz_list+3*0+0));
++				xyz_bis[2][1]=*(xyz_list+3*0+1)+s2*(*(xyz_list+3*2+1)-*(xyz_list+3*0+1));
++				xyz_bis[2][2]=*(xyz_list+3*0+2)+s2*(*(xyz_list+3*2+2)-*(xyz_list+3*0+2));
++			}
++			else if(gl[0]*gl[2]>0){ //Nodes 0 and 2 are similar, so points must be found on segment 1-0 and 1-2
++				/*Coordinates of point 1: same as initial point 2*/
++				xyz_bis[1][0]=*(xyz_list+3*1+0);
++				xyz_bis[1][1]=*(xyz_list+3*1+1);
++				xyz_bis[1][2]=*(xyz_list+3*1+2);
+ 
+-			/*Portion of the segments*/
+-			s1=gl[1]/(gl[1]-gl[0]);
+-			s2=gl[1]/(gl[1]-gl[2]);
++				/*Portion of the segments*/
++				s1=gl[1]/(gl[1]-gl[0]);
++				s2=gl[1]/(gl[1]-gl[2]);
+ 
+-			/*New point 0*/
+-			xyz_bis[0][0]=*(xyz_list+3*1+0)+s1*(*(xyz_list+3*0+0)-*(xyz_list+3*1+0));
+-			xyz_bis[0][1]=*(xyz_list+3*1+1)+s1*(*(xyz_list+3*0+1)-*(xyz_list+3*1+1));
+-			xyz_bis[0][2]=*(xyz_list+3*1+2)+s1*(*(xyz_list+3*0+2)-*(xyz_list+3*1+2));
++				/*New point 0*/
++				xyz_bis[0][0]=*(xyz_list+3*1+0)+s1*(*(xyz_list+3*0+0)-*(xyz_list+3*1+0));
++				xyz_bis[0][1]=*(xyz_list+3*1+1)+s1*(*(xyz_list+3*0+1)-*(xyz_list+3*1+1));
++				xyz_bis[0][2]=*(xyz_list+3*1+2)+s1*(*(xyz_list+3*0+2)-*(xyz_list+3*1+2));
+ 
+-			/*New point 2*/
+-			xyz_bis[2][0]=*(xyz_list+3*1+0)+s2*(*(xyz_list+3*2+0)-*(xyz_list+3*1+0));
+-			xyz_bis[2][1]=*(xyz_list+3*1+1)+s2*(*(xyz_list+3*2+1)-*(xyz_list+3*1+1));
+-			xyz_bis[2][2]=*(xyz_list+3*1+2)+s2*(*(xyz_list+3*2+2)-*(xyz_list+3*1+2));
++				/*New point 2*/
++				xyz_bis[2][0]=*(xyz_list+3*1+0)+s2*(*(xyz_list+3*2+0)-*(xyz_list+3*1+0));
++				xyz_bis[2][1]=*(xyz_list+3*1+1)+s2*(*(xyz_list+3*2+1)-*(xyz_list+3*1+1));
++				xyz_bis[2][2]=*(xyz_list+3*1+2)+s2*(*(xyz_list+3*2+2)-*(xyz_list+3*1+2));
++			}
++
++			/*Compute fraction of grounded element*/
++			GetJacobianDeterminant(&area_init, xyz_list,NULL);
++			GetJacobianDeterminant(&area_grounded, &xyz_bis[0][0],NULL);
++			if(mainlyfloating==true) area_grounded=area_init-area_grounded;
++			phi=area_grounded/area_init;
+ 		}
+-
+-		/*Compute fraction of grounded element*/
+-		GetJacobianDeterminant(&area_init, xyz_list,NULL);
+-		GetJacobianDeterminant(&area_grounded, &xyz_bis[0][0],NULL);
+-		if(mainlyfloating==true) area_grounded=area_init-area_grounded;
+-		phi=area_grounded/area_init;
+ 	}
++	else _error_("mesh type "<<EnumToStringx(meshtype)<<"not supported yet ");
+ 
+ 	if(phi>1 || phi<0) _error_("Error. Problem with portion of grounded element: value should be between 0 and 1");
+ 
+@@ -1938,41 +1955,55 @@
+ /*FUNCTION Tria::ResetFSBasalBoundaryCondition{{{*/
+ void  Tria::ResetFSBasalBoundaryCondition(void){
+ 
+-	int        approximation;
+-	int        numindices;
+-	int       *indices = NULL;
+-	IssmDouble slope;
+-	IssmDouble xz_plane[6];
++	int numnodes = this->GetNumberOfNodes();
+ 
++	int          approximation;
++	IssmDouble*  vertexonbed= NULL;
++	IssmDouble   slope,groundedice;
++	IssmDouble   xz_plane[6];
++
+ 	/*For FS only: we want the CS to be tangential to the bedrock*/
+ 	inputs->GetInputValue(&approximation,ApproximationEnum);
+-	if(IsFloating() || !HasEdgeOnBed() || approximation!=FSApproximationEnum) return;
++	if(IsFloating() || !HasNodeOnBed() ||  approximation!=FSApproximationEnum) return;
+ 
+-	/*Get number of nodes for velocity only and base*/
+-	int index = this->EdgeOnBedIndex();
+-	NodeOnEdgeIndices(&numindices,&indices,index,this->VelocityInterpolation());
+-
++	//printf("element number %i \n",this->id);
+ 	/*Get inputs*/
+-	Input* slope_input=inputs->GetInput(BedSlopeXEnum); _assert_(slope_input);
++	Input* slope_input=inputs->GetInput(BedSlopeXEnum);                             _assert_(slope_input);
++	Input* groundedicelevelset_input=inputs->GetInput(MaskGroundediceLevelsetEnum); _assert_(groundedicelevelset_input);
++	vertexonbed = xNew<IssmDouble>(numnodes);
++	this->GetInputListOnNodesVelocity(&vertexonbed[0],MeshVertexonbedEnum);
+ 
+ 	/*Loop over basal nodes and update their CS*/
+ 	GaussTria* gauss = new GaussTria();
+-	for(int i=0;i<numindices;i++){//FIXME
++	for(int i=0;i<this->NumberofNodesVelocity();i++){
+ 
+-		gauss->GaussNode(this->VelocityInterpolation(),indices[i]);
+-		slope_input->GetInputValue(&slope,gauss);
+-		IssmDouble theta = atan(slope);
++		if(vertexonbed[i]==1){
++			gauss->GaussNode(this->VelocityInterpolation(),i);
++			slope_input->GetInputValue(&slope,gauss);
++			groundedicelevelset_input->GetInputValue(&groundedice,gauss);
++			IssmDouble theta = atan(slope);
+ 
+-		/*New X axis                  New Z axis*/
+-		xz_plane[0]=cos(theta);       xz_plane[3]=0.;  
+-		xz_plane[1]=sin(theta);       xz_plane[4]=0.;  
+-		xz_plane[2]=0.;               xz_plane[5]=1.;          
++			if(groundedice>0){
++				/*New X axis                  New Z axis*/
++				xz_plane[0]=cos(theta);       xz_plane[3]=0.;  
++				xz_plane[1]=sin(theta);       xz_plane[4]=0.;  
++				xz_plane[2]=0.;               xz_plane[5]=1.;          
++				this->nodes[i]->DofInSSet(1); //vy
++			}
++			else{
++				/*New X axis                  New Z axis*/
++				xz_plane[0]=1.;               xz_plane[3]=0;  
++				xz_plane[1]=0.;               xz_plane[4]=0;  
++				xz_plane[2]=0;                xz_plane[5]=1.;          
++				this->nodes[i]->DofInFSet(1); //vy
++			}
+ 
+-		XZvectorsToCoordinateSystem(&this->nodes[indices[i]]->coord_system[0][0],&xz_plane[0]);
++			XZvectorsToCoordinateSystem(&this->nodes[i]->coord_system[0][0],&xz_plane[0]);
++		}
+ 	}
+ 
+ 	/*cleanup*/
+-	xDelete<int>(indices);
++	xDelete<IssmDouble>(vertexonbed);
+ 	delete gauss;
+ }
+ /*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17329)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17330)
+@@ -351,6 +351,23 @@
+ 	delete gauss;
+ }
+ /*}}}*/
++void Element::GetInputListOnNodesVelocity(IssmDouble* pvalue,int enumtype){/*{{{*/
++
++	_assert_(pvalue);
++
++	int    numnodes = this->GetNumberOfNodesVelocity();
++	Input *input    = this->GetInput(enumtype);
++	if(!input) _error_("Input " << EnumToStringx(enumtype) << " not found in element");
++
++	/* Start looping on the number of vertices: */
++	Gauss* gauss=this->NewGauss();
++	for(int iv=0;iv<numnodes;iv++){
++		gauss->GaussNode(this->VelocityInterpolation(),iv);
++		input->GetInputValue(&pvalue[iv],gauss);
++	}
++	delete gauss;
++}
++/*}}}*/
+ void Element::GetVerticesSidList(int* sidlist){/*{{{*/
+ 
+ 	int numvertices = this->GetNumberOfVertices();
Index: issm/oecreview/Archive/16554-17801/ISSM-17330-17331.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17330-17331.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17330-17331.diff	(revision 17802)
@@ -0,0 +1,235 @@
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h	(revision 17330)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h	(revision 17331)
+@@ -29,8 +29,8 @@
+ 		ElementVector* CreatePVector(Element* element);
+ 		ElementVector* CreatePVectorCG(Element* element);
+ 		ElementVector* CreatePVectorDG(Element* element);
+-		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+-		void GetBprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBprime(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ 		void UpdateConstraints(FemModel* femmodel);
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17330)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17331)
+@@ -260,21 +260,30 @@
+ 
+ 	/*Intermediaries */
+ 	int        stabilization;
+-	int        meshtype;
++	int        meshtype,dim;
+ 	IssmDouble Jdet,D_scalar,dt,h;
+ 	IssmDouble vel,vx,vy,dvxdx,dvydy;
+ 	IssmDouble dvx[2],dvy[2];
+ 	IssmDouble* xyz_list = NULL;
+ 
++	/*Get problem dimension*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum:   dim = 1; break;
++		case Mesh2DhorizontalEnum: dim = 2; break;
++		case Mesh3DEnum:           dim = 2; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+ 
+ 	/*Initialize Element vector and other vectors*/
+ 	ElementMatrix* Ke     = element->NewElementMatrix();
+ 	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+-	IssmDouble*    B      = xNew<IssmDouble>(2*numnodes);
+-	IssmDouble*    Bprime = xNew<IssmDouble>(2*numnodes);
+-	IssmDouble     D[2][2]={0.};
++	IssmDouble*    B      = xNew<IssmDouble>(dim*numnodes);
++	IssmDouble*    Bprime = xNew<IssmDouble>(dim*numnodes);
++	IssmDouble*    D      = xNewZeroInit<IssmDouble>(dim*dim);
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+@@ -289,7 +298,8 @@
+ 	}
+ 	else{
+ 		vxaverage_input=element->GetInput(VxAverageEnum); _assert_(vxaverage_input);
+-		vyaverage_input=element->GetInput(VyAverageEnum); _assert_(vyaverage_input);
++		if(dim==2) vyaverage_input=element->GetInput(VyAverageEnum); _assert_(vyaverage_input);
++
+ 	}
+ 	h = element->CharacteristicLength();
+ 
+@@ -302,9 +312,11 @@
+ 		element->NodalFunctions(basis,gauss);
+ 
+ 		vxaverage_input->GetInputValue(&vx,gauss);
+-		vyaverage_input->GetInputValue(&vy,gauss);
+ 		vxaverage_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
+-		vyaverage_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
++		if(dim==2){
++			vyaverage_input->GetInputValue(&vy,gauss);
++			vyaverage_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
++		}
+ 
+ 		D_scalar=gauss->weight*Jdet;
+ 		TripleMultiply(basis,1,numnodes,1,
+@@ -312,50 +324,62 @@
+ 					basis,1,numnodes,0,
+ 					&Ke->values[0],1);
+ 
+-		GetB(B,element,xyz_list,gauss);
+-		GetBprime(Bprime,element,xyz_list,gauss);
++		GetB(B,element,dim,xyz_list,gauss);
++		GetBprime(Bprime,element,dim,xyz_list,gauss);
+ 
+ 		dvxdx=dvx[0];
+-		dvydy=dvy[1];
++		if(dim==2) dvydy=dvy[1];
+ 		D_scalar=dt*gauss->weight*Jdet;
+ 
+-		D[0][0]=D_scalar*dvxdx;
+-		D[1][1]=D_scalar*dvydy;
+-		TripleMultiply(B,2,numnodes,1,
+-					&D[0][0],2,2,0,
+-					B,2,numnodes,0,
++		D[0*dim+0]=D_scalar*dvxdx;
++		if(dim==2) D[1*dim+1]=D_scalar*dvydy;
++
++		TripleMultiply(B,dim,numnodes,1,
++					D,dim,dim,0,
++					B,dim,numnodes,0,
+ 					&Ke->values[0],1);
+ 
+-		D[0][0]=D_scalar*vx;
+-		D[1][1]=D_scalar*vy;
+-		TripleMultiply(B,2,numnodes,1,
+-					&D[0][0],2,2,0,
+-					Bprime,2,numnodes,0,
++		D[0*dim+0]=D_scalar*vx;
++		if(dim==2) D[1*dim+1]=D_scalar*vy;
++
++		TripleMultiply(B,dim,numnodes,1,
++					D,dim,dim,0,
++					Bprime,dim,numnodes,0,
+ 					&Ke->values[0],1);
+ 
+ 		if(stabilization==2){
+-			/*Streamline upwinding*/
+-			vel=sqrt(vx*vx+vy*vy)+1.e-8;
+-			D[0][0]=h/(2*vel)*vx*vx;
+-			D[1][0]=h/(2*vel)*vy*vx;
+-			D[0][1]=h/(2*vel)*vx*vy;
+-			D[1][1]=h/(2*vel)*vy*vy;
++			if(dim==1){
++				vel=fabs(vx)+1.e-8;
++				D[0]=h/(2*vel)*vx*vx;
++			}
++			else{
++				/*Streamline upwinding*/
++				vel=sqrt(vx*vx+vy*vy)+1.e-8;
++				D[0*dim+0]=h/(2*vel)*vx*vx;
++				D[1*dim+0]=h/(2*vel)*vy*vx;
++				D[0*dim+1]=h/(2*vel)*vx*vy;
++				D[1*dim+1]=h/(2*vel)*vy*vy;
++			}
+ 		}
+ 		else if(stabilization==1){
+ 			/*SSA*/
+ 			vxaverage_input->GetInputAverage(&vx);
+-			vyaverage_input->GetInputAverage(&vy);
+-			D[0][0]=h/2.0*fabs(vx);
+-			D[1][1]=h/2.0*fabs(vy);
++			if(dim==2) vyaverage_input->GetInputAverage(&vy);
++			D[0*dim+0]=h/2.0*fabs(vx);
++			if(dim==2) D[1*dim+1]=h/2.0*fabs(vy);
+ 		}
+ 		if(stabilization==1 || stabilization==2){
+-			D[0][0]=D_scalar*D[0][0];
+-			D[1][0]=D_scalar*D[1][0];
+-			D[0][1]=D_scalar*D[0][1];
+-			D[1][1]=D_scalar*D[1][1];
+-			TripleMultiply(Bprime,2,numnodes,1,
+-						&D[0][0],2,2,0,
+-						Bprime,2,numnodes,0,
++			if(dim==1) D[0]=D_scalar*D[0];
++			else{
++				D[0*dim+0]=D_scalar*D[0*dim+0];
++				D[1*dim+0]=D_scalar*D[1*dim+0];
++				D[0*dim+1]=D_scalar*D[0*dim+1];
++				D[1*dim+1]=D_scalar*D[1*dim+1];
++			}
++
++			TripleMultiply(Bprime,dim,numnodes,1,
++						D,dim,dim,0,
++						Bprime,dim,numnodes,0,
+ 						&Ke->values[0],1);
+ 		}
+ 	}
+@@ -365,6 +389,7 @@
+ 	xDelete<IssmDouble>(basis);
+ 	xDelete<IssmDouble>(B);
+ 	xDelete<IssmDouble>(Bprime);
++	xDelete<IssmDouble>(D);
+ 	delete gauss;
+ 	return Ke;
+ }/*}}}*/
+@@ -421,8 +446,8 @@
+ 					&Ke->values[0],1);
+ 
+ 		/*WARNING: B and Bprime are inverted compared to CG*/
+-		GetB(Bprime,element,xyz_list,gauss);
+-		GetBprime(B,element,xyz_list,gauss);
++		GetB(Bprime,element,2,xyz_list,gauss);
++		GetBprime(B,element,2,xyz_list,gauss);
+ 
+ 		D_scalar = - dt*gauss->weight*Jdet;
+ 		D[0][0]  = D_scalar*vx;
+@@ -567,7 +592,7 @@
+ 	delete gauss;
+ 	return pe;
+ }/*}}}*/
+-void MasstransportAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++void MasstransportAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
+ 	 * by: 
+@@ -587,14 +612,15 @@
+ 
+ 	/*Build B: */
+ 	for(int i=0;i<numnodes;i++){
+-		B[numnodes*0+i] = basis[i];
+-		B[numnodes*1+i] = basis[i];
++		for(int j=0;j<dim;j++){
++			B[numnodes*j+i] = basis[i];
++		}
+ 	}
+ 
+ 	/*Clean-up*/
+ 	xDelete<IssmDouble>(basis);
+ }/*}}}*/
+-void MasstransportAnalysis::GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++void MasstransportAnalysis::GetBprime(IssmDouble* Bprime,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 
+ 	 * For node i, Bi' can be expressed in the actual coordinate system
+ 	 * by: 
+@@ -609,13 +635,14 @@
+ 	int numnodes = element->GetNumberOfNodes();
+ 
+ 	/*Get nodal functions derivatives*/
+-	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	IssmDouble* dbasis=xNew<IssmDouble>(dim*numnodes);
+ 	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+ 
+ 	/*Build B': */
+ 	for(int i=0;i<numnodes;i++){
+-		Bprime[numnodes*0+i] = dbasis[0*numnodes+i];
+-		Bprime[numnodes*1+i] = dbasis[1*numnodes+i];
++		for(int j=0;j<dim;j++){
++			Bprime[numnodes*j+i] = dbasis[j*numnodes+i];
++		}
+ 	}
+ 
+ 	/*Clean-up*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17331-17332.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17331-17332.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17331-17332.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17331)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17332)
+@@ -599,7 +599,7 @@
+ 		}
+ 
+ 	}
+-	else if(meshtype==Mesh3DEnum){
++	else if(meshtype==Mesh2DhorizontalEnum){
+ 		/*Check that not all nodes are grounded or floating*/
+ 		if(gl[0]>0 && gl[1]>0 && gl[2]>0){ // All grounded
+ 			phi=1;
Index: issm/oecreview/Archive/16554-17801/ISSM-17332-17333.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17332-17333.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17332-17333.diff	(revision 17802)
@@ -0,0 +1,39 @@
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17332)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17333)
+@@ -297,8 +297,13 @@
+ 		vyaverage_input=element->GetInput(VyEnum); _assert_(vyaverage_input);
+ 	}
+ 	else{
+-		vxaverage_input=element->GetInput(VxAverageEnum); _assert_(vxaverage_input);
+-		if(dim==2) vyaverage_input=element->GetInput(VyAverageEnum); _assert_(vyaverage_input);
++		if(dim==1){
++			vxaverage_input=element->GetInput(VxEnum); _assert_(vxaverage_input);
++		}
++		if(dim==2){
++			vxaverage_input=element->GetInput(VxAverageEnum); _assert_(vxaverage_input);
++			vyaverage_input=element->GetInput(VyAverageEnum); _assert_(vyaverage_input);
++		}
+ 
+ 	}
+ 	h = element->CharacteristicLength();
+Index: ../trunk-jpl/src/c/cores/masstransport_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/masstransport_core.cpp	(revision 17332)
++++ ../trunk-jpl/src/c/cores/masstransport_core.cpp	(revision 17333)
+@@ -61,6 +61,14 @@
+ 	else{
+ 		if(VerboseSolution()) _printf0_("   call computational core\n");
+ 		solutionsequence_linear(femmodel);
++		if(meshtype!=Mesh2DhorizontalEnum){
++			femmodel->parameters->SetParam(ThicknessEnum,InputToExtrudeEnum);
++			extrudefrombase_core(femmodel);
++			femmodel->parameters->SetParam(BedEnum,InputToExtrudeEnum);
++			extrudefrombase_core(femmodel);
++			femmodel->parameters->SetParam(SurfaceEnum,InputToExtrudeEnum);
++			extrudefrombase_core(femmodel);
++		}
+ 	}
+ 
+ 	if(save_results){
Index: issm/oecreview/Archive/16554-17801/ISSM-17333-17334.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17333-17334.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17333-17334.diff	(revision 17802)
@@ -0,0 +1,444 @@
+Index: ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp	(revision 17333)
++++ ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp	(revision 17334)
+@@ -4,6 +4,8 @@
+ #include "../shared/shared.h"
+ #include "../modules/modules.h"
+ 
++#include "../modules/GetVectorFromInputsx/GetVectorFromInputsx.h"
++
+ /*Model processing*/
+ int  LsfReinitializationAnalysis::DofsPerNode(int** doflist,int meshtype,int approximation){/*{{{*/
+ 	return 1;
+@@ -12,10 +14,24 @@
+ 	/* Do nothing for now */
+ }/*}}}*/
+ void LsfReinitializationAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+-	/* Do nothing for now */
++	int    finiteelement;
++
++	/*Finite element type*/
++	finiteelement = P1Enum;
++
++	/*Update elements: */
++	int counter=0;
++	for(int i=0;i<iomodel->numberofelements;i++){
++		if(iomodel->my_elements[i]){
++			Element* element=(Element*)elements->GetObjectByOffset(counter);
++			element->Update(i,iomodel,analysis_counter,analysis_type,finiteelement);
++			counter++;
++		}
++	}
+ }/*}}}*/
+ void LsfReinitializationAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+-	/* Do nothing for now */
++	int finiteelement=P1Enum;
++	::CreateNodes(nodes,iomodel,LsfReinitializationAnalysisEnum,finiteelement);
+ }/*}}}*/
+ void LsfReinitializationAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ 	/* Do nothing for now */
+@@ -25,21 +41,158 @@
+ }/*}}}*/
+ 
+ /*Finite element Analysis*/
+-void           LsfReinitializationAnalysis::Core(FemModel* femmodel){/*{{{*/
+-	_error_("not implemented yet");
++void  LsfReinitializationAnalysis::Core(FemModel* femmodel){/*{{{*/
++
++	/*parameters: */
++	bool save_results;
++	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
++
++	/*activate formulation: */
++	femmodel->SetCurrentConfiguration(LsfReinitializationAnalysisEnum);
++
++	/* set spcs for reinitialization */
++	if(VerboseSolution()) _printf0_("Update spcs for reinitialization:\n");
++	UpdateReinitSPCs(femmodel);
++
++	if(VerboseSolution()) _printf0_("call computational core for reinitialization:\n");
++// 	solutionsequence_lsfreinit_linear(femmodel);
++
++	if(save_results){
++		if(VerboseSolution()) _printf0_("   saving results\n");
++		int outputs = MaskIceLevelsetEnum;
++		femmodel->RequestedOutputsx(&femmodel->results,&outputs,1);
++	}
++
+ }/*}}}*/
+ ElementVector* LsfReinitializationAnalysis::CreateDVector(Element* element){/*{{{*/
+-	_error_("not implemented yet");
++	/*Default, return NULL*/
++	return NULL;
+ }/*}}}*/
+ ElementMatrix* LsfReinitializationAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+ 	_error_("not implemented yet");
+ }/*}}}*/
+ ElementMatrix* LsfReinitializationAnalysis::CreateKMatrix(Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	/*Intermediaries */
++	const int dim = 2;
++	int        i,row,col,stabilization;
++	IssmDouble Jdet,D_scalar,h;
++	IssmDouble dlsf[3],normal[3];
++	IssmDouble norm_dlsf;
++	IssmDouble hx,hy,hz,kappa;
++	IssmDouble* xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementMatrix* Ke     = element->NewElementMatrix();
++	IssmDouble*    B      = xNew<IssmDouble>(dim*numnodes);
++	IssmDouble*    Bprime = xNew<IssmDouble>(dim*numnodes);
++	IssmDouble     D[dim][dim];
++
++	/*Retrieve all inputs and parameters*/
++	Input* lsfpicard_input=element->GetInput(LevelsetfunctionPicardEnum); _assert_(lsfpicard_input);
++	element->GetVerticesCoordinates(&xyz_list);
++	h = element->CharacteristicLength();
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){/*{{{*/
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		GetB(B,element,xyz_list,gauss);
++		GetBprime(Bprime,element,xyz_list,gauss);
++
++		/* Get normal from last iteration on lsf */
++		lsfpicard_input->GetInputDerivativeValue(&dlsf[0],xyz_list,gauss);
++
++		norm_dlsf=0.;
++		for(i=0;i<dim;i++) norm_dlsf+=dlsf[i]*dlsf[i]; 
++		norm_dlsf=sqrt(norm_dlsf); _assert_(norm_dlsf>0.);
++		for(i=0;i<dim;i++)
++			normal[i]=dlsf[i]/norm_dlsf;
++		
++		D_scalar=gauss->weight*Jdet;
++
++		for(row=0;row<dim;row++)
++			for(col=0;col<dim;col++)
++				if(row==col)
++					D[row][col]=D_scalar*normal[row];
++				else
++					D[row][col]=0.;
++		TripleMultiply(B,dim,numnodes,1,
++					&D[0][0],dim,dim,0,
++					Bprime,dim,numnodes,0,
++					&Ke->values[0],1);
++
++		/* Stabilization *//*{{{*/
++		stabilization=1;
++		if (stabilization==0){/* no stabilization, do nothing*/}
++		else if(stabilization==1){
++			/* Artificial Diffusion */
++			element->ElementSizes(&hx,&hy,&hz);
++			h=sqrt( pow(hx*normal[0],2) + pow(hy*normal[1],2));
++			kappa=h/2.; 
++			D[0][0]=D_scalar*kappa;
++			D[0][1]=0.;
++			D[1][0]=0.;
++			D[1][1]=D_scalar*kappa;
++			TripleMultiply(Bprime,dim,numnodes,1,
++						&D[0][0],dim,dim,0,
++						Bprime,dim,numnodes,0,
++						&Ke->values[0],1);
++		}
++		else if(stabilization==2){
++			/*Streamline upwinding - do not use this for extrapolation: yields oscillating results due to smoothing along normal, not across */
++			for(row=0;row<dim;row++)
++				for(col=0;col<dim;col++)
++					D[row][col]=h/(2.*1.)*normal[row]*normal[col];
++
++			TripleMultiply(Bprime,dim,numnodes,1,
++						&D[0][0],dim,dim,0,
++						Bprime,dim,numnodes,0,
++						&Ke->values[0],1);
++		}/*}}}*/
++	}/*}}}*/
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(B);
++	xDelete<IssmDouble>(Bprime);
++	delete gauss;
++	return Ke;
+ }/*}}}*/
+ ElementVector* LsfReinitializationAnalysis::CreatePVector(Element* element){/*{{{*/
+-	_error_("not implemented yet");
+-}/*}}}*/
++	
++	/*Intermediaries */
++	IssmDouble Jdet;
++	IssmDouble* xyz_list = NULL;
++	
++	/*Fetch number of nodes */
++	int numnodes = element->GetNumberOfNodes();
++
++	IssmDouble* basis = xNew<IssmDouble>(numnodes);
++	element->GetVerticesCoordinates(&xyz_list);
++
++	/*Initialize Element vector*/
++	ElementVector* pe = element->NewElementVector();
++
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctions(basis,gauss);
++
++		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*basis[i]; 
++	}
++
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(xyz_list);
++	return pe;
++	}/*}}}*/
+ void LsfReinitializationAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	_error_("not implemented yet");
+ }/*}}}*/
+@@ -49,23 +202,118 @@
+ void LsfReinitializationAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+ 	_error_("not implemented yet");
+ }/*}}}*/
++void LsfReinitializationAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
++	 * For node i, Bi can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi=[ N ]
++	 *          [ N ]
++	 * where N is the finiteelement function for node i.
++	 *
++	 * We assume B_prog has been allocated already, of size: 2x(NDOF1*numnodes)
++	 */
+ 
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions*/
++	IssmDouble* basis=xNew<IssmDouble>(numnodes);
++	element->NodalFunctions(basis,gauss);
++
++	/*Build B: */
++	for(int i=0;i<numnodes;i++){
++		B[numnodes*0+i] = basis[i];
++		B[numnodes*1+i] = basis[i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(basis);
++}/*}}}*/
++void LsfReinitializationAnalysis::GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 
++	 * For node i, Bi' can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi_prime=[ dN/dx ]
++	 *                [ dN/dy ]
++	 * where N is the finiteelement function for node i.
++	 *
++	 * We assume B' has been allocated already, of size: 3x(NDOF2*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Build B': */
++	for(int i=0;i<numnodes;i++){
++		Bprime[numnodes*0+i] = dbasis[0*numnodes+i];
++		Bprime[numnodes*1+i] = dbasis[1*numnodes+i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(dbasis);
++
++}/*}}}*/
++
+ /* Other */
++void LsfReinitializationAnalysis::UpdateReinitSPCs(FemModel* femmodel){/*{{{*/
++
++	int i,k, numnodes;
++	Element* element;
++	Node* node;
++
++	/* deactivate all spcs */
++	for(i=0;i<femmodel->elements->Size();i++){
++		element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++		for(k=0;k<element->GetNumberOfNodes();k++){
++				node=element->GetNode(k);
++				node->DofInFSet(0); 
++		}
++	}
++
++	SetDistanceOnIntersectedElements(femmodel);
++
++	/* reactivate spcs on elements intersected by zero levelset */
++	for(i=0;i<femmodel->elements->Size();i++){
++		element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++		if(element->IsZeroLevelset(MaskIceLevelsetEnum)){
++			/*iterate over nodes and set spc */
++			numnodes=element->GetNumberOfNodes();
++			IssmDouble* lsf = xNew<IssmDouble>(numnodes);
++			element->GetInputListOnNodes(&lsf[0],MaskIceLevelsetEnum);
++			for(k=0;k<numnodes;k++){
++				node=element->GetNode(k);
++				node->ApplyConstraint(1,lsf[k]);
++			}
++			xDelete<IssmDouble>(lsf);
++		}
++	}
++
++}/*}}}*/
+ void LsfReinitializationAnalysis::SetDistanceOnIntersectedElements(FemModel* femmodel){/*{{{*/
+ 
+ 	/* Intermediaries */
+-	int i;
++	int i,k;
+ 
+ 	/*Initialize vector with number of vertices*/
+ 	int numvertices=femmodel->vertices->NumberOfVertices();
+-	Vector<IssmDouble>* vec_dist_zerolevelset=new Vector<IssmDouble>(numvertices); //vertices that have ice at next time step
++	Element* element;
+ 
+-	/*TODO: Fill vector with values of old level set function: */
+-	for(i=0;i<numvertices;i++){
+-		vec_dist_zerolevelset->SetValue(i,0.,INS_VAL);
++	Vector<IssmDouble>* vec_dist_zerolevelset = NULL;
++	GetVectorFromInputsx(&vec_dist_zerolevelset, femmodel, MaskIceLevelsetEnum, VertexEnum);
++	
++	for(i=0;i<femmodel->elements->Size();i++){
++		element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++		if(element->IsZeroLevelset(MaskIceLevelsetEnum))
++			for(k=0;k<element->GetNumberOfVertices();k++)
++				vec_dist_zerolevelset->SetValue(element->vertices[k]->Sid(),NAN,INS_VAL); 
+ 	}
++
+ 	for(i=0;i<femmodel->elements->Size();i++){
+-		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++		element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+ 		if(element->IsZeroLevelset(MaskIceLevelsetEnum))
+ 			SetDistanceToZeroLevelsetElement(vec_dist_zerolevelset, element);
+ 	}
+@@ -102,12 +350,8 @@
+ 	element->GetInputListOnVertices(lsf,MaskIceLevelsetEnum);
+ 
+ 	/* get sign of levelset function */
+-	for(i=0;i<numvertices;i++){
+-		if(lsf[i]==0.)
+-			sign_lsf[i]=1.;
+-		else
+-			sign_lsf[i]=lsf[i]/fabs(lsf[i]);
+-	}
++	for(i=0;i<numvertices;i++)
++		sign_lsf[i]=(lsf[i]>=0.?1.:-1.);
+ 
+ 	element->ZeroLevelsetCoordinates(&xyz_list_zero, xyz_list, MaskIceLevelsetEnum);
+ 	for(d=0;d<dim;d++){
+@@ -126,7 +370,7 @@
+ 	/* insert signed_distance into vec_signed_dist, if computed distance is smaller */
+ 	for(i=0;i<numvertices;i++){
+ 		vec_signed_dist->GetValue(&lsf_old, element->vertices[i]->Sid());
+-		if(fabs(signed_dist[i])<fabs(lsf_old))
++		if(isnan(lsf_old) || fabs(signed_dist[i])<fabs(lsf_old))
+ 			vec_signed_dist->SetValue(element->vertices[i]->Sid(),signed_dist[i],INS_VAL);
+ 	}
+ 
+Index: ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.h	(revision 17333)
++++ ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.h	(revision 17334)
+@@ -28,8 +28,11 @@
+ 	void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 	void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ 	void UpdateConstraints(FemModel* femmodel);
++	void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++	void GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 	
+ 	/* Other */
++	void UpdateReinitSPCs(FemModel* femmodel);
+ 	void SetDistanceOnIntersectedElements(FemModel* femmodel);
+ 	void SetDistanceToZeroLevelsetElement(Vector<IssmDouble>* vec_dist, Element* element);
+ 	IssmDouble GetDistanceToStraight(IssmDouble* q, IssmDouble* s0, IssmDouble* s1);
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17333)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17334)
+@@ -681,6 +681,7 @@
+ 	IceMaskNodeActivationEnum,
+ 	LevelsetfunctionSlopeXEnum,
+ 	LevelsetfunctionSlopeYEnum,
++	LevelsetfunctionPicardEnum,
+ 	/*}}}*/
+ 	MaximumNumberOfDefinitionsEnum
+ };
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17333)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17334)
+@@ -640,6 +640,7 @@
+ 		case IceMaskNodeActivationEnum : return "IceMaskNodeActivation";
+ 		case LevelsetfunctionSlopeXEnum : return "LevelsetfunctionSlopeX";
+ 		case LevelsetfunctionSlopeYEnum : return "LevelsetfunctionSlopeY";
++		case LevelsetfunctionPicardEnum : return "LevelsetfunctionPicard";
+ 		case MaximumNumberOfDefinitionsEnum : return "MaximumNumberOfDefinitions";
+ 		default : return "unknown";
+ 
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17333)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17334)
+@@ -655,6 +655,7 @@
+ 	      else if (strcmp(name,"IceMaskNodeActivation")==0) return IceMaskNodeActivationEnum;
+ 	      else if (strcmp(name,"LevelsetfunctionSlopeX")==0) return LevelsetfunctionSlopeXEnum;
+ 	      else if (strcmp(name,"LevelsetfunctionSlopeY")==0) return LevelsetfunctionSlopeYEnum;
++	      else if (strcmp(name,"LevelsetfunctionPicard")==0) return LevelsetfunctionPicardEnum;
+ 	      else if (strcmp(name,"MaximumNumberOfDefinitions")==0) return MaximumNumberOfDefinitionsEnum;
+          else stage=7;
+    }
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17333)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17334)
+@@ -433,6 +433,7 @@
+ 				name==IceMaskNodeActivationEnum ||
+ 				name==LevelsetfunctionSlopeXEnum ||
+ 				name==LevelsetfunctionSlopeYEnum ||
++				name==LevelsetfunctionPicardEnum ||
+ 				name==GradientEnum ||
+ 				name==OldGradientEnum  ||
+ 				name==ConvergedEnum || 
+Index: ../trunk-jpl/src/m/enum/LevelsetfunctionPicardEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/LevelsetfunctionPicardEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/LevelsetfunctionPicardEnum.m	(revision 17334)
+@@ -0,0 +1,11 @@
++function macro=LevelsetfunctionPicardEnum()
++%LEVELSETFUNCTIONPICARDENUM - Enum of LevelsetfunctionPicard
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=LevelsetfunctionPicardEnum()
++
++macro=StringToEnum('LevelsetfunctionPicard');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17333)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17334)
+@@ -632,4 +632,5 @@
+ def IceMaskNodeActivationEnum(): return StringToEnum("IceMaskNodeActivation")[0]
+ def LevelsetfunctionSlopeXEnum(): return StringToEnum("LevelsetfunctionSlopeX")[0]
+ def LevelsetfunctionSlopeYEnum(): return StringToEnum("LevelsetfunctionSlopeY")[0]
++def LevelsetfunctionPicardEnum(): return StringToEnum("LevelsetfunctionPicard")[0]
+ def MaximumNumberOfDefinitionsEnum(): return StringToEnum("MaximumNumberOfDefinitions")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17334-17335.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17334-17335.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17334-17335.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/cores/masstransport_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/masstransport_core.cpp	(revision 17334)
++++ ../trunk-jpl/src/c/cores/masstransport_core.cpp	(revision 17335)
+@@ -61,7 +61,7 @@
+ 	else{
+ 		if(VerboseSolution()) _printf0_("   call computational core\n");
+ 		solutionsequence_linear(femmodel);
+-		if(meshtype!=Mesh2DhorizontalEnum){
++		if(meshtype==Mesh2DverticalEnum){
+ 			femmodel->parameters->SetParam(ThicknessEnum,InputToExtrudeEnum);
+ 			extrudefrombase_core(femmodel);
+ 			femmodel->parameters->SetParam(BedEnum,InputToExtrudeEnum);
Index: issm/oecreview/Archive/16554-17801/ISSM-17335-17336.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17335-17336.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17335-17336.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp	(revision 17335)
++++ ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp	(revision 17336)
+@@ -370,7 +370,7 @@
+ 	/* insert signed_distance into vec_signed_dist, if computed distance is smaller */
+ 	for(i=0;i<numvertices;i++){
+ 		vec_signed_dist->GetValue(&lsf_old, element->vertices[i]->Sid());
+-		if(isnan(lsf_old) || fabs(signed_dist[i])<fabs(lsf_old))
++		if(xIsNan<IssmDouble>(lsf_old) || fabs(signed_dist[i])<fabs(lsf_old))
+ 			vec_signed_dist->SetValue(element->vertices[i]->Sid(),signed_dist[i],INS_VAL);
+ 	}
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17336-17337.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17336-17337.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17336-17337.diff	(revision 17802)
@@ -0,0 +1,85 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17336)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17337)
+@@ -714,25 +714,6 @@
+ 					count++;
+ 				}
+ 			}
+-
+-			/*Constraint at the bedrock interface (v.n = vz = 0) (Coordinates will be updated according to the bed slope)*/
+-			if (iomodel->meshtype==Mesh3DEnum) if(nodeonbed[i]>0. && groundedice_ls[i]>=0. && nodeonFS[i]>0.){
+-				 switch(reCast<int,IssmDouble>(vertices_type[i])){
+-					case SSAFSApproximationEnum:
+-						constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,5,0.,StressbalanceAnalysisEnum));
+-						count++;
+-						break;
+-					case HOFSApproximationEnum:
+-						constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,5,0.,StressbalanceAnalysisEnum));
+-						count++;
+-						break;
+-					case FSApproximationEnum:
+-						constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,0.,StressbalanceAnalysisEnum));
+-						count++;
+-						break;
+-					default: _error_("Vertex approximation " << EnumToStringx(reCast<int,IssmDouble>(vertices_type[i])) << " not supported");
+-				}
+-			}
+ 		}
+ 	}
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17336)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17337)
+@@ -2160,11 +2160,12 @@
+ /*FUNCTION Penta::ResetFSBasalBoundaryCondition{{{*/
+ void  Penta::ResetFSBasalBoundaryCondition(void){
+ 
+-	int        approximation;
+-	int        numindices;
+-	int       *indices = NULL;
+-	IssmDouble slopex,slopey,groundedice;
+-	IssmDouble xz_plane[6];
++	int          approximation;
++	int          numindices;
++	int         *indices = NULL;
++	IssmDouble   slopex,slopey,groundedice;
++	IssmDouble   xz_plane[6];
++	IssmDouble*  vertexapproximation= NULL;
+ 
+ 	/*For FS only: we want the CS to be tangential to the bedrock*/
+ 	inputs->GetInputValue(&approximation,ApproximationEnum);
+@@ -2192,18 +2193,29 @@
+ 			xz_plane[0]=1.;       xz_plane[3]=-slopex;  
+ 			xz_plane[1]=0.;       xz_plane[4]=-slopey;  
+ 			xz_plane[2]=slopex;   xz_plane[5]=1.;          
+-			this->nodes[indices[i]]->DofInSSet(2); //vz 
++			if(this->nodes[indices[i]]->GetApproximation()==FSApproximationEnum){
++				this->nodes[indices[i]]->DofInSSet(2); //vz 
++			}
++			else if(this->nodes[indices[i]]->GetApproximation()==SSAFSApproximationEnum || this->nodes[indices[i]]->GetApproximation()==HOFSApproximationEnum){
++				this->nodes[indices[i]]->DofInSSet(4); //vz 
++			}
++			else _error_("approximation not implemented");
+ 		}
+ 		else{
+ 			/*New X axis          New Z axis*/
+ 			xz_plane[0]=1.;       xz_plane[3]=0;  
+ 			xz_plane[1]=0.;       xz_plane[4]=0;  
+ 			xz_plane[2]=0;        xz_plane[5]=1.;          
+-			this->nodes[indices[i]]->DofInFSet(2); //vz
++			if(this->nodes[indices[i]]->GetApproximation()==FSApproximationEnum){
++				this->nodes[indices[i]]->DofInFSet(2); //vz
++			}
++			else if(this->nodes[indices[i]]->GetApproximation()==SSAFSApproximationEnum || this->nodes[indices[i]]->GetApproximation()==HOFSApproximationEnum){
++				this->nodes[indices[i]]->DofInFSet(4); //vz 
++			}
++			else _error_("approximation not implemented");
+ 		}
+ 
+ 		XZvectorsToCoordinateSystem(&this->nodes[indices[i]]->coord_system[0][0],&xz_plane[0]);
+-		
+ 	}
+ 
+ 	/*cleanup*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17337-17338.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17337-17338.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17337-17338.diff	(revision 17802)
@@ -0,0 +1,196 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17337)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17338)
+@@ -68,6 +68,10 @@
+ 		void       GetInputListOnNodesVelocity(IssmDouble* pvalue,int enumtype);
+ 		void       GetInputListOnVertices(IssmDouble* pvalue,int enumtype);
+ 		void       GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue);
++		void       GetInputValue(bool* pvalue,int enum_type);
++		void       GetInputValue(int* pvalue,int enum_type);
++		void       GetInputValue(IssmDouble* pvalue,int enum_type);
++		void       GetInputValue(IssmDouble* pvalue,Gauss* gauss,int enum_type);
+ 		IssmDouble GetMaterialParameter(int enum_in);
+ 		void       GetPhi(IssmDouble* phi, IssmDouble*  epsilon, IssmDouble viscosity);
+ 		void       GetVerticesSidList(int* sidlist);
+@@ -167,10 +171,6 @@
+ 		virtual void   GetGroundedPart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* mainlyfloating)=0;
+ 		virtual IssmDouble GetGroundedPortion(IssmDouble* xyz_list)=0;
+ 		virtual void   GetInputValue(IssmDouble* pvalue,Node* node,int enumtype)=0;
+-		virtual void   GetInputValue(bool* pvalue,int enum_type)=0;
+-		virtual void   GetInputValue(int* pvalue,int enum_type)=0;
+-		virtual void   GetInputValue(IssmDouble* pvalue,int enum_type)=0;
+-		virtual void   GetInputValue(IssmDouble* pvalue,Gauss* gauss,int enum_type)=0;
+ 		virtual Node*  GetNode(int node_number)=0;
+ 		virtual void   GetVerticesCoordinates(IssmDouble** xyz_list)=0;
+ 		virtual void   GetVerticesCoordinatesBase(IssmDouble** xyz_list)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17337)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17338)
+@@ -983,38 +983,6 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetInputValue(bool* pvalue,int inputenum) {{{*/
+-void Tria::GetInputValue(bool* pvalue,int inputenum){
+-
+-	Input* input=inputs->GetInput(inputenum);
+-	if(!input) _error_("Input " << EnumToStringx(inputenum) << " not found in element");
+-	input->GetInputValue(pvalue);
+-
+-}/*}}}*/
+-/*FUNCTION Tria::GetInputValue(int* pvalue,int inputenum) {{{*/
+-void Tria::GetInputValue(int* pvalue,int inputenum){
+-
+-	Input* input=inputs->GetInput(inputenum);
+-	if(!input) _error_("Input " << EnumToStringx(inputenum) << " not found in element");
+-	input->GetInputValue(pvalue);
+-
+-}/*}}}*/
+-/*FUNCTION Tria::GetInputValue(IssmDouble* pvalue,int inputenum) {{{*/
+-void Tria::GetInputValue(IssmDouble* pvalue,int inputenum){
+-
+-	Input* input=inputs->GetInput(inputenum);
+-	if(!input) _error_("Input " << EnumToStringx(inputenum) << " not found in element");
+-	input->GetInputValue(pvalue);
+-
+-}/*}}}*/
+-/*FUNCTION Tria::GetInputValue(IssmDouble* pvalue,Gauss* gauss,int inputenum) {{{*/
+-void Tria::GetInputValue(IssmDouble* pvalue,Gauss* gauss,int inputenum){
+-
+-	Input* input=inputs->GetInput(inputenum);
+-	if(!input) _error_("Input " << EnumToStringx(inputenum) << " not found in element");
+-	input->GetInputValue(pvalue,gauss);
+-
+-}/*}}}*/
+ Node* Tria::GetNode(int node_number){/*{{{*/
+ 	_assert_(node_number>=0); 
+ 	_assert_(node_number<this->NumberofNodes()); 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17337)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17338)
+@@ -212,10 +212,6 @@
+ 		void           NormalTop(IssmDouble* normal,IssmDouble* xyz_list);
+ 		void           NormalBase(IssmDouble* normal,IssmDouble* xyz_list);
+ 		void           GetInputValue(IssmDouble* pvalue,Node* node,int enumtype);
+-		void           GetInputValue(bool* pvalue,int enum_type);
+-		void           GetInputValue(int* pvalue,int enum_type);
+-		void           GetInputValue(IssmDouble* pvalue,int enum_type);
+-		void           GetInputValue(IssmDouble* pvalue,Gauss* gauss,int enum_type);
+ 		void           GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype);
+ 		Node*          GetNode(int node_number);
+ 		void	         InputChangeName(int enum_type,int enum_type_old);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17337)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17338)
+@@ -906,38 +906,6 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetInputValue(bool* pvalue,int inputenum) {{{*/
+-void Penta::GetInputValue(bool* pvalue,int inputenum){
+-
+-	Input* input=inputs->GetInput(inputenum);
+-	if(!input) _error_("Input " << EnumToStringx(inputenum) << " not found in element");
+-	input->GetInputValue(pvalue);
+-
+-}/*}}}*/
+-/*FUNCTION Penta::GetInputValue(int* pvalue,int inputenum) {{{*/
+-void Penta::GetInputValue(int* pvalue,int inputenum){
+-
+-	Input* input=inputs->GetInput(inputenum);
+-	if(!input) _error_("Input " << EnumToStringx(inputenum) << " not found in element");
+-	input->GetInputValue(pvalue);
+-
+-}/*}}}*/
+-/*FUNCTION Penta::GetInputValue(IssmDouble* pvalue,int inputenum) {{{*/
+-void Penta::GetInputValue(IssmDouble* pvalue,int inputenum){
+-
+-	Input* input=inputs->GetInput(inputenum);
+-	if(!input) _error_("Input " << EnumToStringx(inputenum) << " not found in element");
+-	input->GetInputValue(pvalue);
+-
+-}/*}}}*/
+-/*FUNCTION Penta::GetInputValue(IssmDouble* pvalue,Gauss* gauss,int inputenum) {{{*/
+-void Penta::GetInputValue(IssmDouble* pvalue,Gauss* gauss,int inputenum){
+-
+-	Input* input=inputs->GetInput(inputenum);
+-	if(!input) _error_("Input " << EnumToStringx(inputenum) << " not found in element");
+-	input->GetInputValue(pvalue,gauss);
+-
+-}/*}}}*/
+ /*FUNCTION Penta::GetVerticesCoordinates(IssmDouble** pxyz_list){{{*/
+ void Penta::GetVerticesCoordinates(IssmDouble** pxyz_list){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17337)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17338)
+@@ -202,10 +202,6 @@
+ 		void	         GetVertexPidList(int* doflist);
+ 		int            GetElementType(void);
+ 		void           GetInputValue(IssmDouble* pvalue,Node* node,int enumtype);
+-		void           GetInputValue(bool* pvalue,int enum_type);
+-		void           GetInputValue(int* pvalue,int enum_type);
+-		void           GetInputValue(IssmDouble* pvalue,int enum_type);
+-		void           GetInputValue(IssmDouble* pvalue,Gauss* gauss,int enum_type);
+ 		Node*          GetNode(int node_number);
+ 		void           InputChangeName(int input_enum, int enum_type_old);
+ 		void	         InputExtrude(int enum_type);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17337)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17338)
+@@ -124,10 +124,6 @@
+ 		void        GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating){_error_("not implemented yet");};
+ 		IssmDouble  GetGroundedPortion(IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		void        GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");};
+-		void        GetInputValue(bool* pvalue,int enum_type){_error_("not implemented yet");};
+-		void        GetInputValue(int* pvalue,int enum_type){_error_("not implemented yet");};
+-		void        GetInputValue(IssmDouble* pvalue,int enum_type){_error_("not implemented yet");};
+-		void        GetInputValue(IssmDouble* pvalue,Gauss* gauss,int enum_type){_error_("not implemented yet");};
+ 		Node*       GetNode(int node_number){_error_("Not implemented");};
+ 		IssmDouble  GetXcoord(Gauss* gauss){_error_("Not implemented");};
+ 		IssmDouble  GetYcoord(Gauss* gauss){_error_("Not implemented");};
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17337)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17338)
+@@ -368,6 +368,34 @@
+ 	delete gauss;
+ }
+ /*}}}*/
++void Element::GetInputValue(bool* pvalue,int inputenum){/*{{{*/
++
++	Input* input=inputs->GetInput(inputenum);
++	if(!input) _error_("Input " << EnumToStringx(inputenum) << " not found in element");
++	input->GetInputValue(pvalue);
++
++}/*}}}*/
++void Element::GetInputValue(int* pvalue,int inputenum){/*{{{*/
++
++	Input* input=inputs->GetInput(inputenum);
++	if(!input) _error_("Input " << EnumToStringx(inputenum) << " not found in element");
++	input->GetInputValue(pvalue);
++
++}/*}}}*/
++void Element::GetInputValue(IssmDouble* pvalue,int inputenum){/*{{{*/
++
++	Input* input=inputs->GetInput(inputenum);
++	if(!input) _error_("Input " << EnumToStringx(inputenum) << " not found in element");
++	input->GetInputValue(pvalue);
++
++}/*}}}*/
++void Element::GetInputValue(IssmDouble* pvalue,Gauss* gauss,int inputenum){/*{{{*/
++
++	Input* input=inputs->GetInput(inputenum);
++	if(!input) _error_("Input " << EnumToStringx(inputenum) << " not found in element");
++	input->GetInputValue(pvalue,gauss);
++
++}/*}}}*/
+ void Element::GetVerticesSidList(int* sidlist){/*{{{*/
+ 
+ 	int numvertices = this->GetNumberOfVertices();
Index: issm/oecreview/Archive/16554-17801/ISSM-17338-17339.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17338-17339.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17338-17339.diff	(revision 17802)
@@ -0,0 +1,35 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17338)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17339)
+@@ -2161,26 +2161,26 @@
+ 			xz_plane[0]=1.;       xz_plane[3]=-slopex;  
+ 			xz_plane[1]=0.;       xz_plane[4]=-slopey;  
+ 			xz_plane[2]=slopex;   xz_plane[5]=1.;          
+-			if(this->nodes[indices[i]]->GetApproximation()==FSApproximationEnum){
++			if(this->nodes[indices[i]]->GetApproximation()==FSvelocityEnum){
+ 				this->nodes[indices[i]]->DofInSSet(2); //vz 
+ 			}
+ 			else if(this->nodes[indices[i]]->GetApproximation()==SSAFSApproximationEnum || this->nodes[indices[i]]->GetApproximation()==HOFSApproximationEnum){
+ 				this->nodes[indices[i]]->DofInSSet(4); //vz 
+ 			}
+-			else _error_("approximation not implemented");
++			else _error_("Flow equation approximation"<<EnumToStringx(this->nodes[indices[i]]->GetApproximation())<<" not supported yet");
+ 		}
+ 		else{
+ 			/*New X axis          New Z axis*/
+ 			xz_plane[0]=1.;       xz_plane[3]=0;  
+ 			xz_plane[1]=0.;       xz_plane[4]=0;  
+ 			xz_plane[2]=0;        xz_plane[5]=1.;          
+-			if(this->nodes[indices[i]]->GetApproximation()==FSApproximationEnum){
++			if(this->nodes[indices[i]]->GetApproximation()==FSvelocityEnum){
+ 				this->nodes[indices[i]]->DofInFSet(2); //vz
+ 			}
+ 			else if(this->nodes[indices[i]]->GetApproximation()==SSAFSApproximationEnum || this->nodes[indices[i]]->GetApproximation()==HOFSApproximationEnum){
+ 				this->nodes[indices[i]]->DofInFSet(4); //vz 
+ 			}
+-			else _error_("approximation not implemented");
++			else _error_("Flow equation approximation"<<EnumToStringx(this->nodes[indices[i]]->GetApproximation())<<" not supported yet");
+ 		}
+ 
+ 		XZvectorsToCoordinateSystem(&this->nodes[indices[i]]->coord_system[0][0],&xz_plane[0]);
Index: issm/oecreview/Archive/16554-17801/ISSM-17339-17340.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17339-17340.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17339-17340.diff	(revision 17802)
@@ -0,0 +1,101 @@
+Index: ../trunk-jpl/src/c/classes/kriging/Observations.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/kriging/Observations.cpp	(revision 17339)
++++ ../trunk-jpl/src/c/classes/kriging/Observations.cpp	(revision 17340)
+@@ -353,15 +353,10 @@
+ 	int           i,j,n_obs;
+ 	IssmPDouble   prediction,error;
+ 	IssmPDouble   numerator,denominator,ratio;
+-	IssmPDouble  *x            = NULL;
+-	IssmPDouble  *y            = NULL;
+-	IssmPDouble  *obs          = NULL;
+-	IssmPDouble  *Gamma        = NULL;
+-	IssmPDouble  *GinvG0       = NULL;
+-	IssmPDouble  *Ginv1        = NULL;
+-	IssmPDouble  *GinvZ        = NULL;
+-	IssmPDouble  *gamma0       = NULL;
+-	IssmPDouble  *ones         = NULL;
++	IssmPDouble  *x      = NULL;
++	IssmPDouble  *y      = NULL;
++	IssmPDouble  *obs    = NULL;
++	IssmPDouble  *Lambda = NULL;
+ 
+ 	/*Some checks*/
+ 	_assert_(mindata>0 && maxdata>0);
+@@ -381,57 +376,48 @@
+ 	}
+ 
+ 	/*Allocate intermediary matrix and vectors*/
+-	Gamma  = xNew<IssmPDouble>(n_obs*n_obs);
+-	gamma0 = xNew<IssmPDouble>(n_obs);
+-	ones   = xNew<IssmPDouble>(n_obs);
++	IssmPDouble* A = xNew<IssmPDouble>((n_obs+1)*(n_obs+1));
++	IssmPDouble* B = xNew<IssmPDouble>(n_obs+1);
+ 
+ 	/*First: Create semivariogram matrix for observations*/
+ 	for(i=0;i<n_obs;i++){
+ 		for(j=0;j<=i;j++){
+-			//Gamma[i*n_obs+j] = variogram->SemiVariogram(x[i]-x[j],y[i]-y[j]);
+-			Gamma[i*n_obs+j] = variogram->Covariance(x[i]-x[j],y[i]-y[j]);
+-			Gamma[j*n_obs+i] = Gamma[i*n_obs+j];
++			A[i*(n_obs+1)+j] = variogram->Covariance(x[i]-x[j],y[i]-y[j]);
++			A[j*(n_obs+1)+i] = A[i*(n_obs+1)+j];
+ 		}
++		A[i*(n_obs+1)+n_obs] = 1.;
+ 	}
+-	for(i=0;i<n_obs;i++) ones[i]=1;
++	for(i=0;i<n_obs;i++) A[n_obs*(n_obs+1)+i]=1.;
++	A[n_obs*(n_obs+1)+n_obs] = 0.;
+ 
+ 	/*Get semivariogram vector associated to this location*/
+-	//for(i=0;i<n_obs;i++) gamma0[i] = variogram->SemiVariogram(x[i]-x_interp,y[i]-y_interp);
+-	for(i=0;i<n_obs;i++) gamma0[i] = variogram->Covariance(x[i]-x_interp,y[i]-y_interp);
++	for(i=0;i<n_obs;i++) B[i] = variogram->Covariance(x[i]-x_interp,y[i]-y_interp);
++	B[n_obs] = 1.;
+ 
+ 	/*Solve the three linear systems*/
+ #if _HAVE_GSL_
+-	DenseGslTripleSolve(&GinvG0,&Ginv1,&GinvZ,Gamma,gamma0,ones,obs,n_obs);
+-	//DenseGslSolve(&GinvG0,Gamma,gamma0,n_obs); // Gamma^-1 gamma0
+-	//DenseGslSolve(&Ginv1, Gamma,ones,n_obs);   // Gamma^-1 ones
+-	//DenseGslSolve(&GinvZ, Gamma,obs,n_obs);    // Gamma^-1 Z
++	DenseGslSolve(&Lambda,A,B,n_obs+1);    // Gamma^-1 Z
+ #else
+ 	_error_("GSL is required");
+ #endif
+ 
+-	/*Prepare predictor*/
+-	numerator=-1.; denominator=0.;
+-	for(i=0;i<n_obs;i++) numerator  +=GinvG0[i];
+-	for(i=0;i<n_obs;i++) denominator+=Ginv1[i];
+-	ratio=numerator/denominator;
+-
++	/*Compute predictor*/
+ 	prediction = 0.;
+-	error      = - numerator*numerator/denominator;
+-	for(i=0;i<n_obs;i++) prediction += (gamma0[i]-ratio)*GinvZ[i];
+-	for(i=0;i<n_obs;i++) error += gamma0[i]*GinvG0[i];
++	for(i=0;i<n_obs;i++) prediction += Lambda[i]*obs[i];
+ 
++	/*Compute error (GSLIB p15 eq II.14)*/
++	error = variogram->Covariance(0.,0.)*(1. - Lambda[n_obs]);;
++	for(i=0;i<n_obs;i++) error += -Lambda[i]*B[i];
++
+ 	/*clean-up*/
+ 	*pprediction = prediction;
+ 	*perror = error;
+ 	xDelete<IssmPDouble>(x);
+ 	xDelete<IssmPDouble>(y);
+ 	xDelete<IssmPDouble>(obs);
+-	xDelete<IssmPDouble>(Gamma);
+-	xDelete<IssmPDouble>(gamma0);
+-	xDelete<IssmPDouble>(ones);
+-	xDelete<IssmPDouble>(GinvG0);
+-	xDelete<IssmPDouble>(Ginv1);
+-	xDelete<IssmPDouble>(GinvZ);
++	xDelete<IssmPDouble>(A);
++	xDelete<IssmPDouble>(B);
++	xDelete<IssmPDouble>(Lambda);
+ 
+ }/*}}}*/
+ /*FUNCTION Observations::InterpolationNearestNeighbor{{{*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17340-17341.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17340-17341.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17340-17341.diff	(revision 17802)
@@ -0,0 +1,31 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17340)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17341)
+@@ -1179,7 +1179,7 @@
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+-	int numdof   = numnodes*2;
++	int numdof   = numnodes*dim;
+ 
+ 	/*Initialize Element matrix and vectors*/
+ 	ElementMatrix* Ke = element->NewElementMatrix(SSAApproximationEnum);
+@@ -1196,7 +1196,7 @@
+ 	if(dim==2){vy_input     = element->GetInput(VyEnum);      _assert_(vy_input);}
+ 
+ 	/*build friction object, used later on: */
+-	Friction* friction=new Friction(element,2);
++	Friction* friction=new Friction(element,1);
+ 
+ 	/*Recover portion of element that is grounded*/
+ 	if(migration_style==SubelementMigrationEnum) phi=element->GetGroundedPortion(xyz_list);
+@@ -1231,7 +1231,7 @@
+ 	}
+ 
+ 	/*Transform Coordinate System*/
+-	element->TransformStiffnessMatrixCoord(Ke,XYEnum);
++	if(dim==2) element->TransformStiffnessMatrixCoord(Ke,XYEnum);
+ 
+ 	/*Clean up and return*/
+ 	delete gauss;
Index: issm/oecreview/Archive/16554-17801/ISSM-17341-17342.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17341-17342.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17341-17342.diff	(revision 17802)
@@ -0,0 +1,32 @@
+Index: ../trunk-jpl/src/c/classes/kriging/Observations.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/kriging/Observations.cpp	(revision 17341)
++++ ../trunk-jpl/src/c/classes/kriging/Observations.cpp	(revision 17342)
+@@ -379,20 +379,24 @@
+ 	IssmPDouble* A = xNew<IssmPDouble>((n_obs+1)*(n_obs+1));
+ 	IssmPDouble* B = xNew<IssmPDouble>(n_obs+1);
+ 
++	IssmDouble unbias = variogram->Covariance(0.,0.);
+ 	/*First: Create semivariogram matrix for observations*/
+ 	for(i=0;i<n_obs;i++){
+ 		for(j=0;j<=i;j++){
+ 			A[i*(n_obs+1)+j] = variogram->Covariance(x[i]-x[j],y[i]-y[j]);
+ 			A[j*(n_obs+1)+i] = A[i*(n_obs+1)+j];
+ 		}
+-		A[i*(n_obs+1)+n_obs] = 1.;
++		A[i*(n_obs+1)+n_obs] = unbias;
++		//A[i*(n_obs+1)+n_obs] = 1.;
+ 	}
+-	for(i=0;i<n_obs;i++) A[n_obs*(n_obs+1)+i]=1.;
++	for(i=0;i<n_obs;i++) A[n_obs*(n_obs+1)+i]=unbias;
++	//for(i=0;i<n_obs;i++) A[n_obs*(n_obs+1)+i]=1.;
+ 	A[n_obs*(n_obs+1)+n_obs] = 0.;
+ 
+ 	/*Get semivariogram vector associated to this location*/
+ 	for(i=0;i<n_obs;i++) B[i] = variogram->Covariance(x[i]-x_interp,y[i]-y_interp);
+-	B[n_obs] = 1.;
++	B[n_obs] = unbias;
++	//B[n_obs] = 1.;
+ 
+ 	/*Solve the three linear systems*/
+ #if _HAVE_GSL_
Index: issm/oecreview/Archive/16554-17801/ISSM-17342-17343.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17342-17343.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17342-17343.diff	(revision 17802)
@@ -0,0 +1,65 @@
+Index: ../trunk-jpl/src/c/toolkits/gsl/gslincludes.h
+===================================================================
+--- ../trunk-jpl/src/c/toolkits/gsl/gslincludes.h	(revision 17342)
++++ ../trunk-jpl/src/c/toolkits/gsl/gslincludes.h	(revision 17343)
+@@ -21,7 +21,6 @@
+ 
+ void DenseGslSolve(IssmPDouble** pX,IssmPDouble* A,IssmPDouble* B, int n);
+ void DenseGslSolve(IssmDouble** pX,IssmDouble* Kff,int Kff_M,int Kff_N,IssmDouble* pf,int pf_M,Parameters* parameters);
+-void DenseGslTripleSolve(IssmPDouble** pX1,IssmPDouble** pX2,IssmPDouble** pX3,IssmPDouble* A,IssmPDouble* B1,IssmPDouble* B2,IssmPDouble* B3,int n);
+ 
+ void SolverxSeq(IssmPDouble *X, IssmPDouble *A, IssmPDouble *B,int n);
+ 
+Index: ../trunk-jpl/src/c/toolkits/gsl/DenseGslSolve.cpp
+===================================================================
+--- ../trunk-jpl/src/c/toolkits/gsl/DenseGslSolve.cpp	(revision 17342)
++++ ../trunk-jpl/src/c/toolkits/gsl/DenseGslSolve.cpp	(revision 17343)
+@@ -45,48 +45,6 @@
+ 	*px=x;
+ }
+ /*}}}*/
+-void DenseGslTripleSolve(IssmPDouble** pX1,IssmPDouble** pX2,IssmPDouble** pX3,IssmPDouble* A,IssmPDouble* B1,IssmPDouble* B2,IssmPDouble* B3,int n){/*{{{*/
+-
+-	/*Allocate output: */
+-	IssmPDouble *X1 = xNew<IssmPDouble>(n);
+-	IssmPDouble *X2 = xNew<IssmPDouble>(n);
+-	IssmPDouble *X3 = xNew<IssmPDouble>(n);
+-
+-#ifdef _HAVE_GSL_
+-	/*GSL Matrices and vectors: */
+-	int s;
+-
+-	double* Acopy = xNew<double>(n*n);
+-	xMemCpy(Acopy,A,n*n);
+-
+-	/*Initialize gsl matrices and vectors: */
+-	gsl_matrix_view a = gsl_matrix_view_array(Acopy,n,n);
+-	gsl_vector_view b1= gsl_vector_view_array(B1,n);
+-	gsl_vector_view b2= gsl_vector_view_array(B2,n);
+-	gsl_vector_view b3= gsl_vector_view_array(B3,n);
+-	gsl_vector_view x1= gsl_vector_view_array(X1,n);
+-	gsl_vector_view x2= gsl_vector_view_array(X2,n);
+-	gsl_vector_view x3= gsl_vector_view_array(X3,n);
+-
+-	/*Run LU and solve: */
+-	gsl_permutation* p = gsl_permutation_alloc (n);
+-	gsl_linalg_LU_decomp(&a.matrix,p,&s);
+-
+-	gsl_linalg_LU_solve(&a.matrix,p,&b1.vector,&x1.vector);
+-	gsl_linalg_LU_solve(&a.matrix,p,&b2.vector,&x2.vector);
+-	gsl_linalg_LU_solve(&a.matrix,p,&b3.vector,&x3.vector);
+-
+-	/*Clean up and assign output pointer*/
+-	xDelete(Acopy);
+-	gsl_permutation_free(p);
+-#endif
+-
+-	/*allocate output pointers: */
+-	*pX1=X1;
+-	*pX2=X2;
+-	*pX3=X3;
+-}
+-/*}}}*/
+ void SolverxSeq(IssmPDouble *X, IssmPDouble *A, IssmPDouble *B,int n){ /*{{{*/
+ #ifdef _HAVE_GSL_
+ 	/*GSL Matrices and vectors: */
Index: issm/oecreview/Archive/16554-17801/ISSM-17343-17344.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17343-17344.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17343-17344.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/test/NightlyRun/test435.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test435.m	(revision 17343)
++++ ../trunk-jpl/test/NightlyRun/test435.m	(revision 17344)
+@@ -46,7 +46,7 @@
+ field_names     ={'Bed1','Surface1','Thickness1','Floatingice1','Vx1','Vy1','Vz1','Pressure1',...
+ 	'Bed2','Surface2','Thickness2','Floatingice2','Vx2','Vy2','Vz2','Pressure2',...
+ 	'Bed3','Surface3','Thickness3','Floatingice3','Vx3','Vy3','Vz3','Pressure3'};
+-field_tolerances={1e-11,1e-12,1e-11,1e-11,2e-10,1e-08,2e-10,1e-13,...
++field_tolerances={1e-11,3e-12,1e-11,1e-11,3e-10,1e-08,3e-10,1e-13,...
+ 	1e-11,3e-12,9e-12,2e-11,1e-09,1e-08,2e-10,1e-10,...
+ 	1e-10,3e-11,1e-10,7e-11,1e-09,1e-08,1e-09,1e-11};
+ field_values={...
Index: issm/oecreview/Archive/16554-17801/ISSM-17344-17345.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17344-17345.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17344-17345.diff	(revision 17802)
@@ -0,0 +1,85 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17344)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17345)
+@@ -1291,6 +1291,7 @@
+ 	IssmDouble  xyz_list[NUMVERTICES][3];
+ 	IssmDouble  Helem_list[NUMVERTICES];
+ 	IssmDouble  zeros_list[NUMVERTICES]={0.0};
++	IssmDouble  p0top1_list[NUMVERTICES];
+ 	Penta* penta=NULL;
+ 	Input* original_input=NULL;
+ 	Input* element_integrated_input=NULL;
+@@ -1338,8 +1339,21 @@
+ 		element_thickness_input=new PentaInput(ThicknessEnum,Helem_list,P1Enum);
+ 
+ 		/*Step3: Vertically integrate A COPY of the original*/
+-		element_integrated_input=(Input*)original_input->copy();
+-		element_integrated_input->VerticallyIntegrate(element_thickness_input);
++		if(original_input->ObjectEnum()==PentaInputEnum){
++			if(((PentaInput*)original_input)->element_type==P0Enum){
++				original_input->GetInputValue(&p0top1_list[i]);
++				element_integrated_input= new  PentaInput(original_input->InstanceEnum(),p0top1_list,P1Enum);
++				element_integrated_input->VerticallyIntegrate(element_thickness_input);
++			}
++			else{
++				element_integrated_input= (Input*)original_input->copy();
++				element_integrated_input->VerticallyIntegrate(element_thickness_input);
++			}
++		}
++		else{
++			element_integrated_input= (Input*)original_input->copy();
++			element_integrated_input->VerticallyIntegrate(element_thickness_input);
++		}
+ 
+ 		/*Add contributions to global inputs*/
+ 		total_integrated_input->AXPY(element_integrated_input,1.0);
+Index: ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 17344)
++++ ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 17345)
+@@ -157,6 +157,15 @@
+ /*}}}*/
+ 
+ /*Object functions*/
++/*FUNCTION PentaInput::GetInputValue(IssmDouble* pvalue){{{*/
++void PentaInput::GetInputValue(IssmDouble* pvalue){
++
++	if(this->element_type==P0Enum){
++		pvalue=&values[0];
++	}
++	else _error_("not implemented yet");
++}
++/*}}}*/
+ /*FUNCTION PentaInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){{{*/
+ void PentaInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){
+ 
+@@ -331,13 +340,14 @@
+ void PentaInput::VerticallyIntegrate(Input* thickness_input){
+ 
+ 	IssmDouble thickness;
++	IssmDouble value=0.;
+ 
+ 	/*Check that input provided is a thickness*/
+ 	if (thickness_input->InstanceEnum()!=ThicknessEnum) _error_("Input provided is not a Thickness (enum_type is " << EnumToStringx(thickness_input->InstanceEnum()) << ")");
+ 
+ 	/*vertically integrate depending on type:*/
+ 	switch(this->element_type){
+-		case P1Enum:{
++		case P1Enum: {
+ 			GaussPenta *gauss=new GaussPenta();
+ 			for(int iv=0;iv<3;iv++){
+ 				gauss->GaussVertex(iv);
+Index: ../trunk-jpl/src/c/classes/Inputs/PentaInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/PentaInput.h	(revision 17344)
++++ ../trunk-jpl/src/c/classes/Inputs/PentaInput.h	(revision 17345)
+@@ -46,7 +46,7 @@
+ 		/*numerics*/
+ 		void GetInputValue(bool* pvalue){_error_("not implemented yet");};
+ 		void GetInputValue(int* pvalue){_error_("not implemented yet");};
+-		void GetInputValue(IssmDouble* pvalue){_error_("not implemented yet");};
++		void GetInputValue(IssmDouble* pvalue);
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss);
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){_error_("not implemented yet");};
+ 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-17345-17346.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17345-17346.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17345-17346.diff	(revision 17802)
@@ -0,0 +1,16 @@
+Index: ../trunk-jpl/src/m/shp/Shp2Exp.m
+===================================================================
+--- ../trunk-jpl/src/m/shp/Shp2Exp.m	(revision 17345)
++++ ../trunk-jpl/src/m/shp/Shp2Exp.m	(revision 17346)
+@@ -36,10 +36,9 @@
+ 			%exp(end).name=num2str(shp(i).id);
+ 		elseif strcmpi(shp(i).Geometry,'Line'),
+ 			x=shp(i).X; y=shp(i).Y;
++			x(end)=x(1); y(end)=y(1);
+ 			expstruct(end+1).x=x;
+ 			expstruct(end).y=y;
+-			expstruct.x(end)=x(1);
+-			expstruct.y(end)=y(1);
+ 			expstruct(end).nods=length(x);
+ 			expstruct(end).density=1;
+ 			expstruct(end).closed=1;
Index: issm/oecreview/Archive/16554-17801/ISSM-17346-17347.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17346-17347.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17346-17347.diff	(revision 17802)
@@ -0,0 +1,17 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 17346)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 17347)
+@@ -250,10 +250,10 @@
+ 	Gauss* gauss = NULL;
+ 
+ 	if(xyz_list_front[0] == xyz_list[0]){
+-		gauss = new GaussSeg(+1.);
++		gauss = new GaussSeg(-1.);
+ 	}
+ 	else if(xyz_list_front[0] == xyz_list[3*1+0]){
+-		gauss = new GaussSeg(-1.);
++		gauss = new GaussSeg(+1.);
+ 	}
+ 	else{
+ 		_error_("front is not located on element edge");
Index: issm/oecreview/Archive/16554-17801/ISSM-17347-17348.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17347-17348.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17347-17348.diff	(revision 17802)
@@ -0,0 +1,118 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 17347)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 17348)
+@@ -256,7 +256,8 @@
+ ElementVector* StressbalanceSIAAnalysis::CreatePVector2D(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries */
+-	IssmDouble ub,vb,slope2,drag,thickness,connectivity;
++	int        frictionlaw = 1;
++	IssmDouble ub,vb,slope2,drag,thickness,surface,connectivity;
+ 	IssmDouble slope[2];
+ 
+ 	/*Fetch number vertices for this element*/
+@@ -273,6 +274,7 @@
+ 	Input* slopex_input    = element->GetInput(SurfaceSlopeXEnum);        _assert_(slopex_input);
+ 	Input* slopey_input    = element->GetInput(SurfaceSlopeYEnum);        _assert_(slopey_input);
+ 	Input* thickness_input = element->GetInput(ThicknessEnum);            _assert_(thickness_input);
++	Input* surface_input   = element->GetInput(SurfaceEnum);              _assert_(surface_input);
+ 	Input* drag_input      = element->GetInput(FrictionCoefficientEnum);  _assert_(drag_input);
+ 
+ 	Gauss* gauss=element->NewGauss();
+@@ -282,20 +284,37 @@
+ 		connectivity=(IssmDouble)element->VertexConnectivity(iv);
+ 
+ 		thickness_input->GetInputValue(&thickness,gauss);
++		surface_input->GetInputValue(&surface,gauss);
+ 		drag_input->GetInputValue(&drag,gauss);
+ 		slopex_input->GetInputValue(&slope[0],gauss);
+ 		slopey_input->GetInputValue(&slope[1],gauss);
+ 		slope2=slope[0]*slope[0]+slope[1]*slope[1];
+ 
+-		/*Payne 1995 (m = 1, B = 5e-3/yts = 1.58e-10  m/s/Pa*/
+-		ub=-1.58*1.e-10*rho_ice*gravity*thickness*slope[0];
+-		vb=-1.58*1.e-10*rho_ice*gravity*thickness*slope[1];
+-		///*Ritz et al. 1996*/
+-		//ub=drag*(rho_ice*gravity*thickness)*(rho_ice*gravity*thickness)*slope[0]/sqrt(slope2);
+-		//vb=drag*(rho_ice*gravity*thickness)*(rho_ice*gravity*thickness)*slope[1]/sqrt(slope2);
+-		///*Rutt et al. 2009*/
+-		//ub=-drag*rho_ice*gravity*thickness*slope[0];
+-		//vb=-drag*rho_ice*gravity*thickness*slope[1];
++		switch(frictionlaw){
++			case 1:
++				/*Payne 1995 (m = 1, B = 5e-3/yts = 1.58e-10  m/s/Pa*/
++				ub=-1.58*1.e-10*rho_ice*gravity*thickness*slope[0];
++				vb=-1.58*1.e-10*rho_ice*gravity*thickness*slope[1];
++				break;
++			case 2:
++				/*Ritz et al. 1996*/
++				ub=drag*(rho_ice*gravity*thickness)*(rho_ice*gravity*thickness)*slope[0]/sqrt(slope2);
++				vb=drag*(rho_ice*gravity*thickness)*(rho_ice*gravity*thickness)*slope[1]/sqrt(slope2);
++				break;
++			case 3:
++				/*Rutt et al. 2009*/
++				ub=-drag*rho_ice*gravity*thickness*slope[0];
++				vb=-drag*rho_ice*gravity*thickness*slope[1];
++				break;
++			case 4:
++				/*Henning Akesson*/
++				drag = -4e-15 * surface + 8.6e-12;
++				ub=-drag*rho_ice*gravity*thickness*slope[0];
++				vb=-drag*rho_ice*gravity*thickness*slope[1];
++				break;
++			default:
++				_error_("Not supported yet");
++		}
+ 
+ 		pe->values[2*iv+0]=(ub-2.*pow(rho_ice*gravity,n)*pow(slope2,((n-1.)/2.))*pow(thickness,n)/(pow(B,n)*(n+1))*slope[0])/connectivity;
+ 		pe->values[2*iv+1]=(vb-2.*pow(rho_ice*gravity,n)*pow(slope2,((n-1.)/2.))*pow(thickness,n)/(pow(B,n)*(n+1))*slope[1])/connectivity;
+@@ -308,6 +327,7 @@
+ ElementVector* StressbalanceSIAAnalysis::CreatePVector3D(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries */
++	int         frictionlaw = 1;
+ 	int         nodeup,nodedown,numsegments;
+ 	IssmDouble  ub,vb,slope2,drag,surface,thickness,constant_part,z,Jdet;
+ 	IssmDouble  slope[2],connectivity[2],xyz_list_line[2][3];
+@@ -373,15 +393,31 @@
+ 		if(element->IsOnBed()){
+ 			drag_input->GetInputValue(&drag,gauss);
+ 
+-			/*Payne 1995 (m = 1, B = 5e-3/yts = 1.58e-10  m/s/Pa*/
+-			ub=-1.58*1.e-10*rho_ice*gravity*thickness*slope[0];
+-			vb=-1.58*1.e-10*rho_ice*gravity*thickness*slope[1];
+-			///*Ritz et al. 1996*/
+-			//ub=drag*(rho_ice*gravity*thickness)*(rho_ice*gravity*thickness)*slope[0]/sqrt(slope2);
+-			//vb=drag*(rho_ice*gravity*thickness)*(rho_ice*gravity*thickness)*slope[1]/sqrt(slope2);
+-			///*Rutt et al. 2009*/
+-			//ub=-drag*rho_ice*gravity*thickness*slope[0];
+-			//vb=-drag*rho_ice*gravity*thickness*slope[1];
++			switch(frictionlaw){
++				case 1:
++					/*Payne 1995 (m = 1, B = 5e-3/yts = 1.58e-10  m/s/Pa*/
++					ub=-1.58*1.e-10*rho_ice*gravity*thickness*slope[0];
++					vb=-1.58*1.e-10*rho_ice*gravity*thickness*slope[1];
++					break;
++				case 2:
++					/*Ritz et al. 1996*/
++					ub=drag*(rho_ice*gravity*thickness)*(rho_ice*gravity*thickness)*slope[0]/sqrt(slope2);
++					vb=drag*(rho_ice*gravity*thickness)*(rho_ice*gravity*thickness)*slope[1]/sqrt(slope2);
++					break;
++				case 3:
++					/*Rutt et al. 2009*/
++					ub=-drag*rho_ice*gravity*thickness*slope[0];
++					vb=-drag*rho_ice*gravity*thickness*slope[1];
++					break;
++				case 4:
++					/*Henning Akesson*/
++					drag = -4e-15 * surface + 8.6e-12;
++					ub=-drag*rho_ice*gravity*thickness*slope[0];
++					vb=-drag*rho_ice*gravity*thickness*slope[1];
++					break;
++				default:
++					_error_("Not supported yet");
++			}
+ 
+ 			pe->values[2*nodedown+0]+=ub/connectivity[0];
+ 			pe->values[2*nodedown+1]+=vb/connectivity[0];
Index: issm/oecreview/Archive/16554-17801/ISSM-17348-17349.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17348-17349.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17348-17349.diff	(revision 17802)
@@ -0,0 +1,1153 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 17348)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 17349)
+@@ -32,6 +32,10 @@
+ 		/*Intermediaries*/
+ 		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		IssmDouble SedimentStoring(Element* element);
++		IssmDouble EplSpecificStoring(Element* element);
++		IssmDouble GetHydrologyDCInefficientHmax(Element* element, Gauss* gauss);
++		IssmDouble GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss);
++		IssmDouble GetHydrologyPVectorTransfer(Element* element, Gauss* gauss);
+ 		void ElementizeEplMask(FemModel* femmodel);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17348)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17349)
+@@ -54,9 +54,10 @@
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
+ 	iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+-	iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
+ 	iomodel->FetchDataToInput(elements,EplHeadEnum);
++	iomodel->FetchDataToInput(elements,SedimentHeadEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcEplInitialThicknessEnum);
++	iomodel->FetchDataToInput(elements,HydrologydcSedimentTransmitivityEnum);
+ 
+ 	//	iomodel->FetchDataToInput(elements,HydrologydcMaskEplactiveNodeEnum);
+ 	
+@@ -139,6 +140,7 @@
+ 	/* Intermediaries */
+ 	IssmDouble  D_scalar,Jdet,dt;
+ 	IssmDouble  epl_thickness;
++	IssmDouble  transfer;
+ 	IssmDouble *xyz_list = NULL;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -153,18 +155,17 @@
+ 	/*Retrieve all inputs and parameters*/
+ 	basalelement->GetVerticesCoordinates(&xyz_list);
+ 	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
+-	Input* thickness_input=basalelement->GetInput(HydrologydcEplThicknessEnum); _assert_(thickness_input);
+-	IssmDouble epl_specificstoring = EplSpecificStoring(basalelement);
+-	IssmDouble epl_conductivity    = basalelement->GetMaterialParameter(HydrologydcEplConductivityEnum);
++	Input* thickness_input = basalelement->GetInput(HydrologydcEplThicknessEnum);          _assert_(thickness_input);
++	IssmDouble epl_specificstoring   = EplSpecificStoring(basalelement);
++	IssmDouble epl_conductivity      = basalelement->GetMaterialParameter(HydrologydcEplConductivityEnum);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	Gauss* gauss=basalelement->NewGauss(2);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-		gauss->GaussPoint(ig);
++		gauss           ->GaussPoint(ig);
++		basalelement    ->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		thickness_input ->GetInputValue(&epl_thickness,gauss);
+ 
+-		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
+-		thickness_input->GetInputValue(&epl_thickness,gauss);
+-
+ 		/*Diffusivity*/
+ 		D_scalar=epl_conductivity*epl_thickness*gauss->weight*Jdet;
+ 		if(dt!=0.) D_scalar=D_scalar*dt;
+@@ -178,15 +179,23 @@
+ 
+ 		/*Transient*/
+ 		if(dt!=0.){
+-			basalelement->NodalFunctions(basis,gauss);
++			basalelement->NodalFunctions(&basis[0],gauss);
+ 			D_scalar=epl_specificstoring*epl_thickness*gauss->weight*Jdet;
+ 			TripleMultiply(basis,numnodes,1,0,
+ 						&D_scalar,1,1,0,
+ 						basis,1,numnodes,0,
+ 						&Ke->values[0],1);
++			
++			/*Transfer EPL part*/
++			transfer=GetHydrologyKMatrixTransfer(basalelement,gauss);
++			basalelement->NodalFunctions(&basis[0],gauss);
++			D_scalar=transfer*gauss->weight*Jdet*dt;
++			TripleMultiply(basis,numnodes,1,0,
++										 &D_scalar,1,1,0,
++										 basis,1,numnodes,0,
++										 &Ke->values[0],1);
+ 		}
+ 	}
+-
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+@@ -223,9 +232,12 @@
+ 		return NULL;
+ 	}
+ 	/*Intermediaries */
+-	IssmDouble dt,scalar,water_head,connectivity;
+-	IssmDouble transfer,residual,epl_thickness;
++	IssmDouble dt,scalar,water_head;
++	IssmDouble transfer;
++	IssmDouble epl_thickness;
+ 	IssmDouble Jdet;
++	IssmDouble residual,connectivity;
++
+ 	IssmDouble *xyz_list     = NULL;
+ 	Input*      old_wh_input = NULL;
+ 
+@@ -239,34 +251,30 @@
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	basalelement->GetVerticesCoordinates(&xyz_list);
++	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);	
++
++	Input* residual_input  = basalelement->GetInput(SedimentHeadResidualEnum);    _assert_(residual_input);
++	Input* thickness_input = basalelement->GetInput(HydrologydcEplThicknessEnum); _assert_(thickness_input);
++	if(dt!= 0.){old_wh_input = basalelement->GetInput(EplHeadOldEnum);            _assert_(old_wh_input);}
++
+ 	IssmDouble epl_specificstoring = EplSpecificStoring(basalelement);
+-	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
+-	Input* residual_input    = basalelement->GetInput(SedimentHeadResidualEnum);    _assert_(residual_input);
+-	Input* transfer_input    = basalelement->GetInput(WaterTransferEnum);           _assert_(transfer_input);
+-	Input* thickness_input   = basalelement->GetInput(HydrologydcEplThicknessEnum); _assert_(thickness_input);
+-	if(dt!= 0.){old_wh_input = basalelement->GetInput(EplHeadOldEnum);              _assert_(old_wh_input);}
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	Gauss* gauss=basalelement->NewGauss(2);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		gauss->GaussPoint(ig);
+ 
+-		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
+-		basalelement->NodalFunctions(basis,gauss);
++		basalelement ->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		basalelement ->NodalFunctions(basis,gauss);
+ 
+-		/*Loading term*/
+-		transfer_input->GetInputValue(&transfer,gauss);
+-		scalar = Jdet*gauss->weight*(-transfer);
+-		if(dt!=0.) scalar = scalar*dt;
+-		
+-		for(int i=0;i<numnodes;i++)pe->values[i]+=scalar*basis[i];
+-		
+-		/*Transient term*/
++		/*Transient and transfer terms*/
+ 		if(dt!=0.){
+-			thickness_input->GetInputValue(&epl_thickness,gauss);
+-			old_wh_input->GetInputValue(&water_head,gauss);
+-			scalar = Jdet*gauss->weight*water_head*epl_specificstoring*epl_thickness;
++			old_wh_input    ->GetInputValue(&water_head,gauss);
++			thickness_input ->GetInputValue(&epl_thickness,gauss);
+ 			
++			/*Dealing with the sediment part of the transfer term*/
++			transfer=GetHydrologyPVectorTransfer(basalelement,gauss);
++			scalar = Jdet*gauss->weight*((water_head*epl_specificstoring*epl_thickness)+(transfer*dt));
+ 			for(int i=0;i<numnodes;i++)pe->values[i]+=scalar*basis[i];
+ 		}
+ 	}
+@@ -280,6 +288,7 @@
+ 		connectivity = IssmDouble(basalelement->VertexConnectivity(iv));
+ 		residual_input->GetInputValue(&residual,gauss);
+ 		pe->values[iv]+=residual/connectivity;
++
+ 	}
+ 
+ 	/*Clean up and return*/
+@@ -317,23 +326,17 @@
+ 	basalelement->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+ 	
+ 	IssmDouble* eplHeads    = xNew<IssmDouble>(numnodes);
+-	/* IssmDouble* relaxed    = xNew<IssmDouble>(numnodes); */
+-	/* IssmDouble* eplOldHeads    = xNew<IssmDouble>(numnodes); */
+-	IssmDouble  Stepping;
++	IssmDouble* eplOldHeads    = xNew<IssmDouble>(numnodes); 
+ 
+-
+ 	/*Get previous water head*/
+-	//basalelement->GetInputListOnNodes(&eplOldHeads[0],EplHeadEnum);
++	basalelement->GetInputListOnNodes(&eplOldHeads[0],EplHeadEnum);
+ 
+ 	/*Use the dof list to index into the solution vector: */
+ 	for(i=0;i<numnodes;i++){
+ 		eplHeads[i]=solution[doflist[i]];
+ 		if(xIsNan<IssmDouble>(eplHeads[i])) _error_("NaN found in solution vector");
++
+ 	}
+-	
+-	/* for(i=0;i<numnodes;i++) { */
+-	/* 	relaxed[i] = eplOldHeads[i]+0.8*(eplHeads[i]-eplOldHeads[i]); */
+-	/* } */
+ 	/*Add input to the element: */
+ 	element->AddBasalInput(EplHeadEnum,eplHeads,P1Enum);
+ 
+@@ -357,6 +360,137 @@
+ 	IssmDouble water_compressibility = element->GetMaterialParameter(HydrologydcWaterCompressibilityEnum);
+ 	return rho_freshwater*g*epl_porosity*(water_compressibility+(epl_compressibility/epl_porosity));		 
+ }/*}}}*/
++IssmDouble HydrologyDCEfficientAnalysis::SedimentStoring(Element* element){/*{{{*/
++	IssmDouble rho_freshwater           = element->GetMaterialParameter(MaterialsRhoFreshwaterEnum);
++	IssmDouble g                        = element->GetMaterialParameter(ConstantsGEnum);
++	IssmDouble sediment_porosity        = element->GetMaterialParameter(HydrologydcSedimentPorosityEnum);
++	IssmDouble sediment_thickness       = element->GetMaterialParameter(HydrologydcSedimentThicknessEnum);
++	IssmDouble sediment_compressibility = element->GetMaterialParameter(HydrologydcSedimentCompressibilityEnum);
++	IssmDouble water_compressibility    = element->GetMaterialParameter(HydrologydcWaterCompressibilityEnum);
++	return rho_freshwater*g*sediment_porosity*sediment_thickness*(water_compressibility+(sediment_compressibility/sediment_porosity));		 
++}/*}}}*/
++IssmDouble HydrologyDCEfficientAnalysis::GetHydrologyDCInefficientHmax(Element* element, Gauss* gauss){/*{{{*/
++	int        hmax_flag;
++	IssmDouble h_max;
++	IssmDouble rho_ice,rho_water;
++	IssmDouble thickness,bed;
++	/*Get the flag to the limitation method*/
++	element->FindParam(&hmax_flag,HydrologydcSedimentlimitFlagEnum);
++	
++	/*Switch between the different cases*/
++	switch(hmax_flag){
++	case 0:
++		h_max=1.0e+10;
++		break;
++	case 1:
++		element->FindParam(&h_max,HydrologydcSedimentlimitEnum);
++		break;
++	case 2:
++		rho_water= element->GetMaterialParameter(MaterialsRhoFreshwaterEnum);
++		rho_ice= element->GetMaterialParameter(MaterialsRhoIceEnum);
++		element->GetInputValue(&thickness,gauss,ThicknessEnum);
++		element->GetInputValue(&bed,gauss,BedEnum);
++		h_max=((rho_ice*thickness)/rho_water)+bed;
++		break;
++	case 3:
++		_error_("Using normal stress  not supported yet");
++		break;
++	default:
++		_error_("no case higher than 3 for SedimentlimitFlag");
++	}
++	return h_max;
++}/*}}}*/
++IssmDouble HydrologyDCEfficientAnalysis::GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss){/*{{{*/
++	
++	int transfermethod;
++	IssmDouble epl_thickness;
++	IssmDouble epl_head,sed_head;
++	IssmDouble sediment_transmitivity;
++	IssmDouble leakage,residual,transfer;
++
++	IssmDouble sediment_thickness  = element->GetMaterialParameter(HydrologydcSedimentThicknessEnum);
++	IssmDouble sediment_storing    = SedimentStoring(element);
++ 	IssmDouble epl_specificstoring = EplSpecificStoring(element);		
++
++	element->FindParam(&transfermethod,HydrologydcTransferFlagEnum);
++	/*Switch between the different transfer methods cases*/
++	switch(transfermethod){
++	case 0:
++		/*Just keepping the transfer to zero, should be OK with the initial value of transfer*/
++		break;
++	case 1:
++
++		element->GetInputValue(&epl_thickness,gauss,HydrologydcEplThicknessEnum);
++		element->GetInputValue(&sed_head,gauss,SedimentHeadEnum);
++		element->GetInputValue(&epl_head,gauss,EplHeadEnum);
++		element->GetInputValue(&sediment_transmitivity,gauss,HydrologydcSedimentTransmitivityEnum);
++		element->GetInputValue(&residual,gauss,SedimentHeadResidualEnum);
++		element->FindParam(&leakage,HydrologydcLeakageFactorEnum);
++
++		if(epl_head>sed_head){
++			if(residual>0.0){	
++				transfer=0.0;
++			}
++			else{
++				transfer=(epl_specificstoring*epl_thickness*sediment_transmitivity)/(sediment_thickness*leakage);
++			}
++		}
++		else{
++			transfer=(sediment_storing*sediment_transmitivity)/(sediment_thickness*leakage);
++		}
++		break;
++	default:
++		_error_("no case higher than 1 for the Transfer method");
++	}
++	
++	return transfer;
++}/*}}}*/
++
++IssmDouble HydrologyDCEfficientAnalysis::GetHydrologyPVectorTransfer(Element* element, Gauss* gauss){/*{{{*/
++
++	int transfermethod;
++	IssmDouble epl_thickness;
++	IssmDouble epl_head,sediment_head;
++	IssmDouble sediment_transmitivity;
++	IssmDouble leakage,residual,transfer;
++
++	IssmDouble sediment_thickness = element->GetMaterialParameter(HydrologydcSedimentThicknessEnum);
++	IssmDouble sediment_storing   = SedimentStoring(element);
++ 	IssmDouble epl_specificstoring = EplSpecificStoring(element);		
++
++	element->FindParam(&transfermethod,HydrologydcTransferFlagEnum);
++	/*Switch between the different transfer methods cases*/
++	switch(transfermethod){
++	case 0:
++		/*Just keepping the transfer to zero, should be OK with the initial value of transfer*/
++		break;
++	case 1:
++
++		element->GetInputValue(&epl_thickness,gauss,HydrologydcEplThicknessEnum);
++		element->GetInputValue(&sediment_head,gauss,SedimentHeadEnum);
++		element->GetInputValue(&epl_head,gauss,EplHeadEnum);
++		element->GetInputValue(&sediment_transmitivity,gauss,HydrologydcSedimentTransmitivityEnum);
++		element->GetInputValue(&residual,gauss,SedimentHeadResidualEnum);
++		element->FindParam(&leakage,HydrologydcLeakageFactorEnum);
++		
++		if(epl_head>sediment_head){
++			if(residual>0.0){	
++				transfer=0.0;
++			}
++			else{
++				transfer=(epl_specificstoring*epl_thickness*sediment_transmitivity*sediment_head)/(sediment_thickness*leakage);
++			}
++		}
++		else{
++			transfer=(sediment_storing*sediment_transmitivity*sediment_head)/(sediment_thickness*leakage);
++		}
++		break;
++	default:
++		_error_("no case higher than 1 for the Transfer method");
++	}
++	return transfer;
++}/*}}}*/
++
+ void HydrologyDCEfficientAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17348)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17349)
+@@ -89,6 +89,7 @@
+ 	iomodel->FetchDataToInput(elements,SedimentHeadEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcSedimentTransmitivityEnum);
+ 
++
+ 	if(isefficientlayer)iomodel->FetchDataToInput(elements,HydrologydcMaskEplactiveNodeEnum);
+ }/*}}}*/
+ void HydrologyDCInefficientAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+@@ -171,10 +172,15 @@
+ 	}
+ 
+ 	/*Intermediaries */
++	bool        active_element,isefficientlayer;
+ 	IssmDouble  D_scalar,Jdet,dt;
+ 	IssmDouble  sediment_transmitivity;
++	IssmDouble  transfer;
+ 	IssmDouble *xyz_list  = NULL;
+ 
++	/*Define transfer related variables*/
++	Input* active_element_input =NULL;
++
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = basalelement->GetNumberOfNodes();
+ 
+@@ -185,18 +191,24 @@
+ 	IssmDouble     D[2][2]= {0.};
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	basalelement                       ->GetVerticesCoordinates(&xyz_list);
+-	IssmDouble sediment_storing        = SedimentStoring(basalelement);
+-	Input* SedTrans_input=basalelement ->GetInput(HydrologydcSedimentTransmitivityEnum); _assert_(SedTrans_input);
+-	basalelement                       ->FindParam(&dt,TimesteppingTimeStepEnum);
++	basalelement ->GetVerticesCoordinates(&xyz_list);
++	basalelement ->FindParam(&dt,TimesteppingTimeStepEnum);
++	basalelement ->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);
+ 
++	Input* SedTrans_input       = basalelement->GetInput(HydrologydcSedimentTransmitivityEnum); _assert_(SedTrans_input);
++	IssmDouble sediment_storing = SedimentStoring(basalelement);
++	/*Transfer related Inputs*/
++	if(isefficientlayer){
++		active_element_input = basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);
++	}
++	
+ 	/* Start  looping on the number of gaussian points: */
+ 	Gauss* gauss=basalelement->NewGauss(2);
+ 	for(int ig=gauss -> begin();ig<gauss->end();ig++){
+ 		gauss          -> GaussPoint(ig);
+ 		basalelement   -> JacobianDeterminant(&Jdet,xyz_list,gauss);
+ 		SedTrans_input -> GetInputValue(&sediment_transmitivity,gauss);
+-
++		
+ 		/*Diffusivity*/
+ 		D_scalar=sediment_transmitivity*gauss->weight*Jdet;
+ 		if(dt!=0.) D_scalar=D_scalar*dt;
+@@ -204,21 +216,35 @@
+ 		D[1][1]=D_scalar;
+ 		GetB(B,basalelement,xyz_list,gauss); 
+ 		TripleMultiply(B,2,numnodes,1,
+-					&D[0][0],2,2,0,
+-					B,2,numnodes,0,
+-					&Ke->values[0],1);
++									 &D[0][0],2,2,0,
++									 B,2,numnodes,0,
++									 &Ke->values[0],1);
+ 
+ 		/*Transient*/
+ 		if(dt!=0.){
+ 			basalelement->NodalFunctions(&basis[0],gauss);
+ 			D_scalar=sediment_storing*gauss->weight*Jdet;
+ 			TripleMultiply(basis,numnodes,1,0,
+-						&D_scalar,1,1,0,
+-						basis,1,numnodes,0,
+-						&Ke->values[0],1);
++										 &D_scalar,1,1,0,
++										 basis,1,numnodes,0,
++										 &Ke->values[0],1);
++			
++			/*Transfer EPL part*/
++			if(isefficientlayer){
++				active_element_input->GetInputValue(&active_element);
++				if(active_element){
++					transfer=GetHydrologyKMatrixTransfer(basalelement,gauss);
++					
++					basalelement->NodalFunctions(&basis[0],gauss);
++					D_scalar=transfer*gauss->weight*Jdet*dt;
++					TripleMultiply(basis,numnodes,1,0,
++												 &D_scalar,1,1,0,
++												 basis,1,numnodes,0,
++												 &Ke->values[0],1);
++				}
++			}
+ 		}
+ 	}
+-
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(B);
+@@ -247,12 +273,15 @@
+ 	}
+ 
+ 	/*Intermediaries */
++	bool       active_element,isefficientlayer;
+ 	IssmDouble dt,scalar,water_head;
+ 	IssmDouble water_load,transfer;
+ 	IssmDouble Jdet;
+-	IssmDouble *xyz_list  = NULL;
+-	Input*      old_wh_input      = NULL;
+ 
++	IssmDouble *xyz_list             = NULL;
++	Input*      old_wh_input         = NULL;
++	Input*      active_element_input = NULL;
++
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = basalelement->GetNumberOfNodes();
+ 
+@@ -262,35 +291,57 @@
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	basalelement->GetVerticesCoordinates(&xyz_list);
+-	IssmDouble sediment_storing = SedimentStoring(basalelement);
+ 	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
++	basalelement->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);
++
+ 	Input* water_input       = basalelement->GetInput(BasalforcingsMeltingRateEnum); _assert_(water_input);
+-	Input* transfer_input    = basalelement->GetInput(WaterTransferEnum);            _assert_(transfer_input);
+ 	if(dt!= 0.){old_wh_input = basalelement->GetInput(SedimentHeadOldEnum);          _assert_(old_wh_input);}
+ 
++	IssmDouble sediment_storing    = SedimentStoring(basalelement);
++
++	/*Transfer related Inputs*/
++	if(isefficientlayer){
++		active_element_input = basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);
++	}
++
+ 	/* Start  looping on the number of gaussian points: */
+ 	Gauss* gauss=basalelement->NewGauss(2);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		gauss->GaussPoint(ig);
+-
++	
+ 		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
+ 		basalelement->NodalFunctions(basis,gauss);
+ 
+ 		/*Loading term*/
+ 		water_input->GetInputValue(&water_load,gauss);
+-		transfer_input->GetInputValue(&transfer,gauss);
+-		scalar = Jdet*gauss->weight*(water_load+transfer);
++	
++		scalar = Jdet*gauss->weight*(water_load);
+ 		if(dt!=0.) scalar = scalar*dt;
+-		for(int i=0;i<numnodes;i++) pe->values[i]+=scalar*basis[i];
+-
+-		/*Transient term*/
++		for(int i=0;i<numnodes;i++){
++			pe->values[i]+=scalar*basis[i];
++		}
++			
++		/*Transient and transfer terms*/
+ 		if(dt!=0.){
+-			old_wh_input->GetInputValue(&water_head,gauss);
+-			scalar = Jdet*gauss->weight*water_head*sediment_storing;
+-			for(int i=0;i<numnodes;i++) pe->values[i]+=scalar*basis[i];
++			old_wh_input    ->GetInputValue(&water_head,gauss);
++			if(isefficientlayer){
++				/*Dealing with the sediment part of the transfer term*/
++				active_element_input->GetInputValue(&active_element);
++				if(active_element){
++					transfer=GetHydrologyPVectorTransfer(basalelement,gauss);
++				}
++				else{
++					transfer=0.0;
++				}
++				scalar = Jdet*gauss->weight*((water_head*sediment_storing)+(dt*transfer));
++				for(int i=0;i<numnodes;i++)pe->values[i]+=scalar*basis[i];
++			}
++			else{
++				scalar = Jdet*gauss->weight*(water_head*sediment_storing);
++				for(int i=0;i<numnodes;i++)pe->values[i]+=scalar*basis[i];
++			}
+ 		}
+ 	}
+-
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+@@ -370,7 +421,7 @@
+ 		kappa=kmax*pow(10.,penalty_factor);
+ 
+ 		for(int i=0;i<numnodes;i++){
+-			basalelement->GetHydrologyDCInefficientHmax(&h_max,i);
++			basalelement->GetHydrologyDCInefficientHmax(&h_max,basalelement->GetNode(i));
+ 			if(values[i]>h_max) residual[i] = kappa*(values[i]-h_max);
+ 			else                residual[i] = 0.;
+ 		}
+@@ -401,6 +452,145 @@
+ 	IssmDouble water_compressibility    = element->GetMaterialParameter(HydrologydcWaterCompressibilityEnum);
+ 	return rho_freshwater*g*sediment_porosity*sediment_thickness*(water_compressibility+(sediment_compressibility/sediment_porosity));		 
+ }/*}}}*/
++
++IssmDouble HydrologyDCInefficientAnalysis::EplSpecificStoring(Element* element){/*{{{*/
++	IssmDouble rho_freshwater        = element->GetMaterialParameter(MaterialsRhoFreshwaterEnum);
++	IssmDouble g                     = element->GetMaterialParameter(ConstantsGEnum);
++	IssmDouble epl_porosity          = element->GetMaterialParameter(HydrologydcEplPorosityEnum);
++	IssmDouble epl_compressibility   = element->GetMaterialParameter(HydrologydcEplCompressibilityEnum);
++	IssmDouble water_compressibility = element->GetMaterialParameter(HydrologydcWaterCompressibilityEnum);
++	return rho_freshwater*g*epl_porosity*(water_compressibility+(epl_compressibility/epl_porosity));		 
++}/*}}}*/
++
++IssmDouble HydrologyDCInefficientAnalysis::GetHydrologyDCInefficientHmax(Element* element, Gauss* gauss){/*{{{*/
++	int        hmax_flag;
++	IssmDouble h_max;
++	IssmDouble rho_ice,rho_water;
++	IssmDouble thickness,bed;
++	/*Get the flag to the limitation method*/
++	element->FindParam(&hmax_flag,HydrologydcSedimentlimitFlagEnum);
++	
++	/*Switch between the different cases*/
++	switch(hmax_flag){
++	case 0:
++		h_max=1.0e+10;
++		break;
++	case 1:
++		element->FindParam(&h_max,HydrologydcSedimentlimitEnum);
++		break;
++	case 2:
++	
++		rho_water = element->GetMaterialParameter(MaterialsRhoFreshwaterEnum);
++		rho_ice   = element->GetMaterialParameter(MaterialsRhoIceEnum);
++
++		/*Compute max*/
++		/* thick_input->GetInputValue(&thickness,gauss); */
++		/* bed_input->GetInputValue(&bed,gauss); */
++		element->GetInputValue(&thickness,gauss,ThicknessEnum);
++		element->GetInputValue(&bed,gauss,BedEnum);
++		h_max=((rho_ice*thickness)/rho_water)+bed;
++		break;
++	case 3:
++		_error_("Using normal stress  not supported yet");
++		break;
++	default:
++		_error_("no case higher than 3 for SedimentlimitFlag");
++	}
++	return h_max;
++}/*}}}*/
++
++IssmDouble HydrologyDCInefficientAnalysis::GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss){/*{{{*/
++
++	int transfermethod;
++	IssmDouble epl_thickness;
++	IssmDouble epl_head,sed_head;
++	IssmDouble sediment_transmitivity;
++	IssmDouble leakage,h_max,transfer;
++
++	IssmDouble sediment_thickness  = element->GetMaterialParameter(HydrologydcSedimentThicknessEnum);
++	IssmDouble sediment_storing    = SedimentStoring(element);
++ 	IssmDouble epl_specificstoring = EplSpecificStoring(element);		
++
++	element->FindParam(&transfermethod,HydrologydcTransferFlagEnum);
++	/*Switch between the different transfer methods cases*/
++	switch(transfermethod){
++	case 0:
++		/*Just keepping the transfer to zero, should be OK with the initial value of transfer*/
++		break;
++	case 1:
++
++		element->GetInputValue(&epl_thickness,gauss,HydrologydcEplThicknessEnum);
++		element->GetInputValue(&sed_head,gauss,SedimentHeadEnum);
++		element->GetInputValue(&epl_head,gauss,EplHeadEnum);
++		element->GetInputValue(&sediment_transmitivity,gauss,HydrologydcSedimentTransmitivityEnum);
++		
++		element->FindParam(&leakage,HydrologydcLeakageFactorEnum);
++	
++		if(epl_head>sed_head){
++			h_max=GetHydrologyDCInefficientHmax(element,gauss);
++			if(sed_head>=h_max){
++				transfer=0.0;
++			}
++			else{
++				transfer=(epl_specificstoring*epl_thickness*sediment_transmitivity)/(sediment_thickness*leakage);
++			}
++		}
++		else{
++			transfer=(sediment_storing*sediment_transmitivity)/(sediment_thickness*leakage);
++		}
++		break;
++	default:
++		_error_("no case higher than 1 for the Transfer method");
++	}
++	
++	return transfer;
++}/*}}}*/
++
++IssmDouble HydrologyDCInefficientAnalysis::GetHydrologyPVectorTransfer(Element* element, Gauss* gauss){/*{{{*/
++
++	int transfermethod;
++	IssmDouble epl_thickness;
++	IssmDouble epl_head,sediment_head;
++	IssmDouble sediment_transmitivity;
++	IssmDouble leakage,h_max,transfer;
++
++	IssmDouble sediment_thickness = element->GetMaterialParameter(HydrologydcSedimentThicknessEnum);
++	IssmDouble sediment_storing   = SedimentStoring(element);
++ 	IssmDouble epl_specificstoring = EplSpecificStoring(element);		
++
++	element->FindParam(&transfermethod,HydrologydcTransferFlagEnum);
++	/*Switch between the different transfer methods cases*/
++	switch(transfermethod){
++	case 0:
++		/*Just keepping the transfer to zero, should be OK with the initial value of transfer*/
++		break;
++	case 1:
++
++		element->GetInputValue(&epl_thickness,gauss,HydrologydcEplThicknessEnum);
++		element->GetInputValue(&sediment_head,gauss,SedimentHeadEnum);
++		element->GetInputValue(&epl_head,gauss,EplHeadEnum);
++		element->GetInputValue(&sediment_transmitivity,gauss,HydrologydcSedimentTransmitivityEnum);
++		
++		element->FindParam(&leakage,HydrologydcLeakageFactorEnum);
++		if(epl_head>sediment_head){
++			h_max=GetHydrologyDCInefficientHmax(element,gauss);
++			if(sediment_head>=h_max){
++				transfer=0.0;
++			}
++			else{
++				transfer=(epl_specificstoring*epl_thickness*sediment_transmitivity*epl_head)/(sediment_thickness*leakage);
++			}
++		}
++		else{
++			transfer=(sediment_storing*sediment_transmitivity*epl_head)/(sediment_thickness*leakage);
++		}
++		break;
++	default:
++		_error_("no case higher than 1 for the Transfer method");
++	}
++	return transfer;
++}/*}}}*/
++
+ void HydrologyDCInefficientAnalysis::ElementizeEplMask(FemModel* femmodel){/*{{{*/
+ 
+ 	bool     element_active;
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 17348)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 17349)
+@@ -32,5 +32,9 @@
+ 		/*Intermediaries*/
+ 		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		IssmDouble EplSpecificStoring(Element* element);
++		IssmDouble SedimentStoring(Element* element);
++		IssmDouble GetHydrologyDCInefficientHmax(Element* element, Gauss* gauss);
++		IssmDouble GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss);
++		IssmDouble GetHydrologyPVectorTransfer(Element* element, Gauss* gauss);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17348)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17349)
+@@ -43,7 +43,7 @@
+ 	IssmDouble eps_hyd;
+ 	IssmDouble ndu_sed,nu_sed;
+ 	IssmDouble ndu_epl,nu_epl;
+-	IssmDouble SedConv,EplConv;
++	IssmDouble EplConv;
+ 
+ 	/*Recover parameters: */
+ 	femmodel->SetCurrentConfiguration(HydrologyDCInefficientAnalysisEnum);
+@@ -75,10 +75,10 @@
+ 
+ 	/*The real computation starts here, outermost loop is on the two layer system*/
+ 	for(;;){
++
++		EplConv=1.0;
+ 		sedcount=1;
+ 		eplcount=1;
+-		SedConv=1.0;
+-		EplConv=1.0;
+ 
+ 		/*If there is two layers we need an outer loop value to compute convergence*/
+ 		if(isefficientlayer){
+@@ -96,14 +96,16 @@
+ 		
+ 		/*Reset constraint on the ZigZag Lock, this thing doesn't work, it have to disapear*/
+ 		ResetConstraintsx(femmodel);
+-		sedconverged=false;
++
+ 		/* {{{ *//*Treating the sediment*/
+ 		for(;;){
++			sedconverged=false;
+ 			uf_sed_sub_iter=uf_sed->Duplicate();_assert_(uf_sed_sub_iter);
+ 			uf_sed->Copy(uf_sed_sub_iter);
+ 			/* {{{ *//*Loop on the sediment layer to deal with the penalization*/
+ 			for(;;){
+ 				/* {{{ *//*Core of the computation*/
++				if(VerboseSolution()) _printf0_("Building Sediment Matrix...\n");
+ 				SystemMatricesx(&Kff,&Kfs,&pf,&df,&sediment_kmax,femmodel);
+ 				CreateNodalConstraintsx(&ys,femmodel->nodes,HydrologyDCInefficientAnalysisEnum);
+ 				Reduceloadx(pf,Kfs,ys); delete Kfs;
+@@ -126,24 +128,17 @@
+ 				sedcount++;
+ 				if(sedconverged)break;
+ 			}
++		
+ 			/* }}} *//*End of the sediment penalization loop*/
+-			sedconverged=false;
+-			/*Update Elemental Mask and compute transfer*/
++			/*Update EPL mask*/
+ 			if(isefficientlayer){
+-				if(SedConv<0.3){
+-					HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
+-					analysis->ElementizeEplMask(femmodel);
+-					delete analysis;
+-					femmodel->HydrologyTransferx();
+-					transfered=true;
+-				}
+-				else{
+-					transfered=false;
+-				}
++				HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
++				analysis->ElementizeEplMask(femmodel);
++				delete analysis;
+ 			}
+-			else{
+-				transfered=true;
+-			}
++			
++			sedconverged=false;
++			
+ 			/*Checking convegence on the value of the sediment head*/
+ 			duf=uf_sed_sub_iter->Duplicate();_assert_(duf);
+ 			uf_sed_sub_iter->Copy(duf);
+@@ -153,14 +148,13 @@
+ 			nu_sed=uf_sed_sub_iter->Norm(NORM_TWO);
+ 			if (xIsNan<IssmDouble>(ndu_sed) || xIsNan<IssmDouble>(nu_sed)) _error_("convergence criterion is NaN!");
+ 			if (ndu_sed==0.0 && nu_sed==0.0) nu_sed=1.0e-6; /*Hacking the case where the layer is empty*/
+-			if(VerboseConvergence()) _printf0_(setw(50) << left << "   Inner Sediment Convergence criterion:" << ndu_sed/nu_sed*100 << " aiming lower than " << eps_hyd*100 << " %\n");
+-			SedConv = ndu_sed/nu_sed*100;
+-			if((ndu_sed/nu_sed)<eps_hyd){
++			if(VerboseConvergence()) _printf0_(setw(50) << left << "   Inner Sediment Convergence criterion:" << ndu_sed/nu_sed*100 << "%, aiming lower than " << eps_hyd*10*100 << " %\n");
++			if((ndu_sed/nu_sed)<eps_hyd*10.){
+ 				if(VerboseConvergence()) _printf0_("   # Inner sediment convergence achieve \n");
+ 				sedconverged=true;
+ 			}
+ 			delete uf_sed_sub_iter;
+-			if(sedconverged && transfered){
++			if(sedconverged){
+ 				femmodel->parameters->SetParam(sediment_kmax,HydrologySedimentKmaxEnum);
+ 				InputUpdateFromConstantx(femmodel,sedconverged,ConvergedEnum);
+ 				InputUpdateFromSolutionx(femmodel,ug_sed);
+@@ -178,16 +172,14 @@
+ 			InputUpdateFromConstantx(femmodel,true,ResetPenaltiesEnum);
+ 			InputUpdateFromConstantx(femmodel,false,ConvergedEnum);
+ 			femmodel->parameters->SetParam(HydrologyEfficientEnum,HydrologyLayerEnum);
+-		
+-			eplconverged=false;
++			EplConv=1.0;
+ 
+ 			for(;;){
+-
++				eplconverged=false;
+ 				ug_epl_sub_iter=ug_epl->Duplicate();_assert_(ug_epl_sub_iter);
+ 				ug_epl->Copy(ug_epl_sub_iter);
+ 
+-				if(EplConv<0.3){
+-					/* {{{ *//*Retriev the EPL head slopes and compute EPL Thickness*/
++				/* {{{ *//*Retriev the EPL head slopes and compute EPL Thickness*/
+ 					if(VerboseSolution()) _printf0_("computing EPL Head slope...\n");
+ 					femmodel->SetCurrentConfiguration(L2ProjectionEPLAnalysisEnum);
+ 					femmodel->UpdateConstraintsL2ProjectionEPLx();
+@@ -200,19 +192,13 @@
+ 					
+ 					//updating mask after the computation of the epl thickness (Allow to close too thin EPL)
+ 					femmodel->HydrologyEPLupdateDomainx();
+-					/* }}} */
+-				
+-					/*Update Elemental Mask and compute transfer*/
++
+ 					HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
+ 					analysis->ElementizeEplMask(femmodel);
+ 					delete analysis;
+-					femmodel->HydrologyTransferx();
+-					transfered=true;
+-				}
+-				else{
+-					transfered=false;
+-				}
+-				
++					/* }}} */
++					
++				if(VerboseSolution()) _printf0_("Building EPL Matrix...\n");
+ 				SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
+ 				CreateNodalConstraintsx(&ys,femmodel->nodes,HydrologyDCEfficientAnalysisEnum);
+ 				Reduceloadx(pf,Kfs,ys); delete Kfs;
+@@ -235,9 +221,9 @@
+ 				nu_epl=ug_epl_sub_iter->Norm(NORM_TWO);
+ 				if (xIsNan<IssmDouble>(ndu_epl) || xIsNan<IssmDouble>(nu_epl)) _error_("convergence criterion is NaN!");
+ 				if (ndu_epl==0.0 && nu_epl==0.0) nu_epl=1.0e-6; /*Hacking the case where the EPL is used but empty*/
+-				if(VerboseConvergence()) _printf0_(setw(50) << left << "   Inner EPL Convergence criterion:" << ndu_epl/nu_epl*100 << " aiming lower than " << eps_hyd*100 << " %\n");
+-				EplConv=ndu_epl/nu_epl*100;
+-				if((ndu_epl/nu_epl)<eps_hyd) eplconverged=true;
++				if(VerboseConvergence()) _printf0_(setw(50) << left << "   Inner EPL Convergence criterion:" << ndu_epl/nu_epl*100 << "%, aiming lower than " << eps_hyd*10*100 << " %\n");
++				EplConv=ndu_epl/nu_epl;
++				if((ndu_epl/nu_epl)<eps_hyd*10.) eplconverged=true;
+ 				if (eplcount>=hydro_maxiter){
+ 					_error_("   maximum number of EPL iterations (" << hydro_maxiter << ") exceeded");
+ 				}
+@@ -245,7 +231,7 @@
+ 				eplcount++;
+ 				
+ 				delete ug_epl_sub_iter;
+-				if(eplconverged && transfered){
++				if(eplconverged){
+ 					if(VerboseSolution()) _printf0_("eplconverged...\n");
+ 					InputUpdateFromConstantx(femmodel,eplconverged,ConvergedEnum);
+ 					InputUpdateFromSolutionx(femmodel,ug_epl);
+@@ -282,8 +268,8 @@
+ 					hydroconverged=true;
+ 				}
+ 				else{ 
+-					if(VerboseConvergence()) _printf0_(setw(50) << left << "   Sediment Convergence criterion:" << ndu_sed/nu_sed*100 << " aiming lower than " << eps_hyd*100 << " %\n");
+-					if(VerboseConvergence()) _printf0_(setw(50) << left << "   EPL Convergence criterion:" << ndu_epl/nu_epl*100 << " aiming lower than " << eps_hyd*100 << " %\n");
++					if(VerboseConvergence()) _printf0_(setw(50) << left << "   Sediment Convergence criterion:" << ndu_sed/nu_sed*100 << "%, aiming lower than " << eps_hyd*100 << " %\n");
++					if(VerboseConvergence()) _printf0_(setw(50) << left << "   EPL Convergence criterion:" << ndu_epl/nu_epl*100 << "%, aiming lower than " << eps_hyd*100 << " %\n");
+ 					hydroconverged=false;
+ 				}
+ 			}
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17348)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17349)
+@@ -282,7 +282,7 @@
+ 		virtual void UpdateConstraintsExtrudeFromBase(void)=0;
+ 		virtual void UpdateConstraintsExtrudeFromTop(void)=0;
+ 
+-		virtual void GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index)=0;
++		//		virtual void GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index)=0;
+ 		virtual void GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode)=0;
+ 		virtual void GetHydrologyTransfer(Vector<IssmDouble>* transfer)=0; 
+ 		virtual void HydrologyEPLGetMask(Vector<IssmDouble>* mask)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17348)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17349)
+@@ -4464,41 +4464,6 @@
+ }
+ /*}}}*/
+ /*FUNCTION Tria::GetHydrologyDCInefficientHmax{{{*/
+-void  Tria::GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index){
+-	
+-	int        hmax_flag;
+-	IssmDouble h_max;
+-	IssmDouble rho_ice,rho_water;
+-	IssmDouble thickness,bed;
+-	/*Get the flag to the limitation method*/
+-	this->parameters->FindParam(&hmax_flag,HydrologydcSedimentlimitFlagEnum);
+-	
+-	/*Switch between the different cases*/
+-	switch(hmax_flag){
+-	case 0:
+-		h_max=1.0e+10;
+-		break;
+-	case 1:
+-		parameters->FindParam(&h_max,HydrologydcSedimentlimitEnum);
+-		break;
+-	case 2:
+-		rho_ice=matpar->GetRhoIce();
+-		rho_water=matpar->GetRhoFreshwater();
+-		this->GetInputValue(&thickness,this->nodes[index],ThicknessEnum);
+-		this->GetInputValue(&bed,this->nodes[index],BedEnum);
+-		h_max=((rho_ice*thickness)/rho_water)+bed;
+-		break;
+-	case 3:
+-		_error_("Using normal stress  not supported yet");
+-		break;
+-	default:
+-		_error_("no case higher than 3 for SedimentlimitFlag");
+-	}
+-	/*Assign output pointer*/
+-	*ph_max=h_max;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::GetHydrologyDCInefficientHmax{{{*/
+ void  Tria::GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode){
+ 	
+ 	int        hmax_flag;
+@@ -4534,93 +4499,97 @@
+ }
+ /*}}}*/
+ /*FUNCTION Tria::GetHydrologyTransfer{{{*/
+-void  Tria::GetHydrologyTransfer(Vector<IssmDouble>* transfer){
++/*This thing should be useless and deleted soon*/
+ 
+-	const int  numdof   = NDOF1 *NUMVERTICES;
+-	int        *doflist = NULL;
+-	int        analysis_type;
+-	bool       isefficientlayer;
+-	bool       active_element;
+-	int        transfermethod;
+-	IssmDouble leakage,h_max;
+-	IssmDouble wh_trans,sed_thick;
+-	IssmDouble epl_specificstoring,sedstoring;
+-	IssmDouble activeEpl[numdof],epl_thickness[numdof],old_epl_thickness[numdof];
+-	IssmDouble epl_head[numdof],sed_head[numdof];
+-	IssmDouble preceding_transfer[numdof],sed_trans[numdof];
++/* void  Tria::GetHydrologyTransfer(Vector<IssmDouble>* transfer){ */
+ 
+-	Input* active_element_input=NULL;
++/* 	const int  numdof   = NDOF1 *NUMVERTICES; */
++/* 	int        *doflist = NULL; */
++/* 	int        analysis_type; */
++/* 	bool       isefficientlayer; */
++/* 	bool       active_element; */
++/* 	int        transfermethod; */
++/* 	IssmDouble leakage,h_max,dt,test; */
++/* 	IssmDouble wh_trans,sed_thick,relaxed; */
++/* 	IssmDouble epl_specificstoring,sedstoring; */
++/* 	IssmDouble activeEpl[numdof],epl_thickness[numdof],old_epl_thickness[numdof]; */
++/* 	IssmDouble epl_head[numdof],sed_head[numdof]; */
++/* 	IssmDouble epl_head_old[numdof],sed_head_old[numdof]; */
++/* 	IssmDouble preceding_transfer[numdof],sed_trans[numdof]; */
+ 
+-	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-		
+-	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
++/* 	Input* active_element_input=NULL; */
+ 
+-	/*Get the flag to know if the efficient layer is present*/
+-	this->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);
+ 
+-	if(isefficientlayer){
+-		/*Also get the flag to the transfer method*/
+-		this->parameters->FindParam(&transfermethod,HydrologydcTransferFlagEnum);
++/* 	parameters->FindParam(&analysis_type,AnalysisTypeEnum); */
+ 		
+-		/*Switch between the different transfer methods cases*/
+-		switch(transfermethod){
+-		case 0:
+-			/*Just keepping the transfer to zero, should be OK with the initial value of transfer*/
+-			break;
+-		case 1:
++/* 	GetDofList(&doflist,NoneApproximationEnum,GsetEnum); */
++
++/* 	/\*Get the flag to know if the efficient layer is present*\/ */
++/* 	this->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum); */
++
++/* 	if(isefficientlayer){ */
++/* 		/\*Also get the flag to the transfer method*\/ */
++/* 		this->parameters->FindParam(&transfermethod,HydrologydcTransferFlagEnum); */
++/* 		this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);		 */
++/* 		/\*Switch between the different transfer methods cases*\/ */
++/* 		switch(transfermethod){ */
++/* 		case 0: */
++/* 			/\*Just keepping the transfer to zero, should be OK with the initial value of transfer*\/ */
++/* 			break; */
++/* 		case 1: */
+ 	
+-			active_element_input=inputs->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);
+-			active_element_input->GetInputValue(&active_element);
++/* 			active_element_input=inputs->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input); */
++/* 			active_element_input->GetInputValue(&active_element); */
+ 
+-			GetInputListOnVertices(&sed_head[0],SedimentHeadEnum);
+-			GetInputListOnVertices(&sed_trans[0],HydrologydcSedimentTransmitivityEnum);
+-			GetInputListOnVertices(&epl_head[0],EplHeadEnum);
+-			GetInputListOnVertices(&epl_thickness[0],HydrologydcEplThicknessEnum);			
++/* 			GetInputListOnVertices(&sed_head[0],SedimentHeadEnum); */
++/* 			GetInputListOnVertices(&sed_head_old[0],SedimentHeadOldEnum); */
++/* 			GetInputListOnVertices(&sed_trans[0],HydrologydcSedimentTransmitivityEnum); */
++/* 			GetInputListOnVertices(&epl_head[0],EplHeadEnum); */
++/* 			GetInputListOnVertices(&epl_head_old[0],EplHeadOldEnum); */
++/* 			GetInputListOnVertices(&epl_thickness[0],HydrologydcEplThicknessEnum);			 */
+ 
+-			this->parameters->FindParam(&leakage,HydrologydcLeakageFactorEnum);
++/* 			this->parameters->FindParam(&leakage,HydrologydcLeakageFactorEnum); */
+ 
+-			sed_thick = matpar->GetSedimentThickness();
++/* 			sed_thick = matpar->GetSedimentThickness(); */
+ 
+-			if(!active_element){
+-				/*No transfer if the EPL is not active*/
+-			}
+-			else{
+-				GetInputListOnVertices(&preceding_transfer[0],WaterTransferEnum);
+-				sedstoring=matpar->GetSedimentStoring();
+-				epl_specificstoring=matpar->GetEplSpecificStoring();
+-					
+-				for(int i=0;i<numdof;i++){
+-					this->GetHydrologyDCInefficientHmax(&h_max,i);
+-			
+-					/*EPL head higher than sediment head, transfer from the epl to the sediment*/
+-					if(epl_head[i]>sed_head[i]){
+-						wh_trans=epl_specificstoring*epl_thickness[i]*sed_trans[i]*(epl_head[i]-sed_head[i])/(leakage*sed_thick);
++/* 			if(!active_element){ */
++
+ 						
+-						/*No transfer if the sediment head is allready at the maximum*/
+-						if(sed_head[i]>=h_max){
+-							wh_trans=0.0;
+-						}
+-					}
+-					/* EPL head lower than sediment head, transfer from the sediment to the epl */
+-					else if(epl_head[i]<=sed_head[i]){
+-						wh_trans=sedstoring*sed_trans[i]*(epl_head[i]-sed_head[i])/(leakage*sed_thick);
+-					}
++/* 				/\*No transfer if the EPL is not active*\/ */
++/* 			} */
++/* 			else{ */
++/* 				GetInputListOnVertices(&preceding_transfer[0],WaterTransferEnum); */
++/* 				sedstoring=matpar->GetSedimentStoring(); */
++/* 				epl_specificstoring=matpar->GetEplSpecificStoring(); */
+ 					
+-					/*Relaxation stuff*/
+-					wh_trans=preceding_transfer[i]+0.8*(wh_trans-preceding_transfer[i]);
++/* 				for(int i=0;i<numdof;i++){ */
++/* 					this->GetHydrologyDCInefficientHmax(&h_max,this->nodes[i]); */
++/* 					/\*EPL head higher than sediment head, transfer from the epl to the sediment*\/ */
++/* 					if(epl_head[i]>sed_head[i]){ */
++/* 						if(sed_head[i]>=h_max){ */
++/* 							wh_trans=0.0; */
++/* 						} */
++/* 						else{ */
++/* 							wh_trans=epl_specificstoring*epl_thickness[i]*sed_trans[i]*(epl_head[i]-sed_head[i])/(leakage*sed_thick); */
++/* 						}						 */
++/* 					} */
++/* 					/\* EPL head lower than sediment head, transfer from the sediment to the epl *\/ */
++/* 					else if(epl_head[i]<=sed_head[i]){ */
++/* 						wh_trans=sedstoring*sed_trans[i]*(epl_head[i]-sed_head[i])/(leakage*sed_thick); */
++/* 					}  */
+ 					
+-					/*Assign output pointer*/
+-					transfer->SetValue(doflist[i],wh_trans,INS_VAL);
+-				}
+-			}
+-			break;
+-		default:
+-			_error_("no case higher than 1 for the Transfer method");
+-		}
+-	}
+-	/*Free ressources:*/
+-	xDelete<int>(doflist);
+-}
++/* 					/\*Assign output pointer*\/ */
++/* 					transfer->SetValue(doflist[i],wh_trans,INS_VAL); */
++/* 				} */
++/* 			} */
++/* 			break; */
++/* 		default: */
++/* 			_error_("no case higher than 1 for the Transfer method"); */
++/* 		} */
++/* 	} */
++/* 	/\*Free ressources:*\/ */
++/* 	xDelete<int>(doflist); */
++/* } */
+ /*}}}*/
+ /*FUNCTION Tria::HydrologyEPLGetActive {{{*/
+ void Tria::HydrologyEPLGetActive(Vector<IssmDouble>* active_vec){
+@@ -4689,10 +4658,11 @@
+ 			/*If epl thickness gets under , close the layer*/
+ 			if(epl_thickness[i]<0.001*init_thick){
+ 				vec_mask->SetValue(nodes[i]->Sid(),0.,INS_VAL);
++				epl_thickness[i]=init_thick;
+ 			}
+ 		}
+ 		/*Increase of the efficient system is needed if the epl head reach the maximum value (sediment max value for now)*/
+-		this->GetHydrologyDCInefficientHmax(&h_max,i);
++		this->GetHydrologyDCInefficientHmax(&h_max,this->nodes[i]);
+ 		if(eplhead[i]>=h_max && active_element){
+ 			for(j=0;j<numdof;j++){
+ 				if(old_active[j]>0.){
+@@ -4771,11 +4741,8 @@
+ 				/*And proceed to the real thing*/
+ 				thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*EPLgrad2-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
+ 					
+-				/*Relaxation stuff*/
+-				if(thickness[i]<10.0*init_thick){
+-					thickness[i] = preceding_thickness[i]+0.8*(thickness[i]-preceding_thickness[i]);
+-				}
+-				else{
++				/*Take care of otherthikening*/
++				if(thickness[i]>10.0*init_thick){
+ 					thickness[i] = 10.0*init_thick;
+ 				}
+ 			}
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17348)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17349)
+@@ -253,7 +253,7 @@
+ 
+ 		ElementMatrix* CreateEPLDomainMassMatrix(void);
+ 		void           CreateHydrologyWaterVelocityInput(void);
+-		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index);
++		//		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index);
+ 		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode);
+ 		void           GetHydrologyTransfer(Vector<IssmDouble>* transfer);
+ 		void           HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17348)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17349)
+@@ -242,7 +242,7 @@
+ 
+ 		ElementMatrix* CreateEPLDomainMassMatrix(void);
+ 		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode);
+-		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index){_error_("not implemented yet");};
++		//		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index){_error_("not implemented yet");};
+ 		void           GetHydrologyTransfer(Vector<IssmDouble>* transfer);
+ 		void           HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
+ 		void           HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17348)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17349)
+@@ -150,7 +150,7 @@
+ 		void        GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
+ 
+ 		void    GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode){_error_("not implemented yet");};
+-		void    GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index){_error_("not implemented yet");};
++		//		void    GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index){_error_("not implemented yet");};
+ 		void    GetHydrologyTransfer(Vector<IssmDouble>* transfer){_error_("not implemented yet");};
+ 		void    HydrologyEPLGetActive(Vector<IssmDouble>* active_vec){_error_("not implemented yet");};
+ 		void    HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-17349-17350.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17349-17350.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17349-17350.diff	(revision 17802)
@@ -0,0 +1,22 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17349)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17350)
+@@ -4501,7 +4501,7 @@
+ /*FUNCTION Tria::GetHydrologyTransfer{{{*/
+ /*This thing should be useless and deleted soon*/
+ 
+-/* void  Tria::GetHydrologyTransfer(Vector<IssmDouble>* transfer){ */
++ void  Tria::GetHydrologyTransfer(Vector<IssmDouble>* transfer){ 
+ 
+ /* 	const int  numdof   = NDOF1 *NUMVERTICES; */
+ /* 	int        *doflist = NULL; */
+@@ -4589,7 +4589,7 @@
+ /* 	} */
+ /* 	/\*Free ressources:*\/ */
+ /* 	xDelete<int>(doflist); */
+-/* } */
++ } 
+ /*}}}*/
+ /*FUNCTION Tria::HydrologyEPLGetActive {{{*/
+ void Tria::HydrologyEPLGetActive(Vector<IssmDouble>* active_vec){
Index: issm/oecreview/Archive/16554-17801/ISSM-17350-17351.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17350-17351.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17350-17351.diff	(revision 17802)
@@ -0,0 +1,126 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17350)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17351)
+@@ -47,19 +47,16 @@
+ 			counter++;
+ 		}
+ 	}
+-
+ 	iomodel->FetchDataToInput(elements,ThicknessEnum);
+-	iomodel->FetchDataToInput(elements,SurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,BedEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
+-	iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,EplHeadEnum);
+ 	iomodel->FetchDataToInput(elements,SedimentHeadEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcEplInitialThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcSedimentTransmitivityEnum);
+ 
+-	//	iomodel->FetchDataToInput(elements,HydrologydcMaskEplactiveNodeEnum);
++	iomodel->FetchDataToInput(elements,HydrologydcMaskEplactiveNodeEnum);
+ 	
+ 	elements->InputDuplicate(HydrologydcEplInitialThicknessEnum,HydrologydcEplThicknessEnum);
+ 
+@@ -130,7 +127,7 @@
+ 	}
+ 
+ 	/*Check that all nodes are active, else return empty matrix*/
+-	if(!basalelement->AllActive()) {
++	if(!basalelement->AllActive()) { /*This could probably replaced by active elt mask*/
+ 	if(meshtype!=Mesh2DhorizontalEnum){
+ 			basalelement->DeleteMaterials(); 
+ 			delete basalelement;
+@@ -326,11 +323,7 @@
+ 	basalelement->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+ 	
+ 	IssmDouble* eplHeads    = xNew<IssmDouble>(numnodes);
+-	IssmDouble* eplOldHeads    = xNew<IssmDouble>(numnodes); 
+ 
+-	/*Get previous water head*/
+-	basalelement->GetInputListOnNodes(&eplOldHeads[0],EplHeadEnum);
+-
+ 	/*Use the dof list to index into the solution vector: */
+ 	for(i=0;i<numnodes;i++){
+ 		eplHeads[i]=solution[doflist[i]];
+@@ -346,6 +339,7 @@
+ 	xDelete<int>(doflist);
+ 	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ } /*}}}*/
++
+ void HydrologyDCEfficientAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+ 	/*Default, do nothing*/
+ 	return;
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17350)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17351)
+@@ -136,7 +136,6 @@
+ 				analysis->ElementizeEplMask(femmodel);
+ 				delete analysis;
+ 			}
+-			
+ 			sedconverged=false;
+ 			
+ 			/*Checking convegence on the value of the sediment head*/
+@@ -174,30 +173,31 @@
+ 			femmodel->parameters->SetParam(HydrologyEfficientEnum,HydrologyLayerEnum);
+ 			EplConv=1.0;
+ 
++
+ 			for(;;){
+ 				eplconverged=false;
+ 				ug_epl_sub_iter=ug_epl->Duplicate();_assert_(ug_epl_sub_iter);
+ 				ug_epl->Copy(ug_epl_sub_iter);
+ 
+ 				/* {{{ *//*Retriev the EPL head slopes and compute EPL Thickness*/
+-					if(VerboseSolution()) _printf0_("computing EPL Head slope...\n");
+-					femmodel->SetCurrentConfiguration(L2ProjectionEPLAnalysisEnum);
+-					femmodel->UpdateConstraintsL2ProjectionEPLx();
+-					femmodel->parameters->SetParam(EplHeadSlopeXEnum,InputToL2ProjectEnum);
+-					solutionsequence_linear(femmodel);
+-					femmodel->parameters->SetParam(EplHeadSlopeYEnum,InputToL2ProjectEnum);
+-					solutionsequence_linear(femmodel);
+-					femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
+-					femmodel->HydrologyEPLThicknessx();
++				if(VerboseSolution()) _printf0_("computing EPL Head slope...\n");
++				femmodel->SetCurrentConfiguration(L2ProjectionEPLAnalysisEnum);
++				femmodel->UpdateConstraintsL2ProjectionEPLx();
++				femmodel->parameters->SetParam(EplHeadSlopeXEnum,InputToL2ProjectEnum);
++				solutionsequence_linear(femmodel);
++				femmodel->parameters->SetParam(EplHeadSlopeYEnum,InputToL2ProjectEnum);
++				solutionsequence_linear(femmodel);
++				femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
++				femmodel->HydrologyEPLThicknessx();
++				
++				//updating mask after the computation of the epl thickness (Allow to close too thin EPL)
++				femmodel->HydrologyEPLupdateDomainx();
++				
++				HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
++				analysis->ElementizeEplMask(femmodel);
++				delete analysis;
++				/* }}} */
+ 					
+-					//updating mask after the computation of the epl thickness (Allow to close too thin EPL)
+-					femmodel->HydrologyEPLupdateDomainx();
+-
+-					HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
+-					analysis->ElementizeEplMask(femmodel);
+-					delete analysis;
+-					/* }}} */
+-					
+ 				if(VerboseSolution()) _printf0_("Building EPL Matrix...\n");
+ 				SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
+ 				CreateNodalConstraintsx(&ys,femmodel->nodes,HydrologyDCEfficientAnalysisEnum);
+@@ -282,8 +282,9 @@
+ 		if(hydroconverged)break;
+ 	}
+ 	/* }}} */
++	if(isefficientlayer)InputUpdateFromSolutionx(femmodel,ug_epl);
++	femmodel->SetCurrentConfiguration(HydrologyDCInefficientAnalysisEnum);
+ 	InputUpdateFromSolutionx(femmodel,ug_sed);
+-	if(isefficientlayer)InputUpdateFromSolutionx(femmodel,ug_epl);
+ 	/*Free ressources: */
+ 	delete ug_epl;
+ 	delete ug_sed;
Index: issm/oecreview/Archive/16554-17801/ISSM-17351-17352.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17351-17352.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17351-17352.diff	(revision 17802)
@@ -0,0 +1,44 @@
+Index: ../trunk-jpl/src/m/enum/WaterTransferEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/WaterTransferEnum.m	(revision 17351)
++++ ../trunk-jpl/src/m/enum/WaterTransferEnum.m	(revision 17352)
+@@ -1,11 +0,0 @@
+-function macro=WaterTransferEnum()
+-%WATERTRANSFERENUM - Enum of WaterTransfer
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=WaterTransferEnum()
+-
+-macro=StringToEnum('WaterTransfer');
+Index: ../trunk-jpl/src/m/enum/L2ProjectionTopAnalysisEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/L2ProjectionTopAnalysisEnum.m	(revision 17351)
++++ ../trunk-jpl/src/m/enum/L2ProjectionTopAnalysisEnum.m	(revision 17352)
+@@ -1,11 +0,0 @@
+-function macro=L2ProjectionTopAnalysisEnum()
+-%L2PROJECTIONTOPANALYSISENUM - Enum of L2ProjectionTopAnalysis
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=L2ProjectionTopAnalysisEnum()
+-
+-macro=StringToEnum('L2ProjectionTopAnalysis');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17351)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17352)
+@@ -129,7 +129,6 @@
+ def HydrologySedimentEnum(): return StringToEnum("HydrologySediment")[0]
+ def HydrologyEfficientEnum(): return StringToEnum("HydrologyEfficient")[0]
+ def HydrologySedimentKmaxEnum(): return StringToEnum("HydrologySedimentKmax")[0]
+-def WaterTransferEnum(): return StringToEnum("WaterTransfer")[0]
+ def IndependentObjectEnum(): return StringToEnum("IndependentObject")[0]
+ def InversionControlParametersEnum(): return StringToEnum("InversionControlParameters")[0]
+ def InversionCostFunctionThresholdEnum(): return StringToEnum("InversionCostFunctionThreshold")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17352-17353.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17352-17353.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17352-17353.diff	(revision 17802)
@@ -0,0 +1,458 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17352)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17353)
+@@ -55,8 +55,6 @@
+ 	iomodel->FetchDataToInput(elements,SedimentHeadEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcEplInitialThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcSedimentTransmitivityEnum);
+-
+-	iomodel->FetchDataToInput(elements,HydrologydcMaskEplactiveNodeEnum);
+ 	
+ 	elements->InputDuplicate(HydrologydcEplInitialThicknessEnum,HydrologydcEplThicknessEnum);
+ 
+@@ -185,7 +183,6 @@
+ 			
+ 			/*Transfer EPL part*/
+ 			transfer=GetHydrologyKMatrixTransfer(basalelement,gauss);
+-			basalelement->NodalFunctions(&basis[0],gauss);
+ 			D_scalar=transfer*gauss->weight*Jdet*dt;
+ 			TripleMultiply(basis,numnodes,1,0,
+ 										 &D_scalar,1,1,0,
+@@ -295,9 +292,11 @@
+ 	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
++
+ void HydrologyDCEfficientAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,EplHeadEnum);
+ }/*}}}*/
++
+ void HydrologyDCEfficientAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 
+ 	int meshtype,i;
+@@ -321,21 +320,18 @@
+ 
+ 	/*Fetch dof list and allocate solution vector*/
+ 	basalelement->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+-	
+ 	IssmDouble* eplHeads    = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Use the dof list to index into the solution vector: */
+ 	for(i=0;i<numnodes;i++){
+ 		eplHeads[i]=solution[doflist[i]];
+ 		if(xIsNan<IssmDouble>(eplHeads[i])) _error_("NaN found in solution vector");
+-
+ 	}
+ 	/*Add input to the element: */
+ 	element->AddBasalInput(EplHeadEnum,eplHeads,P1Enum);
+ 
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(eplHeads);
+-	//	xDelete<IssmDouble>(eplOldHeads);
+ 	xDelete<int>(doflist);
+ 	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ } /*}}}*/
+@@ -354,6 +350,7 @@
+ 	IssmDouble water_compressibility = element->GetMaterialParameter(HydrologydcWaterCompressibilityEnum);
+ 	return rho_freshwater*g*epl_porosity*(water_compressibility+(epl_compressibility/epl_porosity));		 
+ }/*}}}*/
++
+ IssmDouble HydrologyDCEfficientAnalysis::SedimentStoring(Element* element){/*{{{*/
+ 	IssmDouble rho_freshwater           = element->GetMaterialParameter(MaterialsRhoFreshwaterEnum);
+ 	IssmDouble g                        = element->GetMaterialParameter(ConstantsGEnum);
+@@ -363,11 +360,13 @@
+ 	IssmDouble water_compressibility    = element->GetMaterialParameter(HydrologydcWaterCompressibilityEnum);
+ 	return rho_freshwater*g*sediment_porosity*sediment_thickness*(water_compressibility+(sediment_compressibility/sediment_porosity));		 
+ }/*}}}*/
++
+ IssmDouble HydrologyDCEfficientAnalysis::GetHydrologyDCInefficientHmax(Element* element, Gauss* gauss){/*{{{*/
+ 	int        hmax_flag;
+ 	IssmDouble h_max;
+ 	IssmDouble rho_ice,rho_water;
+ 	IssmDouble thickness,bed;
++
+ 	/*Get the flag to the limitation method*/
+ 	element->FindParam(&hmax_flag,HydrologydcSedimentlimitFlagEnum);
+ 	
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17352)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17353)
+@@ -80,11 +80,9 @@
+ 	}
+ 
+ 	iomodel->FetchDataToInput(elements,ThicknessEnum);
+-	iomodel->FetchDataToInput(elements,SurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,BedEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
+-	iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
+ 	iomodel->FetchDataToInput(elements,SedimentHeadEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcSedimentTransmitivityEnum);
+@@ -234,7 +232,6 @@
+ 				active_element_input->GetInputValue(&active_element);
+ 				if(active_element){
+ 					transfer=GetHydrologyKMatrixTransfer(basalelement,gauss);
+-					
+ 					basalelement->NodalFunctions(&basis[0],gauss);
+ 					D_scalar=transfer*gauss->weight*Jdet*dt;
+ 					TripleMultiply(basis,numnodes,1,0,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17352)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17353)
+@@ -129,7 +129,6 @@
+ 	HydrologySedimentEnum,
+ 	HydrologyEfficientEnum,
+ 	HydrologySedimentKmaxEnum,
+-	WaterTransferEnum,
+ 	IndependentObjectEnum,
+ 	InversionControlParametersEnum,
+ 	InversionCostFunctionThresholdEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17352)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17353)
+@@ -137,7 +137,6 @@
+ 		case HydrologySedimentEnum : return "HydrologySediment";
+ 		case HydrologyEfficientEnum : return "HydrologyEfficient";
+ 		case HydrologySedimentKmaxEnum : return "HydrologySedimentKmax";
+-		case WaterTransferEnum : return "WaterTransfer";
+ 		case IndependentObjectEnum : return "IndependentObject";
+ 		case InversionControlParametersEnum : return "InversionControlParameters";
+ 		case InversionCostFunctionThresholdEnum : return "InversionCostFunctionThreshold";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17352)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17353)
+@@ -140,7 +140,6 @@
+    }
+    if(stage==2){
+ 	      if (strcmp(name,"HydrologySedimentKmax")==0) return HydrologySedimentKmaxEnum;
+-	      else if (strcmp(name,"WaterTransfer")==0) return WaterTransferEnum;
+ 	      else if (strcmp(name,"IndependentObject")==0) return IndependentObjectEnum;
+ 	      else if (strcmp(name,"InversionControlParameters")==0) return InversionControlParametersEnum;
+ 	      else if (strcmp(name,"InversionCostFunctionThreshold")==0) return InversionCostFunctionThresholdEnum;
+@@ -259,11 +258,11 @@
+ 	      else if (strcmp(name,"SteadystateReltol")==0) return SteadystateReltolEnum;
+ 	      else if (strcmp(name,"SteadystateRequestedOutputs")==0) return SteadystateRequestedOutputsEnum;
+ 	      else if (strcmp(name,"Surface")==0) return SurfaceEnum;
++	      else if (strcmp(name,"ThermalIsenthalpy")==0) return ThermalIsenthalpyEnum;
+          else stage=3;
+    }
+    if(stage==3){
+-	      if (strcmp(name,"ThermalIsenthalpy")==0) return ThermalIsenthalpyEnum;
+-	      else if (strcmp(name,"ThermalIsdynamicbasalspc")==0) return ThermalIsdynamicbasalspcEnum;
++	      if (strcmp(name,"ThermalIsdynamicbasalspc")==0) return ThermalIsdynamicbasalspcEnum;
+ 	      else if (strcmp(name,"ThermalMaxiter")==0) return ThermalMaxiterEnum;
+ 	      else if (strcmp(name,"ThermalPenaltyFactor")==0) return ThermalPenaltyFactorEnum;
+ 	      else if (strcmp(name,"ThermalPenaltyLock")==0) return ThermalPenaltyLockEnum;
+@@ -382,11 +381,11 @@
+ 	      else if (strcmp(name,"Vertices")==0) return VerticesEnum;
+ 	      else if (strcmp(name,"Results")==0) return ResultsEnum;
+ 	      else if (strcmp(name,"GenericParam")==0) return GenericParamEnum;
++	      else if (strcmp(name,"AdolcParam")==0) return AdolcParamEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"AdolcParam")==0) return AdolcParamEnum;
+-	      else if (strcmp(name,"BoolInput")==0) return BoolInputEnum;
++	      if (strcmp(name,"BoolInput")==0) return BoolInputEnum;
+ 	      else if (strcmp(name,"BoolParam")==0) return BoolParamEnum;
+ 	      else if (strcmp(name,"Contour")==0) return ContourEnum;
+ 	      else if (strcmp(name,"ControlInput")==0) return ControlInputEnum;
+@@ -505,11 +504,11 @@
+ 	      else if (strcmp(name,"VyMesh")==0) return VyMeshEnum;
+ 	      else if (strcmp(name,"VzMesh")==0) return VzMeshEnum;
+ 	      else if (strcmp(name,"Enthalpy")==0) return EnthalpyEnum;
++	      else if (strcmp(name,"EnthalpyPicard")==0) return EnthalpyPicardEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"EnthalpyPicard")==0) return EnthalpyPicardEnum;
+-	      else if (strcmp(name,"ThicknessAbsGradient")==0) return ThicknessAbsGradientEnum;
++	      if (strcmp(name,"ThicknessAbsGradient")==0) return ThicknessAbsGradientEnum;
+ 	      else if (strcmp(name,"ThicknessAlongGradient")==0) return ThicknessAlongGradientEnum;
+ 	      else if (strcmp(name,"ThicknessAcrossGradient")==0) return ThicknessAcrossGradientEnum;
+ 	      else if (strcmp(name,"IntMatParam")==0) return IntMatParamEnum;
+@@ -628,11 +627,11 @@
+ 	      else if (strcmp(name,"Separate")==0) return SeparateEnum;
+ 	      else if (strcmp(name,"Sset")==0) return SsetEnum;
+ 	      else if (strcmp(name,"Verbose")==0) return VerboseEnum;
++	      else if (strcmp(name,"TriangleInterp")==0) return TriangleInterpEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"TriangleInterp")==0) return TriangleInterpEnum;
+-	      else if (strcmp(name,"BilinearInterp")==0) return BilinearInterpEnum;
++	      if (strcmp(name,"BilinearInterp")==0) return BilinearInterpEnum;
+ 	      else if (strcmp(name,"NearestInterp")==0) return NearestInterpEnum;
+ 	      else if (strcmp(name,"XY")==0) return XYEnum;
+ 	      else if (strcmp(name,"XYZ")==0) return XYZEnum;
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17352)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17353)
+@@ -70,9 +70,6 @@
+ 		analysis->ElementizeEplMask(femmodel);
+ 		delete analysis;
+ 	}
+-	/*For the initialization we compute the transfer without the mask if the EPL is not present*/
+-	femmodel->HydrologyTransferx();
+-
+ 	/*The real computation starts here, outermost loop is on the two layer system*/
+ 	for(;;){
+ 
+Index: ../trunk-jpl/src/c/cores/hydrology_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/hydrology_core.cpp	(revision 17352)
++++ ../trunk-jpl/src/c/cores/hydrology_core.cpp	(revision 17353)
+@@ -92,8 +92,8 @@
+ 			if(save_results && ((i+1)%output_frequency==0 || (i+1)==nsteps || i==0)){
+ 				if(VerboseSolution()) _printf0_("   saving results \n");
+ 				if(isefficientlayer){
+-					int outputs[9] = {SedimentHeadEnum,SedimentHeadResidualEnum,EplHeadEnum,HydrologydcMaskEplactiveNodeEnum,HydrologydcMaskEplactiveEltEnum,EplHeadSlopeXEnum,EplHeadSlopeYEnum,HydrologydcEplThicknessEnum,WaterTransferEnum};
+-					femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],9);
++					int outputs[8] = {SedimentHeadEnum,SedimentHeadResidualEnum,EplHeadEnum,HydrologydcMaskEplactiveNodeEnum,HydrologydcMaskEplactiveEltEnum,EplHeadSlopeXEnum,EplHeadSlopeYEnum,HydrologydcEplThicknessEnum};
++					femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],8);
+ 				}
+ 				else{
+ 					int outputs[2] = {SedimentHeadEnum,SedimentHeadResidualEnum};
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17352)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17353)
+@@ -1406,26 +1406,6 @@
+ 
+ }
+ /*}}}*/
+-void FemModel::HydrologyTransferx(void){ /*{{{*/
+-
+-	Vector<IssmDouble>* transferg=NULL;
+-
+-	/*Vector allocation*/
+-	transferg=new Vector<IssmDouble>(nodes->NumberOfNodes());
+-
+-	for (int i=0;i<elements->Size();i++){
+-
+-		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+-		element->GetHydrologyTransfer(transferg);
+-	}
+-	/*Assemble*/
+-	transferg->Assemble();
+-
+-	/*Update Inputs*/
+-	InputUpdateFromVectorx(this,transferg,WaterTransferEnum,NodesEnum);
+-	delete transferg;
+-}
+-/*}}}*/
+ void FemModel::HydrologyEPLThicknessx(void){ /*{{{*/
+ 
+ 	for (int i=0;i<elements->Size();i++){
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17352)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17353)
+@@ -282,9 +282,7 @@
+ 		virtual void UpdateConstraintsExtrudeFromBase(void)=0;
+ 		virtual void UpdateConstraintsExtrudeFromTop(void)=0;
+ 
+-		//		virtual void GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index)=0;
+ 		virtual void GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode)=0;
+-		virtual void GetHydrologyTransfer(Vector<IssmDouble>* transfer)=0; 
+ 		virtual void HydrologyEPLGetMask(Vector<IssmDouble>* mask)=0;
+ 		virtual void HydrologyEPLGetActive(Vector<IssmDouble>* active)=0;
+ 		virtual void ComputeEPLThickness(void)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17352)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17353)
+@@ -4498,99 +4498,6 @@
+ 	*ph_max=h_max;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetHydrologyTransfer{{{*/
+-/*This thing should be useless and deleted soon*/
+-
+- void  Tria::GetHydrologyTransfer(Vector<IssmDouble>* transfer){ 
+-
+-/* 	const int  numdof   = NDOF1 *NUMVERTICES; */
+-/* 	int        *doflist = NULL; */
+-/* 	int        analysis_type; */
+-/* 	bool       isefficientlayer; */
+-/* 	bool       active_element; */
+-/* 	int        transfermethod; */
+-/* 	IssmDouble leakage,h_max,dt,test; */
+-/* 	IssmDouble wh_trans,sed_thick,relaxed; */
+-/* 	IssmDouble epl_specificstoring,sedstoring; */
+-/* 	IssmDouble activeEpl[numdof],epl_thickness[numdof],old_epl_thickness[numdof]; */
+-/* 	IssmDouble epl_head[numdof],sed_head[numdof]; */
+-/* 	IssmDouble epl_head_old[numdof],sed_head_old[numdof]; */
+-/* 	IssmDouble preceding_transfer[numdof],sed_trans[numdof]; */
+-
+-/* 	Input* active_element_input=NULL; */
+-
+-
+-/* 	parameters->FindParam(&analysis_type,AnalysisTypeEnum); */
+-		
+-/* 	GetDofList(&doflist,NoneApproximationEnum,GsetEnum); */
+-
+-/* 	/\*Get the flag to know if the efficient layer is present*\/ */
+-/* 	this->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum); */
+-
+-/* 	if(isefficientlayer){ */
+-/* 		/\*Also get the flag to the transfer method*\/ */
+-/* 		this->parameters->FindParam(&transfermethod,HydrologydcTransferFlagEnum); */
+-/* 		this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);		 */
+-/* 		/\*Switch between the different transfer methods cases*\/ */
+-/* 		switch(transfermethod){ */
+-/* 		case 0: */
+-/* 			/\*Just keepping the transfer to zero, should be OK with the initial value of transfer*\/ */
+-/* 			break; */
+-/* 		case 1: */
+-	
+-/* 			active_element_input=inputs->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input); */
+-/* 			active_element_input->GetInputValue(&active_element); */
+-
+-/* 			GetInputListOnVertices(&sed_head[0],SedimentHeadEnum); */
+-/* 			GetInputListOnVertices(&sed_head_old[0],SedimentHeadOldEnum); */
+-/* 			GetInputListOnVertices(&sed_trans[0],HydrologydcSedimentTransmitivityEnum); */
+-/* 			GetInputListOnVertices(&epl_head[0],EplHeadEnum); */
+-/* 			GetInputListOnVertices(&epl_head_old[0],EplHeadOldEnum); */
+-/* 			GetInputListOnVertices(&epl_thickness[0],HydrologydcEplThicknessEnum);			 */
+-
+-/* 			this->parameters->FindParam(&leakage,HydrologydcLeakageFactorEnum); */
+-
+-/* 			sed_thick = matpar->GetSedimentThickness(); */
+-
+-/* 			if(!active_element){ */
+-
+-						
+-/* 				/\*No transfer if the EPL is not active*\/ */
+-/* 			} */
+-/* 			else{ */
+-/* 				GetInputListOnVertices(&preceding_transfer[0],WaterTransferEnum); */
+-/* 				sedstoring=matpar->GetSedimentStoring(); */
+-/* 				epl_specificstoring=matpar->GetEplSpecificStoring(); */
+-					
+-/* 				for(int i=0;i<numdof;i++){ */
+-/* 					this->GetHydrologyDCInefficientHmax(&h_max,this->nodes[i]); */
+-/* 					/\*EPL head higher than sediment head, transfer from the epl to the sediment*\/ */
+-/* 					if(epl_head[i]>sed_head[i]){ */
+-/* 						if(sed_head[i]>=h_max){ */
+-/* 							wh_trans=0.0; */
+-/* 						} */
+-/* 						else{ */
+-/* 							wh_trans=epl_specificstoring*epl_thickness[i]*sed_trans[i]*(epl_head[i]-sed_head[i])/(leakage*sed_thick); */
+-/* 						}						 */
+-/* 					} */
+-/* 					/\* EPL head lower than sediment head, transfer from the sediment to the epl *\/ */
+-/* 					else if(epl_head[i]<=sed_head[i]){ */
+-/* 						wh_trans=sedstoring*sed_trans[i]*(epl_head[i]-sed_head[i])/(leakage*sed_thick); */
+-/* 					}  */
+-					
+-/* 					/\*Assign output pointer*\/ */
+-/* 					transfer->SetValue(doflist[i],wh_trans,INS_VAL); */
+-/* 				} */
+-/* 			} */
+-/* 			break; */
+-/* 		default: */
+-/* 			_error_("no case higher than 1 for the Transfer method"); */
+-/* 		} */
+-/* 	} */
+-/* 	/\*Free ressources:*\/ */
+-/* 	xDelete<int>(doflist); */
+- } 
+-/*}}}*/
+ /*FUNCTION Tria::HydrologyEPLGetActive {{{*/
+ void Tria::HydrologyEPLGetActive(Vector<IssmDouble>* active_vec){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17352)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17353)
+@@ -253,9 +253,7 @@
+ 
+ 		ElementMatrix* CreateEPLDomainMassMatrix(void);
+ 		void           CreateHydrologyWaterVelocityInput(void);
+-		//		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index);
+ 		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode);
+-		void           GetHydrologyTransfer(Vector<IssmDouble>* transfer);
+ 		void           HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
+ 		void           HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask);
+ 		void           ComputeEPLThickness(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17352)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17353)
+@@ -4178,16 +4178,6 @@
+ 	delete tria->material; delete tria;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetHydrologyTransfer{{{*/
+-void  Penta::GetHydrologyTransfer(Vector<IssmDouble>* transfer){
+-
+-	if (!IsOnBed()) return;
+-
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	tria->GetHydrologyTransfer(transfer);
+-	delete tria->material; delete tria;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::GetSolutionFromInputsOneDof {{{*/
+ void Penta::GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution, int enum_type){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17352)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17353)
+@@ -242,8 +242,6 @@
+ 
+ 		ElementMatrix* CreateEPLDomainMassMatrix(void);
+ 		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode);
+-		//		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index){_error_("not implemented yet");};
+-		void           GetHydrologyTransfer(Vector<IssmDouble>* transfer);
+ 		void           HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
+ 		void           HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask);
+ 		void           ComputeEPLThickness(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17352)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17353)
+@@ -150,8 +150,6 @@
+ 		void        GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
+ 
+ 		void    GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode){_error_("not implemented yet");};
+-		//		void    GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index){_error_("not implemented yet");};
+-		void    GetHydrologyTransfer(Vector<IssmDouble>* transfer){_error_("not implemented yet");};
+ 		void    HydrologyEPLGetActive(Vector<IssmDouble>* active_vec){_error_("not implemented yet");};
+ 		void    HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask){_error_("not implemented yet");};
+ 		void    ComputeEPLThickness(void){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17352)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17353)
+@@ -493,8 +493,7 @@
+ 				name==HydrologydcEplInitialThicknessEnum ||
+ 				name==HydrologydcEplThicknessEnum ||
+ 				name==HydrologydcMaskEplactiveNodeEnum ||
+-				name==MeshVertexonbedEnum ||
+-				name==WaterTransferEnum
++				name==MeshVertexonbedEnum 
+ 
+ 				) {
+ 					return true;
+Index: ../trunk-jpl/src/c/classes/FemModel.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.h	(revision 17352)
++++ ../trunk-jpl/src/c/classes/FemModel.h	(revision 17353)
+@@ -94,7 +94,6 @@
+ 		int  UpdateVertexPositionsx(void);
+ 		void UpdateConstraintsExtrudeFromBasex();
+ 		void UpdateConstraintsExtrudeFromTopx();
+-		void HydrologyTransferx(void);
+ 		void HydrologyEPLupdateDomainx(void);
+ 		void HydrologyEPLThicknessx(void);
+ 		void UpdateConstraintsL2ProjectionEPLx(void);
Index: issm/oecreview/Archive/16554-17801/ISSM-17353-17354.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17353-17354.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17353-17354.diff	(revision 17802)
@@ -0,0 +1,29 @@
+Index: ../trunk-jpl/src/c/classes/Elements/SegRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/SegRef.cpp	(revision 17353)
++++ ../trunk-jpl/src/c/classes/Elements/SegRef.cpp	(revision 17354)
+@@ -98,6 +98,11 @@
+ 			basis[0]=(1.-gauss->coord1)/2.;
+ 			basis[1]=(1.+gauss->coord1)/2.;
+ 			return;
++		case P2Enum:
++			basis[0]=(gauss->coord1-1.)*gauss->coord1/2.;
++			basis[1]=gauss->coord1*(1.+gauss->coord1)/2.;
++			basis[2]=(1.-gauss->coord1)*(1.+gauss->coord1);
++			return;
+ 		default:
+ 			_error_("Element type "<<EnumToStringx(element_type)<<" not supported yet");
+ 	}
+@@ -166,6 +171,12 @@
+ 			/*Nodal function 2*/
+ 			dbasis[1] = 0.5;
+ 			return;
++		case P2Enum:
++			/*Nodal function 1*/
++			dbasis[0] = (gauss->coord1-1.)/2. + gauss->coord1/2.;
++			dbasis[1] = (1.+gauss->coord1)/2. + gauss->coord1/2.;
++			dbasis[2] = -2.*gauss->coord1;
++			return;
+ 		default:
+ 			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+ 	}
Index: issm/oecreview/Archive/16554-17801/ISSM-17354-17355.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17354-17355.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17354-17355.diff	(revision 17802)
@@ -0,0 +1,189 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17354)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17355)
+@@ -409,7 +409,8 @@
+ 	/*Switch between the different transfer methods cases*/
+ 	switch(transfermethod){
+ 	case 0:
+-		/*Just keepping the transfer to zero, should be OK with the initial value of transfer*/
++		/*Just keepping the transfer to zero*/
++		transfer=0.0;
+ 		break;
+ 	case 1:
+ 
+@@ -455,7 +456,8 @@
+ 	/*Switch between the different transfer methods cases*/
+ 	switch(transfermethod){
+ 	case 0:
+-		/*Just keepping the transfer to zero, should be OK with the initial value of transfer*/
++		/*Just keepping the transfer to zero*/
++		transfer=0.0;
+ 		break;
+ 	case 1:
+ 
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17354)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17355)
+@@ -512,7 +512,8 @@
+ 	/*Switch between the different transfer methods cases*/
+ 	switch(transfermethod){
+ 	case 0:
+-		/*Just keepping the transfer to zero, should be OK with the initial value of transfer*/
++		/*Just keepping the transfer to zero*/
++		transfer=0.0;
+ 		break;
+ 	case 1:
+ 
+@@ -559,7 +560,8 @@
+ 	/*Switch between the different transfer methods cases*/
+ 	switch(transfermethod){
+ 	case 0:
+-		/*Just keepping the transfer to zero, should be OK with the initial value of transfer*/
++		/*Just keepping the transfer to zero*/
++		transfer=0.0;
+ 		break;
+ 	case 1:
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17354)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17355)
+@@ -4391,45 +4391,6 @@
+ 	this->inputs->AddInput(new TriaInput(HydrologyWaterVyEnum,vy,P1Enum));
+ }
+ /*}}}*/
+-/*FUNCTION Tria::CreatEPLDomainMassMatrix {{{*/
+-ElementMatrix* Tria::CreateEPLDomainMassMatrix(void){
+-
+-	/* Intermediaries */
+-	IssmDouble  D,Jdet;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Initialize Element matrix and vectors*/
+-	ElementMatrix* Ke    = new ElementMatrix(nodes,numnodes,this->parameters,NoneApproximationEnum);
+-	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+-
+-	/*Retrieve all inputs and parameters*/
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-
+-	/* Start looping on the number of gaussian points: */
+-	GaussTria* gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		GetNodalFunctions(basis,gauss);
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-		D=gauss->weight*Jdet;
+-
+-		TripleMultiply(basis,1,numnodes,1,
+-					&D,1,1,0,
+-					basis,1,numnodes,0,
+-					&Ke->values[0],1);
+-	}
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	xDelete<IssmDouble>(basis);
+-	return Ke;
+-}
+-/*}}}*/
+ /*FUNCTION Tria::GetSolutionFromInputsOneDof{{{*/
+ void  Tria::GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution, int enum_type){
+ 
+@@ -4587,7 +4548,6 @@
+ /*FUNCTION Tria::ComputeEPLThickness{{{*/
+ void  Tria::ComputeEPLThickness(void){
+ 
+-	int         i;
+ 	const int   numdof         = NDOF1 *NUMVERTICES;
+ 	bool        isefficientlayer;
+ 	bool        active_element;
+@@ -4595,10 +4555,10 @@
+ 	IssmDouble  rho_water,rho_ice;
+ 	IssmDouble  gravity,latentheat,EPLgrad2;
+ 	IssmDouble  EPL_N,epl_conductivity;
+-	IssmDouble  activeEpl[numdof],thickness[numdof];
+-	IssmDouble  eplhead[numdof],old_eplhead[numdof];
++	IssmDouble  thickness[numdof];
++	IssmDouble  eplhead[numdof];
+ 	IssmDouble  epl_slopeX[numdof],epl_slopeY[numdof];
+-	IssmDouble  preceding_thickness[numdof],old_thickness[numdof];
++	IssmDouble  old_thickness[numdof];
+ 	IssmDouble  ice_thickness[numdof],bed[numdof];
+ 
+ 	Input* active_element_input=NULL;
+@@ -4636,7 +4596,6 @@
+ 			}
+ 		}
+ 		else{
+-			GetInputListOnVertices(&preceding_thickness[0],HydrologydcEplThicknessEnum);
+ 			for(int i=0;i<numdof;i++){
+ 				
+ 				/*Compute first the effective pressure in the EPL*/
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17354)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17355)
+@@ -251,7 +251,6 @@
+ 		void UpdateConstraintsExtrudeFromBase(void);
+ 		void UpdateConstraintsExtrudeFromTop(void);
+ 
+-		ElementMatrix* CreateEPLDomainMassMatrix(void);
+ 		void           CreateHydrologyWaterVelocityInput(void);
+ 		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode);
+ 		void           HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17354)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17355)
+@@ -4155,19 +4155,6 @@
+ /*}}}*/
+ #endif
+ 
+-/*FUNCTION Penta::CreateEPLDomainMassMatrix {{{*/
+-ElementMatrix* Penta::CreateEPLDomainMassMatrix(void){
+-
+-	if (!IsOnBed()) return NULL;
+-
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	ElementMatrix* Ke=tria->CreateEPLDomainMassMatrix();
+-	delete tria->material; delete tria;
+-
+-	/*clean up and return*/
+-	return Ke;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::GetHydrologyDCInefficientHmax{{{*/
+ void  Penta::GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17354)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17355)
+@@ -218,9 +218,9 @@
+ 		bool           IsIceInElement(void); 
+ 		Gauss*         NewGauss(void);
+ 		Gauss*         NewGauss(int order);
+-      Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){_error_("not implemented yet");};
+-      Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert);
+-      Gauss*         NewGauss(int point1,IssmDouble fraction1,IssmDouble fraction2,bool mainlyfloating,int order){_error_("not implemented yet");};
++		Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){_error_("not implemented yet");};
++		Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert);
++		Gauss*         NewGauss(int point1,IssmDouble fraction1,IssmDouble fraction2,bool mainlyfloating,int order){_error_("not implemented yet");};
+ 		Gauss*         NewGaussBase(int order);
+ 		Gauss*         NewGaussLine(int vertex1,int vertex2,int order);
+ 		Gauss*         NewGaussTop(int order);
+@@ -240,7 +240,6 @@
+ 		Tria*	         SpawnTria(int location);
+ 		IssmDouble     StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa);
+ 
+-		ElementMatrix* CreateEPLDomainMassMatrix(void);
+ 		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode);
+ 		void           HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
+ 		void           HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask);
Index: issm/oecreview/Archive/16554-17801/ISSM-17355-17356.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17355-17356.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17355-17356.diff	(revision 17802)
@@ -0,0 +1,77 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17355)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17356)
+@@ -190,6 +190,7 @@
+ 										 &Ke->values[0],1);
+ 		}
+ 	}
++
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+@@ -292,11 +293,9 @@
+ 	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
+-
+ void HydrologyDCEfficientAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	element->GetSolutionFromInputsOneDof(solution,EplHeadEnum);
+ }/*}}}*/
+-
+ void HydrologyDCEfficientAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 
+ 	int meshtype,i;
+@@ -335,7 +334,6 @@
+ 	xDelete<int>(doflist);
+ 	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ } /*}}}*/
+-
+ void HydrologyDCEfficientAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+ 	/*Default, do nothing*/
+ 	return;
+@@ -350,7 +348,6 @@
+ 	IssmDouble water_compressibility = element->GetMaterialParameter(HydrologydcWaterCompressibilityEnum);
+ 	return rho_freshwater*g*epl_porosity*(water_compressibility+(epl_compressibility/epl_porosity));		 
+ }/*}}}*/
+-
+ IssmDouble HydrologyDCEfficientAnalysis::SedimentStoring(Element* element){/*{{{*/
+ 	IssmDouble rho_freshwater           = element->GetMaterialParameter(MaterialsRhoFreshwaterEnum);
+ 	IssmDouble g                        = element->GetMaterialParameter(ConstantsGEnum);
+@@ -360,7 +357,6 @@
+ 	IssmDouble water_compressibility    = element->GetMaterialParameter(HydrologydcWaterCompressibilityEnum);
+ 	return rho_freshwater*g*sediment_porosity*sediment_thickness*(water_compressibility+(sediment_compressibility/sediment_porosity));		 
+ }/*}}}*/
+-
+ IssmDouble HydrologyDCEfficientAnalysis::GetHydrologyDCInefficientHmax(Element* element, Gauss* gauss){/*{{{*/
+ 	int        hmax_flag;
+ 	IssmDouble h_max;
+@@ -439,7 +435,6 @@
+ 	
+ 	return transfer;
+ }/*}}}*/
+-
+ IssmDouble HydrologyDCEfficientAnalysis::GetHydrologyPVectorTransfer(Element* element, Gauss* gauss){/*{{{*/
+ 
+ 	int transfermethod;
+@@ -485,7 +480,6 @@
+ 	}
+ 	return transfer;
+ }/*}}}*/
+-
+ void HydrologyDCEfficientAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17355)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17356)
+@@ -176,7 +176,7 @@
+ 				ug_epl_sub_iter=ug_epl->Duplicate();_assert_(ug_epl_sub_iter);
+ 				ug_epl->Copy(ug_epl_sub_iter);
+ 
+-				/* {{{ *//*Retriev the EPL head slopes and compute EPL Thickness*/
++				/* {{{ *//*Retrieve the EPL head slopes and compute EPL Thickness*/
+ 				if(VerboseSolution()) _printf0_("computing EPL Head slope...\n");
+ 				femmodel->SetCurrentConfiguration(L2ProjectionEPLAnalysisEnum);
+ 				femmodel->UpdateConstraintsL2ProjectionEPLx();
Index: issm/oecreview/Archive/16554-17801/ISSM-17356-17357.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17356-17357.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17356-17357.diff	(revision 17802)
@@ -0,0 +1,61 @@
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17356)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17357)
+@@ -33,24 +33,21 @@
+ 	Vector<IssmDouble>* df=NULL;
+ 
+ 	bool       sedconverged,eplconverged,hydroconverged;
+-	bool       transfered;
+ 	bool       isefficientlayer;
+ 	int        constraints_converged;
+ 	int        num_unstable_constraints;
+ 	int        sedcount,eplcount,hydrocount;
+ 	int        hydro_maxiter;
+-	IssmDouble sediment_kmax,time;
++	IssmDouble sediment_kmax;
+ 	IssmDouble eps_hyd;
+ 	IssmDouble ndu_sed,nu_sed;
+ 	IssmDouble ndu_epl,nu_epl;
+-	IssmDouble EplConv;
+ 
+ 	/*Recover parameters: */
+ 	femmodel->SetCurrentConfiguration(HydrologyDCInefficientAnalysisEnum);
+ 	femmodel->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);
+ 	femmodel->parameters->FindParam(&hydro_maxiter,HydrologydcMaxIterEnum);
+ 	femmodel->parameters->FindParam(&eps_hyd,HydrologydcRelTolEnum);
+-	femmodel->parameters->FindParam(&time,TimeEnum);
+ 
+ 	hydrocount=1;
+ 	hydroconverged=false;
+@@ -73,7 +70,6 @@
+ 	/*The real computation starts here, outermost loop is on the two layer system*/
+ 	for(;;){
+ 
+-		EplConv=1.0;
+ 		sedcount=1;
+ 		eplcount=1;
+ 
+@@ -168,9 +164,7 @@
+ 			InputUpdateFromConstantx(femmodel,true,ResetPenaltiesEnum);
+ 			InputUpdateFromConstantx(femmodel,false,ConvergedEnum);
+ 			femmodel->parameters->SetParam(HydrologyEfficientEnum,HydrologyLayerEnum);
+-			EplConv=1.0;
+ 
+-
+ 			for(;;){
+ 				eplconverged=false;
+ 				ug_epl_sub_iter=ug_epl->Duplicate();_assert_(ug_epl_sub_iter);
+@@ -219,12 +213,10 @@
+ 				if (xIsNan<IssmDouble>(ndu_epl) || xIsNan<IssmDouble>(nu_epl)) _error_("convergence criterion is NaN!");
+ 				if (ndu_epl==0.0 && nu_epl==0.0) nu_epl=1.0e-6; /*Hacking the case where the EPL is used but empty*/
+ 				if(VerboseConvergence()) _printf0_(setw(50) << left << "   Inner EPL Convergence criterion:" << ndu_epl/nu_epl*100 << "%, aiming lower than " << eps_hyd*10*100 << " %\n");
+-				EplConv=ndu_epl/nu_epl;
+ 				if((ndu_epl/nu_epl)<eps_hyd*10.) eplconverged=true;
+ 				if (eplcount>=hydro_maxiter){
+ 					_error_("   maximum number of EPL iterations (" << hydro_maxiter << ") exceeded");
+ 				}
+-				
+ 				eplcount++;
+ 				
+ 				delete ug_epl_sub_iter;
Index: issm/oecreview/Archive/16554-17801/ISSM-17357-17358.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17357-17358.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17357-17358.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp	(revision 17357)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp	(revision 17358)
+@@ -131,7 +131,7 @@
+ 	int *elementfaces_markers = NULL;
+ 
+ 	/*Maximum number of faces*/
+-	maxnbf = 6*iomodel->numberofelements;
++	maxnbf = 5*iomodel->numberofelements;
+ 
+ 	/*Initialize intermediaries*/
+ 	int*  facestemp = xNew<int>(maxnbf*6);         /*format: [vertex1 vertex2 vertex3 element1 element2 marker]    */
Index: issm/oecreview/Archive/16554-17801/ISSM-17358-17359.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17358-17359.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17358-17359.diff	(revision 17802)
@@ -0,0 +1,139 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17358)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17359)
+@@ -6,7 +6,7 @@
+ #include "../solutionsequences/solutionsequences.h"
+ #include "../cores/cores.h"
+ 
+-//#define FSANALYTICAL 3
++//#define FSANALYTICAL 101
+ 
+ /*Model processing*/
+ int  StressbalanceAnalysis::DofsPerNode(int** pdoftype,int meshtype,int approximation){/*{{{*/
+@@ -2272,8 +2272,67 @@
+ 	xDelete<IssmDouble>(D);
+ 	return Ke;
+ }/*}}}*/
++#ifdef FSANALYTICAL
+ ElementVector* StressbalanceAnalysis::CreatePVectorHO(Element* element){/*{{{*/
+ 
++	/*Intermediaries */
++	int         dim,meshtype;
++	IssmDouble  x_coord,y_coord,z_coord;
++	IssmDouble  Jdet,forcex,forcey,forcez;
++	IssmDouble* xyz_list = NULL;
++
++	/*Get problem dimension*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; break;
++		case Mesh3DEnum:         dim = 3; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and vectors*/
++	ElementVector* pe=element->NewElementVector(HOApproximationEnum);
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(3);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctions(basis, gauss);
++
++		x_coord=element->GetXcoord(gauss);
++		y_coord=element->GetYcoord(gauss);
++		if(dim==3) z_coord=element->GetZcoord(gauss);
++		else z_coord=0.;
++
++		forcex=fx(x_coord,y_coord,z_coord,FSANALYTICAL);
++		forcey=fy(x_coord,y_coord,z_coord,FSANALYTICAL);
++
++		for(int i=0;i<numnodes;i++){
++			pe->values[i*(dim-1)+0]+=forcex*Jdet*gauss->weight*basis[i];
++			pe->values[i*(dim-1)+1]+=forcey*Jdet*gauss->weight*basis[i];
++		}
++	}
++
++	/*Transform coordinate system*/
++	if(dim==3) element->TransformLoadVectorCoord(pe,XYEnum);
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(xyz_list);
++	delete gauss;
++	return pe;
++}/*}}}*/
++#else
++ElementVector* StressbalanceAnalysis::CreatePVectorHO(Element* element){/*{{{*/
++
+ 	/*compute all load vectors for this element*/
+ 	ElementVector* pe1=CreatePVectorHODrivingStress(element);
+ 	ElementVector* pe2=CreatePVectorHOFront(element);
+@@ -2284,6 +2343,7 @@
+ 	delete pe2;
+ 	return pe;
+ }/*}}}*/
++#endif
+ ElementVector* StressbalanceAnalysis::CreatePVectorHODrivingStress(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries */
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h	(revision 17358)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h	(revision 17359)
+@@ -29,4 +29,6 @@
+ IssmDouble fx7(IssmDouble x_coord, IssmDouble y_coord);
+ IssmDouble fy7(IssmDouble x_coord, IssmDouble y_coord);
+ 
++IssmDouble fx101(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
++IssmDouble fy101(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+ #endif //ifndef _SHARED_ANALYTICALS_H_
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp	(revision 17358)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp	(revision 17359)
+@@ -35,6 +35,9 @@
+ 			return fx=fx7(x,y);
+ 		case 8: 
+ 			return fx=1.0;
++
++		case 101: 
++			return fx=fx101(x,y,z);
+ 		default:
+ 			_error_("FS analytical solution"<<testid<<" not implemented yet");
+ 	}
+@@ -60,6 +63,9 @@
+ 			return fy=fy7(x,y);
+ 		case 8: 
+ 			return fy=1.0;
++
++		case 101: 
++			return fy=fy101(x,y,z);
+ 		default:
+ 			_error_("FS analytical solution"<<testid<<" not implemented yet");
+ 	}
+@@ -252,3 +258,14 @@
+ 	return functiony;
+ }
+ /*}}}*/
++
++IssmDouble fx101(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
++
++   return 4*pow(x, 2)*y*z*pow(x - 1, 2)*(z - 1) + 8*pow(x, 2)*y*z*(y - 1)*(2*y - 1)*(z - 1) + 2*pow(x, 2)*y*pow(x - 1, 2)*(y - 1)*(2*y - 1) + 4*pow(x, 2)*z*pow(x - 1, 2)*(y - 1)*(z - 1) + 2*pow(x, 2)*z*pow(x - 1, 2)*(2*y - 1)*(z - 1) - 12*x*pow(y, 2)*z*(x - 1)*(y - 1)*(z - 1) - 6*x*pow(y, 2)*z*(2*x - 1)*(y - 1)*(z - 1) - 12*x*y*z*(x - 1)*pow(y - 1, 2)*(z - 1) + 32*x*y*z*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 6*x*y*z*(2*x - 1)*pow(y - 1, 2)*(z - 1) - 6*pow(y, 2)*z*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 8*y*z*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 6*y*z*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1);
++}
++/*}}}*/
++IssmDouble fy101(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
++
++	return 12*pow(x, 2)*y*z*(x - 1)*(y - 1)*(z - 1) + 6*pow(x, 2)*y*z*(x - 1)*(2*y - 1)*(z - 1) + 6*pow(x, 2)*z*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 8*x*pow(y, 2)*z*(x - 1)*(2*x - 1)*(z - 1) - 4*x*pow(y, 2)*z*pow(y - 1, 2)*(z - 1) - 2*x*pow(y, 2)*(x - 1)*(2*x - 1)*pow(y - 1, 2) + 12*x*y*z*pow(x - 1, 2)*(y - 1)*(z - 1) + 6*x*y*z*pow(x - 1, 2)*(2*y - 1)*(z - 1) - 32*x*y*z*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 6*x*z*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 8*x*z*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1) - 4*pow(y, 2)*z*(x - 1)*pow(y - 1, 2)*(z - 1) - 2*pow(y, 2)*z*(2*x - 1)*pow(y - 1, 2)*(z - 1);
++}
++/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17359-17360.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17359-17360.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17359-17360.diff	(revision 17802)
@@ -0,0 +1,326 @@
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h	(revision 17359)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h	(revision 17360)
+@@ -10,25 +10,5 @@
+ IssmDouble fx(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord, int testid);
+ IssmDouble fy(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord, int testid);
+ IssmDouble fz(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord, int testid);
+-IssmDouble fx1(IssmDouble x_coord, IssmDouble y_coord);
+-IssmDouble fy1(IssmDouble x_coord, IssmDouble y_coord);
+-IssmDouble fx2(IssmDouble x_coord, IssmDouble y_coord);
+-IssmDouble fy2(IssmDouble x_coord, IssmDouble y_coord);
+-IssmDouble fx3(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+-IssmDouble fy3(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+-IssmDouble fz3(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+-IssmDouble fx4(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+-IssmDouble fy4(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+-IssmDouble fz4(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+-IssmDouble fx5(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+-IssmDouble fy5(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+-IssmDouble fz5(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+-IssmDouble fx6(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+-IssmDouble fy6(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+-IssmDouble fz6(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+-IssmDouble fx7(IssmDouble x_coord, IssmDouble y_coord);
+-IssmDouble fy7(IssmDouble x_coord, IssmDouble y_coord);
+ 
+-IssmDouble fx101(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+-IssmDouble fy101(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
+ #endif //ifndef _SHARED_ANALYTICALS_H_
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp	(revision 17359)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp	(revision 17360)
+@@ -16,256 +16,86 @@
+ #include "../shared.h"
+ 
+ IssmDouble fx(IssmDouble x,IssmDouble y,IssmDouble z,int testid){ /*{{{*/ 
+-	IssmDouble fx;
++	IssmDouble p=2;
++	IssmDouble q=2;
+ 
+ 	switch(testid){
+ 		case 1:
+-			return fx=fx1(x,y);
++			z=y;
++			return  4*pow(x, 2)*z*pow(x - 1, 2) + 4*pow(x, 2)*z*(z - 1)*(2*z - 1) + 4*pow(x, 2)*pow(x - 1, 2)*(z - 1) + 2*pow(x, 2)*pow(x - 1, 2)*(2*z - 1) + 16*x*z*(x - 1)*(z - 1)*(2*z - 1) - 4*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) + 6*pow(z, 2)*(6*pow(x, 2) - 6*x + 1) + 4*z*pow(x - 1, 2)*(z - 1)*(2*z - 1) - 2*z*(6*pow(x, 2) - 6*x + 1) + z - 1.0L/2.0L;
+ 		case 2: 
+-			return fx=fx2(x,y);
++			z=y;
++			return 10*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 3)*pow(sin(PI*p*z), 2)*cos(PI*p*z) - 2*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 3)*pow(cos(PI*p*z), 3) - 6*pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*pow(sin(PI*p*z), 2)*pow(cos(PI*p*x), 2)*cos(PI*p*z) + PI*q*sin(PI*q*z)*cos(PI*q*x);
+ 		case 3: 
+-			return fx=fx3(x,y,z);
++			return 4*pow(x, 2)*y*z*pow(x - 1, 2)*(z - 1) + 4*pow(x, 2)*y*z*(y - 1)*(2*y - 1)*(z - 1) + 2*pow(x, 2)*y*pow(x - 1, 2)*(y - 1)*(2*y - 1) + 4*pow(x, 2)*z*pow(x - 1, 2)*(y - 1)*(z - 1) + 2*pow(x, 2)*z*pow(x - 1, 2)*(2*y - 1)*(z - 1) - 4*x*pow(y, 2)*z*(x - 1)*(y - 1)*(z - 1) - 2*x*pow(y, 2)*z*(2*x - 1)*(y - 1)*(z - 1) - 4*x*y*z*(x - 1)*pow(y - 1, 2)*(z - 1) + 16*x*y*z*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 2*x*y*z*(2*x - 1)*pow(y - 1, 2)*(z - 1) - 2*pow(y, 2)*z*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 4*y*z*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 2*y*z*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1) + y - 1.0L/2.0L;
+ 		case 4: 
+-			return fx=fx4(x,y,z);
++			return 4*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*sin(PI*p*y)*sin(PI*p*z) + 2*pow(PI, 2)*pow(p, 2)*sin(PI*p*y)*sin(PI*p*z)*cos(PI*p*x) + PI*q*sin(PI*q*y)*sin(PI*q*z)*cos(PI*q*x);
+ 		case 5: 
+-			return fx=fx5(x,y,z);
++			return 2.*(cos(PI*p*x) - 1)*PI*PI*p*p*sin(PI*p*y) + 3*PI*PI*p*p*sin(PI*p*y)*cos(PI*p*x) + PI*q*sin(PI*q*y)*cos(PI*q*x);
+ 		case 6: 
+-			return fx=fx6(x,y,z);
++			return 4. * PI*PI * p*p * (cos(p*PI*x)-1) * sin(p*PI*y) * sin(p*PI*z)+ 2. * PI*PI*p*p*  sin(p*PI*y)    * sin(p*PI*z) * cos(p*PI*x) + q * PI * cos(q*PI*x) * sin(q*PI*y) * sin(q*PI*z);
+ 		case 7: 
+-			return fx=fx7(x,y);
++			z=y;
++			return 4*pow(x, 2)*z*pow(x - 1, 2) + 4*pow(x, 2)*z*(z - 1)*(2*z - 1) + 4*pow(x, 2)*pow(x - 1, 2)*(z - 1) + 2*pow(x, 2)*pow(x - 1, 2)*(2*z - 1) + 16*x*z*(x - 1)*(z - 1)*(2*z - 1) - 4*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) + 6*pow(z, 2)*(6*pow(x, 2) - 6*x + 1) + 4*z*pow(x - 1, 2)*(z - 1)*(2*z - 1) - 2*z*(6*pow(x, 2) - 6*x + 1) + 1;
+ 		case 8: 
+-			return fx=1.0;
++			return 1.0;
+ 
+ 		case 101: 
+-			return fx=fx101(x,y,z);
++			return 4*pow(x, 2)*y*z*pow(x - 1, 2)*(z - 1) + 8*pow(x, 2)*y*z*(y - 1)*(2*y - 1)*(z - 1) + 2*pow(x, 2)*y*pow(x - 1, 2)*(y - 1)*(2*y - 1) + 4*pow(x, 2)*z*pow(x - 1, 2)*(y - 1)*(z - 1) + 2*pow(x, 2)*z*pow(x - 1, 2)*(2*y - 1)*(z - 1) - 12*x*pow(y, 2)*z*(x - 1)*(y - 1)*(z - 1) - 6*x*pow(y, 2)*z*(2*x - 1)*(y - 1)*(z - 1) - 12*x*y*z*(x - 1)*pow(y - 1, 2)*(z - 1) + 32*x*y*z*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 6*x*y*z*(2*x - 1)*pow(y - 1, 2)*(z - 1) - 6*pow(y, 2)*z*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 8*y*z*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 6*y*z*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1);
+ 		default:
+ 			_error_("FS analytical solution"<<testid<<" not implemented yet");
+ 	}
+ }
+ /*}}}*/
+ IssmDouble fy(IssmDouble x,IssmDouble y,IssmDouble z,int testid){ /*{{{*/ 
+-	IssmDouble fy;
++	IssmDouble p=2;
++	IssmDouble q=2;
+ 
+ 	switch(testid){
+ 		case 1:
+-			return fy=fy1(x,y);
++			z=y;
++			return -8*pow(x, 3) + 4*pow(x, 2)*z*(x - 1)*(z - 1) + 2*pow(x, 2)*z*(x - 1)*(2*z - 1) + 2*pow(x, 2)*(x - 1)*(z - 1)*(2*z - 1) + 12*pow(x, 2) + 4*x*z*pow(x - 1, 2)*(z - 1) + 2*x*z*pow(x - 1, 2)*(2*z - 1) + 2*x*pow(x - 1, 2)*(z - 1)*(2*z - 1) - 3*x - 6*pow(z, 4)*(2*x - 1) + 12*pow(z, 3)*(2*x - 1) - 6*pow(z, 2)*(2*x - 1) - 24*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + 24*z*(2*pow(x, 3) - 3*pow(x, 2) + x) - 1.0L/2.0L;
+ 		case 2: 
+-			return fy=fy2(x,y);
++			z=y;
++			return -10*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*z), 3)*cos(PI*p*x) + 6*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*sin(PI*p*z)*cos(PI*p*x)*pow(cos(PI*p*z), 2) + 2*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*z), 3)*pow(cos(PI*p*x), 3) + PI*q*sin(PI*q*x)*cos(PI*q*z);
+ 		case 3: 
+-			return fy=fy3(x,y,z);
++			return 4*pow(x, 2)*y*z*(x - 1)*(y - 1)*(z - 1) + 2*pow(x, 2)*y*z*(x - 1)*(2*y - 1)*(z - 1) + 2*pow(x, 2)*z*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 4*x*pow(y, 2)*z*(x - 1)*(2*x - 1)*(z - 1) - 4*x*pow(y, 2)*z*pow(y - 1, 2)*(z - 1) - 2*x*pow(y, 2)*(x - 1)*(2*x - 1)*pow(y - 1, 2) + 4*x*y*z*pow(x - 1, 2)*(y - 1)*(z - 1) + 2*x*y*z*pow(x - 1, 2)*(2*y - 1)*(z - 1) - 16*x*y*z*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 2*x*z*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 4*x*z*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1) + x - 4*pow(y, 2)*z*(x - 1)*pow(y - 1, 2)*(z - 1) - 2*pow(y, 2)*z*(2*x - 1)*pow(y - 1, 2)*(z - 1) - 1.0L/2.0L;
+ 		case 4: 
+-			return fy=fy4(x,y,z);
++			return -2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*sin(PI*p*x)*sin(PI*p*z) - pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*z)*cos(PI*p*y) + PI*q*sin(PI*q*x)*sin(PI*q*z)*cos(PI*q*y);
+ 		case 5: 
+-			return fy=fy5(x,y,z);
++			return -(cos(PI*p*y) - 1)*PI*PI*p*p*sin(PI*p*x) + PI*q*sin(PI*q*x)*cos(PI*q*y);
+ 		case 6: 
+-			return fy=fy6(x,y,z);
++			return - 4. * PI*PI * p*p * (cos(p*PI*y)-1) * sin(p*PI*x) * sin(p*PI*z)-  2. * PI*PI * p*p *  sin(p*PI*x)    * cos(p*PI*y) * sin(p*PI*z)+ q * PI * sin(q*PI*x) * cos(q*PI*y) * sin(q*PI*z);
+ 		case 7: 
+-			return fy=fy7(x,y);
++			z=y;
++			return -8*pow(x, 3) + 4*pow(x, 2)*z*(x - 1)*(z - 1) + 2*pow(x, 2)*z*(x - 1)*(2*z - 1) + 2*pow(x, 2)*(x - 1)*(z - 1)*(2*z - 1) + 12*pow(x, 2) + 4*x*z*pow(x - 1, 2)*(z - 1) + 2*x*z*pow(x - 1, 2)*(2*z - 1) + 2*x*pow(x - 1, 2)*(z - 1)*(2*z - 1) - 4*x - 6*pow(z, 4)*(2*x - 1) + 12*pow(z, 3)*(2*x - 1) - 6*pow(z, 2)*(2*x - 1) - 24*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + 24*z*(2*pow(x, 3) - 3*pow(x, 2) + x);
+ 		case 8: 
+-			return fy=1.0;
++			return 1.0;
+ 
+ 		case 101: 
+-			return fy=fy101(x,y,z);
++			return 12*pow(x, 2)*y*z*(x - 1)*(y - 1)*(z - 1) + 6*pow(x, 2)*y*z*(x - 1)*(2*y - 1)*(z - 1) + 6*pow(x, 2)*z*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 8*x*pow(y, 2)*z*(x - 1)*(2*x - 1)*(z - 1) - 4*x*pow(y, 2)*z*pow(y - 1, 2)*(z - 1) - 2*x*pow(y, 2)*(x - 1)*(2*x - 1)*pow(y - 1, 2) + 12*x*y*z*pow(x - 1, 2)*(y - 1)*(z - 1) + 6*x*y*z*pow(x - 1, 2)*(2*y - 1)*(z - 1) - 32*x*y*z*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 6*x*z*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 8*x*z*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1) - 4*pow(y, 2)*z*(x - 1)*pow(y - 1, 2)*(z - 1) - 2*pow(y, 2)*z*(2*x - 1)*pow(y - 1, 2)*(z - 1);
+ 		default:
+ 			_error_("FS analytical solution"<<testid<<" not implemented yet");
+ 	}
+ }
+ /*}}}*/
+ IssmDouble fz(IssmDouble x,IssmDouble y,IssmDouble z,int testid){ /*{{{*/ 
+-	IssmDouble fz;
++	IssmDouble p = 2.0;  
++	IssmDouble q = 2.0;   
+ 
+ 	switch(testid){
+ 		case 1: case 2: case 7: case 8:
+-			return fz=0.;
++			return 0.;
+ 		case 3: 
+-			return fz=fz3(x,y,z);
++			return 2*pow(x, 2)*y*z*(x - 1)*(y - 1)*(2*y - 1) + 2*pow(x, 2)*y*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 2*x*pow(y, 2)*z*(x - 1)*(2*x - 1)*(y - 1) - 2*x*pow(y, 2)*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 2*x*y*z*pow(x - 1, 2)*(y - 1)*(2*y - 1) - 2*x*y*z*(x - 1)*(2*x - 1)*pow(y - 1, 2) + 2*x*y*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 2*x*y*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1);
+ 		case 4: 
+-			return fz=fz4(x,y,z);
++			return -2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*z) - 1)*sin(PI*p*x)*sin(PI*p*y) - pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*y)*cos(PI*p*z) + PI*q*sin(PI*q*x)*sin(PI*q*y)*cos(PI*q*z);
+ 		case 5: 
+-			return fz=fz5(x,y,z);
++			return 2*PI*PI*p*p*sin(PI*p*x)*sin(PI*p*y);
+ 		case 6: 
+-			return fz=fz6(x,y,z);
++			return - 2. * PI*PI * p*p * (cos(p*PI*z)-1) * sin(p*PI*x) * sin(p*PI*y)-PI*PI * p*p *  sin(p*PI*x)    * sin(p*PI*y) * cos(p*PI*z)+ q * PI * sin(q*PI*x) * sin(q*PI*y) * cos(q*PI*z);
+ 		default:
+ 			_error_("FS analytical solution"<<testid<<" not implemented yet");
+ 	}
+ }
+ /*}}}*/
+-IssmDouble fx1(IssmDouble x,IssmDouble y){/*{{{*/
+-	IssmDouble functionx;
+-	IssmDouble z=y;
+-
+-	functionx =  4*pow(x, 2)*z*pow(x - 1, 2) + 4*pow(x, 2)*z*(z - 1)*(2*z - 1) + 4*pow(x, 2)*pow(x - 1, 2)*(z - 1) + 2*pow(x, 2)*pow(x - 1, 2)*(2*z - 1) + 16*x*z*(x - 1)*(z - 1)*(2*z - 1) - 4*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) + 6*pow(z, 2)*(6*pow(x, 2) - 6*x + 1) + 4*z*pow(x - 1, 2)*(z - 1)*(2*z - 1) - 2*z*(6*pow(x, 2) - 6*x + 1) + z - 1.0L/2.0L;
+-	return functionx;
+-}
+-/*}}}*/
+-IssmDouble fy1(IssmDouble x,IssmDouble y){   /*{{{*/
+-	IssmDouble functiony;
+-	IssmDouble z=y;
+-
+-	functiony = -8*pow(x, 3) + 4*pow(x, 2)*z*(x - 1)*(z - 1) + 2*pow(x, 2)*z*(x - 1)*(2*z - 1) + 2*pow(x, 2)*(x - 1)*(z - 1)*(2*z - 1) + 12*pow(x, 2) + 4*x*z*pow(x - 1, 2)*(z - 1) + 2*x*z*pow(x - 1, 2)*(2*z - 1) + 2*x*pow(x - 1, 2)*(z - 1)*(2*z - 1) - 3*x - 6*pow(z, 4)*(2*x - 1) + 12*pow(z, 3)*(2*x - 1) - 6*pow(z, 2)*(2*x - 1) - 24*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + 24*z*(2*pow(x, 3) - 3*pow(x, 2) + x) - 1.0L/2.0L;
+-
+-	return functiony;
+-}
+-/*}}}*/
+-IssmDouble fx2(IssmDouble x,IssmDouble y){   /*{{{*/
+-	IssmDouble functionx;
+-	IssmDouble z=y;
+-	int p=2;
+-	int q=2;
+-
+-	functionx = 10*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 3)*pow(sin(PI*p*z), 2)*cos(PI*p*z) - 2*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 3)*pow(cos(PI*p*z), 3) - 6*pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*pow(sin(PI*p*z), 2)*pow(cos(PI*p*x), 2)*cos(PI*p*z) + PI*q*sin(PI*q*z)*cos(PI*q*x);
+-	return functionx;
+-}
+-/*}}}*/
+-IssmDouble fy2(IssmDouble x,IssmDouble y){   /*{{{*/
+-	IssmDouble functiony;
+-	IssmDouble z=y;
+-	int p=2;
+-	int q=2;
+-
+-	functiony = -10*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*z), 3)*cos(PI*p*x) + 6*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*sin(PI*p*z)*cos(PI*p*x)*pow(cos(PI*p*z), 2) + 2*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*z), 3)*pow(cos(PI*p*x), 3) + PI*q*sin(PI*q*x)*cos(PI*q*z);
+-	return functiony;
+-}
+-/*}}}*/
+-IssmDouble fx3(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
+-	IssmDouble functionx;
+-
+-	functionx = 4*pow(x, 2)*y*z*pow(x - 1, 2)*(z - 1) + 4*pow(x, 2)*y*z*(y - 1)*(2*y - 1)*(z - 1) + 2*pow(x, 2)*y*pow(x - 1, 2)*(y - 1)*(2*y - 1) + 4*pow(x, 2)*z*pow(x - 1, 2)*(y - 1)*(z - 1) + 2*pow(x, 2)*z*pow(x - 1, 2)*(2*y - 1)*(z - 1) - 4*x*pow(y, 2)*z*(x - 1)*(y - 1)*(z - 1) - 2*x*pow(y, 2)*z*(2*x - 1)*(y - 1)*(z - 1) - 4*x*y*z*(x - 1)*pow(y - 1, 2)*(z - 1) + 16*x*y*z*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 2*x*y*z*(2*x - 1)*pow(y - 1, 2)*(z - 1) - 2*pow(y, 2)*z*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 4*y*z*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 2*y*z*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1) + y - 1.0L/2.0L;
+-
+-	return functionx;
+-}
+-/*}}}*/
+-IssmDouble fy3(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
+-	IssmDouble functiony;
+-
+-	functiony = 4*pow(x, 2)*y*z*(x - 1)*(y - 1)*(z - 1) + 2*pow(x, 2)*y*z*(x - 1)*(2*y - 1)*(z - 1) + 2*pow(x, 2)*z*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 4*x*pow(y, 2)*z*(x - 1)*(2*x - 1)*(z - 1) - 4*x*pow(y, 2)*z*pow(y - 1, 2)*(z - 1) - 2*x*pow(y, 2)*(x - 1)*(2*x - 1)*pow(y - 1, 2) + 4*x*y*z*pow(x - 1, 2)*(y - 1)*(z - 1) + 2*x*y*z*pow(x - 1, 2)*(2*y - 1)*(z - 1) - 16*x*y*z*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 2*x*z*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 4*x*z*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1) + x - 4*pow(y, 2)*z*(x - 1)*pow(y - 1, 2)*(z - 1) - 2*pow(y, 2)*z*(2*x - 1)*pow(y - 1, 2)*(z - 1) - 1.0L/2.0L;
+-
+-	return functiony;
+-}
+-/*}}}*/
+-IssmDouble fz3(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
+-	IssmDouble functionz;
+-
+-	functionz = 2*pow(x, 2)*y*z*(x - 1)*(y - 1)*(2*y - 1) + 2*pow(x, 2)*y*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 2*x*pow(y, 2)*z*(x - 1)*(2*x - 1)*(y - 1) - 2*x*pow(y, 2)*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 2*x*y*z*pow(x - 1, 2)*(y - 1)*(2*y - 1) - 2*x*y*z*(x - 1)*(2*x - 1)*pow(y - 1, 2) + 2*x*y*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 2*x*y*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1);
+-
+-	return functionz;
+-}
+-/*}}}*/
+-IssmDouble fx4(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
+-	IssmDouble functionx;
+-	IssmDouble p=2;
+-	IssmDouble q=2;
+-
+-	functionx = 4*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*sin(PI*p*y)*sin(PI*p*z) + 2*pow(PI, 2)*pow(p, 2)*sin(PI*p*y)*sin(PI*p*z)*cos(PI*p*x) + PI*q*sin(PI*q*y)*sin(PI*q*z)*cos(PI*q*x);
+-
+-	return functionx;
+-}
+-/*}}}*/
+-IssmDouble fy4(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
+-	IssmDouble functiony;
+-	IssmDouble p=2;
+-	IssmDouble q=2;
+-
+-	functiony =  -2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*sin(PI*p*x)*sin(PI*p*z) - pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*z)*cos(PI*p*y) + PI*q*sin(PI*q*x)*sin(PI*q*z)*cos(PI*q*y);
+-
+-	return functiony;
+-}
+-/*}}}*/
+-IssmDouble fz4(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
+-	IssmDouble functionz;
+-	IssmDouble p=2;
+-	IssmDouble q=2;
+-
+-	functionz =  -2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*z) - 1)*sin(PI*p*x)*sin(PI*p*y) - pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*y)*cos(PI*p*z) + PI*q*sin(PI*q*x)*sin(PI*q*y)*cos(PI*q*z);
+-
+-	return functionz;
+-}
+-/*}}}*/
+-IssmDouble fx5(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
+-	IssmDouble p = 2.0;  
+-	IssmDouble q = 2.0;   
+-	IssmDouble functionx;
+-
+-	functionx = 2.*(cos(PI*p*x) - 1)*PI*PI*p*p*sin(PI*p*y) + 3*PI*PI*p*p*sin(PI*p*y)*cos(PI*p*x) + PI*q*sin(PI*q*y)*cos(PI*q*x);
+-
+-	return functionx;
+-}
+-/*}}}*/
+-IssmDouble fy5(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
+-	IssmDouble p = 2.0;  
+-	IssmDouble q = 2.0;   
+-	IssmDouble functiony;
+-
+-	functiony = -(cos(PI*p*y) - 1)*PI*PI*p*p*sin(PI*p*x) + PI*q*sin(PI*q*x)*cos(PI*q*y);
+-
+-	return functiony;
+-}
+-/*}}}*/
+-IssmDouble fz5(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
+-	IssmDouble p = 2.0;  
+-	IssmDouble q = 2.0;   
+-	IssmDouble functionz;
+-
+-	functionz = 2*PI*PI*p*p*sin(PI*p*x)*sin(PI*p*y);
+-
+-	return functionz;
+-}
+-/*}}}*/
+-IssmDouble fx6(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
+-	IssmDouble p = 2.0;  
+-	IssmDouble q = 2.0;   
+-	IssmDouble functionx;
+-
+-	functionx =  4. * PI*PI * p*p * (cos(p*PI*x)-1) * sin(p*PI*y) * sin(p*PI*z)+ 2. * PI*PI*p*p*  sin(p*PI*y)    * sin(p*PI*z) * cos(p*PI*x) + q * PI * cos(q*PI*x) * sin(q*PI*y) * sin(q*PI*z);
+-
+-	return functionx;
+-}
+-/*}}}*/
+-IssmDouble fy6(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
+-	IssmDouble p = 2.0;  
+-	IssmDouble q = 2.0;   
+-	IssmDouble functiony;
+-
+-	functiony = - 4. * PI*PI * p*p * (cos(p*PI*y)-1) * sin(p*PI*x) * sin(p*PI*z)-  2. * PI*PI * p*p *  sin(p*PI*x)    * cos(p*PI*y) * sin(p*PI*z)+ q * PI * sin(q*PI*x) * cos(q*PI*y) * sin(q*PI*z);
+-
+-	return functiony;
+-}
+-/*}}}*/
+-IssmDouble fz6(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
+-	IssmDouble p = 2.0;  
+-	IssmDouble q = 2.0;   
+-	IssmDouble functionz;
+-
+-	functionz = - 2. * PI*PI * p*p * (cos(p*PI*z)-1) * sin(p*PI*x) * sin(p*PI*y)-PI*PI * p*p *  sin(p*PI*x)    * sin(p*PI*y) * cos(p*PI*z)+ q * PI * sin(q*PI*x) * sin(q*PI*y) * cos(q*PI*z);
+-
+-	return functionz;
+-}
+-/*}}}*/
+-IssmDouble fx7(IssmDouble x,IssmDouble y){/*{{{*/
+-	IssmDouble functionx;
+-	IssmDouble z=y;
+-
+-	functionx =  4*pow(x, 2)*z*pow(x - 1, 2) + 4*pow(x, 2)*z*(z - 1)*(2*z - 1) + 4*pow(x, 2)*pow(x - 1, 2)*(z - 1) + 2*pow(x, 2)*pow(x - 1, 2)*(2*z - 1) + 16*x*z*(x - 1)*(z - 1)*(2*z - 1) - 4*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) + 6*pow(z, 2)*(6*pow(x, 2) - 6*x + 1) + 4*z*pow(x - 1, 2)*(z - 1)*(2*z - 1) - 2*z*(6*pow(x, 2) - 6*x + 1) + 1;
+-	return functionx;
+-}
+-/*}}}*/
+-IssmDouble fy7(IssmDouble x,IssmDouble y){   /*{{{*/
+-	IssmDouble functiony;
+-	IssmDouble z=y;
+-
+-	functiony = -8*pow(x, 3) + 4*pow(x, 2)*z*(x - 1)*(z - 1) + 2*pow(x, 2)*z*(x - 1)*(2*z - 1) + 2*pow(x, 2)*(x - 1)*(z - 1)*(2*z - 1) + 12*pow(x, 2) + 4*x*z*pow(x - 1, 2)*(z - 1) + 2*x*z*pow(x - 1, 2)*(2*z - 1) + 2*x*pow(x - 1, 2)*(z - 1)*(2*z - 1) - 4*x - 6*pow(z, 4)*(2*x - 1) + 12*pow(z, 3)*(2*x - 1) - 6*pow(z, 2)*(2*x - 1) - 24*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + 24*z*(2*pow(x, 3) - 3*pow(x, 2) + x);
+-
+-	return functiony;
+-}
+-/*}}}*/
+-
+-IssmDouble fx101(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
+-
+-   return 4*pow(x, 2)*y*z*pow(x - 1, 2)*(z - 1) + 8*pow(x, 2)*y*z*(y - 1)*(2*y - 1)*(z - 1) + 2*pow(x, 2)*y*pow(x - 1, 2)*(y - 1)*(2*y - 1) + 4*pow(x, 2)*z*pow(x - 1, 2)*(y - 1)*(z - 1) + 2*pow(x, 2)*z*pow(x - 1, 2)*(2*y - 1)*(z - 1) - 12*x*pow(y, 2)*z*(x - 1)*(y - 1)*(z - 1) - 6*x*pow(y, 2)*z*(2*x - 1)*(y - 1)*(z - 1) - 12*x*y*z*(x - 1)*pow(y - 1, 2)*(z - 1) + 32*x*y*z*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 6*x*y*z*(2*x - 1)*pow(y - 1, 2)*(z - 1) - 6*pow(y, 2)*z*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 8*y*z*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 6*y*z*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1);
+-}
+-/*}}}*/
+-IssmDouble fy101(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
+-
+-	return 12*pow(x, 2)*y*z*(x - 1)*(y - 1)*(z - 1) + 6*pow(x, 2)*y*z*(x - 1)*(2*y - 1)*(z - 1) + 6*pow(x, 2)*z*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 8*x*pow(y, 2)*z*(x - 1)*(2*x - 1)*(z - 1) - 4*x*pow(y, 2)*z*pow(y - 1, 2)*(z - 1) - 2*x*pow(y, 2)*(x - 1)*(2*x - 1)*pow(y - 1, 2) + 12*x*y*z*pow(x - 1, 2)*(y - 1)*(z - 1) + 6*x*y*z*pow(x - 1, 2)*(2*y - 1)*(z - 1) - 32*x*y*z*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 6*x*z*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 8*x*z*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1) - 4*pow(y, 2)*z*(x - 1)*pow(y - 1, 2)*(z - 1) - 2*pow(y, 2)*z*(2*x - 1)*pow(y - 1, 2)*(z - 1);
+-}
+-/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17360-17361.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17360-17361.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17360-17361.diff	(revision 17802)
@@ -0,0 +1,598 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17360)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17361)
+@@ -409,8 +409,10 @@
+ 		transfer=0.0;
+ 		break;
+ 	case 1:
++		/* _assert_(input) */
++		/* get input */
+ 
+-		element->GetInputValue(&epl_thickness,gauss,HydrologydcEplThicknessEnum);
++			element->GetInputValue(&epl_thickness,gauss,HydrologydcEplThicknessEnum);
+ 		element->GetInputValue(&sed_head,gauss,SedimentHeadEnum);
+ 		element->GetInputValue(&epl_head,gauss,EplHeadEnum);
+ 		element->GetInputValue(&sediment_transmitivity,gauss,HydrologydcSedimentTransmitivityEnum);
+@@ -480,6 +482,91 @@
+ 	}
+ 	return transfer;
+ }/*}}}*/
++
++void HydrologyDCEfficientAnalysis::ComputeEPLThickness(FemModel* femmodel){/*{{{*/
++
++	bool        active_element;
++	int         meshtype;
++	IssmDouble  dt,A,B;
++	IssmDouble  EPLgrad2;
++	IssmDouble  EPL_N;
++
++	femmodel->parameters->FindParam(&meshtype,MeshTypeEnum);
++
++	for(int j=0;j<femmodel->elements->Size();j++){
++		
++		Element* element=(Element*)femmodel->elements->GetObjectByOffset(j);
++		
++		switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			if(!element->IsOnBed()) return;			
++			B = element->GetMaterialParameter(MaterialsRheologyBbarEnum);
++			break;
++		case Mesh3DEnum:
++			B = element->GetMaterialParameter(MaterialsRheologyBEnum);
++			break;
++		default:
++		_error_("not Implemented Yet");
++		}
++			
++		int         numnodes = element->GetNumberOfNodes();
++		IssmDouble  thickness[numnodes];
++		IssmDouble  eplhead[numnodes];
++		IssmDouble  epl_slopeX[numnodes],epl_slopeY[numnodes];
++		IssmDouble  old_thickness[numnodes];
++		IssmDouble  ice_thickness[numnodes],bed[numnodes];
++
++		Input* 	active_element_input=element->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);		
++		active_element_input->GetInputValue(&active_element);
++		element->FindParam(&dt,TimesteppingTimeStepEnum);
++	
++		/*For now, assuming just one way to compute EPL thickness*/
++		IssmDouble gravity          = element->GetMaterialParameter(ConstantsGEnum);
++		IssmDouble rho_water        = element->GetMaterialParameter(MaterialsRhoFreshwaterEnum);
++		IssmDouble rho_ice          = element->GetMaterialParameter(MaterialsRhoIceEnum);
++		IssmDouble n                =	element->GetMaterialParameter(MaterialsRheologyNEnum);
++		IssmDouble latentheat       = element->GetMaterialParameter(MaterialsLatentheatEnum);
++		IssmDouble epl_conductivity = element->GetMaterialParameter(HydrologydcEplConductivityEnum);
++		IssmDouble init_thick       =	element->GetMaterialParameter(HydrologydcEplInitialThicknessEnum);
++		
++		A=pow(B,-n);
++		
++		element->GetInputListOnVertices(&eplhead[0],EplHeadEnum);
++		element->GetInputListOnVertices(&epl_slopeX[0],EplHeadSlopeXEnum); 
++		element->GetInputListOnVertices(&epl_slopeY[0],EplHeadSlopeYEnum);
++		element->GetInputListOnVertices(&old_thickness[0],HydrologydcEplThicknessOldEnum);
++		element->GetInputListOnVertices(&ice_thickness[0],ThicknessEnum);
++		element->GetInputListOnVertices(&bed[0],BedEnum);
++			
++		if(!active_element){
++			
++			/*Keeping thickness to initial value if EPL is not active*/
++			for(int i=0;i<numnodes;i++){
++				thickness[i]=init_thick;
++			}
++		}
++		else{
++			for(int i=0;i<numnodes;i++){
++				
++				/*Compute first the effective pressure in the EPL*/
++				EPL_N=gravity*((rho_ice*ice_thickness[i])-(rho_water*(eplhead[i]-bed[i])));
++				if(EPL_N<0.0)EPL_N=0.0;
++				/*Get then the square of the gradient of EPL heads*/
++				EPLgrad2 = (epl_slopeX[i]*epl_slopeX[i]+epl_slopeY[i]*epl_slopeY[i]);
++				
++				/*And proceed to the real thing*/
++				thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*EPLgrad2-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
++				
++				/*Take care of otherthikening*/
++				if(thickness[i]>10.0*init_thick){
++					thickness[i] = 10.0*init_thick;
++				}
++			}
++		}
++		element->AddInput(HydrologydcEplThicknessEnum,thickness,P1Enum);
++	}
++}
++/*}}}*/
+ void HydrologyDCEfficientAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 17360)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 17361)
+@@ -36,5 +36,6 @@
+ 		IssmDouble GetHydrologyDCInefficientHmax(Element* element, Gauss* gauss);
+ 		IssmDouble GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss);
+ 		IssmDouble GetHydrologyPVectorTransfer(Element* element, Gauss* gauss);
++		void ComputeEPLThickness(FemModel* femmodel);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17360)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17361)
+@@ -32,6 +32,9 @@
+ 	Vector<IssmDouble>* pf=NULL;
+ 	Vector<IssmDouble>* df=NULL;
+ 
++	HydrologyDCInefficientAnalysis* inefanalysis = NULL;
++	HydrologyDCEfficientAnalysis* effanalysis = NULL;
++	
+ 	bool       sedconverged,eplconverged,hydroconverged;
+ 	bool       isefficientlayer;
+ 	int        constraints_converged;
+@@ -59,13 +62,12 @@
+ 	Reducevectorgtofx(&uf_sed, ug_sed, femmodel->nodes,femmodel->parameters);
+ 
+ 	if(isefficientlayer) {
++		inefanalysis = new HydrologyDCInefficientAnalysis();
++		effanalysis = new HydrologyDCEfficientAnalysis();
+ 		femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
+ 		GetSolutionFromInputsx(&ug_epl,femmodel);
+-		
+ 		/*Initialize the element mask*/
+-		HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
+-		analysis->ElementizeEplMask(femmodel);
+-		delete analysis;
++		inefanalysis->ElementizeEplMask(femmodel);
+ 	}
+ 	/*The real computation starts here, outermost loop is on the two layer system*/
+ 	for(;;){
+@@ -114,6 +116,7 @@
+ 					if(VerboseConvergence()) _printf0_("   # Sediment unstable constraints = " << num_unstable_constraints << "\n");
+ 					if(num_unstable_constraints==0) sedconverged = true;
+ 					if (sedcount>=hydro_maxiter){
++						//sedconverged = true;
+ 						_error_("   maximum number of Sediment iterations (" << hydro_maxiter << ") exceeded");
+ 					}
+ 				}
+@@ -125,9 +128,7 @@
+ 			/* }}} *//*End of the sediment penalization loop*/
+ 			/*Update EPL mask*/
+ 			if(isefficientlayer){
+-				HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
+-				analysis->ElementizeEplMask(femmodel);
+-				delete analysis;
++				inefanalysis->ElementizeEplMask(femmodel);
+ 			}
+ 			sedconverged=false;
+ 			
+@@ -179,14 +180,12 @@
+ 				femmodel->parameters->SetParam(EplHeadSlopeYEnum,InputToL2ProjectEnum);
+ 				solutionsequence_linear(femmodel);
+ 				femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
+-				femmodel->HydrologyEPLThicknessx();
+-				
++
++				effanalysis->ComputeEPLThickness(femmodel);
++
+ 				//updating mask after the computation of the epl thickness (Allow to close too thin EPL)
+ 				femmodel->HydrologyEPLupdateDomainx();
+-				
+-				HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
+-				analysis->ElementizeEplMask(femmodel);
+-				delete analysis;
++				inefanalysis->ElementizeEplMask(femmodel);
+ 				/* }}} */
+ 					
+ 				if(VerboseSolution()) _printf0_("Building EPL Matrix...\n");
+@@ -280,5 +279,6 @@
+ 	delete uf_sed;
+ 	delete uf_epl;
+ 	delete uf_epl_sub_iter;
+-	
++	delete inefanalysis;
++	delete effanalysis;
+ }
+Index: ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 17360)
++++ ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 17361)
+@@ -638,7 +638,7 @@
+ 	if(penalty_lock){
+ 		if(zigzag_counter>penalty_lock){
+ 			unstable=0;
+-			active=1;
++			active=0;
+ 		}
+ 	}
+ 	/*Set penalty flag*/
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17360)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17361)
+@@ -1406,13 +1406,13 @@
+ 
+ }
+ /*}}}*/
+-void FemModel::HydrologyEPLThicknessx(void){ /*{{{*/
++/* void FemModel::HydrologyEPLThicknessx(void){ /\*{{{*\/ */
+ 
+-	for (int i=0;i<elements->Size();i++){
+-		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+-		element->ComputeEPLThickness();
+-	}
+-}
++/* 	for (int i=0;i<elements->Size();i++){ */
++/* 		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i)); */
++/* 		element->ComputeEPLThickness(); */
++/* 	} */
++/* } */
+ /*}}}*/
+ void FemModel::UpdateConstraintsL2ProjectionEPLx(void){ /*{{{*/
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17360)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17361)
+@@ -285,7 +285,7 @@
+ 		virtual void GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode)=0;
+ 		virtual void HydrologyEPLGetMask(Vector<IssmDouble>* mask)=0;
+ 		virtual void HydrologyEPLGetActive(Vector<IssmDouble>* active)=0;
+-		virtual void ComputeEPLThickness(void)=0;
++		//		virtual void ComputeEPLThickness(void)=0;
+ 
+ 		virtual void   MigrateGroundingLine(IssmDouble* sheet_ungrounding)=0;
+ 		virtual void   PotentialUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17360)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17361)
+@@ -4545,77 +4545,77 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Tria::ComputeEPLThickness{{{*/
+-void  Tria::ComputeEPLThickness(void){
++//* *FUNCTION Tria::ComputeEPLThickness{{{*\/ */
++/* void  Tria::ComputeEPLThickness(void){ */
+ 
+-	const int   numdof         = NDOF1 *NUMVERTICES;
+-	bool        isefficientlayer;
+-	bool        active_element;
+-	IssmDouble  n,A,dt,init_thick;
+-	IssmDouble  rho_water,rho_ice;
+-	IssmDouble  gravity,latentheat,EPLgrad2;
+-	IssmDouble  EPL_N,epl_conductivity;
+-	IssmDouble  thickness[numdof];
+-	IssmDouble  eplhead[numdof];
+-	IssmDouble  epl_slopeX[numdof],epl_slopeY[numdof];
+-	IssmDouble  old_thickness[numdof];
+-	IssmDouble  ice_thickness[numdof],bed[numdof];
++/* 	const int   numdof         = NDOF1 *NUMVERTICES; */
++/* 	bool        isefficientlayer; */
++/* 	bool        active_element; */
++/* 	IssmDouble  n,A,dt,init_thick; */
++/* 	IssmDouble  rho_water,rho_ice; */
++/* 	IssmDouble  gravity,latentheat,EPLgrad2; */
++/* 	IssmDouble  EPL_N,epl_conductivity; */
++/* 	IssmDouble  thickness[numdof]; */
++/* 	IssmDouble  eplhead[numdof]; */
++/* 	IssmDouble  epl_slopeX[numdof],epl_slopeY[numdof]; */
++/* 	IssmDouble  old_thickness[numdof]; */
++/* 	IssmDouble  ice_thickness[numdof],bed[numdof]; */
+ 
+-	Input* active_element_input=NULL;
++/* 	Input* active_element_input=NULL; */
+ 
+-	/*Get the flag to know if the efficient layer is present*/
+-	this->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
++/* 	/\*Get the flag to know if the efficient layer is present*\/ */
++/* 	this->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum); */
++/* 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum); */
+ 
+-	if(isefficientlayer){
++/* 	if(isefficientlayer){ */
+ 
+-		/*For now, assuming just one way to compute EPL thickness*/
+-		rho_water        = matpar->GetRhoWater();
+-		rho_ice          = matpar->GetRhoIce();
+-		gravity          = matpar->GetG();
+-		latentheat       = matpar->GetLatentHeat();
+-		epl_conductivity = matpar->GetEplConductivity();
+-		init_thick       = matpar->GetEplInitialThickness();
+-		n                = material->GetN();
+-		A                = material->GetAbar();
++/* 		/\*For now, assuming just one way to compute EPL thickness*\/ */
++/* 		rho_water        = matpar->GetRhoWater(); */
++/* 		rho_ice          = matpar->GetRhoIce(); */
++/* 		gravity          = matpar->GetG(); */
++/* 		latentheat       = matpar->GetLatentHeat(); */
++/* 		epl_conductivity = matpar->GetEplConductivity(); */
++/* 		init_thick       = matpar->GetEplInitialThickness(); */
++/* 		n                = material->GetN(); */
++/* 		A                = material->GetAbar(); */
+ 		
+-		active_element_input=inputs->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);
+-		active_element_input->GetInputValue(&active_element);
++/* 		active_element_input=inputs->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input); */
++/* 		active_element_input->GetInputValue(&active_element); */
+ 			
+-		GetInputListOnVertices(&eplhead[0],EplHeadEnum);
+-		GetInputListOnVertices(&epl_slopeX[0],EplHeadSlopeXEnum); 
+-		GetInputListOnVertices(&epl_slopeY[0],EplHeadSlopeYEnum);
+-		GetInputListOnVertices(&old_thickness[0],HydrologydcEplThicknessOldEnum);
+-		GetInputListOnVertices(&ice_thickness[0],ThicknessEnum);
+-		GetInputListOnVertices(&bed[0],BedEnum);
++/* 		GetInputListOnVertices(&eplhead[0],EplHeadEnum); */
++/* 		GetInputListOnVertices(&epl_slopeX[0],EplHeadSlopeXEnum);  */
++/* 		GetInputListOnVertices(&epl_slopeY[0],EplHeadSlopeYEnum); */
++/* 		GetInputListOnVertices(&old_thickness[0],HydrologydcEplThicknessOldEnum); */
++/* 		GetInputListOnVertices(&ice_thickness[0],ThicknessEnum); */
++/* 		GetInputListOnVertices(&bed[0],BedEnum); */
+ 		
+-		if(!active_element){
+-			/*Keeping thickness to initial value if EPL is not active*/
+-			for(int i=0;i<numdof;i++){
+-				thickness[i]=init_thick;
+-			}
+-		}
+-		else{
+-			for(int i=0;i<numdof;i++){
++/* 		if(!active_element){ */
++/* 			/\*Keeping thickness to initial value if EPL is not active*\/ */
++/* 			for(int i=0;i<numdof;i++){ */
++/* 				thickness[i]=init_thick; */
++/* 			} */
++/* 		} */
++/* 		else{ */
++/* 			for(int i=0;i<numdof;i++){ */
+ 				
+-				/*Compute first the effective pressure in the EPL*/
+-				EPL_N=gravity*((rho_ice*ice_thickness[i])-(rho_water*(eplhead[i]-bed[i])));
+-				if(EPL_N<0.0)EPL_N=0.0;
+-				/*Get then the square of the gradient of EPL heads*/
+-				EPLgrad2 = (epl_slopeX[i]*epl_slopeX[i]+epl_slopeY[i]*epl_slopeY[i]);
++/* 				/\*Compute first the effective pressure in the EPL*\/ */
++/* 				EPL_N=gravity*((rho_ice*ice_thickness[i])-(rho_water*(eplhead[i]-bed[i]))); */
++/* 				if(EPL_N<0.0)EPL_N=0.0; */
++/* 				/\*Get then the square of the gradient of EPL heads*\/ */
++/* 				EPLgrad2 = (epl_slopeX[i]*epl_slopeX[i]+epl_slopeY[i]*epl_slopeY[i]); */
+ 				
+-				/*And proceed to the real thing*/
+-				thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*EPLgrad2-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
++/* 				/\*And proceed to the real thing*\/ */
++/* 				thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*EPLgrad2-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n))); */
+ 					
+-				/*Take care of otherthikening*/
+-				if(thickness[i]>10.0*init_thick){
+-					thickness[i] = 10.0*init_thick;
+-				}
+-			}
+-		}
+-		this->inputs->AddInput(new TriaInput(HydrologydcEplThicknessEnum,thickness,P1Enum));
+-	}
+-}
++/* 				/\*Take care of otherthikening*\/ */
++/* 				if(thickness[i]>10.0*init_thick){ */
++/* 					thickness[i] = 10.0*init_thick; */
++/* 				} */
++/* 			} */
++/* 		} */
++/* 		this->inputs->AddInput(new TriaInput(HydrologydcEplThicknessEnum,thickness,P1Enum)); */
++/* 	} */
++/* } */
+ /*}}}*/
+ 
+ #ifdef _HAVE_DAKOTA_
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17360)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17361)
+@@ -252,10 +252,11 @@
+ 		void UpdateConstraintsExtrudeFromTop(void);
+ 
+ 		void           CreateHydrologyWaterVelocityInput(void);
++		
+ 		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode);
+ 		void           HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
+ 		void           HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask);
+-		void           ComputeEPLThickness(void);
++		//		void           ComputeEPLThickness(void);
+ 		/*}}}*/
+ 
+ };
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17360)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17361)
+@@ -4219,82 +4219,82 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::ComputeEPLThickness{{{*/
+-void  Penta::ComputeEPLThickness(void){
++/* /\*FUNCTION Penta::ComputeEPLThickness{{{*\/ */
++/* void  Penta::ComputeEPLThickness(void){ */
+ 
+-	int         i;
+-	const int   numdof   = NDOF1 *NUMVERTICES;
+-	const int   numdof2d = NDOF1 *NUMVERTICES2D;
+-	bool        isefficientlayer;
+-	IssmDouble  n,A,dt,init_thick;
+-	IssmDouble  rho_water,rho_ice;
+-	IssmDouble  gravity,latentheat,EPLgrad;
+-	IssmDouble  EPL_N,epl_conductivity;
+-	IssmDouble  activeEpl[numdof],thickness[numdof];
+-	IssmDouble  eplhead[numdof], old_thickness[numdof];
+-	IssmDouble  epl_slopeX[numdof],epl_slopeY[numdof];
+-	IssmDouble  ice_thickness[numdof],bed[numdof];
+-	Penta       *penta = NULL;
+-	/*If not on bed, return*/
+-	if (!IsOnBed())return;
++/* 	int         i; */
++/* 	const int   numdof   = NDOF1 *NUMVERTICES; */
++/* 	const int   numdof2d = NDOF1 *NUMVERTICES2D; */
++/* 	bool        isefficientlayer; */
++/* 	IssmDouble  n,A,dt,init_thick; */
++/* 	IssmDouble  rho_water,rho_ice; */
++/* 	IssmDouble  gravity,latentheat,EPLgrad; */
++/* 	IssmDouble  EPL_N,epl_conductivity; */
++/* 	IssmDouble  activeEpl[numdof],thickness[numdof]; */
++/* 	IssmDouble  eplhead[numdof], old_thickness[numdof]; */
++/* 	IssmDouble  epl_slopeX[numdof],epl_slopeY[numdof]; */
++/* 	IssmDouble  ice_thickness[numdof],bed[numdof]; */
++/* 	Penta       *penta = NULL; */
++/* 	/\*If not on bed, return*\/ */
++/* 	if (!IsOnBed())return; */
+ 
+-	/*Get the flag to know if the efficient layer is present*/
+-	this->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);
+-	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
++/* 	/\*Get the flag to know if the efficient layer is present*\/ */
++/* 	this->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum); */
++/* 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum); */
+ 
+-	if(isefficientlayer){
+-		/*For now, assuming just one way to compute EPL thickness*/
+-		rho_water        = matpar->GetRhoWater();
+-		rho_ice          = matpar->GetRhoIce();
+-		gravity          = matpar->GetG();
+-		latentheat       = matpar->GetLatentHeat();
+-		epl_conductivity = matpar->GetEplConductivity();
+-		init_thick       = matpar->GetEplInitialThickness();
+-		n                = material->GetN();
+-		A                = material->GetA();
++/* 	if(isefficientlayer){ */
++/* 		/\*For now, assuming just one way to compute EPL thickness*\/ */
++/* 		rho_water        = matpar->GetRhoWater(); */
++/* 		rho_ice          = matpar->GetRhoIce(); */
++/* 		gravity          = matpar->GetG(); */
++/* 		latentheat       = matpar->GetLatentHeat(); */
++/* 		epl_conductivity = matpar->GetEplConductivity(); */
++/* 		init_thick       = matpar->GetEplInitialThickness(); */
++/* 		n                = material->GetN(); */
++/* 		A                = material->GetA(); */
+ 		
+-		GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveNodeEnum);
+-		GetInputListOnVertices(&eplhead[0],EplHeadEnum);
+-		GetInputListOnVertices(&epl_slopeX[0],EplHeadSlopeXEnum); 
+-		GetInputListOnVertices(&epl_slopeY[0],EplHeadSlopeYEnum);
+-		GetInputListOnVertices(&old_thickness[0],HydrologydcEplThicknessOldEnum);
+-		GetInputListOnVertices(&ice_thickness[0],ThicknessEnum);
+-		GetInputListOnVertices(&bed[0],BedEnum);
++/* 		GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveNodeEnum); */
++/* 		GetInputListOnVertices(&eplhead[0],EplHeadEnum); */
++/* 		GetInputListOnVertices(&epl_slopeX[0],EplHeadSlopeXEnum);  */
++/* 		GetInputListOnVertices(&epl_slopeY[0],EplHeadSlopeYEnum); */
++/* 		GetInputListOnVertices(&old_thickness[0],HydrologydcEplThicknessOldEnum); */
++/* 		GetInputListOnVertices(&ice_thickness[0],ThicknessEnum); */
++/* 		GetInputListOnVertices(&bed[0],BedEnum); */
+ 		
+-		for(int i=0;i<numdof2d;i++){
+-			/*Keeping thickness to 1 if EPL is not active*/
+-			if(activeEpl[i]==0.0){
+-				thickness[i]=init_thick;
+-				thickness[i+numdof2d]=thickness[i];
+-			}
+-			else{
++/* 		for(int i=0;i<numdof2d;i++){ */
++/* 			/\*Keeping thickness to 1 if EPL is not active*\/ */
++/* 			if(activeEpl[i]==0.0){ */
++/* 				thickness[i]=init_thick; */
++/* 				thickness[i+numdof2d]=thickness[i]; */
++/* 			} */
++/* 			else{ */
+ 
+-				/*Compute first the effective pressure in the EPL*/
+-				EPL_N=gravity*((rho_ice*ice_thickness[i])-(rho_water*(eplhead[i]-bed[i])));
+-				if(EPL_N<0.0)EPL_N=0.0;
+-				/*Get then the gradient of EPL heads*/
+-				EPLgrad = epl_slopeX[i]+epl_slopeY[i];
++/* 				/\*Compute first the effective pressure in the EPL*\/ */
++/* 				EPL_N=gravity*((rho_ice*ice_thickness[i])-(rho_water*(eplhead[i]-bed[i]))); */
++/* 				if(EPL_N<0.0)EPL_N=0.0; */
++/* 				/\*Get then the gradient of EPL heads*\/ */
++/* 				EPLgrad = epl_slopeX[i]+epl_slopeY[i]; */
+ 				
+-				/*And proceed to the real thing*/
+-				thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*pow(EPLgrad,2.0)-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
+-				thickness[i+numdof2d]=thickness[i];
+-			}
+-		}
+-		penta=this;
+-		for(;;){
++/* 				/\*And proceed to the real thing*\/ */
++/* 				thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*pow(EPLgrad,2.0)-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n))); */
++/* 				thickness[i+numdof2d]=thickness[i]; */
++/* 			} */
++/* 		} */
++/* 		penta=this; */
++/* 		for(;;){ */
+ 
+-			/*Add input to the element: */			
+-			penta->inputs->AddInput(new PentaInput(HydrologydcEplThicknessEnum,thickness,P1Enum));
++/* 			/\*Add input to the element: *\/			 */
++/* 			penta->inputs->AddInput(new PentaInput(HydrologydcEplThicknessEnum,thickness,P1Enum)); */
+ 			
+-			/*Stop if we have reached the surface*/
+-			if (penta->IsOnSurface()) break;
++/* 			/\*Stop if we have reached the surface*\/ */
++/* 			if (penta->IsOnSurface()) break; */
+ 			
+-			/* get upper Penta*/
+-			penta=penta->GetUpperPenta(); _assert_(penta->Id()!=this->id);
+-		}
+-	}
+-}
+-/*}}}*/
++/* 			/\* get upper Penta*\/ */
++/* 			penta=penta->GetUpperPenta(); _assert_(penta->Id()!=this->id); */
++/* 		} */
++/* 	} */
++/* } */
++/* /\*}}}*\/ */
+ 
+ /*FUNCTION Penta::MigrateGroundingLine{{{*/
+ void  Penta::MigrateGroundingLine(IssmDouble* phi_ungrounding){
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17360)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17361)
+@@ -243,7 +243,7 @@
+ 		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode);
+ 		void           HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
+ 		void           HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask);
+-		void           ComputeEPLThickness(void);
++		//		void           ComputeEPLThickness(void);
+ 
+ 		void           UpdateConstraintsExtrudeFromBase(void);
+ 		void           UpdateConstraintsExtrudeFromTop(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17360)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17361)
+@@ -152,7 +152,8 @@
+ 		void    GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode){_error_("not implemented yet");};
+ 		void    HydrologyEPLGetActive(Vector<IssmDouble>* active_vec){_error_("not implemented yet");};
+ 		void    HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask){_error_("not implemented yet");};
+-		void    ComputeEPLThickness(void){_error_("not implemented yet");};
++		//		void    ComputeEPLThickness(void){_error_("not implemented yet");};
++		
+ 		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type){_error_("not implemented yet");};
+ 		void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum){_error_("not implemented yet");};
+ 		void        InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/FemModel.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.h	(revision 17360)
++++ ../trunk-jpl/src/c/classes/FemModel.h	(revision 17361)
+@@ -95,7 +95,7 @@
+ 		void UpdateConstraintsExtrudeFromBasex();
+ 		void UpdateConstraintsExtrudeFromTopx();
+ 		void HydrologyEPLupdateDomainx(void);
+-		void HydrologyEPLThicknessx(void);
++		//		void HydrologyEPLThicknessx(void);
+ 		void UpdateConstraintsL2ProjectionEPLx(void);
+ };
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17361-17362.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17361-17362.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17361-17362.diff	(revision 17802)
@@ -0,0 +1,177 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17361)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17362)
+@@ -108,6 +108,7 @@
+ ElementMatrix* HydrologyDCEfficientAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
++	bool     active_element;
+ 	int      meshtype;
+ 	Element* basalelement;
+ 
+@@ -124,8 +125,11 @@
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
++	Input* active_element_input = basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);
++	active_element_input->GetInputValue(&active_element);
++
+ 	/*Check that all nodes are active, else return empty matrix*/
+-	if(!basalelement->AllActive()) { /*This could probably replaced by active elt mask*/
++	if(!active_element) {
+ 	if(meshtype!=Mesh2DhorizontalEnum){
+ 			basalelement->DeleteMaterials(); 
+ 			delete basalelement;
+@@ -203,6 +207,7 @@
+ ElementVector* HydrologyDCEfficientAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
++	bool     active_element;
+ 	int      meshtype;
+ 	Element* basalelement;
+ 
+@@ -218,8 +223,12 @@
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
++
++	Input* active_element_input = basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);
++	active_element_input->GetInputValue(&active_element);
++
+ 	/*Check that all nodes are active, else return empty matrix*/
+-	if(!basalelement->AllActive()) {
++	if(!active_element) {
+ 	if(meshtype!=Mesh2DhorizontalEnum){
+ 			basalelement->DeleteMaterials(); 
+ 			delete basalelement;
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 17361)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 17362)
+@@ -85,7 +85,6 @@
+ 	int      meshtype;
+ 	bool     active_element;
+ 	Element* basalelement;
+-	Input*   active_element_input=NULL;
+ 
+ 	/*Get basal element*/
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+@@ -104,13 +103,12 @@
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+-	/* active_element_input=basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input); */
+-	/* active_element_input->GetInputValue(&active_element); */
++	Input* active_element_input=basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);
++	active_element_input->GetInputValue(&active_element);
+ 
+ 	/* Check that all nodes are active, else return empty matrix */
+-	if(!basalelement->AllActive()) {
+-		//	if(!active_element){
+-	if(meshtype!=Mesh2DhorizontalEnum){
++	if(!active_element){
++		if(meshtype!=Mesh2DhorizontalEnum){
+ 			basalelement->DeleteMaterials();
+ 			delete basalelement;
+ 		}
+@@ -159,7 +157,6 @@
+ 	int      meshtype;
+ 	bool     active_element;
+ 	Element* basalelement;
+-	Input*   active_element_input=NULL;
+ 
+ 	/*Get basal element*/
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+@@ -174,12 +171,11 @@
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+-	/* active_element_input=basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input); */
+-	/* active_element_input->GetInputValue(&active_element); */
++	Input* active_element_input = basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);
++	active_element_input->GetInputValue(&active_element);
+ 
+ 	/*Check that all nodes are active, else return empty matrix*/
+-	if(!basalelement->AllActive()) {
+-		/* if(!active_element){ */
++	if(!active_element) {
+ 		if(meshtype!=Mesh2DhorizontalEnum){
+ 			basalelement->DeleteMaterials();
+ 			delete basalelement;
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17361)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17362)
+@@ -116,7 +116,6 @@
+ 					if(VerboseConvergence()) _printf0_("   # Sediment unstable constraints = " << num_unstable_constraints << "\n");
+ 					if(num_unstable_constraints==0) sedconverged = true;
+ 					if (sedcount>=hydro_maxiter){
+-						//sedconverged = true;
+ 						_error_("   maximum number of Sediment iterations (" << hydro_maxiter << ") exceeded");
+ 					}
+ 				}
+@@ -173,6 +172,7 @@
+ 
+ 				/* {{{ *//*Retrieve the EPL head slopes and compute EPL Thickness*/
+ 				if(VerboseSolution()) _printf0_("computing EPL Head slope...\n");
++				inefanalysis->ElementizeEplMask(femmodel);
+ 				femmodel->SetCurrentConfiguration(L2ProjectionEPLAnalysisEnum);
+ 				femmodel->UpdateConstraintsL2ProjectionEPLx();
+ 				femmodel->parameters->SetParam(EplHeadSlopeXEnum,InputToL2ProjectEnum);
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17361)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17362)
+@@ -51,8 +51,8 @@
+ 
+ 		/*Functions*/
+ 		void       AddInput(Input* input_in);
+-		bool       AllActive(void);
+-		bool       AnyActive(void);
++		/* bool       AllActive(void); */
++		/* bool       AnyActive(void); */
+ 		void       CoordinateSystemTransform(IssmDouble** ptransform,Node** nodes,int numnodes,int* cs_array);
+ 		void       DeleteMaterials(void);
+ 		void       FindParam(bool* pvalue,int paramenum);
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17361)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17362)
+@@ -36,22 +36,22 @@
+ 	_assert_(this->inputs);
+ 	this->inputs->AddInput(input_in);
+ }/*}}}*/
+-bool Element::AllActive(void){/*{{{*/
++/* bool Element::AllActive(void){/\*{{{*\/ */
+ 
+-	int numnodes = this->GetNumberOfNodes();
+-	for(int i=0;i<numnodes;i++){
+-		if(!this->nodes[i]->IsActive()) return false;
+-	}
+-	return true;
+-}/*}}}*/
+-bool Element::AnyActive(void){/*{{{*/
++/* 	int numnodes = this->GetNumberOfNodes(); */
++/* 	for(int i=0;i<numnodes;i++){ */
++/* 		if(!this->nodes[i]->IsActive()) return false; */
++/* 	} */
++/* 	return true; */
++/* }/\*}}}*\/ */
++/* bool Element::AnyActive(void){/\*{{{*\/ */
+ 
+-	int numnodes = this->GetNumberOfNodes();
+-	for(int i=0;i<numnodes;i++){
+-		if(this->nodes[i]->IsActive()) return true;
+-	}
+-	return false;
+-}/*}}}*/
++/* 	int numnodes = this->GetNumberOfNodes(); */
++/* 	for(int i=0;i<numnodes;i++){ */
++/* 		if(this->nodes[i]->IsActive()) return true; */
++/* 	} */
++/* 	return false; */
++/* }/\*}}}*\/ */
+ void Element::CoordinateSystemTransform(IssmDouble** ptransform,Node** nodes_list,int numnodes,int* cs_array){/*{{{*/
+ 
+ 	int         i,counter;
Index: issm/oecreview/Archive/16554-17801/ISSM-17362-17363.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17362-17363.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17362-17363.diff	(revision 17802)
@@ -0,0 +1,104 @@
+Index: ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17362)
++++ ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17363)
+@@ -56,8 +56,14 @@
+ 
+ 	if(VerboseSolution()) _printf0_("extrapolation of " << EnumToStringx(extvar_enum) << ": call computational core:\n");
+ 	solutionsequence_linear(femmodel);
++	
++	save_results=true;
++	if(save_results){
++		if(VerboseSolution()) _printf0_("   saving results\n");
++		int outputs[2] = {VxEnum,VyEnum};
++		femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],2);
++	}
+ 
+-
+ }/*}}}*/
+ ElementVector* ExtrapolationAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+@@ -83,15 +89,11 @@
+ 
+ 	/*Initialize Element vector and other vectors*/
+ 	ElementMatrix* Ke     = element->NewElementMatrix();
+-	IssmDouble*    B      = xNew<IssmDouble>(dim*numnodes);
+ 	IssmDouble*    Bprime = xNew<IssmDouble>(dim*numnodes);
+ 	IssmDouble     D[dim][dim];
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	Input* lsf_slopex_input=element->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
+-	Input* lsf_slopey_input=element->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+ 	element->GetVerticesCoordinates(&xyz_list);
+-	h = element->CharacteristicLength();
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	Gauss* gauss=element->NewGauss(2);
+@@ -99,64 +101,22 @@
+ 		gauss->GaussPoint(ig);
+ 
+ 		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+-		GetB(B,element,xyz_list,gauss);
+ 		GetBprime(Bprime,element,xyz_list,gauss);
+ 
+-		/* Get normal on ice boundary */
+-		lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
+-		lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
+-		norm_dlsf=0.;
+-		for(i=0;i<dim;i++) norm_dlsf+=dlsf[i]*dlsf[i]; 
+-		norm_dlsf=sqrt(norm_dlsf); _assert_(norm_dlsf>0.);
+-		for(i=0;i<dim;i++)
+-			normal[i]=dlsf[i]/norm_dlsf;
+-		
+ 		D_scalar=gauss->weight*Jdet;
+ 
+ 		for(row=0;row<dim;row++)
+ 			for(col=0;col<dim;col++)
+-				if(row==col)
+-					D[row][col]=D_scalar*normal[row];
+-				else
+-					D[row][col]=0.;
+-		TripleMultiply(B,dim,numnodes,1,
++				D[row][col]=((row==col)?D_scalar:0.);
++
++		TripleMultiply(Bprime,dim,numnodes,1,
+ 					&D[0][0],dim,dim,0,
+ 					Bprime,dim,numnodes,0,
+ 					&Ke->values[0],1);
+-
+-		/* Stabilization *//*{{{*/
+-		stabilization=1;
+-		if (stabilization==0){/* no stabilization, do nothing*/}
+-		else if(stabilization==1){
+-			/* Artificial Diffusion */
+-			element->ElementSizes(&hx,&hy,&hz);
+-			h=sqrt( pow(hx*normal[0],2) + pow(hy*normal[1],2));
+-			kappa=h/2.; 
+-			D[0][0]=D_scalar*kappa;
+-			D[0][1]=0.;
+-			D[1][0]=0.;
+-			D[1][1]=D_scalar*kappa;
+-			TripleMultiply(Bprime,dim,numnodes,1,
+-						&D[0][0],dim,dim,0,
+-						Bprime,dim,numnodes,0,
+-						&Ke->values[0],1);
+-		}
+-		else if(stabilization==2){
+-			/*Streamline upwinding - do not use this for extrapolation: yields oscillating results due to smoothing along normal, not across */
+-			for(row=0;row<dim;row++)
+-				for(col=0;col<dim;col++)
+-					D[row][col]=h/(2.*1.)*normal[row]*normal[col];
+-
+-			TripleMultiply(Bprime,dim,numnodes,1,
+-						&D[0][0],dim,dim,0,
+-						Bprime,dim,numnodes,0,
+-						&Ke->values[0],1);
+-		}/*}}}*/
+ 	}/*}}}*/
+ 
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(xyz_list);
+-	xDelete<IssmDouble>(B);
+ 	xDelete<IssmDouble>(Bprime);
+ 	delete gauss;
+ 	return Ke;
Index: issm/oecreview/Archive/16554-17801/ISSM-17363-17364.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17363-17364.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17363-17364.diff	(revision 17802)
@@ -0,0 +1,613 @@
+Index: ../trunk-jpl/test/NightlyRun/test336.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test336.py	(revision 17363)
++++ ../trunk-jpl/test/NightlyRun/test336.py	(revision 17364)
+@@ -34,6 +34,7 @@
+ D=numpy.sqrt(numpy.power(md.mesh.x.reshape(-1,1)-xmed,2.)+numpy.power(md.mesh.y.reshape(-1,1)-ymed,2.))
+ R=0.2*(xmax-xmin)
+ md.mask.ice_levelset=D-R
++md.masstransport.calvingrate=0.*numpy.ones((md.mesh.numberofvertices,1))
+ 
+ md=solve(md,TransientSolutionEnum())
+ 
+Index: ../trunk-jpl/test/Archives/Archive336.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17363)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17364)
+@@ -14,7 +14,7 @@
+ }
+ /*}}}*/
+ void LevelsetAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+-	int    stabilization,finiteelement;
++	int  finiteelement;
+ 
+ 	/*Finite element type*/
+ 	finiteelement = P1Enum;
+@@ -32,6 +32,7 @@
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,VxEnum);
+ 	iomodel->FetchDataToInput(elements,VyEnum);
++	iomodel->FetchDataToInput(elements,MasstransportCalvingrateEnum);
+ 	
+ }
+ /*}}}*/
+@@ -92,10 +93,13 @@
+ 
+ 	/*Intermediaries */
+ 	const int  dim = 2; // solve for LSF in horizontal plane only
++	int i, row, col;
+ 	IssmDouble kappa;
+ 	IssmDouble Jdet, dt, D_scalar;
+ 	IssmDouble h,hx,hy,hz;
+-	IssmDouble vel,vx,vy,bx,by;
++	IssmDouble vel,v[dim];
++	IssmDouble calvingrate, c[dim];
++	IssmDouble dlsf[dim], norm_dlsf, normal[dim];
+ 	IssmDouble* xyz_list = NULL;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -106,13 +110,16 @@
+ 	IssmDouble*    basis    = xNew<IssmDouble>(numnodes);
+ 	IssmDouble*    B        = xNew<IssmDouble>(dim*numnodes);
+ 	IssmDouble*    Bprime   = xNew<IssmDouble>(dim*numnodes);
+-	IssmDouble     D[dim][dim], K[dim][dim];
++	IssmDouble     D[dim][dim];
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+ 	element->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	Input* vx_input  = element->GetInput(VxEnum);     _assert_(vx_input);
+ 	Input* vy_input  = element->GetInput(VyEnum);     _assert_(vy_input);
++	Input* lsf_slopex_input  = element->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
++	Input* lsf_slopey_input  = element->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
++	Input* calvingrate_input  = element->GetInput(MasstransportCalvingrateEnum);     _assert_(calvingrate_input);
+ 	
+ 	/* Start  looping on the number of gaussian points: */
+ 	Gauss* gauss=element->NewGauss(2);
+@@ -135,14 +142,25 @@
+ 		/* Advection */
+ 		GetB(B,element,xyz_list,gauss); 
+ 		GetBprime(Bprime,element,xyz_list,gauss); 
+-		vx_input->GetInputValue(&vx,gauss); // in 3D case, add mesh velocity 
+-		vy_input->GetInputValue(&vy,gauss); 
+-		bx=0.; // horizontal mass change velocities (melt/refreeze/calving) FIXME: insert values from model here
+-		by=0.;
+-		D[0][0]=D_scalar*(vx+bx);
+-		D[0][1]=0.;
+-		D[1][0]=0.;
+-		D[1][1]=D_scalar*(vy+by);
++		vx_input->GetInputValue(&v[0],gauss); // in 3D case, add mesh velocity 
++		vy_input->GetInputValue(&v[1],gauss); 
++		lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
++		lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
++		calvingrate_input->GetInputValue(&calvingrate,gauss);
++
++		norm_dlsf=0.;
++		for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
++		norm_dlsf=sqrt(norm_dlsf);
++
++		if(norm_dlsf>1.e-10)
++			for(i=0;i<dim;i++) c[i]=calvingrate*dlsf[i]/norm_dlsf;
++		else
++			for(i=0;i<dim;i++) c[i]=0.;
++
++		for(row=0;row<dim;row++)
++			for(col=0;col<dim;col++)
++				D[row][col]=((row==col)?D_scalar*(v[row]-c[row]):0.);
++
+ 		TripleMultiply(B,dim,numnodes,1,
+ 					&D[0][0],dim,dim,0,
+ 					Bprime,dim,numnodes,0,
+@@ -150,6 +168,9 @@
+ 
+ 		/* Stabilization */
+ 		int stabilization=2;
++		vel=0.;
++		for(i=0;i<dim;i++) vel+=pow(v[i],2);
++		vel=sqrt(vel)+1.e-14;
+ 		switch(stabilization){
+ 			case 0:
+ 				// no stabilization, do nothing
+@@ -157,15 +178,13 @@
+ 			case 1:
+ 				/* Artificial Diffusion */
+ 				element->ElementSizes(&hx,&hy,&hz);
+-				vel=sqrt(vx*vx + vy*vy) + 1e-14;
+-				h=sqrt( pow(hx*vx/vel,2) + pow(hy*vy/vel,2) ); //FIXME: is this correct?
++				h=sqrt( pow(hx*v[0]/vel,2) + pow(hy*v[1]/vel,2) ); //FIXME: is this correct?
+ 
+ 				kappa=h*vel/2.; //FIXME: insert suitable value for kappa
+-				//GetBprime(Bprime,element,xyz_list,gauss); // recalculation of Bprime needed?
+-				D[0][0]=D_scalar*kappa;
+-				D[0][1]=0.;
+-				D[1][0]=0.;
+-				D[1][1]=D_scalar*kappa;
++				for(row=0;row<dim;row++)
++					for(col=0;col<dim;col++)
++						D[row][col]=((row==col)?D_scalar*kappa:0.);
++
+ 				TripleMultiply(Bprime,dim,numnodes,1,
+ 							&D[0][0],dim,dim,0,
+ 							Bprime,dim,numnodes,0,
+@@ -174,15 +193,13 @@
+ 			case 2:
+ 				/* Streamline Upwinding */
+ 				element->ElementSizes(&hx,&hy,&hz);
+-				vel=sqrt(vx*vx + vy*vy )+1.e-14;
+-				h=sqrt( pow(hx*vx/vel,2) + pow(hy*vy/vel,2) );
+-				K[0][0]=h/(2.*vel)*vx*vx;  K[0][1]=h/(2.*vel)*vx*vy;
+-				K[1][0]=h/(2.*vel)*vy*vx;  K[1][1]=h/(2.*vel)*vy*vy; 
+-				for(int i=0;i<dim;i++) for(int j=0;j<dim;j++) K[i][j] = D_scalar*K[i][j];
++				h=sqrt( pow(hx*v[0]/vel,2) + pow(hy*v[1]/vel,2) );
++				for(row=0;row<dim;row++) 
++					for(col=0;col<dim;col++) 
++						D[row][col] = D_scalar*h/(2.*vel)*v[row]*v[col];
+ 
+-				//GetBprime(Bprime,element,xyz_list,gauss); 
+ 				TripleMultiply(Bprime,dim,numnodes,1,
+-							&K[0][0],dim,dim,0,
++							&D[0][0],dim,dim,0,
+ 							Bprime,dim,numnodes,0,
+ 							&Ke->values[0],1);
+ 				break;
+@@ -202,9 +219,10 @@
+ ElementVector* LevelsetAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries */
+-	int i, ig;
++	const int dim = 2;
++	int i, ig, k;
+ 	IssmDouble  Jdet,dt;
+-	IssmDouble  phi;
++	IssmDouble  lsf;
+ 	IssmDouble* xyz_list = NULL;
+ 	
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -229,8 +247,10 @@
+ 
+ 			element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+ 			element->NodalFunctions(basis,gauss);
+-			levelset_input->GetInputValue(&phi,gauss);
+-			for(i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*phi*basis[i];
++
++			/* old function value */
++			levelset_input->GetInputValue(&lsf,gauss);
++			for(i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*lsf*basis[i];
+ 		}
+ 
+ 		/*Clean up and return*/
+@@ -319,4 +339,137 @@
+ 	xDelete<IssmDouble>(dbasis);
+ 
+ }/*}}}*/
++void LevelsetAnalysis::SetDistanceOnIntersectedElements(FemModel* femmodel){/*{{{*/
+ 
++	/* Intermediaries */
++	int i,k;
++	IssmDouble dmaxp=0.,dmaxm=0,val=0.;
++
++	/*Initialize vector with number of vertices*/
++	int numvertices=femmodel->vertices->NumberOfVertices();
++	Element* element;
++
++	Vector<IssmDouble>* vec_dist_zerolevelset = NULL;
++	GetVectorFromInputsx(&vec_dist_zerolevelset, femmodel, MaskIceLevelsetEnum, VertexEnum);
++	
++	/* set NaN on elements intersected by zero levelset */
++	for(i=0;i<femmodel->elements->Size();i++){
++		element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++		if(element->IsZeroLevelset(MaskIceLevelsetEnum))
++			for(k=0;k<element->GetNumberOfVertices();k++)
++				vec_dist_zerolevelset->SetValue(element->vertices[k]->Sid(),NAN,INS_VAL); 
++	}
++
++	/* set distance on elements intersected by zero levelset */
++	for(i=0;i<femmodel->elements->Size();i++){
++		element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++		if(element->IsZeroLevelset(MaskIceLevelsetEnum)){
++			SetDistanceToZeroLevelsetElement(vec_dist_zerolevelset, element);
++
++			/* Get maximum distance to interface along vertices */
++			for(k=0;k<element->GetNumberOfVertices();k++){
++					vec_dist_zerolevelset->GetValue(&val,element->vertices[k]->Sid()); 
++					if((val>0.) && (val>dmaxp))
++						 dmaxp=val;
++					else if((val<0.) && (val<dmaxm))
++						 dmaxm=val;
++			}
++		}
++	}
++
++	/* set all none intersected vertices to max/min distance */
++	for(i=0;i<numvertices;i++){
++		vec_dist_zerolevelset->GetValue(&val,i);
++		if(val==1.) //FIXME: improve check
++			vec_dist_zerolevelset->SetValue(i,3.*dmaxp,INS_VAL);
++		else if(val==-1.)
++			vec_dist_zerolevelset->SetValue(i,3.*dmaxm,INS_VAL);
++	}
++
++	/*Assemble vector and serialize */
++	vec_dist_zerolevelset->Assemble();
++	IssmDouble* dist_zerolevelset=vec_dist_zerolevelset->ToMPISerial();
++	InputUpdateFromVectorx(femmodel,dist_zerolevelset,MaskIceLevelsetEnum,VertexSIdEnum);
++
++	/*Clean up and return*/
++	delete vec_dist_zerolevelset;
++	delete dist_zerolevelset;
++}/*}}}*/
++void LevelsetAnalysis::SetDistanceToZeroLevelsetElement(Vector<IssmDouble>* vec_signed_dist, Element* element){/*{{{*/
++
++	if(!element->IsZeroLevelset(MaskIceLevelsetEnum))
++		return;
++
++	/* Intermediaries */
++	const int dim=3;
++	int i,d;
++	int numvertices=element->GetNumberOfVertices();
++	IssmDouble s0[dim], s1[dim], v[dim];
++	IssmDouble dist,lsf_old;
++
++	IssmDouble* lsf = xNew<IssmDouble>(numvertices);
++	IssmDouble* sign_lsf = xNew<IssmDouble>(numvertices);
++	IssmDouble* signed_dist = xNew<IssmDouble>(numvertices);
++	IssmDouble* xyz_list = NULL;
++	IssmDouble* xyz_list_zero = NULL;
++
++	/* retrieve inputs and parameters */
++	element->GetVerticesCoordinates(&xyz_list);
++	element->GetInputListOnVertices(lsf,MaskIceLevelsetEnum);
++
++	/* get sign of levelset function */
++	for(i=0;i<numvertices;i++)
++		sign_lsf[i]=(lsf[i]>=0.?1.:-1.);
++
++	element->ZeroLevelsetCoordinates(&xyz_list_zero, xyz_list, MaskIceLevelsetEnum);
++	for(d=0;d<dim;d++){
++		s0[d]=xyz_list_zero[0+d];
++		s1[d]=xyz_list_zero[3+d];
++	}
++
++	/* get signed_distance of vertices to zero levelset straight */
++	for(i=0;i<numvertices;i++){
++		for(d=0;d<dim;d++)
++			v[d]=xyz_list[3*i+d];
++		dist=GetDistanceToStraight(&v[0],&s0[0],&s1[0]);
++		signed_dist[i]=sign_lsf[i]*dist;
++	}
++	
++	/* insert signed_distance into vec_signed_dist, if computed distance is smaller */
++	for(i=0;i<numvertices;i++){
++		vec_signed_dist->GetValue(&lsf_old, element->vertices[i]->Sid());
++		if(xIsNan<IssmDouble>(lsf_old) || fabs(signed_dist[i])<fabs(lsf_old))
++			vec_signed_dist->SetValue(element->vertices[i]->Sid(),signed_dist[i],INS_VAL);
++	}
++
++	xDelete<IssmDouble>(lsf);
++	xDelete<IssmDouble>(sign_lsf);
++	xDelete<IssmDouble>(signed_dist);
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(xyz_list_zero);
++}/*}}}*/
++IssmDouble LevelsetAnalysis::GetDistanceToStraight(IssmDouble* q, IssmDouble* s0, IssmDouble* s1){/*{{{*/
++	// returns distance d of point q to straight going through points s0, s1
++	// d=|a x b|/|b|
++	// with a=q-s0, b=s1-s0
++	
++	/* Intermediaries */
++	const int dim=2;
++	int i;
++	IssmDouble a[dim], b[dim];
++	IssmDouble norm_b;
++
++	for(i=0;i<dim;i++){
++		a[i]=q[i]-s0[i];
++		b[i]=s1[i]-s0[i];
++	}
++	
++	norm_b=0.;
++	for(i=0;i<dim;i++)
++		norm_b+=b[i]*b[i];
++	norm_b=sqrt(norm_b);
++	_assert_(norm_b>0.);
++
++	return fabs(a[0]*b[1]-a[1]*b[0])/norm_b;
++}/*}}}*/
++
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h	(revision 17363)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h	(revision 17364)
+@@ -10,7 +10,7 @@
+ 
+ class LevelsetAnalysis: public Analysis{
+ 	
+- public:
++public:
+ 	/*Model processing*/
+ 	int  DofsPerNode(int** doflist,int meshtype,int approximation);
+ 	void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+@@ -26,10 +26,12 @@
+ 	ElementMatrix* CreateKMatrix(Element* element);
+ 	ElementVector* CreatePVector(Element* element);
+ 	void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+-		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+-		void UpdateConstraints(FemModel* femmodel);
++	void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++	void UpdateConstraints(FemModel* femmodel);
+ 	void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 	void GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+-
++	void SetDistanceOnIntersectedElements(FemModel* femmodel);
++	void SetDistanceToZeroLevelsetElement(Vector<IssmDouble>* vec_signed_dist, Element* element);
++	IssmDouble GetDistanceToStraight(IssmDouble* q, IssmDouble* s0, IssmDouble* s1);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17363)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17364)
+@@ -216,6 +216,7 @@
+ 	MasstransportMinThicknessEnum,
+ 	MasstransportPenaltyFactorEnum,
+ 	MasstransportSpcthicknessEnum,
++	MasstransportCalvingrateEnum,
+ 	MasstransportStabilizationEnum,
+ 	MasstransportVertexPairingEnum,
+ 	MasstransportNumRequestedOutputsEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17363)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17364)
+@@ -224,6 +224,7 @@
+ 		case MasstransportMinThicknessEnum : return "MasstransportMinThickness";
+ 		case MasstransportPenaltyFactorEnum : return "MasstransportPenaltyFactor";
+ 		case MasstransportSpcthicknessEnum : return "MasstransportSpcthickness";
++		case MasstransportCalvingrateEnum : return "MasstransportCalvingrate";
+ 		case MasstransportStabilizationEnum : return "MasstransportStabilization";
+ 		case MasstransportVertexPairingEnum : return "MasstransportVertexPairing";
+ 		case MasstransportNumRequestedOutputsEnum : return "MasstransportNumRequestedOutputs";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17363)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17364)
+@@ -227,6 +227,7 @@
+ 	      else if (strcmp(name,"MasstransportMinThickness")==0) return MasstransportMinThicknessEnum;
+ 	      else if (strcmp(name,"MasstransportPenaltyFactor")==0) return MasstransportPenaltyFactorEnum;
+ 	      else if (strcmp(name,"MasstransportSpcthickness")==0) return MasstransportSpcthicknessEnum;
++	      else if (strcmp(name,"MasstransportCalvingrate")==0) return MasstransportCalvingrateEnum;
+ 	      else if (strcmp(name,"MasstransportStabilization")==0) return MasstransportStabilizationEnum;
+ 	      else if (strcmp(name,"MasstransportVertexPairing")==0) return MasstransportVertexPairingEnum;
+ 	      else if (strcmp(name,"MasstransportNumRequestedOutputs")==0) return MasstransportNumRequestedOutputsEnum;
+@@ -258,11 +259,11 @@
+ 	      else if (strcmp(name,"SteadystateReltol")==0) return SteadystateReltolEnum;
+ 	      else if (strcmp(name,"SteadystateRequestedOutputs")==0) return SteadystateRequestedOutputsEnum;
+ 	      else if (strcmp(name,"Surface")==0) return SurfaceEnum;
+-	      else if (strcmp(name,"ThermalIsenthalpy")==0) return ThermalIsenthalpyEnum;
+          else stage=3;
+    }
+    if(stage==3){
+-	      if (strcmp(name,"ThermalIsdynamicbasalspc")==0) return ThermalIsdynamicbasalspcEnum;
++	      if (strcmp(name,"ThermalIsenthalpy")==0) return ThermalIsenthalpyEnum;
++	      else if (strcmp(name,"ThermalIsdynamicbasalspc")==0) return ThermalIsdynamicbasalspcEnum;
+ 	      else if (strcmp(name,"ThermalMaxiter")==0) return ThermalMaxiterEnum;
+ 	      else if (strcmp(name,"ThermalPenaltyFactor")==0) return ThermalPenaltyFactorEnum;
+ 	      else if (strcmp(name,"ThermalPenaltyLock")==0) return ThermalPenaltyLockEnum;
+@@ -381,11 +382,11 @@
+ 	      else if (strcmp(name,"Vertices")==0) return VerticesEnum;
+ 	      else if (strcmp(name,"Results")==0) return ResultsEnum;
+ 	      else if (strcmp(name,"GenericParam")==0) return GenericParamEnum;
+-	      else if (strcmp(name,"AdolcParam")==0) return AdolcParamEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"BoolInput")==0) return BoolInputEnum;
++	      if (strcmp(name,"AdolcParam")==0) return AdolcParamEnum;
++	      else if (strcmp(name,"BoolInput")==0) return BoolInputEnum;
+ 	      else if (strcmp(name,"BoolParam")==0) return BoolParamEnum;
+ 	      else if (strcmp(name,"Contour")==0) return ContourEnum;
+ 	      else if (strcmp(name,"ControlInput")==0) return ControlInputEnum;
+@@ -504,11 +505,11 @@
+ 	      else if (strcmp(name,"VyMesh")==0) return VyMeshEnum;
+ 	      else if (strcmp(name,"VzMesh")==0) return VzMeshEnum;
+ 	      else if (strcmp(name,"Enthalpy")==0) return EnthalpyEnum;
+-	      else if (strcmp(name,"EnthalpyPicard")==0) return EnthalpyPicardEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"ThicknessAbsGradient")==0) return ThicknessAbsGradientEnum;
++	      if (strcmp(name,"EnthalpyPicard")==0) return EnthalpyPicardEnum;
++	      else if (strcmp(name,"ThicknessAbsGradient")==0) return ThicknessAbsGradientEnum;
+ 	      else if (strcmp(name,"ThicknessAlongGradient")==0) return ThicknessAlongGradientEnum;
+ 	      else if (strcmp(name,"ThicknessAcrossGradient")==0) return ThicknessAcrossGradientEnum;
+ 	      else if (strcmp(name,"IntMatParam")==0) return IntMatParamEnum;
+@@ -627,11 +628,11 @@
+ 	      else if (strcmp(name,"Separate")==0) return SeparateEnum;
+ 	      else if (strcmp(name,"Sset")==0) return SsetEnum;
+ 	      else if (strcmp(name,"Verbose")==0) return VerboseEnum;
+-	      else if (strcmp(name,"TriangleInterp")==0) return TriangleInterpEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"BilinearInterp")==0) return BilinearInterpEnum;
++	      if (strcmp(name,"TriangleInterp")==0) return TriangleInterpEnum;
++	      else if (strcmp(name,"BilinearInterp")==0) return BilinearInterpEnum;
+ 	      else if (strcmp(name,"NearestInterp")==0) return NearestInterpEnum;
+ 	      else if (strcmp(name,"XY")==0) return XYEnum;
+ 	      else if (strcmp(name,"XYZ")==0) return XYZEnum;
+Index: ../trunk-jpl/src/c/cores/transient_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17363)
++++ ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17364)
+@@ -92,6 +92,13 @@
+ 		}
+ 	}
+ 
++	if(islevelset){
++		/* set distance on elements intersected by zero level set */
++		LevelsetAnalysis* lsfanalysis = new LevelsetAnalysis();
++		lsfanalysis->SetDistanceOnIntersectedElements(femmodel);
++		delete lsfanalysis;
++	}
++	
+ 	while(time < finaltime - (yts*DBL_EPSILON)){ //make sure we run up to finaltime.
+ 
+ 		/*Increment*/
+@@ -124,11 +131,10 @@
+ 		
+ 		if(islevelset){
+ 			if(VerboseSolution()) _printf0_("   computing movement of ice boundaries\n");
+-			
+-			/* get slope of lsf for computation of normal on ice domain*/
++			/* smoothen slope of lsf for computation of normal on ice domain*/
+ 			levelsetfunctionslope_core(femmodel);
+ 
+-			/* extrapolate along normal */
++			/* extrapolate velocities onto domain with no ice */
+ 			Analysis* extanalysis = new ExtrapolationAnalysis();
+ 			const int nvars=2;
+ 			int vars[nvars] = {VxEnum, VyEnum};
+@@ -138,6 +144,7 @@
+ 			}
+ 			delete extanalysis;	
+ 
++			/* solve level set equation */
+ 			analysis = new LevelsetAnalysis();
+ 			analysis->Core(femmodel);
+ 			delete analysis;
+@@ -148,7 +155,6 @@
+ 			/* add computation domain mask to outputs */
+ 			int outputs[1] = {IceMaskNodeActivationEnum};
+ 			femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],1);
+-
+ 		}
+ 
+ 		if(ismasstransport){
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17363)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17364)
+@@ -462,6 +462,7 @@
+ 				name==LevelsetfunctionSlopeXEnum ||
+ 				name==LevelsetfunctionSlopeYEnum ||
+ 				name==LevelsetfunctionPicardEnum ||
++				name==MasstransportCalvingrateEnum ||
+ 				name==GradientEnum ||
+ 				name==OldGradientEnum  ||
+ 				name==ConvergedEnum || 
+Index: ../trunk-jpl/src/m/classes/masstransport.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/masstransport.py	(revision 17363)
++++ ../trunk-jpl/src/m/classes/masstransport.py	(revision 17364)
+@@ -14,6 +14,7 @@
+ 
+ 	def __init__(self): # {{{
+ 		self.spcthickness           = float('NaN')
++		self.calvingrate            = float('NaN')
+ 		self.isfreesurface          = 0
+ 		self.min_thickness          = 0
+ 		self.hydrostatic_adjustment = 0
+@@ -29,6 +30,7 @@
+ 	def __repr__(self): # {{{
+ 		string='   Masstransport solution parameters:'
+ 		string="%s\n%s"%(string,fielddisplay(self,'spcthickness','thickness constraints (NaN means no constraint) [m]'))
++		string="%s\n%s"%(string,fielddisplay(self,'calvingrate','calving rate at given location [m/a]'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'isfreesurface','do we use free surfaces (FS only) are mass conservation'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'min_thickness','minimum ice thickness allowed [m]'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'hydrostatic_adjustment','adjustment of ice shelves surface and bed elevations: ''Incremental'' or ''Absolute'' '))
+@@ -67,6 +69,8 @@
+ 			return md
+ 
+ 		md = checkfield(md,'fieldname','masstransport.spcthickness','forcing',1)
++		if LevelsetAnalysisEnum() in analyses and md.transient.islevelset:
++			md = checkfield(md,'fieldname','masstransport.calvingrate','NaN',1,'size',[md.mesh.numberofvertices],'>=',0)
+ 		md = checkfield(md,'fieldname','masstransport.isfreesurface','values',[0,1])
+ 		md = checkfield(md,'fieldname','masstransport.hydrostatic_adjustment','values',['Absolute','Incremental'])
+ 		md = checkfield(md,'fieldname','masstransport.stabilization','values',[0,1,2,3])
+@@ -76,7 +80,11 @@
+ 		return md
+ 	# }}}
+ 	def marshall(self,md,fid):    # {{{
++
++		yts=365.*24.*3600.
++
+ 		WriteData(fid,'object',self,'fieldname','spcthickness','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1)
++		WriteData(fid,'object',self,'fieldname','calvingrate','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1,'scale',1./yts)
+ 		WriteData(fid,'object',self,'fieldname','isfreesurface','format','Boolean')
+ 		WriteData(fid,'object',self,'fieldname','min_thickness','format','Double')
+ 		WriteData(fid,'data',StringToEnum(self.hydrostatic_adjustment)[0],'format','Integer','enum',MasstransportHydrostaticAdjustmentEnum())
+Index: ../trunk-jpl/src/m/classes/masstransport.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/masstransport.m	(revision 17363)
++++ ../trunk-jpl/src/m/classes/masstransport.m	(revision 17364)
+@@ -6,6 +6,7 @@
+ classdef masstransport
+ 	properties (SetAccess=public) 
+ 		 spcthickness           = NaN;
++		 calvingrate            = NaN;
+ 		 isfreesurface          = 0;
+ 		 min_thickness          = 0;
+ 		 hydrostatic_adjustment = 0;
+@@ -87,6 +88,10 @@
+ 			if ~ismember(MasstransportAnalysisEnum(),analyses) |  (solution==TransientSolutionEnum() & md.transient.ismasstransport==0), return; end
+ 
+ 			md = checkfield(md,'fieldname','masstransport.spcthickness','forcing',1);
++			if(ismember(LevelsetAnalysisEnum(), analyses) & md.transient.islevelset)
++				md = checkfield(md,'fieldname','masstransport.calvingrate','NaN',1,'size',[md.mesh.numberofvertices 1],'>=',0);
++			end
++
+ 			md = checkfield(md,'fieldname','masstransport.isfreesurface','values',[0 1]);
+ 			md = checkfield(md,'fieldname','masstransport.hydrostatic_adjustment','values',{'Absolute' 'Incremental'});
+ 			md = checkfield(md,'fieldname','masstransport.stabilization','values',[0 1 2 3]);
+@@ -97,6 +102,7 @@
+ 		function disp(obj) % {{{
+ 			disp(sprintf('   Masstransport solution parameters:'));
+ 			fielddisplay(obj,'spcthickness','thickness constraints (NaN means no constraint) [m]');
++			fielddisplay(obj,'calvingrate','calving rate at given location [m/a]');
+ 			fielddisplay(obj,'isfreesurface','do we use free surfaces (FS only) are mass conservation');
+ 			fielddisplay(obj,'min_thickness','minimum ice thickness allowed [m]');
+ 			fielddisplay(obj,'hydrostatic_adjustment','adjustment of ice shelves surface and bed elevations: ''Incremental'' or ''Absolute'' ');
+@@ -109,7 +115,11 @@
+ 
+ 		end % }}}
+ 		function marshall(obj,md,fid) % {{{
++
++			yts=365.*24.*3600.;
++
+ 			WriteData(fid,'object',obj,'fieldname','spcthickness','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
++			WriteData(fid,'object',obj,'fieldname','calvingrate','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1,'scale',1./yts);
+ 			WriteData(fid,'object',obj,'fieldname','isfreesurface','format','Boolean');
+ 			WriteData(fid,'object',obj,'fieldname','min_thickness','format','Double');
+ 			WriteData(fid,'data',StringToEnum(obj.hydrostatic_adjustment),'format','Integer','enum',MasstransportHydrostaticAdjustmentEnum());
+Index: ../trunk-jpl/src/m/enum/MasstransportCalvingrateEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/MasstransportCalvingrateEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/MasstransportCalvingrateEnum.m	(revision 17364)
+@@ -0,0 +1,11 @@
++function macro=MasstransportCalvingrateEnum()
++%MASSTRANSPORTCALVINGRATEENUM - Enum of MasstransportCalvingrate
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=MasstransportCalvingrateEnum()
++
++macro=StringToEnum('MasstransportCalvingrate');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17363)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17364)
+@@ -216,6 +216,7 @@
+ def MasstransportMinThicknessEnum(): return StringToEnum("MasstransportMinThickness")[0]
+ def MasstransportPenaltyFactorEnum(): return StringToEnum("MasstransportPenaltyFactor")[0]
+ def MasstransportSpcthicknessEnum(): return StringToEnum("MasstransportSpcthickness")[0]
++def MasstransportCalvingrateEnum(): return StringToEnum("MasstransportCalvingrate")[0]
+ def MasstransportStabilizationEnum(): return StringToEnum("MasstransportStabilization")[0]
+ def MasstransportVertexPairingEnum(): return StringToEnum("MasstransportVertexPairing")[0]
+ def MasstransportNumRequestedOutputsEnum(): return StringToEnum("MasstransportNumRequestedOutputs")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17364-17365.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17364-17365.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17364-17365.diff	(revision 17802)
@@ -0,0 +1,202 @@
+Index: ../trunk-jpl/src/m/classes/hydrologydc.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/hydrologydc.py	(revision 0)
++++ ../trunk-jpl/src/m/classes/hydrologydc.py	(revision 17365)
+@@ -0,0 +1,175 @@
++from fielddisplay import fielddisplay
++from EnumDefinitions import *
++from checkfield import *
++from WriteData import *
++
++class hydrologydc(object):
++    """
++    Hydrologydc class definition
++    
++    Usage:
++    hydrologydc=hydrologydc();
++    """
++
++    def __init__(self): # {{{
++		self.water_compressibility    = 0
++		self.isefficientlayer         = 0
++		self.penalty_factor           = 0
++		self.penalty_lock             = 0
++		self.rel_tol                  = 0
++		self.max_iter                 = 0
++		self.sedimentlimit_flag       = 0
++		self.sedimentlimit            = 0
++		self.transfer_flag            = 0
++		self.leakage_factor           = 0
++
++		self.spcsediment_head         = float('NaN')
++		self.sediment_transmitivity   = float('NaN')
++		self.sediment_compressibility = 0
++		self.sediment_porosity        = 0
++		self.sediment_thickness       = 0
++
++
++		self.spcepl_head              = float('NaN')
++		self.mask_eplactive_node      = float('NaN')
++		self.epl_compressibility      = 0
++		self.epl_porosity             = 0
++		self.epl_initial_thickness    = 0
++		self.epl_conductivity         = 0
++                
++		#set defaults
++		self.setdefaultparameters()
++                #}}}
++                
++	def __repr__(self): # {{{
++            string='   hydrology Dual Porous Continuum Equivalent parameters:'
++            string='   - general parameters'
++            string="%s\n%s"%(string,fielddisplay(self,'water_compressibility','compressibility of water [Pa^-1]'))
++            string="%s\n%s"%(string,fielddisplay(self,'isefficientlayer','do we use an efficient drainage system [1: true 0: false]'))
++            string="%s\n%s"%(string,fielddisplay(self,'penalty_factor','exponent of the value used in the penalisation method [dimensionless]'))
++            string="%s\n%s"%(string,fielddisplay(self,'penalty_lock','stabilize unstable constraints that keep zigzagging after n iteration (default is 0, no stabilization)'))
++            string="%s\n%s"%(string,fielddisplay(self,'rel_tol','tolerance of the nonlinear iteration for the transfer between layers [dimensionless]'))
++            string="%s\n%s"%(string,fielddisplay(self,'max_iter','maximum number of nonlinear iteration'))
++            string="%s\n%s"%(string,fielddisplay(self,'sedimentlimit_flag','what kind of upper limit is applied for the inefficient layer'))
++            string='%55s  0: no limit',' '
++            string='%55s  1: user defined: %s',' ','sedimentlimit'
++            string='%55s  2: hydrostatic pressure',' '
++            string='%55s  3: normal stress',' '
++
++            if self.sedimentlimit_flag==1:
++                string="%s\n%s"%(string,fielddisplay(self,'sedimentlimit','user defined upper limit for the inefficient layer [m]'))
++                string="%s\n%s"%(string,fielddisplay(self,'transfer_flag',['what kind of transfer method is applied between the layers']))
++                string='%55s  0: no transfer',' '
++                string='%55s  1: constant leakage factor: %s',' ','leakage_factor'
++                
++            if self.transfer_flag is 1:
++                string="%s\n%s"%(string,fielddisplay(self,'leakage_factor','user defined leakage factor [m]'))
++                string='   - for the sediment layer'
++                string="%s\n%s"%(string,fielddisplay(self,'spcsediment_head','sediment water head constraints (NaN means no constraint) [m above MSL]'))
++                string="%s\n%s"%(string,fielddisplay(self,'sediment_compressibility','sediment compressibility [Pa^-1]'))
++                string="%s\n%s"%(string,fielddisplay(self,'sediment_porosity','sediment [dimensionless]'))
++                string="%s\n%s"%(string,fielddisplay(self,'sediment_thickness','sediment thickness [m]'))
++                string="%s\n%s"%(string,fielddisplay(self,'sediment_transmitivity','sediment transmitivity [m^2/s]'))
++            
++            if self.isefficientlayer==1:
++                string='   - for the epl layer'
++                string="%s\n%s"%(string,fielddisplay(self,'spcepl_head','epl water head constraints (NaN means no constraint) [m above MSL]'))
++                string="%s\n%s"%(string,fielddisplay(self,'mask_eplactive_node','active (1) or not (0) EPL'))
++                string="%s\n%s"%(string,fielddisplay(self,'epl_compressibility','epl compressibility [Pa^-1]'))
++                string="%s\n%s"%(string,fielddisplay(self,'epl_porosity','epl [dimensionless]'))
++                string="%s\n%s"%(string,fielddisplay(self,'epl_initial_thickness','epl initial thickness [m]'))
++                string="%s\n%s"%(string,fielddisplay(self,'epl_conductivity','epl conductivity [m^2/s]'))
++            
++            #}}}
++    def setdefaultparameters(self): #{{{ 
++        
++        #Parameters from de Fleurian 2014
++        self.water_compressibility    = 5.04e-10
++        self.isefficientlayer         = 1
++        self.penalty_factor           = 3
++        self.rel_tol                  = 1.0e-06
++        self.max_iter                 = 100
++        self.sedimentlimit_flag       = 0
++        self.sedimentlimit            = 0
++        self.transfer_flag            = 0
++        self.leakage_factor           = 10.0
++        
++        self.sediment_compressibility = 1.0e-08
++        self.sediment_porosity        = 0.4
++        self.sediment_thickness       = 20.0
++        self.sediment_transmitivity   = 8.0e-04
++        
++        self.epl_compressibility      = 1.0e-08
++        self.epl_porosity             = 0.4
++        self.epl_initial_thickness    = 1.0
++        self.epl_conductivity         = 8.0e-02
++        
++        return self
++    # }}}
++    
++    def checkconsistency(self,md,solution,analyses): #{{{ 
++        
++        #Early return
++        if HydrologyDCInefficientAnalysisEnum() not in analyses:
++            return md
++
++        md = checkfield(md,'fieldname','hydrology.water_compressibility','>',0,'numel',1)
++        md = checkfield(md,'fieldname','hydrology.isefficientlayer','numel',[1],'values',[0 1])
++        md = checkfield(md,'fieldname','hydrology.penalty_factor','>',0,'numel',1)
++        md = checkfield(md,'fieldname','hydrology.rel_tol','>',0,'numel',1)
++        md = checkfield(md,'fieldname','hydrology.max_iter','>',0,'numel',1)
++        md = checkfield(md,'fieldname','hydrology.sedimentlimit_flag','numel',[1],'values',[0 1 2 3])
++        md = checkfield(md,'fieldname','hydrology.transfer_flag','numel',[1],'values',[0 1])
++        
++        if self.sedimentlimit_flag==1:
++            md = checkfield(md,'fieldname','hydrology.sedimentlimit','>',0,'numel',1)
++    
++        if self.transfer_flag==1:
++            md = checkfield(md,'fieldname','hydrology.leakage_factor','>',0,'numel',1)
++            
++        md = checkfield(md,'fieldname','hydrology.spcsediment_head','forcing',1)
++        md = checkfield(md,'fieldname','hydrology.sediment_compressibility','>',0,'numel',1)
++        md = checkfield(md,'fieldname','hydrology.sediment_porosity','>',0,'numel',1)
++        md = checkfield(md,'fieldname','hydrology.sediment_thickness','>',0,'numel',1)
++        md = checkfield(md,'fieldname','hydrology.sediment_transmitivity','>=',0,'size',[md.mesh.numberofvertices 1])
++        if self.isefficientlayer==1:
++            md = checkfield(md,'fieldname','hydrology.spcepl_head','forcing',1)
++            md = checkfield(md,'fieldname','hydrology.mask_eplactive_node','size',[md.mesh.numberofvertices 1],'values',[0 1])
++            md = checkfield(md,'fieldname','hydrology.epl_compressibility','>',0,'numel',1)
++            md = checkfield(md,'fieldname','hydrology.epl_porosity','>',0,'numel',1)
++            md = checkfield(md,'fieldname','hydrology.epl_initial_thickness','>',0,'numel',1)
++            md = checkfield(md,'fieldname','hydrology.epl_conductivity','>',0,'numel',1)
++
++        # }}}
++    def marshall(self,md,fid): #{{{ 
++        WriteData(fid,'enum',HydrologyModelEnum(),'data',HydrologydcEnum(),'format','Integer')
++        WriteData(fid,'object',self,'fieldname','water_compressibility','format','Double')
++        WriteData(fid,'object',self,'fieldname','isefficientlayer','format','Boolean')
++        WriteData(fid,'object',self,'fieldname','penalty_factor','format','Double')
++        WriteData(fid,'object',self,'fieldname','penalty_lock','format','Integer')
++        WriteData(fid,'object',self,'fieldname','rel_tol','format','Double')
++        WriteData(fid,'object',self,'fieldname','max_iter','format','Integer')
++        WriteData(fid,'object',self,'fieldname','sedimentlimit_flag','format','Integer')
++        WriteData(fid,'object',self,'fieldname','transfer_flag','format','Integer')
++
++        if self.sedimentlimit_flag==1:
++            WriteData(fid,'object',self,'fieldname','sedimentlimit','format','Double')
++
++        if self.transfer_flag==1:
++            WriteData(fid,'object',self,'fieldname','leakage_factor','format','Double')
++
++        WriteData(fid,'object',self,'fieldname','spcsediment_head','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1)
++        WriteData(fid,'object',self,'fieldname','sediment_compressibility','format','Double')
++        WriteData(fid,'object',self,'fieldname','sediment_porosity','format','Double')			
++        WriteData(fid,'object',self,'fieldname','sediment_thickness','format','Double')
++        WriteData(fid,'object',self,'fieldname','sediment_transmitivity','format','DoubleMat','mattype',1)		
++
++        if self.isefficientlayer==1:	
++            WriteData(fid,'object',self,'fieldname','spcepl_head','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1)	
++            WriteData(fid,'object',self,'fieldname','mask_eplactive_node','format','DoubleMat','mattype',1)
++            WriteData(fid,'object',self,'fieldname','epl_compressibility','format','Double')			
++            WriteData(fid,'object',self,'fieldname','epl_porosity','format','Double')			
++            WriteData(fid,'object',self,'fieldname','epl_initial_thickness','format','Double')
++            WriteData(fid,'object',self,'fieldname','epl_conductivity','format','Double')
++# }}}
++
+Index: ../trunk-jpl/src/m/classes/hydrologyshreve.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/hydrologyshreve.py	(revision 17364)
++++ ../trunk-jpl/src/m/classes/hydrologyshreve.py	(revision 17365)
+@@ -3,7 +3,7 @@
+ from checkfield import *
+ from WriteData import *
+ 
+-class hydrologyshreve(object):
++class hydrologyshreve(oobject):
+ 	"""
+ 	HYDROLOGYSHREVE class definition
+ 
+@@ -51,7 +51,7 @@
+ 		return self
+ 	#}}}
+ 	def checkconsistency(self,md,solution,analyses):    # {{{
+-
++		
+ 		#Early return
+ 		if HydrologyShreveAnalysisEnum() not in analyses:
+ 			return md
Index: issm/oecreview/Archive/16554-17801/ISSM-17365-17366.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17365-17366.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17365-17366.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/classes/hydrologyshreve.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/hydrologyshreve.py	(revision 17365)
++++ ../trunk-jpl/src/m/classes/hydrologyshreve.py	(revision 17366)
+@@ -3,7 +3,7 @@
+ from checkfield import *
+ from WriteData import *
+ 
+-class hydrologyshreve(oobject):
++class hydrologyshreve(object):
+ 	"""
+ 	HYDROLOGYSHREVE class definition
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17366-17367.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17366-17367.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17366-17367.diff	(revision 17802)
@@ -0,0 +1,413 @@
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17366)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17367)
+@@ -30,6 +30,7 @@
+ 		parameters->AddObject(iomodel->CopyConstantObject(DamageC4Enum));
+ 		parameters->AddObject(iomodel->CopyConstantObject(DamageStressThresholdEnum));
+ 		parameters->AddObject(iomodel->CopyConstantObject(DamageHealingEnum));
++		parameters->AddObject(iomodel->CopyConstantObject(DamageEquivStressEnum));
+ 	}
+ 	xDelete<char>(law);
+ 
+@@ -394,8 +395,9 @@
+ 	/*Intermediaries */
+ 	IssmDouble c1,c2,c3,healing,stress_threshold;
+ 	IssmDouble s_xx,s_xy,s_yy;
+-	IssmDouble J2s,Xis,Psi,PosPsi,NegPsi;
++	IssmDouble J2s,Chi,Psi,PosPsi,NegPsi;
+ 	IssmDouble damage,sigma_xx,sigma_xy,sigma_yy;
++	int equivstress;
+ 
+ 	/*Fetch number of vertices and allocate output*/
+ 	int numvertices = element->GetNumberOfVertices();
+@@ -417,7 +419,10 @@
+ 	Input* sigma_yy_input  = element->GetInput(StressTensoryyEnum);     _assert_(sigma_yy_input);
+ 	Input* damage_input    = element->GetInput(DamageDbarEnum); _assert_(damage_input);
+ 
+-	/*Damage evolution z mapping: */
++	/*retrieve the desired type of equivalent stress*/
++	element->FindParam(&equivstress,DamageEquivStressEnum);
++
++	/*Calculate damage evolution source term: */
+ 	Gauss* gauss=element->NewGauss();
+ 	for (int iv=0;iv<numvertices;iv++){
+ 		gauss->GaussVertex(iv);
+@@ -431,9 +436,11 @@
+ 		s_xy=sigma_xy/(1.-damage);
+ 		s_yy=sigma_yy/(1.-damage);
+ 
+-		J2s=1./sqrt(2.)*sqrt(s_xx*s_xx + s_yy*s_yy + s_xy*s_xy);
+-		Xis=sqrt(3.0)*J2s;
+-		Psi=Xis-stress_threshold;
++		if(equivstress==1){ /* von Mises */
++			J2s=1./sqrt(2.)*sqrt(s_xx*s_xx + s_yy*s_yy + s_xy*s_xy);
++			Chi=sqrt(3.0)*J2s;
++		}
++		Psi=Chi-stress_threshold;
+ 		PosPsi=max(Psi,0.);
+ 		NegPsi=max(-Psi,0.);
+ 
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17366)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17367)
+@@ -178,6 +178,7 @@
+ 	DamageMaxiterEnum,
+ 	DamageSpcdamageEnum,
+ 	DamageMaxDamageEnum,
++	DamageEquivStressEnum,
+ 	MaterialsRhoIceEnum,
+ 	MaterialsRhoWaterEnum,
+ 	MaterialsRhoFreshwaterEnum,
+@@ -670,7 +671,7 @@
+ 	OptionCellEnum,
+ 	OptionStructEnum,
+ 	/*}}}*/
+-	/*Rheology law (move too Material) {{{*/
++	/*Rheology law (move to Material) {{{*/
+ 	PatersonEnum,
+ 	ArrheniusEnum,
+ 	LliboutryDuvalEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17366)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17367)
+@@ -186,6 +186,7 @@
+ 		case DamageMaxiterEnum : return "DamageMaxiter";
+ 		case DamageSpcdamageEnum : return "DamageSpcdamage";
+ 		case DamageMaxDamageEnum : return "DamageMaxDamage";
++		case DamageEquivStressEnum : return "DamageEquivStress";
+ 		case MaterialsRhoIceEnum : return "MaterialsRhoIce";
+ 		case MaterialsRhoWaterEnum : return "MaterialsRhoWater";
+ 		case MaterialsRhoFreshwaterEnum : return "MaterialsRhoFreshwater";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17366)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17367)
+@@ -189,6 +189,7 @@
+ 	      else if (strcmp(name,"DamageMaxiter")==0) return DamageMaxiterEnum;
+ 	      else if (strcmp(name,"DamageSpcdamage")==0) return DamageSpcdamageEnum;
+ 	      else if (strcmp(name,"DamageMaxDamage")==0) return DamageMaxDamageEnum;
++	      else if (strcmp(name,"DamageEquivStress")==0) return DamageEquivStressEnum;
+ 	      else if (strcmp(name,"MaterialsRhoIce")==0) return MaterialsRhoIceEnum;
+ 	      else if (strcmp(name,"MaterialsRhoWater")==0) return MaterialsRhoWaterEnum;
+ 	      else if (strcmp(name,"MaterialsRhoFreshwater")==0) return MaterialsRhoFreshwaterEnum;
+@@ -258,11 +259,11 @@
+ 	      else if (strcmp(name,"SteadystateNumRequestedOutputs")==0) return SteadystateNumRequestedOutputsEnum;
+ 	      else if (strcmp(name,"SteadystateReltol")==0) return SteadystateReltolEnum;
+ 	      else if (strcmp(name,"SteadystateRequestedOutputs")==0) return SteadystateRequestedOutputsEnum;
+-	      else if (strcmp(name,"Surface")==0) return SurfaceEnum;
+          else stage=3;
+    }
+    if(stage==3){
+-	      if (strcmp(name,"ThermalIsenthalpy")==0) return ThermalIsenthalpyEnum;
++	      if (strcmp(name,"Surface")==0) return SurfaceEnum;
++	      else if (strcmp(name,"ThermalIsenthalpy")==0) return ThermalIsenthalpyEnum;
+ 	      else if (strcmp(name,"ThermalIsdynamicbasalspc")==0) return ThermalIsdynamicbasalspcEnum;
+ 	      else if (strcmp(name,"ThermalMaxiter")==0) return ThermalMaxiterEnum;
+ 	      else if (strcmp(name,"ThermalPenaltyFactor")==0) return ThermalPenaltyFactorEnum;
+@@ -381,11 +382,11 @@
+ 	      else if (strcmp(name,"Parameters")==0) return ParametersEnum;
+ 	      else if (strcmp(name,"Vertices")==0) return VerticesEnum;
+ 	      else if (strcmp(name,"Results")==0) return ResultsEnum;
+-	      else if (strcmp(name,"GenericParam")==0) return GenericParamEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"AdolcParam")==0) return AdolcParamEnum;
++	      if (strcmp(name,"GenericParam")==0) return GenericParamEnum;
++	      else if (strcmp(name,"AdolcParam")==0) return AdolcParamEnum;
+ 	      else if (strcmp(name,"BoolInput")==0) return BoolInputEnum;
+ 	      else if (strcmp(name,"BoolParam")==0) return BoolParamEnum;
+ 	      else if (strcmp(name,"Contour")==0) return ContourEnum;
+@@ -504,11 +505,11 @@
+ 	      else if (strcmp(name,"VxMesh")==0) return VxMeshEnum;
+ 	      else if (strcmp(name,"VyMesh")==0) return VyMeshEnum;
+ 	      else if (strcmp(name,"VzMesh")==0) return VzMeshEnum;
+-	      else if (strcmp(name,"Enthalpy")==0) return EnthalpyEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"EnthalpyPicard")==0) return EnthalpyPicardEnum;
++	      if (strcmp(name,"Enthalpy")==0) return EnthalpyEnum;
++	      else if (strcmp(name,"EnthalpyPicard")==0) return EnthalpyPicardEnum;
+ 	      else if (strcmp(name,"ThicknessAbsGradient")==0) return ThicknessAbsGradientEnum;
+ 	      else if (strcmp(name,"ThicknessAlongGradient")==0) return ThicknessAlongGradientEnum;
+ 	      else if (strcmp(name,"ThicknessAcrossGradient")==0) return ThicknessAcrossGradientEnum;
+@@ -627,11 +628,11 @@
+ 	      else if (strcmp(name,"Scaled")==0) return ScaledEnum;
+ 	      else if (strcmp(name,"Separate")==0) return SeparateEnum;
+ 	      else if (strcmp(name,"Sset")==0) return SsetEnum;
+-	      else if (strcmp(name,"Verbose")==0) return VerboseEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"TriangleInterp")==0) return TriangleInterpEnum;
++	      if (strcmp(name,"Verbose")==0) return VerboseEnum;
++	      else if (strcmp(name,"TriangleInterp")==0) return TriangleInterpEnum;
+ 	      else if (strcmp(name,"BilinearInterp")==0) return BilinearInterpEnum;
+ 	      else if (strcmp(name,"NearestInterp")==0) return NearestInterpEnum;
+ 	      else if (strcmp(name,"XY")==0) return XYEnum;
+Index: ../trunk-jpl/src/m/mech/thomasparams.m
+===================================================================
+--- ../trunk-jpl/src/m/mech/thomasparams.m	(revision 17366)
++++ ../trunk-jpl/src/m/mech/thomasparams.m	(revision 17367)
+@@ -1,4 +1,4 @@
+-function [alpha,beta,theta,ex]=thomasparams(md,varargin)
++function [alpha,beta,theta,ex,sigxx]=thomasparams(md,varargin)
+ %THOMASPARAMS - compute Thomas' geometric parameters for an ice shelf 
+ %
+ %	 This routine computes geometric parameters representing ratios between
+@@ -34,12 +34,13 @@
+ %		'theta' which is a combination of alpha and beta arising from the form of
+ %		the equivalent stress
+ %
+-%		'exx' is the longitudinal strain rate along a coordinate system defined
+-%		by 'coordsys' 
++%		'exx' is the strain rate along a coordinate system defined by 'coordsys' 
+ %
+-%   Usage: [alpha,beta,theta,exx]=ThomasParams(md,options)
++%		'sigxx' is the deviatoric stress along a coordinate system defined by 'coordsys' 
+ %
+-%   Example: [alpha,beta,theta,exx]=ThomasParams(md,'eq','Thomas','smoothing',2,'coordsys','longitudinal')
++%   Usage: [alpha,beta,theta,exx,sigxx]=ThomasParams(md,options)
++%
++%   Example: [alpha,beta,theta,exx,sigxx]=ThomasParams(md,'eq','Thomas','smoothing',2,'coordsys','longitudinal')
+ 
+ %some checks
+ if (nargin<4)
+@@ -81,6 +82,10 @@
+ 	e2(pos)=1e-13;
+ end
+ 
++% rheology
++n=averaging(md,md.materials.rheology_n,0);
++B=md.materials.rheology_B;
++
+ switch coordsys
+ 	case 'principal'
+ 		b=zeros(md.mesh.numberofvertices,1);
+@@ -97,6 +102,7 @@
+ 		ex(pos3)=e2(pos3);
+ 		id=find(e1<0 & e2<0);
+ 		a(id)=-a(id); % where both strain rates are compressive, enforce negative alpha
++		sigxx=(abs(ex)./((1+a+a.^2).^((n-1)/2))).^(1./n).*B;
+ 		%mask=ismember(1:md.mesh.numberofvertices,id);
+ 		%plotmodel(md,'data',ex,'mask',mask)
+ 	case 'xy'
+@@ -113,9 +119,10 @@
+ 		exy=-0.5*(exx-eyy).*sin(2*velangle)+exy.*cos(2*velangle);
+ 		a=ey./ex;
+ 		b=exy./ex;
+-		pos=find(ex<0 & ey<0);
+-		%length(pos)
+-		a(pos)=-a(pos);
++		%pos=find(ex<0 & ey<0);
++		%a(pos)=-a(pos);
++		%sigxx=(abs(ex)./((1+a+a.^2+b.^2).^((n-1)/2))).^(1./n).*B;
++		sigxx=abs(ex).^(1./n-1).*ex./((1+a+a.^2+b.^2).^((n-1)./(2*n))).*B;
+ 	otherwise
+ 		error('argument passed to "coordsys" not valid');
+ end
+@@ -128,9 +135,6 @@
+ end
+ a(pos)=-2+1e-3;
+ 
+-% rheology
+-n=averaging(md,md.materials.rheology_n,0);
+-
+ switch eq
+ 	case 'Weertman1D'
+ 		theta=1./8;
+Index: ../trunk-jpl/src/m/mech/mechanicalproperties.m
+===================================================================
+--- ../trunk-jpl/src/m/mech/mechanicalproperties.m	(revision 17366)
++++ ../trunk-jpl/src/m/mech/mechanicalproperties.m	(revision 17367)
+@@ -14,7 +14,7 @@
+ 
+ %some checks
+ if length(vx)~=md.mesh.numberofvertices | length(vy)~=md.mesh.numberofvertices,
+-	error(['the input velocity should be of size ' num2str(md.mesh.numberofvertices) '!'])
++	%error(['the input velocity should be of size ' num2str(md.mesh.numberofvertices) '!'])
+ end
+ if ~(md.mesh.dimension==2)
+ 	error('only 2d model supported yet');
+@@ -138,3 +138,7 @@
+ deviatoricstress.principalaxis2=directionsstress(:,3:4);
+ deviatoricstress.effectivevalue=1/sqrt(2)*sqrt(stress.xx.^2+stress.yy.^2+2*stress.xy.^2);
+ md.results.deviatoricstress=deviatoricstress;
++
++viscosity=struct('nu',[]);
++viscosity.nu=nu;
++md.results.viscosity=viscosity;
+Index: ../trunk-jpl/src/m/mech/steadystateiceshelftemp.m
+===================================================================
+--- ../trunk-jpl/src/m/mech/steadystateiceshelftemp.m	(revision 17366)
++++ ../trunk-jpl/src/m/mech/steadystateiceshelftemp.m	(revision 17367)
+@@ -45,8 +45,8 @@
+ pos=find(abs(wi)>=1e-4); % to avoid division by zero
+ 
+ %calculate depth-averaged temperature (in Celsius)
+-%temperature(pos)=-( (Tb(pos)-Ts(pos))*ki./wi(pos) + Hi(pos).*Tb(pos) - (Hi(pos).*Ts(pos) + (Tb(pos)-Ts(pos))*ki./wi(pos)).*exp(Hi(pos).*wi(pos)/ki) )./( Hi(pos).*(exp(Hi(pos).*wi(pos)/ki)-1));
+-temperature(pos)=-( ((Tb(pos)-Ts(pos))*ki./wi(pos) + Hi(pos).*Tb(pos))./exp(Hi(pos).*wi(pos)/ki) - Hi(pos).*Ts(pos) + (Tb(pos)-Ts(pos))*ki./wi(pos))./( Hi(pos).*(1-exp(-Hi(pos).*wi(pos)/ki)));
++temperature(pos)=-( (Tb(pos)-Ts(pos))*ki./wi(pos) + Hi(pos).*Tb(pos) - (Hi(pos).*Ts(pos) + (Tb(pos)-Ts(pos))*ki./wi(pos)).*exp(Hi(pos).*wi(pos)/ki) )./( Hi(pos).*(exp(Hi(pos).*wi(pos)/ki)-1));
++%temperature(pos)=-( ((Tb(pos)-Ts(pos))*ki./wi(pos) + Hi(pos).*Tb(pos))./exp(Hi(pos).*wi(pos)/ki) - Hi(pos).*Ts(pos) + (Tb(pos)-Ts(pos))*ki./wi(pos))./( Hi(pos).*(1-exp(-Hi(pos).*wi(pos)/ki)));
+ 
+ %temperature should not be less than surface temp
+ pos=find(temperature<Ts);
+Index: ../trunk-jpl/src/m/plot/colormaps/getcolormap.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/colormaps/getcolormap.m	(revision 17366)
++++ ../trunk-jpl/src/m/plot/colormaps/getcolormap.m	(revision 17367)
+@@ -40,7 +40,7 @@
+ 	map = hsv2rgb(map);
+ elseif strcmpi(map,'Rignot'),
+ 	alpha=getfieldvalue(options,'alpha',1);
+-	map = hsv;
++	map = hsv(128);
+ 	map = rgb2hsv(map);
+ 	map(:,2) = max(min( (0.1+map(:,1)).^(1/alpha) ,1),0);
+ 	map = hsv2rgb(map);
+Index: ../trunk-jpl/src/m/classes/damage.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/damage.py	(revision 17366)
++++ ../trunk-jpl/src/m/classes/damage.py	(revision 17367)
+@@ -34,6 +34,7 @@
+ 		self.c3                 = float('NaN')
+ 		self.c4                 = float('NaN')
+ 		self.healing				= float('NaN')
++		self.equiv_stress       = float('NaN')
+ 
+ 		if not len(args):
+ 			self.setdefaultparameters()
+@@ -61,6 +62,7 @@
+ 			s+="%s\n" % fielddisplay(self,"c3","damage parameter 3 ")
+ 			s+="%s\n" % fielddisplay(self,"c4","damage parameter 4 ")
+ 			s+="%s\n" % fielddisplay(self,"stress_threshold","damage stress threshold [Pa]")
++			s+="%s\n" % fielddisplay(self,"equiv_stresss","0: von Mises")
+ 
+ 		return s
+ 	# }}}
+@@ -94,6 +96,7 @@
+ 		self.c3=0
+ 		self.c4=0
+ 		self.healing=0
++		self.equiv_stress=0
+ 
+ 	# }}}
+ 	def checkconsistency(self,md,solution,analyses):    # {{{
+@@ -103,19 +106,20 @@
+ 		md = checkfield(md,'fieldname','damage.law','values',['undamaged','pralong'])
+ 		md = checkfield(md,'fieldname','damage.spcdamage','forcing',1)
+ 			
+-		md = checkfield(md,'fieldname','damage.stabilization','numel',[1],'values',[0,1,2]);
++		md = checkfield(md,'fieldname','damage.stabilization','numel',[1],'values',[0,1,2])
+ 		md = checkfield(md,'fieldname','damage.maxiter','>=0',0);
+ 		md = checkfield(md,'fieldname','damage.penalty_factor','>=0',0);
+ 		md = checkfield(md,'fieldname','damage.penalty_lock','>=0',0);
+ 		md = checkfield(md,'fieldname','damage.penalty_threshold','>=0',0);
+ 
+ 		if self.law == 'pralong':
+-			md = checkfield(md,'fieldname','damage.healing','>=',0);
++			md = checkfield(md,'fieldname','damage.healing','>=',0)
+ 			md = checkfield(md,'fieldname','damage.c1','>=',0)
+ 			md = checkfield(md,'fieldname','damage.c2','>=',0)
+ 			md = checkfield(md,'fieldname','damage.c3','>=',0)
+ 			md = checkfield(md,'fieldname','damage.c4','>=',0)
+ 			md = checkfield(md,'fieldname','damage.stress_threshold','>=',0)
++			md = checkfield(md,'fieldname','damage.equiv_stress','numel',[1],'values',[0])
+ 		elif strcmpi(self.law,'undamaged'):
+ 			if (solution==DamageEvolutionSolutionEnum):
+ 				raise RuntimeError('Invalid evolution law (md.damage.law) for a damage solution');
+@@ -141,4 +145,5 @@
+ 			WriteData(fid,'object',self,'fieldname','c3','format','Double')
+ 			WriteData(fid,'object',self,'fieldname','c4','format','Double')
+ 			WriteData(fid,'object',self,'fieldname','stress_threshold','format','Double')
++			WriteData(fid,'object',self,'fieldname','equiv_stress','format','Integer')
+ 	# }}}
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17366)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17367)
+@@ -1106,7 +1106,7 @@
+ 			disp(sprintf('%19s: %-22s -- %s','surfaceforcings' ,['[1x1 ' class(obj.surfaceforcings) ']'],'surface forcings'));
+ 			disp(sprintf('%19s: %-22s -- %s','basalforcings'   ,['[1x1 ' class(obj.basalforcings) ']'],'bed forcings'));
+ 			disp(sprintf('%19s: %-22s -- %s','materials'       ,['[1x1 ' class(obj.materials) ']'],'material properties'));
+-			disp(sprintf('%19s: %-22s -- %s','damage'          ,['[1x1 ' class(obj.damage) ']'],'damage propagation laws'));
++			disp(sprintf('%19s: %-22s -- %s','damage'          ,['[1x1 ' class(obj.damage) ']'],'parameters for damage evolution solution'));
+ 			disp(sprintf('%19s: %-22s -- %s','friction'        ,['[1x1 ' class(obj.friction) ']'],'basal friction/drag properties'));
+ 			disp(sprintf('%19s: %-22s -- %s','flowequation'    ,['[1x1 ' class(obj.flowequation) ']'],'flow equations'));
+ 			disp(sprintf('%19s: %-22s -- %s','timestepping'    ,['[1x1 ' class(obj.timestepping) ']'],'time stepping for transient models'));
+Index: ../trunk-jpl/src/m/classes/damage.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/damage.m	(revision 17366)
++++ ../trunk-jpl/src/m/classes/damage.m	(revision 17367)
+@@ -25,6 +25,7 @@
+ 		c3                  = NaN;
+ 		c4                  = NaN;
+ 		healing             = NaN;
++		equiv_stress		  = NaN;
+ 	end
+ 	methods
+ 		function obj = damage(varargin) % {{{
+@@ -75,6 +76,7 @@
+ 			obj.c2=0;
+ 			obj.c3=0;
+ 			obj.c4=0;
++			obj.equiv_stress=0;
+ 
+ 		end % }}}
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+@@ -97,6 +99,7 @@
+ 				md = checkfield(md,'fieldname','damage.c3','>=',0);
+ 				md = checkfield(md,'fieldname','damage.c4','>=',0);
+ 				md = checkfield(md,'fieldname','damage.stress_threshold','>=',0);
++				md = checkfield(md,'fieldname','damage.equiv_stress','numel',[1],'values',[0]);
+ 			elseif strcmpi(obj.law,'undamaged'),
+ 				if (solution==DamageEvolutionSolutionEnum),
+ 					error('Invalid evolution law (md.damage.law) for a damage solution');
+@@ -127,6 +130,7 @@
+ 				fielddisplay(obj,'c4','damage parameter 4');
+ 				fielddisplay(obj,'healing','damage healing parameter 1');
+ 				fielddisplay(obj,'stress_threshold','damage stress threshold [Pa]');
++				fielddisplay(obj,'equiv_stress','0: von Mises');
+ 			end
+ 
+ 		end % }}}
+@@ -150,6 +154,7 @@
+ 				WriteData(fid,'object',obj,'fieldname','c4','format','Double');
+ 				WriteData(fid,'object',obj,'fieldname','stress_threshold','format','Double');
+ 				WriteData(fid,'object',obj,'fieldname','healing','format','Double');
++				WriteData(fid,'object',obj,'fieldname','equiv_stress','format','Integer');
+ 			end
+ 
+ 		end % }}}
+Index: ../trunk-jpl/src/m/enum/DamageEquivStressEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/DamageEquivStressEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/DamageEquivStressEnum.m	(revision 17367)
+@@ -0,0 +1,11 @@
++function macro=DamageEquivStressEnum()
++%DAMAGEEQUIVSTRESSENUM - Enum of DamageEquivStress
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=DamageEquivStressEnum()
++
++macro=StringToEnum('DamageEquivStress');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17366)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17367)
+@@ -178,6 +178,7 @@
+ def DamageMaxiterEnum(): return StringToEnum("DamageMaxiter")[0]
+ def DamageSpcdamageEnum(): return StringToEnum("DamageSpcdamage")[0]
+ def DamageMaxDamageEnum(): return StringToEnum("DamageMaxDamage")[0]
++def DamageEquivStressEnum(): return StringToEnum("DamageEquivStress")[0]
+ def MaterialsRhoIceEnum(): return StringToEnum("MaterialsRhoIce")[0]
+ def MaterialsRhoWaterEnum(): return StringToEnum("MaterialsRhoWater")[0]
+ def MaterialsRhoFreshwaterEnum(): return StringToEnum("MaterialsRhoFreshwater")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17367-17368.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17367-17368.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17367-17368.diff	(revision 17802)
@@ -0,0 +1,57 @@
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17367)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17368)
+@@ -97,7 +97,7 @@
+ 	IssmDouble kappa;
+ 	IssmDouble Jdet, dt, D_scalar;
+ 	IssmDouble h,hx,hy,hz;
+-	IssmDouble vel,v[dim];
++	IssmDouble vel,v[dim],w[dim];
+ 	IssmDouble calvingrate, c[dim];
+ 	IssmDouble dlsf[dim], norm_dlsf, normal[dim];
+ 	IssmDouble* xyz_list = NULL;
+@@ -152,14 +152,21 @@
+ 		for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
+ 		norm_dlsf=sqrt(norm_dlsf);
+ 
+-		if(norm_dlsf>1.e-10)
+-			for(i=0;i<dim;i++) c[i]=calvingrate*dlsf[i]/norm_dlsf;
++		if(norm_dlsf>1.e-10){
++			for(i=0;i<dim;i++) normal[i]=dlsf[i]/norm_dlsf;
++			for(i=0;i<dim;i++) c[i]=calvingrate*normal[i];
++		}
+ 		else
+ 			for(i=0;i<dim;i++) c[i]=0.;
++		
++		for(i=0;i<dim;i++) w[i]=v[i]-c[i];
+ 
+ 		for(row=0;row<dim;row++)
+ 			for(col=0;col<dim;col++)
+-				D[row][col]=((row==col)?D_scalar*(v[row]-c[row]):0.);
++				if(row==col)
++					D[row][col]=D_scalar*w[row];
++				else
++				   D[row][col]=0.;
+ 
+ 		TripleMultiply(B,dim,numnodes,1,
+ 					&D[0][0],dim,dim,0,
+@@ -178,12 +185,14 @@
+ 			case 1:
+ 				/* Artificial Diffusion */
+ 				element->ElementSizes(&hx,&hy,&hz);
+-				h=sqrt( pow(hx*v[0]/vel,2) + pow(hy*v[1]/vel,2) ); //FIXME: is this correct?
+-
+-				kappa=h*vel/2.; //FIXME: insert suitable value for kappa
++				h=sqrt( pow(hx*v[0]/vel,2) + pow(hy*v[1]/vel,2) ); 
++				kappa=h*vel/2.;
+ 				for(row=0;row<dim;row++)
+ 					for(col=0;col<dim;col++)
+-						D[row][col]=((row==col)?D_scalar*kappa:0.);
++					if(row==col)
++						D[row][col]=D_scalar*kappa;
++					else
++						D[row][col]=0.;
+ 
+ 				TripleMultiply(Bprime,dim,numnodes,1,
+ 							&D[0][0],dim,dim,0,
Index: issm/oecreview/Archive/16554-17801/ISSM-17368-17369.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17368-17369.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17368-17369.diff	(revision 17802)
@@ -0,0 +1,411 @@
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17368)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17369)
+@@ -10,16 +10,25 @@
+ }/*}}}*/
+ void DamageEvolutionAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+ 
++	/*Intermediaries*/
++	int         numoutputs;
++	char**      requestedoutputs = NULL;
++
+ 	/*retrieve some parameters: */
+ 	parameters->AddObject(iomodel->CopyConstantObject(DamageLawEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(DamageStabilizationEnum));
+-
+ 	parameters->AddObject(iomodel->CopyConstantObject(DamagePenaltyThresholdEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(DamagePenaltyLockEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(DamagePenaltyFactorEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(DamageMaxiterEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(DamageMaxDamageEnum));
+ 
++	/*Requested outputs*/
++	iomodel->FetchData(&requestedoutputs,&numoutputs,DamageEvolutionRequestedOutputsEnum);
++	parameters->AddObject(new IntParam(DamageEvolutionNumRequestedOutputsEnum,numoutputs));
++	if(numoutputs)parameters->AddObject(new StringArrayParam(DamageEvolutionRequestedOutputsEnum,requestedoutputs,numoutputs));
++	iomodel->DeleteData(&requestedoutputs,numoutputs,DamageEvolutionRequestedOutputsEnum);
++
+ 	/*Retrieve law dependent parameters: */
+ 	char* law  = NULL;
+ 	iomodel->Constant(&law,DamageLawEnum);
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17368)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17369)
+@@ -179,6 +179,8 @@
+ 	DamageSpcdamageEnum,
+ 	DamageMaxDamageEnum,
+ 	DamageEquivStressEnum,
++	DamageEvolutionNumRequestedOutputsEnum,
++	DamageEvolutionRequestedOutputsEnum,
+ 	MaterialsRhoIceEnum,
+ 	MaterialsRhoWaterEnum,
+ 	MaterialsRhoFreshwaterEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17368)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17369)
+@@ -187,6 +187,8 @@
+ 		case DamageSpcdamageEnum : return "DamageSpcdamage";
+ 		case DamageMaxDamageEnum : return "DamageMaxDamage";
+ 		case DamageEquivStressEnum : return "DamageEquivStress";
++		case DamageEvolutionNumRequestedOutputsEnum : return "DamageEvolutionNumRequestedOutputs";
++		case DamageEvolutionRequestedOutputsEnum : return "DamageEvolutionRequestedOutputs";
+ 		case MaterialsRhoIceEnum : return "MaterialsRhoIce";
+ 		case MaterialsRhoWaterEnum : return "MaterialsRhoWater";
+ 		case MaterialsRhoFreshwaterEnum : return "MaterialsRhoFreshwater";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17368)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17369)
+@@ -190,6 +190,8 @@
+ 	      else if (strcmp(name,"DamageSpcdamage")==0) return DamageSpcdamageEnum;
+ 	      else if (strcmp(name,"DamageMaxDamage")==0) return DamageMaxDamageEnum;
+ 	      else if (strcmp(name,"DamageEquivStress")==0) return DamageEquivStressEnum;
++	      else if (strcmp(name,"DamageEvolutionNumRequestedOutputs")==0) return DamageEvolutionNumRequestedOutputsEnum;
++	      else if (strcmp(name,"DamageEvolutionRequestedOutputs")==0) return DamageEvolutionRequestedOutputsEnum;
+ 	      else if (strcmp(name,"MaterialsRhoIce")==0) return MaterialsRhoIceEnum;
+ 	      else if (strcmp(name,"MaterialsRhoWater")==0) return MaterialsRhoWaterEnum;
+ 	      else if (strcmp(name,"MaterialsRhoFreshwater")==0) return MaterialsRhoFreshwaterEnum;
+@@ -257,12 +259,12 @@
+ 	      else if (strcmp(name,"MaxIterationConvergenceFlag")==0) return MaxIterationConvergenceFlagEnum;
+ 	      else if (strcmp(name,"SteadystateMaxiter")==0) return SteadystateMaxiterEnum;
+ 	      else if (strcmp(name,"SteadystateNumRequestedOutputs")==0) return SteadystateNumRequestedOutputsEnum;
+-	      else if (strcmp(name,"SteadystateReltol")==0) return SteadystateReltolEnum;
+-	      else if (strcmp(name,"SteadystateRequestedOutputs")==0) return SteadystateRequestedOutputsEnum;
+          else stage=3;
+    }
+    if(stage==3){
+-	      if (strcmp(name,"Surface")==0) return SurfaceEnum;
++	      if (strcmp(name,"SteadystateReltol")==0) return SteadystateReltolEnum;
++	      else if (strcmp(name,"SteadystateRequestedOutputs")==0) return SteadystateRequestedOutputsEnum;
++	      else if (strcmp(name,"Surface")==0) return SurfaceEnum;
+ 	      else if (strcmp(name,"ThermalIsenthalpy")==0) return ThermalIsenthalpyEnum;
+ 	      else if (strcmp(name,"ThermalIsdynamicbasalspc")==0) return ThermalIsdynamicbasalspcEnum;
+ 	      else if (strcmp(name,"ThermalMaxiter")==0) return ThermalMaxiterEnum;
+@@ -380,12 +382,12 @@
+ 	      else if (strcmp(name,"Nodes")==0) return NodesEnum;
+ 	      else if (strcmp(name,"Contours")==0) return ContoursEnum;
+ 	      else if (strcmp(name,"Parameters")==0) return ParametersEnum;
+-	      else if (strcmp(name,"Vertices")==0) return VerticesEnum;
+-	      else if (strcmp(name,"Results")==0) return ResultsEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"GenericParam")==0) return GenericParamEnum;
++	      if (strcmp(name,"Vertices")==0) return VerticesEnum;
++	      else if (strcmp(name,"Results")==0) return ResultsEnum;
++	      else if (strcmp(name,"GenericParam")==0) return GenericParamEnum;
+ 	      else if (strcmp(name,"AdolcParam")==0) return AdolcParamEnum;
+ 	      else if (strcmp(name,"BoolInput")==0) return BoolInputEnum;
+ 	      else if (strcmp(name,"BoolParam")==0) return BoolParamEnum;
+@@ -503,12 +505,12 @@
+ 	      else if (strcmp(name,"VzPicard")==0) return VzPicardEnum;
+ 	      else if (strcmp(name,"VzFS")==0) return VzFSEnum;
+ 	      else if (strcmp(name,"VxMesh")==0) return VxMeshEnum;
+-	      else if (strcmp(name,"VyMesh")==0) return VyMeshEnum;
+-	      else if (strcmp(name,"VzMesh")==0) return VzMeshEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"Enthalpy")==0) return EnthalpyEnum;
++	      if (strcmp(name,"VyMesh")==0) return VyMeshEnum;
++	      else if (strcmp(name,"VzMesh")==0) return VzMeshEnum;
++	      else if (strcmp(name,"Enthalpy")==0) return EnthalpyEnum;
+ 	      else if (strcmp(name,"EnthalpyPicard")==0) return EnthalpyPicardEnum;
+ 	      else if (strcmp(name,"ThicknessAbsGradient")==0) return ThicknessAbsGradientEnum;
+ 	      else if (strcmp(name,"ThicknessAlongGradient")==0) return ThicknessAlongGradientEnum;
+@@ -626,12 +628,12 @@
+ 	      else if (strcmp(name,"QmuOutName")==0) return QmuOutNameEnum;
+ 	      else if (strcmp(name,"Regular")==0) return RegularEnum;
+ 	      else if (strcmp(name,"Scaled")==0) return ScaledEnum;
+-	      else if (strcmp(name,"Separate")==0) return SeparateEnum;
+-	      else if (strcmp(name,"Sset")==0) return SsetEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"Verbose")==0) return VerboseEnum;
++	      if (strcmp(name,"Separate")==0) return SeparateEnum;
++	      else if (strcmp(name,"Sset")==0) return SsetEnum;
++	      else if (strcmp(name,"Verbose")==0) return VerboseEnum;
+ 	      else if (strcmp(name,"TriangleInterp")==0) return TriangleInterpEnum;
+ 	      else if (strcmp(name,"BilinearInterp")==0) return BilinearInterpEnum;
+ 	      else if (strcmp(name,"NearestInterp")==0) return NearestInterpEnum;
+Index: ../trunk-jpl/src/c/cores/damage_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/damage_core.cpp	(revision 17368)
++++ ../trunk-jpl/src/c/cores/damage_core.cpp	(revision 17369)
+@@ -13,8 +13,10 @@
+ 
+ 	/*intermediary*/
+ 	bool   save_results;
+-	bool   dakota_analysis  = false;
++	bool   dakota_analysis     = false;
+ 	int    solution_type;
++	int    numoutputs          = 0; 
++	char   **requested_outputs = NULL;
+ 
+ 	if(VerboseSolution()) _printf0_("   computing damage\n");
+ 	
+@@ -22,6 +24,8 @@
+ 	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
+ 	femmodel->parameters->FindParam(&dakota_analysis,QmuIsdakotaEnum);
+ 	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
++	femmodel->parameters->FindParam(&numoutputs,DamageEvolutionNumRequestedOutputsEnum);
++	if(numoutputs) femmodel->parameters->FindParam(&requested_outputs,&numoutputs,DamageEvolutionRequestedOutputsEnum);
+ 
+ 	if(dakota_analysis && solution_type!=TransientSolutionEnum){
+ 		femmodel->SetCurrentConfiguration(DamageEvolutionAnalysisEnum);
+@@ -33,7 +37,14 @@
+ 
+ 	if(save_results){
+ 		if(VerboseSolution()) _printf0_("   saving results\n");
+-		int outputs = DamageDEnum;
+-		femmodel->RequestedOutputsx(&femmodel->results,&outputs,1);
++		femmodel->RequestedOutputsx(&femmodel->results,requested_outputs,numoutputs);
+ 	}
++	
++	/*Free resources:*/	
++	if(numoutputs){
++		for(int i=0;i<numoutputs;i++){
++			xDelete<char>(requested_outputs[i]);
++		} 
++		xDelete<char*>(requested_outputs);
++	}
+ }
+Index: ../trunk-jpl/src/m/classes/damage.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/damage.py	(revision 17368)
++++ ../trunk-jpl/src/m/classes/damage.py	(revision 17369)
+@@ -9,7 +9,7 @@
+ 	DAMAGE class definition
+ 
+ 	   Usage:
+-	      damage=damage();
++	      damage=damage()
+ 	"""
+ 
+ 	def __init__(self,*args):    # {{{
+@@ -35,6 +35,7 @@
+ 		self.c4                 = float('NaN')
+ 		self.healing				= float('NaN')
+ 		self.equiv_stress       = float('NaN')
++		self.requested_outputs  = []
+ 
+ 		if not len(args):
+ 			self.setdefaultparameters()
+@@ -63,6 +64,7 @@
+ 			s+="%s\n" % fielddisplay(self,"c4","damage parameter 4 ")
+ 			s+="%s\n" % fielddisplay(self,"stress_threshold","damage stress threshold [Pa]")
+ 			s+="%s\n" % fielddisplay(self,"equiv_stresss","0: von Mises")
++			s+="%s\n" % fielddisplay(self,'requested_outputs','additional outputs requested')
+ 
+ 		return s
+ 	# }}}
+@@ -98,7 +100,24 @@
+ 		self.healing=0
+ 		self.equiv_stress=0
+ 
++		#output default:
++		self.requested_outputs=['default']
++
++		return self
+ 	# }}}
++	def defaultoutputs(self,md): # {{{
++
++		if strcmp(md.mesh.meshtype(),'3D'):
++			list = ['DamageD']
++		elif strcmp(md.mesh.meshtype(),'2Dhorizontal'):
++			list = ['DamageD']
++		elif strcmp(md.mesh.meshtype(),'2Dvertical'):
++			list = ['DamageD']
++		else:
++			raise TypeError('mesh type not supported yet')
++		return list
++
++	#}}}
+ 	def checkconsistency(self,md,solution,analyses):    # {{{
+ 
+ 		md = checkfield(md,'fieldname','damage.D','>=',0,'<=',self.max_damage,'size',[md.mesh.numberofvertices])
+@@ -107,10 +126,10 @@
+ 		md = checkfield(md,'fieldname','damage.spcdamage','forcing',1)
+ 			
+ 		md = checkfield(md,'fieldname','damage.stabilization','numel',[1],'values',[0,1,2])
+-		md = checkfield(md,'fieldname','damage.maxiter','>=0',0);
+-		md = checkfield(md,'fieldname','damage.penalty_factor','>=0',0);
+-		md = checkfield(md,'fieldname','damage.penalty_lock','>=0',0);
+-		md = checkfield(md,'fieldname','damage.penalty_threshold','>=0',0);
++		md = checkfield(md,'fieldname','damage.maxiter','>=0',0)
++		md = checkfield(md,'fieldname','damage.penalty_factor','>=0',0)
++		md = checkfield(md,'fieldname','damage.penalty_lock','>=0',0)
++		md = checkfield(md,'fieldname','damage.penalty_threshold','>=0',0)
+ 
+ 		if self.law == 'pralong':
+ 			md = checkfield(md,'fieldname','damage.healing','>=',0)
+@@ -120,9 +139,10 @@
+ 			md = checkfield(md,'fieldname','damage.c4','>=',0)
+ 			md = checkfield(md,'fieldname','damage.stress_threshold','>=',0)
+ 			md = checkfield(md,'fieldname','damage.equiv_stress','numel',[1],'values',[0])
++			md = checkfield(md,'fieldname','damage.requested_outputs','stringrow',1)
+ 		elif strcmpi(self.law,'undamaged'):
+ 			if (solution==DamageEvolutionSolutionEnum):
+-				raise RuntimeError('Invalid evolution law (md.damage.law) for a damage solution');
++				raise RuntimeError('Invalid evolution law (md.damage.law) for a damage solution')
+ 
+ 		return md
+ 	# }}}
+@@ -130,14 +150,14 @@
+ 
+ 		WriteData(fid,'object',self,'fieldname','D','format','DoubleMat','mattype',1)
+ 		WriteData(fid,'object',self,'fieldname','law','format','String')
+-		WriteData(fid,'object',self,'fieldname','spcdamage','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
+-		WriteData(fid,'object',self,'fieldname','max_damage','format','Double');
++		WriteData(fid,'object',self,'fieldname','spcdamage','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1)
++		WriteData(fid,'object',self,'fieldname','max_damage','format','Double')
+ 
+-		WriteData(fid,'object',self,'fieldname','stabilization','format','Integer');
+-		WriteData(fid,'object',self,'fieldname','penalty_threshold','format','Integer');
+-		WriteData(fid,'object',self,'fieldname','maxiter','format','Integer');
+-		WriteData(fid,'object',self,'fieldname','penalty_lock','format','Integer');
+-		WriteData(fid,'object',self,'fieldname','penalty_factor','format','Double');
++		WriteData(fid,'object',self,'fieldname','stabilization','format','Integer')
++		WriteData(fid,'object',self,'fieldname','penalty_threshold','format','Integer')
++		WriteData(fid,'object',self,'fieldname','maxiter','format','Integer')
++		WriteData(fid,'object',self,'fieldname','penalty_lock','format','Integer')
++		WriteData(fid,'object',self,'fieldname','penalty_factor','format','Double')
+ 
+ 		if self.law=='pralong':
+ 			WriteData(fid,'object',self,'fieldname','c1','format','Double')
+@@ -146,4 +166,12 @@
+ 			WriteData(fid,'object',self,'fieldname','c4','format','Double')
+ 			WriteData(fid,'object',self,'fieldname','stress_threshold','format','Double')
+ 			WriteData(fid,'object',self,'fieldname','equiv_stress','format','Integer')
++			
++			#process requested outputs
++			outputs = self.requested_outputs
++			indices = [i for i, x in enumerate(outputs) if x == 'default']
++			if len(indices) > 0:
++				outputscopy=outputs[0:max(0,indices[0]-1)]+self.defaultoutputs(md)+outputs[indices[0]+1:]
++				outputs    =outputscopy
++			WriteData(fid,'data',outputs,'enum',StressbalanceRequestedOutputsEnum(),'format','StringArray')
+ 	# }}}
+Index: ../trunk-jpl/src/m/classes/damage.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/damage.m	(revision 17368)
++++ ../trunk-jpl/src/m/classes/damage.m	(revision 17369)
+@@ -26,6 +26,7 @@
+ 		c4                  = NaN;
+ 		healing             = NaN;
+ 		equiv_stress		  = NaN;
++		requested_outputs   = {};
+ 	end
+ 	methods
+ 		function obj = damage(varargin) % {{{
+@@ -78,6 +79,9 @@
+ 			obj.c4=0;
+ 			obj.equiv_stress=0;
+ 
++			 %output default:
++			 obj.requested_outputs={'default'};
++
+ 		end % }}}
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+ 			
+@@ -100,6 +104,7 @@
+ 				md = checkfield(md,'fieldname','damage.c4','>=',0);
+ 				md = checkfield(md,'fieldname','damage.stress_threshold','>=',0);
+ 				md = checkfield(md,'fieldname','damage.equiv_stress','numel',[1],'values',[0]);
++				md = checkfield(md,'fieldname','damage.requested_outputs','stringrow',1);
+ 			elseif strcmpi(obj.law,'undamaged'),
+ 				if (solution==DamageEvolutionSolutionEnum),
+ 					error('Invalid evolution law (md.damage.law) for a damage solution');
+@@ -109,6 +114,19 @@
+ 			end
+ 
+ 		end % }}}
++		function list=defaultoutputs(self,md) % {{{
++
++			if strcmp(meshtype(md.mesh),'3D'),
++				list = {'DamageD',};
++			elseif strcmp(meshtype(md.mesh),'2Dhorizontal'),
++				list = {'DamageD'};
++			elseif strcmp(meshtype(md.mesh),'2Dvertical'),
++				list = {'DamageD'};
++			else
++				error('mesh type not supported yet');
++			end
++
++		end % }}}
+ 		function disp(obj) % {{{
+ 			disp(sprintf('   Damage:\n'));
+ 
+@@ -131,6 +149,7 @@
+ 				fielddisplay(obj,'healing','damage healing parameter 1');
+ 				fielddisplay(obj,'stress_threshold','damage stress threshold [Pa]');
+ 				fielddisplay(obj,'equiv_stress','0: von Mises');
++				fielddisplay(obj,'requested_outputs','additional outputs requested');
+ 			end
+ 
+ 		end % }}}
+@@ -155,6 +174,15 @@
+ 				WriteData(fid,'object',obj,'fieldname','stress_threshold','format','Double');
+ 				WriteData(fid,'object',obj,'fieldname','healing','format','Double');
+ 				WriteData(fid,'object',obj,'fieldname','equiv_stress','format','Integer');
++					
++				%process requested outputs
++				outputs = obj.requested_outputs;
++				pos = find(ismember(outputs,'default'));
++				if ~isempty(pos),
++					outputs(pos) = [];                         %remove 'default' from outputs
++					outputs      = [outputs defaultoutputs(obj,md)]; %add defaults
++				end
++				WriteData(fid,'data',outputs,'enum',DamageEvolutionRequestedOutputsEnum,'format','StringArray');
+ 			end
+ 
+ 		end % }}}
+Index: ../trunk-jpl/src/m/enum/DamageEvolutionRequestedOutputsEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/DamageEvolutionRequestedOutputsEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/DamageEvolutionRequestedOutputsEnum.m	(revision 17369)
+@@ -0,0 +1,11 @@
++function macro=DamageEvolutionRequestedOutputsEnum()
++%DAMAGEEVOLUTIONREQUESTEDOUTPUTSENUM - Enum of DamageEvolutionRequestedOutputs
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=DamageEvolutionRequestedOutputsEnum()
++
++macro=StringToEnum('DamageEvolutionRequestedOutputs');
+Index: ../trunk-jpl/src/m/enum/DamageEvolutionNumRequestedOutputsEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/DamageEvolutionNumRequestedOutputsEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/DamageEvolutionNumRequestedOutputsEnum.m	(revision 17369)
+@@ -0,0 +1,11 @@
++function macro=DamageEvolutionNumRequestedOutputsEnum()
++%DAMAGEEVOLUTIONNUMREQUESTEDOUTPUTSENUM - Enum of DamageEvolutionNumRequestedOutputs
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=DamageEvolutionNumRequestedOutputsEnum()
++
++macro=StringToEnum('DamageEvolutionNumRequestedOutputs');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17368)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17369)
+@@ -179,6 +179,8 @@
+ def DamageSpcdamageEnum(): return StringToEnum("DamageSpcdamage")[0]
+ def DamageMaxDamageEnum(): return StringToEnum("DamageMaxDamage")[0]
+ def DamageEquivStressEnum(): return StringToEnum("DamageEquivStress")[0]
++def DamageEvolutionNumRequestedOutputsEnum(): return StringToEnum("DamageEvolutionNumRequestedOutputs")[0]
++def DamageEvolutionRequestedOutputsEnum(): return StringToEnum("DamageEvolutionRequestedOutputs")[0]
+ def MaterialsRhoIceEnum(): return StringToEnum("MaterialsRhoIce")[0]
+ def MaterialsRhoWaterEnum(): return StringToEnum("MaterialsRhoWater")[0]
+ def MaterialsRhoFreshwaterEnum(): return StringToEnum("MaterialsRhoFreshwater")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17369-17370.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17369-17370.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17369-17370.diff	(revision 17802)
@@ -0,0 +1,98 @@
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17369)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17370)
+@@ -92,13 +92,13 @@
+ ElementMatrix* LevelsetAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries */
+-	const int  dim = 2; // solve for LSF in horizontal plane only
++	int  dim = 2; // solve for LSF in horizontal plane only
+ 	int i, row, col;
+ 	IssmDouble kappa;
+ 	IssmDouble Jdet, dt, D_scalar;
+ 	IssmDouble h,hx,hy,hz;
+-	IssmDouble vel,v[dim],w[dim];
+-	IssmDouble calvingrate, c[dim];
++	IssmDouble vel;
++	IssmDouble calvingrate;
+ 	IssmDouble dlsf[dim], norm_dlsf, normal[dim];
+ 	IssmDouble* xyz_list = NULL;
+ 
+@@ -110,7 +110,10 @@
+ 	IssmDouble*    basis    = xNew<IssmDouble>(numnodes);
+ 	IssmDouble*    B        = xNew<IssmDouble>(dim*numnodes);
+ 	IssmDouble*    Bprime   = xNew<IssmDouble>(dim*numnodes);
+-	IssmDouble     D[dim][dim];
++	IssmDouble*    D        = xNew<IssmDouble>(dim*dim);
++	IssmDouble*    v        = xNew<IssmDouble>(dim);
++	IssmDouble*    w        = xNew<IssmDouble>(dim);
++	IssmDouble*    c        = xNew<IssmDouble>(dim);
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+@@ -164,19 +167,19 @@
+ 		for(row=0;row<dim;row++)
+ 			for(col=0;col<dim;col++)
+ 				if(row==col)
+-					D[row][col]=D_scalar*w[row];
++					D[row*dim+col]=D_scalar*w[row];
+ 				else
+-				   D[row][col]=0.;
++				   D[row*dim+col]=0.;
+ 
+ 		TripleMultiply(B,dim,numnodes,1,
+-					&D[0][0],dim,dim,0,
++					D,dim,dim,0,
+ 					Bprime,dim,numnodes,0,
+ 					&Ke->values[0],1);
+ 
+ 		/* Stabilization */
+ 		int stabilization=2;
+ 		vel=0.;
+-		for(i=0;i<dim;i++) vel+=pow(v[i],2);
++		for(i=0;i<dim;i++) vel+=v[i]*v[i];
+ 		vel=sqrt(vel)+1.e-14;
+ 		switch(stabilization){
+ 			case 0:
+@@ -190,12 +193,12 @@
+ 				for(row=0;row<dim;row++)
+ 					for(col=0;col<dim;col++)
+ 					if(row==col)
+-						D[row][col]=D_scalar*kappa;
++						D[row*dim+col]=D_scalar*kappa;
+ 					else
+-						D[row][col]=0.;
++						D[row*dim+col]=0.;
+ 
+ 				TripleMultiply(Bprime,dim,numnodes,1,
+-							&D[0][0],dim,dim,0,
++							D,dim,dim,0,
+ 							Bprime,dim,numnodes,0,
+ 							&Ke->values[0],1);
+ 				break;	
+@@ -205,10 +208,10 @@
+ 				h=sqrt( pow(hx*v[0]/vel,2) + pow(hy*v[1]/vel,2) );
+ 				for(row=0;row<dim;row++) 
+ 					for(col=0;col<dim;col++) 
+-						D[row][col] = D_scalar*h/(2.*vel)*v[row]*v[col];
++						D[row*dim+col] = D_scalar*h/(2.*vel)*v[row]*v[col];
+ 
+ 				TripleMultiply(Bprime,dim,numnodes,1,
+-							&D[0][0],dim,dim,0,
++							D,dim,dim,0,
+ 							Bprime,dim,numnodes,0,
+ 							&Ke->values[0],1);
+ 				break;
+@@ -221,7 +224,11 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+ 	xDelete<IssmDouble>(B);
++	xDelete<IssmDouble>(D);
+ 	xDelete<IssmDouble>(Bprime);
++	xDelete<IssmDouble>(v);
++	xDelete<IssmDouble>(w);
++	xDelete<IssmDouble>(c);
+ 	delete gauss;
+ 	return Ke;
+ }/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17370-17371.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17370-17371.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17370-17371.diff	(revision 17802)
@@ -0,0 +1,45 @@
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17370)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17371)
+@@ -97,9 +97,8 @@
+ 	IssmDouble kappa;
+ 	IssmDouble Jdet, dt, D_scalar;
+ 	IssmDouble h,hx,hy,hz;
+-	IssmDouble vel;
+-	IssmDouble calvingrate;
+-	IssmDouble dlsf[dim], norm_dlsf, normal[dim];
++	IssmDouble vel, calvingrate;
++	IssmDouble norm_dlsf;
+ 	IssmDouble* xyz_list = NULL;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -114,6 +113,7 @@
+ 	IssmDouble*    v        = xNew<IssmDouble>(dim);
+ 	IssmDouble*    w        = xNew<IssmDouble>(dim);
+ 	IssmDouble*    c        = xNew<IssmDouble>(dim);
++	IssmDouble*    dlsf     = xNew<IssmDouble>(dim);
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+@@ -155,10 +155,8 @@
+ 		for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
+ 		norm_dlsf=sqrt(norm_dlsf);
+ 
+-		if(norm_dlsf>1.e-10){
+-			for(i=0;i<dim;i++) normal[i]=dlsf[i]/norm_dlsf;
+-			for(i=0;i<dim;i++) c[i]=calvingrate*normal[i];
+-		}
++		if(norm_dlsf>1.e-10)
++			for(i=0;i<dim;i++) c[i]=calvingrate*dlsf[i]/norm_dlsf;
+ 		else
+ 			for(i=0;i<dim;i++) c[i]=0.;
+ 		
+@@ -229,6 +227,7 @@
+ 	xDelete<IssmDouble>(v);
+ 	xDelete<IssmDouble>(w);
+ 	xDelete<IssmDouble>(c);
++	xDelete<IssmDouble>(dlsf);
+ 	delete gauss;
+ 	return Ke;
+ }/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17371-17372.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17371-17372.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17371-17372.diff	(revision 17802)
@@ -0,0 +1,942 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 17371)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 17372)
+@@ -7,7 +7,7 @@
+ 
+ /*Headers*/
+ #include "./Analysis.h"
+-
++class Node; 
+ class HydrologyDCInefficientAnalysis: public Analysis{
+ 
+ 	public:
+@@ -34,6 +34,7 @@
+ 		IssmDouble SedimentStoring(Element* element);
+ 		IssmDouble EplSpecificStoring(Element* element);
+ 		IssmDouble GetHydrologyDCInefficientHmax(Element* element, Gauss* gauss);
++		void GetHydrologyDCInefficientHmax(IssmDouble* ph_max,Element* element, Node* innode);
+ 		IssmDouble GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss);
+ 		IssmDouble GetHydrologyPVectorTransfer(Element* element, Gauss* gauss);
+ 		void ElementizeEplMask(FemModel* femmodel);
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17371)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17372)
+@@ -366,38 +366,6 @@
+ 	IssmDouble water_compressibility    = element->GetMaterialParameter(HydrologydcWaterCompressibilityEnum);
+ 	return rho_freshwater*g*sediment_porosity*sediment_thickness*(water_compressibility+(sediment_compressibility/sediment_porosity));		 
+ }/*}}}*/
+-IssmDouble HydrologyDCEfficientAnalysis::GetHydrologyDCInefficientHmax(Element* element, Gauss* gauss){/*{{{*/
+-	int        hmax_flag;
+-	IssmDouble h_max;
+-	IssmDouble rho_ice,rho_water;
+-	IssmDouble thickness,bed;
+-
+-	/*Get the flag to the limitation method*/
+-	element->FindParam(&hmax_flag,HydrologydcSedimentlimitFlagEnum);
+-	
+-	/*Switch between the different cases*/
+-	switch(hmax_flag){
+-	case 0:
+-		h_max=1.0e+10;
+-		break;
+-	case 1:
+-		element->FindParam(&h_max,HydrologydcSedimentlimitEnum);
+-		break;
+-	case 2:
+-		rho_water= element->GetMaterialParameter(MaterialsRhoFreshwaterEnum);
+-		rho_ice= element->GetMaterialParameter(MaterialsRhoIceEnum);
+-		element->GetInputValue(&thickness,gauss,ThicknessEnum);
+-		element->GetInputValue(&bed,gauss,BedEnum);
+-		h_max=((rho_ice*thickness)/rho_water)+bed;
+-		break;
+-	case 3:
+-		_error_("Using normal stress  not supported yet");
+-		break;
+-	default:
+-		_error_("no case higher than 3 for SedimentlimitFlag");
+-	}
+-	return h_max;
+-}/*}}}*/
+ IssmDouble HydrologyDCEfficientAnalysis::GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss){/*{{{*/
+ 	
+ 	int transfermethod;
+@@ -421,7 +389,7 @@
+ 		/* _assert_(input) */
+ 		/* get input */
+ 
+-			element->GetInputValue(&epl_thickness,gauss,HydrologydcEplThicknessEnum);
++		element->GetInputValue(&epl_thickness,gauss,HydrologydcEplThicknessEnum);
+ 		element->GetInputValue(&sed_head,gauss,SedimentHeadEnum);
+ 		element->GetInputValue(&epl_head,gauss,EplHeadEnum);
+ 		element->GetInputValue(&sediment_transmitivity,gauss,HydrologydcSedimentTransmitivityEnum);
+@@ -518,12 +486,14 @@
+ 		_error_("not Implemented Yet");
+ 		}
+ 			
+-		int         numnodes = element->GetNumberOfNodes();
+-		IssmDouble  thickness[numnodes];
+-		IssmDouble  eplhead[numnodes];
+-		IssmDouble  epl_slopeX[numnodes],epl_slopeY[numnodes];
+-		IssmDouble  old_thickness[numnodes];
+-		IssmDouble  ice_thickness[numnodes],bed[numnodes];
++		int         numnodes      = element->GetNumberOfNodes();
++		IssmDouble* thickness     = xNew<IssmDouble>(numnodes);
++		IssmDouble* eplhead       = xNew<IssmDouble>(numnodes);
++		IssmDouble* epl_slopeX    = xNew<IssmDouble>(numnodes);
++		IssmDouble* epl_slopeY    = xNew<IssmDouble>(numnodes);
++		IssmDouble* old_thickness = xNew<IssmDouble>(numnodes);
++		IssmDouble* ice_thickness = xNew<IssmDouble>(numnodes);
++		IssmDouble* bed           = xNew<IssmDouble>(numnodes);
+ 
+ 		Input* 	active_element_input=element->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);		
+ 		active_element_input->GetInputValue(&active_element);
+@@ -573,6 +543,13 @@
+ 			}
+ 		}
+ 		element->AddInput(HydrologydcEplThicknessEnum,thickness,P1Enum);
++		xDelete<IssmDouble>(thickness);
++		xDelete<IssmDouble>(eplhead);
++		xDelete<IssmDouble>(epl_slopeX);
++		xDelete<IssmDouble>(epl_slopeY);
++		xDelete<IssmDouble>(old_thickness);
++		xDelete<IssmDouble>(ice_thickness);
++		xDelete<IssmDouble>(bed);
+ 	}
+ }
+ /*}}}*/
+@@ -603,3 +580,160 @@
+ 	/*Clean-up*/
+ 	xDelete<IssmDouble>(dbasis);
+ }/*}}}*/
++void  HydrologyDCEfficientAnalysis::HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask,Element* element){
++
++	bool        active_element;
++	int         i,j;
++	int         meshtype;
++	IssmDouble  h_max;
++	IssmDouble  sedheadmin;
++	Element*   basalelement=NULL;
++
++	/*Get basal element*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()) return;
++			basalelement = element->SpawnBasalElement();
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Intermediaries*/
++
++	int         numnodes      =basalelement->GetNumberOfNodes();
++	IssmDouble* epl_thickness =xNew<IssmDouble>(numnodes);
++	IssmDouble* old_active    =xNew<IssmDouble>(numnodes);
++	IssmDouble* sedhead       =xNew<IssmDouble>(numnodes);
++	IssmDouble* eplhead       =xNew<IssmDouble>(numnodes);
++	IssmDouble* residual      =xNew<IssmDouble>(numnodes);
++
++	IssmDouble init_thick =	basalelement->GetMaterialParameter(HydrologydcEplInitialThicknessEnum);
++
++	Input* active_element_input=basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);
++	active_element_input->GetInputValue(&active_element);
++
++	basalelement-> GetInputListOnVertices(&old_active[0],HydrologydcMaskEplactiveNodeEnum);	
++	basalelement->	GetInputListOnVertices(&epl_thickness[0],HydrologydcEplThicknessEnum);	
++	basalelement->	GetInputListOnVertices(&sedhead[0],SedimentHeadEnum);
++	basalelement->	GetInputListOnVertices(&eplhead[0],EplHeadEnum);
++	basalelement->	GetInputListOnVertices(&residual[0],SedimentHeadResidualEnum);
++
++	/*Get minimum sediment head of the element*/
++	sedheadmin=sedhead[0];
++	for(i=1;i<numnodes;i++) if(sedhead[i]<=sedheadmin)sedheadmin=sedhead[i];
++
++	for(i=0;i<numnodes;i++){
++		/*Activate EPL if residual is >0 */
++		if(residual[i]>0.){
++			vec_mask->SetValue(basalelement->nodes[i]->Sid(),1.,INS_VAL);
++		}
++
++		/*If mask was already one, keep one*/
++		else if(old_active[i]>0.){
++			vec_mask->SetValue(basalelement->nodes[i]->Sid(),1.,INS_VAL);
++			/*If epl thickness gets under , close the layer*/
++			if(epl_thickness[i]<0.001*init_thick){
++				vec_mask->SetValue(basalelement->nodes[i]->Sid(),0.,INS_VAL);
++				epl_thickness[i]=init_thick;
++			}
++		}
++		/*Increase of the efficient system is needed if the epl head reach the maximum value (sediment max value for now)*/
++		GetHydrologyDCInefficientHmax(&h_max,basalelement,basalelement->nodes[i]);
++		if(eplhead[i]>=h_max && active_element){
++			for(j=0;j<numnodes;j++){
++				if(old_active[j]>0.){
++					vec_mask->SetValue(basalelement->nodes[i]->Sid(),1.,INS_VAL);
++				}
++				/*Increase of the domain is on the downstream node in term of sediment head*/
++				if(sedhead[j] == sedheadmin){
++					vec_mask->SetValue(basalelement->nodes[j]->Sid(),1.,INS_VAL);
++				}
++			}
++		}
++	}
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	xDelete<IssmDouble>(epl_thickness);
++	xDelete<IssmDouble>(old_active);
++	xDelete<IssmDouble>(sedhead);
++	xDelete<IssmDouble>(eplhead);
++	xDelete<IssmDouble>(residual);
++}
++/*}}}*/
++void HydrologyDCEfficientAnalysis::HydrologyEPLGetActive(Vector<IssmDouble>* active_vec, Element* element){
++	/*Constants*/
++
++	int      meshtype;
++	Element*   basalelement=NULL;
++
++	/*Get basal element*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			basalelement = element;
++			break;
++		case Mesh3DEnum:
++			if(!element->IsOnBed()) return;
++			basalelement = element->SpawnBasalElement();
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++	
++	const int   numnodes = basalelement->GetNumberOfNodes();
++	IssmDouble  flag     = 0.;
++	IssmDouble* active   = xNew<IssmDouble>(numnodes);
++		
++	basalelement->GetInputListOnVertices(&active[0],HydrologydcMaskEplactiveNodeEnum);
++	
++	for(int i=0;i<numnodes;i++) flag+=active[i];
++
++	if(flag>0.){
++		for(int i=0;i<numnodes;i++){
++			active_vec->SetValue(basalelement->nodes[i]->Sid(),1.,INS_VAL);
++		}
++	}
++	else{
++		/*Do not do anything: at least one node is active for this element but this element is not solved for*/
++	}
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	xDelete<IssmDouble>(active);
++}
++
++void  HydrologyDCEfficientAnalysis::GetHydrologyDCInefficientHmax(IssmDouble* ph_max,Element* element, Node* innode){/*{{{*/
++	
++	int        hmax_flag;
++	IssmDouble h_max;
++	IssmDouble rho_ice,rho_water;
++	IssmDouble thickness,bed;
++	/*Get the flag to the limitation method*/
++	element->FindParam(&hmax_flag,HydrologydcSedimentlimitFlagEnum);
++	
++	/*Switch between the different cases*/
++	switch(hmax_flag){
++	case 0:
++		h_max=1.0e+10;
++		break;
++	case 1:
++		element->FindParam(&h_max,HydrologydcSedimentlimitEnum);
++		break;
++	case 2:
++		/*Compute max*/
++		rho_water = element->GetMaterialParameter(MaterialsRhoFreshwaterEnum);
++		rho_ice   = element->GetMaterialParameter(MaterialsRhoIceEnum);
++		element->GetInputValue(&thickness,innode,ThicknessEnum);
++		element->GetInputValue(&bed,innode,BedEnum);
++		h_max=((rho_ice*thickness)/rho_water)+bed;
++		break;
++	case 3:
++		_error_("Using normal stress  not supported yet");
++		break;
++	default:
++		_error_("no case higher than 3 for SedimentlimitFlag");
++	}
++	/*Assign output pointer*/
++	*ph_max=h_max;
++}
++/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17371)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17372)
+@@ -1,6 +1,7 @@
+ #include "./HydrologyDCInefficientAnalysis.h"
+ #include "../toolkits/toolkits.h"
+ #include "../classes/classes.h"
++#include "../classes/Node.h"
+ #include "../shared/shared.h"
+ #include "../modules/modules.h"
+ 
+@@ -418,7 +419,7 @@
+ 		kappa=kmax*pow(10.,penalty_factor);
+ 
+ 		for(int i=0;i<numnodes;i++){
+-			basalelement->GetHydrologyDCInefficientHmax(&h_max,basalelement->GetNode(i));
++			GetHydrologyDCInefficientHmax(&h_max,basalelement,basalelement->GetNode(i));
+ 			if(values[i]>h_max) residual[i] = kappa*(values[i]-h_max);
+ 			else                residual[i] = 0.;
+ 		}
+@@ -495,7 +496,41 @@
+ 	}
+ 	return h_max;
+ }/*}}}*/
+-
++void  HydrologyDCInefficientAnalysis::GetHydrologyDCInefficientHmax(IssmDouble* ph_max,Element* element, Node* innode){/*{{{*/
++	
++	int        hmax_flag;
++	IssmDouble h_max;
++	IssmDouble rho_ice,rho_water;
++	IssmDouble thickness,bed;
++	/*Get the flag to the limitation method*/
++	element->FindParam(&hmax_flag,HydrologydcSedimentlimitFlagEnum);
++	
++	/*Switch between the different cases*/
++	switch(hmax_flag){
++	case 0:
++		h_max=1.0e+10;
++		break;
++	case 1:
++		element->FindParam(&h_max,HydrologydcSedimentlimitEnum);
++		break;
++	case 2:
++		/*Compute max*/
++		rho_water = element->GetMaterialParameter(MaterialsRhoFreshwaterEnum);
++		rho_ice   = element->GetMaterialParameter(MaterialsRhoIceEnum);
++		element->GetInputValue(&thickness,innode,ThicknessEnum);
++		element->GetInputValue(&bed,innode,BedEnum);
++		h_max=((rho_ice*thickness)/rho_water)+bed;
++		break;
++	case 3:
++		_error_("Using normal stress  not supported yet");
++		break;
++	default:
++		_error_("no case higher than 3 for SedimentlimitFlag");
++	}
++	/*Assign output pointer*/
++	*ph_max=h_max;
++}
++/*}}}*/
+ IssmDouble HydrologyDCInefficientAnalysis::GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss){/*{{{*/
+ 
+ 	int transfermethod;
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 17371)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 17372)
+@@ -7,7 +7,7 @@
+ 
+ /*Headers*/
+ #include "./Analysis.h"
+-
++class Node; 
+ class HydrologyDCEfficientAnalysis: public Analysis{
+ 
+ 	public:
+@@ -33,9 +33,11 @@
+ 		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		IssmDouble EplSpecificStoring(Element* element);
+ 		IssmDouble SedimentStoring(Element* element);
+-		IssmDouble GetHydrologyDCInefficientHmax(Element* element, Gauss* gauss);
+ 		IssmDouble GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss);
+ 		IssmDouble GetHydrologyPVectorTransfer(Element* element, Gauss* gauss);
++		void HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask,Element* element);
++		void HydrologyEPLGetActive(Vector<IssmDouble>* active_vec, Element* element);
++		void GetHydrologyDCInefficientHmax(IssmDouble* ph_max,Element* element, Node* innode);
+ 		void ComputeEPLThickness(FemModel* femmodel);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17371)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	(revision 17372)
+@@ -155,7 +155,6 @@
+ 			}
+ 		}
+ 		/* }}} *//*End of the global sediment loop*/
+-
+ 		/* {{{ *//*Now dealing with the EPL in the same way*/
+ 		if(isefficientlayer){
+ 			femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
+@@ -169,7 +168,6 @@
+ 				eplconverged=false;
+ 				ug_epl_sub_iter=ug_epl->Duplicate();_assert_(ug_epl_sub_iter);
+ 				ug_epl->Copy(ug_epl_sub_iter);
+-
+ 				/* {{{ *//*Retrieve the EPL head slopes and compute EPL Thickness*/
+ 				if(VerboseSolution()) _printf0_("computing EPL Head slope...\n");
+ 				inefanalysis->ElementizeEplMask(femmodel);
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_linear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_linear.cpp	(revision 17371)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_linear.cpp	(revision 17372)
+@@ -23,7 +23,6 @@
+ 	femmodel->parameters->FindParam(&configuration_type,ConfigurationTypeEnum);
+ 	femmodel->UpdateConstraintsx();
+ 	SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
+-
+ 	CreateNodalConstraintsx(&ys,femmodel->nodes,configuration_type);
+ 	Reduceloadx(pf, Kfs, ys); delete Kfs;
+ 	Solverx(&uf, Kff, pf, NULL, df, femmodel->parameters); 
+Index: ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 17371)
++++ ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 17372)
+@@ -12,6 +12,7 @@
+ 
+ #include "../classes.h"
+ #include "shared/shared.h"
++#include "../../analyses/analyses.h"
+ /*}}}*/
+ 
+ /*Element macros*/
+@@ -600,6 +601,7 @@
+ 	IssmDouble pressure;
+ 	IssmDouble h;
+ 	IssmDouble h_max;	
++	HydrologyDCInefficientAnalysis* inefanalysis = NULL;
+ 
+ 	/*check that pengrid is not a clone (penalty to be added only once)*/
+ 	if(node->IsClone()){
+@@ -615,8 +617,9 @@
+ 	}
+ 
+ 	/*Get sediment water head h*/
++	inefanalysis = new HydrologyDCInefficientAnalysis();
+ 	element->GetInputValue(&h,node,SedimentHeadEnum);
+-	element->GetHydrologyDCInefficientHmax(&h_max,node);
++	inefanalysis->GetHydrologyDCInefficientHmax(&h_max,element,node);
+ 	parameters->FindParam(&penalty_lock,HydrologydcPenaltyLockEnum);
+ 
+ 	if (h>h_max){
+@@ -645,12 +648,12 @@
+ 	this->active=new_active;
+ 
+ 	/*Assign output pointers:*/
++	delete inefanalysis;
+ 	*punstable=unstable;
+ }
+ /*}}}*/
+ /*FUNCTION Pengrid::PenaltyCreateKMatrixHydrologyDCInefficient {{{*/
+ ElementMatrix* Pengrid::PenaltyCreateKMatrixHydrologyDCInefficient(IssmDouble kmax){
+-
+ 	IssmDouble    penalty_factor;
+ 
+ 	/*Retrieve parameters*/
+@@ -671,19 +674,23 @@
+ 
+ 	IssmDouble h_max;
+ 	IssmDouble penalty_factor;
++	HydrologyDCInefficientAnalysis* inefanalysis = NULL;
+ 
+ 	/*Initialize Element matrix and return if necessary*/
+ 	if(!this->active) return NULL;
+ 	ElementVector* pe=new ElementVector(&node,1,this->parameters);
++	inefanalysis = new HydrologyDCInefficientAnalysis();
+ 
+ 	/*Retrieve parameters*/
+ 	parameters->FindParam(&penalty_factor,HydrologydcPenaltyFactorEnum);
+ 
+ 	/*Get h_max and compute penalty*/
+-	element->GetHydrologyDCInefficientHmax(&h_max,node);
++	inefanalysis->GetHydrologyDCInefficientHmax(&h_max,element,node);
++
+ 	pe->values[0]=kmax*pow(10.,penalty_factor)*h_max;
+ 
+ 	/*Clean up and return*/
++	delete inefanalysis;
+ 	return pe;
+ }
+ /*}}}*/
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17371)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17372)
+@@ -15,6 +15,8 @@
+ #include "./modules/modules.h"
+ #include "../shared/Enum/Enum.h"
+ 
++#include "../analyses/analyses.h"
++
+ /*module includes: {{{*/
+ #include "../modules/ModelProcessorx/ModelProcessorx.h"
+ #include "../modules/VerticesDofx/VerticesDofx.h"
+@@ -1351,12 +1353,14 @@
+ 	IssmDouble*         serial_mask   = NULL;
+ 	Vector<IssmDouble>* active        = NULL;
+ 	IssmDouble*         serial_active = NULL;
+-
+-	/*Step 1: update maks, the mask might be extended by residual and/or using downstream sediment head*/
++	
++	HydrologyDCEfficientAnalysis* effanalysis =  new HydrologyDCEfficientAnalysis();
++	/*Step 1: update mask, the mask might be extended by residual and/or using downstream sediment head*/
+ 	mask=new Vector<IssmDouble>(nodes->NumberOfNodes(HydrologyDCEfficientAnalysisEnum));
++
+ 	for (int i=0;i<elements->Size();i++){
+ 		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+-		element->HydrologyEPLGetMask(mask);
++		effanalysis->HydrologyEPLGetMask(mask,element);
+ 	}
+ 
+ 	/*Assemble and serialize*/
+@@ -1372,7 +1376,7 @@
+ 	active=new Vector<IssmDouble>(nodes->NumberOfNodes(HydrologyDCEfficientAnalysisEnum));
+ 	for (int i=0;i<elements->Size();i++){
+ 		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+-		element->HydrologyEPLGetActive(active);
++		effanalysis->HydrologyEPLGetActive(active,element);
+ 	}
+ 
+ 	/*Assemble and serialize*/
+@@ -1395,6 +1399,7 @@
+ 		}
+ 	}
+ 	xDelete<IssmDouble>(serial_active);
++	delete effanalysis;
+ 	int sum_counter;
+ 	ISSM_MPI_Reduce(&counter,&sum_counter,1,ISSM_MPI_INT,ISSM_MPI_SUM,0,IssmComm::GetComm() );
+ 	ISSM_MPI_Bcast(&sum_counter,1,ISSM_MPI_INT,0,IssmComm::GetComm());                
+@@ -1406,30 +1411,24 @@
+ 
+ }
+ /*}}}*/
+-/* void FemModel::HydrologyEPLThicknessx(void){ /\*{{{*\/ */
+-
+-/* 	for (int i=0;i<elements->Size();i++){ */
+-/* 		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i)); */
+-/* 		element->ComputeEPLThickness(); */
+-/* 	} */
+-/* } */
+-/*}}}*/
+ void FemModel::UpdateConstraintsL2ProjectionEPLx(void){ /*{{{*/
+ 
+ 	Vector<IssmDouble>* active        = NULL;
+ 	IssmDouble*         serial_active = NULL;
++	HydrologyDCEfficientAnalysis* effanalysis = new HydrologyDCEfficientAnalysis();
+ 
+ 	/*update node activity. If one element is connected to mask=1, all nodes are active*/
+ 	active=new Vector<IssmDouble>(nodes->NumberOfNodes(HydrologyDCEfficientAnalysisEnum));
+ 	for (int i=0;i<elements->Size();i++){
+ 		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+-		element->HydrologyEPLGetActive(active);
++		effanalysis->HydrologyEPLGetActive(active,element);
+ 	}
+ 
+ 	/*Assemble and serialize*/
+ 	active->Assemble();
+ 	serial_active=active->ToMPISerial();
+ 	delete active;
++	delete effanalysis;
+ 
+ 	/*Update node activation accordingly*/
+ 	int counter =0;
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17371)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17372)
+@@ -282,11 +282,6 @@
+ 		virtual void UpdateConstraintsExtrudeFromBase(void)=0;
+ 		virtual void UpdateConstraintsExtrudeFromTop(void)=0;
+ 
+-		virtual void GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode)=0;
+-		virtual void HydrologyEPLGetMask(Vector<IssmDouble>* mask)=0;
+-		virtual void HydrologyEPLGetActive(Vector<IssmDouble>* active)=0;
+-		//		virtual void ComputeEPLThickness(void)=0;
+-
+ 		virtual void   MigrateGroundingLine(IssmDouble* sheet_ungrounding)=0;
+ 		virtual void   PotentialUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding)=0;
+ 		virtual int    UpdatePotentialUngrounding(IssmDouble* potential_sheet_ungrounding,Vector<IssmDouble>* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17371)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17372)
+@@ -4424,200 +4424,7 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetHydrologyDCInefficientHmax{{{*/
+-void  Tria::GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode){
+-	
+-	int        hmax_flag;
+-	IssmDouble h_max;
+-	IssmDouble rho_ice,rho_water;
+-	IssmDouble thickness,bed;
+-	/*Get the flag to the limitation method*/
+-	this->parameters->FindParam(&hmax_flag,HydrologydcSedimentlimitFlagEnum);
+-	
+-	/*Switch between the different cases*/
+-	switch(hmax_flag){
+-	case 0:
+-		h_max=1.0e+10;
+-		break;
+-	case 1:
+-		parameters->FindParam(&h_max,HydrologydcSedimentlimitEnum);
+-		break;
+-	case 2:
+-		rho_ice=matpar->GetRhoIce();
+-		rho_water=matpar->GetRhoFreshwater();
+-		this->GetInputValue(&thickness,innode,ThicknessEnum);
+-		this->GetInputValue(&bed,innode,BedEnum);
+-		h_max=((rho_ice*thickness)/rho_water)+bed;
+-		break;
+-	case 3:
+-		_error_("Using normal stress  not supported yet");
+-		break;
+-	default:
+-		_error_("no case higher than 3 for SedimentlimitFlag");
+-	}
+-	/*Assign output pointer*/
+-	*ph_max=h_max;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::HydrologyEPLGetActive {{{*/
+-void Tria::HydrologyEPLGetActive(Vector<IssmDouble>* active_vec){
+ 
+-	/*Constants*/
+-	const int  numnodes = NUMVERTICES;
+-	IssmDouble flag     = 0.;
+-	IssmDouble active[numnodes];
+-
+-	GetInputListOnVertices(&active[0],HydrologydcMaskEplactiveNodeEnum);
+-	
+-	for(int i=0;i<numnodes;i++) flag+=active[i];
+-
+-	if(flag>0.){
+-		for(int i=0;i<numnodes;i++){
+-			active_vec->SetValue(nodes[i]->Sid(),1.,INS_VAL);
+-		}
+-	}
+-	else{
+-		/*Do not do anything: at least one node is active for this element but this element is not solved for*/
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION Tria::HydrologyEPLGetMask{{{*/
+-void  Tria::HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask){
+-
+-	/*Intermediaries*/
+-	int         i,j;
+-	const int   numdof         = NDOF1 *NUMVERTICES;
+-	IssmDouble  init_thick;
+-	IssmDouble  h_max;
+-	IssmDouble  sedheadmin;
+-	IssmDouble  epl_thickness[numdof];
+-	IssmDouble  old_active[numdof];
+-	IssmDouble  sedhead[numdof];
+-	IssmDouble  eplhead[numdof];
+-	IssmDouble  residual[numdof];
+-
+-	bool       active_element;
+-	Input* active_element_input=NULL;
+-
+-	init_thick = matpar->GetEplInitialThickness();
+-
+-	active_element_input=inputs->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);
+-	active_element_input->GetInputValue(&active_element);
+-
+-	GetInputListOnVertices(&old_active[0],HydrologydcMaskEplactiveNodeEnum);	
+-	GetInputListOnVertices(&epl_thickness[0],HydrologydcEplThicknessEnum);	
+-	GetInputListOnVertices(&sedhead[0],SedimentHeadEnum);
+-	GetInputListOnVertices(&eplhead[0],EplHeadEnum);
+-	GetInputListOnVertices(&residual[0],SedimentHeadResidualEnum);
+-
+-	/*Get minimum sediment head of the element*/
+-	sedheadmin=sedhead[0];
+-	for(i=1;i<numdof;i++) if(sedhead[i]<=sedheadmin)sedheadmin=sedhead[i];
+-
+-	for(i=0;i<numdof;i++){
+-		/*Activate EPL if residual is >0 */
+-		if(residual[i]>0.){
+-			vec_mask->SetValue(nodes[i]->Sid(),1.,INS_VAL);
+-		}
+-
+-		/*If mask was already one, keep one*/
+-		else if(old_active[i]>0.){
+-			vec_mask->SetValue(nodes[i]->Sid(),1.,INS_VAL);
+-			/*If epl thickness gets under , close the layer*/
+-			if(epl_thickness[i]<0.001*init_thick){
+-				vec_mask->SetValue(nodes[i]->Sid(),0.,INS_VAL);
+-				epl_thickness[i]=init_thick;
+-			}
+-		}
+-		/*Increase of the efficient system is needed if the epl head reach the maximum value (sediment max value for now)*/
+-		this->GetHydrologyDCInefficientHmax(&h_max,this->nodes[i]);
+-		if(eplhead[i]>=h_max && active_element){
+-			for(j=0;j<numdof;j++){
+-				if(old_active[j]>0.){
+-					vec_mask->SetValue(nodes[i]->Sid(),1.,INS_VAL);
+-				}
+-				/*Increase of the domain is on the downstream node in term of sediment head*/
+-				if(sedhead[j] == sedheadmin){
+-					vec_mask->SetValue(nodes[j]->Sid(),1.,INS_VAL);
+-				}
+-			}
+-		}
+-	}
+-}
+-/*}}}*/
+-//* *FUNCTION Tria::ComputeEPLThickness{{{*\/ */
+-/* void  Tria::ComputeEPLThickness(void){ */
+-
+-/* 	const int   numdof         = NDOF1 *NUMVERTICES; */
+-/* 	bool        isefficientlayer; */
+-/* 	bool        active_element; */
+-/* 	IssmDouble  n,A,dt,init_thick; */
+-/* 	IssmDouble  rho_water,rho_ice; */
+-/* 	IssmDouble  gravity,latentheat,EPLgrad2; */
+-/* 	IssmDouble  EPL_N,epl_conductivity; */
+-/* 	IssmDouble  thickness[numdof]; */
+-/* 	IssmDouble  eplhead[numdof]; */
+-/* 	IssmDouble  epl_slopeX[numdof],epl_slopeY[numdof]; */
+-/* 	IssmDouble  old_thickness[numdof]; */
+-/* 	IssmDouble  ice_thickness[numdof],bed[numdof]; */
+-
+-/* 	Input* active_element_input=NULL; */
+-
+-/* 	/\*Get the flag to know if the efficient layer is present*\/ */
+-/* 	this->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum); */
+-/* 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum); */
+-
+-/* 	if(isefficientlayer){ */
+-
+-/* 		/\*For now, assuming just one way to compute EPL thickness*\/ */
+-/* 		rho_water        = matpar->GetRhoWater(); */
+-/* 		rho_ice          = matpar->GetRhoIce(); */
+-/* 		gravity          = matpar->GetG(); */
+-/* 		latentheat       = matpar->GetLatentHeat(); */
+-/* 		epl_conductivity = matpar->GetEplConductivity(); */
+-/* 		init_thick       = matpar->GetEplInitialThickness(); */
+-/* 		n                = material->GetN(); */
+-/* 		A                = material->GetAbar(); */
+-		
+-/* 		active_element_input=inputs->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input); */
+-/* 		active_element_input->GetInputValue(&active_element); */
+-			
+-/* 		GetInputListOnVertices(&eplhead[0],EplHeadEnum); */
+-/* 		GetInputListOnVertices(&epl_slopeX[0],EplHeadSlopeXEnum);  */
+-/* 		GetInputListOnVertices(&epl_slopeY[0],EplHeadSlopeYEnum); */
+-/* 		GetInputListOnVertices(&old_thickness[0],HydrologydcEplThicknessOldEnum); */
+-/* 		GetInputListOnVertices(&ice_thickness[0],ThicknessEnum); */
+-/* 		GetInputListOnVertices(&bed[0],BedEnum); */
+-		
+-/* 		if(!active_element){ */
+-/* 			/\*Keeping thickness to initial value if EPL is not active*\/ */
+-/* 			for(int i=0;i<numdof;i++){ */
+-/* 				thickness[i]=init_thick; */
+-/* 			} */
+-/* 		} */
+-/* 		else{ */
+-/* 			for(int i=0;i<numdof;i++){ */
+-				
+-/* 				/\*Compute first the effective pressure in the EPL*\/ */
+-/* 				EPL_N=gravity*((rho_ice*ice_thickness[i])-(rho_water*(eplhead[i]-bed[i]))); */
+-/* 				if(EPL_N<0.0)EPL_N=0.0; */
+-/* 				/\*Get then the square of the gradient of EPL heads*\/ */
+-/* 				EPLgrad2 = (epl_slopeX[i]*epl_slopeX[i]+epl_slopeY[i]*epl_slopeY[i]); */
+-				
+-/* 				/\*And proceed to the real thing*\/ */
+-/* 				thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*EPLgrad2-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n))); */
+-					
+-/* 				/\*Take care of otherthikening*\/ */
+-/* 				if(thickness[i]>10.0*init_thick){ */
+-/* 					thickness[i] = 10.0*init_thick; */
+-/* 				} */
+-/* 			} */
+-/* 		} */
+-/* 		this->inputs->AddInput(new TriaInput(HydrologydcEplThicknessEnum,thickness,P1Enum)); */
+-/* 	} */
+-/* } */
+-/*}}}*/
+-
+ #ifdef _HAVE_DAKOTA_
+ /*FUNCTION Tria::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type);{{{*/
+ void  Tria::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17371)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17372)
+@@ -252,11 +252,6 @@
+ 		void UpdateConstraintsExtrudeFromTop(void);
+ 
+ 		void           CreateHydrologyWaterVelocityInput(void);
+-		
+-		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode);
+-		void           HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
+-		void           HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask);
+-		//		void           ComputeEPLThickness(void);
+ 		/*}}}*/
+ 
+ };
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17371)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17372)
+@@ -4154,17 +4154,6 @@
+ }
+ /*}}}*/
+ #endif
+-
+-/*FUNCTION Penta::GetHydrologyDCInefficientHmax{{{*/
+-void  Penta::GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode){
+-
+-	if (!IsOnBed()) return;
+-
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	tria->GetHydrologyDCInefficientHmax(ph_max,innode);
+-	delete tria->material; delete tria;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::GetSolutionFromInputsOneDof {{{*/
+ void Penta::GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution, int enum_type){
+ 
+@@ -4196,106 +4185,6 @@
+ 	xDelete<int>(doflist);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::HydrologyEPLGetActive {{{*/
+-void Penta::HydrologyEPLGetActive(Vector<IssmDouble>* active_vec){
+-
+-	if (!IsOnBed()){
+-		return;
+-	}
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	tria->HydrologyEPLGetActive(active_vec);
+-	delete tria->material; delete tria;
+-
+-}
+-/*}}}*/
+-/*FUNCTION Penta::HydrologyEPLGetMask{{{*/
+-void  Penta::HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask){
+-
+-	if (!IsOnBed())return;
+-
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
+-	tria->HydrologyEPLGetMask(vec_mask);
+-	delete tria->material; delete tria;
+-
+-}
+-/*}}}*/
+-/* /\*FUNCTION Penta::ComputeEPLThickness{{{*\/ */
+-/* void  Penta::ComputeEPLThickness(void){ */
+-
+-/* 	int         i; */
+-/* 	const int   numdof   = NDOF1 *NUMVERTICES; */
+-/* 	const int   numdof2d = NDOF1 *NUMVERTICES2D; */
+-/* 	bool        isefficientlayer; */
+-/* 	IssmDouble  n,A,dt,init_thick; */
+-/* 	IssmDouble  rho_water,rho_ice; */
+-/* 	IssmDouble  gravity,latentheat,EPLgrad; */
+-/* 	IssmDouble  EPL_N,epl_conductivity; */
+-/* 	IssmDouble  activeEpl[numdof],thickness[numdof]; */
+-/* 	IssmDouble  eplhead[numdof], old_thickness[numdof]; */
+-/* 	IssmDouble  epl_slopeX[numdof],epl_slopeY[numdof]; */
+-/* 	IssmDouble  ice_thickness[numdof],bed[numdof]; */
+-/* 	Penta       *penta = NULL; */
+-/* 	/\*If not on bed, return*\/ */
+-/* 	if (!IsOnBed())return; */
+-
+-/* 	/\*Get the flag to know if the efficient layer is present*\/ */
+-/* 	this->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum); */
+-/* 	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum); */
+-
+-/* 	if(isefficientlayer){ */
+-/* 		/\*For now, assuming just one way to compute EPL thickness*\/ */
+-/* 		rho_water        = matpar->GetRhoWater(); */
+-/* 		rho_ice          = matpar->GetRhoIce(); */
+-/* 		gravity          = matpar->GetG(); */
+-/* 		latentheat       = matpar->GetLatentHeat(); */
+-/* 		epl_conductivity = matpar->GetEplConductivity(); */
+-/* 		init_thick       = matpar->GetEplInitialThickness(); */
+-/* 		n                = material->GetN(); */
+-/* 		A                = material->GetA(); */
+-		
+-/* 		GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveNodeEnum); */
+-/* 		GetInputListOnVertices(&eplhead[0],EplHeadEnum); */
+-/* 		GetInputListOnVertices(&epl_slopeX[0],EplHeadSlopeXEnum);  */
+-/* 		GetInputListOnVertices(&epl_slopeY[0],EplHeadSlopeYEnum); */
+-/* 		GetInputListOnVertices(&old_thickness[0],HydrologydcEplThicknessOldEnum); */
+-/* 		GetInputListOnVertices(&ice_thickness[0],ThicknessEnum); */
+-/* 		GetInputListOnVertices(&bed[0],BedEnum); */
+-		
+-/* 		for(int i=0;i<numdof2d;i++){ */
+-/* 			/\*Keeping thickness to 1 if EPL is not active*\/ */
+-/* 			if(activeEpl[i]==0.0){ */
+-/* 				thickness[i]=init_thick; */
+-/* 				thickness[i+numdof2d]=thickness[i]; */
+-/* 			} */
+-/* 			else{ */
+-
+-/* 				/\*Compute first the effective pressure in the EPL*\/ */
+-/* 				EPL_N=gravity*((rho_ice*ice_thickness[i])-(rho_water*(eplhead[i]-bed[i]))); */
+-/* 				if(EPL_N<0.0)EPL_N=0.0; */
+-/* 				/\*Get then the gradient of EPL heads*\/ */
+-/* 				EPLgrad = epl_slopeX[i]+epl_slopeY[i]; */
+-				
+-/* 				/\*And proceed to the real thing*\/ */
+-/* 				thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*pow(EPLgrad,2.0)-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n))); */
+-/* 				thickness[i+numdof2d]=thickness[i]; */
+-/* 			} */
+-/* 		} */
+-/* 		penta=this; */
+-/* 		for(;;){ */
+-
+-/* 			/\*Add input to the element: *\/			 */
+-/* 			penta->inputs->AddInput(new PentaInput(HydrologydcEplThicknessEnum,thickness,P1Enum)); */
+-			
+-/* 			/\*Stop if we have reached the surface*\/ */
+-/* 			if (penta->IsOnSurface()) break; */
+-			
+-/* 			/\* get upper Penta*\/ */
+-/* 			penta=penta->GetUpperPenta(); _assert_(penta->Id()!=this->id); */
+-/* 		} */
+-/* 	} */
+-/* } */
+-/* /\*}}}*\/ */
+-
+ /*FUNCTION Penta::MigrateGroundingLine{{{*/
+ void  Penta::MigrateGroundingLine(IssmDouble* phi_ungrounding){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17371)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17372)
+@@ -240,11 +240,6 @@
+ 		Tria*	         SpawnTria(int location);
+ 		IssmDouble     StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa);
+ 
+-		void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode);
+-		void           HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
+-		void           HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask);
+-		//		void           ComputeEPLThickness(void);
+-
+ 		void           UpdateConstraintsExtrudeFromBase(void);
+ 		void           UpdateConstraintsExtrudeFromTop(void);
+ 		/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17371)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17372)
+@@ -149,9 +149,9 @@
+ 		void		   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum);
+ 		void        GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
+ 
+-		void    GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode){_error_("not implemented yet");};
+-		void    HydrologyEPLGetActive(Vector<IssmDouble>* active_vec){_error_("not implemented yet");};
+-		void    HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask){_error_("not implemented yet");};
++		//void    GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode){_error_("not implemented yet");};
++		//void    HydrologyEPLGetActive(Vector<IssmDouble>* active_vec){_error_("not implemented yet");};
++		//void    HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask){_error_("not implemented yet");};
+ 		//		void    ComputeEPLThickness(void){_error_("not implemented yet");};
+ 		
+ 		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-17372-17373.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17372-17373.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17372-17373.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/jenkins/windows
+===================================================================
+--- ../trunk-jpl/jenkins/windows	(revision 17372)
++++ ../trunk-jpl/jenkins/windows	(revision 17373)
+@@ -98,7 +98,7 @@
+ #ex: "'id',[101 102 103]"
+ 
+ #In Windows, we don't yet have MUMPS, can't do full stokes, so exclude all FS runs. Also exclude all runs with Dakota. And exclude higher order runs that have penalties.
+-MATLAB_NROPTIONS="'exclude',[104, 204, 211, 215, 220, 221, 285, 290, 308, 322, 404, 421, 422, 503, 507, 510, 511, 701, 702, 703, 218, 234, 235, 412, 413, 414, 417, 418, 420, 205, 274, 331, 405, 409, 455, 612, 514 ]"
++MATLAB_NROPTIONS="'exclude',[104, 124, 204, 211, 215, 220, 221, 285, 290, 308, 322, 404, 421, 422, 503, 507, 510, 511, 701, 702, 703, 218, 234, 235, 412, 413, 414, 417, 418, 420, 205, 274, 331, 405, 409, 455, 612, 514 ]"
+ PYTHON_NROPTIONS=""
+ 
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17373-17374.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17373-17374.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17373-17374.diff	(revision 17802)
@@ -0,0 +1,25 @@
+Index: ../trunk-jpl/jenkins/linux64_murdo
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo	(revision 17373)
++++ ../trunk-jpl/jenkins/linux64_murdo	(revision 17374)
+@@ -120,5 +120,5 @@
+ #as follows: runme($MATLAB_NROPTIONS). The options must be understandable
+ #by Matlab and runme.m
+ #ex: "'id',[101 102 103]"
+-MATLAB_NROPTIONS="'exclude',[119,514,701,702]"
+-PYTHON_NROPTIONS="--exclude 119 514 701 702"
++MATLAB_NROPTIONS="'exclude',[119,514,701,702,435]"
++PYTHON_NROPTIONS="--exclude 119 514 701 702 435"
+Index: ../trunk-jpl/jenkins/imac-012301-gil
+===================================================================
+--- ../trunk-jpl/jenkins/imac-012301-gil	(revision 17373)
++++ ../trunk-jpl/jenkins/imac-012301-gil	(revision 17374)
+@@ -104,6 +104,6 @@
+ #as follows: runme($MATLAB_NROPTIONS). The options must be understandable
+ #by Matlab and runme.m
+ #ex: "'id',[101 102 103]"
+-##                                                                   bamg mesh   FS
+-MATLAB_NROPTIONS="'exclude',[218 234 235 412 413 414 417 418 420 514 701 702 703 422 404 421 503 507 510]"
++##                                                                   bamg mesh   FS                      Other
++MATLAB_NROPTIONS="'exclude',[218 234 235 412 413 414 417 418 420 514 701 702 703 422 404 421 503 507 510 435]"
+ PYTHON_NROPTIONS=""
Index: issm/oecreview/Archive/16554-17801/ISSM-17374-17375.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17374-17375.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17374-17375.diff	(revision 17802)
@@ -0,0 +1,368 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 17374)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 17375)
+@@ -8,6 +8,7 @@
+ /*Headers*/
+ #include "./Analysis.h"
+ class Node; 
++class Input;
+ class HydrologyDCInefficientAnalysis: public Analysis{
+ 
+ 	public:
+@@ -33,10 +34,10 @@
+ 		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		IssmDouble SedimentStoring(Element* element);
+ 		IssmDouble EplSpecificStoring(Element* element);
+-		IssmDouble GetHydrologyDCInefficientHmax(Element* element, Gauss* gauss);
++		IssmDouble GetHydrologyDCInefficientHmax(Element* element, Gauss* gauss, Input* thickness_input, Input* bed_input);
+ 		void GetHydrologyDCInefficientHmax(IssmDouble* ph_max,Element* element, Node* innode);
+-		IssmDouble GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss);
+-		IssmDouble GetHydrologyPVectorTransfer(Element* element, Gauss* gauss);
++		IssmDouble GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss, Input* epl_thick_input, Input* sed_head_input, Input* epl_head_input, Input* sed_trans_input, Input* thickness_input, Input* bed_input);
++		IssmDouble GetHydrologyPVectorTransfer(Element* element, Gauss* gauss, Input* epl_thick_input, Input* sed_head_input, Input* epl_head_input, Input* sed_trans_input, Input* thickness_input, Input* bed_input);
+ 		void ElementizeEplMask(FemModel* femmodel);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17374)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17375)
+@@ -155,6 +155,11 @@
+ 	basalelement->GetVerticesCoordinates(&xyz_list);
+ 	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	Input* thickness_input = basalelement->GetInput(HydrologydcEplThicknessEnum);          _assert_(thickness_input);
++	Input* sed_head_input  = basalelement->GetInput(SedimentHeadEnum);
++	Input* epl_head_input  = basalelement->GetInput(EplHeadEnum);
++	Input* sed_trans_input = basalelement->GetInput(HydrologydcSedimentTransmitivityEnum);
++	Input* residual_input  = basalelement->GetInput(SedimentHeadResidualEnum);
++
+ 	IssmDouble epl_specificstoring   = EplSpecificStoring(basalelement);
+ 	IssmDouble epl_conductivity      = basalelement->GetMaterialParameter(HydrologydcEplConductivityEnum);
+ 
+@@ -186,7 +191,7 @@
+ 						&Ke->values[0],1);
+ 			
+ 			/*Transfer EPL part*/
+-			transfer=GetHydrologyKMatrixTransfer(basalelement,gauss);
++			transfer=GetHydrologyKMatrixTransfer(basalelement,gauss,thickness_input,sed_head_input,epl_head_input,sed_trans_input,residual_input);
+ 			D_scalar=transfer*gauss->weight*Jdet*dt;
+ 			TripleMultiply(basis,numnodes,1,0,
+ 										 &D_scalar,1,1,0,
+@@ -257,8 +262,11 @@
+ 	basalelement->GetVerticesCoordinates(&xyz_list);
+ 	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);	
+ 
++	Input* thickness_input = basalelement->GetInput(HydrologydcEplThicknessEnum); _assert_(thickness_input);
++	Input* sed_head_input  = basalelement->GetInput(SedimentHeadEnum);
++	Input* epl_head_input  = basalelement->GetInput(EplHeadEnum);
++	Input* sed_trans_input = basalelement->GetInput(HydrologydcSedimentTransmitivityEnum);
+ 	Input* residual_input  = basalelement->GetInput(SedimentHeadResidualEnum);    _assert_(residual_input);
+-	Input* thickness_input = basalelement->GetInput(HydrologydcEplThicknessEnum); _assert_(thickness_input);
+ 	if(dt!= 0.){old_wh_input = basalelement->GetInput(EplHeadOldEnum);            _assert_(old_wh_input);}
+ 
+ 	IssmDouble epl_specificstoring = EplSpecificStoring(basalelement);
+@@ -277,7 +285,7 @@
+ 			thickness_input ->GetInputValue(&epl_thickness,gauss);
+ 			
+ 			/*Dealing with the sediment part of the transfer term*/
+-			transfer=GetHydrologyPVectorTransfer(basalelement,gauss);
++			transfer=GetHydrologyPVectorTransfer(basalelement,gauss,thickness_input,sed_head_input,epl_head_input,sed_trans_input,residual_input);
+ 			scalar = Jdet*gauss->weight*((water_head*epl_specificstoring*epl_thickness)+(transfer*dt));
+ 			for(int i=0;i<numnodes;i++)pe->values[i]+=scalar*basis[i];
+ 		}
+@@ -366,7 +374,7 @@
+ 	IssmDouble water_compressibility    = element->GetMaterialParameter(HydrologydcWaterCompressibilityEnum);
+ 	return rho_freshwater*g*sediment_porosity*sediment_thickness*(water_compressibility+(sediment_compressibility/sediment_porosity));		 
+ }/*}}}*/
+-IssmDouble HydrologyDCEfficientAnalysis::GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss){/*{{{*/
++IssmDouble HydrologyDCEfficientAnalysis::GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss, Input* epl_thick_input, Input* sed_head_input, Input* epl_head_input, Input* sed_trans_input, Input* residual_input){/*{{{*/
+ 	
+ 	int transfermethod;
+ 	IssmDouble epl_thickness;
+@@ -386,14 +394,17 @@
+ 		transfer=0.0;
+ 		break;
+ 	case 1:
+-		/* _assert_(input) */
++		_assert_(epl_thick_input); 
++		_assert_(sed_head_input); 
++		_assert_(epl_head_input); 
++		_assert_(sed_trans_input); 
++		_assert_(residual_input); 
+ 		/* get input */
+-
+-		element->GetInputValue(&epl_thickness,gauss,HydrologydcEplThicknessEnum);
+-		element->GetInputValue(&sed_head,gauss,SedimentHeadEnum);
+-		element->GetInputValue(&epl_head,gauss,EplHeadEnum);
+-		element->GetInputValue(&sediment_transmitivity,gauss,HydrologydcSedimentTransmitivityEnum);
+-		element->GetInputValue(&residual,gauss,SedimentHeadResidualEnum);
++		epl_thick_input->GetInputValue(&epl_thickness,gauss);
++		sed_head_input->GetInputValue(&sed_head,gauss);
++		epl_head_input->GetInputValue(&epl_head,gauss);
++		sed_trans_input->GetInputValue(&sediment_transmitivity,gauss);
++		residual_input->GetInputValue(&residual,gauss);
+ 		element->FindParam(&leakage,HydrologydcLeakageFactorEnum);
+ 
+ 		if(epl_head>sed_head){
+@@ -414,7 +425,7 @@
+ 	
+ 	return transfer;
+ }/*}}}*/
+-IssmDouble HydrologyDCEfficientAnalysis::GetHydrologyPVectorTransfer(Element* element, Gauss* gauss){/*{{{*/
++IssmDouble HydrologyDCEfficientAnalysis::GetHydrologyPVectorTransfer(Element* element, Gauss* gauss, Input* epl_thick_input, Input* sed_head_input, Input* epl_head_input, Input* sed_trans_input, Input* residual_input){/*{{{*/
+ 
+ 	int transfermethod;
+ 	IssmDouble epl_thickness;
+@@ -434,12 +445,17 @@
+ 		transfer=0.0;
+ 		break;
+ 	case 1:
+-
+-		element->GetInputValue(&epl_thickness,gauss,HydrologydcEplThicknessEnum);
+-		element->GetInputValue(&sediment_head,gauss,SedimentHeadEnum);
+-		element->GetInputValue(&epl_head,gauss,EplHeadEnum);
+-		element->GetInputValue(&sediment_transmitivity,gauss,HydrologydcSedimentTransmitivityEnum);
+-		element->GetInputValue(&residual,gauss,SedimentHeadResidualEnum);
++		_assert_(epl_thick_input); 
++		_assert_(sed_head_input); 
++		_assert_(epl_head_input); 
++		_assert_(sed_trans_input); 
++		_assert_(residual_input); 
++		/* get input */
++		epl_thick_input->GetInputValue(&epl_thickness,gauss);
++		sed_head_input->GetInputValue(&sediment_head,gauss);
++		epl_head_input->GetInputValue(&epl_head,gauss);
++		sed_trans_input->GetInputValue(&sediment_transmitivity,gauss);
++		residual_input->GetInputValue(&residual,gauss);
+ 		element->FindParam(&leakage,HydrologydcLeakageFactorEnum);
+ 		
+ 		if(epl_head>sediment_head){
+@@ -617,10 +633,10 @@
+ 	active_element_input->GetInputValue(&active_element);
+ 
+ 	basalelement-> GetInputListOnVertices(&old_active[0],HydrologydcMaskEplactiveNodeEnum);	
+-	basalelement->	GetInputListOnVertices(&epl_thickness[0],HydrologydcEplThicknessEnum);	
+-	basalelement->	GetInputListOnVertices(&sedhead[0],SedimentHeadEnum);
+-	basalelement->	GetInputListOnVertices(&eplhead[0],EplHeadEnum);
+-	basalelement->	GetInputListOnVertices(&residual[0],SedimentHeadResidualEnum);
++	basalelement-> GetInputListOnVertices(&epl_thickness[0],HydrologydcEplThicknessEnum);	
++	basalelement-> GetInputListOnVertices(&sedhead[0],SedimentHeadEnum);
++	basalelement-> GetInputListOnVertices(&eplhead[0],EplHeadEnum);
++	basalelement-> GetInputListOnVertices(&residual[0],SedimentHeadResidualEnum);
+ 
+ 	/*Get minimum sediment head of the element*/
+ 	sedheadmin=sedhead[0];
+@@ -702,7 +718,7 @@
+ 	xDelete<IssmDouble>(active);
+ }
+ 
+-void  HydrologyDCEfficientAnalysis::GetHydrologyDCInefficientHmax(IssmDouble* ph_max,Element* element, Node* innode){/*{{{*/
++void HydrologyDCEfficientAnalysis::GetHydrologyDCInefficientHmax(IssmDouble* ph_max,Element* element, Node* innode){/*{{{*/
+ 	
+ 	int        hmax_flag;
+ 	IssmDouble h_max;
+@@ -723,8 +739,8 @@
+ 		/*Compute max*/
+ 		rho_water = element->GetMaterialParameter(MaterialsRhoFreshwaterEnum);
+ 		rho_ice   = element->GetMaterialParameter(MaterialsRhoIceEnum);
+-		element->GetInputValue(&thickness,innode,ThicknessEnum);
+-		element->GetInputValue(&bed,innode,BedEnum);
++		element-> GetInputValue(&thickness,innode,ThicknessEnum);
++		element-> GetInputValue(&bed,innode,BedEnum);
+ 		h_max=((rho_ice*thickness)/rho_water)+bed;
+ 		break;
+ 	case 3:
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17374)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17375)
+@@ -194,7 +194,12 @@
+ 	basalelement ->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	basalelement ->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);
+ 
+-	Input* SedTrans_input       = basalelement->GetInput(HydrologydcSedimentTransmitivityEnum); _assert_(SedTrans_input);
++	Input* epl_thick_input   = basalelement->GetInput(HydrologydcEplThicknessEnum);
++	Input* sed_head_input    = basalelement->GetInput(SedimentHeadEnum);
++	Input* epl_head_input    = basalelement->GetInput(EplHeadEnum);
++	Input* thickness_input   = basalelement->GetInput(ThicknessEnum);
++	Input* bed_input         = basalelement->GetInput(BedEnum);
++	Input* SedTrans_input    = basalelement->GetInput(HydrologydcSedimentTransmitivityEnum); _assert_(SedTrans_input);
+ 	IssmDouble sediment_storing = SedimentStoring(basalelement);
+ 	/*Transfer related Inputs*/
+ 	if(isefficientlayer){
+@@ -232,7 +237,7 @@
+ 			if(isefficientlayer){
+ 				active_element_input->GetInputValue(&active_element);
+ 				if(active_element){
+-					transfer=GetHydrologyKMatrixTransfer(basalelement,gauss);
++					transfer=GetHydrologyKMatrixTransfer(basalelement,gauss,epl_thick_input,sed_head_input,epl_head_input,SedTrans_input,thickness_input,bed_input);
+ 					basalelement->NodalFunctions(&basis[0],gauss);
+ 					D_scalar=transfer*gauss->weight*Jdet*dt;
+ 					TripleMultiply(basis,numnodes,1,0,
+@@ -292,6 +297,12 @@
+ 	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	basalelement->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);
+ 
++	Input* epl_thick_input   = basalelement->GetInput(HydrologydcEplThicknessEnum);
++	Input* sed_head_input    = basalelement->GetInput(SedimentHeadEnum);
++	Input* epl_head_input    = basalelement->GetInput(EplHeadEnum);
++	Input* sed_trans_input   = basalelement->GetInput(HydrologydcSedimentTransmitivityEnum);
++	Input* thickness_input   = basalelement->GetInput(ThicknessEnum);
++	Input* bed_input         = basalelement->GetInput(BedEnum);
+ 	Input* water_input       = basalelement->GetInput(BasalforcingsMeltingRateEnum); _assert_(water_input);
+ 	if(dt!= 0.){old_wh_input = basalelement->GetInput(SedimentHeadOldEnum);          _assert_(old_wh_input);}
+ 
+@@ -326,7 +337,7 @@
+ 				/*Dealing with the sediment part of the transfer term*/
+ 				active_element_input->GetInputValue(&active_element);
+ 				if(active_element){
+-					transfer=GetHydrologyPVectorTransfer(basalelement,gauss);
++					transfer=GetHydrologyPVectorTransfer(basalelement,gauss,epl_thick_input,sed_head_input,epl_head_input,sed_trans_input,thickness_input,bed_input);
+ 				}
+ 				else{
+ 					transfer=0.0;
+@@ -460,7 +471,7 @@
+ 	return rho_freshwater*g*epl_porosity*(water_compressibility+(epl_compressibility/epl_porosity));		 
+ }/*}}}*/
+ 
+-IssmDouble HydrologyDCInefficientAnalysis::GetHydrologyDCInefficientHmax(Element* element, Gauss* gauss){/*{{{*/
++IssmDouble HydrologyDCInefficientAnalysis::GetHydrologyDCInefficientHmax(Element* element, Gauss* gauss, Input* thick_input, Input* bed_input){/*{{{*/
+ 	int        hmax_flag;
+ 	IssmDouble h_max;
+ 	IssmDouble rho_ice,rho_water;
+@@ -481,11 +492,12 @@
+ 		rho_water = element->GetMaterialParameter(MaterialsRhoFreshwaterEnum);
+ 		rho_ice   = element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 
++		_assert_(thick_input);
++		_assert_(bed_input);
++
+ 		/*Compute max*/
+-		/* thick_input->GetInputValue(&thickness,gauss); */
+-		/* bed_input->GetInputValue(&bed,gauss); */
+-		element->GetInputValue(&thickness,gauss,ThicknessEnum);
+-		element->GetInputValue(&bed,gauss,BedEnum);
++		thick_input->GetInputValue(&thickness,gauss);
++		bed_input->GetInputValue(&bed,gauss);
+ 		h_max=((rho_ice*thickness)/rho_water)+bed;
+ 		break;
+ 	case 3:
+@@ -531,7 +543,7 @@
+ 	*ph_max=h_max;
+ }
+ /*}}}*/
+-IssmDouble HydrologyDCInefficientAnalysis::GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss){/*{{{*/
++IssmDouble HydrologyDCInefficientAnalysis::GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss, Input* epl_thick_input, Input* sed_head_input, Input* epl_head_input, Input* sed_trans_input, Input* thickness_input, Input* bed_input){/*{{{*/
+ 
+ 	int transfermethod;
+ 	IssmDouble epl_thickness;
+@@ -551,16 +563,22 @@
+ 		transfer=0.0;
+ 		break;
+ 	case 1:
++		
++		_assert_(epl_thick_input);
++		_assert_(sed_head_input);
++		_assert_(epl_head_input);
++		_assert_(sed_trans_input);
++		_assert_(thickness_input);
++		_assert_(bed_input);
+ 
+-		element->GetInputValue(&epl_thickness,gauss,HydrologydcEplThicknessEnum);
+-		element->GetInputValue(&sed_head,gauss,SedimentHeadEnum);
+-		element->GetInputValue(&epl_head,gauss,EplHeadEnum);
+-		element->GetInputValue(&sediment_transmitivity,gauss,HydrologydcSedimentTransmitivityEnum);
+-		
++		epl_thick_input->GetInputValue(&epl_thickness,gauss);
++		sed_head_input->GetInputValue(&sed_head,gauss);
++		epl_head_input->GetInputValue(&epl_head,gauss);
++		sed_trans_input->GetInputValue(&sediment_transmitivity,gauss);
+ 		element->FindParam(&leakage,HydrologydcLeakageFactorEnum);
+ 	
+ 		if(epl_head>sed_head){
+-			h_max=GetHydrologyDCInefficientHmax(element,gauss);
++			h_max=GetHydrologyDCInefficientHmax(element,gauss,thickness_input,bed_input);
+ 			if(sed_head>=h_max){
+ 				transfer=0.0;
+ 			}
+@@ -579,7 +597,7 @@
+ 	return transfer;
+ }/*}}}*/
+ 
+-IssmDouble HydrologyDCInefficientAnalysis::GetHydrologyPVectorTransfer(Element* element, Gauss* gauss){/*{{{*/
++IssmDouble HydrologyDCInefficientAnalysis::GetHydrologyPVectorTransfer(Element* element, Gauss* gauss, Input* epl_thick_input, Input* sed_head_input, Input* epl_head_input, Input* sed_trans_input, Input* thickness_input, Input* bed_input){/*{{{*/
+ 
+ 	int transfermethod;
+ 	IssmDouble epl_thickness;
+@@ -599,15 +617,23 @@
+ 		transfer=0.0;
+ 		break;
+ 	case 1:
++		
++		_assert_(epl_thick_input);
++		_assert_(sed_head_input);
++		_assert_(epl_head_input);
++		_assert_(sed_trans_input);
++		_assert_(thickness_input);
++		_assert_(bed_input);
+ 
+-		element->GetInputValue(&epl_thickness,gauss,HydrologydcEplThicknessEnum);
+-		element->GetInputValue(&sediment_head,gauss,SedimentHeadEnum);
+-		element->GetInputValue(&epl_head,gauss,EplHeadEnum);
+-		element->GetInputValue(&sediment_transmitivity,gauss,HydrologydcSedimentTransmitivityEnum);
+-		
++		epl_thick_input->GetInputValue(&epl_thickness,gauss);
++		sed_head_input->GetInputValue(&sediment_head,gauss);
++		epl_head_input->GetInputValue(&epl_head,gauss);
++		sed_trans_input->GetInputValue(&sediment_transmitivity,gauss);
++
+ 		element->FindParam(&leakage,HydrologydcLeakageFactorEnum);
++
+ 		if(epl_head>sediment_head){
+-			h_max=GetHydrologyDCInefficientHmax(element,gauss);
++			h_max=GetHydrologyDCInefficientHmax(element,gauss,thickness_input,bed_input);
+ 			if(sediment_head>=h_max){
+ 				transfer=0.0;
+ 			}
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 17374)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 17375)
+@@ -7,7 +7,8 @@
+ 
+ /*Headers*/
+ #include "./Analysis.h"
+-class Node; 
++class Node;
++class Input;
+ class HydrologyDCEfficientAnalysis: public Analysis{
+ 
+ 	public:
+@@ -33,8 +34,8 @@
+ 		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		IssmDouble EplSpecificStoring(Element* element);
+ 		IssmDouble SedimentStoring(Element* element);
+-		IssmDouble GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss);
+-		IssmDouble GetHydrologyPVectorTransfer(Element* element, Gauss* gauss);
++		IssmDouble GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss, Input* epl_thick_input, Input* sed_head_input, Input* epl_head_input, Input* sed_trans_input, Input* residual_input);
++		IssmDouble GetHydrologyPVectorTransfer(Element* element, Gauss* gauss, Input* epl_thick_input, Input* sed_head_input, Input* epl_head_input, Input* sed_trans_input, Input* residual_input);
+ 		void HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask,Element* element);
+ 		void HydrologyEPLGetActive(Vector<IssmDouble>* active_vec, Element* element);
+ 		void GetHydrologyDCInefficientHmax(IssmDouble* ph_max,Element* element, Node* innode);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17374)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17375)
+@@ -149,11 +149,6 @@
+ 		void		   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum);
+ 		void        GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
+ 
+-		//void    GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode){_error_("not implemented yet");};
+-		//void    HydrologyEPLGetActive(Vector<IssmDouble>* active_vec){_error_("not implemented yet");};
+-		//void    HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask){_error_("not implemented yet");};
+-		//		void    ComputeEPLThickness(void){_error_("not implemented yet");};
+-		
+ 		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type){_error_("not implemented yet");};
+ 		void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum){_error_("not implemented yet");};
+ 		void        InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-17375-17376.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17375-17376.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17375-17376.diff	(revision 17802)
@@ -0,0 +1,69 @@
+Index: ../trunk-jpl/test/NightlyRun/test3300.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test3300.m	(revision 0)
++++ ../trunk-jpl/test/NightlyRun/test3300.m	(revision 17376)
+@@ -0,0 +1,52 @@
++md=triangle(model(),'../Exp/Square.exp',100000.);
++md=setmask(md,'','');
++md=parameterize(md,'../Par/SquareSheetConstrained.par');
++md=setflowequation(md,'SSA','all');
++md.cluster=generic('name',oshostname(),'np',1);
++md.hydrology=(hydrologydc);
++md.hydrology.isefficientlayer=1;
++md.hydrology.sedimentlimit_flag=1;
++md.hydrology.sedimentlimit=400.0;
++md.hydrology.sediment_thickness=20.0;
++md.initialization.sediment_head=0.0*ones(md.mesh.numberofvertices,1);
++md.hydrology.spcsediment_head=NaN*ones(md.mesh.numberofvertices,1);
++md.basalforcings.melting_rate = 2.0*ones(md.mesh.numberofvertices,1);
++md.hydrology.sediment_transmitivity=1.5e-4*ones(md.mesh.numberofvertices,1);
++
++md.initialization.epl_head=0.0*ones(md.mesh.numberofvertices,1);
++md.hydrology.spcepl_head=NaN*ones(md.mesh.numberofvertices,1);
++md.hydrology.mask_eplactive_node=0*ones(md.mesh.numberofvertices,1);
++
++md.hydrology.epl_conductivity=1.5e-2;
++md.hydrology.epl_initial_thickness=1.0;
++
++md.hydrology.transfer_flag=1;
++md.hydrology.leakage_factor=500;
++
++times=0:0.2:8.0;
++md.basalforcings.melting_rate=ones(md.mesh.numberofvertices+1,length(times));
++
++for i=1:length(times)
++	if(times(i)<1.2)
++		md.basalforcings.melting_rate(:,i)=1.0;
++	elseif(times(i)<6.0)
++		md.basalforcings.melting_rate(:,i)=-0.2;
++	else
++		md.basalforcings.melting_rate(:,i)=0.0;
++ end
++end	
++
++md.basalforcings.melting_rate(end,:)=times;
++
++
++md.timestepping.time_step=0.2;
++md.timestepping.final_time=8.0;
++
++md=solve(md,HydrologySolutionEnum());
++
++field_names     ={'SedimentWaterHead5','EplWaterHead5','SedimentWaterHead40','EplWaterHead40'};
++field_tolerances={1e-13, 1e-13, 1e-13, 1e-13, 1e-13};
++field_values={md.results.HydrologySolution(5).SedimentHead, ...
++							md.results.HydrologySolution(5).EplHead,...
++							md.results.HydrologySolution(40).SedimentHead,...
++							md.results.HydrologySolution(40).EplHead};
+Index: ../trunk-jpl/test/NightlyRun/IdToName.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/IdToName.py	(revision 17375)
++++ ../trunk-jpl/test/NightlyRun/IdToName.py	(revision 17376)
+@@ -238,6 +238,7 @@
+ 	3115 : 'SquareShelfConstrainedMasstransp2dAdolcForwardDifferenceMumps',
+ 	3119 : 'SquareShelfConstrainedTherTranAdolcReverseVsForwardMumps',
+ 	3120 : 'SquareShelfConstrainedTranAdolcReverseVsForwardMumps',
++	3300 : 'SquareSheetHydrologyDCTwoLayersVolumeControl',
+ 	}
+ 
+ 	if not id == 0:
Index: issm/oecreview/Archive/16554-17801/ISSM-17376-17377.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17376-17377.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17376-17377.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/jenkins/imac-012301-gil
+===================================================================
+--- ../trunk-jpl/jenkins/imac-012301-gil	(revision 17376)
++++ ../trunk-jpl/jenkins/imac-012301-gil	(revision 17377)
+@@ -104,6 +104,6 @@
+ #as follows: runme($MATLAB_NROPTIONS). The options must be understandable
+ #by Matlab and runme.m
+ #ex: "'id',[101 102 103]"
+-##                                                                   bamg mesh   FS                      Other
+-MATLAB_NROPTIONS="'exclude',[218 234 235 412 413 414 417 418 420 514 701 702 703 422 404 421 503 507 510 435]"
++##                                                                   bamg mesh   FS                     
++MATLAB_NROPTIONS="'exclude',[218 234 235 412 413 414 417 418 420 514 701 702 703 422 404 421 503 507 510]"
+ PYTHON_NROPTIONS=""
+Index: ../trunk-jpl/jenkins/windows
+===================================================================
+--- ../trunk-jpl/jenkins/windows	(revision 17376)
++++ ../trunk-jpl/jenkins/windows	(revision 17377)
+@@ -98,7 +98,7 @@
+ #ex: "'id',[101 102 103]"
+ 
+ #In Windows, we don't yet have MUMPS, can't do full stokes, so exclude all FS runs. Also exclude all runs with Dakota. And exclude higher order runs that have penalties.
+-MATLAB_NROPTIONS="'exclude',[104, 124, 204, 211, 215, 220, 221, 285, 290, 308, 322, 404, 421, 422, 503, 507, 510, 511, 701, 702, 703, 218, 234, 235, 412, 413, 414, 417, 418, 420, 205, 274, 331, 405, 409, 455, 612, 514 ]"
++MATLAB_NROPTIONS="'exclude',[104, 124, 204, 211, 215, 220, 221, 285, 290, 308, 322, 404, 421, 422, 503, 507, 510, 511, 701, 702, 703, 218, 234, 235, 412, 413, 414, 417, 418, 420, 205, 274, 331, 405, 409, 455, 612, 514, 435]"
+ PYTHON_NROPTIONS=""
+ 
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17377-17378.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17377-17378.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17377-17378.diff	(revision 17802)
@@ -0,0 +1,72 @@
+Index: ../trunk-jpl/externalpackages/petsc/install-3.4-pleiades2.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/petsc/install-3.4-pleiades2.sh	(revision 0)
++++ ../trunk-jpl/externalpackages/petsc/install-3.4-pleiades2.sh	(revision 17378)
+@@ -0,0 +1,61 @@
++#!/bin/bash
++
++#Some cleanup
++rm -rf install petsc-3.4.3 src
++mkdir install src
++
++#Download from ISSM server
++$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/petsc-lite-3.4.3.tar.gz' 'petsc-3.4.3.tar.gz'
++
++#Untar and move petsc to install directory
++tar -zxvf  petsc-3.4.3.tar.gz
++mv petsc-3.4.3/* src/
++rm -rf petsc-3.4.3
++
++#configure
++cd src
++./config/configure.py \
++ --prefix="$ISSM_DIR/externalpackages/petsc/install" \
++ --PETSC_ARCH="$ISSM_ARCH" \
++ --PETSC_DIR="$ISSM_DIR/externalpackages/petsc/src" \
++ --with-batch=1  \
++ --with-debugging=0 \
++ --with-shared-libraries=1 \
++ --known-mpi-shared-libraries=1 \
++ --with-mpi=1 \
++ --with-mpi-lib="/nasa/sgi/mpt/2.06rp16/lib/libmpi.so" \
++ --with-mpi-include="/nasa/sgi/mpt/2.06rp16/include" \
++ --with-blas-lapack-dir="/nasa/intel/Compiler/2013.1.117/composer_xe_2013.1.117/mkl/lib/intel64" \
++ --download-scalapack=yes \
++ --download-blacs=yes \
++ --download-mumps=yes \
++ --download-metis=yes \
++ --download-parmetis=yes \
++ --download-trilinos=yes \
++ --download-euclid=yes \
++ --download-hypre=yes \
++ --COPTFLAGS="-lmpi -O3" \
++ --FOPTFLAGS="-lmpi -O3" \
++ --CXXOPTFLAGS="-lmpi -O3"
++
++#prepare script to reconfigure petsc
++cat > script.queue << EOF
++#PBS -S /bin/bash
++#PBS -l select=1:ncpus=1:model=wes 
++#PBS -l walltime=200 
++#PBS -W group_list=s1010
++#PBS -m e 
++
++. /usr/share/modules/init/bash 
++module load comp-intel/2013.1.117
++module load mpi-sgi/mpt.2.06rp16
++
++export PATH="$PATH:." 
++export MPI_GROUP_MAX=64 
++mpiexec -np 1 ./conftest-linux-gnu-ia64-intel.py
++EOF
++
++#print instructions
++echo "== Now: cd src/ "
++echo "== qsub -q devel script.queue "
++echo "== Then run reconfigure script generated by PETSc and follow instructions"
+
+Property changes on: ../trunk-jpl/externalpackages/petsc/install-3.4-pleiades2.sh
+___________________________________________________________________
+Name: svn:executable
+   + *
+
Index: issm/oecreview/Archive/16554-17801/ISSM-17378-17379.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17378-17379.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17378-17379.diff	(revision 17802)
@@ -0,0 +1,151 @@
+Index: ../trunk-jpl/src/m/exp/expdisp.m
+===================================================================
+--- ../trunk-jpl/src/m/exp/expdisp.m	(revision 17378)
++++ ../trunk-jpl/src/m/exp/expdisp.m	(revision 17379)
+@@ -45,7 +45,7 @@
+ figure(figurenumber),hold on
+ for i=1:length(domain),		
+ 	if domain(i).nods==1
+-		plot(domain(i).x*unitmultiplier,domain(i).y*unitmultiplier,'ok','MarkerSize',10);
++		plot(domain(i).x*unitmultiplier,domain(i).y*unitmultiplier,'o','MarkerEdgeColor','k','MarkerFaceColor','r','MarkerSize',10);
+ 	else
+ 		if (isnumeric(linestyle))
+ 			plot(domain(i).x*unitmultiplier,domain(i).y*unitmultiplier,'Color',linestyle,'linewidth',linewidth);
+Index: ../trunk-jpl/src/m/contrib/paraview/exportVTK.m
+===================================================================
+--- ../trunk-jpl/src/m/contrib/paraview/exportVTK.m	(revision 17378)
++++ ../trunk-jpl/src/m/contrib/paraview/exportVTK.m	(revision 17379)
+@@ -38,19 +38,23 @@
+ 
+ %this is the result structure
+ res_struct=model.results;
+-%Getting all the solutions of the model
+-solnames=fields(res_struct);
+-num_of_sols=length(solnames);
+-num_of_timesteps=1;
+-%building solution structure 
+-for i=1:num_of_sols
+-	sol_struct{i}=res_struct.(solnames{i});
+-	%looking for multiple time steps
+-	if(size(sol_struct{i},2)>num_of_timesteps);
+-		num_of_timesteps=size(sol_struct{i},2);
++%checking for results
++if (length(fields(res_struct))>0);
++	%Getting all the solutions of the model
++	solnames=fields(res_struct);
++	num_of_sols=length(solnames);
++	num_of_timesteps=1;
++	%building solution structure 
++	for i=1:num_of_sols
++		sol_struct{i}=res_struct.(solnames{i});
++		%looking for multiple time steps
++		if(size(sol_struct{i},2)>num_of_timesteps);
++			num_of_timesteps=size(sol_struct{i},2);
+   end
++ end
++else
++	num_of_timesteps=1;
+ end
+-
+ for step=1:num_of_timesteps;
+ 	
+ 	timestep=step;
+@@ -84,36 +88,37 @@
+ 	fprintf(FID,'POINT_DATA %s \n',num2str(num_of_points));
+ 
+ 	%loop over the different solution structures
+-	for j=1:num_of_sols
+-		%dealing with results on different timesteps
+-		if(size(sol_struct{j},2)>timestep);
+-			timestep = step;
+-		else
+-			timestep = size(sol_struct{j},2);
++	if (exist('num_of_sols'));
++		for j=1:num_of_sols
++			%dealing with results on different timesteps
++			if(size(sol_struct{j},2)>timestep);
++				timestep = step;
++			else
++				timestep = size(sol_struct{j},2);
++	    end
++			
++			%getting the number of fields in the solution
++			fieldnames=fields(sol_struct{j}(timestep));
++			num_of_fields=length(fieldnames);
++			
++			%check which field is a real result and print
++			for k=1:num_of_fields
++				if ((numel(sol_struct{j}(timestep).(fieldnames{k})))== ...
++						num_of_points);
++					%paraview does not like NaN, replacing
++					nanval=find(isnan(sol_struct{j}(timestep).(fieldnames{k})));
++					sol_struct{j}(timestep).(fieldnames{k})(nanval)=-9999;
++					%also checking for verry small value that mess up
++					smallval=(abs(sol_struct{j}(timestep).(fieldnames{k}))<1.0e-20);
++					sol_struct{j}(timestep).(fieldnames{k})(smallval)=0.0;
++					fprintf(FID,'SCALARS %s float 1 \n',fieldnames{k});
++					fprintf(FID,'LOOKUP_TABLE default\n');
++					s='%e\n';
++					fprintf(FID,s,sol_struct{j}(timestep).(fieldnames{k}));
++		    end		
++	    end 
+ 	  end
+-
+-		%getting the number of fields in the solution
+-		fieldnames=fields(sol_struct{j}(timestep));
+-		num_of_fields=length(fieldnames);
+-		
+-		%check which field is a real result and print
+-			for k=1:num_of_fields
+-			if ((numel(sol_struct{j}(timestep).(fieldnames{k})))== ...
+-					num_of_points);
+-				%paraview does not like NaN, replacing
+-				nanval=find(isnan(sol_struct{j}(timestep).(fieldnames{k})));
+-				sol_struct{j}(timestep).(fieldnames{k})(nanval)=-9999;
+-				%also checking for verry small value that mess up
+-				smallval=(abs(sol_struct{j}(timestep).(fieldnames{k}))<1.0e-20);
+-				sol_struct{j}(timestep).(fieldnames{k})(smallval)=0.0;
+-				fprintf(FID,'SCALARS %s float 1 \n',fieldnames{k});
+-				fprintf(FID,'LOOKUP_TABLE default\n');
+-				s='%e\n';
+-				fprintf(FID,s,sol_struct{j}(timestep).(fieldnames{k}));
+-    	end		
+-	  end 
+-	end
+-	
++  end
+ 	%loop on arguments, if something other than result is asked, do
+ 	%it now
+ 	for j= 1:nargin-2
+Index: ../trunk-jpl/src/m/enum/DamageEvolutionRequestedOutputsEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/DamageEvolutionRequestedOutputsEnum.m	(revision 17378)
++++ ../trunk-jpl/src/m/enum/DamageEvolutionRequestedOutputsEnum.m	(revision 17379)
+@@ -1,11 +0,0 @@
+-function macro=DamageEvolutionRequestedOutputsEnum()
+-%DAMAGEEVOLUTIONREQUESTEDOUTPUTSENUM - Enum of DamageEvolutionRequestedOutputs
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=DamageEvolutionRequestedOutputsEnum()
+-
+-macro=StringToEnum('DamageEvolutionRequestedOutputs');
+Index: ../trunk-jpl/src/m/enum/DamageEvolutionNumRequestedOutputsEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/DamageEvolutionNumRequestedOutputsEnum.m	(revision 17378)
++++ ../trunk-jpl/src/m/enum/DamageEvolutionNumRequestedOutputsEnum.m	(revision 17379)
+@@ -1,11 +0,0 @@
+-function macro=DamageEvolutionNumRequestedOutputsEnum()
+-%DAMAGEEVOLUTIONNUMREQUESTEDOUTPUTSENUM - Enum of DamageEvolutionNumRequestedOutputs
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=DamageEvolutionNumRequestedOutputsEnum()
+-
+-macro=StringToEnum('DamageEvolutionNumRequestedOutputs');
Index: issm/oecreview/Archive/16554-17801/ISSM-17379-17380.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17379-17380.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17379-17380.diff	(revision 17802)
@@ -0,0 +1,32 @@
+Index: ../trunk-jpl/src/m/enum/DamageEvolutionRequestedOutputsEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/DamageEvolutionRequestedOutputsEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/DamageEvolutionRequestedOutputsEnum.m	(revision 17380)
+@@ -0,0 +1,11 @@
++function macro=DamageEvolutionRequestedOutputsEnum()
++%DAMAGEEVOLUTIONREQUESTEDOUTPUTSENUM - Enum of DamageEvolutionRequestedOutputs
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=DamageEvolutionRequestedOutputsEnum()
++
++macro=StringToEnum('DamageEvolutionRequestedOutputs');
+Index: ../trunk-jpl/src/m/enum/DamageEvolutionNumRequestedOutputsEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/DamageEvolutionNumRequestedOutputsEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/DamageEvolutionNumRequestedOutputsEnum.m	(revision 17380)
+@@ -0,0 +1,11 @@
++function macro=DamageEvolutionNumRequestedOutputsEnum()
++%DAMAGEEVOLUTIONNUMREQUESTEDOUTPUTSENUM - Enum of DamageEvolutionNumRequestedOutputs
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=DamageEvolutionNumRequestedOutputsEnum()
++
++macro=StringToEnum('DamageEvolutionNumRequestedOutputs');
Index: issm/oecreview/Archive/16554-17801/ISSM-17380-17381.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17380-17381.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17380-17381.diff	(revision 17802)
@@ -0,0 +1,41 @@
+Index: ../trunk-jpl/src/m/solve/solve.m
+===================================================================
+--- ../trunk-jpl/src/m/solve/solve.m	(revision 17380)
++++ ../trunk-jpl/src/m/solve/solve.m	(revision 17381)
+@@ -18,7 +18,8 @@
+ %		 - FlaimSolutionEnum
+ %
+ %  extra options:
+-%      - loadonly : does not solve. only load results
++%      - loadonly    : does not solve. only load results
++%      - runtimename : true or false (default is true), makes name unique
+ %
+ %   Examples:
+ %      md=solve(md,StressbalanceSolutionEnum);
+@@ -47,8 +48,12 @@
+ end
+ 
+ %First, build a runtime name that is unique
+-c=clock;
+-md.private.runtimename=sprintf('%s-%02i-%02i-%04i-%02i-%02i-%02i-%i',md.miscellaneous.name,c(2),c(3),c(1),c(4),c(5),floor(c(6)),feature('GetPid'));
++if options.runtimename,
++	c=clock;
++	md.private.runtimename=sprintf('%s-%02i-%02i-%04i-%02i-%02i-%02i-%i',md.miscellaneous.name,c(2),c(3),c(1),c(4),c(5),floor(c(6)),feature('GetPid'));
++else
++	md.private.runtimename=md.miscellaneous.name;
++end
+ 
+ %if running qmu analysis, some preprocessing of dakota files using models
+ %fields needs to be carried out. 
+Index: ../trunk-jpl/src/m/solve/process_solve_options.m
+===================================================================
+--- ../trunk-jpl/src/m/solve/process_solve_options.m	(revision 17380)
++++ ../trunk-jpl/src/m/solve/process_solve_options.m	(revision 17381)
+@@ -17,6 +17,7 @@
+ end
+ outoptions.solution_type=solution_type;
+ 
++outoptions.runtimename=getfieldvalue(options,'runtimename',true);
+ outoptions.upload=getfieldvalue(options,'upload','off');
+ outoptions.batch=getfieldvalue(options,'batch','no');
+ outoptions.loadonly=getfieldvalue(options,'loadonly',false);
Index: issm/oecreview/Archive/16554-17801/ISSM-17383-17384.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17383-17384.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17383-17384.diff	(revision 17802)
@@ -0,0 +1,100 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17383)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17384)
+@@ -131,7 +131,6 @@
+ 
+ 		case P2Enum:
+ 			EdgesPartitioning(&my_edges,iomodel);
+-			FacesPartitioning(&my_faces,iomodel);
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+ 					nodes->AddObject(new Node(id0+i+1,i,lid++,i,iomodel,analysis,approximation));
+@@ -143,19 +142,22 @@
+ 				}
+ 			}
+ 			id0 = id0+iomodel->numberofvertices+iomodel->numberofedges;
+-			for(i=0;i<iomodel->numberoffaces;i++){
+-				if(iomodel->faces[i*6+5]==2){/*Vertical quads*/
+-					if(my_faces[i]){
+-						node = new Node(id0+i+1,iomodel->numberofvertices+iomodel->numberofedges+i,lid++,0,iomodel,analysis,approximation);
+-						nodes->AddObject(node);
++	      if(iomodel->meshtype==Mesh3DEnum){
++				FacesPartitioning(&my_faces,iomodel);
++				for(i=0;i<iomodel->numberoffaces;i++){
++					if(iomodel->faces[i*6+5]==2){/*Vertical quads*/
++						if(my_faces[i]){
++							node = new Node(id0+i+1,iomodel->numberofvertices+iomodel->numberofedges+i,lid++,0,iomodel,analysis,approximation);
++							nodes->AddObject(node);
++						}
+ 					}
++					else if(iomodel->faces[i*6+5]==1){/*Triangular base/top*/
++						/*Nothing*/
++					}
++					else{
++						_error_("not supported");
++					}
+ 				}
+-				else if(iomodel->faces[i*6+5]==1){/*Triangular base/top*/
+-					/*Nothing*/
+-				}
+-				else{
+-					_error_("not supported");
+-				}
+ 			}
+ 			break;
+ 		case P2xP4Enum:
+Index: ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17383)
++++ ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17384)
+@@ -71,7 +71,9 @@
+ 			break;
+ 		case P2Enum:
+ 			EdgesPartitioning(&my_edges,iomodel);
+-			FacesPartitioning(&my_faces,iomodel);
++	      if(iomodel->meshtype==Mesh3DEnum){
++				FacesPartitioning(&my_faces,iomodel);
++			}
+ 			break;
+ 		case P2xP4Enum:
+ 			EdgesPartitioning(&my_edges,iomodel);
+@@ -114,22 +116,24 @@
+ 						}
+ 					}
+ 				}
+-				for(i=0;i<iomodel->numberoffaces;i++){
+-					if(iomodel->faces[i*6+5]==2){/*Vertical quads*/
+-						if(my_faces[i]){
+-							FaceGetVertexIndices(iomodel,&numfacevertices,&faceverticesid,i);
+-							isnan=0;
+-							for(j=0;j<numfacevertices;j++){
+-								if(xIsNan<IssmDouble>(spcdata[faceverticesid[j]])) isnan=1;
+-							}
+-							if(isnan==0){
+-								value=0;
++				if(iomodel->meshtype==Mesh3DEnum){
++					for(i=0;i<iomodel->numberoffaces;i++){
++						if(iomodel->faces[i*6+5]==2){/*Vertical quads*/
++							if(my_faces[i]){
++								FaceGetVertexIndices(iomodel,&numfacevertices,&faceverticesid,i);
++								isnan=0;
+ 								for(j=0;j<numfacevertices;j++){
+-									value=value+spcdata[faceverticesid[j]]/numfacevertices;
++									if(xIsNan<IssmDouble>(spcdata[faceverticesid[j]])) isnan=1;
+ 								}
+-								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofedges+i+1,
+-												dof,value,analysis_type));
+-								count++;
++								if(isnan==0){
++									value=0;
++									for(j=0;j<numfacevertices;j++){
++										value=value+spcdata[faceverticesid[j]]/numfacevertices;
++									}
++									constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofedges+i+1,
++													dof,value,analysis_type));
++									count++;
++								}
+ 							}
+ 						}
+ 					}
Index: issm/oecreview/Archive/16554-17801/ISSM-17384-17385.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17384-17385.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17384-17385.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/test/Archives/Archive290.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive455.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive285.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17385-17386.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17385-17386.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17385-17386.diff	(revision 17802)
@@ -0,0 +1,59 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp	(revision 17385)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp	(revision 17386)
+@@ -16,7 +16,7 @@
+ 	_assert_(iomodel->elements);
+ 
+ 	/*Check Iomodel properties*/
+-	if(iomodel->meshtype==Mesh2DhorizontalEnum){
++	if(iomodel->meshtype==Mesh2DhorizontalEnum || iomodel->meshtype==Mesh2DverticalEnum){
+ 		/*Keep going*/
+ 	}
+ 	else if(iomodel->meshtype==Mesh3DEnum){
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17385)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17386)
+@@ -295,7 +295,6 @@
+ 			_assert_(approximation==FSApproximationEnum);
+ 			/*P2 velocity*/
+ 			EdgesPartitioning(&my_edges,iomodel);
+-			FacesPartitioning(&my_faces,iomodel);
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+ 					nodes->AddObject(new Node(id0+i+1,i,lid++,i,iomodel,analysis,FSvelocityEnum));
+@@ -307,19 +306,22 @@
+ 				}
+ 			}
+ 			id0 = id0+iomodel->numberofvertices+iomodel->numberofedges;
+-			for(i=0;i<iomodel->numberoffaces;i++){
+-				if(iomodel->faces[i*6+5]==2){/*Vertical quads*/
+-					if(my_faces[i]){
+-						node = new Node(id0+i+1,iomodel->numberofvertices+iomodel->numberofedges+i,lid++,0,iomodel,analysis,FSvelocityEnum);
+-						nodes->AddObject(node);
++	      if(iomodel->meshtype==Mesh3DEnum){
++				FacesPartitioning(&my_faces,iomodel);
++				for(i=0;i<iomodel->numberoffaces;i++){
++					if(iomodel->faces[i*6+5]==2){/*Vertical quads*/
++						if(my_faces[i]){
++							node = new Node(id0+i+1,iomodel->numberofvertices+iomodel->numberofedges+i,lid++,0,iomodel,analysis,FSvelocityEnum);
++							nodes->AddObject(node);
++						}
+ 					}
++					else if(iomodel->faces[i*6+5]==1){/*Triangular base/top*/
++						/*Nothing*/
++					}
++					else{
++						_error_("not supported");
++					}
+ 				}
+-				else if(iomodel->faces[i*6+5]==1){/*Triangular base/top*/
+-					/*Nothing*/
+-				}
+-				else{
+-					_error_("not supported");
+-				}
+ 			}
+ 
+ 			/*P1 pressure*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17386-17387.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17386-17387.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17386-17387.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/test/NightlyRun/test290.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test290.m	(revision 17386)
++++ ../trunk-jpl/test/NightlyRun/test290.m	(revision 17387)
+@@ -9,7 +9,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure'};
+-field_tolerances={1e-7,1e-7,1e-6,1e-7,1e-7};
++field_tolerances={5e-5,5e-5,5e-5,5e-5,1e-7};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test290.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test290.py	(revision 17386)
++++ ../trunk-jpl/test/NightlyRun/test290.py	(revision 17387)
+@@ -19,7 +19,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Vx', 'Vy', 'Vz', 'Vel','Pressure'];
+-field_tolerances=[1e-7,1e-7,1e-6,1e-7,1e-7];
++field_tolerances=[5e-5,5e-5,5e-5,5e-5,1e-7]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Vx,\
+ 	md.results.StressbalanceSolution.Vy,\
Index: issm/oecreview/Archive/16554-17801/ISSM-17387-17388.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17387-17388.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17387-17388.diff	(revision 17802)
@@ -0,0 +1,31 @@
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp	(revision 17387)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp	(revision 17388)
+@@ -39,6 +39,8 @@
+ 			return 4*pow(x, 2)*z*pow(x - 1, 2) + 4*pow(x, 2)*z*(z - 1)*(2*z - 1) + 4*pow(x, 2)*pow(x - 1, 2)*(z - 1) + 2*pow(x, 2)*pow(x - 1, 2)*(2*z - 1) + 16*x*z*(x - 1)*(z - 1)*(2*z - 1) - 4*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) + 6*pow(z, 2)*(6*pow(x, 2) - 6*x + 1) + 4*z*pow(x - 1, 2)*(z - 1)*(2*z - 1) - 2*z*(6*pow(x, 2) - 6*x + 1) + 1;
+ 		case 8: 
+ 			return 1.0;
++		case 9:
++			return 4*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*sin(PI*p*y)*sin(PI*p*z) + 2*pow(PI, 2)*pow(p, 2)*sin(PI*p*y)*sin(PI*p*z)*cos(PI*p*x) + 2*x*z;
+ 
+ 		case 101: 
+ 			return 4*pow(x, 2)*y*z*pow(x - 1, 2)*(z - 1) + 8*pow(x, 2)*y*z*(y - 1)*(2*y - 1)*(z - 1) + 2*pow(x, 2)*y*pow(x - 1, 2)*(y - 1)*(2*y - 1) + 4*pow(x, 2)*z*pow(x - 1, 2)*(y - 1)*(z - 1) + 2*pow(x, 2)*z*pow(x - 1, 2)*(2*y - 1)*(z - 1) - 12*x*pow(y, 2)*z*(x - 1)*(y - 1)*(z - 1) - 6*x*pow(y, 2)*z*(2*x - 1)*(y - 1)*(z - 1) - 12*x*y*z*(x - 1)*pow(y - 1, 2)*(z - 1) + 32*x*y*z*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 6*x*y*z*(2*x - 1)*pow(y - 1, 2)*(z - 1) - 6*pow(y, 2)*z*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 8*y*z*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 6*y*z*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1);
+@@ -71,6 +73,8 @@
+ 			return -8*pow(x, 3) + 4*pow(x, 2)*z*(x - 1)*(z - 1) + 2*pow(x, 2)*z*(x - 1)*(2*z - 1) + 2*pow(x, 2)*(x - 1)*(z - 1)*(2*z - 1) + 12*pow(x, 2) + 4*x*z*pow(x - 1, 2)*(z - 1) + 2*x*z*pow(x - 1, 2)*(2*z - 1) + 2*x*pow(x - 1, 2)*(z - 1)*(2*z - 1) - 4*x - 6*pow(z, 4)*(2*x - 1) + 12*pow(z, 3)*(2*x - 1) - 6*pow(z, 2)*(2*x - 1) - 24*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + 24*z*(2*pow(x, 3) - 3*pow(x, 2) + x);
+ 		case 8: 
+ 			return 1.0;
++		case 9: 
++			return -2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*sin(PI*p*x)*sin(PI*p*z) - pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*z)*cos(PI*p*y) + 2*y*z;
+ 
+ 		case 101: 
+ 			return 12*pow(x, 2)*y*z*(x - 1)*(y - 1)*(z - 1) + 6*pow(x, 2)*y*z*(x - 1)*(2*y - 1)*(z - 1) + 6*pow(x, 2)*z*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 8*x*pow(y, 2)*z*(x - 1)*(2*x - 1)*(z - 1) - 4*x*pow(y, 2)*z*pow(y - 1, 2)*(z - 1) - 2*x*pow(y, 2)*(x - 1)*(2*x - 1)*pow(y - 1, 2) + 12*x*y*z*pow(x - 1, 2)*(y - 1)*(z - 1) + 6*x*y*z*pow(x - 1, 2)*(2*y - 1)*(z - 1) - 32*x*y*z*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 6*x*z*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 8*x*z*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1) - 4*pow(y, 2)*z*(x - 1)*pow(y - 1, 2)*(z - 1) - 2*pow(y, 2)*z*(2*x - 1)*pow(y - 1, 2)*(z - 1);
+@@ -94,6 +98,8 @@
+ 			return 2*PI*PI*p*p*sin(PI*p*x)*sin(PI*p*y);
+ 		case 6: 
+ 			return - 2. * PI*PI * p*p * (cos(p*PI*z)-1) * sin(p*PI*x) * sin(p*PI*y)-PI*PI * p*p *  sin(p*PI*x)    * sin(p*PI*y) * cos(p*PI*z)+ q * PI * sin(q*PI*x) * sin(q*PI*y) * cos(q*PI*z);
++		case 9:
++			return -2*pow(PI, 3)*pow(p, 3)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*sin(PI*p*y) - pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*y)*cos(PI*p*z) + pow(x, 2) + pow(y, 2);
+ 		default:
+ 			_error_("FS analytical solution"<<testid<<" not implemented yet");
+ 	}
Index: issm/oecreview/Archive/16554-17801/ISSM-17388-17389.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17388-17389.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17388-17389.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/mech/analyticaldamage.m
+===================================================================
+--- ../trunk-jpl/src/m/mech/analyticaldamage.m	(revision 17388)
++++ ../trunk-jpl/src/m/mech/analyticaldamage.m	(revision 17389)
+@@ -61,7 +61,7 @@
+ sigmab = getfieldvalue(options,'sigmab',0);
+ coordsys = getfieldvalue(options,'coordsys','longitudinal');
+ if length(sigmab)==1,
+-	sigmab=sigmab*ones(md.mesh.numberofelements,1);
++	sigmab=sigmab*ones(md.mesh.numberofvertices,1);
+ end
+ 
+ [a,b,theta,ex]=thomasparams(md,'eq',eq,'smoothing',smoothing,'coordsys',coordsys);
Index: issm/oecreview/Archive/16554-17801/ISSM-17389-17390.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17389-17390.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17389-17390.diff	(revision 17802)
@@ -0,0 +1,42 @@
+Index: ../trunk-jpl/src/m/mech/mechanicalproperties.m
+===================================================================
+--- ../trunk-jpl/src/m/mech/mechanicalproperties.m	(revision 17389)
++++ ../trunk-jpl/src/m/mech/mechanicalproperties.m	(revision 17390)
+@@ -1,9 +1,9 @@
+ function md=mechanicalproperties(md,vx,vy)
+ %MECHANICALPROPERTIES - compute stress and strain rate for a goven velocity
+ %
+-%   this routine computes the components of the stress tensor
+-%   strain rate tensor and their respective principal directions.
+-%   the results are in the model md: md.results
++%   this routine computes the components of the (deviatoric) stress tensor,
++%   the strain rate tensor, and their respective principal directions.
++%   The results are in the model md: md.results
+ %
+ %   Usage:
+ %      md=mechanicalproperties(md,vx,vy)
+@@ -106,6 +106,7 @@
+ 
+ %plug onto the model
+ %NB: Matlab sorts the eigen value in increasing order, we want the reverse
++%NOTE: all stresses below are deviatoric
+ stress=struct('xx',[],'yy',[],'xy',[],'principalvalue1',[],'principalaxis1',[],'principalvalue2',[],'principalaxis2',[],'effectivevalue',[]);
+ stress.xx=tau_xx;
+ stress.yy=tau_yy;
+@@ -114,7 +115,7 @@
+ stress.principalaxis1=directionsstress(:,1:2);
+ stress.principalvalue2=valuesstress(:,2);
+ stress.principalaxis2=directionsstress(:,3:4);
+-stress.effectivevalue=1/sqrt(2)*sqrt(stress.xx.^2+stress.yy.^2+2*stress.xy.^2);
++stress.effectivevalue=1/sqrt(2)*sqrt(stress.xx.^2+stress.yy.^2+2*stress.xy.^2); % effective shear stress
+ md.results.stress=stress;
+ 
+ strainrate=struct('xx',[],'yy',[],'xy',[],'principalvalue1',[],'principalaxis1',[],'principalvalue2',[],'principalaxis2',[],'effectivevalue',[]);
+@@ -128,6 +129,7 @@
+ strainrate.effectivevalue=1/sqrt(2)*sqrt(strainrate.xx.^2+strainrate.yy.^2+2*strainrate.xy.^2);
+ md.results.strainrate=strainrate;
+ 
++%exact same stress as above
+ deviatoricstress=struct('xx',[],'yy',[],'xy',[],'principalvalue1',[],'principalaxis1',[],'principalvalue2',[],'principalaxis2',[],'effectivevalue',[]);
+ deviatoricstress.xx=tau_xx;
+ deviatoricstress.yy=tau_yy;
Index: issm/oecreview/Archive/16554-17801/ISSM-17390-17391.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17390-17391.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17390-17391.diff	(revision 17802)
@@ -0,0 +1,442 @@
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h	(revision 17390)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h	(revision 17391)
+@@ -25,8 +25,8 @@
+ 		ElementMatrix* CreateJacobianMatrix(Element* element);
+ 		ElementMatrix* CreateKMatrix(Element* element);
+ 		ElementVector* CreatePVector(Element* element);
+-		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+-		void GetBprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBprime(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ 		void UpdateConstraints(FemModel* femmodel);
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17390)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17391)
+@@ -116,38 +116,41 @@
+ }/*}}}*/
+ ElementMatrix* DamageEvolutionAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*Intermediaries*/
+-	int      meshtype;
+-	Element* basalelement;
++	Element*    basalelement;
++	int         meshtype,dim;
++	int         stabilization;
++	IssmDouble  Jdet,dt,D_scalar,h;
++	IssmDouble  vel,vx,vy,dvxdx,dvydy,dvx[2],dvy[2];
++	IssmDouble *xyz_list  = NULL;
+ 
+-	/*Get basal element*/
++	/*Get problem dimension and basal element*/
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+ 	switch(meshtype){
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
++			dim = 2;
+ 			break;
+ 		case Mesh3DEnum:
+ 			if(!element->IsOnBed()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
++			dim = 2;
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+-	/*Intermediaries */
+-	int         stabilization;
+-	IssmDouble  Jdet,dt,D_scalar;
+-	IssmDouble  vel,vx,vy,dvxdx,dvydy,dvx[2],dvy[2];
+-	IssmDouble *xyz_list  = NULL;
+-
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = basalelement->GetNumberOfNodes();
+ 
+ 	/*Initialize Element vector*/
+-	ElementMatrix* Ke     = basalelement->NewElementMatrix(NoneApproximationEnum);
++	ElementMatrix* Ke     = basalelement->NewElementMatrix();
+ 	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+-	IssmDouble*    B      = xNew<IssmDouble>(2*numnodes);
+-	IssmDouble*    Bprime = xNew<IssmDouble>(2*numnodes);
+-	IssmDouble     D[2][2]={0.};
++	IssmDouble*    B      = xNew<IssmDouble>(dim*numnodes);
++	IssmDouble*    Bprime = xNew<IssmDouble>(dim*numnodes);
++	IssmDouble*    D      = xNewZeroInit<IssmDouble>(dim*dim);
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	basalelement->GetVerticesCoordinates(&xyz_list);
+@@ -160,10 +163,15 @@
+ 		vyaverage_input=basalelement->GetInput(VyEnum); _assert_(vyaverage_input);
+ 	}
+ 	else{
+-		vxaverage_input=basalelement->GetInput(VxAverageEnum); _assert_(vxaverage_input);
+-		vyaverage_input=basalelement->GetInput(VyAverageEnum); _assert_(vyaverage_input);
++		if(dim==1){
++			vxaverage_input=element->GetInput(VxEnum); _assert_(vxaverage_input);
++		}
++		if(dim==2){
++			vxaverage_input=element->GetInput(VxAverageEnum); _assert_(vxaverage_input);
++			vyaverage_input=element->GetInput(VyAverageEnum); _assert_(vyaverage_input);
++		}
+ 	}
+-	IssmDouble h=basalelement->CharacteristicLength();
++	h=basalelement->CharacteristicLength();
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	Gauss* gauss=basalelement->NewGauss(2);
+@@ -172,64 +180,75 @@
+ 
+ 		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
+ 		basalelement->NodalFunctions(basis,gauss);
+-		D_scalar=gauss->weight*Jdet;
+-
++		
+ 		vxaverage_input->GetInputValue(&vx,gauss);
+-		vyaverage_input->GetInputValue(&vy,gauss);
+ 		vxaverage_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
+-		vyaverage_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
++		if(dim==2){
++			vyaverage_input->GetInputValue(&vy,gauss);
++			vyaverage_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
++		}
+ 
++		D_scalar=gauss->weight*Jdet;
+ 		TripleMultiply(basis,1,numnodes,1,
+ 					&D_scalar,1,1,0,
+ 					basis,1,numnodes,0,
+ 					&Ke->values[0],1);
+ 
+-		GetB(B,element,xyz_list,gauss);
+-		GetBprime(Bprime,element,xyz_list,gauss);
++		GetB(B,basalelement,dim,xyz_list,gauss);
++		GetBprime(Bprime,basalelement,dim,xyz_list,gauss);
+ 
+ 		dvxdx=dvx[0];
+-		dvydy=dvy[1];
++		if(dim==2) dvydy=dvy[1];
+ 		D_scalar=dt*gauss->weight*Jdet;
+ 
+-		D[0][0]=D_scalar*dvxdx;
+-		D[1][1]=D_scalar*dvydy;
+-		TripleMultiply(B,2,numnodes,1,
+-					&D[0][0],2,2,0,
+-					B,2,numnodes,0,
++		D[0*dim+0]=D_scalar*dvxdx;
++		if(dim==2) D[1*dim+1]=D_scalar*dvydy;
++
++		TripleMultiply(B,dim,numnodes,1,
++					D,dim,dim,0,
++					B,dim,numnodes,0,
+ 					&Ke->values[0],1);
+ 
+-		D[0][0]=D_scalar*vx;
+-		D[1][1]=D_scalar*vy;
+-		TripleMultiply(B,2,numnodes,1,
+-					&D[0][0],2,2,0,
+-					Bprime,2,numnodes,0,
++		D[0*dim+0]=D_scalar*vx;
++		if(dim==2) D[1*dim+1]=D_scalar*vy;
++
++		TripleMultiply(B,dim,numnodes,1,
++					D,dim,dim,0,
++					Bprime,dim,numnodes,0,
+ 					&Ke->values[0],1);
+ 
+ 		if(stabilization==2){
+-			/*Streamline upwinding*/
+-			vel=sqrt(vx*vx+vy*vy)+1.e-8;
+-			D[0][0]=h/(2*vel)*vx*vx;
+-			D[1][0]=h/(2*vel)*vy*vx;
+-			D[0][1]=h/(2*vel)*vx*vy;
+-			D[1][1]=h/(2*vel)*vy*vy;
++			if(dim==1){
++				vel=fabs(vx)+1.e-8;
++				D[0]=h/(2*vel)*vx*vx;
++			}
++			else{
++				/*Streamline upwinding*/
++				vel=sqrt(vx*vx+vy*vy)+1.e-8;
++				D[0*dim+0]=h/(2*vel)*vx*vx;
++				D[1*dim+0]=h/(2*vel)*vy*vx;
++				D[0*dim+1]=h/(2*vel)*vx*vy;
++				D[1*dim+1]=h/(2*vel)*vy*vy;
++			}
+ 		}
+ 		else if(stabilization==1){
+-			/*SSA*/
+ 			vxaverage_input->GetInputAverage(&vx);
+-			vyaverage_input->GetInputAverage(&vy);
+-			D[0][0]=h/2.0*fabs(vx);
+-			D[0][1]=0.;
+-			D[1][0]=0.;
+-			D[1][1]=h/2.0*fabs(vy);
++			if(dim==2) vyaverage_input->GetInputAverage(&vy);
++			D[0*dim+0]=h/2.0*fabs(vx);
++			if(dim==2) D[1*dim+1]=h/2.0*fabs(vy);
+ 		}
+ 		if(stabilization==1 || stabilization==2){
+-			D[0][0]=D_scalar*D[0][0];
+-			D[1][0]=D_scalar*D[1][0];
+-			D[0][1]=D_scalar*D[0][1];
+-			D[1][1]=D_scalar*D[1][1];
+-			TripleMultiply(Bprime,2,numnodes,1,
+-						&D[0][0],2,2,0,
+-						Bprime,2,numnodes,0,
++			if(dim==1) D[0]=D_scalar*D[0];
++			else{
++				D[0*dim+0]=D_scalar*D[0*dim+0];
++				D[1*dim+0]=D_scalar*D[1*dim+0];
++				D[0*dim+1]=D_scalar*D[0*dim+1];
++				D[1*dim+1]=D_scalar*D[1*dim+1];
++			}
++
++			TripleMultiply(Bprime,dim,numnodes,1,
++						D,dim,dim,0,
++						Bprime,dim,numnodes,0,
+ 						&Ke->values[0],1);
+ 		}
+ 
+@@ -240,15 +259,22 @@
+ 	xDelete<IssmDouble>(basis);
+ 	xDelete<IssmDouble>(B);
+ 	xDelete<IssmDouble>(Bprime);
++	xDelete<IssmDouble>(D);
+ 	delete gauss;
+ 	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return Ke;
+ }/*}}}*/
+ ElementVector* DamageEvolutionAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*Intermediaries*/
+ 	int      meshtype;
+ 	Element* basalelement;
++	IssmDouble  Jdet,dt;
++	IssmDouble  f,damage;
++	IssmDouble* xyz_list = NULL;
+ 
+ 	/*Get basal element*/
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+@@ -263,37 +289,35 @@
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+-	/*Intermediaries */
+-	IssmDouble  Jdet,dt;
+-	IssmDouble  f,damage;
+-	IssmDouble* xyz_list = NULL;
+-
+ 	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = element->GetNumberOfNodes();
++	int numnodes = basalelement->GetNumberOfNodes();
+ 
+ 	/*Initialize Element vector and other vectors*/
+-	ElementVector* pe    = element->NewElementVector();
++	ElementVector* pe    = basalelement->NewElementVector();
+ 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	element->GetVerticesCoordinates(&xyz_list);
+-	element->FindParam(&dt,TimesteppingTimeStepEnum);
+-	this->CreateDamageFInput(element);
+-	Input* damaged_input = element->GetInput(DamageDbarEnum); _assert_(damaged_input);
+-	Input* damagef_input = element->GetInput(DamageFEnum);    _assert_(damagef_input);
++	basalelement->GetVerticesCoordinates(&xyz_list);
++	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
++	this->CreateDamageFInput(basalelement);
++	Input* damaged_input = basalelement->GetInput(DamageDEnum); _assert_(damaged_input);
++	Input* damagef_input = basalelement->GetInput(DamageFEnum); _assert_(damagef_input);
+ 
++
+ 	/* Start  looping on the number of gaussian points: */
+-	Gauss* gauss=element->NewGauss(2);
++	Gauss* gauss=basalelement->NewGauss(2);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		gauss->GaussPoint(ig);
+ 
+-		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+-		element->NodalFunctions(basis,gauss);
++		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		basalelement->NodalFunctions(basis,gauss);
+ 
+ 		damaged_input->GetInputValue(&damage,gauss);
+ 		damagef_input->GetInputValue(&f,gauss);
+ 
+-		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*(damage+dt*f)*basis[i];
++		for(int i=0;i<numnodes;i++){
++			pe->values[i]+=Jdet*gauss->weight*(damage+dt*f)*basis[i];
++		}
+ 	}
+ 
+ 	/*Clean up and return*/
+@@ -303,7 +327,7 @@
+ 	delete gauss;
+ 	return pe;
+ }/*}}}*/
+-void DamageEvolutionAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++void DamageEvolutionAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
+ 	 * For node i, Bi can be expressed in the actual coordinate system
+ 	 * by: 
+@@ -323,14 +347,15 @@
+ 
+ 	/*Build B: */
+ 	for(int i=0;i<numnodes;i++){
+-		B[numnodes*0+i] = basis[i];
+-		B[numnodes*1+i] = basis[i];
++		for(int j=0;j<dim;j++){
++			B[numnodes*j+i] = basis[i];
++		}
+ 	}
+ 
+ 	/*Clean-up*/
+ 	xDelete<IssmDouble>(basis);
+ }/*}}}*/
+-void DamageEvolutionAnalysis::GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++void DamageEvolutionAnalysis::GetBprime(IssmDouble* Bprime,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 
+ 	 * For node i, Bi' can be expressed in the actual coordinate system
+ 	 * by: 
+@@ -345,13 +370,14 @@
+ 	int numnodes = element->GetNumberOfNodes();
+ 
+ 	/*Get nodal functions derivatives*/
+-	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	IssmDouble* dbasis=xNew<IssmDouble>(dim*numnodes);
+ 	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+ 
+ 	/*Build B': */
+ 	for(int i=0;i<numnodes;i++){
+-		Bprime[numnodes*0+i] = dbasis[0*numnodes+i];
+-		Bprime[numnodes*1+i] = dbasis[1*numnodes+i];
++		for(int j=0;j<dim;j++){
++			Bprime[numnodes*j+i] = dbasis[j*numnodes+i];
++		}
+ 	}
+ 
+ 	/*Clean-up*/
+@@ -363,35 +389,46 @@
+ }/*}}}*/
+ void DamageEvolutionAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 
++	int meshtype;
+ 	IssmDouble  max_damage;
+ 	int			*doflist = NULL;
++	Element*   basalelement=NULL;
+ 
++	element->FindParam(&meshtype,MeshTypeEnum);
++	if(meshtype!=Mesh2DhorizontalEnum){
++		if(!element->IsOnBed()) return;
++		basalelement=element->SpawnBasalElement();
++	}
++	else{
++		basalelement = element;
++	}
+ 	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = element->GetNumberOfNodes();
++	int numnodes = basalelement->GetNumberOfNodes();
+ 
+ 	/*Fetch dof list and allocate solution vector*/
+-	element->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+-	IssmDouble* values    = xNew<IssmDouble>(numnodes);
++	basalelement->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
++	IssmDouble* newdamage = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Get user-supplied max_damage: */
+-	element->FindParam(&max_damage,DamageMaxDamageEnum);
++	basalelement->FindParam(&max_damage,DamageMaxDamageEnum);
+ 
+ 	/*Use the dof list to index into the solution vector: */
+ 	for(int i=0;i<numnodes;i++){
+-		values[i]=solution[doflist[i]];
++		newdamage[i]=solution[doflist[i]];
+ 		/*Check solution*/
+-		if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector");
++		if(xIsNan<IssmDouble>(newdamage[i])) _error_("NaN found in solution vector");
+ 		/*Enforce D < max_damage and D > 0 */
+-		if(values[i]>max_damage) values[i]=max_damage;
+-		else if(values[i]<0.)    values[i]=0.;
++		if(newdamage[i]>max_damage) newdamage[i]=max_damage;
++		else if(newdamage[i]<0.)    newdamage[i]=0.;
+ 	}
+ 
+ 	/*Get all inputs and parameters*/
+-	element->AddInput(DamageDbarEnum,values,P1Enum);
++	basalelement->AddBasalInput(DamageDEnum,newdamage,P1Enum);
+ 
+ 	/*Free ressources:*/
+-	xDelete<IssmDouble>(values);
++	xDelete<IssmDouble>(newdamage);
+ 	xDelete<int>(doflist);
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ }/*}}}*/
+ void DamageEvolutionAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+ 	/*Default, do nothing*/
+@@ -426,7 +463,7 @@
+ 	Input* sigma_xx_input  = element->GetInput(StressTensorxxEnum);     _assert_(sigma_xx_input);
+ 	Input* sigma_xy_input  = element->GetInput(StressTensorxyEnum);     _assert_(sigma_xy_input);
+ 	Input* sigma_yy_input  = element->GetInput(StressTensoryyEnum);     _assert_(sigma_yy_input);
+-	Input* damage_input    = element->GetInput(DamageDbarEnum); _assert_(damage_input);
++	Input* damage_input    = element->GetInput(DamageDEnum); _assert_(damage_input);
+ 
+ 	/*retrieve the desired type of equivalent stress*/
+ 	element->FindParam(&equivstress,DamageEquivStressEnum);
+@@ -445,13 +482,12 @@
+ 		s_xy=sigma_xy/(1.-damage);
+ 		s_yy=sigma_yy/(1.-damage);
+ 
+-		if(equivstress==1){ /* von Mises */
+-			J2s=1./sqrt(2.)*sqrt(s_xx*s_xx + s_yy*s_yy + s_xy*s_xy);
+-			Chi=sqrt(3.0)*J2s;
++		if(equivstress==0){ /* von Mises */
++			Chi=sqrt(s_xx*s_xx - s_xx*s_yy + s_yy*s_yy + 3*s_xy*s_xy);
+ 		}
+ 		Psi=Chi-stress_threshold;
+ 		PosPsi=max(Psi,0.);
+-		NegPsi=max(-Psi,0.);
++		NegPsi=max(-Chi,0.); /* healing only for compressive stresses */
+ 
+ 		f[iv]= c1*(pow(PosPsi,c2) - healing*pow(NegPsi,c2))*pow((1.-damage),-c3);
+ 	}
+Index: ../trunk-jpl/src/c/cores/damage_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/damage_core.cpp	(revision 17390)
++++ ../trunk-jpl/src/c/cores/damage_core.cpp	(revision 17391)
+@@ -18,7 +18,6 @@
+ 	int    numoutputs          = 0; 
+ 	char   **requested_outputs = NULL;
+ 
+-	if(VerboseSolution()) _printf0_("   computing damage\n");
+ 	
+ 	//first recover parameters common to all solutions
+ 	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
+@@ -32,6 +31,7 @@
+ 		ResetConstraintsx(femmodel);
+ 	}
+ 
++	if(VerboseSolution()) _printf0_("   computing damage\n");
+ 	femmodel->SetCurrentConfiguration(DamageEvolutionAnalysisEnum);
+ 	solutionsequence_linear(femmodel);
+ 
+Index: ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 17390)
++++ ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 17391)
+@@ -712,7 +712,7 @@
+ 	}
+ 
+ 	//First recover damage  using the element: */
+-	element->GetInputValue(&damage,node,DamageDbarEnum);
++	element->GetInputValue(&damage,node,DamageDEnum);
+ 
+ 	//Recover our data:
+ 	parameters->FindParam(&penalty_lock,DamagePenaltyLockEnum);
Index: issm/oecreview/Archive/16554-17801/ISSM-17391-17392.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17391-17392.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17391-17392.diff	(revision 17802)
@@ -0,0 +1,75 @@
+Index: ../trunk-jpl/src/m/solve/process_solve_options.py
+===================================================================
+--- ../trunk-jpl/src/m/solve/process_solve_options.py	(revision 17391)
++++ ../trunk-jpl/src/m/solve/process_solve_options.py	(revision 17392)
+@@ -21,7 +21,7 @@
+ 			SteadystateSolutionEnum(),TransientSolutionEnum(),\
+ 			BalancethicknessSolutionEnum(),BalancevelocitySolutionEnum(),\
+ 			BedSlopeSolutionEnum(),SurfaceSlopeSolutionEnum(),\
+-			HydrologySolutionEnum(),FlaimSolutionEnum(),GiaSolutionEnum()):
++			HydrologySolutionEnum(),FlaimSolutionEnum(),GiaSolutionEnum(),DamageEvolutionSolutionEnum()):
+ 		raise ValueError("process_solve_options error message: solution_type '%s' not supported yet!" % EnumToString(solution_type)[0])
+ 	outoptions['solution_type']=solution_type
+ 
+Index: ../trunk-jpl/src/m/consistency/ismodelselfconsistent.py
+===================================================================
+--- ../trunk-jpl/src/m/consistency/ismodelselfconsistent.py	(revision 17391)
++++ ../trunk-jpl/src/m/consistency/ismodelselfconsistent.py	(revision 17392)
+@@ -45,6 +45,9 @@
+ 	elif solutiontype == HydrologySolutionEnum():
+ 		analyses=[L2ProjectionBaseAnalysisEnum(),HydrologyShreveAnalysisEnum(),HydrologyDCInefficientAnalysisEnum(),HydrologyDCEfficientAnalysisEnum()]
+ 
++	elif DamageEvolutionSolutionEnum():
++		analyses=[DamageEvolutionAnalysisEnum()]
++
+ 	else:
+ 		raise TypeError("solution type: '%s' not supported yet!" % EnumToString(solutiontype)[0])
+ 
+Index: ../trunk-jpl/src/m/classes/damage.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/damage.py	(revision 17391)
++++ ../trunk-jpl/src/m/classes/damage.py	(revision 17392)
+@@ -63,6 +63,7 @@
+ 			s+="%s\n" % fielddisplay(self,"c3","damage parameter 3 ")
+ 			s+="%s\n" % fielddisplay(self,"c4","damage parameter 4 ")
+ 			s+="%s\n" % fielddisplay(self,"stress_threshold","damage stress threshold [Pa]")
++			s+="%s\n" % fielddisplay(self,"healing","damage healing parameter")
+ 			s+="%s\n" % fielddisplay(self,"equiv_stresss","0: von Mises")
+ 			s+="%s\n" % fielddisplay(self,'requested_outputs','additional outputs requested')
+ 
+@@ -138,6 +139,7 @@
+ 			md = checkfield(md,'fieldname','damage.c3','>=',0)
+ 			md = checkfield(md,'fieldname','damage.c4','>=',0)
+ 			md = checkfield(md,'fieldname','damage.stress_threshold','>=',0)
++			md = checkfield(md,'fieldname','damage.healing','>=',0)
+ 			md = checkfield(md,'fieldname','damage.equiv_stress','numel',[1],'values',[0])
+ 			md = checkfield(md,'fieldname','damage.requested_outputs','stringrow',1)
+ 		elif strcmpi(self.law,'undamaged'):
+@@ -165,6 +167,7 @@
+ 			WriteData(fid,'object',self,'fieldname','c3','format','Double')
+ 			WriteData(fid,'object',self,'fieldname','c4','format','Double')
+ 			WriteData(fid,'object',self,'fieldname','stress_threshold','format','Double')
++			WriteData(fid,'object',self,'fieldname','healing','format','Double')
+ 			WriteData(fid,'object',self,'fieldname','equiv_stress','format','Integer')
+ 			
+ 			#process requested outputs
+@@ -173,5 +176,5 @@
+ 			if len(indices) > 0:
+ 				outputscopy=outputs[0:max(0,indices[0]-1)]+self.defaultoutputs(md)+outputs[indices[0]+1:]
+ 				outputs    =outputscopy
+-			WriteData(fid,'data',outputs,'enum',StressbalanceRequestedOutputsEnum(),'format','StringArray')
++			WriteData(fid,'data',outputs,'enum',DamageEvolutionRequestedOutputsEnum(),'format','StringArray')
+ 	# }}}
+Index: ../trunk-jpl/src/m/classes/damage.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/damage.m	(revision 17391)
++++ ../trunk-jpl/src/m/classes/damage.m	(revision 17392)
+@@ -146,7 +146,7 @@
+ 				fielddisplay(obj,'c2','damage parameter 2');
+ 				fielddisplay(obj,'c3','damage parameter 3');
+ 				fielddisplay(obj,'c4','damage parameter 4');
+-				fielddisplay(obj,'healing','damage healing parameter 1');
++				fielddisplay(obj,'healing','damage healing parameter');
+ 				fielddisplay(obj,'stress_threshold','damage stress threshold [Pa]');
+ 				fielddisplay(obj,'equiv_stress','0: von Mises');
+ 				fielddisplay(obj,'requested_outputs','additional outputs requested');
Index: issm/oecreview/Archive/16554-17801/ISSM-17392-17393.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17392-17393.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17392-17393.diff	(revision 17802)
@@ -0,0 +1,126 @@
+Index: ../trunk-jpl/test/NightlyRun/test275.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test275.py	(revision 0)
++++ ../trunk-jpl/test/NightlyRun/test275.py	(revision 17393)
+@@ -0,0 +1,38 @@
++import numpy as npy
++from triangle import triangle
++from model import model
++from setmask import setmask
++from parameterize import parameterize
++from verbose import verbose
++from setflowequation import setflowequation
++from generic import generic
++from socket import gethostname as oshostname
++from solve import solve
++from EnumDefinitions import DamageEvolutionSolutionEnum
++
++md=triangle(model(),'../Exp/Square.exp',150000.)
++md=setmask(md,'all','')
++md=parameterize(md,'../Par/SquareShelf.py')
++md.damage.D=0.1*npy.ones((md.mesh.numberofvertices,1))
++md.damage.spcdamage=npy.float('nan')*npy.ones((md.mesh.numberofvertices,1))
++md.damage.law='pralong'
++
++md.damage.c1=1.e-11
++md.damage.c2=0.4
++md.damage.c3=1.e-3
++md.damage.healing=0.4
++md.damage.stress_threshold=1.e5
++md.damage.stabilization=1
++
++md.damage.requested_outputs=['default','DamageF']
++
++md=setflowequation(md,'SSA','all')
++md.cluster=generic('name',oshostname(),'np',3)
++md=solve(md,DamageEvolutionSolutionEnum())
++
++field_names=['D','F']
++field_tolerances=[1.e-13,1.e-13]
++field_values=[\
++		md.results.DamageEvolutionSolution.DamageD,\
++		md.results.DamageEvolutionSolution.DamageF,\
++		]
+Index: ../trunk-jpl/test/NightlyRun/test275.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test275.m	(revision 0)
++++ ../trunk-jpl/test/NightlyRun/test275.m	(revision 17393)
+@@ -0,0 +1,26 @@
++md=triangle(model(),'../Exp/Square.exp',150000.);
++md=setmask(md,'all','');
++md=parameterize(md,'../Par/SquareShelf.par');
++md.damage.D=0.1*ones(md.mesh.numberofvertices,1);
++md.damage.spcdamage=NaN*ones(md.mesh.numberofvertices,1);
++md.damage.law='pralong';
++
++md.damage.c1=1.e-11;
++md.damage.c2=0.4;
++md.damage.c3=1.e-3;
++md.damage.healing=0.4;
++md.damage.stress_threshold=1e5;
++md.damage.stabilization=1;
++
++md.damage.requested_outputs={'default','DamageF'}
++
++md=setflowequation(md,'SSA','all');
++md.cluster=generic('name',oshostname(),'np',3);
++md=solve(md,DamageEvolutionSolutionEnum());
++
++field_names={'D','F'}
++field_tolerances={1e-13,1e-13}
++field_values={...
++		(md.results.DamageEvolutionSolution.DamageD),...
++		(md.results.DamageEvolutionSolution.DamageF),...
++	};
+Index: ../trunk-jpl/test/NightlyRun/runme.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/runme.py	(revision 17392)
++++ ../trunk-jpl/test/NightlyRun/runme.py	(revision 17393)
+@@ -140,9 +140,10 @@
+ 			#UPDATE ARCHIVE?
+ 			archive_name='Archive'+str(id)
+ 			if strcmpi(procedure,'update'):
+-
+-				os.remove(os.path.join('..','Archives',archive_name+'.nc'))
+-				f = netCDF4.Dataset(os.path.join('..','Archives',archive_name+'.nc'),'w',format='NETCDF3_CLASSIC')
++				archive=os.path.join('..','Archives',archive_name+'.nc')
++				if os.path.isfile(archive):
++					os.remove(archive)
++				f = netCDF4.Dataset(archive,'w',format='NETCDF3_CLASSIC')
+ 				for k,fieldname in enumerate(field_names):
+ 					field=numpy.array(field_values[k],dtype=float)
+ 					if len(field.shape) == 1:
+Index: ../trunk-jpl/test/NightlyRun/IdToName.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/IdToName.m	(revision 17392)
++++ ../trunk-jpl/test/NightlyRun/IdToName.m	(revision 17393)
+@@ -70,6 +70,7 @@
+ 	case 271, name='SquareShelfStressSSA2dDamageTran';
+ 	case 272, name='SquareShelfCMZSSA2dDamage';
+ 	case 274, name='SquareShelfStressSSA2dDamageRift';
++	case 275, name='SquareShelfDamageEvolutionSSA2d';
+ 	case 280, name='SquareShelfStressSSA2dHigherOrder';
+ 	case 285, name='SquareShelfStressHOHigherOrder';
+ 	case 290, name='SquareShelfStressFSP2P1';
+Index: ../trunk-jpl/test/NightlyRun/IdToName.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/IdToName.py	(revision 17392)
++++ ../trunk-jpl/test/NightlyRun/IdToName.py	(revision 17393)
+@@ -71,6 +71,7 @@
+ 	270  : 'SquareShelfStressSSA2dDamage',
+ 	272  : 'SquareShelfCMZSSA2dDamage',
+ 	274  : 'SquareShelfStressSSA2dDamageRift',
++	275  : 'SquareShelfDamageEvolutionSSA2d',
+ 	280  : 'SquareShelfStressSSA2dHigherOrder',
+ 	285  : 'SquareShelfStressHOHigherOrder',
+ 	290  : 'SquareShelfStressFSP2P1',
+Index: ../trunk-jpl/test/Archives/Archive275.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/test/Archives/Archive275.nc
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+
Index: issm/oecreview/Archive/16554-17801/ISSM-17393-17394.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17393-17394.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17393-17394.diff	(revision 17802)
@@ -0,0 +1,173 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17393)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17394)
+@@ -6,7 +6,7 @@
+ #include "../solutionsequences/solutionsequences.h"
+ #include "../cores/cores.h"
+ 
+-//#define FSANALYTICAL 101
++//#define FSANALYTICAL 4
+ 
+ /*Model processing*/
+ int  StressbalanceAnalysis::DofsPerNode(int** pdoftype,int meshtype,int approximation){/*{{{*/
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17393)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17394)
+@@ -532,6 +532,7 @@
+ 	StressTensoryyEnum,
+ 	StressTensoryzEnum,
+ 	StressTensorzzEnum,
++	DivergenceEnum,
+ 	GiaCrossSectionShapeEnum,
+ 	GiadWdtEnum,
+ 	GiaWEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17393)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17394)
+@@ -521,6 +521,7 @@
+ 		case StressTensoryyEnum : return "StressTensoryy";
+ 		case StressTensoryzEnum : return "StressTensoryz";
+ 		case StressTensorzzEnum : return "StressTensorzz";
++		case DivergenceEnum : return "Divergence";
+ 		case GiaCrossSectionShapeEnum : return "GiaCrossSectionShape";
+ 		case GiadWdtEnum : return "GiadWdt";
+ 		case GiaWEnum : return "GiaW";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17393)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17394)
+@@ -533,6 +533,7 @@
+ 	      else if (strcmp(name,"StressTensoryy")==0) return StressTensoryyEnum;
+ 	      else if (strcmp(name,"StressTensoryz")==0) return StressTensoryzEnum;
+ 	      else if (strcmp(name,"StressTensorzz")==0) return StressTensorzzEnum;
++	      else if (strcmp(name,"Divergence")==0) return DivergenceEnum;
+ 	      else if (strcmp(name,"GiaCrossSectionShape")==0) return GiaCrossSectionShapeEnum;
+ 	      else if (strcmp(name,"GiadWdt")==0) return GiadWdtEnum;
+ 	      else if (strcmp(name,"GiaW")==0) return GiaWEnum;
+@@ -627,11 +628,11 @@
+ 	      else if (strcmp(name,"QmuInName")==0) return QmuInNameEnum;
+ 	      else if (strcmp(name,"QmuOutName")==0) return QmuOutNameEnum;
+ 	      else if (strcmp(name,"Regular")==0) return RegularEnum;
+-	      else if (strcmp(name,"Scaled")==0) return ScaledEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"Separate")==0) return SeparateEnum;
++	      if (strcmp(name,"Scaled")==0) return ScaledEnum;
++	      else if (strcmp(name,"Separate")==0) return SeparateEnum;
+ 	      else if (strcmp(name,"Sset")==0) return SsetEnum;
+ 	      else if (strcmp(name,"Verbose")==0) return VerboseEnum;
+ 	      else if (strcmp(name,"TriangleInterp")==0) return TriangleInterpEnum;
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17393)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17394)
+@@ -431,6 +431,7 @@
+ 
+ 	switch (response_descriptor_enum){
+ 
++		case DivergenceEnum:               this->Divergencex(responses); break;
+ 		case IceVolumeEnum:                this->IceVolumex(responses); break;
+ 		case IceVolumeAboveFloatationEnum: this->IceVolumeAboveFloatationx(responses); break;
+ 		case MinVelEnum:                   this->MinVelx(responses); break;
+@@ -503,6 +504,7 @@
+ 			switch(output_enum){
+ 
+ 				/*Scalar output*/
++				case DivergenceEnum:               this->Divergencex(&double_result);               break;
+ 				case IceVolumeEnum:                this->IceVolumex(&double_result);                break;
+ 				case IceVolumeAboveFloatationEnum: this->IceVolumeAboveFloatationx(&double_result); break;
+ 				case MinVelEnum:                   this->MinVelx(&double_result);                   break;
+@@ -1041,6 +1043,22 @@
+ 	*pSmb=total_smb;
+ 
+ }/*}}}*/
++void FemModel::Divergencex(IssmDouble* pdiv){/*{{{*/
++
++	IssmDouble local_divergence=0;
++	IssmDouble total_divergence;
++
++	for(int i=0;i<this->elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(this->elements->GetObjectByOffset(i));
++		local_divergence+=element->Divergence();
++	}
++	ISSM_MPI_Reduce(&local_divergence,&total_divergence,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() );
++	ISSM_MPI_Bcast(&total_divergence,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
++
++	/*Assign output pointers: */
++	*pdiv=total_divergence;
++
++}/*}}}*/
+ void FemModel::IceVolumex(IssmDouble* pV){/*{{{*/
+ 
+ 	IssmDouble local_ice_volume = 0;
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17393)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17394)
+@@ -55,6 +55,7 @@
+ 		/* bool       AnyActive(void); */
+ 		void       CoordinateSystemTransform(IssmDouble** ptransform,Node** nodes,int numnodes,int* cs_array);
+ 		void       DeleteMaterials(void);
++		IssmDouble Divergence(void);
+ 		void       FindParam(bool* pvalue,int paramenum);
+ 		void       FindParam(int* pvalue,int paramenum);
+ 		void       FindParam(IssmDouble* pvalue,int paramenum);
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17393)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17394)
+@@ -129,6 +129,38 @@
+ void Element::DeleteMaterials(void){/*{{{*/
+ 	delete this->material;
+ }/*}}}*/
++IssmDouble Element::Divergence(void){/*{{{*/
++	/*Compute element divergence*/
++
++	/*Intermediaries*/
++	IssmDouble Jdet;
++	IssmDouble divergence=0.;
++	IssmDouble dvx[3],dvy[3],dvz[3];
++	IssmDouble *xyz_list = NULL;
++
++	/*Get inputs and parameters*/
++	Input* vx_input        = this->GetInput(VxEnum); _assert_(vx_input);
++	Input* vy_input        = this->GetInput(VyEnum); _assert_(vy_input);
++	Input* vz_input        = this->GetInput(VzEnum); _assert_(vz_input);
++	this->GetVerticesCoordinates(&xyz_list);
++
++	Gauss* gauss=this->NewGaussBase(5);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++		this->JacobianDeterminant(&Jdet,xyz_list,gauss);
++
++		/*Get strain rate assuming that epsilon has been allocated*/
++		vx_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
++		vy_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
++		vz_input->GetInputDerivativeValue(&dvz[0],xyz_list,gauss);
++
++		divergence += (dvx[0]+dvy[1]+dvz[2])*gauss->weight*Jdet;
++	}
++
++	/*Clean up and return*/
++	delete gauss;
++	return divergence;
++}/*}}}*/
+ void Element::FindParam(bool* pvalue,int paramenum){/*{{{*/
+ 	this->parameters->FindParam(pvalue,paramenum);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/classes/FemModel.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.h	(revision 17393)
++++ ../trunk-jpl/src/c/classes/FemModel.h	(revision 17394)
+@@ -71,6 +71,7 @@
+ 		void MinVyx(IssmDouble* presponse);
+ 		void MinVzx(IssmDouble* presponse);
+ 		void TotalSmbx(IssmDouble* pSmb);
++		void Divergencex(IssmDouble* pdiv);
+ 		void IceVolumex(IssmDouble* pV);
+ 		void IceVolumeAboveFloatationx(IssmDouble* pV);
+ 		void ElementResponsex(IssmDouble* presponse,int response_enum);
Index: issm/oecreview/Archive/16554-17801/ISSM-17394-17395.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17394-17395.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17394-17395.diff	(revision 17802)
@@ -0,0 +1,46 @@
+Index: ../trunk-jpl/src/m/mech/mechanicalproperties.py
+===================================================================
+--- ../trunk-jpl/src/m/mech/mechanicalproperties.py	(revision 17394)
++++ ../trunk-jpl/src/m/mech/mechanicalproperties.py	(revision 17395)
+@@ -1,6 +1,7 @@
+ import numpy as npy
+ from GetNodalFunctionsCoeff import GetNodalFunctionsCoeff
+ from results import results
++from averaging import averaging
+ 
+ def mechanicalproperties(md,vx,vy):
+ 	"""
+@@ -27,9 +28,15 @@
+ 
+ 	if npy.any(md.flowequation.element_equation!=2):
+ 		print 'Warning: the model has some non SSA elements. These will be treated like SSA elements'
++
++	if npy.ndim(vx)==2:
++		vx=vx.reshape(-1,)
++	if npy.ndim(vy)==2:
++		vy=vy.reshape(-1,)
+ 	
+ 	#initialization
+ 	numberofelements=md.mesh.numberofelements
++	numberofvertices=md.mesh.numberofvertices
+ 	index=md.mesh.elements
+ 	summation=npy.array([[1],[1],[1]])
+ 	directionsstress=npy.zeros((numberofelements,4))
+@@ -53,7 +60,7 @@
+ 	#compute viscosity
+ 	nu=npy.zeros((numberofelements,))
+ 	B_bar=npy.dot(md.materials.rheology_B[index-1],summation/3.).reshape(-1,)
+-	power=(md.materials.rheology_n-1.)/(2.*md.materials.rheology_n)
++	power=((md.materials.rheology_n-1.)/(2.*md.materials.rheology_n)).reshape(-1,)
+ 	second_inv=(ux**2.+vy**2.+((uy+vx)**2.)/4.+ux*vy).reshape(-1,)
+ 	
+ 	#some corrections
+@@ -65,6 +72,8 @@
+ 		nu[location]=B_bar[location]/(second_inv[location]**power[location])
+ 		location=npy.nonzero(npy.logical_and(second_inv==0,power==0))
+ 		nu[location]=B_bar[location]
++		location=npy.nonzero(npy.logical_and(second_inv==0,power!=0))
++		nu[location]=10^18
+ 	elif 'matdamageice' in md.materials.__module__:
+ 		Zinv=npy.dot(md.materials.rheology_Z[index-1],summation/3.).reshape(-1,)
+ 		location=npy.nonzero(second_inv)
Index: issm/oecreview/Archive/16554-17801/ISSM-17395-17396.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17395-17396.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17395-17396.diff	(revision 17802)
@@ -0,0 +1,83 @@
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17395)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17396)
+@@ -440,7 +440,7 @@
+ 
+ 	/*Intermediaries */
+ 	IssmDouble c1,c2,c3,healing,stress_threshold;
+-	IssmDouble s_xx,s_xy,s_yy;
++	IssmDouble s_xx,s_xy,s_yy,s1,s2,stmp;
+ 	IssmDouble J2s,Chi,Psi,PosPsi,NegPsi;
+ 	IssmDouble damage,sigma_xx,sigma_xy,sigma_yy;
+ 	int equivstress;
+@@ -477,14 +477,23 @@
+ 		sigma_xx_input->GetInputValue(&sigma_xx,gauss);
+ 		sigma_xy_input->GetInputValue(&sigma_xy,gauss);
+ 		sigma_yy_input->GetInputValue(&sigma_yy,gauss);
+-
++	
++		/*Calculate effective stress components*/
+ 		s_xx=sigma_xx/(1.-damage);
+ 		s_xy=sigma_xy/(1.-damage);
+ 		s_yy=sigma_yy/(1.-damage);
+ 
++		/*Calculate principal effective stresses*/
++		s1=(s_xx+s_yy)/2.+sqrt(pow((s_xx-s_yy)/2.,2)+pow(s_xy,2));
++		s2=(s_xx+s_yy)/2.-sqrt(pow((s_xx-s_yy)/2.,2)+pow(s_xy,2));
++		if(fabs(s2)>fabs(s1)){stmp=s2; s2=s1; s1=stmp;}
++
+ 		if(equivstress==0){ /* von Mises */
+-			Chi=sqrt(s_xx*s_xx - s_xx*s_yy + s_yy*s_yy + 3*s_xy*s_xy);
++			Chi=sqrt(s1*s1-s1*s2+s2*s2);
+ 		}
++		else if(equivstress==1){ /* max principal stress */
++			Chi=s1;
++		}
+ 		Psi=Chi-stress_threshold;
+ 		PosPsi=max(Psi,0.);
+ 		NegPsi=max(-Chi,0.); /* healing only for compressive stresses */
+Index: ../trunk-jpl/src/m/classes/damage.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/damage.py	(revision 17395)
++++ ../trunk-jpl/src/m/classes/damage.py	(revision 17396)
+@@ -64,7 +64,7 @@
+ 			s+="%s\n" % fielddisplay(self,"c4","damage parameter 4 ")
+ 			s+="%s\n" % fielddisplay(self,"stress_threshold","damage stress threshold [Pa]")
+ 			s+="%s\n" % fielddisplay(self,"healing","damage healing parameter")
+-			s+="%s\n" % fielddisplay(self,"equiv_stresss","0: von Mises")
++			s+="%s\n" % fielddisplay(self,"equiv_stress","0: von Mises, 1: max principal")
+ 			s+="%s\n" % fielddisplay(self,'requested_outputs','additional outputs requested')
+ 
+ 		return s
+@@ -140,7 +140,7 @@
+ 			md = checkfield(md,'fieldname','damage.c4','>=',0)
+ 			md = checkfield(md,'fieldname','damage.stress_threshold','>=',0)
+ 			md = checkfield(md,'fieldname','damage.healing','>=',0)
+-			md = checkfield(md,'fieldname','damage.equiv_stress','numel',[1],'values',[0])
++			md = checkfield(md,'fieldname','damage.equiv_stress','numel',[1],'values',[0,1])
+ 			md = checkfield(md,'fieldname','damage.requested_outputs','stringrow',1)
+ 		elif strcmpi(self.law,'undamaged'):
+ 			if (solution==DamageEvolutionSolutionEnum):
+Index: ../trunk-jpl/src/m/classes/damage.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/damage.m	(revision 17395)
++++ ../trunk-jpl/src/m/classes/damage.m	(revision 17396)
+@@ -103,7 +103,7 @@
+ 				md = checkfield(md,'fieldname','damage.c3','>=',0);
+ 				md = checkfield(md,'fieldname','damage.c4','>=',0);
+ 				md = checkfield(md,'fieldname','damage.stress_threshold','>=',0);
+-				md = checkfield(md,'fieldname','damage.equiv_stress','numel',[1],'values',[0]);
++				md = checkfield(md,'fieldname','damage.equiv_stress','numel',[1],'values',[0 1]);
+ 				md = checkfield(md,'fieldname','damage.requested_outputs','stringrow',1);
+ 			elseif strcmpi(obj.law,'undamaged'),
+ 				if (solution==DamageEvolutionSolutionEnum),
+@@ -148,7 +148,7 @@
+ 				fielddisplay(obj,'c4','damage parameter 4');
+ 				fielddisplay(obj,'healing','damage healing parameter');
+ 				fielddisplay(obj,'stress_threshold','damage stress threshold [Pa]');
+-				fielddisplay(obj,'equiv_stress','0: von Mises');
++				fielddisplay(obj,'equiv_stress','0: von Mises, 1: max principal');
+ 				fielddisplay(obj,'requested_outputs','additional outputs requested');
+ 			end
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17396-17397.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17396-17397.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17396-17397.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp	(revision 17396)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp	(revision 17397)
+@@ -292,7 +292,7 @@
+ 			}
+ 			if(counter==3) break;
+ 		}
+-		if(!counter==3) _error_("face not found in element");
++		if(counter!=3) _error_("face not found in element");
+ 
+ 		for(j=0;j<3;j++) facevertices[i]=iomodel->elements[elementid*6+elementfaces[cols*faceid+j]];
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17397-17398.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17397-17398.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17397-17398.diff	(revision 17802)
@@ -0,0 +1,1190 @@
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17397)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17398)
+@@ -414,8 +414,6 @@
+ 	ParamEnum,
+ 	PengridEnum,
+ 	PenpairEnum,
+-	PentaEnum,
+-	PentaInputEnum,
+ 	ProfilerEnum,
+ 	MatrixParamEnum,
+ 	NodeSIdEnum,
+@@ -433,6 +431,10 @@
+ 	SegInputEnum,
+ 	TriaEnum,
+ 	TriaInputEnum,
++	TetraEnum,
++	TetraInputEnum,
++	PentaEnum,
++	PentaInputEnum,
+ 	VertexEnum,
+ 	VertexPIdEnum,
+ 	VertexSIdEnum,
+@@ -615,6 +617,7 @@
+ 	/*Gauss{{{*/
+ 	GaussSegEnum,
+ 	GaussTriaEnum,
++	GaussTetraEnum,
+ 	GaussPentaEnum,
+ 	/*}}}*/
+ 	/*Solver{{{*/
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17397)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17398)
+@@ -409,8 +409,6 @@
+ 		case ParamEnum : return "Param";
+ 		case PengridEnum : return "Pengrid";
+ 		case PenpairEnum : return "Penpair";
+-		case PentaEnum : return "Penta";
+-		case PentaInputEnum : return "PentaInput";
+ 		case ProfilerEnum : return "Profiler";
+ 		case MatrixParamEnum : return "MatrixParam";
+ 		case NodeSIdEnum : return "NodeSId";
+@@ -428,6 +426,10 @@
+ 		case SegInputEnum : return "SegInput";
+ 		case TriaEnum : return "Tria";
+ 		case TriaInputEnum : return "TriaInput";
++		case TetraEnum : return "Tetra";
++		case TetraInputEnum : return "TetraInput";
++		case PentaEnum : return "Penta";
++		case PentaInputEnum : return "PentaInput";
+ 		case VertexEnum : return "Vertex";
+ 		case VertexPIdEnum : return "VertexPId";
+ 		case VertexSIdEnum : return "VertexSId";
+@@ -590,6 +592,7 @@
+ 		case QmuMaskGroundediceLevelsetEnum : return "QmuMaskGroundediceLevelset";
+ 		case GaussSegEnum : return "GaussSeg";
+ 		case GaussTriaEnum : return "GaussTria";
++		case GaussTetraEnum : return "GaussTetra";
+ 		case GaussPentaEnum : return "GaussPenta";
+ 		case FSSolverEnum : return "FSSolver";
+ 		case AdjointEnum : return "Adjoint";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17397)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17398)
+@@ -418,8 +418,6 @@
+ 	      else if (strcmp(name,"Param")==0) return ParamEnum;
+ 	      else if (strcmp(name,"Pengrid")==0) return PengridEnum;
+ 	      else if (strcmp(name,"Penpair")==0) return PenpairEnum;
+-	      else if (strcmp(name,"Penta")==0) return PentaEnum;
+-	      else if (strcmp(name,"PentaInput")==0) return PentaInputEnum;
+ 	      else if (strcmp(name,"Profiler")==0) return ProfilerEnum;
+ 	      else if (strcmp(name,"MatrixParam")==0) return MatrixParamEnum;
+ 	      else if (strcmp(name,"NodeSId")==0) return NodeSIdEnum;
+@@ -437,6 +435,10 @@
+ 	      else if (strcmp(name,"SegInput")==0) return SegInputEnum;
+ 	      else if (strcmp(name,"Tria")==0) return TriaEnum;
+ 	      else if (strcmp(name,"TriaInput")==0) return TriaInputEnum;
++	      else if (strcmp(name,"Tetra")==0) return TetraEnum;
++	      else if (strcmp(name,"TetraInput")==0) return TetraInputEnum;
++	      else if (strcmp(name,"Penta")==0) return PentaEnum;
++	      else if (strcmp(name,"PentaInput")==0) return PentaInputEnum;
+ 	      else if (strcmp(name,"Vertex")==0) return VertexEnum;
+ 	      else if (strcmp(name,"VertexPId")==0) return VertexPIdEnum;
+ 	      else if (strcmp(name,"VertexSId")==0) return VertexSIdEnum;
+@@ -503,12 +505,12 @@
+ 	      else if (strcmp(name,"VzSSA")==0) return VzSSAEnum;
+ 	      else if (strcmp(name,"VzHO")==0) return VzHOEnum;
+ 	      else if (strcmp(name,"VzPicard")==0) return VzPicardEnum;
+-	      else if (strcmp(name,"VzFS")==0) return VzFSEnum;
+-	      else if (strcmp(name,"VxMesh")==0) return VxMeshEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"VyMesh")==0) return VyMeshEnum;
++	      if (strcmp(name,"VzFS")==0) return VzFSEnum;
++	      else if (strcmp(name,"VxMesh")==0) return VxMeshEnum;
++	      else if (strcmp(name,"VyMesh")==0) return VyMeshEnum;
+ 	      else if (strcmp(name,"VzMesh")==0) return VzMeshEnum;
+ 	      else if (strcmp(name,"Enthalpy")==0) return EnthalpyEnum;
+ 	      else if (strcmp(name,"EnthalpyPicard")==0) return EnthalpyPicardEnum;
+@@ -602,6 +604,7 @@
+ 	      else if (strcmp(name,"QmuMaskGroundediceLevelset")==0) return QmuMaskGroundediceLevelsetEnum;
+ 	      else if (strcmp(name,"GaussSeg")==0) return GaussSegEnum;
+ 	      else if (strcmp(name,"GaussTria")==0) return GaussTriaEnum;
++	      else if (strcmp(name,"GaussTetra")==0) return GaussTetraEnum;
+ 	      else if (strcmp(name,"GaussPenta")==0) return GaussPentaEnum;
+ 	      else if (strcmp(name,"FSSolver")==0) return FSSolverEnum;
+ 	      else if (strcmp(name,"Adjoint")==0) return AdjointEnum;
+@@ -625,13 +628,13 @@
+ 	      else if (strcmp(name,"ToolkitsOptionsAnalyses")==0) return ToolkitsOptionsAnalysesEnum;
+ 	      else if (strcmp(name,"ToolkitsOptionsStrings")==0) return ToolkitsOptionsStringsEnum;
+ 	      else if (strcmp(name,"QmuErrName")==0) return QmuErrNameEnum;
+-	      else if (strcmp(name,"QmuInName")==0) return QmuInNameEnum;
+-	      else if (strcmp(name,"QmuOutName")==0) return QmuOutNameEnum;
+-	      else if (strcmp(name,"Regular")==0) return RegularEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"Scaled")==0) return ScaledEnum;
++	      if (strcmp(name,"QmuInName")==0) return QmuInNameEnum;
++	      else if (strcmp(name,"QmuOutName")==0) return QmuOutNameEnum;
++	      else if (strcmp(name,"Regular")==0) return RegularEnum;
++	      else if (strcmp(name,"Scaled")==0) return ScaledEnum;
+ 	      else if (strcmp(name,"Separate")==0) return SeparateEnum;
+ 	      else if (strcmp(name,"Sset")==0) return SsetEnum;
+ 	      else if (strcmp(name,"Verbose")==0) return VerboseEnum;
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17397)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17398)
+@@ -29,6 +29,10 @@
+ 					./classes/gauss/GaussSeg.cpp\
+ 					./classes/gauss/GaussTria.h\
+ 					./classes/gauss/GaussTria.cpp\
++					./classes/gauss/GaussTetra.h\
++					./classes/gauss/GaussTetra.cpp\
++					./classes/gauss/GaussPenta.h\
++					./classes/gauss/GaussPenta.cpp\
+ 					./classes/Update.h\
+ 					./classes/FemModel.h\
+ 					./classes/FemModel.cpp\
+@@ -80,6 +84,14 @@
+ 					./classes/Elements/Tria.cpp\
+ 					./classes/Elements/TriaRef.h\
+ 					./classes/Elements/TriaRef.cpp\
++					./classes/Elements/Tetra.h\
++					./classes/Elements/Tetra.cpp\
++					./classes/Elements/TetraRef.h\
++					./classes/Elements/TetraRef.cpp\
++					./classes/Elements/Penta.h\
++					./classes/Elements/Penta.cpp\
++					./classes/Elements/PentaRef.h\
++					./classes/Elements/PentaRef.cpp\
+ 					./classes/Inputs/Inputs.h\
+ 					./classes/Inputs/Inputs.cpp\
+ 					./classes/Inputs/Input.h\
+@@ -430,14 +442,8 @@
+ 					./modules/ModelProcessorx/CreateOutputDefinitions.cpp\
+ 					./modules/OutputDefinitionsResponsex/OutputDefinitionsResponsex.h\
+ 					./modules/OutputDefinitionsResponsex/OutputDefinitionsResponsex.cpp\
+-					./classes/gauss/GaussPenta.h\
+-					./classes/gauss/GaussPenta.cpp\
+ 					./classes/Inputs/PentaInput.h\
+ 					./classes/Inputs/PentaInput.cpp\
+-					./classes/Elements/Penta.h\
+-					./classes/Elements/Penta.cpp\
+-					./classes/Elements/PentaRef.h\
+-					./classes/Elements/PentaRef.cpp\
+ 					#}}}
+ #DAKOTA sources  {{{
+ if DAKOTA
+Index: ../trunk-jpl/src/c/classes/classes.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/classes.h	(revision 17397)
++++ ../trunk-jpl/src/c/classes/classes.h	(revision 17398)
+@@ -44,6 +44,8 @@
+ #include "./Elements/SegRef.h"
+ #include "./Elements/Tria.h"
+ #include "./Elements/TriaRef.h"
++#include "./Elements/Tetra.h"
++#include "./Elements/TetraRef.h"
+ #include "./Elements/ElementHook.h"
+ 
+ /*Option parsing objects: */
+Index: ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp	(revision 0)
++++ ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp	(revision 17398)
+@@ -0,0 +1,250 @@
++/*!\file TetraRef.c
++ * \brief: implementation of the TetraRef object
++ */
++
++/*Headers:*/
++/*{{{*/
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#else
++#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
++#endif
++
++#include "../classes.h"
++#include "../../shared/shared.h"
++/*}}}*/
++
++/*Element macros*/
++#define NUMNODESP0  1
++#define NUMNODESP1  4
++
++/*Object constructors and destructor*/
++/*FUNCTION TetraRef::TetraRef(){{{*/
++TetraRef::TetraRef(){
++	this->element_type_list=NULL;
++}
++/*}}}*/
++/*FUNCTION TetraRef::TetraRef(int* types,int nummodels){{{*/
++TetraRef::TetraRef(const int nummodels){
++
++	/*Only allocate pointer*/
++	element_type_list=xNew<int>(nummodels);
++
++}
++/*}}}*/
++/*FUNCTION TetraRef::~TetraRef(){{{*/
++TetraRef::~TetraRef(){
++	xDelete<int>(element_type_list);
++}
++/*}}}*/
++
++/*Management*/
++/*FUNCTION TetraRef::SetElementType{{{*/
++void TetraRef::SetElementType(int type,int type_counter){
++
++	/*initialize element type*/
++	this->element_type_list[type_counter]=type;
++}
++/*}}}*/
++
++/*Reference Element numerics*/
++/*FUNCTION TetraRef::GetNodalFunctions(IssmDouble* basis,GaussTetra* gauss){{{*/
++void TetraRef::GetNodalFunctions(IssmDouble* basis,GaussTetra* gauss){
++	/*This routine returns the values of the nodal functions  at the gaussian point.*/
++	_assert_(basis);
++	GetNodalFunctions(basis,gauss,this->element_type);
++}
++/*}}}*/
++/*FUNCTION TetraRef::GetNodalFunctions(IssmDouble* basis,GaussTetra* gauss,int finiteelement){{{*/
++void TetraRef::GetNodalFunctions(IssmDouble* basis,GaussTetra* gauss,int finiteelement){
++	/*This routine returns the values of the nodal functions  at the gaussian point.*/
++
++	_assert_(basis);
++
++	switch(element_type){
++		default:
++			_error_("Element type "<<EnumToStringx(element_type)<<" not supported yet");
++	}
++}
++/*}}}*/
++/*FUNCTION TetraRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss){{{*/
++void TetraRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss){
++	GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss,this->element_type);
++}
++/*}}}*/
++/*FUNCTION TetraRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss,int finiteelement){{{*/
++void TetraRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss,int finiteelement){
++
++	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
++	 * actual coordinate system): */
++	IssmDouble    Jinv[3][3];
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = this->NumberofNodes(finiteelement);
++
++	/*Get nodal functions derivatives in reference triangle*/
++	IssmDouble* dbasis_ref=xNew<IssmDouble>(3*numnodes);
++	GetNodalFunctionsDerivativesReference(dbasis_ref,gauss,finiteelement); 
++
++	/*Get Jacobian invert: */
++	GetJacobianInvert(&Jinv[0][0], xyz_list, gauss);
++
++	/*Build dbasis: 
++	 *
++	 * [dhi/dx]= Jinv'*[dhi/dr]
++	 * [dhi/dy]        [dhi/ds]
++	 * [dhi/dz]        [dhi/dzeta]
++	 */
++
++	for(int i=0;i<numnodes;i++){
++		dbasis[numnodes*0+i]=Jinv[0][0]*dbasis_ref[0*numnodes+i]+Jinv[0][1]*dbasis_ref[1*numnodes+i]+Jinv[0][2]*dbasis_ref[2*numnodes+i];
++		dbasis[numnodes*1+i]=Jinv[1][0]*dbasis_ref[0*numnodes+i]+Jinv[1][1]*dbasis_ref[1*numnodes+i]+Jinv[1][2]*dbasis_ref[2*numnodes+i];
++		dbasis[numnodes*2+i]=Jinv[2][0]*dbasis_ref[0*numnodes+i]+Jinv[2][1]*dbasis_ref[1*numnodes+i]+Jinv[2][2]*dbasis_ref[2*numnodes+i];
++	}
++
++	/*Clean up*/
++	xDelete<IssmDouble>(dbasis_ref);
++
++}
++/*}}}*/
++/*FUNCTION TetraRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTetra* gauss){{{*/
++void TetraRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTetra* gauss){
++	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
++	 * natural coordinate system) at the gaussian point. */
++
++	GetNodalFunctionsDerivativesReference(dbasis,gauss,this->element_type);
++
++}
++/*}}}*/
++/*FUNCTION TetraRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTetra* gauss,int finiteelement){{{*/
++void TetraRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTetra* gauss,int finiteelement){
++	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
++	 * natural coordinate system) at the gaussian point. */
++
++	_assert_(dbasis && gauss);
++
++	switch(finiteelement){
++		default:
++			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
++	}
++
++}
++/*}}}*/
++/*FUNCTION TetraRef::GetInputDerivativeValue{{{*/
++void TetraRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, GaussTetra* gauss){
++	/*From node values of parameter p (p_list[0], p_list[1], p_list[2],
++	 * p_list[3], p_list[4] and p_list[4]), return parameter derivative value at
++	 * gaussian point specified by gauss_coord:
++	 *   dp/dx=p_list[0]*dh1/dx+p_list[1]*dh2/dx+p_list[2]*dh3/dx+p_list[3]*dh4/dx+p_list[4]*dh5/dx+p_list[5]*dh6/dx;
++	 *   dp/dy=p_list[0]*dh1/dy+p_list[1]*dh2/dy+p_list[2]*dh3/dy+p_list[3]*dh4/dy+p_list[4]*dh5/dy+p_list[5]*dh6/dy;
++	 *   dp/dz=p_list[0]*dh1/dz+p_list[1]*dh2/dz+p_list[2]*dh3/dz+p_list[3]*dh4/dz+p_list[4]*dh5/dz+p_list[5]*dh6/dz;
++	 *
++	 *   p is a vector of size 3x1 already allocated.
++	 */
++
++	/*Output*/
++	IssmDouble dpx=0.;
++	IssmDouble dpy=0.;
++	IssmDouble dpz=0.;
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = this->NumberofNodes();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* dbasis=xNew<IssmDouble>(3*numnodes);
++	GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Calculate parameter for this Gauss point*/
++	for(int i=0;i<numnodes;i++) dpx += dbasis[0*numnodes+i]*plist[i];
++	for(int i=0;i<numnodes;i++) dpy += dbasis[1*numnodes+i]*plist[i];
++	for(int i=0;i<numnodes;i++) dpz += dbasis[2*numnodes+i]*plist[i];
++
++	/*Assign values*/
++	xDelete<IssmDouble>(dbasis);
++	p[0]=dpx;
++	p[1]=dpy;
++	p[2]=dpz;
++}
++/*}}}*/
++/*FUNCTION TetraRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTetra* gauss){{{*/
++void TetraRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTetra* gauss){
++
++	GetInputValue(p,plist,gauss,this->element_type);
++}
++/*}}}*/
++/*FUNCTION TetraRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTetra* gauss,int finiteelement){{{*/
++void TetraRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTetra* gauss,int finiteelement){
++
++	/*Output*/
++	IssmDouble value =0.;
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = this->NumberofNodes(finiteelement);
++
++	/*Get nodal functions*/
++	IssmDouble* basis=xNew<IssmDouble>(numnodes);
++	GetNodalFunctions(basis, gauss,finiteelement);
++
++	/*Calculate parameter for this Gauss point*/
++	for(int i=0;i<numnodes;i++) value += basis[i]*plist[i];
++
++	/*Assign output pointer*/
++	xDelete<IssmDouble>(basis);
++	*p = value;
++}
++/*}}}*/
++/*FUNCTION TetraRef::GetJacobian{{{*/
++void TetraRef::GetJacobian(IssmDouble* J, IssmDouble* xyz_list,GaussTetra* gauss){
++	/*The Jacobian is constant over the element, discard the gaussian points. 
++	 * J is assumed to have been allocated of size 1*/
++
++	_error_("Not implemented yet");
++}
++/*}}}*/
++/*FUNCTION TetraRef::GetJacobianDeterminant{{{*/
++void TetraRef::GetJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,GaussTetra* gauss){
++	/*The Jacobian determinant is constant over the element, discard the gaussian points. 
++	 * J is assumed to have been allocated of size NDOF2xNDOF2.*/
++	IssmDouble J[3][3];
++
++	/*Call Jacobian routine to get the jacobian:*/
++	GetJacobian(&J[0][0],xyz_list, gauss);
++
++	/*Get Determinant*/
++	Matrix3x3Determinant(Jdet,&J[0][0]);
++	if(*Jdet<0) _error_("negative jacobian determinant!");
++
++}
++/*}}}*/
++/*FUNCTION TetraRef::GetJacobianInvert {{{*/
++void TetraRef::GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,GaussTetra* gauss){
++
++	/*Jacobian*/
++	IssmDouble J[3][3];
++
++	/*Call Jacobian routine to get the jacobian:*/
++	GetJacobian(&J[0][0], xyz_list, gauss);
++
++	/*Invert Jacobian matrix: */
++	Matrix3x3Invert(Jinv,&J[0][0]);
++}
++/*}}}*/
++/*FUNCTION TetraRef::NumberofNodes(){{{*/
++int TetraRef::NumberofNodes(void){
++
++	return this->NumberofNodes(this->element_type);
++}
++/*}}}*/
++/*FUNCTION TetraRef::NumberofNodes(int finiteelement){{{*/
++int TetraRef::NumberofNodes(int finiteelement){
++
++	switch(finiteelement){
++		case P0Enum:                return NUMNODESP0;
++		case P1Enum:                return NUMNODESP1;
++		case P1DGEnum:              return NUMNODESP1;
++		default: _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
++	}
++
++	return -1;
++}
++/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 0)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17398)
+@@ -0,0 +1,215 @@
++/*!\file Tetra.cpp
++ * \brief: implementation of the Tetrament object
++ */
++/*Headers:*/
++/*{{{*/
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#else
++#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
++#endif
++
++#include <stdio.h>
++#include <string.h>
++#include "../classes.h"
++#include "../../shared/shared.h"
++/*}}}*/
++
++/*Element macros*/
++#define NUMVERTICES 4
++
++/*Constructors/destructor/copy*/
++/*FUNCTION Tetra::Tetra(int id, int sid,int index, IoModel* iomodel,int nummodels){{{*/
++Tetra::Tetra(int seg_id, int seg_sid, int index, IoModel* iomodel,int nummodels)
++		:TetraRef(nummodels),ElementHook(nummodels,index+1,2,iomodel){
++
++			/*id: */
++			this->id  = seg_id;
++			this->sid = seg_sid;
++
++			//this->parameters: we still can't point to it, it may not even exist. Configure will handle this.
++			this->parameters = NULL;
++
++			/*intialize inputs: */
++			this->inputs  = new Inputs();
++
++			/*initialize pointers:*/
++			this->nodes    = NULL;
++			this->vertices = NULL;
++			this->material = NULL;
++			this->matpar   = NULL;
++		}
++/*}}}*/
++/*FUNCTION Tetra::~Tetra(){{{*/
++Tetra::~Tetra(){
++	this->parameters=NULL;
++}
++/*}}}*/
++/*FUNCTION Tetra::copy {{{*/
++Object* Tetra::copy() {
++	_error_("not implemented yet");
++}
++/*}}}*/
++
++/*FUNCTION Tetra::Echo{{{*/
++void Tetra::Echo(void){
++	_printf_("Tetra:\n");
++	_printf_("   id: " << id << "\n");
++	if(nodes){
++		nodes[0]->Echo();
++		nodes[1]->Echo();
++		nodes[2]->Echo();
++		nodes[3]->Echo();
++	}
++	else _printf_("nodes = NULL\n");
++
++	if (material) material->Echo();
++	else _printf_("material = NULL\n");
++
++	if (matpar) matpar->Echo();
++	else _printf_("matpar = NULL\n");
++
++	_printf_("   parameters\n");
++	if (parameters) parameters->Echo();
++	else _printf_("parameters = NULL\n");
++
++	_printf_("   inputs\n");
++	if (inputs) inputs->Echo();
++	else _printf_("inputs=NULL\n");
++}
++/*}}}*/
++/*FUNCTION Tetra::FiniteElement{{{*/
++int Tetra::FiniteElement(void){
++	return this->element_type;
++}
++/*}}}*/
++/*FUNCTION Tetra::DeepEcho{{{*/
++void Tetra::DeepEcho(void){
++
++	_printf_("Tetra:\n");
++	_printf_("   id: " << id << "\n");
++	if(nodes){
++		nodes[0]->DeepEcho();
++		nodes[1]->DeepEcho();
++		nodes[2]->DeepEcho();
++		nodes[3]->DeepEcho();
++	}
++	else _printf_("nodes = NULL\n");
++
++	if (material) material->DeepEcho();
++	else _printf_("material = NULL\n");
++
++	if (matpar) matpar->DeepEcho();
++	else _printf_("matpar = NULL\n");
++
++	_printf_("   parameters\n");
++	if (parameters) parameters->DeepEcho();
++	else _printf_("parameters = NULL\n");
++
++	_printf_("   inputs\n");
++	if (inputs) inputs->DeepEcho();
++	else _printf_("inputs=NULL\n");
++
++	return;
++}
++/*}}}*/
++/*FUNCTION Tetra::ObjectEnum{{{*/
++int Tetra::ObjectEnum(void){
++
++	return TetraEnum;
++
++}
++/*}}}*/
++/*FUNCTION Tetra::Id {{{*/
++int Tetra::Id(){
++	return id;
++}
++/*}}}*/
++
++/*FUNCTION Tetra::GetNumberOfNodes;{{{*/
++int Tetra::GetNumberOfNodes(void){
++	return this->NumberofNodes();
++}
++/*}}}*/
++/*FUNCTION Tetra::GetNumberOfVertices;{{{*/
++int Tetra::GetNumberOfVertices(void){
++	return NUMVERTICES;
++}
++/*}}}*/
++/*FUNCTION Tetra::GetVerticesCoordinates(IssmDouble** pxyz_list)   THIS ONE{{{*/
++void Tetra::GetVerticesCoordinates(IssmDouble** pxyz_list){
++
++	IssmDouble* xyz_list = xNew<IssmDouble>(NUMVERTICES*3);
++	::GetVerticesCoordinates(xyz_list,this->vertices,NUMVERTICES);
++
++	/*Assign output pointer*/
++	*pxyz_list = xyz_list;
++
++}/*}}}*/
++/*FUNCTION Tetra::IsIceInElement {{{*/
++bool   Tetra::IsIceInElement(){
++
++	_error_("not implemented yet");
++}
++/*}}}*/
++bool Tetra::IsIcefront(void){/*{{{*/
++
++	_error_("not implemented yet");
++}/*}}}*/
++/*FUNCTION Tetra::JacobianDeterminant{{{*/
++void Tetra::JacobianDeterminant(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussTetraEnum);
++	this->GetJacobianDeterminant(pJdet,xyz_list,(GaussTetra*)gauss);
++
++}
++/*}}}*/
++/*FUNCTION Tetra::JacobianDeterminantSurface{{{*/
++void Tetra::JacobianDeterminantSurface(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){
++
++	_error_("not implemented yet");
++
++}
++/*}}}*/
++/*FUNCTION Tetra::NewGauss(){{{*/
++Gauss* Tetra::NewGauss(void){
++	return new GaussTetra();
++}
++/*}}}*/
++/*FUNCTION Tetra::NewGauss(int order){{{*/
++Gauss* Tetra::NewGauss(int order){
++	return new GaussTetra(order);
++}
++/*}}}*/
++/*FUNCTION Tetra::NewElementVector THIS ONE{{{*/
++ElementVector* Tetra::NewElementVector(int approximation_enum){
++	return new ElementVector(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
++}
++/*}}}*/
++/*FUNCTION Tetra::NewElementMatrix  THIS ONE{{{*/
++ElementMatrix* Tetra::NewElementMatrix(int approximation_enum){
++	return new ElementMatrix(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
++}
++/*}}}*/
++/*FUNCTION Tetra::NodalFunctions{{{*/
++void Tetra::NodalFunctions(IssmDouble* basis, Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussTetraEnum);
++	this->GetNodalFunctions(basis,(GaussTetra*)gauss);
++
++}
++/*}}}*/
++/*FUNCTION Tetra::NodalFunctionsDerivatives{{{*/
++void Tetra::NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussTetraEnum);
++	this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussTetra*)gauss);
++
++}
++/*}}}*/
++/*FUNCTION Tetra::NormalSection{{{*/
++void Tetra::NormalSection(IssmDouble* normal,IssmDouble* xyz_list_front){
++
++	_error_("Not implemented yet");
++}
++/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/TetraRef.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TetraRef.h	(revision 0)
++++ ../trunk-jpl/src/c/classes/Elements/TetraRef.h	(revision 17398)
+@@ -0,0 +1,41 @@
++
++/*!\file:  TetraRef.h
++ * \brief abstract class for handling Tetra oriented routines, like nodal functions, 
++ * strain rate generation, etc ...
++ */ 
++
++#ifndef _TETRAREF_H_
++#define _TETRAREF_H_
++
++class GaussTetra;
++
++class TetraRef{
++
++	public: 
++		int* element_type_list;
++		int  element_type;
++
++		TetraRef();
++		TetraRef(const int nummodels);
++		~TetraRef();
++
++		/*Management*/
++		void SetElementType(int type,int type_counter);
++		void GetBprimeMasstransport(IssmDouble* Bprime, IssmDouble* xyz_list, GaussTetra* gauss);
++		void GetJacobian(IssmDouble* J, IssmDouble* xyz_list,GaussTetra* gauss);
++		void GetJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,GaussTetra* gauss);
++		void GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,GaussTetra* gauss);
++		void GetNodalFunctions(IssmDouble* basis,GaussTetra* gauss);
++		void GetNodalFunctions(IssmDouble* basis,GaussTetra* gauss,int finiteelement);
++		void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss);
++		void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss,int finiteelement);
++		void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTetra* gauss);
++		void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTetra* gauss,int finiteelement);
++		void GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, GaussTetra* gauss);
++		void GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTetra* gauss);
++		void GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTetra* gauss,int finiteelement);
++
++		int  NumberofNodes(void);
++		int  NumberofNodes(int finiteelement);
++};
++#endif
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 0)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17398)
+@@ -0,0 +1,234 @@
++/*! \file Tetra.h 
++ *  \brief: header file for seg object
++ */
++
++#ifndef _TETRA_H_
++#define _TETRA_H_
++
++/*Headers:*/
++/*{{{*/
++#include "./Element.h"
++#include "./ElementHook.h"
++#include "./TetraRef.h"
++class Parameters;
++class Inputs;
++class IoModel;
++class Results;
++class Node;
++class Material;
++class Matpar;
++class ElementMatrix;
++class ElementVector;
++class Vertex;
++
++#include "../../shared/Exceptions/exceptions.h"
++#include "../../shared/Enum/Enum.h"
++/*}}}*/
++
++class Tetra: public Element,public ElementHook,public TetraRef{
++
++	public:
++
++		int id;
++		int sid;
++
++		/*Tetra constructors, destructors {{{*/
++		Tetra(){};
++		Tetra(int seg_id,int seg_sid,int i, IoModel* iomodel,int nummodels);
++		~Tetra();
++		/*}}}*/
++		/*Object virtual functions definitions:{{{ */
++		void    Echo();
++		void    DeepEcho();
++		int     Id();
++		int     ObjectEnum();
++		Object *copy();
++		/*}}}*/
++		/*Update virtual functions resolution: {{{*/
++		void  InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solution,int inputenum){_error_("not implemented yet");};
++		void  InputUpdateFromSolutionOneDof(IssmDouble* solution,int inputenum){_error_("not implemented yet");};
++		void  InputUpdateFromVector(IssmDouble* vector, int name, int type){_error_("not implemented yet");};
++#ifdef _HAVE_DAKOTA_
++		void  InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){_error_("not implemented yet");};
++		void  InputUpdateFromMatrixDakota(IssmDouble* matrix, int nows, int ncols, int name, int type){_error_("not implemented yet");};
++#endif
++		void  InputUpdateFromConstant(IssmDouble constant, int name){_error_("not implemented yet");};
++		void  InputUpdateFromConstant(int constant, int name){_error_("not implemented yet");};
++		void  InputUpdateFromConstant(bool constant, int name){_error_("not implemented yet");};
++		void  InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented yet");};
++		/*}}}*/
++		/*Element virtual functions definitions: {{{*/
++		void        AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
++		void        AddInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
++		IssmDouble  CharacteristicLength(void){_error_("not implemented yet");};
++		void        ComputeBasalStress(Vector<IssmDouble>* sigma_b){_error_("not implemented yet");};
++		void        ComputeStrainRate(Vector<IssmDouble>* eps){_error_("not implemented yet");};
++		void        ComputeStressTensor(){_error_("not implemented yet");};
++		void        Configure(Elements* elements,Loads* loads,Nodes* nodesin,Vertices* verticesin,Materials* materials,Parameters* parameters){_error_("not implemented yet");};
++		void        SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters){_error_("not implemented yet");};
++		void        SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum){_error_("not implemented yet");};
++		void        Delta18oParameterization(void){_error_("not implemented yet");};
++		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){_error_("not implemented yet");};
++		void        ThermalToEnthalpy(IssmDouble* penthalpy,IssmDouble temperature,IssmDouble waterfraction,IssmDouble pressure){_error_("not implemented yet");};
++		void        EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented yet");};
++		IssmDouble  EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented");};
++		IssmDouble  EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure){_error_("not implemented");};
++		int         FiniteElement(void);
++		Element*    GetUpperElement(void){_error_("not implemented yet");};
++	  	Element*    GetLowerElement(void){_error_("not implemented yet");};
++	  	Element*    GetSurfaceElement(void){_error_("not implemented yet");};
++		Element*    GetBasalElement(void){_error_("not implemented yet");};
++		int         GetNodeIndex(Node* node){_error_("not implemented yet");};
++		void        GetNodesSidList(int* sidlist){_error_("not implemented yet");};
++		void        GetNodesLidList(int* lidlist){_error_("not implemented yet");};
++		int         GetNumberOfNodes(void);
++		int         GetNumberOfNodesVelocity(void){_error_("not implemented yet");};
++		int         GetNumberOfNodesPressure(void){_error_("not implemented yet");};
++		int         GetNumberOfVertices(void);
++		void        GetVerticesCoordinates(IssmDouble** pxyz_list);
++		void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list){_error_("not implemented yet");};
++		void        GetVerticesCoordinatesTop(IssmDouble** pxyz_list){_error_("not implemented yet");};
++		int         Sid(){_error_("not implemented yet");};
++		void        InputChangeName(int input_enum, int enum_type_old){_error_("not implemented yet");};
++		bool        IsOnBed(){_error_("not implemented yet");};
++		bool        IsOnSurface(){_error_("not implemented yet");};
++		bool        IsNodeOnShelfFromFlags(IssmDouble* flags){_error_("not implemented yet");};
++		void        JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss);
++		void        JacobianDeterminantLine(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
++		void        JacobianDeterminantSurface(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss);
++		void        JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
++		void        JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
++		IssmDouble  MinEdgeLength(IssmDouble* xyz_list){_error_("not implemented yet");};
++		void        NodalFunctions(IssmDouble* basis,Gauss* gauss);
++		void        NodalFunctionsP1(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
++		void        NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
++		void        NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
++		void        NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
++		void        NodalFunctionsP1Derivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
++		void        NodalFunctionsMINIDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
++		void        NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
++		bool        IsIceInElement();
++		void        NormalSection(IssmDouble* normal,IssmDouble* xyz_list);
++		void        NormalTop(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
++		void        NormalBase(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
++		int         NumberofNodesVelocity(void){_error_("not implemented yet");};
++		int         NumberofNodesPressure(void){_error_("not implemented yet");};
++	   Element*    SpawnBasalElement(void){_error_("not implemented yet");};
++		Element*    SpawnTopElement(void){_error_("not implemented yet");};
++		IssmDouble  StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa){_error_("not implemented yet");};
++		IssmDouble  PureIceEnthalpy(IssmDouble pressure){_error_("not implemented yet");};
++		int         PressureInterpolation(void){_error_("not implemented yet");};
++		void        ValueP1OnGauss(IssmDouble* pvalue,IssmDouble* values,Gauss* gauss){_error_("not implemented yet");};
++		void        ValueP1DerivativesOnGauss(IssmDouble* dvalue,IssmDouble* values,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
++		int         VelocityInterpolation(void){_error_("not implemented yet");};
++		void        GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating){_error_("not implemented yet");};
++		IssmDouble  GetGroundedPortion(IssmDouble* xyz_list){_error_("not implemented yet");};
++		void        GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");};
++		Node*       GetNode(int node_number){_error_("Not implemented");};
++		IssmDouble  GetXcoord(Gauss* gauss){_error_("Not implemented");};
++		IssmDouble  GetYcoord(Gauss* gauss){_error_("Not implemented");};
++		IssmDouble  GetZcoord(Gauss* gauss){_error_("not implemented yet");};
++		int         GetElementType(void){_error_("not implemented yet");};
++		Gauss*      NewGauss(void);
++		Gauss*      NewGauss(int order);
++      Gauss*      NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){_error_("not implemented yet");};
++      Gauss*      NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){_error_("not implemented yet");};
++      Gauss*      NewGauss(int point1,IssmDouble fraction1,IssmDouble fraction2,bool mainlyfloating,int order){_error_("not implemented yet");};
++		Gauss*      NewGaussBase(int order){_error_("not implemented yet");};
++		Gauss*      NewGaussLine(int vertex1,int vertex2,int order){_error_("not implemented yet");};
++		Gauss*      NewGaussTop(int order){_error_("not implemented yet");};
++		ElementVector* NewElementVector(int approximation_enum);
++		ElementMatrix* NewElementMatrix(int approximation_enum);
++		ElementMatrix* NewElementMatrixCoupling(int number_nodes,int approximation_enum){_error_("not implemented yet");};
++		int         VertexConnectivity(int vertexindex){_error_("not implemented yet");};
++		void        VerticalSegmentIndices(int** pindices,int* pnumseg){_error_("not implemented yet");};
++		void        ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
++		bool        IsZeroLevelset(int levelset_enum){_error_("not implemented");};
++		bool		   IsIcefront(void);
++		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented");};
++		void		   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented yet");};
++		void        GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
++
++		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type){_error_("not implemented yet");};
++		void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum){_error_("not implemented yet");};
++		void        InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){_error_("not implemented yet");};
++		void        InputDepthAverageAtBase(int enum_type,int average_enum_type){_error_("not implemented yet");};
++		void        InputDuplicate(int original_enum,int new_enum){_error_("not implemented yet");};
++		void        InputScale(int enum_type,IssmDouble scale_factor){_error_("not implemented yet");};
++		void        MaterialUpdateFromTemperature(void){_error_("not implemented yet");};
++		int         NodalValue(IssmDouble* pvalue, int index, int natureofdataenum){_error_("not implemented yet");};
++		void        PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm){_error_("not implemented yet");};
++		void        ResetFSBasalBoundaryCondition(void){_error_("not implemented yet");};
++		void        ReduceMatrices(ElementMatrix* Ke,ElementVector* pe){_error_("not implemented yet");};
++		void        SetTemporaryElementType(int element_type_in){_error_("not implemented yet");};
++		void	      SmbGradients(){_error_("not implemented yet");};
++		IssmDouble  SurfaceArea(void){_error_("not implemented yet");};
++		void        Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement){_error_("not implemented yet");};
++		IssmDouble  TimeAdapt(){_error_("not implemented yet");};
++		void UpdateConstraintsExtrudeFromBase(){_error_("not implemented");};
++		void UpdateConstraintsExtrudeFromTop(){_error_("not implemented");};
++
++		void       AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part){_error_("not implemented yet");};
++		IssmDouble IceVolume(void){_error_("not implemented yet");};
++		IssmDouble IceVolumeAboveFloatation(void){_error_("not implemented yet");};
++		IssmDouble TotalSmb(void){_error_("not implemented yet");};
++		void       MinVel(IssmDouble* pminvel){_error_("not implemented yet");};
++		void       MinVx(IssmDouble* pminvx){_error_("not implemented yet");};
++		void       MinVy(IssmDouble* pminvy){_error_("not implemented yet");};
++		void       MinVz(IssmDouble* pminvz){_error_("not implemented yet");};
++		IssmDouble MassFlux(IssmDouble* segment){_error_("not implemented yet");};
++		IssmDouble MassFlux(IssmDouble x1,IssmDouble y1, IssmDouble x2, IssmDouble y2,int segment_id){_error_("not implemented yet");}
++		void       MaxAbsVx(IssmDouble* pmaxabsvx){_error_("not implemented yet");};
++		void       MaxAbsVy(IssmDouble* pmaxabsvy){_error_("not implemented yet");};
++		void       MaxAbsVz(IssmDouble* pmaxabsvz){_error_("not implemented yet");};
++		void       ElementResponse(IssmDouble* presponse,int response_enum){_error_("not implemented yet");};
++		void       MaxVel(IssmDouble* pmaxvel){_error_("not implemented yet");};
++		void       MaxVx(IssmDouble* pmaxvx){_error_("not implemented yet");};
++		void       MaxVy(IssmDouble* pmaxvy){_error_("not implemented yet");};
++		void       MaxVz(IssmDouble* pmaxvz){_error_("not implemented yet");};
++		IssmDouble Misfit(int modelenum,int observationenum,int weightsenum){_error_("not implemented yet");};
++		IssmDouble MisfitArea(int weightsenum){_error_("not implemented yet");};
++
++#ifdef _HAVE_GIA_
++		void   GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x,IssmDouble* y){_error_("not implemented yet");};
++#endif
++
++		IssmDouble DragCoefficientAbsGradient(void){_error_("not implemented yet");};
++		void       GradientIndexing(int* indexing,int control_index){_error_("not implemented yet");};
++		void       Gradj(Vector<IssmDouble>* gradient,int control_type,int control_index){_error_("not implemented yet");};
++		void       GradjBGradient(Vector<IssmDouble>* gradient,int control_index){_error_("not implemented yet");};
++		void       GradjDGradient(Vector<IssmDouble>* gradient,int control_index){_error_("not implemented yet");};
++		void       GradjBSSA(Vector<IssmDouble>* gradient,int control_index){_error_("not implemented yet");};
++		void       GradjDSSA(Vector<IssmDouble>* gradient,int control_index){_error_("not implemented yet");};
++		void       GradjDragSSA(Vector<IssmDouble>* gradient,int control_index){_error_("not implemented yet");};
++		void       GradjDragFS(Vector<IssmDouble>* gradient,int control_index){_error_("not implemented yet");};
++		void       GradjDragGradient(Vector<IssmDouble>* gradient,int control_index){_error_("not implemented yet");};
++		void       GradjDhDtBalancedthickness(Vector<IssmDouble>* gradient,int control_index){_error_("not implemented yet");};
++		void       GradjVxBalancedthickness(Vector<IssmDouble>* gradient,int control_index){_error_("not implemented yet");};
++		void       GradjVyBalancedthickness(Vector<IssmDouble>* gradient,int control_index){_error_("not implemented yet");};
++		void       GradjThicknessBalancethicknessSoft(Vector<IssmDouble>* gradient,int control_index){_error_("not implemented yet");};
++		void       GetVectorFromControlInputs(Vector<IssmDouble>* gradient,int control_enum,int control_index,const char* data){_error_("not implemented yet");};
++		void       SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index){_error_("not implemented yet");};
++		void       ControlInputGetGradient(Vector<IssmDouble>* gradient,int enum_type,int control_index){_error_("not implemented yet");};
++		void       ControlInputScaleGradient(int enum_type,IssmDouble scale){_error_("not implemented yet");};
++		void       ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index){_error_("not implemented yet");};
++		void       ControlToVectors(Vector<IssmPDouble>* vector_control, Vector<IssmPDouble>* vector_gradient,int control_enum){_error_("not implemented yet");};
++		IssmDouble RheologyBbarAbsGradient(void){_error_("not implemented yet");};
++		IssmDouble ThicknessAbsMisfit(void){_error_("not implemented yet");};
++		IssmDouble SurfaceAbsVelMisfit(void){_error_("not implemented yet");};
++		IssmDouble ThicknessAbsGradient(void){_error_("not implemented yet");};
++		IssmDouble ThicknessAlongGradient(void){_error_("not implemented yet");};
++		IssmDouble ThicknessAcrossGradient(void){_error_("not implemented yet");};
++		IssmDouble BalancethicknessMisfit(void){_error_("not implemented yet");};
++		IssmDouble SurfaceRelVelMisfit(void){_error_("not implemented yet");};
++		IssmDouble SurfaceLogVelMisfit(void){_error_("not implemented yet");};
++		IssmDouble SurfaceLogVxVyMisfit(void){_error_("not implemented yet");};
++		IssmDouble SurfaceAverageVelMisfit(void){_error_("not implemented yet");};
++		void       InputControlUpdate(IssmDouble scalar,bool save_parameter){_error_("not implemented yet");};
++
++		void   PotentialUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding){_error_("not implemented yet");};
++		void   MigrateGroundingLine(IssmDouble* sheet_ungrounding){_error_("not implemented yet");};
++		int    UpdatePotentialUngrounding(IssmDouble* vertices_potentially_ungrounding,Vector<IssmDouble>* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf){_error_("not implemented yet");};
++		/*}}}*/
++};
++#endif  /* _SEG_H */
+Index: ../trunk-jpl/src/c/classes/gauss/gaussobjects.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/gaussobjects.h	(revision 17397)
++++ ../trunk-jpl/src/c/classes/gauss/gaussobjects.h	(revision 17398)
+@@ -8,6 +8,7 @@
+ #include "./Gauss.h"
+ #include "./GaussSeg.h"
+ #include "./GaussTria.h"
++#include "./GaussTetra.h"
+ #include "./GaussPenta.h"
+ 
+ #endif
+Index: ../trunk-jpl/src/c/classes/gauss/GaussTetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussTetra.cpp	(revision 0)
++++ ../trunk-jpl/src/c/classes/gauss/GaussTetra.cpp	(revision 17398)
+@@ -0,0 +1,175 @@
++/*!\file GaussTetra.c
++ * \brief: implementation of the GaussTetra object
++ */
++
++#include "./GaussTetra.h"
++#include "../../shared/io/Print/Print.h"
++#include "../../shared/Exceptions/exceptions.h"
++#include "../../shared/MemOps/MemOps.h"
++#include "../../shared/Enum/Enum.h"
++#include "../../shared/Numerics/GaussPoints.h"
++#include "../../shared/Numerics/constants.h"
++
++/*GaussTetra constructors and destructors:*/
++/*FUNCTION GaussTetra::GaussTetra() {{{*/
++GaussTetra::GaussTetra(){
++
++	numgauss=-1;
++
++	weights=NULL;
++	coords1=NULL;
++	coords2=NULL;
++	coords3=NULL;
++	coords4=NULL;
++
++	weight=UNDEF;
++	coord1=UNDEF;
++	coord2=UNDEF;
++	coord3=UNDEF;
++	coord4=UNDEF;
++}
++/*}}}*/
++/*FUNCTION GaussTetra::GaussTetra(int order) {{{*/
++GaussTetra::GaussTetra(int order){
++	_error_("not implemented yet");
++}
++/*}}}*/
++/*FUNCTION GaussTetra::~GaussTetra(){{{*/
++GaussTetra::~GaussTetra(){
++	xDelete<IssmDouble>(weights);
++	xDelete<IssmDouble>(coords1);
++	xDelete<IssmDouble>(coords2);
++	xDelete<IssmDouble>(coords3);
++	xDelete<IssmDouble>(coords4);
++}
++/*}}}*/
++
++/*Methods*/
++/*FUNCTION GaussTetra::Echo{{{*/
++void GaussTetra::Echo(void){
++
++	_printf_("GaussTetra:\n");
++	_printf_("   numgauss: " << numgauss << "\n");
++
++	if (weights){
++	 _printf_("   weights = ["); 
++	 for(int i=0;i<numgauss;i++) _printf_(" " << weights[i] << "\n");
++	 _printf_("]\n");
++	}
++	else _printf_("weights = NULL\n");
++	if (coords1){
++	 _printf_("   coords1 = ["); 
++	 for(int i=0;i<numgauss;i++) _printf_(" " << coords1[i] << "\n");
++	 _printf_("]\n");
++	}
++	else _printf_("coords1 = NULL\n");
++	if (coords2){
++	 _printf_("   coords2 = ["); 
++	 for(int i=0;i<numgauss;i++) _printf_(" " << coords2[i] << "\n");
++	 _printf_("]\n");
++	}
++	else _printf_("coords2 = NULL\n");
++	if (coords3){
++	 _printf_("   coords3 = ["); 
++	 for(int i=0;i<numgauss;i++) _printf_(" " << coords3[i] << "\n");
++	 _printf_("]\n");
++	}
++	else _printf_("coords3 = NULL\n");
++	if (coords4){
++		_printf_("   coords4 = ["); 
++		for(int i=0;i<numgauss;i++) _printf_(" " << coords4[i] << "\n");
++		_printf_("]\n");
++	}
++	else _printf_("coords4 = NULL\n");
++
++	_printf_("   weight = " << weight << "\n");
++	_printf_("   coord1 = " << coord1 << "\n");
++	_printf_("   coord2 = " << coord2 << "\n");
++	_printf_("   coord3 = " << coord3 << "\n");
++	_printf_("   coord4 = " << coord4 << "\n");
++
++}
++/*}}}*/
++/*FUNCTION GaussTetra::Enum{{{*/
++int GaussTetra::Enum(void){
++	return GaussTetraEnum;
++}
++/*}}}*/
++/*FUNCTION GaussTetra::GaussPoint{{{*/
++void GaussTetra::GaussPoint(int ig){
++
++	/*Check input in debugging mode*/
++	 _assert_(ig>=0 && ig< numgauss);
++
++	 /*update static arrays*/
++	 weight=weights[ig];
++	 coord1=coords1[ig];
++	 coord2=coords2[ig];
++	 coord3=coords3[ig];
++	 coord4=coords4[ig];
++
++}
++/*}}}*/
++/*FUNCTION GaussTetra::GaussVertex{{{*/
++void GaussTetra::GaussVertex(int iv){
++
++	/*in debugging mode: check that the default constructor has been called*/
++	_assert_(numgauss==-1);
++
++	/*update static arrays*/
++	switch(iv){
++		default: _error_("vertex index should be in [0 5]");
++
++	}
++
++}
++/*}}}*/
++/*FUNCTION GaussTetra::GaussNode{{{*/
++void GaussTetra::GaussNode(int finiteelement,int iv){
++
++	/*in debugging mode: check that the default constructor has been called*/
++	_assert_(numgauss==-1);
++
++	/*update static arrays*/
++	switch(finiteelement){
++		default: _error_("Finite element "<<EnumToStringx(finiteelement)<<" not supported");
++	}
++
++}
++/*}}}*/
++/*FUNCTION GaussTetra::begin{{{*/
++int GaussTetra::begin(void){
++
++	/*Check that this has been initialized*/
++	_assert_(numgauss>0);
++	_assert_(weights);
++	_assert_(coords1);
++	_assert_(coords2);
++	_assert_(coords3);
++	_assert_(coords4);
++
++	/*return first gauss index*/
++	return 0;
++}
++/*}}}*/
++/*FUNCTION GaussTetra::end{{{*/
++int GaussTetra::end(void){
++
++	/*Check that this has been initialized*/
++	_assert_(numgauss>0);
++	_assert_(weights);
++	_assert_(coords1);
++	_assert_(coords2);
++	_assert_(coords3);
++	_assert_(coords4);
++
++	/*return last gauss index +1*/
++	return numgauss;
++}
++/*}}}*/
++/*FUNCTION GaussTetra::SynchronizeGaussBase{{{*/
++void GaussTetra::SynchronizeGaussBase(Gauss* gauss){
++
++	_error_("not supported");
++}
++/*}}}*/
+Index: ../trunk-jpl/src/c/classes/gauss/GaussTetra.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussTetra.h	(revision 0)
++++ ../trunk-jpl/src/c/classes/gauss/GaussTetra.h	(revision 17398)
+@@ -0,0 +1,45 @@
++/*!\file GaussTetra.h
++ * \brief: header file for node object
++ */
++
++#ifndef _GAUSSTETRA_H_
++#define _GAUSSTETRA_H_
++
++/*Headers:*/
++#include "../../shared/Numerics/types.h"
++#include "./Gauss.h"
++
++class GaussTetra: public Gauss{
++
++	private:
++		int numgauss;
++		IssmDouble* weights;
++		IssmDouble* coords1;
++		IssmDouble* coords2;
++		IssmDouble* coords3;
++		IssmDouble* coords4;
++
++	public:
++		IssmDouble coord1;
++		IssmDouble coord2;
++		IssmDouble coord3;
++		IssmDouble coord4;
++
++	public:
++
++		/*GaussTetra constructors, destructors*/
++		GaussTetra();
++		GaussTetra(int order);
++		~GaussTetra();
++
++		/*Methods*/
++		int  begin(void);
++		int  end(void);
++		void Echo(void);
++		int  Enum(void);
++		void GaussPoint(int ig);
++		void GaussVertex(int iv);
++		void GaussNode(int finitelement,int iv);
++		void SynchronizeGaussBase(Gauss* gauss);
++};
++#endif
Index: issm/oecreview/Archive/16554-17801/ISSM-17398-17399.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17398-17399.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17398-17399.diff	(revision 17802)
@@ -0,0 +1,104 @@
+Index: ../trunk-jpl/src/m/enum/TetraInputEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/TetraInputEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/TetraInputEnum.m	(revision 17399)
+@@ -0,0 +1,11 @@
++function macro=TetraInputEnum()
++%TETRAINPUTENUM - Enum of TetraInput
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=TetraInputEnum()
++
++macro=StringToEnum('TetraInput');
+Index: ../trunk-jpl/src/m/enum/TetraEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/TetraEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/TetraEnum.m	(revision 17399)
+@@ -0,0 +1,11 @@
++function macro=TetraEnum()
++%TETRAENUM - Enum of Tetra
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=TetraEnum()
++
++macro=StringToEnum('Tetra');
+Index: ../trunk-jpl/src/m/enum/DivergenceEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/DivergenceEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/DivergenceEnum.m	(revision 17399)
+@@ -0,0 +1,11 @@
++function macro=DivergenceEnum()
++%DIVERGENCEENUM - Enum of Divergence
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=DivergenceEnum()
++
++macro=StringToEnum('Divergence');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17398)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17399)
+@@ -401,8 +401,6 @@
+ def ParamEnum(): return StringToEnum("Param")[0]
+ def PengridEnum(): return StringToEnum("Pengrid")[0]
+ def PenpairEnum(): return StringToEnum("Penpair")[0]
+-def PentaEnum(): return StringToEnum("Penta")[0]
+-def PentaInputEnum(): return StringToEnum("PentaInput")[0]
+ def ProfilerEnum(): return StringToEnum("Profiler")[0]
+ def MatrixParamEnum(): return StringToEnum("MatrixParam")[0]
+ def NodeSIdEnum(): return StringToEnum("NodeSId")[0]
+@@ -420,6 +418,10 @@
+ def SegInputEnum(): return StringToEnum("SegInput")[0]
+ def TriaEnum(): return StringToEnum("Tria")[0]
+ def TriaInputEnum(): return StringToEnum("TriaInput")[0]
++def TetraEnum(): return StringToEnum("Tetra")[0]
++def TetraInputEnum(): return StringToEnum("TetraInput")[0]
++def PentaEnum(): return StringToEnum("Penta")[0]
++def PentaInputEnum(): return StringToEnum("PentaInput")[0]
+ def VertexEnum(): return StringToEnum("Vertex")[0]
+ def VertexPIdEnum(): return StringToEnum("VertexPId")[0]
+ def VertexSIdEnum(): return StringToEnum("VertexSId")[0]
+@@ -513,6 +515,7 @@
+ def StressTensoryyEnum(): return StringToEnum("StressTensoryy")[0]
+ def StressTensoryzEnum(): return StringToEnum("StressTensoryz")[0]
+ def StressTensorzzEnum(): return StringToEnum("StressTensorzz")[0]
++def DivergenceEnum(): return StringToEnum("Divergence")[0]
+ def GiaCrossSectionShapeEnum(): return StringToEnum("GiaCrossSectionShape")[0]
+ def GiadWdtEnum(): return StringToEnum("GiadWdt")[0]
+ def GiaWEnum(): return StringToEnum("GiaW")[0]
+@@ -581,6 +584,7 @@
+ def QmuMaskGroundediceLevelsetEnum(): return StringToEnum("QmuMaskGroundediceLevelset")[0]
+ def GaussSegEnum(): return StringToEnum("GaussSeg")[0]
+ def GaussTriaEnum(): return StringToEnum("GaussTria")[0]
++def GaussTetraEnum(): return StringToEnum("GaussTetra")[0]
+ def GaussPentaEnum(): return StringToEnum("GaussPenta")[0]
+ def FSSolverEnum(): return StringToEnum("FSSolver")[0]
+ def AdjointEnum(): return StringToEnum("Adjoint")[0]
+Index: ../trunk-jpl/src/m/enum/GaussTetraEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/GaussTetraEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/GaussTetraEnum.m	(revision 17399)
+@@ -0,0 +1,11 @@
++function macro=GaussTetraEnum()
++%GAUSSTETRAENUM - Enum of GaussTetra
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=GaussTetraEnum()
++
++macro=StringToEnum('GaussTetra');
Index: issm/oecreview/Archive/16554-17801/ISSM-17399-17400.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17399-17400.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17399-17400.diff	(revision 17802)
@@ -0,0 +1,82 @@
+Index: ../trunk-jpl/test/NightlyRun/test271.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test271.py	(revision 0)
++++ ../trunk-jpl/test/NightlyRun/test271.py	(revision 17400)
+@@ -0,0 +1,35 @@
++import numpy as npy
++from triangle import triangle
++from model import model
++from setmask import setmask
++from parameterize import parameterize
++from verbose import verbose
++from setflowequation import setflowequation
++from generic import generic
++from socket import gethostname as oshostname
++from solve import solve
++from EnumDefinitions import DamageEvolutionSolutionEnum
++
++md=triangle(model(),'../Exp/Square.exp',150000.)
++md=setmask(md,'all','')
++md=parameterize(md,'../Par/SquareShelf.py')
++md.damage.D=npy.zeros((md.mesh.numberofvertices,1))
++md.damage.spcdamage=npy.float('nan')*npy.ones((md.mesh.numberofvertices,1))
++md.damage.law='pralong'
++md.damage.stabilization=1;
++
++pos=npy.nonzero(npy.logical_and(md.mask.ice_levelset[:,0]!=0,md.mesh.vertexonboundary==1))
++md.damage.spcdamage[pos]=0.5;
++
++md.damage.requested_outputs=['default','DamageF']
++
++md=setflowequation(md,'SSA','all')
++md.cluster=generic('name',oshostname(),'np',3)
++md=solve(md,DamageEvolutionSolutionEnum())
++
++field_names=['D','F']
++field_tolerances=[1.e-13,1.e-13]
++field_values=[\
++		md.results.DamageEvolutionSolution.DamageD,\
++		md.results.DamageEvolutionSolution.DamageF,\
++		]
+Index: ../trunk-jpl/test/NightlyRun/test271.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test271.m	(revision 17399)
++++ ../trunk-jpl/test/NightlyRun/test271.m	(revision 17400)
+@@ -1,7 +1,7 @@
+ md=triangle(model(),'../Exp/Square.exp',150000.);
+ md=setmask(md,'all','');
+ md=parameterize(md,'../Par/SquareShelf.par');
+-md.damage.D=0.5*ones(md.mesh.numberofvertices,1);
++md.damage.D=zeros(md.mesh.numberofvertices,1);
+ md.damage.spcdamage=NaN*ones(md.mesh.numberofvertices,1);
+ md.damage.law='pralong';
+ 
+@@ -9,15 +9,19 @@
+ boundary=zeros(md.mesh.numberofvertices,1);
+ boundary(md.mesh.segments(:,1:2))=1;
+ pos=find(~md.mask.ice_levelset==0 & boundary==1);
+-md.damage.spcdamage(pos)=0;
++md.damage.spcdamage(pos)=0.5;
++md.damage.stabilization=1;
+ 
+-md.verbose=verbose('solution',true);
++md.damage.requested_outputs={'default','DamageF'}
+ 
+ md=setflowequation(md,'SSA','all');
+ md.cluster=generic('name',oshostname(),'np',3);
+ md=solve(md,DamageEvolutionSolutionEnum());
+ 
+ %Fields and tolerances to track changes
+-field_names     ={'D'};
+-field_tolerances={1e-13};
+-field_values={md.results.DamageEvolutionSolution.DamageD};
++field_names={'D','F'}
++field_tolerances={1e-13,1e-13};
++field_values={...
++		(md.results.DamageEvolutionSolution.DamageD),...
++		(md.results.DamageEvolutionSolution.DamageF),...
++	};
+Index: ../trunk-jpl/test/Archives/Archive271.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17400-17401.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17400-17401.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17400-17401.diff	(revision 17802)
@@ -0,0 +1,15 @@
+Index: ../trunk-jpl/src/m/classes/damage.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/damage.py	(revision 17400)
++++ ../trunk-jpl/src/m/classes/damage.py	(revision 17401)
+@@ -54,8 +54,8 @@
+ 		s+="%s\n" % fielddisplay(self,"stabilization","0: no, 1: artificial_diffusivity, 2: SUPG")
+ 		s+="%s\n" % fielddisplay(self,"maxiter","maximum number of non linear iterations")
+ 		s+="%s\n" % fielddisplay(self,"penalty_lock","stabilize unstable damage constraints that keep zigzagging after n iteration (default is 0, no stabilization)")
+-		s+="%s\n" % fielddisplay(self,"penalty_lock","threshold to declare convergence of damage evolution solution (default is 0)")
+-		s+="%s\n" % fielddisplay(self,"penalty_lock","scaling exponent (default is 3)")
++		s+="%s\n" % fielddisplay(self,"penalty_threshold","threshold to declare convergence of damage evolution solution (default is 0)")
++		s+="%s\n" % fielddisplay(self,"penalty_factor","scaling exponent (default is 3)")
+ 
+ 		if (self.law=='pralong'):
+ 			s+="%s\n" % fielddisplay(self,"c1","damage parameter 1 ")
Index: issm/oecreview/Archive/16554-17801/ISSM-17401-17402.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17401-17402.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17401-17402.diff	(revision 17802)
@@ -0,0 +1,22 @@
+Index: ../trunk-jpl/src/m/plot/plotmodel.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plotmodel.py	(revision 17401)
++++ ../trunk-jpl/src/m/plot/plotmodel.py	(revision 17402)
+@@ -44,7 +44,6 @@
+ 	if not nl==nc:
+ 		raise StandardError('error: nlines and ncols need to be specified together, or not at all')
+ 	
+-	
+ 	#Go through plots
+ 	if numberofplots:
+ 		
+@@ -53,6 +52,9 @@
+ 		#UNLESS plotmodel is called within a script (e.g. a runme.py file) 
+ 		#handling the 'visible' option will need some check on whether ipython is currently in interactive or non-interactive mode
+ 
++		#clear any previous plot window
++		p.clf()
++
+ 		#if figsize specified
+ 		if options.list[0].exist('figsize'):
+ 			figsize=options.list[0].getfieldvalue('figsize')
Index: issm/oecreview/Archive/16554-17801/ISSM-17402-17403.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17402-17403.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17402-17403.diff	(revision 17802)
@@ -0,0 +1,67 @@
+Index: ../trunk-jpl/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.cpp	(revision 17402)
++++ ../trunk-jpl/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.cpp	(revision 17403)
+@@ -161,11 +161,23 @@
+ void SmbHenningx(FemModel* femmodel){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	IssmDouble  z_critical = 200.;
+-	IssmDouble  a = 2.;
+-	IssmDouble  b = 3.;
+-	IssmDouble  smb,smbref,z;
+-
++	IssmDouble  z_critical = 1675.;
++	IssmDouble  dz = 0;
++	IssmDouble  a = -15.86;
++	IssmDouble  b = 0.00969;
++	IssmDouble  c = -0.235;
++	IssmDouble  f = 1.;
++	IssmDouble  g = -0.0011;
++	IssmDouble  h = -1.54e-5;
++	IssmDouble  smb,smbref,anomaly,yts,z;
++    
++    /* Get constants */
++    femmodel->parameters->FindParam(&yts,ConstantsYtsEnum);
++    /*iomodel->Constant(&yts,ConstantsYtsEnum);*/
++    /*this->parameters->FindParam(&yts,ConstantsYtsEnum);*/
++    /*Mathieu original*/
++    /*IssmDouble  smb,smbref,z;*/
++    
+ 	/*Loop over all the elements of this partition*/
+ 	for(int i=0;i<femmodel->elements->Size();i++){
+ 		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+@@ -181,18 +193,26 @@
+ 		/*Loop over all vertices of element and correct SMB as a function of altitude z*/
+ 		for(int v=0;v<numvertices;v++){
+ 
+-			/*Get vertex elevation, reference smb*/
++			/*Get vertex elevation, anoma smb*/
+ 			z      = surfacelist[v];
+-			smbref = smblistref[v];
++			anomaly = smblistref[v];
+ 
+-			/*Compute corrected smb*/
+-			if(z<z_critical){
+-				smb = smbref;
++            /* Henning edited acc. to Riannes equations*/
++            /* Set SMB maximum elevation, if dz = 0 -> z_critical = 1675 */
++            z_critical = z_critical + dz;
++            
++            /* Calculate smb acc. to the surface elevation z */
++            if(z<z_critical){
++				smb = a + b*z + c;
+ 			}
+ 			else{
+-				smb = a*smbref*smbref+b+z;
++			  smb = (a + b*z)*(f + g*(z-z_critical) + h*(z-z_critical)*(z-z_critical)) + c;
+ 			}
+-
++            
++            /* Compute smb including anomaly,
++             correct for number of seconds in a year [s/yr]*/
++            smb = smb + anomaly*yts;
++            
+ 			/*Update array accordingly*/
+ 			smblist[v] = smb;
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17403-17404.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17403-17404.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17403-17404.diff	(revision 17802)
@@ -0,0 +1,55 @@
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp	(revision 17403)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp	(revision 17404)
+@@ -18,6 +18,7 @@
+ IssmDouble fx(IssmDouble x,IssmDouble y,IssmDouble z,int testid){ /*{{{*/ 
+ 	IssmDouble p=2;
+ 	IssmDouble q=2;
++	IssmDouble a=1;
+ 
+ 	switch(testid){
+ 		case 1:
+@@ -41,6 +42,8 @@
+ 			return 1.0;
+ 		case 9:
+ 			return 4*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*sin(PI*p*y)*sin(PI*p*z) + 2*pow(PI, 2)*pow(p, 2)*sin(PI*p*y)*sin(PI*p*z)*cos(PI*p*x) + 2*x*z;
++		case 10:
++			return 4*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*sin(PI*p*y)*sin(PI*p*z) + 2*pow(PI, 2)*pow(p, 2)*sin(PI*p*y)*sin(PI*p*z)*cos(PI*p*x) + PI*q*pow(z, a)*sin(PI*q*y)*cos(PI*q*x);
+ 
+ 		case 101: 
+ 			return 4*pow(x, 2)*y*z*pow(x - 1, 2)*(z - 1) + 8*pow(x, 2)*y*z*(y - 1)*(2*y - 1)*(z - 1) + 2*pow(x, 2)*y*pow(x - 1, 2)*(y - 1)*(2*y - 1) + 4*pow(x, 2)*z*pow(x - 1, 2)*(y - 1)*(z - 1) + 2*pow(x, 2)*z*pow(x - 1, 2)*(2*y - 1)*(z - 1) - 12*x*pow(y, 2)*z*(x - 1)*(y - 1)*(z - 1) - 6*x*pow(y, 2)*z*(2*x - 1)*(y - 1)*(z - 1) - 12*x*y*z*(x - 1)*pow(y - 1, 2)*(z - 1) + 32*x*y*z*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 6*x*y*z*(2*x - 1)*pow(y - 1, 2)*(z - 1) - 6*pow(y, 2)*z*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 8*y*z*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 6*y*z*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1);
+@@ -52,6 +55,7 @@
+ IssmDouble fy(IssmDouble x,IssmDouble y,IssmDouble z,int testid){ /*{{{*/ 
+ 	IssmDouble p=2;
+ 	IssmDouble q=2;
++	IssmDouble a=1;
+ 
+ 	switch(testid){
+ 		case 1:
+@@ -75,6 +79,8 @@
+ 			return 1.0;
+ 		case 9: 
+ 			return -2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*sin(PI*p*x)*sin(PI*p*z) - pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*z)*cos(PI*p*y) + 2*y*z;
++		case 10:
++			return -2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*sin(PI*p*x)*sin(PI*p*z) - pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*z)*cos(PI*p*y) + PI*q*pow(z, a)*sin(PI*q*x)*cos(PI*q*y);
+ 
+ 		case 101: 
+ 			return 12*pow(x, 2)*y*z*(x - 1)*(y - 1)*(z - 1) + 6*pow(x, 2)*y*z*(x - 1)*(2*y - 1)*(z - 1) + 6*pow(x, 2)*z*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 8*x*pow(y, 2)*z*(x - 1)*(2*x - 1)*(z - 1) - 4*x*pow(y, 2)*z*pow(y - 1, 2)*(z - 1) - 2*x*pow(y, 2)*(x - 1)*(2*x - 1)*pow(y - 1, 2) + 12*x*y*z*pow(x - 1, 2)*(y - 1)*(z - 1) + 6*x*y*z*pow(x - 1, 2)*(2*y - 1)*(z - 1) - 32*x*y*z*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 6*x*z*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 8*x*z*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1) - 4*pow(y, 2)*z*(x - 1)*pow(y - 1, 2)*(z - 1) - 2*pow(y, 2)*z*(2*x - 1)*pow(y - 1, 2)*(z - 1);
+@@ -86,6 +92,7 @@
+ IssmDouble fz(IssmDouble x,IssmDouble y,IssmDouble z,int testid){ /*{{{*/ 
+ 	IssmDouble p = 2.0;  
+ 	IssmDouble q = 2.0;   
++	IssmDouble a = 1.0;
+ 
+ 	switch(testid){
+ 		case 1: case 2: case 7: case 8:
+@@ -100,6 +107,8 @@
+ 			return - 2. * PI*PI * p*p * (cos(p*PI*z)-1) * sin(p*PI*x) * sin(p*PI*y)-PI*PI * p*p *  sin(p*PI*x)    * sin(p*PI*y) * cos(p*PI*z)+ q * PI * sin(q*PI*x) * sin(q*PI*y) * cos(q*PI*z);
+ 		case 9:
+ 			return -2*pow(PI, 3)*pow(p, 3)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*sin(PI*p*y) - pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*y)*cos(PI*p*z) + pow(x, 2) + pow(y, 2);
++		case 10:
++			return a*pow(z, a - 1)*(sin(PI*q*x)*sin(PI*q*y) + 1) - 2*pow(PI, 3)*pow(p, 3)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*sin(PI*p*y) - pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*y)*cos(PI*p*z);
+ 		default:
+ 			_error_("FS analytical solution"<<testid<<" not implemented yet");
+ 	}
Index: issm/oecreview/Archive/16554-17801/ISSM-17404-17405.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17404-17405.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17404-17405.diff	(revision 17802)
@@ -0,0 +1,170 @@
+Index: ../trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp	(revision 17404)
++++ ../trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp	(revision 17405)
+@@ -45,7 +45,7 @@
+ 
+ 	file_line= what_line;
+ 	/*When error messages are not shown properly, uncomment the following line*/
+-	//this->Report();
++	this->Report();
+ 
+ }/*}}}*/
+ ErrorException::~ErrorException() throw(){/*{{{*/
+Index: ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp	(revision 17404)
++++ ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp	(revision 17405)
+@@ -17,6 +17,7 @@
+ /*Element macros*/
+ #define NUMNODESP0  1
+ #define NUMNODESP1  4
++#define NUMNODESP2  10
+ 
+ /*Object constructors and destructor*/
+ /*FUNCTION TetraRef::TetraRef(){{{*/
+@@ -62,6 +63,29 @@
+ 	_assert_(basis);
+ 
+ 	switch(element_type){
++		case P0Enum:
++			basis[0]=1.;
++			return;
++		case P1Enum: case P1DGEnum:
++			basis[0]=gauss->coord1;
++			basis[1]=gauss->coord2;
++			basis[2]=gauss->coord3;
++			basis[3]=gauss->coord4;
++			return;
++		case P2Enum:
++			/*Vertices*/
++			basis[0]=gauss->coord1*(2.*gauss->coord1-1.);
++			basis[1]=gauss->coord2*(2.*gauss->coord2-1.);
++			basis[2]=gauss->coord3*(2.*gauss->coord3-1.);
++			basis[3]=gauss->coord4*(2.*gauss->coord4-1.);
++			/*Edges*/
++			basis[4]=4.*gauss->coord2*gauss->coord3;
++			basis[5]=4.*gauss->coord1*gauss->coord3;
++			basis[6]=4.*gauss->coord1*gauss->coord2;
++			basis[7]=4.*gauss->coord2*gauss->coord4;
++			basis[8]=4.*gauss->coord3*gauss->coord4;
++			basis[9]=4.*gauss->coord1*gauss->coord4;
++			return;
+ 		default:
+ 			_error_("Element type "<<EnumToStringx(element_type)<<" not supported yet");
+ 	}
+@@ -104,7 +128,6 @@
+ 
+ 	/*Clean up*/
+ 	xDelete<IssmDouble>(dbasis_ref);
+-
+ }
+ /*}}}*/
+ /*FUNCTION TetraRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTetra* gauss){{{*/
+@@ -124,6 +147,70 @@
+ 	_assert_(dbasis && gauss);
+ 
+ 	switch(finiteelement){
++		case P0Enum:
++			/*Nodal function 1*/
++			dbasis[NUMNODESP0*0+0] = 0.;
++			dbasis[NUMNODESP0*1+0] = 0.;
++			dbasis[NUMNODESP0*2+0] = 0.;
++			return;
++		case P1Enum: case P1DGEnum:
++			dbasis[NUMNODESP1*0+0] = -1.;
++			dbasis[NUMNODESP1*1+0] = -1.;
++			dbasis[NUMNODESP1*2+0] = -1.;
++
++			dbasis[NUMNODESP1*0+1] = 1.;
++			dbasis[NUMNODESP1*1+1] = 0.;
++			dbasis[NUMNODESP1*2+1] = 0.;
++
++			dbasis[NUMNODESP1*0+2] = 0.;
++			dbasis[NUMNODESP1*1+2] = 1.;
++			dbasis[NUMNODESP1*2+2] = 0.;
++
++			dbasis[NUMNODESP1*0+3] = 0.;
++			dbasis[NUMNODESP1*1+3] = 0.;
++			dbasis[NUMNODESP1*2+3] = 1.;
++			return;
++		case P2Enum:
++			dbasis[NUMNODESP2*0+0] = -4.*gauss->coord1+1.;
++			dbasis[NUMNODESP2*1+0] = -4.*gauss->coord1+1.;
++			dbasis[NUMNODESP2*2+0] = -4.*gauss->coord1+1.;
++
++			dbasis[NUMNODESP2*0+1] = 4.*gauss->coord2-1.;
++			dbasis[NUMNODESP2*1+1] = 0.;
++			dbasis[NUMNODESP2*2+1] = 0.;
++
++			dbasis[NUMNODESP2*0+2] = 0.;
++			dbasis[NUMNODESP2*1+2] = 4.*gauss->coord3-1.;
++			dbasis[NUMNODESP2*2+2] = 0.;
++
++			dbasis[NUMNODESP2*0+3] = 0.;
++			dbasis[NUMNODESP2*1+3] = 0.;
++			dbasis[NUMNODESP2*2+3] = 4.*gauss->coord4-1.;
++
++			dbasis[NUMNODESP2*0+4] = 4.*gauss->coord3;
++			dbasis[NUMNODESP2*1+4] = 4.*gauss->coord2;
++			dbasis[NUMNODESP2*2+4] = 0.;
++
++			dbasis[NUMNODESP2*0+5] = -4.*gauss->coord3;
++			dbasis[NUMNODESP2*1+5] = 4.*(gauss->coord1-gauss->coord3);
++			dbasis[NUMNODESP2*2+5] = -4.*gauss->coord3;
++
++			dbasis[NUMNODESP2*0+6] = 4.*(gauss->coord1-gauss->coord2);
++			dbasis[NUMNODESP2*1+6] = -4.*gauss->coord2;
++			dbasis[NUMNODESP2*2+6] = -4.*gauss->coord2;
++
++			dbasis[NUMNODESP2*0+7] = 4.*gauss->coord4;
++			dbasis[NUMNODESP2*1+7] = 0.;
++			dbasis[NUMNODESP2*2+7] = 4.*gauss->coord2;
++
++			dbasis[NUMNODESP2*0+8] = 0.;
++			dbasis[NUMNODESP2*1+8] = 4.*gauss->coord4;
++			dbasis[NUMNODESP2*2+8] = 4.*gauss->coord3;
++
++			dbasis[NUMNODESP2*0+9] = -4.*gauss->coord4;
++			dbasis[NUMNODESP2*1+9] = -4.*gauss->coord4;
++			dbasis[NUMNODESP2*2+9] = 4.*(gauss->coord1-gauss->coord4);
++			return;
+ 		default:
+ 			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+ 	}
+@@ -198,6 +285,21 @@
+ 	/*The Jacobian is constant over the element, discard the gaussian points. 
+ 	 * J is assumed to have been allocated of size 1*/
+ 
++	IssmDouble x1=xyz_list[3*0+0];
++	IssmDouble x2=xyz_list[3*1+0];
++	IssmDouble x3=xyz_list[3*2+0];
++	IssmDouble x4=xyz_list[3*3+0];
++
++	IssmDouble y1=xyz_list[3*0+1];
++	IssmDouble y2=xyz_list[3*1+1];
++	IssmDouble y3=xyz_list[3*2+1];
++	IssmDouble y4=xyz_list[3*3+1];
++
++	IssmDouble z1=xyz_list[3*0+2];
++	IssmDouble z2=xyz_list[3*1+2];
++	IssmDouble z3=xyz_list[3*2+2];
++	IssmDouble z4=xyz_list[3*3+2];
++
+ 	_error_("Not implemented yet");
+ }
+ /*}}}*/
+@@ -239,9 +341,10 @@
+ int TetraRef::NumberofNodes(int finiteelement){
+ 
+ 	switch(finiteelement){
+-		case P0Enum:                return NUMNODESP0;
+-		case P1Enum:                return NUMNODESP1;
+-		case P1DGEnum:              return NUMNODESP1;
++		case P0Enum:   return NUMNODESP0;
++		case P1Enum:   return NUMNODESP1;
++		case P1DGEnum: return NUMNODESP1;
++		case P2Enum:   return NUMNODESP2;
+ 		default: _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+ 	}
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17405-17406.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17405-17406.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17405-17406.diff	(revision 17802)
@@ -0,0 +1,23 @@
+Index: ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp	(revision 17405)
++++ ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp	(revision 17406)
+@@ -300,7 +300,17 @@
+ 	IssmDouble z3=xyz_list[3*2+2];
+ 	IssmDouble z4=xyz_list[3*3+2];
+ 
+-	_error_("Not implemented yet");
++	J[NDOF3*0+0] = x2-x1;
++	J[NDOF3*1+0] = y2-y1;
++	J[NDOF3*2+0] = z2-z1;
++
++	J[NDOF3*0+1] = x3-x1;
++	J[NDOF3*1+1] = y3-y1;
++	J[NDOF3*2+1] = z3-z1;
++
++	J[NDOF3*0+2] = x4-x1;
++	J[NDOF3*1+2] = y4-y1;
++	J[NDOF3*2+2] = z4-z1;
+ }
+ /*}}}*/
+ /*FUNCTION TetraRef::GetJacobianDeterminant{{{*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17406-17407.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17406-17407.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17406-17407.diff	(revision 17802)
@@ -0,0 +1,129 @@
+Index: ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17406)
++++ ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17407)
+@@ -56,8 +56,8 @@
+ 
+ 	if(VerboseSolution()) _printf0_("extrapolation of " << EnumToStringx(extvar_enum) << ": call computational core:\n");
+ 	solutionsequence_linear(femmodel);
+-	
+-	save_results=true;
++
++	save_results=false;
+ 	if(save_results){
+ 		if(VerboseSolution()) _printf0_("   saving results\n");
+ 		int outputs[2] = {VxEnum,VyEnum};
+@@ -78,6 +78,7 @@
+ 	/*Intermediaries */
+ 	const int dim = 2;
+ 	int        i,row,col,stabilization;
++	bool	   extrapolatebydiffusion = true;
+ 	IssmDouble Jdet,D_scalar,h;
+ 	IssmDouble dlsf[dim],normal[dim];
+ 	IssmDouble norm_dlsf;
+@@ -89,11 +90,15 @@
+ 
+ 	/*Initialize Element vector and other vectors*/
+ 	ElementMatrix* Ke     = element->NewElementMatrix();
++	IssmDouble*    B      = xNew<IssmDouble>(dim*numnodes);
+ 	IssmDouble*    Bprime = xNew<IssmDouble>(dim*numnodes);
+ 	IssmDouble     D[dim][dim];
+ 
+ 	/*Retrieve all inputs and parameters*/
++	Input* lsf_slopex_input=element->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
++	Input* lsf_slopey_input=element->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+ 	element->GetVerticesCoordinates(&xyz_list);
++	h = element->CharacteristicLength();
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	Gauss* gauss=element->NewGauss(2);
+@@ -101,22 +106,84 @@
+ 		gauss->GaussPoint(ig);
+ 
+ 		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		GetB(B,element,xyz_list,gauss);
+ 		GetBprime(Bprime,element,xyz_list,gauss);
+-
++		
+ 		D_scalar=gauss->weight*Jdet;
+ 
+-		for(row=0;row<dim;row++)
+-			for(col=0;col<dim;col++)
+-				D[row][col]=((row==col)?D_scalar:0.);
++		if(extrapolatebydiffusion){
++			/* diffuse values outward */
++			for(row=0;row<dim;row++)
++				for(col=0;col<dim;col++)
++					if(row==col)
++						D[row][col] = D_scalar;
++					else
++						D[row][col] = 0.;
+ 
+-		TripleMultiply(Bprime,dim,numnodes,1,
++			TripleMultiply(Bprime,dim,numnodes,1,
+ 					&D[0][0],dim,dim,0,
+ 					Bprime,dim,numnodes,0,
+ 					&Ke->values[0],1);
++		}
++		else{
++			/* extrapolate values along normal */
++			/* Get normal on ice boundary */
++			lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
++			lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
++			norm_dlsf=0.;
++			for(i=0;i<dim;i++)	norm_dlsf+=dlsf[i]*dlsf[i]; 
++			norm_dlsf=sqrt(norm_dlsf); _assert_(norm_dlsf>0.);
++
++			if(norm_dlsf>0.)
++				for(i=0;i<dim;i++)	normal[i]=dlsf[i]/norm_dlsf;
++			else
++				for(i=0;i<dim;i++)	normal[i]=0.;
++			
++			for(row=0;row<dim;row++)
++				for(col=0;col<dim;col++)
++					if(row==col)
++						D[row][col]=D_scalar*normal[row];
++					else
++						D[row][col]=0.;
++			TripleMultiply(B,dim,numnodes,1,
++						&D[0][0],dim,dim,0,
++						Bprime,dim,numnodes,0,
++						&Ke->values[0],1);
++
++			/* Stabilization *//*{{{*/
++			stabilization=1;
++			if (stabilization==0){/* no stabilization, do nothing*/}
++			else if(stabilization==1){
++				/* Artificial Diffusion */
++				element->ElementSizes(&hx,&hy,&hz);
++				h=sqrt( pow(hx*normal[0],2) + pow(hy*normal[1],2));
++				kappa=h/2.+1.e-14; 
++				D[0][0]=D_scalar*kappa;
++				D[0][1]=0.;
++				D[1][0]=0.;
++				D[1][1]=D_scalar*kappa;
++				TripleMultiply(Bprime,dim,numnodes,1,
++							&D[0][0],dim,dim,0,
++							Bprime,dim,numnodes,0,
++							&Ke->values[0],1);
++			}
++			else if(stabilization==2){
++				/*Streamline upwinding - do not use this for extrapolation: yields oscillating results due to smoothing along normal, not across */
++				for(row=0;row<dim;row++)
++					for(col=0;col<dim;col++)
++						D[row][col]=h/(2.*1.)*normal[row]*normal[col];
++
++				TripleMultiply(Bprime,dim,numnodes,1,
++							&D[0][0],dim,dim,0,
++							Bprime,dim,numnodes,0,
++							&Ke->values[0],1);
++			}/*}}}*/
++		}
+ 	}/*}}}*/
+ 
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(B);
+ 	xDelete<IssmDouble>(Bprime);
+ 	delete gauss;
+ 	return Ke;
Index: issm/oecreview/Archive/16554-17801/ISSM-17407-17408.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17407-17408.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17407-17408.diff	(revision 17802)
@@ -0,0 +1,20 @@
+Index: ../trunk-jpl/src/m/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/m/Makefile.am	(revision 17407)
++++ ../trunk-jpl/src/m/Makefile.am	(revision 17408)
+@@ -13,7 +13,6 @@
+ 					./kml/*.m \
+ 					./enum/*.m \
+ 					./dev/issmversion.m \
+-					./dev/issmversion.py \
+ 					./classes/*.m \
+ 					./classes/qmu/*.m \
+ 					./classes/qmu/@dakota_method/*.m \
+@@ -61,6 +60,7 @@
+ 					./classes/*.py \
+ 					./classes/clusters/*.py \
+ 					./consistency/*.py \
++					./dev/issmversion.py \
+ 					./boundaryconditions/*.py \
+ 					./exp/*.py \
+ 					./geometry/*.py \
Index: issm/oecreview/Archive/16554-17801/ISSM-17408-17409.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17408-17409.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17408-17409.diff	(revision 17802)
@@ -0,0 +1,27 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17408)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17409)
+@@ -12,6 +12,7 @@
+ 
+ 	/*Intermediaries*/
+ 	int   i,j,counter,vnodes,lid=0;
++	int   numberoffaces;
+ 	int   id0 = iomodel->nodecounter;
+ 	bool *my_faces = NULL;
+ 	bool *my_edges = NULL;
+@@ -325,10 +326,12 @@
+ 			}
+ 
+ 			/*P1 pressure*/
+-			vnodes = id0+iomodel->numberoffaces;
++	      if(iomodel->meshtype==Mesh3DEnum) numberoffaces=iomodel->numberoffaces;
++			else numberoffaces=0;
++			vnodes = id0+numberoffaces;
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+-					nodes->AddObject(new Node(vnodes+i+1,iomodel->numberofvertices+iomodel->numberofedges+iomodel->numberoffaces+i,lid++,i,iomodel,analysis,FSpressureEnum));
++					nodes->AddObject(new Node(vnodes+i+1,iomodel->numberofvertices+iomodel->numberofedges+numberoffaces+i,lid++,i,iomodel,analysis,FSpressureEnum));
+ 				}
+ 			}
+ 			break;
Index: issm/oecreview/Archive/16554-17801/ISSM-17409-17410.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17409-17410.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17409-17410.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/jenkins/jenkins.sh
+===================================================================
+--- ../trunk-jpl/jenkins/jenkins.sh	(revision 17409)
++++ ../trunk-jpl/jenkins/jenkins.sh	(revision 17410)
+@@ -208,6 +208,8 @@
+ 	exit 1
+ fi
+ #}}}
++echo "Cleaning up execution directory"
++rm -rf $ISSM_DIR/execution/*
+ 
+ #Prepare info.log
+ #{{{
Index: issm/oecreview/Archive/16554-17801/ISSM-17410-17411.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17410-17411.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17410-17411.diff	(revision 17802)
@@ -0,0 +1,117 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17410)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17411)
+@@ -68,6 +68,7 @@
+ 		ElementMatrix* CreateKMatrixFS(Element* element);
+ 		ElementMatrix* CreateKMatrixFSViscous(Element* element);
+ 		ElementMatrix* CreateKMatrixFSFriction(Element* element);
++		ElementMatrix* CreateKMatrixFSShelf(Element* element);
+ 		ElementVector* CreatePVectorFS(Element* element);
+ 		ElementVector* CreatePVectorFSViscous(Element* element);
+ 		ElementVector* CreatePVectorFSShelf(Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17410)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17411)
+@@ -6,7 +6,7 @@
+ #include "../solutionsequences/solutionsequences.h"
+ #include "../cores/cores.h"
+ 
+-//#define FSANALYTICAL 4
++//#define FSANALYTICAL 10
+ 
+ /*Model processing*/
+ int  StressbalanceAnalysis::DofsPerNode(int** pdoftype,int meshtype,int approximation){/*{{{*/
+@@ -2809,11 +2809,13 @@
+ 	/*compute all stiffness matrices for this element*/
+ 	ElementMatrix* Ke1=CreateKMatrixFSViscous(element);
+ 	ElementMatrix* Ke2=CreateKMatrixFSFriction(element);
+-	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
++	ElementMatrix* Ke3=CreateKMatrixFSShelf(element);
++	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2,Ke3);
+ 
+ 	/*clean-up and return*/
+ 	delete Ke1;
+ 	delete Ke2;
++	delete Ke3;
+ 	return Ke;
+ }/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixFSViscous(Element* element){/*{{{*/
+@@ -2980,6 +2982,76 @@
+ 	xDelete<IssmDouble>(D);
+ 	return Ke;
+ }/*}}}*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixFSShelf(Element* element){/*{{{*/
++
++	if(!element->IsFloating() || !element->IsOnBed()) return NULL;
++
++	/*If on not water or not FS, skip stiffness: */
++	int approximation,shelf_dampening;
++	element->GetInputValue(&approximation,ApproximationEnum);
++	if(approximation!=FSApproximationEnum && approximation!=SSAFSApproximationEnum && approximation!=HOFSApproximationEnum) return NULL;
++	element->FindParam(&shelf_dampening,StressbalanceShelfDampeningEnum);
++	if(shelf_dampening==0) return NULL;
++
++	/*Intermediaries*/
++	bool        mainlyfloating;
++	int         j,i,meshtype,dim;
++	IssmDouble  Jdet,slope2,scalar,dt;
++	IssmDouble  slope[2];
++	IssmDouble *xyz_list_base = NULL;
++	Gauss*      gauss         = NULL;
++
++	/*Get problem dimension*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2;break;
++		case Mesh3DEnum:         dim = 3;break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int vnumnodes = element->GetNumberOfNodesVelocity();
++	int pnumnodes = element->GetNumberOfNodesPressure();
++	int numdof    = vnumnodes*dim + pnumnodes;
++
++	/*Initialize Element matrix and vectors*/
++	ElementMatrix* Ke = element->NewElementMatrix(FSvelocityEnum);
++	IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinatesBase(&xyz_list_base);
++	element->FindParam(&dt,TimesteppingTimeStepEnum);
++	if(dt==0) dt=pow(10,5);
++	IssmDouble  rho_water =element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble  gravity =element->GetMaterialParameter(ConstantsGEnum);
++	Input*      surface_input  = element->GetInput(SurfaceEnum); _assert_(surface_input);
++
++	/* Start  looping on the number of gaussian points: */
++	gauss=element->NewGaussBase(3);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		surface_input->GetInputDerivativeValue(&slope[0],xyz_list_base,gauss);
++		element->NodalFunctionsVelocity(vbasis,gauss);
++		element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
++		if(dim==2) slope2=slope[0]*slope[0];
++		else if(dim==3) slope2=slope[0]*slope[0]+slope[1]*slope[1];
++		scalar  = rho_water*gravity*sqrt(1+slope2)*gauss->weight*Jdet*dt; 
++		for(i=0;i<vnumnodes;i++){
++			for(j=0;j<vnumnodes;j++){
++				Ke->values[numdof*(i*dim+1)+j*dim+1] += scalar*vbasis[i]*vbasis[j];
++			}
++		}
++	}
++
++	/*DO NOT Transform Coordinate System: this stiffness matrix is already expressed in tangential coordinates*/
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<IssmDouble>(xyz_list_base);
++	xDelete<IssmDouble>(vbasis);
++	return Ke;
++}/*}}}*/
+ #ifdef FSANALYTICAL
+ ElementVector* StressbalanceAnalysis::CreatePVectorFS(Element* element){/*{{{*/
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17411-17412.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17411-17412.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17411-17412.diff	(revision 17802)
@@ -0,0 +1,19 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17411)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17412)
+@@ -3021,10 +3021,10 @@
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinatesBase(&xyz_list_base);
+ 	element->FindParam(&dt,TimesteppingTimeStepEnum);
+-	if(dt==0) dt=pow(10,5);
+-	IssmDouble  rho_water =element->GetMaterialParameter(MaterialsRhoWaterEnum);
+-	IssmDouble  gravity =element->GetMaterialParameter(ConstantsGEnum);
+-	Input*      surface_input  = element->GetInput(SurfaceEnum); _assert_(surface_input);
++	if(dt==0)   dt=1.e+5;
++	IssmDouble  rho_water     = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble  gravity       = element->GetMaterialParameter(ConstantsGEnum);
++	Input*      surface_input = element->GetInput(SurfaceEnum); _assert_(surface_input);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	gauss=element->NewGaussBase(3);
Index: issm/oecreview/Archive/16554-17801/ISSM-17412-17413.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17412-17413.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17412-17413.diff	(revision 17802)
@@ -0,0 +1,32 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17412)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17413)
+@@ -2170,11 +2170,12 @@
+ 		slopey_input->GetInputValue(&slopey,gauss);
+ 		groundedicelevelset_input->GetInputValue(&groundedice,gauss);
+ 
++		/*New X axis          New Z axis*/
++		xz_plane[0]=1.;       xz_plane[3]=-slopex;  
++		xz_plane[1]=0.;       xz_plane[4]=-slopey;  
++		xz_plane[2]=slopex;   xz_plane[5]=1.;          
++
+ 		if(groundedice>0){
+-			/*New X axis          New Z axis*/
+-			xz_plane[0]=1.;       xz_plane[3]=-slopex;  
+-			xz_plane[1]=0.;       xz_plane[4]=-slopey;  
+-			xz_plane[2]=slopex;   xz_plane[5]=1.;          
+ 			if(this->nodes[indices[i]]->GetApproximation()==FSvelocityEnum){
+ 				this->nodes[indices[i]]->DofInSSet(2); //vz 
+ 			}
+@@ -2184,10 +2185,6 @@
+ 			else _error_("Flow equation approximation"<<EnumToStringx(this->nodes[indices[i]]->GetApproximation())<<" not supported yet");
+ 		}
+ 		else{
+-			/*New X axis          New Z axis*/
+-			xz_plane[0]=1.;       xz_plane[3]=0;  
+-			xz_plane[1]=0.;       xz_plane[4]=0;  
+-			xz_plane[2]=0;        xz_plane[5]=1.;          
+ 			if(this->nodes[indices[i]]->GetApproximation()==FSvelocityEnum){
+ 				this->nodes[indices[i]]->DofInFSet(2); //vz
+ 			}
Index: issm/oecreview/Archive/16554-17801/ISSM-17413-17414.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17413-17414.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17413-17414.diff	(revision 17802)
@@ -0,0 +1,27 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17413)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17414)
+@@ -1951,18 +1951,14 @@
+ 			groundedicelevelset_input->GetInputValue(&groundedice,gauss);
+ 			IssmDouble theta = atan(slope);
+ 
++			/*New X axis                  New Z axis*/
++			xz_plane[0]=cos(theta);       xz_plane[3]=0.;  
++			xz_plane[1]=sin(theta);       xz_plane[4]=0.;  
++			xz_plane[2]=0.;               xz_plane[5]=1.;          
+ 			if(groundedice>0){
+-				/*New X axis                  New Z axis*/
+-				xz_plane[0]=cos(theta);       xz_plane[3]=0.;  
+-				xz_plane[1]=sin(theta);       xz_plane[4]=0.;  
+-				xz_plane[2]=0.;               xz_plane[5]=1.;          
+ 				this->nodes[i]->DofInSSet(1); //vy
+ 			}
+ 			else{
+-				/*New X axis                  New Z axis*/
+-				xz_plane[0]=1.;               xz_plane[3]=0;  
+-				xz_plane[1]=0.;               xz_plane[4]=0;  
+-				xz_plane[2]=0;                xz_plane[5]=1.;          
+ 				this->nodes[i]->DofInFSet(1); //vy
+ 			}
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17414-17415.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17414-17415.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17414-17415.diff	(revision 17802)
@@ -0,0 +1,70 @@
+Index: ../trunk-jpl/test/NightlyRun/test703.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test703.m	(revision 17414)
++++ ../trunk-jpl/test/NightlyRun/test703.m	(revision 17415)
+@@ -42,6 +42,7 @@
+ %Transient settings
+ md.timestepping.time_step=0.000001;
+ md.timestepping.final_time=0.000005;
++md.stressbalance.shelf_dampening=1;
+ md.surfaceforcings.mass_balance=zeros(md.mesh.numberofvertices,1);
+ md.basalforcings.melting_rate=zeros(md.mesh.numberofvertices,1);
+ md.basalforcings.geothermalflux=zeros(md.mesh.numberofvertices,1);
+@@ -57,16 +58,26 @@
+ 
+ %Go solve
+ md.cluster=generic('np',3);
++md.stressbalance.shelf_dampening=1;
++md1=solve(md,TransientSolutionEnum());
++
++md.stressbalance.shelf_dampening=0;
+ md=solve(md,TransientSolutionEnum());
+ 
+ %Fields and tolerances to track changes
+ field_names     ={...
+ 	'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1',...
+ 	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2',...
+-	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3'};
++	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3',...
++	'Vx1_damp','Vy1_damp','Vel1_damp','Pressure1_damp','Bed1_damp','Surface1_damp','Thickness1_damp',...
++	'Vx2_damp','Vy2_damp','Vel2_damp','Pressure2_damp','Bed2_damp','Surface2_damp','Thickness2_damp',...
++	'Vx3_damp','Vy3_damp','Vel3_damp','Pressure3_damp','Bed3_damp','Surface3_damp','Thickness3_damp'};
+ field_tolerances={...
+ 	1e-08,1e-08,1e-08,1e-08,1e-10,1e-10,1e-10,...
+ 	1e-08,1e-08,1e-08,1e-08,1e-10,1e-10,1e-10,...
++	1e-08,1e-08,1e-08,1e-08,1e-10,1e-10,1e-10,...
++	1e-08,1e-08,1e-08,1e-08,1e-10,1e-10,1e-10,...
++	1e-08,1e-08,1e-08,1e-08,1e-10,1e-10,1e-10,...
+ 	1e-08,1e-08,1e-08,1e-08,1e-10,1e-10,1e-10};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
+@@ -90,4 +101,25 @@
+ 	(md.results.TransientSolution(3).Bed),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
++	(md1.results.TransientSolution(1).Vx),...
++	(md1.results.TransientSolution(1).Vy),...
++	(md1.results.TransientSolution(1).Vel),...
++	(md1.results.TransientSolution(1).Pressure),...
++	(md1.results.TransientSolution(1).Bed),...
++	(md1.results.TransientSolution(1).Surface),...
++	(md1.results.TransientSolution(1).Thickness),...
++	(md1.results.TransientSolution(2).Vx),...
++	(md1.results.TransientSolution(2).Vy),...
++	(md1.results.TransientSolution(2).Vel),...
++	(md1.results.TransientSolution(2).Pressure),...
++	(md1.results.TransientSolution(2).Bed),...
++	(md1.results.TransientSolution(2).Surface),...
++	(md1.results.TransientSolution(2).Thickness),...
++	(md1.results.TransientSolution(3).Vx),...
++	(md1.results.TransientSolution(3).Vy),...
++	(md1.results.TransientSolution(3).Vel),...
++	(md1.results.TransientSolution(3).Pressure),...
++	(md1.results.TransientSolution(3).Bed),...
++	(md1.results.TransientSolution(3).Surface),...
++	(md1.results.TransientSolution(3).Thickness),...
+ 	};
+Index: ../trunk-jpl/test/Archives/Archive703.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17415-17416.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17415-17416.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17415-17416.diff	(revision 17802)
@@ -0,0 +1,19 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17415)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17416)
+@@ -326,8 +326,12 @@
+ 			}
+ 
+ 			/*P1 pressure*/
+-	      if(iomodel->meshtype==Mesh3DEnum) numberoffaces=iomodel->numberoffaces;
+-			else numberoffaces=0;
++	      if(iomodel->meshtype==Mesh3DEnum){
++				numberoffaces=iomodel->numberoffaces;
++			}
++			else{
++				numberoffaces=iomodel->numberoffaces;
++			}
+ 			vnodes = id0+numberoffaces;
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
Index: issm/oecreview/Archive/16554-17801/ISSM-17416-17417.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17416-17417.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17416-17417.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17416)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17417)
+@@ -333,7 +333,7 @@
+ 				numberoffaces=iomodel->numberoffaces;
+ 			}
+ 			vnodes = id0+numberoffaces;
+-			for(i=0;i<iomodel->numberofvertices;i++){
++			for(i=0;i<numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+ 					nodes->AddObject(new Node(vnodes+i+1,iomodel->numberofvertices+iomodel->numberofedges+numberoffaces+i,lid++,i,iomodel,analysis,FSpressureEnum));
+ 				}
Index: issm/oecreview/Archive/16554-17801/ISSM-17417-17418.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17417-17418.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17417-17418.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17417)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17418)
+@@ -333,7 +333,7 @@
+ 				numberoffaces=iomodel->numberoffaces;
+ 			}
+ 			vnodes = id0+numberoffaces;
+-			for(i=0;i<numberofvertices;i++){
++			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+ 					nodes->AddObject(new Node(vnodes+i+1,iomodel->numberofvertices+iomodel->numberofedges+numberoffaces+i,lid++,i,iomodel,analysis,FSpressureEnum));
+ 				}
Index: issm/oecreview/Archive/16554-17801/ISSM-17418-17419.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17418-17419.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17418-17419.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17418)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17419)
+@@ -330,7 +330,7 @@
+ 				numberoffaces=iomodel->numberoffaces;
+ 			}
+ 			else{
+-				numberoffaces=iomodel->numberoffaces;
++				numberoffaces=0;
+ 			}
+ 			vnodes = id0+numberoffaces;
+ 			for(i=0;i<iomodel->numberofvertices;i++){
Index: issm/oecreview/Archive/16554-17801/ISSM-17419-17420.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17419-17420.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17419-17420.diff	(revision 17802)
@@ -0,0 +1,101 @@
+Index: ../trunk-jpl/test/NightlyRun/test204.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test204.py	(revision 17419)
++++ ../trunk-jpl/test/NightlyRun/test204.py	(revision 17420)
+@@ -14,6 +14,10 @@
+ md.extrude(3,2.)
+ md=setflowequation(md,'FS','all')
+ md.cluster=generic('name',oshostname(),'np',3)
++md.stressbalance.shelf_dampening=1;
++md.timestepping.time_step=0;
++md1=solve(md,StressbalanceSolutionEnum())
++md.stressbalance.shelf_dampening=0;
+ md=solve(md,StressbalanceSolutionEnum())
+ 
+ 
+Index: ../trunk-jpl/test/NightlyRun/test204.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test204.m	(revision 17419)
++++ ../trunk-jpl/test/NightlyRun/test204.m	(revision 17420)
+@@ -3,16 +3,25 @@
+ md=parameterize(md,'../Par/SquareShelf.par');
+ md=extrude(md,3,2.);
+ md=setflowequation(md,'FS','all');
+-md.cluster=generic('name',oshostname(),'np',3);
++md.cluster=generic('name',oshostname(),'np',1);
++md.stressbalance.shelf_dampening=1;
++md.timestepping.time_step=0;
++md1=solve(md,StressbalanceSolutionEnum());
++md.stressbalance.shelf_dampening=0;
+ md=solve(md,StressbalanceSolutionEnum());
+ 
+ %Fields and tolerances to track changes
+-field_names     ={'Vx','Vy','Vz','Vel','Pressure'};
+-field_tolerances={1e-08,1e-08,2e-07,1e-08,1e-08};
++field_names     ={'Vx','Vy','Vz','Vel','Pressure','Vx_damp','Vy_damp','Vz_damp','Vel_damp','Pressure_damp'};
++field_tolerances={1e-08,1e-08,2e-07,1e-08,1e-08,1e-08,1e-08,2e-07,1e-08,1e-08};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+ 	(md.results.StressbalanceSolution.Vz),...
+ 	(md.results.StressbalanceSolution.Vel),...
+ 	(md.results.StressbalanceSolution.Pressure),...
++	(md1.results.StressbalanceSolution.Vx),...
++	(md1.results.StressbalanceSolution.Vy),...
++	(md1.results.StressbalanceSolution.Vz),...
++	(md1.results.StressbalanceSolution.Vel),...
++	(md1.results.StressbalanceSolution.Pressure),...
+ 	};
+Index: ../trunk-jpl/test/Archives/Archive204.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17419)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17420)
+@@ -2997,8 +2997,9 @@
+ 	bool        mainlyfloating;
+ 	int         j,i,meshtype,dim;
+ 	IssmDouble  Jdet,slope2,scalar,dt;
+-	IssmDouble  slope[2];
++	IssmDouble  slope[3];
+ 	IssmDouble *xyz_list_base = NULL;
++	IssmDouble *xyz_list      = NULL;
+ 	Gauss*      gauss         = NULL;
+ 
+ 	/*Get problem dimension*/
+@@ -3020,6 +3021,7 @@
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinatesBase(&xyz_list_base);
++	element->GetVerticesCoordinates(&xyz_list);
+ 	element->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	if(dt==0)   dt=1.e+5;
+ 	IssmDouble  rho_water     = element->GetMaterialParameter(MaterialsRhoWaterEnum);
+@@ -3031,7 +3033,7 @@
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		gauss->GaussPoint(ig);
+ 
+-		surface_input->GetInputDerivativeValue(&slope[0],xyz_list_base,gauss);
++		surface_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
+ 		element->NodalFunctionsVelocity(vbasis,gauss);
+ 		element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
+ 		if(dim==2) slope2=slope[0]*slope[0];
+@@ -3039,7 +3041,7 @@
+ 		scalar  = rho_water*gravity*sqrt(1+slope2)*gauss->weight*Jdet*dt; 
+ 		for(i=0;i<vnumnodes;i++){
+ 			for(j=0;j<vnumnodes;j++){
+-				Ke->values[numdof*(i*dim+1)+j*dim+1] += scalar*vbasis[i]*vbasis[j];
++				Ke->values[numdof*((i+1)*dim-1)+(j+1)*dim-1] += scalar*vbasis[i]*vbasis[j];
+ 			}
+ 		}
+ 	}
+@@ -3049,6 +3051,7 @@
+ 	/*Clean up and return*/
+ 	delete gauss;
+ 	xDelete<IssmDouble>(xyz_list_base);
++	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(vbasis);
+ 	return Ke;
+ }/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17420-17421.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17420-17421.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17420-17421.diff	(revision 17802)
@@ -0,0 +1,23 @@
+Index: ../trunk-jpl/src/c/shared/Numerics/GaussPoints.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Numerics/GaussPoints.cpp	(revision 17420)
++++ ../trunk-jpl/src/c/shared/Numerics/GaussPoints.cpp	(revision 17421)
+@@ -1252,6 +1252,9 @@
+ 	static IssmPDouble l13[]={
+ 		0.250000000000000, 0.500000000000000, 0.166666666666667, 
+ 		0.166666666666667, 0.166666666666667};
++	static IssmPDouble l23[]={
++		0.250000000000000, 0.166666666666667, 0.500000000000000, 
++		0.166666666666667, 0.166666666666667};
+ 	static IssmPDouble l33[]={
+ 		0.250000000000000, 0.166666666666667, 0.166666666666667, 
+ 		0.500000000000000, 0.166666666666667};
+@@ -1375,7 +1378,7 @@
+ 
+ 	static IssmPDouble* wgtp[MAX_TETRA_SYM_ORD]={wgt1,wgt2,wgt3,wgt4,wgt5,wgt6};
+ 	static IssmPDouble* l1p [MAX_TETRA_SYM_ORD]={l11 ,l12 ,l13 ,l14 ,l15 ,l16 };
+-	static IssmPDouble* l2p [MAX_TETRA_SYM_ORD]={l21 ,l22 ,l32 ,l24 ,l25 ,l26 };
++	static IssmPDouble* l2p [MAX_TETRA_SYM_ORD]={l21 ,l22 ,l23 ,l24 ,l25 ,l26 };
+ 	static IssmPDouble* l3p [MAX_TETRA_SYM_ORD]={l31 ,l32 ,l33 ,l34 ,l35 ,l36 };
+ 	static IssmPDouble* l4p [MAX_TETRA_SYM_ORD]={l41 ,l42 ,l43 ,l44 ,l45 ,l46 };
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17421-17422.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17421-17422.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17421-17422.diff	(revision 17802)
@@ -0,0 +1,368 @@
+Index: ../trunk-jpl/test/NightlyRun/test332.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test332.m	(revision 17421)
++++ ../trunk-jpl/test/NightlyRun/test332.m	(revision 17422)
+@@ -4,6 +4,7 @@
+ md=setflowequation(md,'SSA','all');
+ md.cluster=generic('name',oshostname(),'np',1);
+ md.hydrology=(hydrologydc);
++md.hydrology=initialize(md.hydrology,md);
+ md.hydrology.isefficientlayer=0;
+ md.hydrology.sedimentlimit_flag=1;
+ md.hydrology.sedimentlimit=8000.0;
+Index: ../trunk-jpl/test/NightlyRun/test333.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test333.m	(revision 17421)
++++ ../trunk-jpl/test/NightlyRun/test333.m	(revision 17422)
+@@ -4,6 +4,7 @@
+ md=setflowequation(md,'SSA','all');
+ md.cluster=generic('name',oshostname(),'np',1);
+ md.hydrology=(hydrologydc);
++md.hydrology=initialize(md.hydrology,md);
+ md.hydrology.isefficientlayer=1;
+ md.hydrology.sedimentlimit_flag=1;
+ md.hydrology.sedimentlimit=800.0;
+Index: ../trunk-jpl/test/NightlyRun/test3300.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test3300.m	(revision 17421)
++++ ../trunk-jpl/test/NightlyRun/test3300.m	(revision 17422)
+@@ -4,6 +4,7 @@
+ md=setflowequation(md,'SSA','all');
+ md.cluster=generic('name',oshostname(),'np',1);
+ md.hydrology=(hydrologydc);
++md.hydrology=initialize(md.hydrology,md);
+ md.hydrology.isefficientlayer=1;
+ md.hydrology.sedimentlimit_flag=1;
+ md.hydrology.sedimentlimit=400.0;
+Index: ../trunk-jpl/test/NightlyRun/test334.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test334.m	(revision 17421)
++++ ../trunk-jpl/test/NightlyRun/test334.m	(revision 17422)
+@@ -4,6 +4,7 @@
+ md=setflowequation(md,'SSA','all');
+ md.cluster=generic('name',oshostname(),'np',1);
+ md.hydrology=(hydrologydc);
++md.hydrology=initialize(md.hydrology,md);
+ md.hydrology.isefficientlayer=0;
+ md.hydrology.sedimentlimit_flag=1;
+ md.hydrology.sedimentlimit=8000.0;
+Index: ../trunk-jpl/test/NightlyRun/test335.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test335.m	(revision 17421)
++++ ../trunk-jpl/test/NightlyRun/test335.m	(revision 17422)
+@@ -4,6 +4,7 @@
+ md=setflowequation(md,'SSA','all');
+ md.cluster=generic('name',oshostname(),'np',1);
+ md.hydrology=(hydrologydc);
++md.hydrology=initialize(md.hydrology,md);
+ md.hydrology.isefficientlayer=1;
+ md.hydrology.sedimentlimit_flag=1;
+ md.hydrology.sedimentlimit=800.0;
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17421)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17422)
+@@ -85,6 +85,7 @@
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
+ 	iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
++	iomodel->FetchDataToInput(elements,HydrologydcBasalMoulinInputEnum);
+ 	iomodel->FetchDataToInput(elements,SedimentHeadEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcSedimentTransmitivityEnum);
+ 
+@@ -277,7 +278,8 @@
+ 
+ 	/*Intermediaries */
+ 	bool       active_element,isefficientlayer;
+-	IssmDouble dt,scalar,water_head;
++	IssmDouble dt,scalar;
++	IssmDouble moulin_load,water_head;
+ 	IssmDouble water_load,transfer;
+ 	IssmDouble Jdet;
+ 
+@@ -303,8 +305,9 @@
+ 	Input* sed_trans_input   = basalelement->GetInput(HydrologydcSedimentTransmitivityEnum);
+ 	Input* thickness_input   = basalelement->GetInput(ThicknessEnum);
+ 	Input* bed_input         = basalelement->GetInput(BedEnum);
+-	Input* water_input       = basalelement->GetInput(BasalforcingsMeltingRateEnum); _assert_(water_input);
+-	if(dt!= 0.){old_wh_input = basalelement->GetInput(SedimentHeadOldEnum);          _assert_(old_wh_input);}
++	Input* water_input       = basalelement->GetInput(BasalforcingsMeltingRateEnum);    _assert_(water_input);
++	Input* moulin_input      = basalelement->GetInput(HydrologydcBasalMoulinInputEnum); _assert_(moulin_input);
++	if(dt!= 0.){old_wh_input = basalelement->GetInput(SedimentHeadOldEnum);             _assert_(old_wh_input);}
+ 
+ 	IssmDouble sediment_storing    = SedimentStoring(basalelement);
+ 
+@@ -323,8 +326,10 @@
+ 
+ 		/*Loading term*/
+ 		water_input->GetInputValue(&water_load,gauss);
++		moulin_input->GetInputValue(&moulin_load,gauss);
+ 	
+ 		scalar = Jdet*gauss->weight*(water_load);
++		scalar = scalar + Jdet* moulin_load;
+ 		if(dt!=0.) scalar = scalar*dt;
+ 		for(int i=0;i<numnodes;i++){
+ 			pe->values[i]+=scalar*basis[i];
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17421)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17422)
+@@ -125,6 +125,7 @@
+ 	HydrologydcLeakageFactorEnum,
+ 	HydrologydcPenaltyFactorEnum,
+ 	HydrologydcPenaltyLockEnum,
++	HydrologydcBasalMoulinInputEnum,
+ 	HydrologyLayerEnum,
+ 	HydrologySedimentEnum,
+ 	HydrologyEfficientEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17421)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17422)
+@@ -133,6 +133,7 @@
+ 		case HydrologydcLeakageFactorEnum : return "HydrologydcLeakageFactor";
+ 		case HydrologydcPenaltyFactorEnum : return "HydrologydcPenaltyFactor";
+ 		case HydrologydcPenaltyLockEnum : return "HydrologydcPenaltyLock";
++		case HydrologydcBasalMoulinInputEnum : return "HydrologydcBasalMoulinInput";
+ 		case HydrologyLayerEnum : return "HydrologyLayer";
+ 		case HydrologySedimentEnum : return "HydrologySediment";
+ 		case HydrologyEfficientEnum : return "HydrologyEfficient";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17421)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17422)
+@@ -133,13 +133,14 @@
+ 	      else if (strcmp(name,"HydrologydcLeakageFactor")==0) return HydrologydcLeakageFactorEnum;
+ 	      else if (strcmp(name,"HydrologydcPenaltyFactor")==0) return HydrologydcPenaltyFactorEnum;
+ 	      else if (strcmp(name,"HydrologydcPenaltyLock")==0) return HydrologydcPenaltyLockEnum;
++	      else if (strcmp(name,"HydrologydcBasalMoulinInput")==0) return HydrologydcBasalMoulinInputEnum;
+ 	      else if (strcmp(name,"HydrologyLayer")==0) return HydrologyLayerEnum;
+ 	      else if (strcmp(name,"HydrologySediment")==0) return HydrologySedimentEnum;
+-	      else if (strcmp(name,"HydrologyEfficient")==0) return HydrologyEfficientEnum;
+          else stage=2;
+    }
+    if(stage==2){
+-	      if (strcmp(name,"HydrologySedimentKmax")==0) return HydrologySedimentKmaxEnum;
++	      if (strcmp(name,"HydrologyEfficient")==0) return HydrologyEfficientEnum;
++	      else if (strcmp(name,"HydrologySedimentKmax")==0) return HydrologySedimentKmaxEnum;
+ 	      else if (strcmp(name,"IndependentObject")==0) return IndependentObjectEnum;
+ 	      else if (strcmp(name,"InversionControlParameters")==0) return InversionControlParametersEnum;
+ 	      else if (strcmp(name,"InversionCostFunctionThreshold")==0) return InversionCostFunctionThresholdEnum;
+@@ -258,11 +259,11 @@
+ 	      else if (strcmp(name,"ProfilingSolutionTime")==0) return ProfilingSolutionTimeEnum;
+ 	      else if (strcmp(name,"MaxIterationConvergenceFlag")==0) return MaxIterationConvergenceFlagEnum;
+ 	      else if (strcmp(name,"SteadystateMaxiter")==0) return SteadystateMaxiterEnum;
+-	      else if (strcmp(name,"SteadystateNumRequestedOutputs")==0) return SteadystateNumRequestedOutputsEnum;
+          else stage=3;
+    }
+    if(stage==3){
+-	      if (strcmp(name,"SteadystateReltol")==0) return SteadystateReltolEnum;
++	      if (strcmp(name,"SteadystateNumRequestedOutputs")==0) return SteadystateNumRequestedOutputsEnum;
++	      else if (strcmp(name,"SteadystateReltol")==0) return SteadystateReltolEnum;
+ 	      else if (strcmp(name,"SteadystateRequestedOutputs")==0) return SteadystateRequestedOutputsEnum;
+ 	      else if (strcmp(name,"Surface")==0) return SurfaceEnum;
+ 	      else if (strcmp(name,"ThermalIsenthalpy")==0) return ThermalIsenthalpyEnum;
+@@ -381,11 +382,11 @@
+ 	      else if (strcmp(name,"Materials")==0) return MaterialsEnum;
+ 	      else if (strcmp(name,"Nodes")==0) return NodesEnum;
+ 	      else if (strcmp(name,"Contours")==0) return ContoursEnum;
+-	      else if (strcmp(name,"Parameters")==0) return ParametersEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"Vertices")==0) return VerticesEnum;
++	      if (strcmp(name,"Parameters")==0) return ParametersEnum;
++	      else if (strcmp(name,"Vertices")==0) return VerticesEnum;
+ 	      else if (strcmp(name,"Results")==0) return ResultsEnum;
+ 	      else if (strcmp(name,"GenericParam")==0) return GenericParamEnum;
+ 	      else if (strcmp(name,"AdolcParam")==0) return AdolcParamEnum;
+@@ -504,11 +505,11 @@
+ 	      else if (strcmp(name,"Vz")==0) return VzEnum;
+ 	      else if (strcmp(name,"VzSSA")==0) return VzSSAEnum;
+ 	      else if (strcmp(name,"VzHO")==0) return VzHOEnum;
+-	      else if (strcmp(name,"VzPicard")==0) return VzPicardEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"VzFS")==0) return VzFSEnum;
++	      if (strcmp(name,"VzPicard")==0) return VzPicardEnum;
++	      else if (strcmp(name,"VzFS")==0) return VzFSEnum;
+ 	      else if (strcmp(name,"VxMesh")==0) return VxMeshEnum;
+ 	      else if (strcmp(name,"VyMesh")==0) return VyMeshEnum;
+ 	      else if (strcmp(name,"VzMesh")==0) return VzMeshEnum;
+@@ -627,11 +628,11 @@
+ 	      else if (strcmp(name,"LockFileName")==0) return LockFileNameEnum;
+ 	      else if (strcmp(name,"ToolkitsOptionsAnalyses")==0) return ToolkitsOptionsAnalysesEnum;
+ 	      else if (strcmp(name,"ToolkitsOptionsStrings")==0) return ToolkitsOptionsStringsEnum;
+-	      else if (strcmp(name,"QmuErrName")==0) return QmuErrNameEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"QmuInName")==0) return QmuInNameEnum;
++	      if (strcmp(name,"QmuErrName")==0) return QmuErrNameEnum;
++	      else if (strcmp(name,"QmuInName")==0) return QmuInNameEnum;
+ 	      else if (strcmp(name,"QmuOutName")==0) return QmuOutNameEnum;
+ 	      else if (strcmp(name,"Regular")==0) return RegularEnum;
+ 	      else if (strcmp(name,"Scaled")==0) return ScaledEnum;
+Index: ../trunk-jpl/src/m/classes/hydrologydc.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/hydrologydc.m	(revision 17421)
++++ ../trunk-jpl/src/m/classes/hydrologydc.m	(revision 17422)
+@@ -15,6 +15,7 @@
+ 		sedimentlimit            = 0;
+ 		transfer_flag            = 0;
+ 		leakage_factor           = 0;
++		basal_moulin_input       = NaN;
+ 
+ 		spcsediment_head         = NaN;
+ 		sediment_transmitivity   = NaN;
+@@ -41,6 +42,13 @@
+ 	    end
+ 		end 
+ 		% }}}
++		function self = initialize(self,md) % {{{
++			if isnan(self.basal_moulin_input),
++				self.basal_moulin_input=zeros(md.mesh.numberofvertices,1);
++				disp('      no hydrology.basal_moulin_input specified: values set as zero');
++			end
++
++		end % }}}
+ 		% {{{ function obj = setdefaultparameters(obj) 
+ 		function obj = setdefaultparameters(obj) 
+ 
+@@ -87,6 +95,7 @@
+ 			if obj.transfer_flag==1,
+ 				md = checkfield(md,'fieldname','hydrology.leakage_factor','>',0,'numel',1);
+ 	    end
++			md = checkfield(md,'fieldname','hydrology.basal_moulin_input','NaN',1,'forcing',1);
+ 
+ 			md = checkfield(md,'fieldname','hydrology.spcsediment_head','forcing',1);
+ 			md = checkfield(md,'fieldname','hydrology.sediment_compressibility','>',0,'numel',1);
+@@ -128,6 +137,7 @@
+ 			if obj.transfer_flag==1,
+ 				fielddisplay(obj,'leakage_factor','user defined leakage factor [m]');
+ 	    end
++			fielddisplay(obj,'basal_moulin_input','Figure out what it is');
+ 			disp(sprintf('   - for the sediment layer'));
+ 			fielddisplay(obj,'spcsediment_head','sediment water head constraints (NaN means no constraint) [m above MSL]');
+ 			fielddisplay(obj,'sediment_compressibility','sediment compressibility [Pa^-1]');
+@@ -164,6 +174,7 @@
+ 			if obj.transfer_flag==1,
+ 				WriteData(fid,'object',obj,'fieldname','leakage_factor','format','Double');
+ 	    end
++			WriteData(fid,'object',obj,'fieldname','basal_moulin_input','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1)
+ 
+ 			WriteData(fid,'object',obj,'fieldname','spcsediment_head','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
+ 			WriteData(fid,'object',obj,'fieldname','sediment_compressibility','format','Double');			
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17421)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17422)
+@@ -726,11 +726,14 @@
+ 			md.damage.spcdamage=project3d(md,'vector',md.damage.spcdamage,'type','node');
+ 			md.stressbalance.referential=project3d(md,'vector',md.stressbalance.referential,'type','node');
+ 			md.stressbalance.loadingforce=project3d(md,'vector',md.stressbalance.loadingforce,'type','node');
++
++			% Hydrologydc variables
+ 			if isa(md.hydrology,'hydrologydc');
+ 				md.hydrology.spcsediment_head=project3d(md,'vector',md.hydrology.spcsediment_head,'type','node','layer',1);
+ 				md.hydrology.spcepl_head=project3d(md,'vector',md.hydrology.spcepl_head,'type','node','layer',1);
+ 				md.hydrology.mask_eplactive_node=project3d(md,'vector',md.hydrology.mask_eplactive_node,'type','node','layer',1);
+ 				md.hydrology.sediment_transmitivity=project3d(md,'vector',md.hydrology.sediment_transmitivity,'type','node','layer',1);
++				md.hydrology.basal_moulin_input=project3d(md,'vector',md.hydrology.basal_moulin_input,'type','node','layer',1);
+ 	    end
+ 
+ 			%connectivity
+Index: ../trunk-jpl/src/m/contrib/paraview/exportVTK.m
+===================================================================
+--- ../trunk-jpl/src/m/contrib/paraview/exportVTK.m	(revision 17421)
++++ ../trunk-jpl/src/m/contrib/paraview/exportVTK.m	(revision 17422)
+@@ -59,33 +59,33 @@
+ 	
+ 	timestep=step;
+ 
+-	FID = fopen(strcat(path,filesep,name,filesep,name,'.vtk',int2str(timestep),'.vtk'),'w+');
+-	fprintf(FID,'# vtk DataFile Version 2.0 \n');
+-	fprintf(FID,'Data for run %s \n',model.miscellaneous.name);
+-	fprintf(FID,'ASCII \n');
+-	fprintf(FID,'DATASET UNSTRUCTURED_GRID \n');
++	fid = fopen(strcat(path,filesep,name,filesep,name,'.vtk',int2str(timestep),'.vtk'),'w+');
++	fprintf(fid,'# vtk DataFile Version 2.0 \n');
++	fprintf(fid,'Data for run %s \n',model.miscellaneous.name);
++	fprintf(fid,'ASCII \n');
++	fprintf(fid,'DATASET UNSTRUCTURED_GRID \n');
+ 	
+-	fprintf(FID,'POINTS %d float\n',num_of_points);
++	fprintf(fid,'POINTS %d float\n',num_of_points);
+ 	if(dim==3);
+ 		s='%f %f %f \n';
+ 	elseif(dim==2);
+ 		s='%f %f \n';
+   end
+ 	P=[points zeros(num_of_points,3-dim)];
+-	fprintf(FID,s,P');
++	fprintf(fid,s,P');
+ 	
+-	fprintf(FID,'CELLS %d %d\n',num_of_elt,num_of_elt*(point_per_elt+1));
++	fprintf(fid,'CELLS %d %d\n',num_of_elt,num_of_elt*(point_per_elt+1));
+ 	s='%d';
+ 	for j=1:point_per_elt
+ 		s=horzcat(s,{' %d'});
+   end
+ 	s=cell2mat(horzcat(s,{'\n'}));
+-	fprintf(FID,s,[(point_per_elt)*ones(num_of_elt,1) model.mesh.elements-1]');
++	fprintf(fid,s,[(point_per_elt)*ones(num_of_elt,1) model.mesh.elements-1]');
+ 	
+-	fprintf(FID,'CELL_TYPES %d\n',num_of_elt);
++	fprintf(fid,'CELL_TYPES %d\n',num_of_elt);
+ 	s='%d\n';
+-	fprintf(FID,s,celltype*ones(num_of_elt,1));
+-	fprintf(FID,'POINT_DATA %s \n',num2str(num_of_points));
++	fprintf(fid,s,celltype*ones(num_of_elt,1));
++	fprintf(fid,'POINT_DATA %s \n',num2str(num_of_points));
+ 
+ 	%loop over the different solution structures
+ 	if (exist('num_of_sols'));
+@@ -111,10 +111,10 @@
+ 					%also checking for verry small value that mess up
+ 					smallval=(abs(sol_struct{j}(timestep).(fieldnames{k}))<1.0e-20);
+ 					sol_struct{j}(timestep).(fieldnames{k})(smallval)=0.0;
+-					fprintf(FID,'SCALARS %s float 1 \n',fieldnames{k});
+-					fprintf(FID,'LOOKUP_TABLE default\n');
++					fprintf(fid,'SCALARS %s float 1 \n',fieldnames{k});
++					fprintf(fid,'LOOKUP_TABLE default\n');
+ 					s='%e\n';
+-					fprintf(FID,s,sol_struct{j}(timestep).(fieldnames{k}));
++					fprintf(fid,s,sol_struct{j}(timestep).(fieldnames{k}));
+ 		    end		
+ 	    end 
+ 	  end
+@@ -133,12 +133,12 @@
+ 				%also checking for verry small value that mess up
+ 				smallval=(abs(res_struct.(fieldnames{k}))<1.0e-20);
+ 				res_struct.(fieldnames{k})(smallval)=0.0;
+-				fprintf(FID,'SCALARS %s float 1 \n',fieldnames{k});
+-				fprintf(FID,'LOOKUP_TABLE default\n');
++				fprintf(fid,'SCALARS %s float 1 \n',fieldnames{k});
++				fprintf(fid,'LOOKUP_TABLE default\n');
+ 				s='%e\n';
+-				fprintf(FID,s,res_struct.(fieldnames{k}));
++				fprintf(fid,s,res_struct.(fieldnames{k}));
+ 	    end		
+ 		end 
+ 	end
+-	fclose(FID);
++	fclose(fid);
+ end
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17421)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17422)
+@@ -125,6 +125,7 @@
+ def HydrologydcLeakageFactorEnum(): return StringToEnum("HydrologydcLeakageFactor")[0]
+ def HydrologydcPenaltyFactorEnum(): return StringToEnum("HydrologydcPenaltyFactor")[0]
+ def HydrologydcPenaltyLockEnum(): return StringToEnum("HydrologydcPenaltyLock")[0]
++def HydrologydcBasalMoulinInputEnum(): return StringToEnum("HydrologydcBasalMoulinInput")[0]
+ def HydrologyLayerEnum(): return StringToEnum("HydrologyLayer")[0]
+ def HydrologySedimentEnum(): return StringToEnum("HydrologySediment")[0]
+ def HydrologyEfficientEnum(): return StringToEnum("HydrologyEfficient")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17424-17425.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17424-17425.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17424-17425.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17424)
++++ ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17425)
+@@ -57,7 +57,7 @@
+ 	if(VerboseSolution()) _printf0_("extrapolation of " << EnumToStringx(extvar_enum) << ": call computational core:\n");
+ 	solutionsequence_linear(femmodel);
+ 
+-	save_results=false;
++	save_results=true;
+ 	if(save_results){
+ 		if(VerboseSolution()) _printf0_("   saving results\n");
+ 		int outputs[2] = {VxEnum,VyEnum};
Index: issm/oecreview/Archive/16554-17801/ISSM-17425-17426.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17425-17426.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17425-17426.diff	(revision 17802)
@@ -0,0 +1,183 @@
+Index: ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17425)
++++ ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17426)
+@@ -32,7 +32,9 @@
+ /*}}}*/
+ void ExtrapolationAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 	int finiteelement=P1Enum;
++	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,ExtrapolationAnalysisEnum,finiteelement);
++	iomodel->DeleteData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
+ }
+ /*}}}*/
+ void ExtrapolationAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+@@ -75,39 +77,52 @@
+ }/*}}}*/
+ ElementMatrix* ExtrapolationAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
++	if(!element->IsOnBed()) return NULL;
++	Element* basalelement = element->SpawnBasalElement();
++
+ 	/*Intermediaries */
+-	const int dim = 2;
++	int		  meshtype,dim;
+ 	int        i,row,col,stabilization;
+ 	bool	   extrapolatebydiffusion = true;
+ 	IssmDouble Jdet,D_scalar,h;
+-	IssmDouble dlsf[dim],normal[dim];
+ 	IssmDouble norm_dlsf;
+ 	IssmDouble hx,hy,hz,kappa;
+ 	IssmDouble* xyz_list = NULL;
+ 
++	/*Get problem dimension*/
++	basalelement->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum:   dim = 1; break;
++		case Mesh2DhorizontalEnum: dim = 2; break;
++		case Mesh3DEnum:           dim = 2; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
+ 	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = element->GetNumberOfNodes();
++	int numnodes = basalelement->GetNumberOfNodes();
+ 
+ 	/*Initialize Element vector and other vectors*/
+-	ElementMatrix* Ke     = element->NewElementMatrix();
++	ElementMatrix* Ke     = basalelement->NewElementMatrix();
+ 	IssmDouble*    B      = xNew<IssmDouble>(dim*numnodes);
+ 	IssmDouble*    Bprime = xNew<IssmDouble>(dim*numnodes);
+-	IssmDouble     D[dim][dim];
++	IssmDouble*		dlsf   = xNew<IssmDouble>(dim);
++	IssmDouble*		normal = xNew<IssmDouble>(dim);
++	IssmDouble*    D		 = xNew<IssmDouble>(dim*dim);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	Input* lsf_slopex_input=element->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
+-	Input* lsf_slopey_input=element->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+-	element->GetVerticesCoordinates(&xyz_list);
+-	h = element->CharacteristicLength();
++	Input* lsf_slopex_input=basalelement->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
++	Input* lsf_slopey_input=basalelement->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
++	basalelement->GetVerticesCoordinates(&xyz_list);
++	h = basalelement->CharacteristicLength();
+ 
+ 	/* Start  looping on the number of gaussian points: */
+-	Gauss* gauss=element->NewGauss(2);
++	Gauss* gauss=basalelement->NewGauss(2);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){/*{{{*/
+ 		gauss->GaussPoint(ig);
+ 
+-		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+-		GetB(B,element,xyz_list,gauss);
+-		GetBprime(Bprime,element,xyz_list,gauss);
++		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		GetB(B,basalelement,xyz_list,gauss);
++		GetBprime(Bprime,basalelement,xyz_list,gauss);
+ 		
+ 		D_scalar=gauss->weight*Jdet;
+ 
+@@ -116,12 +131,12 @@
+ 			for(row=0;row<dim;row++)
+ 				for(col=0;col<dim;col++)
+ 					if(row==col)
+-						D[row][col] = D_scalar;
++						D[row*dim+col] = D_scalar;
+ 					else
+-						D[row][col] = 0.;
++						D[row*dim+col] = 0.;
+ 
+ 			TripleMultiply(Bprime,dim,numnodes,1,
+-					&D[0][0],dim,dim,0,
++					D,dim,dim,0,
+ 					Bprime,dim,numnodes,0,
+ 					&Ke->values[0],1);
+ 		}
+@@ -142,11 +157,11 @@
+ 			for(row=0;row<dim;row++)
+ 				for(col=0;col<dim;col++)
+ 					if(row==col)
+-						D[row][col]=D_scalar*normal[row];
++						D[row*dim+col] = D_scalar*normal[row];
+ 					else
+-						D[row][col]=0.;
++						D[row*dim+col] = 0.;
+ 			TripleMultiply(B,dim,numnodes,1,
+-						&D[0][0],dim,dim,0,
++						D,dim,dim,0,
+ 						Bprime,dim,numnodes,0,
+ 						&Ke->values[0],1);
+ 
+@@ -155,15 +170,17 @@
+ 			if (stabilization==0){/* no stabilization, do nothing*/}
+ 			else if(stabilization==1){
+ 				/* Artificial Diffusion */
+-				element->ElementSizes(&hx,&hy,&hz);
++				basalelement->ElementSizes(&hx,&hy,&hz);
+ 				h=sqrt( pow(hx*normal[0],2) + pow(hy*normal[1],2));
+ 				kappa=h/2.+1.e-14; 
+-				D[0][0]=D_scalar*kappa;
+-				D[0][1]=0.;
+-				D[1][0]=0.;
+-				D[1][1]=D_scalar*kappa;
++				for(row=0;row<dim;row++)
++					for(col=0;col<dim;col++)
++						if(row==col)
++							D[row*dim+col] = D_scalar*kappa;
++						else
++							D[row*dim+col] = 0.;
+ 				TripleMultiply(Bprime,dim,numnodes,1,
+-							&D[0][0],dim,dim,0,
++							D,dim,dim,0,
+ 							Bprime,dim,numnodes,0,
+ 							&Ke->values[0],1);
+ 			}
+@@ -171,34 +188,43 @@
+ 				/*Streamline upwinding - do not use this for extrapolation: yields oscillating results due to smoothing along normal, not across */
+ 				for(row=0;row<dim;row++)
+ 					for(col=0;col<dim;col++)
+-						D[row][col]=h/(2.*1.)*normal[row]*normal[col];
++						D[row*dim+col]=h/(2.*1.)*normal[row]*normal[col];
+ 
+ 				TripleMultiply(Bprime,dim,numnodes,1,
+-							&D[0][0],dim,dim,0,
++							D,dim,dim,0,
+ 							Bprime,dim,numnodes,0,
+ 							&Ke->values[0],1);
+ 			}/*}}}*/
+ 		}
+ 	}/*}}}*/
+ 
++	//TESTING
++	_printf_("in element: " << basalelement->Id() << "\n");
++	Ke->Echo();
++
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(B);
+ 	xDelete<IssmDouble>(Bprime);
++	xDelete<IssmDouble>(dlsf);
++	xDelete<IssmDouble>(normal);
+ 	delete gauss;
+ 	return Ke;
+ 
+ }/*}}}*/
+ ElementVector* ExtrapolationAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
++	if(!element->IsOnBed()) return NULL;
++	Element* basalelement = element->SpawnBasalElement();
++
+ 	/*Intermediaries */
+ 	int i;
+ 	
+ 	/*Fetch number of nodes */
+-	int numnodes = element->GetNumberOfNodes();
++	int numnodes = basalelement->GetNumberOfNodes();
+ 
+ 	/*Initialize Element vector*/
+-	ElementVector* pe = element->NewElementVector();
++	ElementVector* pe = basalelement->NewElementVector();
+ 	for(i=0;i<numnodes;i++) 
+ 		pe->values[i]=0.; 
+ 	return pe;
Index: issm/oecreview/Archive/16554-17801/ISSM-17426-17427.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17426-17427.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17426-17427.diff	(revision 17802)
@@ -0,0 +1,205 @@
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17426)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17427)
+@@ -28,17 +28,22 @@
+ 			counter++;
+ 		}
+ 	}
+-
++	
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,VxEnum);
+ 	iomodel->FetchDataToInput(elements,VyEnum);
+ 	iomodel->FetchDataToInput(elements,MasstransportCalvingrateEnum);
+ 	
++	if(iomodel->meshtype==Mesh3DEnum){
++		iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
++	}
+ }
+ /*}}}*/
+ void LevelsetAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 	int finiteelement=P1Enum;
++	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,LevelsetAnalysisEnum,finiteelement);
++	iomodel->DeleteData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
+ }
+ /*}}}*/
+ void LevelsetAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+@@ -91,8 +96,11 @@
+ }/*}}}*/
+ ElementMatrix* LevelsetAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
++	if(!element->IsOnBed()) return NULL;
++	Element* basalelement = element->SpawnBasalElement();
++
+ 	/*Intermediaries */
+-	int  dim = 2; // solve for LSF in horizontal plane only
++	int  dim, meshtype; // solve for LSF in horizontal plane only
+ 	int i, row, col;
+ 	IssmDouble kappa;
+ 	IssmDouble Jdet, dt, D_scalar;
+@@ -101,11 +109,20 @@
+ 	IssmDouble norm_dlsf;
+ 	IssmDouble* xyz_list = NULL;
+ 
++	/*Get problem dimension*/
++	basalelement->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum:   dim = 1; break;
++		case Mesh2DhorizontalEnum: dim = 2; break;
++		case Mesh3DEnum:           dim = 2; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
+ 	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes    = element->GetNumberOfNodes();
++	int numnodes    = basalelement->GetNumberOfNodes();
+ 
+ 	/*Initialize Element vector and other vectors*/
+-	ElementMatrix* Ke       = element->NewElementMatrix();
++	ElementMatrix* Ke       = basalelement->NewElementMatrix();
+ 	IssmDouble*    basis    = xNew<IssmDouble>(numnodes);
+ 	IssmDouble*    B        = xNew<IssmDouble>(dim*numnodes);
+ 	IssmDouble*    Bprime   = xNew<IssmDouble>(dim*numnodes);
+@@ -116,25 +133,39 @@
+ 	IssmDouble*    dlsf     = xNew<IssmDouble>(dim);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	element->GetVerticesCoordinates(&xyz_list);
+-	element->FindParam(&dt,TimesteppingTimeStepEnum);
+-	Input* vx_input  = element->GetInput(VxEnum);     _assert_(vx_input);
+-	Input* vy_input  = element->GetInput(VyEnum);     _assert_(vy_input);
+-	Input* lsf_slopex_input  = element->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
+-	Input* lsf_slopey_input  = element->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+-	Input* calvingrate_input  = element->GetInput(MasstransportCalvingrateEnum);     _assert_(calvingrate_input);
++	basalelement->GetVerticesCoordinates(&xyz_list);
++	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
++	Input* vx_input  = NULL;
++	Input* vy_input  = NULL;
++	Input* lsf_slopex_input  = basalelement->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
++	Input* lsf_slopey_input  = basalelement->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
++	Input* calvingrate_input  = basalelement->GetInput(MasstransportCalvingrateEnum);     _assert_(calvingrate_input);
++
++	if(meshtype==Mesh2DhorizontalEnum){
++		vx_input=basalelement->GetInput(VxEnum); _assert_(vx_input);
++		vy_input=basalelement->GetInput(VyEnum); _assert_(vy_input);
++	}
++	else{
++		if(dim==1){
++			vx_input=basalelement->GetInput(VxEnum); _assert_(vx_input);
++		}
++		if(dim==2){
++			vx_input=basalelement->GetInput(VxAverageEnum); _assert_(vx_input);
++			vy_input=basalelement->GetInput(VyAverageEnum); _assert_(vy_input);
++		}
++	}
+ 	
+ 	/* Start  looping on the number of gaussian points: */
+-	Gauss* gauss=element->NewGauss(2);
++	Gauss* gauss=basalelement->NewGauss(2);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		gauss->GaussPoint(ig);
+ 
+-		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
+ 		D_scalar=gauss->weight*Jdet;
+ 
+ 		/* Transient */
+ 		if(dt!=0.){
+-			element->NodalFunctions(basis,gauss);
++			basalelement->NodalFunctions(basis,gauss);
+ 			TripleMultiply(basis,numnodes,1,0,
+ 						&D_scalar,1,1,0,
+ 						basis,1,numnodes,0,
+@@ -143,8 +174,8 @@
+ 		}
+ 
+ 		/* Advection */
+-		GetB(B,element,xyz_list,gauss); 
+-		GetBprime(Bprime,element,xyz_list,gauss); 
++		GetB(B,basalelement,xyz_list,gauss); 
++		GetBprime(Bprime,basalelement,xyz_list,gauss); 
+ 		vx_input->GetInputValue(&v[0],gauss); // in 3D case, add mesh velocity 
+ 		vy_input->GetInputValue(&v[1],gauss); 
+ 		lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
+@@ -185,7 +216,7 @@
+ 				break;
+ 			case 1:
+ 				/* Artificial Diffusion */
+-				element->ElementSizes(&hx,&hy,&hz);
++				basalelement->ElementSizes(&hx,&hy,&hz);
+ 				h=sqrt( pow(hx*v[0]/vel,2) + pow(hy*v[1]/vel,2) ); 
+ 				kappa=h*vel/2.;
+ 				for(row=0;row<dim;row++)
+@@ -202,7 +233,7 @@
+ 				break;	
+ 			case 2:
+ 				/* Streamline Upwinding */
+-				element->ElementSizes(&hx,&hy,&hz);
++				basalelement->ElementSizes(&hx,&hy,&hz);
+ 				h=sqrt( pow(hx*v[0]/vel,2) + pow(hy*v[1]/vel,2) );
+ 				for(row=0;row<dim;row++) 
+ 					for(col=0;col<dim;col++) 
+@@ -228,40 +259,43 @@
+ 	xDelete<IssmDouble>(w);
+ 	xDelete<IssmDouble>(c);
+ 	xDelete<IssmDouble>(dlsf);
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	delete gauss;
+ 	return Ke;
+ }/*}}}*/
+ ElementVector* LevelsetAnalysis::CreatePVector(Element* element){/*{{{*/
++	
++	if(!element->IsOnBed()) return NULL;
++	Element* basalelement = element->SpawnBasalElement();
+ 
+ 	/*Intermediaries */
+-	const int dim = 2;
+-	int i, ig, k;
++	int i, ig, meshtype;
+ 	IssmDouble  Jdet,dt;
+ 	IssmDouble  lsf;
+ 	IssmDouble* xyz_list = NULL;
+ 	
+ 	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = element->GetNumberOfNodes();
++	int numnodes = basalelement->GetNumberOfNodes();
+ 
+ 	/*Initialize Element vector*/
+-	ElementVector* pe = element->NewElementVector();
+-	element->FindParam(&dt,TimesteppingTimeStepEnum);
++	ElementVector* pe = basalelement->NewElementVector();
++	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	
+ 	if(dt!=0.){
+ 		/*Initialize basis vector*/
+ 		IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+ 		/*Retrieve all inputs and parameters*/
+-		element->GetVerticesCoordinates(&xyz_list);
+-		Input* levelset_input     = element->GetInput(MaskIceLevelsetEnum);                    _assert_(levelset_input);
++		basalelement->GetVerticesCoordinates(&xyz_list);
++		Input* levelset_input     = basalelement->GetInput(MaskIceLevelsetEnum);                    _assert_(levelset_input);
+ 
+ 		/* Start  looping on the number of gaussian points: */
+-		Gauss* gauss=element->NewGauss(2);
++		Gauss* gauss=basalelement->NewGauss(2);
+ 		for(ig=gauss->begin();ig<gauss->end();ig++){
+ 			gauss->GaussPoint(ig);
+ 
+-			element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+-			element->NodalFunctions(basis,gauss);
++			basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++			basalelement->NodalFunctions(basis,gauss);
+ 
+ 			/* old function value */
+ 			levelset_input->GetInputValue(&lsf,gauss);
+@@ -276,6 +310,7 @@
+ 	else
+ 		for(i=0;i<numnodes;i++) 
+ 			pe->values[i]=0.; 
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
+ void LevelsetAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17427-17428.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17427-17428.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17427-17428.diff	(revision 17802)
@@ -0,0 +1,52 @@
+Index: ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17427)
++++ ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17428)
+@@ -28,6 +28,10 @@
+ 			counter++;
+ 		}
+ 	}
++	
++	if(iomodel->meshtype==Mesh3DEnum){
++		iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
++	}
+ }
+ /*}}}*/
+ void ExtrapolationAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+@@ -198,16 +202,13 @@
+ 		}
+ 	}/*}}}*/
+ 
+-	//TESTING
+-	_printf_("in element: " << basalelement->Id() << "\n");
+-	Ke->Echo();
+-
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(B);
+ 	xDelete<IssmDouble>(Bprime);
+ 	xDelete<IssmDouble>(dlsf);
+ 	xDelete<IssmDouble>(normal);
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	delete gauss;
+ 	return Ke;
+ 
+@@ -218,15 +219,17 @@
+ 	Element* basalelement = element->SpawnBasalElement();
+ 
+ 	/*Intermediaries */
+-	int i;
++	int i, meshtype;
+ 	
+ 	/*Fetch number of nodes */
+ 	int numnodes = basalelement->GetNumberOfNodes();
++	basalelement->FindParam(&meshtype,MeshTypeEnum);
+ 
+ 	/*Initialize Element vector*/
+ 	ElementVector* pe = basalelement->NewElementVector();
+ 	for(i=0;i<numnodes;i++) 
+ 		pe->values[i]=0.; 
++	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
+ void ExtrapolationAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17428-17429.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17428-17429.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17428-17429.diff	(revision 17802)
@@ -0,0 +1,202 @@
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17428)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17429)
+@@ -36,6 +36,7 @@
+ 	
+ 	if(iomodel->meshtype==Mesh3DEnum){
+ 		iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
++		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
+ }
+ /*}}}*/
+@@ -100,7 +101,7 @@
+ 	Element* basalelement = element->SpawnBasalElement();
+ 
+ 	/*Intermediaries */
+-	int  dim, meshtype; // solve for LSF in horizontal plane only
++	int  dim, meshtype;
+ 	int i, row, col;
+ 	IssmDouble kappa;
+ 	IssmDouble Jdet, dt, D_scalar;
+@@ -135,12 +136,8 @@
+ 	/*Retrieve all inputs and parameters*/
+ 	basalelement->GetVerticesCoordinates(&xyz_list);
+ 	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
+-	Input* vx_input  = NULL;
+-	Input* vy_input  = NULL;
+-	Input* lsf_slopex_input  = basalelement->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
+-	Input* lsf_slopey_input  = basalelement->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+-	Input* calvingrate_input  = basalelement->GetInput(MasstransportCalvingrateEnum);     _assert_(calvingrate_input);
+-
++	Input* vx_input=NULL;
++	Input* vy_input=NULL;
+ 	if(meshtype==Mesh2DhorizontalEnum){
+ 		vx_input=basalelement->GetInput(VxEnum); _assert_(vx_input);
+ 		vy_input=basalelement->GetInput(VyEnum); _assert_(vy_input);
+@@ -154,6 +151,10 @@
+ 			vy_input=basalelement->GetInput(VyAverageEnum); _assert_(vy_input);
+ 		}
+ 	}
++
++	Input* lsf_slopex_input  = basalelement->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
++	Input* lsf_slopey_input  = basalelement->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
++	Input* calvingrate_input  = basalelement->GetInput(MasstransportCalvingrateEnum);     _assert_(calvingrate_input);
+ 	
+ 	/* Start  looping on the number of gaussian points: */
+ 	Gauss* gauss=basalelement->NewGauss(2);
+@@ -259,8 +260,8 @@
+ 	xDelete<IssmDouble>(w);
+ 	xDelete<IssmDouble>(c);
+ 	xDelete<IssmDouble>(dlsf);
++	delete gauss;
+ 	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+-	delete gauss;
+ 	return Ke;
+ }/*}}}*/
+ ElementVector* LevelsetAnalysis::CreatePVector(Element* element){/*{{{*/
+@@ -305,12 +306,13 @@
+ 		/*Clean up and return*/
+ 		xDelete<IssmDouble>(xyz_list);
+ 		xDelete<IssmDouble>(basis);
++		basalelement->FindParam(&meshtype,MeshTypeEnum);
++		if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 		delete gauss;
+ 	}
+ 	else
+ 		for(i=0;i<numnodes;i++) 
+ 			pe->values[i]=0.; 
+-	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
+ void LevelsetAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17428)
++++ ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17429)
+@@ -28,9 +28,9 @@
+ 			counter++;
+ 		}
+ 	}
+-	
+ 	if(iomodel->meshtype==Mesh3DEnum){
+ 		iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
++		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
+ }
+ /*}}}*/
+@@ -85,7 +85,7 @@
+ 	Element* basalelement = element->SpawnBasalElement();
+ 
+ 	/*Intermediaries */
+-	int		  meshtype,dim;
++	int		   meshtype,dim;
+ 	int        i,row,col,stabilization;
+ 	bool	   extrapolatebydiffusion = true;
+ 	IssmDouble Jdet,D_scalar,h;
+@@ -109,9 +109,9 @@
+ 	ElementMatrix* Ke     = basalelement->NewElementMatrix();
+ 	IssmDouble*    B      = xNew<IssmDouble>(dim*numnodes);
+ 	IssmDouble*    Bprime = xNew<IssmDouble>(dim*numnodes);
+-	IssmDouble*		dlsf   = xNew<IssmDouble>(dim);
+-	IssmDouble*		normal = xNew<IssmDouble>(dim);
+-	IssmDouble*    D		 = xNew<IssmDouble>(dim*dim);
++	IssmDouble*		D	  = xNew<IssmDouble>(dim*dim);
++	IssmDouble*		dlsf  = xNew<IssmDouble>(dim);
++	IssmDouble*		normal= xNew<IssmDouble>(dim);
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	Input* lsf_slopex_input=basalelement->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
+@@ -161,9 +161,9 @@
+ 			for(row=0;row<dim;row++)
+ 				for(col=0;col<dim;col++)
+ 					if(row==col)
+-						D[row*dim+col] = D_scalar*normal[row];
++						D[row*dim+col]=D_scalar*normal[row];
+ 					else
+-						D[row*dim+col] = 0.;
++						D[row*dim+col]=0.;
+ 			TripleMultiply(B,dim,numnodes,1,
+ 						D,dim,dim,0,
+ 						Bprime,dim,numnodes,0,
+@@ -180,9 +180,9 @@
+ 				for(row=0;row<dim;row++)
+ 					for(col=0;col<dim;col++)
+ 						if(row==col)
+-							D[row*dim+col] = D_scalar*kappa;
++							D[row*dim+col]=D_scalar*kappa;
+ 						else
+-							D[row*dim+col] = 0.;
++							D[row*dim+col]=0.;
+ 				TripleMultiply(Bprime,dim,numnodes,1,
+ 							D,dim,dim,0,
+ 							Bprime,dim,numnodes,0,
+@@ -206,10 +206,11 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(B);
+ 	xDelete<IssmDouble>(Bprime);
++	xDelete<IssmDouble>(D);
+ 	xDelete<IssmDouble>(dlsf);
+ 	xDelete<IssmDouble>(normal);
++	delete gauss;
+ 	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+-	delete gauss;
+ 	return Ke;
+ 
+ }/*}}}*/
+@@ -223,12 +224,13 @@
+ 	
+ 	/*Fetch number of nodes */
+ 	int numnodes = basalelement->GetNumberOfNodes();
+-	basalelement->FindParam(&meshtype,MeshTypeEnum);
+ 
+ 	/*Initialize Element vector*/
+ 	ElementVector* pe = basalelement->NewElementVector();
+ 	for(i=0;i<numnodes;i++) 
+ 		pe->values[i]=0.; 
++
++	basalelement->FindParam(&meshtype,MeshTypeEnum);
+ 	if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
+@@ -325,15 +327,17 @@
+ 		gauss->GaussNode(element->GetElementType(),in);
+ 		node=element->GetNode(in);
+ 		levelset_input->GetInputValue(&phi,gauss);
+-		if(phi<=0.){
+-			/* if ice, set dirichlet BC */
+-			extvar_input->GetInputValue(&value,gauss);
+-			node->ApplyConstraint(1,value);
++		if(node->IsActive()){
++			if(phi<=0.){
++				/* if ice, set dirichlet BC */
++				extvar_input->GetInputValue(&value,gauss);
++				node->ApplyConstraint(1,value);
++			}
++			else {
++				/* no ice, set no spc */
++				node->DofInFSet(0); 
++			}
+ 		}
+-		else {
+-			/* no ice, set no spc */
+-			node->DofInFSet(0); 
+-		}
+ 	}
+ 	delete gauss;
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Node.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Node.cpp	(revision 17428)
++++ ../trunk-jpl/src/c/classes/Node.cpp	(revision 17429)
+@@ -96,7 +96,9 @@
+ 				analysis_enum==BalancethicknessAnalysisEnum ||
+ 				analysis_enum==HydrologyDCInefficientAnalysisEnum ||
+ 				analysis_enum==DamageEvolutionAnalysisEnum || 
+-				analysis_enum==HydrologyDCEfficientAnalysisEnum
++				analysis_enum==HydrologyDCEfficientAnalysisEnum ||
++				analysis_enum==LevelsetAnalysisEnum ||
++				analysis_enum==ExtrapolationAnalysisEnum
+ 				){
+ 		if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh2DverticalEnum){
+ 			/*On a 3d mesh, we may have collapsed elements, hence dead nodes. Freeze them out: */
Index: issm/oecreview/Archive/16554-17801/ISSM-17429-17430.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17429-17430.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17429-17430.diff	(revision 17802)
@@ -0,0 +1,237 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17429)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17430)
+@@ -121,6 +121,7 @@
+ 	bool   isSSA,isL1L2,isHO,isFS,iscoupling;
+ 	bool   control_analysis;
+ 	bool   dakota_analysis;
++	bool   islevelset;
+ 
+ 	/*Fetch constants needed: */
+ 	iomodel->Constant(&isSSA,FlowequationIsSSAEnum);
+@@ -130,6 +131,7 @@
+ 	iomodel->Constant(&control_analysis,InversionIscontrolEnum);
+ 	iomodel->Constant(&dakota_analysis,QmuIsdakotaEnum);
+ 	iomodel->Constant(&materials_type,MaterialsEnum);
++	iomodel->Constant(&islevelset,TransientIslevelsetEnum);
+ 
+ 	/*return if no processing required*/
+ 	if(!isSSA & !isL1L2 & !isHO & !isFS) return;
+@@ -202,7 +204,6 @@
+ 	iomodel->FetchDataToInput(elements,LoadingforceXEnum);
+ 	iomodel->FetchDataToInput(elements,LoadingforceYEnum);
+ 	iomodel->FetchDataToInput(elements,DamageDEnum);
+-	iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
+ 
+ 	if(iomodel->meshtype==Mesh3DEnum){
+ 		iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
+@@ -221,6 +222,11 @@
+ 		iomodel->FetchDataToInput(elements,PressureEnum,0.);
+ 		if(dakota_analysis)elements->InputDuplicate(PressureEnum,QmuPressureEnum);
+ 	}
++	if(islevelset){
++		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
++		if(iomodel->meshtype!=Mesh2DhorizontalEnum)
++			iomodel->FetchDataToInput(elements,MeshVertexonbedEnum); // required for updating active nodes
++	}
+ 
+ #ifdef _HAVE_ANDROID_
+ 	elements->InputDuplicate(FrictionCoefficientEnum,AndroidFrictionCoefficientEnum);
+@@ -1032,7 +1038,7 @@
+ 	femmodel->parameters->FindParam(&islevelset,TransientIslevelsetEnum);
+ 	if(islevelset){
+ 		_printf0_("   Updating active and non-active nodes for StressbalanceAnalysis \n");
+-		SetActiveNodesLSMx(femmodel->elements);
++		SetActiveNodesLSMx(femmodel);
+ 	}
+ 	return;
+ }/*}}}*/
+@@ -2104,6 +2110,9 @@
+ }/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixHO(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*compute all stiffness matrices for this element*/
+ 	ElementMatrix* Ke1=CreateKMatrixHOViscous(element);
+ 	ElementMatrix* Ke2=CreateKMatrixHOFriction(element);
+@@ -2116,6 +2125,9 @@
+ }/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixHOViscous(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*Intermediaries*/
+ 	int         dim,meshtype,bsize;
+ 	IssmDouble  viscosity,newviscosity,oldviscosity;
+@@ -2188,6 +2200,9 @@
+ }/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixHOFriction(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	if(element->IsFloating() || !element->IsOnBed()) return NULL;
+ 
+ 	/*Intermediaries*/
+@@ -2275,6 +2290,9 @@
+ #ifdef FSANALYTICAL
+ ElementVector* StressbalanceAnalysis::CreatePVectorHO(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*Intermediaries */
+ 	int         dim,meshtype;
+ 	IssmDouble  x_coord,y_coord,z_coord;
+@@ -2333,6 +2351,9 @@
+ #else
+ ElementVector* StressbalanceAnalysis::CreatePVectorHO(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*compute all load vectors for this element*/
+ 	ElementVector* pe1=CreatePVectorHODrivingStress(element);
+ 	ElementVector* pe2=CreatePVectorHOFront(element);
+@@ -2346,6 +2367,9 @@
+ #endif
+ ElementVector* StressbalanceAnalysis::CreatePVectorHODrivingStress(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*Intermediaries */
+ 	int         dim,meshtype;
+ 	IssmDouble  Jdet,slope[3];
+@@ -2397,6 +2421,9 @@
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorHOFront(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*If no front, return NULL*/
+ 	if(!element->IsIcefront()) return NULL;
+ 
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17429)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17430)
+@@ -35,12 +35,14 @@
+ 	bool   ispdd;
+ 	bool   isdelta18o;
+ 	bool   isgroundingline;
++	bool   islevelset;
+ 
+ 	/*Fetch data needed: */
+ 	iomodel->Constant(&stabilization,MasstransportStabilizationEnum);
+ 	iomodel->Constant(&dakota_analysis,QmuIsdakotaEnum);
+ 	iomodel->Constant(&smb_model,SurfaceforcingsEnum);
+ 	iomodel->Constant(&isgroundingline,TransientIsgroundinglineEnum);
++	iomodel->Constant(&islevelset,TransientIslevelsetEnum);
+ 
+ 	/*Finite element type*/
+ 	finiteelement = P1Enum;
+@@ -85,6 +87,12 @@
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
+ 
++	if(islevelset){
++		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
++		if(iomodel->meshtype!=Mesh2DhorizontalEnum)
++			iomodel->FetchDataToInput(elements,MeshVertexonbedEnum); // required for updating active nodes
++	}
++
+ 	switch(smb_model){
+ 		case SMBEnum:
+ 			iomodel->FetchDataToInput(elements,SurfaceforcingsMassBalanceEnum,0.);
+@@ -747,7 +755,7 @@
+ 	femmodel->parameters->FindParam(&islevelset,TransientIslevelsetEnum);
+ 	if(islevelset){
+ 		_printf0_("   Updating active and non-active nodes for MasstransportAnalysis \n");
+-		SetActiveNodesLSMx(femmodel->elements);
++		SetActiveNodesLSMx(femmodel);
+ 	}
+ 	return;
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp	(revision 17429)
++++ ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp	(revision 17430)
+@@ -9,9 +9,17 @@
+ #include "../../toolkits/toolkits.h"
+ #include "../modules.h"
+ 
+-void SetActiveNodesLSMx(Elements* elements){/*{{{*/
++void SetActiveNodesLSMx(FemModel* femmodel){/*{{{*/
+ 
+-	for(int i=0;i<elements->Size();i++){
++	/* intermediaries */
++	bool solvein2d=false;
++	int i,in,meshtype,analysis_type;
++	Elements* elements = femmodel->elements;
++
++	/* find parameters */
++	femmodel->parameters->FindParam(&meshtype,MeshTypeEnum);
++
++	for(i=0;i<elements->Size();i++){
+ 		Element    *element  = dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+ 		int         numnodes = element->GetNumberOfNodes();
+ 		IssmDouble *mask     = xNew<IssmDouble>(numnodes);
+@@ -39,7 +47,38 @@
+ 				break;
+ 		}
+ 
+-		for(int in=0;in<numnodes;in++){
++		if(meshtype!=Mesh2DhorizontalEnum){
++			femmodel->parameters->FindParam(&analysis_type,AnalysisTypeEnum);
++			if(
++					analysis_type==FreeSurfaceBaseAnalysisEnum || 
++					analysis_type==MasstransportAnalysisEnum || 
++					analysis_type==MeltingAnalysisEnum || 
++					analysis_type==L2ProjectionBaseAnalysisEnum || 
++					analysis_type==BalancethicknessAnalysisEnum ||
++					analysis_type==HydrologyDCInefficientAnalysisEnum ||
++					analysis_type==DamageEvolutionAnalysisEnum || 
++					analysis_type==HydrologyDCEfficientAnalysisEnum ||
++					analysis_type==LevelsetAnalysisEnum ||
++					analysis_type==ExtrapolationAnalysisEnum
++					){ solvein2d=true;}
++
++			if(analysis_type==StressbalanceAnalysisEnum){
++				bool isSIA,isSSA;
++				femmodel->parameters->FindParam(&isSIA,FlowequationIsSIAEnum);
++				femmodel->parameters->FindParam(&isSSA,FlowequationIsSSAEnum);
++				if(isSIA || isSSA)
++					solvein2d=true;
++			}
++
++			if(solvein2d){
++				IssmDouble *mask_isonbed = xNew<IssmDouble>(numnodes);
++				element->GetInputListOnNodes(&mask_isonbed[0],MeshVertexonbedEnum);
++				for(in=0;in<numnodes;in++)	 mask[in]*=mask_isonbed[in];
++				xDelete<IssmDouble>(mask_isonbed);
++			}
++		}
++
++		for(in=0;in<numnodes;in++){
+ 			Node* node=element->GetNode(in);
+ 			if(mask[in]==1.){
+ 				node->Activate();
+Index: ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.h	(revision 17429)
++++ ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.h	(revision 17430)
+@@ -7,7 +7,7 @@
+ 
+ #include "../../classes/classes.h"
+ 
+-void SetActiveNodesLSMx(Elements* elements);
++void SetActiveNodesLSMx(FemModel* femmodel);
+ void GetMaskOfIceVerticesLSMx(FemModel* femmodel);
+ void SetMaskOfIceElement(Vector<IssmDouble>* vec_mask_ice, Element* element);
+ #endif  /* _UPDATESPCSX_H */
Index: issm/oecreview/Archive/16554-17801/ISSM-17430-17431.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17430-17431.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17430-17431.diff	(revision 17802)
@@ -0,0 +1,101 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 17430)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 17431)
+@@ -18,7 +18,9 @@
+ 
+ 	/*Fetch data needed: */
+ 	bool   isSIA;
++	bool   islevelset;
+ 	iomodel->Constant(&isSIA,FlowequationIsSIAEnum);
++	iomodel->Constant(&islevelset,TransientIslevelsetEnum);
+ 
+ 	/*Now, is the flag SIA on? otherwise, do nothing: */
+ 	if (!isSIA)return;
+@@ -37,6 +39,11 @@
+ 
+ 	iomodel->FetchDataToInput(elements,ThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,FrictionCoefficientEnum);
++	if(islevelset){
++		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
++		if(iomodel->meshtype!=Mesh2DhorizontalEnum)
++			iomodel->FetchDataToInput(elements,MeshVertexonbedEnum); // required for updating active nodes
++	}
+ 
+ 	/*Free data: */
+ 	iomodel->DeleteData(1,FlowequationElementEquationEnum);
+@@ -149,6 +156,10 @@
+ _error_("Not implemented");
+ }/*}}}*/
+ ElementMatrix* StressbalanceSIAAnalysis::CreateKMatrix(Element* element){/*{{{*/
++
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	int meshtype;
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+ 	switch(meshtype){
+@@ -161,6 +172,9 @@
+ }/*}}}*/
+ ElementMatrix* StressbalanceSIAAnalysis::CreateKMatrix2D(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*Intermediaries */
+ 	IssmDouble connectivity;
+ 
+@@ -180,6 +194,9 @@
+ }/*}}}*/
+ ElementMatrix* StressbalanceSIAAnalysis::CreateKMatrix3D(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*Intermediaries */
+ 	int         i0,i1,j0,j1,nodeup,nodedown,numsegments;
+ 	IssmDouble  slope[2],connectivity[2],one0,one1;
+@@ -243,6 +260,9 @@
+ }/*}}}*/
+ ElementVector* StressbalanceSIAAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	int meshtype;
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+ 	switch(meshtype){
+@@ -255,6 +275,9 @@
+ }/*}}}*/
+ ElementVector* StressbalanceSIAAnalysis::CreatePVector2D(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*Intermediaries */
+ 	int        frictionlaw = 1;
+ 	IssmDouble ub,vb,slope2,drag,thickness,surface,connectivity;
+@@ -326,6 +349,9 @@
+ }/*}}}*/
+ ElementVector* StressbalanceSIAAnalysis::CreatePVector3D(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*Intermediaries */
+ 	int         frictionlaw = 1;
+ 	int         nodeup,nodedown,numsegments;
+@@ -549,6 +575,12 @@
+ 	xDelete<int>(doflist);
+ }/*}}}*/
+ void StressbalanceSIAAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+-	/*Default, do nothing*/
++
++	bool islevelset;
++	femmodel->parameters->FindParam(&islevelset,TransientIslevelsetEnum);
++	if(islevelset){
++		_printf0_("   Updating active and non-active nodes for StressbalanceSIAAnalysis \n");
++		SetActiveNodesLSMx(femmodel);
++	}
+ 	return;
+ }/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17431-17432.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17431-17432.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17431-17432.diff	(revision 17802)
@@ -0,0 +1,107 @@
+Index: ../trunk-jpl/src/m/parameterization/setmask.m
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/setmask.m	(revision 17431)
++++ ../trunk-jpl/src/m/parameterization/setmask.m	(revision 17432)
+@@ -1,4 +1,4 @@
+-function md=setmask(md,floatingicename,groundedicename)
++function md=setmask(md,floatingicename,groundedicename,varargin)
+ %SETMASK - establish boundaries between grounded and floating ice.
+ %
+ %   By default, ice is considered grounded. The contour floatingicename defines nodes 
+@@ -14,11 +14,22 @@
+ %      md=setmask(md,'Iceshelves.exp','Islands.exp');
+ 
+ %some checks on list of arguments
+-if ((nargin~=3) | (nargout~=1)),
++if ((mod(nargin,2)==0) | (nargout~=1))
+ 	help mask
+ 	error('mask error message');
+ end
+ 
++if(nargin>0)
++	if(varargin(1)='icedomain')
++		icedomainname=varargin(2);	
++	else
++		error('mask error message: wrong field specified. Only icedomain allowed for now.');
++	end
++	if ~exist(icedomainname),
++        error(['setmask error message: file ' icedomainname ' not found!']);
++	end
++end
++
+ %Get assigned fields
+ x=md.mesh.x;
+ y=md.mesh.y;
+@@ -41,6 +52,19 @@
+ %}}}
+ 
+ %level sets
+-md.mask.ice_levelset=-1.*ones(md.mesh.numberofvertices,1);
+ md.mask.groundedice_levelset=vertexongroundedice;
+ md.mask.groundedice_levelset(find(vertexongroundedice==0.))=-1.;
++
++if(nargin>0)
++	if(varargin(1)='icedomain')
++		md.mask.ice_levelset = 1.*ones(md.mesh.numberofvertices,1);
++		%use contourtomesh to set ice values inside ice domain
++		[vertexinsideicedomain,elementinsideicedomain]=ContourToMesh(elements,x,y,icedomainname,'node',1);
++		pos=find(vertexinsideicedomain==1.);
++		md.mask.ice_levelset(pos) = -1.;
++	end
++else
++	md.mask.ice_levelset = -1.*ones(md.mesh.numberofvertices,1);
++end
++
++
+Index: ../trunk-jpl/src/m/parameterization/setmask.py
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/setmask.py	(revision 17431)
++++ ../trunk-jpl/src/m/parameterization/setmask.py	(revision 17432)
+@@ -1,7 +1,9 @@
+ import numpy
++import os
++from model import *
+ from FlagElements import *
+ 
+-def setmask(md, floatingicename, groundedicename):
++def setmask(md, floatingicename, groundedicename, *args):
+ 	"""
+ 	SETMASK - establish boundaries between grounded and floating ice.
+ 
+@@ -17,7 +19,16 @@
+ 	      md=setmask(md,'all','');
+ 	      md=setmask(md,'Iceshelves.exp','Islands.exp');
+ 	"""
++	#some checks on list of arguments
++	if not isinstance(md,model):
++		raise TypeError("setmask error message")
+ 
++	if len(args)%2:
++		raise TypeError("odd number of arguments provided in setmask")
++
++	#process options
++	options=pairoptions(*args)
++
+ 	#Get assigned fields
+ 	x = md.mesh.x
+ 	y = md.mesh.y
+@@ -41,8 +52,18 @@
+ 	#}}}
+ 
+ 	#level sets
+-	md.mask.ice_levelset         = -1.*numpy.ones((md.mesh.numberofvertices,1))
+ 	md.mask.groundedice_levelset = -1.*numpy.ones((md.mesh.numberofvertices,1))
+ 	md.mask.groundedice_levelset[md.mesh.elements[numpy.nonzero(elementongroundedice),:]-1]=1.
+ 
++	if(len(args)):
++		md.mask.ice_levelset = 1.*numpy.ones((md.mesh.numberofvertices,1))
++		icedomainfile = options.getfieldvalue('icedomain','none')
++		if not os.path.exists(icedomainfile):
++			raise IOError("setmask error message: ice domain file '%s' not found." % icedomainfile)
++		#use contourtomesh to set ice values inside ice domain
++		[vertexinsideicedomain,elementinsideicedomain]=ContourToMesh(elements,x,y,icedomainfile,'node',1)
++		md.mask.ice_levelset[numpy.nonzero(vertexinsideicedomain)[0]] = -1.
++	else:
++		md.mask.ice_levelset = -1.*numpy.ones((md.mesh.numberofvertices,1))
++
+ 	return md
Index: issm/oecreview/Archive/16554-17801/ISSM-17432-17433.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17432-17433.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17432-17433.diff	(revision 17802)
@@ -0,0 +1,32 @@
+Index: ../trunk-jpl/src/m/parameterization/setmask.m
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/setmask.m	(revision 17432)
++++ ../trunk-jpl/src/m/parameterization/setmask.m	(revision 17433)
+@@ -14,13 +14,13 @@
+ %      md=setmask(md,'Iceshelves.exp','Islands.exp');
+ 
+ %some checks on list of arguments
+-if ((mod(nargin,2)==0) | (nargout~=1))
++if ((mod(nargin,2)==0) | (nargout~=1)),
+ 	help mask
+ 	error('mask error message');
+ end
+ 
+-if(nargin>0)
+-	if(varargin(1)='icedomain')
++if(nargin>3)
++	if(varargin(1)=='icedomain'),
+ 		icedomainname=varargin(2);	
+ 	else
+ 		error('mask error message: wrong field specified. Only icedomain allowed for now.');
+@@ -55,8 +55,8 @@
+ md.mask.groundedice_levelset=vertexongroundedice;
+ md.mask.groundedice_levelset(find(vertexongroundedice==0.))=-1.;
+ 
+-if(nargin>0)
+-	if(varargin(1)='icedomain')
++if(nargin>3)
++	if(varargin(1)=='icedomain')
+ 		md.mask.ice_levelset = 1.*ones(md.mesh.numberofvertices,1);
+ 		%use contourtomesh to set ice values inside ice domain
+ 		[vertexinsideicedomain,elementinsideicedomain]=ContourToMesh(elements,x,y,icedomainname,'node',1);
Index: issm/oecreview/Archive/16554-17801/ISSM-17433-17434.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17433-17434.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17433-17434.diff	(revision 17802)
@@ -0,0 +1,302 @@
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17433)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17434)
+@@ -42,8 +42,9 @@
+ 		}
+ 	}
+ 
+-	bool dakota_analysis;
++	bool dakota_analysis, islevelset;
+ 	iomodel->Constant(&dakota_analysis,QmuIsdakotaEnum);
++	iomodel->Constant(&islevelset,TransientIslevelsetEnum);
+ 
+ 	iomodel->FetchDataToInput(elements,ThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+@@ -74,6 +75,10 @@
+ 		elements->InputDuplicate(VxMeshEnum,QmuVyMeshEnum);
+ 		elements->InputDuplicate(VxMeshEnum,QmuVzMeshEnum);
+ 	}
++	if(islevelset){
++		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonbedEnum); // required for updating active nodes
++	}
+ }/*}}}*/
+ void ThermalAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+@@ -123,6 +128,9 @@
+ }/*}}}*/
+ ElementMatrix* ThermalAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*compute all stiffness matrices for this element*/
+ 	ElementMatrix* Ke1=CreateKMatrixVolume(element);
+ 	ElementMatrix* Ke2=CreateKMatrixShelf(element);
+@@ -135,6 +143,9 @@
+ }/*}}}*/
+ ElementMatrix* ThermalAnalysis::CreateKMatrixVolume(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*Intermediaries */
+ 	int         stabilization;
+ 	IssmDouble  Jdet,dt,u,v,w,um,vm,wm,vel;
+@@ -265,6 +276,9 @@
+ }/*}}}*/
+ ElementMatrix* ThermalAnalysis::CreateKMatrixShelf(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*Initialize Element matrix and return if necessary*/
+ 	if(!element->IsOnBed() || !element->IsFloating()) return NULL;
+ 
+@@ -315,6 +329,9 @@
+ 	return Ke;
+ }/*}}}*/
+ ElementVector* ThermalAnalysis::CreatePVector(Element* element){/*{{{*/
++	
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
+ 
+ 	/*compute all load vectors for this element*/
+ 	ElementVector* pe1=CreatePVectorVolume(element);
+@@ -330,6 +347,9 @@
+ }/*}}}*/
+ ElementVector* ThermalAnalysis::CreatePVectorVolume(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*Intermediaries*/
+ 	int         stabilization;
+ 	IssmDouble  Jdet,phi,dt;
+@@ -409,6 +429,9 @@
+ }/*}}}*/
+ ElementVector* ThermalAnalysis::CreatePVectorSheet(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/* Geothermal flux on ice sheet base and basal friction */
+ 	if(!element->IsOnBed() || element->IsFloating()) return NULL;
+ 
+@@ -468,6 +491,9 @@
+ }/*}}}*/
+ ElementVector* ThermalAnalysis::CreatePVectorShelf(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	IssmDouble  t_pmp,dt,Jdet,scalar_ocean,pressure;
+ 	IssmDouble *xyz_list_base = NULL;
+ 
+@@ -682,6 +708,12 @@
+ 	xDelete<int>(doflist);
+ }/*}}}*/
+ void ThermalAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+-	/*Default, do nothing*/
++
++	bool islevelset;
++	femmodel->parameters->FindParam(&islevelset,TransientIslevelsetEnum);
++	if(islevelset){
++		_printf0_("   Updating active and non-active nodes for ThermalAnalysis \n");
++		SetActiveNodesLSMx(femmodel);
++	}
+ 	return;
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17433)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17434)
+@@ -24,7 +24,7 @@
+ }/*}}}*/
+ void EnthalpyAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+ 
+-	bool dakota_analysis;
++	bool dakota_analysis, islevelset;
+ 	bool isenthalpy;
+ 
+ 	/*Now, is the model 3d? otherwise, do nothing: */
+@@ -48,6 +48,7 @@
+ 	}
+ 
+ 	iomodel->Constant(&dakota_analysis,QmuIsdakotaEnum);
++	iomodel->Constant(&islevelset,TransientIslevelsetEnum);
+ 
+ 	iomodel->FetchDataToInput(elements,ThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+@@ -82,6 +83,10 @@
+ 		elements->InputDuplicate(VxMeshEnum,QmuVyMeshEnum);
+ 		elements->InputDuplicate(VxMeshEnum,QmuVzMeshEnum);
+ 	}
++	if(islevelset){
++		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonbedEnum); // required for updating active nodes
++	}
+ 
+ 	/*Free data: */
+ 	iomodel->DeleteData(3,TemperatureEnum,WaterfractionEnum,PressureEnum);
+@@ -195,6 +200,9 @@
+ }/*}}}*/
+ ElementMatrix* EnthalpyAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*compute all stiffness matrices for this element*/
+ 	ElementMatrix* Ke1=CreateKMatrixVolume(element);
+ 	ElementMatrix* Ke2=CreateKMatrixShelf(element);
+@@ -207,6 +215,9 @@
+ }/*}}}*/
+ ElementMatrix* EnthalpyAnalysis::CreateKMatrixVolume(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*Intermediaries */
+ 	int         stabilization;
+ 	IssmDouble  Jdet,dt,u,v,w,um,vm,wm,vel;
+@@ -338,6 +349,9 @@
+ }/*}}}*/
+ ElementMatrix* EnthalpyAnalysis::CreateKMatrixShelf(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*Initialize Element matrix and return if necessary*/
+ 	if(!element->IsOnBed() || !element->IsFloating()) return NULL;
+ 
+@@ -387,6 +401,9 @@
+ }/*}}}*/
+ ElementVector* EnthalpyAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*compute all load vectors for this element*/
+ 	ElementVector* pe1=CreatePVectorVolume(element);
+ 	ElementVector* pe2=CreatePVectorSheet(element);
+@@ -401,6 +418,9 @@
+ }/*}}}*/
+ ElementVector* EnthalpyAnalysis::CreatePVectorVolume(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*Intermediaries*/
+ 	int         i, stabilization;
+ 	IssmDouble  Jdet,phi,dt;
+@@ -514,6 +534,9 @@
+ }/*}}}*/
+ ElementVector* EnthalpyAnalysis::CreatePVectorSheet(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/* implementation of the basal condition decision chart of Aschwanden 2012, Fig.5 */
+ 	if(!element->IsOnBed() || element->IsFloating()) return NULL;
+ 
+@@ -601,6 +624,9 @@
+ }/*}}}*/
+ ElementVector* EnthalpyAnalysis::CreatePVectorShelf(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return NULL;
++
+ 	/*Get basal element*/
+ 	if(!element->IsOnBed() || !element->IsFloating()) return NULL;
+ 
+@@ -818,7 +844,13 @@
+ 	xDelete<int>(doflist);
+ }/*}}}*/
+ void EnthalpyAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+-	/*Default, do nothing*/
++
++	bool islevelset;
++	femmodel->parameters->FindParam(&islevelset,TransientIslevelsetEnum);
++	if(islevelset){
++		_printf0_("   Updating active and non-active nodes for ThermalAnalysis \n");
++		SetActiveNodesLSMx(femmodel);
++	}
+ 	return;
+ }/*}}}*/
+ 
+@@ -828,7 +860,7 @@
+ 	/*Intermediaries*/
+ 	int solution_type, i;
+ 	bool computebasalmeltingrates=true;
+-	bool isdrainage=true;
++	bool isdrainage=false;
+ 	bool updatebasalconstraints=true;
+ 
+ 	if(isdrainage){
+@@ -862,6 +894,12 @@
+ 	/*Calculate the basal melt rates of the enthalpy model after Aschwanden 2012*/
+ 	/* melting rate is positive when melting, negative when refreezing*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return;
++
++	/* Only compute melt rates at the base of grounded ice*/
++	if(!element->IsOnBed() || element->IsFloating()) return;
++
+ 	/* Intermediaries */
+ 	const int   dim=3;
+ 	int         i,is,vertexdown,vertexup,numvertices,numsegments;
+@@ -877,9 +915,6 @@
+ 	IssmDouble *xyz_list_base = NULL;
+ 	int        *pairindices   = NULL;
+ 
+-	/* Only compute melt rates at the base of grounded ice*/
+-	if(!element->IsOnBed() || element->IsFloating()) return;
+-
+ 	/*Fetch parameters and inputs */
+ 	element->GetVerticesCoordinates(&xyz_list);
+ 	element->GetVerticesCoordinatesBase(&xyz_list_base);
+@@ -1005,6 +1040,9 @@
+ }/*}}}*/
+ void EnthalpyAnalysis::DrainWaterfractionIcecolumn(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return;
++
+ 	/* Only drain waterfraction of ice column from element at base*/
+ 	if(!element->IsOnBed()) return; //FIXME: allow freeze on for floating elements
+ 
+@@ -1043,6 +1081,9 @@
+ }/*}}}*/
+ void EnthalpyAnalysis::DrainWaterfraction(Element* element, IssmDouble* pdrainrate_element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return;
++
+ 	/*Intermediaries*/
+ 	int iv,is,vertexdown,vertexup,numsegments;	
+ 	IssmDouble dt, height_element;
+@@ -1101,6 +1142,12 @@
+ }/*}}}*/
+ void EnthalpyAnalysis::UpdateBasalConstraints(Element* element){/*{{{*/
+ 
++	/* Check if ice in element */
++	if(!element->IsIceInElement()) return;
++
++	/* Only update Constraints at the base of grounded ice*/
++	if(!(element->IsOnBed()) || element->IsFloating()) return;
++
+ 	/*Intermediary*/
+ 	bool        isdynamicbasalspc,setspc;
+ 	int         numindices, numindicesup;
+@@ -1109,9 +1156,6 @@
+ 	IssmDouble  watercolumn;
+ 	int        *indices = NULL, *indicesup = NULL;
+ 	Node*       node = NULL;
+-	
+-	/* Only update Constraints at the base of grounded ice*/
+-	if(!(element->IsOnBed()) || element->IsFloating()) return;
+ 
+ 	/*Check wether dynamic basal boundary conditions are activated */
+ 	element->FindParam(&isdynamicbasalspc,ThermalIsdynamicbasalspcEnum);
Index: issm/oecreview/Archive/16554-17801/ISSM-17434-17435.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17434-17435.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17434-17435.diff	(revision 17802)
@@ -0,0 +1,24 @@
+Index: ../trunk-jpl/src/m/classes/model.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.py	(revision 17434)
++++ ../trunk-jpl/src/m/classes/model.py	(revision 17435)
+@@ -626,6 +626,7 @@
+ 		md.damage.spcdamage=project3d(md,'vector',md.damage.spcdamage,'type','node')
+ 		md.stressbalance.referential=project3d(md,'vector',md.stressbalance.referential,'type','node')
+ 		md.stressbalance.loadingforce=project3d(md,'vector',md.stressbalance.loadingforce,'type','node')
++		md.masstransport.calvingrate=project3d(md,'vector',md.masstransport.calvingrate,'type','node')
+ 
+ 		#connectivity
+ 		md.mesh.elementconnectivity=numpy.tile(md.mesh.elementconnectivity,(numlayers-1,1))
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17434)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17435)
+@@ -722,6 +722,7 @@
+ 			md.stressbalance.spcvz=project3d(md,'vector',md.stressbalance.spcvz,'type','node');
+ 			md.thermal.spctemperature=project3d(md,'vector',md.thermal.spctemperature,'type','node','layer',md.mesh.numberoflayers,'padding',NaN);
+ 			md.masstransport.spcthickness=project3d(md,'vector',md.masstransport.spcthickness,'type','node');
++			md.masstransport.calvingrate=project3d(md,'vector',md.masstransport.calvingrate,'type','node');
+ 			md.balancethickness.spcthickness=project3d(md,'vector',md.balancethickness.spcthickness,'type','node');
+ 			md.damage.spcdamage=project3d(md,'vector',md.damage.spcdamage,'type','node');
+ 			md.stressbalance.referential=project3d(md,'vector',md.stressbalance.referential,'type','node');
Index: issm/oecreview/Archive/16554-17801/ISSM-17435-17436.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17435-17436.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17435-17436.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17435)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17436)
+@@ -860,7 +860,7 @@
+ 	/*Intermediaries*/
+ 	int solution_type, i;
+ 	bool computebasalmeltingrates=true;
+-	bool isdrainage=false;
++	bool isdrainage=true;
+ 	bool updatebasalconstraints=true;
+ 
+ 	if(isdrainage){
Index: issm/oecreview/Archive/16554-17801/ISSM-17436-17437.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17436-17437.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17436-17437.diff	(revision 17802)
@@ -0,0 +1,69 @@
+Index: ../trunk-jpl/test/NightlyRun/test336.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test336.py	(revision 17436)
++++ ../trunk-jpl/test/NightlyRun/test336.py	(revision 17437)
+@@ -11,12 +11,11 @@
+ md=setmask(md,'','')
+ md=parameterize(md,'../Par/SquareSheetConstrained.py') 
+ md=setflowequation(md,'SSA','all')
+-md.cluster=generic('name',oshostname(),'np',1)
+-# md.cluster=generic('name',oshostname(),'np',3)
++md.cluster=generic('name',oshostname(),'np',3)
+ 
+ # parameters
+ md.transient.isstressbalance=True
+-md.transient.ismasstransport=False
++md.transient.ismasstransport=True
+ md.transient.isthermal=False
+ md.transient.isgroundingline=False
+ md.transient.isgia=False
+@@ -27,29 +26,35 @@
+ ymin, ymax=min(md.mesh.y), max(md.mesh.y)
+ xmed, ymed=(xmax+xmin)/2.,(ymax+ymin)/2.  
+ 
+-# distx=numpy.absolute(md.mesh.x.reshape(-1,1)-xmed)
+-# disty=numpy.absolute(md.mesh.y.reshape(-1,1)-ymed)
+-# md.mask.ice_levelset=numpy.maximum(distx,disty)-0.2*(xmax-xmin)
++md.mask.ice_levelset=md.mesh.y.reshape(-1,1) - ymed
+ 
+-D=numpy.sqrt(numpy.power(md.mesh.x.reshape(-1,1)-xmed,2.)+numpy.power(md.mesh.y.reshape(-1,1)-ymed,2.))
+-R=0.2*(xmax-xmin)
+-md.mask.ice_levelset=D-R
+-md.masstransport.calvingrate=0.*numpy.ones((md.mesh.numberofvertices,1))
+-
+ md=solve(md,TransientSolutionEnum())
+ 
+ #Fields and tolerances to track changes
+-field_names     =['Vx','Vy','Vel','Pressure','MaskIceLevelset']
+-field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
++field_names     =['Vx','Vy','Vel','Pressure','Thickness','Surface','MaskIceLevelset']
++field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
++		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
++		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
+ field_values=[\
+ 	md.results.TransientSolution[0].Vx,\
+ 	md.results.TransientSolution[0].Vy,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
++	md.results.TransientSolution[0].Thickness,\
++	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].MaskIceLevelset,\
+ 	md.results.TransientSolution[1].Vx,\
+ 	md.results.TransientSolution[1].Vy,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
++	md.results.TransientSolution[1].Thickness,\
++	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].MaskIceLevelset,\
++	md.results.TransientSolution[2].Vx,\
++	md.results.TransientSolution[2].Vy,\
++	md.results.TransientSolution[2].Vel,\
++	md.results.TransientSolution[2].Pressure,\
++	md.results.TransientSolution[2].Thickness,\
++	md.results.TransientSolution[2].Surface,\
++	md.results.TransientSolution[2].MaskIceLevelset,\
+ 	]
+Index: ../trunk-jpl/test/Archives/Archive336.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17437-17438.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17437-17438.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17437-17438.diff	(revision 17802)
@@ -0,0 +1,14 @@
+Index: ../trunk-jpl/test/Par/SquareSheetConstrained.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareSheetConstrained.py	(revision 17437)
++++ ../trunk-jpl/test/Par/SquareSheetConstrained.py	(revision 17438)
+@@ -42,6 +42,9 @@
+ #Damage
+ md.damage.D=numpy.zeros((md.mesh.numberofvertices,1))
+ 
++#Masstransport
++md.masstransport.calvingrate=0.*numpy.ones((md.mesh.numberofvertices,1))
++
+ #Friction
+ md.friction.coefficient=20.*numpy.ones((md.mesh.numberofvertices,1))
+ md.friction.coefficient[numpy.nonzero(md.mask.groundedice_levelset<0.)[0]]=0.
Index: issm/oecreview/Archive/16554-17801/ISSM-17438-17439.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17438-17439.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17438-17439.diff	(revision 17802)
@@ -0,0 +1,81 @@
+Index: ../trunk-jpl/test/NightlyRun/IdToName.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/IdToName.m	(revision 17438)
++++ ../trunk-jpl/test/NightlyRun/IdToName.m	(revision 17439)
+@@ -107,6 +107,7 @@
+ 	case 333, name='SquareSheetHydrologyDCTwoLayers';
+ 	case 334, name='SquareSheetConstrainedExtrudedHydrologyDC';
+ 	case 335, name='SquareSheetExtrudedHydrologyDCTwoLayers';
++	case 336, name='SquareSheetLevelsetSSAMasstransp2d';
+ 	case 401, name='SquareSheetShelfStressSSA2d';
+ 	case 402, name='SquareSheetShelfStressSSA3d';
+ 	case 403, name='SquareSheetShelfStressHO';
+Index: ../trunk-jpl/test/NightlyRun/IdToName.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/IdToName.py	(revision 17438)
++++ ../trunk-jpl/test/NightlyRun/IdToName.py	(revision 17439)
+@@ -106,7 +106,7 @@
+ 	329  : 'SquareSheetConstrainedSmbGradients3d',
+ 	332  : 'SquareSheetConstrainedHydrologyDC',
+ 	333  : 'SquareSheetHydrologyDCTwoLayers',
+-	336  : 'SquareSheetLevelsetSSA2d',
++	336  : 'SquareSheetLevelsetSSAMasstransp2d',
+ 	401  : 'SquareSheetShelfStressSSA2d',
+ 	402  : 'SquareSheetShelfStressSSA3d',
+ 	403  : 'SquareSheetShelfStressHO',
+Index: ../trunk-jpl/test/NightlyRun/test336.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test336.m	(revision 0)
++++ ../trunk-jpl/test/NightlyRun/test336.m	(revision 17439)
+@@ -0,0 +1,51 @@
++md=triangle(model(),'../Exp/Square.exp',100000.);
++md=setmask(md,'','');
++md=parameterize(md,'../Par/SquareSheetConstrained.py');
++md=setflowequation(md,'SSA','all');
++md.cluster=generic('name',oshostname(),'np',3);
++
++% parameters
++md.transient.isstressbalance=1;
++md.transient.ismasstransport=1;
++md.transient.isthermal=0;
++md.transient.isgroundingline=0;
++md.transient.isgia=0;
++md.transient.islevelset=1;
++
++% init levelset function
++xmin, xmax=min(md.mesh.x), max(md.mesh.x)
++ymin, ymax=min(md.mesh.y), max(md.mesh.y)
++xmed, ymed=(xmax+xmin)/2.,(ymax+ymin)/2.  
++
++md.mask.ice_levelset=md.mesh.y - ymed
++
++md=solve(md,TransientSolutionEnum())
++
++%Fields and tolerances to track changes
++field_names     ={'Vx','Vy','Vel','Pressure','Thickness','Surface','MaskIceLevelset'}
++field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
++		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
++		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13}
++field_values={\
++	md.results.TransientSolution[0].Vx,\
++	md.results.TransientSolution[0].Vy,\
++	md.results.TransientSolution[0].Vel,\
++	md.results.TransientSolution[0].Pressure,\
++	md.results.TransientSolution[0].Thickness,\
++	md.results.TransientSolution[0].Surface,\
++	md.results.TransientSolution[0].MaskIceLevelset,\
++	md.results.TransientSolution[1].Vx,\
++	md.results.TransientSolution[1].Vy,\
++	md.results.TransientSolution[1].Vel,\
++	md.results.TransientSolution[1].Pressure,\
++	md.results.TransientSolution[1].Thickness,\
++	md.results.TransientSolution[1].Surface,\
++	md.results.TransientSolution[1].MaskIceLevelset,\
++	md.results.TransientSolution[2].Vx,\
++	md.results.TransientSolution[2].Vy,\
++	md.results.TransientSolution[2].Vel,\
++	md.results.TransientSolution[2].Pressure,\
++	md.results.TransientSolution[2].Thickness,\
++	md.results.TransientSolution[2].Surface,\
++	md.results.TransientSolution[2].MaskIceLevelset,\
++	}
Index: issm/oecreview/Archive/16554-17801/ISSM-17439-17440.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17439-17440.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17439-17440.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/test/Par/SquareSheetConstrained.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareSheetConstrained.par	(revision 17439)
++++ ../trunk-jpl/test/Par/SquareSheetConstrained.par	(revision 17440)
+@@ -31,6 +31,7 @@
+ 
+ %Damage
+ md.damage.D=zeros(md.mesh.numberofvertices,1);
++md.masstransport.calvingrate=zeros(md.mesh.numberofvertices,1);
+ 
+ %Friction
+ md.friction.coefficient=20.*ones(md.mesh.numberofvertices,1);
Index: issm/oecreview/Archive/16554-17801/ISSM-17440-17441.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17440-17441.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17440-17441.diff	(revision 17802)
@@ -0,0 +1,81 @@
+Index: ../trunk-jpl/test/NightlyRun/test336.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test336.m	(revision 17440)
++++ ../trunk-jpl/test/NightlyRun/test336.m	(revision 17441)
+@@ -1,6 +1,6 @@
+ md=triangle(model(),'../Exp/Square.exp',100000.);
+ md=setmask(md,'','');
+-md=parameterize(md,'../Par/SquareSheetConstrained.py');
++md=parameterize(md,'../Par/SquareSheetConstrained.par');
+ md=setflowequation(md,'SSA','all');
+ md.cluster=generic('name',oshostname(),'np',3);
+ 
+@@ -13,39 +13,38 @@
+ md.transient.islevelset=1;
+ 
+ % init levelset function
+-xmin, xmax=min(md.mesh.x), max(md.mesh.x)
+-ymin, ymax=min(md.mesh.y), max(md.mesh.y)
+-xmed, ymed=(xmax+xmin)/2.,(ymax+ymin)/2.  
++ymed = (max(md.mesh.y)+min(md.mesh.y))/2;
++md.mask.ice_levelset=md.mesh.y - ymed;
+ 
+-md.mask.ice_levelset=md.mesh.y - ymed
+-
+ md=solve(md,TransientSolutionEnum())
+ 
+ %Fields and tolerances to track changes
+-field_names     ={'Vx','Vy','Vel','Pressure','Thickness','Surface','MaskIceLevelset'}
+-field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
+-		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
++field_names     ={'Vx1','Vy1','Vel1','Pressure1','Thickness1','Surface1','MaskIceLevelset1',...
++                  'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2',...
++                  'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3'}
++field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
++		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+ 		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13}
+-field_values={\
+-	md.results.TransientSolution[0].Vx,\
+-	md.results.TransientSolution[0].Vy,\
+-	md.results.TransientSolution[0].Vel,\
+-	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Thickness,\
+-	md.results.TransientSolution[0].Surface,\
+-	md.results.TransientSolution[0].MaskIceLevelset,\
+-	md.results.TransientSolution[1].Vx,\
+-	md.results.TransientSolution[1].Vy,\
+-	md.results.TransientSolution[1].Vel,\
+-	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Thickness,\
+-	md.results.TransientSolution[1].Surface,\
+-	md.results.TransientSolution[1].MaskIceLevelset,\
+-	md.results.TransientSolution[2].Vx,\
+-	md.results.TransientSolution[2].Vy,\
+-	md.results.TransientSolution[2].Vel,\
+-	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Thickness,\
+-	md.results.TransientSolution[2].Surface,\
+-	md.results.TransientSolution[2].MaskIceLevelset,\
++field_values={...
++	md.results.TransientSolution(1).Vx,...
++	md.results.TransientSolution(1).Vy,...
++	md.results.TransientSolution(1).Vel,...
++	md.results.TransientSolution(1).Pressure,...
++	md.results.TransientSolution(1).Thickness,...
++	md.results.TransientSolution(1).Surface,...
++	md.results.TransientSolution(1).MaskIceLevelset,...
++	md.results.TransientSolution(2).Vx,...
++	md.results.TransientSolution(2).Vy,...
++	md.results.TransientSolution(2).Vel,...
++	md.results.TransientSolution(2).Pressure,...
++	md.results.TransientSolution(2).Thickness,...
++	md.results.TransientSolution(2).Surface,...
++	md.results.TransientSolution(2).MaskIceLevelset,...
++	md.results.TransientSolution(3).Vx,...
++	md.results.TransientSolution(3).Vy,...
++	md.results.TransientSolution(3).Vel,...
++	md.results.TransientSolution(3).Pressure,...
++	md.results.TransientSolution(3).Thickness,...
++	md.results.TransientSolution(3).Surface,...
++	md.results.TransientSolution(3).MaskIceLevelset...
+ 	}
Index: issm/oecreview/Archive/16554-17801/ISSM-17441-17442.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17441-17442.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17441-17442.diff	(revision 17802)
@@ -0,0 +1,23 @@
+Index: ../trunk-jpl/src/c/cores/transient_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17441)
++++ ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17442)
+@@ -92,12 +92,12 @@
+ 		}
+ 	}
+ 
+-	if(islevelset){
+-		/* set distance on elements intersected by zero level set */
+-		LevelsetAnalysis* lsfanalysis = new LevelsetAnalysis();
+-		lsfanalysis->SetDistanceOnIntersectedElements(femmodel);
+-		delete lsfanalysis;
+-	}
++// 	if(islevelset){
++// 		/* set distance on elements intersected by zero level set */
++// 		LevelsetAnalysis* lsfanalysis = new LevelsetAnalysis();
++// 		lsfanalysis->SetDistanceOnIntersectedElements(femmodel);
++// 		delete lsfanalysis;
++// 	}
+ 	
+ 	while(time < finaltime - (yts*DBL_EPSILON)){ //make sure we run up to finaltime.
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17442-17443.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17442-17443.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17442-17443.diff	(revision 17802)
@@ -0,0 +1,23 @@
+Index: ../trunk-jpl/test/NightlyRun/test336.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test336.m	(revision 17442)
++++ ../trunk-jpl/test/NightlyRun/test336.m	(revision 17443)
+@@ -21,10 +21,10 @@
+ %Fields and tolerances to track changes
+ field_names     ={'Vx1','Vy1','Vel1','Pressure1','Thickness1','Surface1','MaskIceLevelset1',...
+                   'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2',...
+-                  'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3'}
++                  'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3'};
+ field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+ 		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+-		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13}
++		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
+ field_values={...
+ 	md.results.TransientSolution(1).Vx,...
+ 	md.results.TransientSolution(1).Vy,...
+@@ -47,4 +47,4 @@
+ 	md.results.TransientSolution(3).Thickness,...
+ 	md.results.TransientSolution(3).Surface,...
+ 	md.results.TransientSolution(3).MaskIceLevelset...
+-	}
++	};
Index: issm/oecreview/Archive/16554-17801/ISSM-17443-17444.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17443-17444.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17443-17444.diff	(revision 17802)
@@ -0,0 +1,148 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17443)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17444)
+@@ -123,10 +123,10 @@
+ 
+ 	iomodel->FetchData(1,MeshVertexonbedEnum);
+ 
+-	//create penalties for nodes: no node can have a temperature over the melting point
++	//create penalties for nodes: no node can have water above the max
+ 	CreateSingleNodeToElementConnectivity(iomodel);
+ 	for(int i=0;i<iomodel->numberofvertices;i++){
+-		if (iomodel->meshtype==Mesh3DEnum){
++		if (iomodel->meshtype!=Mesh3DEnum){
+ 			/*keep only this partition's nodes:*/
+ 			if(iomodel->my_vertices[i]){
+ 				loads->AddObject(new Pengrid(iomodel->loadcounter+i+1,i,iomodel,HydrologyDCInefficientAnalysisEnum));
+@@ -279,7 +279,7 @@
+ 	/*Intermediaries */
+ 	bool       active_element,isefficientlayer;
+ 	IssmDouble dt,scalar;
+-	IssmDouble moulin_load,water_head;
++	IssmDouble water_head;
+ 	IssmDouble water_load,transfer;
+ 	IssmDouble Jdet;
+ 
+@@ -306,7 +306,6 @@
+ 	Input* thickness_input   = basalelement->GetInput(ThicknessEnum);
+ 	Input* bed_input         = basalelement->GetInput(BedEnum);
+ 	Input* water_input       = basalelement->GetInput(BasalforcingsMeltingRateEnum);    _assert_(water_input);
+-	Input* moulin_input      = basalelement->GetInput(HydrologydcBasalMoulinInputEnum); _assert_(moulin_input);
+ 	if(dt!= 0.){old_wh_input = basalelement->GetInput(SedimentHeadOldEnum);             _assert_(old_wh_input);}
+ 
+ 	IssmDouble sediment_storing    = SedimentStoring(basalelement);
+@@ -326,10 +325,8 @@
+ 
+ 		/*Loading term*/
+ 		water_input->GetInputValue(&water_load,gauss);
+-		moulin_input->GetInputValue(&moulin_load,gauss);
+-	
++
+ 		scalar = Jdet*gauss->weight*(water_load);
+-		scalar = scalar + Jdet* moulin_load;
+ 		if(dt!=0.) scalar = scalar*dt;
+ 		for(int i=0;i<numnodes;i++){
+ 			pe->values[i]+=scalar*basis[i];
+Index: ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 17443)
++++ ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 17444)
+@@ -75,7 +75,11 @@
+ 		ElementVector* pe = analysis->CreatePVector(element);
+ 		element->ReduceMatrices(Ke,pe);
+ 		if(Ke) Ke->AddToGlobal(Kff,Kfs);
+-		if(pe) pe->AddToGlobal(pf);
++		if(pe){
++			pe->AddToGlobal(pf);
++			/* printf("-------------------USUAL \n"); */
++			/* pf->Echo(); */
++		}
+ 		delete Ke;
+ 		delete pe;
+ 	}
+@@ -86,6 +90,8 @@
+ 		if(load->InAnalysis(configuration_type)){
+ 			load->CreateKMatrix(Kff,Kfs);
+ 			load->CreatePVector(pf);
++			/* printf("-------------------LOADING \n"); */
++			/* pf->Echo(); */
+ 		}
+ 	}
+ 
+@@ -96,6 +102,8 @@
+ 			if(load->InAnalysis(configuration_type)){
+ 				load->PenaltyCreateKMatrix(Kff,Kfs,kmax);
+ 				load->PenaltyCreatePVector(pf,kmax);
++				/* printf("-------------------PENALTY \n"); */
++				/* pf->Echo(); */
+ 			}
+ 		}
+ 	}
+Index: ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 17443)
++++ ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 17444)
+@@ -180,9 +180,24 @@
+ /*FUNCTION Pengrid::CreatePVector {{{*/
+ void  Pengrid::CreatePVector(Vector<IssmDouble>* pf){
+ 
+-	/*No loads applied, do nothing: */
+-	return;
++	ElementVector* pe=NULL;
++	int analysis_type;
++	this->parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+ 
++	switch(analysis_type){
++		
++	case HydrologyDCInefficientAnalysisEnum:
++		pe = CreatePVectorHydrologyDCInefficient();
++		break;
++	default:
++		/*No loads applied, do nothing: */
++		return;
++	}
++	if(pe){
++		pe->AddToGlobal(pf);
++		delete pe;
++	}
++
+ }
+ /*}}}*/
+ /*FUNCTION Pengrid::GetNodesSidList{{{*/
+@@ -792,6 +807,23 @@
+ 	return pe;
+ }
+ /*}}}*/
++/*FUNCTION Pengrid::CreatePVectorHydrologyDCInefficient {{{*/
++ElementVector* Pengrid::CreatePVectorHydrologyDCInefficient(void){
++
++	IssmDouble moulin_load,dt;
++
++	/*Initialize Element matrix*/
++	ElementVector* pe=new ElementVector(&node,1,this->parameters);
++
++	this->element->GetInputValue(&moulin_load,node,HydrologydcBasalMoulinInputEnum);
++	parameters->FindParam(&dt,TimesteppingTimeStepEnum);
++
++	if(dt!=0.0) pe->values[0]=moulin_load*dt;
++
++	/*Clean up and return*/
++	return pe;
++ }
++/*}}}*/
+ /*FUNCTION Pengrid::ResetConstraint {{{*/
+ void  Pengrid::ResetConstraint(void){
+ 	active         = 0;
+Index: ../trunk-jpl/src/c/classes/Loads/Pengrid.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Pengrid.h	(revision 17443)
++++ ../trunk-jpl/src/c/classes/Loads/Pengrid.h	(revision 17444)
+@@ -93,6 +93,7 @@
+ 		ElementVector* PenaltyCreatePVectorHydrologyDCInefficient(IssmDouble kmax);
+ 		void           ConstraintActivateHydrologyDCInefficient(int* punstable);
+ 		void  ConstraintActivate(int* punstable);
++		ElementVector* CreatePVectorHydrologyDCInefficient(void);
+ 		void  ResetConstraint(void);
+ 		/*}}}*/
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17444-17445.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17444-17445.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17444-17445.diff	(revision 17802)
@@ -0,0 +1,16 @@
+Index: ../trunk-jpl/src/m/enum/HydrologydcBasalMoulinInputEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/HydrologydcBasalMoulinInputEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/HydrologydcBasalMoulinInputEnum.m	(revision 17445)
+@@ -0,0 +1,11 @@
++function macro=HydrologydcBasalMoulinInputEnum()
++%HYDROLOGYDCBASALMOULININPUTENUM - Enum of HydrologydcBasalMoulinInput
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=HydrologydcBasalMoulinInputEnum()
++
++macro=StringToEnum('HydrologydcBasalMoulinInput');
Index: issm/oecreview/Archive/16554-17801/ISSM-17445-17446.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17445-17446.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17445-17446.diff	(revision 17802)
@@ -0,0 +1,34 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17445)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17446)
+@@ -2346,10 +2346,8 @@
+ 
+ 	/*If the level set is awlays <0, there is no ice front here*/
+ 	iszerols= false;
+-	if(IsIceInElement()){
+-		if(ls[0]*ls[1]<0. || ls[0]*ls[2]<0. || (ls[0]*ls[1]+ls[0]*ls[2]+ls[1]*ls[2]==0.)){
+-			iszerols= true;
+-		}
++	if(ls[0]*ls[1]<0. || ls[0]*ls[2]<0. || (ls[0]*ls[1]*ls[2]==0. && ls[0]*ls[1]+ls[0]*ls[2]+ls[1]*ls[2]<=0.)){
++		iszerols = true;
+ 	}
+ 
+ 	return iszerols;
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17445)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17446)
+@@ -2911,10 +2911,8 @@
+ 
+ 	/*If the level set has always same sign, there is no ice front here*/
+ 	iszerols = false;
+-	if(IsIceInElement()){
+-		if(ls[0]*ls[1]<0. || ls[0]*ls[2]<0. || (ls[0]*ls[1]+ls[0]*ls[2]+ls[1]*ls[2]==0.)){
+-			iszerols = true;
+-		}
++	if(ls[0]*ls[1]<0. || ls[0]*ls[2]<0. || (ls[0]*ls[1]*ls[2]==0. && ls[0]*ls[1]+ls[0]*ls[2]+ls[1]*ls[2]<=0.)){
++		iszerols = true;
+ 	}
+ 	return iszerols;
+ }
Index: issm/oecreview/Archive/16554-17801/ISSM-17446-17447.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17446-17447.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17446-17447.diff	(revision 17802)
@@ -0,0 +1,85 @@
+Index: ../trunk-jpl/test/NightlyRun/test801.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test801.py	(revision 0)
++++ ../trunk-jpl/test/NightlyRun/test801.py	(revision 17447)
+@@ -0,0 +1,58 @@
++from model import *
++from triangle import *
++from squaremesh import *
++from setmask import *
++from parameterize import *
++from setflowequation import *
++from EnumDefinitions import *
++from solve import *
++from MatlabFuncs import *
++
++md=triangle(model(),'../Exp/Square.exp',30000)
++md=setmask(md,'','')
++md=parameterize(md,'../Par/ValleyGlacierShelf.py')
++md=setflowequation(md,'SSA','all')
++md.cluster=generic('name',oshostname(),'np',1)
++
++#Transient
++md.transient.isstressbalance=True
++md.transient.islevelset=True
++md.transient.ismasstransport=True
++md.transient.isthermal=False
++md.transient.isgroundingline=True
++md.transient.isgia=False
++
++md.transient.requested_outputs=['IceVolume']
++
++md=solve(md,TransientSolutionEnum())
++
++#Fields and tolerances to track changes
++field_names     =['Vx1','Vy1','Vel1','Pressure1','Thickness1','Surface1','MaskIceLevelset1',\
++		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2',\
++		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3']
++field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
++		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
++		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
++field_values=[\
++	md.results.TransientSolution[0].Vx,\
++	md.results.TransientSolution[0].Vy,\
++	md.results.TransientSolution[0].Vel,\
++	md.results.TransientSolution[0].Pressure,\
++	md.results.TransientSolution[0].Thickness,\
++	md.results.TransientSolution[0].Surface,\
++	md.results.TransientSolution[0].MaskIceLevelset,\
++	md.results.TransientSolution[1].Vx,\
++	md.results.TransientSolution[1].Vy,\
++	md.results.TransientSolution[1].Vel,\
++	md.results.TransientSolution[1].Pressure,\
++	md.results.TransientSolution[1].Thickness,\
++	md.results.TransientSolution[1].Surface,\
++	md.results.TransientSolution[1].MaskIceLevelset,\
++	md.results.TransientSolution[2].Vx,\
++	md.results.TransientSolution[2].Vy,\
++	md.results.TransientSolution[2].Vel,\
++	md.results.TransientSolution[2].Pressure,\
++	md.results.TransientSolution[2].Thickness,\
++	md.results.TransientSolution[2].Surface,\
++	md.results.TransientSolution[2].MaskIceLevelset,\
++	]
+Index: ../trunk-jpl/test/NightlyRun/IdToName.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/IdToName.py	(revision 17446)
++++ ../trunk-jpl/test/NightlyRun/IdToName.py	(revision 17447)
+@@ -172,6 +172,7 @@
+ 	610  : '79NorthBalThic3d',
+ 	611  : '79NorthCMBalThic2dCG',
+ 	613  : '79NorthCMBalThicVxVy',
++	801	 : 'ValleyGlacierLevelsetSSA2d',	
+ 	1101 : 'ISMIPAHO',
+ 	1102 : 'ISMIPAFS',
+ 	1103 : 'ISMIPBHO',
+Index: ../trunk-jpl/test/Archives/Archive801.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/test/Archives/Archive801.nc
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+
Index: issm/oecreview/Archive/16554-17801/ISSM-17447-17448.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17447-17448.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17447-17448.diff	(revision 17802)
@@ -0,0 +1,120 @@
+Index: ../trunk-jpl/test/Par/ValleyGlacierShelf.py
+===================================================================
+--- ../trunk-jpl/test/Par/ValleyGlacierShelf.py	(revision 0)
++++ ../trunk-jpl/test/Par/ValleyGlacierShelf.py	(revision 17448)
+@@ -0,0 +1,98 @@
++import os.path
++import netCDF4
++import numpy
++import inspect
++import math
++from verbose import verbose
++from InterpFromMeshToMesh2d import InterpFromMeshToMesh2d
++from paterson import paterson
++from SetIceShelfBC import SetIceShelfBC
++
++#Start defining model parameters here
++x=md.mesh.x.reshape(-1,1)
++y=md.mesh.y.reshape(-1,1)
++xmin, xmax = min(x), max(x)
++ymin, ymax = min(y), max(y)
++Lx=(xmax-xmin)
++Ly=(ymax-ymin)
++xm,ym = (xmin+xmax)/2., (ymin+ymax)/2.
++
++#Geometry: U-shaped valley in y direction
++thk_center = 1000.
++thk_margin = 0.5*thk_center
++bmax=0.
++bmin=-thk_center*md.materials.rho_ice/md.materials.rho_water
++
++alpha=2./3.
++slope = (bmin-bmax)*(x-xmin)/(Lx*alpha) + bmax
++md.geometry.surface= (thk_center+bmax) + slope 
++md.geometry.bed=bmax + slope + 4./Ly**2*(thk_center-thk_margin)*(numpy.power(y-ym,2))
++md.geometry.thickness=md.geometry.surface - md.geometry.bed
++md.geometry.bathymetry = md.geometry.bed
++
++#Mask
++md.mask.ice_levelset=x - alpha*Lx
++md.mask.groundedice_levelset= numpy.ones((md.mesh.numberofvertices,1))
++
++#Initial velocity 
++md.initialization.vx=numpy.zeros((md.mesh.numberofvertices,1))
++md.initialization.vy=numpy.zeros((md.mesh.numberofvertices,1))
++md.initialization.vz=numpy.zeros((md.mesh.numberofvertices,1))
++md.initialization.pressure=numpy.zeros((md.mesh.numberofvertices,1))
++
++#Materials
++md.initialization.temperature=(273.15-5.)*numpy.ones((md.mesh.numberofvertices,1))
++md.materials.rheology_B=paterson(md.initialization.temperature)
++md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
++
++#Groundingline
++md.groundingline.migration='SubelementMigration'
++
++#Damage
++md.damage.D=numpy.zeros((md.mesh.numberofvertices,1))
++
++#Surface mass balance and basal melting
++md.surfaceforcings.mass_balance=0.3*numpy.ones((md.mesh.numberofvertices,1))
++md.basalforcings.melting_rate=md.surfaceforcings.mass_balance
++
++#Friction
++md.friction.coefficient=20.*numpy.ones((md.mesh.numberofvertices,1))
++md.friction.coefficient[numpy.nonzero(md.mask.groundedice_levelset<0.)[0]]=0.
++md.friction.p=numpy.ones((md.mesh.numberofelements,1))
++md.friction.q=numpy.ones((md.mesh.numberofelements,1))
++
++#Transient
++md.transient.isstressbalance=True
++md.transient.islevelset=True
++md.transient.ismasstransport=False
++md.transient.isthermal=False
++md.transient.isgroundingline=True
++md.transient.isgia=False
++
++#Stressbalance
++md.stressbalance.maxiter=100
++md.stressbalance.viscosity_overshoot=0.0
++md.stressbalance.restol=0.05
++md.stressbalance.reltol=0.05
++md.stressbalance.abstol=float('nan')
++
++#Masstransport
++md.masstransport.calvingrate=0.*numpy.ones((md.mesh.numberofvertices,1))
++md.masstransport.stabilization=1.
++
++#Numerical parameters
++md.thermal.stabilization=1.
++md.settings.waitonlock=30
++md.steadystate.reltol=0.05
++md.timestepping.time_step=1.
++md.timestepping.final_time=3.
++
++#Verbose
++md.verbose = verbose(0)
++
++#Deal with boundary conditions:
++md = SetIceShelfBC(md)
++
++#Change name so that no tests have the same name
++if len(inspect.stack()) > 2:
++	md.miscellaneous.name = os.path.basename(inspect.stack()[2][1]).split('.')[0]
+Index: ../trunk-jpl/test/NightlyRun/test801.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test801.py	(revision 17447)
++++ ../trunk-jpl/test/NightlyRun/test801.py	(revision 17448)
+@@ -8,7 +8,7 @@
+ from solve import *
+ from MatlabFuncs import *
+ 
+-md=triangle(model(),'../Exp/Square.exp',30000)
++md=triangle(model(),'../Exp/Square.exp',50000)
+ md=setmask(md,'','')
+ md=parameterize(md,'../Par/ValleyGlacierShelf.py')
+ md=setflowequation(md,'SSA','all')
+Index: ../trunk-jpl/test/Archives/Archive801.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17448-17449.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17448-17449.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17448-17449.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17448)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17449)
+@@ -599,7 +599,7 @@
+ 		}
+ 
+ 	}
+-	else if(meshtype==Mesh2DhorizontalEnum){
++	else if(meshtype==Mesh2DhorizontalEnum || meshtype==Mesh3DEnum){
+ 		/*Check that not all nodes are grounded or floating*/
+ 		if(gl[0]>0 && gl[1]>0 && gl[2]>0){ // All grounded
+ 			phi=1;
Index: issm/oecreview/Archive/16554-17801/ISSM-17449-17450.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17449-17450.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17449-17450.diff	(revision 17802)
@@ -0,0 +1,22 @@
+Index: ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp	(revision 17449)
++++ ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp	(revision 17450)
+@@ -10,6 +10,7 @@
+ #include "../modules.h"
+ 
+ void SetActiveNodesLSMx(FemModel* femmodel){/*{{{*/
++	/* activate/deactivate nodes for levelset method according to IceMaskNodeActivation */
+ 
+ 	/* intermediaries */
+ 	bool solvein2d=false;
+@@ -98,9 +99,6 @@
+ 	/*Initialize vector with number of vertices*/
+ 	int numvertices=femmodel->vertices->NumberOfVertices();
+ 	Vector<IssmDouble>* vec_mask_ice=new Vector<IssmDouble>(numvertices); //vertices that have ice at next time step
+-	for(i=0;i<numvertices;i++){
+-		vec_mask_ice->SetValue(i,0.,INS_VAL);
+-	}
+ 	/*Fill vector with values: */
+ 	for(i=0;i<femmodel->elements->Size();i++){
+ 		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
Index: issm/oecreview/Archive/16554-17801/ISSM-17450-17451.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17450-17451.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17450-17451.diff	(revision 17802)
@@ -0,0 +1,123 @@
+Index: ../trunk-jpl/test/Par/ValleyGlacierShelf.py
+===================================================================
+--- ../trunk-jpl/test/Par/ValleyGlacierShelf.py	(revision 17450)
++++ ../trunk-jpl/test/Par/ValleyGlacierShelf.py	(revision 17451)
+@@ -45,6 +45,10 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature)
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
++#Thermal
++md.thermal.isenthalpy=False
++md.thermal.spctemperature=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
++
+ #Groundingline
+ md.groundingline.migration='SubelementMigration'
+ 
+Index: ../trunk-jpl/test/NightlyRun/test801.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test801.py	(revision 17450)
++++ ../trunk-jpl/test/NightlyRun/test801.py	(revision 17451)
+@@ -12,7 +12,7 @@
+ md=setmask(md,'','')
+ md=parameterize(md,'../Par/ValleyGlacierShelf.py')
+ md=setflowequation(md,'SSA','all')
+-md.cluster=generic('name',oshostname(),'np',1)
++md.cluster=generic('name',oshostname(),'np',3)
+ 
+ #Transient
+ md.transient.isstressbalance=True
+Index: ../trunk-jpl/test/NightlyRun/test802.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test802.py	(revision 0)
++++ ../trunk-jpl/test/NightlyRun/test802.py	(revision 17451)
+@@ -0,0 +1,64 @@
++from model import *
++from triangle import *
++from squaremesh import *
++from setmask import *
++from parameterize import *
++from setflowequation import *
++from EnumDefinitions import *
++from solve import *
++from MatlabFuncs import *
++
++md=triangle(model(),'../Exp/Square.exp',50000)
++md=setmask(md,'','')
++md=parameterize(md,'../Par/ValleyGlacierShelf.py')
++md.extrude(3,2.)
++md=setflowequation(md,'SSA','all')
++md.cluster=generic('name',oshostname(),'np',3)
++
++#Thermal model
++pos_surf=numpy.nonzero(md.mesh.vertexonsurface)[0]
++md.thermal.spctemperature[pos_surf]=md.initialization.temperature[pos_surf]
++
++#Transient
++md.transient.isstressbalance=True
++md.transient.islevelset=True
++md.transient.ismasstransport=True
++md.transient.isthermal=True
++md.transient.isgroundingline=True
++md.transient.isgia=False
++
++md=solve(md,TransientSolutionEnum())
++
++#Fields and tolerances to track changes
++field_names     =['Vx1','Vy1','Vel1','Pressure1','Thickness1','Surface1','MaskIceLevelset1','Temperature1',\
++		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2','Temperature2',\
++		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3','Temperature3']
++field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
++		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,\
++		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10]
++field_values=[\
++	md.results.TransientSolution[0].Vx,\
++	md.results.TransientSolution[0].Vy,\
++	md.results.TransientSolution[0].Vel,\
++	md.results.TransientSolution[0].Pressure,\
++	md.results.TransientSolution[0].Thickness,\
++	md.results.TransientSolution[0].Surface,\
++	md.results.TransientSolution[0].MaskIceLevelset,\
++	md.results.TransientSolution[0].Temperature,\
++	md.results.TransientSolution[1].Vx,\
++	md.results.TransientSolution[1].Vy,\
++	md.results.TransientSolution[1].Vel,\
++	md.results.TransientSolution[1].Pressure,\
++	md.results.TransientSolution[1].Thickness,\
++	md.results.TransientSolution[1].Surface,\
++	md.results.TransientSolution[1].MaskIceLevelset,\
++	md.results.TransientSolution[1].Temperature,\
++	md.results.TransientSolution[2].Vx,\
++	md.results.TransientSolution[2].Vy,\
++	md.results.TransientSolution[2].Vel,\
++	md.results.TransientSolution[2].Pressure,\
++	md.results.TransientSolution[2].Thickness,\
++	md.results.TransientSolution[2].Surface,\
++	md.results.TransientSolution[2].MaskIceLevelset,\
++	md.results.TransientSolution[2].Temperature,\
++	]
+Index: ../trunk-jpl/test/NightlyRun/IdToName.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/IdToName.py	(revision 17450)
++++ ../trunk-jpl/test/NightlyRun/IdToName.py	(revision 17451)
+@@ -173,6 +173,7 @@
+ 	611  : '79NorthCMBalThic2dCG',
+ 	613  : '79NorthCMBalThicVxVy',
+ 	801	 : 'ValleyGlacierLevelsetSSA2d',	
++	802	 : 'ValleyGlacierLevelsetThermalSSA3d',	
+ 	1101 : 'ISMIPAHO',
+ 	1102 : 'ISMIPAFS',
+ 	1103 : 'ISMIPBHO',
+Index: ../trunk-jpl/test/Archives/Archive802.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/test/Archives/Archive802.nc
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+
+Index: ../trunk-jpl/test/Archives/Archive801.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17451-17452.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17451-17452.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17451-17452.diff	(revision 17802)
@@ -0,0 +1,114 @@
+Index: ../trunk-jpl/test/Par/ValleyGlacierShelf.py
+===================================================================
+--- ../trunk-jpl/test/Par/ValleyGlacierShelf.py	(revision 17451)
++++ ../trunk-jpl/test/Par/ValleyGlacierShelf.py	(revision 17452)
+@@ -42,6 +42,8 @@
+ 
+ #Materials
+ md.initialization.temperature=(273.15-5.)*numpy.ones((md.mesh.numberofvertices,1))
++md.initialization.waterfraction=numpy.zeros((md.mesh.numberofvertices,1))
++md.initialization.watercolumn=numpy.zeros((md.mesh.numberofvertices,1))
+ md.materials.rheology_B=paterson(md.initialization.temperature)
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+Index: ../trunk-jpl/test/NightlyRun/test803.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test803.py	(revision 0)
++++ ../trunk-jpl/test/NightlyRun/test803.py	(revision 17452)
+@@ -0,0 +1,70 @@
++from model import *
++from triangle import *
++from squaremesh import *
++from setmask import *
++from parameterize import *
++from setflowequation import *
++from EnumDefinitions import *
++from solve import *
++from MatlabFuncs import *
++
++md=triangle(model(),'../Exp/Square.exp',50000)
++md=setmask(md,'','')
++md=parameterize(md,'../Par/ValleyGlacierShelf.py')
++md.extrude(3,2.)
++md=setflowequation(md,'HO','all')
++md.cluster=generic('name',oshostname(),'np',3)
++
++#Thermal model
++pos_surf=numpy.nonzero(md.mesh.vertexonsurface)[0]
++md.thermal.spctemperature[pos_surf]=md.initialization.temperature[pos_surf]
++md.thermal.isenthalpy=True
++
++#Transient
++md.transient.isstressbalance=True
++md.transient.islevelset=True
++md.transient.ismasstransport=True
++md.transient.isthermal=True
++md.transient.isgroundingline=True
++md.transient.isgia=False
++
++md=solve(md,TransientSolutionEnum())
++
++#Fields and tolerances to track changes
++field_names     =['Vx1','Vy1','Vel1','Pressure1','Thickness1','Surface1','MaskIceLevelset1','Enthalpy1','Watercolumn1',\
++		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2','Enthalpy2','Watercolumn2',\
++		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3','Enthalpy3','Watercolumn3']
++field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
++		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,\
++		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10]
++field_values=[\
++	md.results.TransientSolution[0].Vx,\
++	md.results.TransientSolution[0].Vy,\
++	md.results.TransientSolution[0].Vel,\
++	md.results.TransientSolution[0].Pressure,\
++	md.results.TransientSolution[0].Thickness,\
++	md.results.TransientSolution[0].Surface,\
++	md.results.TransientSolution[0].MaskIceLevelset,\
++	md.results.TransientSolution[0].Enthalpy,\
++	md.results.TransientSolution[0].Watercolumn,\
++	md.results.TransientSolution[1].Vx,\
++	md.results.TransientSolution[1].Vy,\
++	md.results.TransientSolution[1].Vel,\
++	md.results.TransientSolution[1].Pressure,\
++	md.results.TransientSolution[1].Thickness,\
++	md.results.TransientSolution[1].Surface,\
++	md.results.TransientSolution[1].MaskIceLevelset,\
++	md.results.TransientSolution[1].Enthalpy,\
++	md.results.TransientSolution[1].Watercolumn,\
++	md.results.TransientSolution[1].Temperature,\
++	md.results.TransientSolution[2].Vx,\
++	md.results.TransientSolution[2].Vy,\
++	md.results.TransientSolution[2].Vel,\
++	md.results.TransientSolution[2].Pressure,\
++	md.results.TransientSolution[2].Thickness,\
++	md.results.TransientSolution[2].Surface,\
++	md.results.TransientSolution[2].MaskIceLevelset,\
++	md.results.TransientSolution[2].Enthalpy,\
++	md.results.TransientSolution[2].Watercolumn,\
++
++	]
+Index: ../trunk-jpl/test/NightlyRun/IdToName.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/IdToName.py	(revision 17451)
++++ ../trunk-jpl/test/NightlyRun/IdToName.py	(revision 17452)
+@@ -172,8 +172,9 @@
+ 	610  : '79NorthBalThic3d',
+ 	611  : '79NorthCMBalThic2dCG',
+ 	613  : '79NorthCMBalThicVxVy',
+-	801	 : 'ValleyGlacierLevelsetSSA2d',	
+-	802	 : 'ValleyGlacierLevelsetThermalSSA3d',	
++	801  : 'ValleyGlacierLevelsetSSA2d',	
++	802  : 'ValleyGlacierLevelsetThermalSSA3d',	
++	803  : 'ValleyGlacierLevelsetEnthalpyHO3d',	
+ 	1101 : 'ISMIPAHO',
+ 	1102 : 'ISMIPAFS',
+ 	1103 : 'ISMIPBHO',
+Index: ../trunk-jpl/test/Archives/Archive803.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/test/Archives/Archive803.nc
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+
Index: issm/oecreview/Archive/16554-17801/ISSM-17452-17453.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17452-17453.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17452-17453.diff	(revision 17802)
@@ -0,0 +1,148 @@
+Index: ../trunk-jpl/test/NightlyRun/test336.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test336.py	(revision 17452)
++++ ../trunk-jpl/test/NightlyRun/test336.py	(revision 17453)
+@@ -1,60 +0,0 @@
+-from model import *
+-from triangle import *
+-from setmask import *
+-from parameterize import *
+-from setflowequation import *
+-from EnumDefinitions import *
+-from solve import *
+-from MatlabFuncs import *
+-
+-md=triangle(model(),'../Exp/Square.exp',100000.)
+-md=setmask(md,'','')
+-md=parameterize(md,'../Par/SquareSheetConstrained.py') 
+-md=setflowequation(md,'SSA','all')
+-md.cluster=generic('name',oshostname(),'np',3)
+-
+-# parameters
+-md.transient.isstressbalance=True
+-md.transient.ismasstransport=True
+-md.transient.isthermal=False
+-md.transient.isgroundingline=False
+-md.transient.isgia=False
+-md.transient.islevelset=True
+-
+-# init levelset function
+-xmin, xmax=min(md.mesh.x), max(md.mesh.x)
+-ymin, ymax=min(md.mesh.y), max(md.mesh.y)
+-xmed, ymed=(xmax+xmin)/2.,(ymax+ymin)/2.  
+-
+-md.mask.ice_levelset=md.mesh.y.reshape(-1,1) - ymed
+-
+-md=solve(md,TransientSolutionEnum())
+-
+-#Fields and tolerances to track changes
+-field_names     =['Vx','Vy','Vel','Pressure','Thickness','Surface','MaskIceLevelset']
+-field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
+-		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
+-		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
+-field_values=[\
+-	md.results.TransientSolution[0].Vx,\
+-	md.results.TransientSolution[0].Vy,\
+-	md.results.TransientSolution[0].Vel,\
+-	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Thickness,\
+-	md.results.TransientSolution[0].Surface,\
+-	md.results.TransientSolution[0].MaskIceLevelset,\
+-	md.results.TransientSolution[1].Vx,\
+-	md.results.TransientSolution[1].Vy,\
+-	md.results.TransientSolution[1].Vel,\
+-	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Thickness,\
+-	md.results.TransientSolution[1].Surface,\
+-	md.results.TransientSolution[1].MaskIceLevelset,\
+-	md.results.TransientSolution[2].Vx,\
+-	md.results.TransientSolution[2].Vy,\
+-	md.results.TransientSolution[2].Vel,\
+-	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Thickness,\
+-	md.results.TransientSolution[2].Surface,\
+-	md.results.TransientSolution[2].MaskIceLevelset,\
+-	]
+Index: ../trunk-jpl/test/NightlyRun/test336.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test336.m	(revision 17452)
++++ ../trunk-jpl/test/NightlyRun/test336.m	(revision 17453)
+@@ -1,50 +0,0 @@
+-md=triangle(model(),'../Exp/Square.exp',100000.);
+-md=setmask(md,'','');
+-md=parameterize(md,'../Par/SquareSheetConstrained.par');
+-md=setflowequation(md,'SSA','all');
+-md.cluster=generic('name',oshostname(),'np',3);
+-
+-% parameters
+-md.transient.isstressbalance=1;
+-md.transient.ismasstransport=1;
+-md.transient.isthermal=0;
+-md.transient.isgroundingline=0;
+-md.transient.isgia=0;
+-md.transient.islevelset=1;
+-
+-% init levelset function
+-ymed = (max(md.mesh.y)+min(md.mesh.y))/2;
+-md.mask.ice_levelset=md.mesh.y - ymed;
+-
+-md=solve(md,TransientSolutionEnum())
+-
+-%Fields and tolerances to track changes
+-field_names     ={'Vx1','Vy1','Vel1','Pressure1','Thickness1','Surface1','MaskIceLevelset1',...
+-                  'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2',...
+-                  'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3'};
+-field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+-		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+-		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
+-field_values={...
+-	md.results.TransientSolution(1).Vx,...
+-	md.results.TransientSolution(1).Vy,...
+-	md.results.TransientSolution(1).Vel,...
+-	md.results.TransientSolution(1).Pressure,...
+-	md.results.TransientSolution(1).Thickness,...
+-	md.results.TransientSolution(1).Surface,...
+-	md.results.TransientSolution(1).MaskIceLevelset,...
+-	md.results.TransientSolution(2).Vx,...
+-	md.results.TransientSolution(2).Vy,...
+-	md.results.TransientSolution(2).Vel,...
+-	md.results.TransientSolution(2).Pressure,...
+-	md.results.TransientSolution(2).Thickness,...
+-	md.results.TransientSolution(2).Surface,...
+-	md.results.TransientSolution(2).MaskIceLevelset,...
+-	md.results.TransientSolution(3).Vx,...
+-	md.results.TransientSolution(3).Vy,...
+-	md.results.TransientSolution(3).Vel,...
+-	md.results.TransientSolution(3).Pressure,...
+-	md.results.TransientSolution(3).Thickness,...
+-	md.results.TransientSolution(3).Surface,...
+-	md.results.TransientSolution(3).MaskIceLevelset...
+-	};
+Index: ../trunk-jpl/test/NightlyRun/IdToName.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/IdToName.m	(revision 17452)
++++ ../trunk-jpl/test/NightlyRun/IdToName.m	(revision 17453)
+@@ -107,7 +107,6 @@
+ 	case 333, name='SquareSheetHydrologyDCTwoLayers';
+ 	case 334, name='SquareSheetConstrainedExtrudedHydrologyDC';
+ 	case 335, name='SquareSheetExtrudedHydrologyDCTwoLayers';
+-	case 336, name='SquareSheetLevelsetSSAMasstransp2d';
+ 	case 401, name='SquareSheetShelfStressSSA2d';
+ 	case 402, name='SquareSheetShelfStressSSA3d';
+ 	case 403, name='SquareSheetShelfStressHO';
+Index: ../trunk-jpl/test/NightlyRun/IdToName.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/IdToName.py	(revision 17452)
++++ ../trunk-jpl/test/NightlyRun/IdToName.py	(revision 17453)
+@@ -106,7 +106,6 @@
+ 	329  : 'SquareSheetConstrainedSmbGradients3d',
+ 	332  : 'SquareSheetConstrainedHydrologyDC',
+ 	333  : 'SquareSheetHydrologyDCTwoLayers',
+-	336  : 'SquareSheetLevelsetSSAMasstransp2d',
+ 	401  : 'SquareSheetShelfStressSSA2d',
+ 	402  : 'SquareSheetShelfStressSSA3d',
+ 	403  : 'SquareSheetShelfStressHO',
+Index: ../trunk-jpl/test/Archives/Archive336.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17453-17454.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17453-17454.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17453-17454.diff	(revision 17802)
@@ -0,0 +1,190 @@
+Index: ../trunk-jpl/test/NightlyRun/test803.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test803.py	(revision 17453)
++++ ../trunk-jpl/test/NightlyRun/test803.py	(revision 17454)
+@@ -56,7 +56,6 @@
+ 	md.results.TransientSolution[1].MaskIceLevelset,\
+ 	md.results.TransientSolution[1].Enthalpy,\
+ 	md.results.TransientSolution[1].Watercolumn,\
+-	md.results.TransientSolution[1].Temperature,\
+ 	md.results.TransientSolution[2].Vx,\
+ 	md.results.TransientSolution[2].Vy,\
+ 	md.results.TransientSolution[2].Vel,\
+@@ -66,5 +65,4 @@
+ 	md.results.TransientSolution[2].MaskIceLevelset,\
+ 	md.results.TransientSolution[2].Enthalpy,\
+ 	md.results.TransientSolution[2].Watercolumn,\
+-
+ 	]
+Index: ../trunk-jpl/test/NightlyRun/test804.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test804.py	(revision 0)
++++ ../trunk-jpl/test/NightlyRun/test804.py	(revision 17454)
+@@ -0,0 +1,59 @@
++from model import *
++from triangle import *
++from squaremesh import *
++from setmask import *
++from parameterize import *
++from setflowequation import *
++from EnumDefinitions import *
++from solve import *
++from MatlabFuncs import *
++
++md=triangle(model(),'../Exp/Square.exp',50000)
++md=setmask(md,'','')
++md=parameterize(md,'../Par/ValleyGlacierShelf.py')
++md=setflowequation(md,'SIA','all')
++md.cluster=generic('name',oshostname(),'np',3)
++
++#Transient
++md.transient.isstressbalance=True
++md.transient.islevelset=True
++md.transient.ismasstransport=True
++md.transient.isthermal=False
++md.transient.isgroundingline=True
++md.transient.isgia=False
++
++md.masstransport.calvingrate=1000.*numpy.ones((md.mesh.numberofvertices,1))
++
++md=solve(md,TransientSolutionEnum())
++
++#Fields and tolerances to track changes
++field_names     =['Vx1','Vy1','Vel1','Pressure1','Thickness1','Surface1','MaskIceLevelset1',\
++		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2',\
++		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3']
++field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
++		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
++		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
++field_values=[\
++	md.results.TransientSolution[0].Vx,\
++	md.results.TransientSolution[0].Vy,\
++	md.results.TransientSolution[0].Vel,\
++	md.results.TransientSolution[0].Pressure,\
++	md.results.TransientSolution[0].Thickness,\
++	md.results.TransientSolution[0].Surface,\
++	md.results.TransientSolution[0].MaskIceLevelset,\
++	md.results.TransientSolution[1].Vx,\
++	md.results.TransientSolution[1].Vy,\
++	md.results.TransientSolution[1].Vel,\
++	md.results.TransientSolution[1].Pressure,\
++	md.results.TransientSolution[1].Thickness,\
++	md.results.TransientSolution[1].Surface,\
++	md.results.TransientSolution[1].MaskIceLevelset,\
++	md.results.TransientSolution[2].Vx,\
++	md.results.TransientSolution[2].Vy,\
++	md.results.TransientSolution[2].Vel,\
++	md.results.TransientSolution[2].Pressure,\
++	md.results.TransientSolution[2].Thickness,\
++	md.results.TransientSolution[2].Surface,\
++	md.results.TransientSolution[2].MaskIceLevelset,\
++
++	]
+Index: ../trunk-jpl/test/NightlyRun/test805.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test805.py	(revision 0)
++++ ../trunk-jpl/test/NightlyRun/test805.py	(revision 17454)
+@@ -0,0 +1,70 @@
++from model import *
++from triangle import *
++from squaremesh import *
++from setmask import *
++from parameterize import *
++from setflowequation import *
++from EnumDefinitions import *
++from solve import *
++from MatlabFuncs import *
++
++md=triangle(model(),'../Exp/Square.exp',50000)
++md=setmask(md,'','')
++md=parameterize(md,'../Par/ValleyGlacierShelf.py')
++md.extrude(3,2.)
++md=setflowequation(md,'HO','all')
++md.cluster=generic('name',oshostname(),'np',3)
++
++#Thermal model
++pos_surf=numpy.nonzero(md.mesh.vertexonsurface)[0]
++md.thermal.spctemperature[pos_surf]=md.initialization.temperature[pos_surf]
++md.thermal.isenthalpy=True
++
++#Transient
++md.transient.isstressbalance=True
++md.transient.islevelset=True
++md.transient.ismasstransport=True
++md.transient.isthermal=True
++md.transient.isgroundingline=True
++md.transient.isgia=False
++
++md.masstransport.calvingrate=1000.*numpy.ones((md.mesh.numberofvertices,1))
++
++md=solve(md,TransientSolutionEnum())
++
++#Fields and tolerances to track changes
++field_names     =['Vx1','Vy1','Vel1','Pressure1','Thickness1','Surface1','MaskIceLevelset1','Enthalpy1','Watercolumn1',\
++		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2','Enthalpy2','Watercolumn2',\
++		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3','Enthalpy3','Watercolumn3']
++field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
++		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,\
++		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10]
++field_values=[\
++	md.results.TransientSolution[0].Vx,\
++	md.results.TransientSolution[0].Vy,\
++	md.results.TransientSolution[0].Vel,\
++	md.results.TransientSolution[0].Pressure,\
++	md.results.TransientSolution[0].Thickness,\
++	md.results.TransientSolution[0].Surface,\
++	md.results.TransientSolution[0].MaskIceLevelset,\
++	md.results.TransientSolution[0].Enthalpy,\
++	md.results.TransientSolution[0].Watercolumn,\
++	md.results.TransientSolution[1].Vx,\
++	md.results.TransientSolution[1].Vy,\
++	md.results.TransientSolution[1].Vel,\
++	md.results.TransientSolution[1].Pressure,\
++	md.results.TransientSolution[1].Thickness,\
++	md.results.TransientSolution[1].Surface,\
++	md.results.TransientSolution[1].MaskIceLevelset,\
++	md.results.TransientSolution[1].Enthalpy,\
++	md.results.TransientSolution[1].Watercolumn,\
++	md.results.TransientSolution[2].Vx,\
++	md.results.TransientSolution[2].Vy,\
++	md.results.TransientSolution[2].Vel,\
++	md.results.TransientSolution[2].Pressure,\
++	md.results.TransientSolution[2].Thickness,\
++	md.results.TransientSolution[2].Surface,\
++	md.results.TransientSolution[2].MaskIceLevelset,\
++	md.results.TransientSolution[2].Enthalpy,\
++	md.results.TransientSolution[2].Watercolumn,\
++	]
+Index: ../trunk-jpl/test/NightlyRun/IdToName.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/IdToName.py	(revision 17453)
++++ ../trunk-jpl/test/NightlyRun/IdToName.py	(revision 17454)
+@@ -174,6 +174,8 @@
+ 	801  : 'ValleyGlacierLevelsetSSA2d',	
+ 	802  : 'ValleyGlacierLevelsetThermalSSA3d',	
+ 	803  : 'ValleyGlacierLevelsetEnthalpyHO3d',	
++	804  : 'ValleyGlacierLevelsetCalvingSIA2d',	
++	805  : 'ValleyGlacierLevelsetEnthCalvingHO3d',	
+ 	1101 : 'ISMIPAHO',
+ 	1102 : 'ISMIPAFS',
+ 	1103 : 'ISMIPBHO',
+Index: ../trunk-jpl/test/Archives/Archive804.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/test/Archives/Archive804.nc
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+
+Index: ../trunk-jpl/test/Archives/Archive805.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/test/Archives/Archive805.nc
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+
Index: issm/oecreview/Archive/16554-17801/ISSM-17454-17455.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17454-17455.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17454-17455.diff	(revision 17802)
@@ -0,0 +1,113 @@
+Index: ../trunk-jpl/src/m/materials/paterson.m
+===================================================================
+--- ../trunk-jpl/src/m/materials/paterson.m	(revision 17454)
++++ ../trunk-jpl/src/m/materials/paterson.m	(revision 17455)
+@@ -7,7 +7,7 @@
+ %   Usage:
+ %      rigidity=paterson(temperature)
+ 
+-if(temperature<0)
++if any(temperature<0)
+ 	error('input temperature should be in Kelvin (positive)');
+ end
+ T=temperature-273.15;
+Index: ../trunk-jpl/src/m/materials/cuffey.py
+===================================================================
+--- ../trunk-jpl/src/m/materials/cuffey.py	(revision 0)
++++ ../trunk-jpl/src/m/materials/cuffey.py	(revision 17455)
+@@ -0,0 +1,49 @@
++import numpy
++
++def cuffey(temperature):
++	"""
++	CUFFEY - calculates ice rigidity as a function of temperature
++
++	   rigidity (in s^(1/3)Pa) is the flow law parameter in the flow law sigma=B*e(1/3)
++		(Cuffey and Paterson, p75). 
++	   temperature is in Kelvin degrees
++
++	   Usage:
++	      rigidity=cuffey(temperature)
++	"""
++	
++	if numpy.any(temperature<0.):
++		raise RuntimeError("input temperature should be in Kelvin (positive)")
++	
++	T = temperature.reshape(-1,)-273.15
++
++	rigidity=numpy.zeros_like(T)
++	pos=numpy.nonzero(T<=-45)
++	rigidity[pos]=10**8*(-0.000396645116301*(T[pos]+50)**3+ 0.013345579471334*(T[pos]+50)**2  -0.356868703259105*(T[pos]+50)+7.272363035371383)
++	pos=numpy.nonzero(numpy.logical_and(-45<=T,T<-40))
++	rigidity[pos]=10**8*(-0.000396645116301*(T[pos]+45)**3+ 0.007395902726819*(T[pos]+45)**2  -0.253161292268336*(T[pos]+45)+5.772078366321591)
++	pos=numpy.nonzero(numpy.logical_and(-40<=T,T<-35))
++	rigidity[pos]=10**8*(0.000408322072669*(T[pos]+40)**3+  0.001446225982305*(T[pos]+40)**2  -0.208950648722716*(T[pos]+40)+4.641588833612773)
++	pos=numpy.nonzero(numpy.logical_and(-35<=T,T<-30))
++	rigidity[pos]=10**8*(-0.000423888728124*(T[pos]+35)**3+ 0.007571057072334*(T[pos]+35)**2  -0.163864233449525*(T[pos]+35)+3.684031498640382)
++	pos=numpy.nonzero(numpy.logical_and(-30<=T,T<-25))
++	rigidity[pos]=10**8*(0.000147154327025*(T[pos]+30)**3+ 0.001212726150476*(T[pos]+30)**2  -0.119945317335478*(T[pos]+30)+3.001000667185614)
++	pos=numpy.nonzero(numpy.logical_and(-25<=T,T<-20))
++	rigidity[pos]=10**8*(-0.000193435838672*(T[pos]+25)**3+ 0.003420041055847*(T[pos]+25)**2  -0.096781481303861*(T[pos]+25)+2.449986525148220)
++	pos=numpy.nonzero(numpy.logical_and(-20<=T,T<-15))
++	rigidity[pos]=10**8*(0.000219771255067*(T[pos]+20)**3+  0.000518503475772*(T[pos]+20)**2  -0.077088758645767*(T[pos]+20)+2.027400665191131)
++	pos=numpy.nonzero(numpy.logical_and(-15<=T,T<-10))
++	rigidity[pos]=10**8*(-0.000653438900191*(T[pos]+15)**3+ 0.003815072301777*(T[pos]+15)**2  -0.055420879758021*(T[pos]+15)+1.682390865739973)
++	pos=numpy.nonzero(numpy.logical_and(-10<=T,T<-5))
++	rigidity[pos]=10**8*(0.000692439419762*(T[pos]+10)**3 -0.005986511201093 *(T[pos]+10)**2 -0.066278074254598*(T[pos]+10)+1.418983411970382)
++	pos=numpy.nonzero(numpy.logical_and(-5<=T,T<-2))
++	rigidity[pos]=10**8*(-0.000132282004110*(T[pos]+5)**3 +0.004400080095332*(T[pos]+5)**2    -0.074210229783403*(T[pos]+5)+ 1.024485188140279)
++	pos=numpy.nonzero(-2<=T)
++	rigidity[pos]=10**8*(-0.000132282004110*(T[pos]+2)**3 +0.003209542058346*(T[pos]+2)**2    -0.051381363322371*(T[pos]+2)+ 0.837883605537096)
++
++	#Now make sure that rigidity is positive
++	pos=numpy.nonzero(rigidity<0)
++	rigidity[pos]=1**6 
++
++	return rigidity
++
+Index: ../trunk-jpl/src/m/materials/cuffey.m
+===================================================================
+--- ../trunk-jpl/src/m/materials/cuffey.m	(revision 0)
++++ ../trunk-jpl/src/m/materials/cuffey.m	(revision 17455)
+@@ -0,0 +1,41 @@
++function rigidity=cuffey(temperature)
++%CUFFEY - calculates ice rigidity as a function of temperature
++%
++%   rigidity (in s^(1/3)Pa) is the flow law parameter in the flow law sigma=B*e(1/3)
++%   (Cuffey and Paterson, p75). 
++%   temperature is in Kelvin degrees
++%
++%   Usage:
++%      rigidity=cuffey(temperature)
++
++if any(temperature<0)
++	error('input temperature should be in Kelvin (positive)');
++end
++T=temperature-273.15;
++
++%The routine below is equivalent to:
++% n=3; T=temperature-273;
++% %From cuffey
++% Temp=[0;-2;-5;-10;-15;-20;-25;-30;-35;-40;-45;-50];
++% A=[2.4*10^-24;1.7*10^-24;9.3*10^-25;3.5*10^-25;2.1*10^-25;1.2*10^-25;6.8*10^-26;3.7*10^-26;2.0*10^-26;1.0*10^-26;5.2*10^-27;2.6*10^-27];%s-1(Pa-3)
++% %Convert into rigidity B
++% B=A.^(-1/n); %s^(1/3)Pa
++% %Now, do a cubic fit between Temp and B: 
++% fittedmodel=fit(Temp,B,'cubicspline');
++% rigidity=fittedmodel(temperature);
++
++rigidity=zeros(length(T),1);
++pos=find(T<=-45);         rigidity(pos)=10^8*(-0.000396645116301*(T(pos)+50).^3+ 0.013345579471334*(T(pos)+50).^2  -0.356868703259105*(T(pos)+50)+7.272363035371383);
++pos=find(-45<=T & T<-40); rigidity(pos)=10^8*(-0.000396645116301*(T(pos)+45).^3+ 0.007395902726819*(T(pos)+45).^2  -0.253161292268336*(T(pos)+45)+5.772078366321591);
++pos=find(-40<=T & T<-35); rigidity(pos)=10^8*(0.000408322072669*(T(pos)+40).^3+  0.001446225982305*(T(pos)+40).^2  -0.208950648722716*(T(pos)+40)+4.641588833612773);
++pos=find(-35<=T & T<-30); rigidity(pos)=10^8*(-0.000423888728124*(T(pos)+35).^3+ 0.007571057072334*(T(pos)+35).^2  -0.163864233449525*(T(pos)+35)+3.684031498640382);
++pos=find(-30<=T & T<-25); rigidity(pos)=10^8*(0.000147154327025*(T(pos)+30).^3+ 0.001212726150476*(T(pos)+30).^2  -0.119945317335478*(T(pos)+30)+3.001000667185614);
++pos=find(-25<=T & T<-20); rigidity(pos)=10^8*(-0.000193435838672*(T(pos)+25).^3+ 0.003420041055847*(T(pos)+25).^2  -0.096781481303861*(T(pos)+25)+2.449986525148220);
++pos=find(-20<=T & T<-15); rigidity(pos)=10^8*(0.000219771255067*(T(pos)+20).^3+  0.000518503475772*(T(pos)+20).^2  -0.077088758645767*(T(pos)+20)+2.027400665191131);
++pos=find(-15<=T & T<-10); rigidity(pos)=10^8*(-0.000653438900191*(T(pos)+15).^3+ 0.003815072301777*(T(pos)+15).^2  -0.055420879758021*(T(pos)+15)+1.682390865739973);
++pos=find(-10<=T & T<-5);  rigidity(pos)=10^8*(0.000692439419762*(T(pos)+10).^3 -0.005986511201093 *(T(pos)+10).^2 -0.066278074254598*(T(pos)+10)+1.418983411970382);
++pos=find(-5<=T & T<-2);   rigidity(pos)=10^8*(-0.000132282004110*(T(pos)+5).^3 +0.004400080095332*(T(pos)+5).^2    -0.074210229783403*(T(pos)+5)+ 1.024485188140279);
++pos=find(-2<=T);          rigidity(pos)=10^8*(-0.000132282004110*(T(pos)+2).^3 +0.003209542058346*(T(pos)+2).^2    -0.051381363322371*(T(pos)+2)+ 0.837883605537096);
++
++%Now make sure that rigidity is positive
++pos=find(rigidity<0);        rigidity(pos)=10^6;
Index: issm/oecreview/Archive/16554-17801/ISSM-17455-17456.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17455-17456.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17455-17456.diff	(revision 17802)
@@ -0,0 +1,44 @@
+Index: ../trunk-jpl/src/m/classes/matice.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/matice.m	(revision 17455)
++++ ../trunk-jpl/src/m/classes/matice.m	(revision 17456)
+@@ -103,7 +103,7 @@
+ 			md = checkfield(md,'fieldname','materials.mu_water','>',0);
+ 			md = checkfield(md,'fieldname','materials.rheology_B','>',0,'size',[md.mesh.numberofvertices 1]);
+ 			md = checkfield(md,'fieldname','materials.rheology_n','>',0,'size',[md.mesh.numberofelements 1]);
+-			md = checkfield(md,'fieldname','materials.rheology_law','values',{'None' 'Paterson' 'Arrhenius' 'LliboutryDuval'});
++			md = checkfield(md,'fieldname','materials.rheology_law','values',{'None' 'Cuffey' 'Paterson' 'Arrhenius' 'LliboutryDuval'});
+ 
+ 			if ismember(GiaAnalysisEnum(),analyses),
+ 				md = checkfield(md,'fieldname','materials.lithosphere_shear_modulus','>',0,'numel',1);
+@@ -130,7 +130,7 @@
+ 			fielddisplay(obj,'thermal_exchange_velocity','thermal exchange velocity [m/s]');
+ 			fielddisplay(obj,'rheology_B','flow law parameter [Pa/s^(1/n)]');
+ 			fielddisplay(obj,'rheology_n','Glen''s flow law exponent');
+-			fielddisplay(obj,'rheology_law',['law for the temperature dependance of the rheology: ''None'', ''Paterson'',  ''Arrhenius'' or ''LliboutryDuval''']);
++			fielddisplay(obj,'rheology_law',['law for the temperature dependance of the rheology: ''None'', ''Cuffey'', ''Paterson'', ''Arrhenius'' or ''LliboutryDuval''']);
+ 			fielddisplay(obj,'lithosphere_shear_modulus','Lithosphere shear modulus [Pa]');
+ 			fielddisplay(obj,'lithosphere_density','Lithosphere density [g/cm^-3]');
+ 			fielddisplay(obj,'mantle_shear_modulus','Mantle shear modulus [Pa]');
+Index: ../trunk-jpl/src/m/classes/matice.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/matice.py	(revision 17455)
++++ ../trunk-jpl/src/m/classes/matice.py	(revision 17456)
+@@ -54,7 +54,7 @@
+ 		string="%s\n%s"%(string,fielddisplay(self,"thermal_exchange_velocity","thermal exchange velocity [m/s]"))
+ 		string="%s\n%s"%(string,fielddisplay(self,"rheology_B","flow law parameter [Pa/s^(1/n)]"))
+ 		string="%s\n%s"%(string,fielddisplay(self,"rheology_n","Glen's flow law exponent"))
+-		string="%s\n%s"%(string,fielddisplay(self,"rheology_law","law for the temperature dependance of the rheology: 'None', 'Paterson', 'Arrhenius' or 'LliboutryDuval'"))
++		string="%s\n%s"%(string,fielddisplay(self,"rheology_law","law for the temperature dependance of the rheology: 'None', 'Cuffey', 'Paterson', 'Arrhenius' or 'LliboutryDuval'"))
+ 		string="%s\n%s"%(string,fielddisplay(self,"lithosphere_shear_modulus","Lithosphere shear modulus [Pa]"))
+ 		string="%s\n%s"%(string,fielddisplay(self,"lithosphere_density","Lithosphere density [g/cm^-3]"))
+ 		string="%s\n%s"%(string,fielddisplay(self,"mantle_shear_modulus","Mantle shear modulus [Pa]"))
+@@ -118,7 +118,7 @@
+ 		md = checkfield(md,'fieldname','materials.mu_water','>',0)
+ 		md = checkfield(md,'fieldname','materials.rheology_B','>',0,'size',[md.mesh.numberofvertices])
+ 		md = checkfield(md,'fieldname','materials.rheology_n','>',0,'size',[md.mesh.numberofelements])
+-		md = checkfield(md,'fieldname','materials.rheology_law','values',['None','Paterson','Arrhenius','LliboutryDuval'])
++		md = checkfield(md,'fieldname','materials.rheology_law','values',['None','Cuffey','Paterson','Arrhenius','LliboutryDuval'])
+ 		md = checkfield(md,'fieldname','materials.lithosphere_shear_modulus','>',0,'numel',[1]);
+ 		md = checkfield(md,'fieldname','materials.lithosphere_density','>',0,'numel',[1]);
+ 		md = checkfield(md,'fieldname','materials.mantle_shear_modulus','>',0,'numel',[1]);
Index: issm/oecreview/Archive/16554-17801/ISSM-17456-17457.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17456-17457.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17456-17457.diff	(revision 17802)
@@ -0,0 +1,178 @@
+Index: ../trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp	(revision 17456)
++++ ../trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp	(revision 17457)
+@@ -45,7 +45,7 @@
+ 
+ 	file_line= what_line;
+ 	/*When error messages are not shown properly, uncomment the following line*/
+-	this->Report();
++	//this->Report();
+ 
+ }/*}}}*/
+ ErrorException::~ErrorException() throw(){/*{{{*/
+Index: ../trunk-jpl/src/c/shared/Elements/Cuffey.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Elements/Cuffey.cpp	(revision 0)
++++ ../trunk-jpl/src/c/shared/Elements/Cuffey.cpp	(revision 17457)
+@@ -0,0 +1,57 @@
++/* \file Cuffey.cpp
++ * \brief figure out B of ice for a certain temperature
++ *	  INPUT function B=Cuffey(temperature)
++ *    where rigidigty (in s^(1/3)Pa) is the flow law paramter in the flow law sigma=B*e(1/3) (Cuffey, p75). 
++ */
++
++#include <math.h>
++
++#include "../Numerics/types.h"
++
++IssmDouble Cuffey(IssmDouble temperature){
++
++	/*output: */
++	IssmDouble B,T;
++
++	/*Switch to celsius from Kelvin: */
++	T=temperature-273.15;
++
++	if(T<=-45.0){
++		B=1.e+8*(-0.000396645116301*pow(T+50.,3)+ 0.013345579471334*pow(T+50.,2) -0.356868703259105*(T+50.)+7.272363035371383);
++	}
++	else if((T>=-45.0) && (T<=-40.0)){
++		B=1.e+8*(-0.000396645116301*pow(T+45.,3)+ 0.007395902726819*pow(T+45.,2) -0.253161292268336*(T+45.)+5.772078366321591);
++	}
++	else if((T>=-40.0) && (T<=-35.0)){
++		B=1.e+8*(0.000408322072669*pow(T+40.,3)+  0.001446225982305*pow(T+40.,2)  -0.208950648722716*(T+40.)+4.641588833612773);
++	}
++	else if((T>=-35.0) && (T<=-30.0)){
++		B=1.e+8*(-0.000423888728124*pow(T+35.,3)+ 0.007571057072334*pow(T+35.,2)  -0.163864233449525*(T+35.)+3.684031498640382);
++	}
++	else if((T>=-30.0) && (T<=-25.0)){
++		B=1.e+8*(0.000147154327025*pow(T+30.,3)+ 0.001212726150476*pow(T+30.,2) -0.119945317335478*(T+30.)+3.001000667185614);
++	}
++	else if((T>=-25.0) && (T<=-20.0)){
++		B=1.e+8*(-0.000193435838672*pow(T+25.,3)+ 0.003420041055847*pow(T+25.,2)  -0.096781481303861*(T+25.)+2.449986525148220);
++	}
++	else if((T>=-20.0) && (T<=-15.0)){
++		B=1.e+8*(0.000219771255067*pow(T+20.,3)+  0.000518503475772*pow(T+20.,2)  -0.077088758645767*(T+20.)+2.027400665191131);
++	}
++	else if((T>=-15.0) && (T<=-10.0)){
++		B=1.e+8*(-0.000653438900191*pow(T+15.,3)+ 0.003815072301777*pow(T+15.,2)  -0.055420879758021*(T+15.)+1.682390865739973);
++	}
++	else if((T>=-10.0) && (T<=-5.0)){
++		B=1.e+8*(0.000692439419762*pow(T+10.,3) -0.005986511201093 *pow(T+10.,2) -0.066278074254598*(T+10.)+1.418983411970382);
++	}
++	else if((T>=-5.0) && (T<=-2.0)){
++		B=1.e+8*(-0.000132282004110*pow(T+5.,3) +0.004400080095332*pow(T+5.,2)    -0.074210229783403*(T+5.)+ 1.024485188140279);
++	}
++	else{
++		B=1.e+8*(-0.000132282004110*pow(T+2.,3) +0.003209542058346*pow(T+2.,2)    -0.051381363322371*(T+2.)+ 0.837883605537096);
++	}
++
++	/*B cannot be negative!*/
++	if(B<0) B=1.e+6;
++
++	return B;
++}
+Index: ../trunk-jpl/src/c/shared/Elements/elements.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Elements/elements.h	(revision 17456)
++++ ../trunk-jpl/src/c/shared/Elements/elements.h	(revision 17457)
+@@ -7,6 +7,7 @@
+ 
+ #include "../Numerics/types.h"
+ 
++IssmDouble Cuffey(IssmDouble temperature);
+ IssmDouble Paterson(IssmDouble temperature);
+ IssmDouble Arrhenius(IssmDouble temperature,IssmDouble depth,IssmDouble n);
+ IssmDouble LliboutryDuval(IssmDouble enthalpy, IssmDouble pressure, IssmDouble n, IssmDouble betaCC, IssmDouble referencetemperature, IssmDouble heatcapacity, IssmDouble latentheat);
+Index: ../trunk-jpl/src/c/shared/Elements/Paterson.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Elements/Paterson.cpp	(revision 17456)
++++ ../trunk-jpl/src/c/shared/Elements/Paterson.cpp	(revision 17457)
+@@ -10,61 +10,48 @@
+ 
+ IssmDouble Paterson(IssmDouble temperature){
+ 
+-	/*output: */
+-	IssmDouble B;
+-	IssmDouble T;
++	IssmDouble B,T;
+ 
+ 	/*Switch to celsius from Kelvin: */
+ 	T=temperature-273.15;
+ 
+-//	%The routine below is equivalent to:
+-//	% n=3; T=temperature-273;
+-//	% %From Paterson,
+-//	% Temp=[0;-2;-5;-10;-15;-20;-25;-30;-35;-40;-45;-50];
+-//	% A=[6.8*10^-15;2.4*10^-15;1.6*10^-15;4.9*10^-16;2.9*10^-16;1.7*10^-16;9.4*
+-//	% 10^-17;5.1*10^-17;2.7*10^-17;1.4*10^-17;7.3*10^-18;3.6*10^-18];;%s-1(kPa-3)
+-//	% %Convert into B B
+-//	% B=A.^(-1/n)*10^3; %s^(1/3)Pa
+-//	% %Now, do a cubic fit between Temp and B: 
+-//	% fittedmodel=fit(Temp,B,'cubicspline');
+-//	% B=fittedmodel(temperature);
+ 
+ 	if(T<=-45.0){
+-		B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.000292866376675*pow(T+50,3)+ 0.011672640664130*pow(T+50,2)  -0.325004442485481*(T+50)+  6.524779401948101);
++		B=1.e+8*(-0.000292866376675*pow(T+50.,3)+ 0.011672640664130*pow(T+50.,2)  -0.325004442485481*(T+50.)+  6.524779401948101);
+ 	}
+ 	else if((T>=-45.0) && (T<=-40.0)){
+-		B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.000292866376675*pow(T+45,3)+ 0.007279645014004*pow(T+45,2)  -0.230243014094813*(T+45)+  5.154964909039554);
++		B=1.e+8*(-0.000292866376675*pow(T+45.,3)+ 0.007279645014004*pow(T+45.,2)  -0.230243014094813*(T+45.)+  5.154964909039554);
+ 	}
+ 	else if((T>=-40.0) && (T<=-35.0)){
+-		B=pow((IssmPDouble)10,(IssmPDouble)8)*(0.000072737147457*pow(T+40,3)+  0.002886649363879*pow(T+40,2)  -0.179411542205399*(T+40)+  4.149132666831214);
++		B=1.e+8*(0.000072737147457*pow(T+40.,3)+  0.002886649363879*pow(T+40.,2)  -0.179411542205399*(T+40.)+  4.149132666831214);
+ 	}
+ 	else if((T>=-35.0) && (T<=-30.0)){
+-		B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.000086144770023*pow(T+35,3)+ 0.003977706575736*pow(T+35,2)  -0.145089762507325*(T+35)+  3.333333333333331);
++		B=1.e+8*(-0.000086144770023*pow(T+35.,3)+ 0.003977706575736*pow(T+35.,2)  -0.145089762507325*(T+35.)+  3.333333333333331);
+ 	}
+ 	else if((T>=-30.0) && (T<=-25.0)){
+-		B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.000043984685769*pow(T+30,3)+ 0.002685535025386*pow(T+30,2)  -0.111773554501713*(T+30)+  2.696559088937191);
++		B=1.e+8*(-0.000043984685769*pow(T+30.,3)+ 0.002685535025386*pow(T+30.,2)  -0.111773554501713*(T+30.)+  2.696559088937191);
+ 	}
+ 	else if((T>=-25.0) && (T<=-20.0)){
+-		B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.000029799523463*pow(T+25,3)+ 0.002025764738854*pow(T+25,2)  -0.088217055680511*(T+25)+  2.199331606342181);
++		B=1.e+8*(-0.000029799523463*pow(T+25.,3)+ 0.002025764738854*pow(T+25.,2)  -0.088217055680511*(T+25.)+  2.199331606342181);
+ 	}
+ 	else if((T>=-20.0) && (T<=-15.0)){
+-		B=pow((IssmPDouble)10,(IssmPDouble)8)*(0.000136920904777*pow(T+20,3)+  0.001578771886910*pow(T+20,2)  -0.070194372551690*(T+20)+  1.805165505978111);
++		B=1.e+8*(0.000136920904777*pow(T+20.,3)+  0.001578771886910*pow(T+20.,2)  -0.070194372551690*(T+20.)+  1.805165505978111);
+ 	}
+ 	else if((T>=-15.0) && (T<=-10.0)){
+-		B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.000899763781026*pow(T+15,3)+ 0.003632585458564*pow(T+15,2)  -0.044137585824322*(T+15)+  1.510778053489523);
++		B=1.e+8*(-0.000899763781026*pow(T+15.,3)+ 0.003632585458564*pow(T+15.,2)  -0.044137585824322*(T+15.)+  1.510778053489523);
+ 	}
+ 	else if((T>=-10.0) && (T<=-5.0)){
+-		B=pow((IssmPDouble)10,(IssmPDouble)8)*(0.001676964325070*pow(T+10,3)-  0.009863871256831*pow(T+10,2)  -0.075294014815659*(T+10)+  1.268434288203714);
++		B=1.e+8*(0.001676964325070*pow(T+10.,3)-  0.009863871256831*pow(T+10.,2)  -0.075294014815659*(T+10.)+  1.268434288203714);
+ 	}
+ 	else if((T>=-5.0) && (T<=-2.0)){
+-		B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.003748937622487*pow(T+5,3)+0.015290593619213*pow(T+5,2)  -0.048160403003748*(T+5)+  0.854987973338348);
++		B=1.e+8*(-0.003748937622487*pow(T+5.,3)+0.015290593619213*pow(T+5.,2)  -0.048160403003748*(T+5.)+  0.854987973338348);
+ 	}
+ 	else{
+-		B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.003748937622488*pow(T+2,3)-0.018449844983174*pow(T+2,2)  -0.057638157095631*(T+2)+  0.746900791092860);
++		B=1.e+8*(-0.003748937622488*pow(T+2.,3)-0.018449844983174*pow(T+2.,2)  -0.057638157095631*(T+2.)+  0.746900791092860);
+ 	}
+ 
+ 	/*B cannot be negative!*/
+-	if(B<0) B=pow((IssmPDouble)10,(IssmPDouble)6);
++	if(B<0) B=1.e+6;
+ 
+ 	return B;
+ }
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17456)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17457)
+@@ -214,6 +214,7 @@
+ 					./shared/Sorting/binary_search.cpp\
+ 					./shared/Sorting/sorting.h\
+ 					./shared/Elements/elements.h\
++					./shared/Elements/Cuffey.cpp\
+ 					./shared/Elements/Paterson.cpp\
+ 					./shared/Elements/Arrhenius.cpp\
+ 					./shared/Elements/LliboutryDuval.cpp \
Index: issm/oecreview/Archive/16554-17801/ISSM-17457-17458.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17457-17458.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17457-17458.diff	(revision 17802)
@@ -0,0 +1,213 @@
+Index: ../trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim
+===================================================================
+--- ../trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim	(revision 17457)
++++ ../trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim	(revision 17458)
+@@ -440,6 +440,7 @@
+ syn keyword cType Gauss
+ syn keyword cType GaussPenta
+ syn keyword cType GaussSeg
++syn keyword cType GaussTetra
+ syn keyword cType GaussTria
+ syn keyword cType GaussianVariogram
+ syn keyword cType GenericExternalResult
+@@ -495,6 +496,8 @@
+ syn keyword cType SphericalVariogram
+ syn keyword cType StringArrayParam
+ syn keyword cType StringParam
++syn keyword cType Tetra
++syn keyword cType TetraRef
+ syn keyword cType TransientInput
+ syn keyword cType TransientParam
+ syn keyword cType Tria
+@@ -518,6 +521,7 @@
+ syn keyword cType DamageEvolutionAnalysis
+ syn keyword cType EnthalpyAnalysis
+ syn keyword cType EnumToAnalysis
++syn keyword cType ExtrapolationAnalysis
+ syn keyword cType ExtrudeFromBaseAnalysis
+ syn keyword cType ExtrudeFromTopAnalysis
+ syn keyword cType FreeSurfaceBaseAnalysis
+@@ -528,6 +532,8 @@
+ syn keyword cType HydrologyShreveAnalysis
+ syn keyword cType L2ProjectionBaseAnalysis
+ syn keyword cType L2ProjectionEPLAnalysis
++syn keyword cType LevelsetAnalysis
++syn keyword cType LsfReinitializationAnalysis
+ syn keyword cType MasstransportAnalysis
+ syn keyword cType MeltingAnalysis
+ syn keyword cType MeshdeformationAnalysis
+@@ -632,6 +638,7 @@
+ syn keyword cConstant EplHeadOldEnum
+ syn keyword cConstant EplHeadSlopeXEnum
+ syn keyword cConstant EplHeadSlopeYEnum
++syn keyword cConstant HydrologydcMaxIterEnum
+ syn keyword cConstant HydrologydcRelTolEnum
+ syn keyword cConstant HydrologydcSpcsedimentHeadEnum
+ syn keyword cConstant HydrologydcSedimentCompressibilityEnum
+@@ -655,11 +662,11 @@
+ syn keyword cConstant HydrologydcLeakageFactorEnum
+ syn keyword cConstant HydrologydcPenaltyFactorEnum
+ syn keyword cConstant HydrologydcPenaltyLockEnum
++syn keyword cConstant HydrologydcBasalMoulinInputEnum
+ syn keyword cConstant HydrologyLayerEnum
+ syn keyword cConstant HydrologySedimentEnum
+ syn keyword cConstant HydrologyEfficientEnum
+ syn keyword cConstant HydrologySedimentKmaxEnum
+-syn keyword cConstant WaterTransferEnum
+ syn keyword cConstant IndependentObjectEnum
+ syn keyword cConstant InversionControlParametersEnum
+ syn keyword cConstant InversionCostFunctionThresholdEnum
+@@ -709,6 +716,9 @@
+ syn keyword cConstant DamageMaxiterEnum
+ syn keyword cConstant DamageSpcdamageEnum
+ syn keyword cConstant DamageMaxDamageEnum
++syn keyword cConstant DamageEquivStressEnum
++syn keyword cConstant DamageEvolutionNumRequestedOutputsEnum
++syn keyword cConstant DamageEvolutionRequestedOutputsEnum
+ syn keyword cConstant MaterialsRhoIceEnum
+ syn keyword cConstant MaterialsRhoWaterEnum
+ syn keyword cConstant MaterialsRhoFreshwaterEnum
+@@ -747,6 +757,7 @@
+ syn keyword cConstant MasstransportMinThicknessEnum
+ syn keyword cConstant MasstransportPenaltyFactorEnum
+ syn keyword cConstant MasstransportSpcthicknessEnum
++syn keyword cConstant MasstransportCalvingrateEnum
+ syn keyword cConstant MasstransportStabilizationEnum
+ syn keyword cConstant MasstransportVertexPairingEnum
+ syn keyword cConstant MasstransportNumRequestedOutputsEnum
+@@ -763,16 +774,11 @@
+ syn keyword cConstant QmuMaterialsRheologyBEnum
+ syn keyword cConstant RiftsNumriftsEnum
+ syn keyword cConstant RiftsRiftstructEnum
++syn keyword cConstant SettingsResultsOnNodesEnum
+ syn keyword cConstant SettingsIoGatherEnum
+ syn keyword cConstant SettingsLowmemEnum
+ syn keyword cConstant SettingsOutputFrequencyEnum
+ syn keyword cConstant SettingsWaitonlockEnum
+-syn keyword cConstant SurfaceforcingsDelta18oEnum
+-syn keyword cConstant SurfaceforcingsDelta18oSurfaceEnum
+-syn keyword cConstant SurfaceforcingsIsdelta18oEnum
+-syn keyword cConstant SurfaceforcingsPrecipitationsPresentdayEnum
+-syn keyword cConstant SurfaceforcingsTemperaturesPresentdayEnum
+-syn keyword cConstant SurfaceforcingsTemperaturesLgmEnum
+ syn keyword cConstant DebugProfilingEnum
+ syn keyword cConstant ProfilingCurrentMemEnum
+ syn keyword cConstant ProfilingCurrentFlopsEnum
+@@ -783,17 +789,6 @@
+ syn keyword cConstant SteadystateReltolEnum
+ syn keyword cConstant SteadystateRequestedOutputsEnum
+ syn keyword cConstant SurfaceEnum
+-syn keyword cConstant SurfaceforcingsPrecipitationEnum
+-syn keyword cConstant SurfaceforcingsMassBalanceEnum
+-syn keyword cConstant SurfaceforcingsIspddEnum
+-syn keyword cConstant SurfaceforcingsDesfacEnum
+-syn keyword cConstant SurfaceforcingsS0pEnum
+-syn keyword cConstant SurfaceforcingsIssmbgradientsEnum
+-syn keyword cConstant SurfaceforcingsMonthlytemperaturesEnum
+-syn keyword cConstant SurfaceforcingsHrefEnum
+-syn keyword cConstant SurfaceforcingsSmbrefEnum
+-syn keyword cConstant SurfaceforcingsBPosEnum
+-syn keyword cConstant SurfaceforcingsBNegEnum
+ syn keyword cConstant ThermalIsenthalpyEnum
+ syn keyword cConstant ThermalIsdynamicbasalspcEnum
+ syn keyword cConstant ThermalMaxiterEnum
+@@ -820,6 +815,28 @@
+ syn keyword cConstant TransientIsdamageEnum
+ syn keyword cConstant TransientNumRequestedOutputsEnum
+ syn keyword cConstant TransientRequestedOutputsEnum
++syn keyword cConstant SurfaceforcingsEnum
++syn keyword cConstant SMBEnum
++syn keyword cConstant SurfaceforcingsMassBalanceEnum
++syn keyword cConstant SMBpddEnum
++syn keyword cConstant SurfaceforcingsDelta18oEnum
++syn keyword cConstant SurfaceforcingsDelta18oSurfaceEnum
++syn keyword cConstant SurfaceforcingsIsdelta18oEnum
++syn keyword cConstant SurfaceforcingsPrecipitationsPresentdayEnum
++syn keyword cConstant SurfaceforcingsTemperaturesPresentdayEnum
++syn keyword cConstant SurfaceforcingsTemperaturesLgmEnum
++syn keyword cConstant SurfaceforcingsPrecipitationEnum
++syn keyword cConstant SurfaceforcingsDesfacEnum
++syn keyword cConstant SurfaceforcingsS0pEnum
++syn keyword cConstant SMBgradientsEnum
++syn keyword cConstant SurfaceforcingsMonthlytemperaturesEnum
++syn keyword cConstant SurfaceforcingsHrefEnum
++syn keyword cConstant SurfaceforcingsSmbrefEnum
++syn keyword cConstant SurfaceforcingsBPosEnum
++syn keyword cConstant SurfaceforcingsBNegEnum
++syn keyword cConstant SMBhenningEnum
++syn keyword cConstant SurfaceforcingsIspddEnum
++syn keyword cConstant SurfaceforcingsIssmbgradientsEnum
+ syn keyword cConstant SolutionTypeEnum
+ syn keyword cConstant AnalysisTypeEnum
+ syn keyword cConstant ConfigurationTypeEnum
+@@ -858,7 +875,6 @@
+ syn keyword cConstant ExtrudeFromBaseAnalysisEnum
+ syn keyword cConstant ExtrudeFromTopAnalysisEnum
+ syn keyword cConstant SteadystateSolutionEnum
+-syn keyword cConstant L2ProjectionTopAnalysisEnum
+ syn keyword cConstant SurfaceSlopeSolutionEnum
+ syn keyword cConstant SmoothedSurfaceSlopeXAnalysisEnum
+ syn keyword cConstant SmoothedSurfaceSlopeYAnalysisEnum
+@@ -869,6 +885,9 @@
+ syn keyword cConstant GiaAnalysisEnum
+ syn keyword cConstant MeshdeformationSolutionEnum
+ syn keyword cConstant MeshdeformationAnalysisEnum
++syn keyword cConstant LevelsetAnalysisEnum
++syn keyword cConstant ExtrapolationAnalysisEnum
++syn keyword cConstant LsfReinitializationAnalysisEnum
+ syn keyword cConstant ApproximationEnum
+ syn keyword cConstant NoneApproximationEnum
+ syn keyword cConstant SIAApproximationEnum
+@@ -920,8 +939,6 @@
+ syn keyword cConstant ParamEnum
+ syn keyword cConstant PengridEnum
+ syn keyword cConstant PenpairEnum
+-syn keyword cConstant PentaEnum
+-syn keyword cConstant PentaInputEnum
+ syn keyword cConstant ProfilerEnum
+ syn keyword cConstant MatrixParamEnum
+ syn keyword cConstant NodeSIdEnum
+@@ -939,6 +956,10 @@
+ syn keyword cConstant SegInputEnum
+ syn keyword cConstant TriaEnum
+ syn keyword cConstant TriaInputEnum
++syn keyword cConstant TetraEnum
++syn keyword cConstant TetraInputEnum
++syn keyword cConstant PentaEnum
++syn keyword cConstant PentaInputEnum
+ syn keyword cConstant VertexEnum
+ syn keyword cConstant VertexPIdEnum
+ syn keyword cConstant VertexSIdEnum
+@@ -1032,6 +1053,7 @@
+ syn keyword cConstant StressTensoryyEnum
+ syn keyword cConstant StressTensoryzEnum
+ syn keyword cConstant StressTensorzzEnum
++syn keyword cConstant DivergenceEnum
+ syn keyword cConstant GiaCrossSectionShapeEnum
+ syn keyword cConstant GiadWdtEnum
+ syn keyword cConstant GiaWEnum
+@@ -1100,6 +1122,7 @@
+ syn keyword cConstant QmuMaskGroundediceLevelsetEnum
+ syn keyword cConstant GaussSegEnum
+ syn keyword cConstant GaussTriaEnum
++syn keyword cConstant GaussTetraEnum
+ syn keyword cConstant GaussPentaEnum
+ syn keyword cConstant FSSolverEnum
+ syn keyword cConstant AdjointEnum
+@@ -1146,9 +1169,16 @@
+ syn keyword cConstant GenericOptionEnum
+ syn keyword cConstant OptionCellEnum
+ syn keyword cConstant OptionStructEnum
++syn keyword cConstant CuffeyEnum
+ syn keyword cConstant PatersonEnum
+ syn keyword cConstant ArrheniusEnum
+ syn keyword cConstant LliboutryDuvalEnum
++syn keyword cConstant TransientIslevelsetEnum
++syn keyword cConstant ExtrapolationVariableEnum
++syn keyword cConstant IceMaskNodeActivationEnum
++syn keyword cConstant LevelsetfunctionSlopeXEnum
++syn keyword cConstant LevelsetfunctionSlopeYEnum
++syn keyword cConstant LevelsetfunctionPicardEnum
+ "ISSM's Enums end
+ """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17458-17459.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17458-17459.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17458-17459.diff	(revision 17802)
@@ -0,0 +1,66 @@
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17458)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17459)
+@@ -682,6 +682,10 @@
+ 			case NoneEnum:
+ 				/*Do nothing: B is not temperature dependent*/
+ 				break;
++			case CuffeyEnum:
++				for(i=0;i<numnodes;i++) B[i]=Cuffey(values[i]);
++				element->AddInput(MaterialsRheologyBEnum,&B[0],P1Enum);
++				break;
+ 			case PatersonEnum:
+ 				for(i=0;i<numnodes;i++) B[i]=Paterson(values[i]);
+ 				element->AddInput(MaterialsRheologyBEnum,&B[0],P1Enum);
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17458)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17459)
+@@ -813,6 +813,10 @@
+ 			case NoneEnum:
+ 				/*Do nothing: B is not temperature dependent*/
+ 				break;
++			case CuffeyEnum:
++				for(i=0;i<numnodes;i++) B[i]=Cuffey(temperature[i]);
++				element->AddInput(MaterialsRheologyBEnum,&B[0],P1Enum);
++				break;
+ 			case PatersonEnum:
+ 				for(i=0;i<numnodes;i++) B[i]=Paterson(temperature[i]);
+ 				element->AddInput(MaterialsRheologyBEnum,&B[0],P1Enum);
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17458)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17459)
+@@ -679,6 +679,7 @@
+ 	OptionStructEnum,
+ 	/*}}}*/
+ 	/*Rheology law (move to Material) {{{*/
++	CuffeyEnum,
+ 	PatersonEnum,
+ 	ArrheniusEnum,
+ 	LliboutryDuvalEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17458)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17459)
+@@ -640,6 +640,7 @@
+ 		case GenericOptionEnum : return "GenericOption";
+ 		case OptionCellEnum : return "OptionCell";
+ 		case OptionStructEnum : return "OptionStruct";
++		case CuffeyEnum : return "Cuffey";
+ 		case PatersonEnum : return "Paterson";
+ 		case ArrheniusEnum : return "Arrhenius";
+ 		case LliboutryDuvalEnum : return "LliboutryDuval";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17458)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17459)
+@@ -655,6 +655,7 @@
+ 	      else if (strcmp(name,"GenericOption")==0) return GenericOptionEnum;
+ 	      else if (strcmp(name,"OptionCell")==0) return OptionCellEnum;
+ 	      else if (strcmp(name,"OptionStruct")==0) return OptionStructEnum;
++	      else if (strcmp(name,"Cuffey")==0) return CuffeyEnum;
+ 	      else if (strcmp(name,"Paterson")==0) return PatersonEnum;
+ 	      else if (strcmp(name,"Arrhenius")==0) return ArrheniusEnum;
+ 	      else if (strcmp(name,"LliboutryDuval")==0) return LliboutryDuvalEnum;
Index: issm/oecreview/Archive/16554-17801/ISSM-17459-17460.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17459-17460.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17459-17460.diff	(revision 17802)
@@ -0,0 +1,28 @@
+Index: ../trunk-jpl/src/m/enum/CuffeyEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/CuffeyEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/CuffeyEnum.m	(revision 17460)
+@@ -0,0 +1,11 @@
++function macro=CuffeyEnum()
++%CUFFEYENUM - Enum of Cuffey
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=CuffeyEnum()
++
++macro=StringToEnum('Cuffey');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17459)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17460)
+@@ -632,6 +632,7 @@
+ def GenericOptionEnum(): return StringToEnum("GenericOption")[0]
+ def OptionCellEnum(): return StringToEnum("OptionCell")[0]
+ def OptionStructEnum(): return StringToEnum("OptionStruct")[0]
++def CuffeyEnum(): return StringToEnum("Cuffey")[0]
+ def PatersonEnum(): return StringToEnum("Paterson")[0]
+ def ArrheniusEnum(): return StringToEnum("Arrhenius")[0]
+ def LliboutryDuvalEnum(): return StringToEnum("LliboutryDuval")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17460-17461.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17460-17461.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17460-17461.diff	(revision 17802)
@@ -0,0 +1,42 @@
+Index: ../trunk-jpl/src/m/classes/clusters/greenplanet.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/clusters/greenplanet.m	(revision 17460)
++++ ../trunk-jpl/src/m/classes/clusters/greenplanet.m	(revision 17461)
+@@ -18,6 +18,7 @@
+ 		 executionpath='';
+ 		 interactive=0;
+ 		 time=24*60;
++		 memory=2;
+ 	 end
+ 	 properties (SetAccess=private) 
+ 		 np=20*8;
+@@ -46,6 +47,8 @@
+ 			 disp(sprintf('    codepath: %s',cluster.codepath));
+ 			 disp(sprintf('    executionpath: %s',cluster.executionpath));
+ 			 disp(sprintf('    interactive: %i',cluster.interactive));
++			 disp(sprintf('    time: %i',cluster.time));
++			 disp(sprintf('    memory: %i',cluster.memory));
+ 		 end
+ 		 %}}}
+ 		 function md = checkconsistency(cluster,md,solution,analyses) % {{{
+@@ -77,6 +80,8 @@
+ 			 fprintf(fid,'#PBS -N %s\n',modelname);
+ 			 fprintf(fid,'#PBS -q %s \n',cluster.queue);
+ 			 fprintf(fid,'#PBS -l nodes=%i:ppn=%i\n',cluster.numnodes,cluster.cpuspernode);
++			 fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60);%walltime is in seconds.
++			 fprintf(fid,'#PBS -l mem=%igb\n',cluster.memory);
+ 			 fprintf(fid,'#PBS -m bea\n');
+ 			 fprintf(fid,'#PBS -M mmorligh@uci.edu\n');
+ 			 fprintf(fid,'#PBS -o %s.outlog \n',modelname);
+@@ -102,7 +107,10 @@
+ 			 fprintf(fid,'#PBS -S /bin/bash\n');
+ 			 fprintf(fid,'#PBS -N %s\n',modelname);
+ 			 fprintf(fid,'#PBS -q %s \n',cluster.queue);
+-			 fprintf(fid,'#PBS -l nodes=%i:ppn=%i\n',cluster.numnodes,cluster.cpuspernode);
++			 fprintf(fid,'#PBS -l nodes=%i:ppn=%i\n',cluster.numnodes, ...
++							 cluster.cpuspernode);
++			 fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds.
++			 fprintf(fid,'#PBS -l mem=%igb\n',cluster.memory);
+ 			 fprintf(fid,'#PBS -m bea\n');
+ 			 fprintf(fid,'#PBS -M mmorligh@uci.edu\n');
+ 			 fprintf(fid,'#PBS -o %s.outlog \n',modelname);
Index: issm/oecreview/Archive/16554-17801/ISSM-17461-17462.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17461-17462.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17461-17462.diff	(revision 17802)
@@ -0,0 +1,76 @@
+Index: ../trunk-jpl/test/Par/ValleyGlacierShelf.py
+===================================================================
+--- ../trunk-jpl/test/Par/ValleyGlacierShelf.py	(revision 17461)
++++ ../trunk-jpl/test/Par/ValleyGlacierShelf.py	(revision 17462)
+@@ -24,7 +24,7 @@
+ bmin=-thk_center*md.materials.rho_ice/md.materials.rho_water
+ 
+ alpha=2./3.
+-slope = (bmin-bmax)*(x-xmin)/(Lx*alpha) + bmax
++slope = 0.9*(bmin-bmax)*(x-xmin)/(Lx*alpha) + 0.1*(bmin-bmax)*(y-ymin)/(Ly) + bmax
+ md.geometry.surface= (thk_center+bmax) + slope 
+ md.geometry.bed=bmax + slope + 4./Ly**2*(thk_center-thk_margin)*(numpy.power(y-ym,2))
+ md.geometry.thickness=md.geometry.surface - md.geometry.bed
+Index: ../trunk-jpl/test/NightlyRun/test805.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test805.py	(revision 17461)
++++ ../trunk-jpl/test/NightlyRun/test805.py	(revision 17462)
+@@ -36,7 +36,7 @@
+ field_names     =['Vx1','Vy1','Vel1','Pressure1','Thickness1','Surface1','MaskIceLevelset1','Enthalpy1','Watercolumn1',\
+ 		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2','Enthalpy2','Watercolumn2',\
+ 		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3','Enthalpy3','Watercolumn3']
+-field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
++field_tolerances=[1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,\
+ 		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,\
+ 		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10]
+ field_values=[\
+Index: ../trunk-jpl/test/NightlyRun/test801.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test801.py	(revision 17461)
++++ ../trunk-jpl/test/NightlyRun/test801.py	(revision 17462)
+@@ -30,9 +30,9 @@
+ field_names     =['Vx1','Vy1','Vel1','Pressure1','Thickness1','Surface1','MaskIceLevelset1',\
+ 		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2',\
+ 		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3']
+-field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
+-		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
+-		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
++field_tolerances=[1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,\
++		1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,\
++		1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,1e-12]
+ field_values=[\
+ 	md.results.TransientSolution[0].Vx,\
+ 	md.results.TransientSolution[0].Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test802.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test802.py	(revision 17461)
++++ ../trunk-jpl/test/NightlyRun/test802.py	(revision 17462)
+@@ -33,7 +33,7 @@
+ field_names     =['Vx1','Vy1','Vel1','Pressure1','Thickness1','Surface1','MaskIceLevelset1','Temperature1',\
+ 		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2','Temperature2',\
+ 		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3','Temperature3']
+-field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
++field_tolerances=[1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,\
+ 		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,\
+ 		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10]
+ field_values=[\
+Index: ../trunk-jpl/test/Archives/Archive804.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive802.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive805.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive803.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive801.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17462-17463.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17462-17463.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17462-17463.diff	(revision 17802)
@@ -0,0 +1,245 @@
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17462)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17463)
+@@ -10,7 +10,7 @@
+ }
+ /*}}}*/
+ void LevelsetAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+-	// parameters->AddObject(iomodel->CopyConstantObject(FlowequationIsSIAEnum));
++	return;
+ }
+ /*}}}*/
+ void LevelsetAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+@@ -33,11 +33,6 @@
+ 	iomodel->FetchDataToInput(elements,VxEnum);
+ 	iomodel->FetchDataToInput(elements,VyEnum);
+ 	iomodel->FetchDataToInput(elements,MasstransportCalvingrateEnum);
+-	
+-	if(iomodel->meshtype==Mesh3DEnum){
+-		iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
+-		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+-	}
+ }
+ /*}}}*/
+ void LevelsetAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+@@ -48,19 +43,11 @@
+ }
+ /*}}}*/
+ void LevelsetAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+-
+-	/*Intermediary*/
+-
+-	/*Fetch parameters: */
+-
++	return;
+ }
+ /*}}}*/
+ void LevelsetAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+-	
+-	/*Intermediary*/
+-
+-	/*Fetch parameters: */
+-
++	return;
+ }/*}}}*/
+ 
+ /*Finite element Analysis*/
+@@ -72,7 +59,6 @@
+ 
+ 	/*parameters: */
+ 	bool save_results;
+-	
+ 	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
+ 
+ 	/*activate formulation: */
+@@ -524,4 +510,3 @@
+ 
+ 	return fabs(a[0]*b[1]-a[1]*b[0])/norm_b;
+ }/*}}}*/
+-
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 17462)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 17463)
+@@ -579,7 +579,6 @@
+ 	bool islevelset;
+ 	femmodel->parameters->FindParam(&islevelset,TransientIslevelsetEnum);
+ 	if(islevelset){
+-		_printf0_("   Updating active and non-active nodes for StressbalanceSIAAnalysis \n");
+ 		SetActiveNodesLSMx(femmodel);
+ 	}
+ 	return;
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17462)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17463)
+@@ -1037,7 +1037,6 @@
+ 	bool islevelset;
+ 	femmodel->parameters->FindParam(&islevelset,TransientIslevelsetEnum);
+ 	if(islevelset){
+-		_printf0_("   Updating active and non-active nodes for StressbalanceAnalysis \n");
+ 		SetActiveNodesLSMx(femmodel);
+ 	}
+ 	return;
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17462)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17463)
+@@ -716,7 +716,6 @@
+ 	bool islevelset;
+ 	femmodel->parameters->FindParam(&islevelset,TransientIslevelsetEnum);
+ 	if(islevelset){
+-		_printf0_("   Updating active and non-active nodes for ThermalAnalysis \n");
+ 		SetActiveNodesLSMx(femmodel);
+ 	}
+ 	return;
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17462)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17463)
+@@ -754,7 +754,6 @@
+ 	bool islevelset;
+ 	femmodel->parameters->FindParam(&islevelset,TransientIslevelsetEnum);
+ 	if(islevelset){
+-		_printf0_("   Updating active and non-active nodes for MasstransportAnalysis \n");
+ 		SetActiveNodesLSMx(femmodel);
+ 	}
+ 	return;
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17462)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17463)
+@@ -852,7 +852,6 @@
+ 	bool islevelset;
+ 	femmodel->parameters->FindParam(&islevelset,TransientIslevelsetEnum);
+ 	if(islevelset){
+-		_printf0_("   Updating active and non-active nodes for ThermalAnalysis \n");
+ 		SetActiveNodesLSMx(femmodel);
+ 	}
+ 	return;
+Index: ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17462)
++++ ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17463)
+@@ -11,6 +11,7 @@
+ /*}}}*/
+ void ExtrapolationAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+ 	//do nothing for now
++	return;
+ }
+ /*}}}*/
+ void ExtrapolationAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+@@ -43,10 +44,12 @@
+ /*}}}*/
+ void ExtrapolationAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ 	// do nothing for now
++	return;
+ }
+ /*}}}*/
+ void ExtrapolationAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+-// 	do nothing for now
++	//	do nothing for now
++	return;
+ }/*}}}*/
+ 
+ /*Finite element Analysis*/
+@@ -69,7 +72,6 @@
+ 		int outputs[2] = {VxEnum,VyEnum};
+ 		femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],2);
+ 	}
+-
+ }/*}}}*/
+ ElementVector* ExtrapolationAnalysis::CreateDVector(Element* element){/*{{{*/
+ 	/*Default, return NULL*/
+@@ -347,5 +349,4 @@
+ 		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+ 		this->SetConstraintsOnIce(element);
+ 	}
+-
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp	(revision 17462)
++++ ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp	(revision 17463)
+@@ -48,6 +48,7 @@
+ 				break;
+ 		}
+ 
++		/* if solving 2d problem on vertically extende mesh, solve on basal layer only*/
+ 		if(meshtype!=Mesh2DhorizontalEnum){
+ 			femmodel->parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+ 			if(
+@@ -96,6 +97,7 @@
+ 
+ 	/* Intermediaries */
+ 	int i;
++
+ 	/*Initialize vector with number of vertices*/
+ 	int numvertices=femmodel->vertices->NumberOfVertices();
+ 	Vector<IssmDouble>* vec_mask_ice=new Vector<IssmDouble>(numvertices); //vertices that have ice at next time step
+Index: ../trunk-jpl/src/c/cores/transient_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17462)
++++ ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17463)
+@@ -92,13 +92,6 @@
+ 		}
+ 	}
+ 
+-// 	if(islevelset){
+-// 		/* set distance on elements intersected by zero level set */
+-// 		LevelsetAnalysis* lsfanalysis = new LevelsetAnalysis();
+-// 		lsfanalysis->SetDistanceOnIntersectedElements(femmodel);
+-// 		delete lsfanalysis;
+-// 	}
+-	
+ 	while(time < finaltime - (yts*DBL_EPSILON)){ //make sure we run up to finaltime.
+ 
+ 		/*Increment*/
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17462)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17463)
+@@ -406,7 +406,7 @@
+ 	parameters->FindParam(&time,TimeEnum);
+ 
+ 	/*start module: */
+-	if(VerboseModule()) _printf0_("   Updating constraints for time: " << time << "\n");
++	if(VerboseModule()) _printf0_("   Updating constraints and active domain of analysis " << EnumToStringx(analysis_type)  << " for time: " << time << "\n");
+ 
+ 	Analysis* analysis= EnumToAnalysis(analysis_type);
+ 	analysis->UpdateConstraints(this);
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17462)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17463)
+@@ -2346,8 +2346,10 @@
+ 
+ 	/*If the level set is awlays <0, there is no ice front here*/
+ 	iszerols= false;
+-	if(ls[0]*ls[1]<0. || ls[0]*ls[2]<0. || (ls[0]*ls[1]*ls[2]==0. && ls[0]*ls[1]+ls[0]*ls[2]+ls[1]*ls[2]<=0.)){
+-		iszerols = true;
++	if(IsIceInElement()){
++		if(ls[0]*ls[1]<0. || ls[0]*ls[2]<0. || (ls[0]*ls[1]*ls[2]==0. && ls[0]*ls[1]+ls[0]*ls[2]+ls[1]*ls[2]<=0.)){
++			iszerols = true;
++		}
+ 	}
+ 
+ 	return iszerols;
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17462)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17463)
+@@ -2911,8 +2911,10 @@
+ 
+ 	/*If the level set has always same sign, there is no ice front here*/
+ 	iszerols = false;
+-	if(ls[0]*ls[1]<0. || ls[0]*ls[2]<0. || (ls[0]*ls[1]*ls[2]==0. && ls[0]*ls[1]+ls[0]*ls[2]+ls[1]*ls[2]<=0.)){
+-		iszerols = true;
++	if(IsIceInElement()){
++		if(ls[0]*ls[1]<0. || ls[0]*ls[2]<0. || (ls[0]*ls[1]*ls[2]==0. && ls[0]*ls[1]+ls[0]*ls[2]+ls[1]*ls[2]<=0.)){
++			iszerols = true;
++		}
+ 	}
+ 	return iszerols;
+ }
Index: issm/oecreview/Archive/16554-17801/ISSM-17463-17464.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17463-17464.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17463-17464.diff	(revision 17802)
@@ -0,0 +1,304 @@
+Index: ../trunk-jpl/test/NightlyRun/test801.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test801.m	(revision 0)
++++ ../trunk-jpl/test/NightlyRun/test801.m	(revision 17464)
+@@ -0,0 +1,46 @@
++md=triangle(model(),'../Exp/Square.exp',50000)
++md=setmask(md,'','')
++md=parameterize(md,'../Par/ValleyGlacierShelf.py')
++md=setflowequation(md,'SSA','all')
++md.cluster=generic('name',oshostname(),'np',3)
++
++%Transient
++md.transient.isstressbalance=1
++md.transient.islevelset=1
++md.transient.ismasstransport=1
++md.transient.isthermal=0
++md.transient.isgroundingline=1
++md.transient.isgia=0
++
++md=solve(md,TransientSolutionEnum())
++
++%Fields and tolerances to track changes
++field_names     ={'Vx1','Vy1','Vel1','Pressure1','Thickness1','Surface1','MaskIceLevelset1',...
++		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2',...
++		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3'}
++field_tolerances={1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,...
++		1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,...
++		1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,1e-12}
++field_values={...
++	md.results.TransientSolution(1).Vx,...
++	md.results.TransientSolution(1).Vy,...
++	md.results.TransientSolution(1).Vel,...
++	md.results.TransientSolution(1).Pressure,...
++	md.results.TransientSolution(1).Thickness,...
++	md.results.TransientSolution(1).Surface,...
++	md.results.TransientSolution(1).MaskIceLevelset,...
++	md.results.TransientSolution(2).Vx,...
++	md.results.TransientSolution(2).Vy,...
++	md.results.TransientSolution(2).Vel,...
++	md.results.TransientSolution(2).Pressure,...
++	md.results.TransientSolution(2).Thickness,...
++	md.results.TransientSolution(2).Surface,...
++	md.results.TransientSolution(2).MaskIceLevelset,...
++	md.results.TransientSolution(3).Vx,...
++	md.results.TransientSolution(3).Vy,...
++	md.results.TransientSolution(3).Vel,...
++	md.results.TransientSolution(3).Pressure,...
++	md.results.TransientSolution(3).Thickness,...
++	md.results.TransientSolution(3).Surface,...
++	md.results.TransientSolution(3).MaskIceLevelset,...
++	}
+Index: ../trunk-jpl/test/NightlyRun/test802.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test802.m	(revision 0)
++++ ../trunk-jpl/test/NightlyRun/test802.m	(revision 17464)
+@@ -0,0 +1,54 @@
++md=triangle(model(),'../Exp/Square.exp',50000)
++md=setmask(md,'','')
++md=parameterize(md,'../Par/ValleyGlacierShelf.py')
++md=extrude(md,3,2.)
++md=setflowequation(md,'SSA','all')
++md.cluster=generic('name',oshostname(),'np',3)
++
++%Thermal model
++pos_surf=find(md.mesh.vertexonsurface)
++md.thermal.spctemperature(pos_surf)=md.initialization.temperature(pos_surf)
++
++%Transient
++md.transient.isstressbalance=1
++md.transient.islevelset=1
++md.transient.ismasstransport=1
++md.transient.isthermal=1
++md.transient.isgroundingline=1
++md.transient.isgia=0
++
++md=solve(md,TransientSolutionEnum())
++
++%Fields and tolerances to track changes
++field_names     ={'Vx1','Vy1','Vel1','Pressure1','Thickness1','Surface1','MaskIceLevelset1','Temperature1',...
++		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2','Temperature2',...
++		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3','Temperature3'}
++field_tolerances={1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,...
++		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
++		1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11}
++field_values={...
++	md.results.TransientSolution(1).Vx,...
++	md.results.TransientSolution(1).Vy,...
++	md.results.TransientSolution(1).Vel,...
++	md.results.TransientSolution(1).Pressure,...
++	md.results.TransientSolution(1).Thickness,...
++	md.results.TransientSolution(1).Surface,...
++	md.results.TransientSolution(1).MaskIceLevelset,...
++	md.results.TransientSolution(1).Temperature,...
++	md.results.TransientSolution(2).Vx,...
++	md.results.TransientSolution(2).Vy,...
++	md.results.TransientSolution(2).Vel,...
++	md.results.TransientSolution(2).Pressure,...
++	md.results.TransientSolution(2).Thickness,...
++	md.results.TransientSolution(2).Surface,...
++	md.results.TransientSolution(2).MaskIceLevelset,...
++	md.results.TransientSolution(2).Temperature,...
++	md.results.TransientSolution(3).Vx,...
++	md.results.TransientSolution(3).Vy,...
++	md.results.TransientSolution(3).Vel,...
++	md.results.TransientSolution(3).Pressure,...
++	md.results.TransientSolution(3).Thickness,...
++	md.results.TransientSolution(3).Surface,...
++	md.results.TransientSolution(3).MaskIceLevelset,...
++	md.results.TransientSolution(3).Temperature,...
++	}
+Index: ../trunk-jpl/test/NightlyRun/test803.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test803.m	(revision 0)
++++ ../trunk-jpl/test/NightlyRun/test803.m	(revision 17464)
+@@ -0,0 +1,58 @@
++md=triangle(model(),'../Exp/Square.exp',50000)
++md=setmask(md,'','')
++md=parameterize(md,'../Par/ValleyGlacierShelf.py')
++md=extrude(md,3,2.)
++md=setflowequation(md,'HO','all')
++md.cluster=generic('name',oshostname(),'np',3)
++
++%Thermal model
++pos_surf=find(md.mesh.vertexonsurface)
++md.thermal.spctemperature(pos_surf)=md.initialization.temperature(pos_surf)
++md.thermal.isenthalpy=1
++
++%Transient
++md.transient.isstressbalance=1
++md.transient.islevelset=1
++md.transient.ismasstransport=1
++md.transient.isthermal=1
++md.transient.isgroundingline=1
++md.transient.isgia=0
++
++md=solve(md,TransientSolutionEnum())
++
++%Fields and tolerances to track changes
++field_names     ={'Vx1','Vy1','Vel1','Pressure1','Thickness1','Surface1','MaskIceLevelset1','Enthalpy1','Watercolumn1',...
++		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2','Enthalpy2','Watercolumn2',...
++		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3','Enthalpy3','Watercolumn3'}
++field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
++		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
++		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10}
++field_values={...
++	md.results.TransientSolution(1).Vx,...
++	md.results.TransientSolution(1).Vy,...
++	md.results.TransientSolution(1).Vel,...
++	md.results.TransientSolution(1).Pressure,...
++	md.results.TransientSolution(1).Thickness,...
++	md.results.TransientSolution(1).Surface,...
++	md.results.TransientSolution(1).MaskIceLevelset,...
++	md.results.TransientSolution(1).Enthalpy,...
++	md.results.TransientSolution(1).Watercolumn,...
++	md.results.TransientSolution(2).Vx,...
++	md.results.TransientSolution(2).Vy,...
++	md.results.TransientSolution(2).Vel,...
++	md.results.TransientSolution(2).Pressure,...
++	md.results.TransientSolution(2).Thickness,...
++	md.results.TransientSolution(2).Surface,...
++	md.results.TransientSolution(2).MaskIceLevelset,...
++	md.results.TransientSolution(2).Enthalpy,...
++	md.results.TransientSolution(2).Watercolumn,...
++	md.results.TransientSolution(3).Vx,...
++	md.results.TransientSolution(3).Vy,...
++	md.results.TransientSolution(3).Vel,...
++	md.results.TransientSolution(3).Pressure,...
++	md.results.TransientSolution(3).Thickness,...
++	md.results.TransientSolution(3).Surface,...
++	md.results.TransientSolution(3).MaskIceLevelset,...
++	md.results.TransientSolution(3).Enthalpy,...
++	md.results.TransientSolution(3).Watercolumn,...
++	}
+Index: ../trunk-jpl/test/NightlyRun/test804.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test804.m	(revision 0)
++++ ../trunk-jpl/test/NightlyRun/test804.m	(revision 17464)
+@@ -0,0 +1,48 @@
++md=triangle(model(),'../Exp/Square.exp',50000)
++md=setmask(md,'','')
++md=parameterize(md,'../Par/ValleyGlacierShelf.py')
++md=setflowequation(md,'SIA','all')
++md.cluster=generic('name',oshostname(),'np',3)
++
++%Transient
++md.transient.isstressbalance=1
++md.transient.islevelset=1
++md.transient.ismasstransport=1
++md.transient.isthermal=0
++md.transient.isgroundingline=1
++md.transient.isgia=0
++
++md.masstransport.calvingrate=1000.*ones(md.mesh.numberofvertices,1)
++
++md=solve(md,TransientSolutionEnum())
++
++%Fields and tolerances to track changes
++field_names     ={'Vx1','Vy1','Vel1','Pressure1','Thickness1','Surface1','MaskIceLevelset1',...
++		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2',...
++		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3'}
++field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
++		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
++		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13}
++field_values={...
++	md.results.TransientSolution(1).Vx,...
++	md.results.TransientSolution(1).Vy,...
++	md.results.TransientSolution(1).Vel,...
++	md.results.TransientSolution(1).Pressure,...
++	md.results.TransientSolution(1).Thickness,...
++	md.results.TransientSolution(1).Surface,...
++	md.results.TransientSolution(1).MaskIceLevelset,...
++	md.results.TransientSolution(2).Vx,...
++	md.results.TransientSolution(2).Vy,...
++	md.results.TransientSolution(2).Vel,...
++	md.results.TransientSolution(2).Pressure,...
++	md.results.TransientSolution(2).Thickness,...
++	md.results.TransientSolution(2).Surface,...
++	md.results.TransientSolution(2).MaskIceLevelset,...
++	md.results.TransientSolution(3).Vx,...
++	md.results.TransientSolution(3).Vy,...
++	md.results.TransientSolution(3).Vel,...
++	md.results.TransientSolution(3).Pressure,...
++	md.results.TransientSolution(3).Thickness,...
++	md.results.TransientSolution(3).Surface,...
++	md.results.TransientSolution(3).MaskIceLevelset,...
++	}
+Index: ../trunk-jpl/test/NightlyRun/test805.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test805.m	(revision 0)
++++ ../trunk-jpl/test/NightlyRun/test805.m	(revision 17464)
+@@ -0,0 +1,60 @@
++md=triangle(model(),'../Exp/Square.exp',50000)
++md=setmask(md,'','')
++md=parameterize(md,'../Par/ValleyGlacierShelf.py')
++md=extrude(md,3,2.)
++md=setflowequation(md,'HO','all')
++md.cluster=generic('name',oshostname(),'np',3)
++
++%Thermal model
++pos_surf=find(md.mesh.vertexonsurface)
++md.thermal.spctemperature(pos_surf)=md.initialization.temperature(pos_surf)
++md.thermal.isenthalpy=1
++
++%Transient
++md.transient.isstressbalance=1
++md.transient.islevelset=1
++md.transient.ismasstransport=1
++md.transient.isthermal=1
++md.transient.isgroundingline=1
++md.transient.isgia=0
++
++md.masstransport.calvingrate=1000.*ones(md.mesh.numberofvertices,1)
++
++md=solve(md,TransientSolutionEnum())
++
++%Fields and tolerances to track changes
++field_names     ={'Vx1','Vy1','Vel1','Pressure1','Thickness1','Surface1','MaskIceLevelset1','Enthalpy1','Watercolumn1',...
++		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2','Enthalpy2','Watercolumn2',...
++		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3','Enthalpy3','Watercolumn3'}
++field_tolerances={1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,...
++		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
++		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10}
++field_values={...
++	md.results.TransientSolution(1).Vx,...
++	md.results.TransientSolution(1).Vy,...
++	md.results.TransientSolution(1).Vel,...
++	md.results.TransientSolution(1).Pressure,...
++	md.results.TransientSolution(1).Thickness,...
++	md.results.TransientSolution(1).Surface,...
++	md.results.TransientSolution(1).MaskIceLevelset,...
++	md.results.TransientSolution(1).Enthalpy,...
++	md.results.TransientSolution(1).Watercolumn,...
++	md.results.TransientSolution(2).Vx,...
++	md.results.TransientSolution(2).Vy,...
++	md.results.TransientSolution(2).Vel,...
++	md.results.TransientSolution(2).Pressure,...
++	md.results.TransientSolution(2).Thickness,...
++	md.results.TransientSolution(2).Surface,...
++	md.results.TransientSolution(2).MaskIceLevelset,...
++	md.results.TransientSolution(2).Enthalpy,...
++	md.results.TransientSolution(2).Watercolumn,...
++	md.results.TransientSolution(3).Vx,...
++	md.results.TransientSolution(3).Vy,...
++	md.results.TransientSolution(3).Vel,...
++	md.results.TransientSolution(3).Pressure,...
++	md.results.TransientSolution(3).Thickness,...
++	md.results.TransientSolution(3).Surface,...
++	md.results.TransientSolution(3).MaskIceLevelset,...
++	md.results.TransientSolution(3).Enthalpy,...
++	md.results.TransientSolution(3).Watercolumn,...
++	}
+Index: ../trunk-jpl/test/NightlyRun/test801.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test801.py	(revision 17463)
++++ ../trunk-jpl/test/NightlyRun/test801.py	(revision 17464)
+@@ -22,8 +22,6 @@
+ md.transient.isgroundingline=True
+ md.transient.isgia=False
+ 
+-md.transient.requested_outputs=['IceVolume']
+-
+ md=solve(md,TransientSolutionEnum())
+ 
+ #Fields and tolerances to track changes
Index: issm/oecreview/Archive/16554-17801/ISSM-17464-17465.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17464-17465.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17464-17465.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/src/m/extrusion/project3d.py
+===================================================================
+--- ../trunk-jpl/src/m/extrusion/project3d.py	(revision 17464)
++++ ../trunk-jpl/src/m/extrusion/project3d.py	(revision 17465)
+@@ -26,7 +26,7 @@
+ 	#some regular checks
+ 	if not md:
+ 		raise TypeError("bad usage")
+-	if not md.mesh.dimension==3:
++	if not strcmp(md.mesh.meshtype(),'3D'):
+ 		raise TypeError("input model is not 3d")
+ 
+ 	#retrieve parameters from options.
+Index: ../trunk-jpl/src/m/extrusion/project3d.m
+===================================================================
+--- ../trunk-jpl/src/m/extrusion/project3d.m	(revision 17464)
++++ ../trunk-jpl/src/m/extrusion/project3d.m	(revision 17465)
+@@ -22,7 +22,7 @@
+ 	help project3d
+ 	error('bad usage');
+ end
+-if md.mesh.dimension~=3
++if ~strcmp(meshtype(md.mesh),'3D')
+ 	error('input model is not 3d');
+ end
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17465-17466.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17465-17466.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17465-17466.diff	(revision 17802)
@@ -0,0 +1,16 @@
+Index: ../trunk-jpl/src/m/parameterization/setflowequation.py
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/setflowequation.py	(revision 17465)
++++ ../trunk-jpl/src/m/parameterization/setflowequation.py	(revision 17466)
+@@ -66,11 +66,6 @@
+ 		SIAflag[numpy.nonzero(numpy.logical_and(SIAflag,HOflag))]=False
+ 		SSAflag[numpy.nonzero(numpy.logical_and(SSAflag,HOflag))]=False
+ 
+-	#Check that no HO or FS for 2d mesh
+-	if md.mesh.dimension==2:
+-		if numpy.any(logical_or_n(L1L2flag,FSflag,HOflag)):
+-			raise TypeError("FS and HO elements not allowed in 2d mesh, extrude it first")
+-
+ 	#FS can only be used alone for now:
+ 	if any(FSflag) and any(SIAflag):
+ 		raise TypeError("FS cannot be used with any other model for now, put FS everywhere")
Index: issm/oecreview/Archive/16554-17801/ISSM-17466-17467.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17466-17467.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17466-17467.diff	(revision 17802)
@@ -0,0 +1,102 @@
+Index: ../trunk-jpl/test/Par/ValleyGlacierShelf.par
+===================================================================
+--- ../trunk-jpl/test/Par/ValleyGlacierShelf.par	(revision 0)
++++ ../trunk-jpl/test/Par/ValleyGlacierShelf.par	(revision 17467)
+@@ -0,0 +1,97 @@
++%Start defining model parameters here
++x = md.mesh.x
++y = md.mesh.y
++xmin = min(x)
++xmax = max(x)
++ymin = min(y)
++ymax = max(y)
++Lx = (xmax-xmin)
++Ly = (ymax-ymin)
++xm = (xmin+xmax)/2.
++ym = (ymin+ymax)/2.
++
++%Geometry: U-shaped valley in y direction
++thk_center = 1000.
++thk_margin = 0.5*thk_center
++bmax = 0.
++bmin = -thk_center*md.materials.rho_ice/md.materials.rho_water
++
++alpha = 2./3.
++slope = 0.9*(bmin-bmax)*(x-xmin)/(Lx*alpha) + 0.1*(bmin-bmax)*(y-ymin)/(Ly) + bmax
++md.geometry.surface = (thk_center+bmax) + slope 
++md.geometry.bed = bmax + slope + 4./Ly^2*(thk_center-thk_margin)*(y-ym).^2)
++md.geometry.thickness = md.geometry.surface - md.geometry.bed
++md.geometry.bathymetry = md.geometry.bed
++
++%Mask
++md.mask.ice_levelset = x - alpha*Lx
++md.mask.groundedice_levelset = ones(md.mesh.numberofvertices,1)
++
++%Initial velocity 
++md.initialization.vx = zeros(md.mesh.numberofvertices,1)
++md.initialization.vy = zeros(md.mesh.numberofvertices,1)
++md.initialization.vz = zeros(md.mesh.numberofvertices,1)
++md.initialization.pressure = zeros(md.mesh.numberofvertices,1)
++
++%Materials
++md.initialization.temperature = (273.15-5.)*ones(md.mesh.numberofvertices,1)
++md.initialization.waterfraction = zeros(md.mesh.numberofvertices,1)
++md.initialization.watercolumn = zeros(md.mesh.numberofvertices,1)
++md.materials.rheology_B = paterson(md.initialization.temperature)
++md.materials.rheology_n = 3.*ones(md.mesh.numberofelements,1)
++
++%Thermal
++md.thermal.isenthalpy = 0
++md.thermal.spctemperature = NaN(md.mesh.numberofvertices,1)
++
++%Groundingline
++md.groundingline.migration = 'SubelementMigration'
++
++%Damage
++md.damage.D = zeros(md.mesh.numberofvertices,1)
++
++%Surface mass balance and basal melting
++md.surfaceforcings.mass_balance = 0.3*ones(md.mesh.numberofvertices,1)
++md.basalforcings.melting_rate = md.surfaceforcings.mass_balance
++
++%Friction
++md.friction.coefficient = 20.*ones(md.mesh.numberofvertices,1)
++md.friction.coefficient(find(md.mask.groundedice_levelset<0.)) = 0.
++md.friction.p = ones(md.mesh.numberofelements,1)
++md.friction.q = ones(md.mesh.numberofelements,1)
++
++%Transient
++md.transient.isstressbalance = 1
++md.transient.islevelset = 1
++md.transient.ismasstransport = 0
++md.transient.isthermal = 0
++md.transient.isgroundingline = 1
++md.transient.isgia = 0
++
++%Stressbalance
++md.stressbalance.maxiter = 100
++md.stressbalance.viscosity_overshoot = 0.0
++md.stressbalance.restol = 0.05
++md.stressbalance.reltol = 0.05
++md.stressbalance.abstol = NaN
++
++%Masstransport
++md.masstransport.calvingrate = 0.*ones(md.mesh.numberofvertices,1)
++md.masstransport.stabilization = 1.
++
++%Numerical parameters
++md.thermal.stabilization = 1.
++md.settings.waitonlock = 30
++md.steadystate.reltol = 0.05
++md.timestepping.time_step = 1.
++md.timestepping.final_time = 3.
++
++%Verbose
++md.verbose = verbose(0)
++
++%Deal with boundary conditions:
++md = SetIceShelfBC(md)
++
++%Change name so that no test have the same name
++A = dbstack;
++if (length(A)>2), md.miscellaneous.name=A(3).file(1:end-2); end
Index: issm/oecreview/Archive/16554-17801/ISSM-17467-17468.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17467-17468.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17467-17468.diff	(revision 17802)
@@ -0,0 +1,290 @@
+Index: ../trunk-jpl/test/NightlyRun/test801.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test801.m	(revision 17467)
++++ ../trunk-jpl/test/NightlyRun/test801.m	(revision 17468)
+@@ -1,26 +1,26 @@
+-md=triangle(model(),'../Exp/Square.exp',50000)
+-md=setmask(md,'','')
+-md=parameterize(md,'../Par/ValleyGlacierShelf.py')
+-md=setflowequation(md,'SSA','all')
+-md.cluster=generic('name',oshostname(),'np',3)
++md=triangle(model(),'../Exp/Square.exp',50000);
++md=setmask(md,'','');
++md=parameterize(md,'../Par/ValleyGlacierShelf.py');
++md=setflowequation(md,'SSA','all');
++md.cluster=generic('name',oshostname(),'np',3);
+ 
+-%Transient
+-md.transient.isstressbalance=1
+-md.transient.islevelset=1
+-md.transient.ismasstransport=1
+-md.transient.isthermal=0
+-md.transient.isgroundingline=1
+-md.transient.isgia=0
++%Transient;
++md.transient.isstressbalance=1;
++md.transient.islevelset=1;
++md.transient.ismasstransport=1;
++md.transient.isthermal=0;
++md.transient.isgroundingline=1;
++md.transient.isgia=0;
+ 
+-md=solve(md,TransientSolutionEnum())
++md=solve(md,TransientSolutionEnum());
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx1','Vy1','Vel1','Pressure1','Thickness1','Surface1','MaskIceLevelset1',...
+ 		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2',...
+-		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3'}
++		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3'};
+ field_tolerances={1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,...
+ 		1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,...
+-		1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,1e-12}
++		1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,1e-12};
+ field_values={...
+ 	md.results.TransientSolution(1).Vx,...
+ 	md.results.TransientSolution(1).Vy,...
+@@ -43,4 +43,4 @@
+ 	md.results.TransientSolution(3).Thickness,...
+ 	md.results.TransientSolution(3).Surface,...
+ 	md.results.TransientSolution(3).MaskIceLevelset,...
+-	}
++	};
+Index: ../trunk-jpl/test/NightlyRun/test802.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test802.m	(revision 17467)
++++ ../trunk-jpl/test/NightlyRun/test802.m	(revision 17468)
+@@ -1,31 +1,31 @@
+-md=triangle(model(),'../Exp/Square.exp',50000)
+-md=setmask(md,'','')
+-md=parameterize(md,'../Par/ValleyGlacierShelf.py')
+-md=extrude(md,3,2.)
+-md=setflowequation(md,'SSA','all')
+-md.cluster=generic('name',oshostname(),'np',3)
++md=triangle(model(),'../Exp/Square.exp',50000);
++md=setmask(md,'','');
++md=parameterize(md,'../Par/ValleyGlacierShelf.py');
++md=extrude(md,3,2.);
++md=setflowequation(md,'SSA','all');
++md.cluster=generic('name',oshostname(),'np',3);
+ 
+ %Thermal model
+-pos_surf=find(md.mesh.vertexonsurface)
+-md.thermal.spctemperature(pos_surf)=md.initialization.temperature(pos_surf)
++pos_surf=find(md.mesh.vertexonsurface);
++md.thermal.spctemperature(pos_surf)=md.initialization.temperature(pos_surf);
+ 
+ %Transient
+-md.transient.isstressbalance=1
+-md.transient.islevelset=1
+-md.transient.ismasstransport=1
+-md.transient.isthermal=1
+-md.transient.isgroundingline=1
+-md.transient.isgia=0
++md.transient.isstressbalance=1;
++md.transient.islevelset=1;
++md.transient.ismasstransport=1;
++md.transient.isthermal=1;
++md.transient.isgroundingline=1;
++md.transient.isgia=0;
+ 
+-md=solve(md,TransientSolutionEnum())
++md=solve(md,TransientSolutionEnum());
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx1','Vy1','Vel1','Pressure1','Thickness1','Surface1','MaskIceLevelset1','Temperature1',...
+ 		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2','Temperature2',...
+-		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3','Temperature3'}
++		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3','Temperature3'};
+ field_tolerances={1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,...
+ 		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
+-		1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11}
++		1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11};
+ field_values={...
+ 	md.results.TransientSolution(1).Vx,...
+ 	md.results.TransientSolution(1).Vy,...
+@@ -51,4 +51,4 @@
+ 	md.results.TransientSolution(3).Surface,...
+ 	md.results.TransientSolution(3).MaskIceLevelset,...
+ 	md.results.TransientSolution(3).Temperature,...
+-	}
++	};
+Index: ../trunk-jpl/test/NightlyRun/test803.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test803.m	(revision 17467)
++++ ../trunk-jpl/test/NightlyRun/test803.m	(revision 17468)
+@@ -1,32 +1,32 @@
+-md=triangle(model(),'../Exp/Square.exp',50000)
+-md=setmask(md,'','')
+-md=parameterize(md,'../Par/ValleyGlacierShelf.py')
+-md=extrude(md,3,2.)
+-md=setflowequation(md,'HO','all')
+-md.cluster=generic('name',oshostname(),'np',3)
++md=triangle(model(),'../Exp/Square.exp',50000);
++md=setmask(md,'','');
++md=parameterize(md,'../Par/ValleyGlacierShelf.py');
++md=extrude(md,3,2.);
++md=setflowequation(md,'HO','all');
++md.cluster=generic('name',oshostname(),'np',3);
+ 
+ %Thermal model
+-pos_surf=find(md.mesh.vertexonsurface)
+-md.thermal.spctemperature(pos_surf)=md.initialization.temperature(pos_surf)
+-md.thermal.isenthalpy=1
++pos_surf=find(md.mesh.vertexonsurface);
++md.thermal.spctemperature(pos_surf)=md.initialization.temperature(pos_surf);
++md.thermal.isenthalpy=1;
+ 
+ %Transient
+-md.transient.isstressbalance=1
+-md.transient.islevelset=1
+-md.transient.ismasstransport=1
+-md.transient.isthermal=1
+-md.transient.isgroundingline=1
+-md.transient.isgia=0
++md.transient.isstressbalance=1;
++md.transient.islevelset=1;
++md.transient.ismasstransport=1;
++md.transient.isthermal=1;
++md.transient.isgroundingline=1;
++md.transient.isgia=0;
+ 
+-md=solve(md,TransientSolutionEnum())
++md=solve(md,TransientSolutionEnum());
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx1','Vy1','Vel1','Pressure1','Thickness1','Surface1','MaskIceLevelset1','Enthalpy1','Watercolumn1',...
+ 		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2','Enthalpy2','Watercolumn2',...
+-		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3','Enthalpy3','Watercolumn3'}
++		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3','Enthalpy3','Watercolumn3'};
+ field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+ 		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
+-		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10}
++		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10};
+ field_values={...
+ 	md.results.TransientSolution(1).Vx,...
+ 	md.results.TransientSolution(1).Vy,...
+@@ -55,4 +55,4 @@
+ 	md.results.TransientSolution(3).MaskIceLevelset,...
+ 	md.results.TransientSolution(3).Enthalpy,...
+ 	md.results.TransientSolution(3).Watercolumn,...
+-	}
++	};
+Index: ../trunk-jpl/test/NightlyRun/test804.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test804.m	(revision 17467)
++++ ../trunk-jpl/test/NightlyRun/test804.m	(revision 17468)
+@@ -1,28 +1,28 @@
+-md=triangle(model(),'../Exp/Square.exp',50000)
+-md=setmask(md,'','')
+-md=parameterize(md,'../Par/ValleyGlacierShelf.py')
+-md=setflowequation(md,'SIA','all')
+-md.cluster=generic('name',oshostname(),'np',3)
++md=triangle(model(),'../Exp/Square.exp',50000);
++md=setmask(md,'','');
++md=parameterize(md,'../Par/ValleyGlacierShelf.py');
++md=setflowequation(md,'SIA','all');
++md.cluster=generic('name',oshostname(),'np',3);
+ 
+ %Transient
+-md.transient.isstressbalance=1
+-md.transient.islevelset=1
+-md.transient.ismasstransport=1
+-md.transient.isthermal=0
+-md.transient.isgroundingline=1
+-md.transient.isgia=0
++md.transient.isstressbalance=1;
++md.transient.islevelset=1;
++md.transient.ismasstransport=1;
++md.transient.isthermal=0;
++md.transient.isgroundingline=1;
++md.transient.isgia=0;
+ 
+-md.masstransport.calvingrate=1000.*ones(md.mesh.numberofvertices,1)
++md.masstransport.calvingrate=1000.*ones(md.mesh.numberofvertices,1);
+ 
+-md=solve(md,TransientSolutionEnum())
++md=solve(md,TransientSolutionEnum());
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx1','Vy1','Vel1','Pressure1','Thickness1','Surface1','MaskIceLevelset1',...
+ 		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2',...
+-		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3'}
++		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3'};
+ field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+ 		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+-		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13}
++		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
+ field_values={...
+ 	md.results.TransientSolution(1).Vx,...
+ 	md.results.TransientSolution(1).Vy,...
+@@ -45,4 +45,4 @@
+ 	md.results.TransientSolution(3).Thickness,...
+ 	md.results.TransientSolution(3).Surface,...
+ 	md.results.TransientSolution(3).MaskIceLevelset,...
+-	}
++	};
+Index: ../trunk-jpl/test/NightlyRun/test805.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test805.m	(revision 17467)
++++ ../trunk-jpl/test/NightlyRun/test805.m	(revision 17468)
+@@ -1,34 +1,34 @@
+-md=triangle(model(),'../Exp/Square.exp',50000)
+-md=setmask(md,'','')
+-md=parameterize(md,'../Par/ValleyGlacierShelf.py')
+-md=extrude(md,3,2.)
+-md=setflowequation(md,'HO','all')
+-md.cluster=generic('name',oshostname(),'np',3)
++md=triangle(model(),'../Exp/Square.exp',50000);
++md=setmask(md,'','');
++md=parameterize(md,'../Par/ValleyGlacierShelf.py');
++md=extrude(md,3,2.);
++md=setflowequation(md,'HO','all');
++md.cluster=generic('name',oshostname(),'np',3);
+ 
+ %Thermal model
+-pos_surf=find(md.mesh.vertexonsurface)
+-md.thermal.spctemperature(pos_surf)=md.initialization.temperature(pos_surf)
+-md.thermal.isenthalpy=1
++pos_surf=find(md.mesh.vertexonsurface);
++md.thermal.spctemperature(pos_surf)=md.initialization.temperature(pos_surf);
++md.thermal.isenthalpy=1;
+ 
+ %Transient
+-md.transient.isstressbalance=1
+-md.transient.islevelset=1
+-md.transient.ismasstransport=1
+-md.transient.isthermal=1
+-md.transient.isgroundingline=1
+-md.transient.isgia=0
++md.transient.isstressbalance=1;
++md.transient.islevelset=1;
++md.transient.ismasstransport=1;
++md.transient.isthermal=1;
++md.transient.isgroundingline=1;
++md.transient.isgia=0;
+ 
+-md.masstransport.calvingrate=1000.*ones(md.mesh.numberofvertices,1)
++md.masstransport.calvingrate=1000.*ones(md.mesh.numberofvertices,1);
+ 
+-md=solve(md,TransientSolutionEnum())
++md=solve(md,TransientSolutionEnum());
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx1','Vy1','Vel1','Pressure1','Thickness1','Surface1','MaskIceLevelset1','Enthalpy1','Watercolumn1',...
+ 		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2','Enthalpy2','Watercolumn2',...
+-		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3','Enthalpy3','Watercolumn3'}
++		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3','Enthalpy3','Watercolumn3'};
+ field_tolerances={1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,...
+ 		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
+-		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10}
++		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10};
+ field_values={...
+ 	md.results.TransientSolution(1).Vx,...
+ 	md.results.TransientSolution(1).Vy,...
+@@ -57,4 +57,4 @@
+ 	md.results.TransientSolution(3).MaskIceLevelset,...
+ 	md.results.TransientSolution(3).Enthalpy,...
+ 	md.results.TransientSolution(3).Watercolumn,...
+-	}
++	};
Index: issm/oecreview/Archive/16554-17801/ISSM-17468-17469.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17468-17469.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17468-17469.diff	(revision 17802)
@@ -0,0 +1,165 @@
+Index: ../trunk-jpl/test/Par/ValleyGlacierShelf.par
+===================================================================
+--- ../trunk-jpl/test/Par/ValleyGlacierShelf.par	(revision 17468)
++++ ../trunk-jpl/test/Par/ValleyGlacierShelf.par	(revision 17469)
+@@ -1,97 +1,97 @@
+ %Start defining model parameters here
+-x = md.mesh.x
+-y = md.mesh.y
+-xmin = min(x)
+-xmax = max(x)
+-ymin = min(y)
+-ymax = max(y)
+-Lx = (xmax-xmin)
+-Ly = (ymax-ymin)
+-xm = (xmin+xmax)/2.
+-ym = (ymin+ymax)/2.
++x = md.mesh.x;
++y = md.mesh.y;
++xmin = min(x);
++xmax = max(x);
++ymin = min(y);
++ymax = max(y);
++Lx = (xmax-xmin);
++Ly = (ymax-ymin);
++xm = (xmin+xmax)/2.;
++ym = (ymin+ymax)/2.;
+ 
+ %Geometry: U-shaped valley in y direction
+-thk_center = 1000.
+-thk_margin = 0.5*thk_center
+-bmax = 0.
+-bmin = -thk_center*md.materials.rho_ice/md.materials.rho_water
++thk_center = 1000.;
++thk_margin = 0.5*thk_center;
++bmax = 0.;
++bmin = -thk_center*md.materials.rho_ice/md.materials.rho_water;
+ 
+-alpha = 2./3.
+-slope = 0.9*(bmin-bmax)*(x-xmin)/(Lx*alpha) + 0.1*(bmin-bmax)*(y-ymin)/(Ly) + bmax
+-md.geometry.surface = (thk_center+bmax) + slope 
+-md.geometry.bed = bmax + slope + 4./Ly^2*(thk_center-thk_margin)*(y-ym).^2)
+-md.geometry.thickness = md.geometry.surface - md.geometry.bed
+-md.geometry.bathymetry = md.geometry.bed
++alpha = 2./3.;
++slope = 0.9*(bmin-bmax)*(x-xmin)/(Lx*alpha) + 0.1*(bmin-bmax)*(y-ymin)/(Ly) + bmax;
++md.geometry.surface = (thk_center+bmax) + slope ;
++md.geometry.bed = bmax + slope + 4./Ly^2*(thk_center-thk_margin)*(y-ym).^2);
++md.geometry.thickness = md.geometry.surface - md.geometry.bed;
++md.geometry.bathymetry = md.geometry.bed;
+ 
+ %Mask
+-md.mask.ice_levelset = x - alpha*Lx
+-md.mask.groundedice_levelset = ones(md.mesh.numberofvertices,1)
++md.mask.ice_levelset = x - alpha*Lx;
++md.mask.groundedice_levelset = ones(md.mesh.numberofvertices,1);
+ 
+ %Initial velocity 
+-md.initialization.vx = zeros(md.mesh.numberofvertices,1)
+-md.initialization.vy = zeros(md.mesh.numberofvertices,1)
+-md.initialization.vz = zeros(md.mesh.numberofvertices,1)
+-md.initialization.pressure = zeros(md.mesh.numberofvertices,1)
++md.initialization.vx = zeros(md.mesh.numberofvertices,1);
++md.initialization.vy = zeros(md.mesh.numberofvertices,1);
++md.initialization.vz = zeros(md.mesh.numberofvertices,1);
++md.initialization.pressure = zeros(md.mesh.numberofvertices,1);
+ 
+ %Materials
+-md.initialization.temperature = (273.15-5.)*ones(md.mesh.numberofvertices,1)
+-md.initialization.waterfraction = zeros(md.mesh.numberofvertices,1)
+-md.initialization.watercolumn = zeros(md.mesh.numberofvertices,1)
+-md.materials.rheology_B = paterson(md.initialization.temperature)
+-md.materials.rheology_n = 3.*ones(md.mesh.numberofelements,1)
++md.initialization.temperature = (273.15-5.)*ones(md.mesh.numberofvertices,1);
++md.initialization.waterfraction = zeros(md.mesh.numberofvertices,1);
++md.initialization.watercolumn = zeros(md.mesh.numberofvertices,1);
++md.materials.rheology_B = paterson(md.initialization.temperature);
++md.materials.rheology_n = 3.*ones(md.mesh.numberofelements,1);
+ 
+ %Thermal
+-md.thermal.isenthalpy = 0
+-md.thermal.spctemperature = NaN(md.mesh.numberofvertices,1)
++md.thermal.isenthalpy = 0;
++md.thermal.spctemperature = NaN(md.mesh.numberofvertices,1);
+ 
+ %Groundingline
+-md.groundingline.migration = 'SubelementMigration'
++md.groundingline.migration = 'SubelementMigration';
+ 
+ %Damage
+-md.damage.D = zeros(md.mesh.numberofvertices,1)
++md.damage.D = zeros(md.mesh.numberofvertices,1);
+ 
+ %Surface mass balance and basal melting
+-md.surfaceforcings.mass_balance = 0.3*ones(md.mesh.numberofvertices,1)
+-md.basalforcings.melting_rate = md.surfaceforcings.mass_balance
++md.surfaceforcings.mass_balance = 0.3*ones(md.mesh.numberofvertices,1);
++md.basalforcings.melting_rate = md.surfaceforcings.mass_balance;
+ 
+ %Friction
+-md.friction.coefficient = 20.*ones(md.mesh.numberofvertices,1)
+-md.friction.coefficient(find(md.mask.groundedice_levelset<0.)) = 0.
+-md.friction.p = ones(md.mesh.numberofelements,1)
+-md.friction.q = ones(md.mesh.numberofelements,1)
++md.friction.coefficient = 20.*ones(md.mesh.numberofvertices,1);
++md.friction.coefficient(find(md.mask.groundedice_levelset<0.)) = 0.;
++md.friction.p = ones(md.mesh.numberofelements,1);
++md.friction.q = ones(md.mesh.numberofelements,1);
+ 
+ %Transient
+-md.transient.isstressbalance = 1
+-md.transient.islevelset = 1
+-md.transient.ismasstransport = 0
+-md.transient.isthermal = 0
+-md.transient.isgroundingline = 1
+-md.transient.isgia = 0
++md.transient.isstressbalance = 1;
++md.transient.islevelset = 1;
++md.transient.ismasstransport = 0;
++md.transient.isthermal = 0;
++md.transient.isgroundingline = 1;
++md.transient.isgia = 0;
+ 
+ %Stressbalance
+-md.stressbalance.maxiter = 100
+-md.stressbalance.viscosity_overshoot = 0.0
+-md.stressbalance.restol = 0.05
+-md.stressbalance.reltol = 0.05
+-md.stressbalance.abstol = NaN
++md.stressbalance.maxiter = 100;
++md.stressbalance.viscosity_overshoot = 0.0;
++md.stressbalance.restol = 0.05;
++md.stressbalance.reltol = 0.05;
++md.stressbalance.abstol = NaN;
+ 
+-%Masstransport
+-md.masstransport.calvingrate = 0.*ones(md.mesh.numberofvertices,1)
+-md.masstransport.stabilization = 1.
++%Masstransport;
++md.masstransport.calvingrate = 0.*ones(md.mesh.numberofvertices,1);
++md.masstransport.stabilization = 1.;
+ 
+ %Numerical parameters
+-md.thermal.stabilization = 1.
+-md.settings.waitonlock = 30
+-md.steadystate.reltol = 0.05
+-md.timestepping.time_step = 1.
+-md.timestepping.final_time = 3.
++md.thermal.stabilization = 1.;
++md.settings.waitonlock = 30;
++md.steadystate.reltol = 0.05;
++md.timestepping.time_step = 1.;
++md.timestepping.final_time = 3.;
+ 
+ %Verbose
+-md.verbose = verbose(0)
++md.verbose = verbose(0);
+ 
+ %Deal with boundary conditions:
+-md = SetIceShelfBC(md)
++md = SetIceShelfBC(md);
+ 
+-%Change name so that no test have the same name
++%Change name so that no test have the same name;
+ A = dbstack;
+ if (length(A)>2), md.miscellaneous.name=A(3).file(1:end-2); end
Index: issm/oecreview/Archive/16554-17801/ISSM-17469-17470.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17469-17470.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17469-17470.diff	(revision 17802)
@@ -0,0 +1,129 @@
+Index: ../trunk-jpl/test/Par/ValleyGlacierShelf.par
+===================================================================
+--- ../trunk-jpl/test/Par/ValleyGlacierShelf.par	(revision 17469)
++++ ../trunk-jpl/test/Par/ValleyGlacierShelf.par	(revision 17470)
+@@ -19,7 +19,7 @@
+ alpha = 2./3.;
+ slope = 0.9*(bmin-bmax)*(x-xmin)/(Lx*alpha) + 0.1*(bmin-bmax)*(y-ymin)/(Ly) + bmax;
+ md.geometry.surface = (thk_center+bmax) + slope ;
+-md.geometry.bed = bmax + slope + 4./Ly^2*(thk_center-thk_margin)*(y-ym).^2);
++md.geometry.bed = bmax + slope + 4./Ly^2*(thk_center-thk_margin)*(y-ym).^2;
+ md.geometry.thickness = md.geometry.surface - md.geometry.bed;
+ md.geometry.bathymetry = md.geometry.bed;
+ 
+Index: ../trunk-jpl/test/NightlyRun/test801.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test801.m	(revision 17469)
++++ ../trunk-jpl/test/NightlyRun/test801.m	(revision 17470)
+@@ -1,6 +1,6 @@
+ md=triangle(model(),'../Exp/Square.exp',50000);
+ md=setmask(md,'','');
+-md=parameterize(md,'../Par/ValleyGlacierShelf.py');
++md=parameterize(md,'../Par/ValleyGlacierShelf.par');
+ md=setflowequation(md,'SSA','all');
+ md.cluster=generic('name',oshostname(),'np',3);
+ 
+Index: ../trunk-jpl/test/NightlyRun/test803.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test803.py	(revision 17469)
++++ ../trunk-jpl/test/NightlyRun/test803.py	(revision 17470)
+@@ -19,6 +19,7 @@
+ pos_surf=numpy.nonzero(md.mesh.vertexonsurface)[0]
+ md.thermal.spctemperature[pos_surf]=md.initialization.temperature[pos_surf]
+ md.thermal.isenthalpy=True
++md.thermal.isdynamicbasalspc=True
+ 
+ #Transient
+ md.transient.isstressbalance=True
+Index: ../trunk-jpl/test/NightlyRun/test802.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test802.m	(revision 17469)
++++ ../trunk-jpl/test/NightlyRun/test802.m	(revision 17470)
+@@ -1,6 +1,6 @@
+ md=triangle(model(),'../Exp/Square.exp',50000);
+ md=setmask(md,'','');
+-md=parameterize(md,'../Par/ValleyGlacierShelf.py');
++md=parameterize(md,'../Par/ValleyGlacierShelf.par');
+ md=extrude(md,3,2.);
+ md=setflowequation(md,'SSA','all');
+ md.cluster=generic('name',oshostname(),'np',3);
+Index: ../trunk-jpl/test/NightlyRun/test803.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test803.m	(revision 17469)
++++ ../trunk-jpl/test/NightlyRun/test803.m	(revision 17470)
+@@ -1,6 +1,6 @@
+ md=triangle(model(),'../Exp/Square.exp',50000);
+ md=setmask(md,'','');
+-md=parameterize(md,'../Par/ValleyGlacierShelf.py');
++md=parameterize(md,'../Par/ValleyGlacierShelf.par');
+ md=extrude(md,3,2.);
+ md=setflowequation(md,'HO','all');
+ md.cluster=generic('name',oshostname(),'np',3);
+@@ -9,6 +9,7 @@
+ pos_surf=find(md.mesh.vertexonsurface);
+ md.thermal.spctemperature(pos_surf)=md.initialization.temperature(pos_surf);
+ md.thermal.isenthalpy=1;
++md.thermal.isdynamicbasalspc=1;
+ 
+ %Transient
+ md.transient.isstressbalance=1;
+Index: ../trunk-jpl/test/NightlyRun/test804.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test804.m	(revision 17469)
++++ ../trunk-jpl/test/NightlyRun/test804.m	(revision 17470)
+@@ -1,6 +1,6 @@
+ md=triangle(model(),'../Exp/Square.exp',50000);
+ md=setmask(md,'','');
+-md=parameterize(md,'../Par/ValleyGlacierShelf.py');
++md=parameterize(md,'../Par/ValleyGlacierShelf.par');
+ md=setflowequation(md,'SIA','all');
+ md.cluster=generic('name',oshostname(),'np',3);
+ 
+Index: ../trunk-jpl/test/NightlyRun/test805.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test805.py	(revision 17469)
++++ ../trunk-jpl/test/NightlyRun/test805.py	(revision 17470)
+@@ -19,6 +19,7 @@
+ pos_surf=numpy.nonzero(md.mesh.vertexonsurface)[0]
+ md.thermal.spctemperature[pos_surf]=md.initialization.temperature[pos_surf]
+ md.thermal.isenthalpy=True
++md.thermal.isdynamicbasalspc=True
+ 
+ #Transient
+ md.transient.isstressbalance=True
+Index: ../trunk-jpl/test/NightlyRun/test805.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test805.m	(revision 17469)
++++ ../trunk-jpl/test/NightlyRun/test805.m	(revision 17470)
+@@ -1,6 +1,6 @@
+ md=triangle(model(),'../Exp/Square.exp',50000);
+ md=setmask(md,'','');
+-md=parameterize(md,'../Par/ValleyGlacierShelf.py');
++md=parameterize(md,'../Par/ValleyGlacierShelf.par');
+ md=extrude(md,3,2.);
+ md=setflowequation(md,'HO','all');
+ md.cluster=generic('name',oshostname(),'np',3);
+@@ -9,6 +9,7 @@
+ pos_surf=find(md.mesh.vertexonsurface);
+ md.thermal.spctemperature(pos_surf)=md.initialization.temperature(pos_surf);
+ md.thermal.isenthalpy=1;
++md.thermal.isdynamicbasalspc=1;
+ 
+ %Transient
+ md.transient.isstressbalance=1;
+Index: ../trunk-jpl/test/NightlyRun/IdToName.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/IdToName.m	(revision 17469)
++++ ../trunk-jpl/test/NightlyRun/IdToName.m	(revision 17470)
+@@ -176,6 +176,11 @@
+ 	case 701, name='FlowbandFSshelf';
+ 	case 702, name='FlowbandFSsheetshelf';
+ 	case 703, name='FlowbandFSsheetshelfTrans';
++	case 801, name='ValleyGlacierLevelsetSSA2d';
++	case 802, name='ValleyGlacierLevelsetThermalSSA3d';
++	case 803, name='ValleyGlacierLevelsetEnthalpyHO3d';
++	case 804, name='ValleyGlacierLevelsetCalvingSIA2d';
++	case 805, name='ValleyGlacierLevelsetEnthCalvingHO3d';
+ 	case 1101, name='ISMIPAHO';
+ 	case 1102, name='ISMIPAFS';
+ 	case 1103, name='ISMIPBHO';
Index: issm/oecreview/Archive/16554-17801/ISSM-17470-17471.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17470-17471.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17470-17471.diff	(revision 17802)
@@ -0,0 +1,15 @@
+Index: ../trunk-jpl/src/m/classes/thermal.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/thermal.py	(revision 17470)
++++ ../trunk-jpl/src/m/classes/thermal.py	(revision 17471)
+@@ -86,7 +86,9 @@
+ 			md = checkfield(md,'fieldname','thermal.spctemperature[numpy.nonzero(numpy.logical_not(numpy.isnan(md.thermal.spctemperature[0:md.mesh.numberofvertices,:])))]','<',md.materials.meltingpoint-md.materials.beta*md.materials.rho_ice*md.constants.g*replicate[pos],'message',"spctemperature should be below the adjusted melting point")
+ 			md = checkfield(md,'fieldname','thermal.isenthalpy','numel',[1],'values',[0,1])
+ 			md = checkfield(md,'fieldname','thermal.isdynamicbasalspc','numel',[1],'values',[0,1]);
+-			md = checkfield(md,'fieldname','thermal.requested_outputs','stringrow',1)
++			if(md.thermal.isenthalpy):
++				md = checkfield(md,'fieldname','thermal.isdynamicbasalspc','numel', [1],'values',[1], 'message',"for enthalpy run thermal.isdynamicbasalspc should be true")
++		md = checkfield(md,'fieldname','thermal.requested_outputs','stringrow',1)
+ 
+ 		return md
+ 	# }}}
Index: issm/oecreview/Archive/16554-17801/ISSM-17471-17472.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17471-17472.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17471-17472.diff	(revision 17802)
@@ -0,0 +1,2932 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17471)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17472)
+@@ -19,6 +19,7 @@
+ 		case SSAApproximationEnum:
+ 			 switch(meshtype){
+ 				 case Mesh3DEnum:           numdofs=2; break;
++				 case Mesh3DtetrasEnum:     numdofs=2; break;
+ 				 case Mesh2DhorizontalEnum: numdofs=2; break;
+ 				 case Mesh2DverticalEnum:   numdofs=1; break;
+ 				 default: _error_("mesh type not supported yet");
+@@ -28,6 +29,7 @@
+ 		case HOApproximationEnum:   
+ 			 switch(meshtype){
+ 				 case Mesh3DEnum:         numdofs=2; break;
++				 case Mesh3DtetrasEnum:   numdofs=2; break;
+ 				 case Mesh2DverticalEnum: numdofs=1; break;
+ 				 default: _error_("mesh type not supported yet");
+ 			 }
+@@ -36,6 +38,7 @@
+ 		case FSvelocityEnum:
+ 			 switch(meshtype){
+ 				 case Mesh3DEnum:         numdofs=3; break;
++				 case Mesh3DtetrasEnum:   numdofs=3; break;
+ 				 case Mesh2DverticalEnum: numdofs=2; break;
+ 				 default: _error_("mesh type not supported yet");
+ 			}
+@@ -44,6 +47,7 @@
+ 		case NoneApproximationEnum:
+ 			 switch(meshtype){
+ 				 case Mesh3DEnum:         numdofs=4; break;
++				 case Mesh3DtetrasEnum:   numdofs=4; break;
+ 				 case Mesh2DverticalEnum: numdofs=3; break;
+ 				 default: _error_("mesh type not supported yet");
+ 			}
+@@ -214,8 +218,16 @@
+ 		iomodel->FetchDataToInput(elements,VzEnum,0.);
+ 		if(dakota_analysis)elements->InputDuplicate(VzEnum,QmuVzEnum);
+ 	}
++	if(iomodel->meshtype==Mesh3DtetrasEnum){
++		iomodel->FetchDataToInput(elements,MeshVertexonbedEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
++		iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
++		iomodel->FetchDataToInput(elements,LoadingforceZEnum);
++		iomodel->FetchDataToInput(elements,VzEnum,0.);
++		if(dakota_analysis)elements->InputDuplicate(VzEnum,QmuVzEnum);
++	}
+ 	if(iomodel->meshtype==Mesh2DverticalEnum){
+-	      iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+ 	}
+ 	if(isFS){
+ 		iomodel->FetchDataToInput(elements,MeshVertexonbedEnum);
+@@ -962,6 +974,7 @@
+ 		case Mesh2DhorizontalEnum: dim = 2; dofpernode = 2; break;
+ 		case Mesh2DverticalEnum:   dim = 2; dofpernode = 1; break;
+ 		case Mesh3DEnum:           dim = 3; dofpernode = 2; break;
++		case Mesh3DtetrasEnum:     dim = 3; dofpernode = 2; break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+@@ -1179,6 +1192,7 @@
+ 		case Mesh2DverticalEnum:   dim = 1;break;
+ 		case Mesh2DhorizontalEnum: dim = 2;break;
+ 		case Mesh3DEnum:           dim = 2;break;
++		case Mesh3DtetrasEnum:     dim = 2;break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+@@ -1264,6 +1278,7 @@
+ 		case Mesh2DverticalEnum:   dim = 1; bsize = 1; break;
+ 		case Mesh2DhorizontalEnum: dim = 2; bsize = 3; break;
+ 		case Mesh3DEnum:           dim = 2; bsize = 3; break;
++		case Mesh3DtetrasEnum:     dim = 2; bsize = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+@@ -1376,6 +1391,7 @@
+ 		case Mesh2DverticalEnum:   dim = 1;break;
+ 		case Mesh2DhorizontalEnum: dim = 2;break;
+ 		case Mesh3DEnum:           dim = 2;break;
++		case Mesh3DtetrasEnum:     dim = 2;break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+@@ -1441,6 +1457,7 @@
+ 		case Mesh2DverticalEnum:   dim = 1;break;
+ 		case Mesh2DhorizontalEnum: dim = 2;break;
+ 		case Mesh3DEnum:           dim = 2;break;
++		case Mesh3DtetrasEnum:     dim = 2;break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+@@ -2139,6 +2156,7 @@
+ 	switch(meshtype){
+ 		case Mesh2DverticalEnum: dim = 2; bsize = 2; break;
+ 		case Mesh3DEnum:         dim = 3; bsize = 5; break;
++		case Mesh3DtetrasEnum:   dim = 3; bsize = 5; break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+@@ -2218,6 +2236,7 @@
+ 	switch(meshtype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
++		case Mesh3DtetrasEnum:   dim = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+@@ -2303,6 +2322,7 @@
+ 	switch(meshtype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
++		case Mesh3DtetrasEnum:   dim = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+@@ -2379,6 +2399,7 @@
+ 	switch(meshtype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
++		case Mesh3DtetrasEnum:   dim = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+@@ -2440,6 +2461,7 @@
+ 	switch(meshtype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
++		case Mesh3DtetrasEnum:   dim = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+@@ -2638,6 +2660,7 @@
+ 	switch(meshtype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
++		case Mesh3DtetrasEnum:   dim = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+@@ -2725,6 +2748,7 @@
+ 	switch(meshtype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
++		case Mesh3DtetrasEnum:   dim = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+@@ -2856,6 +2880,7 @@
+ 	switch(meshtype){
+ 		case Mesh2DverticalEnum: dim = 2; epssize = 3; break;
+ 		case Mesh3DEnum:         dim = 3; epssize = 6; break;
++		case Mesh3DtetrasEnum:   dim = 3; epssize = 6; break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+@@ -2939,6 +2964,7 @@
+ 	switch(meshtype){
+ 		case Mesh2DverticalEnum: dim = 2;break;
+ 		case Mesh3DEnum:         dim = 3;break;
++		case Mesh3DtetrasEnum:   dim = 3;break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+@@ -3033,6 +3059,7 @@
+ 	switch(meshtype){
+ 		case Mesh2DverticalEnum: dim = 2;break;
+ 		case Mesh3DEnum:         dim = 3;break;
++		case Mesh3DtetrasEnum:   dim = 3;break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+@@ -3091,8 +3118,9 @@
+ 
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+ 	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+-		case Mesh2DverticalEnum: dim = 2; break;
++		case Mesh3DtetrasEnum:   dim = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+@@ -3175,6 +3203,7 @@
+ 	switch(meshtype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
++		case Mesh3DtetrasEnum:   dim = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+@@ -3253,6 +3282,7 @@
+ 	switch(meshtype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
++		case Mesh3DtetrasEnum:   dim = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+@@ -3329,6 +3359,7 @@
+ 	switch(meshtype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
++		case Mesh3DtetrasEnum:   dim = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+@@ -3681,6 +3712,7 @@
+ 	switch(meshtype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
++		case Mesh3DtetrasEnum:   dim = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+@@ -3748,6 +3780,7 @@
+ 	switch(meshtype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
++		case Mesh3DtetrasEnum:   dim = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17471)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17472)
+@@ -214,6 +214,7 @@
+ 	Mesh2DhorizontalEnum,
+ 	Mesh2DverticalEnum,
+ 	Mesh3DEnum,
++	Mesh3DtetrasEnum,
+ 	MiscellaneousNameEnum, //FIXME: only used by qmu, should not be marshalled (already in queueing script)
+ 	MasstransportHydrostaticAdjustmentEnum,
+ 	MasstransportIsfreesurfaceEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17471)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17472)
+@@ -222,6 +222,7 @@
+ 		case Mesh2DhorizontalEnum : return "Mesh2Dhorizontal";
+ 		case Mesh2DverticalEnum : return "Mesh2Dvertical";
+ 		case Mesh3DEnum : return "Mesh3D";
++		case Mesh3DtetrasEnum : return "Mesh3Dtetras";
+ 		case MiscellaneousNameEnum : return "MiscellaneousName";
+ 		case MasstransportHydrostaticAdjustmentEnum : return "MasstransportHydrostaticAdjustment";
+ 		case MasstransportIsfreesurfaceEnum : return "MasstransportIsfreesurface";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17471)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17472)
+@@ -225,6 +225,7 @@
+ 	      else if (strcmp(name,"Mesh2Dhorizontal")==0) return Mesh2DhorizontalEnum;
+ 	      else if (strcmp(name,"Mesh2Dvertical")==0) return Mesh2DverticalEnum;
+ 	      else if (strcmp(name,"Mesh3D")==0) return Mesh3DEnum;
++	      else if (strcmp(name,"Mesh3Dtetras")==0) return Mesh3DtetrasEnum;
+ 	      else if (strcmp(name,"MiscellaneousName")==0) return MiscellaneousNameEnum;
+ 	      else if (strcmp(name,"MasstransportHydrostaticAdjustment")==0) return MasstransportHydrostaticAdjustmentEnum;
+ 	      else if (strcmp(name,"MasstransportIsfreesurface")==0) return MasstransportIsfreesurfaceEnum;
+@@ -258,11 +259,11 @@
+ 	      else if (strcmp(name,"ProfilingCurrentFlops")==0) return ProfilingCurrentFlopsEnum;
+ 	      else if (strcmp(name,"ProfilingSolutionTime")==0) return ProfilingSolutionTimeEnum;
+ 	      else if (strcmp(name,"MaxIterationConvergenceFlag")==0) return MaxIterationConvergenceFlagEnum;
+-	      else if (strcmp(name,"SteadystateMaxiter")==0) return SteadystateMaxiterEnum;
+          else stage=3;
+    }
+    if(stage==3){
+-	      if (strcmp(name,"SteadystateNumRequestedOutputs")==0) return SteadystateNumRequestedOutputsEnum;
++	      if (strcmp(name,"SteadystateMaxiter")==0) return SteadystateMaxiterEnum;
++	      else if (strcmp(name,"SteadystateNumRequestedOutputs")==0) return SteadystateNumRequestedOutputsEnum;
+ 	      else if (strcmp(name,"SteadystateReltol")==0) return SteadystateReltolEnum;
+ 	      else if (strcmp(name,"SteadystateRequestedOutputs")==0) return SteadystateRequestedOutputsEnum;
+ 	      else if (strcmp(name,"Surface")==0) return SurfaceEnum;
+@@ -381,11 +382,11 @@
+ 	      else if (strcmp(name,"Loads")==0) return LoadsEnum;
+ 	      else if (strcmp(name,"Materials")==0) return MaterialsEnum;
+ 	      else if (strcmp(name,"Nodes")==0) return NodesEnum;
+-	      else if (strcmp(name,"Contours")==0) return ContoursEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"Parameters")==0) return ParametersEnum;
++	      if (strcmp(name,"Contours")==0) return ContoursEnum;
++	      else if (strcmp(name,"Parameters")==0) return ParametersEnum;
+ 	      else if (strcmp(name,"Vertices")==0) return VerticesEnum;
+ 	      else if (strcmp(name,"Results")==0) return ResultsEnum;
+ 	      else if (strcmp(name,"GenericParam")==0) return GenericParamEnum;
+@@ -504,11 +505,11 @@
+ 	      else if (strcmp(name,"VyPicard")==0) return VyPicardEnum;
+ 	      else if (strcmp(name,"Vz")==0) return VzEnum;
+ 	      else if (strcmp(name,"VzSSA")==0) return VzSSAEnum;
+-	      else if (strcmp(name,"VzHO")==0) return VzHOEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"VzPicard")==0) return VzPicardEnum;
++	      if (strcmp(name,"VzHO")==0) return VzHOEnum;
++	      else if (strcmp(name,"VzPicard")==0) return VzPicardEnum;
+ 	      else if (strcmp(name,"VzFS")==0) return VzFSEnum;
+ 	      else if (strcmp(name,"VxMesh")==0) return VxMeshEnum;
+ 	      else if (strcmp(name,"VyMesh")==0) return VyMeshEnum;
+@@ -627,11 +628,11 @@
+ 	      else if (strcmp(name,"OutputFileName")==0) return OutputFileNameEnum;
+ 	      else if (strcmp(name,"LockFileName")==0) return LockFileNameEnum;
+ 	      else if (strcmp(name,"ToolkitsOptionsAnalyses")==0) return ToolkitsOptionsAnalysesEnum;
+-	      else if (strcmp(name,"ToolkitsOptionsStrings")==0) return ToolkitsOptionsStringsEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"QmuErrName")==0) return QmuErrNameEnum;
++	      if (strcmp(name,"ToolkitsOptionsStrings")==0) return ToolkitsOptionsStringsEnum;
++	      else if (strcmp(name,"QmuErrName")==0) return QmuErrNameEnum;
+ 	      else if (strcmp(name,"QmuInName")==0) return QmuInNameEnum;
+ 	      else if (strcmp(name,"QmuOutName")==0) return QmuOutNameEnum;
+ 	      else if (strcmp(name,"Regular")==0) return RegularEnum;
+Index: ../trunk-jpl/src/c/modules/MeshPartitionx/MeshPartitionx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/MeshPartitionx/MeshPartitionx.h	(revision 17471)
++++ ../trunk-jpl/src/c/modules/MeshPartitionx/MeshPartitionx.h	(revision 17472)
+@@ -32,31 +32,8 @@
+ 
+ 	switch(meshtype){
+ 		case Mesh2DhorizontalEnum:
+-			epart=xNew<int>(numberofelements);
+-			npart=xNew<int>(numberofnodes);
+-			index=xNew<int>(elements_width*numberofelements);
+-			for (i=0;i<numberofelements;i++){
+-				for (j=0;j<elements_width;j++){
+-					*(index+elements_width*i+j)=(*(elements+elements_width*i+j))-1; //-1 for C indexing in Metis
+-				}
+-			}
+-
+-			/*Partition using Metis:*/
+-			if (num_procs>1){
+-#ifdef _HAVE_METIS_
+-				METIS_PartMeshNodalPatch(&numberofelements,&numberofnodes, index, &etype, &numflag, &num_procs, &edgecut, epart, npart);
+-#else
+-				_error_("metis has not beed installed. Cannot run with more than 1 cpu");
+-#endif
+-			}
+-			else if (num_procs==1){
+-				/*METIS does not know how to deal with one cpu only!*/
+-				for (i=0;i<numberofelements;i++) epart[i]=0;
+-				for (i=0;i<numberofnodes;i++)    npart[i]=0;
+-			}
+-			else _error_("At least one processor is required");
+-			break;
+ 		case Mesh2DverticalEnum:
++		case Mesh3DtetrasEnum:
+ 			epart=xNew<int>(numberofelements);
+ 			npart=xNew<int>(numberofnodes);
+ 			index=xNew<int>(elements_width*numberofelements);
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp	(revision 17471)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp	(revision 17472)
+@@ -38,6 +38,7 @@
+ 	switch(iomodel->meshtype){
+ 		case Mesh2DhorizontalEnum: elementswidth=3; break;
+ 		case Mesh2DverticalEnum:   elementswidth=3; break;
++		case Mesh3DtetrasEnum:     elementswidth=4; break;
+ 		case Mesh3DEnum:           elementswidth=6; break;
+ 		default:                   _error_("mesh not supported yet");
+ 	}
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp	(revision 17471)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp	(revision 17472)
+@@ -36,6 +36,11 @@
+ 				if(iomodel->my_elements[i]) elements->AddObject(new Tria(i+1,i,i,iomodel,nummodels));
+ 			}
+ 			break;
++		case Mesh3DtetrasEnum:
++			for(i=0;i<iomodel->numberofelements;i++){
++				if(iomodel->my_elements[i]) elements->AddObject(new Tetra(i+1,i,i,iomodel,nummodels));
++			}
++			break;
+ 		case Mesh3DEnum:
+ 			iomodel->FetchData(2,MeshUpperelementsEnum,MeshLowerelementsEnum);
+ 			for(i=0;i<iomodel->numberofelements;i++){
+@@ -59,7 +64,7 @@
+ 					elements->InputDuplicate(DamageDEnum,DamageDbarEnum);
+ 					if(dakota_analysis) elements->InputDuplicate(MaterialsRheologyBbarEnum,QmuMaterialsRheologyBEnum);
+ 					break;
+-				case Mesh3DEnum:
++				case Mesh3DEnum: case Mesh3DtetrasEnum:
+ 					if(dakota_analysis) elements->InputDuplicate(MaterialsRheologyBEnum,QmuMaterialsRheologyBEnum); 
+ 					break;
+ 				default:
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp	(revision 17471)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp	(revision 17472)
+@@ -63,6 +63,12 @@
+ 			numberofvertices2d = 0;
+ 			numlayers          = 0;
+ 			break;
++		case Mesh3DtetrasEnum:
++			elements_width=4; //penta elements
++			numberofelements2d = 0;
++			numberofvertices2d = 0;
++			numlayers          = 0;
++			break;
+ 		case Mesh3DEnum:
+ 			elements_width=6; //penta elements
+ 			iomodel->FetchData(&elements2d,NULL,NULL,MeshElements2dEnum);
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17471)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17472)
+@@ -445,6 +445,8 @@
+ 					./modules/OutputDefinitionsResponsex/OutputDefinitionsResponsex.cpp\
+ 					./classes/Inputs/PentaInput.h\
+ 					./classes/Inputs/PentaInput.cpp\
++					./classes/Inputs/TetraInput.h\
++					./classes/Inputs/TetraInput.cpp\
+ 					#}}}
+ #DAKOTA sources  {{{
+ if DAKOTA
+Index: ../trunk-jpl/src/c/classes/classes.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/classes.h	(revision 17471)
++++ ../trunk-jpl/src/c/classes/classes.h	(revision 17472)
+@@ -60,6 +60,7 @@
+ #include "./Inputs/BoolInput.h"
+ #include "./Inputs/DoubleInput.h"
+ #include "./Inputs/IntInput.h"
++#include "./Inputs/TetraInput.h"
+ #include "./Inputs/PentaInput.h"
+ #include "./Inputs/TriaInput.h"
+ #include "./Inputs/SegInput.h"
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17471)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17472)
+@@ -74,11 +74,22 @@
+ 		void       GetInputValue(IssmDouble* pvalue,int enum_type);
+ 		void       GetInputValue(IssmDouble* pvalue,Gauss* gauss,int enum_type);
+ 		IssmDouble GetMaterialParameter(int enum_in);
++		void       GetNodesSidList(int* sidlist);
++		void       GetNodesLidList(int* lidlist);
+ 		void       GetPhi(IssmDouble* phi, IssmDouble*  epsilon, IssmDouble viscosity);
++		void       GetVerticesCoordinates(IssmDouble** xyz_list);
+ 		void       GetVerticesSidList(int* sidlist);
+ 		void       GetVerticesConnectivityList(int* connectivitylist);
++		void       InputChangeName(int enum_type,int enum_type_old);
++		void       InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);
++		void       InputUpdateFromConstant(IssmDouble constant, int name);
++		void       InputUpdateFromConstant(int constant, int name);
++		void       InputUpdateFromConstant(bool constant, int name);
+ 		bool	     IsInput(int name);
+ 		bool       IsFloating(); 
++		ElementVector*  NewElementVector(int approximation_enum=NoneApproximationEnum);
++		ElementMatrix*  NewElementMatrix(int approximation_enum=NoneApproximationEnum);
++		ElementMatrix*  NewElementMatrixCoupling(int number_nodes,int approximation_enum=NoneApproximationEnum);
+ 		void       ResultInterpolation(int* pinterpolation,int*nodesperelement,int output_enum);
+ 		void       ResultToVector(Vector<IssmDouble>* vector,int output_enum);
+ 		void       ResultToPatch(IssmDouble* values,int nodesperelement,int output_enum);
+@@ -160,8 +171,6 @@
+ 		virtual int    GetNumberOfNodesVelocity(void)=0;
+ 		virtual int    GetNumberOfNodesPressure(void)=0;
+ 		virtual int    GetNumberOfVertices(void)=0;
+-		virtual void   GetNodesSidList(int* sidlist)=0;
+-		virtual void   GetNodesLidList(int* sidlist)=0;
+ 
+ 		virtual int    Id()=0;
+ 		virtual int    Sid()=0;
+@@ -173,7 +182,6 @@
+ 		virtual IssmDouble GetGroundedPortion(IssmDouble* xyz_list)=0;
+ 		virtual void   GetInputValue(IssmDouble* pvalue,Node* node,int enumtype)=0;
+ 		virtual Node*  GetNode(int node_number)=0;
+-		virtual void   GetVerticesCoordinates(IssmDouble** xyz_list)=0;
+ 		virtual void   GetVerticesCoordinatesBase(IssmDouble** xyz_list)=0;
+ 		virtual void   GetVerticesCoordinatesTop(IssmDouble** xyz_list)=0;
+ 		virtual IssmDouble GetXcoord(Gauss* gauss)=0;
+@@ -183,14 +191,12 @@
+ 
+ 		virtual IssmDouble SurfaceArea(void)=0;
+ 		virtual void   InputDepthAverageAtBase(int enum_type,int average_enum_type)=0;
+-		virtual void   InputChangeName(int enum_type,int enum_type_old)=0;
+ 		virtual void   ComputeBasalStress(Vector<IssmDouble>* sigma_b)=0;
+ 		virtual void   ComputeStrainRate(Vector<IssmDouble>* eps)=0;
+ 		virtual void   ComputeStressTensor(void)=0;
+ 
+ 		virtual void   Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finite_element)=0;
+ 		virtual void   InputDuplicate(int original_enum,int new_enum)=0;
+-		virtual void   InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code)=0;
+ 		virtual void   InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solution,int inputenum)=0;
+ 		virtual void   InputUpdateFromSolutionOneDof(IssmDouble* solution,int inputenum)=0;
+ 
+@@ -205,9 +211,7 @@
+ 		virtual Gauss* NewGaussBase(int order)=0;
+ 		virtual Gauss* NewGaussLine(int vertex1,int vertex2,int order)=0;
+ 		virtual Gauss* NewGaussTop(int order)=0;
+-		virtual ElementVector*  NewElementVector(int approximation_enum=NoneApproximationEnum)=0;
+-		virtual ElementMatrix*  NewElementMatrix(int approximation_enum=NoneApproximationEnum)=0;
+-		virtual ElementMatrix*  NewElementMatrixCoupling(int number_nodes,int approximation_enum=NoneApproximationEnum)=0;
++
+ 		virtual void   InputScale(int enum_type,IssmDouble scale_factor)=0;
+ 		virtual void   GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum)=0;
+ 		virtual IssmDouble TimeAdapt()=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17471)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17472)
+@@ -25,7 +25,7 @@
+ /*Constructors/destructor/copy*/
+ /*FUNCTION Tria::Tria(int id, int sid,int index, IoModel* iomodel,int nummodels){{{*/
+ Tria::Tria(int tria_id, int tria_sid, int index, IoModel* iomodel,int nummodels)
+-	:TriaRef(nummodels),ElementHook(nummodels,index+1,3,iomodel){
++	:TriaRef(nummodels),ElementHook(nummodels,index+1,NUMVERTICES,iomodel){
+ 
+ 		/*id: */
+ 		this->id  = tria_id;
+@@ -686,16 +686,6 @@
+ 	return phi;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetVerticesCoordinates(IssmDouble** pxyz_list){{{*/
+-void Tria::GetVerticesCoordinates(IssmDouble** pxyz_list){
+-
+-	IssmDouble* xyz_list = xNew<IssmDouble>(NUMVERTICES*3);
+-	::GetVerticesCoordinates(xyz_list,this->vertices,NUMVERTICES);
+-
+-	/*Assign output pointer*/
+-	*pxyz_list = xyz_list;
+-
+-}/*}}}*/
+ /*FUNCTION Tria::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){{{*/
+ void Tria::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){
+ 
+@@ -926,30 +916,6 @@
+ 	_error_("Node provided not found among element nodes");
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetNodesSidList{{{*/
+-void Tria::GetNodesSidList(int* sidlist){
+-
+-	_assert_(sidlist);
+-	_assert_(nodes);
+-	int numnodes = this->NumberofNodes();
+-
+-	for(int i=0;i<numnodes;i++){
+-		sidlist[i]=nodes[i]->Sid();
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION Tria::GetNodesLidList{{{*/
+-void Tria::GetNodesLidList(int* lidlist){
+-
+-	_assert_(lidlist);
+-	_assert_(nodes);
+-	int numnodes = this->NumberofNodes();
+-
+-	for(int i=0;i<numnodes;i++){
+-		lidlist[i]=nodes[i]->Lid();
+-	}
+-}
+-/*}}}*/
+ /*FUNCTION Tria::GetNumberOfNodes;{{{*/
+ int Tria::GetNumberOfNodes(void){
+ 	return this->NumberofNodes();
+@@ -1085,13 +1051,6 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Tria::InputChangeName{{{*/
+-void  Tria::InputChangeName(int original_enum,int new_enum){
+-
+-	/*Call inputs method*/
+-	this->inputs->ChangeEnum(original_enum,new_enum);
+-}
+-/*}}}*/
+ /*FUNCTION Tria::InputScale{{{*/
+ void  Tria::InputScale(int enum_type,IssmDouble scale_factor){
+ 
+@@ -1105,36 +1064,6 @@
+ 	input->Scale(scale_factor);
+ }
+ /*}}}*/
+-/*FUNCTION Tria::InputUpdateFromConstant(int value, int name);{{{*/
+-void  Tria::InputUpdateFromConstant(int constant, int name){
+-
+-	/*Check that name is an element input*/
+-	if(!IsInput(name)) return;
+-
+-	/*update input*/
+-	this->inputs->AddInput(new IntInput(name,constant));
+-}
+-/*}}}*/
+-/*FUNCTION Tria::InputUpdateFromConstant(IssmDouble value, int name);{{{*/
+-void  Tria::InputUpdateFromConstant(IssmDouble constant, int name){
+-
+-	/*Check that name is an element input*/
+-	if(!IsInput(name)) return;
+-
+-	/*update input*/
+-	this->inputs->AddInput(new DoubleInput(name,constant));
+-}
+-/*}}}*/
+-/*FUNCTION Tria::InputUpdateFromConstant(bool value, int name);{{{*/
+-void  Tria::InputUpdateFromConstant(bool constant, int name){
+-
+-	/*Check that name is an element input*/
+-	if(!IsInput(name)) return;
+-
+-	/*update input*/
+-	this->inputs->AddInput(new BoolInput(name,constant));
+-}
+-/*}}}*/
+ /*FUNCTION Tria::InputUpdateFromIoModel{{{*/
+ void Tria::InputUpdateFromIoModel(int index, IoModel* iomodel){ //i is the element index
+ 
+@@ -1339,76 +1268,6 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){{{*/
+-void Tria::InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){
+-
+-	/*Intermediaries*/
+-	int    i,t;
+-	int    tria_vertex_ids[3];
+-	int    row;
+-	IssmDouble nodeinputs[3];
+-	IssmDouble time;
+-	TransientInput* transientinput=NULL;
+-
+-	/*Branch on type of vector: nodal or elementary: */
+-	if(vector_type==1){ //nodal vector
+-
+-		/*Recover vertices ids needed to initialize inputs*/
+-		for(i=0;i<3;i++){ 
+-			_assert_(iomodel->elements);
+-			tria_vertex_ids[i]=reCast<int>(iomodel->elements[3*this->sid+i]); //ids for vertices are in the elements array from Matlab
+-		}
+-
+-		/*Are we in transient or static? */
+-		if(M==iomodel->numberofvertices){
+-
+-			/*create input values: */
+-			for(i=0;i<3;i++)nodeinputs[i]=vector[tria_vertex_ids[i]-1];
+-
+-			/*create static input: */
+-			this->inputs->AddInput(new TriaInput(vector_enum,nodeinputs,P1Enum));
+-		}
+-		else if(M==iomodel->numberofvertices+1){
+-			/*create transient input: */
+-			IssmDouble* times = xNew<IssmDouble>(N);
+-			for(t=0;t<N;t++) times[t] = vector[(M-1)*N+t];
+-			transientinput=new TransientInput(vector_enum,times,N);
+-			for(t=0;t<N;t++){
+-				for(i=0;i<NUMVERTICES;i++) nodeinputs[i]=vector[N*(tria_vertex_ids[i]-1)+t];
+-				transientinput->AddTimeInput(new TriaInput(vector_enum,nodeinputs,P1Enum));
+-			}
+-			this->inputs->AddInput(transientinput);
+-			xDelete<IssmDouble>(times);
+-		}
+-		else _error_("nodal vector is either numberofvertices or numberofvertices+1 long. Field provided (" << EnumToStringx(vector_enum) << ") is " << M << " long");
+-	}
+-	else if(vector_type==2){ //element vector
+-		/*Are we in transient or static? */
+-		if(M==iomodel->numberofelements){
+-
+-			/*static mode: create an input out of the element value: */
+-
+-			if (code==5){ //boolean
+-				this->inputs->AddInput(new BoolInput(vector_enum,reCast<bool>(vector[this->sid])));
+-			}
+-			else if (code==6){ //integer
+-				this->inputs->AddInput(new IntInput(vector_enum,reCast<int>(vector[this->sid])));
+-			}
+-			else if (code==7){ //IssmDouble
+-				this->inputs->AddInput(new DoubleInput(vector_enum,vector[this->sid]));
+-			}
+-			else _error_("could not recognize nature of vector from code " << code);
+-		}
+-		else {
+-			_error_("transient element inputs not supported yet!");
+-		}
+-	}
+-	else{
+-		_error_("Cannot add input for vector type " << vector_type << " (not supported)");
+-	}
+-
+-}
+-/*}}}*/
+ /*FUNCTION Tria::IsOnBed {{{*/
+ bool Tria::IsOnBed(){
+ 
+@@ -1682,16 +1541,6 @@
+ 	return new GaussTria(indices[0],indices[1],order);
+ }
+ /*}}}*/
+-/*FUNCTION Tria::NewElementVector{{{*/
+-ElementVector* Tria::NewElementVector(int approximation_enum){
+-	return new ElementVector(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
+-}
+-/*}}}*/
+-/*FUNCTION Tria::NewElementMatrix{{{*/
+-ElementMatrix* Tria::NewElementMatrix(int approximation_enum){
+-	return new ElementMatrix(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
+-}
+-/*}}}*/
+ /*FUNCTION Tria::IsIceInElement {{{*/
+ bool   Tria::IsIceInElement(){
+ 
+@@ -2023,22 +1872,6 @@
+ 	  this->inputs->AddInput(new TriaInput(SurfaceforcingsMassBalanceEnum,&smb[0],P1Enum));
+ }
+ /*}}}*/
+-/*FUNCTION Tria::SetCurrentConfiguration {{{*/
+-void  Tria::SetCurrentConfiguration(Elements* elementsin, Loads* loadsin, Nodes* nodesin, Materials* materialsin, Parameters* parametersin){
+-
+-	/*go into parameters and get the analysis_counter: */
+-	int analysis_counter;
+-	parametersin->FindParam(&analysis_counter,AnalysisCounterEnum);
+-
+-	/*Get Element type*/
+-	this->element_type=this->element_type_list[analysis_counter];
+-
+-	/*Pick up nodes*/
+-	if(this->hnodes[analysis_counter]) this->nodes=(Node**)this->hnodes[analysis_counter]->deliverp();
+-	else this->nodes=NULL;
+-
+-}
+-/*}}}*/
+ /*FUNCTION Tria::SpawnSeg {{{*/
+ Seg*  Tria::SpawnSeg(int index1,int index2){
+ 
+@@ -2105,6 +1938,22 @@
+ 	}
+ }
+ /*}}}*/
++/*FUNCTION Tria::SetCurrentConfiguration {{{*/
++void  Tria::SetCurrentConfiguration(Elements* elementsin, Loads* loadsin, Nodes* nodesin, Materials* materialsin, Parameters* parametersin){
++
++	/*go into parameters and get the analysis_counter: */
++	int analysis_counter;
++	parametersin->FindParam(&analysis_counter,AnalysisCounterEnum);
++
++	/*Get Element type*/
++	this->element_type=this->element_type_list[analysis_counter];
++
++	/*Pick up nodes*/
++	if(this->hnodes[analysis_counter]) this->nodes=(Node**)this->hnodes[analysis_counter]->deliverp();
++	else this->nodes=NULL;
++
++}
++/*}}}*/
+ /*FUNCTION Tria::SurfaceArea {{{*/
+ IssmDouble Tria::SurfaceArea(void){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17471)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17472)
+@@ -52,9 +52,6 @@
+ 		void  InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type);
+ 		void  InputUpdateFromMatrixDakota(IssmDouble* matrix, int nows, int ncols, int name, int type);
+ 		#endif
+-		void  InputUpdateFromConstant(IssmDouble constant, int name);
+-		void  InputUpdateFromConstant(int constant, int name);
+-		void  InputUpdateFromConstant(bool constant, int name);
+ 		void  InputUpdateFromIoModel(int index, IoModel* iomodel);
+ 		/*}}}*/
+ 		/*Element virtual functions definitions: {{{*/
+@@ -78,8 +75,6 @@
+ 		void        GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating);
+ 		IssmDouble  GetGroundedPortion(IssmDouble* xyz_list);
+ 		int         GetNodeIndex(Node* node);
+-		void        GetNodesSidList(int* sidlist);
+-		void        GetNodesLidList(int* lidlist);
+ 		int         GetNumberOfNodes(void);
+ 		int         GetNumberOfNodesPressure(void);
+ 		int         GetNumberOfNodesVelocity(void);
+@@ -101,10 +96,8 @@
+ 		bool        IsIceInElement();
+ 		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
+ 		void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum);
+-		void        GetVerticesCoordinates(IssmDouble** pxyz_list);
+ 		void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list);
+ 		void        GetVerticesCoordinatesTop(IssmDouble** pxyz_list);
+-		void        InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);
+ 		void        InputDepthAverageAtBase(int enum_type,int average_enum_type);
+ 		void        InputDuplicate(int original_enum,int new_enum);
+ 		void        InputScale(int enum_type,IssmDouble scale_factor);
+@@ -214,7 +207,6 @@
+ 		void           GetInputValue(IssmDouble* pvalue,Node* node,int enumtype);
+ 		void           GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype);
+ 		Node*          GetNode(int node_number);
+-		void	         InputChangeName(int enum_type,int enum_type_old);
+ 		void	         InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type);
+ 		void	         InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solution,int enum_type){_error_("not implemented yet");};
+ 		void           JacobianDeterminant(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss);
+@@ -231,9 +223,6 @@
+ 		Gauss*         NewGaussBase(int order);
+ 		Gauss*         NewGaussLine(int vertex1,int vertex2,int order){_error_("not implemented yet");};
+ 		Gauss*         NewGaussTop(int order);
+-		ElementVector* NewElementVector(int approximation_enum);
+-		ElementMatrix* NewElementMatrix(int approximation_enum);
+-		ElementMatrix* NewElementMatrixCoupling(int number_nodes,int approximation_enum){_error_("not implemented yet");};
+ 		void           NodalFunctions(IssmDouble* basis,Gauss* gauss);
+ 		void           NodalFunctionsP1(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+ 		void           NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17471)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17472)
+@@ -27,7 +27,7 @@
+ /*FUNCTION Penta::Penta(int id, int index, IoModel* iomodel,int nummodels) {{{*/
+ Penta::Penta(int penta_id, int penta_sid, int index, IoModel* iomodel,int nummodels)
+ 	:PentaRef(nummodels)
+-	,ElementHook(nummodels,index+1,6,iomodel){
++	,ElementHook(nummodels,index+1,NUMVERTICES,iomodel){
+ 
+ 	int penta_elements_ids[2];
+ 
+@@ -842,30 +842,6 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetNodesSidList{{{*/
+-void Penta::GetNodesSidList(int* sidlist){
+-
+-	_assert_(sidlist);
+-	_assert_(nodes);
+-	int numnodes = this->NumberofNodes();
+-
+-	for(int i=0;i<numnodes;i++){
+-		sidlist[i]=nodes[i]->Sid();
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION Penta::GetNodesLidList{{{*/
+-void Penta::GetNodesLidList(int* lidlist){
+-
+-	_assert_(lidlist);
+-	_assert_(nodes);
+-	int numnodes = this->NumberofNodes();
+-
+-	for(int i=0;i<numnodes;i++){
+-		lidlist[i]=nodes[i]->Lid();
+-	}
+-}
+-/*}}}*/
+ /*FUNCTION Penta::GetNumberOfNodes;{{{*/
+ int Penta::GetNumberOfNodes(void){
+ 	return this->NumberofNodes();
+@@ -906,16 +882,6 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetVerticesCoordinates(IssmDouble** pxyz_list){{{*/
+-void Penta::GetVerticesCoordinates(IssmDouble** pxyz_list){
+-
+-	IssmDouble* xyz_list = xNew<IssmDouble>(NUMVERTICES*3);
+-	::GetVerticesCoordinates(xyz_list,this->vertices,NUMVERTICES);
+-
+-	/*Assign output pointer*/
+-	*pxyz_list = xyz_list;
+-
+-}/*}}}*/
+ /*FUNCTION Penta::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){{{*/
+ void Penta::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){
+ 
+@@ -952,7 +918,7 @@
+ 	AC[2]=xyz_list[2*3+2] - xyz_list[0*3+2];
+ 
+ 	cross(normal,AB,AC);
+-	norm=sqrt(pow(normal[0],2.0)+pow(normal[1],2.0)+pow(normal[2],2.0));
++	norm=sqrt(normal[0]*normal[0]+normal[1]*normal[1]+normal[2]*normal[2]);
+ 
+ 	for(int i=0;i<3;i++) normal[i]=normal[i]/norm;
+ }
+@@ -1207,83 +1173,6 @@
+ 	return id; 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::InputChangeName{{{*/
+-void  Penta::InputChangeName(int original_enum,int new_enum){
+-
+-	/*Call inputs method*/
+-	this->inputs->ChangeEnum(original_enum,new_enum);
+-}
+-/*}}}*/
+-/*FUNCTION Penta::InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){{{*/
+-void Penta::InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){
+-
+-	/*Intermediaries*/
+-	int             i,t;
+-	int             penta_vertex_ids[6];
+-	int             row;
+-	IssmDouble      nodeinputs[6];
+-	IssmDouble      time;
+-	TransientInput *transientinput      = NULL;
+-
+-	/*Branch on type of vector: nodal or elementary: */
+-	if(vector_type==1){ //nodal vector
+-
+-		/*Recover vertices ids needed to initialize inputs*/
+-		for(i=0;i<6;i++){ 
+-			_assert_(iomodel->elements);
+-			penta_vertex_ids[i]=iomodel->elements[6*this->sid+i]; //ids for vertices are in the elements array from Matlab
+-		}
+-
+-		/*Are we in transient or static? */
+-		if(M==iomodel->numberofvertices){
+-
+-			/*create input values: */
+-			for(i=0;i<6;i++)nodeinputs[i]=(IssmDouble)vector[penta_vertex_ids[i]-1];
+-
+-			/*create static input: */
+-			this->inputs->AddInput(new PentaInput(vector_enum,nodeinputs,P1Enum));
+-		}
+-		else if(M==iomodel->numberofvertices+1){
+-			/*create transient input: */
+-			IssmDouble* times = xNew<IssmDouble>(N);
+-			for(t=0;t<N;t++) times[t] = vector[(M-1)*N+t];
+-			transientinput=new TransientInput(vector_enum,times,N);
+-			for(t=0;t<N;t++){
+-				for(i=0;i<NUMVERTICES;i++) nodeinputs[i]=vector[N*(penta_vertex_ids[i]-1)+t];
+-				transientinput->AddTimeInput(new PentaInput(vector_enum,nodeinputs,P1Enum));
+-			}
+-			this->inputs->AddInput(transientinput);
+-			xDelete<IssmDouble>(times);
+-		}
+-		else _error_("nodal vector is either numberofvertices (" << iomodel->numberofvertices << "), or numberofvertices+1 long. Field provided is " << M << " long. Enum " << EnumToStringx(vector_enum));
+-	}
+-	else if(vector_type==2){ //element vector
+-		/*Are we in transient or static? */
+-		if(M==iomodel->numberofelements){
+-
+-			/*static mode: create an input out of the element value: */
+-
+-			if (code==5){ //boolean
+-				this->inputs->AddInput(new BoolInput(vector_enum,reCast<bool,IssmDouble>(vector[this->sid])));
+-			}
+-			else if (code==6){ //integer
+-				this->inputs->AddInput(new IntInput(vector_enum,reCast<int,IssmDouble>(vector[this->sid])));
+-			}
+-			else if (code==7){ //IssmDouble
+-				this->inputs->AddInput(new DoubleInput(vector_enum,vector[this->sid]));
+-			}
+-			else _error_("could not recognize nature of vector from code " << code);
+-		}
+-		else {
+-			_error_("transient elementary inputs not supported yet!");
+-		}
+-	}
+-	else{
+-		_error_("Cannot add input for vector type " << vector_type << " (not supported)");
+-	}
+-
+-}
+-/*}}}*/
+ /*FUNCTION Penta::InputDepthAverageAtBase{{{*/
+ void  Penta::InputDepthAverageAtBase(int enum_type,int average_enum_type){
+ 
+@@ -1451,43 +1340,15 @@
+ 	input->Scale(scale_factor);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::InputUpdateFromConstant(bool value, int name);{{{*/
+-void  Penta::InputUpdateFromConstant(bool constant, int name){
+-
+-	/*Check that name is an element input*/
+-	if (!IsInput(name)) return;
+-
+-	/*update input*/
+-	this->inputs->AddInput(new BoolInput(name,constant));
+-}
+-/*}}}*/
+-/*FUNCTION Penta::InputUpdateFromConstant(IssmDouble value, int name);{{{*/
+-void  Penta::InputUpdateFromConstant(IssmDouble constant, int name){
+-	/*Check that name is an element input*/
+-	if (!IsInput(name)) return;
+-
+-	/*update input*/
+-	this->inputs->AddInput(new DoubleInput(name,constant));
+-}
+-/*}}}*/
+-/*FUNCTION Penta::InputUpdateFromConstant(int value, int name);{{{*/
+-void  Penta::InputUpdateFromConstant(int constant, int name){
+-	/*Check that name is an element input*/
+-	if (!IsInput(name)) return;
+-
+-	/*update input*/
+-	this->inputs->AddInput(new IntInput(name,constant));
+-}
+-/*}}}*/
+ /*FUNCTION Penta::InputUpdateFromIoModel {{{*/
+ void Penta::InputUpdateFromIoModel(int index,IoModel* iomodel){ 
+ 
+ 	/*Intermediaries*/
+-	IssmInt i,j;
+-	int     penta_vertex_ids[6];
+-	IssmDouble  nodeinputs[6];
+-	IssmDouble  cmmininputs[6];
+-	IssmDouble  cmmaxinputs[6];
++	int         i,j;
++	int         penta_vertex_ids[NUMVERTICES];
++	IssmDouble  nodeinputs[NUMVERTICES];
++	IssmDouble  cmmininputs[NUMVERTICES];
++	IssmDouble  cmmaxinputs[NUMVERTICES];
+ 
+ 	IssmDouble  yts;
+ 	bool    control_analysis;
+@@ -1499,14 +1360,10 @@
+ 	if(control_analysis) iomodel->Constant(&num_control_type,InversionNumControlParametersEnum);
+ 	if(control_analysis) iomodel->Constant(&num_responses,InversionNumCostFunctionsEnum);
+ 
+-	/*Checks if debuging*/
+-	/*{{{*/
+-	_assert_(iomodel->elements);
+-	/*}}}*/
+-
+ 	/*Recover vertices ids needed to initialize inputs*/
+-	for(i=0;i<6;i++){ 
+-		penta_vertex_ids[i]=iomodel->elements[6*index+i]; //ids for vertices are in the elements array from Matlab
++	_assert_(iomodel->elements);
++	for(i=0;i<NUMVERTICES;i++){ 
++		penta_vertex_ids[i]=iomodel->elements[NUMVERTICES*index+i]; //ids for vertices are in the elements array from Matlab
+ 	}
+ 
+ 	/*Control Inputs*/
+@@ -1515,49 +1372,49 @@
+ 			switch(reCast<int,IssmDouble>(iomodel->Data(InversionControlParametersEnum)[i])){
+ 				case BalancethicknessThickeningRateEnum:
+ 					if (iomodel->Data(BalancethicknessThickeningRateEnum)){
+-						for(j=0;j<6;j++)nodeinputs[j]=iomodel->Data(BalancethicknessThickeningRateEnum)[penta_vertex_ids[j]-1]/yts;
+-						for(j=0;j<6;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
+-						for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
++						for(j=0;j<NUMVERTICES;j++)nodeinputs[j]=iomodel->Data(BalancethicknessThickeningRateEnum)[penta_vertex_ids[j]-1]/yts;
++						for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
++						for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
+ 						this->inputs->AddInput(new ControlInput(BalancethicknessThickeningRateEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+ 					}
+ 					break;
+ 				case VxEnum:
+ 					if (iomodel->Data(VxEnum)){
+-						for(j=0;j<6;j++)nodeinputs[j]=iomodel->Data(VxEnum)[penta_vertex_ids[j]-1]/yts;
+-						for(j=0;j<6;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
+-						for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
++						for(j=0;j<NUMVERTICES;j++)nodeinputs[j]=iomodel->Data(VxEnum)[penta_vertex_ids[j]-1]/yts;
++						for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
++						for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
+ 						this->inputs->AddInput(new ControlInput(VxEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+ 					}
+ 					break;
+ 				case VyEnum:
+ 					if (iomodel->Data(VyEnum)){
+-						for(j=0;j<6;j++)nodeinputs[j]=iomodel->Data(VyEnum)[penta_vertex_ids[j]-1]/yts;
+-						for(j=0;j<6;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
+-						for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
++						for(j=0;j<NUMVERTICES;j++)nodeinputs[j]=iomodel->Data(VyEnum)[penta_vertex_ids[j]-1]/yts;
++						for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
++						for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
+ 						this->inputs->AddInput(new ControlInput(VyEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+ 					}
+ 					break;
+ 				case FrictionCoefficientEnum:
+ 					if (iomodel->Data(FrictionCoefficientEnum)){
+-						for(j=0;j<6;j++)nodeinputs[j]=iomodel->Data(FrictionCoefficientEnum)[penta_vertex_ids[j]-1];
+-						for(j=0;j<6;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
+-						for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
++						for(j=0;j<NUMVERTICES;j++)nodeinputs[j]=iomodel->Data(FrictionCoefficientEnum)[penta_vertex_ids[j]-1];
++						for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
++						for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
+ 						this->inputs->AddInput(new ControlInput(FrictionCoefficientEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+ 					}
+ 					break;
+ 				case MaterialsRheologyBbarEnum:
+ 					if(iomodel->Data(MaterialsRheologyBEnum)){
+-						for(j=0;j<6;j++) nodeinputs[j]=iomodel->Data(MaterialsRheologyBEnum)[penta_vertex_ids[j]-1];
+-						for(j=0;j<6;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
+-						for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
++						for(j=0;j<NUMVERTICES;j++) nodeinputs[j]=iomodel->Data(MaterialsRheologyBEnum)[penta_vertex_ids[j]-1];
++						for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
++						for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
+ 						this->inputs->AddInput(new ControlInput(MaterialsRheologyBEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+ 					}
+ 					break;
+ 				case DamageDbarEnum:
+ 					if(iomodel->Data(DamageDEnum)){
+-						for(j=0;j<6;j++) nodeinputs[j]=iomodel->Data(DamageDEnum)[penta_vertex_ids[j]-1];
+-						for(j=0;j<6;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
+-						for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
++						for(j=0;j<NUMVERTICES;j++) nodeinputs[j]=iomodel->Data(DamageDEnum)[penta_vertex_ids[j]-1];
++						for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
++						for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
+ 						this->inputs->AddInput(new ControlInput(DamageDEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+ 					}
+ 					break;
+@@ -1578,7 +1435,7 @@
+ 		/*Create inputs and add to DataSetInput*/
+ 		DatasetInput* datasetinput=new DatasetInput(InversionCostFunctionsCoefficientsEnum);
+ 		for(i=0;i<num_responses;i++){
+-			for(j=0;j<6;j++)nodeinputs[j]=iomodel->Data(InversionCostFunctionsCoefficientsEnum)[(penta_vertex_ids[j]-1)*num_responses+i];
++			for(j=0;j<NUMVERTICES;j++)nodeinputs[j]=iomodel->Data(InversionCostFunctionsCoefficientsEnum)[(penta_vertex_ids[j]-1)*num_responses+i];
+ 			datasetinput->AddInput(new PentaInput(InversionCostFunctionsCoefficientsEnum,nodeinputs,P1Enum),reCast<int>(iomodel->Data(InversionCostFunctionsEnum)[i]));
+ 		}
+ 
+@@ -1888,21 +1745,6 @@
+ 	return new GaussPenta(3,4,5,order);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::NewElementVector{{{*/
+-ElementVector* Penta::NewElementVector(int approximation_enum){
+-	return new ElementVector(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
+-}
+-/*}}}*/
+-/*FUNCTION Penta::NewElementMatrix{{{*/
+-ElementMatrix* Penta::NewElementMatrix(int approximation_enum){
+-	return new ElementMatrix(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
+-}
+-/*}}}*/
+-/*FUNCTION Penta::NewElementMatrixCoupling{{{*/
+-ElementMatrix* Penta::NewElementMatrixCoupling(int number_nodes,int approximation_enum){
+-	return new ElementMatrix(nodes,number_nodes,this->parameters,approximation_enum);
+-}
+-/*}}}*/
+ /*FUNCTION Penta::NodalFunctions{{{*/
+ void Penta::NodalFunctions(IssmDouble* basis, Gauss* gauss){
+ 
+@@ -2211,17 +2053,17 @@
+ /*FUNCTION Penta::SetCurrentConfiguration {{{*/
+ void  Penta::SetCurrentConfiguration(Elements* elementsin, Loads* loadsin, Nodes* nodesin, Materials* materialsin, Parameters* parametersin){
+ 
+-	int analysis_counter;
+-
+ 	/*go into parameters and get the analysis_counter: */
++	int analysis_counter;
+ 	parametersin->FindParam(&analysis_counter,AnalysisCounterEnum);
+ 
+ 	/*Get Element type*/
+ 	this->element_type=this->element_type_list[analysis_counter];
+ 
+-	/*Pick up nodes */
+-	if (this->hnodes[analysis_counter]) this->nodes=(Node**)this->hnodes[analysis_counter]->deliverp();
++	/*Pick up nodes*/
++	if(this->hnodes[analysis_counter]) this->nodes=(Node**)this->hnodes[analysis_counter]->deliverp();
+ 	else this->nodes=NULL;
++
+ }
+ /*}}}*/
+ /*FUNCTION Penta::SetTemporaryElementType{{{*/
+Index: ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp	(revision 17471)
++++ ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp	(revision 17472)
+@@ -328,6 +328,26 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION TetraRef::GetJacobianDeterminantFace{{{*/
++void TetraRef::GetJacobianDeterminantFace(IssmDouble*  Jdet, IssmDouble* xyz_list,GaussTetra* gauss){
++	/*The Jacobian determinant is constant over the element, discard the gaussian points. 
++	 * J is assumed to have been allocated of size NDOF2xNDOF2.*/
++
++	IssmDouble x1=xyz_list[3*0+0];
++	IssmDouble y1=xyz_list[3*0+1];
++	IssmDouble z1=xyz_list[3*0+2];
++	IssmDouble x2=xyz_list[3*1+0];
++	IssmDouble y2=xyz_list[3*1+1];
++	IssmDouble z2=xyz_list[3*1+2];
++	IssmDouble x3=xyz_list[3*2+0];
++	IssmDouble y3=xyz_list[3*2+1];
++	IssmDouble z3=xyz_list[3*2+2];
++
++	/*Jdet = norm( AB ^ AC ) / (2 * area of the reference triangle), with areaRef=sqrt(3) */
++	*Jdet=SQRT3/6.*pow(pow(((y2-y1)*(z3-z1)-(z2-z1)*(y3-y1)),2)+pow(((z2-z1)*(x3-x1)-(x2-x1)*(z3-z1)),2)+pow(((x2-x1)*(y3-y1)-(y2-y1)*(x3-x1)),2),0.5);
++	if(*Jdet<0) _error_("negative jacobian determinant!");
++}
++/*}}}*/
+ /*FUNCTION TetraRef::GetJacobianInvert {{{*/
+ void TetraRef::GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,GaussTetra* gauss){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17471)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17472)
+@@ -49,9 +49,6 @@
+ 		int     Id();
+ 		/*}}}*/
+ 		/*Update virtual functions definitions: {{{*/
+-		void  InputUpdateFromConstant(bool constant, int name);
+-		void  InputUpdateFromConstant(IssmDouble constant, int name);
+-		void  InputUpdateFromConstant(int constant, int name);
+ 		void  InputUpdateFromVector(IssmDouble* vector, int name, int type);
+ 		#ifdef _HAVE_DAKOTA_
+ 		void  InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type);
+@@ -84,8 +81,6 @@
+ 		void   GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating);
+ 		IssmDouble GetGroundedPortion(IssmDouble* xyz_list);
+ 		int    GetNodeIndex(Node* node);
+-		void   GetNodesSidList(int* sidlist);
+-		void   GetNodesLidList(int* lidlist);
+ 		int    GetNumberOfNodes(void);
+ 		int    GetNumberOfNodesPressure(void);
+ 		int    GetNumberOfNodesVelocity(void);
+@@ -95,12 +90,10 @@
+ 		IssmDouble GetYcoord(Gauss* gauss);
+ 		IssmDouble GetZcoord(Gauss* gauss);
+ 		void   GetVectorFromInputs(Vector<IssmDouble>* vector,int name_enum);
+-		void   GetVerticesCoordinates(IssmDouble** pxyz_list);
+ 		void   GetVerticesCoordinatesBase(IssmDouble** pxyz_list);
+ 		void   GetVerticesCoordinatesTop(IssmDouble** pxyz_list);
+ 
+ 		int    Sid();
+-		void   InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);
+ 		void   InputDepthAverageAtBase(int enum_type,int average_enum_type);
+ 		void   InputDuplicate(int original_enum,int new_enum);
+ 		void   InputScale(int enum_type,IssmDouble scale_factor);
+@@ -203,7 +196,6 @@
+ 		int            GetElementType(void);
+ 		void           GetInputValue(IssmDouble* pvalue,Node* node,int enumtype);
+ 		Node*          GetNode(int node_number);
+-		void           InputChangeName(int input_enum, int enum_type_old);
+ 		void	         InputExtrude(int enum_type);
+ 		void           InputUpdateFromSolutionOneDof(IssmDouble* solutiong,int enum_type);
+ 		void           InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solutiong,int enum_type);
+@@ -224,9 +216,6 @@
+ 		Gauss*         NewGaussBase(int order);
+ 		Gauss*         NewGaussLine(int vertex1,int vertex2,int order);
+ 		Gauss*         NewGaussTop(int order);
+-		ElementVector* NewElementVector(int approximation_enum);
+-		ElementMatrix* NewElementMatrix(int approximation_enum);
+-		ElementMatrix* NewElementMatrixCoupling(int number_nodes,int approximation_enum);
+ 		void           NodalFunctions(IssmDouble* basis,Gauss* gauss);
+ 		void           NodalFunctionsP1(IssmDouble* basis,Gauss* gauss);
+ 		void           NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 17471)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 17472)
+@@ -20,7 +20,7 @@
+ /*Constructors/destructor/copy*/
+ /*FUNCTION Seg::Seg(int id, int sid,int index, IoModel* iomodel,int nummodels){{{*/
+ Seg::Seg(int seg_id, int seg_sid, int index, IoModel* iomodel,int nummodels)
+-		:SegRef(nummodels),ElementHook(nummodels,index+1,2,iomodel){
++		:SegRef(nummodels),ElementHook(nummodels,index+1,NUMVERTICES,iomodel){
+ 
+ 			/*id: */
+ 			this->id  = seg_id;
+@@ -262,16 +262,6 @@
+ 	return gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Seg::NewElementVector{{{*/
+-ElementVector* Seg::NewElementVector(int approximation_enum){
+-	return new ElementVector(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
+-}
+-/*}}}*/
+-/*FUNCTION Seg::NewElementMatrix{{{*/
+-ElementMatrix* Seg::NewElementMatrix(int approximation_enum){
+-	return new ElementMatrix(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
+-}
+-/*}}}*/
+ /*FUNCTION Seg::NodalFunctions{{{*/
+ void Seg::NodalFunctions(IssmDouble* basis, Gauss* gauss){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17471)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17472)
+@@ -21,7 +21,7 @@
+ /*Constructors/destructor/copy*/
+ /*FUNCTION Tetra::Tetra(int id, int sid,int index, IoModel* iomodel,int nummodels){{{*/
+ Tetra::Tetra(int seg_id, int seg_sid, int index, IoModel* iomodel,int nummodels)
+-		:TetraRef(nummodels),ElementHook(nummodels,index+1,2,iomodel){
++		:TetraRef(nummodels),ElementHook(nummodels,index+1,NUMVERTICES,iomodel){
+ 
+ 			/*id: */
+ 			this->id  = seg_id;
+@@ -126,6 +126,109 @@
+ }
+ /*}}}*/
+ 
++/*FUNCTION Tetra::AddInput{{{*/
++void  Tetra::AddInput(int input_enum,IssmDouble* values, int interpolation_enum){
++
++	/*Call inputs method*/
++	_assert_(this->inputs);
++	this->inputs->AddInput(new TetraInput(input_enum,values,interpolation_enum));
++}
++/*}}}*/
++/*FUNCTION Tetra::Configure {{{*/
++void  Tetra::Configure(Elements* elementsin, Loads* loadsin, Nodes* nodesin,Vertices* verticesin, Materials* materialsin, Parameters* parametersin){
++
++	int analysis_counter;
++
++	/*go into parameters and get the analysis_counter: */
++	parametersin->FindParam(&analysis_counter,AnalysisCounterEnum);
++
++	/*Get Element type*/
++	this->element_type=this->element_type_list[analysis_counter];
++
++	/*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 
++	 * datasets, using internal ids and offsets hidden in hooks: */
++	if (this->hnodes[analysis_counter]) this->hnodes[analysis_counter]->configure(nodesin);
++	this->hvertices->configure(verticesin);
++	this->hmaterial->configure(materialsin);
++	this->hmatpar->configure(materialsin);
++
++	/*Now, go pick up the objects inside the hooks: */
++	if (this->hnodes[analysis_counter]) this->nodes=(Node**)this->hnodes[analysis_counter]->deliverp();
++	else this->nodes=NULL;
++	this->vertices          = (Vertex**)this->hvertices->deliverp();
++	this->material          = (Material*)this->hmaterial->delivers();
++	this->matpar            = (Matpar*)this->hmatpar->delivers();
++
++	/*point parameters to real dataset: */
++	this->parameters=parametersin;
++
++	/*get inputs configured too: */
++	this->inputs->Configure(parameters);
++}
++/*}}}*/
++/*FUNCTION Tetra::FaceOnBedIndices{{{*/
++void Tetra::FaceOnBedIndices(int* pindex1,int* pindex2,int* pindex3){
++
++	IssmDouble values[NUMVERTICES];
++	int        indices[4][3] = {{0,1,2},{0,1,3},{1,2,3},{2,0,3}};
++
++	/*Retrieve all inputs and parameters*/
++	GetInputListOnVertices(&values[0],MeshVertexonbedEnum);
++
++	for(int i=0;i<4;i++){
++		if(values[indices[i][0]] == 1. && values[indices[i][1]] == 1. && values[indices[i][2]] == 1.){
++			*pindex1 = indices[i][0];
++			*pindex2 = indices[i][1];
++			*pindex3 = indices[i][2];
++			return;
++		}
++	}
++
++	_error_("Could not find 3 vertices on bed");
++}
++/*}}}*/
++/*FUNCTION Tetra::FaceOnSurfaceIndices{{{*/
++void Tetra::FaceOnSurfaceIndices(int* pindex1,int* pindex2,int* pindex3){
++
++	IssmDouble values[NUMVERTICES];
++	int        indices[4][3] = {{0,1,2},{0,1,3},{1,2,3},{2,0,3}};
++
++	/*Retrieve all inputs and parameters*/
++	GetInputListOnVertices(&values[0],MeshVertexonsurfaceEnum);
++
++	for(int i=0;i<4;i++){
++		if(values[indices[i][0]] == 1. && values[indices[i][1]] == 1. && values[indices[i][2]] == 1.){
++			*pindex1 = indices[i][0];
++			*pindex2 = indices[i][1];
++			*pindex3 = indices[i][2];
++			return;
++		}
++	}
++
++	_error_("Could not find 3 vertices on bed");
++}
++/*}}}*/
++/*FUNCTION Tetra::FaceOnFranceIndices{{{*/
++void Tetra::FaceOnFrontIndices(int* pindex1,int* pindex2,int* pindex3){
++
++	IssmDouble values[NUMVERTICES];
++	int        indices[4][3] = {{0,1,2},{0,1,3},{1,2,3},{2,0,3}};
++
++	/*Retrieve all inputs and parameters*/
++	GetInputListOnVertices(&values[0],MaskIceLevelsetEnum);
++
++	for(int i=0;i<4;i++){
++		if(values[indices[i][0]] == 0. && values[indices[i][1]] == 0. && values[indices[i][2]] == 0.){
++			*pindex1 = indices[i][0];
++			*pindex2 = indices[i][1];
++			*pindex3 = indices[i][2];
++			return;
++		}
++	}
++
++	_error_("Could not find 3 vertices on bed");
++}
++/*}}}*/
+ /*FUNCTION Tetra::GetNumberOfNodes;{{{*/
+ int Tetra::GetNumberOfNodes(void){
+ 	return this->NumberofNodes();
+@@ -136,25 +239,239 @@
+ 	return NUMVERTICES;
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::GetVerticesCoordinates(IssmDouble** pxyz_list)   THIS ONE{{{*/
+-void Tetra::GetVerticesCoordinates(IssmDouble** pxyz_list){
++/*FUNCTION Tetra::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){{{*/
++void Tetra::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){
+ 
+-	IssmDouble* xyz_list = xNew<IssmDouble>(NUMVERTICES*3);
+-	::GetVerticesCoordinates(xyz_list,this->vertices,NUMVERTICES);
++	int        indices[3];
++	IssmDouble xyz_list[NUMVERTICES][3];
+ 
++	/*Element XYZ list*/
++	::GetVerticesCoordinates(&xyz_list[0][0],this->vertices,NUMVERTICES);
++
++	/*Allocate Output*/
++	IssmDouble* xyz_list_edge = xNew<IssmDouble>(3*3);
++	this->FaceOnBedIndices(&indices[0],&indices[1],&indices[2]);
++	for(int i=0;i<3;i++) for(int j=0;j<3;j++) xyz_list_edge[i*3+j]=xyz_list[indices[i]][j];
++
+ 	/*Assign output pointer*/
+-	*pxyz_list = xyz_list;
++	*pxyz_list = xyz_list_edge;
+ 
+ }/*}}}*/
+-/*FUNCTION Tetra::IsIceInElement {{{*/
++/*FUNCTION Tetra::GetVerticesCoordinatesTop(IssmDouble** pxyz_list){{{*/
++void Tetra::GetVerticesCoordinatesTop(IssmDouble** pxyz_list){
++
++	int        indices[3];
++	IssmDouble xyz_list[NUMVERTICES][3];
++
++	/*Element XYZ list*/
++	::GetVerticesCoordinates(&xyz_list[0][0],this->vertices,NUMVERTICES);
++
++	/*Allocate Output*/
++	IssmDouble* xyz_list_edge = xNew<IssmDouble>(3*3);
++	this->FaceOnSurfaceIndices(&indices[0],&indices[1],&indices[2]);
++	for(int i=0;i<3;i++) for(int j=0;j<3;j++) xyz_list_edge[i*3+j]=xyz_list[indices[i]][j];
++
++	/*Assign output pointer*/
++	*pxyz_list = xyz_list_edge;
++
++}/*}}}*/
++/*FUNCTION Tetra::GetZcoord {{{*/
++IssmDouble Tetra::GetZcoord(Gauss* gauss){
++
++	int    i;
++	IssmDouble z;
++	IssmDouble xyz_list[NUMVERTICES][3];
++	IssmDouble z_list[NUMVERTICES];
++
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	for(i=0;i<NUMVERTICES;i++) z_list[i]=xyz_list[i][2];
++	TetraRef::GetInputValue(&z,&z_list[0],(GaussTetra*)gauss,P1Enum);
++
++	return z;
++}
++/*}}}*/
++/*FUNCTION Tetra::HasFaceOnBed{{{*/
++bool Tetra::HasFaceOnBed(){
++
++	IssmDouble values[NUMVERTICES];
++	IssmDouble sum;
++
++	/*Retrieve all inputs and parameters*/
++	GetInputListOnVertices(&values[0],MeshVertexonbedEnum);
++	sum = values[0]+values[1]+values[2]+values[3];
++
++	_assert_(sum==0. || sum==1. || sum==2. || sum==3.);
++
++	if(sum==3){
++		return true;
++	}
++	else{
++		return false;
++	}
++}
++/*}}}*/
++/*FUNCTION Tetra::HasFaceOnSurface{{{*/
++bool Tetra::HasFaceOnSurface(){
++
++	IssmDouble values[NUMVERTICES];
++	IssmDouble sum;
++
++	/*Retrieve all inputs and parameters*/
++	GetInputListOnVertices(&values[0],MeshVertexonsurfaceEnum);
++	sum = values[0]+values[1]+values[2]+values[3];
++
++	_assert_(sum==0. || sum==1. || sum==2. || sum==3.);
++
++	if(sum==3){
++		return true;
++	}
++	else{
++		return false;
++	}
++}
++/*}}}*/
++/*FUNCTION Tetra::InputUpdateFromIoModel {{{*/
++void Tetra::InputUpdateFromIoModel(int index,IoModel* iomodel){ 
++
++	/*Intermediaries*/
++	int         i,j;
++	int         tetra_vertex_ids[NUMVERTICES];
++	IssmDouble  nodeinputs[NUMVERTICES];
++	IssmDouble  cmmininputs[NUMVERTICES];
++	IssmDouble  cmmaxinputs[NUMVERTICES];
++
++	IssmDouble  yts;
++	bool    control_analysis;
++	int     num_control_type,num_responses;
++
++	/*Fetch parameters: */
++	iomodel->Constant(&yts,ConstantsYtsEnum);
++	iomodel->Constant(&control_analysis,InversionIscontrolEnum);
++	if(control_analysis) iomodel->Constant(&num_control_type,InversionNumControlParametersEnum);
++	if(control_analysis) iomodel->Constant(&num_responses,InversionNumCostFunctionsEnum);
++
++	/*Recover vertices ids needed to initialize inputs*/
++	_assert_(iomodel->elements);
++	for(i=0;i<NUMVERTICES;i++){ 
++		tetra_vertex_ids[i]=iomodel->elements[NUMVERTICES*index+i]; //ids for vertices are in the elements array from Matlab
++	}
++
++	/*Control Inputs*/
++	if (control_analysis && iomodel->Data(InversionControlParametersEnum)){
++		for(i=0;i<num_control_type;i++){
++			switch(reCast<int,IssmDouble>(iomodel->Data(InversionControlParametersEnum)[i])){
++				case BalancethicknessThickeningRateEnum:
++					if (iomodel->Data(BalancethicknessThickeningRateEnum)){
++						for(j=0;j<NUMVERTICES;j++)nodeinputs[j]=iomodel->Data(BalancethicknessThickeningRateEnum)[tetra_vertex_ids[j]-1]/yts;
++						for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tetra_vertex_ids[j]-1)*num_control_type+i]/yts;
++						for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tetra_vertex_ids[j]-1)*num_control_type+i]/yts;
++						this->inputs->AddInput(new ControlInput(BalancethicknessThickeningRateEnum,TetraInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
++					}
++					break;
++				case VxEnum:
++					if (iomodel->Data(VxEnum)){
++						for(j=0;j<NUMVERTICES;j++)nodeinputs[j]=iomodel->Data(VxEnum)[tetra_vertex_ids[j]-1]/yts;
++						for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tetra_vertex_ids[j]-1)*num_control_type+i]/yts;
++						for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tetra_vertex_ids[j]-1)*num_control_type+i]/yts;
++						this->inputs->AddInput(new ControlInput(VxEnum,TetraInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
++					}
++					break;
++				case VyEnum:
++					if (iomodel->Data(VyEnum)){
++						for(j=0;j<NUMVERTICES;j++)nodeinputs[j]=iomodel->Data(VyEnum)[tetra_vertex_ids[j]-1]/yts;
++						for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tetra_vertex_ids[j]-1)*num_control_type+i]/yts;
++						for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tetra_vertex_ids[j]-1)*num_control_type+i]/yts;
++						this->inputs->AddInput(new ControlInput(VyEnum,TetraInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
++					}
++					break;
++				case FrictionCoefficientEnum:
++					if (iomodel->Data(FrictionCoefficientEnum)){
++						for(j=0;j<NUMVERTICES;j++)nodeinputs[j]=iomodel->Data(FrictionCoefficientEnum)[tetra_vertex_ids[j]-1];
++						for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tetra_vertex_ids[j]-1)*num_control_type+i];
++						for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tetra_vertex_ids[j]-1)*num_control_type+i];
++						this->inputs->AddInput(new ControlInput(FrictionCoefficientEnum,TetraInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
++					}
++					break;
++				case MaterialsRheologyBbarEnum:
++					if(iomodel->Data(MaterialsRheologyBEnum)){
++						for(j=0;j<NUMVERTICES;j++) nodeinputs[j]=iomodel->Data(MaterialsRheologyBEnum)[tetra_vertex_ids[j]-1];
++						for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tetra_vertex_ids[j]-1)*num_control_type+i];
++						for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tetra_vertex_ids[j]-1)*num_control_type+i];
++						this->inputs->AddInput(new ControlInput(MaterialsRheologyBEnum,TetraInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
++					}
++					break;
++				case DamageDbarEnum:
++					if(iomodel->Data(DamageDEnum)){
++						for(j=0;j<NUMVERTICES;j++) nodeinputs[j]=iomodel->Data(DamageDEnum)[tetra_vertex_ids[j]-1];
++						for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tetra_vertex_ids[j]-1)*num_control_type+i];
++						for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tetra_vertex_ids[j]-1)*num_control_type+i];
++						this->inputs->AddInput(new ControlInput(DamageDEnum,TetraInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
++					}
++					break;
++				default:
++					_error_("Control " << EnumToStringx(reCast<int,IssmDouble>(iomodel->Data(InversionControlParametersEnum)[i])) << " not implemented yet");
++			}
++		}
++	}
++
++	/*Need to know the type of approximation for this element*/
++	if(iomodel->Data(FlowequationElementEquationEnum)){
++		this->inputs->AddInput(new IntInput(ApproximationEnum,reCast<int>(iomodel->Data(FlowequationElementEquationEnum)[index])));
++	}
++
++	/*DatasetInputs*/
++	if (control_analysis && iomodel->Data(InversionCostFunctionsCoefficientsEnum)) {
++
++		/*Create inputs and add to DataSetInput*/
++		DatasetInput* datasetinput=new DatasetInput(InversionCostFunctionsCoefficientsEnum);
++		for(i=0;i<num_responses;i++){
++			for(j=0;j<NUMVERTICES;j++)nodeinputs[j]=iomodel->Data(InversionCostFunctionsCoefficientsEnum)[(tetra_vertex_ids[j]-1)*num_responses+i];
++			datasetinput->AddInput(new TetraInput(InversionCostFunctionsCoefficientsEnum,nodeinputs,P1Enum),reCast<int>(iomodel->Data(InversionCostFunctionsEnum)[i]));
++		}
++
++		/*Add datasetinput to element inputs*/
++		this->inputs->AddInput(datasetinput);
++	}
++}
++/*}}}*/
++/*FUNCTION Tetra::IsIceInElement    THIS ONE{{{*/
+ bool   Tetra::IsIceInElement(){
+ 
+-	_error_("not implemented yet");
++	/*Get levelset*/
++	IssmDouble ls[NUMVERTICES];
++	GetInputListOnVertices(&ls[0],MaskIceLevelsetEnum);
++
++	/*If the level set on one of the nodes is <0, ice is present in this element*/
++	for(int i=0;i<NUMVERTICES;i++){
++		if(ls[i]<0.) return true;
++	}
++
++	return false;
+ }
+ /*}}}*/
++/*FUNCTION Tetra::IsOnBed {{{*/
++bool Tetra::IsOnBed(){
++	return HasFaceOnBed();
++}
++/*}}}*/
++/*FUNCTION Tetra::IsOnSurface {{{*/
++bool Tetra::IsOnSurface(){
++	return HasFaceOnSurface();
++}
++/*}}}*/
+ bool Tetra::IsIcefront(void){/*{{{*/
+ 
+-	_error_("not implemented yet");
++	/*Retrieve all inputs and parameters*/
++	IssmDouble ls[NUMVERTICES];
++	GetInputListOnVertices(&ls[0],MaskIceLevelsetEnum);
++
++	/* If only one vertex has ice, there is an ice front here */
++	if(IsIceInElement()){
++		int nrice=0;       
++		for(int i=0;i<NUMVERTICES;i++) if(ls[i]<0.) nrice++;
++		if(nrice==1) return true;
++	}
++	return false;
+ }/*}}}*/
+ /*FUNCTION Tetra::JacobianDeterminant{{{*/
+ void Tetra::JacobianDeterminant(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){
+@@ -167,10 +484,27 @@
+ /*FUNCTION Tetra::JacobianDeterminantSurface{{{*/
+ void Tetra::JacobianDeterminantSurface(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){
+ 
+-	_error_("not implemented yet");
++	_assert_(gauss->Enum()==GaussTetraEnum);
++	this->GetJacobianDeterminantFace(pJdet,xyz_list,(GaussTetra*)gauss);
+ 
+ }
+ /*}}}*/
++/*FUNCTION Tetra::JacobianDeterminantBase{{{*/
++void Tetra::JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussTetraEnum);
++	this->GetJacobianDeterminantFace(pJdet,xyz_list_base,(GaussTetra*)gauss);
++
++}
++/*}}}*/
++/*FUNCTION Tetra::JacobianDeterminantTop{{{*/
++void Tetra::JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussTetraEnum);
++	this->GetJacobianDeterminantFace(pJdet,xyz_list_base,(GaussTetra*)gauss);
++
++}
++/*}}}*/
+ /*FUNCTION Tetra::NewGauss(){{{*/
+ Gauss* Tetra::NewGauss(void){
+ 	return new GaussTetra();
+@@ -181,16 +515,30 @@
+ 	return new GaussTetra(order);
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::NewElementVector THIS ONE{{{*/
+-ElementVector* Tetra::NewElementVector(int approximation_enum){
+-	return new ElementVector(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
++/*FUNCTION Tetra::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){{{*/
++Gauss* Tetra::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){
++	/*FIXME: this is messed up, should provide indices and not xyz_list!*/
++	int indices[3];
++	this->FaceOnFrontIndices(&indices[0],&indices[1],&indices[2]);
++	return new GaussTetra(indices[0],indices[1],indices[2],max(order_horiz,order_vert));
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::NewElementMatrix  THIS ONE{{{*/
+-ElementMatrix* Tetra::NewElementMatrix(int approximation_enum){
+-	return new ElementMatrix(nodes,this->NumberofNodes(),this->parameters,approximation_enum);
++/*FUNCTION Tetra::NewGaussBase(int order){{{*/
++Gauss* Tetra::NewGaussBase(int order){
++
++	int indices[3];
++	this->FaceOnBedIndices(&indices[0],&indices[1],&indices[2]);
++	return new GaussTetra(indices[0],indices[1],indices[2],order);
+ }
+ /*}}}*/
++/*FUNCTION Tetra::NewGaussTop(int order){{{*/
++Gauss* Tetra::NewGaussTop(int order){
++
++	int indices[3];
++	this->FaceOnSurfaceIndices(&indices[0],&indices[1],&indices[2]);
++	return new GaussTetra(indices[0],indices[1],indices[2],order);
++}
++/*}}}*/
+ /*FUNCTION Tetra::NodalFunctions{{{*/
+ void Tetra::NodalFunctions(IssmDouble* basis, Gauss* gauss){
+ 
+@@ -208,8 +556,272 @@
+ }
+ /*}}}*/
+ /*FUNCTION Tetra::NormalSection{{{*/
+-void Tetra::NormalSection(IssmDouble* normal,IssmDouble* xyz_list_front){
++void Tetra::NormalSection(IssmDouble* normal,IssmDouble* xyz_list){
+ 
+-	_error_("Not implemented yet");
++	/*Build unit outward pointing vector*/
++	IssmDouble AB[3];
++	IssmDouble AC[3];
++	IssmDouble norm;
++
++	AB[0]=xyz_list[1*3+0] - xyz_list[0*3+0];
++	AB[1]=xyz_list[1*3+1] - xyz_list[0*3+1];
++	AB[2]=xyz_list[1*3+2] - xyz_list[0*3+2];
++	AC[0]=xyz_list[2*3+0] - xyz_list[0*3+0];
++	AC[1]=xyz_list[2*3+1] - xyz_list[0*3+1];
++	AC[2]=xyz_list[2*3+2] - xyz_list[0*3+2];
++
++	cross(normal,AB,AC);
++	norm=sqrt(normal[0]*normal[0]+normal[1]*normal[1]+normal[2]*normal[2]);
++
++	for(int i=0;i<3;i++) normal[i]=normal[i]/norm;
+ }
+ /*}}}*/
++/*FUNCTION Tetra::ReduceMatrices{{{*/
++void Tetra::ReduceMatrices(ElementMatrix* Ke,ElementVector* pe){
++
++	int analysis_type;
++	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
++
++	if(pe){
++		if(analysis_type==StressbalanceAnalysisEnum){
++			if(this->element_type==MINIcondensedEnum){
++				int approximation;
++				inputs->GetInputValue(&approximation,ApproximationEnum);
++				if(approximation==HOFSApproximationEnum || approximation==SSAFSApproximationEnum){
++					//Do nothing, condensation already done in PVectorCoupling
++				}
++				else{
++					_error_("Not implemented");
++				}
++			}
++			else if(this->element_type==P1bubblecondensedEnum){
++				_error_("Not implemented");
++			}
++		}
++	}
++
++	if(Ke){
++		if(analysis_type==StressbalanceAnalysisEnum){
++			int approximation;
++			inputs->GetInputValue(&approximation,ApproximationEnum);
++			if(approximation==HOFSApproximationEnum || approximation==SSAFSApproximationEnum){
++				//Do nothing condensatino already done for Stokes part
++			}
++			else{
++				if(this->element_type==MINIcondensedEnum){
++					_error_("Not implemented");
++				}
++				else if(this->element_type==P1bubblecondensedEnum){
++					_error_("Not implemented");
++				}
++			}
++		}
++	}
++}
++/*}}}*/
++/*FUNCTION Tetra::SetCurrentConfiguration {{{*/
++void  Tetra::SetCurrentConfiguration(Elements* elementsin, Loads* loadsin, Nodes* nodesin, Materials* materialsin, Parameters* parametersin){
++
++	/*go into parameters and get the analysis_counter: */
++	int analysis_counter;
++	parametersin->FindParam(&analysis_counter,AnalysisCounterEnum);
++
++	/*Get Element type*/
++	this->element_type=this->element_type_list[analysis_counter];
++
++	/*Pick up nodes*/
++	if(this->hnodes[analysis_counter]) this->nodes=(Node**)this->hnodes[analysis_counter]->deliverp();
++	else this->nodes=NULL;
++
++}
++/*}}}*/
++/*FUNCTION Tetra::SetwiseNodeConnectivity   THIS ONE (take from Penta.cpp){{{*/
++void Tetra::SetwiseNodeConnectivity(int* pd_nz,int* po_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum){
++
++	/*Intermediaries*/
++	const int numnodes = this->NumberofNodes();
++
++	/*Output */
++	int d_nz = 0;
++	int o_nz = 0;
++
++	/*Loop over all nodes*/
++	for(int i=0;i<numnodes;i++){
++
++		if(!flags[this->nodes[i]->Lid()]){
++
++			/*flag current node so that no other element processes it*/
++			flags[this->nodes[i]->Lid()]=true;
++
++			int counter=0;
++			while(flagsindices[counter]>=0) counter++;
++			flagsindices[counter]=this->nodes[i]->Lid();
++
++			/*if node is clone, we have an off-diagonal non-zero, else it is a diagonal non-zero*/
++			switch(set2_enum){
++				case FsetEnum:
++					if(nodes[i]->indexing.fsize){
++						if(this->nodes[i]->IsClone())
++						 o_nz += 1;
++						else
++						 d_nz += 1;
++					}
++					break;
++				case GsetEnum:
++					if(nodes[i]->indexing.gsize){
++						if(this->nodes[i]->IsClone())
++						 o_nz += 1;
++						else
++						 d_nz += 1;
++					}
++					break;
++				case SsetEnum:
++					if(nodes[i]->indexing.ssize){
++						if(this->nodes[i]->IsClone())
++						 o_nz += 1;
++						else
++						 d_nz += 1;
++					}
++					break;
++				default: _error_("not supported");
++			}
++		}
++	}
++
++	/*Assign output pointers: */
++	*pd_nz=d_nz;
++	*po_nz=o_nz;
++}
++/*}}}*/
++/*FUNCTION Tetra::Sid  THIS ONE{{{*/
++int    Tetra::Sid(){
++
++	return sid;
++
++}
++/*}}}*/
++/*FUNCTION Tetra::Update {{{*/
++void Tetra::Update(int index,IoModel* iomodel,int analysis_counter,int analysis_type,int finiteelement_type){ 
++
++	/*Intermediaries*/
++	int        i;
++	int        tetra_vertex_ids[6];
++	IssmDouble nodeinputs[6];
++	IssmDouble yts;
++	bool       dakota_analysis;
++	bool       isFS;
++	int        numnodes;
++	int*       tetra_node_ids = NULL;
++
++	/*Fetch parameters: */
++	iomodel->Constant(&yts,ConstantsYtsEnum);
++	iomodel->Constant(&dakota_analysis,QmuIsdakotaEnum);
++	iomodel->Constant(&isFS,FlowequationIsFSEnum);
++
++	/*Checks if debuging*/
++	_assert_(iomodel->elements);
++
++	/*Recover element type*/
++	this->SetElementType(finiteelement_type,analysis_counter);
++
++	/*Recover vertices ids needed to initialize inputs*/
++	for(i=0;i<6;i++) tetra_vertex_ids[i]=iomodel->elements[6*index+i]; //ids for vertices are in the elements array from Matlab
++
++	/*Recover nodes ids needed to initialize the node hook.*/
++	switch(finiteelement_type){
++		case P1Enum:
++			numnodes         = 4;
++			tetra_node_ids   = xNew<int>(numnodes);
++			tetra_node_ids[0]=iomodel->nodecounter+iomodel->elements[4*index+0];
++			tetra_node_ids[1]=iomodel->nodecounter+iomodel->elements[4*index+1];
++			tetra_node_ids[2]=iomodel->nodecounter+iomodel->elements[4*index+2];
++			tetra_node_ids[3]=iomodel->nodecounter+iomodel->elements[4*index+3];
++			break;
++		default:
++			_error_("Finite element "<<EnumToStringx(finiteelement_type)<<" not supported yet");
++	}
++
++	/*hooks: */
++	this->SetHookNodes(tetra_node_ids,numnodes,analysis_counter); this->nodes=NULL;
++	xDelete<int>(tetra_node_ids);
++
++	/*Fill with IoModel*/
++	this->InputUpdateFromIoModel(index,iomodel);
++}
++/*}}}*/
++/*FUNCTION Tetra::ZeroLevelsetCoordinates{{{*/
++void Tetra::ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){
++	/*Compute portion of the element that is grounded*/ 
++
++	IssmDouble  levelset[NUMVERTICES];
++	IssmDouble* xyz_zero = xNew<IssmDouble>(3*3);
++
++	/*Recover parameters and values*/
++	GetInputListOnVertices(&levelset[0],levelsetenum);
++
++	if(levelset[0]==0. && levelset[1]==0. && levelset[2]==0.){ 
++		xyz_zero[3*0+0]=xyz_list[0*3+0];
++		xyz_zero[3*0+1]=xyz_list[0*3+1];
++		xyz_zero[3*0+2]=xyz_list[0*3+2];
++
++		/*New point 2*/
++		xyz_zero[3*1+0]=xyz_list[1*3+0];
++		xyz_zero[3*1+1]=xyz_list[1*3+1];
++		xyz_zero[3*1+2]=xyz_list[1*3+2];
++
++		/*New point 3*/
++		xyz_zero[3*2+0]=xyz_list[2*3+0];
++		xyz_zero[3*2+1]=xyz_list[2*3+1];
++		xyz_zero[3*2+2]=xyz_list[2*3+2];
++	}
++	else if(levelset[0]==0. && levelset[1]==0. && levelset[3]==0.){ 
++		xyz_zero[3*0+0]=xyz_list[0*3+0];
++		xyz_zero[3*0+1]=xyz_list[0*3+1];
++		xyz_zero[3*0+2]=xyz_list[0*3+2];
++
++		/*New point 2*/
++		xyz_zero[3*1+0]=xyz_list[1*3+0];
++		xyz_zero[3*1+1]=xyz_list[1*3+1];
++		xyz_zero[3*1+2]=xyz_list[1*3+2];
++
++		/*New point 3*/
++		xyz_zero[3*2+0]=xyz_list[3*3+0];
++		xyz_zero[3*2+1]=xyz_list[3*3+1];
++		xyz_zero[3*2+2]=xyz_list[3*3+2];
++	}
++	else if(levelset[1]==0. && levelset[2]==0. && levelset[3]==0.){ 
++		xyz_zero[3*0+0]=xyz_list[1*3+0];
++		xyz_zero[3*0+1]=xyz_list[1*3+1];
++		xyz_zero[3*0+2]=xyz_list[1*3+2];
++
++		/*New point 2*/
++		xyz_zero[3*1+0]=xyz_list[2*3+0];
++		xyz_zero[3*1+1]=xyz_list[2*3+1];
++		xyz_zero[3*1+2]=xyz_list[2*3+2];
++
++		/*New point 3*/
++		xyz_zero[3*2+0]=xyz_list[3*3+0];
++		xyz_zero[3*2+1]=xyz_list[3*3+1];
++		xyz_zero[3*2+2]=xyz_list[3*3+2];
++	}
++	else if(levelset[2]==0. && levelset[0]==0. && levelset[3]==0.){ 
++		xyz_zero[3*0+0]=xyz_list[2*3+0];
++		xyz_zero[3*0+1]=xyz_list[2*3+1];
++		xyz_zero[3*0+2]=xyz_list[2*3+2];
++
++		/*New point 2*/
++		xyz_zero[3*1+0]=xyz_list[0*3+0];
++		xyz_zero[3*1+1]=xyz_list[0*3+1];
++		xyz_zero[3*1+2]=xyz_list[0*3+2];
++
++		/*New point 3*/
++		xyz_zero[3*2+0]=xyz_list[3*3+0];
++		xyz_zero[3*2+1]=xyz_list[3*3+1];
++		xyz_zero[3*2+2]=xyz_list[3*3+2];
++	}
++	else _error_("Case not covered");
++
++	/*Assign output pointer*/
++	*pxyz_zero= xyz_zero;
++}
++/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/TetraRef.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TetraRef.h	(revision 17471)
++++ ../trunk-jpl/src/c/classes/Elements/TetraRef.h	(revision 17472)
+@@ -24,6 +24,7 @@
+ 		void GetBprimeMasstransport(IssmDouble* Bprime, IssmDouble* xyz_list, GaussTetra* gauss);
+ 		void GetJacobian(IssmDouble* J, IssmDouble* xyz_list,GaussTetra* gauss);
+ 		void GetJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,GaussTetra* gauss);
++		void GetJacobianDeterminantFace(IssmDouble*  Jdet, IssmDouble* xyz_list,GaussTetra* gauss);
+ 		void GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,GaussTetra* gauss);
+ 		void GetNodalFunctions(IssmDouble* basis,GaussTetra* gauss);
+ 		void GetNodalFunctions(IssmDouble* basis,GaussTetra* gauss,int finiteelement);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17471)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17472)
+@@ -52,9 +52,6 @@
+ 		void  InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){_error_("not implemented yet");};
+ 		void  InputUpdateFromMatrixDakota(IssmDouble* matrix, int nows, int ncols, int name, int type){_error_("not implemented yet");};
+ #endif
+-		void  InputUpdateFromConstant(IssmDouble constant, int name){_error_("not implemented yet");};
+-		void  InputUpdateFromConstant(int constant, int name){_error_("not implemented yet");};
+-		void  InputUpdateFromConstant(bool constant, int name){_error_("not implemented yet");};
+ 		void  InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented yet");};
+ 		/*}}}*/
+ 		/*Element virtual functions definitions: {{{*/
+@@ -79,8 +76,6 @@
+ 	  	Element*    GetSurfaceElement(void){_error_("not implemented yet");};
+ 		Element*    GetBasalElement(void){_error_("not implemented yet");};
+ 		int         GetNodeIndex(Node* node){_error_("not implemented yet");};
+-		void        GetNodesSidList(int* sidlist){_error_("not implemented yet");};
+-		void        GetNodesLidList(int* lidlist){_error_("not implemented yet");};
+ 		int         GetNumberOfNodes(void);
+ 		int         GetNumberOfNodesVelocity(void){_error_("not implemented yet");};
+ 		int         GetNumberOfNodesPressure(void){_error_("not implemented yet");};
+@@ -89,7 +84,6 @@
+ 		void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list){_error_("not implemented yet");};
+ 		void        GetVerticesCoordinatesTop(IssmDouble** pxyz_list){_error_("not implemented yet");};
+ 		int         Sid(){_error_("not implemented yet");};
+-		void        InputChangeName(int input_enum, int enum_type_old){_error_("not implemented yet");};
+ 		bool        IsOnBed(){_error_("not implemented yet");};
+ 		bool        IsOnSurface(){_error_("not implemented yet");};
+ 		bool        IsNodeOnShelfFromFlags(IssmDouble* flags){_error_("not implemented yet");};
+@@ -137,9 +131,6 @@
+ 		Gauss*      NewGaussBase(int order){_error_("not implemented yet");};
+ 		Gauss*      NewGaussLine(int vertex1,int vertex2,int order){_error_("not implemented yet");};
+ 		Gauss*      NewGaussTop(int order){_error_("not implemented yet");};
+-		ElementVector* NewElementVector(int approximation_enum);
+-		ElementMatrix* NewElementMatrix(int approximation_enum);
+-		ElementMatrix* NewElementMatrixCoupling(int number_nodes,int approximation_enum){_error_("not implemented yet");};
+ 		int         VertexConnectivity(int vertexindex){_error_("not implemented yet");};
+ 		void        VerticalSegmentIndices(int** pindices,int* pnumseg){_error_("not implemented yet");};
+ 		void        ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
+@@ -151,7 +142,6 @@
+ 
+ 		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type){_error_("not implemented yet");};
+ 		void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum){_error_("not implemented yet");};
+-		void        InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){_error_("not implemented yet");};
+ 		void        InputDepthAverageAtBase(int enum_type,int average_enum_type){_error_("not implemented yet");};
+ 		void        InputDuplicate(int original_enum,int new_enum){_error_("not implemented yet");};
+ 		void        InputScale(int enum_type,IssmDouble scale_factor){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17471)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17472)
+@@ -52,52 +52,50 @@
+ 		void  InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){_error_("not implemented yet");};
+ 		void  InputUpdateFromMatrixDakota(IssmDouble* matrix, int nows, int ncols, int name, int type){_error_("not implemented yet");};
+ #endif
+-		void  InputUpdateFromConstant(IssmDouble constant, int name){_error_("not implemented yet");};
+-		void  InputUpdateFromConstant(int constant, int name){_error_("not implemented yet");};
+-		void  InputUpdateFromConstant(bool constant, int name){_error_("not implemented yet");};
+-		void  InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented yet");};
++		void  InputUpdateFromIoModel(int index, IoModel* iomodel);
+ 		/*}}}*/
+ 		/*Element virtual functions definitions: {{{*/
+ 		void        AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
+-		void        AddInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
++		void        AddInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		IssmDouble  CharacteristicLength(void){_error_("not implemented yet");};
+ 		void        ComputeBasalStress(Vector<IssmDouble>* sigma_b){_error_("not implemented yet");};
+ 		void        ComputeStrainRate(Vector<IssmDouble>* eps){_error_("not implemented yet");};
+ 		void        ComputeStressTensor(){_error_("not implemented yet");};
+-		void        Configure(Elements* elements,Loads* loads,Nodes* nodesin,Vertices* verticesin,Materials* materials,Parameters* parameters){_error_("not implemented yet");};
+-		void        SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters){_error_("not implemented yet");};
+-		void        SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum){_error_("not implemented yet");};
++		void        Configure(Elements* elements,Loads* loads,Nodes* nodesin,Vertices* verticesin,Materials* materials,Parameters* parameters);
++		void        SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters);
++		void        SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum);
+ 		void        Delta18oParameterization(void){_error_("not implemented yet");};
+ 		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){_error_("not implemented yet");};
+ 		void        ThermalToEnthalpy(IssmDouble* penthalpy,IssmDouble temperature,IssmDouble waterfraction,IssmDouble pressure){_error_("not implemented yet");};
+ 		void        EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented yet");};
+ 		IssmDouble  EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented");};
+ 		IssmDouble  EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure){_error_("not implemented");};
++		void        FaceOnFrontIndices(int* pindex1,int* pindex2,int* pindex3);
++		void        FaceOnBedIndices(int* pindex1,int* pindex2,int* pindex3);
++		void        FaceOnSurfaceIndices(int* pindex1,int* pindex2,int* pindex3);
+ 		int         FiniteElement(void);
+ 		Element*    GetUpperElement(void){_error_("not implemented yet");};
+ 	  	Element*    GetLowerElement(void){_error_("not implemented yet");};
+ 	  	Element*    GetSurfaceElement(void){_error_("not implemented yet");};
+ 		Element*    GetBasalElement(void){_error_("not implemented yet");};
+ 		int         GetNodeIndex(Node* node){_error_("not implemented yet");};
+-		void        GetNodesSidList(int* sidlist){_error_("not implemented yet");};
+-		void        GetNodesLidList(int* lidlist){_error_("not implemented yet");};
+ 		int         GetNumberOfNodes(void);
+ 		int         GetNumberOfNodesVelocity(void){_error_("not implemented yet");};
+ 		int         GetNumberOfNodesPressure(void){_error_("not implemented yet");};
+ 		int         GetNumberOfVertices(void);
+-		void        GetVerticesCoordinates(IssmDouble** pxyz_list);
+-		void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list){_error_("not implemented yet");};
+-		void        GetVerticesCoordinatesTop(IssmDouble** pxyz_list){_error_("not implemented yet");};
+-		int         Sid(){_error_("not implemented yet");};
+-		void        InputChangeName(int input_enum, int enum_type_old){_error_("not implemented yet");};
+-		bool        IsOnBed(){_error_("not implemented yet");};
+-		bool        IsOnSurface(){_error_("not implemented yet");};
++		void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list);
++		void        GetVerticesCoordinatesTop(IssmDouble** pxyz_list);
++		bool        HasFaceOnBed();
++		bool        HasFaceOnSurface();
++		int         Sid();
++		bool        IsOnBed();
++		bool        IsOnSurface();
+ 		bool        IsNodeOnShelfFromFlags(IssmDouble* flags){_error_("not implemented yet");};
+ 		void        JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss);
+ 		void        JacobianDeterminantLine(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void        JacobianDeterminantSurface(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss);
+-		void        JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
+-		void        JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){_error_("not implemented yet");};
++		void        JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss);
++		void        JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss);
+ 		IssmDouble  MinEdgeLength(IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		void        NodalFunctions(IssmDouble* basis,Gauss* gauss);
+ 		void        NodalFunctionsP1(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+@@ -127,31 +125,27 @@
+ 		Node*       GetNode(int node_number){_error_("Not implemented");};
+ 		IssmDouble  GetXcoord(Gauss* gauss){_error_("Not implemented");};
+ 		IssmDouble  GetYcoord(Gauss* gauss){_error_("Not implemented");};
+-		IssmDouble  GetZcoord(Gauss* gauss){_error_("not implemented yet");};
++		IssmDouble  GetZcoord(Gauss* gauss);
+ 		int         GetElementType(void){_error_("not implemented yet");};
+ 		Gauss*      NewGauss(void);
+ 		Gauss*      NewGauss(int order);
+       Gauss*      NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){_error_("not implemented yet");};
+-      Gauss*      NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){_error_("not implemented yet");};
++      Gauss*      NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert);
+       Gauss*      NewGauss(int point1,IssmDouble fraction1,IssmDouble fraction2,bool mainlyfloating,int order){_error_("not implemented yet");};
+-		Gauss*      NewGaussBase(int order){_error_("not implemented yet");};
++		Gauss*      NewGaussBase(int order);
+ 		Gauss*      NewGaussLine(int vertex1,int vertex2,int order){_error_("not implemented yet");};
+-		Gauss*      NewGaussTop(int order){_error_("not implemented yet");};
+-		ElementVector* NewElementVector(int approximation_enum);
+-		ElementMatrix* NewElementMatrix(int approximation_enum);
+-		ElementMatrix* NewElementMatrixCoupling(int number_nodes,int approximation_enum){_error_("not implemented yet");};
++		Gauss*      NewGaussTop(int order);
+ 		int         VertexConnectivity(int vertexindex){_error_("not implemented yet");};
+ 		void        VerticalSegmentIndices(int** pindices,int* pnumseg){_error_("not implemented yet");};
+ 		void        ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
+ 		bool        IsZeroLevelset(int levelset_enum){_error_("not implemented");};
+ 		bool		   IsIcefront(void);
+-		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented");};
++		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum);
+ 		void		   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented yet");};
+ 		void        GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
+ 
+ 		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type){_error_("not implemented yet");};
+ 		void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum){_error_("not implemented yet");};
+-		void        InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){_error_("not implemented yet");};
+ 		void        InputDepthAverageAtBase(int enum_type,int average_enum_type){_error_("not implemented yet");};
+ 		void        InputDuplicate(int original_enum,int new_enum){_error_("not implemented yet");};
+ 		void        InputScale(int enum_type,IssmDouble scale_factor){_error_("not implemented yet");};
+@@ -159,11 +153,11 @@
+ 		int         NodalValue(IssmDouble* pvalue, int index, int natureofdataenum){_error_("not implemented yet");};
+ 		void        PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm){_error_("not implemented yet");};
+ 		void        ResetFSBasalBoundaryCondition(void){_error_("not implemented yet");};
+-		void        ReduceMatrices(ElementMatrix* Ke,ElementVector* pe){_error_("not implemented yet");};
++		void        ReduceMatrices(ElementMatrix* Ke,ElementVector* pe);
+ 		void        SetTemporaryElementType(int element_type_in){_error_("not implemented yet");};
+ 		void	      SmbGradients(){_error_("not implemented yet");};
+ 		IssmDouble  SurfaceArea(void){_error_("not implemented yet");};
+-		void        Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement){_error_("not implemented yet");};
++		void        Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement);
+ 		IssmDouble  TimeAdapt(){_error_("not implemented yet");};
+ 		void UpdateConstraintsExtrudeFromBase(){_error_("not implemented");};
+ 		void UpdateConstraintsExtrudeFromTop(){_error_("not implemented");};
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17471)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17472)
+@@ -428,6 +428,35 @@
+ 	input->GetInputValue(pvalue,gauss);
+ 
+ }/*}}}*/
++void Element::GetNodesSidList(int* sidlist){/*{{{*/
++
++	_assert_(sidlist);
++	_assert_(nodes);
++	int numnodes = this->GetNumberOfNodes();
++	for(int i=0;i<numnodes;i++){
++		sidlist[i]=nodes[i]->Sid();
++	}
++}
++/*}}}*/
++void Element::GetNodesLidList(int* lidlist){/*{{{*/
++
++	_assert_(lidlist);
++	_assert_(nodes);
++	int numnodes = this->GetNumberOfNodes();
++	for(int i=0;i<numnodes;i++){
++		lidlist[i]=nodes[i]->Lid();
++	}
++}
++/*}}}*/
++void Element::GetVerticesCoordinates(IssmDouble** pxyz_list){/*{{{*/
++
++	int         numvertices = this->GetNumberOfVertices();
++	IssmDouble* xyz_list    = xNew<IssmDouble>(numvertices*3);
++	::GetVerticesCoordinates(xyz_list,this->vertices,numvertices);
++
++	*pxyz_list = xyz_list;
++
++}/*}}}*/
+ void Element::GetVerticesSidList(int* sidlist){/*{{{*/
+ 
+ 	int numvertices = this->GetNumberOfVertices();
+@@ -440,6 +469,105 @@
+ 	for(int i=0;i<numvertices;i++) connectivity[i]=this->vertices[i]->Connectivity();
+ }
+ /*}}}*/
++void Element::InputChangeName(int original_enum,int new_enum){/*{{{*/
++	this->inputs->ChangeEnum(original_enum,new_enum);
++}
++/*}}}*/
++void Element::InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){/*{{{*/
++
++	/*Intermediaries*/
++	int        i,t,row;
++	IssmDouble time;
++
++	/*Branch on type of vector: nodal or elementary: */
++	if(vector_type==1){ //nodal vector
++
++		int         numvertices = this->GetNumberOfVertices();
++		int        *vertexids   = xNew<int>(numvertices);
++		IssmDouble *values      = xNew<IssmDouble>(numvertices);
++
++		/*Recover vertices ids needed to initialize inputs*/
++		_assert_(iomodel->elements);
++		for(i=0;i<numvertices;i++){ 
++			vertexids[i]=reCast<int>(iomodel->elements[numvertices*this->Sid()+i]); //ids for vertices are in the elements array from Matlab
++		}
++
++		/*Are we in transient or static? */
++		if(M==iomodel->numberofvertices){
++			for(i=0;i<numvertices;i++) values[i]=vector[vertexids[i]-1];
++			this->AddInput(vector_enum,values,P1Enum);
++		}
++		else if(M==iomodel->numberofvertices+1){
++			/*create transient input: */
++			IssmDouble* times = xNew<IssmDouble>(N);
++			for(t=0;t<N;t++) times[t] = vector[(M-1)*N+t];
++			TransientInput* transientinput=new TransientInput(vector_enum,times,N);
++			for(t=0;t<N;t++){
++				for(i=0;i<numvertices;i++) values[i]=vector[N*(vertexids[i]-1)+t];
++				switch(this->ObjectEnum()){
++					case TriaEnum:  transientinput->AddTimeInput(new TriaInput( vector_enum,values,P1Enum)); break;
++					case PentaEnum: transientinput->AddTimeInput(new PentaInput(vector_enum,values,P1Enum)); break;
++					case TetraEnum: transientinput->AddTimeInput(new TetraInput(vector_enum,values,P1Enum)); break;
++					default: _error_("Not implemented yet");
++				}
++			}
++			this->inputs->AddInput(transientinput);
++			xDelete<IssmDouble>(times);
++		}
++		else _error_("nodal vector is either numberofvertices or numberofvertices+1 long. Field provided (" << EnumToStringx(vector_enum) << ") is " << M << " long");
++
++		xDelete<IssmDouble>(values);
++		xDelete<int>(vertexids);
++	}
++	else if(vector_type==2){ //element vector
++		/*Are we in transient or static? */
++		if(M==iomodel->numberofelements){
++			if (code==5){ //boolean
++				this->inputs->AddInput(new BoolInput(vector_enum,reCast<bool>(vector[this->Sid()])));
++			}
++			else if (code==6){ //integer
++				this->inputs->AddInput(new IntInput(vector_enum,reCast<int>(vector[this->Sid()])));
++			}
++			else if (code==7){ //IssmDouble
++				this->inputs->AddInput(new DoubleInput(vector_enum,vector[this->Sid()]));
++			}
++			else _error_("could not recognize nature of vector from code " << code);
++		}
++		else {
++			_error_("transient element inputs not supported yet!");
++		}
++	}
++	else{
++		_error_("Cannot add input for vector type " << vector_type << " (not supported)");
++	}
++}/*}}}*/
++void Element::InputUpdateFromConstant(int constant, int name){/*{{{*/
++
++	/*Check that name is an element input*/
++	if(!IsInput(name)) return;
++
++	/*update input*/
++	this->inputs->AddInput(new IntInput(name,constant));
++}
++/*}}}*/
++void Element::InputUpdateFromConstant(IssmDouble constant, int name){/*{{{*/
++
++	/*Check that name is an element input*/
++	if(!IsInput(name)) return;
++
++	/*update input*/
++	this->inputs->AddInput(new DoubleInput(name,constant));
++}
++/*}}}*/
++void Element::InputUpdateFromConstant(bool constant, int name){/*{{{*/
++
++	/*Check that name is an element input*/
++	if(!IsInput(name)) return;
++
++	/*update input*/
++	this->inputs->AddInput(new BoolInput(name,constant));
++}
++/*}}}*/
+ bool Element::IsFloating(){/*{{{*/
+ 
+ 	bool shelf;
+@@ -534,6 +662,18 @@
+ 	else return false;
+ }
+ /*}}}*/
++ElementVector* Element::NewElementVector(int approximation_enum){/*{{{*/
++	return new ElementVector(nodes,this->GetNumberOfNodes(),this->parameters,approximation_enum);
++}
++/*}}}*/
++ElementMatrix* Element::NewElementMatrix(int approximation_enum){/*{{{*/
++	return new ElementMatrix(nodes,this->GetNumberOfNodes(),this->parameters,approximation_enum);
++}
++/*}}}*/
++ElementMatrix* Element::NewElementMatrixCoupling(int number_nodes,int approximation_enum){/*{{{*/
++	return new ElementMatrix(nodes,number_nodes,this->parameters,approximation_enum);
++}
++/*}}}*/
+ void Element::ResultInterpolation(int* pinterpolation,int* pnodesperelement,int output_enum){/*{{{*/
+ 
+ 	Input* input=this->inputs->GetInput(output_enum);
+Index: ../trunk-jpl/src/c/classes/gauss/GaussTetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussTetra.cpp	(revision 17471)
++++ ../trunk-jpl/src/c/classes/gauss/GaussTetra.cpp	(revision 17472)
+@@ -2,6 +2,7 @@
+  * \brief: implementation of the GaussTetra object
+  */
+ 
++#include <math.h>
+ #include "./GaussTetra.h"
+ #include "../../shared/io/Print/Print.h"
+ #include "../../shared/Exceptions/exceptions.h"
+@@ -31,9 +32,46 @@
+ /*}}}*/
+ /*FUNCTION GaussTetra::GaussTetra(int order) {{{*/
+ GaussTetra::GaussTetra(int order){
+-	_error_("not implemented yet");
++	/*Get gauss points*/
++	GaussLegendreTetra(&numgauss,&coords1,&coords2,&coords3,&coords4,&weights,order);
++	for(int i=0;i<numgauss;i++) this->weights[i]=this->weights[i]*sqrt(2.)/6.; //FIXME: double check that
++
++	/*Initialize static fields as undefinite*/
++	weight=UNDEF;
++	coord1=UNDEF;
++	coord2=UNDEF;
++	coord3=UNDEF;
+ }
+ /*}}}*/
++/*FUNCTION GaussTetra::GaussTetra(int index1,int index2,int index3,int order) {{{*/
++GaussTetra::GaussTetra(int index1,int index2,int index3,int order){
++
++	/*Basal Tria*/
++	if(index1==0 && index2==1 && index3==2){
++		GaussLegendreTria(&numgauss,&coords1,&coords2,&coords3,&weights,order);
++		coords4=xNew<IssmDouble>(numgauss);
++		for(int i=0;i<numgauss;i++) coords4[i]=0.;
++	}
++	else if(index1==0 && index2==1 && index3==3){
++		GaussLegendreTria(&numgauss,&coords1,&coords2,&coords4,&weights,order);
++		coords3=xNew<IssmDouble>(numgauss);
++		for(int i=0;i<numgauss;i++) coords3[i]=0.;
++	}
++	else if(index1==1 && index2==2 && index3==3){
++		GaussLegendreTria(&numgauss,&coords2,&coords3,&coords4,&weights,order);
++		coords1=xNew<IssmDouble>(numgauss);
++		for(int i=0;i<numgauss;i++) coords1[i]=0.;
++	}
++	else if(index1==2 && index2==0 && index3==3){
++		GaussLegendreTria(&numgauss,&coords1,&coords3,&coords4,&weights,order);
++		coords2=xNew<IssmDouble>(numgauss);
++		for(int i=0;i<numgauss;i++) coords2[i]=0.;
++	}
++	else{
++		_error_(index1 <<" "<<index2 <<" "<<index3 <<" Not supported yet");
++	}
++}
++/*}}}*/
+ /*FUNCTION GaussTetra::~GaussTetra(){{{*/
+ GaussTetra::~GaussTetra(){
+ 	xDelete<IssmDouble>(weights);
+@@ -118,7 +156,11 @@
+ 
+ 	/*update static arrays*/
+ 	switch(iv){
+-		default: _error_("vertex index should be in [0 5]");
++		case 0: coord1=1.; coord2=0.; coord3=0.; coord4=0.; break;
++		case 1: coord1=0.; coord2=1.; coord3=0.; coord4=0.; break;
++		case 2: coord1=0.; coord2=0.; coord3=1.; coord4=0.; break;
++		case 3: coord1=0.; coord2=0.; coord3=0.; coord4=1.; break;
++		default: _error_("vertex index should be in [0 3]");
+ 
+ 	}
+ 
+@@ -132,6 +174,15 @@
+ 
+ 	/*update static arrays*/
+ 	switch(finiteelement){
++		case P1Enum: case P1DGEnum:
++			switch(iv){
++				case 0: coord1=1.; coord2=0.; coord3=0.; coord4=0.; break;
++				case 1: coord1=0.; coord2=1.; coord3=0.; coord4=0.; break;
++				case 2: coord1=0.; coord2=0.; coord3=1.; coord4=0.; break;
++				case 3: coord1=0.; coord2=0.; coord3=0.; coord4=1.; break;
++				default: _error_("node index should be in [0 3]");
++			}
++			break;
+ 		default: _error_("Finite element "<<EnumToStringx(finiteelement)<<" not supported");
+ 	}
+ 
+Index: ../trunk-jpl/src/c/classes/gauss/GaussTetra.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussTetra.h	(revision 17471)
++++ ../trunk-jpl/src/c/classes/gauss/GaussTetra.h	(revision 17472)
+@@ -30,6 +30,7 @@
+ 		/*GaussTetra constructors, destructors*/
+ 		GaussTetra();
+ 		GaussTetra(int order);
++		GaussTetra(int index1,int index2,int index3,int order);
+ 		~GaussTetra();
+ 
+ 		/*Methods*/
+Index: ../trunk-jpl/src/c/classes/Inputs/TetraInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TetraInput.cpp	(revision 0)
++++ ../trunk-jpl/src/c/classes/Inputs/TetraInput.cpp	(revision 17472)
+@@ -0,0 +1,419 @@
++/*!\file TetraInput.c
++ * \brief: implementation of the TetraInput object
++ */
++
++#ifdef HAVE_CONFIG_H
++	#include <config.h>
++#else
++#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
++#endif
++
++#include "../classes.h"
++#include "../../shared/shared.h"
++
++/*TetraInput constructors and destructor*/
++/*FUNCTION TetraInput::TetraInput(){{{*/
++TetraInput::TetraInput(){
++	values = NULL;
++}
++/*}}}*/
++/*FUNCTION TetraInput::TetraInput(int in_enum_type,IssmDouble* invalues,element_type_in){{{*/
++TetraInput::TetraInput(int in_enum_type,IssmDouble* in_values,int element_type_in)
++	:TetraRef(1)
++{
++
++	/*Set TetraRef*/
++	this->SetElementType(element_type_in,0);
++	this->element_type=element_type_in;
++
++	/*Set Enum*/
++	enum_type=in_enum_type;
++
++	/*Set values*/
++	this->values=xNew<IssmDouble>(this->NumberofNodes());
++	for(int i=0;i<this->NumberofNodes();i++) values[i]=in_values[i];
++}
++/*}}}*/
++/*FUNCTION TetraInput::~TetraInput(){{{*/
++TetraInput::~TetraInput(){
++	xDelete<IssmDouble>(this->values);
++}
++/*}}}*/
++
++/*Object virtual functions definitions:*/
++/*FUNCTION TetraInput::Echo {{{*/
++void TetraInput::Echo(void){
++	this->DeepEcho();
++}
++/*}}}*/
++/*FUNCTION TetraInput::DeepEcho{{{*/
++void TetraInput::DeepEcho(void){
++
++	_printf_(setw(15)<<"   TetraInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" [");
++	for(int i=0;i<this->NumberofNodes();i++) _printf_(" "<<this->values[i]);
++	_printf_("] ("<<EnumToStringx(this->element_type)<<")\n");
++}
++/*}}}*/
++/*FUNCTION TetraInput::Id{{{*/
++int    TetraInput::Id(void){ return -1; }
++/*}}}*/
++/*FUNCTION TetraInput::ObjectEnum{{{*/
++int TetraInput::ObjectEnum(void){
++
++	return TetraInputEnum;
++
++}
++/*}}}*/
++/*FUNCTION TetraInput::copy{{{*/
++Object* TetraInput::copy() {
++
++	return new TetraInput(this->enum_type,this->values,this->element_type);
++
++}
++/*}}}*/
++
++/*TetraInput management*/
++/*FUNCTION TetraInput::InstanceEnum{{{*/
++int TetraInput::InstanceEnum(void){
++
++	return this->enum_type;
++
++}
++/*}}}*/
++/*FUNCTION TetraInput::GetResultInterpolation{{{*/
++int  TetraInput::GetResultInterpolation(void){
++
++	return P1Enum;
++
++}
++/*}}}*/
++/*FUNCTION TetraInput::GetResultNumberOfNodes{{{*/
++int  TetraInput::GetResultNumberOfNodes(void){
++
++	return this->NumberofNodes();
++
++}
++/*}}}*/
++/*FUNCTION TetraInput::ResultToPatch{{{*/
++void TetraInput::ResultToPatch(IssmDouble* values,int nodesperelement,int sid){
++
++	int numnodes = this->NumberofNodes();
++
++	/*Some checks*/
++	_assert_(values);
++	_assert_(numnodes==nodesperelement);
++
++	/*Fill in arrays*/
++	for(int i=0;i<numnodes;i++) values[sid*numnodes + i] = this->values[i];
++}
++/*}}}*/
++
++/*Object functions*/
++/*FUNCTION TetraInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){{{*/
++void TetraInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){
++
++	/*Call TetraRef function*/
++	_assert_(gauss->Enum()==GaussTetraEnum);
++	TetraRef::GetInputValue(pvalue,&values[0],(GaussTetra*)gauss);
++
++}
++/*}}}*/
++/*FUNCTION TetraInput::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, Gauss* gauss){{{*/
++void TetraInput::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, Gauss* gauss){
++
++	/*Call TetraRef function*/
++	_assert_(gauss->Enum()==GaussTetraEnum);
++	TetraRef::GetInputDerivativeValue(p,&values[0],xyz_list,(GaussTetra*)gauss);
++}
++/*}}}*/
++/*FUNCTION TetraInput::ChangeEnum{{{*/
++void TetraInput::ChangeEnum(int newenumtype){
++	this->enum_type=newenumtype;
++}
++/*}}}*/
++/*FUNCTION TetraInput::GetInputAverage{{{*/
++void TetraInput::GetInputAverage(IssmDouble* pvalue){
++
++	int        numnodes  = this->NumberofNodes();
++	IssmDouble numnodesd = reCast<int,IssmDouble>(numnodes);
++	IssmDouble value     = 0.;
++
++	for(int i=0;i<numnodes;i++) value+=values[i];
++	value = value/numnodesd;
++
++	*pvalue=value;
++}
++/*}}}*/
++/*FUNCTION TetraInput::GetInputAllTimeAverages{{{*/
++void TetraInput::GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){
++
++	IssmDouble* outvalues=NULL;
++	IssmDouble* times=NULL;
++	int         numtimes;
++
++	/*this is not a transient forcing, so we only have 1 value, steady state: */
++	numtimes=1;
++	outvalues=xNew<IssmDouble>(1);
++	times=xNew<IssmDouble>(1);
++
++	this->GetInputAverage(&outvalues[0]);
++	times[0]=0.; /*we don't have a time*/
++
++	*pvalues=outvalues;
++	*ptimes=times;
++	*pnumtimes=numtimes;
++}
++/*}}}*/
++/*FUNCTION TetraInput::GetInputUpToCurrentTimeAverages{{{*/
++void TetraInput::GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){
++
++	IssmDouble* outvalues=NULL;
++	IssmDouble* times=NULL;
++	int         numtimes;
++
++	/*this is not a transient forcing, so we only have 1 value, steady state: */
++	numtimes=1;
++	outvalues=xNew<IssmDouble>(1);
++	times=xNew<IssmDouble>(1);
++
++	this->GetInputAverage(&outvalues[0]);
++	times[0]=currenttime; /*we don't have a time*/
++
++	*pvalues=outvalues;
++	*ptimes=times;
++	*pnumtimes=numtimes;
++}
++/*}}}*/
++
++/*Intermediary*/
++/*FUNCTION TetraInput::SquareMin{{{*/
++void TetraInput::SquareMin(IssmDouble* psquaremin,Parameters* parameters){
++
++	int        numnodes=this->NumberofNodes();
++	IssmDouble squaremin;
++
++	/*Now, figure out minimum of valuescopy: */
++	squaremin=pow(this->values[0],2);
++	for(int i=1;i<numnodes;i++){
++		if(pow(this->values[i],2)<squaremin)squaremin=pow(this->values[i],2);
++	}
++	/*Assign output pointers:*/
++	*psquaremin=squaremin;
++}
++/*}}}*/
++/*FUNCTION TetraInput::ContrainMin{{{*/
++void TetraInput::ConstrainMin(IssmDouble minimum){
++
++	int numnodes = this->NumberofNodes();
++	for(int i=0;i<numnodes;i++) if (values[i]<minimum) values[i]=minimum;
++}
++/*}}}*/
++/*FUNCTION TetraInput::InfinityNorm{{{*/
++IssmDouble TetraInput::InfinityNorm(void){
++
++	/*Output*/
++	IssmDouble norm=0.;
++	int numnodes=this->NumberofNodes();
++
++	for(int i=0;i<numnodes;i++) if(fabs(values[i])>norm) norm=fabs(values[i]);
++	return norm;
++}
++/*}}}*/
++/*FUNCTION TetraInput::Max{{{*/
++IssmDouble TetraInput::Max(void){
++
++	int  numnodes=this->NumberofNodes();
++	IssmDouble max=values[0];
++
++	for(int i=1;i<numnodes;i++){
++		if(values[i]>max) max=values[i];
++	}
++	return max;
++}
++/*}}}*/
++/*FUNCTION TetraInput::MaxAbs{{{*/
++IssmDouble TetraInput::MaxAbs(void){
++
++	int  numnodes=this->NumberofNodes();
++	IssmDouble max=fabs(values[0]);
++
++	for(int i=1;i<numnodes;i++){
++		if(fabs(values[i])>max) max=fabs(values[i]);
++	}
++	return max;
++}
++/*}}}*/
++/*FUNCTION TetraInput::Min{{{*/
++IssmDouble TetraInput::Min(void){
++
++	const int  numnodes=this->NumberofNodes();
++	IssmDouble min=values[0];
++
++	for(int i=1;i<numnodes;i++){
++		if(values[i]<min) min=values[i];
++	}
++	return min;
++}
++/*}}}*/
++/*FUNCTION TetraInput::MinAbs{{{*/
++IssmDouble TetraInput::MinAbs(void){
++
++	const int  numnodes=this->NumberofNodes();
++	IssmDouble min=fabs(values[0]);
++
++	for(int i=1;i<numnodes;i++){
++		if(fabs(values[i])<min) min=fabs(values[i]);
++	}
++	return min;
++}
++/*}}}*/
++/*FUNCTION TetraInput::Scale{{{*/
++void TetraInput::Scale(IssmDouble scale_factor){
++
++	const int numnodes=this->NumberofNodes();
++	for(int i=0;i<numnodes;i++)values[i]=values[i]*scale_factor;
++}
++/*}}}*/
++/*FUNCTION TetraInput::Set{{{*/
++void TetraInput::Set(IssmDouble setvalue){
++
++	const int numnodes=this->NumberofNodes();
++	for(int i=0;i<numnodes;i++)values[i]=setvalue;
++}
++/*}}}*/
++/*FUNCTION TetraInput::AXPY{{{*/
++void TetraInput::AXPY(Input* xinput,IssmDouble scalar){
++
++	const int numnodes=this->NumberofNodes();
++	TetraInput*  xtriainput=NULL;
++
++	/*xinput is of the same type, so cast it: */
++	if(xinput->ObjectEnum()!=TetraInputEnum) _error_("Operation not permitted because xinput is of type " << EnumToStringx(xinput->ObjectEnum()));
++	xtriainput=(TetraInput*)xinput;
++	if(xtriainput->element_type!=this->element_type) _error_("Operation not permitted because xinput is of type " << EnumToStringx(xinput->ObjectEnum()));
++
++	/*Carry out the AXPY operation depending on type:*/
++	for(int i=0;i<numnodes;i++)this->values[i]=this->values[i]+scalar*xtriainput->values[i];
++
++}
++/*}}}*/
++/*FUNCTION TetraInput::Constrain{{{*/
++void TetraInput::Constrain(IssmDouble cm_min, IssmDouble cm_max){
++
++	int i;
++	const int numnodes=this->NumberofNodes();
++
++	if(!xIsNan<IssmDouble>(cm_min)) for(i=0;i<numnodes;i++)if (this->values[i]<cm_min)this->values[i]=cm_min;
++	if(!xIsNan<IssmDouble>(cm_max)) for(i=0;i<numnodes;i++)if (this->values[i]>cm_max)this->values[i]=cm_max;
++
++}
++/*}}}*/
++/*FUNCTION TetraInput::GetVectorFromInputs{{{*/
++void TetraInput::GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist){
++
++	const int numnodes=this->NumberofNodes();
++	vector->SetValues(numnodes,doflist,this->values,INS_VAL);
++
++} /*}}}*/
++/*FUNCTION TetraInput::PointwiseMin{{{*/
++Input* TetraInput::PointwiseMin(Input* inputB){
++
++	/*Ouput*/
++	TetraInput* outinput=NULL;
++
++	/*Intermediaries*/
++	int         i;
++	TetraInput  *xinputB   = NULL;
++	const int   numnodes  = this->NumberofNodes();
++	IssmDouble *minvalues = xNew<IssmDouble>(numnodes);
++
++	/*Check that inputB is of the same type*/
++	if(inputB->ObjectEnum()!=TetraInputEnum)       _error_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum()));
++	xinputB=(TetraInput*)inputB;
++	if(xinputB->element_type!=this->element_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->element_type));
++
++	/*Create point wise min*/
++	for(i=0;i<numnodes;i++){
++		if(this->values[i] > xinputB->values[i]) minvalues[i]=xinputB->values[i];
++		else minvalues[i]=this->values[i];
++	}
++
++	/*Create new Tetra vertex input (copy of current input)*/
++	outinput=new TetraInput(this->enum_type,&minvalues[0],this->element_type);
++
++	/*Return output pointer*/
++	xDelete<IssmDouble>(minvalues);
++	return outinput;
++
++}
++/*}}}*/
++/*FUNCTION TetraInput::PointwiseMax{{{*/
++Input* TetraInput::PointwiseMax(Input* inputB){
++
++	/*Ouput*/
++	TetraInput* outinput=NULL;
++
++	/*Intermediaries*/
++	int         i;
++	TetraInput  *xinputB   = NULL;
++	const int   numnodes  = this->NumberofNodes();
++	IssmDouble *maxvalues = xNew<IssmDouble>(numnodes);
++
++	/*Check that inputB is of the same type*/
++	if(inputB->ObjectEnum()!=TetraInputEnum) _error_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum()));
++	xinputB=(TetraInput*)inputB;
++	if(xinputB->element_type!=this->element_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->element_type));
++
++	/*Create point wise max*/
++	for(i=0;i<numnodes;i++){
++		if(this->values[i] < xinputB->values[i]) maxvalues[i]=xinputB->values[i];
++		else maxvalues[i]=this->values[i];
++	}
++
++	/*Create new Tetra vertex input (copy of current input)*/
++	outinput=new TetraInput(this->enum_type,&maxvalues[0],this->element_type);
++
++	/*Return output pointer*/
++	xDelete<IssmDouble>(maxvalues);
++	return outinput;
++
++}
++/*}}}*/
++/*FUNCTION TetraInput::PointwiseDivide{{{*/
++Input* TetraInput::PointwiseDivide(Input* inputB){
++
++	/*Ouput*/
++	TetraInput* outinput=NULL;
++
++	/*Intermediaries*/
++	TetraInput *xinputB  = NULL;
++	const int   numnodes = this->NumberofNodes();
++
++	/*Check that inputB is of the same type*/
++	if(inputB->ObjectEnum()!=TetraInputEnum)     _error_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum()));
++	xinputB=(TetraInput*)inputB;
++	if(xinputB->element_type!=this->element_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->element_type));
++
++	/*Allocate intermediary*/
++	IssmDouble* AdotBvalues=xNew<IssmDouble>(numnodes);
++
++	/*Create point wise division*/
++	for(int i=0;i<numnodes;i++){
++		_assert_(xinputB->values[i]!=0);
++		AdotBvalues[i]=this->values[i]/xinputB->values[i];
++	}
++
++	/*Create new Tetra vertex input (copy of current input)*/
++	outinput=new TetraInput(this->enum_type,AdotBvalues,this->element_type);
++
++	/*Return output pointer*/
++	xDelete<IssmDouble>(AdotBvalues);
++	return outinput;
++
++}
++/*}}}*/
++/*FUNCTION TetraInput::Configure{{{*/
++void TetraInput::Configure(Parameters* parameters){
++	/*do nothing: */
++}
++/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Inputs/TetraInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TetraInput.h	(revision 0)
++++ ../trunk-jpl/src/c/classes/Inputs/TetraInput.h	(revision 17472)
+@@ -0,0 +1,75 @@
++/*! \file TetraInput.h 
++ *  \brief: header file for TetraInput object
++ */
++
++#ifndef _TETRAINPUT_H_
++#define _TETRAINPUT_H_
++
++/*Headers:*/
++/*{{{*/
++#include "./Input.h"
++#include "../Elements/TetraRef.h"
++class Gauss;
++class Gauss;
++/*}}}*/
++
++class TetraInput: public Input,public TetraRef{
++
++	public:
++		int         enum_type;
++		IssmDouble* values;
++
++		/*TetraInput constructors, destructors*/
++		TetraInput();
++		TetraInput(int enum_type,IssmDouble* values,int element_type_in);
++		~TetraInput();
++
++		/*Object virtual functions definitions*/
++		void    Echo();
++		void    DeepEcho();
++		int     Id();
++		int     ObjectEnum();
++		Object *copy();
++
++		/*TetraInput management:*/
++		int    InstanceEnum();
++		Input* SpawnTriaInput(int location){_error_("not supported yet");};
++		Input* SpawnSegInput(int index1,int index2){_error_("not supported yet");};
++		Input* PointwiseDivide(Input* inputB);
++		Input* PointwiseMin(Input* inputB);
++		Input* PointwiseMax(Input* inputB);
++		int    GetResultInterpolation(void);
++		int    GetResultNumberOfNodes(void);
++		void   ResultToPatch(IssmDouble* values,int nodesperelement,int sid);
++		void   AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error_("not supported yet");};
++		void   Configure(Parameters* parameters);
++
++		/*numerics*/
++		void GetInputValue(bool* pvalue){_error_("not implemented yet");}
++		void GetInputValue(int* pvalue){_error_("not implemented yet");}
++		void GetInputValue(IssmDouble* pvalue){_error_("not implemented yet");}
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss);
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){_error_("not implemented yet");};
++		void GetInputValue(IssmDouble* pvalue,Gauss* gauss,int index){_error_("not implemented yet");};
++		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list,Gauss* gauss);
++		void GetInputAverage(IssmDouble* pvalue);
++		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes);
++		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime);
++		void ChangeEnum(int newenumtype);
++		void SquareMin(IssmDouble* psquaremin,Parameters* parameters);
++		void ConstrainMin(IssmDouble minimum);
++		void Set(IssmDouble setvalue);
++		void Scale(IssmDouble scale_factor);
++		void AXPY(Input* xinput,IssmDouble scalar);
++		void Constrain(IssmDouble cm_min, IssmDouble cm_max);
++		IssmDouble InfinityNorm(void);
++		IssmDouble Max(void);
++		IssmDouble MaxAbs(void);
++		IssmDouble Min(void);
++		IssmDouble MinAbs(void);
++		void Extrude(void){_error_("not supported yet");};
++		void VerticallyIntegrate(Input* thickness_input){_error_("not supported yet");};
++		void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist);
++
++};
++#endif  /* _TETRAINPUT_H */
Index: issm/oecreview/Archive/16554-17801/ISSM-17472-17473.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17472-17473.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17472-17473.diff	(revision 17802)
@@ -0,0 +1,28 @@
+Index: ../trunk-jpl/src/m/enum/Mesh3DtetrasEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/Mesh3DtetrasEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/Mesh3DtetrasEnum.m	(revision 17473)
+@@ -0,0 +1,11 @@
++function macro=Mesh3DtetrasEnum()
++%MESH3DTETRASENUM - Enum of Mesh3Dtetras
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=Mesh3DtetrasEnum()
++
++macro=StringToEnum('Mesh3Dtetras');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17472)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17473)
+@@ -214,6 +214,7 @@
+ def Mesh2DhorizontalEnum(): return StringToEnum("Mesh2Dhorizontal")[0]
+ def Mesh2DverticalEnum(): return StringToEnum("Mesh2Dvertical")[0]
+ def Mesh3DEnum(): return StringToEnum("Mesh3D")[0]
++def Mesh3DtetrasEnum(): return StringToEnum("Mesh3Dtetras")[0]
+ def MiscellaneousNameEnum(): return StringToEnum("MiscellaneousName")[0]
+ def MasstransportHydrostaticAdjustmentEnum(): return StringToEnum("MasstransportHydrostaticAdjustment")[0]
+ def MasstransportIsfreesurfaceEnum(): return StringToEnum("MasstransportIsfreesurface")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17473-17474.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17473-17474.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17473-17474.diff	(revision 17802)
@@ -0,0 +1,161 @@
+Index: ../trunk-jpl/src/m/plot/processmesh.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/processmesh.m	(revision 17473)
++++ ../trunk-jpl/src/m/plot/processmesh.m	(revision 17474)
+@@ -44,16 +44,14 @@
+ elements=md.mesh.elements;
+ 
+ %is it a 2d plot?
+-if (md.mesh.dimension==2);
++if ~strcmp(md.mesh.meshtype(),'3D');
+ 	is2d=1;
+-elseif (md.mesh.dimension==3),
++else
+ 	if getfieldvalue(options,'layer',0)>=1,
+ 		is2d=1;
+ 	else
+ 		is2d=0;
+ 	end
+-else
+-	error(['dim = ' num2str(md.mesh.dimension) ' not supported yet']);
+ end
+ 
+ %layer projection? 
+Index: ../trunk-jpl/src/m/plot/plot_mesh.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_mesh.m	(revision 17473)
++++ ../trunk-jpl/src/m/plot/plot_mesh.m	(revision 17474)
+@@ -21,14 +21,20 @@
+ 	A=elements(:,1); B=elements(:,2); C=elements(:,3); 
+ 	patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none','EdgeColor',edgecolor,'linewidth',linewidth);
+ else
+-	if ~isplanet,
++	if size(elements,2)==6, %prisms
+ 		A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6);
+ 		patch( 'Faces', [A B C],  'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none','EdgeColor',edgecolor,'linewidth',linewidth);
+ 		patch( 'Faces', [D E F],  'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none','EdgeColor',edgecolor,'linewidth',linewidth);
+ 		patch( 'Faces', [A B E D],'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none','EdgeColor',edgecolor,'linewidth',linewidth);
+ 		patch( 'Faces', [B E F C],'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none','EdgeColor',edgecolor,'linewidth',linewidth);
+ 		patch( 'Faces', [C A D F],'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none','EdgeColor',edgecolor,'linewidth',linewidth);
+-	else
++	elseif size(elements,2)==4, %tetras
++		A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4);
++		patch( 'Faces',[A B C],'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none','EdgeColor',edgecolor,'linewidth',linewidth);
++		patch( 'Faces',[A B D],'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none','EdgeColor',edgecolor,'linewidth',linewidth);
++		patch( 'Faces',[B C D],'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none','EdgeColor',edgecolor,'linewidth',linewidth);
++		patch( 'Faces',[C A D],'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none','EdgeColor',edgecolor,'linewidth',linewidth);
++	else %triangles (planet)
+ 		A=elements(:,1); B=elements(:,2); C=elements(:,3); 
+ 		if (size(elements,2)==4), D=elements(:,4); else D=C; end
+ 		patch( 'Faces', [A B C D],  'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none','EdgeColor',edgecolor,'linewidth',linewidth);
+Index: ../trunk-jpl/src/m/plot/plot_highlightelements.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_highlightelements.m	(revision 17473)
++++ ../trunk-jpl/src/m/plot/plot_highlightelements.m	(revision 17474)
+@@ -14,6 +14,7 @@
+ [elementnumbers datatype]=processdata(md,[1:md.mesh.numberofelements]',options);
+ 
+ %plot
++pos=getfieldvalue(options,'highlight',[]);
+ if is2d
+ 	%plot mesh 
+ 	A=elements(:,1); B=elements(:,2); C=elements(:,3);
+@@ -24,22 +25,37 @@
+ 	A=elements(pos,1); B=elements(pos,2); C=elements(pos,3);
+ 	patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
+ else
+-	%plot mesh 
+-	A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6);
+-	patch( 'Faces', [A B C],  'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
+-	patch( 'Faces', [D E F],  'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
+-	patch( 'Faces', [A B E D],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
+-	patch( 'Faces', [B E F C],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
+-	patch( 'Faces', [C A D F],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
++	if size(elements,2)==6, %prisms
++		%plot mesh 
++		A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6);
++		patch( 'Faces', [A B C],  'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
++		patch( 'Faces', [D E F],  'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
++		patch( 'Faces', [A B E D],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
++		patch( 'Faces', [B E F C],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
++		patch( 'Faces', [C A D F],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
+ 
+-	%Highlight
+-	pos=getfieldvalue(options,'highlight',[]);
+-	A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); D=elements(pos,4); E=elements(pos,5); F=elements(pos,6);
+-	patch( 'Faces', [A B C],  'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
+-	patch( 'Faces', [D E F],  'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
+-	patch( 'Faces', [A B E D],'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
+-	patch( 'Faces', [B E F C],'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
+-	patch( 'Faces', [C A D F],'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
++		%Highlight
++		A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); D=elements(pos,4); E=elements(pos,5); F=elements(pos,6);
++		patch( 'Faces', [A B C],  'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
++		patch( 'Faces', [D E F],  'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
++		patch( 'Faces', [A B E D],'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
++		patch( 'Faces', [B E F C],'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
++		patch( 'Faces', [C A D F],'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
++	elseif size(elements,2)==4, %tetras
++		A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4);
++		patch( 'Faces',[A B C],'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none','EdgeColor','black');
++		patch( 'Faces',[A B D],'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none','EdgeColor','black');
++		patch( 'Faces',[B C D],'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none','EdgeColor','black');
++		patch( 'Faces',[C A D],'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none','EdgeColor','black');
++		%Highlight
++		A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); D=elements(pos,4);
++		patch( 'Faces',[A B C],'Vertices', [x y z],'FaceVertexCData',[0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
++		patch( 'Faces',[A B D],'Vertices', [x y z],'FaceVertexCData',[0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
++		patch( 'Faces',[B C D],'Vertices', [x y z],'FaceVertexCData',[0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
++		patch( 'Faces',[C A D],'Vertices', [x y z],'FaceVertexCData',[0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
++	else
++		error('Not supported');
++	end
+ end
+ 
+ %apply options
+Index: ../trunk-jpl/src/m/plot/processdata.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/processdata.m	(revision 17473)
++++ ../trunk-jpl/src/m/plot/processdata.m	(revision 17474)
+@@ -55,7 +55,7 @@
+ end
+ 
+ %check length
+-if datasize(1)~=md.mesh.numberofvertices & datasize(1)~=md.mesh.numberofelements & datasize(1)~=md.mesh.numberofvertices*6 & (md.mesh.dimension==3 & ~(datasize(1)==numberofelements2d | datasize(1)==numberofvertices2d))
++if datasize(1)~=md.mesh.numberofvertices & datasize(1)~=md.mesh.numberofelements & datasize(1)~=md.mesh.numberofvertices*6 & (strcmp(md.mesh.meshtype(),'3D') & ~(datasize(1)==numberofelements2d | datasize(1)==numberofvertices2d))
+ 	error('plotmodel error message: data not supported yet');
+ end
+ 
+@@ -64,14 +64,12 @@
+ 	datatype=3;
+ 
+ 	%check number of columns, add zeros if necessary,
+-	if (md.mesh.dimension==3)
++	if (strcmp(md.mesh.meshtype(),'3D'))
+ 		if datasize(2)==2,
+ 			data=[data, zeros(datasize(1),1)];
+ 		elseif datasize(2)~=3,
+ 			error('plotmodel error message: data provided should have 2 or 3 columns for quiver plot, and 1 for regular plot');
+ 		end
+-		%elseif ((md.mesh.dimension==2) & datasize(2)~=2),
+-		%	error('plotmodel error message: data provided should have 2 columns for quiver plot, and 1 for regular plot');
+ 	end
+ end
+ 
+@@ -86,14 +84,14 @@
+ end
+ 
+ %treat the case datasize(1)=nodes2d
+-if (md.mesh.dimension==3 & datasize(1)==numberofvertices2d),
++if (strcmp(md.mesh.meshtype(),'3D') & datasize(1)==numberofvertices2d),
+ 	data=project3d(md,'vector',data,'type','node');
+ 	datasize(1)=md.mesh.numberofvertices;
+ 	%---> go to node data
+ end
+ 
+ %treat the case datasize(1)=nodes2d
+-if (md.mesh.dimension==3 & datasize(1)==numberofelements2d),
++if (strcmp(md.mesh.meshtype(),'3D') & datasize(1)==numberofelements2d),
+ 	data=project3d(md,'vector',data,'type','element');
+ 	datasize(1)=md.mesh.numberofelements;
+ 	%---> go to node data
Index: issm/oecreview/Archive/16554-17801/ISSM-17474-17475.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17474-17475.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17474-17475.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.m
+===================================================================
+--- ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.m	(revision 17474)
++++ ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.m	(revision 17475)
+@@ -51,7 +51,7 @@
+ md.mask.ice_levelset(find(vertexonicefront))=0;
+ 
+ %First find segments that are not completely on the front
+-if(md.mesh.dimension==2),
++if ~strcmp(md.mesh.meshtype(),'3D'),
+ 	numbernodesfront=2;
+ else 
+ 	numbernodesfront=4;
+Index: ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py
+===================================================================
+--- ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py	(revision 17474)
++++ ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py	(revision 17475)
+@@ -51,7 +51,7 @@
+ 	md.mask.ice_levelset[pos]=0
+ 
+ 	#First find segments that are not completely on the front
+-	if md.mesh.dimension==2:
++	if not strcmp(md.mesh.meshtype(),'3D')
+ 		numbernodesfront=2
+ 	else:
+ 		numbernodesfront=4
Index: issm/oecreview/Archive/16554-17801/ISSM-17475-17476.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17475-17476.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17475-17476.diff	(revision 17802)
@@ -0,0 +1,160 @@
+Index: ../trunk-jpl/src/m/mesh/planet/planetmesher.m
+===================================================================
+--- ../trunk-jpl/src/m/mesh/planet/planetmesher.m	(revision 17475)
++++ ../trunk-jpl/src/m/mesh/planet/planetmesher.m	(revision 17476)
+@@ -1,35 +0,0 @@
+-function md=planetmesher(md,varargin)
+-%PLANETMESHER - create planet mesh using several packages
+-%
+-%   This routine creates a planet mesh using several packages: a custom made 
+-%   ISSM mesher (called planetmixedmesh.m, method 'mixed') and the planettrimesh
+-%   (method 'tria')
+-%   where md is a @planet object, varargin is a list of options
+-%
+-% Usage: md=planetmesher(md,'method','mixed','radius',6378000,'angleresol',1);
+-%        md=planetmesher(md,'method','tria','shape','iso','radius',6378000,'refinement',5);
+-%
+-%
+-
+-	%recover options
+-	options=pairoptions(varargin{:});
+-
+-	method=getfieldvalue(options,'method','mixed');
+-
+-	if strcmpi(method,'mixed'),
+-		%recover radius and angleresol: 
+-		radius=getfieldvalue(options,'radius',6378000); %earth radius as default
+-		angleresol=getfieldvalue(options,'angleresol',10); %10 degree resolution
+-
+-		%call mixed mesh 
+-		md=planetmixedmesh(md,radius,angleresol);
+-	else
+-		%recover radius, shape and level of refinmenet
+-		radius=getfieldvalue(options,'radius',6378000); %earth radius as default
+-		refinement=getfieldvalue(options,'refinement',5); %refine 5 times
+-		shape=getfieldvalue(options,'shape','ico'); 
+-
+-		%call triangular mesh
+-		md=planettrimesh(md,shape,radius,refinement);
+-	end
+-end
+Index: ../trunk-jpl/src/m/mesh/planet/planetmixedmesh.m
+===================================================================
+--- ../trunk-jpl/src/m/mesh/planet/planetmixedmesh.m	(revision 17475)
++++ ../trunk-jpl/src/m/mesh/planet/planetmixedmesh.m	(revision 17476)
+@@ -1,97 +0,0 @@
+-function md=planetmixedmesh(md,radius,angleresol)
+-%PLANETMIXEDMESH: build 2d shell mesh
+-%
+-% Usage: md=planetmixedshell(md,radius,angleresol)
+-%
+-
+-conv=pi/180;
+-
+-r=radius;
+-theta=(0:angleresol:360)';
+-theta=theta*conv;
+-phi=(0:angleresol:180)';
+-phi=phi(2:end-1)*conv;
+-
+-nphi=length(phi);
+-nthetha=length(theta);
+-
+-x=zeros(nphi*nthetha,1);
+-y=zeros(nphi*nthetha,1);
+-z=zeros(nphi*nthetha,1);
+-
+-for i=1:nphi,
+-	phii=phi(i);
+-	x((i-1)*nthetha+1:i*nthetha)=r.*cos(theta).*sin(phii);
+-	y((i-1)*nthetha+1:i*nthetha)=r.*sin(theta).*sin(phii);
+-	z((i-1)*nthetha+1:i*nthetha)=r.*cos(phii);
+-end
+-
+-quads=zeros((nthetha-1)*(nphi-1),4);
+-
+-%build elements
+-for i=1:nphi-1,
+-	for j=1:nthetha-1,
+-		count=(i-1)*(nthetha-1)+j;
+-
+-		A=(i-1)*nthetha+j;
+-		B=(i-1)*nthetha+j+1;
+-		C=(i)*nthetha+j+1;
+-		D=(i)*nthetha+j;
+-
+-		quads(count,:)=[A B C D];
+-	end
+-end
+-
+-%now, add polar elements:
+-%first north: phi = 0;
+-x=[r.*cos(0).*sin(0);x];
+-y=[r.*sin(0).*sin(0);y];
+-z=[r.*cos(0);z];
+-
+-%add 1 to quads: 
+-quads=quads+1;
+-
+-%add tria elements:
+-trias=zeros(nthetha-1,4);
+-
+-for i=1:nthetha-1,
+-	A=1;
+-	B=i+1;
+-	C=i+2;
+-	trias(i,:)=[A B C NaN];
+-end
+-
+-quads=[trias;quads];
+-
+-% now add south pole: 
+-phii=180*conv;
+-x=[x;r.*cos(phii).*sin(phii)];
+-y=[y;r.*sin(phii).*sin(phii)];
+-z=[z;r.*cos(phii)];
+-nods=length(x);
+-
+-%add tria elements:
+-trias=zeros(nthetha-1,4);
+-
+-start=nods-nthetha;
+-for i=1:nthetha-1,
+-	A=start+i-1;
+-	B=start+i;
+-	C=nods;
+-	trias(i,:)=[A B C NaN];
+-end
+-
+-quads=[quads;trias];
+-
+-md.mesh.elements=quads;
+-md.mesh.x=x;
+-md.mesh.y=y;
+-md.mesh.z=z;
+-md.mesh.r=sqrt(x.^2+y.^2+z.^2);
+-md.mesh.theta=acos(z./md.mesh.r);
+-md.mesh.phi=atan2(y,x);
+-
+-md.mesh.numberofvertices=length(md.mesh.x);
+-md.mesh.numberofelements=size(md.mesh.elements,1);
+-
+-md.mesh.dimension=3;
+Index: ../trunk-jpl/src/m/mesh/planet/planettrimesh.m
+===================================================================
+--- ../trunk-jpl/src/m/mesh/planet/planettrimesh.m	(revision 17475)
++++ ../trunk-jpl/src/m/mesh/planet/planettrimesh.m	(revision 17476)
+@@ -5,6 +5,7 @@
+ %
+ 
+ results = sphere_tri(shape,refinement,radius);
++md.mesh=meshplanet(); %???
+ md.mesh.x=results.vertices(:,1);
+ md.mesh.y=results.vertices(:,2);
+ md.mesh.z=results.vertices(:,3);
+@@ -16,5 +17,3 @@
+ 
+ md.mesh.numberofvertices=length(md.mesh.x);
+ md.mesh.numberofelements=size(md.mesh.elements,1);
+-
+-md.mesh.dimension=3;
Index: issm/oecreview/Archive/16554-17801/ISSM-17476-17477.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17476-17477.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17476-17477.diff	(revision 17802)
@@ -0,0 +1,21 @@
+Index: ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py
+===================================================================
+--- ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py	(revision 17476)
++++ ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py	(revision 17477)
+@@ -1,6 +1,7 @@
+ import os
+ import numpy
+ from ContourToMesh import *
++from MatlabFuncs import *
+ 
+ def SetMarineIceSheetBC(md,icefrontfile=''):
+ 	"""
+@@ -51,7 +52,7 @@
+ 	md.mask.ice_levelset[pos]=0
+ 
+ 	#First find segments that are not completely on the front
+-	if not strcmp(md.mesh.meshtype(),'3D')
++	if not strcmp(md.mesh.meshtype(),'3D'):
+ 		numbernodesfront=2
+ 	else:
+ 		numbernodesfront=4
Index: issm/oecreview/Archive/16554-17801/ISSM-17477-17478.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17477-17478.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17477-17478.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/test/NightlyRun/test803.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test803.py	(revision 17477)
++++ ../trunk-jpl/test/NightlyRun/test803.py	(revision 17478)
+@@ -35,7 +35,7 @@
+ field_names     =['Vx1','Vy1','Vel1','Pressure1','Thickness1','Surface1','MaskIceLevelset1','Enthalpy1','Watercolumn1',\
+ 		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2','Enthalpy2','Watercolumn2',\
+ 		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3','Enthalpy3','Watercolumn3']
+-field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
++field_tolerances=[1e-10,1e-10,1e-10,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
+ 		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,\
+ 		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10]
+ field_values=[\
+Index: ../trunk-jpl/test/NightlyRun/test803.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test803.m	(revision 17477)
++++ ../trunk-jpl/test/NightlyRun/test803.m	(revision 17478)
+@@ -25,7 +25,7 @@
+ field_names     ={'Vx1','Vy1','Vel1','Pressure1','Thickness1','Surface1','MaskIceLevelset1','Enthalpy1','Watercolumn1',...
+ 		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2','Enthalpy2','Watercolumn2',...
+ 		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3','Enthalpy3','Watercolumn3'};
+-field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
++field_tolerances={1e-10,1e-10,1e-10,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+ 		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
+ 		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10};
+ field_values={...
Index: issm/oecreview/Archive/16554-17801/ISSM-17478-17479.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17478-17479.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17478-17479.diff	(revision 17802)
@@ -0,0 +1,60 @@
+Index: ../trunk-jpl/src/c/shared/Numerics/GaussPoints.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Numerics/GaussPoints.cpp	(revision 17478)
++++ ../trunk-jpl/src/c/shared/Numerics/GaussPoints.cpp	(revision 17479)
+@@ -1198,7 +1198,7 @@
+ 	return;
+ }/*}}}*/
+ /*FUNCTION GaussLegendreTetra{{{*/
+-void GaussLegendreTetra( int* pngaus, IssmPDouble** pl1, IssmPDouble** pl2, IssmPDouble** pl3, IssmPDouble** pl4, IssmPDouble** pwgt, int iord ) {
++void GaussLegendreTetra( int* pngaus, IssmDouble** pl1, IssmDouble** pl2, IssmDouble** pl3, IssmDouble** pl4, IssmDouble** pwgt, int iord ) {
+ 	/* Gauss quadrature points for the tetrahedron.
+ 
+ 		p=2-3 points from Y. Jinyun, "Symmetric Gaussian Quadrature
+@@ -1401,11 +1401,11 @@
+ 
+ 		*pngaus=np[iord-1];
+ 
+-		*pl1  =xNew<IssmPDouble>(*pngaus);
+-		*pl2  =xNew<IssmPDouble>(*pngaus);
+-		*pl3  =xNew<IssmPDouble>(*pngaus);
+-		*pl4  =xNew<IssmPDouble>(*pngaus);
+-		*pwgt =xNew<IssmPDouble>(*pngaus);
++		*pl1  =xNew<IssmDouble>(*pngaus);
++		*pl2  =xNew<IssmDouble>(*pngaus);
++		*pl3  =xNew<IssmDouble>(*pngaus);
++		*pl4  =xNew<IssmDouble>(*pngaus);
++		*pwgt =xNew<IssmDouble>(*pngaus);
+ 
+ 		for (i=0; i<*pngaus; i++) {
+ 			(*pl1 )[i]=l1p [iord-1][i];
+@@ -1421,11 +1421,11 @@
+ 		nigaus =iord/2+1;
+ 		*pngaus=nigaus*nigaus*nigaus;
+ 
+-		*pl1  =xNew<IssmPDouble>(*pngaus);
+-		*pl2  =xNew<IssmPDouble>(*pngaus);
+-		*pl3  =xNew<IssmPDouble>(*pngaus);
+-		*pl4  =xNew<IssmPDouble>(*pngaus);
+-		*pwgt =xNew<IssmPDouble>(*pngaus);
++		*pl1  =xNew<IssmDouble>(*pngaus);
++		*pl2  =xNew<IssmDouble>(*pngaus);
++		*pl3  =xNew<IssmDouble>(*pngaus);
++		*pl4  =xNew<IssmDouble>(*pngaus);
++		*pwgt =xNew<IssmDouble>(*pngaus);
+ 
+ 		/*  get the gauss points in each direction  */
+ 		GaussLegendreLinear(&xgaus, &xwgt, nigaus);
+Index: ../trunk-jpl/src/c/shared/Numerics/GaussPoints.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Numerics/GaussPoints.h	(revision 17478)
++++ ../trunk-jpl/src/c/shared/Numerics/GaussPoints.h	(revision 17479)
+@@ -11,7 +11,7 @@
+ #define MAX_TRIA_SYM_ORD    20
+ void GaussLegendreTria(int* pngaus, IssmDouble** pl1, IssmDouble** pl2, IssmDouble** pl3, IssmDouble** pwgt, int iord);
+ #define MAX_TETRA_SYM_ORD    6
+-void GaussLegendreTetra(int* pngaus, IssmPDouble** pl1, IssmPDouble** pl2, IssmPDouble** pl3, IssmPDouble** pl4, IssmPDouble** pwgt, int iord);
++void GaussLegendreTetra(int* pngaus, IssmDouble** pl1, IssmDouble** pl2, IssmDouble** pl3, IssmDouble** pl4, IssmDouble** pwgt, int iord);
+ #define MAX_LINE_GLOB_PTS    5
+ void GaussLobatto(IssmPDouble** pxgaus, IssmPDouble** pxwgt, int ngaus);
+ #define MAX_GAUS_ITER   30
Index: issm/oecreview/Archive/16554-17801/ISSM-17479-17480.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17479-17480.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17479-17480.diff	(revision 17802)
@@ -0,0 +1,1369 @@
+Index: ../trunk-jpl/src/m/os/issmssh.py
+===================================================================
+--- ../trunk-jpl/src/m/os/issmssh.py	(revision 17479)
++++ ../trunk-jpl/src/m/os/issmssh.py	(revision 17480)
+@@ -1,7 +1,7 @@
+ from socket import gethostname
+ import subprocess
+ import os
+-from MatlabFuncs import *
++import MatlabFuncs as m
+ 
+ def issmssh(host,login,port,command):
+ 	"""
+@@ -15,10 +15,10 @@
+ 	hostname=gethostname()
+ 
+ 	#if same as host, just run the command. 
+-	if strcmpi(host,hostname):
++	if m.strcmpi(host,hostname):
+ 		subprocess.call(command,shell=True)
+ 	else:
+-		if ispc():
++		if m.ispc():
+ 			#use the putty project plink.exe: it should be in the path.
+ 		
+ 			#get ISSM_DIR variable
+Index: ../trunk-jpl/src/m/os/issmscpin.py
+===================================================================
+--- ../trunk-jpl/src/m/os/issmscpin.py	(revision 17479)
++++ ../trunk-jpl/src/m/os/issmscpin.py	(revision 17480)
+@@ -2,7 +2,7 @@
+ import subprocess
+ import os
+ import shutil
+-from MatlabFuncs import *
++import MatlabFuncs as m
+ 
+ def issmscpin(host, login,port,path, packages):
+ 	"""
+@@ -23,7 +23,7 @@
+ 			pass
+ 
+ 	#if hostname and host are the same, do a simple copy
+-	if strcmpi(hostname,host):
++	if m.strcmpi(hostname,host):
+ 
+ 		for package in packages:
+ 			try:
+@@ -33,7 +33,7 @@
+ 
+ 	else:
+ 
+-		if ispc():
++		if m.ispc():
+ 			#use the putty project pscp.exe: it should be in the path.
+ 		
+ 			#get ISSM_DIR variable
+Index: ../trunk-jpl/src/m/os/issmscpout.py
+===================================================================
+--- ../trunk-jpl/src/m/os/issmscpout.py	(revision 17479)
++++ ../trunk-jpl/src/m/os/issmscpout.py	(revision 17480)
+@@ -1,7 +1,7 @@
+ from socket  import gethostname
+ import subprocess
+ import os
+-from MatlabFuncs import *
++import MatlabFuncs as m
+ 
+ def issmscpout(host,path,login,port,packages):
+ 	"""
+@@ -15,7 +15,7 @@
+ 
+ 	#if hostname and host are the same, do a simple copy
+ 
+-	if strcmpi(host,hostname):
++	if m.strcmpi(host,hostname):
+ 		for package in packages:
+ 			here=os.getcwd()
+ 			os.chdir(path)
+@@ -26,7 +26,7 @@
+ 			subprocess.call('ln -s %s %s' % (os.path.join(here,package),path),shell=True)
+ 			os.chdir(here)
+ 	else:
+-		if ispc():
++		if m.ispc():
+ 			#use the putty project pscp.exe: it should be in the path.
+ 		
+ 			#get ISSM_DIR variable
+Index: ../trunk-jpl/src/m/os/issmdir.py
+===================================================================
+--- ../trunk-jpl/src/m/os/issmdir.py	(revision 17479)
++++ ../trunk-jpl/src/m/os/issmdir.py	(revision 17480)
+@@ -1,5 +1,5 @@
+ import os
+-from MatlabFuncs import *
++import MatlabFuncs as m
+ 
+ def issmdir():
+ 	"""
+@@ -9,11 +9,11 @@
+ 	      ISSM_DIR=issmdir()
+ 	"""
+ 
+-	if not ispc():
++	if not m.ispc():
+ 		ISSM_DIR =os.environ['ISSM_DIR']
+ 	else:
+ 		ISSM_DIR =os.environ['ISSM_DIR_WIN']
+-		if strcmpi(ISSM_DIR[-1],'/') or strcmpi(ISSM_DIR[-1],'\\'):
++		if m.strcmpi(ISSM_DIR[-1],'/') or m.strcmpi(ISSM_DIR[-1],'\\'):
+ 			ISSM_DIR = ISSM_DIR[:-1]    #shave off the last '/'
+ 
+ 	if not ISSM_DIR:
+Index: ../trunk-jpl/src/m/solve/solve.py
+===================================================================
+--- ../trunk-jpl/src/m/solve/solve.py	(revision 17479)
++++ ../trunk-jpl/src/m/solve/solve.py	(revision 17480)
+@@ -1,14 +1,15 @@
+ import datetime
+ import os
+ import shutil
+-from pairoptions import *
+-from process_solve_options import *
++from pairoptions import pairoptions
++from process_solve_options import process_solve_options
+ from EnumDefinitions import *
+ from EnumToString import EnumToString
+-from ismodelselfconsistent import *
+-from marshall import *
+-from waitonlock import *
+-from loadresultsfromcluster import *
++from ismodelselfconsistent import ismodelselfconsistent
++from marshall import marshall
++from waitonlock import waitonlock
++from loadresultsfromcluster import loadresultsfromcluster
++import MatlabFuncs as m
+ 
+ def solve(md,solutionenum,*args):
+ 	"""
+@@ -82,7 +83,7 @@
+ 	cluster.BuildQueueScript(md.private.runtimename,md.miscellaneous.name,md.private.solution,md.settings.io_gather,md.debug.valgrind,md.debug.gprof)    # queue file
+ 
+ 	#Stop here if batch mode
+-	if strcmpi(options['batch'],'yes'):
++	if m.strcmpi(options['batch'],'yes'):
+ 		print 'batch mode requested: not launching job interactively'
+ 		print 'launch solution sequence on remote cluster by hand'
+ 		return md
+@@ -95,7 +96,7 @@
+ 	cluster.LaunchQueueJob(md.miscellaneous.name,md.private.runtimename,filelist)
+ 
+ 	#did we even try to run? if so, wait on lock
+-	if strcmpi(options['upload'],'on'):
++	if m.strcmpi(options['upload'],'on'):
+ 		print 'solve done uploading test decks'
+ 		return md
+ 
+Index: ../trunk-jpl/src/m/solve/parseresultsfromdisk.py
+===================================================================
+--- ../trunk-jpl/src/m/solve/parseresultsfromdisk.py	(revision 17479)
++++ ../trunk-jpl/src/m/solve/parseresultsfromdisk.py	(revision 17480)
+@@ -2,7 +2,7 @@
+ import numpy
+ from collections import OrderedDict
+ import results as resultsclass
+-from MatlabFuncs import *
++import MatlabFuncs as m
+ 
+ def parseresultsfromdisk(filename,iosplit):
+ 	"""
+@@ -49,7 +49,7 @@
+ 		setattr(results[result['step']-1],'time',result['time']) 
+ 	
+ 		#Add result
+-		if hasattr(results[result['step']-1],result['fieldname']) and not strcmp(result['fieldname'],'SolutionType'):
++		if hasattr(results[result['step']-1],result['fieldname']) and not m.strcmp(result['fieldname'],'SolutionType'):
+ 			setattr(results[result['step']-1],result['fieldname'],numpy.vstack((getattr(results[result['step']-1],result['fieldname']),result['field'])))
+ 		else:
+ 			setattr(results[result['step']-1],result['fieldname'],result['field'])
+@@ -161,27 +161,27 @@
+ 
+ 		#Process units here FIXME: this should not be done here!
+ 		yts=365.0*24.0*3600.0
+-		if strcmp(fieldname,'BalancethicknessThickeningRate'):
++		if m.strcmp(fieldname,'BalancethicknessThickeningRate'):
+ 			field = field*yts
+-		elif strcmp(fieldname,'Time'):
++		elif m.strcmp(fieldname,'Time'):
+ 			field = field/yts
+-		elif strcmp(fieldname,'HydrologyWaterVx'):
++		elif m.strcmp(fieldname,'HydrologyWaterVx'):
+ 			field = field*yts
+-		elif strcmp(fieldname,'HydrologyWaterVy'):
++		elif m.strcmp(fieldname,'HydrologyWaterVy'):
+ 			field = field*yts
+-		elif strcmp(fieldname,'Vx'):
++		elif m.strcmp(fieldname,'Vx'):
+ 			field = field*yts
+-		elif strcmp(fieldname,'Vy'):
++		elif m.strcmp(fieldname,'Vy'):
+ 			field = field*yts
+-		elif strcmp(fieldname,'Vz'):
++		elif m.strcmp(fieldname,'Vz'):
+ 			field = field*yts
+-		elif strcmp(fieldname,'Vel'):
++		elif m.strcmp(fieldname,'Vel'):
+ 			field = field*yts
+-		elif strcmp(fieldname,'BasalforcingsMeltingRate'):
++		elif m.strcmp(fieldname,'BasalforcingsMeltingRate'):
+ 			field = field*yts
+-		elif strcmp(fieldname,'TotalSmb'):
++		elif m.strcmp(fieldname,'TotalSmb'):
+ 			field = field/10.**12.*yts #(GigaTon/year)
+-		elif strcmp(fieldname,'SurfaceforcingsMassBalance'):
++		elif m.strcmp(fieldname,'SurfaceforcingsMassBalance'):
+ 			field = field*yts
+ 
+ 		result=OrderedDict()
+Index: ../trunk-jpl/src/m/solve/loadresultsfromdisk.py
+===================================================================
+--- ../trunk-jpl/src/m/solve/loadresultsfromdisk.py	(revision 17479)
++++ ../trunk-jpl/src/m/solve/loadresultsfromdisk.py	(revision 17480)
+@@ -1,8 +1,8 @@
+ import os
+-from results import *
+-from parseresultsfromdisk import *
++from results import results
++from parseresultsfromdisk import parseresultsfromdisk
+ from EnumToString import EnumToString
+-from MatlabFuncs import *
++import MatlabFuncs as m
+ 
+ def loadresultsfromdisk(md,filename):
+ 	"""
+@@ -52,7 +52,7 @@
+ 			print ("loadresultsfromcluster info message: error during solution. Check your errlog and outlog model fields.")
+ 
+ 		#if only one solution, extract it from list for user friendliness
+-		if len(structure) == 1 and not strcmp(structure[0].SolutionType,'TransientSolution'):
++		if len(structure) == 1 and not m.strcmp(structure[0].SolutionType,'TransientSolution'):
+ 			setattr(md.results,structure[0].SolutionType,structure[0])
+ 
+ 	#post processes qmu results if necessary
+Index: ../trunk-jpl/src/m/solve/waitonlock.py
+===================================================================
+--- ../trunk-jpl/src/m/solve/waitonlock.py	(revision 17479)
++++ ../trunk-jpl/src/m/solve/waitonlock.py	(revision 17480)
+@@ -1,7 +1,7 @@
+ import os
+ import socket
+ import time
+-from MatlabFuncs import *
++import MatlabFuncs as m
+ 
+ def waitonlock(md):
+ 	"""
+@@ -23,11 +23,11 @@
+ 	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(),cluster):
++	if not m.strcmpi(socket.gethostname(),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'): 
++		if not m.strcmp(choice,'y'): 
+ 			print 'Results not loaded... exiting' 
+ 			flag=0
+ 		else:
+Index: ../trunk-jpl/src/m/solve/WriteData.py
+===================================================================
+--- ../trunk-jpl/src/m/solve/WriteData.py	(revision 17479)
++++ ../trunk-jpl/src/m/solve/WriteData.py	(revision 17480)
+@@ -1,8 +1,8 @@
+ import numpy
+ import math
+ import struct
+-from pairoptions import *
+-from MatlabFuncs import *
++import pairoptions
++import MatlabFuncs as m
+ from EnumDefinitions import *
+ from EnumToString import EnumToString
+ 
+@@ -15,9 +15,7 @@
+ 	"""
+ 
+ 	#process options
+-	#  the import above the function level doesn't work?
+-	from pairoptions import pairoptions
+-	options=pairoptions(*args)
++	options=pairoptions.pairoptions(*args)
+ 
+ 	#Get data properties
+ 	if options.exist('object'):
+@@ -61,7 +59,7 @@
+ 	fid.write(struct.pack('i',enum)) 
+ 
+ 	#Step 2: write the data itself.
+-	if   strcmpi(format,'Boolean'):    # {{{
++	if   m.strcmpi(format,'Boolean'):    # {{{
+ #		if len(data) !=1:
+ #			raise ValueError('field %s cannot be marshalled as it has more than one element!' % EnumToString(enum)[0])
+ 
+@@ -75,7 +73,7 @@
+ 		fid.write(struct.pack('i',int(data)))  #send an int, not easy to send a bool
+ 		# }}}
+ 
+-	elif strcmpi(format,'Integer'):    # {{{
++	elif m.strcmpi(format,'Integer'):    # {{{
+ #		if len(data) !=1:
+ #			raise ValueError('field %s cannot be marshalled as it has more than one element!' % EnumToString(enum)[0])
+ 
+@@ -89,7 +87,7 @@
+ 		fid.write(struct.pack('i',data)) 
+ 		# }}}
+ 
+-	elif strcmpi(format,'Double'):    # {{{
++	elif m.strcmpi(format,'Double'):    # {{{
+ #		if len(data) !=1:
+ #			raise ValueError('field %s cannot be marshalled as it has more than one element!' % EnumToString(enum)[0])
+ 
+@@ -103,7 +101,7 @@
+ 		fid.write(struct.pack('d',data)) 
+ 		# }}}
+ 
+-	elif strcmpi(format,'String'):    # {{{
++	elif m.strcmpi(format,'String'):    # {{{
+ 		#first write length of record
+ 		fid.write(struct.pack('i',len(data)+4+4))  #string + string size + code
+ 
+@@ -115,7 +113,7 @@
+ 		fid.write(struct.pack('%ds' % len(data),data)) 
+ 		# }}}
+ 
+-	elif strcmpi(format,'BooleanMat'):    # {{{
++	elif m.strcmpi(format,'BooleanMat'):    # {{{
+ 
+ 		if   isinstance(data,bool):
+ 			data=numpy.array([data])
+@@ -148,7 +146,7 @@
+ 				fid.write(struct.pack('d',float(data[i][j])))    #get to the "c" convention, hence the transpose
+ 		# }}}
+ 
+-	elif strcmpi(format,'IntMat'):    # {{{
++	elif m.strcmpi(format,'IntMat'):    # {{{
+ 
+ 		if   isinstance(data,(int,long)):
+ 			data=numpy.array([data])
+@@ -181,7 +179,7 @@
+ 				fid.write(struct.pack('d',float(data[i][j])))    #get to the "c" convention, hence the transpose
+ 		# }}}
+ 
+-	elif strcmpi(format,'DoubleMat'):    # {{{
++	elif m.strcmpi(format,'DoubleMat'):    # {{{
+ 
+ 		if   isinstance(data,(bool,int,long,float)):
+ 			data=numpy.array([data])
+@@ -218,7 +216,7 @@
+ 				fid.write(struct.pack('d',float(data[i][j])))    #get to the "c" convention, hence the transpose
+ 		# }}}
+ 
+-	elif strcmpi(format,'MatArray'):    # {{{
++	elif m.strcmpi(format,'MatArray'):    # {{{
+ 
+ 		#first get length of record
+ 		recordlength=4+4    #number of records + code
+@@ -262,7 +260,7 @@
+ 					fid.write(struct.pack('d',float(matrix[i][j])))
+ 		# }}}
+ 
+-	elif strcmpi(format,'StringArray'):    # {{{
++	elif m.strcmpi(format,'StringArray'):    # {{{
+ 
+ 		#first get length of record
+ 		recordlength=4+4    #for length of array + code
+@@ -318,23 +316,23 @@
+ 	sent.
+ 	"""
+ 
+-	if   strcmpi(format,'Boolean'):
++	if   m.strcmpi(format,'Boolean'):
+ 		code=1
+-	elif strcmpi(format,'Integer'):
++	elif m.strcmpi(format,'Integer'):
+ 		code=2
+-	elif strcmpi(format,'Double'):
++	elif m.strcmpi(format,'Double'):
+ 		code=3
+-	elif strcmpi(format,'String'):
++	elif m.strcmpi(format,'String'):
+ 		code=4
+-	elif strcmpi(format,'BooleanMat'):
++	elif m.strcmpi(format,'BooleanMat'):
+ 		code=5
+-	elif strcmpi(format,'IntMat'):
++	elif m.strcmpi(format,'IntMat'):
+ 		code=6
+-	elif strcmpi(format,'DoubleMat'):
++	elif m.strcmpi(format,'DoubleMat'):
+ 		code=7
+-	elif strcmpi(format,'MatArray'):
++	elif m.strcmpi(format,'MatArray'):
+ 		code=8
+-	elif strcmpi(format,'StringArray'):
++	elif m.strcmpi(format,'StringArray'):
+ 		code=9
+ 	else:
+ 		raise InputError('FormatToCode error message: data type not supported yet!')
+Index: ../trunk-jpl/src/m/solve/loadresultsfromcluster.py
+===================================================================
+--- ../trunk-jpl/src/m/solve/loadresultsfromcluster.py	(revision 17479)
++++ ../trunk-jpl/src/m/solve/loadresultsfromcluster.py	(revision 17480)
+@@ -1,7 +1,7 @@
+ import os
+ import socket
+-from MatlabFuncs import *
+-from loadresultsfromdisk import *
++import MatlabFuncs as m
++from loadresultsfromdisk import loadresultsfromdisk
+ 
+ def loadresultsfromcluster(md,runtimename=False):
+ 	"""
+@@ -40,19 +40,19 @@
+ 		os.remove(md.miscellaneous.name+'.outlog')
+ 		os.remove(md.miscellaneous.name+'.errlog')
+ 		os.remove(md.miscellaneous.name+'.outbin')
+-		if not ispc():
++		if not m.ispc():
+ 			os.remove(md.private.runtimename+'.tar.gz')
+ 
+ 	#erase input file if run was carried out on same platform.
+ 	hostname=socket.gethostname()
+-	if strcmpi(hostname,cluster.name):
++	if m.strcmpi(hostname,cluster.name):
+ 		if md.qmu.isdakota:
+ 			os.remove(os.path.join('qmu'+str(os.getpid()),md.miscellaneous.name+'.bin'))
+ 			os.remove(os.path.join('qmu'+str(os.getpid()),md.miscellaneous.name+'.queue'))
+ 		else:
+ 			os.remove(md.miscellaneous.name+'.bin')
+ 			os.remove(md.miscellaneous.name+'.toolkits')
+-			if not ispc():
++			if not m.ispc():
+ 				os.remove(md.miscellaneous.name+'.queue')
+ 			else:
+ 				os.remove(md.miscellaneous.name+'.bat')
+Index: ../trunk-jpl/src/m/geometry/FlagElements.py
+===================================================================
+--- ../trunk-jpl/src/m/geometry/FlagElements.py	(revision 17479)
++++ ../trunk-jpl/src/m/geometry/FlagElements.py	(revision 17480)
+@@ -1,9 +1,9 @@
+ import numpy
+ import os
+-#from basinzoom import *
+-from ContourToMesh import *
+-from MatlabFuncs import *
+-from PythonFuncs import *
++#from basinzoom import basinzoon
++from ContourToMesh import ContourToMesh
++import MatlabFuncs as m
++import PythonFuncs as p
+ 
+ def FlagElements(md,region):
+ 	"""
+@@ -25,12 +25,12 @@
+ 		if   not region:
+ 			flag=numpy.zeros(md.mesh.numberofelements,bool)
+ 			invert=0
+-		elif strcmpi(region,'all'):
++		elif m.strcmpi(region,'all'):
+ 			flag=numpy.ones(md.mesh.numberofelements,bool)
+ 			invert=0
+ 		else:
+ 			#make sure that we actually don't want the elements outside the domain outline!
+-			if strcmpi(region[0],'~'):
++			if m.strcmpi(region[0],'~'):
+ 				region=region[1:]
+ 				invert=1
+ 			else:
+@@ -38,11 +38,11 @@
+ 
+ 			#does the region domain outline exist or do we have to look for xlim,ylim in basinzoom?
+ 			if not os.path.exists(region):
+-				if len(region)>3 and not strcmp(region[-4:],'.exp'):
++				if len(region)>3 and not m.strcmp(region[-4:],'.exp'):
+ 					raise IOError("Error: File 'region' not found!" % region)
+ 				raise RuntimeError("FlagElements.py calling basinzoom.py is not complete.")
+ 				xlim,ylim=basinzoom('basin',region)
+-				flag_nodes=logical_and_n(md.mesh.x<xlim[1],md.mesh.x>xlim[0],md.mesh.y<ylim[1],md.mesh.y>ylim[0])
++				flag_nodes=p.logical_and_n(md.mesh.x<xlim[1],md.mesh.x>xlim[0],md.mesh.y<ylim[1],md.mesh.y>ylim[0])
+ 				flag=numpy.prod(flag_nodes[md.mesh.elements],axis=1).astype(bool)
+ 			else:
+ 				#ok, flag elements
+Index: ../trunk-jpl/src/m/exp/expread.py
+===================================================================
+--- ../trunk-jpl/src/m/exp/expread.py	(revision 17479)
++++ ../trunk-jpl/src/m/exp/expread.py	(revision 17480)
+@@ -1,7 +1,7 @@
+ import os.path
+ import numpy
+ from collections import OrderedDict
+-from MatlabFuncs import *
++import MatlabFuncs as m
+ 
+ def expread(filename):
+ 	"""
+@@ -47,7 +47,7 @@
+ 		if not A:
+ 			break
+ 		A=A.split(None,1)
+-		if not (len(A) == 2 and strcmp(A[0],'##') and strncmp(A[1],'Name:',5)):
++		if not (len(A) == 2 and m.strcmp(A[0],'##') and strncmp(A[1],'Name:',5)):
+ 			break
+ 		if len(A[1])>5: 
+ 			contour['name']=A[1][5:-1]
+@@ -56,12 +56,12 @@
+ 
+ 		#Get Icon
+ 		A=fid.readline().split(None,1)
+-		if not (len(A) == 2 and strcmp(A[0],'##') and strncmp(A[1],'Icon:',5)):
++		if not (len(A) == 2 and m.strcmp(A[0],'##') and strncmp(A[1],'Icon:',5)):
+ 			break
+ 
+ 		#Get Info
+ 		A=fid.readline().split()
+-		if not (len(A) == 4 and strcmp(A[0],'#') and strcmp(A[1],'Points')):
++		if not (len(A) == 4 and m.strcmp(A[0],'#') and m.strcmp(A[1],'Points')):
+ 			break
+ 
+ 		#Get number of nodes and density
+@@ -71,8 +71,8 @@
+ 
+ 		#Get Info
+ 		A=fid.readline().split()
+-		if not (len(A) == 5 and strcmp(A[0],'#') and strcmp(A[1],'X') and strcmp(A[2],'pos') \
+-		                                         and strcmp(A[3],'Y') and strcmp(A[4],'pos')):
++		if not (len(A) == 5 and m.strcmp(A[0],'#') and m.strcmp(A[1],'X') and m.strcmp(A[2],'pos') \
++		                                         and m.strcmp(A[3],'Y') and m.strcmp(A[4],'pos')):
+ 			break
+ 
+ 		#Get Coordinates
+Index: ../trunk-jpl/src/m/exp/expcoarsen.py
+===================================================================
+--- ../trunk-jpl/src/m/exp/expcoarsen.py	(revision 17479)
++++ ../trunk-jpl/src/m/exp/expcoarsen.py	(revision 17480)
+@@ -1,7 +1,6 @@
+ import os.path
+ import numpy as npy
+ from collections import OrderedDict
+-from MatlabFuncs import *
+ from expread import expread
+ from expwrite import expwrite
+ 
+Index: ../trunk-jpl/src/m/consistency/checkfield.py
+===================================================================
+--- ../trunk-jpl/src/m/consistency/checkfield.py	(revision 17479)
++++ ../trunk-jpl/src/m/consistency/checkfield.py	(revision 17480)
+@@ -1,7 +1,7 @@
+ import numpy
+ import os
+-from pairoptions import *
+-from MatlabFuncs import *
++from pairoptions import pairoptions
++import MatlabFuncs as m
+ 
+ def checkfield(md,*args):
+ 	"""
+@@ -106,7 +106,7 @@
+ 	#check values
+ 	if options.exist('values'):
+ 		fieldvalues=options.getfieldvalue('values')
+-		if False in ismember(field,fieldvalues):
++		if False in m.ismember(field,fieldvalues):
+ 			if   len(fieldvalues)==1:
+ 				md = md.checkmessage(options.getfieldvalue('message',\
+ 					"field '%s' value should be '%s'"  % (fieldname,fieldvalues[0])))
+Index: ../trunk-jpl/src/m/miscellaneous/fielddisplay.py
+===================================================================
+--- ../trunk-jpl/src/m/miscellaneous/fielddisplay.py	(revision 17479)
++++ ../trunk-jpl/src/m/miscellaneous/fielddisplay.py	(revision 17480)
+@@ -1,7 +1,7 @@
+ #Module import 
+ import numpy
+ from math import isnan
+-from MatlabFuncs import *
++import MatlabFuncs as m
+ 
+ def fielddisplay(md,name,comment):
+ 	"""
+@@ -100,7 +100,7 @@
+ 				string=sbeg
+ 				break
+ 
+-	if strcmp(string,sbeg):
++	if m.strcmp(string,sbeg):
+ 		string="%s%dx1%s" % (sbeg,len(field),send)
+ 	else:
+ 		string=string[:-1]+send
+@@ -116,7 +116,7 @@
+ 		name="%s..." % name[:20]
+ 	
+ 	#take care of characterization
+-	if strcmp(characterization,"''") or strcmp(characterization,'""') or strcmpi(characterization,'nan'):
++	if m.strcmp(characterization,"''") or m.strcmp(characterization,'""') or m.strcmpi(characterization,'nan'):
+ 		characterization="N/A"
+ 	
+ 	if len(characterization)>15:
+Index: ../trunk-jpl/src/m/boundaryconditions/SetIceSheetBC.py
+===================================================================
+--- ../trunk-jpl/src/m/boundaryconditions/SetIceSheetBC.py	(revision 17479)
++++ ../trunk-jpl/src/m/boundaryconditions/SetIceSheetBC.py	(revision 17480)
+@@ -1,6 +1,6 @@
+ import os
+ import numpy
+-from ContourToMesh import *
++from ContourToMesh import ContourToMesh
+ 
+ def SetIceSheetBC(md):
+ 	"""
+Index: ../trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py
+===================================================================
+--- ../trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py	(revision 17479)
++++ ../trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py	(revision 17480)
+@@ -1,7 +1,7 @@
+ import os
+ import numpy
+-from ContourToMesh import *
+-from MatlabFuncs import *
++from ContourToMesh import ContourToMesh
++import MatlabFuncs as m
+ 
+ def SetIceShelfBC(md,icefrontfile=''):
+ 	"""
+@@ -43,9 +43,9 @@
+ 	md.mask.ice_levelset[pos]=0
+ 
+ 	#First find segments that are not completely on the front
+-	if strcmp(md.mesh.meshtype(),'3D'):
++	if m.strcmp(md.mesh.meshtype(),'3D'):
+ 		numbernodesfront=4;
+-	elif strcmp(md.mesh.meshtype(),'2Dhorizontal'):
++	elif m.strcmp(md.mesh.meshtype(),'2Dhorizontal'):
+ 		numbernodesfront=2;
+ 	else:
+ 		raise	error('mesh type not supported yet')
+Index: ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py
+===================================================================
+--- ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py	(revision 17479)
++++ ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py	(revision 17480)
+@@ -1,7 +1,7 @@
+ import os
+ import numpy
+-from ContourToMesh import *
+-from MatlabFuncs import *
++from ContourToMesh import ContourToMesh
++import MatlabFuncs as m
+ 
+ def SetMarineIceSheetBC(md,icefrontfile=''):
+ 	"""
+@@ -52,7 +52,7 @@
+ 	md.mask.ice_levelset[pos]=0
+ 
+ 	#First find segments that are not completely on the front
+-	if not strcmp(md.mesh.meshtype(),'3D'):
++	if not m.strcmp(md.mesh.meshtype(),'3D'):
+ 		numbernodesfront=2
+ 	else:
+ 		numbernodesfront=4
+Index: ../trunk-jpl/src/m/mesh/rifts/meshprocessoutsiderifts.py
+===================================================================
+--- ../trunk-jpl/src/m/mesh/rifts/meshprocessoutsiderifts.py	(revision 17479)
++++ ../trunk-jpl/src/m/mesh/rifts/meshprocessoutsiderifts.py	(revision 17480)
+@@ -1,6 +1,6 @@
+ import numpy
+-from ElementsFromEdge import *
+-from MatlabFuncs import *
++from ElementsFromEdge import ElementsFromEdge
++import MatlabFuncs as m
+ 
+ def meshprocessoutsiderifts(md,domainoutline):
+ 	"""
+@@ -46,12 +46,12 @@
+ 				#detect elements on edge A,B:
+ 				edgeelements=ElementsFromEdge(md.mesh.elements,A,B)
+ 				#rule out those we already detected
+-				already_detected=ismember(edgeelements,elements)
++				already_detected=m.ismember(edgeelements,elements)
+ 				nextelement=edgeelements(numpy.nonzero(numpy.logical_not(already_detected))[0])
+ 				#add new detected element to the list of elements we are looking for.
+ 				elements=numpy.concatenate((elements,nextelement))
+ 				#new B:
+-				B=md.mesh.elements[nextelement-1,numpy.nonzero(numpy.logical_not(ismember(md.mesh.elements[nextelement-1,:],numpy.array([A,B]))))]
++				B=md.mesh.elements[nextelement-1,numpy.nonzero(numpy.logical_not(m.ismember(md.mesh.elements[nextelement-1,:],numpy.array([A,B]))))]
+ 		
+ 			#take the list of elements on one side of the rift that connect to the tip, 
+ 			#and duplicate the tip on them, so as to open the rift to the outside.
+Index: ../trunk-jpl/src/m/mesh/triangle.py
+===================================================================
+--- ../trunk-jpl/src/m/mesh/triangle.py	(revision 17479)
++++ ../trunk-jpl/src/m/mesh/triangle.py	(revision 17480)
+@@ -1,8 +1,8 @@
+ import numpy
+-from TriMesh import *
+-from NodeConnectivity import *
+-from ElementConnectivity import *
+-from MatlabFuncs import *
++from TriMesh import TriMesh
++from NodeConnectivity import NodeConnectivity
++from ElementConnectivity import ElementConnectivity
++import MatlabFuncs as m
+ 
+ def triangle(md,domainname,*args):
+ 	"""
+@@ -35,7 +35,7 @@
+ 	#Check that mesh was not already run, and warn user: 
+ 	if md.mesh.numberofelements:
+ 		choice = raw_input('This model already has a mesh. Are you sure you want to go ahead? (y/n)')
+-		if not strcmp(choice,'y'):
++		if not m.strcmp(choice,'y'):
+ 			print 'no meshing done ... exiting'
+ 			return None
+ 
+Index: ../trunk-jpl/src/m/mesh/bamg.py
+===================================================================
+--- ../trunk-jpl/src/m/mesh/bamg.py	(revision 17479)
++++ ../trunk-jpl/src/m/mesh/bamg.py	(revision 17480)
+@@ -1,15 +1,15 @@
+ import os.path
+ import numpy
+ from collections import OrderedDict
+-from pairoptions import *
+-from bamggeom import *
+-from bamgmesh import *
+-from expread import *
+-from expwrite import *
+-from SegIntersect import *
+-from MatlabFuncs import *
+-from BamgMesher import *
+-from ContourToNodes import *
++from pairoptions import pairoptions
++from bamggeom import bamggeom
++from bamgmesh import bamgmesh
++from expread import expread
++from expwrite import expwrite
++from SegIntersect import SegIntersect
++import MatlabFuncs as m
++from BamgMesher import BamgMesher
++from ContourToNodes import ContourToNodes
+ 
+ def bamg(md,*args):
+ 	"""
+@@ -373,7 +373,7 @@
+ 			j+=1
+ 
+ 			#Skip if the two edges already have a vertex in common
+-			if any(ismember(geom.Edges[i,0:2],geom.Edges[j,0:2])):
++			if any(m.ismember(geom.Edges[i,0:2],geom.Edges[j,0:2])):
+ 				continue
+ 
+ 			#Get coordinates
+@@ -470,7 +470,7 @@
+ 					geom.Vertices(j,:)=[];
+ 
+ 					%update edges
+-					posedges=find(ismember(geom.Edges,j));
++					posedges=find(m.ismember(geom.Edges,j));
+ 					geom.Edges(posedges)=i;
+ 					posedges=find(geom.Edges>j);
+ 					geom.Edges(posedges)=geom.Edges(posedges)-1;
+Index: ../trunk-jpl/src/m/mesh/ComputeHessian.py
+===================================================================
+--- ../trunk-jpl/src/m/mesh/ComputeHessian.py	(revision 17479)
++++ ../trunk-jpl/src/m/mesh/ComputeHessian.py	(revision 17480)
+@@ -1,7 +1,7 @@
+ import numpy
+-from GetNodalFunctionsCoeff import *
+-from GetAreas import *
+-from MatlabFuncs import *
++from GetNodalFunctionsCoeff import GetNodalFunctionsCoeff
++from GetAreas import GetAreas
++import MatlabFuncs as m
+ 
+ def ComputeHessian(index,x,y,field,type):
+ 	"""
+@@ -25,7 +25,7 @@
+ 	#some checks
+ 	if numpy.size(field)!=numberofnodes and numpy.size(field)!=numberofelements:
+ 		raise TypeError("ComputeHessian error message: the given field size not supported yet")
+-	if not strcmpi(type,'node') and not strcmpi(type,'element'):
++	if not m.strcmpi(type,'node') and not m.strcmpi(type,'element'):
+ 		raise TypeError("ComputeHessian error message: only 'node' or 'element' type supported yet")
+ 
+ 	#initialization
+@@ -56,7 +56,7 @@
+ 	#Compute hessian for each element
+ 	hessian=numpy.hstack((numpy.sum(gradx[index-1,0]*alpha,axis=1).reshape(-1,1),numpy.sum(grady[index-1,0]*alpha,axis=1).reshape(-1,1),numpy.sum(grady[index-1,0]*beta,axis=1).reshape(-1,1)))
+ 
+-	if strcmpi(type,'node'):
++	if m.strcmpi(type,'node'):
+ 		#Compute Hessian on the nodes (average of the elements around)
+ 		hessian=numpy.hstack((sparse(line,numpy.ones((linesize,1)),numpy.tile((areas*hessian[:,0]).reshape(-1,1),(3,1)),numberofnodes,1)/weights, \
+ 			sparse(line,numpy.ones((linesize,1)),numpy.tile((areas*hessian[:,1]).reshape(-1,1),(3,1)),numberofnodes,1)/weights, \
+Index: ../trunk-jpl/src/m/classes/groundingline.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/groundingline.py	(revision 17479)
++++ ../trunk-jpl/src/m/classes/groundingline.py	(revision 17480)
+@@ -2,9 +2,9 @@
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+ from StringToEnum import StringToEnum
+-from checkfield import *
+-from WriteData import *
+-from MatlabFuncs import *
++from checkfield import checkfield
++from WriteData import WriteData
++import MatlabFuncs as m
+ 
+ class groundingline(object):
+ 	"""
+@@ -43,7 +43,7 @@
+ 
+ 		md = checkfield(md,'fieldname','groundingline.migration','values',['None','AgressiveMigration','SoftMigration','SubelementMigration','SubelementMigration2'])
+ 
+-		if not strcmp(self.migration,'None'):
++		if not m.strcmp(self.migration,'None'):
+ 			if numpy.any(numpy.isnan(md.geometry.bathymetry)):
+ 				md.checkmessage("requesting grounding line migration, but bathymetry is absent!")
+ 			pos=numpy.nonzero(md.mask.groundedice_levelset>0.)[0]
+Index: ../trunk-jpl/src/m/classes/damage.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/damage.py	(revision 17479)
++++ ../trunk-jpl/src/m/classes/damage.py	(revision 17480)
+@@ -1,8 +1,9 @@
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+ from StringToEnum import StringToEnum
+-from checkfield import *
+-from WriteData import *
++from checkfield import checkfield
++from WriteData import WriteData
++import MatlabFuncs as m
+ 
+ class damage(object):
+ 	"""
+@@ -108,11 +109,11 @@
+ 	# }}}
+ 	def defaultoutputs(self,md): # {{{
+ 
+-		if strcmp(md.mesh.meshtype(),'3D'):
++		if m.strcmp(md.mesh.meshtype(),'3D'):
+ 			list = ['DamageD']
+-		elif strcmp(md.mesh.meshtype(),'2Dhorizontal'):
++		elif m.strcmp(md.mesh.meshtype(),'2Dhorizontal'):
+ 			list = ['DamageD']
+-		elif strcmp(md.mesh.meshtype(),'2Dvertical'):
++		elif m.strcmp(md.mesh.meshtype(),'2Dvertical'):
+ 			list = ['DamageD']
+ 		else:
+ 			raise TypeError('mesh type not supported yet')
+@@ -142,7 +143,7 @@
+ 			md = checkfield(md,'fieldname','damage.healing','>=',0)
+ 			md = checkfield(md,'fieldname','damage.equiv_stress','numel',[1],'values',[0,1])
+ 			md = checkfield(md,'fieldname','damage.requested_outputs','stringrow',1)
+-		elif strcmpi(self.law,'undamaged'):
++		elif m.strcmpi(self.law,'undamaged'):
+ 			if (solution==DamageEvolutionSolutionEnum):
+ 				raise RuntimeError('Invalid evolution law (md.damage.law) for a damage solution')
+ 
+Index: ../trunk-jpl/src/m/classes/plotoptions.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/plotoptions.py	(revision 17479)
++++ ../trunk-jpl/src/m/classes/plotoptions.py	(revision 17480)
+@@ -1,5 +1,5 @@
+ from collections import OrderedDict, Counter, defaultdict
+-from pairoptions import *
++import pairoptions
+ 
+ class plotoptions(object):
+ 	'''
+Index: ../trunk-jpl/src/m/classes/mesh.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh.py	(revision 17479)
++++ ../trunk-jpl/src/m/classes/mesh.py	(revision 17480)
+@@ -1,8 +1,9 @@
+ import numpy
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from MatlabFuncs import *
++from checkfield import checkfield
++import MatlabFuncs as m
++from WriteData import WriteData
+ 
+ class mesh(object):
+ 	"""
+@@ -130,7 +131,7 @@
+ 			md = checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements,3])
+ 		else:
+ 			md = checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements,6])
+-		if numpy.any(numpy.logical_not(ismember(numpy.arange(1,md.mesh.numberofvertices+1),md.mesh.elements))):
++		if numpy.any(numpy.logical_not(m.ismember(numpy.arange(1,md.mesh.numberofvertices+1),md.mesh.elements))):
+ 			md.checkmessage("orphan nodes have been found. Check the mesh outline")
+ 		md = checkfield(md,'fieldname','mesh.dimension','values',[2,3])
+ 		md = checkfield(md,'fieldname','mesh.numberoflayers','>=',0)
+Index: ../trunk-jpl/src/m/classes/clusters/generic.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/clusters/generic.py	(revision 17479)
++++ ../trunk-jpl/src/m/classes/clusters/generic.py	(revision 17480)
+@@ -1,14 +1,15 @@
+ import socket
++import os
+ import math
+ import subprocess
+ from IssmConfig import IssmConfig
+ from EnumToString import EnumToString
+-from issmdir import *
+-from pairoptions import *
+-from issmssh import *
+-from issmscpin import *
+-from issmscpout import *
+-from MatlabFuncs import *
++from issmdir import issmdir
++from pairoptions import pairoptions
++from issmssh import issmssh
++from issmscpin import issmscpin
++from issmscpout import issmscpout
++import MatlabFuncs as m
+ 
+ class generic(object):
+ 	"""
+@@ -36,7 +37,7 @@
+ 		options=pairoptions(*args)
+ 
+ 		#get name
+-		self.name=gethostname()
++		self.name=socket.gethostname()
+ 
+ 		#initialize cluster using user settings if provided
+ 		if os.path.exists(self.name+'_settings.py'):
+@@ -70,7 +71,7 @@
+ 	def BuildQueueScript(self,dirname,modelname,solution,io_gather,isvalgrind,isgprof):    # {{{
+ 
+ 		#write queuing script 
+-		if not ispc():
++		if not m.ispc():
+ 
+ 			fid=open(modelname+'.queue','w')
+ 			fid.write('#!/bin/sh\n')
+@@ -122,7 +123,7 @@
+ 	def BuildKrigingQueueScript(self,modelname,solution,io_gather,isvalgrind,isgprof):    # {{{
+ 
+ 		#write queuing script 
+-		if not ispc():
++		if not m.ispc():
+ 
+ 			fid=open(modelname+'.queue','w')
+ 			fid.write('#!/bin/sh\n')
+@@ -180,7 +181,7 @@
+ 	# }}}
+ 	def Download(self,dirname,filelist):     # {{{
+ 
+-		if ispc():
++		if m.ispc():
+ 			#do nothing
+ 			return
+ 
+Index: ../trunk-jpl/src/m/classes/initialization.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/initialization.py	(revision 17479)
++++ ../trunk-jpl/src/m/classes/initialization.py	(revision 17480)
+@@ -1,8 +1,9 @@
+ import numpy
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from WriteData import *
++from checkfield import checkfield
++from WriteData import WriteData
++import MatlabFuncs as m
+ 
+ class initialization(object):
+ 	"""
+@@ -64,7 +65,7 @@
+ 		if ThermalAnalysisEnum() in analyses:
+ 			md = checkfield(md,'fieldname','initialization.vx','NaN',1,'size',[md.mesh.numberofvertices])
+ 			md = checkfield(md,'fieldname','initialization.vy','NaN',1,'size',[md.mesh.numberofvertices])
+-			if strcmp(md.mesh.meshtype(),'3D'):
++			if m.strcmp(md.mesh.meshtype(),'3D'):
+ 				md = checkfield(md,'fieldname','initialization.vz','NaN',1,'size',[md.mesh.numberofvertices])
+ 			md = checkfield(md,'fieldname','initialization.pressure','NaN',1,'size',[md.mesh.numberofvertices])
+ 		if (EnthalpyAnalysisEnum() in analyses and md.thermal.isenthalpy):
+Index: ../trunk-jpl/src/m/classes/verbose.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/verbose.py	(revision 17479)
++++ ../trunk-jpl/src/m/classes/verbose.py	(revision 17480)
+@@ -1,7 +1,7 @@
+-from pairoptions import *
+-from MatlabFuncs import *
++from pairoptions import pairoptions
++import MatlabFuncs as m
+ from EnumDefinitions import *
+-from WriteData import *
++from WriteData import WriteData
+ 
+ class verbose(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/pairoptions.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/pairoptions.py	(revision 17479)
++++ ../trunk-jpl/src/m/classes/pairoptions.py	(revision 17480)
+@@ -1,5 +1,5 @@
+ from collections import OrderedDict
+-from WriteData import *
++from WriteData import WriteData
+ 
+ class pairoptions(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/stressbalance.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/stressbalance.py	(revision 17479)
++++ ../trunk-jpl/src/m/classes/stressbalance.py	(revision 17480)
+@@ -3,9 +3,9 @@
+ import copy
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from WriteData import *
+-from MatlabFuncs import *
++from checkfield import checkfield
++from WriteData import WriteData
++import MatlabFuncs as m
+ 
+ class stressbalance(object):
+ 	"""
+@@ -109,11 +109,11 @@
+ 	#}}}
+ 	def defaultoutputs(self,md): # {{{
+ 
+-		if strcmp(md.mesh.meshtype(),'3D'):
++		if m.strcmp(md.mesh.meshtype(),'3D'):
+ 			list = ['Vx','Vy','Vz','Vel','Pressure']
+-		elif strcmp(md.mesh.meshtype(),'2Dhorizontal'):
++		elif m.strcmp(md.mesh.meshtype(),'2Dhorizontal'):
+ 			list = ['Vx','Vy','Vel','Pressure']
+-		elif strcmp(md.mesh.meshtype(),'2Dvertical'):
++		elif m.strcmp(md.mesh.meshtype(),'2Dvertical'):
+ 			list = ['Vx','Vy','Vel','Pressure']
+ 		else:
+ 			raise TypeError('mesh type not supported yet');
+@@ -128,7 +128,7 @@
+ 
+ 		md = checkfield(md,'fieldname','stressbalance.spcvx','forcing',1)
+ 		md = checkfield(md,'fieldname','stressbalance.spcvy','forcing',1)
+-		if strcmp(md.mesh.meshtype(),'3D'):
++		if m.strcmp(md.mesh.meshtype(),'3D'):
+ 			md = checkfield(md,'fieldname','stressbalance.spcvz','forcing',1)
+ 		md = checkfield(md,'fieldname','stressbalance.restol','size',[1],'>',0)
+ 		md = checkfield(md,'fieldname','stressbalance.reltol','size',[1])
+@@ -160,7 +160,7 @@
+ 				if numpy.abs(numpy.inner(item[0:2],item[3:5]))>sys.float_info.epsilon:
+ 					md.checkmessage("Vectors in stressbalance.referential (columns 1 to 3 and 4 to 6) must be orthogonal")
+ 		#CHECK THAT NO rotation specified for FS Grounded ice at base
+-		if strcmp(md.mesh.meshtype(),'3D') and md.flowequation.isFS:
++		if m.strcmp(md.mesh.meshtype(),'3D') and md.flowequation.isFS:
+ 			pos=numpy.nonzero(numpy.logical_and(md.mask.groundedice_levelset,md.mesh.vertexonbed))
+ 			if numpy.any(numpy.logical_not(numpy.isnan(md.stressbalance.referential[pos,:]))):
+ 				md.checkmessage("no referential should be specified for basal vertices of grounded ice")
+Index: ../trunk-jpl/src/m/classes/independent.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/independent.py	(revision 17479)
++++ ../trunk-jpl/src/m/classes/independent.py	(revision 17480)
+@@ -1,9 +1,8 @@
+ import numpy
+-from pairoptions import *
+-from fielddisplay import *
+-from MatlabFuncs import *
++from pairoptions import pairoptions
++from fielddisplay import fielddisplay
++import MatlabFuncs as m
+ from EnumDefinitions import *
+-from WriteData import *
+ 
+ class independent(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/results.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/results.py	(revision 17479)
++++ ../trunk-jpl/src/m/classes/results.py	(revision 17480)
+@@ -1,9 +1,8 @@
+ import numpy
+-from pairoptions import *
+-from fielddisplay import *
+-from MatlabFuncs import *
++from pairoptions import pairoptions
++from fielddisplay import fielddisplay
++import MatlabFuncs as m
+ from EnumDefinitions import *
+-from WriteData import *
+ 
+ class results(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/qmu.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/qmu.py	(revision 17479)
++++ ../trunk-jpl/src/m/classes/qmu.py	(revision 17480)
+@@ -2,9 +2,9 @@
+ from collections import OrderedDict
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from WriteData import *
+-from MatlabFuncs import *
++from checkfield import checkfield
++from WriteData import WriteData
++import MatlabFuncs as m
+ 
+ class qmu(object):
+ 	"""
+@@ -55,7 +55,7 @@
+ 			if max(md.qmu.partition)>=md.qmu.numberofpartitions:
+ 				md.checkmessage("for qmu analysis, partitioning vector cannot go over npart, number of partition areas")
+ 
+-		if not strcmpi(md.cluster.name,'none'):
++		if not m.strcmpi(md.cluster.name,'none'):
+ 			if not md.settings.waitonlock:
+ 				md.checkmessage("waitonlock should be activated when running qmu in parallel mode!")
+ 
+Index: ../trunk-jpl/src/m/classes/dependent.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/dependent.py	(revision 17479)
++++ ../trunk-jpl/src/m/classes/dependent.py	(revision 17480)
+@@ -1,11 +1,10 @@
+ import os.path
+ import numpy
+-from pairoptions import *
+-from fielddisplay import *
+-from MatlabFuncs import *
++from pairoptions import pairoptions
++from fielddisplay import fielddisplay
++import MatlabFuncs as m
+ from EnumDefinitions import *
+-from WriteData import *
+-from MeshProfileIntersection import *
++from MeshProfileIntersection import MeshProfileIntersection
+ 
+ class dependent(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/toolkits.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/toolkits.py	(revision 17479)
++++ ../trunk-jpl/src/m/classes/toolkits.py	(revision 17480)
+@@ -1,11 +1,10 @@
+ from IssmConfig import IssmConfig
+-from mumpsoptions import *
+-from iluasmoptions import *
++from mumpsoptions import mumpsoptions
++from iluasmoptions import iluasmoptions
+ from EnumToString import EnumToString
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from MatlabFuncs import *
++from checkfield import checkfield
+ 
+ class toolkits(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/flowequation.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/flowequation.py	(revision 17479)
++++ ../trunk-jpl/src/m/classes/flowequation.py	(revision 17480)
+@@ -2,8 +2,9 @@
+ import copy
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from WriteData import *
++from checkfield import checkfield
++from WriteData import WriteData
++import MatlabFuncs as m
+ 
+ class flowequation(object):
+ 	"""
+@@ -78,10 +79,10 @@
+ 			md = checkfield(md,'fieldname','flowequation.borderSSA','size',[md.mesh.numberofvertices],'values',[0,1])
+ 			md = checkfield(md,'fieldname','flowequation.borderHO','size',[md.mesh.numberofvertices],'values',[0,1])
+ 			md = checkfield(md,'fieldname','flowequation.borderFS','size',[md.mesh.numberofvertices],'values',[0,1])
+-			if strcmp(md.mesh.meshtype(),'2Dhorizontal'):
++			if m.strcmp(md.mesh.meshtype(),'2Dhorizontal'):
+ 				md = checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices],'values',[1,2])
+ 				md = checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements],'values',[1,2])
+-			elif strcmp(md.mesh.meshtype(),'3D'):
++			elif m.strcmp(md.mesh.meshtype(),'3D'):
+ 				md = checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices],'values',numpy.arange(0,8+1))
+ 				md = checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements],'values',numpy.arange(0,8+1))
+ 			else:
+Index: ../trunk-jpl/src/m/classes/mesh2d.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh2d.py	(revision 17479)
++++ ../trunk-jpl/src/m/classes/mesh2d.py	(revision 17480)
+@@ -1,8 +1,8 @@
+ import numpy
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from MatlabFuncs import *
++from checkfield import checkfield
++import MatlabFuncs as m
+ 
+ class mesh2d(object):
+ 	"""
+@@ -87,7 +87,7 @@
+ 		md = checkfield(md,'fieldname','mesh.z','NaN',1,'size',[md.mesh.numberofvertices])
+ 		md = checkfield(md,'fieldname','mesh.elements','NaN',1,'>',0,'values',numpy.arange(1,md.mesh.numberofvertices+1))
+ 		md = checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements,3])
+-		if numpy.any(numpy.logical_not(ismember(numpy.arange(1,md.mesh.numberofvertices+1),md.mesh.elements))):
++		if numpy.any(numpy.logical_not(m.ismember(numpy.arange(1,md.mesh.numberofvertices+1),md.mesh.elements))):
+ 			md.checkmessage("orphan nodes have been found. Check the mesh outline")
+ 		md = checkfield(md,'fieldname','mesh.numberofelements','>',0)
+ 		md = checkfield(md,'fieldname','mesh.numberofvertices','>',0)
+Index: ../trunk-jpl/src/m/extrusion/project3d.py
+===================================================================
+--- ../trunk-jpl/src/m/extrusion/project3d.py	(revision 17479)
++++ ../trunk-jpl/src/m/extrusion/project3d.py	(revision 17480)
+@@ -1,6 +1,6 @@
+ import numpy
+-from pairoptions import *
+-from MatlabFuncs import *
++from pairoptions import pairoptions
++import MatlabFuncs as m
+ 
+ def project3d(md,*args):
+ 	"""
+@@ -26,7 +26,7 @@
+ 	#some regular checks
+ 	if not md:
+ 		raise TypeError("bad usage")
+-	if not strcmp(md.mesh.meshtype(),'3D'):
++	if not m.strcmp(md.mesh.meshtype(),'3D'):
+ 		raise TypeError("input model is not 3d")
+ 
+ 	#retrieve parameters from options.
+@@ -44,7 +44,7 @@
+ 	if   isinstance(vector2d,(bool,int,long,float)) or numpy.size(vector2d)==1:
+ 		projected_vector=vector2d
+ 
+-	elif strcmpi(type,'node'):
++	elif m.strcmpi(type,'node'):
+ 
+ 		#Initialize 3d vector
+ 		if   numpy.size(vector2d,axis=0)==md.mesh.numberofvertices2d:
+@@ -63,7 +63,7 @@
+ 		else:
+ 			projected_vector[((layer-1)*md.mesh.numberofvertices2d):(layer*md.mesh.numberofvertices2d),:]=vector2d
+ 
+-	elif strcmpi(type,'element'):
++	elif m.strcmpi(type,'element'):
+ 
+ 		#Initialize 3d vector
+ 		if   numpy.size(vector2d,axis=0)==md.mesh.numberofelements2d:
+Index: ../trunk-jpl/src/m/contrib/bamg/YamsCall.py
+===================================================================
+--- ../trunk-jpl/src/m/contrib/bamg/YamsCall.py	(revision 17479)
++++ ../trunk-jpl/src/m/contrib/bamg/YamsCall.py	(revision 17480)
+@@ -2,9 +2,8 @@
+ import time
+ import subprocess
+ import os
+-from ComputeHessian import *
+-from ComputeMetric import *
+-from MatlabFuncs import *
++from ComputeHessian import ComputeHessian
++from ComputeMetric import ComputeMetric
+ 
+ def YamsCall(md,field,hmin,hmax,gradation,epsilon):
+ 	"""
+@@ -84,7 +83,7 @@
+ 
+ 	#call yams
+ 	print "%s\n" % '      call Yams...'
+-	if   ispc():
++	if   m.ispc():
+ 		#windows
+ 		subprocess.call('yams2-win -O 1 -v -0 -ecp -hgrad %g carre0 carre1' % gradation,shell=True)
+ 	elif ismac():
+Index: ../trunk-jpl/src/m/parameterization/setflowequation.py
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/setflowequation.py	(revision 17479)
++++ ../trunk-jpl/src/m/parameterization/setflowequation.py	(revision 17480)
+@@ -1,9 +1,9 @@
+ import numpy
+ from model import *
+-from pairoptions import *
+-from MatlabFuncs import *
+-from PythonFuncs import *
+-from FlagElements import *
++from pairoptions import pairoptions
++import MatlabFuncs as m
++import PythonFuncs as p
++from FlagElements import FlagElements
+ 
+ def setflowequation(md,*args):
+ 	"""
+@@ -36,7 +36,7 @@
+ 
+ 	#Find_out what kind of coupling to use
+ 	coupling_method=options.getfieldvalue('coupling','tiling')
+-	if not strcmpi(coupling_method,'tiling') and not strcmpi(coupling_method,'penalties'):
++	if not m.strcmpi(coupling_method,'tiling') and not m.strcmpi(coupling_method,'penalties'):
+ 		raise TypeError("coupling type can only be: tiling or penalties")
+ 
+ 	#recover elements distribution
+@@ -48,11 +48,11 @@
+ 	filltype     = options.getfieldvalue('fill','none')
+ 
+ 	#Flag the elements that have not been flagged as filltype
+-	if   strcmpi(filltype,'SIA'):
++	if   m.strcmpi(filltype,'SIA'):
+ 		SIAflag[numpy.nonzero(numpy.logical_not(logical_or_n(SSAflag,HOflag)))]=True
+-	elif strcmpi(filltype,'SSA'):
++	elif m.strcmpi(filltype,'SSA'):
+ 		SSAflag[numpy.nonzero(numpy.logical_not(logical_or_n(SIAflag,HOflag,FSflag)))]=True
+-	elif strcmpi(filltype,'HO'):
++	elif m.strcmpi(filltype,'HO'):
+ 		HOflag[numpy.nonzero(numpy.logical_not(logical_or_n(SIAflag,SSAflag,FSflag)))]=True
+ 
+ 	#check that each element has at least one flag
+@@ -113,7 +113,7 @@
+ 	SSAHOflag=numpy.zeros(md.mesh.numberofelements,bool)
+ 	SSAFSflag=numpy.zeros(md.mesh.numberofelements,bool)
+ 	HOFSflag=numpy.zeros(md.mesh.numberofelements,bool)
+-	if   strcmpi(coupling_method,'penalties'):
++	if   m.strcmpi(coupling_method,'penalties'):
+ 		#Create the border nodes between HO and SSA and extrude them
+ 		numnodes2d=md.mesh.numberofvertices2d
+ 		numlayers=md.mesh.numberoflayers
+@@ -126,12 +126,12 @@
+ 				penalties=numpy.vstack((penalties,numpy.hstack((bordernodes2d.reshape(-1,1),bordernodes2d.reshape(-1,1)+md.mesh.numberofvertices2d*(i)))))
+ 			md.stressbalance.vertex_pairing=penalties
+ 
+-	elif strcmpi(coupling_method,'tiling'):
++	elif m.strcmpi(coupling_method,'tiling'):
+ 		if   any(SSAflag) and any(HOflag):    #coupling SSA HO
+ 			#Find node at the border
+ 			nodeonSSAHO[numpy.nonzero(numpy.logical_and(nodeonSSA,nodeonHO))]=True
+ 			#SSA elements in contact with this layer become SSAHO elements
+-			matrixelements=ismember(md.mesh.elements-1,numpy.nonzero(nodeonSSAHO)[0])
++			matrixelements=m.ismember(md.mesh.elements-1,numpy.nonzero(nodeonSSAHO)[0])
+ 			commonelements=numpy.sum(matrixelements,axis=1)!=0
+ 			commonelements[numpy.nonzero(HOflag)]=False    #only one layer: the elements previously in SSA
+ 			SSAflag[numpy.nonzero(commonelements)]=False    #these elements are now SSAHOelements
+@@ -163,7 +163,7 @@
+ 			#Find node at the border
+ 			nodeonHOFS[numpy.nonzero(numpy.logical_and(nodeonHO,nodeonFS))]=True
+ 			#FS elements in contact with this layer become HOFS elements
+-			matrixelements=ismember(md.mesh.elements-1,numpy.nonzero(nodeonHOFS)[0])
++			matrixelements=m.ismember(md.mesh.elements-1,numpy.nonzero(nodeonHOFS)[0])
+ 			commonelements=numpy.sum(matrixelements,axis=1)!=0
+ 			commonelements[numpy.nonzero(HOflag)]=False    #only one layer: the elements previously in SSA
+ 			FSflag[numpy.nonzero(commonelements)]=False    #these elements are now SSAHOelements
+@@ -195,7 +195,7 @@
+ 			#Find node at the border
+ 			nodeonSSAFS[numpy.nonzero(numpy.logical_and(nodeonSSA,nodeonFS))]=True
+ 			#FS elements in contact with this layer become SSAFS elements
+-			matrixelements=ismember(md.mesh.elements-1,numpy.nonzero(nodeonSSAFS)[0])
++			matrixelements=m.ismember(md.mesh.elements-1,numpy.nonzero(nodeonSSAFS)[0])
+ 			commonelements=numpy.sum(matrixelements,axis=1)!=0
+ 			commonelements[numpy.nonzero(SSAflag)]=False    #only one layer: the elements previously in SSA
+ 			FSflag[numpy.nonzero(commonelements)]=False    #these elements are now SSASSAelements
Index: issm/oecreview/Archive/16554-17801/ISSM-17480-17481.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17480-17481.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17480-17481.diff	(revision 17802)
@@ -0,0 +1,130 @@
+Index: ../trunk-jpl/externalpackages/fti/install.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/fti/install.sh	(revision 0)
++++ ../trunk-jpl/externalpackages/fti/install.sh	(revision 17481)
+@@ -0,0 +1,24 @@
++#!/bin/bash
++set -eu
++
++#Some cleanup
++rm -rf install fti-0.9.2
++mkdir install
++
++#Download from ISSM server
++$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/fti-0.9.2.tgz' 'fti-0.9.2.tgz'
++
++#Untar 
++tar -zxvf  fti-0.9.2.tgz
++
++#Move mpich into src directory
++mv fti/* install
++rm -rf fti
++
++#Configure mpich
++cd install
++cp ../Makefile .
++
++#Compile mpich (this new version supports parallel make)
++make
++make install 
+
+Property changes on: ../trunk-jpl/externalpackages/fti/install.sh
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/externalpackages/fti/Makefile
+===================================================================
+--- ../trunk-jpl/externalpackages/fti/Makefile	(revision 0)
++++ ../trunk-jpl/externalpackages/fti/Makefile	(revision 17481)
+@@ -0,0 +1,90 @@
++## * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
++##* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
++##=======================================================================
++##Copyright (C) 2010-2013 Leonardo A. BAUTISTA GOMEZ
++##This program is free software; you can redistribute it and/or modify
++##it under the terms of the GNU General Public License (GPL) as published
++##of the License, or (at your option) any later version.
++##
++##This program is distributed in the hope that it will be useful,
++##but WITHOUT ANY WARRANTY; without even the implied warranty of
++##MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++##GNU General Public License for more details.
++##
++##To read the license please visit http://www.gnu.org/copyleft/gpl.html
++##=======================================================================
++
++##=======================================================================
++##   PLEASE SET THESE VARIABLES BEFORE COMPILING
++##=======================================================================
++
++FTIPATH		= $(ISSM_DIR)/externalpackages/fti/install
++MPIPATH		= $(ISSM_DIR)/externalpackages/mpich/install
++
++##=======================================================================
++##   DIRECTORY TREE
++##=======================================================================
++
++LIB 		= lib
++OBJ		= obj
++SRC		= src
++DOC		= doc
++INC		= include
++
++##=======================================================================
++##   COMPILERS
++##=======================================================================
++
++CC 		= gcc
++MPICC 		= mpicc
++
++##=======================================================================
++##   FLAGS
++##=======================================================================
++
++FTIFLAGS	= -fPIC -g -Iinclude/ -c
++MPIFLAGS	= -I$(MPIPATH)/include -L$(MPIPATH)/lib -lmpich -lpmpich
++
++##=======================================================================
++##   TARGETS
++##=======================================================================
++
++
++OBJS		= $(OBJ)/galois.o $(OBJ)/jerasure.o $(OBJ)/dictionary.o $(OBJ)/iniparser.o \
++		$(OBJ)/recover.o $(OBJ)/tools.o $(OBJ)/checkpoint.o $(OBJ)/topo.o \
++		$(OBJ)/api.o
++
++SHARED		= libfti.so
++STATIC		= libfti.a
++
++all: 		$(SHARED) $(STATIC)
++
++doc:
++		doxygen $(DOC)/Doxyfile
++
++$(OBJ)/%.o:	$(SRC)/%.c
++		$(MPICC) $(FTIFLAGS) $< -o $@
++
++$(SHARED):	$(OBJS)
++		$(CC) $(MPIFLAGS) -shared -o $(LIB)/$(SHARED) $(OBJS) -lc
++
++$(STATIC):	$(OBJS)
++		$(AR) -cvq $(LIB)/$(STATIC) $(OBJS)
++install:
++		if [ ! -d "$(FTIPATH)/FTI" ]; then mkdir $(FTIPATH)/FTI; fi
++		if [ ! -d "$(FTIPATH)/FTI/$(LIB)" ]; then mkdir $(FTIPATH)/FTI/$(LIB); fi
++		if [ ! -d "$(FTIPATH)/FTI/$(INC)" ]; then mkdir $(FTIPATH)/FTI/$(INC); fi
++		rm -f $(FTIPATH)/FTI/$(LIB)/* $(FTIPATH)/FTI/$(INC)/*
++		cp $(INC)/* $(FTIPATH)/FTI/$(INC)/
++		cp $(LIB)/* $(FTIPATH)/FTI/$(LIB)/
++
++uninstall:
++		rm -f $(FTIPATH)/FTI/$(LIB)/* $(FTIPATH)/FTI/$(INC)/*
++		if [ -d "$(FTIPATH)/FTI/$(LIB)" ]; then rmdir $(FTIPATH)/FTI/$(LIB); fi
++		if [ -d "$(FTIPATH)/FTI/$(INC)" ]; then rmdir $(FTIPATH)/FTI/$(INC); fi
++		if [ -d "$(FTIPATH)/FTI" ]; then rmdir $(FTIPATH)/FTI; fi
++
++clean:
++		rm -f $(OBJ)/* $(LIB)/*
++
++.PHONY:		$(SHARED) $(STATIC) doc install uninstall clean
Index: issm/oecreview/Archive/16554-17801/ISSM-17481-17482.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17481-17482.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17481-17482.diff	(revision 17802)
@@ -0,0 +1,41 @@
+Index: ../trunk-jpl/src/m/plot/plot_unit.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_unit.m	(revision 17481)
++++ ../trunk-jpl/src/m/plot/plot_unit.m	(revision 17482)
+@@ -29,22 +29,22 @@
+ 	%node plot
+ 	case 2,
+ 
+-		if is2d,
++		if size(elements,2)==6, %prisms
++			A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6);
++			patch( 'Faces', [A B C],  'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor);
++			patch( 'Faces', [D E F],  'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor);
++			patch( 'Faces', [A B E D],'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor);
++			patch( 'Faces', [B E F C],'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor);
++			patch( 'Faces', [C A D F],'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor);
++		elseif size(elements,2)==4, %tetras
++			A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4);
++			patch( 'Faces',[A B C],'Vertices', [x y z],'FaceVertexCData',data(:),'FaceColor','interp','EdgeColor',edgecolor);
++			patch( 'Faces',[A B D],'Vertices', [x y z],'FaceVertexCData',data(:),'FaceColor','interp','EdgeColor',edgecolor);
++			patch( 'Faces',[B C D],'Vertices', [x y z],'FaceVertexCData',data(:),'FaceColor','interp','EdgeColor',edgecolor);
++			patch( 'Faces',[C A D],'Vertices', [x y z],'FaceVertexCData',data(:),'FaceColor','interp','EdgeColor',edgecolor);
++		else
+ 			A=elements(:,1); B=elements(:,2); C=elements(:,3); 
+ 			patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor);
+-		else
+-			if ~isplanet,
+-				A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6);
+-				patch( 'Faces', [A B C],  'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor);
+-				patch( 'Faces', [D E F],  'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor);
+-				patch( 'Faces', [A B E D],'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor);
+-				patch( 'Faces', [B E F C],'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor);
+-				patch( 'Faces', [C A D F],'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor);
+-			else
+-				A=elements(:,1); B=elements(:,2); C=elements(:,3); 
+-				if size(elements,2)==4, D=elements(:,4); else D=C; end
+-				patch( 'Faces', [A B C D],  'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor);
+-			end
+ 		end
+ 
+ 	%quiver plot
Index: issm/oecreview/Archive/16554-17801/ISSM-17482-17483.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17482-17483.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17482-17483.diff	(revision 17802)
@@ -0,0 +1,213 @@
+Index: ../trunk-jpl/src/m/classes/mesh3dtetras.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh3dtetras.m	(revision 0)
++++ ../trunk-jpl/src/m/classes/mesh3dtetras.m	(revision 17483)
+@@ -0,0 +1,152 @@
++%MESH3DTETRAS class definition
++%
++%   Usage:
++%      mesh=mesh3dtetras();
++
++classdef mesh3dtetras
++	properties (SetAccess=public) 
++		x                           = NaN;
++		y                           = NaN;
++		z                           = NaN
++		elements                    = NaN
++		numberoflayers              = 0;
++		numberofelements            = 0;
++		numberofvertices            = 0;
++
++		lat                         = NaN
++		long                        = NaN
++		hemisphere                  = NaN
++
++		vertexonbed                 = NaN
++		vertexonsurface             = NaN
++		lowerelements               = NaN
++		lowervertex                 = NaN
++		upperelements               = NaN
++		uppervertex                 = NaN
++		vertexonboundary            = NaN
++
++		vertexconnectivity          = NaN
++		elementconnectivity         = NaN
++		average_vertex_connectivity = 0;
++
++		x2d                         = NaN
++		y2d                         = NaN
++		elements2d                  = NaN
++		numberofvertices2d          = 0;
++		numberofelements2d          = 0;
++
++		extractedvertices           = NaN
++		extractedelements           = NaN
++	end
++	methods
++		function self = mesh3dtetras(varargin) % {{{
++			switch nargin
++				case 0
++					self=setdefaultparameters(self);
++				case 1
++					inputstruct=varargin{1};
++					list1 = properties('mesh3dtetras');
++					list2 = fieldnames(inputstruct);
++					for i=1:length(list1)
++						fieldname = list1{i};
++						if ismember(fieldname,list2),
++							self.(fieldname) = inputstruct.(fieldname);
++						end
++					end
++				otherwise
++					error('constructor not supported');
++			end
++		end % }}}
++		function obj = setdefaultparameters(obj) % {{{
++
++			%the connectivity is the averaged number of nodes linked to a
++			%given node through an edge. This connectivity is used to initially
++			%allocate memory to the stiffness matrix. A value of 16 seems to
++			%give a good memory/time ration. This value can be checked in
++			%trunk/test/Miscellaneous/runme.m
++			obj.average_vertex_connectivity=25;
++		end % }}}
++		function md = checkconsistency(obj,md,solution,analyses) % {{{
++
++			md = checkfield(md,'fieldname','mesh.x','NaN',1,'size',[md.mesh.numberofvertices 1]);
++			md = checkfield(md,'fieldname','mesh.y','NaN',1,'size',[md.mesh.numberofvertices 1]);
++			md = checkfield(md,'fieldname','mesh.z','NaN',1,'size',[md.mesh.numberofvertices 1]);
++			md = checkfield(md,'fieldname','mesh.elements','NaN',1,'>',0,'values',1:md.mesh.numberofvertices);
++			md = checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements 4]);
++			if any(~ismember(1:md.mesh.numberofvertices,sort(unique(md.mesh.elements(:)))));
++				md = checkmessage(md,'orphan nodes have been found. Check the mesh outline');
++			end
++			md = checkfield(md,'fieldname','mesh.numberoflayers','>=',0);
++			md = checkfield(md,'fieldname','mesh.numberofelements','>',0);
++			md = checkfield(md,'fieldname','mesh.numberofvertices','>',0);
++			%no checks for numberofedges lat long and hemisphere
++			md = checkfield(md,'fieldname','mesh.vertexonbed','size',[md.mesh.numberofvertices 1],'values',[0 1]);
++			md = checkfield(md,'fieldname','mesh.vertexonsurface','size',[md.mesh.numberofvertices 1],'values',[0 1]);
++			md = checkfield(md,'fieldname','mesh.z','>=',md.geometry.bed-10^-10,'message','''mesh.z'' lower than bedrock');
++			md = checkfield(md,'fieldname','mesh.z','<=',md.geometry.surface+10^-10,'message','''mesh.z'' higher than surface elevation');
++			md = checkfield(md,'fieldname','mesh.average_vertex_connectivity','>=',24,'message','''mesh.average_vertex_connectivity'' should be at least 24 in 3d');
++		end % }}}
++		function disp(obj) % {{{
++			disp(sprintf('   Mesh:')); 
++
++			disp(sprintf('\n      Elements and vertices of the original 2d mesh:'));
++			fielddisplay(obj,'numberofelements2d','number of elements');
++			fielddisplay(obj,'numberofvertices2d','number of vertices');
++			fielddisplay(obj,'elements2d','vertex indices of the mesh elements');
++			fielddisplay(obj,'x2d','vertices x coordinate [m]');
++			fielddisplay(obj,'y2d','vertices y coordinate [m]');
++
++			disp(sprintf('\n      Elements and vertices of the extruded 3d mesh:'));
++			fielddisplay(obj,'numberofelements','number of elements');
++			fielddisplay(obj,'numberofvertices','number of vertices');
++			fielddisplay(obj,'elements','vertex indices of the mesh elements');
++			fielddisplay(obj,'x','vertices x coordinate [m]');
++			fielddisplay(obj,'y','vertices y coordinate [m]');
++			fielddisplay(obj,'z','vertices z coordinate [m]');
++
++			disp(sprintf('\n      Properties:'));
++			fielddisplay(obj,'numberoflayers','number of extrusion layers');
++			fielddisplay(obj,'vertexonbed','lower vertices flags list');
++			fielddisplay(obj,'vertexonsurface','upper vertices flags list');
++			fielddisplay(obj,'uppervertex','upper vertex list (NaN for vertex on the upper surface)');
++			fielddisplay(obj,'upperelements','upper element list (NaN for element on the upper layer)');
++			fielddisplay(obj,'lowervertex','lower vertex list (NaN for vertex on the lower surface)');
++			fielddisplay(obj,'lowerelements','lower element list (NaN for element on the lower layer');
++			fielddisplay(obj,'vertexonboundary','vertices on the boundary of the domain flag list');
++
++			fielddisplay(obj,'vertexconnectivity','list of vertices connected to vertex_i');
++			fielddisplay(obj,'elementconnectivity','list of vertices connected to element_i');
++			fielddisplay(obj,'average_vertex_connectivity','average number of vertices connected to one vertex');
++
++			disp(sprintf('\n      Extracted model:'));
++			fielddisplay(obj,'extractedvertices','vertices extracted from the model');
++			fielddisplay(obj,'extractedelements','elements extracted from the model');
++
++			disp(sprintf('\n      Projection:'));
++			fielddisplay(obj,'lat','vertices latitude [degrees]');
++			fielddisplay(obj,'long','vertices longitude [degrees]');
++			fielddisplay(obj,'hemisphere','Indicate hemisphere ''n'' or ''s'' ');
++		end % }}}
++		function marshall(obj,md,fid) % {{{
++			WriteData(fid,'enum',MeshTypeEnum(),'data',Mesh3DtetrasEnum,'format','Integer');
++			WriteData(fid,'object',obj,'class','mesh','fieldname','x','format','DoubleMat','mattype',1);
++			WriteData(fid,'object',obj,'class','mesh','fieldname','y','format','DoubleMat','mattype',1);
++			WriteData(fid,'object',obj,'class','mesh','fieldname','z','format','DoubleMat','mattype',1);
++			WriteData(fid,'object',obj,'class','mesh','fieldname','elements','format','DoubleMat','mattype',2);
++			WriteData(fid,'object',obj,'class','mesh','fieldname','numberoflayers','format','Integer');
++			WriteData(fid,'object',obj,'class','mesh','fieldname','numberofelements','format','Integer');
++			WriteData(fid,'object',obj,'class','mesh','fieldname','numberofvertices','format','Integer');
++			WriteData(fid,'object',obj,'class','mesh','fieldname','vertexonbed','format','BooleanMat','mattype',1);
++			WriteData(fid,'object',obj,'class','mesh','fieldname','vertexonsurface','format','BooleanMat','mattype',1);
++			WriteData(fid,'object',obj,'class','mesh','fieldname','lowerelements','format','DoubleMat','mattype',2);
++			WriteData(fid,'object',obj,'class','mesh','fieldname','upperelements','format','DoubleMat','mattype',2);
++			WriteData(fid,'object',obj,'class','mesh','fieldname','average_vertex_connectivity','format','Integer');
++			WriteData(fid,'object',obj,'class','mesh','fieldname','elements2d','format','DoubleMat','mattype',3);
++			WriteData(fid,'object',obj,'class','mesh','fieldname','numberofvertices2d','format','Integer');
++			WriteData(fid,'object',obj,'class','mesh','fieldname','numberofelements2d','format','Integer');
++		end % }}}
++		function type = meshtype(obj) % {{{
++			type = '3D';
++		end % }}}
++	end
++end
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17482)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17483)
+@@ -1102,6 +1102,51 @@
+ 			md.private          = private();
+ 		end
+ 		%}}}
++		function md = tetras(md,varargin) % {{{
++			%TETRAS - split 3d prismatic mesh into 3 tetrahedrons
++			%
++			%   Usage:
++			%      md=tetra(md)
++
++			if ~isa(md.mesh,'mesh3dprisms')
++				error('mesh is not a 3d prismatic mesh');
++			end
++
++			%Initialize tetra mesh
++			md.mesh=mesh3dtetras(md.mesh);
++
++			%Split in 3 tetras
++			subelement1 = [1 2 3 5];
++			subelement2 = [4 6 5 1];
++			subelement3 = [5 6 3 1];
++			elements=[md.mesh.elements(:,subelement1);md.mesh.elements(:,subelement2);md.mesh.elements(:,subelement3)];
++			pos_elements = repmat([1:md.mesh.numberofelements]',3,1);
++
++			md.mesh.elements=elements;
++			md.mesh.numberofelements=size(elements,1);
++
++			%p and q (same deal, except for element that are on the bedrock: )
++			md.friction.p=md.friction.p(pos_elements);
++			md.friction.q=md.friction.q(pos_elements);
++
++			%elementstype
++			if ~isnan(md.flowequation.element_equation)
++				oldelements_type=md.flowequation.element_equation;
++				md.flowequation.element_equation=zeros(number_el3d,1);
++				md.flowequation.element_equation=md.flowequation.element_equation(pos_elements);
++			end
++
++			%connectivity
++			md.mesh.elementconnectivity=NaN;
++
++			%materials
++			md.materials.rheology_n=md.materials.rheology_n(pos_elements);
++
++			%increase connectivity if less than 25:
++			if md.mesh.average_vertex_connectivity<=25,
++				md.mesh.average_vertex_connectivity=100;
++			end
++		end % }}}
+ 		function disp(obj) % {{{
+ 			disp(sprintf('%19s: %-22s -- %s','mesh'            ,['[1x1 ' class(obj.mesh) ']'],'mesh properties'));
+ 			disp(sprintf('%19s: %-22s -- %s','mask'            ,['[1x1 ' class(obj.mask) ']'],'defines grounded and floating elements'));
Index: issm/oecreview/Archive/16554-17801/ISSM-17483-17484.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17483-17484.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17483-17484.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17483)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17484)
+@@ -725,7 +725,7 @@
+ 	this->SetElementType(finiteelement_type,analysis_counter);
+ 
+ 	/*Recover vertices ids needed to initialize inputs*/
+-	for(i=0;i<6;i++) tetra_vertex_ids[i]=iomodel->elements[6*index+i]; //ids for vertices are in the elements array from Matlab
++	for(i=0;i<4;i++) tetra_vertex_ids[i]=iomodel->elements[4*index+i]; //ids for vertices are in the elements array from Matlab
+ 
+ 	/*Recover nodes ids needed to initialize the node hook.*/
+ 	switch(finiteelement_type){
Index: issm/oecreview/Archive/16554-17801/ISSM-17484-17485.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17484-17485.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17484-17485.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/classes/gauss/GaussTetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussTetra.cpp	(revision 17484)
++++ ../trunk-jpl/src/c/classes/gauss/GaussTetra.cpp	(revision 17485)
+@@ -34,7 +34,7 @@
+ GaussTetra::GaussTetra(int order){
+ 	/*Get gauss points*/
+ 	GaussLegendreTetra(&numgauss,&coords1,&coords2,&coords3,&coords4,&weights,order);
+-	for(int i=0;i<numgauss;i++) this->weights[i]=this->weights[i]*sqrt(2.)/6.; //FIXME: double check that
++	for(int i=0;i<numgauss;i++) this->weights[i]=this->weights[i]/6.; //FIXME: double check that
+ 
+ 	/*Initialize static fields as undefinite*/
+ 	weight=UNDEF;
Index: issm/oecreview/Archive/16554-17801/ISSM-17485-17486.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17485-17486.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17485-17486.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp	(revision 17485)
++++ ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp	(revision 17486)
+@@ -301,15 +301,15 @@
+ 	IssmDouble z4=xyz_list[3*3+2];
+ 
+ 	J[NDOF3*0+0] = x2-x1;
+-	J[NDOF3*1+0] = y2-y1;
+-	J[NDOF3*2+0] = z2-z1;
++	J[NDOF3*0+1] = y2-y1;
++	J[NDOF3*0+2] = z2-z1;
+ 
+-	J[NDOF3*0+1] = x3-x1;
++	J[NDOF3*1+0] = x3-x1;
+ 	J[NDOF3*1+1] = y3-y1;
+-	J[NDOF3*2+1] = z3-z1;
++	J[NDOF3*1+2] = z3-z1;
+ 
+-	J[NDOF3*0+2] = x4-x1;
+-	J[NDOF3*1+2] = y4-y1;
++	J[NDOF3*2+0] = x4-x1;
++	J[NDOF3*2+1] = y4-y1;
+ 	J[NDOF3*2+2] = z4-z1;
+ }
+ /*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17486-17487.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17486-17487.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17486-17487.diff	(revision 17802)
@@ -0,0 +1,42 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp	(revision 17486)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp	(revision 17487)
+@@ -16,7 +16,7 @@
+ 
+ void  ElementsAndVerticesPartitioning(bool** pmy_elements, int** pmy_vertices, IoModel* iomodel){
+ 
+-	int i;
++	int i,j;
+ 
+ 	const int RIFTINFOSIZE = 12;
+ 	int numberofelements2d;
+@@ -101,25 +101,17 @@
+ 	my_elements=xNewZeroInit<bool>(iomodel->numberofelements);
+ 
+ 	/*Start figuring out, out of the partition, which elements belong to this cpu: */
+-	for (i=0;i<iomodel->numberofelements;i++){
++	for(i=0;i<iomodel->numberofelements;i++){
+ 
+ 		/*!All elements have been partitioned above, only deal with elements for this cpu: */
+ 		if(my_rank==epart[i]){ 
+-
+ 			my_elements[i]=true;
+-
+ 			/*Now that we are here, we can also start building the list of vertices belonging to this cpu partition: we use 
+ 			 *the  element index to do this. For each element n, we know index[n][0:2] holds the indices (matlab indexing) 
+ 			 into the vertices coordinates. If we start plugging 1 into my_vertices for each index[n][i] (i=0:2), then my_vertices 
+ 			 will hold which vertices belong to this partition*/
+-			my_vertices[iomodel->elements[elements_width*i+0]-1]=1;
+-			my_vertices[iomodel->elements[elements_width*i+1]-1]=1;
+-			my_vertices[iomodel->elements[elements_width*i+2]-1]=1;
+-
+-			if(elements_width==6){
+-				my_vertices[iomodel->elements[elements_width*i+3]-1]=1;
+-				my_vertices[iomodel->elements[elements_width*i+4]-1]=1;
+-				my_vertices[iomodel->elements[elements_width*i+5]-1]=1;
++			for(j=0;j<elements_width;j++){
++				my_vertices[iomodel->elements[elements_width*i+j]-1]=1;
+ 			}
+ 		}
+ 	}
Index: issm/oecreview/Archive/16554-17801/ISSM-17487-17488.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17487-17488.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17487-17488.diff	(revision 17802)
@@ -0,0 +1,166 @@
+Index: ../trunk-jpl/src/m/exp/expread.py
+===================================================================
+--- ../trunk-jpl/src/m/exp/expread.py	(revision 17487)
++++ ../trunk-jpl/src/m/exp/expread.py	(revision 17488)
+@@ -47,7 +47,7 @@
+ 		if not A:
+ 			break
+ 		A=A.split(None,1)
+-		if not (len(A) == 2 and m.strcmp(A[0],'##') and strncmp(A[1],'Name:',5)):
++		if not (len(A) == 2 and m.strcmp(A[0],'##') and m.strncmp(A[1],'Name:',5)):
+ 			break
+ 		if len(A[1])>5: 
+ 			contour['name']=A[1][5:-1]
+@@ -56,7 +56,7 @@
+ 
+ 		#Get Icon
+ 		A=fid.readline().split(None,1)
+-		if not (len(A) == 2 and m.strcmp(A[0],'##') and strncmp(A[1],'Icon:',5)):
++		if not (len(A) == 2 and m.strcmp(A[0],'##') and m.strncmp(A[1],'Icon:',5)):
+ 			break
+ 
+ 		#Get Info
+Index: ../trunk-jpl/src/m/mesh/ComputeHessian.py
+===================================================================
+--- ../trunk-jpl/src/m/mesh/ComputeHessian.py	(revision 17487)
++++ ../trunk-jpl/src/m/mesh/ComputeHessian.py	(revision 17488)
+@@ -37,19 +37,19 @@
+ 	areas=GetAreas(index,x,y)
+ 
+ 	#compute weights that hold the volume of all the element holding the node i
+-	weights=sparse(line,numpy.ones((linesize,1)),numpy.tile(areas.reshape(-1,1),(3,1)),numberofnodes,1)
++	weights=m.sparse(line,numpy.ones((linesize,1)),numpy.tile(areas.reshape(-1,1),(3,1)),numberofnodes,1)
+ 
+ 	#compute field on nodes if on elements
+ 	if numpy.size(field,axis=0)==numberofelements:
+-		field=sparse(line,numpy.ones((linesize,1)),numpy.tile(areas*field,(3,1)),numberofnodes,1)/weights
++		field=m.sparse(line,numpy.ones((linesize,1)),numpy.tile(areas*field,(3,1)),numberofnodes,1)/weights
+ 
+ 	#Compute gradient for each element
+ 	grad_elx=numpy.sum(field[index-1,0]*alpha,axis=1) 
+ 	grad_ely=numpy.sum(field[index-1,0]*beta,axis=1)
+ 
+ 	#Compute gradient for each node (average of the elements around)
+-	gradx=sparse(line,numpy.ones((linesize,1)),numpy.tile((areas*grad_elx).reshape(-1,1),(3,1)),numberofnodes,1)
+-	grady=sparse(line,numpy.ones((linesize,1)),numpy.tile((areas*grad_ely).reshape(-1,1),(3,1)),numberofnodes,1)
++	gradx=m.sparse(line,numpy.ones((linesize,1)),numpy.tile((areas*grad_elx).reshape(-1,1),(3,1)),numberofnodes,1)
++	grady=m.sparse(line,numpy.ones((linesize,1)),numpy.tile((areas*grad_ely).reshape(-1,1),(3,1)),numberofnodes,1)
+ 	gradx=gradx/weights
+ 	grady=grady/weights
+ 
+@@ -58,9 +58,9 @@
+ 
+ 	if m.strcmpi(type,'node'):
+ 		#Compute Hessian on the nodes (average of the elements around)
+-		hessian=numpy.hstack((sparse(line,numpy.ones((linesize,1)),numpy.tile((areas*hessian[:,0]).reshape(-1,1),(3,1)),numberofnodes,1)/weights, \
+-			sparse(line,numpy.ones((linesize,1)),numpy.tile((areas*hessian[:,1]).reshape(-1,1),(3,1)),numberofnodes,1)/weights, \
+-			sparse(line,numpy.ones((linesize,1)),numpy.tile((areas*hessian[:,2]).reshape(-1,1),(3,1)),numberofnodes,1)/weights ))
++		hessian=numpy.hstack((m.sparse(line,numpy.ones((linesize,1)),numpy.tile((areas*hessian[:,0]).reshape(-1,1),(3,1)),numberofnodes,1)/weights, \
++			m.sparse(line,numpy.ones((linesize,1)),numpy.tile((areas*hessian[:,1]).reshape(-1,1),(3,1)),numberofnodes,1)/weights, \
++			m.sparse(line,numpy.ones((linesize,1)),numpy.tile((areas*hessian[:,2]).reshape(-1,1),(3,1)),numberofnodes,1)/weights ))
+ 
+ 	return hessian
+ 
+Index: ../trunk-jpl/src/m/classes/model.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.py	(revision 17487)
++++ ../trunk-jpl/src/m/classes/model.py	(revision 17488)
+@@ -41,14 +41,14 @@
+ from miscellaneous import miscellaneous
+ from private import private
+ from EnumDefinitions import *
+-from mumpsoptions import *
+-from iluasmoptions import *
+-from project3d import *
+-from FlagElements import *
+-from NodeConnectivity import *
+-from ElementConnectivity import *
+-from contourenvelope import *
+-from PythonFuncs import *
++from mumpsoptions import mumpsoptions
++from iluasmoptions import iluasmoptions
++from project3d import project3d
++from FlagElements import FlagElements
++from NodeConnectivity import NodeConnectivity
++from ElementConnectivity import ElementConnectivity
++from contourenvelope import contourenvelope
++import MatlabFuncs as m
+ #}}}
+ 
+ class model(object):
+@@ -256,7 +256,7 @@
+ 			#get field
+ 			field=getattr(md1,fieldi)
+ 			fieldsize=numpy.shape(field)
+-			if hasattr(field,'__dict__') and not ismember(fieldi,['results'])[0]:    #recursive call
++			if hasattr(field,'__dict__') and not m.ismember(fieldi,['results'])[0]:    #recursive call
+ 				object_fields=vars(field)
+ 				for fieldj in object_fields:
+ 					#get field
+Index: ../trunk-jpl/src/m/parameterization/contourenvelope.py
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/contourenvelope.py	(revision 17487)
++++ ../trunk-jpl/src/m/parameterization/contourenvelope.py	(revision 17488)
+@@ -1,9 +1,10 @@
+ import os.path
+ import numpy
+ import copy
+-from NodeConnectivity import *
+-from ElementConnectivity import *
++from NodeConnectivity import NodeConnectivity
++from ElementConnectivity import ElementConnectivity
+ from mesh import *
++import MatlabFuncs as m
+ 
+ def contourenvelope(md,*args):
+ 	"""
+@@ -66,7 +67,7 @@
+ 			#modify element connectivity
+ 			elemout=numpy.nonzero(numpy.logical_not(elemin))[0]
+ 			mesh.elementconnectivity[elemout,:]=0
+-			mesh.elementconnectivity[numpy.nonzero(ismember(mesh.elementconnectivity,elemout+1))]=0
++			mesh.elementconnectivity[numpy.nonzero(m.ismember(mesh.elementconnectivity,elemout+1))]=0
+ 		else:
+ 			#get flag list of elements and nodes inside the contour
+ 			nodein=numpy.zeros(mesh.numberofvertices)
+@@ -79,7 +80,7 @@
+ 			#modify element connectivity
+ 			elemout=numpy.nonzero(numpy.logical_not(elemin))[0]
+ 			mesh.elementconnectivity[elemout,:]=0
+-			mesh.elementconnectivity[numpy.nonzero(ismember(mesh.elementconnectivity,elemout+1))]=0
++			mesh.elementconnectivity[numpy.nonzero(m.ismember(mesh.elementconnectivity,elemout+1))]=0
+ 
+ 	#Find element on boundary
+ 	#First: find elements on the boundary of the domain
+@@ -117,7 +118,7 @@
+ 			flag=numpy.setdiff1d(nods1,mesh.elements[els2,:])
+ 			for j in xrange(0,3):
+ 				nods=numpy.delete(nods1,j)
+-				if numpy.any(ismember(flag,nods)):
++				if numpy.any(m.ismember(flag,nods)):
+ 					segments[count,:]=[nods[0],nods[1],el1+1]
+ 					ord1=numpy.nonzero(nods[0]==mesh.elements[el1,:])[0][0]
+ 					ord2=numpy.nonzero(nods[1]==mesh.elements[el1,:])[0][0]
+Index: ../trunk-jpl/src/m/parameterization/setmask.py
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/setmask.py	(revision 17487)
++++ ../trunk-jpl/src/m/parameterization/setmask.py	(revision 17488)
+@@ -1,7 +1,8 @@
+ import numpy
+ import os
+ from model import *
+-from FlagElements import *
++from FlagElements import FlagElements
++import pairoptions
+ 
+ def setmask(md, floatingicename, groundedicename, *args):
+ 	"""
+@@ -27,7 +28,7 @@
+ 		raise TypeError("odd number of arguments provided in setmask")
+ 
+ 	#process options
+-	options=pairoptions(*args)
++	options=pairoptions.pairoptions(*args)
+ 
+ 	#Get assigned fields
+ 	x = md.mesh.x
Index: issm/oecreview/Archive/16554-17801/ISSM-17488-17489.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17488-17489.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17488-17489.diff	(revision 17802)
@@ -0,0 +1,31 @@
+Index: ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 17488)
++++ ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 17489)
+@@ -77,8 +77,6 @@
+ 		if(Ke) Ke->AddToGlobal(Kff,Kfs);
+ 		if(pe){
+ 			pe->AddToGlobal(pf);
+-			/* printf("-------------------USUAL \n"); */
+-			/* pf->Echo(); */
+ 		}
+ 		delete Ke;
+ 		delete pe;
+@@ -90,8 +88,6 @@
+ 		if(load->InAnalysis(configuration_type)){
+ 			load->CreateKMatrix(Kff,Kfs);
+ 			load->CreatePVector(pf);
+-			/* printf("-------------------LOADING \n"); */
+-			/* pf->Echo(); */
+ 		}
+ 	}
+ 
+@@ -102,8 +98,6 @@
+ 			if(load->InAnalysis(configuration_type)){
+ 				load->PenaltyCreateKMatrix(Kff,Kfs,kmax);
+ 				load->PenaltyCreatePVector(pf,kmax);
+-				/* printf("-------------------PENALTY \n"); */
+-				/* pf->Echo(); */
+ 			}
+ 		}
+ 	}
Index: issm/oecreview/Archive/16554-17801/ISSM-17489-17490.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17489-17490.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17489-17490.diff	(revision 17802)
@@ -0,0 +1,216 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp	(revision 17489)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp	(revision 17490)
+@@ -40,6 +40,18 @@
+ 		elementedges[2*1+0] = 2; elementedges[2*1+1] = 0; elementedges_markers[1] = 1;
+ 		elementedges[2*2+0] = 0; elementedges[2*2+1] = 1; elementedges_markers[2] = 1;
+ 	}
++	else if(iomodel->meshtype==Mesh3DtetrasEnum){
++		elementnbv = 4;
++		elementnbe = 6;
++		elementedges         = xNew<int>(elementnbe*2);
++		elementedges_markers = xNew<int>(elementnbe);
++		elementedges[2*0+0] = 1; elementedges[2*0+1] = 2; elementedges_markers[0] = 1;
++		elementedges[2*1+0] = 2; elementedges[2*1+1] = 0; elementedges_markers[1] = 1;
++		elementedges[2*2+0] = 0; elementedges[2*2+1] = 1; elementedges_markers[2] = 1;
++		elementedges[2*3+0] = 0; elementedges[2*3+1] = 3; elementedges_markers[3] = 1;
++		elementedges[2*4+0] = 1; elementedges[2*4+1] = 3; elementedges_markers[4] = 1;
++		elementedges[2*5+0] = 2; elementedges[2*5+1] = 3; elementedges_markers[5] = 1;
++	}
+ 	else if(iomodel->meshtype==Mesh3DEnum){
+ 		elementnbv = 6;
+ 		elementnbe = 9;
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/EdgesPartitioning.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/EdgesPartitioning.cpp	(revision 17489)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/EdgesPartitioning.cpp	(revision 17490)
+@@ -23,6 +23,9 @@
+ 	else if(iomodel->meshtype==Mesh2DverticalEnum){
+ 		elementnbe = 3;
+ 	}
++	else if(iomodel->meshtype==Mesh3DtetrasEnum){
++		elementnbe = 6;
++	}
+ 	else if(iomodel->meshtype==Mesh3DEnum){
+ 		elementnbe = 9;
+ 	}
+Index: ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 17489)
++++ ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 17490)
+@@ -63,8 +63,8 @@
+ 	AllocateSystemMatricesx(&Kff,&Kfs,&df,&pf,femmodel);
+ 
+ 	/*Display size*/
++	Kff->GetSize(&M,&N);
+ 	if(VerboseModule()){
+-		Kff->GetSize(&M,&N);
+ 		_printf0_(" (Kff stiffness matrix size: "<<M<<" x "<<N<<")\n");
+ 	}
+ 
+@@ -119,6 +119,8 @@
+ 	df->Assemble();
+ 	//Kff->AllocationInfo();
+ 	//Kfs->AllocationInfo();
++	//IssmDouble* k = Kff->ToSerial();
++	//printarray(k,N,N);
+ 
+ 	/*cleanu up and assign output pointers: */
+ 	delete analysis;
+Index: ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17489)
++++ ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17490)
+@@ -53,6 +53,7 @@
+ 			switch(iomodel->meshtype){
+ 				case Mesh2DhorizontalEnum: elementnbv = 3; break;
+ 				case Mesh2DverticalEnum:   elementnbv = 3; break;
++				case Mesh3DtetrasEnum:     elementnbv = 4; break;
+ 				case Mesh3DEnum:           elementnbv = 6; break;
+ 				default: _error_("mesh type not supported yet");
+ 			}
+Index: ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp	(revision 17489)
++++ ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp	(revision 17490)
+@@ -17,6 +17,7 @@
+ /*Element macros*/
+ #define NUMNODESP0  1
+ #define NUMNODESP1  4
++#define NUMNODESP1b 5
+ #define NUMNODESP2  10
+ 
+ /*Object constructors and destructor*/
+@@ -72,6 +73,15 @@
+ 			basis[2]=gauss->coord3;
+ 			basis[3]=gauss->coord4;
+ 			return;
++		case P1bubbleEnum: case P1bubblecondensedEnum:
++			/*Corner nodes*/
++			basis[0]=gauss->coord1;
++			basis[1]=gauss->coord2;
++			basis[2]=gauss->coord3;
++			basis[3]=gauss->coord4;
++			/*bubble*/
++			basis[4]=256.*gauss->coord1*gauss->coord2*gauss->coord3*gauss->coord4;
++			return;
+ 		case P2Enum:
+ 			/*Vertices*/
+ 			basis[0]=gauss->coord1*(2.*gauss->coord1-1.);
+@@ -170,6 +180,27 @@
+ 			dbasis[NUMNODESP1*1+3] = 0.;
+ 			dbasis[NUMNODESP1*2+3] = 1.;
+ 			return;
++		case P1bubbleEnum: case P1bubblecondensedEnum:
++			dbasis[NUMNODESP1b*0+0] = -1.;
++			dbasis[NUMNODESP1b*1+0] = -1.;
++			dbasis[NUMNODESP1b*2+0] = -1.;
++
++			dbasis[NUMNODESP1b*0+1] = 1.;
++			dbasis[NUMNODESP1b*1+1] = 0.;
++			dbasis[NUMNODESP1b*2+1] = 0.;
++
++			dbasis[NUMNODESP1b*0+2] = 0.;
++			dbasis[NUMNODESP1b*1+2] = 1.;
++			dbasis[NUMNODESP1b*2+2] = 0.;
++
++			dbasis[NUMNODESP1b*0+3] = 0.;
++			dbasis[NUMNODESP1b*1+3] = 0.;
++			dbasis[NUMNODESP1b*2+3] = 1.;
++
++			dbasis[NUMNODESP1b*0+4] = 256.*(-gauss->coord2*gauss->coord3*gauss->coord4+gauss->coord1*gauss->coord3*gauss->coord4);
++			dbasis[NUMNODESP1b*1+4] = 256.*(-gauss->coord2*gauss->coord3*gauss->coord4+gauss->coord1*gauss->coord2*gauss->coord4);
++			dbasis[NUMNODESP1b*2+4] = 256.*(-gauss->coord2*gauss->coord3*gauss->coord4+gauss->coord1*gauss->coord2*gauss->coord3);
++			return;
+ 		case P2Enum:
+ 			dbasis[NUMNODESP2*0+0] = -4.*gauss->coord1+1.;
+ 			dbasis[NUMNODESP2*1+0] = -4.*gauss->coord1+1.;
+@@ -371,10 +402,12 @@
+ int TetraRef::NumberofNodes(int finiteelement){
+ 
+ 	switch(finiteelement){
+-		case P0Enum:   return NUMNODESP0;
+-		case P1Enum:   return NUMNODESP1;
+-		case P1DGEnum: return NUMNODESP1;
+-		case P2Enum:   return NUMNODESP2;
++		case P0Enum:                return NUMNODESP0;
++		case P1Enum:                return NUMNODESP1;
++		case P1DGEnum:              return NUMNODESP1;
++		case P1bubbleEnum:          return NUMNODESP1b;
++		case P1bubblecondensedEnum: return NUMNODESP1b;
++		case P2Enum:                return NUMNODESP2;
+ 		default: _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+ 	}
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17489)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17490)
+@@ -737,6 +737,29 @@
+ 			tetra_node_ids[2]=iomodel->nodecounter+iomodel->elements[4*index+2];
+ 			tetra_node_ids[3]=iomodel->nodecounter+iomodel->elements[4*index+3];
+ 			break;
++		case P1bubbleEnum: case P1bubblecondensedEnum:
++			numnodes         = 5;
++			tetra_node_ids   = xNew<int>(numnodes);
++			tetra_node_ids[0]=iomodel->nodecounter+iomodel->elements[4*index+0];
++			tetra_node_ids[1]=iomodel->nodecounter+iomodel->elements[4*index+1];
++			tetra_node_ids[2]=iomodel->nodecounter+iomodel->elements[4*index+2];
++			tetra_node_ids[3]=iomodel->nodecounter+iomodel->elements[4*index+3];
++			tetra_node_ids[4]=iomodel->nodecounter+iomodel->numberofvertices+index+1;
++			break;
++		case P2Enum:
++			numnodes        = 10;
++			tetra_node_ids   = xNew<int>(numnodes);
++			tetra_node_ids[0]=iomodel->nodecounter+iomodel->elements[4*index+0];
++			tetra_node_ids[1]=iomodel->nodecounter+iomodel->elements[4*index+1];
++			tetra_node_ids[2]=iomodel->nodecounter+iomodel->elements[4*index+2];
++			tetra_node_ids[3]=iomodel->nodecounter+iomodel->elements[4*index+3];
++			tetra_node_ids[4]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+0]+1;
++			tetra_node_ids[5]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+1]+1;
++			tetra_node_ids[6]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+2]+1;
++			tetra_node_ids[7]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+3]+1;
++			tetra_node_ids[8]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+4]+1;
++			tetra_node_ids[9]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+5]+1;
++			break;
+ 		default:
+ 			_error_("Finite element "<<EnumToStringx(finiteelement_type)<<" not supported yet");
+ 	}
+Index: ../trunk-jpl/src/c/classes/gauss/GaussTetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussTetra.cpp	(revision 17489)
++++ ../trunk-jpl/src/c/classes/gauss/GaussTetra.cpp	(revision 17490)
+@@ -183,6 +183,32 @@
+ 				default: _error_("node index should be in [0 3]");
+ 			}
+ 			break;
++		case P1bubbleEnum: case P1bubblecondensedEnum:
++			switch(iv){
++				case 0: coord1=1.; coord2=0.; coord3=0.; coord4=0.; break;
++				case 1: coord1=0.; coord2=1.; coord3=0.; coord4=0.; break;
++				case 2: coord1=0.; coord2=0.; coord3=1.; coord4=0.; break;
++				case 3: coord1=0.; coord2=0.; coord3=0.; coord4=1.; break;
++				case 4: coord1=1./4.; coord2=1./4.; coord3=1./4.; coord4=1./4.; break;
++				default: _error_("node index should be in [0 4]");
++			}
++			break;
++		case P2Enum:
++			switch(iv){
++				case 0: coord1=1.; coord2=0.; coord3=0.; coord4=0.; break;
++				case 1: coord1=0.; coord2=1.; coord3=0.; coord4=0.; break;
++				case 2: coord1=0.; coord2=0.; coord3=1.; coord4=0.; break;
++				case 3: coord1=0.; coord2=0.; coord3=0.; coord4=1.; break;
++
++				case 4: coord1=0.; coord2=.5; coord3=.5; coord4=0.; break;
++				case 5: coord1=.5; coord2=0.; coord3=.5; coord4=0.; break;
++				case 6: coord1=.5; coord2=.5; coord3=0.; coord4=0.; break;
++				case 7: coord1=.5; coord2=0.; coord3=0.; coord4=.5; break;
++				case 8: coord1=0.; coord2=.5; coord3=0.; coord4=.5; break;
++				case 9: coord1=0.; coord2=0.; coord3=.5; coord4=.5; break;
++				default: _error_("node index should be in [0 9]");
++			}
++			break;
+ 		default: _error_("Finite element "<<EnumToStringx(finiteelement)<<" not supported");
+ 	}
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17490-17491.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17490-17491.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17490-17491.diff	(revision 17802)
@@ -0,0 +1,70 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17490)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17491)
+@@ -579,43 +579,34 @@
+ /*FUNCTION Tetra::ReduceMatrices{{{*/
+ void Tetra::ReduceMatrices(ElementMatrix* Ke,ElementVector* pe){
+ 
+-	int analysis_type;
+-	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-
+ 	if(pe){
+-		if(analysis_type==StressbalanceAnalysisEnum){
+-			if(this->element_type==MINIcondensedEnum){
+-				int approximation;
+-				inputs->GetInputValue(&approximation,ApproximationEnum);
+-				if(approximation==HOFSApproximationEnum || approximation==SSAFSApproximationEnum){
+-					//Do nothing, condensation already done in PVectorCoupling
+-				}
+-				else{
+-					_error_("Not implemented");
+-				}
+-			}
+-			else if(this->element_type==P1bubblecondensedEnum){
+-				_error_("Not implemented");
+-			}
++		if(this->element_type==MINIcondensedEnum){
++			_error_("Not implemented");
+ 		}
++		else if(this->element_type==P1bubblecondensedEnum){
++			int size   = nodes[4]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
++			int offset = 0;
++			for(int i=0;i<4;i++) offset+=nodes[i]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
++			int* indices=xNew<int>(size);
++			for(int i=0;i<size;i++) indices[i] = offset+i;
++			pe->StaticCondensation(Ke,size,indices);
++			xDelete<int>(indices);
++		}
+ 	}
+ 
+ 	if(Ke){
+-		if(analysis_type==StressbalanceAnalysisEnum){
+-			int approximation;
+-			inputs->GetInputValue(&approximation,ApproximationEnum);
+-			if(approximation==HOFSApproximationEnum || approximation==SSAFSApproximationEnum){
+-				//Do nothing condensatino already done for Stokes part
+-			}
+-			else{
+-				if(this->element_type==MINIcondensedEnum){
+-					_error_("Not implemented");
+-				}
+-				else if(this->element_type==P1bubblecondensedEnum){
+-					_error_("Not implemented");
+-				}
+-			}
++		if(this->element_type==MINIcondensedEnum){
++			_error_("Not implemented");
+ 		}
++		else if(this->element_type==P1bubblecondensedEnum){
++			int size   = nodes[4]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
++			int offset = 0;
++			for(int i=0;i<4;i++) offset+=nodes[i]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
++			int* indices=xNew<int>(size);
++			for(int i=0;i<size;i++) indices[i] = offset+i;
++			Ke->StaticCondensation(size,indices);
++			xDelete<int>(indices);
++		}
+ 	}
+ }
+ /*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17491-17492.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17491-17492.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17491-17492.diff	(revision 17802)
@@ -0,0 +1,23 @@
+Index: ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 17491)
++++ ../trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 17492)
+@@ -63,8 +63,8 @@
+ 	AllocateSystemMatricesx(&Kff,&Kfs,&df,&pf,femmodel);
+ 
+ 	/*Display size*/
+-	Kff->GetSize(&M,&N);
+ 	if(VerboseModule()){
++		Kff->GetSize(&M,&N);
+ 		_printf0_(" (Kff stiffness matrix size: "<<M<<" x "<<N<<")\n");
+ 	}
+ 
+@@ -119,8 +119,6 @@
+ 	df->Assemble();
+ 	//Kff->AllocationInfo();
+ 	//Kfs->AllocationInfo();
+-	//IssmDouble* k = Kff->ToSerial();
+-	//printarray(k,N,N);
+ 
+ 	/*cleanu up and assign output pointers: */
+ 	delete analysis;
Index: issm/oecreview/Archive/16554-17801/ISSM-17492-17493.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17492-17493.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17492-17493.diff	(revision 17802)
@@ -0,0 +1,451 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17492)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17493)
+@@ -421,7 +421,7 @@
+ 			iomodel->FetchData(&nodeonFS,NULL,NULL,FlowequationBorderFSEnum);
+ 			iomodel->FetchData(&nodeonbed,NULL,NULL,MeshVertexonbedEnum);
+ 			iomodel->FetchData(&groundedice_ls,NULL,NULL,MaskGroundediceLevelsetEnum);
+-			if(iomodel->meshtype==Mesh3DEnum){
++			if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh3DtetrasEnum){
+ 				iomodel->FetchData(&spcvz,&Mz,&Nz,StressbalanceSpcvzEnum);
+ 			}
+ 			else if (iomodel->meshtype==Mesh2DverticalEnum){
+@@ -430,7 +430,7 @@
+ 			else{
+ 				_error_("not supported yet");
+ 			}
+-			if(iomodel->meshtype==Mesh3DEnum){
++			if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh3DtetrasEnum){
+ 				IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvxEnum,StressbalanceAnalysisEnum,finiteelement,1);
+ 				IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvyEnum,StressbalanceAnalysisEnum,finiteelement,2);
+ 				IoModelToConstraintsx(constraints,iomodel,spcvz,Mz,Nz,StressbalanceAnalysisEnum,finiteelement,3);
+@@ -510,10 +510,10 @@
+ 	iomodel->FetchData(&spcvy,&My,&Ny,StressbalanceSpcvyEnum);
+ 	iomodel->FetchData(&spcvz,&Mz,&Nz,StressbalanceSpcvzEnum);
+ 	iomodel->FetchData(&nodeonSSA,NULL,NULL,FlowequationBorderSSAEnum);
+-	if(iomodel->meshtype==Mesh3DEnum)iomodel->FetchData(&nodeonHO,NULL,NULL,FlowequationBorderHOEnum);
+-	if(iomodel->meshtype==Mesh3DEnum)iomodel->FetchData(&nodeonFS,NULL,NULL,FlowequationBorderFSEnum);
+-	if(iomodel->meshtype==Mesh3DEnum)iomodel->FetchData(&nodeonbed,NULL,NULL,MeshVertexonbedEnum);
+-	if(iomodel->meshtype==Mesh3DEnum)iomodel->FetchData(&groundedice_ls,NULL,NULL,MaskGroundediceLevelsetEnum);
++	if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh3DtetrasEnum)iomodel->FetchData(&nodeonHO,NULL,NULL,FlowequationBorderHOEnum);
++	if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh3DtetrasEnum)iomodel->FetchData(&nodeonFS,NULL,NULL,FlowequationBorderFSEnum);
++	if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh3DtetrasEnum)iomodel->FetchData(&nodeonbed,NULL,NULL,MeshVertexonbedEnum);
++	if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh3DtetrasEnum)iomodel->FetchData(&groundedice_ls,NULL,NULL,MaskGroundediceLevelsetEnum);
+ 	iomodel->FetchData(&vertices_type,NULL,NULL,FlowequationVertexEquationEnum);
+ 	iomodel->FetchData(&surface,NULL,NULL,SurfaceEnum);
+ 	iomodel->FetchData(&z,NULL,NULL,MeshZEnum);
+@@ -740,10 +740,10 @@
+ 	iomodel->DeleteData(spcvy,StressbalanceSpcvyEnum);
+ 	iomodel->DeleteData(spcvz,StressbalanceSpcvzEnum);
+ 	iomodel->DeleteData(nodeonSSA,FlowequationBorderSSAEnum);
+-	if(iomodel->meshtype==Mesh3DEnum)iomodel->DeleteData(nodeonHO,FlowequationBorderHOEnum);
+-	if(iomodel->meshtype==Mesh3DEnum)iomodel->DeleteData(nodeonFS,FlowequationBorderFSEnum);
+-	if(iomodel->meshtype==Mesh3DEnum)iomodel->DeleteData(nodeonbed,MeshVertexonbedEnum);
+-	if(iomodel->meshtype==Mesh3DEnum)iomodel->DeleteData(groundedice_ls,MaskGroundediceLevelsetEnum);
++	if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh3DtetrasEnum)iomodel->DeleteData(nodeonHO,FlowequationBorderHOEnum);
++	if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh3DtetrasEnum)iomodel->DeleteData(nodeonFS,FlowequationBorderFSEnum);
++	if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh3DtetrasEnum)iomodel->DeleteData(nodeonbed,MeshVertexonbedEnum);
++	if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh3DtetrasEnum)iomodel->DeleteData(groundedice_ls,MaskGroundediceLevelsetEnum);
+ 	iomodel->DeleteData(vertices_type,FlowequationVertexEquationEnum);
+ 	iomodel->DeleteData(surface,SurfaceEnum);
+ 	iomodel->DeleteData(z,MeshZEnum);
+Index: ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp	(revision 17492)
++++ ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp	(revision 17493)
+@@ -101,6 +101,76 @@
+ 	}
+ }
+ /*}}}*/
++/*FUNCTION TetraRef::GetNodalFunctionsVelocity{{{*/
++void TetraRef::GetNodalFunctionsVelocity(IssmDouble* basis,GaussTetra* gauss){
++	/*This routine returns the values of the nodal functions  at the gaussian point.*/
++
++	switch(this->element_type){
++		case P1P1Enum:
++			this->element_type = P1Enum;
++			this->GetNodalFunctions(basis,gauss);
++			this->element_type = P1P1Enum;
++			return;
++		case P1P1GLSEnum:
++			this->element_type = P1Enum;
++			this->GetNodalFunctions(basis,gauss);
++			this->element_type = P1P1GLSEnum;
++			return;
++		case MINIcondensedEnum:
++			this->element_type = P1bubbleEnum;
++			this->GetNodalFunctions(basis,gauss);
++			this->element_type = MINIcondensedEnum;
++			return;
++		case MINIEnum:
++			this->element_type = P1bubbleEnum;
++			this->GetNodalFunctions(basis,gauss);
++			this->element_type = MINIEnum;
++			return;
++		case TaylorHoodEnum:
++			this->element_type = P2Enum;
++			this->GetNodalFunctions(basis,gauss);
++			this->element_type = TaylorHoodEnum;
++			return;
++		default:
++			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
++	}
++}
++/*}}}*/
++/*FUNCTION TetraRef::GetNodalFunctionsPressure{{{*/
++void TetraRef::GetNodalFunctionsPressure(IssmDouble* basis,GaussTetra* gauss){
++	/*This routine returns the values of the nodal functions  at the gaussian point.*/
++
++	switch(this->element_type){
++		case P1P1Enum:
++			this->element_type = P1Enum;
++			this->GetNodalFunctions(basis,gauss);
++			this->element_type = P1P1Enum;
++			return;
++		case P1P1GLSEnum:
++			this->element_type = P1Enum;
++			this->GetNodalFunctions(basis,gauss);
++			this->element_type = P1P1GLSEnum;
++			return;
++		case MINIcondensedEnum:
++			this->element_type = P1Enum;
++			this->GetNodalFunctions(basis,gauss);
++			this->element_type = MINIcondensedEnum;
++			return;
++		case MINIEnum:
++			this->element_type = P1Enum;
++			this->GetNodalFunctions(basis,gauss);
++			this->element_type = MINIEnum;
++			return;
++		case TaylorHoodEnum:
++			this->element_type = P1Enum;
++			this->GetNodalFunctions(basis,gauss);
++			this->element_type = TaylorHoodEnum;
++			return;
++		default:
++			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
++	}
++}
++/*}}}*/
+ /*FUNCTION TetraRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss){{{*/
+ void TetraRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss){
+ 	GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss,this->element_type);
+@@ -140,6 +210,72 @@
+ 	xDelete<IssmDouble>(dbasis_ref);
+ }
+ /*}}}*/
++/*FUNCTION TetraRef::GetNodalFunctionsDerivativesPressure         (THIS ONE and following ones){{{*/
++void TetraRef::GetNodalFunctionsDerivativesPressure(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss){
++	switch(this->element_type){
++		case P1P1Enum:
++			this->element_type = P1Enum;
++			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++			this->element_type = P1P1Enum;
++			return;
++		case P1P1GLSEnum:
++			this->element_type = P1Enum;
++			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++			this->element_type = P1P1GLSEnum;
++			return;
++		case MINIcondensedEnum:
++			this->element_type = P1Enum;
++			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++			this->element_type = MINIcondensedEnum;
++			return;
++		case MINIEnum:
++			this->element_type = P1Enum;
++			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++			this->element_type = MINIEnum;
++			return;
++		case TaylorHoodEnum:
++			this->element_type = P1Enum;
++			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++			this->element_type = TaylorHoodEnum;
++			return;
++		default:
++			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
++	}
++}
++/*}}}*/
++/*FUNCTION TetraRef::GetNodalFunctionsDerivativesVelocity{{{*/
++void TetraRef::GetNodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss){
++	switch(this->element_type){
++		case P1P1Enum:
++			this->element_type = P1Enum;
++			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++			this->element_type = P1P1Enum;
++			return;
++		case P1P1GLSEnum:
++			this->element_type = P1Enum;
++			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++			this->element_type = P1P1GLSEnum;
++			return;
++		case MINIcondensedEnum:
++			this->element_type = P1bubbleEnum;
++			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++			this->element_type = MINIcondensedEnum;
++			return;
++		case MINIEnum:
++			this->element_type = P1bubbleEnum;
++			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++			this->element_type = MINIEnum;
++			return;
++		case TaylorHoodEnum:
++			this->element_type = P2Enum;
++			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++			this->element_type = TaylorHoodEnum;
++			return;
++		default:
++			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
++	}
++}
++/*}}}*/
+ /*FUNCTION TetraRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTetra* gauss){{{*/
+ void TetraRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTetra* gauss){
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+@@ -414,3 +550,63 @@
+ 	return -1;
+ }
+ /*}}}*/
++/*FUNCTION TetraRef::NumberofNodesPressure{{{*/
++int TetraRef::NumberofNodesPressure(void){
++
++	switch(this->element_type){
++		case P1P1Enum:          return NUMNODESP1;
++		case P1P1GLSEnum:       return NUMNODESP1;
++		case MINIcondensedEnum: return NUMNODESP1;
++		case MINIEnum:          return NUMNODESP1;
++		case TaylorHoodEnum:    return NUMNODESP1;
++		default: _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
++	}
++
++	return -1;
++}
++/*}}}*/
++/*FUNCTION TetraRef::NumberofNodesVelocity{{{*/
++int TetraRef::NumberofNodesVelocity(void){
++
++	switch(this->element_type){
++		case P1P1Enum:          return NUMNODESP1;
++		case P1P1GLSEnum:       return NUMNODESP1;
++		case MINIcondensedEnum: return NUMNODESP1b;
++		case MINIEnum:          return NUMNODESP1b;
++		case TaylorHoodEnum:    return NUMNODESP2;
++		default:       _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
++	}
++
++	return -1;
++}
++/*}}}*/
++/*FUNCTION TetraRef::VelocityInterpolation{{{*/
++int TetraRef::VelocityInterpolation(void){
++
++	switch(this->element_type){
++		case P1P1Enum:          return P1Enum;
++		case P1P1GLSEnum:       return P1Enum;
++		case MINIcondensedEnum: return P1bubbleEnum;
++		case MINIEnum:          return P1bubbleEnum;
++		case TaylorHoodEnum:    return P2Enum;
++		default:       _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
++	}
++
++	return -1;
++}
++/*}}}*/
++/*FUNCTION TetraRef::PressureInterpolation{{{*/
++int TetraRef::PressureInterpolation(void){
++
++	switch(this->element_type){
++		case P1P1Enum:          return P1Enum;
++		case P1P1GLSEnum:       return P1Enum;
++		case MINIcondensedEnum: return P1Enum;
++		case MINIEnum:          return P1Enum;
++		case TaylorHoodEnum:    return P1Enum;
++		default:       _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
++	}
++
++	return -1;
++}
++/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17492)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17493)
+@@ -239,6 +239,16 @@
+ 	return NUMVERTICES;
+ }
+ /*}}}*/
++/*FUNCTION Tetra::GetNumberOfNodesPressure         THIS ONE (and corresponding TetraRef function){{{*/
++int Tetra::GetNumberOfNodesPressure(void){
++	return this->NumberofNodesPressure();
++}
++/*}}}*/
++/*FUNCTION Tetra::GetNumberOfNodesVelocity;{{{*/
++int Tetra::GetNumberOfNodesVelocity(void){
++	return this->NumberofNodesVelocity();
++}
++/*}}}*/
+ /*FUNCTION Tetra::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){{{*/
+ void Tetra::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){
+ 
+@@ -547,6 +557,22 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Tetra::NodalFunctionsVelocity{{{*/
++void Tetra::NodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussTetraEnum);
++	this->GetNodalFunctionsVelocity(basis,(GaussTetra*)gauss);
++
++}
++/*}}}*/
++/*FUNCTION Tetra::NodalFunctionsPressure{{{*/
++void Tetra::NodalFunctionsPressure(IssmDouble* basis, Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussTetraEnum);
++	this->GetNodalFunctionsPressure(basis,(GaussTetra*)gauss);
++
++}
++/*}}}*/
+ /*FUNCTION Tetra::NodalFunctionsDerivatives{{{*/
+ void Tetra::NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){
+ 
+@@ -555,6 +581,14 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Tetra::NodalFunctionsDerivativesVelocity{{{*/
++void Tetra::NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussTetraEnum);
++	this->GetNodalFunctionsDerivativesVelocity(dbasis,xyz_list,(GaussTetra*)gauss);
++
++}
++/*}}}*/
+ /*FUNCTION Tetra::NormalSection{{{*/
+ void Tetra::NormalSection(IssmDouble* normal,IssmDouble* xyz_list){
+ 
+@@ -576,6 +610,16 @@
+ 	for(int i=0;i<3;i++) normal[i]=normal[i]/norm;
+ }
+ /*}}}*/
++/*FUNCTION Tetra::NumberofNodesPressure{{{*/
++int Tetra::NumberofNodesPressure(void){
++	return TetraRef::NumberofNodesPressure();
++}
++/*}}}*/
++/*FUNCTION Tetra::NumberofNodesVelocity{{{*/
++int Tetra::NumberofNodesVelocity(void){
++	return TetraRef::NumberofNodesVelocity();
++}
++/*}}}*/
+ /*FUNCTION Tetra::ReduceMatrices{{{*/
+ void Tetra::ReduceMatrices(ElementMatrix* Ke,ElementVector* pe){
+ 
+@@ -751,6 +795,38 @@
+ 			tetra_node_ids[8]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+4]+1;
+ 			tetra_node_ids[9]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+5]+1;
+ 			break;
++		case MINIEnum: case MINIcondensedEnum:
++			numnodes         = 9;
++			tetra_node_ids   = xNew<int>(numnodes);
++			tetra_node_ids[0]=iomodel->nodecounter+iomodel->elements[4*index+0];
++			tetra_node_ids[1]=iomodel->nodecounter+iomodel->elements[4*index+1];
++			tetra_node_ids[2]=iomodel->nodecounter+iomodel->elements[4*index+2];
++			tetra_node_ids[3]=iomodel->nodecounter+iomodel->elements[4*index+3];
++			tetra_node_ids[4]=iomodel->nodecounter+iomodel->numberofvertices+index+1;
++
++			tetra_node_ids[5]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofelements+iomodel->elements[4*index+0];
++			tetra_node_ids[6]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofelements+iomodel->elements[4*index+1];
++			tetra_node_ids[7]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofelements+iomodel->elements[4*index+2];
++			tetra_node_ids[8]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofelements+iomodel->elements[4*index+3];
++			break;
++			numnodes        = 14;
++			tetra_node_ids   = xNew<int>(numnodes);
++			tetra_node_ids[0]=iomodel->nodecounter+iomodel->elements[4*index+0];
++			tetra_node_ids[1]=iomodel->nodecounter+iomodel->elements[4*index+1];
++			tetra_node_ids[2]=iomodel->nodecounter+iomodel->elements[4*index+2];
++			tetra_node_ids[3]=iomodel->nodecounter+iomodel->elements[4*index+3];
++			tetra_node_ids[4]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+0]+1;
++			tetra_node_ids[5]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+1]+1;
++			tetra_node_ids[6]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+2]+1;
++			tetra_node_ids[7]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+3]+1;
++			tetra_node_ids[8]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+4]+1;
++			tetra_node_ids[9]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+5]+1;
++
++			tetra_node_ids[10]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofedges+iomodel->elements[4*index+0];
++			tetra_node_ids[11]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofedges+iomodel->elements[4*index+1];
++			tetra_node_ids[12]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofedges+iomodel->elements[4*index+2];
++			tetra_node_ids[13]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofedges+iomodel->elements[4*index+3];
++			break;
+ 		default:
+ 			_error_("Finite element "<<EnumToStringx(finiteelement_type)<<" not supported yet");
+ 	}
+Index: ../trunk-jpl/src/c/classes/Elements/TetraRef.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TetraRef.h	(revision 17492)
++++ ../trunk-jpl/src/c/classes/Elements/TetraRef.h	(revision 17493)
+@@ -28,8 +28,12 @@
+ 		void GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,GaussTetra* gauss);
+ 		void GetNodalFunctions(IssmDouble* basis,GaussTetra* gauss);
+ 		void GetNodalFunctions(IssmDouble* basis,GaussTetra* gauss,int finiteelement);
++		void GetNodalFunctionsVelocity(IssmDouble* basis, GaussTetra* gauss);
++		void GetNodalFunctionsPressure(IssmDouble* basis, GaussTetra* gauss);
+ 		void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss);
+ 		void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss,int finiteelement);
++		void GetNodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,GaussTetra* gauss);
++		void GetNodalFunctionsDerivativesPressure(IssmDouble* dbasis,IssmDouble* xyz_list,GaussTetra* gauss);
+ 		void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTetra* gauss);
+ 		void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTetra* gauss,int finiteelement);
+ 		void GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, GaussTetra* gauss);
+@@ -38,5 +42,9 @@
+ 
+ 		int  NumberofNodes(void);
+ 		int  NumberofNodes(int finiteelement);
++		int  NumberofNodesVelocity(void);
++		int  NumberofNodesPressure(void);
++		int  VelocityInterpolation(void);
++		int  PressureInterpolation(void);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17492)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17493)
+@@ -80,8 +80,8 @@
+ 		Element*    GetBasalElement(void){_error_("not implemented yet");};
+ 		int         GetNodeIndex(Node* node){_error_("not implemented yet");};
+ 		int         GetNumberOfNodes(void);
+-		int         GetNumberOfNodesVelocity(void){_error_("not implemented yet");};
+-		int         GetNumberOfNodesPressure(void){_error_("not implemented yet");};
++		int         GetNumberOfNodesVelocity(void);
++		int         GetNumberOfNodesPressure(void);
+ 		int         GetNumberOfVertices(void);
+ 		void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list);
+ 		void        GetVerticesCoordinatesTop(IssmDouble** pxyz_list);
+@@ -99,18 +99,18 @@
+ 		IssmDouble  MinEdgeLength(IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		void        NodalFunctions(IssmDouble* basis,Gauss* gauss);
+ 		void        NodalFunctionsP1(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+-		void        NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+-		void        NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
++		void        NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss);
++		void        NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss);
+ 		void        NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+ 		void        NodalFunctionsP1Derivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsMINIDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+-		void        NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
++		void        NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+ 		bool        IsIceInElement();
+ 		void        NormalSection(IssmDouble* normal,IssmDouble* xyz_list);
+ 		void        NormalTop(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		void        NormalBase(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+-		int         NumberofNodesVelocity(void){_error_("not implemented yet");};
+-		int         NumberofNodesPressure(void){_error_("not implemented yet");};
++		int         NumberofNodesVelocity(void);
++		int         NumberofNodesPressure(void);
+ 	   Element*    SpawnBasalElement(void){_error_("not implemented yet");};
+ 		Element*    SpawnTopElement(void){_error_("not implemented yet");};
+ 		IssmDouble  StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-17493-17494.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17493-17494.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17493-17494.diff	(revision 17802)
@@ -0,0 +1,393 @@
+Index: ../trunk-jpl/m4/issm_options.m4
+===================================================================
+--- ../trunk-jpl/m4/issm_options.m4	(revision 17493)
++++ ../trunk-jpl/m4/issm_options.m4	(revision 17494)
+@@ -1710,6 +1710,20 @@
+ 	AM_CONDITIONAL([DAMAGEEVOLUTION], [test x$HAVE_DAMAGEEVOLUTION = xyes])
+ 	AC_MSG_RESULT($HAVE_DAMAGEEVOLUTION)
+ 	dnl }}}
++	dnl with-DepthAverage{{{
++	AC_ARG_WITH([DepthAverage],
++		AS_HELP_STRING([--with-DepthAverage = YES], [compile with DepthAverage capabilities (default is yes)]),
++		[DEPTHAVERAGE=$withval],[DEPTHAVERAGE=yes]) 
++	AC_MSG_CHECKING(for DepthAverage capability compilation)
++
++	HAVE_DEPTHAVERAGE=no
++	if test "x$DEPTHAVERAGE" = "xyes"; then
++		HAVE_DEPTHAVERAGE=yes
++		AC_DEFINE([_HAVE_DEPTHAVERAGE_],[1],[with DepthAverage capability])
++	fi
++	AM_CONDITIONAL([DEPTHAVERAGE], [test x$HAVE_DEPTHAVERAGE = xyes])
++	AC_MSG_RESULT($HAVE_DEPTHAVERAGE)
++	dnl }}}
+ 	dnl with-stressbalance{{{
+ 	AC_ARG_WITH([stressbalance],
+ 		AS_HELP_STRING([--with-stressbalance = YES], [compile with stressbalance capabilities (default is yes)]),
+Index: ../trunk-jpl/src/c/analyses/EnumToAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnumToAnalysis.cpp	(revision 17493)
++++ ../trunk-jpl/src/c/analyses/EnumToAnalysis.cpp	(revision 17494)
+@@ -76,6 +76,9 @@
+ 		#ifdef _HAVE_EXTRUDEFROMTOP_
+ 		case ExtrudeFromTopAnalysisEnum : return new ExtrudeFromTopAnalysis();
+ 		#endif
++		#ifdef _HAVE_DEPTHAVERAGE_
++		case DepthAverageAnalysisEnum : return new DepthAverageAnalysis();
++		#endif
+ 		#ifdef _HAVE_SMOOTHEDSURFACESLOPEX_
+ 		case SmoothedSurfaceSlopeXAnalysisEnum : return new SmoothedSurfaceSlopeXAnalysis();
+ 		#endif
+Index: ../trunk-jpl/src/c/analyses/DepthAverageAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DepthAverageAnalysis.h	(revision 0)
++++ ../trunk-jpl/src/c/analyses/DepthAverageAnalysis.h	(revision 17494)
+@@ -0,0 +1,33 @@
++/*! \file DepthAverageAnalysis.h 
++ *  \brief: header file for generic external result object
++ */
++
++#ifndef _DepthAverageAnalysis_
++#define _DepthAverageAnalysis_
++
++/*Headers*/
++#include "./Analysis.h"
++
++class DepthAverageAnalysis: public Analysis{
++
++	public:
++		/*Model processing*/
++		int  DofsPerNode(int** doflist,int meshtype,int approximation);
++		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
++		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
++		void CreateNodes(Nodes* nodes,IoModel* iomodel);
++		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
++		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
++		ElementVector* CreateDVector(Element* element);
++		ElementMatrix* CreateJacobianMatrix(Element* element);
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
++		void GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
++};
++#endif
+Index: ../trunk-jpl/src/c/analyses/DepthAverageAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DepthAverageAnalysis.cpp	(revision 0)
++++ ../trunk-jpl/src/c/analyses/DepthAverageAnalysis.cpp	(revision 17494)
+@@ -0,0 +1,133 @@
++#include "./DepthAverageAnalysis.h"
++#include "../toolkits/toolkits.h"
++#include "../classes/classes.h"
++#include "../shared/shared.h"
++#include "../modules/modules.h"
++
++/*Model processing*/
++int  DepthAverageAnalysis::DofsPerNode(int** doflist,int meshtype,int approximation){/*{{{*/
++	return 1;
++}/*}}}*/
++void DepthAverageAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
++}/*}}}*/
++void DepthAverageAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
++
++	int counter=0;
++	for(int i=0;i<iomodel->numberofelements;i++){
++		if(iomodel->my_elements[i]){
++			Element* element=(Element*)elements->GetObjectByOffset(counter);
++			element->Update(i,iomodel,analysis_counter,analysis_type,P1Enum);
++			counter++;
++		}
++	}
++
++	if(iomodel->meshtype==Mesh2DverticalEnum){
++		iomodel->FetchDataToInput(elements,MeshVertexonbedEnum);
++	}
++}/*}}}*/
++void DepthAverageAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
++
++	::CreateNodes(nodes,iomodel,DepthAverageAnalysisEnum,P1Enum);
++
++}/*}}}*/
++void DepthAverageAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
++}/*}}}*/
++void DepthAverageAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
++}/*}}}*/
++
++/*Finite Element Analysis*/
++void           DepthAverageAnalysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented");
++}/*}}}*/
++ElementVector* DepthAverageAnalysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
++ElementMatrix* DepthAverageAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
++ElementMatrix* DepthAverageAnalysis::CreateKMatrix(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	IssmDouble  Jdet,D;
++	IssmDouble *xyz_list = NULL;
++
++	/*Get dimension*/
++	int dim,meshtype;
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; break;
++		case Mesh3DEnum:         dim = 3; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementMatrix* Ke     = element->NewElementMatrix();
++	IssmDouble*    B      = xNew<IssmDouble>(numnodes);
++	IssmDouble*    Bprime = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctions(Bprime,gauss);
++		GetB(B,element,dim,xyz_list,gauss);
++		D=gauss->weight*Jdet;
++
++		TripleMultiply(B,1,numnodes,1,
++					&D,1,1,0,
++					Bprime,1,numnodes,0,
++					&Ke->values[0],1);
++	} 
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(B);
++	xDelete<IssmDouble>(Bprime);
++	delete gauss;
++	return Ke;
++}/*}}}*/
++ElementVector* DepthAverageAnalysis::CreatePVector(Element* element){/*{{{*/
++	return NULL;
++}/*}}}*/
++void DepthAverageAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*	Compute B  matrix. B=[dh1/dz dh2/dz dh3/dz dh4/dz dh5/dz dh6/dz];
++		where hi is the interpolation function for node i.*/
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* dbasis=xNew<IssmDouble>(dim*numnodes);
++	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Build B: */
++	for(int i=0;i<numnodes;i++){
++		B[i] = dbasis[(dim-1)*numnodes+i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(dbasis);
++}
++/*}}}*/
++void DepthAverageAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	   _error_("not implemented yet");
++}/*}}}*/
++void DepthAverageAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++
++	int inputenum;
++	element->FindParam(&inputenum,InputToDepthaverageEnum);
++	element->InputUpdateFromSolutionOneDof(solution,inputenum);
++}/*}}}*/
++void DepthAverageAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/analyses.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/analyses.h	(revision 17493)
++++ ../trunk-jpl/src/c/analyses/analyses.h	(revision 17494)
+@@ -13,6 +13,7 @@
+ #include "./BalancethicknessSoftAnalysis.h"
+ #include "./BalancevelocityAnalysis.h"
+ #include "./DamageEvolutionAnalysis.h"
++#include "./DepthAverageAnalysis.h"
+ #include "./EnthalpyAnalysis.h"
+ #include "./ExtrudeFromBaseAnalysis.h"
+ #include "./ExtrudeFromTopAnalysis.h"
+Index: ../trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp	(revision 17493)
++++ ../trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp	(revision 17494)
+@@ -45,7 +45,7 @@
+ 
+ 	file_line= what_line;
+ 	/*When error messages are not shown properly, uncomment the following line*/
+-	//this->Report();
++	this->Report();
+ 
+ }/*}}}*/
+ ErrorException::~ErrorException() throw(){/*{{{*/
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17493)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17494)
+@@ -345,6 +345,7 @@
+ 	SurfaceNormalVelocityEnum,
+ 	ExtrudeFromBaseAnalysisEnum,
+ 	ExtrudeFromTopAnalysisEnum,
++	DepthAverageAnalysisEnum,
+ 	SteadystateSolutionEnum,
+ 	SurfaceSlopeSolutionEnum,
+ 	SmoothedSurfaceSlopeXAnalysisEnum,
+@@ -405,6 +406,7 @@
+ 	IntInputEnum,
+ 	InputToExtrudeEnum,
+ 	InputToL2ProjectEnum,
++	InputToDepthaverageEnum,
+ 	IntParamEnum,
+ 	IntVecParamEnum,
+ 	TransientParamEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17493)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17494)
+@@ -346,6 +346,7 @@
+ 		case SurfaceNormalVelocityEnum : return "SurfaceNormalVelocity";
+ 		case ExtrudeFromBaseAnalysisEnum : return "ExtrudeFromBaseAnalysis";
+ 		case ExtrudeFromTopAnalysisEnum : return "ExtrudeFromTopAnalysis";
++		case DepthAverageAnalysisEnum : return "DepthAverageAnalysis";
+ 		case SteadystateSolutionEnum : return "SteadystateSolution";
+ 		case SurfaceSlopeSolutionEnum : return "SurfaceSlopeSolution";
+ 		case SmoothedSurfaceSlopeXAnalysisEnum : return "SmoothedSurfaceSlopeXAnalysis";
+@@ -400,6 +401,7 @@
+ 		case IntInputEnum : return "IntInput";
+ 		case InputToExtrudeEnum : return "InputToExtrude";
+ 		case InputToL2ProjectEnum : return "InputToL2Project";
++		case InputToDepthaverageEnum : return "InputToDepthaverage";
+ 		case IntParamEnum : return "IntParam";
+ 		case IntVecParamEnum : return "IntVecParam";
+ 		case TransientParamEnum : return "TransientParam";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17493)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17494)
+@@ -352,6 +352,7 @@
+ 	      else if (strcmp(name,"SurfaceNormalVelocity")==0) return SurfaceNormalVelocityEnum;
+ 	      else if (strcmp(name,"ExtrudeFromBaseAnalysis")==0) return ExtrudeFromBaseAnalysisEnum;
+ 	      else if (strcmp(name,"ExtrudeFromTopAnalysis")==0) return ExtrudeFromTopAnalysisEnum;
++	      else if (strcmp(name,"DepthAverageAnalysis")==0) return DepthAverageAnalysisEnum;
+ 	      else if (strcmp(name,"SteadystateSolution")==0) return SteadystateSolutionEnum;
+ 	      else if (strcmp(name,"SurfaceSlopeSolution")==0) return SurfaceSlopeSolutionEnum;
+ 	      else if (strcmp(name,"SmoothedSurfaceSlopeXAnalysis")==0) return SmoothedSurfaceSlopeXAnalysisEnum;
+@@ -381,11 +382,11 @@
+ 	      else if (strcmp(name,"Constraints")==0) return ConstraintsEnum;
+ 	      else if (strcmp(name,"Loads")==0) return LoadsEnum;
+ 	      else if (strcmp(name,"Materials")==0) return MaterialsEnum;
+-	      else if (strcmp(name,"Nodes")==0) return NodesEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"Contours")==0) return ContoursEnum;
++	      if (strcmp(name,"Nodes")==0) return NodesEnum;
++	      else if (strcmp(name,"Contours")==0) return ContoursEnum;
+ 	      else if (strcmp(name,"Parameters")==0) return ParametersEnum;
+ 	      else if (strcmp(name,"Vertices")==0) return VerticesEnum;
+ 	      else if (strcmp(name,"Results")==0) return ResultsEnum;
+@@ -409,6 +410,7 @@
+ 	      else if (strcmp(name,"IntInput")==0) return IntInputEnum;
+ 	      else if (strcmp(name,"InputToExtrude")==0) return InputToExtrudeEnum;
+ 	      else if (strcmp(name,"InputToL2Project")==0) return InputToL2ProjectEnum;
++	      else if (strcmp(name,"InputToDepthaverage")==0) return InputToDepthaverageEnum;
+ 	      else if (strcmp(name,"IntParam")==0) return IntParamEnum;
+ 	      else if (strcmp(name,"IntVecParam")==0) return IntVecParamEnum;
+ 	      else if (strcmp(name,"TransientParam")==0) return TransientParamEnum;
+@@ -503,12 +505,12 @@
+ 	      else if (strcmp(name,"VyAverage")==0) return VyAverageEnum;
+ 	      else if (strcmp(name,"Vy")==0) return VyEnum;
+ 	      else if (strcmp(name,"VyPicard")==0) return VyPicardEnum;
+-	      else if (strcmp(name,"Vz")==0) return VzEnum;
+-	      else if (strcmp(name,"VzSSA")==0) return VzSSAEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"VzHO")==0) return VzHOEnum;
++	      if (strcmp(name,"Vz")==0) return VzEnum;
++	      else if (strcmp(name,"VzSSA")==0) return VzSSAEnum;
++	      else if (strcmp(name,"VzHO")==0) return VzHOEnum;
+ 	      else if (strcmp(name,"VzPicard")==0) return VzPicardEnum;
+ 	      else if (strcmp(name,"VzFS")==0) return VzFSEnum;
+ 	      else if (strcmp(name,"VxMesh")==0) return VxMeshEnum;
+@@ -626,12 +628,12 @@
+ 	      else if (strcmp(name,"OldGradient")==0) return OldGradientEnum;
+ 	      else if (strcmp(name,"OutputFilePointer")==0) return OutputFilePointerEnum;
+ 	      else if (strcmp(name,"OutputFileName")==0) return OutputFileNameEnum;
+-	      else if (strcmp(name,"LockFileName")==0) return LockFileNameEnum;
+-	      else if (strcmp(name,"ToolkitsOptionsAnalyses")==0) return ToolkitsOptionsAnalysesEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"ToolkitsOptionsStrings")==0) return ToolkitsOptionsStringsEnum;
++	      if (strcmp(name,"LockFileName")==0) return LockFileNameEnum;
++	      else if (strcmp(name,"ToolkitsOptionsAnalyses")==0) return ToolkitsOptionsAnalysesEnum;
++	      else if (strcmp(name,"ToolkitsOptionsStrings")==0) return ToolkitsOptionsStringsEnum;
+ 	      else if (strcmp(name,"QmuErrName")==0) return QmuErrNameEnum;
+ 	      else if (strcmp(name,"QmuInName")==0) return QmuInNameEnum;
+ 	      else if (strcmp(name,"QmuOutName")==0) return QmuOutNameEnum;
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17493)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17494)
+@@ -367,6 +367,7 @@
+ 					./cores/transient_core.cpp\
+ 					./cores/steadystate_core.cpp\
+ 					./cores/masstransport_core.cpp\
++					./cores/depthaverage_core.cpp\
+ 					./cores/extrudefrombase_core.cpp\
+ 					./cores/extrudefromtop_core.cpp\
+ 					./cores/thermal_core.cpp\
+@@ -573,6 +574,9 @@
+ if EXTRUDEFROMTOP
+ issm_sources += ./analyses/ExtrudeFromTopAnalysis.cpp
+ endif
++if DEPTHAVERAGE
++issm_sources += ./analyses/DepthAverageAnalysis.cpp
++endif
+ if THERMAL
+ issm_sources += ./analyses/ThermalAnalysis.cpp
+ endif
+Index: ../trunk-jpl/src/c/cores/depthaverage_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/depthaverage_core.cpp	(revision 0)
++++ ../trunk-jpl/src/c/cores/depthaverage_core.cpp	(revision 17494)
+@@ -0,0 +1,20 @@
++/*!\file: depthaverage_core.cpp
++ * \brief: core of the extrusion solution
++ */ 
++
++#include "./cores.h"
++#include "../toolkits/toolkits.h"
++#include "../classes/classes.h"
++#include "../shared/shared.h"
++#include "../solutionsequences/solutionsequences.h"
++#include "../modules/modules.h"
++
++void depthaverage_core(FemModel* femmodel){
++
++	if(VerboseSolution()) _printf0_("extruding solution from base...\n");
++
++	/*Call on core computations: */
++	femmodel->SetCurrentConfiguration(DepthAverageAnalysisEnum);
++	solutionsequence_linear(femmodel);
++
++}
Index: issm/oecreview/Archive/16554-17801/ISSM-17494-17495.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17494-17495.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17494-17495.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp	(revision 17494)
++++ ../trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp	(revision 17495)
+@@ -45,7 +45,7 @@
+ 
+ 	file_line= what_line;
+ 	/*When error messages are not shown properly, uncomment the following line*/
+-	this->Report();
++	//this->Report();
+ 
+ }/*}}}*/
+ ErrorException::~ErrorException() throw(){/*{{{*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17495-17496.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17495-17496.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17495-17496.diff	(revision 17802)
@@ -0,0 +1,19 @@
+Index: ../trunk-jpl/src/m/parameterization/setflowequation.py
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/setflowequation.py	(revision 17495)
++++ ../trunk-jpl/src/m/parameterization/setflowequation.py	(revision 17496)
+@@ -49,11 +49,11 @@
+ 
+ 	#Flag the elements that have not been flagged as filltype
+ 	if   m.strcmpi(filltype,'SIA'):
+-		SIAflag[numpy.nonzero(numpy.logical_not(logical_or_n(SSAflag,HOflag)))]=True
++		SIAflag[numpy.nonzero(numpy.logical_not(p.logical_or_n(SSAflag,HOflag)))]=True
+ 	elif m.strcmpi(filltype,'SSA'):
+-		SSAflag[numpy.nonzero(numpy.logical_not(logical_or_n(SIAflag,HOflag,FSflag)))]=True
++		SSAflag[numpy.nonzero(numpy.logical_not(p.logical_or_n(SIAflag,HOflag,FSflag)))]=True
+ 	elif m.strcmpi(filltype,'HO'):
+-		HOflag[numpy.nonzero(numpy.logical_not(logical_or_n(SIAflag,SSAflag,FSflag)))]=True
++		HOflag[numpy.nonzero(numpy.logical_not(p.logical_or_n(SIAflag,SSAflag,FSflag)))]=True
+ 
+ 	#check that each element has at least one flag
+ 	if not any(SIAflag+SSAflag+L1L2flag+HOflag+FSflag):
Index: issm/oecreview/Archive/16554-17801/ISSM-17496-17497.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17496-17497.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17496-17497.diff	(revision 17802)
@@ -0,0 +1,797 @@
+Index: ../trunk-jpl/src/m/solve/marshall.py
+===================================================================
+--- ../trunk-jpl/src/m/solve/marshall.py	(revision 17496)
++++ ../trunk-jpl/src/m/solve/marshall.py	(revision 17497)
+@@ -1,4 +1,4 @@
+-from WriteData import *
++from WriteData import WriteData
+ from EnumDefinitions import *
+ 
+ def marshall(md):
+Index: ../trunk-jpl/src/m/plot/plot_manager.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_manager.py	(revision 17496)
++++ ../trunk-jpl/src/m/plot/plot_manager.py	(revision 17497)
+@@ -4,7 +4,6 @@
+ except ImportError:
+ 	print "could not import pylab, matplotlib has not been installed, no plotting capabilities enabled"
+ 
+-from pairoptions import *
+ from checkplotoptions import checkplotoptions
+ from plot_mesh import plot_mesh
+ from processmesh import processmesh
+Index: ../trunk-jpl/src/m/plot/plotmodel.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plotmodel.py	(revision 17496)
++++ ../trunk-jpl/src/m/plot/plotmodel.py	(revision 17497)
+@@ -5,7 +5,6 @@
+ except ImportError:
+ 	print "could not import pylab, matplotlib has not been installed, no plotting capabilities enabled"
+ 
+-#from pairoptions import *
+ from plotoptions import plotoptions
+ from plot_manager import plot_manager
+ from math import ceil, sqrt
+Index: ../trunk-jpl/src/m/mesh/meshconvert.py
+===================================================================
+--- ../trunk-jpl/src/m/mesh/meshconvert.py	(revision 17496)
++++ ../trunk-jpl/src/m/mesh/meshconvert.py	(revision 17497)
+@@ -1,8 +1,8 @@
+ import numpy
+ from collections import OrderedDict
+-from BamgConvertMesh import *
+-from bamgmesh import *
+-from bamggeom import *
++from BamgConvertMesh import BamgConvertMesh 
++from bamgmesh import bamgmesh
++from bamggeom import bamggeom
+ 
+ def meshconvert(md,*args):
+ 	"""
+Index: ../trunk-jpl/src/m/mesh/rifts/meshprocessrifts.py
+===================================================================
+--- ../trunk-jpl/src/m/mesh/rifts/meshprocessrifts.py	(revision 17496)
++++ ../trunk-jpl/src/m/mesh/rifts/meshprocessrifts.py	(revision 17497)
+@@ -1,8 +1,8 @@
+ import numpy
+-from TriMeshProcessRifts import *
+-from ContourToMesh import *
+-from meshprocessoutsiderifts import *
+-from GetAreas import *
++from TriMeshProcessRifts import TriMeshProcessRifts
++from ContourToMesh import ContourToMesh
++from meshprocessoutsiderifts import meshprocessoutsiderifts
++from GetAreas import GetAreas
+ 
+ def meshprocessrifts(md,domainoutline):
+ 	"""
+Index: ../trunk-jpl/src/m/mesh/roundmesh.py
+===================================================================
+--- ../trunk-jpl/src/m/mesh/roundmesh.py	(revision 17496)
++++ ../trunk-jpl/src/m/mesh/roundmesh.py	(revision 17497)
+@@ -1,9 +1,8 @@
+ import numpy
+ import os
+ from collections import OrderedDict
+-from expwrite import *
+-from triangle import *
+-#from bamg import *
++from expwrite import expwrite
++from triangle import triangle
+ 
+ def roundmesh(md,radius,resolution):
+ 	"""
+Index: ../trunk-jpl/src/m/mesh/squaremesh.py
+===================================================================
+--- ../trunk-jpl/src/m/mesh/squaremesh.py	(revision 17496)
++++ ../trunk-jpl/src/m/mesh/squaremesh.py	(revision 17497)
+@@ -1,6 +1,6 @@
+ import numpy
+-from NodeConnectivity import *
+-from ElementConnectivity import *
++from NodeConnectivity import NodeConnectivity
++from ElementConnectivity import ElementConnectivity 
+ 
+ def squaremesh(md,Lx,Ly,nx,ny):
+ 	"""
+Index: ../trunk-jpl/src/m/mesh/ElementsFromEdge.py
+===================================================================
+--- ../trunk-jpl/src/m/mesh/ElementsFromEdge.py	(revision 17496)
++++ ../trunk-jpl/src/m/mesh/ElementsFromEdge.py	(revision 17497)
+@@ -1,5 +1,5 @@
+ import numpy
+-from PythonFuncs import *
++import PythonFuncs as p
+ 
+ def ElementsFromEdge(elements,A,B):
+ 	"""
+@@ -12,7 +12,7 @@
+ 	"""
+ 
+ 	edgeelements=numpy.nonzero(\
+-		logical_or_n(numpy.logical_and(elements[:,0]==A,elements[:,1]==B), \
++		p.logical_or_n(numpy.logical_and(elements[:,0]==A,elements[:,1]==B), \
+ 					 numpy.logical_and(elements[:,0]==A,elements[:,2]==B), \
+ 					 numpy.logical_and(elements[:,1]==A,elements[:,2]==B), \
+ 					 numpy.logical_and(elements[:,1]==A,elements[:,0]==B), \
+Index: ../trunk-jpl/src/m/classes/massfluxatgate.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/massfluxatgate.py	(revision 17496)
++++ ../trunk-jpl/src/m/classes/massfluxatgate.py	(revision 17497)
+@@ -1,8 +1,8 @@
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from WriteData import *
+-from MeshProfileIntersection import *
++from checkfield import checkfield
++from WriteData import WriteData
++from MeshProfileIntersection import MeshProfileIntersection
+ import os
+ 
+ class massfluxatgate(object):
+Index: ../trunk-jpl/src/m/classes/thermal.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/thermal.py	(revision 17496)
++++ ../trunk-jpl/src/m/classes/thermal.py	(revision 17497)
+@@ -1,8 +1,8 @@
+ import numpy
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from WriteData import *
++from checkfield import checkfield
++from WriteData import WriteData
+ 
+ class thermal(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/settings.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/settings.py	(revision 17496)
++++ ../trunk-jpl/src/m/classes/settings.py	(revision 17497)
+@@ -1,7 +1,7 @@
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from WriteData import *
++from checkfield import checkfield
++from WriteData import WriteData
+ 
+ class settings(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/gia.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/gia.py	(revision 17496)
++++ ../trunk-jpl/src/m/classes/gia.py	(revision 17497)
+@@ -1,7 +1,7 @@
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from WriteData import *
++from checkfield import checkfield
++from WriteData import WriteData
+ 
+ class gia(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/balancethickness.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/balancethickness.py	(revision 17496)
++++ ../trunk-jpl/src/m/classes/balancethickness.py	(revision 17497)
+@@ -1,7 +1,7 @@
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from WriteData import *
++from checkfield import checkfield
++from WriteData import WriteData
+ 
+ class balancethickness(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/transient.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/transient.py	(revision 17496)
++++ ../trunk-jpl/src/m/classes/transient.py	(revision 17497)
+@@ -1,7 +1,7 @@
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from WriteData import *
++from checkfield import checkfield
++from WriteData import WriteData
+ 
+ class transient(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/SMBpdd.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/SMBpdd.py	(revision 17496)
++++ ../trunk-jpl/src/m/classes/SMBpdd.py	(revision 17497)
+@@ -1,8 +1,8 @@
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from project3d import *
+-from WriteData import *
++from checkfield import checkfield
++from WriteData import WriteData
++from project3d import project3d
+ 
+ class SMBpdd(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/SMB.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/SMB.py	(revision 17496)
++++ ../trunk-jpl/src/m/classes/SMB.py	(revision 17497)
+@@ -1,8 +1,9 @@
++import numpy
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from project3d import *
+-from WriteData import *
++from checkfield import checkfield
++from WriteData import WriteData
++from project3d import project3d
+ 
+ class SMB(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/rifts.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/rifts.py	(revision 17496)
++++ ../trunk-jpl/src/m/classes/rifts.py	(revision 17497)
+@@ -1,9 +1,9 @@
+ import numpy
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from WriteData import *
+-from isnans import *
++from checkfield import checkfield
++from WriteData import WriteData
++from isnans import isnans
+ 
+ class rifts(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/timestepping.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/timestepping.py	(revision 17496)
++++ ../trunk-jpl/src/m/classes/timestepping.py	(revision 17497)
+@@ -1,7 +1,7 @@
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from WriteData import *
++from checkfield import checkfield
++from WriteData import WriteData
+ 
+ class timestepping(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/constants.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/constants.py	(revision 17496)
++++ ../trunk-jpl/src/m/classes/constants.py	(revision 17497)
+@@ -1,7 +1,7 @@
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from WriteData import *
++from checkfield import checkfield
++from WriteData import WriteData
+ 
+ class constants(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/friction.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/friction.py	(revision 17496)
++++ ../trunk-jpl/src/m/classes/friction.py	(revision 17497)
+@@ -1,7 +1,7 @@
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from WriteData import *
++from checkfield import checkfield
++from WriteData import WriteData
+ 
+ class friction(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/hydrologydc.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/hydrologydc.py	(revision 17496)
++++ ../trunk-jpl/src/m/classes/hydrologydc.py	(revision 17497)
+@@ -1,7 +1,7 @@
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from WriteData import *
++from checkfield import checkfield
++from WriteData import WriteData
+ 
+ class hydrologydc(object):
+     """
+Index: ../trunk-jpl/src/m/classes/mask.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/mask.py	(revision 17496)
++++ ../trunk-jpl/src/m/classes/mask.py	(revision 17497)
+@@ -1,8 +1,8 @@
+ import numpy
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from WriteData import *
++from checkfield import checkfield
++from WriteData import WriteData
+ 
+ class mask(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/autodiff.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/autodiff.py	(revision 17496)
++++ ../trunk-jpl/src/m/classes/autodiff.py	(revision 17497)
+@@ -1,10 +1,10 @@
+ import numpy
+-from dependent import *
+-from independent import *
++from dependent import dependent
++from independent import independent
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from WriteData import *
++from checkfield import checkfield
++from WriteData import WriteData
+ 
+ class autodiff(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/outputdefinition.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/outputdefinition.py	(revision 17496)
++++ ../trunk-jpl/src/m/classes/outputdefinition.py	(revision 17497)
+@@ -1,8 +1,8 @@
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+ from StringToEnum import StringToEnum
+-from checkfield import *
+-from WriteData import *
++from checkfield import checkfield
++from WriteData import WriteData
+ import numpy as npy
+ 
+ class outputdefinition(object):
+Index: ../trunk-jpl/src/m/classes/masstransport.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/masstransport.py	(revision 17496)
++++ ../trunk-jpl/src/m/classes/masstransport.py	(revision 17497)
+@@ -1,8 +1,8 @@
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+ from StringToEnum import StringToEnum
+-from checkfield import *
+-from WriteData import *
++from checkfield import checkfield
++from WriteData import WriteData
+ 
+ class masstransport(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/SMBgradients.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/SMBgradients.py	(revision 17496)
++++ ../trunk-jpl/src/m/classes/SMBgradients.py	(revision 17497)
+@@ -1,8 +1,8 @@
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from project3d import *
+-from WriteData import *
++from checkfield import checkfield
++from WriteData import WriteData
++from project3d import project3d
+ 
+ class SMBgradients(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/flaim.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/flaim.py	(revision 17496)
++++ ../trunk-jpl/src/m/classes/flaim.py	(revision 17497)
+@@ -2,8 +2,8 @@
+ from collections import OrderedDict
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from WriteData import *
++from checkfield import checkfield
++from WriteData import WriteData
+ 
+ class flaim(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/steadystate.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/steadystate.py	(revision 17496)
++++ ../trunk-jpl/src/m/classes/steadystate.py	(revision 17497)
+@@ -1,8 +1,8 @@
+ import numpy
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from WriteData import *
++from checkfield import checkfield
++from WriteData import WriteData
+ 
+ class steadystate(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/geometry.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/geometry.py	(revision 17496)
++++ ../trunk-jpl/src/m/classes/geometry.py	(revision 17497)
+@@ -1,7 +1,7 @@
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from WriteData import *
++from checkfield import checkfield
++from WriteData import WriteData
+ 
+ class geometry(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/hydrologyshreve.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/hydrologyshreve.py	(revision 17496)
++++ ../trunk-jpl/src/m/classes/hydrologyshreve.py	(revision 17497)
+@@ -1,7 +1,7 @@
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from WriteData import *
++from checkfield import checkfield
++from WriteData import WriteData
+ 
+ class hydrologyshreve(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/organizer.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/organizer.py	(revision 17496)
++++ ../trunk-jpl/src/m/classes/organizer.py	(revision 17497)
+@@ -1,9 +1,9 @@
+ import os.path
+ from collections import OrderedDict
+-from pairoptions import *
+-from loadvars import *
+-from loadmodel import *
+-from savevars import *
++import pairoptions
++from loadvars import loadvars
++from loadmodel import loadmodel
++from savevars import savevars
+ from model import model
+ from whichdb import whichdb
+ 
+@@ -33,7 +33,7 @@
+ 		self.requestedsteps=[0]
+ 
+ 		#process options
+-		options=pairoptions(*args)
++		options=pairoptions.pairoptions(*args)
+ 
+ 		#Get prefix
+ 		prefix=options.getfieldvalue('prefix','model.')
+Index: ../trunk-jpl/src/m/classes/matice.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/matice.py	(revision 17496)
++++ ../trunk-jpl/src/m/classes/matice.py	(revision 17497)
+@@ -1,8 +1,8 @@
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+ from StringToEnum import StringToEnum
+-from checkfield import *
+-from WriteData import *
++from checkfield import checkfield
++from WriteData import WriteData
+ 
+ class matice(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/miscellaneous.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/miscellaneous.py	(revision 17496)
++++ ../trunk-jpl/src/m/classes/miscellaneous.py	(revision 17497)
+@@ -1,8 +1,8 @@
+ from collections import OrderedDict
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from WriteData import *
++from checkfield import checkfield
++from WriteData import WriteData
+ 
+ class miscellaneous(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/private.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/private.py	(revision 17496)
++++ ../trunk-jpl/src/m/classes/private.py	(revision 17497)
+@@ -1,7 +1,7 @@
+ from collections import OrderedDict
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
++from checkfield import checkfield
+ 
+ class private(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/inversion.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/inversion.py	(revision 17496)
++++ ../trunk-jpl/src/m/classes/inversion.py	(revision 17497)
+@@ -3,8 +3,8 @@
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+ from StringToEnum import StringToEnum
+-from checkfield import *
+-from WriteData import *
++from checkfield import checkfield
++from WriteData import WriteData
+ 
+ class inversion(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/basalforcings.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/basalforcings.py	(revision 17496)
++++ ../trunk-jpl/src/m/classes/basalforcings.py	(revision 17497)
+@@ -1,7 +1,7 @@
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+-from checkfield import *
+-from WriteData import *
++from checkfield import checkfield
++from WriteData import WriteData
+ import numpy
+ 
+ class basalforcings(object):
+Index: ../trunk-jpl/src/m/solvers/matlaboptions.py
+===================================================================
+--- ../trunk-jpl/src/m/solvers/matlaboptions.py	(revision 17496)
++++ ../trunk-jpl/src/m/solvers/matlaboptions.py	(revision 17497)
+@@ -1,4 +1,5 @@
+-from pairoptions import *
++import pairoptions
++
+ def matlaboptions(*args):
+ 	#MATLABOPTIONS - return Matlab petsc options
+ 	#
+@@ -6,7 +7,7 @@
+ 	#      options=matlaboptions;
+ 	
+ 	#retrieve options provided in varargin
+-	arguments=pairoptions(*args) 
++	arguments=pairoptions.pairoptions(*args) 
+ 	
+ 	options=[['toolkit','petsc'],['ksp_type','matlab']];
+ 
+Index: ../trunk-jpl/src/m/solvers/jacobicgoptions.py
+===================================================================
+--- ../trunk-jpl/src/m/solvers/jacobicgoptions.py	(revision 17496)
++++ ../trunk-jpl/src/m/solvers/jacobicgoptions.py	(revision 17497)
+@@ -1,4 +1,5 @@
+-from pairoptions import *
++import pairoptions 
++
+ def jacobicgoptions(*args):
+ 	#ASMOPTIONS - return Additive Shwartz Method with Jacobi preconditioner petsc options
+ 	#
+@@ -6,7 +7,7 @@
+ 	#      options=jacobicgoptions;
+ 	
+ 	#retrieve options provided in varargin
+-	arguments=pairoptions(*args) 
++	arguments=pairoptions.pairoptions(*args) 
+ 	
+ 	options=[['toolkit','petsc'],['mat_type','aij'],['ksp_type','cg'],['ksp_max_it',100],['ksp_rtol',1e-15]];
+ 
+Index: ../trunk-jpl/src/m/solvers/soroptions.py
+===================================================================
+--- ../trunk-jpl/src/m/solvers/soroptions.py	(revision 17496)
++++ ../trunk-jpl/src/m/solvers/soroptions.py	(revision 17497)
+@@ -1,4 +1,5 @@
+-from pairoptions import *
++import pairoptions
++
+ def soroptions(*args):
+ 	#SOROPTIONS - return Relaxation Solver petsc options
+ 	#
+@@ -6,7 +7,7 @@
+ 	#      options=soroptions;
+ 	
+ 	#retrieve options provided in varargin
+-	arguments=pairoptions(*args) 
++	arguments=pairoptions.pairoptions(*args) 
+ 	
+ 	options=[['toolkit','petsc'],['mat_type','aij'],['ksp_type','cg'],['pc_type','sor'],['pc_sor_omega',1.1],['pc_sor_its',2]];
+ 
+Index: ../trunk-jpl/src/m/solvers/asmoptions.py
+===================================================================
+--- ../trunk-jpl/src/m/solvers/asmoptions.py	(revision 17496)
++++ ../trunk-jpl/src/m/solvers/asmoptions.py	(revision 17497)
+@@ -1,4 +1,5 @@
+-from pairoptions import *
++import pairoptions
++
+ def asmoptions(*args):
+ 	#ASMOPTIONS - return ASM petsc options
+ 	#
+@@ -6,7 +7,7 @@
+ 	#      options=asmoptions;
+ 	
+ 	#retrieve options provided in varargin
+-	arguments=pairoptions(*args) 
++	arguments=pairoptions.pairoptions(*args) 
+ 	
+ 	options=[['toolkit','petsc'],['mat_type','aij'],['ksp_type','gmres'],['pc_type','asm'],['sub_pc_type','lu'],['pc_asm_overlap',3],['ksp_max_it',100],['ksp_rtol',1e-30]];
+ 
+Index: ../trunk-jpl/src/m/solvers/mumpsoptions.py
+===================================================================
+--- ../trunk-jpl/src/m/solvers/mumpsoptions.py	(revision 17496)
++++ ../trunk-jpl/src/m/solvers/mumpsoptions.py	(revision 17497)
+@@ -1,6 +1,6 @@
+ from collections import OrderedDict
+-from pairoptions import *
+-from IssmConfig  import *
++import pairoptions
++from IssmConfig import IssmConfig
+ 
+ def mumpsoptions(*args):
+ 	"""
+@@ -11,7 +11,7 @@
+ 	"""
+ 
+ 	#retrieve options provided in varargin
+-	options=pairoptions(*args)
++	options=pairoptions.pairoptions(*args)
+ 	mumps=OrderedDict()
+ 
+ 	#default mumps options
+Index: ../trunk-jpl/src/m/solvers/issmmumpssolver.py
+===================================================================
+--- ../trunk-jpl/src/m/solvers/issmmumpssolver.py	(revision 17496)
++++ ../trunk-jpl/src/m/solvers/issmmumpssolver.py	(revision 17497)
+@@ -1,4 +1,5 @@
+-from pairoptions import *
++import pairoptions
++
+ def issmmumpssolver(*args):
+ 	#ISSMSOLVE - return issm solver options
+ 	#
+@@ -6,7 +7,7 @@
+ 	#      options=issmsolver;
+ 	
+ 	#retrieve options provided in varargin
+-	arguments=pairoptions(*args) 
++	arguments=pairoptions.pairoptions(*args) 
+ 	
+ 	options=[['toolkit','issm'],['mat_type','mpidense'],['vec_type','mpi'],['solver_type','mumps']];
+ 
+Index: ../trunk-jpl/src/m/solvers/jacobiasmoptions.py
+===================================================================
+--- ../trunk-jpl/src/m/solvers/jacobiasmoptions.py	(revision 17496)
++++ ../trunk-jpl/src/m/solvers/jacobiasmoptions.py	(revision 17497)
+@@ -1,4 +1,5 @@
+-from pairoptions import *
++import pairoptions
++
+ def jacobiasmoptions(*args):
+ 	#ASMOPTIONS - return Additive Shwartz Method with Jacobi preconditioner petsc options
+ 	#
+@@ -6,7 +7,7 @@
+ 	#      options=jacobiasmoptions;
+ 	
+ 	#retrieve options provided in varargin
+-	arguments=pairoptions(*args) 
++	arguments=pairoptions.pairoptions(*args) 
+ 	
+ 	options=[['toolkit','petsc'],['mat_type','aij'],['ksp_type','gmres'],['pc_type','asm'],['sub_pc_type','jacobi'],['pc_asm_overlap',3],['ksp_max_it',100],['ksp_rtol',1e-15]];
+ 
+Index: ../trunk-jpl/src/m/solvers/iluasmoptions.py
+===================================================================
+--- ../trunk-jpl/src/m/solvers/iluasmoptions.py	(revision 17496)
++++ ../trunk-jpl/src/m/solvers/iluasmoptions.py	(revision 17497)
+@@ -1,5 +1,5 @@
+ from collections import OrderedDict
+-from pairoptions import *
++import pairoptions
+ 
+ def iluasmoptions(*args):
+ 	"""
+@@ -10,7 +10,7 @@
+ 	"""
+ 			 
+ 	#retrieve options provided in varargin
+-	options=pairoptions(*args)
++	options=pairoptions.pairoptions(*args)
+ 	iluasm=OrderedDict()
+ 
+ 	#default iluasm options
+Index: ../trunk-jpl/src/m/solvers/issmgslsolver.py
+===================================================================
+--- ../trunk-jpl/src/m/solvers/issmgslsolver.py	(revision 17496)
++++ ../trunk-jpl/src/m/solvers/issmgslsolver.py	(revision 17497)
+@@ -1,4 +1,5 @@
+-from pairoptions import *
++import pairoptions
++
+ def issmgslsolver(*args):
+ 	#ISSMSOLVE - return issm solver options
+ 	#
+@@ -6,7 +7,7 @@
+ 	#      options=issmsolver;
+ 	
+ 	#retrieve options provided in varargin
+-	arguments=pairoptions(*args) 
++	arguments=pairoptions.pairoptions(*args) 
+ 	
+ 	options=[['toolkit','issm'],['mat_type','dense'],['vec_type','seq'],['solver_type','gsl']];
+ 
+Index: ../trunk-jpl/src/m/solvers/stokesoptions.py
+===================================================================
+--- ../trunk-jpl/src/m/solvers/stokesoptions.py	(revision 17496)
++++ ../trunk-jpl/src/m/solvers/stokesoptions.py	(revision 17497)
+@@ -1,5 +1,6 @@
+-from pairoptions import *
+-from IssmConfig  import *
++import pairoptions
++from IssmConfig import IssmConfig
++
+ def stokesoptions(*args):
+ 	#STOKESOPTIONS - return STOKES multi-physics solver petsc options
+ 	#
+@@ -7,7 +8,7 @@
+ 	#      options=stokesoptions;
+ 	
+ 	#retrieve options provided in varargin
+-	arguments=pairoptions(*args) 
++	arguments=pairoptions.pairoptions(*args) 
+ 
+ 
+ 	#default stokes options
+Index: ../trunk-jpl/src/m/io/loadmodel.py
+===================================================================
+--- ../trunk-jpl/src/m/io/loadmodel.py	(revision 17496)
++++ ../trunk-jpl/src/m/io/loadmodel.py	(revision 17497)
+@@ -1,5 +1,4 @@
+-import os.path
+-from loadvars import *
++from loadvars import loadvars
+ from whichdb import whichdb
+ 
+ def loadmodel(path):
+Index: ../trunk-jpl/src/m/parameterization/setflowequation.py
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/setflowequation.py	(revision 17496)
++++ ../trunk-jpl/src/m/parameterization/setflowequation.py	(revision 17497)
+@@ -1,5 +1,5 @@
+ import numpy
+-from model import *
++from model import model
+ from pairoptions import pairoptions
+ import MatlabFuncs as m
+ import PythonFuncs as p
+Index: ../trunk-jpl/src/m/parameterization/contourenvelope.py
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/contourenvelope.py	(revision 17496)
++++ ../trunk-jpl/src/m/parameterization/contourenvelope.py	(revision 17497)
+@@ -3,7 +3,7 @@
+ import copy
+ from NodeConnectivity import NodeConnectivity
+ from ElementConnectivity import ElementConnectivity
+-from mesh import *
++from mesh import mesh
+ import MatlabFuncs as m
+ 
+ def contourenvelope(md,*args):
+Index: ../trunk-jpl/src/m/parameterization/setmask.py
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/setmask.py	(revision 17496)
++++ ../trunk-jpl/src/m/parameterization/setmask.py	(revision 17497)
+@@ -1,6 +1,6 @@
+ import numpy
+ import os
+-from model import *
++from model import model
+ from FlagElements import FlagElements
+ import pairoptions
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17497-17498.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17497-17498.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17497-17498.diff	(revision 17802)
@@ -0,0 +1,52 @@
+Index: ../trunk-jpl/src/m/enum/InputToDepthaverageEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/InputToDepthaverageEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/InputToDepthaverageEnum.m	(revision 17498)
+@@ -0,0 +1,11 @@
++function macro=InputToDepthaverageEnum()
++%INPUTTODEPTHAVERAGEENUM - Enum of InputToDepthaverage
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=InputToDepthaverageEnum()
++
++macro=StringToEnum('InputToDepthaverage');
+Index: ../trunk-jpl/src/m/enum/DepthAverageAnalysisEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/DepthAverageAnalysisEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/DepthAverageAnalysisEnum.m	(revision 17498)
+@@ -0,0 +1,11 @@
++function macro=DepthAverageAnalysisEnum()
++%DEPTHAVERAGEANALYSISENUM - Enum of DepthAverageAnalysis
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=DepthAverageAnalysisEnum()
++
++macro=StringToEnum('DepthAverageAnalysis');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17497)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17498)
+@@ -338,6 +338,7 @@
+ def SurfaceNormalVelocityEnum(): return StringToEnum("SurfaceNormalVelocity")[0]
+ def ExtrudeFromBaseAnalysisEnum(): return StringToEnum("ExtrudeFromBaseAnalysis")[0]
+ def ExtrudeFromTopAnalysisEnum(): return StringToEnum("ExtrudeFromTopAnalysis")[0]
++def DepthAverageAnalysisEnum(): return StringToEnum("DepthAverageAnalysis")[0]
+ def SteadystateSolutionEnum(): return StringToEnum("SteadystateSolution")[0]
+ def SurfaceSlopeSolutionEnum(): return StringToEnum("SurfaceSlopeSolution")[0]
+ def SmoothedSurfaceSlopeXAnalysisEnum(): return StringToEnum("SmoothedSurfaceSlopeXAnalysis")[0]
+@@ -392,6 +393,7 @@
+ def IntInputEnum(): return StringToEnum("IntInput")[0]
+ def InputToExtrudeEnum(): return StringToEnum("InputToExtrude")[0]
+ def InputToL2ProjectEnum(): return StringToEnum("InputToL2Project")[0]
++def InputToDepthaverageEnum(): return StringToEnum("InputToDepthaverage")[0]
+ def IntParamEnum(): return StringToEnum("IntParam")[0]
+ def IntVecParamEnum(): return StringToEnum("IntVecParam")[0]
+ def TransientParamEnum(): return StringToEnum("TransientParam")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17498-17499.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17498-17499.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17498-17499.diff	(revision 17802)
@@ -0,0 +1,228 @@
+Index: ../trunk-jpl/test/NightlyRun/test202.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test202.py	(revision 17498)
++++ ../trunk-jpl/test/NightlyRun/test202.py	(revision 17499)
+@@ -7,6 +7,7 @@
+ from parameterize import *
+ from setflowequation import *
+ from solve import *
++from generic import generic
+ 
+ md=triangle(model(),'../Exp/Square.exp',180000)
+ md=setmask(md,'all','')
+Index: ../trunk-jpl/test/NightlyRun/test216.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test216.py	(revision 17498)
++++ ../trunk-jpl/test/NightlyRun/test216.py	(revision 17499)
+@@ -8,6 +8,7 @@
+ from parameterize import *
+ from setflowequation import *
+ from solve import *
++from generic import generic
+ 
+ md=triangle(model(),'../Exp/SquareHole.exp','../Exp/Rifts.exp',50000.)
+ md=meshprocessrifts(md,'../Exp/Square.exp')
+Index: ../trunk-jpl/test/NightlyRun/test211.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.py	(revision 17498)
++++ ../trunk-jpl/test/NightlyRun/test211.py	(revision 17499)
+@@ -7,6 +7,7 @@
+ from parameterize import *
+ from setflowequation import *
+ from solve import *
++from generic import generic
+ 
+ md=triangle(model(),'../Exp/Square.exp',200000)
+ md=setmask(md,'all','')
+Index: ../trunk-jpl/test/NightlyRun/test220.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test220.py	(revision 17498)
++++ ../trunk-jpl/test/NightlyRun/test220.py	(revision 17499)
+@@ -7,6 +7,7 @@
+ from parameterize import *
+ from setflowequation import *
+ from solve import *
++from generic import generic
+ 
+ md=triangle(model(),'../Exp/Square.exp',120000.)
+ md=setmask(md,'all','')
+Index: ../trunk-jpl/test/NightlyRun/test208.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test208.py	(revision 17498)
++++ ../trunk-jpl/test/NightlyRun/test208.py	(revision 17499)
+@@ -7,6 +7,7 @@
+ from parameterize import *
+ from setflowequation import *
+ from solve import *
++from generic import generic
+ 
+ md=triangle(model(),'../Exp/Square.exp',150000)
+ md=setmask(md,'all','')
+Index: ../trunk-jpl/test/NightlyRun/test203.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test203.py	(revision 17498)
++++ ../trunk-jpl/test/NightlyRun/test203.py	(revision 17499)
+@@ -7,6 +7,7 @@
+ from parameterize import *
+ from setflowequation import *
+ from solve import *
++from generic import generic
+ 
+ md=triangle(model(),'../Exp/Square.exp',180000)
+ md=setmask(md,'all','')
+Index: ../trunk-jpl/test/NightlyRun/test217.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test217.py	(revision 17498)
++++ ../trunk-jpl/test/NightlyRun/test217.py	(revision 17499)
+@@ -8,6 +8,7 @@
+ from setflowequation import *
+ from paterson import *
+ from solve import *
++from generic import generic
+ 
+ md=triangle(model(),'../Exp/Square.exp',150000)
+ md=setmask(md,'all','')
+Index: ../trunk-jpl/test/NightlyRun/test212.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test212.py	(revision 17498)
++++ ../trunk-jpl/test/NightlyRun/test212.py	(revision 17499)
+@@ -7,6 +7,7 @@
+ from parameterize import *
+ from setflowequation import *
+ from solve import *
++from generic import generic
+ 
+ md=triangle(model(),'../Exp/Square.exp',200000)
+ md=setmask(md,'all','')
+Index: ../trunk-jpl/test/NightlyRun/test209.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test209.py	(revision 17498)
++++ ../trunk-jpl/test/NightlyRun/test209.py	(revision 17499)
+@@ -7,6 +7,7 @@
+ from parameterize import *
+ from setflowequation import *
+ from solve import *
++from generic import generic
+ 
+ md=triangle(model(),'../Exp/Square.exp',180000)
+ md=setmask(md,'all','')
+Index: ../trunk-jpl/test/NightlyRun/test204.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test204.py	(revision 17498)
++++ ../trunk-jpl/test/NightlyRun/test204.py	(revision 17499)
+@@ -7,6 +7,7 @@
+ from parameterize import *
+ from setflowequation import *
+ from solve import *
++from generic import generic
+ 
+ md=triangle(model(),'../Exp/Square.exp',180000)
+ md=setmask(md,'all','')
+Index: ../trunk-jpl/test/NightlyRun/test213.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test213.py	(revision 17498)
++++ ../trunk-jpl/test/NightlyRun/test213.py	(revision 17499)
+@@ -7,6 +7,7 @@
+ from parameterize import *
+ from setflowequation import *
+ from solve import *
++from generic import generic
+ 
+ md=triangle(model(),'../Exp/Square.exp',200000)
+ md=setmask(md,'all','')
+Index: ../trunk-jpl/test/NightlyRun/test101.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test101.py	(revision 17498)
++++ ../trunk-jpl/test/NightlyRun/test101.py	(revision 17499)
+@@ -7,6 +7,7 @@
+ from solve import *
+ from MatlabFuncs import *
+ from massfluxatgate import massfluxatgate
++from generic import generic
+ 
+ md=triangle(model(),'../Exp/Square.exp',50000)
+ md=setmask(md,'all','')
+Index: ../trunk-jpl/test/NightlyRun/test205.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test205.py	(revision 17498)
++++ ../trunk-jpl/test/NightlyRun/test205.py	(revision 17499)
+@@ -7,6 +7,7 @@
+ from parameterize import *
+ from setflowequation import *
+ from solve import *
++from generic import generic
+ 
+ md=triangle(model(),'../Exp/Square.exp',150000)
+ md=setmask(md,'all','')
+Index: ../trunk-jpl/test/NightlyRun/test219.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test219.py	(revision 17498)
++++ ../trunk-jpl/test/NightlyRun/test219.py	(revision 17499)
+@@ -7,6 +7,7 @@
+ from parameterize import *
+ from setflowequation import *
+ from solve import *
++from generic import generic
+ 
+ md=triangle(model(),'../Exp/Square.exp',150000.)
+ md=setmask(md,'all','')
+Index: ../trunk-jpl/test/NightlyRun/test214.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test214.py	(revision 17498)
++++ ../trunk-jpl/test/NightlyRun/test214.py	(revision 17499)
+@@ -7,6 +7,7 @@
+ from parameterize import *
+ from setflowequation import *
+ from solve import *
++from generic import generic
+ 
+ md=triangle(model(),'../Exp/Square.exp',200000)
+ md=setmask(md,'all','')
+Index: ../trunk-jpl/test/NightlyRun/test237.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test237.py	(revision 17498)
++++ ../trunk-jpl/test/NightlyRun/test237.py	(revision 17499)
+@@ -7,6 +7,7 @@
+ from EnumDefinitions import *
+ from solve import *
+ from MatlabFuncs import *
++from generic import generic
+ 
+ md=triangle(model(),'../Exp/Square.exp',600000)    #180000
+ md=setmask(md,'all','')
+Index: ../trunk-jpl/test/NightlyRun/test206.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test206.py	(revision 17498)
++++ ../trunk-jpl/test/NightlyRun/test206.py	(revision 17499)
+@@ -7,6 +7,7 @@
+ from parameterize import *
+ from setflowequation import *
+ from solve import *
++from generic import generic
+ 
+ md=triangle(model(),'../Exp/Square.exp',180000)
+ md=setmask(md,'all','')
+Index: ../trunk-jpl/test/NightlyRun/test215.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test215.py	(revision 17498)
++++ ../trunk-jpl/test/NightlyRun/test215.py	(revision 17499)
+@@ -7,6 +7,7 @@
+ from parameterize import *
+ from setflowequation import *
+ from solve import *
++from generic import generic
+ 
+ md=triangle(model(),'../Exp/Square.exp',200000)
+ md=setmask(md,'all','')
+Index: ../trunk-jpl/test/NightlyRun/test207.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test207.py	(revision 17498)
++++ ../trunk-jpl/test/NightlyRun/test207.py	(revision 17499)
+@@ -7,6 +7,7 @@
+ from parameterize import *
+ from setflowequation import *
+ from solve import *
++from generic import generic
+ 
+ md=triangle(model(),'../Exp/Square.exp',180000)
+ md=setmask(md,'all','')
Index: issm/oecreview/Archive/16554-17801/ISSM-17499-17500.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17499-17500.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17499-17500.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/m/parameterization/setmask.py
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/setmask.py	(revision 17499)
++++ ../trunk-jpl/src/m/parameterization/setmask.py	(revision 17500)
+@@ -3,6 +3,7 @@
+ from model import model
+ from FlagElements import FlagElements
+ import pairoptions
++from ContourToMesh import ContourToMesh
+ 
+ def setmask(md, floatingicename, groundedicename, *args):
+ 	"""
Index: issm/oecreview/Archive/16554-17801/ISSM-17500-17501.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17500-17501.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17500-17501.diff	(revision 17802)
@@ -0,0 +1,39 @@
+Index: ../trunk-jpl/src/m/classes/organizer.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/organizer.py	(revision 17500)
++++ ../trunk-jpl/src/m/classes/organizer.py	(revision 17501)
+@@ -6,6 +6,7 @@
+ from savevars import savevars
+ from model import model
+ from whichdb import whichdb
++import MatlabFuncs as m
+ 
+ class organizer(object):
+ 	"""
+@@ -39,7 +40,7 @@
+ 		prefix=options.getfieldvalue('prefix','model.')
+ 		if not isinstance(prefix,(str,unicode)):
+ 			raise TypeError("prefix is not a string")
+-		if not strcmp(prefix,prefix.strip()) or len(prefix.split()) > 1:
++		if not m.strcmp(prefix,prefix.strip()) or len(prefix.split()) > 1:
+ 			raise TypeError("prefix should not have any white space")
+ 		self.prefix=prefix
+ 
+@@ -59,7 +60,7 @@
+ 			trunkprefix=options.getfieldvalue('trunkprefix','')
+ 			if not isinstance(trunkprefix,(str,unicode)):
+ 				raise TypeError("trunkprefix is not a string")
+-			if not strcmp(trunkprefix,trunkprefix.strip()) or len(trunkprefix.split()) > 1:
++			if not m.strcmp(trunkprefix,trunkprefix.strip()) or len(trunkprefix.split()) > 1:
+ 				raise TypeError("trunkprefix should not have any white space")
+ 			self.trunkprefix=trunkprefix
+ 	#}}}
+@@ -122,7 +123,7 @@
+ 		#Some checks
+ 		if not isinstance(string,(str,unicode)):
+ 			raise TypeError("Step provided should be a string")
+-		if not strcmp(string,string.strip()) or len(string.split()) > 1:
++		if not m.strcmp(string,string.strip()) or len(string.split()) > 1:
+ 			raise TypeError("Step provided should not have any white space")
+ 		if self._currentstep>0 and string in [step['string'] for step in self.steps]:
+ 			raise RuntimeError("Step '%s' already present. Change name" % string) 
Index: issm/oecreview/Archive/16554-17801/ISSM-17501-17502.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17501-17502.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17501-17502.diff	(revision 17802)
@@ -0,0 +1,39 @@
+Index: ../trunk-jpl/src/m/plot/plotmodel.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plotmodel.py	(revision 17501)
++++ ../trunk-jpl/src/m/plot/plotmodel.py	(revision 17502)
+@@ -1,11 +1,11 @@
+ import numpy as npy
++from plotoptions import plotoptions
+ 
+ try:
+ 	import pylab as p
+ except ImportError:
+ 	print "could not import pylab, matplotlib has not been installed, no plotting capabilities enabled"
+ 
+-from plotoptions import plotoptions
+ from plot_manager import plot_manager
+ from math import ceil, sqrt
+ 
+Index: ../trunk-jpl/src/m/classes/plotoptions.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/plotoptions.py	(revision 17501)
++++ ../trunk-jpl/src/m/classes/plotoptions.py	(revision 17502)
+@@ -40,7 +40,7 @@
+ 			raise TypeError('Invalid parameter/value pair arguments')
+ 
+ 		#go through args and build list (like pairoptions)
+-		rawoptions=pairoptions(*arg)
++		rawoptions=pairoptions.pairoptions(*arg)
+ 		numoptions=len(arg)/2
+ 		rawlist=[] # cannot be a dict since they do not support duplicate keys
+ 
+@@ -68,7 +68,7 @@
+ 		#initialize self.list (will need a list of dict's (or nested dict) for numberofplots>1)
+ 		#self.list=defaultdict(dict)
+ 		for i in xrange(numberofplots):
+-			self.list[i]=pairoptions()
++			self.list[i]=pairoptions.pairoptions()
+ 
+ 		#process plot options
+ 		for i in xrange(len(rawlist)):
Index: issm/oecreview/Archive/16554-17801/ISSM-17502-17503.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17502-17503.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17502-17503.diff	(revision 17802)
@@ -0,0 +1,565 @@
+Index: ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.h	(revision 17502)
++++ ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.h	(revision 17503)
+@@ -32,9 +32,10 @@
+ 	void GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 	
+ 	/* Other */
+-	void UpdateReinitSPCs(FemModel* femmodel);
++	void SetReinitSPCs(FemModel* femmodel);
+ 	void SetDistanceOnIntersectedElements(FemModel* femmodel);
+ 	void SetDistanceToZeroLevelsetElement(Vector<IssmDouble>* vec_dist, Element* element);
+ 	IssmDouble GetDistanceToStraight(IssmDouble* q, IssmDouble* s0, IssmDouble* s1);
++	bool ReinitConvergence(Vector<IssmDouble>* lsfg,Vector<IssmDouble>* lsfg_old,IssmDouble reltol);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp	(revision 17502)
++++ ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp	(revision 17503)
+@@ -3,6 +3,8 @@
+ #include "../classes/classes.h"
+ #include "../shared/shared.h"
+ #include "../modules/modules.h"
++#include "../solutionsequences/solutionsequences.h"
++#include "../cores/cores.h"
+ 
+ #include "../modules/GetVectorFromInputsx/GetVectorFromInputsx.h"
+ 
+@@ -28,10 +30,14 @@
+ 			counter++;
+ 		}
+ 	}
++
++	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ }/*}}}*/
+ void LsfReinitializationAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 	int finiteelement=P1Enum;
++	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,LsfReinitializationAnalysisEnum,finiteelement);
++	iomodel->DeleteData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+ void LsfReinitializationAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ 	/* Do nothing for now */
+@@ -45,6 +51,13 @@
+ 
+ 	/*parameters: */
+ 	bool save_results;
++	int maxiter = 3;
++	int step;
++	IssmDouble reltol = 0.05;
++
++	Vector<IssmDouble>* lsfg     = NULL;
++	Vector<IssmDouble>* lsfg_old = NULL;
++
+ 	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
+ 
+ 	/*activate formulation: */
+@@ -52,15 +65,38 @@
+ 
+ 	/* set spcs for reinitialization */
+ 	if(VerboseSolution()) _printf0_("Update spcs for reinitialization:\n");
+-	UpdateReinitSPCs(femmodel);
++	SetReinitSPCs(femmodel);
+ 
+-	if(VerboseSolution()) _printf0_("call computational core for reinitialization:\n");
+-// 	solutionsequence_lsfreinit_linear(femmodel);
++	step = 1;
++	for(;;){
+ 
++		_printf_("smoothing lsf slope\n");
++		/* smoothen slope of lsf for computation of normal on ice domain*/
++		levelsetfunctionslope_core(femmodel);
++
++		//solve current artificial time step
++		if(VerboseSolution()) _printf0_("call computational core for reinitialization in step " << step << ":\n");
++		solutionsequence_linear(femmodel);
++		GetSolutionFromInputsx(&lsfg,femmodel);
++
++		if(step>1){
++			if(VerboseSolution()) _printf0_("   checking reinitialization convergence\n");
++			if(ReinitConvergence(lsfg,lsfg_old,reltol)) break;
++		}
++		if(step>maxiter){
++			if(VerboseSolution()) _printf0_("   maximum number reinitialization iterations " << maxiter << " reached\n");
++			break;
++		}
++
++		/*update results and increase counter*/
++		delete lsfg_old;lsfg_old=lsfg;
++		step++;
++	}
++
+ 	if(save_results){
+ 		if(VerboseSolution()) _printf0_("   saving results\n");
+-		int outputs = MaskIceLevelsetEnum;
+-		femmodel->RequestedOutputsx(&femmodel->results,&outputs,1);
++		int outputs[1] = {MaskIceLevelsetEnum};
++		femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],1);
+ 	}
+ 
+ }/*}}}*/
+@@ -72,14 +108,13 @@
+ 	_error_("not implemented yet");
+ }/*}}}*/
+ ElementMatrix* LsfReinitializationAnalysis::CreateKMatrix(Element* element){/*{{{*/
+-
++	
+ 	/*Intermediaries */
+ 	const int dim = 2;
+ 	int        i,row,col,stabilization;
+-	IssmDouble Jdet,D_scalar,h;
+-	IssmDouble dlsf[3],normal[3];
+-	IssmDouble norm_dlsf;
+-	IssmDouble hx,hy,hz,kappa;
++	IssmDouble Jdet,D_scalar;
++	IssmDouble dtau = 1.;
++	IssmDouble mu = 1.;
+ 	IssmDouble* xyz_list = NULL;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -87,14 +122,13 @@
+ 
+ 	/*Initialize Element vector and other vectors*/
+ 	ElementMatrix* Ke     = element->NewElementMatrix();
+-	IssmDouble*    B      = xNew<IssmDouble>(dim*numnodes);
++	IssmDouble*    basis    = xNew<IssmDouble>(numnodes);
+ 	IssmDouble*    Bprime = xNew<IssmDouble>(dim*numnodes);
+-	IssmDouble     D[dim][dim];
++	IssmDouble*    D		= xNew<IssmDouble>(dim*dim);
++	IssmDouble*    dlsf	= xNew<IssmDouble>(dim);
++	IssmDouble*    normal= xNew<IssmDouble>(dim);
+ 
+-	/*Retrieve all inputs and parameters*/
+-	Input* lsfpicard_input=element->GetInput(LevelsetfunctionPicardEnum); _assert_(lsfpicard_input);
+ 	element->GetVerticesCoordinates(&xyz_list);
+-	h = element->CharacteristicLength();
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	Gauss* gauss=element->NewGauss(2);
+@@ -102,105 +136,177 @@
+ 		gauss->GaussPoint(ig);
+ 
+ 		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+-		GetB(B,element,xyz_list,gauss);
+-		GetBprime(Bprime,element,xyz_list,gauss);
++		D_scalar=gauss->weight*Jdet;
+ 
+-		/* Get normal from last iteration on lsf */
+-		lsfpicard_input->GetInputDerivativeValue(&dlsf[0],xyz_list,gauss);
++		if(dtau!=0.){
++			element->NodalFunctions(basis,gauss);
++			TripleMultiply(basis,numnodes,1,0,
++						&D_scalar,1,1,0,
++						basis,1,numnodes,0,
++						&Ke->values[0],1);
++			D_scalar*=dtau;
++		}
+ 
+-		norm_dlsf=0.;
+-		for(i=0;i<dim;i++) norm_dlsf+=dlsf[i]*dlsf[i]; 
+-		norm_dlsf=sqrt(norm_dlsf); _assert_(norm_dlsf>0.);
+-		for(i=0;i<dim;i++)
+-			normal[i]=dlsf[i]/norm_dlsf;
+-		
+-		D_scalar=gauss->weight*Jdet;
++		GetBprime(Bprime,element,xyz_list,gauss);
+ 
+ 		for(row=0;row<dim;row++)
+ 			for(col=0;col<dim;col++)
+ 				if(row==col)
+-					D[row][col]=D_scalar*normal[row];
++					D[row*dim+col]=mu*D_scalar;
+ 				else
+-					D[row][col]=0.;
+-		TripleMultiply(B,dim,numnodes,1,
+-					&D[0][0],dim,dim,0,
++					D[row*dim+col]=0.;
++		TripleMultiply(Bprime,dim,numnodes,1,
++					D,dim,dim,0,
+ 					Bprime,dim,numnodes,0,
+ 					&Ke->values[0],1);
+ 
+-		/* Stabilization *//*{{{*/
+-		stabilization=1;
++		/* Stabilization */
++		stabilization=0;
+ 		if (stabilization==0){/* no stabilization, do nothing*/}
+-		else if(stabilization==1){
+-			/* Artificial Diffusion */
+-			element->ElementSizes(&hx,&hy,&hz);
+-			h=sqrt( pow(hx*normal[0],2) + pow(hy*normal[1],2));
+-			kappa=h/2.; 
+-			D[0][0]=D_scalar*kappa;
+-			D[0][1]=0.;
+-			D[1][0]=0.;
+-			D[1][1]=D_scalar*kappa;
+-			TripleMultiply(Bprime,dim,numnodes,1,
+-						&D[0][0],dim,dim,0,
+-						Bprime,dim,numnodes,0,
+-						&Ke->values[0],1);
+-		}
+-		else if(stabilization==2){
+-			/*Streamline upwinding - do not use this for extrapolation: yields oscillating results due to smoothing along normal, not across */
+-			for(row=0;row<dim;row++)
+-				for(col=0;col<dim;col++)
+-					D[row][col]=h/(2.*1.)*normal[row]*normal[col];
+-
+-			TripleMultiply(Bprime,dim,numnodes,1,
+-						&D[0][0],dim,dim,0,
+-						Bprime,dim,numnodes,0,
+-						&Ke->values[0],1);
+-		}/*}}}*/
++		
+ 	}/*}}}*/
+ 
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(xyz_list);
+-	xDelete<IssmDouble>(B);
++	xDelete<IssmDouble>(basis);
+ 	xDelete<IssmDouble>(Bprime);
++	xDelete<IssmDouble>(D);
+ 	delete gauss;
+ 	return Ke;
+ }/*}}}*/
+ ElementVector* LsfReinitializationAnalysis::CreatePVector(Element* element){/*{{{*/
+ 	
+ 	/*Intermediaries */
+-	IssmDouble Jdet;
+-	IssmDouble* xyz_list = NULL;
+-	
++	int i,k;
++	int dim = 2;
++	IssmDouble dtau = 1.;
++	IssmDouble mu = 1.;
++	IssmDouble Jdet, D_scalar;
++	IssmDouble lsf;
++	IssmDouble norm_dlsf;
++	IssmDouble dbasis_normal;
++
+ 	/*Fetch number of nodes */
+ 	int numnodes = element->GetNumberOfNodes();
+ 
++	IssmDouble* xyz_list = NULL;
+ 	IssmDouble* basis = xNew<IssmDouble>(numnodes);
++	IssmDouble* dbasis=xNew<IssmDouble>(dim*numnodes);
++	IssmDouble* dlsf = xNew<IssmDouble>(dim);
++	IssmDouble* normal = xNew<IssmDouble>(dim);
+ 	element->GetVerticesCoordinates(&xyz_list);
+ 
+ 	/*Initialize Element vector*/
+ 	ElementVector* pe = element->NewElementVector();
+ 
++	/*Retrieve all inputs and parameters*/
++	Input* lsf_input = element->GetInput(MaskIceLevelsetEnum); _assert_(lsf_input);
++	Input* lsf_slopex_input=element->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
++	Input* lsf_slopey_input=element->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
++
+ 	Gauss* gauss=element->NewGauss(2);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		gauss->GaussPoint(ig);
+ 
+ 		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+ 		element->NodalFunctions(basis,gauss);
++		element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+ 
+-		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*basis[i]; 
++		D_scalar=Jdet*gauss->weight;
++
++		if(dtau!=0.){
++			/* old function value */
++			lsf_input->GetInputValue(&lsf,gauss);
++			for(i=0;i<numnodes;i++) pe->values[i]+=D_scalar*lsf*basis[i];
++			D_scalar*=dtau;
++		}
++
++		lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
++		lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
++
++		/*get normal*/
++		norm_dlsf=0.;
++		for(i=0;i<dim;i++) norm_dlsf+=dlsf[i]*dlsf[i]; 
++		norm_dlsf=sqrt(norm_dlsf);
++		if(norm_dlsf>0.)
++			for(i=0;i<dim;i++)	normal[i]=dlsf[i]/norm_dlsf;
++		else
++			for(i=0;i<dim;i++)	normal[i]=0.;
++
++		/* multiply normal and dbasis */
++		for(i=0;i<numnodes;i++){
++			dbasis_normal=0.;
++			for(k=0;k<dim;k++) dbasis_normal+=dbasis[k*numnodes+i]*normal[k];
++			pe->values[i]+=D_scalar*mu*dbasis_normal; 
++		}
+ 	}
+ 
+ 	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(dbasis);
+ 	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(dlsf);
++	xDelete<IssmDouble>(normal);
+ 	return pe;
+ 	}/*}}}*/
+ void LsfReinitializationAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	IssmDouble   lsf;
++	int          meshtype,dim,approximation,dofpernode;
++	int*         doflist = NULL;
++
++	/*Get some parameters*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum: dim = 2; dofpernode = 1; break;
++		case Mesh2DverticalEnum:   dim = 2; dofpernode = 1; break;
++		case Mesh3DEnum:           dim = 3; dofpernode = 1; break;
++		case Mesh3DtetrasEnum:     dim = 3; dofpernode = 1; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++	int numdof   = numnodes*dofpernode;
++
++	/*Fetch dof list and allocate solution vector*/
++	element->GetDofList(&doflist,approximation,GsetEnum);
++	IssmDouble* values = xNew<IssmDouble>(numdof);
++
++	/*Get inputs*/
++	Input* lsf_input=element->GetInput(MaskIceLevelsetEnum); _assert_(lsf_input);
++
++	Gauss* gauss=element->NewGauss();
++	for(int i=0;i<numnodes;i++){
++		gauss->GaussNode(element->FiniteElement(),i);
++
++		lsf_input->GetInputValue(&lsf,gauss);
++		values[i*dofpernode+0]=lsf;
++	}
++
++	solution->SetValues(numdof,doflist,values,INS_VAL);
++
++	/*Free ressources:*/
++	delete gauss;
++	xDelete<IssmDouble>(values);
++	xDelete<int>(doflist);
++
+ }/*}}}*/
+ void LsfReinitializationAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	_error_("not implemented yet");
++
++	int meshtype;
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DhorizontalEnum:
++			element->InputUpdateFromSolutionOneDof(solution,MaskIceLevelsetEnum);
++			break;
++		case Mesh3DEnum:
++			element->InputUpdateFromSolutionOneDofCollapsed(solution,MaskIceLevelsetEnum);
++			break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
+ }/*}}}*/
+ void LsfReinitializationAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+-	_error_("not implemented yet");
++	/* Do nothing for now */
+ }/*}}}*/
+ void LsfReinitializationAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
+@@ -259,7 +365,7 @@
+ }/*}}}*/
+ 
+ /* Other */
+-void LsfReinitializationAnalysis::UpdateReinitSPCs(FemModel* femmodel){/*{{{*/
++void LsfReinitializationAnalysis::SetReinitSPCs(FemModel* femmodel){/*{{{*/
+ 
+ 	int i,k, numnodes;
+ 	Element* element;
+@@ -269,8 +375,10 @@
+ 	for(i=0;i<femmodel->elements->Size();i++){
+ 		element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+ 		for(k=0;k<element->GetNumberOfNodes();k++){
+-				node=element->GetNode(k);
++			node=element->GetNode(k);
++			if(node->IsActive()){
+ 				node->DofInFSet(0); 
++			}
+ 		}
+ 	}
+ 
+@@ -286,7 +394,9 @@
+ 			element->GetInputListOnNodes(&lsf[0],MaskIceLevelsetEnum);
+ 			for(k=0;k<numnodes;k++){
+ 				node=element->GetNode(k);
+-				node->ApplyConstraint(1,lsf[k]);
++				if(node->IsActive()){
++					node->ApplyConstraint(1,lsf[k]);
++				}
+ 			}
+ 			xDelete<IssmDouble>(lsf);
+ 		}
+@@ -297,27 +407,44 @@
+ 
+ 	/* Intermediaries */
+ 	int i,k;
++	IssmDouble dmaxp,dmaxm,val;
++	Element* element;
+ 
+ 	/*Initialize vector with number of vertices*/
+ 	int numvertices=femmodel->vertices->NumberOfVertices();
+-	Element* element;
+ 
+ 	Vector<IssmDouble>* vec_dist_zerolevelset = NULL;
+ 	GetVectorFromInputsx(&vec_dist_zerolevelset, femmodel, MaskIceLevelsetEnum, VertexEnum);
+ 	
++	/* set distance on elements intersected by zero levelset */
+ 	for(i=0;i<femmodel->elements->Size();i++){
+ 		element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+-		if(element->IsZeroLevelset(MaskIceLevelsetEnum))
+-			for(k=0;k<element->GetNumberOfVertices();k++)
+-				vec_dist_zerolevelset->SetValue(element->vertices[k]->Sid(),NAN,INS_VAL); 
++		if(element->IsZeroLevelset(MaskIceLevelsetEnum)){
++			SetDistanceToZeroLevelsetElement(vec_dist_zerolevelset, element);
++		}
+ 	}
++	vec_dist_zerolevelset->Assemble();
+ 
+-	for(i=0;i<femmodel->elements->Size();i++){
+-		element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+-		if(element->IsZeroLevelset(MaskIceLevelsetEnum))
+-			SetDistanceToZeroLevelsetElement(vec_dist_zerolevelset, element);
++	/* Get maximum distance to interface along vertices */
++	dmaxp=0.; dmaxm=0.;
++	for(i=0;i<numvertices;i++){
++		vec_dist_zerolevelset->GetValue(&val,i); 
++		if((val>0.) && (val>dmaxp))
++			 dmaxp=val;
++		else if((val<0.) && (val<dmaxm))
++			 dmaxm=val;
+ 	}
++	//wait until all values are computed
+ 
++	/* set all none intersected vertices to max/min distance */
++	for(i=0;i<numvertices;i++){
++		vec_dist_zerolevelset->GetValue(&val,i);
++		if(val==1.) //FIXME: improve check
++			vec_dist_zerolevelset->SetValue(i,3.*dmaxp,INS_VAL);
++		else if(val==-1.)
++			vec_dist_zerolevelset->SetValue(i,3.*dmaxm,INS_VAL);
++	}
++
+ 	/*Assemble vector and serialize */
+ 	vec_dist_zerolevelset->Assemble();
+ 	IssmDouble* dist_zerolevelset=vec_dist_zerolevelset->ToMPISerial();
+@@ -326,6 +453,7 @@
+ 	/*Clean up and return*/
+ 	delete vec_dist_zerolevelset;
+ 	delete dist_zerolevelset;
++
+ }/*}}}*/
+ void LsfReinitializationAnalysis::SetDistanceToZeroLevelsetElement(Vector<IssmDouble>* vec_signed_dist, Element* element){/*{{{*/
+ 
+@@ -333,15 +461,18 @@
+ 		return;
+ 
+ 	/* Intermediaries */
+-	const int dim=3;
++	int dim=3;
+ 	int i,d;
+-	int numvertices=element->GetNumberOfVertices();
+-	IssmDouble s0[dim], s1[dim], v[dim];
+ 	IssmDouble dist,lsf_old;
+ 
++	int numvertices=element->GetNumberOfVertices();
++
+ 	IssmDouble* lsf = xNew<IssmDouble>(numvertices);
+ 	IssmDouble* sign_lsf = xNew<IssmDouble>(numvertices);
+ 	IssmDouble* signed_dist = xNew<IssmDouble>(numvertices);
++	IssmDouble* s0 = xNew<IssmDouble>(dim);
++	IssmDouble* s1 = xNew<IssmDouble>(dim);
++	IssmDouble* v = xNew<IssmDouble>(dim);
+ 	IssmDouble* xyz_list = NULL;
+ 	IssmDouble* xyz_list_zero = NULL;
+ 
+@@ -354,15 +485,15 @@
+ 		sign_lsf[i]=(lsf[i]>=0.?1.:-1.);
+ 
+ 	element->ZeroLevelsetCoordinates(&xyz_list_zero, xyz_list, MaskIceLevelsetEnum);
+-	for(d=0;d<dim;d++){
+-		s0[d]=xyz_list_zero[0+d];
+-		s1[d]=xyz_list_zero[3+d];
++	for(i=0;i<dim;i++){
++		s0[i]=xyz_list_zero[0+i];
++		s1[i]=xyz_list_zero[3+i];
+ 	}
+ 
+ 	/* get signed_distance of vertices to zero levelset straight */
+ 	for(i=0;i<numvertices;i++){
+ 		for(d=0;d<dim;d++)
+-			v[d]=xyz_list[3*i+d];
++			v[d]=xyz_list[dim*i+d];
+ 		dist=GetDistanceToStraight(&v[0],&s0[0],&s1[0]);
+ 		signed_dist[i]=sign_lsf[i]*dist;
+ 	}
+@@ -370,13 +501,18 @@
+ 	/* insert signed_distance into vec_signed_dist, if computed distance is smaller */
+ 	for(i=0;i<numvertices;i++){
+ 		vec_signed_dist->GetValue(&lsf_old, element->vertices[i]->Sid());
+-		if(xIsNan<IssmDouble>(lsf_old) || fabs(signed_dist[i])<fabs(lsf_old))
++		/* initial lsf values are +-1. Update those fields or if distance to interface smaller.*/
++		if(fabs(lsf_old)==1. || fabs(signed_dist[i])<fabs(lsf_old))
+ 			vec_signed_dist->SetValue(element->vertices[i]->Sid(),signed_dist[i],INS_VAL);
+ 	}
+ 
+ 	xDelete<IssmDouble>(lsf);
+ 	xDelete<IssmDouble>(sign_lsf);
+ 	xDelete<IssmDouble>(signed_dist);
++	xDelete<IssmDouble>(s0);
++	xDelete<IssmDouble>(s1);
++	xDelete<IssmDouble>(v);
++
+ }/*}}}*/
+ IssmDouble LsfReinitializationAnalysis::GetDistanceToStraight(IssmDouble* q, IssmDouble* s0, IssmDouble* s1){/*{{{*/
+ 	// returns distance d of point q to straight going through points s0, s1
+@@ -402,4 +538,29 @@
+ 
+ 	return fabs(a[0]*b[1]-a[1]*b[0])/norm_b;
+ }/*}}}*/
++bool LsfReinitializationAnalysis::ReinitConvergence(Vector<IssmDouble>* lsfg,Vector<IssmDouble>* lsfg_old,IssmDouble reltol){/*{{{*/
+ 
++	/*Output*/
++	bool converged = true;
++
++	/*Intermediary*/
++	Vector<IssmDouble>* dlsfg    = NULL;
++	IssmDouble          norm_dlsf,norm_lsf;
++
++	/*compute norm(du)/norm(u)*/
++	dlsfg=lsfg_old->Duplicate(); lsfg_old->Copy(dlsfg); dlsfg->AYPX(lsfg,-1.0);
++	norm_dlsf=dlsfg->Norm(NORM_TWO); norm_lsf=lsfg_old->Norm(NORM_TWO);
++	if (xIsNan<IssmDouble>(norm_dlsf) || xIsNan<IssmDouble>(norm_lsf)) _error_("convergence criterion is NaN!");
++	if((norm_dlsf/norm_lsf)<reltol){
++		if(VerboseConvergence()) _printf0_("\n"<<setw(50)<<left<<"   Velocity convergence: norm(du)/norm(u)"<<norm_dlsf/norm_lsf*100<<" < "<<reltol*100<<" %\n");
++	}
++	else{ 
++		if(VerboseConvergence()) _printf0_("\n"<<setw(50)<<left<<"   Velocity convergence: norm(du)/norm(u)"<<norm_dlsf/norm_lsf*100<<" > "<<reltol*100<<" %\n");
++		converged=false;
++	}
++
++	/*Cleanup*/
++	delete dlsfg;
++
++	return converged;
++}/*}}}*/
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp	(revision 17502)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp	(revision 17503)
+@@ -75,6 +75,7 @@
+ 		if(solution_enum==SteadystateSolutionEnum && analysis_enum==EnthalpyAnalysisEnum && isenthalpy==false) continue;
+ 		if(solution_enum==TransientSolutionEnum && analysis_enum==LevelsetAnalysisEnum && islevelset==false) continue;
+ 		if(solution_enum==TransientSolutionEnum && analysis_enum==ExtrapolationAnalysisEnum && islevelset==false) continue;
++		if(solution_enum==TransientSolutionEnum && analysis_enum==LsfReinitializationAnalysisEnum && islevelset==false) continue;
+ 
+ 
+ 		if(VerboseMProcessor()) _printf0_("   creating datasets for analysis " << EnumToStringx(analysis_enum) << "\n");
Index: issm/oecreview/Archive/16554-17801/ISSM-17503-17504.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17503-17504.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17503-17504.diff	(revision 17802)
@@ -0,0 +1,284 @@
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17503)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17504)
+@@ -275,40 +275,40 @@
+ 			return;
+ 		case P2xP4Enum :
+ 			/*Corner nodes*/
+-			basis[ 0]=(2./3.)*gauss->coord1*(2.*gauss->coord1-1.)*(zeta-1.)*(zeta-0.5 )*(zeta)*(zeta+0.5);
+-			basis[ 1]=(2./3.)*gauss->coord2*(2.*gauss->coord2-1.)*(zeta-1.)*(zeta-0.5 )*(zeta)*(zeta+0.5);
+-			basis[ 2]=(2./3.)*gauss->coord3*(2.*gauss->coord3-1.)*(zeta-1.)*(zeta-0.5 )*(zeta)*(zeta+0.5);
+-			basis[ 3]=(2./3.)*gauss->coord1*(2.*gauss->coord1-1.)*(zeta-0.5)*(zeta)*(zeta+0.5)*(zeta +1.);
+-			basis[ 4]=(2./3.)*gauss->coord2*(2.*gauss->coord2-1.)*(zeta-0.5)*(zeta)*(zeta+0.5)*(zeta +1.);
+-			basis[ 5]=(2./3.)*gauss->coord3*(2.*gauss->coord3-1.)*(zeta-0.5)*(zeta)*(zeta+0.5)*(zeta +1.);
++			basis[ 0]=gauss->coord1*(2.*gauss->coord1-1.)*(2./3.)*(zeta-1.)*(zeta-0.5 )*(zeta)*(zeta+0.5);
++			basis[ 1]=gauss->coord2*(2.*gauss->coord2-1.)*(2./3.)*(zeta-1.)*(zeta-0.5 )*(zeta)*(zeta+0.5);
++			basis[ 2]=gauss->coord3*(2.*gauss->coord3-1.)*(2./3.)*(zeta-1.)*(zeta-0.5 )*(zeta)*(zeta+0.5);
++			basis[ 3]=gauss->coord1*(2.*gauss->coord1-1.)*(2./3.)*(zeta-0.5)*(zeta)*(zeta+0.5)*(zeta +1.);
++			basis[ 4]=gauss->coord2*(2.*gauss->coord2-1.)*(2./3.)*(zeta-0.5)*(zeta)*(zeta+0.5)*(zeta +1.);
++			basis[ 5]=gauss->coord3*(2.*gauss->coord3-1.)*(2./3.)*(zeta-0.5)*(zeta)*(zeta+0.5)*(zeta +1.);
+ 			/*mid-sides of quads*/
+-			basis[ 6]=4.*gauss->coord1*(2.*gauss->coord1-1)*(zeta-1.)*(zeta-0.5)*(zeta+0.5)*(zeta+1.);
+-			basis[ 7]=4.*gauss->coord2*(2.*gauss->coord2-1)*(zeta-1.)*(zeta-0.5)*(zeta+0.5)*(zeta+1.);
+-			basis[ 8]=4.*gauss->coord3*(2.*gauss->coord3-1)*(zeta-1.)*(zeta-0.5)*(zeta+0.5)*(zeta+1.);
++			basis[ 6]=gauss->coord1*(2.*gauss->coord1-1)*4.*(zeta-1.)*(zeta-0.5)*(zeta+0.5)*(zeta+1.);
++			basis[ 7]=gauss->coord2*(2.*gauss->coord2-1)*4.*(zeta-1.)*(zeta-0.5)*(zeta+0.5)*(zeta+1.);
++			basis[ 8]=gauss->coord3*(2.*gauss->coord3-1)*4.*(zeta-1.)*(zeta-0.5)*(zeta+0.5)*(zeta+1.);
+ 			/*mid-sides of triangles*/
+-			basis[ 9]=(8./3.)*gauss->coord2*gauss->coord3*(zeta-1.)*(zeta-0.5)*zeta*(zeta+0.5);
+-			basis[10]=(8./3.)*gauss->coord1*gauss->coord3*(zeta-1.)*(zeta-0.5)*zeta*(zeta+0.5);
+-			basis[11]=(8./3.)*gauss->coord1*gauss->coord2*(zeta-1.)*(zeta-0.5)*zeta*(zeta+0.5);
+-			basis[12]=(8./3.)*gauss->coord2*gauss->coord3*(zeta-0.5)*zeta*(zeta+0.5)*(zeta+1.);
+-			basis[13]=(8./3.)*gauss->coord1*gauss->coord3*(zeta-0.5)*zeta*(zeta+0.5)*(zeta+1.);
+-			basis[14]=(8./3.)*gauss->coord1*gauss->coord2*(zeta-0.5)*zeta*(zeta+0.5)*(zeta+1.);
++			basis[ 9]=4.*gauss->coord2*gauss->coord3*(2./3.)*(zeta-1.)*(zeta-0.5)*zeta*(zeta+0.5);
++			basis[10]=4.*gauss->coord1*gauss->coord3*(2./3.)*(zeta-1.)*(zeta-0.5)*zeta*(zeta+0.5);
++			basis[11]=4.*gauss->coord1*gauss->coord2*(2./3.)*(zeta-1.)*(zeta-0.5)*zeta*(zeta+0.5);
++			basis[12]=4.*gauss->coord2*gauss->coord3*(2./3.)*(zeta-0.5)*zeta*(zeta+0.5)*(zeta+1.);
++			basis[13]=4.*gauss->coord1*gauss->coord3*(2./3.)*(zeta-0.5)*zeta*(zeta+0.5)*(zeta+1.);
++			basis[14]=4.*gauss->coord1*gauss->coord2*(2./3.)*(zeta-0.5)*zeta*(zeta+0.5)*(zeta+1.);
+ 			/*quarter-sides of quads*/
+-			basis[15]=-(8./3.)*gauss->coord1*(2.*gauss->coord1-1.)*(zeta-1.0)*(zeta-0.5)*zeta*(zeta+1.);
+-			basis[16]=-(8./3.)*gauss->coord2*(2.*gauss->coord2-1.)*(zeta-1.0)*(zeta-0.5)*zeta*(zeta+1.);
+-			basis[17]=-(8./3.)*gauss->coord3*(2.*gauss->coord3-1.)*(zeta-1.0)*(zeta-0.5)*zeta*(zeta+1.);
+-			basis[18]=-(8./3.)*gauss->coord1*(2.*gauss->coord1-1.)*(zeta-1.0)*zeta*(zeta+0.5)*(zeta+1.);
+-			basis[19]=-(8./3.)*gauss->coord2*(2.*gauss->coord2-1.)*(zeta-1.0)*zeta*(zeta+0.5)*(zeta+1.);
+-			basis[20]=-(8./3.)*gauss->coord3*(2.*gauss->coord3-1.)*(zeta-1.0)*zeta*(zeta+0.5)*(zeta+1.);
++			basis[15]=gauss->coord1*(2.*gauss->coord1-1.)*(-8./3.)*(zeta-1.0)*(zeta-0.5)*zeta*(zeta+1.);
++			basis[16]=gauss->coord2*(2.*gauss->coord2-1.)*(-8./3.)*(zeta-1.0)*(zeta-0.5)*zeta*(zeta+1.);
++			basis[17]=gauss->coord3*(2.*gauss->coord3-1.)*(-8./3.)*(zeta-1.0)*(zeta-0.5)*zeta*(zeta+1.);
++			basis[18]=gauss->coord1*(2.*gauss->coord1-1.)*(-8./3.)*(zeta-1.0)*zeta*(zeta+0.5)*(zeta+1.);
++			basis[19]=gauss->coord2*(2.*gauss->coord2-1.)*(-8./3.)*(zeta-1.0)*zeta*(zeta+0.5)*(zeta+1.);
++			basis[20]=gauss->coord3*(2.*gauss->coord3-1.)*(-8./3.)*(zeta-1.0)*zeta*(zeta+0.5)*(zeta+1.);
+ 			/* mid-sides of interior triangles*/
+-			basis[21]=-(32./3.)*gauss->coord2*gauss->coord3*(zeta-1.0)*(zeta-0.5)*zeta*(zeta+1.);
+-			basis[22]=-(32./3.)*gauss->coord1*gauss->coord3*(zeta-1.0)*(zeta-0.5)*zeta*(zeta+1.);
+-			basis[23]=-(32./3.)*gauss->coord1*gauss->coord2*(zeta-1.0)*(zeta-0.5)*zeta*(zeta+1.);
+-			basis[24]=16.*gauss->coord2*gauss->coord3*(zeta-1.0)*(zeta-0.5)*(zeta+0.5)*(zeta+1.);
+-			basis[25]=16.*gauss->coord1*gauss->coord3*(zeta-1.0)*(zeta-0.5)*(zeta+0.5)*(zeta+1.);
+-			basis[26]=16.*gauss->coord1*gauss->coord2*(zeta-1.0)*(zeta-0.5)*(zeta+0.5)*(zeta+1.);
+-			basis[27]=-(32./3.)*gauss->coord2*gauss->coord3*(zeta-1.0)*zeta*(zeta+0.5)*(zeta+1.);
+-			basis[28]=-(32./3.)*gauss->coord1*gauss->coord3*(zeta-1.0)*zeta*(zeta+0.5)*(zeta+1.);
+-			basis[29]=-(32./3.)*gauss->coord1*gauss->coord2*(zeta-1.0)*zeta*(zeta+0.5)*(zeta+1.);
++			basis[21]=4.*gauss->coord2*gauss->coord3*(-8./3.)*(zeta-1.0)*(zeta-0.5)*zeta*(zeta+1.);
++			basis[22]=4.*gauss->coord1*gauss->coord3*(-8./3.)*(zeta-1.0)*(zeta-0.5)*zeta*(zeta+1.);
++			basis[23]=4.*gauss->coord1*gauss->coord2*(-8./3.)*(zeta-1.0)*(zeta-0.5)*zeta*(zeta+1.);
++			basis[24]=4.*gauss->coord2*gauss->coord3*4.*(zeta-1.0)*(zeta-0.5)*(zeta+0.5)*(zeta+1.);
++			basis[25]=4.*gauss->coord1*gauss->coord3*4.*(zeta-1.0)*(zeta-0.5)*(zeta+0.5)*(zeta+1.);
++			basis[26]=4.*gauss->coord1*gauss->coord2*4.*(zeta-1.0)*(zeta-0.5)*(zeta+0.5)*(zeta+1.);
++			basis[27]=4.*gauss->coord2*gauss->coord3*(-8./3.)*(zeta-1.0)*zeta*(zeta+0.5)*(zeta+1.);
++			basis[28]=4.*gauss->coord1*gauss->coord3*(-8./3.)*(zeta-1.0)*zeta*(zeta+0.5)*(zeta+1.);
++			basis[29]=4.*gauss->coord1*gauss->coord2*(-8./3.)*(zeta-1.0)*zeta*(zeta+0.5)*(zeta+1.);
+ 			return;
+ 		case P1xP3Enum :
+ 			/*Corner nodes*/
+@@ -656,123 +656,123 @@
+ 			/*Nodal function 1*/
+ 			dbasis[NUMNODESP2xP4*0+0 ] = (-2* gauss->coord1 + 0.5 ) *(2./3.) *(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta+0.5) ; 
+ 			dbasis[NUMNODESP2xP4*1+0 ] = (-((2.*SQRT3)/(3.))*gauss->coord1 + (SQRT3/6.) )*(2./3.)*(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta+0.5) ; 
+-			dbasis[NUMNODESP2xP4*2+0 ] = (2./3.)* gauss->coord1 *(2.* gauss->coord1 -1)*( (2.*zeta-1)*(zeta -0.5)*(zeta +0.5) + 2.* zeta *zeta *(zeta -1.)); 
++			dbasis[NUMNODESP2xP4*2+0 ] =  gauss->coord1 *(2.* gauss->coord1 -1)* 2./3.*( (2.*zeta-1)*(zeta -0.5)*(zeta +0.5) + 2.* zeta *zeta *(zeta -1.)); 
+ 			/*Nodal function 2*/
+ 			dbasis[NUMNODESP2xP4*0+1 ] = (2.*gauss->coord2 - 0.5 ) *(2./3.) *(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta+0.5) ; 
+ 			dbasis[NUMNODESP2xP4*1+1 ] = (-((2.*SQRT3)/(3.))*gauss->coord2 + (SQRT3/6.) )*(2./3.)*(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta+0.5) ; 
+-			dbasis[NUMNODESP2xP4*2+1 ] = (2./3.)*gauss->coord2*(2.*gauss->coord2 -1.)*((2.*zeta-1.)*(zeta -0.5)*(zeta +0.5) + 2. * zeta *zeta*(zeta -1.)); 
++			dbasis[NUMNODESP2xP4*2+1 ] = gauss->coord2*(2.*gauss->coord2 -1.)* 2./3.* ((2.*zeta-1.)*(zeta -0.5)*(zeta +0.5) + 2. * zeta *zeta*(zeta -1.)); 
+ 			/*Nodal function 3*/
+ 			dbasis[NUMNODESP2xP4*0+2 ] = 0. ; 
+ 			dbasis[NUMNODESP2xP4*1+2 ] = (((4.*SQRT3)/(3.))*gauss->coord3 - (SQRT3)/(3.))*(2./3.)*(zeta -1.)*(zeta-0.5)*(zeta)*(zeta+0.5); 
+-			dbasis[NUMNODESP2xP4*2+2 ] = (2./3.)*gauss->coord3*(2.* gauss->coord3 -1.)*( (2.*zeta-1.)*(zeta -0.5)*(zeta +0.5) + 2.*zeta *zeta*(zeta -1.)); 
++			dbasis[NUMNODESP2xP4*2+2 ] = gauss->coord3*(2.* gauss->coord3 -1.)* 2./3.*( (2.*zeta-1.)*(zeta -0.5)*(zeta +0.5) + 2.*zeta *zeta*(zeta -1.)); 
+ 			/*Nodal function 4*/
+ 			dbasis[NUMNODESP2xP4*0+3 ] = (-2.* gauss->coord1 + 0.5 ) *(2./3.) *(zeta - 0.5)*(zeta)*(zeta+0.5)*(zeta +1. ); 
+ 			dbasis[NUMNODESP2xP4*1+3 ] = (-((2.*SQRT3)/(3.)) *gauss->coord1 + (SQRT3)/(6.) ) *(2./3.) *(zeta - 0.5)*(zeta)*(zeta+0.5)*(zeta +1. ); 
+-			dbasis[NUMNODESP2xP4*2+3 ] = (2./3.)*gauss->coord1*(2.*gauss->coord1 -1.)*( (2.*zeta+1.)*(zeta -0.5)*(zeta +0.5) + 2.*zeta *zeta*(zeta +1.)); 
++			dbasis[NUMNODESP2xP4*2+3 ] = gauss->coord1*(2.*gauss->coord1 -1.)* 2./3.*( (2.*zeta+1.)*(zeta -0.5)*(zeta +0.5) + 2.*zeta *zeta*(zeta +1.)); 
+ 			/*Nodal function 5*/
+ 			dbasis[NUMNODESP2xP4*0+4 ] = (2*gauss->coord2 - 0.5 ) *(2./3.) *(zeta - 0.5)*(zeta)*(zeta+0.5)*(zeta +1. ); 
+ 			dbasis[NUMNODESP2xP4*1+4 ] = (-((2.*SQRT3)/(3.)) *gauss->coord2 + (SQRT3/6.))*(2./3.)*(zeta - 0.5)*(zeta)*(zeta+0.5)*(zeta +1. );
+-			dbasis[NUMNODESP2xP4*2+4 ] = (2./3.)*gauss->coord2 *(2.*gauss->coord2 -1.)*( (2.*zeta+1.)*(zeta -0.5)*(zeta +0.5) + 2.*zeta *zeta*(zeta +1.)); 
++			dbasis[NUMNODESP2xP4*2+4 ] = gauss->coord2 *(2.*gauss->coord2 -1.)* 2./3.*( (2.*zeta+1.)*(zeta -0.5)*(zeta +0.5) + 2.*zeta *zeta*(zeta +1.)); 
+ 			/*Nodal function 6*/
+ 			dbasis[NUMNODESP2xP4*0+5 ] = 0. ; 
+ 			dbasis[NUMNODESP2xP4*1+5 ] = (((4.*SQRT3)/(3.))*gauss->coord3 - SQRT3/3. ) *(2./3.) *(zeta - 0.5)*(zeta)*(zeta+0.5)*(zeta +1. ); 
+-			dbasis[NUMNODESP2xP4*2+5 ] = (2./3.)*gauss->coord3 *(2.*gauss->coord3 -1.)*( (2.*zeta+1.)*(zeta -0.5)*(zeta +0.5) + 2.*zeta *zeta*(zeta +1)); 
++			dbasis[NUMNODESP2xP4*2+5 ] = gauss->coord3 *(2.*gauss->coord3 -1.)* 2./3.*( (2.*zeta+1.)*(zeta -0.5)*(zeta +0.5) + 2.*zeta *zeta*(zeta +1)); 
+ 			/*Nodal function 7*/
+-			dbasis[NUMNODESP2xP4*0+6 ] =  4.*(-2.* gauss->coord1 + 0.5 ) *(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*1+6 ] =  4.*(-((2.*SQRT3)/(3.)) *gauss->coord1 + (SQRT3)/(6.) )*(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1.)  ; 
+-			dbasis[NUMNODESP2xP4*2+6 ] =  4.*gauss->coord1*(2.*gauss->coord1-1)*( 4.*zeta *zeta*zeta - (5./2.)*zeta ); 
++			dbasis[NUMNODESP2xP4*0+6 ] =  (-2.* gauss->coord1 + 0.5 ) * 4.*(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*1+6 ] =  (-((2.*SQRT3)/(3.)) *gauss->coord1 + (SQRT3)/(6.) )* 4.*(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1.)  ; 
++			dbasis[NUMNODESP2xP4*2+6 ] =  gauss->coord1*(2.*gauss->coord1-1)* 4.*( 4.*zeta *zeta*zeta - (5./2.)*zeta ); 
+ 			/*Nodal function 8*/
+-			dbasis[NUMNODESP2xP4*0+7 ] =  4.*(2*gauss->coord2 - 0.5 )*(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*1+7 ] =  4.*(-((2.*SQRT3)/(3.)) *gauss->coord2 + (SQRT3)/(6.)) *(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. )  ; 
+-			dbasis[NUMNODESP2xP4*2+7 ] =  4.*gauss->coord2*(2.*gauss->coord2-1)*( 4.*zeta *zeta*zeta - (5./2.)*zeta ); 
++			dbasis[NUMNODESP2xP4*0+7 ] =  (2*gauss->coord2 - 0.5 )* 4.*(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*1+7 ] =  (-((2.*SQRT3)/(3.)) *gauss->coord2 + (SQRT3)/(6.)) * 4.*(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. )  ; 
++			dbasis[NUMNODESP2xP4*2+7 ] =  gauss->coord2*(2.*gauss->coord2-1)* 4.*( 4.*zeta *zeta*zeta - (5./2.)*zeta ); 
+ 			/*Nodal function 9*/
+ 			dbasis[NUMNODESP2xP4*0+8 ] = 0. ; 
+-			dbasis[NUMNODESP2xP4*1+8 ] = 4.*(((4.*SQRT3)/(3.))*gauss->coord3 - SQRT3/3. ) *(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. )  ; 
+-			dbasis[NUMNODESP2xP4*2+8 ] =  4.*gauss->coord3*(2.*gauss->coord3-1)*( 4.*zeta *zeta*zeta - (5./2.)*zeta ); 
++			dbasis[NUMNODESP2xP4*1+8 ] = (((4.*SQRT3)/(3.))*gauss->coord3 - SQRT3/3. ) * 4.*(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. )  ; 
++			dbasis[NUMNODESP2xP4*2+8 ] = gauss->coord3*(2.*gauss->coord3-1)* 4.*( 4.*zeta *zeta*zeta - (5./2.)*zeta ); 
+ 			/*Nodal function 10*/
+-			dbasis[NUMNODESP2xP4*0+9 ] = (4./3.)*(gauss->coord3 )*(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta+0.5) ; 
+-			dbasis[NUMNODESP2xP4*1+9 ] =  4.* (((- SQRT3)/6.)* gauss->coord3+ (SQRT3/3.) *gauss->coord2) *(2./3.) *(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta+0.5);
++			dbasis[NUMNODESP2xP4*0+9 ] = 2.*gauss->coord3 * 2./3.*(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta+0.5) ; 
++			dbasis[NUMNODESP2xP4*1+9 ] = (4.* SQRT3/3.* gauss->coord2- 2.*SQRT3/3. *gauss->coord3) *(2./3.) *(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta+0.5);
+ 			dbasis[NUMNODESP2xP4*2+9 ] = 4.* gauss->coord2 * gauss->coord3 *(2./3.)*((2.*zeta-1.)*(zeta -0.5)*(zeta +0.5) + 2.* zeta*zeta*(zeta -1.)); 
+ 			/*Nodal function 11*/
+-			dbasis[NUMNODESP2xP4*0+10] = -(4./3.)* gauss->coord3*(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta+0.5) ; 
+-			dbasis[NUMNODESP2xP4*1+10] =  4.* ((SQRT3/3.)*gauss->coord1- (SQRT3/6.)*gauss->coord3) *(2./3.) *(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta+0.5);
++			dbasis[NUMNODESP2xP4*0+10] = -2.* gauss->coord3* 2./3.*(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta+0.5) ; 
++			dbasis[NUMNODESP2xP4*1+10] = (4.*SQRT3/3.*gauss->coord1 - 2.*SQRT3/3.*gauss->coord3) * (2./3.) *(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta+0.5);
+ 			dbasis[NUMNODESP2xP4*2+10] = 4.* gauss->coord3*gauss->coord1 *(2./3.)*( (2*zeta-1.)*(zeta -0.5)*(zeta +0.5) + 2* zeta * zeta*(zeta -1));
+ 			/*Nodal function 12*/
+-			dbasis[NUMNODESP2xP4*0+11] = 4.* (gauss->coord1*0.5- gauss->coord2 *0.5 )*(2./3.) *(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta+0.5) ; 
+-			dbasis[NUMNODESP2xP4*1+11] =  4.* (- (SQRT3/6.) *gauss->coord2 - (SQRT3/6.) *gauss->coord1) *(2./3.) *(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta+0.5);
++			dbasis[NUMNODESP2xP4*0+11] = 2.* (gauss->coord1- gauss->coord2)* (2./3.) *(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta+0.5) ; 
++			dbasis[NUMNODESP2xP4*1+11] = -2.* SQRT3/3.*(gauss->coord2 +gauss->coord1) *(2./3.) *(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta+0.5);
+ 			dbasis[NUMNODESP2xP4*2+11] = 4.* gauss->coord1*gauss->coord2 *(2./3.) *( (2.*zeta-1)*(zeta -0.5)*(zeta +0.5) + 2* zeta* zeta*(zeta -1));
+ 			/*Nodal function 13*/
+-			dbasis[NUMNODESP2xP4*0+12] = (4./3.) * gauss->coord3 *(zeta - 0.5)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*1+12] =  4.* ( (- SQRT3/6. ) * gauss->coord3 + (SQRT3/3.) *gauss->coord2) *(2./3.) *(zeta - 0.5)*(zeta)*(zeta+0.5)*(zeta +1. );
+-			dbasis[NUMNODESP2xP4*2+12] = 4.* gauss->coord2*gauss->coord3 *(2./3.)*( (2.*zeta+1.)*(zeta -0.5)*(zeta +0.5) + 2*zeta*zeta*(zeta +1.)); 
++			dbasis[NUMNODESP2xP4*0+12] = 2.* gauss->coord3 * 2./3.*(zeta - 0.5)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*1+12] = (4.*SQRT3/3.* gauss->coord2 - 2.*SQRT3/3. *gauss->coord3) *(2./3.) *(zeta - 0.5)*(zeta)*(zeta+0.5)*(zeta +1. );
++			dbasis[NUMNODESP2xP4*2+12] = 4.*gauss->coord2*gauss->coord3 *(2./3.)*( (2.*zeta+1.)*(zeta -0.5)*(zeta +0.5) + 2*zeta*zeta*(zeta +1.)); 
+ 			/*Nodal function 14*/
+-			dbasis[NUMNODESP2xP4*0+13] = (- 4./3.) *gauss->coord3*(zeta - 0.5)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*1+13] = 4.* ((SQRT3/3.)*gauss->coord1- (SQRT3/6.)*gauss->coord3) *(2./3.) *(zeta - 0.5)*(zeta)*(zeta+0.5)*(zeta +1. );
+-			dbasis[NUMNODESP2xP4*2+13] = 4.* gauss->coord3*gauss->coord1 *(2./3.)*( (2.*zeta+1.)*(zeta -0.5)*(zeta +0.5) + 2.*zeta *zeta*(zeta +1.)); 
++			dbasis[NUMNODESP2xP4*0+13] = - 2.*gauss->coord3* 2./3.*(zeta - 0.5)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*1+13] = (4.*SQRT3/3.*gauss->coord1- 2.*SQRT3/3.*gauss->coord3) * (2./3.) *(zeta - 0.5)*(zeta)*(zeta+0.5)*(zeta +1. );
++			dbasis[NUMNODESP2xP4*2+13] = 4.*gauss->coord3*gauss->coord1 *(2./3.)*( (2.*zeta+1.)*(zeta -0.5)*(zeta +0.5) + 2.*zeta *zeta*(zeta +1.)); 
+ 			/*Nodal function 15*/
+-			dbasis[NUMNODESP2xP4*0+14] = 4.* ( gauss->coord1*0.5- gauss->coord2*0.5) *(2./3.) *(zeta - 0.5)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*1+14] = 4.* (- (SQRT3/6.)*gauss->coord2 - (SQRT3/6.)*gauss->coord1) *(2./3.) *(zeta - 0.5)*(zeta)*(zeta+0.5)*(zeta +1. );
+-			dbasis[NUMNODESP2xP4*2+14] = 4.* gauss->coord1*gauss->coord2 *(2./3.)*( (2.*zeta+1.)*(zeta -0.5)*(zeta +0.5) + 2* zeta *zeta*(zeta +1.)); 
++			dbasis[NUMNODESP2xP4*0+14] = 2.* (gauss->coord1- gauss->coord2)* (2./3.) *(zeta - 0.5)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*1+14] = -2.* SQRT3/3.*(gauss->coord2 +gauss->coord1) *(2./3.) *(zeta - 0.5)*(zeta)*(zeta+0.5)*(zeta +1. );
++			dbasis[NUMNODESP2xP4*2+14] = 4.*gauss->coord1*gauss->coord2 *(2./3.)*( (2.*zeta+1.)*(zeta -0.5)*(zeta +0.5) + 2* zeta *zeta*(zeta +1.)); 
+ 			/*Nodal function 16*/
+-			dbasis[NUMNODESP2xP4*0+15] =  -(8./3.) *(-2.* gauss->coord1 + 0.5 )*(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*1+15] =  -(8./3.) *(-((2.*SQRT3)/(3.)) *gauss->coord1 + (SQRT3)/(6.) ) *(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*2+15] =  -(8./3.) *gauss->coord1*(2.*gauss->coord1-1) *((2.*zeta -1. )*(zeta-0.5)*(zeta +1.) +  zeta*(zeta -1.)*( 2.*zeta + 0.5)); 
++			dbasis[NUMNODESP2xP4*0+15] = (-2.* gauss->coord1 + 0.5 )* (-8./3.)*(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*1+15] = (-2.*SQRT3/3. *gauss->coord1 + SQRT3/6.) * (-8./3.)*(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*2+15] = gauss->coord1*(2.*gauss->coord1-1) * (-8./3.)*((2.*zeta -1.)*(zeta-0.5)*(zeta +1.) +zeta*(zeta -1.)*( 2.*zeta + 0.5)); 
+ 			/*Nodal function 17*/
+-			dbasis[NUMNODESP2xP4*0+16] = - (8./3.) *(2*gauss->coord2 - 0.5 )*(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*1+16] = - (8./3.)*(-((2.*SQRT3)/(3.)) *gauss->coord2 + (SQRT3/6.))*(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*2+16] = - (8./3.)*gauss->coord2*(2.*gauss->coord2-1) *((2.*zeta -1. )*(zeta-0.5)*(zeta +1.) +  zeta *(zeta -1.)*( 2.*zeta + 0.5)); 
++			dbasis[NUMNODESP2xP4*0+16] = (2*gauss->coord2 - 0.5 )* (-8./3.)*(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*1+16] = (-2.*SQRT3/3. *gauss->coord2 + SQRT3/6.)* (-8./3.)*(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*2+16] = gauss->coord2*(2.*gauss->coord2-1) * (-8./3.)*((2.*zeta -1.)*(zeta-0.5)*(zeta +1.) +zeta *(zeta -1.)*( 2.*zeta + 0.5)); 
+ 			/*Nodal function 18*/
+ 			dbasis[NUMNODESP2xP4*0+17] = 0. ; 
+-			dbasis[NUMNODESP2xP4*1+17] =  -(8./3.) *(((4.*SQRT3)/(3.))*gauss->coord3 - SQRT3/3. )*(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*2+17] =  -(8./3.)*gauss->coord3*(2*gauss->coord3-1) *((2.* zeta -1. ) *(zeta-0.5)* (zeta +1.) +  zeta *(zeta -1.)*( 2.*zeta + 0.5));
++			dbasis[NUMNODESP2xP4*1+17] = (4.*SQRT3/3.*gauss->coord3 - SQRT3/3. )* (-8./3.)*(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*2+17] = gauss->coord3*(2*gauss->coord3-1) * (-8./3.)*((2.*zeta-1.)*(zeta-0.5)*(zeta +1.) +zeta *(zeta -1.)*( 2.*zeta + 0.5));
+ 			/*Nodal function 19*/
+-			dbasis[NUMNODESP2xP4*0+18] =  -(8./3.)*(-2.* gauss->coord1 + 0.5 ) *(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*1+18] =  -(8./3.)* (-((2.*SQRT3)/(3.)) *gauss->coord1 + (SQRT3)/(6.) )*(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*2+18] =  -(8./3.)*gauss->coord1*(2.*gauss->coord1-1) *((2.*zeta -1. ) *(zeta+0.5)* (zeta +1.) +  zeta* (zeta -1.)*( 2.*zeta + 3./2.));
++			dbasis[NUMNODESP2xP4*0+18] = (-2.* gauss->coord1 + 0.5 ) * (-8./3.)*(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*1+18] =  (-2.*SQRT3/3. *gauss->coord1 + SQRT3/6. )* (-8./3.)*(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*2+18] = gauss->coord1*(2.*gauss->coord1-1) * (-8./3.)*((2.*zeta -1. ) *(zeta+0.5)* (zeta +1.) +  zeta* (zeta -1.)*( 2.*zeta + 3./2.));
+ 			/*Nodal function 20*/
+-			dbasis[NUMNODESP2xP4*0+19] =  -(8./3.)*(2*gauss->coord2 - 0.5 )*(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*1+19] =  -(8./3.)*(-((2.*SQRT3)/(3.)) *gauss->coord2 + (SQRT3/6.)) *(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*2+19] =  -(8./3.)*gauss->coord2*(2.*gauss->coord2-1)*((2.*zeta -1. )*(zeta+0.5)*(zeta +1.) +  zeta*(zeta -1.)*( 2.*zeta + 3./2.)); 
++			dbasis[NUMNODESP2xP4*0+19] = (2*gauss->coord2 - 0.5 )* (-8./3.)*(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*1+19] = (-2.*SQRT3/3.*gauss->coord2 + SQRT3/6.) * (-8./3.)*(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*2+19] = gauss->coord2*(2.*gauss->coord2-1)* (-8./3.)*((2.*zeta -1. )*(zeta+0.5)*(zeta +1.) +  zeta*(zeta -1.)*( 2.*zeta + 3./2.)); 
+ 			/*Nodal function 21*/
+ 			dbasis[NUMNODESP2xP4*0+20] = 0 ; 
+-			dbasis[NUMNODESP2xP4*1+20] =  -(8./3.)* (((4.*SQRT3)/(3.))*gauss->coord3 - SQRT3/3. ) *(zeta - 1.)*(zeta + 0.5)*(zeta)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*2+20] =  -(8./3.)*gauss->coord3*(2*gauss->coord3-1) *((2. *zeta -1. )*(zeta+0.5)*(zeta +1.) +  zeta*(zeta -1.)*( 2.*zeta + 3./2.));
++			dbasis[NUMNODESP2xP4*1+20] = (4.*SQRT3/3.*gauss->coord3 - SQRT3/3.)* (-8./3.)*(zeta - 1.)*(zeta + 0.5)*(zeta)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*2+20] = gauss->coord3*(2*gauss->coord3-1) * (-8./3.)*((2. *zeta -1. )*(zeta+0.5)*(zeta +1.) +  zeta*(zeta -1.)*( 2.*zeta + 3./2.));
+ 			/*Nodal function 22*/
+-			dbasis[NUMNODESP2xP4*0+21] = -(32./6.) *gauss->coord3 *(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ); 
+-			dbasis[NUMNODESP2xP4*1+21] = -(32./3.)*(- (SQRT3/6.)*gauss->coord3+ (SQRT3/3.)*gauss->coord2 ) *(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*2+21] = -(32./3.)*gauss->coord2 *gauss->coord3*((2.*zeta -1. )*(zeta-0.5)*(zeta +1.) +  zeta*(zeta -1.)*( 2.*zeta + 0.5)); 
++			dbasis[NUMNODESP2xP4*0+21] = 2. *gauss->coord3 * (-8./3.)*(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ); 
++			dbasis[NUMNODESP2xP4*1+21] = (4.* SQRT3/3.*gauss->coord2- 2.*SQRT3/3.*gauss->coord3) * (-8./3.)*(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*2+21] = 4.*gauss->coord2 *gauss->coord3* (-8./3.)*((2.*zeta -1. )*(zeta-0.5)*(zeta +1.) +  zeta*(zeta -1.)*( 2.*zeta + 0.5)); 
+ 			/*Nodal function 23*/
+-			dbasis[NUMNODESP2xP4*0+22] = (32./6.) *gauss->coord3 *(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ); 
+-			dbasis[NUMNODESP2xP4*1+22] = -(32./3.)*( (SQRT3/3.)*gauss->coord1- (SQRT3/6.)*gauss->coord3 )*(zeta -1.)*(zeta - 0.5)*(zeta)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*2+22] = -(32./3.) *gauss->coord1*gauss->coord3*((2.*zeta -1. )*(zeta-0.5)*(zeta +1.) +  zeta*(zeta -1.)*( 2.*zeta + 0.5)); 
++			dbasis[NUMNODESP2xP4*0+22] = -2. *gauss->coord3 *( -8./3.)*(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ); 
++			dbasis[NUMNODESP2xP4*1+22] = (4.* SQRT3/3.*gauss->coord1- 2.*SQRT3/3.*gauss->coord3 )*(-8./3.)*(zeta -1.)*(zeta - 0.5)*(zeta)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*2+22] = 4.*gauss->coord1*gauss->coord3* (-8./3.)*((2.*zeta -1. )*(zeta-0.5)*(zeta +1.) +  zeta*(zeta -1.)*( 2.*zeta + 0.5)); 
+ 			/*Nodal function 24*/
+-			dbasis[NUMNODESP2xP4*0+23] = -(32./3.)*( gauss->coord1*0.5- gauss->coord2*0.5) *(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ); 
+-			dbasis[NUMNODESP2xP4*1+23] = -(32./3.)*(- (SQRT3/6.)*gauss->coord2- (SQRT3/6.)*gauss->coord1 ) *(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*2+23] = -(32./3.)*gauss->coord1*gauss->coord2*((2.*zeta -1. )* (zeta-0.5) *(zeta +1.) +  zeta* (zeta -1.)*( 2.*zeta + 0.5));
++			dbasis[NUMNODESP2xP4*0+23] = 2.*(gauss->coord1- gauss->coord2) * (-8./3.)*(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ); 
++			dbasis[NUMNODESP2xP4*1+23] = -2.*SQRT3/3.*(gauss->coord2+ gauss->coord1) * (-8./3.)*(zeta - 1.)*(zeta - 0.5)*(zeta)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*2+23] = 4.*gauss->coord1*gauss->coord2* (-8./3.)*((2.*zeta -1. )* (zeta-0.5) *(zeta +1.) +  zeta* (zeta -1.)*( 2.*zeta + 0.5));
+ 			/*Nodal function 25*/
+-			dbasis[NUMNODESP2xP4*0+24] = 8. *gauss->coord3 *(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. ); 
+-			dbasis[NUMNODESP2xP4*1+24] = 16.*(- (SQRT3/6.)*gauss->coord3 + (SQRT3/3.) *gauss->coord2) *(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*2+24] = 16.* gauss->coord2 * gauss->coord3* ( 4.* zeta*zeta*zeta - (5./2.) *zeta ); 
++			dbasis[NUMNODESP2xP4*0+24] = 2. *gauss->coord3 *4.*(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. ); 
++			dbasis[NUMNODESP2xP4*1+24] = (4.*SQRT3/3.*gauss->coord2 - 2.* SQRT3/3. *gauss->coord3) *4.*(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*2+24] = 4.* gauss->coord2 * gauss->coord3* 4.*( 4.* zeta*zeta*zeta - 5./2. *zeta ); 
+ 			/*Nodal function 26*/
+-			dbasis[NUMNODESP2xP4*0+25] = -8. *gauss->coord3*(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. ); 
+-			dbasis[NUMNODESP2xP4*1+25] = 16.*((SQRT3/3.)*gauss->coord1- (SQRT3/6.)*gauss->coord3 )*(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*2+25] = 16. * gauss->coord1 * gauss->coord3 *( 4. *zeta*zeta*zeta - (5./2.)* zeta );
++			dbasis[NUMNODESP2xP4*0+25] = -2. *gauss->coord3*4.*(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. ); 
++			dbasis[NUMNODESP2xP4*1+25] = (4.*SQRT3/3.*gauss->coord1- 2.*SQRT3/3.*gauss->coord3 )*4.*(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*2+25] = 4. * gauss->coord1 * gauss->coord3 *4.*( 4. *zeta*zeta*zeta - 5./2.* zeta );
+ 			/*Nodal function 27*/
+-			dbasis[NUMNODESP2xP4*0+26] = 16.*( gauss->coord1*0.5-gauss->coord2*0.5) *(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. ); 
+-			dbasis[NUMNODESP2xP4*1+26] = 16.*(- (SQRT3/6.)*gauss->coord2- (SQRT3/6.)*gauss->coord1 )*(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*2+26] = 16. *gauss->coord1 *gauss->coord2 *( 4.* zeta*zeta*zeta - (5./2.)*zeta ); 
++			dbasis[NUMNODESP2xP4*0+26] = 2.*( gauss->coord1-gauss->coord2) * 4.*(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. ); 
++			dbasis[NUMNODESP2xP4*1+26] = -2.* SQRT3/3.*(gauss->coord1+ gauss->coord2 )*4.*(zeta - 1.)*(zeta - 0.5)*(zeta+0.5)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*2+26] = 4. *gauss->coord1 *gauss->coord2 *4.*( 4.* zeta*zeta*zeta - 5./2.*zeta ); 
+ 			/*Nodal function 28*/
+-			dbasis[NUMNODESP2xP4*0+27] = -(32./6.)* gauss->coord3*(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ); 
+-			dbasis[NUMNODESP2xP4*1+27] = -(32./3.)*(- (SQRT3/6.)*gauss->coord3+ (SQRT3/3.)*gauss->coord2 ) *(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*2+27] = -(32./3.)* gauss->coord2*gauss->coord3* ((2.*zeta -1. )*(zeta+0.5)*(zeta +1.) +  zeta*(zeta -1.)*( 2.*zeta + (3./2.))); 
++			dbasis[NUMNODESP2xP4*0+27] = 2.* gauss->coord3* (-8./3.)*(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ); 
++			dbasis[NUMNODESP2xP4*1+27] = (4.*SQRT3/3.*gauss->coord2- 2.*SQRT3/3.*gauss->coord3) * (-8./3.)*(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*2+27] = 4.* gauss->coord2*gauss->coord3* (-8./3.)*((2.*zeta -1. )*(zeta+0.5)*(zeta +1.) +zeta*(zeta -1.)*( 2.*zeta + 3./2.)); 
+ 			/*Nodal function 29*/
+-			dbasis[NUMNODESP2xP4*0+28] = (32./6.) *gauss->coord3 *(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ); 
+-			dbasis[NUMNODESP2xP4*1+28] = -(32./3.)*((SQRT3/3.)*gauss->coord1- (SQRT3/6.)*gauss->coord3 ) *(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*2+28] = -(32./3.)* gauss->coord1*gauss->coord3* ((2.*zeta -1. )*(zeta+0.5)*(zeta +1.) +  zeta*(zeta -1.)*( 2.*zeta + (3./2.))); 
++			dbasis[NUMNODESP2xP4*0+28] = -2.*gauss->coord3 *(-8./3.)*(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ); 
++			dbasis[NUMNODESP2xP4*1+28] = (4.*SQRT3/3.*gauss->coord1- 2.*SQRT3/3.*gauss->coord3) * (-8./3.)*(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*2+28] = 4.* gauss->coord1*gauss->coord3* (-8./3.)*((2.*zeta -1. )*(zeta+0.5)*(zeta +1.) +zeta*(zeta -1.)*( 2.*zeta + 3./2.)); 
+ 			/*Nodal function 30*/
+-			dbasis[NUMNODESP2xP4*0+29] = -(32./3.)*( gauss->coord1*0.5- gauss->coord2*0.5)*(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ); 
+-			dbasis[NUMNODESP2xP4*1+29] = -(32./3.)*(- (SQRT3/6.)*gauss->coord2- (SQRT3/6.)*gauss->coord1 ) *(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
+-			dbasis[NUMNODESP2xP4*2+29] = -(32./3.)* gauss->coord1*gauss->coord2 *((2.*zeta -1. )*(zeta+0.5)*(zeta +1) +   zeta*(zeta -1.)*( 2.*zeta + (3./2.))); 
++			dbasis[NUMNODESP2xP4*0+29] = 2.*(gauss->coord1-gauss->coord2)* (-8./3.)*(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ); 
++			dbasis[NUMNODESP2xP4*1+29] = -2.*SQRT3/3.*(gauss->coord1+gauss->coord2) * (-8./3.)*(zeta - 1.)*(zeta)*(zeta+0.5)*(zeta +1. ) ; 
++			dbasis[NUMNODESP2xP4*2+29] = 4.* gauss->coord1*gauss->coord2 * (-8./3.)*((2.*zeta -1. )*(zeta+0.5)*(zeta +1) +zeta*(zeta -1.)*( 2.*zeta + 3./2.)); 
+ 			return;
+ 		case P1xP3Enum :
+ 			/*Nodal function 1*/
+Index: ../trunk-jpl/src/c/classes/gauss/GaussPenta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussPenta.cpp	(revision 17503)
++++ ../trunk-jpl/src/c/classes/gauss/GaussPenta.cpp	(revision 17504)
+@@ -696,7 +696,7 @@
+ 				case 27: coord1=0.; coord2=.5; coord3=.5; coord4=+.5;break;
+ 				case 28: coord1=.5; coord2=0.; coord3=.5; coord4=+.5;break;
+ 				case 29: coord1=.5; coord2=.5; coord3=0.; coord4=+.5;break;
+-				default: _error_("node index should be in [0 14]");
++				default: _error_("node index should be in [0 29]");
+ 			}
+ 			break;
+ 		default: _error_("Finite element "<<EnumToStringx(finiteelement)<<" not supported");
Index: issm/oecreview/Archive/16554-17801/ISSM-17504-17505.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17504-17505.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17504-17505.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/test/NightlyRun/test210.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test210.py	(revision 17504)
++++ ../trunk-jpl/test/NightlyRun/test210.py	(revision 17505)
+@@ -7,6 +7,7 @@
+ from parameterize import *
+ from setflowequation import *
+ from solve import *
++from generic import generic
+ 
+ md=triangle(model(),'../Exp/Square.exp',200000)
+ md=setmask(md,'all','')
Index: issm/oecreview/Archive/16554-17801/ISSM-17505-17506.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17505-17506.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17505-17506.diff	(revision 17802)
@@ -0,0 +1,9 @@
+Index: ../trunk-jpl/src/m/classes/SMBpdd.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/SMBpdd.py	(revision 17505)
++++ ../trunk-jpl/src/m/classes/SMBpdd.py	(revision 17506)
+@@ -1,3 +1,4 @@
++import numpy
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+ from checkfield import checkfield
Index: issm/oecreview/Archive/16554-17801/ISSM-17506-17507.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17506-17507.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17506-17507.diff	(revision 17802)
@@ -0,0 +1,287 @@
+Index: ../trunk-jpl/src/c/bamg/ListofIntersectionTriangles.cpp
+===================================================================
+--- ../trunk-jpl/src/c/bamg/ListofIntersectionTriangles.cpp	(revision 17506)
++++ ../trunk-jpl/src/c/bamg/ListofIntersectionTriangles.cpp	(revision 17507)
+@@ -82,7 +82,7 @@
+ 	int  ListofIntersectionTriangles::NewItem(Triangle * tt,double d0,double d1,double d2) { 
+ 		/*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/NewItem)*/
+ 
+-		register int n;
++		int n;
+ 		R2 x(0,0);
+ 		if ( d0) x =      (*tt)[0].r * d0;
+ 		if ( d1) x = x +  (*tt)[1].r * d1;
+@@ -96,7 +96,7 @@
+ 			lIntTria[Size].bary[2]=d2;
+ 			lIntTria[Size].x = x;
+ 			Metric m0,m1,m2;
+-			register BamgVertex * v;
++			BamgVertex * v;
+ 			if ((v=(*tt)(0))) m0    = v->m;
+ 			if ((v=(*tt)(1))) m1    = v->m;
+ 			if ((v=(*tt)(2))) m2    = v->m;
+@@ -110,7 +110,7 @@
+ 	int ListofIntersectionTriangles::NewItem(R2 A,const Metric & mm) {
+ 		/*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/NewItem)*/
+ 
+-		register int n;
++		int n;
+ 		if(!Size ||  Norme2_2(lIntTria[Size-1].x-A)) {
+ 			if (Size==MaxSize) ReShape();
+ 			lIntTria[Size].t=0;
+@@ -182,7 +182,7 @@
+ 	/*FUNCTION ListofIntersectionTriangles::ReShape{{{*/
+ 	void ListofIntersectionTriangles::ReShape(){ 
+ 
+-		register int newsize = MaxSize*2;
++		int newsize = MaxSize*2;
+ 		IntersectionTriangles* nw = new IntersectionTriangles[newsize];
+ 		_assert_(nw);
+ 
+Index: ../trunk-jpl/src/c/bamg/Triangle.cpp
+===================================================================
+--- ../trunk-jpl/src/c/bamg/Triangle.cpp	(revision 17506)
++++ ../trunk-jpl/src/c/bamg/Triangle.cpp	(revision 17507)
+@@ -230,9 +230,9 @@
+ 	void Triangle::SetAdjAdj(short a){
+ 		// Copy all the mark 
+ 		a &= 3;
+-		register Triangle *tt=adj[a];
++		Triangle *tt=adj[a];
+ 		AdjEdgeIndex [a] &= 55; // remove MarkUnSwap
+-		register short aatt = AdjEdgeIndex[a] & 3;
++		short aatt = AdjEdgeIndex[a] & 3;
+ 		if(tt){ 
+ 			tt->adj[aatt]=this;
+ 			tt->AdjEdgeIndex[aatt]=a + (AdjEdgeIndex[a] & 60 ) ;
+@@ -254,7 +254,7 @@
+ 	/*FUNCTION Triangle::SetHidden{{{*/
+ 	void Triangle::SetHidden(int a){
+ 		//Get Adjacent Triangle number a
+-		register Triangle* t = adj[a];
++		Triangle* t = adj[a];
+ 		//if it exist
+ 		//C|=D -> C=(C|D) bitwise inclusive OR
+ 		if(t) t->AdjEdgeIndex[AdjEdgeIndex[a] & 3] |=16;
+@@ -263,13 +263,13 @@
+ 	/*FUNCTION Triangle::SetLocked{{{*/
+ 	void Triangle::SetLocked(int a){
+ 		//mark the edge as on Boundary
+-		register Triangle * t = adj[a];
++		Triangle * t = adj[a];
+ 		t->AdjEdgeIndex[AdjEdgeIndex[a] & 3] |=4;
+ 		AdjEdgeIndex[a] |= 4;
+ 	}/*}}}*/
+ 	/*FUNCTION Triangle::SetMarkUnSwap{{{*/
+ 	void Triangle::SetMarkUnSwap(int a){
+-		register Triangle * t = adj[a];
++		Triangle * t = adj[a];
+ 		t->AdjEdgeIndex[AdjEdgeIndex[a] & 3] |=8;
+ 		AdjEdgeIndex[a] |=8 ;
+ 	}/*}}}*/
+@@ -281,7 +281,7 @@
+ 	}/*}}}*/
+ 	/*FUNCTION Triangle::SetUnMarkUnSwap{{{*/
+ 	void Triangle::SetUnMarkUnSwap(int a){ 
+-		register Triangle * t = adj[a];
++		Triangle * t = adj[a];
+ 		t->AdjEdgeIndex[AdjEdgeIndex[a] & 3] &=55; // 23 + 32 
+ 		AdjEdgeIndex[a] &=55 ;
+ 	}/*}}}*/
+@@ -291,14 +291,14 @@
+ 
+ 		if(a/4 !=0) return 0;// arete lock or MarkUnSwap
+ 
+-		register Triangle *t1=this,*t2=adj[a];// les 2 triangles adjacent
+-		register short a1=a,a2=AdjEdgeIndex[a];// les 2 numero de l arete dans les 2 triangles
++		Triangle *t1=this,*t2=adj[a];// les 2 triangles adjacent
++		short a1=a,a2=AdjEdgeIndex[a];// les 2 numero de l arete dans les 2 triangles
+ 		if(a2/4 !=0) return 0; // arete lock or MarkUnSwap
+ 
+-		register BamgVertex  *sa=t1->vertices[VerticesOfTriangularEdge[a1][0]];
+-		register BamgVertex  *sb=t1->vertices[VerticesOfTriangularEdge[a1][1]];
+-		register BamgVertex  *s1=t1->vertices[OppositeVertex[a1]];
+-		register BamgVertex  *s2=t2->vertices[OppositeVertex[a2]];
++		BamgVertex  *sa=t1->vertices[VerticesOfTriangularEdge[a1][0]];
++		BamgVertex  *sb=t1->vertices[VerticesOfTriangularEdge[a1][1]];
++		BamgVertex  *s1=t1->vertices[OppositeVertex[a1]];
++		BamgVertex  *s2=t2->vertices[OppositeVertex[a2]];
+ 
+ 		Icoor2 det1=t1->det , det2=t2->det ;
+ 		Icoor2 detT = det1+det2;
+@@ -327,7 +327,7 @@
+ 					while (1)
+ 					 if(kopt) {
+ 						 // critere de Delaunay pure isotrope
+-						 register Icoor2 xb1 = sb->i.x - s1->i.x,
++						 Icoor2 xb1 = sb->i.x - s1->i.x,
+ 									 x21 = s2->i.x - s1->i.x,
+ 									 yb1 = sb->i.y - s1->i.y,
+ 									 y21 = s2->i.y - s1->i.y,
+@@ -335,7 +335,7 @@
+ 									 x2a = s2->i.x - sa->i.x,
+ 									 yba = sb->i.y - sa->i.y,
+ 									 y2a = s2->i.y - sa->i.y;
+-						 register double
++						 double
+ 							cosb12 =  double(xb1*x21 + yb1*y21),
+ 									 cosba2 =  double(xba*x2a + yba*y2a) ,
+ 									 sinb12 = double(det2),
+Index: ../trunk-jpl/src/c/bamg/Geometry.cpp
+===================================================================
+--- ../trunk-jpl/src/c/bamg/Geometry.cpp	(revision 17506)
++++ ../trunk-jpl/src/c/bamg/Geometry.cpp	(revision 17507)
+@@ -597,7 +597,7 @@
+ 				long *p=head_v+i;               
+ 				long *po=p;                     
+ 				long  n=*p;                     
+-				register float angleold=-1000 ; // angle = - infinity
++				float angleold=-1000 ; // angle = - infinity
+ 				ord=0; exch=0;
+ 
+ 				// loop over the edges that contain the vertex i (till -1)
+@@ -877,7 +877,7 @@
+ 
+ 		double sg;
+ 		if (eg0 == eg1) { 
+-			register double s0=vg0,s1=vg1;
++			double s0=vg0,s1=vg1;
+ 			sg =  s0*(1.0-s) +  s*s1;
+ 			on=eg0;
+ 		}
+Index: ../trunk-jpl/src/c/bamg/BamgQuadtree.cpp
+===================================================================
+--- ../trunk-jpl/src/c/bamg/BamgQuadtree.cpp	(revision 17506)
++++ ../trunk-jpl/src/c/bamg/BamgQuadtree.cpp	(revision 17507)
+@@ -149,10 +149,10 @@
+ 		BamgQuadtreeBox*  b=NULL;
+ 
+ 		/*Get integer coodinate of current point w*/
+-		register long i=w.i.x, j=w.i.y;
++		long i=w.i.x, j=w.i.y;
+ 
+ 		/*Initialize level*/
+-		register long level=MaxISize;
++		long level=MaxISize;
+ 
+ 		/*Get inital box (the largest)*/
+ 		pb = &root;
+@@ -425,8 +425,8 @@
+ 		BamgQuadtreeBox * pb[ MaxDepth ];
+ 		int  pi[ MaxDepth  ];
+ 		Icoor1 ii[  MaxDepth ], jj [ MaxDepth];
+-		register int l=0; // level
+-		register BamgQuadtreeBox * b;
++		int l=0; // level
++		BamgQuadtreeBox * b;
+ 		Icoor1 hb =  MaxISize;
+ 		Icoor1 i0=0,j0=0;
+ 
+@@ -443,7 +443,7 @@
+ 		do {    
+ 			b= pb[l];
+ 			while (pi[l]--){ 	      
+-				register int k = pi[l];
++				int k = pi[l];
+ 
+ 				if (b->nbitems>0){ // BamgVertex BamgQuadtreeBox none empty
+ 					I2 i2 =  b->v[k]->i;
+@@ -456,11 +456,11 @@
+ 					  }
+ 				}
+ 				else{ // Pointer BamgQuadtreeBox 
+-					register BamgQuadtreeBox *b0=b;
++					BamgQuadtreeBox *b0=b;
+ 					if ((b=b->b[k])){
+ 						hb >>=1 ; // div by 2
+-						register long iii = ii[l]+I_IJ(k,hb);
+-						register long jjj = jj[l]+J_IJ(k,hb);
++						long iii = ii[l]+I_IJ(k,hb);
++						long jjj = jj[l]+J_IJ(k,hb);
+ 
+ 						if  (INTER_SEG(iii,iii+hb,i-hx,i+hx) && INTER_SEG(jjj,jjj+hb,j-hy,j+hy)){
+ 							pb[++l]=  b;
+Index: ../trunk-jpl/src/c/bamg/BamgVertex.cpp
+===================================================================
+--- ../trunk-jpl/src/c/bamg/BamgVertex.cpp	(revision 17506)
++++ ../trunk-jpl/src/c/bamg/BamgVertex.cpp	(revision 17507)
+@@ -124,12 +124,12 @@
+ 	double  BamgVertex::Smoothing(Mesh &Th,const Mesh &BTh,Triangle* &tstart ,double omega){
+ 		/*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/Smoothing)*/
+ 
+-		register BamgVertex* s=this;
++		BamgVertex* s=this;
+ 		BamgVertex &vP = *s,vPsave=vP;
+ 
+-		register Triangle* tbegin= t , *tria = t , *ttc;
++		Triangle* tbegin= t , *tria = t , *ttc;
+ 
+-		register int k=0,kk=0,j = EdgesVertexTriangle[IndexInTriangle][0],jc;
++		int k=0,kk=0,j = EdgesVertexTriangle[IndexInTriangle][0],jc;
+ 		R2 P(s->r),PNew(0,0);
+ 		do {
+ 			k++; 
+Index: ../trunk-jpl/src/c/bamg/Mesh.cpp
+===================================================================
+--- ../trunk-jpl/src/c/bamg/Mesh.cpp	(revision 17506)
++++ ../trunk-jpl/src/c/bamg/Mesh.cpp	(revision 17507)
+@@ -2932,8 +2932,8 @@
+ 		long k3 = temp%nbvnew;
+ 		//loop over the new points
+ 		for (int is3=0; is3<nbvnew; is3++){
+-			register long j=nbvold +(k3 = (k3+PrimeNumber)%nbvnew);
+-			register long i=nbvold+is3; 
++			long j=nbvold +(k3 = (k3+PrimeNumber)%nbvnew);
++			long i=nbvold+is3; 
+ 			orderedvertices[i]= vertices + j;
+ 			orderedvertices[i]->ReferenceNumber=i;
+ 		}
+@@ -3721,8 +3721,8 @@
+ 		/*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/ReNumberingTheTriangleBySubDomain)*/
+ 
+ 		long *renu= new long[nbt];
+-		register Triangle *t0,*t,*te=triangles+nbt;
+-		register long k=0,it,i,j;
++		Triangle *t0,*t,*te=triangles+nbt;
++		long k=0,it,i,j;
+ 
+ 		for ( it=0;it<nbt;it++) 
+ 		 renu[it]=-1; // outside triangle 
+@@ -3913,7 +3913,7 @@
+ 		kch=0;
+ 		for(i=Head0;i>=0;i=first_np_or_next_t0[ip=i],first_np_or_next_t0[ip]=-1) {
+ 			//  pour tous les triangles autour du sommet s
+-			register Triangle* t= vertices[i].t;
++			Triangle* t= vertices[i].t;
+ 			if (!t){
+ 				_error_("!t");
+ 			}
+@@ -4153,8 +4153,8 @@
+ long  Mesh::TriangleReferenceList(long* reft) const {
+ 	/*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/ConsRefTriangle)*/
+ 
+-	register Triangle *t0,*t;
+-	register long k=0, num;   
++	Triangle *t0,*t;
++	long k=0, num;   
+ 
+ 	//initialize all triangles as -1 (outside)
+ 	for (int it=0;it<nbt;it++) reft[it]=-1;
+@@ -4706,7 +4706,7 @@
+ 					double sNew=Lstep;// abscisse of the new points (phase==1) 
+ 					L=0;// length of the curve
+ 					long i=0;// index of new points on the curve
+-					register GeomVertex * GA0 = *(*peequi)[k0equi].GeomEdgeHook;
++					GeomVertex * GA0 = *(*peequi)[k0equi].GeomEdgeHook;
+ 					BamgVertex *A0;
+ 					A0 = GA0->MeshVertexHook;  // the vertex in new mesh
+ 					BamgVertex *A1;
+@@ -4780,7 +4780,7 @@
+ 							_assert_(ee.GeomEdgeHook->CurveNumber==ei.GeomEdgeHook->CurveNumber);
+ 							if (ee[k1].GeomEdgeHook->IsRequiredVertex()) {
+ 								_assert_(eeequi[k1equi].GeomEdgeHook->IsRequiredVertex());
+-								register GeomVertex * GA1 = *eeequi[k1equi].GeomEdgeHook;
++								GeomVertex * GA1 = *eeequi[k1equi].GeomEdgeHook;
+ 								A1=GA1->MeshVertexHook;// the vertex in new mesh
+ 								_assert_(A1-vertices>=0 && A1-vertices<nbv);
+ 								break;
Index: issm/oecreview/Archive/16554-17801/ISSM-17507-17508.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17507-17508.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17507-17508.diff	(revision 17802)
@@ -0,0 +1,35 @@
+Index: ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17507)
++++ ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17508)
+@@ -180,15 +180,22 @@
+ 				for(i=0;i<iomodel->numberoffaces;i++){
+ 					if(iomodel->faces[i*6+5]==2){/*Vertical quads*/
+ 						if(my_faces[i]){
+-							v1 = iomodel->faces[6*i+0]-1;
+-							v2 = iomodel->faces[6*i+1]-1;
+-							if(!xIsNan<IssmDouble>(spcdata[v1]) && !xIsNan<IssmDouble>(spcdata[v2])){
++							FaceGetVertexIndices(iomodel,&numfacevertices,&faceverticesid,i);
++							isnan=0;
++							for(j=0;j<numfacevertices;j++){
++								if(xIsNan<IssmDouble>(spcdata[faceverticesid[j]])) isnan=1;
++							}
++							if(isnan==0){
++								value=0;
++								for(j=0;j<numfacevertices;j++){
++									value=value+spcdata[faceverticesid[j]]/numfacevertices;
++								}
+ 								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*i+1,
+-												dof,1./2.*spcdata[v1]+1./2.*spcdata[v2],analysis_type));
+-								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+2,iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*i+2,
+-												dof,1./2.*spcdata[v1]+1./2.*spcdata[v2],analysis_type));
+-								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+3,iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*i+3,
+-												dof,1./2.*spcdata[v1]+1./2.*spcdata[v2],analysis_type));
++												dof,value,analysis_type));
++								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*i+2,
++												dof,value,analysis_type));
++								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*i+3,
++												dof,value,analysis_type));
+ 								count=count+3;
+ 							}
+ 						}
Index: issm/oecreview/Archive/16554-17801/ISSM-17508-17509.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17508-17509.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17508-17509.diff	(revision 17802)
@@ -0,0 +1,92 @@
+Index: ../trunk-jpl/src/c/toolkits/objects/Vector.h
+===================================================================
+--- ../trunk-jpl/src/c/toolkits/objects/Vector.h	(revision 17508)
++++ ../trunk-jpl/src/c/toolkits/objects/Vector.h	(revision 17509)
+@@ -304,6 +304,20 @@
+ 			else this->ivector->Copy(to->ivector);
+ 		}
+ 		/*}}}*/
++		/*FUNCTION Max{{{*/
++		doubletype Max(void){_assert_(this);
++
++			doubletype max=0;
++
++			if(type==PetscVecType){
++				#ifdef _HAVE_PETSC_
++				max=this->pvector->Max();
++				#endif
++			}
++			else _error_("operation not supported yet");
++			return max;
++		}
++		/*}}}*/
+ 		/*FUNCTION Norm{{{*/
+ 		doubletype Norm(NormMode norm_type){_assert_(this);
+ 
+Index: ../trunk-jpl/src/c/toolkits/petsc/objects/PetscVec.h
+===================================================================
+--- ../trunk-jpl/src/c/toolkits/petsc/objects/PetscVec.h	(revision 17508)
++++ ../trunk-jpl/src/c/toolkits/petsc/objects/PetscVec.h	(revision 17509)
+@@ -37,23 +37,24 @@
+ 		~PetscVec();
+ 
+ 		/*PetscVec specific routines*/
+-		void Echo(void);
+-		void Assemble(void);
+-		void SetValues(int ssize, int* list, IssmDouble* values, InsMode mode);
+-		void SetValue(int dof, IssmDouble value, InsMode  mode);
+-		void GetValue(IssmDouble* pvalue, int dof);
+-		void GetSize(int* pM);
+-		void GetLocalSize(int* pM);
+-		PetscVec* Duplicate(void);
+-		void Set(IssmDouble value);
+-		void AXPY(PetscVec* X, IssmDouble a);
+-		void AYPX(PetscVec* X, IssmDouble a);
++		void        Echo(void);
++		void        Assemble(void);
++		void        SetValues(int ssize, int* list, IssmDouble* values, InsMode mode);
++		void        SetValue(int dof, IssmDouble value, InsMode  mode);
++		void        GetValue(IssmDouble* pvalue, int dof);
++		void        GetSize(int* pM);
++		void        GetLocalSize(int* pM);
++		PetscVec*   Duplicate(void);
++		void        Set(IssmDouble value);
++		void        AXPY(PetscVec* X, IssmDouble a);
++		void        AYPX(PetscVec* X, IssmDouble a);
+ 		IssmDouble* ToMPISerial(void);
+-		void Copy(PetscVec* to);
+-		IssmDouble Norm(NormMode norm_type);
+-		void Scale(IssmDouble scale_factor);
+-		void PointwiseDivide(PetscVec* x,PetscVec* y);
+-		IssmDouble Dot(PetscVec* vector);
++		void        Copy(PetscVec* to);
++		IssmDouble  Norm(NormMode norm_type);
++		IssmDouble  Max(void);
++		void        Scale(IssmDouble scale_factor);
++		void        PointwiseDivide(PetscVec* x,PetscVec* y);
++		IssmDouble  Dot(PetscVec* vector);
+ };
+ 
+ #endif //#ifndef _PETSCVEC_H_
+Index: ../trunk-jpl/src/c/toolkits/petsc/objects/PetscVec.cpp
+===================================================================
+--- ../trunk-jpl/src/c/toolkits/petsc/objects/PetscVec.cpp	(revision 17508)
++++ ../trunk-jpl/src/c/toolkits/petsc/objects/PetscVec.cpp	(revision 17509)
+@@ -187,6 +187,17 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION PetscVec::Max{{{*/
++IssmDouble PetscVec::Max(void){
++
++	_assert_(this->vector);
++
++	IssmDouble max;
++	VecMax(this->vector,NULL,&max);
++	return max;
++
++}
++/*}}}*/
+ /*FUNCTION PetscVec::Norm{{{*/
+ IssmDouble PetscVec::Norm(NormMode mode){
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17509-17510.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17509-17510.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17509-17510.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/src/m/extrusion/project2d.m
+===================================================================
+--- ../trunk-jpl/src/m/extrusion/project2d.m	(revision 17509)
++++ ../trunk-jpl/src/m/extrusion/project2d.m	(revision 17510)
+@@ -19,7 +19,7 @@
+ 	error('project2d error message');
+ end
+ 
+-if (md3d.mesh.dimension~=3),
++if ~strcmp(md3d.mesh.meshtype,'3D');
+ 	error('wrong model type ... should be ''3d''');
+ end
+ 
+Index: ../trunk-jpl/src/m/extrusion/DepthAverage.m
+===================================================================
+--- ../trunk-jpl/src/m/extrusion/DepthAverage.m	(revision 17509)
++++ ../trunk-jpl/src/m/extrusion/DepthAverage.m	(revision 17510)
+@@ -8,7 +8,7 @@
+ %      vel_bar=DepthAverage(md,md.initialization.vel);
+ 
+ %check that the model given in input is 3d
+-if ~md.mesh.dimension==3;
++if ~strcmp(md.mesh.meshtype,'3D');
+ 	error('DepthAverage error message: the model given in input must be 3d')
+ end
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17510-17511.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17510-17511.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17510-17511.diff	(revision 17802)
@@ -0,0 +1,213 @@
+Index: ../trunk-jpl/src/c/analyses/DepthAverageAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DepthAverageAnalysis.cpp	(revision 17510)
++++ ../trunk-jpl/src/c/analyses/DepthAverageAnalysis.cpp	(revision 17511)
+@@ -49,7 +49,7 @@
+ ElementMatrix* DepthAverageAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries */
+-	IssmDouble  Jdet,D;
++	IssmDouble  Jdet,D,dt=1.e+9;
+ 	IssmDouble *xyz_list = NULL;
+ 
+ 	/*Get dimension*/
+@@ -58,6 +58,7 @@
+ 	switch(meshtype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
++		case Mesh3DtetrasEnum:    dim = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+@@ -67,7 +68,6 @@
+ 	/*Initialize Element vector and other vectors*/
+ 	ElementMatrix* Ke     = element->NewElementMatrix();
+ 	IssmDouble*    B      = xNew<IssmDouble>(numnodes);
+-	IssmDouble*    Bprime = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+@@ -78,25 +78,69 @@
+ 		gauss->GaussPoint(ig);
+ 
+ 		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+-		element->NodalFunctions(Bprime,gauss);
+ 		GetB(B,element,dim,xyz_list,gauss);
+-		D=gauss->weight*Jdet;
++		D=gauss->weight*Jdet*dt;
+ 
++		/*vertical diffusion*/
+ 		TripleMultiply(B,1,numnodes,1,
+ 					&D,1,1,0,
+-					Bprime,1,numnodes,0,
++					B,1,numnodes,0,
+ 					&Ke->values[0],1);
++
++		/*Next value*/
++		D=gauss->weight*Jdet;
++		element->NodalFunctions(B,gauss);
++		TripleMultiply(B,numnodes,1,0,
++					&D,1,1,0,
++					B,1,numnodes,0,
++					&Ke->values[0],1);
+ 	} 
+ 
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(B);
+-	xDelete<IssmDouble>(Bprime);
+ 	delete gauss;
+ 	return Ke;
+ }/*}}}*/
+ ElementVector* DepthAverageAnalysis::CreatePVector(Element* element){/*{{{*/
+-	return NULL;
++
++	/*Intermediaries*/
++	int         input_enum;
++	IssmDouble  Jdet,scalar,value;
++	IssmDouble* xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector*/
++	ElementVector* pe     = element->NewElementVector();
++	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	element->FindParam(&input_enum,InputToDepthaverageEnum);
++	Input* input = element->GetInput(input_enum); _assert_(input);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(3);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctions(basis,gauss);
++
++		/* Build transient now */
++		input->GetInputValue(&value, gauss);
++		scalar=value*Jdet*gauss->weight;
++		for(int i=0;i<numnodes;i++) pe->values[i]+=scalar*basis[i];
++
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(xyz_list);
++	delete gauss;
++	return pe;
+ }/*}}}*/
+ void DepthAverageAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*	Compute B  matrix. B=[dh1/dz dh2/dz dh3/dz dh4/dz dh5/dz dh6/dz];
+Index: ../trunk-jpl/src/c/cores/surfaceslope_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/surfaceslope_core.cpp	(revision 17510)
++++ ../trunk-jpl/src/c/cores/surfaceslope_core.cpp	(revision 17511)
+@@ -32,7 +32,7 @@
+ 		solutionsequence_linear(femmodel);
+ 	}
+ 	if(meshtype==Mesh2DverticalEnum){
+-	      femmodel->parameters->SetParam(SurfaceSlopeXEnum,InputToExtrudeEnum);
++		femmodel->parameters->SetParam(SurfaceSlopeXEnum,InputToExtrudeEnum);
+ 		extrudefrombase_core(femmodel);
+ 	}
+ 
+Index: ../trunk-jpl/src/c/cores/depthaverage_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/depthaverage_core.cpp	(revision 17510)
++++ ../trunk-jpl/src/c/cores/depthaverage_core.cpp	(revision 17511)
+@@ -11,7 +11,7 @@
+ 
+ void depthaverage_core(FemModel* femmodel){
+ 
+-	if(VerboseSolution()) _printf0_("extruding solution from base...\n");
++	if(VerboseSolution()) _printf0_("depth averaging...\n");
+ 
+ 	/*Call on core computations: */
+ 	femmodel->SetCurrentConfiguration(DepthAverageAnalysisEnum);
+Index: ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp	(revision 17510)
++++ ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp	(revision 17511)
+@@ -25,13 +25,14 @@
+ 	switch(solutiontype){
+ 
+ 		case StressbalanceSolutionEnum:
+-			numanalyses=5;
++			numanalyses=6;
+ 			analyses=xNew<int>(numanalyses);
+ 			analyses[0]=StressbalanceAnalysisEnum;
+ 			analyses[1]=StressbalanceVerticalAnalysisEnum;
+ 			analyses[2]=StressbalanceSIAAnalysisEnum;
+ 			analyses[3]=L2ProjectionBaseAnalysisEnum;
+ 			analyses[4]=ExtrudeFromBaseAnalysisEnum;
++			analyses[5]=DepthAverageAnalysisEnum;
+ 			break;
+ 
+ 		case SteadystateSolutionEnum:
+Index: ../trunk-jpl/src/c/cores/cores.h
+===================================================================
+--- ../trunk-jpl/src/c/cores/cores.h	(revision 17510)
++++ ../trunk-jpl/src/c/cores/cores.h	(revision 17511)
+@@ -29,6 +29,7 @@
+ void control_core(FemModel* femmodel);
+ void controltao_core(FemModel* femmodel);
+ void masstransport_core(FemModel* femmodel);
++void depthaverage_core(FemModel* femmodel);
+ void extrudefrombase_core(FemModel* femmodel);
+ void extrudefromtop_core(FemModel* femmodel);
+ void balancethickness_core(FemModel* femmodel);
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17510)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17511)
+@@ -444,6 +444,33 @@
+ 	}
+ }
+ /*}}}*/
++/*FUNCTION Tetra::InputUpdateFromSolutionOneDof{{{*/
++void  Tetra::InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type){
++
++	/*Intermediary*/
++	int* doflist = NULL;
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = this->NumberofNodes();
++
++	/*Fetch dof list and allocate solution vector*/
++	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
++	IssmDouble* values    = xNew<IssmDouble>(numnodes);
++
++	/*Use the dof list to index into the solution vector: */
++	for(int i=0;i<numnodes;i++){
++		values[i]=solution[doflist[i]];
++		if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector");
++	}
++
++	/*Add input to the element: */
++	this->inputs->AddInput(new TetraInput(enum_type,values,P1Enum));
++
++	/*Free ressources:*/
++	xDelete<IssmDouble>(values);
++	xDelete<int>(doflist);
++}
++/*}}}*/
+ /*FUNCTION Tetra::IsIceInElement    THIS ONE{{{*/
+ bool   Tetra::IsIceInElement(){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17510)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17511)
+@@ -46,7 +46,7 @@
+ 		/*}}}*/
+ 		/*Update virtual functions resolution: {{{*/
+ 		void  InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solution,int inputenum){_error_("not implemented yet");};
+-		void  InputUpdateFromSolutionOneDof(IssmDouble* solution,int inputenum){_error_("not implemented yet");};
++		void  InputUpdateFromSolutionOneDof(IssmDouble* solution,int inputenum);
+ 		void  InputUpdateFromVector(IssmDouble* vector, int name, int type){_error_("not implemented yet");};
+ #ifdef _HAVE_DAKOTA_
+ 		void  InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-17511-17512.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17511-17512.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17511-17512.diff	(revision 17802)
@@ -0,0 +1,16 @@
+Index: ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17511)
++++ ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17512)
+@@ -192,9 +192,9 @@
+ 								}
+ 								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*i+1,
+ 												dof,value,analysis_type));
+-								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*i+2,
++								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+2,iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*i+2,
+ 												dof,value,analysis_type));
+-								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*i+3,
++								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+3,iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*i+3,
+ 												dof,value,analysis_type));
+ 								count=count+3;
+ 							}
Index: issm/oecreview/Archive/16554-17801/ISSM-17512-17513.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17512-17513.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17512-17513.diff	(revision 17802)
@@ -0,0 +1,650 @@
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 17512)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 17513)
+@@ -35,7 +35,7 @@
+ }/*}}}*/
+ void L2ProjectionBaseAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+-	if(iomodel->meshtype==Mesh3DEnum){
++	if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh3DtetrasEnum){
+ 		iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
+ 	}
+ 	else if(iomodel->meshtype==Mesh2DverticalEnum){
+@@ -84,6 +84,10 @@
+ 			if(!element->IsOnBed()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
++		case Mesh3DtetrasEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+@@ -143,6 +147,10 @@
+ 			if(!element->IsOnBed()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
++		case Mesh3DtetrasEnum:
++			if(!element->IsOnBed()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+@@ -212,6 +220,7 @@
+ 			element->InputUpdateFromSolutionOneDof(solution,inputenum);
+ 			break;
+ 		case Mesh2DverticalEnum:
++		case Mesh3DtetrasEnum:
+ 			element->InputUpdateFromSolutionOneDof(solution,inputenum);
+ 			break;
+ 		case Mesh3DEnum:
+Index: ../trunk-jpl/src/c/shared/Exceptions/exceptions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Exceptions/exceptions.h	(revision 17512)
++++ ../trunk-jpl/src/c/shared/Exceptions/exceptions.h	(revision 17513)
+@@ -62,7 +62,7 @@
+ 		exception.Report();\
+ 		return 0;\
+ 	}\
+-	catch (exception& e) {\
++	catch(exception& e) {\
+ 		_printf_("Standard exception: " << e.what() << "\n\n");\
+ 		return 0;\
+ 	}\
+Index: ../trunk-jpl/src/c/classes/Elements/ElementHook.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/ElementHook.cpp	(revision 17512)
++++ ../trunk-jpl/src/c/classes/Elements/ElementHook.cpp	(revision 17513)
+@@ -127,6 +127,35 @@
+ 	triahook->hmatpar=(Hook*)this->hmatpar->copy();
+ }
+ /*}}}*/
++/*FUNCTION ElementHook::SpawnTriaHook{{{*/
++void ElementHook::SpawnTriaHook(ElementHook* triahook,int index1,int index2,int index3){
++
++	/*Create arrow of indices depending on location (0=base 1=surface)*/
++	int indices[3];
++	indices[0] = index1;
++	indices[1] = index2;
++	indices[2] = index3;
++
++	triahook->numanalyses=this->numanalyses;
++
++	/*Spawn nodes hook*/
++	triahook->hnodes=new Hook*[this->numanalyses];
++	for(int i=0;i<this->numanalyses;i++){
++		/*Do not do anything if Hook is empty*/
++		if (!this->hnodes[i] || this->hnodes[i]->GetNum()==0){
++			triahook->hnodes[i]=NULL;
++		}
++		else{
++			triahook->hnodes[i]=this->hnodes[i]->Spawn(indices,3);
++		}
++	}
++
++	/*do not spawn hmaterial. material will be taken care of by Penta*/
++	triahook->hmaterial=NULL;
++	triahook->hvertices=(Hook*)this->hvertices->Spawn(indices,3);
++	triahook->hmatpar=(Hook*)this->hmatpar->copy();
++}
++/*}}}*/
+ /*FUNCTION ElementHook::SpawnSegHook{{{*/
+ void ElementHook::SpawnSegHook(ElementHook* triahook,int index1,int index2){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/ElementHook.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/ElementHook.h	(revision 17512)
++++ ../trunk-jpl/src/c/classes/Elements/ElementHook.h	(revision 17513)
+@@ -24,7 +24,8 @@
+ 		~ElementHook();
+ 
+ 		void SetHookNodes(int* node_ids,int numnodes,int analysis_counter);
+-		void SpawnTriaHook(ElementHook* triahook,int location); //3d only
++		void SpawnTriaHook(ElementHook* triahook,int location); //3d only TO BE REMOVED (replaced by the one below)
++		void SpawnTriaHook(ElementHook* triahook,int index1,int index2,int index3); //3d only
+ 		void SpawnSegHook(ElementHook* triahook,int ndex1,int index2); //2d only
+ 		void InitHookNeighbors(int* element_ids);               //3d only
+ };
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17512)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17513)
+@@ -762,6 +762,52 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Tetra::SpawnBasalElement{{{*/
++Element*  Tetra::SpawnBasalElement(void){
++
++	_assert_(HasFaceOnBed());
++
++	int index1,index2,index3;
++	this->FaceOnBedIndices(&index1,&index2,&index3);
++	return SpawnTria(index1,index2,index3);
++}/*}}}*/
++/*FUNCTION Tetra::SpawnTopElement{{{*/
++Element*  Tetra::SpawnTopElement(void){
++
++	_assert_(HasFaceOnSurface());
++
++	int index1,index2,index3;
++	this->FaceOnSurfaceIndices(&index1,&index2,&index3);
++	return SpawnTria(index1,index2,index3);
++}/*}}}*/
++/*FUNCTION Tetra::SpawnTria{{{*/
++Tria*  Tetra::SpawnTria(int index1,int index2,int index3){
++
++	int analysis_counter;
++
++	/*go into parameters and get the analysis_counter: */
++	this->parameters->FindParam(&analysis_counter,AnalysisCounterEnum);
++
++	/*Create Tria*/
++	Tria* tria=new Tria();
++	tria->id=this->id;
++	tria->inputs=(Inputs*)this->inputs->SpawnTriaInputs(index1,index2,index3);
++	tria->parameters=this->parameters;
++	tria->element_type=P1Enum; //Only P1 CG for now (TO BE CHANGED)
++	this->SpawnTriaHook(dynamic_cast<ElementHook*>(tria),index1,index2,index3);
++
++	/*Spawn material*/
++	tria->material=(Material*)this->material->copy2(tria);
++
++	/*recover nodes, material and matpar: */
++	tria->nodes    = (Node**)tria->hnodes[analysis_counter]->deliverp();
++	tria->vertices = (Vertex**)tria->hvertices->deliverp();
++	tria->matpar   = (Matpar*)tria->hmatpar->delivers();
++
++	/*Return new Tria*/
++	return tria;
++}
++/*}}}*/
+ /*FUNCTION Tetra::Update {{{*/
+ void Tetra::Update(int index,IoModel* iomodel,int analysis_counter,int analysis_type,int finiteelement_type){ 
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17512)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17513)
+@@ -111,8 +111,9 @@
+ 		void        NormalBase(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		int         NumberofNodesVelocity(void);
+ 		int         NumberofNodesPressure(void);
+-	   Element*    SpawnBasalElement(void){_error_("not implemented yet");};
+-		Element*    SpawnTopElement(void){_error_("not implemented yet");};
++	   Element*    SpawnBasalElement(void);
++		Element*    SpawnTopElement(void);
++		Tria*       SpawnTria(int index1,int index2,int index3);
+ 		IssmDouble  StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa){_error_("not implemented yet");};
+ 		IssmDouble  PureIceEnthalpy(IssmDouble pressure){_error_("not implemented yet");};
+ 		int         PressureInterpolation(void){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/TetraInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TetraInput.cpp	(revision 17512)
++++ ../trunk-jpl/src/c/classes/Inputs/TetraInput.cpp	(revision 17513)
+@@ -184,7 +184,38 @@
+ 	*pnumtimes=numtimes;
+ }
+ /*}}}*/
++/*FUNCTION TetraInput::SpawnTriaInput{{{*/
++Input* TetraInput::SpawnTriaInput(int index1,int index2,int index3){
+ 
++	/*output*/
++	TriaInput* outinput=NULL;
++
++	if(this->element_type==P0Enum){ 
++		outinput=new TriaInput(this->enum_type,&this->values[0],P0Enum);
++	}
++	else{
++		/*Assume P1 interpolation only for now*/
++		IssmDouble newvalues[3]; 
++
++		/*Create array of indices depending on location (0=base 1=surface)*/
++		int indices[3];
++		indices[0] = index1;
++		indices[1] = index2;
++		indices[2] = index3;
++
++		/*Create new input*/
++		for(int i=0;i<3;i++){
++			_assert_(indices[i]>=0 && indices[i]<4);
++			newvalues[i]=this->values[indices[i]];
++		}
++		outinput=new TriaInput(this->enum_type,&newvalues[0],P1Enum);
++	}
++
++	/*Assign output*/
++	return outinput;
++}
++/*}}}*/
++
+ /*Intermediary*/
+ /*FUNCTION TetraInput::SquareMin{{{*/
+ void TetraInput::SquareMin(IssmDouble* psquaremin,Parameters* parameters){
+Index: ../trunk-jpl/src/c/classes/Inputs/DoubleInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/DoubleInput.h	(revision 17512)
++++ ../trunk-jpl/src/c/classes/Inputs/DoubleInput.h	(revision 17513)
+@@ -33,6 +33,7 @@
+ 		/*DoubleInput management: {{{*/
+ 		int   InstanceEnum();
+ 		Input* SpawnTriaInput(int location);
++		Input* SpawnTriaInput(int index1,int index2,int index3);
+ 		Input* SpawnSegInput(int index1,int index2);
+ 		Input* PointwiseDivide(Input* inputB);
+ 		Input* PointwiseMin(Input* inputB);
+Index: ../trunk-jpl/src/c/classes/Inputs/ControlInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/ControlInput.cpp	(revision 17512)
++++ ../trunk-jpl/src/c/classes/Inputs/ControlInput.cpp	(revision 17513)
+@@ -195,6 +195,10 @@
+ Input* ControlInput::SpawnTriaInput(int location){
+ 	return values->SpawnTriaInput(location);
+ }/*}}}*/
++/*FUNCTION ControlInput::SpawnTriaInput{{{*/
++Input* ControlInput::SpawnTriaInput(int index1,int index2,int index3){
++	return values->SpawnTriaInput(index1,index2,index3);
++}/*}}}*/
+ /*FUNCTION ControlInput::SpawnSegInput{{{*/
+ Input* ControlInput::SpawnSegInput(int index1,int index2){
+ 	return values->SpawnSegInput(index1,index2);
+Index: ../trunk-jpl/src/c/classes/Inputs/SegInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/SegInput.h	(revision 17512)
++++ ../trunk-jpl/src/c/classes/Inputs/SegInput.h	(revision 17513)
+@@ -34,6 +34,7 @@
+ 		/*SegInput management:*/
+ 		int    InstanceEnum();
+ 		Input* SpawnTriaInput(int location){_error_("not supported yet");};
++		Input* SpawnTriaInput(int index1,int index2,int index3){_error_("not supported yet");};
+ 		Input* SpawnSegInput(int index1,int index2){_error_("not implemented yet");};
+ 		Input* PointwiseDivide(Input* inputB){_error_("not supported yet");};
+ 		Input* PointwiseMin(Input* inputB){_error_("not supported yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/TetraInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TetraInput.h	(revision 17512)
++++ ../trunk-jpl/src/c/classes/Inputs/TetraInput.h	(revision 17513)
+@@ -34,6 +34,7 @@
+ 		/*TetraInput management:*/
+ 		int    InstanceEnum();
+ 		Input* SpawnTriaInput(int location){_error_("not supported yet");};
++		Input* SpawnTriaInput(int index1,int index2,int index3);
+ 		Input* SpawnSegInput(int index1,int index2){_error_("not supported yet");};
+ 		Input* PointwiseDivide(Input* inputB);
+ 		Input* PointwiseMin(Input* inputB);
+Index: ../trunk-jpl/src/c/classes/Inputs/Input.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/Input.h	(revision 17512)
++++ ../trunk-jpl/src/c/classes/Inputs/Input.h	(revision 17513)
+@@ -54,6 +54,7 @@
+ 		virtual void   GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist)=0;
+ 
+ 		virtual Input* SpawnTriaInput(int location)=0;
++		virtual Input* SpawnTriaInput(int index1,int index2,int index3)=0;
+ 		virtual Input* SpawnSegInput(int index1,int index2)=0;
+ 		virtual Input* PointwiseDivide(Input* inputB)=0;
+ 		virtual Input* PointwiseMax(Input* inputmax)=0;
+Index: ../trunk-jpl/src/c/classes/Inputs/ControlInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/ControlInput.h	(revision 17512)
++++ ../trunk-jpl/src/c/classes/Inputs/ControlInput.h	(revision 17513)
+@@ -38,6 +38,7 @@
+ 		/*ControlInput management: {{{*/
+ 		int    InstanceEnum();
+ 		Input* SpawnTriaInput(int location);
++		Input* SpawnTriaInput(int index1,int index2,int index3);
+ 		Input* SpawnSegInput(int index1,int index2);
+ 		Input* PointwiseDivide(Input* inputB){_error_("not implemented yet");};
+ 		Input* PointwiseMin(Input* inputB){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/DatasetInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/DatasetInput.cpp	(revision 17512)
++++ ../trunk-jpl/src/c/classes/Inputs/DatasetInput.cpp	(revision 17513)
+@@ -95,6 +95,24 @@
+ 	return outinput;
+ }
+ /*}}}*/
++/*FUNCTION DatasetInput::SpawnTriaInput{{{*/
++Input* DatasetInput::SpawnTriaInput(int index1,int index2,int index3){
++
++	/*output*/
++	DatasetInput* outinput=NULL;
++
++	/*Create new Datasetinput (copy of current input)*/
++	outinput=new DatasetInput();
++	outinput->enum_type=this->enum_type;
++	outinput->inputs=dynamic_cast<Inputs*>(this->inputs->SpawnTriaInputs(index1,index2,index3));
++	outinput->numids=this->numids;
++	outinput->ids=xNew<int>(this->numids);
++	xMemCpy(outinput->ids,this->ids,this->numids);
++
++	/*Assign output*/
++	return outinput;
++}
++/*}}}*/
+ /*FUNCTION DatasetInput::SpawnSegInput{{{*/
+ Input* DatasetInput::SpawnSegInput(int index1,int index2){
+ 
+Index: ../trunk-jpl/src/c/classes/Inputs/DatasetInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/DatasetInput.h	(revision 17512)
++++ ../trunk-jpl/src/c/classes/Inputs/DatasetInput.h	(revision 17513)
+@@ -36,6 +36,7 @@
+ 		void   AddInput(Input* input,int id);
+ 		int    InstanceEnum();
+ 		Input* SpawnTriaInput(int location);
++		Input* SpawnTriaInput(int index1,int index2,int index3);
+ 		Input* SpawnSegInput(int index1,int index2);
+ 		Input* PointwiseDivide(Input* inputB){_error_("not implemented yet");};
+ 		Input* PointwiseMin(Input* inputB){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/IntInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/IntInput.cpp	(revision 17512)
++++ ../trunk-jpl/src/c/classes/Inputs/IntInput.cpp	(revision 17513)
+@@ -82,6 +82,20 @@
+ 	return outinput;
+ }
+ /*}}}*/
++/*FUNCTION IntInput::SpawnTriaInput{{{*/
++Input* IntInput::SpawnTriaInput(int index1,int index2,int index3){
++
++	/*output*/
++	IntInput* outinput=new IntInput();
++
++	/*only copy current value*/
++	outinput->enum_type=this->enum_type;
++	outinput->value=this->value;
++
++	/*Assign output*/
++	return outinput;
++}
++/*}}}*/
+ /*FUNCTION IntInput::SpawnSegInput{{{*/
+ Input* IntInput::SpawnSegInput(int index1,int index2){
+ 
+Index: ../trunk-jpl/src/c/classes/Inputs/BoolInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/BoolInput.cpp	(revision 17512)
++++ ../trunk-jpl/src/c/classes/Inputs/BoolInput.cpp	(revision 17513)
+@@ -83,6 +83,21 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION BoolInput::SpawnTriaInput{{{*/
++Input* BoolInput::SpawnTriaInput(int index1,int index2,int index3){
++
++		/*output*/
++		BoolInput* outinput=new BoolInput();
++
++		/*only copy current value*/
++		outinput->enum_type=this->enum_type;
++		outinput->value=this->value;
++
++		/*Assign output*/
++		return outinput;
++
++}
++/*}}}*/
+ /*FUNCTION BoolInput::SpawnSegInput{{{*/
+ Input* BoolInput::SpawnSegInput(int index1,int index2){
+ 
+Index: ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 17512)
++++ ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 17513)
+@@ -94,6 +94,20 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION TriaInput::SpawnTriaInput{{{*/
++Input* TriaInput::SpawnTriaInput(int index1,int index2,int index3){
++
++	/*output*/
++	TriaInput* outinput=NULL;
++
++	/*Create new Tria input (copy of current input)*/
++	outinput=new TriaInput(this->enum_type,&this->values[0],this->element_type);
++
++	/*Assign output*/
++	return outinput;
++
++}
++/*}}}*/
+ /*FUNCTION TriaInput::SpawnSegInput{{{*/
+ Input* TriaInput::SpawnSegInput(int index1,int index2){
+ 
+Index: ../trunk-jpl/src/c/classes/Inputs/IntInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/IntInput.h	(revision 17512)
++++ ../trunk-jpl/src/c/classes/Inputs/IntInput.h	(revision 17513)
+@@ -34,6 +34,7 @@
+ 		/*IntInput management: {{{*/
+ 		int   InstanceEnum();
+ 		Input* SpawnTriaInput(int location);
++		Input* SpawnTriaInput(int index1,int index2,int index3);
+ 		Input* SpawnSegInput(int index1,int index2);
+ 		Input* PointwiseDivide(Input* inputB){_error_("not implemented yet");};
+ 		Input* PointwiseMin(Input* inputB){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/BoolInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/BoolInput.h	(revision 17512)
++++ ../trunk-jpl/src/c/classes/Inputs/BoolInput.h	(revision 17513)
+@@ -30,6 +30,7 @@
+ 		/*BoolInput management: {{{*/
+ 		int   InstanceEnum();
+ 		Input* SpawnTriaInput(int location);
++		Input* SpawnTriaInput(int index1,int index2,int index3);
+ 		Input* SpawnSegInput(int index1,int index2);
+ 		Input* PointwiseDivide(Input* inputB){_error_("not implemented yet");};
+ 		Input* PointwiseMin(Input* inputB){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/Inputs.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/Inputs.cpp	(revision 17512)
++++ ../trunk-jpl/src/c/classes/Inputs/Inputs.cpp	(revision 17513)
+@@ -394,6 +394,32 @@
+ 	return newinputs;
+ }
+ /*}}}*/
++/*FUNCTION Inputs::SpawnTriaInputs{{{*/
++Inputs* Inputs::SpawnTriaInputs(int index1,int index2,int index3){
++
++	/*Intermediary*/
++	vector<Object*>::iterator object;
++	Input* inputin=NULL;
++	Input* inputout=NULL;
++
++	/*Output*/
++	Inputs* newinputs=new Inputs();
++
++	/*Go through inputs and call Spawn function*/
++	for ( object=objects.begin() ; object < objects.end(); object++ ){
++
++		/*Create new input*/
++		inputin=dynamic_cast<Input*>(*object);
++		inputout=inputin->SpawnTriaInput(index1,index2,index3);
++
++		/*Add input to new inputs*/
++		newinputs->AddObject(inputout);
++	}
++
++	/*Assign output pointer*/
++	return newinputs;
++}
++/*}}}*/
+ /*FUNCTION Inputs::SpawnSegInputs{{{*/
+ Inputs* Inputs::SpawnSegInputs(int index1,int index2){
+ 
+Index: ../trunk-jpl/src/c/classes/Inputs/TriaInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TriaInput.h	(revision 17512)
++++ ../trunk-jpl/src/c/classes/Inputs/TriaInput.h	(revision 17513)
+@@ -34,6 +34,7 @@
+ 		/*TriaInput management:*/
+ 		int    InstanceEnum();
+ 		Input* SpawnTriaInput(int location);
++		Input* SpawnTriaInput(int index1,int index2,int index3);
+ 		Input* SpawnSegInput(int index1,int index2);
+ 		Input* PointwiseDivide(Input* inputB);
+ 		Input* PointwiseMin(Input* inputB);
+Index: ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 17512)
++++ ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 17513)
+@@ -122,6 +122,37 @@
+ 	return outinput;
+ }
+ /*}}}*/
++/*FUNCTION PentaInput::SpawnTriaInput{{{*/
++Input* PentaInput::SpawnTriaInput(int index1,int index2,int index3){
++
++	/*output*/
++	TriaInput* outinput=NULL;
++
++	if(this->element_type==P0Enum){ 
++		outinput=new TriaInput(this->enum_type,&this->values[0],P0Enum);
++	}
++	else{
++		/*Assume P1 interpolation only for now*/
++		IssmDouble newvalues[3]; 
++
++		/*Create array of indices depending on location (0=base 1=surface)*/
++		int indices[3];
++		indices[0] = index1;
++		indices[1] = index2;
++		indices[2] = index3;
++
++		/*Create new input*/
++		for(int i=0;i<3;i++){
++			_assert_(indices[i]>=0 && indices[i]<6);
++			newvalues[i]=this->values[indices[i]];
++		}
++		outinput=new TriaInput(this->enum_type,&newvalues[0],P1Enum);
++	}
++
++	/*Assign output*/
++	return outinput;
++}
++/*}}}*/
+ /*FUNCTION PentaInput::SpawnSegInput{{{*/
+ Input* PentaInput::SpawnSegInput(int index1,int index2){
+ 
+Index: ../trunk-jpl/src/c/classes/Inputs/Inputs.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/Inputs.h	(revision 17512)
++++ ../trunk-jpl/src/c/classes/Inputs/Inputs.h	(revision 17513)
+@@ -27,7 +27,8 @@
+ 		int         DeleteInput(int enum_type);
+ 		void        DuplicateInput(int original_enum,int new_enum);
+ 		Input*      GetInput(int enum_name);
+-		Inputs*     SpawnTriaInputs(int position);
++		Inputs*     SpawnTriaInputs(int position);//TO BE REMOVED (replaced by the other one)
++		Inputs*     SpawnTriaInputs(int index1,int index2,int index3);
+ 		Inputs*     SpawnSegInputs(int index1,int index2);
+ 		Inputs*     SpawnSegInputs(int position);
+ 		void        AXPY(int inputy_enum, IssmDouble scalar, int inputx_enum);
+Index: ../trunk-jpl/src/c/classes/Inputs/TransientInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TransientInput.cpp	(revision 17512)
++++ ../trunk-jpl/src/c/classes/Inputs/TransientInput.cpp	(revision 17513)
+@@ -141,6 +141,26 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION TransientInput::SpawnTriaInput{{{*/
++Input* TransientInput::SpawnTriaInput(int index1,int index2,int index3){
++
++	/*output*/
++	TransientInput* outinput=NULL;
++
++	/*Create new Transientinput (copy of current input)*/
++	outinput=new TransientInput();
++	outinput->enum_type=this->enum_type;
++	outinput->numtimesteps=this->numtimesteps;
++	outinput->timesteps=xNew<IssmDouble>(this->numtimesteps);
++	xMemCpy(outinput->timesteps,this->timesteps,this->numtimesteps);
++	outinput->inputs=(Inputs*)this->inputs->SpawnTriaInputs(index1,index2,index3);
++	outinput->parameters=this->parameters;
++
++	/*Assign output*/
++	return outinput;
++
++}
++/*}}}*/
+ /*FUNCTION TransientInput::SpawnSegInput{{{*/
+ Input* TransientInput::SpawnSegInput(int index1,int index2){
+ 
+Index: ../trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp	(revision 17512)
++++ ../trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp	(revision 17513)
+@@ -83,6 +83,21 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION DoubleInput::SpawnTriaInput{{{*/
++Input* DoubleInput::SpawnTriaInput(int index1,int index2,int index3){
++
++	/*output*/
++	DoubleInput* outinput=new DoubleInput();
++
++	/*only copy current value*/
++	outinput->enum_type=this->enum_type;
++	outinput->value=this->value;
++
++	/*Assign output*/
++	return outinput;
++
++}
++/*}}}*/
+ /*FUNCTION DoubleInput::SpawnSegInput{{{*/
+ Input* DoubleInput::SpawnSegInput(int index1,int index2){
+ 
+Index: ../trunk-jpl/src/c/classes/Inputs/PentaInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/PentaInput.h	(revision 17512)
++++ ../trunk-jpl/src/c/classes/Inputs/PentaInput.h	(revision 17513)
+@@ -34,6 +34,7 @@
+ 		/*PentaInput management*/
+ 		int   InstanceEnum();
+ 		Input* SpawnTriaInput(int location);
++		Input* SpawnTriaInput(int index1,int index2,int index3);
+ 		Input* SpawnSegInput(int index1,int index2);
+ 		Input* PointwiseDivide(Input* inputB);
+ 		Input* PointwiseMin(Input* inputB);
+Index: ../trunk-jpl/src/c/classes/Inputs/TransientInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TransientInput.h	(revision 17512)
++++ ../trunk-jpl/src/c/classes/Inputs/TransientInput.h	(revision 17513)
+@@ -40,6 +40,7 @@
+ 		/*TransientInput management: {{{*/
+ 		int    InstanceEnum();
+ 		Input* SpawnTriaInput(int location);
++		Input* SpawnTriaInput(int index1,int index2,int index3);
+ 		Input* SpawnSegInput(int index1,int index2);
+ 		Input* PointwiseDivide(Input* forcingB){_error_("not implemented yet");};
+ 		Input* PointwiseMin(Input* forcingB){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Node.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Node.cpp	(revision 17512)
++++ ../trunk-jpl/src/c/classes/Node.cpp	(revision 17513)
+@@ -100,7 +100,7 @@
+ 				analysis_enum==LevelsetAnalysisEnum ||
+ 				analysis_enum==ExtrapolationAnalysisEnum
+ 				){
+-		if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh2DverticalEnum){
++		if(iomodel->meshtype!=Mesh2DhorizontalEnum){
+ 			/*On a 3d mesh, we may have collapsed elements, hence dead nodes. Freeze them out: */
+ 			_assert_(iomodel->Data(MeshVertexonbedEnum));
+ 			if(!(reCast<bool>(iomodel->Data(MeshVertexonbedEnum)[io_index]))){
+@@ -111,7 +111,7 @@
+ 	if(
+ 				analysis_enum==FreeSurfaceTopAnalysisEnum
+ 				){
+-		if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh2DverticalEnum){
++		if(iomodel->meshtype!=Mesh2DhorizontalEnum){
+ 			/*On a 3d mesh, we may have collapsed elements, hence dead nodes. Freeze them out: */
+ 			_assert_(iomodel->Data(MeshVertexonsurfaceEnum));
+ 			if(!(reCast<bool>(iomodel->Data(MeshVertexonsurfaceEnum)[io_index]))){
Index: issm/oecreview/Archive/16554-17801/ISSM-17513-17514.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17513-17514.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17513-17514.diff	(revision 17802)
@@ -0,0 +1,719 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17513)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17514)
+@@ -2143,7 +2143,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION Penta::SpawnTria {{{*/
+-Tria*  Penta::SpawnTria(int location){
++Tria*  Penta::SpawnTria(int index1,int index2,int index3){
+ 
+ 	int analysis_counter;
+ 
+@@ -2153,10 +2153,10 @@
+ 	/*Create Tria*/
+ 	Tria* tria=new Tria();
+ 	tria->id=this->id;
+-	tria->inputs=(Inputs*)this->inputs->SpawnTriaInputs(location);
++	tria->inputs=(Inputs*)this->inputs->SpawnTriaInputs(index1,index2,index3);
+ 	tria->parameters=this->parameters;
+ 	tria->element_type=P1Enum; //Only P1 CG for now (TO BE CHANGED)
+-	this->SpawnTriaHook(dynamic_cast<ElementHook*>(tria),location);
++	this->SpawnTriaHook(dynamic_cast<ElementHook*>(tria),index1,index2,index3);
+ 
+ 	/*Spawn material*/
+ 	tria->material=(Material*)this->material->copy2(tria);
+@@ -2179,7 +2179,7 @@
+ 	this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum);
+ 	if(this->inputs->GetInput(VxEnum)) this->InputDepthAverageAtBase(VxEnum,VxAverageEnum);
+ 	if(this->inputs->GetInput(VyEnum)) this->InputDepthAverageAtBase(VyEnum,VyAverageEnum);
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
++	Tria* tria=(Tria*)SpawnTria(0,1,2);
+ 	this->inputs->DeleteInput(MaterialsRheologyBbarEnum);
+ 	this->inputs->DeleteInput(DamageDbarEnum);
+ 	this->inputs->DeleteInput(VxAverageEnum);
+@@ -2193,7 +2193,7 @@
+ 
+ 	_assert_(this->IsOnSurface());
+ 
+-	Tria* tria=(Tria*)SpawnTria(1); //lower face is 0, upper face is 1.
++	Tria* tria=(Tria*)SpawnTria(3,4,5);
+ 
+ 	return tria;
+ }
+@@ -2267,14 +2267,14 @@
+ 
+ 		/*This element should be collapsed into a tria element at its base. Create this tria element, 
+ 		 * and compute SurfaceArea*/
+-		tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
++		tria=(Tria*)SpawnTria(0,1,2);
+ 		S=tria->SurfaceArea();
+ 		delete tria->material; delete tria;
+ 		return S;
+ 	}
+ 	else{
+ 
+-		tria=(Tria*)SpawnTria(1); //lower face is 0, upper face is 1.
++		tria=(Tria*)SpawnTria(3,4,5);
+ 		S=tria->SurfaceArea();
+ 		delete tria->material; delete tria;
+ 		return S;
+@@ -2891,7 +2891,7 @@
+ 	this->InputDepthAverageAtBase(VyEnum,VyAverageEnum);
+ 
+ 	/*Spawn Tria element from the base of the Penta: */
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
++	Tria* tria=(Tria*)SpawnTria(0,1,2);
+ 	mass_flux=tria->MassFlux(segment);
+ 	delete tria->material; delete tria;
+ 
+@@ -2915,7 +2915,7 @@
+ 	this->InputDepthAverageAtBase(VyEnum,VyAverageEnum);
+ 
+ 	/*Spawn Tria element from the base of the Penta: */
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
++	Tria* tria=(Tria*)SpawnTria(0,1,2);
+ 	mass_flux=tria->MassFlux(x1,y1,x2,y2,segment_id);
+ 	delete tria->material; delete tria;
+ 
+@@ -3267,14 +3267,14 @@
+ 			break;
+ 		case DragCoefficientAbsGradientEnum:
+ 			if(IsOnBed()){
+-				tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
++				tria=(Tria*)SpawnTria(0,1,2);
+ 				tria->GradjDragGradient(gradient,control_index);
+ 				delete tria->material; delete tria;
+ 			}
+ 			break;
+ 		case RheologyBbarAbsGradientEnum:
+ 			if(IsOnBed()){
+-				tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
++				tria=(Tria*)SpawnTria(0,1,2);
+ 				tria->GradjBGradient(gradient,control_index);
+ 				delete tria->material; delete tria;
+ 			}
+@@ -3292,7 +3292,7 @@
+ 	if(IsFloating() || !IsOnBed()) return;
+ 
+ 	/*Spawn tria*/
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
++	Tria* tria=(Tria*)SpawnTria(0,1,2);
+ 	tria->GradjDragSSA(gradient,control_index);
+ 	delete tria->material; delete tria;
+ 
+@@ -3471,7 +3471,7 @@
+ 	this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum);
+ 
+ 	/*Collapse element to the base*/
+-	Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
++	Tria* tria=(Tria*)SpawnTria(0,1,2);
+ 	tria->GradjBSSA(gradient,control_index);
+ 	delete tria->material; delete tria;
+ 
+@@ -3491,7 +3491,7 @@
+ 	this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum);
+ 
+ 	/*Collapse element to the base*/
+-	Tria* tria=(Tria*)SpawnTria(0);
++	Tria* tria=(Tria*)SpawnTria(0,1,2);
+ 	tria->GradjBSSA(gradient,control_index);    //We use SSA as an estimate for now
+ 	delete tria->material; delete tria;
+ 
+@@ -3510,7 +3510,7 @@
+ 	this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum);
+ 
+ 	/*Collapse element to the base*/
+-	Tria* tria=(Tria*)SpawnTria(0);
++	Tria* tria=(Tria*)SpawnTria(0,1,2);
+ 	tria->GradjBSSA(gradient,control_index);    //We use SSA as an estimate for now
+ 	delete tria->material; delete tria;
+ 
+@@ -3585,14 +3585,14 @@
+ 
+ 		/*This element should be collapsed into a tria element at its base. Create this tria element, 
+ 		 * and compute SurfaceAverageVelMisfit*/
+-		tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
++		tria=(Tria*)SpawnTria(0,1,2);
+ 		J=tria->SurfaceAverageVelMisfit();
+ 		delete tria->material; delete tria;
+ 		return J;
+ 	}
+ 	else{
+ 
+-		tria=(Tria*)SpawnTria(1); //lower face is 0, upper face is 1.
++		tria=(Tria*)SpawnTria(3,4,5);
+ 		J=tria->SurfaceAverageVelMisfit();
+ 		delete tria->material; delete tria;
+ 		return J;
+@@ -3622,14 +3622,14 @@
+ 
+ 		/*This element should be collapsed into a tria element at its base. Create this tria element, 
+ 		 * and compute SurfaceAbsVelMisfit*/
+-		tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
++		tria=(Tria*)SpawnTria(0,1,2);
+ 		J=tria->SurfaceAbsVelMisfit();
+ 		delete tria->material; delete tria;
+ 		return J;
+ 	}
+ 	else{
+ 
+-		tria=(Tria*)SpawnTria(1); //lower face is 0, upper face is 1.
++		tria=(Tria*)SpawnTria(3,4,5);
+ 		J=tria->SurfaceAbsVelMisfit();
+ 		delete tria->material; delete tria;
+ 		return J;
+@@ -3659,14 +3659,14 @@
+ 
+ 		/*This element should be collapsed into a tria element at its base. Create this tria element, 
+ 		 * and compute SurfaceLogVelMisfit*/
+-		tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
++		tria=(Tria*)SpawnTria(0,1,2); //lower face is 0, upper face is 1.
+ 		J=tria->SurfaceLogVelMisfit();
+ 		delete tria->material; delete tria;
+ 		return J;
+ 	}
+ 	else{
+ 
+-		tria=(Tria*)SpawnTria(1); //lower face is 0, upper face is 1.
++		tria=(Tria*)SpawnTria(3,4,5); //lower face is 0, upper face is 1.
+ 		J=tria->SurfaceLogVelMisfit();
+ 		delete tria->material; delete tria;
+ 		return J;
+@@ -3698,14 +3698,14 @@
+ 
+ 		/*This element should be collapsed into a tria element at its base. Create this tria element, 
+ 		 * and compute SurfaceLogVxVyMisfit*/
+-		tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
++		tria=(Tria*)SpawnTria(0,1,2);
+ 		J=tria->SurfaceLogVxVyMisfit();
+ 		delete tria->material; delete tria;
+ 		return J;
+ 	}
+ 	else{
+ 
+-		tria=(Tria*)SpawnTria(1); //lower face is 0, upper face is 1.
++		tria=(Tria*)SpawnTria(3,4,5);
+ 		J=tria->SurfaceLogVxVyMisfit();
+ 		delete tria->material; delete tria;
+ 		return J;
+@@ -3735,14 +3735,14 @@
+ 
+ 		/*This element should be collapsed into a tria element at its base. Create this tria element, 
+ 		 * and compute SurfaceRelVelMisfit*/
+-		tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1.
++		tria=(Tria*)SpawnTria(0,1,2);
+ 		J=tria->SurfaceRelVelMisfit();
+ 		delete tria->material; delete tria;
+ 		return J;
+ 	}
+ 	else{
+ 
+-		tria=(Tria*)SpawnTria(1); //lower face is 0, upper face is 1.
++		tria=(Tria*)SpawnTria(3,4,5);
+ 		J=tria->SurfaceRelVelMisfit();
+ 		delete tria->material; delete tria;
+ 		return J;
+@@ -3769,7 +3769,7 @@
+ 	if(!IsIceInElement())return 0;
+ 	_error_("Not implemented yet");
+ 
+-	tria=(Tria*)SpawnTria(0);
++	tria=(Tria*)SpawnTria(0,1,2);
+ 	J=tria->ThicknessAbsMisfit();
+ 	delete tria->material; delete tria;
+ 	return J;
+@@ -3784,7 +3784,7 @@
+ 	/*If on water, on shelf or not on bed, skip: */
+ 	if(!IsIceInElement()|| IsFloating() || !IsOnBed()) return 0;
+ 
+-	tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1
++	tria=(Tria*)SpawnTria(0,1,2); //lower face is 0, upper face is 1
+ 	J=tria->DragCoefficientAbsGradient();
+ 	delete tria->material; delete tria;
+ 	return J;
+@@ -3799,7 +3799,7 @@
+ 	/*If on water, on shelf or not on bed, skip: */
+ 	if(!IsIceInElement() || !IsOnBed()) return 0;
+ 
+-	tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1
++	tria=(Tria*)SpawnTria(0,1,2);
+ 	J=tria->RheologyBbarAbsGradient();
+ 	delete tria->material; delete tria;
+ 	return J;
+Index: ../trunk-jpl/src/c/classes/Elements/ElementHook.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/ElementHook.cpp	(revision 17513)
++++ ../trunk-jpl/src/c/classes/Elements/ElementHook.cpp	(revision 17514)
+@@ -88,46 +88,6 @@
+ }
+ /*}}}*/
+ /*FUNCTION ElementHook::SpawnTriaHook{{{*/
+-void ElementHook::SpawnTriaHook(ElementHook* triahook,int location){
+-
+-	/*Create arrow of indices depending on location (0=base 1=surface)*/
+-	int indices[3];
+-	switch(location){
+-		case 0:
+-			indices[0] = 0;
+-			indices[1] = 1;
+-			indices[2] = 2;
+-			break;
+-		case 1:
+-			indices[0] = 3;
+-			indices[1] = 4;
+-			indices[2] = 5;
+-			break;
+-		default:
+-			_error_("case "<<location<<" not supported");
+-	}
+-
+-	triahook->numanalyses=this->numanalyses;
+-
+-	/*Spawn nodes hook*/
+-	triahook->hnodes=new Hook*[this->numanalyses];
+-	for(int i=0;i<this->numanalyses;i++){
+-		/*Do not do anything if Hook is empty*/
+-		if (!this->hnodes[i] || this->hnodes[i]->GetNum()==0){
+-			triahook->hnodes[i]=NULL;
+-		}
+-		else{
+-			triahook->hnodes[i]=this->hnodes[i]->Spawn(indices,3);
+-		}
+-	}
+-
+-	/*do not spawn hmaterial. material will be taken care of by Penta*/
+-	triahook->hmaterial=NULL;
+-	triahook->hvertices=(Hook*)this->hvertices->Spawn(indices,3);
+-	triahook->hmatpar=(Hook*)this->hmatpar->copy();
+-}
+-/*}}}*/
+-/*FUNCTION ElementHook::SpawnTriaHook{{{*/
+ void ElementHook::SpawnTriaHook(ElementHook* triahook,int index1,int index2,int index3){
+ 
+ 	/*Create arrow of indices depending on location (0=base 1=surface)*/
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17513)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17514)
+@@ -226,7 +226,7 @@
+ 		void           NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss);
+ 		IssmDouble     MinEdgeLength(IssmDouble* xyz_list);
+ 		void	         SetClone(int* minranks);
+-		Tria*	         SpawnTria(int location);
++		Tria*	         SpawnTria(int index1,int index2,int index3);
+ 		IssmDouble     StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa);
+ 
+ 		void           UpdateConstraintsExtrudeFromBase(void);
+Index: ../trunk-jpl/src/c/classes/Elements/ElementHook.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/ElementHook.h	(revision 17513)
++++ ../trunk-jpl/src/c/classes/Elements/ElementHook.h	(revision 17514)
+@@ -24,7 +24,6 @@
+ 		~ElementHook();
+ 
+ 		void SetHookNodes(int* node_ids,int numnodes,int analysis_counter);
+-		void SpawnTriaHook(ElementHook* triahook,int location); //3d only TO BE REMOVED (replaced by the one below)
+ 		void SpawnTriaHook(ElementHook* triahook,int index1,int index2,int index3); //3d only
+ 		void SpawnSegHook(ElementHook* triahook,int ndex1,int index2); //2d only
+ 		void InitHookNeighbors(int* element_ids);               //3d only
+Index: ../trunk-jpl/src/c/classes/Inputs/DoubleInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/DoubleInput.h	(revision 17513)
++++ ../trunk-jpl/src/c/classes/Inputs/DoubleInput.h	(revision 17514)
+@@ -32,7 +32,6 @@
+ 		/*}}}*/
+ 		/*DoubleInput management: {{{*/
+ 		int   InstanceEnum();
+-		Input* SpawnTriaInput(int location);
+ 		Input* SpawnTriaInput(int index1,int index2,int index3);
+ 		Input* SpawnSegInput(int index1,int index2);
+ 		Input* PointwiseDivide(Input* inputB);
+Index: ../trunk-jpl/src/c/classes/Inputs/ControlInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/ControlInput.cpp	(revision 17513)
++++ ../trunk-jpl/src/c/classes/Inputs/ControlInput.cpp	(revision 17514)
+@@ -192,10 +192,6 @@
+ 
+ }/*}}}*/
+ /*FUNCTION ControlInput::SpawnTriaInput{{{*/
+-Input* ControlInput::SpawnTriaInput(int location){
+-	return values->SpawnTriaInput(location);
+-}/*}}}*/
+-/*FUNCTION ControlInput::SpawnTriaInput{{{*/
+ Input* ControlInput::SpawnTriaInput(int index1,int index2,int index3){
+ 	return values->SpawnTriaInput(index1,index2,index3);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Inputs/SegInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/SegInput.h	(revision 17513)
++++ ../trunk-jpl/src/c/classes/Inputs/SegInput.h	(revision 17514)
+@@ -33,7 +33,6 @@
+ 
+ 		/*SegInput management:*/
+ 		int    InstanceEnum();
+-		Input* SpawnTriaInput(int location){_error_("not supported yet");};
+ 		Input* SpawnTriaInput(int index1,int index2,int index3){_error_("not supported yet");};
+ 		Input* SpawnSegInput(int index1,int index2){_error_("not implemented yet");};
+ 		Input* PointwiseDivide(Input* inputB){_error_("not supported yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/TetraInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TetraInput.h	(revision 17513)
++++ ../trunk-jpl/src/c/classes/Inputs/TetraInput.h	(revision 17514)
+@@ -33,7 +33,6 @@
+ 
+ 		/*TetraInput management:*/
+ 		int    InstanceEnum();
+-		Input* SpawnTriaInput(int location){_error_("not supported yet");};
+ 		Input* SpawnTriaInput(int index1,int index2,int index3);
+ 		Input* SpawnSegInput(int index1,int index2){_error_("not supported yet");};
+ 		Input* PointwiseDivide(Input* inputB);
+Index: ../trunk-jpl/src/c/classes/Inputs/Input.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/Input.h	(revision 17513)
++++ ../trunk-jpl/src/c/classes/Inputs/Input.h	(revision 17514)
+@@ -53,7 +53,6 @@
+ 		virtual void   Extrude()=0;
+ 		virtual void   GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist)=0;
+ 
+-		virtual Input* SpawnTriaInput(int location)=0;
+ 		virtual Input* SpawnTriaInput(int index1,int index2,int index3)=0;
+ 		virtual Input* SpawnSegInput(int index1,int index2)=0;
+ 		virtual Input* PointwiseDivide(Input* inputB)=0;
+Index: ../trunk-jpl/src/c/classes/Inputs/ControlInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/ControlInput.h	(revision 17513)
++++ ../trunk-jpl/src/c/classes/Inputs/ControlInput.h	(revision 17514)
+@@ -37,7 +37,6 @@
+ 		/*}}}*/
+ 		/*ControlInput management: {{{*/
+ 		int    InstanceEnum();
+-		Input* SpawnTriaInput(int location);
+ 		Input* SpawnTriaInput(int index1,int index2,int index3);
+ 		Input* SpawnSegInput(int index1,int index2);
+ 		Input* PointwiseDivide(Input* inputB){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/DatasetInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/DatasetInput.cpp	(revision 17513)
++++ ../trunk-jpl/src/c/classes/Inputs/DatasetInput.cpp	(revision 17514)
+@@ -78,24 +78,6 @@
+ }
+ /*}}}*/
+ /*FUNCTION DatasetInput::SpawnTriaInput{{{*/
+-Input* DatasetInput::SpawnTriaInput(int location){
+-
+-	/*output*/
+-	DatasetInput* outinput=NULL;
+-
+-	/*Create new Datasetinput (copy of current input)*/
+-	outinput=new DatasetInput();
+-	outinput->enum_type=this->enum_type;
+-	outinput->inputs=dynamic_cast<Inputs*>(this->inputs->SpawnTriaInputs(location));
+-	outinput->numids=this->numids;
+-	outinput->ids=xNew<int>(this->numids);
+-	xMemCpy(outinput->ids,this->ids,this->numids);
+-
+-	/*Assign output*/
+-	return outinput;
+-}
+-/*}}}*/
+-/*FUNCTION DatasetInput::SpawnTriaInput{{{*/
+ Input* DatasetInput::SpawnTriaInput(int index1,int index2,int index3){
+ 
+ 	/*output*/
+Index: ../trunk-jpl/src/c/classes/Inputs/DatasetInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/DatasetInput.h	(revision 17513)
++++ ../trunk-jpl/src/c/classes/Inputs/DatasetInput.h	(revision 17514)
+@@ -35,7 +35,6 @@
+ 		/*DatasetInput management: {{{*/
+ 		void   AddInput(Input* input,int id);
+ 		int    InstanceEnum();
+-		Input* SpawnTriaInput(int location);
+ 		Input* SpawnTriaInput(int index1,int index2,int index3);
+ 		Input* SpawnSegInput(int index1,int index2);
+ 		Input* PointwiseDivide(Input* inputB){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/IntInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/IntInput.cpp	(revision 17513)
++++ ../trunk-jpl/src/c/classes/Inputs/IntInput.cpp	(revision 17514)
+@@ -69,20 +69,6 @@
+ }
+ /*}}}*/
+ /*FUNCTION IntInput::SpawnTriaInput{{{*/
+-Input* IntInput::SpawnTriaInput(int location){
+-
+-	/*output*/
+-	IntInput* outinput=new IntInput();
+-
+-	/*only copy current value*/
+-	outinput->enum_type=this->enum_type;
+-	outinput->value=this->value;
+-
+-	/*Assign output*/
+-	return outinput;
+-}
+-/*}}}*/
+-/*FUNCTION IntInput::SpawnTriaInput{{{*/
+ Input* IntInput::SpawnTriaInput(int index1,int index2,int index3){
+ 
+ 	/*output*/
+Index: ../trunk-jpl/src/c/classes/Inputs/BoolInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/BoolInput.cpp	(revision 17513)
++++ ../trunk-jpl/src/c/classes/Inputs/BoolInput.cpp	(revision 17514)
+@@ -69,21 +69,6 @@
+ }
+ /*}}}*/
+ /*FUNCTION BoolInput::SpawnTriaInput{{{*/
+-Input* BoolInput::SpawnTriaInput(int location){
+-
+-		/*output*/
+-		BoolInput* outinput=new BoolInput();
+-
+-		/*only copy current value*/
+-		outinput->enum_type=this->enum_type;
+-		outinput->value=this->value;
+-
+-		/*Assign output*/
+-		return outinput;
+-
+-}
+-/*}}}*/
+-/*FUNCTION BoolInput::SpawnTriaInput{{{*/
+ Input* BoolInput::SpawnTriaInput(int index1,int index2,int index3){
+ 
+ 		/*output*/
+Index: ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 17513)
++++ ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 17514)
+@@ -81,20 +81,6 @@
+ }
+ /*}}}*/
+ /*FUNCTION TriaInput::SpawnTriaInput{{{*/
+-Input* TriaInput::SpawnTriaInput(int location){
+-
+-	/*output*/
+-	TriaInput* outinput=NULL;
+-
+-	/*Create new Tria input (copy of current input)*/
+-	outinput=new TriaInput(this->enum_type,&this->values[0],this->element_type);
+-
+-	/*Assign output*/
+-	return outinput;
+-
+-}
+-/*}}}*/
+-/*FUNCTION TriaInput::SpawnTriaInput{{{*/
+ Input* TriaInput::SpawnTriaInput(int index1,int index2,int index3){
+ 
+ 	/*output*/
+Index: ../trunk-jpl/src/c/classes/Inputs/IntInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/IntInput.h	(revision 17513)
++++ ../trunk-jpl/src/c/classes/Inputs/IntInput.h	(revision 17514)
+@@ -33,7 +33,6 @@
+ 		/*}}}*/
+ 		/*IntInput management: {{{*/
+ 		int   InstanceEnum();
+-		Input* SpawnTriaInput(int location);
+ 		Input* SpawnTriaInput(int index1,int index2,int index3);
+ 		Input* SpawnSegInput(int index1,int index2);
+ 		Input* PointwiseDivide(Input* inputB){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/BoolInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/BoolInput.h	(revision 17513)
++++ ../trunk-jpl/src/c/classes/Inputs/BoolInput.h	(revision 17514)
+@@ -29,7 +29,6 @@
+ 		/*}}}*/
+ 		/*BoolInput management: {{{*/
+ 		int   InstanceEnum();
+-		Input* SpawnTriaInput(int location);
+ 		Input* SpawnTriaInput(int index1,int index2,int index3);
+ 		Input* SpawnSegInput(int index1,int index2);
+ 		Input* PointwiseDivide(Input* inputB){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Inputs/Inputs.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/Inputs.cpp	(revision 17513)
++++ ../trunk-jpl/src/c/classes/Inputs/Inputs.cpp	(revision 17514)
+@@ -369,32 +369,6 @@
+ }
+ /*}}}*/
+ /*FUNCTION Inputs::SpawnTriaInputs{{{*/
+-Inputs* Inputs::SpawnTriaInputs(int location){
+-
+-	/*Intermediary*/
+-	vector<Object*>::iterator object;
+-	Input* inputin=NULL;
+-	Input* inputout=NULL;
+-
+-	/*Output*/
+-	Inputs* newinputs=new Inputs();
+-
+-	/*Go through inputs and call Spawn function*/
+-	for ( object=objects.begin() ; object < objects.end(); object++ ){
+-
+-		/*Create new input*/
+-		inputin=dynamic_cast<Input*>(*object);
+-		inputout=inputin->SpawnTriaInput(location);
+-
+-		/*Add input to new inputs*/
+-		newinputs->AddObject(inputout);
+-	}
+-
+-	/*Assign output pointer*/
+-	return newinputs;
+-}
+-/*}}}*/
+-/*FUNCTION Inputs::SpawnTriaInputs{{{*/
+ Inputs* Inputs::SpawnTriaInputs(int index1,int index2,int index3){
+ 
+ 	/*Intermediary*/
+Index: ../trunk-jpl/src/c/classes/Inputs/TriaInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TriaInput.h	(revision 17513)
++++ ../trunk-jpl/src/c/classes/Inputs/TriaInput.h	(revision 17514)
+@@ -33,7 +33,6 @@
+ 
+ 		/*TriaInput management:*/
+ 		int    InstanceEnum();
+-		Input* SpawnTriaInput(int location);
+ 		Input* SpawnTriaInput(int index1,int index2,int index3);
+ 		Input* SpawnSegInput(int index1,int index2);
+ 		Input* PointwiseDivide(Input* inputB);
+Index: ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 17513)
++++ ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 17514)
+@@ -81,48 +81,6 @@
+ }
+ /*}}}*/
+ /*FUNCTION PentaInput::SpawnTriaInput{{{*/
+-Input* PentaInput::SpawnTriaInput(int location){
+-
+-	/*output*/
+-	TriaInput* outinput=NULL;
+-
+-	if(this->element_type==P0Enum){ 
+-		outinput=new TriaInput(this->enum_type,&this->values[0],P0Enum);
+-	}
+-	else{
+-		/*Assume P1 interpolation only for now*/
+-		IssmDouble newvalues[3]; 
+-
+-		/*Create array of indices depending on location (0=base 1=surface)*/
+-		int indices[3];
+-		switch(location){
+-			case 0:
+-				indices[0] = 0;
+-				indices[1] = 1;
+-				indices[2] = 2;
+-				break;
+-			case 1:
+-				indices[0] = 3;
+-				indices[1] = 4;
+-				indices[2] = 5;
+-				break;
+-			default:
+-				_error_("case "<<location<<" not supported");
+-		}
+-
+-		/*Create new input*/
+-		for(int i=0;i<3;i++){
+-			_assert_(indices[i]>=0 && indices[i]<6);
+-			newvalues[i]=this->values[indices[i]];
+-		}
+-		outinput=new TriaInput(this->enum_type,&newvalues[0],P1Enum);
+-	}
+-
+-	/*Assign output*/
+-	return outinput;
+-}
+-/*}}}*/
+-/*FUNCTION PentaInput::SpawnTriaInput{{{*/
+ Input* PentaInput::SpawnTriaInput(int index1,int index2,int index3){
+ 
+ 	/*output*/
+Index: ../trunk-jpl/src/c/classes/Inputs/TransientInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TransientInput.cpp	(revision 17513)
++++ ../trunk-jpl/src/c/classes/Inputs/TransientInput.cpp	(revision 17514)
+@@ -122,26 +122,6 @@
+ }
+ /*}}}*/
+ /*FUNCTION TransientInput::SpawnTriaInput{{{*/
+-Input* TransientInput::SpawnTriaInput(int location){
+-
+-	/*output*/
+-	TransientInput* outinput=NULL;
+-
+-	/*Create new Transientinput (copy of current input)*/
+-	outinput=new TransientInput();
+-	outinput->enum_type=this->enum_type;
+-	outinput->numtimesteps=this->numtimesteps;
+-	outinput->timesteps=xNew<IssmDouble>(this->numtimesteps);
+-	xMemCpy(outinput->timesteps,this->timesteps,this->numtimesteps);
+-	outinput->inputs=(Inputs*)this->inputs->SpawnTriaInputs(location);
+-	outinput->parameters=this->parameters;
+-
+-	/*Assign output*/
+-	return outinput;
+-
+-}
+-/*}}}*/
+-/*FUNCTION TransientInput::SpawnTriaInput{{{*/
+ Input* TransientInput::SpawnTriaInput(int index1,int index2,int index3){
+ 
+ 	/*output*/
+Index: ../trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp	(revision 17513)
++++ ../trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp	(revision 17514)
+@@ -69,21 +69,6 @@
+ }
+ /*}}}*/
+ /*FUNCTION DoubleInput::SpawnTriaInput{{{*/
+-Input* DoubleInput::SpawnTriaInput(int location){
+-
+-	/*output*/
+-	DoubleInput* outinput=new DoubleInput();
+-
+-	/*only copy current value*/
+-	outinput->enum_type=this->enum_type;
+-	outinput->value=this->value;
+-
+-	/*Assign output*/
+-	return outinput;
+-
+-}
+-/*}}}*/
+-/*FUNCTION DoubleInput::SpawnTriaInput{{{*/
+ Input* DoubleInput::SpawnTriaInput(int index1,int index2,int index3){
+ 
+ 	/*output*/
+Index: ../trunk-jpl/src/c/classes/Inputs/PentaInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/PentaInput.h	(revision 17513)
++++ ../trunk-jpl/src/c/classes/Inputs/PentaInput.h	(revision 17514)
+@@ -33,7 +33,6 @@
+ 
+ 		/*PentaInput management*/
+ 		int   InstanceEnum();
+-		Input* SpawnTriaInput(int location);
+ 		Input* SpawnTriaInput(int index1,int index2,int index3);
+ 		Input* SpawnSegInput(int index1,int index2);
+ 		Input* PointwiseDivide(Input* inputB);
+Index: ../trunk-jpl/src/c/classes/Inputs/TransientInput.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TransientInput.h	(revision 17513)
++++ ../trunk-jpl/src/c/classes/Inputs/TransientInput.h	(revision 17514)
+@@ -39,7 +39,6 @@
+ 		/*}}}*/
+ 		/*TransientInput management: {{{*/
+ 		int    InstanceEnum();
+-		Input* SpawnTriaInput(int location);
+ 		Input* SpawnTriaInput(int index1,int index2,int index3);
+ 		Input* SpawnSegInput(int index1,int index2);
+ 		Input* PointwiseDivide(Input* forcingB){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-17514-17515.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17514-17515.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17514-17515.diff	(revision 17802)
@@ -0,0 +1,158 @@
+Index: ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp	(revision 17514)
++++ ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp	(revision 17515)
+@@ -544,6 +544,11 @@
+ 		case P1bubbleEnum:          return NUMNODESP1b;
+ 		case P1bubblecondensedEnum: return NUMNODESP1b;
+ 		case P2Enum:                return NUMNODESP2;
++		case P1P1Enum:              return NUMNODESP1*2;
++		case P1P1GLSEnum:           return NUMNODESP1*2;
++		case MINIcondensedEnum:     return NUMNODESP1b+NUMNODESP1;
++		case MINIEnum:              return NUMNODESP1b+NUMNODESP1;
++		case TaylorHoodEnum:        return NUMNODESP2+NUMNODESP1;
+ 		default: _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+ 	}
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17514)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17515)
+@@ -340,6 +340,19 @@
+ 	}
+ }
+ /*}}}*/
++/*FUNCTION Tetra::HasNodeOnBed           THIS ONE{{{*/
++bool Tetra::HasNodeOnBed(){
++
++	IssmDouble values[NUMVERTICES];
++	IssmDouble sum;
++
++	/*Retrieve all inputs and parameters*/
++	GetInputListOnVertices(&values[0],MeshVertexonbedEnum);
++	sum = values[0]+values[1]+values[2]+values[3];
++
++	return sum>0.;
++}
++/*}}}*/
+ /*FUNCTION Tetra::InputUpdateFromIoModel {{{*/
+ void Tetra::InputUpdateFromIoModel(int index,IoModel* iomodel){ 
+ 
+@@ -681,6 +694,66 @@
+ 	}
+ }
+ /*}}}*/
++/*FUNCTION Tetra::ResetFSBasalBoundaryCondition {{{*/
++void  Tetra::ResetFSBasalBoundaryCondition(void){
++
++	int numnodes = this->GetNumberOfNodes();
++
++	int          approximation;
++	IssmDouble*  vertexonbed= NULL;
++	IssmDouble   slopex,slopey,groundedice;
++	IssmDouble   xz_plane[6];
++
++	/*For FS only: we want the CS to be tangential to the bedrock*/
++	inputs->GetInputValue(&approximation,ApproximationEnum);
++	if(IsFloating() || !HasNodeOnBed() ||  approximation!=FSApproximationEnum) return;
++
++	//printf("element number %i \n",this->id);
++	/*Get inputs*/
++	Input* slopex_input=inputs->GetInput(BedSlopeXEnum); _assert_(slopex_input);
++	Input* slopey_input=inputs->GetInput(BedSlopeYEnum); _assert_(slopey_input);
++	Input* groundedicelevelset_input=inputs->GetInput(MaskGroundediceLevelsetEnum); _assert_(groundedicelevelset_input);
++	vertexonbed = xNew<IssmDouble>(numnodes);
++	this->GetInputListOnNodesVelocity(&vertexonbed[0],MeshVertexonbedEnum);
++
++	/*Loop over basal nodes and update their CS*/
++	GaussTetra* gauss = new GaussTetra();
++	for(int i=0;i<this->NumberofNodesVelocity();i++){
++
++		if(vertexonbed[i]==1){
++			gauss->GaussNode(this->VelocityInterpolation(),i);
++
++			slopex_input->GetInputValue(&slopex,gauss);
++			slopey_input->GetInputValue(&slopey,gauss);
++			groundedicelevelset_input->GetInputValue(&groundedice,gauss);
++
++			/*New X axis          New Z axis*/
++			xz_plane[0]=1.;       xz_plane[3]=-slopex;  
++			xz_plane[1]=0.;       xz_plane[4]=-slopey;  
++			xz_plane[2]=slopex;   xz_plane[5]=1.;          
++
++			if(groundedice>0){
++				if(this->nodes[i]->GetApproximation()==FSvelocityEnum){
++					this->nodes[i]->DofInSSet(2); //vz 
++				}
++				else _error_("Flow equation approximation"<<EnumToStringx(this->nodes[i]->GetApproximation())<<" not supported yet");
++			}
++			else{
++				if(this->nodes[i]->GetApproximation()==FSvelocityEnum){
++					this->nodes[i]->DofInFSet(2); //vz
++				}
++				else _error_("Flow equation approximation"<<EnumToStringx(this->nodes[i]->GetApproximation())<<" not supported yet");
++			}
++
++			XZvectorsToCoordinateSystem(&this->nodes[i]->coord_system[0][0],&xz_plane[0]);
++		}
++	}
++
++	/*cleanup*/
++	xDelete<IssmDouble>(vertexonbed);
++	delete gauss;
++}
++/*}}}*/
+ /*FUNCTION Tetra::SetCurrentConfiguration {{{*/
+ void  Tetra::SetCurrentConfiguration(Elements* elementsin, Loads* loadsin, Nodes* nodesin, Materials* materialsin, Parameters* parametersin){
+ 
+@@ -912,6 +985,16 @@
+ 	this->InputUpdateFromIoModel(index,iomodel);
+ }
+ /*}}}*/
++/*FUNCTION Tetra::VelocityInterpolation{{{*/
++int Tetra::VelocityInterpolation(void){
++	return TetraRef::VelocityInterpolation();
++}
++/*}}}*/
++/*FUNCTION Tetra::PressureInterpolation{{{*/
++int Tetra::PressureInterpolation(void){
++	return TetraRef::PressureInterpolation();
++}
++/*}}}*/
+ /*FUNCTION Tetra::ZeroLevelsetCoordinates{{{*/
+ void Tetra::ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){
+ 	/*Compute portion of the element that is grounded*/ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17514)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17515)
+@@ -87,6 +87,7 @@
+ 		void        GetVerticesCoordinatesTop(IssmDouble** pxyz_list);
+ 		bool        HasFaceOnBed();
+ 		bool        HasFaceOnSurface();
++		bool        HasNodeOnBed();
+ 		int         Sid();
+ 		bool        IsOnBed();
+ 		bool        IsOnSurface();
+@@ -116,10 +117,10 @@
+ 		Tria*       SpawnTria(int index1,int index2,int index3);
+ 		IssmDouble  StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa){_error_("not implemented yet");};
+ 		IssmDouble  PureIceEnthalpy(IssmDouble pressure){_error_("not implemented yet");};
+-		int         PressureInterpolation(void){_error_("not implemented yet");};
++		int         PressureInterpolation(void);
+ 		void        ValueP1OnGauss(IssmDouble* pvalue,IssmDouble* values,Gauss* gauss){_error_("not implemented yet");};
+ 		void        ValueP1DerivativesOnGauss(IssmDouble* dvalue,IssmDouble* values,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+-		int         VelocityInterpolation(void){_error_("not implemented yet");};
++		int         VelocityInterpolation(void);
+ 		void        GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating){_error_("not implemented yet");};
+ 		IssmDouble  GetGroundedPortion(IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		void        GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");};
+@@ -153,7 +154,7 @@
+ 		void        MaterialUpdateFromTemperature(void){_error_("not implemented yet");};
+ 		int         NodalValue(IssmDouble* pvalue, int index, int natureofdataenum){_error_("not implemented yet");};
+ 		void        PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm){_error_("not implemented yet");};
+-		void        ResetFSBasalBoundaryCondition(void){_error_("not implemented yet");};
++		void        ResetFSBasalBoundaryCondition(void);
+ 		void        ReduceMatrices(ElementMatrix* Ke,ElementVector* pe);
+ 		void        SetTemporaryElementType(int element_type_in){_error_("not implemented yet");};
+ 		void	      SmbGradients(){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-17515-17516.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17515-17516.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17515-17516.diff	(revision 17802)
@@ -0,0 +1,2114 @@
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 17515)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 17516)
+@@ -213,8 +213,8 @@
+ 	IssmDouble *xyz_list = NULL;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = element->GetNumberOfNodesVelocity();
+-	int pnumnodes = element->GetNumberOfNodesPressure();
++	int vnumnodes = element->NumberofNodesVelocity();
++	int pnumnodes = element->NumberofNodesPressure();
+ 	int numdof    = vnumnodes*3 + pnumnodes;
+ 
+ 	/*Initialize Jacobian with regular FS (first part of the Gateau derivative)*/
+@@ -319,8 +319,8 @@
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = element->GetNumberOfNodesVelocity();
+-	int pnumnodes = element->GetNumberOfNodesPressure();
++	int vnumnodes = element->NumberofNodesVelocity();
++	int pnumnodes = element->NumberofNodesPressure();
+ 
+ 	/*Prepare coordinate system list*/
+ 	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+@@ -938,8 +938,8 @@
+ 	IssmDouble   FSreconditioning;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = element->GetNumberOfNodesVelocity();
+-	int pnumnodes = element->GetNumberOfNodesPressure();
++	int vnumnodes = element->NumberofNodesVelocity();
++	int pnumnodes = element->NumberofNodesPressure();
+ 	int vnumdof   = vnumnodes*3;
+ 	int pnumdof   = pnumnodes*1;
+ 
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17515)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17516)
+@@ -194,7 +194,7 @@
+ 	IssmDouble *vertex_pairing=NULL;
+ 	IssmDouble *nodeonbed=NULL;
+ 	iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,MasstransportVertexPairingEnum);
+-	iomodel->FetchData(&nodeonbed,NULL,NULL,MeshVertexonbedEnum);
++	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(&nodeonbed,NULL,NULL,MeshVertexonbedEnum);
+ 
+ 	for(int i=0;i<numvertex_pairing;i++){
+ 
+@@ -204,7 +204,9 @@
+ 			_assert_(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+1])-1]);
+ 
+ 			/*Skip if one of the two is not on the bed*/
+-			if(!(reCast<bool>(nodeonbed[reCast<int>(vertex_pairing[2*i+0])-1])) || !(reCast<bool>(nodeonbed[reCast<int>(vertex_pairing[2*i+1])-1]))) continue;
++			if(iomodel->meshtype!=Mesh2DhorizontalEnum){
++				if(!(reCast<bool>(nodeonbed[reCast<int>(vertex_pairing[2*i+0])-1])) || !(reCast<bool>(nodeonbed[reCast<int>(vertex_pairing[2*i+1])-1]))) continue;
++			}
+ 
+ 			/*Get node ids*/
+ 			penpair_ids[0]=iomodel->nodecounter+reCast<int>(vertex_pairing[2*i+0]);
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17515)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17516)
+@@ -34,7 +34,7 @@
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,VxEnum);
+-	iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
++	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+ 	if(iomodel->meshtype==Mesh3DEnum){
+ 		iomodel->FetchDataToInput(elements,VzEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
+@@ -68,7 +68,7 @@
+ 	IssmDouble *vertex_pairing=NULL;
+ 	IssmDouble *nodeonsurface=NULL;
+ 	iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,MasstransportVertexPairingEnum);
+-	iomodel->FetchData(&nodeonsurface,NULL,NULL,MeshVertexonsurfaceEnum);
++	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(&nodeonsurface,NULL,NULL,MeshVertexonsurfaceEnum);
+ 	for(int i=0;i<numvertex_pairing;i++){
+ 
+ 		if(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+0])-1]){
+@@ -77,7 +77,9 @@
+ 			_assert_(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+1])-1]);
+ 
+ 			/*Skip if one of the two is not on the bed*/
+-			if(!(reCast<bool>(nodeonsurface[reCast<int>(vertex_pairing[2*i+0])-1])) || !(reCast<bool>(nodeonsurface[reCast<int>(vertex_pairing[2*i+1])-1]))) continue;
++			if(iomodel->meshtype!=Mesh2DhorizontalEnum){
++				if(!(reCast<bool>(nodeonsurface[reCast<int>(vertex_pairing[2*i+0])-1])) || !(reCast<bool>(nodeonsurface[reCast<int>(vertex_pairing[2*i+1])-1]))) continue;
++			}
+ 
+ 			/*Get node ids*/
+ 			penpair_ids[0]=iomodel->nodecounter+reCast<int>(vertex_pairing[2*i+0]);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17515)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17516)
+@@ -2753,8 +2753,8 @@
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = element->GetNumberOfNodesVelocity();
+-	int pnumnodes = element->GetNumberOfNodesPressure();
++	int vnumnodes = element->NumberofNodesVelocity();
++	int pnumnodes = element->NumberofNodesPressure();
+ 
+ 	/*Initialize output vector*/
+ 	ElementVector* de = element->NewElementVector(FSvelocityEnum);
+@@ -2783,8 +2783,8 @@
+ 	IssmDouble *xyz_list = NULL;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = element->GetNumberOfNodesVelocity();
+-	int pnumnodes = element->GetNumberOfNodesPressure();
++	int vnumnodes = element->NumberofNodesVelocity();
++	int pnumnodes = element->NumberofNodesPressure();
+ 	int numdof    = vnumnodes*NDOF3 + pnumnodes*NDOF1;
+ 
+ 	/*Prepare coordinate system list*/
+@@ -2885,8 +2885,8 @@
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = element->GetNumberOfNodesVelocity();
+-	int pnumnodes = element->GetNumberOfNodesPressure();
++	int vnumnodes = element->NumberofNodesVelocity();
++	int pnumnodes = element->NumberofNodesPressure();
+ 	int numdof    = vnumnodes*dim + pnumnodes;
+ 	int bsize     = epssize + 2;
+ 
+@@ -2969,8 +2969,8 @@
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = element->GetNumberOfNodesVelocity();
+-	int pnumnodes = element->GetNumberOfNodesPressure();
++	int vnumnodes = element->NumberofNodesVelocity();
++	int pnumnodes = element->NumberofNodesPressure();
+ 	int numdof    = vnumnodes*dim + pnumnodes;
+ 
+ 	/*Initialize Element matrix and vectors*/
+@@ -3064,8 +3064,8 @@
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = element->GetNumberOfNodesVelocity();
+-	int pnumnodes = element->GetNumberOfNodesPressure();
++	int vnumnodes = element->NumberofNodesVelocity();
++	int pnumnodes = element->NumberofNodesPressure();
+ 	int numdof    = vnumnodes*dim + pnumnodes;
+ 
+ 	/*Initialize Element matrix and vectors*/
+@@ -3125,8 +3125,8 @@
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = element->GetNumberOfNodesVelocity();
+-	int pnumnodes = element->GetNumberOfNodesPressure();
++	int vnumnodes = element->NumberofNodesVelocity();
++	int pnumnodes = element->NumberofNodesPressure();
+ 
+ 	/*Prepare coordinate system list*/
+ 	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+@@ -3208,8 +3208,8 @@
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = element->GetNumberOfNodesVelocity();
+-	int pnumnodes = element->GetNumberOfNodesPressure();
++	int vnumnodes = element->NumberofNodesVelocity();
++	int pnumnodes = element->NumberofNodesPressure();
+ 
+ 	/*Prepare coordinate system list*/
+ 	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+@@ -3287,8 +3287,8 @@
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = element->GetNumberOfNodesVelocity();
+-	int pnumnodes = element->GetNumberOfNodesPressure();
++	int vnumnodes = element->NumberofNodesVelocity();
++	int pnumnodes = element->NumberofNodesPressure();
+ 
+ 	/*Prepare coordinate system list*/
+ 	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+@@ -3364,8 +3364,8 @@
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes   = element->GetNumberOfNodesVelocity();
+-	int pnumnodes   = element->GetNumberOfNodesPressure();
++	int vnumnodes   = element->NumberofNodesVelocity();
++	int pnumnodes   = element->NumberofNodesPressure();
+ 	int numvertices = element->GetNumberOfVertices();
+ 
+ 	/*Prepare coordinate system list*/
+@@ -3658,8 +3658,8 @@
+ 	 */
+ 
+ 	/*Fetch number of nodes for this finite element*/
+-	int pnumnodes = element->GetNumberOfNodesPressure();
+-	int vnumnodes = element->GetNumberOfNodesVelocity();
++	int pnumnodes = element->NumberofNodesPressure();
++	int vnumnodes = element->NumberofNodesVelocity();
+ 	int pnumdof   = pnumnodes;
+ 	int vnumdof   = vnumnodes*dim;
+ 
+@@ -3785,8 +3785,8 @@
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = element->GetNumberOfNodesVelocity();
+-	int pnumnodes = element->GetNumberOfNodesPressure();
++	int vnumnodes = element->NumberofNodesVelocity();
++	int pnumnodes = element->NumberofNodesPressure();
+ 	int vnumdof   = vnumnodes*dim;
+ 	int pnumdof   = pnumnodes*1;
+ 
+@@ -4320,8 +4320,8 @@
+ 	element->GetInputValue(&approximation,ApproximationEnum);
+ 	if(element->IsFloating() || !element->IsOnBed()) return NULL;
+ 
+-	int vnumnodes = element->GetNumberOfNodesVelocity();
+-	int pnumnodes = element->GetNumberOfNodesPressure();
++	int vnumnodes = element->NumberofNodesVelocity();
++	int pnumnodes = element->NumberofNodesPressure();
+ 	int numnodes  = 2*vnumnodes-1+pnumnodes;
+ 
+ 	/*Prepare node list*/
+@@ -4438,8 +4438,8 @@
+ 	Element* pentabase=element->GetBasalElement();
+ 	Element* basaltria=pentabase->SpawnBasalElement();
+ 
+-	int vnumnodes = element->GetNumberOfNodesVelocity();
+-	int pnumnodes = element->GetNumberOfNodesPressure();
++	int vnumnodes = element->NumberofNodesVelocity();
++	int pnumnodes = element->NumberofNodesPressure();
+ 	int numnodes  = 2*vnumnodes-1+pnumnodes;
+ 
+ 	/*Prepare node list*/
+@@ -4607,8 +4607,8 @@
+ 	element->GetInputValue(&approximation,ApproximationEnum);
+ 	if(approximation!=HOFSApproximationEnum) return NULL;
+ 
+-	int vnumnodes = element->GetNumberOfNodesVelocity();
+-	int pnumnodes = element->GetNumberOfNodesPressure();
++	int vnumnodes = element->NumberofNodesVelocity();
++	int pnumnodes = element->NumberofNodesPressure();
+ 	int numnodes  = vnumnodes+pnumnodes;
+ 
+ 	/*Prepare coordinate system list*/
+@@ -4686,8 +4686,8 @@
+ 	/*Initialize Element vector and return if necessary*/
+ 	element->GetInputValue(&approximation,ApproximationEnum);
+ 	if(approximation!=HOFSApproximationEnum) return NULL;
+-	int   vnumnodes = element->GetNumberOfNodesVelocity();
+-	int   pnumnodes = element->GetNumberOfNodesPressure();
++	int   vnumnodes = element->NumberofNodesVelocity();
++	int   pnumnodes = element->NumberofNodesPressure();
+ 
+ 	/*Prepare coordinate system list*/
+ 	int*   cs_list   = xNew<int>(vnumnodes+pnumnodes);
+@@ -4770,8 +4770,8 @@
+ 	if(!element->IsOnBed() || element->IsFloating()) return NULL;
+ 	element->GetInputValue(&approximation,ApproximationEnum);
+ 	if(approximation!=SSAFSApproximationEnum) return NULL;
+-	int vnumnodes = element->GetNumberOfNodesVelocity();
+-	int pnumnodes = element->GetNumberOfNodesPressure();
++	int vnumnodes = element->NumberofNodesVelocity();
++	int pnumnodes = element->NumberofNodesPressure();
+ 
+ 	/*Prepare coordinate system list*/
+ 	int* cs_list     = xNew<int>(vnumnodes+pnumnodes);
+@@ -4846,8 +4846,8 @@
+ 	/*Initialize Element vector and return if necessary*/
+ 	element->GetInputValue(&approximation,ApproximationEnum);
+ 	if(approximation!=SSAFSApproximationEnum) return NULL;
+-	int vnumnodes = element->GetNumberOfNodesVelocity();
+-	int pnumnodes = element->GetNumberOfNodesPressure();
++	int vnumnodes = element->NumberofNodesVelocity();
++	int pnumnodes = element->NumberofNodesPressure();
+ 
+ 	/*Prepare coordinate system list*/
+ 	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17515)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17516)
+@@ -72,7 +72,7 @@
+ }/*}}}*/
+ void DamageEvolutionAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+-	iomodel->FetchData(1,MeshVertexonbedEnum);
++	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(1,MeshVertexonbedEnum);
+ 	::CreateNodes(nodes,iomodel,DamageEvolutionAnalysisEnum,P1Enum);
+ 	iomodel->DeleteData(1,MeshVertexonbedEnum);
+ }/*}}}*/
+@@ -86,21 +86,8 @@
+ }/*}}}*/
+ void DamageEvolutionAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+ 
+-	/*create penalties for nodes: no node can have a damage > 1*/
+-	iomodel->FetchData(1,DamageSpcdamageEnum);
+-	CreateSingleNodeToElementConnectivity(iomodel);
++	/*Nothing for now*/
+ 
+-	for(int i=0;i<iomodel->numberofvertices;i++){
+-
+-		/*keep only this partition's nodes:*/
+-		if(iomodel->my_vertices[i]){
+-			if (xIsNan<IssmDouble>(iomodel->Data(DamageSpcdamageEnum)[i])){ //No penalty applied on spc nodes!
+-				loads->AddObject(new Pengrid(iomodel->loadcounter+i+1,i,iomodel,DamageEvolutionAnalysisEnum));
+-			}
+-		}
+-	}
+-	iomodel->DeleteData(1,DamageSpcdamageEnum);
+-
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17515)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17516)
+@@ -59,7 +59,7 @@
+ 	IssmDouble *vertex_pairing=NULL;
+ 	IssmDouble *nodeonbed=NULL;
+ 	iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,MasstransportVertexPairingEnum);
+-	iomodel->FetchData(&nodeonbed,NULL,NULL,MeshVertexonbedEnum);
++	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(&nodeonbed,NULL,NULL,MeshVertexonbedEnum);
+ 	for(int i=0;i<numvertex_pairing;i++){
+ 
+ 		if(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+0])-1]){
+@@ -68,7 +68,9 @@
+ 			_assert_(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+1])-1]);
+ 
+ 			/*Skip if one of the two is not on the bed*/
+-			if(!(reCast<bool>(nodeonbed[reCast<int>(vertex_pairing[2*i+0])-1])) || !(reCast<bool>(nodeonbed[reCast<int>(vertex_pairing[2*i+1])-1]))) continue;
++			if(iomodel->meshtype!=Mesh2DhorizontalEnum){
++				if(!(reCast<bool>(nodeonbed[reCast<int>(vertex_pairing[2*i+0])-1])) || !(reCast<bool>(nodeonbed[reCast<int>(vertex_pairing[2*i+1])-1]))) continue;
++			}
+ 
+ 			/*Get node ids*/
+ 			penpair_ids[0]=iomodel->nodecounter+reCast<int>(vertex_pairing[2*i+0]);
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_damage_nonlinear.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_damage_nonlinear.cpp	(revision 17515)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_damage_nonlinear.cpp	(revision 17516)
+@@ -1,80 +0,0 @@
+-/*
+- * \brief: solutionsequence_damage_nonlinear.cpp: core of the damage solution 
+- */ 
+-
+-#include "../toolkits/toolkits.h"
+-#include "../classes/classes.h"
+-#include "../shared/shared.h"
+-#include "../modules/modules.h"
+-
+-void solutionsequence_damage_nonlinear(FemModel* femmodel){
+-
+-	/*solution : */
+-	Vector<IssmDouble>* Dg=NULL; 
+-	Vector<IssmDouble>* Df=NULL; 
+-	Vector<IssmDouble>* Df_old=NULL; 
+-	Vector<IssmDouble>* ys=NULL; 
+-
+-	/*intermediary: */
+-	Matrix<IssmDouble>* Kff=NULL;
+-	Matrix<IssmDouble>* Kfs=NULL;
+-	Vector<IssmDouble>* pf=NULL;
+-	Vector<IssmDouble>* df=NULL;
+-
+-	bool converged;
+-	int constraints_converged;
+-	int num_unstable_constraints;
+-	int count;
+-	int damage_penalty_threshold;
+-	int damage_maxiter;
+-
+-	/*parameters:*/
+-	int  configuration_type;
+-
+-	/*Recover parameters: */
+-	femmodel->parameters->FindParam(&damage_penalty_threshold,DamagePenaltyThresholdEnum);
+-	femmodel->parameters->FindParam(&configuration_type,ConfigurationTypeEnum);
+-	femmodel->parameters->FindParam(&damage_maxiter,DamageMaxiterEnum);
+-
+-	count=1;
+-	converged=false;
+-
+-	InputUpdateFromConstantx(femmodel,true,ResetPenaltiesEnum);
+-	InputUpdateFromConstantx(femmodel,false,ConvergedEnum);
+-	femmodel->UpdateConstraintsx();
+-
+-	for(;;){
+-
+-		delete Df_old; Df_old=Df;
+-		SystemMatricesx(&Kff, &Kfs, &pf,&df, NULL,femmodel);
+-		CreateNodalConstraintsx(&ys,femmodel->nodes,configuration_type);
+-		Reduceloadx(pf, Kfs, ys); delete Kfs;
+-		Solverx(&Df, Kff, pf,Df_old, df, femmodel->parameters);
+-		delete Kff;delete pf;delete Dg; delete df;
+-		Mergesolutionfromftogx(&Dg, Df,ys,femmodel->nodes,femmodel->parameters); delete ys;
+-		InputUpdateFromSolutionx(femmodel,Dg);
+-
+-		ConstraintsStatex(&constraints_converged,&num_unstable_constraints,femmodel);
+-
+-		if (!converged){
+-			if(VerboseConvergence()) _printf0_("   #unstable constraints = " << num_unstable_constraints << "\n");
+-			if (num_unstable_constraints <= damage_penalty_threshold)converged=true;
+-			if (count>=damage_maxiter){
+-				converged=true;
+-				_printf0_("   maximum number of iterations (" << damage_maxiter << ") exceeded\n"); 
+-			}
+-		}
+-		count++;
+-
+-		InputUpdateFromConstantx(femmodel,converged,ConvergedEnum);
+-
+-		if(converged)break;
+-	}
+-
+-	InputUpdateFromSolutionx(femmodel,Dg);
+-
+-	/*Free ressources: */
+-	delete Dg;
+-	delete Df;
+-	delete Df_old;
+-}
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequences.h
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequences.h	(revision 17515)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequences.h	(revision 17516)
+@@ -12,7 +12,6 @@
+ #include "../shared/Numerics/types.h"
+ 
+ void solutionsequence_thermal_nonlinear(FemModel* femmodel);
+-void solutionsequence_damage_nonlinear(FemModel* femmodel);
+ void solutionsequence_hydro_nonlinear(FemModel* femmodel);
+ void solutionsequence_nonlinear(FemModel* femmodel,bool conserve_loads);
+ void solutionsequence_newton(FemModel* femmodel);
+Index: ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 17515)
++++ ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 17516)
+@@ -242,9 +242,6 @@
+ 		case HydrologyDCInefficientAnalysisEnum:
+ 			Ke=PenaltyCreateKMatrixHydrologyDCInefficient(kmax);
+ 			break;
+-		case DamageEvolutionAnalysisEnum:
+-			Ke=PenaltyCreateKMatrixDamageEvolution(kmax);
+-			break;
+ 		default:
+ 			_error_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet");
+ 	}
+@@ -276,9 +273,6 @@
+ 		case HydrologyDCInefficientAnalysisEnum:
+ 			pe=PenaltyCreatePVectorHydrologyDCInefficient(kmax);
+ 			break;
+-		case DamageEvolutionAnalysisEnum:
+-			pe=PenaltyCreatePVectorDamageEvolution(kmax);
+-			break;
+ 		default:
+ 			_error_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet");
+ 	}
+@@ -416,11 +410,6 @@
+ 		ConstraintActivateHydrologyDCInefficient(punstable);
+ 		return;
+ 	}
+-	else if (analysis_type==DamageEvolutionAnalysisEnum){
+-		ConstraintActivateDamageEvolution(punstable);
+-		return;
+-	}
+-
+ 	else{
+ 		_error_("analysis: " << EnumToStringx(analysis_type) << " not supported yet");
+ 	}
+@@ -709,104 +698,6 @@
+ 	return pe;
+ }
+ /*}}}*/
+-/*FUNCTION Pengrid::ConstraintActivateDamageEvolution {{{*/
+-void  Pengrid::ConstraintActivateDamageEvolution(int* punstable){
+-
+-	//   The penalty is stable if it doesn't change during to successive iterations.   
+-	IssmDouble max_damage;
+-	IssmDouble damage;
+-	int        new_active;
+-	int        unstable=0;
+-	int        penalty_lock;
+-
+-	/*check that pengrid is not a clone (penalty to be added only once)*/
+-	if (node->IsClone()){
+-		unstable=0;
+-		*punstable=unstable;
+-		return;
+-	}
+-
+-	//First recover damage  using the element: */
+-	element->GetInputValue(&damage,node,DamageDEnum);
+-
+-	//Recover our data:
+-	parameters->FindParam(&penalty_lock,DamagePenaltyLockEnum);
+-	parameters->FindParam(&max_damage,DamageMaxDamageEnum);
+-	
+-	//Figure out if damage>max_damage, in which case, this penalty needs to be activated.
+-	//Would need to do the same for damage<0 if penalties are used.  For now, ConstraintStatex 
+-	//is not called in solutionsequence_damage_nonlinear, so no penalties are applied.
+-
+-	if (damage>max_damage){
+-		new_active=1;
+-	}
+-	else{
+-		new_active=0;
+-	}
+-
+-	//Figure out stability of this penalty
+-	if (active==new_active){
+-		unstable=0;
+-	}
+-	else{
+-		unstable=1;
+-		if(penalty_lock)zigzag_counter++;
+-	}
+-
+-	/*If penalty keeps zigzagging more than penalty_lock times: */
+-	if(penalty_lock){
+-		if(zigzag_counter>penalty_lock){
+-			unstable=0;
+-			active=1;
+-		}
+-	}
+-
+-	//Set penalty flag
+-	active=new_active;
+-
+-	//*Assign output pointers:*/
+-	*punstable=unstable;
+-}
+-/*}}}*/
+-/*FUNCTION Pengrid::PenaltyCreateKMatrixDamageEvolution {{{*/
+-ElementMatrix* Pengrid::PenaltyCreateKMatrixDamageEvolution(IssmDouble kmax){
+-
+-	IssmDouble    penalty_factor;
+-
+-	/*Initialize Element matrix and return if necessary*/
+-	if(!this->active) return NULL;
+-	ElementMatrix* Ke=new ElementMatrix(&node,NUMVERTICES,this->parameters);
+-
+-	/*recover parameters: */
+-	parameters->FindParam(&penalty_factor,DamagePenaltyFactorEnum);
+-
+-	Ke->values[0]=kmax*pow(10.,penalty_factor);
+-
+-	/*Clean up and return*/
+-	return Ke;
+-}
+-/*}}}*/
+-/*FUNCTION Pengrid::PenaltyCreatePVectorDamageEvolution {{{*/
+-ElementVector* Pengrid::PenaltyCreatePVectorDamageEvolution(IssmDouble kmax){
+-
+-	IssmDouble penalty_factor;
+-	IssmDouble max_damage;
+-
+-	/*Initialize Element matrix and return if necessary*/
+-	if(!this->active) return NULL;
+-	ElementVector* pe=new ElementVector(&node,1,this->parameters);
+-
+-	//Recover our data:
+-	parameters->FindParam(&penalty_factor,DamagePenaltyFactorEnum);
+-	parameters->FindParam(&max_damage,DamageMaxDamageEnum);
+-
+-	//right hand side penalizes to max_damage
+-	pe->values[0]=kmax*pow(10.,penalty_factor)*max_damage;
+-
+-	/*Clean up and return*/
+-	return pe;
+-}
+-/*}}}*/
+ /*FUNCTION Pengrid::CreatePVectorHydrologyDCInefficient {{{*/
+ ElementVector* Pengrid::CreatePVectorHydrologyDCInefficient(void){
+ 
+Index: ../trunk-jpl/src/c/classes/Loads/Pengrid.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Pengrid.h	(revision 17515)
++++ ../trunk-jpl/src/c/classes/Loads/Pengrid.h	(revision 17516)
+@@ -86,9 +86,6 @@
+ 		ElementVector* PenaltyCreatePVectorThermal(IssmDouble kmax);
+ 		ElementVector* PenaltyCreatePVectorMelting(IssmDouble kmax);
+ 		void           ConstraintActivateThermal(int* punstable);
+-		ElementMatrix* PenaltyCreateKMatrixDamageEvolution(IssmDouble kmax);
+-		ElementVector* PenaltyCreatePVectorDamageEvolution(IssmDouble kmax);
+-		void           ConstraintActivateDamageEvolution(int* punstable);
+ 		ElementMatrix* PenaltyCreateKMatrixHydrologyDCInefficient(IssmDouble kmax);
+ 		ElementVector* PenaltyCreatePVectorHydrologyDCInefficient(IssmDouble kmax);
+ 		void           ConstraintActivateHydrologyDCInefficient(int* punstable);
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17515)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17516)
+@@ -37,6 +37,8 @@
+ class Element: public Object,public Update{
+ 
+ 	public:
++		int          id;
++		int          sid;
+ 		Inputs      *inputs;
+ 		Node       **nodes;
+ 		Vertex     **vertices;
+@@ -54,8 +56,14 @@
+ 		/* bool       AllActive(void); */
+ 		/* bool       AnyActive(void); */
+ 		void       CoordinateSystemTransform(IssmDouble** ptransform,Node** nodes,int numnodes,int* cs_array);
++		void       Echo();
++		void       DeepEcho();
+ 		void       DeleteMaterials(void);
+ 		IssmDouble Divergence(void);
++		void       ThermalToEnthalpy(IssmDouble* penthalpy,IssmDouble temperature,IssmDouble waterfraction,IssmDouble pressure);
++		void       EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure);
++		IssmDouble EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure);
++		IssmDouble EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure);
+ 		void       FindParam(bool* pvalue,int paramenum);
+ 		void       FindParam(int* pvalue,int paramenum);
+ 		void       FindParam(IssmDouble* pvalue,int paramenum);
+@@ -80,19 +88,26 @@
+ 		void       GetVerticesCoordinates(IssmDouble** xyz_list);
+ 		void       GetVerticesSidList(int* sidlist);
+ 		void       GetVerticesConnectivityList(int* connectivitylist);
++		bool       HasNodeOnBed();
++		bool       HasNodeOnSurface();
++		int        Id();
++		int        Sid();
+ 		void       InputChangeName(int enum_type,int enum_type_old);
+ 		void       InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);
+ 		void       InputUpdateFromConstant(IssmDouble constant, int name);
+ 		void       InputUpdateFromConstant(int constant, int name);
+ 		void       InputUpdateFromConstant(bool constant, int name);
++		bool       IsIceInElement();
+ 		bool	     IsInput(int name);
+ 		bool       IsFloating(); 
+ 		ElementVector*  NewElementVector(int approximation_enum=NoneApproximationEnum);
+ 		ElementMatrix*  NewElementMatrix(int approximation_enum=NoneApproximationEnum);
+ 		ElementMatrix*  NewElementMatrixCoupling(int number_nodes,int approximation_enum=NoneApproximationEnum);
++		IssmDouble PureIceEnthalpy(IssmDouble pressure);
+ 		void       ResultInterpolation(int* pinterpolation,int*nodesperelement,int output_enum);
+ 		void       ResultToVector(Vector<IssmDouble>* vector,int output_enum);
+ 		void       ResultToPatch(IssmDouble* values,int nodesperelement,int output_enum);
++		void       SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum);
+ 		void       StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+ 		void       StrainRateSSA1d(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input);
+ 		void       StrainRateHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+@@ -134,12 +149,8 @@
+ 		virtual IssmDouble CharacteristicLength(void)=0;
+ 		virtual void       Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters)=0;
+ 		virtual void       SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters)=0;
+-		virtual void       SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum)=0;
+ 		virtual void   ElementSizes(IssmDouble* phx,IssmDouble* phy,IssmDouble* phz)=0;
+-		virtual void   ThermalToEnthalpy(IssmDouble* penthalpy,IssmDouble temperature,IssmDouble waterfraction,IssmDouble pressure)=0;
+-		virtual void   EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure)=0;
+-		virtual IssmDouble EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure)=0;
+-		virtual IssmDouble EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure)=0;
++
+ 		virtual int    FiniteElement(void)=0;
+ 		virtual IssmDouble MinEdgeLength(IssmDouble* xyz_list)=0;
+ 		virtual void   NodalFunctions(IssmDouble* basis,Gauss* gauss)=0;
+@@ -153,7 +164,6 @@
+ 		virtual void   NormalSection(IssmDouble* normal,IssmDouble* xyz_list)=0;
+ 		virtual void   NormalTop(IssmDouble* normal,IssmDouble* xyz_list)=0;
+ 		virtual void   NormalBase(IssmDouble* normal,IssmDouble* xyz_list)=0;
+-		virtual IssmDouble PureIceEnthalpy(IssmDouble pressure)=0;
+ 
+ 		virtual Element* GetUpperElement(void)=0;
+ 		virtual Element* GetLowerElement(void)=0;
+@@ -168,16 +178,11 @@
+ 		virtual void   GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int solutionenum)=0;
+ 		virtual int    GetNodeIndex(Node* node)=0;
+ 		virtual int    GetNumberOfNodes(void)=0;
+-		virtual int    GetNumberOfNodesVelocity(void)=0;
+-		virtual int    GetNumberOfNodesPressure(void)=0;
+ 		virtual int    GetNumberOfVertices(void)=0;
+ 
+-		virtual int    Id()=0;
+-		virtual int    Sid()=0;
+ 		virtual bool   IsNodeOnShelfFromFlags(IssmDouble* flags)=0; 
+ 		virtual bool   IsOnBed()=0;
+ 		virtual bool   IsOnSurface()=0;
+-		virtual bool   IsIceInElement()=0;
+ 		virtual void   GetGroundedPart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* mainlyfloating)=0;
+ 		virtual IssmDouble GetGroundedPortion(IssmDouble* xyz_list)=0;
+ 		virtual void   GetInputValue(IssmDouble* pvalue,Node* node,int enumtype)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17515)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17516)
+@@ -94,64 +94,6 @@
+ /*}}}*/
+ 
+ /*Other*/
+-/*FUNCTION Tria::SetwiseNodeConnectivity{{{*/
+-void Tria::SetwiseNodeConnectivity(int* pd_nz,int* po_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum){
+-
+-	/*Intermediaries*/
+-	const int numnodes = this->NumberofNodes();
+-
+-	/*Output */
+-	int d_nz = 0;
+-	int o_nz = 0;
+-
+-	/*Loop over all nodes*/
+-	for(int i=0;i<numnodes;i++){
+-
+-		if(!flags[this->nodes[i]->Lid()]){
+-
+-			/*flag current node so that no other element processes it*/
+-			flags[this->nodes[i]->Lid()]=true;
+-
+-			int counter=0;
+-			while(flagsindices[counter]>=0) counter++;
+-			flagsindices[counter]=this->nodes[i]->Lid();
+-
+-			/*if node is clone, we have an off-diagonal non-zero, else it is a diagonal non-zero*/
+-			switch(set2_enum){
+-				case FsetEnum:
+-					if(nodes[i]->indexing.fsize){
+-						if(this->nodes[i]->IsClone())
+-						 o_nz += 1;
+-						else
+-						 d_nz += 1;
+-					}
+-					break;
+-				case GsetEnum:
+-					if(nodes[i]->indexing.gsize){
+-						if(this->nodes[i]->IsClone())
+-						 o_nz += 1;
+-						else
+-						 d_nz += 1;
+-					}
+-					break;
+-				case SsetEnum:
+-					if(nodes[i]->indexing.ssize){
+-						if(this->nodes[i]->IsClone())
+-						 o_nz += 1;
+-						else
+-						 d_nz += 1;
+-					}
+-					break;
+-				default: _error_("not supported");
+-			}
+-		}
+-	}
+-
+-	/*Assign output pointers: */
+-	*pd_nz=d_nz;
+-	*po_nz=o_nz;
+-}
+-/*}}}*/
+ /*FUNCTION Tria::AddBasalInput{{{*/
+ void  Tria::AddBasalInput(int input_enum,IssmDouble* values, int interpolation_enum){
+ 
+@@ -291,35 +233,6 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::DeepEcho{{{*/
+-void Tria::DeepEcho(void){
+-
+-	_printf_("Tria:\n");
+-	_printf_("   id: " << id << "\n");
+-	if(nodes){
+-		nodes[0]->DeepEcho();
+-		nodes[1]->DeepEcho();
+-		nodes[2]->DeepEcho();
+-	}
+-	else _printf_("nodes = NULL\n");
+-
+-	if (material) material->DeepEcho();
+-	else _printf_("material = NULL\n");
+-
+-	if (matpar) matpar->DeepEcho();
+-	else _printf_("matpar = NULL\n");
+-
+-	_printf_("   parameters\n");
+-	if (parameters) parameters->DeepEcho();
+-	else _printf_("parameters = NULL\n");
+-
+-	_printf_("   inputs\n");
+-	if (inputs) inputs->DeepEcho();
+-	else _printf_("inputs=NULL\n");
+-
+-	return;
+-}
+-/*}}}*/
+ /*FUNCTION Tria::Delta18oParameterization{{{*/
+ void  Tria::Delta18oParameterization(void){
+ 
+@@ -415,32 +328,6 @@
+ 	*hz=0.;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::Echo{{{*/
+-void Tria::Echo(void){
+-	_printf_("Tria:\n");
+-	_printf_("   id: " << id << "\n");
+-	if(nodes){
+-		nodes[0]->Echo();
+-		nodes[1]->Echo();
+-		nodes[2]->Echo();
+-	}
+-	else _printf_("nodes = NULL\n");
+-
+-	if (material) material->Echo();
+-	else _printf_("material = NULL\n");
+-
+-	if (matpar) matpar->Echo();
+-	else _printf_("matpar = NULL\n");
+-
+-	_printf_("   parameters\n");
+-	if (parameters) parameters->Echo();
+-	else _printf_("parameters = NULL\n");
+-
+-	_printf_("   inputs\n");
+-	if (inputs) inputs->Echo();
+-	else _printf_("inputs=NULL\n");
+-}
+-/*}}}*/
+ /*FUNCTION Tria::FiniteElement{{{*/
+ int Tria::FiniteElement(void){
+ 	return this->element_type;
+@@ -921,16 +808,6 @@
+ 	return this->NumberofNodes();
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetNumberOfNodesPressure;{{{*/
+-int Tria::GetNumberOfNodesPressure(void){
+-	return this->NumberofNodesPressure();
+-}
+-/*}}}*/
+-/*FUNCTION Tria::GetNumberOfNodesVelocity;{{{*/
+-int Tria::GetNumberOfNodesVelocity(void){
+-	return this->NumberofNodesVelocity();
+-}
+-/*}}}*/
+ /*FUNCTION Tria::GetNumberOfVertices;{{{*/
+ int Tria::GetNumberOfVertices(void){
+ 	return NUMVERTICES;
+@@ -1009,20 +886,6 @@
+ 	return y;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::Id {{{*/
+-int    Tria::Id(){
+-
+-	return id;
+-
+-}
+-/*}}}*/
+-/*FUNCTION Tria::Sid {{{*/
+-int    Tria::Sid(){
+-
+-	return sid;
+-
+-}
+-/*}}}*/
+ /*FUNCTION Tria::InputDepthAverageAtBase {{{*/
+ void  Tria::InputDepthAverageAtBase(int enum_type,int average_enum_type){
+ 
+@@ -1350,19 +1213,6 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Tria::HasNodeOnBed {{{*/
+-bool Tria::HasNodeOnBed(){
+-
+-	IssmDouble values[NUMVERTICES];
+-	IssmDouble sum;
+-
+-	/*Retrieve all inputs and parameters*/
+-	GetInputListOnVertices(&values[0],MeshVertexonbedEnum);
+-	sum = values[0]+values[1]+values[2];
+-
+-	return sum>0.;
+-}
+-/*}}}*/
+ /*FUNCTION Tria::HasEdgeOnSurface {{{*/
+ bool Tria::HasEdgeOnSurface(){
+ 
+@@ -1385,19 +1235,6 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Tria::HasNodeOnSurface {{{*/
+-bool Tria::HasNodeOnSurface(){
+-
+-	IssmDouble values[NUMVERTICES];
+-	IssmDouble sum;
+-
+-	/*Retrieve all inputs and parameters*/
+-	GetInputListOnVertices(&values[0],MeshVertexonbedEnum);
+-	sum = values[0]+values[1]+values[2];
+-
+-	return sum>0.;
+-}
+-/*}}}*/
+ /*FUNCTION Tria::EdgeOnBedIndices{{{*/
+ void Tria::EdgeOnBedIndices(int* pindex1,int* pindex2){
+ 
+@@ -1541,20 +1378,6 @@
+ 	return new GaussTria(indices[0],indices[1],order);
+ }
+ /*}}}*/
+-/*FUNCTION Tria::IsIceInElement {{{*/
+-bool   Tria::IsIceInElement(){
+-
+-	/*Get levelset*/
+-	IssmDouble ls[NUMVERTICES];
+-	GetInputListOnVertices(&ls[0],MaskIceLevelsetEnum);
+-
+-	/*If the level set on one of the nodes is <0, ice is present in this element*/
+-	if(ls[0]<0. || ls[1]<0. || ls[2]<0.) 
+-		return true;
+-	else
+-		return false;
+-}
+-/*}}}*/
+ /*FUNCTION Tria::NodalFunctions{{{*/
+ void Tria::NodalFunctions(IssmDouble* basis, Gauss* gauss){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17515)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17516)
+@@ -31,18 +31,12 @@
+ 
+ 	public:
+ 
+-		int id;
+-		int sid;
+-
+ 		/*Tria constructors, destructors {{{*/
+ 		Tria(){};
+ 		Tria(int tria_id,int tria_sid,int i, IoModel* iomodel,int nummodels);
+ 		~Tria();
+ 		/*}}}*/
+ 		/*Object virtual functions definitions:{{{ */
+-		void    Echo();
+-		void    DeepEcho();
+-		int     Id();
+ 		int     ObjectEnum();
+ 		Object *copy();
+ 		/*}}}*/
+@@ -62,11 +56,8 @@
+ 		void        ComputeSurfaceNormalVelocity();
+ 		void        Configure(Elements* elements,Loads* loads,Nodes* nodesin,Vertices* verticesin,Materials* materials,Parameters* parameters);
+ 		void        SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters);
+-		void        SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum);
+ 		void        Delta18oParameterization(void);
+ 		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz);
+-		void        ThermalToEnthalpy(IssmDouble* penthalpy,IssmDouble temperature,IssmDouble waterfraction,IssmDouble pressure){_error_("not implemented yet");};
+-		void        EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented yet");};
+ 		int         FiniteElement(void);
+ 		Element*    GetUpperElement(void){_error_("not implemented yet");};
+ 	  	Element*    GetLowerElement(void){_error_("not implemented yet");};
+@@ -76,16 +67,11 @@
+ 		IssmDouble  GetGroundedPortion(IssmDouble* xyz_list);
+ 		int         GetNodeIndex(Node* node);
+ 		int         GetNumberOfNodes(void);
+-		int         GetNumberOfNodesPressure(void);
+-		int         GetNumberOfNodesVelocity(void);
+ 		int         GetNumberOfVertices(void);
+-		int         Sid();
+ 		bool        IsOnBed();
+ 		bool        IsOnSurface();
+ 		bool        HasEdgeOnBed();
+-		bool        HasNodeOnBed();
+ 		bool        HasEdgeOnSurface();
+-		bool        HasNodeOnSurface();
+ 		void        EdgeOnSurfaceIndices(int* pindex1,int* pindex);
+ 		void        EdgeOnBedIndices(int* pindex1,int* pindex);
+ 		int         EdgeOnBedIndex();
+@@ -93,7 +79,6 @@
+ 		bool        IsNodeOnShelfFromFlags(IssmDouble* flags);
+ 		int         NumberofNodesVelocity(void);
+ 		int         NumberofNodesPressure(void);
+-		bool        IsIceInElement();
+ 		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
+ 		void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum);
+ 		void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list);
+@@ -110,7 +95,6 @@
+ 	   Element*    SpawnBasalElement(void);
+ 		Element*    SpawnTopElement(void);
+ 		int         VelocityInterpolation();
+-		IssmDouble  PureIceEnthalpy(IssmDouble pressure){_error_("not implemented yet");};
+ 		int         PressureInterpolation();
+ 		IssmDouble  SurfaceArea(void);
+ 		void        Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement);
+@@ -191,8 +175,6 @@
+ 		/*Tria specific routines:{{{*/
+ 		void           AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		void           AddInput(int input_enum, IssmDouble* values, int interpolation_enum);
+-		IssmDouble     EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented");};
+-		IssmDouble     EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure){_error_("not implemented");};
+ 		IssmDouble     GetArea(void);
+ 		void           GetAreaCoordinates(IssmDouble *area_coordinates,IssmDouble* xyz_zero,IssmDouble* xyz_list,int numpoints);
+ 		int            GetElementType(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17515)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17516)
+@@ -370,26 +370,6 @@
+ 	this->inputs->Configure(parameters);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::DeepEcho{{{*/
+-void Penta::DeepEcho(void){
+-
+-	_printf_("Penta:\n");
+-	_printf_("   id: " << id << "\n");
+-	nodes[0]->DeepEcho();
+-	nodes[1]->DeepEcho();
+-	nodes[2]->DeepEcho();
+-	nodes[3]->DeepEcho();
+-	nodes[4]->DeepEcho();
+-	nodes[5]->DeepEcho();
+-	material->DeepEcho();
+-	matpar->DeepEcho();
+-	_printf_("   neighbor ids: " << verticalneighbors[0]->Id() << "-" << verticalneighbors[1]->Id() << "\n");
+-	_printf_("   parameters\n");
+-	parameters->DeepEcho();
+-	_printf_("   inputs\n");
+-	inputs->DeepEcho();
+-}
+-/*}}}*/
+ /*FUNCTION Penta::Delta18oParameterization{{{*/
+ void  Penta::Delta18oParameterization(void){
+         /*Are we on the base? If not, return*/
+@@ -464,32 +444,6 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::Echo{{{*/
+-
+-void Penta::Echo(void){
+-	this->DeepEcho();
+-}
+-/*}}}*/
+-/*FUNCTION Penta::ThermalToEnthalpy{{{*/
+-void Penta::ThermalToEnthalpy(IssmDouble* penthalpy,IssmDouble temperature,IssmDouble waterfraction,IssmDouble pressure){
+-	matpar->ThermalToEnthalpy(penthalpy,temperature,waterfraction,pressure);
+-}
+-/*}}}*/
+-/*FUNCTION Penta::EnthalpyToThermal{{{*/
+-void Penta::EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){
+-	matpar->EnthalpyToThermal(ptemperature,pwaterfraction,enthalpy,pressure);
+-}
+-/*}}}*/
+-/*FUNCTION Penta::EnthalpyDiffusionParameter{{{*/
+-IssmDouble Penta::EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure){
+-	return matpar->GetEnthalpyDiffusionParameter(enthalpy,pressure);
+-}
+-/*}}}*/
+-/*FUNCTION Penta::EnthalpyDiffusionParameterVolume{{{*/
+-IssmDouble Penta::EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure){
+-	return matpar->GetEnthalpyDiffusionParameterVolume(numvertices,enthalpy,pressure);
+-}
+-/*}}}*/
+ /*FUNCTION Penta::FiniteElement{{{*/
+ int Penta::FiniteElement(void){
+ 	return this->element_type;
+@@ -847,16 +801,6 @@
+ 	return this->NumberofNodes();
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetNumberOfNodesPressure;{{{*/
+-int Penta::GetNumberOfNodesPressure(void){
+-	return this->NumberofNodesPressure();
+-}
+-/*}}}*/
+-/*FUNCTION Penta::GetNumberOfNodesVelocity;{{{*/
+-int Penta::GetNumberOfNodesVelocity(void){
+-	return this->NumberofNodesVelocity();
+-}
+-/*}}}*/
+ /*FUNCTION Penta::GetNumberOfVertices;{{{*/
+ int Penta::GetNumberOfVertices(void){
+ 	return NUMVERTICES; 
+@@ -1161,18 +1105,6 @@
+ 	*pxyz_zero= xyz_zero;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::Sid {{{*/
+-int    Penta::Sid(){
+-
+-	return sid;
+-
+-}
+-/*}}}*/
+-/*FUNCTION Penta::Id {{{*/
+-int    Penta::Id(void){
+-	return id; 
+-}
+-/*}}}*/
+ /*FUNCTION Penta::InputDepthAverageAtBase{{{*/
+ void  Penta::InputDepthAverageAtBase(int enum_type,int average_enum_type){
+ 
+@@ -1642,20 +1574,6 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::IsIceInElement {{{*/
+-bool   Penta::IsIceInElement(){
+-
+-	/*Get levelset*/
+-	IssmDouble ls[NUMVERTICES];
+-	GetInputListOnVertices(&ls[0],MaskIceLevelsetEnum);
+-
+-	/*If the level set one one of the nodes is <0, ice is present in this element*/
+-	if(ls[0]<0. || ls[1]<0. || ls[2]<0.) 
+-		return true;
+-	else
+-		return false;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::MinEdgeLength{{{*/
+ IssmDouble Penta::MinEdgeLength(IssmDouble* xyz_list){
+ 	/*Return the minimum lenght of the nine egdes of the penta*/
+@@ -1812,12 +1730,11 @@
+ /*FUNCTION Penta::NormalBase {{{*/
+ void Penta::NormalBase(IssmDouble* bed_normal,IssmDouble* xyz_list){
+ 
+-	int i;
+ 	IssmDouble v13[3],v23[3];
+ 	IssmDouble normal[3];
+ 	IssmDouble normal_norm;
+ 
+-	for (i=0;i<3;i++){
++	for(int i=0;i<3;i++){
+ 		v13[i]=xyz_list[0*3+i]-xyz_list[2*3+i];
+ 		v23[i]=xyz_list[1*3+i]-xyz_list[2*3+i];
+ 	}
+@@ -1825,7 +1742,7 @@
+ 	normal[0]=v13[1]*v23[2]-v13[2]*v23[1];
+ 	normal[1]=v13[2]*v23[0]-v13[0]*v23[2];
+ 	normal[2]=v13[0]*v23[1]-v13[1]*v23[0];
+-	normal_norm=sqrt( pow(normal[0],2)+pow(normal[1],2)+pow(normal[2],2) );
++	normal_norm=sqrt(normal[0]*normal[0]+ normal[1]*normal[1]+ normal[2]*normal[2]);
+ 
+ 	/*Bed normal is opposite to surface normal*/
+ 	bed_normal[0]=-normal[0]/normal_norm;
+@@ -1918,12 +1835,6 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::PureIceEnthalpy{{{*/
+-IssmDouble Penta::PureIceEnthalpy(IssmDouble pressure){
+-
+-	return this->matpar->PureIceEnthalpy(pressure);
+-}
+-/*}}}*/
+ /*FUNCTION Penta::ReduceMatrices{{{*/
+ void Penta::ReduceMatrices(ElementMatrix* Ke,ElementVector* pe){
+ 
+@@ -2071,77 +1982,6 @@
+ 	this->element_type=element_type_in;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::SetwiseNodeConnectivity{{{*/
+-void Penta::SetwiseNodeConnectivity(int* pd_nz,int* po_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum){
+-
+-	/*Intermediaries*/
+-	const int numnodes = this->NumberofNodes();
+-
+-	/*Output */
+-	int d_nz = 0;
+-	int o_nz = 0;
+-
+-	/*Loop over all nodes*/
+-	for(int i=0;i<numnodes;i++){
+-
+-		if(!flags[this->nodes[i]->Lid()]){
+-
+-			/*flag current node so that no other element processes it*/
+-			flags[this->nodes[i]->Lid()]=true;
+-
+-			int counter=0;
+-			while(flagsindices[counter]>=0) counter++;
+-			flagsindices[counter]=this->nodes[i]->Lid();
+-
+-			/*if node is clone, we have an off-diagonal non-zero, else it is a diagonal non-zero*/
+-			switch(set2_enum){
+-				case FsetEnum:
+-					if(nodes[i]->indexing.fsize){
+-						if(this->nodes[i]->IsClone())
+-						 o_nz += 1;
+-						else
+-						 d_nz += 1;
+-					}
+-					break;
+-				case GsetEnum:
+-					if(nodes[i]->indexing.gsize){
+-						if(this->nodes[i]->IsClone())
+-						 o_nz += 1;
+-						else
+-						 d_nz += 1;
+-					}
+-					break;
+-				case SsetEnum:
+-					if(nodes[i]->indexing.ssize){
+-						if(this->nodes[i]->IsClone())
+-						 o_nz += 1;
+-						else
+-						 d_nz += 1;
+-					}
+-					break;
+-				default: _error_("not supported");
+-			}
+-		}
+-	}
+-
+-	/*Special case: 2d/3d coupling, the node of this element might be connected
+-	 *to the basal element*/
+-	int analysis_type,approximation,numlayers;
+-	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-	if(analysis_type==StressbalanceAnalysisEnum){
+-		inputs->GetInputValue(&approximation,ApproximationEnum);
+-		if(approximation==SSAHOApproximationEnum || approximation==SSAFSApproximationEnum){
+-			parameters->FindParam(&numlayers,MeshNumberoflayersEnum);
+-			o_nz += numlayers*3;
+-			d_nz += numlayers*3;
+-		}
+-	}
+-
+-	/*Assign output pointers: */
+-	*pd_nz=d_nz;
+-	*po_nz=o_nz;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::SpawnTria {{{*/
+ Tria*  Penta::SpawnTria(int index1,int index2,int index3){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17515)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17516)
+@@ -31,9 +31,6 @@
+ 
+ 	public:
+ 
+-		int id;
+-		int sid;
+-
+ 		Penta      **verticalneighbors;           // 2 neighbors: first one under, second one above
+ 
+ 		/*Penta constructors and destructor: {{{*/
+@@ -43,10 +40,7 @@
+ 		/*}}}*/
+ 		/*Object virtual functions definitions: {{{*/
+ 		Object *copy();
+-		void    DeepEcho();
+-		void    Echo();
+ 		int     ObjectEnum();
+-		int     Id();
+ 		/*}}}*/
+ 		/*Update virtual functions definitions: {{{*/
+ 		void  InputUpdateFromVector(IssmDouble* vector, int name, int type);
+@@ -66,10 +60,7 @@
+ 		void   ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz);
+ 		int    FiniteElement(void);
+ 		void   SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters);
+-		void   SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum);
+ 		void   Delta18oParameterization(void);
+-		void   ThermalToEnthalpy(IssmDouble* penthalpy,IssmDouble temperature,IssmDouble waterfraction,IssmDouble pressure);
+-		void   EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure);
+ 		Penta* GetUpperPenta(void);
+ 		Penta* GetLowerPenta(void);
+ 		Penta* GetSurfacePenta(void);
+@@ -82,8 +73,6 @@
+ 		IssmDouble GetGroundedPortion(IssmDouble* xyz_list);
+ 		int    GetNodeIndex(Node* node);
+ 		int    GetNumberOfNodes(void);
+-		int    GetNumberOfNodesPressure(void);
+-		int    GetNumberOfNodesVelocity(void);
+ 		int    GetNumberOfVertices(void);
+ 		void   GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
+ 		IssmDouble GetXcoord(Gauss* gauss);
+@@ -93,14 +82,12 @@
+ 		void   GetVerticesCoordinatesBase(IssmDouble** pxyz_list);
+ 		void   GetVerticesCoordinatesTop(IssmDouble** pxyz_list);
+ 
+-		int    Sid();
+ 		void   InputDepthAverageAtBase(int enum_type,int average_enum_type);
+ 		void   InputDuplicate(int original_enum,int new_enum);
+ 		void   InputScale(int enum_type,IssmDouble scale_factor);
+ 		int    NumberofNodesVelocity(void);
+ 		int    NumberofNodesPressure(void);
+ 		int    VelocityInterpolation();
+-		IssmDouble PureIceEnthalpy(IssmDouble pressure);
+ 		int    PressureInterpolation();
+ 		bool   IsZeroLevelset(int levelset_enum);
+ 		bool   IsIcefront(void);
+@@ -188,8 +175,6 @@
+ 		void           NormalSection(IssmDouble* normal,IssmDouble* xyz_list);
+ 		void	         NormalTop(IssmDouble* bed_normal, IssmDouble* xyz_list);
+ 		ElementMatrix* CreateBasalMassMatrix(void);
+-		IssmDouble     EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure);
+-		IssmDouble     EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure);
+ 		void           GetAreaCoordinates(IssmDouble *area_coordinates,IssmDouble* xyz_zero,IssmDouble* xyz_list,int numpoints);
+ 
+ 		void	         GetVertexPidList(int* doflist);
+@@ -207,7 +192,6 @@
+ 		void           JacobianDeterminantSurface(IssmDouble*  pJdet, IssmDouble* xyz_list,Gauss* gauss);
+ 		void           JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss);
+ 		void           JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss);
+-		bool           IsIceInElement(void); 
+ 		Gauss*         NewGauss(void);
+ 		Gauss*         NewGauss(int order);
+ 		Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 17515)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 17516)
+@@ -64,64 +64,11 @@
+ 	return sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
+ }
+ /*}}}*/
+-/*FUNCTION Seg::Echo{{{*/
+-void Seg::Echo(void){
+-	_printf_("Seg:\n");
+-	_printf_("   id: " << id << "\n");
+-	if(nodes){
+-		nodes[0]->Echo();
+-		nodes[1]->Echo();
+-	}
+-	else _printf_("nodes = NULL\n");
+-
+-	if (material) material->Echo();
+-	else _printf_("material = NULL\n");
+-
+-	if (matpar) matpar->Echo();
+-	else _printf_("matpar = NULL\n");
+-
+-	_printf_("   parameters\n");
+-	if (parameters) parameters->Echo();
+-	else _printf_("parameters = NULL\n");
+-
+-	_printf_("   inputs\n");
+-	if (inputs) inputs->Echo();
+-	else _printf_("inputs=NULL\n");
+-}
+-/*}}}*/
+ /*FUNCTION Seg::FiniteElement{{{*/
+ int Seg::FiniteElement(void){
+ 	return this->element_type;
+ }
+ /*}}}*/
+-/*FUNCTION Seg::DeepEcho{{{*/
+-void Seg::DeepEcho(void){
+-
+-	_printf_("Seg:\n");
+-	_printf_("   id: " << id << "\n");
+-	if(nodes){
+-		nodes[0]->DeepEcho();
+-		nodes[1]->DeepEcho();
+-	}
+-	else _printf_("nodes = NULL\n");
+-
+-	if (material) material->DeepEcho();
+-	else _printf_("material = NULL\n");
+-
+-	if (matpar) matpar->DeepEcho();
+-	else _printf_("matpar = NULL\n");
+-
+-	_printf_("   parameters\n");
+-	if (parameters) parameters->DeepEcho();
+-	else _printf_("parameters = NULL\n");
+-
+-	_printf_("   inputs\n");
+-	if (inputs) inputs->DeepEcho();
+-	else _printf_("inputs=NULL\n");
+-
+-	return;
+-}
+-/*}}}*/
+ /*FUNCTION Seg::ObjectEnum{{{*/
+ int Seg::ObjectEnum(void){
+ 
+@@ -129,14 +76,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Seg::Id {{{*/
+-int    Seg::Id(){
+ 
+-	return id;
+-
+-}
+-/*}}}*/
+-
+ void  Seg::GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){/*{{{*/
+ 	
+ 	/* Intermediaries */
+@@ -185,20 +125,6 @@
+ 	*pxyz_list = xyz_list;
+ 
+ }/*}}}*/
+-/*FUNCTION Seg::IsIceInElement {{{*/
+-bool   Seg::IsIceInElement(){
+-
+-	/*Get levelset*/
+-	IssmDouble ls[NUMVERTICES];
+-	GetInputListOnVertices(&ls[0],MaskIceLevelsetEnum);
+-
+-	/*If the level set on one of the nodes is <0, ice is present in this element*/
+-	if(ls[0]<0. || ls[1]<0.) 
+-	 return true;
+-	else
+-	 return false;
+-}
+-/*}}}*/
+ bool Seg::IsIcefront(void){/*{{{*/
+ 
+ 	bool isicefront;
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17515)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17516)
+@@ -51,80 +51,16 @@
+ }
+ /*}}}*/
+ 
+-/*FUNCTION Tetra::Echo{{{*/
+-void Tetra::Echo(void){
+-	_printf_("Tetra:\n");
+-	_printf_("   id: " << id << "\n");
+-	if(nodes){
+-		nodes[0]->Echo();
+-		nodes[1]->Echo();
+-		nodes[2]->Echo();
+-		nodes[3]->Echo();
+-	}
+-	else _printf_("nodes = NULL\n");
+-
+-	if (material) material->Echo();
+-	else _printf_("material = NULL\n");
+-
+-	if (matpar) matpar->Echo();
+-	else _printf_("matpar = NULL\n");
+-
+-	_printf_("   parameters\n");
+-	if (parameters) parameters->Echo();
+-	else _printf_("parameters = NULL\n");
+-
+-	_printf_("   inputs\n");
+-	if (inputs) inputs->Echo();
+-	else _printf_("inputs=NULL\n");
+-}
+-/*}}}*/
+ /*FUNCTION Tetra::FiniteElement{{{*/
+ int Tetra::FiniteElement(void){
+ 	return this->element_type;
+-}
+-/*}}}*/
+-/*FUNCTION Tetra::DeepEcho{{{*/
+-void Tetra::DeepEcho(void){
+-
+-	_printf_("Tetra:\n");
+-	_printf_("   id: " << id << "\n");
+-	if(nodes){
+-		nodes[0]->DeepEcho();
+-		nodes[1]->DeepEcho();
+-		nodes[2]->DeepEcho();
+-		nodes[3]->DeepEcho();
+-	}
+-	else _printf_("nodes = NULL\n");
+-
+-	if (material) material->DeepEcho();
+-	else _printf_("material = NULL\n");
+-
+-	if (matpar) matpar->DeepEcho();
+-	else _printf_("matpar = NULL\n");
+-
+-	_printf_("   parameters\n");
+-	if (parameters) parameters->DeepEcho();
+-	else _printf_("parameters = NULL\n");
+-
+-	_printf_("   inputs\n");
+-	if (inputs) inputs->DeepEcho();
+-	else _printf_("inputs=NULL\n");
+-
+-	return;
+-}
+-/*}}}*/
++} /*}}}*/
+ /*FUNCTION Tetra::ObjectEnum{{{*/
+ int Tetra::ObjectEnum(void){
+ 
+ 	return TetraEnum;
+ 
+-}
+-/*}}}*/
+-/*FUNCTION Tetra::Id {{{*/
+-int Tetra::Id(){
+-	return id;
+-}
+-/*}}}*/
++}/*}}}*/
+ 
+ /*FUNCTION Tetra::AddInput{{{*/
+ void  Tetra::AddInput(int input_enum,IssmDouble* values, int interpolation_enum){
+@@ -239,16 +175,6 @@
+ 	return NUMVERTICES;
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::GetNumberOfNodesPressure         THIS ONE (and corresponding TetraRef function){{{*/
+-int Tetra::GetNumberOfNodesPressure(void){
+-	return this->NumberofNodesPressure();
+-}
+-/*}}}*/
+-/*FUNCTION Tetra::GetNumberOfNodesVelocity;{{{*/
+-int Tetra::GetNumberOfNodesVelocity(void){
+-	return this->NumberofNodesVelocity();
+-}
+-/*}}}*/
+ /*FUNCTION Tetra::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){{{*/
+ void Tetra::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){
+ 
+@@ -340,19 +266,6 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::HasNodeOnBed           THIS ONE{{{*/
+-bool Tetra::HasNodeOnBed(){
+-
+-	IssmDouble values[NUMVERTICES];
+-	IssmDouble sum;
+-
+-	/*Retrieve all inputs and parameters*/
+-	GetInputListOnVertices(&values[0],MeshVertexonbedEnum);
+-	sum = values[0]+values[1]+values[2]+values[3];
+-
+-	return sum>0.;
+-}
+-/*}}}*/
+ /*FUNCTION Tetra::InputUpdateFromIoModel {{{*/
+ void Tetra::InputUpdateFromIoModel(int index,IoModel* iomodel){ 
+ 
+@@ -484,21 +397,6 @@
+ 	xDelete<int>(doflist);
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::IsIceInElement    THIS ONE{{{*/
+-bool   Tetra::IsIceInElement(){
+-
+-	/*Get levelset*/
+-	IssmDouble ls[NUMVERTICES];
+-	GetInputListOnVertices(&ls[0],MaskIceLevelsetEnum);
+-
+-	/*If the level set on one of the nodes is <0, ice is present in this element*/
+-	for(int i=0;i<NUMVERTICES;i++){
+-		if(ls[i]<0.) return true;
+-	}
+-
+-	return false;
+-}
+-/*}}}*/
+ /*FUNCTION Tetra::IsOnBed {{{*/
+ bool Tetra::IsOnBed(){
+ 	return HasFaceOnBed();
+@@ -650,6 +548,51 @@
+ 	for(int i=0;i<3;i++) normal[i]=normal[i]/norm;
+ }
+ /*}}}*/
++/*FUNCTION Tetra::NormalBase (THIS ONE){{{*/
++void Tetra::NormalBase(IssmDouble* bed_normal,IssmDouble* xyz_list){
++
++	IssmDouble v13[3],v23[3];
++	IssmDouble normal[3];
++	IssmDouble normal_norm;
++
++	for(int i=0;i<3;i++){
++		v13[i]=xyz_list[0*3+i]-xyz_list[2*3+i];
++		v23[i]=xyz_list[1*3+i]-xyz_list[2*3+i];
++	}
++
++	normal[0]=v13[1]*v23[2]-v13[2]*v23[1];
++	normal[1]=v13[2]*v23[0]-v13[0]*v23[2];
++	normal[2]=v13[0]*v23[1]-v13[1]*v23[0];
++	normal_norm=sqrt(normal[0]*normal[0]+ normal[1]*normal[1]+ normal[2]*normal[2]);
++
++	/*Bed normal is opposite to surface normal*/
++	bed_normal[0]=-normal[0]/normal_norm;
++	bed_normal[1]=-normal[1]/normal_norm;
++	bed_normal[2]=-normal[2]/normal_norm;
++}
++/*}}}*/
++/*FUNCTION Tetra::NormalTop (THIS ONE){{{*/
++void Tetra::NormalTop(IssmDouble* top_normal,IssmDouble* xyz_list){
++
++	IssmDouble v13[3],v23[3];
++	IssmDouble normal[3];
++	IssmDouble normal_norm;
++
++	for(int i=0;i<3;i++){
++		v13[i]=xyz_list[0*3+i]-xyz_list[2*3+i];
++		v23[i]=xyz_list[1*3+i]-xyz_list[2*3+i];
++	}
++
++	normal[0]=v13[1]*v23[2]-v13[2]*v23[1];
++	normal[1]=v13[2]*v23[0]-v13[0]*v23[2];
++	normal[2]=v13[0]*v23[1]-v13[1]*v23[0];
++	normal_norm=sqrt(normal[0]*normal[0]+ normal[1]*normal[1]+ normal[2]*normal[2]);
++
++	top_normal[0]=normal[0]/normal_norm;
++	top_normal[1]=normal[1]/normal_norm;
++	top_normal[2]=normal[2]/normal_norm;
++}
++/*}}}*/
+ /*FUNCTION Tetra::NumberofNodesPressure{{{*/
+ int Tetra::NumberofNodesPressure(void){
+ 	return TetraRef::NumberofNodesPressure();
+@@ -665,7 +608,8 @@
+ 
+ 	if(pe){
+ 		if(this->element_type==MINIcondensedEnum){
+-			_error_("Not implemented");
++			int indices[3]={12,13,14};
++			pe->StaticCondensation(Ke,3,&indices[0]);
+ 		}
+ 		else if(this->element_type==P1bubblecondensedEnum){
+ 			int size   = nodes[4]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
+@@ -680,7 +624,8 @@
+ 
+ 	if(Ke){
+ 		if(this->element_type==MINIcondensedEnum){
+-			_error_("Not implemented");
++			int indices[3]={12,13,14};
++			Ke->StaticCondensation(3,&indices[0]);
+ 		}
+ 		else if(this->element_type==P1bubblecondensedEnum){
+ 			int size   = nodes[4]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
+@@ -770,71 +715,6 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::SetwiseNodeConnectivity   THIS ONE (take from Penta.cpp){{{*/
+-void Tetra::SetwiseNodeConnectivity(int* pd_nz,int* po_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum){
+-
+-	/*Intermediaries*/
+-	const int numnodes = this->NumberofNodes();
+-
+-	/*Output */
+-	int d_nz = 0;
+-	int o_nz = 0;
+-
+-	/*Loop over all nodes*/
+-	for(int i=0;i<numnodes;i++){
+-
+-		if(!flags[this->nodes[i]->Lid()]){
+-
+-			/*flag current node so that no other element processes it*/
+-			flags[this->nodes[i]->Lid()]=true;
+-
+-			int counter=0;
+-			while(flagsindices[counter]>=0) counter++;
+-			flagsindices[counter]=this->nodes[i]->Lid();
+-
+-			/*if node is clone, we have an off-diagonal non-zero, else it is a diagonal non-zero*/
+-			switch(set2_enum){
+-				case FsetEnum:
+-					if(nodes[i]->indexing.fsize){
+-						if(this->nodes[i]->IsClone())
+-						 o_nz += 1;
+-						else
+-						 d_nz += 1;
+-					}
+-					break;
+-				case GsetEnum:
+-					if(nodes[i]->indexing.gsize){
+-						if(this->nodes[i]->IsClone())
+-						 o_nz += 1;
+-						else
+-						 d_nz += 1;
+-					}
+-					break;
+-				case SsetEnum:
+-					if(nodes[i]->indexing.ssize){
+-						if(this->nodes[i]->IsClone())
+-						 o_nz += 1;
+-						else
+-						 d_nz += 1;
+-					}
+-					break;
+-				default: _error_("not supported");
+-			}
+-		}
+-	}
+-
+-	/*Assign output pointers: */
+-	*pd_nz=d_nz;
+-	*po_nz=o_nz;
+-}
+-/*}}}*/
+-/*FUNCTION Tetra::Sid  THIS ONE{{{*/
+-int    Tetra::Sid(){
+-
+-	return sid;
+-
+-}
+-/*}}}*/
+ /*FUNCTION Tetra::SpawnBasalElement{{{*/
+ Element*  Tetra::SpawnBasalElement(void){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17515)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17516)
+@@ -29,18 +29,12 @@
+ 
+ 	public:
+ 
+-		int id;
+-		int sid;
+-
+ 		/*Seg constructors, destructors {{{*/
+ 		Seg(){};
+ 		Seg(int seg_id,int seg_sid,int i, IoModel* iomodel,int nummodels);
+ 		~Seg();
+ 		/*}}}*/
+ 		/*Object virtual functions definitions:{{{ */
+-		void    Echo();
+-		void    DeepEcho();
+-		int     Id();
+ 		int     ObjectEnum();
+ 		Object *copy();
+ 		/*}}}*/
+@@ -63,13 +57,8 @@
+ 		void        ComputeStressTensor(){_error_("not implemented yet");};
+ 		void        Configure(Elements* elements,Loads* loads,Nodes* nodesin,Vertices* verticesin,Materials* materials,Parameters* parameters){_error_("not implemented yet");};
+ 		void        SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters){_error_("not implemented yet");};
+-		void        SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum){_error_("not implemented yet");};
+ 		void        Delta18oParameterization(void){_error_("not implemented yet");};
+ 		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){_error_("not implemented yet");};
+-		void        ThermalToEnthalpy(IssmDouble* penthalpy,IssmDouble temperature,IssmDouble waterfraction,IssmDouble pressure){_error_("not implemented yet");};
+-		void        EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented yet");};
+-		IssmDouble  EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented");};
+-		IssmDouble  EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure){_error_("not implemented");};
+ 		int         FiniteElement(void);
+ 		Element*    GetUpperElement(void){_error_("not implemented yet");};
+ 	  	Element*    GetLowerElement(void){_error_("not implemented yet");};
+@@ -77,13 +66,10 @@
+ 		Element*    GetBasalElement(void){_error_("not implemented yet");};
+ 		int         GetNodeIndex(Node* node){_error_("not implemented yet");};
+ 		int         GetNumberOfNodes(void);
+-		int         GetNumberOfNodesVelocity(void){_error_("not implemented yet");};
+-		int         GetNumberOfNodesPressure(void){_error_("not implemented yet");};
+ 		int         GetNumberOfVertices(void);
+ 		void        GetVerticesCoordinates(IssmDouble** pxyz_list);
+ 		void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list){_error_("not implemented yet");};
+ 		void        GetVerticesCoordinatesTop(IssmDouble** pxyz_list){_error_("not implemented yet");};
+-		int         Sid(){_error_("not implemented yet");};
+ 		bool        IsOnBed(){_error_("not implemented yet");};
+ 		bool        IsOnSurface(){_error_("not implemented yet");};
+ 		bool        IsNodeOnShelfFromFlags(IssmDouble* flags){_error_("not implemented yet");};
+@@ -101,7 +87,6 @@
+ 		void        NodalFunctionsP1Derivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsMINIDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+-		bool        IsIceInElement();
+ 		void        NormalSection(IssmDouble* normal,IssmDouble* xyz_list);
+ 		void        NormalTop(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		void        NormalBase(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+@@ -110,7 +95,6 @@
+ 	   Element*    SpawnBasalElement(void){_error_("not implemented yet");};
+ 		Element*    SpawnTopElement(void){_error_("not implemented yet");};
+ 		IssmDouble  StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa){_error_("not implemented yet");};
+-		IssmDouble  PureIceEnthalpy(IssmDouble pressure){_error_("not implemented yet");};
+ 		int         PressureInterpolation(void){_error_("not implemented yet");};
+ 		void        ValueP1OnGauss(IssmDouble* pvalue,IssmDouble* values,Gauss* gauss){_error_("not implemented yet");};
+ 		void        ValueP1DerivativesOnGauss(IssmDouble* dvalue,IssmDouble* values,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17515)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17516)
+@@ -29,18 +29,12 @@
+ 
+ 	public:
+ 
+-		int id;
+-		int sid;
+-
+ 		/*Tetra constructors, destructors {{{*/
+ 		Tetra(){};
+ 		Tetra(int seg_id,int seg_sid,int i, IoModel* iomodel,int nummodels);
+ 		~Tetra();
+ 		/*}}}*/
+ 		/*Object virtual functions definitions:{{{ */
+-		void    Echo();
+-		void    DeepEcho();
+-		int     Id();
+ 		int     ObjectEnum();
+ 		Object *copy();
+ 		/*}}}*/
+@@ -63,13 +57,8 @@
+ 		void        ComputeStressTensor(){_error_("not implemented yet");};
+ 		void        Configure(Elements* elements,Loads* loads,Nodes* nodesin,Vertices* verticesin,Materials* materials,Parameters* parameters);
+ 		void        SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters);
+-		void        SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum);
+ 		void        Delta18oParameterization(void){_error_("not implemented yet");};
+ 		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){_error_("not implemented yet");};
+-		void        ThermalToEnthalpy(IssmDouble* penthalpy,IssmDouble temperature,IssmDouble waterfraction,IssmDouble pressure){_error_("not implemented yet");};
+-		void        EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented yet");};
+-		IssmDouble  EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented");};
+-		IssmDouble  EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure){_error_("not implemented");};
+ 		void        FaceOnFrontIndices(int* pindex1,int* pindex2,int* pindex3);
+ 		void        FaceOnBedIndices(int* pindex1,int* pindex2,int* pindex3);
+ 		void        FaceOnSurfaceIndices(int* pindex1,int* pindex2,int* pindex3);
+@@ -80,15 +69,11 @@
+ 		Element*    GetBasalElement(void){_error_("not implemented yet");};
+ 		int         GetNodeIndex(Node* node){_error_("not implemented yet");};
+ 		int         GetNumberOfNodes(void);
+-		int         GetNumberOfNodesVelocity(void);
+-		int         GetNumberOfNodesPressure(void);
+ 		int         GetNumberOfVertices(void);
+ 		void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list);
+ 		void        GetVerticesCoordinatesTop(IssmDouble** pxyz_list);
+ 		bool        HasFaceOnBed();
+ 		bool        HasFaceOnSurface();
+-		bool        HasNodeOnBed();
+-		int         Sid();
+ 		bool        IsOnBed();
+ 		bool        IsOnSurface();
+ 		bool        IsNodeOnShelfFromFlags(IssmDouble* flags){_error_("not implemented yet");};
+@@ -106,17 +91,15 @@
+ 		void        NodalFunctionsP1Derivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsMINIDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+-		bool        IsIceInElement();
+ 		void        NormalSection(IssmDouble* normal,IssmDouble* xyz_list);
+-		void        NormalTop(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
+-		void        NormalBase(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
++		void        NormalTop(IssmDouble* normal,IssmDouble* xyz_list);
++		void        NormalBase(IssmDouble* normal,IssmDouble* xyz_list);
+ 		int         NumberofNodesVelocity(void);
+ 		int         NumberofNodesPressure(void);
+ 	   Element*    SpawnBasalElement(void);
+ 		Element*    SpawnTopElement(void);
+ 		Tria*       SpawnTria(int index1,int index2,int index3);
+ 		IssmDouble  StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa){_error_("not implemented yet");};
+-		IssmDouble  PureIceEnthalpy(IssmDouble pressure){_error_("not implemented yet");};
+ 		int         PressureInterpolation(void);
+ 		void        ValueP1OnGauss(IssmDouble* pvalue,IssmDouble* values,Gauss* gauss){_error_("not implemented yet");};
+ 		void        ValueP1DerivativesOnGauss(IssmDouble* dvalue,IssmDouble* values,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+@@ -227,4 +210,4 @@
+ 		int    UpdatePotentialUngrounding(IssmDouble* vertices_potentially_ungrounding,Vector<IssmDouble>* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf){_error_("not implemented yet");};
+ 		/*}}}*/
+ };
+-#endif  /* _SEG_H */
++#endif  /* _TETRA_H_*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17515)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17516)
+@@ -16,6 +16,8 @@
+ 
+ /*Constructors/destructor/copy*/
+ Element::Element(){/*{{{*/
++	this->id  = -1;
++	this->sid = -1;
+ 	this->inputs     = NULL;
+ 	this->nodes      = NULL;
+ 	this->vertices   = NULL;
+@@ -129,6 +131,71 @@
+ void Element::DeleteMaterials(void){/*{{{*/
+ 	delete this->material;
+ }/*}}}*/
++void Element::DeepEcho(void){/*{{{*/
++
++	_printf_(EnumToStringx(this->ObjectEnum())<<" element:\n");
++	_printf_("   id : "<<this->id <<"\n");
++	_printf_("   sid: "<<this->sid<<"\n");
++	if(vertices){
++		int numvertices = this->GetNumberOfVertices();
++		for(int i=0;i<numvertices;i++) vertices[i]->Echo();
++	}
++	else _printf_("vertices = NULL\n");
++
++	if(nodes){
++		int numnodes = this->GetNumberOfNodes();
++		for(int i=0;i<numnodes;i++) nodes[i]->DeepEcho();
++	}
++	else _printf_("nodes = NULL\n");
++
++	if (material) material->DeepEcho();
++	else _printf_("material = NULL\n");
++
++	if (matpar) matpar->DeepEcho();
++	else _printf_("matpar = NULL\n");
++
++	_printf_("   parameters\n");
++	if (parameters) parameters->DeepEcho();
++	else _printf_("parameters = NULL\n");
++
++	_printf_("   inputs\n");
++	if (inputs) inputs->DeepEcho();
++	else _printf_("inputs=NULL\n");
++
++	return;
++}
++/*}}}*/
++void Element::Echo(void){/*{{{*/
++	_printf_(EnumToStringx(this->ObjectEnum())<<" element:\n");
++	_printf_("   id : "<<this->id <<"\n");
++	_printf_("   sid: "<<this->sid<<"\n");
++	if(vertices){
++		int numvertices = this->GetNumberOfVertices();
++		for(int i=0;i<numvertices;i++) vertices[i]->Echo();
++	}
++	else _printf_("vertices = NULL\n");
++
++	if(nodes){
++		int numnodes = this->GetNumberOfNodes();
++		for(int i=0;i<numnodes;i++) nodes[i]->Echo();
++	}
++	else _printf_("nodes = NULL\n");
++
++	if (material) material->Echo();
++	else _printf_("material = NULL\n");
++
++	if (matpar) matpar->Echo();
++	else _printf_("matpar = NULL\n");
++
++	_printf_("   parameters\n");
++	if (parameters) parameters->Echo();
++	else _printf_("parameters = NULL\n");
++
++	_printf_("   inputs\n");
++	if (inputs) inputs->Echo();
++	else _printf_("inputs=NULL\n");
++}
++/*}}}*/
+ IssmDouble Element::Divergence(void){/*{{{*/
+ 	/*Compute element divergence*/
+ 
+@@ -161,6 +228,18 @@
+ 	delete gauss;
+ 	return divergence;
+ }/*}}}*/
++void Element::ThermalToEnthalpy(IssmDouble* penthalpy,IssmDouble temperature,IssmDouble waterfraction,IssmDouble pressure){/*{{{*/
++	matpar->ThermalToEnthalpy(penthalpy,temperature,waterfraction,pressure);
++}/*}}}*/
++void Element::EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){/*{{{*/
++	matpar->EnthalpyToThermal(ptemperature,pwaterfraction,enthalpy,pressure);
++}/*}}}*/
++IssmDouble Element::EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure){/*{{{*/
++	return matpar->GetEnthalpyDiffusionParameter(enthalpy,pressure);
++}/*}}}*/
++IssmDouble Element::EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure){/*{{{*/
++	return matpar->GetEnthalpyDiffusionParameterVolume(numvertices,enthalpy,pressure);
++}/*}}}*/
+ void Element::FindParam(bool* pvalue,int paramenum){/*{{{*/
+ 	this->parameters->FindParam(pvalue,paramenum);
+ }/*}}}*/
+@@ -199,7 +278,7 @@
+ void Element::GetDofListVelocity(int** pdoflist,int setenum){/*{{{*/
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = this->GetNumberOfNodesVelocity();
++	int numnodes = this->NumberofNodesVelocity();
+ 
+ 	/*First, figure out size of doflist and create it: */
+ 	int numberofdofs=0;
+@@ -222,8 +301,8 @@
+ void Element::GetDofListPressure(int** pdoflist,int setenum){/*{{{*/
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+-	int vnumnodes = this->GetNumberOfNodesVelocity();
+-	int pnumnodes = this->GetNumberOfNodesPressure();
++	int vnumnodes = this->NumberofNodesVelocity();
++	int pnumnodes = this->NumberofNodesPressure();
+ 
+ 	/*First, figure out size of doflist and create it: */
+ 	int numberofdofs=0;
+@@ -387,7 +466,7 @@
+ 
+ 	_assert_(pvalue);
+ 
+-	int    numnodes = this->GetNumberOfNodesVelocity();
++	int    numnodes = this->NumberofNodesVelocity();
+ 	Input *input    = this->GetInput(enumtype);
+ 	if(!input) _error_("Input " << EnumToStringx(enumtype) << " not found in element");
+ 
+@@ -469,6 +548,18 @@
+ 	for(int i=0;i<numvertices;i++) connectivity[i]=this->vertices[i]->Connectivity();
+ }
+ /*}}}*/
++bool Element::HasNodeOnBed(){/*{{{*/
++	return (this->inputs->Max(MeshVertexonbedEnum)>0.);
++}/*}}}*/
++bool Element::HasNodeOnSurface(){/*{{{*/
++	return (this->inputs->Max(MeshVertexonsurfaceEnum)>0.);
++}/*}}}*/
++int  Element::Id(){/*{{{*/
++
++	return this->id;
++
++}
++/*}}}*/
+ void Element::InputChangeName(int original_enum,int new_enum){/*{{{*/
+ 	this->inputs->ChangeEnum(original_enum,new_enum);
+ }
+@@ -586,6 +677,10 @@
+ 
+ 	return shelf;
+ }/*}}}*/
++bool Element::IsIceInElement(){/*{{{*/
++	return (this->inputs->Min(MaskIceLevelsetEnum)<0.);
++}
++/*}}}*/
+ bool Element::IsInput(int name){/*{{{*/
+ 	if (
+ 				name==ThicknessEnum ||
+@@ -674,6 +769,9 @@
+ 	return new ElementMatrix(nodes,number_nodes,this->parameters,approximation_enum);
+ }
+ /*}}}*/
++IssmDouble Element::PureIceEnthalpy(IssmDouble pressure){/*{{{*/
++	return this->matpar->PureIceEnthalpy(pressure);
++}/*}}}*/
+ void Element::ResultInterpolation(int* pinterpolation,int* pnodesperelement,int output_enum){/*{{{*/
+ 
+ 	Input* input=this->inputs->GetInput(output_enum);
+@@ -772,6 +870,82 @@
+ 	input->ResultToPatch(values,nodesperelement,this->Sid());
+ 
+ } /*}}}*/
++void Element::SetwiseNodeConnectivity(int* pd_nz,int* po_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum){/*{{{*/
++
++	/*Intermediaries*/
++	const int numnodes = this->GetNumberOfNodes();
++
++	/*Output */
++	int d_nz = 0;
++	int o_nz = 0;
++
++	/*Loop over all nodes*/
++	for(int i=0;i<numnodes;i++){
++
++		if(!flags[this->nodes[i]->Lid()]){
++
++			/*flag current node so that no other element processes it*/
++			flags[this->nodes[i]->Lid()]=true;
++
++			int counter=0;
++			while(flagsindices[counter]>=0) counter++;
++			flagsindices[counter]=this->nodes[i]->Lid();
++
++			/*if node is clone, we have an off-diagonal non-zero, else it is a diagonal non-zero*/
++			switch(set2_enum){
++				case FsetEnum:
++					if(nodes[i]->indexing.fsize){
++						if(this->nodes[i]->IsClone())
++						 o_nz += 1;
++						else
++						 d_nz += 1;
++					}
++					break;
++				case GsetEnum:
++					if(nodes[i]->indexing.gsize){
++						if(this->nodes[i]->IsClone())
++						 o_nz += 1;
++						else
++						 d_nz += 1;
++					}
++					break;
++				case SsetEnum:
++					if(nodes[i]->indexing.ssize){
++						if(this->nodes[i]->IsClone())
++						 o_nz += 1;
++						else
++						 d_nz += 1;
++					}
++					break;
++				default: _error_("not supported");
++			}
++		}
++	}
++
++	/*Special case: 2d/3d coupling, the node of this element might be connected
++	 *to the basal element*/
++	int analysis_type,approximation,numlayers;
++	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
++	if(analysis_type==StressbalanceAnalysisEnum){
++		inputs->GetInputValue(&approximation,ApproximationEnum);
++		if(approximation==SSAHOApproximationEnum || approximation==SSAFSApproximationEnum){
++			parameters->FindParam(&numlayers,MeshNumberoflayersEnum);
++			o_nz += numlayers*3;
++			d_nz += numlayers*3;
++		}
++	}
++
++	/*Assign output pointers: */
++	*pd_nz=d_nz;
++	*po_nz=o_nz;
++}
++/*}}}*/
++int  Element::Sid(){/*{{{*/
++
++	return this->sid;
++
++}
++/*}}}*/
+ IssmDouble Element::TMeltingPoint(IssmDouble pressure){/*{{{*/
+ 	_assert_(matpar);
+ 	return this->matpar->TMeltingPoint(pressure);
Index: issm/oecreview/Archive/16554-17801/ISSM-17516-17517.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17516-17517.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17516-17517.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17516)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17517)
+@@ -435,7 +435,6 @@
+ 					./cores/damage_core.cpp\
+ 					./cores/levelsetfunctionslope_core.cpp\
+ 					./analyses/DamageEvolutionAnalysis.cpp\
+-					./solutionsequences/solutionsequence_damage_nonlinear.cpp\
+ 					./modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp\
+ 					./classes/Loads/Riftfront.cpp\
+ 					./modules/ConstraintsStatex/RiftConstraintsState.cpp\
Index: issm/oecreview/Archive/16554-17801/ISSM-17517-17518.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17517-17518.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17517-17518.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17517)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17518)
+@@ -192,7 +192,7 @@
+ 			/*Streamline upwinding*/
+ 			if(dim==1){
+ 				vel=fabs(vx)+1.e-8;
+-				D[0] = h/(2.*vel)*vx;
++				D[0] = h/(2.*vel)*vx*vx;
+ 			}
+ 			else{
+ 				vel=sqrt(vx*vx+vy*vy)+1.e-8;
Index: issm/oecreview/Archive/16554-17801/ISSM-17518-17519.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17518-17519.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17518-17519.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17518)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17519)
+@@ -183,7 +183,7 @@
+ 			/*Streamline upwinding*/
+ 			if(dim==1){
+ 			 vel=fabs(vx)+1.e-8;
+-			 D[0] = h/(2.*vel)*vx;
++			 D[0] = h/(2.*vel)*vx*vx;
+ 			}
+ 			else{
+ 			 vel=sqrt(vx*vx+vy*vy)+1.e-8;
Index: issm/oecreview/Archive/16554-17801/ISSM-17519-17520.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17519-17520.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17519-17520.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/test/NightlyRun/test1502.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1502.m	(revision 17519)
++++ ../trunk-jpl/test/NightlyRun/test1502.m	(revision 17520)
+@@ -16,7 +16,6 @@
+ smb= 2.*ones(md.mesh.numberofvertices,1);
+ md.surfaceforcings.mass_balance= smb;
+ md.basalforcings.melting_rate= smb;
+-md.verbose=verbose('all');
+ 
+ md=solve(md,MasstransportSolutionEnum());
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17520-17521.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17520-17521.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17520-17521.diff	(revision 17802)
@@ -0,0 +1,22 @@
+Index: ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp	(revision 17520)
++++ ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp	(revision 17521)
+@@ -251,7 +251,7 @@
+ void LsfReinitializationAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 
+ 	IssmDouble   lsf;
+-	int          meshtype,dim,approximation,dofpernode;
++	int          meshtype,dim,dofpernode;
+ 	int*         doflist = NULL;
+ 
+ 	/*Get some parameters*/
+@@ -269,7 +269,7 @@
+ 	int numdof   = numnodes*dofpernode;
+ 
+ 	/*Fetch dof list and allocate solution vector*/
+-	element->GetDofList(&doflist,approximation,GsetEnum);
++	element->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+ 	IssmDouble* values = xNew<IssmDouble>(numdof);
+ 
+ 	/*Get inputs*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17521-17522.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17521-17522.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17521-17522.diff	(revision 17802)
@@ -0,0 +1,122 @@
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17521)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17522)
+@@ -559,6 +559,7 @@
+ 	MINIEnum,
+ 	MINIcondensedEnum,
+ 	TaylorHoodEnum,
++	XTaylorHoodEnum,
+ 	OneLayerP4zEnum,
+ 	/*}}}*/
+ 	/*Results{{{*/
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17521)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17522)
+@@ -546,6 +546,7 @@
+ 		case MINIEnum : return "MINI";
+ 		case MINIcondensedEnum : return "MINIcondensed";
+ 		case TaylorHoodEnum : return "TaylorHood";
++		case XTaylorHoodEnum : return "XTaylorHood";
+ 		case OneLayerP4zEnum : return "OneLayerP4z";
+ 		case SaveResultsEnum : return "SaveResults";
+ 		case BoolExternalResultEnum : return "BoolExternalResult";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17521)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17522)
+@@ -558,6 +558,7 @@
+ 	      else if (strcmp(name,"MINI")==0) return MINIEnum;
+ 	      else if (strcmp(name,"MINIcondensed")==0) return MINIcondensedEnum;
+ 	      else if (strcmp(name,"TaylorHood")==0) return TaylorHoodEnum;
++	      else if (strcmp(name,"XTaylorHood")==0) return XTaylorHoodEnum;
+ 	      else if (strcmp(name,"OneLayerP4z")==0) return OneLayerP4zEnum;
+ 	      else if (strcmp(name,"SaveResults")==0) return SaveResultsEnum;
+ 	      else if (strcmp(name,"BoolExternalResult")==0) return BoolExternalResultEnum;
+@@ -627,11 +628,11 @@
+ 	      else if (strcmp(name,"Nodal")==0) return NodalEnum;
+ 	      else if (strcmp(name,"OldGradient")==0) return OldGradientEnum;
+ 	      else if (strcmp(name,"OutputFilePointer")==0) return OutputFilePointerEnum;
+-	      else if (strcmp(name,"OutputFileName")==0) return OutputFileNameEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"LockFileName")==0) return LockFileNameEnum;
++	      if (strcmp(name,"OutputFileName")==0) return OutputFileNameEnum;
++	      else if (strcmp(name,"LockFileName")==0) return LockFileNameEnum;
+ 	      else if (strcmp(name,"ToolkitsOptionsAnalyses")==0) return ToolkitsOptionsAnalysesEnum;
+ 	      else if (strcmp(name,"ToolkitsOptionsStrings")==0) return ToolkitsOptionsStringsEnum;
+ 	      else if (strcmp(name,"QmuErrName")==0) return QmuErrNameEnum;
+Index: ../trunk-jpl/src/m/classes/flowequation.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/flowequation.py	(revision 17521)
++++ ../trunk-jpl/src/m/classes/flowequation.py	(revision 17522)
+@@ -44,7 +44,7 @@
+ 		string="%s\n%s"%(string,fielddisplay(self,'isFS',"are the Full-FS (FS) equations used ?"))
+ 		string="%s\n%s"%(string,fielddisplay(self,'fe_SSA',"Finite Element for SSA: 'P1', 'P1bubble' 'P1bubblecondensed' 'P2'"))
+ 		string="%s\n%s"%(string,fielddisplay(self,'fe_HO' ,"Finite Element for HO:  'P1' 'P1bubble' 'P1bubblecondensed' 'P1xP2' 'P2xP1' 'P2'"))
+-		string="%s\n%s"%(string,fielddisplay(self,'fe_FS' ,"Finite Element for FS:  'P1P1' (debugging only) 'P1P1GLS' 'MINIcondensed' 'MINI' 'TaylorHood'"))
++		string="%s\n%s"%(string,fielddisplay(self,'fe_FS' ,"Finite Element for FS:  'P1P1' (debugging only) 'P1P1GLS' 'MINIcondensed' 'MINI' 'TaylorHood' 'XTaylorHood'"))
+ 		string="%s\n%s"%(string,fielddisplay(self,'vertex_equation',"flow equation for each vertex"))
+ 		string="%s\n%s"%(string,fielddisplay(self,'element_equation',"flow equation for each element"))
+ 		string="%s\n%s"%(string,fielddisplay(self,'borderSSA',"vertices on SSA's border (for tiling)"))
+@@ -75,7 +75,7 @@
+ 			md = checkfield(md,'fieldname','flowequation.isFS','numel',[1],'values',[0,1])
+ 			md = checkfield(md,'fieldname','flowequation.fe_SSA','values',['P1','P1bubble','P1bubblecondensed','P2'])
+ 			md = checkfield(md,'fieldname','flowequation.fe_HO' ,'values',['P1','P1bubble','P1bubblecondensed','P1xP2','P2xP1','P2','P1xP3','P2xP4'])
+-			md = checkfield(md,'fieldname','flowequation.fe_FS' ,'values',['P1P1','P1P1GLS','MINIcondensed','MINI','TaylorHood','OneLayerP4z','P1xP3','P2xP4'])
++			md = checkfield(md,'fieldname','flowequation.fe_FS' ,'values',['P1P1','P1P1GLS','MINIcondensed','MINI','TaylorHood','XTaylorHood','OneLayerP4z'])
+ 			md = checkfield(md,'fieldname','flowequation.borderSSA','size',[md.mesh.numberofvertices],'values',[0,1])
+ 			md = checkfield(md,'fieldname','flowequation.borderHO','size',[md.mesh.numberofvertices],'values',[0,1])
+ 			md = checkfield(md,'fieldname','flowequation.borderFS','size',[md.mesh.numberofvertices],'values',[0,1])
+Index: ../trunk-jpl/src/m/classes/flowequation.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/flowequation.m	(revision 17521)
++++ ../trunk-jpl/src/m/classes/flowequation.m	(revision 17522)
+@@ -86,7 +86,7 @@
+ 				md = checkfield(md,'fieldname','flowequation.isFS','numel',[1],'values',[0 1]);
+ 				md = checkfield(md,'fieldname','flowequation.fe_SSA','values',{'P1','P1bubble','P1bubblecondensed','P2'});
+ 				md = checkfield(md,'fieldname','flowequation.fe_HO' ,'values',{'P1','P1bubble','P1bubblecondensed','P1xP2','P2xP1','P2','P1xP3','P2xP4'});
+-				md = checkfield(md,'fieldname','flowequation.fe_FS' ,'values',{'P1P1','P1P1GLS','MINIcondensed','MINI','TaylorHood','OneLayerP4z'});
++				md = checkfield(md,'fieldname','flowequation.fe_FS' ,'values',{'P1P1','P1P1GLS','MINIcondensed','MINI','TaylorHood','XTaylorHood','OneLayerP4z'});
+ 				md = checkfield(md,'fieldname','flowequation.borderSSA','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+ 				md = checkfield(md,'fieldname','flowequation.borderHO','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+ 				md = checkfield(md,'fieldname','flowequation.borderFS','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+@@ -125,7 +125,7 @@
+ 			fielddisplay(obj,'isFS','are the Full-FS (FS) equations used ?');
+ 			fielddisplay(obj,'fe_SSA','Finite Element for SSA  ''P1'', ''P1bubble'' ''P1bubblecondensed'' ''P2''');
+ 			fielddisplay(obj,'fe_HO', 'Finite Element for HO   ''P1'' ''P1bubble'' ''P1bubblecondensed'' ''P1xP2'' ''P2xP1'' ''P2''');
+-			fielddisplay(obj,'fe_FS', 'Finite Element for FS   ''P1P1'' (debugging only) ''P1P1GLS'' ''MINIcondensed'' ''MINI'' ''TaylorHood''');
++			fielddisplay(obj,'fe_FS', 'Finite Element for FS   ''P1P1'' (debugging only) ''P1P1GLS'' ''MINIcondensed'' ''MINI'' ''TaylorHood'' ''XTaylorHood''');
+ 			fielddisplay(obj,'vertex_equation','flow equation for each vertex');
+ 			fielddisplay(obj,'element_equation','flow equation for each element');
+ 			fielddisplay(obj,'borderSSA','vertices on SSA''s border (for tiling)');
+Index: ../trunk-jpl/src/m/enum/XTaylorHoodEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/XTaylorHoodEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/XTaylorHoodEnum.m	(revision 17522)
+@@ -0,0 +1,11 @@
++function macro=XTaylorHoodEnum()
++%XTAYLORHOODENUM - Enum of XTaylorHood
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=XTaylorHoodEnum()
++
++macro=StringToEnum('XTaylorHood');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17521)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17522)
+@@ -538,6 +538,7 @@
+ def MINIEnum(): return StringToEnum("MINI")[0]
+ def MINIcondensedEnum(): return StringToEnum("MINIcondensed")[0]
+ def TaylorHoodEnum(): return StringToEnum("TaylorHood")[0]
++def XTaylorHoodEnum(): return StringToEnum("XTaylorHood")[0]
+ def OneLayerP4zEnum(): return StringToEnum("OneLayerP4z")[0]
+ def SaveResultsEnum(): return StringToEnum("SaveResults")[0]
+ def BoolExternalResultEnum(): return StringToEnum("BoolExternalResult")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17522-17523.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17522-17523.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17522-17523.diff	(revision 17802)
@@ -0,0 +1,66 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17522)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17523)
+@@ -55,8 +55,9 @@
+ 	iomodel->FetchDataToInput(elements,SedimentHeadEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcEplInitialThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcSedimentTransmitivityEnum);
++	iomodel->FetchDataToInput(elements,HydrologydcEplThicknessEnum);
+ 	
+-	elements->InputDuplicate(HydrologydcEplInitialThicknessEnum,HydrologydcEplThicknessEnum);
++	//	elements->InputDuplicate(HydrologydcEplInitialThicknessEnum,HydrologydcEplThicknessEnum);
+ 
+ }/*}}}*/
+ void HydrologyDCEfficientAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+Index: ../trunk-jpl/src/m/classes/initialization.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/initialization.m	(revision 17522)
++++ ../trunk-jpl/src/m/classes/initialization.m	(revision 17523)
+@@ -14,6 +14,7 @@
+ 		waterfraction = NaN;
+ 		sediment_head = NaN;
+ 		epl_head      = NaN;
++		epl_thickness = NaN;
+ 		watercolumn   = NaN;
+ 	end
+ 	methods
+@@ -72,7 +73,9 @@
+ 			if ismember(HydrologyDCEfficientAnalysisEnum(),analyses),
+ 				if isa(md.hydrology,'hydrologydc'),
+ 					if md.hydrology.isefficientlayer==1,
+-						md = checkfield(md,'fieldname','initialization.epl_head','NaN',1,'size',[md.mesh.numberofvertices 1]);
++						md = checkfield(md,'fieldname', ...
++														'initialization.epl_head','NaN',1,'size',[md.mesh.numberofvertices 1]);
++						md = checkfield(md,'fieldname','initialization.epl_thickness','NaN',1,'size',[md.mesh.numberofvertices 1]);
+ 					end
+ 				end
+ 			end
+@@ -89,6 +92,7 @@
+ 			fielddisplay(obj,'waterfraction','fraction of water in the ice');
+ 			fielddisplay(obj,'sediment_head','sediment water head of subglacial system [m]');
+ 			fielddisplay(obj,'epl_head','epl water head of subglacial system [m]');
++			fielddisplay(obj,'epl_thickness','epl layer thickness [m]');
+ 			fielddisplay(obj,'watercolumn','thickness of subglacial water [m]');
+ 
+ 		end % }}}
+@@ -104,6 +108,7 @@
+ 			WriteData(fid,'data',obj.waterfraction,'format','DoubleMat','mattype',1,'enum',WaterfractionEnum);
+ 			WriteData(fid,'data',obj.sediment_head,'format','DoubleMat','mattype',1,'enum',SedimentHeadEnum);
+ 			WriteData(fid,'data',obj.epl_head,'format','DoubleMat','mattype',1,'enum',EplHeadEnum);
++			WriteData(fid,'data',obj.epl_thickness,'format','DoubleMat','mattype',1,'enum',HydrologydcEplThicknessEnum);
+ 			WriteData(fid,'data',obj.watercolumn,'format','DoubleMat','mattype',1,'enum',WatercolumnEnum);
+ 
+ 			if md.thermal.isenthalpy,
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17522)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17523)
+@@ -692,6 +692,7 @@
+       if ~isnan(md.initialization.watercolumn),md.initialization.watercolumn=project3d(md,'vector',md.initialization.watercolumn,'type','node','layer',1);end;
+       if ~isnan(md.initialization.sediment_head),md.initialization.sediment_head=project3d(md,'vector',md.initialization.sediment_head,'type','node','layer',1);end;
+       if ~isnan(md.initialization.epl_head),md.initialization.epl_head=project3d(md,'vector',md.initialization.epl_head,'type','node','layer',1);end;
++      if ~isnan(md.initialization.epl_thickness),md.initialization.epl_thickness=project3d(md,'vector',md.initialization.epl_thickness,'type','node','layer',1);end;
+ 
+ 			%bedinfo and surface info
+ 			md.mesh.elementonbed=project3d(md,'vector',ones(md.mesh.numberofelements2d,1),'type','element','layer',1);
Index: issm/oecreview/Archive/16554-17801/ISSM-17523-17524.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17523-17524.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17523-17524.diff	(revision 17802)
@@ -0,0 +1,36 @@
+Index: ../trunk-jpl/test/NightlyRun/test333.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test333.m	(revision 17523)
++++ ../trunk-jpl/test/NightlyRun/test333.m	(revision 17524)
+@@ -14,6 +14,7 @@
+ md.hydrology.sediment_transmitivity=3*ones(md.mesh.numberofvertices,1);
+ 
+ md.initialization.epl_head=0.0*ones(md.mesh.numberofvertices,1);
++md.initialization.epl_thickness=1.0*ones(md.mesh.numberofvertices,1);
+ md.hydrology.spcepl_head=NaN*ones(md.mesh.numberofvertices,1);
+ md.hydrology.mask_eplactive_node=0*ones(md.mesh.numberofvertices,1);
+ md.basalforcings.melting_rate = 2.0*ones(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/test/NightlyRun/test3300.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test3300.m	(revision 17523)
++++ ../trunk-jpl/test/NightlyRun/test3300.m	(revision 17524)
+@@ -15,6 +15,7 @@
+ md.hydrology.sediment_transmitivity=1.5e-4*ones(md.mesh.numberofvertices,1);
+ 
+ md.initialization.epl_head=0.0*ones(md.mesh.numberofvertices,1);
++md.initialization.epl_thickness=1.0*ones(md.mesh.numberofvertices,1);
+ md.hydrology.spcepl_head=NaN*ones(md.mesh.numberofvertices,1);
+ md.hydrology.mask_eplactive_node=0*ones(md.mesh.numberofvertices,1);
+ 
+Index: ../trunk-jpl/test/NightlyRun/test335.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test335.m	(revision 17523)
++++ ../trunk-jpl/test/NightlyRun/test335.m	(revision 17524)
+@@ -14,6 +14,7 @@
+ md.hydrology.sediment_transmitivity=3*ones(md.mesh.numberofvertices,1);
+ 
+ md.initialization.epl_head=0.0*ones(md.mesh.numberofvertices,1);
++md.initialization.epl_thickness=1.0*ones(md.mesh.numberofvertices,1);
+ md.hydrology.spcepl_head=NaN*ones(md.mesh.numberofvertices,1);
+ md.hydrology.mask_eplactive_node=0*ones(md.mesh.numberofvertices,1);
+ md.basalforcings.melting_rate = 2.0*ones(md.mesh.numberofvertices,1);
Index: issm/oecreview/Archive/16554-17801/ISSM-17524-17525.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17524-17525.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17524-17525.diff	(revision 17802)
@@ -0,0 +1,447 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17524)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17525)
+@@ -66,11 +66,13 @@
+ 		ElementVector* CreateDVectorFS(Element* element);
+ 		ElementMatrix* CreateJacobianMatrixFS(Element* element);
+ 		ElementMatrix* CreateKMatrixFS(Element* element);
++		ElementMatrix* CreateKMatrixFSViscousXTH(Element* element);
+ 		ElementMatrix* CreateKMatrixFSViscous(Element* element);
+ 		ElementMatrix* CreateKMatrixFSFriction(Element* element);
+ 		ElementMatrix* CreateKMatrixFSShelf(Element* element);
+ 		ElementVector* CreatePVectorFS(Element* element);
+ 		ElementVector* CreatePVectorFSViscous(Element* element);
++		ElementVector* CreatePVectorFSViscousXTH(Element* element);
+ 		ElementVector* CreatePVectorFSShelf(Element* element);
+ 		ElementVector* CreatePVectorFSFront(Element* element);
+ 		void GetBFS(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17524)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17525)
+@@ -406,8 +406,9 @@
+ 				case MINIcondensedEnum : finiteelement = P1bubbleEnum; break;
+ 				case MINIEnum          : finiteelement = P1bubbleEnum; break;
+ 				case TaylorHoodEnum    : finiteelement = P2Enum;       break;
++				case XTaylorHoodEnum   : finiteelement = P2Enum;       break;
+ 				case OneLayerP4zEnum   : finiteelement = P2xP4Enum;    break;
+-				default: _error_("finite element "<<finiteelement<<" not supported");
++				default: _error_("finite element "<<EnumToStringx(finiteelement)<<" not supported");
+ 			}
+ 		}
+ 		else{
+@@ -825,20 +826,32 @@
+ 	/*Intermediaries*/
+ 	bool isSSA,isL1L2,isHO,isFS;
+ 	bool conserve_loads = true;
+-	int  newton,meshtype;
++	int  newton,meshtype,fe_FS;
+ 
+ 	/* recover parameters:*/
+ 	femmodel->parameters->FindParam(&isSSA,FlowequationIsSSAEnum);
+ 	femmodel->parameters->FindParam(&isL1L2,FlowequationIsL1L2Enum);
+ 	femmodel->parameters->FindParam(&isHO,FlowequationIsHOEnum);
+ 	femmodel->parameters->FindParam(&isFS,FlowequationIsFSEnum);
++	femmodel->parameters->FindParam(&fe_FS,FlowequationFeFSEnum);
+ 	femmodel->parameters->FindParam(&meshtype,MeshTypeEnum);
+ 	femmodel->parameters->FindParam(&newton,StressbalanceIsnewtonEnum);
+ 
+-	if((isSSA || isHO || isL1L2) ^ isFS){ // ^ = xor
++	if(isFS){
+ 		if(VerboseSolution()) _printf0_("   computing velocities\n");
+ 
+ 		femmodel->SetCurrentConfiguration(StressbalanceAnalysisEnum);
++		if (fe_FS==XTaylorHoodEnum)
++		 solutionsequence_la_theta(femmodel);
++		else if(newton>0)
++		 solutionsequence_newton(femmodel);
++		else
++		 solutionsequence_nonlinear(femmodel,conserve_loads); 
++	}
++	else if(isSSA || isHO || isL1L2){ 
++		if(VerboseSolution()) _printf0_("   computing velocities\n");
++
++		femmodel->SetCurrentConfiguration(StressbalanceAnalysisEnum);
+ 		if(newton>0)
+ 		 solutionsequence_newton(femmodel);
+ 		else
+@@ -851,6 +864,9 @@
+ 			extrudefrombase_core(femmodel);
+ 		}
+ 	}
++	else{
++		_error_("not supported");
++	}
+ 
+ 	if ((isSSA || isL1L2 || isHO) && isFS){
+ 		if(VerboseSolution()) _printf0_("   computing coupling between lower order models and FS\n");
+@@ -2856,8 +2872,17 @@
+ }/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixFS(Element* element){/*{{{*/
+ 
++	/*Get type of algorithm*/
++	int fe_FS;
++	element->FindParam(&fe_FS,FlowequationFeFSEnum);
++
+ 	/*compute all stiffness matrices for this element*/
+-	ElementMatrix* Ke1=CreateKMatrixFSViscous(element);
++	ElementMatrix* Ke1=NULL;
++	if(fe_FS==XTaylorHoodEnum)
++	 Ke1=CreateKMatrixFSViscousXTH(element);
++	else
++	 Ke1=CreateKMatrixFSViscous(element);
++
+ 	ElementMatrix* Ke2=CreateKMatrixFSFriction(element);
+ 	ElementMatrix* Ke3=CreateKMatrixFSShelf(element);
+ 	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2,Ke3);
+@@ -2868,6 +2893,81 @@
+ 	delete Ke3;
+ 	return Ke;
+ }/*}}}*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixFSViscousXTH(Element* element){/*{{{*/
++
++	/*Intermediaries*/
++	int         i,meshtype,dim,epssize;
++	IssmDouble  r,FSreconditioning,Jdet;
++	IssmDouble *xyz_list = NULL;
++
++	/*FIXME this should change*/
++	r = 1.;
++
++	/*Get problem dimension*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; epssize = 3; break;
++		case Mesh3DEnum:         dim = 3; epssize = 6; break;
++		case Mesh3DtetrasEnum:   dim = 3; epssize = 6; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int vnumnodes = element->NumberofNodesVelocity();
++	int pnumnodes = element->NumberofNodesPressure();
++	int numdof    = vnumnodes*dim + pnumnodes;
++	int bsize     = epssize + 2;
++
++	/*Prepare coordinate system list*/
++	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
++	if(dim==2) for(i=0;i<vnumnodes;i++) cs_list[i] = XYEnum;
++	else       for(i=0;i<vnumnodes;i++) cs_list[i] = XYZEnum;
++	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
++
++	/*Initialize Element matrix and vectors*/
++	ElementMatrix* Ke     = element->NewElementMatrix(FSvelocityEnum);
++	IssmDouble*    B      = xNew<IssmDouble>(bsize*numdof);
++	IssmDouble*    Bprime = xNew<IssmDouble>(bsize*numdof);
++	IssmDouble*    D      = xNewZeroInit<IssmDouble>(bsize*bsize);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
++	Input* vx_input=element->GetInput(VxEnum);     _assert_(vx_input);
++	Input* vy_input=element->GetInput(VyEnum);     _assert_(vy_input);
++	Input* vz_input;
++	if(dim==3){vz_input=element->GetInput(VzEnum); _assert_(vz_input);}
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss = element->NewGauss(5);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		this->GetBFS(B,element,dim,xyz_list,gauss);
++		this->GetBFSprime(Bprime,element,dim,xyz_list,gauss);
++
++		for(i=0;i<epssize;i++)     D[i*bsize+i] = + r*gauss->weight*Jdet;
++		for(i=epssize;i<bsize;i++) D[i*bsize+i] = - FSreconditioning*gauss->weight*Jdet;
++
++		TripleMultiply(B,bsize,numdof,1,
++					D,bsize,bsize,0,
++					Bprime,bsize,numdof,0,
++					&Ke->values[0],1);
++	}
++
++	/*Transform Coordinate System*/
++	element->TransformStiffnessMatrixCoord(Ke,cs_list);
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(D);
++	xDelete<IssmDouble>(Bprime);
++	xDelete<IssmDouble>(B);
++	xDelete<int>(cs_list);
++	return Ke;
++}/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixFSViscous(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+@@ -3178,17 +3278,35 @@
+ #else
+ ElementVector* StressbalanceAnalysis::CreatePVectorFS(Element* element){/*{{{*/
+ 
+-	/*compute all load vectors for this element*/
+-	ElementVector* pe1=CreatePVectorFSViscous(element);
+-	ElementVector* pe2=CreatePVectorFSShelf(element);
+-	ElementVector* pe3=CreatePVectorFSFront(element);
+-	ElementVector* pe =new ElementVector(pe1,pe2,pe3);
++	ElementVector* pe = NULL;
+ 
++	int fe_FS;
++	element->FindParam(&fe_FS,FlowequationFeFSEnum);
++
++	if(fe_FS==XTaylorHoodEnum){
++		ElementVector* pe1=CreatePVectorFSViscous(element);
++		ElementVector* pe2=CreatePVectorFSShelf(element);
++		ElementVector* pe3=CreatePVectorFSFront(element);
++		ElementVector* petemp =new ElementVector(pe1,pe2,pe3);
++		ElementVector* pe4=CreatePVectorFSViscousXTH(element);
++		ElementVector* pe = new ElementVector(petemp,pe4);
++		delete pe1;
++		delete pe2;
++		delete pe3;
++		delete petemp;
++		delete pe4;
++	}
++	else{
++		ElementVector* pe1=CreatePVectorFSViscous(element);
++		ElementVector* pe2=CreatePVectorFSShelf(element);
++		ElementVector* pe3=CreatePVectorFSFront(element);
++		pe =new ElementVector(pe1,pe2,pe3);
++		delete pe1;
++		delete pe2;
++		delete pe3;
++	}
++
+ 	/*clean-up and return*/
+-	delete pe1;
+-	delete pe2;
+-	delete pe3;
+-
+ 	return pe;
+ }/*}}}*/
+ #endif
+@@ -3267,6 +3385,82 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	return pe;
+ }/*}}}*/
++ElementVector* StressbalanceAnalysis::CreatePVectorFSViscousXTH(Element* element){/*{{{*/
++	_error_("STOP");
++
++	int         i,meshtype,dim;
++	IssmDouble  Jdet,forcex,forcey,forcez;
++	IssmDouble *xyz_list = NULL;
++
++	/*Get problem dimension*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; break;
++		case Mesh3DEnum:         dim = 3; break;
++		case Mesh3DtetrasEnum:   dim = 3; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int vnumnodes = element->NumberofNodesVelocity();
++	int pnumnodes = element->NumberofNodesPressure();
++
++	/*Prepare coordinate system list*/
++	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
++	if(dim==2) for(i=0;i<vnumnodes;i++) cs_list[i] = XYEnum;
++	else       for(i=0;i<vnumnodes;i++) cs_list[i] = XYZEnum;
++	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
++
++	/*Initialize vectors*/
++	ElementVector* pe     = element->NewElementVector(FSvelocityEnum);
++	IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	IssmDouble  rho_ice =element->GetMaterialParameter(MaterialsRhoIceEnum);
++	IssmDouble  gravity =element->GetMaterialParameter(ConstantsGEnum);
++	Input*      loadingforcex_input=element->GetInput(LoadingforceXEnum);  _assert_(loadingforcex_input);
++	Input*      loadingforcey_input=element->GetInput(LoadingforceYEnum);  _assert_(loadingforcey_input);
++	Input*      loadingforcez_input=NULL;
++	if(dim==3){
++		loadingforcez_input=element->GetInput(LoadingforceZEnum);  _assert_(loadingforcez_input);
++	}
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(5);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctionsVelocity(vbasis,gauss);
++
++		loadingforcex_input->GetInputValue(&forcex,gauss);
++		loadingforcey_input->GetInputValue(&forcey,gauss);
++		if(dim==3) loadingforcez_input->GetInputValue(&forcez,gauss);
++
++		for(i=0;i<vnumnodes;i++){
++			pe->values[i*dim+0] += +rho_ice*forcex *Jdet*gauss->weight*vbasis[i];
++			pe->values[i*dim+1] += +rho_ice*forcey *Jdet*gauss->weight*vbasis[i];
++			if(dim==3){
++				pe->values[i*dim+2] += +rho_ice*forcez*Jdet*gauss->weight*vbasis[i];
++				pe->values[i*dim+2] += -rho_ice*gravity*Jdet*gauss->weight*vbasis[i];
++			}
++			else{
++				pe->values[i*dim+1] += -rho_ice*gravity*Jdet*gauss->weight*vbasis[i];
++			}
++		}
++	}
++
++	/*Transform coordinate system*/
++	element->TransformLoadVectorCoord(pe,cs_list);
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<int>(cs_list);
++	xDelete<IssmDouble>(vbasis);
++	xDelete<IssmDouble>(xyz_list);
++	return pe;
++}/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorFSShelf(Element* element){/*{{{*/
+ 
+ 	int         i,meshtype,dim;
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17524)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17525)
+@@ -293,6 +293,7 @@
+ 			}
+ 			break;
+ 		case TaylorHoodEnum:
++		case XTaylorHoodEnum:
+ 			_assert_(approximation==FSApproximationEnum);
+ 			/*P2 velocity*/
+ 			EdgesPartitioning(&my_edges,iomodel);
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp	(revision 0)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp	(revision 17525)
+@@ -0,0 +1,34 @@
++/*!\file: solutionsequence_la_theta.cpp
++ * \brief: numerical core of la_theta solutions
++ */ 
++
++#include "../toolkits/toolkits.h"
++#include "../classes/classes.h"
++#include "../shared/shared.h"
++#include "../modules/modules.h"
++
++void solutionsequence_la_theta(FemModel* femmodel){
++
++	/*intermediary: */
++	Matrix<IssmDouble>*  Kff = NULL;
++	Matrix<IssmDouble>*  Kfs = NULL;
++	Vector<IssmDouble>*  ug  = NULL;
++	Vector<IssmDouble>*  uf  = NULL;
++	Vector<IssmDouble>*  pf  = NULL;
++	Vector<IssmDouble>*  df  = NULL;
++	Vector<IssmDouble>*  ys  = NULL;
++	int  configuration_type;
++
++	/*Recover parameters: */
++	femmodel->parameters->FindParam(&configuration_type,ConfigurationTypeEnum);
++	femmodel->UpdateConstraintsx();
++	SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
++	_error_("STOP");
++	CreateNodalConstraintsx(&ys,femmodel->nodes,configuration_type);
++	Reduceloadx(pf, Kfs, ys); delete Kfs;
++	Solverx(&uf, Kff, pf, NULL, df, femmodel->parameters); 
++	delete Kff; delete pf; delete df;
++	Mergesolutionfromftogx(&ug, uf,ys,femmodel->nodes,femmodel->parameters);delete uf; delete ys;
++	InputUpdateFromSolutionx(femmodel,ug); 
++	delete ug;  
++}
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequences.h
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequences.h	(revision 17524)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequences.h	(revision 17525)
+@@ -17,6 +17,7 @@
+ void solutionsequence_newton(FemModel* femmodel);
+ void solutionsequence_FScoupling_nonlinear(FemModel* femmodel,bool conserve_loads);
+ void solutionsequence_linear(FemModel* femmodel);
++void solutionsequence_la_theta(FemModel* femmodel);
+ void solutionsequence_adjoint_linear(FemModel* femmodel);
+ 
+ /*convergence*/
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17524)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17525)
+@@ -354,6 +354,7 @@
+ 					./solutionsequences/solutionsequence_linear.cpp\
+ 					./solutionsequences/solutionsequence_nonlinear.cpp\
+ 					./solutionsequences/solutionsequence_newton.cpp\
++					./solutionsequences/solutionsequence_la_theta.cpp\
+ 					./solutionsequences/convergence.cpp\
+ 					./classes/Options/Options.h\
+ 					./classes/Options/Options.cpp\
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17524)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17525)
+@@ -1595,7 +1595,7 @@
+ /*FUNCTION Tria::ResetFSBasalBoundaryCondition{{{*/
+ void  Tria::ResetFSBasalBoundaryCondition(void){
+ 
+-	int numnodes = this->GetNumberOfNodes();
++	int numnodes = this->NumberofNodesVelocity();
+ 
+ 	int          approximation;
+ 	IssmDouble*  vertexonbed= NULL;
+@@ -1918,6 +1918,7 @@
+ 			tria_node_ids[6]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofelements+iomodel->elements[3*index+2];
+ 			break;
+ 		case TaylorHoodEnum:
++		case XTaylorHoodEnum:
+ 			numnodes        = 9;
+ 			tria_node_ids   = xNew<int>(numnodes);
+ 			tria_node_ids[0]=iomodel->nodecounter+iomodel->elements[3*index+0];
+Index: ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp	(revision 17524)
++++ ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp	(revision 17525)
+@@ -420,6 +420,7 @@
+ 			this->element_type = MINIEnum;
+ 			return;
+ 		case TaylorHoodEnum:
++		case XTaylorHoodEnum:
+ 			this->element_type = P2Enum;
+ 			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+ 			this->element_type = TaylorHoodEnum;
+@@ -587,6 +588,7 @@
+ 		case MINIcondensedEnum:     return NUMNODESP1b+NUMNODESP1;
+ 		case MINIEnum:              return NUMNODESP1b+NUMNODESP1;
+ 		case TaylorHoodEnum:        return NUMNODESP2+NUMNODESP1;
++		case XTaylorHoodEnum:       return NUMNODESP2+NUMNODESP1;
+ 		default: _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+ 	}
+ 
+@@ -602,6 +604,7 @@
+ 		case MINIcondensedEnum: return NUMNODESP1;
+ 		case MINIEnum:          return NUMNODESP1;
+ 		case TaylorHoodEnum:    return NUMNODESP1;
++		case XTaylorHoodEnum:   return NUMNODESP1;
+ 		default: _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+ 	}
+ 
+@@ -617,6 +620,7 @@
+ 		case MINIcondensedEnum: return NUMNODESP1b;
+ 		case MINIEnum:          return NUMNODESP1b;
+ 		case TaylorHoodEnum:    return NUMNODESP2;
++		case XTaylorHoodEnum:   return NUMNODESP2;
+ 		default:       _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+ 	}
+ 
+@@ -632,6 +636,7 @@
+ 		case MINIcondensedEnum: return P1bubbleEnum;
+ 		case MINIEnum:          return P1bubbleEnum;
+ 		case TaylorHoodEnum:    return P2Enum;
++		case XTaylorHoodEnum:   return P2Enum;
+ 		default:       _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+ 	}
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17525-17526.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17525-17526.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17525-17526.diff	(revision 17802)
@@ -0,0 +1,94 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17525)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17526)
+@@ -3386,24 +3386,27 @@
+ 	return pe;
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorFSViscousXTH(Element* element){/*{{{*/
+-	_error_("STOP");
+ 
+-	int         i,meshtype,dim;
+-	IssmDouble  Jdet,forcex,forcey,forcez;
++	int         i,tausize,meshtype,dim;
++	IssmDouble  Jdet,r;
+ 	IssmDouble *xyz_list = NULL;
+ 
+ 	/*Get problem dimension*/
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+ 	switch(meshtype){
+-		case Mesh2DverticalEnum: dim = 2; break;
+-		case Mesh3DEnum:         dim = 3; break;
+-		case Mesh3DtetrasEnum:   dim = 3; break;
++		case Mesh2DverticalEnum: dim = 2; tausize = 3; break;
++		case Mesh3DEnum:         dim = 3; tausize = 6; break;
++		case Mesh3DtetrasEnum:   dim = 3; tausize = 6; break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
++	/*FIXME*/
++	r = 1.;
++
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int vnumnodes = element->NumberofNodesVelocity();
+ 	int pnumnodes = element->NumberofNodesPressure();
++	int tnumnodes = element->GetNumberOfVertices();      //Tensors, P1 DG
+ 
+ 	/*Prepare coordinate system list*/
+ 	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+@@ -3412,43 +3415,19 @@
+ 	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
+ 
+ 	/*Initialize vectors*/
+-	ElementVector* pe     = element->NewElementVector(FSvelocityEnum);
+-	IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
++	ElementVector* pe    = element->NewElementVector(FSvelocityEnum);
++	IssmDouble*    Dstar = xNew<IssmDouble>(tausize*tnumnodes);
++	IssmDouble*    tau   = xNew<IssmDouble>(tausize);
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+-	IssmDouble  rho_ice =element->GetMaterialParameter(MaterialsRhoIceEnum);
+-	IssmDouble  gravity =element->GetMaterialParameter(ConstantsGEnum);
+-	Input*      loadingforcex_input=element->GetInput(LoadingforceXEnum);  _assert_(loadingforcex_input);
+-	Input*      loadingforcey_input=element->GetInput(LoadingforceYEnum);  _assert_(loadingforcey_input);
+-	Input*      loadingforcez_input=NULL;
+-	if(dim==3){
+-		loadingforcez_input=element->GetInput(LoadingforceZEnum);  _assert_(loadingforcez_input);
+-	}
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	Gauss* gauss=element->NewGauss(5);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		gauss->GaussPoint(ig);
+-
+ 		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+-		element->NodalFunctionsVelocity(vbasis,gauss);
+-
+-		loadingforcex_input->GetInputValue(&forcex,gauss);
+-		loadingforcey_input->GetInputValue(&forcey,gauss);
+-		if(dim==3) loadingforcez_input->GetInputValue(&forcez,gauss);
+-
+-		for(i=0;i<vnumnodes;i++){
+-			pe->values[i*dim+0] += +rho_ice*forcex *Jdet*gauss->weight*vbasis[i];
+-			pe->values[i*dim+1] += +rho_ice*forcey *Jdet*gauss->weight*vbasis[i];
+-			if(dim==3){
+-				pe->values[i*dim+2] += +rho_ice*forcez*Jdet*gauss->weight*vbasis[i];
+-				pe->values[i*dim+2] += -rho_ice*gravity*Jdet*gauss->weight*vbasis[i];
+-			}
+-			else{
+-				pe->values[i*dim+1] += -rho_ice*gravity*Jdet*gauss->weight*vbasis[i];
+-			}
+-		}
++		_error_("STOP");
+ 	}
+ 
+ 	/*Transform coordinate system*/
+@@ -3457,7 +3436,6 @@
+ 	/*Clean up and return*/
+ 	delete gauss;
+ 	xDelete<int>(cs_list);
+-	xDelete<IssmDouble>(vbasis);
+ 	xDelete<IssmDouble>(xyz_list);
+ 	return pe;
+ }/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17526-17527.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17526-17527.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17526-17527.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17526)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17527)
+@@ -1260,7 +1260,7 @@
+ void Tria::EdgeOnSurfaceIndices(int* pindex1,int* pindex2){
+ 
+ 	IssmDouble values[NUMVERTICES];
+-	int        indices[3][2] = {{1,2},{2,0},{0,1}};
++	int        indices[3][2] = {{2,1},{0,2},{1,0}}; //WARNING: reversed compared to bed!!
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	GetInputListOnVertices(&values[0],MeshVertexonsurfaceEnum);
Index: issm/oecreview/Archive/16554-17801/ISSM-17527-17528.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17527-17528.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17527-17528.diff	(revision 17802)
@@ -0,0 +1,42 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17527)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17528)
+@@ -837,7 +837,7 @@
+ 	femmodel->parameters->FindParam(&meshtype,MeshTypeEnum);
+ 	femmodel->parameters->FindParam(&newton,StressbalanceIsnewtonEnum);
+ 
+-	if(isFS){
++	if(isFS && !(isSSA || isHO || isL1L2)){
+ 		if(VerboseSolution()) _printf0_("   computing velocities\n");
+ 
+ 		femmodel->SetCurrentConfiguration(StressbalanceAnalysisEnum);
+@@ -848,7 +848,7 @@
+ 		else
+ 		 solutionsequence_nonlinear(femmodel,conserve_loads); 
+ 	}
+-	else if(isSSA || isHO || isL1L2){ 
++	else if(!isFS && (isSSA || isHO || isL1L2)){ 
+ 		if(VerboseSolution()) _printf0_("   computing velocities\n");
+ 
+ 		femmodel->SetCurrentConfiguration(StressbalanceAnalysisEnum);
+@@ -864,15 +864,14 @@
+ 			extrudefrombase_core(femmodel);
+ 		}
+ 	}
++	else if ((isSSA || isL1L2 || isHO) && isFS){
++		if(VerboseSolution()) _printf0_("   computing coupling between lower order models and FS\n");
++		solutionsequence_FScoupling_nonlinear(femmodel,conserve_loads);
++	}
+ 	else{
+ 		_error_("not supported");
+ 	}
+ 
+-	if ((isSSA || isL1L2 || isHO) && isFS){
+-		if(VerboseSolution()) _printf0_("   computing coupling between lower order models and FS\n");
+-		solutionsequence_FScoupling_nonlinear(femmodel,conserve_loads);
+-	}
+-
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreateDVector(Element* element){/*{{{*/
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17528-17529.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17528-17529.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17528-17529.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/test/Archives/Archive703.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17528)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17529)
+@@ -1260,7 +1260,7 @@
+ void Tria::EdgeOnSurfaceIndices(int* pindex1,int* pindex2){
+ 
+ 	IssmDouble values[NUMVERTICES];
+-	int        indices[3][2] = {{2,1},{0,2},{1,0}}; //WARNING: reversed compared to bed!!
++	int        indices[3][2] = {{1,2},{2,0},{0,1}};
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	GetInputListOnVertices(&values[0],MeshVertexonsurfaceEnum);
+@@ -1755,7 +1755,7 @@
+ 		case Mesh2DverticalEnum:
+ 			_assert_(HasEdgeOnSurface());
+ 			this->EdgeOnSurfaceIndices(&index1,&index2);
+-			return SpawnSeg(index1,index2);
++			return SpawnSeg(index2,index1); //reverse order
+ 		default:
+ 			_error_("not implemented yet");
+ 	}
Index: issm/oecreview/Archive/16554-17801/ISSM-17529-17530.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17529-17530.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17529-17530.diff	(revision 17802)
@@ -0,0 +1,14 @@
+Index: ../trunk-jpl/jenkins/imac-012301-gil
+===================================================================
+--- ../trunk-jpl/jenkins/imac-012301-gil	(revision 17529)
++++ ../trunk-jpl/jenkins/imac-012301-gil	(revision 17530)
+@@ -28,7 +28,8 @@
+ 	--with-blas-lapack-dir=$ISSM_DIR/externalpackages/petsc/install \
+ 	--with-scalapack-dir=$ISSM_DIR/externalpackages/petsc/install/ \
+ 	--with-mumps-dir=$ISSM_DIR/externalpackages/petsc/install \
+-	--with-tao-dir=$ISSM_DIR/externalpackages/tao/install'
++	--with-tao-dir=$ISSM_DIR/externalpackages/tao/install \
++	--enable-development
+ 
+ #MATLAB path
+ MATLAB_PATH="/Applications/MATLAB_R2011b.app/"
Index: issm/oecreview/Archive/16554-17801/ISSM-17530-17531.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17530-17531.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17530-17531.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/jenkins/imac-012301-gil
+===================================================================
+--- ../trunk-jpl/jenkins/imac-012301-gil	(revision 17530)
++++ ../trunk-jpl/jenkins/imac-012301-gil	(revision 17531)
+@@ -29,7 +29,7 @@
+ 	--with-scalapack-dir=$ISSM_DIR/externalpackages/petsc/install/ \
+ 	--with-mumps-dir=$ISSM_DIR/externalpackages/petsc/install \
+ 	--with-tao-dir=$ISSM_DIR/externalpackages/tao/install \
+-	--enable-development
++	--enable-development'
+ 
+ #MATLAB path
+ MATLAB_PATH="/Applications/MATLAB_R2011b.app/"
Index: issm/oecreview/Archive/16554-17801/ISSM-17531-17532.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17531-17532.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17531-17532.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17531)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17532)
+@@ -1604,7 +1604,7 @@
+ 
+ 	/*For FS only: we want the CS to be tangential to the bedrock*/
+ 	inputs->GetInputValue(&approximation,ApproximationEnum);
+-	if(IsFloating() || !HasNodeOnBed() ||  approximation!=FSApproximationEnum) return;
++	if(!HasNodeOnBed() ||  approximation!=FSApproximationEnum) return;
+ 
+ 	//printf("element number %i \n",this->id);
+ 	/*Get inputs*/
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17531)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17532)
+@@ -1904,7 +1904,7 @@
+ 
+ 	/*For FS only: we want the CS to be tangential to the bedrock*/
+ 	inputs->GetInputValue(&approximation,ApproximationEnum);
+-	if(IsFloating() || !IsOnBed() || (approximation!=FSApproximationEnum && approximation!=SSAFSApproximationEnum &&  approximation!=HOFSApproximationEnum)) return;
++	if(!IsOnBed() || (approximation!=FSApproximationEnum && approximation!=SSAFSApproximationEnum &&  approximation!=HOFSApproximationEnum)) return;
+ 
+ 	/*Get number of nodes for velocity only and base*/
+ 	BasalNodeIndices(&numindices,&indices,this->VelocityInterpolation());
Index: issm/oecreview/Archive/16554-17801/ISSM-17532-17533.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17532-17533.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17532-17533.diff	(revision 17802)
@@ -0,0 +1,14 @@
+Index: ../trunk-jpl/jenkins/windows
+===================================================================
+--- ../trunk-jpl/jenkins/windows	(revision 17532)
++++ ../trunk-jpl/jenkins/windows	(revision 17533)
+@@ -23,7 +23,8 @@
+ 	--with-blas-lapack-dir=$ISSM_DIR/externalpackages/petsc/install/lib/  \
+ 	--with-mpi-libdir="$ISSM_DIR/externalpackages/petsc/install/lib" \
+ 	--with-mpi-libflags="-Wl,libpetsc.lib" \
+-	--with-mpi-include="$ISSM_DIR/externalpackages/petsc/install/include/mpiuni"'
++	--with-mpi-include="$ISSM_DIR/externalpackages/petsc/install/include/mpiuni" \
++	--enable-development'
+ 
+ #MATLAB path
+ MATLAB_PATH="C:/MATLAB/R2013a/"
Index: issm/oecreview/Archive/16554-17801/ISSM-17533-17534.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17533-17534.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17533-17534.diff	(revision 17802)
@@ -0,0 +1,40 @@
+Index: ../trunk-jpl/test/Archives/Archive221.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive510.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive215.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive507.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive511.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive211.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive104.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive124.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive220.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive503.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17534-17535.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17534-17535.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17534-17535.diff	(revision 17802)
@@ -0,0 +1,445 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17534)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17535)
+@@ -3388,7 +3388,10 @@
+ 
+ 	int         i,tausize,meshtype,dim;
+ 	IssmDouble  Jdet,r;
++	IssmDouble  epsxx,epsyy,epszz,epsxy,epsxz,epsyz;
++	IssmDouble  sigmapxx,sigmapyy,sigmapzz,sigmapxy,sigmapxz,sigmapyz;
+ 	IssmDouble *xyz_list = NULL;
++	Gauss*      gauss    = NULL;
+ 
+ 	/*Get problem dimension*/
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+@@ -3411,21 +3414,67 @@
+ 	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+ 	if(dim==2) for(i=0;i<vnumnodes;i++) cs_list[i] = XYEnum;
+ 	else       for(i=0;i<vnumnodes;i++) cs_list[i] = XYZEnum;
+-	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
++	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i]  = PressureEnum;
+ 
+ 	/*Initialize vectors*/
+ 	ElementVector* pe    = element->NewElementVector(FSvelocityEnum);
+-	IssmDouble*    Dstar = xNew<IssmDouble>(tausize*tnumnodes);
+-	IssmDouble*    tau   = xNew<IssmDouble>(tausize);
++	IssmDouble*    Dstar = xNew<IssmDouble>((dim*vnumnodes)*(tausize*tnumnodes));
++	IssmDouble*    tau   = xNew<IssmDouble>(tausize*tnumnodes);
++	IssmDouble*    d     = xNew<IssmDouble>(tausize*tnumnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+ 
++	/*Get d and tau*/
++	Input* epsxx_input=element->GetInput(StrainRatexxEnum); _assert_(epsxx_input);
++	Input* epsyy_input=element->GetInput(StrainRateyyEnum); _assert_(epsyy_input);
++	Input* epsxy_input=element->GetInput(StrainRatexyEnum); _assert_(epsxy_input);
++	Input* epszz_input=NULL; Input* epsxz_input=NULL; Input* epsyz_input=NULL;
++	Input* sigmapxx_input=element->GetInput(DeviatoricStressxxEnum); _assert_(sigmapxx_input);
++	Input* sigmapyy_input=element->GetInput(DeviatoricStressyyEnum); _assert_(sigmapyy_input);
++	Input* sigmapxy_input=element->GetInput(DeviatoricStressxyEnum); _assert_(sigmapxy_input);
++	Input* sigmapzz_input=NULL; Input* sigmapxz_input=NULL; Input* sigmapyz_input=NULL;
++	if(dim==3){
++		epszz_input=element->GetInput(StrainRatezzEnum); _assert_(epszz_input);
++		epsxz_input=element->GetInput(StrainRatexzEnum); _assert_(epsxz_input);
++		epsyz_input=element->GetInput(StrainRateyzEnum); _assert_(epsyz_input);
++		sigmapzz_input=element->GetInput(DeviatoricStresszzEnum); _assert_(sigmapzz_input);
++		sigmapxz_input=element->GetInput(DeviatoricStressxzEnum); _assert_(sigmapxz_input);
++		sigmapyz_input=element->GetInput(DeviatoricStressyzEnum); _assert_(sigmapyz_input);
++	}
++	gauss = element->NewGauss();
++	for(int i=0;i<tnumnodes;i++){
++		gauss->GaussNode(P1DGEnum,i);
++
++		epsxx_input->GetInputValue(&epsxx,gauss); sigmapxx_input->GetInputValue(&sigmapxx,gauss);
++		epsyy_input->GetInputValue(&epsyy,gauss); sigmapyy_input->GetInputValue(&sigmapyy,gauss);
++		epsxy_input->GetInputValue(&epsxy,gauss); sigmapxy_input->GetInputValue(&sigmapxy,gauss);
++		if(dim==2){
++			d[i*tausize+0]=epsxx;  tau[i*tausize+0]=sigmapxx;
++			d[i*tausize+1]=epsyy;  tau[i*tausize+1]=sigmapyy;
++			d[i*tausize+2]=epsxy;  tau[i*tausize+2]=sigmapxy;
++		}
++		else{
++			epszz_input->GetInputValue(&epszz,gauss); sigmapzz_input->GetInputValue(&sigmapzz,gauss);
++			epsxz_input->GetInputValue(&epsxz,gauss); sigmapxz_input->GetInputValue(&sigmapxz,gauss);
++			epsyz_input->GetInputValue(&epsyz,gauss); sigmapyz_input->GetInputValue(&sigmapyz,gauss);
++			d[i*tausize+0]=epsxx;  tau[i*tausize+0]=sigmapxx;
++			d[i*tausize+1]=epsyy;  tau[i*tausize+1]=sigmapyy;
++			d[i*tausize+2]=epszz;  tau[i*tausize+2]=sigmapzz;
++			d[i*tausize+3]=epsxy;  tau[i*tausize+3]=sigmapxy;
++			d[i*tausize+4]=epsxz;  tau[i*tausize+4]=sigmapxz;
++			d[i*tausize+5]=epsyz;  tau[i*tausize+5]=sigmapyz;
++		}
++	}
++
+ 	/* Start  looping on the number of gaussian points: */
+-	Gauss* gauss=element->NewGauss(5);
++	delete gauss;
++	gauss=element->NewGauss(5);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		gauss->GaussPoint(ig);
+ 		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++
++		/*Create Dstar*/
+ 		_error_("STOP");
+ 	}
+ 
+@@ -3436,6 +3485,9 @@
+ 	delete gauss;
+ 	xDelete<int>(cs_list);
+ 	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(Dstar);
++	xDelete<IssmDouble>(d);
++	xDelete<IssmDouble>(tau);
+ 	return pe;
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorFSShelf(Element* element){/*{{{*/
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17534)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17535)
+@@ -538,6 +538,20 @@
+ 	StressTensoryyEnum,
+ 	StressTensoryzEnum,
+ 	StressTensorzzEnum,
++	DeviatoricStressEnum,
++	DeviatoricStressxxEnum,
++	DeviatoricStressxyEnum,
++	DeviatoricStressxzEnum,
++	DeviatoricStressyyEnum,
++	DeviatoricStressyzEnum,
++	DeviatoricStresszzEnum,
++	StrainRateEnum,
++	StrainRatexxEnum,
++	StrainRatexyEnum,
++	StrainRatexzEnum,
++	StrainRateyyEnum,
++	StrainRateyzEnum,
++	StrainRatezzEnum,
+ 	DivergenceEnum,
+ 	GiaCrossSectionShapeEnum,
+ 	GiadWdtEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17534)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17535)
+@@ -527,6 +527,20 @@
+ 		case StressTensoryyEnum : return "StressTensoryy";
+ 		case StressTensoryzEnum : return "StressTensoryz";
+ 		case StressTensorzzEnum : return "StressTensorzz";
++		case DeviatoricStressEnum : return "DeviatoricStress";
++		case DeviatoricStressxxEnum : return "DeviatoricStressxx";
++		case DeviatoricStressxyEnum : return "DeviatoricStressxy";
++		case DeviatoricStressxzEnum : return "DeviatoricStressxz";
++		case DeviatoricStressyyEnum : return "DeviatoricStressyy";
++		case DeviatoricStressyzEnum : return "DeviatoricStressyz";
++		case DeviatoricStresszzEnum : return "DeviatoricStresszz";
++		case StrainRateEnum : return "StrainRate";
++		case StrainRatexxEnum : return "StrainRatexx";
++		case StrainRatexyEnum : return "StrainRatexy";
++		case StrainRatexzEnum : return "StrainRatexz";
++		case StrainRateyyEnum : return "StrainRateyy";
++		case StrainRateyzEnum : return "StrainRateyz";
++		case StrainRatezzEnum : return "StrainRatezz";
+ 		case DivergenceEnum : return "Divergence";
+ 		case GiaCrossSectionShapeEnum : return "GiaCrossSectionShape";
+ 		case GiadWdtEnum : return "GiadWdt";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17534)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17535)
+@@ -539,6 +539,20 @@
+ 	      else if (strcmp(name,"StressTensoryy")==0) return StressTensoryyEnum;
+ 	      else if (strcmp(name,"StressTensoryz")==0) return StressTensoryzEnum;
+ 	      else if (strcmp(name,"StressTensorzz")==0) return StressTensorzzEnum;
++	      else if (strcmp(name,"DeviatoricStress")==0) return DeviatoricStressEnum;
++	      else if (strcmp(name,"DeviatoricStressxx")==0) return DeviatoricStressxxEnum;
++	      else if (strcmp(name,"DeviatoricStressxy")==0) return DeviatoricStressxyEnum;
++	      else if (strcmp(name,"DeviatoricStressxz")==0) return DeviatoricStressxzEnum;
++	      else if (strcmp(name,"DeviatoricStressyy")==0) return DeviatoricStressyyEnum;
++	      else if (strcmp(name,"DeviatoricStressyz")==0) return DeviatoricStressyzEnum;
++	      else if (strcmp(name,"DeviatoricStresszz")==0) return DeviatoricStresszzEnum;
++	      else if (strcmp(name,"StrainRate")==0) return StrainRateEnum;
++	      else if (strcmp(name,"StrainRatexx")==0) return StrainRatexxEnum;
++	      else if (strcmp(name,"StrainRatexy")==0) return StrainRatexyEnum;
++	      else if (strcmp(name,"StrainRatexz")==0) return StrainRatexzEnum;
++	      else if (strcmp(name,"StrainRateyy")==0) return StrainRateyyEnum;
++	      else if (strcmp(name,"StrainRateyz")==0) return StrainRateyzEnum;
++	      else if (strcmp(name,"StrainRatezz")==0) return StrainRatezzEnum;
+ 	      else if (strcmp(name,"Divergence")==0) return DivergenceEnum;
+ 	      else if (strcmp(name,"GiaCrossSectionShape")==0) return GiaCrossSectionShapeEnum;
+ 	      else if (strcmp(name,"GiadWdt")==0) return GiadWdtEnum;
+@@ -614,7 +628,10 @@
+ 	      else if (strcmp(name,"FSSolver")==0) return FSSolverEnum;
+ 	      else if (strcmp(name,"Adjoint")==0) return AdjointEnum;
+ 	      else if (strcmp(name,"Colinear")==0) return ColinearEnum;
+-	      else if (strcmp(name,"ControlSteady")==0) return ControlSteadyEnum;
++         else stage=6;
++   }
++   if(stage==6){
++	      if (strcmp(name,"ControlSteady")==0) return ControlSteadyEnum;
+ 	      else if (strcmp(name,"Fset")==0) return FsetEnum;
+ 	      else if (strcmp(name,"Gradient1")==0) return Gradient1Enum;
+ 	      else if (strcmp(name,"Gradient2")==0) return Gradient2Enum;
+@@ -628,10 +645,7 @@
+ 	      else if (strcmp(name,"Nodal")==0) return NodalEnum;
+ 	      else if (strcmp(name,"OldGradient")==0) return OldGradientEnum;
+ 	      else if (strcmp(name,"OutputFilePointer")==0) return OutputFilePointerEnum;
+-         else stage=6;
+-   }
+-   if(stage==6){
+-	      if (strcmp(name,"OutputFileName")==0) return OutputFileNameEnum;
++	      else if (strcmp(name,"OutputFileName")==0) return OutputFileNameEnum;
+ 	      else if (strcmp(name,"LockFileName")==0) return LockFileNameEnum;
+ 	      else if (strcmp(name,"ToolkitsOptionsAnalyses")==0) return ToolkitsOptionsAnalysesEnum;
+ 	      else if (strcmp(name,"ToolkitsOptionsStrings")==0) return ToolkitsOptionsStringsEnum;
+Index: ../trunk-jpl/src/m/enum/DeviatoricStressxzEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/DeviatoricStressxzEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/DeviatoricStressxzEnum.m	(revision 17535)
+@@ -0,0 +1,11 @@
++function macro=DeviatoricStressxzEnum()
++%DEVIATORICSTRESSXZENUM - Enum of DeviatoricStressxz
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=DeviatoricStressxzEnum()
++
++macro=StringToEnum('DeviatoricStressxz');
+Index: ../trunk-jpl/src/m/enum/DeviatoricStressyyEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/DeviatoricStressyyEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/DeviatoricStressyyEnum.m	(revision 17535)
+@@ -0,0 +1,11 @@
++function macro=DeviatoricStressyyEnum()
++%DEVIATORICSTRESSYYENUM - Enum of DeviatoricStressyy
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=DeviatoricStressyyEnum()
++
++macro=StringToEnum('DeviatoricStressyy');
+Index: ../trunk-jpl/src/m/enum/StrainRateyzEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/StrainRateyzEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/StrainRateyzEnum.m	(revision 17535)
+@@ -0,0 +1,11 @@
++function macro=StrainRateyzEnum()
++%STRAINRATEYZENUM - Enum of StrainRateyz
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=StrainRateyzEnum()
++
++macro=StringToEnum('StrainRateyz');
+Index: ../trunk-jpl/src/m/enum/DeviatoricStressyzEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/DeviatoricStressyzEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/DeviatoricStressyzEnum.m	(revision 17535)
+@@ -0,0 +1,11 @@
++function macro=DeviatoricStressyzEnum()
++%DEVIATORICSTRESSYZENUM - Enum of DeviatoricStressyz
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=DeviatoricStressyzEnum()
++
++macro=StringToEnum('DeviatoricStressyz');
+Index: ../trunk-jpl/src/m/enum/StrainRatezzEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/StrainRatezzEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/StrainRatezzEnum.m	(revision 17535)
+@@ -0,0 +1,11 @@
++function macro=StrainRatezzEnum()
++%STRAINRATEZZENUM - Enum of StrainRatezz
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=StrainRatezzEnum()
++
++macro=StringToEnum('StrainRatezz');
+Index: ../trunk-jpl/src/m/enum/DeviatoricStresszzEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/DeviatoricStresszzEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/DeviatoricStresszzEnum.m	(revision 17535)
+@@ -0,0 +1,11 @@
++function macro=DeviatoricStresszzEnum()
++%DEVIATORICSTRESSZZENUM - Enum of DeviatoricStresszz
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=DeviatoricStresszzEnum()
++
++macro=StringToEnum('DeviatoricStresszz');
+Index: ../trunk-jpl/src/m/enum/StrainRatexxEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/StrainRatexxEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/StrainRatexxEnum.m	(revision 17535)
+@@ -0,0 +1,11 @@
++function macro=StrainRatexxEnum()
++%STRAINRATEXXENUM - Enum of StrainRatexx
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=StrainRatexxEnum()
++
++macro=StringToEnum('StrainRatexx');
+Index: ../trunk-jpl/src/m/enum/DeviatoricStressxxEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/DeviatoricStressxxEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/DeviatoricStressxxEnum.m	(revision 17535)
+@@ -0,0 +1,11 @@
++function macro=DeviatoricStressxxEnum()
++%DEVIATORICSTRESSXXENUM - Enum of DeviatoricStressxx
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=DeviatoricStressxxEnum()
++
++macro=StringToEnum('DeviatoricStressxx');
+Index: ../trunk-jpl/src/m/enum/StrainRatexyEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/StrainRatexyEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/StrainRatexyEnum.m	(revision 17535)
+@@ -0,0 +1,11 @@
++function macro=StrainRatexyEnum()
++%STRAINRATEXYENUM - Enum of StrainRatexy
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=StrainRatexyEnum()
++
++macro=StringToEnum('StrainRatexy');
+Index: ../trunk-jpl/src/m/enum/StrainRateEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/StrainRateEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/StrainRateEnum.m	(revision 17535)
+@@ -0,0 +1,11 @@
++function macro=StrainRateEnum()
++%STRAINRATEENUM - Enum of StrainRate
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=StrainRateEnum()
++
++macro=StringToEnum('StrainRate');
+Index: ../trunk-jpl/src/m/enum/DeviatoricStressEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/DeviatoricStressEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/DeviatoricStressEnum.m	(revision 17535)
+@@ -0,0 +1,11 @@
++function macro=DeviatoricStressEnum()
++%DEVIATORICSTRESSENUM - Enum of DeviatoricStress
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=DeviatoricStressEnum()
++
++macro=StringToEnum('DeviatoricStress');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17534)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17535)
+@@ -519,6 +519,20 @@
+ def StressTensoryyEnum(): return StringToEnum("StressTensoryy")[0]
+ def StressTensoryzEnum(): return StringToEnum("StressTensoryz")[0]
+ def StressTensorzzEnum(): return StringToEnum("StressTensorzz")[0]
++def DeviatoricStressEnum(): return StringToEnum("DeviatoricStress")[0]
++def DeviatoricStressxxEnum(): return StringToEnum("DeviatoricStressxx")[0]
++def DeviatoricStressxyEnum(): return StringToEnum("DeviatoricStressxy")[0]
++def DeviatoricStressxzEnum(): return StringToEnum("DeviatoricStressxz")[0]
++def DeviatoricStressyyEnum(): return StringToEnum("DeviatoricStressyy")[0]
++def DeviatoricStressyzEnum(): return StringToEnum("DeviatoricStressyz")[0]
++def DeviatoricStresszzEnum(): return StringToEnum("DeviatoricStresszz")[0]
++def StrainRateEnum(): return StringToEnum("StrainRate")[0]
++def StrainRatexxEnum(): return StringToEnum("StrainRatexx")[0]
++def StrainRatexyEnum(): return StringToEnum("StrainRatexy")[0]
++def StrainRatexzEnum(): return StringToEnum("StrainRatexz")[0]
++def StrainRateyyEnum(): return StringToEnum("StrainRateyy")[0]
++def StrainRateyzEnum(): return StringToEnum("StrainRateyz")[0]
++def StrainRatezzEnum(): return StringToEnum("StrainRatezz")[0]
+ def DivergenceEnum(): return StringToEnum("Divergence")[0]
+ def GiaCrossSectionShapeEnum(): return StringToEnum("GiaCrossSectionShape")[0]
+ def GiadWdtEnum(): return StringToEnum("GiadWdt")[0]
+Index: ../trunk-jpl/src/m/enum/DeviatoricStressxyEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/DeviatoricStressxyEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/DeviatoricStressxyEnum.m	(revision 17535)
+@@ -0,0 +1,11 @@
++function macro=DeviatoricStressxyEnum()
++%DEVIATORICSTRESSXYENUM - Enum of DeviatoricStressxy
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=DeviatoricStressxyEnum()
++
++macro=StringToEnum('DeviatoricStressxy');
+Index: ../trunk-jpl/src/m/enum/StrainRatexzEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/StrainRatexzEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/StrainRatexzEnum.m	(revision 17535)
+@@ -0,0 +1,11 @@
++function macro=StrainRatexzEnum()
++%STRAINRATEXZENUM - Enum of StrainRatexz
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=StrainRatexzEnum()
++
++macro=StringToEnum('StrainRatexz');
+Index: ../trunk-jpl/src/m/enum/StrainRateyyEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/StrainRateyyEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/StrainRateyyEnum.m	(revision 17535)
+@@ -0,0 +1,11 @@
++function macro=StrainRateyyEnum()
++%STRAINRATEYYENUM - Enum of StrainRateyy
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=StrainRateyyEnum()
++
++macro=StringToEnum('StrainRateyy');
Index: issm/oecreview/Archive/16554-17801/ISSM-17535-17536.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17535-17536.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17535-17536.diff	(revision 17802)
@@ -0,0 +1,283 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17535)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17536)
+@@ -3417,10 +3417,12 @@
+ 	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i]  = PressureEnum;
+ 
+ 	/*Initialize vectors*/
+-	ElementVector* pe    = element->NewElementVector(FSvelocityEnum);
+-	IssmDouble*    Dstar = xNew<IssmDouble>((dim*vnumnodes)*(tausize*tnumnodes));
+-	IssmDouble*    tau   = xNew<IssmDouble>(tausize*tnumnodes);
+-	IssmDouble*    d     = xNew<IssmDouble>(tausize*tnumnodes);
++	ElementVector* pe      = element->NewElementVector(FSvelocityEnum);
++	IssmDouble*    Dstar   = xNew<IssmDouble>((dim*vnumnodes)*(tausize*tnumnodes));
++	IssmDouble*    tau     = xNew<IssmDouble>(tausize*tnumnodes);
++	IssmDouble*    d       = xNew<IssmDouble>(tausize*tnumnodes);
++	IssmDouble*    vdbasis = xNew<IssmDouble>(dim*vnumnodes);
++	IssmDouble*    tbasis  = xNew<IssmDouble>(tnumnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+@@ -3475,6 +3477,9 @@
+ 		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+ 
+ 		/*Create Dstar*/
++		element->NodalFunctionsDerivativesVelocity(vdbasis,xyz_list,gauss);
++		element->NodalFunctionsTensor(tbasis,gauss);
++
+ 		_error_("STOP");
+ 	}
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17535)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17536)
+@@ -157,6 +157,7 @@
+ 		virtual void   NodalFunctionsP1(IssmDouble* basis,Gauss* gauss)=0;
+ 		virtual void   NodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss)=0;
+ 		virtual void   NodalFunctionsPressure(IssmDouble* basis, Gauss* gauss)=0;
++		virtual void   NodalFunctionsTensor(IssmDouble* basis, Gauss* gauss)=0;
+ 		virtual void   NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss)=0;
+ 		virtual void   NodalFunctionsP1Derivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss)=0;
+ 		virtual void   NodalFunctionsMINIDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17535)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17536)
+@@ -1418,6 +1418,14 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Tria::NodalFunctionsTensor{{{*/
++void Tria::NodalFunctionsTensor(IssmDouble* basis, Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussTriaEnum);
++	this->GetNodalFunctionsTensor(basis,(GaussTria*)gauss);
++
++}
++/*}}}*/
+ /*FUNCTION Tria::NodalValue {{{*/
+ int    Tria::NodalValue(IssmDouble* pvalue, int index, int natureofdataenum){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/TriaRef.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TriaRef.h	(revision 17535)
++++ ../trunk-jpl/src/c/classes/Elements/TriaRef.h	(revision 17536)
+@@ -30,6 +30,7 @@
+ 		void GetNodalFunctions(IssmDouble* basis,Gauss* gauss,int finiteelement);
+ 		void GetNodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss);
+ 		void GetNodalFunctionsPressure(IssmDouble* basis, Gauss* gauss);
++		void GetNodalFunctionsTensor(IssmDouble* basis, Gauss* gauss);
+ 		void GetSegmentNodalFunctions(IssmDouble* basis,Gauss* gauss, int index1,int index2);
+ 		void GetSegmentBFlux(IssmDouble* B,Gauss* gauss, int index1,int index2);
+ 		void GetSegmentBprimeFlux(IssmDouble* Bprime,Gauss* gauss, int index1,int index2);
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17535)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17536)
+@@ -213,6 +213,7 @@
+ 		void           NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+ 		void           NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss);
+ 		void           NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss);
++		void           NodalFunctionsTensor(IssmDouble* basis,Gauss* gauss);
+ 		void	         SetClone(int* minranks);
+ 		void           SetTemporaryElementType(int element_type_in){_error_("not implemented yet");};
+ 		Seg*	         SpawnSeg(int index1,int index2);
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17535)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17536)
+@@ -353,6 +353,17 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION PentaRef::GetNodalFunctionsTensor{{{*/
++void PentaRef::GetNodalFunctionsTensor(IssmDouble* basis,Gauss* gauss){
++	/*This routine returns the values of the nodal functions  at the gaussian point.*/
++
++	int save = this->element_type;
++	this->element_type = TensorInterpolation();
++	this->GetNodalFunctions(basis,gauss);
++	this->element_type = save;
++
++}
++/*}}}*/
+ /*FUNCTION PentaRef::GetNodalFunctionsDerivatives{{{*/
+ void PentaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){
+ 
+@@ -1191,6 +1202,17 @@
+ 	return -1;
+ }
+ /*}}}*/
++/*FUNCTION PentaRef::TensorInterpolation{{{*/
++int PentaRef::TensorInterpolation(void){
++
++	switch(this->element_type){
++		case XTaylorHoodEnum:    return P1DGEnum;
++		default: _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
++	}
++
++	return -1;
++}
++/*}}}*/
+ /*FUNCTION PentaRef::BasalNodeIndices{{{*/
+ void PentaRef::BasalNodeIndices(int* pnumindices,int** pindices,int finiteelement){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17535)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17536)
+@@ -1727,6 +1727,14 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Penta::NodalFunctionsTensor{{{*/
++void Penta::NodalFunctionsTensor(IssmDouble* basis, Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussPentaEnum);
++	this->GetNodalFunctionsTensor(basis,(GaussPenta*)gauss);
++
++}
++/*}}}*/
+ /*FUNCTION Penta::NormalBase {{{*/
+ void Penta::NormalBase(IssmDouble* bed_normal,IssmDouble* xyz_list){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.h	(revision 17535)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.h	(revision 17536)
+@@ -25,6 +25,7 @@
+ 		void GetNodalFunctions(IssmDouble* basis, Gauss* gauss,int finiteelement);
+ 		void GetNodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss);
+ 		void GetNodalFunctionsPressure(IssmDouble* basis, Gauss* gauss);
++		void GetNodalFunctionsTensor(IssmDouble* basis, Gauss* gauss);
+ 		void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetNodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetNodalFunctionsDerivativesPressure(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+@@ -54,5 +55,6 @@
+ 		int  NumberofNodesPressure(void);
+ 		int  VelocityInterpolation(void);
+ 		int  PressureInterpolation(void);
++		int  TensorInterpolation(void);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp	(revision 17535)
++++ ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp	(revision 17536)
+@@ -171,6 +171,21 @@
+ 	}
+ }
+ /*}}}*/
++/*FUNCTION TetraRef::GetNodalFunctionsTensor{{{*/
++void TetraRef::GetNodalFunctionsTensor(IssmDouble* basis,GaussTetra* gauss){
++	/*This routine returns the values of the nodal functions  at the gaussian point.*/
++
++	switch(this->element_type){
++		case XTaylorHoodEnum:
++			this->element_type = P1DGEnum;
++			this->GetNodalFunctions(basis,gauss);
++			this->element_type = XTaylorHoodEnum;
++			return;
++		default:
++			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
++	}
++}
++/*}}}*/
+ /*FUNCTION TetraRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss){{{*/
+ void TetraRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss){
+ 	GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss,this->element_type);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17535)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17536)
+@@ -208,6 +208,7 @@
+ 		void           NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+ 		void           NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss);
+ 		void           NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss);
++		void           NodalFunctionsTensor(IssmDouble* basis,Gauss* gauss);
+ 		IssmDouble     MinEdgeLength(IssmDouble* xyz_list);
+ 		void	         SetClone(int* minranks);
+ 		Tria*	         SpawnTria(int index1,int index2,int index3);
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17535)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17536)
+@@ -511,6 +511,14 @@
+ 
+ }
+ /*}}}*/
++/*FUNCTION Tetra::NodalFunctionsTensor{{{*/
++void Tetra::NodalFunctionsTensor(IssmDouble* basis, Gauss* gauss){
++
++	_assert_(gauss->Enum()==GaussTetraEnum);
++	this->GetNodalFunctionsTensor(basis,(GaussTetra*)gauss);
++
++}
++/*}}}*/
+ /*FUNCTION Tetra::NodalFunctionsDerivatives{{{*/
+ void Tetra::NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/TetraRef.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TetraRef.h	(revision 17535)
++++ ../trunk-jpl/src/c/classes/Elements/TetraRef.h	(revision 17536)
+@@ -30,6 +30,7 @@
+ 		void GetNodalFunctions(IssmDouble* basis,GaussTetra* gauss,int finiteelement);
+ 		void GetNodalFunctionsVelocity(IssmDouble* basis, GaussTetra* gauss);
+ 		void GetNodalFunctionsPressure(IssmDouble* basis, GaussTetra* gauss);
++		void GetNodalFunctionsTensor(IssmDouble* basis, GaussTetra* gauss);
+ 		void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss);
+ 		void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss,int finiteelement);
+ 		void GetNodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,GaussTetra* gauss);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17535)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17536)
+@@ -83,6 +83,7 @@
+ 		void        NodalFunctionsP1(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
++		void        NodalFunctionsTensor(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+ 		void        NodalFunctionsP1Derivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsMINIDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17535)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17536)
+@@ -87,6 +87,7 @@
+ 		void        NodalFunctionsP1(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss);
+ 		void        NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss);
++		void        NodalFunctionsTensor(IssmDouble* basis,Gauss* gauss);
+ 		void        NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+ 		void        NodalFunctionsP1Derivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		void        NodalFunctionsMINIDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp	(revision 17535)
++++ ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp	(revision 17536)
+@@ -285,6 +285,21 @@
+ 	}
+ }
+ /*}}}*/
++/*FUNCTION TriaRef::GetNodalFunctionsTensor{{{*/
++void TriaRef::GetNodalFunctionsTensor(IssmDouble* basis,Gauss* gauss){
++	/*This routine returns the values of the nodal functions  at the gaussian point.*/
++
++	switch(this->element_type){
++		case XTaylorHoodEnum:
++			this->element_type = P1DGEnum;
++			this->GetNodalFunctions(basis,gauss);
++			this->element_type = XTaylorHoodEnum;
++			return;
++		default:
++			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
++	}
++}
++/*}}}*/
+ /*FUNCTION TriaRef::GetSegmentNodalFunctions{{{*/
+ void TriaRef::GetSegmentNodalFunctions(IssmDouble* basis,Gauss* gauss,int index1,int index2){
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17536-17537.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17536-17537.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17536-17537.diff	(revision 17802)
@@ -0,0 +1,73 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17536)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17537)
+@@ -3418,7 +3418,7 @@
+ 
+ 	/*Initialize vectors*/
+ 	ElementVector* pe      = element->NewElementVector(FSvelocityEnum);
+-	IssmDouble*    Dstar   = xNew<IssmDouble>((dim*vnumnodes)*(tausize*tnumnodes));
++	IssmDouble*    Dstar   = xNewZeroInit<IssmDouble>((dim*vnumnodes)*(tausize*tnumnodes));
+ 	IssmDouble*    tau     = xNew<IssmDouble>(tausize*tnumnodes);
+ 	IssmDouble*    d       = xNew<IssmDouble>(tausize*tnumnodes);
+ 	IssmDouble*    vdbasis = xNew<IssmDouble>(dim*vnumnodes);
+@@ -3477,10 +3477,58 @@
+ 		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+ 
+ 		/*Create Dstar*/
++		/*In dim = 2
++		 *
++		 *       <----------------- tausize ---------------> x tnumnodes
++		 *       |  gamma_ij^x         0       gamma_ij^y  | ^
++		 * Dij = |                                         | dim
++		 *       |     0          gamma_ij^y   gamma_ij^x  | v
++		 *                                                   x
++		 *                                                   vnumnodes
++		 *
++		 *In dim = 3
++		 *
++		 *       |  gamma_ij^x         0          0         gamma_ij^y  gamma_ij^z      0      |
++		 *       |                                                                             |
++		 * Dij = |     0          gamma_ij^y      0         gamma_ij^x     0        gamma_ij^z |
++		 *       |                                                                             |
++		 *       |     0               0      gamma_ij^z        0       gamma_ij^x  gamma_ij^y |
++		 *
++		 * gamma_ij^x = zeta_j dphi_i/dx
++		 *
++		 * where:
++		 *   - zeta_j is the nodal function for the j^th node of the tensor (P1DG)
++		 *   - phi_i  is the nodal function for the i^th node of the velocity (P2)*/
+ 		element->NodalFunctionsDerivativesVelocity(vdbasis,xyz_list,gauss);
+ 		element->NodalFunctionsTensor(tbasis,gauss);
++		if(dim==2){
++			for(int i=0;i<vnumnodes;i++){
++				for(int j=0;j<tnumnodes;j++){
++					Dstar[(i*dim+0)*tausize*tnumnodes + j*tausize+0] = tbasis[j]*vdbasis[0*vnumnodes+i];
++					Dstar[(i*dim+0)*tausize*tnumnodes + j*tausize+2] = tbasis[j]*vdbasis[1*vnumnodes+i];
+ 
+-		_error_("STOP");
++					Dstar[(i*dim+1)*tausize*tnumnodes + j*tausize+1] = tbasis[j]*vdbasis[1*vnumnodes+i];
++					Dstar[(i*dim+1)*tausize*tnumnodes + j*tausize+2] = tbasis[j]*vdbasis[0*vnumnodes+i];
++				}
++			}
++		}
++		else{
++			for(int i=0;i<vnumnodes;i++){
++				for(int j=0;j<tnumnodes;j++){
++					Dstar[(i*dim+0)*tausize*tnumnodes + j*tausize+0] = tbasis[j]*vdbasis[0*vnumnodes+i];
++					Dstar[(i*dim+0)*tausize*tnumnodes + j*tausize+3] = tbasis[j]*vdbasis[1*vnumnodes+i];
++					Dstar[(i*dim+0)*tausize*tnumnodes + j*tausize+4] = tbasis[j]*vdbasis[2*vnumnodes+i];
++
++					Dstar[(i*dim+1)*tausize*tnumnodes + j*tausize+1] = tbasis[j]*vdbasis[1*vnumnodes+i];
++					Dstar[(i*dim+1)*tausize*tnumnodes + j*tausize+3] = tbasis[j]*vdbasis[0*vnumnodes+i];
++					Dstar[(i*dim+1)*tausize*tnumnodes + j*tausize+5] = tbasis[j]*vdbasis[2*vnumnodes+i];
++
++					Dstar[(i*dim+2)*tausize*tnumnodes + j*tausize+2] = tbasis[j]*vdbasis[2*vnumnodes+i];
++					Dstar[(i*dim+2)*tausize*tnumnodes + j*tausize+4] = tbasis[j]*vdbasis[0*vnumnodes+i];
++					Dstar[(i*dim+2)*tausize*tnumnodes + j*tausize+5] = tbasis[j]*vdbasis[1*vnumnodes+i];
++				}
++			}
++		}
+ 	}
+ 
+ 	/*Transform coordinate system*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17537-17538.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17537-17538.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17537-17538.diff	(revision 17802)
@@ -0,0 +1,41 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17537)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17538)
+@@ -3423,6 +3423,7 @@
+ 	IssmDouble*    d       = xNew<IssmDouble>(tausize*tnumnodes);
+ 	IssmDouble*    vdbasis = xNew<IssmDouble>(dim*vnumnodes);
+ 	IssmDouble*    tbasis  = xNew<IssmDouble>(tnumnodes);
++	IssmDouble*    D       = xNewZeroInit<IssmDouble>(tausize*tnumnodes*tausize*tnumnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+@@ -3529,6 +3530,20 @@
+ 				}
+ 			}
+ 		}
++
++		/*contribution -Dstar tau*/
++		for(i=0;i<tausize*tnumnodes;i++) D[i*(tausize*tnumnodes)+i] = -gauss->weight*Jdet;
++		TripleMultiply(Dstar,dim*tnumnodes,tausize*tnumnodes,0,
++					D,tausize*tnumnodes,tausize*tnumnodes,0,
++					tau,tausize*tnumnodes,1,0,
++					&pe->values[0],1);
++
++		/*contribution + r Dstar d*/
++		for(i=0;i<tausize*tnumnodes;i++) D[i*(tausize*tnumnodes)+i] = +r*gauss->weight*Jdet;
++		TripleMultiply(Dstar,dim*tnumnodes,tausize*tnumnodes,0,
++					D,tausize*tnumnodes,tausize*tnumnodes,0,
++					d,tausize*tnumnodes,1,0,
++					&pe->values[0],1);
+ 	}
+ 
+ 	/*Transform coordinate system*/
+@@ -3540,6 +3555,7 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(Dstar);
+ 	xDelete<IssmDouble>(d);
++	xDelete<IssmDouble>(D);
+ 	xDelete<IssmDouble>(tau);
+ 	return pe;
+ }/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17538-17539.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17538-17539.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17538-17539.diff	(revision 17802)
@@ -0,0 +1,81 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17538)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17539)
+@@ -18,6 +18,7 @@
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
++		void InitializeXTH(Elements* elements);
+ 
+ 		/*Finite element Analysis*/
+ 		void           Core(FemModel* femmodel);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17538)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17539)
+@@ -233,6 +233,7 @@
+ 		iomodel->FetchDataToInput(elements,MeshVertexonbedEnum);
+ 		iomodel->FetchDataToInput(elements,PressureEnum,0.);
+ 		if(dakota_analysis)elements->InputDuplicate(PressureEnum,QmuPressureEnum);
++		if(finiteelement==XTaylorHoodEnum) this->InitializeXTH(elements);
+ 	}
+ 	if(islevelset){
+ 		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
+@@ -819,7 +820,56 @@
+ 		xDelete<IssmDouble>(riftinfo);
+ 	}
+ }/*}}}*/
++void StressbalanceAnalysis::InitializeXTH(Elements* elements){/*{{{*/
+ 
++	/*Intermediaries*/
++	int        meshtype,dim;
++	IssmDouble dvx[3],dvy[3],dvz[3];
++	IssmDouble viscosity;
++	IssmDouble *xyz_list = NULL;
++
++	for(int i=0;i<elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
++
++		/*Get problem dimension*/
++		element->FindParam(&meshtype,MeshTypeEnum);
++		switch(meshtype){
++			case Mesh2DverticalEnum: dim = 2; break;
++			case Mesh3DEnum:         dim = 3; break;
++			case Mesh3DtetrasEnum:   dim = 3; break;
++			default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++		}
++
++		int tnumnodes = element->GetNumberOfVertices();      //Tensors, P1 DG
++
++		/*Get inputs and parameters*/
++		element->GetVerticesCoordinates(&xyz_list);
++		Input* vx_input=element->GetInput(VxEnum); _assert_(vx_input);
++		Input* vy_input=element->GetInput(VyEnum); _assert_(vy_input);
++		Input* vz_input;
++		if(dim==3){vz_input=element->GetInput(VzEnum); _assert_(vz_input);}
++
++		/*Get d and tau*/
++		Gauss* gauss = element->NewGauss();
++		for(int i=0;i<tnumnodes;i++){
++			gauss->GaussNode(P1DGEnum,i);
++
++			vx_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
++			vy_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
++			if(dim==3){
++				vz_input->GetInputDerivativeValue(&dvz[0],xyz_list,gauss);
++			}
++
++			_error_("STOP");
++			element->ViscosityFS(&viscosity,dim,xyz_list,gauss,vx_input,vy_input,vz_input);
++		}
++
++		/*Clean up*/
++		xDelete<IssmDouble>(xyz_list);
++	}
++
++}/*}}}*/
++
+ /*Finite Element Analysis*/
+ void           StressbalanceAnalysis::Core(FemModel* femmodel){/*{{{*/
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17539-17540.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17539-17540.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17539-17540.diff	(revision 17802)
@@ -0,0 +1,253 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17539)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17540)
+@@ -18,7 +18,6 @@
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+ 		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+ 		void CreateLoads(Loads* loads, IoModel* iomodel);
+-		void InitializeXTH(Elements* elements);
+ 
+ 		/*Finite element Analysis*/
+ 		void           Core(FemModel* femmodel);
+@@ -81,6 +80,7 @@
+ 		void GetBFSFriction(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputsFS(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolutionFS(IssmDouble* solution,Element* element);
++		void InitializeXTH(Elements* elements,Parameters* parameters);
+ 		/*Coupling*/
+ 		ElementMatrix* CreateKMatrixSSA3d(Element* element);
+ 		ElementMatrix* CreateKMatrixSSA3dFriction(Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17539)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17540)
+@@ -233,7 +233,6 @@
+ 		iomodel->FetchDataToInput(elements,MeshVertexonbedEnum);
+ 		iomodel->FetchDataToInput(elements,PressureEnum,0.);
+ 		if(dakota_analysis)elements->InputDuplicate(PressureEnum,QmuPressureEnum);
+-		if(finiteelement==XTaylorHoodEnum) this->InitializeXTH(elements);
+ 	}
+ 	if(islevelset){
+ 		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
+@@ -820,56 +819,7 @@
+ 		xDelete<IssmDouble>(riftinfo);
+ 	}
+ }/*}}}*/
+-void StressbalanceAnalysis::InitializeXTH(Elements* elements){/*{{{*/
+ 
+-	/*Intermediaries*/
+-	int        meshtype,dim;
+-	IssmDouble dvx[3],dvy[3],dvz[3];
+-	IssmDouble viscosity;
+-	IssmDouble *xyz_list = NULL;
+-
+-	for(int i=0;i<elements->Size();i++){
+-		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+-
+-		/*Get problem dimension*/
+-		element->FindParam(&meshtype,MeshTypeEnum);
+-		switch(meshtype){
+-			case Mesh2DverticalEnum: dim = 2; break;
+-			case Mesh3DEnum:         dim = 3; break;
+-			case Mesh3DtetrasEnum:   dim = 3; break;
+-			default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+-		}
+-
+-		int tnumnodes = element->GetNumberOfVertices();      //Tensors, P1 DG
+-
+-		/*Get inputs and parameters*/
+-		element->GetVerticesCoordinates(&xyz_list);
+-		Input* vx_input=element->GetInput(VxEnum); _assert_(vx_input);
+-		Input* vy_input=element->GetInput(VyEnum); _assert_(vy_input);
+-		Input* vz_input;
+-		if(dim==3){vz_input=element->GetInput(VzEnum); _assert_(vz_input);}
+-
+-		/*Get d and tau*/
+-		Gauss* gauss = element->NewGauss();
+-		for(int i=0;i<tnumnodes;i++){
+-			gauss->GaussNode(P1DGEnum,i);
+-
+-			vx_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
+-			vy_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
+-			if(dim==3){
+-				vz_input->GetInputDerivativeValue(&dvz[0],xyz_list,gauss);
+-			}
+-
+-			_error_("STOP");
+-			element->ViscosityFS(&viscosity,dim,xyz_list,gauss,vx_input,vy_input,vz_input);
+-		}
+-
+-		/*Clean up*/
+-		xDelete<IssmDouble>(xyz_list);
+-	}
+-
+-}/*}}}*/
+-
+ /*Finite Element Analysis*/
+ void           StressbalanceAnalysis::Core(FemModel* femmodel){/*{{{*/
+ 
+@@ -4108,6 +4058,90 @@
+ 	xDelete<IssmDouble>(pvalues);
+ 	xDelete<IssmDouble>(vvalues);
+ }/*}}}*/
++void StressbalanceAnalysis::InitializeXTH(Elements* elements,Parameters* parameters){/*{{{*/
++
++	/*Intermediaries*/
++	int        meshtype,dim;
++	IssmDouble dvx[3],dvy[3],dvz[3];
++	IssmDouble viscosity;
++	IssmDouble *xyz_list = NULL;
++
++	/*Get problem dimension*/
++	parameters->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; break;
++		case Mesh3DEnum:         dim = 3; break;
++		case Mesh3DtetrasEnum:   dim = 3; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	for(int i=0;i<elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
++
++		/*Get inputs and parameters*/
++		element->GetVerticesCoordinates(&xyz_list);
++		Input* vx_input=element->GetInput(VxEnum); _assert_(vx_input);
++		Input* vy_input=element->GetInput(VyEnum); _assert_(vy_input);
++		Input* vz_input;
++		if(dim==3){vz_input=element->GetInput(VzEnum); _assert_(vz_input);}
++
++		/*Allocate new inputs*/
++		int tnumnodes = element->GetNumberOfVertices();      //Tensors, P1 DG
++		IssmDouble* epsxx = xNew<IssmDouble>(tnumnodes); IssmDouble* sigmapxx = xNew<IssmDouble>(tnumnodes);
++		IssmDouble* epsyy = xNew<IssmDouble>(tnumnodes); IssmDouble* sigmapyy = xNew<IssmDouble>(tnumnodes); 
++		IssmDouble* epsxy = xNew<IssmDouble>(tnumnodes); IssmDouble* sigmapxy = xNew<IssmDouble>(tnumnodes); 
++		IssmDouble* epszz = NULL;                        IssmDouble* sigmapzz = NULL;  
++		IssmDouble* epsxz = NULL;                        IssmDouble* sigmapxz = NULL;  
++		IssmDouble* epsyz = NULL;                        IssmDouble* sigmapyz = NULL;  
++		if(dim==3){
++			epszz = xNew<IssmDouble>(tnumnodes); sigmapzz = xNew<IssmDouble>(tnumnodes);
++			epsxz = xNew<IssmDouble>(tnumnodes); sigmapxz = xNew<IssmDouble>(tnumnodes); 
++			epsyz = xNew<IssmDouble>(tnumnodes); sigmapyz = xNew<IssmDouble>(tnumnodes); 
++		}
++
++		/*Get d and tau*/
++		Gauss* gauss = element->NewGauss();
++		for(int i=0;i<tnumnodes;i++){
++			gauss->GaussNode(P1DGEnum,i);
++
++			vx_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
++			vy_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
++			if(dim==3){
++				vz_input->GetInputDerivativeValue(&dvz[0],xyz_list,gauss);
++			}
++
++			element->ViscosityFS(&viscosity,dim,xyz_list,gauss,vx_input,vy_input,vz_input);
++			epsxx[i] = dvx[0];                sigmapxx[i] = 2.*viscosity*epsxx[i];
++			epsyy[i] = dvy[1];                sigmapyy[i] = 2.*viscosity*epsyy[i];
++			epsxy[i] = 0.5*(dvx[1] + dvy[0]); sigmapxy[i] = 2.*viscosity*epsxy[i];
++			if(dim==3){
++				epszz[i] = dvz[2];                sigmapzz[i] = 2.*viscosity*epszz[i];
++				epsxz[i] = 0.5*(dvx[2] + dvz[0]); sigmapxz[i] = 2.*viscosity*epsxz[i];
++				epsyz[i] = 0.5*(dvy[2] + dvz[1]); sigmapyz[i] = 2.*viscosity*epsyz[i];
++			}
++		}
++
++		/*Add inputs*/
++		element->AddInput(StrainRatexxEnum,epsxx,P1DGEnum); element->AddInput(DeviatoricStressxxEnum,sigmapxx,P1DGEnum);
++		element->AddInput(StrainRateyyEnum,epsyy,P1DGEnum); element->AddInput(DeviatoricStressyyEnum,sigmapyy,P1DGEnum);
++		element->AddInput(StrainRatexyEnum,epsxy,P1DGEnum); element->AddInput(DeviatoricStressxyEnum,sigmapxy,P1DGEnum);
++		if(dim==3){
++			element->AddInput(StrainRatezzEnum,epszz,P1DGEnum); element->AddInput(DeviatoricStresszzEnum,sigmapzz,P1DGEnum);
++			element->AddInput(StrainRatexzEnum,epsxz,P1DGEnum); element->AddInput(DeviatoricStressxzEnum,sigmapxz,P1DGEnum);
++			element->AddInput(StrainRateyzEnum,epsyz,P1DGEnum); element->AddInput(DeviatoricStressyzEnum,sigmapyz,P1DGEnum);
++		}
++
++		/*Clean up*/
++		xDelete<IssmDouble>(xyz_list);
++		xDelete<IssmDouble>(epsxx);
++		xDelete<IssmDouble>(epsyy);
++		xDelete<IssmDouble>(epszz);
++		xDelete<IssmDouble>(epsxy);
++		xDelete<IssmDouble>(epsxz);
++		xDelete<IssmDouble>(epsyz);
++	}
++
++}/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionFS(IssmDouble* solution,Element* element){/*{{{*/
+ 
+ 	bool         results_on_nodes;
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp	(revision 17539)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp	(revision 17540)
+@@ -19,16 +19,30 @@
+ 	Vector<IssmDouble>*  ys  = NULL;
+ 	int  configuration_type;
+ 
++	/*Create analysis*/
++	StressbalanceAnalysis* analysis = new StressbalanceAnalysis();
++
+ 	/*Recover parameters: */
+ 	femmodel->parameters->FindParam(&configuration_type,ConfigurationTypeEnum);
++
++	/*Update constraints and initialize d and tau if necessary*/
+ 	femmodel->UpdateConstraintsx();
++	analysis->InitializeXTH(femmodel->elements,femmodel->parameters);
++
++	/*Solve KU=F*/
+ 	SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
+-	_error_("STOP");
+ 	CreateNodalConstraintsx(&ys,femmodel->nodes,configuration_type);
+ 	Reduceloadx(pf, Kfs, ys); delete Kfs;
+ 	Solverx(&uf, Kff, pf, NULL, df, femmodel->parameters); 
+ 	delete Kff; delete pf; delete df;
+ 	Mergesolutionfromftogx(&ug, uf,ys,femmodel->nodes,femmodel->parameters);delete uf; delete ys;
++
++	/*Update solution*/
+ 	InputUpdateFromSolutionx(femmodel,ug); 
++
++	/*Update d and tau accordingly*/
++	_error_("STOP");
++
+ 	delete ug;  
++	delete analysis;
+ }
+Index: ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp	(revision 17539)
++++ ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp	(revision 17540)
+@@ -245,6 +245,11 @@
+ 			this->GetNodalFunctions(basis,gauss);
+ 			this->element_type = TaylorHoodEnum;
+ 			return;
++		case XTaylorHoodEnum:
++			this->element_type = P2Enum;
++			this->GetNodalFunctions(basis,gauss);
++			this->element_type = XTaylorHoodEnum;
++			return;
+ 		default:
+ 			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+ 	}
+@@ -280,6 +285,11 @@
+ 			this->GetNodalFunctions(basis,gauss);
+ 			this->element_type = TaylorHoodEnum;
+ 			return;
++		case XTaylorHoodEnum:
++			this->element_type = P1Enum;
++			this->GetNodalFunctions(basis,gauss);
++			this->element_type = XTaylorHoodEnum;
++			return;
+ 		default:
+ 			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+ 	}
+@@ -438,7 +448,7 @@
+ 		case XTaylorHoodEnum:
+ 			this->element_type = P2Enum;
+ 			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = TaylorHoodEnum;
++			this->element_type = XTaylorHoodEnum;
+ 			return;
+ 		default:
+ 			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
Index: issm/oecreview/Archive/16554-17801/ISSM-17540-17541.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17540-17541.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17540-17541.diff	(revision 17802)
@@ -0,0 +1,64 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17540)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17541)
+@@ -80,6 +80,7 @@
+ 		void GetBFSFriction(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputsFS(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolutionFS(IssmDouble* solution,Element* element);
++		void InputUpdateFromSolutionFSXTH(Elements* elements,Parameters* parameters);
+ 		void InitializeXTH(Elements* elements,Parameters* parameters);
+ 		/*Coupling*/
+ 		ElementMatrix* CreateKMatrixSSA3d(Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17540)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17541)
+@@ -4247,7 +4247,33 @@
+ 	xDelete<int>(pdoflist);
+ 	xDelete<int>(cs_list);
+ }/*}}}*/
++void StressbalanceAnalysis::InputUpdateFromSolutionFSXTH(Elements* elements,Parameters* parameters){/*{{{*/
+ 
++	/*Intermediaries*/
++	int  dim,meshtype;
++
++	parameters->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; break;
++		case Mesh3DEnum:         dim = 3; break;
++		case Mesh3DtetrasEnum:   dim = 3; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	for(int i=0;i<elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
++
++		/*Get inputs and parameters*/
++		Input* vx_input=element->GetInput(VxEnum); _assert_(vx_input);
++		Input* vy_input=element->GetInput(VyEnum); _assert_(vy_input);
++		Input* vz_input;
++		if(dim==3){vz_input=element->GetInput(VzEnum); _assert_(vz_input);}
++
++		_error_("NOT implemented yet");
++	}
++
++}/*}}}*/
++
+ /*Coupling (Tiling)*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSA3d(Element* element){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp	(revision 17540)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp	(revision 17541)
+@@ -41,6 +41,9 @@
+ 	InputUpdateFromSolutionx(femmodel,ug); 
+ 
+ 	/*Update d and tau accordingly*/
++	analysis->InputUpdateFromSolutionFSXTH(femmodel->elements,femmodel->parameters);
++
++	/*Check for convergence*/
+ 	_error_("STOP");
+ 
+ 	delete ug;  
Index: issm/oecreview/Archive/16554-17801/ISSM-17541-17542.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17541-17542.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17541-17542.diff	(revision 17802)
@@ -0,0 +1,165 @@
+Index: ../trunk-jpl/src/m/shp/Shp2Exp.m
+===================================================================
+--- ../trunk-jpl/src/m/shp/Shp2Exp.m	(revision 17541)
++++ ../trunk-jpl/src/m/shp/Shp2Exp.m	(revision 17542)
+@@ -1,48 +0,0 @@
+-function Shp2Exp(expfilename,shapefilename)
+-%SHP2EXP- transform shape file to Argus .exp file
+-%
+-%   Usage:
+-%      Shp2Exp(expfilename,shapefilename);
+-%
+-%   Example:
+-%      Shp2Exp('Domain.exp','Domain.shp');
+-%
+-%   See also EXPMASTER, EXPDOC
+-
+-	if ~exist(shapefilename,'file'),
+-		error(['Shapefile ' shapefilename ' does not exist']);
+-	end
+-	shp=shaperead(shapefilename);
+-
+-	expstruct=struct([]);
+-	for i=1:length(shp),
+-		if strcmpi(shp(i).Geometry,'Polygon'),
+-			x=shp(i).X; y=shp(i).Y;
+-			ids=find(isnan(x));
+-			x(ids)=[]; y(ids)=[];
+-			expstruct(end+1).x=x;
+-			expstruct(end).y=y;
+-			expstruct(end).nods=length(x);
+-			expstruct(end).density=1;
+-			expstruct(end).closed=1;
+-			expstruct(end).name=num2str(shp(i).id);
+-		elseif strcmpi(shp(i).Geometry,'Point'),
+-			x=shp(i).X; y=shp(i).Y;
+-			expstruct(end+1).x=x;
+-			expstruct(end).y=y;
+-			expstruct(end).nods=length(x);
+-			expstruct(end).density=1;
+-			expstruct(end).closed=1;
+-			%exp(end).name=num2str(shp(i).id);
+-		elseif strcmpi(shp(i).Geometry,'Line'),
+-			x=shp(i).X; y=shp(i).Y;
+-			x(end)=x(1); y(end)=y(1);
+-			expstruct(end+1).x=x;
+-			expstruct(end).y=y;
+-			expstruct(end).nods=length(x);
+-			expstruct(end).density=1;
+-			expstruct(end).closed=1;
+-		end
+-	end
+-
+-	expwrite(expstruct,expfilename);
+Index: ../trunk-jpl/src/m/shp/shp2exp.py
+===================================================================
+--- ../trunk-jpl/src/m/shp/shp2exp.py	(revision 0)
++++ ../trunk-jpl/src/m/shp/shp2exp.py	(revision 17542)
+@@ -0,0 +1,54 @@
++import shapefile
++import os
++from expwrite import expwrite
++
++def shp2exp(shapefilename,*expfilename):
++	'''
++	Convert a shapefile to an .exp file.  Optionally, expfilename can be
++	specified to give a name for the .exp file to be created, otherwise the
++	.exp file will have the same prefix as the .shp file.
++
++	Usage:
++		shp2exp(shapefilename)
++		shp2exp(shapefilename,expfilename)
++
++	Examples:
++		shp2exp('Domain.shp') % creates Domain.exp
++		shp2exp('Domain.shp','DomainForISSM.exp')
++	'''
++	
++	if not os.path.exists(shapefilename):
++		raise IOError("shp2exp error message: file '%s' not found!" % parametername)
++	if not len(expfilename):
++		expfile=os.path.splitext(shapefilename)[0]+'.exp'
++	else:
++		expfile=expfilename[0]
++
++	shp=shapefile.Reader(shapefilename)
++	expdict=dict(closed=1,density=1)
++
++
++	for i in range(len(shp.shapes())):
++		geom=shp.shapes()[i].shapeType
++		if geom==5: # polygon
++			x=[p[0] for p in shp.shapes()[i].points]
++			y=[q[1] for q in shp.shapes()[i].points]
++			expdict['x']=x
++			expdict['y']=y
++			expdict['nods']=len(x)
++		elif geom==3: # line
++			x=[p[0] for p in shp.shapes()[i].points]
++			y=[q[1] for q in shp.shapes()[i].points]
++			x.append(x[0])
++			y.append(y[0])
++			expdict['x']=x
++			expdict['y']=y
++			expdict['nods']=len(x)
++		elif geom==1: # point
++			x=[p[0] for p in shp.shapes()[i].points]
++			y=[q[1] for q in shp.shapes()[i].points]
++			expdict['x']=x
++			expdict['y']=y
++			expdict['nods']=len(x)
++
++	expwrite([expdict],expfile)
+Index: ../trunk-jpl/src/m/shp/shp2exp.m
+===================================================================
+--- ../trunk-jpl/src/m/shp/shp2exp.m	(revision 0)
++++ ../trunk-jpl/src/m/shp/shp2exp.m	(revision 17542)
+@@ -0,0 +1,48 @@
++function Shp2Exp(expfilename,shapefilename)
++%SHP2EXP- transform shape file to Argus .exp file
++%
++%   Usage:
++%      Shp2Exp(expfilename,shapefilename);
++%
++%   Example:
++%      Shp2Exp('Domain.exp','Domain.shp');
++%
++%   See also EXPMASTER, EXPDOC
++
++	if ~exist(shapefilename,'file'),
++		error(['Shapefile ' shapefilename ' does not exist']);
++	end
++	shp=shaperead(shapefilename);
++
++	expstruct=struct([]);
++	for i=1:length(shp),
++		if strcmpi(shp(i).Geometry,'Polygon'),
++			x=shp(i).X; y=shp(i).Y;
++			ids=find(isnan(x));
++			x(ids)=[]; y(ids)=[];
++			expstruct(end+1).x=x;
++			expstruct(end).y=y;
++			expstruct(end).nods=length(x);
++			expstruct(end).density=1;
++			expstruct(end).closed=1;
++			expstruct(end).name=num2str(shp(i).id);
++		elseif strcmpi(shp(i).Geometry,'Point'),
++			x=shp(i).X; y=shp(i).Y;
++			expstruct(end+1).x=x;
++			expstruct(end).y=y;
++			expstruct(end).nods=length(x);
++			expstruct(end).density=1;
++			expstruct(end).closed=1;
++			%exp(end).name=num2str(shp(i).id);
++		elseif strcmpi(shp(i).Geometry,'Line'),
++			x=shp(i).X; y=shp(i).Y;
++			x(end)=x(1); y(end)=y(1);
++			expstruct(end+1).x=x;
++			expstruct(end).y=y;
++			expstruct(end).nods=length(x);
++			expstruct(end).density=1;
++			expstruct(end).closed=1;
++		end
++	end
++
++	expwrite(expstruct,expfilename);
Index: issm/oecreview/Archive/16554-17801/ISSM-17542-17543.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17542-17543.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17542-17543.diff	(revision 17802)
@@ -0,0 +1,41 @@
+Index: ../trunk-jpl/src/c/shared/Numerics/GaussPoints.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Numerics/GaussPoints.cpp	(revision 17542)
++++ ../trunk-jpl/src/c/shared/Numerics/GaussPoints.cpp	(revision 17543)
+@@ -41,9 +41,21 @@
+ 	static IssmPDouble wgt4[]={0.347854845137454, 0.652145154862546, 0.652145154862546, 0.347854845137454};
+ 	static IssmPDouble xi4[]={-0.861136311594053,-0.339981043584856, 0.339981043584856, 0.861136311594053};
+ 
+-	static IssmPDouble* wgtp[MAX_LINE_GAUS_PTS]={wgt1 ,wgt2 ,wgt3 ,wgt4 };
+-	static IssmPDouble* xip [MAX_LINE_GAUS_PTS]={xi1  ,xi2  ,xi3  ,xi4  };
++	/*npoint= 5*/
++	static IssmPDouble wgt5[]={0.5688888888888889,0.4786286704993665,0.4786286704993665,0.2369268850561891,0.2369268850561891};
++	static IssmPDouble xi5[]={0.0000000000000000,-0.5384693101056831,0.5384693101056831,-0.9061798459386640,0.9061798459386640};
+ 
++	/*npoint= 6*/
++	static IssmPDouble wgt6[]={0.3607615730481386,0.3607615730481386,0.4679139345726910,0.4679139345726910,0.1713244923791704,0.1713244923791704};
++	static IssmPDouble xi6[]={-0.6612093864662645,0.6612093864662645,-0.2386191860831969,0.2386191860831969,-0.9324695142031521,0.9324695142031521};
++
++	/*npoint= 7*/
++	static IssmPDouble wgt7[]={0.4179591836734694,0.3818300505051189,0.3818300505051189,0.2797053914892766,0.2797053914892766,0.1294849661688697,0.1294849661688697};
++	static IssmPDouble xi7[]={0.0000000000000000,-0.4058451513773972,0.4058451513773972,-0.7415311855993945,0.7415311855993945,-0.9491079123427585,0.9491079123427585};
++
++	static IssmPDouble* wgtp[MAX_LINE_GAUS_PTS]={wgt1 ,wgt2 ,wgt3 ,wgt4, wgt5, wgt6, wgt7};
++	static IssmPDouble* xip [MAX_LINE_GAUS_PTS]={xi1  ,xi2  ,xi3  ,xi4, xi5, xi6, xi7};
++
+ 	*pxgaus =xNew<IssmPDouble>(ngaus);
+ 	*pxwgt  =xNew<IssmPDouble>(ngaus);
+ 
+Index: ../trunk-jpl/src/c/shared/Numerics/GaussPoints.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Numerics/GaussPoints.h	(revision 17542)
++++ ../trunk-jpl/src/c/shared/Numerics/GaussPoints.h	(revision 17543)
+@@ -6,7 +6,7 @@
+ #ifndef _GAUSSPOINTS_H
+ #define _GAUSSPOINTS_H
+ 
+-#define MAX_LINE_GAUS_PTS    4
++#define MAX_LINE_GAUS_PTS    7
+ void GaussLegendreLinear(IssmPDouble** pxgaus, IssmPDouble** pxwgt, int ngaus);
+ #define MAX_TRIA_SYM_ORD    20
+ void GaussLegendreTria(int* pngaus, IssmDouble** pl1, IssmDouble** pl2, IssmDouble** pl3, IssmDouble** pwgt, int iord);
Index: issm/oecreview/Archive/16554-17801/ISSM-17543-17544.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17543-17544.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17543-17544.diff	(revision 17802)
@@ -0,0 +1,48 @@
+Index: ../trunk-jpl/test/Archives/Archive703.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive221.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive215.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive204.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive507.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive511.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive211.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive104.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive124.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive702.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive220.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive503.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17544-17545.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17544-17545.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17544-17545.diff	(revision 17802)
@@ -0,0 +1,164 @@
+Index: ../trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim
+===================================================================
+--- ../trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim	(revision 17544)
++++ ../trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim	(revision 17545)
+@@ -411,13 +411,14 @@
+ "ISSM's objects begin
+ syn keyword cType BoolInput
+ syn keyword cType BoolParam
++syn keyword cType classes
+ syn keyword cType Constraint
+ syn keyword cType Constraints
+ syn keyword cType Contour
+ syn keyword cType Contours
+ syn keyword cType ControlInput
++syn keyword cType DatasetInput
+ syn keyword cType DataSetParam
+-syn keyword cType DatasetInput
+ syn keyword cType Definition
+ syn keyword cType DependentObject
+ syn keyword cType DofIndexing
+@@ -430,19 +431,20 @@
+ syn keyword cType Element
+ syn keyword cType ElementHook
+ syn keyword cType ElementMatrix
++syn keyword cType Elements
+ syn keyword cType ElementVector
+-syn keyword cType Elements
+ syn keyword cType ExponentialVariogram
+ syn keyword cType ExternalResult
+ syn keyword cType FemModel
+ syn keyword cType FileParam
+ syn keyword cType Friction
+ syn keyword cType Gauss
++syn keyword cType GaussianVariogram
++syn keyword cType gaussobjects
+ syn keyword cType GaussPenta
+ syn keyword cType GaussSeg
+ syn keyword cType GaussTetra
+ syn keyword cType GaussTria
+-syn keyword cType GaussianVariogram
+ syn keyword cType GenericExternalResult
+ syn keyword cType GenericOption
+ syn keyword cType GenericParam
+@@ -456,6 +458,7 @@
+ syn keyword cType IntParam
+ syn keyword cType IntVecParam
+ syn keyword cType IoModel
++syn keyword cType krigingobjects
+ syn keyword cType Load
+ syn keyword cType Loads
+ syn keyword cType Massfluxatgate
+@@ -463,6 +466,7 @@
+ syn keyword cType Materials
+ syn keyword cType Matice
+ syn keyword cType Matpar
++syn keyword cType matrixobjects
+ syn keyword cType MatrixParam
+ syn keyword cType Misfit
+ syn keyword cType Node
+@@ -471,8 +475,8 @@
+ syn keyword cType Observation
+ syn keyword cType Observations
+ syn keyword cType Option
++syn keyword cType Options
+ syn keyword cType OptionUtilities
+-syn keyword cType Options
+ syn keyword cType Param
+ syn keyword cType Parameters
+ syn keyword cType Pengrid
+@@ -484,12 +488,12 @@
+ syn keyword cType Profiler
+ syn keyword cType Quadtree
+ syn keyword cType Results
++syn keyword cType Riftfront
+ syn keyword cType RiftStruct
+-syn keyword cType Riftfront
+ syn keyword cType Seg
+ syn keyword cType SegInput
++syn keyword cType Segment
+ syn keyword cType SegRef
+-syn keyword cType Segment
+ syn keyword cType SpcDynamic
+ syn keyword cType SpcStatic
+ syn keyword cType SpcTransient
+@@ -497,6 +501,7 @@
+ syn keyword cType StringArrayParam
+ syn keyword cType StringParam
+ syn keyword cType Tetra
++syn keyword cType TetraInput
+ syn keyword cType TetraRef
+ syn keyword cType TransientInput
+ syn keyword cType TransientParam
+@@ -508,10 +513,6 @@
+ syn keyword cType VectorParam
+ syn keyword cType Vertex
+ syn keyword cType Vertices
+-syn keyword cType classes
+-syn keyword cType gaussobjects
+-syn keyword cType krigingobjects
+-syn keyword cType matrixobjects
+ syn keyword cType AdjointBalancethicknessAnalysis
+ syn keyword cType AdjointHorizAnalysis
+ syn keyword cType Analysis
+@@ -519,6 +520,7 @@
+ syn keyword cType BalancethicknessSoftAnalysis
+ syn keyword cType BalancevelocityAnalysis
+ syn keyword cType DamageEvolutionAnalysis
++syn keyword cType DepthAverageAnalysis
+ syn keyword cType EnthalpyAnalysis
+ syn keyword cType EnumToAnalysis
+ syn keyword cType ExtrapolationAnalysis
+@@ -751,6 +753,7 @@
+ syn keyword cConstant Mesh2DhorizontalEnum
+ syn keyword cConstant Mesh2DverticalEnum
+ syn keyword cConstant Mesh3DEnum
++syn keyword cConstant Mesh3DtetrasEnum
+ syn keyword cConstant MiscellaneousNameEnum
+ syn keyword cConstant MasstransportHydrostaticAdjustmentEnum
+ syn keyword cConstant MasstransportIsfreesurfaceEnum
+@@ -874,6 +877,7 @@
+ syn keyword cConstant SurfaceNormalVelocityEnum
+ syn keyword cConstant ExtrudeFromBaseAnalysisEnum
+ syn keyword cConstant ExtrudeFromTopAnalysisEnum
++syn keyword cConstant DepthAverageAnalysisEnum
+ syn keyword cConstant SteadystateSolutionEnum
+ syn keyword cConstant SurfaceSlopeSolutionEnum
+ syn keyword cConstant SmoothedSurfaceSlopeXAnalysisEnum
+@@ -928,6 +932,7 @@
+ syn keyword cConstant IntInputEnum
+ syn keyword cConstant InputToExtrudeEnum
+ syn keyword cConstant InputToL2ProjectEnum
++syn keyword cConstant InputToDepthaverageEnum
+ syn keyword cConstant IntParamEnum
+ syn keyword cConstant IntVecParamEnum
+ syn keyword cConstant TransientParamEnum
+@@ -1053,6 +1058,20 @@
+ syn keyword cConstant StressTensoryyEnum
+ syn keyword cConstant StressTensoryzEnum
+ syn keyword cConstant StressTensorzzEnum
++syn keyword cConstant DeviatoricStressEnum
++syn keyword cConstant DeviatoricStressxxEnum
++syn keyword cConstant DeviatoricStressxyEnum
++syn keyword cConstant DeviatoricStressxzEnum
++syn keyword cConstant DeviatoricStressyyEnum
++syn keyword cConstant DeviatoricStressyzEnum
++syn keyword cConstant DeviatoricStresszzEnum
++syn keyword cConstant StrainRateEnum
++syn keyword cConstant StrainRatexxEnum
++syn keyword cConstant StrainRatexyEnum
++syn keyword cConstant StrainRatexzEnum
++syn keyword cConstant StrainRateyyEnum
++syn keyword cConstant StrainRateyzEnum
++syn keyword cConstant StrainRatezzEnum
+ syn keyword cConstant DivergenceEnum
+ syn keyword cConstant GiaCrossSectionShapeEnum
+ syn keyword cConstant GiadWdtEnum
+@@ -1072,6 +1091,7 @@
+ syn keyword cConstant MINIEnum
+ syn keyword cConstant MINIcondensedEnum
+ syn keyword cConstant TaylorHoodEnum
++syn keyword cConstant XTaylorHoodEnum
+ syn keyword cConstant OneLayerP4zEnum
+ syn keyword cConstant SaveResultsEnum
+ syn keyword cConstant BoolExternalResultEnum
Index: issm/oecreview/Archive/16554-17801/ISSM-17545-17546.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17545-17546.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17545-17546.diff	(revision 17802)
@@ -0,0 +1,236 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17545)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17546)
+@@ -3445,6 +3445,7 @@
+ 		sigmapxz_input=element->GetInput(DeviatoricStressxzEnum); _assert_(sigmapxz_input);
+ 		sigmapyz_input=element->GetInput(DeviatoricStressyzEnum); _assert_(sigmapyz_input);
+ 	}
++
+ 	gauss = element->NewGauss();
+ 	for(int i=0;i<tnumnodes;i++){
+ 		gauss->GaussNode(P1DGEnum,i);
+@@ -4250,26 +4251,150 @@
+ void StressbalanceAnalysis::InputUpdateFromSolutionFSXTH(Elements* elements,Parameters* parameters){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int  dim,meshtype;
++	int         dim,tausize,meshtype;
++	IssmDouble  epsxx,epsyy,epszz,epsxy,epsxz,epsyz,D_scalar;
++	IssmDouble  sigmapxx,sigmapyy,sigmapzz,sigmapxy,sigmapxz,sigmapyz;
++	IssmDouble  dvx[3],dvy[3],dvz[3],B,n;
++	IssmDouble *xyz_list = NULL;
++	IssmDouble  Jdet,r;
+ 
+ 	parameters->FindParam(&meshtype,MeshTypeEnum);
+ 	switch(meshtype){
+-		case Mesh2DverticalEnum: dim = 2; break;
+-		case Mesh3DEnum:         dim = 3; break;
+-		case Mesh3DtetrasEnum:   dim = 3; break;
++		case Mesh2DverticalEnum: dim = 2; tausize = 3; break;
++		case Mesh3DEnum:         dim = 3; tausize = 6; break;
++		case Mesh3DtetrasEnum:   dim = 3; tausize = 6; break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
++	/*FIXME*/
++	r = 1.;
++
+ 	for(int i=0;i<elements->Size();i++){
+ 		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+ 
+ 		/*Get inputs and parameters*/
+-		Input* vx_input=element->GetInput(VxEnum); _assert_(vx_input);
+-		Input* vy_input=element->GetInput(VyEnum); _assert_(vy_input);
++		element->GetVerticesCoordinates(&xyz_list);
++		Input*  B_input=element->GetInput(MaterialsRheologyBEnum); _assert_(B_input);
++		Input*  n_input=element->GetInput(MaterialsRheologyNEnum); _assert_(n_input);
++		Input* vx_input=element->GetInput(VxEnum);                 _assert_(vx_input);
++		Input* vy_input=element->GetInput(VyEnum);                 _assert_(vy_input);
+ 		Input* vz_input;
+ 		if(dim==3){vz_input=element->GetInput(VzEnum); _assert_(vz_input);}
+ 
+-		_error_("NOT implemented yet");
++		/*Fetch number of nodes and dof for this finite element*/
++		int tnumnodes = element->GetNumberOfVertices();      //Tensors, P1 DG
++
++		/*Initialize vectors*/
++		IssmDouble* tbasis = xNew<IssmDouble>(tnumnodes);
++		IssmDouble* Ke     = xNewZeroInit<IssmDouble>(tnumnodes*tnumnodes);
++		IssmDouble* pe_xx  = xNewZeroInit<IssmDouble>(tnumnodes);
++		IssmDouble* pe_yy  = xNewZeroInit<IssmDouble>(tnumnodes);
++		IssmDouble* pe_xy  = xNewZeroInit<IssmDouble>(tnumnodes);
++		IssmDouble* pe_zz  = NULL; IssmDouble* pe_xz  = NULL; IssmDouble* pe_yz  = NULL;
++		if(dim==3){
++			pe_zz = xNewZeroInit<IssmDouble>(tnumnodes);
++			pe_xz = xNewZeroInit<IssmDouble>(tnumnodes);
++			pe_yz = xNewZeroInit<IssmDouble>(tnumnodes);
++		}
++
++		/*Get tau*/
++		Input* sigmapxx_input=element->GetInput(DeviatoricStressxxEnum); _assert_(sigmapxx_input);
++		Input* sigmapyy_input=element->GetInput(DeviatoricStressyyEnum); _assert_(sigmapyy_input);
++		Input* sigmapxy_input=element->GetInput(DeviatoricStressxyEnum); _assert_(sigmapxy_input);
++		Input* sigmapzz_input=NULL; Input* sigmapxz_input=NULL; Input* sigmapyz_input=NULL;
++		if(dim==3){
++			sigmapzz_input=element->GetInput(DeviatoricStresszzEnum); _assert_(sigmapzz_input);
++			sigmapxz_input=element->GetInput(DeviatoricStressxzEnum); _assert_(sigmapxz_input);
++			sigmapyz_input=element->GetInput(DeviatoricStressyzEnum); _assert_(sigmapyz_input);
++		}
++
++		Gauss* gauss=element->NewGauss(5);
++		for(int ig=gauss->begin();ig<gauss->end();ig++){
++			gauss->GaussPoint(ig);
++			element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++			element->NodalFunctionsTensor(tbasis,gauss);
++
++			/*Get tau from inputs*/
++			sigmapxx_input->GetInputValue(&sigmapxx,gauss);
++			sigmapyy_input->GetInputValue(&sigmapyy,gauss);
++			sigmapxy_input->GetInputValue(&sigmapxy,gauss);
++			if(dim==3){
++				sigmapzz_input->GetInputValue(&sigmapzz,gauss);
++				sigmapxz_input->GetInputValue(&sigmapxz,gauss);
++				sigmapyz_input->GetInputValue(&sigmapyz,gauss);
++			}
++
++			/*Calculate d from previous results*/
++			vx_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
++			vy_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
++			if(dim==3){
++				vz_input->GetInputDerivativeValue(&dvz[0],xyz_list,gauss);
++			}
++			epsxx = dvx[0];
++			epsyy = dvy[1];
++			epsxy = 0.5*(dvx[1] + dvy[0]); 
++			if(dim==3){
++				epszz = dvz[2];               
++				epsxz = 0.5*(dvx[2] + dvz[0]);
++				epsyz = 0.5*(dvy[2] + dvz[1]);
++			}
++
++			/*Solve 2 eta_0 |d|^s-1 + r |d| = |rD(u) + tau|*/
++			IssmDouble coef1,coef2,coef3;
++			B_input->GetInputValue(&B,gauss);
++			n_input->GetInputValue(&n,gauss);
++			coef1 = (B/2.)*pow(1./sqrt(2.),(1.-n)/n); //2 eta_0
++			coef2 = r;
++			if(dim==2){
++				coef3 = sqrt(
++							  (r*epsxx + sigmapxx)*(r*epsxx + sigmapxx)
++							+ (r*epsyy + sigmapyy)*(r*epsyy + sigmapyy)
++							+ 2*(r*epsxy + sigmapxy)*(r*epsxy + sigmapxy)
++							);
++			}
++			else{
++				coef3 = sqrt(
++					  		  (r*epsxx + sigmapxx)*(r*epsxx + sigmapxx)
++							+ (r*epsyy + sigmapyy)*(r*epsyy + sigmapyy)
++							+ (r*epszz + sigmapzz)*(r*epszz + sigmapzz)
++							+ 2*(r*epsxy + sigmapxy)*(r*epsxy + sigmapxy)
++							+ 2*(r*epsxz + sigmapxz)*(r*epsxz + sigmapxz)
++							+ 2*(r*epsyz + sigmapyz)*(r*epsyz + sigmapyz)
++							);
++			}
++			IssmDouble dnorm;
++			NewtonSolveDnorm(&dnorm,coef1,coef2,coef3,n);
++
++			/*Create Ke*/
++			D_scalar=(coef1*pow(dnorm,(1.-n)/n)+r)*gauss->weight*Jdet;
++			TripleMultiply(tbasis,tnumnodes,1,0,
++						&D_scalar,1,1,0,
++						tbasis,1,tnumnodes,0,
++						Ke,1);
++
++			/*Create Right hand sides*/
++			for(int ii=0;ii<tnumnodes;ii++) pe_xx[ii] += sigmapxx*tbasis[ii]*gauss->weight*Jdet;
++			for(int ii=0;ii<tnumnodes;ii++) pe_yy[ii] += sigmapyy*tbasis[ii]*gauss->weight*Jdet;
++			for(int ii=0;ii<tnumnodes;ii++) pe_xy[ii] += sigmapxy*tbasis[ii]*gauss->weight*Jdet;
++			if(dim==3){
++				for(int ii=0;ii<tnumnodes;ii++) pe_zz[ii] += sigmapzz*tbasis[ii]*gauss->weight*Jdet;
++				for(int ii=0;ii<tnumnodes;ii++) pe_xz[ii] += sigmapxz*tbasis[ii]*gauss->weight*Jdet;
++				for(int ii=0;ii<tnumnodes;ii++) pe_yz[ii] += sigmapyz*tbasis[ii]*gauss->weight*Jdet;
++			}
++		}
++
++		/*Solve the systems*/
++		_error_("S");
++
++		/*Clean up and */
++		xDelete<IssmDouble>(tbasis);
++		xDelete<IssmDouble>(Ke);
++		xDelete<IssmDouble>(pe_xx);
++		xDelete<IssmDouble>(pe_yy);
++		xDelete<IssmDouble>(pe_zz);
++		xDelete<IssmDouble>(pe_xy);
++		xDelete<IssmDouble>(pe_xz);
++		xDelete<IssmDouble>(pe_yz);
+ 	}
+ 
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/shared/Numerics/NewtonSolveDnorm.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Numerics/NewtonSolveDnorm.cpp	(revision 0)
++++ ../trunk-jpl/src/c/shared/Numerics/NewtonSolveDnorm.cpp	(revision 17546)
+@@ -0,0 +1,38 @@
++#include <math.h>
++#include "./types.h"
++
++int NewtonSolveDnorm(IssmDouble* pdnorm,IssmDouble c1,IssmDouble c2,IssmDouble c3,IssmDouble n){
++	/* solve the following equation using Newton-Raphson
++	 *
++	 *   c1*x^(s-1) + c2*x = c3
++	 *
++	 *   s = (1+n)/n
++	 *
++	 *   we solve y = 10^x:
++	 */
++
++
++	/*Intermediaries*/
++	IssmDouble s = (1.+n)/n;
++	IssmDouble y2;
++	IssmDouble threshold = 1.e-12;
++
++	/*Initial guess*/
++	IssmDouble y1 = 0.;
++
++	while(true){
++
++		/*Newton step*/
++		y2 = y1 - (c1*pow(pow(10.,y1),s-1.) + c2*pow(10.,y1) - c3)/((s-1)*c1*log(10)*pow(pow(10.,y1),s-1) + c2*log(10.)*pow(10.,y1));
++
++		if( fabs(y2-y1)/fabs(y1)<threshold ){
++			break;
++		}
++		else{
++			y1=y2;
++		}
++	}
++
++	/*Assign output pointer*/
++	*pdnorm = pow(10.,y2);
++}
+Index: ../trunk-jpl/src/c/shared/Numerics/numerics.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Numerics/numerics.h	(revision 17545)
++++ ../trunk-jpl/src/c/shared/Numerics/numerics.h	(revision 17546)
+@@ -37,4 +37,6 @@
+ void        XZvectorsToCoordinateSystem(IssmDouble *T,IssmDouble*xzvectors);
+ int         cubic(IssmDouble a, IssmDouble b, IssmDouble c, IssmDouble d, double X[3], int *num);
+ 
++int         NewtonSolveDnorm(IssmDouble* pdnorm,IssmDouble c1,IssmDouble c2,IssmDouble c3,IssmDouble n);
++
+ #endif //ifndef _NUMERICS_H_
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17545)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17546)
+@@ -205,6 +205,7 @@
+ 					./shared/Numerics/isnan.h\
+ 					./shared/Numerics/isnan.cpp\
+ 					./shared/Numerics/cubic.cpp\
++					./shared/Numerics/NewtonSolveDnorm.cpp\
+ 					./shared/Numerics/extrema.cpp\
+ 					./shared/Numerics/XZvectorsToCoordinateSystem.cpp\
+ 					./shared/Numerics/OptArgs.h\
Index: issm/oecreview/Archive/16554-17801/ISSM-17546-17547.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17546-17547.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17546-17547.diff	(revision 17802)
@@ -0,0 +1,88 @@
+Index: ../trunk-jpl/src/m/materials/paterson.py
+===================================================================
+--- ../trunk-jpl/src/m/materials/paterson.py	(revision 17546)
++++ ../trunk-jpl/src/m/materials/paterson.py	(revision 17547)
+@@ -13,9 +13,12 @@
+ 	
+ 	if numpy.any(temperature<0.):
+ 		raise RuntimeError("input temperature should be in Kelvin (positive)")
+-	
+-	T = temperature.reshape(-1,)-273.15
+ 
++	if numpy.ndim(temperature)==2:
++		T = temperature.reshape(-1,)-273.15
++	else:
++		T = numpy.array([temperature])-273.15
++
+ 	#The routine below is equivalent to:
+ 
+ 	# n=3; T=temperature-273;
+@@ -30,32 +33,44 @@
+ 	# rigidity=fittedmodel(temperature);
+ 
+ 	rigidity=numpy.zeros_like(T)
+-	pos1=numpy.nonzero(T<=-45)
+-	rigidity[pos1]=10**8*(-0.000292866376675*(T[pos1]+50)**3+ 0.011672640664130*(T[pos1]+50)**2  -0.325004442485481*(T[pos1]+50)+  6.524779401948101)
+-	pos2=numpy.nonzero(numpy.logical_and(-45<=T,T<-40))
+-	rigidity[pos2]=10**8*(-0.000292866376675*(T[pos2]+45)**3+ 0.007279645014004*(T[pos2]+45)**2  -0.230243014094813*(T[pos2]+45)+  5.154964909039554)
+-	pos3=numpy.nonzero(numpy.logical_and(-40<=T,T<-35))
+-	rigidity[pos3]=10**8*(0.000072737147457*(T[pos3]+40)**3+  0.002886649363879*(T[pos3]+40)**2  -0.179411542205399*(T[pos3]+40)+  4.149132666831214)
+-	pos4=numpy.nonzero(numpy.logical_and(-35<=T,T<-30))
+-	rigidity[pos4]=10**8*(-0.000086144770023*(T[pos4]+35)**3+ 0.003977706575736*(T[pos4]+35)**2  -0.145089762507325*(T[pos4]+35)+  3.333333333333331)
+-	pos5=numpy.nonzero(numpy.logical_and(-30<=T,T<-25))
+-	rigidity[pos5]=10**8*(-0.000043984685769*(T[pos5]+30)**3+ 0.002685535025386*(T[pos5]+30)**2  -0.111773554501713*(T[pos5]+30)+  2.696559088937191)
+-	pos6=numpy.nonzero(numpy.logical_and(-25<=T,T<-20))
+-	rigidity[pos6]=10**8*(-0.000029799523463*(T[pos6]+25)**3+ 0.002025764738854*(T[pos6]+25)**2  -0.088217055680511*(T[pos6]+25)+  2.199331606342181)
+-	pos7=numpy.nonzero(numpy.logical_and(-20<=T,T<-15))
+-	rigidity[pos7]=10**8*(0.000136920904777*(T[pos7]+20)**3+  0.001578771886910*(T[pos7]+20)**2  -0.070194372551690*(T[pos7]+20)+  1.805165505978111)
+-	pos8=numpy.nonzero(numpy.logical_and(-15<=T,T<-10))
+-	rigidity[pos8]=10**8*(-0.000899763781026*(T[pos8]+15)**3+ 0.003632585458564*(T[pos8]+15)**2  -0.044137585824322*(T[pos8]+15)+  1.510778053489523)
+-	pos9=numpy.nonzero(numpy.logical_and(-10<=T,T<-5))
+-	rigidity[pos9]=10**8*(0.001676964325070*(T[pos9]+10)**3-  0.009863871256831*(T[pos9]+10)**2  -0.075294014815659*(T[pos9]+10)+  1.268434288203714)
+-	pos10=numpy.nonzero(numpy.logical_and(-5<=T,T<-2))
+-	rigidity[pos10]=10**8*(-0.003748937622487*(T[pos10]+5)**3+0.015290593619213*(T[pos10]+5)**2  -0.048160403003748*(T[pos10]+5)+  0.854987973338348)
+-	pos11=numpy.nonzero(-2<=T)
+-	rigidity[pos11]=10**8*(-0.003748937622488*(T[pos11]+2)**3-0.018449844983174*(T[pos11]+2)**2  -0.057638157095631*(T[pos11]+2)+  0.746900791092860)
++	pos1=numpy.nonzero(T<=-45)[0]
++	if len(pos1):
++		rigidity[pos1]=10**8*(-0.000292866376675*(T[pos1]+50)**3+ 0.011672640664130*(T[pos1]+50)**2  -0.325004442485481*(T[pos1]+50)+  6.524779401948101)
++	pos2=numpy.nonzero(numpy.logical_and(-45<=T,T<-40))[0]
++	if len(pos2):
++		rigidity[pos2]=10**8*(-0.000292866376675*(T[pos2]+45)**3+ 0.007279645014004*(T[pos2]+45)**2  -0.230243014094813*(T[pos2]+45)+  5.154964909039554)
++	pos3=numpy.nonzero(numpy.logical_and(-40<=T,T<-35))[0]
++	if len(pos3):
++		rigidity[pos3]=10**8*(0.000072737147457*(T[pos3]+40)**3+  0.002886649363879*(T[pos3]+40)**2  -0.179411542205399*(T[pos3]+40)+  4.149132666831214)
++	pos4=numpy.nonzero(numpy.logical_and(-35<=T,T<-30))[0]
++	if len(pos4):
++		rigidity[pos4]=10**8*(-0.000086144770023*(T[pos4]+35)**3+ 0.003977706575736*(T[pos4]+35)**2  -0.145089762507325*(T[pos4]+35)+  3.333333333333331)
++	pos5=numpy.nonzero(numpy.logical_and(-30<=T,T<-25))[0]
++	if len(pos5):
++		rigidity[pos5]=10**8*(-0.000043984685769*(T[pos5]+30)**3+ 0.002685535025386*(T[pos5]+30)**2  -0.111773554501713*(T[pos5]+30)+  2.696559088937191)
++	pos6=numpy.nonzero(numpy.logical_and(-25<=T,T<-20))[0]
++	if len(pos6):
++		rigidity[pos6]=10**8*(-0.000029799523463*(T[pos6]+25)**3+ 0.002025764738854*(T[pos6]+25)**2  -0.088217055680511*(T[pos6]+25)+  2.199331606342181)
++	pos7=numpy.nonzero(numpy.logical_and(-20<=T,T<-15))[0]
++	if len(pos7):
++		rigidity[pos7]=10**8*(0.000136920904777*(T[pos7]+20)**3+  0.001578771886910*(T[pos7]+20)**2  -0.070194372551690*(T[pos7]+20)+  1.805165505978111)
++	pos8=numpy.nonzero(numpy.logical_and(-15<=T,T<-10))[0]
++	if len(pos8):
++		rigidity[pos8]=10**8*(-0.000899763781026*(T[pos8]+15)**3+ 0.003632585458564*(T[pos8]+15)**2  -0.044137585824322*(T[pos8]+15)+  1.510778053489523)
++	pos9=numpy.nonzero(numpy.logical_and(-10<=T,T<-5))[0]
++	if len(pos9):
++		rigidity[pos9]=10**8*(0.001676964325070*(T[pos9]+10)**3-  0.009863871256831*(T[pos9]+10)**2  -0.075294014815659*(T[pos9]+10)+  1.268434288203714)
++	pos10=numpy.nonzero(numpy.logical_and(-5<=T,T<-2))[0]
++	if len(pos10):
++		rigidity[pos10]=10**8*(-0.003748937622487*(T[pos10]+5)**3+0.015290593619213*(T[pos10]+5)**2  -0.048160403003748*(T[pos10]+5)+  0.854987973338348)
++	pos11=numpy.nonzero(-2<=T)[0]
++	if len(pos11):
++		rigidity[pos11]=10**8*(-0.003748937622488*(T[pos11]+2)**3-0.018449844983174*(T[pos11]+2)**2  -0.057638157095631*(T[pos11]+2)+  0.746900791092860)
+ 
+ 	#Now make sure that rigidity is positive
+-	pos=numpy.nonzero(rigidity<0)
+-	rigidity[pos]=1**6 
++	pos=numpy.nonzero(rigidity<0)[0]
++	if len(pos):
++		rigidity[pos]=1**6 
+ 
+ 	return rigidity
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17547-17548.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17547-17548.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17547-17548.diff	(revision 17802)
@@ -0,0 +1,196 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17547)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17548)
+@@ -4257,6 +4257,7 @@
+ 	IssmDouble  dvx[3],dvy[3],dvz[3],B,n;
+ 	IssmDouble *xyz_list = NULL;
+ 	IssmDouble  Jdet,r;
++	Gauss*      gauss = NULL;
+ 
+ 	parameters->FindParam(&meshtype,MeshTypeEnum);
+ 	switch(meshtype){
+@@ -4308,7 +4309,7 @@
+ 			sigmapyz_input=element->GetInput(DeviatoricStressyzEnum); _assert_(sigmapyz_input);
+ 		}
+ 
+-		Gauss* gauss=element->NewGauss(5);
++		gauss=element->NewGauss(5);
+ 		for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 			gauss->GaussPoint(ig);
+ 			element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+@@ -4373,30 +4374,128 @@
+ 						Ke,1);
+ 
+ 			/*Create Right hand sides*/
+-			for(int ii=0;ii<tnumnodes;ii++) pe_xx[ii] += sigmapxx*tbasis[ii]*gauss->weight*Jdet;
+-			for(int ii=0;ii<tnumnodes;ii++) pe_yy[ii] += sigmapyy*tbasis[ii]*gauss->weight*Jdet;
+-			for(int ii=0;ii<tnumnodes;ii++) pe_xy[ii] += sigmapxy*tbasis[ii]*gauss->weight*Jdet;
++			for(int ii=0;ii<tnumnodes;ii++) pe_xx[ii] += (r*epsxx+sigmapxx)*tbasis[ii]*gauss->weight*Jdet;
++			for(int ii=0;ii<tnumnodes;ii++) pe_yy[ii] += (r*epsyy+sigmapyy)*tbasis[ii]*gauss->weight*Jdet;
++			for(int ii=0;ii<tnumnodes;ii++) pe_xy[ii] += (r*epsxy+sigmapxy)*tbasis[ii]*gauss->weight*Jdet;
+ 			if(dim==3){
+-				for(int ii=0;ii<tnumnodes;ii++) pe_zz[ii] += sigmapzz*tbasis[ii]*gauss->weight*Jdet;
+-				for(int ii=0;ii<tnumnodes;ii++) pe_xz[ii] += sigmapxz*tbasis[ii]*gauss->weight*Jdet;
+-				for(int ii=0;ii<tnumnodes;ii++) pe_yz[ii] += sigmapyz*tbasis[ii]*gauss->weight*Jdet;
++				for(int ii=0;ii<tnumnodes;ii++) pe_zz[ii] += (r*epszz+sigmapzz)*tbasis[ii]*gauss->weight*Jdet;
++				for(int ii=0;ii<tnumnodes;ii++) pe_xz[ii] += (r*epsxz+sigmapxz)*tbasis[ii]*gauss->weight*Jdet;
++				for(int ii=0;ii<tnumnodes;ii++) pe_yz[ii] += (r*epsyz+sigmapyz)*tbasis[ii]*gauss->weight*Jdet;
+ 			}
+ 		}
+ 
+ 		/*Solve the systems*/
+-		_error_("S");
++		IssmDouble* d_xx = xNew<IssmDouble>(tnumnodes);
++		IssmDouble* d_yy = xNew<IssmDouble>(tnumnodes);
++		IssmDouble* d_xy = xNew<IssmDouble>(tnumnodes);
++		IssmDouble* d_zz = NULL;
++		IssmDouble* d_xz = NULL;
++		IssmDouble* d_yz = NULL;
++		if(dim==2){
++			_assert_(tnumnodes==3);
++			Matrix3x3Solve(&d_xx[0],Ke,pe_xx);
++			Matrix3x3Solve(&d_yy[0],Ke,pe_yy);
++			Matrix3x3Solve(&d_xy[0],Ke,pe_xy);
++			element->AddInput(StrainRatexxEnum,d_xx,P1DGEnum);
++			element->AddInput(StrainRateyyEnum,d_yy,P1DGEnum);
++			element->AddInput(StrainRatexyEnum,d_xy,P1DGEnum);
++		}
++		else{
++			_assert_(tnumnodes==4);
++			Matrix3x3Solve(&d_xx[0],Ke,pe_xx);
++			Matrix3x3Solve(&d_yy[0],Ke,pe_yy);
++			Matrix3x3Solve(&d_xy[0],Ke,pe_xy);
++			Matrix3x3Solve(&d_zz[0],Ke,pe_zz);
++			Matrix3x3Solve(&d_xz[0],Ke,pe_xz);
++			Matrix3x3Solve(&d_yz[0],Ke,pe_yz);
++			element->AddInput(StrainRatexxEnum,d_xx,P1DGEnum);
++			element->AddInput(StrainRateyyEnum,d_yy,P1DGEnum);
++			element->AddInput(StrainRatexyEnum,d_xy,P1DGEnum);
++			element->AddInput(StrainRatezzEnum,d_zz,P1DGEnum);
++			element->AddInput(StrainRatexzEnum,d_xz,P1DGEnum);
++			element->AddInput(StrainRateyzEnum,d_yz,P1DGEnum);
++		}
+ 
++		/*Update tau accordingly*/
++		IssmDouble* tau_xx = xNew<IssmDouble>(tnumnodes);
++		IssmDouble* tau_yy = xNew<IssmDouble>(tnumnodes);
++		IssmDouble* tau_xy = xNew<IssmDouble>(tnumnodes);
++		IssmDouble* tau_zz = NULL;
++		IssmDouble* tau_xz = NULL;
++		IssmDouble* tau_yz = NULL;
++		Input* epsxx_input=element->GetInput(StrainRatexxEnum); _assert_(epsxx_input);
++		Input* epsyy_input=element->GetInput(StrainRateyyEnum); _assert_(epsyy_input);
++		Input* epsxy_input=element->GetInput(StrainRatexyEnum); _assert_(epsxy_input);
++		Input* epszz_input=NULL; Input* epsxz_input=NULL; Input* epsyz_input=NULL;
++		if(dim==3){
++			epszz_input=element->GetInput(StrainRatezzEnum); _assert_(epszz_input);
++			epsxz_input=element->GetInput(StrainRatexzEnum); _assert_(epsxz_input);
++			epsyz_input=element->GetInput(StrainRateyzEnum); _assert_(epsyz_input);
++		}
++		Gauss* gauss = element->NewGauss();
++		for(int ig=0;ig<tnumnodes;ig++){
++			gauss->GaussNode(P1DGEnum,ig);
++
++			/*Get D(u)*/
++			vx_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
++			vy_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
++			if(dim==3){
++				vz_input->GetInputDerivativeValue(&dvz[0],xyz_list,gauss);
++			}
++			epsxx = dvx[0];
++			epsyy = dvy[1];
++			epsxy = 0.5*(dvx[1] + dvy[0]); 
++			if(dim==3){
++				epszz = dvz[2]; 
++				epsxz = 0.5*(dvx[2] + dvz[0]);
++				epsyz = 0.5*(dvy[2] + dvz[1]);
++			}
++
++			/*Get tau^(n-1) from inputs*/
++			sigmapxx_input->GetInputValue(&sigmapxx,gauss);
++			sigmapyy_input->GetInputValue(&sigmapyy,gauss);
++			sigmapxy_input->GetInputValue(&sigmapxy,gauss);
++			if(dim==3){
++				sigmapzz_input->GetInputValue(&sigmapzz,gauss);
++				sigmapxz_input->GetInputValue(&sigmapxz,gauss);
++				sigmapyz_input->GetInputValue(&sigmapyz,gauss);
++			}
++
++			/*Get d and update tau accordingly*/
++			tau_xx[ig] = sigmapxx + r*(epsxx - d_xx[ig]);
++			tau_yy[ig] = sigmapyy + r*(epsyy - d_yy[ig]);
++			tau_xy[ig] = sigmapxy + r*(epsxy - d_xy[ig]);
++			if(dim==3){
++				tau_zz[ig] = sigmapzz + r*(epszz - d_zz[ig]);
++				tau_xz[ig] = sigmapxz + r*(epsxz - d_xz[ig]);
++				tau_yz[ig] = sigmapyz + r*(epsyz - d_yz[ig]);
++			}
++		}
++
++		/*Add inputs*/
++		element->AddInput(StrainRatexxEnum,tau_xx,P1DGEnum);
++		element->AddInput(StrainRateyyEnum,tau_yy,P1DGEnum);
++		element->AddInput(StrainRatexyEnum,tau_xy,P1DGEnum);
++		if(dim==3){
++			element->AddInput(StrainRatezzEnum,tau_zz,P1DGEnum);
++			element->AddInput(StrainRatexzEnum,tau_xz,P1DGEnum);
++			element->AddInput(StrainRateyzEnum,tau_yz,P1DGEnum);
++		}
++
+ 		/*Clean up and */
++		xDelete<IssmDouble>(xyz_list);
+ 		xDelete<IssmDouble>(tbasis);
+ 		xDelete<IssmDouble>(Ke);
+-		xDelete<IssmDouble>(pe_xx);
+-		xDelete<IssmDouble>(pe_yy);
+-		xDelete<IssmDouble>(pe_zz);
+-		xDelete<IssmDouble>(pe_xy);
+-		xDelete<IssmDouble>(pe_xz);
+-		xDelete<IssmDouble>(pe_yz);
++		xDelete<IssmDouble>(pe_xx); xDelete<IssmDouble>(d_xx);   xDelete<IssmDouble>(tau_xx);
++		xDelete<IssmDouble>(pe_yy); xDelete<IssmDouble>(d_yy);   xDelete<IssmDouble>(tau_yy);
++		xDelete<IssmDouble>(pe_zz); xDelete<IssmDouble>(d_zz);   xDelete<IssmDouble>(tau_zz);
++		xDelete<IssmDouble>(pe_xy); xDelete<IssmDouble>(d_xy);   xDelete<IssmDouble>(tau_xy);
++		xDelete<IssmDouble>(pe_xz); xDelete<IssmDouble>(d_xz);   xDelete<IssmDouble>(tau_xz);
++		xDelete<IssmDouble>(pe_yz); xDelete<IssmDouble>(d_yz);   xDelete<IssmDouble>(tau_yz);
+ 	}
+ 
++	delete gauss;
++
+ }/*}}}*/
+ 
+ /*Coupling (Tiling)*/
+Index: ../trunk-jpl/src/c/shared/Matrix/MatrixUtils.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Matrix/MatrixUtils.cpp	(revision 17547)
++++ ../trunk-jpl/src/c/shared/Matrix/MatrixUtils.cpp	(revision 17548)
+@@ -366,3 +366,16 @@
+ 	Ainv[8]=(A[0]*A[4]-A[1]*A[3])/det; /* = (a*e-b*d)/det */
+ 
+ }/*}}}*/
++/*FUNCTION Matrix3x3Solve(IssmDouble* X,IssmDouble* A,IssmDouble* B) {{{*/
++void Matrix3x3Solve(IssmDouble* X,IssmDouble* A,IssmDouble* B){
++
++	IssmDouble Ainv[3][3];
++
++	Matrix3x3Invert(&Ainv[0][0],A);
++	for(int i=0;i<3;i++) X[i]=Ainv[i][0]*B[0] + Ainv[i][1]*B[1] + Ainv[i][2]*B[2];
++
++}/*}}}*/
++/*FUNCTION Matrix4x4Solve(IssmDouble* X,IssmDouble* A,IssmDouble *B) {{{*/
++void Matrix4x4Solve(IssmDouble* X,IssmDouble* A,IssmDouble *B){
++	_error_("STOP");
++}/*}}}*/
+Index: ../trunk-jpl/src/c/shared/Matrix/matrix.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Matrix/matrix.h	(revision 17547)
++++ ../trunk-jpl/src/c/shared/Matrix/matrix.h	(revision 17548)
+@@ -14,5 +14,7 @@
+ void Matrix2x2Determinant(IssmDouble* Adet,IssmDouble* A);
+ void Matrix3x3Invert(IssmDouble* Ainv, IssmDouble* A);
+ void Matrix3x3Determinant(IssmDouble* Adet,IssmDouble* A);
++void Matrix3x3Solve(IssmDouble* X,IssmDouble* A,IssmDouble* B);
++void Matrix4x4Solve(IssmDouble* X,IssmDouble* A,IssmDouble* B);
+ 
+ #endif //ifndef _MATRIXUTILS_H_
Index: issm/oecreview/Archive/16554-17801/ISSM-17548-17549.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17548-17549.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17548-17549.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp	(revision 17548)
++++ ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp	(revision 17549)
+@@ -677,6 +677,7 @@
+ 		case MINIcondensedEnum: return P1Enum;
+ 		case MINIEnum:          return P1Enum;
+ 		case TaylorHoodEnum:    return P1Enum;
++		case XTaylorHoodEnum:   return P1Enum;
+ 		default:       _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+ 	}
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17549-17550.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17549-17550.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17549-17550.diff	(revision 17802)
@@ -0,0 +1,4 @@
+Index: ../trunk-jpl/test/Archives/Archive435.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17550-17551.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17550-17551.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17550-17551.diff	(revision 17802)
@@ -0,0 +1,63 @@
+Index: ../trunk-jpl/src/m/interp/averaging.py
+===================================================================
+--- ../trunk-jpl/src/m/interp/averaging.py	(revision 17550)
++++ ../trunk-jpl/src/m/interp/averaging.py	(revision 17551)
+@@ -24,7 +24,7 @@
+ 	      temperature=averaging(md,md.initialization.temperature,1,1)
+ 	'''
+ 
+-	if (len(data)!=md.mesh.numberofelements & len(data)!=md.mesh.numberofvertices):
++	if len(data)!=md.mesh.numberofelements and len(data)!=md.mesh.numberofvertices:
+ 		raise StandardError('averaging error message: data not supported yet')
+ 	if md.mesh.dimension==3 and layer!=0:
+ 		if layer<=0 or layer>md.mesh.numberoflayers:
+Index: ../trunk-jpl/src/m/interp/holefiller.py
+===================================================================
+--- ../trunk-jpl/src/m/interp/holefiller.py	(revision 0)
++++ ../trunk-jpl/src/m/interp/holefiller.py	(revision 17551)
+@@ -0,0 +1,45 @@
++import numpy as npy
++from scipy.spatial import cKDTree
++
++def nearestneighbors(md,data,goodids,badids,knn):
++	'''
++	fill holes using nearest neigbors.  Arguments include:
++
++	md:		the model
++	data:		the data field to be filled (full field, including holes)
++	goodids:	id's into the vertices that have good data
++	badids:	id's into the vertices with missing/bad data
++	knn:		integer representing the k nearest neighbors to use for filling
++				holes.  The average data value over the k nearest neighbors is 
++				then used to fill the hole.
++
++	Usage:
++		filleddata=nearestneighbors(md,goodids,badids,knn)
++
++	Example:
++		filledthickness=nearestneighbors(md,goodids,badids,5)
++	'''
++
++	if type(knn) != int or knn<1:
++		raise TypeError('nearestneighbors error: knn should be an integer>1')
++
++	if len(data) != md.mesh.numberofvertices:
++		raise StandardError('nearestneighbors error: "data" should have length md.mesh.numberofvertices')
++
++	filled=data
++	
++	XYGood=npy.dstack([md.mesh.x[goodids],md.mesh.y[goodids]])[0]
++	XYBad=npy.dstack([md.mesh.x[badids],md.mesh.y[badids]])[0]
++	tree=cKDTree(XYGood)
++	nearest=tree.query(XYBad,k=knn)[1]
++	
++	if knn==1:
++		filled[badids]=filled[goodids][nearest] # can add k=N to return the N nearest neighbors
++	else:
++		for i in range(len(badids)):
++			neardat=[]
++			for j in range(knn):
++				neardat.append(filled[goodids][nearest[i][j]])
++				filled[badids[i]]=npy.mean(neardat)
++				
++	return filled
Index: issm/oecreview/Archive/16554-17801/ISSM-17551-17552.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17551-17552.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17551-17552.diff	(revision 17802)
@@ -0,0 +1,4 @@
+Index: ../trunk-jpl/test/Archives/Archive510.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17552-17553.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17552-17553.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17552-17553.diff	(revision 17802)
@@ -0,0 +1,239 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17552)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17553)
+@@ -2899,11 +2899,9 @@
+ 	IssmDouble  r,FSreconditioning,Jdet;
+ 	IssmDouble *xyz_list = NULL;
+ 
+-	/*FIXME this should change*/
+-	r = 1.;
+-
+ 	/*Get problem dimension*/
+ 	element->FindParam(&meshtype,MeshTypeEnum);
++	element->FindParam(&r,AugmentedLagrangianREnum);
+ 	switch(meshtype){
+ 		case Mesh2DverticalEnum: dim = 2; epssize = 3; break;
+ 		case Mesh3DEnum:         dim = 3; epssize = 6; break;
+@@ -3288,7 +3286,7 @@
+ 		ElementVector* pe3=CreatePVectorFSFront(element);
+ 		ElementVector* petemp =new ElementVector(pe1,pe2,pe3);
+ 		ElementVector* pe4=CreatePVectorFSViscousXTH(element);
+-		ElementVector* pe = new ElementVector(petemp,pe4);
++		pe = new ElementVector(petemp,pe4);
+ 		delete pe1;
+ 		delete pe2;
+ 		delete pe3;
+@@ -3402,9 +3400,6 @@
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+-	/*FIXME*/
+-	r = 1.;
+-
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int vnumnodes = element->NumberofNodesVelocity();
+ 	int pnumnodes = element->NumberofNodesPressure();
+@@ -3426,6 +3421,7 @@
+ 	IssmDouble*    D       = xNewZeroInit<IssmDouble>(tausize*tnumnodes*tausize*tnumnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
++	element->FindParam(&r,AugmentedLagrangianREnum);
+ 	element->GetVerticesCoordinates(&xyz_list);
+ 
+ 	/*Get d and tau*/
+@@ -4259,6 +4255,7 @@
+ 	IssmDouble  Jdet,r;
+ 	Gauss*      gauss = NULL;
+ 
++	parameters->FindParam(&r,AugmentedLagrangianREnum);
+ 	parameters->FindParam(&meshtype,MeshTypeEnum);
+ 	switch(meshtype){
+ 		case Mesh2DverticalEnum: dim = 2; tausize = 3; break;
+@@ -4267,9 +4264,6 @@
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+ 	}
+ 
+-	/*FIXME*/
+-	r = 1.;
+-
+ 	for(int i=0;i<elements->Size();i++){
+ 		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+ 
+Index: ../trunk-jpl/src/c/shared/Numerics/NewtonSolveDnorm.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Numerics/NewtonSolveDnorm.cpp	(revision 17552)
++++ ../trunk-jpl/src/c/shared/Numerics/NewtonSolveDnorm.cpp	(revision 17553)
+@@ -1,5 +1,6 @@
+ #include <math.h>
+ #include "./types.h"
++#include "../Exceptions/exceptions.h"
+ 
+ int NewtonSolveDnorm(IssmDouble* pdnorm,IssmDouble c1,IssmDouble c2,IssmDouble c3,IssmDouble n){
+ 	/* solve the following equation using Newton-Raphson
+@@ -11,8 +12,14 @@
+ 	 *   we solve y = 10^x:
+ 	 */
+ 
++	/*trivial solution*/
++	if(c3==0.){
++		*pdnorm =0.;
++		return 0;
++	}
+ 
+ 	/*Intermediaries*/
++	int        counter = 0;
+ 	IssmDouble s = (1.+n)/n;
+ 	IssmDouble y2;
+ 	IssmDouble threshold = 1.e-12;
+@@ -23,16 +30,20 @@
+ 	while(true){
+ 
+ 		/*Newton step*/
+-		y2 = y1 - (c1*pow(pow(10.,y1),s-1.) + c2*pow(10.,y1) - c3)/((s-1)*c1*log(10)*pow(pow(10.,y1),s-1) + c2*log(10.)*pow(10.,y1));
++		y2 = y1 - (c1*pow(pow(10.,y1),s-1.) + c2*pow(10.,y1) - c3)/((s-1)*c1*log(10)*pow(pow(10.,y1),s-1.) + c2*log(10.)*pow(10.,y1));
+ 
+-		if( fabs(y2-y1)/fabs(y1)<threshold ){
++		if( fabs(y2-y1)/(fabs(y2))<threshold ){
+ 			break;
+ 		}
+ 		else{
+ 			y1=y2;
++			counter++;
+ 		}
++
++		if(counter>50) _error_("Could not converge");
+ 	}
+ 
+ 	/*Assign output pointer*/
+ 	*pdnorm = pow(10.,y2);
++	return 0;
+ }
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17552)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17553)
+@@ -623,6 +623,7 @@
+ 	/*Relaxation{{{*/
+ 	AbsoluteEnum,
+ 	IncrementalEnum,
++	AugmentedLagrangianREnum,
+ 	/*}}}*/
+ 	/*Grounding Line{{{*/
+ 	AgressiveMigrationEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17552)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17553)
+@@ -602,6 +602,7 @@
+ 		case TotalSmbEnum : return "TotalSmb";
+ 		case AbsoluteEnum : return "Absolute";
+ 		case IncrementalEnum : return "Incremental";
++		case AugmentedLagrangianREnum : return "AugmentedLagrangianR";
+ 		case AgressiveMigrationEnum : return "AgressiveMigration";
+ 		case NoneEnum : return "None";
+ 		case SoftMigrationEnum : return "SoftMigration";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17552)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17553)
+@@ -614,6 +614,7 @@
+ 	      else if (strcmp(name,"TotalSmb")==0) return TotalSmbEnum;
+ 	      else if (strcmp(name,"Absolute")==0) return AbsoluteEnum;
+ 	      else if (strcmp(name,"Incremental")==0) return IncrementalEnum;
++	      else if (strcmp(name,"AugmentedLagrangianR")==0) return AugmentedLagrangianREnum;
+ 	      else if (strcmp(name,"AgressiveMigration")==0) return AgressiveMigrationEnum;
+ 	      else if (strcmp(name,"None")==0) return NoneEnum;
+ 	      else if (strcmp(name,"SoftMigration")==0) return SoftMigrationEnum;
+@@ -627,11 +628,11 @@
+ 	      else if (strcmp(name,"GaussPenta")==0) return GaussPentaEnum;
+ 	      else if (strcmp(name,"FSSolver")==0) return FSSolverEnum;
+ 	      else if (strcmp(name,"Adjoint")==0) return AdjointEnum;
+-	      else if (strcmp(name,"Colinear")==0) return ColinearEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"ControlSteady")==0) return ControlSteadyEnum;
++	      if (strcmp(name,"Colinear")==0) return ColinearEnum;
++	      else if (strcmp(name,"ControlSteady")==0) return ControlSteadyEnum;
+ 	      else if (strcmp(name,"Fset")==0) return FsetEnum;
+ 	      else if (strcmp(name,"Gradient1")==0) return Gradient1Enum;
+ 	      else if (strcmp(name,"Gradient2")==0) return Gradient2Enum;
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp	(revision 17552)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp	(revision 17553)
+@@ -29,22 +29,33 @@
+ 	femmodel->UpdateConstraintsx();
+ 	analysis->InitializeXTH(femmodel->elements,femmodel->parameters);
+ 
+-	/*Solve KU=F*/
+-	SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
+-	CreateNodalConstraintsx(&ys,femmodel->nodes,configuration_type);
+-	Reduceloadx(pf, Kfs, ys); delete Kfs;
+-	Solverx(&uf, Kff, pf, NULL, df, femmodel->parameters); 
+-	delete Kff; delete pf; delete df;
+-	Mergesolutionfromftogx(&ug, uf,ys,femmodel->nodes,femmodel->parameters);delete uf; delete ys;
++	/*Convergence criterion*/
++	int count = 0;
++	femmodel->parameters->SetParam(10.,AugmentedLagrangianREnum);
+ 
+-	/*Update solution*/
+-	InputUpdateFromSolutionx(femmodel,ug); 
++	while(true){
+ 
+-	/*Update d and tau accordingly*/
+-	analysis->InputUpdateFromSolutionFSXTH(femmodel->elements,femmodel->parameters);
++		/*Solve KU=F*/
++		SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
++		CreateNodalConstraintsx(&ys,femmodel->nodes,configuration_type);
++		Reduceloadx(pf, Kfs, ys); delete Kfs;
++		Solverx(&uf, Kff, pf, NULL, df, femmodel->parameters); 
++		delete Kff; delete pf; delete df;
++		Mergesolutionfromftogx(&ug, uf,ys,femmodel->nodes,femmodel->parameters);delete uf; delete ys;
+ 
++		/*Update solution*/
++		printf("ug norm = %g\n",ug->Norm(NORM_TWO));
++		InputUpdateFromSolutionx(femmodel,ug); 
++
++		/*Update d and tau accordingly*/
++		analysis->InputUpdateFromSolutionFSXTH(femmodel->elements,femmodel->parameters);
++
++		count++;
++		if(count>5) break;
++	}
++
+ 	/*Check for convergence*/
+-	_error_("STOP");
++	//_error_("STOP");
+ 
+ 	delete ug;  
+ 	delete analysis;
+Index: ../trunk-jpl/src/m/enum/AugmentedLagrangianREnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/AugmentedLagrangianREnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/AugmentedLagrangianREnum.m	(revision 17553)
+@@ -0,0 +1,11 @@
++function macro=AugmentedLagrangianREnum()
++%AUGMENTEDLAGRANGIANRENUM - Enum of AugmentedLagrangianR
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=AugmentedLagrangianREnum()
++
++macro=StringToEnum('AugmentedLagrangianR');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17552)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17553)
+@@ -594,6 +594,7 @@
+ def TotalSmbEnum(): return StringToEnum("TotalSmb")[0]
+ def AbsoluteEnum(): return StringToEnum("Absolute")[0]
+ def IncrementalEnum(): return StringToEnum("Incremental")[0]
++def AugmentedLagrangianREnum(): return StringToEnum("AugmentedLagrangianR")[0]
+ def AgressiveMigrationEnum(): return StringToEnum("AgressiveMigration")[0]
+ def NoneEnum(): return StringToEnum("None")[0]
+ def SoftMigrationEnum(): return StringToEnum("SoftMigration")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17553-17554.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17553-17554.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17553-17554.diff	(revision 17802)
@@ -0,0 +1,122 @@
+Index: ../trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim
+===================================================================
+--- ../trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim	(revision 17553)
++++ ../trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim	(revision 17554)
+@@ -411,14 +411,13 @@
+ "ISSM's objects begin
+ syn keyword cType BoolInput
+ syn keyword cType BoolParam
+-syn keyword cType classes
+ syn keyword cType Constraint
+ syn keyword cType Constraints
+ syn keyword cType Contour
+ syn keyword cType Contours
+ syn keyword cType ControlInput
++syn keyword cType DataSetParam
+ syn keyword cType DatasetInput
+-syn keyword cType DataSetParam
+ syn keyword cType Definition
+ syn keyword cType DependentObject
+ syn keyword cType DofIndexing
+@@ -431,20 +430,19 @@
+ syn keyword cType Element
+ syn keyword cType ElementHook
+ syn keyword cType ElementMatrix
++syn keyword cType ElementVector
+ syn keyword cType Elements
+-syn keyword cType ElementVector
+ syn keyword cType ExponentialVariogram
+ syn keyword cType ExternalResult
+ syn keyword cType FemModel
+ syn keyword cType FileParam
+ syn keyword cType Friction
+ syn keyword cType Gauss
+-syn keyword cType GaussianVariogram
+-syn keyword cType gaussobjects
+ syn keyword cType GaussPenta
+ syn keyword cType GaussSeg
+ syn keyword cType GaussTetra
+ syn keyword cType GaussTria
++syn keyword cType GaussianVariogram
+ syn keyword cType GenericExternalResult
+ syn keyword cType GenericOption
+ syn keyword cType GenericParam
+@@ -458,7 +456,6 @@
+ syn keyword cType IntParam
+ syn keyword cType IntVecParam
+ syn keyword cType IoModel
+-syn keyword cType krigingobjects
+ syn keyword cType Load
+ syn keyword cType Loads
+ syn keyword cType Massfluxatgate
+@@ -466,7 +463,6 @@
+ syn keyword cType Materials
+ syn keyword cType Matice
+ syn keyword cType Matpar
+-syn keyword cType matrixobjects
+ syn keyword cType MatrixParam
+ syn keyword cType Misfit
+ syn keyword cType Node
+@@ -475,8 +471,8 @@
+ syn keyword cType Observation
+ syn keyword cType Observations
+ syn keyword cType Option
++syn keyword cType OptionUtilities
+ syn keyword cType Options
+-syn keyword cType OptionUtilities
+ syn keyword cType Param
+ syn keyword cType Parameters
+ syn keyword cType Pengrid
+@@ -488,12 +484,12 @@
+ syn keyword cType Profiler
+ syn keyword cType Quadtree
+ syn keyword cType Results
++syn keyword cType RiftStruct
+ syn keyword cType Riftfront
+-syn keyword cType RiftStruct
+ syn keyword cType Seg
+ syn keyword cType SegInput
++syn keyword cType SegRef
+ syn keyword cType Segment
+-syn keyword cType SegRef
+ syn keyword cType SpcDynamic
+ syn keyword cType SpcStatic
+ syn keyword cType SpcTransient
+@@ -513,6 +509,10 @@
+ syn keyword cType VectorParam
+ syn keyword cType Vertex
+ syn keyword cType Vertices
++syn keyword cType classes
++syn keyword cType gaussobjects
++syn keyword cType krigingobjects
++syn keyword cType matrixobjects
+ syn keyword cType AdjointBalancethicknessAnalysis
+ syn keyword cType AdjointHorizAnalysis
+ syn keyword cType Analysis
+@@ -579,8 +579,8 @@
+ syn keyword cConstant BasalforcingsGeothermalfluxEnum
+ syn keyword cConstant BasalforcingsMeltingRateCorrectionEnum
+ syn keyword cConstant BasalforcingsMeltingRateEnum
+-syn keyword cConstant BathymetryEnum
+ syn keyword cConstant BedEnum
++syn keyword cConstant BaseEnum
+ syn keyword cConstant ConstantsGEnum
+ syn keyword cConstant ConstantsReferencetemperatureEnum
+ syn keyword cConstant ConstantsYtsEnum
+@@ -999,7 +999,7 @@
+ syn keyword cConstant QmuVyEnum
+ syn keyword cConstant QmuVzEnum
+ syn keyword cConstant QmuThicknessEnum
+-syn keyword cConstant QmuBedEnum
++syn keyword cConstant QmuBaseEnum
+ syn keyword cConstant QmuSurfaceEnum
+ syn keyword cConstant QmuMeltingEnum
+ syn keyword cConstant QmuVxMeshEnum
+@@ -1133,6 +1133,7 @@
+ syn keyword cConstant TotalSmbEnum
+ syn keyword cConstant AbsoluteEnum
+ syn keyword cConstant IncrementalEnum
++syn keyword cConstant AugmentedLagrangianREnum
+ syn keyword cConstant AgressiveMigrationEnum
+ syn keyword cConstant NoneEnum
+ syn keyword cConstant SoftMigrationEnum
Index: issm/oecreview/Archive/16554-17801/ISSM-17554-17555.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17554-17555.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17554-17555.diff	(revision 17802)
@@ -0,0 +1,3871 @@
+Index: ../trunk-jpl/test/NightlyRun/test323.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test323.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test323.py	(revision 17555)
+@@ -25,21 +25,21 @@
+ 	md.results.TransientSolution[0].Vy,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[1].Vx,\
+ 	md.results.TransientSolution[1].Vy,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[2].Vx,\
+ 	md.results.TransientSolution[2].Vy,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	]
+Index: ../trunk-jpl/test/NightlyRun/test222.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test222.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test222.m	(revision 17555)
+@@ -14,21 +14,21 @@
+ 	(md.results.TransientSolution(1).Vy),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(2).Vx),...
+ 	(md.results.TransientSolution(2).Vy),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(3).Vx),...
+ 	(md.results.TransientSolution(3).Vy),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	};
+Index: ../trunk-jpl/test/NightlyRun/test124.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test124.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test124.m	(revision 17555)
+@@ -27,21 +27,21 @@
+ 	(md.results.TransientSolution(1).Vy),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(2).Vx),...
+ 	(md.results.TransientSolution(2).Vy),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(3).Vx),...
+ 	(md.results.TransientSolution(3).Vy),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	};
+Index: ../trunk-jpl/test/NightlyRun/test703.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test703.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test703.m	(revision 17555)
+@@ -84,42 +84,42 @@
+ 	(md.results.TransientSolution(1).Vy),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(2).Vx),...
+ 	(md.results.TransientSolution(2).Vy),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(3).Vx),...
+ 	(md.results.TransientSolution(3).Vy),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md1.results.TransientSolution(1).Vx),...
+ 	(md1.results.TransientSolution(1).Vy),...
+ 	(md1.results.TransientSolution(1).Vel),...
+ 	(md1.results.TransientSolution(1).Pressure),...
+-	(md1.results.TransientSolution(1).Bed),...
++	(md1.results.TransientSolution(1).Base),...
+ 	(md1.results.TransientSolution(1).Surface),...
+ 	(md1.results.TransientSolution(1).Thickness),...
+ 	(md1.results.TransientSolution(2).Vx),...
+ 	(md1.results.TransientSolution(2).Vy),...
+ 	(md1.results.TransientSolution(2).Vel),...
+ 	(md1.results.TransientSolution(2).Pressure),...
+-	(md1.results.TransientSolution(2).Bed),...
++	(md1.results.TransientSolution(2).Base),...
+ 	(md1.results.TransientSolution(2).Surface),...
+ 	(md1.results.TransientSolution(2).Thickness),...
+ 	(md1.results.TransientSolution(3).Vx),...
+ 	(md1.results.TransientSolution(3).Vy),...
+ 	(md1.results.TransientSolution(3).Vel),...
+ 	(md1.results.TransientSolution(3).Pressure),...
+-	(md1.results.TransientSolution(3).Bed),...
++	(md1.results.TransientSolution(3).Base),...
+ 	(md1.results.TransientSolution(3).Surface),...
+ 	(md1.results.TransientSolution(3).Thickness),...
+ 	};
+Index: ../trunk-jpl/test/NightlyRun/test426.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test426.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test426.m	(revision 17555)
+@@ -26,19 +26,19 @@
+ 	1e-11,1e-10,1e-11,3e-11,2e-12,5e-12,...
+ 	1e-10,1e-10,1e-10,5e-11,2e-12,5e-12};
+ field_values={...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).MaskGroundediceLevelset),...
+ 	(md.results.TransientSolution(1).IceVolume),...
+ 	(md.results.TransientSolution(1).IceVolumeAboveFloatation),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).MaskGroundediceLevelset),...
+ 	(md.results.TransientSolution(2).IceVolume),...
+ 	(md.results.TransientSolution(2).IceVolumeAboveFloatation),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).MaskGroundediceLevelset),...
+Index: ../trunk-jpl/test/NightlyRun/test507.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test507.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test507.m	(revision 17555)
+@@ -16,7 +16,7 @@
+ 	(md.results.TransientSolution(1).Vz),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).Temperature),...
+@@ -26,7 +26,7 @@
+ 	(md.results.TransientSolution(2).Vz),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).Temperature),...
+Index: ../trunk-jpl/test/NightlyRun/test328.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test328.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test328.m	(revision 17555)
+@@ -18,7 +18,7 @@
+ 	(md.results.TransientSolution(1).Vx),...
+ 	(md.results.TransientSolution(1).Vy),...
+ 	(md.results.TransientSolution(1).Vel),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).SurfaceforcingsMassBalance),...
+@@ -26,7 +26,7 @@
+ 	(md.results.TransientSolution(2).Vx),...
+ 	(md.results.TransientSolution(2).Vy),...
+ 	(md.results.TransientSolution(2).Vel),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).TotalSmb),...
+@@ -34,7 +34,7 @@
+ 	(md.results.TransientSolution(3).Vx),...
+ 	(md.results.TransientSolution(3).Vy),...
+ 	(md.results.TransientSolution(3).Vel),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).SurfaceforcingsMassBalance),...
+Index: ../trunk-jpl/test/NightlyRun/test409.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test409.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test409.m	(revision 17555)
+@@ -20,7 +20,7 @@
+ 	(md.results.TransientSolution(1).Vz),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).Temperature),...
+@@ -30,7 +30,7 @@
+ 	(md.results.TransientSolution(2).Vz),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).Temperature),...
+@@ -40,7 +40,7 @@
+ 	(md.results.TransientSolution(3).Vz),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).Temperature),...
+Index: ../trunk-jpl/test/NightlyRun/test211.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test211.py	(revision 17555)
+@@ -35,7 +35,7 @@
+ 	md.results.TransientSolution[0].Vz,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].Temperature,\
+@@ -45,7 +45,7 @@
+ 	md.results.TransientSolution[1].Vz,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].Temperature,\
+@@ -55,7 +55,7 @@
+ 	md.results.TransientSolution[2].Vz,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	md.results.TransientSolution[2].Temperature,\
+Index: ../trunk-jpl/test/NightlyRun/test225.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test225.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test225.py	(revision 17555)
+@@ -32,7 +32,7 @@
+ 	md.results.TransientSolution[0].Vz,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].Temperature,\
+@@ -42,7 +42,7 @@
+ 	md.results.TransientSolution[1].Vz,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].Temperature,\
+@@ -52,7 +52,7 @@
+ 	md.results.TransientSolution[2].Vz,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	md.results.TransientSolution[2].Temperature,\
+Index: ../trunk-jpl/test/NightlyRun/test231.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test231.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test231.m	(revision 17555)
+@@ -34,7 +34,7 @@
+ 	(md.results.TransientSolution(1).Vz),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).SurfaceforcingsMassBalance),...
+@@ -43,7 +43,7 @@
+ 	(md.results.TransientSolution(2).Vz),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).SurfaceforcingsMassBalance),...
+@@ -52,7 +52,7 @@
+ 	(md.results.TransientSolution(3).Vz),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).SurfaceforcingsMassBalance),...
+@@ -61,7 +61,7 @@
+ 	(md.results.TransientSolution(4).Vz),...
+ 	(md.results.TransientSolution(4).Vel),...
+ 	(md.results.TransientSolution(4).Pressure),...
+-	(md.results.TransientSolution(4).Bed),...
++	(md.results.TransientSolution(4).Base),...
+ 	(md.results.TransientSolution(4).Surface),...
+ 	(md.results.TransientSolution(4).Thickness),...
+ 	(md.results.TransientSolution(4).SurfaceforcingsMassBalance),...
+Index: ../trunk-jpl/test/NightlyRun/test427.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test427.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test427.py	(revision 17555)
+@@ -35,15 +35,15 @@
+ 	1e-13,1e-13,1e-13,1e-13,\
+ 	1e-10,1e-11,1e-10,1e-13]
+ field_values=[\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].MaskGroundediceLevelset,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].MaskGroundediceLevelset,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	md.results.TransientSolution[2].MaskGroundediceLevelset,\
+Index: ../trunk-jpl/test/NightlyRun/test435.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test435.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test435.m	(revision 17555)
+@@ -50,7 +50,7 @@
+ 	1e-11,3e-12,9e-12,2e-11,1e-09,1e-08,2e-10,1e-10,...
+ 	1e-10,3e-11,1e-10,7e-11,1e-09,1e-08,1e-09,1e-11};
+ field_values={...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).MaskGroundediceLevelset),...
+@@ -58,7 +58,7 @@
+ 	(md.results.TransientSolution(1).Vy),...
+ 	(md.results.TransientSolution(1).Vz),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).MaskGroundediceLevelset),...
+@@ -66,7 +66,7 @@
+ 	(md.results.TransientSolution(2).Vy),...
+ 	(md.results.TransientSolution(2).Vz),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).MaskGroundediceLevelset),...
+Index: ../trunk-jpl/test/NightlyRun/test3010.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test3010.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test3010.m	(revision 17555)
+@@ -20,7 +20,7 @@
+ 	(md.results.TransientSolution(1).Vy),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).IceVolume),...
+@@ -28,7 +28,7 @@
+ 	(md.results.TransientSolution(2).Vy),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).IceVolume),...
+@@ -36,7 +36,7 @@
+ 	(md.results.TransientSolution(3).Vy),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).IceVolume),...
+Index: ../trunk-jpl/test/NightlyRun/test315.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test315.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test315.py	(revision 17555)
+@@ -28,7 +28,7 @@
+ 	md.results.TransientSolution[0].Vz,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].Temperature,\
+@@ -38,7 +38,7 @@
+ 	md.results.TransientSolution[1].Vz,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].Temperature,\
+@@ -48,7 +48,7 @@
+ 	md.results.TransientSolution[2].Vz,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	md.results.TransientSolution[2].Temperature,\
+Index: ../trunk-jpl/test/NightlyRun/test208.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test208.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test208.py	(revision 17555)
+@@ -26,21 +26,21 @@
+ 	md.results.TransientSolution[0].Vy,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[1].Vx,\
+ 	md.results.TransientSolution[1].Vy,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[2].Vx,\
+ 	md.results.TransientSolution[2].Vy,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	]
+Index: ../trunk-jpl/test/NightlyRun/test223.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test223.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test223.m	(revision 17555)
+@@ -15,21 +15,21 @@
+ 	(md.results.TransientSolution(1).Vy),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(2).Vx),...
+ 	(md.results.TransientSolution(2).Vy),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(3).Vx),...
+ 	(md.results.TransientSolution(3).Vy),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	};
+Index: ../trunk-jpl/test/NightlyRun/test329.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test329.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test329.py	(revision 17555)
+@@ -33,7 +33,7 @@
+ 	md.results.TransientSolution[0].Vy,\
+ 	md.results.TransientSolution[0].Vz,\
+ 	md.results.TransientSolution[0].Vel,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].Temperature,\
+@@ -43,7 +43,7 @@
+ 	md.results.TransientSolution[1].Vy,\
+ 	md.results.TransientSolution[1].Vz,\
+ 	md.results.TransientSolution[1].Vel,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].Temperature,\
+@@ -53,7 +53,7 @@
+ 	md.results.TransientSolution[2].Vy,\
+ 	md.results.TransientSolution[2].Vz,\
+ 	md.results.TransientSolution[2].Vel,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	md.results.TransientSolution[2].Temperature,\
+Index: ../trunk-jpl/test/NightlyRun/test427.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test427.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test427.m	(revision 17555)
+@@ -25,15 +25,15 @@
+ 	4e-12,2e-12,6e-12,2e-11,...
+ 	1e-10,3e-11,1e-10,7e-11};
+ field_values={...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).MaskGroundediceLevelset),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).MaskGroundediceLevelset),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).MaskGroundediceLevelset),...
+Index: ../trunk-jpl/test/NightlyRun/test329.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test329.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test329.m	(revision 17555)
+@@ -22,7 +22,7 @@
+ 	(md.results.TransientSolution(1).Vy),...
+ 	(md.results.TransientSolution(1).Vz),...
+ 	(md.results.TransientSolution(1).Vel),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).Temperature),...
+@@ -32,7 +32,7 @@
+ 	(md.results.TransientSolution(2).Vy),...
+ 	(md.results.TransientSolution(2).Vz),...
+ 	(md.results.TransientSolution(2).Vel),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).Temperature),...
+@@ -42,7 +42,7 @@
+ 	(md.results.TransientSolution(3).Vy),...
+ 	(md.results.TransientSolution(3).Vz),...
+ 	(md.results.TransientSolution(3).Vel),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).Temperature),...
+Index: ../trunk-jpl/test/NightlyRun/test122.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test122.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test122.py	(revision 17555)
+@@ -34,7 +34,7 @@
+ 	md.results.TransientSolution[0].Vz,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].Temperature,\
+@@ -45,7 +45,7 @@
+ 	md.results.TransientSolution[1].Vz,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].Temperature,\
+@@ -56,7 +56,7 @@
+ 	md.results.TransientSolution[2].Vz,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	md.results.TransientSolution[2].Temperature,\
+Index: ../trunk-jpl/test/NightlyRun/test324.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test324.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test324.py	(revision 17555)
+@@ -31,7 +31,7 @@
+ 	md.results.TransientSolution[0].Vz,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].Temperature,\
+@@ -41,7 +41,7 @@
+ 	md.results.TransientSolution[1].Vz,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].Temperature,\
+@@ -51,7 +51,7 @@
+ #	md.results.TransientSolution[2].Vz,\
+ #	md.results.TransientSolution[2].Vel,\
+ #	md.results.TransientSolution[2].Pressure,\
+-#	md.results.TransientSolution[2].Bed,\
++#	md.results.TransientSolution[2].Base,\
+ #	md.results.TransientSolution[2].Surface,\
+ #	md.results.TransientSolution[2].Thickness,\
+ #	md.results.TransientSolution[2].Temperature,\
+Index: ../trunk-jpl/test/NightlyRun/test1501.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1501.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test1501.py	(revision 17555)
+@@ -63,7 +63,7 @@
+ 	md.results.TransientSolution[400-1].Vy,\
+ 	md.results.TransientSolution[400-1].Vel,\
+ 	md.results.TransientSolution[400-1].Pressure,\
+-	md.results.TransientSolution[400-1].Bed,\
++	md.results.TransientSolution[400-1].Base,\
+ 	md.results.TransientSolution[400-1].Surface,\
+ 	md.results.TransientSolution[400-1].Thickness,\
+ 	md.results.TransientSolution[400-1].SurfaceforcingsMassBalance,\
+@@ -71,7 +71,7 @@
+ 	md.results.TransientSolution[800-1].Vy,\
+ 	md.results.TransientSolution[800-1].Vel,\
+ 	md.results.TransientSolution[800-1].Pressure,\
+-	md.results.TransientSolution[800-1].Bed,\
++	md.results.TransientSolution[800-1].Base,\
+ 	md.results.TransientSolution[800-1].Surface,\
+ 	md.results.TransientSolution[800-1].Thickness,\
+ 	md.results.TransientSolution[800-1].SurfaceforcingsMassBalance,\
+@@ -79,7 +79,7 @@
+ 	md.results.TransientSolution[1200-1].Vy,\
+ 	md.results.TransientSolution[1200-1].Vel,\
+ 	md.results.TransientSolution[1200-1].Pressure,\
+-	md.results.TransientSolution[1200-1].Bed,\
++	md.results.TransientSolution[1200-1].Base,\
+ 	md.results.TransientSolution[1200-1].Surface,\
+ 	md.results.TransientSolution[1200-1].Thickness,\
+ 	md.results.TransientSolution[1200-1].SurfaceforcingsMassBalance,\
+@@ -87,7 +87,7 @@
+ 	md.results.TransientSolution[1600-1].Vy,\
+ 	md.results.TransientSolution[1600-1].Vel,\
+ 	md.results.TransientSolution[1600-1].Pressure,\
+-	md.results.TransientSolution[1600-1].Bed,\
++	md.results.TransientSolution[1600-1].Base,\
+ 	md.results.TransientSolution[1600-1].Surface,\
+ 	md.results.TransientSolution[1600-1].Thickness,\
+ 	md.results.TransientSolution[1600-1].SurfaceforcingsMassBalance,\
+@@ -95,7 +95,7 @@
+ 	md.results.TransientSolution[2000-1].Vy,\
+ 	md.results.TransientSolution[2000-1].Vel,\
+ 	md.results.TransientSolution[2000-1].Pressure,\
+-	md.results.TransientSolution[2000-1].Bed,\
++	md.results.TransientSolution[2000-1].Base,\
+ 	md.results.TransientSolution[2000-1].Surface,\
+ 	md.results.TransientSolution[2000-1].Thickness,\
+ 	md.results.TransientSolution[2000-1].SurfaceforcingsMassBalance,\
+Index: ../trunk-jpl/test/NightlyRun/test226.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test226.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test226.py	(revision 17555)
+@@ -24,21 +24,21 @@
+ 	md.results.TransientSolution[0].Vy,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[1].Vx,\
+ 	md.results.TransientSolution[1].Vy,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[2].Vx,\
+ 	md.results.TransientSolution[2].Vy,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	]
+Index: ../trunk-jpl/test/NightlyRun/test224.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test224.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test224.m	(revision 17555)
+@@ -21,7 +21,7 @@
+ 	(md.results.TransientSolution(1).Vz),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).Temperature),...
+@@ -31,7 +31,7 @@
+ 	(md.results.TransientSolution(2).Vz),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).Temperature),...
+@@ -41,7 +41,7 @@
+ 	(md.results.TransientSolution(3).Vz),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).Temperature),...
+Index: ../trunk-jpl/test/NightlyRun/test110.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test110.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test110.m	(revision 17555)
+@@ -17,7 +17,7 @@
+ 	(md.results.TransientSolution(1).Vy),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).IceVolume),...
+@@ -25,7 +25,7 @@
+ 	(md.results.TransientSolution(2).Vy),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).IceVolume),...
+@@ -33,7 +33,7 @@
+ 	(md.results.TransientSolution(3).Vy),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).IceVolume),...
+Index: ../trunk-jpl/test/NightlyRun/test504.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test504.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test504.py	(revision 17555)
+@@ -22,14 +22,14 @@
+ 	md.results.TransientSolution[0].Vy,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[1].Vx,\
+ 	md.results.TransientSolution[1].Vy,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	]
+Index: ../trunk-jpl/test/NightlyRun/test316.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test316.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test316.py	(revision 17555)
+@@ -22,21 +22,21 @@
+ 	md.results.TransientSolution[0].Vy,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[1].Vx,\
+ 	md.results.TransientSolution[1].Vy,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[2].Vx,\
+ 	md.results.TransientSolution[2].Vy,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	]
+Index: ../trunk-jpl/test/NightlyRun/test209.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test209.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test209.py	(revision 17555)
+@@ -34,7 +34,7 @@
+ 	md.results.TransientSolution[0].Vz,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].Temperature,\
+@@ -44,7 +44,7 @@
+ 	md.results.TransientSolution[1].Vz,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].Temperature,\
+@@ -54,7 +54,7 @@
+ 	md.results.TransientSolution[2].Vz,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	md.results.TransientSolution[2].Temperature,\
+Index: ../trunk-jpl/test/NightlyRun/test314.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test314.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test314.m	(revision 17555)
+@@ -13,21 +13,21 @@
+ 	(md.results.TransientSolution(1).Vy),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(2).Vx),...
+ 	(md.results.TransientSolution(2).Vy),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(3).Vx),...
+ 	(md.results.TransientSolution(3).Vy),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	};
+Index: ../trunk-jpl/test/NightlyRun/test233.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test233.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test233.m	(revision 17555)
+@@ -24,7 +24,7 @@
+ 	(md.results.TransientSolution(1).Vz),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).Temperature),...
+@@ -34,7 +34,7 @@
+ 	(md.results.TransientSolution(2).Vz),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).Temperature),...
+@@ -44,7 +44,7 @@
+ 	(md.results.TransientSolution(3).Vz),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).Temperature),...
+@@ -54,7 +54,7 @@
+ 	(md.results.TransientSolution(4).Vz),...
+ 	(md.results.TransientSolution(4).Vel),...
+ 	(md.results.TransientSolution(4).Pressure),...
+-	(md.results.TransientSolution(4).Bed),...
++	(md.results.TransientSolution(4).Base),...
+ 	(md.results.TransientSolution(4).Surface),...
+ 	(md.results.TransientSolution(4).Thickness),...
+ 	(md.results.TransientSolution(4).Temperature),...
+Index: ../trunk-jpl/test/NightlyRun/test3110.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test3110.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test3110.m	(revision 17555)
+@@ -20,7 +20,7 @@
+ 	(md.results.TransientSolution(1).Vy),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).IceVolume),...
+@@ -28,7 +28,7 @@
+ 	(md.results.TransientSolution(2).Vy),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).IceVolume),...
+@@ -36,7 +36,7 @@
+ 	(md.results.TransientSolution(3).Vy),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).IceVolume),...
+Index: ../trunk-jpl/test/NightlyRun/test230.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test230.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test230.py	(revision 17555)
+@@ -43,7 +43,7 @@
+ 	md.results.TransientSolution[0].Vz,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].SurfaceforcingsMassBalance,\
+@@ -52,7 +52,7 @@
+ 	md.results.TransientSolution[1].Vz,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].SurfaceforcingsMassBalance,\
+@@ -61,7 +61,7 @@
+ 	md.results.TransientSolution[2].Vz,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	md.results.TransientSolution[2].SurfaceforcingsMassBalance,\
+@@ -70,7 +70,7 @@
+ 	md.results.TransientSolution[3].Vz,\
+ 	md.results.TransientSolution[3].Vel,\
+ 	md.results.TransientSolution[3].Pressure,\
+-	md.results.TransientSolution[3].Bed,\
++	md.results.TransientSolution[3].Base,\
+ 	md.results.TransientSolution[3].Surface,\
+ 	md.results.TransientSolution[3].Thickness,\
+ 	md.results.TransientSolution[3].SurfaceforcingsMassBalance,\
+Index: ../trunk-jpl/test/NightlyRun/test323.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test323.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test323.m	(revision 17555)
+@@ -15,21 +15,21 @@
+ 	(md.results.TransientSolution(1).Vy),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(2).Vx),...
+ 	(md.results.TransientSolution(2).Vy),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(3).Vx),...
+ 	(md.results.TransientSolution(3).Vy),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	};
+Index: ../trunk-jpl/test/NightlyRun/test225.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test225.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test225.m	(revision 17555)
+@@ -22,7 +22,7 @@
+ 	(md.results.TransientSolution(1).Vz),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).Temperature),...
+@@ -32,7 +32,7 @@
+ 	(md.results.TransientSolution(2).Vz),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).Temperature),...
+@@ -42,7 +42,7 @@
+ 	(md.results.TransientSolution(3).Vz),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).Temperature),...
+Index: ../trunk-jpl/test/NightlyRun/test208.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test208.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test208.m	(revision 17555)
+@@ -13,21 +13,21 @@
+ 	(md.results.TransientSolution(1).Vy),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(2).Vx),...
+ 	(md.results.TransientSolution(2).Vy),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(3).Vx),...
+ 	(md.results.TransientSolution(3).Vy),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	};
+Index: ../trunk-jpl/test/NightlyRun/test1502.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1502.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test1502.py	(revision 17555)
+@@ -65,7 +65,7 @@
+ 	md.results.TransientSolution[400-1].Vz,\
+ 	md.results.TransientSolution[400-1].Vel,\
+ 	md.results.TransientSolution[400-1].Pressure,\
+-	md.results.TransientSolution[400-1].Bed,\
++	md.results.TransientSolution[400-1].Base,\
+ 	md.results.TransientSolution[400-1].Surface,\
+ 	md.results.TransientSolution[400-1].Thickness,\
+ 	md.results.TransientSolution[400-1].SurfaceforcingsMassBalance,\
+@@ -74,7 +74,7 @@
+ 	md.results.TransientSolution[800-1].Vz,\
+ 	md.results.TransientSolution[800-1].Vel,\
+ 	md.results.TransientSolution[800-1].Pressure,\
+-	md.results.TransientSolution[800-1].Bed,\
++	md.results.TransientSolution[800-1].Base,\
+ 	md.results.TransientSolution[800-1].Surface,\
+ 	md.results.TransientSolution[800-1].Thickness,\
+ 	md.results.TransientSolution[800-1].SurfaceforcingsMassBalance,\
+@@ -83,7 +83,7 @@
+ 	md.results.TransientSolution[1200-1].Vz,\
+ 	md.results.TransientSolution[1200-1].Vel,\
+ 	md.results.TransientSolution[1200-1].Pressure,\
+-	md.results.TransientSolution[1200-1].Bed,\
++	md.results.TransientSolution[1200-1].Base,\
+ 	md.results.TransientSolution[1200-1].Surface,\
+ 	md.results.TransientSolution[1200-1].Thickness,\
+ 	md.results.TransientSolution[1200-1].SurfaceforcingsMassBalance,\
+@@ -92,7 +92,7 @@
+ 	md.results.TransientSolution[1600-1].Vz,\
+ 	md.results.TransientSolution[1600-1].Vel,\
+ 	md.results.TransientSolution[1600-1].Pressure,\
+-	md.results.TransientSolution[1600-1].Bed,\
++	md.results.TransientSolution[1600-1].Base,\
+ 	md.results.TransientSolution[1600-1].Surface,\
+ 	md.results.TransientSolution[1600-1].Thickness,\
+ 	md.results.TransientSolution[1600-1].SurfaceforcingsMassBalance,\
+@@ -101,7 +101,7 @@
+ 	md.results.TransientSolution[2000-1].Vz,\
+ 	md.results.TransientSolution[2000-1].Vel,\
+ 	md.results.TransientSolution[2000-1].Pressure,\
+-	md.results.TransientSolution[2000-1].Bed,\
++	md.results.TransientSolution[2000-1].Base,\
+ 	md.results.TransientSolution[2000-1].Surface,\
+ 	md.results.TransientSolution[2000-1].Thickness,\
+ 	md.results.TransientSolution[2000-1].SurfaceforcingsMassBalance,\
+Index: ../trunk-jpl/test/NightlyRun/test111.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test111.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test111.m	(revision 17555)
+@@ -22,7 +22,7 @@
+ 	(md.results.TransientSolution(1).Vz),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).Temperature),...
+@@ -33,7 +33,7 @@
+ 	(md.results.TransientSolution(2).Vz),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).Temperature),...
+@@ -44,7 +44,7 @@
+ 	(md.results.TransientSolution(3).Vz),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).Temperature),...
+Index: ../trunk-jpl/test/NightlyRun/test227.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test227.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test227.py	(revision 17555)
+@@ -31,7 +31,7 @@
+ 	md.results.TransientSolution[0].Vz,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].Temperature,\
+@@ -41,7 +41,7 @@
+ 	md.results.TransientSolution[1].Vz,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].Temperature,\
+@@ -51,7 +51,7 @@
+ 	md.results.TransientSolution[2].Vz,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	md.results.TransientSolution[2].Temperature,\
+Index: ../trunk-jpl/test/NightlyRun/test315.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test315.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test315.m	(revision 17555)
+@@ -19,7 +19,7 @@
+ 	(md.results.TransientSolution(1).Vz),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).Temperature),...
+@@ -29,7 +29,7 @@
+ 	(md.results.TransientSolution(2).Vz),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).Temperature),...
+@@ -39,7 +39,7 @@
+ 	(md.results.TransientSolution(3).Vz),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).Temperature),...
+Index: ../trunk-jpl/test/NightlyRun/test3010.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test3010.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test3010.py	(revision 17555)
+@@ -28,7 +28,7 @@
+ 	md.results.TransientSolution[0].Vy,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].IceVolume,\
+@@ -36,7 +36,7 @@
+ 	md.results.TransientSolution[1].Vy,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].IceVolume,\
+@@ -44,7 +44,7 @@
+ 	md.results.TransientSolution[2].Vy,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	md.results.TransientSolution[2].IceVolume,\
+Index: ../trunk-jpl/test/NightlyRun/test222.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test222.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test222.py	(revision 17555)
+@@ -23,21 +23,21 @@
+ 	md.results.TransientSolution[0].Vy,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[1].Vx,\
+ 	md.results.TransientSolution[1].Vy,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[2].Vx,\
+ 	md.results.TransientSolution[2].Vy,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	]
+Index: ../trunk-jpl/test/NightlyRun/test505.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test505.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test505.py	(revision 17555)
+@@ -26,7 +26,7 @@
+ 	md.results.TransientSolution[0].Vz,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].Temperature,\
+@@ -36,7 +36,7 @@
+ 	md.results.TransientSolution[1].Vz,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].Temperature,\
+Index: ../trunk-jpl/test/NightlyRun/test424.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test424.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test424.py	(revision 17555)
+@@ -35,19 +35,19 @@
+ 	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
+ 	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
+ field_values=[\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].MaskGroundediceLevelset,\
+ 	md.results.TransientSolution[0].IceVolume,\
+ 	md.results.TransientSolution[0].IceVolumeAboveFloatation,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].MaskGroundediceLevelset,\
+ 	md.results.TransientSolution[1].IceVolume,\
+ 	md.results.TransientSolution[1].IceVolumeAboveFloatation,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	md.results.TransientSolution[2].MaskGroundediceLevelset,\
+Index: ../trunk-jpl/test/NightlyRun/test317.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test317.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test317.py	(revision 17555)
+@@ -28,7 +28,7 @@
+ 	md.results.TransientSolution[0].Vz,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].Temperature,\
+@@ -38,7 +38,7 @@
+ 	md.results.TransientSolution[1].Vz,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].Temperature,\
+@@ -48,7 +48,7 @@
+ 	md.results.TransientSolution[2].Vz,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	md.results.TransientSolution[2].Temperature,\
+Index: ../trunk-jpl/test/NightlyRun/test236.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test236.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test236.py	(revision 17555)
+@@ -70,7 +70,7 @@
+ 	md.results.TransientSolution[0].Vy,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].SurfaceforcingsMonthlytemperatures,\
+@@ -79,7 +79,7 @@
+ 	md.results.TransientSolution[1].Vy,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].SurfaceforcingsMonthlytemperatures,\
+@@ -88,7 +88,7 @@
+ 	md.results.TransientSolution[2].Vy,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	md.results.TransientSolution[2].SurfaceforcingsMonthlytemperatures,\
+Index: ../trunk-jpl/test/NightlyRun/test324.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test324.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test324.m	(revision 17555)
+@@ -21,7 +21,7 @@
+ 	(md.results.TransientSolution(1).Vz),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).Temperature),...
+@@ -31,7 +31,7 @@
+ 	(md.results.TransientSolution(2).Vz),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).Temperature),...
+@@ -41,7 +41,7 @@
+ %	(md.results.TransientSolution(3).Vz),...
+ %	(md.results.TransientSolution(3).Vel),...
+ %	(md.results.TransientSolution(3).Pressure),...
+-%	(md.results.TransientSolution(3).Bed),...
++%	(md.results.TransientSolution(3).Base),...
+ %	(md.results.TransientSolution(3).Surface),...
+ %	(md.results.TransientSolution(3).Thickness),...
+ %	(md.results.TransientSolution(3).Temperature),...
+Index: ../trunk-jpl/test/NightlyRun/test226.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test226.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test226.m	(revision 17555)
+@@ -15,21 +15,21 @@
+ 	(md.results.TransientSolution(1).Vy),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(2).Vx),...
+ 	(md.results.TransientSolution(2).Vy),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(3).Vx),...
+ 	(md.results.TransientSolution(3).Vy),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	};
+Index: ../trunk-jpl/test/NightlyRun/test209.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test209.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test209.m	(revision 17555)
+@@ -20,7 +20,7 @@
+ 	(md.results.TransientSolution(1).Vz),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).Temperature),...
+@@ -30,7 +30,7 @@
+ 	(md.results.TransientSolution(2).Vz),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).Temperature),...
+@@ -40,7 +40,7 @@
+ 	(md.results.TransientSolution(3).Vz),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).Temperature),...
+Index: ../trunk-jpl/test/NightlyRun/test110.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test110.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test110.py	(revision 17555)
+@@ -26,7 +26,7 @@
+ 	md.results.TransientSolution[0].Vy,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].IceVolume,\
+@@ -34,7 +34,7 @@
+ 	md.results.TransientSolution[1].Vy,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].IceVolume,\
+@@ -42,7 +42,7 @@
+ 	md.results.TransientSolution[2].Vy,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	md.results.TransientSolution[2].IceVolume,\
+Index: ../trunk-jpl/test/NightlyRun/test231.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test231.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test231.py	(revision 17555)
+@@ -43,7 +43,7 @@
+ 	md.results.TransientSolution[0].Vz,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].SurfaceforcingsMassBalance,\
+@@ -52,7 +52,7 @@
+ 	md.results.TransientSolution[1].Vz,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].SurfaceforcingsMassBalance,\
+@@ -61,7 +61,7 @@
+ 	md.results.TransientSolution[2].Vz,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	md.results.TransientSolution[2].SurfaceforcingsMassBalance,\
+@@ -70,7 +70,7 @@
+ 	md.results.TransientSolution[3].Vz,\
+ 	md.results.TransientSolution[3].Vel,\
+ 	md.results.TransientSolution[3].Pressure,\
+-	md.results.TransientSolution[3].Bed,\
++	md.results.TransientSolution[3].Base,\
+ 	md.results.TransientSolution[3].Surface,\
+ 	md.results.TransientSolution[3].Thickness,\
+ 	md.results.TransientSolution[3].SurfaceforcingsMassBalance,\
+Index: ../trunk-jpl/test/NightlyRun/test210.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test210.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test210.m	(revision 17555)
+@@ -20,7 +20,7 @@
+ 	(md.results.TransientSolution(1).Vz),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).Temperature),...
+@@ -30,7 +30,7 @@
+ 	(md.results.TransientSolution(2).Vz),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).Temperature),...
+@@ -40,7 +40,7 @@
+ 	(md.results.TransientSolution(3).Vz),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).Temperature),...
+Index: ../trunk-jpl/test/NightlyRun/test316.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test316.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test316.m	(revision 17555)
+@@ -13,21 +13,21 @@
+ 	(md.results.TransientSolution(1).Vy),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(2).Vx),...
+ 	(md.results.TransientSolution(2).Vy),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(3).Vx),...
+ 	(md.results.TransientSolution(3).Vy),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	};
+Index: ../trunk-jpl/test/NightlyRun/test1208.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1208.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test1208.py	(revision 17555)
+@@ -42,7 +42,7 @@
+ md=solve(md,TransientSolutionEnum())
+ 
+ #Fields and tolerances to track changes
+-field_names     =['Vx','Vy','Vz','Vel','Pressure','Thickness','Bed','Surface','Temperature','BasalforcingsMeltingRate']
++field_names     =['Vx','Vy','Vz','Vel','Pressure','Thickness','Base','Surface','Temperature','BasalforcingsMeltingRate']
+ field_tolerances=[1e-08,1e-08,1e-07,1e-08,1e-08,1e-08,1e-08,1e-08,1e-07,1e-07]
+ field_values=[\
+ 	md.results.TransientSolution[-1].Vx,\
+@@ -51,7 +51,7 @@
+ 	md.results.TransientSolution[-1].Vel,\
+ 	md.results.TransientSolution[-1].Pressure,\
+ 	md.results.TransientSolution[-1].Thickness,\
+-	md.results.TransientSolution[-1].Bed,\
++	md.results.TransientSolution[-1].Base,\
+ 	md.results.TransientSolution[-1].Surface,\
+ 	md.results.TransientSolution[-1].Temperature,\
+ 	md.results.TransientSolution[-1].BasalforcingsMeltingRate,\
+Index: ../trunk-jpl/test/NightlyRun/test228.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test228.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test228.py	(revision 17555)
+@@ -41,7 +41,7 @@
+ 	md.results.TransientSolution[0].Vy,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].SurfaceforcingsMassBalance,\
+@@ -49,7 +49,7 @@
+ 	md.results.TransientSolution[1].Vy,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].SurfaceforcingsMassBalance,\
+@@ -57,7 +57,7 @@
+ 	md.results.TransientSolution[2].Vy,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	md.results.TransientSolution[2].SurfaceforcingsMassBalance,\
+@@ -65,7 +65,7 @@
+ 	md.results.TransientSolution[3].Vy,\
+ 	md.results.TransientSolution[3].Vel,\
+ 	md.results.TransientSolution[3].Pressure,\
+-	md.results.TransientSolution[3].Bed,\
++	md.results.TransientSolution[3].Base,\
+ 	md.results.TransientSolution[3].Surface,\
+ 	md.results.TransientSolution[3].Thickness,\
+ 	md.results.TransientSolution[3].SurfaceforcingsMassBalance,\
+Index: ../trunk-jpl/test/NightlyRun/test504.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test504.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test504.m	(revision 17555)
+@@ -13,14 +13,14 @@
+ 	(md.results.TransientSolution(1).Vy),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(2).Vx),...
+ 	(md.results.TransientSolution(2).Vy),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	};
+Index: ../trunk-jpl/test/NightlyRun/test227.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test227.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test227.m	(revision 17555)
+@@ -22,7 +22,7 @@
+ 	(md.results.TransientSolution(1).Vz),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).Temperature),...
+@@ -32,7 +32,7 @@
+ 	(md.results.TransientSolution(2).Vz),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).Temperature),...
+@@ -42,7 +42,7 @@
+ 	(md.results.TransientSolution(3).Vz),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).Temperature),...
+Index: ../trunk-jpl/test/NightlyRun/test1501.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1501.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test1501.m	(revision 17555)
+@@ -50,7 +50,7 @@
+ 	(md.results.TransientSolution(400).Vy),...
+ 	(md.results.TransientSolution(400).Vel),...
+ 	(md.results.TransientSolution(400).Pressure),...
+-	(md.results.TransientSolution(400).Bed),...
++	(md.results.TransientSolution(400).Base),...
+ 	(md.results.TransientSolution(400).Surface),...
+ 	(md.results.TransientSolution(400).Thickness),...
+ 	(md.results.TransientSolution(400).SurfaceforcingsMassBalance),...
+@@ -58,7 +58,7 @@
+ 	(md.results.TransientSolution(800).Vy),...
+ 	(md.results.TransientSolution(800).Vel),...
+ 	(md.results.TransientSolution(800).Pressure),...
+-	(md.results.TransientSolution(800).Bed),...
++	(md.results.TransientSolution(800).Base),...
+ 	(md.results.TransientSolution(800).Surface),...
+ 	(md.results.TransientSolution(800).Thickness),...
+ 	(md.results.TransientSolution(800).SurfaceforcingsMassBalance),...
+@@ -66,7 +66,7 @@
+ 	(md.results.TransientSolution(1200).Vy),...
+ 	(md.results.TransientSolution(1200).Vel),...
+ 	(md.results.TransientSolution(1200).Pressure),...
+-	(md.results.TransientSolution(1200).Bed),...
++	(md.results.TransientSolution(1200).Base),...
+ 	(md.results.TransientSolution(1200).Surface),...
+ 	(md.results.TransientSolution(1200).Thickness),...
+ 	(md.results.TransientSolution(1200).SurfaceforcingsMassBalance),...
+@@ -74,7 +74,7 @@
+ 	(md.results.TransientSolution(1600).Vy),...
+ 	(md.results.TransientSolution(1600).Vel),...
+ 	(md.results.TransientSolution(1600).Pressure),...
+-	(md.results.TransientSolution(1600).Bed),...
++	(md.results.TransientSolution(1600).Base),...
+ 	(md.results.TransientSolution(1600).Surface),...
+ 	(md.results.TransientSolution(1600).Thickness),...
+ 	(md.results.TransientSolution(1600).SurfaceforcingsMassBalance),...
+@@ -82,7 +82,7 @@
+ 	(md.results.TransientSolution(2000).Vy),...
+ 	(md.results.TransientSolution(2000).Vel),...
+ 	(md.results.TransientSolution(2000).Pressure),...
+-	(md.results.TransientSolution(2000).Bed),...
++	(md.results.TransientSolution(2000).Base),...
+ 	(md.results.TransientSolution(2000).Surface),...
+ 	(md.results.TransientSolution(2000).Thickness),...
+ 	(md.results.TransientSolution(2000).SurfaceforcingsMassBalance),...
+Index: ../trunk-jpl/test/NightlyRun/test223.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test223.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test223.py	(revision 17555)
+@@ -25,21 +25,21 @@
+ 	md.results.TransientSolution[0].Vy,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[1].Vx,\
+ 	md.results.TransientSolution[1].Vy,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[2].Vx,\
+ 	md.results.TransientSolution[2].Vy,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	]
+Index: ../trunk-jpl/test/NightlyRun/test211.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test211.m	(revision 17555)
+@@ -22,7 +22,7 @@
+ 	(md.results.TransientSolution(1).Vz),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).Temperature),...
+@@ -32,7 +32,7 @@
+ 	(md.results.TransientSolution(2).Vz),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).Temperature),...
+@@ -42,7 +42,7 @@
+ 	(md.results.TransientSolution(3).Vz),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).Temperature),...
+Index: ../trunk-jpl/test/NightlyRun/test425.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test425.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test425.py	(revision 17555)
+@@ -34,15 +34,15 @@
+ 	1e-13,1e-13,1e-13,1e-13,\
+ 	1e-13,1e-13,1e-13,1e-13]
+ field_values=[\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].MaskGroundediceLevelset,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].MaskGroundediceLevelset,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	md.results.TransientSolution[2].MaskGroundediceLevelset,\
+Index: ../trunk-jpl/test/NightlyRun/test506.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test506.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test506.py	(revision 17555)
+@@ -26,7 +26,7 @@
+ 	md.results.TransientSolution[0].Vz,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].Temperature,\
+@@ -36,7 +36,7 @@
+ 	md.results.TransientSolution[1].Vz,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].Temperature,\
+Index: ../trunk-jpl/test/NightlyRun/test237.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test237.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test237.py	(revision 17555)
+@@ -78,7 +78,7 @@
+ 	md.results.TransientSolution[0].Vz,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].Temperature,\
+@@ -90,7 +90,7 @@
+ 	md.results.TransientSolution[1].Vz,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].Temperature,\
+@@ -102,7 +102,7 @@
+ 	md.results.TransientSolution[2].Vz,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	md.results.TransientSolution[2].Temperature,\
+Index: ../trunk-jpl/test/NightlyRun/test236.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test236.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test236.m	(revision 17555)
+@@ -59,7 +59,7 @@
+ 	(md.results.TransientSolution(1).Vy),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).SurfaceforcingsMonthlytemperatures),...
+@@ -68,7 +68,7 @@
+ 	(md.results.TransientSolution(2).Vy),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).SurfaceforcingsMonthlytemperatures),...
+@@ -77,7 +77,7 @@
+ 	(md.results.TransientSolution(3).Vy),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).SurfaceforcingsMonthlytemperatures),...
+Index: ../trunk-jpl/test/NightlyRun/test317.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test317.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test317.m	(revision 17555)
+@@ -19,7 +19,7 @@
+ 	(md.results.TransientSolution(1).Vz),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).Temperature),...
+@@ -29,7 +29,7 @@
+ 	(md.results.TransientSolution(2).Vz),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).Temperature),...
+@@ -39,7 +39,7 @@
+ 	(md.results.TransientSolution(3).Vz),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).Temperature),...
+Index: ../trunk-jpl/test/NightlyRun/test111.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test111.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test111.py	(revision 17555)
+@@ -31,7 +31,7 @@
+ 	md.results.TransientSolution[0].Vz,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].Temperature,\
+@@ -42,7 +42,7 @@
+ 	md.results.TransientSolution[1].Vz,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].Temperature,\
+@@ -53,7 +53,7 @@
+ 	md.results.TransientSolution[2].Vz,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	md.results.TransientSolution[2].Temperature,\
+Index: ../trunk-jpl/test/NightlyRun/test122.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test122.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test122.m	(revision 17555)
+@@ -25,7 +25,7 @@
+ 	(md.results.TransientSolution(1).Vz),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).Temperature),...
+@@ -36,7 +36,7 @@
+ 	(md.results.TransientSolution(2).Vz),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).Temperature),...
+@@ -47,7 +47,7 @@
+ 	(md.results.TransientSolution(3).Vz),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).Temperature),...
+Index: ../trunk-jpl/test/NightlyRun/test327.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test327.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test327.py	(revision 17555)
+@@ -36,7 +36,7 @@
+ 	md.results.TransientSolution[0].Vz,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].Temperature,\
+@@ -47,7 +47,7 @@
+ 	md.results.TransientSolution[1].Vz,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].Temperature,\
+@@ -58,7 +58,7 @@
+ 	md.results.TransientSolution[2].Vz,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	md.results.TransientSolution[2].Temperature,\
+Index: ../trunk-jpl/test/NightlyRun/test408.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test408.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test408.py	(revision 17555)
+@@ -23,21 +23,21 @@
+ 	md.results.TransientSolution[0].Vy,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[1].Vx,\
+ 	md.results.TransientSolution[1].Vy,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[2].Vx,\
+ 	md.results.TransientSolution[2].Vy,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	]
+Index: ../trunk-jpl/test/NightlyRun/test424.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test424.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test424.m	(revision 17555)
+@@ -25,19 +25,19 @@
+ 	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+ 	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
+ field_values={...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).MaskGroundediceLevelset),...
+ 	(md.results.TransientSolution(1).IceVolume),...
+ 	(md.results.TransientSolution(1).IceVolumeAboveFloatation),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).MaskGroundediceLevelset),...
+ 	(md.results.TransientSolution(2).IceVolume),...
+ 	(md.results.TransientSolution(2).IceVolumeAboveFloatation),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).MaskGroundediceLevelset),...
+Index: ../trunk-jpl/test/NightlyRun/test505.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test505.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test505.m	(revision 17555)
+@@ -17,7 +17,7 @@
+ 	(md.results.TransientSolution(1).Vz),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).Temperature),...
+@@ -27,7 +27,7 @@
+ 	(md.results.TransientSolution(2).Vz),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).Temperature),...
+Index: ../trunk-jpl/test/NightlyRun/test228.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test228.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test228.m	(revision 17555)
+@@ -32,7 +32,7 @@
+ 	(md.results.TransientSolution(1).Vy),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).SurfaceforcingsMassBalance),...
+@@ -40,7 +40,7 @@
+ 	(md.results.TransientSolution(2).Vy),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).SurfaceforcingsMassBalance),...
+@@ -48,7 +48,7 @@
+ 	(md.results.TransientSolution(3).Vy),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).SurfaceforcingsMassBalance),...
+@@ -56,7 +56,7 @@
+ 	(md.results.TransientSolution(4).Vy),...
+ 	(md.results.TransientSolution(4).Vel),...
+ 	(md.results.TransientSolution(4).Pressure),...
+-	(md.results.TransientSolution(4).Bed),...
++	(md.results.TransientSolution(4).Base),...
+ 	(md.results.TransientSolution(4).Surface),...
+ 	(md.results.TransientSolution(4).Thickness),...
+ 	(md.results.TransientSolution(4).SurfaceforcingsMassBalance),...
+Index: ../trunk-jpl/test/NightlyRun/test3110.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test3110.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test3110.py	(revision 17555)
+@@ -28,7 +28,7 @@
+ 	md.results.TransientSolution[0].Vy,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].IceVolume,\
+@@ -36,7 +36,7 @@
+ 	md.results.TransientSolution[1].Vy,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].IceVolume,\
+@@ -44,7 +44,7 @@
+ 	md.results.TransientSolution[2].Vy,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	md.results.TransientSolution[2].IceVolume,\
+Index: ../trunk-jpl/test/NightlyRun/test1502.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1502.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test1502.m	(revision 17555)
+@@ -52,7 +52,7 @@
+ 	(md.results.TransientSolution(400).Vz),...
+ 	(md.results.TransientSolution(400).Vel),...
+ 	(md.results.TransientSolution(400).Pressure),...
+-	(md.results.TransientSolution(400).Bed),...
++	(md.results.TransientSolution(400).Base),...
+ 	(md.results.TransientSolution(400).Surface),...
+ 	(md.results.TransientSolution(400).Thickness),...
+ 	(md.results.TransientSolution(400).SurfaceforcingsMassBalance),...
+@@ -61,7 +61,7 @@
+ 	(md.results.TransientSolution(800).Vz),...
+ 	(md.results.TransientSolution(800).Vel),...
+ 	(md.results.TransientSolution(800).Pressure),...
+-	(md.results.TransientSolution(800).Bed),...
++	(md.results.TransientSolution(800).Base),...
+ 	(md.results.TransientSolution(800).Surface),...
+ 	(md.results.TransientSolution(800).Thickness),...
+ 	(md.results.TransientSolution(800).SurfaceforcingsMassBalance),...
+@@ -70,7 +70,7 @@
+ 	(md.results.TransientSolution(1200).Vz),...
+ 	(md.results.TransientSolution(1200).Vel),...
+ 	(md.results.TransientSolution(1200).Pressure),...
+-	(md.results.TransientSolution(1200).Bed),...
++	(md.results.TransientSolution(1200).Base),...
+ 	(md.results.TransientSolution(1200).Surface),...
+ 	(md.results.TransientSolution(1200).Thickness),...
+ 	(md.results.TransientSolution(1200).SurfaceforcingsMassBalance),...
+@@ -79,7 +79,7 @@
+ 	(md.results.TransientSolution(1600).Vz),...
+ 	(md.results.TransientSolution(1600).Vel),...
+ 	(md.results.TransientSolution(1600).Pressure),...
+-	(md.results.TransientSolution(1600).Bed),...
++	(md.results.TransientSolution(1600).Base),...
+ 	(md.results.TransientSolution(1600).Surface),...
+ 	(md.results.TransientSolution(1600).Thickness),...
+ 	(md.results.TransientSolution(1600).SurfaceforcingsMassBalance),...
+@@ -88,7 +88,7 @@
+ 	(md.results.TransientSolution(2000).Vz),...
+ 	(md.results.TransientSolution(2000).Vel),...
+ 	(md.results.TransientSolution(2000).Pressure),...
+-	(md.results.TransientSolution(2000).Bed),...
++	(md.results.TransientSolution(2000).Base),...
+ 	(md.results.TransientSolution(2000).Surface),...
+ 	(md.results.TransientSolution(2000).Thickness),...
+ 	(md.results.TransientSolution(2000).SurfaceforcingsMassBalance),...
+Index: ../trunk-jpl/test/NightlyRun/test1208.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1208.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test1208.m	(revision 17555)
+@@ -29,7 +29,7 @@
+ md=solve(md,TransientSolutionEnum());
+ 
+ %Fields and tolerances to track changes
+-field_names     ={'Vx','Vy','Vz','Vel','Pressure','Thickness','Bed','Surface','Temperature','BasalforcingsMeltingRate'};
++field_names     ={'Vx','Vy','Vz','Vel','Pressure','Thickness','Base','Surface','Temperature','BasalforcingsMeltingRate'};
+ field_tolerances={1e-08,1e-08,1e-07,1e-08,1e-08,1e-08,1e-08,1e-08,1e-07,3e-07};
+ field_values={...
+ 	(md.results.TransientSolution(end).Vx),...
+@@ -38,7 +38,7 @@
+ 	(md.results.TransientSolution(end).Vel),...
+ 	(md.results.TransientSolution(end).Pressure),...
+ 	(md.results.TransientSolution(end).Thickness),...
+-	(md.results.TransientSolution(end).Bed),...
++	(md.results.TransientSolution(end).Base),...
+ 	(md.results.TransientSolution(end).Surface),...
+ 	(md.results.TransientSolution(end).Temperature),...
+ 	(md.results.TransientSolution(end).BasalforcingsMeltingRate),...
+Index: ../trunk-jpl/test/NightlyRun/test229.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test229.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test229.py	(revision 17555)
+@@ -41,7 +41,7 @@
+ 	md.results.TransientSolution[0].Vy,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].SurfaceforcingsMassBalance,\
+@@ -49,7 +49,7 @@
+ 	md.results.TransientSolution[1].Vy,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].SurfaceforcingsMassBalance,\
+@@ -57,7 +57,7 @@
+ 	md.results.TransientSolution[2].Vy,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	md.results.TransientSolution[2].SurfaceforcingsMassBalance,\
+@@ -65,7 +65,7 @@
+ 	md.results.TransientSolution[3].Vy,\
+ 	md.results.TransientSolution[3].Vel,\
+ 	md.results.TransientSolution[3].Pressure,\
+-	md.results.TransientSolution[3].Bed,\
++	md.results.TransientSolution[3].Base,\
+ 	md.results.TransientSolution[3].Surface,\
+ 	md.results.TransientSolution[3].Thickness,\
+ 	md.results.TransientSolution[3].SurfaceforcingsMassBalance,\
+Index: ../trunk-jpl/test/NightlyRun/test237.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test237.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test237.m	(revision 17555)
+@@ -66,7 +66,7 @@
+ 	(md.results.TransientSolution(1).Vz),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).Temperature),...
+@@ -78,7 +78,7 @@
+ 	(md.results.TransientSolution(2).Vz),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).Temperature),...
+@@ -90,7 +90,7 @@
+ 	(md.results.TransientSolution(3).Vz),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).Temperature),...
+Index: ../trunk-jpl/test/NightlyRun/test210.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test210.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test210.py	(revision 17555)
+@@ -33,7 +33,7 @@
+ 	md.results.TransientSolution[0].Vz,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].Temperature,\
+@@ -43,7 +43,7 @@
+ 	md.results.TransientSolution[1].Vz,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].Temperature,\
+@@ -53,7 +53,7 @@
+ 	md.results.TransientSolution[2].Vz,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	md.results.TransientSolution[2].Temperature,\
+Index: ../trunk-jpl/test/NightlyRun/test224.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test224.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test224.py	(revision 17555)
+@@ -30,7 +30,7 @@
+ 	md.results.TransientSolution[0].Vz,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].Temperature,\
+@@ -40,7 +40,7 @@
+ 	md.results.TransientSolution[1].Vz,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].Temperature,\
+@@ -50,7 +50,7 @@
+ 	md.results.TransientSolution[2].Vz,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	md.results.TransientSolution[2].Temperature,\
+Index: ../trunk-jpl/test/NightlyRun/test426.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test426.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test426.py	(revision 17555)
+@@ -38,19 +38,19 @@
+ 	1e-10,1e-10,1e-10,5e-11,2e-12,5e-12]
+ 
+ field_values=[\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].MaskGroundediceLevelset,\
+ 	md.results.TransientSolution[0].IceVolume,\
+ 	md.results.TransientSolution[0].IceVolumeAboveFloatation,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].MaskGroundediceLevelset,\
+ 	md.results.TransientSolution[1].IceVolume,\
+ 	md.results.TransientSolution[1].IceVolumeAboveFloatation,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	md.results.TransientSolution[2].MaskGroundediceLevelset,\
+Index: ../trunk-jpl/test/NightlyRun/test507.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test507.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test507.py	(revision 17555)
+@@ -25,7 +25,7 @@
+ 	md.results.TransientSolution[0].Vz,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].Temperature,\
+@@ -35,7 +35,7 @@
+ 	md.results.TransientSolution[1].Vz,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].Temperature,\
+Index: ../trunk-jpl/test/NightlyRun/test425.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test425.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test425.m	(revision 17555)
+@@ -24,15 +24,15 @@
+ 	1e-13,1e-13,1e-13,1e-13,...
+ 	1e-13,1e-13,1e-13,1e-13};
+ field_values={...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).MaskGroundediceLevelset),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).MaskGroundediceLevelset),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).MaskGroundediceLevelset),...
+Index: ../trunk-jpl/test/NightlyRun/test506.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test506.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test506.m	(revision 17555)
+@@ -17,7 +17,7 @@
+ 	(md.results.TransientSolution(1).Vz),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).Temperature),...
+@@ -27,7 +27,7 @@
+ 	(md.results.TransientSolution(2).Vz),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).Temperature),...
+Index: ../trunk-jpl/test/NightlyRun/test327.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test327.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test327.m	(revision 17555)
+@@ -28,7 +28,7 @@
+ 	(md.results.TransientSolution(1).Vz),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).Temperature),...
+@@ -39,7 +39,7 @@
+ 	(md.results.TransientSolution(2).Vz),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).Temperature),...
+@@ -50,7 +50,7 @@
+ 	(md.results.TransientSolution(3).Vz),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).Temperature),...
+Index: ../trunk-jpl/test/NightlyRun/test408.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test408.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test408.m	(revision 17555)
+@@ -13,21 +13,21 @@
+ 	(md.results.TransientSolution(1).Vy),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(2).Vx),...
+ 	(md.results.TransientSolution(2).Vy),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(3).Vx),...
+ 	(md.results.TransientSolution(3).Vy),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	};
+Index: ../trunk-jpl/test/NightlyRun/test229.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test229.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test229.m	(revision 17555)
+@@ -32,7 +32,7 @@
+ 	(md.results.TransientSolution(1).Vy),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).SurfaceforcingsMassBalance),...
+@@ -40,7 +40,7 @@
+ 	(md.results.TransientSolution(2).Vy),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).SurfaceforcingsMassBalance),...
+@@ -48,7 +48,7 @@
+ 	(md.results.TransientSolution(3).Vy),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).SurfaceforcingsMassBalance),...
+@@ -56,7 +56,7 @@
+ 	(md.results.TransientSolution(4).Vy),...
+ 	(md.results.TransientSolution(4).Vel),...
+ 	(md.results.TransientSolution(4).Pressure),...
+-	(md.results.TransientSolution(4).Bed),...
++	(md.results.TransientSolution(4).Base),...
+ 	(md.results.TransientSolution(4).Surface),...
+ 	(md.results.TransientSolution(4).Thickness),...
+ 	(md.results.TransientSolution(4).SurfaceforcingsMassBalance),...
+Index: ../trunk-jpl/test/NightlyRun/test233.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test233.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test233.py	(revision 17555)
+@@ -34,7 +34,7 @@
+ 	md.results.TransientSolution[0].Vz,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].Temperature,\
+@@ -44,7 +44,7 @@
+ 	md.results.TransientSolution[1].Vz,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].Temperature,\
+@@ -54,7 +54,7 @@
+ 	md.results.TransientSolution[2].Vz,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	md.results.TransientSolution[2].Temperature,\
+@@ -64,7 +64,7 @@
+ 	md.results.TransientSolution[3].Vz,\
+ 	md.results.TransientSolution[3].Vel,\
+ 	md.results.TransientSolution[3].Pressure,\
+-	md.results.TransientSolution[3].Bed,\
++	md.results.TransientSolution[3].Base,\
+ 	md.results.TransientSolution[3].Surface,\
+ 	md.results.TransientSolution[3].Thickness,\
+ 	md.results.TransientSolution[3].Temperature,\
+Index: ../trunk-jpl/test/NightlyRun/test314.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test314.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test314.py	(revision 17555)
+@@ -22,21 +22,21 @@
+ 	md.results.TransientSolution[0].Vy,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[1].Vx,\
+ 	md.results.TransientSolution[1].Vy,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[2].Vx,\
+ 	md.results.TransientSolution[2].Vy,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	]
+Index: ../trunk-jpl/test/NightlyRun/test230.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test230.m	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test230.m	(revision 17555)
+@@ -34,7 +34,7 @@
+ 	(md.results.TransientSolution(1).Vz),...
+ 	(md.results.TransientSolution(1).Vel),...
+ 	(md.results.TransientSolution(1).Pressure),...
+-	(md.results.TransientSolution(1).Bed),...
++	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+ 	(md.results.TransientSolution(1).Thickness),...
+ 	(md.results.TransientSolution(1).SurfaceforcingsMassBalance),...
+@@ -43,7 +43,7 @@
+ 	(md.results.TransientSolution(2).Vz),...
+ 	(md.results.TransientSolution(2).Vel),...
+ 	(md.results.TransientSolution(2).Pressure),...
+-	(md.results.TransientSolution(2).Bed),...
++	(md.results.TransientSolution(2).Base),...
+ 	(md.results.TransientSolution(2).Surface),...
+ 	(md.results.TransientSolution(2).Thickness),...
+ 	(md.results.TransientSolution(2).SurfaceforcingsMassBalance),...
+@@ -52,7 +52,7 @@
+ 	(md.results.TransientSolution(3).Vz),...
+ 	(md.results.TransientSolution(3).Vel),...
+ 	(md.results.TransientSolution(3).Pressure),...
+-	(md.results.TransientSolution(3).Bed),...
++	(md.results.TransientSolution(3).Base),...
+ 	(md.results.TransientSolution(3).Surface),...
+ 	(md.results.TransientSolution(3).Thickness),...
+ 	(md.results.TransientSolution(3).SurfaceforcingsMassBalance),...
+@@ -61,7 +61,7 @@
+ 	(md.results.TransientSolution(4).Vz),...
+ 	(md.results.TransientSolution(4).Vel),...
+ 	(md.results.TransientSolution(4).Pressure),...
+-	(md.results.TransientSolution(4).Bed),...
++	(md.results.TransientSolution(4).Base),...
+ 	(md.results.TransientSolution(4).Surface),...
+ 	(md.results.TransientSolution(4).Thickness),...
+ 	(md.results.TransientSolution(4).SurfaceforcingsMassBalance),...
+Index: ../trunk-jpl/test/NightlyRun/test328.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test328.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test328.py	(revision 17555)
+@@ -29,7 +29,7 @@
+ 	md.results.TransientSolution[0].Vx,\
+ 	md.results.TransientSolution[0].Vy,\
+ 	md.results.TransientSolution[0].Vel,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].SurfaceforcingsMassBalance,\
+@@ -37,7 +37,7 @@
+ 	md.results.TransientSolution[1].Vx,\
+ 	md.results.TransientSolution[1].Vy,\
+ 	md.results.TransientSolution[1].Vel,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].TotalSmb,\
+@@ -45,7 +45,7 @@
+ 	md.results.TransientSolution[2].Vx,\
+ 	md.results.TransientSolution[2].Vy,\
+ 	md.results.TransientSolution[2].Vel,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	md.results.TransientSolution[2].SurfaceforcingsMassBalance,\
+Index: ../trunk-jpl/test/NightlyRun/test409.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test409.py	(revision 17554)
++++ ../trunk-jpl/test/NightlyRun/test409.py	(revision 17555)
+@@ -30,7 +30,7 @@
+ 	md.results.TransientSolution[0].Vz,\
+ 	md.results.TransientSolution[0].Vel,\
+ 	md.results.TransientSolution[0].Pressure,\
+-	md.results.TransientSolution[0].Bed,\
++	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+ 	md.results.TransientSolution[0].Thickness,\
+ 	md.results.TransientSolution[0].Temperature,\
+@@ -40,7 +40,7 @@
+ 	md.results.TransientSolution[1].Vz,\
+ 	md.results.TransientSolution[1].Vel,\
+ 	md.results.TransientSolution[1].Pressure,\
+-	md.results.TransientSolution[1].Bed,\
++	md.results.TransientSolution[1].Base,\
+ 	md.results.TransientSolution[1].Surface,\
+ 	md.results.TransientSolution[1].Thickness,\
+ 	md.results.TransientSolution[1].Temperature,\
+@@ -50,7 +50,7 @@
+ 	md.results.TransientSolution[2].Vz,\
+ 	md.results.TransientSolution[2].Vel,\
+ 	md.results.TransientSolution[2].Pressure,\
+-	md.results.TransientSolution[2].Bed,\
++	md.results.TransientSolution[2].Base,\
+ 	md.results.TransientSolution[2].Surface,\
+ 	md.results.TransientSolution[2].Thickness,\
+ 	md.results.TransientSolution[2].Temperature,\
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 17554)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 17555)
+@@ -35,7 +35,7 @@
+ 
+ 	iomodel->FetchDataToInput(elements,ThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+-	iomodel->FetchDataToInput(elements,BedEnum);
++	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,VxEnum);
+ 	iomodel->FetchDataToInput(elements,VyEnum);
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17554)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17555)
+@@ -48,7 +48,7 @@
+ 		}
+ 	}
+ 	iomodel->FetchDataToInput(elements,ThicknessEnum);
+-	iomodel->FetchDataToInput(elements,BedEnum);
++	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
+ 	iomodel->FetchDataToInput(elements,EplHeadEnum);
+@@ -532,7 +532,7 @@
+ 		element->GetInputListOnVertices(&epl_slopeY[0],EplHeadSlopeYEnum);
+ 		element->GetInputListOnVertices(&old_thickness[0],HydrologydcEplThicknessOldEnum);
+ 		element->GetInputListOnVertices(&ice_thickness[0],ThicknessEnum);
+-		element->GetInputListOnVertices(&bed[0],BedEnum);
++		element->GetInputListOnVertices(&bed[0],BaseEnum);
+ 			
+ 		if(!active_element){
+ 			
+@@ -741,7 +741,7 @@
+ 		rho_water = element->GetMaterialParameter(MaterialsRhoFreshwaterEnum);
+ 		rho_ice   = element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 		element-> GetInputValue(&thickness,innode,ThicknessEnum);
+-		element-> GetInputValue(&bed,innode,BedEnum);
++		element-> GetInputValue(&bed,innode,BaseEnum);
+ 		h_max=((rho_ice*thickness)/rho_water)+bed;
+ 		break;
+ 	case 3:
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 17554)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 17555)
+@@ -31,7 +31,7 @@
+ 
+ 	iomodel->FetchDataToInput(elements,ThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+-	iomodel->FetchDataToInput(elements,BedEnum);
++	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
+ 	iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+@@ -290,7 +290,7 @@
+ 	element->GetVerticesCoordinates(&xyz_list);
+ 	element->GetVerticesCoordinatesBase(&xyz_list_base);
+ 	element->GetInputValue(&approximation,ApproximationEnum);
+-	Input* bed_input=element->GetInput(BedEnum);                                _assert_(bed_input);
++	Input* base_input=element->GetInput(BaseEnum);                                _assert_(base_input);
+ 	Input* basal_melting_input=element->GetInput(BasalforcingsMeltingRateEnum); _assert_(basal_melting_input);
+ 	Input* vx_input=element->GetInput(VxEnum);                                  _assert_(vx_input);
+ 	Input* vy_input=element->GetInput(VyEnum);                                  _assert_(vy_input);
+@@ -305,7 +305,7 @@
+ 		gauss->GaussPoint(ig);
+ 
+ 		basal_melting_input->GetInputValue(&basalmeltingvalue,gauss);
+-		bed_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
++		base_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
+ 		vx_input->GetInputValue(&vx,gauss);
+ 		vy_input->GetInputValue(&vy,gauss);
+ 		if(approximation==HOFSApproximationEnum || approximation==SSAFSApproximationEnum){
+Index: ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 17554)
++++ ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 17555)
+@@ -28,7 +28,7 @@
+ 	/*Create inputs: */
+ 	iomodel->FetchDataToInput(elements,ThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+-	iomodel->FetchDataToInput(elements,BedEnum);
++	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,FrictionCoefficientEnum);
+ 	iomodel->FetchDataToInput(elements,FrictionPEnum);
+ 	iomodel->FetchDataToInput(elements,FrictionQEnum);
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17554)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17555)
+@@ -62,7 +62,7 @@
+ 
+ 	iomodel->FetchDataToInput(elements,ThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+-	iomodel->FetchDataToInput(elements,BedEnum);
++	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,MaskGroundediceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
+@@ -75,7 +75,7 @@
+ 	}
+ 
+ 	if(dakota_analysis){
+-		elements->InputDuplicate(BedEnum,QmuBedEnum);
++		elements->InputDuplicate(BaseEnum,QmuBaseEnum);
+ 		elements->InputDuplicate(ThicknessEnum,QmuThicknessEnum);
+ 		elements->InputDuplicate(SurfaceEnum,QmuSurfaceEnum);
+ 		elements->InputDuplicate(MaskIceLevelsetEnum,QmuMaskIceLevelsetEnum);
+@@ -706,7 +706,7 @@
+ 	}
+ 
+ 	/*Get previous bed, thickness and surface*/
+-	basalelement->GetInputListOnNodes(&oldbed[0],BedEnum);
++	basalelement->GetInputListOnNodes(&oldbed[0],BaseEnum);
+ 	basalelement->GetInputListOnNodes(&oldsurface[0],SurfaceEnum);
+ 	basalelement->GetInputListOnNodes(&oldthickness[0],ThicknessEnum);
+ 	basalelement->GetInputListOnNodes(&phi[0],MaskGroundediceLevelsetEnum);
+@@ -738,7 +738,7 @@
+ 	/*Add input to the element: */
+ 	element->AddBasalInput(ThicknessEnum,newthickness,P1Enum);
+ 	element->AddBasalInput(SurfaceEnum,newsurface,P1Enum);
+-	element->AddBasalInput(BedEnum,newbed,P1Enum);
++	element->AddBasalInput(BaseEnum,newbed,P1Enum);
+ 
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(newthickness);
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 17554)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 17555)
+@@ -23,7 +23,7 @@
+ 	}
+ 
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+-	iomodel->FetchDataToInput(elements,BedEnum);
++	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	if(iomodel->meshtype==Mesh3DEnum){
+ 		iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 17554)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 17555)
+@@ -23,7 +23,7 @@
+ 	}
+ 
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+-	iomodel->FetchDataToInput(elements,BedEnum);
++	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	if(iomodel->meshtype==Mesh3DEnum){
+ 		iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 17554)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 17555)
+@@ -42,7 +42,7 @@
+ 
+ 	iomodel->FetchDataToInput(elements,ThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+-	iomodel->FetchDataToInput(elements,BedEnum);
++	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
+ 	iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 17554)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 17555)
+@@ -34,10 +34,10 @@
+ 		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		IssmDouble SedimentStoring(Element* element);
+ 		IssmDouble EplSpecificStoring(Element* element);
+-		IssmDouble GetHydrologyDCInefficientHmax(Element* element, Gauss* gauss, Input* thickness_input, Input* bed_input);
++		IssmDouble GetHydrologyDCInefficientHmax(Element* element, Gauss* gauss, Input* thickness_input, Input* base_input);
+ 		void GetHydrologyDCInefficientHmax(IssmDouble* ph_max,Element* element, Node* innode);
+-		IssmDouble GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss, Input* epl_thick_input, Input* sed_head_input, Input* epl_head_input, Input* sed_trans_input, Input* thickness_input, Input* bed_input);
+-		IssmDouble GetHydrologyPVectorTransfer(Element* element, Gauss* gauss, Input* epl_thick_input, Input* sed_head_input, Input* epl_head_input, Input* sed_trans_input, Input* thickness_input, Input* bed_input);
++		IssmDouble GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss, Input* epl_thick_input, Input* sed_head_input, Input* epl_head_input, Input* sed_trans_input, Input* thickness_input, Input* base_input);
++		IssmDouble GetHydrologyPVectorTransfer(Element* element, Gauss* gauss, Input* epl_thick_input, Input* sed_head_input, Input* epl_head_input, Input* sed_trans_input, Input* thickness_input, Input* base_input);
+ 		void ElementizeEplMask(FemModel* femmodel);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 17554)
++++ ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 17555)
+@@ -24,7 +24,7 @@
+ 
+ 	iomodel->FetchDataToInput(elements,ThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+-	iomodel->FetchDataToInput(elements,BedEnum);
++	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,VxEnum);
+ 	iomodel->FetchDataToInput(elements,VyEnum);
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 17554)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 17555)
+@@ -23,7 +23,7 @@
+ 	}
+ 
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+-	iomodel->FetchDataToInput(elements,BedEnum);
++	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	if(iomodel->meshtype==Mesh3DEnum){
+ 		iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
+@@ -174,8 +174,8 @@
+ 	switch(input_enum){
+ 		case SurfaceSlopeXEnum: input2 = basalelement->GetInput(SurfaceEnum); _assert_(input2); break;
+ 		case SurfaceSlopeYEnum: input2 = basalelement->GetInput(SurfaceEnum); _assert_(input2); break;
+-		case BedSlopeXEnum:     input2 = basalelement->GetInput(BedEnum);     _assert_(input2); break;
+-		case BedSlopeYEnum:     input2 = basalelement->GetInput(BedEnum);     _assert_(input2); break;
++		case BedSlopeXEnum:     input2 = basalelement->GetInput(BaseEnum);     _assert_(input2); break;
++		case BedSlopeYEnum:     input2 = basalelement->GetInput(BaseEnum);     _assert_(input2); break;
+ 		case LevelsetfunctionSlopeXEnum: input2 = basalelement->GetInput(MaskIceLevelsetEnum);     _assert_(input2); break;
+ 		case LevelsetfunctionSlopeYEnum: input2 = basalelement->GetInput(MaskIceLevelsetEnum);     _assert_(input2); break;
+ 		default: input = element->GetInput(input_enum);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17554)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17555)
+@@ -193,7 +193,7 @@
+ 	/*Create inputs: */
+ 	iomodel->FetchDataToInput(elements,ThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+-	iomodel->FetchDataToInput(elements,BedEnum);
++	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,FrictionCoefficientEnum);
+ 	iomodel->FetchDataToInput(elements,FrictionPEnum);
+ 	iomodel->FetchDataToInput(elements,FrictionQEnum);
+@@ -808,14 +808,14 @@
+ 	/*Create Riffront loads for rifts: */
+ 	if(numrifts){
+ 		iomodel->FetchData(&riftinfo,&numriftsegments,NULL,RiftsRiftstructEnum);
+-		iomodel->FetchData(5,RiftsRiftstructEnum,ThicknessEnum,BedEnum,SurfaceEnum,MaskGroundediceLevelsetEnum);
++		iomodel->FetchData(5,RiftsRiftstructEnum,ThicknessEnum,BaseEnum,SurfaceEnum,MaskGroundediceLevelsetEnum);
+ 		for(i=0;i<numriftsegments;i++){
+ 			if(iomodel->my_elements[reCast<int,IssmDouble>(*(riftinfo+RIFTINFOSIZE*i+2))-1]){
+ 				loads->AddObject(new Riftfront(iomodel->loadcounter+count+1,i,iomodel,StressbalanceAnalysisEnum));
+ 				count++;
+ 			}
+ 		}
+-		iomodel->DeleteData(5,RiftsRiftstructEnum,ThicknessEnum,BedEnum,SurfaceEnum,MaskGroundediceLevelsetEnum);
++		iomodel->DeleteData(5,RiftsRiftstructEnum,ThicknessEnum,BaseEnum,SurfaceEnum,MaskGroundediceLevelsetEnum);
+ 		xDelete<IssmDouble>(riftinfo);
+ 	}
+ }/*}}}*/
+@@ -1485,7 +1485,7 @@
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	Input* thickness_input = element->GetInput(ThicknessEnum); _assert_(thickness_input);
+-	Input* bed_input       = element->GetInput(BedEnum);       _assert_(bed_input);
++	Input* base_input       = element->GetInput(BaseEnum);       _assert_(base_input);
+ 	IssmDouble rho_water   = element->GetMaterialParameter(MaterialsRhoWaterEnum);
+ 	IssmDouble rho_ice     = element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 	IssmDouble gravity     = element->GetMaterialParameter(ConstantsGEnum);
+@@ -1500,7 +1500,7 @@
+ 
+ 		gauss->GaussPoint(ig);
+ 		thickness_input->GetInputValue(&thickness,gauss);
+-		bed_input->GetInputValue(&bed,gauss);
++		base_input->GetInputValue(&bed,gauss);
+ 		element->JacobianDeterminantSurface(&Jdet,xyz_list_front,gauss);
+ 		element->NodalFunctions(basis,gauss);
+ 
+@@ -1937,7 +1937,7 @@
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	Input* thickness_input = element->GetInput(ThicknessEnum); _assert_(thickness_input);
+-	Input* bed_input       = element->GetInput(BedEnum);       _assert_(bed_input);
++	Input* base_input       = element->GetInput(BaseEnum);       _assert_(base_input);
+ 	IssmDouble rho_water   = element->GetMaterialParameter(MaterialsRhoWaterEnum);
+ 	IssmDouble rho_ice     = element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 	IssmDouble gravity     = element->GetMaterialParameter(ConstantsGEnum);
+@@ -1951,7 +1951,7 @@
+ 
+ 		gauss->GaussPoint(ig);
+ 		thickness_input->GetInputValue(&thickness,gauss);
+-		bed_input->GetInputValue(&bed,gauss);
++		base_input->GetInputValue(&bed,gauss);
+ 		element->JacobianDeterminantSurface(&Jdet,xyz_list_front,gauss);
+ 		element->NodalFunctions(basis,gauss);
+ 
+@@ -3591,7 +3591,7 @@
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinatesBase(&xyz_list_base);
+-	Input*      bed_input=element->GetInput(BedEnum); _assert_(bed_input);
++	Input*      base_input=element->GetInput(BaseEnum); _assert_(base_input);
+ 	IssmDouble  rho_water=element->GetMaterialParameter(MaterialsRhoWaterEnum);
+ 	IssmDouble  gravity  =element->GetMaterialParameter(ConstantsGEnum);
+ 
+@@ -3605,7 +3605,7 @@
+ 
+ 		element->NormalBase(&normal[0],xyz_list_base);
+ 		_assert_(normal[dim-1]<0.);
+-		bed_input->GetInputValue(&bed, gauss);
++		base_input->GetInputValue(&bed, gauss);
+ 		water_pressure=gravity*rho_water*bed;
+ 
+ 		for(i=0;i<vnumnodes;i++){
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17554)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17555)
+@@ -81,7 +81,7 @@
+ 	}
+ 
+ 	iomodel->FetchDataToInput(elements,ThicknessEnum);
+-	iomodel->FetchDataToInput(elements,BedEnum);
++	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
+ 	iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
+@@ -199,7 +199,7 @@
+ 	Input* sed_head_input    = basalelement->GetInput(SedimentHeadEnum);
+ 	Input* epl_head_input    = basalelement->GetInput(EplHeadEnum);
+ 	Input* thickness_input   = basalelement->GetInput(ThicknessEnum);
+-	Input* bed_input         = basalelement->GetInput(BedEnum);
++	Input* base_input         = basalelement->GetInput(BaseEnum);
+ 	Input* SedTrans_input    = basalelement->GetInput(HydrologydcSedimentTransmitivityEnum); _assert_(SedTrans_input);
+ 	IssmDouble sediment_storing = SedimentStoring(basalelement);
+ 	/*Transfer related Inputs*/
+@@ -238,7 +238,7 @@
+ 			if(isefficientlayer){
+ 				active_element_input->GetInputValue(&active_element);
+ 				if(active_element){
+-					transfer=GetHydrologyKMatrixTransfer(basalelement,gauss,epl_thick_input,sed_head_input,epl_head_input,SedTrans_input,thickness_input,bed_input);
++					transfer=GetHydrologyKMatrixTransfer(basalelement,gauss,epl_thick_input,sed_head_input,epl_head_input,SedTrans_input,thickness_input,base_input);
+ 					basalelement->NodalFunctions(&basis[0],gauss);
+ 					D_scalar=transfer*gauss->weight*Jdet*dt;
+ 					TripleMultiply(basis,numnodes,1,0,
+@@ -304,7 +304,7 @@
+ 	Input* epl_head_input    = basalelement->GetInput(EplHeadEnum);
+ 	Input* sed_trans_input   = basalelement->GetInput(HydrologydcSedimentTransmitivityEnum);
+ 	Input* thickness_input   = basalelement->GetInput(ThicknessEnum);
+-	Input* bed_input         = basalelement->GetInput(BedEnum);
++	Input* base_input         = basalelement->GetInput(BaseEnum);
+ 	Input* water_input       = basalelement->GetInput(BasalforcingsMeltingRateEnum);    _assert_(water_input);
+ 	if(dt!= 0.){old_wh_input = basalelement->GetInput(SedimentHeadOldEnum);             _assert_(old_wh_input);}
+ 
+@@ -339,7 +339,7 @@
+ 				/*Dealing with the sediment part of the transfer term*/
+ 				active_element_input->GetInputValue(&active_element);
+ 				if(active_element){
+-					transfer=GetHydrologyPVectorTransfer(basalelement,gauss,epl_thick_input,sed_head_input,epl_head_input,sed_trans_input,thickness_input,bed_input);
++					transfer=GetHydrologyPVectorTransfer(basalelement,gauss,epl_thick_input,sed_head_input,epl_head_input,sed_trans_input,thickness_input,base_input);
+ 				}
+ 				else{
+ 					transfer=0.0;
+@@ -473,7 +473,7 @@
+ 	return rho_freshwater*g*epl_porosity*(water_compressibility+(epl_compressibility/epl_porosity));		 
+ }/*}}}*/
+ 
+-IssmDouble HydrologyDCInefficientAnalysis::GetHydrologyDCInefficientHmax(Element* element, Gauss* gauss, Input* thick_input, Input* bed_input){/*{{{*/
++IssmDouble HydrologyDCInefficientAnalysis::GetHydrologyDCInefficientHmax(Element* element, Gauss* gauss, Input* thick_input, Input* base_input){/*{{{*/
+ 	int        hmax_flag;
+ 	IssmDouble h_max;
+ 	IssmDouble rho_ice,rho_water;
+@@ -495,11 +495,11 @@
+ 		rho_ice   = element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 
+ 		_assert_(thick_input);
+-		_assert_(bed_input);
++		_assert_(base_input);
+ 
+ 		/*Compute max*/
+ 		thick_input->GetInputValue(&thickness,gauss);
+-		bed_input->GetInputValue(&bed,gauss);
++		base_input->GetInputValue(&bed,gauss);
+ 		h_max=((rho_ice*thickness)/rho_water)+bed;
+ 		break;
+ 	case 3:
+@@ -532,7 +532,7 @@
+ 		rho_water = element->GetMaterialParameter(MaterialsRhoFreshwaterEnum);
+ 		rho_ice   = element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 		element->GetInputValue(&thickness,innode,ThicknessEnum);
+-		element->GetInputValue(&bed,innode,BedEnum);
++		element->GetInputValue(&bed,innode,BaseEnum);
+ 		h_max=((rho_ice*thickness)/rho_water)+bed;
+ 		break;
+ 	case 3:
+@@ -545,7 +545,7 @@
+ 	*ph_max=h_max;
+ }
+ /*}}}*/
+-IssmDouble HydrologyDCInefficientAnalysis::GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss, Input* epl_thick_input, Input* sed_head_input, Input* epl_head_input, Input* sed_trans_input, Input* thickness_input, Input* bed_input){/*{{{*/
++IssmDouble HydrologyDCInefficientAnalysis::GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss, Input* epl_thick_input, Input* sed_head_input, Input* epl_head_input, Input* sed_trans_input, Input* thickness_input, Input* base_input){/*{{{*/
+ 
+ 	int transfermethod;
+ 	IssmDouble epl_thickness;
+@@ -571,7 +571,7 @@
+ 		_assert_(epl_head_input);
+ 		_assert_(sed_trans_input);
+ 		_assert_(thickness_input);
+-		_assert_(bed_input);
++		_assert_(base_input);
+ 
+ 		epl_thick_input->GetInputValue(&epl_thickness,gauss);
+ 		sed_head_input->GetInputValue(&sed_head,gauss);
+@@ -580,7 +580,7 @@
+ 		element->FindParam(&leakage,HydrologydcLeakageFactorEnum);
+ 	
+ 		if(epl_head>sed_head){
+-			h_max=GetHydrologyDCInefficientHmax(element,gauss,thickness_input,bed_input);
++			h_max=GetHydrologyDCInefficientHmax(element,gauss,thickness_input,base_input);
+ 			if(sed_head>=h_max){
+ 				transfer=0.0;
+ 			}
+@@ -599,7 +599,7 @@
+ 	return transfer;
+ }/*}}}*/
+ 
+-IssmDouble HydrologyDCInefficientAnalysis::GetHydrologyPVectorTransfer(Element* element, Gauss* gauss, Input* epl_thick_input, Input* sed_head_input, Input* epl_head_input, Input* sed_trans_input, Input* thickness_input, Input* bed_input){/*{{{*/
++IssmDouble HydrologyDCInefficientAnalysis::GetHydrologyPVectorTransfer(Element* element, Gauss* gauss, Input* epl_thick_input, Input* sed_head_input, Input* epl_head_input, Input* sed_trans_input, Input* thickness_input, Input* base_input){/*{{{*/
+ 
+ 	int transfermethod;
+ 	IssmDouble epl_thickness;
+@@ -625,7 +625,7 @@
+ 		_assert_(epl_head_input);
+ 		_assert_(sed_trans_input);
+ 		_assert_(thickness_input);
+-		_assert_(bed_input);
++		_assert_(base_input);
+ 
+ 		epl_thick_input->GetInputValue(&epl_thickness,gauss);
+ 		sed_head_input->GetInputValue(&sediment_head,gauss);
+@@ -635,7 +635,7 @@
+ 		element->FindParam(&leakage,HydrologydcLeakageFactorEnum);
+ 
+ 		if(epl_head>sediment_head){
+-			h_max=GetHydrologyDCInefficientHmax(element,gauss,thickness_input,bed_input);
++			h_max=GetHydrologyDCInefficientHmax(element,gauss,thickness_input,base_input);
+ 			if(sediment_head>=h_max){
+ 				transfer=0.0;
+ 			}
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17554)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17555)
+@@ -48,7 +48,7 @@
+ 
+ 	iomodel->FetchDataToInput(elements,ThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+-	iomodel->FetchDataToInput(elements,BedEnum);
++	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,FrictionCoefficientEnum);
+ 	iomodel->FetchDataToInput(elements,FrictionPEnum);
+ 	iomodel->FetchDataToInput(elements,FrictionQEnum);
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17554)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17555)
+@@ -52,7 +52,7 @@
+ 
+ 	iomodel->FetchDataToInput(elements,ThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+-	iomodel->FetchDataToInput(elements,BedEnum);
++	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,FrictionCoefficientEnum);
+ 	iomodel->FetchDataToInput(elements,FrictionPEnum);
+ 	iomodel->FetchDataToInput(elements,FrictionQEnum);
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17554)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17555)
+@@ -265,7 +265,7 @@
+ 	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	Input* mb_input            = basalelement->GetInput(BasalforcingsMeltingRateEnum);   _assert_(mb_input);
+ 	Input* mb_correction_input = basalelement->GetInput(BasalforcingsMeltingRateCorrectionEnum);
+-	Input* bed_input           = basalelement->GetInput(BedEnum);                        _assert_(bed_input);
++	Input* base_input           = basalelement->GetInput(BaseEnum);                        _assert_(base_input);
+ 	Input* vz_input      = NULL;
+ 	switch(dim){
+ 		case 1: vz_input = basalelement->GetInput(VyEnum); _assert_(vz_input); break;
+@@ -284,7 +284,7 @@
+ 
+ 		vz_input->GetInputValue(&vz,gauss);
+ 		mb_input->GetInputValue(&mb,gauss);
+-		bed_input->GetInputValue(&bed,gauss);
++		base_input->GetInputValue(&bed,gauss);
+ 		if(mb_correction_input)
+ 		 mb_correction_input->GetInputValue(&mb_correction,gauss);
+ 		else
+@@ -362,7 +362,7 @@
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+ void FreeSurfaceBaseAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	element->InputUpdateFromSolutionOneDof(solution,BedEnum);
++	element->InputUpdateFromSolutionOneDof(solution,BaseEnum);
+ }/*}}}*/
+ void FreeSurfaceBaseAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+ 	/*Default, do nothing*/
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17554)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17555)
+@@ -40,8 +40,8 @@
+ 	BasalforcingsGeothermalfluxEnum,
+ 	BasalforcingsMeltingRateCorrectionEnum,
+ 	BasalforcingsMeltingRateEnum,
+-	BathymetryEnum,
+ 	BedEnum,
++	BaseEnum,
+ 	ConstantsGEnum,
+ 	ConstantsReferencetemperatureEnum,
+ 	ConstantsYtsEnum,
+@@ -479,7 +479,7 @@
+ 	QmuVyEnum,
+ 	QmuVzEnum,
+ 	QmuThicknessEnum,
+-	QmuBedEnum,
++	QmuBaseEnum,
+ 	QmuSurfaceEnum,
+ 	QmuMeltingEnum,
+ 	QmuVxMeshEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17554)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17555)
+@@ -48,8 +48,8 @@
+ 		case BasalforcingsGeothermalfluxEnum : return "BasalforcingsGeothermalflux";
+ 		case BasalforcingsMeltingRateCorrectionEnum : return "BasalforcingsMeltingRateCorrection";
+ 		case BasalforcingsMeltingRateEnum : return "BasalforcingsMeltingRate";
+-		case BathymetryEnum : return "Bathymetry";
+ 		case BedEnum : return "Bed";
++		case BaseEnum : return "Base";
+ 		case ConstantsGEnum : return "ConstantsG";
+ 		case ConstantsReferencetemperatureEnum : return "ConstantsReferencetemperature";
+ 		case ConstantsYtsEnum : return "ConstantsYts";
+@@ -468,7 +468,7 @@
+ 		case QmuVyEnum : return "QmuVy";
+ 		case QmuVzEnum : return "QmuVz";
+ 		case QmuThicknessEnum : return "QmuThickness";
+-		case QmuBedEnum : return "QmuBed";
++		case QmuBaseEnum : return "QmuBase";
+ 		case QmuSurfaceEnum : return "QmuSurface";
+ 		case QmuMeltingEnum : return "QmuMelting";
+ 		case QmuVxMeshEnum : return "QmuVxMesh";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17554)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17555)
+@@ -48,8 +48,8 @@
+ 	      else if (strcmp(name,"BasalforcingsGeothermalflux")==0) return BasalforcingsGeothermalfluxEnum;
+ 	      else if (strcmp(name,"BasalforcingsMeltingRateCorrection")==0) return BasalforcingsMeltingRateCorrectionEnum;
+ 	      else if (strcmp(name,"BasalforcingsMeltingRate")==0) return BasalforcingsMeltingRateEnum;
+-	      else if (strcmp(name,"Bathymetry")==0) return BathymetryEnum;
+ 	      else if (strcmp(name,"Bed")==0) return BedEnum;
++	      else if (strcmp(name,"Base")==0) return BaseEnum;
+ 	      else if (strcmp(name,"ConstantsG")==0) return ConstantsGEnum;
+ 	      else if (strcmp(name,"ConstantsReferencetemperature")==0) return ConstantsReferencetemperatureEnum;
+ 	      else if (strcmp(name,"ConstantsYts")==0) return ConstantsYtsEnum;
+@@ -477,7 +477,7 @@
+ 	      else if (strcmp(name,"QmuVy")==0) return QmuVyEnum;
+ 	      else if (strcmp(name,"QmuVz")==0) return QmuVzEnum;
+ 	      else if (strcmp(name,"QmuThickness")==0) return QmuThicknessEnum;
+-	      else if (strcmp(name,"QmuBed")==0) return QmuBedEnum;
++	      else if (strcmp(name,"QmuBase")==0) return QmuBaseEnum;
+ 	      else if (strcmp(name,"QmuSurface")==0) return QmuSurfaceEnum;
+ 	      else if (strcmp(name,"QmuMelting")==0) return QmuMeltingEnum;
+ 	      else if (strcmp(name,"QmuVxMesh")==0) return QmuVxMeshEnum;
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/Transient/UpdateElementsTransient.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/Transient/UpdateElementsTransient.cpp	(revision 17554)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/Transient/UpdateElementsTransient.cpp	(revision 17555)
+@@ -14,6 +14,6 @@
+ 	parameters->FindParam(&isgroundingline,TransientIsgroundinglineEnum);
+ 
+ 	if(isgroundingline){
+-		iomodel->FetchDataToInput(elements,BathymetryEnum);
++		iomodel->FetchDataToInput(elements,BedEnum);
+ 	}
+ }
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp	(revision 17554)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp	(revision 17555)
+@@ -86,7 +86,7 @@
+ 	/*Create vertices: */
+ 
+ 	/*Fetch data:*/
+-	iomodel->FetchData(6,MeshXEnum,MeshYEnum,MeshZEnum,BedEnum,ThicknessEnum,MaskIceLevelsetEnum);
++	iomodel->FetchData(6,MeshXEnum,MeshYEnum,MeshZEnum,BaseEnum,ThicknessEnum,MaskIceLevelsetEnum);
+ 	CreateNumberNodeToElementConnectivity(iomodel);
+ 
+ 	for(i=0;i<iomodel->numberofvertices;i++){
+@@ -94,5 +94,5 @@
+ 	}
+ 
+ 	/*Free data: */
+-	iomodel->DeleteData(6,MeshXEnum,MeshYEnum,MeshZEnum,BedEnum,ThicknessEnum,MaskIceLevelsetEnum);
++	iomodel->DeleteData(6,MeshXEnum,MeshYEnum,MeshZEnum,BaseEnum,ThicknessEnum,MaskIceLevelsetEnum);
+ }
+Index: ../trunk-jpl/src/c/cores/transient_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17554)
++++ ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17555)
+@@ -72,7 +72,7 @@
+ 		if(ismasstransport || isgroundingline){
+ 			InputDuplicatex(femmodel,QmuThicknessEnum,ThicknessEnum);
+ 			InputDuplicatex(femmodel,QmuSurfaceEnum,SurfaceEnum);
+-			InputDuplicatex(femmodel,QmuBedEnum,BedEnum);
++			InputDuplicatex(femmodel,QmuBaseEnum,BaseEnum);
+ 			InputDuplicatex(femmodel,QmuMaskIceLevelsetEnum,MaskIceLevelsetEnum);
+ 		}
+ 		if(isgroundingline) InputDuplicatex(femmodel,QmuMaskGroundediceLevelsetEnum,MaskGroundediceLevelsetEnum);
+@@ -161,7 +161,7 @@
+ 			if(VerboseSolution()) _printf0_("   computing new grounding line position\n");
+ 			GroundinglineMigrationx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
+ 			if(save_results){
+-				int outputs[3] = {SurfaceEnum,BedEnum,MaskGroundediceLevelsetEnum};
++				int outputs[3] = {SurfaceEnum,BaseEnum,MaskGroundediceLevelsetEnum};
+ 				femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],3);
+ 			}
+ 		}
+Index: ../trunk-jpl/src/c/cores/masstransport_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/masstransport_core.cpp	(revision 17554)
++++ ../trunk-jpl/src/c/cores/masstransport_core.cpp	(revision 17555)
+@@ -36,7 +36,7 @@
+ 	if(dakota_analysis && solution_type==MasstransportSolutionEnum){
+ 		InputDuplicatex(femmodel,QmuSurfaceEnum,SurfaceEnum);
+ 		InputDuplicatex(femmodel,QmuThicknessEnum,ThicknessEnum);
+-		InputDuplicatex(femmodel,QmuBedEnum,BedEnum);
++		InputDuplicatex(femmodel,QmuBaseEnum,BaseEnum);
+ 	}
+ 
+ 	/*Calculate new Surface Mass Balance (SMB)*/
+@@ -48,7 +48,7 @@
+ 		femmodel->SetCurrentConfiguration(FreeSurfaceBaseAnalysisEnum);
+ 		solutionsequence_linear(femmodel);
+ 		if(meshtype!=Mesh2DhorizontalEnum){
+-			femmodel->parameters->SetParam(BedEnum,InputToExtrudeEnum);
++			femmodel->parameters->SetParam(BaseEnum,InputToExtrudeEnum);
+ 			extrudefrombase_core(femmodel);
+ 		}
+ 		femmodel->SetCurrentConfiguration(FreeSurfaceTopAnalysisEnum);
+@@ -64,7 +64,7 @@
+ 		if(meshtype==Mesh2DverticalEnum){
+ 			femmodel->parameters->SetParam(ThicknessEnum,InputToExtrudeEnum);
+ 			extrudefrombase_core(femmodel);
+-			femmodel->parameters->SetParam(BedEnum,InputToExtrudeEnum);
++			femmodel->parameters->SetParam(BaseEnum,InputToExtrudeEnum);
+ 			extrudefrombase_core(femmodel);
+ 			femmodel->parameters->SetParam(SurfaceEnum,InputToExtrudeEnum);
+ 			extrudefrombase_core(femmodel);
+Index: ../trunk-jpl/src/c/classes/Vertex.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Vertex.cpp	(revision 17554)
++++ ../trunk-jpl/src/c/classes/Vertex.cpp	(revision 17555)
+@@ -33,14 +33,14 @@
+ 	this->z            = iomodel->Data(MeshZEnum)[i];
+ 	this->meshtype     = iomodel->meshtype;
+ 
+-	_assert_(iomodel->Data(BedEnum) && iomodel->Data(ThicknessEnum) && iomodel->numbernodetoelementconnectivity);
++	_assert_(iomodel->Data(BaseEnum) && iomodel->Data(ThicknessEnum) && iomodel->numbernodetoelementconnectivity);
+ 	switch(iomodel->meshtype){
+ 		case Mesh3DEnum:
+ 		case Mesh2DhorizontalEnum:
+-			this->sigma = (iomodel->Data(MeshZEnum)[i]-iomodel->Data(BedEnum)[i])/(iomodel->Data(ThicknessEnum)[i]);
++			this->sigma = (iomodel->Data(MeshZEnum)[i]-iomodel->Data(BaseEnum)[i])/(iomodel->Data(ThicknessEnum)[i]);
+ 			break;
+ 		case Mesh2DverticalEnum:
+-			this->sigma = (iomodel->Data(MeshYEnum)[i]-iomodel->Data(BedEnum)[i])/(iomodel->Data(ThicknessEnum)[i]);
++			this->sigma = (iomodel->Data(MeshYEnum)[i]-iomodel->Data(BaseEnum)[i])/(iomodel->Data(ThicknessEnum)[i]);
+ 			break;
+ 	}
+ 
+Index: ../trunk-jpl/src/c/classes/Loads/Friction.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Friction.cpp	(revision 17554)
++++ ../trunk-jpl/src/c/classes/Loads/Friction.cpp	(revision 17555)
+@@ -59,7 +59,7 @@
+ 	element->GetInputValue(&drag_p,FrictionPEnum);
+ 	element->GetInputValue(&drag_q,FrictionQEnum);
+ 	element->GetInputValue(&thickness, gauss,ThicknessEnum);
+-	element->GetInputValue(&bed, gauss,BedEnum);
++	element->GetInputValue(&bed, gauss,BaseEnum);
+ 	element->GetInputValue(&drag_coefficient, gauss,FrictionCoefficientEnum);
+ 	IssmDouble rho_water   = element->GetMaterialParameter(MaterialsRhoWaterEnum);
+ 	IssmDouble rho_ice     = element->GetMaterialParameter(MaterialsRhoIceEnum);
+@@ -123,7 +123,7 @@
+ 	element->GetInputValue(&drag_p,FrictionPEnum);
+ 	element->GetInputValue(&drag_q,FrictionQEnum);
+ 	element->GetInputValue(&thickness, gauss,ThicknessEnum);
+-	element->GetInputValue(&bed, gauss,BedEnum);
++	element->GetInputValue(&bed, gauss,BaseEnum);
+ 	element->GetInputValue(&drag_coefficient, gauss,FrictionCoefficientEnum);
+ 	IssmDouble rho_water   = element->GetMaterialParameter(MaterialsRhoWaterEnum);
+ 	IssmDouble rho_ice     = element->GetMaterialParameter(MaterialsRhoIceEnum);
+Index: ../trunk-jpl/src/c/classes/Loads/Riftfront.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Riftfront.cpp	(revision 17554)
++++ ../trunk-jpl/src/c/classes/Loads/Riftfront.cpp	(revision 17555)
+@@ -525,8 +525,8 @@
+ 	tria2->GetInputValue(&h[1],nodes[1],ThicknessEnum);
+ 	if (h[0]!=h[1])_error_("different thicknesses not supported for rift fronts");
+ 	thickness=h[0];
+-	tria1->GetInputValue(&b[0],nodes[0],BedEnum);
+-	tria2->GetInputValue(&b[1],nodes[1],BedEnum);
++	tria1->GetInputValue(&b[0],nodes[0],BaseEnum);
++	tria2->GetInputValue(&b[1],nodes[1],BaseEnum);
+ 	if (b[0]!=b[1])_error_("different beds not supported for rift fronts");
+ 	bed=b[0];
+ 
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17554)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17555)
+@@ -364,7 +364,7 @@
+ 
+ 	/*get vertex vectors for bed and thickness: */
+ 	GetVectorFromInputsx(&surface  ,this, SurfaceEnum,VertexEnum);
+-	GetVectorFromInputsx(&bed      ,this, BedEnum,    VertexEnum);
++	GetVectorFromInputsx(&bed      ,this, BaseEnum,    VertexEnum);
+ 
+ 	/*Allocate vector*/
+ 	Vector<IssmDouble> *vx=new Vector<IssmDouble>(vertices->NumberOfVertices());
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17554)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17555)
+@@ -2108,9 +2108,9 @@
+ 
+ 	/*Now get the average height*/
+ 	Input* surface_input = inputs->GetInput(SurfaceEnum); _assert_(surface_input);
+-	Input* bed_input     = inputs->GetInput(BedEnum);     _assert_(bed_input);
++	Input* base_input     = inputs->GetInput(BaseEnum);     _assert_(base_input);
+ 	surface_input->GetInputAverage(&surface);
+-	bed_input->GetInputAverage(&bed);
++	base_input->GetInputAverage(&bed);
+ 
+ 	/*Return: */
+ 	int meshtype;
+@@ -2144,11 +2144,11 @@
+ 
+ 	/*Now get the average height and bathymetry*/
+ 	Input* surface_input    = inputs->GetInput(SurfaceEnum);    _assert_(surface_input);
+-	Input* bed_input        = inputs->GetInput(BedEnum);        _assert_(bed_input);
+-	Input* bathymetry_input = inputs->GetInput(BathymetryEnum); _assert_(bathymetry_input);
++	Input* base_input        = inputs->GetInput(BaseEnum);        _assert_(base_input);
++	Input* bed_input = inputs->GetInput(BedEnum); _assert_(bed_input);
+ 	surface_input->GetInputAverage(&surface);
+-	bed_input->GetInputAverage(&bed);
+-	bathymetry_input->GetInputAverage(&bathymetry);
++	base_input->GetInputAverage(&bed);
++	bed_input->GetInputAverage(&bathymetry);
+ 	
+ 	/*Return: */
+ 	return base*(surface-bed+min(rho_water/rho_ice*bathymetry,0.));
+@@ -4135,7 +4135,7 @@
+ 					/*retrieve inputs: */
+ 					GetInputListOnVertices(&thickness_init[0],ThicknessEnum);
+ 					GetInputListOnVertices(&hydrostatic_ratio[0],GeometryHydrostaticRatioEnum);
+-					GetInputListOnVertices(&bed[0],BedEnum);
++					GetInputListOnVertices(&bed[0],BaseEnum);
+ 					GetInputListOnVertices(&surface[0],SurfaceEnum);
+ 
+ 					/*build new bed and surface: */
+@@ -4177,7 +4177,7 @@
+ 
+ 					/*Add new inputs: */
+ 					this->inputs->AddInput(new TriaInput(ThicknessEnum,thickness,P1Enum));
+-					this->inputs->AddInput(new TriaInput(BedEnum,bed,P1Enum));
++					this->inputs->AddInput(new TriaInput(BaseEnum,bed,P1Enum));
+ 					this->inputs->AddInput(new TriaInput(SurfaceEnum,surface,P1Enum));
+ 
+ 					break;
+@@ -4254,8 +4254,8 @@
+ 	parameters->FindParam(&yts,ConstantsYtsEnum);
+ 	GetInputListOnVertices(&h[0],ThicknessEnum);
+ 	GetInputListOnVertices(&s[0],SurfaceEnum);
+-	GetInputListOnVertices(&b[0],BedEnum);
+-	GetInputListOnVertices(&r[0],BathymetryEnum);
++	GetInputListOnVertices(&b[0],BaseEnum);
++	GetInputListOnVertices(&r[0],BedEnum);
+ 	GetInputListOnVertices(&phi[0],MaskGroundediceLevelsetEnum);
+ 	rho_water   = matpar->GetRhoWater();
+ 	rho_ice     = matpar->GetRhoIce();
+@@ -4332,7 +4332,7 @@
+ 
+ 	/*Update inputs*/
+ 	this->inputs->AddInput(new TriaInput(SurfaceEnum,&s[0],P1Enum));
+-	this->inputs->AddInput(new TriaInput(BedEnum,&b[0],P1Enum));
++	this->inputs->AddInput(new TriaInput(BaseEnum,&b[0],P1Enum));
+ 
+ }
+ /*}}}*/
+@@ -4348,7 +4348,7 @@
+ 	rho_ice=matpar->GetRhoIce();
+ 	density=rho_ice/rho_water;
+ 	GetInputListOnVertices(&h[0],ThicknessEnum);
+-	GetInputListOnVertices(&r[0],BathymetryEnum);
++	GetInputListOnVertices(&r[0],BedEnum);
+ 	GetInputListOnVertices(&gl[0],MaskGroundediceLevelsetEnum);
+ 
+ 	/*go through vertices, and figure out which ones are grounded and want to unground: */
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17554)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17555)
+@@ -2677,11 +2677,11 @@
+ 
+ 	/*Now get the average height above floatation*/
+ 	Input* surface_input    = inputs->GetInput(SurfaceEnum);    _assert_(surface_input);
+-	Input* bed_input        = inputs->GetInput(BedEnum);        _assert_(bed_input);
+-	Input* bathymetry_input = inputs->GetInput(BathymetryEnum); _assert_(bathymetry_input);
++	Input* base_input        = inputs->GetInput(BaseEnum);        _assert_(base_input);
++	Input* bed_input = inputs->GetInput(BedEnum); _assert_(bed_input);
+ 	surface_input->GetInputAverage(&surface);
+-	bed_input->GetInputAverage(&bed);
+-	bathymetry_input->GetInputAverage(&bathymetry);
++	base_input->GetInputAverage(&bed);
++	bed_input->GetInputAverage(&bathymetry);
+ 
+ 	/*Return: */
+ 	return base*(surface - bed + min( rho_water/rho_ice * bathymetry, 0.) );
+@@ -3739,7 +3739,7 @@
+ 					/*retrieve inputs: */
+ 					GetInputListOnVertices(&thickness_init[0],ThicknessEnum);
+ 					GetInputListOnVertices(&hydrostatic_ratio[0],GeometryHydrostaticRatioEnum);
+-					GetInputListOnVertices(&bed[0],BedEnum);
++					GetInputListOnVertices(&bed[0],BaseEnum);
+ 					GetInputListOnVertices(&surface[0],SurfaceEnum);
+ 
+ 					/*build new thickness: */
+@@ -3792,7 +3792,7 @@
+ 
+ 					/*Add new inputs: */
+ 					this->inputs->AddInput(new PentaInput(ThicknessEnum,thickness,P1Enum));
+-					this->inputs->AddInput(new PentaInput(BedEnum,bed,P1Enum));
++					this->inputs->AddInput(new PentaInput(BaseEnum,bed,P1Enum));
+ 					this->inputs->AddInput(new PentaInput(SurfaceEnum,surface,P1Enum));
+ 					break;
+ 
+@@ -3898,8 +3898,8 @@
+ 	parameters->FindParam(&yts,ConstantsYtsEnum);
+ 	GetInputListOnVertices(&h[0],ThicknessEnum);
+ 	GetInputListOnVertices(&s[0],SurfaceEnum);
+-	GetInputListOnVertices(&b[0],BedEnum);
+-	GetInputListOnVertices(&r[0],BathymetryEnum);
++	GetInputListOnVertices(&b[0],BaseEnum);
++	GetInputListOnVertices(&r[0],BedEnum);
+ 	GetInputListOnVertices(&phi[0],MaskGroundediceLevelsetEnum);
+ 	rho_water   = matpar->GetRhoWater();
+ 	rho_ice     = matpar->GetRhoIce();
+@@ -3976,11 +3976,11 @@
+ 
+ 	/*Update inputs*/
+ 	this->inputs->AddInput(new PentaInput(SurfaceEnum,&s[0],P1Enum));
+-	this->inputs->AddInput(new PentaInput(BedEnum,&b[0],P1Enum));
++	this->inputs->AddInput(new PentaInput(BaseEnum,&b[0],P1Enum));
+ 
+ 	/*Extrude inputs*/
+ 	this->InputExtrude(SurfaceEnum);
+-	this->InputExtrude(BedEnum);
++	this->InputExtrude(BaseEnum);
+ }
+ /*}}}*/
+ /*FUNCTION Penta::PotentialUngrounding{{{*/
+@@ -3995,7 +3995,7 @@
+ 	rho_ice=matpar->GetRhoIce();
+ 	density=rho_ice/rho_water;
+ 	GetInputListOnVertices(&h[0],ThicknessEnum);
+-	GetInputListOnVertices(&r[0],BathymetryEnum);
++	GetInputListOnVertices(&r[0],BedEnum);
+ 	GetInputListOnVertices(&gl[0],MaskGroundediceLevelsetEnum);
+ 
+ 	/*go through vertices, and figure out which ones are on the ice sheet, and want to unground: */
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17554)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17555)
+@@ -685,8 +685,8 @@
+ 	if (
+ 				name==ThicknessEnum ||
+ 				name==SurfaceEnum ||
++				name==BaseEnum ||
+ 				name==BedEnum ||
+-				name==BathymetryEnum ||
+ 				name==SurfaceSlopeXEnum ||
+ 				name==SurfaceSlopeYEnum ||
+ 				name==SurfaceforcingsMassBalanceEnum ||
+@@ -728,7 +728,7 @@
+ 				name==QmuVyMeshEnum ||
+ 				name==QmuVzMeshEnum ||
+ 				name==QmuPressureEnum ||
+-				name==QmuBedEnum ||
++				name==QmuBaseEnum ||
+ 				name==QmuThicknessEnum ||
+ 				name==QmuSurfaceEnum ||
+ 				name==QmuTemperatureEnum ||
+Index: ../trunk-jpl/src/m/classes/geometry.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/geometry.m	(revision 17554)
++++ ../trunk-jpl/src/m/classes/geometry.m	(revision 17555)
+@@ -52,8 +52,8 @@
+ 		function marshall(obj,md,fid) % {{{
+ 			WriteData(fid,'data',obj.surface,'format','DoubleMat','mattype',1,'enum',SurfaceEnum());
+ 			WriteData(fid,'data',obj.thickness,'format','DoubleMat','mattype',1,'enum',ThicknessEnum(),'forcinglength',md.mesh.numberofvertices+1);
+-			WriteData(fid,'data',obj.bed,'format','DoubleMat','mattype',1,'enum',BedEnum());
+-			WriteData(fid,'data',obj.bathymetry,'format','DoubleMat','mattype',1,'enum',BathymetryEnum());
++			WriteData(fid,'data',obj.bed,'format','DoubleMat','mattype',1,'enum',BaseEnum());
++			WriteData(fid,'data',obj.bathymetry,'format','DoubleMat','mattype',1,'enum',BedEnum());
+ 			WriteData(fid,'object',obj,'fieldname','hydrostatic_ratio','format','DoubleMat','mattype',1);
+ 		end % }}}
+ 	end
+Index: ../trunk-jpl/src/m/classes/masstransport.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/masstransport.py	(revision 17554)
++++ ../trunk-jpl/src/m/classes/masstransport.py	(revision 17555)
+@@ -41,7 +41,7 @@
+ 		#}}}
+ 	def defaultoutputs(self,md): # {{{
+ 
+-		return ['Thickness','Surface','Bed']
++		return ['Thickness','Surface','Base']
+ 
+ 	#}}}
+ 	def setdefaultparameters(self): # {{{
+Index: ../trunk-jpl/src/m/classes/geometry.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/geometry.py	(revision 17554)
++++ ../trunk-jpl/src/m/classes/geometry.py	(revision 17555)
+@@ -50,7 +50,7 @@
+ 	def marshall(self,md,fid):    # {{{
+ 		WriteData(fid,'data',self.surface,'format','DoubleMat','mattype',1,'enum',SurfaceEnum())
+ 		WriteData(fid,'data',self.thickness,'format','DoubleMat','mattype',1,'enum',ThicknessEnum(),'forcinglength',md.mesh.numberofvertices+1)
+-		WriteData(fid,'data',self.bed,'format','DoubleMat','mattype',1,'enum',BedEnum())
+-		WriteData(fid,'data',self.bathymetry,'format','DoubleMat','mattype',1,'enum',BathymetryEnum())
++		WriteData(fid,'data',self.bed,'format','DoubleMat','mattype',1,'enum',BaseEnum())
++		WriteData(fid,'data',self.bathymetry,'format','DoubleMat','mattype',1,'enum',BedEnum())
+ 		WriteData(fid,'object',self,'fieldname','hydrostatic_ratio','format','DoubleMat','mattype',1)
+ 	# }}}
+Index: ../trunk-jpl/src/m/classes/masstransport.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/masstransport.m	(revision 17554)
++++ ../trunk-jpl/src/m/classes/masstransport.m	(revision 17555)
+@@ -62,7 +62,7 @@
+ 		end % }}}
+ 		function list = defaultoutputs(self,md) % {{{
+ 
+-			list = {'Thickness','Surface','Bed'};
++			list = {'Thickness','Surface','Base'};
+ 
+ 		end % }}}
+ 		function obj = setdefaultparameters(obj) % {{{
+Index: ../trunk-jpl/src/m/enum/QmuBedEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/QmuBedEnum.m	(revision 17554)
++++ ../trunk-jpl/src/m/enum/QmuBedEnum.m	(revision 17555)
+@@ -1,11 +0,0 @@
+-function macro=QmuBedEnum()
+-%QMUBEDENUM - Enum of QmuBed
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=QmuBedEnum()
+-
+-macro=StringToEnum('QmuBed');
+Index: ../trunk-jpl/src/m/enum/BathymetryEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/BathymetryEnum.m	(revision 17554)
++++ ../trunk-jpl/src/m/enum/BathymetryEnum.m	(revision 17555)
+@@ -1,11 +0,0 @@
+-function macro=BathymetryEnum()
+-%BATHYMETRYENUM - Enum of Bathymetry
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=BathymetryEnum()
+-
+-macro=StringToEnum('Bathymetry');
+Index: ../trunk-jpl/src/m/enum/QmuBaseEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/QmuBaseEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/QmuBaseEnum.m	(revision 17555)
+@@ -0,0 +1,11 @@
++function macro=QmuBaseEnum()
++%QMUBASEENUM - Enum of QmuBase
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=QmuBaseEnum()
++
++macro=StringToEnum('QmuBase');
+Index: ../trunk-jpl/src/m/enum/BaseEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/BaseEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/BaseEnum.m	(revision 17555)
+@@ -0,0 +1,11 @@
++function macro=BaseEnum()
++%BASEENUM - Enum of Base
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=BaseEnum()
++
++macro=StringToEnum('Base');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17554)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17555)
+@@ -40,8 +40,8 @@
+ def BasalforcingsGeothermalfluxEnum(): return StringToEnum("BasalforcingsGeothermalflux")[0]
+ def BasalforcingsMeltingRateCorrectionEnum(): return StringToEnum("BasalforcingsMeltingRateCorrection")[0]
+ def BasalforcingsMeltingRateEnum(): return StringToEnum("BasalforcingsMeltingRate")[0]
+-def BathymetryEnum(): return StringToEnum("Bathymetry")[0]
+ def BedEnum(): return StringToEnum("Bed")[0]
++def BaseEnum(): return StringToEnum("Base")[0]
+ def ConstantsGEnum(): return StringToEnum("ConstantsG")[0]
+ def ConstantsReferencetemperatureEnum(): return StringToEnum("ConstantsReferencetemperature")[0]
+ def ConstantsYtsEnum(): return StringToEnum("ConstantsYts")[0]
+@@ -460,7 +460,7 @@
+ def QmuVyEnum(): return StringToEnum("QmuVy")[0]
+ def QmuVzEnum(): return StringToEnum("QmuVz")[0]
+ def QmuThicknessEnum(): return StringToEnum("QmuThickness")[0]
+-def QmuBedEnum(): return StringToEnum("QmuBed")[0]
++def QmuBaseEnum(): return StringToEnum("QmuBase")[0]
+ def QmuSurfaceEnum(): return StringToEnum("QmuSurface")[0]
+ def QmuMeltingEnum(): return StringToEnum("QmuMelting")[0]
+ def QmuVxMeshEnum(): return StringToEnum("QmuVxMesh")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17555-17556.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17555-17556.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17555-17556.diff	(revision 17802)
@@ -0,0 +1,313 @@
+Index: ../trunk-jpl/src/m/classes/mesh3dprisms.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh3dprisms.py	(revision 0)
++++ ../trunk-jpl/src/m/classes/mesh3dprisms.py	(revision 17556)
+@@ -0,0 +1,153 @@
++import numpy
++from fielddisplay import fielddisplay
++from EnumDefinitions import *
++from checkfield import *
++from MatlabFuncs import *
++
++class mesh3dprisms(object):
++	"""
++	MESH3DPRISMS class definition
++
++	   Usage:
++	      mesh3d=mesh3dprisms();
++	"""
++
++	def __init__(self): # {{{
++		self.x                           = float('NaN');
++		self.y                           = float('NaN');
++		self.z                           = float('NaN');
++		self.elements                    = float('NaN');
++		self.dimension                   = 0;
++		self.numberoflayers              = 0;
++		self.numberofelements            = 0;
++		self.numberofvertices            = 0;
++		
++		self.lat                         = float('NaN');
++		self.long                        = float('NaN');
++		self.hemisphere                  = float('NaN');
++
++		self.elementonbed                = float('NaN');
++		self.elementonsurface            = float('NaN');
++		self.vertexonbed                 = float('NaN');
++		self.vertexonsurface             = float('NaN');
++		self.lowerelements               = float('NaN');
++		self.lowervertex                 = float('NaN');
++		self.upperelements               = float('NaN');
++		self.uppervertex                 = float('NaN');
++		self.vertexonboundary            = float('NaN');
++
++		self.vertexconnectivity          = float('NaN');
++		self.elementconnectivity         = float('NaN');
++		self.average_vertex_connectivity = 0;
++
++		self.x2d                         = float('NaN');
++		self.y2d                         = float('NaN');
++		self.elements2d                  = float('NaN');
++		self.numberofvertices2d          = 0;
++		self.numberofelements2d          = 0;
++
++		self.extractedvertices           = float('NaN');
++		self.extractedelements           = float('NaN');
++
++		#set defaults
++		self.setdefaultparameters()
++		#}}}
++	def __repr__(self): # {{{
++		string="   Mesh 3D prisms:" 
++
++		string="%s\n%s"%(string,"\n      Elements and vertices of the original 2d mesh3dprisms:")
++		
++		string="%s\n%s"%(string,fielddisplay(self,"numberofelements2d","number of elements"))
++		string="%s\n%s"%(string,fielddisplay(self,"numberofvertices2d","number of vertices"))
++		string="%s\n%s"%(string,fielddisplay(self,"elements2d","vertex indices of the mesh3dprisms elements"))
++		string="%s\n%s"%(string,fielddisplay(self,"x2d","vertices x coordinate [m]"))
++		string="%s\n%s"%(string,fielddisplay(self,"y2d","vertices y coordinate [m]"))
++
++		string="%s\n%s"%(string,"\n\n      Elements and vertices of the extruded 3d mesh3dprisms:")
++		string="%s\n%s"%(string,fielddisplay(self,"numberofelements","number of elements"))
++		string="%s\n%s"%(string,fielddisplay(self,"numberofvertices","number of vertices"))
++		string="%s\n%s"%(string,fielddisplay(self,"elements","vertex indices of the mesh3dprisms elements"))
++		string="%s\n%s"%(string,fielddisplay(self,"x","vertices x coordinate [m]"))
++		string="%s\n%s"%(string,fielddisplay(self,"y","vertices y coordinate [m]"))
++		string="%s\n%s"%(string,fielddisplay(self,"z","vertices z coordinate [m]"))
++
++		string="%s%s"%(string,"\n\n      Properties:")
++		string="%s\n%s"%(string,fielddisplay(self,"numberoflayers","number of extrusion layers"))
++		string="%s\n%s"%(string,fielddisplay(self,"vertexonbed","lower vertices flags list"))
++		string="%s\n%s"%(string,fielddisplay(self,"elementonbed","lower elements flags list"))
++		string="%s\n%s"%(string,fielddisplay(self,"vertexonsurface","upper vertices flags list"))
++		string="%s\n%s"%(string,fielddisplay(self,"elementonsurface","upper elements flags list"))
++		string="%s\n%s"%(string,fielddisplay(self,"uppervertex","upper vertex list (-1 for vertex on the upper surface)"))
++		string="%s\n%s"%(string,fielddisplay(self,"upperelements","upper element list (-1 for element on the upper layer)"))
++		string="%s\n%s"%(string,fielddisplay(self,"lowervertex","lower vertex list (-1 for vertex on the lower surface)"))
++		string="%s\n%s"%(string,fielddisplay(self,"lowerelements","lower element list (-1 for element on the lower layer)"))
++		string="%s\n%s"%(string,fielddisplay(self,"vertexonboundary","vertices on the boundary of the domain flag list"))
++		string="%s\n%s"%(string,fielddisplay(self,"vertexconnectivity","list of vertices connected to vertex_i"))
++		string="%s\n%s"%(string,fielddisplay(self,"elementconnectivity","list of vertices connected to element_i"))
++		string="%s\n%s"%(string,fielddisplay(self,"average_vertex_connectivity","average number of vertices connected to one vertex"))
++
++		string="%s%s"%(string,"\n\n      Extracted model:")
++		string="%s\n%s"%(string,fielddisplay(self,"extractedvertices","vertices extracted from the model"))
++		string="%s\n%s"%(string,fielddisplay(self,"extractedelements","elements extracted from the model"))
++
++		string="%s%s"%(string,"\n\n      Projection:")
++		string="%s\n%s"%(string,fielddisplay(self,"lat","vertices latitude [degrees]"))
++		string="%s\n%s"%(string,fielddisplay(self,"long","vertices longitude [degrees]"))
++		string="%s\n%s"%(string,fielddisplay(self,"hemisphere","Indicate hemisphere 'n' or 's'"))
++		return string
++		#}}}
++	def setdefaultparameters(self): # {{{
++		
++		#the connectivity is the averaged number of nodes linked to a
++		#given node through an edge. This connectivity is used to initially
++		#allocate memory to the stiffness matrix. A value of 16 seems to
++		#give a good memory/time ration. This value can be checked in
++		#trunk/test/Miscellaneous/runme.m
++		self.average_vertex_connectivity=25
++
++		return self
++	#}}}
++	def checkconsistency(self,md,solution,analyses):    # {{{
++
++		md = checkfield(md,'fieldname','mesh.x','NaN',1,'size',[md.mesh.numberofvertices])
++		md = checkfield(md,'fieldname','mesh.y','NaN',1,'size',[md.mesh.numberofvertices])
++		md = checkfield(md,'fieldname','mesh.z','NaN',1,'size',[md.mesh.numberofvertices])
++		md = checkfield(md,'fieldname','mesh.elements','NaN',1,'>',0,'values',numpy.arange(1,md.mesh.numberofvertices+1))
++		md = checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements,6])
++		if numpy.any(numpy.logical_not(ismember(numpy.arange(1,md.mesh.numberofvertices+1),md.mesh.elements))):
++			md.checkmessage("orphan nodes have been found. Check the mesh3dprisms outline")
++		md = checkfield(md,'fieldname','mesh.numberoflayers','>=',0)
++		md = checkfield(md,'fieldname','mesh.numberofelements','>',0)
++		md = checkfield(md,'fieldname','mesh.numberofvertices','>',0)
++		#no checks for numberofedges lat long and hemisphere
++		md = checkfield(md,'fieldname','mesh.elementonbed','size',[md.mesh.numberofelements],'values',[0,1])
++		md = checkfield(md,'fieldname','mesh.elementonsurface','size',[md.mesh.numberofelements],'values',[0,1])
++		md = checkfield(md,'fieldname','mesh.vertexonbed','size',[md.mesh.numberofvertices],'values',[0,1])
++		md = checkfield(md,'fieldname','mesh.vertexonsurface','size',[md.mesh.numberofvertices],'values',[0,1])
++		md = checkfield(md,'fieldname','mesh.average_vertex_connectivity','>=',24,'message',"'mesh.average_vertex_connectivity' should be at least 24 in 3d")
++
++		return md
++	# }}}
++	def meshtype(self): # {{{
++		return "3D"
++	#}}}
++	def marshall(self,md,fid):    # {{{
++		WriteData(fid,'enum',MeshTypeEnum(),'data',StringToEnum("Mesh"+self.meshtype())[0],'format','Integer');
++		WriteData(fid,'object',self,'class','mesh','fieldname','x','format','DoubleMat','mattype',1)
++		WriteData(fid,'object',self,'class','mesh','fieldname','y','format','DoubleMat','mattype',1)
++		WriteData(fid,'object',self,'class','mesh','fieldname','z','format','DoubleMat','mattype',1)
++		WriteData(fid,'object',self,'class','mesh','fieldname','elements','format','DoubleMat','mattype',2)
++		WriteData(fid,'object',self,'class','mesh','fieldname','numberoflayers','format','Integer')
++		WriteData(fid,'object',self,'class','mesh','fieldname','numberofelements','format','Integer')
++		WriteData(fid,'object',self,'class','mesh','fieldname','numberofvertices','format','Integer')
++		WriteData(fid,'object',self,'class','mesh','fieldname','elementonbed','format','BooleanMat','mattype',2)
++		WriteData(fid,'object',self,'class','mesh','fieldname','elementonsurface','format','BooleanMat','mattype',2)
++		WriteData(fid,'object',self,'class','mesh','fieldname','vertexonbed','format','BooleanMat','mattype',1)
++		WriteData(fid,'object',self,'class','mesh','fieldname','vertexonsurface','format','BooleanMat','mattype',1)
++		WriteData(fid,'object',self,'class','mesh','fieldname','lowerelements','format','DoubleMat','mattype',2)
++		WriteData(fid,'object',self,'class','mesh','fieldname','upperelements','format','DoubleMat','mattype',2)
++		WriteData(fid,'object',self,'class','mesh','fieldname','average_vertex_connectivity','format','Integer')
++		WriteData(fid,'object',self,'class','mesh','fieldname','elements2d','format','DoubleMat','mattype',3)
++		WriteData(fid,'object',self,'class','mesh','fieldname','numberofvertices2d','format','Integer')
++		WriteData(fid,'object',self,'class','mesh','fieldname','numberofelements2d','format','Integer')
++	# }}}
+Index: ../trunk-jpl/src/m/classes/mesh3dprisms.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh3dprisms.m	(revision 0)
++++ ../trunk-jpl/src/m/classes/mesh3dprisms.m	(revision 17556)
+@@ -0,0 +1,150 @@
++%MESH3DPRISMS class definition
++%
++%   Usage:
++%      mesh=mesh3dprisms();
++
++classdef mesh3dprisms
++	properties (SetAccess=public) 
++		x                           = NaN;
++		y                           = NaN;
++		z                           = NaN
++		elements                    = NaN
++		numberoflayers              = 0;
++		numberofelements            = 0;
++		numberofvertices            = 0;
++
++		lat                         = NaN
++		long                        = NaN
++		hemisphere                  = NaN
++
++		elementonbed                = NaN
++		elementonsurface            = NaN
++		vertexonbed                 = NaN
++		vertexonsurface             = NaN
++		lowerelements               = NaN
++		lowervertex                 = NaN
++		upperelements               = NaN
++		uppervertex                 = NaN
++		vertexonboundary            = NaN
++
++		vertexconnectivity          = NaN
++		elementconnectivity         = NaN
++		average_vertex_connectivity = 0;
++
++		x2d                         = NaN
++		y2d                         = NaN
++		elements2d                  = NaN
++		numberofvertices2d          = 0;
++		numberofelements2d          = 0;
++
++		extractedvertices           = NaN
++		extractedelements           = NaN
++	end
++	methods
++		function obj = mesh(varargin) % {{{
++			switch nargin
++				case 0
++					obj=setdefaultparameters(obj);
++				otherwise
++					error('constructor not supported');
++			end
++		end % }}}
++		function obj = setdefaultparameters(obj) % {{{
++
++			%the connectivity is the averaged number of nodes linked to a
++			%given node through an edge. This connectivity is used to initially
++			%allocate memory to the stiffness matrix. A value of 16 seems to
++			%give a good memory/time ration. This value can be checked in
++			%trunk/test/Miscellaneous/runme.m
++			obj.average_vertex_connectivity=25;
++		end % }}}
++		function md = checkconsistency(obj,md,solution,analyses) % {{{
++
++			md = checkfield(md,'fieldname','mesh.x','NaN',1,'size',[md.mesh.numberofvertices 1]);
++			md = checkfield(md,'fieldname','mesh.y','NaN',1,'size',[md.mesh.numberofvertices 1]);
++			md = checkfield(md,'fieldname','mesh.z','NaN',1,'size',[md.mesh.numberofvertices 1]);
++			md = checkfield(md,'fieldname','mesh.elements','NaN',1,'>',0,'values',1:md.mesh.numberofvertices);
++			md = checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements 6]);
++			if any(~ismember(1:md.mesh.numberofvertices,sort(unique(md.mesh.elements(:)))));
++				md = checkmessage(md,'orphan nodes have been found. Check the mesh outline');
++			end
++			md = checkfield(md,'fieldname','mesh.numberoflayers','>=',0);
++			md = checkfield(md,'fieldname','mesh.numberofelements','>',0);
++			md = checkfield(md,'fieldname','mesh.numberofvertices','>',0);
++			%no checks for numberofedges lat long and hemisphere
++			md = checkfield(md,'fieldname','mesh.elementonbed','size',[md.mesh.numberofelements 1],'values',[0 1]);
++			md = checkfield(md,'fieldname','mesh.elementonsurface','size',[md.mesh.numberofelements 1],'values',[0 1]);
++			md = checkfield(md,'fieldname','mesh.vertexonbed','size',[md.mesh.numberofvertices 1],'values',[0 1]);
++			md = checkfield(md,'fieldname','mesh.vertexonsurface','size',[md.mesh.numberofvertices 1],'values',[0 1]);
++			md = checkfield(md,'fieldname','mesh.z','>=',md.geometry.bed-10^-10,'message','''mesh.z'' lower than bedrock');
++			md = checkfield(md,'fieldname','mesh.z','<=',md.geometry.surface+10^-10,'message','''mesh.z'' higher than surface elevation');
++			md = checkfield(md,'fieldname','mesh.average_vertex_connectivity','>=',24,'message','''mesh.average_vertex_connectivity'' should be at least 24 in 3d');
++		end % }}}
++		function disp(obj) % {{{
++			disp(sprintf('   Mesh:')); 
++
++			disp(sprintf('\n      Elements and vertices of the original 2d mesh:'));
++			fielddisplay(obj,'numberofelements2d','number of elements');
++			fielddisplay(obj,'numberofvertices2d','number of vertices');
++			fielddisplay(obj,'elements2d','vertex indices of the mesh elements');
++			fielddisplay(obj,'x2d','vertices x coordinate [m]');
++			fielddisplay(obj,'y2d','vertices y coordinate [m]');
++
++			disp(sprintf('\n      Elements and vertices of the extruded 3d mesh:'));
++			fielddisplay(obj,'numberofelements','number of elements');
++			fielddisplay(obj,'numberofvertices','number of vertices');
++			fielddisplay(obj,'elements','vertex indices of the mesh elements');
++			fielddisplay(obj,'x','vertices x coordinate [m]');
++			fielddisplay(obj,'y','vertices y coordinate [m]');
++			fielddisplay(obj,'z','vertices z coordinate [m]');
++
++			disp(sprintf('\n      Properties:'));
++			fielddisplay(obj,'numberoflayers','number of extrusion layers');
++			fielddisplay(obj,'vertexonbed','lower vertices flags list');
++			fielddisplay(obj,'elementonbed','lower elements flags list');
++			fielddisplay(obj,'vertexonsurface','upper vertices flags list');
++			fielddisplay(obj,'elementonsurface','upper elements flags list');
++			fielddisplay(obj,'uppervertex','upper vertex list (NaN for vertex on the upper surface)');
++			fielddisplay(obj,'upperelements','upper element list (NaN for element on the upper layer)');
++			fielddisplay(obj,'lowervertex','lower vertex list (NaN for vertex on the lower surface)');
++			fielddisplay(obj,'lowerelements','lower element list (NaN for element on the lower layer');
++			fielddisplay(obj,'vertexonboundary','vertices on the boundary of the domain flag list');
++
++			fielddisplay(obj,'vertexconnectivity','list of vertices connected to vertex_i');
++			fielddisplay(obj,'elementconnectivity','list of vertices connected to element_i');
++			fielddisplay(obj,'average_vertex_connectivity','average number of vertices connected to one vertex');
++
++			disp(sprintf('\n      Extracted model:'));
++			fielddisplay(obj,'extractedvertices','vertices extracted from the model');
++			fielddisplay(obj,'extractedelements','elements extracted from the model');
++
++			disp(sprintf('\n      Projection:'));
++			fielddisplay(obj,'lat','vertices latitude [degrees]');
++			fielddisplay(obj,'long','vertices longitude [degrees]');
++			fielddisplay(obj,'hemisphere','Indicate hemisphere ''n'' or ''s'' ');
++		end % }}}
++		function marshall(obj,md,fid) % {{{
++			WriteData(fid,'enum',MeshTypeEnum(),'data',StringToEnum(['Mesh' meshtype(obj)]),'format','Integer');
++			WriteData(fid,'object',obj,'class','mesh','fieldname','x','format','DoubleMat','mattype',1);
++			WriteData(fid,'object',obj,'class','mesh','fieldname','y','format','DoubleMat','mattype',1);
++			WriteData(fid,'object',obj,'class','mesh','fieldname','z','format','DoubleMat','mattype',1);
++			WriteData(fid,'object',obj,'class','mesh','fieldname','elements','format','DoubleMat','mattype',2);
++			WriteData(fid,'object',obj,'class','mesh','fieldname','numberoflayers','format','Integer');
++			WriteData(fid,'object',obj,'class','mesh','fieldname','numberofelements','format','Integer');
++			WriteData(fid,'object',obj,'class','mesh','fieldname','numberofvertices','format','Integer');
++			WriteData(fid,'object',obj,'class','mesh','fieldname','elementonbed','format','BooleanMat','mattype',2);
++			WriteData(fid,'object',obj,'class','mesh','fieldname','elementonsurface','format','BooleanMat','mattype',2);
++			WriteData(fid,'object',obj,'class','mesh','fieldname','vertexonbed','format','BooleanMat','mattype',1);
++			WriteData(fid,'object',obj,'class','mesh','fieldname','vertexonsurface','format','BooleanMat','mattype',1);
++			WriteData(fid,'object',obj,'class','mesh','fieldname','lowerelements','format','DoubleMat','mattype',2);
++			WriteData(fid,'object',obj,'class','mesh','fieldname','upperelements','format','DoubleMat','mattype',2);
++			WriteData(fid,'object',obj,'class','mesh','fieldname','average_vertex_connectivity','format','Integer');
++			WriteData(fid,'object',obj,'class','mesh','fieldname','elements2d','format','DoubleMat','mattype',3);
++			WriteData(fid,'object',obj,'class','mesh','fieldname','numberofvertices2d','format','Integer');
++			WriteData(fid,'object',obj,'class','mesh','fieldname','numberofelements2d','format','Integer');
++		end % }}}
++		function type = meshtype(obj) % {{{
++			type = '3D';
++		end % }}}
++	end
++end
Index: issm/oecreview/Archive/16554-17801/ISSM-17556-17557.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17556-17557.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17556-17557.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/test/NightlyRun/test1108.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1108.m	(revision 17556)
++++ ../trunk-jpl/test/NightlyRun/test1108.m	(revision 17557)
+@@ -37,7 +37,6 @@
+ 
+ 	%Compute the stressbalance
+ 	md.cluster=generic('name',oshostname(),'np',8);
+-	md.verbose=verbose('convergence',true);
+ 	md=solve(md,StressbalanceSolutionEnum());
+ 	md.stressbalance.reltol=NaN;
+ 	md.stressbalance.abstol=NaN;
Index: issm/oecreview/Archive/16554-17801/ISSM-17557-17558.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17557-17558.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17557-17558.diff	(revision 17802)
@@ -0,0 +1,1193 @@
+Index: ../trunk-jpl/src/m/mesh/triangle2dvertical.m
+===================================================================
+--- ../trunk-jpl/src/m/mesh/triangle2dvertical.m	(revision 17557)
++++ ../trunk-jpl/src/m/mesh/triangle2dvertical.m	(revision 17558)
+@@ -45,7 +45,7 @@
+ end
+ 
+ %plug into md
+-md.mesh=mesh2dvertical;
++md.mesh=mesh2dvertical();
+ md.mesh.x=x;
+ md.mesh.z=z;
+ md.mesh.elements=elements;
+Index: ../trunk-jpl/src/m/mesh/meshconvert.py
+===================================================================
+--- ../trunk-jpl/src/m/mesh/meshconvert.py	(revision 17557)
++++ ../trunk-jpl/src/m/mesh/meshconvert.py	(revision 17558)
+@@ -1,6 +1,7 @@
+ import numpy
+ from collections import OrderedDict
+ from BamgConvertMesh import BamgConvertMesh 
++from mesh2d   import mesh2d
+ from bamgmesh import bamgmesh
+ from bamggeom import bamggeom
+ 
+@@ -32,6 +33,7 @@
+ 	md.private.bamg             = OrderedDict()
+ 	md.private.bamg['mesh']     = bamgmesh(bamgmesh_out)
+ 	md.private.bamg['geometry'] = bamggeom(bamggeom_out)
++	md.mesh                     = mesh2d()
+ 	md.mesh.x                   = bamgmesh_out['Vertices'][:,0].copy()
+ 	md.mesh.y                   = bamgmesh_out['Vertices'][:,1].copy()
+ 	md.mesh.elements            = bamgmesh_out['Triangles'][:,0:3].astype(int)
+@@ -40,16 +42,9 @@
+ 	md.mesh.segmentmarkers      = bamgmesh_out['IssmSegments'][:,3].astype(int)
+ 
+ 	#Fill in rest of fields:
+-	md.mesh.dimension          = 2
+ 	md.mesh.numberofelements   = numpy.size(md.mesh.elements,axis=0)
+ 	md.mesh.numberofvertices   = numpy.size(md.mesh.x)
+ 	md.mesh.numberofedges      = numpy.size(md.mesh.edges,axis=0)
+-	md.mesh.z                  = numpy.zeros(md.mesh.numberofvertices)
+-	md.mesh.vertexonbed        = numpy.ones(md.mesh.numberofvertices,bool)
+-	md.mask.vertexonwater      = numpy.zeros(md.mesh.numberofvertices,bool)
+-	md.mesh.vertexonsurface    = numpy.ones(md.mesh.numberofvertices,bool)
+-	md.mesh.elementonbed       = numpy.ones(md.mesh.numberofelements,bool)
+-	md.mesh.elementonsurface   = numpy.ones(md.mesh.numberofelements,bool)
+ 	md.mesh.vertexonboundary   = numpy.zeros(md.mesh.numberofvertices,bool)
+ 	md.mesh.vertexonboundary[md.mesh.segments[:,0:2]-1] = True
+ 
+Index: ../trunk-jpl/src/m/mesh/rifts/meshprocessoutsiderifts.py
+===================================================================
+--- ../trunk-jpl/src/m/mesh/rifts/meshprocessoutsiderifts.py	(revision 17557)
++++ ../trunk-jpl/src/m/mesh/rifts/meshprocessoutsiderifts.py	(revision 17558)
+@@ -79,15 +79,9 @@
+ 	#Fill in rest of fields:
+ 	md.mesh.numberofelements=numpy.size(md.mesh.elements,axis=0)
+ 	md.mesh.numberofvertices=numpy.size(md.mesh.x)
+-	md.mesh.z=numpy.zeros(md.mesh.numberofvertices)
+ 	md.mesh.vertexonboundary=numpy.zeros(numpy.size(md.mesh.x),bool)
+ 	md.mesh.vertexonboundary[md.mesh.segments[:,0:2]-1]=True
+ 	md.rifts.numrifts=length(md.rifts.riftstruct)
+-	md.flowequation.element_equation=3*numpy.ones(md.mesh.numberofelements,int)
+-	md.mesh.vertexonbed=numpy.ones(md.mesh.numberofvertices,bool)
+-	md.mesh.vertexonsurface=numpy.ones(md.mesh.numberofvertices,bool)
+-	md.mesh.elementonbed=numpy.ones(md.mesh.numberofelements,bool)
+-	md.mesh.elementonsurface=numpy.ones(md.mesh.numberofelements,bool)
+ 
+ 	return md
+ 
+Index: ../trunk-jpl/src/m/mesh/rifts/meshaddrifts.m
+===================================================================
+--- ../trunk-jpl/src/m/mesh/rifts/meshaddrifts.m	(revision 17557)
++++ ../trunk-jpl/src/m/mesh/rifts/meshaddrifts.m	(revision 17558)
+@@ -79,14 +79,7 @@
+ 
+ %finish up "a la" mesh.h
+ md.mesh.vertexonboundary=zeros(md.mesh.numberofvertices,1); md.mesh.vertexonboundary(md.mesh.segments(:,1:2))=1;
+-md.mesh.vertexonbed=ones(md.mesh.numberofvertices,1);
+-md.mesh.vertexonsurface=ones(md.mesh.numberofvertices,1);
+-md.mesh.elementonbed=ones(md.mesh.numberofelements,1);
+-md.mesh.elementonsurface=ones(md.mesh.numberofelements,1);
+ 
+ %Now, build the connectivity tables for this mesh.
+ md.mesh.vertexconnectivity=NodeConnectivity(md.mesh.elements,md.mesh.numberofvertices);
+ md.mesh.elementconnectivity=ElementConnectivity(md.mesh.elements,md.mesh.vertexconnectivity);
+-
+-%type of model
+-md.mesh.dimension=2;
+Index: ../trunk-jpl/src/m/mesh/rifts/meshprocessrifts.py
+===================================================================
+--- ../trunk-jpl/src/m/mesh/rifts/meshprocessrifts.py	(revision 17557)
++++ ../trunk-jpl/src/m/mesh/rifts/meshprocessrifts.py	(revision 17558)
+@@ -34,13 +34,8 @@
+ 	numrifts=len(md.rifts.riftstruct)
+ 	md.mesh.numberofelements=numpy.size(md.mesh.elements,axis=0)
+ 	md.mesh.numberofvertices=numpy.size(md.mesh.x)
+-	md.mesh.z=numpy.zeros(md.mesh.numberofvertices)
+ 	md.mesh.vertexonboundary=numpy.zeros(numpy.size(md.mesh.x),bool)
+ 	md.mesh.vertexonboundary[md.mesh.segments[:,0:2]-1]=True
+-	md.mesh.vertexonbed=numpy.ones(md.mesh.numberofvertices,bool)
+-	md.mesh.vertexonsurface=numpy.ones(md.mesh.numberofvertices,bool)
+-	md.mesh.elementonbed=numpy.ones(md.mesh.numberofelements,bool)
+-	md.mesh.elementonsurface=numpy.ones(md.mesh.numberofelements,bool)
+ 
+ 	#get coordinates of rift tips
+ 	for rift in md.rifts.riftstruct:
+Index: ../trunk-jpl/src/m/mesh/rifts/meshprocessoutsiderifts.m
+===================================================================
+--- ../trunk-jpl/src/m/mesh/rifts/meshprocessoutsiderifts.m	(revision 17557)
++++ ../trunk-jpl/src/m/mesh/rifts/meshprocessoutsiderifts.m	(revision 17558)
+@@ -81,13 +81,7 @@
+ %Fill in rest of fields:
+ md.mesh.numberofelements=length(md.mesh.elements);
+ md.mesh.numberofvertices=length(md.mesh.x);
+-md.mesh.z=zeros(md.mesh.numberofvertices,1);
+ md.mesh.vertexonboundary=zeros(length(md.mesh.x),1); md.mesh.vertexonboundary(md.mesh.segments(:,1:2))=1;
+-md.flowequation.element_equation=3*ones(md.mesh.numberofelements,1);
+-md.mesh.vertexonbed=ones(md.mesh.numberofvertices,1);
+-md.mesh.vertexonsurface=ones(md.mesh.numberofvertices,1);
+-md.mesh.elementonbed=ones(md.mesh.numberofelements,1);
+-md.mesh.elementonsurface=ones(md.mesh.numberofelements,1);
+ end
+ 
+ function flag=isconnected(elements,A,B)% {{{
+Index: ../trunk-jpl/src/m/mesh/rifts/meshprocessrifts.m
+===================================================================
+--- ../trunk-jpl/src/m/mesh/rifts/meshprocessrifts.m	(revision 17557)
++++ ../trunk-jpl/src/m/mesh/rifts/meshprocessrifts.m	(revision 17558)
+@@ -33,12 +33,7 @@
+ numrifts=length(md.rifts.riftstruct);
+ md.mesh.numberofelements=length(md.mesh.elements);
+ md.mesh.numberofvertices=length(md.mesh.x);
+-md.mesh.z=zeros(md.mesh.numberofvertices,1);
+ md.mesh.vertexonboundary=zeros(length(md.mesh.x),1); md.mesh.vertexonboundary(md.mesh.segments(:,1:2))=1;
+-md.mesh.vertexonbed=ones(md.mesh.numberofvertices,1);
+-md.mesh.vertexonsurface=ones(md.mesh.numberofvertices,1);
+-md.mesh.elementonbed=ones(md.mesh.numberofelements,1);
+-md.mesh.elementonsurface=ones(md.mesh.numberofelements,1);
+ 
+ %get coordinates of rift tips
+ for i=1:numrifts,
+Index: ../trunk-jpl/src/m/mesh/meshconvert.m
+===================================================================
+--- ../trunk-jpl/src/m/mesh/meshconvert.m	(revision 17557)
++++ ../trunk-jpl/src/m/mesh/meshconvert.m	(revision 17558)
+@@ -35,13 +35,7 @@
+ md.mesh.segmentmarkers = bamgmesh_out.IssmSegments(:,4);
+ 
+ %Fill in rest of fields:
+-md.mesh.dimension        = 2;
+ md.mesh.numberofelements = size(md.mesh.elements,1);
+ md.mesh.numberofvertices = length(md.mesh.x);
+ md.mesh.numberofedges    = size(md.mesh.edges,1);
+-md.mesh.z                = zeros(md.mesh.numberofvertices,1);
+-md.mesh.vertexonbed      = ones(md.mesh.numberofvertices,1);
+-md.mesh.vertexonsurface  = ones(md.mesh.numberofvertices,1);
+-md.mesh.elementonbed     = ones(md.mesh.numberofelements,1);
+-md.mesh.elementonsurface = ones(md.mesh.numberofelements,1);
+ md.mesh.vertexonboundary = zeros(md.mesh.numberofvertices,1); md.mesh.vertexonboundary(md.mesh.segments(:,1:2)) = 1;
+Index: ../trunk-jpl/src/m/mesh/argusmesh.m
+===================================================================
+--- ../trunk-jpl/src/m/mesh/argusmesh.m	(revision 17557)
++++ ../trunk-jpl/src/m/mesh/argusmesh.m	(revision 17558)
+@@ -76,17 +76,12 @@
+ name=root;
+ 
+ %Finally, use model constructor to build a complete model: 
++md.mesh=mesh2d();
+ md.mesh.elements=elements;
+ md.mesh.x=x;
+ md.mesh.y=y;
+-md.z=z;
+ md.mesh.numberofvertices=size(md.mesh.x,1);
+ md.mesh.numberofelements=size(md.mesh.elements,1);
+-md.mesh.vertexonbed=ones(md.mesh.numberofvertices,1);
+-md.mesh.vertexonsurface=ones(md.mesh.numberofvertices,1);
+-md.mesh.elementonbed=ones(md.mesh.numberofelements,1);
+-md.mesh.elementonsurface=ones(md.mesh.numberofelements,1);
+-md.mesh.dimension=2;
+ md=addnote(md,notes);
+ 
+ %Add segments and nodes on boundary
+Index: ../trunk-jpl/src/m/mesh/triangle.py
+===================================================================
+--- ../trunk-jpl/src/m/mesh/triangle.py	(revision 17557)
++++ ../trunk-jpl/src/m/mesh/triangle.py	(revision 17558)
+@@ -1,4 +1,5 @@
+ import numpy
++from mesh2d import mesh2d
+ from TriMesh import TriMesh
+ from NodeConnectivity import NodeConnectivity
+ from ElementConnectivity import ElementConnectivity
+@@ -42,6 +43,7 @@
+ 	area = resolution**2
+ 
+ 	#Mesh using TriMesh
++	md.mesh=mesh2d()
+ 	[md.mesh.elements,md.mesh.x,md.mesh.y,md.mesh.segments,md.mesh.segmentmarkers]=TriMesh(domainname,riftname,area)
+ 	md.mesh.elements=md.mesh.elements.astype(int)
+ 	md.mesh.segments=md.mesh.segments.astype(int)
+@@ -50,20 +52,11 @@
+ 	#Fill in rest of fields:
+ 	md.mesh.numberofelements = numpy.size(md.mesh.elements,axis=0)
+ 	md.mesh.numberofvertices = numpy.size(md.mesh.x)
+-	md.mesh.z = numpy.zeros(md.mesh.numberofvertices)
+ 	md.mesh.vertexonboundary = numpy.zeros(md.mesh.numberofvertices,bool)
+ 	md.mesh.vertexonboundary[md.mesh.segments[:,0:2]-1] = True
+-	md.mesh.vertexonbed = numpy.ones(md.mesh.numberofvertices,bool)
+-	md.mesh.vertexonsurface = numpy.ones(md.mesh.numberofvertices,bool)
+-	md.mesh.elementonbed = numpy.ones(md.mesh.numberofelements,bool)
+-	md.mesh.elementonsurface = numpy.ones(md.mesh.numberofelements,bool)
+ 
+ 	#Now, build the connectivity tables for this mesh.
+ 	[md.mesh.vertexconnectivity] = NodeConnectivity(md.mesh.elements, md.mesh.numberofvertices)
+ 	[md.mesh.elementconnectivity] = ElementConnectivity(md.mesh.elements, md.mesh.vertexconnectivity)
+ 
+-	#type of model
+-	md.mesh.dimension = 2.
+-
+ 	return md
+-
+Index: ../trunk-jpl/src/m/mesh/bamg.py
+===================================================================
+--- ../trunk-jpl/src/m/mesh/bamg.py	(revision 17557)
++++ ../trunk-jpl/src/m/mesh/bamg.py	(revision 17558)
+@@ -1,5 +1,6 @@
+ import os.path
+ import numpy
++from mesh2d import mesh2d
+ from collections import OrderedDict
+ from pairoptions import pairoptions
+ from bamggeom import bamggeom
+@@ -319,6 +320,7 @@
+ 	md.private.bamg=OrderedDict()
+ 	md.private.bamg['mesh']=bamgmesh(bamgmesh_out)
+ 	md.private.bamg['geometry']=bamggeom(bamggeom_out)
++	md.mesh = mesh2d()
+ 	md.mesh.x=bamgmesh_out['Vertices'][:,0].copy()
+ 	md.mesh.y=bamgmesh_out['Vertices'][:,1].copy()
+ 	md.mesh.elements=bamgmesh_out['Triangles'][:,0:3].astype(int)
+@@ -327,15 +329,9 @@
+ 	md.mesh.segmentmarkers=bamgmesh_out['IssmSegments'][:,3].astype(int)
+ 
+ 	#Fill in rest of fields:
+-	md.mesh.dimension=2
+ 	md.mesh.numberofelements=numpy.size(md.mesh.elements,axis=0)
+ 	md.mesh.numberofvertices=numpy.size(md.mesh.x)
+ 	md.mesh.numberofedges=numpy.size(md.mesh.edges,axis=0)
+-	md.mesh.z=numpy.zeros(md.mesh.numberofvertices)
+-	md.mesh.vertexonbed=numpy.ones(md.mesh.numberofvertices,bool)
+-	md.mesh.vertexonsurface=numpy.ones(md.mesh.numberofvertices,bool)
+-	md.mesh.elementonbed=numpy.ones(md.mesh.numberofelements,bool)
+-	md.mesh.elementonsurface=numpy.ones(md.mesh.numberofelements,bool)
+ 	md.mesh.vertexonboundary=numpy.zeros(md.mesh.numberofvertices,bool)
+ 	md.mesh.vertexonboundary[md.mesh.segments[:,0:2]-1]=True
+ 	md.mesh.elementconnectivity=md.private.bamg['mesh'].ElementConnectivity
+Index: ../trunk-jpl/src/m/mesh/triangle.m
+===================================================================
+--- ../trunk-jpl/src/m/mesh/triangle.m	(revision 17557)
++++ ../trunk-jpl/src/m/mesh/triangle.m	(revision 17558)
+@@ -58,6 +58,7 @@
+ end
+ 
+ %plug into md
++md.mesh=mesh2d();
+ md.mesh.x=x;
+ md.mesh.y=y;
+ md.mesh.elements=elements;
+@@ -67,16 +68,8 @@
+ %Fill in rest of fields:
+ md.mesh.numberofelements=size(md.mesh.elements,1);
+ md.mesh.numberofvertices=length(md.mesh.x);
+-md.mesh.z=zeros(md.mesh.numberofvertices,1);
+ md.mesh.vertexonboundary=zeros(md.mesh.numberofvertices,1); md.mesh.vertexonboundary(md.mesh.segments(:,1:2))=1;
+-md.mesh.vertexonbed=ones(md.mesh.numberofvertices,1);
+-md.mesh.vertexonsurface=ones(md.mesh.numberofvertices,1);
+-md.mesh.elementonbed=ones(md.mesh.numberofelements,1);
+-md.mesh.elementonsurface=ones(md.mesh.numberofelements,1);
+ 
+ %Now, build the connectivity tables for this mesh.
+ md.mesh.vertexconnectivity=NodeConnectivity(md.mesh.elements,md.mesh.numberofvertices);
+ md.mesh.elementconnectivity=ElementConnectivity(md.mesh.elements,md.mesh.vertexconnectivity);
+-
+-%type of model
+-md.mesh.dimension=2;
+Index: ../trunk-jpl/src/m/mesh/bamg.m
+===================================================================
+--- ../trunk-jpl/src/m/mesh/bamg.m	(revision 17557)
++++ ../trunk-jpl/src/m/mesh/bamg.m	(revision 17558)
+@@ -332,7 +332,7 @@
+ [bamgmesh_out bamggeom_out]=BamgMesher(bamg_mesh,bamg_geometry,bamg_options);
+ 
+ if getfieldvalue(options,'vertical',0),
+-	md.mesh=mesh2dvertical;
++	md.mesh=mesh2dvertical();
+ 	md.mesh.x=bamgmesh_out.Vertices(:,1);
+ 	md.mesh.y=bamgmesh_out.Vertices(:,2);
+ 	md.mesh.elements=bamgmesh_out.Triangles(:,1:3);
+@@ -349,7 +349,7 @@
+ 	%Now, build the connectivity tables for this mesh.
+ 	md.mesh.vertexonboundary=zeros(md.mesh.numberofvertices,1); md.mesh.vertexonboundary(md.mesh.segments(:,1:2))=1;
+ else
+-	% plug results onto model
++	md.mesh=mesh2d();
+ 	md.mesh.x=bamgmesh_out.Vertices(:,1);
+ 	md.mesh.y=bamgmesh_out.Vertices(:,2);
+ 	md.mesh.elements=bamgmesh_out.Triangles(:,1:3);
+@@ -358,24 +358,19 @@
+ 	md.mesh.segmentmarkers=bamgmesh_out.IssmSegments(:,4);
+ 
+ 	%Fill in rest of fields:
+-	md.mesh.dimension=2;
+ 	md.mesh.numberofelements=size(md.mesh.elements,1);
+ 	md.mesh.numberofvertices=length(md.mesh.x);
+ 	md.mesh.numberofedges=size(md.mesh.edges,1);
+-	md.mesh.z=zeros(md.mesh.numberofvertices,1);
+-	md.mesh.vertexonbed=ones(md.mesh.numberofvertices,1);
+-	md.mesh.vertexonsurface=ones(md.mesh.numberofvertices,1);
+-	md.mesh.elementonbed=ones(md.mesh.numberofelements,1);
+-	md.mesh.elementonsurface=ones(md.mesh.numberofelements,1);
+ 	md.mesh.vertexonboundary=zeros(md.mesh.numberofvertices,1); md.mesh.vertexonboundary(md.mesh.segments(:,1:2))=1;
+ end
++
++%Bamg private fields
+ md.private.bamg=struct();
+ md.private.bamg.mesh=bamgmesh(bamgmesh_out);
+ md.private.bamg.geometry=bamggeom(bamggeom_out);
+ md.mesh.elementconnectivity=md.private.bamg.mesh.ElementConnectivity;
+ md.mesh.elementconnectivity(find(isnan(md.mesh.elementconnectivity)))=0;
+ 
+-
+ %Check for orphan
+ if any(~ismember(1:md.mesh.numberofvertices,sort(unique(reshape(md.mesh.elements,3*md.mesh.numberofelements,1)))))
+ 	error('Output mesh has orphans. Decrease MaxCornerAngle to prevent outside points (ex: 0.01)');
+Index: ../trunk-jpl/src/m/mesh/squaremesh.py
+===================================================================
+--- ../trunk-jpl/src/m/mesh/squaremesh.py	(revision 17557)
++++ ../trunk-jpl/src/m/mesh/squaremesh.py	(revision 17558)
+@@ -56,28 +56,20 @@
+ 	segments[2*(ny-1)+(nx-1):2*(nx-1)+2*(ny-1),:]=numpy.hstack((numpy.arange(1,(nx-2)*ny+2,ny).reshape(-1,1),numpy.arange(ny+1,ny*(nx-1)+2,ny).reshape(-1,1),numpy.arange(1,2*(nx-2)*(ny-1)+2,2*(ny-1)).reshape(-1,1)))
+ 
+ 	#plug coordinates and nodes
++	md.mesh=mesh2d()
+ 	md.mesh.x=x
+ 	md.mesh.y=y
+-	md.mesh.z=numpy.zeros((nods))
+ 	md.mesh.numberofvertices=nods
+ 	md.mesh.vertexonboundary=numpy.zeros((nods),bool)
+ 	md.mesh.vertexonboundary[segments[:,0:2]-1]=True
+-	md.mesh.vertexonbed=numpy.ones((nods),bool)
+-	md.mesh.vertexonsurface=numpy.ones((nods),bool)
+ 
+ 	#plug elements
+ 	md.mesh.elements=index
+ 	md.mesh.segments=segments
+ 	md.mesh.numberofelements=nel
+-	md.mesh.elementonbed=numpy.ones((nel),bool)
+-	md.mesh.elementonsurface=numpy.ones((nel),bool)
+ 
+ 	#Now, build the connectivity tables for this mesh.
+ 	[md.mesh.vertexconnectivity]=NodeConnectivity(md.mesh.elements,md.mesh.numberofvertices)
+ 	[md.mesh.elementconnectivity]=ElementConnectivity(md.mesh.elements,md.mesh.vertexconnectivity)
+ 
+-	#plug other field
+-	md.mesh.dimension=2
+-
+ 	return md
+-
+Index: ../trunk-jpl/src/m/mesh/squaremesh.m
+===================================================================
+--- ../trunk-jpl/src/m/mesh/squaremesh.m	(revision 17557)
++++ ../trunk-jpl/src/m/mesh/squaremesh.m	(revision 17558)
+@@ -54,24 +54,17 @@
+ segments(2*(ny-1)+(nx-1)+1:2*(nx-1)+2*(ny-1),:)=[[1:ny:(nx-2)*ny+1]' [ny+1:ny:ny*(nx-1)+1]' [1:2*(ny-1):2*(nx-2)*(ny-1)+1]'];
+ 
+ %plug coordinates and nodes
++md.mesh=mesh2d();
+ md.mesh.x=x;
+ md.mesh.y=y;
+-md.mesh.z=zeros(nods,1);
+ md.mesh.numberofvertices=nods;
+ md.mesh.vertexonboundary=zeros(nods,1);md.mesh.vertexonboundary(segments(:,1:2))=1;
+-md.mesh.vertexonbed=ones(nods,1);
+-md.mesh.vertexonsurface=ones(nods,1);
+ 
+ %plug elements
+ md.mesh.elements=index;
+ md.mesh.segments=segments;
+ md.mesh.numberofelements=nel;
+-md.mesh.elementonbed=ones(nel,1);
+-md.mesh.elementonsurface=ones(nel,1);
+ 
+ %Now, build the connectivity tables for this mesh.
+ md.mesh.vertexconnectivity=NodeConnectivity(md.mesh.elements,md.mesh.numberofvertices);
+ md.mesh.elementconnectivity=ElementConnectivity(md.mesh.elements,md.mesh.vertexconnectivity);
+-
+-%plug other field
+-md.mesh.dimension=2;
+Index: ../trunk-jpl/src/m/classes/mesh.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh.py	(revision 17557)
++++ ../trunk-jpl/src/m/classes/mesh.py	(revision 17558)
+@@ -1,191 +0,0 @@
+-import numpy
+-from fielddisplay import fielddisplay
+-from EnumDefinitions import *
+-from checkfield import checkfield
+-import MatlabFuncs as m
+-from WriteData import WriteData
+-
+-class mesh(object):
+-	"""
+-	MESH class definition
+-
+-	   Usage:
+-	      mesh=mesh();
+-	"""
+-
+-	def __init__(self): # {{{
+-		self.x                           = float('NaN');
+-		self.y                           = float('NaN');
+-		self.z                           = float('NaN');
+-		self.elements                    = float('NaN');
+-		self.dimension                   = 0;
+-		self.numberoflayers              = 0;
+-		self.numberofelements            = 0;
+-		self.numberofvertices            = 0;
+-		self.numberofedges               = 0;
+-		
+-		self.lat                         = float('NaN');
+-		self.long                        = float('NaN');
+-		self.hemisphere                  = float('NaN');
+-
+-		self.elementonbed                = float('NaN');
+-		self.elementonsurface            = float('NaN');
+-		self.vertexonbed                 = float('NaN');
+-		self.vertexonsurface             = float('NaN');
+-		self.lowerelements               = float('NaN');
+-		self.lowervertex                 = float('NaN');
+-		self.upperelements               = float('NaN');
+-		self.uppervertex                 = float('NaN');
+-		self.vertexonboundary            = float('NaN');
+-
+-		self.edges                       = float('NaN');
+-		self.segments                    = float('NaN');
+-		self.segmentmarkers              = float('NaN');
+-		self.vertexconnectivity          = float('NaN');
+-		self.elementconnectivity         = float('NaN');
+-		self.average_vertex_connectivity = 0;
+-
+-		self.x2d                         = float('NaN');
+-		self.y2d                         = float('NaN');
+-		self.elements2d                  = float('NaN');
+-		self.numberofvertices2d          = 0;
+-		self.numberofelements2d          = 0;
+-
+-		self.extractedvertices           = float('NaN');
+-		self.extractedelements           = float('NaN');
+-
+-		#set defaults
+-		self.setdefaultparameters()
+-		#}}}
+-	def __repr__(self): # {{{
+-		string="   Mesh:" 
+-
+-
+-		if self.dimension==3:
+-			string="%s\n%s"%(string,"\n      Elements and vertices of the original 2d mesh:")
+-			
+-			string="%s\n%s"%(string,fielddisplay(self,"numberofelements2d","number of elements"))
+-			string="%s\n%s"%(string,fielddisplay(self,"numberofvertices2d","number of vertices"))
+-			string="%s\n%s"%(string,fielddisplay(self,"elements2d","vertex indices of the mesh elements"))
+-			string="%s\n%s"%(string,fielddisplay(self,"x2d","vertices x coordinate [m]"))
+-			string="%s\n%s"%(string,fielddisplay(self,"y2d","vertices y coordinate [m]"))
+-
+-			string="%s\n%s"%(string,"\n\n      Elements and vertices of the extruded 3d mesh:")
+-		else:
+-			string="%s\n%s"%(string,"\n      Elements and vertices:")
+-		string="%s\n%s"%(string,fielddisplay(self,"numberofelements","number of elements"))
+-		string="%s\n%s"%(string,fielddisplay(self,"numberofvertices","number of vertices"))
+-		string="%s\n%s"%(string,fielddisplay(self,"elements","vertex indices of the mesh elements"))
+-		string="%s\n%s"%(string,fielddisplay(self,"x","vertices x coordinate [m]"))
+-		string="%s\n%s"%(string,fielddisplay(self,"y","vertices y coordinate [m]"))
+-		string="%s\n%s"%(string,fielddisplay(self,"z","vertices z coordinate [m]"))
+-		string="%s\n%s"%(string,fielddisplay(self,"edges","edges of the 2d mesh (vertex1 vertex2 element1 element2)"))
+-		string="%s\n%s"%(string,fielddisplay(self,"numberofedges","number of edges of the 2d mesh"))
+-
+-		string="%s%s"%(string,"\n\n      Properties:")
+-		string="%s\n%s"%(string,fielddisplay(self,"dimension","mesh dimension (2d or 3d)"))
+-		string="%s\n%s"%(string,fielddisplay(self,"numberoflayers","number of extrusion layers"))
+-		string="%s\n%s"%(string,fielddisplay(self,"vertexonbed","lower vertices flags list"))
+-		string="%s\n%s"%(string,fielddisplay(self,"elementonbed","lower elements flags list"))
+-		string="%s\n%s"%(string,fielddisplay(self,"vertexonsurface","upper vertices flags list"))
+-		string="%s\n%s"%(string,fielddisplay(self,"elementonsurface","upper elements flags list"))
+-		string="%s\n%s"%(string,fielddisplay(self,"uppervertex","upper vertex list (-1 for vertex on the upper surface)"))
+-		string="%s\n%s"%(string,fielddisplay(self,"upperelements","upper element list (-1 for element on the upper layer)"))
+-		string="%s\n%s"%(string,fielddisplay(self,"lowervertex","lower vertex list (-1 for vertex on the lower surface)"))
+-		string="%s\n%s"%(string,fielddisplay(self,"lowerelements","lower element list (-1 for element on the lower layer)"))
+-		string="%s\n%s"%(string,fielddisplay(self,"vertexonboundary","vertices on the boundary of the domain flag list"))
+-		string="%s\n%s"%(string,fielddisplay(self,"segments","edges on domain boundary (vertex1 vertex2 element)"))
+-		string="%s\n%s"%(string,fielddisplay(self,"segmentmarkers","number associated to each segment"))
+-		string="%s\n%s"%(string,fielddisplay(self,"vertexconnectivity","list of vertices connected to vertex_i"))
+-		string="%s\n%s"%(string,fielddisplay(self,"elementconnectivity","list of vertices connected to element_i"))
+-		string="%s\n%s"%(string,fielddisplay(self,"average_vertex_connectivity","average number of vertices connected to one vertex"))
+-
+-		string="%s%s"%(string,"\n\n      Extracted model:")
+-		string="%s\n%s"%(string,fielddisplay(self,"extractedvertices","vertices extracted from the model"))
+-		string="%s\n%s"%(string,fielddisplay(self,"extractedelements","elements extracted from the model"))
+-
+-		string="%s%s"%(string,"\n\n      Projection:")
+-		string="%s\n%s"%(string,fielddisplay(self,"lat","vertices latitude [degrees]"))
+-		string="%s\n%s"%(string,fielddisplay(self,"long","vertices longitude [degrees]"))
+-		string="%s\n%s"%(string,fielddisplay(self,"hemisphere","Indicate hemisphere 'n' or 's'"))
+-		return string
+-		#}}}
+-	def setdefaultparameters(self): # {{{
+-		
+-		#the connectivity is the averaged number of nodes linked to a
+-		#given node through an edge. This connectivity is used to initially
+-		#allocate memory to the stiffness matrix. A value of 16 seems to
+-		#give a good memory/time ration. This value can be checked in
+-		#trunk/test/Miscellaneous/runme.m
+-		self.average_vertex_connectivity=25
+-
+-		return self
+-	#}}}
+-	def checkconsistency(self,md,solution,analyses):    # {{{
+-
+-		md = checkfield(md,'fieldname','mesh.x','NaN',1,'size',[md.mesh.numberofvertices])
+-		md = checkfield(md,'fieldname','mesh.y','NaN',1,'size',[md.mesh.numberofvertices])
+-		md = checkfield(md,'fieldname','mesh.z','NaN',1,'size',[md.mesh.numberofvertices])
+-		md = checkfield(md,'fieldname','mesh.elements','NaN',1,'>',0,'values',numpy.arange(1,md.mesh.numberofvertices+1))
+-		if md.mesh.dimension==2:
+-			md = checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements,3])
+-		else:
+-			md = checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements,6])
+-		if numpy.any(numpy.logical_not(m.ismember(numpy.arange(1,md.mesh.numberofvertices+1),md.mesh.elements))):
+-			md.checkmessage("orphan nodes have been found. Check the mesh outline")
+-		md = checkfield(md,'fieldname','mesh.dimension','values',[2,3])
+-		md = checkfield(md,'fieldname','mesh.numberoflayers','>=',0)
+-		md = checkfield(md,'fieldname','mesh.numberofelements','>',0)
+-		md = checkfield(md,'fieldname','mesh.numberofvertices','>',0)
+-		#no checks for numberofedges lat long and hemisphere
+-		md = checkfield(md,'fieldname','mesh.elementonbed','size',[md.mesh.numberofelements],'values',[0,1])
+-		md = checkfield(md,'fieldname','mesh.elementonsurface','size',[md.mesh.numberofelements],'values',[0,1])
+-		md = checkfield(md,'fieldname','mesh.vertexonbed','size',[md.mesh.numberofvertices],'values',[0,1])
+-		md = checkfield(md,'fieldname','mesh.vertexonsurface','size',[md.mesh.numberofvertices],'values',[0,1])
+-		if md.mesh.dimension==2:
+-			md = checkfield(md,'fieldname','mesh.average_vertex_connectivity','>=',9,'message',"'mesh.average_vertex_connectivity' should be at least 9 in 2d")
+-		else:
+-			md = checkfield(md,'fieldname','mesh.average_vertex_connectivity','>=',24,'message',"'mesh.average_vertex_connectivity' should be at least 24 in 3d")
+-
+-		#Solution specific checks
+-		if   solution==MasstransportSolutionEnum():
+-			if md.masstransport.stabilization==3:
+-				md = checkfield(md,'fieldname','mesh.dimension','values',2,'message',"Discontinuous Galerkin only supported for 2d meshes")
+-		elif solution==BalancethicknessSolutionEnum():
+-			if md.balancethickness.stabilization==3:
+-				md = checkfield(md,'fieldname','mesh.dimension','values',2,'message',"Discontinuous Galerkin only supported for 2d meshes")
+-		elif solution==TransientSolutionEnum():
+-			if md.transient.ismasstransport and md.masstransport.stabilization==3:
+-				md = checkfield(md,'fieldname','mesh.dimension','values',2,'message',"Discontinuous Galerkin only supported for 2d meshes")
+-		elif solution==ThermalSolutionEnum():
+-			md = checkfield(md,'fieldname','mesh.dimension','values',3,'message','thermal solution only supported on 3d meshes')
+-
+-		return md
+-	# }}}
+-	def meshtype(self): # {{{
+-
+-		if self.dimension==2:
+-			return "2Dhorizontal"
+-		else:
+-			return "3D"
+-	#}}}
+-	def marshall(self,md,fid):    # {{{
+-		WriteData(fid,'enum',MeshTypeEnum(),'data',StringToEnum("Mesh"+self.meshtype())[0],'format','Integer');
+-		WriteData(fid,'object',self,'fieldname','x','format','DoubleMat','mattype',1)
+-		WriteData(fid,'object',self,'fieldname','y','format','DoubleMat','mattype',1)
+-		WriteData(fid,'object',self,'fieldname','z','format','DoubleMat','mattype',1)
+-		WriteData(fid,'object',self,'fieldname','elements','format','DoubleMat','mattype',2)
+-		WriteData(fid,'object',self,'fieldname','numberoflayers','format','Integer')
+-		WriteData(fid,'object',self,'fieldname','numberofelements','format','Integer')
+-		WriteData(fid,'object',self,'fieldname','numberofvertices','format','Integer')
+-		WriteData(fid,'object',self,'fieldname','elementonbed','format','BooleanMat','mattype',2)
+-		WriteData(fid,'object',self,'fieldname','elementonsurface','format','BooleanMat','mattype',2)
+-		WriteData(fid,'object',self,'fieldname','vertexonbed','format','BooleanMat','mattype',1)
+-		WriteData(fid,'object',self,'fieldname','vertexonsurface','format','BooleanMat','mattype',1)
+-		WriteData(fid,'object',self,'fieldname','lowerelements','format','DoubleMat','mattype',2)
+-		WriteData(fid,'object',self,'fieldname','upperelements','format','DoubleMat','mattype',2)
+-		WriteData(fid,'object',self,'fieldname','average_vertex_connectivity','format','Integer')
+-		WriteData(fid,'object',self,'fieldname','elements2d','format','DoubleMat','mattype',3)
+-		WriteData(fid,'object',self,'fieldname','numberofvertices2d','format','Integer')
+-		WriteData(fid,'object',self,'fieldname','numberofelements2d','format','Integer')
+-	# }}}
+Index: ../trunk-jpl/src/m/classes/mesh.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh.m	(revision 17557)
++++ ../trunk-jpl/src/m/classes/mesh.m	(revision 17558)
+@@ -1,210 +0,0 @@
+-%MESH class definition
+-%
+-%   Usage:
+-%      mesh=mesh();
+-
+-classdef mesh
+-	properties (SetAccess=public) 
+-		x                           = NaN;
+-		y                           = NaN;
+-		z                           = NaN
+-		elements                    = NaN
+-		dimension                   = 0;
+-		numberoflayers              = 0;
+-		numberofelements            = 0;
+-		numberofvertices            = 0;
+-		numberofedges               = 0;
+-
+-		lat                         = NaN
+-		long                        = NaN
+-		hemisphere                  = NaN
+-
+-		elementonbed                = NaN
+-		elementonsurface            = NaN
+-		vertexonbed                 = NaN
+-		vertexonsurface             = NaN
+-		lowerelements               = NaN
+-		lowervertex                 = NaN
+-		upperelements               = NaN
+-		uppervertex                 = NaN
+-		vertexonboundary            = NaN
+-
+-		edges                       = NaN
+-		segments                    = NaN
+-		segmentmarkers              = NaN
+-		vertexconnectivity          = NaN
+-		elementconnectivity         = NaN
+-		average_vertex_connectivity = 0;
+-
+-		x2d                         = NaN
+-		y2d                         = NaN
+-		elements2d                  = NaN
+-		numberofvertices2d          = 0;
+-		numberofelements2d          = 0;
+-
+-		extractedvertices           = NaN
+-		extractedelements           = NaN
+-	end
+-	methods (Static)
+-		function obj = loadobj(obj) % {{{
+-			% This function is directly called by matlab when a model object is
+-			% loaded. Update old properties here
+-
+-			%2012 June 28th
+-			if numel(obj.edges)>1 & any(isnan(obj.edges(:)))
+-				disp('Update model edges from previous version');
+-				obj.edges(isnan(obj.edges))=-1;
+-			end
+-
+-		end% }}}
+-	end
+-	methods
+-		function obj = mesh(varargin) % {{{
+-			switch nargin
+-				case 0
+-					obj=setdefaultparameters(obj);
+-				otherwise
+-					error('constructor not supported');
+-			end
+-		end % }}}
+-		function obj = setdefaultparameters(obj) % {{{
+-
+-			%the connectivity is the averaged number of nodes linked to a
+-			%given node through an edge. This connectivity is used to initially
+-			%allocate memory to the stiffness matrix. A value of 16 seems to
+-			%give a good memory/time ration. This value can be checked in
+-			%trunk/test/Miscellaneous/runme.m
+-			obj.average_vertex_connectivity=25;
+-		end % }}}
+-		function md = checkconsistency(obj,md,solution,analyses) % {{{
+-
+-			md = checkfield(md,'fieldname','mesh.x','NaN',1,'size',[md.mesh.numberofvertices 1]);
+-			md = checkfield(md,'fieldname','mesh.y','NaN',1,'size',[md.mesh.numberofvertices 1]);
+-			md = checkfield(md,'fieldname','mesh.z','NaN',1,'size',[md.mesh.numberofvertices 1]);
+-			md = checkfield(md,'fieldname','mesh.elements','NaN',1,'>',0,'values',1:md.mesh.numberofvertices);
+-			if(md.mesh.dimension==2),
+-				md = checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements 3]);
+-			else
+-				md = checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements 6]);
+-			end
+-			if any(~ismember(1:md.mesh.numberofvertices,sort(unique(md.mesh.elements(:)))));
+-				md = checkmessage(md,'orphan nodes have been found. Check the mesh outline');
+-			end
+-			md = checkfield(md,'fieldname','mesh.dimension','values',[2 3]);
+-			md = checkfield(md,'fieldname','mesh.numberoflayers','>=',0);
+-			md = checkfield(md,'fieldname','mesh.numberofelements','>',0);
+-			md = checkfield(md,'fieldname','mesh.numberofvertices','>',0);
+-			%no checks for numberofedges lat long and hemisphere
+-			md = checkfield(md,'fieldname','mesh.elementonbed','size',[md.mesh.numberofelements 1],'values',[0 1]);
+-			md = checkfield(md,'fieldname','mesh.elementonsurface','size',[md.mesh.numberofelements 1],'values',[0 1]);
+-			md = checkfield(md,'fieldname','mesh.vertexonbed','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+-			md = checkfield(md,'fieldname','mesh.vertexonsurface','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+-			if (md.mesh.dimension==3),
+-				md = checkfield(md,'fieldname','mesh.z','>=',md.geometry.bed-10^-10,'message','''mesh.z'' lower than bedrock');
+-				md = checkfield(md,'fieldname','mesh.z','<=',md.geometry.surface+10^-10,'message','''mesh.z'' higher than surface elevation');
+-			end
+-			if (md.mesh.dimension==2),
+-				md = checkfield(md,'fieldname','mesh.average_vertex_connectivity','>=',9,'message','''mesh.average_vertex_connectivity'' should be at least 9 in 2d');
+-			else
+-				md = checkfield(md,'fieldname','mesh.average_vertex_connectivity','>=',24,'message','''mesh.average_vertex_connectivity'' should be at least 24 in 3d');
+-			end
+-
+-			%Solution specific checks
+-			switch(solution),
+-				case MasstransportSolutionEnum(),
+-					if md.masstransport.stabilization==3,
+-						md = checkfield(md,'fieldname','mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes');
+-					end
+-				case BalancethicknessSolutionEnum(),
+-					if md.balancethickness.stabilization==3,
+-						md = checkfield(md,'fieldname','mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes');
+-					end
+-				case TransientSolutionEnum(),
+-					if md.transient.ismasstransport & md.masstransport.stabilization==3,
+-						md = checkfield(md,'fieldname','mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes');
+-					end
+-				case ThermalSolutionEnum(),
+-					md = checkfield(md,'fieldname','mesh.dimension','values',3,'message','thermal solution only supported on 3d meshes');
+-			end
+-		end % }}}
+-		function disp(obj) % {{{
+-			disp(sprintf('   Mesh:')); 
+-
+-			if obj.dimension==3,
+-				disp(sprintf('\n      Elements and vertices of the original 2d mesh:'));
+-				fielddisplay(obj,'numberofelements2d','number of elements');
+-				fielddisplay(obj,'numberofvertices2d','number of vertices');
+-				fielddisplay(obj,'elements2d','vertex indices of the mesh elements');
+-				fielddisplay(obj,'x2d','vertices x coordinate [m]');
+-				fielddisplay(obj,'y2d','vertices y coordinate [m]');
+-
+-				disp(sprintf('\n      Elements and vertices of the extruded 3d mesh:'));
+-			else
+-				disp(sprintf('\n      Elements and vertices:'));
+-			end
+-			fielddisplay(obj,'numberofelements','number of elements');
+-			fielddisplay(obj,'numberofvertices','number of vertices');
+-			fielddisplay(obj,'elements','vertex indices of the mesh elements');
+-			fielddisplay(obj,'x','vertices x coordinate [m]');
+-			fielddisplay(obj,'y','vertices y coordinate [m]');
+-			fielddisplay(obj,'z','vertices z coordinate [m]');
+-			fielddisplay(obj,'edges','edges of the 2d mesh (vertex1 vertex2 element1 element2)');
+-			fielddisplay(obj,'numberofedges','number of edges of the 2d mesh');
+-
+-			disp(sprintf('\n      Properties:'));
+-			fielddisplay(obj,'dimension','mesh dimension');
+-			fielddisplay(obj,'numberoflayers','number of extrusion layers');
+-			fielddisplay(obj,'vertexonbed','lower vertices flags list');
+-			fielddisplay(obj,'elementonbed','lower elements flags list');
+-			fielddisplay(obj,'vertexonsurface','upper vertices flags list');
+-			fielddisplay(obj,'elementonsurface','upper elements flags list');
+-			fielddisplay(obj,'uppervertex','upper vertex list (NaN for vertex on the upper surface)');
+-			fielddisplay(obj,'upperelements','upper element list (NaN for element on the upper layer)');
+-			fielddisplay(obj,'lowervertex','lower vertex list (NaN for vertex on the lower surface)');
+-			fielddisplay(obj,'lowerelements','lower element list (NaN for element on the lower layer');
+-			fielddisplay(obj,'vertexonboundary','vertices on the boundary of the domain flag list');
+-
+-			fielddisplay(obj,'segments','edges on domain boundary (vertex1 vertex2 element)');
+-			fielddisplay(obj,'segmentmarkers','number associated to each segment');
+-			fielddisplay(obj,'vertexconnectivity','list of vertices connected to vertex_i');
+-			fielddisplay(obj,'elementconnectivity','list of vertices connected to element_i');
+-			fielddisplay(obj,'average_vertex_connectivity','average number of vertices connected to one vertex');
+-
+-			disp(sprintf('\n      Extracted model:'));
+-			fielddisplay(obj,'extractedvertices','vertices extracted from the model');
+-			fielddisplay(obj,'extractedelements','elements extracted from the model');
+-
+-			disp(sprintf('\n      Projection:'));
+-			fielddisplay(obj,'lat','vertices latitude [degrees]');
+-			fielddisplay(obj,'long','vertices longitude [degrees]');
+-			fielddisplay(obj,'hemisphere','Indicate hemisphere ''n'' or ''s'' ');
+-		end % }}}
+-		function marshall(obj,md,fid) % {{{
+-			WriteData(fid,'enum',MeshTypeEnum(),'data',StringToEnum(['Mesh' meshtype(obj)]),'format','Integer');
+-			WriteData(fid,'object',obj,'fieldname','x','format','DoubleMat','mattype',1);
+-			WriteData(fid,'object',obj,'fieldname','y','format','DoubleMat','mattype',1);
+-			WriteData(fid,'object',obj,'fieldname','z','format','DoubleMat','mattype',1);
+-			WriteData(fid,'object',obj,'fieldname','elements','format','DoubleMat','mattype',2);
+-			WriteData(fid,'object',obj,'fieldname','numberoflayers','format','Integer');
+-			WriteData(fid,'object',obj,'fieldname','numberofelements','format','Integer');
+-			WriteData(fid,'object',obj,'fieldname','numberofvertices','format','Integer');
+-			WriteData(fid,'object',obj,'fieldname','elementonbed','format','BooleanMat','mattype',2);
+-			WriteData(fid,'object',obj,'fieldname','elementonsurface','format','BooleanMat','mattype',2);
+-			WriteData(fid,'object',obj,'fieldname','vertexonbed','format','BooleanMat','mattype',1);
+-			WriteData(fid,'object',obj,'fieldname','vertexonsurface','format','BooleanMat','mattype',1);
+-			WriteData(fid,'object',obj,'fieldname','lowerelements','format','DoubleMat','mattype',2);
+-			WriteData(fid,'object',obj,'fieldname','upperelements','format','DoubleMat','mattype',2);
+-			WriteData(fid,'object',obj,'fieldname','average_vertex_connectivity','format','Integer');
+-			WriteData(fid,'object',obj,'fieldname','elements2d','format','DoubleMat','mattype',3);
+-			WriteData(fid,'object',obj,'fieldname','numberofvertices2d','format','Integer');
+-			WriteData(fid,'object',obj,'fieldname','numberofelements2d','format','Integer');
+-		end % }}}
+-		function type = meshtype(obj) % {{{
+-			if obj.dimension==2,
+-				type = '2Dhorizontal';
+-			else
+-				type = '3D';
+-			end
+-		end % }}}
+-	end
+-end
+Index: ../trunk-jpl/src/m/classes/mesh3dprisms.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh3dprisms.py	(revision 17557)
++++ ../trunk-jpl/src/m/classes/mesh3dprisms.py	(revision 17558)
+@@ -3,6 +3,7 @@
+ from EnumDefinitions import *
+ from checkfield import *
+ from MatlabFuncs import *
++from WriteData import WriteData
+ 
+ class mesh3dprisms(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/mesh3dprisms.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh3dprisms.m	(revision 17557)
++++ ../trunk-jpl/src/m/classes/mesh3dprisms.m	(revision 17558)
+@@ -45,6 +45,16 @@
+ 			switch nargin
+ 				case 0
+ 					obj=setdefaultparameters(obj);
++				case 1
++					self=mesh3dprisms();
++					object=varargin{1};
++					fields=fieldnames(object);
++					for i=1:length(fields)
++						field=fields{i};
++						if ismember(field,properties('mesh3dprisms')),
++							self.(field)=object.(field);
++						end
++					end
+ 				otherwise
+ 					error('constructor not supported');
+ 			end
+Index: ../trunk-jpl/src/m/classes/model.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.py	(revision 17557)
++++ ../trunk-jpl/src/m/classes/model.py	(revision 17558)
+@@ -3,6 +3,7 @@
+ import copy
+ import sys
+ from mesh import mesh
++from mesh3dprisms import mesh3dprisms
+ from mask import mask
+ from geometry import geometry
+ from constants import constants
+@@ -238,7 +239,7 @@
+ 		elements_2[:,0]=Pnode[elements_2[:,0]-1]
+ 		elements_2[:,1]=Pnode[elements_2[:,1]-1]
+ 		elements_2[:,2]=Pnode[elements_2[:,2]-1]
+-		if md1.mesh.dimension==3:
++		if md1.mesh.__class__.__name__=='mesh3dprisms':
+ 			elements_2[:,3]=Pnode[elements_2[:,3]-1]
+ 			elements_2[:,4]=Pnode[elements_2[:,4]-1]
+ 			elements_2[:,5]=Pnode[elements_2[:,5]-1]
+@@ -290,7 +291,7 @@
+ 		md2.mesh.elements=elements_2
+ 
+ 		#mesh.uppervertex mesh.lowervertex
+-		if md1.mesh.dimension==3:
++		if md1.mesh.__class__.__name__=='mesh3dprisms':
+ 			md2.mesh.uppervertex=md1.mesh.uppervertex[pos_node]
+ 			pos=numpy.nonzero(numpy.logical_not(md2.mesh.uppervertex==-1))[0]
+ 			md2.mesh.uppervertex[pos]=Pnode[md2.mesh.uppervertex[pos]-1]
+@@ -308,7 +309,7 @@
+ 			md2.mesh.lowerelements[pos]=Pelem[md2.mesh.lowerelements[pos]-1]
+ 
+ 		#Initial 2d mesh 
+-		if md1.mesh.dimension==3:
++		if md1.mesh.__class__.__name__=='mesh3dprisms':
+ 			flag_elem_2d=flag_elem[numpy.arange(0,md1.mesh.numberofelements2d)]
+ 			pos_elem_2d=numpy.nonzero(flag_elem_2d)[0]
+ 			flag_node_2d=flag_node[numpy.arange(0,md1.mesh.numberofvertices2d)]
+@@ -361,7 +362,7 @@
+ 			md2.masstransport.vertex_pairing=md2.masstransport.vertex_pairing[numpy.nonzero(md2.masstransport.vertex_pairing[:,0])[0],:]
+ 
+ 		#recreate segments
+-		if md1.mesh.dimension==2:
++		if md1.mesh.__class__.__name__=='mesh2d':
+ 			[md2.mesh.vertexconnectivity]=NodeConnectivity(md2.mesh.elements,md2.mesh.numberofvertices)
+ 			[md2.mesh.elementconnectivity]=ElementConnectivity(md2.mesh.elements,md2.mesh.vertexconnectivity)
+ 			md2.mesh.segments=contourenvelope(md2)
+@@ -497,10 +498,30 @@
+ 
+ 		if numlayers<2:
+ 			raise TypeError("number of layers should be at least 2")
+-		if md.mesh.dimension==3:
++		if md.mesh.__class__.__name__=='mesh3dprisms':
+ 			raise TypeError("Cannot extrude a 3d mesh (extrude cannot be called more than once)")
+ 
+ 		#Initialize with the 2d mesh
++		mesh2d = md.mesh
++		md.mesh=mesh3dprisms()
++		md.mesh.x                           = mesh2d.x
++		md.mesh.y                           = mesh2d.y
++		md.mesh.elements                    = mesh2d.elements
++		md.mesh.numberofelements            = mesh2d.numberofelements
++		md.mesh.numberofvertices            = mesh2d.numberofvertices
++
++		md.mesh.lat                         = mesh2d.lat
++		md.mesh.long                        = mesh2d.long
++		md.mesh.hemisphere                  = mesh2d.hemisphere
++
++		md.mesh.vertexonboundary            = mesh2d.vertexonboundary
++		md.mesh.vertexconnectivity          = mesh2d.vertexconnectivity
++		md.mesh.elementconnectivity         = mesh2d.elementconnectivity
++		md.mesh.average_vertex_connectivity = mesh2d.average_vertex_connectivity
++
++		md.mesh.extractedvertices           = mesh2d.extractedvertices
++		md.mesh.extractedelements           = mesh2d.extractedelements
++
+ 		x3d=numpy.empty((0))
+ 		y3d=numpy.empty((0))
+ 		z3d=numpy.empty((0))    #the lower node is on the bed
+@@ -544,9 +565,6 @@
+ 		md.mesh.numberofelements2d=md.mesh.numberofelements
+ 		md.mesh.numberofvertices2d=md.mesh.numberofvertices
+ 
+-		#Update mesh type
+-		md.mesh.dimension=3
+-
+ 		#Build global 3d mesh 
+ 		md.mesh.elements=elements3d
+ 		md.mesh.x=x3d
+Index: ../trunk-jpl/src/m/classes/oldclasses/mesh.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/oldclasses/mesh.m	(revision 0)
++++ ../trunk-jpl/src/m/classes/oldclasses/mesh.m	(revision 17558)
+@@ -0,0 +1,43 @@
++classdef mesh
++	properties (SetAccess=public) 
++		x                           = NaN;
++		y                           = NaN;
++		z                           = NaN
++		elements                    = NaN
++		dimension                   = 0;
++		numberoflayers              = 0;
++		numberofelements            = 0;
++		numberofvertices            = 0;
++		numberofedges               = 0;
++
++		lat                         = NaN
++		long                        = NaN
++		hemisphere                  = NaN
++
++		elementonbed                = NaN
++		elementonsurface            = NaN
++		vertexonbed                 = NaN
++		vertexonsurface             = NaN
++		lowerelements               = NaN
++		lowervertex                 = NaN
++		upperelements               = NaN
++		uppervertex                 = NaN
++		vertexonboundary            = NaN
++
++		edges                       = NaN
++		segments                    = NaN
++		segmentmarkers              = NaN
++		vertexconnectivity          = NaN
++		elementconnectivity         = NaN
++		average_vertex_connectivity = 0;
++
++		x2d                         = NaN
++		y2d                         = NaN
++		elements2d                  = NaN
++		numberofvertices2d          = 0;
++		numberofelements2d          = 0;
++
++		extractedvertices           = NaN
++		extractedelements           = NaN
++	end
++end
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17557)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17558)
+@@ -110,6 +110,14 @@
+ 				md.surfaceforcings=SMB();
+ 				md.surfaceforcings.mass_balance=mass_balance;
+ 			end
++			%2014 March 26th
++			if isa(md.mesh,'mesh'),
++				if(md.mesh.dimension==2),
++					md.mesh=mesh2d(md.mesh);
++				else
++					md.mesh=mesh3dprisms(md.mesh);
++				end
++			end
+ 		end% }}}
+ 	end
+ 	methods
+@@ -142,7 +150,7 @@
+ 			%   See also: EXTRUDE, MODELEXTRACT
+ 
+ 			%Check that the model is really a 3d model
+-			if ~md.mesh.dimension==3,
++			if ~strcmp(md.mesh.meshtype(),'3D'),
+ 				error('collapse error message: only 3d mesh can be collapsed')
+ 			end
+ 
+@@ -178,12 +186,6 @@
+ 			if ~isnan(md.gia.mantle_viscosity), md.gia.mantle_viscosity=project2d(md,md.gia.mantle_viscosity,1); end
+ 			if ~isnan(md.gia.lithosphere_thickness), md.gia.lithosphere_thickness=project2d(md,md.gia.lithosphere_thickness,1); end
+ 
+-			%bedinfo and surface info
+-			md.mesh.elementonbed=ones(md.mesh.numberofelements2d,1);
+-			md.mesh.elementonsurface=ones(md.mesh.numberofelements2d,1);
+-			md.mesh.vertexonbed=ones(md.mesh.numberofvertices2d,1);
+-			md.mesh.vertexonsurface=ones(md.mesh.numberofvertices2d,1);
+-
+ 			%elementstype
+ 			if ~isnan(md.flowequation.element_equation)
+ 				md.flowequation.element_equation=project2d(md,md.flowequation.element_equation,1);
+@@ -236,6 +238,7 @@
+ 			if numel(md.mesh.long)==md.mesh.numberofvertices, md.mesh.long=project2d(md,md.mesh.long,1); end
+ 
+ 			%Initialize with the 2d mesh
++			md.mesh=mesh2d();
+ 			md.mesh.x=md.mesh.x2d;
+ 			md.mesh.y=md.mesh.y2d;
+ 			md.mesh.z=zeros(size(md.mesh.x2d));
+@@ -257,8 +260,6 @@
+ 			md.mesh.numberofvertices2d=md.mesh.numberofvertices;
+ 			md.mesh.numberoflayers=0;
+ 
+-			%Update mesh type
+-			md.mesh.dimension=2;
+ 		end % }}}
+ 		function md2 = extract(md,area) % {{{
+ 			%extract - extract a model according to an Argus contour or flag list
+@@ -326,7 +327,7 @@
+ 			elements_2(:,1)=Pnode(elements_2(:,1));
+ 			elements_2(:,2)=Pnode(elements_2(:,2));
+ 			elements_2(:,3)=Pnode(elements_2(:,3));
+-			if md1.mesh.dimension==3,
++			if isa(md1.mesh,'mesh3dprisms'),
+ 				elements_2(:,4)=Pnode(elements_2(:,4));
+ 				elements_2(:,5)=Pnode(elements_2(:,5));
+ 				elements_2(:,6)=Pnode(elements_2(:,6));
+@@ -382,7 +383,7 @@
+ 			md2.mesh.elements=elements_2;
+ 
+ 			%mesh.uppervertex mesh.lowervertex
+-			if md1.mesh.dimension==3
++			if isa(md1.mesh,'mesh3dprisms'),
+ 				md2.mesh.uppervertex=md1.mesh.uppervertex(pos_node);
+ 				pos=find(~isnan(md2.mesh.uppervertex));
+ 				md2.mesh.uppervertex(pos)=Pnode(md2.mesh.uppervertex(pos));
+@@ -401,7 +402,7 @@
+ 			end
+ 
+ 			%Initial 2d mesh 
+-			if md1.mesh.dimension==3
++			if isa(md1.mesh,'mesh3dprisms'),
+ 				flag_elem_2d=flag_elem(1:md1.mesh.numberofelements2d);
+ 				pos_elem_2d=find(flag_elem_2d);
+ 				flag_node_2d=flag_node(1:md1.mesh.numberofvertices2d);
+@@ -460,7 +461,7 @@
+ 			end
+ 
+ 			%recreate segments
+-			if md1.mesh.dimension==2
++			if isa(md1.mesh,'mesh2d'),
+ 				md2.mesh.vertexconnectivity=NodeConnectivity(md2.mesh.elements,md2.mesh.numberofvertices);
+ 				md2.mesh.elementconnectivity=ElementConnectivity(md2.mesh.elements,md2.mesh.vertexconnectivity);
+ 				md2.mesh.segments=contourenvelope(md2);
+@@ -599,11 +600,31 @@
+ 			if numlayers<2,
+ 				error('number of layers should be at least 2');
+ 			end
+-			if md.mesh.dimension==3,
++			if strcmp(md.mesh.meshtype(),'3D')
+ 				error('Cannot extrude a 3d mesh (extrude cannot be called more than once)');
+ 			end
+ 
+ 			%Initialize with the 2d mesh
++			mesh2d = md.mesh;
++			md.mesh=mesh3dprisms();
++			md.mesh.x                           = mesh2d.x;
++			md.mesh.y                           = mesh2d.y;
++			md.mesh.elements                    = mesh2d.elements;
++			md.mesh.numberofelements            = mesh2d.numberofelements;
++			md.mesh.numberofvertices            = mesh2d.numberofvertices;
++
++			md.mesh.lat                         = mesh2d.lat;
++			md.mesh.long                        = mesh2d.long;
++			md.mesh.hemisphere                  = mesh2d.hemisphere;
++
++			md.mesh.vertexonboundary            = mesh2d.vertexonboundary;
++			md.mesh.vertexconnectivity          = mesh2d.vertexconnectivity;
++			md.mesh.elementconnectivity         = mesh2d.elementconnectivity;
++			md.mesh.average_vertex_connectivity = mesh2d.average_vertex_connectivity;
++
++			md.mesh.extractedvertices           = mesh2d.extractedvertices;
++			md.mesh.extractedelements           = mesh2d.extractedelements;
++
+ 			x3d=[]; 
+ 			y3d=[];
+ 			z3d=[];  %the lower node is on the bed
+@@ -649,9 +670,6 @@
+ 			md.mesh.numberofelements2d=md.mesh.numberofelements;
+ 			md.mesh.numberofvertices2d=md.mesh.numberofvertices;
+ 
+-			%Update mesh type
+-			md.mesh.dimension=3;
+-
+ 			%Build global 3d mesh 
+ 			md.mesh.elements=elements3d;
+ 			md.mesh.x=x3d;
+@@ -905,7 +923,6 @@
+ 			if isfield(structmd,'long'), md.mesh.long=structmd.long; end
+ 			if isfield(structmd,'segments'), md.mesh.segments=structmd.segments; end
+ 			if isfield(structmd,'segmentmarkers'), md.mesh.segmentmarkers=structmd.segmentmarkers; end
+-			if isfield(structmd,'dim'), md.mesh.dimension=structmd.dim; end
+ 			if isfield(structmd,'numlayers'), md.mesh.numberoflayers=structmd.numlayers; end
+ 			if isfield(structmd,'numberofelements'), md.mesh.numberofelements=structmd.numberofelements; end
+ 			if isfield(structmd,'numberofvertices'), md.mesh.numberofvertices=structmd.numberofvertices; end
+@@ -939,11 +956,6 @@
+ 			if isfield(structmd,'npart'); md.qmu.numberofpartitions=structmd.npart; end
+ 			if isfield(structmd,'part'); md.qmu.partition=structmd.part; end
+ 
+-			%Field changes
+-			if (isfield(structmd,'type') & ischar(structmd.type)), 
+-				if strcmpi(structmd.type,'2d'), md.mesh.dimension=2; end
+-				if strcmpi(structmd.type,'3d'), md.mesh.dimension=3; end
+-			end
+ 			if isnumeric(md.verbose),
+ 				md.verbose=verbose;
+ 			end
+@@ -1065,7 +1077,7 @@
+ 		function md = setdefaultparameters(md) % {{{
+ 
+ 			%initialize subclasses
+-			md.mesh             = mesh();
++			md.mesh             = mesh2d();
+ 			md.mask             = mask();
+ 			md.constants        = constants();
+ 			md.geometry         = geometry();
+Index: ../trunk-jpl/src/m/classes/mesh2d.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh2d.py	(revision 17557)
++++ ../trunk-jpl/src/m/classes/mesh2d.py	(revision 17558)
+@@ -3,6 +3,7 @@
+ from EnumDefinitions import *
+ from checkfield import checkfield
+ import MatlabFuncs as m
++from WriteData import WriteData
+ 
+ class mesh2d(object):
+ 	"""
+@@ -84,7 +85,6 @@
+ 
+ 		md = checkfield(md,'fieldname','mesh.x','NaN',1,'size',[md.mesh.numberofvertices])
+ 		md = checkfield(md,'fieldname','mesh.y','NaN',1,'size',[md.mesh.numberofvertices])
+-		md = checkfield(md,'fieldname','mesh.z','NaN',1,'size',[md.mesh.numberofvertices])
+ 		md = checkfield(md,'fieldname','mesh.elements','NaN',1,'>',0,'values',numpy.arange(1,md.mesh.numberofvertices+1))
+ 		md = checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements,3])
+ 		if numpy.any(numpy.logical_not(m.ismember(numpy.arange(1,md.mesh.numberofvertices+1),md.mesh.elements))):
+Index: ../trunk-jpl/src/m/parameterization/contourenvelope.m
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/contourenvelope.m	(revision 17557)
++++ ../trunk-jpl/src/m/parameterization/contourenvelope.m	(revision 17558)
+@@ -41,7 +41,7 @@
+ 
+ %get nodes inside profile
+ mesh.elementconnectivity=md.mesh.elementconnectivity;
+-if md.mesh.dimension==2;
++if strcmp(md.mesh.meshtype(),'2Dhorizontal'),
+ 	mesh.elements=md.mesh.elements;
+ 	mesh.x=md.mesh.x;
+ 	mesh.y=md.mesh.y;
+Index: ../trunk-jpl/src/m/parameterization/contourenvelope.py
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/contourenvelope.py	(revision 17557)
++++ ../trunk-jpl/src/m/parameterization/contourenvelope.py	(revision 17558)
+@@ -45,7 +45,7 @@
+ 
+ 	#get nodes inside profile
+ 	mesh.elementconnectivity=copy.deepcopy(md.mesh.elementconnectivity)
+-	if md.mesh.dimension==2:
++	if m.strcmp(md.mesh.meshtype(),'2Dhorizontal'):
+ 		mesh.elements=copy.deepcopy(md.mesh.elements)
+ 		mesh.x=copy.deepcopy(md.mesh.x)
+ 		mesh.y=copy.deepcopy(md.mesh.y)
Index: issm/oecreview/Archive/16554-17801/ISSM-17558-17559.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17558-17559.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17558-17559.diff	(revision 17802)
@@ -0,0 +1,779 @@
+Index: ../trunk-jpl/src/m/geometry/slope.py
+===================================================================
+--- ../trunk-jpl/src/m/geometry/slope.py	(revision 17558)
++++ ../trunk-jpl/src/m/geometry/slope.py	(revision 17559)
+@@ -11,7 +11,7 @@
+ 	"""
+ 
+ 	#load some variables (it is much faster if the variables are loaded from md once for all) 
+-	if md.mesh.dimension==2:
++	if m.strcmp(md.mesh.meshtype(),'2Dhorizontal'):
+ 		numberofelements=md.mesh.numberofelements
+ 		numberofnodes=md.mesh.numberofvertices
+ 		index=md.mesh.elements
+@@ -38,7 +38,7 @@
+ 
+ 	s=npy.sqrt(sx**2+sy**2)
+ 
+-	if md.mesh.dimension==3:
++	if m.strcmp(md.mesh.meshtype(),'3D'):
+ 		sx=project3d(md,'vector',sx,'type','element')
+ 		sy=project3d(md,'vector',sy,'type','element')
+ 		s=npy.sqrt(sx**2+sy**2)
+Index: ../trunk-jpl/src/m/geometry/slope.m
+===================================================================
+--- ../trunk-jpl/src/m/geometry/slope.m	(revision 17558)
++++ ../trunk-jpl/src/m/geometry/slope.m	(revision 17559)
+@@ -6,7 +6,7 @@
+ %      [sx,sy,s]=slope(md,md.results.TransientSolution(1).Surface)
+ 
+ %load some variables (it is much faster if the variab;es are loaded from md once for all) 
+-if (md.mesh.dimension==2),
++if (strcmp(meshtype(md.mesh),'2Dhorizontal')),
+ 	numberofelements=md.mesh.numberofelements;
+ 	numberofnodes=md.mesh.numberofvertices;
+ 	index=md.mesh.elements;
+@@ -29,7 +29,7 @@
+ sy=(surf(index).*beta)*summation;
+ s=sqrt(sx.^2+sy.^2);
+ 
+-if md.mesh.dimension==3,
++if strcmp(meshtype(md.mesh),'3D'),
+ 	sx=project3d(md,'vector',sx,'type','element');
+ 	sy=project3d(md,'vector',sy,'type','element');
+ 	s=sqrt(sx.^2+sy.^2);
+Index: ../trunk-jpl/src/m/exp/contourlevelzero.m
+===================================================================
+--- ../trunk-jpl/src/m/exp/contourlevelzero.m	(revision 17558)
++++ ../trunk-jpl/src/m/exp/contourlevelzero.m	(revision 17559)
+@@ -9,7 +9,7 @@
+ %   See also: PLOT_CONTOUR
+ 
+ %process data 
+-if md.mesh.dimension==3,
++if strcmp(meshtype(md.mesh),'3D'),
+ 	error('contourlevelzero error message: routine not supported for 3d meshes, project on a layer');
+ end
+ 
+Index: ../trunk-jpl/src/m/inversions/velocitymisfit.m
+===================================================================
+--- ../trunk-jpl/src/m/inversions/velocitymisfit.m	(revision 17558)
++++ ../trunk-jpl/src/m/inversions/velocitymisfit.m	(revision 17559)
+@@ -8,7 +8,7 @@
+ %      J=misfit(md)
+ %
+ 
+-if md.mesh.dimension==2,
++if strcmp(meshtype(md.mesh),'2Dhorizontal'),
+ 	elements=md.mesh.elements;
+ 	x=md.mesh.x;
+ 	y=md.mesh.y;
+Index: ../trunk-jpl/src/m/partition/AreaAverageOntoPartition.m
+===================================================================
+--- ../trunk-jpl/src/m/partition/AreaAverageOntoPartition.m	(revision 17558)
++++ ../trunk-jpl/src/m/partition/AreaAverageOntoPartition.m	(revision 17559)
+@@ -8,7 +8,7 @@
+ %      average=AreaAverageOntoPartition(md,vector,layer) %if in 3D, chose which layer is partitioned
+ 
+ %some checks
+-if md.mesh.dimension==3,
++if strcmp(meshtype(md.mesh),'3D'),
+ 	if nargin~=3,
+ 		error('layer should be provided onto which Area Averaging occurs');
+ 	end
+@@ -50,6 +50,6 @@
+ end
+ 
+ %in 3D, restore 3D model:
+-if md.mesh.dimension==3,
++if strcmp(meshtype(md.mesh),'3D'),
+ 	md=md3d;
+ end
+Index: ../trunk-jpl/src/m/partition/partitioner.m
+===================================================================
+--- ../trunk-jpl/src/m/partition/partitioner.m	(revision 17558)
++++ ../trunk-jpl/src/m/partition/partitioner.m	(revision 17559)
+@@ -29,7 +29,7 @@
+ npart=getfieldvalue(options,'npart');
+ recomputeadjacency=getfieldvalue(options,'recomputeadjacency');
+ 
+-if(md.mesh.dimension==3),
++if(strcmp(meshtype(md.mesh),'3D')),
+ 	%partitioning essentially happens in 2D. So partition in 2D, then 
+ 	%extrude the partition vector vertically. 
+ 	md3d=md; %save  for later
+@@ -68,7 +68,11 @@
+ 	end
+ 
+ 	%  partition into nparts
+-	part=Chaco(md.qmu.adjacency,weights,[],md.mesh.x, md.mesh.y ,md.mesh.z,method,npart,[])'+1; %index partitions from 1 up. like metis.
++	if isa(md.mesh,'mesh2d'),
++		part=Chaco(md.qmu.adjacency,weights,[],md.mesh.x, md.mesh.y,zeros(md.mesh.numberofvertices,1),method,npart,[])'+1; %index partitions from 1 up. like metis.
++	else
++		part=Chaco(md.qmu.adjacency,weights,[],md.mesh.x, md.mesh.y,md.mesh.z,method,npart,[])'+1; %index partitions from 1 up. like metis.
++	end
+ 
+ elseif strcmpi(package,'scotch'),
+ 
+@@ -95,7 +99,7 @@
+ end
+ 
+ %extrude if we are in 3D:
+-if md.mesh.dimension==3,
++if strcmp(meshtype(md.mesh),'3D'),
+ 	md3d.qmu.vertex_weight=md.qmu.vertex_weight;
+ 	md3d.qmu.adjacency=md.qmu.adjacency;
+ 	md=md3d;
+Index: ../trunk-jpl/src/m/mech/backstressfrominversion.m
+===================================================================
+--- ../trunk-jpl/src/m/mech/backstressfrominversion.m	(revision 17558)
++++ ../trunk-jpl/src/m/mech/backstressfrominversion.m	(revision 17559)
+@@ -40,7 +40,7 @@
+ if isempty(fieldnames(md.results)),
+ 	error(['md.results.strainrate is not present.  Calculate using md=mechanicalproperties(md,vx,vy)']);
+ end
+-if ~(md.mesh.dimension==2),
++if ~(strcmp(meshtype(md.mesh),'2Dhorizontal')),
+ 	error('only 2d model supported currently');
+ end
+ if any(md.flowequation.element_equation~=2),
+Index: ../trunk-jpl/src/m/mech/strainrateuncert.m
+===================================================================
+--- ../trunk-jpl/src/m/mech/strainrateuncert.m	(revision 17558)
++++ ../trunk-jpl/src/m/mech/strainrateuncert.m	(revision 17559)
+@@ -31,7 +31,7 @@
+ if length(dvy)~=md.mesh.numberofelements,
+ 	error(['the velocity error dvy should be of size ' num2str(md.mesh.numberofelements) ' or 1!'])
+ end
+-if ~(md.mesh.dimension==2)
++if ~(strcmp(meshtype(md.mesh),'2Dhorizontal'))
+ 	error('only 2d model supported yet');
+ end
+ if any(md.flowequation.element_equation~=2),
+Index: ../trunk-jpl/src/m/mech/damagefrominversion.m
+===================================================================
+--- ../trunk-jpl/src/m/mech/damagefrominversion.m	(revision 17558)
++++ ../trunk-jpl/src/m/mech/damagefrominversion.m	(revision 17559)
+@@ -20,7 +20,7 @@
+ if isempty(fieldnames(md.results)),
+ 	error(['md.results.strainrate is not present.  Calculate using md=mechanicalproperties(md,vx,vy)']);
+ end
+-if ~(md.mesh.dimension==2),
++if ~(strcmp(meshtype(md.mesh),'2Dhorizontal')),
+ 	error('only 2d model supported currently');
+ end
+ if any(md.flowequation.element_equation~=2),
+Index: ../trunk-jpl/src/m/mech/thomasparams.m
+===================================================================
+--- ../trunk-jpl/src/m/mech/thomasparams.m	(revision 17558)
++++ ../trunk-jpl/src/m/mech/thomasparams.m	(revision 17559)
+@@ -50,7 +50,7 @@
+ if isempty(fieldnames(md.results)),
+ 	error(['md.results.strainrate is not present.  Calculate using md=mechanicalproperties(md,vx,vy)'])
+ end
+-if ~(md.mesh.dimension==2)
++if ~(strcmp(meshtype(md.mesh),'2Dhorizontal'))
+ 	error('only 2d model supported currently');
+ end
+ if any(md.flowequation.element_equation~=2),
+Index: ../trunk-jpl/src/m/mech/analyticaldamage.m
+===================================================================
+--- ../trunk-jpl/src/m/mech/analyticaldamage.m	(revision 17558)
++++ ../trunk-jpl/src/m/mech/analyticaldamage.m	(revision 17559)
+@@ -47,7 +47,7 @@
+ if isempty(fieldnames(md.results)),
+ 	error(['md.results.strainrate is not present.  Calculate using md=mechanicalproperties(md,vx,vy)']);
+ end
+-if ~(md.mesh.dimension==2),
++if ~(strcmp(meshtype(md.mesh),'2Dhorizontal')),
+ 	error('only 2d model supported currently');
+ end
+ if any(md.flowequation.element_equation~=2),
+Index: ../trunk-jpl/src/m/mech/mechanicalproperties.m
+===================================================================
+--- ../trunk-jpl/src/m/mech/mechanicalproperties.m	(revision 17558)
++++ ../trunk-jpl/src/m/mech/mechanicalproperties.m	(revision 17559)
+@@ -16,7 +16,7 @@
+ if length(vx)~=md.mesh.numberofvertices | length(vy)~=md.mesh.numberofvertices,
+ 	%error(['the input velocity should be of size ' num2str(md.mesh.numberofvertices) '!'])
+ end
+-if ~(md.mesh.dimension==2)
++if ~(strcmp(meshtype(md.mesh),'2Dhorizontal'))
+ 	error('only 2d model supported yet');
+ end
+ if any(md.flowequation.element_equation~=2),
+Index: ../trunk-jpl/src/m/plot/plot_icefront.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_icefront.m	(revision 17558)
++++ ../trunk-jpl/src/m/plot/plot_icefront.m	(revision 17559)
+@@ -18,7 +18,7 @@
+ elementnoice=sum(noice(md.mesh.elements),2);
+ elementzeroice=sum(zeroice(md.mesh.elements),2);
+ 
+-if (md.mesh.dimension==2),
++if (strcmp(meshtype(md.mesh),'2Dhorizontal')),
+ 	icefront=(elementice & elementnoice) & ~(elementice==2 & elementzeroice);
+ 
+ 	%plot mesh
+Index: ../trunk-jpl/src/m/plot/plot_tensor_principalaxis.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_tensor_principalaxis.m	(revision 17558)
++++ ../trunk-jpl/src/m/plot/plot_tensor_principalaxis.m	(revision 17559)
+@@ -12,7 +12,7 @@
+ %process data and model
+ [x y z elements is2d isplanet]=processmesh(md,[],options);
+ 
+-if ((md.mesh.dimension==2)),
++if ((strcmp(meshtype(md.mesh),'2Dhorizontal'))),
+ 	eval(['Vx=tensor.principalaxis' type(end) '(:,1); Vy=tensor.principalaxis' type(end) '(:,2);'])
+ 	eval(['value=tensor.principalvalue' type(end) ';']);
+ 	[Vx datatype]=processdata(md,Vx,options);
+@@ -32,7 +32,7 @@
+ end
+ 
+ %plot quivers
+-if (md.mesh.dimension==2),
++if (strcmp(meshtype(md.mesh),'2Dhorizontal')),
+ 
+ 	%density
+ 	if exist(options,'density')
+Index: ../trunk-jpl/src/m/plot/plot_section.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_section.m	(revision 17558)
++++ ../trunk-jpl/src/m/plot/plot_section.m	(revision 17559)
+@@ -202,14 +202,14 @@
+ 
+ %apply options
+ options=addfielddefault(options,'title','Section value');
+-if (md.mesh.dimension==2)
++if (strcmp(meshtype(md.mesh),'2Dhorizontal'))
+ 	options=addfielddefault(options,'colorbar',0);
+ end
+-if ((md.mesh.dimension==2) | getfieldvalue(options,'view')==2 )
++if ((strcmp(meshtype(md.mesh),'2Dhorizontal')) | getfieldvalue(options,'view')==2 )
+ 	options=addfielddefault(options,'xlabel','Curvilinear coordinate');
+ 	options=addfielddefault(options,'axis','auto');
+ end
+-if (md.mesh.dimension==3 & getfieldvalue(options,'view')==2 )
++if (strcmp(meshtype(md.mesh),'3D') & getfieldvalue(options,'view')==2 )
+ 	options=addfielddefault(options,'ylabel','z');
+ end
+ applyoptions(md,[],options);
+Index: ../trunk-jpl/src/m/plot/plot_tensor_principal.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_tensor_principal.m	(revision 17558)
++++ ../trunk-jpl/src/m/plot/plot_tensor_principal.m	(revision 17559)
+@@ -9,13 +9,13 @@
+ %Compute the indexes of the components plots
+ upperplots=fix((i-1)/width);
+ if upperplots==0, leftplots=i-1; else leftplots=i-width*upperplots-1; end
+-if (md.mesh.dimension==2)%3 components -> 3 indexes
++if (strcmp(meshtype(md.mesh),'2Dhorizontal'))%3 components -> 3 indexes
+ 	index1=4*width*upperplots+2*leftplots+1;
+ 	index2=index1+1;
+ 	index3=index1+width*2;
+ 	index4=index3+1;
+ 	newwidth=2*width;
+-elseif md.mesh.dimension==3%6 components -> 6 indexes
++elseif strcmp(meshtype(md.mesh),'3D')%6 components -> 6 indexes
+ 	index1=3*3*width*upperplots+3*leftplots+1;
+ 	index2=index1+1;
+ 	index3=index1+2;
+@@ -30,7 +30,7 @@
+ plot_tensor_principalaxis(md,options,newwidth,index1,tensor,type1,plot_options);
+ type2=[type 'axis2'];
+ plot_tensor_principalaxis(md,options,newwidth,index2,tensor,type2,plot_options);
+-if  md.mesh.dimension==3
++if  strcmp(meshtype(md.mesh),'3D')
+ 	type3=[type 'axis3'];
+ 	plot_tensor_principalaxis(md,options,newwidth,index3,tensor,type3,plot_options);
+ end
+@@ -39,11 +39,11 @@
+ [x y z elements is2d isplanet]=processmesh(md,[],options);
+ [tensor.principalvalue1 datatype]=processdata(md,tensor.principalvalue1,options);
+ [tensor.principalvalue2 datatype]=processdata(md,tensor.principalvalue2,options);
+-if  md.mesh.dimension==3
++if  strcmp(meshtype(md.mesh),'3D')
+ 	[tensor.principalvalue3 datatype]=processdata(md,tensor.principalvalue3,options);
+ end
+ 
+-if ((md.mesh.dimension==2)),
++if ((strcmp(meshtype(md.mesh),'2Dhorizontal'))),
+ 	subplot(2*width,2*width,index3)
+ 	plot_unit(x,y,z,elements,tensor.principalvalue1,is2d,isplanet,datatype,options)
+ 	Apply_options_tensor(md,options,type,'principal value 1')
+Index: ../trunk-jpl/src/m/plot/plot_basaldrag.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_basaldrag.m	(revision 17558)
++++ ../trunk-jpl/src/m/plot/plot_basaldrag.m	(revision 17559)
+@@ -8,7 +8,7 @@
+ %   See also: PLOTMODEL
+ 
+ %check layer
+-if md.mesh.dimension==3,
++if strcmp(meshtype(md.mesh),'3D'),
+ 	if getfieldvalue(options,'layer',1)~=1;
+ 		disp('plot_basaldrag warning: basal drag is displayed in the lower layer')
+ 		changefieldvalue(options,'layer',1);
+Index: ../trunk-jpl/src/m/plot/plot_segments.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_segments.m	(revision 17558)
++++ ../trunk-jpl/src/m/plot/plot_segments.m	(revision 17559)
+@@ -13,7 +13,7 @@
+ [x y z elements is2d isplanet]=processmesh(md,[],options);
+ segments=md.mesh.segments;
+ 
+-if (md.mesh.dimension==2),
++if (strcmp(meshtype(md.mesh),'2Dhorizontal')),
+ 	%plot mesh
+ 	A=elements(:,1); B=elements(:,2); C=elements(:,3); 
+ 	h1=patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
+Index: ../trunk-jpl/src/m/plot/plot_transient_results.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_transient_results.m	(revision 17558)
++++ ../trunk-jpl/src/m/plot/plot_transient_results.m	(revision 17559)
+@@ -40,7 +40,7 @@
+ eval(string);
+ clear string;
+ 
+-if md.mesh.dimension==3,
++if strcmp(meshtype(md.mesh),'3D'),
+ 	string='plotmodel(md';
+ 	for i=1:length(md.results.transient),
+ 		string=[string ',''data'',md.results.transient(' num2str(i) ').temperature,''view'',3,''title'',''Temperature at time ' num2str(md.results.transient(i).time) ' a'''];
+@@ -66,7 +66,7 @@
+ eval(string);
+ clear string;
+ 
+-if md.mesh.dimension==3,
++if strcmp(meshtype(md.mesh),'3D'),
+ 	string='plotmodel(md';
+ 	for i=2:length(md.results.transient),
+ 		string=[string ',''data'',md.results.transient(' num2str(i) ').temperature-md.results.transient(' num2str(i-1) ').temperature,''view'',3,''title'',''Delta temperature at time ' num2str(md.results.transient(i).time) ' a'''];
+Index: ../trunk-jpl/src/m/plot/plot_qmu_mass_flux_segments.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_qmu_mass_flux_segments.m	(revision 17558)
++++ ../trunk-jpl/src/m/plot/plot_qmu_mass_flux_segments.m	(revision 17559)
+@@ -12,7 +12,7 @@
+ 
+ allsegments=md.qmu.mass_flux_segments;
+ 
+-if (md.mesh.dimension==2),
++if (strcmp(meshtype(md.mesh),'2Dhorizontal')),
+ 
+ 	%recover segments
+ 	hold on
+Index: ../trunk-jpl/src/m/plot/processmesh.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/processmesh.py	(revision 17558)
++++ ../trunk-jpl/src/m/plot/processmesh.py	(revision 17559)
+@@ -43,9 +43,9 @@
+ 		elements=elements-1
+ 
+ 		#is it a 2D plot?
+-		if md.mesh.dimension==2:
++		if m.strcmp(md.mesh.meshtype(),'2Dhorizontal'):
+ 			is2d=1
+-		elif md.mesh.dimension==3:
++		elif m.strcmp(md.mesh.meshtype(),'3D'):
+ 			if options.getfieldvalue('layer',0)>=1:
+ 				is2d=1
+ 			else:
+@@ -65,7 +65,7 @@
+ 	
+ 	else:
+ 		#Process mesh for plotting 
+-		if md.mesh.dimension==2:
++		if m.strcmp(md.mesh.meshtype(),'2Dhorizontal'):
+ 			is2d=1
+ 		else:
+ 			# process polycollection here for 3D plot
+Index: ../trunk-jpl/src/m/plot/plot_referential.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_referential.m	(revision 17558)
++++ ../trunk-jpl/src/m/plot/plot_referential.m	(revision 17559)
+@@ -27,7 +27,7 @@
+ 
+ Yhat=cross(Zhat,Xhat);
+ 
+-if (md.mesh.dimension==2),
++if (strcmp(meshtype(md.mesh),'2Dhorizontal')),
+ 
+ 	%plot mesh
+ 	A=elements(:,1); B=elements(:,2); C=elements(:,3); 
+Index: ../trunk-jpl/src/m/plot/plot_penalties.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_penalties.m	(revision 17558)
++++ ../trunk-jpl/src/m/plot/plot_penalties.m	(revision 17559)
+@@ -20,7 +20,7 @@
+ 	z=z*unit;
+ end
+ 
+-if ~md.mesh.dimension==3,
++if ~strcmp(meshtype(md.mesh),'3D'),
+ 	error('no penalties to plot for ''2d'' model');
+ elseif isempty(md.penalties),
+ 	disp('no penalty applied in this model');
+Index: ../trunk-jpl/src/m/plot/plot_edges.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_edges.m	(revision 17558)
++++ ../trunk-jpl/src/m/plot/plot_edges.m	(revision 17559)
+@@ -16,7 +16,7 @@
+ 	error('edges in NaN')
+ end
+ 
+-if (md.mesh.dimension==2),
++if (strcmp(meshtype(md.mesh),'2Dhorizontal')),
+ 	%plot mesh
+ 	A=elements(:,1); B=elements(:,2); C=elements(:,3); 
+ 	h1=patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
+Index: ../trunk-jpl/src/m/plot/plot_tensor_components.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_tensor_components.m	(revision 17558)
++++ ../trunk-jpl/src/m/plot/plot_tensor_components.m	(revision 17559)
+@@ -9,11 +9,11 @@
+ %Compute the indexes of the components plots
+ upperplots=fix((i-1)/width);
+ if upperplots==0, leftplots=i-1; else leftplots=i-width*upperplots-1; end
+-if (md.mesh.dimension==2)%3 components -> 3 indexes
++if (strcmp(meshtype(md.mesh),'2Dhorizontal'))%3 components -> 3 indexes
+ 	index1=4*width*upperplots+2*leftplots+1;
+ 	index2=index1+1;
+ 	index3=index1+width*2;
+-elseif md.mesh.dimension==3%6 components -> 6 indexes
++elseif strcmp(meshtype(md.mesh),'3D')%6 components -> 6 indexes
+ 	index1=3*3*width*upperplots+3*leftplots+1;
+ 	index2=index1+1;
+ 	index3=index1+2;
+@@ -27,13 +27,13 @@
+ [tensor.xx datatype]=processdata(md,tensor.xx,options);
+ [tensor.yy datatype]=processdata(md,tensor.yy,options);
+ [tensor.xy datatype]=processdata(md,tensor.xy,options);
+-if  md.mesh.dimension==3
++if  strcmp(meshtype(md.mesh),'3D')
+ 	[tensor.xz datatype]=processdata(md,tensor.xz,options);
+ 	[tensor.yz datatype]=processdata(md,tensor.yz,options);
+ 	[tensor.zz datatype]=processdata(md,tensor.zz,options);
+ end
+ 
+-if ((md.mesh.dimension==2)),
++if ((strcmp(meshtype(md.mesh),'2Dhorizontal'))),
+ 	subplot(2*width,2*width,index1),
+ 	plot_unit(x,y,z,elements,tensor.xx,is2d,isplanet,datatype,options)
+ 	Apply_options_tensor(md,options,type,'xx')
+Index: ../trunk-jpl/src/m/mesh/bamg.py
+===================================================================
+--- ../trunk-jpl/src/m/mesh/bamg.py	(revision 17558)
++++ ../trunk-jpl/src/m/mesh/bamg.py	(revision 17559)
+@@ -271,7 +271,7 @@
+ 		pass
+ 	#}}}
+ 	# Bamg Mesh parameters {{{
+-	if not options.exist('domain') and md.mesh.numberofvertices and md.mesh.dimension==2:
++	if not options.exist('domain') and md.mesh.numberofvertices and m.strcmp(md.mesh.meshtype(),'2Dhorizontal'):
+ 
+ 		if isinstance(md.private.bamg,dict) and 'mesh' in md.private.bamg:
+ 			bamg_mesh=bamgmesh(md.private.bamg['mesh'].__dict__)
+Index: ../trunk-jpl/src/m/mesh/bamg.m
+===================================================================
+--- ../trunk-jpl/src/m/mesh/bamg.m	(revision 17558)
++++ ../trunk-jpl/src/m/mesh/bamg.m	(revision 17559)
+@@ -283,7 +283,7 @@
+ end
+ %}}}
+ % Bamg Mesh parameters {{{
+-if (~exist(options,'domain') & md.mesh.numberofvertices~=0 & md.mesh.dimension==2),
++if (~exist(options,'domain') & md.mesh.numberofvertices~=0 & strcmp(meshtype(md.mesh),'2Dhorizontal')),
+ 
+ 	if isstruct(md.private.bamg) & isfield(md.private.bamg,'mesh'),
+ 		bamg_mesh=bamgmesh(md.private.bamg.mesh);
+Index: ../trunk-jpl/src/m/classes/thermal.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/thermal.py	(revision 17558)
++++ ../trunk-jpl/src/m/classes/thermal.py	(revision 17559)
+@@ -80,7 +80,7 @@
+ 
+ 		md = checkfield(md,'fieldname','thermal.stabilization','numel',[1],'values',[0,1,2])
+ 		md = checkfield(md,'fieldname','thermal.spctemperature','forcing',1)
+-		if EnthalpyAnalysisEnum() in analyses and md.thermal.isenthalpy and md.mesh.dimension==3:
++		if EnthalpyAnalysisEnum() in analyses and md.thermal.isenthalpy and m.strcmp(md.mesh.meshtype(),'3D'):
+ 			pos=numpy.nonzero(numpy.logical_not(numpy.isnan(md.thermal.spctemperature[0:md.mesh.numberofvertices])))
+ 			replicate=numpy.tile(md.geometry.surface-md.mesh.z,(1,numpy.size(md.thermal.spctemperature,axis=1)))
+ 			md = checkfield(md,'fieldname','thermal.spctemperature[numpy.nonzero(numpy.logical_not(numpy.isnan(md.thermal.spctemperature[0:md.mesh.numberofvertices,:])))]','<',md.materials.meltingpoint-md.materials.beta*md.materials.rho_ice*md.constants.g*replicate[pos],'message',"spctemperature should be below the adjusted melting point")
+Index: ../trunk-jpl/src/m/classes/rifts.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/rifts.py	(revision 17558)
++++ ../trunk-jpl/src/m/classes/rifts.py	(revision 17559)
+@@ -38,7 +38,7 @@
+ 			numrifts=len(self.riftstruct)
+ 
+ 		if numrifts:
+-			if not md.mesh.dimension==2:
++			if not m.strcmp(md.mesh.meshtype(),'2Dhorizontal'):
+ 				md.checkmessage("models with rifts are only supported in 2d for now!")
+ 			if not isinstance(self.riftstruct,list):
+ 				md.checkmessage("rifts.riftstruct should be a structure!")
+Index: ../trunk-jpl/src/m/classes/thermal.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/thermal.m	(revision 17558)
++++ ../trunk-jpl/src/m/classes/thermal.m	(revision 17559)
+@@ -63,7 +63,7 @@
+ 
+ 			md = checkfield(md,'fieldname','thermal.stabilization','numel',[1],'values',[0 1 2]);
+ 			md = checkfield(md,'fieldname','thermal.spctemperature','forcing',1);
+-			if (ismember(EnthalpyAnalysisEnum(),analyses) & md.thermal.isenthalpy & md.mesh.dimension==3),
++			if (ismember(EnthalpyAnalysisEnum(),analyses) & md.thermal.isenthalpy & strcmp(meshtype(md.mesh),'3D')),
+ 				pos=find(md.thermal.spctemperature(1:md.mesh.numberofvertices,:)~=NaN);
+ 				replicate=repmat(md.geometry.surface-md.mesh.z,1,size(md.thermal.spctemperature,2));
+ 				md = checkfield(md,'fieldname','thermal.spctemperature(find(md.thermal.spctemperature(1:md.mesh.numberofvertices,:)~=NaN))','<',md.materials.meltingpoint-md.materials.beta*md.materials.rho_ice*md.constants.g*replicate(pos),'message','spctemperature should be below the adjusted melting point');
+Index: ../trunk-jpl/src/m/classes/modellist.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/modellist.m	(revision 17558)
++++ ../trunk-jpl/src/m/classes/modellist.m	(revision 17559)
+@@ -31,7 +31,7 @@
+ 			%in flags.
+ 
+ 			%2D or 3D?
+-			if md.mesh.dimension==3,
++			if strcmp(meshtype(md.mesh),'3D'),
+ 				numberofelements=md.mesh.numberofelements2d; %this will be forgotten when we get out.
+ 				flags=project2d(md,flags,1);
+ 			else
+@@ -83,7 +83,7 @@
+ 
+ 			for i=1:size(flag_list,1),
+ 				disp(['   ' num2str(i) '/' num2str(size(flag_list,1))]);
+-				if md.mesh.dimension==3,
++				if strcmp(meshtype(md.mesh),'3D'),
+ 					flags2d=flag_list{i};
+ 					realflags=project3d(md,flags2d,'element');
+ 				else
+Index: ../trunk-jpl/src/m/classes/rifts.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/rifts.m	(revision 17558)
++++ ../trunk-jpl/src/m/classes/rifts.m	(revision 17559)
+@@ -27,7 +27,7 @@
+ 				numrifts=numel(obj.riftstruct);
+ 			end
+ 			if numrifts,
+-				if ~(md.mesh.dimension==2),
++				if ~(strcmp(meshtype(md.mesh),'2Dhorizontal')),
+ 					md = checkmessage(md,['models with rifts are only supported in 2d for now!']);
+ 				end
+ 				if ~isstruct(obj.riftstruct),
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17558)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17559)
+@@ -112,7 +112,7 @@
+ 			end
+ 			%2014 March 26th
+ 			if isa(md.mesh,'mesh'),
+-				if(md.mesh.dimension==2),
++				if(strcmp(meshtype(md.mesh),'2Dhorizontal')),
+ 					md.mesh=mesh2d(md.mesh);
+ 				else
+ 					md.mesh=mesh3dprisms(md.mesh);
+Index: ../trunk-jpl/src/m/classes/spheremesh.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/spheremesh.m	(revision 17558)
++++ ../trunk-jpl/src/m/classes/spheremesh.m	(revision 17559)
+@@ -12,7 +12,6 @@
+ 		theta                       = NaN;
+ 		phi                         = NaN
+ 		elements                    = NaN
+-		dimension                   = 0;
+ 		numberoflayers              = 0;
+ 		numberofelements            = 0;
+ 		numberofvertices            = 0;
+@@ -48,38 +47,14 @@
+ 			md = checkfield(md,'fieldname','spheremesh.theta','NaN',1,'size',[md.spheremesh.numberofvertices 1]);
+ 			md = checkfield(md,'fieldname','spheremesh.phi','NaN',1,'size',[md.spheremesh.numberofvertices 1]);
+ 			md = checkfield(md,'fieldname','spheremesh.elements','NaN',1,'>',0,'values',1:md.spheremesh.numberofvertices);
+-			if(md.spheremesh.dimension==2),
+-				md = checkfield(md,'fieldname','spheremesh.elements','size',[md.spheremesh.numberofelements 3]);
+-			else
+-				md = checkfield(md,'fieldname','spheremesh.elements','size',[md.spheremesh.numberofelements 6]);
+-			end
++			md = checkfield(md,'fieldname','spheremesh.elements','size',[md.spheremesh.numberofelements 3]);
+ 			if any(~ismember(1:md.spheremesh.numberofvertices,sort(unique(md.spheremesh.elements(:)))));
+ 				md = checkmessage(md,'orphan nodes have been found. Check the spheremesh outline');
+ 			end
+-			md = checkfield(md,'fieldname','spheremesh.dimension','values',[2 3]);
+ 			md = checkfield(md,'fieldname','spheremesh.numberoflayers','>=',0);
+ 			md = checkfield(md,'fieldname','spheremesh.numberofelements','>',0);
+ 			md = checkfield(md,'fieldname','spheremesh.numberofvertices','>',0);
+-			if (md.spheremesh.dimension==2),
+-				md = checkfield(md,'fieldname','spheremesh.average_vertex_connectivity','>=',9,'message','''spheremesh.average_vertex_connectivity'' should be at least 9 in 2d');
+-			else
+-				md = checkfield(md,'fieldname','spheremesh.average_vertex_connectivity','>=',24,'message','''spheremesh.average_vertex_connectivity'' should be at least 24 in 3d');
+-			end
+ 			md = checkfield(md,'fieldname','spheremesh.elementconnectivity','size',[md.spheremesh.numberofelements 3],'NaN',1);
+-
+-			%Solution specific checks
+-			switch(solution),
+-				case MasstransportSolutionEnum(),
+-					if md.masstransport.stabilization==3,
+-						md = checkfield(md,'fieldname','spheremesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d spheremeshes');
+-					end
+-				case TransientSolutionEnum(),
+-					if md.transient.ismasstransport & md.masstransport.stabilization==3,
+-						md = checkfield(md,'fieldname','spheremesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d spheremeshes');
+-					end
+-				case ThermalSolutionEnum(),
+-					md = checkfield(md,'fieldname','spheremesh.dimension','values',3,'message','thermal solution only supported on 3d spheremeshes');
+-			end
+ 		end % }}}
+ 		function disp(obj) % {{{
+ 			disp(sprintf('   Mesh:')); 
+@@ -96,7 +71,6 @@
+ 			fielddisplay(obj,'phi','vertices phi coordinate [degrees]');
+ 
+ 			disp(sprintf('\n      Properties:'));
+-			fielddisplay(obj,'dimension','spheremesh dimension (2d or 3d)');
+ 			fielddisplay(obj,'numberoflayers','number of extrusion layers');
+ 
+ 			fielddisplay(obj,'vertexconnectivity','list of vertices connected to vertex_i');
+@@ -112,7 +86,6 @@
+ 			WriteData(fid,'object',obj,'fieldname','theta','format','DoubleMat','mattype',1);
+ 			WriteData(fid,'object',obj,'fieldname','phi','format','DoubleMat','mattype',1);
+ 			WriteData(fid,'object',obj,'fieldname','elements','format','DoubleMat','mattype',2);
+-			WriteData(fid,'object',obj,'fieldname','dimension','format','Integer');
+ 			WriteData(fid,'object',obj,'fieldname','numberoflayers','format','Integer');
+ 			WriteData(fid,'object',obj,'fieldname','numberofelements','format','Integer');
+ 			WriteData(fid,'object',obj,'fieldname','numberofvertices','format','Integer');
+Index: ../trunk-jpl/src/m/contrib/hack/tres.m
+===================================================================
+--- ../trunk-jpl/src/m/contrib/hack/tres.m	(revision 17558)
++++ ../trunk-jpl/src/m/contrib/hack/tres.m	(revision 17559)
+@@ -8,7 +8,7 @@
+ %check number of arguments
+ 
+ if strcmpi(string,'stressbalance'),
+-	if md.mesh.dimension==2,
++	if strcmp(meshtype(md.mesh),'2Dhorizontal'),
+ 		md.initialization.vx=md.results.StressbalanceSolution.Vx;
+ 		md.initialization.vy=md.results.StressbalanceSolution.Vy;
+ 	else 
+Index: ../trunk-jpl/src/m/contrib/ecco/PropagateFlagsUntilDistance.m
+===================================================================
+--- ../trunk-jpl/src/m/contrib/ecco/PropagateFlagsUntilDistance.m	(revision 17558)
++++ ../trunk-jpl/src/m/contrib/ecco/PropagateFlagsUntilDistance.m	(revision 17559)
+@@ -9,7 +9,7 @@
+ new_flags=flags;
+ 
+ %make 3d work in 2d: 
+-if md.mesh.dimension==3,
++if strcmp(meshtype(md.mesh),'3D'),
+ 	md.mesh.x=md.mesh.x2d;
+ 	md.mesh.y=md.mesh.y2d;
+ 	md.mesh.elements=md.mesh.elements2d;
+Index: ../trunk-jpl/src/m/contrib/massbalance/outflux.m
+===================================================================
+--- ../trunk-jpl/src/m/contrib/massbalance/outflux.m	(revision 17558)
++++ ../trunk-jpl/src/m/contrib/massbalance/outflux.m	(revision 17559)
+@@ -15,7 +15,7 @@
+ Ny=ly./L;
+ 
+ if nargin==1,
+-	if md.mesh.dimension==3,
++	if strcmp(meshtype(md.mesh),'3D'),
+ 		vxa=DepthAverage(md,md.initialization.vx);
+ 		vya=DepthAverage(md,md.initialization.vy);
+ 	else
+@@ -27,7 +27,7 @@
+ 	H=(md.geometry.thickness(A)+md.geometry.thickness(B))/2;
+ else
+ 	step=varargin{1};
+-	if md.mesh.dimension==3,
++	if strcmp(meshtype(md.mesh),'3D'),
+ 		vxa=DepthAverage(md,md.results.TransientSolution(step).Vx);
+ 		vya=DepthAverage(md,md.results.TransientSolution(step).Vy);
+ 	else
+Index: ../trunk-jpl/src/m/contrib/massbalance/divergence.m
+===================================================================
+--- ../trunk-jpl/src/m/contrib/massbalance/divergence.m	(revision 17558)
++++ ../trunk-jpl/src/m/contrib/massbalance/divergence.m	(revision 17559)
+@@ -4,7 +4,7 @@
+ %   Usage:
+ %      div=divergence(md,a,b)
+ 
+-if (md.mesh.dimension==2),
++if (strcmp(meshtype(md.mesh),'2Dhorizontal')),
+ 	numberofelements=md.mesh.numberofelements;
+ 	numberofnodes=md.mesh.numberofvertices;
+ 	index=md.mesh.elements;
+Index: ../trunk-jpl/src/m/interp/SectionValues.m
+===================================================================
+--- ../trunk-jpl/src/m/interp/SectionValues.m	(revision 17558)
++++ ../trunk-jpl/src/m/interp/SectionValues.m	(revision 17559)
+@@ -28,7 +28,7 @@
+ else
+ 	error('SectionValues error message: wrong resolution type. Resolution must be an array [horizontal_resolution vertical_resolution]')
+ end
+-if md.mesh.dimension==3
++if strcmp(meshtype(md.mesh),'3D')
+ 	if (length(resolution)==2 & isnumeric(resolution(2)))
+ 		res_v=resolution(2);
+ 	else
+@@ -77,7 +77,7 @@
+ Z=zeros(numberofnodes,1);
+ 
+ %New mesh and Data interpolation
+-if (md.mesh.dimension==2)
++if (strcmp(meshtype(md.mesh),'2Dhorizontal'))
+ 
+ 	%Interpolation of data on specified points
+ 	data_interp=InterpFromMesh2d(md.mesh.elements,md.mesh.x,md.mesh.y,data,X,Y);
+Index: ../trunk-jpl/src/m/interp/averaging.py
+===================================================================
+--- ../trunk-jpl/src/m/interp/averaging.py	(revision 17558)
++++ ../trunk-jpl/src/m/interp/averaging.py	(revision 17559)
+@@ -26,7 +26,7 @@
+ 
+ 	if len(data)!=md.mesh.numberofelements and len(data)!=md.mesh.numberofvertices:
+ 		raise StandardError('averaging error message: data not supported yet')
+-	if md.mesh.dimension==3 and layer!=0:
++	if m.strcmp(md.mesh.meshtype(),'3D') and layer!=0:
+ 		if layer<=0 or layer>md.mesh.numberoflayers:
+ 			raise ValueError('layer should be between 1 and md.mesh.numberoflayers')
+ 	else:
+@@ -52,10 +52,10 @@
+ 
+ 	
+ 	#build some variables
+-	if md.mesh.dimension==3 and layer==0:
++	if m.strcmp(md.mesh.meshtype(),'3D') and layer==0:
+ 		rep=6
+ 		areas=GetAreas(index,md.mesh.x,md.mesh.y,md.mesh.z)
+-	elif md.mesh.dimension==2:
++	elif m.strcmp(md.mesh.meshtype(),'2Dhorizontal'):
+ 		rep=3
+ 		areas=GetAreas(index,md.mesh.x,md.mesh.y)
+ 	else:
+Index: ../trunk-jpl/src/m/interp/averaging.m
+===================================================================
+--- ../trunk-jpl/src/m/interp/averaging.m	(revision 17558)
++++ ../trunk-jpl/src/m/interp/averaging.m	(revision 17559)
+@@ -24,7 +24,7 @@
+ if (length(data)~=md.mesh.numberofelements & length(data)~=md.mesh.numberofvertices),
+ 	error('averaging error message: data not supported yet');
+ end
+-if md.mesh.dimension==3 & nargin==4,
++if strcmp(meshtype(md.mesh),'3D') & nargin==4,
+ 	if varargin{1}<=0 | varargin{1}>md.mesh.numberoflayers,
+ 		error('layer should be between 1 and md.mesh.numberoflayers');
+ 	end
+@@ -55,10 +55,10 @@
+ 
+ %build some variables
+ line=index(:);
+-if md.mesh.dimension==3 & layer==0,
++if strcmp(meshtype(md.mesh),'3D') & layer==0,
+ 	rep=6;
+ 	areas=GetAreas(index,md.mesh.x,md.mesh.y,md.mesh.z);
+-elseif md.mesh.dimension==2,
++elseif strcmp(meshtype(md.mesh),'2Dhorizontal'),
+ 	rep=3;
+ 	areas=GetAreas(index,md.mesh.x,md.mesh.y);
+ else
Index: issm/oecreview/Archive/16554-17801/ISSM-17559-17560.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17559-17560.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17559-17560.diff	(revision 17802)
@@ -0,0 +1,17 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 17559)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 17560)
+@@ -62,8 +62,10 @@
+ 
+ 	/*First create nodes*/
+ 	int    lid=0;
+-	iomodel->FetchData(6,MeshVertexonbedEnum,MeshVertexonsurfaceEnum,FlowequationBorderSSAEnum,FlowequationBorderFSEnum,
+-				FlowequationVertexEquationEnum,StressbalanceReferentialEnum);
++	iomodel->FetchData(4,FlowequationBorderSSAEnum,FlowequationBorderFSEnum,FlowequationVertexEquationEnum,StressbalanceReferentialEnum);
++	if(iomodel->meshtype!=Mesh2DhorizontalEnum){
++		iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	}
+ 
+ 	for(int i=0;i<iomodel->numberofvertices;i++){
+ 		if(iomodel->my_vertices[i]){
Index: issm/oecreview/Archive/16554-17801/ISSM-17560-17561.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17560-17561.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17560-17561.diff	(revision 17802)
@@ -0,0 +1,107 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp	(revision 17560)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp	(revision 17561)
+@@ -243,10 +243,10 @@
+ 
+ 	int numbervertices;
+ 	if(iomodel->meshtype==Mesh3DEnum){
+-		if((iomodel->faces[6*facenumber+5]-1)==1){
++		if((iomodel->faces[6*facenumber+5])==1){
+ 			numbervertices=3;
+ 		}
+-		else if((iomodel->faces[6*facenumber+5]-1)==2){
++		else if((iomodel->faces[6*facenumber+5])==2){
+ 			numbervertices=4;
+ 		}
+ 		else _error_("face marker not supported yet ");
+@@ -258,11 +258,11 @@
+ 		for(int i=0;i<3;i++) facevertices[i]=iomodel->faces[6*facenumber+i]-1;
+ 	}
+ 	else if(numbervertices==4){
+-		int  i,j,cols,faceid;
++		int  i,j,k,cols,faceid;
+ 		int  maxnbf,nbf,elementnbf,elementnbv,facemaxnbv;
+ 		int *elementfaces         = NULL;
+ 		int *elementfaces_markers = NULL;
+-		int elementid=iomodel->faces[6*facenumber+4]-1;
++		int elementid=iomodel->faces[6*facenumber+3];
+ 		int counter=0;
+ 
+ 		/*Recreate element properties*/
+@@ -288,13 +288,17 @@
+ 		for(faceid=2;faceid<5;faceid++){
+ 			counter=0;
+ 			for(j=0;j<3;j++){
+-				if(iomodel->elements[elementid*6+elementfaces[cols*faceid+j]] == iomodel->faces[6*facenumber+j]) counter++;
++				for(k=1;k<5;k++){
++					if(iomodel->elements[(elementid-1)*6+elementfaces[cols*faceid+k]] == iomodel->faces[6*facenumber+j]) counter++;
++				}
+ 			}
+ 			if(counter==3) break;
+ 		}
+ 		if(counter!=3) _error_("face not found in element");
+ 
+-		for(j=0;j<3;j++) facevertices[i]=iomodel->elements[elementid*6+elementfaces[cols*faceid+j]];
++		for(j=0;j<4;j++){
++			facevertices[j]=iomodel->elements[(elementid-1)*6+elementfaces[cols*faceid+j+1]];
++		}
+ 
+ 		/*Delete*/
+ 		xDelete<int>(elementfaces);
+Index: ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17560)
++++ ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17561)
+@@ -124,17 +124,18 @@
+ 								FaceGetVertexIndices(iomodel,&numfacevertices,&faceverticesid,i);
+ 								isnan=0;
+ 								for(j=0;j<numfacevertices;j++){
+-									if(xIsNan<IssmDouble>(spcdata[faceverticesid[j]])) isnan=1;
++									if(xIsNan<IssmDouble>(spcdata[faceverticesid[j]-1])) isnan=1;
+ 								}
+ 								if(isnan==0){
+ 									value=0;
+ 									for(j=0;j<numfacevertices;j++){
+-										value=value+spcdata[faceverticesid[j]]/numfacevertices;
++										value=value+spcdata[faceverticesid[j]-1]/numfacevertices;
+ 									}
+ 									constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofedges+i+1,
+ 													dof,value,analysis_type));
+ 									count++;
+ 								}
++								xDelete<int>(faceverticesid);
+ 							}
+ 						}
+ 					}
+@@ -183,12 +184,12 @@
+ 							FaceGetVertexIndices(iomodel,&numfacevertices,&faceverticesid,i);
+ 							isnan=0;
+ 							for(j=0;j<numfacevertices;j++){
+-								if(xIsNan<IssmDouble>(spcdata[faceverticesid[j]])) isnan=1;
++								if(xIsNan<IssmDouble>(spcdata[faceverticesid[j]-1])) isnan=1;
+ 							}
+ 							if(isnan==0){
+ 								value=0;
+ 								for(j=0;j<numfacevertices;j++){
+-									value=value+spcdata[faceverticesid[j]]/numfacevertices;
++									value=value+spcdata[faceverticesid[j]-1]/numfacevertices;
+ 								}
+ 								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*i+1,
+ 												dof,value,analysis_type));
+@@ -198,6 +199,7 @@
+ 												dof,value,analysis_type));
+ 								count=count+3;
+ 							}
++							xDelete<int>(faceverticesid);
+ 						}
+ 					}
+ 				}
+@@ -465,7 +467,6 @@
+ 	}
+ 
+ 	/*Free ressources:*/
+-	xDelete<int>(faceverticesid);
+ 	xDelete<IssmDouble>(times);
+ 	xDelete<IssmDouble>(values);
+ 	xDelete<bool>(my_edges);
Index: issm/oecreview/Archive/16554-17801/ISSM-17561-17562.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17561-17562.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17561-17562.diff	(revision 17802)
@@ -0,0 +1,112 @@
+Index: ../trunk-jpl/src/m/classes/mesh3dprisms.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh3dprisms.py	(revision 17561)
++++ ../trunk-jpl/src/m/classes/mesh3dprisms.py	(revision 17562)
+@@ -54,7 +54,7 @@
+ 		self.setdefaultparameters()
+ 		#}}}
+ 	def __repr__(self): # {{{
+-		string="   Mesh 3D prisms:" 
++		string="   3D prism Mesh:" 
+ 
+ 		string="%s\n%s"%(string,"\n      Elements and vertices of the original 2d mesh3dprisms:")
+ 		
+Index: ../trunk-jpl/src/m/classes/mesh3dprisms.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh3dprisms.m	(revision 17561)
++++ ../trunk-jpl/src/m/classes/mesh3dprisms.m	(revision 17562)
+@@ -91,7 +91,7 @@
+ 			md = checkfield(md,'fieldname','mesh.average_vertex_connectivity','>=',24,'message','''mesh.average_vertex_connectivity'' should be at least 24 in 3d');
+ 		end % }}}
+ 		function disp(obj) % {{{
+-			disp(sprintf('   Mesh:')); 
++			disp(sprintf('   3D prism Mesh:')); 
+ 
+ 			disp(sprintf('\n      Elements and vertices of the original 2d mesh:'));
+ 			fielddisplay(obj,'numberofelements2d','number of elements');
+Index: ../trunk-jpl/src/m/classes/mesh3dtetras.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh3dtetras.m	(revision 17561)
++++ ../trunk-jpl/src/m/classes/mesh3dtetras.m	(revision 17562)
+@@ -87,7 +87,7 @@
+ 			md = checkfield(md,'fieldname','mesh.average_vertex_connectivity','>=',24,'message','''mesh.average_vertex_connectivity'' should be at least 24 in 3d');
+ 		end % }}}
+ 		function disp(obj) % {{{
+-			disp(sprintf('   Mesh:')); 
++			disp(sprintf('   3D tetra Mesh:')); 
+ 
+ 			disp(sprintf('\n      Elements and vertices of the original 2d mesh:'));
+ 			fielddisplay(obj,'numberofelements2d','number of elements');
+Index: ../trunk-jpl/src/m/classes/mesh2dvertical.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh2dvertical.m	(revision 17561)
++++ ../trunk-jpl/src/m/classes/mesh2dvertical.m	(revision 17562)
+@@ -76,7 +76,7 @@
+ 			end
+ 		end % }}}
+ 		function disp(obj) % {{{
+-			disp(sprintf('   2d vertical Mesh:')); 
++			disp(sprintf('   2D tria Mesh (vertical):')); 
+ 
+ 			disp(sprintf('\n      Elements and vertices:'));
+ 			fielddisplay(obj,'numberofelements','number of elements');
+Index: ../trunk-jpl/src/m/classes/model.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.py	(revision 17561)
++++ ../trunk-jpl/src/m/classes/model.py	(revision 17562)
+@@ -639,6 +639,11 @@
+ 		md.stressbalance.spcvy=project3d(md,'vector',md.stressbalance.spcvy,'type','node')
+ 		md.stressbalance.spcvz=project3d(md,'vector',md.stressbalance.spcvz,'type','node')
+ 		md.thermal.spctemperature=project3d(md,'vector',md.thermal.spctemperature,'type','node','layer',md.mesh.numberoflayers,'padding',float('NaN'))
++		if isinstance(md.initialization.temperature,numpy.ndarray) and numpy.size(md.initialization.temperature,axis=0)==md.mesh.numberofvertices:
++			md.thermal.spctemperature=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
++			if hasattr(md.mesh,'vertexonsurface'):
++				pos=numpy.nonzero(md.mesh.vertexonsurface)[0]
++				md.thermal.spctemperature[pos]=md.initialization.temperature[pos]    #impose observed temperature on surface
+ 		md.masstransport.spcthickness=project3d(md,'vector',md.masstransport.spcthickness,'type','node')
+ 		md.balancethickness.spcthickness=project3d(md,'vector',md.balancethickness.spcthickness,'type','node')
+ 		md.damage.spcdamage=project3d(md,'vector',md.damage.spcdamage,'type','node')
+Index: ../trunk-jpl/src/m/classes/mesh2d.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh2d.m	(revision 17561)
++++ ../trunk-jpl/src/m/classes/mesh2d.m	(revision 17562)
+@@ -75,7 +75,7 @@
+ 			end
+ 		end % }}}
+ 		function disp(obj) % {{{
+-			disp(sprintf('   2d Mesh:')); 
++			disp(sprintf('   2D tria Mesh (horizontal):')); 
+ 
+ 			disp(sprintf('\n      Elements and vertices:'));
+ 			fielddisplay(obj,'numberofelements','number of elements');
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17561)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17562)
+@@ -740,6 +740,13 @@
+ 			md.stressbalance.spcvy=project3d(md,'vector',md.stressbalance.spcvy,'type','node');
+ 			md.stressbalance.spcvz=project3d(md,'vector',md.stressbalance.spcvz,'type','node');
+ 			md.thermal.spctemperature=project3d(md,'vector',md.thermal.spctemperature,'type','node','layer',md.mesh.numberoflayers,'padding',NaN);
++			if (length(md.initialization.temperature)==md.mesh.numberofvertices),
++				md.thermal.spctemperature=NaN*ones(md.mesh.numberofvertices,1);
++				if isprop(md.mesh,'vertexonsurface'),
++					pos=find(md.mesh.vertexonsurface);
++					md.thermal.spctemperature(pos)=md.initialization.temperature(pos); %impose observed temperature on surface
++				end
++			end
+ 			md.masstransport.spcthickness=project3d(md,'vector',md.masstransport.spcthickness,'type','node');
+ 			md.masstransport.calvingrate=project3d(md,'vector',md.masstransport.calvingrate,'type','node');
+ 			md.balancethickness.spcthickness=project3d(md,'vector',md.balancethickness.spcthickness,'type','node');
+Index: ../trunk-jpl/src/m/classes/mesh2d.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh2d.py	(revision 17561)
++++ ../trunk-jpl/src/m/classes/mesh2d.py	(revision 17562)
+@@ -41,7 +41,7 @@
+ 
+ 		#}}}
+ 	def __repr__(self): # {{{
+-		string="   2d Mesh:" 
++		string="   2D tria Mesh (horizontal):" 
+ 
+ 		string="%s\n%s"%(string,"\n      Elements and vertices:")
+ 		string="%s\n%s"%(string,fielddisplay(self,"numberofelements","number of elements"))
Index: issm/oecreview/Archive/16554-17801/ISSM-17562-17563.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17562-17563.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17562-17563.diff	(revision 17802)
@@ -0,0 +1,145 @@
+Index: ../trunk-jpl/src/m/classes/thermal.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/thermal.py	(revision 17562)
++++ ../trunk-jpl/src/m/classes/thermal.py	(revision 17563)
+@@ -3,6 +3,7 @@
+ from EnumDefinitions import *
+ from checkfield import checkfield
+ from WriteData import WriteData
++import MatlabFuncs as m
+ 
+ class thermal(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/rifts.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/rifts.py	(revision 17562)
++++ ../trunk-jpl/src/m/classes/rifts.py	(revision 17563)
+@@ -4,6 +4,7 @@
+ from checkfield import checkfield
+ from WriteData import WriteData
+ from isnans import isnans
++import MatlabFuncs as m
+ 
+ class rifts(object):
+ 	"""
+Index: ../trunk-jpl/src/m/classes/model.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.py	(revision 17562)
++++ ../trunk-jpl/src/m/classes/model.py	(revision 17563)
+@@ -326,30 +326,31 @@
+ 			md2.mesh.y2d=md1.mesh.y[pos_node_2d]
+ 
+ 		#Edges
+-		if numpy.ndim(md2.mesh.edges)>1 and numpy.size(md2.mesh.edges,axis=1)>1:    #do not use ~isnan because there are some NaNs...
+-			#renumber first two columns
+-			pos=numpy.nonzero(md2.mesh.edges[:,3]!=-1)[0]
+-			md2.mesh.edges[:  ,0]=Pnode[md2.mesh.edges[:,0]-1]
+-			md2.mesh.edges[:  ,1]=Pnode[md2.mesh.edges[:,1]-1]
+-			md2.mesh.edges[:  ,2]=Pelem[md2.mesh.edges[:,2]-1]
+-			md2.mesh.edges[pos,3]=Pelem[md2.mesh.edges[pos,3]-1]
+-			#remove edges when the 2 vertices are not in the domain.
+-			md2.mesh.edges=md2.mesh.edges[numpy.nonzero(numpy.logical_and(md2.mesh.edges[:,0],md2.mesh.edges[:,1]))[0],:]
+-			#Replace all zeros by -1 in the last two columns
+-			pos=numpy.nonzero(md2.mesh.edges[:,2]==0)[0]
+-			md2.mesh.edges[pos,2]=-1
+-			pos=numpy.nonzero(md2.mesh.edges[:,3]==0)[0]
+-			md2.mesh.edges[pos,3]=-1
+-			#Invert -1 on the third column with last column (Also invert first two columns!!)
+-			pos=numpy.nonzero(md2.mesh.edges[:,2]==-1)[0]
+-			md2.mesh.edges[pos,2]=md2.mesh.edges[pos,3]
+-			md2.mesh.edges[pos,3]=-1
+-			values=md2.mesh.edges[pos,1]
+-			md2.mesh.edges[pos,1]=md2.mesh.edges[pos,0]
+-			md2.mesh.edges[pos,0]=values
+-			#Finally remove edges that do not belong to any element
+-			pos=numpy.nonzero(numpy.logical_and(md2.mesh.edges[:,1]==-1,md2.mesh.edges[:,2]==-1))[0]
+-			md2.mesh.edges=numpy.delete(md2.mesh.edges,pos,axis=0)
++		if m.strcmp(md.mesh.meshtype(),'2Dhorizontal'):
++			if numpy.ndim(md2.mesh.edges)>1 and numpy.size(md2.mesh.edges,axis=1)>1:    #do not use ~isnan because there are some NaNs...
++				#renumber first two columns
++				pos=numpy.nonzero(md2.mesh.edges[:,3]!=-1)[0]
++				md2.mesh.edges[:  ,0]=Pnode[md2.mesh.edges[:,0]-1]
++				md2.mesh.edges[:  ,1]=Pnode[md2.mesh.edges[:,1]-1]
++				md2.mesh.edges[:  ,2]=Pelem[md2.mesh.edges[:,2]-1]
++				md2.mesh.edges[pos,3]=Pelem[md2.mesh.edges[pos,3]-1]
++				#remove edges when the 2 vertices are not in the domain.
++				md2.mesh.edges=md2.mesh.edges[numpy.nonzero(numpy.logical_and(md2.mesh.edges[:,0],md2.mesh.edges[:,1]))[0],:]
++				#Replace all zeros by -1 in the last two columns
++				pos=numpy.nonzero(md2.mesh.edges[:,2]==0)[0]
++				md2.mesh.edges[pos,2]=-1
++				pos=numpy.nonzero(md2.mesh.edges[:,3]==0)[0]
++				md2.mesh.edges[pos,3]=-1
++				#Invert -1 on the third column with last column (Also invert first two columns!!)
++				pos=numpy.nonzero(md2.mesh.edges[:,2]==-1)[0]
++				md2.mesh.edges[pos,2]=md2.mesh.edges[pos,3]
++				md2.mesh.edges[pos,3]=-1
++				values=md2.mesh.edges[pos,1]
++				md2.mesh.edges[pos,1]=md2.mesh.edges[pos,0]
++				md2.mesh.edges[pos,0]=values
++				#Finally remove edges that do not belong to any element
++				pos=numpy.nonzero(numpy.logical_and(md2.mesh.edges[:,1]==-1,md2.mesh.edges[:,2]==-1))[0]
++				md2.mesh.edges=numpy.delete(md2.mesh.edges,pos,axis=0)
+ 
+ 		#Penalties
+ 		if numpy.any(numpy.logical_not(numpy.isnan(md2.stressbalance.vertex_pairing))):
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17562)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17563)
+@@ -420,30 +420,32 @@
+ 			end
+ 
+ 			%Edges
+-			if size(md2.mesh.edges,2)>1, %do not use ~isnan because there are some NaNs...
+-				%renumber first two columns
+-				pos=find(md2.mesh.edges(:,4)~=-1);
+-				md2.mesh.edges(:  ,1)=Pnode(md2.mesh.edges(:,1));
+-				md2.mesh.edges(:  ,2)=Pnode(md2.mesh.edges(:,2));
+-				md2.mesh.edges(:  ,3)=Pelem(md2.mesh.edges(:,3));
+-				md2.mesh.edges(pos,4)=Pelem(md2.mesh.edges(pos,4));
+-				%remove edges when the 2 vertices are not in the domain.
+-				md2.mesh.edges=md2.mesh.edges(find(md2.mesh.edges(:,1) & md2.mesh.edges(:,2)),:);
+-				%Replace all zeros by -1 in the last two columns
+-				pos=find(md2.mesh.edges(:,3)==0);
+-				md2.mesh.edges(pos,3)=-1;
+-				pos=find(md2.mesh.edges(:,4)==0);
+-				md2.mesh.edges(pos,4)=-1;
+-				%Invert -1 on the third column with last column (Also invert first two columns!!)
+-				pos=find(md2.mesh.edges(:,3)==-1);
+-				md2.mesh.edges(pos,3)=md2.mesh.edges(pos,4);
+-				md2.mesh.edges(pos,4)=-1;
+-				values=md2.mesh.edges(pos,2);
+-				md2.mesh.edges(pos,2)=md2.mesh.edges(pos,1);
+-				md2.mesh.edges(pos,1)=values;
+-				%Finally remove edges that do not belong to any element
+-				pos=find(md2.mesh.edges(:,3)==-1 & md2.mesh.edges(:,4)==-1);
+-				md2.mesh.edges(pos,:)=[];
++			if(strcmp(meshtype(md.mesh),'2Dhorizontal')),
++				if size(md2.mesh.edges,2)>1, %do not use ~isnan because there are some NaNs...
++					%renumber first two columns
++					pos=find(md2.mesh.edges(:,4)~=-1);
++					md2.mesh.edges(:  ,1)=Pnode(md2.mesh.edges(:,1));
++					md2.mesh.edges(:  ,2)=Pnode(md2.mesh.edges(:,2));
++					md2.mesh.edges(:  ,3)=Pelem(md2.mesh.edges(:,3));
++					md2.mesh.edges(pos,4)=Pelem(md2.mesh.edges(pos,4));
++					%remove edges when the 2 vertices are not in the domain.
++					md2.mesh.edges=md2.mesh.edges(find(md2.mesh.edges(:,1) & md2.mesh.edges(:,2)),:);
++					%Replace all zeros by -1 in the last two columns
++					pos=find(md2.mesh.edges(:,3)==0);
++					md2.mesh.edges(pos,3)=-1;
++					pos=find(md2.mesh.edges(:,4)==0);
++					md2.mesh.edges(pos,4)=-1;
++					%Invert -1 on the third column with last column (Also invert first two columns!!)
++					pos=find(md2.mesh.edges(:,3)==-1);
++					md2.mesh.edges(pos,3)=md2.mesh.edges(pos,4);
++					md2.mesh.edges(pos,4)=-1;
++					values=md2.mesh.edges(pos,2);
++					md2.mesh.edges(pos,2)=md2.mesh.edges(pos,1);
++					md2.mesh.edges(pos,1)=values;
++					%Finally remove edges that do not belong to any element
++					pos=find(md2.mesh.edges(:,3)==-1 & md2.mesh.edges(:,4)==-1);
++					md2.mesh.edges(pos,:)=[];
++				end
+ 			end
+ 
+ 			%Penalties
Index: issm/oecreview/Archive/16554-17801/ISSM-17563-17564.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17563-17564.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17563-17564.diff	(revision 17802)
@@ -0,0 +1,137 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17563)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17564)
+@@ -50,12 +50,12 @@
+ 	iomodel->FetchDataToInput(elements,ThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+-	iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
+ 	iomodel->FetchDataToInput(elements,EplHeadEnum);
+ 	iomodel->FetchDataToInput(elements,SedimentHeadEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcEplInitialThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcSedimentTransmitivityEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcEplThicknessEnum);
++	if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
+ 	
+ 	//	elements->InputDuplicate(HydrologydcEplInitialThicknessEnum,HydrologydcEplThicknessEnum);
+ 
+@@ -72,9 +72,9 @@
+ 	iomodel->Constant(&isefficientlayer,HydrologydcIsefficientlayerEnum);
+ 	if(!isefficientlayer) return;
+ 
+-	iomodel->FetchData(3,MeshVertexonbedEnum,MeshVertexonsurfaceEnum,FlowequationVertexEquationEnum);
++	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,HydrologyDCEfficientAnalysisEnum,P1Enum);
+-	iomodel->DeleteData(3,MeshVertexonbedEnum,MeshVertexonsurfaceEnum,FlowequationVertexEquationEnum);
++	iomodel->DeleteData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+ void HydrologyDCEfficientAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 17563)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 17564)
+@@ -34,9 +34,9 @@
+ 	}
+ }/*}}}*/
+ void SmoothedSurfaceSlopeXAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+-	iomodel->FetchData(1,MeshVertexonbedEnum);
++	if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchData(1,MeshVertexonbedEnum);
+ 	::CreateNodes(nodes,iomodel,SmoothedSurfaceSlopeXAnalysisEnum,P1Enum);
+-	iomodel->DeleteData(1,MeshVertexonbedEnum);
++	if(iomodel->meshtype==Mesh3DEnum) iomodel->DeleteData(1,MeshVertexonbedEnum);
+ }/*}}}*/
+ void SmoothedSurfaceSlopeXAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 17563)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 17564)
+@@ -34,9 +34,9 @@
+ 	}
+ }/*}}}*/
+ void SmoothedSurfaceSlopeYAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+-	iomodel->FetchData(1,MeshVertexonbedEnum);
++	if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchData(1,MeshVertexonbedEnum);
+ 	::CreateNodes(nodes,iomodel,SmoothedSurfaceSlopeYAnalysisEnum,P1Enum);
+-	iomodel->DeleteData(1,MeshVertexonbedEnum);
++	if(iomodel->meshtype==Mesh3DEnum) iomodel->DeleteData(1,MeshVertexonbedEnum);
+ }/*}}}*/
+ void SmoothedSurfaceSlopeYAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 17563)
++++ ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 17564)
+@@ -43,9 +43,7 @@
+ 	if(iomodel->meshtype==Mesh3DEnum) _error_("DG 3d not implemented yet");
+ 
+ 	/*First fetch data: */
+-	iomodel->FetchData(3,MeshVertexonbedEnum,MeshVertexonsurfaceEnum,FlowequationVertexEquationEnum);
+ 	::CreateNodes(nodes,iomodel,BalancevelocityAnalysisEnum,P1Enum);
+-	iomodel->DeleteData(3,MeshVertexonbedEnum,MeshVertexonsurfaceEnum,FlowequationVertexEquationEnum);
+ }/*}}}*/
+ void BalancevelocityAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17563)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17564)
+@@ -83,13 +83,12 @@
+ 	iomodel->FetchDataToInput(elements,ThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+-	iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
+ 	iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcBasalMoulinInputEnum);
+ 	iomodel->FetchDataToInput(elements,SedimentHeadEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcSedimentTransmitivityEnum);
++	if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
+ 
+-
+ 	if(isefficientlayer)iomodel->FetchDataToInput(elements,HydrologydcMaskEplactiveNodeEnum);
+ }/*}}}*/
+ void HydrologyDCInefficientAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+@@ -101,7 +100,7 @@
+ 	/*Now, do we really want DC?*/
+ 	if(hydrology_model!=HydrologydcEnum) return;
+ 
+-	if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,HydrologyDCInefficientAnalysisEnum,P1Enum);
+ 	iomodel->DeleteData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+@@ -121,7 +120,7 @@
+ 	iomodel->Constant(&hydrology_model,HydrologyModelEnum);
+ 	if(hydrology_model!=HydrologydcEnum) return;
+ 
+-	iomodel->FetchData(1,MeshVertexonbedEnum);
++	if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchData(1,MeshVertexonbedEnum);
+ 
+ 	//create penalties for nodes: no node can have water above the max
+ 	CreateSingleNodeToElementConnectivity(iomodel);
+Index: ../trunk-jpl/src/m/classes/model.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.py	(revision 17563)
++++ ../trunk-jpl/src/m/classes/model.py	(revision 17564)
+@@ -373,7 +373,6 @@
+ 			#First do the connectivity for the contourenvelope in 2d
+ 			[md2.mesh.vertexconnectivity]=NodeConnectivity(md2.mesh.elements2d,md2.mesh.numberofvertices2d)
+ 			[md2.mesh.elementconnectivity]=ElementConnectivity(md2.mesh.elements2d,md2.mesh.vertexconnectivity)
+-			md2.mesh.segments=contourenvelope(md2)
+ 			md2.mesh.vertexonboundary=numpy.zeros(numberofvertices2/md2.mesh.numberoflayers,bool)
+ 			md2.mesh.vertexonboundary[md2.mesh.segments[:,0:2]-1]=True
+ 			md2.mesh.vertexonboundary=numpy.tile(md2.mesh.vertexonboundary,md2.mesh.numberoflayers)
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17563)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17564)
+@@ -472,7 +472,6 @@
+ 				%First do the connectivity for the contourenvelope in 2d
+ 				md2.mesh.vertexconnectivity=NodeConnectivity(md2.mesh.elements2d,md2.mesh.numberofvertices2d);
+ 				md2.mesh.elementconnectivity=ElementConnectivity(md2.mesh.elements2d,md2.mesh.vertexconnectivity);
+-				md2.mesh.segments=contourenvelope(md2);
+ 				md2.mesh.vertexonboundary=zeros(numberofvertices2/md2.mesh.numberoflayers,1); md2.mesh.vertexonboundary(md2.mesh.segments(:,1:2))=1;
+ 				md2.mesh.vertexonboundary=repmat(md2.mesh.vertexonboundary,md2.mesh.numberoflayers,1);
+ 				%Then do it for 3d as usual
Index: issm/oecreview/Archive/16554-17801/ISSM-17564-17565.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17564-17565.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17564-17565.diff	(revision 17802)
@@ -0,0 +1,29 @@
+Index: ../trunk-jpl/src/m/classes/model.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.py	(revision 17564)
++++ ../trunk-jpl/src/m/classes/model.py	(revision 17565)
+@@ -373,8 +373,9 @@
+ 			#First do the connectivity for the contourenvelope in 2d
+ 			[md2.mesh.vertexconnectivity]=NodeConnectivity(md2.mesh.elements2d,md2.mesh.numberofvertices2d)
+ 			[md2.mesh.elementconnectivity]=ElementConnectivity(md2.mesh.elements2d,md2.mesh.vertexconnectivity)
++			segments=contourenvelope(md2)
+ 			md2.mesh.vertexonboundary=numpy.zeros(numberofvertices2/md2.mesh.numberoflayers,bool)
+-			md2.mesh.vertexonboundary[md2.mesh.segments[:,0:2]-1]=True
++			md2.mesh.vertexonboundary[segments[:,0:2]-1]=True
+ 			md2.mesh.vertexonboundary=numpy.tile(md2.mesh.vertexonboundary,md2.mesh.numberoflayers)
+ 			#Then do it for 3d as usual
+ 			[md2.mesh.vertexconnectivity]=NodeConnectivity(md2.mesh.elements,md2.mesh.numberofvertices)
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17564)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17565)
+@@ -472,7 +472,8 @@
+ 				%First do the connectivity for the contourenvelope in 2d
+ 				md2.mesh.vertexconnectivity=NodeConnectivity(md2.mesh.elements2d,md2.mesh.numberofvertices2d);
+ 				md2.mesh.elementconnectivity=ElementConnectivity(md2.mesh.elements2d,md2.mesh.vertexconnectivity);
+-				md2.mesh.vertexonboundary=zeros(numberofvertices2/md2.mesh.numberoflayers,1); md2.mesh.vertexonboundary(md2.mesh.segments(:,1:2))=1;
++				segments=contourenvelope(md2);
++				md2.mesh.vertexonboundary=zeros(numberofvertices2/md2.mesh.numberoflayers,1); md2.mesh.vertexonboundary(segments(:,1:2))=1;
+ 				md2.mesh.vertexonboundary=repmat(md2.mesh.vertexonboundary,md2.mesh.numberoflayers,1);
+ 				%Then do it for 3d as usual
+ 				md2.mesh.vertexconnectivity=NodeConnectivity(md2.mesh.elements,md2.mesh.numberofvertices);
Index: issm/oecreview/Archive/16554-17801/ISSM-17565-17566.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17565-17566.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17565-17566.diff	(revision 17802)
@@ -0,0 +1,23 @@
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17565)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17566)
+@@ -112,10 +112,15 @@
+ 			end
+ 			%2014 March 26th
+ 			if isa(md.mesh,'mesh'),
+-				if(strcmp(meshtype(md.mesh),'2Dhorizontal')),
+-					md.mesh=mesh2d(md.mesh);
++				disp('Recovering old mesh class');
++				if isprop(md.mesh,'dimension'),
++					if md.mesh.dimension==2,
++						md.mesh=mesh2d(md.mesh);
++					else
++						md.mesh=mesh3dprisms(md.mesh);
++					end
+ 				else
+-					md.mesh=mesh3dprisms(md.mesh);
++					md.mesh=mesh2dvertical(md.mesh);
+ 				end
+ 			end
+ 		end% }}}
Index: issm/oecreview/Archive/16554-17801/ISSM-17566-17567.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17566-17567.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17566-17567.diff	(revision 17802)
@@ -0,0 +1,111 @@
+Index: ../trunk-jpl/src/m/boundaryconditions/PattynSMB.py
+===================================================================
+--- ../trunk-jpl/src/m/boundaryconditions/PattynSMB.py	(revision 0)
++++ ../trunk-jpl/src/m/boundaryconditions/PattynSMB.py	(revision 17567)
+@@ -0,0 +1,50 @@
++import os
++import numpy as npy
++def PattynSMB(md,Tf):
++	"""
++    PATTYNSMB- Compute SMB over Antarctica (from Pattyn 2006, pg. 18, "GRANTISM: An ExcelTM model for Greenland 
++	and Antarctic ice-sheet response to climate changes")
++
++    Usage:
++      md=PattynSMB(md,Tf)
++
++      where Tf is a background forcing temperature ("an anomalous temperature relative to the present conditions)
++
++
++    See also: SETICESHELFBC, SETMARINEICESHEETBC
++	"""
++ 
++	# Tma    : Mean annual surface temperature in [deg C]
++	# Tms    : Mean summer temperature in [deg C]
++	# h      : Surface/bedrock elevation (I assume in meters but paper does not specify)
++	# phi    : Latitude in degrees SOUTH
++	# lambda : Longitude in degrees WEST
++	# Tf     : Background forcing temperature ("an anomalous temperature relative to the present conditions)
++	# ACCdot : Accumulation rate in units of [m/a] ice equivalent
++	# ABLdot : Surface ablation rate in [m/a] ice equivalent
++
++	#Double check lat and long exist:
++	if npy.any(npy.isnan(md.mesh.lat)): 
++		raise IOError('PattynSMB error message: md.mesh.lat field required')
++
++	# Calculate mean annual surface temperature, Eqn (11)
++	# Here, -0.012 is the atmospheric Lapse rate from sea level in deg/m.
++	# It is multiplied by surface elevation from sea level
++	Tma = -15.15 - 0.012*md.geometry.surface
++	
++
++	# Calculate summer temperature, Eqn (12)
++	# No melting at PIG in mean conditions - need about 6 degress Tf to start having a negative yearly SMB
++	Tms = 16.81 - 0.00692*md.geometry.surface - 0.27937*npy.abs(md.mesh.lat) + Tf
++	Tms= Tms[0]
++
++	# Calculate Accumulation perturbation with Tf forcing, Eqn (9)
++	ACCdot = 2.5*2**((Tma+Tf)/10.) - 2.5*2**(Tma/10.)
++
++	# Calculate Ablation, Eqn (10) (use for both Antarctica & Greenland), max melt is 10m/a
++	ABLdot=0.*npy.ones(md.mesh.numberofvertices)
++	pos=npy.nonzero(Tms>=0)
++	ABLdot[pos]=npy.minimum(1.4*Tms[pos],10)
++
++	smb=ACCdot-ABLdot
++	return smb[0]
+Index: ../trunk-jpl/src/m/boundaryconditions/PattynSMB.m
+===================================================================
+--- ../trunk-jpl/src/m/boundaryconditions/PattynSMB.m	(revision 0)
++++ ../trunk-jpl/src/m/boundaryconditions/PattynSMB.m	(revision 17567)
+@@ -0,0 +1,51 @@
++function smb=PattynSMB(md,Tf)
++%PATTYNSMB- Compute SMB over Antarctica (from Pattyn 2006, pg. 18, "GRANTISM: An ExcelTM model for Greenland and 
++%           Antarctic ice-sheet response to climate changes")
++%
++%   Usage:
++%      md=PattynSMB(md,Tf)
++%
++%      where Tf is a background forcing temperature ("an anomalous temperature relative to the present conditions)
++%
++%
++%   See also: SETICESHELFBC, SETMARINEICESHEETBC
++
++ 
++% Tma    : Mean annual surface temperature in [deg C]
++% Tms    : Mean summer temperature in [deg C]
++% h      : Surface/bedrock elevation (I assume in meters but paper does not specify)
++% phi    : Latitude in degrees SOUTH
++% lambda : Longitude in degrees WEST
++% Tf     : Background forcing temperature ("an anomalous temperature relative to the present conditions)
++% ACCdot : Accumulation rate in units of [m/a] ice equivalent
++% ABLdot : Surface ablation rate in [m/a] ice equivalent
++
++	%Double check lat and long exist:
++	if isnan(md.mesh.lat),
++		error('PattynSMB error message: md.mesh.lat field required');
++	end
++
++	%Delta Temperature forcing 
++	if (nargin==1),
++		Tf=0; 
++	end
++
++	% Calculate mean annual surface temperature, Eqn (11)
++	% Here, -0.012 is the atmospheric Lapse rate from sea level in deg/m.
++	% It is multiplied by surface elevation from sea level
++	Tma = -15.15 - 0.012*md.geometry.surface;
++
++	%% Calculate summer temperature, Eqn (12)
++	%% No melting at PIG in mean conditions - need about 6 degress Tf to start having a negative yearly SMB
++	Tms = 16.81 - 0.00692*md.geometry.surface - 0.27937*abs(md.mesh.lat) + Tf;
++
++	%% Calculate Accumulation perturbation with Tf forcing, Eqn (9)
++	ACCdot = 2.5*2.^((Tma+Tf)/10.) - 2.5*2.^(Tma/10.);
++
++	%% Calculate Ablation, Eqn (10) (use for both Antarctica & Greenland), max melt is 10m/a
++	ABLdot=zeros(size(ACCdot));
++	pos=Tms>=0;
++	ABLdot(pos)=min(1.4*Tms(Tms>=0),10);
++
++	smb=ACCdot-ABLdot;
++end
Index: issm/oecreview/Archive/16554-17801/ISSM-17567-17568.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17567-17568.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17567-17568.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/m/plot/applyoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/applyoptions.m	(revision 17567)
++++ ../trunk-jpl/src/m/plot/applyoptions.m	(revision 17568)
+@@ -428,6 +428,7 @@
+ 	markersize=getfieldvalue(options,'markersize',5);
+ 	color=getfieldvalue(options,'cloudcolor','k');
+ 	set(p,'Color',color);
++	set(p,'MarkerSize',markersize);
+ end
+ 
+ %========================%
Index: issm/oecreview/Archive/16554-17801/ISSM-17568-17569.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17568-17569.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17568-17569.diff	(revision 17802)
@@ -0,0 +1,24 @@
+Index: ../trunk-jpl/src/m/solve/waitonlock.py
+===================================================================
+--- ../trunk-jpl/src/m/solve/waitonlock.py	(revision 17568)
++++ ../trunk-jpl/src/m/solve/waitonlock.py	(revision 17569)
+@@ -1,5 +1,5 @@
+ import os
+-import socket
++from socket import gethostname
+ import time
+ import MatlabFuncs as m
+ 
+Index: ../trunk-jpl/src/m/solve/waitonlock.m
+===================================================================
+--- ../trunk-jpl/src/m/solve/waitonlock.m	(revision 17568)
++++ ../trunk-jpl/src/m/solve/waitonlock.m	(revision 17569)
+@@ -60,7 +60,7 @@
+ 		ispresent=(exist(lockfilename,'file') & exist(logfilename,'file'));
+ 		time=etime(clock,time0)/60;
+ 	else
+-		pause(10);
++		pause(5);
+ 		time=etime(clock,time0);
+ 		fprintf('\rchecking for job completion (time: %i min %i sec)      ',floor(time/60),floor(rem(time,60)));
+ 		time=time/60; %converts time from sec to min
Index: issm/oecreview/Archive/16554-17801/ISSM-17569-17570.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17569-17570.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17569-17570.diff	(revision 17802)
@@ -0,0 +1,22 @@
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp	(revision 17569)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp	(revision 17570)
+@@ -31,7 +31,7 @@
+ 
+ 	/*Convergence criterion*/
+ 	int count = 0;
+-	femmodel->parameters->SetParam(10.,AugmentedLagrangianREnum);
++	femmodel->parameters->SetParam(reCast<IssmDouble>(10.),AugmentedLagrangianREnum);
+ 
+ 	while(true){
+ 
+@@ -44,7 +44,7 @@
+ 		Mergesolutionfromftogx(&ug, uf,ys,femmodel->nodes,femmodel->parameters);delete uf; delete ys;
+ 
+ 		/*Update solution*/
+-		printf("ug norm = %g\n",ug->Norm(NORM_TWO));
++		_printf_("ug norm = " << ug->Norm(NORM_TWO) << "\n");
+ 		InputUpdateFromSolutionx(femmodel,ug); 
+ 
+ 		/*Update d and tau accordingly*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17570-17571.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17570-17571.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17570-17571.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/solve/waitonlock.m
+===================================================================
+--- ../trunk-jpl/src/m/solve/waitonlock.m	(revision 17570)
++++ ../trunk-jpl/src/m/solve/waitonlock.m	(revision 17571)
+@@ -16,7 +16,7 @@
+ timelimit     = md.settings.waitonlock;
+ cluster       = md.cluster;
+ 
+-if ~isa(cluster,'generic') & cluster.interactive,
++if isa(cluster,'pfe')
+ 	lockfilename  = [executionpath '/Interactive' num2str(cluster.interactive) '/' md.miscellaneous.name '.lock'];
+ 	logfilename   = [executionpath '/Interactive' num2str(cluster.interactive) '/' md.miscellaneous.name '.outlog'];
+ else
Index: issm/oecreview/Archive/16554-17801/ISSM-17571-17572.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17571-17572.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17571-17572.diff	(revision 17802)
@@ -0,0 +1,102 @@
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17571)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17572)
+@@ -626,11 +626,12 @@
+ 	AugmentedLagrangianREnum,
+ 	/*}}}*/
+ 	/*Grounding Line{{{*/
++	NoneEnum,
+ 	AgressiveMigrationEnum,
+-	NoneEnum,
+ 	SoftMigrationEnum,
+ 	SubelementMigrationEnum,
+ 	SubelementMigration2Enum,
++	ContactEnum,
+ 	MaskGroundediceLevelsetEnum,
+ 	QmuMaskGroundediceLevelsetEnum,
+ 	/*}}}*/
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17571)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17572)
+@@ -603,11 +603,12 @@
+ 		case AbsoluteEnum : return "Absolute";
+ 		case IncrementalEnum : return "Incremental";
+ 		case AugmentedLagrangianREnum : return "AugmentedLagrangianR";
++		case NoneEnum : return "None";
+ 		case AgressiveMigrationEnum : return "AgressiveMigration";
+-		case NoneEnum : return "None";
+ 		case SoftMigrationEnum : return "SoftMigration";
+ 		case SubelementMigrationEnum : return "SubelementMigration";
+ 		case SubelementMigration2Enum : return "SubelementMigration2";
++		case ContactEnum : return "Contact";
+ 		case MaskGroundediceLevelsetEnum : return "MaskGroundediceLevelset";
+ 		case QmuMaskGroundediceLevelsetEnum : return "QmuMaskGroundediceLevelset";
+ 		case GaussSegEnum : return "GaussSeg";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17571)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17572)
+@@ -615,11 +615,12 @@
+ 	      else if (strcmp(name,"Absolute")==0) return AbsoluteEnum;
+ 	      else if (strcmp(name,"Incremental")==0) return IncrementalEnum;
+ 	      else if (strcmp(name,"AugmentedLagrangianR")==0) return AugmentedLagrangianREnum;
++	      else if (strcmp(name,"None")==0) return NoneEnum;
+ 	      else if (strcmp(name,"AgressiveMigration")==0) return AgressiveMigrationEnum;
+-	      else if (strcmp(name,"None")==0) return NoneEnum;
+ 	      else if (strcmp(name,"SoftMigration")==0) return SoftMigrationEnum;
+ 	      else if (strcmp(name,"SubelementMigration")==0) return SubelementMigrationEnum;
+ 	      else if (strcmp(name,"SubelementMigration2")==0) return SubelementMigration2Enum;
++	      else if (strcmp(name,"Contact")==0) return ContactEnum;
+ 	      else if (strcmp(name,"MaskGroundediceLevelset")==0) return MaskGroundediceLevelsetEnum;
+ 	      else if (strcmp(name,"QmuMaskGroundediceLevelset")==0) return QmuMaskGroundediceLevelsetEnum;
+ 	      else if (strcmp(name,"GaussSeg")==0) return GaussSegEnum;
+@@ -627,11 +628,11 @@
+ 	      else if (strcmp(name,"GaussTetra")==0) return GaussTetraEnum;
+ 	      else if (strcmp(name,"GaussPenta")==0) return GaussPentaEnum;
+ 	      else if (strcmp(name,"FSSolver")==0) return FSSolverEnum;
+-	      else if (strcmp(name,"Adjoint")==0) return AdjointEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"Colinear")==0) return ColinearEnum;
++	      if (strcmp(name,"Adjoint")==0) return AdjointEnum;
++	      else if (strcmp(name,"Colinear")==0) return ColinearEnum;
+ 	      else if (strcmp(name,"ControlSteady")==0) return ControlSteadyEnum;
+ 	      else if (strcmp(name,"Fset")==0) return FsetEnum;
+ 	      else if (strcmp(name,"Gradient1")==0) return Gradient1Enum;
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17571)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17572)
+@@ -595,11 +595,12 @@
+ def AbsoluteEnum(): return StringToEnum("Absolute")[0]
+ def IncrementalEnum(): return StringToEnum("Incremental")[0]
+ def AugmentedLagrangianREnum(): return StringToEnum("AugmentedLagrangianR")[0]
++def NoneEnum(): return StringToEnum("None")[0]
+ def AgressiveMigrationEnum(): return StringToEnum("AgressiveMigration")[0]
+-def NoneEnum(): return StringToEnum("None")[0]
+ def SoftMigrationEnum(): return StringToEnum("SoftMigration")[0]
+ def SubelementMigrationEnum(): return StringToEnum("SubelementMigration")[0]
+ def SubelementMigration2Enum(): return StringToEnum("SubelementMigration2")[0]
++def ContactEnum(): return StringToEnum("Contact")[0]
+ def MaskGroundediceLevelsetEnum(): return StringToEnum("MaskGroundediceLevelset")[0]
+ def QmuMaskGroundediceLevelsetEnum(): return StringToEnum("QmuMaskGroundediceLevelset")[0]
+ def GaussSegEnum(): return StringToEnum("GaussSeg")[0]
+Index: ../trunk-jpl/src/m/enum/ContactEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/ContactEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/ContactEnum.m	(revision 17572)
+@@ -0,0 +1,11 @@
++function macro=ContactEnum()
++%CONTACTENUM - Enum of Contact
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=ContactEnum()
++
++macro=StringToEnum('Contact');
Index: issm/oecreview/Archive/16554-17801/ISSM-17572-17573.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17572-17573.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17572-17573.diff	(revision 17802)
@@ -0,0 +1,15 @@
+Index: ../trunk-jpl/test/NightlyRun/test435.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test435.m	(revision 17572)
++++ ../trunk-jpl/test/NightlyRun/test435.m	(revision 17573)
+@@ -47,8 +47,8 @@
+ 	'Bed2','Surface2','Thickness2','Floatingice2','Vx2','Vy2','Vz2','Pressure2',...
+ 	'Bed3','Surface3','Thickness3','Floatingice3','Vx3','Vy3','Vz3','Pressure3'};
+ field_tolerances={1e-11,3e-12,1e-11,1e-11,3e-10,1e-08,3e-10,1e-13,...
+-	1e-11,3e-12,9e-12,2e-11,1e-09,1e-08,2e-10,1e-10,...
+-	1e-10,3e-11,1e-10,7e-11,1e-09,1e-08,1e-09,1e-11};
++	2e-11,3e-12,9e-10,2e-11,1e-09,1e-08,3e-10,1e-10,...
++	1e-10,3e-11,1e-10,7e-11,1e-09,1e-08,1e-09,2e-11};
+ field_values={...
+ 	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
Index: issm/oecreview/Archive/16554-17801/ISSM-17573-17574.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17573-17574.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17573-17574.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/solve/waitonlock.py
+===================================================================
+--- ../trunk-jpl/src/m/solve/waitonlock.py	(revision 17573)
++++ ../trunk-jpl/src/m/solve/waitonlock.py	(revision 17574)
+@@ -23,7 +23,7 @@
+ 	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 m.strcmpi(socket.gethostname(),cluster):
++	if not m.strcmpi(gethostname(),cluster):
+ 
+ 		print 'solution launched on remote cluster. log in to detect job completion.'
+ 		choice=raw_input('Is the job successfully completed? (y/n) ')
Index: issm/oecreview/Archive/16554-17801/ISSM-17574-17575.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17574-17575.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17574-17575.diff	(revision 17802)
@@ -0,0 +1,38 @@
+Index: ../trunk-jpl/src/m/miscellaneous/vorticity.m
+===================================================================
+--- ../trunk-jpl/src/m/miscellaneous/vorticity.m	(revision 0)
++++ ../trunk-jpl/src/m/miscellaneous/vorticity.m	(revision 17575)
+@@ -0,0 +1,33 @@
++function rot = vorticity(vx,vy)
++%VORTICITY - calculates 2d vorticity
++%
++%   rot = d/dx(vy) - d/dy(vx)
++%
++%   Usage:
++%      rot = vorticity(vx,vy)
++
++
++%load some variables (it is much faster if the variab;es are loaded from md once for all) 
++if ~strcmpi(md.mesh.meshtype(),'3D'),
++	numberofelements=md.mesh.numberofelements;
++	numberofnodes=md.mesh.numberofvertices;
++	index=md.mesh.elements;
++	x=md.mesh.x; y=md.mesh.y;
++else
++	numberofelements=md.mesh.numberofelements2d;
++	numberofnodes=md.mesh.numberofvertices2d;
++	index=md.mesh.elements2d;
++	x=md.mesh.x2d; y=md.mesh.y2d;
++end
++
++%compute nodal functions coefficients N(x,y)=alpha x + beta y + gamma
++[alpha beta]=GetNodalFunctionsCoeff(index,x,y);
++
++summation=[1;1;1];
++dvydx=(vy(index).*alpha)*summation;
++dvxdy=(vx(index).*beta)*summation;
++rot=dvxdy - dvydx;
++
++if md.mesh.dimension==3,
++	rot=project3d(md,'vector',rot,'type','element');
++end
Index: issm/oecreview/Archive/16554-17801/ISSM-17575-17576.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17575-17576.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17575-17576.diff	(revision 17802)
@@ -0,0 +1,16 @@
+Index: ../trunk-jpl/src/m/plot/processmesh.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/processmesh.m	(revision 17575)
++++ ../trunk-jpl/src/m/plot/processmesh.m	(revision 17576)
+@@ -36,8 +36,10 @@
+ 	z=md.(z_field);
+ elseif isnumeric(z_field),
+ 	z=z_field;
++elseif isprop(md.mesh,'z'),
++	z=md.mesh.z;
+ else
+-	z=md.mesh.z;
++	z=zeros(size(x));
+ end
+ 
+ if isprop(md.mesh,'elements2d'), elements2d=md.mesh.elements2d; end
Index: issm/oecreview/Archive/16554-17801/ISSM-17576-17577.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17576-17577.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17576-17577.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/src/m/plot/processmesh.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/processmesh.m	(revision 17576)
++++ ../trunk-jpl/src/m/plot/processmesh.m	(revision 17577)
+@@ -31,16 +31,15 @@
+ 	y=md.mesh.lat;
+ end
+ 
+-z_field=getfieldvalue(options,'z',md.mesh.z);
+-if ischar(z_field),
+-	z=md.(z_field);
+-elseif isnumeric(z_field),
+-	z=z_field;
+-elseif isprop(md.mesh,'z'),
++if isprop(md.mesh,'z'),
+ 	z=md.mesh.z;
+ else
+ 	z=zeros(size(x));
+ end
++z=getfieldvalue(options,'z',z);
++if ischar(z_field),
++	z=md.(z);
++end
+ 
+ if isprop(md.mesh,'elements2d'), elements2d=md.mesh.elements2d; end
+ elements=md.mesh.elements;
Index: issm/oecreview/Archive/16554-17801/ISSM-17577-17578.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17577-17578.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17577-17578.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/plot/processmesh.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/processmesh.m	(revision 17577)
++++ ../trunk-jpl/src/m/plot/processmesh.m	(revision 17578)
+@@ -37,7 +37,7 @@
+ 	z=zeros(size(x));
+ end
+ z=getfieldvalue(options,'z',z);
+-if ischar(z_field),
++if ischar(z),
+ 	z=md.(z);
+ end
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17578-17579.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17578-17579.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17578-17579.diff	(revision 17802)
@@ -0,0 +1,199 @@
+Index: ../trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp	(revision 17578)
++++ ../trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp	(revision 17579)
+@@ -22,21 +22,26 @@
+ 
+ 	if(migration_style==NoneEnum) return;
+ 
+-	if(migration_style!=AgressiveMigrationEnum  &&
+-		migration_style!=SoftMigrationEnum       &&
+-		migration_style!=SubelementMigrationEnum &&
+-		migration_style!=SubelementMigration2Enum)
+-	 _error_("Grounding line migration "<<EnumToStringx(migration_style) << " not supported yet!");
+-
+ 	/*Set toolkit to default*/
+ 	ToolkitsOptionsFromAnalysis(parameters,DefaultAnalysisEnum);
+ 
+-	if(migration_style==SoftMigrationEnum){
+-		/*Create flag for grounded vertices above the hydrostatic equilibrium: */
+-		vertices_potentially_ungrounding=PotentialUngrounding(elements,vertices,parameters);
+-
+-		/*propagate ice shelf into connex areas of the ice sheet that potentially want to unground: */
+-		phi_ungrounding=PropagateFloatingiceToGroundedNeighbors(elements,nodes,vertices,parameters,vertices_potentially_ungrounding);
++	switch(migration_style){
++		case SoftMigrationEnum:
++			/*Create flag for grounded vertices above the hydrostatic equilibrium: */
++			vertices_potentially_ungrounding=PotentialUngrounding(elements,vertices,parameters);
++			/*propagate ice shelf into connex areas of the ice sheet that potentially want to unground: */
++			phi_ungrounding=PropagateFloatingiceToGroundedNeighbors(elements,nodes,vertices,parameters,vertices_potentially_ungrounding);
++			break;
++		case ContactEnum:
++			phi_ungrounding=ContactFSLevelset(elements,vertices);
++			break;
++		case AgressiveMigrationEnum:
++		case SubelementMigrationEnum:
++		case SubelementMigration2Enum:
++			/*Nothing additional to do here, MigrateGroundingLine takes care of everything*/
++			break;
++		default:
++			_error_("Grounding line migration "<<EnumToStringx(migration_style) << " not supported yet!");
+ 	}
+ 
+ 	/*Migrate grounding line : */
+@@ -50,6 +55,57 @@
+ 	xDelete<IssmDouble>(phi_ungrounding);
+ }
+ 
++/*FUNCTION ContactFSLevelset{{{*/
++IssmDouble*    ContactFSLevelset(Elements* elements,Vertices* vertices){ 
++
++	Vector<IssmDouble>* vertexgrounded = NULL;
++	Vector<IssmDouble>* vertexfloating = NULL;
++	IssmDouble*  serial_vertexgrounded = NULL;
++	IssmDouble*  serial_vertexfloating = NULL;
++	IssmDouble*  phi                   = NULL;
++
++	/*Initialize vector with number of vertices*/
++	int numberofvertices=vertices->NumberOfVertices();
++	vertexgrounded=new Vector<IssmDouble>(numberofvertices);
++	vertexfloating=new Vector<IssmDouble>(numberofvertices);
++	phi           =xNew<IssmDouble>(numberofvertices);
++
++	/*Fill vector vertices_potentially_floating: */
++	for(int i=0;i<elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
++		element->FSContactMigration(vertexgrounded,vertexfloating);
++	}
++
++	/*Assemble vector and serialize */
++	vertexgrounded->Assemble();
++	vertexfloating->Assemble();
++	serial_vertexgrounded=vertexgrounded->ToMPISerial();
++	serial_vertexfloating=vertexfloating->ToMPISerial();
++
++	for(int i=0;i<numberofvertices;i++){
++		if(serial_vertexgrounded[i]==1. && serial_vertexfloating[i]==1.){
++			phi[i]=0.;
++		}
++		else if(serial_vertexgrounded[i]==1.){
++			phi[i]=1.;
++		}
++		else if(serial_vertexfloating[i]==1.){
++			phi[i]=-1.;
++		}
++		else{
++			_error_("not supported");
++		}
++	}
++
++	/*free ressouces and return: */
++	delete vertexgrounded;
++	delete vertexfloating;
++	xDelete<IssmDouble>(serial_vertexgrounded);
++	xDelete<IssmDouble>(serial_vertexfloating);
++
++	return phi;
++}
++/*}}}*/
+ /*FUNCTION PotentialUngrounding {{{*/
+ IssmDouble*    PotentialUngrounding(Elements* elements,Vertices* vertices,Parameters* parameters){ 
+ 
+Index: ../trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.h	(revision 17578)
++++ ../trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.h	(revision 17579)
+@@ -12,6 +12,7 @@
+ 
+ /* local prototypes: */
+ void         GroundinglineMigrationx(Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters);
++IssmDouble*  ContactFSLevelset(Elements* elements,Vertices* vertices);
+ IssmDouble*  PotentialUngrounding(Elements* elements,Vertices* vertices,Parameters* parameters);
+ IssmDouble*  PropagateFloatingiceToGroundedNeighbors(Elements* elements,Nodes* nodes,Vertices* vertices,Parameters* parameters,IssmDouble* vertices_potentially_ungrounding);
+ #endif  /* _GROUNDINGLINEMIGRATIONX_H */
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17578)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17579)
+@@ -294,6 +294,7 @@
+ 		virtual void UpdateConstraintsExtrudeFromTop(void)=0;
+ 
+ 		virtual void   MigrateGroundingLine(IssmDouble* sheet_ungrounding)=0;
++		virtual void   FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating)=0;
+ 		virtual void   PotentialUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding)=0;
+ 		virtual int    UpdatePotentialUngrounding(IssmDouble* potential_sheet_ungrounding,Vector<IssmDouble>* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf)=0;
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17578)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17579)
+@@ -58,6 +58,7 @@
+ 		void        SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters);
+ 		void        Delta18oParameterization(void);
+ 		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz);
++		void        FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating){_error_("not implemented yet");};
+ 		int         FiniteElement(void);
+ 		Element*    GetUpperElement(void){_error_("not implemented yet");};
+ 	  	Element*    GetLowerElement(void){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17578)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17579)
+@@ -59,6 +59,7 @@
+ 		void   Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
+ 		void   ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz);
+ 		int    FiniteElement(void);
++		void   FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating){_error_("not implemented yet");};
+ 		void   SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters);
+ 		void   Delta18oParameterization(void);
+ 		Penta* GetUpperPenta(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17578)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17579)
+@@ -59,6 +59,7 @@
+ 		void        SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters){_error_("not implemented yet");};
+ 		void        Delta18oParameterization(void){_error_("not implemented yet");};
+ 		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){_error_("not implemented yet");};
++		void        FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating){_error_("not implemented yet");};
+ 		int         FiniteElement(void);
+ 		Element*    GetUpperElement(void){_error_("not implemented yet");};
+ 	  	Element*    GetLowerElement(void){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17578)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17579)
+@@ -62,6 +62,7 @@
+ 		void        FaceOnFrontIndices(int* pindex1,int* pindex2,int* pindex3);
+ 		void        FaceOnBedIndices(int* pindex1,int* pindex2,int* pindex3);
+ 		void        FaceOnSurfaceIndices(int* pindex1,int* pindex2,int* pindex3);
++		void        FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating){_error_("not implemented yet");};
+ 		int         FiniteElement(void);
+ 		Element*    GetUpperElement(void){_error_("not implemented yet");};
+ 	  	Element*    GetLowerElement(void){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/m/classes/groundingline.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/groundingline.py	(revision 17578)
++++ ../trunk-jpl/src/m/classes/groundingline.py	(revision 17579)
+@@ -41,7 +41,7 @@
+ 	#}}}
+ 	def checkconsistency(self,md,solution,analyses):    # {{{
+ 
+-		md = checkfield(md,'fieldname','groundingline.migration','values',['None','AgressiveMigration','SoftMigration','SubelementMigration','SubelementMigration2'])
++		md = checkfield(md,'fieldname','groundingline.migration','values',['None','AgressiveMigration','SoftMigration','SubelementMigration','SubelementMigration2' 'Contact'])
+ 
+ 		if not m.strcmp(self.migration,'None'):
+ 			if numpy.any(numpy.isnan(md.geometry.bathymetry)):
+Index: ../trunk-jpl/src/m/classes/groundingline.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/groundingline.m	(revision 17578)
++++ ../trunk-jpl/src/m/classes/groundingline.m	(revision 17579)
+@@ -28,7 +28,7 @@
+ 		end % }}}
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+ 
+-			md = checkfield(md,'fieldname','groundingline.migration','values',{'None' 'AgressiveMigration' 'SoftMigration' 'SubelementMigration','SubelementMigration2'});
++			md = checkfield(md,'fieldname','groundingline.migration','values',{'None' 'AgressiveMigration' 'SoftMigration' 'SubelementMigration','SubelementMigration2' 'Contact'});
+ 
+ 			if ~strcmp(obj.migration,'None'),
+ 				if isnan(md.geometry.bathymetry),
Index: issm/oecreview/Archive/16554-17801/ISSM-17579-17580.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17579-17580.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17579-17580.diff	(revision 17802)
@@ -0,0 +1,18 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17579)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17580)
+@@ -4262,6 +4262,13 @@
+ 	density     = rho_ice/rho_water;
+ 	oldfloating = this->IsFloating(); //figure out if element is floating before we start to change everything
+ 
++	if(migration_style==ContactEnum){
++		this->inputs->AddInput(new TriaInput(MaskGroundediceLevelsetEnum,&phi[0],P1Enum));
++		return;
++	}
++
++	this->inputs->AddInput(new TriaInput(MaskGroundediceLevelsetEnum,&phi[0],P1Enum));
++
+ 	/*go through vertices, and update inputs, considering them to be TriaVertex type: */
+ 	for(i=0;i<NUMVERTICES;i++){
+ 		/*Ice shelf: if bed below bathymetry, impose it at the bathymetry and update surface, elso do nothing */
Index: issm/oecreview/Archive/16554-17801/ISSM-17580-17581.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17580-17581.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17580-17581.diff	(revision 17802)
@@ -0,0 +1,10 @@
+Index: ../trunk-jpl/src/m/plot/processmesh.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/processmesh.py	(revision 17580)
++++ ../trunk-jpl/src/m/plot/processmesh.py	(revision 17581)
+@@ -1,4 +1,5 @@
+ from math import isnan
++import MatlabFuncs as m
+ 
+ def processmesh(md,data,options):
+ 	"""
Index: issm/oecreview/Archive/16554-17801/ISSM-17581-17582.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17581-17582.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17581-17582.diff	(revision 17802)
@@ -0,0 +1,63 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17581)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17582)
+@@ -1315,6 +1315,37 @@
+ 	_error_("Could not find 2 vertices on surface");
+ }
+ /*}}}*/
++/*FUNCTION Tria::FSContactMigration{{{*/
++void Tria::FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating){
++
++	if(!IsOnBed()) return;
++
++	/*Intermediaries*/
++	IssmDouble* xyz_list = NULL;
++
++	/*Figure out wether element is grounded or floating*/
++	bool grounded = true;
++
++	/* Get node coordinates and dof list: */
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++
++	/*Retrieve all inputs we will be needing: */
++	Input* pressure_input=inputs->GetInput(PressureEnum); _assert_(pressure_input);
++	Input* vx_input=inputs->GetInput(VxEnum);             _assert_(vx_input);
++	Input* vy_input=inputs->GetInput(VyEnum);             _assert_(vy_input);
++
++	_error_("STOP");
++
++	for(i=0;i<NUMVERTICES;i++){
++		if(grounded) vertexgrounded->SetValue(vertices[i]->Pid(),+1.,INS_VAL);
++		else         vertexfloating->SetValue(vertices[i]->Pid(),+1.,INS_VAL);
++	}
++
++	/*clean up*/
++	xDelete<IssmDouble>(xyz_list);
++
++}
++/*}}}*/
+ /*FUNCTION Tria::IsNodeOnShelfFromFlags {{{*/
+ bool   Tria::IsNodeOnShelfFromFlags(IssmDouble* flags){
+ 
+@@ -4263,6 +4294,7 @@
+ 	oldfloating = this->IsFloating(); //figure out if element is floating before we start to change everything
+ 
+ 	if(migration_style==ContactEnum){
++		for(i=0;i<NUMVERTICES;i++) phi[i]=phi_ungrounding[vertices[i]->Pid()];
+ 		this->inputs->AddInput(new TriaInput(MaskGroundediceLevelsetEnum,&phi[0],P1Enum));
+ 		return;
+ 	}
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17581)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17582)
+@@ -58,7 +58,7 @@
+ 		void        SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters);
+ 		void        Delta18oParameterization(void);
+ 		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz);
+-		void        FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating){_error_("not implemented yet");};
++		void        FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating);
+ 		int         FiniteElement(void);
+ 		Element*    GetUpperElement(void){_error_("not implemented yet");};
+ 	  	Element*    GetLowerElement(void){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-17582-17583.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17582-17583.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17582-17583.diff	(revision 17802)
@@ -0,0 +1,22 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17582)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17583)
+@@ -1327,7 +1327,7 @@
+ 	bool grounded = true;
+ 
+ 	/* Get node coordinates and dof list: */
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	::GetVerticesCoordinates(xyz_list,vertices,NUMVERTICES);
+ 
+ 	/*Retrieve all inputs we will be needing: */
+ 	Input* pressure_input=inputs->GetInput(PressureEnum); _assert_(pressure_input);
+@@ -1336,7 +1336,7 @@
+ 
+ 	_error_("STOP");
+ 
+-	for(i=0;i<NUMVERTICES;i++){
++	for(int i=0;i<NUMVERTICES;i++){
+ 		if(grounded) vertexgrounded->SetValue(vertices[i]->Pid(),+1.,INS_VAL);
+ 		else         vertexfloating->SetValue(vertices[i]->Pid(),+1.,INS_VAL);
+ 	}
Index: issm/oecreview/Archive/16554-17801/ISSM-17583-17584.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17583-17584.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17583-17584.diff	(revision 17802)
@@ -0,0 +1,43 @@
+Index: ../trunk-jpl/test/Archives/Archive703.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17583)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17584)
+@@ -365,6 +365,32 @@
+ 	element->InputUpdateFromSolutionOneDof(solution,BaseEnum);
+ }/*}}}*/
+ void FreeSurfaceBaseAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+-	/*Default, do nothing*/
+-	return;
++
++	/*Intermediary*/
++	IssmDouble phi,isonbed,base;
++
++	for(int i=0;i<femmodel->elements->Size();i++){
++
++		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++		if(!element->IsOnBed()) continue;
++
++		int             numnodes = element->GetNumberOfNodes();
++		Input* groundedice_input = element->GetInput(MaskGroundediceLevelsetEnum);  _assert_(groundedice_input);
++		Input* onbed_input       = element->GetInput(MeshVertexonbedEnum);          _assert_(onbed_input);
++		Input* base_input        = element->GetInput(BaseEnum);                     _assert_(base_input);
++
++		Gauss* gauss=element->NewGauss();
++		for(int iv=0;iv<numnodes;iv++){
++			gauss->GaussNode(element->GetElementType(),iv);
++			onbed_input->GetInputValue(&isonbed,gauss);
++			if(isonbed==1.){
++				groundedice_input->GetInputValue(&phi,gauss);
++				if(phi>=0.){
++					base_input->GetInputValue(&base,gauss);
++					element->nodes[iv]->ApplyConstraint(1,base);
++				}
++			}
++		}
++		delete gauss;
++	}
+ }/*}}}*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17584-17585.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17584-17585.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17584-17585.diff	(revision 17802)
@@ -0,0 +1,1380 @@
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 17584)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 17585)
+@@ -125,7 +125,7 @@
+ }/*}}}*/
+ ElementMatrix* BalancethicknessAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+-	if(!element->IsOnBed()) return NULL;
++	if(!element->IsOnBase()) return NULL;
+ 	Element* basalelement = element->SpawnBasalElement();
+ 
+ 	ElementMatrix* Ke = NULL;
+@@ -317,7 +317,7 @@
+ }/*}}}*/
+ ElementVector* BalancethicknessAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+-	if(!element->IsOnBed()) return NULL;
++	if(!element->IsOnBase()) return NULL;
+ 	Element* basalelement = element->SpawnBasalElement();
+ 
+ 	ElementVector* pe = NULL;
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17584)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17585)
+@@ -120,7 +120,7 @@
+ 			basalelement = element;
+ 			break;
+ 		case Mesh3DEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+@@ -224,7 +224,7 @@
+ 			basalelement = element;
+ 			break;
+ 		case Mesh3DEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+@@ -322,7 +322,7 @@
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+ 
+ 	if(meshtype!=Mesh2DhorizontalEnum){
+-		if(!element->IsOnBed()) return;
++		if(!element->IsOnBase()) return;
+ 		basalelement=element->SpawnBasalElement();
+ 	}
+ 	else{
+@@ -493,7 +493,7 @@
+ 		
+ 		switch(meshtype){
+ 		case Mesh2DhorizontalEnum:
+-			if(!element->IsOnBed()) return;			
++			if(!element->IsOnBase()) return;			
+ 			B = element->GetMaterialParameter(MaterialsRheologyBbarEnum);
+ 			break;
+ 		case Mesh3DEnum:
+@@ -613,7 +613,7 @@
+ 			basalelement = element;
+ 			break;
+ 		case Mesh3DEnum:
+-			if(!element->IsOnBed()) return;
++			if(!element->IsOnBase()) return;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+@@ -693,7 +693,7 @@
+ 			basalelement = element;
+ 			break;
+ 		case Mesh3DEnum:
+-			if(!element->IsOnBed()) return;
++			if(!element->IsOnBase()) return;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 17584)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 17585)
+@@ -64,7 +64,7 @@
+ 			basalelement = element;
+ 			break;
+ 		case Mesh3DEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+@@ -693,7 +693,7 @@
+ 			basalelement = element;
+ 			break;
+ 		case Mesh3DEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17584)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17585)
+@@ -83,7 +83,7 @@
+ }/*}}}*/
+ ElementMatrix* LevelsetAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+-	if(!element->IsOnBed()) return NULL;
++	if(!element->IsOnBase()) return NULL;
+ 	Element* basalelement = element->SpawnBasalElement();
+ 
+ 	/*Intermediaries */
+@@ -252,7 +252,7 @@
+ }/*}}}*/
+ ElementVector* LevelsetAnalysis::CreatePVector(Element* element){/*{{{*/
+ 	
+-	if(!element->IsOnBed()) return NULL;
++	if(!element->IsOnBase()) return NULL;
+ 	Element* basalelement = element->SpawnBasalElement();
+ 
+ 	/*Intermediaries */
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 17584)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 17585)
+@@ -277,7 +277,7 @@
+ 	IssmDouble  Jdet,slope[3];
+ 	IssmDouble  vx,vy,vz=0.,dbdx,dbdy,basalmeltingvalue;
+ 
+-	if(!element->IsOnBed()) return NULL;
++	if(!element->IsOnBase()) return NULL;
+ 
+ 	/*Fetch number of nodes for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+Index: ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 17584)
++++ ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 17585)
+@@ -84,7 +84,7 @@
+ ElementMatrix* MeltingAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/*Get basal element*/
+-	if(!element->IsOnBed()) return NULL;
++	if(!element->IsOnBase()) return NULL;
+ 	Element* basalelement = element->SpawnBasalElement();
+ 
+ 	/*Intermediaries */
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 17584)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 17585)
+@@ -162,7 +162,7 @@
+ /*}}}*/
+ ElementMatrix* ExtrudeFromBaseAnalysis::CreateKMatrixBed(Element* element){/*{{{*/
+ 
+-	if(!element->IsOnBed()) return NULL;
++	if(!element->IsOnBase()) return NULL;
+ 
+ 	/*Intermediaries */
+ 	IssmDouble  Jdet,D,normal[3];
+Index: ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 17584)
++++ ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 17585)
+@@ -58,7 +58,7 @@
+ 			basalelement = element;
+ 			break;
+ 		case Mesh3DEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 17584)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 17585)
+@@ -93,11 +93,11 @@
+ 			basalelement = element;
+ 			break;
+ 		case Mesh2DverticalEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+ 		case Mesh3DEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+@@ -165,7 +165,7 @@
+ 			basalelement = element;
+ 			break;
+ 		case Mesh3DEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17584)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17585)
+@@ -243,7 +243,7 @@
+ 	/* Check if ice in element */
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+-	if(!element->IsOnBed()) return NULL;
++	if(!element->IsOnBase()) return NULL;
+ 	Element* basalelement = element->SpawnBasalElement();
+ 
+ 	ElementMatrix* Ke = NULL;
+@@ -489,7 +489,7 @@
+ 	/* Check if ice in element */
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+-	if(!element->IsOnBed()) return NULL;
++	if(!element->IsOnBase()) return NULL;
+ 	Element* basalelement = element->SpawnBasalElement();
+ 
+ 	ElementVector* pe = NULL;
+@@ -676,7 +676,7 @@
+ 
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+ 	if(meshtype!=Mesh2DhorizontalEnum){
+-		if(!element->IsOnBed()) return;
++		if(!element->IsOnBase()) return;
+ 		basalelement=element->SpawnBasalElement();
+ 	}
+ 	else{
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 17584)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 17585)
+@@ -114,7 +114,7 @@
+ 			basalelement = element;
+ 			break;
+ 		case Mesh3DEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 17584)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 17585)
+@@ -114,7 +114,7 @@
+ 			basalelement = element;
+ 			break;
+ 		case Mesh3DEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 17584)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 17585)
+@@ -162,7 +162,7 @@
+ /*}}}*/
+ ElementMatrix* ExtrudeFromTopAnalysis::CreateKMatrixBed(Element* element){/*{{{*/
+ 
+-	if(!element->IsOnBed()) return NULL;
++	if(!element->IsOnBase()) return NULL;
+ 
+ 	/*Intermediaries */
+ 	IssmDouble  Jdet,D,normal[3];
+Index: ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 17584)
++++ ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 17585)
+@@ -157,7 +157,7 @@
+ 			basalelement = element;
+ 			break;
+ 		case Mesh3DEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 17584)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 17585)
+@@ -77,15 +77,15 @@
+ 			basalelement = element;
+ 			break;
+ 		case Mesh2DverticalEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+ 		case Mesh3DEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+ 		case Mesh3DtetrasEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+@@ -140,15 +140,15 @@
+ 			basalelement = element;
+ 			break;
+ 		case Mesh2DverticalEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+ 		case Mesh3DEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+ 		case Mesh3DtetrasEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 17584)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 17585)
+@@ -226,7 +226,7 @@
+ 		j0=2*nodeup;    j1=2*nodeup+1;
+ 
+ 		/*Create matrix for these two nodes*/
+-		if(element->IsOnBed() && element->IsOnSurface()){
++		if(element->IsOnBase() && element->IsOnSurface()){
+ 			Ke->values[i0*numdof+i0] = +one0;
+ 			Ke->values[i1*numdof+i1] = +one0;
+ 			Ke->values[j0*numdof+i0] = -one1;
+@@ -234,7 +234,7 @@
+ 			Ke->values[j1*numdof+i1] = -one1;
+ 			Ke->values[j1*numdof+j1] = +one1;
+ 		}
+-		else if(element->IsOnBed()){
++		else if(element->IsOnBase()){
+ 			Ke->values[i0*numdof+i0] = one0;
+ 			Ke->values[i1*numdof+i1] = one0;
+ 			Ke->values[j0*numdof+i0] = -2.*one1;
+@@ -418,7 +418,7 @@
+ 		}
+ 
+ 		/*Deal with basal velocities*/
+-		if(element->IsOnBed()){
++		if(element->IsOnBase()){
+ 			drag_input->GetInputValue(&drag,gauss);
+ 
+ 			switch(frictionlaw){
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17584)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17585)
+@@ -1084,7 +1084,7 @@
+ 			basalelement = element;
+ 			break;
+ 		case Mesh3DEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+@@ -1170,7 +1170,7 @@
+ 			basalelement = element;
+ 			break;
+ 		case Mesh3DEnum: case Mesh2DverticalEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+@@ -1373,7 +1373,7 @@
+ 			basalelement = element;
+ 			break;
+ 		case Mesh3DEnum: case Mesh2DverticalEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+@@ -1691,7 +1691,7 @@
+ 			basalelement = element;
+ 			break;
+ 		case Mesh3DEnum: case Mesh2DverticalEnum:
+-			if(!element->IsOnBed()){xDelete<IssmDouble>(xyz_list); return;}
++			if(!element->IsOnBase()){xDelete<IssmDouble>(xyz_list); return;}
+ 			basalelement=element->SpawnBasalElement();
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+@@ -1772,7 +1772,7 @@
+ }/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixL1L2Friction(Element* element){/*{{{*/
+ 
+-	if(!element->IsOnBed() || element->IsFloating()) return NULL;
++	if(!element->IsOnBase() || element->IsFloating()) return NULL;
+ 	Element* basalelement = element->SpawnBasalElement();
+ 	ElementMatrix* Ke = CreateKMatrixSSAFriction(basalelement);
+ 
+@@ -1853,7 +1853,7 @@
+ 			basalelement = element;
+ 			break;
+ 		case Mesh3DEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+@@ -2017,7 +2017,7 @@
+ 			basalelement = element;
+ 			break;
+ 		case Mesh3DEnum:
+-			if(!element->IsOnBed()){xDelete<IssmDouble>(xyz_list); return;}
++			if(!element->IsOnBase()){xDelete<IssmDouble>(xyz_list); return;}
+ 			basalelement=element->SpawnBasalElement();
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+@@ -2235,7 +2235,7 @@
+ 	/* Check if ice in element */
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+-	if(element->IsFloating() || !element->IsOnBed()) return NULL;
++	if(element->IsFloating() || !element->IsOnBase()) return NULL;
+ 
+ 	/*Intermediaries*/
+ 	int         dim,meshtype;
+@@ -3040,7 +3040,7 @@
+ }/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixFSFriction(Element* element){/*{{{*/
+ 
+-	if(element->IsFloating() || !element->IsOnBed()) return NULL;
++	if(element->IsFloating() || !element->IsOnBase()) return NULL;
+ 
+ 	/*If on water or not FS, skip stiffness: */
+ 	int approximation;
+@@ -3133,7 +3133,7 @@
+ }/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixFSShelf(Element* element){/*{{{*/
+ 
+-	if(!element->IsFloating() || !element->IsOnBed()) return NULL;
++	if(!element->IsFloating() || !element->IsOnBase()) return NULL;
+ 
+ 	/*If on not water or not FS, skip stiffness: */
+ 	int approximation,shelf_dampening;
+@@ -3564,7 +3564,7 @@
+ 	IssmDouble *xyz_list_base = NULL;
+ 
+ 	/*Get basal element*/
+-	if(!element->IsOnBed() || !element->IsFloating()) return NULL;
++	if(!element->IsOnBase() || !element->IsFloating()) return NULL;
+ 
+ 	/*Get problem dimension*/
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+@@ -4508,7 +4508,7 @@
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSA3dFriction(Element* element){/*{{{*/
+ 
+ 	/*Initialize Element matrix and return if necessary*/
+-	if(element->IsFloating() || !element->IsOnBed()) return NULL;
++	if(element->IsFloating() || !element->IsOnBase()) return NULL;
+ 
+ 	/*Build a tria element using the 3 nodes of the base of the penta. Then use 
+ 	 * the tria functionality to build a friction stiffness matrix on these 3
+@@ -4732,7 +4732,7 @@
+ }/*}}}*/
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixCouplingSSAHOFriction(Element* element){/*{{{*/
+ 
+-	if(element->IsFloating() || !element->IsOnBed()) return NULL;
++	if(element->IsFloating() || !element->IsOnBase()) return NULL;
+ 
+ 	/*Constants*/
+ 	int numnodes    = element->GetNumberOfNodes();
+@@ -4938,7 +4938,7 @@
+ 
+ 	/*If on water or not FS, skip stiffness: */
+ 	element->GetInputValue(&approximation,ApproximationEnum);
+-	if(element->IsFloating() || !element->IsOnBed()) return NULL;
++	if(element->IsFloating() || !element->IsOnBase()) return NULL;
+ 
+ 	int vnumnodes = element->NumberofNodesVelocity();
+ 	int pnumnodes = element->NumberofNodesPressure();
+@@ -5223,7 +5223,7 @@
+ 	IssmDouble  basis[6]; //for the six nodes of the penta
+ 
+ 	/*Initialize Element vector and return if necessary*/
+-	if(!element->IsOnBed() || element->IsFloating()) return NULL;
++	if(!element->IsOnBase() || element->IsFloating()) return NULL;
+ 	element->GetInputValue(&approximation,ApproximationEnum);
+ 	if(approximation!=HOFSApproximationEnum) return NULL;
+ 
+@@ -5387,7 +5387,7 @@
+ 	IssmDouble  *xyz_list      = NULL;
+ 
+ 	/*Initialize Element vector and return if necessary*/
+-	if(!element->IsOnBed() || element->IsFloating()) return NULL;
++	if(!element->IsOnBase() || element->IsFloating()) return NULL;
+ 	element->GetInputValue(&approximation,ApproximationEnum);
+ 	if(approximation!=SSAFSApproximationEnum) return NULL;
+ 	int vnumnodes = element->NumberofNodesVelocity();
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17584)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17585)
+@@ -164,7 +164,7 @@
+ 			basalelement = element;
+ 			break;
+ 		case Mesh3DEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+@@ -269,7 +269,7 @@
+ 			basalelement = element;
+ 			break;
+ 		case Mesh3DEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+@@ -398,7 +398,7 @@
+ 
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+ 	if(meshtype!=Mesh2DhorizontalEnum){
+-		if(!element->IsOnBed()) return;
++		if(!element->IsOnBase()) return;
+ 		basalelement=element->SpawnBasalElement();
+ 	}
+ 	else{
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17584)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17585)
+@@ -280,13 +280,13 @@
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+ 	/*Initialize Element matrix and return if necessary*/
+-	if(!element->IsOnBed() || !element->IsFloating()) return NULL;
++	if(!element->IsOnBase() || !element->IsFloating()) return NULL;
+ 
+ 	IssmDouble  dt,Jdet,D;
+ 	IssmDouble *xyz_list_base = NULL;
+ 
+ 	/*Get basal element*/
+-	if(!element->IsOnBed() || !element->IsFloating()) return NULL;
++	if(!element->IsOnBase() || !element->IsFloating()) return NULL;
+ 
+ 	/*Fetch number of nodes for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+@@ -433,7 +433,7 @@
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+ 	/* Geothermal flux on ice sheet base and basal friction */
+-	if(!element->IsOnBed() || element->IsFloating()) return NULL;
++	if(!element->IsOnBase() || element->IsFloating()) return NULL;
+ 
+ 	IssmDouble  dt,Jdet,geothermalflux,vx,vy,vz;
+ 	IssmDouble  alpha2,scalar,basalfriction,heatflux;
+@@ -498,7 +498,7 @@
+ 	IssmDouble *xyz_list_base = NULL;
+ 
+ 	/*Get basal element*/
+-	if(!element->IsOnBed() || !element->IsFloating()) return NULL;
++	if(!element->IsOnBase() || !element->IsFloating()) return NULL;
+ 
+ 	/*Fetch number of nodes for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17584)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17585)
+@@ -122,7 +122,7 @@
+ 			dim = 2;
+ 			break;
+ 		case Mesh3DEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			dim = 2;
+ 			break;
+@@ -270,7 +270,7 @@
+ 			basalelement = element;
+ 			break;
+ 		case Mesh3DEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+@@ -383,7 +383,7 @@
+ 
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+ 	if(meshtype!=Mesh2DhorizontalEnum){
+-		if(!element->IsOnBed()) return;
++		if(!element->IsOnBase()) return;
+ 		basalelement=element->SpawnBasalElement();
+ 	}
+ 	else{
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17584)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17585)
+@@ -353,7 +353,7 @@
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+ 	/*Initialize Element matrix and return if necessary*/
+-	if(!element->IsOnBed() || !element->IsFloating()) return NULL;
++	if(!element->IsOnBase() || !element->IsFloating()) return NULL;
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble  dt,Jdet,D;
+@@ -538,7 +538,7 @@
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+ 	/* implementation of the basal condition decision chart of Aschwanden 2012, Fig.5 */
+-	if(!element->IsOnBed() || element->IsFloating()) return NULL;
++	if(!element->IsOnBase() || element->IsFloating()) return NULL;
+ 
+ 	IssmDouble  dt,Jdet,enthalpy,pressure,watercolumn,geothermalflux,vx,vy,vz;
+ 	IssmDouble  enthalpyup,pressureup,alpha2,scalar,basalfriction,heatflux;
+@@ -628,7 +628,7 @@
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+ 	/*Get basal element*/
+-	if(!element->IsOnBed() || !element->IsFloating()) return NULL;
++	if(!element->IsOnBase() || !element->IsFloating()) return NULL;
+ 
+ 	IssmDouble  h_pmp,dt,Jdet,scalar_ocean,pressure;
+ 	IssmDouble *xyz_list_base = NULL;
+@@ -901,7 +901,7 @@
+ 	if(!element->IsIceInElement()) return;
+ 
+ 	/* Only compute melt rates at the base of grounded ice*/
+-	if(!element->IsOnBed() || element->IsFloating()) return;
++	if(!element->IsOnBase() || element->IsFloating()) return;
+ 
+ 	/* Intermediaries */
+ 	const int   dim=3;
+@@ -1047,7 +1047,7 @@
+ 	if(!element->IsIceInElement()) return;
+ 
+ 	/* Only drain waterfraction of ice column from element at base*/
+-	if(!element->IsOnBed()) return; //FIXME: allow freeze on for floating elements
++	if(!element->IsOnBase()) return; //FIXME: allow freeze on for floating elements
+ 
+ 	/* Intermediaries*/
+ 	int is, numvertices, numsegments;
+@@ -1149,7 +1149,7 @@
+ 	if(!element->IsIceInElement()) return;
+ 
+ 	/* Only update Constraints at the base of grounded ice*/
+-	if(!(element->IsOnBed()) || element->IsFloating()) return;
++	if(!(element->IsOnBase()) || element->IsFloating()) return;
+ 
+ 	/*Intermediary*/
+ 	bool        isdynamicbasalspc,setspc;
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17584)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17585)
+@@ -118,12 +118,12 @@
+ 			dim = 2;
+ 			break;
+ 		case Mesh2DverticalEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			dim = 1;
+ 			break;
+ 		case Mesh3DEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			dim = 2;
+ 			break;
+@@ -241,12 +241,12 @@
+ 			dim = 2;
+ 			break;
+ 		case Mesh2DverticalEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			dim = 1;
+ 			break;
+ 		case Mesh3DEnum:
+-			if(!element->IsOnBed()) return NULL;
++			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			dim = 2;
+ 			break;
+@@ -372,7 +372,7 @@
+ 	for(int i=0;i<femmodel->elements->Size();i++){
+ 
+ 		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+-		if(!element->IsOnBed()) continue;
++		if(!element->IsOnBase()) continue;
+ 
+ 		int             numnodes = element->GetNumberOfNodes();
+ 		Input* groundedice_input = element->GetInput(MaskGroundediceLevelsetEnum);  _assert_(groundedice_input);
+Index: ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17584)
++++ ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17585)
+@@ -83,7 +83,7 @@
+ }/*}}}*/
+ ElementMatrix* ExtrapolationAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+-	if(!element->IsOnBed()) return NULL;
++	if(!element->IsOnBase()) return NULL;
+ 	Element* basalelement = element->SpawnBasalElement();
+ 
+ 	/*Intermediaries */
+@@ -218,7 +218,7 @@
+ }/*}}}*/
+ ElementVector* ExtrapolationAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+-	if(!element->IsOnBed()) return NULL;
++	if(!element->IsOnBase()) return NULL;
+ 	Element* basalelement = element->SpawnBasalElement();
+ 
+ 	/*Intermediaries */
+Index: ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 17584)
++++ ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 17585)
+@@ -613,7 +613,7 @@
+ 		*punstable=unstable;
+ 		return;
+ 	}
+-	if(!element->IsOnBed()){
++	if(!element->IsOnBase()){
+ 		unstable=0;
+ 		active=0;
+ 		*punstable=unstable;
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17584)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17585)
+@@ -88,7 +88,7 @@
+ 		void       GetVerticesCoordinates(IssmDouble** xyz_list);
+ 		void       GetVerticesSidList(int* sidlist);
+ 		void       GetVerticesConnectivityList(int* connectivitylist);
+-		bool       HasNodeOnBed();
++		bool       HasNodeOnBase();
+ 		bool       HasNodeOnSurface();
+ 		int        Id();
+ 		int        Sid();
+@@ -182,7 +182,7 @@
+ 		virtual int    GetNumberOfVertices(void)=0;
+ 
+ 		virtual bool   IsNodeOnShelfFromFlags(IssmDouble* flags)=0; 
+-		virtual bool   IsOnBed()=0;
++		virtual bool   IsOnBase()=0;
+ 		virtual bool   IsOnSurface()=0;
+ 		virtual void   GetGroundedPart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* mainlyfloating)=0;
+ 		virtual IssmDouble GetGroundedPortion(IssmDouble* xyz_list)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17584)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17585)
+@@ -111,7 +111,7 @@
+ 				IssmDouble values2[NUMVERTICES]={0.};
+ 				int        numindices;
+ 				int       *indices = NULL;
+-				int        index = this->EdgeOnBedIndex();
++				int        index = this->EdgeOnBaseIndex();
+ 				NodeOnEdgeIndices(&numindices,&indices,index,this->FiniteElement());
+ 				for(int i=0;i<numindices;i++){
+ 					values2[indices[i]] = values[i];
+@@ -475,7 +475,7 @@
+ 	if(gl[2]==0.) gl[2]=gl[2]+epsilon;
+ 
+ 	if(meshtype==Mesh2DverticalEnum){
+-		this->EdgeOnBedIndices(&index1,&index2);
++		this->EdgeOnBaseIndices(&index1,&index2);
+ 		if(gl[index1]>0 && gl[index2]>0) phi=1; // All grounded
+ 		else if(gl[index1]<0 && gl[index2]<0) phi=0; // All floating
+ 		else if(gl[index1]<0 && gl[index2]>0){ //index2 grounded
+@@ -584,7 +584,7 @@
+ 
+ 	/*Allocate Output*/
+ 	IssmDouble* xyz_list_edge = xNew<IssmDouble>(2*3);
+-	this->EdgeOnBedIndices(&indices[0],&indices[1]);
++	this->EdgeOnBaseIndices(&indices[0],&indices[1]);
+ 	for(int i=0;i<2;i++) for(int j=0;j<2;j++) xyz_list_edge[i*3+j]=xyz_list[indices[i]][j];
+ 
+ 	/*Assign output pointer*/
+@@ -1131,14 +1131,14 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::IsOnBed {{{*/
+-bool Tria::IsOnBed(){
++/*FUNCTION Tria::IsOnBase {{{*/
++bool Tria::IsOnBase(){
+ 
+ 	int meshtype;
+ 	this->parameters->FindParam(&meshtype,MeshTypeEnum);
+ 	switch(meshtype){
+ 		case Mesh2DverticalEnum:
+-			return HasEdgeOnBed();
++			return HasEdgeOnBase();
+ 		case Mesh2DhorizontalEnum:
+ 			return true;
+ 		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+@@ -1191,8 +1191,8 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::HasEdgeOnBed {{{*/
+-bool Tria::HasEdgeOnBed(){
++/*FUNCTION Tria::HasEdgeOnBase {{{*/
++bool Tria::HasEdgeOnBase(){
+ 
+ 	IssmDouble values[NUMVERTICES];
+ 	IssmDouble sum;
+@@ -1235,8 +1235,8 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Tria::EdgeOnBedIndices{{{*/
+-void Tria::EdgeOnBedIndices(int* pindex1,int* pindex2){
++/*FUNCTION Tria::EdgeOnBaseIndices{{{*/
++void Tria::EdgeOnBaseIndices(int* pindex1,int* pindex2){
+ 
+ 	IssmDouble values[NUMVERTICES];
+ 	int        indices[3][2] = {{1,2},{2,0},{0,1}};
+@@ -1277,8 +1277,8 @@
+ 	_error_("Could not find 2 vertices on surface");
+ }
+ /*}}}*/
+-/*FUNCTION Tria::EdgeOnBedIndex{{{*/
+-int Tria::EdgeOnBedIndex(void){
++/*FUNCTION Tria::EdgeOnBaseIndex{{{*/
++int Tria::EdgeOnBaseIndex(void){
+ 
+ 	IssmDouble values[NUMVERTICES];
+ 	int        indices[3][2] = {{1,2},{2,0},{0,1}};
+@@ -1318,7 +1318,7 @@
+ /*FUNCTION Tria::FSContactMigration{{{*/
+ void Tria::FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating){
+ 
+-	if(!IsOnBed()) return;
++	if(!IsOnBase()) return;
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble* xyz_list = NULL;
+@@ -1397,7 +1397,7 @@
+ Gauss* Tria::NewGaussBase(int order){
+ 
+ 	int indices[2];
+-	this->EdgeOnBedIndices(&indices[0],&indices[1]);
++	this->EdgeOnBaseIndices(&indices[0],&indices[1]);
+ 	return new GaussTria(indices[0],indices[1],order);
+ }
+ /*}}}*/
+@@ -1643,7 +1643,7 @@
+ 
+ 	/*For FS only: we want the CS to be tangential to the bedrock*/
+ 	inputs->GetInputValue(&approximation,ApproximationEnum);
+-	if(!HasNodeOnBed() ||  approximation!=FSApproximationEnum) return;
++	if(!HasNodeOnBase() ||  approximation!=FSApproximationEnum) return;
+ 
+ 	//printf("element number %i \n",this->id);
+ 	/*Get inputs*/
+@@ -1773,8 +1773,8 @@
+ 		case Mesh2DhorizontalEnum:
+ 			return this;
+ 		case Mesh2DverticalEnum:
+-			_assert_(HasEdgeOnBed());
+-			this->EdgeOnBedIndices(&index1,&index2);
++			_assert_(HasEdgeOnBase());
++			this->EdgeOnBaseIndices(&index1,&index2);
+ 			return SpawnSeg(index1,index2);
+ 		default:
+ 			_error_("not implemented yet");
+@@ -1986,7 +1986,7 @@
+ /*FUNCTION Tria::UpdateConstraintsExtrudeFromBase{{{*/
+ void  Tria::UpdateConstraintsExtrudeFromBase(void){
+ 
+-	if(!HasEdgeOnBed()) return;
++	if(!HasEdgeOnBase()) return;
+ 
+ 	int        extrusioninput;
+ 	IssmDouble value,isonbed;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17584)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17585)
+@@ -69,13 +69,13 @@
+ 		int         GetNodeIndex(Node* node);
+ 		int         GetNumberOfNodes(void);
+ 		int         GetNumberOfVertices(void);
+-		bool        IsOnBed();
++		bool        IsOnBase();
+ 		bool        IsOnSurface();
+-		bool        HasEdgeOnBed();
++		bool        HasEdgeOnBase();
+ 		bool        HasEdgeOnSurface();
+ 		void        EdgeOnSurfaceIndices(int* pindex1,int* pindex);
+-		void        EdgeOnBedIndices(int* pindex1,int* pindex);
+-		int         EdgeOnBedIndex();
++		void        EdgeOnBaseIndices(int* pindex1,int* pindex);
++		int         EdgeOnBaseIndex();
+ 		int         EdgeOnSurfaceIndex();
+ 		bool        IsNodeOnShelfFromFlags(IssmDouble* flags);
+ 		int         NumberofNodesVelocity(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17584)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17585)
+@@ -118,7 +118,7 @@
+ void  Penta::AddBasalInput(int input_enum,IssmDouble* values, int interpolation_enum){
+ 
+ 	_assert_(this->inputs);
+-	if(!IsOnBed()) return;
++	if(!IsOnBase()) return;
+ 	else{
+ 		if(interpolation_enum==P1Enum){
+ 			int        i;
+@@ -151,7 +151,7 @@
+ 	GaussPenta *gauss                      = NULL;
+ 
+ 	/* Basal friction can only be found at the base of an ice sheet: */
+-	if (!IsOnBed() || IsFloating()){
++	if (!IsOnBase() || IsFloating()){
+ 		//empty friction: 
+ 		this->inputs->AddInput(new PentaInput(BasalFrictionEnum,&basalfriction[0],P1Enum));
+ 		return;
+@@ -218,7 +218,7 @@
+ 	/*retrieve some parameters: */
+ 	this->parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+ 
+-	if(!IsOnBed()){
++	if(!IsOnBase()){
+ 		//put zero
+ 		sigma_b->SetValue(id-1,0.0,INS_VAL);
+ 		return;
+@@ -373,7 +373,7 @@
+ /*FUNCTION Penta::Delta18oParameterization{{{*/
+ void  Penta::Delta18oParameterization(void){
+         /*Are we on the base? If not, return*/
+-        if(!IsOnBed()) return;
++        if(!IsOnBase()) return;
+ 
+ 	int        i;
+ 	IssmDouble monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12];
+@@ -543,7 +543,7 @@
+ 	penta=this;
+ 	for(;;){
+ 		/*Stop if we have reached the surface, else, take lower penta*/
+-		if (penta->IsOnBed()) break;
++		if (penta->IsOnBase()) break;
+ 
+ 		/* get lower Penta*/
+ 		penta=penta->GetLowerPenta();
+@@ -1124,7 +1124,7 @@
+ 	/*recover parameters: */
+ 
+ 	/*Are we on the base? If not, return*/
+-	if(!IsOnBed()) return;
++	if(!IsOnBase()) return;
+ 
+ 	/*OK, we are on bed. Initialize global inputs as 0*/
+ 	total_thickness_input =new PentaInput(ThicknessEnum,zeros_list,P1Enum);
+@@ -1224,7 +1224,7 @@
+ 	Input **base_inputs = NULL;
+ 
+ 	/*Are we on the base, not on the surface?:*/
+-	if(!IsOnBed()) return;
++	if(!IsOnBase()) return;
+ 
+ 	/*Step1: Get and Extrude original input: */
+ 	num_inputs=1;
+@@ -1414,7 +1414,7 @@
+ 	Penta  *penta   = NULL;
+ 
+ 	/*If not on bed, return*/
+-	if (!IsOnBed()) return;
++	if (!IsOnBase()) return;
+ 
+ 	/*Get dof list: */
+ 	GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+@@ -1503,8 +1503,8 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Penta::IsOnBed{{{*/
+-bool Penta::IsOnBed(void){
++/*FUNCTION Penta::IsOnBase{{{*/
++bool Penta::IsOnBase(void){
+ 
+ 	bool onbed;
+ 	inputs->GetInputValue(&onbed,MeshElementonbedEnum);
+@@ -1912,7 +1912,7 @@
+ 
+ 	/*For FS only: we want the CS to be tangential to the bedrock*/
+ 	inputs->GetInputValue(&approximation,ApproximationEnum);
+-	if(!IsOnBed() || (approximation!=FSApproximationEnum && approximation!=SSAFSApproximationEnum &&  approximation!=HOFSApproximationEnum)) return;
++	if(!IsOnBase() || (approximation!=FSApproximationEnum && approximation!=SSAFSApproximationEnum &&  approximation!=HOFSApproximationEnum)) return;
+ 
+ 	/*Get number of nodes for velocity only and base*/
+ 	BasalNodeIndices(&numindices,&indices,this->VelocityInterpolation());
+@@ -2021,7 +2021,7 @@
+ /*FUNCTION Penta::SpawnBasalElement{{{*/
+ Element*  Penta::SpawnBasalElement(void){
+ 
+-	_assert_(this->IsOnBed());
++	_assert_(this->IsOnBase());
+ 
+ 	this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum);
+ 	this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum);
+@@ -2108,7 +2108,7 @@
+ 	/*Bail out if this element if:
+ 	 * -> Non SSA not on the surface
+ 	 * -> SSA (2d model) and not on bed) */
+-	if ((approximation!=SSAApproximationEnum && !IsOnSurface()) || (approximation==SSAApproximationEnum && !IsOnBed())){
++	if ((approximation!=SSAApproximationEnum && !IsOnSurface()) || (approximation==SSAApproximationEnum && !IsOnBase())){
+ 		return 0;
+ 	}
+ 	else if (approximation==SSAApproximationEnum){
+@@ -2489,7 +2489,7 @@
+ /*FUNCTION Penta::UpdateConstraintsExtrudeFromBase{{{*/
+ void  Penta::UpdateConstraintsExtrudeFromBase(void){
+ 
+-	if(!IsOnBed()) return;
++	if(!IsOnBase()) return;
+ 
+ 	int        extrusioninput;
+ 	IssmDouble value,isonbed;
+@@ -2664,7 +2664,7 @@
+ 	IssmDouble base,bed,surface,bathymetry;
+ 	IssmDouble xyz_list[NUMVERTICES][3];
+ 
+-	if(!IsIceInElement() || IsFloating() || !IsOnBed())return 0;
++	if(!IsIceInElement() || IsFloating() || !IsOnBase())return 0;
+ 
+ 	rho_ice=matpar->GetRhoIce();
+ 	rho_water=matpar->GetRhoWater();
+@@ -2732,7 +2732,7 @@
+ 
+ 	IssmDouble mass_flux=0;
+ 
+-	if(!IsOnBed()) return mass_flux;
++	if(!IsOnBase()) return mass_flux;
+ 
+ 	/*Depth Averaging Vx and Vy*/
+ 	this->InputDepthAverageAtBase(VxEnum,VxAverageEnum);
+@@ -2756,7 +2756,7 @@
+ 
+ 	IssmDouble mass_flux=0;
+ 
+-	if(!IsOnBed()) return mass_flux;
++	if(!IsOnBase()) return mass_flux;
+ 
+ 	/*Depth Averaging Vx and Vy*/
+ 	this->InputDepthAverageAtBase(VxEnum,VxAverageEnum);
+@@ -2922,11 +2922,11 @@
+ 	Input* input=NULL;
+ 
+ 	if(enum_type==MaterialsRheologyBbarEnum){
+-		if(!IsOnBed()) return;
++		if(!IsOnBase()) return;
+ 		input=(Input*)inputs->GetInput(MaterialsRheologyBEnum);
+ 	}
+ 	else if(enum_type==DamageDbarEnum){
+-		if(!IsOnBed()) return;
++		if(!IsOnBase()) return;
+ 		input=(Input*)inputs->GetInput(DamageDEnum);
+ 	}
+ 	else{
+@@ -3114,14 +3114,14 @@
+ 			/*Nothing, J does not depends on the parameter being inverted for*/
+ 			break;
+ 		case DragCoefficientAbsGradientEnum:
+-			if(IsOnBed()){
++			if(IsOnBase()){
+ 				tria=(Tria*)SpawnTria(0,1,2);
+ 				tria->GradjDragGradient(gradient,control_index);
+ 				delete tria->material; delete tria;
+ 			}
+ 			break;
+ 		case RheologyBbarAbsGradientEnum:
+-			if(IsOnBed()){
++			if(IsOnBase()){
+ 				tria=(Tria*)SpawnTria(0,1,2);
+ 				tria->GradjBGradient(gradient,control_index);
+ 				delete tria->material; delete tria;
+@@ -3137,7 +3137,7 @@
+ void  Penta::GradjDragSSA(Vector<IssmDouble>* gradient,int control_index){
+ 
+ 	/*Gradient is 0 if on shelf or not on bed*/
+-	if(IsFloating() || !IsOnBed()) return;
++	if(IsFloating() || !IsOnBase()) return;
+ 
+ 	/*Spawn tria*/
+ 	Tria* tria=(Tria*)SpawnTria(0,1,2);
+@@ -3163,7 +3163,7 @@
+ 	GaussPenta *gauss=NULL;
+ 
+ 	/*Gradient is 0 if on shelf or not on bed*/
+-	if(IsFloating() || !IsOnBed()) return;
++	if(IsFloating() || !IsOnBase()) return;
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+@@ -3236,7 +3236,7 @@
+ 	GaussPenta* gauss=NULL;
+ 
+ 	/*Gradient is 0 if on shelf or not on bed*/
+-	if(IsFloating() || !IsOnBed()) return;
++	if(IsFloating() || !IsOnBase()) return;
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+@@ -3312,7 +3312,7 @@
+ void  Penta::GradjBbarSSA(Vector<IssmDouble>* gradient,int control_index){
+ 
+ 	/*This element should be collapsed into a tria element at its base*/
+-	if (!IsOnBed()) return; 
++	if (!IsOnBase()) return; 
+ 
+ 	/*Depth Average B*/
+ 	this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum);
+@@ -3332,7 +3332,7 @@
+ void  Penta::GradjBbarHO(Vector<IssmDouble>* gradient,int control_index){
+ 
+ 	/*Gradient is computed on bed only (Bbar)*/
+-	if (!IsOnBed()) return;
++	if (!IsOnBase()) return;
+ 
+ 	/*Depth Average B and D*/
+ 	this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum);
+@@ -3351,7 +3351,7 @@
+ void  Penta::GradjBbarFS(Vector<IssmDouble>* gradient,int control_index){
+ 
+ 	/*Gradient is computed on bed only (Bbar)*/
+-	if (!IsOnBed()) return;
++	if (!IsOnBase()) return;
+ 
+ 	/*Depth Average B and D*/
+ 	this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum);
+@@ -3381,11 +3381,11 @@
+ 	for(int i=0;i<num_controls;i++){
+ 
+ 		if(control_type[i]==MaterialsRheologyBbarEnum){
+-			if (!IsOnBed()) goto cleanup_and_return;
++			if (!IsOnBase()) goto cleanup_and_return;
+ 			input=(Input*)this->inputs->GetInput(MaterialsRheologyBEnum); _assert_(input);
+ 		}
+ 		else if(control_type[i]==DamageDbarEnum){
+-			if (!IsOnBed()) goto cleanup_and_return;
++			if (!IsOnBase()) goto cleanup_and_return;
+ 			input=(Input*)this->inputs->GetInput(DamageDEnum); _assert_(input);
+ 		}
+ 		else{
+@@ -3426,7 +3426,7 @@
+ 	/*Bail out if this element if:
+ 	 * -> Non SSA and not on the surface
+ 	 * -> SSA (2d model) and not on bed) */
+-	if ((approximation!=SSAApproximationEnum && !IsOnSurface()) || (approximation==SSAApproximationEnum && !IsOnBed())){
++	if ((approximation!=SSAApproximationEnum && !IsOnSurface()) || (approximation==SSAApproximationEnum && !IsOnBase())){
+ 		return 0;
+ 	}
+ 	else if (approximation==SSAApproximationEnum){
+@@ -3463,7 +3463,7 @@
+ 	/*Bail out if this element if:
+ 	 * -> Non SSA and not on the surface
+ 	 * -> SSA (2d model) and not on bed) */
+-	if ((approximation!=SSAApproximationEnum && !IsOnSurface()) || (approximation==SSAApproximationEnum && !IsOnBed())){
++	if ((approximation!=SSAApproximationEnum && !IsOnSurface()) || (approximation==SSAApproximationEnum && !IsOnBase())){
+ 		return 0;
+ 	}
+ 	else if (approximation==SSAApproximationEnum){
+@@ -3500,7 +3500,7 @@
+ 	/*Bail out if this element if:
+ 	 * -> Non SSA and not on the surface
+ 	 * -> SSA (2d model) and not on bed) */
+-	if ((approximation!=SSAApproximationEnum && !IsOnSurface()) || (approximation==SSAApproximationEnum && !IsOnBed())){
++	if ((approximation!=SSAApproximationEnum && !IsOnSurface()) || (approximation==SSAApproximationEnum && !IsOnBase())){
+ 		return 0;
+ 	}
+ 	else if (approximation==SSAApproximationEnum){
+@@ -3539,7 +3539,7 @@
+ 	/*Bail out if this element if:
+ 	 * -> Non SSA and not on the surface
+ 	 * -> SSA (2d model) and not on bed) */
+-	if ((approximation!=SSAApproximationEnum && !IsOnSurface()) || (approximation==SSAApproximationEnum && !IsOnBed())){
++	if ((approximation!=SSAApproximationEnum && !IsOnSurface()) || (approximation==SSAApproximationEnum && !IsOnBase())){
+ 		return 0;
+ 	}
+ 	else if (approximation==SSAApproximationEnum){
+@@ -3576,7 +3576,7 @@
+ 	/*Bail out if this element if:
+ 	 * -> Non SSA and not on the surface
+ 	 * -> SSA (2d model) and not on bed) */
+-	if ((approximation!=SSAApproximationEnum && !IsOnSurface()) || (approximation==SSAApproximationEnum && !IsOnBed())){
++	if ((approximation!=SSAApproximationEnum && !IsOnSurface()) || (approximation==SSAApproximationEnum && !IsOnBase())){
+ 		return 0;
+ 	}
+ 	else if (approximation==SSAApproximationEnum){
+@@ -3630,7 +3630,7 @@
+ 	Tria*  tria=NULL;
+ 
+ 	/*If on water, on shelf or not on bed, skip: */
+-	if(!IsIceInElement()|| IsFloating() || !IsOnBed()) return 0;
++	if(!IsIceInElement()|| IsFloating() || !IsOnBase()) return 0;
+ 
+ 	tria=(Tria*)SpawnTria(0,1,2); //lower face is 0, upper face is 1
+ 	J=tria->DragCoefficientAbsGradient();
+@@ -3645,7 +3645,7 @@
+ 	Tria*  tria=NULL;
+ 
+ 	/*If on water, on shelf or not on bed, skip: */
+-	if(!IsIceInElement() || !IsOnBed()) return 0;
++	if(!IsIceInElement() || !IsOnBase()) return 0;
+ 
+ 	tria=(Tria*)SpawnTria(0,1,2);
+ 	J=tria->RheologyBbarAbsGradient();
+@@ -3890,7 +3890,7 @@
+ 	IssmDouble h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],r[NUMVERTICES];
+ 	IssmDouble melting[NUMVERTICES],phi[NUMVERTICES];
+ 
+-	if(!IsOnBed()) return;
++	if(!IsOnBase()) return;
+ 
+ 	/*Recover info at the vertices: */
+ 	parameters->FindParam(&migration_style,GroundinglineMigrationEnum);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17584)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17585)
+@@ -186,7 +186,7 @@
+ 		void           InputUpdateFromSolutionOneDof(IssmDouble* solutiong,int enum_type);
+ 		void           InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solutiong,int enum_type);
+ 		bool	         IsOnSurface(void);
+-		bool	         IsOnBed(void);
++		bool	         IsOnBase(void);
+ 		bool           IsNodeOnShelfFromFlags(IssmDouble* flags);
+ 		void           JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss);
+ 		void           JacobianDeterminantLine(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss);
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17584)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17585)
+@@ -102,8 +102,8 @@
+ 	this->inputs->Configure(parameters);
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::FaceOnBedIndices{{{*/
+-void Tetra::FaceOnBedIndices(int* pindex1,int* pindex2,int* pindex3){
++/*FUNCTION Tetra::FaceOnBaseIndices{{{*/
++void Tetra::FaceOnBaseIndices(int* pindex1,int* pindex2,int* pindex3){
+ 
+ 	IssmDouble values[NUMVERTICES];
+ 	int        indices[4][3] = {{0,1,2},{0,1,3},{1,2,3},{2,0,3}};
+@@ -186,7 +186,7 @@
+ 
+ 	/*Allocate Output*/
+ 	IssmDouble* xyz_list_edge = xNew<IssmDouble>(3*3);
+-	this->FaceOnBedIndices(&indices[0],&indices[1],&indices[2]);
++	this->FaceOnBaseIndices(&indices[0],&indices[1],&indices[2]);
+ 	for(int i=0;i<3;i++) for(int j=0;j<3;j++) xyz_list_edge[i*3+j]=xyz_list[indices[i]][j];
+ 
+ 	/*Assign output pointer*/
+@@ -226,8 +226,8 @@
+ 	return z;
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::HasFaceOnBed{{{*/
+-bool Tetra::HasFaceOnBed(){
++/*FUNCTION Tetra::HasFaceOnBase{{{*/
++bool Tetra::HasFaceOnBase(){
+ 
+ 	IssmDouble values[NUMVERTICES];
+ 	IssmDouble sum;
+@@ -397,9 +397,9 @@
+ 	xDelete<int>(doflist);
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::IsOnBed {{{*/
+-bool Tetra::IsOnBed(){
+-	return HasFaceOnBed();
++/*FUNCTION Tetra::IsOnBase {{{*/
++bool Tetra::IsOnBase(){
++	return HasFaceOnBase();
+ }
+ /*}}}*/
+ /*FUNCTION Tetra::IsOnSurface {{{*/
+@@ -475,7 +475,7 @@
+ Gauss* Tetra::NewGaussBase(int order){
+ 
+ 	int indices[3];
+-	this->FaceOnBedIndices(&indices[0],&indices[1],&indices[2]);
++	this->FaceOnBaseIndices(&indices[0],&indices[1],&indices[2]);
+ 	return new GaussTetra(indices[0],indices[1],indices[2],order);
+ }
+ /*}}}*/
+@@ -659,7 +659,7 @@
+ 
+ 	/*For FS only: we want the CS to be tangential to the bedrock*/
+ 	inputs->GetInputValue(&approximation,ApproximationEnum);
+-	if(IsFloating() || !HasNodeOnBed() ||  approximation!=FSApproximationEnum) return;
++	if(IsFloating() || !HasNodeOnBase() ||  approximation!=FSApproximationEnum) return;
+ 
+ 	//printf("element number %i \n",this->id);
+ 	/*Get inputs*/
+@@ -726,10 +726,10 @@
+ /*FUNCTION Tetra::SpawnBasalElement{{{*/
+ Element*  Tetra::SpawnBasalElement(void){
+ 
+-	_assert_(HasFaceOnBed());
++	_assert_(HasFaceOnBase());
+ 
+ 	int index1,index2,index3;
+-	this->FaceOnBedIndices(&index1,&index2,&index3);
++	this->FaceOnBaseIndices(&index1,&index2,&index3);
+ 	return SpawnTria(index1,index2,index3);
+ }/*}}}*/
+ /*FUNCTION Tetra::SpawnTopElement{{{*/
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17584)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17585)
+@@ -71,7 +71,7 @@
+ 		void        GetVerticesCoordinates(IssmDouble** pxyz_list);
+ 		void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list){_error_("not implemented yet");};
+ 		void        GetVerticesCoordinatesTop(IssmDouble** pxyz_list){_error_("not implemented yet");};
+-		bool        IsOnBed(){_error_("not implemented yet");};
++		bool        IsOnBase(){_error_("not implemented yet");};
+ 		bool        IsOnSurface(){_error_("not implemented yet");};
+ 		bool        IsNodeOnShelfFromFlags(IssmDouble* flags){_error_("not implemented yet");};
+ 		void        JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss);
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17584)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17585)
+@@ -60,7 +60,7 @@
+ 		void        Delta18oParameterization(void){_error_("not implemented yet");};
+ 		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){_error_("not implemented yet");};
+ 		void        FaceOnFrontIndices(int* pindex1,int* pindex2,int* pindex3);
+-		void        FaceOnBedIndices(int* pindex1,int* pindex2,int* pindex3);
++		void        FaceOnBaseIndices(int* pindex1,int* pindex2,int* pindex3);
+ 		void        FaceOnSurfaceIndices(int* pindex1,int* pindex2,int* pindex3);
+ 		void        FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating){_error_("not implemented yet");};
+ 		int         FiniteElement(void);
+@@ -73,9 +73,9 @@
+ 		int         GetNumberOfVertices(void);
+ 		void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list);
+ 		void        GetVerticesCoordinatesTop(IssmDouble** pxyz_list);
+-		bool        HasFaceOnBed();
++		bool        HasFaceOnBase();
+ 		bool        HasFaceOnSurface();
+-		bool        IsOnBed();
++		bool        IsOnBase();
+ 		bool        IsOnSurface();
+ 		bool        IsNodeOnShelfFromFlags(IssmDouble* flags){_error_("not implemented yet");};
+ 		void        JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss);
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17584)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17585)
+@@ -548,7 +548,7 @@
+ 	for(int i=0;i<numvertices;i++) connectivity[i]=this->vertices[i]->Connectivity();
+ }
+ /*}}}*/
+-bool Element::HasNodeOnBed(){/*{{{*/
++bool Element::HasNodeOnBase(){/*{{{*/
+ 	return (this->inputs->Max(MeshVertexonbedEnum)>0.);
+ }/*}}}*/
+ bool Element::HasNodeOnSurface(){/*{{{*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17585-17586.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17585-17586.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17585-17586.diff	(revision 17802)
@@ -0,0 +1,850 @@
+Index: ../trunk-jpl/CMakeLists.txt
+===================================================================
+--- ../trunk-jpl/CMakeLists.txt	(revision 17585)
++++ ../trunk-jpl/CMakeLists.txt	(revision 17586)
+@@ -1,57 +0,0 @@
+-# CMake version check. Version 2.6 is considered standard.
+-cmake_minimum_required (VERSION 2.6) 
+-
+-# Project Information {{{
+-# Project Name
+-project(ISSM) 
+-set(ISSM_VERSION_MAJOR 4)
+-set(ISSM_VERSION_MINOR 1)
+-# }}}
+-# Contact Information {{{
+-set(ISSM_EMAIL "issm@jpl.nasa.gov")
+-set(ISSM_WEBSITE "http://issm.jpl.nasa.gov")
+-# }}}
+-
+-# CMake Modules {{{
+-include(CheckLanguage)
+-include(./m4/issm_options.cmake)
+-# }}}
+-
+-# Language Checks {{{
+-
+-# 'C' language check.
+-include(CheckLanguage)
+-
+-check_language(C)
+-if(CMAKE_C_COMPILER)
+-   enable_language(C)
+-else(CMAKE_C_COMPILER)
+-   message(FATAL_ERROR "No C support found!")
+-endif(CMAKE_C_COMPILER)
+-
+-# 'C++' language check.
+-check_language(CXX)
+-if(CMAKE_CXX_COMPILER)
+-   enable_language(CXX)
+-else(CMAKE_CXX_COMPILER)
+-   message(FATA_ERROR "No C++ support found!")
+-endif(CMAKE_CXX_COMPILER)
+-
+-# 'Fortran' language check.
+-#check_language(Fortran)
+-#if(CMAKE_Fortran_COMPILER)
+-#   enable_language(Fortran)
+-#else(CMAKE_Fortran_COMPILER)
+-#   message(FATA_ERROR "No Fortran support")
+-#endif(CMAKE_Fortran_COMPILER)
+-# }}}
+-
+-# Subdirectories {{{
+-add_subdirectory(src) 
+-# }}}
+-
+-# Options {{{
+-option(SHARED_LIBS "Set whether to produce shared libraries, or not. Default is no."
+-       OFF)
+-# Questionable whether all options should be contained within this file or included from some other file.
+-# }}}
+Index: ../trunk-jpl/m4/issm_options.cmake
+===================================================================
+--- ../trunk-jpl/m4/issm_options.cmake	(revision 17585)
++++ ../trunk-jpl/m4/issm_options.cmake	(revision 17586)
+@@ -1,37 +0,0 @@
+-# ISSM Options {{{
+-option(DAKOTA "DAKOTA" OFF)
+-option(PETSC "PETSC" OFF)
+-option(MUMPS "MUMPS" OFF)
+-#option(GSL "GSL" OFF)
+-option(TRANSIENT "TRANSIENT" ON)
+-option(STEADYSTATE "STEADYSTATE" ON)
+-option(PROGNOSTIC "PROGNOSTIC" ON)
+-option(THERMAL "THERMAL" ON)
+-option(GIA "GIA" OFF)
+-option(CONTROL "CONTROL" ON)
+-option(HYDROLOGY "HYDROLOGY" ON)
+-option(DIAGNOSTIC "DIAGNOSTIC" ON)
+-option(BALANCED "BALANCED" ON)
+-option(SLOPE "SLOPE" ON)
+-option(GROUNDINGLINE "GROUNDINGLINE" ON)
+-option(RIFTS "RIFTS" ON)
+-option(ANDROID "ANDROID" OFF)
+-option(THREED "THREED" ON)
+-option(MPI "MPI" OFF)
+-option(METIS "METIS" OFF)
+-option(KRIGING "KRIGING" OFF)
+-# }}}
+-
+-if(NOT GSL_DIR)
+-    message(FATAL_ERROR "Non GSL build not supported")
+-else(NOT GSL_DIR)
+-    find_path(GSL lib ${GSL_DIR})
+-
+-    if(GSL)
+-        message("Found GSL: ${GSL_DIR}")
+-        set(GSL_INC_DIR ${GSL_DIR}/include)
+-        set(GSL_LIB_DIR ${GSL_DIR}/lib)
+-    else(GSL)
+-        message(FATAL_ERROR "GSL installation directory not found!")
+-    endif(GSL)
+-endif(NOT GSL_DIR)
+Index: ../trunk-jpl/src/CMakeLists.txt
+===================================================================
+--- ../trunk-jpl/src/CMakeLists.txt	(revision 17585)
++++ ../trunk-jpl/src/CMakeLists.txt	(revision 17586)
+@@ -1,8 +0,0 @@
+-# Subdirectories {{{
+-add_subdirectory(c)
+-#add_subdirectory(m)
+-#add_subdirectory(wrappers)
+-#Android Dir {{{
+-# add_subdirectory(android)
+-#}}}
+-# }}}
+Index: ../trunk-jpl/src/c/CMakeLists.txt
+===================================================================
+--- ../trunk-jpl/src/c/CMakeLists.txt	(revision 17585)
++++ ../trunk-jpl/src/c/CMakeLists.txt	(revision 17586)
+@@ -1,728 +0,0 @@
+-# config.h {{{
+-set(CPP_FLAGS -DHAVE_CONFIG_H)
+-# }}}
+-# Include Directory {{{
+-include_directories(AFTER $ENV{ISSM_DIR}/ 
+-                          $ENV{ISSM_DIR}/src/c 
+-                          $ENV{ISSM_DIR}/src/c/main 
+-                          $ENV{ISSM_DIR}/src/c/datastructure 
+-                          $ENV{ISSM_DIR}/src/c/classes 
+-                          $ENV{ISSM_DIR}/src/c/classes/Options 
+-                          $ENV{ISSM_DIR}/src/c/classes/ExternalResults 
+-                          $ENV{ISSM_DIR}/src/c/classes/Elements 
+-                          $ENV{ISSM_DIR}/src/c/classes/Inputs 
+-                          $ENV{ISSM_DIR}/src/c/classes/Materials 
+-                          $ENV{ISSM_DIR}/src/c/classes/Constraints 
+-                          $ENV{ISSM_DIR}/src/c/classes/Loads 
+-                          $ENV{ISSM_DIR}/src/c/classes/matrix 
+-                          $ENV{ISSM_DIR}/src/c/classes/Params 
+-                          $ENV{ISSM_DIR}/src/c/classes/Params 
+-                          $ENV{ISSM_DIR}/src/c/shared 
+-                          $ENV{ISSM_DIR}/src/c/shared/MemOps 
+-                          $ENV{ISSM_DIR}/src/c/shared/Matrix 
+-                          $ENV{ISSM_DIR}/src/c/shared/io 
+-                          $ENV{ISSM_DIR}/src/c/shared/io/Disk 
+-                          $ENV{ISSM_DIR}/src/c/shared/io/Print 
+-                          $ENV{ISSM_DIR}/src/c/shared/io/Comm 
+-                          $ENV{ISSM_DIR}/src/c/shared/LatLong 
+-                          $ENV{ISSM_DIR}/src/c/shared/Enum 
+-                          $ENV{ISSM_DIR}/src/c/shared/Numerics 
+-                          $ENV{ISSM_DIR}/src/c/shared/Exceptions 
+-                          $ENV{ISSM_DIR}/src/c/shared/Sorting 
+-                          $ENV{ISSM_DIR}/src/c/shared/Elements 
+-                          $ENV{ISSM_DIR}/src/c/shared/String 
+-                          $ENV{ISSM_DIR}/src/c/toolkits 
+-                          $ENV{ISSM_DIR}/src/c/toolkits/metis 
+-                          $ENV{ISSM_DIR}/src/c/toolkits/issm 
+-                          $ENV{ISSM_DIR}/src/c/toolkits/adolc 
+-                          $ENV{ISSM_DIR}/src/c/toolkits/triangle 
+-                          $ENV{ISSM_DIR}/src/c/toolkits/objects 
+-                          $ENV{ISSM_DIR}/src/c/modules 
+-                          $ENV{ISSM_DIR}/src/c/modules/ModelProcessorx 
+-                          $ENV{ISSM_DIR}/src/c/modules/ParseToolkitsOptionsx 
+-                          $ENV{ISSM_DIR}/src/c/modules/NodesDofx 
+-                          $ENV{ISSM_DIR}/src/c/modules/NodalValuex 
+-                          $ENV{ISSM_DIR}/src/c/modules/VerticesDofx 
+-                          $ENV{ISSM_DIR}/src/c/modules/VertexCoordinatesx 
+-                          $ENV{ISSM_DIR}/src/c/modules/OutputResultsx 
+-                          $ENV{ISSM_DIR}/src/c/modules/InputDuplicatex 
+-                          $ENV{ISSM_DIR}/src/c/modules/InputScalex 
+-                          $ENV{ISSM_DIR}/src/c/modules/SurfaceAreax 
+-                          $ENV{ISSM_DIR}/src/c/modules/CreateNodalConstraintsx 
+-                          $ENV{ISSM_DIR}/src/c/modules/UpdateDynamicConstraintsx 
+-                          $ENV{ISSM_DIR}/src/c/modules/IoModelToConstraintsx 
+-                          $ENV{ISSM_DIR}/src/c/modules/InputUpdateFromConstantx 
+-                          $ENV{ISSM_DIR}/src/c/modules/GetSolutionFromInputsx 
+-                          $ENV{ISSM_DIR}/src/c/modules/GetVectorFromInputsx 
+-                          $ENV{ISSM_DIR}/src/c/modules/InputUpdateFromVectorx 
+-                          $ENV{ISSM_DIR}/src/c/modules/ConfigureObjectsx 
+-                          $ENV{ISSM_DIR}/src/c/modules/ComputeBasalStressx 
+-                          $ENV{ISSM_DIR}/src/c/modules/ComputeStrainRatex 
+-                          $ENV{ISSM_DIR}/src/c/modules/SpcNodesx 
+-                          $ENV{ISSM_DIR}/src/c/modules/PositiveDegreeDayx 
+-                          $ENV{ISSM_DIR}/src/c/modules/Delta18oParameterizationx 
+-                          $ENV{ISSM_DIR}/src/c/modules/SmbGradientsx 
+-                          $ENV{ISSM_DIR}/src/c/modules/MeshPartitionx 
+-                          $ENV{ISSM_DIR}/src/c/modules/Reducevectorgtofx 
+-                          $ENV{ISSM_DIR}/src/c/modules/Reduceloadx 
+-                          $ENV{ISSM_DIR}/src/c/modules/ConstraintsStatex 
+-                          $ENV{ISSM_DIR}/src/c/modules/ResetConstraintsx 
+-                          $ENV{ISSM_DIR}/src/c/modules/ResetCoordinateSystemx 
+-                          $ENV{ISSM_DIR}/src/c/modules/Solverx 
+-                          $ENV{ISSM_DIR}/src/c/modules/VecMergex 
+-                          $ENV{ISSM_DIR}/src/c/modules/Mergesolutionfromftogx 
+-                          $ENV{ISSM_DIR}/src/c/cores 
+-                          $ENV{ISSM_DIR}/src/c/solutionsequences 
+-                          $ENV{ISSM_DIR}/src/c/solutionsequences)
+-# }}}
+-
+-# Core Sources {{{
+-set(core_sources   	./datastructures/DataSet.cpp
+-					./classes/gauss/GaussTria.cpp
+-					./classes/FemModel.cpp
+-					./classes/Loads/Friction.cpp
+-					./classes/Inputs/TransientInput.cpp
+-					./classes/Constraints/SpcTransient.cpp
+-					./classes/IndependentObject.cpp
+-					./classes/DependentObject.cpp
+-					./classes/DofIndexing.cpp
+-					./classes/IoModel.cpp
+-					./classes/Contours.cpp
+-					./classes/Nodes.cpp
+-					./classes/Vertices.cpp
+-					./classes/Node.cpp
+-					./classes/Vertex.cpp
+-					./classes/Hook.cpp
+-					./classes/ExternalResults/Results.cpp
+-					./classes/Elements/Elements.cpp
+-					./classes/Elements/ElementHook.cpp
+-					./classes/Elements/Tria.cpp
+-					./classes/Elements/TriaRef.cpp
+-					./classes/Inputs/Inputs.cpp
+-					./classes/Inputs/TriaInput.cpp
+-					./classes/Inputs/BoolInput.cpp
+-					./classes/Inputs/IntInput.cpp
+-					./classes/Inputs/DoubleInput.cpp
+-					./classes/Inputs/DatasetInput.cpp
+-					./classes/Materials/Materials.cpp
+-					./classes/Materials/Matice.cpp
+-					./classes/Materials/Matdamageice.cpp
+-					./classes/Materials/Matpar.cpp
+-					./classes/Constraints/Constraints.cpp
+-					./classes/Constraints/SpcStatic.cpp
+-					./classes/Constraints/SpcDynamic.cpp
+-					./classes/Loads/Loads.cpp
+-					./classes/Loads/Penpair.cpp
+-					./classes/Loads/Pengrid.cpp
+-					./classes/Loads/Icefront.cpp
+-					./classes/Loads/Numericalflux.cpp
+-					./classes/matrix/ElementMatrix.cpp
+-					./classes/matrix/ElementVector.cpp
+-					./classes/Params/Parameters.cpp
+-					./classes/Params/BoolParam.cpp
+-					./classes/Params/IntParam.cpp
+-					./classes/Params/IntVecParam.cpp
+-					./classes/Params/IntMatParam.cpp
+-					./classes/Params/DoubleParam.cpp
+-					./classes/Params/FileParam.cpp
+-					./classes/Params/StringArrayParam.cpp
+-					./classes/Params/DoubleMatParam.cpp
+-					./classes/Params/DoubleTransientMatParam.cpp
+-					./classes/Params/DoubleMatArrayParam.cpp
+-					./classes/Params/DoubleVecParam.cpp
+-					./classes/Params/StringParam.cpp
+-					./classes/Params/MatrixParam.cpp
+-					./classes/Params/VectorParam.cpp
+-					./classes/Params/TransientParam.cpp
+-					./classes/Params/DataSetParam.cpp
+-					./classes/Profiler.cpp
+-					./shared/Matrix/MatrixUtils.cpp
+-					./shared/io/Disk/pfopen.cpp
+-					./shared/io/Disk/pfclose.cpp
+-					./shared/io/Disk/WriteLockFile.cpp
+-					./shared/io/Print/PrintfFunction.cpp
+-					./shared/io/Comm/IssmComm.cpp
+-					./shared/LatLong/Ll2xyx.cpp
+-					./shared/LatLong/Xy2llx.cpp
+-					./shared/Enum/EnumToStringx.cpp
+-					./shared/Enum/StringToEnumx.cpp
+-					./shared/Numerics/Verbosity.cpp
+-					./shared/Numerics/GaussPoints.cpp
+-					./shared/Numerics/cross.cpp
+-					./shared/Numerics/isnan.cpp
+-					./shared/Numerics/cubic.cpp
+-					./shared/Numerics/extrema.cpp
+-					./shared/Numerics/XZvectorsToCoordinateSystem.cpp
+-					./shared/Exceptions/Exceptions.cpp
+-					./shared/Exceptions/exprintf.cpp
+-					./shared/Sorting/binary_search.cpp
+-					./shared/Elements/Paterson.cpp
+-					./shared/Elements/Arrhenius.cpp
+-					./shared/Elements/PrintArrays.cpp
+-					./shared/Elements/PddSurfaceMassBalance.cpp
+-					./shared/Elements/ComputeDelta18oTemperaturePrecipitation.cpp
+-					./shared/String/DescriptorIndex.cpp
+-					./toolkits/issm/IssmToolkitUtils.cpp
+-					./toolkits/issm/IssmSolver.cpp
+-					./toolkits/ToolkitOptions.cpp
+-					./modules/ModelProcessorx/ModelProcessorx.cpp
+-					./modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp
+-					./modules/ModelProcessorx/NodesPartitioning.cpp
+-					./modules/ModelProcessorx/EdgesPartitioning.cpp
+-					./modules/ModelProcessorx/SortDataSets.cpp
+-					./modules/ModelProcessorx/UpdateCounters.cpp
+-					./modules/ModelProcessorx/CreateDataSets.cpp
+-					./modules/ModelProcessorx/CreateParameters.cpp
+-					./modules/ModelProcessorx/Autodiff/CreateParametersAutodiff.cpp
+-					./modules/ModelProcessorx/CreateEdges.cpp
+-					./modules/ModelProcessorx/CreateElementToEdgeConnectivity.cpp
+-					./modules/ModelProcessorx/CreateSingleNodeToElementConnectivity.cpp
+-					./modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp
+-					./modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp
+-					./modules/ModelProcessorx/CreateNodes.cpp
+-					./modules/ParseToolkitsOptionsx/ParseToolkitsOptionsx.cpp
+-					./modules/NodesDofx/NodesDofx.cpp
+-					./modules/NodalValuex/NodalValuex.cpp
+-					./modules/VerticesDofx/VerticesDofx.cpp
+-					./modules/VertexCoordinatesx/VertexCoordinatesx.cpp
+-					./modules/OutputResultsx/OutputResultsx.cpp
+-					./modules/InputDuplicatex/InputDuplicatex.cpp
+-					./modules/InputScalex/InputScalex.cpp
+-					./modules/SurfaceAreax/SurfaceAreax.cpp
+-					./modules/CreateNodalConstraintsx/CreateNodalConstraintsx.cpp
+-					./modules/UpdateDynamicConstraintsx/UpdateDynamicConstraintsx.cpp
+-					./modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp
+-					./modules/InputUpdateFromConstantx/InputUpdateFromConstantx.cpp
+-					./modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp
+-					./modules/GetSolutionFromInputsx/GetSolutionFromInputsx.cpp
+-					./modules/GetVectorFromInputsx/GetVectorFromInputsx.cpp
+-					./modules/InputUpdateFromVectorx/InputUpdateFromVectorx.cpp
+-					./modules/ConfigureObjectsx/ConfigureObjectsx.cpp
+-					./modules/ComputeBasalStressx/ComputeBasalStressx.cpp
+-					./modules/ComputeStrainRatex/ComputeStrainRatex.cpp
+-					./modules/SpcNodesx/SpcNodesx.cpp
+-					./modules/PositiveDegreeDayx/PositiveDegreeDayx.cpp
+-					./modules/Delta18oParameterizationx/Delta18oParameterizationx.cpp
+-					./modules/SmbGradientsx/SmbGradientsx.cpp
+-					./modules/Reducevectorgtofx/Reducevectorgtofx.cpp
+-					./modules/Reduceloadx/Reduceloadx.cpp
+-					./modules/ConstraintsStatex/ConstraintsStatex.cpp
+-					./modules/ResetConstraintsx/ResetConstraintsx.cpp
+-					./modules/ResetCoordinateSystemx/ResetCoordinateSystemx.cpp
+-					./modules/Solverx/Solverx.cpp
+-					./modules/VecMergex/VecMergex.cpp
+-					./modules/Mergesolutionfromftogx/Mergesolutionfromftogx.cpp
+-					./cores/ProcessArguments.cpp
+-					./cores/ResetBoundaryConditions.cpp
+-					./cores/AnalysisConfiguration.cpp
+-					./cores/WrapperCorePointerFromSolutionEnum.cpp
+-					./cores/CorePointerFromSolutionEnum.cpp
+-					./cores/EnvironmentInit.cpp
+-					./cores/EnvironmentFinalize.cpp
+-					./cores/ad_core.cpp
+-					./solutionsequences/solutionsequence_linear.cpp
+-					./solutionsequences/solutionsequence_nonlinear.cpp
+-					./solutionsequences/solutionsequence_newton.cpp
+-					./solutionsequences/convergence.cpp
+-					./classes/Options/Options.cpp
+-					./classes/Options/OptionUtilities.cpp
+-					./classes/RiftStruct.cpp)
+-set(issm_sources ${core_sources})
+-# }}}
+-
+-# DAKOTA sources  {{{
+-set(dakota_sources 				  ./modules/InputUpdateFromDakotax/InputUpdateFromDakotax.cpp
+-					  				  ./modules/InputUpdateFromVectorDakotax/InputUpdateFromVectorDakotax.cpp
+-					  				  ./modules/InputUpdateFromMatrixDakotax/InputUpdateFromMatrixDakotax.cpp
+-					  ./modules/AverageOntoPartitionx/AverageOntoPartitionx.cpp
+-					  				  ./modules/ModelProcessorx/Dakota/CreateParametersDakota.cpp
+-					  ./cores/dakota_core.cpp
+-					  				  ./cores/DakotaSpawnCore.cpp)
+-#}}}
+-#Transient sources  {{{
+-set(transient_sources ./modules/ModelProcessorx/Transient/UpdateElementsTransient.cpp 
+-							./cores/transient_core.cpp)
+-#}}}
+-#Steadystate sources  {{{
+-set(steadystate_sources ./cores/steadystate_core.cpp)
+-#}}}
+-#Prognostic sources  {{{
+-set(prognostic_sources ./modules/ModelProcessorx/Prognostic/UpdateElementsPrognostic.cpp
+-					      ./modules/ModelProcessorx/Prognostic/CreateNodesPrognostic.cpp
+-					      ./modules/ModelProcessorx/Prognostic/CreateConstraintsPrognostic.cpp
+-					      ./modules/ModelProcessorx/Prognostic/CreateLoadsPrognostic.cpp
+-							./cores/prognostic_core.cpp)
+-#}}}
+-#Thermal sources  {{{
+-set(thermal_sources ./modules/ModelProcessorx/Thermal/UpdateElementsThermal.cpp
+-					   ./modules/ModelProcessorx/Thermal/CreateNodesThermal.cpp
+-					   ./modules/ModelProcessorx/Thermal/CreateConstraintsThermal.cpp
+-					   ./modules/ModelProcessorx/Thermal/CreateLoadsThermal.cpp
+-					   ./modules/ModelProcessorx/Enthalpy/UpdateElementsEnthalpy.cpp
+-					   ./modules/ModelProcessorx/Enthalpy/CreateNodesEnthalpy.cpp
+-					   ./modules/ModelProcessorx/Enthalpy/CreateConstraintsEnthalpy.cpp
+-					   ./modules/ModelProcessorx/Enthalpy/CreateLoadsEnthalpy.cpp
+-					   ./modules/ModelProcessorx/Melting/UpdateElementsMelting.cpp
+-					   ./modules/ModelProcessorx/Melting/CreateNodesMelting.cpp
+-					   ./modules/ModelProcessorx/Melting/CreateConstraintsMelting.cpp
+-					   ./modules/ModelProcessorx/Melting/CreateLoadsMelting.cpp
+-					   ./modules/ConstraintsStatex/ThermalConstraintsState.cpp
+-					   ./modules/ConstraintsStatex/ThermalIsPresent.cpp
+-					   ./modules/ResetConstraintsx/ThermalConstraintsReset.cpp 
+-					   ./cores/thermal_core.cpp
+-					   ./solutionsequences/solutionsequence_thermal_nonlinear.cpp)
+-#}}}
+-#Control sources  {{{
+-set(control_sources ./modules/ControlInputGetGradientx/ControlInputGetGradientx.cpp
+-					  				  ./modules/ControlInputSetGradientx/ControlInputSetGradientx.cpp
+-					  				  ./modules/ControlInputScaleGradientx/ControlInputScaleGradientx.cpp
+-					  				  ./modules/GetVectorFromControlInputsx/GetVectorFromControlInputsx.cpp
+-					  				  ./modules/SetControlInputsFromVectorx/SetControlInputsFromVectorx.cpp
+-					  				  ./modules/ModelProcessorx/Control/CreateParametersControl.cpp
+-					  ./modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp
+-					  				  ./modules/InputControlUpdatex/InputControlUpdatex.cpp
+-					  				  ./modules/SurfaceAbsVelMisfitx/SurfaceAbsVelMisfitx.cpp
+-					  				  ./modules/SurfaceRelVelMisfitx/SurfaceRelVelMisfitx.cpp
+-					  				  ./modules/SurfaceLogVelMisfitx/SurfaceLogVelMisfitx.cpp
+-					  				  ./modules/SurfaceLogVxVyMisfitx/SurfaceLogVxVyMisfitx.cpp
+-					  				  ./modules/SurfaceAverageVelMisfitx/SurfaceAverageVelMisfitx.cpp
+-					  				  ./modules/ThicknessAbsMisfitx/ThicknessAbsMisfitx.cpp
+-					  				  ./modules/Orthx/Orthx.cpp
+-					  				  ./modules/Gradjx/Gradjx.cpp
+-					  ./modules/DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.cpp
+-					  				  ./modules/ThicknessAlongGradientx/ThicknessAlongGradientx.cpp
+-					  				  ./modules/ThicknessAcrossGradientx/ThicknessAcrossGradientx.cpp
+-					  				  ./modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.cpp
+-					  				  				  ./classes/Inputs/ControlInput.cpp
+-					  ./shared/Numerics/BrentSearch.cpp
+-					  ./shared/Numerics/OptimalSearch.cpp 
+-					  ./cores/control_core.cpp
+-					  ./cores/controltao_core.cpp
+-					  ./cores/objectivefunction.cpp
+-					  ./cores/gradient_core.cpp
+-					  ./cores/adjointdiagnostic_core.cpp
+-					  ./cores/adjointbalancethickness_core.cpp
+-					  ./cores/AdjointCorePointerFromSolutionEnum.cpp
+-					  ./solutionsequences/solutionsequence_adjoint_linear.cpp)
+-#}}}
+-#Hydrology sources  {{{
+-set(hydrology_sources  ./modules/ModelProcessorx/HydrologyShreve/UpdateElementsHydrologyShreve.cpp
+-					      ./modules/ModelProcessorx/HydrologyShreve/CreateNodesHydrologyShreve.cpp
+-					      ./modules/ModelProcessorx/HydrologyShreve/CreateConstraintsHydrologyShreve.cpp
+-					      ./modules/ModelProcessorx/HydrologyShreve/CreateLoadsHydrologyShreve.cpp 
+-							./modules/ModelProcessorx/HydrologyShreve/CreateParametersHydrologyShreve.cpp 
+-							./modules/ModelProcessorx/HydrologyDCInefficient/UpdateElementsHydrologyDCInefficient.cpp
+-							./modules/ModelProcessorx/HydrologyDCInefficient/CreateNodesHydrologyDCInefficient.cpp
+-							./modules/ModelProcessorx/HydrologyDCInefficient/CreateConstraintsHydrologyDCInefficient.cpp
+-							./modules/ModelProcessorx/HydrologyDCInefficient/CreateLoadsHydrologyDCInefficient.cpp 
+-							./modules/ModelProcessorx/HydrologyDCInefficient/CreateParametersHydrologyDCInefficient.cpp 
+-							./modules/ModelProcessorx/HydrologyDCEfficient/UpdateElementsHydrologyDCEfficient.cpp
+-							./modules/ModelProcessorx/HydrologyDCEfficient/CreateNodesHydrologyDCEfficient.cpp
+-							./modules/ModelProcessorx/HydrologyDCEfficient/CreateConstraintsHydrologyDCEfficient.cpp
+-							./modules/ModelProcessorx/HydrologyDCEfficient/CreateLoadsHydrologyDCEfficient.cpp 
+-							./modules/ModelProcessorx/HydrologyDCEfficient/CreateParametersHydrologyDCEfficient.cpp 
+-							./cores/hydrology_core.cpp
+-							./solutionsequences/solutionsequence_hydro_nonlinear.cpp)
+-#}}}
+-#Diagnostic sources  {{{
+-set(diagnostic_sources ./modules/ModelProcessorx/DiagnosticHoriz/UpdateElementsDiagnosticHoriz.cpp
+-					      ./modules/ModelProcessorx/DiagnosticHoriz/CreateNodesDiagnosticHoriz.cpp 
+-					      ./modules/ModelProcessorx/DiagnosticHoriz/CreateConstraintsDiagnosticHoriz.cpp 
+-					      ./modules/ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp
+-					      ./modules/ModelProcessorx/DiagnosticVert/UpdateElementsDiagnosticVert.cpp
+-					      ./modules/ModelProcessorx/DiagnosticVert/CreateNodesDiagnosticVert.cpp 
+-					      ./modules/ModelProcessorx/DiagnosticVert/CreateConstraintsDiagnosticVert.cpp 
+-					      ./modules/ModelProcessorx/DiagnosticVert/CreateLoadsDiagnosticVert.cpp
+-					      ./modules/ModelProcessorx/DiagnosticHutter/UpdateElementsDiagnosticHutter.cpp
+-					      ./modules/ModelProcessorx/DiagnosticHutter/CreateNodesDiagnosticHutter.cpp 
+-					      ./modules/ModelProcessorx/DiagnosticHutter/CreateConstraintsDiagnosticHutter.cpp 
+-							./modules/ModelProcessorx/DiagnosticHutter/CreateLoadsDiagnosticHutter.cpp 
+-							./cores/diagnostic_core.cpp
+-							./solutionsequences/solutionsequence_stokescoupling_nonlinear.cpp)
+-#}}}
+-#Balanced sources  {{{
+-set(balanced_sources ./modules/ModelProcessorx/Balancethickness/UpdateElementsBalancethickness.cpp
+-					    ./modules/ModelProcessorx/Balancethickness/CreateNodesBalancethickness.cpp
+-					    ./modules/ModelProcessorx/Balancethickness/CreateConstraintsBalancethickness.cpp
+-						 ./modules/ModelProcessorx/Balancethickness/CreateLoadsBalancethickness.cpp
+-						 ./cores/balancethickness_core.cpp 
+-						 ./cores/dummy_core.cpp)
+-#}}}
+-#Slope sources  {{{
+-set(slope_sources  ./modules/ModelProcessorx/BedSlope/UpdateElementsBedSlope.cpp
+-					  ./modules/ModelProcessorx/BedSlope/CreateNodesBedSlope.cpp 
+-					  ./modules/ModelProcessorx/BedSlope/CreateConstraintsBedSlope.cpp
+-					  ./modules/ModelProcessorx/BedSlope/CreateLoadsBedSlope.cpp
+-					  ./modules/ModelProcessorx/SurfaceSlope/UpdateElementsSurfaceSlope.cpp
+-					  ./modules/ModelProcessorx/SurfaceSlope/CreateNodesSurfaceSlope.cpp 
+-					  ./modules/ModelProcessorx/SurfaceSlope/CreateConstraintsSurfaceSlope.cpp
+-					  ./modules/ModelProcessorx/SurfaceSlope/CreateLoadsSurfaceSlope.cpp
+-					  ./cores/surfaceslope_core.cpp
+-					  ./cores/bedslope_core.cpp)
+-#}}}
+-#Gia sources  {{{
+-set(gia_sources  ./cores/gia_core.cpp
+-					./modules/ModelProcessorx/Gia/UpdateElementsGia.cpp
+-					./modules/ModelProcessorx/Gia/CreateNodesGia.cpp 
+-					./modules/ModelProcessorx/Gia/CreateConstraintsGia.cpp
+-					./modules/ModelProcessorx/Gia/CreateLoadsGia.cpp
+-					./modules/GiaDeflectionCorex/GiaDeflectionCorex.cpp
+-									./modules/GiaDeflectionCorex/distme.f
+-					./modules/GiaDeflectionCorex/freed.f
+-					./modules/GiaDeflectionCorex/ojrule.f
+-					./modules/GiaDeflectionCorex/pwise.f
+-					./modules/GiaDeflectionCorex/qwise.f
+-					./modules/GiaDeflectionCorex/stot.f
+-					./modules/GiaDeflectionCorex/what0.f
+-					)
+-#}}}
+-#Groundingline sources  {{{
+-set(groundingline_sources ./modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp
+-					        )
+-#}}}
+-#Rifts sources  {{{
+-set(rifts_sources ./classes/Loads/Riftfront.cpp
+-				    			    ./modules/ConstraintsStatex/RiftConstraintsState.cpp)
+-#}}}
+-#Android sources  {{{
+-set(android_sources )
+-#}}}
+-#3D sources  {{{
+-set(threed_sources 			     ./classes/gauss/GaussPenta.cpp
+-				     			     ./classes/Inputs/PentaInput.cpp
+-				     			     ./classes/Elements/Penta.cpp
+-				     			     ./classes/Elements/PentaRef.cpp)
+-#}}}
+-#Bamg sources  {{{
+-set(bamg_sources  						./bamg/BamgGeom.cpp
+-							./bamg/BamgMesh.cpp
+-							./bamg/BamgOpts.cpp
+-							./bamg/CrackedEdge.cpp
+-							./bamg/Curve.cpp
+-							./bamg/Direction.cpp
+-										./bamg/Edge.cpp
+-							./bamg/GeomEdge.cpp
+-							./bamg/GeomSubDomain.cpp
+-							./bamg/GeomVertex.cpp
+-				./bamg/Geometry.cpp
+-							./bamg/ListofIntersectionTriangles.cpp
+-							./bamg/EigenMetric.cpp
+-				./bamg/Metric.cpp
+-							./bamg/BamgQuadtree.cpp
+-										./bamg/SetOfE4.cpp
+-										./bamg/SubDomain.cpp
+-							./bamg/AdjacentTriangle.cpp
+-				./bamg/Triangle.cpp
+-				./bamg/det.h 
+-							./bamg/BamgVertex.cpp
+-										./bamg/VertexOnEdge.cpp
+-							./bamg/VertexOnGeom.cpp
+-							./bamg/VertexOnVertex.cpp
+-				./bamg/Mesh.cpp
+-							./shared/Bamg/Abs.h 
+-							./shared/Bamg/BigPrimeNumber.cpp
+-				./shared/Bamg/BinaryRand.h 
+-				./shared/Bamg/Exchange.h 
+-				./shared/Bamg/extrema.h 
+-				./shared/Bamg/HeapSort.h 
+-				./shared/Bamg/OppositeAngle.h 
+-				./modules/Bamgx/Bamgx.cpp
+-							./modules/BamgConvertMeshx/BamgConvertMeshx.cpp
+-							./modules/BamgTriangulatex/BamgTriangulatex.cpp
+-				)
+-#}}}
+-#Kriging sources  {{{
+-set(kriging_sources 					./classes/kriging/Observations.cpp
+-						./classes/kriging/Variogram.h 
+-											./classes/kriging/GaussianVariogram.cpp
+-											./classes/kriging/ExponentialVariogram.cpp
+-											./classes/kriging/SphericalVariogram.cpp
+-											./classes/kriging/PowerVariogram.cpp
+-											./classes/kriging/Quadtree.cpp
+-											./classes/kriging/Observation.cpp
+-						./modules/Krigingx/Krigingx.cpp
+-						./modules/Krigingx/Kriging
+-#For parallel kriging, only difference is ./modules/Krigingx/pKrigingx.cpp with no multithreading
+-set(pkriging_sources 					./classes/kriging/Observations.cpp
+-						./classes/kriging/Variogram.h 
+-											./classes/kriging/GaussianVariogram.cpp
+-											./classes/kriging/ExponentialVariogram.cpp
+-											./classes/kriging/SphericalVariogram.cpp
+-											./classes/kriging/PowerVariogram.cpp
+-											./classes/kriging/Quadtree.cpp
+-											./classes/kriging/Observation.cpp
+-						./modules/Krigingx/pKrigingx.cpp
+-						)
+-#}}}
+-#Kml sources  {{{
+-set(kml_sources 		     ./modules/Exp2Kmlx/Exp2Kmlx.cpp
+-			     		     ./modules/Kml2Expx/Kml2Expx.cpp
+-			     		     ./modules/Shp2Expx/Shp2Expx.cpp
+-			     		     ./modules/Shp2Kmlx/Shp2Kmlx.cpp
+-			     		     ./modules/KMLFileReadx/KMLFileReadx.cpp
+-			     		     ./modules/KMLMeshWritex/KMLMeshWritex.cpp
+-			     		     ./modules/KMLOverlayx/KMLOverlayx.cpp
+-			     		     ./kml/KML_Attribute.cpp
+-			     		     ./kml/KML_Comment.cpp
+-			     		     ./kml/KML_ColorStyle.cpp
+-			     		     ./kml/KML_Container.cpp
+-			     		     ./kml/KML_Document.cpp
+-			     		     ./kml/KML_Feature.cpp
+-			     		     ./kml/KML_File.cpp
+-			     		     ./kml/KML_Folder.cpp
+-			     		     ./kml/KML_Geometry.cpp
+-			     		     ./kml/KML_GroundOverlay.cpp
+-			     		     ./kml/KML_Icon.cpp
+-			     		     ./kml/KML_LatLonBox.cpp
+-		  	     		     ./kml/KML_LinearRing.cpp
+-			     		     ./kml/KML_LineString.cpp
+-			     		     ./kml/KML_LineStyle.cpp
+-			     		     ./kml/KML_MultiGeometry.cpp
+-			     		     ./kml/KML_Object.cpp
+-			     		     ./kml/KML_Overlay.cpp
+-			     		     ./kml/KML_Point.cpp
+-			     		     ./kml/KML_Placemark.cpp
+-			     		     ./kml/KML_Polygon.cpp
+-			     		     ./kml/KML_PolyStyle.cpp
+-			     		     ./kml/KML_Style.cpp
+-			     		     ./kml/KML_StyleSelector.cpp
+-			     		     ./kml/KML_SubStyle.cpp
+-			     		     ./kml/KML_Unknown.cpp
+-			     		     ./kml/KMLFileReadUtils.cpp
+-			     )
+-#}}}
+-#Petsc sources  {{{
+-petsc_sources= ./toolkits/petsc
+-					./toolkits/petsc/patches
+-													./toolkits/petsc/patches/VecToMPISerial.cpp
+-					./toolkits/petsc/patches/MatToSerial.cpp
+-					./toolkits/petsc/patches/VecMerge.cpp
+-					./toolkits/petsc/patches/NewVec.cpp
+-					./toolkits/petsc/patches/PetscOptionsDetermineSolverType.cpp
+-					./toolkits/petsc/patches/PetscOptionsInsertMultipleString.cpp
+-					./toolkits/petsc/patches/NewMat.cpp
+-					./toolkits/petsc/patches/VecFree.cpp
+-					./toolkits/petsc/patches/KSPFree.cpp
+-					./toolkits/petsc/patches/MatFree.cpp
+-					./toolkits/petsc/patches/MatMultPatch.cpp
+-					./toolkits/petsc/patches/ISSMToPetscMatrixType.cpp
+-					./toolkits/petsc/patches/ISSMToPetscInsertMode.cpp
+-					./toolkits/petsc/patches/ISSMToPetscNormMode.cpp
+-													./toolkits/petsc/objects/PetscMat.cpp
+-									./toolkits/petsc/objects/PetscVec.cpp
+-					./toolkits/petsc/objects/PetscSolver.cpp
+-									)
+-#}}}
+-#Mumps sources  {{{
+-set(mumps_sources      ./toolkits/mumps
+-									./toolkits/mumps/MpiDenseMumpsSolve.cpp)
+-#}}}
+-#Gsl sources  {{{
+-set(gsl_sources   ./toolkits/gsl/DenseGslSolve.cpp)
+-#}}}
+-#Mpi sources  {{{
+-set(mpi_sources 						./toolkits/mpi/patches/DetermineLocalSize.cpp
+-				./toolkits/mpi/patches/DetermineGlobalSize.cpp
+-				./toolkits/mpi/patches/DetermineRowRankFromLocalSize.cpp
+-				./toolkits/mpi/patches/GetOwnershipBoundariesFromRange.cpp
+-							)
+-#}}}
+-#Metis sources  {{{
+-set(metis_sources 				./toolkits/metis/patches/METIS_PartMeshNodalPatch.cpp)
+-#}}}
+-
+-# API Print {{{
+-if(NOT PYTHON AND NOT MATLAB)
+-    add_library(ISSMOverload STATIC ./shared/String/ApiPrintf.cpp)
+-    list(APPEND issm_deps ISSMOverload)
+-else(NOT PYTHON AND NOT MATLAB)
+-    message(FATAL_ERROR "Python and Matlab are not supported yet.")
+-endif(NOT PYTHON AND NOT MATLAB)
+-# }}}
+-
+-# Modules Sources {{{
+-set(modules_sources ./shared/Threads/LaunchThread.cpp
+-			./shared/Threads/PartitionRange.cpp
+-			./shared/Exp/exp.cpp
+-			./shared/TriMesh/AssociateSegmentToElement.cpp
+-			./shared/TriMesh/GridInsideHole.cpp
+-			./shared/TriMesh/OrderSegments.cpp
+-			./shared/TriMesh/SplitMeshForRifts.cpp
+-			./shared/TriMesh/TriMeshUtils.cpp
+-			./modules/Chacox/Chacox.cpp
+-			./modules/Chacox/input_parse.cpp
+-			./modules/Chacox/chaco_seconds.cpp
+-			./modules/Chacox/user_params.cpp
+-			./modules/TriaSearchx/TriaSearchx.cpp
+-			./modules/TriMeshx/TriMeshx.cpp
+-			./modules/TriMeshProcessRiftsx/TriMeshProcessRiftsx.cpp
+-			./modules/PointCloudFindNeighborsx/PointCloudFindNeighborsx.cpp
+-			./modules/PointCloudFindNeighborsx/PointCloudFindNeighborsxt.cpp
+-			./modules/InterpFromGridToMeshx/InterpFromGridToMeshx.cpp
+-			./modules/InterpFromMesh2dx/InterpFromMesh2dx.cpp
+-			./modules/InterpFromMesh2dx/InterpFromMesh2dxt.cpp
+-			./modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.cpp
+-			./modules/InterpFromMeshToMesh3dx/InterpFromMeshToMesh3dx.cpp
+-			./modules/InterpFromMeshToGridx/InterpFromMeshToGridx.cpp
+-			./modules/HoleFillerx/HoleFillerx.cpp
+-			./modules/EdgeDetectionx/EdgeDetectionx.cpp
+-			./modules/AverageFilterx/AverageFilterx.cpp
+-			./modules/MeshProfileIntersectionx/MeshProfileIntersectionx.cpp
+-			./modules/ContourToMeshx/ContourToMeshx.cpp
+-			./modules/ContourToMeshx/ContourToMeshxt.cpp
+-			./modules/ContourToNodesx/ContourToNodesx.cpp
+-			./modules/Reducevectorgtosx/Reducevectorgtosx.cpp
+-			./modules/NodeConnectivityx/NodeConnectivityx.cpp
+-			./modules/ElementConnectivityx/ElementConnectivityx.cpp
+-			./modules/Scotchx/Scotchx.cpp
+-			./modules/PropagateFlagsFromConnectivityx/PropagateFlagsFromConnectivityx.cpp)
+-# }}}
+-
+-#{{{ Conditional build-up of sources
+-#ISSM sources are a combination of core sources and sources related to specific capabilities.
+-
+-if(DAKOTA)
+-list(APPEND CPP_FLAGS '-D_HAVE_DAKOTA_')
+-list(APPEND issm_sources ${dakota_sources})
+-endif(DAKOTA)
+-
+-if(PETSC)
+-list(APPEND CPP_FLAGS '-D_HAVE_PETSC_')
+-list(APPEND issm_sources ${petsc_sources})
+-endif(PETSC)
+-
+-if(MUMPS)
+-list(APPEND CPP_FLAGS '-D_HAVE_MUMPS_')
+-list(APPEND issm_sources ${mumps_sources})
+-endif(MUMPS)
+-
+-if(GSL)
+-list(APPEND CPP_FLAGS '-D_HAVE_GSL_')
+-list(APPEND issm_sources ${gsl_sources})
+-list(APPEND issm_deps gsl gslcblas)
+-list(APPEND issm_lib_paths ${GSL_LIB_DIR})
+-include_directories(AFTER ${GSL_INC_DIR})
+-message("GSL_INC: ${GSL_INC_DIR}")
+-message("GSL_LIB: ${GSL_LIB_DIR}")
+-endif(GSL)
+-
+-if(TRANSIENT)
+-list(APPEND CPP_FLAGS '-D_HAVE_TRANSIENT_')
+-list(APPEND issm_sources ${transient_sources})
+-endif(TRANSIENT)
+-
+-if(STEADYSTATE)
+-list(APPEND CPP_FLAGS '-D_HAVE_STEADYSTATE_')
+-list(APPEND issm_sources ${steadystate_sources})
+-endif(STEADYSTATE)
+-
+-if(PROGNOSTIC)
+-list(APPEND CPP_FLAGS '-D_HAVE_PROGNOSTIC_')
+-list(APPEND issm_sources ${prognostic_sources})
+-endif(PROGNOSTIC)
+-
+-if(THERMAL)
+-list(APPEND CPP_FLAGS '-D_HAVE_THERMAL_')
+-list(APPEND issm_sources ${thermal_sources})
+-endif(THERMAL)
+-
+-if(GIA)
+-list(APPEND CPP_FLAGS '-D_HAVE_GIA_')
+-list(APPEND issm_sources ${gia_sources})
+-endif(GIA)
+-
+-if(CONTROL)
+-list(APPEND CPP_FLAGS '-D_HAVE_CONTROL_')
+-list(APPEND issm_sources ${control_sources})
+-endif(CONTROL)
+-
+-if(HYDROLOGY)
+-list(APPEND CPP_FLAGS '-D_HAVE_HYDROLOGY_')
+-list(APPEND issm_sources ${hydrology_sources})
+-endif(HYDROLOGY)
+-
+-if(DIAGNOSTIC)
+-list(APPEND CPP_FLAGS '-D_HAVE_DIAGNOSTIC_')
+-list(APPEND issm_sources ${diagnostic_sources})
+-endif(DIAGNOSTIC)
+-
+-if(BALANCED)
+-list(APPEND CPP_FLAGS '-D_HAVE_BALANCED_')
+-list(APPEND issm_sources ${balanced_sources})
+-endif(BALANCED)
+-
+-if(SLOPE)
+-list(APPEND CPP_FLAGS '-D_HAVE_SLOPE_')
+-list(APPEND issm_sources ${slope_sources})
+-endif(SLOPE)
+-
+-if(GROUNDINGLINE)
+-list(APPEND CPP_FLAGS '-D_HAVE_GROUNDINGLINE_')
+-list(APPEND issm_sources ${groundingline_sources})
+-endif(GROUNDINGLINE)
+-
+-if(RIFTS)
+-list(APPEND CPP_FLAGS '-D_HAVE_RIFTS_')
+-list(APPEND issm_sources ${rifts_sources})
+-endif(RIFTS)
+-
+-if(ANDROID)
+-list(APPEND CPP_FLAGS '-D_HAVE_ANDROID_')
+-list(APPEND issm_sources ${android_sources})
+-endif(ANDROID)
+-
+-if(THREED)
+-list(APPEND CPP_FLAGS '-D_HAVE_THREED_')
+-list(APPEND issm_sources ${threed_sources})
+-endif(THREED)
+-
+-if(MPI)
+-list(APPEND CPP_FLAGS '-D_HAVE_MPI_')
+-list(APPEND issm_sources ${mpi_sources})
+-endif(MPI)
+-
+-if(METIS)
+-list(APPEND CPP_FLAGS '-D_HAVE_METIS_')
+-list(APPEND issm_sources ${metis_sources})
+-endif(METIS)
+-
+-if(KRIGING)
+-list(APPEND CPP_FLAGS '-D_HAVE_KRIGING_')
+-list(APPEND issm_sources ${pkriging_sources})
+-endif(KRIGING)
+-#}}}
+-
+-add_library(ISSMCore STATIC ${issm_sources})
+-add_library(ISSMModules STATIC ${modules_sources})
+-
+-list(INSERT issm_deps 0 ISSMCore ISSMModules)
+-add_executable(issm ./main/issm.cpp)
+-
+-# Definitions {{{
+-add_definitions(${CPP_FLAGS})
+-# }}}
+-# Compilation Flags {{{
+-# }}}
+-# Linking Flags {{{
+-link_directories($ENV{ISSM_DIR}/src/c )
+-target_link_libraries(issm ${issm_deps})
+-message("ISSM_DEPS: ${issm_deps}")
+-# }}}
+-
+-# Install Targets {{{
+-# Install 'issm.exe'
+-install(TARGETS issm RUNTIME DESTINATION $ENV{ISSM_DIR}/bin)
+-
+-# Install 'libISSMCore.a' and 'libISSMOverload.a'
+-install(TARGETS ISSMCore
+-                ISSMModules
+-                ISSMOverload
+-        ARCHIVE DESTINATION $ENV{ISSM_DIR}/lib)
+-# }}}
+-# Optional Install {{{
+-#if(${SHARED_LIBS} IS ON)
+-#   install(TARGETS ISSMCore
+-#                   ISSMOverload
+-#           LIBRARY)
+-#endif(${SHARED_LIBS} IS ON)
+-# }}}
Index: issm/oecreview/Archive/16554-17801/ISSM-17586-17587.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17586-17587.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17586-17587.diff	(revision 17802)
@@ -0,0 +1,67 @@
+Index: ../trunk-jpl/src/m/coordsystems/ll2xy.py
+===================================================================
+--- ../trunk-jpl/src/m/coordsystems/ll2xy.py	(revision 0)
++++ ../trunk-jpl/src/m/coordsystems/ll2xy.py	(revision 17587)
+@@ -0,0 +1,62 @@
++import numpy as npy 
++
++def ll2xy(lat,lon,sgn=-1,central_meridian=0,standard_parallel=71):
++	'''
++	LL2XY - converts lat lon to polar stereographic
++
++   Converts from geodetic latitude and longitude to Polar 
++   Stereographic (X,Y) coordinates for the polar regions.
++   Author: Michael P. Schodlok, December 2003 (map2ll)
++
++   Usage:
++      x,y = ll2xy(lat,lon,sgn)
++      x,y = ll2xy(lat,lon,sgn,central_meridian,standard_parallel)
++
++      - sgn = Sign of latitude +1 : north latitude (default is mer=45 lat=70)
++                               -1 : south latitude (default is mer=0  lat=71)
++	'''
++
++	assert sgn==1 or sgn==-1, 'error: sgn should be either +1 or -1'
++
++	#Get central_meridian and standard_parallel depending on hemisphere
++	if sgn == 1:
++		delta = 45
++		slat = 70
++		print 'Info: creating coordinates in polar stereographic (Std Latitude: 70N Meridian: 45)'
++	else: 
++		delta = central_meridian
++		slat = standard_parallel
++		print 'Info: creating coordinates in polar stereographic (Std Latitude: 71S Meridian: 0)'
++	
++	# Conversion constant from degrees to radians
++	cde = 57.29577951
++	# Radius of the earth in meters
++	re = 6378.273*10**3
++	# Eccentricity of the Hughes ellipsoid squared
++	ex2 = .006693883
++	# Eccentricity of the Hughes ellipsoid
++	ex = npy.sqrt(ex2)
++	
++	latitude = npy.abs(lat) * npy.pi/180.
++	longitude = (lon + delta) * npy.pi/180.
++	
++	# compute X and Y in grid coordinates.
++	T = npy.tan(npy.pi/4-latitude/2) / ((1-ex*npy.sin(latitude))/(1+ex*npy.sin(latitude)))**(ex/2)
++	
++	if (90 - slat) <  1.e-5:
++		rho = 2.*re*T/npy.sqrt((1.+ex)**(1.+ex)*(1.-ex)**(1.-ex))
++	else:
++		sl  = slat*npy.pi/180.
++		tc  = npy.tan(npy.pi/4.-sl/2.)/((1.-ex*npy.sin(sl))/(1.+ex*npy.sin(sl)))**(ex/2.)
++		mc  = npy.cos(sl)/npy.sqrt(1.0-ex2*(npy.sin(sl)**2))
++		rho = re*mc*T/tc
++	
++	y = -rho * sgn * npy.cos(sgn*longitude)
++	x =  rho * sgn * npy.sin(sgn*longitude)
++
++	cnt1=npy.nonzero(latitude>= npy.pi/2.)[0]
++	
++	if cnt1:
++		x[cnt1,0] = 0.0
++		y[cnt1,0] = 0.0
++	return x,y
Index: issm/oecreview/Archive/16554-17801/ISSM-17587-17588.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17587-17588.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17587-17588.diff	(revision 17802)
@@ -0,0 +1,36 @@
+Index: ../trunk-jpl/src/m/classes/model.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.py	(revision 17587)
++++ ../trunk-jpl/src/m/classes/model.py	(revision 17588)
+@@ -2,7 +2,7 @@
+ import numpy
+ import copy
+ import sys
+-from mesh import mesh
++from mesh2d import mesh2d
+ from mesh3dprisms import mesh3dprisms
+ from mask import mask
+ from geometry import geometry
+@@ -55,7 +55,7 @@
+ class model(object):
+ 	#properties
+ 	def __init__(self):#{{{
+-		self.mesh             = mesh()
++		self.mesh             = mesh2d()
+ 		self.mask             = mask()
+ 		self.geometry         = geometry()
+ 		self.constants        = constants()
+Index: ../trunk-jpl/src/m/parameterization/contourenvelope.py
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/contourenvelope.py	(revision 17587)
++++ ../trunk-jpl/src/m/parameterization/contourenvelope.py	(revision 17588)
+@@ -3,7 +3,8 @@
+ import copy
+ from NodeConnectivity import NodeConnectivity
+ from ElementConnectivity import ElementConnectivity
+-from mesh import mesh
++from mesh2d import mesh2d
++from mesh3dprisms import mesh3dprisms
+ import MatlabFuncs as m
+ 
+ def contourenvelope(md,*args):
Index: issm/oecreview/Archive/16554-17801/ISSM-17588-17589.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17588-17589.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17588-17589.diff	(revision 17802)
@@ -0,0 +1,17 @@
+Index: ../trunk-jpl/src/m/classes/mesh3dprisms.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh3dprisms.m	(revision 17588)
++++ ../trunk-jpl/src/m/classes/mesh3dprisms.m	(revision 17589)
+@@ -41,10 +41,10 @@
+ 		extractedelements           = NaN
+ 	end
+ 	methods
+-		function obj = mesh(varargin) % {{{
++		function self = mesh3dprisms(varargin) % {{{
+ 			switch nargin
+ 				case 0
+-					obj=setdefaultparameters(obj);
++					self=setdefaultparameters(self);
+ 				case 1
+ 					self=mesh3dprisms();
+ 					object=varargin{1};
Index: issm/oecreview/Archive/16554-17801/ISSM-17589-17590.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17589-17590.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17589-17590.diff	(revision 17802)
@@ -0,0 +1,1680 @@
+Index: ../trunk-jpl/test/Par/SquareEISMINT.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareEISMINT.py	(revision 17589)
++++ ../trunk-jpl/test/Par/SquareEISMINT.py	(revision 17590)
+@@ -7,8 +7,8 @@
+ ymin=numpy.min(md.mesh.y)
+ ymax=numpy.max(md.mesh.y)
+ md.geometry.thickness=500.*numpy.ones((md.mesh.numberofvertices,1))
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
++md.geometry.surface=md.geometry.base+md.geometry.thickness
+ 
+ print "      creating drag"
+ md.friction.coefficient=200.*numpy.ones((md.mesh.numberofvertices,1))
+Index: ../trunk-jpl/test/Par/RoundSheetShelf.py
+===================================================================
+--- ../trunk-jpl/test/Par/RoundSheetShelf.py	(revision 17589)
++++ ../trunk-jpl/test/Par/RoundSheetShelf.py	(revision 17590)
+@@ -17,44 +17,44 @@
+ ymin=numpy.min(radius)
+ ymax=numpy.max(radius)
+ md.geometry.thickness=hmax+(hmin-hmax)*(radius-ymin)/(ymax-ymin)
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
+ 
+ pos=numpy.nonzero(md.mask.groundedice_levelset>0.)[0]
+-md.geometry.bed[pos]=md.geometry.bed[pos]-300.*(radius[pos]-(rad-shelfextent))/(rad-shelfextent)
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness
++md.geometry.base[pos]=md.geometry.base[pos]-300.*(radius[pos]-(rad-shelfextent))/(rad-shelfextent)
++md.geometry.surface=md.geometry.base+md.geometry.thickness
+ 
+ pos=numpy.nonzero(radius<200000.)
+ md.geometry.thickness[pos]=100.
+-md.geometry.bed[pos]=-di*md.geometry.thickness[pos]-20.
+-md.geometry.surface[pos]=md.geometry.bed[pos]+md.geometry.thickness[pos]
++md.geometry.base[pos]=-di*md.geometry.thickness[pos]-20.
++md.geometry.surface[pos]=md.geometry.base[pos]+md.geometry.thickness[pos]
+ 
+ pos=numpy.nonzero(numpy.logical_and(numpy.logical_and(md.mesh.x<0.2*1.e6,md.mesh.x>-0.2*1.e6),md.mesh.y>0.))
+ md.geometry.thickness[pos]=100.
+-md.geometry.bed[pos]=-di*md.geometry.thickness[pos]-20.
+-md.geometry.surface[pos]=md.geometry.bed[pos]+md.geometry.thickness[pos]
++md.geometry.base[pos]=-di*md.geometry.thickness[pos]-20.
++md.geometry.surface[pos]=md.geometry.base[pos]+md.geometry.thickness[pos]
+ 
+ pos=numpy.nonzero(numpy.logical_and(numpy.logical_and(md.mesh.x<0.1*1.e6,md.mesh.x>-0.1*1.e6),numpy.logical_and(md.mesh.y<-0.5*1.e6,md.mesh.y>-0.6*1.e6)))
+ md.geometry.thickness[pos]=100.
+-md.geometry.bed[pos]=-di*md.geometry.thickness[pos]-20.
+-md.geometry.surface[pos]=md.geometry.bed[pos]+md.geometry.thickness[pos]
++md.geometry.base[pos]=-di*md.geometry.thickness[pos]-20.
++md.geometry.surface[pos]=md.geometry.base[pos]+md.geometry.thickness[pos]
+ 
+ #plug holes into the ice sheet, to test for grounding line migration. 
+ di=md.materials.rho_ice/md.materials.rho_water
+ rad=numpy.sqrt(md.mesh.x**2+md.mesh.y**2)
+ pos=numpy.nonzero(rad<200000.)
+ md.geometry.thickness[pos]=100.
+-md.geometry.bed[pos]=-di*md.geometry.thickness[pos]-20.
+-md.geometry.surface[pos]=md.geometry.bed[pos]+md.geometry.thickness[pos]
++md.geometry.base[pos]=-di*md.geometry.thickness[pos]-20.
++md.geometry.surface[pos]=md.geometry.base[pos]+md.geometry.thickness[pos]
+ 
+ pos=numpy.nonzero(numpy.logical_and(numpy.logical_and(md.mesh.x<0.2*1.e6,md.mesh.x>-0.2*1.e6),md.mesh.y>0.))
+ md.geometry.thickness[pos]=100.
+-md.geometry.bed[pos]=-di*md.geometry.thickness[pos]-20.
+-md.geometry.surface[pos]=md.geometry.bed[pos]+md.geometry.thickness[pos]
++md.geometry.base[pos]=-di*md.geometry.thickness[pos]-20.
++md.geometry.surface[pos]=md.geometry.base[pos]+md.geometry.thickness[pos]
+ 
+ pos=numpy.nonzero(numpy.logical_and(numpy.logical_and(md.mesh.x<0.1*1.e6,md.mesh.x>-0.1*1.e6),numpy.logical_and(md.mesh.y<-0.5*1.e6,md.mesh.y>-0.6*1.e6)))
+ md.geometry.thickness[pos]=100.
+-md.geometry.bed[pos]=-di*md.geometry.thickness[pos]-20.
+-md.geometry.surface[pos]=md.geometry.bed[pos]+md.geometry.thickness[pos]
++md.geometry.base[pos]=-di*md.geometry.thickness[pos]-20.
++md.geometry.surface[pos]=md.geometry.base[pos]+md.geometry.thickness[pos]
+ 
+ #Initial velocity 
+ md.initialization.vx=numpy.zeros((md.mesh.numberofvertices,1))
+@@ -105,9 +105,9 @@
+ 
+ #bathymetry and grounding line migration:
+ md.groundingline.migration='AgressiveMigration'
+-md.geometry.bathymetry=copy.deepcopy(md.geometry.bed)
++md.geometry.base=copy.deepcopy(md.geometry.base)
+ pos=numpy.nonzero(md.mask.groundedice_levelset<0.)[0]
+-md.geometry.bathymetry[pos]=md.geometry.bed[pos]-900.
++md.geometry.base[pos]=md.geometry.base[pos]-900.
+ 
+ #Deal with boundary conditions:
+ md.stressbalance.spcvx=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
+Index: ../trunk-jpl/test/Par/RoundSheetEISMINT.par
+===================================================================
+--- ../trunk-jpl/test/Par/RoundSheetEISMINT.par	(revision 17589)
++++ ../trunk-jpl/test/Par/RoundSheetEISMINT.par	(revision 17590)
+@@ -1,8 +1,8 @@
+ %Ok, start defining model parameters here
+ disp('      creating thickness');
+ md.geometry.thickness=10.*ones(md.mesh.numberofvertices,1);
+-md.geometry.bed=zeros(md.mesh.numberofvertices,1);
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness;
++md.geometry.base=zeros(md.mesh.numberofvertices,1);
++md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ 
+ disp('      creating drag');
+ md.friction.coefficient=20.*ones(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/test/Par/79North.par
+===================================================================
+--- ../trunk-jpl/test/Par/79North.par	(revision 17589)
++++ ../trunk-jpl/test/Par/79North.par	(revision 17590)
+@@ -12,7 +12,7 @@
+ md.initialization.vy =InterpFromMeshToMesh2d(index,x,y,vy,md.mesh.x,md.mesh.y);
+ md.geometry.surface  =InterpFromMeshToMesh2d(index,x,y,surface,md.mesh.x,md.mesh.y);
+ md.geometry.thickness=InterpFromMeshToMesh2d(index,x,y,thickness,md.mesh.x,md.mesh.y);
+-md.geometry.bed=md.geometry.surface-md.geometry.thickness;
++md.geometry.base=md.geometry.surface-md.geometry.thickness;
+ clear surface thickness vx vy x y index;
+ 
+ %Materials
+Index: ../trunk-jpl/test/Par/SquareShelf2.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareShelf2.py	(revision 17589)
++++ ../trunk-jpl/test/Par/SquareShelf2.py	(revision 17590)
+@@ -16,8 +16,8 @@
+ xmin=min(md.mesh.x)
+ xmax=max(md.mesh.x)
+ md.geometry.thickness=hmax+(hmin-hmax)*(md.mesh.y.reshape(-1,1)-ymin)/(ymax-ymin)+0.1*(hmin-hmax)*(md.mesh.x.reshape(-1,1)-xmin)/(xmax-xmin)
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
++md.geometry.surface=md.geometry.base+md.geometry.thickness
+ 
+ #Initial velocity and pressure
+ iVelF = netCDF4.Dataset('../Data/SquareShelf.nc','r')
+Index: ../trunk-jpl/test/Par/SquareThermal.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareThermal.par	(revision 17589)
++++ ../trunk-jpl/test/Par/SquareThermal.par	(revision 17590)
+@@ -5,8 +5,8 @@
+ disp('      creating thickness');
+ h=1000.;
+ md.geometry.thickness=h*ones(md.mesh.numberofvertices,1);
+-md.geometry.bed=-1000.*ones(md.mesh.numberofvertices,1);
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness;
++md.geometry.base=-1000.*ones(md.mesh.numberofvertices,1);
++md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ 
+ disp('      creating velocities');
+ md.initialization.vx=zeros(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/test/Par/RoundSheetEISMINT.py
+===================================================================
+--- ../trunk-jpl/test/Par/RoundSheetEISMINT.py	(revision 17589)
++++ ../trunk-jpl/test/Par/RoundSheetEISMINT.py	(revision 17590)
+@@ -4,8 +4,8 @@
+ #Ok, start defining model parameters here
+ print "      creating thickness"
+ md.geometry.thickness=10.*numpy.ones((md.mesh.numberofvertices,1))
+-md.geometry.bed=numpy.zeros((md.mesh.numberofvertices,1))
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness
++md.geometry.base=numpy.zeros((md.mesh.numberofvertices,1))
++md.geometry.surface=md.geometry.base+md.geometry.thickness
+ 
+ print "      creating drag"
+ md.friction.coefficient=20.*numpy.ones((md.mesh.numberofvertices,1)) 
+Index: ../trunk-jpl/test/Par/Pig.par
+===================================================================
+--- ../trunk-jpl/test/Par/Pig.par	(revision 17589)
++++ ../trunk-jpl/test/Par/Pig.par	(revision 17590)
+@@ -12,7 +12,7 @@
+ md.inversion.vy_obs   =InterpFromMeshToMesh2d(index,x,y,vy_obs,md.mesh.x,md.mesh.y);
+ md.geometry.surface  =InterpFromMeshToMesh2d(index,x,y,surface,md.mesh.x,md.mesh.y);
+ md.geometry.thickness=InterpFromMeshToMesh2d(index,x,y,thickness,md.mesh.x,md.mesh.y);
+-md.geometry.bed=md.geometry.surface-md.geometry.thickness;
++md.geometry.base=md.geometry.surface-md.geometry.thickness;
+ clear surface thickness vx_obs vy_obs x y index;
+ md.initialization.vx=md.inversion.vx_obs;
+ md.initialization.vy=md.inversion.vy_obs;
+Index: ../trunk-jpl/test/Par/RoundSheetStaticEISMINT.par
+===================================================================
+--- ../trunk-jpl/test/Par/RoundSheetStaticEISMINT.par	(revision 17589)
++++ ../trunk-jpl/test/Par/RoundSheetStaticEISMINT.par	(revision 17590)
+@@ -5,8 +5,8 @@
+ radiusmax=max(radius);
+ radius(find(radius>(1.-10^-9)*radiusmax))=radiusmax;    %eliminate roundoff issues in next statement
+ md.geometry.thickness=hmin*ones(size(md.mesh.x,1),1)+hmax*(4.*((1./2.)^(4./3.)*ones(size(md.mesh.x,1),1)-((radius)./(2.*radiusmax)).^(4./3.))).^(3./8.);
+-md.geometry.bed=0.*md.geometry.thickness;
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness;
++md.geometry.base=0.*md.geometry.thickness;
++md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ 
+ disp('      creating drag');
+ md.friction.coefficient=20.*ones(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/test/Par/SquareShelf.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareShelf.par	(revision 17589)
++++ ../trunk-jpl/test/Par/SquareShelf.par	(revision 17590)
+@@ -8,8 +8,8 @@
+ xmin=min(md.mesh.x);
+ xmax=max(md.mesh.x);
+ md.geometry.thickness=hmax+(hmin-hmax)*(md.mesh.y-ymin)/(ymax-ymin)+0.1*(hmin-hmax)*(md.mesh.x-xmin)/(xmax-xmin);
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness;
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
++md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ 
+ %Initial velocity and pressure
+ x     = transpose(ncread('../Data/SquareShelf.nc','x'));
+Index: ../trunk-jpl/test/Par/ISMIPA.par
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPA.par	(revision 17589)
++++ ../trunk-jpl/test/Par/ISMIPA.par	(revision 17590)
+@@ -2,8 +2,8 @@
+ 
+ disp('      creating thickness');
+ md.geometry.surface=-md.mesh.x*tan(0.5*pi/180.);
+-md.geometry.bed=md.geometry.surface-1000.+500.*sin(md.mesh.x*2.*pi/max(md.mesh.x)).*sin(md.mesh.y*2.*pi/max(md.mesh.x));
+-md.geometry.thickness=md.geometry.surface-md.geometry.bed;
++md.geometry.base=md.geometry.surface-1000.+500.*sin(md.mesh.x*2.*pi/max(md.mesh.x)).*sin(md.mesh.y*2.*pi/max(md.mesh.x));
++md.geometry.thickness=md.geometry.surface-md.geometry.base;
+ 
+ disp('      creating drag');
+ md.friction.coefficient=200.*ones(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/test/Par/SquareShelfConstrained.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareShelfConstrained.py	(revision 17589)
++++ ../trunk-jpl/test/Par/SquareShelfConstrained.py	(revision 17590)
+@@ -16,8 +16,8 @@
+ xmin=min(md.mesh.x)
+ xmax=max(md.mesh.x)
+ md.geometry.thickness=hmax+(hmin-hmax)*(md.mesh.y.reshape(-1,1)-ymin)/(ymax-ymin)+0.1*(hmin-hmax)*(md.mesh.x.reshape(-1,1)-xmin)/(xmax-xmin)
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
++md.geometry.surface=md.geometry.base+md.geometry.thickness
+ 
+ #Initial velocity 
+ f = netCDF4.Dataset('../Data/SquareShelfConstrained.nc','r')
+Index: ../trunk-jpl/test/Par/ISMIPB.par
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPB.par	(revision 17589)
++++ ../trunk-jpl/test/Par/ISMIPB.par	(revision 17590)
+@@ -2,8 +2,8 @@
+ 
+ disp('      creating thickness');
+ md.geometry.surface=-md.mesh.x*tan(0.5*pi/180.);
+-md.geometry.bed=md.geometry.surface-1000.+500.*sin(md.mesh.x*2.*pi/max(md.mesh.x));
+-md.geometry.thickness=md.geometry.surface-md.geometry.bed;
++md.geometry.base=md.geometry.surface-1000.+500.*sin(md.mesh.x*2.*pi/max(md.mesh.x));
++md.geometry.thickness=md.geometry.surface-md.geometry.base;
+ 
+ disp('      creating drag');
+ md.friction.coefficient=200.*ones(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/test/Par/SquareThermal.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareThermal.py	(revision 17589)
++++ ../trunk-jpl/test/Par/SquareThermal.py	(revision 17590)
+@@ -9,8 +9,8 @@
+ print "      creating thickness"
+ h=1000.
+ md.geometry.thickness=h*numpy.ones((md.mesh.numberofvertices,1))
+-md.geometry.bed=-1000.*numpy.ones((md.mesh.numberofvertices,1))
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness;
++md.geometry.base=-1000.*numpy.ones((md.mesh.numberofvertices,1))
++md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ 
+ print "      creating velocities"
+ md.initialization.vx=numpy.zeros((md.mesh.numberofvertices,1))
+Index: ../trunk-jpl/test/Par/ISMIPC.par
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPC.par	(revision 17589)
++++ ../trunk-jpl/test/Par/ISMIPC.par	(revision 17590)
+@@ -2,11 +2,11 @@
+ 
+ disp('      creating thickness');
+ md.geometry.surface=2000.-md.mesh.x*tan(0.1*pi/180.); %to have z>0
+-md.geometry.bed=md.geometry.surface-1000.;
+-md.geometry.thickness=md.geometry.surface-md.geometry.bed;
++md.geometry.base=md.geometry.surface-1000.;
++md.geometry.thickness=md.geometry.surface-md.geometry.base;
+ 
+ disp('      creating drag');
+-%md.friction.coefficient=sqrt(md.constants.yts.*(1000.+1000.*sin(md.mesh.x*2.*pi/max(md.mesh.x/2.)).*sin(md.mesh.y*2.*pi/max(md.mesh.x/2.)))./(md.constants.g*(md.materials.rho_ice*md.geometry.thickness+md.materials.rho_water*md.geometry.bed)));
++%md.friction.coefficient=sqrt(md.constants.yts.*(1000.+1000.*sin(md.mesh.x*2.*pi/max(md.mesh.x/2.)).*sin(md.mesh.y*2.*pi/max(md.mesh.x/2.)))./(md.constants.g*(md.materials.rho_ice*md.geometry.thickness+md.materials.rho_water*md.geometry.base)));
+ md.friction.coefficient=sqrt(md.constants.yts.*(1000.+1000.*sin(md.mesh.x*2.*pi/max(md.mesh.x)).*sin(md.mesh.y*2.*pi/max(md.mesh.x))));
+ md.friction.coefficient(find(md.mask.groundedice_levelset<0.))=0.;
+ md.friction.p=ones(md.mesh.numberofelements,1);
+Index: ../trunk-jpl/test/Par/ISMIPD.par
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPD.par	(revision 17589)
++++ ../trunk-jpl/test/Par/ISMIPD.par	(revision 17590)
+@@ -2,8 +2,8 @@
+ 
+ disp('      creating thickness');
+ md.geometry.surface=2000.-md.mesh.x*tan(0.1*pi/180.); %to have z>0
+-md.geometry.bed=md.geometry.surface-1000.;
+-md.geometry.thickness=md.geometry.surface-md.geometry.bed;
++md.geometry.base=md.geometry.surface-1000.;
++md.geometry.thickness=md.geometry.surface-md.geometry.base;
+ 
+ disp('      creating drag');
+ md.friction.coefficient=sqrt(md.constants.yts.*(1000.+1000.*sin(md.mesh.x*2.*pi/max(md.mesh.x))));
+Index: ../trunk-jpl/test/Par/Pig.py
+===================================================================
+--- ../trunk-jpl/test/Par/Pig.py	(revision 17589)
++++ ../trunk-jpl/test/Par/Pig.py	(revision 17590)
+@@ -24,7 +24,7 @@
+ [md.inversion.vy_obs]   =InterpFromMeshToMesh2d(index,x,y,vy_obs,md.mesh.x,md.mesh.y)
+ [md.geometry.surface]  =InterpFromMeshToMesh2d(index,x,y,surface,md.mesh.x,md.mesh.y)
+ [md.geometry.thickness]=InterpFromMeshToMesh2d(index,x,y,thickness,md.mesh.x,md.mesh.y)
+-md.geometry.bed=md.geometry.surface-md.geometry.thickness
++md.geometry.base=md.geometry.surface-md.geometry.thickness
+ md.initialization.vx=md.inversion.vx_obs
+ md.initialization.vy=md.inversion.vy_obs
+ md.initialization.vz=numpy.zeros((md.mesh.numberofvertices,1))
+Index: ../trunk-jpl/test/Par/ISMIPE.par
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPE.par	(revision 17589)
++++ ../trunk-jpl/test/Par/ISMIPE.par	(revision 17590)
+@@ -3,18 +3,18 @@
+ disp('      creating thickness');
+ data=transpose(ncread('../Data/ISMIPE.nc','data'));
+ md.geometry.surface=zeros(md.mesh.numberofvertices,1);
+-md.geometry.bed=zeros(md.mesh.numberofvertices,1);
++md.geometry.base=zeros(md.mesh.numberofvertices,1);
+ for i=1:md.mesh.numberofvertices
+ 	y=md.mesh.y(i);
+ 	point1=floor(y/100.)+1;
+ 	point2=min(point1+1,51);
+ 	coeff=(y-(point1-1.)*100.)/100.;
+-	md.geometry.bed(i)=(1.-coeff)*data(point1,2)+coeff*data(point2,2);
++	md.geometry.base(i)=(1.-coeff)*data(point1,2)+coeff*data(point2,2);
+ 	md.geometry.surface(i)=(1.-coeff)*data(point1,3)+coeff*data(point2,3);
+ end
+-md.geometry.thickness=md.geometry.surface-md.geometry.bed;
++md.geometry.thickness=md.geometry.surface-md.geometry.base;
+ md.geometry.thickness(find(~md.geometry.thickness))=0.01;
+-md.geometry.bed=md.geometry.surface-md.geometry.thickness;
++md.geometry.base=md.geometry.surface-md.geometry.thickness;
+ 
+ disp('      creating drag');
+ md.friction.coefficient=zeros(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/test/Par/ISMIPF.par
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPF.par	(revision 17589)
++++ ../trunk-jpl/test/Par/ISMIPF.par	(revision 17590)
+@@ -3,9 +3,9 @@
+ 
+ disp('      creating thickness');
+ md.geometry.surface=-md.mesh.x*tan(3.*pi/180.);
+-%md.geometry.bed=md.geometry.surface-1000.;
+-md.geometry.bed=md.geometry.surface-1000.+100.*exp(-((md.mesh.x-max(md.mesh.x)/2.).^2+(md.mesh.y-max(md.mesh.y)/2.).^2)/(10000.^2));
+-md.geometry.thickness=md.geometry.surface-md.geometry.bed;
++%md.geometry.base=md.geometry.surface-1000.;
++md.geometry.base=md.geometry.surface-1000.+100.*exp(-((md.mesh.x-max(md.mesh.x)/2.).^2+(md.mesh.y-max(md.mesh.y)/2.).^2)/(10000.^2));
++md.geometry.thickness=md.geometry.surface-md.geometry.base;
+ 
+ disp('      creating drag');
+ md.friction.coefficient=sqrt(md.constants.yts/(2.140373*10^-7*1000.))*ones(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/test/Par/RoundSheetStaticEISMINT.py
+===================================================================
+--- ../trunk-jpl/test/Par/RoundSheetStaticEISMINT.py	(revision 17589)
++++ ../trunk-jpl/test/Par/RoundSheetStaticEISMINT.py	(revision 17590)
+@@ -8,8 +8,8 @@
+ radiusmax=numpy.max(radius)
+ radius[numpy.nonzero(radius>(1.-10**-9)*radiusmax)]=radiusmax    #eliminate roundoff issues in next statement
+ md.geometry.thickness=hmin*numpy.ones((numpy.size(md.mesh.x),1))+hmax*(4.*((1./2.)**(4./3.)*numpy.ones((numpy.size(md.mesh.x),1))-((radius)/(2.*radiusmax))**(4./3.)))**(3./8.)
+-md.geometry.bed=0.*md.geometry.thickness
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness
++md.geometry.base=0.*md.geometry.thickness
++md.geometry.surface=md.geometry.base+md.geometry.thickness
+ 
+ print "      creating drag"
+ md.friction.coefficient=20.*numpy.ones((md.mesh.numberofvertices,1))
+Index: ../trunk-jpl/test/Par/ISMIPB.py
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPB.py	(revision 17589)
++++ ../trunk-jpl/test/Par/ISMIPB.py	(revision 17590)
+@@ -5,8 +5,8 @@
+ 
+ print "      creating thickness"
+ md.geometry.surface=-md.mesh.x.reshape(-1,1)*numpy.tan(0.5*numpy.pi/180.)
+-md.geometry.bed=md.geometry.surface-1000.+500.*numpy.sin(md.mesh.x.reshape(-1,1)*2.*numpy.pi/numpy.max(md.mesh.x))
+-md.geometry.thickness=md.geometry.surface-md.geometry.bed
++md.geometry.base=md.geometry.surface-1000.+500.*numpy.sin(md.mesh.x.reshape(-1,1)*2.*numpy.pi/numpy.max(md.mesh.x))
++md.geometry.thickness=md.geometry.surface-md.geometry.base
+ 
+ print "      creating drag"
+ md.friction.coefficient=200.*numpy.ones((md.mesh.numberofvertices,1))
+Index: ../trunk-jpl/test/Par/ISMIPD.py
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPD.py	(revision 17589)
++++ ../trunk-jpl/test/Par/ISMIPD.py	(revision 17590)
+@@ -5,8 +5,8 @@
+ 
+ print "      creating thickness"
+ md.geometry.surface=2000.-md.mesh.x.reshape(-1,1)*numpy.tan(0.1*numpy.pi/180.)    #to have z>0
+-md.geometry.bed=md.geometry.surface-1000.
+-md.geometry.thickness=md.geometry.surface-md.geometry.bed
++md.geometry.base=md.geometry.surface-1000.
++md.geometry.thickness=md.geometry.surface-md.geometry.base
+ 
+ print "      creating drag"
+ md.friction.coefficient=numpy.sqrt(md.constants.yts*(1000.+1000.*numpy.sin(md.mesh.x.reshape(-1,1)*2.*numpy.pi/numpy.max(md.mesh.x))))
+Index: ../trunk-jpl/test/Par/ISMIPF.py
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPF.py	(revision 17589)
++++ ../trunk-jpl/test/Par/ISMIPF.py	(revision 17590)
+@@ -6,9 +6,9 @@
+ 
+ print "      creating thickness"
+ md.geometry.surface=-md.mesh.x.reshape(-1,1)*numpy.tan(3.*numpy.pi/180.)
+-#md.geometry.bed=md.geometry.surface-1000.
+-md.geometry.bed=md.geometry.surface-1000.+100.*numpy.exp(-((md.mesh.x.reshape(-1,1)-numpy.max(md.mesh.x)/2.)**2+(md.mesh.y.reshape(-1,1)-numpy.max(md.mesh.y)/2.)**2)/(10000.**2))
+-md.geometry.thickness=md.geometry.surface-md.geometry.bed
++#md.geometry.base=md.geometry.surface-1000.
++md.geometry.base=md.geometry.surface-1000.+100.*numpy.exp(-((md.mesh.x.reshape(-1,1)-numpy.max(md.mesh.x)/2.)**2+(md.mesh.y.reshape(-1,1)-numpy.max(md.mesh.y)/2.)**2)/(10000.**2))
++md.geometry.thickness=md.geometry.surface-md.geometry.base
+ 
+ print "      creating drag"
+ md.friction.coefficient=numpy.sqrt(md.constants.yts/(2.140373*10**-7*1000.))*numpy.ones((md.mesh.numberofvertices,1))
+Index: ../trunk-jpl/test/Par/GiaBenchmarksAB.par
+===================================================================
+--- ../trunk-jpl/test/Par/GiaBenchmarksAB.par	(revision 17589)
++++ ../trunk-jpl/test/Par/GiaBenchmarksAB.par	(revision 17590)
+@@ -10,8 +10,8 @@
+ 	end
+ end
+ md.geometry.thickness=md.geometry.thickness';
+-md.geometry.bed=zeros(md.mesh.numberofvertices,1); 
+-md.geometry.surface=md.geometry.thickness+md.geometry.bed; 
++md.geometry.base=zeros(md.mesh.numberofvertices,1); 
++md.geometry.surface=md.geometry.thickness+md.geometry.base; 
+ 
+ %Ice density used for benchmarking, not 917 kg/m^3
+ md.materials.rho_ice=1000; %kg m^3
+Index: ../trunk-jpl/test/Par/RoundSheetShelf.par
+===================================================================
+--- ../trunk-jpl/test/Par/RoundSheetShelf.par	(revision 17589)
++++ ../trunk-jpl/test/Par/RoundSheetShelf.par	(revision 17590)
+@@ -10,44 +10,44 @@
+ ymin=min(radius);
+ ymax=max(radius);
+ md.geometry.thickness=hmax+(hmin-hmax)*(radius-ymin)/(ymax-ymin);
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
+ 
+ pos=find(md.mask.groundedice_levelset>0.);
+-md.geometry.bed(pos)=md.geometry.bed(pos)-300.*(radius(pos)-(rad-shelfextent))/(rad-shelfextent);
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness;
++md.geometry.base(pos)=md.geometry.base(pos)-300.*(radius(pos)-(rad-shelfextent))/(rad-shelfextent);
++md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ 
+ pos=find(radius<200000);
+ md.geometry.thickness(pos)=100.;
+-md.geometry.bed(pos)=-di*md.geometry.thickness(pos)-20.;
+-md.geometry.surface(pos)=md.geometry.bed(pos)+md.geometry.thickness(pos);
++md.geometry.base(pos)=-di*md.geometry.thickness(pos)-20.;
++md.geometry.surface(pos)=md.geometry.base(pos)+md.geometry.thickness(pos);
+ 
+ pos=find(md.mesh.x<0.2*1.e6 & md.mesh.x>-0.2*1.e6 & md.mesh.y>0.);
+ md.geometry.thickness(pos)=100.;
+-md.geometry.bed(pos)=-di*md.geometry.thickness(pos)-20.;
+-md.geometry.surface(pos)=md.geometry.bed(pos)+md.geometry.thickness(pos);
++md.geometry.base(pos)=-di*md.geometry.thickness(pos)-20.;
++md.geometry.surface(pos)=md.geometry.base(pos)+md.geometry.thickness(pos);
+ 
+ pos=find(md.mesh.x<0.1*1.e6 & md.mesh.x>-0.1*1.e6 & md.mesh.y<-0.5*1.e6 & md.mesh.y>-0.6*1.e6);
+ md.geometry.thickness(pos)=100.;
+-md.geometry.bed(pos)=-di*md.geometry.thickness(pos)-20.;
+-md.geometry.surface(pos)=md.geometry.bed(pos)+md.geometry.thickness(pos);
++md.geometry.base(pos)=-di*md.geometry.thickness(pos)-20.;
++md.geometry.surface(pos)=md.geometry.base(pos)+md.geometry.thickness(pos);
+ 
+ %plug holes into the ice sheet, to test for grounding line migration. 
+ di=md.materials.rho_ice/md.materials.rho_water;
+ rad=sqrt(md.mesh.x.^2+md.mesh.y.^2);
+ pos=find(rad<200000.);
+ md.geometry.thickness(pos)=100.;
+-md.geometry.bed(pos)=-di*md.geometry.thickness(pos)-20.;
+-md.geometry.surface(pos)=md.geometry.bed(pos)+md.geometry.thickness(pos);
++md.geometry.base(pos)=-di*md.geometry.thickness(pos)-20.;
++md.geometry.surface(pos)=md.geometry.base(pos)+md.geometry.thickness(pos);
+ 
+ pos=find(md.mesh.x<0.2*1.e6 & md.mesh.x>-0.2*1.e6 & md.mesh.y>0.);
+ md.geometry.thickness(pos)=100.;
+-md.geometry.bed(pos)=-di*md.geometry.thickness(pos)-20.;
+-md.geometry.surface(pos)=md.geometry.bed(pos)+md.geometry.thickness(pos);
++md.geometry.base(pos)=-di*md.geometry.thickness(pos)-20.;
++md.geometry.surface(pos)=md.geometry.base(pos)+md.geometry.thickness(pos);
+ 
+ pos=find(md.mesh.x<0.1*1.e6 & md.mesh.x>-0.1*1.e6 & md.mesh.y<-0.5*1.e6 & md.mesh.y>-0.6*1.e6);
+ md.geometry.thickness(pos)=100.;
+-md.geometry.bed(pos)=-di*md.geometry.thickness(pos)-20.;
+-md.geometry.surface(pos)=md.geometry.bed(pos)+md.geometry.thickness(pos);
++md.geometry.base(pos)=-di*md.geometry.thickness(pos)-20.;
++md.geometry.surface(pos)=md.geometry.base(pos)+md.geometry.thickness(pos);
+ 
+ %Initial velocity 
+ md.initialization.vx=zeros(md.mesh.numberofvertices,1);
+@@ -97,8 +97,8 @@
+ 
+ %bathymetry and grounding line migration:
+ md.groundingline.migration='AgressiveMigration';
+-md.geometry.bathymetry=md.geometry.bed;
+-pos=find(md.mask.groundedice_levelset<0.); md.geometry.bathymetry(pos)=md.geometry.bed(pos)-900.;
++md.geometry.bed=md.geometry.base;
++pos=find(md.mask.groundedice_levelset<0.); md.geometry.bed(pos)=md.geometry.base(pos)-900.;
+ 
+ %Deal with boundary conditions:
+ md.stressbalance.spcvx=NaN*ones(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/test/Par/SquareShelf2.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareShelf2.par	(revision 17589)
++++ ../trunk-jpl/test/Par/SquareShelf2.par	(revision 17590)
+@@ -8,8 +8,8 @@
+ xmin=min(md.mesh.x);
+ xmax=max(md.mesh.x);
+ md.geometry.thickness=hmax+(hmin-hmax)*(md.mesh.y-ymin)/(ymax-ymin)+0.1*(hmin-hmax)*(md.mesh.x-xmin)/(xmax-xmin);
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness;
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
++md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ 
+ %Initial velocity and pressure
+ x     = transpose(ncread('../Data/SquareShelf.nc','x'));
+Index: ../trunk-jpl/test/Par/ValleyGlacierShelf.par
+===================================================================
+--- ../trunk-jpl/test/Par/ValleyGlacierShelf.par	(revision 17589)
++++ ../trunk-jpl/test/Par/ValleyGlacierShelf.par	(revision 17590)
+@@ -19,9 +19,9 @@
+ alpha = 2./3.;
+ slope = 0.9*(bmin-bmax)*(x-xmin)/(Lx*alpha) + 0.1*(bmin-bmax)*(y-ymin)/(Ly) + bmax;
+ md.geometry.surface = (thk_center+bmax) + slope ;
+-md.geometry.bed = bmax + slope + 4./Ly^2*(thk_center-thk_margin)*(y-ym).^2;
+-md.geometry.thickness = md.geometry.surface - md.geometry.bed;
+-md.geometry.bathymetry = md.geometry.bed;
++md.geometry.base = bmax + slope + 4./Ly^2*(thk_center-thk_margin)*(y-ym).^2;
++md.geometry.thickness = md.geometry.surface - md.geometry.base;
++md.geometry.bed = md.geometry.base;
+ 
+ %Mask
+ md.mask.ice_levelset = x - alpha*Lx;
+Index: ../trunk-jpl/test/Par/GiaBenchmarksCD.par
+===================================================================
+--- ../trunk-jpl/test/Par/GiaBenchmarksCD.par	(revision 17589)
++++ ../trunk-jpl/test/Par/GiaBenchmarksCD.par	(revision 17590)
+@@ -10,8 +10,8 @@
+ 	end
+ end
+ md.geometry.thickness=md.geometry.thickness';
+-md.geometry.bed=zeros(md.mesh.numberofvertices,1); 
+-md.geometry.surface=md.geometry.thickness+md.geometry.bed; 
++md.geometry.base=zeros(md.mesh.numberofvertices,1); 
++md.geometry.surface=md.geometry.thickness+md.geometry.base; 
+ 
+ %Ice density used for benchmarking, not 917 kg/m^3
+ md.materials.rho_ice=1000; %kg m^3
+Index: ../trunk-jpl/test/Par/ValleyGlacierShelf.py
+===================================================================
+--- ../trunk-jpl/test/Par/ValleyGlacierShelf.py	(revision 17589)
++++ ../trunk-jpl/test/Par/ValleyGlacierShelf.py	(revision 17590)
+@@ -26,9 +26,9 @@
+ alpha=2./3.
+ slope = 0.9*(bmin-bmax)*(x-xmin)/(Lx*alpha) + 0.1*(bmin-bmax)*(y-ymin)/(Ly) + bmax
+ md.geometry.surface= (thk_center+bmax) + slope 
+-md.geometry.bed=bmax + slope + 4./Ly**2*(thk_center-thk_margin)*(numpy.power(y-ym,2))
+-md.geometry.thickness=md.geometry.surface - md.geometry.bed
+-md.geometry.bathymetry = md.geometry.bed
++md.geometry.base=bmax + slope + 4./Ly**2*(thk_center-thk_margin)*(numpy.power(y-ym,2))
++md.geometry.thickness=md.geometry.surface - md.geometry.base
++md.geometry.base = md.geometry.base
+ 
+ #Mask
+ md.mask.ice_levelset=x - alpha*Lx
+Index: ../trunk-jpl/test/Par/SquareSheetShelf.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareSheetShelf.par	(revision 17589)
++++ ../trunk-jpl/test/Par/SquareSheetShelf.par	(revision 17590)
+@@ -8,11 +8,11 @@
+ xmin=min(md.mesh.x);
+ xmax=max(md.mesh.x);
+ md.geometry.thickness=hmax+(hmin-hmax)*(md.mesh.y-ymin)/(ymax-ymin)+0.1*(hmin-hmax)*(md.mesh.x-xmin)/(xmax-xmin);
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
+ bed_sheet=-md.materials.rho_ice/md.materials.rho_water*(hmax+(hmin-hmax)*(ymax/2-ymin)/(ymax-ymin));
+ pos=find(md.mesh.y<=ymax/2.);
+-md.geometry.bed(pos)=bed_sheet;
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness;
++md.geometry.base(pos)=bed_sheet;
++md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ 
+ %Initial velocity 
+ x     = transpose(ncread('../Data/SquareSheetShelf.nc','x'));
+Index: ../trunk-jpl/test/Par/SquareShelfConstrained.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareShelfConstrained.par	(revision 17589)
++++ ../trunk-jpl/test/Par/SquareShelfConstrained.par	(revision 17590)
+@@ -8,8 +8,8 @@
+ xmin=min(md.mesh.x);
+ xmax=max(md.mesh.x);
+ md.geometry.thickness=hmax+(hmin-hmax)*(md.mesh.y-ymin)/(ymax-ymin)+0.1*(hmin-hmax)*(md.mesh.x-xmin)/(xmax-xmin);
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness;
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
++md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ 
+ %Initial velocity 
+ x     = transpose(ncread('../Data/SquareShelfConstrained.nc','x'));
+Index: ../trunk-jpl/test/Par/79North.py
+===================================================================
+--- ../trunk-jpl/test/Par/79North.py	(revision 17589)
++++ ../trunk-jpl/test/Par/79North.py	(revision 17590)
+@@ -24,7 +24,7 @@
+ [md.initialization.vy]  = InterpFromMeshToMesh2d(index,x,y,vy,md.mesh.x,md.mesh.y)
+ [md.geometry.surface]   = InterpFromMeshToMesh2d(index,x,y,surface,md.mesh.x,md.mesh.y)
+ [md.geometry.thickness] = InterpFromMeshToMesh2d(index,x,y,thickness,md.mesh.x,md.mesh.y)
+-md.geometry.bed         = md.geometry.surface-md.geometry.thickness
++md.geometry.base         = md.geometry.surface-md.geometry.thickness
+ 
+ #Materials
+ md.initialization.temperature=(273.-20.)*numpy.ones((md.mesh.numberofvertices,1))
+Index: ../trunk-jpl/test/Par/SquareSheetShelf.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareSheetShelf.py	(revision 17589)
++++ ../trunk-jpl/test/Par/SquareSheetShelf.py	(revision 17590)
+@@ -17,11 +17,11 @@
+ xmin=min(md.mesh.x)
+ xmax=max(md.mesh.x)
+ md.geometry.thickness=hmax+(hmin-hmax)*(md.mesh.y.reshape(-1,1)-ymin)/(ymax-ymin)+0.1*(hmin-hmax)*(md.mesh.x.reshape(-1,1)-xmin)/(xmax-xmin)
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
+ bed_sheet=-md.materials.rho_ice/md.materials.rho_water*(hmax+(hmin-hmax)*(ymax/2-ymin)/(ymax-ymin))
+ pos=numpy.nonzero(md.mesh.y<=ymax/2.)
+-md.geometry.bed[pos]=bed_sheet
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness
++md.geometry.base[pos]=bed_sheet
++md.geometry.surface=md.geometry.base+md.geometry.thickness
+ 
+ #Initial velocity 
+ f = netCDF4.Dataset('../Data/SquareSheetShelf.nc','r')
+Index: ../trunk-jpl/test/Par/SquareSheetConstrained.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareSheetConstrained.par	(revision 17589)
++++ ../trunk-jpl/test/Par/SquareSheetConstrained.par	(revision 17590)
+@@ -8,8 +8,8 @@
+ xmin=min(md.mesh.x);
+ xmax=max(md.mesh.x);
+ md.geometry.thickness=hmax+(hmin-hmax)*(md.mesh.y-ymin)/(ymax-ymin)+0.1*(hmin-hmax)*(md.mesh.x-xmin)/(xmax-xmin);
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness+20.;
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness;
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness+20.;
++md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ 
+ %Initial velocity 
+ x     = transpose(ncread('../Data/SquareSheetConstrained.nc','x'));
+Index: ../trunk-jpl/test/Par/SquareShelf.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareShelf.py	(revision 17589)
++++ ../trunk-jpl/test/Par/SquareShelf.py	(revision 17590)
+@@ -16,8 +16,8 @@
+ xmin=min(md.mesh.x)
+ xmax=max(md.mesh.x)
+ md.geometry.thickness=hmax+(hmin-hmax)*(md.mesh.y.reshape(-1,1)-ymin)/(ymax-ymin)+0.1*(hmin-hmax)*(md.mesh.x.reshape(-1,1)-xmin)/(xmax-xmin)
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
++md.geometry.surface=md.geometry.base+md.geometry.thickness
+ 
+ #Initial velocity and pressure
+ iVelF = netCDF4.Dataset('../Data/SquareShelf.nc','r')
+Index: ../trunk-jpl/test/Par/ISMIPA.py
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPA.py	(revision 17589)
++++ ../trunk-jpl/test/Par/ISMIPA.py	(revision 17590)
+@@ -5,8 +5,8 @@
+ 
+ print "      creating thickness"
+ md.geometry.surface=-md.mesh.x.reshape(-1,1)*numpy.tan(0.5*numpy.pi/180.)
+-md.geometry.bed=md.geometry.surface-1000.+500.*numpy.sin(md.mesh.x.reshape(-1,1)*2.*numpy.pi/numpy.max(md.mesh.x))*numpy.sin(md.mesh.y.reshape(-1,1)*2.*numpy.pi/numpy.max(md.mesh.x))
+-md.geometry.thickness=md.geometry.surface-md.geometry.bed
++md.geometry.base=md.geometry.surface-1000.+500.*numpy.sin(md.mesh.x.reshape(-1,1)*2.*numpy.pi/numpy.max(md.mesh.x))*numpy.sin(md.mesh.y.reshape(-1,1)*2.*numpy.pi/numpy.max(md.mesh.x))
++md.geometry.thickness=md.geometry.surface-md.geometry.base
+ 
+ print "      creating drag"
+ md.friction.coefficient=200.*numpy.ones((md.mesh.numberofvertices,1))
+Index: ../trunk-jpl/test/Par/SquareSheetConstrained.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareSheetConstrained.py	(revision 17589)
++++ ../trunk-jpl/test/Par/SquareSheetConstrained.py	(revision 17590)
+@@ -17,8 +17,8 @@
+ xmin=min(md.mesh.x)
+ xmax=max(md.mesh.x)
+ md.geometry.thickness=hmax+(hmin-hmax)*(md.mesh.y.reshape(-1,1)-ymin)/(ymax-ymin)+0.1*(hmin-hmax)*(md.mesh.x.reshape(-1,1)-xmin)/(xmax-xmin)
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness+20.
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness+20.
++md.geometry.surface=md.geometry.base+md.geometry.thickness
+ 
+ #Initial velocity 
+ f = netCDF4.Dataset('../Data/SquareSheetConstrained.nc','r')
+Index: ../trunk-jpl/test/Par/SquareEISMINT.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareEISMINT.par	(revision 17589)
++++ ../trunk-jpl/test/Par/SquareEISMINT.par	(revision 17590)
+@@ -4,8 +4,8 @@
+ ymin=min(md.mesh.y);
+ ymax=max(md.mesh.y);
+ md.geometry.thickness=500.*ones(md.mesh.numberofvertices,1);
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness;
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
++md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ 
+ disp('      creating drag');
+ md.friction.coefficient=200.*ones(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/test/Par/ISMIPC.py
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPC.py	(revision 17589)
++++ ../trunk-jpl/test/Par/ISMIPC.py	(revision 17590)
+@@ -5,11 +5,11 @@
+ 
+ print "      creating thickness"
+ md.geometry.surface=2000.-md.mesh.x.reshape(-1,1)*numpy.tan(0.1*numpy.pi/180.)    #to have z>0
+-md.geometry.bed=md.geometry.surface-1000.
+-md.geometry.thickness=md.geometry.surface-md.geometry.bed
++md.geometry.base=md.geometry.surface-1000.
++md.geometry.thickness=md.geometry.surface-md.geometry.base
+ 
+ print "      creating drag"
+-#md.friction.coefficient=sqrt(md.constants.yts.*(1000.+1000.*sin(md.mesh.x*2.*pi/max(md.mesh.x/2.)).*sin(md.mesh.y*2.*pi/max(md.mesh.x/2.)))./(md.constants.g*(md.materials.rho_ice*md.geometry.thickness+md.materials.rho_water*md.geometry.bed)));
++#md.friction.coefficient=sqrt(md.constants.yts.*(1000.+1000.*sin(md.mesh.x*2.*pi/max(md.mesh.x/2.)).*sin(md.mesh.y*2.*pi/max(md.mesh.x/2.)))./(md.constants.g*(md.materials.rho_ice*md.geometry.thickness+md.materials.rho_water*md.geometry.base)));
+ md.friction.coefficient=numpy.sqrt(md.constants.yts*(1000.+1000.*numpy.sin(md.mesh.x.reshape(-1,1)*2.*numpy.pi/numpy.max(md.mesh.x))*numpy.sin(md.mesh.y.reshape(-1,1)*2.*numpy.pi/numpy.max(md.mesh.x))))
+ md.friction.coefficient[numpy.nonzero(md.mask.groundedice_levelset<0.)[0]]=0.
+ md.friction.p=numpy.ones((md.mesh.numberofelements,1))
+Index: ../trunk-jpl/test/Par/ISMIPE.py
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPE.py	(revision 17589)
++++ ../trunk-jpl/test/Par/ISMIPE.py	(revision 17590)
+@@ -9,17 +9,17 @@
+ data = f.variables['data'][:]
+ f.close()
+ md.geometry.surface=numpy.zeros((md.mesh.numberofvertices,1))
+-md.geometry.bed=numpy.zeros((md.mesh.numberofvertices,1))
++md.geometry.base=numpy.zeros((md.mesh.numberofvertices,1))
+ for i in xrange(0,md.mesh.numberofvertices):
+ 	y=md.mesh.y[i]
+ 	point1=numpy.floor(y/100.)
+ 	point2=numpy.minimum(point1+1,50)
+ 	coeff=(y-(point1-1.)*100.)/100.
+-	md.geometry.bed[i]=(1.-coeff)*data[point1,1]+coeff*data[point2,1]
++	md.geometry.base[i]=(1.-coeff)*data[point1,1]+coeff*data[point2,1]
+ 	md.geometry.surface[i]=(1.-coeff)*data[point1,2]+coeff*data[point2,2]
+-md.geometry.thickness=md.geometry.surface-md.geometry.bed
++md.geometry.thickness=md.geometry.surface-md.geometry.base
+ md.geometry.thickness[numpy.nonzero(numpy.logical_not(md.geometry.thickness))]=0.01
+-md.geometry.bed=md.geometry.surface-md.geometry.thickness
++md.geometry.base=md.geometry.surface-md.geometry.thickness
+ 
+ print "      creating drag"
+ md.friction.coefficient=numpy.zeros((md.mesh.numberofvertices,1))
+Index: ../trunk-jpl/test/NightlyRun/test511.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test511.py	(revision 17589)
++++ ../trunk-jpl/test/NightlyRun/test511.py	(revision 17590)
+@@ -13,8 +13,8 @@
+ md=parameterize(md,'../Par/Pig.py')
+ 
+ #impose hydrostatic equilibrium (required by Stokes)
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
++md.geometry.surface=md.geometry.base+md.geometry.thickness
+ md.extrude(3,1.)
+ md=setflowequation(md,'FS','all')
+ md=md.extract(md.mask.groundedice_levelset<0.)
+Index: ../trunk-jpl/test/NightlyRun/test703.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test703.m	(revision 17589)
++++ ../trunk-jpl/test/NightlyRun/test703.m	(revision 17590)
+@@ -10,8 +10,8 @@
+ 
+ %parameterize
+ md.geometry.surface   = interp1(x,b+h,md.mesh.x);
+-md.geometry.bed       = interp1(x,b,md.mesh.x);
+-md.geometry.thickness = md.geometry.surface-md.geometry.bed;
++md.geometry.base       = interp1(x,b,md.mesh.x);
++md.geometry.thickness = md.geometry.surface-md.geometry.base;
+ md.mask.ice_levelset  = - ones(md.mesh.numberofvertices,1);
+ md.mask.ice_levelset(find(vertexflags(md.mesh,2))) = 0;
+ md.mask.groundedice_levelset = double(md.mesh.x<0)-.5;
+Index: ../trunk-jpl/test/NightlyRun/test426.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test426.m	(revision 17589)
++++ ../trunk-jpl/test/NightlyRun/test426.m	(revision 17590)
+@@ -3,10 +3,10 @@
+ md=parameterize(md,'../Par/SquareSheetShelf.par');
+ md.initialization.vx(:)=0.;
+ md.initialization.vy(:)=0.;
+-md.geometry.bed=-700.-abs(md.mesh.y-500000.)/1000.;
+-md.geometry.bathymetry=-700.-abs(md.mesh.y-500000.)/1000.;
++md.geometry.base=-700.-abs(md.mesh.y-500000.)/1000.;
++md.geometry.base=-700.-abs(md.mesh.y-500000.)/1000.;
+ md.geometry.thickness(:)=1000.;
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness;
++md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ md.surfaceforcings.mass_balance(:)=100.;
+ md=extrude(md,3,1.);
+ md=setflowequation(md,'SSA','all');
+Index: ../trunk-jpl/test/NightlyRun/test225.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test225.py	(revision 17589)
++++ ../trunk-jpl/test/NightlyRun/test225.py	(revision 17590)
+@@ -10,7 +10,7 @@
+ md=triangle(model(),'../Exp/Square.exp',200000.)
+ md=setmask(md,'all','')
+ md=parameterize(md,'../Par/SquareShelf.py')
+-md.geometry.bed=md.geometry.bed+50.
++md.geometry.base=md.geometry.base+50.
+ md.geometry.surface=md.geometry.surface+50.
+ md.extrude(3,1.)
+ md=setflowequation(md,'HO','all')
+Index: ../trunk-jpl/test/NightlyRun/test427.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test427.py	(revision 17589)
++++ ../trunk-jpl/test/NightlyRun/test427.py	(revision 17590)
+@@ -13,10 +13,10 @@
+ md=parameterize(md,'../Par/SquareSheetShelf.py')
+ md.initialization.vx[:]=0.
+ md.initialization.vy[:]=0.
+-md.geometry.bed=-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
+-md.geometry.bathymetry=-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
++md.geometry.base=-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
++md.geometry.base=-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
+ md.geometry.thickness[:]=1300
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness
++md.geometry.surface=md.geometry.base+md.geometry.thickness
+ md=setflowequation(md,'SSA','all')
+ md.extrude(3,1.)
+ 
+Index: ../trunk-jpl/test/NightlyRun/test435.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test435.m	(revision 17589)
++++ ../trunk-jpl/test/NightlyRun/test435.m	(revision 17590)
+@@ -4,12 +4,12 @@
+ md.initialization.vx(:)=1.;
+ md.initialization.vy(:)=1.;
+ md.geometry.thickness(:)=500-md.mesh.x/10000;
+-md.geometry.bathymetry=-100-md.mesh.x/1000;
+-md.geometry.bed=-md.geometry.thickness*md.materials.rho_ice/md.materials.rho_water;
+-md.mask.groundedice_levelset=md.geometry.thickness+md.materials.rho_water/md.materials.rho_ice*md.geometry.bathymetry;
++md.geometry.base=-100-md.mesh.x/1000;
++md.geometry.base=-md.geometry.thickness*md.materials.rho_ice/md.materials.rho_water;
++md.mask.groundedice_levelset=md.geometry.thickness+md.materials.rho_water/md.materials.rho_ice*md.geometry.base;
+ pos=find(md.mask.groundedice_levelset>=0);
+-md.geometry.bed(pos)=md.geometry.bathymetry(pos);
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness;
++md.geometry.base(pos)=md.geometry.base(pos);
++md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ md=extrude(md,4,1.);
+ md=setflowequation(md,'HO','all');
+ 
+Index: ../trunk-jpl/test/NightlyRun/test223.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test223.m	(revision 17589)
++++ ../trunk-jpl/test/NightlyRun/test223.m	(revision 17590)
+@@ -2,7 +2,7 @@
+ md=setmask(md,'all','');
+ md=parameterize(md,'../Par/SquareShelf.par');
+ md=setflowequation(md,'SSA','all');
+-md.geometry.bed=md.geometry.bed+50.; md.geometry.surface=md.geometry.surface+50.;
++md.geometry.base=md.geometry.base+50.; md.geometry.surface=md.geometry.surface+50.;
+ md.cluster=generic('name',oshostname(),'np',1);
+ md.masstransport.hydrostatic_adjustment='Incremental';
+ md=solve(md,TransientSolutionEnum());
+Index: ../trunk-jpl/test/NightlyRun/test427.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test427.m	(revision 17589)
++++ ../trunk-jpl/test/NightlyRun/test427.m	(revision 17590)
+@@ -3,10 +3,10 @@
+ md=parameterize(md,'../Par/SquareSheetShelf.par');
+ md.initialization.vx(:)=0.;
+ md.initialization.vy(:)=0.;
+-md.geometry.bed=-700.-abs(md.mesh.y-500000.)/1000.;
+-md.geometry.bathymetry=-700.-abs(md.mesh.y-500000.)/1000.;
++md.geometry.base=-700.-abs(md.mesh.y-500000.)/1000.;
++md.geometry.base=-700.-abs(md.mesh.y-500000.)/1000.;
+ md.geometry.thickness(:)=1300;
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness;
++md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ md=setflowequation(md,'SSA','all');
+ md=extrude(md,3,1.);
+ 
+Index: ../trunk-jpl/test/NightlyRun/test217.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test217.py	(revision 17589)
++++ ../trunk-jpl/test/NightlyRun/test217.py	(revision 17590)
+@@ -33,8 +33,8 @@
+ 
+ h=1000.
+ md.geometry.thickness=h*ones((md.mesh.numberofvertices,1))
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
++md.geometry.surface=md.geometry.base+md.geometry.thickness
+ 
+ # Initial velocity and pressure
+ md.initialization.vx=zeros((md.mesh.numberofvertices,1))
+Index: ../trunk-jpl/test/NightlyRun/test3020.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test3020.m	(revision 17589)
++++ ../trunk-jpl/test/NightlyRun/test3020.m	(revision 17590)
+@@ -39,8 +39,8 @@
+ md=md2;
+ md.autodiff.isautodiff=false;
+ md.geometry.thickness(index)=h0;
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness;
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
++md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ md=SetIceShelfBC(md);
+ 
+ md=solve(md,TransientSolutionEnum());
+@@ -51,8 +51,8 @@
+ md=md2;
+ md.autodiff.isautodiff=false;
+ md.geometry.thickness(index)=h2;
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness;
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
++md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ md=SetIceShelfBC(md);
+ 
+ md=solve(md,TransientSolutionEnum());
+@@ -67,8 +67,8 @@
+ md=md2;
+ md.autodiff.isautodiff=true;
+ md.geometry.thickness(index)=h1;
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness;
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
++md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ md=SetIceShelfBC(md);
+ 
+ md=solve(md,TransientSolutionEnum());
+Index: ../trunk-jpl/test/NightlyRun/test423.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test423.py	(revision 17589)
++++ ../trunk-jpl/test/NightlyRun/test423.py	(revision 17590)
+@@ -44,7 +44,7 @@
+ element_on_iceshelf_soft=md.results.TransientSolution[0].MaskGroundediceLevelset
+ vel_soft=md.results.TransientSolution[0].Vel
+ 
+-md.mask.groundedice_levelset=md.geometry.thickness + md.materials.rho_water/md.materials.rho_ice*md.geometry.bathymetry
++md.mask.groundedice_levelset=md.geometry.thickness + md.materials.rho_water/md.materials.rho_ice*md.geometry.base
+ md.groundingline.migration='SubelementMigration'
+ md=solve(md,TransientSolutionEnum())
+ element_on_iceshelf_subelement=md.results.TransientSolution[0].MaskGroundediceLevelset
+Index: ../trunk-jpl/test/NightlyRun/test225.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test225.m	(revision 17589)
++++ ../trunk-jpl/test/NightlyRun/test225.m	(revision 17590)
+@@ -1,7 +1,7 @@
+ md=triangle(model(),'../Exp/Square.exp',200000.);
+ md=setmask(md,'all','');
+ md=parameterize(md,'../Par/SquareShelf.par');
+-md.geometry.bed=md.geometry.bed+50.; md.geometry.surface=md.geometry.surface+50.;
++md.geometry.base=md.geometry.base+50.; md.geometry.surface=md.geometry.surface+50.;
+ md=extrude(md,3,1.);
+ md=setflowequation(md,'HO','all');
+ md.cluster=generic('name',oshostname(),'np',3);
+Index: ../trunk-jpl/test/NightlyRun/test3015.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test3015.py	(revision 17589)
++++ ../trunk-jpl/test/NightlyRun/test3015.py	(revision 17590)
+@@ -51,8 +51,8 @@
+ md=copy.deepcopy(md2)
+ md.autodiff.isautodiff=False
+ md.geometry.thickness[index]=h0
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
++md.geometry.surface=md.geometry.base+md.geometry.thickness
+ md=SetIceShelfBC(md)
+ 
+ md=solve(md,MasstransportSolutionEnum())
+@@ -62,8 +62,8 @@
+ md=copy.deepcopy(md2)
+ md.autodiff.isautodiff=False
+ md.geometry.thickness[index]=h2
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
++md.geometry.surface=md.geometry.base+md.geometry.thickness
+ md=SetIceShelfBC(md)
+ 
+ md=solve(md,MasstransportSolutionEnum())
+@@ -76,8 +76,8 @@
+ md=md2
+ md.autodiff.isautodiff=True
+ md.geometry.thickness[index]=h1
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
++md.geometry.surface=md.geometry.base+md.geometry.thickness
+ md=SetIceShelfBC(md)
+ 
+ md=solve(md,MasstransportSolutionEnum())
+Index: ../trunk-jpl/test/NightlyRun/test511.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test511.m	(revision 17589)
++++ ../trunk-jpl/test/NightlyRun/test511.m	(revision 17590)
+@@ -3,8 +3,8 @@
+ md=parameterize(md,'../Par/Pig.par');
+ 
+ %impose hydrostatic equilibrium (required by Stokes)
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness;
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
++md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ md=extrude(md,3,1.);
+ md=setflowequation(md,'FS','all');
+ md=extract(md,md.mask.groundedice_levelset<0.);
+Index: ../trunk-jpl/test/NightlyRun/test217.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test217.m	(revision 17589)
++++ ../trunk-jpl/test/NightlyRun/test217.m	(revision 17590)
+@@ -21,8 +21,8 @@
+ 
+ h=1000;
+ md.geometry.thickness=h*ones(md.mesh.numberofvertices,1);
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness;
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
++md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ 
+ %Initial velocity and pressure
+ md.initialization.vx=zeros(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/test/NightlyRun/test424.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test424.py	(revision 17589)
++++ ../trunk-jpl/test/NightlyRun/test424.py	(revision 17590)
+@@ -14,10 +14,10 @@
+ md=setflowequation(md,'SSA','all')
+ md.initialization.vx[:]=0.
+ md.initialization.vy[:]=0.
+-md.geometry.bed=-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
+-md.geometry.bathymetry=-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
++md.geometry.base=-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
++md.geometry.base=-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
+ md.geometry.thickness[:]=1000.
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness
++md.geometry.surface=md.geometry.base+md.geometry.thickness
+ md.surfaceforcings.mass_balance[:]=100.
+ md.transient.isstressbalance=False
+ md.transient.isgroundingline=True
+Index: ../trunk-jpl/test/NightlyRun/test218.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test218.m	(revision 17589)
++++ ../trunk-jpl/test/NightlyRun/test218.m	(revision 17590)
+@@ -18,8 +18,8 @@
+ 
+ h=1000;
+ md.geometry.thickness=h*ones(md.mesh.numberofvertices,1);
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness;
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
++md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ 
+ %Initial velocity and pressure
+ md.initialization.vx=zeros(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/test/NightlyRun/test423.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test423.m	(revision 17589)
++++ ../trunk-jpl/test/NightlyRun/test423.m	(revision 17590)
+@@ -33,7 +33,7 @@
+ element_on_iceshelf_soft=(md.results.TransientSolution.MaskGroundediceLevelset);
+ vel_soft=(md.results.TransientSolution.Vel);
+ 
+-md.mask.groundedice_levelset=md.geometry.thickness + md.materials.rho_water/md.materials.rho_ice*md.geometry.bathymetry;
++md.mask.groundedice_levelset=md.geometry.thickness + md.materials.rho_water/md.materials.rho_ice*md.geometry.base;
+ md.groundingline.migration='SubelementMigration';
+ md=solve(md,TransientSolutionEnum());
+ element_on_iceshelf_subelement=(md.results.TransientSolution.MaskGroundediceLevelset);
+Index: ../trunk-jpl/test/NightlyRun/test223.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test223.py	(revision 17589)
++++ ../trunk-jpl/test/NightlyRun/test223.py	(revision 17590)
+@@ -11,7 +11,7 @@
+ md=setmask(md,'all','')
+ md=parameterize(md,'../Par/SquareShelf.py')
+ md=setflowequation(md,'SSA','all')
+-md.geometry.bed=md.geometry.bed+50.
++md.geometry.base=md.geometry.base+50.
+ md.geometry.surface=md.geometry.surface+50.
+ md.cluster=generic('name',oshostname(),'np',1)
+ md.masstransport.hydrostatic_adjustment='Incremental'
+Index: ../trunk-jpl/test/NightlyRun/test425.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test425.py	(revision 17589)
++++ ../trunk-jpl/test/NightlyRun/test425.py	(revision 17590)
+@@ -14,10 +14,10 @@
+ md=setflowequation(md,'SSA','all')
+ md.initialization.vx[:]=0.
+ md.initialization.vy[:]=0.
+-md.geometry.bed=-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
+-md.geometry.bathymetry=-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
++md.geometry.base=-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
++md.geometry.base=-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
+ md.geometry.thickness[:]=1300.
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness
++md.geometry.surface=md.geometry.base+md.geometry.thickness
+ md.surfaceforcings.mass_balance[:]=-150.
+ md.transient.isstressbalance=False
+ md.transient.isgroundingline=True
+Index: ../trunk-jpl/test/NightlyRun/test3020.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test3020.py	(revision 17589)
++++ ../trunk-jpl/test/NightlyRun/test3020.py	(revision 17590)
+@@ -53,8 +53,8 @@
+ md=copy.deepcopy(md2)
+ md.autodiff.isautodiff=False
+ md.geometry.thickness[index]=h0
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
++md.geometry.surface=md.geometry.base+md.geometry.thickness
+ md=SetIceShelfBC(md)
+ 
+ md=solve(md,TransientSolutionEnum())
+@@ -65,8 +65,8 @@
+ md=copy.deepcopy(md2)
+ md.autodiff.isautodiff=False
+ md.geometry.thickness[index]=h2
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
++md.geometry.surface=md.geometry.base+md.geometry.thickness
+ md=SetIceShelfBC(md)
+ 
+ md=solve(md,TransientSolutionEnum())
+@@ -81,8 +81,8 @@
+ md=copy.deepcopy(md2)
+ md.autodiff.isautodiff=True
+ md.geometry.thickness[index]=h1
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
++md.geometry.surface=md.geometry.base+md.geometry.thickness
+ md=SetIceShelfBC(md)
+ 
+ md=solve(md,TransientSolutionEnum())
+Index: ../trunk-jpl/test/NightlyRun/test3015.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test3015.m	(revision 17589)
++++ ../trunk-jpl/test/NightlyRun/test3015.m	(revision 17590)
+@@ -37,8 +37,8 @@
+ md=md2;
+ md.autodiff.isautodiff=false;
+ md.geometry.thickness(index)=h0;
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness;
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
++md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ md=SetIceShelfBC(md);
+ 
+ md=solve(md,MasstransportSolutionEnum());
+@@ -48,8 +48,8 @@
+ md=md2;
+ md.autodiff.isautodiff=false;
+ md.geometry.thickness(index)=h2;
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness;
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
++md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ md=SetIceShelfBC(md);
+ 
+ md=solve(md,MasstransportSolutionEnum());
+@@ -62,8 +62,8 @@
+ md=md2;
+ md.autodiff.isautodiff=true;
+ md.geometry.thickness(index)=h1;
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness;
++md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
++md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ md=SetIceShelfBC(md);
+ 
+ md=solve(md,MasstransportSolutionEnum());
+Index: ../trunk-jpl/test/NightlyRun/test701.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test701.m	(revision 17589)
++++ ../trunk-jpl/test/NightlyRun/test701.m	(revision 17590)
+@@ -6,8 +6,8 @@
+ 
+ %Geometry
+ md.geometry.surface   = interp1(x,b+h,md.mesh.x);
+-md.geometry.bed       = interp1(x,b,md.mesh.x);
+-md.geometry.thickness = md.geometry.surface-md.geometry.bed;
++md.geometry.base       = interp1(x,b,md.mesh.x);
++md.geometry.thickness = md.geometry.surface-md.geometry.base;
+ 
+ %mask
+ md.mask.ice_levelset  = - ones(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/test/NightlyRun/test424.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test424.m	(revision 17589)
++++ ../trunk-jpl/test/NightlyRun/test424.m	(revision 17590)
+@@ -4,10 +4,10 @@
+ md=setflowequation(md,'SSA','all');
+ md.initialization.vx(:)=0.;
+ md.initialization.vy(:)=0.;
+-md.geometry.bed=-700.-abs(md.mesh.y-500000.)/1000.;
+-md.geometry.bathymetry=-700.-abs(md.mesh.y-500000.)/1000.;
++md.geometry.base=-700.-abs(md.mesh.y-500000.)/1000.;
++md.geometry.base=-700.-abs(md.mesh.y-500000.)/1000.;
+ md.geometry.thickness(:)=1000.;
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness;
++md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ md.surfaceforcings.mass_balance(:)=100.;
+ md.transient.isstressbalance=0;
+ md.transient.isgroundingline=1;
+Index: ../trunk-jpl/test/NightlyRun/test426.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test426.py	(revision 17589)
++++ ../trunk-jpl/test/NightlyRun/test426.py	(revision 17590)
+@@ -13,10 +13,10 @@
+ md=parameterize(md,'../Par/SquareSheetShelf.py')
+ md.initialization.vx[:]=0.
+ md.initialization.vy[:]=0.
+-md.geometry.bed=-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
+-md.geometry.bathymetry=-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
++md.geometry.base=-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
++md.geometry.base=-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
+ md.geometry.thickness[:]=1000.
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness
++md.geometry.surface=md.geometry.base+md.geometry.thickness
+ md.surfaceforcings.mass_balance[:]=100.
+ md.extrude(3,1.);
+ md=setflowequation(md,'SSA','all');
+Index: ../trunk-jpl/test/NightlyRun/test702.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test702.m	(revision 17589)
++++ ../trunk-jpl/test/NightlyRun/test702.m	(revision 17590)
+@@ -10,8 +10,8 @@
+ 
+ %parameterize
+ md.geometry.surface   = interp1(x,b+h,md.mesh.x);
+-md.geometry.bed       = interp1(x,b,md.mesh.x);
+-md.geometry.thickness = md.geometry.surface-md.geometry.bed;
++md.geometry.base       = interp1(x,b,md.mesh.x);
++md.geometry.thickness = md.geometry.surface-md.geometry.base;
+ md.mask.ice_levelset = - ones(md.mesh.numberofvertices,1);
+ md.mask.ice_levelset(find(vertexflags(md.mesh,2))) = 0;
+ md.mask.groundedice_levelset = double(md.mesh.x<0)-.5;
+Index: ../trunk-jpl/test/NightlyRun/test425.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test425.m	(revision 17589)
++++ ../trunk-jpl/test/NightlyRun/test425.m	(revision 17590)
+@@ -4,10 +4,10 @@
+ md=setflowequation(md,'SSA','all');
+ md.initialization.vx(:)=0.;
+ md.initialization.vy(:)=0.;
+-md.geometry.bed=-700.-abs(md.mesh.y-500000.)/1000.;
+-md.geometry.bathymetry=-700.-abs(md.mesh.y-500000.)/1000.;
++md.geometry.base=-700.-abs(md.mesh.y-500000.)/1000.;
++md.geometry.base=-700.-abs(md.mesh.y-500000.)/1000.;
+ md.geometry.thickness(:)=1300.;
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness;
++md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ md.surfaceforcings.mass_balance(:)=-150.;
+ md.transient.isstressbalance=0;
+ md.transient.isgroundingline=1;
+Index: ../trunk-jpl/src/m/geometry/ThicknessCorrection.m
+===================================================================
+--- ../trunk-jpl/src/m/geometry/ThicknessCorrection.m	(revision 17589)
++++ ../trunk-jpl/src/m/geometry/ThicknessCorrection.m	(revision 17590)
+@@ -74,4 +74,4 @@
+ %change bed to take into account the changes in thickness
+ md.geometry.thickness=thickness;
+ md.geometry.hydrostatic_ratio=hydrostatic_ratio;
+-md.geometry.bed=md.geometry.surface-md.geometry.thickness;
++md.geometry.base=md.geometry.surface-md.geometry.thickness;
+Index: ../trunk-jpl/src/m/mech/basalstress.m
+===================================================================
+--- ../trunk-jpl/src/m/mech/basalstress.m	(revision 17589)
++++ ../trunk-jpl/src/m/mech/basalstress.m	(revision 17590)
+@@ -16,6 +16,6 @@
+ uby=md.initialization.vy/md.constants.yts;
+ 
+ %compute basal drag
+-bx=(md.constants.g*(md.materials.rho_ice*md.geometry.thickness+md.materials.rho_water*md.geometry.bed)).^r.*(md.friction.coefficient).^2.*ubx.^s;
+-by=(md.constants.g*(md.materials.rho_ice*md.geometry.thickness+md.materials.rho_water*md.geometry.bed)).^r.*(md.friction.coefficient).^2.*uby.^s;
+-b=(md.constants.g*(md.materials.rho_ice*md.geometry.thickness+md.materials.rho_water*md.geometry.bed)).^r.*(md.friction.coefficient).^2.*ub.^s;
++bx=(md.constants.g*(md.materials.rho_ice*md.geometry.thickness+md.materials.rho_water*md.geometry.base)).^r.*(md.friction.coefficient).^2.*ubx.^s;
++by=(md.constants.g*(md.materials.rho_ice*md.geometry.thickness+md.materials.rho_water*md.geometry.base)).^r.*(md.friction.coefficient).^2.*uby.^s;
++b=(md.constants.g*(md.materials.rho_ice*md.geometry.thickness+md.materials.rho_water*md.geometry.base)).^r.*(md.friction.coefficient).^2.*ub.^s;
+Index: ../trunk-jpl/src/m/plot/plot_basaldrag.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_basaldrag.m	(revision 17589)
++++ ../trunk-jpl/src/m/plot/plot_basaldrag.m	(revision 17590)
+@@ -29,7 +29,7 @@
+ end
+ 
+ %compute basal drag
+-drag=(max(md.constants.g*(md.materials.rho_ice*md.geometry.thickness+md.materials.rho_water*md.geometry.bed),0)).^r.*(md.friction.coefficient).^2.*ub.^s/1000;
++drag=(max(md.constants.g*(md.materials.rho_ice*md.geometry.thickness+md.materials.rho_water*md.geometry.base),0)).^r.*(md.friction.coefficient).^2.*ub.^s/1000;
+ 
+ %Figure out if this is a Section plot
+ if exist(options,'sectionvalue')
+Index: ../trunk-jpl/src/m/classes/groundingline.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/groundingline.py	(revision 17589)
++++ ../trunk-jpl/src/m/classes/groundingline.py	(revision 17590)
+@@ -44,12 +44,12 @@
+ 		md = checkfield(md,'fieldname','groundingline.migration','values',['None','AgressiveMigration','SoftMigration','SubelementMigration','SubelementMigration2' 'Contact'])
+ 
+ 		if not m.strcmp(self.migration,'None'):
+-			if numpy.any(numpy.isnan(md.geometry.bathymetry)):
++			if numpy.any(numpy.isnan(md.geometry.bed)):
+ 				md.checkmessage("requesting grounding line migration, but bathymetry is absent!")
+ 			pos=numpy.nonzero(md.mask.groundedice_levelset>0.)[0]
+-			if any(numpy.abs(md.geometry.bed[pos]-md.geometry.bathymetry[pos])>10**-10):
++			if any(numpy.abs(md.geometry.base[pos]-md.geometry.bed[pos])>10**-10):
+ 				md.checkmessage("bathymetry not equal to bed on grounded ice!")
+-			if any(md.geometry.bathymetry - md.geometry.bed > 10**-9):
++			if any(md.geometry.bed - md.geometry.base > 10**-9):
+ 				md.checkmessage("bathymetry superior to bed on floating ice!")
+ 
+ 		return md
+Index: ../trunk-jpl/src/m/classes/mesh3dprisms.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh3dprisms.m	(revision 17589)
++++ ../trunk-jpl/src/m/classes/mesh3dprisms.m	(revision 17590)
+@@ -86,7 +86,7 @@
+ 			md = checkfield(md,'fieldname','mesh.elementonsurface','size',[md.mesh.numberofelements 1],'values',[0 1]);
+ 			md = checkfield(md,'fieldname','mesh.vertexonbed','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+ 			md = checkfield(md,'fieldname','mesh.vertexonsurface','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+-			md = checkfield(md,'fieldname','mesh.z','>=',md.geometry.bed-10^-10,'message','''mesh.z'' lower than bedrock');
++			md = checkfield(md,'fieldname','mesh.z','>=',md.geometry.base-10^-10,'message','''mesh.z'' lower than bedrock');
+ 			md = checkfield(md,'fieldname','mesh.z','<=',md.geometry.surface+10^-10,'message','''mesh.z'' higher than surface elevation');
+ 			md = checkfield(md,'fieldname','mesh.average_vertex_connectivity','>=',24,'message','''mesh.average_vertex_connectivity'' should be at least 24 in 3d');
+ 		end % }}}
+Index: ../trunk-jpl/src/m/classes/geometry.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/geometry.m	(revision 17589)
++++ ../trunk-jpl/src/m/classes/geometry.m	(revision 17590)
+@@ -7,10 +7,30 @@
+ 	properties (SetAccess=public) 
+ 		surface           = NaN;
+ 		thickness         = NaN;
++		base              = NaN;
+ 		bed               = NaN;
+-		bathymetry        = NaN;
+ 		hydrostatic_ratio = NaN;
+ 	end
++	methods (Static)
++		function obj = loadobj(obj) % {{{
++			% This function is directly called by matlab when a model object is
++			% loaded. Update old properties here
++
++			%2014 March 26th
++			if isstruct(obj),
++				disp('WARNING: updating geometry');
++				disp('         md.geometry.bed        is now md.geometry.base');
++				disp('         md.geometry.bathymetry is now md.geometry.bed');
++				obj2=obj;
++				obj=geometry();
++				obj.surface    = obj2.surface;
++				obj.thickness  = obj2.thickness;
++				obj.base       = obj2.bed;
++				obj.bed        = obj2.bathymetry;
++			end
++
++		end% }}}
++	end
+ 	methods
+ 		function obj = geometry(varargin) % {{{
+ 			switch nargin
+@@ -29,31 +49,30 @@
+ 				md = checkfield(md,'fieldname','geometry.thickness','forcing',1,'NaN',1,'>=',0);
+ 			else
+ 				md = checkfield(md,'fieldname','geometry.surface'  ,'NaN',1,'size',[md.mesh.numberofvertices 1]);
+-				md = checkfield(md,'fieldname','geometry.bed'      ,'NaN',1,'size',[md.mesh.numberofvertices 1]);
++				md = checkfield(md,'fieldname','geometry.base'      ,'NaN',1,'size',[md.mesh.numberofvertices 1]);
+ 				md = checkfield(md,'fieldname','geometry.thickness','NaN',1,'size',[md.mesh.numberofvertices 1],'>',0);
+-				if any((obj.thickness-obj.surface+obj.bed)>10^-9),
+-					md = checkmessage(md,['equality thickness=surface-bed violated']);
++				if any((obj.thickness-obj.surface+obj.base)>10^-9),
++					md = checkmessage(md,['equality thickness=surface-base violated']);
+ 				end 
+ 				if solution==TransientSolutionEnum() & md.transient.isgroundingline,
+-					md = checkfield(md,'fieldname','geometry.bathymetry','NaN',1,'size',[md.mesh.numberofvertices 1]);
++					md = checkfield(md,'fieldname','geometry.bed','NaN',1,'size',[md.mesh.numberofvertices 1]);
+ 				end
+ 			end
+ 		end % }}}
+ 		function disp(obj) % {{{
+ 			disp(sprintf('   geometry parameters:'));
+ 
+-			fielddisplay(obj,'surface','surface elevation [m]');
++			fielddisplay(obj,'surface','ice upper surface elevation [m]');
+ 			fielddisplay(obj,'thickness','ice thickness [m]');
++			fielddisplay(obj,'base','ice base elevation [m]');
+ 			fielddisplay(obj,'bed','bed elevation [m]');
+-			fielddisplay(obj,'bathymetry','bathymetry elevation [m]');
+-			fielddisplay(obj,'hydrostatic_ratio','coefficient for ice shelves'' thickness correction: hydrostatic_ratio H_obs+ (1-hydrostatic_ratio) H_hydro');
+ 
+ 		end % }}}
+ 		function marshall(obj,md,fid) % {{{
+ 			WriteData(fid,'data',obj.surface,'format','DoubleMat','mattype',1,'enum',SurfaceEnum());
+ 			WriteData(fid,'data',obj.thickness,'format','DoubleMat','mattype',1,'enum',ThicknessEnum(),'forcinglength',md.mesh.numberofvertices+1);
+-			WriteData(fid,'data',obj.bed,'format','DoubleMat','mattype',1,'enum',BaseEnum());
+-			WriteData(fid,'data',obj.bathymetry,'format','DoubleMat','mattype',1,'enum',BedEnum());
++			WriteData(fid,'data',obj.base,'format','DoubleMat','mattype',1,'enum',BaseEnum());
++			WriteData(fid,'data',obj.bed,'format','DoubleMat','mattype',1,'enum',BedEnum());
+ 			WriteData(fid,'object',obj,'fieldname','hydrostatic_ratio','format','DoubleMat','mattype',1);
+ 		end % }}}
+ 	end
+Index: ../trunk-jpl/src/m/classes/groundingline.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/groundingline.m	(revision 17589)
++++ ../trunk-jpl/src/m/classes/groundingline.m	(revision 17590)
+@@ -31,14 +31,14 @@
+ 			md = checkfield(md,'fieldname','groundingline.migration','values',{'None' 'AgressiveMigration' 'SoftMigration' 'SubelementMigration','SubelementMigration2' 'Contact'});
+ 
+ 			if ~strcmp(obj.migration,'None'),
+-				if isnan(md.geometry.bathymetry),
++				if isnan(md.geometry.bed),
+ 					md = checkmessage(md,['requesting grounding line migration, but bathymetry is absent!']);
+ 				end
+ 				pos=find(md.mask.groundedice_levelset>0.);
+-				if any(abs(md.geometry.bed(pos)-md.geometry.bathymetry(pos))>10^-10),
++				if any(abs(md.geometry.base(pos)-md.geometry.bed(pos))>10^-10),
+ 					md = checkmessage(md,['bathymetry not equal to bed on grounded ice!']);
+ 				end
+-				if any(md.geometry.bathymetry - md.geometry.bed > 10^-9),
++				if any(md.geometry.bed - md.geometry.base > 10^-9),
+ 					md = checkmessage(md,['bathymetry superior to bed on floating ice!']);
+ 				end
+ 			end
+Index: ../trunk-jpl/src/m/classes/mesh3dtetras.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh3dtetras.m	(revision 17589)
++++ ../trunk-jpl/src/m/classes/mesh3dtetras.m	(revision 17590)
+@@ -82,7 +82,7 @@
+ 			%no checks for numberofedges lat long and hemisphere
+ 			md = checkfield(md,'fieldname','mesh.vertexonbed','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+ 			md = checkfield(md,'fieldname','mesh.vertexonsurface','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+-			md = checkfield(md,'fieldname','mesh.z','>=',md.geometry.bed-10^-10,'message','''mesh.z'' lower than bedrock');
++			md = checkfield(md,'fieldname','mesh.z','>=',md.geometry.base-10^-10,'message','''mesh.z'' lower than bedrock');
+ 			md = checkfield(md,'fieldname','mesh.z','<=',md.geometry.surface+10^-10,'message','''mesh.z'' higher than surface elevation');
+ 			md = checkfield(md,'fieldname','mesh.average_vertex_connectivity','>=',24,'message','''mesh.average_vertex_connectivity'' should be at least 24 in 3d');
+ 		end % }}}
+Index: ../trunk-jpl/src/m/classes/model.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.py	(revision 17589)
++++ ../trunk-jpl/src/m/classes/model.py	(revision 17590)
+@@ -527,7 +527,7 @@
+ 		y3d=numpy.empty((0))
+ 		z3d=numpy.empty((0))    #the lower node is on the bed
+ 		thickness3d=md.geometry.thickness    #thickness and bed for these nodes
+-		bed3d=md.geometry.bed
++		bed3d=md.geometry.base
+ 
+ 		#Create the new layers
+ 		for i in xrange(numlayers):
+@@ -544,20 +544,20 @@
+ 		number_el3d=numpy.size(elements3d,axis=0)    #number of 3d nodes for the non extruded part of the mesh
+ 
+ 		#Keep a trace of lower and upper nodes
+-		mesh.lowervertex=-1*numpy.ones(number_nodes3d,int)
+-		mesh.uppervertex=-1*numpy.ones(number_nodes3d,int)
+-		mesh.lowervertex[md.mesh.numberofvertices:]=numpy.arange(1,(numlayers-1)*md.mesh.numberofvertices+1)
+-		mesh.uppervertex[:(numlayers-1)*md.mesh.numberofvertices]=numpy.arange(md.mesh.numberofvertices+1,number_nodes3d+1)
+-		md.mesh.lowervertex=mesh.lowervertex
+-		md.mesh.uppervertex=mesh.uppervertex
++		lowervertex=-1*numpy.ones(number_nodes3d,int)
++		uppervertex=-1*numpy.ones(number_nodes3d,int)
++		lowervertex[md.mesh.numberofvertices:]=numpy.arange(1,(numlayers-1)*md.mesh.numberofvertices+1)
++		uppervertex[:(numlayers-1)*md.mesh.numberofvertices]=numpy.arange(md.mesh.numberofvertices+1,number_nodes3d+1)
++		md.mesh.lowervertex=lowervertex
++		md.mesh.uppervertex=uppervertex
+ 
+ 		#same for lower and upper elements
+-		mesh.lowerelements=-1*numpy.ones(number_el3d,int)
+-		mesh.upperelements=-1*numpy.ones(number_el3d,int)
+-		mesh.lowerelements[md.mesh.numberofelements:]=numpy.arange(1,(numlayers-2)*md.mesh.numberofelements+1)
+-		mesh.upperelements[:(numlayers-2)*md.mesh.numberofelements]=numpy.arange(md.mesh.numberofelements+1,(numlayers-1)*md.mesh.numberofelements+1)
+-		md.mesh.lowerelements=mesh.lowerelements
+-		md.mesh.upperelements=mesh.upperelements
++		lowerelements=-1*numpy.ones(number_el3d,int)
++		upperelements=-1*numpy.ones(number_el3d,int)
++		lowerelements[md.mesh.numberofelements:]=numpy.arange(1,(numlayers-2)*md.mesh.numberofelements+1)
++		upperelements[:(numlayers-2)*md.mesh.numberofelements]=numpy.arange(md.mesh.numberofelements+1,(numlayers-1)*md.mesh.numberofelements+1)
++		md.mesh.lowerelements=lowerelements
++		md.mesh.upperelements=upperelements
+ 
+ 		#Save old mesh 
+ 		md.mesh.x2d=md.mesh.x
+@@ -673,8 +673,8 @@
+ 		md.gia.mantle_viscosity=project3d(md,'vector',md.gia.mantle_viscosity,'type','node')
+ 		md.gia.lithosphere_thickness=project3d(md,'vector',md.gia.lithosphere_thickness,'type','node')
+ 		md.geometry.hydrostatic_ratio=project3d(md,'vector',md.geometry.hydrostatic_ratio,'type','node')
++		md.geometry.base=project3d(md,'vector',md.geometry.base,'type','node')
+ 		md.geometry.bed=project3d(md,'vector',md.geometry.bed,'type','node')
+-		md.geometry.bathymetry=project3d(md,'vector',md.geometry.bathymetry,'type','node')
+ 		md.mesh.vertexonboundary=project3d(md,'vector',md.mesh.vertexonboundary,'type','node')
+ 		md.mask.ice_levelset=project3d(md,'vector',md.mask.ice_levelset,'type','node')
+ 		md.mask.groundedice_levelset=project3d(md,'vector',md.mask.groundedice_levelset,'type','node')
+Index: ../trunk-jpl/src/m/classes/geometry.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/geometry.py	(revision 17589)
++++ ../trunk-jpl/src/m/classes/geometry.py	(revision 17590)
+@@ -14,8 +14,8 @@
+ 	def __init__(self): # {{{
+ 		self.surface           = float('NaN')
+ 		self.thickness         = float('NaN')
+-		self.bed               = float('NaN')
+-		self.bathymetry        = float('NaN')
++		self.base               = float('NaN')
++		self.bed        = float('NaN')
+ 		self.hydrostatic_ratio = float('NaN')
+ 
+ 		#set defaults
+@@ -25,11 +25,10 @@
+ 	def __repr__(self): # {{{
+ 
+ 		string="   geometry parameters:"
+-		string="%s\n%s"%(string,fielddisplay(self,'surface','surface elevation [m]'))
++		string="%s\n%s"%(string,fielddisplay(self,'surface','ice upper surface elevation [m]'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'thickness','ice thickness [m]'))
++		string="%s\n%s"%(string,fielddisplay(self,'base','ice base elevation [m]'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'bed','bed elevation [m]'))
+-		string="%s\n%s"%(string,fielddisplay(self,'bathymetry','bathymetry elevation [m]'))
+-		string="%s\n%s"%(string,fielddisplay(self,'hydrostatic_ratio','coefficient for ice shelves'' thickness correction: hydrostatic_ratio H_obs+ (1-hydrostatic_ratio) H_hydro'))
+ 		return string
+ 		#}}}
+ 	def setdefaultparameters(self): # {{{
+@@ -38,19 +37,19 @@
+ 	def checkconsistency(self,md,solution,analyses):    # {{{
+ 
+ 		md = checkfield(md,'fieldname','geometry.surface'  ,'NaN',1,'size',[md.mesh.numberofvertices])
+-		md = checkfield(md,'fieldname','geometry.bed'      ,'NaN',1,'size',[md.mesh.numberofvertices])
++		md = checkfield(md,'fieldname','geometry.base'      ,'NaN',1,'size',[md.mesh.numberofvertices])
+ 		md = checkfield(md,'fieldname','geometry.thickness','NaN',1,'size',[md.mesh.numberofvertices],'>',0,'forcing',1)
+-		if any((self.thickness-self.surface+self.bed)>10**-9):
+-			md.checkmessage("equality thickness=surface-bed violated")
++		if any((self.thickness-self.surface+self.base)>10**-9):
++			md.checkmessage("equality thickness=surface-base violated")
+ 		if solution==TransientSolutionEnum() and md.transient.isgroundingline:
+-			md = checkfield(md,'fieldname','geometry.bathymetry','NaN',1,'size',[md.mesh.numberofvertices])
++			md = checkfield(md,'fieldname','geometry.bed','NaN',1,'size',[md.mesh.numberofvertices])
+ 
+ 		return md
+ 	# }}}
+ 	def marshall(self,md,fid):    # {{{
+ 		WriteData(fid,'data',self.surface,'format','DoubleMat','mattype',1,'enum',SurfaceEnum())
+ 		WriteData(fid,'data',self.thickness,'format','DoubleMat','mattype',1,'enum',ThicknessEnum(),'forcinglength',md.mesh.numberofvertices+1)
+-		WriteData(fid,'data',self.bed,'format','DoubleMat','mattype',1,'enum',BaseEnum())
+-		WriteData(fid,'data',self.bathymetry,'format','DoubleMat','mattype',1,'enum',BedEnum())
++		WriteData(fid,'data',self.base,'format','DoubleMat','mattype',1,'enum',BaseEnum())
++		WriteData(fid,'data',self.bed,'format','DoubleMat','mattype',1,'enum',BedEnum())
+ 		WriteData(fid,'object',self,'fieldname','hydrostatic_ratio','format','DoubleMat','mattype',1)
+ 	# }}}
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17589)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17590)
+@@ -231,8 +231,8 @@
+ 			%parameters
+ 			md.geometry.surface=project2d(md,md.geometry.surface,1);
+ 			md.geometry.thickness=project2d(md,md.geometry.thickness,1);
++			md.geometry.base=project2d(md,md.geometry.base,1);
+ 			md.geometry.bed=project2d(md,md.geometry.bed,1);
+-			md.geometry.bathymetry=project2d(md,md.geometry.bathymetry,1);
+ 			md.mesh.vertexonboundary=project2d(md,md.mesh.vertexonboundary,1);
+ 			md.mesh.elementconnectivity=project2d(md,md.mesh.elementconnectivity,1);
+ 			md.mask.groundedice_levelset=project2d(md,md.mask.groundedice_levelset,1);
+@@ -636,7 +636,7 @@
+ 			y3d=[];
+ 			z3d=[];  %the lower node is on the bed
+ 			thickness3d=md.geometry.thickness; %thickness and bed for these nodes
+-			bed3d=md.geometry.bed;
++			bed3d=md.geometry.base;
+ 
+ 			%Create the new layers
+ 			for i=1:numlayers,
+@@ -655,20 +655,20 @@
+ 			number_el3d=size(elements3d,1); %number of 3d nodes for the non extruded part of the mesh
+ 
+ 			%Keep a trace of lower and upper nodes
+-			mesh.lowervertex=NaN*ones(number_nodes3d,1);
+-			mesh.uppervertex=NaN*ones(number_nodes3d,1);
+-			mesh.lowervertex(md.mesh.numberofvertices+1:end)=1:(numlayers-1)*md.mesh.numberofvertices;
+-			mesh.uppervertex(1:(numlayers-1)*md.mesh.numberofvertices)=md.mesh.numberofvertices+1:number_nodes3d;
+-			md.mesh.lowervertex=mesh.lowervertex;
+-			md.mesh.uppervertex=mesh.uppervertex;
++			lowervertex=NaN*ones(number_nodes3d,1);
++			uppervertex=NaN*ones(number_nodes3d,1);
++			lowervertex(md.mesh.numberofvertices+1:end)=1:(numlayers-1)*md.mesh.numberofvertices;
++			uppervertex(1:(numlayers-1)*md.mesh.numberofvertices)=md.mesh.numberofvertices+1:number_nodes3d;
++			md.mesh.lowervertex=lowervertex;
++			md.mesh.uppervertex=uppervertex;
+ 
+ 			%same for lower and upper elements
+-			mesh.lowerelements=NaN*ones(number_el3d,1);
+-			mesh.upperelements=NaN*ones(number_el3d,1);
+-			mesh.lowerelements(md.mesh.numberofelements+1:end)=1:(numlayers-2)*md.mesh.numberofelements;
+-			mesh.upperelements(1:(numlayers-2)*md.mesh.numberofelements)=md.mesh.numberofelements+1:(numlayers-1)*md.mesh.numberofelements;
+-			md.mesh.lowerelements=mesh.lowerelements;
+-			md.mesh.upperelements=mesh.upperelements;
++			lowerelements=NaN*ones(number_el3d,1);
++			upperelements=NaN*ones(number_el3d,1);
++			lowerelements(md.mesh.numberofelements+1:end)=1:(numlayers-2)*md.mesh.numberofelements;
++			upperelements(1:(numlayers-2)*md.mesh.numberofelements)=md.mesh.numberofelements+1:(numlayers-1)*md.mesh.numberofelements;
++			md.mesh.lowerelements=lowerelements;
++			md.mesh.upperelements=upperelements;
+ 
+ 			%Save old mesh 
+ 			md.mesh.x2d=md.mesh.x;
+@@ -792,8 +792,8 @@
+ 			md.gia.mantle_viscosity=project3d(md,'vector',md.gia.mantle_viscosity,'type','node');
+ 			md.gia.lithosphere_thickness=project3d(md,'vector',md.gia.lithosphere_thickness,'type','node');
+ 			md.geometry.hydrostatic_ratio=project3d(md,'vector',md.geometry.hydrostatic_ratio,'type','node');
++			md.geometry.base=project3d(md,'vector',md.geometry.base,'type','node');
+ 			md.geometry.bed=project3d(md,'vector',md.geometry.bed,'type','node');
+-			md.geometry.bathymetry=project3d(md,'vector',md.geometry.bathymetry,'type','node');
+ 			md.mesh.vertexonboundary=project3d(md,'vector',md.mesh.vertexonboundary,'type','node');
+ 			md.mask.groundedice_levelset=project3d(md,'vector',md.mask.groundedice_levelset,'type','node');
+ 			md.mask.ice_levelset=project3d(md,'vector',md.mask.ice_levelset,'type','node');
+@@ -924,9 +924,9 @@
+ 			if isfield(structmd,'waterfraction'), md.initialization.waterfraction=structmd.waterfraction; end
+ 			if isfield(structmd,'watercolumn'), md.initialization.watercolumn=structmd.watercolumn; end
+ 			if isfield(structmd,'surface'), md.geometry.surface=structmd.surface; end
+-			if isfield(structmd,'bed'), md.geometry.bed=structmd.bed; end
++			if isfield(structmd,'bed'), md.geometry.base=structmd.bed; end
+ 			if isfield(structmd,'thickness'), md.geometry.thickness=structmd.thickness; end
+-			if isfield(structmd,'bathymetry'), md.geometry.bathymetry=structmd.bathymetry; end
++			if isfield(structmd,'bathymetry'), md.geometry.bed=structmd.bathymetry; end
+ 			if isfield(structmd,'thickness_coeff'), md.geometry.hydrostatic_ratio=structmd.thickness_coeff; end
+ 			if isfield(structmd,'connectivity'), md.mesh.average_vertex_connectivity=structmd.connectivity; end
+ 			if isfield(structmd,'extractednodes'), md.mesh.extractedvertices=structmd.extractednodes; end
+Index: ../trunk-jpl/src/m/contrib/hydrology/effectivepressure.m
+===================================================================
+--- ../trunk-jpl/src/m/contrib/hydrology/effectivepressure.m	(revision 17589)
++++ ../trunk-jpl/src/m/contrib/hydrology/effectivepressure.m	(revision 17590)
+@@ -7,6 +7,6 @@
+ %   Example:
+ %      Neff=effectivepressure(md)
+ 
+-Neff=md.materials.rho_ice*md.constants.g*md.geometry.thickness+md.materials.rho_ice*md.constants.g*md.geometry.bed;
++Neff=md.materials.rho_ice*md.constants.g*md.geometry.thickness+md.materials.rho_ice*md.constants.g*md.geometry.base;
+ pos=find(Neff<0);
+ Neff(pos)=0;
+Index: ../trunk-jpl/src/m/interp/SectionValues.m
+===================================================================
+--- ../trunk-jpl/src/m/interp/SectionValues.m	(revision 17589)
++++ ../trunk-jpl/src/m/interp/SectionValues.m	(revision 17590)
+@@ -93,7 +93,7 @@
+ 
+ 	%Get bed and surface for each 2d point, offset to make sure that it is inside the glacier system
+ 	offset=10^-3;
+-	bed=InterpFromMeshToMesh2d(md.mesh.elements2d,md.mesh.x2d,md.mesh.y2d,project2d(md,md.geometry.bed,1),X,Y)+offset;
++	bed=InterpFromMeshToMesh2d(md.mesh.elements2d,md.mesh.x2d,md.mesh.y2d,project2d(md,md.geometry.base,1),X,Y)+offset;
+ 	surface=InterpFromMeshToMesh2d(md.mesh.elements2d,md.mesh.x2d,md.mesh.y2d,project2d(md,md.geometry.surface,1),X,Y)-offset;
+ 
+ 	%Some useful parameters
+Index: ../trunk-jpl/src/m/interp/ProfileValues.m
+===================================================================
+--- ../trunk-jpl/src/m/interp/ProfileValues.m	(revision 17589)
++++ ../trunk-jpl/src/m/interp/ProfileValues.m	(revision 17590)
+@@ -10,7 +10,7 @@
+ 
+ %Get bed and surface for each 2d point, offset to make sure that it is inside the glacier system
+ offset=10^-3;
+-bed=InterpFromMeshToMesh2d(md.mesh.elements2d,md.mesh.x2d,md.mesh.y2d,project2d(md,md.geometry.bed,1),xprof,yprof)+offset;
++bed=InterpFromMeshToMesh2d(md.mesh.elements2d,md.mesh.x2d,md.mesh.y2d,project2d(md,md.geometry.base,1),xprof,yprof)+offset;
+ surface=InterpFromMeshToMesh2d(md.mesh.elements2d,md.mesh.x2d,md.mesh.y2d,project2d(md,md.geometry.surface,1),xprof,yprof)-offset;
+ 
+ %Some useful parameters
Index: issm/oecreview/Archive/16554-17801/ISSM-17590-17591.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17590-17591.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17590-17591.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/solve/waitonlock.m
+===================================================================
+--- ../trunk-jpl/src/m/solve/waitonlock.m	(revision 17590)
++++ ../trunk-jpl/src/m/solve/waitonlock.m	(revision 17591)
+@@ -16,7 +16,7 @@
+ timelimit     = md.settings.waitonlock;
+ cluster       = md.cluster;
+ 
+-if isa(cluster,'pfe')
++if isa(cluster,'pfe') && cluster.interactive>0
+ 	lockfilename  = [executionpath '/Interactive' num2str(cluster.interactive) '/' md.miscellaneous.name '.lock'];
+ 	logfilename   = [executionpath '/Interactive' num2str(cluster.interactive) '/' md.miscellaneous.name '.outlog'];
+ else
Index: issm/oecreview/Archive/16554-17801/ISSM-17591-17592.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17591-17592.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17591-17592.diff	(revision 17802)
@@ -0,0 +1,123 @@
+Index: ../trunk-jpl/test/NightlyRun/test427.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test427.py	(revision 17591)
++++ ../trunk-jpl/test/NightlyRun/test427.py	(revision 17592)
+@@ -14,7 +14,7 @@
+ md.initialization.vx[:]=0.
+ md.initialization.vy[:]=0.
+ md.geometry.base=-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
+-md.geometry.base=-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
++md.geometry.bed =-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
+ md.geometry.thickness[:]=1300
+ md.geometry.surface=md.geometry.base+md.geometry.thickness
+ md=setflowequation(md,'SSA','all')
+Index: ../trunk-jpl/test/NightlyRun/test435.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test435.m	(revision 17591)
++++ ../trunk-jpl/test/NightlyRun/test435.m	(revision 17592)
+@@ -4,11 +4,11 @@
+ md.initialization.vx(:)=1.;
+ md.initialization.vy(:)=1.;
+ md.geometry.thickness(:)=500-md.mesh.x/10000;
+-md.geometry.base=-100-md.mesh.x/1000;
++md.geometry.bed =-100-md.mesh.x/1000;
+ md.geometry.base=-md.geometry.thickness*md.materials.rho_ice/md.materials.rho_water;
+-md.mask.groundedice_levelset=md.geometry.thickness+md.materials.rho_water/md.materials.rho_ice*md.geometry.base;
++md.mask.groundedice_levelset=md.geometry.thickness+md.materials.rho_water/md.materials.rho_ice*md.geometry.bed;
+ pos=find(md.mask.groundedice_levelset>=0);
+-md.geometry.base(pos)=md.geometry.base(pos);
++md.geometry.base(pos)=md.geometry.bed(pos);
+ md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ md=extrude(md,4,1.);
+ md=setflowequation(md,'HO','all');
+Index: ../trunk-jpl/test/NightlyRun/test427.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test427.m	(revision 17591)
++++ ../trunk-jpl/test/NightlyRun/test427.m	(revision 17592)
+@@ -4,7 +4,7 @@
+ md.initialization.vx(:)=0.;
+ md.initialization.vy(:)=0.;
+ md.geometry.base=-700.-abs(md.mesh.y-500000.)/1000.;
+-md.geometry.base=-700.-abs(md.mesh.y-500000.)/1000.;
++md.geometry.bed =-700.-abs(md.mesh.y-500000.)/1000.;
+ md.geometry.thickness(:)=1300;
+ md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ md=setflowequation(md,'SSA','all');
+Index: ../trunk-jpl/test/NightlyRun/test423.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test423.py	(revision 17591)
++++ ../trunk-jpl/test/NightlyRun/test423.py	(revision 17592)
+@@ -44,7 +44,7 @@
+ element_on_iceshelf_soft=md.results.TransientSolution[0].MaskGroundediceLevelset
+ vel_soft=md.results.TransientSolution[0].Vel
+ 
+-md.mask.groundedice_levelset=md.geometry.thickness + md.materials.rho_water/md.materials.rho_ice*md.geometry.base
++md.mask.groundedice_levelset=md.geometry.thickness + md.materials.rho_water/md.materials.rho_ice*md.geometry.bed
+ md.groundingline.migration='SubelementMigration'
+ md=solve(md,TransientSolutionEnum())
+ element_on_iceshelf_subelement=md.results.TransientSolution[0].MaskGroundediceLevelset
+Index: ../trunk-jpl/test/NightlyRun/test424.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test424.py	(revision 17591)
++++ ../trunk-jpl/test/NightlyRun/test424.py	(revision 17592)
+@@ -15,7 +15,7 @@
+ md.initialization.vx[:]=0.
+ md.initialization.vy[:]=0.
+ md.geometry.base=-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
+-md.geometry.base=-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
++md.geometry.bed =-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
+ md.geometry.thickness[:]=1000.
+ md.geometry.surface=md.geometry.base+md.geometry.thickness
+ md.surfaceforcings.mass_balance[:]=100.
+Index: ../trunk-jpl/test/NightlyRun/test423.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test423.m	(revision 17591)
++++ ../trunk-jpl/test/NightlyRun/test423.m	(revision 17592)
+@@ -33,7 +33,7 @@
+ element_on_iceshelf_soft=(md.results.TransientSolution.MaskGroundediceLevelset);
+ vel_soft=(md.results.TransientSolution.Vel);
+ 
+-md.mask.groundedice_levelset=md.geometry.thickness + md.materials.rho_water/md.materials.rho_ice*md.geometry.base;
++md.mask.groundedice_levelset=md.geometry.thickness + md.materials.rho_water/md.materials.rho_ice*md.geometry.bed;
+ md.groundingline.migration='SubelementMigration';
+ md=solve(md,TransientSolutionEnum());
+ element_on_iceshelf_subelement=(md.results.TransientSolution.MaskGroundediceLevelset);
+Index: ../trunk-jpl/test/NightlyRun/test425.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test425.py	(revision 17591)
++++ ../trunk-jpl/test/NightlyRun/test425.py	(revision 17592)
+@@ -15,7 +15,7 @@
+ md.initialization.vx[:]=0.
+ md.initialization.vy[:]=0.
+ md.geometry.base=-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
+-md.geometry.base=-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
++md.geometry.bed =-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
+ md.geometry.thickness[:]=1300.
+ md.geometry.surface=md.geometry.base+md.geometry.thickness
+ md.surfaceforcings.mass_balance[:]=-150.
+Index: ../trunk-jpl/test/NightlyRun/test424.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test424.m	(revision 17591)
++++ ../trunk-jpl/test/NightlyRun/test424.m	(revision 17592)
+@@ -5,7 +5,7 @@
+ md.initialization.vx(:)=0.;
+ md.initialization.vy(:)=0.;
+ md.geometry.base=-700.-abs(md.mesh.y-500000.)/1000.;
+-md.geometry.base=-700.-abs(md.mesh.y-500000.)/1000.;
++md.geometry.bed =-700.-abs(md.mesh.y-500000.)/1000.;
+ md.geometry.thickness(:)=1000.;
+ md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ md.surfaceforcings.mass_balance(:)=100.;
+Index: ../trunk-jpl/test/NightlyRun/test425.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test425.m	(revision 17591)
++++ ../trunk-jpl/test/NightlyRun/test425.m	(revision 17592)
+@@ -5,7 +5,7 @@
+ md.initialization.vx(:)=0.;
+ md.initialization.vy(:)=0.;
+ md.geometry.base=-700.-abs(md.mesh.y-500000.)/1000.;
+-md.geometry.base=-700.-abs(md.mesh.y-500000.)/1000.;
++md.geometry.bed =-700.-abs(md.mesh.y-500000.)/1000.;
+ md.geometry.thickness(:)=1300.;
+ md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ md.surfaceforcings.mass_balance(:)=-150.;
Index: issm/oecreview/Archive/16554-17801/ISSM-17592-17593.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17592-17593.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17592-17593.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/classes/groundingline.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/groundingline.py	(revision 17592)
++++ ../trunk-jpl/src/m/classes/groundingline.py	(revision 17593)
+@@ -41,7 +41,7 @@
+ 	#}}}
+ 	def checkconsistency(self,md,solution,analyses):    # {{{
+ 
+-		md = checkfield(md,'fieldname','groundingline.migration','values',['None','AgressiveMigration','SoftMigration','SubelementMigration','SubelementMigration2' 'Contact'])
++		md = checkfield(md,'fieldname','groundingline.migration','values',['None','AgressiveMigration','SoftMigration','SubelementMigration','SubelementMigration2','Contact'])
+ 
+ 		if not m.strcmp(self.migration,'None'):
+ 			if numpy.any(numpy.isnan(md.geometry.bed)):
Index: issm/oecreview/Archive/16554-17801/ISSM-17593-17594.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17593-17594.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17593-17594.diff	(revision 17802)
@@ -0,0 +1,29 @@
+Index: ../trunk-jpl/test/Par/RoundSheetShelf.py
+===================================================================
+--- ../trunk-jpl/test/Par/RoundSheetShelf.py	(revision 17593)
++++ ../trunk-jpl/test/Par/RoundSheetShelf.py	(revision 17594)
+@@ -105,9 +105,9 @@
+ 
+ #bathymetry and grounding line migration:
+ md.groundingline.migration='AgressiveMigration'
+-md.geometry.base=copy.deepcopy(md.geometry.base)
++md.geometry.bed=copy.deepcopy(md.geometry.base)
+ pos=numpy.nonzero(md.mask.groundedice_levelset<0.)[0]
+-md.geometry.base[pos]=md.geometry.base[pos]-900.
++md.geometry.bed[pos]=md.geometry.base[pos]-900.
+ 
+ #Deal with boundary conditions:
+ md.stressbalance.spcvx=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
+Index: ../trunk-jpl/test/Par/ValleyGlacierShelf.py
+===================================================================
+--- ../trunk-jpl/test/Par/ValleyGlacierShelf.py	(revision 17593)
++++ ../trunk-jpl/test/Par/ValleyGlacierShelf.py	(revision 17594)
+@@ -28,7 +28,7 @@
+ md.geometry.surface= (thk_center+bmax) + slope 
+ md.geometry.base=bmax + slope + 4./Ly**2*(thk_center-thk_margin)*(numpy.power(y-ym,2))
+ md.geometry.thickness=md.geometry.surface - md.geometry.base
+-md.geometry.base = md.geometry.base
++md.geometry.bed = md.geometry.base
+ 
+ #Mask
+ md.mask.ice_levelset=x - alpha*Lx
Index: issm/oecreview/Archive/16554-17801/ISSM-17594-17595.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17594-17595.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17594-17595.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/test/NightlyRun/test426.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test426.py	(revision 17594)
++++ ../trunk-jpl/test/NightlyRun/test426.py	(revision 17595)
+@@ -14,7 +14,7 @@
+ md.initialization.vx[:]=0.
+ md.initialization.vy[:]=0.
+ md.geometry.base=-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
+-md.geometry.base=-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
++md.geometry.bed =-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
+ md.geometry.thickness[:]=1000.
+ md.geometry.surface=md.geometry.base+md.geometry.thickness
+ md.surfaceforcings.mass_balance[:]=100.
Index: issm/oecreview/Archive/16554-17801/ISSM-17595-17596.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17595-17596.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17595-17596.diff	(revision 17802)
@@ -0,0 +1,174 @@
+Index: ../trunk-jpl/src/m/interp/interp.py
+===================================================================
+--- ../trunk-jpl/src/m/interp/interp.py	(revision 0)
++++ ../trunk-jpl/src/m/interp/interp.py	(revision 17596)
+@@ -0,0 +1,169 @@
++# module for inperpolating/smoothing data
++import numpy as npy
++from scipy.interpolate import CloughTocher2DInterpolator, Rbf
++
++def MeshSplineToMesh2d(x,y,data,xi,yi,tol=1e-6,**kwargs):#{{{
++	'''
++	Piecewise cubic, C1 smooth, curvature-minimizing interpolant in 2D.
++	The interpolant is guaranteed to be continuously differentiable,
++	and the gradients are chosen such that the curvature of the interpolant
++	is approximately minimized.
++
++	Uses scipy.interpolate.CloughTocher2DInterpolator
++
++	x,y:			data point coordinates
++	data:			data to be interpolated (same length as x,y)
++	xi,yi:		coordintes to interpolate data onto
++	tol:			tolerance for gradient estimation (default 1e-6)
++	**kwargs:	optional keywork arguments:
++					maxiter: maximum iterations in gradient estimation
++	
++	Returns interpolated data at given x,y coordinates.
++
++	Usage:
++		interpdata=CloughToucher2d(x,y,data)
++
++	Examples:
++		interpdata=CloughToucher2d(md.mesh.x,md.mesh.y,data)
++		interpdata=CloughToucher2d(md.mesh.x,md.mesh.y,data,tol=1e-3,maxiter=100)
++	'''
++
++	# unpack kwargs
++	maxiter=kwargs.pop('maxiter',None)
++	if 'maxiter' in kwargs: del kwargs['maxiter']
++	if maxiter:
++		assert type(maxiter)==int, 'error, maxiter should be an integer'
++	assert len(kwargs)==0, 'error, unexpected or misspelled kwargs'
++
++	points=npy.array([x,y]).T
++
++	if maxiter:
++		curvy=CloughTocher2DInterpolator(points,data,tol,maxiter=maxiter)
++	else:
++		curvy=CloughTocher2DInterpolator(points,data,tol)
++
++	interpdata=curvy(xi,yi)
++
++	return interpdata
++#}}}
++def GridSplineToMesh2d(x,y,data,xi,yi,default_value=npy.nan):#{{{
++	'''
++	python analog to InterpFromGridToMesh.  This routine uses
++	scipy.interpolate.CloughTocher2dInterpolator to create a bivariate spline
++	interpolation of the input data and then return values of the spline
++	on the x,y coordinates of the model mesh.  The interpolant is piece-wise
++	cubic, C1 smooth (continuously differentiable) and has approximately 
++	minimized curvature.  See "help(scipy.interpolate.CloughTocher2dInterpolator)"
++	for more information on the routine.
++
++	NOTE: this routine will not be appropriate if there are large holes (nan's) in 
++	the input data.  A non-spline interpolation scheme should be used in that case.
++
++	x,y:				vectors defining the coordinates of the input data
++	data:				2D array of input data
++	xi,yi:			x and y coordinates to be interpolated onto
++	default_value:	default value if points lie outside the convex hull of input
++						points (defaults to nan if not specified)
++
++	Usage:
++		interpdata=GridToMesh(x,y,data,xi,yi,default_value=npy.nan)
++
++	Examples:
++		interpdata=GridToMesh(x_m,y_m,data,md.mesh.x,md.mesh.y,0)
++	'''
++
++	if npy.ndim(x)==2:
++		x=x.reshape(-1,)
++	if npy.ndim(y)==2:
++		y=y.reshape(-1,)
++	if len(x) > data.shape[1]+1:
++		raise ValueError('x should have same length as ncols(data)+1')
++	if len(y) > data.shape[0]+1:
++		raise ValueError('y should have same length as nrows(data)+1')
++	
++	# create sub-grid that just covers the limits of xi and yi
++	dx=x[1]-x[0]
++	dy=y[1]-y[0]
++	xlim=[min(xi)-dx,max(xi)+dx]
++	ylim=[min(yi)-dy,max(yi)+dy]
++	xind=npy.nonzero(npy.logical_and(x>xlim[0],x<xlim[1]))[0]
++	yind=npy.nonzero(npy.logical_and(y>ylim[0],y<ylim[1]))[0]
++	subdata=data[yind[0]:yind[-1]+1,xind[0]:xind[-1]+1]
++
++	# create points array and flattened data array
++	xg,yg=npy.meshgrid(x[xind],y[yind])
++	points=npy.array([xg.ravel(),yg.ravel()]).T
++	flatsubdata=subdata.ravel()
++
++	# mask out any nan's in the data and corresponding coordinate points
++	mask=npy.isnan(flatsubdata)
++	ind=npy.nonzero(mask)[0]
++	if float(len(ind))/float(len(flatsubdata)) > 0.1:
++		print "WARNING: over 10% of data grid contains nan values. Spline interpolation may be questionable."
++	flatsubdata=npy.delete(flatsubdata,ind)
++	points=npy.delete(points,ind,axis=0)
++
++	# create spline and index spline at mesh points
++	spl=CloughTocher2DInterpolator(points,flatsubdata)
++	interpdata=spl(xi,yi)
++
++	return interpdata
++#}}}
++def RadialInterp(x,y,data,**kwargs):#{{{
++	'''
++	Interpolation using a radial basis function in 2 or 3 dimensions.
++	Useful for smoothing input data after interpolation.
++
++	Uses scipy.interpolate.Rbf
++
++	x,y:			data point coordinates
++	data:			data to be interpolated (same length as x,y)
++
++		function: form of radial basis function for interpolation:
++			'multiquadric': sqrt((r/self.epsilon)**2 + 1) (default)
++			'inverse': 1.0/sqrt((r/self.epsilon)**2 + 1)
++			'gaussian': exp(-(r/self.epsilon)**2)
++			'linear': r
++			'cubic': r**3
++			'quintic': r**5
++			'thin_plate': r**2 * log(r)
++		epsilon: adjustable constant for scaling radial distance.  Defaults to 
++					approximate average distance between nodes.
++		smooth: float>0, adjusts the amount of smoothing applied.  Defaults to 0,
++					such that the function always passes through nodal points.
++		z:	coordinate array if interpolating in 3 dimensions
++
++	Usage:
++		interpdata=RadialInterp(x,y,data,**kwargs)
++
++	Examples:
++		interpdata=RadialInterp(md.mesh.x,md.mesh.y,data)
++		interpdata=RadialInterp(md.mesh.x,md.mesh.y,data,function='gaussian',epsilon=100,smooth=1)
++	'''
++
++	# unpack kwargs
++	function=kwargs.pop('function','multiquadric')
++	if 'function' in kwargs: del kwargs['function']
++	epsilon=kwargs.pop('epsilon',None)
++	if 'epsilon' in kwargs: del kwargs['epsilon']
++	smooth=kwargs.pop('smooth',0)
++	if 'smooth' in kwargs: del kwargs['smooth']
++	z=kwargs.pop('z',None)
++	if 'z' in kwargs: del kwargs['z']
++	assert len(kwargs)==0, 'error, unexpected or misspelled kwargs'
++
++	if z:
++		if epsilon:
++			rbfi=Rbf(x,y,z,data,function=function,smooth=smooth,epsilon=epsilon)
++		else:
++			rbfi=Rbf(x,y,z,data,function=function,smooth=smooth)
++		interpdata=rbfi(x,y,z)
++	else:
++		if epsilon:
++			rbfi=Rbf(x,y,data,function=function,smooth=smooth,epsilon=epsilon)
++		else:
++			rbfi=Rbf(x,y,data,function=function,smooth=smooth)
++		interpdata=rbfi(x,y)
++	
++	return interpdata
++#}}}
Index: issm/oecreview/Archive/16554-17801/ISSM-17596-17597.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17596-17597.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17596-17597.diff	(revision 17802)
@@ -0,0 +1,70 @@
+Index: ../trunk-jpl/src/m/plot/processmesh.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/processmesh.py	(revision 17596)
++++ ../trunk-jpl/src/m/plot/processmesh.py	(revision 17597)
+@@ -1,5 +1,6 @@
+ from math import isnan
+ import MatlabFuncs as m
++import numpy as npy
+ 
+ def processmesh(md,data,options):
+ 	"""
+@@ -21,25 +22,21 @@
+ 		
+ 		if 'latlon' not in options.getfieldvalue('coord','xy').lower(): #convert to lower case for comparison
+ 			x=md.mesh.x
+-			if not isnan(md.mesh.x2d): x2d=md.mesh.x2d
++			if 'x2d' in dir(md.mesh): x2d=md.mesh.x2d
+ 			y=md.mesh.y
+-			if not isnan(md.mesh.y2d): y2d=md.mesh.y2d
++			if 'y2d' in dir(md.mesh): y2d=md.mesh.x2d
+ 		else:
+ 			x=md.mesh.long
+ 			y=md.mesh.lat
+ 
+-		z_field=options.getfieldvalue('z',md.mesh.z)
+-		#if isinstance(z_field,basestring): # how could z be a string?
+-		#	z=md.(z_field)
+-		if isinstance(z_field,(int,long,float)):  # isnumeric
+-			z=z_field
+-		else:
++		if 'z' in dir(md.mesh):
+ 			z=md.mesh.z
++		else:
++			z=npy.zeros_like(md.mesh.x)
+ 		
+-		if not isnan(md.mesh.elements2d): 
++		if 'elements2d' in dir(md.mesh): 
+ 			elements2d=md.mesh.elements2d
+-			elements2d=elements2d-1
+-		# subtract one since python indexes from zero
++			elements2d=elements2d-1  # subtract one since python indexes from zero
+ 		elements=md.mesh.elements
+ 		elements=elements-1
+ 
+Index: ../trunk-jpl/src/m/plot/processdata.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/processdata.py	(revision 17596)
++++ ../trunk-jpl/src/m/plot/processdata.py	(revision 17597)
+@@ -21,7 +21,7 @@
+ 		raise ValueError("processdata error message: 'data' provided is empty")
+ 
+ 	#needed later on
+-	if md.mesh.numberofvertices2d:
++	if 'numberofvertices2d' in dir(md.mesh):
+ 		numberofvertices2d=md.mesh.numberofvertices2d
+ 		numberofelements2d=md.mesh.numberofelements2d
+ 	else:
+Index: ../trunk-jpl/src/m/plot/processdata.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/processdata.m	(revision 17596)
++++ ../trunk-jpl/src/m/plot/processdata.m	(revision 17597)
+@@ -21,7 +21,7 @@
+ 	data(find(isnan(data)))=getfieldvalue(options,'nan',0);
+ end
+ 
+-%special case for mesg 2dvertical
++%special case for mesh 2dvertical
+ if strcmp(meshtype(md.mesh),'2Dvertical'),
+ 	[data datatype] = processdata(md.mesh,md,data,options);
+ 	return;
Index: issm/oecreview/Archive/16554-17801/ISSM-17597-17598.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17597-17598.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17597-17598.diff	(revision 17802)
@@ -0,0 +1,61 @@
+Index: ../trunk-jpl/src/m/interp/interp.py
+===================================================================
+--- ../trunk-jpl/src/m/interp/interp.py	(revision 17597)
++++ ../trunk-jpl/src/m/interp/interp.py	(revision 17598)
+@@ -35,14 +35,33 @@
+ 		assert type(maxiter)==int, 'error, maxiter should be an integer'
+ 	assert len(kwargs)==0, 'error, unexpected or misspelled kwargs'
+ 
+-	points=npy.array([x,y]).T
++	# create sub-vectors that just cover the limits of xi and yi
++	dx=x[1]-x[0]
++	dy=y[1]-y[0]
++	xlim=[min(xi)-dx,max(xi)+dx]
++	ylim=[min(yi)-dy,max(yi)+dy]
++	xflag=npy.logical_and(x>xlim[0],x<xlim[1])
++	yflag=npy.logical_and(y>ylim[0],y<ylim[1])
++	bothind=npy.nonzero(npy.logical_and(xflag,yflag))
++	subdata=data[bothind]
++	subx=x[bothind]
++	suby=y[bothind]
++	points=npy.array([subx,suby]).T
+ 
++	# mask out any nan's in the data and corresponding coordinate points
++	mask=npy.isnan(subdata)
++	ind=npy.nonzero(mask)[0]
++	if len(ind):
++		print "WARNING: input data grid contains nan values. Spline interpolation may be questionable."
++	subdata=npy.delete(subdata,ind)
++	points=npy.delete(points,ind,axis=0)
++
+ 	if maxiter:
+-		curvy=CloughTocher2DInterpolator(points,data,tol,maxiter=maxiter)
++		spline=CloughTocher2DInterpolator(points,subdata,tol,maxiter=maxiter)
+ 	else:
+-		curvy=CloughTocher2DInterpolator(points,data,tol)
++		spline=CloughTocher2DInterpolator(points,subdata,tol)
+ 
+-	interpdata=curvy(xi,yi)
++	interpdata=spline(xi,yi)
+ 
+ 	return interpdata
+ #}}}
+@@ -98,14 +117,14 @@
+ 	# mask out any nan's in the data and corresponding coordinate points
+ 	mask=npy.isnan(flatsubdata)
+ 	ind=npy.nonzero(mask)[0]
+-	if float(len(ind))/float(len(flatsubdata)) > 0.1:
+-		print "WARNING: over 10% of data grid contains nan values. Spline interpolation may be questionable."
++	if len(ind):
++		print "WARNING: input data grid contains nan values. Spline interpolation may be questionable."
+ 	flatsubdata=npy.delete(flatsubdata,ind)
+ 	points=npy.delete(points,ind,axis=0)
+ 
+ 	# create spline and index spline at mesh points
+-	spl=CloughTocher2DInterpolator(points,flatsubdata)
+-	interpdata=spl(xi,yi)
++	spline=CloughTocher2DInterpolator(points,flatsubdata)
++	interpdata=spline(xi,yi)
+ 
+ 	return interpdata
+ #}}}
Index: issm/oecreview/Archive/16554-17801/ISSM-17598-17599.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17598-17599.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17598-17599.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/test/NightlyRun/test426.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test426.m	(revision 17598)
++++ ../trunk-jpl/test/NightlyRun/test426.m	(revision 17599)
+@@ -4,7 +4,7 @@
+ md.initialization.vx(:)=0.;
+ md.initialization.vy(:)=0.;
+ md.geometry.base=-700.-abs(md.mesh.y-500000.)/1000.;
+-md.geometry.base=-700.-abs(md.mesh.y-500000.)/1000.;
++md.geometry.bed =-700.-abs(md.mesh.y-500000.)/1000.;
+ md.geometry.thickness(:)=1000.;
+ md.geometry.surface=md.geometry.base+md.geometry.thickness;
+ md.surfaceforcings.mass_balance(:)=100.;
Index: issm/oecreview/Archive/16554-17801/ISSM-17599-17600.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17599-17600.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17599-17600.diff	(revision 17802)
@@ -0,0 +1,507 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 17599)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 17600)
+@@ -73,11 +73,11 @@
+ 		if(iomodel->my_vertices[i]){
+ 
+ 			if (reCast<int,IssmDouble>(iomodel->Data(FlowequationBorderFSEnum)[i])){
+-				constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,0,StressbalanceVerticalAnalysisEnum)); //spc to zero as vertical velocity is done in Horiz for FS
++				constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,0,0,StressbalanceVerticalAnalysisEnum)); //spc to zero as vertical velocity is done in Horiz for FS
+ 				count++;
+ 			}
+ 			else if (!xIsNan<IssmDouble>(iomodel->Data(StressbalanceSpcvzEnum)[i])){
+-				constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,
++				constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,0,
+ 								iomodel->Data(StressbalanceSpcvzEnum)[i],StressbalanceVerticalAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+ 				count++;
+ 
+Index: ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp	(revision 17599)
++++ ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp	(revision 17600)
+@@ -395,7 +395,7 @@
+ 			for(k=0;k<numnodes;k++){
+ 				node=element->GetNode(k);
+ 				if(node->IsActive()){
+-					node->ApplyConstraint(1,lsf[k]);
++					node->ApplyConstraint(0,lsf[k]);
+ 				}
+ 			}
+ 			xDelete<IssmDouble>(lsf);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 17599)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 17600)
+@@ -113,20 +113,20 @@
+ 		if((iomodel->my_vertices[i])){
+ 			if (reCast<int,IssmDouble>(iomodel->Data(FlowequationVertexEquationEnum)[i])!=SIAApproximationEnum){
+ 
+-				constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,0,StressbalanceSIAAnalysisEnum));
++				constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,0,0,StressbalanceSIAAnalysisEnum));
+ 				count++;
+ 
+-				constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,0,StressbalanceSIAAnalysisEnum));
++				constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,0,StressbalanceSIAAnalysisEnum));
+ 				count++;
+ 			}
+ 			else{
+ 				if (!xIsNan<IssmDouble>(iomodel->Data(StressbalanceSpcvxEnum)[i])){
+-					constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,iomodel->Data(StressbalanceSpcvxEnum)[i]/yts,StressbalanceSIAAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
++					constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,0,iomodel->Data(StressbalanceSpcvxEnum)[i]/yts,StressbalanceSIAAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+ 					count++;
+ 				}
+ 
+ 				if (!xIsNan<IssmDouble>(iomodel->Data(StressbalanceSpcvyEnum)[i])){
+-					constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,iomodel->Data(StressbalanceSpcvyEnum)[i]/yts,StressbalanceSIAAnalysisEnum)); //add count'th spc, on node i+1, setting dof 2 to vy
++					constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,iomodel->Data(StressbalanceSpcvyEnum)[i]/yts,StressbalanceSIAAnalysisEnum)); //add count'th spc, on node i+1, setting dof 2 to vy
+ 					count++;
+ 				}
+ 			}
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17599)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17600)
+@@ -432,14 +432,14 @@
+ 				_error_("not supported yet");
+ 			}
+ 			if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh3DtetrasEnum){
+-				IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvxEnum,StressbalanceAnalysisEnum,finiteelement,1);
+-				IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvyEnum,StressbalanceAnalysisEnum,finiteelement,2);
+-				IoModelToConstraintsx(constraints,iomodel,spcvz,Mz,Nz,StressbalanceAnalysisEnum,finiteelement,3);
++				IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvxEnum,StressbalanceAnalysisEnum,finiteelement,0);
++				IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvyEnum,StressbalanceAnalysisEnum,finiteelement,1);
++				IoModelToConstraintsx(constraints,iomodel,spcvz,Mz,Nz,StressbalanceAnalysisEnum,finiteelement,2);
+ 				iomodel->DeleteData(spcvz,StressbalanceSpcvzEnum);
+ 			}
+ 			else if (iomodel->meshtype==Mesh2DverticalEnum){
+-				IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvxEnum,StressbalanceAnalysisEnum,finiteelement,1);
+-				IoModelToConstraintsx(constraints,iomodel,spcvz,Mz,Nz,StressbalanceAnalysisEnum,finiteelement,2);
++				IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvxEnum,StressbalanceAnalysisEnum,finiteelement,0);
++				IoModelToConstraintsx(constraints,iomodel,spcvz,Mz,Nz,StressbalanceAnalysisEnum,finiteelement,1);
+ 				iomodel->DeleteData(spcvz,StressbalanceSpcvyEnum);
+ 			}
+ 			else{
+@@ -460,7 +460,7 @@
+ 					for(i=0;i<iomodel->numberofvertices;i++){
+ 						if(iomodel->my_vertices[i]){
+ 							if(reCast<int,IssmDouble>(vertices_type[i])==NoneApproximationEnum){
+-								constraints->AddObject(new SpcStatic(count+1,iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofelements+i+1,1,g*rho_ice*(surface[i]-z[i])/FSreconditioning,StressbalanceAnalysisEnum));
++								constraints->AddObject(new SpcStatic(count+1,iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofelements+i+1,0,g*rho_ice*(surface[i]-z[i])/FSreconditioning,StressbalanceAnalysisEnum));
+ 								count++;
+ 							}
+ 						}
+@@ -470,7 +470,7 @@
+ 					for(i=0;i<iomodel->numberofvertices;i++){
+ 						if(iomodel->my_vertices[i]){
+ 							if(reCast<int,IssmDouble>(vertices_type[i])==NoneApproximationEnum){
+-								constraints->AddObject(new SpcStatic(count+1,iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofelements+i+1,1,g*rho_ice*(surface[i]-z[i])/FSreconditioning,StressbalanceAnalysisEnum));
++								constraints->AddObject(new SpcStatic(count+1,iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofelements+i+1,0,g*rho_ice*(surface[i]-z[i])/FSreconditioning,StressbalanceAnalysisEnum));
+ 								count++;
+ 							}
+ 						}
+@@ -480,7 +480,7 @@
+ 					for(i=0;i<iomodel->numberofvertices;i++){
+ 						if(iomodel->my_vertices[i]){
+ 							if(reCast<int,IssmDouble>(vertices_type[i])==NoneApproximationEnum){
+-								constraints->AddObject(new SpcStatic(count+1,iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofedges+i+1,1,g*rho_ice*(surface[i]-z[i])/FSreconditioning,StressbalanceAnalysisEnum));
++								constraints->AddObject(new SpcStatic(count+1,iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofedges+i+1,0,g*rho_ice*(surface[i]-z[i])/FSreconditioning,StressbalanceAnalysisEnum));
+ 								count++;
+ 							}
+ 						}
+@@ -497,9 +497,9 @@
+ 			iomodel->DeleteData(z,MeshZEnum);
+ 		}
+ 		else{
+-			IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvxEnum,StressbalanceAnalysisEnum,finiteelement,1);
++			IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvxEnum,StressbalanceAnalysisEnum,finiteelement,0);
+ 			if(iomodel->meshtype!=Mesh2DverticalEnum){
+-				IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvyEnum,StressbalanceAnalysisEnum,finiteelement,2);
++				IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvyEnum,StressbalanceAnalysisEnum,finiteelement,1);
+ 			}
+ 		}
+ 
+@@ -546,31 +546,31 @@
+ 			if(reCast<int,IssmDouble>(vertices_type[i]==SSAHOApproximationEnum)){
+ 				/*If grionSSA, spc HO dofs: 3 & 4*/
+ 					if (reCast<int,IssmDouble>(nodeonHO[i])){
++						constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,0,0,StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
++						count++;
+ 						constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,0,StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+ 						count++;
+-						constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,0,StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+-						count++;
+ 						if (!xIsNan<IssmDouble>(spcvx[i])){
+-							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,spcvx[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
++							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,spcvx[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+ 							count++;
+ 						}
+ 						if (!xIsNan<IssmDouble>(spcvy[i])){
+-							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,4,spcvy[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
++							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,spcvy[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+ 							count++;
+ 						}
+ 
+ 					}
+ 					else if (reCast<int,IssmDouble>(nodeonSSA[i])){
++						constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,0,StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
++						count++;
+ 						constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,0,StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+ 						count++;
+-						constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,4,0,StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+-						count++;
+ 						if (!xIsNan<IssmDouble>(spcvx[i])){
+-							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,spcvx[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
++							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,0,spcvx[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+ 							count++;
+ 						}
+ 						if (!xIsNan<IssmDouble>(spcvy[i])){
+-							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,spcvy[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
++							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,spcvy[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+ 							count++;
+ 						}
+ 
+@@ -581,37 +581,37 @@
+ 			else if (reCast<int,IssmDouble>(vertices_type[i])==HOFSApproximationEnum){
+ 				/*If grion,HO spc FS dofs: 3 4 & 5*/
+ 					if (reCast<int,IssmDouble>(nodeonHO[i])){
++						constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,0,StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
++						count++;
+ 						constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,0,StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+ 						count++;
+ 						constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,4,0,StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+ 						count++;
+-						constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,5,0,StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+-						count++;
+ 						if (!xIsNan<IssmDouble>(spcvx[i])){
+-							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,spcvx[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
++							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,0,spcvx[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+ 							count++;
+ 						}
+ 						if (!xIsNan<IssmDouble>(spcvy[i])){
+-							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,spcvy[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
++							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,spcvy[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+ 							count++;
+ 						}
+ 
+ 					}
+ 					else if (reCast<int,IssmDouble>(nodeonFS[i])){ //spc HO nodes: 1 & 2
++						constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,0,0,StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
++						count++;
+ 						constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,0,StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+ 						count++;
+-						constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,0,StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+-						count++;
+ 						if (!xIsNan<IssmDouble>(spcvx[i])){
+-							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,spcvx[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
++							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,spcvx[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+ 							count++;
+ 						}
+ 						if (!xIsNan<IssmDouble>(spcvy[i])){
+-							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,4,spcvy[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
++							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,spcvy[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+ 							count++;
+ 						}
+ 						if (!xIsNan<IssmDouble>(spcvz[i])){
+-							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,5,spcvz[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
++							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,4,spcvz[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+ 							count++;
+ 						}
+ 					}
+@@ -621,37 +621,37 @@
+ 			else if (reCast<int,IssmDouble>(vertices_type[i])==SSAFSApproximationEnum){
+ 				/*If grion,HO spc FS dofs: 3 4 & 5*/
+ 					if (reCast<int,IssmDouble>(nodeonSSA[i])){
++						constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,0,StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
++						count++;
+ 						constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,0,StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+ 						count++;
+ 						constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,4,0,StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+ 						count++;
+-						constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,5,0,StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+-						count++;
+ 						if (!xIsNan<IssmDouble>(spcvx[i])){
+-							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,spcvx[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
++							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,0,spcvx[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+ 							count++;
+ 						}
+ 						if (!xIsNan<IssmDouble>(spcvy[i])){
+-							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,spcvy[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
++							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,spcvy[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+ 							count++;
+ 						}
+ 
+ 					}
+ 					else if (reCast<int,IssmDouble>(nodeonFS[i])){ //spc SSA nodes: 1 & 2
++						constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,0,0,StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
++						count++;
+ 						constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,0,StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+ 						count++;
+-						constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,0,StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+-						count++;
+ 						if (!xIsNan<IssmDouble>(spcvx[i])){
+-							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,spcvx[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
++							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,spcvx[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+ 							count++;
+ 						}
+ 						if (!xIsNan<IssmDouble>(spcvy[i])){
+-							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,4,spcvy[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
++							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,spcvy[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+ 							count++;
+ 						}
+ 						if (!xIsNan<IssmDouble>(spcvz[i])){
+-							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,5,spcvz[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
++							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,4,spcvz[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+ 							count++;
+ 						}
+ 					}
+@@ -660,7 +660,7 @@
+ 			/*Now add the regular spcs*/
+ 			else{
+ 				if (Mx==iomodel->numberofvertices && !xIsNan<IssmDouble>(spcvx[i])){
+-					constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,spcvx[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
++					constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,0,spcvx[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+ 					count++;
+ 
+ 				}
+@@ -674,18 +674,18 @@
+ 					}
+ 
+ 					if(spcpresent){
+-						constraints->AddObject(new SpcTransient(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,Nx,timesx,values,StressbalanceAnalysisEnum));
++						constraints->AddObject(new SpcTransient(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,0,Nx,timesx,values,StressbalanceAnalysisEnum));
+ 						count++;
+ 					}
+ 					xDelete<IssmDouble>(values);
+ 				}
+ 				else if (vertices_type[i]==SIAApproximationEnum){
+-					constraints->AddObject(new SpcDynamic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,StressbalanceAnalysisEnum));
++					constraints->AddObject(new SpcDynamic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,0,StressbalanceAnalysisEnum));
+ 					count++;
+ 				}
+ 
+ 				if (My==iomodel->numberofvertices && !xIsNan<IssmDouble>(spcvy[i])){
+-					constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,spcvy[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vy.
++					constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,spcvy[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vy.
+ 					count++;
+ 				}
+ 				else if (My==iomodel->numberofvertices+1){
+@@ -697,19 +697,19 @@
+ 						if(!xIsNan<IssmDouble>(values[j]))spcpresent=true; //NaN means no spc by default
+ 					}
+ 					if(spcpresent){
+-						constraints->AddObject(new SpcTransient(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,Ny,timesy,values,StressbalanceAnalysisEnum));
++						constraints->AddObject(new SpcTransient(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,Ny,timesy,values,StressbalanceAnalysisEnum));
+ 						count++;
+ 					}
+ 					xDelete<IssmDouble>(values);
+ 				}
+ 				else if (vertices_type[i]==SIAApproximationEnum){
+-					constraints->AddObject(new SpcDynamic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,StressbalanceAnalysisEnum));
++					constraints->AddObject(new SpcDynamic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,StressbalanceAnalysisEnum));
+ 					count++;
+ 				}
+ 
+ 				if (reCast<int,IssmDouble>(vertices_type[i])==FSApproximationEnum ||  (reCast<int,IssmDouble>(vertices_type[i])==NoneApproximationEnum)){
+ 					if (Mz==iomodel->numberofvertices && !xIsNan<IssmDouble>(spcvz[i])){
+-						constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,spcvz[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 2 to vy
++						constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,spcvz[i],StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 2 to vy
+ 						count++;
+ 					}
+ 					else if (Mz==iomodel->numberofvertices+1){
+@@ -721,7 +721,7 @@
+ 							if(!xIsNan<IssmDouble>(values[j]))spcpresent=true; //NaN means no spc by default
+ 						}
+ 						if(spcpresent){
+-							constraints->AddObject(new SpcTransient(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,Nz,timesz,values,StressbalanceAnalysisEnum));
++							constraints->AddObject(new SpcTransient(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,Nz,timesz,values,StressbalanceAnalysisEnum));
+ 							count++;
+ 						}
+ 						xDelete<IssmDouble>(values);
+@@ -729,7 +729,7 @@
+ 
+ 				}
+ 				if (reCast<int,IssmDouble>(vertices_type[i])==NoneApproximationEnum){
+-					constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+i+1,1,g*rho_ice*(surface[i]-z[i])/FSreconditioning,StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 2 to vy
++					constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+i+1,0,g*rho_ice*(surface[i]-z[i])/FSreconditioning,StressbalanceAnalysisEnum)); //add count'th spc, on node i+1, setting dof 2 to vy
+ 					count++;
+ 				}
+ 			}
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17599)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17600)
+@@ -133,7 +133,7 @@
+ 
+ 				if (!xIsNan<IssmDouble>(spcvector[i])){
+ 
+-					constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,heatcapacity*(spcvector[i]-referencetemperature),EnthalpyAnalysisEnum));
++					constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,0,heatcapacity*(spcvector[i]-referencetemperature),EnthalpyAnalysisEnum));
+ 					count++;
+ 
+ 				}
+@@ -166,7 +166,7 @@
+ 				}
+ 
+ 				if(spcpresent){
+-					constraints->AddObject(new SpcTransient(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,N,times,values,EnthalpyAnalysisEnum));
++					constraints->AddObject(new SpcTransient(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,0,N,times,values,EnthalpyAnalysisEnum));
+ 					count++;
+ 				}
+ 				xDelete<IssmDouble>(values);
+@@ -1200,8 +1200,8 @@
+ 			setspc = false;
+ 
+ 		node=element->GetNode(indices[i]);
+-		if (setspc) 
+-			node->ApplyConstraint(1,h_pmp); /*apply spc*/ 
++		if(setspc) 
++			node->ApplyConstraint(0,h_pmp); /*apply spc*/ 
+ 		else			
+ 			node->DofInFSet(0); /*remove spc*/ 
+ 	}
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17599)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17600)
+@@ -387,8 +387,11 @@
+ 				groundedice_input->GetInputValue(&phi,gauss);
+ 				if(phi>=0.){
+ 					base_input->GetInputValue(&base,gauss);
+-					element->nodes[iv]->ApplyConstraint(1,base);
++					element->nodes[iv]->ApplyConstraint(0,base);
+ 				}
++				else{
++					element->nodes[iv]->DofInFSet(0);
++				}
+ 			}
+ 		}
+ 		delete gauss;
+Index: ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17599)
++++ ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17600)
+@@ -333,7 +333,7 @@
+ 			if(phi<=0.){
+ 				/* if ice, set dirichlet BC */
+ 				extvar_input->GetInputValue(&value,gauss);
+-				node->ApplyConstraint(1,value);
++				node->ApplyConstraint(0,value);
+ 			}
+ 			else {
+ 				/* no ice, set no spc */
+Index: ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.h	(revision 17599)
++++ ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.h	(revision 17600)
+@@ -7,7 +7,7 @@
+ #include "../../classes/classes.h"
+ 
+ /* local prototypes: */
+-void IoModelToConstraintsx(Constraints* constraints,IoModel* iomodel,int vector_enum,int analysis_type,int finite_element,int dof=1);
+-void IoModelToConstraintsx(Constraints* constraints,IoModel* iomodel,IssmDouble* spcdata,int M,int N,int analysis_type,int finite_element,int dof=1);
++void IoModelToConstraintsx(Constraints* constraints,IoModel* iomodel,int vector_enum,int analysis_type,int finite_element,int dof=0);
++void IoModelToConstraintsx(Constraints* constraints,IoModel* iomodel,IssmDouble* spcdata,int M,int N,int analysis_type,int finite_element,int dof=0);
+ 
+ #endif  /* _IOMODELTOELEMENTINPUTX_H */
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17599)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17600)
+@@ -2001,7 +2001,7 @@
+ 		onbed->GetInputValue(&isonbed,gauss);
+ 		if(isonbed==1.){
+ 			input->GetInputValue(&value,gauss);
+-			this->nodes[iv]->ApplyConstraint(1,value);
++			this->nodes[iv]->ApplyConstraint(0,value);
+ 		}
+ 	}
+ 	delete gauss;
+@@ -2025,7 +2025,7 @@
+ 	for(int i=0;i<2;i++){
+ 		gauss->GaussNode(P1Enum,indices[i]);
+ 		input->GetInputValue(&value,gauss);
+-		this->nodes[indices[i]]->ApplyConstraint(1,value);
++		this->nodes[indices[i]]->ApplyConstraint(0,value);
+ 	}
+ 	delete gauss;
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17599)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17600)
+@@ -2504,7 +2504,7 @@
+ 		onbed->GetInputValue(&isonbed,gauss);
+ 		if(isonbed==1.){
+ 			input->GetInputValue(&value,gauss);
+-			this->nodes[iv]->ApplyConstraint(1,value);
++			this->nodes[iv]->ApplyConstraint(0,value);
+ 		}
+ 	}
+ 	delete gauss;
+@@ -2527,7 +2527,7 @@
+ 	for(int i=0;i<3;i++){
+ 		gauss->GaussNode(P1Enum,indices[i]);
+ 		input->GetInputValue(&value,gauss);
+-		this->nodes[indices[i]]->ApplyConstraint(1,value);
++		this->nodes[indices[i]]->ApplyConstraint(0,value);
+ 	}
+ 	delete gauss;
+ 
+Index: ../trunk-jpl/src/c/classes/Node.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Node.cpp	(revision 17599)
++++ ../trunk-jpl/src/c/classes/Node.cpp	(revision 17600)
+@@ -77,7 +77,7 @@
+ 			}
+ 			if(in_approximation==SSAFSApproximationEnum && reCast<int>(iomodel->Data(FlowequationBorderSSAEnum)[io_index])){
+ 				if(!reCast<int>(iomodel->Data(MeshVertexonbedEnum)[io_index])){
+-					for(k=1;k<=2;k++) this->FreezeDof(k);
++					for(k=0;k<=1;k++) this->FreezeDof(k);
+ 				}
+ 			}
+ 		}
+@@ -382,8 +382,8 @@
+ 
+ 	/*Dof should be added in the s set, describing which 
+ 	 * dofs are constrained to a certain value (dirichlet boundary condition*/
+-	DofInSSet(dof-1);
+-	this->indexing.svalues[dof-1]=value;
++	DofInSSet(dof);
++	this->indexing.svalues[dof]=value;
+ }
+ /*}}}*/
+ /*FUNCTION Node::RequiresDofReindexing{{{*/
+@@ -404,8 +404,8 @@
+ void  Node::RelaxConstraint(int dof){
+ 
+ 	/*Dof should be added to the f-set, and taken out of the s-set:*/
+-	DofInFSet(dof-1);
+-	this->indexing.svalues[dof-1]=0.;
++	DofInFSet(dof);
++	this->indexing.svalues[dof]=0.;
+ }
+ /*}}}*/
+ /*FUNCTION Node::CreateNodalConstraints{{{*/
+@@ -467,7 +467,7 @@
+ /*FUNCTION Node::FreezeDof{{{*/
+ void  Node::FreezeDof(int dof){
+ 
+-	DofInSSet(dof-1); //with 0 displacement for this dof.
++	DofInSSet(dof); //with 0 displacement for this dof.
+ 
+ }
+ /*}}}*/
+Index: ../trunk-jpl/src/c/classes/Constraints/SpcDynamic.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Constraints/SpcDynamic.cpp	(revision 17599)
++++ ../trunk-jpl/src/c/classes/Constraints/SpcDynamic.cpp	(revision 17600)
+@@ -123,7 +123,7 @@
+ 	int pos;
+ 
+ 	Node* node=(Node*)nodes->GetObjectById(NULL,nodeid);
+-	pos=node->GetDof(dof-1,GsetEnum);
++	pos=node->GetDof(dof,GsetEnum);
+ 
+ 	this->value=yg_serial[pos];
+ 	this->isset=true;
Index: issm/oecreview/Archive/16554-17801/ISSM-17600-17601.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17600-17601.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17600-17601.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/test/NightlyRun/test237.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test237.py	(revision 17600)
++++ ../trunk-jpl/test/NightlyRun/test237.py	(revision 17601)
+@@ -44,7 +44,7 @@
+ itemp=numpy.arange(0,md.timestepping.final_time,md.timestepping.time_step)
+ md.thermal.spctemperature=numpy.vstack((md.thermal.spctemperature,itemp.reshape(1,-1)))
+ 
+-md.initialization.temperature=md.surfaceforcings.temperatures_lgm[0:md.mesh.numberofvertices,0]    #*ones(md.mesh.numberofvertices,1)
++md.initialization.temperature=md.surfaceforcings.temperatures_lgm[0:md.mesh.numberofvertices,0].reshape(-1,1)   #*ones(md.mesh.numberofvertices,1)
+ 
+ # creating precipitation
+ md.surfaceforcings.precipitations_presentday=numpy.zeros((md.mesh.numberofvertices+1,12))
Index: issm/oecreview/Archive/16554-17801/ISSM-17601-17602.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17601-17602.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17601-17602.diff	(revision 17802)
@@ -0,0 +1,113 @@
+Index: ../trunk-jpl/src/m/parameterization/contourenvelope.py
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/contourenvelope.py	(revision 17601)
++++ ../trunk-jpl/src/m/parameterization/contourenvelope.py	(revision 17602)
+@@ -45,47 +45,47 @@
+ 		[md.mesh.elementconnectivity]=ElementConnectivity(md.mesh.elements,md.mesh.vertexconnectivity)
+ 
+ 	#get nodes inside profile
+-	mesh.elementconnectivity=copy.deepcopy(md.mesh.elementconnectivity)
++	elementconnectivity=copy.deepcopy(md.mesh.elementconnectivity)
+ 	if m.strcmp(md.mesh.meshtype(),'2Dhorizontal'):
+-		mesh.elements=copy.deepcopy(md.mesh.elements)
+-		mesh.x=copy.deepcopy(md.mesh.x)
+-		mesh.y=copy.deepcopy(md.mesh.y)
+-		mesh.numberofvertices=copy.deepcopy(md.mesh.numberofvertices)
+-		mesh.numberofelements=copy.deepcopy(md.mesh.numberofelements)
++		elements=copy.deepcopy(md.mesh.elements)
++		x=copy.deepcopy(md.mesh.x)
++		y=copy.deepcopy(md.mesh.y)
++		numberofvertices=copy.deepcopy(md.mesh.numberofvertices)
++		numberofelements=copy.deepcopy(md.mesh.numberofelements)
+ 	else:
+-		mesh.elements=copy.deepcopy(md.mesh.elements2d)
+-		mesh.x=copy.deepcopy(md.mesh.x2d)
+-		mesh.y=copy.deepcopy(md.mesh.y2d)
+-		mesh.numberofvertices=copy.deepcopy(md.mesh.numberofvertices2d)
+-		mesh.numberofelements=copy.deepcopy(md.mesh.numberofelements2d)
++		elements=copy.deepcopy(md.mesh.elements2d)
++		x=copy.deepcopy(md.mesh.x2d)
++		y=copy.deepcopy(md.mesh.y2d)
++		numberofvertices=copy.deepcopy(md.mesh.numberofvertices2d)
++		numberofelements=copy.deepcopy(md.mesh.numberofelements2d)
+ 
+ 	if len(args)==1:
+ 
+ 		if isfile:
+ 			#get flag list of elements and nodes inside the contour
+-			nodein=ContourToMesh(mesh.elements,mesh.x,mesh.y,file,'node',1)
+-			elemin=(numpy.sum(nodein(mesh.elements),axis=1)==numpy.size(mesh.elements,axis=1))
++			nodein=ContourToMesh(elements,x,y,file,'node',1)
++			elemin=(numpy.sum(nodein(elements),axis=1)==numpy.size(elements,axis=1))
+ 			#modify element connectivity
+ 			elemout=numpy.nonzero(numpy.logical_not(elemin))[0]
+-			mesh.elementconnectivity[elemout,:]=0
+-			mesh.elementconnectivity[numpy.nonzero(m.ismember(mesh.elementconnectivity,elemout+1))]=0
++			elementconnectivity[elemout,:]=0
++			elementconnectivity[numpy.nonzero(m.ismember(elementconnectivity,elemout+1))]=0
+ 		else:
+ 			#get flag list of elements and nodes inside the contour
+-			nodein=numpy.zeros(mesh.numberofvertices)
+-			elemin=numpy.zeros(mesh.numberofelements)
++			nodein=numpy.zeros(numberofvertices)
++			elemin=numpy.zeros(numberofelements)
+ 
+ 			pos=numpy.nonzero(flags)
+ 			elemin[pos]=1
+-			nodein[mesh.elements[pos,:]-1]=1
++			nodein[elements[pos,:]-1]=1
+ 
+ 			#modify element connectivity
+ 			elemout=numpy.nonzero(numpy.logical_not(elemin))[0]
+-			mesh.elementconnectivity[elemout,:]=0
+-			mesh.elementconnectivity[numpy.nonzero(m.ismember(mesh.elementconnectivity,elemout+1))]=0
++			elementconnectivity[elemout,:]=0
++			elementconnectivity[numpy.nonzero(m.ismember(elementconnectivity,elemout+1))]=0
+ 
+ 	#Find element on boundary
+ 	#First: find elements on the boundary of the domain
+-	flag=copy.deepcopy(mesh.elementconnectivity)
++	flag=copy.deepcopy(elementconnectivity)
+ 	if len(args)==1:
+ 		flag[numpy.nonzero(flag)]=elemin[flag[numpy.nonzero(flag)]]
+ 	elementonboundary=numpy.logical_and(numpy.prod(flag,axis=1)==0,numpy.sum(flag,axis=1)>0)
+@@ -97,15 +97,15 @@
+ 	count=0
+ 
+ 	for el1 in pos:
+-		els2=mesh.elementconnectivity[el1,numpy.nonzero(mesh.elementconnectivity[el1,:])[0]]-1
++		els2=elementconnectivity[el1,numpy.nonzero(elementconnectivity[el1,:])[0]]-1
+ 		if numpy.size(els2)>1:
+-			flag=numpy.intersect1d(numpy.intersect1d(mesh.elements[els2[0],:],mesh.elements[els2[1],:]),mesh.elements[el1,:])
+-			nods1=mesh.elements[el1,:]
++			flag=numpy.intersect1d(numpy.intersect1d(elements[els2[0],:],elements[els2[1],:]),elements[el1,:])
++			nods1=elements[el1,:]
+ 			nods1=numpy.delete(nods1,numpy.nonzero(nods1==flag))
+ 			segments[count,:]=[nods1[0],nods1[1],el1+1]
+ 
+-			ord1=numpy.nonzero(nods1[0]==mesh.elements[el1,:])[0][0]
+-			ord2=numpy.nonzero(nods1[1]==mesh.elements[el1,:])[0][0]
++			ord1=numpy.nonzero(nods1[0]==elements[el1,:])[0][0]
++			ord2=numpy.nonzero(nods1[1]==elements[el1,:])[0][0]
+ 
+ 			#swap segment nodes if necessary
+ 			if ( (ord1==0 and ord2==1) or (ord1==1 and ord2==2) or (ord1==2 and ord2==0) ):
+@@ -115,14 +115,14 @@
+ 			segments[count,0:2]=numpy.flipud(segments[count,0:2])
+ 			count+=1
+ 		else:
+-			nods1=mesh.elements[el1,:]
+-			flag=numpy.setdiff1d(nods1,mesh.elements[els2,:])
++			nods1=elements[el1,:]
++			flag=numpy.setdiff1d(nods1,elements[els2,:])
+ 			for j in xrange(0,3):
+ 				nods=numpy.delete(nods1,j)
+ 				if numpy.any(m.ismember(flag,nods)):
+ 					segments[count,:]=[nods[0],nods[1],el1+1]
+-					ord1=numpy.nonzero(nods[0]==mesh.elements[el1,:])[0][0]
+-					ord2=numpy.nonzero(nods[1]==mesh.elements[el1,:])[0][0]
++					ord1=numpy.nonzero(nods[0]==elements[el1,:])[0][0]
++					ord2=numpy.nonzero(nods[1]==elements[el1,:])[0][0]
+ 					if ( (ord1==0 and ord2==1) or (ord1==1 and ord2==2) or (ord1==2 and ord2==0) ):
+ 						temp=segments[count,0]
+ 						segments[count,0]=segments[count,1]
Index: issm/oecreview/Archive/16554-17801/ISSM-17602-17603.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17602-17603.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17602-17603.diff	(revision 17802)
@@ -0,0 +1,74 @@
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp	(revision 17602)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp	(revision 17603)
+@@ -10,13 +10,14 @@
+ void solutionsequence_la_theta(FemModel* femmodel){
+ 
+ 	/*intermediary: */
+-	Matrix<IssmDouble>*  Kff = NULL;
+-	Matrix<IssmDouble>*  Kfs = NULL;
+-	Vector<IssmDouble>*  ug  = NULL;
+-	Vector<IssmDouble>*  uf  = NULL;
+-	Vector<IssmDouble>*  pf  = NULL;
+-	Vector<IssmDouble>*  df  = NULL;
+-	Vector<IssmDouble>*  ys  = NULL;
++	Matrix<IssmDouble>*  Kff    = NULL;
++	Matrix<IssmDouble>*  Kfs    = NULL;
++	Vector<IssmDouble>*  ug_old = NULL;
++	Vector<IssmDouble>*  ug     = NULL;
++	Vector<IssmDouble>*  uf     = NULL;
++	Vector<IssmDouble>*  pf     = NULL;
++	Vector<IssmDouble>*  df     = NULL;
++	Vector<IssmDouble>*  ys     = NULL;
+ 	int  configuration_type;
+ 
+ 	/*Create analysis*/
+@@ -30,11 +31,16 @@
+ 	analysis->InitializeXTH(femmodel->elements,femmodel->parameters);
+ 
+ 	/*Convergence criterion*/
+-	int count = 0;
+-	femmodel->parameters->SetParam(reCast<IssmDouble>(10.),AugmentedLagrangianREnum);
++	int        count   = 0;
++	IssmDouble eps_rel = .001;
++	femmodel->parameters->SetParam(0.6,AugmentedLagrangianREnum);
++	GetSolutionFromInputsx(&ug,femmodel);
+ 
+ 	while(true){
+ 
++		/*save pointer to old velocity*/
++		delete ug_old;ug_old=ug;
++
+ 		/*Solve KU=F*/
+ 		SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
+ 		CreateNodalConstraintsx(&ys,femmodel->nodes,configuration_type);
+@@ -50,13 +56,24 @@
+ 		/*Update d and tau accordingly*/
+ 		analysis->InputUpdateFromSolutionFSXTH(femmodel->elements,femmodel->parameters);
+ 
++		/*Check for convergence*/
++		Vector<IssmDouble>* dug=ug_old->Duplicate(); ug_old->Copy(dug); dug->AYPX(ug,-1.0);
++		IssmDouble ndu=dug->Norm(NORM_TWO);   delete dug;
++		IssmDouble nu =ug_old->Norm(NORM_TWO);
++		if (xIsNan<IssmDouble>(ndu) || xIsNan<IssmDouble>(nu)) _error_("convergence criterion is NaN!");
++		if((ndu/nu)<eps_rel){
++			if(VerboseConvergence()) _printf0_(setw(50) << left << "   Convergence criterion: norm(du)/norm(u)" << ndu/nu*100 << " < " << eps_rel*100 << " %\n");
++			break;
++		}
++		else{ 
++			if(VerboseConvergence()) _printf0_(setw(50) << left << "   Convergence criterion: norm(du)/norm(u)" << ndu/nu*100 << " > " << eps_rel*100 << " %\n");
++		}
++
+ 		count++;
+-		if(count>5) break;
++		if(count>20) break;
+ 	}
+ 
+-	/*Check for convergence*/
+-	//_error_("STOP");
+-
+ 	delete ug;  
++	delete ug_old;  
+ 	delete analysis;
+ }
Index: issm/oecreview/Archive/16554-17801/ISSM-17603-17604.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17603-17604.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17603-17604.diff	(revision 17802)
@@ -0,0 +1,30 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17603)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17604)
+@@ -4218,20 +4218,11 @@
+ 	if(dim==3) element->InputChangeName(VzEnum,VzPicardEnum);
+ 
+ 	/*Add vx and vy as inputs to the tria element: */
+-	if(results_on_nodes){
+-		element->AddInput(VxEnum,      vx,      element->VelocityInterpolation());
+-		element->AddInput(VyEnum,      vy,      element->VelocityInterpolation());
+-		element->AddInput(VelEnum,     vel,     element->VelocityInterpolation());
+-		element->AddInput(PressureEnum,pressure,element->PressureInterpolation());
+-		if(dim==3) element->AddInput(VzEnum,vz, element->VelocityInterpolation());
+-	}
+-	else{
+-		element->AddInput(VxEnum,vx,P1Enum);
+-		element->AddInput(VyEnum,vy,P1Enum);
+-		element->AddInput(VelEnum,vel,P1Enum);
+-		element->AddInput(PressureEnum,pressure,P1Enum);
+-		if(dim==3) element->AddInput(VzEnum,vz,P1Enum);
+-	}
++	element->AddInput(VxEnum,      vx,      element->VelocityInterpolation());
++	element->AddInput(VyEnum,      vy,      element->VelocityInterpolation());
++	element->AddInput(VelEnum,     vel,     element->VelocityInterpolation());
++	element->AddInput(PressureEnum,pressure,element->PressureInterpolation());
++	if(dim==3) element->AddInput(VzEnum,vz, element->VelocityInterpolation());
+ 
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(pressure);
Index: issm/oecreview/Archive/16554-17801/ISSM-17604-17605.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17604-17605.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17604-17605.diff	(revision 17802)
@@ -0,0 +1,39 @@
+Index: ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 17604)
++++ ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 17605)
+@@ -334,18 +334,23 @@
+ 	/*Check that input provided is a thickness*/
+ 	if (thickness_input->InstanceEnum()!=ThicknessEnum) _error_("Input provided is not a Thickness (enum_type is " << EnumToStringx(thickness_input->InstanceEnum()) << ")");
+ 
+-	/*vertically integrate depending on type:*/
++	/*vertically integrate depending on type (and use P1 interpolation from now on)*/
+ 	switch(this->element_type){
+-		case P1Enum: {
+-			GaussPenta *gauss=new GaussPenta();
+-			for(int iv=0;iv<3;iv++){
+-				gauss->GaussVertex(iv);
+-				thickness_input->GetInputValue(&thickness,gauss);
+-				this->values[iv]=0.5*(this->values[iv]+this->values[iv+3]) * thickness;
+-				this->values[iv+3]=this->values[iv];
+-			}
+-			delete gauss;
+-			return; }
++		case P1Enum:
++		case P1bubbleEnum:
++		case P2Enum:
++			  {
++				this->element_type=P1Enum;
++				GaussPenta *gauss=new GaussPenta();
++				for(int iv=0;iv<3;iv++){
++					gauss->GaussVertex(iv);
++					thickness_input->GetInputValue(&thickness,gauss);
++					this->values[iv]=0.5*(this->values[iv]+this->values[iv+3]) * thickness;
++					this->values[iv+3]=this->values[iv];
++				}
++				delete gauss;
++				return; 
++			  }
+ 		default:
+ 			_error_("not supported yet for type "<<EnumToStringx(this->element_type));
+ 	}
Index: issm/oecreview/Archive/16554-17801/ISSM-17605-17606.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17605-17606.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17605-17606.diff	(revision 17802)
@@ -0,0 +1,64 @@
+Index: ../trunk-jpl/test/Archives/Archive221.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive510.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive322.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive215.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive204.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive290.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive507.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive421.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive308.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive511.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive404.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive211.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive104.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive220.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive422.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive503.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17606-17607.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17606-17607.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17606-17607.diff	(revision 17802)
@@ -0,0 +1,20 @@
+Index: ../trunk-jpl/test/Archives/Archive703.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive701.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive211.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive124.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive702.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17607-17608.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17607-17608.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17607-17608.diff	(revision 17802)
@@ -0,0 +1,21 @@
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17607)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17608)
+@@ -1077,7 +1077,7 @@
+ 	/* Feed updated water column back into model */
+ 	element->AddInput(WatercolumnEnum,watercolumn,P1Enum);
+ 
+-	delete pairindices;
++	xDelete<int>(pairindices);
+ 	xDelete<IssmDouble>(drainrate_column);
+ 	xDelete<IssmDouble>(drainrate_element);
+ 	xDelete<IssmDouble>(watercolumn);
+@@ -1136,6 +1136,7 @@
+ 	}
+ 
+ 	/*Clean up and return*/
++	xDelete<int>(pairindices);
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(enthalpies);
+ 	xDelete<IssmDouble>(pressures);
Index: issm/oecreview/Archive/16554-17801/ISSM-17608-17609.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17608-17609.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17608-17609.diff	(revision 17802)
@@ -0,0 +1,203 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17608)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17609)
+@@ -559,7 +559,7 @@
+ 				}
+ 			}
+ 		}
+-		element->AddInput(HydrologydcEplThicknessEnum,thickness,P1Enum);
++		element->AddInput(HydrologydcEplThicknessEnum,thickness,element->GetElementType());
+ 		xDelete<IssmDouble>(thickness);
+ 		xDelete<IssmDouble>(eplhead);
+ 		xDelete<IssmDouble>(epl_slopeX);
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 17608)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 17609)
+@@ -922,8 +922,8 @@
+ 	}
+ 
+ 	/*Add vx and vy as inputs to the tria element: */
+-	element->AddInput(AdjointxEnum,lambdax,P1Enum);
+-	element->AddInput(AdjointyEnum,lambday,P1Enum);
++	element->AddInput(AdjointxEnum,lambdax,element->GetElementType());
++	element->AddInput(AdjointyEnum,lambday,element->GetElementType());
+ 
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(values);
+@@ -980,10 +980,10 @@
+ 	for(i=0;i<pnumnodes;i++) lambdap[i]=lambdap[i]*FSreconditioning;
+ 
+ 	/*Add vx and vy as inputs to the tria element: */
+-	element->AddInput(AdjointxEnum,lambdax,P1Enum);
+-	element->AddInput(AdjointyEnum,lambday,P1Enum);
+-	element->AddInput(AdjointzEnum,lambdaz,P1Enum);
+-	element->AddInput(AdjointpEnum,lambdap,P1Enum);
++	element->AddInput(AdjointxEnum,lambdax,element->VelocityInterpolation());
++	element->AddInput(AdjointyEnum,lambday,element->VelocityInterpolation());
++	element->AddInput(AdjointzEnum,lambdaz,element->VelocityInterpolation());
++	element->AddInput(AdjointpEnum,lambdap,element->PressureInterpolation());
+ 
+ 	/*Free ressources:*/
+ 	xDelete<int>(vdoflist);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 17608)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 17609)
+@@ -442,7 +442,7 @@
+ 
+ 	if(approximation!=HOFSApproximationEnum && approximation!=SSAFSApproximationEnum){
+ 		element->InputChangeName(PressureEnum,PressurePicardEnum);
+-		element->AddInput(PressureEnum,pressure,P1Enum);
++		element->AddInput(PressureEnum,pressure,element->GetElementType());
+ 	}
+ 	else if(approximation==HOFSApproximationEnum){
+ 		element->AddInput(VzHOEnum,vzHO,P1Enum);
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 17608)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 17609)
+@@ -309,7 +309,7 @@
+ 	}
+ 
+ 	/*Add input to the element: */
+-	element->AddInput(WatercolumnEnum,values,P1Enum);
++	element->AddInput(WatercolumnEnum,values,element->GetElementType());
+ 
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(values);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17608)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17609)
+@@ -1742,9 +1742,9 @@
+ 	if(dim==2)element->InputChangeName(VyEnum,VyPicardEnum);
+ 
+ 	/*Add vx and vy as inputs to the tria element: */
+-	element->AddBasalInput(VxEnum,vx,P1Enum);
+-	if(dim==2)element->AddBasalInput(VyEnum,vy,P1Enum);
+-	element->AddBasalInput(VelEnum,vel,P1Enum);
++	element->AddBasalInput(VxEnum,vx,element->GetElementType());
++	if(dim==2)element->AddBasalInput(VyEnum,vy,element->GetElementType());
++	element->AddBasalInput(VelEnum,vel,element->GetElementType());
+ 
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(vel);
+@@ -2062,9 +2062,9 @@
+ 	element->InputChangeName(VyEnum,VyPicardEnum);
+ 
+ 	/*Add vx and vy as inputs to the tria element: */
+-	element->AddBasalInput(VxEnum,vx,P1Enum);
+-	element->AddBasalInput(VyEnum,vy,P1Enum);
+-	element->AddBasalInput(VelEnum,vel,P1Enum);
++	element->AddBasalInput(VxEnum,vx,element->GetElementType());
++	element->AddBasalInput(VyEnum,vy,element->GetElementType());
++	element->AddBasalInput(VelEnum,vel,element->GetElementType());
+ 
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(vel);
+@@ -2739,9 +2739,9 @@
+ 	//element->AddInput(VxEnum,  vx,element->GetElementType());
+ 	//element->AddInput(VyEnum,  vy,element->GetElementType());
+ 	//element->AddInput(VelEnum,vel,element->GetElementType());
+-	element->AddInput(VxEnum,vx,P1Enum);
+-	if(dim==3)element->AddInput(VyEnum,vy,P1Enum);
+-	element->AddInput(VelEnum,vel,P1Enum);
++	element->AddInput(VxEnum,vx,element->GetElementType());
++	if(dim==3)element->AddInput(VyEnum,vy,element->GetElementType());
++	element->AddInput(VelEnum,vel,element->GetElementType());
+ 
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(vel);
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17608)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17609)
+@@ -672,7 +672,7 @@
+ 	/*Get all inputs and parameters*/
+ 	element->GetInputValue(&converged,ConvergedEnum);
+ 	if(converged){
+-		element->AddInput(TemperatureEnum,values,P1Enum);
++		element->AddInput(TemperatureEnum,values,element->GetElementType());
+ 
+ 		/*Update Rheology only if converged (we must make sure that the temperature is below melting point
+ 		 * otherwise the rheology could be negative*/
+@@ -684,16 +684,16 @@
+ 				break;
+ 			case CuffeyEnum:
+ 				for(i=0;i<numnodes;i++) B[i]=Cuffey(values[i]);
+-				element->AddInput(MaterialsRheologyBEnum,&B[0],P1Enum);
++				element->AddInput(MaterialsRheologyBEnum,&B[0],element->GetElementType());
+ 				break;
+ 			case PatersonEnum:
+ 				for(i=0;i<numnodes;i++) B[i]=Paterson(values[i]);
+-				element->AddInput(MaterialsRheologyBEnum,&B[0],P1Enum);
++				element->AddInput(MaterialsRheologyBEnum,&B[0],element->GetElementType());
+ 				break;
+ 			case ArrheniusEnum:{
+ 				element->GetVerticesCoordinates(&xyz_list);
+ 				for(i=0;i<numnodes;i++) B[i]=Arrhenius(values[i],surface[i]-xyz_list[i*3+2],element->GetMaterialParameter(MaterialsRheologyNEnum));
+-				element->AddInput(MaterialsRheologyBEnum,&B[0],P1Enum);
++				element->AddInput(MaterialsRheologyBEnum,&B[0],element->GetElementType());
+ 				break;
+ 				}
+ 			default:
+@@ -701,7 +701,7 @@
+ 		}
+ 	}
+ 	else{
+-		element->AddInput(TemperaturePicardEnum,values,P1Enum);
++		element->AddInput(TemperaturePicardEnum,values,element->GetElementType());
+ 	}
+ 
+ 	/*Free ressources:*/
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17608)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17609)
+@@ -801,9 +801,9 @@
+ 			if(waterfraction[i]<0.) _error_("Negative water fraction found in solution vector");
+ 			//if(waterfraction[i]>1.) _error_("Water fraction >1 found in solution vector");
+ 		}
+-		element->AddInput(EnthalpyEnum,values,P1Enum);
+-		element->AddInput(WaterfractionEnum,waterfraction,P1Enum);
+-		element->AddInput(TemperatureEnum,temperature,P1Enum);
++		element->AddInput(EnthalpyEnum,values,element->GetElementType());
++		element->AddInput(WaterfractionEnum,waterfraction,element->GetElementType());
++		element->AddInput(TemperatureEnum,temperature,element->GetElementType());
+ 
+ 		/*Update Rheology only if converged (we must make sure that the temperature is below melting point
+ 		 * otherwise the rheology could be negative*/
+@@ -815,26 +815,26 @@
+ 				break;
+ 			case CuffeyEnum:
+ 				for(i=0;i<numnodes;i++) B[i]=Cuffey(temperature[i]);
+-				element->AddInput(MaterialsRheologyBEnum,&B[0],P1Enum);
++				element->AddInput(MaterialsRheologyBEnum,&B[0],element->GetElementType());
+ 				break;
+ 			case PatersonEnum:
+ 				for(i=0;i<numnodes;i++) B[i]=Paterson(temperature[i]);
+-				element->AddInput(MaterialsRheologyBEnum,&B[0],P1Enum);
++				element->AddInput(MaterialsRheologyBEnum,&B[0],element->GetElementType());
+ 				break;
+ 			case ArrheniusEnum:
+ 				element->GetVerticesCoordinates(&xyz_list);
+ 				for(i=0;i<numnodes;i++) B[i]=Arrhenius(temperature[i],surface[i]-xyz_list[i*3+2],element->GetMaterialParameter(MaterialsRheologyNEnum));
+-				element->AddInput(MaterialsRheologyBEnum,&B[0],P1Enum);
++				element->AddInput(MaterialsRheologyBEnum,&B[0],element->GetElementType());
+ 				break;
+ 			case LliboutryDuvalEnum:
+ 				for(i=0;i<numnodes;i++) B[i]=LliboutryDuval(values[i],pressure[i],element->GetMaterialParameter(MaterialsRheologyNEnum),element->GetMaterialParameter(MaterialsBetaEnum),element->GetMaterialParameter(ConstantsReferencetemperatureEnum),element->GetMaterialParameter(MaterialsHeatcapacityEnum),element->GetMaterialParameter(MaterialsLatentheatEnum)); 
+-				element->AddInput(MaterialsRheologyBEnum,&B[0],P1Enum); 
++				element->AddInput(MaterialsRheologyBEnum,&B[0],element->GetElementType()); 
+ 				break; 
+ 			default: _error_("Rheology law " << EnumToStringx(rheology_law) << " not supported yet");
+ 		}
+ 	}
+ 	else{
+-		element->AddInput(EnthalpyPicardEnum,values,P1Enum);
++		element->AddInput(EnthalpyPicardEnum,values,element->GetElementType());
+ 	}
+ 
+ 	/*Free ressources:*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17609-17610.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17609-17610.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17609-17610.diff	(revision 17802)
@@ -0,0 +1,2075 @@
+Index: ../trunk-jpl/test/NightlyRun/test703.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test703.m	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test703.m	(revision 17610)
+@@ -46,7 +46,7 @@
+ md.surfaceforcings.mass_balance=zeros(md.mesh.numberofvertices,1);
+ md.basalforcings.melting_rate=zeros(md.mesh.numberofvertices,1);
+ md.basalforcings.geothermalflux=zeros(md.mesh.numberofvertices,1);
+-posb=find((md.mesh.x>0) & md.mesh.vertexonbed);
++posb=find((md.mesh.x>0) & md.mesh.vertexonbase);
+ md.basalforcings.melting_rate(posb)=18;
+ md.initialization.vx=zeros(md.mesh.numberofvertices,1);
+ md.initialization.vy=zeros(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/test/NightlyRun/test1205.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1205.py	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test1205.py	(revision 17610)
+@@ -34,7 +34,7 @@
+ md=setflowequation(md,'SIA','all')
+ 
+ #Spc the nodes on the bed
+-pos=numpy.nonzero(md.mesh.vertexonbed)
++pos=numpy.nonzero(md.mesh.vertexonbase)
+ md.stressbalance.spcvx[pos]=0.
+ md.stressbalance.spcvy[pos]=0.
+ md.stressbalance.spcvz[pos]=0.
+Index: ../trunk-jpl/test/NightlyRun/test1104.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1104.m	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test1104.m	(revision 17610)
+@@ -20,7 +20,7 @@
+ 	md.stressbalance.spcvy=NaN*ones(md.mesh.numberofvertices,1);
+ 	md.stressbalance.spcvz=NaN*ones(md.mesh.numberofvertices,1);
+ 
+-	pos=find(md.mesh.vertexonbed);
++	pos=find(md.mesh.vertexonbase);
+ 	md.stressbalance.spcvx(pos)=0.;
+ 	md.stressbalance.spcvy(pos)=0.;
+ 
+Index: ../trunk-jpl/test/NightlyRun/test1107.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1107.py	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test1107.py	(revision 17610)
+@@ -39,10 +39,10 @@
+ 	md.stressbalance.spcvz=float('NaN')*numpy.ones((md.mesh.numberofvertices,1))
+ 
+ 	#Create MPCs to have periodic boundary conditions
+-#	posx=find(md.mesh.x==0. & ~(md.mesh.y==0. & md.mesh.vertexonbed) & ~(md.mesh.y==L & md.mesh.vertexonbed));
+-	posx=numpy.nonzero(logical_and_n(md.mesh.x==0.,numpy.logical_not(numpy.logical_and(md.mesh.y==0.,md.mesh.vertexonbed)),numpy.logical_not(numpy.logical_and(md.mesh.y==L,md.mesh.vertexonbed))))[0]
+-#	posx2=find(md.mesh.x==max(md.mesh.x) & ~(md.mesh.y==0. & md.mesh.vertexonbed) & ~(md.mesh.y==L & md.mesh.vertexonbed));
+-	posx2=numpy.nonzero(logical_and_n(md.mesh.x==numpy.max(md.mesh.x),numpy.logical_not(numpy.logical_and(md.mesh.y==0.,md.mesh.vertexonbed)),numpy.logical_not(numpy.logical_and(md.mesh.y==L,md.mesh.vertexonbed))))[0]
++#	posx=find(md.mesh.x==0. & ~(md.mesh.y==0. & md.mesh.vertexonbase) & ~(md.mesh.y==L & md.mesh.vertexonbase));
++	posx=numpy.nonzero(logical_and_n(md.mesh.x==0.,numpy.logical_not(numpy.logical_and(md.mesh.y==0.,md.mesh.vertexonbase)),numpy.logical_not(numpy.logical_and(md.mesh.y==L,md.mesh.vertexonbase))))[0]
++#	posx2=find(md.mesh.x==max(md.mesh.x) & ~(md.mesh.y==0. & md.mesh.vertexonbase) & ~(md.mesh.y==L & md.mesh.vertexonbase));
++	posx2=numpy.nonzero(logical_and_n(md.mesh.x==numpy.max(md.mesh.x),numpy.logical_not(numpy.logical_and(md.mesh.y==0.,md.mesh.vertexonbase)),numpy.logical_not(numpy.logical_and(md.mesh.y==L,md.mesh.vertexonbase))))[0]
+ 
+ 	posy=numpy.nonzero(logical_and_n(md.mesh.y==0.,md.mesh.x!=0.,md.mesh.x!=numpy.max(md.mesh.x)))[0]    #Don't take the same nodes two times
+ 	posy2=numpy.nonzero(logical_and_n(md.mesh.y==numpy.max(md.mesh.y),md.mesh.x!=0.,md.mesh.x!=numpy.max(md.mesh.x)))[0]
+@@ -50,7 +50,7 @@
+ 	md.stressbalance.vertex_pairing=numpy.vstack((numpy.hstack((posx.reshape(-1,1)+1,posx2.reshape(-1,1)+1)),numpy.hstack((posy.reshape(-1,1)+1,posy2.reshape(-1,1)+1))))
+ 
+ 	#Add spc on the corners
+-	pos=numpy.nonzero(logical_and_n(numpy.logical_or(md.mesh.x==0.,md.mesh.x==L),numpy.logical_or(md.mesh.y==0.,md.mesh.y==L),md.mesh.vertexonbed))
++	pos=numpy.nonzero(logical_and_n(numpy.logical_or(md.mesh.x==0.,md.mesh.x==L),numpy.logical_or(md.mesh.y==0.,md.mesh.y==L),md.mesh.vertexonbase))
+ 	md.stressbalance.spcvy[:]=0.
+ 	md.stressbalance.spcvx[pos]=0.
+ 	if   (L==5000.):
+@@ -67,7 +67,7 @@
+ 		md.stressbalance.spcvx[pos]=16.91
+ 	
+ 	#Spc the bed at zero for vz
+-	pos=numpy.nonzero(md.mesh.vertexonbed)
++	pos=numpy.nonzero(md.mesh.vertexonbase)
+ 	md.stressbalance.spcvz[pos]=0.
+ 
+ 	#Compute the stressbalance
+Index: ../trunk-jpl/test/NightlyRun/test1102.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1102.py	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test1102.py	(revision 17610)
+@@ -41,7 +41,7 @@
+ 	md=setflowequation(md,'FS','all')
+ 
+ 	#Create dirichlet on the bed only
+-	pos=numpy.nonzero(md.mesh.vertexonbed)
++	pos=numpy.nonzero(md.mesh.vertexonbase)
+ 	md.stressbalance.spcvx[pos]=0.
+ 	md.stressbalance.spcvy[pos]=0.
+ 	md.stressbalance.spcvz[pos]=0.
+@@ -49,11 +49,11 @@
+ #	#Create MPCs to have periodic boundary conditions
+ #	posx=numpy.nonzero(md.mesh.x==0.)[0]
+ #	posx2=numpy.nonzero(md.mesh.x==numpy.max(md.mesh.x))[0]
+-#	posx=numpy.nonzero(logical_and_n(md.mesh.x==0.,md.mesh.y!=0.,md.mesh.y!=numpy.max(md.mesh.y),numpy.logical_not(md.mesh.vertexonbed)))[0]
+-#	posx2=numpy.nonzero(logical_and_n(md.mesh.x==numpy.max(md.mesh.x),md.mesh.y!=0.,md.mesh.y!=numpy.max(md.mesh.y),numpy.logical_not(md.mesh.vertexonbed)))[0]
++#	posx=numpy.nonzero(logical_and_n(md.mesh.x==0.,md.mesh.y!=0.,md.mesh.y!=numpy.max(md.mesh.y),numpy.logical_not(md.mesh.vertexonbase)))[0]
++#	posx2=numpy.nonzero(logical_and_n(md.mesh.x==numpy.max(md.mesh.x),md.mesh.y!=0.,md.mesh.y!=numpy.max(md.mesh.y),numpy.logical_not(md.mesh.vertexonbase)))[0]
+ 
+-#	posy=numpy.nonzero(logical_and_n(md.mesh.y==0.,md.mesh.x!=0.,md.mesh.x!=numpy.max(md.mesh.x),numpy.logical_not(md.mesh.vertexonbed)))[0]    #Don't take the same nodes two times
+-#	posy2=numpy.nonzero(logical_and_n(md.mesh.y==numpy.max(md.mesh.y),md.mesh.x!=0.,md.mesh.x!=numpy.max(md.mesh.x),numpy.logical_not(md.mesh.vertexonbed)))[0]
++#	posy=numpy.nonzero(logical_and_n(md.mesh.y==0.,md.mesh.x!=0.,md.mesh.x!=numpy.max(md.mesh.x),numpy.logical_not(md.mesh.vertexonbase)))[0]    #Don't take the same nodes two times
++#	posy2=numpy.nonzero(logical_and_n(md.mesh.y==numpy.max(md.mesh.y),md.mesh.x!=0.,md.mesh.x!=numpy.max(md.mesh.x),numpy.logical_not(md.mesh.vertexonbase)))[0]
+ 
+ #	md.stressbalance.vertex_pairing=numpy.vstack((numpy.hstack((posx.reshape(-1,1)+1,posx2.reshape(-1,1)+1)),numpy.hstack((posy.reshape(-1,1)+1,posy2.reshape(-1,1)+1))))
+ 
+Index: ../trunk-jpl/test/NightlyRun/test1105.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1105.m	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test1105.m	(revision 17610)
+@@ -33,7 +33,7 @@
+ 	md.stressbalance.vertex_pairing=[posx,posx2;posy,posy2];
+ 
+ 	%Add spc on the corners
+-	pos=find((md.mesh.x==0. | md.mesh.x==L) & (md.mesh.y==0. | md.mesh.y==L) & md.mesh.vertexonbed);
++	pos=find((md.mesh.x==0. | md.mesh.x==L) & (md.mesh.y==0. | md.mesh.y==L) & md.mesh.vertexonbase);
+ 	md.stressbalance.spcvx(pos)=0.;
+ 	md.stressbalance.spcvy(pos)=0.;
+ 	if(L==5000.),
+@@ -57,7 +57,7 @@
+ 	end
+ 	
+ 	%Spc the bed at zero for vz
+-	pos=find(md.mesh.vertexonbed);
++	pos=find(md.mesh.vertexonbase);
+ 	md.stressbalance.spcvz(pos)=0.;
+ 
+ 	%Compute the stressbalance
+Index: ../trunk-jpl/test/NightlyRun/test1206.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1206.py	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test1206.py	(revision 17610)
+@@ -34,7 +34,7 @@
+ md=setflowequation(md,'HO','all')
+ 
+ #Spc the nodes on the bed
+-pos=numpy.nonzero(md.mesh.vertexonbed)
++pos=numpy.nonzero(md.mesh.vertexonbase)
+ md.stressbalance.spcvx[pos]=0.
+ md.stressbalance.spcvy[pos]=0.
+ md.stressbalance.spcvz[pos]=0.
+Index: ../trunk-jpl/test/NightlyRun/test1302.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1302.m	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test1302.m	(revision 17610)
+@@ -11,7 +11,7 @@
+ md=setflowequation(md,'HO','all');
+ 
+ %Thermal boundary conditions
+-pos1=find(md.mesh.elementonbed);     md.thermal.spctemperature(md.mesh.elements(pos1,1:3))=10.;
++pos1=find(md.mesh.elementonbase);     md.thermal.spctemperature(md.mesh.elements(pos1,1:3))=10.;
+ pos2=find(md.mesh.elementonsurface); md.thermal.spctemperature(md.mesh.elements(pos2,4:6))=0.;
+ md.initialization.vz=0.1*ones(md.mesh.numberofvertices,1);
+ md.initialization.vel=sqrt( md.initialization.vx.^2+ md.initialization.vy.^2+ md.initialization.vz.^2);
+Index: ../trunk-jpl/test/NightlyRun/test1108.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1108.py	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test1108.py	(revision 17610)
+@@ -33,7 +33,7 @@
+ 	md.stressbalance.spcvy=float('NaN')*numpy.ones((md.mesh.numberofvertices,1))
+ 	md.stressbalance.spcvz=float('NaN')*numpy.ones((md.mesh.numberofvertices,1))
+ 	
+-	pos=numpy.nonzero(logical_and_n(md.mesh.vertexonbed,numpy.logical_or(md.mesh.x==0.,md.mesh.x==numpy.max(md.mesh.x)),numpy.logical_or(md.mesh.y==0.,md.mesh.y==numpy.max(md.mesh.y))))
++	pos=numpy.nonzero(logical_and_n(md.mesh.vertexonbase,numpy.logical_or(md.mesh.x==0.,md.mesh.x==numpy.max(md.mesh.x)),numpy.logical_or(md.mesh.y==0.,md.mesh.y==numpy.max(md.mesh.y))))
+ 	md.stressbalance.spcvx[pos]=0.
+ 	md.stressbalance.spcvy[pos]=0.
+ 	md.stressbalance.spcvz[pos]=0.
+Index: ../trunk-jpl/test/NightlyRun/test1103.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1103.py	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test1103.py	(revision 17610)
+@@ -37,7 +37,7 @@
+ 	md.stressbalance.spcvx=float('NaN')*numpy.ones((md.mesh.numberofvertices,1))
+ 	md.stressbalance.spcvy=float('NaN')*numpy.ones((md.mesh.numberofvertices,1))
+ 	md.stressbalance.spcvz=float('NaN')*numpy.ones((md.mesh.numberofvertices,1))
+-	pos=numpy.nonzero(md.mesh.vertexonbed)
++	pos=numpy.nonzero(md.mesh.vertexonbase)
+ 	md.stressbalance.spcvx[pos]=0.
+ 	md.stressbalance.spcvy[pos]=0.
+ 
+Index: ../trunk-jpl/test/NightlyRun/test1207.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1207.py	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test1207.py	(revision 17610)
+@@ -34,7 +34,7 @@
+ md=setflowequation(md,'FS','all')
+ 
+ #Spc the nodes on the bed
+-pos=numpy.nonzero(md.mesh.vertexonbed)
++pos=numpy.nonzero(md.mesh.vertexonbase)
+ md.stressbalance.spcvx[pos]=0.
+ md.stressbalance.spcvy[pos]=0.
+ md.stressbalance.spcvz[pos]=0.
+Index: ../trunk-jpl/test/NightlyRun/test1303.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1303.m	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test1303.m	(revision 17610)
+@@ -11,7 +11,7 @@
+ md=extrude(md,11,2.);
+ md=setflowequation(md,'HO','all');
+ 
+-pos1=find(md.mesh.elementonbed);     md.thermal.spctemperature(md.mesh.elements(pos1,1:3))=10.;
++pos1=find(md.mesh.elementonbase);     md.thermal.spctemperature(md.mesh.elements(pos1,1:3))=10.;
+ pos2=find(md.mesh.elementonsurface); md.thermal.spctemperature(md.mesh.elements(pos2,4:6))=0.;
+ md.initialization.pressure=zeros(md.mesh.numberofvertices,1);
+ 
+Index: ../trunk-jpl/test/NightlyRun/test1205.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1205.m	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test1205.m	(revision 17610)
+@@ -21,7 +21,7 @@
+ md=setflowequation(md,'SIA','all');
+ 
+ %Spc the nodes on the bed
+-pos=find(md.mesh.vertexonbed);
++pos=find(md.mesh.vertexonbase);
+ md.stressbalance.spcvx(pos)=0.;
+ md.stressbalance.spcvy(pos)=0.;
+ md.stressbalance.spcvz(pos)=0.;
+Index: ../trunk-jpl/test/NightlyRun/test1107.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1107.m	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test1107.m	(revision 17610)
+@@ -25,8 +25,8 @@
+ 	md.stressbalance.spcvz=NaN*ones(md.mesh.numberofvertices,1);
+ 
+ 	%Create MPCs to have periodic boundary conditions
+-	posx=find(md.mesh.x==0. & ~(md.mesh.y==0. & md.mesh.vertexonbed) & ~(md.mesh.y==L & md.mesh.vertexonbed));
+-	posx2=find(md.mesh.x==max(md.mesh.x) & ~(md.mesh.y==0. & md.mesh.vertexonbed) & ~(md.mesh.y==L & md.mesh.vertexonbed));
++	posx=find(md.mesh.x==0. & ~(md.mesh.y==0. & md.mesh.vertexonbase) & ~(md.mesh.y==L & md.mesh.vertexonbase));
++	posx2=find(md.mesh.x==max(md.mesh.x) & ~(md.mesh.y==0. & md.mesh.vertexonbase) & ~(md.mesh.y==L & md.mesh.vertexonbase));
+ 
+ 	posy=find(md.mesh.y==0. & md.mesh.x~=0. & md.mesh.x~=max(md.mesh.x)); %Don't take the same nodes two times
+ 	posy2=find(md.mesh.y==max(md.mesh.y) & md.mesh.x~=0. & md.mesh.x~=max(md.mesh.x));
+@@ -34,7 +34,7 @@
+ 	md.stressbalance.vertex_pairing=[posx,posx2;posy,posy2];
+ 
+ 	%Add spc on the corners
+-	pos=find((md.mesh.x==0. | md.mesh.x==L) & (md.mesh.y==0. | md.mesh.y==L) & md.mesh.vertexonbed);
++	pos=find((md.mesh.x==0. | md.mesh.x==L) & (md.mesh.y==0. | md.mesh.y==L) & md.mesh.vertexonbase);
+ 	md.stressbalance.spcvy(:)=0.;
+ 	md.stressbalance.spcvx(pos)=0.;
+ 	if(L==5000.),
+@@ -52,7 +52,7 @@
+ 	end
+ 	
+ 	%Spc the bed at zero for vz
+-	pos=find(md.mesh.vertexonbed);
++	pos=find(md.mesh.vertexonbase);
+ 	md.stressbalance.spcvz(pos)=0.;
+ 
+ 	%Compute the stressbalance
+Index: ../trunk-jpl/test/NightlyRun/test1104.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1104.py	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test1104.py	(revision 17610)
+@@ -32,7 +32,7 @@
+ 	md.stressbalance.spcvy=float('NaN')*numpy.ones((md.mesh.numberofvertices,1))
+ 	md.stressbalance.spcvz=float('NaN')*numpy.ones((md.mesh.numberofvertices,1))
+ 
+-	pos=numpy.nonzero(md.mesh.vertexonbed)
++	pos=numpy.nonzero(md.mesh.vertexonbase)
+ 	md.stressbalance.spcvx[pos]=0.
+ 	md.stressbalance.spcvy[pos]=0.
+ 
+Index: ../trunk-jpl/test/NightlyRun/test1206.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1206.m	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test1206.m	(revision 17610)
+@@ -21,7 +21,7 @@
+ md=setflowequation(md,'HO','all');
+ 
+ %Spc the nodes on the bed
+-pos=find(md.mesh.vertexonbed);
++pos=find(md.mesh.vertexonbase);
+ md.stressbalance.spcvx(pos)=0.;
+ md.stressbalance.spcvy(pos)=0.;
+ md.stressbalance.spcvz(pos)=0.;
+Index: ../trunk-jpl/test/NightlyRun/test1108.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1108.m	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test1108.m	(revision 17610)
+@@ -21,7 +21,7 @@
+ 	md.stressbalance.spcvy=NaN*ones(md.mesh.numberofvertices,1);
+ 	md.stressbalance.spcvz=NaN*ones(md.mesh.numberofvertices,1);
+ 	
+-	pos=find(md.mesh.vertexonbed & (md.mesh.x==0. | md.mesh.x==max(md.mesh.x)) & (md.mesh.y==0. | md.mesh.y==max(md.mesh.y)));
++	pos=find(md.mesh.vertexonbase & (md.mesh.x==0. | md.mesh.x==max(md.mesh.x)) & (md.mesh.y==0. | md.mesh.y==max(md.mesh.y)));
+ 	md.stressbalance.spcvx(pos)=0.;
+ 	md.stressbalance.spcvy(pos)=0.;
+ 	md.stressbalance.spcvz(pos)=0.;
+Index: ../trunk-jpl/test/NightlyRun/test1208.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1208.py	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test1208.py	(revision 17610)
+@@ -25,7 +25,7 @@
+ md=setflowequation(md,'SIA','all')
+ 
+ #Spc the nodes on the bed
+-pos=numpy.nonzero(md.mesh.vertexonbed)
++pos=numpy.nonzero(md.mesh.vertexonbase)
+ md.stressbalance.spcvx[pos]=0.
+ md.stressbalance.spcvy[pos]=0.
+ md.stressbalance.spcvz[pos]=0.
+Index: ../trunk-jpl/test/NightlyRun/test1101.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1101.m	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test1101.m	(revision 17610)
+@@ -24,7 +24,7 @@
+ 	md.stressbalance.spcvy=NaN*ones(md.mesh.numberofvertices,1);
+ 	md.stressbalance.spcvz=NaN*ones(md.mesh.numberofvertices,1);
+ 
+-	pos=find(md.mesh.vertexonbed);
++	pos=find(md.mesh.vertexonbase);
+ 	md.stressbalance.spcvx(pos)=0.;
+ 	md.stressbalance.spcvy(pos)=0.;
+ 
+Index: ../trunk-jpl/test/NightlyRun/test1207.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1207.m	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test1207.m	(revision 17610)
+@@ -21,7 +21,7 @@
+ md=setflowequation(md,'FS','all');
+ 
+ %Spc the nodes on the bed
+-pos=find(md.mesh.vertexonbed);
++pos=find(md.mesh.vertexonbase);
+ md.stressbalance.spcvx(pos)=0.;
+ md.stressbalance.spcvy(pos)=0.;
+ md.stressbalance.spcvz(pos)=0.;
+Index: ../trunk-jpl/test/NightlyRun/test1109.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1109.m	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test1109.m	(revision 17610)
+@@ -30,7 +30,7 @@
+ 	md.stressbalance.vertex_pairing=[posx,posx2];
+ 
+ 	%Create spcs on the bed 
+-	pos=find(md.mesh.vertexonbed);
++	pos=find(md.mesh.vertexonbase);
+ 	md.stressbalance.spcvx=NaN*ones(md.mesh.numberofvertices,1);
+ 	md.stressbalance.spcvy=NaN*ones(md.mesh.numberofvertices,1);
+ 	md.stressbalance.spcvz=NaN*ones(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/test/NightlyRun/test1110.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1110.m	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test1110.m	(revision 17610)
+@@ -25,17 +25,17 @@
+ 	md.stressbalance.spcvz=NaN*ones(md.mesh.numberofvertices,1);
+ 	if (i==1 | i==3),
+ 		%Create dirichlet on the bed if no slip
+-		pos=find(md.mesh.vertexonbed);
++		pos=find(md.mesh.vertexonbase);
+ 		md.stressbalance.spcvx(pos)=0.;
+ 		md.stressbalance.spcvy(pos)=0.;
+ 		md.stressbalance.spcvz(pos)=0.;
+ 	else
+-		pos=find(md.mesh.vertexonbed & (md.mesh.x==0. | md.mesh.x==max(md.mesh.x)) & (md.mesh.y==0. | md.mesh.y==max(md.mesh.y)));
++		pos=find(md.mesh.vertexonbase & (md.mesh.x==0. | md.mesh.x==max(md.mesh.x)) & (md.mesh.y==0. | md.mesh.y==max(md.mesh.y)));
+ 		md.stressbalance.spcvx(pos)=100.; %because we need a dirichlet somewhere
+ 		md.stressbalance.spcvy(pos)=0.;
+ 		md.stressbalance.spcvz(pos)=0.;
+ 	end
+-	pos=find(~md.mesh.vertexonbed);
++	pos=find(~md.mesh.vertexonbase);
+ 	md.thermal.spctemperature(pos)=255.;
+ 
+ 	%Create MPCs to have periodic boundary conditions
+Index: ../trunk-jpl/test/NightlyRun/test1105.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1105.py	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test1105.py	(revision 17610)
+@@ -47,7 +47,7 @@
+ 	md.stressbalance.vertex_pairing=numpy.vstack((numpy.hstack((posx.reshape(-1,1)+1,posx2.reshape(-1,1)+1)),numpy.hstack((posy.reshape(-1,1)+1,posy2.reshape(-1,1)+1))))
+ 
+ 	#Add spc on the corners
+-	pos=numpy.nonzero(logical_and_n(numpy.logical_or(md.mesh.x==0.,md.mesh.x==L),numpy.logical_or(md.mesh.y==0.,md.mesh.y==L),md.mesh.vertexonbed))
++	pos=numpy.nonzero(logical_and_n(numpy.logical_or(md.mesh.x==0.,md.mesh.x==L),numpy.logical_or(md.mesh.y==0.,md.mesh.y==L),md.mesh.vertexonbase))
+ 	md.stressbalance.spcvx[pos]=0.
+ 	md.stressbalance.spcvy[pos]=0.
+ 	if   (L==5000.):
+@@ -70,7 +70,7 @@
+ 		md.stressbalance.spcvy[pos]=-1.27
+ 	
+ 	#Spc the bed at zero for vz
+-	pos=numpy.nonzero(md.mesh.vertexonbed)
++	pos=numpy.nonzero(md.mesh.vertexonbase)
+ 	md.stressbalance.spcvz[pos]=0.
+ 
+ 	#Compute the stressbalance
+Index: ../trunk-jpl/test/NightlyRun/test1302.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1302.py	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test1302.py	(revision 17610)
+@@ -25,7 +25,7 @@
+ md=setflowequation(md,'HO','all')
+ 
+ #Thermal boundary conditions
+-pos1=numpy.nonzero(md.mesh.elementonbed)[0]
++pos1=numpy.nonzero(md.mesh.elementonbase)[0]
+ md.thermal.spctemperature[md.mesh.elements[pos1,0:3]-1]=10.
+ pos2=numpy.nonzero(md.mesh.elementonsurface)[0]
+ md.thermal.spctemperature[md.mesh.elements[pos2,3:6]-1]=0.
+Index: ../trunk-jpl/test/NightlyRun/test1102.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1102.m	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test1102.m	(revision 17610)
+@@ -27,7 +27,7 @@
+ 	md=setflowequation(md,'FS','all');
+ 
+ 	%Create dirichlet on the bed only
+-	pos=find(md.mesh.vertexonbed);
++	pos=find(md.mesh.vertexonbase);
+ 	md.stressbalance.spcvx(pos)=0.;
+ 	md.stressbalance.spcvy(pos)=0.;
+ 	md.stressbalance.spcvz(pos)=0.;
+@@ -35,11 +35,11 @@
+ %	%Create MPCs to have periodic boundary conditions
+ %	posx=find(md.mesh.x==0.);
+ %	posx2=find(md.mesh.x==max(md.mesh.x));
+-%	posx=find(md.mesh.x==0. & md.mesh.y~=0. & md.mesh.y~=max(md.mesh.y) & ~md.mesh.vertexonbed);
+-%	posx2=find(md.mesh.x==max(md.mesh.x) &  md.mesh.y~=0. & md.mesh.y~=max(md.mesh.y) & ~md.mesh.vertexonbed);
++%	posx=find(md.mesh.x==0. & md.mesh.y~=0. & md.mesh.y~=max(md.mesh.y) & ~md.mesh.vertexonbase);
++%	posx2=find(md.mesh.x==max(md.mesh.x) &  md.mesh.y~=0. & md.mesh.y~=max(md.mesh.y) & ~md.mesh.vertexonbase);
+ 
+-%	posy=find(md.mesh.y==0. & md.mesh.x~=0. & md.mesh.x~=max(md.mesh.x) & ~md.mesh.vertexonbed); %Don't take the same nodes two times
+-%	posy2=find(md.mesh.y==max(md.mesh.y) & md.mesh.x~=0. & md.mesh.x~=max(md.mesh.x) & ~md.mesh.vertexonbed);
++%	posy=find(md.mesh.y==0. & md.mesh.x~=0. & md.mesh.x~=max(md.mesh.x) & ~md.mesh.vertexonbase); %Don't take the same nodes two times
++%	posy2=find(md.mesh.y==max(md.mesh.y) & md.mesh.x~=0. & md.mesh.x~=max(md.mesh.x) & ~md.mesh.vertexonbase);
+ 
+ %	md.stressbalance.vertex_pairing=[posx,posx2;posy,posy2];
+ 
+Index: ../trunk-jpl/test/NightlyRun/test1208.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1208.m	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test1208.m	(revision 17610)
+@@ -12,7 +12,7 @@
+ md=setflowequation(md,'SIA','all');
+ 
+ %Spc the nodes on the bed
+-pos=find(md.mesh.vertexonbed);
++pos=find(md.mesh.vertexonbase);
+ md.stressbalance.spcvx(pos)=0.;
+ md.stressbalance.spcvy(pos)=0.;
+ md.stressbalance.spcvz(pos)=0.;
+Index: ../trunk-jpl/test/NightlyRun/test1103.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1103.m	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test1103.m	(revision 17610)
+@@ -23,7 +23,7 @@
+ 	md.stressbalance.spcvx=NaN*ones(md.mesh.numberofvertices,1);
+ 	md.stressbalance.spcvy=NaN*ones(md.mesh.numberofvertices,1);
+ 	md.stressbalance.spcvz=NaN*ones(md.mesh.numberofvertices,1);
+-	pos=find(md.mesh.vertexonbed);
++	pos=find(md.mesh.vertexonbase);
+ 	md.stressbalance.spcvx(pos)=0.;
+ 	md.stressbalance.spcvy(pos)=0.;
+ 
+Index: ../trunk-jpl/test/NightlyRun/test1101.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1101.py	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test1101.py	(revision 17610)
+@@ -38,7 +38,7 @@
+ 	md.stressbalance.spcvy=float('NaN')*numpy.ones((md.mesh.numberofvertices,1))
+ 	md.stressbalance.spcvz=float('NaN')*numpy.ones((md.mesh.numberofvertices,1))
+ 
+-	pos=numpy.nonzero(md.mesh.vertexonbed)
++	pos=numpy.nonzero(md.mesh.vertexonbase)
+ 	md.stressbalance.spcvx[pos]=0.
+ 	md.stressbalance.spcvy[pos]=0.
+ 
+Index: ../trunk-jpl/test/NightlyRun/test1303.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1303.py	(revision 17609)
++++ ../trunk-jpl/test/NightlyRun/test1303.py	(revision 17610)
+@@ -25,7 +25,7 @@
+ md.extrude(11,2.)
+ md=setflowequation(md,'HO','all')
+ 
+-pos1=numpy.nonzero(md.mesh.elementonbed)[0]
++pos1=numpy.nonzero(md.mesh.elementonbase)[0]
+ md.thermal.spctemperature[md.mesh.elements[pos1,0:3]-1]=10.
+ pos2=numpy.nonzero(md.mesh.elementonsurface)[0]
+ md.thermal.spctemperature[md.mesh.elements[pos2,3:6]-1]=0.
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 17610)
+@@ -44,7 +44,7 @@
+ 	iomodel->FetchDataToInput(elements,BalancethicknessThickeningRateEnum);
+ 
+ 	if(iomodel->meshtype==Mesh3DEnum){
+-		iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
++		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
+ }/*}}}*/
+@@ -57,14 +57,14 @@
+ 	if(stabilization==3 && iomodel->meshtype==Mesh3DEnum) _error_("DG 3d not implemented yet");
+ 
+ 	/*First fetch data: */
+-	if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	if(stabilization!=3){
+ 		::CreateNodes(nodes,iomodel,BalancethicknessAnalysisEnum,P1Enum);
+ 	}
+ 	else{
+ 		::CreateNodes(nodes,iomodel,BalancethicknessAnalysisEnum,P1DGEnum);
+ 	}
+-	iomodel->DeleteData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+ void BalancethicknessAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17610)
+@@ -55,7 +55,7 @@
+ 	iomodel->FetchDataToInput(elements,HydrologydcEplInitialThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcSedimentTransmitivityEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcEplThicknessEnum);
+-	if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
++	if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 	
+ 	//	elements->InputDuplicate(HydrologydcEplInitialThicknessEnum,HydrologydcEplThicknessEnum);
+ 
+@@ -72,9 +72,9 @@
+ 	iomodel->Constant(&isefficientlayer,HydrologydcIsefficientlayerEnum);
+ 	if(!isefficientlayer) return;
+ 
+-	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,HydrologyDCEfficientAnalysisEnum,P1Enum);
+-	iomodel->DeleteData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+ void HydrologyDCEfficientAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17610)
+@@ -37,9 +37,9 @@
+ /*}}}*/
+ void LevelsetAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 	int finiteelement=P1Enum;
+-	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,LevelsetAnalysisEnum,finiteelement);
+-	iomodel->DeleteData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }
+ /*}}}*/
+ void LevelsetAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 17610)
+@@ -33,7 +33,7 @@
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+-	iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
++	iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 	iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
+ 	iomodel->FetchDataToInput(elements,VxEnum,0.);
+@@ -44,9 +44,9 @@
+ 	/*return if not 3d mesh*/
+ 	if(iomodel->meshtype!=Mesh3DEnum) return;
+ 
+-	iomodel->FetchData(3,MeshVertexonbedEnum,MeshVertexonsurfaceEnum,FlowequationVertexEquationEnum);
++	iomodel->FetchData(3,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum,FlowequationVertexEquationEnum);
+ 	::CreateNodes(nodes,iomodel,StressbalanceVerticalAnalysisEnum,P1Enum);
+-	iomodel->DeleteData(3,MeshVertexonbedEnum,MeshVertexonsurfaceEnum,FlowequationVertexEquationEnum);
++	iomodel->DeleteData(3,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum,FlowequationVertexEquationEnum);
+ }/*}}}*/
+ void StressbalanceVerticalAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 17610)
+@@ -33,7 +33,7 @@
+ 	iomodel->FetchDataToInput(elements,FrictionPEnum);
+ 	iomodel->FetchDataToInput(elements,FrictionQEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+-	iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
++	iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 	iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,FlowequationElementEquationEnum);
+ 	iomodel->FetchDataToInput(elements,MaterialsRheologyBEnum);
+@@ -43,9 +43,9 @@
+ }/*}}}*/
+ void MeltingAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+-	if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,MeltingAnalysisEnum,P1Enum);
+-	iomodel->DeleteData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+ void MeltingAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ 	/*No Constraints*/
+@@ -56,17 +56,17 @@
+ 	if(iomodel->meshtype==Mesh2DhorizontalEnum) _error_("2d meshes not supported yet");
+ 
+ 	//create penalties for nodes: no node can have a temperature over the melting point
+-	iomodel->FetchData(1,MeshVertexonbedEnum);
++	iomodel->FetchData(1,MeshVertexonbaseEnum);
+ 	CreateSingleNodeToElementConnectivity(iomodel);
+ 
+ 	for(int i=0;i<iomodel->numberofvertices;i++){
+ 		if(iomodel->my_vertices[i]){
+-			if (reCast<int>(iomodel->Data(MeshVertexonbedEnum)[i])){
++			if (reCast<int>(iomodel->Data(MeshVertexonbaseEnum)[i])){
+ 				loads->AddObject(new Pengrid(iomodel->loadcounter+i+1,i,iomodel,MeltingAnalysisEnum));
+ 			}
+ 		}
+ 	}
+-	iomodel->DeleteData(1,MeshVertexonbedEnum);
++	iomodel->DeleteData(1,MeshVertexonbaseEnum);
+ 
+ }/*}}}*/
+ 
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 17610)
+@@ -22,7 +22,7 @@
+ 	}
+ 
+ 	if(iomodel->meshtype==Mesh2DverticalEnum){
+-		iomodel->FetchDataToInput(elements,MeshVertexonbedEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
+ 	}
+ }/*}}}*/
+ void ExtrudeFromBaseAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 17610)
+@@ -36,7 +36,7 @@
+ 	iomodel->FetchDataToInput(elements,EplHeadEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	if(iomodel->meshtype==Mesh3DEnum){
+-		iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
++		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 	}
+ }/*}}}*/
+ void L2ProjectionEPLAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+@@ -51,13 +51,13 @@
+ 	if(!isefficientlayer) return;
+ 
+ 	if(iomodel->meshtype==Mesh3DEnum){
+-		iomodel->FetchData(1,MeshVertexonbedEnum);
++		iomodel->FetchData(1,MeshVertexonbaseEnum);
+ 	}
+ 	else if(iomodel->meshtype==Mesh2DverticalEnum){
+-		iomodel->FetchData(1,MeshVertexonbedEnum);
++		iomodel->FetchData(1,MeshVertexonbaseEnum);
+ 	}
+ 	::CreateNodes(nodes,iomodel,L2ProjectionEPLAnalysisEnum,P1Enum);
+-	iomodel->DeleteData(1,MeshVertexonbedEnum);
++	iomodel->DeleteData(1,MeshVertexonbaseEnum);
+ }/*}}}*/
+ void L2ProjectionEPLAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17610)
+@@ -83,14 +83,14 @@
+ 	}
+ 
+ 	if(iomodel->meshtype==Mesh3DEnum){
+-		iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
++		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
+ 
+ 	if(islevelset){
+ 		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
+ 		if(iomodel->meshtype!=Mesh2DhorizontalEnum)
+-			iomodel->FetchDataToInput(elements,MeshVertexonbedEnum); // required for updating active nodes
++			iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum); // required for updating active nodes
+ 	}
+ 
+ 	switch(smb_model){
+@@ -134,14 +134,14 @@
+ 	if(stabilization==3 && iomodel->meshtype==Mesh3DEnum) _error_("DG 3d not implemented yet");
+ 
+ 	/*Create Nodes either DG or CG depending on stabilization*/
+-	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	if(stabilization!=3){
+ 		::CreateNodes(nodes,iomodel,MasstransportAnalysisEnum,P1Enum);
+ 	}
+ 	else{
+ 		::CreateNodes(nodes,iomodel,MasstransportAnalysisEnum,P1DGEnum);
+ 	}
+-	iomodel->DeleteData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+ void MasstransportAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ 
+@@ -192,9 +192,9 @@
+ 
+ 	/*Create Penpair for vertex_pairing: */
+ 	IssmDouble *vertex_pairing=NULL;
+-	IssmDouble *nodeonbed=NULL;
++	IssmDouble *nodeonbase=NULL;
+ 	iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,MasstransportVertexPairingEnum);
+-	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(&nodeonbed,NULL,NULL,MeshVertexonbedEnum);
++	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(&nodeonbase,NULL,NULL,MeshVertexonbaseEnum);
+ 
+ 	for(int i=0;i<numvertex_pairing;i++){
+ 
+@@ -205,7 +205,7 @@
+ 
+ 			/*Skip if one of the two is not on the bed*/
+ 			if(iomodel->meshtype!=Mesh2DhorizontalEnum){
+-				if(!(reCast<bool>(nodeonbed[reCast<int>(vertex_pairing[2*i+0])-1])) || !(reCast<bool>(nodeonbed[reCast<int>(vertex_pairing[2*i+1])-1]))) continue;
++				if(!(reCast<bool>(nodeonbase[reCast<int>(vertex_pairing[2*i+0])-1])) || !(reCast<bool>(nodeonbase[reCast<int>(vertex_pairing[2*i+1])-1]))) continue;
+ 			}
+ 
+ 			/*Get node ids*/
+@@ -223,7 +223,7 @@
+ 
+ 	/*free ressources: */
+ 	iomodel->DeleteData(vertex_pairing,MasstransportVertexPairingEnum);
+-	iomodel->DeleteData(nodeonbed,MeshVertexonbedEnum);
++	iomodel->DeleteData(nodeonbase,MeshVertexonbaseEnum);
+ 
+ }/*}}}*/
+ 
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 17610)
+@@ -26,17 +26,17 @@
+ 	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	if(iomodel->meshtype==Mesh3DEnum){
+-		iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
++		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
+ 	if(iomodel->meshtype==Mesh2DverticalEnum){
+-		iomodel->FetchDataToInput(elements,MeshVertexonbedEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
+ 	}
+ }/*}}}*/
+ void SmoothedSurfaceSlopeXAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+-	if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchData(1,MeshVertexonbedEnum);
++	if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchData(1,MeshVertexonbaseEnum);
+ 	::CreateNodes(nodes,iomodel,SmoothedSurfaceSlopeXAnalysisEnum,P1Enum);
+-	if(iomodel->meshtype==Mesh3DEnum) iomodel->DeleteData(1,MeshVertexonbedEnum);
++	if(iomodel->meshtype==Mesh3DEnum) iomodel->DeleteData(1,MeshVertexonbaseEnum);
+ }/*}}}*/
+ void SmoothedSurfaceSlopeXAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 17610)
+@@ -26,17 +26,17 @@
+ 	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	if(iomodel->meshtype==Mesh3DEnum){
+-		iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
++		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
+ 	if(iomodel->meshtype==Mesh2DverticalEnum){
+-		iomodel->FetchDataToInput(elements,MeshVertexonbedEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
+ 	}
+ }/*}}}*/
+ void SmoothedSurfaceSlopeYAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+-	if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchData(1,MeshVertexonbedEnum);
++	if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchData(1,MeshVertexonbaseEnum);
+ 	::CreateNodes(nodes,iomodel,SmoothedSurfaceSlopeYAnalysisEnum,P1Enum);
+-	if(iomodel->meshtype==Mesh3DEnum) iomodel->DeleteData(1,MeshVertexonbedEnum);
++	if(iomodel->meshtype==Mesh3DEnum) iomodel->DeleteData(1,MeshVertexonbaseEnum);
+ }/*}}}*/
+ void SmoothedSurfaceSlopeYAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 17610)
+@@ -22,7 +22,7 @@
+ 	}
+ 
+ 	if(iomodel->meshtype==Mesh2DverticalEnum){
+-		iomodel->FetchDataToInput(elements,MeshVertexonbedEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
+ 	}
+ }/*}}}*/
+ void ExtrudeFromTopAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 17610)
+@@ -43,7 +43,7 @@
+ 	iomodel->FetchDataToInput(elements,ThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,BaseEnum);
+-	iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
++	iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 	iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,MaskGroundediceLevelsetEnum);
+@@ -61,9 +61,9 @@
+ 	/*Now, do we really want Shreve?*/
+ 	if(hydrology_model!=HydrologyshreveEnum) return;
+ 
+-	if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,HydrologyShreveAnalysisEnum,P1Enum);
+-	iomodel->DeleteData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+ void HydrologyShreveAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/analyses/DepthAverageAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DepthAverageAnalysis.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/analyses/DepthAverageAnalysis.cpp	(revision 17610)
+@@ -22,7 +22,7 @@
+ 	}
+ 
+ 	if(iomodel->meshtype==Mesh2DverticalEnum){
+-		iomodel->FetchDataToInput(elements,MeshVertexonbedEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
+ 	}
+ }/*}}}*/
+ void DepthAverageAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 17610)
+@@ -33,7 +33,7 @@
+ 	iomodel->FetchDataToInput(elements,BalancethicknessThickeningRateEnum);
+ 
+ 	if(iomodel->meshtype==Mesh3DEnum){
+-		iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
++		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 17610)
+@@ -26,23 +26,23 @@
+ 	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	if(iomodel->meshtype==Mesh3DEnum){
+-		iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
++		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
+ 	if(iomodel->meshtype==Mesh2DverticalEnum){
+-		iomodel->FetchDataToInput(elements,MeshVertexonbedEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
+ 	}
+ }/*}}}*/
+ void L2ProjectionBaseAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+ 	if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh3DtetrasEnum){
+-		iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++		iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	}
+ 	else if(iomodel->meshtype==Mesh2DverticalEnum){
+-		iomodel->FetchData(1,MeshVertexonbedEnum);
++		iomodel->FetchData(1,MeshVertexonbaseEnum);
+ 	}
+ 	::CreateNodes(nodes,iomodel,L2ProjectionBaseAnalysisEnum,P1Enum);
+-	iomodel->DeleteData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+ void L2ProjectionBaseAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17610)
+@@ -37,7 +37,7 @@
+ 	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+ 	if(iomodel->meshtype==Mesh3DEnum){
+ 		iomodel->FetchDataToInput(elements,VzEnum);
+-		iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
++		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
+ 	switch(smb_model){
+@@ -51,9 +51,9 @@
+ }/*}}}*/
+ void FreeSurfaceTopAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+-	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,FreeSurfaceTopAnalysisEnum,P1Enum);
+-	iomodel->DeleteData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+ void FreeSurfaceTopAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp	(revision 17610)
+@@ -35,9 +35,9 @@
+ }/*}}}*/
+ void LsfReinitializationAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 	int finiteelement=P1Enum;
+-	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,LsfReinitializationAnalysisEnum,finiteelement);
+-	iomodel->DeleteData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+ void LsfReinitializationAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ 	/* Do nothing for now */
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 17610)
+@@ -42,7 +42,7 @@
+ 	if(islevelset){
+ 		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
+ 		if(iomodel->meshtype!=Mesh2DhorizontalEnum)
+-			iomodel->FetchDataToInput(elements,MeshVertexonbedEnum); // required for updating active nodes
++			iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum); // required for updating active nodes
+ 	}
+ 
+ 	/*Free data: */
+@@ -64,7 +64,7 @@
+ 	int    lid=0;
+ 	iomodel->FetchData(4,FlowequationBorderSSAEnum,FlowequationBorderFSEnum,FlowequationVertexEquationEnum,StressbalanceReferentialEnum);
+ 	if(iomodel->meshtype!=Mesh2DhorizontalEnum){
+-		iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++		iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	}
+ 
+ 	for(int i=0;i<iomodel->numberofvertices;i++){
+@@ -83,7 +83,7 @@
+ 		}
+ 	}
+ 
+-	iomodel->DeleteData(6,MeshVertexonbedEnum,MeshVertexonsurfaceEnum,FlowequationBorderSSAEnum,FlowequationBorderFSEnum,
++	iomodel->DeleteData(6,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum,FlowequationBorderSSAEnum,FlowequationBorderFSEnum,
+ 				FlowequationVertexEquationEnum,StressbalanceReferentialEnum);
+ 
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17610)
+@@ -210,7 +210,7 @@
+ 	iomodel->FetchDataToInput(elements,DamageDEnum);
+ 
+ 	if(iomodel->meshtype==Mesh3DEnum){
+-		iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
++		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 		iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
+ 		iomodel->FetchDataToInput(elements,FlowequationBorderFSEnum);
+@@ -219,7 +219,7 @@
+ 		if(dakota_analysis)elements->InputDuplicate(VzEnum,QmuVzEnum);
+ 	}
+ 	if(iomodel->meshtype==Mesh3DtetrasEnum){
+-		iomodel->FetchDataToInput(elements,MeshVertexonbedEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+ 		iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
+ 		iomodel->FetchDataToInput(elements,LoadingforceZEnum);
+@@ -230,14 +230,14 @@
+ 		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+ 	}
+ 	if(isFS){
+-		iomodel->FetchDataToInput(elements,MeshVertexonbedEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,PressureEnum,0.);
+ 		if(dakota_analysis)elements->InputDuplicate(PressureEnum,QmuPressureEnum);
+ 	}
+ 	if(islevelset){
+ 		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
+ 		if(iomodel->meshtype!=Mesh2DhorizontalEnum)
+-			iomodel->FetchDataToInput(elements,MeshVertexonbedEnum); // required for updating active nodes
++			iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum); // required for updating active nodes
+ 	}
+ 
+ #ifdef _HAVE_ANDROID_
+@@ -290,9 +290,9 @@
+ 			iomodel->Constant(&finiteelement,FlowequationFeFSEnum);
+ 		}
+ 		iomodel->FetchData(3,FlowequationBorderSSAEnum,FlowequationVertexEquationEnum,StressbalanceReferentialEnum);
+-		if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(3,MeshVertexonbedEnum,MeshVertexonsurfaceEnum,FlowequationBorderFSEnum);
++		if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(3,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum,FlowequationBorderFSEnum);
+ 		::CreateNodes(nodes,iomodel,StressbalanceAnalysisEnum,finiteelement,approximation);
+-		iomodel->DeleteData(6,MeshVertexonbedEnum,MeshVertexonsurfaceEnum,FlowequationBorderSSAEnum,FlowequationBorderFSEnum,
++		iomodel->DeleteData(6,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum,FlowequationBorderSSAEnum,FlowequationBorderFSEnum,
+ 					FlowequationVertexEquationEnum,StressbalanceReferentialEnum);
+ 	}
+ 	else{
+@@ -302,7 +302,7 @@
+ 		int    lid=0;
+ 		if(!nodes) nodes = new Nodes();
+ 
+-		iomodel->FetchData(6,MeshVertexonbedEnum,MeshVertexonsurfaceEnum,FlowequationBorderSSAEnum,FlowequationBorderFSEnum,
++		iomodel->FetchData(6,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum,FlowequationBorderSSAEnum,FlowequationBorderFSEnum,
+ 					FlowequationVertexEquationEnum,StressbalanceReferentialEnum);
+ 		if(isFS){
+ 			/*P1+ velocity*/
+@@ -339,7 +339,7 @@
+ 				}
+ 			}
+ 		}
+-		iomodel->DeleteData(6,MeshVertexonbedEnum,MeshVertexonsurfaceEnum,FlowequationBorderSSAEnum,FlowequationBorderFSEnum,
++		iomodel->DeleteData(6,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum,FlowequationBorderSSAEnum,FlowequationBorderFSEnum,
+ 					FlowequationVertexEquationEnum,StressbalanceReferentialEnum);
+ 	}
+ }/*}}}*/
+@@ -362,7 +362,7 @@
+ 	IssmDouble *nodeonSSA = NULL;
+ 	IssmDouble *nodeonHO   = NULL;
+ 	IssmDouble *nodeonFS   = NULL;
+-	IssmDouble *nodeonbed      = NULL;
++	IssmDouble *nodeonbase      = NULL;
+ 	IssmDouble *groundedice_ls = NULL;
+ 	IssmDouble *vertices_type  = NULL;
+ 	IssmDouble *surface        = NULL;
+@@ -420,7 +420,7 @@
+ 			/*Constraint at the bedrock interface (v.n = vz = 0) (Coordinates will be updated according to the bed slope)*/
+ 			iomodel->FetchData(&vertices_type,NULL,NULL,FlowequationVertexEquationEnum);
+ 			iomodel->FetchData(&nodeonFS,NULL,NULL,FlowequationBorderFSEnum);
+-			iomodel->FetchData(&nodeonbed,NULL,NULL,MeshVertexonbedEnum);
++			iomodel->FetchData(&nodeonbase,NULL,NULL,MeshVertexonbaseEnum);
+ 			iomodel->FetchData(&groundedice_ls,NULL,NULL,MaskGroundediceLevelsetEnum);
+ 			if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh3DtetrasEnum){
+ 				iomodel->FetchData(&spcvz,&Mz,&Nz,StressbalanceSpcvzEnum);
+@@ -447,7 +447,7 @@
+ 			}
+ 			iomodel->DeleteData(vertices_type,FlowequationVertexEquationEnum);
+ 			iomodel->DeleteData(nodeonFS,FlowequationBorderFSEnum);
+-			iomodel->DeleteData(nodeonbed,MeshVertexonbedEnum);
++			iomodel->DeleteData(nodeonbase,MeshVertexonbaseEnum);
+ 			iomodel->DeleteData(groundedice_ls,MaskGroundediceLevelsetEnum);
+ 
+ 			/*Pressure spc*/
+@@ -513,7 +513,7 @@
+ 	iomodel->FetchData(&nodeonSSA,NULL,NULL,FlowequationBorderSSAEnum);
+ 	if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh3DtetrasEnum)iomodel->FetchData(&nodeonHO,NULL,NULL,FlowequationBorderHOEnum);
+ 	if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh3DtetrasEnum)iomodel->FetchData(&nodeonFS,NULL,NULL,FlowequationBorderFSEnum);
+-	if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh3DtetrasEnum)iomodel->FetchData(&nodeonbed,NULL,NULL,MeshVertexonbedEnum);
++	if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh3DtetrasEnum)iomodel->FetchData(&nodeonbase,NULL,NULL,MeshVertexonbaseEnum);
+ 	if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh3DtetrasEnum)iomodel->FetchData(&groundedice_ls,NULL,NULL,MaskGroundediceLevelsetEnum);
+ 	iomodel->FetchData(&vertices_type,NULL,NULL,FlowequationVertexEquationEnum);
+ 	iomodel->FetchData(&surface,NULL,NULL,SurfaceEnum);
+@@ -743,7 +743,7 @@
+ 	iomodel->DeleteData(nodeonSSA,FlowequationBorderSSAEnum);
+ 	if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh3DtetrasEnum)iomodel->DeleteData(nodeonHO,FlowequationBorderHOEnum);
+ 	if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh3DtetrasEnum)iomodel->DeleteData(nodeonFS,FlowequationBorderFSEnum);
+-	if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh3DtetrasEnum)iomodel->DeleteData(nodeonbed,MeshVertexonbedEnum);
++	if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh3DtetrasEnum)iomodel->DeleteData(nodeonbase,MeshVertexonbaseEnum);
+ 	if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh3DtetrasEnum)iomodel->DeleteData(groundedice_ls,MaskGroundediceLevelsetEnum);
+ 	iomodel->DeleteData(vertices_type,FlowequationVertexEquationEnum);
+ 	iomodel->DeleteData(surface,SurfaceEnum);
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17610)
+@@ -87,7 +87,7 @@
+ 	iomodel->FetchDataToInput(elements,HydrologydcBasalMoulinInputEnum);
+ 	iomodel->FetchDataToInput(elements,SedimentHeadEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcSedimentTransmitivityEnum);
+-	if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
++	if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 
+ 	if(isefficientlayer)iomodel->FetchDataToInput(elements,HydrologydcMaskEplactiveNodeEnum);
+ }/*}}}*/
+@@ -100,9 +100,9 @@
+ 	/*Now, do we really want DC?*/
+ 	if(hydrology_model!=HydrologydcEnum) return;
+ 
+-	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,HydrologyDCInefficientAnalysisEnum,P1Enum);
+-	iomodel->DeleteData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+ void HydrologyDCInefficientAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ 
+@@ -120,7 +120,7 @@
+ 	iomodel->Constant(&hydrology_model,HydrologyModelEnum);
+ 	if(hydrology_model!=HydrologydcEnum) return;
+ 
+-	if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchData(1,MeshVertexonbedEnum);
++	if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchData(1,MeshVertexonbaseEnum);
+ 
+ 	//create penalties for nodes: no node can have water above the max
+ 	CreateSingleNodeToElementConnectivity(iomodel);
+@@ -131,13 +131,13 @@
+ 				loads->AddObject(new Pengrid(iomodel->loadcounter+i+1,i,iomodel,HydrologyDCInefficientAnalysisEnum));
+ 			}
+ 		}
+-		else if(reCast<int>(iomodel->Data(MeshVertexonbedEnum)[i])){
++		else if(reCast<int>(iomodel->Data(MeshVertexonbaseEnum)[i])){
+ 			if(iomodel->my_vertices[i]){
+ 				loads->AddObject(new Pengrid(iomodel->loadcounter+i+1,i,iomodel,HydrologyDCInefficientAnalysisEnum));
+ 			}	
+ 		}
+ 	}
+-	iomodel->DeleteData(1,MeshVertexonbedEnum);
++	iomodel->DeleteData(1,MeshVertexonbaseEnum);
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17610)
+@@ -54,7 +54,7 @@
+ 	iomodel->FetchDataToInput(elements,FrictionQEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,MaskGroundediceLevelsetEnum);
+-	iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
++	iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 	iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,FlowequationElementEquationEnum);
+ 	iomodel->FetchDataToInput(elements,MaterialsRheologyBEnum);
+@@ -77,14 +77,14 @@
+ 	}
+ 	if(islevelset){
+ 		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
+-		iomodel->FetchDataToInput(elements,MeshVertexonbedEnum); // required for updating active nodes
++		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum); // required for updating active nodes
+ 	}
+ }/*}}}*/
+ void ThermalAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+-	if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,ThermalAnalysisEnum,P1Enum);
+-	iomodel->DeleteData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+ void ThermalAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17610)
+@@ -72,9 +72,9 @@
+ }/*}}}*/
+ void DamageEvolutionAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+-	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(1,MeshVertexonbedEnum);
++	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(1,MeshVertexonbaseEnum);
+ 	::CreateNodes(nodes,iomodel,DamageEvolutionAnalysisEnum,P1Enum);
+-	iomodel->DeleteData(1,MeshVertexonbedEnum);
++	iomodel->DeleteData(1,MeshVertexonbaseEnum);
+ }/*}}}*/
+ void DamageEvolutionAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17610)
+@@ -58,7 +58,7 @@
+ 	iomodel->FetchDataToInput(elements,FrictionQEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,MaskGroundediceLevelsetEnum);
+-	iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
++	iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 	iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,FlowequationElementEquationEnum);
+ 	iomodel->FetchDataToInput(elements,MaterialsRheologyBEnum);
+@@ -85,7 +85,7 @@
+ 	}
+ 	if(islevelset){
+ 		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
+-		iomodel->FetchDataToInput(elements,MeshVertexonbedEnum); // required for updating active nodes
++		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum); // required for updating active nodes
+ 	}
+ 
+ 	/*Free data: */
+@@ -93,9 +93,9 @@
+ }/*}}}*/
+ void EnthalpyAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+-	if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,EnthalpyAnalysisEnum,P1Enum);
+-	iomodel->DeleteData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+ void EnthalpyAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17610)
+@@ -36,15 +36,15 @@
+ 	iomodel->FetchDataToInput(elements,VyEnum);
+ 	if(iomodel->meshtype==Mesh3DEnum){
+ 		iomodel->FetchDataToInput(elements,VzEnum);
+-		iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
++		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
+ }/*}}}*/
+ void FreeSurfaceBaseAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+-	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,FreeSurfaceBaseAnalysisEnum,P1Enum);
+-	iomodel->DeleteData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+ void FreeSurfaceBaseAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ }/*}}}*/
+@@ -57,9 +57,9 @@
+ 
+ 	/*Create Penpair for vertex_pairing: */
+ 	IssmDouble *vertex_pairing=NULL;
+-	IssmDouble *nodeonbed=NULL;
++	IssmDouble *nodeonbase=NULL;
+ 	iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,MasstransportVertexPairingEnum);
+-	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(&nodeonbed,NULL,NULL,MeshVertexonbedEnum);
++	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(&nodeonbase,NULL,NULL,MeshVertexonbaseEnum);
+ 	for(int i=0;i<numvertex_pairing;i++){
+ 
+ 		if(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+0])-1]){
+@@ -69,7 +69,7 @@
+ 
+ 			/*Skip if one of the two is not on the bed*/
+ 			if(iomodel->meshtype!=Mesh2DhorizontalEnum){
+-				if(!(reCast<bool>(nodeonbed[reCast<int>(vertex_pairing[2*i+0])-1])) || !(reCast<bool>(nodeonbed[reCast<int>(vertex_pairing[2*i+1])-1]))) continue;
++				if(!(reCast<bool>(nodeonbase[reCast<int>(vertex_pairing[2*i+0])-1])) || !(reCast<bool>(nodeonbase[reCast<int>(vertex_pairing[2*i+1])-1]))) continue;
+ 			}
+ 
+ 			/*Get node ids*/
+@@ -87,7 +87,7 @@
+ 
+ 	/*free ressources: */
+ 	iomodel->DeleteData(vertex_pairing,MasstransportVertexPairingEnum);
+-	iomodel->DeleteData(nodeonbed,MeshVertexonbedEnum);
++	iomodel->DeleteData(nodeonbase,MeshVertexonbaseEnum);
+ }/*}}}*/
+ 
+ /*Finite Element Analysis*/
+@@ -367,7 +367,7 @@
+ void FreeSurfaceBaseAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+ 
+ 	/*Intermediary*/
+-	IssmDouble phi,isonbed,base;
++	IssmDouble phi,isonbase,base;
+ 
+ 	for(int i=0;i<femmodel->elements->Size();i++){
+ 
+@@ -376,14 +376,14 @@
+ 
+ 		int             numnodes = element->GetNumberOfNodes();
+ 		Input* groundedice_input = element->GetInput(MaskGroundediceLevelsetEnum);  _assert_(groundedice_input);
+-		Input* onbed_input       = element->GetInput(MeshVertexonbedEnum);          _assert_(onbed_input);
++		Input* onbase_input       = element->GetInput(MeshVertexonbaseEnum);          _assert_(onbase_input);
+ 		Input* base_input        = element->GetInput(BaseEnum);                     _assert_(base_input);
+ 
+ 		Gauss* gauss=element->NewGauss();
+ 		for(int iv=0;iv<numnodes;iv++){
+ 			gauss->GaussNode(element->GetElementType(),iv);
+-			onbed_input->GetInputValue(&isonbed,gauss);
+-			if(isonbed==1.){
++			onbase_input->GetInputValue(&isonbase,gauss);
++			if(isonbase==1.){
+ 				groundedice_input->GetInputValue(&phi,gauss);
+ 				if(phi>=0.){
+ 					base_input->GetInputValue(&base,gauss);
+Index: ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17610)
+@@ -30,16 +30,16 @@
+ 		}
+ 	}
+ 	if(iomodel->meshtype==Mesh3DEnum){
+-		iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
++		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
+ }
+ /*}}}*/
+ void ExtrapolationAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 	int finiteelement=P1Enum;
+-	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->meshtype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,ExtrapolationAnalysisEnum,finiteelement);
+-	iomodel->DeleteData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
++	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }
+ /*}}}*/
+ void ExtrapolationAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17609)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17610)
+@@ -194,7 +194,7 @@
+ 	MaterialsMantleShearModulusEnum,
+ 	MaterialsMantleDensityEnum,
+ 	MeshAverageVertexConnectivityEnum,
+-	MeshElementonbedEnum,
++	MeshElementonbaseEnum,
+ 	MeshElementonsurfaceEnum,
+ 	MeshElements2dEnum,
+ 	MeshElementsEnum,
+@@ -205,7 +205,7 @@
+ 	MeshNumberofvertices2dEnum,
+ 	MeshNumberofverticesEnum,
+ 	MeshUpperelementsEnum,
+-	MeshVertexonbedEnum,
++	MeshVertexonbaseEnum,
+ 	MeshVertexonsurfaceEnum,
+ 	MeshXEnum,
+ 	MeshYEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17610)
+@@ -202,7 +202,7 @@
+ 		case MaterialsMantleShearModulusEnum : return "MaterialsMantleShearModulus";
+ 		case MaterialsMantleDensityEnum : return "MaterialsMantleDensity";
+ 		case MeshAverageVertexConnectivityEnum : return "MeshAverageVertexConnectivity";
+-		case MeshElementonbedEnum : return "MeshElementonbed";
++		case MeshElementonbaseEnum : return "MeshElementonbase";
+ 		case MeshElementonsurfaceEnum : return "MeshElementonsurface";
+ 		case MeshElements2dEnum : return "MeshElements2d";
+ 		case MeshElementsEnum : return "MeshElements";
+@@ -213,7 +213,7 @@
+ 		case MeshNumberofvertices2dEnum : return "MeshNumberofvertices2d";
+ 		case MeshNumberofverticesEnum : return "MeshNumberofvertices";
+ 		case MeshUpperelementsEnum : return "MeshUpperelements";
+-		case MeshVertexonbedEnum : return "MeshVertexonbed";
++		case MeshVertexonbaseEnum : return "MeshVertexonbase";
+ 		case MeshVertexonsurfaceEnum : return "MeshVertexonsurface";
+ 		case MeshXEnum : return "MeshX";
+ 		case MeshYEnum : return "MeshY";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17610)
+@@ -205,7 +205,7 @@
+ 	      else if (strcmp(name,"MaterialsMantleShearModulus")==0) return MaterialsMantleShearModulusEnum;
+ 	      else if (strcmp(name,"MaterialsMantleDensity")==0) return MaterialsMantleDensityEnum;
+ 	      else if (strcmp(name,"MeshAverageVertexConnectivity")==0) return MeshAverageVertexConnectivityEnum;
+-	      else if (strcmp(name,"MeshElementonbed")==0) return MeshElementonbedEnum;
++	      else if (strcmp(name,"MeshElementonbase")==0) return MeshElementonbaseEnum;
+ 	      else if (strcmp(name,"MeshElementonsurface")==0) return MeshElementonsurfaceEnum;
+ 	      else if (strcmp(name,"MeshElements2d")==0) return MeshElements2dEnum;
+ 	      else if (strcmp(name,"MeshElements")==0) return MeshElementsEnum;
+@@ -216,7 +216,7 @@
+ 	      else if (strcmp(name,"MeshNumberofvertices2d")==0) return MeshNumberofvertices2dEnum;
+ 	      else if (strcmp(name,"MeshNumberofvertices")==0) return MeshNumberofverticesEnum;
+ 	      else if (strcmp(name,"MeshUpperelements")==0) return MeshUpperelementsEnum;
+-	      else if (strcmp(name,"MeshVertexonbed")==0) return MeshVertexonbedEnum;
++	      else if (strcmp(name,"MeshVertexonbase")==0) return MeshVertexonbaseEnum;
+ 	      else if (strcmp(name,"MeshVertexonsurface")==0) return MeshVertexonsurfaceEnum;
+ 	      else if (strcmp(name,"MeshX")==0) return MeshXEnum;
+ 	      else if (strcmp(name,"MeshY")==0) return MeshYEnum;
+Index: ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp	(revision 17610)
+@@ -73,10 +73,10 @@
+ 			}
+ 
+ 			if(solvein2d){
+-				IssmDouble *mask_isonbed = xNew<IssmDouble>(numnodes);
+-				element->GetInputListOnNodes(&mask_isonbed[0],MeshVertexonbedEnum);
+-				for(in=0;in<numnodes;in++)	 mask[in]*=mask_isonbed[in];
+-				xDelete<IssmDouble>(mask_isonbed);
++				IssmDouble *mask_isonbase = xNew<IssmDouble>(numnodes);
++				element->GetInputListOnNodes(&mask_isonbase[0],MeshVertexonbaseEnum);
++				for(in=0;in<numnodes;in++)	 mask[in]*=mask_isonbase[in];
++				xDelete<IssmDouble>(mask_isonbase);
+ 			}
+ 		}
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17610)
+@@ -1198,7 +1198,7 @@
+ 	IssmDouble sum;
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetInputListOnVertices(&values[0],MeshVertexonbedEnum);
++	GetInputListOnVertices(&values[0],MeshVertexonbaseEnum);
+ 	sum = values[0]+values[1]+values[2];
+ 
+ 	_assert_(sum==0. || sum==1. || sum==2.);
+@@ -1242,7 +1242,7 @@
+ 	int        indices[3][2] = {{1,2},{2,0},{0,1}};
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetInputListOnVertices(&values[0],MeshVertexonbedEnum);
++	GetInputListOnVertices(&values[0],MeshVertexonbaseEnum);
+ 
+ 	for(int i=0;i<3;i++){
+ 		if(values[indices[i][0]] == 1. && values[indices[i][1]] == 1.){
+@@ -1284,7 +1284,7 @@
+ 	int        indices[3][2] = {{1,2},{2,0},{0,1}};
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetInputListOnVertices(&values[0],MeshVertexonbedEnum);
++	GetInputListOnVertices(&values[0],MeshVertexonbaseEnum);
+ 
+ 	for(int i=0;i<3;i++){
+ 		if(values[indices[i][0]] == 1. && values[indices[i][1]] == 1.){
+@@ -1637,7 +1637,7 @@
+ 	int numnodes = this->NumberofNodesVelocity();
+ 
+ 	int          approximation;
+-	IssmDouble*  vertexonbed= NULL;
++	IssmDouble*  vertexonbase= NULL;
+ 	IssmDouble   slope,groundedice;
+ 	IssmDouble   xz_plane[6];
+ 
+@@ -1649,14 +1649,14 @@
+ 	/*Get inputs*/
+ 	Input* slope_input=inputs->GetInput(BedSlopeXEnum);                             _assert_(slope_input);
+ 	Input* groundedicelevelset_input=inputs->GetInput(MaskGroundediceLevelsetEnum); _assert_(groundedicelevelset_input);
+-	vertexonbed = xNew<IssmDouble>(numnodes);
+-	this->GetInputListOnNodesVelocity(&vertexonbed[0],MeshVertexonbedEnum);
++	vertexonbase = xNew<IssmDouble>(numnodes);
++	this->GetInputListOnNodesVelocity(&vertexonbase[0],MeshVertexonbaseEnum);
+ 
+ 	/*Loop over basal nodes and update their CS*/
+ 	GaussTria* gauss = new GaussTria();
+ 	for(int i=0;i<this->NumberofNodesVelocity();i++){
+ 
+-		if(vertexonbed[i]==1){
++		if(vertexonbase[i]==1){
+ 			gauss->GaussNode(this->VelocityInterpolation(),i);
+ 			slope_input->GetInputValue(&slope,gauss);
+ 			groundedicelevelset_input->GetInputValue(&groundedice,gauss);
+@@ -1678,7 +1678,7 @@
+ 	}
+ 
+ 	/*cleanup*/
+-	xDelete<IssmDouble>(vertexonbed);
++	xDelete<IssmDouble>(vertexonbase);
+ 	delete gauss;
+ }
+ /*}}}*/
+@@ -1989,17 +1989,17 @@
+ 	if(!HasEdgeOnBase()) return;
+ 
+ 	int        extrusioninput;
+-	IssmDouble value,isonbed;
++	IssmDouble value,isonbase;
+ 
+ 	this->parameters->FindParam(&extrusioninput,InputToExtrudeEnum);
+ 	Input* input = inputs->GetInput(extrusioninput);      _assert_(input);
+-	Input* onbed = inputs->GetInput(MeshVertexonbedEnum); _assert_(onbed);
++	Input* onbase = inputs->GetInput(MeshVertexonbaseEnum); _assert_(onbase);
+ 
+ 	GaussTria* gauss=new GaussTria();
+ 	for(int iv=0;iv<this->NumberofNodes();iv++){
+ 		gauss->GaussNode(this->element_type,iv);
+-		onbed->GetInputValue(&isonbed,gauss);
+-		if(isonbed==1.){
++		onbase->GetInputValue(&isonbase,gauss);
++		if(isonbase==1.){
+ 			input->GetInputValue(&value,gauss);
+ 			this->nodes[iv]->ApplyConstraint(0,value);
+ 		}
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17610)
+@@ -1506,9 +1506,9 @@
+ /*FUNCTION Penta::IsOnBase{{{*/
+ bool Penta::IsOnBase(void){
+ 
+-	bool onbed;
+-	inputs->GetInputValue(&onbed,MeshElementonbedEnum);
+-	return onbed;
++	bool onbase;
++	inputs->GetInputValue(&onbase,MeshElementonbaseEnum);
++	return onbase;
+ }
+ /*}}}*/
+ /*FUNCTION Penta::IsOnSurface{{{*/
+@@ -2492,17 +2492,17 @@
+ 	if(!IsOnBase()) return;
+ 
+ 	int        extrusioninput;
+-	IssmDouble value,isonbed;
++	IssmDouble value,isonbase;
+ 
+ 	this->parameters->FindParam(&extrusioninput,InputToExtrudeEnum);
+ 	Input* input = inputs->GetInput(extrusioninput);      _assert_(extrusioninput);
+-	Input* onbed = inputs->GetInput(MeshVertexonbedEnum); _assert_(onbed);
++	Input* onbase = inputs->GetInput(MeshVertexonbaseEnum); _assert_(onbase);
+ 
+ 	GaussPenta* gauss=new GaussPenta();
+ 	for(int iv=0;iv<this->NumberofNodes();iv++){
+ 		gauss->GaussNode(this->element_type,iv);
+-		onbed->GetInputValue(&isonbed,gauss);
+-		if(isonbed==1.){
++		onbase->GetInputValue(&isonbase,gauss);
++		if(isonbase==1.){
+ 			input->GetInputValue(&value,gauss);
+ 			this->nodes[iv]->ApplyConstraint(0,value);
+ 		}
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17610)
+@@ -109,7 +109,7 @@
+ 	int        indices[4][3] = {{0,1,2},{0,1,3},{1,2,3},{2,0,3}};
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetInputListOnVertices(&values[0],MeshVertexonbedEnum);
++	GetInputListOnVertices(&values[0],MeshVertexonbaseEnum);
+ 
+ 	for(int i=0;i<4;i++){
+ 		if(values[indices[i][0]] == 1. && values[indices[i][1]] == 1. && values[indices[i][2]] == 1.){
+@@ -233,7 +233,7 @@
+ 	IssmDouble sum;
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	GetInputListOnVertices(&values[0],MeshVertexonbedEnum);
++	GetInputListOnVertices(&values[0],MeshVertexonbaseEnum);
+ 	sum = values[0]+values[1]+values[2]+values[3];
+ 
+ 	_assert_(sum==0. || sum==1. || sum==2. || sum==3.);
+@@ -653,7 +653,7 @@
+ 	int numnodes = this->GetNumberOfNodes();
+ 
+ 	int          approximation;
+-	IssmDouble*  vertexonbed= NULL;
++	IssmDouble*  vertexonbase= NULL;
+ 	IssmDouble   slopex,slopey,groundedice;
+ 	IssmDouble   xz_plane[6];
+ 
+@@ -666,14 +666,14 @@
+ 	Input* slopex_input=inputs->GetInput(BedSlopeXEnum); _assert_(slopex_input);
+ 	Input* slopey_input=inputs->GetInput(BedSlopeYEnum); _assert_(slopey_input);
+ 	Input* groundedicelevelset_input=inputs->GetInput(MaskGroundediceLevelsetEnum); _assert_(groundedicelevelset_input);
+-	vertexonbed = xNew<IssmDouble>(numnodes);
+-	this->GetInputListOnNodesVelocity(&vertexonbed[0],MeshVertexonbedEnum);
++	vertexonbase = xNew<IssmDouble>(numnodes);
++	this->GetInputListOnNodesVelocity(&vertexonbase[0],MeshVertexonbaseEnum);
+ 
+ 	/*Loop over basal nodes and update their CS*/
+ 	GaussTetra* gauss = new GaussTetra();
+ 	for(int i=0;i<this->NumberofNodesVelocity();i++){
+ 
+-		if(vertexonbed[i]==1){
++		if(vertexonbase[i]==1){
+ 			gauss->GaussNode(this->VelocityInterpolation(),i);
+ 
+ 			slopex_input->GetInputValue(&slopex,gauss);
+@@ -703,7 +703,7 @@
+ 	}
+ 
+ 	/*cleanup*/
+-	xDelete<IssmDouble>(vertexonbed);
++	xDelete<IssmDouble>(vertexonbase);
+ 	delete gauss;
+ }
+ /*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17610)
+@@ -549,7 +549,7 @@
+ }
+ /*}}}*/
+ bool Element::HasNodeOnBase(){/*{{{*/
+-	return (this->inputs->Max(MeshVertexonbedEnum)>0.);
++	return (this->inputs->Max(MeshVertexonbaseEnum)>0.);
+ }/*}}}*/
+ bool Element::HasNodeOnSurface(){/*{{{*/
+ 	return (this->inputs->Max(MeshVertexonsurfaceEnum)>0.);
+@@ -749,7 +749,7 @@
+ 				name==HydrologydcEplInitialThicknessEnum ||
+ 				name==HydrologydcEplThicknessEnum ||
+ 				name==HydrologydcMaskEplactiveNodeEnum ||
+-				name==MeshVertexonbedEnum 
++				name==MeshVertexonbaseEnum 
+ 
+ 				) {
+ 					return true;
+Index: ../trunk-jpl/src/c/classes/Node.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Node.cpp	(revision 17609)
++++ ../trunk-jpl/src/c/classes/Node.cpp	(revision 17610)
+@@ -62,21 +62,21 @@
+ 
+ 		if(iomodel->meshtype!=Mesh2DhorizontalEnum){
+ 			/*We have a  3d mesh, we may have collapsed elements, hence dead nodes. Freeze them out: */
+-			_assert_(iomodel->Data(MeshVertexonbedEnum)); 
++			_assert_(iomodel->Data(MeshVertexonbaseEnum)); 
+ 			_assert_(iomodel->Data(FlowequationVertexEquationEnum));
+-			if(in_approximation==SSAApproximationEnum && !reCast<int>(iomodel->Data(MeshVertexonbedEnum)[io_index])){
++			if(in_approximation==SSAApproximationEnum && !reCast<int>(iomodel->Data(MeshVertexonbaseEnum)[io_index])){
+ 				this->Deactivate();
+ 			}
+-			if(in_approximation==L1L2ApproximationEnum && !reCast<int>(iomodel->Data(MeshVertexonbedEnum)[io_index])){
++			if(in_approximation==L1L2ApproximationEnum && !reCast<int>(iomodel->Data(MeshVertexonbaseEnum)[io_index])){
+ 				this->Deactivate();
+ 			}
+ 			if(in_approximation==SSAHOApproximationEnum && reCast<int>(iomodel->Data(FlowequationBorderSSAEnum)[io_index])){
+-				if(!reCast<int>(iomodel->Data(MeshVertexonbedEnum)[io_index])){
++				if(!reCast<int>(iomodel->Data(MeshVertexonbaseEnum)[io_index])){
+ 					this->Deactivate();
+ 				}
+ 			}
+ 			if(in_approximation==SSAFSApproximationEnum && reCast<int>(iomodel->Data(FlowequationBorderSSAEnum)[io_index])){
+-				if(!reCast<int>(iomodel->Data(MeshVertexonbedEnum)[io_index])){
++				if(!reCast<int>(iomodel->Data(MeshVertexonbaseEnum)[io_index])){
+ 					for(k=0;k<=1;k++) this->FreezeDof(k);
+ 				}
+ 			}
+@@ -102,8 +102,8 @@
+ 				){
+ 		if(iomodel->meshtype!=Mesh2DhorizontalEnum){
+ 			/*On a 3d mesh, we may have collapsed elements, hence dead nodes. Freeze them out: */
+-			_assert_(iomodel->Data(MeshVertexonbedEnum));
+-			if(!(reCast<bool>(iomodel->Data(MeshVertexonbedEnum)[io_index]))){
++			_assert_(iomodel->Data(MeshVertexonbaseEnum));
++			if(!(reCast<bool>(iomodel->Data(MeshVertexonbaseEnum)[io_index]))){
+ 				this->Deactivate();
+ 			}
+ 		}
+Index: ../trunk-jpl/src/m/consistency/checkfield.py
+===================================================================
+--- ../trunk-jpl/src/m/consistency/checkfield.py	(revision 17609)
++++ ../trunk-jpl/src/m/consistency/checkfield.py	(revision 17610)
+@@ -31,7 +31,7 @@
+ 	      md = checkfield(md,fieldname,options);
+ 
+ 	   Example:
+-	      md = checkfield(md,'mesh.elementonbed','size',[md.mesh.numberofelements 1],'values',[0 1]);
++	      md = checkfield(md,'mesh.elementonbase','size',[md.mesh.numberofelements 1],'values',[0 1]);
+ 	"""
+ 
+ 	#get options
+Index: ../trunk-jpl/src/m/consistency/checkfield.m
+===================================================================
+--- ../trunk-jpl/src/m/consistency/checkfield.m	(revision 17609)
++++ ../trunk-jpl/src/m/consistency/checkfield.m	(revision 17610)
+@@ -24,7 +24,7 @@
+ %      md = checkfield(md,fieldname,options);
+ %
+ %   Example:
+-%      md = checkfield(md,'mesh.elementonbed','size',[md.mesh.numberofelements 1],'values',[0 1]);
++%      md = checkfield(md,'mesh.elementonbase','size',[md.mesh.numberofelements 1],'values',[0 1]);
+ 
+ %get options
+ options=pairoptions(varargin{:});
+Index: ../trunk-jpl/src/m/mesh/bamgflowband.m
+===================================================================
+--- ../trunk-jpl/src/m/mesh/bamgflowband.m	(revision 17609)
++++ ../trunk-jpl/src/m/mesh/bamgflowband.m	(revision 17610)
+@@ -30,7 +30,7 @@
+ md=bamg(model(),'domain',A,'vertical',1,'Markers',m,varargin{:});
+ 
+ %Deal with vertices on bed
+-md.mesh.vertexonbed=zeros(md.mesh.numberofvertices,1);
+-md.mesh.vertexonbed(find(vertexflags(md.mesh,1)))=1;
++md.mesh.vertexonbase=zeros(md.mesh.numberofvertices,1);
++md.mesh.vertexonbase(find(vertexflags(md.mesh,1)))=1;
+ md.mesh.vertexonsurface=zeros(md.mesh.numberofvertices,1);
+ md.mesh.vertexonsurface(find(vertexflags(md.mesh,3)))=1;
+Index: ../trunk-jpl/src/m/classes/mesh3dprisms.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh3dprisms.py	(revision 17609)
++++ ../trunk-jpl/src/m/classes/mesh3dprisms.py	(revision 17610)
+@@ -27,9 +27,9 @@
+ 		self.long                        = float('NaN');
+ 		self.hemisphere                  = float('NaN');
+ 
+-		self.elementonbed                = float('NaN');
++		self.elementonbase                = float('NaN');
+ 		self.elementonsurface            = float('NaN');
+-		self.vertexonbed                 = float('NaN');
++		self.vertexonbase                 = float('NaN');
+ 		self.vertexonsurface             = float('NaN');
+ 		self.lowerelements               = float('NaN');
+ 		self.lowervertex                 = float('NaN');
+@@ -74,8 +74,8 @@
+ 
+ 		string="%s%s"%(string,"\n\n      Properties:")
+ 		string="%s\n%s"%(string,fielddisplay(self,"numberoflayers","number of extrusion layers"))
+-		string="%s\n%s"%(string,fielddisplay(self,"vertexonbed","lower vertices flags list"))
+-		string="%s\n%s"%(string,fielddisplay(self,"elementonbed","lower elements flags list"))
++		string="%s\n%s"%(string,fielddisplay(self,"vertexonbase","lower vertices flags list"))
++		string="%s\n%s"%(string,fielddisplay(self,"elementonbase","lower elements flags list"))
+ 		string="%s\n%s"%(string,fielddisplay(self,"vertexonsurface","upper vertices flags list"))
+ 		string="%s\n%s"%(string,fielddisplay(self,"elementonsurface","upper elements flags list"))
+ 		string="%s\n%s"%(string,fielddisplay(self,"uppervertex","upper vertex list (-1 for vertex on the upper surface)"))
+@@ -121,9 +121,9 @@
+ 		md = checkfield(md,'fieldname','mesh.numberofelements','>',0)
+ 		md = checkfield(md,'fieldname','mesh.numberofvertices','>',0)
+ 		#no checks for numberofedges lat long and hemisphere
+-		md = checkfield(md,'fieldname','mesh.elementonbed','size',[md.mesh.numberofelements],'values',[0,1])
++		md = checkfield(md,'fieldname','mesh.elementonbase','size',[md.mesh.numberofelements],'values',[0,1])
+ 		md = checkfield(md,'fieldname','mesh.elementonsurface','size',[md.mesh.numberofelements],'values',[0,1])
+-		md = checkfield(md,'fieldname','mesh.vertexonbed','size',[md.mesh.numberofvertices],'values',[0,1])
++		md = checkfield(md,'fieldname','mesh.vertexonbase','size',[md.mesh.numberofvertices],'values',[0,1])
+ 		md = checkfield(md,'fieldname','mesh.vertexonsurface','size',[md.mesh.numberofvertices],'values',[0,1])
+ 		md = checkfield(md,'fieldname','mesh.average_vertex_connectivity','>=',24,'message',"'mesh.average_vertex_connectivity' should be at least 24 in 3d")
+ 
+@@ -141,9 +141,9 @@
+ 		WriteData(fid,'object',self,'class','mesh','fieldname','numberoflayers','format','Integer')
+ 		WriteData(fid,'object',self,'class','mesh','fieldname','numberofelements','format','Integer')
+ 		WriteData(fid,'object',self,'class','mesh','fieldname','numberofvertices','format','Integer')
+-		WriteData(fid,'object',self,'class','mesh','fieldname','elementonbed','format','BooleanMat','mattype',2)
++		WriteData(fid,'object',self,'class','mesh','fieldname','elementonbase','format','BooleanMat','mattype',2)
+ 		WriteData(fid,'object',self,'class','mesh','fieldname','elementonsurface','format','BooleanMat','mattype',2)
+-		WriteData(fid,'object',self,'class','mesh','fieldname','vertexonbed','format','BooleanMat','mattype',1)
++		WriteData(fid,'object',self,'class','mesh','fieldname','vertexonbase','format','BooleanMat','mattype',1)
+ 		WriteData(fid,'object',self,'class','mesh','fieldname','vertexonsurface','format','BooleanMat','mattype',1)
+ 		WriteData(fid,'object',self,'class','mesh','fieldname','lowerelements','format','DoubleMat','mattype',2)
+ 		WriteData(fid,'object',self,'class','mesh','fieldname','upperelements','format','DoubleMat','mattype',2)
+Index: ../trunk-jpl/src/m/classes/mesh3dprisms.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh3dprisms.m	(revision 17609)
++++ ../trunk-jpl/src/m/classes/mesh3dprisms.m	(revision 17610)
+@@ -17,9 +17,9 @@
+ 		long                        = NaN
+ 		hemisphere                  = NaN
+ 
+-		elementonbed                = NaN
++		elementonbase                = NaN
+ 		elementonsurface            = NaN
+-		vertexonbed                 = NaN
++		vertexonbase                 = NaN
+ 		vertexonsurface             = NaN
+ 		lowerelements               = NaN
+ 		lowervertex                 = NaN
+@@ -82,9 +82,9 @@
+ 			md = checkfield(md,'fieldname','mesh.numberofelements','>',0);
+ 			md = checkfield(md,'fieldname','mesh.numberofvertices','>',0);
+ 			%no checks for numberofedges lat long and hemisphere
+-			md = checkfield(md,'fieldname','mesh.elementonbed','size',[md.mesh.numberofelements 1],'values',[0 1]);
++			md = checkfield(md,'fieldname','mesh.elementonbase','size',[md.mesh.numberofelements 1],'values',[0 1]);
+ 			md = checkfield(md,'fieldname','mesh.elementonsurface','size',[md.mesh.numberofelements 1],'values',[0 1]);
+-			md = checkfield(md,'fieldname','mesh.vertexonbed','size',[md.mesh.numberofvertices 1],'values',[0 1]);
++			md = checkfield(md,'fieldname','mesh.vertexonbase','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+ 			md = checkfield(md,'fieldname','mesh.vertexonsurface','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+ 			md = checkfield(md,'fieldname','mesh.z','>=',md.geometry.base-10^-10,'message','''mesh.z'' lower than bedrock');
+ 			md = checkfield(md,'fieldname','mesh.z','<=',md.geometry.surface+10^-10,'message','''mesh.z'' higher than surface elevation');
+@@ -110,8 +110,8 @@
+ 
+ 			disp(sprintf('\n      Properties:'));
+ 			fielddisplay(obj,'numberoflayers','number of extrusion layers');
+-			fielddisplay(obj,'vertexonbed','lower vertices flags list');
+-			fielddisplay(obj,'elementonbed','lower elements flags list');
++			fielddisplay(obj,'vertexonbase','lower vertices flags list');
++			fielddisplay(obj,'elementonbase','lower elements flags list');
+ 			fielddisplay(obj,'vertexonsurface','upper vertices flags list');
+ 			fielddisplay(obj,'elementonsurface','upper elements flags list');
+ 			fielddisplay(obj,'uppervertex','upper vertex list (NaN for vertex on the upper surface)');
+@@ -142,9 +142,9 @@
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','numberoflayers','format','Integer');
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','numberofelements','format','Integer');
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','numberofvertices','format','Integer');
+-			WriteData(fid,'object',obj,'class','mesh','fieldname','elementonbed','format','BooleanMat','mattype',2);
++			WriteData(fid,'object',obj,'class','mesh','fieldname','elementonbase','format','BooleanMat','mattype',2);
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','elementonsurface','format','BooleanMat','mattype',2);
+-			WriteData(fid,'object',obj,'class','mesh','fieldname','vertexonbed','format','BooleanMat','mattype',1);
++			WriteData(fid,'object',obj,'class','mesh','fieldname','vertexonbase','format','BooleanMat','mattype',1);
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','vertexonsurface','format','BooleanMat','mattype',1);
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','lowerelements','format','DoubleMat','mattype',2);
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','upperelements','format','DoubleMat','mattype',2);
+Index: ../trunk-jpl/src/m/classes/mesh3dtetras.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh3dtetras.m	(revision 17609)
++++ ../trunk-jpl/src/m/classes/mesh3dtetras.m	(revision 17610)
+@@ -17,7 +17,7 @@
+ 		long                        = NaN
+ 		hemisphere                  = NaN
+ 
+-		vertexonbed                 = NaN
++		vertexonbase                 = NaN
+ 		vertexonsurface             = NaN
+ 		lowerelements               = NaN
+ 		lowervertex                 = NaN
+@@ -80,7 +80,7 @@
+ 			md = checkfield(md,'fieldname','mesh.numberofelements','>',0);
+ 			md = checkfield(md,'fieldname','mesh.numberofvertices','>',0);
+ 			%no checks for numberofedges lat long and hemisphere
+-			md = checkfield(md,'fieldname','mesh.vertexonbed','size',[md.mesh.numberofvertices 1],'values',[0 1]);
++			md = checkfield(md,'fieldname','mesh.vertexonbase','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+ 			md = checkfield(md,'fieldname','mesh.vertexonsurface','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+ 			md = checkfield(md,'fieldname','mesh.z','>=',md.geometry.base-10^-10,'message','''mesh.z'' lower than bedrock');
+ 			md = checkfield(md,'fieldname','mesh.z','<=',md.geometry.surface+10^-10,'message','''mesh.z'' higher than surface elevation');
+@@ -106,7 +106,7 @@
+ 
+ 			disp(sprintf('\n      Properties:'));
+ 			fielddisplay(obj,'numberoflayers','number of extrusion layers');
+-			fielddisplay(obj,'vertexonbed','lower vertices flags list');
++			fielddisplay(obj,'vertexonbase','lower vertices flags list');
+ 			fielddisplay(obj,'vertexonsurface','upper vertices flags list');
+ 			fielddisplay(obj,'uppervertex','upper vertex list (NaN for vertex on the upper surface)');
+ 			fielddisplay(obj,'upperelements','upper element list (NaN for element on the upper layer)');
+@@ -136,7 +136,7 @@
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','numberoflayers','format','Integer');
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','numberofelements','format','Integer');
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','numberofvertices','format','Integer');
+-			WriteData(fid,'object',obj,'class','mesh','fieldname','vertexonbed','format','BooleanMat','mattype',1);
++			WriteData(fid,'object',obj,'class','mesh','fieldname','vertexonbase','format','BooleanMat','mattype',1);
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','vertexonsurface','format','BooleanMat','mattype',1);
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','lowerelements','format','DoubleMat','mattype',2);
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','upperelements','format','DoubleMat','mattype',2);
+Index: ../trunk-jpl/src/m/classes/mesh2dvertical.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh2dvertical.m	(revision 17609)
++++ ../trunk-jpl/src/m/classes/mesh2dvertical.m	(revision 17610)
+@@ -17,7 +17,7 @@
+ 		hemisphere                  = NaN
+ 
+ 		vertexonboundary            = NaN
+-		vertexonbed                 = NaN
++		vertexonbase                 = NaN
+ 		vertexonsurface             = NaN
+ 
+ 		edges                       = NaN
+@@ -66,7 +66,7 @@
+ 			end
+ 			md = checkfield(md,'fieldname','mesh.numberofelements','>',0);
+ 			md = checkfield(md,'fieldname','mesh.numberofvertices','>',0);
+-			md = checkfield(md,'fieldname','mesh.vertexonbed','size',[md.mesh.numberofvertices 1],'values',[0 1]);
++			md = checkfield(md,'fieldname','mesh.vertexonbase','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+ 			md = checkfield(md,'fieldname','mesh.vertexonsurface','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+ 			md = checkfield(md,'fieldname','mesh.average_vertex_connectivity','>=',9,'message','''mesh.average_vertex_connectivity'' should be at least 9 in 2d');
+ 
+@@ -89,7 +89,7 @@
+ 
+ 			disp(sprintf('\n      Properties:'));
+ 			fielddisplay(obj,'vertexonboundary','vertices on the boundary of the domain flag list');
+-			fielddisplay(obj,'vertexonbed','vertices on the bed of the domain flag list');
++			fielddisplay(obj,'vertexonbase','vertices on the bed of the domain flag list');
+ 			fielddisplay(obj,'vertexonsurface','vertices on the surface of the domain flag list');
+ 			fielddisplay(obj,'segments','edges on domain boundary (vertex1 vertex2 element)');
+ 			fielddisplay(obj,'segmentmarkers','number associated to each segment');
+@@ -110,7 +110,7 @@
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','elements','format','DoubleMat','mattype',2);
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','numberofelements','format','Integer');
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','numberofvertices','format','Integer');
+-			WriteData(fid,'object',obj,'class','mesh','fieldname','vertexonbed','format','BooleanMat','mattype',1);
++			WriteData(fid,'object',obj,'class','mesh','fieldname','vertexonbase','format','BooleanMat','mattype',1);
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','vertexonsurface','format','BooleanMat','mattype',1);
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','average_vertex_connectivity','format','Integer');
+ 		end % }}}
+Index: ../trunk-jpl/src/m/classes/model.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.py	(revision 17609)
++++ ../trunk-jpl/src/m/classes/model.py	(revision 17610)
+@@ -614,9 +614,9 @@
+ 
+ 
+ 		#bedinfo and surface info
+-		md.mesh.elementonbed=project3d(md,'vector',numpy.ones(md.mesh.numberofelements2d,bool),'type','element','layer',1)
++		md.mesh.elementonbase=project3d(md,'vector',numpy.ones(md.mesh.numberofelements2d,bool),'type','element','layer',1)
+ 		md.mesh.elementonsurface=project3d(md,'vector',numpy.ones(md.mesh.numberofelements2d,bool),'type','element','layer',md.mesh.numberoflayers-1)
+-		md.mesh.vertexonbed=project3d(md,'vector',numpy.ones(md.mesh.numberofvertices2d,bool),'type','node','layer',1)
++		md.mesh.vertexonbase=project3d(md,'vector',numpy.ones(md.mesh.numberofvertices2d,bool),'type','node','layer',1)
+ 		md.mesh.vertexonsurface=project3d(md,'vector',numpy.ones(md.mesh.numberofvertices2d,bool),'type','node','layer',md.mesh.numberoflayers)
+ 
+ 		#elementstype
+Index: ../trunk-jpl/src/m/classes/oldclasses/mesh.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/oldclasses/mesh.m	(revision 17609)
++++ ../trunk-jpl/src/m/classes/oldclasses/mesh.m	(revision 17610)
+@@ -14,9 +14,9 @@
+ 		long                        = NaN
+ 		hemisphere                  = NaN
+ 
+-		elementonbed                = NaN
++		elementonbase                = NaN
+ 		elementonsurface            = NaN
+-		vertexonbed                 = NaN
++		vertexonbase                 = NaN
+ 		vertexonsurface             = NaN
+ 		lowerelements               = NaN
+ 		lowervertex                 = NaN
+Index: ../trunk-jpl/src/m/classes/stressbalance.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/stressbalance.py	(revision 17609)
++++ ../trunk-jpl/src/m/classes/stressbalance.py	(revision 17610)
+@@ -161,7 +161,7 @@
+ 					md.checkmessage("Vectors in stressbalance.referential (columns 1 to 3 and 4 to 6) must be orthogonal")
+ 		#CHECK THAT NO rotation specified for FS Grounded ice at base
+ 		if m.strcmp(md.mesh.meshtype(),'3D') and md.flowequation.isFS:
+-			pos=numpy.nonzero(numpy.logical_and(md.mask.groundedice_levelset,md.mesh.vertexonbed))
++			pos=numpy.nonzero(numpy.logical_and(md.mask.groundedice_levelset,md.mesh.vertexonbase))
+ 			if numpy.any(numpy.logical_not(numpy.isnan(md.stressbalance.referential[pos,:]))):
+ 				md.checkmessage("no referential should be specified for basal vertices of grounded ice")
+ 
+Index: ../trunk-jpl/src/m/classes/stressbalance.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/stressbalance.m	(revision 17609)
++++ ../trunk-jpl/src/m/classes/stressbalance.m	(revision 17610)
+@@ -112,7 +112,7 @@
+ 			end
+ 			%CHECK THAT NO rotation specified for FS Grounded ice at base
+ 			if strcmp(meshtype(md.mesh),'3D') & md.flowequation.isFS,
+-				pos=find(md.mask.groundedice_levelset>0. & md.mesh.vertexonbed);
++				pos=find(md.mask.groundedice_levelset>0. & md.mesh.vertexonbase);
+ 				if any(~isnan(md.stressbalance.referential(pos,:))),
+ 					md = checkmessage(md,['no referential should be specified for basal vertices of grounded ice']);
+ 				end
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17609)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17610)
+@@ -720,9 +720,9 @@
+       if ~isnan(md.initialization.epl_thickness),md.initialization.epl_thickness=project3d(md,'vector',md.initialization.epl_thickness,'type','node','layer',1);end;
+ 
+ 			%bedinfo and surface info
+-			md.mesh.elementonbed=project3d(md,'vector',ones(md.mesh.numberofelements2d,1),'type','element','layer',1);
++			md.mesh.elementonbase=project3d(md,'vector',ones(md.mesh.numberofelements2d,1),'type','element','layer',1);
+ 			md.mesh.elementonsurface=project3d(md,'vector',ones(md.mesh.numberofelements2d,1),'type','element','layer',md.mesh.numberoflayers-1);
+-			md.mesh.vertexonbed=project3d(md,'vector',ones(md.mesh.numberofvertices2d,1),'type','node','layer',1);
++			md.mesh.vertexonbase=project3d(md,'vector',ones(md.mesh.numberofvertices2d,1),'type','node','layer',1);
+ 			md.mesh.vertexonsurface=project3d(md,'vector',ones(md.mesh.numberofvertices2d,1),'type','node','layer',md.mesh.numberoflayers);
+ 
+ 			%elementstype
+@@ -840,7 +840,7 @@
+ 			if isfield(structmd,'numberofgrids2d'), md.mesh.numberofvertices2d=structmd.numberofgrids2d; end
+ 			if isfield(structmd,'uppergrids'), md.mesh.uppervertex=structmd.uppergrids; end
+ 			if isfield(structmd,'lowergrids'), md.mesh.lowervertex=structmd.lowergrids; end
+-			if isfield(structmd,'gridonbed'), md.mesh.vertexonbed=structmd.gridonbed; end
++			if isfield(structmd,'gridonbase'), md.mesh.vertexonbase=structmd.gridonbase; end
+ 			if isfield(structmd,'gridonsurface'), md.mesh.vertexonsurface=structmd.gridonsurface; end
+ 			if isfield(structmd,'extractedgrids'), md.mesh.extractedvertices=structmd.extractedgrids; end
+ 			if isfield(structmd,'gridonboundary'), md.mesh.vertexonboundary=structmd.gridonboundary; end
+@@ -950,10 +950,10 @@
+ 			if isfield(structmd,'lowernodes'), md.mesh.lowervertex=structmd.lowernodes; end
+ 			if isfield(structmd,'upperelements'), md.mesh.upperelements=structmd.upperelements; end
+ 			if isfield(structmd,'lowerelements'), md.mesh.lowerelements=structmd.lowerelements; end
+-			if isfield(structmd,'elementonbed'), md.mesh.elementonbed=structmd.elementonbed; end
++			if isfield(structmd,'elementonbase'), md.mesh.elementonbase=structmd.elementonbase; end
+ 			if isfield(structmd,'elementonsurface'), md.mesh.elementonsurface=structmd.elementonsurface; end
+ 			if isfield(structmd,'nodeonsurface'), md.mesh.vertexonsurface=structmd.nodeonsurface; end
+-			if isfield(structmd,'nodeonbed'), md.mesh.vertexonbed=structmd.nodeonbed; end
++			if isfield(structmd,'nodeonbase'), md.mesh.vertexonbase=structmd.nodeonbase; end
+ 			if isfield(structmd,'elements2d'), md.mesh.elements2d=structmd.elements2d; end
+ 			if isfield(structmd,'y2d'), md.mesh.y2d=structmd.y2d; end
+ 			if isfield(structmd,'x2d'), md.mesh.x2d=structmd.x2d; end
+Index: ../trunk-jpl/src/m/contrib/dassflow/importgmsh.m
+===================================================================
+--- ../trunk-jpl/src/m/contrib/dassflow/importgmsh.m	(revision 17609)
++++ ../trunk-jpl/src/m/contrib/dassflow/importgmsh.m	(revision 17610)
+@@ -84,7 +84,7 @@
+ md.mesh=mesh2dvertical(md.mesh);
+ md.mesh.segmentmarkers=segmentmarkers;
+ md.mesh.segments=segments;
+-md.mesh.vertexonbed=zeros(md.mesh.numberofvertices,1);
+-md.mesh.vertexonbed(find(vertexflags(md.mesh,1)))=1;
++md.mesh.vertexonbase=zeros(md.mesh.numberofvertices,1);
++md.mesh.vertexonbase(find(vertexflags(md.mesh,1)))=1;
+ md.mesh.vertexonsurface=zeros(md.mesh.numberofvertices,1);
+ md.mesh.vertexonsurface(find(vertexflags(md.mesh,3)))=1;
+Index: ../trunk-jpl/src/m/contrib/bamg/yams.m
+===================================================================
+--- ../trunk-jpl/src/m/contrib/bamg/yams.m	(revision 17609)
++++ ../trunk-jpl/src/m/contrib/bamg/yams.m	(revision 17610)
+@@ -105,9 +105,9 @@
+ 
+ %Fill in rest of fields:
+ md.mesh.z=zeros(md.mesh.numberofvertices,1);
+-md.mesh.vertexonbed=ones(md.mesh.numberofvertices,1);
++md.mesh.vertexonbase=ones(md.mesh.numberofvertices,1);
+ md.mesh.vertexonsurface=ones(md.mesh.numberofvertices,1);
+-md.mesh.elementonbed=ones(md.mesh.numberofelements,1);
++md.mesh.elementonbase=ones(md.mesh.numberofelements,1);
+ md.mesh.elementonsurface=ones(md.mesh.numberofelements,1);
+ if strcmpi(Names.interp,'node'),
+ 	md.inversion.vx_obs=InterpFromGridToMesh(Vel.(Names.xname),Vel.(Names.yname),Vel.(Names.vxname),md.mesh.x,md.mesh.y,0);
+Index: ../trunk-jpl/src/m/enum/MeshElementonbedEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/MeshElementonbedEnum.m	(revision 17609)
++++ ../trunk-jpl/src/m/enum/MeshElementonbedEnum.m	(revision 17610)
+@@ -1,11 +0,0 @@
+-function macro=MeshElementonbedEnum()
+-%MESHELEMENTONBEDENUM - Enum of MeshElementonbed
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=MeshElementonbedEnum()
+-
+-macro=StringToEnum('MeshElementonbed');
+Index: ../trunk-jpl/src/m/enum/MeshVertexonbedEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/MeshVertexonbedEnum.m	(revision 17609)
++++ ../trunk-jpl/src/m/enum/MeshVertexonbedEnum.m	(revision 17610)
+@@ -1,11 +0,0 @@
+-function macro=MeshVertexonbedEnum()
+-%MESHVERTEXONBEDENUM - Enum of MeshVertexonbed
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=MeshVertexonbedEnum()
+-
+-macro=StringToEnum('MeshVertexonbed');
+Index: ../trunk-jpl/src/m/enum/MeshVertexonbaseEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/MeshVertexonbaseEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/MeshVertexonbaseEnum.m	(revision 17610)
+@@ -0,0 +1,11 @@
++function macro=MeshVertexonbaseEnum()
++%MESHVERTEXONBASEENUM - Enum of MeshVertexonbase
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=MeshVertexonbaseEnum()
++
++macro=StringToEnum('MeshVertexonbase');
+Index: ../trunk-jpl/src/m/enum/MeshElementonbaseEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/MeshElementonbaseEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/MeshElementonbaseEnum.m	(revision 17610)
+@@ -0,0 +1,11 @@
++function macro=MeshElementonbaseEnum()
++%MESHELEMENTONBASEENUM - Enum of MeshElementonbase
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=MeshElementonbaseEnum()
++
++macro=StringToEnum('MeshElementonbase');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17609)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17610)
+@@ -194,7 +194,7 @@
+ def MaterialsMantleShearModulusEnum(): return StringToEnum("MaterialsMantleShearModulus")[0]
+ def MaterialsMantleDensityEnum(): return StringToEnum("MaterialsMantleDensity")[0]
+ def MeshAverageVertexConnectivityEnum(): return StringToEnum("MeshAverageVertexConnectivity")[0]
+-def MeshElementonbedEnum(): return StringToEnum("MeshElementonbed")[0]
++def MeshElementonbaseEnum(): return StringToEnum("MeshElementonbase")[0]
+ def MeshElementonsurfaceEnum(): return StringToEnum("MeshElementonsurface")[0]
+ def MeshElements2dEnum(): return StringToEnum("MeshElements2d")[0]
+ def MeshElementsEnum(): return StringToEnum("MeshElements")[0]
+@@ -205,7 +205,7 @@
+ def MeshNumberofvertices2dEnum(): return StringToEnum("MeshNumberofvertices2d")[0]
+ def MeshNumberofverticesEnum(): return StringToEnum("MeshNumberofvertices")[0]
+ def MeshUpperelementsEnum(): return StringToEnum("MeshUpperelements")[0]
+-def MeshVertexonbedEnum(): return StringToEnum("MeshVertexonbed")[0]
++def MeshVertexonbaseEnum(): return StringToEnum("MeshVertexonbase")[0]
+ def MeshVertexonsurfaceEnum(): return StringToEnum("MeshVertexonsurface")[0]
+ def MeshXEnum(): return StringToEnum("MeshX")[0]
+ def MeshYEnum(): return StringToEnum("MeshY")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17610-17611.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17610-17611.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17610-17611.diff	(revision 17802)
@@ -0,0 +1,16 @@
+Index: ../trunk-jpl/src/m/classes/oldclasses/mesh.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/oldclasses/mesh.m	(revision 17610)
++++ ../trunk-jpl/src/m/classes/oldclasses/mesh.m	(revision 17611)
+@@ -14,9 +14,9 @@
+ 		long                        = NaN
+ 		hemisphere                  = NaN
+ 
+-		elementonbase                = NaN
++		elementonbed                = NaN
+ 		elementonsurface            = NaN
+-		vertexonbase                 = NaN
++		vertexonbed                 = NaN
+ 		vertexonsurface             = NaN
+ 		lowerelements               = NaN
+ 		lowervertex                 = NaN
Index: issm/oecreview/Archive/16554-17801/ISSM-17611-17612.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17611-17612.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17611-17612.diff	(revision 17802)
@@ -0,0 +1,25 @@
+Index: ../trunk-jpl/src/m/shp/shp2exp.py
+===================================================================
+--- ../trunk-jpl/src/m/shp/shp2exp.py	(revision 17611)
++++ ../trunk-jpl/src/m/shp/shp2exp.py	(revision 17612)
+@@ -27,7 +27,8 @@
+ 	shp=shapefile.Reader(shapefilename)
+ 	expdict=dict(closed=1,density=1)
+ 
+-
++	x=[]
++	y=[]
+ 	for i in range(len(shp.shapes())):
+ 		geom=shp.shapes()[i].shapeType
+ 		if geom==5: # polygon
+@@ -45,8 +46,8 @@
+ 			expdict['y']=y
+ 			expdict['nods']=len(x)
+ 		elif geom==1: # point
+-			x=[p[0] for p in shp.shapes()[i].points]
+-			y=[q[1] for q in shp.shapes()[i].points]
++			x.append(shp.shapes()[i].points[0][0])
++			y.append(shp.shapes()[i].points[0][1])
+ 			expdict['x']=x
+ 			expdict['y']=y
+ 			expdict['nods']=len(x)
Index: issm/oecreview/Archive/16554-17801/ISSM-17612-17613.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17612-17613.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17612-17613.diff	(revision 17802)
@@ -0,0 +1,16 @@
+Index: ../trunk-jpl/test/Archives/Archive455.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive450.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive285.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive280.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17613-17614.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17613-17614.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17613-17614.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/exp/expread.py
+===================================================================
+--- ../trunk-jpl/src/m/exp/expread.py	(revision 17613)
++++ ../trunk-jpl/src/m/exp/expread.py	(revision 17614)
+@@ -7,7 +7,7 @@
+ 	"""
+ 	EXPREAD - read a file exp and build a Structure
+ 
+-	   This routine reads a file .exp and build a Structure containing the 
++	   This routine reads a file .exp and builds a list of dicts containing the 
+ 	   fields x and y corresponding to the coordinates, one for the filename of
+ 	   the exp file, for the density, for the nodes, and a field closed to 
+ 	   indicate if the domain is closed. 
Index: issm/oecreview/Archive/16554-17801/ISSM-17614-17615.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17614-17615.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17614-17615.diff	(revision 17802)
@@ -0,0 +1,74 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17614)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17615)
+@@ -993,6 +993,18 @@
+ }
+ /*}}}*/
+ void Element::ViscosityFS(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){/*{{{*/
++	/*The effective strain rate is defined in Paterson 3d Ed p 91 eq 9,
++	 * and Cuffey p 303 eq 8.18:
++	 *
++	 *  2 eps_eff^2 = eps_xx^2 + eps_yy^2 + eps_zz^2 + 2(eps_xy^2 + eps_xz^2 + eps_yz^2)
++	 *
++	 *  or
++	 *
++	 *  eps_eff = 1/sqrt(2) sqrt( \sum_ij eps_ij^2 )
++	 *
++	 *          = 1/sqrt(2) ||eps||_F
++	 *
++	 *  where ||.||_F is the Frobenius norm */
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble viscosity;
+@@ -1007,9 +1019,9 @@
+ 		eps_eff = sqrt(epsilon3d[0]*epsilon3d[0] + epsilon3d[1]*epsilon3d[1] + epsilon3d[3]*epsilon3d[3] +  epsilon3d[4]*epsilon3d[4] + epsilon3d[5]*epsilon3d[5] + epsilon3d[0]*epsilon3d[1]+eps0*eps0);
+ 	}
+ 	else{
+-		/* eps_eff^2 = exx^2 + eyy^2 + 2*exy^2 */
++		/* eps_eff^2 = 1/2 ( exx^2 + eyy^2 + 2*exy^2 )*/
+ 		this->StrainRateSSA(&epsilon2d[0],xyz_list,gauss,vx_input,vy_input);
+-		eps_eff = sqrt(epsilon2d[0]*epsilon2d[0] + epsilon2d[1]*epsilon2d[1] + 2.*epsilon2d[2]*epsilon2d[2]);
++		eps_eff = 1./sqrt(2.)*sqrt(epsilon2d[0]*epsilon2d[0] + epsilon2d[1]*epsilon2d[1] + 2.*epsilon2d[2]*epsilon2d[2]);
+ 	}
+ 
+ 	/*Get viscosity*/
+@@ -1083,7 +1095,7 @@
+ 	/*Intermediaries*/
+ 	IssmDouble viscosity;
+ 	IssmDouble epsilon3d[5];/* epsilon=[exx,eyy,exy,exz,eyz];*/
+-	IssmDouble epsilon2d[2]; /* epsilon=[exx,exy];           */
++	IssmDouble epsilon2d[2];/* epsilon=[exx,exy];            */
+ 	IssmDouble eps_eff;
+ 
+ 	if(dim==3){
+@@ -1092,9 +1104,9 @@
+ 		eps_eff = sqrt(epsilon3d[0]*epsilon3d[0] + epsilon3d[1]*epsilon3d[1] + epsilon3d[2]*epsilon3d[2] +  epsilon3d[3]*epsilon3d[3] + epsilon3d[4]*epsilon3d[4] + epsilon3d[0]*epsilon3d[1]);
+ 	}
+ 	else{
+-		/* eps_eff^2 = exx^2 + exy^2 */
++		/* eps_eff^2 = 1/2 (exx^2 + 2*exy^2 )*/
+ 		this->StrainRateHO2dvertical(&epsilon2d[0],xyz_list,gauss,vx_input,vy_input);
+-		eps_eff = sqrt(epsilon2d[0]*epsilon2d[0] + epsilon2d[1]*epsilon2d[1]);
++		eps_eff = 1./sqrt(2.)*sqrt(epsilon2d[0]*epsilon2d[0] + 2.*epsilon2d[1]*epsilon2d[1]);
+ 	}
+ 
+ 	/*Get viscosity*/
+@@ -1112,14 +1124,14 @@
+ 	IssmDouble eps_eff;
+ 
+ 	 if(dim==2){
+-		 /* eps_eff^2 = exx^2 + eyy^2 + exy^2 + exx*eyy+*/
++		 /* eps_eff^2 = exx^2 + eyy^2 + exy^2 + exx*eyy*/
+ 		 this->StrainRateSSA(&epsilon2d[0],xyz_list,gauss,vx_input,vy_input);
+ 		 eps_eff = sqrt(epsilon2d[0]*epsilon2d[0] + epsilon2d[1]*epsilon2d[1] + epsilon2d[2]*epsilon2d[2] + epsilon2d[0]*epsilon2d[1]);
+ 	 }
+ 	 else{
+-		 /* eps_eff^2 = exx^2*/
++		 /* eps_eff^2 = 1/2 exx^2*/
+ 		 this->StrainRateSSA1d(&epsilon1d,xyz_list,gauss,vx_input);
+-		 eps_eff = sqrt(epsilon1d*epsilon1d);
++		 eps_eff = sqrt(epsilon1d*epsilon1d/2.);
+ 	 }
+ 
+ 	/*Get viscosity*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17615-17616.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17615-17616.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17615-17616.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/test/Archives/Archive703.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive701.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive702.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17616-17617.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17616-17617.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17616-17617.diff	(revision 17802)
@@ -0,0 +1,42 @@
+Index: ../trunk-jpl/src/m/plot/processdata.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/processdata.py	(revision 17616)
++++ ../trunk-jpl/src/m/plot/processdata.py	(revision 17617)
+@@ -40,8 +40,10 @@
+ 		datasize=npy.shape(data)
+ 	
+ 	#process NaN's if any
+-	if options.exist('nan'):
+-		data[npy.isnan(data)]=options.getfieldvalue('nan',0)
++	nanfill=options.getfieldvalue('nan',0)
++	if npy.any(npy.isnan(data)):
++		data[npy.isnan(data)]=nanfill
++		print "WARNING: nan's treated as zeros by default.  Change using pairoption 'nan',nan_fill_value in plotmodel call"
+ 
+ 	#non-patch processing 
+ 
+Index: ../trunk-jpl/src/m/plot/plotmodel.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plotmodel.py	(revision 17616)
++++ ../trunk-jpl/src/m/plot/plotmodel.py	(revision 17617)
+@@ -24,6 +24,9 @@
+ 	figurenumber=options.figurenumber
+ 	numberofplots=options.numberofplots
+ 
++	#get hold
++	hold=options.list[0].getfieldvalue('hold',False)
++
+ 	#if nlines and ncols specified, then bypass
+ 	if options.list[0].exist('nlines'):
+ 		nlines=options.list[0].getfieldvalue('nlines')
+@@ -51,8 +54,8 @@
+ 		#UNLESS plotmodel is called within a script (e.g. a runme.py file) 
+ 		#handling the 'visible' option will need some check on whether ipython is currently in interactive or non-interactive mode
+ 
+-		#clear any previous plot window
+-		p.clf()
++		if not hold:
++			p.clf()
+ 
+ 		#if figsize specified
+ 		if options.list[0].exist('figsize'):
Index: issm/oecreview/Archive/16554-17801/ISSM-17617-17618.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17617-17618.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17617-17618.diff	(revision 17802)
@@ -0,0 +1,17 @@
+Index: ../trunk-jpl/src/m/plot/processdata.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/processdata.py	(revision 17617)
++++ ../trunk-jpl/src/m/plot/processdata.py	(revision 17618)
+@@ -40,10 +40,10 @@
+ 		datasize=npy.shape(data)
+ 	
+ 	#process NaN's if any
+-	nanfill=options.getfieldvalue('nan',0)
++	nanfill=options.getfieldvalue('nan',-999)
+ 	if npy.any(npy.isnan(data)):
+ 		data[npy.isnan(data)]=nanfill
+-		print "WARNING: nan's treated as zeros by default.  Change using pairoption 'nan',nan_fill_value in plotmodel call"
++		print "WARNING: nan's treated as -999 by default.  Change using pairoption 'nan',nan_fill_value in plotmodel call"
+ 
+ 	#non-patch processing 
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17618-17619.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17618-17619.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17618-17619.diff	(revision 17802)
@@ -0,0 +1,69 @@
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp	(revision 17618)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp	(revision 17619)
+@@ -18,13 +18,14 @@
+ 	Vector<IssmDouble>*  pf     = NULL;
+ 	Vector<IssmDouble>*  df     = NULL;
+ 	Vector<IssmDouble>*  ys     = NULL;
+-	int  configuration_type;
++	int  configuration_type,max_nonlinear_iterations;
+ 
+ 	/*Create analysis*/
+ 	StressbalanceAnalysis* analysis = new StressbalanceAnalysis();
+ 
+ 	/*Recover parameters: */
+ 	femmodel->parameters->FindParam(&configuration_type,ConfigurationTypeEnum);
++	femmodel->parameters->FindParam(&max_nonlinear_iterations,StressbalanceMaxiterEnum);
+ 
+ 	/*Update constraints and initialize d and tau if necessary*/
+ 	femmodel->UpdateConstraintsx();
+@@ -33,7 +34,7 @@
+ 	/*Convergence criterion*/
+ 	int        count   = 0;
+ 	IssmDouble eps_rel = .001;
+-	femmodel->parameters->SetParam(0.6,AugmentedLagrangianREnum);
++	femmodel->parameters->SetParam(.6,AugmentedLagrangianREnum);
+ 	GetSolutionFromInputsx(&ug,femmodel);
+ 
+ 	while(true){
+@@ -45,8 +46,18 @@
+ 		SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
+ 		CreateNodalConstraintsx(&ys,femmodel->nodes,configuration_type);
+ 		Reduceloadx(pf, Kfs, ys); delete Kfs;
++
++	//	pf->Echo();
++	//	IssmDouble* temp=Kff->ToSerial();
++	//	int m,n;
++	//	Kff->GetSize(&m,&n);
++	//	printarray(temp,m,n);
++	//	xDelete<IssmDouble>(temp);
++
+ 		Solverx(&uf, Kff, pf, NULL, df, femmodel->parameters); 
++		//uf->Echo();
+ 		delete Kff; delete pf; delete df;
++
+ 		Mergesolutionfromftogx(&ug, uf,ys,femmodel->nodes,femmodel->parameters);delete uf; delete ys;
+ 
+ 		/*Update solution*/
+@@ -70,7 +81,7 @@
+ 		}
+ 
+ 		count++;
+-		if(count>20) break;
++		if(count>=max_nonlinear_iterations) break;
+ 	}
+ 
+ 	delete ug;  
+Index: ../trunk-jpl/src/c/classes/Materials/Matice.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 17618)
++++ ../trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 17619)
+@@ -248,6 +248,7 @@
+ 		/*if no strain rate, return maximum viscosity*/
+ 		if(eps_eff==0.){
+ 			viscosity = 1.e+14/2.;
++			//viscosity = B;
+ 			//viscosity=2.5*pow(10.,17);
+ 		}
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17621-17622.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17621-17622.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17621-17622.diff	(revision 17802)
@@ -0,0 +1,471 @@
+Index: ../trunk-jpl/src/m/mech/thomasparams.py
+===================================================================
+--- ../trunk-jpl/src/m/mech/thomasparams.py	(revision 0)
++++ ../trunk-jpl/src/m/mech/thomasparams.py	(revision 17622)
+@@ -0,0 +1,145 @@
++import numpy as npy
++from averaging import averaging
++
++def thomasparams(md,**kwargs):
++	'''
++	compute Thomas' geometric parameters for an ice shelf 
++
++	This routine computes geometric parameters representing ratios between
++	components of the horizontal strain rate tensor for an ice shelf, as
++	originally developed in Thomas (1973).  The model must contain computed
++	strain rates, either from observed or modeled ice velocities.
++
++   Available options:
++	 -eq			: analytical equation to use in the calculation.  Must be one of:
++				'Thomas' for a 2D ice shelf, taking into account full strain rate
++					tensor (default)
++				'Weertman1D' for a confined ice shelf free to flow in one direction
++				'Weertman2D' for an unconfined ice shelf free to spread in any direction
++
++	 -smoothing	: an integer smoothing parameter for the averaging function
++						(default 0) Type 'help averaging' for more information on its usage.
++
++	 -coordsys	: coordinate system for calculating the strain rate
++						components. Must be one of:
++				'longitudinal': x axis aligned along a flowline at every point (default)
++				'principal': x axis aligned along maximum principal strain rate
++					at every point
++				'xy': x and y axes same as in polar stereographic projection 
++
++   Return values: 
++
++		'alpha' which is the ratio e_yy/e_xx between components of the strain
++		rate tensor
++
++		'beta' which is the ratio e_xy/e_xx between components of the strain rate
++		tensor
++
++		'theta' which is a combination of alpha and beta arising from the form of
++		the equivalent stress
++
++		'exx' is the strain rate along a coordinate system defined by 'coordsys' 
++
++		'sigxx' is the deviatoric stress along a coordinate system defined by 'coordsys' 
++
++   Usage: 
++		alpha,beta,theta,exx,sigxx=thomasparams(md)
++
++   Example: 
++		alpha,beta,theta,exx,sigxx=thomasparams(md,eq='Thomas',smoothing=2,coordsys='longitudinal')
++	'''
++
++	#unpack kwargs
++	eq=kwargs.pop('eq','Thomas')
++	if 'eq' in kwargs: del kwargs['eq']
++	smoothing=kwargs.pop('smoothing',0)
++	if 'smoothing' in kwargs: del kwargs['smoothing']
++	coordsys=kwargs.pop('coordsys','longitudinal')
++	if 'coordsys' in kwargs: del kwargs['coordsys']
++	assert len(kwargs)==0, 'error, unexpected or misspelled kwargs'
++
++	# some checks
++	if not hasattr(md.results,'strainrate'):
++		raise StandardError('md.results.strainrate not present.  Calculate using md=mechanicalproperties(md,vx,vy)')
++	if not '2d' in md.mesh.__doc__:
++		raise StandardError('only 2d (planview) model supported currently')
++	if any(md.flowequation.element_equation!=2):
++		raise StandardError('Warning: the model has some non-SSA elements.  These will be treated like SSA elements')
++
++	# average element strain rates onto vertices
++	e1=averaging(md,md.results.strainrate.principalvalue1,smoothing)/md.constants.yts # convert to s^-1
++	e2=averaging(md,md.results.strainrate.principalvalue2,smoothing)/md.constants.yts
++	exx=averaging(md,md.results.strainrate.xx,smoothing)/md.constants.yts
++	eyy=averaging(md,md.results.strainrate.yy,smoothing)/md.constants.yts
++	exy=averaging(md,md.results.strainrate.xy,smoothing)/md.constants.yts
++	
++	# checks: any of e1 or e2 equal to zero?
++	pos=npy.nonzero(e1==0)
++	if npy.any(pos==1):
++		print 'WARNING: first principal strain rate equal to zero.  Value set to 1e-13 s^-1'
++		e1[pos]=1.e-13
++	pos=npy.nonzero(e2==0)
++	if npy.any(pos==1):
++		print 'WARNING: second principal strain rate equal to zero.  Value set to 1e-13 s^-1'
++		e2[pos]=1.e-13
++	
++	# rheology
++	n=averaging(md,md.materials.rheology_n,0)
++	B=md.materials.rheology_B
++	
++	if coordsys=='principal':
++		b=npy.zeros((md.mesh.numberofvertices,))
++		ex=e1
++		a=e2/e1
++		pos=npy.nonzero(npy.logical_and(e1<0,e2>0)) # longitudinal compression and lateral tension
++		a[pos]=e1[pos]/e2[pos]
++		ex[pos]=e2[pos]
++		pos2=npy.nonzero(e1<0 & e2<0 & npy.abs(e1)<npy.abs(e2)) # lateral and longitudinal compression
++		a[pos2]=e1[pos2]/e2[pos2]
++		ex[pos2]=e2[pos2]
++		pos3=npy.nonzero(e1>0 & e2>0 & npy.abs(e1)<npy.abs(e2)) # lateral and longitudinal tension
++		a[pos3]=e1[pos3]/e2[pos3]
++		ex[pos3]=e2[pos3]
++		ind=npy.nonzero(e1<0 & e2<0)
++		a[ind]=-a[ind] # where both strain rates are compressive, enforce negative alpha
++		sigxx=(npy.abs(ex)/((1.+a+a**2)**((n-1.)/2.)))**(1./n)*B
++	elif coordsys=='xy':
++		ex=exx
++		a=eyy/exx
++		b=exy/exx
++	elif coordsys=='longitudinal':
++		# using longitudinal strain rates defined by observed velocity vector
++		velangle=npy.arctan(md.initialization.vy/md.initialization.vx)
++		pos=npy.nonzero(md.initialization.vx==0)
++		velangle[pos]=npy.pi/2
++		ex=0.5*(exx+eyy)+0.5*(exx-eyy)*npy.cos(2.*velangle)+exy*npy.sin(2.*velangle)
++		ey=exx+eyy-ex # trace of strain rate tensor is invariant
++		exy=-0.5*(exx-eyy)*npy.sin(2.*velangle)+exy*npy.cos(2.*velangle)
++		a=ey/ex
++		b=exy/ex
++		sigxx=abs(ex)**(1./n-1.)*ex/((1.+a+a**2+b**2)**((n-1.)/(2.*n)))*B
++	else:
++		raise ValueError('argument passed to "coordsys" not valid')
++	
++	# a < -1 in areas of strong lateral compression or longitudinal compression and
++	# theta flips sign at a = -2
++	pos=npy.nonzero(npy.abs((npy.abs(a)-2.))<1.e-3)
++	if len(pos)>0:
++		print 'Warning: ', len(pos), ' vertices have alpha within 1e-3 of -2'
++	a[pos]=-2+1e-3
++
++	if eq=='Weertman1D':
++		theta=1./8
++		a=npy.zeros((md.mesh.numberofvertices,))
++	elif eq=='Weertman2D':
++		theta=1./9
++		a=npy.ones((md.mesh.numberofvertices,1))
++	elif eq=='Thomas':
++		theta=((1.+a+a**2+b**2)**((n-1.)/2.))/(npy.abs(2.+a)**n)
++	else:
++		raise ValueError('argument passed to "eq" not valid')
++
++	alpha=a
++	beta=b
++
++	return alpha,beta,theta,ex
+Index: ../trunk-jpl/src/m/mech/damagefrominversion.py
+===================================================================
+--- ../trunk-jpl/src/m/mech/damagefrominversion.py	(revision 0)
++++ ../trunk-jpl/src/m/mech/damagefrominversion.py	(revision 17622)
+@@ -0,0 +1,32 @@
++import numpy as npy
++
++def damagefrominversion(md):
++	'''
++	compute ice shelf damage from inversion results
++
++	This routine computes damage based on the analytical formalism of Borstad et
++	al. (2013, The Cryosphere).  The model must contain inversion results for
++	ice rigidity.  Ice rigidity B is assumed to be parameterized by the ice
++	temperature in md.materials.rheology_B. 
++	
++	Usage:
++		damage=damagefrominversion(md)
++	
++	Example:
++		damage=damagefrominversion(md)
++	'''
++
++	# check inputs
++	if not hasattr(md.results,'strainrate'):
++		raise StandardError('md.results.strainrate is not present.  Calculate using md=mechanicalproperties(md,vx,vy)')
++	if not '2d' in md.mesh.__doc__:
++		raise StandardError('only 2d (planview) model supported currently')
++	if any(md.flowequation.element_equation!=2):
++		raise StandardError('Warning: the model has some non-SSA elements.  These will be treated like SSA elements')
++
++	damage=npy.zeros((md.mesh.numberofvertices,))
++	# Damage where Bi softer than B(T)
++	pos=npy.nonzero(md.results.StressbalanceSolution.MaterialsRheologyBbar<md.materials.rheology_B)
++	damage[pos]=1.-md.results.StressbalanceSolution.MaterialsRheologyBbar[pos]/md.materials.rheology_B[pos]
++
++	return damage
+Index: ../trunk-jpl/src/m/mech/mechanicalproperties.py
+===================================================================
+--- ../trunk-jpl/src/m/mech/mechanicalproperties.py	(revision 17621)
++++ ../trunk-jpl/src/m/mech/mechanicalproperties.py	(revision 17622)
+@@ -22,10 +22,10 @@
+ 	#some checks
+ 	if len(vx)!=md.mesh.numberofvertices or len(vy)!=md.mesh.numberofvertices:
+ 		raise ValueError('the input velocity should be of size ' + md.mesh.numberofvertices)
++	
++	#if md.mesh.dimension!=2:
++	#	raise StandardError('only 2D model supported currently')
+ 
+-	if md.mesh.dimension!=2:
+-		raise StandardError('only 2D model supported currently')
+-
+ 	if npy.any(md.flowequation.element_equation!=2):
+ 		print 'Warning: the model has some non SSA elements. These will be treated like SSA elements'
+ 
+Index: ../trunk-jpl/src/m/mech/analyticaldamage.py
+===================================================================
+--- ../trunk-jpl/src/m/mech/analyticaldamage.py	(revision 17621)
++++ ../trunk-jpl/src/m/mech/analyticaldamage.py	(revision 17622)
+@@ -1,9 +1,9 @@
+ import numpy as npy
+-from pairoptions import pairoptions
+ from averaging import averaging
+ from plotmodel import plotmodel
++from thomasparams import thomasparams
+ 
+-def analyticaldamage(md,*args):
++def analyticaldamage(md,**kwargs):
+ 	'''
+ 	ANALYTICALDAMAGE - compute damage for an ice shelf 
+ 	
+@@ -13,13 +13,15 @@
+ 		 either from observed or modeled ice velocities.
+ 	
+ 	   Available options:
+-			- 'eq'			: analytical equation to use in the calculation.  Must be one of:
++			-eq			: analytical equation to use in the calculation.  Must be one of:
+ 									'Weertman1D' for a confined ice shelf free to flow in one direction
+ 									'Weertman2D' for an unconfined ice shelf free to spread in any direction
+ 									'Thomas' for a 2D ice shelf, taking into account full strain rate tensor (default)
+-			- 'smoothing'	: the amount of smoothing to be applied to the strain rate data.
++			-smoothing	: the amount of smoothing to be applied to the strain rate data.
+ 									Type 'help averaging' for more information on its usage.
+-			- 'sigmab'		: a compressive backstress term to be subtracted from the driving stress 
++			-coordsys	: coordinate system for calculating the strain rate
++						components. Must be one of:
++			-sigmab		: a compressive backstress term to be subtracted from the driving stress 
+ 									in the damage calculation
+ 	
+ 	   Return values:
+@@ -33,79 +35,36 @@
+ 			(keeping damage within its appropriate limits, e.g. D in [0,1]).
+ 	
+ 	   Usage:
+-	      [damage,B,backstress]=analyticaldamage(md,options)
++	      damage,B,backstress=analyticaldamage(md,kwargs)
+ 	
+ 	   Example:
+-	      [damage,B,backstress]=analyticaldamage(md,'eq','Weertman2D','smoothing',2,'backstress',10e3)
++	      damage,B,backstress=analyticaldamage(md,eq='Weertman2D',smoothing=2,sigmab=10e3)
+ 	'''
+ 
++	#unpack kwargs
++	eq=kwargs.pop('eq','Thomas')
++	if 'eq' in kwargs: del kwargs['eq']
++	smoothing=kwargs.pop('smoothing',0)
++	if 'smoothing' in kwargs: del kwargs['smoothing']
++	coordsys=kwargs.pop('coordsys','longitudinal')
++	if 'coordsys' in kwargs: del kwargs['coordsys']
++	sigmab=kwargs.pop('sigmab',0)
++	if 'sigmab' in kwargs: del kwargs['sigmab']
++	assert len(kwargs)==0, 'error, unexpected or misspelled kwargs'
++
++	if len(sigmab)==1:
++		sigmab=sigmab*npy.ones((md.mesh.numberofvertices,))
++
+ 	# check inputs
+ 	if 'strainrate' not in md.results.__dict__:
+ 		raise StandardError('md.results.strainrate not present.  Calculate using md=mechanicalproperties(md,vx,vy)')
+-	if md.mesh.dimension!=2:
+-		raise StandardError('only 2D model supported currently')
++	if not '2d' in md.mesh.__doc__:
++		raise StandardError('only 2d (planview) model supported currently')
+ 	if npy.any(md.flowequation.element_equation!=2):
+ 		print 'Warning: the model has some non SSA elements. These will be treated like SSA elements'
+ 
+-	# process options
+-	options = pairoptions(*args)
+-	eq = options.getfieldvalue('eq','Thomas')
+-	smoothing = options.getfieldvalue('smoothing',0)
+-	sigmab = options.getfieldvalue('sigmab',0)
+-	if len(sigmab==1):
+-		sigmab=sigmab*npy.ones(md.mesh.numberofvertices,)
++	a,b,theta,ex=thomasparams(md,eq=eq,smoothing=smoothing,coordsys=coordsys)
+ 	
+-	# average element strain rates onto vertices
+-	e1=averaging(md,md.results.strainrate.principalvalue1,smoothing)/md.constants.yts # convert to s^-1
+-	e2=averaging(md,md.results.strainrate.principalvalue2,smoothing)/md.constants.yts
+-	exx=averaging(md,md.results.strainrate.xx,smoothing)/md.constants.yts
+-	eyy=averaging(md,md.results.strainrate.yy,smoothing)/md.constants.yts
+-	exy=averaging(md,md.results.strainrate.xy,smoothing)/md.constants.yts
+-	
+-	# checks: any of e1 or e2 equal to zero?
+-	pos=npy.nonzero(e1==0)
+-	if npy.any(pos==1):
+-		print 'WARNING: first principal strain rate equal to zero.  Value set to 1e-13 s^-1'
+-		e1[pos]=1e-13
+-	pos=npy.nonzero(e2==0)
+-	if npy.any(pos==1):
+-		disp('WARNING: second principal strain rate equal to zero.  Value set to 1e-13 s^-1');
+-		e2[pos]=1e-13
+-	
+-	## old method using principal strain rates {{{
+-	## ex=maximum principal tensile strain rate
+-	#ex=e1;
+-	#a=e2./e1;
+-	#pos=find(e1<0 & e2>0); # longitudinal compression and lateral tension
+-	#a(pos)=e1(pos)./e2(pos);
+-	#ex(pos)=e2(pos);
+-	#pos2=find(e1<0 & e2<0 & abs(e1)<abs(e2)); # lateral and longitudinal compression
+-	#a(pos2)=e1(pos2)./e2(pos2);
+-	#ex(pos2)=e2(pos2);
+-	#pos3=find(e1>0 & e2>0 & abs(e1)<abs(e2)); # lateral and longitudinal tension 
+-	#a(pos3)=e1(pos3)./e2(pos3);
+-	#ex(pos3)=e2(pos3);
+-	#id=find(e1<0 & e2<0);
+-	#a(id)=-a(id); # where both strain rates are compressive, enforce negative alpha
+-	#
+-	## }}}
+-	
+-	# new method using longitudinal strain rates defined by observed velocity vector
+-	velangle=npy.arctan(md.initialization.vy/md.initialization.vx)
+-	ex=0.5*(exx+eyy)+0.5*(exx-eyy)*npy.cos(2.*velangle)+exy*npy.sin(2.*velangle)
+-	ey=exx+eyy-ex # trace of strain rate tensor is invariant
+-	exy=-0.5*(exx-eyy)*npy.sin(2.*velangle)+exy*npy.cos(2.*velangle)
+-	a=ey/ex
+-	b=exy/ex
+-	pos=npy.nonzero(npy.logical_and(ex<0,ey<0))
+-	#length(pos)
+-	a[pos]=-a[pos]
+-	
+-	# a < -1 in areas of strong lateral compression or longitudinal compression
+-	# and theta is undefined at a = -2
+-	pos=npy.nonzero(abs((abs(a)-2))<1e-3)
+-	a[pos]=-2+1e-3
+-	
+ 	# spreading stress
+ 	rhoi=md.materials.rho_ice
+ 	rhow=md.materials.rho_water
+@@ -116,39 +75,31 @@
+ 	B=md.materials.rheology_B
+ 	n=averaging(md,md.materials.rheology_n,0)
+ 	
+-	if eq=='Weertman1D':
+-		theta=1./8*npy.ones(md.mesh.numberofvertices,)
+-		a=npy.zeros(md.mesh.numberofvertices,)
+-	elif eq=='Weertman2D':
+-		theta=1./9*npy.ones(md.mesh.numberofvertices,1)
+-		a=npy.ones(md.mesh.numberofvertices,)
+-	elif eq=='Thomas':
+-		theta=((1+a+a**2+b**2)**((n-1)/2))/(abs(2+a)**n)
+-	else:
+-		raise StandardError('argument passed to "eq" not valid.  Type "help analyticaldamage" for usage')
++	D=1.-(1.+a+a**2+b**2)**((n-1.)/(2.*n))/npy.abs(ex)**(1./n)*(T-sigmab)/B/(2.+a)/npy.sign(ex)
+ 	
+-	D=1-(1+a+a**2+b**2)**((n-1)/(2*n))/abs(ex)**(1./n)*(T-sigmab)/B/(2+a)/npy.sign(ex)
+-	
+-	backstress=npy.zeros(md.mesh.numberofvertices,)
+-	
+ 	# D>1 where (2+a).*sign(ex)<0, compressive regions where high backstress needed
+ 	pos=npy.nonzero(D>1)
+ 	D[pos]=0
+ 	
+-	# backstress to bring damage to zero
+-	backstress[pos]=T[pos]-(1-D[pos])*B[pos]*npy.sign(ex[pos])*(2+a[pos])*abs(ex[pos])**(1./n[pos])/(1+a[pos]+a[pos]**2)**((n[pos]-1)/2./n[pos])
++	backstress=npy.zeros((md.mesh.numberofvertices,))
+ 	
++	# backstress to bring D down to one 
++	backstress[pos]=T[pos]-(1.-D[pos])*B[pos]*npy.sign(ex[pos])*(2.+a[pos])*npy.abs(ex[pos])**(1./n[pos])/(1.+a[pos]+a[pos]**2)**((n[pos]-1.)/2./n[pos])
++	
+ 	pos=npy.nonzero(D<0)
++	#mask=ismember(1:md.mesh.numberofvertices,pos);
+ 	D[pos]=0
+-
++	
+ 	# backstress to bring negative damage to zero
+-	backstress[pos]=T[pos]-(1-D[pos])*B[pos]*npy.sign(ex[pos])*(2+a[pos])*abs(ex[pos])**(1./n[pos])/(1+a[pos]+a[pos]**2)**((n[pos]-1)/2./n[pos])
++	backstress[pos]=T[pos]-(1.-D[pos])*B[pos]*npy.sign(ex[pos])*(2.+a[pos])*npy.abs(ex[pos])**(1./n[pos])/(1.+a[pos]+a[pos]**2)**((n[pos]-1.)/2./n[pos])
+ 	
+ 	pos=npy.nonzero(backstress<0)
+ 	backstress[pos]=0
+ 	
+-	# increased rigidity to bring negative damage to zero
+-	B[pos]=npy.sign(ex[pos])/(2+a[pos])*(1+a[pos]+a[pos]**2)**((n[pos]-1)/2./n[pos])*T[pos]/abs(ex[pos])**(1./n[pos]);
++	# rigidity from Thomas relation for D=0 and backstress=0
++	B=npy.sign(ex)/(2.+a)*(1.+a+a**2)**((n-1.)/2./n)*T/(npy.abs(ex)**(1./n))
++	pos=npy.nonzero(B<0)
++	B[pos]=md.materials.rheology_B[pos]
+ 	
+ 	damage=D
+ 	
+Index: ../trunk-jpl/src/m/mech/backstressfrominversion.py
+===================================================================
+--- ../trunk-jpl/src/m/mech/backstressfrominversion.py	(revision 0)
++++ ../trunk-jpl/src/m/mech/backstressfrominversion.py	(revision 17622)
+@@ -0,0 +1,75 @@
++import numpy as npy
++from averaging import averaging
++from thomasparams import thomasparams
++
++def backstressfrominversion(md,**kwargs):
++	'''
++	Compute ice shelf backstress from inversion results.
++
++	This routine computes backstress based on the analytical formalism of
++	Thomas (1973) and Borstad et al. (2013, The Cryoshpere).  The model
++	must contain inversion results for ice rigidity.  Strain rates must
++	also be included, either from observed or modeled velocities.  Ice
++	rigidity B is assumed to be parameterized by the ice temperature in
++	md.materials.rheology_B.
++
++   Available options:
++		- 'tempmask'	: mask the inverted rigidity to be no more than
++							appropriate for the temperature of the ice?  
++							Boolean, defaults to false.
++		- 'smoothing'	: the amount of smoothing to be applied to the strain rate data.
++								Type 'help averaging' for more information on its
++								usage. Defaults to 0.
++		- 'coordsys'	: coordinate system for calculating the strain rate
++							components. Must be one of: 
++				'longitudinal': x axis aligned along a flowline at every point (default)
++				'principal': x axis aligned along maximum principal strain rate
++					at every point
++				'xy': x and y axes same as in polar stereographic projection 
++
++   Return values:
++		'backstress' is the inferred backstress necessary to balance the
++		analytical solution (keeping damage within its appropriate limits, e.g. D
++		in [0,1]).
++
++   Usage:
++      backstress=backstressfrominversion(md,options)
++
++   Example:
++      backstress=backstressfrominversion(md,'smoothing',2,'coordsys','longitudinal','tempmask',true);
++	'''
++
++	# unpack kwargs
++	tempmask=kwargs.pop('tempmask',False)
++	if 'tempmask' in kwargs: del kwargs['maxiter']
++	smoothing=kwargs.pop('smoothing',0)
++	if 'smoothing' in kwargs: del kwargs['smoothing']
++	coordsys=kwargs.pop('coordsys','longitudinal')
++	if 'coordsys' in kwargs: del kwargs['coordsys']
++	assert len(kwargs)==0, 'error, unexpected or misspelled kwargs'
++
++	# some checks
++	if not hasattr(md.results,'strainrate'):
++		raise StandardError('md.results.strainrate not present.  Calculate using md=mechanicalproperties(md,vx,vy)')
++	if not '2d' in md.mesh.__doc__:
++		raise StandardError('only 2d (planview) model supported currently')
++	if any(md.flowequation.element_equation!=2):
++		raise StandardError('Warning: the model has some non-SSA elements.  These will be treated like SSA elements')
++
++	T=0.5*md.materials.rho_ice*md.constants.g*(1-md.materials.rho_ice/md.materials.rho_water)*md.geometry.thickness
++	n=averaging(md,md.materials.rheology_n,0)
++	B=md.materials.rheology_B
++	Bi=md.results.StressbalanceSolution.MaterialsRheologyBbar.reshape(-1,)
++	
++	a0,b0,theta0,ex0=thomasparams(md,eq='Thomas',smoothing=smoothing,coordsys=coordsys)
++	
++	if tempmask:
++		Bi=md.results.StressbalanceSolution.MaterialsRheologyBbar
++		pos=npy.nonzero(Bi>md.materials.rheology_B)
++		Bi[pos]=md.materials.rheology_B[pos]
++	
++	# analytical backstress solution
++	backstress=T-Bi*npy.sign(ex0)*(2+a0)*npy.abs(ex0)**(1./n)/((1+a0+a0**2+b0**2)**((n-1.)/2./n))
++	backstress[npy.nonzero(backstress<0)]=0
++
++	return backstress
Index: issm/oecreview/Archive/16554-17801/ISSM-17622-17623.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17622-17623.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17622-17623.diff	(revision 17802)
@@ -0,0 +1,19 @@
+Index: ../trunk-jpl/src/c/classes/Elements/SegRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/SegRef.cpp	(revision 17622)
++++ ../trunk-jpl/src/c/classes/Elements/SegRef.cpp	(revision 17623)
+@@ -245,13 +245,9 @@
+ 	 * J is assumed to have been allocated of size 1*/
+ 
+ 	IssmDouble x1=xyz_list[3*0+0];
+-	IssmDouble y1=xyz_list[3*0+1];
+-	IssmDouble z1=xyz_list[3*0+2];
+ 	IssmDouble x2=xyz_list[3*1+0];
+-	IssmDouble y2=xyz_list[3*1+1];
+-	IssmDouble z2=xyz_list[3*1+2];
+ 
+-	*J=.5*sqrt(pow(x2-x1,2) + pow(y2-y1,2) + pow(z2-z1,2));
++	*J=.5*fabs(x2-x1);
+ }
+ /*}}}*/
+ /*FUNCTION SegRef::GetJacobianDeterminant{{{*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17623-17624.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17623-17624.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17623-17624.diff	(revision 17802)
@@ -0,0 +1,30 @@
+Index: ../trunk-jpl/src/m/mech/damagefrominversion.py
+===================================================================
+--- ../trunk-jpl/src/m/mech/damagefrominversion.py	(revision 17623)
++++ ../trunk-jpl/src/m/mech/damagefrominversion.py	(revision 17624)
+@@ -23,10 +23,22 @@
+ 		raise StandardError('only 2d (planview) model supported currently')
+ 	if any(md.flowequation.element_equation!=2):
+ 		raise StandardError('Warning: the model has some non-SSA elements.  These will be treated like SSA elements')
++	if npy.ndim(md.results.StressbalanceSolution.MaterialsRheologyBbar)==2:
++		Bi=md.results.StressbalanceSolution.MaterialsRheologyBbar.reshape(-1,)
++	else:
++		Bi=md.results.StressbalanceSolution.MaterialsRheologyBbar
++	if npy.ndim(md.materials.rheology_B)==2:
++		BT=md.materials.rheology_B.reshape(-1,)
++	else:
++		BT=md.materials.rheology_B
+ 
+-	damage=npy.zeros((md.mesh.numberofvertices,))
++	damage=npy.zeros_like(Bi)
++
+ 	# Damage where Bi softer than B(T)
+-	pos=npy.nonzero(md.results.StressbalanceSolution.MaterialsRheologyBbar<md.materials.rheology_B)
+-	damage[pos]=1.-md.results.StressbalanceSolution.MaterialsRheologyBbar[pos]/md.materials.rheology_B[pos]
++	pos=npy.nonzero(Bi<BT)[0]
++	damage[pos]=1.-Bi[pos]/BT[pos]
++	
++	pos=npy.nonzero(damage<0)
++	damage[pos]=0
+ 
+ 	return damage
Index: issm/oecreview/Archive/16554-17801/ISSM-17624-17625.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17624-17625.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17624-17625.diff	(revision 17802)
@@ -0,0 +1,8 @@
+Index: ../trunk-jpl/test/Archives/Archive703.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive702.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17625-17626.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17625-17626.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17625-17626.diff	(revision 17802)
@@ -0,0 +1,81 @@
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17625)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17626)
+@@ -1,3 +1,8 @@
++#ifdef HAVE_CONFIG_H
++   #include <config.h>
++#else
++#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
++#endif
+ #include "./LevelsetAnalysis.h"
+ #include "../toolkits/toolkits.h"
+ #include "../classes/classes.h"
+@@ -296,9 +301,7 @@
+ 		if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 		delete gauss;
+ 	}
+-	else
+-		for(i=0;i<numnodes;i++) 
+-			pe->values[i]=0.; 
++
+ 	return pe;
+ }/*}}}*/
+ void LevelsetAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h	(revision 17625)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h	(revision 17626)
+@@ -9,29 +9,29 @@
+ #include "./Analysis.h"
+ 
+ class LevelsetAnalysis: public Analysis{
+-	
+-public:
+-	/*Model processing*/
+-	int  DofsPerNode(int** doflist,int meshtype,int approximation);
+-	void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+-	void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+-	void CreateNodes(Nodes* nodes,IoModel* iomodel);
+-	void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+-	void CreateLoads(Loads* loads, IoModel* iomodel);
+ 
+-	/*Finite element Analysis*/
+-	void           Core(FemModel* femmodel);
+-	ElementVector* CreateDVector(Element* element);
+-	ElementMatrix* CreateJacobianMatrix(Element* element);
+-	ElementMatrix* CreateKMatrix(Element* element);
+-	ElementVector* CreatePVector(Element* element);
+-	void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+-	void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+-	void UpdateConstraints(FemModel* femmodel);
+-	void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+-	void GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+-	void SetDistanceOnIntersectedElements(FemModel* femmodel);
+-	void SetDistanceToZeroLevelsetElement(Vector<IssmDouble>* vec_signed_dist, Element* element);
+-	IssmDouble GetDistanceToStraight(IssmDouble* q, IssmDouble* s0, IssmDouble* s1);
++	public:
++		/*Model processing*/
++		int  DofsPerNode(int** doflist,int meshtype,int approximation);
++		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
++		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
++		void CreateNodes(Nodes* nodes,IoModel* iomodel);
++		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
++		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
++		ElementVector* CreateDVector(Element* element);
++		ElementMatrix* CreateJacobianMatrix(Element* element);
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
++		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void SetDistanceOnIntersectedElements(FemModel* femmodel);
++		void SetDistanceToZeroLevelsetElement(Vector<IssmDouble>* vec_signed_dist, Element* element);
++		IssmDouble GetDistanceToStraight(IssmDouble* q, IssmDouble* s0, IssmDouble* s1);
+ };
+ #endif
Index: issm/oecreview/Archive/16554-17801/ISSM-17626-17627.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17626-17627.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17626-17627.diff	(revision 17802)
@@ -0,0 +1,369 @@
+Index: ../trunk-jpl/src/c/toolkits/mpi/issmmpi.h
+===================================================================
+--- ../trunk-jpl/src/c/toolkits/mpi/issmmpi.h	(revision 17626)
++++ ../trunk-jpl/src/c/toolkits/mpi/issmmpi.h	(revision 17627)
+@@ -11,8 +11,9 @@
+ #else
+ #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+ #endif
+-
+ #include <cstddef>
++#include <cassert>
++#include "../../shared/Numerics/types.h"
+ 
+ #ifdef _HAVE_MPI_
+ 	/*Include header files: {{{*/
+@@ -82,6 +83,78 @@
+ 	#define ISSM_MPI_ANY_SOURCE    3
+ 	/*}}}*/
+ # endif 
++
++template <class T> ISSM_MPI_Datatype TypeToMPIType(){assert(false);};
++template <> inline ISSM_MPI_Datatype TypeToMPIType<IssmDouble>(){return ISSM_MPI_DOUBLE;};
++#if _HAVE_ADOLC_
++template <> inline ISSM_MPI_Datatype TypeToMPIType<IssmPDouble>(){return ISSM_MPI_PDOUBLE;};
++#endif
++template <> inline ISSM_MPI_Datatype TypeToMPIType<int>(){return ISSM_MPI_INT;};
++template <> inline ISSM_MPI_Datatype TypeToMPIType<char>(){return ISSM_MPI_CHAR;};
++template <class T> ISSM_MPI_Datatype ISSM_MPI_Reduce(T *sendbuf,T *recvbuf,int count,ISSM_MPI_Op op, int root, ISSM_MPI_Comm comm){ /*{{{*/
++
++	/*Get MPI type*/
++	ISSM_MPI_Datatype datatype = TypeToMPIType<T>();
++
++	int rc=0;
++#ifdef _HAVE_MPI_
++# ifdef _HAVE_AMPI_
++	rc=AMPI_Reduce(sendbuf,
++				recvbuf,
++				count,
++				datatype,
++				op,
++				root,
++				comm);
++# else
++	rc=MPI_Reduce(sendbuf,
++				recvbuf,
++				count,
++				datatype,
++				op,
++				root,
++				comm);
++# endif
++#else
++# ifdef _HAVE_ADOLC_
++	if (datatype==ISSM_MPI_DOUBLE) { 
++		IssmDouble* activeSendBuf=(IssmDouble*)sendbuf;
++		IssmDouble* activeRecvBuf=(IssmDouble*)recvbuf;
++		for(int i=0;i<count;++i) activeRecvBuf[i]=activeSendBuf[i];
++	}
++	else 
++# endif
++	 memcpy(recvbuf,sendbuf,sizeHelper(datatype)*count);
++#endif
++	return rc;
++}/*}}}*/
++template <class T> int ISSM_MPI_Bcast(T *buffer, int count,int root, ISSM_MPI_Comm comm){  /*{{{*/
++
++	int rc=0;
++
++	/*Get MPI type*/
++	ISSM_MPI_Datatype datatype = TypeToMPIType<T>();
++
++#ifdef _HAVE_MPI_
++# ifdef _HAVE_AMPI_
++	rc=AMPI_Bcast(buffer, 
++				count,
++				datatype,
++				root,
++				comm);
++# else
++	rc=MPI_Bcast(buffer, 
++				count,
++				datatype,
++				root,
++				comm);
++# endif
++#else 
++	// nothing to be done here 
++#endif
++	return rc;
++}/*}}}*/
++
+ /* interfaces  {{{*/
+ int ISSM_MPI_Allgather(void *sendbuf, int sendcount, ISSM_MPI_Datatype sendtype, void *recvbuf, int recvcount, ISSM_MPI_Datatype recvtype, ISSM_MPI_Comm comm);
+ int ISSM_MPI_Allgatherv(void *sendbuf, int sendcount, ISSM_MPI_Datatype sendtype, void *recvbuf, int *recvcounts, int *displs, ISSM_MPI_Datatype recvtype, ISSM_MPI_Comm comm); 
+Index: ../trunk-jpl/src/c/classes/IoModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 17626)
++++ ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 17627)
+@@ -444,7 +444,7 @@
+ 
+ 				/*Ok, we have reached the end of the file. break: */
+ 				record_code=0; //0 means bailout
+-				ISSM_MPI_Bcast(&record_code,1,ISSM_MPI_INT,0,IssmComm::GetComm());  /*tell others cpus we are bailing: */
++				ISSM_MPI_Bcast<int>(&record_code,1,0,IssmComm::GetComm());  /*tell others cpus we are bailing: */
+ 				break;
+ 			}
+ 			else{
+@@ -652,7 +652,7 @@
+ 	if(my_rank==0){  
+ 		if(fread(&booleanint,sizeof(int),1,fid)!=1) _error_("could not read boolean ");
+ 	}
+-	ISSM_MPI_Bcast(&booleanint,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
++	ISSM_MPI_Bcast<int>(&booleanint,1,0,IssmComm::GetComm()); 
+ 
+ 	/*cast to bool: */
+ 	/*Assign output pointers: */
+@@ -682,7 +682,7 @@
+ 		if(fread(&integer,sizeof(int),1,fid)!=1) _error_("could not read integer ");
+ 	}
+ 
+-	ISSM_MPI_Bcast(&integer,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
++	ISSM_MPI_Bcast<int>(&integer,1,0,IssmComm::GetComm()); 
+ 
+ 	/*Assign output pointers: */
+ 	*pinteger=integer;
+@@ -709,7 +709,7 @@
+ 	if(my_rank==0){
+ 		if(fread(&scalar,sizeof(IssmPDouble),1,fid)!=1)_error_("could not read scalar ");
+ 	}
+-	ISSM_MPI_Bcast(&scalar,1,ISSM_MPI_PDOUBLE,0,IssmComm::GetComm()); 
++	ISSM_MPI_Bcast<IssmPDouble>(&scalar,1,0,IssmComm::GetComm()); 
+ 
+ 	/*Assign output pointers: */
+ 	*pscalar=scalar;
+@@ -741,7 +741,7 @@
+ 		if(fread(&string_size,sizeof(int),1,fid)!=1) _error_("could not read length of string ");
+ 	}
+ 
+-	ISSM_MPI_Bcast(&string_size,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
++	ISSM_MPI_Bcast<int>(&string_size,1,0,IssmComm::GetComm()); 
+ 
+ 	/*Now allocate string: */
+ 	if(string_size){
+@@ -752,7 +752,7 @@
+ 		if(my_rank==0){  
+ 			if(fread(string,string_size*sizeof(char),1,fid)!=1)_error_(" could not read string ");
+ 		}
+-		ISSM_MPI_Bcast(string,string_size,ISSM_MPI_CHAR,0,IssmComm::GetComm()); 
++		ISSM_MPI_Bcast<char>(string,string_size,0,IssmComm::GetComm()); 
+ 	}
+ 	else{
+ 		string=xNew<char>(1);
+@@ -791,12 +791,12 @@
+ 		if(fread(&M,sizeof(int),1,fid)!=1) _error_("could not read number of rows for matrix ");
+ 	}
+ 
+-	ISSM_MPI_Bcast(&M,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
++	ISSM_MPI_Bcast<int>(&M,1,0,IssmComm::GetComm()); 
+ 
+ 	if(my_rank==0){  
+ 		if(fread(&N,sizeof(int),1,fid)!=1) _error_("could not read number of columns for matrix ");
+ 	}
+-	ISSM_MPI_Bcast(&N,1,ISSM_MPI_INT,0,IssmComm::GetComm());
++	ISSM_MPI_Bcast<int>(&N,1,0,IssmComm::GetComm());
+ 
+ 	/*Now allocate matrix: */
+ 	if(M*N){
+@@ -807,7 +807,7 @@
+ 			if(fread(matrix,M*N*sizeof(IssmPDouble),1,fid)!=1) _error_("could not read matrix ");
+ 		}
+ 
+-		ISSM_MPI_Bcast(matrix,M*N,ISSM_MPI_PDOUBLE,0,IssmComm::GetComm()); 
++		ISSM_MPI_Bcast<IssmPDouble>(matrix,M*N,0,IssmComm::GetComm()); 
+ 	}
+ 
+ 	/*Now cast to integer: */
+@@ -856,12 +856,12 @@
+ 	if(my_rank==0){  
+ 		if(fread(&M,sizeof(int),1,fid)!=1) _error_("could not read number of rows for matrix ");
+ 	}
+-	ISSM_MPI_Bcast(&M,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
++	ISSM_MPI_Bcast<int>(&M,1,0,IssmComm::GetComm()); 
+ 
+ 	if(my_rank==0){  
+ 		if(fread(&N,sizeof(int),1,fid)!=1) _error_("could not read number of columns for matrix ");
+ 	}
+-	ISSM_MPI_Bcast(&N,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
++	ISSM_MPI_Bcast<int>(&N,1,0,IssmComm::GetComm()); 
+ 
+ 	/*Now allocate matrix: */
+ 	if(M*N){
+@@ -871,7 +871,7 @@
+ 		if(my_rank==0){  
+ 			if(fread(matrix,M*N*sizeof(IssmPDouble),1,fid)!=1) _error_("could not read matrix ");
+ 		}
+-		ISSM_MPI_Bcast(matrix,M*N,ISSM_MPI_PDOUBLE,0,IssmComm::GetComm()); 
++		ISSM_MPI_Bcast<IssmPDouble>(matrix,M*N,0,IssmComm::GetComm()); 
+ 
+ 		_assert_(this->independents);
+ 		if(this->independents[data_enum]){
+@@ -920,7 +920,7 @@
+ 	if(my_rank==0){  
+ 		if(fread(&numstrings,sizeof(int),1,fid)!=1) _error_("could not read length of string array");
+ 	}
+-	ISSM_MPI_Bcast(&numstrings,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
++	ISSM_MPI_Bcast<int>(&numstrings,1,0,IssmComm::GetComm()); 
+ 
+ 	/*Now allocate string array: */
+ 	if(numstrings){
+@@ -933,7 +933,7 @@
+ 			if(my_rank==0){  
+ 				if(fread(&string_size,sizeof(int),1,fid)!=1) _error_("could not read length of string ");
+ 			}
+-			ISSM_MPI_Bcast(&string_size,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
++			ISSM_MPI_Bcast<int>(&string_size,1,0,IssmComm::GetComm()); 
+ 			if(string_size){
+ 				string=xNew<char>((string_size+1));
+ 				string[string_size]='\0';
+@@ -942,7 +942,7 @@
+ 				if(my_rank==0){  
+ 					if(fread(string,string_size*sizeof(char),1,fid)!=1)_error_(" could not read string ");
+ 				}
+-				ISSM_MPI_Bcast(string,string_size,ISSM_MPI_CHAR,0,IssmComm::GetComm()); 
++				ISSM_MPI_Bcast<char>(string,string_size,0,IssmComm::GetComm()); 
+ 			}
+ 			else{
+ 				string=xNew<char>(1);
+@@ -987,7 +987,7 @@
+ 	if(my_rank==0){  
+ 		if(fread(&numrecords,sizeof(int),1,fid)!=1) _error_("could not read number of records in matrix array ");
+ 	}
+-	ISSM_MPI_Bcast(&numrecords,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
++	ISSM_MPI_Bcast<int>(&numrecords,1,0,IssmComm::GetComm()); 
+ 
+ 	if(numrecords){
+ 
+@@ -1008,12 +1008,12 @@
+ 			if(my_rank==0){  
+ 				if(fread(&M,sizeof(int),1,fid)!=1) _error_("could not read number of rows in " << i << "th matrix of matrix array");
+ 			}
+-			ISSM_MPI_Bcast(&M,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
++			ISSM_MPI_Bcast<int>(&M,1,0,IssmComm::GetComm()); 
+ 
+ 			if(my_rank==0){  
+ 				if(fread(&N,sizeof(int),1,fid)!=1) _error_("could not read number of columns in " << i << "th matrix of matrix array");
+ 			}
+-			ISSM_MPI_Bcast(&N,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
++			ISSM_MPI_Bcast<int>(&N,1,0,IssmComm::GetComm()); 
+ 
+ 			/*Now allocate matrix: */
+ 			if(M*N){
+@@ -1024,7 +1024,7 @@
+ 					if(fread(matrix,M*N*sizeof(IssmPDouble),1,fid)!=1) _error_("could not read matrix ");
+ 				}
+ 
+-				ISSM_MPI_Bcast(matrix,M*N,ISSM_MPI_PDOUBLE,0,IssmComm::GetComm()); 
++				ISSM_MPI_Bcast<IssmPDouble>(matrix,M*N,0,IssmComm::GetComm()); 
+ 				matrices[i]=xNew<IssmDouble>(M*N);
+ 				for (int j=0;j<M*N;++j) {matrices[i][j]=matrix[j];}
+ 				xDelete<IssmPDouble>(matrix);
+@@ -1168,7 +1168,7 @@
+ 				if(fread(&string_size,sizeof(int),1,fid)!=1) _error_("could not read length of string ");
+ 			}
+ 
+-			ISSM_MPI_Bcast(&string_size,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
++			ISSM_MPI_Bcast<int>(&string_size,1,0,IssmComm::GetComm()); 
+ 
+ 			/*Now allocate string: */
+ 			if(string_size){
+@@ -1179,7 +1179,7 @@
+ 				if(my_rank==0){
+ 					if(fread(string,string_size*sizeof(char),1,fid)!=1)_error_(" could not read string ");
+ 				}
+-				ISSM_MPI_Bcast(string,string_size,ISSM_MPI_CHAR,0,IssmComm::GetComm()); 
++				ISSM_MPI_Bcast<char>(string,string_size,0,IssmComm::GetComm()); 
+ 			}
+ 			else{
+ 				string=xNew<char>(1);
+@@ -1235,7 +1235,7 @@
+ 					if(fread(&integer,sizeof(int),1,fid)!=1) _error_("could not read integer ");
+ 				}
+ 			}
+-			ISSM_MPI_Bcast(&integer,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
++			ISSM_MPI_Bcast<int>(&integer,1,0,IssmComm::GetComm()); 
+ 
+ 			/*Assign: */
+ 			vector[i]=integer;
+@@ -1294,12 +1294,12 @@
+ 				fsetpos(fid,file_positions+i);
+ 				if(fread(&M,sizeof(int),1,fid)!=1) _error_("could not read number of rows for matrix ");
+ 			}
+-			ISSM_MPI_Bcast(&M,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
++			ISSM_MPI_Bcast<int>(&M,1,0,IssmComm::GetComm()); 
+ 
+ 			if(my_rank==0){  
+ 				if(fread(&N,sizeof(int),1,fid)!=1) _error_("could not read number of columns for matrix ");
+ 			}
+-			ISSM_MPI_Bcast(&N,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
++			ISSM_MPI_Bcast<int>(&N,1,0,IssmComm::GetComm()); 
+ 
+ 
+ 			/*Now allocate matrix: */
+@@ -1310,7 +1310,7 @@
+ 				if(my_rank==0){  
+ 					if(fread(pmatrix,M*N*sizeof(IssmPDouble),1,fid)!=1) _error_("could not read matrix ");
+ 				}
+-				ISSM_MPI_Bcast(pmatrix,M*N,ISSM_MPI_PDOUBLE,0,IssmComm::GetComm()); 
++				ISSM_MPI_Bcast<IssmPDouble>(pmatrix,M*N,0,IssmComm::GetComm()); 
+ 
+ 				_assert_(this->independents);
+ 				if(this->independents[data_enum]){
+@@ -1400,12 +1400,12 @@
+ 				fsetpos(fid,file_positions+i);
+ 				if(fread(&M,sizeof(int),1,fid)!=1) _error_("could not read number of rows for matrix ");
+ 			}
+-			ISSM_MPI_Bcast(&M,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
++			ISSM_MPI_Bcast<int>(&M,1,0,IssmComm::GetComm()); 
+ 
+ 			if(my_rank==0){  
+ 				if(fread(&N,sizeof(int),1,fid)!=1) _error_("could not read number of columns for matrix ");
+ 			}
+-			ISSM_MPI_Bcast(&N,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
++			ISSM_MPI_Bcast<int>(&N,1,0,IssmComm::GetComm()); 
+ 
+ 
+ 			/*Now allocate matrix: */
+@@ -1417,7 +1417,7 @@
+ 				if(my_rank==0){  
+ 					if(fread(pmatrix,M*N*sizeof(IssmPDouble),1,fid)!=1) _error_("could not read matrix ");
+ 				}
+-				ISSM_MPI_Bcast(pmatrix,M*N,ISSM_MPI_PDOUBLE,0,IssmComm::GetComm()); 
++				ISSM_MPI_Bcast<IssmPDouble>(pmatrix,M*N,0,IssmComm::GetComm()); 
+ 
+ 				_assert_(this->independents);
+ 				if(this->independents[data_enum]){
+@@ -1593,7 +1593,7 @@
+ 		}
+ 	}
+ 	/*Broadcast code and vector type: */
+-	ISSM_MPI_Bcast(&lastindex,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
++	ISSM_MPI_Bcast<int>(&lastindex,1,0,IssmComm::GetComm()); 
+ 
+ 	/*Assign output pointers:*/
+ 	*pindex=lastindex;
+@@ -1649,12 +1649,12 @@
+ 			}
+ 		}
+ 	}
+-	ISSM_MPI_Bcast(&found,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
++	ISSM_MPI_Bcast<int>(&found,1,0,IssmComm::GetComm()); 
+ 	if(!found)_error_("could not find data with name " << EnumToStringx(data_enum) << " in binary file");
+ 
+ 	/*Broadcast code and vector type: */
+-	ISSM_MPI_Bcast(&record_code,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+-	ISSM_MPI_Bcast(&vector_type,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
++	ISSM_MPI_Bcast<int>(&record_code,1,0,IssmComm::GetComm()); 
++	ISSM_MPI_Bcast<int>(&vector_type,1,0,IssmComm::GetComm()); 
+ 
+ 	/*Assign output pointers:*/
+ 	*pcode=record_code;
+@@ -1753,7 +1753,7 @@
+ 	}
+ 
+ 	/*Broadcast data: */
+-	ISSM_MPI_Bcast(&num_instances,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
++	ISSM_MPI_Bcast<int>(&num_instances,1,0,IssmComm::GetComm()); 
+ 
+ 	/*Assign output pointers:*/
+ 	*pcodes         = codes;
Index: issm/oecreview/Archive/16554-17801/ISSM-17627-17628.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17627-17628.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17627-17628.diff	(revision 17802)
@@ -0,0 +1,77 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17627)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17628)
+@@ -3502,46 +3502,46 @@
+ 		if(dim==2){
+ 			for(int i=0;i<vnumnodes;i++){
+ 				for(int j=0;j<tnumnodes;j++){
+-					Dstar[(i*dim+0)*tausize*tnumnodes + j*tausize+0] = tbasis[j]*vdbasis[0*vnumnodes+i];
+-					Dstar[(i*dim+0)*tausize*tnumnodes + j*tausize+2] = tbasis[j]*vdbasis[1*vnumnodes+i];
++					Dstar[(i*dim+0)*tausize*tnumnodes + j*tausize+0] += gauss->weight*Jdet*tbasis[j]*vdbasis[0*vnumnodes+i];
++					Dstar[(i*dim+0)*tausize*tnumnodes + j*tausize+2] += gauss->weight*Jdet*tbasis[j]*vdbasis[1*vnumnodes+i];
+ 
+-					Dstar[(i*dim+1)*tausize*tnumnodes + j*tausize+1] = tbasis[j]*vdbasis[1*vnumnodes+i];
+-					Dstar[(i*dim+1)*tausize*tnumnodes + j*tausize+2] = tbasis[j]*vdbasis[0*vnumnodes+i];
++					Dstar[(i*dim+1)*tausize*tnumnodes + j*tausize+1] += gauss->weight*Jdet*tbasis[j]*vdbasis[1*vnumnodes+i];
++					Dstar[(i*dim+1)*tausize*tnumnodes + j*tausize+2] += gauss->weight*Jdet*tbasis[j]*vdbasis[0*vnumnodes+i];
+ 				}
+ 			}
+ 		}
+ 		else{
+ 			for(int i=0;i<vnumnodes;i++){
+ 				for(int j=0;j<tnumnodes;j++){
+-					Dstar[(i*dim+0)*tausize*tnumnodes + j*tausize+0] = tbasis[j]*vdbasis[0*vnumnodes+i];
+-					Dstar[(i*dim+0)*tausize*tnumnodes + j*tausize+3] = tbasis[j]*vdbasis[1*vnumnodes+i];
+-					Dstar[(i*dim+0)*tausize*tnumnodes + j*tausize+4] = tbasis[j]*vdbasis[2*vnumnodes+i];
++					Dstar[(i*dim+0)*tausize*tnumnodes + j*tausize+0] += gauss->weight*Jdet*tbasis[j]*vdbasis[0*vnumnodes+i];
++					Dstar[(i*dim+0)*tausize*tnumnodes + j*tausize+3] += gauss->weight*Jdet*tbasis[j]*vdbasis[1*vnumnodes+i];
++					Dstar[(i*dim+0)*tausize*tnumnodes + j*tausize+4] += gauss->weight*Jdet*tbasis[j]*vdbasis[2*vnumnodes+i];
+ 
+-					Dstar[(i*dim+1)*tausize*tnumnodes + j*tausize+1] = tbasis[j]*vdbasis[1*vnumnodes+i];
+-					Dstar[(i*dim+1)*tausize*tnumnodes + j*tausize+3] = tbasis[j]*vdbasis[0*vnumnodes+i];
+-					Dstar[(i*dim+1)*tausize*tnumnodes + j*tausize+5] = tbasis[j]*vdbasis[2*vnumnodes+i];
++					Dstar[(i*dim+1)*tausize*tnumnodes + j*tausize+1] += gauss->weight*Jdet*tbasis[j]*vdbasis[1*vnumnodes+i];
++					Dstar[(i*dim+1)*tausize*tnumnodes + j*tausize+3] += gauss->weight*Jdet*tbasis[j]*vdbasis[0*vnumnodes+i];
++					Dstar[(i*dim+1)*tausize*tnumnodes + j*tausize+5] += gauss->weight*Jdet*tbasis[j]*vdbasis[2*vnumnodes+i];
+ 
+-					Dstar[(i*dim+2)*tausize*tnumnodes + j*tausize+2] = tbasis[j]*vdbasis[2*vnumnodes+i];
+-					Dstar[(i*dim+2)*tausize*tnumnodes + j*tausize+4] = tbasis[j]*vdbasis[0*vnumnodes+i];
+-					Dstar[(i*dim+2)*tausize*tnumnodes + j*tausize+5] = tbasis[j]*vdbasis[1*vnumnodes+i];
++					Dstar[(i*dim+2)*tausize*tnumnodes + j*tausize+2] += gauss->weight*Jdet*tbasis[j]*vdbasis[2*vnumnodes+i];
++					Dstar[(i*dim+2)*tausize*tnumnodes + j*tausize+4] += gauss->weight*Jdet*tbasis[j]*vdbasis[0*vnumnodes+i];
++					Dstar[(i*dim+2)*tausize*tnumnodes + j*tausize+5] += gauss->weight*Jdet*tbasis[j]*vdbasis[1*vnumnodes+i];
+ 				}
+ 			}
+ 		}
++	}
+ 
+-		/*contribution -Dstar tau*/
+-		for(i=0;i<tausize*tnumnodes;i++) D[i*(tausize*tnumnodes)+i] = -gauss->weight*Jdet;
+-		TripleMultiply(Dstar,dim*tnumnodes,tausize*tnumnodes,0,
+-					D,tausize*tnumnodes,tausize*tnumnodes,0,
+-					tau,tausize*tnumnodes,1,0,
+-					&pe->values[0],1);
++	/*contribution -Dstar tau*/
++	for(i=0;i<tausize*tnumnodes;i++) D[i*(tausize*tnumnodes)+i] = -1.;
++	TripleMultiply(Dstar,dim*vnumnodes,tausize*tnumnodes,0,
++				D,tausize*tnumnodes,tausize*tnumnodes,0,
++				tau,tausize*tnumnodes,1,0,
++				&pe->values[0],1);
+ 
+-		/*contribution + r Dstar d*/
+-		for(i=0;i<tausize*tnumnodes;i++) D[i*(tausize*tnumnodes)+i] = +r*gauss->weight*Jdet;
+-		TripleMultiply(Dstar,dim*tnumnodes,tausize*tnumnodes,0,
+-					D,tausize*tnumnodes,tausize*tnumnodes,0,
+-					d,tausize*tnumnodes,1,0,
+-					&pe->values[0],1);
+-	}
++	/*contribution + r Dstar d*/
++	for(i=0;i<tausize*tnumnodes;i++) D[i*(tausize*tnumnodes)+i] = +r;
++	TripleMultiply(Dstar,dim*vnumnodes,tausize*tnumnodes,0,
++				D,tausize*tnumnodes,tausize*tnumnodes,0,
++				d,tausize*tnumnodes,1,0,
++				&pe->values[0],1);
+ 
+ 	/*Transform coordinate system*/
+ 	element->TransformLoadVectorCoord(pe,cs_list);
Index: issm/oecreview/Archive/16554-17801/ISSM-17628-17629.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17628-17629.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17628-17629.diff	(revision 17802)
@@ -0,0 +1,131 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17628)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17629)
+@@ -3551,7 +3551,7 @@
+ 	xDelete<int>(cs_list);
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(Dstar);
+-	xDelete<IssmDouble>(d);
++xDelete<IssmDouble>(d);
+ 	xDelete<IssmDouble>(D);
+ 	xDelete<IssmDouble>(tau);
+ 	xDelete<IssmDouble>(vdbasis);
+@@ -4243,6 +4243,7 @@
+ 	/*Intermediaries*/
+ 	int         dim,tausize,meshtype;
+ 	IssmDouble  epsxx,epsyy,epszz,epsxy,epsxz,epsyz,D_scalar;
++	IssmDouble  epsxx_old,epsyy_old,epszz_old,epsxy_old,epsxz_old,epsyz_old;
+ 	IssmDouble  sigmapxx,sigmapyy,sigmapzz,sigmapxy,sigmapxz,sigmapyz;
+ 	IssmDouble  dvx[3],dvy[3],dvz[3],B,n;
+ 	IssmDouble *xyz_list = NULL;
+@@ -4286,6 +4287,17 @@
+ 			pe_yz = xNewZeroInit<IssmDouble>(tnumnodes);
+ 		}
+ 
++		/*Get previous d*/
++		Input* epsxx_input=element->GetInput(StrainRatexxEnum); _assert_(epsxx_input);
++		Input* epsyy_input=element->GetInput(StrainRateyyEnum); _assert_(epsyy_input);
++		Input* epsxy_input=element->GetInput(StrainRatexyEnum); _assert_(epsxy_input);
++		Input* epszz_input=NULL; Input* epsxz_input=NULL; Input* epsyz_input=NULL;
++		if(dim==3){
++			epszz_input=element->GetInput(StrainRatezzEnum); _assert_(epszz_input);
++			epsxz_input=element->GetInput(StrainRatexzEnum); _assert_(epsxz_input);
++			epsyz_input=element->GetInput(StrainRateyzEnum); _assert_(epsyz_input);
++		}
++
+ 		/*Get tau*/
+ 		Input* sigmapxx_input=element->GetInput(DeviatoricStressxxEnum); _assert_(sigmapxx_input);
+ 		Input* sigmapyy_input=element->GetInput(DeviatoricStressyyEnum); _assert_(sigmapyy_input);
+@@ -4313,6 +4325,16 @@
+ 				sigmapyz_input->GetInputValue(&sigmapyz,gauss);
+ 			}
+ 
++			/*Get previous d*/
++			epsxx_input->GetInputValue(&epsxx_old,gauss);
++			epsyy_input->GetInputValue(&epsyy_old,gauss);
++			epsxy_input->GetInputValue(&epsxy_old,gauss);
++			if(dim==3){
++				epszz_input->GetInputValue(&epszz_old,gauss);
++				epsxz_input->GetInputValue(&epsxz_old,gauss);
++				epsyz_input->GetInputValue(&epsyz_old,gauss);
++			}
++
+ 			/*Calculate d from previous results*/
+ 			vx_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
+ 			vy_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
+@@ -4332,7 +4354,7 @@
+ 			IssmDouble coef1,coef2,coef3;
+ 			B_input->GetInputValue(&B,gauss);
+ 			n_input->GetInputValue(&n,gauss);
+-			coef1 = (B/2.)*pow(1./sqrt(2.),(1.-n)/n); //2 eta_0
++			coef1 = B*pow(1./sqrt(2.),(1.-n)/n); //2 eta_0 = 2 * B/(2* (1/sqrt(2)  )^(n-1)/n ) 
+ 			coef2 = r;
+ 			if(dim==2){
+ 				coef3 = sqrt(
+@@ -4352,7 +4374,14 @@
+ 							);
+ 			}
+ 			IssmDouble dnorm;
+-			NewtonSolveDnorm(&dnorm,coef1,coef2,coef3,n);
++			if(dim==2){
++				dnorm = sqrt( epsxx_old*epsxx_old + epsyy_old*epsyy_old + 2.*epsxy_old*epsxy_old );
++			}
++			else{
++				dnorm = sqrt( epsxx_old*epsxx_old + epsyy_old*epsyy_old + epszz_old*epszz_old 
++							+2.*(epsxy_old*epsxy_old + epsxz_old*epsxz_old + epsyz_old*epsyz_old));
++			}
++			NewtonSolveDnorm(&dnorm,coef1,coef2,coef3,n,dnorm);
+ 
+ 			/*Create Ke*/
+ 			D_scalar=(coef1*pow(dnorm,(1.-n)/n)+r)*gauss->weight*Jdet;
+@@ -4411,15 +4440,6 @@
+ 		IssmDouble* tau_zz = NULL;
+ 		IssmDouble* tau_xz = NULL;
+ 		IssmDouble* tau_yz = NULL;
+-		Input* epsxx_input=element->GetInput(StrainRatexxEnum); _assert_(epsxx_input);
+-		Input* epsyy_input=element->GetInput(StrainRateyyEnum); _assert_(epsyy_input);
+-		Input* epsxy_input=element->GetInput(StrainRatexyEnum); _assert_(epsxy_input);
+-		Input* epszz_input=NULL; Input* epsxz_input=NULL; Input* epsyz_input=NULL;
+-		if(dim==3){
+-			epszz_input=element->GetInput(StrainRatezzEnum); _assert_(epszz_input);
+-			epsxz_input=element->GetInput(StrainRatexzEnum); _assert_(epsxz_input);
+-			epsyz_input=element->GetInput(StrainRateyzEnum); _assert_(epsyz_input);
+-		}
+ 		delete gauss;
+ 		gauss = element->NewGauss();
+ 		for(int ig=0;ig<tnumnodes;ig++){
+Index: ../trunk-jpl/src/c/shared/Numerics/NewtonSolveDnorm.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Numerics/NewtonSolveDnorm.cpp	(revision 17628)
++++ ../trunk-jpl/src/c/shared/Numerics/NewtonSolveDnorm.cpp	(revision 17629)
+@@ -2,7 +2,7 @@
+ #include "./types.h"
+ #include "../Exceptions/exceptions.h"
+ 
+-int NewtonSolveDnorm(IssmDouble* pdnorm,IssmDouble c1,IssmDouble c2,IssmDouble c3,IssmDouble n){
++int NewtonSolveDnorm(IssmDouble* pdnorm,IssmDouble c1,IssmDouble c2,IssmDouble c3,IssmDouble n,IssmDouble dnorm){
+ 	/* solve the following equation using Newton-Raphson
+ 	 *
+ 	 *   c1*x^(s-1) + c2*x = c3
+@@ -25,7 +25,7 @@
+ 	IssmDouble threshold = 1.e-12;
+ 
+ 	/*Initial guess*/
+-	IssmDouble y1 = 0.;
++	IssmDouble y1 = log10(dnorm);
+ 
+ 	while(true){
+ 
+Index: ../trunk-jpl/src/c/shared/Numerics/numerics.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Numerics/numerics.h	(revision 17628)
++++ ../trunk-jpl/src/c/shared/Numerics/numerics.h	(revision 17629)
+@@ -37,6 +37,6 @@
+ void        XZvectorsToCoordinateSystem(IssmDouble *T,IssmDouble*xzvectors);
+ int         cubic(IssmDouble a, IssmDouble b, IssmDouble c, IssmDouble d, double X[3], int *num);
+ 
+-int         NewtonSolveDnorm(IssmDouble* pdnorm,IssmDouble c1,IssmDouble c2,IssmDouble c3,IssmDouble n);
++int         NewtonSolveDnorm(IssmDouble* pdnorm,IssmDouble c1,IssmDouble c2,IssmDouble c3,IssmDouble n,IssmDouble dnorm);
+ 
+ #endif //ifndef _NUMERICS_H_
Index: issm/oecreview/Archive/16554-17801/ISSM-17629-17630.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17629-17630.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17629-17630.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/test/NightlyRun/test211.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.py	(revision 17629)
++++ ../trunk-jpl/test/NightlyRun/test211.py	(revision 17630)
+@@ -27,7 +27,7 @@
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3']
+ field_tolerances=[\
+ 	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,\
+-	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06,\
++	2e-08,3e-08,1e-06,3e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06,\
+ 	1e-07,1e-07,1e-06,3e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06]
+ field_values=[\
+ 	md.results.TransientSolution[0].Vx,\
+Index: ../trunk-jpl/test/NightlyRun/test211.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.m	(revision 17629)
++++ ../trunk-jpl/test/NightlyRun/test211.m	(revision 17630)
+@@ -14,7 +14,7 @@
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3'};
+ field_tolerances={...
+ 	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,...
+-	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06,...
++	2e-08,3e-08,1e-06,3e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06,...
+ 	1e-07,1e-07,1e-06,3e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
Index: issm/oecreview/Archive/16554-17801/ISSM-17630-17631.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17630-17631.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17630-17631.diff	(revision 17802)
@@ -0,0 +1,23 @@
+Index: ../trunk-jpl/m4/issm_options.m4
+===================================================================
+--- ../trunk-jpl/m4/issm_options.m4	(revision 17630)
++++ ../trunk-jpl/m4/issm_options.m4	(revision 17631)
+@@ -180,11 +180,15 @@
+   				MEXEXT=".$MEXEXT"
+   			;;
+ 		   *)
+-		      MEXLINK=$(mex -v 2>&1 < /dev/null | grep LDFLAGS     | sed -e "s/         LDFLAGS            = //g")
+-	         MEXLIB=$( mex -v 2>&1 < /dev/null | grep CXXLIBS     | sed -e "s/         CXXLIBS            = //g")
+-		      MEXEXT=$( mex -v 2>&1 < /dev/null | grep LDEXTENSION | sed -e "s/         LDEXTENSION        = //g")
++		      MEXLINK=$($MATLAB_ROOT/bin/mex -v 2>&1 < /dev/null | grep LDFLAGS     | sed -e "s/         LDFLAGS            = //g")
++	         MEXLIB=$( $MATLAB_ROOT/bin/mex -v 2>&1 < /dev/null | grep CXXLIBS     | sed -e "s/         CXXLIBS            = //g")
++		      MEXEXT=$( $MATLAB_ROOT/bin/mex -v 2>&1 < /dev/null | grep LDEXTENSION | sed -e "s/         LDEXTENSION        = //g")
+   			;;
+       esac
++	   if test "x$MEXEXT" = "x" ; then
++			AC_MSG_ERROR([Couldn't find mex... check your installation of matlab])
++	   fi
++
+ 		AC_SUBST([MATLABINCL])
+ 		AC_SUBST([MEX])
+ 		MATLABWRAPPEREXT=$MEXEXT
Index: issm/oecreview/Archive/16554-17801/ISSM-17631-17632.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17631-17632.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17631-17632.diff	(revision 17802)
@@ -0,0 +1,23 @@
+Index: ../trunk-jpl/src/m/classes/damage.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/damage.py	(revision 17631)
++++ ../trunk-jpl/src/m/classes/damage.py	(revision 17632)
+@@ -171,11 +171,11 @@
+ 			WriteData(fid,'object',self,'fieldname','healing','format','Double')
+ 			WriteData(fid,'object',self,'fieldname','equiv_stress','format','Integer')
+ 			
+-			#process requested outputs
+-			outputs = self.requested_outputs
+-			indices = [i for i, x in enumerate(outputs) if x == 'default']
+-			if len(indices) > 0:
+-				outputscopy=outputs[0:max(0,indices[0]-1)]+self.defaultoutputs(md)+outputs[indices[0]+1:]
+-				outputs    =outputscopy
+-			WriteData(fid,'data',outputs,'enum',DamageEvolutionRequestedOutputsEnum(),'format','StringArray')
++		#process requested outputs
++		outputs = self.requested_outputs
++		indices = [i for i, x in enumerate(outputs) if x == 'default']
++		if len(indices) > 0:
++			outputscopy=outputs[0:max(0,indices[0]-1)]+self.defaultoutputs(md)+outputs[indices[0]+1:]
++			outputs    =outputscopy
++		WriteData(fid,'data',outputs,'enum',DamageEvolutionRequestedOutputsEnum(),'format','StringArray')
+ 	# }}}
Index: issm/oecreview/Archive/16554-17801/ISSM-17632-17633.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17632-17633.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17632-17633.diff	(revision 17802)
@@ -0,0 +1,96 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17632)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17633)
+@@ -1322,28 +1322,70 @@
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble* xyz_list = NULL;
++	IssmDouble  pressure,water_pressure,sigma_nn,viscosity,bed,base;
++	IssmDouble  bed_normal[2];
++	IssmDouble  epsilon[3]; /* epsilon=[exx,eyy,exy];*/
++	IssmDouble  surface=0,value=0;
++	bool grounded;
+ 
+-	/*Figure out wether element is grounded or floating*/
+-	bool grounded = true;
++	IssmDouble* basis = xNew<IssmDouble>(NUMVERTICES);
+ 
++
+ 	/* Get node coordinates and dof list: */
+-	::GetVerticesCoordinates(xyz_list,vertices,NUMVERTICES);
++	GetVerticesCoordinates(&xyz_list);
+ 
+ 	/*Retrieve all inputs we will be needing: */
+-	Input* pressure_input=inputs->GetInput(PressureEnum); _assert_(pressure_input);
+-	Input* vx_input=inputs->GetInput(VxEnum);             _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);             _assert_(vy_input);
++	Input* pressure_input = inputs->GetInput(PressureEnum); _assert_(pressure_input);
++	Input* base_input     = inputs->GetInput(BaseEnum);     _assert_(base_input);
++	Input* bed_input      = inputs->GetInput(BedEnum);      _assert_(bed_input);
++	Input* vx_input       = inputs->GetInput(VxEnum);       _assert_(vx_input);
++	Input* vy_input       = inputs->GetInput(VyEnum);       _assert_(vy_input);
+ 
+-	_error_("STOP");
++	Gauss* gauss=NewGaussBase(1);
++	gauss->GaussPoint(0);
+ 
++	if(!IsFloating()){ 
++
++		this->StrainRateSSA(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
++		this->ViscosityFS(&viscosity,2,xyz_list,gauss,vx_input,vy_input,NULL);
++		pressure_input->GetInputValue(&pressure, gauss);
++		base_input->GetInputValue(&base, gauss); _assert_(base<0.);
++
++		/*Compute Stress*/
++		IssmDouble sigma_xx=2.*viscosity*epsilon[0]-pressure;
++		IssmDouble sigma_yy=2.*viscosity*epsilon[1]-pressure;
++		IssmDouble sigma_xy=2.*viscosity*epsilon[2];
++
++		/*Get normal vector to the bed */
++		NormalBase(&bed_normal[0],xyz_list);
++
++		/*basalforce*/
++		sigma_nn = sigma_xx*bed_normal[0]*bed_normal[0] + sigma_yy*bed_normal[1]*bed_normal[1] + 2.*sigma_xy*bed_normal[0]*bed_normal[1];
++
++		/*Compute water pressure*/
++		IssmDouble rho_ice   = matpar->GetRhoIce();
++		IssmDouble rho_water = matpar->GetRhoWater();
++		IssmDouble gravity   = matpar->GetG();
++		water_pressure=gravity*rho_water*base;
++
++		/*Compare basal stress to water pressure and determine whether it should ground*/
++		if (sigma_nn<water_pressure) grounded=true;
++		else                         grounded=false;
++	}
++	else{
++		base_input->GetInputValue(&base, gauss);
++		bed_input->GetInputValue(&bed, gauss);
++		if (base<bed) grounded=true;
++		else          grounded=false;
++	}
+ 	for(int i=0;i<NUMVERTICES;i++){
+ 		if(grounded) vertexgrounded->SetValue(vertices[i]->Pid(),+1.,INS_VAL);
+ 		else         vertexfloating->SetValue(vertices[i]->Pid(),+1.,INS_VAL);
+ 	}
+ 
+ 	/*clean up*/
++	delete gauss;
+ 	xDelete<IssmDouble>(xyz_list);
+-
+ }
+ /*}}}*/
+ /*FUNCTION Tria::IsNodeOnShelfFromFlags {{{*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17632)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17633)
+@@ -669,7 +669,7 @@
+ 		if(this->inputs->Max(MaskGroundediceLevelsetEnum) <= 0.) shelf=true;
+ 		else shelf=false;
+ 	}
+-	else if(migration_style==NoneEnum || migration_style==AgressiveMigrationEnum || migration_style==SoftMigrationEnum){ //Floating if all nodes are floating
++	else if(migration_style==NoneEnum || migration_style==AgressiveMigrationEnum || migration_style==SoftMigrationEnum || migration_style==ContactEnum){ //Floating if all nodes are floating
+ 		if(this->inputs->Min(MaskGroundediceLevelsetEnum) > 0.) shelf=false;
+ 		else shelf=true;
+ 	}
Index: issm/oecreview/Archive/16554-17801/ISSM-17633-17634.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17633-17634.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17633-17634.diff	(revision 17802)
@@ -0,0 +1,22 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17633)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17634)
+@@ -1328,9 +1328,6 @@
+ 	IssmDouble  surface=0,value=0;
+ 	bool grounded;
+ 
+-	IssmDouble* basis = xNew<IssmDouble>(NUMVERTICES);
+-
+-
+ 	/* Get node coordinates and dof list: */
+ 	GetVerticesCoordinates(&xyz_list);
+ 
+@@ -1341,6 +1338,7 @@
+ 	Input* vx_input       = inputs->GetInput(VxEnum);       _assert_(vx_input);
+ 	Input* vy_input       = inputs->GetInput(VyEnum);       _assert_(vy_input);
+ 
++	/*Create gauss point in the middle of the basal edge*/
+ 	Gauss* gauss=NewGaussBase(1);
+ 	gauss->GaussPoint(0);
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17634-17635.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17634-17635.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17634-17635.diff	(revision 17802)
@@ -0,0 +1,84 @@
+Index: ../trunk-jpl/src/m/plot/applyoptions.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/applyoptions.py	(revision 17634)
++++ ../trunk-jpl/src/m/plot/applyoptions.py	(revision 17635)
+@@ -1,3 +1,5 @@
++import numpy as npy
++
+ try:
+ 	from matplotlib.ticker import MaxNLocator
+ 	from mpl_toolkits.axes_grid1 import make_axes_locatable
+@@ -152,8 +154,10 @@
+ 	#clim {{{
+ 	if options.exist('clim'):
+ 		lims=options.getfieldvalue('clim')
++	elif options.exist('caxis'):
++		lims=options.getfieldvalue('caxis')
+ 		if len(lims)!=2:
+-			print 'WARNING: clim should be passed as a list of length 2'
++			print 'WARNING: clim/caxis should be passed as a list of length 2'
+ 		else:
+ 			p.clim(lims[0],lims[1])
+ 	#}}}
+@@ -166,7 +170,9 @@
+ 			p.grid()
+ 	#}}}
+ 
+-	#colormap
++	#colormap {{{
++	cmap=options.getfieldvalue('colormap',mpl.cm.gnuplot2)
++	#}}}
+ 
+ 	#wrapping
+ 
+@@ -179,11 +185,17 @@
+ 			divider = make_axes_locatable(ax)
+ 			cax = divider.new_horizontal("5%", pad=0.05, axes_class=mpl.axes.Axes)
+ 			fig.add_axes(cax) 
+-			cmap = mpl.cm.jet
+ 			norm = mpl.colors.Normalize(vmin=lims[0], vmax=lims[1])
+ 			cb = mpl.colorbar.ColorbarBase(cax, cmap=cmap, norm=norm)
+ 		else:
+-			cb=p.colorbar()
++			# build custom colorbar (does not yet allow customizing the location)
++			fig = p.gcf()
++			ax = p.gca()
++			divider = make_axes_locatable(ax)
++			cax = divider.new_horizontal("5%", pad=0.05, axes_class=mpl.axes.Axes)
++			fig.add_axes(cax) 
++			norm = mpl.colors.Normalize(vmin=npy.min(data.flatten()), vmax=npy.max(data.flatten()))
++			cb = mpl.colorbar.ColorbarBase(cax, cmap=cmap, norm=norm)
+ 		cb.locator=MaxNLocator(nbins=5) # default 5 ticks
+ 		cb.update_ticks()
+ 		if options.exist('colorbarnumticks'):
+Index: ../trunk-jpl/src/m/plot/plot_unit.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_unit.py	(revision 17634)
++++ ../trunk-jpl/src/m/plot/plot_unit.py	(revision 17635)
+@@ -1,6 +1,7 @@
+ 
+ try:
+ 	import pylab as p
++	import matplotlib as mpl
+ except ImportError:
+ 	print "could not import pylab, matplotlib has not been installed, no plotting capabilities enabled"
+ 
+@@ -20,6 +21,9 @@
+ 	#number of colorlevels for plots
+ 	colorlevels=options.getfieldvalue('colorlevels',256)
+ 
++	#colormap
++	cmap=options.getfieldvalue('colormap',mpl.cm.gnuplot2)
++
+ 	if datatype==1:
+ 		#element plot
+ 		if is2d:
+@@ -31,7 +35,7 @@
+ 	elif datatype==2:
+ 		#node plot
+ 		if is2d:
+-			p.tricontourf(x,y,elements,data,colorlevels)
++			p.tricontourf(x,y,elements,data,colorlevels,cmap=cmap)
+ 			if edgecolor != 'None':
+ 				p.triplot(x,y,elements,color=edgecolor)
+ 		else:
Index: issm/oecreview/Archive/16554-17801/ISSM-17635-17636.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17635-17636.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17635-17636.diff	(revision 17802)
@@ -0,0 +1,51 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17635)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17636)
+@@ -1344,6 +1344,8 @@
+ 
+ 	if(!IsFloating()){ 
+ 
++		if(this->inputs->Max(MaskGroundediceLevelsetEnum)==0.){
++
+ 		this->StrainRateSSA(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
+ 		this->ViscosityFS(&viscosity,2,xyz_list,gauss,vx_input,vy_input,NULL);
+ 		pressure_input->GetInputValue(&pressure, gauss);
+@@ -1369,6 +1371,10 @@
+ 		/*Compare basal stress to water pressure and determine whether it should ground*/
+ 		if (sigma_nn<water_pressure) grounded=true;
+ 		else                         grounded=false;
++		}
++		else{
++			grounded=true;
++		}
+ 	}
+ 	else{
+ 		base_input->GetInputValue(&base, gauss);
+@@ -1706,7 +1712,7 @@
+ 			xz_plane[0]=cos(theta);       xz_plane[3]=0.;  
+ 			xz_plane[1]=sin(theta);       xz_plane[4]=0.;  
+ 			xz_plane[2]=0.;               xz_plane[5]=1.;          
+-			if(groundedice>0){
++			if(groundedice>=0){
+ 				this->nodes[i]->DofInSSet(1); //vy
+ 			}
+ 			else{
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17635)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17636)
+@@ -665,11 +665,11 @@
+ 	int  migration_style;
+ 	parameters->FindParam(&migration_style,GroundinglineMigrationEnum);
+ 
+-	if(migration_style==SubelementMigrationEnum || migration_style==SubelementMigration2Enum){ //Floating if all nodes are floating
++	if(migration_style==SubelementMigrationEnum || migration_style==SubelementMigration2Enum || migration_style==ContactEnum){ //Floating if all nodes are floating
+ 		if(this->inputs->Max(MaskGroundediceLevelsetEnum) <= 0.) shelf=true;
+ 		else shelf=false;
+ 	}
+-	else if(migration_style==NoneEnum || migration_style==AgressiveMigrationEnum || migration_style==SoftMigrationEnum || migration_style==ContactEnum){ //Floating if all nodes are floating
++	else if(migration_style==NoneEnum || migration_style==AgressiveMigrationEnum || migration_style==SoftMigrationEnum){ //Floating if all nodes are floating
+ 		if(this->inputs->Min(MaskGroundediceLevelsetEnum) > 0.) shelf=false;
+ 		else shelf=true;
+ 	}
Index: issm/oecreview/Archive/16554-17801/ISSM-17636-17637.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17636-17637.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17636-17637.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17636)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17637)
+@@ -1936,7 +1936,7 @@
+ 		xz_plane[1]=0.;       xz_plane[4]=-slopey;  
+ 		xz_plane[2]=slopex;   xz_plane[5]=1.;          
+ 
+-		if(groundedice>0){
++		if(groundedice>=0){
+ 			if(this->nodes[indices[i]]->GetApproximation()==FSvelocityEnum){
+ 				this->nodes[indices[i]]->DofInSSet(2); //vz 
+ 			}
Index: issm/oecreview/Archive/16554-17801/ISSM-17637-17638.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17637-17638.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17637-17638.diff	(revision 17802)
@@ -0,0 +1,14 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17637)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17638)
+@@ -1344,8 +1344,7 @@
+ 
+ 	if(!IsFloating()){ 
+ 
+-		if(this->inputs->Max(MaskGroundediceLevelsetEnum)==0.){
+-
++		if(this->inputs->Min(MaskGroundediceLevelsetEnum)==0.){
+ 		this->StrainRateSSA(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
+ 		this->ViscosityFS(&viscosity,2,xyz_list,gauss,vx_input,vy_input,NULL);
+ 		pressure_input->GetInputValue(&pressure, gauss);
Index: issm/oecreview/Archive/16554-17801/ISSM-17638-17639.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17638-17639.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17638-17639.diff	(revision 17802)
@@ -0,0 +1,8 @@
+Index: ../trunk-jpl/test/Archives/Archive703.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive702.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17639-17640.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17639-17640.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17639-17640.diff	(revision 17802)
@@ -0,0 +1,193 @@
+Index: ../trunk-jpl/src/m/plot/applyoptions.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/applyoptions.py	(revision 17639)
++++ ../trunk-jpl/src/m/plot/applyoptions.py	(revision 17640)
+@@ -156,10 +156,11 @@
+ 		lims=options.getfieldvalue('clim')
+ 	elif options.exist('caxis'):
+ 		lims=options.getfieldvalue('caxis')
+-		if len(lims)!=2:
+-			print 'WARNING: clim/caxis should be passed as a list of length 2'
+-		else:
+-			p.clim(lims[0],lims[1])
++		options.addfielddefault('clim',lims)
++	else:
++		lims=[min(data.flatten()),max(data.flatten())]
++	if len(lims)!=2:
++		print 'WARNING: clim/caxis should be passed as a list of length 2'
+ 	#}}}
+ 
+ 	#shading
+@@ -178,24 +179,30 @@
+ 
+ 	#colorbar {{{
+ 	if options.getfieldvalue('colorbar',1)==1:
+-		if options.exist('clim'):
+-			# build custom colorbar (does not yet allow customizing the location)
+-			fig = p.gcf()
+-			ax = p.gca()
+-			divider = make_axes_locatable(ax)
+-			cax = divider.new_horizontal("5%", pad=0.05, axes_class=mpl.axes.Axes)
+-			fig.add_axes(cax) 
+-			norm = mpl.colors.Normalize(vmin=lims[0], vmax=lims[1])
+-			cb = mpl.colorbar.ColorbarBase(cax, cmap=cmap, norm=norm)
+-		else:
+-			# build custom colorbar (does not yet allow customizing the location)
+-			fig = p.gcf()
+-			ax = p.gca()
+-			divider = make_axes_locatable(ax)
+-			cax = divider.new_horizontal("5%", pad=0.05, axes_class=mpl.axes.Axes)
+-			fig.add_axes(cax) 
+-			norm = mpl.colors.Normalize(vmin=npy.min(data.flatten()), vmax=npy.max(data.flatten()))
+-			cb = mpl.colorbar.ColorbarBase(cax, cmap=cmap, norm=norm)
++		fig = p.gcf()
++		ax = p.gca()
++		divider = make_axes_locatable(ax)
++		cax = divider.new_horizontal("5%", pad=0.05, axes_class=mpl.axes.Axes)
++		fig.add_axes(cax) 
++		norm = mpl.colors.Normalize(vmin=lims[0], vmax=lims[1])
++		cbar_extend=0
++		if options.exist('cmap_set_over'):
++			over=options.getfieldvalue('cmap_set_over','0.5')
++			cmap.set_over(over)
++			cbar_extend+=1
++		if options.exist('cmap_set_under'):
++			under=options.getfieldvalue('cmap_set_under','0.5')
++			cmap.set_under(under)
++			cbar_extend+=2
++		if cbar_extend==0:
++			extend='neither'
++		elif cbar_extend==1:
++			extend='max'
++		elif cbar_extend==2:
++			extend='min'
++		elif cbar_extend==3:
++			extend='both'
++		cb = mpl.colorbar.ColorbarBase(cax, cmap=cmap, norm=norm, extend=extend)
+ 		cb.locator=MaxNLocator(nbins=5) # default 5 ticks
+ 		cb.update_ticks()
+ 		if options.exist('colorbarnumticks'):
+Index: ../trunk-jpl/src/m/plot/plot_unit.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_unit.py	(revision 17639)
++++ ../trunk-jpl/src/m/plot/plot_unit.py	(revision 17640)
+@@ -6,54 +6,71 @@
+ 	print "could not import pylab, matplotlib has not been installed, no plotting capabilities enabled"
+ 
+ def plot_unit(x,y,z,elements,data,is2d,isplanet,datatype,options):
+-	"""
+-	PLOT_UNIT - unit plot, display data
++   """
++   PLOT_UNIT - unit plot, display data
++   
++   	Usage:
++   		plot_unit(x,y,z,elements,data,is2d,isplanet,datatype,options)
++   
++   	See also: PLOTMODEL, PLOT_MANAGER
++   """
+ 
+-		Usage:
+-			plot_unit(x,y,z,elements,data,is2d,isplanet,datatype,options)
++   #edgecolor
++   edgecolor=options.getfieldvalue('edgecolor','None')
++   
++   #number of colorlevels for plots
++   colorlevels=options.getfieldvalue('colorlevels',256)
++   
++   #colormap
++   cmap=options.getfieldvalue('colormap',mpl.cm.gnuplot2)
++   cbar_extend=0
++   if options.exist('cmap_set_over'):
++      over=options.getfieldvalue('cmap_set_over','0.5')
++      cmap.set_over(over)
++      cbar_extend+=1
++   if options.exist('cmap_set_under'):
++      under=options.getfieldvalue('cmap_set_under','0.5')
++      cmap.set_under(under)
++      cbar_extend+=1
+ 
+-		See also: PLOTMODEL, PLOT_MANAGER
+-	"""
+-
+-	#edgecolor
+-	edgecolor=options.getfieldvalue('edgecolor','None')
+-
+-	#number of colorlevels for plots
+-	colorlevels=options.getfieldvalue('colorlevels',256)
+-
+-	#colormap
+-	cmap=options.getfieldvalue('colormap',mpl.cm.gnuplot2)
+-
+-	if datatype==1:
+-		#element plot
+-		if is2d:
+-			p.tripcolor(x,y,elements,data,colorlevels,edgecolors=edgecolor)
+-		else:
+-			raise ValueError('plot_unit error: 3D element plot not supported yet')
+-		return
+-
+-	elif datatype==2:
+-		#node plot
+-		if is2d:
+-			p.tricontourf(x,y,elements,data,colorlevels,cmap=cmap)
+-			if edgecolor != 'None':
+-				p.triplot(x,y,elements,color=edgecolor)
+-		else:
+-			raise ValueError('plot_unit error: 3D node plot not supported yet')
+-		return
+-
+-	elif datatype==3:
+-		print 'plot_unit message: quiver plot not implemented yet'
+-		return
+-
+-	elif datatype==4:
+-		#P1 patch plot
+-		print 'plot_unit message: P1 patch plot not implemented yet'
+-		return
+-
+-	elif datatype==5:
+-		print 'plot_unit message: P0 patch plot not implemented yet'
+-		return
+-
+-	else:
++   #normalize colormap if clim/caxis specified
++   if options.exist('clim'):
++      lims=options.getfieldvalue('clim',[min(data),max(data)])
++   elif options.exist('caxis'):
++      lims=options.getfieldvalue('caxis',[min(data),max(data)])
++   else:
++      lims=[min(data),max(data)]
++   norm = mpl.colors.Normalize(vmin=lims[0], vmax=lims[1])
++   if datatype==1:
++      #element plot
++   	if is2d:
++   		p.tripcolor(x,y,elements,data,colorlevels,edgecolors=edgecolor)
++   	else:
++   		raise ValueError('plot_unit error: 3D element plot not supported yet')
++   	return
++   
++   elif datatype==2:
++   	#node plot
++   	if is2d:
++   		p.tricontourf(x,y,elements,data,colorlevels,cmap=cmap,norm=norm)
++   		if edgecolor != 'None':
++   			p.triplot(x,y,elements,color=edgecolor)
++   	else:
++   		raise ValueError('plot_unit error: 3D node plot not supported yet')
++   	return
++   
++   elif datatype==3:
++   	print 'plot_unit message: quiver plot not implemented yet'
++   	return
++   
++   elif datatype==4:
++   	#P1 patch plot
++   	print 'plot_unit message: P1 patch plot not implemented yet'
++   	return
++   
++   elif datatype==5:
++   	print 'plot_unit message: P0 patch plot not implemented yet'
++   	return
++   
++   else:
+ 		raise ValueError('datatype=%d not supported' % datatype)
Index: issm/oecreview/Archive/16554-17801/ISSM-17640-17641.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17640-17641.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17640-17641.diff	(revision 17802)
@@ -0,0 +1,185 @@
+Index: ../trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp	(revision 17640)
++++ ../trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp	(revision 17641)
+@@ -93,7 +93,7 @@
+ 			phi[i]=-1.;
+ 		}
+ 		else{
+-			_error_("not supported");
++			_error_("not supported (vertexfloating="<<serial_vertexfloating[i]<<" vertexgrounded="<<serial_vertexgrounded[i]<<")");
+ 		}
+ 	}
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17640)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17641)
+@@ -1343,39 +1343,40 @@
+ 	gauss->GaussPoint(0);
+ 
+ 	if(!IsFloating()){ 
+-
++		/*Check for basal force only if grounded and touching GL*/
+ 		if(this->inputs->Min(MaskGroundediceLevelsetEnum)==0.){
+-		this->StrainRateSSA(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
+-		this->ViscosityFS(&viscosity,2,xyz_list,gauss,vx_input,vy_input,NULL);
+-		pressure_input->GetInputValue(&pressure, gauss);
+-		base_input->GetInputValue(&base, gauss); _assert_(base<0.);
++			this->StrainRateSSA(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
++			this->ViscosityFS(&viscosity,2,xyz_list,gauss,vx_input,vy_input,NULL);
++			pressure_input->GetInputValue(&pressure, gauss);
++			base_input->GetInputValue(&base, gauss); _assert_(base<0.);
+ 
+-		/*Compute Stress*/
+-		IssmDouble sigma_xx=2.*viscosity*epsilon[0]-pressure;
+-		IssmDouble sigma_yy=2.*viscosity*epsilon[1]-pressure;
+-		IssmDouble sigma_xy=2.*viscosity*epsilon[2];
++			/*Compute Stress*/
++			IssmDouble sigma_xx=2.*viscosity*epsilon[0]-pressure;
++			IssmDouble sigma_yy=2.*viscosity*epsilon[1]-pressure;
++			IssmDouble sigma_xy=2.*viscosity*epsilon[2];
+ 
+-		/*Get normal vector to the bed */
+-		NormalBase(&bed_normal[0],xyz_list);
++			/*Get normal vector to the bed */
++			NormalBase(&bed_normal[0],xyz_list);
+ 
+-		/*basalforce*/
+-		sigma_nn = sigma_xx*bed_normal[0]*bed_normal[0] + sigma_yy*bed_normal[1]*bed_normal[1] + 2.*sigma_xy*bed_normal[0]*bed_normal[1];
++			/*basalforce*/
++			sigma_nn = sigma_xx*bed_normal[0]*bed_normal[0] + sigma_yy*bed_normal[1]*bed_normal[1] + 2.*sigma_xy*bed_normal[0]*bed_normal[1];
+ 
+-		/*Compute water pressure*/
+-		IssmDouble rho_ice   = matpar->GetRhoIce();
+-		IssmDouble rho_water = matpar->GetRhoWater();
+-		IssmDouble gravity   = matpar->GetG();
+-		water_pressure=gravity*rho_water*base;
++			/*Compute water pressure*/
++			IssmDouble rho_ice   = matpar->GetRhoIce();
++			IssmDouble rho_water = matpar->GetRhoWater();
++			IssmDouble gravity   = matpar->GetG();
++			water_pressure=gravity*rho_water*base;
+ 
+-		/*Compare basal stress to water pressure and determine whether it should ground*/
+-		if (sigma_nn<water_pressure) grounded=true;
+-		else                         grounded=false;
++			/*Compare basal stress to water pressure and determine whether it should ground*/
++			if (sigma_nn<water_pressure) grounded=true;
++			else                         grounded=false;
+ 		}
+ 		else{
+ 			grounded=true;
+ 		}
+ 	}
+ 	else{
++		/*Check for basal elevation if floating*/
+ 		base_input->GetInputValue(&base, gauss);
+ 		bed_input->GetInputValue(&bed, gauss);
+ 		if (base<bed) grounded=true;
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17640)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17641)
+@@ -449,6 +449,88 @@
+ 	return this->element_type;
+ }
+ /*}}}*/
++/*FUNCTION Penta::FSContactMigration{{{*/
++void Penta::FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating){
++
++	if(!IsOnBase()) return;
++
++	/*Intermediaries*/
++	IssmDouble* xyz_list = NULL;
++	IssmDouble  pressure,water_pressure,sigma_nn,viscosity,bed,base;
++	IssmDouble  bed_normal[3];
++	IssmDouble  epsilon[6]; /* epsilon=[exx eyy ezz exy exz eyz];*/
++	IssmDouble  surface=0,value=0;
++	bool grounded;
++
++	/* Get node coordinates and dof list: */
++	GetVerticesCoordinates(&xyz_list);
++
++	/*Retrieve all inputs we will be needing: */
++	Input* pressure_input = inputs->GetInput(PressureEnum); _assert_(pressure_input);
++	Input* base_input     = inputs->GetInput(BaseEnum);     _assert_(base_input);
++	Input* bed_input      = inputs->GetInput(BedEnum);      _assert_(bed_input);
++	Input* vx_input       = inputs->GetInput(VxEnum);       _assert_(vx_input);
++	Input* vy_input       = inputs->GetInput(VyEnum);       _assert_(vy_input);
++	Input* vz_input       = inputs->GetInput(VzEnum);       _assert_(vz_input);
++
++	/*Create gauss point in the middle of the basal edge*/
++	Gauss* gauss=NewGaussBase(1);
++	gauss->GaussPoint(0);
++
++	if(!IsFloating()){ 
++		/*Check for basal force only if grounded and touching GL*/
++		if(this->inputs->Min(MaskGroundediceLevelsetEnum)==0.){
++			this->StrainRateFS(&epsilon[0],xyz_list,gauss,vx_input,vy_input,vz_input);
++			this->ViscosityFS(&viscosity,3,xyz_list,gauss,vx_input,vy_input,vz_input);
++			pressure_input->GetInputValue(&pressure, gauss);
++			base_input->GetInputValue(&base, gauss); _assert_(base<0.);
++
++			/*Compute Stress*/
++			IssmDouble sigma_xx=2.*viscosity*epsilon[0]-pressure;
++			IssmDouble sigma_yy=2.*viscosity*epsilon[1]-pressure;
++			IssmDouble sigma_zz=2.*viscosity*epsilon[2]-pressure;
++			IssmDouble sigma_xy=2.*viscosity*epsilon[3];
++			IssmDouble sigma_xz=2.*viscosity*epsilon[4];
++			IssmDouble sigma_yz=2.*viscosity*epsilon[5];
++
++			/*Get normal vector to the bed */
++			NormalBase(&bed_normal[0],xyz_list);
++
++			/*basalforce*/
++			sigma_nn = sigma_xx*bed_normal[0]*bed_normal[0] + sigma_yy*bed_normal[1]*bed_normal[1] + sigma_zz*bed_normal[2]*bed_normal[2] 
++			  + 2.*sigma_xy*bed_normal[0]*bed_normal[1] + 2.*sigma_xz*bed_normal[0]*bed_normal[2] + 2.*sigma_yz*bed_normal[1]*bed_normal[2];
++
++			/*Compute water pressure*/
++			IssmDouble rho_ice   = matpar->GetRhoIce();
++			IssmDouble rho_water = matpar->GetRhoWater();
++			IssmDouble gravity   = matpar->GetG();
++			water_pressure=gravity*rho_water*base;
++
++			/*Compare basal stress to water pressure and determine whether it should ground*/
++			if (sigma_nn<water_pressure) grounded=true;
++			else                         grounded=false;
++		}
++		else{
++			grounded=true;
++		}
++	}
++	else{
++		/*Check for basal elevation if floating*/
++		base_input->GetInputValue(&base, gauss);
++		bed_input->GetInputValue(&bed, gauss);
++		if (base<bed) grounded=true;
++		else          grounded=false;
++	}
++	for(int i=0;i<NUMVERTICES;i++){
++		if(grounded) vertexgrounded->SetValue(vertices[i]->Pid(),+1.,INS_VAL);
++		else         vertexfloating->SetValue(vertices[i]->Pid(),+1.,INS_VAL);
++	}
++
++	/*clean up*/
++	delete gauss;
++	xDelete<IssmDouble>(xyz_list);
++}
++/*}}}*/
+ /*FUNCTION Penta::ObjectEnum{{{*/
+ int Penta::ObjectEnum(void){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17640)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17641)
+@@ -59,7 +59,7 @@
+ 		void   Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
+ 		void   ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz);
+ 		int    FiniteElement(void);
+-		void   FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating){_error_("not implemented yet");};
++		void   FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating);
+ 		void   SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters);
+ 		void   Delta18oParameterization(void);
+ 		Penta* GetUpperPenta(void);
Index: issm/oecreview/Archive/16554-17801/ISSM-17641-17642.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17641-17642.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17641-17642.diff	(revision 17802)
@@ -0,0 +1,255 @@
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17641)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17642)
+@@ -26,6 +26,7 @@
+ 	/*Requested outputs*/
+ 	iomodel->FetchData(&requestedoutputs,&numoutputs,DamageEvolutionRequestedOutputsEnum);
+ 	parameters->AddObject(new IntParam(DamageEvolutionNumRequestedOutputsEnum,numoutputs));
++	_printf0_("numoutputs = " << numoutputs << ", requestedoutputs = " << requestedoutputs);
+ 	if(numoutputs)parameters->AddObject(new StringArrayParam(DamageEvolutionRequestedOutputsEnum,requestedoutputs,numoutputs));
+ 	iomodel->DeleteData(&requestedoutputs,numoutputs,DamageEvolutionRequestedOutputsEnum);
+ 
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17641)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17642)
+@@ -278,7 +278,7 @@
+ 	TransientIsmasstransportEnum,
+ 	TransientIsthermalEnum,
+ 	TransientIsgiaEnum,
+-	TransientIsdamageEnum,
++	TransientIsdamageevolutionEnum,
+ 	TransientNumRequestedOutputsEnum,
+ 	TransientRequestedOutputsEnum,
+ 	/*}}}*/
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17641)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17642)
+@@ -284,7 +284,7 @@
+ 		case TransientIsmasstransportEnum : return "TransientIsmasstransport";
+ 		case TransientIsthermalEnum : return "TransientIsthermal";
+ 		case TransientIsgiaEnum : return "TransientIsgia";
+-		case TransientIsdamageEnum : return "TransientIsdamage";
++		case TransientIsdamageevolutionEnum : return "TransientIsdamageevolution";
+ 		case TransientNumRequestedOutputsEnum : return "TransientNumRequestedOutputs";
+ 		case TransientRequestedOutputsEnum : return "TransientRequestedOutputs";
+ 		case SurfaceforcingsEnum : return "Surfaceforcings";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17641)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17642)
+@@ -290,7 +290,7 @@
+ 	      else if (strcmp(name,"TransientIsmasstransport")==0) return TransientIsmasstransportEnum;
+ 	      else if (strcmp(name,"TransientIsthermal")==0) return TransientIsthermalEnum;
+ 	      else if (strcmp(name,"TransientIsgia")==0) return TransientIsgiaEnum;
+-	      else if (strcmp(name,"TransientIsdamage")==0) return TransientIsdamageEnum;
++	      else if (strcmp(name,"TransientIsdamageevolution")==0) return TransientIsdamageevolutionEnum;
+ 	      else if (strcmp(name,"TransientNumRequestedOutputs")==0) return TransientNumRequestedOutputsEnum;
+ 	      else if (strcmp(name,"TransientRequestedOutputs")==0) return TransientRequestedOutputsEnum;
+ 	      else if (strcmp(name,"Surfaceforcings")==0) return SurfaceforcingsEnum;
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17641)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17642)
+@@ -68,6 +68,7 @@
+ 	parameters->AddObject(iomodel->CopyConstantObject(TransientIsgroundinglineEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(TransientIsgiaEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(TransientIslevelsetEnum));
++	parameters->AddObject(iomodel->CopyConstantObject(TransientIsdamageevolutionEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(MaterialsRheologyLawEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(AutodiffIsautodiffEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(QmuIsdakotaEnum));
+@@ -144,6 +145,11 @@
+ 	if(numoutputs)parameters->AddObject(new StringArrayParam(SteadystateRequestedOutputsEnum,requestedoutputs,numoutputs));
+ 	iomodel->DeleteData(&requestedoutputs,numoutputs,SteadystateRequestedOutputsEnum);
+ 
++	iomodel->FetchData(&requestedoutputs,&numoutputs,DamageEvolutionRequestedOutputsEnum);
++	parameters->AddObject(new IntParam(DamageEvolutionNumRequestedOutputsEnum,numoutputs));
++	if(numoutputs)parameters->AddObject(new StringArrayParam(DamageEvolutionRequestedOutputsEnum,requestedoutputs,numoutputs));
++	iomodel->DeleteData(&requestedoutputs,numoutputs,DamageEvolutionRequestedOutputsEnum);
++
+ 	/*Deal with mass flux segments: {{{*/
+ 	iomodel->FetchData(&qmu_mass_flux_present,QmuMassFluxSegmentsPresentEnum);
+ 	iomodel->FetchData(&autodiff_mass_flux_present,AutodiffMassFluxSegmentsPresentEnum);
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp	(revision 17641)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp	(revision 17642)
+@@ -15,7 +15,7 @@
+ void ModelProcessorx(Elements** pelements, Nodes** pnodes, Vertices** pvertices, Materials** pmaterials, Constraints** pconstraints, Loads** ploads, Parameters** pparameters, FILE* IOMODEL,FILE* toolkitfile, char* rootpath,const int solution_enum,const int nummodels,const int* analysis_enum_list){
+ 
+ 	int   i,analysis_enum,verbose;
+-	bool  isthermal,ismasstransport,isstressbalance,isgroundingline,isenthalpy,islevelset;
++	bool  isthermal,ismasstransport,isstressbalance,isgroundingline,isenthalpy,islevelset,isdamage;
+ 
+ 	/*Initialize datasets*/
+ 	Elements    *elements    = new Elements();
+@@ -37,6 +37,7 @@
+ 	iomodel->Constant(&ismasstransport,TransientIsmasstransportEnum);
+ 	iomodel->Constant(&isstressbalance,TransientIsstressbalanceEnum);
+ 	iomodel->Constant(&isgroundingline,TransientIsgroundinglineEnum);
++	iomodel->Constant(&isdamage,TransientIsdamageevolutionEnum);
+ 
+ 	SetVerbosityLevel(verbose);
+ 
+Index: ../trunk-jpl/src/c/cores/transient_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17641)
++++ ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17642)
+@@ -21,7 +21,7 @@
+ 	/*parameters: */
+ 	int    i;
+ 	IssmDouble starttime,finaltime,dt,yts;
+-	bool   isstressbalance,ismasstransport,isFS,isthermal,isgroundingline,isgia,islevelset;
++	bool   isstressbalance,ismasstransport,isFS,isthermal,isgroundingline,isgia,islevelset,isdamageevolution;
+ 	bool   save_results,dakota_analysis;
+ 	bool   time_adapt=false;
+ 	int    output_frequency;
+@@ -50,6 +50,7 @@
+ 	femmodel->parameters->FindParam(&isgia,TransientIsgiaEnum);
+ 	femmodel->parameters->FindParam(&isgroundingline,TransientIsgroundinglineEnum);
+ 	femmodel->parameters->FindParam(&islevelset,TransientIslevelsetEnum);
++	femmodel->parameters->FindParam(&isdamageevolution,TransientIsdamageevolutionEnum);
+ 	femmodel->parameters->FindParam(&isFS,FlowequationIsFSEnum);
+ 	if(isgroundingline) femmodel->parameters->FindParam(&groundingline_migration,GroundinglineMigrationEnum);
+ 	femmodel->parameters->FindParam(&numoutputs,TransientNumRequestedOutputsEnum);
+@@ -121,7 +122,12 @@
+ 			if(VerboseSolution()) _printf0_("   computing new velocity\n");
+ 			stressbalance_core(femmodel);
+ 		}
+-		
++
++		if(isdamageevolution){
++			if(VerboseSolution()) _printf0_("   computing damage\n");
++			damage_core(femmodel);
++		}
++
+ 		if(islevelset){
+ 			if(VerboseSolution()) _printf0_("   computing movement of ice boundaries\n");
+ 			/* smoothen slope of lsf for computation of normal on ice domain*/
+Index: ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp	(revision 17641)
++++ ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp	(revision 17642)
+@@ -116,7 +116,7 @@
+ 			break;
+ 
+ 		case TransientSolutionEnum:
+-			numanalyses=15;
++			numanalyses=16;
+ 			analyses=xNew<int>(numanalyses);
+ 			analyses[ 0]=StressbalanceAnalysisEnum;
+ 			analyses[ 1]=StressbalanceVerticalAnalysisEnum;
+@@ -133,6 +133,7 @@
+ 			analyses[12]=LevelsetAnalysisEnum;
+ 			analyses[13]=ExtrapolationAnalysisEnum;
+ 			analyses[14]=LsfReinitializationAnalysisEnum;
++			analyses[15]=DamageEvolutionAnalysisEnum;
+ 			break;
+ 
+ 		default:
+Index: ../trunk-jpl/src/m/classes/transient.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/transient.py	(revision 17641)
++++ ../trunk-jpl/src/m/classes/transient.py	(revision 17642)
+@@ -17,6 +17,7 @@
+ 		self.isthermal         = False
+ 		self.isgroundingline   = False
+ 		self.isgia             = False
++		self.isdamageevolution = False
+ 		self.islevelset        = False
+ 		self.requested_outputs = []
+ 
+@@ -31,6 +32,7 @@
+ 		string="%s\n%s"%(string,fielddisplay(self,'isthermal','indicates if a thermal solution is used in the transient'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'isgroundingline','indicates if a groundingline migration is used in the transient'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'isgia','indicates if a postglacial rebound is used in the transient'))
++		string="%s\n%s"%(string,fielddisplay(self,'isdamageevolution','indicates whether damage evolution is used in the transient'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'islevelset','LEVELSET METHOD DESCRIPTION'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'requested_outputs','list of additional outputs requested'))
+ 		return string
+@@ -51,7 +53,8 @@
+ 		self.isthermal       = True
+ 		self.isgroundingline = False
+ 		self.isgia           = False
+-		self.islevelset           = False
++		self.isdamageevolution = False
++		self.islevelset      = False
+ 
+ 		#default output
+ 		self.requested_outputs=['default']
+@@ -68,6 +71,7 @@
+ 		md = checkfield(md,'fieldname','transient.isthermal','numel',[1],'values',[0,1])
+ 		md = checkfield(md,'fieldname','transient.isgroundingline','numel',[1],'values',[0,1])
+ 		md = checkfield(md,'fieldname','transient.isgia','numel',[1],'values',[0,1])
++		md = checkfield(md,'fieldname','transient.isdamageevolution','numel',[1],'values',[0,1])
+ 		md = checkfield(md,'fieldname','transient.islevelset','numel',[1],'values',[0,1])
+ 		md = checkfield(md,'fieldname','transient.requested_outputs','stringrow',1)
+ 
+@@ -79,6 +83,7 @@
+ 		WriteData(fid,'object',self,'fieldname','isthermal','format','Boolean')
+ 		WriteData(fid,'object',self,'fieldname','isgroundingline','format','Boolean')
+ 		WriteData(fid,'object',self,'fieldname','isgia','format','Boolean')
++		WriteData(fid,'object',self,'fieldname','isdamageevolution','format','Boolean')
+ 		WriteData(fid,'object',self,'fieldname','islevelset','format','Boolean')
+ 
+ 		#process requested outputs
+Index: ../trunk-jpl/src/m/interp/averaging.py
+===================================================================
+--- ../trunk-jpl/src/m/interp/averaging.py	(revision 17641)
++++ ../trunk-jpl/src/m/interp/averaging.py	(revision 17642)
+@@ -1,6 +1,7 @@
+ import numpy as npy
+ from GetAreas import GetAreas
+ from scipy.sparse import csc_matrix
++import MatlabFuncs as m
+ 
+ def averaging(md,data,iterations,layer=0):
+ 	'''
+Index: ../trunk-jpl/src/m/enum/TransientIsdamageEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/TransientIsdamageEnum.m	(revision 17641)
++++ ../trunk-jpl/src/m/enum/TransientIsdamageEnum.m	(revision 17642)
+@@ -1,11 +0,0 @@
+-function macro=TransientIsdamageEnum()
+-%TRANSIENTISDAMAGEENUM - Enum of TransientIsdamage
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=TransientIsdamageEnum()
+-
+-macro=StringToEnum('TransientIsdamage');
+Index: ../trunk-jpl/src/m/enum/TransientIsdamageevolutionEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/TransientIsdamageevolutionEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/TransientIsdamageevolutionEnum.m	(revision 17642)
+@@ -0,0 +1,11 @@
++function macro=TransientIsdamageevolutionEnum()
++%TRANSIENTISDAMAGEEVOLUTIONENUM - Enum of TransientIsdamageevolution
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=TransientIsdamageevolutionEnum()
++
++macro=StringToEnum('TransientIsdamageevolution');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17641)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17642)
+@@ -276,7 +276,7 @@
+ def TransientIsmasstransportEnum(): return StringToEnum("TransientIsmasstransport")[0]
+ def TransientIsthermalEnum(): return StringToEnum("TransientIsthermal")[0]
+ def TransientIsgiaEnum(): return StringToEnum("TransientIsgia")[0]
+-def TransientIsdamageEnum(): return StringToEnum("TransientIsdamage")[0]
++def TransientIsdamageevolutionEnum(): return StringToEnum("TransientIsdamageevolution")[0]
+ def TransientNumRequestedOutputsEnum(): return StringToEnum("TransientNumRequestedOutputs")[0]
+ def TransientRequestedOutputsEnum(): return StringToEnum("TransientRequestedOutputs")[0]
+ def SurfaceforcingsEnum(): return StringToEnum("Surfaceforcings")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17642-17643.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17642-17643.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17642-17643.diff	(revision 17802)
@@ -0,0 +1,20 @@
+Index: ../trunk-jpl/src/m/plot/plot_unit.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_unit.py	(revision 17642)
++++ ../trunk-jpl/src/m/plot/plot_unit.py	(revision 17643)
+@@ -23,15 +23,12 @@
+    
+    #colormap
+    cmap=options.getfieldvalue('colormap',mpl.cm.gnuplot2)
+-   cbar_extend=0
+    if options.exist('cmap_set_over'):
+       over=options.getfieldvalue('cmap_set_over','0.5')
+       cmap.set_over(over)
+-      cbar_extend+=1
+    if options.exist('cmap_set_under'):
+       under=options.getfieldvalue('cmap_set_under','0.5')
+       cmap.set_under(under)
+-      cbar_extend+=1
+ 
+    #normalize colormap if clim/caxis specified
+    if options.exist('clim'):
Index: issm/oecreview/Archive/16554-17801/ISSM-17643-17644.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17643-17644.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17643-17644.diff	(revision 17802)
@@ -0,0 +1,80 @@
+Index: ../trunk-jpl/src/m/classes/transient.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/transient.m	(revision 17643)
++++ ../trunk-jpl/src/m/classes/transient.m	(revision 17644)
+@@ -10,7 +10,7 @@
+ 		isthermal         = 0;
+ 		isgroundingline   = 0;
+ 		isgia             = 0;
+-		isdamage          = 0;
++		isdamageevolution = 0;
+ 		islevelset        = 0;
+ 		requested_outputs = {};
+ 	end
+@@ -31,7 +31,7 @@
+ 			obj.isthermal       = 1;
+ 			obj.isgroundingline = 0;
+ 			obj.isgia           = 0;
+-			obj.isdamage        = 0;
++			obj.isdamageevolution = 0;
+ 			obj.islevelset      = 0;
+ 
+ 			%default output
+@@ -54,7 +54,7 @@
+ 			md = checkfield(md,'fieldname','transient.isthermal','numel',[1],'values',[0 1]);
+ 			md = checkfield(md,'fieldname','transient.isgroundingline','numel',[1],'values',[0 1]);
+ 			md = checkfield(md,'fieldname','transient.isgia','numel',[1],'values',[0 1]);
+-			md = checkfield(md,'fieldname','transient.isdamage','numel',[1],'values',[0 1]);
++			md = checkfield(md,'fieldname','transient.isdamageevolution','numel',[1],'values',[0 1]);
+ 			md = checkfield(md,'fieldname','transient.islevelset','numel',[1],'values',[0 1]);
+ 			md = checkfield(md,'fieldname','transient.requested_outputs','stringrow',1);
+ 
+@@ -67,7 +67,7 @@
+ 			fielddisplay(obj,'isthermal','indicates whether a thermal solution is used in the transient');
+ 			fielddisplay(obj,'isgroundingline','indicates whether a groundingline migration is used in the transient');
+ 			fielddisplay(obj,'isgia','indicates whether a postglacial rebound model is used in the transient');
+-			fielddisplay(obj,'isdamage','indicates whether damage evolution is used in the transient');
++			fielddisplay(obj,'isdamageevolution','indicates whether damage evolution is used in the transient');
+ 			fielddisplay(obj,'islevelset','LEVEL SET DESCRIPTION...');
+ 			fielddisplay(obj,'requested_outputs','list of additional outputs requested');
+ 
+@@ -78,7 +78,7 @@
+ 			WriteData(fid,'object',obj,'fieldname','isthermal','format','Boolean');
+ 			WriteData(fid,'object',obj,'fieldname','isgroundingline','format','Boolean');
+ 			WriteData(fid,'object',obj,'fieldname','isgia','format','Boolean');
+-			WriteData(fid,'object',obj,'fieldname','isdamage','format','Boolean');
++			WriteData(fid,'object',obj,'fieldname','isdamageevolution','format','Boolean');
+ 			WriteData(fid,'object',obj,'fieldname','islevelset','format','Boolean');
+ 
+ 			%process requested outputs
+Index: ../trunk-jpl/src/m/classes/damage.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/damage.m	(revision 17643)
++++ ../trunk-jpl/src/m/classes/damage.m	(revision 17644)
+@@ -174,17 +174,17 @@
+ 				WriteData(fid,'object',obj,'fieldname','stress_threshold','format','Double');
+ 				WriteData(fid,'object',obj,'fieldname','healing','format','Double');
+ 				WriteData(fid,'object',obj,'fieldname','equiv_stress','format','Integer');
+-					
+-				%process requested outputs
+-				outputs = obj.requested_outputs;
+-				pos = find(ismember(outputs,'default'));
+-				if ~isempty(pos),
+-					outputs(pos) = [];                         %remove 'default' from outputs
+-					outputs      = [outputs defaultoutputs(obj,md)]; %add defaults
+-				end
+-				WriteData(fid,'data',outputs,'enum',DamageEvolutionRequestedOutputsEnum,'format','StringArray');
+ 			end
+ 
++			%process requested outputs
++			outputs = obj.requested_outputs;
++			pos = find(ismember(outputs,'default'));
++			if ~isempty(pos),
++				outputs(pos) = [];                         %remove 'default' from outputs
++				outputs      = [outputs defaultoutputs(obj,md)]; %add defaults
++			end
++			WriteData(fid,'data',outputs,'enum',DamageEvolutionRequestedOutputsEnum,'format','StringArray');
++
+ 		end % }}}
+ 	end
+ end
Index: issm/oecreview/Archive/16554-17801/ISSM-17644-17645.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17644-17645.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17644-17645.diff	(revision 17802)
@@ -0,0 +1,42 @@
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17644)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17645)
+@@ -26,7 +26,6 @@
+ 	/*Requested outputs*/
+ 	iomodel->FetchData(&requestedoutputs,&numoutputs,DamageEvolutionRequestedOutputsEnum);
+ 	parameters->AddObject(new IntParam(DamageEvolutionNumRequestedOutputsEnum,numoutputs));
+-	_printf0_("numoutputs = " << numoutputs << ", requestedoutputs = " << requestedoutputs);
+ 	if(numoutputs)parameters->AddObject(new StringArrayParam(DamageEvolutionRequestedOutputsEnum,requestedoutputs,numoutputs));
+ 	iomodel->DeleteData(&requestedoutputs,numoutputs,DamageEvolutionRequestedOutputsEnum);
+ 
+@@ -79,7 +78,7 @@
+ }/*}}}*/
+ void DamageEvolutionAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ 
+-	int stabilization;
++	int stabilization,finitelelement;
+ 	iomodel->Constant(&stabilization,DamageStabilizationEnum);
+ 
+ 	IoModelToConstraintsx(constraints,iomodel,DamageSpcdamageEnum,DamageEvolutionAnalysisEnum,P1Enum);
+@@ -208,15 +207,15 @@
+ 		if(stabilization==2){
+ 			if(dim==1){
+ 				vel=fabs(vx)+1.e-8;
+-				D[0]=h/(2*vel)*vx*vx;
++				D[0]=h/(2.0*vel)*vx*vx;
+ 			}
+ 			else{
+ 				/*Streamline upwinding*/
+ 				vel=sqrt(vx*vx+vy*vy)+1.e-8;
+-				D[0*dim+0]=h/(2*vel)*vx*vx;
+-				D[1*dim+0]=h/(2*vel)*vy*vx;
+-				D[0*dim+1]=h/(2*vel)*vx*vy;
+-				D[1*dim+1]=h/(2*vel)*vy*vy;
++				D[0*dim+0]=h/(2.0*vel)*vx*vx;
++				D[1*dim+0]=h/(2.0*vel)*vy*vx;
++				D[0*dim+1]=h/(2.0*vel)*vx*vy;
++				D[1*dim+1]=h/(2.0*vel)*vy*vy;
+ 			}
+ 		}
+ 		else if(stabilization==1){
Index: issm/oecreview/Archive/16554-17801/ISSM-17645-17646.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17645-17646.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17645-17646.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17645)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17646)
+@@ -59,7 +59,7 @@
+ 	/*What input do I need to run my damage evolution model?*/
+ 	iomodel->FetchDataToInput(elements,VxEnum);
+ 	iomodel->FetchDataToInput(elements,VyEnum);
+-	iomodel->FetchDataToInput(elements,VzEnum);
++	if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchDataToInput(elements,VzEnum);
+ 	iomodel->FetchDataToInput(elements,DamageDEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,PressureEnum);
Index: issm/oecreview/Archive/16554-17801/ISSM-17646-17647.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17646-17647.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17646-17647.diff	(revision 17802)
@@ -0,0 +1,24 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17646)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17647)
+@@ -4482,13 +4482,13 @@
+ 		}
+ 
+ 		/*Add inputs*/
+-		element->AddInput(StrainRatexxEnum,tau_xx,P1DGEnum);
+-		element->AddInput(StrainRateyyEnum,tau_yy,P1DGEnum);
+-		element->AddInput(StrainRatexyEnum,tau_xy,P1DGEnum);
++		element->AddInput(DeviatoricStressxxEnum,tau_xx,P1DGEnum);
++		element->AddInput(DeviatoricStressyyEnum,tau_yy,P1DGEnum);
++		element->AddInput(DeviatoricStressxyEnum,tau_xy,P1DGEnum);
+ 		if(dim==3){
+-			element->AddInput(StrainRatezzEnum,tau_zz,P1DGEnum);
+-			element->AddInput(StrainRatexzEnum,tau_xz,P1DGEnum);
+-			element->AddInput(StrainRateyzEnum,tau_yz,P1DGEnum);
++			element->AddInput(DeviatoricStresszzEnum,tau_zz,P1DGEnum);
++			element->AddInput(DeviatoricStressxzEnum,tau_xz,P1DGEnum);
++			element->AddInput(DeviatoricStressyzEnum,tau_yz,P1DGEnum);
+ 		}
+ 
+ 		/*Clean up and */
Index: issm/oecreview/Archive/16554-17801/ISSM-17647-17648.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17647-17648.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17647-17648.diff	(revision 17802)
@@ -0,0 +1,32 @@
+Index: ../trunk-jpl/src/m/coordsystems/xy2ll.py
+===================================================================
+--- ../trunk-jpl/src/m/coordsystems/xy2ll.py	(revision 17647)
++++ ../trunk-jpl/src/m/coordsystems/xy2ll.py	(revision 17648)
+@@ -24,12 +24,12 @@
+ 		slat  = args[1]
+ 	elif len(args) == 0:
+ 		if sgn == 1:
+-			delta = 45 
+-			slat = 70
++			delta = 45. 
++			slat = 70.
+ 			print 'Warning: expecting coordinates in polar stereographic (Std Latitude: 70degN Meridian: 45deg)'
+ 		elif sgn == -1:
+-			delta = 0  
+-			slat = 71
++			delta = 0.  
++			slat = 71.
+ 			print 'Warning: expecting coordinates in polar stereographic (Std Latitude: 71degS Meridian: 0deg)'
+ 		else:
+ 			raise ValueError('sgn should be either +1 or -1')
+@@ -70,8 +70,8 @@
+ 	lon = npy.arctan2(sgn * x,-sgn * y)
+ 	lon = sgn * lon
+ 	
+-	res1 = npy.nonzero(rho <= 0.1)
+-	if len(res1[0] > 0):
++	res1 = npy.nonzero(rho <= 0.1)[0]
++	if len(res1) > 0:
+ 		lat[res1] = 90. * sgn
+ 		lon[res1] = 0.0
+ 	
Index: issm/oecreview/Archive/16554-17801/ISSM-17648-17649.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17648-17649.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17648-17649.diff	(revision 17802)
@@ -0,0 +1,30 @@
+Index: ../trunk-jpl/src/m/plot/colormaps/cmaptools.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/colormaps/cmaptools.py	(revision 0)
++++ ../trunk-jpl/src/m/plot/colormaps/cmaptools.py	(revision 17649)
+@@ -0,0 +1,25 @@
++import numpy as npy
++
++try:
++	import matplotlib as mpl
++except ImportError:
++	print 'cannot import matplotlib, no plotting capabilities enabled'
++
++def truncate_colormap(cmap, minval=0.0, maxval=1.0, n=100):
++	'''
++	truncate a colormap within normalized limits [0,1]
++
++	cmap - a matplotlib colormap
++	minval - minimum value, normalized, of cmap to be returned.
++	maxval - maximum value, normalized, of cmap to be returned.
++	n - number of levels to use in constructing the new colormap
++
++	Example:
++		newcmap=truncate_colormap(oldcmap,minval=0.2,maxval=0.8,n=128)
++
++	'''
++
++	new_cmap = mpl.colors.LinearSegmentedColormap.from_list('trunc({n},{a:.2f},{b:.2f})'.format(n=cmap.name,
++		a=minval, b=maxval), cmap(npy.linspace(minval, maxval, n)))
++	
++	return new_cmap
Index: issm/oecreview/Archive/16554-17801/ISSM-17649-17650.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17649-17650.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17649-17650.diff	(revision 17802)
@@ -0,0 +1,201 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17649)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17650)
+@@ -6,7 +6,7 @@
+ #include "../solutionsequences/solutionsequences.h"
+ #include "../cores/cores.h"
+ 
+-//#define FSANALYTICAL 10
++//#define FSANALYTICAL 2
+ 
+ /*Model processing*/
+ int  StressbalanceAnalysis::DofsPerNode(int** pdoftype,int meshtype,int approximation){/*{{{*/
+@@ -3208,11 +3208,12 @@
+ #ifdef FSANALYTICAL
+ ElementVector* StressbalanceAnalysis::CreatePVectorFS(Element* element){/*{{{*/
+ 
+-	int         i,meshtype,dim;
++	int         i,meshtype,dim,fe_FS;
+ 	IssmDouble  x_coord,y_coord,z_coord;
+ 	IssmDouble  Jdet,forcex,forcey,forcez;
+ 	IssmDouble *xyz_list = NULL;
+ 
++	element->FindParam(&fe_FS,FlowequationFeFSEnum);
+ 	element->FindParam(&meshtype,MeshTypeEnum);
+ 	switch(meshtype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+@@ -3270,6 +3271,13 @@
+ 	xDelete<int>(cs_list);
+ 	xDelete<IssmDouble>(vbasis);
+ 	xDelete<IssmDouble>(xyz_list);
++	if(fe_FS==XTaylorHoodEnum){
++		ElementVector* pe2=CreatePVectorFSViscousXTH(element);
++		ElementVector* pe3 = new ElementVector(pe,pe2);
++		delete pe;
++		delete pe2;
++		return pe3;
++	}
+ 	return pe;
+ }/*}}}*/
+ #else
+@@ -3551,7 +3559,7 @@
+ 	xDelete<int>(cs_list);
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(Dstar);
+-xDelete<IssmDouble>(d);
++	xDelete<IssmDouble>(d);
+ 	xDelete<IssmDouble>(D);
+ 	xDelete<IssmDouble>(tau);
+ 	xDelete<IssmDouble>(vdbasis);
+@@ -4381,7 +4389,11 @@
+ 				dnorm = sqrt( epsxx_old*epsxx_old + epsyy_old*epsyy_old + epszz_old*epszz_old 
+ 							+2.*(epsxy_old*epsxy_old + epsxz_old*epsxz_old + epsyz_old*epsyz_old));
+ 			}
++			/*Initial guess cannot be 0 otherwise log(0)  - inf*/
++			if(dnorm==0.) dnorm=1.;
+ 			NewtonSolveDnorm(&dnorm,coef1,coef2,coef3,n,dnorm);
++			_assert_(dnorm>=0.);
++			_assert_(!xIsNan<IssmDouble>(dnorm));
+ 
+ 			/*Create Ke*/
+ 			D_scalar=(coef1*pow(dnorm,(1.-n)/n)+r)*gauss->weight*Jdet;
+@@ -4413,18 +4425,21 @@
+ 			Matrix3x3Solve(&d_xx[0],Ke,pe_xx);
+ 			Matrix3x3Solve(&d_yy[0],Ke,pe_yy);
+ 			Matrix3x3Solve(&d_xy[0],Ke,pe_xy);
++			for(int i=0;i<3;i++) _assert_(!xIsNan<IssmDouble>(d_xx[i]));
++			for(int i=0;i<3;i++) _assert_(!xIsNan<IssmDouble>(d_yy[i]));
++			for(int i=0;i<3;i++) _assert_(!xIsNan<IssmDouble>(d_xx[i]));
+ 			element->AddInput(StrainRatexxEnum,d_xx,P1DGEnum);
+ 			element->AddInput(StrainRateyyEnum,d_yy,P1DGEnum);
+ 			element->AddInput(StrainRatexyEnum,d_xy,P1DGEnum);
+ 		}
+ 		else{
+ 			_assert_(tnumnodes==4);
+-			Matrix3x3Solve(&d_xx[0],Ke,pe_xx);
+-			Matrix3x3Solve(&d_yy[0],Ke,pe_yy);
+-			Matrix3x3Solve(&d_xy[0],Ke,pe_xy);
+-			Matrix3x3Solve(&d_zz[0],Ke,pe_zz);
+-			Matrix3x3Solve(&d_xz[0],Ke,pe_xz);
+-			Matrix3x3Solve(&d_yz[0],Ke,pe_yz);
++			Matrix4x4Solve(&d_xx[0],Ke,pe_xx);
++			Matrix4x4Solve(&d_yy[0],Ke,pe_yy);
++			Matrix4x4Solve(&d_xy[0],Ke,pe_xy);
++			Matrix4x4Solve(&d_zz[0],Ke,pe_zz);
++			Matrix4x4Solve(&d_xz[0],Ke,pe_xz);
++			Matrix4x4Solve(&d_yz[0],Ke,pe_yz);
+ 			element->AddInput(StrainRatexxEnum,d_xx,P1DGEnum);
+ 			element->AddInput(StrainRateyyEnum,d_yy,P1DGEnum);
+ 			element->AddInput(StrainRatexyEnum,d_xy,P1DGEnum);
+Index: ../trunk-jpl/src/c/shared/Numerics/NewtonSolveDnorm.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Numerics/NewtonSolveDnorm.cpp	(revision 17649)
++++ ../trunk-jpl/src/c/shared/Numerics/NewtonSolveDnorm.cpp	(revision 17650)
+@@ -14,7 +14,7 @@
+ 
+ 	/*trivial solution*/
+ 	if(c3==0.){
+-		*pdnorm =0.;
++		*pdnorm = 0.;
+ 		return 0;
+ 	}
+ 
+@@ -25,6 +25,7 @@
+ 	IssmDouble threshold = 1.e-12;
+ 
+ 	/*Initial guess*/
++	_assert_(dnorm>0.); 
+ 	IssmDouble y1 = log10(dnorm);
+ 
+ 	while(true){
+@@ -40,9 +41,12 @@
+ 			counter++;
+ 		}
+ 
+-		if(counter>50) _error_("Could not converge");
++		if(counter>50) break;
+ 	}
+ 
++	/*Avoid extremely large values that indicate non convergence*/
++	if(y2>50.) y2 = 50;
++
+ 	/*Assign output pointer*/
+ 	*pdnorm = pow(10.,y2);
+ 	return 0;
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp	(revision 17649)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp	(revision 17650)
+@@ -18,6 +18,7 @@
+ 	Vector<IssmDouble>*  pf     = NULL;
+ 	Vector<IssmDouble>*  df     = NULL;
+ 	Vector<IssmDouble>*  ys     = NULL;
++	IssmDouble           eps_rel;
+ 	int  configuration_type,max_nonlinear_iterations;
+ 
+ 	/*Create analysis*/
+@@ -25,19 +26,20 @@
+ 
+ 	/*Recover parameters: */
+ 	femmodel->parameters->FindParam(&configuration_type,ConfigurationTypeEnum);
++	femmodel->parameters->FindParam(&eps_rel,StressbalanceReltolEnum);
+ 	femmodel->parameters->FindParam(&max_nonlinear_iterations,StressbalanceMaxiterEnum);
++	femmodel->parameters->SetParam(.6,AugmentedLagrangianREnum);
+ 
+ 	/*Update constraints and initialize d and tau if necessary*/
+ 	femmodel->UpdateConstraintsx();
+ 	analysis->InitializeXTH(femmodel->elements,femmodel->parameters);
+ 
+ 	/*Convergence criterion*/
+-	int        count   = 0;
+-	IssmDouble eps_rel = .001;
+-	femmodel->parameters->SetParam(.6,AugmentedLagrangianREnum);
++	int  count = 0;
+ 	GetSolutionFromInputsx(&ug,femmodel);
+ 
+ 	while(true){
++		count++;
+ 
+ 		/*save pointer to old velocity*/
+ 		delete ug_old;ug_old=ug;
+@@ -46,22 +48,11 @@
+ 		SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
+ 		CreateNodalConstraintsx(&ys,femmodel->nodes,configuration_type);
+ 		Reduceloadx(pf, Kfs, ys); delete Kfs;
+-
+-	//	pf->Echo();
+-	//	IssmDouble* temp=Kff->ToSerial();
+-	//	int m,n;
+-	//	Kff->GetSize(&m,&n);
+-	//	printarray(temp,m,n);
+-	//	xDelete<IssmDouble>(temp);
+-
+ 		Solverx(&uf, Kff, pf, NULL, df, femmodel->parameters); 
+-		//uf->Echo();
+ 		delete Kff; delete pf; delete df;
+-
+ 		Mergesolutionfromftogx(&ug, uf,ys,femmodel->nodes,femmodel->parameters);delete uf; delete ys;
+ 
+ 		/*Update solution*/
+-		_printf_("ug norm = " << ug->Norm(NORM_TWO) << "\n");
+ 		InputUpdateFromSolutionx(femmodel,ug); 
+ 
+ 		/*Update d and tau accordingly*/
+@@ -80,10 +71,14 @@
+ 			if(VerboseConvergence()) _printf0_(setw(50) << left << "   Convergence criterion: norm(du)/norm(u)" << ndu/nu*100 << " > " << eps_rel*100 << " %\n");
+ 		}
+ 
+-		count++;
+-		if(count>=max_nonlinear_iterations) break;
++		if(count>=max_nonlinear_iterations){
++			_printf0_("   maximum number of nonlinear iterations (" << max_nonlinear_iterations << ") exceeded\n"); 
++			break;
++		}
+ 	}
+ 
++	if(VerboseConvergence()) _printf0_("\n   total number of iterations: " << count-1 << "\n");
++
+ 	delete ug;  
+ 	delete ug_old;  
+ 	delete analysis;
Index: issm/oecreview/Archive/16554-17801/ISSM-17650-17651.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17650-17651.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17650-17651.diff	(revision 17802)
@@ -0,0 +1,78 @@
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17650)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17651)
+@@ -624,6 +624,7 @@
+ 	AbsoluteEnum,
+ 	IncrementalEnum,
+ 	AugmentedLagrangianREnum,
++	AugmentedLagrangianThetaEnum,
+ 	/*}}}*/
+ 	/*Grounding Line{{{*/
+ 	NoneEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17650)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17651)
+@@ -603,6 +603,7 @@
+ 		case AbsoluteEnum : return "Absolute";
+ 		case IncrementalEnum : return "Incremental";
+ 		case AugmentedLagrangianREnum : return "AugmentedLagrangianR";
++		case AugmentedLagrangianThetaEnum : return "AugmentedLagrangianTheta";
+ 		case NoneEnum : return "None";
+ 		case AgressiveMigrationEnum : return "AgressiveMigration";
+ 		case SoftMigrationEnum : return "SoftMigration";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17650)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17651)
+@@ -615,6 +615,7 @@
+ 	      else if (strcmp(name,"Absolute")==0) return AbsoluteEnum;
+ 	      else if (strcmp(name,"Incremental")==0) return IncrementalEnum;
+ 	      else if (strcmp(name,"AugmentedLagrangianR")==0) return AugmentedLagrangianREnum;
++	      else if (strcmp(name,"AugmentedLagrangianTheta")==0) return AugmentedLagrangianThetaEnum;
+ 	      else if (strcmp(name,"None")==0) return NoneEnum;
+ 	      else if (strcmp(name,"AgressiveMigration")==0) return AgressiveMigrationEnum;
+ 	      else if (strcmp(name,"SoftMigration")==0) return SoftMigrationEnum;
+@@ -627,11 +628,11 @@
+ 	      else if (strcmp(name,"GaussTria")==0) return GaussTriaEnum;
+ 	      else if (strcmp(name,"GaussTetra")==0) return GaussTetraEnum;
+ 	      else if (strcmp(name,"GaussPenta")==0) return GaussPentaEnum;
+-	      else if (strcmp(name,"FSSolver")==0) return FSSolverEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"Adjoint")==0) return AdjointEnum;
++	      if (strcmp(name,"FSSolver")==0) return FSSolverEnum;
++	      else if (strcmp(name,"Adjoint")==0) return AdjointEnum;
+ 	      else if (strcmp(name,"Colinear")==0) return ColinearEnum;
+ 	      else if (strcmp(name,"ControlSteady")==0) return ControlSteadyEnum;
+ 	      else if (strcmp(name,"Fset")==0) return FsetEnum;
+Index: ../trunk-jpl/src/m/enum/AugmentedLagrangianThetaEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/AugmentedLagrangianThetaEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/AugmentedLagrangianThetaEnum.m	(revision 17651)
+@@ -0,0 +1,11 @@
++function macro=AugmentedLagrangianThetaEnum()
++%AUGMENTEDLAGRANGIANTHETAENUM - Enum of AugmentedLagrangianTheta
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=AugmentedLagrangianThetaEnum()
++
++macro=StringToEnum('AugmentedLagrangianTheta');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17650)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17651)
+@@ -595,6 +595,7 @@
+ def AbsoluteEnum(): return StringToEnum("Absolute")[0]
+ def IncrementalEnum(): return StringToEnum("Incremental")[0]
+ def AugmentedLagrangianREnum(): return StringToEnum("AugmentedLagrangianR")[0]
++def AugmentedLagrangianThetaEnum(): return StringToEnum("AugmentedLagrangianTheta")[0]
+ def NoneEnum(): return StringToEnum("None")[0]
+ def AgressiveMigrationEnum(): return StringToEnum("AgressiveMigration")[0]
+ def SoftMigrationEnum(): return StringToEnum("SoftMigration")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17651-17652.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17651-17652.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17651-17652.diff	(revision 17802)
@@ -0,0 +1,436 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17651)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17652)
+@@ -6,7 +6,7 @@
+ #include "../solutionsequences/solutionsequences.h"
+ #include "../cores/cores.h"
+ 
+-//#define FSANALYTICAL 2
++//#define FSANALYTICAL 21
+ 
+ /*Model processing*/
+ int  StressbalanceAnalysis::DofsPerNode(int** pdoftype,int meshtype,int approximation){/*{{{*/
+@@ -3038,22 +3038,24 @@
+ 	xDelete<int>(cs_list);
+ 	return Ke;
+ }/*}}}*/
+-ElementMatrix* StressbalanceAnalysis::CreateKMatrixFSFriction(Element* element){/*{{{*/
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixFSShelf(Element* element){/*{{{*/
+ 
+-	if(element->IsFloating() || !element->IsOnBase()) return NULL;
++	if(!element->IsFloating() || !element->IsOnBase()) return NULL;
+ 
+-	/*If on water or not FS, skip stiffness: */
+-	int approximation;
++	/*If on not water or not FS, skip stiffness: */
++	int approximation,shelf_dampening;
+ 	element->GetInputValue(&approximation,ApproximationEnum);
+ 	if(approximation!=FSApproximationEnum && approximation!=SSAFSApproximationEnum && approximation!=HOFSApproximationEnum) return NULL;
++	element->FindParam(&shelf_dampening,StressbalanceShelfDampeningEnum);
++	if(shelf_dampening==0) return NULL;
+ 
+ 	/*Intermediaries*/
+ 	bool        mainlyfloating;
+-	int         i,meshtype,dim,epssize;
+-	int         migration_style,point1;
+-	IssmDouble  alpha2,Jdet,fraction1,fraction2;
+-	IssmDouble  gllevelset,phi=1.;
++	int         j,i,meshtype,dim;
++	IssmDouble  Jdet,slope2,scalar,dt;
++	IssmDouble  slope[3];
+ 	IssmDouble *xyz_list_base = NULL;
++	IssmDouble *xyz_list      = NULL;
+ 	Gauss*      gauss         = NULL;
+ 
+ 	/*Get problem dimension*/
+@@ -3072,83 +3074,59 @@
+ 
+ 	/*Initialize Element matrix and vectors*/
+ 	ElementMatrix* Ke = element->NewElementMatrix(FSvelocityEnum);
+-	IssmDouble*    B  = xNew<IssmDouble>((dim-1)*numdof);
+-	IssmDouble*    D  = xNewZeroInit<IssmDouble>((dim-1)*(dim-1));
++	IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinatesBase(&xyz_list_base);
+-	element->FindParam(&migration_style,GroundinglineMigrationEnum);
+-	Input* vx_input         = element->GetInput(VxEnum);      _assert_(vx_input);
+-	Input* vy_input         = element->GetInput(VyEnum);      _assert_(vy_input);
+-	Input* vz_input         = NULL;
+-	if(dim==3){    vz_input = element->GetInput(VzEnum);      _assert_(vz_input);}
+-	Input* gllevelset_input = NULL;
++	element->GetVerticesCoordinates(&xyz_list);
++	element->FindParam(&dt,TimesteppingTimeStepEnum);
++	if(dt==0)   dt=1.e+5;
++	IssmDouble  rho_water     = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble  gravity       = element->GetMaterialParameter(ConstantsGEnum);
++	Input*      surface_input = element->GetInput(SurfaceEnum); _assert_(surface_input);
+ 
+-	/*build friction object, used later on: */
+-	Friction* friction=new Friction(element,dim==3?3:1);
+-
+-	/*Recover portion of element that is grounded*/
+-	if(migration_style==SubelementMigrationEnum) phi=element->GetGroundedPortion(xyz_list_base);
+-	if(migration_style==SubelementMigration2Enum){
+-		if(meshtype==Mesh2DverticalEnum) _error_("Subelement Migration 2 not implemented yet for Flowline");
+-		gllevelset_input=element->GetInput(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input);
+-		element->GetGroundedPart(&point1,&fraction1,&fraction2,&mainlyfloating);
+-		//gauss = element->NewGauss(point1,fraction1,fraction2,mainlyfloating,2);
+-		gauss=element->NewGaussBase(3);
+-	}
+-	else{
+-		gauss=element->NewGaussBase(3);
+-	}
+-
+ 	/* Start  looping on the number of gaussian points: */
++	gauss=element->NewGaussBase(3);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		gauss->GaussPoint(ig);
+ 
+-		friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input);
+-		if(migration_style==SubelementMigrationEnum) alpha2=phi*alpha2;
+-		if(migration_style==SubelementMigration2Enum){
+-			gllevelset_input->GetInputValue(&gllevelset, gauss);
+-			if(gllevelset<0.) alpha2=0.;
++		surface_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
++		element->NodalFunctionsVelocity(vbasis,gauss);
++		element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
++		if(dim==2) slope2=slope[0]*slope[0];
++		else if(dim==3) slope2=slope[0]*slope[0]+slope[1]*slope[1];
++		scalar  = rho_water*gravity*sqrt(1+slope2)*gauss->weight*Jdet*dt; 
++		for(i=0;i<vnumnodes;i++){
++			for(j=0;j<vnumnodes;j++){
++				Ke->values[numdof*((i+1)*dim-1)+(j+1)*dim-1] += scalar*vbasis[i]*vbasis[j];
++			}
+ 		}
+-
+-		this->GetBFSFriction(B,element,dim,xyz_list_base,gauss);
+-		element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
+-		for(int i=0;i<dim-1;i++) D[i*(dim-1)+i] = alpha2*gauss->weight*Jdet; //taub_x = -alpha2 v_x (same for y)
+-
+-		TripleMultiply(B,dim-1,numdof,1,
+-					D,dim-1,dim-1,0,
+-					B,dim-1,numdof,0,
+-					&Ke->values[0],1);
+ 	}
+ 
+ 	/*DO NOT Transform Coordinate System: this stiffness matrix is already expressed in tangential coordinates*/
+ 
+ 	/*Clean up and return*/
+ 	delete gauss;
+-	delete friction;
+ 	xDelete<IssmDouble>(xyz_list_base);
+-	xDelete<IssmDouble>(B);
+-	xDelete<IssmDouble>(D);
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(vbasis);
+ 	return Ke;
+ }/*}}}*/
+-ElementMatrix* StressbalanceAnalysis::CreateKMatrixFSShelf(Element* element){/*{{{*/
++#ifdef FSANALYTICAL
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixFSFriction(Element* element){/*{{{*/
+ 
+-	if(!element->IsFloating() || !element->IsOnBase()) return NULL;
++	if(element->IsFloating() || !element->IsOnBase()) return NULL;
+ 
+-	/*If on not water or not FS, skip stiffness: */
+-	int approximation,shelf_dampening;
++	/*If on water or not FS, skip stiffness: */
++	int approximation;
+ 	element->GetInputValue(&approximation,ApproximationEnum);
+ 	if(approximation!=FSApproximationEnum && approximation!=SSAFSApproximationEnum && approximation!=HOFSApproximationEnum) return NULL;
+-	element->FindParam(&shelf_dampening,StressbalanceShelfDampeningEnum);
+-	if(shelf_dampening==0) return NULL;
+ 
+ 	/*Intermediaries*/
+-	bool        mainlyfloating;
+-	int         j,i,meshtype,dim;
+-	IssmDouble  Jdet,slope2,scalar,dt;
+-	IssmDouble  slope[3];
++	int         i,meshtype,dim;
++	IssmDouble  alpha2,Jdet;
++	IssmDouble  x_coord,y_coord,z_coord;
+ 	IssmDouble *xyz_list_base = NULL;
+-	IssmDouble *xyz_list      = NULL;
+ 	Gauss*      gauss         = NULL;
+ 
+ 	/*Get problem dimension*/
+@@ -3167,33 +3145,36 @@
+ 
+ 	/*Initialize Element matrix and vectors*/
+ 	ElementMatrix* Ke = element->NewElementMatrix(FSvelocityEnum);
+-	IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
++	IssmDouble*    B  = xNew<IssmDouble>((dim-1)*numdof);
++	IssmDouble*    D  = xNewZeroInit<IssmDouble>((dim-1)*(dim-1));
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinatesBase(&xyz_list_base);
+-	element->GetVerticesCoordinates(&xyz_list);
+-	element->FindParam(&dt,TimesteppingTimeStepEnum);
+-	if(dt==0)   dt=1.e+5;
+-	IssmDouble  rho_water     = element->GetMaterialParameter(MaterialsRhoWaterEnum);
+-	IssmDouble  gravity       = element->GetMaterialParameter(ConstantsGEnum);
+-	Input*      surface_input = element->GetInput(SurfaceEnum); _assert_(surface_input);
++	Input* vx_input         = element->GetInput(VxEnum);      _assert_(vx_input);
++	Input* vy_input         = element->GetInput(VyEnum);      _assert_(vy_input);
++	Input* vz_input         = NULL;
++	if(dim==3){    vz_input = element->GetInput(VzEnum);      _assert_(vz_input);}
+ 
+ 	/* Start  looping on the number of gaussian points: */
+-	gauss=element->NewGaussBase(3);
++	gauss=element->NewGaussBase(10);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		gauss->GaussPoint(ig);
+ 
+-		surface_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
+-		element->NodalFunctionsVelocity(vbasis,gauss);
++		x_coord=element->GetXcoord(gauss);
++		y_coord=element->GetYcoord(gauss);
++		if(dim==3) z_coord=element->GetZcoord(gauss);
++		else z_coord=0.;
++
++		alpha2=alpha(x_coord,y_coord,z_coord,FSANALYTICAL);
++
++		this->GetBFSFriction(B,element,dim,xyz_list_base,gauss);
+ 		element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
+-		if(dim==2) slope2=slope[0]*slope[0];
+-		else if(dim==3) slope2=slope[0]*slope[0]+slope[1]*slope[1];
+-		scalar  = rho_water*gravity*sqrt(1+slope2)*gauss->weight*Jdet*dt; 
+-		for(i=0;i<vnumnodes;i++){
+-			for(j=0;j<vnumnodes;j++){
+-				Ke->values[numdof*((i+1)*dim-1)+(j+1)*dim-1] += scalar*vbasis[i]*vbasis[j];
+-			}
+-		}
++		for(int i=0;i<dim-1;i++) D[i*(dim-1)+i] = alpha2*gauss->weight*Jdet; //taub_x = -alpha2 v_x (same for y)
++
++		TripleMultiply(B,dim-1,numdof,1,
++					D,dim-1,dim-1,0,
++					B,dim-1,numdof,0,
++					&Ke->values[0],1);
+ 	}
+ 
+ 	/*DO NOT Transform Coordinate System: this stiffness matrix is already expressed in tangential coordinates*/
+@@ -3201,11 +3182,10 @@
+ 	/*Clean up and return*/
+ 	delete gauss;
+ 	xDelete<IssmDouble>(xyz_list_base);
+-	xDelete<IssmDouble>(xyz_list);
+-	xDelete<IssmDouble>(vbasis);
++	xDelete<IssmDouble>(B);
++	xDelete<IssmDouble>(D);
+ 	return Ke;
+ }/*}}}*/
+-#ifdef FSANALYTICAL
+ ElementVector* StressbalanceAnalysis::CreatePVectorFS(Element* element){/*{{{*/
+ 
+ 	int         i,meshtype,dim,fe_FS;
+@@ -3281,6 +3261,99 @@
+ 	return pe;
+ }/*}}}*/
+ #else
++ElementMatrix* StressbalanceAnalysis::CreateKMatrixFSFriction(Element* element){/*{{{*/
++
++	if(element->IsFloating() || !element->IsOnBase()) return NULL;
++
++	/*If on water or not FS, skip stiffness: */
++	int approximation;
++	element->GetInputValue(&approximation,ApproximationEnum);
++	if(approximation!=FSApproximationEnum && approximation!=SSAFSApproximationEnum && approximation!=HOFSApproximationEnum) return NULL;
++
++	/*Intermediaries*/
++	bool        mainlyfloating;
++	int         i,meshtype,dim,epssize;
++	int         migration_style,point1;
++	IssmDouble  alpha2,Jdet,fraction1,fraction2;
++	IssmDouble  gllevelset,phi=1.;
++	IssmDouble *xyz_list_base = NULL;
++	Gauss*      gauss         = NULL;
++
++	/*Get problem dimension*/
++	element->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2;break;
++		case Mesh3DEnum:         dim = 3;break;
++		case Mesh3DtetrasEnum:   dim = 3;break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int vnumnodes = element->NumberofNodesVelocity();
++	int pnumnodes = element->NumberofNodesPressure();
++	int numdof    = vnumnodes*dim + pnumnodes;
++
++	/*Initialize Element matrix and vectors*/
++	ElementMatrix* Ke = element->NewElementMatrix(FSvelocityEnum);
++	IssmDouble*    B  = xNew<IssmDouble>((dim-1)*numdof);
++	IssmDouble*    D  = xNewZeroInit<IssmDouble>((dim-1)*(dim-1));
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinatesBase(&xyz_list_base);
++	element->FindParam(&migration_style,GroundinglineMigrationEnum);
++	Input* vx_input         = element->GetInput(VxEnum);      _assert_(vx_input);
++	Input* vy_input         = element->GetInput(VyEnum);      _assert_(vy_input);
++	Input* vz_input         = NULL;
++	if(dim==3){    vz_input = element->GetInput(VzEnum);      _assert_(vz_input);}
++	Input* gllevelset_input = NULL;
++
++	/*build friction object, used later on: */
++	Friction* friction=new Friction(element,dim==3?3:1);
++
++	/*Recover portion of element that is grounded*/
++	if(migration_style==SubelementMigrationEnum) phi=element->GetGroundedPortion(xyz_list_base);
++	if(migration_style==SubelementMigration2Enum){
++		if(meshtype==Mesh2DverticalEnum) _error_("Subelement Migration 2 not implemented yet for Flowline");
++		gllevelset_input=element->GetInput(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input);
++		element->GetGroundedPart(&point1,&fraction1,&fraction2,&mainlyfloating);
++		//gauss = element->NewGauss(point1,fraction1,fraction2,mainlyfloating,2);
++		gauss=element->NewGaussBase(3);
++	}
++	else{
++		gauss=element->NewGaussBase(3);
++	}
++
++	/* Start  looping on the number of gaussian points: */
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input);
++		if(migration_style==SubelementMigrationEnum) alpha2=phi*alpha2;
++		if(migration_style==SubelementMigration2Enum){
++			gllevelset_input->GetInputValue(&gllevelset, gauss);
++			if(gllevelset<0.) alpha2=0.;
++		}
++
++		this->GetBFSFriction(B,element,dim,xyz_list_base,gauss);
++		element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
++		for(int i=0;i<dim-1;i++) D[i*(dim-1)+i] = alpha2*gauss->weight*Jdet; //taub_x = -alpha2 v_x (same for y)
++
++		TripleMultiply(B,dim-1,numdof,1,
++					D,dim-1,dim-1,0,
++					B,dim-1,numdof,0,
++					&Ke->values[0],1);
++	}
++
++	/*DO NOT Transform Coordinate System: this stiffness matrix is already expressed in tangential coordinates*/
++
++	/*Clean up and return*/
++	delete gauss;
++	delete friction;
++	xDelete<IssmDouble>(xyz_list_base);
++	xDelete<IssmDouble>(B);
++	xDelete<IssmDouble>(D);
++	return Ke;
++}/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorFS(Element* element){/*{{{*/
+ 
+ 	ElementVector* pe = NULL;
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h	(revision 17651)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h	(revision 17652)
+@@ -10,5 +10,6 @@
+ IssmDouble fx(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord, int testid);
+ IssmDouble fy(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord, int testid);
+ IssmDouble fz(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord, int testid);
++IssmDouble alpha(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord, int testid);
+ 
+ #endif //ifndef _SHARED_ANALYTICALS_H_
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp	(revision 17651)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp	(revision 17652)
+@@ -24,7 +24,7 @@
+ 		case 1:
+ 			z=y;
+ 			return  4*pow(x, 2)*z*pow(x - 1, 2) + 4*pow(x, 2)*z*(z - 1)*(2*z - 1) + 4*pow(x, 2)*pow(x - 1, 2)*(z - 1) + 2*pow(x, 2)*pow(x - 1, 2)*(2*z - 1) + 16*x*z*(x - 1)*(z - 1)*(2*z - 1) - 4*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) + 6*pow(z, 2)*(6*pow(x, 2) - 6*x + 1) + 4*z*pow(x - 1, 2)*(z - 1)*(2*z - 1) - 2*z*(6*pow(x, 2) - 6*x + 1) + z - 1.0L/2.0L;
+-		case 2: 
++		case 2: case 11:
+ 			z=y;
+ 			return 10*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 3)*pow(sin(PI*p*z), 2)*cos(PI*p*z) - 2*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 3)*pow(cos(PI*p*z), 3) - 6*pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*pow(sin(PI*p*z), 2)*pow(cos(PI*p*x), 2)*cos(PI*p*z) + PI*q*sin(PI*q*z)*cos(PI*q*x);
+ 		case 3: 
+@@ -38,12 +38,17 @@
+ 		case 7: 
+ 			z=y;
+ 			return 4*pow(x, 2)*z*pow(x - 1, 2) + 4*pow(x, 2)*z*(z - 1)*(2*z - 1) + 4*pow(x, 2)*pow(x - 1, 2)*(z - 1) + 2*pow(x, 2)*pow(x - 1, 2)*(2*z - 1) + 16*x*z*(x - 1)*(z - 1)*(2*z - 1) - 4*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) + 6*pow(z, 2)*(6*pow(x, 2) - 6*x + 1) + 4*z*pow(x - 1, 2)*(z - 1)*(2*z - 1) - 2*z*(6*pow(x, 2) - 6*x + 1) + 1;
+-		case 8: 
++		case 8: case 18:
+ 			return 1.0;
+ 		case 9:
+ 			return 4*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*sin(PI*p*y)*sin(PI*p*z) + 2*pow(PI, 2)*pow(p, 2)*sin(PI*p*y)*sin(PI*p*z)*cos(PI*p*x) + 2*x*z;
+ 		case 10:
+ 			return 4*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*sin(PI*p*y)*sin(PI*p*z) + 2*pow(PI, 2)*pow(p, 2)*sin(PI*p*y)*sin(PI*p*z)*cos(PI*p*x) + PI*q*pow(z, a)*sin(PI*q*y)*cos(PI*q*x);
++		case 21:
++			z=y;
++			return z - 4.0L/3.0L*pow(2, 1.0L/3.0L)*(pow(x, 2)*z*(x - 1)*(z - 1)*(2*z - 1) + x*z*pow(x - 1, 2)*(z - 1)*(2*z - 1))*(4*(pow(x, 2)*z*(x - 1)*(z - 1)*(2*z - 1) + x*z*pow(x - 1, 2)*(z - 1)*(2*z - 1))*(pow(x, 2)*z*(z - 1)*(2*z - 1) + 4*x*z*(x - 1)*(z - 1)*(2*z - 1) + z*pow(x - 1, 2)*(z - 1)*(2*z - 1)) + 4*(2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - 3*pow(z, 2)*(6*pow(x, 2) - 6*x + 1) + z*(6*pow(x, 2) - 6*x + 1))*(2*pow(z, 3)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 3*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + z*(2*pow(x, 3) - 3*pow(x, 2) + x)) + (2*pow(x, 2)*z*pow(x - 1, 2)*(z - 1) + pow(x, 2)*z*pow(x - 1, 2)*(2*z - 1) + pow(x, 2)*pow(x - 1, 2)*(z - 1)*(2*z - 1) - pow(z, 4)*(6*pow(x, 2) - 6*x + 1) + 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - pow(z, 2)*(6*pow(x, 2) - 6*x + 1))*(2*pow(x, 2)*z*(x - 1)*(z - 1) + pow(x, 2)*z*(x - 1)*(2*z - 1) + pow(x, 2)*(x - 1)*(z - 1)*(2*z - 1) + 2*x*z*pow(x - 1, 2)*(z - 1) + x*z*pow(x - 1, 2)*(2*z - 1) + x*pow(x - 1, 2)*(z - 1)*(2*z - 1) - 3*pow(z, 4)*(2*x - 1) + 6*pow(z, 3)*(2*x - 1) - 3*pow(z, 2)*(2*x - 1)))/pow(4*pow(pow(x, 2)*z*(x - 1)*(z - 1)*(2*z - 1) + x*z*pow(x - 1, 2)*(z - 1)*(2*z - 1), 2) + 4*pow(2*pow(z, 3)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 3*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + z*(2*pow(x, 3) - 3*pow(x, 2) + x), 2) + (1.0L/2.0L)*pow(2*pow(x, 2)*z*pow(x - 1, 2)*(z - 1) + pow(x, 2)*z*pow(x - 1, 2)*(2*z - 1) + pow(x, 2)*pow(x - 1, 2)*(z - 1)*(2*z - 1) - pow(z, 4)*(6*pow(x, 2) - 6*x + 1) + 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - pow(z, 2)*(6*pow(x, 2) - 6*x + 1), 2), 4.0L/3.0L) - 1.0L/3.0L*pow(2, 1.0L/3.0L)*(4*(pow(x, 2)*z*(x - 1)*(z - 1)*(2*z - 1) + x*z*pow(x - 1, 2)*(z - 1)*(2*z - 1))*(2*pow(x, 2)*z*(x - 1)*(z - 1) + pow(x, 2)*z*(x - 1)*(2*z - 1) + pow(x, 2)*(x - 1)*(z - 1)*(2*z - 1) + 2*x*z*pow(x - 1, 2)*(z - 1) + x*z*pow(x - 1, 2)*(2*z - 1) + x*pow(x - 1, 2)*(z - 1)*(2*z - 1)) + 4*(2*pow(z, 3)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 3*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + z*(2*pow(x, 3) - 3*pow(x, 2) + x))*(2*pow(x, 3) - 3*pow(x, 2) + x + 6*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 6*z*(2*pow(x, 3) - 3*pow(x, 2) + x)) + (2*pow(x, 2)*z*pow(x - 1, 2) + 2*pow(x, 2)*pow(x - 1, 2)*(z - 1) + pow(x, 2)*pow(x - 1, 2)*(2*z - 1) - 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) + 3*pow(z, 2)*(6*pow(x, 2) - 6*x + 1) - z*(6*pow(x, 2) - 6*x + 1))*(2*pow(x, 2)*z*pow(x - 1, 2)*(z - 1) + pow(x, 2)*z*pow(x - 1, 2)*(2*z - 1) + pow(x, 2)*pow(x - 1, 2)*(z - 1)*(2*z - 1) - pow(z, 4)*(6*pow(x, 2) - 6*x + 1) + 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - pow(z, 2)*(6*pow(x, 2) - 6*x + 1)))*(2*pow(x, 2)*z*pow(x - 1, 2)*(z - 1) + pow(x, 2)*z*pow(x - 1, 2)*(2*z - 1) + pow(x, 2)*pow(x - 1, 2)*(z - 1)*(2*z - 1) - pow(z, 4)*(6*pow(x, 2) - 6*x + 1) + 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - pow(z, 2)*(6*pow(x, 2) - 6*x + 1))/pow(4*pow(pow(x, 2)*z*(x - 1)*(z - 1)*(2*z - 1) + x*z*pow(x - 1, 2)*(z - 1)*(2*z - 1), 2) + 4*pow(2*pow(z, 3)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 3*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + z*(2*pow(x, 3) - 3*pow(x, 2) + x), 2) + (1.0L/2.0L)*pow(2*pow(x, 2)*z*pow(x - 1, 2)*(z - 1) + pow(x, 2)*z*pow(x - 1, 2)*(2*z - 1) + pow(x, 2)*pow(x - 1, 2)*(z - 1)*(2*z - 1) - pow(z, 4)*(6*pow(x, 2) - 6*x + 1) + 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - pow(z, 2)*(6*pow(x, 2) - 6*x + 1), 2), 4.0L/3.0L) + 2*pow(2, 1.0L/3.0L)*(pow(x, 2)*z*(z - 1)*(2*z - 1) + 4*x*z*(x - 1)*(z - 1)*(2*z - 1) + z*pow(x - 1, 2)*(z - 1)*(2*z - 1))/pow(4*pow(pow(x, 2)*z*(x - 1)*(z - 1)*(2*z - 1) + x*z*pow(x - 1, 2)*(z - 1)*(2*z - 1), 2) + 4*pow(2*pow(z, 3)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 3*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + z*(2*pow(x, 3) - 3*pow(x, 2) + x), 2) + (1.0L/2.0L)*pow(2*pow(x, 2)*z*pow(x - 1, 2)*(z - 1) + pow(x, 2)*z*pow(x - 1, 2)*(2*z - 1) + pow(x, 2)*pow(x - 1, 2)*(z - 1)*(2*z - 1) - pow(z, 4)*(6*pow(x, 2) - 6*x + 1) + 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - pow(z, 2)*(6*pow(x, 2) - 6*x + 1), 2), 1.0L/3.0L) - 1.0L/2.0L + pow(2, 1.0L/3.0L)*(2*pow(x, 2)*z*pow(x - 1, 2) + 2*pow(x, 2)*pow(x - 1, 2)*(z - 1) + pow(x, 2)*pow(x - 1, 2)*(2*z - 1) - 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) + 3*pow(z, 2)*(6*pow(x, 2) - 6*x + 1) - z*(6*pow(x, 2) - 6*x + 1))/pow(4*pow(pow(x, 2)*z*(x - 1)*(z - 1)*(2*z - 1) + x*z*pow(x - 1, 2)*(z - 1)*(2*z - 1), 2) + 4*pow(2*pow(z, 3)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 3*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + z*(2*pow(x, 3) - 3*pow(x, 2) + x), 2) + (1.0L/2.0L)*pow(2*pow(x, 2)*z*pow(x - 1, 2)*(z - 1) + pow(x, 2)*z*pow(x - 1, 2)*(2*z - 1) + pow(x, 2)*pow(x - 1, 2)*(z - 1)*(2*z - 1) - pow(z, 4)*(6*pow(x, 2) - 6*x + 1) + 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - pow(z, 2)*(6*pow(x, 2) - 6*x + 1), 2), 1.0L/3.0L);
++		case 24:
++			return 2*pow(2, 1.0L/3.0L)*pow(PI, 2)*pow(p, 2)*sin(PI*p*y)*sin(PI*p*z)*cos(PI*p*x)/pow(6*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*y), 2)*pow(sin(PI*p*z), 2) + (1.0L/2.0L)*pow(-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z), 2), 1.0L/3.0L) - 2.0L/3.0L*pow(2, 1.0L/3.0L)*PI*p*(12*pow(PI, 3)*pow(p, 3)*sin(PI*p*x)*pow(sin(PI*p*y), 2)*pow(sin(PI*p*z), 2)*cos(PI*p*x) - (-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x))*(pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*sin(PI*p*x)*sin(PI*p*z) - 2*pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*z)*cos(PI*p*y)) + (pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z))*(pow(PI, 3)*pow(p, 3)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*cos(PI*p*x)*cos(PI*p*y) + pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*cos(PI*p*x)*cos(PI*p*z)) - (pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z))*(pow(PI, 3)*pow(p, 3)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*sin(PI*p*y) - 2*pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*y)*cos(PI*p*z)))*sin(PI*p*x)*sin(PI*p*y)*sin(PI*p*z)/pow(6*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*y), 2)*pow(sin(PI*p*z), 2) + (1.0L/2.0L)*pow(-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z), 2), 4.0L/3.0L) + PI*q*sin(PI*q*y)*sin(PI*q*z)*cos(PI*q*x) - 1.0L/6.0L*pow(2, 1.0L/3.0L)*(-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x))*(12*pow(PI, 3)*pow(p, 3)*pow(sin(PI*p*x), 2)*sin(PI*p*y)*pow(sin(PI*p*z), 2)*cos(PI*p*y) + (-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x))*(2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*sin(PI*p*y)*sin(PI*p*z) - pow(PI, 2)*pow(p, 2)*sin(PI*p*y)*sin(PI*p*z)*cos(PI*p*x)) - (pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z))*(pow(PI, 3)*pow(p, 3)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*sin(PI*p*y) + pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*y)*cos(PI*p*z)) + (pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z))*(pow(PI, 3)*pow(p, 3)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*cos(PI*p*x)*cos(PI*p*y) - 2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*cos(PI*p*y)*cos(PI*p*z)))/pow(6*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*y), 2)*pow(sin(PI*p*z), 2) + (1.0L/2.0L)*pow(-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z), 2), 4.0L/3.0L) - 1.0L/6.0L*pow(2, 1.0L/3.0L)*(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z))*(12*pow(PI, 3)*pow(p, 3)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*y), 2)*sin(PI*p*z)*cos(PI*p*z) + (-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x))*(-2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*cos(PI*p*y)*cos(PI*p*z) + pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*cos(PI*p*x)*cos(PI*p*z)) - (pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z))*(pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*sin(PI*p*x)*sin(PI*p*z) + pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*z)*cos(PI*p*y)) + (pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z))*(2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*sin(PI*p*y)*sin(PI*p*z) - pow(PI, 2)*pow(p, 2)*sin(PI*p*y)*sin(PI*p*z)*cos(PI*p*x)))/pow(6*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*y), 2)*pow(sin(PI*p*z), 2) + (1.0L/2.0L)*pow(-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z), 2), 4.0L/3.0L) + pow(2, 1.0L/3.0L)*(2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*sin(PI*p*y)*sin(PI*p*z) - pow(PI, 2)*pow(p, 2)*sin(PI*p*y)*sin(PI*p*z)*cos(PI*p*x))/pow(6*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*y), 2)*pow(sin(PI*p*z), 2) + (1.0L/2.0L)*pow(-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z), 2), 1.0L/3.0L);
+ 
+ 		case 101: 
+ 			return 4*pow(x, 2)*y*z*pow(x - 1, 2)*(z - 1) + 8*pow(x, 2)*y*z*(y - 1)*(2*y - 1)*(z - 1) + 2*pow(x, 2)*y*pow(x - 1, 2)*(y - 1)*(2*y - 1) + 4*pow(x, 2)*z*pow(x - 1, 2)*(y - 1)*(z - 1) + 2*pow(x, 2)*z*pow(x - 1, 2)*(2*y - 1)*(z - 1) - 12*x*pow(y, 2)*z*(x - 1)*(y - 1)*(z - 1) - 6*x*pow(y, 2)*z*(2*x - 1)*(y - 1)*(z - 1) - 12*x*y*z*(x - 1)*pow(y - 1, 2)*(z - 1) + 32*x*y*z*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 6*x*y*z*(2*x - 1)*pow(y - 1, 2)*(z - 1) - 6*pow(y, 2)*z*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 8*y*z*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 6*y*z*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1);
+@@ -61,7 +66,7 @@
+ 		case 1:
+ 			z=y;
+ 			return -8*pow(x, 3) + 4*pow(x, 2)*z*(x - 1)*(z - 1) + 2*pow(x, 2)*z*(x - 1)*(2*z - 1) + 2*pow(x, 2)*(x - 1)*(z - 1)*(2*z - 1) + 12*pow(x, 2) + 4*x*z*pow(x - 1, 2)*(z - 1) + 2*x*z*pow(x - 1, 2)*(2*z - 1) + 2*x*pow(x - 1, 2)*(z - 1)*(2*z - 1) - 3*x - 6*pow(z, 4)*(2*x - 1) + 12*pow(z, 3)*(2*x - 1) - 6*pow(z, 2)*(2*x - 1) - 24*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + 24*z*(2*pow(x, 3) - 3*pow(x, 2) + x) - 1.0L/2.0L;
+-		case 2: 
++		case 2: case 11:
+ 			z=y;
+ 			return -10*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*z), 3)*cos(PI*p*x) + 6*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*sin(PI*p*z)*cos(PI*p*x)*pow(cos(PI*p*z), 2) + 2*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*z), 3)*pow(cos(PI*p*x), 3) + PI*q*sin(PI*q*x)*cos(PI*q*z);
+ 		case 3: 
+@@ -75,12 +80,17 @@
+ 		case 7: 
+ 			z=y;
+ 			return -8*pow(x, 3) + 4*pow(x, 2)*z*(x - 1)*(z - 1) + 2*pow(x, 2)*z*(x - 1)*(2*z - 1) + 2*pow(x, 2)*(x - 1)*(z - 1)*(2*z - 1) + 12*pow(x, 2) + 4*x*z*pow(x - 1, 2)*(z - 1) + 2*x*z*pow(x - 1, 2)*(2*z - 1) + 2*x*pow(x - 1, 2)*(z - 1)*(2*z - 1) - 4*x - 6*pow(z, 4)*(2*x - 1) + 12*pow(z, 3)*(2*x - 1) - 6*pow(z, 2)*(2*x - 1) - 24*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + 24*z*(2*pow(x, 3) - 3*pow(x, 2) + x);
+-		case 8: 
++		case 8: case 18:
+ 			return 1.0;
+ 		case 9: 
+ 			return -2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*sin(PI*p*x)*sin(PI*p*z) - pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*z)*cos(PI*p*y) + 2*y*z;
+ 		case 10:
+ 			return -2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*sin(PI*p*x)*sin(PI*p*z) - pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*z)*cos(PI*p*y) + PI*q*pow(z, a)*sin(PI*q*x)*cos(PI*q*y);
++		case 21:
++			z=y;
++			return x + (4.0L/3.0L)*pow(2, 1.0L/3.0L)*(2*pow(z, 3)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 3*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + z*(2*pow(x, 3) - 3*pow(x, 2) + x))*(4*(pow(x, 2)*z*(x - 1)*(z - 1)*(2*z - 1) + x*z*pow(x - 1, 2)*(z - 1)*(2*z - 1))*(2*pow(x, 2)*z*(x - 1)*(z - 1) + pow(x, 2)*z*(x - 1)*(2*z - 1) + pow(x, 2)*(x - 1)*(z - 1)*(2*z - 1) + 2*x*z*pow(x - 1, 2)*(z - 1) + x*z*pow(x - 1, 2)*(2*z - 1) + x*pow(x - 1, 2)*(z - 1)*(2*z - 1)) + 4*(2*pow(z, 3)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 3*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + z*(2*pow(x, 3) - 3*pow(x, 2) + x))*(2*pow(x, 3) - 3*pow(x, 2) + x + 6*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 6*z*(2*pow(x, 3) - 3*pow(x, 2) + x)) + (2*pow(x, 2)*z*pow(x - 1, 2) + 2*pow(x, 2)*pow(x - 1, 2)*(z - 1) + pow(x, 2)*pow(x - 1, 2)*(2*z - 1) - 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) + 3*pow(z, 2)*(6*pow(x, 2) - 6*x + 1) - z*(6*pow(x, 2) - 6*x + 1))*(2*pow(x, 2)*z*pow(x - 1, 2)*(z - 1) + pow(x, 2)*z*pow(x - 1, 2)*(2*z - 1) + pow(x, 2)*pow(x - 1, 2)*(z - 1)*(2*z - 1) - pow(z, 4)*(6*pow(x, 2) - 6*x + 1) + 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - pow(z, 2)*(6*pow(x, 2) - 6*x + 1)))/pow(4*pow(pow(x, 2)*z*(x - 1)*(z - 1)*(2*z - 1) + x*z*pow(x - 1, 2)*(z - 1)*(2*z - 1), 2) + 4*pow(2*pow(z, 3)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 3*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + z*(2*pow(x, 3) - 3*pow(x, 2) + x), 2) + (1.0L/2.0L)*pow(2*pow(x, 2)*z*pow(x - 1, 2)*(z - 1) + pow(x, 2)*z*pow(x - 1, 2)*(2*z - 1) + pow(x, 2)*pow(x - 1, 2)*(z - 1)*(2*z - 1) - pow(z, 4)*(6*pow(x, 2) - 6*x + 1) + 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - pow(z, 2)*(6*pow(x, 2) - 6*x + 1), 2), 4.0L/3.0L) - 1.0L/3.0L*pow(2, 1.0L/3.0L)*(4*(pow(x, 2)*z*(x - 1)*(z - 1)*(2*z - 1) + x*z*pow(x - 1, 2)*(z - 1)*(2*z - 1))*(pow(x, 2)*z*(z - 1)*(2*z - 1) + 4*x*z*(x - 1)*(z - 1)*(2*z - 1) + z*pow(x - 1, 2)*(z - 1)*(2*z - 1)) + 4*(2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - 3*pow(z, 2)*(6*pow(x, 2) - 6*x + 1) + z*(6*pow(x, 2) - 6*x + 1))*(2*pow(z, 3)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 3*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + z*(2*pow(x, 3) - 3*pow(x, 2) + x)) + (2*pow(x, 2)*z*pow(x - 1, 2)*(z - 1) + pow(x, 2)*z*pow(x - 1, 2)*(2*z - 1) + pow(x, 2)*pow(x - 1, 2)*(z - 1)*(2*z - 1) - pow(z, 4)*(6*pow(x, 2) - 6*x + 1) + 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - pow(z, 2)*(6*pow(x, 2) - 6*x + 1))*(2*pow(x, 2)*z*(x - 1)*(z - 1) + pow(x, 2)*z*(x - 1)*(2*z - 1) + pow(x, 2)*(x - 1)*(z - 1)*(2*z - 1) + 2*x*z*pow(x - 1, 2)*(z - 1) + x*z*pow(x - 1, 2)*(2*z - 1) + x*pow(x - 1, 2)*(z - 1)*(2*z - 1) - 3*pow(z, 4)*(2*x - 1) + 6*pow(z, 3)*(2*x - 1) - 3*pow(z, 2)*(2*x - 1)))*(2*pow(x, 2)*z*pow(x - 1, 2)*(z - 1) + pow(x, 2)*z*pow(x - 1, 2)*(2*z - 1) + pow(x, 2)*pow(x - 1, 2)*(z - 1)*(2*z - 1) - pow(z, 4)*(6*pow(x, 2) - 6*x + 1) + 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - pow(z, 2)*(6*pow(x, 2) - 6*x + 1))/pow(4*pow(pow(x, 2)*z*(x - 1)*(z - 1)*(2*z - 1) + x*z*pow(x - 1, 2)*(z - 1)*(2*z - 1), 2) + 4*pow(2*pow(z, 3)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 3*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + z*(2*pow(x, 3) - 3*pow(x, 2) + x), 2) + (1.0L/2.0L)*pow(2*pow(x, 2)*z*pow(x - 1, 2)*(z - 1) + pow(x, 2)*z*pow(x - 1, 2)*(2*z - 1) + pow(x, 2)*pow(x - 1, 2)*(z - 1)*(2*z - 1) - pow(z, 4)*(6*pow(x, 2) - 6*x + 1) + 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - pow(z, 2)*(6*pow(x, 2) - 6*x + 1), 2), 4.0L/3.0L) - 1.0L/2.0L - 2*pow(2, 1.0L/3.0L)*(2*pow(x, 3) - 3*pow(x, 2) + x + 6*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 6*z*(2*pow(x, 3) - 3*pow(x, 2) + x))/pow(4*pow(pow(x, 2)*z*(x - 1)*(z - 1)*(2*z - 1) + x*z*pow(x - 1, 2)*(z - 1)*(2*z - 1), 2) + 4*pow(2*pow(z, 3)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 3*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + z*(2*pow(x, 3) - 3*pow(x, 2) + x), 2) + (1.0L/2.0L)*pow(2*pow(x, 2)*z*pow(x - 1, 2)*(z - 1) + pow(x, 2)*z*pow(x - 1, 2)*(2*z - 1) + pow(x, 2)*pow(x - 1, 2)*(z - 1)*(2*z - 1) - pow(z, 4)*(6*pow(x, 2) - 6*x + 1) + 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - pow(z, 2)*(6*pow(x, 2) - 6*x + 1), 2), 1.0L/3.0L) + pow(2, 1.0L/3.0L)*(2*pow(x, 2)*z*(x - 1)*(z - 1) + pow(x, 2)*z*(x - 1)*(2*z - 1) + pow(x, 2)*(x - 1)*(z - 1)*(2*z - 1) + 2*x*z*pow(x - 1, 2)*(z - 1) + x*z*pow(x - 1, 2)*(2*z - 1) + x*pow(x - 1, 2)*(z - 1)*(2*z - 1) - 3*pow(z, 4)*(2*x - 1) + 6*pow(z, 3)*(2*x - 1) - 3*pow(z, 2)*(2*x - 1))/pow(4*pow(pow(x, 2)*z*(x - 1)*(z - 1)*(2*z - 1) + x*z*pow(x - 1, 2)*(z - 1)*(2*z - 1), 2) + 4*pow(2*pow(z, 3)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 3*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + z*(2*pow(x, 3) - 3*pow(x, 2) + x), 2) + (1.0L/2.0L)*pow(2*pow(x, 2)*z*pow(x - 1, 2)*(z - 1) + pow(x, 2)*z*pow(x - 1, 2)*(2*z - 1) + pow(x, 2)*pow(x - 1, 2)*(z - 1)*(2*z - 1) - pow(z, 4)*(6*pow(x, 2) - 6*x + 1) + 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - pow(z, 2)*(6*pow(x, 2) - 6*x + 1), 2), 1.0L/3.0L);
++		case 24:
++			return -pow(2, 1.0L/3.0L)*pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*z)*cos(PI*p*y)/pow(6*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*y), 2)*pow(sin(PI*p*z), 2) + (1.0L/2.0L)*pow(-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z), 2), 1.0L/3.0L) + (1.0L/3.0L)*pow(2, 1.0L/3.0L)*PI*p*(12*pow(PI, 3)*pow(p, 3)*pow(sin(PI*p*x), 2)*sin(PI*p*y)*pow(sin(PI*p*z), 2)*cos(PI*p*y) + (-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x))*(2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*sin(PI*p*y)*sin(PI*p*z) - pow(PI, 2)*pow(p, 2)*sin(PI*p*y)*sin(PI*p*z)*cos(PI*p*x)) - (pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z))*(pow(PI, 3)*pow(p, 3)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*sin(PI*p*y) + pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*y)*cos(PI*p*z)) + (pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z))*(pow(PI, 3)*pow(p, 3)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*cos(PI*p*x)*cos(PI*p*y) - 2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*cos(PI*p*y)*cos(PI*p*z)))*sin(PI*p*x)*sin(PI*p*y)*sin(PI*p*z)/pow(6*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*y), 2)*pow(sin(PI*p*z), 2) + (1.0L/2.0L)*pow(-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z), 2), 4.0L/3.0L) + PI*q*sin(PI*q*x)*sin(PI*q*z)*cos(PI*q*y) - 1.0L/6.0L*pow(2, 1.0L/3.0L)*(-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x))*(12*pow(PI, 3)*pow(p, 3)*sin(PI*p*x)*pow(sin(PI*p*y), 2)*pow(sin(PI*p*z), 2)*cos(PI*p*x) - (-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x))*(pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*sin(PI*p*x)*sin(PI*p*z) - 2*pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*z)*cos(PI*p*y)) + (pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z))*(pow(PI, 3)*pow(p, 3)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*cos(PI*p*x)*cos(PI*p*y) + pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*cos(PI*p*x)*cos(PI*p*z)) - (pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z))*(pow(PI, 3)*pow(p, 3)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*sin(PI*p*y) - 2*pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*y)*cos(PI*p*z)))/pow(6*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*y), 2)*pow(sin(PI*p*z), 2) + (1.0L/2.0L)*pow(-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z), 2), 4.0L/3.0L) - 1.0L/6.0L*pow(2, 1.0L/3.0L)*(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z))*(12*pow(PI, 3)*pow(p, 3)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*y), 2)*sin(PI*p*z)*cos(PI*p*z) + (-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x))*(-2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*cos(PI*p*y)*cos(PI*p*z) + pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*cos(PI*p*x)*cos(PI*p*z)) - (pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z))*(pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*sin(PI*p*x)*sin(PI*p*z) + pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*z)*cos(PI*p*y)) + (pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z))*(2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*sin(PI*p*y)*sin(PI*p*z) - pow(PI, 2)*pow(p, 2)*sin(PI*p*y)*sin(PI*p*z)*cos(PI*p*x)))/pow(6*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*y), 2)*pow(sin(PI*p*z), 2) + (1.0L/2.0L)*pow(-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z), 2), 4.0L/3.0L) - 1.0L/2.0L*pow(2, 1.0L/3.0L)*(pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*sin(PI*p*x)*sin(PI*p*z) - 2*pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*z)*cos(PI*p*y))/pow(6*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*y), 2)*pow(sin(PI*p*z), 2) + (1.0L/2.0L)*pow(-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z), 2), 1.0L/3.0L) - 1.0L/2.0L*pow(2, 1.0L/3.0L)*(pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*sin(PI*p*x)*sin(PI*p*z) + pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*z)*cos(PI*p*y))/pow(6*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*y), 2)*pow(sin(PI*p*z), 2) + (1.0L/2.0L)*pow(-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z), 2), 1.0L/3.0L); 
+ 
+ 		case 101: 
+ 			return 12*pow(x, 2)*y*z*(x - 1)*(y - 1)*(z - 1) + 6*pow(x, 2)*y*z*(x - 1)*(2*y - 1)*(z - 1) + 6*pow(x, 2)*z*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 8*x*pow(y, 2)*z*(x - 1)*(2*x - 1)*(z - 1) - 4*x*pow(y, 2)*z*pow(y - 1, 2)*(z - 1) - 2*x*pow(y, 2)*(x - 1)*(2*x - 1)*pow(y - 1, 2) + 12*x*y*z*pow(x - 1, 2)*(y - 1)*(z - 1) + 6*x*y*z*pow(x - 1, 2)*(2*y - 1)*(z - 1) - 32*x*y*z*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 6*x*z*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 8*x*z*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1) - 4*pow(y, 2)*z*(x - 1)*pow(y - 1, 2)*(z - 1) - 2*pow(y, 2)*z*(2*x - 1)*pow(y - 1, 2)*(z - 1);
+@@ -95,7 +105,7 @@
+ 	IssmDouble a = 1.0;
+ 
+ 	switch(testid){
+-		case 1: case 2: case 7: case 8:
++		case 1: case 2: case 7: case 8: case 11: case 18: case 21:
+ 			return 0.;
+ 		case 3: 
+ 			return 2*pow(x, 2)*y*z*(x - 1)*(y - 1)*(2*y - 1) + 2*pow(x, 2)*y*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 2*x*pow(y, 2)*z*(x - 1)*(2*x - 1)*(y - 1) - 2*x*pow(y, 2)*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 2*x*y*z*pow(x - 1, 2)*(y - 1)*(2*y - 1) - 2*x*y*z*(x - 1)*(2*x - 1)*pow(y - 1, 2) + 2*x*y*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 2*x*y*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1);
+@@ -109,8 +119,28 @@
+ 			return -2*pow(PI, 3)*pow(p, 3)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*sin(PI*p*y) - pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*y)*cos(PI*p*z) + pow(x, 2) + pow(y, 2);
+ 		case 10:
+ 			return a*pow(z, a - 1)*(sin(PI*q*x)*sin(PI*q*y) + 1) - 2*pow(PI, 3)*pow(p, 3)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*sin(PI*p*y) - pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*y)*cos(PI*p*z);
++		case 24:
++			return -pow(2, 1.0L/3.0L)*pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*y)*cos(PI*p*z)/pow(6*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*y), 2)*pow(sin(PI*p*z), 2) + (1.0L/2.0L)*pow(-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z), 2), 1.0L/3.0L) + (1.0L/3.0L)*pow(2, 1.0L/3.0L)*PI*p*(12*pow(PI, 3)*pow(p, 3)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*y), 2)*sin(PI*p*z)*cos(PI*p*z) + (-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x))*(-2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*cos(PI*p*y)*cos(PI*p*z) + pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*cos(PI*p*x)*cos(PI*p*z)) - (pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z))*(pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*sin(PI*p*x)*sin(PI*p*z) + pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*z)*cos(PI*p*y)) + (pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z))*(2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*sin(PI*p*y)*sin(PI*p*z) - pow(PI, 2)*pow(p, 2)*sin(PI*p*y)*sin(PI*p*z)*cos(PI*p*x)))*sin(PI*p*x)*sin(PI*p*y)*sin(PI*p*z)/pow(6*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*y), 2)*pow(sin(PI*p*z), 2) + (1.0L/2.0L)*pow(-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z), 2), 4.0L/3.0L) + PI*q*sin(PI*q*x)*sin(PI*q*y)*cos(PI*q*z) - 1.0L/6.0L*pow(2, 1.0L/3.0L)*(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z))*(12*pow(PI, 3)*pow(p, 3)*pow(sin(PI*p*x), 2)*sin(PI*p*y)*pow(sin(PI*p*z), 2)*cos(PI*p*y) + (-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x))*(2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*sin(PI*p*y)*sin(PI*p*z) - pow(PI, 2)*pow(p, 2)*sin(PI*p*y)*sin(PI*p*z)*cos(PI*p*x)) - (pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z))*(pow(PI, 3)*pow(p, 3)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*sin(PI*p*y) + pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*y)*cos(PI*p*z)) + (pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z))*(pow(PI, 3)*pow(p, 3)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*cos(PI*p*x)*cos(PI*p*y) - 2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*cos(PI*p*y)*cos(PI*p*z)))/pow(6*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*y), 2)*pow(sin(PI*p*z), 2) + (1.0L/2.0L)*pow(-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z), 2), 4.0L/3.0L) - 1.0L/6.0L*pow(2, 1.0L/3.0L)*(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z))*(12*pow(PI, 3)*pow(p, 3)*sin(PI*p*x)*pow(sin(PI*p*y), 2)*pow(sin(PI*p*z), 2)*cos(PI*p*x) - (-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x))*(pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*sin(PI*p*x)*sin(PI*p*z) - 2*pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*z)*cos(PI*p*y)) + (pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z))*(pow(PI, 3)*pow(p, 3)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*cos(PI*p*x)*cos(PI*p*y) + pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*cos(PI*p*x)*cos(PI*p*z)) - (pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z))*(pow(PI, 3)*pow(p, 3)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*sin(PI*p*y) - 2*pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*y)*cos(PI*p*z)))/pow(6*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*y), 2)*pow(sin(PI*p*z), 2) + (1.0L/2.0L)*pow(-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z), 2), 4.0L/3.0L) - 1.0L/2.0L*pow(2, 1.0L/3.0L)*(pow(PI, 3)*pow(p, 3)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*sin(PI*p*y) - 2*pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*y)*cos(PI*p*z))/pow(6*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*y), 2)*pow(sin(PI*p*z), 2) + (1.0L/2.0L)*pow(-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z), 2), 1.0L/3.0L) - 1.0L/2.0L*pow(2, 1.0L/3.0L)*(pow(PI, 3)*pow(p, 3)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*sin(PI*p*y) + pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*y)*cos(PI*p*z))/pow(6*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*y), 2)*pow(sin(PI*p*z), 2) + (1.0L/2.0L)*pow(-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z), 2), 1.0L/3.0L);
+ 		default:
+ 			_error_("FS analytical solution"<<testid<<" not implemented yet");
+ 	}
+ }
+ /*}}}*/
++IssmDouble alpha(IssmDouble x,IssmDouble y,IssmDouble z,int testid){ /*{{{*/ 
++	IssmDouble p = 2.0;  
++	IssmDouble q = 2.0;   
++
++	switch(testid){
++		case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 21:
++			return 0.;
++		case 11:
++			z=y;
++			return -10*PI*p*sqrt((9.0L/25.0L)*pow(PI, 2)*pow(p, 2)*pow(cos(2*PI*p*x), 2) + 1)*(9*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*pow(cos(2*PI*p*x), 2)*pow(cos(PI*p*z), 2) - 9*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*z), 2)*pow(cos(PI*p*x), 2)*pow(cos(2*PI*p*x), 2) + 90*PI*p*sin(PI*p*x)*sin(PI*p*z)*cos(PI*p*x)*cos(2*PI*p*x)*cos(PI*p*z) - 25*pow(sin(PI*p*x), 2)*pow(cos(PI*p*z), 2) + 25*pow(sin(PI*p*z), 2)*pow(cos(PI*p*x), 2))/((9*pow(PI, 2)*pow(p, 2)*pow(cos(2*PI*p*x), 2) + 25)*(3*PI*p*sin(PI*p*z)*cos(PI*p*x)*cos(2*PI*p*x) - 5*sin(PI*p*x)*cos(PI*p*z))*sin(PI*p*x)*sin(PI*p*z));
++		case 18:
++			return (120.0L/109.0L)*sqrt(109)/(10*x - 3*z);
++		default:
++			_error_("FS analytical solution"<<testid<<" not implemented yet");
++	}
++}
++/*}}}*/
++
Index: issm/oecreview/Archive/16554-17801/ISSM-17652-17653.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17652-17653.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17652-17653.diff	(revision 17802)
@@ -0,0 +1,225 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17652)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17653)
+@@ -80,7 +80,8 @@
+ 		void GetBFSFriction(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputsFS(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolutionFS(IssmDouble* solution,Element* element);
+-		void InputUpdateFromSolutionFSXTH(Elements* elements,Parameters* parameters);
++		void InputUpdateFromSolutionFSXTH_d(Elements* elements,Parameters* parameters);
++		void InputUpdateFromSolutionFSXTH_tau(Elements* elements,Parameters* parameters);
+ 		void InitializeXTH(Elements* elements,Parameters* parameters);
+ 		/*Coupling*/
+ 		ElementMatrix* CreateKMatrixSSA3d(Element* element);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17652)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17653)
+@@ -4319,7 +4319,7 @@
+ 	xDelete<int>(pdoflist);
+ 	xDelete<int>(cs_list);
+ }/*}}}*/
+-void StressbalanceAnalysis::InputUpdateFromSolutionFSXTH(Elements* elements,Parameters* parameters){/*{{{*/
++void StressbalanceAnalysis::InputUpdateFromSolutionFSXTH_d(Elements* elements,Parameters* parameters){/*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	int         dim,tausize,meshtype;
+@@ -4329,7 +4329,6 @@
+ 	IssmDouble  dvx[3],dvy[3],dvz[3],B,n;
+ 	IssmDouble *xyz_list = NULL;
+ 	IssmDouble  Jdet,r;
+-	Gauss*      gauss = NULL;
+ 
+ 	parameters->FindParam(&r,AugmentedLagrangianREnum);
+ 	parameters->FindParam(&meshtype,MeshTypeEnum);
+@@ -4390,7 +4389,7 @@
+ 			sigmapyz_input=element->GetInput(DeviatoricStressyzEnum); _assert_(sigmapyz_input);
+ 		}
+ 
+-		gauss=element->NewGauss(5);
++		Gauss* gauss=element->NewGauss(5);
+ 		for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 			gauss->GaussPoint(ig);
+ 			element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+@@ -4521,6 +4520,74 @@
+ 			element->AddInput(StrainRateyzEnum,d_yz,P1DGEnum);
+ 		}
+ 
++		/*Clean up*/
++		delete gauss;
++		xDelete<IssmDouble>(xyz_list);
++		xDelete<IssmDouble>(tbasis);
++		xDelete<IssmDouble>(Ke);
++		xDelete<IssmDouble>(pe_xx); xDelete<IssmDouble>(d_xx);
++		xDelete<IssmDouble>(pe_yy); xDelete<IssmDouble>(d_yy);
++		xDelete<IssmDouble>(pe_zz); xDelete<IssmDouble>(d_zz);
++		xDelete<IssmDouble>(pe_xy); xDelete<IssmDouble>(d_xy);
++		xDelete<IssmDouble>(pe_xz); xDelete<IssmDouble>(d_xz);
++		xDelete<IssmDouble>(pe_yz); xDelete<IssmDouble>(d_yz);
++	}
++}/*}}}*/
++void StressbalanceAnalysis::InputUpdateFromSolutionFSXTH_tau(Elements* elements,Parameters* parameters){/*{{{*/
++
++	/*Intermediaries*/
++	int         dim,tausize,meshtype;
++	IssmDouble  epsxx,epsyy,epszz,epsxy,epsxz,epsyz,D_scalar;
++	IssmDouble  d_xx,d_yy,d_zz,d_xy,d_xz,d_yz;
++	IssmDouble  sigmapxx,sigmapyy,sigmapzz,sigmapxy,sigmapxz,sigmapyz;
++	IssmDouble  dvx[3],dvy[3],dvz[3];
++	IssmDouble *xyz_list = NULL;
++	IssmDouble  Jdet,r;
++
++	parameters->FindParam(&r,AugmentedLagrangianREnum);
++	parameters->FindParam(&meshtype,MeshTypeEnum);
++	switch(meshtype){
++		case Mesh2DverticalEnum: dim = 2; tausize = 3; break;
++		case Mesh3DEnum:         dim = 3; tausize = 6; break;
++		case Mesh3DtetrasEnum:   dim = 3; tausize = 6; break;
++		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
++	}
++
++	for(int i=0;i<elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
++
++		/*Get inputs and parameters*/
++		element->GetVerticesCoordinates(&xyz_list);
++		Input* vx_input=element->GetInput(VxEnum);                 _assert_(vx_input);
++		Input* vy_input=element->GetInput(VyEnum);                 _assert_(vy_input);
++		Input* vz_input;
++		if(dim==3){vz_input=element->GetInput(VzEnum); _assert_(vz_input);}
++
++		/*Get previous tau*/
++		Input* sigmapxx_input=element->GetInput(DeviatoricStressxxEnum); _assert_(sigmapxx_input);
++		Input* sigmapyy_input=element->GetInput(DeviatoricStressyyEnum); _assert_(sigmapyy_input);
++		Input* sigmapxy_input=element->GetInput(DeviatoricStressxyEnum); _assert_(sigmapxy_input);
++		Input* sigmapzz_input=NULL; Input* sigmapxz_input=NULL; Input* sigmapyz_input=NULL;
++		if(dim==3){
++			sigmapzz_input=element->GetInput(DeviatoricStresszzEnum); _assert_(sigmapzz_input);
++			sigmapxz_input=element->GetInput(DeviatoricStressxzEnum); _assert_(sigmapxz_input);
++			sigmapyz_input=element->GetInput(DeviatoricStressyzEnum); _assert_(sigmapyz_input);
++		}
++
++		/*Get NEW d*/
++		Input* epsxx_input=element->GetInput(StrainRatexxEnum); _assert_(epsxx_input);
++		Input* epsyy_input=element->GetInput(StrainRateyyEnum); _assert_(epsyy_input);
++		Input* epsxy_input=element->GetInput(StrainRatexyEnum); _assert_(epsxy_input);
++		Input* epszz_input=NULL; Input* epsxz_input=NULL; Input* epsyz_input=NULL;
++		if(dim==3){
++			epszz_input=element->GetInput(StrainRatezzEnum); _assert_(epszz_input);
++			epsxz_input=element->GetInput(StrainRatexzEnum); _assert_(epsxz_input);
++			epsyz_input=element->GetInput(StrainRateyzEnum); _assert_(epsyz_input);
++		}
++
++		/*Fetch number of nodes and dof for this finite element*/
++		int tnumnodes = element->GetNumberOfVertices();      //Tensors, P1 DG
++
+ 		/*Update tau accordingly*/
+ 		IssmDouble* tau_xx = xNew<IssmDouble>(tnumnodes);
+ 		IssmDouble* tau_yy = xNew<IssmDouble>(tnumnodes);
+@@ -4528,8 +4595,7 @@
+ 		IssmDouble* tau_zz = NULL;
+ 		IssmDouble* tau_xz = NULL;
+ 		IssmDouble* tau_yz = NULL;
+-		delete gauss;
+-		gauss = element->NewGauss();
++		Gauss* gauss = element->NewGauss();
+ 		for(int ig=0;ig<tnumnodes;ig++){
+ 			gauss->GaussNode(P1DGEnum,ig);
+ 
+@@ -4558,14 +4624,24 @@
+ 				sigmapyz_input->GetInputValue(&sigmapyz,gauss);
+ 			}
+ 
++			/*Get new d*/
++			epsxx_input->GetInputValue(&d_xx,gauss);
++			epsyy_input->GetInputValue(&d_yy,gauss);
++			epsxy_input->GetInputValue(&d_xy,gauss);
++			if(dim==3){
++				epszz_input->GetInputValue(&d_zz,gauss);
++				epsxz_input->GetInputValue(&d_xz,gauss);
++				epsyz_input->GetInputValue(&d_yz,gauss);
++			}
++
+ 			/*Get d and update tau accordingly*/
+-			tau_xx[ig] = sigmapxx + r*(epsxx - d_xx[ig]);
+-			tau_yy[ig] = sigmapyy + r*(epsyy - d_yy[ig]);
+-			tau_xy[ig] = sigmapxy + r*(epsxy - d_xy[ig]);
++			tau_xx[ig] = sigmapxx + r*(epsxx - d_xx);
++			tau_yy[ig] = sigmapyy + r*(epsyy - d_yy);
++			tau_xy[ig] = sigmapxy + r*(epsxy - d_xy);
+ 			if(dim==3){
+-				tau_zz[ig] = sigmapzz + r*(epszz - d_zz[ig]);
+-				tau_xz[ig] = sigmapxz + r*(epsxz - d_xz[ig]);
+-				tau_yz[ig] = sigmapyz + r*(epsyz - d_yz[ig]);
++				tau_zz[ig] = sigmapzz + r*(epszz - d_zz);
++				tau_xz[ig] = sigmapxz + r*(epsxz - d_xz);
++				tau_yz[ig] = sigmapyz + r*(epsyz - d_yz);
+ 			}
+ 		}
+ 
+@@ -4582,14 +4658,12 @@
+ 		/*Clean up and */
+ 		delete gauss;
+ 		xDelete<IssmDouble>(xyz_list);
+-		xDelete<IssmDouble>(tbasis);
+-		xDelete<IssmDouble>(Ke);
+-		xDelete<IssmDouble>(pe_xx); xDelete<IssmDouble>(d_xx);   xDelete<IssmDouble>(tau_xx);
+-		xDelete<IssmDouble>(pe_yy); xDelete<IssmDouble>(d_yy);   xDelete<IssmDouble>(tau_yy);
+-		xDelete<IssmDouble>(pe_zz); xDelete<IssmDouble>(d_zz);   xDelete<IssmDouble>(tau_zz);
+-		xDelete<IssmDouble>(pe_xy); xDelete<IssmDouble>(d_xy);   xDelete<IssmDouble>(tau_xy);
+-		xDelete<IssmDouble>(pe_xz); xDelete<IssmDouble>(d_xz);   xDelete<IssmDouble>(tau_xz);
+-		xDelete<IssmDouble>(pe_yz); xDelete<IssmDouble>(d_yz);   xDelete<IssmDouble>(tau_yz);
++		xDelete<IssmDouble>(tau_xx);
++		xDelete<IssmDouble>(tau_yy);
++		xDelete<IssmDouble>(tau_zz);
++		xDelete<IssmDouble>(tau_xy);
++		xDelete<IssmDouble>(tau_xz);
++		xDelete<IssmDouble>(tau_yz);
+ 	}
+ }/*}}}*/
+ 
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp	(revision 17652)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp	(revision 17653)
+@@ -21,6 +21,9 @@
+ 	IssmDouble           eps_rel;
+ 	int  configuration_type,max_nonlinear_iterations;
+ 
++	IssmDouble r     = .6;
++	IssmDouble theta = 0.; // 0<theta<.5   -> .15<theta<.45
++
+ 	/*Create analysis*/
+ 	StressbalanceAnalysis* analysis = new StressbalanceAnalysis();
+ 
+@@ -29,6 +32,7 @@
+ 	femmodel->parameters->FindParam(&eps_rel,StressbalanceReltolEnum);
+ 	femmodel->parameters->FindParam(&max_nonlinear_iterations,StressbalanceMaxiterEnum);
+ 	femmodel->parameters->SetParam(.6,AugmentedLagrangianREnum);
++	femmodel->parameters->SetParam(theta,AugmentedLagrangianThetaEnum);
+ 
+ 	/*Update constraints and initialize d and tau if necessary*/
+ 	femmodel->UpdateConstraintsx();
+@@ -44,6 +48,11 @@
+ 		/*save pointer to old velocity*/
+ 		delete ug_old;ug_old=ug;
+ 
++		/*Calculate d*/
++		if(theta){
++			analysis->InputUpdateFromSolutionFSXTH_d(femmodel->elements,femmodel->parameters);
++		}
++
+ 		/*Solve KU=F*/
+ 		SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
+ 		CreateNodalConstraintsx(&ys,femmodel->nodes,configuration_type);
+@@ -56,7 +65,8 @@
+ 		InputUpdateFromSolutionx(femmodel,ug); 
+ 
+ 		/*Update d and tau accordingly*/
+-		analysis->InputUpdateFromSolutionFSXTH(femmodel->elements,femmodel->parameters);
++		analysis->InputUpdateFromSolutionFSXTH_d(  femmodel->elements,femmodel->parameters);
++		analysis->InputUpdateFromSolutionFSXTH_tau(femmodel->elements,femmodel->parameters);
+ 
+ 		/*Check for convergence*/
+ 		Vector<IssmDouble>* dug=ug_old->Duplicate(); ug_old->Copy(dug); dug->AYPX(ug,-1.0);
Index: issm/oecreview/Archive/16554-17801/ISSM-17653-17654.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17653-17654.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17653-17654.diff	(revision 17802)
@@ -0,0 +1,186 @@
+Index: ../trunk-jpl/src/m/plot/plot_manager.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_manager.py	(revision 17653)
++++ ../trunk-jpl/src/m/plot/plot_manager.py	(revision 17654)
+@@ -1,4 +1,3 @@
+-
+ try:
+ 	import pylab as p
+ except ImportError:
+@@ -10,6 +9,7 @@
+ from processdata import processdata
+ from plot_unit import plot_unit
+ from applyoptions import applyoptions
++from plot_overlay import plot_overlay
+ 
+ def plot_manager(md,options,subplotwidth,nlines,ncols,i):
+ 	'''
+@@ -23,11 +23,24 @@
+ 
+ 	#parse options and get a structure of options
+ 	options=checkplotoptions(md,options)
+-	#print 'options:', options
+ 
+ 	#get data to be plotted
+ 	data=options.getfieldvalue('data');
+ 
++	#initialize plot handle variable
++	handle=None
++
++	##basemap plot
++	#if options.exist('basemap'):
++	#	plot_basemap(md,data,options,nlines,ncols,i)
++
++	#overlay plot
++	if options.exist('overlay'):
++		handle=plot_overlay(md,data,options,nlines,ncols,i)
++		options.addfielddefault('alpha',0.5)
++		options.addfielddefault('xlim',[min(md.mesh.x),max(md.mesh.x)])
++		options.addfielddefault('ylim',[min(md.mesh.y),max(md.mesh.y)])
++
+ 	#figure out if this is a special plot
+ 	if isinstance(data,(str,unicode)):
+ 
+@@ -35,6 +48,9 @@
+ 		if data.lower()=='mesh': 
+ 			plot_mesh(md,options,nlines,ncols,i)
+ 			return
++		elif data.lower()=='none':
++			print 'no data provided to plot (TODO: write plot_none.py)'
++			return
+ 		else:
+ 			print "WARNING: '%s' is not implemented or is not a valid string for option 'data'" % data
+ 
+@@ -42,8 +58,6 @@
+ 	#else:
+ 		#print "'data' not a string, plotting model properties yet to be implemented..."
+ 
+-	#Overlay plot
+-
+ 	#Gridded plot
+ 
+ 	#Section plot
+@@ -55,7 +69,8 @@
+ 	data2,datatype=processdata(md,data,options)
+ 
+ 	#standard plot
+-	p.subplot(nlines,ncols,i,aspect='equal')
++	if not handle:
++		p.subplot(nlines,ncols,i,aspect='equal')
+ 
+ 	#plot unit
+ 	plot_unit(x,y,z,elements,data2,is2d,isplanet,datatype,options)
+Index: ../trunk-jpl/src/m/plot/plot_overlay.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_overlay.py	(revision 0)
++++ ../trunk-jpl/src/m/plot/plot_overlay.py	(revision 17654)
+@@ -0,0 +1,85 @@
++import numpy as npy
++from processmesh import processmesh
++from processdata import processdata
++from osgeo import gdal
++import matplotlib.pyplot as plt
++import matplotlib as mpl
++import os
++
++def plot_overlay(md,data,options,rows,cols,i):
++	'''
++	Function for plotting a georeferenced image.  This function is called
++	from within the plotmodel code.
++	'''
++
++	x,y,z,elements,is2d,isplanet=processmesh(md,[],options)
++
++	if data=='none' or data==None:
++		imageonly=1
++		data=npy.float('nan')*npy.ones((md.mesh.numberofvertices,))
++		datatype=1
++	else:
++		imageonly=0
++		data,datatype=processdata(md,data,options)
++
++	if not is2d:
++		raise StandardError('overlay plot not supported for 3D meshes, project on a 2D layer first')
++	if datatype==3:
++		raise StandardError('overlay not yet supported for quiver plots')	
++
++	if not options.exist('geotiff_name'):
++		raise StandardError('overlay error: provide geotiff_name with path to geotiff file')
++	geotiff=options.getfieldvalue('geotiff_name')
++
++	xlim=options.getfieldvalue('xlim',[min(md.mesh.x),max(md.mesh.x)])
++	ylim=options.getfieldvalue('ylim',[min(md.mesh.y),max(md.mesh.y)])
++
++	gtif=gdal.Open(geotiff)
++	trans=gtif.GetGeoTransform()
++	xmin=trans[0]
++	xmax=trans[0]+gtif.RasterXSize*trans[1]
++	ymin=trans[3]+gtif.RasterYSize*trans[5]
++	ymax=trans[3]
++	
++	# allow supplied geotiff to have limits smaller than basemap or model limits
++	x0=max(min(xlim),xmin)
++	x1=min(max(xlim),xmax)
++	y0=max(min(ylim),ymin)
++	y1=min(max(ylim),ymax)
++	inputname='temp.tif'
++	os.system('gdal_translate -quiet -projwin ' + str(x0) + ' ' + str(y1) + ' ' + str(x1) + ' ' + str(y0) + ' ' + geotiff + ' ' + inputname)
++	
++	gtif=gdal.Open(inputname)
++	arr=gtif.ReadAsArray()
++	#os.system('rm -rf ./temp.tif')
++	
++	# get parameters from cropped geotiff
++	trans=gtif.GetGeoTransform()
++	xmin=trans[0]
++	xmax=trans[0]+gtif.RasterXSize*trans[1]
++	ymin=trans[3]+gtif.RasterYSize*trans[5]
++	ymax=trans[3]
++	dx=trans[1]
++	dy=trans[5]	
++	
++	xarr=npy.arange(xmin,xmax,dx)
++	yarr=npy.arange(ymin,ymax,-dy) # -dy since origin='upper' (not sure how robust this is)
++	xg,yg=npy.meshgrid(xarr,yarr)
++	if options.exist('basemap'):
++		# get handle to basemap instance
++		# handle= functiontogethandle()
++		# create coordinate grid in map projection units (for plotting)
++		lats,lons=xy2ll(xg,yg,-1,0,71)
++		xgmap,ygmap=m(lons,lats) # map projection units returned by basemap instance
++	else:
++		xgmap=xg
++		ygmap=yg
++		handle=plt.gca()
++	
++	# for single band geotiffs
++	overlaylims=options.getfieldvalue('overlaylims',[min(arr.ravel()),max(arr.ravel())])
++
++	norm=mpl.colors.Normalize(vmin=overlaylims[0],vmax=overlaylims[1])
++	handle.pcolormesh(xgmap, ygmap, npy.flipud(arr), cmap=mpl.cm.Greys, norm=norm)
++	plt.axes().set_aspect('equal','box')
++	return handle
+Index: ../trunk-jpl/src/m/plot/plot_unit.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_unit.py	(revision 17653)
++++ ../trunk-jpl/src/m/plot/plot_unit.py	(revision 17654)
+@@ -20,7 +20,9 @@
+    
+    #number of colorlevels for plots
+    colorlevels=options.getfieldvalue('colorlevels',256)
+-   
++
++   alpha=options.getfieldvalue('alpha',1)
++
+    #colormap
+    cmap=options.getfieldvalue('colormap',mpl.cm.gnuplot2)
+    if options.exist('cmap_set_over'):
+@@ -49,7 +51,7 @@
+    elif datatype==2:
+    	#node plot
+    	if is2d:
+-   		p.tricontourf(x,y,elements,data,colorlevels,cmap=cmap,norm=norm)
++   		p.tricontourf(x,y,elements,data,colorlevels,cmap=cmap,norm=norm,alpha=alpha)
+    		if edgecolor != 'None':
+    			p.triplot(x,y,elements,color=edgecolor)
+    	else:
Index: issm/oecreview/Archive/16554-17801/ISSM-17654-17655.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17654-17655.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17654-17655.diff	(revision 17802)
@@ -0,0 +1,50 @@
+Index: ../trunk-jpl/src/m/interp/interp.py
+===================================================================
+--- ../trunk-jpl/src/m/interp/interp.py	(revision 17654)
++++ ../trunk-jpl/src/m/interp/interp.py	(revision 17655)
+@@ -1,6 +1,11 @@
+ # module for inperpolating/smoothing data
+ import numpy as npy
+ from scipy.interpolate import CloughTocher2DInterpolator, Rbf
++try:
++	import matplotlib.pyplot as plt
++except ImportError:
++	print 'could not import matplotlib, no plotting functions enabled.\
++			Set plotonly=False in function call'
+ 
+ def MeshSplineToMesh2d(x,y,data,xi,yi,tol=1e-6,**kwargs):#{{{
+ 	'''
+@@ -65,7 +70,7 @@
+ 
+ 	return interpdata
+ #}}}
+-def GridSplineToMesh2d(x,y,data,xi,yi,default_value=npy.nan):#{{{
++def GridSplineToMesh2d(x,y,data,xi,yi,default_value=npy.nan,plotonly=False):#{{{
+ 	'''
+ 	python analog to InterpFromGridToMesh.  This routine uses
+ 	scipy.interpolate.CloughTocher2dInterpolator to create a bivariate spline
+@@ -83,9 +88,11 @@
+ 	xi,yi:			x and y coordinates to be interpolated onto
+ 	default_value:	default value if points lie outside the convex hull of input
+ 						points (defaults to nan if not specified)
++	plotonly:		plot the data to be interpolated using imshow (useful for
++						identifying holes in data and problems with interpolation)
+ 
+ 	Usage:
+-		interpdata=GridToMesh(x,y,data,xi,yi,default_value=npy.nan)
++		interpdata=GridToMesh(x,y,data,xi,yi,default_value=npy.nan,plotonly=False)
+ 
+ 	Examples:
+ 		interpdata=GridToMesh(x_m,y_m,data,md.mesh.x,md.mesh.y,0)
+@@ -114,6 +121,11 @@
+ 	points=npy.array([xg.ravel(),yg.ravel()]).T
+ 	flatsubdata=subdata.ravel()
+ 
++	if plotonly:
++		plt.imshow(npy.flipud(subdata),origin='upper')
++		plt.show()
++		return
++
+ 	# mask out any nan's in the data and corresponding coordinate points
+ 	mask=npy.isnan(flatsubdata)
+ 	ind=npy.nonzero(mask)[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17655-17656.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17655-17656.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17655-17656.diff	(revision 17802)
@@ -0,0 +1,32 @@
+Index: ../trunk-jpl/src/m/plot/plot_overlay.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_overlay.py	(revision 17655)
++++ ../trunk-jpl/src/m/plot/plot_overlay.py	(revision 17656)
+@@ -51,8 +51,17 @@
+ 	
+ 	gtif=gdal.Open(inputname)
+ 	arr=gtif.ReadAsArray()
+-	#os.system('rm -rf ./temp.tif')
++	os.system('rm -rf ./temp.tif')
+ 	
++	if gtif.RasterCount>=3:  # RGB array
++		r=gtif.GetRasterBand(1).ReadAsArray()
++		g=gtif.GetRasterBand(2).ReadAsArray()
++		b=gtif.GetRasterBand(3).ReadAsArray()
++		arr=0.299*r+0.587*g+0.114*b
++
++	# normalize array
++	arr=arr/npy.max(arr.ravel())
++
+ 	# get parameters from cropped geotiff
+ 	trans=gtif.GetGeoTransform()
+ 	xmin=trans[0]
+@@ -66,7 +75,7 @@
+ 	yarr=npy.arange(ymin,ymax,-dy) # -dy since origin='upper' (not sure how robust this is)
+ 	xg,yg=npy.meshgrid(xarr,yarr)
+ 	if options.exist('basemap'):
+-		# get handle to basemap instance
++		# TODO get handle to basemap instance 
+ 		# handle= functiontogethandle()
+ 		# create coordinate grid in map projection units (for plotting)
+ 		lats,lons=xy2ll(xg,yg,-1,0,71)
Index: issm/oecreview/Archive/16554-17801/ISSM-17656-17657.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17656-17657.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17656-17657.diff	(revision 17802)
@@ -0,0 +1,21 @@
+Index: ../trunk-jpl/src/m/plot/plot_overlay.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_overlay.py	(revision 17656)
++++ ../trunk-jpl/src/m/plot/plot_overlay.py	(revision 17657)
+@@ -60,7 +60,7 @@
+ 		arr=0.299*r+0.587*g+0.114*b
+ 
+ 	# normalize array
+-	arr=arr/npy.max(arr.ravel())
++	arr=arr/npy.float(npy.max(arr.ravel()))
+ 
+ 	# get parameters from cropped geotiff
+ 	trans=gtif.GetGeoTransform()
+@@ -85,7 +85,6 @@
+ 		ygmap=yg
+ 		handle=plt.gca()
+ 	
+-	# for single band geotiffs
+ 	overlaylims=options.getfieldvalue('overlaylims',[min(arr.ravel()),max(arr.ravel())])
+ 
+ 	norm=mpl.colors.Normalize(vmin=overlaylims[0],vmax=overlaylims[1])
Index: issm/oecreview/Archive/16554-17801/ISSM-17659-17660.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17659-17660.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17659-17660.diff	(revision 17802)
@@ -0,0 +1,275 @@
+Index: ../trunk-jpl/src/c/classes/IoModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 17659)
++++ ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 17660)
+@@ -444,7 +444,7 @@
+ 
+ 				/*Ok, we have reached the end of the file. break: */
+ 				record_code=0; //0 means bailout
+-				ISSM_MPI_Bcast<int>(&record_code,1,0,IssmComm::GetComm());  /*tell others cpus we are bailing: */
++				ISSM_MPI_Bcast(&record_code,1,ISSM_MPI_INT,0,IssmComm::GetComm());  /*tell others cpus we are bailing: */
+ 				break;
+ 			}
+ 			else{
+@@ -652,7 +652,7 @@
+ 	if(my_rank==0){  
+ 		if(fread(&booleanint,sizeof(int),1,fid)!=1) _error_("could not read boolean ");
+ 	}
+-	ISSM_MPI_Bcast<int>(&booleanint,1,0,IssmComm::GetComm()); 
++	ISSM_MPI_Bcast(&booleanint,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+ 
+ 	/*cast to bool: */
+ 	/*Assign output pointers: */
+@@ -682,7 +682,7 @@
+ 		if(fread(&integer,sizeof(int),1,fid)!=1) _error_("could not read integer ");
+ 	}
+ 
+-	ISSM_MPI_Bcast<int>(&integer,1,0,IssmComm::GetComm()); 
++	ISSM_MPI_Bcast(&integer,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+ 
+ 	/*Assign output pointers: */
+ 	*pinteger=integer;
+@@ -709,7 +709,7 @@
+ 	if(my_rank==0){
+ 		if(fread(&scalar,sizeof(IssmPDouble),1,fid)!=1)_error_("could not read scalar ");
+ 	}
+-	ISSM_MPI_Bcast<IssmPDouble>(&scalar,1,0,IssmComm::GetComm()); 
++	ISSM_MPI_Bcast(&scalar,1,ISSM_MPI_PDOUBLE,0,IssmComm::GetComm()); 
+ 
+ 	/*Assign output pointers: */
+ 	*pscalar=scalar;
+@@ -741,7 +741,7 @@
+ 		if(fread(&string_size,sizeof(int),1,fid)!=1) _error_("could not read length of string ");
+ 	}
+ 
+-	ISSM_MPI_Bcast<int>(&string_size,1,0,IssmComm::GetComm()); 
++	ISSM_MPI_Bcast(&string_size,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+ 
+ 	/*Now allocate string: */
+ 	if(string_size){
+@@ -752,7 +752,7 @@
+ 		if(my_rank==0){  
+ 			if(fread(string,string_size*sizeof(char),1,fid)!=1)_error_(" could not read string ");
+ 		}
+-		ISSM_MPI_Bcast<char>(string,string_size,0,IssmComm::GetComm()); 
++		ISSM_MPI_Bcast(string,string_size,ISSM_MPI_CHAR,0,IssmComm::GetComm()); 
+ 	}
+ 	else{
+ 		string=xNew<char>(1);
+@@ -791,12 +791,12 @@
+ 		if(fread(&M,sizeof(int),1,fid)!=1) _error_("could not read number of rows for matrix ");
+ 	}
+ 
+-	ISSM_MPI_Bcast<int>(&M,1,0,IssmComm::GetComm()); 
++	ISSM_MPI_Bcast(&M,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+ 
+ 	if(my_rank==0){  
+ 		if(fread(&N,sizeof(int),1,fid)!=1) _error_("could not read number of columns for matrix ");
+ 	}
+-	ISSM_MPI_Bcast<int>(&N,1,0,IssmComm::GetComm());
++	ISSM_MPI_Bcast(&N,1,ISSM_MPI_INT,0,IssmComm::GetComm());
+ 
+ 	/*Now allocate matrix: */
+ 	if(M*N){
+@@ -807,7 +807,7 @@
+ 			if(fread(matrix,M*N*sizeof(IssmPDouble),1,fid)!=1) _error_("could not read matrix ");
+ 		}
+ 
+-		ISSM_MPI_Bcast<IssmPDouble>(matrix,M*N,0,IssmComm::GetComm()); 
++		ISSM_MPI_Bcast(matrix,M*N,ISSM_MPI_PDOUBLE,0,IssmComm::GetComm()); 
+ 	}
+ 
+ 	/*Now cast to integer: */
+@@ -856,12 +856,12 @@
+ 	if(my_rank==0){  
+ 		if(fread(&M,sizeof(int),1,fid)!=1) _error_("could not read number of rows for matrix ");
+ 	}
+-	ISSM_MPI_Bcast<int>(&M,1,0,IssmComm::GetComm()); 
++	ISSM_MPI_Bcast(&M,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+ 
+ 	if(my_rank==0){  
+ 		if(fread(&N,sizeof(int),1,fid)!=1) _error_("could not read number of columns for matrix ");
+ 	}
+-	ISSM_MPI_Bcast<int>(&N,1,0,IssmComm::GetComm()); 
++	ISSM_MPI_Bcast(&N,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+ 
+ 	/*Now allocate matrix: */
+ 	if(M*N){
+@@ -871,7 +871,7 @@
+ 		if(my_rank==0){  
+ 			if(fread(matrix,M*N*sizeof(IssmPDouble),1,fid)!=1) _error_("could not read matrix ");
+ 		}
+-		ISSM_MPI_Bcast<IssmPDouble>(matrix,M*N,0,IssmComm::GetComm()); 
++		ISSM_MPI_Bcast(matrix,M*N,ISSM_MPI_PDOUBLE,0,IssmComm::GetComm()); 
+ 
+ 		_assert_(this->independents);
+ 		if(this->independents[data_enum]){
+@@ -920,7 +920,7 @@
+ 	if(my_rank==0){  
+ 		if(fread(&numstrings,sizeof(int),1,fid)!=1) _error_("could not read length of string array");
+ 	}
+-	ISSM_MPI_Bcast<int>(&numstrings,1,0,IssmComm::GetComm()); 
++	ISSM_MPI_Bcast(&numstrings,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+ 
+ 	/*Now allocate string array: */
+ 	if(numstrings){
+@@ -933,7 +933,7 @@
+ 			if(my_rank==0){  
+ 				if(fread(&string_size,sizeof(int),1,fid)!=1) _error_("could not read length of string ");
+ 			}
+-			ISSM_MPI_Bcast<int>(&string_size,1,0,IssmComm::GetComm()); 
++			ISSM_MPI_Bcast(&string_size,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+ 			if(string_size){
+ 				string=xNew<char>((string_size+1));
+ 				string[string_size]='\0';
+@@ -942,7 +942,7 @@
+ 				if(my_rank==0){  
+ 					if(fread(string,string_size*sizeof(char),1,fid)!=1)_error_(" could not read string ");
+ 				}
+-				ISSM_MPI_Bcast<char>(string,string_size,0,IssmComm::GetComm()); 
++				ISSM_MPI_Bcast(string,string_size,ISSM_MPI_CHAR,0,IssmComm::GetComm()); 
+ 			}
+ 			else{
+ 				string=xNew<char>(1);
+@@ -987,7 +987,7 @@
+ 	if(my_rank==0){  
+ 		if(fread(&numrecords,sizeof(int),1,fid)!=1) _error_("could not read number of records in matrix array ");
+ 	}
+-	ISSM_MPI_Bcast<int>(&numrecords,1,0,IssmComm::GetComm()); 
++	ISSM_MPI_Bcast(&numrecords,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+ 
+ 	if(numrecords){
+ 
+@@ -1008,12 +1008,12 @@
+ 			if(my_rank==0){  
+ 				if(fread(&M,sizeof(int),1,fid)!=1) _error_("could not read number of rows in " << i << "th matrix of matrix array");
+ 			}
+-			ISSM_MPI_Bcast<int>(&M,1,0,IssmComm::GetComm()); 
++			ISSM_MPI_Bcast(&M,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+ 
+ 			if(my_rank==0){  
+ 				if(fread(&N,sizeof(int),1,fid)!=1) _error_("could not read number of columns in " << i << "th matrix of matrix array");
+ 			}
+-			ISSM_MPI_Bcast<int>(&N,1,0,IssmComm::GetComm()); 
++			ISSM_MPI_Bcast(&N,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+ 
+ 			/*Now allocate matrix: */
+ 			if(M*N){
+@@ -1024,7 +1024,7 @@
+ 					if(fread(matrix,M*N*sizeof(IssmPDouble),1,fid)!=1) _error_("could not read matrix ");
+ 				}
+ 
+-				ISSM_MPI_Bcast<IssmPDouble>(matrix,M*N,0,IssmComm::GetComm()); 
++				ISSM_MPI_Bcast(matrix,M*N,ISSM_MPI_PDOUBLE,0,IssmComm::GetComm()); 
+ 				matrices[i]=xNew<IssmDouble>(M*N);
+ 				for (int j=0;j<M*N;++j) {matrices[i][j]=matrix[j];}
+ 				xDelete<IssmPDouble>(matrix);
+@@ -1168,7 +1168,7 @@
+ 				if(fread(&string_size,sizeof(int),1,fid)!=1) _error_("could not read length of string ");
+ 			}
+ 
+-			ISSM_MPI_Bcast<int>(&string_size,1,0,IssmComm::GetComm()); 
++			ISSM_MPI_Bcast(&string_size,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+ 
+ 			/*Now allocate string: */
+ 			if(string_size){
+@@ -1179,7 +1179,7 @@
+ 				if(my_rank==0){
+ 					if(fread(string,string_size*sizeof(char),1,fid)!=1)_error_(" could not read string ");
+ 				}
+-				ISSM_MPI_Bcast<char>(string,string_size,0,IssmComm::GetComm()); 
++				ISSM_MPI_Bcast(string,string_size,ISSM_MPI_CHAR,0,IssmComm::GetComm()); 
+ 			}
+ 			else{
+ 				string=xNew<char>(1);
+@@ -1235,7 +1235,7 @@
+ 					if(fread(&integer,sizeof(int),1,fid)!=1) _error_("could not read integer ");
+ 				}
+ 			}
+-			ISSM_MPI_Bcast<int>(&integer,1,0,IssmComm::GetComm()); 
++			ISSM_MPI_Bcast(&integer,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+ 
+ 			/*Assign: */
+ 			vector[i]=integer;
+@@ -1294,12 +1294,12 @@
+ 				fsetpos(fid,file_positions+i);
+ 				if(fread(&M,sizeof(int),1,fid)!=1) _error_("could not read number of rows for matrix ");
+ 			}
+-			ISSM_MPI_Bcast<int>(&M,1,0,IssmComm::GetComm()); 
++			ISSM_MPI_Bcast(&M,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+ 
+ 			if(my_rank==0){  
+ 				if(fread(&N,sizeof(int),1,fid)!=1) _error_("could not read number of columns for matrix ");
+ 			}
+-			ISSM_MPI_Bcast<int>(&N,1,0,IssmComm::GetComm()); 
++			ISSM_MPI_Bcast(&N,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+ 
+ 
+ 			/*Now allocate matrix: */
+@@ -1310,7 +1310,7 @@
+ 				if(my_rank==0){  
+ 					if(fread(pmatrix,M*N*sizeof(IssmPDouble),1,fid)!=1) _error_("could not read matrix ");
+ 				}
+-				ISSM_MPI_Bcast<IssmPDouble>(pmatrix,M*N,0,IssmComm::GetComm()); 
++				ISSM_MPI_Bcast(pmatrix,M*N,ISSM_MPI_PDOUBLE,0,IssmComm::GetComm()); 
+ 
+ 				_assert_(this->independents);
+ 				if(this->independents[data_enum]){
+@@ -1400,12 +1400,12 @@
+ 				fsetpos(fid,file_positions+i);
+ 				if(fread(&M,sizeof(int),1,fid)!=1) _error_("could not read number of rows for matrix ");
+ 			}
+-			ISSM_MPI_Bcast<int>(&M,1,0,IssmComm::GetComm()); 
++			ISSM_MPI_Bcast(&M,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+ 
+ 			if(my_rank==0){  
+ 				if(fread(&N,sizeof(int),1,fid)!=1) _error_("could not read number of columns for matrix ");
+ 			}
+-			ISSM_MPI_Bcast<int>(&N,1,0,IssmComm::GetComm()); 
++			ISSM_MPI_Bcast(&N,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+ 
+ 
+ 			/*Now allocate matrix: */
+@@ -1417,7 +1417,7 @@
+ 				if(my_rank==0){  
+ 					if(fread(pmatrix,M*N*sizeof(IssmPDouble),1,fid)!=1) _error_("could not read matrix ");
+ 				}
+-				ISSM_MPI_Bcast<IssmPDouble>(pmatrix,M*N,0,IssmComm::GetComm()); 
++				ISSM_MPI_Bcast(pmatrix,M*N,ISSM_MPI_PDOUBLE,0,IssmComm::GetComm()); 
+ 
+ 				_assert_(this->independents);
+ 				if(this->independents[data_enum]){
+@@ -1593,7 +1593,7 @@
+ 		}
+ 	}
+ 	/*Broadcast code and vector type: */
+-	ISSM_MPI_Bcast<int>(&lastindex,1,0,IssmComm::GetComm()); 
++	ISSM_MPI_Bcast(&lastindex,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+ 
+ 	/*Assign output pointers:*/
+ 	*pindex=lastindex;
+@@ -1649,12 +1649,12 @@
+ 			}
+ 		}
+ 	}
+-	ISSM_MPI_Bcast<int>(&found,1,0,IssmComm::GetComm()); 
++	ISSM_MPI_Bcast(&found,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+ 	if(!found)_error_("could not find data with name " << EnumToStringx(data_enum) << " in binary file");
+ 
+ 	/*Broadcast code and vector type: */
+-	ISSM_MPI_Bcast<int>(&record_code,1,0,IssmComm::GetComm()); 
+-	ISSM_MPI_Bcast<int>(&vector_type,1,0,IssmComm::GetComm()); 
++	ISSM_MPI_Bcast(&record_code,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
++	ISSM_MPI_Bcast(&vector_type,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+ 
+ 	/*Assign output pointers:*/
+ 	*pcode=record_code;
+@@ -1753,7 +1753,7 @@
+ 	}
+ 
+ 	/*Broadcast data: */
+-	ISSM_MPI_Bcast<int>(&num_instances,1,0,IssmComm::GetComm()); 
++	ISSM_MPI_Bcast(&num_instances,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+ 
+ 	/*Assign output pointers:*/
+ 	*pcodes         = codes;
Index: issm/oecreview/Archive/16554-17801/ISSM-17660-17661.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17660-17661.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17660-17661.diff	(revision 17802)
@@ -0,0 +1,11 @@
+Index: ../trunk-jpl/src/m/solvers/mumpsoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/solvers/mumpsoptions.m	(revision 17660)
++++ ../trunk-jpl/src/m/solvers/mumpsoptions.m	(revision 17661)
+@@ -26,4 +26,6 @@
+ 	mumps.pc_factor_mat_solver_package=getfieldvalue(options,'pc_factor_mat_solver_package','mumps');
+ 	mumps.mat_mumps_icntl_14=getfieldvalue(options,'mat_mumps_icntl_14',120);
+ 	mumps.pc_factor_shift_positive_definite=getfieldvalue(options,'pc_factor_shift_positive_definite','true');
++	mumps.mat_mumps_icntl_28=2; %1=serial, 2=parallel
++	mumps.mat_mumps_icntl_29=2; %parallel ordering 1 = ptscotch, 2 = parmetis
+ end
Index: issm/oecreview/Archive/16554-17801/ISSM-17661-17662.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17661-17662.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17661-17662.diff	(revision 17802)
@@ -0,0 +1,17 @@
+Index: ../trunk-jpl/src/c/toolkits/petsc/patches/NewVec.cpp
+===================================================================
+--- ../trunk-jpl/src/c/toolkits/petsc/patches/NewVec.cpp	(revision 17661)
++++ ../trunk-jpl/src/c/toolkits/petsc/patches/NewVec.cpp	(revision 17662)
+@@ -32,12 +32,8 @@
+ 	}
+ 
+ 	VecCreate(comm,&vector); 
+-
+ 	VecSetSizes(vector,local_size,PETSC_DECIDE); 
+ 	VecSetFromOptions(vector); 
+ 
+-	/*fill with 0: */
+-	VecSet(vector,0.0);
+-
+ 	return vector;
+ }
Index: issm/oecreview/Archive/16554-17801/ISSM-17662-17663.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17662-17663.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17662-17663.diff	(revision 17802)
@@ -0,0 +1,171 @@
+Index: ../trunk-jpl/test/NightlyRun/test427.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test427.py	(revision 17662)
++++ ../trunk-jpl/test/NightlyRun/test427.py	(revision 17663)
+@@ -32,7 +32,7 @@
+ 	'Bed2','Surface2','Thickness2','Floatingice2',\
+ 	'Bed3','Surface3','Thickness3','Floatingice3']
+ field_tolerances=[1e-13,1e-13,1e-13,1e-13,\
+-	1e-13,1e-13,1e-13,1e-13,\
++	5e-12,3e-12,7e-12,2e-11,\
+ 	1e-10,1e-11,1e-10,1e-13]
+ field_values=[\
+ 	md.results.TransientSolution[0].Base,\
+Index: ../trunk-jpl/test/NightlyRun/test435.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test435.m	(revision 17662)
++++ ../trunk-jpl/test/NightlyRun/test435.m	(revision 17663)
+@@ -46,8 +46,8 @@
+ field_names     ={'Bed1','Surface1','Thickness1','Floatingice1','Vx1','Vy1','Vz1','Pressure1',...
+ 	'Bed2','Surface2','Thickness2','Floatingice2','Vx2','Vy2','Vz2','Pressure2',...
+ 	'Bed3','Surface3','Thickness3','Floatingice3','Vx3','Vy3','Vz3','Pressure3'};
+-field_tolerances={1e-11,3e-12,1e-11,1e-11,3e-10,1e-08,3e-10,1e-13,...
+-	2e-11,3e-12,9e-10,2e-11,1e-09,1e-08,3e-10,1e-10,...
++field_tolerances={2e-11,3e-12,2e-11,1e-11,4e-10,1e-08,6e-10,1e-13,...
++	2e-11,4e-12,9e-10,2e-11,1e-09,1e-08,3e-10,1e-10,...
+ 	1e-10,3e-11,1e-10,7e-11,1e-09,1e-08,1e-09,2e-11};
+ field_values={...
+ 	(md.results.TransientSolution(1).Base),...
+Index: ../trunk-jpl/test/NightlyRun/test427.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test427.m	(revision 17662)
++++ ../trunk-jpl/test/NightlyRun/test427.m	(revision 17663)
+@@ -22,7 +22,7 @@
+ 	'Bed2','Surface2','Thickness2','Floatingice2',...
+ 	'Bed3','Surface3','Thickness3','Floatingice3'};
+ field_tolerances={1e-13,1e-13,1e-13,1e-13,...
+-	4e-12,2e-12,6e-12,2e-11,...
++	5e-12,3e-12,7e-12,2e-11,...
+ 	1e-10,3e-11,1e-10,7e-11};
+ field_values={...
+ 	(md.results.TransientSolution(1).Base),...
+Index: ../trunk-jpl/test/NightlyRun/test419.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test419.py	(revision 17662)
++++ ../trunk-jpl/test/NightlyRun/test419.py	(revision 17663)
+@@ -18,7 +18,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Vx','Vy','Vz','Vel','Pressure']
+-field_tolerances=[1e-09,1e-09,1e-09,1e-09,1e-09]
++field_tolerances=[2e-09,1e-09,1e-09,1e-09,1e-09]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Vx,\
+ 	md.results.StressbalanceSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test419.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test419.m	(revision 17662)
++++ ../trunk-jpl/test/NightlyRun/test419.m	(revision 17663)
+@@ -8,7 +8,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure'};
+-field_tolerances={1e-09,1e-09,1e-09,1e-09,1e-09};
++field_tolerances={2e-09,1e-09,1e-09,1e-09,1e-09};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test804.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test804.py	(revision 17662)
++++ ../trunk-jpl/test/NightlyRun/test804.py	(revision 17663)
+@@ -32,7 +32,7 @@
+ 		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3']
+ field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
+ 		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
+-		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
++		2e-13,2e-13,2e-13,1e-13,1e-13,1e-13,1e-13]
+ field_values=[\
+ 	md.results.TransientSolution[0].Vx,\
+ 	md.results.TransientSolution[0].Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test204.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test204.py	(revision 17662)
++++ ../trunk-jpl/test/NightlyRun/test204.py	(revision 17663)
+@@ -25,7 +25,7 @@
+ # Fields and tolerances to track changes
+ 
+ field_names     =['Vx','Vy','Vz','Vel','Pressure']
+-field_tolerances=[1e-08,1e-08,2e-07,1e-08,1e-08]
++field_tolerances=[1e-08,1e-08,2e-06,1e-08,1e-08]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Vx,\
+ 	md.results.StressbalanceSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test804.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test804.m	(revision 17662)
++++ ../trunk-jpl/test/NightlyRun/test804.m	(revision 17663)
+@@ -22,7 +22,7 @@
+ 		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3'};
+ field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+ 		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+-		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
++		2e-13,2e-13,2e-13,1e-13,1e-13,1e-13,1e-13};
+ field_values={...
+ 	md.results.TransientSolution(1).Vx,...
+ 	md.results.TransientSolution(1).Vy,...
+Index: ../trunk-jpl/test/NightlyRun/test455.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test455.py	(revision 17662)
++++ ../trunk-jpl/test/NightlyRun/test455.py	(revision 17663)
+@@ -22,7 +22,7 @@
+ 	md.flowequation.fe_HO=i
+ 	md=solve(md,StressbalanceSolutionEnum())
+ 	field_names     =field_names+['Vx'+i,'Vy'+i,'Vz'+i,'Vel'+i,'Pressure'+i]
+-	field_tolerances=field_tolerances+[3e-08,2.5e-08,1e-08,3e-08,3e-13]
++	field_tolerances=field_tolerances+[4e-08,4e-08,1e-08,4e-08,3e-13]
+ 	field_values=field_values+[\
+ 			md.results.StressbalanceSolution.Vx,\
+ 			md.results.StressbalanceSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test455.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test455.m	(revision 17662)
++++ ../trunk-jpl/test/NightlyRun/test455.m	(revision 17663)
+@@ -12,7 +12,7 @@
+ 	md.flowequation.fe_HO=i{1};
+ 	md=solve(md,StressbalanceSolutionEnum());
+ 	field_names     ={field_names{:},['Vx' i{1}],['Vy' i{1}],['Vz' i{1}],['Vel' i{1}],['Pressure' i{1}]};
+-	field_tolerances={field_tolerances{:},3e-08,2.5e-08,1e-08,3e-08,3e-13};
++	field_tolerances={field_tolerances{:},4e-08,4e-08,1e-08,4e-08,3e-13};
+ 	field_values={field_values{:},...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test335.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test335.m	(revision 17662)
++++ ../trunk-jpl/test/NightlyRun/test335.m	(revision 17663)
+@@ -48,7 +48,7 @@
+ 								 'SedimentWaterHead9','EplWaterHead9','SedimentHeadResidual9'};
+ field_tolerances={1e-13, 1e-13, 1e-13,...
+ 								 1e-13, 1e-13, 1e-13,...
+-								 1e-13, 6e-13, 9e-12,...
++								 1e-13, 1e-12, 9e-12,...
+ 								 1e-13, 9e-13, 1e-11};
+ field_values={md.results.HydrologySolution(1).SedimentHead, ...
+ 							md.results.HydrologySolution(1).EplHead,...
+Index: ../trunk-jpl/test/NightlyRun/test204.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test204.m	(revision 17662)
++++ ../trunk-jpl/test/NightlyRun/test204.m	(revision 17663)
+@@ -12,7 +12,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure','Vx_damp','Vy_damp','Vz_damp','Vel_damp','Pressure_damp'};
+-field_tolerances={1e-08,1e-08,2e-07,1e-08,1e-08,1e-08,1e-08,2e-07,1e-08,1e-08};
++field_tolerances={1e-08,1e-08,2e-06,1e-08,1e-08,1e-08,1e-08,2e-07,1e-08,1e-08};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test702.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test702.m	(revision 17662)
++++ ../trunk-jpl/test/NightlyRun/test702.m	(revision 17663)
+@@ -45,7 +45,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vel','Pressure'};
+-field_tolerances={2e-09,2e-09,2e-09,1e-08};
++field_tolerances={3e-09,3e-09,3e-09,1e-08};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
Index: issm/oecreview/Archive/16554-17801/ISSM-17663-17664.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17663-17664.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17663-17664.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp	(revision 17663)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp	(revision 17664)
+@@ -46,7 +46,7 @@
+ 		delete ug_old;ug_old=ug;
+ 
+ 		/*Calculate d*/
+-		if(theta){
++		if(theta>0.){
+ 			analysis->InputUpdateFromSolutionFSXTH_d(femmodel->elements,femmodel->parameters);
+ 		}
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17664-17665.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17664-17665.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17664-17665.diff	(revision 17802)
@@ -0,0 +1,14 @@
+Index: ../trunk-jpl/src/c/toolkits/mpi/issmmpi.h
+===================================================================
+--- ../trunk-jpl/src/c/toolkits/mpi/issmmpi.h	(revision 17664)
++++ ../trunk-jpl/src/c/toolkits/mpi/issmmpi.h	(revision 17665)
+@@ -86,9 +86,6 @@
+ 
+ template <class T> ISSM_MPI_Datatype TypeToMPIType(){assert(false);};
+ template <> inline ISSM_MPI_Datatype TypeToMPIType<IssmDouble>(){return ISSM_MPI_DOUBLE;};
+-#if _HAVE_ADOLC_
+-template <> inline ISSM_MPI_Datatype TypeToMPIType<IssmPDouble>(){return ISSM_MPI_PDOUBLE;};
+-#endif
+ template <> inline ISSM_MPI_Datatype TypeToMPIType<int>(){return ISSM_MPI_INT;};
+ template <> inline ISSM_MPI_Datatype TypeToMPIType<char>(){return ISSM_MPI_CHAR;};
+ template <class T> ISSM_MPI_Datatype ISSM_MPI_Reduce(T *sendbuf,T *recvbuf,int count,ISSM_MPI_Op op, int root, ISSM_MPI_Comm comm){ /*{{{*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17665-17666.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17665-17666.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17665-17666.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/test/NightlyRun/test435.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test435.m	(revision 17665)
++++ ../trunk-jpl/test/NightlyRun/test435.m	(revision 17666)
+@@ -47,7 +47,7 @@
+ 	'Bed2','Surface2','Thickness2','Floatingice2','Vx2','Vy2','Vz2','Pressure2',...
+ 	'Bed3','Surface3','Thickness3','Floatingice3','Vx3','Vy3','Vz3','Pressure3'};
+ field_tolerances={2e-11,3e-12,2e-11,1e-11,4e-10,1e-08,6e-10,1e-13,...
+-	2e-11,4e-12,9e-10,2e-11,1e-09,1e-08,3e-10,1e-10,...
++	2e-11,4.5e-12,9e-10,2e-11,1e-09,1e-08,3e-10,1e-10,...
+ 	1e-10,3e-11,1e-10,7e-11,1e-09,1e-08,1e-09,2e-11};
+ field_values={...
+ 	(md.results.TransientSolution(1).Base),...
+Index: ../trunk-jpl/test/NightlyRun/test274.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test274.m	(revision 17665)
++++ ../trunk-jpl/test/NightlyRun/test274.m	(revision 17666)
+@@ -10,7 +10,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vel','Pressure'};
+-field_tolerances={4.5e-8,1.35e-8,1.55e-8,1e-11};
++field_tolerances={5.0e-8,2.0e-8,2.0e-8,1e-11};
+ field_values={...
+ 	   (md.results.StressbalanceSolution.Vx),...
+ 	   (md.results.StressbalanceSolution.Vy),...
Index: issm/oecreview/Archive/16554-17801/ISSM-17666-17667.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17666-17667.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17666-17667.diff	(revision 17802)
@@ -0,0 +1,33 @@
+Index: ../trunk-jpl/externalpackages/tao/install-2.2.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/tao/install-2.2.sh	(revision 17666)
++++ ../trunk-jpl/externalpackages/tao/install-2.2.sh	(revision 17667)
+@@ -1,22 +1,22 @@
+ #!/bin/bash
+ set -eu
+-#http://www.mcs.anl.gov/research/projects/tao/download/tao-2.2-pre1.tar.gz
++#http://www.mcs.anl.gov/research/projects/tao/download/tao-2.2.2.tar.gz
+ 
+ #compatible with PETSc 3.4
+ 
+ #Some cleanup
+-rm -rf install tao-2.2-pre1
++rm -rf install tao-2.2.2
+ mkdir install
+ 
+ #Download from ISSM server
+-$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/tao-2.2-pre1.tar.gz' 'tao-2.2-pre1.tar.gz'
++$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/tao-2.2.2.tar.gz' 'tao-2.2.2.tar.gz'
+ 
+ #Untar 
+-tar -zxvf  tao-2.2-pre1.tar.gz
++tar -zxvf  tao-2.2.2.tar.gz
+ 
+ #move into place
+-mv tao-2.2-pre1/* install/
+-rm -rf tao-2.2-pre1
++mv tao-2.2.2/* install/
++rm -rf tao-2.2.2
+ 
+ #compile
+ cd install
Index: issm/oecreview/Archive/16554-17801/ISSM-17667-17668.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17667-17668.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17667-17668.diff	(revision 17802)
@@ -0,0 +1,24 @@
+Index: ../trunk-jpl/src/c/modules/Krigingx/pKrigingx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/Krigingx/pKrigingx.cpp	(revision 17667)
++++ ../trunk-jpl/src/c/modules/Krigingx/pKrigingx.cpp	(revision 17668)
+@@ -107,6 +107,19 @@
+ 		ISSM_MPI_Allreduce(predictions,sumpredictions,n_interp,ISSM_MPI_PDOUBLE,ISSM_MPI_SUM,IssmComm::GetComm());
+ 		xDelete<double>(predictions); predictions=sumpredictions;
+ 	}
++	else if(strcmp(output,"distance")==0){
++
++		/*partition loop across threads: */
++		for(int idx=my_rank;idx<n_interp;idx+=num_procs){
++			_printf0_("      interpolation progress: "<<setw(6)<<setprecision(4)<<double(idx)/double(n_interp)*100.<<"%  \n");
++			observations->Distances(&predictions[idx],&x_interp[idx],&y_interp[idx],1,radius);
++		}
++		_printf0_("      interpolation progress: "<<fixed<<setw(6)<<setprecision(4)<<100.<<"%  \n");
++
++		double *sumpredictions =xNew<double>(n_interp);
++		ISSM_MPI_Allreduce(predictions,sumpredictions,n_interp,ISSM_MPI_PDOUBLE,ISSM_MPI_SUM,IssmComm::GetComm());
++		xDelete<double>(predictions); predictions=sumpredictions;
++	}
+ 	else if(strcmp(output,"idw")==0){
+ 		double power;
+ 		options->Get(&power,"power",2.);
Index: issm/oecreview/Archive/16554-17801/ISSM-17668-17669.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17668-17669.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17668-17669.diff	(revision 17802)
@@ -0,0 +1,48 @@
+Index: ../trunk-jpl/src/c/toolkits/mpi/issmmpi.h
+===================================================================
+--- ../trunk-jpl/src/c/toolkits/mpi/issmmpi.h	(revision 17668)
++++ ../trunk-jpl/src/c/toolkits/mpi/issmmpi.h	(revision 17669)
+@@ -88,43 +88,6 @@
+ template <> inline ISSM_MPI_Datatype TypeToMPIType<IssmDouble>(){return ISSM_MPI_DOUBLE;};
+ template <> inline ISSM_MPI_Datatype TypeToMPIType<int>(){return ISSM_MPI_INT;};
+ template <> inline ISSM_MPI_Datatype TypeToMPIType<char>(){return ISSM_MPI_CHAR;};
+-template <class T> ISSM_MPI_Datatype ISSM_MPI_Reduce(T *sendbuf,T *recvbuf,int count,ISSM_MPI_Op op, int root, ISSM_MPI_Comm comm){ /*{{{*/
+-
+-	/*Get MPI type*/
+-	ISSM_MPI_Datatype datatype = TypeToMPIType<T>();
+-
+-	int rc=0;
+-#ifdef _HAVE_MPI_
+-# ifdef _HAVE_AMPI_
+-	rc=AMPI_Reduce(sendbuf,
+-				recvbuf,
+-				count,
+-				datatype,
+-				op,
+-				root,
+-				comm);
+-# else
+-	rc=MPI_Reduce(sendbuf,
+-				recvbuf,
+-				count,
+-				datatype,
+-				op,
+-				root,
+-				comm);
+-# endif
+-#else
+-# ifdef _HAVE_ADOLC_
+-	if (datatype==ISSM_MPI_DOUBLE) { 
+-		IssmDouble* activeSendBuf=(IssmDouble*)sendbuf;
+-		IssmDouble* activeRecvBuf=(IssmDouble*)recvbuf;
+-		for(int i=0;i<count;++i) activeRecvBuf[i]=activeSendBuf[i];
+-	}
+-	else 
+-# endif
+-	 memcpy(recvbuf,sendbuf,sizeHelper(datatype)*count);
+-#endif
+-	return rc;
+-}/*}}}*/
+ template <class T> int ISSM_MPI_Bcast(T *buffer, int count,int root, ISSM_MPI_Comm comm){  /*{{{*/
+ 
+ 	int rc=0;
Index: issm/oecreview/Archive/16554-17801/ISSM-17669-17670.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17669-17670.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17669-17670.diff	(revision 17802)
@@ -0,0 +1,21 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17669)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17670)
+@@ -164,6 +164,7 @@
+ 	IssmDouble	sigma_xz[NUMVERTICES]={0,0,0};
+ 	IssmDouble	sigma_yz[NUMVERTICES]={0,0,0};
+ 	GaussTria*  gauss=NULL;
++	int dim=2;
+ 
+ 	/* Get node coordinates and dof list: */
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+@@ -180,7 +181,7 @@
+ 
+ 		/*Compute strain rate viscosity and pressure: */
+ 		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+-		this->ViscositySSA(&viscosity,2,&xyz_list[0][0],gauss,vx_input,vy_input);
++		this->ViscositySSA(&viscosity,dim,&xyz_list[0][0],gauss,vx_input,vy_input);
+ 		pressure_input->GetInputValue(&pressure,gauss);
+ 
+ 		/*Compute Stress*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17670-17671.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17670-17671.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17670-17671.diff	(revision 17802)
@@ -0,0 +1,219 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17670)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17671)
+@@ -85,6 +85,8 @@
+ 		void       GetNodesSidList(int* sidlist);
+ 		void       GetNodesLidList(int* lidlist);
+ 		void       GetPhi(IssmDouble* phi, IssmDouble*  epsilon, IssmDouble viscosity);
++		void       GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum);
++		void	     GetVertexPidList(int* pidlist);
+ 		void       GetVerticesCoordinates(IssmDouble** xyz_list);
+ 		void       GetVerticesSidList(int* sidlist);
+ 		void       GetVerticesConnectivityList(int* connectivitylist);
+@@ -219,7 +221,6 @@
+ 		virtual Gauss* NewGaussTop(int order)=0;
+ 
+ 		virtual void   InputScale(int enum_type,IssmDouble scale_factor)=0;
+-		virtual void   GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum)=0;
+ 		virtual IssmDouble TimeAdapt()=0;
+ 		virtual void   PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm)=0;
+ 		virtual void   Delta18oParameterization(void)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17670)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17671)
+@@ -833,32 +833,6 @@
+ 	return this->nodes[node_number];
+ 
+ }/*}}}*/
+-/*FUNCTION Tria::GetVertexPidList {{{*/
+-void  Tria::GetVertexPidList(int* doflist){
+-
+-	for(int i=0;i<3;i++) doflist[i]=vertices[i]->Pid();
+-
+-}
+-/*}}}*/
+-/*FUNCTION Tria::GetVectorFromInputs{{{*/
+-void  Tria::GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum){
+-
+-	int vertexpidlist[NUMVERTICES];
+-
+-	/*Get out if this is not an element input*/
+-	if(!IsInput(input_enum)) return;
+-
+-	/*Prepare index list*/
+-	this->GetVertexPidList(&vertexpidlist[0]);
+-
+-	/*Get input (either in element or material)*/
+-	Input* input=inputs->GetInput(input_enum);
+-	if(!input) _error_("Input " << EnumToStringx(input_enum) << " not found in element");
+-
+-	/*We found the enum.  Use its values to fill into the vector, using the vertices ids: */
+-	input->GetVectorFromInputs(vector,&vertexpidlist[0]);
+-}
+-/*}}}*/
+ /*FUNCTION Tria::GetXcoord {{{*/
+ IssmDouble Tria::GetXcoord(Gauss* gauss){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17670)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17671)
+@@ -81,7 +81,6 @@
+ 		int         NumberofNodesVelocity(void);
+ 		int         NumberofNodesPressure(void);
+ 		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
+-		void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum);
+ 		void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list);
+ 		void        GetVerticesCoordinatesTop(IssmDouble** pxyz_list);
+ 		void        InputDepthAverageAtBase(int enum_type,int average_enum_type);
+@@ -179,8 +178,6 @@
+ 		IssmDouble     GetArea(void);
+ 		void           GetAreaCoordinates(IssmDouble *area_coordinates,IssmDouble* xyz_zero,IssmDouble* xyz_list,int numpoints);
+ 		int            GetElementType(void);
+-
+-		void	         GetVertexPidList(int* doflist);
+ 		IssmDouble     GetXcoord(Gauss* gauss);
+ 		IssmDouble     GetYcoord(Gauss* gauss);
+ 		IssmDouble     GetZcoord(Gauss* gauss){_error_("not implemented");};
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17670)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17671)
+@@ -824,13 +824,6 @@
+ 	return phi;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetVertexPidList {{{*/
+-void  Penta::GetVertexPidList(int* doflist){
+-
+-	for(int i=0;i<6;i++) doflist[i]=vertices[i]->Pid();
+-
+-}
+-/*}}}*/
+ /*FUNCTION Penta::GetElementType {{{*/
+ int Penta::GetElementType(){
+ 
+@@ -967,25 +960,6 @@
+ 	return tau_parameter;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetVectorFromInputs{{{*/
+-void  Penta::GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum){
+-
+-	int vertexpidlist[NUMVERTICES];
+-
+-	/*Get out if this is not an element input*/
+-	if (!IsInput(input_enum)) return;
+-
+-	/*Prepare index list*/
+-	this->GetVertexPidList(&vertexpidlist[0]);
+-
+-	/*Get input (either in element or material)*/
+-	Input* input=inputs->GetInput(input_enum);
+-	if(!input) _error_("Input " << EnumToStringx(input_enum) << " not found in element");
+-
+-	/*We found the enum.  Use its values to fill into the vector, using the vertices ids: */
+-	input->GetVectorFromInputs(vector,&vertexpidlist[0]);
+-}
+-/*}}}*/
+ /*FUNCTION Penta::GetXcoord {{{*/
+ IssmDouble Penta::GetXcoord(Gauss* gauss){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17670)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17671)
+@@ -79,7 +79,6 @@
+ 		IssmDouble GetXcoord(Gauss* gauss);
+ 		IssmDouble GetYcoord(Gauss* gauss);
+ 		IssmDouble GetZcoord(Gauss* gauss);
+-		void   GetVectorFromInputs(Vector<IssmDouble>* vector,int name_enum);
+ 		void   GetVerticesCoordinatesBase(IssmDouble** pxyz_list);
+ 		void   GetVerticesCoordinatesTop(IssmDouble** pxyz_list);
+ 
+@@ -177,8 +176,6 @@
+ 		void	         NormalTop(IssmDouble* bed_normal, IssmDouble* xyz_list);
+ 		ElementMatrix* CreateBasalMassMatrix(void);
+ 		void           GetAreaCoordinates(IssmDouble *area_coordinates,IssmDouble* xyz_zero,IssmDouble* xyz_list,int numpoints);
+-
+-		void	         GetVertexPidList(int* doflist);
+ 		int            GetElementType(void);
+ 		void           GetInputValue(IssmDouble* pvalue,Node* node,int enumtype);
+ 		Node*          GetNode(int node_number);
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17670)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17671)
+@@ -843,8 +843,9 @@
+ 			tetra_node_ids[7]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofelements+iomodel->elements[4*index+2];
+ 			tetra_node_ids[8]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofelements+iomodel->elements[4*index+3];
+ 			break;
++		case TaylorHoodEnum:
+ 			numnodes        = 14;
+-			tetra_node_ids   = xNew<int>(numnodes);
++			tetra_node_ids  = xNew<int>(numnodes);
+ 			tetra_node_ids[0]=iomodel->nodecounter+iomodel->elements[4*index+0];
+ 			tetra_node_ids[1]=iomodel->nodecounter+iomodel->elements[4*index+1];
+ 			tetra_node_ids[2]=iomodel->nodecounter+iomodel->elements[4*index+2];
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17670)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17671)
+@@ -127,7 +127,6 @@
+ 		void        GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
+ 
+ 		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type){_error_("not implemented yet");};
+-		void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum){_error_("not implemented yet");};
+ 		void        InputDepthAverageAtBase(int enum_type,int average_enum_type){_error_("not implemented yet");};
+ 		void        InputDuplicate(int original_enum,int new_enum){_error_("not implemented yet");};
+ 		void        InputScale(int enum_type,IssmDouble scale_factor){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17670)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17671)
+@@ -132,7 +132,6 @@
+ 		void        GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
+ 
+ 		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type){_error_("not implemented yet");};
+-		void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum){_error_("not implemented yet");};
+ 		void        InputDepthAverageAtBase(int enum_type,int average_enum_type){_error_("not implemented yet");};
+ 		void        InputDuplicate(int original_enum,int new_enum){_error_("not implemented yet");};
+ 		void        InputScale(int enum_type,IssmDouble scale_factor){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17670)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17671)
+@@ -527,6 +527,31 @@
+ 	}
+ }
+ /*}}}*/
++void  Element::GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum){/*{{{*/
++
++	/*Fetch number vertices for this element and allocate arrays*/
++	int numvertices = this->GetNumberOfVertices();
++	int*        vertexpidlist = xNew<int>(numvertices);
++	IssmDouble* values        = xNew<IssmDouble>(numvertices);
++
++	/*Fill in values*/
++	this->GetVertexPidList(vertexpidlist);
++	this->GetInputListOnNodesVelocity(values,input_enum);
++	vector->SetValues(numvertices,vertexpidlist,values,INS_VAL);
++
++	/*Clean up*/
++	xDelete<int>(vertexpidlist);
++	xDelete<IssmDouble>(values);
++
++}
++/*}}}*/
++void  Element::GetVertexPidList(int* pidlist){/*{{{*/
++
++	int numvertices = this->GetNumberOfVertices();
++	for(int i=0;i<numvertices;i++) pidlist[i]=vertices[i]->Pid();
++
++}
++/*}}}*/
+ void Element::GetVerticesCoordinates(IssmDouble** pxyz_list){/*{{{*/
+ 
+ 	int         numvertices = this->GetNumberOfVertices();
Index: issm/oecreview/Archive/16554-17801/ISSM-17671-17672.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17671-17672.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17671-17672.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17671)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17672)
+@@ -536,7 +536,7 @@
+ 
+ 	/*Fill in values*/
+ 	this->GetVertexPidList(vertexpidlist);
+-	this->GetInputListOnNodesVelocity(values,input_enum);
++	this->GetInputListOnVertices(values,input_enum);
+ 	vector->SetValues(numvertices,vertexpidlist,values,INS_VAL);
+ 
+ 	/*Clean up*/
Index: issm/oecreview/Archive/16554-17801/ISSM-17674-17675.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17674-17675.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17674-17675.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17674)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17675)
+@@ -1159,7 +1159,6 @@
+ 			%elementstype
+ 			if ~isnan(md.flowequation.element_equation)
+ 				oldelements_type=md.flowequation.element_equation;
+-				md.flowequation.element_equation=zeros(number_el3d,1);
+ 				md.flowequation.element_equation=md.flowequation.element_equation(pos_elements);
+ 			end
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17675-17676.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17675-17676.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17675-17676.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/parameterization/setflowequation.m
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/setflowequation.m	(revision 17675)
++++ ../trunk-jpl/src/m/parameterization/setflowequation.m	(revision 17676)
+@@ -70,7 +70,7 @@
+ end
+ 
+ %Check that no L1L2 or HO or FS for 2d mesh
+-if meshdim(md.mesh)==2
++if strcmp(meshxdim(md.mesh),'2Dhorizontal')
+ 	if any(L1L2flag | FSflag | HOflag)
+ 		error('FS and HO elements not allowed in 2d mesh, extrude it first')
+ 	end
Index: issm/oecreview/Archive/16554-17801/ISSM-17676-17677.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17676-17677.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17676-17677.diff	(revision 17802)
@@ -0,0 +1,23 @@
+Index: ../trunk-jpl/src/m/contrib/gslib/gslib.m
+===================================================================
+--- ../trunk-jpl/src/m/contrib/gslib/gslib.m	(revision 17676)
++++ ../trunk-jpl/src/m/contrib/gslib/gslib.m	(revision 17677)
+@@ -1,17 +1,9 @@
+-function output = gslib(x,y,data,varargin)
++function [B E] = gslib(x,y,data,xmin,ymin,nx,ny,deltax,deltay)
+ %GSLIB - use gslib for Kriging
+ %
+ %   Usage:
+ %      output = gslib(x,y,data,varargin)
+ 
+-%Output Matrix
+-xmin   = xl(1);
+-ymin   = yl(1);
+-nx     = 101;
+-ny     = 101;
+-deltax = 5000;
+-deltay = 5000;
+-
+ %Variogram
+ nugget=10;
+ sill  =164;
Index: issm/oecreview/Archive/16554-17801/ISSM-17677-17678.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17677-17678.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17677-17678.diff	(revision 17802)
@@ -0,0 +1,48 @@
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp	(revision 17677)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp	(revision 17678)
+@@ -38,12 +38,16 @@
+ 	/*Convergence criterion*/
+ 	int  count = 0;
+ 	GetSolutionFromInputsx(&ug,femmodel);
++	Vector<IssmDouble>* vx     = NULL;
++	Vector<IssmDouble>* vx_old = NULL;
++	GetVectorFromInputsx(&vx,femmodel,VxEnum,VertexEnum);
+ 
+ 	while(true){
+ 		count++;
+ 
+ 		/*save pointer to old velocity*/
+ 		delete ug_old;ug_old=ug;
++		delete vx_old;vx_old=vx;
+ 
+ 		/*Calculate d*/
+ 		if(theta>0.){
+@@ -64,11 +68,15 @@
+ 		/*Update d and tau accordingly*/
+ 		analysis->InputUpdateFromSolutionFSXTH_d(  femmodel->elements,femmodel->parameters);
+ 		analysis->InputUpdateFromSolutionFSXTH_tau(femmodel->elements,femmodel->parameters);
++		GetVectorFromInputsx(&vx,femmodel,VxEnum,VertexEnum);
+ 
+ 		/*Check for convergence*/
+-		Vector<IssmDouble>* dug=ug_old->Duplicate(); ug_old->Copy(dug); dug->AYPX(ug,-1.0);
+-		IssmDouble ndu=dug->Norm(NORM_TWO);   delete dug;
+-		IssmDouble nu =ug_old->Norm(NORM_TWO);
++		//Vector<IssmDouble>* dug=ug_old->Duplicate(); ug_old->Copy(dug); dug->AYPX(ug,-1.0);
++		//IssmDouble ndu=dug->Norm(NORM_TWO);   delete dug;
++		//IssmDouble nu =ug_old->Norm(NORM_TWO);
++		Vector<IssmDouble>* dvx=vx_old->Duplicate(); vx_old->Copy(dvx); dvx->AYPX(vx,-1.0);
++		IssmDouble ndu=dvx->Norm(NORM_TWO);   delete dvx;
++		IssmDouble nu =vx_old->Norm(NORM_TWO);
+ 		if (xIsNan<IssmDouble>(ndu) || xIsNan<IssmDouble>(nu)) _error_("convergence criterion is NaN!");
+ 		if((ndu/nu)<eps_rel){
+ 			if(VerboseConvergence()) _printf0_(setw(50) << left << "   Convergence criterion: norm(du)/norm(u)" << ndu/nu*100 << " < " << eps_rel*100 << " %\n");
+@@ -88,5 +96,7 @@
+ 
+ 	delete ug;  
+ 	delete ug_old;  
++	delete vx;  
++	delete vx_old;  
+ 	delete analysis;
+ }
Index: issm/oecreview/Archive/16554-17801/ISSM-17678-17679.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17678-17679.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17678-17679.diff	(revision 17802)
@@ -0,0 +1,51 @@
+Index: ../trunk-jpl/src/c/classes/Inputs/TetraInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TetraInput.cpp	(revision 17678)
++++ ../trunk-jpl/src/c/classes/Inputs/TetraInput.cpp	(revision 17679)
+@@ -341,10 +341,8 @@
+ /*}}}*/
+ /*FUNCTION TetraInput::GetVectorFromInputs{{{*/
+ void TetraInput::GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist){
+-
+-	const int numnodes=this->NumberofNodes();
+-	vector->SetValues(numnodes,doflist,this->values,INS_VAL);
+-
++	const int numvertices=4;
++	vector->SetValues(numvertices,doflist,this->values,INS_VAL);
+ } /*}}}*/
+ /*FUNCTION TetraInput::PointwiseMin{{{*/
+ Input* TetraInput::PointwiseMin(Input* inputB){
+Index: ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 17678)
++++ ../trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 17679)
+@@ -350,10 +350,8 @@
+ /*}}}*/
+ /*FUNCTION TriaInput::GetVectorFromInputs{{{*/
+ void TriaInput::GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist){
+-
+-	const int numnodes=this->NumberofNodes();
+-	vector->SetValues(numnodes,doflist,this->values,INS_VAL);
+-
++	const int numvertices=3;
++	vector->SetValues(numvertices,doflist,this->values,INS_VAL);
+ } /*}}}*/
+ /*FUNCTION TriaInput::PointwiseMin{{{*/
+ Input* TriaInput::PointwiseMin(Input* inputB){
+Index: ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 17678)
++++ ../trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 17679)
+@@ -453,10 +453,8 @@
+ /*}}}*/
+ /*FUNCTION PentaInput::GetVectorFromInputs{{{*/
+ void PentaInput::GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist){
+-
+-	const int numnodes=this->NumberofNodes();
+-	vector->SetValues(numnodes,doflist,this->values,INS_VAL);
+-
++	const int numvertices=6;
++	vector->SetValues(numvertices,doflist,this->values,INS_VAL);
+ } /*}}}*/
+ /*FUNCTION PentaInput::Configure{{{*/
+ void PentaInput::Configure(Parameters* parameters){
Index: issm/oecreview/Archive/16554-17801/ISSM-17679-17680.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17679-17680.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17679-17680.diff	(revision 17802)
@@ -0,0 +1,252 @@
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17679)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17680)
+@@ -429,7 +429,7 @@
+ 	IssmDouble c1,c2,c3,healing,stress_threshold;
+ 	IssmDouble s_xx,s_xy,s_yy,s1,s2,stmp;
+ 	IssmDouble J2s,Chi,Psi,PosPsi,NegPsi;
+-	IssmDouble damage,sigma_xx,sigma_xy,sigma_yy;
++	IssmDouble damage,tau_xx,tau_xy,tau_yy;
+ 	int equivstress;
+ 
+ 	/*Fetch number of vertices and allocate output*/
+@@ -444,12 +444,12 @@
+ 	element->FindParam(&stress_threshold,DamageStressThresholdEnum);
+ 
+ 	/*Compute stress tensor: */
+-	element->ComputeStressTensor();
++	element->ComputeDeviatoricStressTensor();
+ 
+ 	/*retrieve what we need: */
+-	Input* sigma_xx_input  = element->GetInput(StressTensorxxEnum);     _assert_(sigma_xx_input);
+-	Input* sigma_xy_input  = element->GetInput(StressTensorxyEnum);     _assert_(sigma_xy_input);
+-	Input* sigma_yy_input  = element->GetInput(StressTensoryyEnum);     _assert_(sigma_yy_input);
++	Input* tau_xx_input  = element->GetInput(DeviatoricStressxxEnum);     _assert_(tau_xx_input);
++	Input* tau_xy_input  = element->GetInput(DeviatoricStressxyEnum);     _assert_(tau_xy_input);
++	Input* tau_yy_input  = element->GetInput(DeviatoricStressyyEnum);     _assert_(tau_yy_input);
+ 	Input* damage_input    = element->GetInput(DamageDEnum); _assert_(damage_input);
+ 
+ 	/*retrieve the desired type of equivalent stress*/
+@@ -461,14 +461,14 @@
+ 		gauss->GaussVertex(iv);
+ 		
+ 		damage_input->GetInputValue(&damage,gauss);
+-		sigma_xx_input->GetInputValue(&sigma_xx,gauss);
+-		sigma_xy_input->GetInputValue(&sigma_xy,gauss);
+-		sigma_yy_input->GetInputValue(&sigma_yy,gauss);
++		tau_xx_input->GetInputValue(&tau_xx,gauss);
++		tau_xy_input->GetInputValue(&tau_xy,gauss);
++		tau_yy_input->GetInputValue(&tau_yy,gauss);
+ 	
+ 		/*Calculate effective stress components*/
+-		s_xx=sigma_xx/(1.-damage);
+-		s_xy=sigma_xy/(1.-damage);
+-		s_yy=sigma_yy/(1.-damage);
++		s_xx=tau_xx/(1.-damage);
++		s_xy=tau_xy/(1.-damage);
++		s_yy=tau_yy/(1.-damage);
+ 
+ 		/*Calculate principal effective stresses*/
+ 		s1=(s_xx+s_yy)/2.+sqrt(pow((s_xx-s_yy)/2.,2)+pow(s_xy,2));
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17679)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17680)
+@@ -202,6 +202,7 @@
+ 		virtual void   ComputeBasalStress(Vector<IssmDouble>* sigma_b)=0;
+ 		virtual void   ComputeStrainRate(Vector<IssmDouble>* eps)=0;
+ 		virtual void   ComputeStressTensor(void)=0;
++		virtual void   ComputeDeviatoricStressTensor(void)=0;
+ 
+ 		virtual void   Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finite_element)=0;
+ 		virtual void   InputDuplicate(int original_enum,int new_enum)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17679)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17680)
+@@ -164,12 +164,14 @@
+ 	IssmDouble	sigma_xz[NUMVERTICES]={0,0,0};
+ 	IssmDouble	sigma_yz[NUMVERTICES]={0,0,0};
+ 	GaussTria*  gauss=NULL;
+-	int dim=2;
++	int meshtype,dim=2;
+ 
+ 	/* Get node coordinates and dof list: */
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*Retrieve all inputs we will be needing: */
++	this->FindParam(&meshtype,MeshTypeEnum);
++	if(meshtype==Mesh2DhorizontalEnum) _error_("stress tensor calculation not supported for mesh of type " <<EnumToStringx(meshtype)<<", extrude mesh or call ComputeDeviatoricStressTensor");
+ 	Input* pressure_input=inputs->GetInput(PressureEnum); _assert_(pressure_input);
+ 	Input* vx_input=inputs->GetInput(VxEnum);             _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum);             _assert_(vy_input);
+@@ -202,6 +204,57 @@
+ 	delete gauss;
+ }
+ /*}}}*/
++/*FUNCTION Tria::ComputeDeviatoricStressTensor {{{*/
++void  Tria::ComputeDeviatoricStressTensor(){
++
++	IssmDouble  xyz_list[NUMVERTICES][3];
++	IssmDouble  viscosity;
++	IssmDouble  epsilon[3]; /* epsilon=[exx,eyy,exy];*/
++	IssmDouble  tau_xx[NUMVERTICES];
++	IssmDouble	tau_yy[NUMVERTICES];
++	IssmDouble	tau_zz[NUMVERTICES]={0,0,0};
++	IssmDouble  tau_xy[NUMVERTICES];
++	IssmDouble	tau_xz[NUMVERTICES]={0,0,0};
++	IssmDouble	tau_yz[NUMVERTICES]={0,0,0};
++	GaussTria*  gauss=NULL;
++	int meshtype,dim=2;
++
++	/* Get node coordinates and dof list: */
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++
++	/*Retrieve all inputs we will be needing: */
++	this->FindParam(&meshtype,MeshTypeEnum);
++	if(meshtype!=Mesh2DhorizontalEnum) _error_("deviatoric stress tensor calculation not implemented for mesh of type " <<EnumToStringx(meshtype));
++	Input* vx_input=inputs->GetInput(VxEnum);             _assert_(vx_input);
++	Input* vy_input=inputs->GetInput(VyEnum);             _assert_(vy_input);
++
++	/* Start looping on the number of vertices: */
++	gauss=new GaussTria();
++	for (int iv=0;iv<NUMVERTICES;iv++){
++		gauss->GaussVertex(iv);
++
++		/*Compute strain rate and viscosity: */
++		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
++		this->ViscositySSA(&viscosity,dim,&xyz_list[0][0],gauss,vx_input,vy_input);
++
++		/*Compute Stress*/
++		tau_xx[iv]=2*viscosity*epsilon[0]; // tau = nu eps
++		tau_yy[iv]=2*viscosity*epsilon[1];
++		tau_xy[iv]=2*viscosity*epsilon[2];
++	}
++
++	/*Add Stress tensor components into inputs*/
++	this->inputs->AddInput(new TriaInput(DeviatoricStressxxEnum,&tau_xx[0],P1Enum));
++	this->inputs->AddInput(new TriaInput(DeviatoricStressxyEnum,&tau_xy[0],P1Enum));
++	this->inputs->AddInput(new TriaInput(DeviatoricStressxzEnum,&tau_xz[0],P1Enum));
++	this->inputs->AddInput(new TriaInput(DeviatoricStressyyEnum,&tau_yy[0],P1Enum));
++	this->inputs->AddInput(new TriaInput(DeviatoricStressyzEnum,&tau_yz[0],P1Enum));
++	this->inputs->AddInput(new TriaInput(DeviatoricStresszzEnum,&tau_zz[0],P1Enum));
++
++	/*Clean up and return*/
++	delete gauss;
++}
++/*}}}*/
+ /*FUNCTION Tria::Configure {{{*/
+ void  Tria::Configure(Elements* elementsin, Loads* loadsin,Nodes* nodesin,Vertices *verticesin,Materials* materialsin, Parameters* parametersin){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17679)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17680)
+@@ -53,6 +53,7 @@
+ 		void        ComputeBasalStress(Vector<IssmDouble>* sigma_b);
+ 		void        ComputeStrainRate(Vector<IssmDouble>* eps);
+ 		void        ComputeStressTensor();
++		void        ComputeDeviatoricStressTensor();
+ 		void        ComputeSurfaceNormalVelocity();
+ 		void        Configure(Elements* elements,Loads* loads,Nodes* nodesin,Vertices* verticesin,Materials* materials,Parameters* parameters);
+ 		void        SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17679)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17680)
+@@ -336,6 +336,58 @@
+ 	delete gauss;
+ }
+ /*}}}*/
++/*FUNCTION Penta::ComputeDeviatoricStressTensor {{{*/
++void  Penta::ComputeDeviatoricStressTensor(){
++
++	IssmDouble      xyz_list[NUMVERTICES][3];
++	IssmDouble      viscosity;
++	IssmDouble      epsilon[6]; /* epsilon=[exx,eyy,exy];*/
++	IssmDouble      tau_xx[NUMVERTICES];
++	IssmDouble		tau_yy[NUMVERTICES];
++	IssmDouble		tau_zz[NUMVERTICES];
++	IssmDouble      tau_xy[NUMVERTICES];
++	IssmDouble		tau_xz[NUMVERTICES];
++	IssmDouble		tau_yz[NUMVERTICES];
++	GaussPenta* gauss=NULL;
++
++	/* Get node coordinates and dof list: */
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++
++	/*Retrieve all inputs we will be needing: */
++	Input* vx_input=inputs->GetInput(VxEnum);             _assert_(vx_input);
++	Input* vy_input=inputs->GetInput(VyEnum);             _assert_(vy_input);
++	Input* vz_input=inputs->GetInput(VzEnum);             _assert_(vz_input);
++
++	/* Start looping on the number of vertices: */
++	gauss=new GaussPenta();
++	for (int iv=0;iv<NUMVERTICES;iv++){
++		gauss->GaussVertex(iv);
++
++		/*Compute strain rate viscosity and pressure: */
++		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
++		this->ViscosityFS(&viscosity,3,&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
++
++		/*Compute Stress*/
++		tau_xx[iv]=2*viscosity*epsilon[0]; // tau = nu eps 
++		tau_yy[iv]=2*viscosity*epsilon[1];
++		tau_zz[iv]=2*viscosity*epsilon[2];
++		tau_xy[iv]=2*viscosity*epsilon[3];
++		tau_xz[iv]=2*viscosity*epsilon[4];
++		tau_yz[iv]=2*viscosity*epsilon[5];
++	}
++
++	/*Add Stress tensor components into inputs*/
++	this->inputs->AddInput(new PentaInput(StressTensorxxEnum,&tau_xx[0],P1Enum));
++	this->inputs->AddInput(new PentaInput(StressTensorxyEnum,&tau_xy[0],P1Enum));
++	this->inputs->AddInput(new PentaInput(StressTensorxzEnum,&tau_xz[0],P1Enum));
++	this->inputs->AddInput(new PentaInput(StressTensoryyEnum,&tau_yy[0],P1Enum));
++	this->inputs->AddInput(new PentaInput(StressTensoryzEnum,&tau_yz[0],P1Enum));
++	this->inputs->AddInput(new PentaInput(StressTensorzzEnum,&tau_zz[0],P1Enum));
++
++	/*Clean up and return*/
++	delete gauss;
++}
++/*}}}*/
+ /*FUNCTION Penta::Configure {{{*/
+ void  Penta::Configure(Elements* elementsin, Loads* loadsin, Nodes* nodesin,Vertices* verticesin, Materials* materialsin, Parameters* parametersin){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17679)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17680)
+@@ -56,6 +56,7 @@
+ 		void   ComputeBasalStress(Vector<IssmDouble>* sigma_b);
+ 		void   ComputeStrainRate(Vector<IssmDouble>* eps);
+ 		void   ComputeStressTensor();
++		void   ComputeDeviatoricStressTensor();
+ 		void   Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
+ 		void   ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz);
+ 		int    FiniteElement(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17679)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17680)
+@@ -55,6 +55,7 @@
+ 		void        ComputeBasalStress(Vector<IssmDouble>* sigma_b){_error_("not implemented yet");};
+ 		void        ComputeStrainRate(Vector<IssmDouble>* eps){_error_("not implemented yet");};
+ 		void        ComputeStressTensor(){_error_("not implemented yet");};
++		void        ComputeDeviatoricStressTensor(){_error_("not implemented yet");};
+ 		void        Configure(Elements* elements,Loads* loads,Nodes* nodesin,Vertices* verticesin,Materials* materials,Parameters* parameters){_error_("not implemented yet");};
+ 		void        SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters){_error_("not implemented yet");};
+ 		void        Delta18oParameterization(void){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17679)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17680)
+@@ -55,6 +55,7 @@
+ 		void        ComputeBasalStress(Vector<IssmDouble>* sigma_b){_error_("not implemented yet");};
+ 		void        ComputeStrainRate(Vector<IssmDouble>* eps){_error_("not implemented yet");};
+ 		void        ComputeStressTensor(){_error_("not implemented yet");};
++		void        ComputeDeviatoricStressTensor(){_error_("not implemented yet");};
+ 		void        Configure(Elements* elements,Loads* loads,Nodes* nodesin,Vertices* verticesin,Materials* materials,Parameters* parameters);
+ 		void        SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters);
+ 		void        Delta18oParameterization(void){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-17680-17681.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17680-17681.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17680-17681.diff	(revision 17802)
@@ -0,0 +1,40 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17680)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17681)
+@@ -164,14 +164,14 @@
+ 	IssmDouble	sigma_xz[NUMVERTICES]={0,0,0};
+ 	IssmDouble	sigma_yz[NUMVERTICES]={0,0,0};
+ 	GaussTria*  gauss=NULL;
+-	int meshtype,dim=2;
++	int meshxdim,dim=2;
+ 
+ 	/* Get node coordinates and dof list: */
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*Retrieve all inputs we will be needing: */
+-	this->FindParam(&meshtype,MeshTypeEnum);
+-	if(meshtype==Mesh2DhorizontalEnum) _error_("stress tensor calculation not supported for mesh of type " <<EnumToStringx(meshtype)<<", extrude mesh or call ComputeDeviatoricStressTensor");
++	this->FindParam(&meshxdim,MeshTypeEnum);
++	if(meshxdim==Mesh2DhorizontalEnum) _error_("stress tensor calculation not supported for mesh of type " <<EnumToStringx(meshxdim)<<", extrude mesh or call ComputeDeviatoricStressTensor");
+ 	Input* pressure_input=inputs->GetInput(PressureEnum); _assert_(pressure_input);
+ 	Input* vx_input=inputs->GetInput(VxEnum);             _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum);             _assert_(vy_input);
+@@ -217,14 +217,14 @@
+ 	IssmDouble	tau_xz[NUMVERTICES]={0,0,0};
+ 	IssmDouble	tau_yz[NUMVERTICES]={0,0,0};
+ 	GaussTria*  gauss=NULL;
+-	int meshtype,dim=2;
++	int meshxdim,dim=2;
+ 
+ 	/* Get node coordinates and dof list: */
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*Retrieve all inputs we will be needing: */
+-	this->FindParam(&meshtype,MeshTypeEnum);
+-	if(meshtype!=Mesh2DhorizontalEnum) _error_("deviatoric stress tensor calculation not implemented for mesh of type " <<EnumToStringx(meshtype));
++	this->FindParam(&meshxdim,MeshTypeEnum);
++	if(meshxdim!=Mesh2DhorizontalEnum) _error_("deviatoric stress tensor calculation not implemented for mesh of type " <<EnumToStringx(meshxdim));
+ 	Input* vx_input=inputs->GetInput(VxEnum);             _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum);             _assert_(vy_input);
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17681-17682.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17681-17682.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17681-17682.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/classes/stressbalance.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/stressbalance.py	(revision 17681)
++++ ../trunk-jpl/src/m/classes/stressbalance.py	(revision 17682)
+@@ -109,7 +109,7 @@
+ 	#}}}
+ 	def defaultoutputs(self,md): # {{{
+ 
+-		if md.mesh.meshdim==3:
++		if md.mesh.meshdim()==3:
+ 			list = ['Vx','Vy','Vz','Vel','Pressure']
+ 		else:
+ 			list = ['Vx','Vy','Vel','Pressure']
Index: issm/oecreview/Archive/16554-17801/ISSM-17682-17683.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17682-17683.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17682-17683.diff	(revision 17802)
@@ -0,0 +1,70 @@
+Index: ../trunk-jpl/test/NightlyRun/test101.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test101.m	(revision 17682)
++++ ../trunk-jpl/test/NightlyRun/test101.m	(revision 17683)
+@@ -5,7 +5,7 @@
+ md.cluster=generic('name',oshostname(),'np',2);
+ 
+ %output
+-md.stressbalance.requested_outputs={'default','StressTensorxx','StressTensoryy','StressTensorxy','MassFlux1','MassFlux2','MassFlux3','MassFlux4','MassFlux5','MassFlux6'};
++md.stressbalance.requested_outputs={'default','DeviatoricStressxx','DeviatoricStressyy','DeviatoricStressxy','MassFlux1','MassFlux2','MassFlux3','MassFlux4','MassFlux5','MassFlux6'};
+ md.outputdefinition.definitions={...
+ 	massfluxatgate('MassFlux1',['../Exp/MassFlux1.exp']),...
+ 	massfluxatgate('MassFlux2',['../Exp/MassFlux2.exp']),...
+@@ -19,7 +19,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vel','Pressure',...
+-	'StressTensorxx','StressTensoryy','StressTensorxy','MassFlux1','MassFlux2','MassFlux3','MassFlux4','MassFlux5','MassFlux6'};
++	'DeviatoricStressxx','DeviatoricStressyy','DeviatoricStressxy','MassFlux1','MassFlux2','MassFlux3','MassFlux4','MassFlux5','MassFlux6'};
+ field_tolerances={2e-13,1e-13,1e-13,1e-13,...
+ 	1e-13,1e-13,1e-13,...
+ 	1e-13, 1e-13, 1e-13, 1e-13, 1e-13, 1e-13 };
+@@ -28,9 +28,9 @@
+ 	(md.results.StressbalanceSolution.Vy),...
+ 	(md.results.StressbalanceSolution.Vel),...
+ 	(md.results.StressbalanceSolution.Pressure),...
+-	(md.results.StressbalanceSolution.StressTensorxx),...
+-	(md.results.StressbalanceSolution.StressTensoryy),...
+-	(md.results.StressbalanceSolution.StressTensorxy),...
++	(md.results.StressbalanceSolution.DeviatoricStressxx),...
++	(md.results.StressbalanceSolution.DeviatoricStressyy),...
++	(md.results.StressbalanceSolution.DeviatoricStressxy),...
+ 	(md.results.StressbalanceSolution.MassFlux1),...
+ 	(md.results.StressbalanceSolution.MassFlux2),...
+ 	(md.results.StressbalanceSolution.MassFlux3),...
+Index: ../trunk-jpl/test/NightlyRun/test101.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test101.py	(revision 17682)
++++ ../trunk-jpl/test/NightlyRun/test101.py	(revision 17683)
+@@ -16,7 +16,7 @@
+ md.cluster=generic('name',oshostname(),'np',3)
+ 
+ #outputs
+-md.stressbalance.requested_outputs=['default','StressTensorxx','StressTensoryy','StressTensorxy','MassFlux1','MassFlux2','MassFlux3','MassFlux4','MassFlux5','MassFlux6']
++md.stressbalance.requested_outputs=['default','DeviatoricStressxx','DeviatoricStressyy','DeviatoricStressxy','MassFlux1','MassFlux2','MassFlux3','MassFlux4','MassFlux5','MassFlux6']
+ md.outputdefinition.definitions=[
+ 		massfluxatgate('MassFlux1','../Exp/MassFlux1.exp'),
+ 		massfluxatgate('MassFlux2','../Exp/MassFlux2.exp'),
+@@ -30,7 +30,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Vx','Vy','Vel','Pressure',\
+-	'StressTensorxx','StressTensoryy','StressTensorxy','MassFlux1','MassFlux2','MassFlux3','MassFlux4','MassFlux5','MassFlux6']
++	'DeviatoricStressxx','DeviatoricStressyy','DeviatoricStressxy','MassFlux1','MassFlux2','MassFlux3','MassFlux4','MassFlux5','MassFlux6']
+ field_tolerances=[1e-13,1e-13,1e-13,1e-13,\
+ 	1e-13,1e-13,1e-13,\
+ 	1e-13, 1e-13, 1e-13, 1e-13, 1e-13, 1e-13 ]
+@@ -39,9 +39,9 @@
+ 	md.results.StressbalanceSolution.Vy,\
+ 	md.results.StressbalanceSolution.Vel,\
+ 	md.results.StressbalanceSolution.Pressure,\
+-	md.results.StressbalanceSolution.StressTensorxx,\
+-	md.results.StressbalanceSolution.StressTensoryy,\
+-	md.results.StressbalanceSolution.StressTensorxy,\
++	md.results.StressbalanceSolution.DeviatoricStressxx,\
++	md.results.StressbalanceSolution.DeviatoricStressyy,\
++	md.results.StressbalanceSolution.DeviatoricStressxy,\
+ 	md.results.StressbalanceSolution.MassFlux1,\
+ 	md.results.StressbalanceSolution.MassFlux2,\
+ 	md.results.StressbalanceSolution.MassFlux3,\
Index: issm/oecreview/Archive/16554-17801/ISSM-17683-17684.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17683-17684.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17683-17684.diff	(revision 17802)
@@ -0,0 +1,62 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17683)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17684)
+@@ -170,7 +170,7 @@
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*Retrieve all inputs we will be needing: */
+-	this->FindParam(&meshxdim,MeshTypeEnum);
++	this->FindParam(&meshxdim,MeshXDimEnum);
+ 	if(meshxdim==Mesh2DhorizontalEnum) _error_("stress tensor calculation not supported for mesh of type " <<EnumToStringx(meshxdim)<<", extrude mesh or call ComputeDeviatoricStressTensor");
+ 	Input* pressure_input=inputs->GetInput(PressureEnum); _assert_(pressure_input);
+ 	Input* vx_input=inputs->GetInput(VxEnum);             _assert_(vx_input);
+@@ -223,7 +223,7 @@
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*Retrieve all inputs we will be needing: */
+-	this->FindParam(&meshxdim,MeshTypeEnum);
++	this->FindParam(&meshxdim,MeshXDimEnum);
+ 	if(meshxdim!=Mesh2DhorizontalEnum) _error_("deviatoric stress tensor calculation not implemented for mesh of type " <<EnumToStringx(meshxdim));
+ 	Input* vx_input=inputs->GetInput(VxEnum);             _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum);             _assert_(vy_input);
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17683)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17684)
+@@ -809,27 +809,21 @@
+ 				input=this->inputs->GetInput(output_enum);
+ 				break;
+ 			case StressTensorxxEnum: 
+-				this->ComputeStressTensor();
+-				input=this->inputs->GetInput(output_enum);
+-				break;
+ 			case StressTensorxyEnum: 
+-				this->ComputeStressTensor();
+-				input=this->inputs->GetInput(output_enum);
+-				break;
+ 			case StressTensorxzEnum: 
+-				this->ComputeStressTensor();
+-				input=this->inputs->GetInput(output_enum);
+-				break;
+ 			case StressTensoryyEnum: 
+-				this->ComputeStressTensor();
+-				input=this->inputs->GetInput(output_enum);
+-				break;
+ 			case StressTensoryzEnum: 
++			case StressTensorzzEnum: 
+ 				this->ComputeStressTensor();
+ 				input=this->inputs->GetInput(output_enum);
+ 				break;
+-			case StressTensorzzEnum: 
+-				this->ComputeStressTensor();
++			case DeviatoricStressxxEnum: 
++			case DeviatoricStressxyEnum: 
++			case DeviatoricStressxzEnum: 
++			case DeviatoricStressyyEnum: 
++			case DeviatoricStressyzEnum: 
++			case DeviatoricStresszzEnum: 
++				this->ComputeDeviatoricStressTensor();
+ 				input=this->inputs->GetInput(output_enum);
+ 				break;
+ 			default:
Index: issm/oecreview/Archive/16554-17801/ISSM-17684-17685.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17684-17685.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17684-17685.diff	(revision 17802)
@@ -0,0 +1,20 @@
+Index: ../trunk-jpl/test/NightlyRun/runme.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/runme.py	(revision 17684)
++++ ../trunk-jpl/test/NightlyRun/runme.py	(revision 17685)
+@@ -3,7 +3,6 @@
+ import glob
+ import socket
+ import numpy
+-#import h5py
+ import netCDF4
+ import sys
+ 
+@@ -272,6 +271,7 @@
+ 
+ 	md = runme(args.id, args.exclude, args.benchmark, args.procedure, args.output, args.rank, args.numprocs)
+ 
++	from MatlabFuncs import strcmpi
+ 	if strcmpi(args.output,'nightly'):
+ 		print "PYTHONEXITEDCORRECTLY"
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17685-17686.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17685-17686.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17685-17686.diff	(revision 17802)
@@ -0,0 +1,6563 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h	(revision 17686)
+@@ -12,7 +12,7 @@
+ 
+ 	public:
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 17686)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ 
+ /*Model processing*/
+-int  BalancethicknessAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int  BalancethicknessAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	return 1;
+ }/*}}}*/
+ void BalancethicknessAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+@@ -43,7 +43,7 @@
+ 	iomodel->FetchDataToInput(elements,SurfaceforcingsMassBalanceEnum);
+ 	iomodel->FetchDataToInput(elements,BalancethicknessThickeningRateEnum);
+ 
+-	if(iomodel->meshxdim==Mesh3DEnum){
++	if(iomodel->domaintype==Mesh3DEnum){
+ 		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
+@@ -54,10 +54,10 @@
+ 	iomodel->Constant(&stabilization,BalancethicknessStabilizationEnum);
+ 
+ 	/*Check in 3d*/
+-	if(stabilization==3 && iomodel->meshxdim==Mesh3DEnum) _error_("DG 3d not implemented yet");
++	if(stabilization==3 && iomodel->domaintype==Mesh3DEnum) _error_("DG 3d not implemented yet");
+ 
+ 	/*First fetch data: */
+-	if(iomodel->meshxdim==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	if(stabilization!=3){
+ 		::CreateNodes(nodes,iomodel,BalancethicknessAnalysisEnum,P1Enum);
+ 	}
+@@ -140,16 +140,16 @@
+ 			_error_("Element type " << EnumToStringx(element->FiniteElement()) << " not supported yet");
+ 	}
+ 
+-	int meshxdim;
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	int domaintype;
++	element->FindParam(&domaintype,DomainTypeEnum);
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return Ke;
+ }/*}}}*/
+ ElementMatrix* BalancethicknessAnalysis::CreateKMatrixCG(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries */
+ 	int        stabilization;
+-	int        meshxdim;
++	int        domaintype;
+ 	IssmDouble Jdet,D_scalar,h;
+ 	IssmDouble vel,vx,vy,dvxdx,dvydy;
+ 	IssmDouble dvx[2],dvy[2];
+@@ -166,11 +166,11 @@
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+-	element->FindParam(&meshxdim,MeshXDimEnum);
++	element->FindParam(&domaintype,DomainTypeEnum);
+ 	element->FindParam(&stabilization,BalancethicknessStabilizationEnum);
+ 	Input* vxaverage_input=NULL;
+ 	Input* vyaverage_input=NULL;
+-	if(meshxdim==Mesh2DhorizontalEnum){
++	if(domaintype==Mesh2DhorizontalEnum){
+ 		vxaverage_input=element->GetInput(VxEnum); _assert_(vxaverage_input);
+ 		vyaverage_input=element->GetInput(VyEnum); _assert_(vyaverage_input);
+ 	}
+@@ -252,7 +252,7 @@
+ ElementMatrix* BalancethicknessAnalysis::CreateKMatrixDG(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries */
+-	int        meshxdim;
++	int        domaintype;
+ 	IssmDouble Jdet,D_scalar,vx,vy,dvxdx,dvydy,vel;
+ 	IssmDouble dvx[2],dvy[2];
+ 	IssmDouble* xyz_list = NULL;
+@@ -268,10 +268,10 @@
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+-	element->FindParam(&meshxdim,MeshXDimEnum);
++	element->FindParam(&domaintype,DomainTypeEnum);
+ 	Input* vxaverage_input=NULL;
+ 	Input* vyaverage_input=NULL;
+-	if(meshxdim==Mesh2DhorizontalEnum){
++	if(domaintype==Mesh2DhorizontalEnum){
+ 		vxaverage_input=element->GetInput(VxEnum); _assert_(vxaverage_input);
+ 		vyaverage_input=element->GetInput(VyEnum); _assert_(vyaverage_input);
+ 	}
+@@ -332,9 +332,9 @@
+ 			_error_("Element type " << EnumToStringx(element->FiniteElement()) << " not supported yet");
+ 	}
+ 
+-	int meshxdim;
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	int domaintype;
++	element->FindParam(&domaintype,DomainTypeEnum);
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
+ ElementVector* BalancethicknessAnalysis::CreatePVectorCG(Element* element){/*{{{*/
+@@ -479,16 +479,16 @@
+ }/*}}}*/
+ void BalancethicknessAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	int meshxdim;
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	int domaintype;
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			element->InputUpdateFromSolutionOneDof(solution,ThicknessEnum);
+ 			break;
+ 		case Mesh3DEnum:
+ 			element->InputUpdateFromSolutionOneDofCollapsed(solution,ThicknessEnum);
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ }/*}}}*/
+ void BalancethicknessAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.h	(revision 17686)
+@@ -12,7 +12,7 @@
+ 
+ 	public:
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17686)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ 
+ /*Model processing*/
+-int  HydrologyDCEfficientAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int  HydrologyDCEfficientAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	return 1;
+ }/*}}}*/
+ void HydrologyDCEfficientAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+@@ -55,7 +55,7 @@
+ 	iomodel->FetchDataToInput(elements,HydrologydcEplInitialThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcSedimentTransmitivityEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcEplThicknessEnum);
+-	if(iomodel->meshxdim==Mesh3DEnum) iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
++	if(iomodel->domaintype==Mesh3DEnum) iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 	
+ 	//	elements->InputDuplicate(HydrologydcEplInitialThicknessEnum,HydrologydcEplThicknessEnum);
+ 
+@@ -72,7 +72,7 @@
+ 	iomodel->Constant(&isefficientlayer,HydrologydcIsefficientlayerEnum);
+ 	if(!isefficientlayer) return;
+ 
+-	if(iomodel->meshxdim!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,HydrologyDCEfficientAnalysisEnum,P1Enum);
+ 	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+@@ -110,12 +110,12 @@
+ 
+ 	/*Intermediaries*/
+ 	bool     active_element;
+-	int      meshxdim;
++	int      domaintype;
+ 	Element* basalelement;
+ 
+ 	/*Get basal element*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+@@ -123,7 +123,7 @@
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	Input* active_element_input = basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);
+@@ -131,7 +131,7 @@
+ 
+ 	/*Check that all nodes are active, else return empty matrix*/
+ 	if(!active_element) {
+-	if(meshxdim!=Mesh2DhorizontalEnum){
++	if(domaintype!=Mesh2DhorizontalEnum){
+ 			basalelement->DeleteMaterials(); 
+ 			delete basalelement;
+ 		}
+@@ -206,7 +206,7 @@
+ 	xDelete<IssmDouble>(basis);
+ 	xDelete<IssmDouble>(B);
+ 	delete gauss;
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return Ke;
+ 
+ }/*}}}*/
+@@ -214,12 +214,12 @@
+ 
+ 	/*Intermediaries*/
+ 	bool     active_element;
+-	int      meshxdim;
++	int      domaintype;
+ 	Element* basalelement;
+ 
+ 	/*Get basal element*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+@@ -227,7 +227,7 @@
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	Input* active_element_input = basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);
+@@ -235,7 +235,7 @@
+ 
+ 	/*Check that all nodes are active, else return empty matrix*/
+ 	if(!active_element) {
+-	if(meshxdim!=Mesh2DhorizontalEnum){
++	if(domaintype!=Mesh2DhorizontalEnum){
+ 			basalelement->DeleteMaterials(); 
+ 			delete basalelement;
+ 		}
+@@ -308,7 +308,7 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+ 	delete gauss;
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
+ void HydrologyDCEfficientAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+@@ -316,12 +316,12 @@
+ }/*}}}*/
+ void HydrologyDCEfficientAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	int meshxdim,i;
++	int domaintype,i;
+ 	Element*   basalelement=NULL;
+ 
+-	element->FindParam(&meshxdim,MeshXDimEnum);
++	element->FindParam(&domaintype,DomainTypeEnum);
+ 
+-	if(meshxdim!=Mesh2DhorizontalEnum){
++	if(domaintype!=Mesh2DhorizontalEnum){
+ 		if(!element->IsOnBase()) return;
+ 		basalelement=element->SpawnBasalElement();
+ 	}
+@@ -350,7 +350,7 @@
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(eplHeads);
+ 	xDelete<int>(doflist);
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ } /*}}}*/
+ void HydrologyDCEfficientAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+ 	/*Default, do nothing*/
+@@ -480,18 +480,18 @@
+ void HydrologyDCEfficientAnalysis::ComputeEPLThickness(FemModel* femmodel){/*{{{*/
+ 
+ 	bool        active_element;
+-	int         meshxdim;
++	int         domaintype;
+ 	IssmDouble  dt,A,B;
+ 	IssmDouble  EPLgrad2;
+ 	IssmDouble  EPL_N;
+ 
+-	femmodel->parameters->FindParam(&meshxdim,MeshXDimEnum);
++	femmodel->parameters->FindParam(&domaintype,DomainTypeEnum);
+ 
+ 	for(int j=0;j<femmodel->elements->Size();j++){
+ 		
+ 		Element* element=(Element*)femmodel->elements->GetObjectByOffset(j);
+ 		
+-		switch(meshxdim){
++		switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			if(!element->IsOnBase()) return;			
+ 			B = element->GetMaterialParameter(MaterialsRheologyBbarEnum);
+@@ -601,14 +601,14 @@
+ 
+ 	bool        active_element;
+ 	int         i,j;
+-	int         meshxdim;
++	int         domaintype;
+ 	IssmDouble  h_max;
+ 	IssmDouble  sedheadmin;
+ 	Element*   basalelement=NULL;
+ 
+ 	/*Get basal element*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+@@ -616,7 +616,7 @@
+ 			if(!element->IsOnBase()) return;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Intermediaries*/
+@@ -672,7 +672,7 @@
+ 			}
+ 		}
+ 	}
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	xDelete<IssmDouble>(epl_thickness);
+ 	xDelete<IssmDouble>(old_active);
+ 	xDelete<IssmDouble>(sedhead);
+@@ -683,12 +683,12 @@
+ void HydrologyDCEfficientAnalysis::HydrologyEPLGetActive(Vector<IssmDouble>* active_vec, Element* element){
+ 	/*Constants*/
+ 
+-	int      meshxdim;
++	int      domaintype;
+ 	Element*   basalelement=NULL;
+ 
+ 	/*Get basal element*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+@@ -696,7 +696,7 @@
+ 			if(!element->IsOnBase()) return;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 	
+ 	const int   numnodes = basalelement->GetNumberOfNodes();
+@@ -715,7 +715,7 @@
+ 	else{
+ 		/*Do not do anything: at least one node is active for this element but this element is not solved for*/
+ 	}
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	xDelete<IssmDouble>(active);
+ }
+ 
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h	(revision 17686)
+@@ -12,7 +12,7 @@
+ 
+ 	public:
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 17686)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ 
+ /*Model processing*/
+-int  AdjointHorizAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int  AdjointHorizAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	_error_("not implemented");
+ }/*}}}*/
+ void AdjointHorizAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+@@ -54,12 +54,12 @@
+ ElementMatrix* AdjointHorizAnalysis::CreateKMatrixSSA(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int      meshxdim;
++	int      domaintype;
+ 	Element* basalelement;
+ 
+ 	/*Get basal element*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+@@ -67,7 +67,7 @@
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Intermediaries */
+@@ -86,7 +86,7 @@
+ 	ElementMatrix* Ke=analysis->CreateKMatrix(element);
+ 	delete analysis;
+ 	if(incomplete_adjoint){
+-		if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++		if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 		return Ke;
+ 	}
+ 
+@@ -135,7 +135,7 @@
+ 	delete gauss;
+ 	xDelete<IssmDouble>(dbasis);
+ 	xDelete<IssmDouble>(xyz_list);
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return Ke;
+ }/*}}}*/
+ ElementMatrix* AdjointHorizAnalysis::CreateKMatrixHO(Element* element){/*{{{*/
+@@ -303,7 +303,7 @@
+ 	if(!element->IsOnSurface()) return NULL;
+ 
+ 	/*Intermediaries */
+-	int        num_responses,i,meshxdim,dim;
++	int        num_responses,i,domaintype,dim;
+ 	IssmDouble Jdet,obs_velocity_mag,velocity_mag;
+ 	IssmDouble vx,vy,vxobs,vyobs,dux,duy,weight;
+ 	IssmDouble scalex,scaley,scale,S;
+@@ -311,11 +311,11 @@
+ 	IssmDouble *xyz_list_top = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -683,12 +683,12 @@
+ ElementVector* AdjointHorizAnalysis::CreatePVectorSSA(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int      meshxdim;
++	int      domaintype;
+ 	Element* basalelement;
+ 
+ 	/*Get basal element*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+@@ -696,7 +696,7 @@
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Intermediaries */
+@@ -874,7 +874,7 @@
+ 	xDelete<int>(responses);
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	delete gauss;
+ 	return pe;
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/MeltingAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeltingAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/MeltingAnalysis.h	(revision 17686)
+@@ -12,7 +12,7 @@
+ 
+ 	public:
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/GiaAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/GiaAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/GiaAnalysis.h	(revision 17686)
+@@ -12,7 +12,7 @@
+ 
+ 	public:
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h	(revision 17686)
+@@ -12,7 +12,7 @@
+ 
+ 	public:
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17686)
+@@ -10,7 +10,7 @@
+ #include "../modules/modules.h"
+ #include "../solutionsequences/solutionsequences.h"
+ 
+-int LevelsetAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int LevelsetAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	return 1;
+ }
+ /*}}}*/
+@@ -42,7 +42,7 @@
+ /*}}}*/
+ void LevelsetAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 	int finiteelement=P1Enum;
+-	if(iomodel->meshxdim!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,LevelsetAnalysisEnum,finiteelement);
+ 	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }
+@@ -92,7 +92,7 @@
+ 	Element* basalelement = element->SpawnBasalElement();
+ 
+ 	/*Intermediaries */
+-	int  dim, meshxdim;
++	int  dim, domaintype;
+ 	int i, row, col;
+ 	IssmDouble kappa;
+ 	IssmDouble Jdet, dt, D_scalar;
+@@ -102,12 +102,12 @@
+ 	IssmDouble* xyz_list = NULL;
+ 
+ 	/*Get problem dimension*/
+-	basalelement->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	basalelement->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum:   dim = 1; break;
+ 		case Mesh2DhorizontalEnum: dim = 2; break;
+ 		case Mesh3DEnum:           dim = 2; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -129,7 +129,7 @@
+ 	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	Input* vx_input=NULL;
+ 	Input* vy_input=NULL;
+-	if(meshxdim==Mesh2DhorizontalEnum){
++	if(domaintype==Mesh2DhorizontalEnum){
+ 		vx_input=basalelement->GetInput(VxEnum); _assert_(vx_input);
+ 		vy_input=basalelement->GetInput(VyEnum); _assert_(vy_input);
+ 	}
+@@ -252,7 +252,7 @@
+ 	xDelete<IssmDouble>(c);
+ 	xDelete<IssmDouble>(dlsf);
+ 	delete gauss;
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return Ke;
+ }/*}}}*/
+ ElementVector* LevelsetAnalysis::CreatePVector(Element* element){/*{{{*/
+@@ -261,7 +261,7 @@
+ 	Element* basalelement = element->SpawnBasalElement();
+ 
+ 	/*Intermediaries */
+-	int i, ig, meshxdim;
++	int i, ig, domaintype;
+ 	IssmDouble  Jdet,dt;
+ 	IssmDouble  lsf;
+ 	IssmDouble* xyz_list = NULL;
+@@ -297,8 +297,8 @@
+ 		/*Clean up and return*/
+ 		xDelete<IssmDouble>(xyz_list);
+ 		xDelete<IssmDouble>(basis);
+-		basalelement->FindParam(&meshxdim,MeshXDimEnum);
+-		if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++		basalelement->FindParam(&domaintype,DomainTypeEnum);
++		if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 		delete gauss;
+ 	}
+ 
+@@ -309,16 +309,16 @@
+ }/*}}}*/
+ void LevelsetAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	int meshxdim;
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	int domaintype;
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			element->InputUpdateFromSolutionOneDof(solution,MaskIceLevelsetEnum);
+ 			break;
+ 		case Mesh3DEnum:
+ 			element->InputUpdateFromSolutionOneDofCollapsed(solution,MaskIceLevelsetEnum);
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ }/*}}}*/
+ void LevelsetAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 17686)
+@@ -6,7 +6,7 @@
+ #include "../solutionsequences/solutionsequences.h"
+ 
+ /*Model processing*/
+-int  StressbalanceVerticalAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int  StressbalanceVerticalAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	return 1;
+ }/*}}}*/
+ void StressbalanceVerticalAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+@@ -17,7 +17,7 @@
+ void StressbalanceVerticalAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+ 
+ 	/*return if not 3d mesh*/
+-	if(iomodel->meshxdim!=Mesh3DEnum) return;
++	if(iomodel->domaintype!=Mesh3DEnum) return;
+ 
+ 	/*Update elements: */
+ 	int counter=0;
+@@ -42,7 +42,7 @@
+ void StressbalanceVerticalAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+ 	/*return if not 3d mesh*/
+-	if(iomodel->meshxdim!=Mesh3DEnum) return;
++	if(iomodel->domaintype!=Mesh3DEnum) return;
+ 
+ 	iomodel->FetchData(3,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum,FlowequationVertexEquationEnum);
+ 	::CreateNodes(nodes,iomodel,StressbalanceVerticalAnalysisEnum,P1Enum);
+@@ -58,7 +58,7 @@
+ 	iomodel->Constant(&yts,ConstantsYtsEnum);
+ 
+ 	/*return if not 3d mesh*/
+-	if(iomodel->meshxdim!=Mesh3DEnum) return;
++	if(iomodel->domaintype!=Mesh3DEnum) return;
+ 
+ 	/*Fetch data: */
+ 	iomodel->FetchData(2,StressbalanceSpcvzEnum,FlowequationBorderFSEnum);
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.h	(revision 17686)
+@@ -12,7 +12,7 @@
+ 
+ 	public:
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h	(revision 17686)
+@@ -12,7 +12,7 @@
+ 
+ 	public:
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h	(revision 17686)
+@@ -12,7 +12,7 @@
+ 
+ 	public:
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h	(revision 17686)
+@@ -12,7 +12,7 @@
+ 
+ 	public:
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 17686)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ 
+ /*Model processing*/
+-int  MeltingAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int  MeltingAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	return 1;
+ }/*}}}*/
+ void MeltingAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+@@ -13,7 +13,7 @@
+ void MeltingAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+ 
+ 	/*Now, is the model 3d? otherwise, do nothing: */
+-	if(iomodel->meshxdim==Mesh2DhorizontalEnum)return;
++	if(iomodel->domaintype==Mesh2DhorizontalEnum)return;
+ 
+ 	/*Update elements: */
+ 	int counter=0;
+@@ -43,7 +43,7 @@
+ }/*}}}*/
+ void MeltingAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+-	if(iomodel->meshxdim==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,MeltingAnalysisEnum,P1Enum);
+ 	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+@@ -53,7 +53,7 @@
+ void MeltingAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+ 
+ 	/*if 2d: Error*/
+-	if(iomodel->meshxdim==Mesh2DhorizontalEnum) _error_("2d meshes not supported yet");
++	if(iomodel->domaintype==Mesh2DhorizontalEnum) _error_("2d meshes not supported yet");
+ 
+ 	//create penalties for nodes: no node can have a temperature over the melting point
+ 	iomodel->FetchData(1,MeshVertexonbaseEnum);
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 17686)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ 
+ /*Model processing*/
+-int  ExtrudeFromBaseAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int  ExtrudeFromBaseAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	return 1;
+ }/*}}}*/
+ void ExtrudeFromBaseAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+@@ -21,7 +21,7 @@
+ 		}
+ 	}
+ 
+-	if(iomodel->meshxdim==Mesh2DverticalEnum){
++	if(iomodel->domaintype==Mesh2DverticalEnum){
+ 		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
+ 	}
+ }/*}}}*/
+@@ -67,12 +67,12 @@
+ 	IssmDouble *xyz_list = NULL;
+ 
+ 	/*Get dimension*/
+-	int dim,meshxdim;
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	int dim,domaintype;
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -119,12 +119,12 @@
+ 	IssmDouble *xyz_list_top = NULL;
+ 
+ 	/*Get dimension*/
+-	int dim,meshxdim;
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	int dim,domaintype;
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -169,12 +169,12 @@
+ 	IssmDouble *xyz_list_base = NULL;
+ 
+ 	/*Get dimension*/
+-	int dim,meshxdim;
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	int dim,domaintype;
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h	(revision 17686)
+@@ -12,7 +12,7 @@
+ 
+ 	public:
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h	(revision 17686)
+@@ -12,7 +12,7 @@
+ 
+ 	public:
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/DepthAverageAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DepthAverageAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/DepthAverageAnalysis.h	(revision 17686)
+@@ -12,7 +12,7 @@
+ 
+ 	public:
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 17686)
+@@ -13,7 +13,7 @@
+ 
+ 	public:
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h	(revision 17686)
+@@ -12,7 +12,7 @@
+ 
+ 	public:
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h	(revision 17686)
+@@ -12,7 +12,7 @@
+ 
+ 	public:
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 17686)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ 
+ /*Model processor*/
+-int  AdjointBalancethicknessAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int  AdjointBalancethicknessAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	return 1;
+ }/*}}}*/
+ void AdjointBalancethicknessAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+@@ -48,12 +48,12 @@
+ ElementVector* AdjointBalancethicknessAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int      meshxdim;
++	int      domaintype;
+ 	Element* basalelement;
+ 
+ 	/*Get basal element*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+@@ -61,7 +61,7 @@
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Intermediaries */
+@@ -142,7 +142,7 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+ 	xDelete<IssmDouble>(dbasis);
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	delete gauss;
+ 	return pe;
+ }/*}}}*/
+@@ -151,16 +151,16 @@
+ }/*}}}*/
+ void AdjointBalancethicknessAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	int meshxdim;
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	int domaintype;
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			element->InputUpdateFromSolutionOneDof(solution,AdjointEnum);
+ 			break;
+ 		case Mesh3DEnum:
+ 			element->InputUpdateFromSolutionOneDofCollapsed(solution,AdjointEnum);
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ }/*}}}*/
+ void AdjointBalancethicknessAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 17686)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ 
+ /*Model processing*/
+-int  L2ProjectionEPLAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int  L2ProjectionEPLAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	return 1;
+ }/*}}}*/
+ void L2ProjectionEPLAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+@@ -35,7 +35,7 @@
+ 
+ 	iomodel->FetchDataToInput(elements,EplHeadEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+-	if(iomodel->meshxdim==Mesh3DEnum){
++	if(iomodel->domaintype==Mesh3DEnum){
+ 		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 	}
+ }/*}}}*/
+@@ -50,10 +50,10 @@
+ 	iomodel->Constant(&isefficientlayer,HydrologydcIsefficientlayerEnum);
+ 	if(!isefficientlayer) return;
+ 
+-	if(iomodel->meshxdim==Mesh3DEnum){
++	if(iomodel->domaintype==Mesh3DEnum){
+ 		iomodel->FetchData(1,MeshVertexonbaseEnum);
+ 	}
+-	else if(iomodel->meshxdim==Mesh2DverticalEnum){
++	else if(iomodel->domaintype==Mesh2DverticalEnum){
+ 		iomodel->FetchData(1,MeshVertexonbaseEnum);
+ 	}
+ 	::CreateNodes(nodes,iomodel,L2ProjectionEPLAnalysisEnum,P1Enum);
+@@ -82,13 +82,13 @@
+ ElementMatrix* L2ProjectionEPLAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int      meshxdim;
++	int      domaintype;
+ 	bool     active_element;
+ 	Element* basalelement;
+ 
+ 	/*Get basal element*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+@@ -100,7 +100,7 @@
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	Input* active_element_input=basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);
+@@ -108,7 +108,7 @@
+ 
+ 	/* Check that all nodes are active, else return empty matrix */
+ 	if(!active_element){
+-		if(meshxdim!=Mesh2DhorizontalEnum){
++		if(domaintype!=Mesh2DhorizontalEnum){
+ 			basalelement->DeleteMaterials();
+ 			delete basalelement;
+ 		}
+@@ -148,19 +148,19 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+ 	delete gauss;
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return Ke;
+ }/*}}}*/
+ ElementVector* L2ProjectionEPLAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int      meshxdim;
++	int      domaintype;
+ 	bool     active_element;
+ 	Element* basalelement;
+ 
+ 	/*Get basal element*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+@@ -168,7 +168,7 @@
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	Input* active_element_input = basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);
+@@ -176,7 +176,7 @@
+ 
+ 	/*Check that all nodes are active, else return empty matrix*/
+ 	if(!active_element) {
+-		if(meshxdim!=Mesh2DhorizontalEnum){
++		if(domaintype!=Mesh2DhorizontalEnum){
+ 			basalelement->DeleteMaterials();
+ 			delete basalelement;
+ 		}
+@@ -221,18 +221,18 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+ 	delete gauss;
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
+ void L2ProjectionEPLAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+ void L2ProjectionEPLAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+-	int inputenum,meshxdim;
++	int inputenum,domaintype;
+ 
+ 	element->FindParam(&inputenum,InputToL2ProjectEnum);
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			element->InputUpdateFromSolutionOneDof(solution,inputenum);
+ 			break;
+@@ -242,7 +242,7 @@
+ 		case Mesh3DEnum:
+ 			element->InputUpdateFromSolutionOneDofCollapsed(solution,inputenum);
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ }/*}}}*/
+ void L2ProjectionEPLAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17686)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ 
+ /*Model processing*/
+-int  MasstransportAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int  MasstransportAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	return 1;
+ }/*}}}*/
+ void MasstransportAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+@@ -82,14 +82,14 @@
+ 		if(isgroundingline) elements->InputDuplicate(MaskGroundediceLevelsetEnum,QmuMaskGroundediceLevelsetEnum);
+ 	}
+ 
+-	if(iomodel->meshxdim==Mesh3DEnum){
++	if(iomodel->domaintype==Mesh3DEnum){
+ 		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
+ 
+ 	if(islevelset){
+ 		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
+-		if(iomodel->meshxdim!=Mesh2DhorizontalEnum)
++		if(iomodel->domaintype!=Mesh2DhorizontalEnum)
+ 			iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum); // required for updating active nodes
+ 	}
+ 
+@@ -131,10 +131,10 @@
+ 	iomodel->Constant(&stabilization,MasstransportStabilizationEnum);
+ 
+ 	/*Check in 3d*/
+-	if(stabilization==3 && iomodel->meshxdim==Mesh3DEnum) _error_("DG 3d not implemented yet");
++	if(stabilization==3 && iomodel->domaintype==Mesh3DEnum) _error_("DG 3d not implemented yet");
+ 
+ 	/*Create Nodes either DG or CG depending on stabilization*/
+-	if(iomodel->meshxdim!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	if(stabilization!=3){
+ 		::CreateNodes(nodes,iomodel,MasstransportAnalysisEnum,P1Enum);
+ 	}
+@@ -194,7 +194,7 @@
+ 	IssmDouble *vertex_pairing=NULL;
+ 	IssmDouble *nodeonbase=NULL;
+ 	iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,MasstransportVertexPairingEnum);
+-	if(iomodel->meshxdim!=Mesh2DhorizontalEnum) iomodel->FetchData(&nodeonbase,NULL,NULL,MeshVertexonbaseEnum);
++	if(iomodel->domaintype!=Mesh2DhorizontalEnum) iomodel->FetchData(&nodeonbase,NULL,NULL,MeshVertexonbaseEnum);
+ 
+ 	for(int i=0;i<numvertex_pairing;i++){
+ 
+@@ -204,7 +204,7 @@
+ 			_assert_(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+1])-1]);
+ 
+ 			/*Skip if one of the two is not on the bed*/
+-			if(iomodel->meshxdim!=Mesh2DhorizontalEnum){
++			if(iomodel->domaintype!=Mesh2DhorizontalEnum){
+ 				if(!(reCast<bool>(nodeonbase[reCast<int>(vertex_pairing[2*i+0])-1])) || !(reCast<bool>(nodeonbase[reCast<int>(vertex_pairing[2*i+1])-1]))) continue;
+ 			}
+ 
+@@ -258,9 +258,9 @@
+ 			_error_("Element type " << EnumToStringx(element->FiniteElement()) << " not supported yet");
+ 	}
+ 
+-	int meshxdim;
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	int domaintype;
++	element->FindParam(&domaintype,DomainTypeEnum);
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return Ke;
+ }/*}}}*/
+ ElementMatrix* MasstransportAnalysis::CreateKMatrixCG(Element* element){/*{{{*/
+@@ -270,19 +270,19 @@
+ 
+ 	/*Intermediaries */
+ 	int        stabilization;
+-	int        meshxdim,dim;
++	int        domaintype,dim;
+ 	IssmDouble Jdet,D_scalar,dt,h;
+ 	IssmDouble vel,vx,vy,dvxdx,dvydy;
+ 	IssmDouble dvx[2],dvy[2];
+ 	IssmDouble* xyz_list = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum:   dim = 1; break;
+ 		case Mesh2DhorizontalEnum: dim = 2; break;
+ 		case Mesh3DEnum:           dim = 2; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -298,11 +298,11 @@
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+ 	element->FindParam(&dt,TimesteppingTimeStepEnum);
+-	element->FindParam(&meshxdim,MeshXDimEnum);
++	element->FindParam(&domaintype,DomainTypeEnum);
+ 	element->FindParam(&stabilization,MasstransportStabilizationEnum);
+ 	Input* vxaverage_input=NULL;
+ 	Input* vyaverage_input=NULL;
+-	if(meshxdim==Mesh2DhorizontalEnum){
++	if(domaintype==Mesh2DhorizontalEnum){
+ 		vxaverage_input=element->GetInput(VxEnum); _assert_(vxaverage_input);
+ 		vyaverage_input=element->GetInput(VyEnum); _assert_(vyaverage_input);
+ 	}
+@@ -414,7 +414,7 @@
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+ 	/*Intermediaries */
+-	int        meshxdim;
++	int        domaintype;
+ 	IssmDouble Jdet,D_scalar,dt,vx,vy;
+ 	IssmDouble* xyz_list = NULL;
+ 
+@@ -431,10 +431,10 @@
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+ 	element->FindParam(&dt,TimesteppingTimeStepEnum);
+-	element->FindParam(&meshxdim,MeshXDimEnum);
++	element->FindParam(&domaintype,DomainTypeEnum);
+ 	Input* vxaverage_input=NULL;
+ 	Input* vyaverage_input=NULL;
+-	if(meshxdim==Mesh2DhorizontalEnum){
++	if(domaintype==Mesh2DhorizontalEnum){
+ 		vxaverage_input=element->GetInput(VxEnum); _assert_(vxaverage_input);
+ 		vyaverage_input=element->GetInput(VyEnum); _assert_(vyaverage_input);
+ 	}
+@@ -504,9 +504,9 @@
+ 			_error_("Element type " << EnumToStringx(element->FiniteElement()) << " not supported yet");
+ 	}
+ 
+-	int meshxdim;
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	int domaintype;
++	element->FindParam(&domaintype,DomainTypeEnum);
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
+ ElementVector* MasstransportAnalysis::CreatePVectorCG(Element* element){/*{{{*/
+@@ -669,13 +669,13 @@
+ }/*}}}*/
+ void MasstransportAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	int        i,hydroadjustment,meshxdim;
++	int        i,hydroadjustment,domaintype;
+ 	int*       doflist=NULL;
+ 	IssmDouble rho_ice,rho_water,minthickness;
+ 	Element*   basalelement=NULL;
+ 
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	if(meshxdim!=Mesh2DhorizontalEnum){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	if(domaintype!=Mesh2DhorizontalEnum){
+ 		if(!element->IsOnBase()) return;
+ 		basalelement=element->SpawnBasalElement();
+ 	}
+@@ -749,7 +749,7 @@
+ 	xDelete<IssmDouble>(oldsurface);
+ 	xDelete<IssmDouble>(phi);
+ 	xDelete<int>(doflist);
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ }/*}}}*/
+ void MasstransportAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h	(revision 17686)
+@@ -12,7 +12,7 @@
+ 
+ 	public:
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 17686)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ 
+ /*Model processing*/
+-int  SmoothedSurfaceSlopeXAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int  SmoothedSurfaceSlopeXAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	return 1;
+ }/*}}}*/
+ void SmoothedSurfaceSlopeXAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+@@ -25,18 +25,18 @@
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+-	if(iomodel->meshxdim==Mesh3DEnum){
++	if(iomodel->domaintype==Mesh3DEnum){
+ 		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
+-	if(iomodel->meshxdim==Mesh2DverticalEnum){
++	if(iomodel->domaintype==Mesh2DverticalEnum){
+ 		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
+ 	}
+ }/*}}}*/
+ void SmoothedSurfaceSlopeXAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+-	if(iomodel->meshxdim==Mesh3DEnum) iomodel->FetchData(1,MeshVertexonbaseEnum);
++	if(iomodel->domaintype==Mesh3DEnum) iomodel->FetchData(1,MeshVertexonbaseEnum);
+ 	::CreateNodes(nodes,iomodel,SmoothedSurfaceSlopeXAnalysisEnum,P1Enum);
+-	if(iomodel->meshxdim==Mesh3DEnum) iomodel->DeleteData(1,MeshVertexonbaseEnum);
++	if(iomodel->domaintype==Mesh3DEnum) iomodel->DeleteData(1,MeshVertexonbaseEnum);
+ }/*}}}*/
+ void SmoothedSurfaceSlopeXAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ }/*}}}*/
+@@ -104,12 +104,12 @@
+ ElementVector* SmoothedSurfaceSlopeXAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int      meshxdim;
++	int      domaintype;
+ 	Element* basalelement;
+ 
+ 	/*Get basal element*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+@@ -117,7 +117,7 @@
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Intermediaries */
+@@ -168,7 +168,7 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+ 	delete gauss;
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
+ void SmoothedSurfaceSlopeXAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 17686)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ 
+ /*Model processing*/
+-int  SmoothedSurfaceSlopeYAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int  SmoothedSurfaceSlopeYAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	return 1;
+ }/*}}}*/
+ void SmoothedSurfaceSlopeYAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+@@ -25,18 +25,18 @@
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+-	if(iomodel->meshxdim==Mesh3DEnum){
++	if(iomodel->domaintype==Mesh3DEnum){
+ 		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
+-	if(iomodel->meshxdim==Mesh2DverticalEnum){
++	if(iomodel->domaintype==Mesh2DverticalEnum){
+ 		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
+ 	}
+ }/*}}}*/
+ void SmoothedSurfaceSlopeYAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+-	if(iomodel->meshxdim==Mesh3DEnum) iomodel->FetchData(1,MeshVertexonbaseEnum);
++	if(iomodel->domaintype==Mesh3DEnum) iomodel->FetchData(1,MeshVertexonbaseEnum);
+ 	::CreateNodes(nodes,iomodel,SmoothedSurfaceSlopeYAnalysisEnum,P1Enum);
+-	if(iomodel->meshxdim==Mesh3DEnum) iomodel->DeleteData(1,MeshVertexonbaseEnum);
++	if(iomodel->domaintype==Mesh3DEnum) iomodel->DeleteData(1,MeshVertexonbaseEnum);
+ }/*}}}*/
+ void SmoothedSurfaceSlopeYAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ }/*}}}*/
+@@ -104,12 +104,12 @@
+ ElementVector* SmoothedSurfaceSlopeYAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int      meshxdim;
++	int      domaintype;
+ 	Element* basalelement;
+ 
+ 	/*Get basal element*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+@@ -117,7 +117,7 @@
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Intermediaries */
+@@ -168,7 +168,7 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+ 	delete gauss;
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
+ void SmoothedSurfaceSlopeYAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 17686)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ 
+ /*Model processing*/
+-int  ExtrudeFromTopAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int  ExtrudeFromTopAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	return 1;
+ }/*}}}*/
+ void ExtrudeFromTopAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+@@ -21,7 +21,7 @@
+ 		}
+ 	}
+ 
+-	if(iomodel->meshxdim==Mesh2DverticalEnum){
++	if(iomodel->domaintype==Mesh2DverticalEnum){
+ 		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
+ 	}
+ }/*}}}*/
+@@ -63,16 +63,16 @@
+ ElementMatrix* ExtrudeFromTopAnalysis::CreateKMatrixVolume(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries */
+-	int         meshxdim,dim;
++	int         domaintype,dim;
+ 	IssmDouble  Jdet,D;
+ 	IssmDouble *xyz_list = NULL;
+ 
+ 	/*Get dimension*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -119,12 +119,12 @@
+ 	IssmDouble *xyz_list_top = NULL;
+ 
+ 	/*Get dimension*/
+-	int dim,meshxdim;
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	int dim,domaintype;
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -169,12 +169,12 @@
+ 	IssmDouble *xyz_list_base = NULL;
+ 
+ 	/*Get dimension*/
+-	int dim,meshxdim;
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	int dim,domaintype;
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+Index: ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.h	(revision 17686)
+@@ -12,7 +12,7 @@
+ 	
+ public:
+ 	/*Model processing*/
+-	int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++	int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 	void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 	void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 	void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp	(revision 17686)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ 
+ /*Model processing*/
+-int  BalancethicknessSoftAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int  BalancethicknessSoftAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	_error_("not implemented");
+ }/*}}}*/
+ void BalancethicknessSoftAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 17686)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ 
+ /*Model processing*/
+-int  HydrologyShreveAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int  HydrologyShreveAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	return 1;
+ }/*}}}*/
+ void HydrologyShreveAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+@@ -61,7 +61,7 @@
+ 	/*Now, do we really want Shreve?*/
+ 	if(hydrology_model!=HydrologyshreveEnum) return;
+ 
+-	if(iomodel->meshxdim==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,HydrologyShreveAnalysisEnum,P1Enum);
+ 	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.h	(revision 17686)
+@@ -12,7 +12,7 @@
+ 
+   public:
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/DepthAverageAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DepthAverageAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/DepthAverageAnalysis.cpp	(revision 17686)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ 
+ /*Model processing*/
+-int  DepthAverageAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int  DepthAverageAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	return 1;
+ }/*}}}*/
+ void DepthAverageAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+@@ -21,7 +21,7 @@
+ 		}
+ 	}
+ 
+-	if(iomodel->meshxdim==Mesh2DverticalEnum){
++	if(iomodel->domaintype==Mesh2DverticalEnum){
+ 		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
+ 	}
+ }/*}}}*/
+@@ -53,13 +53,13 @@
+ 	IssmDouble *xyz_list = NULL;
+ 
+ 	/*Get dimension*/
+-	int dim,meshxdim;
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	int dim,domaintype;
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+ 		case Mesh3DtetrasEnum:    dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 17686)
+@@ -13,7 +13,7 @@
+ 
+ 	public:
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 17686)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ 
+ /*Model processing*/
+-int  BalancevelocityAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int  BalancevelocityAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	return 1;
+ }/*}}}*/
+ void BalancevelocityAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+@@ -32,7 +32,7 @@
+ 	iomodel->FetchDataToInput(elements,SurfaceforcingsMassBalanceEnum);
+ 	iomodel->FetchDataToInput(elements,BalancethicknessThickeningRateEnum);
+ 
+-	if(iomodel->meshxdim==Mesh3DEnum){
++	if(iomodel->domaintype==Mesh3DEnum){
+ 		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
+@@ -40,7 +40,7 @@
+ void BalancevelocityAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+ 	/*Check in 3d*/
+-	if(iomodel->meshxdim==Mesh3DEnum) _error_("DG 3d not implemented yet");
++	if(iomodel->domaintype==Mesh3DEnum) _error_("DG 3d not implemented yet");
+ 
+ 	/*First fetch data: */
+ 	::CreateNodes(nodes,iomodel,BalancevelocityAnalysisEnum,P1Enum);
+@@ -147,12 +147,12 @@
+ ElementVector* BalancevelocityAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int      meshxdim;
++	int      domaintype;
+ 	Element* basalelement;
+ 
+ 	/*Get basal element*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+@@ -160,7 +160,7 @@
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Intermediaries */
+@@ -234,7 +234,7 @@
+ 	xDelete<IssmDouble>(Nx);
+ 	xDelete<IssmDouble>(Ny);
+ 	delete gauss;
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
+ void BalancevelocityAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+@@ -242,16 +242,16 @@
+ }/*}}}*/
+ void BalancevelocityAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	int meshxdim;
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	int domaintype;
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			element->InputUpdateFromSolutionOneDof(solution,VelEnum);
+ 			break;
+ 		case Mesh3DEnum:
+ 			element->InputUpdateFromSolutionOneDofCollapsed(solution,VelEnum);
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ }/*}}}*/
+ void BalancevelocityAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 17686)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ 
+ /*Model processing*/
+-int  L2ProjectionBaseAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int  L2ProjectionBaseAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	return 1;
+ }/*}}}*/
+ void L2ProjectionBaseAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+@@ -25,20 +25,20 @@
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+-	if(iomodel->meshxdim==Mesh3DEnum){
++	if(iomodel->domaintype==Mesh3DEnum){
+ 		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
+-	if(iomodel->meshxdim==Mesh2DverticalEnum){
++	if(iomodel->domaintype==Mesh2DverticalEnum){
+ 		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
+ 	}
+ }/*}}}*/
+ void L2ProjectionBaseAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+-	if(iomodel->meshxdim==Mesh3DEnum || iomodel->meshxdim==Mesh3DtetrasEnum){
++	if(iomodel->domaintype==Mesh3DEnum || iomodel->domaintype==Mesh3DtetrasEnum){
+ 		iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	}
+-	else if(iomodel->meshxdim==Mesh2DverticalEnum){
++	else if(iomodel->domaintype==Mesh2DverticalEnum){
+ 		iomodel->FetchData(1,MeshVertexonbaseEnum);
+ 	}
+ 	::CreateNodes(nodes,iomodel,L2ProjectionBaseAnalysisEnum,P1Enum);
+@@ -67,12 +67,12 @@
+ ElementMatrix* L2ProjectionBaseAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int      meshxdim;
++	int      domaintype;
+ 	Element* basalelement;
+ 
+ 	/*Get basal element*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+@@ -88,7 +88,7 @@
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Intermediaries */
+@@ -124,18 +124,18 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+ 	delete gauss;
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return Ke;
+ }/*}}}*/
+ ElementVector* L2ProjectionBaseAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int      meshxdim;
++	int      domaintype;
+ 	Element* basalelement;
+ 
+ 	/*Get basal element*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+@@ -151,7 +151,7 @@
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Intermediaries */
+@@ -203,7 +203,7 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+ 	delete gauss;
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
+ void L2ProjectionBaseAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+@@ -211,11 +211,11 @@
+ }/*}}}*/
+ void L2ProjectionBaseAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	int inputenum,meshxdim;
++	int inputenum,domaintype;
+ 
+ 	element->FindParam(&inputenum,InputToL2ProjectEnum);
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			element->InputUpdateFromSolutionOneDof(solution,inputenum);
+ 			break;
+@@ -226,7 +226,7 @@
+ 		case Mesh3DEnum:
+ 			element->InputUpdateFromSolutionOneDofCollapsed(solution,inputenum);
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ }/*}}}*/
+ void L2ProjectionBaseAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17686)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ 
+ /*Model processing*/
+-int  FreeSurfaceTopAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int  FreeSurfaceTopAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	return 1;
+ }/*}}}*/
+ void FreeSurfaceTopAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+@@ -13,7 +13,7 @@
+ void FreeSurfaceTopAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+ 
+ 	/*Now, is the model 3d? otherwise, do nothing: */
+-	if (iomodel->meshxdim==Mesh2DhorizontalEnum)return;
++	if (iomodel->domaintype==Mesh2DhorizontalEnum)return;
+ 
+ 	int smb_model;
+ 	int finiteelement = P1Enum;
+@@ -34,8 +34,8 @@
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,VxEnum);
+-	if(iomodel->meshxdim!=Mesh2DhorizontalEnum) iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+-	if(iomodel->meshxdim==Mesh3DEnum){
++	if(iomodel->domaintype!=Mesh2DhorizontalEnum) iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype==Mesh3DEnum){
+ 		iomodel->FetchDataToInput(elements,VzEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+@@ -51,7 +51,7 @@
+ }/*}}}*/
+ void FreeSurfaceTopAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+-	if(iomodel->meshxdim!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,FreeSurfaceTopAnalysisEnum,P1Enum);
+ 	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+@@ -68,7 +68,7 @@
+ 	IssmDouble *vertex_pairing=NULL;
+ 	IssmDouble *nodeonsurface=NULL;
+ 	iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,MasstransportVertexPairingEnum);
+-	if(iomodel->meshxdim!=Mesh2DhorizontalEnum) iomodel->FetchData(&nodeonsurface,NULL,NULL,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype!=Mesh2DhorizontalEnum) iomodel->FetchData(&nodeonsurface,NULL,NULL,MeshVertexonsurfaceEnum);
+ 	for(int i=0;i<numvertex_pairing;i++){
+ 
+ 		if(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+0])-1]){
+@@ -77,7 +77,7 @@
+ 			_assert_(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+1])-1]);
+ 
+ 			/*Skip if one of the two is not on the bed*/
+-			if(iomodel->meshxdim!=Mesh2DhorizontalEnum){
++			if(iomodel->domaintype!=Mesh2DhorizontalEnum){
+ 				if(!(reCast<bool>(nodeonsurface[reCast<int>(vertex_pairing[2*i+0])-1])) || !(reCast<bool>(nodeonsurface[reCast<int>(vertex_pairing[2*i+1])-1]))) continue;
+ 			}
+ 
+@@ -113,15 +113,15 @@
+ ElementMatrix* FreeSurfaceTopAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int         meshxdim,dim,stabilization;
++	int         domaintype,dim,stabilization;
+ 	Element*    topelement = NULL;
+ 	IssmDouble *xyz_list  = NULL;
+ 	IssmDouble  Jdet,D_scalar,dt,h;
+ 	IssmDouble  vel,vx,vy;
+ 
+ 	/*Get top element*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			topelement = element;
+ 			dim = 2;
+@@ -136,7 +136,7 @@
+ 			topelement = element->SpawnTopElement();
+ 			dim = 2;
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -231,20 +231,20 @@
+ 	xDelete<IssmDouble>(Bprime);
+ 	xDelete<IssmDouble>(D);
+ 	delete gauss;
+-	if(meshxdim!=Mesh2DhorizontalEnum){topelement->DeleteMaterials(); delete topelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){topelement->DeleteMaterials(); delete topelement;};
+ 	return Ke;
+ }/*}}}*/
+ ElementVector* FreeSurfaceTopAnalysis::CreatePVector(Element* element){/*{{{*/
+ 	/*Intermediaries*/
+-	int         meshxdim,dim;
++	int         domaintype,dim;
+ 	IssmDouble  Jdet,dt;
+ 	IssmDouble  ms,surface,vz;
+ 	Element*    topelement = NULL;
+ 	IssmDouble *xyz_list  = NULL;
+ 
+ 	/*Get top element*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			topelement = element;
+ 			dim = 2;
+@@ -259,7 +259,7 @@
+ 			topelement = element->SpawnTopElement();
+ 			dim = 2;
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -301,7 +301,7 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+ 	delete gauss;
+-	if(meshxdim!=Mesh2DhorizontalEnum){topelement->DeleteMaterials(); delete topelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){topelement->DeleteMaterials(); delete topelement;};
+ 	return pe;
+ 
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h	(revision 17686)
+@@ -12,7 +12,7 @@
+ 
+ 	public:
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp	(revision 17686)
+@@ -9,7 +9,7 @@
+ #include "../modules/GetVectorFromInputsx/GetVectorFromInputsx.h"
+ 
+ /*Model processing*/
+-int  LsfReinitializationAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int  LsfReinitializationAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	return 1;
+ }/*}}}*/
+ void LsfReinitializationAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+@@ -35,7 +35,7 @@
+ }/*}}}*/
+ void LsfReinitializationAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 	int finiteelement=P1Enum;
+-	if(iomodel->meshxdim!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,LsfReinitializationAnalysisEnum,finiteelement);
+ 	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+@@ -251,17 +251,17 @@
+ void LsfReinitializationAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 
+ 	IssmDouble   lsf;
+-	int          meshxdim,dim,dofpernode;
++	int          domaintype,dim,dofpernode;
+ 	int*         doflist = NULL;
+ 
+ 	/*Get some parameters*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum: dim = 2; dofpernode = 1; break;
+ 		case Mesh2DverticalEnum:   dim = 2; dofpernode = 1; break;
+ 		case Mesh3DEnum:           dim = 3; dofpernode = 1; break;
+ 		case Mesh3DtetrasEnum:     dim = 3; dofpernode = 1; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -293,16 +293,16 @@
+ }/*}}}*/
+ void LsfReinitializationAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	int meshxdim;
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	int domaintype;
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			element->InputUpdateFromSolutionOneDof(solution,MaskIceLevelsetEnum);
+ 			break;
+ 		case Mesh3DEnum:
+ 			element->InputUpdateFromSolutionOneDofCollapsed(solution,MaskIceLevelsetEnum);
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ }/*}}}*/
+ void LsfReinitializationAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/Analysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/Analysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/Analysis.h	(revision 17686)
+@@ -24,7 +24,7 @@
+ 		virtual      ~Analysis(){};
+ 
+ 		/*Model processing*/
+-		virtual int  DofsPerNode(int** doflist,int meshxdim,int approximation)=0;
++		virtual int  DofsPerNode(int** doflist,int domaintype,int approximation)=0;
+ 		virtual void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum)=0;
+ 		virtual void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type)=0;
+ 		virtual void CreateNodes(Nodes* nodes,IoModel* iomodel)=0;
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.h	(revision 17686)
+@@ -12,7 +12,7 @@
+ 
+ 	public:
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 17686)
+@@ -6,7 +6,7 @@
+ #include "../solutionsequences/solutionsequences.h"
+ 
+ /*Model processing*/
+-int  StressbalanceSIAAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int  StressbalanceSIAAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	return 2;
+ }/*}}}*/
+ void StressbalanceSIAAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+@@ -41,7 +41,7 @@
+ 	iomodel->FetchDataToInput(elements,FrictionCoefficientEnum);
+ 	if(islevelset){
+ 		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
+-		if(iomodel->meshxdim!=Mesh2DhorizontalEnum)
++		if(iomodel->domaintype!=Mesh2DhorizontalEnum)
+ 			iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum); // required for updating active nodes
+ 	}
+ 
+@@ -63,7 +63,7 @@
+ 	/*First create nodes*/
+ 	int    lid=0;
+ 	iomodel->FetchData(4,FlowequationBorderSSAEnum,FlowequationBorderFSEnum,FlowequationVertexEquationEnum,StressbalanceReferentialEnum);
+-	if(iomodel->meshxdim!=Mesh2DhorizontalEnum){
++	if(iomodel->domaintype!=Mesh2DhorizontalEnum){
+ 		iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	}
+ 
+@@ -162,14 +162,14 @@
+ 	/* Check if ice in element */
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+-	int meshxdim;
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	int domaintype;
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			return CreateKMatrix2D(element);
+ 		case Mesh3DEnum:
+ 			return CreateKMatrix3D(element);
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ }/*}}}*/
+ ElementMatrix* StressbalanceSIAAnalysis::CreateKMatrix2D(Element* element){/*{{{*/
+@@ -265,14 +265,14 @@
+ 	/* Check if ice in element */
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+-	int meshxdim;
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	int domaintype;
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			return CreatePVector2D(element);
+ 		case Mesh3DEnum:
+ 			return CreatePVector3D(element);
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ }/*}}}*/
+ ElementVector* StressbalanceSIAAnalysis::CreatePVector2D(Element* element){/*{{{*/
+@@ -494,7 +494,7 @@
+ }/*}}}*/
+ void StressbalanceSIAAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	int         i,meshxdim;
++	int         i,domaintype;
+ 	IssmDouble  rho_ice,g;
+ 	int*        doflist=NULL;
+ 	IssmDouble* xyz_list=NULL;
+@@ -538,8 +538,8 @@
+ 	 *so the pressure is just the pressure at the bedrock: */
+ 	rho_ice  = element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 	g        = element->GetMaterialParameter(ConstantsGEnum);
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			element->GetInputListOnNodes(&thickness[0],ThicknessEnum);
+ 			for(i=0;i<numnodes;i++) pressure[i]=rho_ice*g*thickness[i];
+@@ -549,7 +549,7 @@
+ 			element->GetInputListOnNodes(&surface[0],SurfaceEnum);
+ 			for(i=0;i<numnodes;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Now, we have to move the previous Vx and Vy inputs  to old 
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h	(revision 17686)
+@@ -12,7 +12,7 @@
+ 
+ 	public:
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17686)
+@@ -9,7 +9,7 @@
+ //#define FSANALYTICAL 21
+ 
+ /*Model processing*/
+-int  StressbalanceAnalysis::DofsPerNode(int** pdoftype,int meshxdim,int approximation){/*{{{*/
++int  StressbalanceAnalysis::DofsPerNode(int** pdoftype,int domaintype,int approximation){/*{{{*/
+ 
+ 	/*output*/
+ 	int *doftype = NULL;
+@@ -17,7 +17,7 @@
+ 
+ 	switch(approximation){
+ 		case SSAApproximationEnum:
+-			 switch(meshxdim){
++			 switch(domaintype){
+ 				 case Mesh3DEnum:           numdofs=2; break;
+ 				 case Mesh3DtetrasEnum:     numdofs=2; break;
+ 				 case Mesh2DhorizontalEnum: numdofs=2; break;
+@@ -27,7 +27,7 @@
+ 			 break;
+ 		case L1L2ApproximationEnum: numdofs =2; break;
+ 		case HOApproximationEnum:   
+-			 switch(meshxdim){
++			 switch(domaintype){
+ 				 case Mesh3DEnum:         numdofs=2; break;
+ 				 case Mesh3DtetrasEnum:   numdofs=2; break;
+ 				 case Mesh2DverticalEnum: numdofs=1; break;
+@@ -36,7 +36,7 @@
+ 			 break;
+ 		case SIAApproximationEnum:  numdofs =2; break;
+ 		case FSvelocityEnum:
+-			 switch(meshxdim){
++			 switch(domaintype){
+ 				 case Mesh3DEnum:         numdofs=3; break;
+ 				 case Mesh3DtetrasEnum:   numdofs=3; break;
+ 				 case Mesh2DverticalEnum: numdofs=2; break;
+@@ -45,7 +45,7 @@
+ 			break;
+ 		case FSpressureEnum: numdofs=1; break;
+ 		case NoneApproximationEnum:
+-			 switch(meshxdim){
++			 switch(domaintype){
+ 				 case Mesh3DEnum:         numdofs=4; break;
+ 				 case Mesh3DtetrasEnum:   numdofs=4; break;
+ 				 case Mesh2DverticalEnum: numdofs=3; break;
+@@ -217,7 +217,7 @@
+ 	iomodel->FetchDataToInput(elements,LoadingforceYEnum);
+ 	iomodel->FetchDataToInput(elements,DamageDEnum);
+ 
+-	if(iomodel->meshxdim==Mesh3DEnum){
++	if(iomodel->domaintype==Mesh3DEnum){
+ 		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 		iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
+@@ -226,7 +226,7 @@
+ 		iomodel->FetchDataToInput(elements,VzEnum,0.);
+ 		if(dakota_analysis)elements->InputDuplicate(VzEnum,QmuVzEnum);
+ 	}
+-	if(iomodel->meshxdim==Mesh3DtetrasEnum){
++	if(iomodel->domaintype==Mesh3DtetrasEnum){
+ 		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+ 		iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
+@@ -234,7 +234,7 @@
+ 		iomodel->FetchDataToInput(elements,VzEnum,0.);
+ 		if(dakota_analysis)elements->InputDuplicate(VzEnum,QmuVzEnum);
+ 	}
+-	if(iomodel->meshxdim==Mesh2DverticalEnum){
++	if(iomodel->domaintype==Mesh2DverticalEnum){
+ 		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+ 	}
+ 	if(isFS){
+@@ -244,7 +244,7 @@
+ 	}
+ 	if(islevelset){
+ 		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
+-		if(iomodel->meshxdim!=Mesh2DhorizontalEnum)
++		if(iomodel->domaintype!=Mesh2DhorizontalEnum)
+ 			iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum); // required for updating active nodes
+ 	}
+ 
+@@ -298,7 +298,7 @@
+ 			iomodel->Constant(&finiteelement,FlowequationFeFSEnum);
+ 		}
+ 		iomodel->FetchData(3,FlowequationBorderSSAEnum,FlowequationVertexEquationEnum,StressbalanceReferentialEnum);
+-		if(iomodel->meshxdim!=Mesh2DhorizontalEnum) iomodel->FetchData(3,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum,FlowequationBorderFSEnum);
++		if(iomodel->domaintype!=Mesh2DhorizontalEnum) iomodel->FetchData(3,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum,FlowequationBorderFSEnum);
+ 		::CreateNodes(nodes,iomodel,StressbalanceAnalysisEnum,finiteelement,approximation);
+ 		iomodel->DeleteData(6,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum,FlowequationBorderSSAEnum,FlowequationBorderFSEnum,
+ 					FlowequationVertexEquationEnum,StressbalanceReferentialEnum);
+@@ -430,22 +430,22 @@
+ 			iomodel->FetchData(&nodeonFS,NULL,NULL,FlowequationBorderFSEnum);
+ 			iomodel->FetchData(&nodeonbase,NULL,NULL,MeshVertexonbaseEnum);
+ 			iomodel->FetchData(&groundedice_ls,NULL,NULL,MaskGroundediceLevelsetEnum);
+-			if(iomodel->meshxdim==Mesh3DEnum || iomodel->meshxdim==Mesh3DtetrasEnum){
++			if(iomodel->domaintype==Mesh3DEnum || iomodel->domaintype==Mesh3DtetrasEnum){
+ 				iomodel->FetchData(&spcvz,&Mz,&Nz,StressbalanceSpcvzEnum);
+ 			}
+-			else if (iomodel->meshxdim==Mesh2DverticalEnum){
++			else if (iomodel->domaintype==Mesh2DverticalEnum){
+ 				iomodel->FetchData(&spcvz,&Mz,&Nz,StressbalanceSpcvyEnum);
+ 			}
+ 			else{
+ 				_error_("not supported yet");
+ 			}
+-			if(iomodel->meshxdim==Mesh3DEnum || iomodel->meshxdim==Mesh3DtetrasEnum){
++			if(iomodel->domaintype==Mesh3DEnum || iomodel->domaintype==Mesh3DtetrasEnum){
+ 				IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvxEnum,StressbalanceAnalysisEnum,finiteelement,0);
+ 				IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvyEnum,StressbalanceAnalysisEnum,finiteelement,1);
+ 				IoModelToConstraintsx(constraints,iomodel,spcvz,Mz,Nz,StressbalanceAnalysisEnum,finiteelement,2);
+ 				iomodel->DeleteData(spcvz,StressbalanceSpcvzEnum);
+ 			}
+-			else if (iomodel->meshxdim==Mesh2DverticalEnum){
++			else if (iomodel->domaintype==Mesh2DverticalEnum){
+ 				IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvxEnum,StressbalanceAnalysisEnum,finiteelement,0);
+ 				IoModelToConstraintsx(constraints,iomodel,spcvz,Mz,Nz,StressbalanceAnalysisEnum,finiteelement,1);
+ 				iomodel->DeleteData(spcvz,StressbalanceSpcvyEnum);
+@@ -506,7 +506,7 @@
+ 		}
+ 		else{
+ 			IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvxEnum,StressbalanceAnalysisEnum,finiteelement,0);
+-			if(iomodel->meshxdim!=Mesh2DverticalEnum){
++			if(iomodel->domaintype!=Mesh2DverticalEnum){
+ 				IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvyEnum,StressbalanceAnalysisEnum,finiteelement,1);
+ 			}
+ 		}
+@@ -519,10 +519,10 @@
+ 	iomodel->FetchData(&spcvy,&My,&Ny,StressbalanceSpcvyEnum);
+ 	iomodel->FetchData(&spcvz,&Mz,&Nz,StressbalanceSpcvzEnum);
+ 	iomodel->FetchData(&nodeonSSA,NULL,NULL,FlowequationBorderSSAEnum);
+-	if(iomodel->meshxdim==Mesh3DEnum || iomodel->meshxdim==Mesh3DtetrasEnum)iomodel->FetchData(&nodeonHO,NULL,NULL,FlowequationBorderHOEnum);
+-	if(iomodel->meshxdim==Mesh3DEnum || iomodel->meshxdim==Mesh3DtetrasEnum)iomodel->FetchData(&nodeonFS,NULL,NULL,FlowequationBorderFSEnum);
+-	if(iomodel->meshxdim==Mesh3DEnum || iomodel->meshxdim==Mesh3DtetrasEnum)iomodel->FetchData(&nodeonbase,NULL,NULL,MeshVertexonbaseEnum);
+-	if(iomodel->meshxdim==Mesh3DEnum || iomodel->meshxdim==Mesh3DtetrasEnum)iomodel->FetchData(&groundedice_ls,NULL,NULL,MaskGroundediceLevelsetEnum);
++	if(iomodel->domaintype==Mesh3DEnum || iomodel->domaintype==Mesh3DtetrasEnum)iomodel->FetchData(&nodeonHO,NULL,NULL,FlowequationBorderHOEnum);
++	if(iomodel->domaintype==Mesh3DEnum || iomodel->domaintype==Mesh3DtetrasEnum)iomodel->FetchData(&nodeonFS,NULL,NULL,FlowequationBorderFSEnum);
++	if(iomodel->domaintype==Mesh3DEnum || iomodel->domaintype==Mesh3DtetrasEnum)iomodel->FetchData(&nodeonbase,NULL,NULL,MeshVertexonbaseEnum);
++	if(iomodel->domaintype==Mesh3DEnum || iomodel->domaintype==Mesh3DtetrasEnum)iomodel->FetchData(&groundedice_ls,NULL,NULL,MaskGroundediceLevelsetEnum);
+ 	iomodel->FetchData(&vertices_type,NULL,NULL,FlowequationVertexEquationEnum);
+ 	iomodel->FetchData(&surface,NULL,NULL,SurfaceEnum);
+ 	iomodel->FetchData(&z,NULL,NULL,MeshZEnum);
+@@ -749,10 +749,10 @@
+ 	iomodel->DeleteData(spcvy,StressbalanceSpcvyEnum);
+ 	iomodel->DeleteData(spcvz,StressbalanceSpcvzEnum);
+ 	iomodel->DeleteData(nodeonSSA,FlowequationBorderSSAEnum);
+-	if(iomodel->meshxdim==Mesh3DEnum || iomodel->meshxdim==Mesh3DtetrasEnum)iomodel->DeleteData(nodeonHO,FlowequationBorderHOEnum);
+-	if(iomodel->meshxdim==Mesh3DEnum || iomodel->meshxdim==Mesh3DtetrasEnum)iomodel->DeleteData(nodeonFS,FlowequationBorderFSEnum);
+-	if(iomodel->meshxdim==Mesh3DEnum || iomodel->meshxdim==Mesh3DtetrasEnum)iomodel->DeleteData(nodeonbase,MeshVertexonbaseEnum);
+-	if(iomodel->meshxdim==Mesh3DEnum || iomodel->meshxdim==Mesh3DtetrasEnum)iomodel->DeleteData(groundedice_ls,MaskGroundediceLevelsetEnum);
++	if(iomodel->domaintype==Mesh3DEnum || iomodel->domaintype==Mesh3DtetrasEnum)iomodel->DeleteData(nodeonHO,FlowequationBorderHOEnum);
++	if(iomodel->domaintype==Mesh3DEnum || iomodel->domaintype==Mesh3DtetrasEnum)iomodel->DeleteData(nodeonFS,FlowequationBorderFSEnum);
++	if(iomodel->domaintype==Mesh3DEnum || iomodel->domaintype==Mesh3DtetrasEnum)iomodel->DeleteData(nodeonbase,MeshVertexonbaseEnum);
++	if(iomodel->domaintype==Mesh3DEnum || iomodel->domaintype==Mesh3DtetrasEnum)iomodel->DeleteData(groundedice_ls,MaskGroundediceLevelsetEnum);
+ 	iomodel->DeleteData(vertices_type,FlowequationVertexEquationEnum);
+ 	iomodel->DeleteData(surface,SurfaceEnum);
+ 	iomodel->DeleteData(z,MeshZEnum);
+@@ -834,7 +834,7 @@
+ 	/*Intermediaries*/
+ 	bool isSSA,isL1L2,isHO,isFS;
+ 	bool conserve_loads = true;
+-	int  newton,meshxdim,fe_FS;
++	int  newton,domaintype,fe_FS;
+ 
+ 	/* recover parameters:*/
+ 	femmodel->parameters->FindParam(&isSSA,FlowequationIsSSAEnum);
+@@ -842,7 +842,7 @@
+ 	femmodel->parameters->FindParam(&isHO,FlowequationIsHOEnum);
+ 	femmodel->parameters->FindParam(&isFS,FlowequationIsFSEnum);
+ 	femmodel->parameters->FindParam(&fe_FS,FlowequationFeFSEnum);
+-	femmodel->parameters->FindParam(&meshxdim,MeshXDimEnum);
++	femmodel->parameters->FindParam(&domaintype,DomainTypeEnum);
+ 	femmodel->parameters->FindParam(&newton,StressbalanceIsnewtonEnum);
+ 
+ 	if(isFS && !(isSSA || isHO || isL1L2)){
+@@ -865,7 +865,7 @@
+ 		else
+ 		 solutionsequence_nonlinear(femmodel,conserve_loads); 
+ 
+-		if(meshxdim==Mesh2DverticalEnum && isSSA){
++		if(domaintype==Mesh2DverticalEnum && isSSA){
+ 			femmodel->parameters->SetParam(VxEnum,InputToExtrudeEnum);
+ 			extrudefrombase_core(femmodel);
+ 			femmodel->parameters->SetParam(VelEnum,InputToExtrudeEnum);
+@@ -988,17 +988,17 @@
+ void StressbalanceAnalysis::GetSolutionFromInputsHoriz(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 
+ 	IssmDouble   vx,vy;
+-	int          meshxdim,dim,approximation,dofpernode;
++	int          domaintype,dim,approximation,dofpernode;
+ 	int*         doflist = NULL;
+ 
+ 	/*Get some parameters*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum: dim = 2; dofpernode = 2; break;
+ 		case Mesh2DverticalEnum:   dim = 2; dofpernode = 1; break;
+ 		case Mesh3DEnum:           dim = 3; dofpernode = 2; break;
+ 		case Mesh3DtetrasEnum:     dim = 3; dofpernode = 2; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -1013,7 +1013,7 @@
+ 	/*Get inputs*/
+ 	Input* vx_input=element->GetInput(VxEnum); _assert_(vx_input);
+ 	Input* vy_input=NULL;
+-	if(meshxdim!=Mesh2DverticalEnum){vy_input=element->GetInput(VyEnum); _assert_(vy_input);}
++	if(domaintype!=Mesh2DverticalEnum){vy_input=element->GetInput(VyEnum); _assert_(vy_input);}
+ 
+ 	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+ 	Gauss* gauss=element->NewGauss();
+@@ -1082,12 +1082,12 @@
+ ElementMatrix* StressbalanceAnalysis::CreateJacobianMatrixSSA(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int      meshxdim;
++	int      domaintype;
+ 	Element* basalelement;
+ 
+ 	/*Get basal element*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+@@ -1095,7 +1095,7 @@
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Intermediaries */
+@@ -1158,7 +1158,7 @@
+ 	xDelete<IssmDouble>(dbasis);
+ 
+ 	/*clean-up and return*/
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return Ke;
+ 
+ }/*}}}*/
+@@ -1168,12 +1168,12 @@
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+ 	/*Intermediaries*/
+-	int      meshxdim;
++	int      domaintype;
+ 	Element* basalelement;
+ 
+ 	/*Get basal element*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+@@ -1181,7 +1181,7 @@
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*compute all stiffness matrices for this element*/
+@@ -1190,7 +1190,7 @@
+ 	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
+ 
+ 	/*clean-up and return*/
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	delete Ke1;
+ 	delete Ke2;
+ 	return Ke;
+@@ -1201,7 +1201,7 @@
+ 	if(element->IsFloating() || !element->IsIceInElement()) return NULL;
+ 
+ 	/*Intermediaries*/
+-	int         dim,meshxdim;
++	int         dim,domaintype;
+ 	bool        mainlyfloating;
+ 	int         migration_style,point1;
+ 	IssmDouble  alpha2,Jdet,fraction1,fraction2;
+@@ -1210,13 +1210,13 @@
+ 	Gauss*      gauss     = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum:   dim = 1;break;
+ 		case Mesh2DhorizontalEnum: dim = 2;break;
+ 		case Mesh3DEnum:           dim = 2;break;
+ 		case Mesh3DtetrasEnum:     dim = 2;break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -1289,20 +1289,20 @@
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+ 	/*Intermediaries*/
+-	int         dim,meshxdim,bsize;
++	int         dim,domaintype,bsize;
+ 	IssmDouble  viscosity,newviscosity,oldviscosity;
+ 	IssmDouble  viscosity_overshoot,thickness,Jdet;
+ 	IssmDouble  D_scalar;
+ 	IssmDouble *xyz_list = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum:   dim = 1; bsize = 1; break;
+ 		case Mesh2DhorizontalEnum: dim = 2; bsize = 3; break;
+ 		case Mesh3DEnum:           dim = 2; bsize = 3; break;
+ 		case Mesh3DtetrasEnum:     dim = 2; bsize = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -1371,12 +1371,12 @@
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+ 	/*Intermediaries*/
+-	int      meshxdim;
++	int      domaintype;
+ 	Element* basalelement;
+ 
+ 	/*Get basal element*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+@@ -1384,7 +1384,7 @@
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*compute all load vectors for this element*/
+@@ -1393,7 +1393,7 @@
+ 	ElementVector* pe =new ElementVector(pe1,pe2);
+ 
+ 	/*clean-up and return*/
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	delete pe1;
+ 	delete pe2;
+ 	return pe;
+@@ -1404,18 +1404,18 @@
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+ 	/*Intermediaries */
+-	int         dim,meshxdim;
++	int         dim,domaintype;
+ 	IssmDouble  thickness,Jdet,slope[2];
+ 	IssmDouble* xyz_list = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum:   dim = 1;break;
+ 		case Mesh2DhorizontalEnum: dim = 2;break;
+ 		case Mesh3DEnum:           dim = 2;break;
+ 		case Mesh3DtetrasEnum:     dim = 2;break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -1467,7 +1467,7 @@
+ 	if(!element->IsIcefront()) return NULL;
+ 
+ 	/*Intermediaries*/
+-	int         dim,meshxdim;
++	int         dim,domaintype;
+ 	IssmDouble  Jdet,thickness,bed,water_pressure,ice_pressure;
+ 	IssmDouble  surface_under_water,base_under_water,pressure;
+ 	IssmDouble *xyz_list = NULL;
+@@ -1475,13 +1475,13 @@
+ 	IssmDouble  normal[2];
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum:   dim = 1;break;
+ 		case Mesh2DhorizontalEnum: dim = 2;break;
+ 		case Mesh3DEnum:           dim = 2;break;
+ 		case Mesh3DtetrasEnum:     dim = 2;break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes for this finite element*/
+@@ -1653,7 +1653,7 @@
+ }/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionSSA(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	int         i,dim,meshxdim;
++	int         i,dim,domaintype;
+ 	IssmDouble  rho_ice,g;
+ 	int*        doflist=NULL;
+ 	IssmDouble* xyz_list=NULL;
+@@ -1665,10 +1665,10 @@
+ 	IssmDouble* thickness = xNew<IssmDouble>(numvertices);
+ 	IssmDouble* surface   = xNew<IssmDouble>(numvertices);
+ 
+-	element->FindParam(&meshxdim,MeshXDimEnum);
++	element->FindParam(&domaintype,DomainTypeEnum);
+ 	rho_ice =element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 	g       =element->GetMaterialParameter(ConstantsGEnum);
+-	switch(meshxdim){
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			element->GetInputListOnVertices(thickness,ThicknessEnum);
+ 			for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*thickness[i];
+@@ -1686,7 +1686,7 @@
+ 			for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
+ 			dim=1;
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 	element->AddInput(PressureEnum,pressure,P1Enum);
+ 	xDelete<IssmDouble>(pressure);
+@@ -1694,7 +1694,7 @@
+ 	xDelete<IssmDouble>(surface);
+ 
+ 	/*Get basal element*/
+-	switch(meshxdim){
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+@@ -1702,7 +1702,7 @@
+ 			if(!element->IsOnBase()){xDelete<IssmDouble>(xyz_list); return;}
+ 			basalelement=element->SpawnBasalElement();
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -1762,7 +1762,7 @@
+ 	xDelete<IssmDouble>(values);
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<int>(doflist);
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ }/*}}}*/
+ 
+ /*L1L2*/
+@@ -1851,12 +1851,12 @@
+ ElementVector* StressbalanceAnalysis::CreatePVectorL1L2(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int      meshxdim;
++	int      domaintype;
+ 	Element* basalelement;
+ 
+ 	/*Get basal element*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+@@ -1864,7 +1864,7 @@
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*compute all load vectors for this element*/
+@@ -1873,7 +1873,7 @@
+ 	ElementVector* pe =new ElementVector(pe1,pe2);
+ 
+ 	/*clean-up and return*/
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	delete pe1;
+ 	delete pe2;
+ 	return pe;
+@@ -1987,7 +1987,7 @@
+ }/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionL1L2(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	int         i,meshxdim;
++	int         i,domaintype;
+ 	IssmDouble  rho_ice,g;
+ 	int*        doflist=NULL;
+ 	IssmDouble* xyz_list=NULL;
+@@ -1999,10 +1999,10 @@
+ 	IssmDouble* thickness = xNew<IssmDouble>(numvertices);
+ 	IssmDouble* surface   = xNew<IssmDouble>(numvertices);
+ 
+-	element->FindParam(&meshxdim,MeshXDimEnum);
++	element->FindParam(&domaintype,DomainTypeEnum);
+ 	rho_ice =element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 	g       =element->GetMaterialParameter(ConstantsGEnum);
+-	switch(meshxdim){
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			element->GetInputListOnVertices(thickness,ThicknessEnum);
+ 			for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*thickness[i];
+@@ -2012,7 +2012,7 @@
+ 			element->GetInputListOnVertices(surface,SurfaceEnum);
+ 			for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 	element->AddInput(PressureEnum,pressure,P1Enum);
+ 	xDelete<IssmDouble>(pressure);
+@@ -2020,7 +2020,7 @@
+ 	xDelete<IssmDouble>(surface);
+ 
+ 	/*Get basal element*/
+-	switch(meshxdim){
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+@@ -2028,7 +2028,7 @@
+ 			if(!element->IsOnBase()){xDelete<IssmDouble>(xyz_list); return;}
+ 			basalelement=element->SpawnBasalElement();
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -2048,7 +2048,7 @@
+ 
+ 	/*Transform solution in Cartesian Space*/
+ 	basalelement->TransformSolutionCoord(&values[0],XYEnum);
+-	basalelement->FindParam(&meshxdim,MeshXDimEnum);
++	basalelement->FindParam(&domaintype,DomainTypeEnum);
+ 
+ 	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+ 	for(i=0;i<numnodes;i++){
+@@ -2082,7 +2082,7 @@
+ 	xDelete<IssmDouble>(values);
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<int>(doflist);
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ }/*}}}*/
+ 
+ /*HO*/
+@@ -2168,19 +2168,19 @@
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+ 	/*Intermediaries*/
+-	int         dim,meshxdim,bsize;
++	int         dim,domaintype,bsize;
+ 	IssmDouble  viscosity,newviscosity,oldviscosity;
+ 	IssmDouble  viscosity_overshoot,thickness,Jdet;
+ 	IssmDouble  D_scalar;
+ 	IssmDouble *xyz_list = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; bsize = 2; break;
+ 		case Mesh3DEnum:         dim = 3; bsize = 5; break;
+ 		case Mesh3DtetrasEnum:   dim = 3; bsize = 5; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -2246,7 +2246,7 @@
+ 	if(element->IsFloating() || !element->IsOnBase()) return NULL;
+ 
+ 	/*Intermediaries*/
+-	int         dim,meshxdim;
++	int         dim,domaintype;
+ 	bool        mainlyfloating;
+ 	int         migration_style,point1;
+ 	IssmDouble  alpha2,Jdet,fraction1,fraction2;
+@@ -2255,12 +2255,12 @@
+ 	Gauss*      gauss         = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+ 		case Mesh3DtetrasEnum:   dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -2335,18 +2335,18 @@
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+ 	/*Intermediaries */
+-	int         dim,meshxdim;
++	int         dim,domaintype;
+ 	IssmDouble  x_coord,y_coord,z_coord;
+ 	IssmDouble  Jdet,forcex,forcey,forcez;
+ 	IssmDouble* xyz_list = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+ 		case Mesh3DtetrasEnum:   dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -2413,17 +2413,17 @@
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+ 	/*Intermediaries */
+-	int         dim,meshxdim;
++	int         dim,domaintype;
+ 	IssmDouble  Jdet,slope[3];
+ 	IssmDouble* xyz_list = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+ 		case Mesh3DtetrasEnum:   dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -2471,7 +2471,7 @@
+ 	if(!element->IsIcefront()) return NULL;
+ 
+ 	/*Intermediaries*/
+-	int         dim,meshxdim;
++	int         dim,domaintype;
+ 	IssmDouble  Jdet,surface,z,water_pressure,ice_pressure;
+ 	IssmDouble  surface_under_water,base_under_water,pressure;
+ 	IssmDouble* xyz_list       = NULL;
+@@ -2480,12 +2480,12 @@
+ 	Gauss*      gauss = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+ 		case Mesh3DtetrasEnum:   dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -2674,17 +2674,17 @@
+ }/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionHO(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	int         i,dim,meshxdim;
++	int         i,dim,domaintype;
+ 	int*        doflist=NULL;
+ 	IssmDouble* xyz_list=NULL;
+ 
+ 	/*Get mesh dimension*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+ 		case Mesh3DtetrasEnum:   dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Deal with pressure first*/
+@@ -2764,15 +2764,15 @@
+ /*FS*/
+ ElementVector* StressbalanceAnalysis::CreateDVectorFS(Element* element){/*{{{*/
+ 
+-	int         meshxdim,dim;
++	int         domaintype,dim;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+ 		case Mesh3DtetrasEnum:   dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -2903,18 +2903,18 @@
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixFSViscousXTH(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int         i,meshxdim,dim,epssize;
++	int         i,domaintype,dim,epssize;
+ 	IssmDouble  r,FSreconditioning,Jdet;
+ 	IssmDouble *xyz_list = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
++	element->FindParam(&domaintype,DomainTypeEnum);
+ 	element->FindParam(&r,AugmentedLagrangianREnum);
+-	switch(meshxdim){
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; epssize = 3; break;
+ 		case Mesh3DEnum:         dim = 3; epssize = 6; break;
+ 		case Mesh3DtetrasEnum:   dim = 3; epssize = 6; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -2976,17 +2976,17 @@
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixFSViscous(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int         i,meshxdim,dim,epssize;
++	int         i,domaintype,dim,epssize;
+ 	IssmDouble  viscosity,FSreconditioning,Jdet;
+ 	IssmDouble *xyz_list = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; epssize = 3; break;
+ 		case Mesh3DEnum:         dim = 3; epssize = 6; break;
+ 		case Mesh3DtetrasEnum:   dim = 3; epssize = 6; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -3059,7 +3059,7 @@
+ 
+ 	/*Intermediaries*/
+ 	bool        mainlyfloating;
+-	int         j,i,meshxdim,dim;
++	int         j,i,domaintype,dim;
+ 	IssmDouble  Jdet,slope2,scalar,dt;
+ 	IssmDouble  slope[3];
+ 	IssmDouble *xyz_list_base = NULL;
+@@ -3067,12 +3067,12 @@
+ 	Gauss*      gauss         = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2;break;
+ 		case Mesh3DEnum:         dim = 3;break;
+ 		case Mesh3DtetrasEnum:   dim = 3;break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -3131,19 +3131,19 @@
+ 	if(approximation!=FSApproximationEnum && approximation!=SSAFSApproximationEnum && approximation!=HOFSApproximationEnum) return NULL;
+ 
+ 	/*Intermediaries*/
+-	int         i,meshxdim,dim;
++	int         i,domaintype,dim;
+ 	IssmDouble  alpha2,Jdet;
+ 	IssmDouble  x_coord,y_coord,z_coord;
+ 	IssmDouble *xyz_list_base = NULL;
+ 	Gauss*      gauss         = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2;break;
+ 		case Mesh3DEnum:         dim = 3;break;
+ 		case Mesh3DtetrasEnum:   dim = 3;break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -3196,18 +3196,18 @@
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorFS(Element* element){/*{{{*/
+ 
+-	int         i,meshxdim,dim,fe_FS;
++	int         i,domaintype,dim,fe_FS;
+ 	IssmDouble  x_coord,y_coord,z_coord;
+ 	IssmDouble  Jdet,forcex,forcey,forcez;
+ 	IssmDouble *xyz_list = NULL;
+ 
+ 	element->FindParam(&fe_FS,FlowequationFeFSEnum);
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+ 		case Mesh3DtetrasEnum:   dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -3280,7 +3280,7 @@
+ 
+ 	/*Intermediaries*/
+ 	bool        mainlyfloating;
+-	int         i,meshxdim,dim,epssize;
++	int         i,domaintype,dim,epssize;
+ 	int         migration_style,point1;
+ 	IssmDouble  alpha2,Jdet,fraction1,fraction2;
+ 	IssmDouble  gllevelset,phi=1.;
+@@ -3288,12 +3288,12 @@
+ 	Gauss*      gauss         = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2;break;
+ 		case Mesh3DEnum:         dim = 3;break;
+ 		case Mesh3DtetrasEnum:   dim = 3;break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -3321,7 +3321,7 @@
+ 	/*Recover portion of element that is grounded*/
+ 	if(migration_style==SubelementMigrationEnum) phi=element->GetGroundedPortion(xyz_list_base);
+ 	if(migration_style==SubelementMigration2Enum){
+-		if(meshxdim==Mesh2DverticalEnum) _error_("Subelement Migration 2 not implemented yet for Flowline");
++		if(domaintype==Mesh2DverticalEnum) _error_("Subelement Migration 2 not implemented yet for Flowline");
+ 		gllevelset_input=element->GetInput(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input);
+ 		element->GetGroundedPart(&point1,&fraction1,&fraction2,&mainlyfloating);
+ 		//gauss = element->NewGauss(point1,fraction1,fraction2,mainlyfloating,2);
+@@ -3398,17 +3398,17 @@
+ #endif
+ ElementVector* StressbalanceAnalysis::CreatePVectorFSViscous(Element* element){/*{{{*/
+ 
+-	int         i,meshxdim,dim;
++	int         i,domaintype,dim;
+ 	IssmDouble  Jdet,forcex,forcey,forcez;
+ 	IssmDouble *xyz_list = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+ 		case Mesh3DtetrasEnum:   dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -3473,7 +3473,7 @@
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorFSViscousXTH(Element* element){/*{{{*/
+ 
+-	int         i,tausize,meshxdim,dim;
++	int         i,tausize,domaintype,dim;
+ 	IssmDouble  Jdet,r;
+ 	IssmDouble  epsxx,epsyy,epszz,epsxy,epsxz,epsyz;
+ 	IssmDouble  sigmapxx,sigmapyy,sigmapzz,sigmapxy,sigmapxz,sigmapyz;
+@@ -3481,12 +3481,12 @@
+ 	Gauss*      gauss    = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; tausize = 3; break;
+ 		case Mesh3DEnum:         dim = 3; tausize = 6; break;
+ 		case Mesh3DtetrasEnum:   dim = 3; tausize = 6; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -3649,7 +3649,7 @@
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorFSShelf(Element* element){/*{{{*/
+ 
+-	int         i,meshxdim,dim;
++	int         i,domaintype,dim;
+ 	IssmDouble  Jdet,water_pressure,bed;
+ 	IssmDouble	normal[3];
+ 	IssmDouble *xyz_list_base = NULL;
+@@ -3658,12 +3658,12 @@
+ 	if(!element->IsOnBase() || !element->IsFloating()) return NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+ 		case Mesh3DtetrasEnum:   dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -3724,7 +3724,7 @@
+ 	if(!element->IsIcefront()) return NULL;
+ 
+ 	/*Intermediaries*/
+-	int         i,meshxdim,dim;
++	int         i,domaintype,dim;
+ 	IssmDouble  Jdet,pressure,surface,z;
+ 	IssmDouble	normal[3];
+ 	IssmDouble *xyz_list       = NULL;
+@@ -3735,12 +3735,12 @@
+ 	if(!element->IsFloating()) return NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+ 		case Mesh3DtetrasEnum:   dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -4082,18 +4082,18 @@
+ 	int*         vdoflist=NULL;
+ 	int*         pdoflist=NULL;
+ 	Input*       vz_input=NULL;
+-	int          meshxdim,dim;
++	int          domaintype,dim;
+ 	IssmDouble   vx,vy,vz,p;
+ 	IssmDouble   FSreconditioning;
+ 
+ 	/*Get some parameters*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
++	element->FindParam(&domaintype,DomainTypeEnum);
+ 	element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+-	switch(meshxdim){
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+ 		case Mesh3DtetrasEnum:   dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -4149,18 +4149,18 @@
+ void StressbalanceAnalysis::InitializeXTH(Elements* elements,Parameters* parameters){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int        meshxdim,dim;
++	int        domaintype,dim;
+ 	IssmDouble dvx[3],dvy[3],dvz[3];
+ 	IssmDouble viscosity;
+ 	IssmDouble *xyz_list = NULL;
+ 
+ 	/*Get problem dimension*/
+-	parameters->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	parameters->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+ 		case Mesh3DtetrasEnum:   dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	for(int i=0;i<elements->Size();i++){
+@@ -4234,19 +4234,19 @@
+ void StressbalanceAnalysis::InputUpdateFromSolutionFS(IssmDouble* solution,Element* element){/*{{{*/
+ 
+ 	bool         results_on_nodes;
+-	int          i,dim,meshxdim;
++	int          i,dim,domaintype;
+ 	int*         vdoflist=NULL;
+ 	int*         pdoflist=NULL;
+ 	IssmDouble   FSreconditioning;
+ 
+-	element->FindParam(&meshxdim,MeshXDimEnum);
++	element->FindParam(&domaintype,DomainTypeEnum);
+ 	element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+ 	element->FindParam(&results_on_nodes,SettingsResultsOnNodesEnum);
+-	switch(meshxdim){
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+ 		case Mesh3DtetrasEnum:   dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -4330,7 +4330,7 @@
+ void StressbalanceAnalysis::InputUpdateFromSolutionFSXTH_d(Elements* elements,Parameters* parameters){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int         dim,tausize,meshxdim;
++	int         dim,tausize,domaintype;
+ 	IssmDouble  epsxx,epsyy,epszz,epsxy,epsxz,epsyz,D_scalar;
+ 	IssmDouble  epsxx_old,epsyy_old,epszz_old,epsxy_old,epsxz_old,epsyz_old;
+ 	IssmDouble  sigmapxx,sigmapyy,sigmapzz,sigmapxy,sigmapxz,sigmapyz;
+@@ -4339,12 +4339,12 @@
+ 	IssmDouble  Jdet,r;
+ 
+ 	parameters->FindParam(&r,AugmentedLagrangianREnum);
+-	parameters->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	parameters->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; tausize = 3; break;
+ 		case Mesh3DEnum:         dim = 3; tausize = 6; break;
+ 		case Mesh3DtetrasEnum:   dim = 3; tausize = 6; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	for(int i=0;i<elements->Size();i++){
+@@ -4544,7 +4544,7 @@
+ void StressbalanceAnalysis::InputUpdateFromSolutionFSXTH_tau(Elements* elements,Parameters* parameters){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int         dim,tausize,meshxdim;
++	int         dim,tausize,domaintype;
+ 	IssmDouble  epsxx,epsyy,epszz,epsxy,epsxz,epsyz,D_scalar;
+ 	IssmDouble  d_xx,d_yy,d_zz,d_xy,d_xz,d_yz;
+ 	IssmDouble  sigmapxx,sigmapyy,sigmapzz,sigmapxy,sigmapxz,sigmapyz;
+@@ -4553,12 +4553,12 @@
+ 	IssmDouble  Jdet,r;
+ 
+ 	parameters->FindParam(&r,AugmentedLagrangianREnum);
+-	parameters->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	parameters->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; tausize = 3; break;
+ 		case Mesh3DEnum:         dim = 3; tausize = 6; break;
+ 		case Mesh3DtetrasEnum:   dim = 3; tausize = 6; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	for(int i=0;i<elements->Size();i++){
+@@ -6339,7 +6339,7 @@
+ }/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionSSAHO(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	int         i,meshxdim;
++	int         i,domaintype;
+ 	IssmDouble  rho_ice,g;
+ 	int*        SSAdoflist = NULL;
+ 	int*        HOdoflist  = NULL;
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h	(revision 17686)
+@@ -12,7 +12,7 @@
+ 
+ 	public:
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17686)
+@@ -6,7 +6,7 @@
+ #include "../modules/modules.h"
+ 
+ /*Model processing*/
+-int  HydrologyDCInefficientAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int  HydrologyDCInefficientAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	return 1;
+ }/*}}}*/
+ void HydrologyDCInefficientAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+@@ -87,7 +87,7 @@
+ 	iomodel->FetchDataToInput(elements,HydrologydcBasalMoulinInputEnum);
+ 	iomodel->FetchDataToInput(elements,SedimentHeadEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcSedimentTransmitivityEnum);
+-	if(iomodel->meshxdim==Mesh3DEnum) iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
++	if(iomodel->domaintype==Mesh3DEnum) iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 
+ 	if(isefficientlayer)iomodel->FetchDataToInput(elements,HydrologydcMaskEplactiveNodeEnum);
+ }/*}}}*/
+@@ -100,7 +100,7 @@
+ 	/*Now, do we really want DC?*/
+ 	if(hydrology_model!=HydrologydcEnum) return;
+ 
+-	if(iomodel->meshxdim!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,HydrologyDCInefficientAnalysisEnum,P1Enum);
+ 	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+@@ -120,12 +120,12 @@
+ 	iomodel->Constant(&hydrology_model,HydrologyModelEnum);
+ 	if(hydrology_model!=HydrologydcEnum) return;
+ 
+-	if(iomodel->meshxdim==Mesh3DEnum) iomodel->FetchData(1,MeshVertexonbaseEnum);
++	if(iomodel->domaintype==Mesh3DEnum) iomodel->FetchData(1,MeshVertexonbaseEnum);
+ 
+ 	//create penalties for nodes: no node can have water above the max
+ 	CreateSingleNodeToElementConnectivity(iomodel);
+ 	for(int i=0;i<iomodel->numberofvertices;i++){
+-		if (iomodel->meshxdim!=Mesh3DEnum){
++		if (iomodel->domaintype!=Mesh3DEnum){
+ 			/*keep only this partition's nodes:*/
+ 			if(iomodel->my_vertices[i]){
+ 				loads->AddObject(new Pengrid(iomodel->loadcounter+i+1,i,iomodel,HydrologyDCInefficientAnalysisEnum));
+@@ -154,12 +154,12 @@
+ ElementMatrix* HydrologyDCInefficientAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int      meshxdim;
++	int      domaintype;
+ 	Element* basalelement;
+ 
+ 	/*Get basal element*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+@@ -167,7 +167,7 @@
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Intermediaries */
+@@ -253,18 +253,18 @@
+ 	xDelete<IssmDouble>(B);
+ 	xDelete<IssmDouble>(basis);
+ 	delete gauss;
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return Ke;
+ }/*}}}*/
+ ElementVector* HydrologyDCInefficientAnalysis::CreatePVector(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int      meshxdim;
++	int      domaintype;
+ 	Element* basalelement;
+ 
+ 	/*Get basal element*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+@@ -272,7 +272,7 @@
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Intermediaries */
+@@ -356,7 +356,7 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+ 	delete gauss;
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
+ void HydrologyDCInefficientAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+@@ -391,13 +391,13 @@
+ }/*}}}*/
+ void HydrologyDCInefficientAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	int        meshxdim;
++	int        domaintype;
+ 	bool       converged;
+ 	int*       doflist=NULL;
+ 	Element*   basalelement=NULL;
+ 
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	if(meshxdim!=Mesh2DhorizontalEnum){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	if(domaintype!=Mesh2DhorizontalEnum){
+ 		if(!element->IsOnBase()) return;
+ 		basalelement=element->SpawnBasalElement();
+ 	}
+@@ -445,7 +445,7 @@
+ 	xDelete<IssmDouble>(values);
+ 	xDelete<IssmDouble>(residual);
+ 	xDelete<int>(doflist);
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ }/*}}}*/
+ void HydrologyDCInefficientAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+ 	/*Default, do nothing*/
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h	(revision 17686)
+@@ -12,7 +12,7 @@
+ 
+ 	public:
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17686)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ 
+ /*Model processing*/
+-int  ThermalAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int  ThermalAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	return 1;
+ }/*}}}*/
+ void ThermalAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+@@ -30,7 +30,7 @@
+ void ThermalAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+ 
+ 	/*Now, is the model 3d? otherwise, do nothing: */
+-	if(iomodel->meshxdim==Mesh2DhorizontalEnum)return;
++	if(iomodel->domaintype==Mesh2DhorizontalEnum)return;
+ 
+ 	/*Update elements: */
+ 	int counter=0;
+@@ -82,21 +82,21 @@
+ }/*}}}*/
+ void ThermalAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+-	if(iomodel->meshxdim==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,ThermalAnalysisEnum,P1Enum);
+ 	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+ void ThermalAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ 
+ 	/*Only 3d mesh supported*/
+-	if(iomodel->meshxdim==Mesh3DEnum){
++	if(iomodel->domaintype==Mesh3DEnum){
+ 		IoModelToConstraintsx(constraints,iomodel,ThermalSpctemperatureEnum,ThermalAnalysisEnum,P1Enum);
+ 	}
+ 
+ }/*}}}*/
+ void ThermalAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+ 
+-	if(iomodel->meshxdim==Mesh2DhorizontalEnum) _error_("2d meshes not supported yet");
++	if(iomodel->domaintype==Mesh2DhorizontalEnum) _error_("2d meshes not supported yet");
+ 
+ 	/*create penalties for nodes: no node can have a temperature over the melting point*/
+ 	iomodel->FetchData(1,ThermalSpctemperatureEnum);
+Index: ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.h	(revision 17686)
+@@ -12,7 +12,7 @@
+ 	
+  public:
+ 	/*Model processing*/
+-	int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++	int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 	void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 	void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 	void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/GiaAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/GiaAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/GiaAnalysis.cpp	(revision 17686)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ 
+ /*Model processing*/
+-int  GiaAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int  GiaAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	return 1;
+ }/*}}}*/
+ void GiaAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h	(revision 17686)
+@@ -12,7 +12,7 @@
+ 
+ 	public:
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h	(revision 17686)
+@@ -12,7 +12,7 @@
+ 
+ 	public:
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/EnumToAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnumToAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/EnumToAnalysis.h	(revision 17686)
+@@ -7,7 +7,7 @@
+ 
+ #endif
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17686)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ 
+ /*Model processing*/
+-int  DamageEvolutionAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int  DamageEvolutionAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	return 1;
+ }/*}}}*/
+ void DamageEvolutionAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+@@ -59,7 +59,7 @@
+ 	/*What input do I need to run my damage evolution model?*/
+ 	iomodel->FetchDataToInput(elements,VxEnum);
+ 	iomodel->FetchDataToInput(elements,VyEnum);
+-	if(iomodel->meshxdim==Mesh3DEnum) iomodel->FetchDataToInput(elements,VzEnum);
++	if(iomodel->domaintype==Mesh3DEnum) iomodel->FetchDataToInput(elements,VzEnum);
+ 	iomodel->FetchDataToInput(elements,DamageDEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,PressureEnum);
+@@ -72,7 +72,7 @@
+ }/*}}}*/
+ void DamageEvolutionAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+-	if(iomodel->meshxdim!=Mesh2DhorizontalEnum) iomodel->FetchData(1,MeshVertexonbaseEnum);
++	if(iomodel->domaintype!=Mesh2DhorizontalEnum) iomodel->FetchData(1,MeshVertexonbaseEnum);
+ 	::CreateNodes(nodes,iomodel,DamageEvolutionAnalysisEnum,P1Enum);
+ 	iomodel->DeleteData(1,MeshVertexonbaseEnum);
+ }/*}}}*/
+@@ -108,15 +108,15 @@
+ 
+ 	/*Intermediaries*/
+ 	Element*    basalelement;
+-	int         meshxdim,dim;
++	int         domaintype,dim;
+ 	int         stabilization;
+ 	IssmDouble  Jdet,dt,D_scalar,h;
+ 	IssmDouble  vel,vx,vy,dvxdx,dvydy,dvx[2],dvy[2];
+ 	IssmDouble *xyz_list  = NULL;
+ 
+ 	/*Get problem dimension and basal element*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			dim = 2;
+@@ -126,7 +126,7 @@
+ 			basalelement = element->SpawnBasalElement();
+ 			dim = 2;
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -145,7 +145,7 @@
+ 	basalelement->FindParam(&stabilization,DamageStabilizationEnum);
+ 	Input* vxaverage_input=NULL;
+ 	Input* vyaverage_input=NULL;
+-	if(meshxdim==Mesh2DhorizontalEnum){
++	if(domaintype==Mesh2DhorizontalEnum){
+ 		vxaverage_input=basalelement->GetInput(VxEnum); _assert_(vxaverage_input);
+ 		vyaverage_input=basalelement->GetInput(VyEnum); _assert_(vyaverage_input);
+ 	}
+@@ -248,7 +248,7 @@
+ 	xDelete<IssmDouble>(Bprime);
+ 	xDelete<IssmDouble>(D);
+ 	delete gauss;
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return Ke;
+ }/*}}}*/
+ ElementVector* DamageEvolutionAnalysis::CreatePVector(Element* element){/*{{{*/
+@@ -257,15 +257,15 @@
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+ 	/*Intermediaries*/
+-	int      meshxdim;
++	int      domaintype;
+ 	Element* basalelement;
+ 	IssmDouble  Jdet,dt;
+ 	IssmDouble  f,damage;
+ 	IssmDouble* xyz_list = NULL;
+ 
+ 	/*Get basal element*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+@@ -273,7 +273,7 @@
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -310,7 +310,7 @@
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	delete gauss;
+ 	return pe;
+ }/*}}}*/
+@@ -376,13 +376,13 @@
+ }/*}}}*/
+ void DamageEvolutionAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	int meshxdim;
++	int domaintype;
+ 	IssmDouble  max_damage;
+ 	int			*doflist = NULL;
+ 	Element*   basalelement=NULL;
+ 
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	if(meshxdim!=Mesh2DhorizontalEnum){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	if(domaintype!=Mesh2DhorizontalEnum){
+ 		if(!element->IsOnBase()) return;
+ 		basalelement=element->SpawnBasalElement();
+ 	}
+@@ -415,7 +415,7 @@
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(newdamage);
+ 	xDelete<int>(doflist);
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ }/*}}}*/
+ void DamageEvolutionAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+ 	/*Default, do nothing*/
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17686)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ 
+ /*Model processing*/
+-int  EnthalpyAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int  EnthalpyAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	return 1;
+ }/*}}}*/
+ void EnthalpyAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+@@ -28,7 +28,7 @@
+ 	bool isenthalpy;
+ 
+ 	/*Now, is the model 3d? otherwise, do nothing: */
+-	if(iomodel->meshxdim==Mesh2DhorizontalEnum)return;
++	if(iomodel->domaintype==Mesh2DhorizontalEnum)return;
+ 
+ 	/*Is enthalpy requested?*/
+ 	iomodel->Constant(&isenthalpy,ThermalIsenthalpyEnum);
+@@ -93,7 +93,7 @@
+ }/*}}}*/
+ void EnthalpyAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+-	if(iomodel->meshxdim==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,EnthalpyAnalysisEnum,P1Enum);
+ 	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+@@ -116,7 +116,7 @@
+ 	iomodel->Constant(&referencetemperature,ConstantsReferencetemperatureEnum);
+ 
+ 	/*return if 2d mesh*/
+-	if(iomodel->meshxdim==Mesh2DhorizontalEnum) return;
++	if(iomodel->domaintype==Mesh2DhorizontalEnum) return;
+ 
+ 	/*Fetch data: */
+ 	iomodel->FetchData(&spcvector,&M,&N,ThermalSpctemperatureEnum);
+Index: ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp	(revision 17686)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ 
+ /*Model processing*/
+-int  MeshdeformationAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int  MeshdeformationAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	_error_("not implemented");
+ }/*}}}*/
+ void MeshdeformationAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17686)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ 
+ /*Model processing*/
+-int  FreeSurfaceBaseAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int  FreeSurfaceBaseAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	return 1;
+ }/*}}}*/
+ void FreeSurfaceBaseAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+@@ -13,7 +13,7 @@
+ void FreeSurfaceBaseAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+ 
+ 	/*Now, is the model 3d? otherwise, do nothing: */
+-	if (iomodel->meshxdim==Mesh2DhorizontalEnum)return;
++	if (iomodel->domaintype==Mesh2DhorizontalEnum)return;
+ 
+ 	/*Finite element type*/
+ 	int finiteelement = P1Enum;
+@@ -34,7 +34,7 @@
+ 	iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateCorrectionEnum,0.);
+ 	iomodel->FetchDataToInput(elements,VxEnum);
+ 	iomodel->FetchDataToInput(elements,VyEnum);
+-	if(iomodel->meshxdim==Mesh3DEnum){
++	if(iomodel->domaintype==Mesh3DEnum){
+ 		iomodel->FetchDataToInput(elements,VzEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+@@ -42,7 +42,7 @@
+ }/*}}}*/
+ void FreeSurfaceBaseAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+-	if(iomodel->meshxdim!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,FreeSurfaceBaseAnalysisEnum,P1Enum);
+ 	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+@@ -59,7 +59,7 @@
+ 	IssmDouble *vertex_pairing=NULL;
+ 	IssmDouble *nodeonbase=NULL;
+ 	iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,MasstransportVertexPairingEnum);
+-	if(iomodel->meshxdim!=Mesh2DhorizontalEnum) iomodel->FetchData(&nodeonbase,NULL,NULL,MeshVertexonbaseEnum);
++	if(iomodel->domaintype!=Mesh2DhorizontalEnum) iomodel->FetchData(&nodeonbase,NULL,NULL,MeshVertexonbaseEnum);
+ 	for(int i=0;i<numvertex_pairing;i++){
+ 
+ 		if(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+0])-1]){
+@@ -68,7 +68,7 @@
+ 			_assert_(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+1])-1]);
+ 
+ 			/*Skip if one of the two is not on the bed*/
+-			if(iomodel->meshxdim!=Mesh2DhorizontalEnum){
++			if(iomodel->domaintype!=Mesh2DhorizontalEnum){
+ 				if(!(reCast<bool>(nodeonbase[reCast<int>(vertex_pairing[2*i+0])-1])) || !(reCast<bool>(nodeonbase[reCast<int>(vertex_pairing[2*i+1])-1]))) continue;
+ 			}
+ 
+@@ -104,15 +104,15 @@
+ ElementMatrix* FreeSurfaceBaseAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int         meshxdim,dim,stabilization;
++	int         domaintype,dim,stabilization;
+ 	Element*    basalelement = NULL;
+ 	IssmDouble *xyz_list  = NULL;
+ 	IssmDouble  Jdet,D_scalar,dt,h;
+ 	IssmDouble  vel,vx,vy;
+ 
+ 	/*Get basal element*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			dim = 2;
+@@ -127,7 +127,7 @@
+ 			basalelement = element->SpawnBasalElement();
+ 			dim = 2;
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -222,20 +222,20 @@
+ 	xDelete<IssmDouble>(Bprime);
+ 	xDelete<IssmDouble>(D);
+ 	delete gauss;
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return Ke;
+ }/*}}}*/
+ ElementVector* FreeSurfaceBaseAnalysis::CreatePVector(Element* element){/*{{{*/
+ 	/*Intermediaries*/
+-	int         meshxdim,dim;
++	int         domaintype,dim;
+ 	IssmDouble  Jdet,dt;
+ 	IssmDouble  mb,mb_correction,bed,vz;
+ 	Element*    basalelement = NULL;
+ 	IssmDouble *xyz_list  = NULL;
+ 
+ 	/*Get basal element*/
+-	element->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			basalelement = element;
+ 			dim = 2;
+@@ -250,7 +250,7 @@
+ 			basalelement = element->SpawnBasalElement();
+ 			dim = 2;
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -297,7 +297,7 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+ 	delete gauss;
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ 
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.h	(revision 17686)
+@@ -12,7 +12,7 @@
+ 
+ 	public:
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h	(revision 17686)
+@@ -12,7 +12,7 @@
+ 
+ 	public:
+ 		/*Model processing*/
+-		int  DofsPerNode(int** doflist,int meshxdim,int approximation);
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+ 		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+ 		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+ 		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+Index: ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17686)
+@@ -5,7 +5,7 @@
+ #include "../modules/modules.h"
+ #include "../solutionsequences/solutionsequences.h"
+ 
+-int ExtrapolationAnalysis::DofsPerNode(int** doflist,int meshxdim,int approximation){/*{{{*/
++int ExtrapolationAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+ 	return 1;
+ }
+ /*}}}*/
+@@ -29,7 +29,7 @@
+ 			counter++;
+ 		}
+ 	}
+-	if(iomodel->meshxdim==Mesh3DEnum){
++	if(iomodel->domaintype==Mesh3DEnum){
+ 		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
+@@ -37,7 +37,7 @@
+ /*}}}*/
+ void ExtrapolationAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 	int finiteelement=P1Enum;
+-	if(iomodel->meshxdim!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,ExtrapolationAnalysisEnum,finiteelement);
+ 	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }
+@@ -87,7 +87,7 @@
+ 	Element* basalelement = element->SpawnBasalElement();
+ 
+ 	/*Intermediaries */
+-	int		   meshxdim,dim;
++	int		   domaintype,dim;
+ 	int        i,row,col,stabilization;
+ 	bool	   extrapolatebydiffusion = true;
+ 	IssmDouble Jdet,D_scalar,h;
+@@ -96,12 +96,12 @@
+ 	IssmDouble* xyz_list = NULL;
+ 
+ 	/*Get problem dimension*/
+-	basalelement->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	basalelement->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum:   dim = 1; break;
+ 		case Mesh2DhorizontalEnum: dim = 2; break;
+ 		case Mesh3DEnum:           dim = 2; break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -212,7 +212,7 @@
+ 	xDelete<IssmDouble>(dlsf);
+ 	xDelete<IssmDouble>(normal);
+ 	delete gauss;
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return Ke;
+ 
+ }/*}}}*/
+@@ -222,7 +222,7 @@
+ 	Element* basalelement = element->SpawnBasalElement();
+ 
+ 	/*Intermediaries */
+-	int i, meshxdim;
++	int i, domaintype;
+ 	
+ 	/*Fetch number of nodes */
+ 	int numnodes = basalelement->GetNumberOfNodes();
+@@ -232,8 +232,8 @@
+ 	for(i=0;i<numnodes;i++) 
+ 		pe->values[i]=0.; 
+ 
+-	basalelement->FindParam(&meshxdim,MeshXDimEnum);
+-	if(meshxdim!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	basalelement->FindParam(&domaintype,DomainTypeEnum);
++	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
+ void ExtrapolationAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+@@ -241,17 +241,17 @@
+ }/*}}}*/
+ void ExtrapolationAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	int meshxdim, extrapolationvariable;
+-	element->FindParam(&meshxdim,MeshXDimEnum);
++	int domaintype, extrapolationvariable;
++	element->FindParam(&domaintype,DomainTypeEnum);
+ 	element->FindParam(&extrapolationvariable, ExtrapolationVariableEnum);
+-	switch(meshxdim){
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			element->InputUpdateFromSolutionOneDof(solution,extrapolationvariable);
+ 			break;
+ 		case Mesh3DEnum:
+ 			element->InputUpdateFromSolutionOneDofCollapsed(solution,extrapolationvariable);
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ }/*}}}*/
+ void ExtrapolationAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17685)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17686)
+@@ -210,9 +210,9 @@
+ 	MeshXEnum,
+ 	MeshYEnum,
+ 	MeshZEnum,
+-	MeshXDimEnum,
+-	MeshDimEnum,
+-	MeshTypeEnum,
++	DomainTypeEnum,
++	DomainDimensionEnum,
++	MeshElementtypeEnum,
+ 	Mesh2DhorizontalEnum,
+ 	Mesh2DverticalEnum,
+ 	Mesh3DEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17686)
+@@ -218,9 +218,9 @@
+ 		case MeshXEnum : return "MeshX";
+ 		case MeshYEnum : return "MeshY";
+ 		case MeshZEnum : return "MeshZ";
+-		case MeshXDimEnum : return "MeshXDim";
+-		case MeshDimEnum : return "MeshDim";
+-		case MeshTypeEnum : return "MeshType";
++		case DomainTypeEnum : return "DomainType";
++		case DomainDimensionEnum : return "DomainDimension";
++		case MeshElementtypeEnum : return "MeshElementtype";
+ 		case Mesh2DhorizontalEnum : return "Mesh2Dhorizontal";
+ 		case Mesh2DverticalEnum : return "Mesh2Dvertical";
+ 		case Mesh3DEnum : return "Mesh3D";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17686)
+@@ -221,9 +221,9 @@
+ 	      else if (strcmp(name,"MeshX")==0) return MeshXEnum;
+ 	      else if (strcmp(name,"MeshY")==0) return MeshYEnum;
+ 	      else if (strcmp(name,"MeshZ")==0) return MeshZEnum;
+-	      else if (strcmp(name,"MeshXDim")==0) return MeshXDimEnum;
+-	      else if (strcmp(name,"MeshDim")==0) return MeshDimEnum;
+-	      else if (strcmp(name,"MeshType")==0) return MeshTypeEnum;
++	      else if (strcmp(name,"DomainType")==0) return DomainTypeEnum;
++	      else if (strcmp(name,"DomainDimension")==0) return DomainDimensionEnum;
++	      else if (strcmp(name,"MeshElementtype")==0) return MeshElementtypeEnum;
+ 	      else if (strcmp(name,"Mesh2Dhorizontal")==0) return Mesh2DhorizontalEnum;
+ 	      else if (strcmp(name,"Mesh2Dvertical")==0) return Mesh2DverticalEnum;
+ 	      else if (strcmp(name,"Mesh3D")==0) return Mesh3DEnum;
+Index: ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp	(revision 17686)
+@@ -14,11 +14,11 @@
+ 
+ 	/* intermediaries */
+ 	bool solvein2d=false;
+-	int i,in,meshxdim,analysis_type;
++	int i,in,domaintype,analysis_type;
+ 	Elements* elements = femmodel->elements;
+ 
+ 	/* find parameters */
+-	femmodel->parameters->FindParam(&meshxdim,MeshXDimEnum);
++	femmodel->parameters->FindParam(&domaintype,DomainTypeEnum);
+ 
+ 	for(i=0;i<elements->Size();i++){
+ 		Element    *element  = dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+@@ -49,7 +49,7 @@
+ 		}
+ 
+ 		/* if solving 2d problem on vertically extende mesh, solve on basal layer only*/
+-		if(meshxdim!=Mesh2DhorizontalEnum){
++		if(domaintype!=Mesh2DhorizontalEnum){
+ 			femmodel->parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+ 			if(
+ 					analysis_type==FreeSurfaceBaseAnalysisEnum || 
+Index: ../trunk-jpl/src/c/modules/MeshPartitionx/MeshPartitionx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/MeshPartitionx/MeshPartitionx.h	(revision 17685)
++++ ../trunk-jpl/src/c/modules/MeshPartitionx/MeshPartitionx.h	(revision 17686)
+@@ -10,7 +10,7 @@
+ /* local prototypes: */
+ template <class doubletype> 
+ int MeshPartitionx(int** pepart, int** pnpart, int numberofelements,int numberofnodes,int* elements,
+-		int numberofelements2d,int numberofnodes2d,doubletype* elements2d,int numlayers,int elements_width, int meshxdim,int num_procs){
++		int numberofelements2d,int numberofnodes2d,doubletype* elements2d,int numlayers,int elements_width, int domaintype,int num_procs){
+ 
+ 	int noerr=1;
+ 	int i,j;
+@@ -30,7 +30,7 @@
+ 	int  numflag=0;
+ 	int  edgecut=1;
+ 
+-	switch(meshxdim){
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 		case Mesh2DverticalEnum:
+ 		case Mesh3DtetrasEnum:
+@@ -110,7 +110,7 @@
+ 			}
+ 			break;
+ 		default:
+-			_error_("mesh type "<<EnumToStringx(meshxdim)<<" not supported yet");
++			_error_("mesh type "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Assign output pointer:*/
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp	(revision 17686)
+@@ -35,7 +35,7 @@
+ 	connectivity=xNewZeroInit<int>(iomodel->numberofvertices);
+ 
+ 	/*Get element width*/
+-	switch(iomodel->meshxdim){
++	switch(iomodel->domaintype){
+ 		case Mesh2DhorizontalEnum: elementswidth=3; break;
+ 		case Mesh2DverticalEnum:   elementswidth=3; break;
+ 		case Mesh3DtetrasEnum:     elementswidth=4; break;
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/NodesPartitioning.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/NodesPartitioning.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/NodesPartitioning.cpp	(revision 17686)
+@@ -64,7 +64,7 @@
+ 	bool* my_nodes=xNewZeroInit<bool>(3*iomodel->numberofelements);
+ 
+ 	/*First: add all the nodes of all the elements belonging to this cpu*/
+-	if(iomodel->meshxdim==Mesh2DhorizontalEnum){
++	if(iomodel->domaintype==Mesh2DhorizontalEnum){
+ 		for (i=0;i<iomodel->numberofelements;i++){
+ 			if (my_elements[i]){
+ 				my_nodes[3*i+0]=true;
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp	(revision 17686)
+@@ -16,10 +16,10 @@
+ 	_assert_(iomodel->elements);
+ 
+ 	/*Check Iomodel properties*/
+-	if(iomodel->meshxdim==Mesh2DhorizontalEnum || iomodel->meshxdim==Mesh2DverticalEnum){
++	if(iomodel->domaintype==Mesh2DhorizontalEnum || iomodel->domaintype==Mesh2DverticalEnum){
+ 		/*Keep going*/
+ 	}
+-	else if(iomodel->meshxdim==Mesh3DEnum){
++	else if(iomodel->domaintype==Mesh3DEnum){
+ 		CreateFaces3d(iomodel);
+ 		return;
+ 	}
+@@ -143,7 +143,7 @@
+ 	for(i=0;i<iomodel->numberofvertices;i++) head_minv[i]=-1;
+ 
+ 	/*Mesh specific face indexing per element*/
+-	if(iomodel->meshxdim==Mesh3DEnum){
++	if(iomodel->domaintype==Mesh3DEnum){
+ 		elementnbv = 6; /*Number of vertices per element*/
+ 		elementnbf = 5; /*Number of faces per element*/
+ 		facemaxnbv = 4; /*Maximum number of vertices per face*/
+@@ -242,7 +242,7 @@
+ void FaceGetVertexIndices(IoModel* iomodel,int* pnumvertices,int** pverticesid,int facenumber){/*{{{*/
+ 
+ 	int numbervertices;
+-	if(iomodel->meshxdim==Mesh3DEnum){
++	if(iomodel->domaintype==Mesh3DEnum){
+ 		if((iomodel->faces[6*facenumber+5])==1){
+ 			numbervertices=3;
+ 		}
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/FacesPartitioning.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/FacesPartitioning.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/FacesPartitioning.cpp	(revision 17686)
+@@ -17,13 +17,13 @@
+ 	_assert_(iomodel->elementtofaceconnectivity);
+ 
+ 	/*Mesh dependent variables*/
+-	if(iomodel->meshxdim==Mesh2DhorizontalEnum){
++	if(iomodel->domaintype==Mesh2DhorizontalEnum){
+ 		elementnbf = 3;
+ 	}
+-	else if(iomodel->meshxdim==Mesh2DverticalEnum){
++	else if(iomodel->domaintype==Mesh2DverticalEnum){
+ 		elementnbf = 3;
+ 	}
+-	else if(iomodel->meshxdim==Mesh3DEnum){
++	else if(iomodel->domaintype==Mesh3DEnum){
+ 		elementnbf = 5;
+ 	}
+ 	else{
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp	(revision 17686)
+@@ -22,7 +22,7 @@
+ 	int *elementedges_markers = NULL;
+ 
+ 	/*Mesh dependent variables*/
+-	if(iomodel->meshxdim==Mesh2DhorizontalEnum){
++	if(iomodel->domaintype==Mesh2DhorizontalEnum){
+ 		elementnbv = 3;
+ 		elementnbe = 3;
+ 		elementedges         = xNew<int>(elementnbe*2);
+@@ -31,7 +31,7 @@
+ 		elementedges[2*1+0] = 2; elementedges[2*1+1] = 0; elementedges_markers[1] = 1;
+ 		elementedges[2*2+0] = 0; elementedges[2*2+1] = 1; elementedges_markers[2] = 1;
+ 	}
+-	else if(iomodel->meshxdim==Mesh2DverticalEnum){
++	else if(iomodel->domaintype==Mesh2DverticalEnum){
+ 		elementnbv = 3;
+ 		elementnbe = 3;
+ 		elementedges         = xNew<int>(elementnbe*2);
+@@ -40,7 +40,7 @@
+ 		elementedges[2*1+0] = 2; elementedges[2*1+1] = 0; elementedges_markers[1] = 1;
+ 		elementedges[2*2+0] = 0; elementedges[2*2+1] = 1; elementedges_markers[2] = 1;
+ 	}
+-	else if(iomodel->meshxdim==Mesh3DtetrasEnum){
++	else if(iomodel->domaintype==Mesh3DtetrasEnum){
+ 		elementnbv = 4;
+ 		elementnbe = 6;
+ 		elementedges         = xNew<int>(elementnbe*2);
+@@ -52,7 +52,7 @@
+ 		elementedges[2*4+0] = 1; elementedges[2*4+1] = 3; elementedges_markers[4] = 1;
+ 		elementedges[2*5+0] = 2; elementedges[2*5+1] = 3; elementedges_markers[5] = 1;
+ 	}
+-	else if(iomodel->meshxdim==Mesh3DEnum){
++	else if(iomodel->domaintype==Mesh3DEnum){
+ 		elementnbv = 6;
+ 		elementnbe = 9;
+ 		elementedges         = xNew<int>(elementnbe*2);
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/EdgesPartitioning.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/EdgesPartitioning.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/EdgesPartitioning.cpp	(revision 17686)
+@@ -17,16 +17,16 @@
+ 	_assert_(iomodel->elementtoedgeconnectivity);
+ 
+ 	/*Mesh dependent variables*/
+-	if(iomodel->meshxdim==Mesh2DhorizontalEnum){
++	if(iomodel->domaintype==Mesh2DhorizontalEnum){
+ 		elementnbe = 3;
+ 	}
+-	else if(iomodel->meshxdim==Mesh2DverticalEnum){
++	else if(iomodel->domaintype==Mesh2DverticalEnum){
+ 		elementnbe = 3;
+ 	}
+-	else if(iomodel->meshxdim==Mesh3DtetrasEnum){
++	else if(iomodel->domaintype==Mesh3DtetrasEnum){
+ 		elementnbe = 6;
+ 	}
+-	else if(iomodel->meshxdim==Mesh3DEnum){
++	else if(iomodel->domaintype==Mesh3DEnum){
+ 		elementnbe = 9;
+ 	}
+ 	else{
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17686)
+@@ -18,7 +18,7 @@
+ void CreateParameters(Parameters* parameters,IoModel* iomodel,char* rootpath,FILE* toolkitsoptionsfid,const int solution_type){
+ 
+ 	int         i,j,m,k;
+-	int         numoutputs,meshxdim,smb_model;
++	int         numoutputs,domaintype,smb_model;
+ 	char**      requestedoutputs = NULL;
+ 	IssmDouble  time;
+ 	bool        ispdd,isdelta18o;
+@@ -40,7 +40,7 @@
+ 	_assert_(parameters->Size()==0); 
+ 
+ 	/*Copy some constants from iomodel */
+-	parameters->AddObject(iomodel->CopyConstantObject(MeshXDimEnum));
++	parameters->AddObject(iomodel->CopyConstantObject(DomainTypeEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(SettingsOutputFrequencyEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(SteadystateReltolEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(SteadystateMaxiterEnum));
+@@ -83,7 +83,7 @@
+ 	parameters->AddObject(iomodel->CopyConstantObject(StressbalanceRestolEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(StressbalanceReltolEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(StressbalanceAbstolEnum));
+-	if(iomodel->meshxdim==Mesh3DEnum)
++	if(iomodel->domaintype==Mesh3DEnum)
+ 	 parameters->AddObject(iomodel->CopyConstantObject(MeshNumberoflayersEnum));
+ 
+ 	/*Surface mass balance parameters*/
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateSingleNodeToElementConnectivity.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateSingleNodeToElementConnectivity.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateSingleNodeToElementConnectivity.cpp	(revision 17686)
+@@ -29,11 +29,11 @@
+ 	connectivity=xNewZeroInit<int>(iomodel->numberofvertices);
+ 
+ 	/*Get element width (3 or 6)*/
+-	switch(iomodel->meshxdim){
++	switch(iomodel->domaintype){
+ 		case Mesh2DhorizontalEnum: elementswidth=3; break;
+ 		case Mesh2DverticalEnum  : elementswidth=3; break;
+ 		case Mesh3DEnum          : elementswidth=6; break;
+-		default:  _error_("mesh type "<<EnumToStringx(iomodel->meshxdim)<<" not supported yet");
++		default:  _error_("mesh type "<<EnumToStringx(iomodel->domaintype)<<" not supported yet");
+ 	}
+ 
+ 	/*Create connectivity table*/
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp	(revision 17686)
+@@ -58,9 +58,9 @@
+ 		parameters->AddObject(new IntParam(AnalysisCounterEnum,i));
+ 
+ 		/*Hack for trasient runs (FIXME: to be improved)*/
+-		if(solution_enum==TransientSolutionEnum && analysis_enum==ThermalAnalysisEnum  && iomodel->meshxdim==Mesh2DhorizontalEnum) continue;
+-		if(solution_enum==TransientSolutionEnum && analysis_enum==MeltingAnalysisEnum  && iomodel->meshxdim==Mesh2DhorizontalEnum) continue;
+-		if(solution_enum==TransientSolutionEnum && analysis_enum==EnthalpyAnalysisEnum && iomodel->meshxdim==Mesh2DhorizontalEnum) continue;
++		if(solution_enum==TransientSolutionEnum && analysis_enum==ThermalAnalysisEnum  && iomodel->domaintype==Mesh2DhorizontalEnum) continue;
++		if(solution_enum==TransientSolutionEnum && analysis_enum==MeltingAnalysisEnum  && iomodel->domaintype==Mesh2DhorizontalEnum) continue;
++		if(solution_enum==TransientSolutionEnum && analysis_enum==EnthalpyAnalysisEnum && iomodel->domaintype==Mesh2DhorizontalEnum) continue;
+ 		if(solution_enum==TransientSolutionEnum && analysis_enum==ThermalAnalysisEnum && isthermal==false) continue;
+ 		if(solution_enum==TransientSolutionEnum && analysis_enum==MeltingAnalysisEnum && isthermal==false) continue;
+ 		if(solution_enum==TransientSolutionEnum && analysis_enum==EnthalpyAnalysisEnum && isthermal==false) continue;
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp	(revision 17686)
+@@ -25,7 +25,7 @@
+ 
+ 	/*Create elements*/
+ 	if(control_analysis)iomodel->FetchData(3,InversionControlParametersEnum,InversionMinParametersEnum,InversionMaxParametersEnum);
+-	switch(iomodel->meshxdim){
++	switch(iomodel->domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			for(i=0;i<iomodel->numberofelements;i++){
+ 				if(iomodel->my_elements[i]) elements->AddObject(new Tria(i+1,i,i,iomodel,nummodels));
+@@ -58,7 +58,7 @@
+ 			iomodel->FetchDataToInput(elements,MaterialsRheologyNEnum);
+ 			iomodel->FetchDataToInput(elements,DamageDEnum);
+ 			for (i=0;i<iomodel->numberofelements;i++) if(iomodel->my_elements[i]) materials->AddObject(new Matice(i+1,i,iomodel));
+-			switch(iomodel->meshxdim){
++			switch(iomodel->domaintype){
+ 				case Mesh2DhorizontalEnum: case Mesh2DverticalEnum:
+ 					elements->InputDuplicate(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum);
+ 					elements->InputDuplicate(DamageDEnum,DamageDbarEnum);
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp	(revision 17686)
+@@ -50,7 +50,7 @@
+ 
+ 	/*Number of vertices per elements, needed to correctly retrieve data: */
+ 	/*Determine parallel partitioning of elements: we use Metis for now. First load the data, then partition*/
+-	switch(iomodel->meshxdim){
++	switch(iomodel->domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			elements_width=3;
+ 			numberofelements2d = 0;
+@@ -80,7 +80,7 @@
+ 			_error_("mesh not supported yet");
+ 	}
+ 
+-	MeshPartitionx(&epart,&npart,iomodel->numberofelements,iomodel->numberofvertices,iomodel->elements,numberofelements2d,numberofvertices2d,elements2d,numlayers,elements_width,iomodel->meshxdim,num_procs);
++	MeshPartitionx(&epart,&npart,iomodel->numberofelements,iomodel->numberofvertices,iomodel->elements,numberofelements2d,numberofvertices2d,elements2d,numlayers,elements_width,iomodel->domaintype,num_procs);
+ 
+ 	/*Free elements2d: */
+ 	xDelete<int>(elements2d);
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17686)
+@@ -143,7 +143,7 @@
+ 				}
+ 			}
+ 			id0 = id0+iomodel->numberofvertices+iomodel->numberofedges;
+-	      if(iomodel->meshxdim==Mesh3DEnum){
++	      if(iomodel->domaintype==Mesh3DEnum){
+ 				FacesPartitioning(&my_faces,iomodel);
+ 				for(i=0;i<iomodel->numberoffaces;i++){
+ 					if(iomodel->faces[i*6+5]==2){/*Vertical quads*/
+@@ -308,7 +308,7 @@
+ 				}
+ 			}
+ 			id0 = id0+iomodel->numberofvertices+iomodel->numberofedges;
+-	      if(iomodel->meshxdim==Mesh3DEnum){
++	      if(iomodel->domaintype==Mesh3DEnum){
+ 				FacesPartitioning(&my_faces,iomodel);
+ 				for(i=0;i<iomodel->numberoffaces;i++){
+ 					if(iomodel->faces[i*6+5]==2){/*Vertical quads*/
+@@ -327,7 +327,7 @@
+ 			}
+ 
+ 			/*P1 pressure*/
+-	      if(iomodel->meshxdim==Mesh3DEnum){
++	      if(iomodel->domaintype==Mesh3DEnum){
+ 				numberoffaces=iomodel->numberoffaces;
+ 			}
+ 			else{
+Index: ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17686)
+@@ -50,7 +50,7 @@
+ 			/*Nothing else to do*/
+ 			break;
+ 		case P1bubbleEnum:
+-			switch(iomodel->meshxdim){
++			switch(iomodel->domaintype){
+ 				case Mesh2DhorizontalEnum: elementnbv = 3; break;
+ 				case Mesh2DverticalEnum:   elementnbv = 3; break;
+ 				case Mesh3DtetrasEnum:     elementnbv = 4; break;
+@@ -72,7 +72,7 @@
+ 			break;
+ 		case P2Enum:
+ 			EdgesPartitioning(&my_edges,iomodel);
+-	      if(iomodel->meshxdim==Mesh3DEnum){
++	      if(iomodel->domaintype==Mesh3DEnum){
+ 				FacesPartitioning(&my_faces,iomodel);
+ 			}
+ 			break;
+@@ -117,7 +117,7 @@
+ 						}
+ 					}
+ 				}
+-				if(iomodel->meshxdim==Mesh3DEnum){
++				if(iomodel->domaintype==Mesh3DEnum){
+ 					for(i=0;i<iomodel->numberoffaces;i++){
+ 						if(iomodel->faces[i*6+5]==2){/*Vertical quads*/
+ 							if(my_faces[i]){
+Index: ../trunk-jpl/src/c/cores/surfaceslope_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/surfaceslope_core.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/cores/surfaceslope_core.cpp	(revision 17686)
+@@ -13,11 +13,11 @@
+ 
+ 	/*parameters: */
+ 	bool save_results;
+-	int  meshxdim;
++	int  domaintype;
+ 
+ 	/*Recover some parameters: */
+ 	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
+-	femmodel->parameters->FindParam(&meshxdim,MeshXDimEnum);
++	femmodel->parameters->FindParam(&domaintype,DomainTypeEnum);
+ 
+ 	if(VerboseSolution()) _printf0_("computing slope...\n");
+ 
+@@ -27,18 +27,18 @@
+ 	femmodel->parameters->SetParam(SurfaceSlopeXEnum,InputToL2ProjectEnum);
+ 	solutionsequence_linear(femmodel);
+ 
+-	if(meshxdim!=Mesh2DverticalEnum){
++	if(domaintype!=Mesh2DverticalEnum){
+ 		femmodel->parameters->SetParam(SurfaceSlopeYEnum,InputToL2ProjectEnum);
+ 		solutionsequence_linear(femmodel);
+ 	}
+-	if(meshxdim==Mesh2DverticalEnum){
++	if(domaintype==Mesh2DverticalEnum){
+ 		femmodel->parameters->SetParam(SurfaceSlopeXEnum,InputToExtrudeEnum);
+ 		extrudefrombase_core(femmodel);
+ 	}
+ 
+ 	if(save_results){
+ 		if(VerboseSolution()) _printf0_("saving results:\n");
+-		if(meshxdim!=Mesh2DverticalEnum){
++		if(domaintype!=Mesh2DverticalEnum){
+ 			int outputs[2] = {SurfaceSlopeXEnum,SurfaceSlopeYEnum};
+ 			femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],2);
+ 
+Index: ../trunk-jpl/src/c/cores/transient_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17686)
+@@ -25,7 +25,7 @@
+ 	bool   save_results,dakota_analysis;
+ 	bool   time_adapt=false;
+ 	int    output_frequency;
+-	int    meshxdim,groundingline_migration,smb_model;
++	int    domaintype,groundingline_migration,smb_model;
+ 	int    numoutputs         = 0;
+   Analysis *analysis = NULL;
+ 	char** requested_outputs = NULL;
+@@ -36,7 +36,7 @@
+ 	IssmDouble time;
+ 
+ 	//first recover parameters common to all solutions
+-	femmodel->parameters->FindParam(&meshxdim,MeshXDimEnum);
++	femmodel->parameters->FindParam(&domaintype,DomainTypeEnum);
+ 	femmodel->parameters->FindParam(&starttime,TimesteppingStartTimeEnum);
+ 	femmodel->parameters->FindParam(&finaltime,TimesteppingFinalTimeEnum);
+ 	femmodel->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+@@ -65,7 +65,7 @@
+ 		if(isstressbalance){
+ 			InputDuplicatex(femmodel,QmuVxEnum,VxEnum);
+ 			InputDuplicatex(femmodel,QmuVyEnum,VyEnum);
+-			if(meshxdim==Mesh3DEnum){
++			if(domaintype==Mesh3DEnum){
+ 				InputDuplicatex(femmodel,QmuVzEnum,VzEnum);
+ 				if(isFS)InputDuplicatex(femmodel,QmuPressureEnum,PressureEnum);
+ 			}
+@@ -77,7 +77,7 @@
+ 			InputDuplicatex(femmodel,QmuMaskIceLevelsetEnum,MaskIceLevelsetEnum);
+ 		}
+ 		if(isgroundingline) InputDuplicatex(femmodel,QmuMaskGroundediceLevelsetEnum,MaskGroundediceLevelsetEnum);
+-		if(isthermal && meshxdim==Mesh3DEnum){
++		if(isthermal && domaintype==Mesh3DEnum){
+ 			//Update Vertex Position after updating Thickness and Bed
+ 			femmodel->SetCurrentConfiguration(MasstransportAnalysisEnum);
+ 			femmodel->UpdateVertexPositionsx();
+@@ -113,7 +113,7 @@
+ 		 save_results=false;
+ 		femmodel->parameters->SetParam(save_results,SaveResultsEnum);
+ 
+-		if(isthermal && meshxdim==Mesh3DEnum){
++		if(isthermal && domaintype==Mesh3DEnum){
+ 			if(VerboseSolution()) _printf0_("   computing thermal regime\n");
+ 			thermal_core(femmodel);
+ 		}
+Index: ../trunk-jpl/src/c/cores/masstransport_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/masstransport_core.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/cores/masstransport_core.cpp	(revision 17686)
+@@ -13,7 +13,7 @@
+ 
+ 	/*parameters: */
+ 	int    i;
+-	int    numoutputs,meshxdim;
++	int    numoutputs,domaintype;
+ 	bool   save_results;
+ 	bool   issmbgradients,ispdd,isdelta18o,isFS,isfreesurface,dakota_analysis;
+ 	int    solution_type;
+@@ -28,7 +28,7 @@
+ 	femmodel->parameters->FindParam(&isfreesurface,MasstransportIsfreesurfaceEnum);
+ 	femmodel->parameters->FindParam(&dakota_analysis,QmuIsdakotaEnum);
+ 	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
+-	femmodel->parameters->FindParam(&meshxdim,MeshXDimEnum);
++	femmodel->parameters->FindParam(&domaintype,DomainTypeEnum);
+ 	femmodel->parameters->FindParam(&numoutputs,MasstransportNumRequestedOutputsEnum);
+ 	if(numoutputs) femmodel->parameters->FindParam(&requested_outputs,&numoutputs,MasstransportRequestedOutputsEnum);
+ 
+@@ -47,13 +47,13 @@
+ 		if(VerboseSolution()) _printf0_("   call free surface computational core\n");
+ 		femmodel->SetCurrentConfiguration(FreeSurfaceBaseAnalysisEnum);
+ 		solutionsequence_linear(femmodel);
+-		if(meshxdim!=Mesh2DhorizontalEnum){
++		if(domaintype!=Mesh2DhorizontalEnum){
+ 			femmodel->parameters->SetParam(BaseEnum,InputToExtrudeEnum);
+ 			extrudefrombase_core(femmodel);
+ 		}
+ 		femmodel->SetCurrentConfiguration(FreeSurfaceTopAnalysisEnum);
+ 		solutionsequence_linear(femmodel);
+-		if(meshxdim!=Mesh2DhorizontalEnum){
++		if(domaintype!=Mesh2DhorizontalEnum){
+ 			femmodel->parameters->SetParam(SurfaceEnum,InputToExtrudeEnum);
+ 			extrudefromtop_core(femmodel);
+ 		}
+@@ -61,7 +61,7 @@
+ 	else{
+ 		if(VerboseSolution()) _printf0_("   call computational core\n");
+ 		solutionsequence_linear(femmodel);
+-		if(meshxdim==Mesh2DverticalEnum){
++		if(domaintype==Mesh2DverticalEnum){
+ 			femmodel->parameters->SetParam(ThicknessEnum,InputToExtrudeEnum);
+ 			extrudefrombase_core(femmodel);
+ 			femmodel->parameters->SetParam(BaseEnum,InputToExtrudeEnum);
+Index: ../trunk-jpl/src/c/cores/stressbalance_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/stressbalance_core.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/cores/stressbalance_core.cpp	(revision 17686)
+@@ -14,7 +14,7 @@
+ 
+ 	/*parameters: */
+ 	bool       dakota_analysis;
+-	int        meshxdim;
++	int        domaintype;
+ 	bool       isSIA,isSSA,isL1L2,isHO,isFS;
+ 	bool       save_results;
+ 	int        solution_type;
+@@ -23,7 +23,7 @@
+ 	Analysis  *analysis          = NULL;
+ 
+ 	/* recover parameters:*/
+-	femmodel->parameters->FindParam(&meshxdim,MeshXDimEnum);
++	femmodel->parameters->FindParam(&domaintype,DomainTypeEnum);
+ 	femmodel->parameters->FindParam(&isSIA,FlowequationIsSIAEnum);
+ 	femmodel->parameters->FindParam(&isSSA,FlowequationIsSSAEnum);
+ 	femmodel->parameters->FindParam(&isL1L2,FlowequationIsL1L2Enum);
+@@ -39,12 +39,12 @@
+ 	if(dakota_analysis && solution_type==StressbalanceSolutionEnum){
+ 		InputDuplicatex(femmodel,QmuVxEnum,VxEnum);
+ 		InputDuplicatex(femmodel,QmuVyEnum,VyEnum);
+-		if(meshxdim==Mesh3DEnum) InputDuplicatex(femmodel,QmuVzEnum,VzEnum);
++		if(domaintype==Mesh3DEnum) InputDuplicatex(femmodel,QmuVzEnum,VzEnum);
+ 		if(isFS) InputDuplicatex(femmodel,QmuPressureEnum,PressureEnum);
+ 	}
+ 
+ 	/*Compute slopes if necessary */
+-	if(isSIA || (isFS && meshxdim==Mesh2DverticalEnum)) surfaceslope_core(femmodel);
++	if(isSIA || (isFS && domaintype==Mesh2DverticalEnum)) surfaceslope_core(femmodel);
+ 	if(isFS){
+ 		bedslope_core(femmodel);
+ 		femmodel->SetCurrentConfiguration(StressbalanceAnalysisEnum);
+@@ -73,7 +73,7 @@
+ 	}
+ 
+ 	/*Compute vertical velocities*/
+-	if (meshxdim==Mesh3DEnum && (isSIA || isSSA || isL1L2 || isHO)){
++	if (domaintype==Mesh3DEnum && (isSIA || isSSA || isL1L2 || isHO)){
+ 		analysis = new StressbalanceVerticalAnalysis();
+ 		analysis->Core(femmodel);
+ 		delete analysis;
+Index: ../trunk-jpl/src/c/cores/levelsetfunctionslope_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/levelsetfunctionslope_core.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/cores/levelsetfunctionslope_core.cpp	(revision 17686)
+@@ -13,11 +13,11 @@
+ 
+ 	/*parameters: */
+ 	bool save_results;
+-	int  meshxdim;
++	int  domaintype;
+ 
+ 	/*Recover some parameters: */
+ 	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
+-	femmodel->parameters->FindParam(&meshxdim,MeshXDimEnum);
++	femmodel->parameters->FindParam(&domaintype,DomainTypeEnum);
+ 
+ 	if(VerboseSolution()) _printf0_("computing slope of levelset function...\n");
+ 
+@@ -27,18 +27,18 @@
+ 	femmodel->parameters->SetParam(LevelsetfunctionSlopeXEnum,InputToL2ProjectEnum);
+ 	solutionsequence_linear(femmodel);
+ 
+-	if(meshxdim!=Mesh2DverticalEnum){
++	if(domaintype!=Mesh2DverticalEnum){
+ 		femmodel->parameters->SetParam(LevelsetfunctionSlopeYEnum,InputToL2ProjectEnum);
+ 		solutionsequence_linear(femmodel);
+ 	}
+-	if(meshxdim==Mesh2DverticalEnum){
++	if(domaintype==Mesh2DverticalEnum){
+ 	      femmodel->parameters->SetParam(LevelsetfunctionSlopeXEnum,InputToExtrudeEnum);
+ 		extrudefrombase_core(femmodel);
+ 	}
+ 
+ 	if(save_results){
+ 		if(VerboseSolution()) _printf0_("saving results:\n");
+-		if(meshxdim!=Mesh2DverticalEnum){
++		if(domaintype!=Mesh2DverticalEnum){
+ 			int outputs[2] = {LevelsetfunctionSlopeXEnum,LevelsetfunctionSlopeYEnum};
+ 			femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],2);
+ 
+Index: ../trunk-jpl/src/c/cores/bedslope_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/bedslope_core.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/cores/bedslope_core.cpp	(revision 17686)
+@@ -13,11 +13,11 @@
+ 
+ 	/*parameters: */
+ 	bool save_results;
+-	int  meshxdim;
++	int  domaintype;
+ 
+ 	/*Recover some parameters: */
+ 	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
+-	femmodel->parameters->FindParam(&meshxdim,MeshXDimEnum);
++	femmodel->parameters->FindParam(&domaintype,DomainTypeEnum);
+ 
+ 	if(VerboseSolution()) _printf0_("   computing slope\n");
+ 
+@@ -27,14 +27,14 @@
+ 	femmodel->parameters->SetParam(BedSlopeXEnum,InputToL2ProjectEnum);
+ 	solutionsequence_linear(femmodel);
+ 
+-	if(meshxdim!=Mesh2DverticalEnum){
++	if(domaintype!=Mesh2DverticalEnum){
+ 		femmodel->parameters->SetParam(BedSlopeYEnum,InputToL2ProjectEnum);
+ 		solutionsequence_linear(femmodel);
+ 	}
+ 
+ 	if(save_results){
+ 		if(VerboseSolution()) _printf0_("   saving results\n");
+-		if(meshxdim!=Mesh2DverticalEnum){
++		if(domaintype!=Mesh2DverticalEnum){
+ 			int outputs[2] = {BedSlopeXEnum,BedSlopeYEnum};
+ 			femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],2);
+ 		}
+Index: ../trunk-jpl/src/c/classes/Vertex.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Vertex.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/classes/Vertex.cpp	(revision 17686)
+@@ -31,10 +31,10 @@
+ 	this->x            = iomodel->Data(MeshXEnum)[i];
+ 	this->y            = iomodel->Data(MeshYEnum)[i];
+ 	this->z            = iomodel->Data(MeshZEnum)[i];
+-	this->meshxdim     = iomodel->meshxdim;
++	this->domaintype     = iomodel->domaintype;
+ 
+ 	_assert_(iomodel->Data(BaseEnum) && iomodel->Data(ThicknessEnum) && iomodel->numbernodetoelementconnectivity);
+-	switch(iomodel->meshxdim){
++	switch(iomodel->domaintype){
+ 		case Mesh3DEnum:
+ 		case Mesh2DhorizontalEnum:
+ 			this->sigma = (iomodel->Data(MeshZEnum)[i]-iomodel->Data(BaseEnum)[i])/(iomodel->Data(ThicknessEnum)[i]);
+@@ -131,7 +131,7 @@
+ 	parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+ 
+ 	/*sigma remains constant. z=bed+sigma*thickness*/
+-	switch(this->meshxdim){
++	switch(this->domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			/*Nothing*/
+ 			return;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17686)
+@@ -100,9 +100,9 @@
+ 	/*Call inputs method*/
+ 	_assert_(this->inputs);
+ 	
+-	int meshxdim;
+-	parameters->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	int domaintype;
++	parameters->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			this->inputs->AddInput(new TriaInput(input_enum,values,interpolation_enum));
+ 			break;
+@@ -122,7 +122,7 @@
+ 			else _error_("not implemented yet");
+ 			}
+ 			break;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+ }
+@@ -164,14 +164,14 @@
+ 	IssmDouble	sigma_xz[NUMVERTICES]={0,0,0};
+ 	IssmDouble	sigma_yz[NUMVERTICES]={0,0,0};
+ 	GaussTria*  gauss=NULL;
+-	int meshxdim,dim=2;
++	int domaintype,dim=2;
+ 
+ 	/* Get node coordinates and dof list: */
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*Retrieve all inputs we will be needing: */
+-	this->FindParam(&meshxdim,MeshXDimEnum);
+-	if(meshxdim==Mesh2DhorizontalEnum) _error_("stress tensor calculation not supported for mesh of type " <<EnumToStringx(meshxdim)<<", extrude mesh or call ComputeDeviatoricStressTensor");
++	this->FindParam(&domaintype,DomainTypeEnum);
++	if(domaintype==Mesh2DhorizontalEnum) _error_("stress tensor calculation not supported for mesh of type " <<EnumToStringx(domaintype)<<", extrude mesh or call ComputeDeviatoricStressTensor");
+ 	Input* pressure_input=inputs->GetInput(PressureEnum); _assert_(pressure_input);
+ 	Input* vx_input=inputs->GetInput(VxEnum);             _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum);             _assert_(vy_input);
+@@ -217,14 +217,14 @@
+ 	IssmDouble	tau_xz[NUMVERTICES]={0,0,0};
+ 	IssmDouble	tau_yz[NUMVERTICES]={0,0,0};
+ 	GaussTria*  gauss=NULL;
+-	int meshxdim,dim=2;
++	int domaintype,dim=2;
+ 
+ 	/* Get node coordinates and dof list: */
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+ 
+ 	/*Retrieve all inputs we will be needing: */
+-	this->FindParam(&meshxdim,MeshXDimEnum);
+-	if(meshxdim!=Mesh2DhorizontalEnum) _error_("deviatoric stress tensor calculation not implemented for mesh of type " <<EnumToStringx(meshxdim));
++	this->FindParam(&domaintype,DomainTypeEnum);
++	if(domaintype!=Mesh2DhorizontalEnum) _error_("deviatoric stress tensor calculation not implemented for mesh of type " <<EnumToStringx(domaintype));
+ 	Input* vx_input=inputs->GetInput(VxEnum);             _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum);             _assert_(vy_input);
+ 
+@@ -513,14 +513,14 @@
+ 	/*Computeportion of the element that is grounded*/ 
+ 
+ 	bool              mainlyfloating = true;
+-	int               meshxdim,index1,index2;
++	int               domaintype,index1,index2;
+ 	const IssmPDouble epsilon        = 1.e-15;
+ 	IssmDouble        phi,s1,s2,area_init,area_grounded;
+ 	IssmDouble        gl[NUMVERTICES];
+ 	IssmDouble        xyz_bis[3][3];
+ 
+ 	/*Recover parameters and values*/
+-	parameters->FindParam(&meshxdim,MeshXDimEnum);
++	parameters->FindParam(&domaintype,DomainTypeEnum);
+ 	GetInputListOnVertices(&gl[0],MaskGroundediceLevelsetEnum);
+ 
+ 	/*Be sure that values are not zero*/
+@@ -528,7 +528,7 @@
+ 	if(gl[1]==0.) gl[1]=gl[1]+epsilon;
+ 	if(gl[2]==0.) gl[2]=gl[2]+epsilon;
+ 
+-	if(meshxdim==Mesh2DverticalEnum){
++	if(domaintype==Mesh2DverticalEnum){
+ 		this->EdgeOnBaseIndices(&index1,&index2);
+ 		if(gl[index1]>0 && gl[index2]>0) phi=1; // All grounded
+ 		else if(gl[index1]<0 && gl[index2]<0) phi=0; // All floating
+@@ -540,7 +540,7 @@
+ 		}
+ 
+ 	}
+-	else if(meshxdim==Mesh2DhorizontalEnum || meshxdim==Mesh3DEnum){
++	else if(domaintype==Mesh2DhorizontalEnum || domaintype==Mesh3DEnum){
+ 		/*Check that not all nodes are grounded or floating*/
+ 		if(gl[0]>0 && gl[1]>0 && gl[2]>0){ // All grounded
+ 			phi=1;
+@@ -620,7 +620,7 @@
+ 			phi=area_grounded/area_init;
+ 		}
+ 	}
+-	else _error_("mesh type "<<EnumToStringx(meshxdim)<<"not supported yet ");
++	else _error_("mesh type "<<EnumToStringx(domaintype)<<"not supported yet ");
+ 
+ 	if(phi>1 || phi<0) _error_("Error. Problem with portion of grounded element: value should be between 0 and 1");
+ 
+@@ -1162,28 +1162,28 @@
+ /*FUNCTION Tria::IsOnBase {{{*/
+ bool Tria::IsOnBase(){
+ 
+-	int meshxdim;
+-	this->parameters->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	int domaintype;
++	this->parameters->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum:
+ 			return HasEdgeOnBase();
+ 		case Mesh2DhorizontalEnum:
+ 			return true;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ }
+ /*}}}*/
+ /*FUNCTION Tria::IsOnSurface {{{*/
+ bool Tria::IsOnSurface(){
+ 
+-	int meshxdim;
+-	this->parameters->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	int domaintype;
++	this->parameters->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DverticalEnum:
+ 			return HasEdgeOnSurface();
+ 		case Mesh2DhorizontalEnum:
+ 			return true;
+-		default: _error_("mesh "<<EnumToStringx(meshxdim)<<" not supported yet");
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ }
+ /*}}}*/
+@@ -1840,10 +1840,10 @@
+ Element*  Tria::SpawnBasalElement(void){
+ 
+ 	int index1,index2;
+-	int meshxdim;
++	int domaintype;
+ 
+-	this->parameters->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	this->parameters->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			return this;
+ 		case Mesh2DverticalEnum:
+@@ -1859,10 +1859,10 @@
+ Element*  Tria::SpawnTopElement(void){
+ 
+ 	int index1,index2;
+-	int meshxdim;
++	int domaintype;
+ 
+-	this->parameters->FindParam(&meshxdim,MeshXDimEnum);
+-	switch(meshxdim){
++	this->parameters->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			return this;
+ 		case Mesh2DverticalEnum:
+@@ -2218,9 +2218,9 @@
+ 	base_input->GetInputAverage(&bed);
+ 
+ 	/*Return: */
+-	int meshxdim;
+-	parameters->FindParam(&meshxdim,MeshXDimEnum);
+-	if(meshxdim==Mesh2DverticalEnum){
++	int domaintype;
++	parameters->FindParam(&domaintype,DomainTypeEnum);
++	if(domaintype==Mesh2DverticalEnum){
+ 	  return base;
+ 	}
+ 	else{
+@@ -2262,7 +2262,7 @@
+ /*FUNCTION Tria::MassFlux {{{*/
+ IssmDouble Tria::MassFlux( IssmDouble x1, IssmDouble y1, IssmDouble x2, IssmDouble y2,int segment_id){
+ 
+-	int        meshxdim;
++	int        domaintype;
+ 	IssmDouble mass_flux=0.;
+ 	IssmDouble xyz_list[NUMVERTICES][3];
+ 	IssmDouble normal[2];
+@@ -2293,10 +2293,10 @@
+ 	length=sqrt(pow(x2-x1,2)+pow(y2-y1,2));
+ 
+ 	Input* thickness_input=inputs->GetInput(ThicknessEnum); _assert_(thickness_input);
+-	this->parameters->FindParam(&meshxdim,MeshXDimEnum);
++	this->parameters->FindParam(&domaintype,DomainTypeEnum);
+ 	Input* vx_input=NULL;
+ 	Input* vy_input=NULL;
+-	if(meshxdim==Mesh2DhorizontalEnum){
++	if(domaintype==Mesh2DhorizontalEnum){
+ 		vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+ 		vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+ 	}
+@@ -2326,7 +2326,7 @@
+ /*FUNCTION Tria::MassFlux {{{*/
+ IssmDouble Tria::MassFlux( IssmDouble* segment){
+ 
+-	int        meshxdim;
++	int        domaintype;
+ 	IssmDouble mass_flux=0.;
+ 	IssmDouble xyz_list[NUMVERTICES][3];
+ 	IssmDouble normal[2];
+@@ -2360,10 +2360,10 @@
+ 	length=sqrt(pow(x2-x1,2)+pow(y2-y1,2));
+ 
+ 	Input* thickness_input=inputs->GetInput(ThicknessEnum); _assert_(thickness_input);
+-	this->parameters->FindParam(&meshxdim,MeshXDimEnum);
++	this->parameters->FindParam(&domaintype,DomainTypeEnum);
+ 	Input* vx_input=NULL;
+ 	Input* vy_input=NULL;
+-	if(meshxdim==Mesh2DhorizontalEnum){
++	if(domaintype==Mesh2DhorizontalEnum){
+ 		vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+ 		vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+ 	}
+Index: ../trunk-jpl/src/c/classes/IoModel.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/IoModel.h	(revision 17685)
++++ ../trunk-jpl/src/c/classes/IoModel.h	(revision 17686)
+@@ -30,7 +30,7 @@
+ 		int  *my_vertices;
+ 
+ 		/*Mesh properties and connectivity tables*/
+-		int  meshxdim;
++		int  domaintype;
+ 		int  numberofvertices;
+ 		int  numberofelements;
+ 		int  numberoffaces;
+Index: ../trunk-jpl/src/c/classes/Vertex.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Vertex.h	(revision 17685)
++++ ../trunk-jpl/src/c/classes/Vertex.h	(revision 17686)
+@@ -20,7 +20,7 @@
+ 
+ 	public: 
+ 		bool       clone;
+-		int        meshxdim;
++		int        domaintype;
+ 		int        id;           // random index
+ 		int        sid;          // "serial" id (rank of this vertex if the dataset was on 1 cpu)
+ 		int        pid;          // "parallel" id
+Index: ../trunk-jpl/src/c/classes/Node.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Node.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/classes/Node.cpp	(revision 17686)
+@@ -42,7 +42,7 @@
+ 	this->indexingupdate = true;
+ 
+ 	Analysis* analysis = EnumToAnalysis(analysis_enum);
+-	int numdofs        = analysis->DofsPerNode(&doftypes,iomodel->meshxdim,in_approximation);
++	int numdofs        = analysis->DofsPerNode(&doftypes,iomodel->domaintype,in_approximation);
+ 	indexing.Init(numdofs,doftypes);
+ 	xDelete<int>(doftypes);
+ 	delete analysis;
+@@ -60,7 +60,7 @@
+ 		XZvectorsToCoordinateSystem(&this->coord_system[0][0],&iomodel->Data(StressbalanceReferentialEnum)[io_index*6]);
+ 		_assert_(sqrt( coord_system[0][0]*coord_system[0][0] + coord_system[1][0]*coord_system[1][0]) >1.e-4);
+ 
+-		if(iomodel->meshxdim!=Mesh2DhorizontalEnum){
++		if(iomodel->domaintype!=Mesh2DhorizontalEnum){
+ 			/*We have a  3d mesh, we may have collapsed elements, hence dead nodes. Freeze them out: */
+ 			_assert_(iomodel->Data(MeshVertexonbaseEnum)); 
+ 			_assert_(iomodel->Data(FlowequationVertexEquationEnum));
+@@ -100,7 +100,7 @@
+ 				analysis_enum==LevelsetAnalysisEnum ||
+ 				analysis_enum==ExtrapolationAnalysisEnum
+ 				){
+-		if(iomodel->meshxdim!=Mesh2DhorizontalEnum){
++		if(iomodel->domaintype!=Mesh2DhorizontalEnum){
+ 			/*On a 3d mesh, we may have collapsed elements, hence dead nodes. Freeze them out: */
+ 			_assert_(iomodel->Data(MeshVertexonbaseEnum));
+ 			if(!(reCast<bool>(iomodel->Data(MeshVertexonbaseEnum)[io_index]))){
+@@ -111,7 +111,7 @@
+ 	if(
+ 				analysis_enum==FreeSurfaceTopAnalysisEnum
+ 				){
+-		if(iomodel->meshxdim!=Mesh2DhorizontalEnum){
++		if(iomodel->domaintype!=Mesh2DhorizontalEnum){
+ 			/*On a 3d mesh, we may have collapsed elements, hence dead nodes. Freeze them out: */
+ 			_assert_(iomodel->Data(MeshVertexonsurfaceEnum));
+ 			if(!(reCast<bool>(iomodel->Data(MeshVertexonsurfaceEnum)[io_index]))){
+Index: ../trunk-jpl/src/c/classes/IoModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 17685)
++++ ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 17686)
+@@ -29,7 +29,7 @@
+ 	this->my_elements=NULL;
+ 	this->my_vertices=NULL;
+ 
+-	this->meshxdim=-1;
++	this->domaintype=-1;
+ 	this->numberofvertices=-1;
+ 	this->numberofelements=-1;
+ 	this->numberoffaces=-1;
+@@ -74,7 +74,7 @@
+ 	this->my_elements = NULL;
+ 	this->my_vertices = NULL;
+ 
+-	FetchData(&this->meshxdim,MeshXDimEnum);
++	FetchData(&this->domaintype,DomainTypeEnum);
+ 	FetchData(&this->numberofvertices,MeshNumberofverticesEnum);
+ 	FetchData(&this->numberofelements,MeshNumberofelementsEnum);
+ 	FetchData(&this->elements,NULL,NULL,MeshElementsEnum);
+Index: ../trunk-jpl/src/wrappers/MeshPartition/MeshPartition.cpp
+===================================================================
+--- ../trunk-jpl/src/wrappers/MeshPartition/MeshPartition.cpp	(revision 17685)
++++ ../trunk-jpl/src/wrappers/MeshPartition/MeshPartition.cpp	(revision 17686)
+@@ -18,7 +18,7 @@
+ 	int i,j;
+ 
+ 	/* required input: */
+-	int  meshxdim;
++	int  domaintype;
+ 	int  numberofelements;
+ 	int  numberofvertices;
+ 	int *elements         = NULL;
+@@ -49,18 +49,18 @@
+ 	FetchData(&elements,NULL,&elements_width,mxGetAssignedField(MESH,0,"elements"));
+ 
+ 	if(strcmp(mxGetClassName(MESH),"mesh3d")==0){
+-		meshxdim = Mesh3DEnum;
++		domaintype = Mesh3DEnum;
+ 		FetchData(&numberofelements2d,mxGetAssignedField(MESH,0,"numberofelements2d"));
+ 		FetchData(&numberofvertices2d,mxGetAssignedField(MESH,0,"numberofvertices2d"));
+ 		FetchData(&elements2d,NULL,NULL,mxGetAssignedField(MESH,0,"elements2d"));
+ 		FetchData(&numberoflayers,mxGetAssignedField(MESH,0,"numberoflayers"));
+ 	}
+ 	else if(strcmp(mxGetClassName(MESH),"mesh2dhorizontal")==0){
+-		meshxdim = Mesh2DhorizontalEnum;
++		domaintype = Mesh2DhorizontalEnum;
+ 		numberoflayers=1;
+ 	}
+ 	else if(strcmp(mxGetClassName(MESH),"mesh2dvertical")==0){
+-		meshxdim = Mesh2DverticalEnum;
++		domaintype = Mesh2DverticalEnum;
+ 		numberoflayers=1;
+ 	}
+ 	else{
+@@ -70,7 +70,7 @@
+ 
+ 	/*Run partitioning algorithm based on a "clever" use of the Metis partitioner: */
+ 	MeshPartitionx(&int_element_partitioning,&int_node_partitioning,numberofelements,numberofvertices,elements,
+-		numberofelements2d,numberofvertices2d,elements2d,numberoflayers,elements_width,meshxdim,numareas);
++		numberofelements2d,numberofvertices2d,elements2d,numberoflayers,elements_width,domaintype,numareas);
+ 
+ 	/*Post process node_partitioning and element_partitioning to be in double format. Metis needed them in int* format: */
+ 	element_partitioning=xNew<double>(numberofelements);
+Index: ../trunk-jpl/src/m/geometry/slope.py
+===================================================================
+--- ../trunk-jpl/src/m/geometry/slope.py	(revision 17685)
++++ ../trunk-jpl/src/m/geometry/slope.py	(revision 17686)
+@@ -11,7 +11,7 @@
+ 	"""
+ 
+ 	#load some variables (it is much faster if the variables are loaded from md once for all) 
+-	if md.mesh.meshdim()==2:
++	if md.mesh.dimension()==2:
+ 		numberofelements=md.mesh.numberofelements
+ 		numberofnodes=md.mesh.numberofvertices
+ 		index=md.mesh.elements
+@@ -38,7 +38,7 @@
+ 
+ 	s=npy.sqrt(sx**2+sy**2)
+ 
+-	if md.mesh.meshdim()==3:
++	if md.mesh.dimension()==3:
+ 		sx=project3d(md,'vector',sx,'type','element')
+ 		sy=project3d(md,'vector',sy,'type','element')
+ 		s=npy.sqrt(sx**2+sy**2)
+Index: ../trunk-jpl/src/m/geometry/slope.m
+===================================================================
+--- ../trunk-jpl/src/m/geometry/slope.m	(revision 17685)
++++ ../trunk-jpl/src/m/geometry/slope.m	(revision 17686)
+@@ -6,7 +6,7 @@
+ %      [sx,sy,s]=slope(md,md.results.TransientSolution(1).Surface)
+ 
+ %load some variables (it is much faster if the variab;es are loaded from md once for all) 
+-if meshdim(md.mesh)==2,
++if dimension(md.mesh)==2,
+ 	numberofelements=md.mesh.numberofelements;
+ 	numberofnodes=md.mesh.numberofvertices;
+ 	index=md.mesh.elements;
+@@ -29,7 +29,7 @@
+ sy=(surf(index).*beta)*summation;
+ s=sqrt(sx.^2+sy.^2);
+ 
+-if meshdim(md.mesh)==3,
++if dimension(md.mesh)==3,
+ 	sx=project3d(md,'vector',sx,'type','element');
+ 	sy=project3d(md,'vector',sy,'type','element');
+ 	s=sqrt(sx.^2+sy.^2);
+Index: ../trunk-jpl/src/m/exp/contourlevelzero.m
+===================================================================
+--- ../trunk-jpl/src/m/exp/contourlevelzero.m	(revision 17685)
++++ ../trunk-jpl/src/m/exp/contourlevelzero.m	(revision 17686)
+@@ -9,7 +9,7 @@
+ %   See also: PLOT_CONTOUR
+ 
+ %process data 
+-if meshdim(md.mesh)==3,
++if dimension(md.mesh)==3,
+ 	error('contourlevelzero error message: routine not supported for 3d meshes, project on a layer');
+ end
+ 
+Index: ../trunk-jpl/src/m/inversions/velocitymisfit.m
+===================================================================
+--- ../trunk-jpl/src/m/inversions/velocitymisfit.m	(revision 17685)
++++ ../trunk-jpl/src/m/inversions/velocitymisfit.m	(revision 17686)
+@@ -8,7 +8,7 @@
+ %      J=misfit(md)
+ %
+ 
+-if meshdim(md.mesh)==2,
++if dimension(md.mesh)==2,
+ 	elements=md.mesh.elements;
+ 	x=md.mesh.x;
+ 	y=md.mesh.y;
+Index: ../trunk-jpl/src/m/miscellaneous/vorticity.m
+===================================================================
+--- ../trunk-jpl/src/m/miscellaneous/vorticity.m	(revision 17685)
++++ ../trunk-jpl/src/m/miscellaneous/vorticity.m	(revision 17686)
+@@ -8,7 +8,7 @@
+ 
+ 
+ %load some variables (it is much faster if the variab;es are loaded from md once for all) 
+-if ~strcmpi(md.mesh.meshxdim(),'3D'),
++if ~strcmpi(md.mesh.domaintype(),'3D'),
+ 	numberofelements=md.mesh.numberofelements;
+ 	numberofnodes=md.mesh.numberofvertices;
+ 	index=md.mesh.elements;
+Index: ../trunk-jpl/src/m/partition/AreaAverageOntoPartition.m
+===================================================================
+--- ../trunk-jpl/src/m/partition/AreaAverageOntoPartition.m	(revision 17685)
++++ ../trunk-jpl/src/m/partition/AreaAverageOntoPartition.m	(revision 17686)
+@@ -8,7 +8,7 @@
+ %      average=AreaAverageOntoPartition(md,vector,layer) %if in 3D, chose which layer is partitioned
+ 
+ %some checks
+-if meshdim(md.mesh)==3,
++if dimension(md.mesh)==3,
+ 	if nargin~=3,
+ 		error('layer should be provided onto which Area Averaging occurs');
+ 	end
+@@ -50,6 +50,6 @@
+ end
+ 
+ %in 3D, restore 3D model:
+-if meshdim(md.mesh)==3,
++if dimension(md.mesh)==3,
+ 	md=md3d;
+ end
+Index: ../trunk-jpl/src/m/partition/partitioner.m
+===================================================================
+--- ../trunk-jpl/src/m/partition/partitioner.m	(revision 17685)
++++ ../trunk-jpl/src/m/partition/partitioner.m	(revision 17686)
+@@ -29,7 +29,7 @@
+ npart=getfieldvalue(options,'npart');
+ recomputeadjacency=getfieldvalue(options,'recomputeadjacency');
+ 
+-if(meshdim(md.mesh)==3),
++if(dimension(md.mesh)==3),
+ 	%partitioning essentially happens in 2D. So partition in 2D, then 
+ 	%extrude the partition vector vertically. 
+ 	md3d=md; %save  for later
+@@ -99,7 +99,7 @@
+ end
+ 
+ %extrude if we are in 3D:
+-if meshdim(md.mesh)==3,
++if dimension(md.mesh)==3,
+ 	md3d.qmu.vertex_weight=md.qmu.vertex_weight;
+ 	md3d.qmu.adjacency=md.qmu.adjacency;
+ 	md=md3d;
+Index: ../trunk-jpl/src/m/mech/backstressfrominversion.m
+===================================================================
+--- ../trunk-jpl/src/m/mech/backstressfrominversion.m	(revision 17685)
++++ ../trunk-jpl/src/m/mech/backstressfrominversion.m	(revision 17686)
+@@ -40,7 +40,7 @@
+ if isempty(fieldnames(md.results)),
+ 	error(['md.results.strainrate is not present.  Calculate using md=mechanicalproperties(md,vx,vy)']);
+ end
+-if meshdim(md.mesh)~=2,
++if dimension(md.mesh)~=2,
+ 	error('only 2d model supported currently');
+ end
+ if any(md.flowequation.element_equation~=2),
+Index: ../trunk-jpl/src/m/mech/strainrateuncert.m
+===================================================================
+--- ../trunk-jpl/src/m/mech/strainrateuncert.m	(revision 17685)
++++ ../trunk-jpl/src/m/mech/strainrateuncert.m	(revision 17686)
+@@ -31,7 +31,7 @@
+ if length(dvy)~=md.mesh.numberofelements,
+ 	error(['the velocity error dvy should be of size ' num2str(md.mesh.numberofelements) ' or 1!'])
+ end
+-if meshdim(md.mesh)~=2,
++if dimension(md.mesh)~=2,
+ 	error('only 2d model supported yet');
+ end
+ if any(md.flowequation.element_equation~=2),
+Index: ../trunk-jpl/src/m/mech/thomasparams.m
+===================================================================
+--- ../trunk-jpl/src/m/mech/thomasparams.m	(revision 17685)
++++ ../trunk-jpl/src/m/mech/thomasparams.m	(revision 17686)
+@@ -50,7 +50,7 @@
+ if isempty(fieldnames(md.results)),
+ 	error(['md.results.strainrate is not present.  Calculate using md=mechanicalproperties(md,vx,vy)'])
+ end
+-if meshdim(md.mesh)~=2,
++if dimension(md.mesh)~=2,
+ 	error('only 2d model supported currently');
+ end
+ if any(md.flowequation.element_equation~=2),
+Index: ../trunk-jpl/src/m/mech/damagefrominversion.m
+===================================================================
+--- ../trunk-jpl/src/m/mech/damagefrominversion.m	(revision 17685)
++++ ../trunk-jpl/src/m/mech/damagefrominversion.m	(revision 17686)
+@@ -20,7 +20,7 @@
+ if isempty(fieldnames(md.results)),
+ 	error(['md.results.strainrate is not present.  Calculate using md=mechanicalproperties(md,vx,vy)']);
+ end
+-if meshdim(md.mesh)~=2,
++if dimension(md.mesh)~=2,
+ 	error('only 2d model supported currently');
+ end
+ if any(md.flowequation.element_equation~=2),
+Index: ../trunk-jpl/src/m/mech/mechanicalproperties.m
+===================================================================
+--- ../trunk-jpl/src/m/mech/mechanicalproperties.m	(revision 17685)
++++ ../trunk-jpl/src/m/mech/mechanicalproperties.m	(revision 17686)
+@@ -16,7 +16,7 @@
+ if length(vx)~=md.mesh.numberofvertices | length(vy)~=md.mesh.numberofvertices,
+ 	%error(['the input velocity should be of size ' num2str(md.mesh.numberofvertices) '!'])
+ end
+-if meshdim(md.mesh)~=2
++if dimension(md.mesh)~=2
+ 	error('only 2d model supported yet');
+ end
+ if any(md.flowequation.element_equation~=2),
+Index: ../trunk-jpl/src/m/mech/analyticaldamage.m
+===================================================================
+--- ../trunk-jpl/src/m/mech/analyticaldamage.m	(revision 17685)
++++ ../trunk-jpl/src/m/mech/analyticaldamage.m	(revision 17686)
+@@ -47,7 +47,7 @@
+ if isempty(fieldnames(md.results)),
+ 	error(['md.results.strainrate is not present.  Calculate using md=mechanicalproperties(md,vx,vy)']);
+ end
+-if meshdim(md.mesh)~=2,
++if dimension(md.mesh)~=2,
+ 	error('only 2d model supported currently');
+ end
+ if any(md.flowequation.element_equation~=2),
+Index: ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.m
+===================================================================
+--- ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.m	(revision 17685)
++++ ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.m	(revision 17686)
+@@ -51,7 +51,7 @@
+ md.mask.ice_levelset(find(vertexonicefront))=0;
+ 
+ %First find segments that are not completely on the front
+-if ~strcmp(md.mesh.meshxdim(),'3D'),
++if ~strcmp(md.mesh.domaintype(),'3D'),
+ 	numbernodesfront=2;
+ else 
+ 	numbernodesfront=4;
+Index: ../trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py
+===================================================================
+--- ../trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py	(revision 17685)
++++ ../trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py	(revision 17686)
+@@ -43,9 +43,9 @@
+ 	md.mask.ice_levelset[pos]=0
+ 
+ 	#First find segments that are not completely on the front
+-	if m.strcmp(md.mesh.meshtype(),'Penta'):
++	if m.strcmp(md.mesh.elementtype(),'Penta'):
+ 		numbernodesfront=4;
+-	elif m.strcmp(md.mesh.meshtype(),'Tria'):
++	elif m.strcmp(md.mesh.elementtype(),'Tria'):
+ 		numbernodesfront=2;
+ 	else:
+ 		raise	error('mesh type not supported yet')
+Index: ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py
+===================================================================
+--- ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py	(revision 17685)
++++ ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py	(revision 17686)
+@@ -52,7 +52,7 @@
+ 	md.mask.ice_levelset[pos]=0
+ 
+ 	#First find segments that are not completely on the front
+-	if not m.strcmp(md.mesh.meshxdim(),'3D'):
++	if not m.strcmp(md.mesh.domaintype(),'3D'):
+ 		numbernodesfront=2
+ 	else:
+ 		numbernodesfront=4
+Index: ../trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.m
+===================================================================
+--- ../trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.m	(revision 17685)
++++ ../trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.m	(revision 17686)
+@@ -37,9 +37,9 @@
+ md.mask.ice_levelset(find(nodeonicefront))=0;
+ 
+ %First find segments that are not completely on the front
+-if strcmp(meshtype(md.mesh),'Penta'),
++if strcmp(elementtype(md.mesh),'Penta'),
+ 	numbernodesfront=4;
+-elseif strcmp(meshtype(md.mesh),'Tria'),
++elseif strcmp(elementtype(md.mesh),'Tria'),
+ 	numbernodesfront=2;
+ else
+ 	error('mesh type not supported yet');
+Index: ../trunk-jpl/src/m/plot/processmesh.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/processmesh.m	(revision 17685)
++++ ../trunk-jpl/src/m/plot/processmesh.m	(revision 17686)
+@@ -15,7 +15,7 @@
+ end
+ 
+ %special case for mesg 2dvertical
+-if strcmp(meshxdim(md.mesh),'2Dvertical'),
++if strcmp(domaintype(md.mesh),'2Dvertical'),
+ 	[x y z elements is2d isplanet] = processmesh(md.mesh,options);
+ 	return;
+ end
+@@ -45,7 +45,7 @@
+ elements=md.mesh.elements;
+ 
+ %is it a 2d plot?
+-if md.mesh.meshdim()==2,
++if md.mesh.dimension()==2,
+ 	is2d=1;
+ else
+ 	if getfieldvalue(options,'layer',0)>=1,
+Index: ../trunk-jpl/src/m/plot/plot_icefront.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_icefront.m	(revision 17685)
++++ ../trunk-jpl/src/m/plot/plot_icefront.m	(revision 17686)
+@@ -18,7 +18,7 @@
+ elementnoice=sum(noice(md.mesh.elements),2);
+ elementzeroice=sum(zeroice(md.mesh.elements),2);
+ 
+-if (strcmp(meshxdim(md.mesh),'2Dhorizontal')),
++if (strcmp(domaintype(md.mesh),'2Dhorizontal')),
+ 	icefront=(elementice & elementnoice) & ~(elementice==2 & elementzeroice);
+ 
+ 	%plot mesh
+Index: ../trunk-jpl/src/m/plot/plot_tensor_principalaxis.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_tensor_principalaxis.m	(revision 17685)
++++ ../trunk-jpl/src/m/plot/plot_tensor_principalaxis.m	(revision 17686)
+@@ -12,7 +12,7 @@
+ %process data and model
+ [x y z elements is2d isplanet]=processmesh(md,[],options);
+ 
+-if meshdim(md.mesh)==2,
++if dimension(md.mesh)==2,
+ 	eval(['Vx=tensor.principalaxis' type(end) '(:,1); Vy=tensor.principalaxis' type(end) '(:,2);'])
+ 	eval(['value=tensor.principalvalue' type(end) ';']);
+ 	[Vx datatype]=processdata(md,Vx,options);
+@@ -32,7 +32,7 @@
+ end
+ 
+ %plot quivers
+-if meshdim(md.mesh)==2,
++if dimension(md.mesh)==2,
+ 
+ 	%density
+ 	if exist(options,'density')
+Index: ../trunk-jpl/src/m/plot/plot_section.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_section.m	(revision 17685)
++++ ../trunk-jpl/src/m/plot/plot_section.m	(revision 17686)
+@@ -202,14 +202,14 @@
+ 
+ %apply options
+ options=addfielddefault(options,'title','Section value');
+-if meshdim(md.mesh)==2
++if dimension(md.mesh)==2
+ 	options=addfielddefault(options,'colorbar',0);
+ end
+-if ((meshdim(md.mesh)==2) | getfieldvalue(options,'view')==2 )
++if ((dimension(md.mesh)==2) | getfieldvalue(options,'view')==2 )
+ 	options=addfielddefault(options,'xlabel','Curvilinear coordinate');
+ 	options=addfielddefault(options,'axis','auto');
+ end
+-if (meshdim(md.mesh)==3 & getfieldvalue(options,'view')==2 )
++if (dimension(md.mesh)==3 & getfieldvalue(options,'view')==2 )
+ 	options=addfielddefault(options,'ylabel','z');
+ end
+ applyoptions(md,[],options);
+Index: ../trunk-jpl/src/m/plot/plot_tensor_principal.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_tensor_principal.m	(revision 17685)
++++ ../trunk-jpl/src/m/plot/plot_tensor_principal.m	(revision 17686)
+@@ -9,13 +9,13 @@
+ %Compute the indexes of the components plots
+ upperplots=fix((i-1)/width);
+ if upperplots==0, leftplots=i-1; else leftplots=i-width*upperplots-1; end
+-if (meshdim(md.mesh)==2)%3 components -> 3 indexes
++if (dimension(md.mesh)==2)%3 components -> 3 indexes
+ 	index1=4*width*upperplots+2*leftplots+1;
+ 	index2=index1+1;
+ 	index3=index1+width*2;
+ 	index4=index3+1;
+ 	newwidth=2*width;
+-elseif meshdim(md.mesh)==3%6 components -> 6 indexes
++elseif dimension(md.mesh)==3%6 components -> 6 indexes
+ 	index1=3*3*width*upperplots+3*leftplots+1;
+ 	index2=index1+1;
+ 	index3=index1+2;
+@@ -30,7 +30,7 @@
+ plot_tensor_principalaxis(md,options,newwidth,index1,tensor,type1,plot_options);
+ type2=[type 'axis2'];
+ plot_tensor_principalaxis(md,options,newwidth,index2,tensor,type2,plot_options);
+-if  meshdim(md.mesh)==3
++if  dimension(md.mesh)==3
+ 	type3=[type 'axis3'];
+ 	plot_tensor_principalaxis(md,options,newwidth,index3,tensor,type3,plot_options);
+ end
+@@ -39,11 +39,11 @@
+ [x y z elements is2d isplanet]=processmesh(md,[],options);
+ [tensor.principalvalue1 datatype]=processdata(md,tensor.principalvalue1,options);
+ [tensor.principalvalue2 datatype]=processdata(md,tensor.principalvalue2,options);
+-if  meshdim(md.mesh)==3
++if  dimension(md.mesh)==3
+ 	[tensor.principalvalue3 datatype]=processdata(md,tensor.principalvalue3,options);
+ end
+ 
+-if meshdim(md.mesh)==2,
++if dimension(md.mesh)==2,
+ 	subplot(2*width,2*width,index3)
+ 	plot_unit(x,y,z,elements,tensor.principalvalue1,is2d,isplanet,datatype,options)
+ 	Apply_options_tensor(md,options,type,'principal value 1')
+Index: ../trunk-jpl/src/m/plot/plot_basaldrag.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_basaldrag.m	(revision 17685)
++++ ../trunk-jpl/src/m/plot/plot_basaldrag.m	(revision 17686)
+@@ -8,7 +8,7 @@
+ %   See also: PLOTMODEL
+ 
+ %check layer
+-if meshdim(md.mesh)==3,
++if dimension(md.mesh)==3,
+ 	if getfieldvalue(options,'layer',1)~=1;
+ 		disp('plot_basaldrag warning: basal drag is displayed in the lower layer')
+ 		changefieldvalue(options,'layer',1);
+Index: ../trunk-jpl/src/m/plot/plot_segments.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_segments.m	(revision 17685)
++++ ../trunk-jpl/src/m/plot/plot_segments.m	(revision 17686)
+@@ -13,7 +13,7 @@
+ [x y z elements is2d isplanet]=processmesh(md,[],options);
+ segments=md.mesh.segments;
+ 
+-if (strcmp(meshxdim(md.mesh),'2Dhorizontal')),
++if (strcmp(domaintype(md.mesh),'2Dhorizontal')),
+ 	%plot mesh
+ 	A=elements(:,1); B=elements(:,2); C=elements(:,3); 
+ 	h1=patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
+Index: ../trunk-jpl/src/m/plot/plot_transient_results.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_transient_results.m	(revision 17685)
++++ ../trunk-jpl/src/m/plot/plot_transient_results.m	(revision 17686)
+@@ -40,7 +40,7 @@
+ eval(string);
+ clear string;
+ 
+-if strcmp(meshxdim(md.mesh),'3D'),
++if strcmp(domaintype(md.mesh),'3D'),
+ 	string='plotmodel(md';
+ 	for i=1:length(md.results.transient),
+ 		string=[string ',''data'',md.results.transient(' num2str(i) ').temperature,''view'',3,''title'',''Temperature at time ' num2str(md.results.transient(i).time) ' a'''];
+@@ -66,7 +66,7 @@
+ eval(string);
+ clear string;
+ 
+-if strcmp(meshxdim(md.mesh),'3D'),
++if strcmp(domaintype(md.mesh),'3D'),
+ 	string='plotmodel(md';
+ 	for i=2:length(md.results.transient),
+ 		string=[string ',''data'',md.results.transient(' num2str(i) ').temperature-md.results.transient(' num2str(i-1) ').temperature,''view'',3,''title'',''Delta temperature at time ' num2str(md.results.transient(i).time) ' a'''];
+Index: ../trunk-jpl/src/m/plot/plot_qmu_mass_flux_segments.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_qmu_mass_flux_segments.m	(revision 17685)
++++ ../trunk-jpl/src/m/plot/plot_qmu_mass_flux_segments.m	(revision 17686)
+@@ -12,7 +12,7 @@
+ 
+ allsegments=md.qmu.mass_flux_segments;
+ 
+-if (strcmp(meshxdim(md.mesh),'2Dhorizontal')),
++if (strcmp(domaintype(md.mesh),'2Dhorizontal')),
+ 
+ 	%recover segments
+ 	hold on
+Index: ../trunk-jpl/src/m/plot/processmesh.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/processmesh.py	(revision 17685)
++++ ../trunk-jpl/src/m/plot/processmesh.py	(revision 17686)
+@@ -41,9 +41,9 @@
+ 		elements=elements-1
+ 
+ 		#is it a 2D plot?
+-		if m.strcmp(md.mesh.meshxdim(),'2Dhorizontal'):
++		if m.strcmp(md.mesh.domaintype(),'2Dhorizontal'):
+ 			is2d=1
+-		elif m.strcmp(md.mesh.meshxdim(),'3D'):
++		elif m.strcmp(md.mesh.domaintype(),'3D'):
+ 			if options.getfieldvalue('layer',0)>=1:
+ 				is2d=1
+ 			else:
+@@ -63,7 +63,7 @@
+ 	
+ 	else:
+ 		#Process mesh for plotting 
+-		if m.strcmp(md.mesh.meshxdim(),'2Dhorizontal'):
++		if m.strcmp(md.mesh.domaintype(),'2Dhorizontal'):
+ 			is2d=1
+ 		else:
+ 			# process polycollection here for 3D plot
+Index: ../trunk-jpl/src/m/plot/plot_referential.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_referential.m	(revision 17685)
++++ ../trunk-jpl/src/m/plot/plot_referential.m	(revision 17686)
+@@ -27,7 +27,7 @@
+ 
+ Yhat=cross(Zhat,Xhat);
+ 
+-if (strcmp(meshxdim(md.mesh),'2Dhorizontal')),
++if (strcmp(domaintype(md.mesh),'2Dhorizontal')),
+ 
+ 	%plot mesh
+ 	A=elements(:,1); B=elements(:,2); C=elements(:,3); 
+Index: ../trunk-jpl/src/m/plot/plot_penalties.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_penalties.m	(revision 17685)
++++ ../trunk-jpl/src/m/plot/plot_penalties.m	(revision 17686)
+@@ -20,7 +20,7 @@
+ 	z=z*unit;
+ end
+ 
+-if ~strcmp(meshxdim(md.mesh),'3D'),
++if ~strcmp(domaintype(md.mesh),'3D'),
+ 	error('no penalties to plot for ''2d'' model');
+ elseif isempty(md.penalties),
+ 	disp('no penalty applied in this model');
+Index: ../trunk-jpl/src/m/plot/plot_edges.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_edges.m	(revision 17685)
++++ ../trunk-jpl/src/m/plot/plot_edges.m	(revision 17686)
+@@ -16,7 +16,7 @@
+ 	error('edges in NaN')
+ end
+ 
+-if (strcmp(meshxdim(md.mesh),'2Dhorizontal')),
++if (strcmp(domaintype(md.mesh),'2Dhorizontal')),
+ 	%plot mesh
+ 	A=elements(:,1); B=elements(:,2); C=elements(:,3); 
+ 	h1=patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
+Index: ../trunk-jpl/src/m/plot/applyoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/applyoptions.m	(revision 17685)
++++ ../trunk-jpl/src/m/plot/applyoptions.m	(revision 17686)
+@@ -48,7 +48,7 @@
+ if exist(options,'ztick'), set(gca,'ZTick',getfieldvalue(options,'ztick')); end
+ 
+ %view 
+-if strcmp(meshxdim(md.mesh),'3D') & ~exist(options,'layer'),
++if strcmp(domaintype(md.mesh),'3D') & ~exist(options,'layer'),
+ 	view(getfieldvalue(options,'view',3));
+ else
+ 	view(getfieldvalue(options,'view',2));
+@@ -59,7 +59,7 @@
+ if exist(options,'axis')
+ 	eval(['axis ' getfieldvalue(options,'axis')]);
+ else
+-	if strcmpi(meshxdim(md.mesh),'2Dhorizontal') | exist(options,'layer'),
++	if strcmpi(domaintype(md.mesh),'2Dhorizontal') | exist(options,'layer'),
+ 		axis tight equal;
+ 	else
+ 		axis auto tight
+Index: ../trunk-jpl/src/m/plot/processdata.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/processdata.m	(revision 17685)
++++ ../trunk-jpl/src/m/plot/processdata.m	(revision 17686)
+@@ -22,7 +22,7 @@
+ end
+ 
+ %special case for mesh 2dvertical
+-if strcmp(meshxdim(md.mesh),'2Dvertical'),
++if strcmp(domaintype(md.mesh),'2Dvertical'),
+ 	[data datatype] = processdata(md.mesh,md,data,options);
+ 	return;
+ end
+@@ -55,7 +55,7 @@
+ end
+ 
+ %check length
+-if datasize(1)~=md.mesh.numberofvertices & datasize(1)~=md.mesh.numberofelements & datasize(1)~=md.mesh.numberofvertices*6 & (strcmp(md.mesh.meshxdim(),'3D') & ~(datasize(1)==numberofelements2d | datasize(1)==numberofvertices2d))
++if datasize(1)~=md.mesh.numberofvertices & datasize(1)~=md.mesh.numberofelements & datasize(1)~=md.mesh.numberofvertices*6 & (strcmp(md.mesh.domaintype(),'3D') & ~(datasize(1)==numberofelements2d | datasize(1)==numberofvertices2d))
+ 	error('plotmodel error message: data not supported yet');
+ end
+ 
+@@ -64,7 +64,7 @@
+ 	datatype=3;
+ 
+ 	%check number of columns, add zeros if necessary,
+-	if (strcmp(md.mesh.meshxdim(),'3D'))
++	if (strcmp(md.mesh.domaintype(),'3D'))
+ 		if datasize(2)==2,
+ 			data=[data, zeros(datasize(1),1)];
+ 		elseif datasize(2)~=3,
+@@ -84,14 +84,14 @@
+ end
+ 
+ %treat the case datasize(1)=nodes2d
+-if (strcmp(md.mesh.meshxdim(),'3D') & datasize(1)==numberofvertices2d),
++if (strcmp(md.mesh.domaintype(),'3D') & datasize(1)==numberofvertices2d),
+ 	data=project3d(md,'vector',data,'type','node');
+ 	datasize(1)=md.mesh.numberofvertices;
+ 	%---> go to node data
+ end
+ 
+ %treat the case datasize(1)=nodes2d
+-if (strcmp(md.mesh.meshxdim(),'3D') & datasize(1)==numberofelements2d),
++if (strcmp(md.mesh.domaintype(),'3D') & datasize(1)==numberofelements2d),
+ 	data=project3d(md,'vector',data,'type','element');
+ 	datasize(1)=md.mesh.numberofelements;
+ 	%---> go to node data
+Index: ../trunk-jpl/src/m/plot/plot_tensor_components.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_tensor_components.m	(revision 17685)
++++ ../trunk-jpl/src/m/plot/plot_tensor_components.m	(revision 17686)
+@@ -9,11 +9,11 @@
+ %Compute the indexes of the components plots
+ upperplots=fix((i-1)/width);
+ if upperplots==0, leftplots=i-1; else leftplots=i-width*upperplots-1; end
+-if (strcmp(meshxdim(md.mesh),'2Dhorizontal'))%3 components -> 3 indexes
++if (strcmp(domaintype(md.mesh),'2Dhorizontal'))%3 components -> 3 indexes
+ 	index1=4*width*upperplots+2*leftplots+1;
+ 	index2=index1+1;
+ 	index3=index1+width*2;
+-elseif meshdim(md.mesh)==3%6 components -> 6 indexes
++elseif dimension(md.mesh)==3%6 components -> 6 indexes
+ 	index1=3*3*width*upperplots+3*leftplots+1;
+ 	index2=index1+1;
+ 	index3=index1+2;
+@@ -27,13 +27,13 @@
+ [tensor.xx datatype]=processdata(md,tensor.xx,options);
+ [tensor.yy datatype]=processdata(md,tensor.yy,options);
+ [tensor.xy datatype]=processdata(md,tensor.xy,options);
+-if  meshdim(md.mesh)==3
++if  dimension(md.mesh)==3
+ 	[tensor.xz datatype]=processdata(md,tensor.xz,options);
+ 	[tensor.yz datatype]=processdata(md,tensor.yz,options);
+ 	[tensor.zz datatype]=processdata(md,tensor.zz,options);
+ end
+ 
+-if ((strcmp(meshxdim(md.mesh),'2Dhorizontal'))),
++if ((strcmp(domaintype(md.mesh),'2Dhorizontal'))),
+ 	subplot(2*width,2*width,index1),
+ 	plot_unit(x,y,z,elements,tensor.xx,is2d,isplanet,datatype,options)
+ 	Apply_options_tensor(md,options,type,'xx')
+Index: ../trunk-jpl/src/m/mesh/bamg.py
+===================================================================
+--- ../trunk-jpl/src/m/mesh/bamg.py	(revision 17685)
++++ ../trunk-jpl/src/m/mesh/bamg.py	(revision 17686)
+@@ -271,7 +271,7 @@
+ 		pass
+ 	#}}}
+ 	# Bamg Mesh parameters {{{
+-	if not options.exist('domain') and md.mesh.numberofvertices and m.strcmp(md.mesh.meshtype(),'Tria'):
++	if not options.exist('domain') and md.mesh.numberofvertices and m.strcmp(md.mesh.elementtype(),'Tria'):
+ 
+ 		if isinstance(md.private.bamg,dict) and 'mesh' in md.private.bamg:
+ 			bamg_mesh=bamgmesh(md.private.bamg['mesh'].__dict__)
+Index: ../trunk-jpl/src/m/mesh/bamg.m
+===================================================================
+--- ../trunk-jpl/src/m/mesh/bamg.m	(revision 17685)
++++ ../trunk-jpl/src/m/mesh/bamg.m	(revision 17686)
+@@ -283,7 +283,7 @@
+ end
+ %}}}
+ % Bamg Mesh parameters {{{
+-if (~exist(options,'domain') & md.mesh.numberofvertices~=0 & strcmp(meshtype(md.mesh),'Tria')),
++if (~exist(options,'domain') & md.mesh.numberofvertices~=0 & strcmp(elementtype(md.mesh),'Tria')),
+ 
+ 	if isstruct(md.private.bamg) & isfield(md.private.bamg,'mesh'),
+ 		bamg_mesh=bamgmesh(md.private.bamg.mesh);
+Index: ../trunk-jpl/src/m/classes/initialization.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/initialization.m	(revision 17685)
++++ ../trunk-jpl/src/m/classes/initialization.m	(revision 17686)
+@@ -51,7 +51,7 @@
+ 			if ismember(ThermalAnalysisEnum(),analyses),
+ 				md = checkfield(md,'fieldname','initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
+ 				md = checkfield(md,'fieldname','initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
+-				if meshdim(md.mesh)==3
++				if dimension(md.mesh)==3
+ 					md = checkfield(md,'fieldname','initialization.vz','NaN',1,'size',[md.mesh.numberofvertices 1]);
+ 				end
+ 				md = checkfield(md,'fieldname','initialization.pressure','NaN',1,'size',[md.mesh.numberofvertices 1]);
+Index: ../trunk-jpl/src/m/classes/thermal.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/thermal.py	(revision 17685)
++++ ../trunk-jpl/src/m/classes/thermal.py	(revision 17686)
+@@ -81,7 +81,7 @@
+ 
+ 		md = checkfield(md,'fieldname','thermal.stabilization','numel',[1],'values',[0,1,2])
+ 		md = checkfield(md,'fieldname','thermal.spctemperature','forcing',1)
+-		if EnthalpyAnalysisEnum() in analyses and md.thermal.isenthalpy and md.mesh.meshdim()==3:
++		if EnthalpyAnalysisEnum() in analyses and md.thermal.isenthalpy and md.mesh.dimension()==3:
+ 			pos=numpy.nonzero(numpy.logical_not(numpy.isnan(md.thermal.spctemperature[0:md.mesh.numberofvertices])))
+ 			replicate=numpy.tile(md.geometry.surface-md.mesh.z,(1,numpy.size(md.thermal.spctemperature,axis=1)))
+ 			md = checkfield(md,'fieldname','thermal.spctemperature[numpy.nonzero(numpy.logical_not(numpy.isnan(md.thermal.spctemperature[0:md.mesh.numberofvertices,:])))]','<',md.materials.meltingpoint-md.materials.beta*md.materials.rho_ice*md.constants.g*replicate[pos],'message',"spctemperature should be below the adjusted melting point")
+Index: ../trunk-jpl/src/m/classes/mesh3dprisms.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh3dprisms.py	(revision 17685)
++++ ../trunk-jpl/src/m/classes/mesh3dprisms.py	(revision 17686)
+@@ -2,7 +2,7 @@
+ from fielddisplay import fielddisplay
+ from EnumDefinitions import *
+ from checkfield import *
+-from MatlabFuncs import *
++import MatlabFuncs as m
+ from WriteData import WriteData
+ 
+ class mesh3dprisms(object):
+@@ -18,7 +18,6 @@
+ 		self.y                           = float('NaN');
+ 		self.z                           = float('NaN');
+ 		self.elements                    = float('NaN');
+-		self.dimension                   = 0;
+ 		self.numberoflayers              = 0;
+ 		self.numberofelements            = 0;
+ 		self.numberofvertices            = 0;
+@@ -115,7 +114,7 @@
+ 		md = checkfield(md,'fieldname','mesh.z','NaN',1,'size',[md.mesh.numberofvertices])
+ 		md = checkfield(md,'fieldname','mesh.elements','NaN',1,'>',0,'values',numpy.arange(1,md.mesh.numberofvertices+1))
+ 		md = checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements,6])
+-		if numpy.any(numpy.logical_not(ismember(numpy.arange(1,md.mesh.numberofvertices+1),md.mesh.elements))):
++		if numpy.any(numpy.logical_not(m.ismember(numpy.arange(1,md.mesh.numberofvertices+1),md.mesh.elements))):
+ 			md.checkmessage("orphan nodes have been found. Check the mesh3dprisms outline")
+ 		md = checkfield(md,'fieldname','mesh.numberoflayers','>=',0)
+ 		md = checkfield(md,'fieldname','mesh.numberofelements','>',0)
+@@ -129,17 +128,17 @@
+ 
+ 		return md
+ 	# }}}
+-	def meshxdim(self): # {{{
++	def domaintype(self): # {{{
+ 		return "3D"
+ 	#}}}
+-	def meshdim(self): # {{{
++	def dimension(self): # {{{
+ 		return 3
+ 	#}}}
+-	def meshtype(self): # {{{
++	def elementtype(self): # {{{
+ 		return "Penta"
+ 	#}}}
+ 	def marshall(self,md,fid):    # {{{
+-		WriteData(fid,'enum',MeshXDimEnum(),'data',StringToEnum("Mesh"+self.meshxdim())[0],'format','Integer');
++		WriteData(fid,'enum',DomainTypeEnum(),'data',StringToEnum("Mesh"+self.domaintype())[0],'format','Integer');
+ 		WriteData(fid,'object',self,'class','mesh','fieldname','x','format','DoubleMat','mattype',1)
+ 		WriteData(fid,'object',self,'class','mesh','fieldname','y','format','DoubleMat','mattype',1)
+ 		WriteData(fid,'object',self,'class','mesh','fieldname','z','format','DoubleMat','mattype',1)
+Index: ../trunk-jpl/src/m/classes/mesh3dprisms.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh3dprisms.m	(revision 17685)
++++ ../trunk-jpl/src/m/classes/mesh3dprisms.m	(revision 17686)
+@@ -134,7 +134,7 @@
+ 			fielddisplay(obj,'hemisphere','Indicate hemisphere ''n'' or ''s'' ');
+ 		end % }}}
+ 		function marshall(obj,md,fid) % {{{
+-			WriteData(fid,'enum',MeshXDimEnum(),'data',StringToEnum(['Mesh' meshxdim(obj)]),'format','Integer');
++			WriteData(fid,'enum',DomainTypeEnum(),'data',StringToEnum(['Mesh' domaintype(obj)]),'format','Integer');
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','x','format','DoubleMat','mattype',1);
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','y','format','DoubleMat','mattype',1);
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','z','format','DoubleMat','mattype',1);
+@@ -153,13 +153,13 @@
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','numberofvertices2d','format','Integer');
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','numberofelements2d','format','Integer');
+ 		end % }}}
+-		function type = meshxdim(obj) % {{{
++		function type = domaintype(obj) % {{{
+ 			type = '3D';
+ 		end % }}}
+-		function d = meshdim(obj) % {{{
++		function d = dimension(obj) % {{{
+ 			d = 3;
+ 		end % }}}
+-		function s = meshtype(obj) % {{{
++		function s = elementtype(obj) % {{{
+ 			s = 'Penta';
+ 		end % }}}
+ 	end
+Index: ../trunk-jpl/src/m/classes/rifts.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/rifts.py	(revision 17685)
++++ ../trunk-jpl/src/m/classes/rifts.py	(revision 17686)
+@@ -39,7 +39,7 @@
+ 			numrifts=len(self.riftstruct)
+ 
+ 		if numrifts:
+-			if not m.strcmp(md.mesh.meshxdim(),'2Dhorizontal'):
++			if not m.strcmp(md.mesh.domaintype(),'2Dhorizontal'):
+ 				md.checkmessage("models with rifts are only supported in 2d for now!")
+ 			if not isinstance(self.riftstruct,list):
+ 				md.checkmessage("rifts.riftstruct should be a structure!")
+Index: ../trunk-jpl/src/m/classes/thermal.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/thermal.m	(revision 17685)
++++ ../trunk-jpl/src/m/classes/thermal.m	(revision 17686)
+@@ -63,7 +63,7 @@
+ 
+ 			md = checkfield(md,'fieldname','thermal.stabilization','numel',[1],'values',[0 1 2]);
+ 			md = checkfield(md,'fieldname','thermal.spctemperature','forcing',1);
+-			if (ismember(EnthalpyAnalysisEnum(),analyses) & md.thermal.isenthalpy & meshdim(md.mesh)==3),
++			if (ismember(EnthalpyAnalysisEnum(),analyses) & md.thermal.isenthalpy & dimension(md.mesh)==3),
+ 				pos=find(md.thermal.spctemperature(1:md.mesh.numberofvertices,:)~=NaN);
+ 				replicate=repmat(md.geometry.surface-md.mesh.z,1,size(md.thermal.spctemperature,2));
+ 				md = checkfield(md,'fieldname','thermal.spctemperature(find(md.thermal.spctemperature(1:md.mesh.numberofvertices,:)~=NaN))','<',md.materials.meltingpoint-md.materials.beta*md.materials.rho_ice*md.constants.g*replicate(pos),'message','spctemperature should be below the adjusted melting point');
+Index: ../trunk-jpl/src/m/classes/mesh3dtetras.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh3dtetras.m	(revision 17685)
++++ ../trunk-jpl/src/m/classes/mesh3dtetras.m	(revision 17686)
+@@ -128,7 +128,7 @@
+ 			fielddisplay(obj,'hemisphere','Indicate hemisphere ''n'' or ''s'' ');
+ 		end % }}}
+ 		function marshall(obj,md,fid) % {{{
+-			WriteData(fid,'enum',MeshXDimEnum(),'data',Mesh3DtetrasEnum,'format','Integer');
++			WriteData(fid,'enum',DomainTypeEnum(),'data',Mesh3DtetrasEnum,'format','Integer');
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','x','format','DoubleMat','mattype',1);
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','y','format','DoubleMat','mattype',1);
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','z','format','DoubleMat','mattype',1);
+@@ -145,13 +145,13 @@
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','numberofvertices2d','format','Integer');
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','numberofelements2d','format','Integer');
+ 		end % }}}
+-		function t = meshxdim(obj) % {{{
++		function t = domaintype(obj) % {{{
+ 			t = '3D';
+ 		end % }}}
+-		function d = meshdim(obj) % {{{
++		function d = dimension(obj) % {{{
+ 			d = 3;
+ 		end % }}}
+-		function s = meshtype(obj) % {{{
++		function s = elementtype(obj) % {{{
+ 			s = 'Tetra';
+ 		end % }}}
+ 	end
+Index: ../trunk-jpl/src/m/classes/mesh2dvertical.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh2dvertical.m	(revision 17685)
++++ ../trunk-jpl/src/m/classes/mesh2dvertical.m	(revision 17686)
+@@ -103,7 +103,7 @@
+ 			fielddisplay(obj,'hemisphere','Indicate hemisphere ''n'' or ''s'' ');
+ 		end % }}}
+ 		function marshall(obj,md,fid) % {{{
+-			WriteData(fid,'enum',MeshXDimEnum(),'data',StringToEnum(['Mesh' meshxdim(obj)]),'format','Integer');
++			WriteData(fid,'enum',DomainTypeEnum(),'data',StringToEnum(['Mesh' domaintype(obj)]),'format','Integer');
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','x','format','DoubleMat','mattype',1);
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','y','format','DoubleMat','mattype',1);
+ 			WriteData(fid,'enum',MeshZEnum(),'data',zeros(obj.numberofvertices,1),'format','DoubleMat','mattype',1);
+@@ -114,13 +114,13 @@
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','vertexonsurface','format','BooleanMat','mattype',1);
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','average_vertex_connectivity','format','Integer');
+ 		end % }}}
+-		function t = meshxdim(obj) % {{{
++		function t = domaintype(obj) % {{{
+ 			t = '2Dvertical';
+ 		end % }}}
+-		function d = meshdim(obj) % {{{
++		function d = dimension(obj) % {{{
+ 			d = 2;
+ 		end % }}}
+-		function s = meshtype(obj) % {{{
++		function s = elementtype(obj) % {{{
+ 			s = 'Tria';
+ 		end % }}}
+ 		function flags = vertexflags(self,value) % {{{
+Index: ../trunk-jpl/src/m/classes/initialization.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/initialization.py	(revision 17685)
++++ ../trunk-jpl/src/m/classes/initialization.py	(revision 17686)
+@@ -65,7 +65,7 @@
+ 		if ThermalAnalysisEnum() in analyses:
+ 			md = checkfield(md,'fieldname','initialization.vx','NaN',1,'size',[md.mesh.numberofvertices])
+ 			md = checkfield(md,'fieldname','initialization.vy','NaN',1,'size',[md.mesh.numberofvertices])
+-			if md.mesh.meshdim()==3:
++			if md.mesh.dimension()==3:
+ 				md = checkfield(md,'fieldname','initialization.vz','NaN',1,'size',[md.mesh.numberofvertices])
+ 			md = checkfield(md,'fieldname','initialization.pressure','NaN',1,'size',[md.mesh.numberofvertices])
+ 		if (EnthalpyAnalysisEnum() in analyses and md.thermal.isenthalpy):
+Index: ../trunk-jpl/src/m/classes/modellist.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/modellist.m	(revision 17685)
++++ ../trunk-jpl/src/m/classes/modellist.m	(revision 17686)
+@@ -31,7 +31,7 @@
+ 			%in flags.
+ 
+ 			%2D or 3D?
+-			if meshdim(md.mesh)==3,
++			if dimension(md.mesh)==3,
+ 				numberofelements=md.mesh.numberofelements2d; %this will be forgotten when we get out.
+ 				flags=project2d(md,flags,1);
+ 			else
+@@ -83,7 +83,7 @@
+ 
+ 			for i=1:size(flag_list,1),
+ 				disp(['   ' num2str(i) '/' num2str(size(flag_list,1))]);
+-				if meshdim(md.mesh)==3,
++				if dimension(md.mesh)==3,
+ 					flags2d=flag_list{i};
+ 					realflags=project3d(md,flags2d,'element');
+ 				else
+Index: ../trunk-jpl/src/m/classes/model.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.py	(revision 17685)
++++ ../trunk-jpl/src/m/classes/model.py	(revision 17686)
+@@ -326,7 +326,7 @@
+ 			md2.mesh.y2d=md1.mesh.y[pos_node_2d]
+ 
+ 		#Edges
+-		if m.strcmp(md.mesh.meshxdim(),'2Dhorizontal'):
++		if m.strcmp(md.mesh.domaintype(),'2Dhorizontal'):
+ 			if numpy.ndim(md2.mesh.edges)>1 and numpy.size(md2.mesh.edges,axis=1)>1:    #do not use ~isnan because there are some NaNs...
+ 				#renumber first two columns
+ 				pos=numpy.nonzero(md2.mesh.edges[:,3]!=-1)[0]
+Index: ../trunk-jpl/src/m/classes/mesh2d.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh2d.m	(revision 17685)
++++ ../trunk-jpl/src/m/classes/mesh2d.m	(revision 17686)
+@@ -104,7 +104,7 @@
+ 			fielddisplay(obj,'hemisphere','Indicate hemisphere ''n'' or ''s'' ');
+ 		end % }}}
+ 		function marshall(obj,md,fid) % {{{
+-			WriteData(fid,'enum',MeshXDimEnum(),'data',StringToEnum(['Mesh' meshxdim(obj)]),'format','Integer');
++			WriteData(fid,'enum',DomainTypeEnum(),'data',StringToEnum(['Mesh' domaintype(obj)]),'format','Integer');
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','x','format','DoubleMat','mattype',1);
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','y','format','DoubleMat','mattype',1);
+ 			WriteData(fid,'enum',MeshZEnum(),'data',zeros(obj.numberofvertices,1),'format','DoubleMat','mattype',1);
+@@ -113,13 +113,13 @@
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','numberofvertices','format','Integer');
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','average_vertex_connectivity','format','Integer');
+ 		end % }}}
+-		function t = meshxdim(obj) % {{{
++		function t = domaintype(obj) % {{{
+ 			t = '2Dhorizontal';
+ 		end % }}}
+-		function d = meshdim(obj) % {{{
++		function d = dimension(obj) % {{{
+ 			d = 2;
+ 		end % }}}
+-		function s = meshtype(obj) % {{{
++		function s = elementtype(obj) % {{{
+ 			s = 'Tria';
+ 		end % }}}
+ 	end
+Index: ../trunk-jpl/src/m/classes/stressbalance.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/stressbalance.py	(revision 17685)
++++ ../trunk-jpl/src/m/classes/stressbalance.py	(revision 17686)
+@@ -109,7 +109,7 @@
+ 	#}}}
+ 	def defaultoutputs(self,md): # {{{
+ 
+-		if md.mesh.meshdim()==3:
++		if md.mesh.dimension()==3:
+ 			list = ['Vx','Vy','Vz','Vel','Pressure']
+ 		else:
+ 			list = ['Vx','Vy','Vel','Pressure']
+@@ -124,7 +124,7 @@
+ 
+ 		md = checkfield(md,'fieldname','stressbalance.spcvx','forcing',1)
+ 		md = checkfield(md,'fieldname','stressbalance.spcvy','forcing',1)
+-		if m.strcmp(md.mesh.meshxdim(),'3D'):
++		if m.strcmp(md.mesh.domaintype(),'3D'):
+ 			md = checkfield(md,'fieldname','stressbalance.spcvz','forcing',1)
+ 		md = checkfield(md,'fieldname','stressbalance.restol','size',[1],'>',0)
+ 		md = checkfield(md,'fieldname','stressbalance.reltol','size',[1])
+@@ -156,7 +156,7 @@
+ 				if numpy.abs(numpy.inner(item[0:2],item[3:5]))>sys.float_info.epsilon:
+ 					md.checkmessage("Vectors in stressbalance.referential (columns 1 to 3 and 4 to 6) must be orthogonal")
+ 		#CHECK THAT NO rotation specified for FS Grounded ice at base
+-		if m.strcmp(md.mesh.meshxdim(),'3D') and md.flowequation.isFS:
++		if m.strcmp(md.mesh.domaintype(),'3D') and md.flowequation.isFS:
+ 			pos=numpy.nonzero(numpy.logical_and(md.mask.groundedice_levelset,md.mesh.vertexonbase))
+ 			if numpy.any(numpy.logical_not(numpy.isnan(md.stressbalance.referential[pos,:]))):
+ 				md.checkmessage("no referential should be specified for basal vertices of grounded ice")
+Index: ../trunk-jpl/src/m/classes/rifts.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/rifts.m	(revision 17685)
++++ ../trunk-jpl/src/m/classes/rifts.m	(revision 17686)
+@@ -27,7 +27,7 @@
+ 				numrifts=numel(obj.riftstruct);
+ 			end
+ 			if numrifts,
+-				if ~(strcmp(meshxdim(md.mesh),'2Dhorizontal')),
++				if ~(strcmp(domaintype(md.mesh),'2Dhorizontal')),
+ 					md = checkmessage(md,['models with rifts are only supported in 2d for now!']);
+ 				end
+ 				if ~isstruct(obj.riftstruct),
+Index: ../trunk-jpl/src/m/classes/stressbalance.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/stressbalance.m	(revision 17685)
++++ ../trunk-jpl/src/m/classes/stressbalance.m	(revision 17686)
+@@ -111,7 +111,7 @@
+ 				end
+ 			end
+ 			%CHECK THAT NO rotation specified for FS Grounded ice at base
+-			if strcmp(meshxdim(md.mesh),'3D') & md.flowequation.isFS,
++			if strcmp(domaintype(md.mesh),'3D') & md.flowequation.isFS,
+ 				pos=find(md.mask.groundedice_levelset>0. & md.mesh.vertexonbase);
+ 				if any(~isnan(md.stressbalance.referential(pos,:))),
+ 					md = checkmessage(md,['no referential should be specified for basal vertices of grounded ice']);
+@@ -121,9 +121,9 @@
+ 		end % }}}
+ 		function list=defaultoutputs(self,md) % {{{
+ 
+-			if meshdim(md.mesh)==3,
++			if dimension(md.mesh)==3,
+ 				list = {'Vx','Vy','Vz','Vel','Pressure'};
+-			elseif meshdim(md.mesh)==2,
++			elseif dimension(md.mesh)==2,
+ 				list = {'Vx','Vy','Vel','Pressure'};
+ 			else
+ 				error('mesh type not supported yet');
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17685)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17686)
+@@ -155,7 +155,7 @@
+ 			%   See also: EXTRUDE, MODELEXTRACT
+ 
+ 			%Check that the model is really a 3d model
+-			if ~strcmp(md.mesh.meshxdim(),'3D'),
++			if ~strcmp(md.mesh.domaintype(),'3D'),
+ 				error('collapse error message: only 3d mesh can be collapsed')
+ 			end
+ 
+@@ -425,7 +425,7 @@
+ 			end
+ 
+ 			%Edges
+-			if(meshdim(md.mesh)==2),
++			if(dimension(md.mesh)==2),
+ 				if size(md2.mesh.edges,2)>1, %do not use ~isnan because there are some NaNs...
+ 					%renumber first two columns
+ 					pos=find(md2.mesh.edges(:,4)~=-1);
+@@ -607,7 +607,7 @@
+ 			if numlayers<2,
+ 				error('number of layers should be at least 2');
+ 			end
+-			if strcmp(md.mesh.meshxdim(),'3D')
++			if strcmp(md.mesh.domaintype(),'3D')
+ 				error('Cannot extrude a 3d mesh (extrude cannot be called more than once)');
+ 			end
+ 
+Index: ../trunk-jpl/src/m/classes/flowequation.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/flowequation.py	(revision 17685)
++++ ../trunk-jpl/src/m/classes/flowequation.py	(revision 17686)
+@@ -83,10 +83,10 @@
+ 			md = checkfield(md,'fieldname','flowequation.borderFS','size',[md.mesh.numberofvertices],'values',[0,1])
+ 			md = checkfield(md,'fieldname','flowequation.XTH_r','numel',[1],'>',0.)
+ 			md = checkfield(md,'fieldname','flowequation.XTH_theta','numel',[1],'>=',0.,'<',.5)
+-			if m.strcmp(md.mesh.meshxdim(),'2Dhorizontal'):
++			if m.strcmp(md.mesh.domaintype(),'2Dhorizontal'):
+ 				md = checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices],'values',[1,2])
+ 				md = checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements],'values',[1,2])
+-			elif m.strcmp(md.mesh.meshxdim(),'3D'):
++			elif m.strcmp(md.mesh.domaintype(),'3D'):
+ 				md = checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices],'values',numpy.arange(0,8+1))
+ 				md = checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements],'values',numpy.arange(0,8+1))
+ 			else:
+Index: ../trunk-jpl/src/m/classes/flowequation.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/flowequation.m	(revision 17685)
++++ ../trunk-jpl/src/m/classes/flowequation.m	(revision 17686)
+@@ -94,13 +94,13 @@
+ 				md = checkfield(md,'fieldname','flowequation.borderSSA','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+ 				md = checkfield(md,'fieldname','flowequation.borderHO','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+ 				md = checkfield(md,'fieldname','flowequation.borderFS','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+-				if strcmp(meshxdim(md.mesh),'2Dhorizontal')
++				if strcmp(domaintype(md.mesh),'2Dhorizontal')
+ 					md = checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[1:2]);
+ 					md = checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[1:2]);
+-				elseif strcmp(meshxdim(md.mesh),'2Dvertical')
++				elseif strcmp(domaintype(md.mesh),'2Dvertical')
+ 					md = checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[2:4]);
+ 					md = checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[2:4]);
+-				elseif strcmp(meshxdim(md.mesh),'3D'),
++				elseif strcmp(domaintype(md.mesh),'3D'),
+ 					md = checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[0:8]);
+ 					md = checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[0:8]);
+ 				else
+Index: ../trunk-jpl/src/m/classes/mesh2d.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh2d.py	(revision 17685)
++++ ../trunk-jpl/src/m/classes/mesh2d.py	(revision 17686)
+@@ -97,17 +97,17 @@
+ 
+ 		return md
+ 	# }}}
+-	def meshxdim(self): # {{{
++	def domaintype(self): # {{{
+ 		return "2Dhorizontal"
+ 	#}}}
+-	def meshdim(self): # {{{
++	def dimension(self): # {{{
+ 		return 2
+ 	#}}}
+-	def meshtype(self): # {{{
++	def elementtype(self): # {{{
+ 		return "Tria"
+ 	#}}}
+ 	def marshall(self,md,fid):    # {{{
+-		WriteData(fid,'enum',MeshXDimEnum(),'data',StringToEnum("Mesh"+self.meshxdim())[0],'format','Integer');
++		WriteData(fid,'enum',DomainTypeEnum(),'data',StringToEnum("Mesh"+self.domaintype())[0],'format','Integer');
+ 		WriteData(fid,'object',self,'class','mesh','fieldname','x','format','DoubleMat','mattype',1)
+ 		WriteData(fid,'object',self,'class','mesh','fieldname','y','format','DoubleMat','mattype',1)
+ 		WriteData(fid,'enum',MeshZEnum(),'data',numpy.zeros(self.numberofvertices),'format','DoubleMat','mattype',1);
+Index: ../trunk-jpl/src/m/extrusion/project3d.py
+===================================================================
+--- ../trunk-jpl/src/m/extrusion/project3d.py	(revision 17685)
++++ ../trunk-jpl/src/m/extrusion/project3d.py	(revision 17686)
+@@ -26,7 +26,7 @@
+ 	#some regular checks
+ 	if not md:
+ 		raise TypeError("bad usage")
+-	if not m.strcmp(md.mesh.meshtype(),'Penta'):
++	if not m.strcmp(md.mesh.elementtype(),'Penta'):
+ 		raise TypeError("input model is not 3d")
+ 
+ 	#retrieve parameters from options.
+Index: ../trunk-jpl/src/m/extrusion/project2d.m
+===================================================================
+--- ../trunk-jpl/src/m/extrusion/project2d.m	(revision 17685)
++++ ../trunk-jpl/src/m/extrusion/project2d.m	(revision 17686)
+@@ -19,7 +19,7 @@
+ 	error('project2d error message');
+ end
+ 
+-if ~strcmp(md3d.mesh.meshxdim,'3D');
++if ~strcmp(md3d.mesh.domaintype,'3D');
+ 	error('wrong model type ... should be ''3d''');
+ end
+ 
+Index: ../trunk-jpl/src/m/extrusion/project3d.m
+===================================================================
+--- ../trunk-jpl/src/m/extrusion/project3d.m	(revision 17685)
++++ ../trunk-jpl/src/m/extrusion/project3d.m	(revision 17686)
+@@ -22,7 +22,7 @@
+ 	help project3d
+ 	error('bad usage');
+ end
+-if ~strcmp(meshtype(md.mesh),'Penta')
++if ~strcmp(elementtype(md.mesh),'Penta')
+ 	error('input model is not 3d');
+ end
+ 
+Index: ../trunk-jpl/src/m/extrusion/DepthAverage.m
+===================================================================
+--- ../trunk-jpl/src/m/extrusion/DepthAverage.m	(revision 17685)
++++ ../trunk-jpl/src/m/extrusion/DepthAverage.m	(revision 17686)
+@@ -8,7 +8,7 @@
+ %      vel_bar=DepthAverage(md,md.initialization.vel);
+ 
+ %check that the model given in input is 3d
+-if ~strcmp(md.mesh.meshxdim,'3D');
++if ~strcmp(md.mesh.domaintype,'3D');
+ 	error('DepthAverage error message: the model given in input must be 3d')
+ end
+ 
+Index: ../trunk-jpl/src/m/contrib/hack/tres.m
+===================================================================
+--- ../trunk-jpl/src/m/contrib/hack/tres.m	(revision 17685)
++++ ../trunk-jpl/src/m/contrib/hack/tres.m	(revision 17686)
+@@ -8,7 +8,7 @@
+ %check number of arguments
+ 
+ if strcmpi(string,'stressbalance'),
+-	if strcmp(meshxdim(md.mesh),'2Dhorizontal'),
++	if strcmp(domaintype(md.mesh),'2Dhorizontal'),
+ 		md.initialization.vx=md.results.StressbalanceSolution.Vx;
+ 		md.initialization.vy=md.results.StressbalanceSolution.Vy;
+ 	else 
+Index: ../trunk-jpl/src/m/contrib/ecco/PropagateFlagsUntilDistance.m
+===================================================================
+--- ../trunk-jpl/src/m/contrib/ecco/PropagateFlagsUntilDistance.m	(revision 17685)
++++ ../trunk-jpl/src/m/contrib/ecco/PropagateFlagsUntilDistance.m	(revision 17686)
+@@ -9,7 +9,7 @@
+ new_flags=flags;
+ 
+ %make 3d work in 2d: 
+-if strcmp(meshxdim(md.mesh),'3D'),
++if strcmp(domaintype(md.mesh),'3D'),
+ 	md.mesh.x=md.mesh.x2d;
+ 	md.mesh.y=md.mesh.y2d;
+ 	md.mesh.elements=md.mesh.elements2d;
+Index: ../trunk-jpl/src/m/contrib/massbalance/outflux.m
+===================================================================
+--- ../trunk-jpl/src/m/contrib/massbalance/outflux.m	(revision 17685)
++++ ../trunk-jpl/src/m/contrib/massbalance/outflux.m	(revision 17686)
+@@ -15,7 +15,7 @@
+ Ny=ly./L;
+ 
+ if nargin==1,
+-	if meshdim(md.mesh)==3,
++	if dimension(md.mesh)==3,
+ 		vxa=DepthAverage(md,md.initialization.vx);
+ 		vya=DepthAverage(md,md.initialization.vy);
+ 	else
+@@ -27,7 +27,7 @@
+ 	H=(md.geometry.thickness(A)+md.geometry.thickness(B))/2;
+ else
+ 	step=varargin{1};
+-	if meshdim(md.mesh)==3,
++	if dimension(md.mesh)==3,
+ 		vxa=DepthAverage(md,md.results.TransientSolution(step).Vx);
+ 		vya=DepthAverage(md,md.results.TransientSolution(step).Vy);
+ 	else
+Index: ../trunk-jpl/src/m/contrib/massbalance/divergence.m
+===================================================================
+--- ../trunk-jpl/src/m/contrib/massbalance/divergence.m	(revision 17685)
++++ ../trunk-jpl/src/m/contrib/massbalance/divergence.m	(revision 17686)
+@@ -4,7 +4,7 @@
+ %   Usage:
+ %      div=divergence(md,a,b)
+ 
+-if (meshdim(md.mesh)==2),
++if (dimension(md.mesh)==2),
+ 	numberofelements=md.mesh.numberofelements;
+ 	numberofnodes=md.mesh.numberofvertices;
+ 	index=md.mesh.elements;
+Index: ../trunk-jpl/src/m/interp/SectionValues.m
+===================================================================
+--- ../trunk-jpl/src/m/interp/SectionValues.m	(revision 17685)
++++ ../trunk-jpl/src/m/interp/SectionValues.m	(revision 17686)
+@@ -28,7 +28,7 @@
+ else
+ 	error('SectionValues error message: wrong resolution type. Resolution must be an array [horizontal_resolution vertical_resolution]')
+ end
+-if meshdim(md.mesh)==3
++if dimension(md.mesh)==3
+ 	if (length(resolution)==2 & isnumeric(resolution(2)))
+ 		res_v=resolution(2);
+ 	else
+@@ -77,7 +77,7 @@
+ Z=zeros(numberofnodes,1);
+ 
+ %New mesh and Data interpolation
+-if (meshdim(md.mesh)==2)
++if (dimension(md.mesh)==2)
+ 
+ 	%Interpolation of data on specified points
+ 	data_interp=InterpFromMesh2d(md.mesh.elements,md.mesh.x,md.mesh.y,data,X,Y);
+Index: ../trunk-jpl/src/m/interp/averaging.py
+===================================================================
+--- ../trunk-jpl/src/m/interp/averaging.py	(revision 17685)
++++ ../trunk-jpl/src/m/interp/averaging.py	(revision 17686)
+@@ -27,7 +27,7 @@
+ 
+ 	if len(data)!=md.mesh.numberofelements and len(data)!=md.mesh.numberofvertices:
+ 		raise StandardError('averaging error message: data not supported yet')
+-	if md.mesh.meshdim()==3 and layer!=0:
++	if md.mesh.dimension()==3 and layer!=0:
+ 		if layer<=0 or layer>md.mesh.numberoflayers:
+ 			raise ValueError('layer should be between 1 and md.mesh.numberoflayers')
+ 	else:
+@@ -53,10 +53,10 @@
+ 
+ 	
+ 	#build some variables
+-	if md.mesh.meshdim()==3 and layer==0:
++	if md.mesh.dimension()==3 and layer==0:
+ 		rep=6
+ 		areas=GetAreas(index,md.mesh.x,md.mesh.y,md.mesh.z)
+-	elif md.mesh.meshdim()==2:
++	elif md.mesh.dimension()==2:
+ 		rep=3
+ 		areas=GetAreas(index,md.mesh.x,md.mesh.y)
+ 	else:
+Index: ../trunk-jpl/src/m/interp/averaging.m
+===================================================================
+--- ../trunk-jpl/src/m/interp/averaging.m	(revision 17685)
++++ ../trunk-jpl/src/m/interp/averaging.m	(revision 17686)
+@@ -24,7 +24,7 @@
+ if (length(data)~=md.mesh.numberofelements & length(data)~=md.mesh.numberofvertices),
+ 	error('averaging error message: data not supported yet');
+ end
+-if meshdim(md.mesh)==3 & nargin==4,
++if dimension(md.mesh)==3 & nargin==4,
+ 	if varargin{1}<=0 | varargin{1}>md.mesh.numberoflayers,
+ 		error('layer should be between 1 and md.mesh.numberoflayers');
+ 	end
+@@ -55,10 +55,10 @@
+ 
+ %build some variables
+ line=index(:);
+-if meshdim(md.mesh)==3 & layer==0,
++if dimension(md.mesh)==3 & layer==0,
+ 	rep=6;
+ 	areas=GetAreas(index,md.mesh.x,md.mesh.y,md.mesh.z);
+-elseif meshdim(md.mesh)==2,
++elseif dimension(md.mesh)==2,
+ 	rep=3;
+ 	areas=GetAreas(index,md.mesh.x,md.mesh.y);
+ else
+Index: ../trunk-jpl/src/m/enum/MeshDimEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/MeshDimEnum.m	(revision 17685)
++++ ../trunk-jpl/src/m/enum/MeshDimEnum.m	(revision 17686)
+@@ -1,11 +0,0 @@
+-function macro=MeshDimEnum()
+-%MESHDIMENUM - Enum of MeshDim
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=MeshDimEnum()
+-
+-macro=StringToEnum('MeshDim');
+Index: ../trunk-jpl/src/m/enum/MeshXDimEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/MeshXDimEnum.m	(revision 17685)
++++ ../trunk-jpl/src/m/enum/MeshXDimEnum.m	(revision 17686)
+@@ -1,11 +0,0 @@
+-function macro=MeshXDimEnum()
+-%MESHXDIMENUM - Enum of MeshXDim
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=MeshXDimEnum()
+-
+-macro=StringToEnum('MeshXDim');
+Index: ../trunk-jpl/src/m/enum/MeshTypeEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/MeshTypeEnum.m	(revision 17685)
++++ ../trunk-jpl/src/m/enum/MeshTypeEnum.m	(revision 17686)
+@@ -1,11 +0,0 @@
+-function macro=MeshTypeEnum()
+-%MESHTYPEENUM - Enum of MeshType
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=MeshTypeEnum()
+-
+-macro=StringToEnum('MeshType');
+Index: ../trunk-jpl/src/m/enum/DomainTypeEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/DomainTypeEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/DomainTypeEnum.m	(revision 17686)
+@@ -0,0 +1,11 @@
++function macro=DomainTypeEnum()
++%DOMAINTYPEENUM - Enum of DomainType
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=DomainTypeEnum()
++
++macro=StringToEnum('DomainType');
+Index: ../trunk-jpl/src/m/enum/MeshElementtypeEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/MeshElementtypeEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/MeshElementtypeEnum.m	(revision 17686)
+@@ -0,0 +1,11 @@
++function macro=MeshElementtypeEnum()
++%MESHELEMENTTYPEENUM - Enum of MeshElementtype
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=MeshElementtypeEnum()
++
++macro=StringToEnum('MeshElementtype');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17685)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17686)
+@@ -210,9 +210,9 @@
+ def MeshXEnum(): return StringToEnum("MeshX")[0]
+ def MeshYEnum(): return StringToEnum("MeshY")[0]
+ def MeshZEnum(): return StringToEnum("MeshZ")[0]
+-def MeshXDimEnum(): return StringToEnum("MeshXDim")[0]
+-def MeshDimEnum(): return StringToEnum("MeshDim")[0]
+-def MeshTypeEnum(): return StringToEnum("MeshType")[0]
++def DomainTypeEnum(): return StringToEnum("DomainType")[0]
++def DomainDimensionEnum(): return StringToEnum("DomainDimension")[0]
++def MeshElementtypeEnum(): return StringToEnum("MeshElementtype")[0]
+ def Mesh2DhorizontalEnum(): return StringToEnum("Mesh2Dhorizontal")[0]
+ def Mesh2DverticalEnum(): return StringToEnum("Mesh2Dvertical")[0]
+ def Mesh3DEnum(): return StringToEnum("Mesh3D")[0]
+Index: ../trunk-jpl/src/m/enum/DomainDimensionEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/DomainDimensionEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/DomainDimensionEnum.m	(revision 17686)
+@@ -0,0 +1,11 @@
++function macro=DomainDimensionEnum()
++%DOMAINDIMENSIONENUM - Enum of DomainDimension
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=DomainDimensionEnum()
++
++macro=StringToEnum('DomainDimension');
+Index: ../trunk-jpl/src/m/parameterization/contourenvelope.m
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/contourenvelope.m	(revision 17685)
++++ ../trunk-jpl/src/m/parameterization/contourenvelope.m	(revision 17686)
+@@ -41,7 +41,7 @@
+ 
+ %get nodes inside profile
+ mesh.elementconnectivity=md.mesh.elementconnectivity;
+-if strcmp(md.mesh.meshxdim(),'2Dhorizontal'),
++if strcmp(md.mesh.domaintype(),'2Dhorizontal'),
+ 	mesh.elements=md.mesh.elements;
+ 	mesh.x=md.mesh.x;
+ 	mesh.y=md.mesh.y;
+Index: ../trunk-jpl/src/m/parameterization/setflowequation.m
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/setflowequation.m	(revision 17685)
++++ ../trunk-jpl/src/m/parameterization/setflowequation.m	(revision 17686)
+@@ -70,7 +70,7 @@
+ end
+ 
+ %Check that no L1L2 or HO or FS for 2d mesh
+-if strcmp(meshxdim(md.mesh),'2Dhorizontal')
++if strcmp(domaintype(md.mesh),'2Dhorizontal')
+ 	if any(L1L2flag | FSflag | HOflag)
+ 		error('FS and HO elements not allowed in 2d mesh, extrude it first')
+ 	end
+Index: ../trunk-jpl/src/m/parameterization/contourenvelope.py
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/contourenvelope.py	(revision 17685)
++++ ../trunk-jpl/src/m/parameterization/contourenvelope.py	(revision 17686)
+@@ -46,7 +46,7 @@
+ 
+ 	#get nodes inside profile
+ 	elementconnectivity=copy.deepcopy(md.mesh.elementconnectivity)
+-	if m.strcmp(md.mesh.meshxdim(),'2Dhorizontal'):
++	if m.strcmp(md.mesh.domaintype(),'2Dhorizontal'):
+ 		elements=copy.deepcopy(md.mesh.elements)
+ 		x=copy.deepcopy(md.mesh.x)
+ 		y=copy.deepcopy(md.mesh.y)
Index: issm/oecreview/Archive/16554-17801/ISSM-17686-17687.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17686-17687.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17686-17687.diff	(revision 17802)
@@ -0,0 +1,309 @@
+Index: ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.m
+===================================================================
+--- ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.m	(revision 17686)
++++ ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.m	(revision 17687)
+@@ -51,10 +51,12 @@
+ md.mask.ice_levelset(find(vertexonicefront))=0;
+ 
+ %First find segments that are not completely on the front
+-if ~strcmp(md.mesh.domaintype(),'3D'),
++if strcmp(elementtype(md.mesh),'Penta'),
++	numbernodesfront=4;
++elseif strcmp(elementtype(md.mesh),'Tria'),
+ 	numbernodesfront=2;
+-else 
+-	numbernodesfront=4;
++else
++	error('mesh type not supported yet');
+ end
+ segmentsfront=md.mask.ice_levelset(md.mesh.segments(:,1:numbernodesfront))==0;
+ segments=find(sum(segmentsfront,2)~=numbernodesfront);
+Index: ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py
+===================================================================
+--- ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py	(revision 17686)
++++ ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py	(revision 17687)
+@@ -52,10 +52,12 @@
+ 	md.mask.ice_levelset[pos]=0
+ 
+ 	#First find segments that are not completely on the front
+-	if not m.strcmp(md.mesh.domaintype(),'3D'):
++	if m.strcmp(md.mesh.elementtype(),'Penta'):
++		numbernodesfront=4
++	elif m.strcmp(md.mesh.elementtype(),'Tria'):
+ 		numbernodesfront=2
+ 	else:
+-		numbernodesfront=4
++			raise StandardError("Mesh type not supported")
+ 	if any(md.mask.ice_levelset<=0):
+ 		values=md.mask.ice_levelset[md.mesh.segments[:,0:-1]-1]
+ 		segmentsfront=1-values
+Index: ../trunk-jpl/src/m/plot/plot_icefront.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_icefront.m	(revision 17686)
++++ ../trunk-jpl/src/m/plot/plot_icefront.m	(revision 17687)
+@@ -18,7 +18,7 @@
+ elementnoice=sum(noice(md.mesh.elements),2);
+ elementzeroice=sum(zeroice(md.mesh.elements),2);
+ 
+-if (strcmp(domaintype(md.mesh),'2Dhorizontal')),
++if dimension(md.mesh)==2,
+ 	icefront=(elementice & elementnoice) & ~(elementice==2 & elementzeroice);
+ 
+ 	%plot mesh
+Index: ../trunk-jpl/src/m/plot/plot_segments.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_segments.m	(revision 17686)
++++ ../trunk-jpl/src/m/plot/plot_segments.m	(revision 17687)
+@@ -13,7 +13,7 @@
+ [x y z elements is2d isplanet]=processmesh(md,[],options);
+ segments=md.mesh.segments;
+ 
+-if (strcmp(domaintype(md.mesh),'2Dhorizontal')),
++if dimension(md.mesh)==2,
+ 	%plot mesh
+ 	A=elements(:,1); B=elements(:,2); C=elements(:,3); 
+ 	h1=patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
+Index: ../trunk-jpl/src/m/plot/plot_transient_results.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_transient_results.m	(revision 17686)
++++ ../trunk-jpl/src/m/plot/plot_transient_results.m	(revision 17687)
+@@ -40,7 +40,7 @@
+ eval(string);
+ clear string;
+ 
+-if strcmp(domaintype(md.mesh),'3D'),
++if dimension(md.mesh)==3,
+ 	string='plotmodel(md';
+ 	for i=1:length(md.results.transient),
+ 		string=[string ',''data'',md.results.transient(' num2str(i) ').temperature,''view'',3,''title'',''Temperature at time ' num2str(md.results.transient(i).time) ' a'''];
+@@ -66,7 +66,7 @@
+ eval(string);
+ clear string;
+ 
+-if strcmp(domaintype(md.mesh),'3D'),
++if dimension(md.mesh)==3,
+ 	string='plotmodel(md';
+ 	for i=2:length(md.results.transient),
+ 		string=[string ',''data'',md.results.transient(' num2str(i) ').temperature-md.results.transient(' num2str(i-1) ').temperature,''view'',3,''title'',''Delta temperature at time ' num2str(md.results.transient(i).time) ' a'''];
+Index: ../trunk-jpl/src/m/plot/plot_qmu_mass_flux_segments.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_qmu_mass_flux_segments.m	(revision 17686)
++++ ../trunk-jpl/src/m/plot/plot_qmu_mass_flux_segments.m	(revision 17687)
+@@ -12,7 +12,7 @@
+ 
+ allsegments=md.qmu.mass_flux_segments;
+ 
+-if (strcmp(domaintype(md.mesh),'2Dhorizontal')),
++if dimension(md.mesh)==2,
+ 
+ 	%recover segments
+ 	hold on
+Index: ../trunk-jpl/src/m/plot/processmesh.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/processmesh.py	(revision 17686)
++++ ../trunk-jpl/src/m/plot/processmesh.py	(revision 17687)
+@@ -41,15 +41,13 @@
+ 		elements=elements-1
+ 
+ 		#is it a 2D plot?
+-		if m.strcmp(md.mesh.domaintype(),'2Dhorizontal'):
++		if md.mesh.dimension()==2:
+ 			is2d=1
+-		elif m.strcmp(md.mesh.domaintype(),'3D'):
++		else:
+ 			if options.getfieldvalue('layer',0)>=1:
+ 				is2d=1
+ 			else:
+ 				is2d=0
+-		else:
+-			raise ValueError('processmesh error: dim = %d not supported' % md.mesh.dimension)
+ 
+ 		#layer projection?
+ 		if options.getfieldvalue('layer',0)>=1:
+@@ -63,7 +61,7 @@
+ 	
+ 	else:
+ 		#Process mesh for plotting 
+-		if m.strcmp(md.mesh.domaintype(),'2Dhorizontal'):
++		if md.mesh.dimension()==2:
+ 			is2d=1
+ 		else:
+ 			# process polycollection here for 3D plot
+Index: ../trunk-jpl/src/m/plot/plot_referential.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_referential.m	(revision 17686)
++++ ../trunk-jpl/src/m/plot/plot_referential.m	(revision 17687)
+@@ -27,7 +27,7 @@
+ 
+ Yhat=cross(Zhat,Xhat);
+ 
+-if (strcmp(domaintype(md.mesh),'2Dhorizontal')),
++if dimension(md.mesh)==2,
+ 
+ 	%plot mesh
+ 	A=elements(:,1); B=elements(:,2); C=elements(:,3); 
+Index: ../trunk-jpl/src/m/plot/plot_penalties.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_penalties.m	(revision 17686)
++++ ../trunk-jpl/src/m/plot/plot_penalties.m	(revision 17687)
+@@ -20,7 +20,7 @@
+ 	z=z*unit;
+ end
+ 
+-if ~strcmp(domaintype(md.mesh),'3D'),
++if dimension(md.mesh)~=3,
+ 	error('no penalties to plot for ''2d'' model');
+ elseif isempty(md.penalties),
+ 	disp('no penalty applied in this model');
+Index: ../trunk-jpl/src/m/plot/plot_edges.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_edges.m	(revision 17686)
++++ ../trunk-jpl/src/m/plot/plot_edges.m	(revision 17687)
+@@ -16,7 +16,7 @@
+ 	error('edges in NaN')
+ end
+ 
+-if (strcmp(domaintype(md.mesh),'2Dhorizontal')),
++if dimension(md.mesh)==2,
+ 	%plot mesh
+ 	A=elements(:,1); B=elements(:,2); C=elements(:,3); 
+ 	h1=patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
+Index: ../trunk-jpl/src/m/plot/applyoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/applyoptions.m	(revision 17686)
++++ ../trunk-jpl/src/m/plot/applyoptions.m	(revision 17687)
+@@ -48,7 +48,7 @@
+ if exist(options,'ztick'), set(gca,'ZTick',getfieldvalue(options,'ztick')); end
+ 
+ %view 
+-if strcmp(domaintype(md.mesh),'3D') & ~exist(options,'layer'),
++if dimension(md.mesh)==3 & ~exist(options,'layer'),
+ 	view(getfieldvalue(options,'view',3));
+ else
+ 	view(getfieldvalue(options,'view',2));
+@@ -59,7 +59,7 @@
+ if exist(options,'axis')
+ 	eval(['axis ' getfieldvalue(options,'axis')]);
+ else
+-	if strcmpi(domaintype(md.mesh),'2Dhorizontal') | exist(options,'layer'),
++	if dimension(md.mesh)==2 | exist(options,'layer'),
+ 		axis tight equal;
+ 	else
+ 		axis auto tight
+Index: ../trunk-jpl/src/m/plot/processdata.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/processdata.m	(revision 17686)
++++ ../trunk-jpl/src/m/plot/processdata.m	(revision 17687)
+@@ -64,7 +64,7 @@
+ 	datatype=3;
+ 
+ 	%check number of columns, add zeros if necessary,
+-	if (strcmp(md.mesh.domaintype(),'3D'))
++	if (dimension(md.mesh)==3)
+ 		if datasize(2)==2,
+ 			data=[data, zeros(datasize(1),1)];
+ 		elseif datasize(2)~=3,
+@@ -84,14 +84,14 @@
+ end
+ 
+ %treat the case datasize(1)=nodes2d
+-if (strcmp(md.mesh.domaintype(),'3D') & datasize(1)==numberofvertices2d),
++if (dimension(md.mesh)==3 & datasize(1)==numberofvertices2d),
+ 	data=project3d(md,'vector',data,'type','node');
+ 	datasize(1)=md.mesh.numberofvertices;
+ 	%---> go to node data
+ end
+ 
+ %treat the case datasize(1)=nodes2d
+-if (strcmp(md.mesh.domaintype(),'3D') & datasize(1)==numberofelements2d),
++if (dimension(md.mesh)==3 & datasize(1)==numberofelements2d),
+ 	data=project3d(md,'vector',data,'type','element');
+ 	datasize(1)=md.mesh.numberofelements;
+ 	%---> go to node data
+Index: ../trunk-jpl/src/m/plot/plot_tensor_components.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_tensor_components.m	(revision 17686)
++++ ../trunk-jpl/src/m/plot/plot_tensor_components.m	(revision 17687)
+@@ -9,7 +9,7 @@
+ %Compute the indexes of the components plots
+ upperplots=fix((i-1)/width);
+ if upperplots==0, leftplots=i-1; else leftplots=i-width*upperplots-1; end
+-if (strcmp(domaintype(md.mesh),'2Dhorizontal'))%3 components -> 3 indexes
++if dimension(md.mesh)==2 %3 components -> 3 indexes
+ 	index1=4*width*upperplots+2*leftplots+1;
+ 	index2=index1+1;
+ 	index3=index1+width*2;
+@@ -33,7 +33,7 @@
+ 	[tensor.zz datatype]=processdata(md,tensor.zz,options);
+ end
+ 
+-if ((strcmp(domaintype(md.mesh),'2Dhorizontal'))),
++if dimension(md.mesh)==2,
+ 	subplot(2*width,2*width,index1),
+ 	plot_unit(x,y,z,elements,tensor.xx,is2d,isplanet,datatype,options)
+ 	Apply_options_tensor(md,options,type,'xx')
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17686)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17687)
+@@ -155,7 +155,7 @@
+ 			%   See also: EXTRUDE, MODELEXTRACT
+ 
+ 			%Check that the model is really a 3d model
+-			if ~strcmp(md.mesh.domaintype(),'3D'),
++			if ~strcmp(md.mesh.elementtype(),'Penta'),
+ 				error('collapse error message: only 3d mesh can be collapsed')
+ 			end
+ 
+Index: ../trunk-jpl/src/m/extrusion/DepthAverage.m
+===================================================================
+--- ../trunk-jpl/src/m/extrusion/DepthAverage.m	(revision 17686)
++++ ../trunk-jpl/src/m/extrusion/DepthAverage.m	(revision 17687)
+@@ -8,7 +8,7 @@
+ %      vel_bar=DepthAverage(md,md.initialization.vel);
+ 
+ %check that the model given in input is 3d
+-if ~strcmp(md.mesh.domaintype,'3D');
++if ~strcmp(md.mesh.elementtype(),'3D');
+ 	error('DepthAverage error message: the model given in input must be 3d')
+ end
+ 
+Index: ../trunk-jpl/src/m/contrib/ecco/PropagateFlagsUntilDistance.m
+===================================================================
+--- ../trunk-jpl/src/m/contrib/ecco/PropagateFlagsUntilDistance.m	(revision 17686)
++++ ../trunk-jpl/src/m/contrib/ecco/PropagateFlagsUntilDistance.m	(revision 17687)
+@@ -9,7 +9,7 @@
+ new_flags=flags;
+ 
+ %make 3d work in 2d: 
+-if strcmp(domaintype(md.mesh),'3D'),
++if dimension(md.mesh)==3,
+ 	md.mesh.x=md.mesh.x2d;
+ 	md.mesh.y=md.mesh.y2d;
+ 	md.mesh.elements=md.mesh.elements2d;
+Index: ../trunk-jpl/src/m/parameterization/contourenvelope.m
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/contourenvelope.m	(revision 17686)
++++ ../trunk-jpl/src/m/parameterization/contourenvelope.m	(revision 17687)
+@@ -41,7 +41,7 @@
+ 
+ %get nodes inside profile
+ mesh.elementconnectivity=md.mesh.elementconnectivity;
+-if strcmp(md.mesh.domaintype(),'2Dhorizontal'),
++if dimension(md.mesh)==2,
+ 	mesh.elements=md.mesh.elements;
+ 	mesh.x=md.mesh.x;
+ 	mesh.y=md.mesh.y;
+Index: ../trunk-jpl/src/m/parameterization/contourenvelope.py
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/contourenvelope.py	(revision 17686)
++++ ../trunk-jpl/src/m/parameterization/contourenvelope.py	(revision 17687)
+@@ -46,7 +46,7 @@
+ 
+ 	#get nodes inside profile
+ 	elementconnectivity=copy.deepcopy(md.mesh.elementconnectivity)
+-	if m.strcmp(md.mesh.domaintype(),'2Dhorizontal'):
++	if md.mesh.dimension()==2:
+ 		elements=copy.deepcopy(md.mesh.elements)
+ 		x=copy.deepcopy(md.mesh.x)
+ 		y=copy.deepcopy(md.mesh.y)
Index: issm/oecreview/Archive/16554-17801/ISSM-17687-17688.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17687-17688.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17687-17688.diff	(revision 17802)
@@ -0,0 +1,78 @@
+Index: ../trunk-jpl/src/m/classes/mesh3dprisms.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh3dprisms.py	(revision 17687)
++++ ../trunk-jpl/src/m/classes/mesh3dprisms.py	(revision 17688)
+@@ -139,6 +139,8 @@
+ 	#}}}
+ 	def marshall(self,md,fid):    # {{{
+ 		WriteData(fid,'enum',DomainTypeEnum(),'data',StringToEnum("Mesh"+self.domaintype())[0],'format','Integer');
++		WriteData(fid,'enum',DomainDimensionEnum(),'data',self.dimension(),'format','Integer');
++		WriteData(fid,'enum',MeshElementtypeEnum(),'data',StringToEnum(self.elementtype())[0],'format','Integer');
+ 		WriteData(fid,'object',self,'class','mesh','fieldname','x','format','DoubleMat','mattype',1)
+ 		WriteData(fid,'object',self,'class','mesh','fieldname','y','format','DoubleMat','mattype',1)
+ 		WriteData(fid,'object',self,'class','mesh','fieldname','z','format','DoubleMat','mattype',1)
+Index: ../trunk-jpl/src/m/classes/mesh3dprisms.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh3dprisms.m	(revision 17687)
++++ ../trunk-jpl/src/m/classes/mesh3dprisms.m	(revision 17688)
+@@ -135,6 +135,8 @@
+ 		end % }}}
+ 		function marshall(obj,md,fid) % {{{
+ 			WriteData(fid,'enum',DomainTypeEnum(),'data',StringToEnum(['Mesh' domaintype(obj)]),'format','Integer');
++			WriteData(fid,'enum',DomainDimensionEnum(),'data',dimension(obj),'format','Integer');
++			WriteData(fid,'enum',MeshElementtypeEnum(),'data',StringToEnum(elementtype(obj)),'format','Integer');
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','x','format','DoubleMat','mattype',1);
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','y','format','DoubleMat','mattype',1);
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','z','format','DoubleMat','mattype',1);
+Index: ../trunk-jpl/src/m/classes/mesh3dtetras.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh3dtetras.m	(revision 17687)
++++ ../trunk-jpl/src/m/classes/mesh3dtetras.m	(revision 17688)
+@@ -129,6 +129,8 @@
+ 		end % }}}
+ 		function marshall(obj,md,fid) % {{{
+ 			WriteData(fid,'enum',DomainTypeEnum(),'data',Mesh3DtetrasEnum,'format','Integer');
++			WriteData(fid,'enum',DomainDimensionEnum(),'data',dimension(obj),'format','Integer');
++			WriteData(fid,'enum',MeshElementtypeEnum(),'data',StringToEnum(elementtype(obj)),'format','Integer');
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','x','format','DoubleMat','mattype',1);
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','y','format','DoubleMat','mattype',1);
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','z','format','DoubleMat','mattype',1);
+Index: ../trunk-jpl/src/m/classes/mesh2dvertical.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh2dvertical.m	(revision 17687)
++++ ../trunk-jpl/src/m/classes/mesh2dvertical.m	(revision 17688)
+@@ -104,6 +104,8 @@
+ 		end % }}}
+ 		function marshall(obj,md,fid) % {{{
+ 			WriteData(fid,'enum',DomainTypeEnum(),'data',StringToEnum(['Mesh' domaintype(obj)]),'format','Integer');
++			WriteData(fid,'enum',DomainDimensionEnum(),'data',dimension(obj),'format','Integer');
++			WriteData(fid,'enum',MeshElementtypeEnum(),'data',StringToEnum(elementtype(obj)),'format','Integer');
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','x','format','DoubleMat','mattype',1);
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','y','format','DoubleMat','mattype',1);
+ 			WriteData(fid,'enum',MeshZEnum(),'data',zeros(obj.numberofvertices,1),'format','DoubleMat','mattype',1);
+Index: ../trunk-jpl/src/m/classes/mesh2d.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh2d.m	(revision 17687)
++++ ../trunk-jpl/src/m/classes/mesh2d.m	(revision 17688)
+@@ -105,6 +105,8 @@
+ 		end % }}}
+ 		function marshall(obj,md,fid) % {{{
+ 			WriteData(fid,'enum',DomainTypeEnum(),'data',StringToEnum(['Mesh' domaintype(obj)]),'format','Integer');
++			WriteData(fid,'enum',DomainDimensionEnum(),'data',dimension(obj),'format','Integer');
++			WriteData(fid,'enum',MeshElementtypeEnum(),'data',StringToEnum(elementtype(obj)),'format','Integer');
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','x','format','DoubleMat','mattype',1);
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','y','format','DoubleMat','mattype',1);
+ 			WriteData(fid,'enum',MeshZEnum(),'data',zeros(obj.numberofvertices,1),'format','DoubleMat','mattype',1);
+Index: ../trunk-jpl/src/m/classes/mesh2d.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh2d.py	(revision 17687)
++++ ../trunk-jpl/src/m/classes/mesh2d.py	(revision 17688)
+@@ -108,6 +108,8 @@
+ 	#}}}
+ 	def marshall(self,md,fid):    # {{{
+ 		WriteData(fid,'enum',DomainTypeEnum(),'data',StringToEnum("Mesh"+self.domaintype())[0],'format','Integer');
++		WriteData(fid,'enum',DomainDimensionEnum(),'data',self.dimension(),'format','Integer');
++		WriteData(fid,'enum',MeshElementtypeEnum(),'data',StringToEnum(self.elementtype())[0],'format','Integer');
+ 		WriteData(fid,'object',self,'class','mesh','fieldname','x','format','DoubleMat','mattype',1)
+ 		WriteData(fid,'object',self,'class','mesh','fieldname','y','format','DoubleMat','mattype',1)
+ 		WriteData(fid,'enum',MeshZEnum(),'data',numpy.zeros(self.numberofvertices),'format','DoubleMat','mattype',1);
Index: issm/oecreview/Archive/16554-17801/ISSM-17688-17689.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17688-17689.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17688-17689.diff	(revision 17802)
@@ -0,0 +1,17 @@
+Index: ../trunk-jpl/test/NightlyRun/test322.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test322.py	(revision 17688)
++++ ../trunk-jpl/test/NightlyRun/test322.py	(revision 17689)
+@@ -34,7 +34,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Gradient','Misfits','FrictionCoefficient','Pressure','Vel','Vx','Vy']
+-field_tolerances=[1e-06,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,2e-09,2e-09,2e-09]
++field_tolerances=[5e-05,1e-08,1e-09,1e-09,2e-09,2e-09,2e-09]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Gradient1,\
+ 	md.results.StressbalanceSolution.J,\
+Index: ../trunk-jpl/test/Archives/Archive101.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17689-17690.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17689-17690.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17689-17690.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp	(revision 17689)
++++ ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp	(revision 17690)
+@@ -63,7 +63,7 @@
+ 
+ 	_assert_(basis);
+ 
+-	switch(element_type){
++	switch(finiteelement){
+ 		case P0Enum:
+ 			basis[0]=1.;
+ 			return;
Index: issm/oecreview/Archive/16554-17801/ISSM-17690-17691.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17690-17691.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17690-17691.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/plot/plot_unit.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_unit.py	(revision 17690)
++++ ../trunk-jpl/src/m/plot/plot_unit.py	(revision 17691)
+@@ -43,7 +43,7 @@
+    if datatype==1:
+       #element plot
+    	if is2d:
+-   		p.tripcolor(x,y,elements,data,colorlevels,edgecolors=edgecolor)
++   		p.tripcolor(x,y,elements,data,colorlevels,cmap=cmap,edgecolors=edgecolor)
+    	else:
+    		raise ValueError('plot_unit error: 3D element plot not supported yet')
+    	return
Index: issm/oecreview/Archive/16554-17801/ISSM-17691-17692.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17691-17692.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17691-17692.diff	(revision 17802)
@@ -0,0 +1,819 @@
+Index: ../trunk-jpl/src/c/analyses/DepthAverageAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DepthAverageAnalysis.cpp	(revision 17691)
++++ ../trunk-jpl/src/c/analyses/DepthAverageAnalysis.cpp	(revision 17692)
+@@ -58,7 +58,6 @@
+ 	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+-		case Mesh3DtetrasEnum:    dim = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 17691)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 17692)
+@@ -35,7 +35,7 @@
+ }/*}}}*/
+ void L2ProjectionBaseAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+-	if(iomodel->domaintype==Mesh3DEnum || iomodel->domaintype==Mesh3DtetrasEnum){
++	if(iomodel->domaintype==Mesh3DEnum){
+ 		iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	}
+ 	else if(iomodel->domaintype==Mesh2DverticalEnum){
+@@ -84,10 +84,6 @@
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+-		case Mesh3DtetrasEnum:
+-			if(!element->IsOnBase()) return NULL;
+-			basalelement = element->SpawnBasalElement();
+-			break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -147,10 +143,6 @@
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+-		case Mesh3DtetrasEnum:
+-			if(!element->IsOnBase()) return NULL;
+-			basalelement = element->SpawnBasalElement();
+-			break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -211,20 +203,23 @@
+ }/*}}}*/
+ void L2ProjectionBaseAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	int inputenum,domaintype;
++	int inputenum,domaintype,elementtype;
+ 
+ 	element->FindParam(&inputenum,InputToL2ProjectEnum);
+ 	element->FindParam(&domaintype,DomainTypeEnum);
++	element->FindParam(&elementtype,MeshElementtypeEnum);
+ 	switch(domaintype){
+ 		case Mesh2DhorizontalEnum:
+ 			element->InputUpdateFromSolutionOneDof(solution,inputenum);
+ 			break;
+ 		case Mesh2DverticalEnum:
+-		case Mesh3DtetrasEnum:
+ 			element->InputUpdateFromSolutionOneDof(solution,inputenum);
+ 			break;
+ 		case Mesh3DEnum:
+-			element->InputUpdateFromSolutionOneDofCollapsed(solution,inputenum);
++			if(elementtype==TetraEnum)
++			 element->InputUpdateFromSolutionOneDof(solution,inputenum);
++			else
++			 element->InputUpdateFromSolutionOneDofCollapsed(solution,inputenum);
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+Index: ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp	(revision 17691)
++++ ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp	(revision 17692)
+@@ -260,7 +260,6 @@
+ 		case Mesh2DhorizontalEnum: dim = 2; dofpernode = 1; break;
+ 		case Mesh2DverticalEnum:   dim = 2; dofpernode = 1; break;
+ 		case Mesh3DEnum:           dim = 3; dofpernode = 1; break;
+-		case Mesh3DtetrasEnum:     dim = 3; dofpernode = 1; break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17691)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17692)
+@@ -19,7 +19,6 @@
+ 		case SSAApproximationEnum:
+ 			 switch(domaintype){
+ 				 case Mesh3DEnum:           numdofs=2; break;
+-				 case Mesh3DtetrasEnum:     numdofs=2; break;
+ 				 case Mesh2DhorizontalEnum: numdofs=2; break;
+ 				 case Mesh2DverticalEnum:   numdofs=1; break;
+ 				 default: _error_("mesh type not supported yet");
+@@ -29,7 +28,6 @@
+ 		case HOApproximationEnum:   
+ 			 switch(domaintype){
+ 				 case Mesh3DEnum:         numdofs=2; break;
+-				 case Mesh3DtetrasEnum:   numdofs=2; break;
+ 				 case Mesh2DverticalEnum: numdofs=1; break;
+ 				 default: _error_("mesh type not supported yet");
+ 			 }
+@@ -38,7 +36,6 @@
+ 		case FSvelocityEnum:
+ 			 switch(domaintype){
+ 				 case Mesh3DEnum:         numdofs=3; break;
+-				 case Mesh3DtetrasEnum:   numdofs=3; break;
+ 				 case Mesh2DverticalEnum: numdofs=2; break;
+ 				 default: _error_("mesh type not supported yet");
+ 			}
+@@ -47,7 +44,6 @@
+ 		case NoneApproximationEnum:
+ 			 switch(domaintype){
+ 				 case Mesh3DEnum:         numdofs=4; break;
+-				 case Mesh3DtetrasEnum:   numdofs=4; break;
+ 				 case Mesh2DverticalEnum: numdofs=3; break;
+ 				 default: _error_("mesh type not supported yet");
+ 			}
+@@ -226,14 +222,6 @@
+ 		iomodel->FetchDataToInput(elements,VzEnum,0.);
+ 		if(dakota_analysis)elements->InputDuplicate(VzEnum,QmuVzEnum);
+ 	}
+-	if(iomodel->domaintype==Mesh3DtetrasEnum){
+-		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
+-		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+-		iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
+-		iomodel->FetchDataToInput(elements,LoadingforceZEnum);
+-		iomodel->FetchDataToInput(elements,VzEnum,0.);
+-		if(dakota_analysis)elements->InputDuplicate(VzEnum,QmuVzEnum);
+-	}
+ 	if(iomodel->domaintype==Mesh2DverticalEnum){
+ 		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+ 	}
+@@ -430,7 +418,7 @@
+ 			iomodel->FetchData(&nodeonFS,NULL,NULL,FlowequationBorderFSEnum);
+ 			iomodel->FetchData(&nodeonbase,NULL,NULL,MeshVertexonbaseEnum);
+ 			iomodel->FetchData(&groundedice_ls,NULL,NULL,MaskGroundediceLevelsetEnum);
+-			if(iomodel->domaintype==Mesh3DEnum || iomodel->domaintype==Mesh3DtetrasEnum){
++			if(iomodel->domaintype==Mesh3DEnum){
+ 				iomodel->FetchData(&spcvz,&Mz,&Nz,StressbalanceSpcvzEnum);
+ 			}
+ 			else if (iomodel->domaintype==Mesh2DverticalEnum){
+@@ -439,7 +427,7 @@
+ 			else{
+ 				_error_("not supported yet");
+ 			}
+-			if(iomodel->domaintype==Mesh3DEnum || iomodel->domaintype==Mesh3DtetrasEnum){
++			if(iomodel->domaintype==Mesh3DEnum){
+ 				IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvxEnum,StressbalanceAnalysisEnum,finiteelement,0);
+ 				IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvyEnum,StressbalanceAnalysisEnum,finiteelement,1);
+ 				IoModelToConstraintsx(constraints,iomodel,spcvz,Mz,Nz,StressbalanceAnalysisEnum,finiteelement,2);
+@@ -519,10 +507,10 @@
+ 	iomodel->FetchData(&spcvy,&My,&Ny,StressbalanceSpcvyEnum);
+ 	iomodel->FetchData(&spcvz,&Mz,&Nz,StressbalanceSpcvzEnum);
+ 	iomodel->FetchData(&nodeonSSA,NULL,NULL,FlowequationBorderSSAEnum);
+-	if(iomodel->domaintype==Mesh3DEnum || iomodel->domaintype==Mesh3DtetrasEnum)iomodel->FetchData(&nodeonHO,NULL,NULL,FlowequationBorderHOEnum);
+-	if(iomodel->domaintype==Mesh3DEnum || iomodel->domaintype==Mesh3DtetrasEnum)iomodel->FetchData(&nodeonFS,NULL,NULL,FlowequationBorderFSEnum);
+-	if(iomodel->domaintype==Mesh3DEnum || iomodel->domaintype==Mesh3DtetrasEnum)iomodel->FetchData(&nodeonbase,NULL,NULL,MeshVertexonbaseEnum);
+-	if(iomodel->domaintype==Mesh3DEnum || iomodel->domaintype==Mesh3DtetrasEnum)iomodel->FetchData(&groundedice_ls,NULL,NULL,MaskGroundediceLevelsetEnum);
++	if(iomodel->domaintype==Mesh3DEnum)iomodel->FetchData(&nodeonHO,NULL,NULL,FlowequationBorderHOEnum);
++	if(iomodel->domaintype==Mesh3DEnum)iomodel->FetchData(&nodeonFS,NULL,NULL,FlowequationBorderFSEnum);
++	if(iomodel->domaintype==Mesh3DEnum)iomodel->FetchData(&nodeonbase,NULL,NULL,MeshVertexonbaseEnum);
++	if(iomodel->domaintype==Mesh3DEnum)iomodel->FetchData(&groundedice_ls,NULL,NULL,MaskGroundediceLevelsetEnum);
+ 	iomodel->FetchData(&vertices_type,NULL,NULL,FlowequationVertexEquationEnum);
+ 	iomodel->FetchData(&surface,NULL,NULL,SurfaceEnum);
+ 	iomodel->FetchData(&z,NULL,NULL,MeshZEnum);
+@@ -749,10 +737,10 @@
+ 	iomodel->DeleteData(spcvy,StressbalanceSpcvyEnum);
+ 	iomodel->DeleteData(spcvz,StressbalanceSpcvzEnum);
+ 	iomodel->DeleteData(nodeonSSA,FlowequationBorderSSAEnum);
+-	if(iomodel->domaintype==Mesh3DEnum || iomodel->domaintype==Mesh3DtetrasEnum)iomodel->DeleteData(nodeonHO,FlowequationBorderHOEnum);
+-	if(iomodel->domaintype==Mesh3DEnum || iomodel->domaintype==Mesh3DtetrasEnum)iomodel->DeleteData(nodeonFS,FlowequationBorderFSEnum);
+-	if(iomodel->domaintype==Mesh3DEnum || iomodel->domaintype==Mesh3DtetrasEnum)iomodel->DeleteData(nodeonbase,MeshVertexonbaseEnum);
+-	if(iomodel->domaintype==Mesh3DEnum || iomodel->domaintype==Mesh3DtetrasEnum)iomodel->DeleteData(groundedice_ls,MaskGroundediceLevelsetEnum);
++	if(iomodel->domaintype==Mesh3DEnum)iomodel->DeleteData(nodeonHO,FlowequationBorderHOEnum);
++	if(iomodel->domaintype==Mesh3DEnum)iomodel->DeleteData(nodeonFS,FlowequationBorderFSEnum);
++	if(iomodel->domaintype==Mesh3DEnum)iomodel->DeleteData(nodeonbase,MeshVertexonbaseEnum);
++	if(iomodel->domaintype==Mesh3DEnum)iomodel->DeleteData(groundedice_ls,MaskGroundediceLevelsetEnum);
+ 	iomodel->DeleteData(vertices_type,FlowequationVertexEquationEnum);
+ 	iomodel->DeleteData(surface,SurfaceEnum);
+ 	iomodel->DeleteData(z,MeshZEnum);
+@@ -997,7 +985,6 @@
+ 		case Mesh2DhorizontalEnum: dim = 2; dofpernode = 2; break;
+ 		case Mesh2DverticalEnum:   dim = 2; dofpernode = 1; break;
+ 		case Mesh3DEnum:           dim = 3; dofpernode = 2; break;
+-		case Mesh3DtetrasEnum:     dim = 3; dofpernode = 2; break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -1215,7 +1202,6 @@
+ 		case Mesh2DverticalEnum:   dim = 1;break;
+ 		case Mesh2DhorizontalEnum: dim = 2;break;
+ 		case Mesh3DEnum:           dim = 2;break;
+-		case Mesh3DtetrasEnum:     dim = 2;break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -1301,7 +1287,6 @@
+ 		case Mesh2DverticalEnum:   dim = 1; bsize = 1; break;
+ 		case Mesh2DhorizontalEnum: dim = 2; bsize = 3; break;
+ 		case Mesh3DEnum:           dim = 2; bsize = 3; break;
+-		case Mesh3DtetrasEnum:     dim = 2; bsize = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -1414,7 +1399,6 @@
+ 		case Mesh2DverticalEnum:   dim = 1;break;
+ 		case Mesh2DhorizontalEnum: dim = 2;break;
+ 		case Mesh3DEnum:           dim = 2;break;
+-		case Mesh3DtetrasEnum:     dim = 2;break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -1480,7 +1464,6 @@
+ 		case Mesh2DverticalEnum:   dim = 1;break;
+ 		case Mesh2DhorizontalEnum: dim = 2;break;
+ 		case Mesh3DEnum:           dim = 2;break;
+-		case Mesh3DtetrasEnum:     dim = 2;break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -2179,7 +2162,6 @@
+ 	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; bsize = 2; break;
+ 		case Mesh3DEnum:         dim = 3; bsize = 5; break;
+-		case Mesh3DtetrasEnum:   dim = 3; bsize = 5; break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -2259,7 +2241,6 @@
+ 	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+-		case Mesh3DtetrasEnum:   dim = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -2345,7 +2326,6 @@
+ 	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+-		case Mesh3DtetrasEnum:   dim = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -2422,7 +2402,6 @@
+ 	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+-		case Mesh3DtetrasEnum:   dim = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -2484,7 +2463,6 @@
+ 	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+-		case Mesh3DtetrasEnum:   dim = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -2683,7 +2661,6 @@
+ 	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+-		case Mesh3DtetrasEnum:   dim = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -2771,7 +2748,6 @@
+ 	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+-		case Mesh3DtetrasEnum:   dim = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -2913,7 +2889,6 @@
+ 	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; epssize = 3; break;
+ 		case Mesh3DEnum:         dim = 3; epssize = 6; break;
+-		case Mesh3DtetrasEnum:   dim = 3; epssize = 6; break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -2985,7 +2960,6 @@
+ 	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; epssize = 3; break;
+ 		case Mesh3DEnum:         dim = 3; epssize = 6; break;
+-		case Mesh3DtetrasEnum:   dim = 3; epssize = 6; break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -3071,7 +3045,6 @@
+ 	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2;break;
+ 		case Mesh3DEnum:         dim = 3;break;
+-		case Mesh3DtetrasEnum:   dim = 3;break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -3142,7 +3115,6 @@
+ 	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2;break;
+ 		case Mesh3DEnum:         dim = 3;break;
+-		case Mesh3DtetrasEnum:   dim = 3;break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -3206,7 +3178,6 @@
+ 	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+-		case Mesh3DtetrasEnum:   dim = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -3292,7 +3263,6 @@
+ 	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2;break;
+ 		case Mesh3DEnum:         dim = 3;break;
+-		case Mesh3DtetrasEnum:   dim = 3;break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -3407,7 +3377,6 @@
+ 	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+-		case Mesh3DtetrasEnum:   dim = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -3485,7 +3454,6 @@
+ 	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; tausize = 3; break;
+ 		case Mesh3DEnum:         dim = 3; tausize = 6; break;
+-		case Mesh3DtetrasEnum:   dim = 3; tausize = 6; break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -3662,7 +3630,6 @@
+ 	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+-		case Mesh3DtetrasEnum:   dim = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -3739,7 +3706,6 @@
+ 	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+-		case Mesh3DtetrasEnum:   dim = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -4092,7 +4058,6 @@
+ 	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+-		case Mesh3DtetrasEnum:   dim = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -4159,7 +4124,6 @@
+ 	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+-		case Mesh3DtetrasEnum:   dim = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -4245,7 +4209,6 @@
+ 	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; break;
+ 		case Mesh3DEnum:         dim = 3; break;
+-		case Mesh3DtetrasEnum:   dim = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -4343,7 +4306,6 @@
+ 	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; tausize = 3; break;
+ 		case Mesh3DEnum:         dim = 3; tausize = 6; break;
+-		case Mesh3DtetrasEnum:   dim = 3; tausize = 6; break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -4557,7 +4519,6 @@
+ 	switch(domaintype){
+ 		case Mesh2DverticalEnum: dim = 2; tausize = 3; break;
+ 		case Mesh3DEnum:         dim = 3; tausize = 6; break;
+-		case Mesh3DtetrasEnum:   dim = 3; tausize = 6; break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+Index: ../trunk-jpl/src/c/modules/MeshPartitionx/MeshPartitionx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/MeshPartitionx/MeshPartitionx.h	(revision 17691)
++++ ../trunk-jpl/src/c/modules/MeshPartitionx/MeshPartitionx.h	(revision 17692)
+@@ -10,7 +10,7 @@
+ /* local prototypes: */
+ template <class doubletype> 
+ int MeshPartitionx(int** pepart, int** pnpart, int numberofelements,int numberofnodes,int* elements,
+-		int numberofelements2d,int numberofnodes2d,doubletype* elements2d,int numlayers,int elements_width, int domaintype,int num_procs){
++		int numberofelements2d,int numberofnodes2d,doubletype* elements2d,int numlayers,int elements_width, int meshelementtype,int num_procs){
+ 
+ 	int noerr=1;
+ 	int i,j;
+@@ -30,10 +30,9 @@
+ 	int  numflag=0;
+ 	int  edgecut=1;
+ 
+-	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
+-		case Mesh2DverticalEnum:
+-		case Mesh3DtetrasEnum:
++	switch(meshelementtype){
++		case TriaEnum:
++		case TetraEnum:
+ 			epart=xNew<int>(numberofelements);
+ 			npart=xNew<int>(numberofnodes);
+ 			index=xNew<int>(elements_width*numberofelements);
+@@ -58,7 +57,7 @@
+ 			}
+ 			else _error_("At least one processor is required");
+ 			break;
+-		case Mesh3DEnum:
++		case PentaEnum:
+ 			/*We have a 3d mesh, made of a regularly extruded 2d mesh. We first partition the 2d mesh, then we extrude the partition: */
+ 
+ 			/*First build concatenated 2d mesh  from 2d_coll and 2d_noncoll: */
+@@ -110,7 +109,7 @@
+ 			}
+ 			break;
+ 		default:
+-			_error_("mesh type "<<EnumToStringx(domaintype)<<" not supported yet");
++			_error_("mesh type "<<EnumToStringx(meshelementtype)<<" not supported yet");
+ 	}
+ 
+ 	/*Assign output pointer:*/
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp	(revision 17691)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp	(revision 17692)
+@@ -35,11 +35,10 @@
+ 	connectivity=xNewZeroInit<int>(iomodel->numberofvertices);
+ 
+ 	/*Get element width*/
+-	switch(iomodel->domaintype){
+-		case Mesh2DhorizontalEnum: elementswidth=3; break;
+-		case Mesh2DverticalEnum:   elementswidth=3; break;
+-		case Mesh3DtetrasEnum:     elementswidth=4; break;
+-		case Mesh3DEnum:           elementswidth=6; break;
++	switch(iomodel->meshelementtype){
++		case TriaEnum:  elementswidth=3; break;
++		case TetraEnum: elementswidth=4; break;
++		case PentaEnum: elementswidth=6; break;
+ 		default:                   _error_("mesh not supported yet");
+ 	}
+ 
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp	(revision 17691)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp	(revision 17692)
+@@ -143,7 +143,7 @@
+ 	for(i=0;i<iomodel->numberofvertices;i++) head_minv[i]=-1;
+ 
+ 	/*Mesh specific face indexing per element*/
+-	if(iomodel->domaintype==Mesh3DEnum){
++	if(iomodel->meshelementtype==PentaEnum){
+ 		elementnbv = 6; /*Number of vertices per element*/
+ 		elementnbf = 5; /*Number of faces per element*/
+ 		facemaxnbv = 4; /*Maximum number of vertices per face*/
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp	(revision 17691)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp	(revision 17692)
+@@ -22,52 +22,44 @@
+ 	int *elementedges_markers = NULL;
+ 
+ 	/*Mesh dependent variables*/
+-	if(iomodel->domaintype==Mesh2DhorizontalEnum){
+-		elementnbv = 3;
+-		elementnbe = 3;
+-		elementedges         = xNew<int>(elementnbe*2);
+-		elementedges_markers = xNew<int>(elementnbe);
+-		elementedges[2*0+0] = 1; elementedges[2*0+1] = 2; elementedges_markers[0] = 1;
+-		elementedges[2*1+0] = 2; elementedges[2*1+1] = 0; elementedges_markers[1] = 1;
+-		elementedges[2*2+0] = 0; elementedges[2*2+1] = 1; elementedges_markers[2] = 1;
+-	}
+-	else if(iomodel->domaintype==Mesh2DverticalEnum){
+-		elementnbv = 3;
+-		elementnbe = 3;
+-		elementedges         = xNew<int>(elementnbe*2);
+-		elementedges_markers = xNew<int>(elementnbe);
+-		elementedges[2*0+0] = 1; elementedges[2*0+1] = 2; elementedges_markers[0] = 1;
+-		elementedges[2*1+0] = 2; elementedges[2*1+1] = 0; elementedges_markers[1] = 1;
+-		elementedges[2*2+0] = 0; elementedges[2*2+1] = 1; elementedges_markers[2] = 1;
+-	}
+-	else if(iomodel->domaintype==Mesh3DtetrasEnum){
+-		elementnbv = 4;
+-		elementnbe = 6;
+-		elementedges         = xNew<int>(elementnbe*2);
+-		elementedges_markers = xNew<int>(elementnbe);
+-		elementedges[2*0+0] = 1; elementedges[2*0+1] = 2; elementedges_markers[0] = 1;
+-		elementedges[2*1+0] = 2; elementedges[2*1+1] = 0; elementedges_markers[1] = 1;
+-		elementedges[2*2+0] = 0; elementedges[2*2+1] = 1; elementedges_markers[2] = 1;
+-		elementedges[2*3+0] = 0; elementedges[2*3+1] = 3; elementedges_markers[3] = 1;
+-		elementedges[2*4+0] = 1; elementedges[2*4+1] = 3; elementedges_markers[4] = 1;
+-		elementedges[2*5+0] = 2; elementedges[2*5+1] = 3; elementedges_markers[5] = 1;
+-	}
+-	else if(iomodel->domaintype==Mesh3DEnum){
+-		elementnbv = 6;
+-		elementnbe = 9;
+-		elementedges         = xNew<int>(elementnbe*2);
+-		elementedges_markers = xNew<int>(elementnbe);
+-		elementedges[2*0+0] = 0; elementedges[2*0+1] = 3; elementedges_markers[0] = 2;
+-		elementedges[2*1+0] = 1; elementedges[2*1+1] = 4; elementedges_markers[1] = 2;
+-		elementedges[2*2+0] = 2; elementedges[2*2+1] = 5; elementedges_markers[2] = 2;
+-		elementedges[2*3+0] = 1; elementedges[2*3+1] = 2; elementedges_markers[3] = 1;
+-		elementedges[2*4+0] = 2; elementedges[2*4+1] = 0; elementedges_markers[4] = 1;
+-		elementedges[2*5+0] = 0; elementedges[2*5+1] = 1; elementedges_markers[5] = 1;
+-		elementedges[2*6+0] = 4; elementedges[2*6+1] = 5; elementedges_markers[6] = 1;
+-		elementedges[2*7+0] = 5; elementedges[2*7+1] = 3; elementedges_markers[7] = 1;
+-		elementedges[2*8+0] = 3; elementedges[2*8+1] = 4; elementedges_markers[8] = 1;
+-	}
+-	else{
++	switch(iomodel->meshelementtype){
++		case TriaEnum:
++			elementnbv = 3;
++			elementnbe = 3;
++			elementedges         = xNew<int>(elementnbe*2);
++			elementedges_markers = xNew<int>(elementnbe);
++			elementedges[2*0+0] = 1; elementedges[2*0+1] = 2; elementedges_markers[0] = 1;
++			elementedges[2*1+0] = 2; elementedges[2*1+1] = 0; elementedges_markers[1] = 1;
++			elementedges[2*2+0] = 0; elementedges[2*2+1] = 1; elementedges_markers[2] = 1;
++			break;
++		case TetraEnum:
++			elementnbv = 4;
++			elementnbe = 6;
++			elementedges         = xNew<int>(elementnbe*2);
++			elementedges_markers = xNew<int>(elementnbe);
++			elementedges[2*0+0] = 1; elementedges[2*0+1] = 2; elementedges_markers[0] = 1;
++			elementedges[2*1+0] = 2; elementedges[2*1+1] = 0; elementedges_markers[1] = 1;
++			elementedges[2*2+0] = 0; elementedges[2*2+1] = 1; elementedges_markers[2] = 1;
++			elementedges[2*3+0] = 0; elementedges[2*3+1] = 3; elementedges_markers[3] = 1;
++			elementedges[2*4+0] = 1; elementedges[2*4+1] = 3; elementedges_markers[4] = 1;
++			elementedges[2*5+0] = 2; elementedges[2*5+1] = 3; elementedges_markers[5] = 1;
++			break;
++		case PentaEnum:
++			elementnbv = 6;
++			elementnbe = 9;
++			elementedges         = xNew<int>(elementnbe*2);
++			elementedges_markers = xNew<int>(elementnbe);
++			elementedges[2*0+0] = 0; elementedges[2*0+1] = 3; elementedges_markers[0] = 2;
++			elementedges[2*1+0] = 1; elementedges[2*1+1] = 4; elementedges_markers[1] = 2;
++			elementedges[2*2+0] = 2; elementedges[2*2+1] = 5; elementedges_markers[2] = 2;
++			elementedges[2*3+0] = 1; elementedges[2*3+1] = 2; elementedges_markers[3] = 1;
++			elementedges[2*4+0] = 2; elementedges[2*4+1] = 0; elementedges_markers[4] = 1;
++			elementedges[2*5+0] = 0; elementedges[2*5+1] = 1; elementedges_markers[5] = 1;
++			elementedges[2*6+0] = 4; elementedges[2*6+1] = 5; elementedges_markers[6] = 1;
++			elementedges[2*7+0] = 5; elementedges[2*7+1] = 3; elementedges_markers[7] = 1;
++			elementedges[2*8+0] = 3; elementedges[2*8+1] = 4; elementedges_markers[8] = 1;
++			break;
++		default:
+ 		_error_("mesh dimension not supported yet");
+ 	}
+ 
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/EdgesPartitioning.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/EdgesPartitioning.cpp	(revision 17691)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/EdgesPartitioning.cpp	(revision 17692)
+@@ -17,21 +17,13 @@
+ 	_assert_(iomodel->elementtoedgeconnectivity);
+ 
+ 	/*Mesh dependent variables*/
+-	if(iomodel->domaintype==Mesh2DhorizontalEnum){
+-		elementnbe = 3;
++	switch(iomodel->meshelementtype){
++		case TriaEnum:  elementnbe = 3; break;
++		case TetraEnum: elementnbe = 6; break;
++		case PentaEnum: elementnbe = 9; break;
++		default: _error_("mesh dimension not supported yet");
+ 	}
+-	else if(iomodel->domaintype==Mesh2DverticalEnum){
+-		elementnbe = 3;
+-	}
+-	else if(iomodel->domaintype==Mesh3DtetrasEnum){
+-		elementnbe = 6;
+-	}
+-	else if(iomodel->domaintype==Mesh3DEnum){
+-		elementnbe = 9;
+-	}
+-	else{
+-		_error_("mesh dimension not supported yet");
+-	}
++
+ 	/*output: */
+ 	bool* my_edges=xNewZeroInit<bool>(iomodel->numberofedges);
+ 
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17691)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17692)
+@@ -41,6 +41,8 @@
+ 
+ 	/*Copy some constants from iomodel */
+ 	parameters->AddObject(iomodel->CopyConstantObject(DomainTypeEnum));
++	parameters->AddObject(iomodel->CopyConstantObject(DomainDimensionEnum));
++	parameters->AddObject(iomodel->CopyConstantObject(MeshElementtypeEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(SettingsOutputFrequencyEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(SteadystateReltolEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(SteadystateMaxiterEnum));
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp	(revision 17691)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp	(revision 17692)
+@@ -25,23 +25,18 @@
+ 
+ 	/*Create elements*/
+ 	if(control_analysis)iomodel->FetchData(3,InversionControlParametersEnum,InversionMinParametersEnum,InversionMaxParametersEnum);
+-	switch(iomodel->domaintype){
+-		case Mesh2DhorizontalEnum:
++	switch(iomodel->meshelementtype){
++		case TriaEnum:
+ 			for(i=0;i<iomodel->numberofelements;i++){
+ 				if(iomodel->my_elements[i]) elements->AddObject(new Tria(i+1,i,i,iomodel,nummodels));
+ 			}
+ 			break;
+-		case Mesh2DverticalEnum:
++		case TetraEnum:
+ 			for(i=0;i<iomodel->numberofelements;i++){
+-				if(iomodel->my_elements[i]) elements->AddObject(new Tria(i+1,i,i,iomodel,nummodels));
+-			}
+-			break;
+-		case Mesh3DtetrasEnum:
+-			for(i=0;i<iomodel->numberofelements;i++){
+ 				if(iomodel->my_elements[i]) elements->AddObject(new Tetra(i+1,i,i,iomodel,nummodels));
+ 			}
+ 			break;
+-		case Mesh3DEnum:
++		case PentaEnum:
+ 			iomodel->FetchData(2,MeshUpperelementsEnum,MeshLowerelementsEnum);
+ 			for(i=0;i<iomodel->numberofelements;i++){
+ 				if(iomodel->my_elements[i]) elements->AddObject(new Penta(i+1,i,i,iomodel,nummodels));
+@@ -58,13 +53,13 @@
+ 			iomodel->FetchDataToInput(elements,MaterialsRheologyNEnum);
+ 			iomodel->FetchDataToInput(elements,DamageDEnum);
+ 			for (i=0;i<iomodel->numberofelements;i++) if(iomodel->my_elements[i]) materials->AddObject(new Matice(i+1,i,iomodel));
+-			switch(iomodel->domaintype){
+-				case Mesh2DhorizontalEnum: case Mesh2DverticalEnum:
++			switch(iomodel->domaindim){
++				case 2:
+ 					elements->InputDuplicate(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum);
+ 					elements->InputDuplicate(DamageDEnum,DamageDbarEnum);
+ 					if(dakota_analysis) elements->InputDuplicate(MaterialsRheologyBbarEnum,QmuMaterialsRheologyBEnum);
+ 					break;
+-				case Mesh3DEnum: case Mesh3DtetrasEnum:
++				case 3:
+ 					if(dakota_analysis) elements->InputDuplicate(MaterialsRheologyBEnum,QmuMaterialsRheologyBEnum); 
+ 					break;
+ 				default:
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp	(revision 17691)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp	(revision 17692)
+@@ -50,27 +50,21 @@
+ 
+ 	/*Number of vertices per elements, needed to correctly retrieve data: */
+ 	/*Determine parallel partitioning of elements: we use Metis for now. First load the data, then partition*/
+-	switch(iomodel->domaintype){
+-		case Mesh2DhorizontalEnum:
++	switch(iomodel->meshelementtype){
++		case TriaEnum:
+ 			elements_width=3;
+ 			numberofelements2d = 0;
+ 			numberofvertices2d = 0;
+ 			numlayers          = 0;
+ 			break;
+-		case Mesh2DverticalEnum:
+-			elements_width=3;
++		case TetraEnum:
++			elements_width=4;
+ 			numberofelements2d = 0;
+ 			numberofvertices2d = 0;
+ 			numlayers          = 0;
+ 			break;
+-		case Mesh3DtetrasEnum:
+-			elements_width=4; //penta elements
+-			numberofelements2d = 0;
+-			numberofvertices2d = 0;
+-			numlayers          = 0;
+-			break;
+-		case Mesh3DEnum:
+-			elements_width=6; //penta elements
++		case PentaEnum:
++			elements_width=6;
+ 			iomodel->FetchData(&elements2d,NULL,NULL,MeshElements2dEnum);
+ 			iomodel->Constant(&numberofelements2d,MeshNumberofelements2dEnum);
+ 			iomodel->Constant(&numberofvertices2d,MeshNumberofvertices2dEnum);
+@@ -80,7 +74,7 @@
+ 			_error_("mesh not supported yet");
+ 	}
+ 
+-	MeshPartitionx(&epart,&npart,iomodel->numberofelements,iomodel->numberofvertices,iomodel->elements,numberofelements2d,numberofvertices2d,elements2d,numlayers,elements_width,iomodel->domaintype,num_procs);
++	MeshPartitionx(&epart,&npart,iomodel->numberofelements,iomodel->numberofvertices,iomodel->elements,numberofelements2d,numberofvertices2d,elements2d,numlayers,elements_width,iomodel->meshelementtype,num_procs);
+ 
+ 	/*Free elements2d: */
+ 	xDelete<int>(elements2d);
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17691)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17692)
+@@ -143,7 +143,7 @@
+ 				}
+ 			}
+ 			id0 = id0+iomodel->numberofvertices+iomodel->numberofedges;
+-	      if(iomodel->domaintype==Mesh3DEnum){
++	      if(iomodel->meshelementtype==PentaEnum){
+ 				FacesPartitioning(&my_faces,iomodel);
+ 				for(i=0;i<iomodel->numberoffaces;i++){
+ 					if(iomodel->faces[i*6+5]==2){/*Vertical quads*/
+@@ -308,7 +308,7 @@
+ 				}
+ 			}
+ 			id0 = id0+iomodel->numberofvertices+iomodel->numberofedges;
+-	      if(iomodel->domaintype==Mesh3DEnum){
++	      if(iomodel->meshelementtype==PentaEnum){
+ 				FacesPartitioning(&my_faces,iomodel);
+ 				for(i=0;i<iomodel->numberoffaces;i++){
+ 					if(iomodel->faces[i*6+5]==2){/*Vertical quads*/
+@@ -327,7 +327,7 @@
+ 			}
+ 
+ 			/*P1 pressure*/
+-	      if(iomodel->domaintype==Mesh3DEnum){
++	      if(iomodel->meshelementtype==PentaEnum){
+ 				numberoffaces=iomodel->numberoffaces;
+ 			}
+ 			else{
+Index: ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17691)
++++ ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17692)
+@@ -50,11 +50,10 @@
+ 			/*Nothing else to do*/
+ 			break;
+ 		case P1bubbleEnum:
+-			switch(iomodel->domaintype){
+-				case Mesh2DhorizontalEnum: elementnbv = 3; break;
+-				case Mesh2DverticalEnum:   elementnbv = 3; break;
+-				case Mesh3DtetrasEnum:     elementnbv = 4; break;
+-				case Mesh3DEnum:           elementnbv = 6; break;
++			switch(iomodel->meshelementtype){
++				case TriaEnum:  elementnbv = 3; break;
++				case TetraEnum: elementnbv = 4; break;
++				case PentaEnum: elementnbv = 6; break;
+ 				default: _error_("mesh type not supported yet");
+ 			}
+ 			break;
+@@ -72,7 +71,7 @@
+ 			break;
+ 		case P2Enum:
+ 			EdgesPartitioning(&my_edges,iomodel);
+-	      if(iomodel->domaintype==Mesh3DEnum){
++	      if(iomodel->meshelementtype==PentaEnum){
+ 				FacesPartitioning(&my_faces,iomodel);
+ 			}
+ 			break;
+@@ -117,7 +116,7 @@
+ 						}
+ 					}
+ 				}
+-				if(iomodel->domaintype==Mesh3DEnum){
++				if(iomodel->meshelementtype==PentaEnum){
+ 					for(i=0;i<iomodel->numberoffaces;i++){
+ 						if(iomodel->faces[i*6+5]==2){/*Vertical quads*/
+ 							if(my_faces[i]){
+Index: ../trunk-jpl/src/c/classes/IoModel.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/IoModel.h	(revision 17691)
++++ ../trunk-jpl/src/c/classes/IoModel.h	(revision 17692)
+@@ -31,6 +31,8 @@
+ 
+ 		/*Mesh properties and connectivity tables*/
+ 		int  domaintype;
++		int  domaindim;
++		int  meshelementtype;
+ 		int  numberofvertices;
+ 		int  numberofelements;
+ 		int  numberoffaces;
+Index: ../trunk-jpl/src/c/classes/IoModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 17691)
++++ ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 17692)
+@@ -30,6 +30,8 @@
+ 	this->my_vertices=NULL;
+ 
+ 	this->domaintype=-1;
++	this->domaindim=-1;
++	this->meshelementtype=-1;
+ 	this->numberofvertices=-1;
+ 	this->numberofelements=-1;
+ 	this->numberoffaces=-1;
+@@ -75,6 +77,8 @@
+ 	this->my_vertices = NULL;
+ 
+ 	FetchData(&this->domaintype,DomainTypeEnum);
++	FetchData(&this->domaindim,DomainDimensionEnum);
++	FetchData(&this->meshelementtype,MeshElementtypeEnum);
+ 	FetchData(&this->numberofvertices,MeshNumberofverticesEnum);
+ 	FetchData(&this->numberofelements,MeshNumberofelementsEnum);
+ 	FetchData(&this->elements,NULL,NULL,MeshElementsEnum);
Index: issm/oecreview/Archive/16554-17801/ISSM-17692-17693.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17692-17693.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17692-17693.diff	(revision 17802)
@@ -0,0 +1,52 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 17692)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 17693)
+@@ -33,8 +33,10 @@
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+-	iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+-	iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
++	if(iomodel->meshelementtype==PentaEnum){
++		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
++		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
++	}
+ 	iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
+ 	iomodel->FetchDataToInput(elements,VxEnum,0.);
+ 	iomodel->FetchDataToInput(elements,VyEnum,0.);
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 17692)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 17693)
+@@ -26,8 +26,11 @@
+ 	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	if(iomodel->domaintype==Mesh3DEnum){
+-		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+-		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
++		if(iomodel->meshelementtype==PentaEnum){
++			iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
++			iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
++		}
++		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
+ 	}
+ 	if(iomodel->domaintype==Mesh2DverticalEnum){
+ 		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17692)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17693)
+@@ -214,8 +214,10 @@
+ 	iomodel->FetchDataToInput(elements,DamageDEnum);
+ 
+ 	if(iomodel->domaintype==Mesh3DEnum){
+-		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+-		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
++		if(iomodel->meshelementtype==PentaEnum){
++			iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
++			iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
++		}
+ 		iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
+ 		iomodel->FetchDataToInput(elements,FlowequationBorderFSEnum);
+ 		iomodel->FetchDataToInput(elements,LoadingforceZEnum);
Index: issm/oecreview/Archive/16554-17801/ISSM-17693-17694.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17693-17694.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17693-17694.diff	(revision 17802)
@@ -0,0 +1,43 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 17693)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 17694)
+@@ -37,6 +37,7 @@
+ 		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
++	iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
+ 	iomodel->FetchDataToInput(elements,VxEnum,0.);
+ 	iomodel->FetchDataToInput(elements,VyEnum,0.);
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17693)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17694)
+@@ -165,6 +165,13 @@
+ 	_error_("Could not find 3 vertices on bed");
+ }
+ /*}}}*/
++/*FUNCTION Tetra::GetElementType {{{*/
++int Tetra::GetElementType(){
++
++	/*return TetraRef field*/
++	return this->element_type;
++}
++/*}}}*/
+ /*FUNCTION Tetra::GetNumberOfNodes;{{{*/
+ int Tetra::GetNumberOfNodes(void){
+ 	return this->NumberofNodes();
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17693)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17694)
+@@ -114,7 +114,7 @@
+ 		IssmDouble  GetXcoord(Gauss* gauss){_error_("Not implemented");};
+ 		IssmDouble  GetYcoord(Gauss* gauss){_error_("Not implemented");};
+ 		IssmDouble  GetZcoord(Gauss* gauss);
+-		int         GetElementType(void){_error_("not implemented yet");};
++		int         GetElementType(void);
+ 		Gauss*      NewGauss(void);
+ 		Gauss*      NewGauss(int order);
+       Gauss*      NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){_error_("not implemented yet");};
Index: issm/oecreview/Archive/16554-17801/ISSM-17694-17695.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17694-17695.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17694-17695.diff	(revision 17802)
@@ -0,0 +1,8 @@
+Index: ../trunk-jpl/test/Archives/Archive999.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive999.hdf5
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: issm/oecreview/Archive/16554-17801/ISSM-17695-17696.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17695-17696.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17695-17696.diff	(revision 17802)
@@ -0,0 +1,51 @@
+Index: ../trunk-jpl/src/m/plot/processdata.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/processdata.py	(revision 17695)
++++ ../trunk-jpl/src/m/plot/processdata.py	(revision 17696)
+@@ -28,22 +28,24 @@
+ 		numberofvertices2d=npy.nan
+ 		numberofelements2d=npy.nan
+ 
++	procdata=npy.copy(data)
++
+ 	#process patch
+ 
+ 	#initialize datatype
+ 	datatype=0
+ 
+ 	#get datasize
+-	if npy.ndim(data)==1:
+-		datasize=npy.array([len(data),1])
++	if npy.ndim(procdata)==1:
++		datasize=npy.array([len(procdata),1])
+ 	else:
+-		datasize=npy.shape(data)
++		datasize=npy.shape(procdata)
+ 	
+ 	#process NaN's if any
+-	nanfill=options.getfieldvalue('nan',-999)
+-	if npy.any(npy.isnan(data)):
+-		data[npy.isnan(data)]=nanfill
+-		print "WARNING: nan's treated as -999 by default.  Change using pairoption 'nan',nan_fill_value in plotmodel call"
++	nanfill=options.getfieldvalue('nan',-9999)
++	if npy.any(npy.isnan(procdata)):
++		procdata[npy.isnan(procdata)]=nanfill
++		print "WARNING: nan's treated as -9999 by default.  Change using pairoption 'nan',nan_fill_value in plotmodel call"
+ 
+ 	#non-patch processing 
+ 
+@@ -71,11 +73,11 @@
+ 	#control arrow density if quiver plot
+ 
+ 	#convert rank-2 array to rank-1
+-	if npy.ndim(data)==2 and npy.shape(data)[1]==1:
+-		data=data.reshape(-1,)
++	if npy.ndim(procdata)==2 and npy.shape(procdata)[1]==1:
++		procdata=procdata.reshape(-1,)
+ 
+ 	#if datatype is still zero, error out
+ 	if datatype==0:
+ 		raise ValueError("processdata error: data provided not recognized or not supported")
+ 	else:
+-		return data, datatype
++		return procdata, datatype
Index: issm/oecreview/Archive/16554-17801/ISSM-17696-17697.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17696-17697.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17696-17697.diff	(revision 17802)
@@ -0,0 +1,106 @@
+Index: ../trunk-jpl/src/m/interp/interp.py
+===================================================================
+--- ../trunk-jpl/src/m/interp/interp.py	(revision 17696)
++++ ../trunk-jpl/src/m/interp/interp.py	(revision 17697)
+@@ -1,13 +1,14 @@
+ # module for inperpolating/smoothing data
+ import numpy as npy
+ from scipy.interpolate import CloughTocher2DInterpolator, Rbf
++from scipy.spatial import cKDTree
+ try:
+ 	import matplotlib.pyplot as plt
+ except ImportError:
+ 	print 'could not import matplotlib, no plotting functions enabled.\
+ 			Set plotonly=False in function call'
+ 
+-def MeshSplineToMesh2d(x,y,data,xi,yi,tol=1e-6,**kwargs):#{{{
++def MeshSplineToMesh2d(x,y,data,xi,yi,tol=1e-6,fill_nans=False,**kwargs):#{{{
+ 	'''
+ 	Piecewise cubic, C1 smooth, curvature-minimizing interpolant in 2D.
+ 	The interpolant is guaranteed to be continuously differentiable,
+@@ -20,6 +21,7 @@
+ 	data:			data to be interpolated (same length as x,y)
+ 	xi,yi:		coordintes to interpolate data onto
+ 	tol:			tolerance for gradient estimation (default 1e-6)
++	fill_nans:	fill nan's (holes) in data using the spline fit? 
+ 	**kwargs:	optional keywork arguments:
+ 					maxiter: maximum iterations in gradient estimation
+ 	
+@@ -56,8 +58,9 @@
+ 	# mask out any nan's in the data and corresponding coordinate points
+ 	mask=npy.isnan(subdata)
+ 	ind=npy.nonzero(mask)[0]
+-	if len(ind):
+-		print "WARNING: input data grid contains nan values. Spline interpolation may be questionable."
++	if len(ind) and fill_nans:
++		print "WARNING: filling nans using spline fit through good data points,\
++				which may or may not be appropriate. Check results carefully."
+ 	subdata=npy.delete(subdata,ind)
+ 	points=npy.delete(points,ind,axis=0)
+ 
+@@ -67,10 +70,20 @@
+ 		spline=CloughTocher2DInterpolator(points,subdata,tol)
+ 
+ 	interpdata=spline(xi,yi)
++	
++	if not fill_nans:
++		# identify nan's in xi,yi using nearest neighbors
++		xyinterp=npy.dstack([xi,yi])[0]
++		xg,yg=npy.meshgrid(subx,suby)
++		xydata=npy.dstack([xg.ravel(),yg.ravel()])[0]
++		tree=cKDTree(xydata)
++		nearest=tree.query(xyinterp)[1]
++		pos=npy.nonzero(npy.isnan(subdata[nearest]))
++		interpdata[pos]=subdata[nearest][pos]
+ 
+ 	return interpdata
+ #}}}
+-def GridSplineToMesh2d(x,y,data,xi,yi,default_value=npy.nan,plotonly=False):#{{{
++def GridSplineToMesh2d(x,y,data,xi,yi,default_value=npy.nan,plotonly=False,fill_nans=False):#{{{
+ 	'''
+ 	python analog to InterpFromGridToMesh.  This routine uses
+ 	scipy.interpolate.CloughTocher2dInterpolator to create a bivariate spline
+@@ -89,10 +102,10 @@
+ 	default_value:	default value if points lie outside the convex hull of input
+ 						points (defaults to nan if not specified)
+ 	plotonly:		plot the data to be interpolated using imshow (useful for
+-						identifying holes in data and problems with interpolation)
++	fill_nans:		fill nan's (holes) in data using the spline fit? 
+ 
+ 	Usage:
+-		interpdata=GridToMesh(x,y,data,xi,yi,default_value=npy.nan,plotonly=False)
++		interpdata=GridToMesh(x,y,data,xi,yi,default_value=npy.nan,plotonly=False,fill_nans=False)
+ 
+ 	Examples:
+ 		interpdata=GridToMesh(x_m,y_m,data,md.mesh.x,md.mesh.y,0)
+@@ -129,15 +142,25 @@
+ 	# mask out any nan's in the data and corresponding coordinate points
+ 	mask=npy.isnan(flatsubdata)
+ 	ind=npy.nonzero(mask)[0]
+-	if len(ind):
+-		print "WARNING: input data grid contains nan values. Spline interpolation may be questionable."
+-	flatsubdata=npy.delete(flatsubdata,ind)
+-	points=npy.delete(points,ind,axis=0)
++	if len(ind) and fill_nans:
++		print "WARNING: filling nans using spline fit through good data points,\
++				which may or may not be appropriate. Check results carefully."
++	goodsubdata=npy.delete(flatsubdata,ind)
++	goodpoints=npy.delete(points,ind,axis=0)
+ 
+ 	# create spline and index spline at mesh points
+-	spline=CloughTocher2DInterpolator(points,flatsubdata)
++	spline=CloughTocher2DInterpolator(goodpoints,goodsubdata)
+ 	interpdata=spline(xi,yi)
+ 
++	if not fill_nans:
++		# identify nan's in xi,yi using nearest neighbors
++		xyinterp=npy.dstack([xi,yi])[0]
++		xydata=npy.dstack([xg.ravel(),yg.ravel()])[0]
++		tree=cKDTree(xydata)
++		nearest=tree.query(xyinterp)[1]
++		pos=npy.nonzero(npy.isnan(flatsubdata[nearest]))
++		interpdata[pos]=flatsubdata[nearest][pos]
++
+ 	return interpdata
+ #}}}
+ def RadialInterp(x,y,data,**kwargs):#{{{
Index: issm/oecreview/Archive/16554-17801/ISSM-17697-17698.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17697-17698.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17697-17698.diff	(revision 17802)
@@ -0,0 +1,196 @@
+Index: ../trunk-jpl/src/m/plot/processdata.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/processdata.py	(revision 17697)
++++ ../trunk-jpl/src/m/plot/processdata.py	(revision 17698)
+@@ -45,6 +45,8 @@
+ 	nanfill=options.getfieldvalue('nan',-9999)
+ 	if npy.any(npy.isnan(procdata)):
+ 		procdata[npy.isnan(procdata)]=nanfill
++		options.addfielddefault('cmap_set_under','1')
++		options.addfielddefault('clim',[min(data),max(data)])
+ 		print "WARNING: nan's treated as -9999 by default.  Change using pairoption 'nan',nan_fill_value in plotmodel call"
+ 
+ 	#non-patch processing 
+Index: ../trunk-jpl/src/m/plot/plotmodel.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plotmodel.py	(revision 17697)
++++ ../trunk-jpl/src/m/plot/plotmodel.py	(revision 17698)
+@@ -54,7 +54,7 @@
+ 		#UNLESS plotmodel is called within a script (e.g. a runme.py file) 
+ 		#handling the 'visible' option will need some check on whether ipython is currently in interactive or non-interactive mode
+ 
+-		if not hold:
++		if not hold: # TODO need to also check whether figurenumber is a new plot so that old plots are not mistakenly cleared
+ 			p.clf()
+ 
+ 		#if figsize specified
+Index: ../trunk-jpl/src/m/plot/applyoptions.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/applyoptions.py	(revision 17697)
++++ ../trunk-jpl/src/m/plot/applyoptions.py	(revision 17698)
+@@ -1,4 +1,5 @@
+ import numpy as npy
++from cmaptools import truncate_colormap
+ 
+ try:
+ 	from matplotlib.ticker import MaxNLocator
+@@ -172,7 +173,9 @@
+ 	#}}}
+ 
+ 	#colormap {{{
+-	cmap=options.getfieldvalue('colormap',mpl.cm.gnuplot2)
++	# default sequential colormap
++	defaultmap=truncate_colormap(mpl.cm.gnuplot2,0.1,0.9,128)
++	cmap=options.getfieldvalue('colormap',defaultmap)
+ 	#}}}
+ 
+ 	#wrapping
+Index: ../trunk-jpl/src/m/plot/plot_unit.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_unit.py	(revision 17697)
++++ ../trunk-jpl/src/m/plot/plot_unit.py	(revision 17698)
+@@ -1,4 +1,4 @@
+-
++from cmaptools import truncate_colormap
+ try:
+ 	import pylab as p
+ 	import matplotlib as mpl
+@@ -6,70 +6,72 @@
+ 	print "could not import pylab, matplotlib has not been installed, no plotting capabilities enabled"
+ 
+ def plot_unit(x,y,z,elements,data,is2d,isplanet,datatype,options):
+-   """
+-   PLOT_UNIT - unit plot, display data
+-   
+-   	Usage:
+-   		plot_unit(x,y,z,elements,data,is2d,isplanet,datatype,options)
+-   
+-   	See also: PLOTMODEL, PLOT_MANAGER
+-   """
+-
+-   #edgecolor
+-   edgecolor=options.getfieldvalue('edgecolor','None')
+-   
+-   #number of colorlevels for plots
+-   colorlevels=options.getfieldvalue('colorlevels',256)
+-
+-   alpha=options.getfieldvalue('alpha',1)
+-
+-   #colormap
+-   cmap=options.getfieldvalue('colormap',mpl.cm.gnuplot2)
+-   if options.exist('cmap_set_over'):
+-      over=options.getfieldvalue('cmap_set_over','0.5')
+-      cmap.set_over(over)
+-   if options.exist('cmap_set_under'):
+-      under=options.getfieldvalue('cmap_set_under','0.5')
+-      cmap.set_under(under)
+-
+-   #normalize colormap if clim/caxis specified
+-   if options.exist('clim'):
+-      lims=options.getfieldvalue('clim',[min(data),max(data)])
+-   elif options.exist('caxis'):
+-      lims=options.getfieldvalue('caxis',[min(data),max(data)])
+-   else:
+-      lims=[min(data),max(data)]
+-   norm = mpl.colors.Normalize(vmin=lims[0], vmax=lims[1])
+-   if datatype==1:
+-      #element plot
+-   	if is2d:
+-   		p.tripcolor(x,y,elements,data,colorlevels,cmap=cmap,edgecolors=edgecolor)
+-   	else:
+-   		raise ValueError('plot_unit error: 3D element plot not supported yet')
+-   	return
+-   
+-   elif datatype==2:
+-   	#node plot
+-   	if is2d:
+-   		p.tricontourf(x,y,elements,data,colorlevels,cmap=cmap,norm=norm,alpha=alpha)
+-   		if edgecolor != 'None':
+-   			p.triplot(x,y,elements,color=edgecolor)
+-   	else:
+-   		raise ValueError('plot_unit error: 3D node plot not supported yet')
+-   	return
+-   
+-   elif datatype==3:
+-   	print 'plot_unit message: quiver plot not implemented yet'
+-   	return
+-   
+-   elif datatype==4:
+-   	#P1 patch plot
+-   	print 'plot_unit message: P1 patch plot not implemented yet'
+-   	return
+-   
+-   elif datatype==5:
+-   	print 'plot_unit message: P0 patch plot not implemented yet'
+-   	return
+-   
+-   else:
++	"""
++	PLOT_UNIT - unit plot, display data
++	
++		Usage:
++			plot_unit(x,y,z,elements,data,is2d,isplanet,datatype,options)
++	
++		See also: PLOTMODEL, PLOT_MANAGER
++	"""
++	
++	#edgecolor
++	edgecolor=options.getfieldvalue('edgecolor','None')
++	
++	#number of colorlevels for plots
++	colorlevels=options.getfieldvalue('colorlevels',256)
++	
++	alpha=options.getfieldvalue('alpha',1)
++	
++	#colormap
++	# default sequential colormap
++	defaultmap=truncate_colormap(mpl.cm.gnuplot2,0.1,0.9,128)
++	cmap=options.getfieldvalue('colormap',defaultmap)
++	if options.exist('cmap_set_over'):
++	   over=options.getfieldvalue('cmap_set_over','0.5')
++	   cmap.set_over(over)
++	if options.exist('cmap_set_under'):
++	   under=options.getfieldvalue('cmap_set_under','0.5')
++	   cmap.set_under(under)
++	
++	#normalize colormap if clim/caxis specified
++	if options.exist('clim'):
++	   lims=options.getfieldvalue('clim',[min(data),max(data)])
++	elif options.exist('caxis'):
++	   lims=options.getfieldvalue('caxis',[min(data),max(data)])
++	else:
++	   lims=[min(data),max(data)]
++	norm = mpl.colors.Normalize(vmin=lims[0], vmax=lims[1])
++	if datatype==1:
++	   #element plot
++		if is2d:
++			p.tripcolor(x,y,elements,data,colorlevels,cmap=cmap,edgecolors=edgecolor)
++		else:
++			raise ValueError('plot_unit error: 3D element plot not supported yet')
++		return
++	
++	elif datatype==2:
++		#node plot
++		if is2d:
++			p.tricontourf(x,y,elements,data,colorlevels,cmap=cmap,norm=norm,alpha=alpha)
++			if edgecolor != 'None':
++				p.triplot(x,y,elements,color=edgecolor)
++		else:
++			raise ValueError('plot_unit error: 3D node plot not supported yet')
++		return
++	
++	elif datatype==3:
++		print 'plot_unit message: quiver plot not implemented yet'
++		return
++	
++	elif datatype==4:
++		#P1 patch plot
++		print 'plot_unit message: P1 patch plot not implemented yet'
++		return
++	
++	elif datatype==5:
++		print 'plot_unit message: P0 patch plot not implemented yet'
++		return
++	
++	else:
+ 		raise ValueError('datatype=%d not supported' % datatype)
Index: issm/oecreview/Archive/16554-17801/ISSM-17698-17699.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17698-17699.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17698-17699.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/classes/mesh3dtetras.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh3dtetras.m	(revision 17698)
++++ ../trunk-jpl/src/m/classes/mesh3dtetras.m	(revision 17699)
+@@ -128,7 +128,7 @@
+ 			fielddisplay(obj,'hemisphere','Indicate hemisphere ''n'' or ''s'' ');
+ 		end % }}}
+ 		function marshall(obj,md,fid) % {{{
+-			WriteData(fid,'enum',DomainTypeEnum(),'data',Mesh3DtetrasEnum,'format','Integer');
++			WriteData(fid,'enum',DomainTypeEnum(),'data',StringToEnum(['Mesh' domaintype(obj)]),'format','Integer');
+ 			WriteData(fid,'enum',DomainDimensionEnum(),'data',dimension(obj),'format','Integer');
+ 			WriteData(fid,'enum',MeshElementtypeEnum(),'data',StringToEnum(elementtype(obj)),'format','Integer');
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','x','format','DoubleMat','mattype',1);
Index: issm/oecreview/Archive/16554-17801/ISSM-17699-17700.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17699-17700.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17699-17700.diff	(revision 17802)
@@ -0,0 +1,3617 @@
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 17700)
+@@ -43,7 +43,7 @@
+ 	iomodel->FetchDataToInput(elements,SurfaceforcingsMassBalanceEnum);
+ 	iomodel->FetchDataToInput(elements,BalancethicknessThickeningRateEnum);
+ 
+-	if(iomodel->domaintype==Mesh3DEnum){
++	if(iomodel->domaintype==Domain3DEnum){
+ 		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
+@@ -54,10 +54,10 @@
+ 	iomodel->Constant(&stabilization,BalancethicknessStabilizationEnum);
+ 
+ 	/*Check in 3d*/
+-	if(stabilization==3 && iomodel->domaintype==Mesh3DEnum) _error_("DG 3d not implemented yet");
++	if(stabilization==3 && iomodel->domaintype==Domain3DEnum) _error_("DG 3d not implemented yet");
+ 
+ 	/*First fetch data: */
+-	if(iomodel->domaintype==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype==Domain3DEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	if(stabilization!=3){
+ 		::CreateNodes(nodes,iomodel,BalancethicknessAnalysisEnum,P1Enum);
+ 	}
+@@ -142,7 +142,7 @@
+ 
+ 	int domaintype;
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return Ke;
+ }/*}}}*/
+ ElementMatrix* BalancethicknessAnalysis::CreateKMatrixCG(Element* element){/*{{{*/
+@@ -170,7 +170,7 @@
+ 	element->FindParam(&stabilization,BalancethicknessStabilizationEnum);
+ 	Input* vxaverage_input=NULL;
+ 	Input* vyaverage_input=NULL;
+-	if(domaintype==Mesh2DhorizontalEnum){
++	if(domaintype==Domain2DhorizontalEnum){
+ 		vxaverage_input=element->GetInput(VxEnum); _assert_(vxaverage_input);
+ 		vyaverage_input=element->GetInput(VyEnum); _assert_(vyaverage_input);
+ 	}
+@@ -271,7 +271,7 @@
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	Input* vxaverage_input=NULL;
+ 	Input* vyaverage_input=NULL;
+-	if(domaintype==Mesh2DhorizontalEnum){
++	if(domaintype==Domain2DhorizontalEnum){
+ 		vxaverage_input=element->GetInput(VxEnum); _assert_(vxaverage_input);
+ 		vyaverage_input=element->GetInput(VyEnum); _assert_(vyaverage_input);
+ 	}
+@@ -334,7 +334,7 @@
+ 
+ 	int domaintype;
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
+ ElementVector* BalancethicknessAnalysis::CreatePVectorCG(Element* element){/*{{{*/
+@@ -482,10 +482,10 @@
+ 	int domaintype;
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			element->InputUpdateFromSolutionOneDof(solution,ThicknessEnum);
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			element->InputUpdateFromSolutionOneDofCollapsed(solution,ThicknessEnum);
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17700)
+@@ -55,7 +55,7 @@
+ 	iomodel->FetchDataToInput(elements,HydrologydcEplInitialThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcSedimentTransmitivityEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcEplThicknessEnum);
+-	if(iomodel->domaintype==Mesh3DEnum) iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
++	if(iomodel->domaintype==Domain3DEnum) iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 	
+ 	//	elements->InputDuplicate(HydrologydcEplInitialThicknessEnum,HydrologydcEplThicknessEnum);
+ 
+@@ -72,7 +72,7 @@
+ 	iomodel->Constant(&isefficientlayer,HydrologydcIsefficientlayerEnum);
+ 	if(!isefficientlayer) return;
+ 
+-	if(iomodel->domaintype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,HydrologyDCEfficientAnalysisEnum,P1Enum);
+ 	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+@@ -116,10 +116,10 @@
+ 	/*Get basal element*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+@@ -131,7 +131,7 @@
+ 
+ 	/*Check that all nodes are active, else return empty matrix*/
+ 	if(!active_element) {
+-	if(domaintype!=Mesh2DhorizontalEnum){
++	if(domaintype!=Domain2DhorizontalEnum){
+ 			basalelement->DeleteMaterials(); 
+ 			delete basalelement;
+ 		}
+@@ -206,7 +206,7 @@
+ 	xDelete<IssmDouble>(basis);
+ 	xDelete<IssmDouble>(B);
+ 	delete gauss;
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return Ke;
+ 
+ }/*}}}*/
+@@ -220,10 +220,10 @@
+ 	/*Get basal element*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+@@ -235,7 +235,7 @@
+ 
+ 	/*Check that all nodes are active, else return empty matrix*/
+ 	if(!active_element) {
+-	if(domaintype!=Mesh2DhorizontalEnum){
++	if(domaintype!=Domain2DhorizontalEnum){
+ 			basalelement->DeleteMaterials(); 
+ 			delete basalelement;
+ 		}
+@@ -308,7 +308,7 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+ 	delete gauss;
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
+ void HydrologyDCEfficientAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+@@ -321,7 +321,7 @@
+ 
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 
+-	if(domaintype!=Mesh2DhorizontalEnum){
++	if(domaintype!=Domain2DhorizontalEnum){
+ 		if(!element->IsOnBase()) return;
+ 		basalelement=element->SpawnBasalElement();
+ 	}
+@@ -350,7 +350,7 @@
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(eplHeads);
+ 	xDelete<int>(doflist);
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ } /*}}}*/
+ void HydrologyDCEfficientAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+ 	/*Default, do nothing*/
+@@ -492,11 +492,11 @@
+ 		Element* element=(Element*)femmodel->elements->GetObjectByOffset(j);
+ 		
+ 		switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			if(!element->IsOnBase()) return;			
+ 			B = element->GetMaterialParameter(MaterialsRheologyBbarEnum);
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			B = element->GetMaterialParameter(MaterialsRheologyBEnum);
+ 			break;
+ 		default:
+@@ -609,10 +609,10 @@
+ 	/*Get basal element*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			if(!element->IsOnBase()) return;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+@@ -672,7 +672,7 @@
+ 			}
+ 		}
+ 	}
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	xDelete<IssmDouble>(epl_thickness);
+ 	xDelete<IssmDouble>(old_active);
+ 	xDelete<IssmDouble>(sedhead);
+@@ -689,10 +689,10 @@
+ 	/*Get basal element*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			if(!element->IsOnBase()) return;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+@@ -715,7 +715,7 @@
+ 	else{
+ 		/*Do not do anything: at least one node is active for this element but this element is not solved for*/
+ 	}
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	xDelete<IssmDouble>(active);
+ }
+ 
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 17700)
+@@ -60,10 +60,10 @@
+ 	/*Get basal element*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+@@ -86,7 +86,7 @@
+ 	ElementMatrix* Ke=analysis->CreateKMatrix(element);
+ 	delete analysis;
+ 	if(incomplete_adjoint){
+-		if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++		if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 		return Ke;
+ 	}
+ 
+@@ -135,7 +135,7 @@
+ 	delete gauss;
+ 	xDelete<IssmDouble>(dbasis);
+ 	xDelete<IssmDouble>(xyz_list);
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return Ke;
+ }/*}}}*/
+ ElementMatrix* AdjointHorizAnalysis::CreateKMatrixHO(Element* element){/*{{{*/
+@@ -303,7 +303,7 @@
+ 	if(!element->IsOnSurface()) return NULL;
+ 
+ 	/*Intermediaries */
+-	int        num_responses,i,domaintype,dim;
++	int        num_responses,i,dim;
+ 	IssmDouble Jdet,obs_velocity_mag,velocity_mag;
+ 	IssmDouble vx,vy,vxobs,vyobs,dux,duy,weight;
+ 	IssmDouble scalex,scaley,scale,S;
+@@ -311,12 +311,7 @@
+ 	IssmDouble *xyz_list_top = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2; break;
+-		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
++	element->FindParam(&dim,DomainDimensionEnum);
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int vnumnodes = element->NumberofNodesVelocity();
+@@ -689,10 +684,10 @@
+ 	/*Get basal element*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+@@ -874,7 +869,7 @@
+ 	xDelete<int>(responses);
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	delete gauss;
+ 	return pe;
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17700)
+@@ -42,7 +42,7 @@
+ /*}}}*/
+ void LevelsetAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 	int finiteelement=P1Enum;
+-	if(iomodel->domaintype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,LevelsetAnalysisEnum,finiteelement);
+ 	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }
+@@ -104,9 +104,9 @@
+ 	/*Get problem dimension*/
+ 	basalelement->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DverticalEnum:   dim = 1; break;
+-		case Mesh2DhorizontalEnum: dim = 2; break;
+-		case Mesh3DEnum:           dim = 2; break;
++		case Domain2DverticalEnum:   dim = 1; break;
++		case Domain2DhorizontalEnum: dim = 2; break;
++		case Domain3DEnum:           dim = 2; break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -129,7 +129,7 @@
+ 	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	Input* vx_input=NULL;
+ 	Input* vy_input=NULL;
+-	if(domaintype==Mesh2DhorizontalEnum){
++	if(domaintype==Domain2DhorizontalEnum){
+ 		vx_input=basalelement->GetInput(VxEnum); _assert_(vx_input);
+ 		vy_input=basalelement->GetInput(VyEnum); _assert_(vy_input);
+ 	}
+@@ -252,7 +252,7 @@
+ 	xDelete<IssmDouble>(c);
+ 	xDelete<IssmDouble>(dlsf);
+ 	delete gauss;
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return Ke;
+ }/*}}}*/
+ ElementVector* LevelsetAnalysis::CreatePVector(Element* element){/*{{{*/
+@@ -298,7 +298,7 @@
+ 		xDelete<IssmDouble>(xyz_list);
+ 		xDelete<IssmDouble>(basis);
+ 		basalelement->FindParam(&domaintype,DomainTypeEnum);
+-		if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++		if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 		delete gauss;
+ 	}
+ 
+@@ -312,10 +312,10 @@
+ 	int domaintype;
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			element->InputUpdateFromSolutionOneDof(solution,MaskIceLevelsetEnum);
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			element->InputUpdateFromSolutionOneDofCollapsed(solution,MaskIceLevelsetEnum);
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 17700)
+@@ -17,7 +17,7 @@
+ void StressbalanceVerticalAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+ 
+ 	/*return if not 3d mesh*/
+-	if(iomodel->domaintype!=Mesh3DEnum) return;
++	if(iomodel->domaintype!=Domain3DEnum) return;
+ 
+ 	/*Update elements: */
+ 	int counter=0;
+@@ -45,7 +45,7 @@
+ void StressbalanceVerticalAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+ 	/*return if not 3d mesh*/
+-	if(iomodel->domaintype!=Mesh3DEnum) return;
++	if(iomodel->domaintype!=Domain3DEnum) return;
+ 
+ 	iomodel->FetchData(3,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum,FlowequationVertexEquationEnum);
+ 	::CreateNodes(nodes,iomodel,StressbalanceVerticalAnalysisEnum,P1Enum);
+@@ -61,7 +61,7 @@
+ 	iomodel->Constant(&yts,ConstantsYtsEnum);
+ 
+ 	/*return if not 3d mesh*/
+-	if(iomodel->domaintype!=Mesh3DEnum) return;
++	if(iomodel->domaintype!=Domain3DEnum) return;
+ 
+ 	/*Fetch data: */
+ 	iomodel->FetchData(2,StressbalanceSpcvzEnum,FlowequationBorderFSEnum);
+Index: ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 17700)
+@@ -13,7 +13,7 @@
+ void MeltingAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+ 
+ 	/*Now, is the model 3d? otherwise, do nothing: */
+-	if(iomodel->domaintype==Mesh2DhorizontalEnum)return;
++	if(iomodel->domaintype==Domain2DhorizontalEnum)return;
+ 
+ 	/*Update elements: */
+ 	int counter=0;
+@@ -43,7 +43,7 @@
+ }/*}}}*/
+ void MeltingAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+-	if(iomodel->domaintype==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype==Domain3DEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,MeltingAnalysisEnum,P1Enum);
+ 	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+@@ -53,7 +53,7 @@
+ void MeltingAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+ 
+ 	/*if 2d: Error*/
+-	if(iomodel->domaintype==Mesh2DhorizontalEnum) _error_("2d meshes not supported yet");
++	if(iomodel->domaintype==Domain2DhorizontalEnum) _error_("2d meshes not supported yet");
+ 
+ 	//create penalties for nodes: no node can have a temperature over the melting point
+ 	iomodel->FetchData(1,MeshVertexonbaseEnum);
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 17700)
+@@ -21,7 +21,7 @@
+ 		}
+ 	}
+ 
+-	if(iomodel->domaintype==Mesh2DverticalEnum){
++	if(iomodel->domaintype==Domain2DverticalEnum){
+ 		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
+ 	}
+ }/*}}}*/
+@@ -67,13 +67,8 @@
+ 	IssmDouble *xyz_list = NULL;
+ 
+ 	/*Get dimension*/
+-	int dim,domaintype;
+-	element->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2; break;
+-		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
++	int dim;
++	element->FindParam(&dim,DomainDimensionEnum);
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+@@ -115,17 +110,12 @@
+ 	if(!element->IsOnSurface()) return NULL;
+ 
+ 	/*Intermediaries */
++	int         dim;
+ 	IssmDouble  Jdet,D,normal[3];
+ 	IssmDouble *xyz_list_top = NULL;
+ 
+ 	/*Get dimension*/
+-	int dim,domaintype;
+-	element->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2; break;
+-		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
++	element->FindParam(&dim,DomainDimensionEnum);
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+@@ -165,17 +155,12 @@
+ 	if(!element->IsOnBase()) return NULL;
+ 
+ 	/*Intermediaries */
++	int         dim;
+ 	IssmDouble  Jdet,D,normal[3];
+ 	IssmDouble *xyz_list_base = NULL;
+ 
+ 	/*Get dimension*/
+-	int dim,domaintype;
+-	element->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2; break;
+-		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
++	element->FindParam(&dim,DomainDimensionEnum);
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+Index: ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 17700)
+@@ -54,10 +54,10 @@
+ 	/*Get basal element*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+@@ -142,7 +142,7 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+ 	xDelete<IssmDouble>(dbasis);
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	delete gauss;
+ 	return pe;
+ }/*}}}*/
+@@ -154,10 +154,10 @@
+ 	int domaintype;
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			element->InputUpdateFromSolutionOneDof(solution,AdjointEnum);
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			element->InputUpdateFromSolutionOneDofCollapsed(solution,AdjointEnum);
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 17700)
+@@ -35,7 +35,7 @@
+ 
+ 	iomodel->FetchDataToInput(elements,EplHeadEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+-	if(iomodel->domaintype==Mesh3DEnum){
++	if(iomodel->domaintype==Domain3DEnum){
+ 		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 	}
+ }/*}}}*/
+@@ -50,10 +50,10 @@
+ 	iomodel->Constant(&isefficientlayer,HydrologydcIsefficientlayerEnum);
+ 	if(!isefficientlayer) return;
+ 
+-	if(iomodel->domaintype==Mesh3DEnum){
++	if(iomodel->domaintype==Domain3DEnum){
+ 		iomodel->FetchData(1,MeshVertexonbaseEnum);
+ 	}
+-	else if(iomodel->domaintype==Mesh2DverticalEnum){
++	else if(iomodel->domaintype==Domain2DverticalEnum){
+ 		iomodel->FetchData(1,MeshVertexonbaseEnum);
+ 	}
+ 	::CreateNodes(nodes,iomodel,L2ProjectionEPLAnalysisEnum,P1Enum);
+@@ -89,14 +89,14 @@
+ 	/*Get basal element*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+-		case Mesh2DverticalEnum:
++		case Domain2DverticalEnum:
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+@@ -108,7 +108,7 @@
+ 
+ 	/* Check that all nodes are active, else return empty matrix */
+ 	if(!active_element){
+-		if(domaintype!=Mesh2DhorizontalEnum){
++		if(domaintype!=Domain2DhorizontalEnum){
+ 			basalelement->DeleteMaterials();
+ 			delete basalelement;
+ 		}
+@@ -148,7 +148,7 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+ 	delete gauss;
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return Ke;
+ }/*}}}*/
+ ElementVector* L2ProjectionEPLAnalysis::CreatePVector(Element* element){/*{{{*/
+@@ -161,10 +161,10 @@
+ 	/*Get basal element*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+@@ -176,7 +176,7 @@
+ 
+ 	/*Check that all nodes are active, else return empty matrix*/
+ 	if(!active_element) {
+-		if(domaintype!=Mesh2DhorizontalEnum){
++		if(domaintype!=Domain2DhorizontalEnum){
+ 			basalelement->DeleteMaterials();
+ 			delete basalelement;
+ 		}
+@@ -221,7 +221,7 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+ 	delete gauss;
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
+ void L2ProjectionEPLAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+@@ -233,13 +233,13 @@
+ 	element->FindParam(&inputenum,InputToL2ProjectEnum);
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			element->InputUpdateFromSolutionOneDof(solution,inputenum);
+ 			break;
+-		case Mesh2DverticalEnum:
++		case Domain2DverticalEnum:
+ 			element->InputUpdateFromSolutionOneDof(solution,inputenum);
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			element->InputUpdateFromSolutionOneDofCollapsed(solution,inputenum);
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17700)
+@@ -82,14 +82,14 @@
+ 		if(isgroundingline) elements->InputDuplicate(MaskGroundediceLevelsetEnum,QmuMaskGroundediceLevelsetEnum);
+ 	}
+ 
+-	if(iomodel->domaintype==Mesh3DEnum){
++	if(iomodel->domaintype==Domain3DEnum){
+ 		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
+ 
+ 	if(islevelset){
+ 		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
+-		if(iomodel->domaintype!=Mesh2DhorizontalEnum)
++		if(iomodel->domaintype!=Domain2DhorizontalEnum)
+ 			iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum); // required for updating active nodes
+ 	}
+ 
+@@ -131,10 +131,10 @@
+ 	iomodel->Constant(&stabilization,MasstransportStabilizationEnum);
+ 
+ 	/*Check in 3d*/
+-	if(stabilization==3 && iomodel->domaintype==Mesh3DEnum) _error_("DG 3d not implemented yet");
++	if(stabilization==3 && iomodel->domaintype==Domain3DEnum) _error_("DG 3d not implemented yet");
+ 
+ 	/*Create Nodes either DG or CG depending on stabilization*/
+-	if(iomodel->domaintype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	if(stabilization!=3){
+ 		::CreateNodes(nodes,iomodel,MasstransportAnalysisEnum,P1Enum);
+ 	}
+@@ -194,7 +194,7 @@
+ 	IssmDouble *vertex_pairing=NULL;
+ 	IssmDouble *nodeonbase=NULL;
+ 	iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,MasstransportVertexPairingEnum);
+-	if(iomodel->domaintype!=Mesh2DhorizontalEnum) iomodel->FetchData(&nodeonbase,NULL,NULL,MeshVertexonbaseEnum);
++	if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(&nodeonbase,NULL,NULL,MeshVertexonbaseEnum);
+ 
+ 	for(int i=0;i<numvertex_pairing;i++){
+ 
+@@ -204,7 +204,7 @@
+ 			_assert_(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+1])-1]);
+ 
+ 			/*Skip if one of the two is not on the bed*/
+-			if(iomodel->domaintype!=Mesh2DhorizontalEnum){
++			if(iomodel->domaintype!=Domain2DhorizontalEnum){
+ 				if(!(reCast<bool>(nodeonbase[reCast<int>(vertex_pairing[2*i+0])-1])) || !(reCast<bool>(nodeonbase[reCast<int>(vertex_pairing[2*i+1])-1]))) continue;
+ 			}
+ 
+@@ -260,7 +260,7 @@
+ 
+ 	int domaintype;
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return Ke;
+ }/*}}}*/
+ ElementMatrix* MasstransportAnalysis::CreateKMatrixCG(Element* element){/*{{{*/
+@@ -279,9 +279,9 @@
+ 	/*Get problem dimension*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DverticalEnum:   dim = 1; break;
+-		case Mesh2DhorizontalEnum: dim = 2; break;
+-		case Mesh3DEnum:           dim = 2; break;
++		case Domain2DverticalEnum:   dim = 1; break;
++		case Domain2DhorizontalEnum: dim = 2; break;
++		case Domain3DEnum:           dim = 2; break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -302,7 +302,7 @@
+ 	element->FindParam(&stabilization,MasstransportStabilizationEnum);
+ 	Input* vxaverage_input=NULL;
+ 	Input* vyaverage_input=NULL;
+-	if(domaintype==Mesh2DhorizontalEnum){
++	if(domaintype==Domain2DhorizontalEnum){
+ 		vxaverage_input=element->GetInput(VxEnum); _assert_(vxaverage_input);
+ 		vyaverage_input=element->GetInput(VyEnum); _assert_(vyaverage_input);
+ 	}
+@@ -434,7 +434,7 @@
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	Input* vxaverage_input=NULL;
+ 	Input* vyaverage_input=NULL;
+-	if(domaintype==Mesh2DhorizontalEnum){
++	if(domaintype==Domain2DhorizontalEnum){
+ 		vxaverage_input=element->GetInput(VxEnum); _assert_(vxaverage_input);
+ 		vyaverage_input=element->GetInput(VyEnum); _assert_(vyaverage_input);
+ 	}
+@@ -506,7 +506,7 @@
+ 
+ 	int domaintype;
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
+ ElementVector* MasstransportAnalysis::CreatePVectorCG(Element* element){/*{{{*/
+@@ -675,7 +675,7 @@
+ 	Element*   basalelement=NULL;
+ 
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+-	if(domaintype!=Mesh2DhorizontalEnum){
++	if(domaintype!=Domain2DhorizontalEnum){
+ 		if(!element->IsOnBase()) return;
+ 		basalelement=element->SpawnBasalElement();
+ 	}
+@@ -749,7 +749,7 @@
+ 	xDelete<IssmDouble>(oldsurface);
+ 	xDelete<IssmDouble>(phi);
+ 	xDelete<int>(doflist);
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ }/*}}}*/
+ void MasstransportAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 17700)
+@@ -25,18 +25,18 @@
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+-	if(iomodel->domaintype==Mesh3DEnum){
++	if(iomodel->domaintype==Domain3DEnum){
+ 		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
+-	if(iomodel->domaintype==Mesh2DverticalEnum){
++	if(iomodel->domaintype==Domain2DverticalEnum){
+ 		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
+ 	}
+ }/*}}}*/
+ void SmoothedSurfaceSlopeXAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+-	if(iomodel->domaintype==Mesh3DEnum) iomodel->FetchData(1,MeshVertexonbaseEnum);
++	if(iomodel->domaintype==Domain3DEnum) iomodel->FetchData(1,MeshVertexonbaseEnum);
+ 	::CreateNodes(nodes,iomodel,SmoothedSurfaceSlopeXAnalysisEnum,P1Enum);
+-	if(iomodel->domaintype==Mesh3DEnum) iomodel->DeleteData(1,MeshVertexonbaseEnum);
++	if(iomodel->domaintype==Domain3DEnum) iomodel->DeleteData(1,MeshVertexonbaseEnum);
+ }/*}}}*/
+ void SmoothedSurfaceSlopeXAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ }/*}}}*/
+@@ -110,10 +110,10 @@
+ 	/*Get basal element*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+@@ -168,7 +168,7 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+ 	delete gauss;
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
+ void SmoothedSurfaceSlopeXAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 17700)
+@@ -25,18 +25,18 @@
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+-	if(iomodel->domaintype==Mesh3DEnum){
++	if(iomodel->domaintype==Domain3DEnum){
+ 		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
+-	if(iomodel->domaintype==Mesh2DverticalEnum){
++	if(iomodel->domaintype==Domain2DverticalEnum){
+ 		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
+ 	}
+ }/*}}}*/
+ void SmoothedSurfaceSlopeYAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+-	if(iomodel->domaintype==Mesh3DEnum) iomodel->FetchData(1,MeshVertexonbaseEnum);
++	if(iomodel->domaintype==Domain3DEnum) iomodel->FetchData(1,MeshVertexonbaseEnum);
+ 	::CreateNodes(nodes,iomodel,SmoothedSurfaceSlopeYAnalysisEnum,P1Enum);
+-	if(iomodel->domaintype==Mesh3DEnum) iomodel->DeleteData(1,MeshVertexonbaseEnum);
++	if(iomodel->domaintype==Domain3DEnum) iomodel->DeleteData(1,MeshVertexonbaseEnum);
+ }/*}}}*/
+ void SmoothedSurfaceSlopeYAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ }/*}}}*/
+@@ -110,10 +110,10 @@
+ 	/*Get basal element*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+@@ -168,7 +168,7 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+ 	delete gauss;
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
+ void SmoothedSurfaceSlopeYAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 17700)
+@@ -21,7 +21,7 @@
+ 		}
+ 	}
+ 
+-	if(iomodel->domaintype==Mesh2DverticalEnum){
++	if(iomodel->domaintype==Domain2DverticalEnum){
+ 		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
+ 	}
+ }/*}}}*/
+@@ -63,17 +63,12 @@
+ ElementMatrix* ExtrudeFromTopAnalysis::CreateKMatrixVolume(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries */
+-	int         domaintype,dim;
++	int         dim;
+ 	IssmDouble  Jdet,D;
+ 	IssmDouble *xyz_list = NULL;
+ 
+ 	/*Get dimension*/
+-	element->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2; break;
+-		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
++	element->FindParam(&dim,DomainDimensionEnum);
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+@@ -115,17 +110,12 @@
+ 	if(!element->IsOnSurface()) return NULL;
+ 
+ 	/*Intermediaries */
++	int         dim;
+ 	IssmDouble  Jdet,D,normal[2];
+ 	IssmDouble *xyz_list_top = NULL;
+ 
+ 	/*Get dimension*/
+-	int dim,domaintype;
+-	element->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2; break;
+-		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
++	element->FindParam(&dim,DomainDimensionEnum);
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+@@ -165,17 +155,12 @@
+ 	if(!element->IsOnBase()) return NULL;
+ 
+ 	/*Intermediaries */
++	int         dim;
+ 	IssmDouble  Jdet,D,normal[3];
+ 	IssmDouble *xyz_list_base = NULL;
+ 
+ 	/*Get dimension*/
+-	int dim,domaintype;
+-	element->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2; break;
+-		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
++	element->FindParam(&dim,DomainDimensionEnum);
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 17700)
+@@ -61,7 +61,7 @@
+ 	/*Now, do we really want Shreve?*/
+ 	if(hydrology_model!=HydrologyshreveEnum) return;
+ 
+-	if(iomodel->domaintype==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype==Domain3DEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,HydrologyShreveAnalysisEnum,P1Enum);
+ 	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/DepthAverageAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DepthAverageAnalysis.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/analyses/DepthAverageAnalysis.cpp	(revision 17700)
+@@ -21,7 +21,7 @@
+ 		}
+ 	}
+ 
+-	if(iomodel->domaintype==Mesh2DverticalEnum){
++	if(iomodel->domaintype==Domain2DverticalEnum){
+ 		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
+ 	}
+ }/*}}}*/
+@@ -49,17 +49,12 @@
+ ElementMatrix* DepthAverageAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries */
++	int         dim;
+ 	IssmDouble  Jdet,D,dt=1.e+9;
+ 	IssmDouble *xyz_list = NULL;
+ 
+ 	/*Get dimension*/
+-	int dim,domaintype;
+-	element->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2; break;
+-		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
++	element->FindParam(&dim,DomainDimensionEnum);
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+Index: ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 17700)
+@@ -32,7 +32,7 @@
+ 	iomodel->FetchDataToInput(elements,SurfaceforcingsMassBalanceEnum);
+ 	iomodel->FetchDataToInput(elements,BalancethicknessThickeningRateEnum);
+ 
+-	if(iomodel->domaintype==Mesh3DEnum){
++	if(iomodel->domaintype==Domain3DEnum){
+ 		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
+@@ -40,7 +40,7 @@
+ void BalancevelocityAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+ 	/*Check in 3d*/
+-	if(iomodel->domaintype==Mesh3DEnum) _error_("DG 3d not implemented yet");
++	if(iomodel->domaintype==Domain3DEnum) _error_("DG 3d not implemented yet");
+ 
+ 	/*First fetch data: */
+ 	::CreateNodes(nodes,iomodel,BalancevelocityAnalysisEnum,P1Enum);
+@@ -153,10 +153,10 @@
+ 	/*Get basal element*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+@@ -234,7 +234,7 @@
+ 	xDelete<IssmDouble>(Nx);
+ 	xDelete<IssmDouble>(Ny);
+ 	delete gauss;
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
+ void BalancevelocityAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+@@ -245,10 +245,10 @@
+ 	int domaintype;
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			element->InputUpdateFromSolutionOneDof(solution,VelEnum);
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			element->InputUpdateFromSolutionOneDofCollapsed(solution,VelEnum);
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 17700)
+@@ -25,23 +25,23 @@
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+-	if(iomodel->domaintype==Mesh3DEnum){
++	if(iomodel->domaintype==Domain3DEnum){
+ 		if(iomodel->meshelementtype==PentaEnum){
+ 			iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 			iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 		}
+ 		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
+ 	}
+-	if(iomodel->domaintype==Mesh2DverticalEnum){
++	if(iomodel->domaintype==Domain2DverticalEnum){
+ 		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
+ 	}
+ }/*}}}*/
+ void L2ProjectionBaseAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+-	if(iomodel->domaintype==Mesh3DEnum){
++	if(iomodel->domaintype==Domain3DEnum){
+ 		iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	}
+-	else if(iomodel->domaintype==Mesh2DverticalEnum){
++	else if(iomodel->domaintype==Domain2DverticalEnum){
+ 		iomodel->FetchData(1,MeshVertexonbaseEnum);
+ 	}
+ 	::CreateNodes(nodes,iomodel,L2ProjectionBaseAnalysisEnum,P1Enum);
+@@ -76,14 +76,14 @@
+ 	/*Get basal element*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+-		case Mesh2DverticalEnum:
++		case Domain2DverticalEnum:
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+@@ -123,7 +123,7 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+ 	delete gauss;
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return Ke;
+ }/*}}}*/
+ ElementVector* L2ProjectionBaseAnalysis::CreatePVector(Element* element){/*{{{*/
+@@ -135,14 +135,14 @@
+ 	/*Get basal element*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+-		case Mesh2DverticalEnum:
++		case Domain2DverticalEnum:
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+@@ -198,7 +198,7 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+ 	delete gauss;
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
+ void L2ProjectionBaseAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+@@ -212,13 +212,13 @@
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	element->FindParam(&elementtype,MeshElementtypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			element->InputUpdateFromSolutionOneDof(solution,inputenum);
+ 			break;
+-		case Mesh2DverticalEnum:
++		case Domain2DverticalEnum:
+ 			element->InputUpdateFromSolutionOneDof(solution,inputenum);
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			if(elementtype==TetraEnum)
+ 			 element->InputUpdateFromSolutionOneDof(solution,inputenum);
+ 			else
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17700)
+@@ -13,7 +13,7 @@
+ void FreeSurfaceTopAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+ 
+ 	/*Now, is the model 3d? otherwise, do nothing: */
+-	if (iomodel->domaintype==Mesh2DhorizontalEnum)return;
++	if (iomodel->domaintype==Domain2DhorizontalEnum)return;
+ 
+ 	int smb_model;
+ 	int finiteelement = P1Enum;
+@@ -34,8 +34,8 @@
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,VxEnum);
+-	if(iomodel->domaintype!=Mesh2DhorizontalEnum) iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+-	if(iomodel->domaintype==Mesh3DEnum){
++	if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype==Domain3DEnum){
+ 		iomodel->FetchDataToInput(elements,VzEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+@@ -51,7 +51,7 @@
+ }/*}}}*/
+ void FreeSurfaceTopAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+-	if(iomodel->domaintype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,FreeSurfaceTopAnalysisEnum,P1Enum);
+ 	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+@@ -68,7 +68,7 @@
+ 	IssmDouble *vertex_pairing=NULL;
+ 	IssmDouble *nodeonsurface=NULL;
+ 	iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,MasstransportVertexPairingEnum);
+-	if(iomodel->domaintype!=Mesh2DhorizontalEnum) iomodel->FetchData(&nodeonsurface,NULL,NULL,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(&nodeonsurface,NULL,NULL,MeshVertexonsurfaceEnum);
+ 	for(int i=0;i<numvertex_pairing;i++){
+ 
+ 		if(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+0])-1]){
+@@ -77,7 +77,7 @@
+ 			_assert_(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+1])-1]);
+ 
+ 			/*Skip if one of the two is not on the bed*/
+-			if(iomodel->domaintype!=Mesh2DhorizontalEnum){
++			if(iomodel->domaintype!=Domain2DhorizontalEnum){
+ 				if(!(reCast<bool>(nodeonsurface[reCast<int>(vertex_pairing[2*i+0])-1])) || !(reCast<bool>(nodeonsurface[reCast<int>(vertex_pairing[2*i+1])-1]))) continue;
+ 			}
+ 
+@@ -122,16 +122,16 @@
+ 	/*Get top element*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			topelement = element;
+ 			dim = 2;
+ 			break;
+-		case Mesh2DverticalEnum:
++		case Domain2DverticalEnum:
+ 			if(!element->IsOnSurface()) return NULL;
+ 			topelement = element->SpawnTopElement();
+ 			dim = 1;
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			if(!element->IsOnSurface()) return NULL;
+ 			topelement = element->SpawnTopElement();
+ 			dim = 2;
+@@ -231,7 +231,7 @@
+ 	xDelete<IssmDouble>(Bprime);
+ 	xDelete<IssmDouble>(D);
+ 	delete gauss;
+-	if(domaintype!=Mesh2DhorizontalEnum){topelement->DeleteMaterials(); delete topelement;};
++	if(domaintype!=Domain2DhorizontalEnum){topelement->DeleteMaterials(); delete topelement;};
+ 	return Ke;
+ }/*}}}*/
+ ElementVector* FreeSurfaceTopAnalysis::CreatePVector(Element* element){/*{{{*/
+@@ -245,16 +245,16 @@
+ 	/*Get top element*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			topelement = element;
+ 			dim = 2;
+ 			break;
+-		case Mesh2DverticalEnum:
++		case Domain2DverticalEnum:
+ 			if(!element->IsOnSurface()) return NULL;
+ 			topelement = element->SpawnTopElement();
+ 			dim = 1;
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			if(!element->IsOnSurface()) return NULL;
+ 			topelement = element->SpawnTopElement();
+ 			dim = 2;
+@@ -301,7 +301,7 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+ 	delete gauss;
+-	if(domaintype!=Mesh2DhorizontalEnum){topelement->DeleteMaterials(); delete topelement;};
++	if(domaintype!=Domain2DhorizontalEnum){topelement->DeleteMaterials(); delete topelement;};
+ 	return pe;
+ 
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp	(revision 17700)
+@@ -35,7 +35,7 @@
+ }/*}}}*/
+ void LsfReinitializationAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 	int finiteelement=P1Enum;
+-	if(iomodel->domaintype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,LsfReinitializationAnalysisEnum,finiteelement);
+ 	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+@@ -251,25 +251,18 @@
+ void LsfReinitializationAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 
+ 	IssmDouble   lsf;
+-	int          domaintype,dim,dofpernode;
++	int          dim;
+ 	int*         doflist = NULL;
+ 
+ 	/*Get some parameters*/
+-	element->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Mesh2DhorizontalEnum: dim = 2; dofpernode = 1; break;
+-		case Mesh2DverticalEnum:   dim = 2; dofpernode = 1; break;
+-		case Mesh3DEnum:           dim = 3; dofpernode = 1; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
++	element->FindParam(&dim,DomainDimensionEnum);
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+-	int numdof   = numnodes*dofpernode;
+ 
+ 	/*Fetch dof list and allocate solution vector*/
+ 	element->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+-	IssmDouble* values = xNew<IssmDouble>(numdof);
++	IssmDouble* values = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Get inputs*/
+ 	Input* lsf_input=element->GetInput(MaskIceLevelsetEnum); _assert_(lsf_input);
+@@ -279,10 +272,10 @@
+ 		gauss->GaussNode(element->FiniteElement(),i);
+ 
+ 		lsf_input->GetInputValue(&lsf,gauss);
+-		values[i*dofpernode+0]=lsf;
++		values[i]=lsf;
+ 	}
+ 
+-	solution->SetValues(numdof,doflist,values,INS_VAL);
++	solution->SetValues(numnodes,doflist,values,INS_VAL);
+ 
+ 	/*Free ressources:*/
+ 	delete gauss;
+@@ -295,10 +288,10 @@
+ 	int domaintype;
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			element->InputUpdateFromSolutionOneDof(solution,MaskIceLevelsetEnum);
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			element->InputUpdateFromSolutionOneDofCollapsed(solution,MaskIceLevelsetEnum);
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 17700)
+@@ -41,7 +41,7 @@
+ 	iomodel->FetchDataToInput(elements,FrictionCoefficientEnum);
+ 	if(islevelset){
+ 		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
+-		if(iomodel->domaintype!=Mesh2DhorizontalEnum)
++		if(iomodel->domaintype!=Domain2DhorizontalEnum)
+ 			iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum); // required for updating active nodes
+ 	}
+ 
+@@ -63,7 +63,7 @@
+ 	/*First create nodes*/
+ 	int    lid=0;
+ 	iomodel->FetchData(4,FlowequationBorderSSAEnum,FlowequationBorderFSEnum,FlowequationVertexEquationEnum,StressbalanceReferentialEnum);
+-	if(iomodel->domaintype!=Mesh2DhorizontalEnum){
++	if(iomodel->domaintype!=Domain2DhorizontalEnum){
+ 		iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	}
+ 
+@@ -165,9 +165,9 @@
+ 	int domaintype;
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			return CreateKMatrix2D(element);
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			return CreateKMatrix3D(element);
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+@@ -268,9 +268,9 @@
+ 	int domaintype;
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			return CreatePVector2D(element);
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			return CreatePVector3D(element);
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+@@ -540,11 +540,11 @@
+ 	g        = element->GetMaterialParameter(ConstantsGEnum);
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			element->GetInputListOnNodes(&thickness[0],ThicknessEnum);
+ 			for(i=0;i<numnodes;i++) pressure[i]=rho_ice*g*thickness[i];
+ 			break;
+-		case Mesh3DEnum:   
++		case Domain3DEnum:   
+ 			element->GetVerticesCoordinates(&xyz_list);
+ 			element->GetInputListOnNodes(&surface[0],SurfaceEnum);
+ 			for(i=0;i<numnodes;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17700)
+@@ -18,33 +18,33 @@
+ 	switch(approximation){
+ 		case SSAApproximationEnum:
+ 			 switch(domaintype){
+-				 case Mesh3DEnum:           numdofs=2; break;
+-				 case Mesh2DhorizontalEnum: numdofs=2; break;
+-				 case Mesh2DverticalEnum:   numdofs=1; break;
++				 case Domain3DEnum:           numdofs=2; break;
++				 case Domain2DhorizontalEnum: numdofs=2; break;
++				 case Domain2DverticalEnum:   numdofs=1; break;
+ 				 default: _error_("mesh type not supported yet");
+ 			 }
+ 			 break;
+ 		case L1L2ApproximationEnum: numdofs =2; break;
+ 		case HOApproximationEnum:   
+ 			 switch(domaintype){
+-				 case Mesh3DEnum:         numdofs=2; break;
+-				 case Mesh2DverticalEnum: numdofs=1; break;
++				 case Domain3DEnum:         numdofs=2; break;
++				 case Domain2DverticalEnum: numdofs=1; break;
+ 				 default: _error_("mesh type not supported yet");
+ 			 }
+ 			 break;
+ 		case SIAApproximationEnum:  numdofs =2; break;
+ 		case FSvelocityEnum:
+ 			 switch(domaintype){
+-				 case Mesh3DEnum:         numdofs=3; break;
+-				 case Mesh2DverticalEnum: numdofs=2; break;
++				 case Domain3DEnum:         numdofs=3; break;
++				 case Domain2DverticalEnum: numdofs=2; break;
+ 				 default: _error_("mesh type not supported yet");
+ 			}
+ 			break;
+ 		case FSpressureEnum: numdofs=1; break;
+ 		case NoneApproximationEnum:
+ 			 switch(domaintype){
+-				 case Mesh3DEnum:         numdofs=4; break;
+-				 case Mesh2DverticalEnum: numdofs=3; break;
++				 case Domain3DEnum:         numdofs=4; break;
++				 case Domain2DverticalEnum: numdofs=3; break;
+ 				 default: _error_("mesh type not supported yet");
+ 			}
+ 			break;
+@@ -213,7 +213,7 @@
+ 	iomodel->FetchDataToInput(elements,LoadingforceYEnum);
+ 	iomodel->FetchDataToInput(elements,DamageDEnum);
+ 
+-	if(iomodel->domaintype==Mesh3DEnum){
++	if(iomodel->domaintype==Domain3DEnum){
+ 		if(iomodel->meshelementtype==PentaEnum){
+ 			iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 			iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+@@ -224,7 +224,7 @@
+ 		iomodel->FetchDataToInput(elements,VzEnum,0.);
+ 		if(dakota_analysis)elements->InputDuplicate(VzEnum,QmuVzEnum);
+ 	}
+-	if(iomodel->domaintype==Mesh2DverticalEnum){
++	if(iomodel->domaintype==Domain2DverticalEnum){
+ 		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+ 	}
+ 	if(isFS){
+@@ -234,7 +234,7 @@
+ 	}
+ 	if(islevelset){
+ 		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
+-		if(iomodel->domaintype!=Mesh2DhorizontalEnum)
++		if(iomodel->domaintype!=Domain2DhorizontalEnum)
+ 			iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum); // required for updating active nodes
+ 	}
+ 
+@@ -288,7 +288,7 @@
+ 			iomodel->Constant(&finiteelement,FlowequationFeFSEnum);
+ 		}
+ 		iomodel->FetchData(3,FlowequationBorderSSAEnum,FlowequationVertexEquationEnum,StressbalanceReferentialEnum);
+-		if(iomodel->domaintype!=Mesh2DhorizontalEnum) iomodel->FetchData(3,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum,FlowequationBorderFSEnum);
++		if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(3,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum,FlowequationBorderFSEnum);
+ 		::CreateNodes(nodes,iomodel,StressbalanceAnalysisEnum,finiteelement,approximation);
+ 		iomodel->DeleteData(6,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum,FlowequationBorderSSAEnum,FlowequationBorderFSEnum,
+ 					FlowequationVertexEquationEnum,StressbalanceReferentialEnum);
+@@ -420,22 +420,22 @@
+ 			iomodel->FetchData(&nodeonFS,NULL,NULL,FlowequationBorderFSEnum);
+ 			iomodel->FetchData(&nodeonbase,NULL,NULL,MeshVertexonbaseEnum);
+ 			iomodel->FetchData(&groundedice_ls,NULL,NULL,MaskGroundediceLevelsetEnum);
+-			if(iomodel->domaintype==Mesh3DEnum){
++			if(iomodel->domaintype==Domain3DEnum){
+ 				iomodel->FetchData(&spcvz,&Mz,&Nz,StressbalanceSpcvzEnum);
+ 			}
+-			else if (iomodel->domaintype==Mesh2DverticalEnum){
++			else if (iomodel->domaintype==Domain2DverticalEnum){
+ 				iomodel->FetchData(&spcvz,&Mz,&Nz,StressbalanceSpcvyEnum);
+ 			}
+ 			else{
+ 				_error_("not supported yet");
+ 			}
+-			if(iomodel->domaintype==Mesh3DEnum){
++			if(iomodel->domaintype==Domain3DEnum){
+ 				IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvxEnum,StressbalanceAnalysisEnum,finiteelement,0);
+ 				IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvyEnum,StressbalanceAnalysisEnum,finiteelement,1);
+ 				IoModelToConstraintsx(constraints,iomodel,spcvz,Mz,Nz,StressbalanceAnalysisEnum,finiteelement,2);
+ 				iomodel->DeleteData(spcvz,StressbalanceSpcvzEnum);
+ 			}
+-			else if (iomodel->domaintype==Mesh2DverticalEnum){
++			else if (iomodel->domaintype==Domain2DverticalEnum){
+ 				IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvxEnum,StressbalanceAnalysisEnum,finiteelement,0);
+ 				IoModelToConstraintsx(constraints,iomodel,spcvz,Mz,Nz,StressbalanceAnalysisEnum,finiteelement,1);
+ 				iomodel->DeleteData(spcvz,StressbalanceSpcvyEnum);
+@@ -496,7 +496,7 @@
+ 		}
+ 		else{
+ 			IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvxEnum,StressbalanceAnalysisEnum,finiteelement,0);
+-			if(iomodel->domaintype!=Mesh2DverticalEnum){
++			if(iomodel->domaintype!=Domain2DverticalEnum){
+ 				IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvyEnum,StressbalanceAnalysisEnum,finiteelement,1);
+ 			}
+ 		}
+@@ -509,10 +509,10 @@
+ 	iomodel->FetchData(&spcvy,&My,&Ny,StressbalanceSpcvyEnum);
+ 	iomodel->FetchData(&spcvz,&Mz,&Nz,StressbalanceSpcvzEnum);
+ 	iomodel->FetchData(&nodeonSSA,NULL,NULL,FlowequationBorderSSAEnum);
+-	if(iomodel->domaintype==Mesh3DEnum)iomodel->FetchData(&nodeonHO,NULL,NULL,FlowequationBorderHOEnum);
+-	if(iomodel->domaintype==Mesh3DEnum)iomodel->FetchData(&nodeonFS,NULL,NULL,FlowequationBorderFSEnum);
+-	if(iomodel->domaintype==Mesh3DEnum)iomodel->FetchData(&nodeonbase,NULL,NULL,MeshVertexonbaseEnum);
+-	if(iomodel->domaintype==Mesh3DEnum)iomodel->FetchData(&groundedice_ls,NULL,NULL,MaskGroundediceLevelsetEnum);
++	if(iomodel->domaintype==Domain3DEnum)iomodel->FetchData(&nodeonHO,NULL,NULL,FlowequationBorderHOEnum);
++	if(iomodel->domaintype==Domain3DEnum)iomodel->FetchData(&nodeonFS,NULL,NULL,FlowequationBorderFSEnum);
++	if(iomodel->domaintype==Domain3DEnum)iomodel->FetchData(&nodeonbase,NULL,NULL,MeshVertexonbaseEnum);
++	if(iomodel->domaintype==Domain3DEnum)iomodel->FetchData(&groundedice_ls,NULL,NULL,MaskGroundediceLevelsetEnum);
+ 	iomodel->FetchData(&vertices_type,NULL,NULL,FlowequationVertexEquationEnum);
+ 	iomodel->FetchData(&surface,NULL,NULL,SurfaceEnum);
+ 	iomodel->FetchData(&z,NULL,NULL,MeshZEnum);
+@@ -739,10 +739,10 @@
+ 	iomodel->DeleteData(spcvy,StressbalanceSpcvyEnum);
+ 	iomodel->DeleteData(spcvz,StressbalanceSpcvzEnum);
+ 	iomodel->DeleteData(nodeonSSA,FlowequationBorderSSAEnum);
+-	if(iomodel->domaintype==Mesh3DEnum)iomodel->DeleteData(nodeonHO,FlowequationBorderHOEnum);
+-	if(iomodel->domaintype==Mesh3DEnum)iomodel->DeleteData(nodeonFS,FlowequationBorderFSEnum);
+-	if(iomodel->domaintype==Mesh3DEnum)iomodel->DeleteData(nodeonbase,MeshVertexonbaseEnum);
+-	if(iomodel->domaintype==Mesh3DEnum)iomodel->DeleteData(groundedice_ls,MaskGroundediceLevelsetEnum);
++	if(iomodel->domaintype==Domain3DEnum)iomodel->DeleteData(nodeonHO,FlowequationBorderHOEnum);
++	if(iomodel->domaintype==Domain3DEnum)iomodel->DeleteData(nodeonFS,FlowequationBorderFSEnum);
++	if(iomodel->domaintype==Domain3DEnum)iomodel->DeleteData(nodeonbase,MeshVertexonbaseEnum);
++	if(iomodel->domaintype==Domain3DEnum)iomodel->DeleteData(groundedice_ls,MaskGroundediceLevelsetEnum);
+ 	iomodel->DeleteData(vertices_type,FlowequationVertexEquationEnum);
+ 	iomodel->DeleteData(surface,SurfaceEnum);
+ 	iomodel->DeleteData(z,MeshZEnum);
+@@ -855,7 +855,7 @@
+ 		else
+ 		 solutionsequence_nonlinear(femmodel,conserve_loads); 
+ 
+-		if(domaintype==Mesh2DverticalEnum && isSSA){
++		if(domaintype==Domain2DverticalEnum && isSSA){
+ 			femmodel->parameters->SetParam(VxEnum,InputToExtrudeEnum);
+ 			extrudefrombase_core(femmodel);
+ 			femmodel->parameters->SetParam(VelEnum,InputToExtrudeEnum);
+@@ -984,9 +984,9 @@
+ 	/*Get some parameters*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum: dim = 2; dofpernode = 2; break;
+-		case Mesh2DverticalEnum:   dim = 2; dofpernode = 1; break;
+-		case Mesh3DEnum:           dim = 3; dofpernode = 2; break;
++		case Domain2DhorizontalEnum: dim = 2; dofpernode = 2; break;
++		case Domain2DverticalEnum:   dim = 2; dofpernode = 1; break;
++		case Domain3DEnum:           dim = 3; dofpernode = 2; break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -1002,7 +1002,7 @@
+ 	/*Get inputs*/
+ 	Input* vx_input=element->GetInput(VxEnum); _assert_(vx_input);
+ 	Input* vy_input=NULL;
+-	if(domaintype!=Mesh2DverticalEnum){vy_input=element->GetInput(VyEnum); _assert_(vy_input);}
++	if(domaintype!=Domain2DverticalEnum){vy_input=element->GetInput(VyEnum); _assert_(vy_input);}
+ 
+ 	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+ 	Gauss* gauss=element->NewGauss();
+@@ -1077,10 +1077,10 @@
+ 	/*Get basal element*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+@@ -1147,7 +1147,7 @@
+ 	xDelete<IssmDouble>(dbasis);
+ 
+ 	/*clean-up and return*/
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return Ke;
+ 
+ }/*}}}*/
+@@ -1163,10 +1163,10 @@
+ 	/*Get basal element*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+-		case Mesh3DEnum: case Mesh2DverticalEnum:
++		case Domain3DEnum: case Domain2DverticalEnum:
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+@@ -1179,7 +1179,7 @@
+ 	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
+ 
+ 	/*clean-up and return*/
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	delete Ke1;
+ 	delete Ke2;
+ 	return Ke;
+@@ -1201,9 +1201,9 @@
+ 	/*Get problem dimension*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DverticalEnum:   dim = 1;break;
+-		case Mesh2DhorizontalEnum: dim = 2;break;
+-		case Mesh3DEnum:           dim = 2;break;
++		case Domain2DverticalEnum:   dim = 1;break;
++		case Domain2DhorizontalEnum: dim = 2;break;
++		case Domain3DEnum:           dim = 2;break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -1286,9 +1286,9 @@
+ 	/*Get problem dimension*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DverticalEnum:   dim = 1; bsize = 1; break;
+-		case Mesh2DhorizontalEnum: dim = 2; bsize = 3; break;
+-		case Mesh3DEnum:           dim = 2; bsize = 3; break;
++		case Domain2DverticalEnum:   dim = 1; bsize = 1; break;
++		case Domain2DhorizontalEnum: dim = 2; bsize = 3; break;
++		case Domain3DEnum:           dim = 2; bsize = 3; break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -1364,10 +1364,10 @@
+ 	/*Get basal element*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+-		case Mesh3DEnum: case Mesh2DverticalEnum:
++		case Domain3DEnum: case Domain2DverticalEnum:
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+@@ -1380,7 +1380,7 @@
+ 	ElementVector* pe =new ElementVector(pe1,pe2);
+ 
+ 	/*clean-up and return*/
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	delete pe1;
+ 	delete pe2;
+ 	return pe;
+@@ -1398,9 +1398,9 @@
+ 	/*Get problem dimension*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DverticalEnum:   dim = 1;break;
+-		case Mesh2DhorizontalEnum: dim = 2;break;
+-		case Mesh3DEnum:           dim = 2;break;
++		case Domain2DverticalEnum:   dim = 1;break;
++		case Domain2DhorizontalEnum: dim = 2;break;
++		case Domain3DEnum:           dim = 2;break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -1463,9 +1463,9 @@
+ 	/*Get problem dimension*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DverticalEnum:   dim = 1;break;
+-		case Mesh2DhorizontalEnum: dim = 2;break;
+-		case Mesh3DEnum:           dim = 2;break;
++		case Domain2DverticalEnum:   dim = 1;break;
++		case Domain2DhorizontalEnum: dim = 2;break;
++		case Domain3DEnum:           dim = 2;break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -1654,18 +1654,18 @@
+ 	rho_ice =element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 	g       =element->GetMaterialParameter(ConstantsGEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			element->GetInputListOnVertices(thickness,ThicknessEnum);
+ 			for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*thickness[i];
+ 			dim=2;
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			element->GetVerticesCoordinates(&xyz_list);
+ 			element->GetInputListOnVertices(surface,SurfaceEnum);
+ 			for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
+ 			dim=2;
+ 			break;
+-		case Mesh2DverticalEnum:
++		case Domain2DverticalEnum:
+ 			element->GetVerticesCoordinates(&xyz_list);
+ 			element->GetInputListOnVertices(surface,SurfaceEnum);
+ 			for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
+@@ -1680,10 +1680,10 @@
+ 
+ 	/*Get basal element*/
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+-		case Mesh3DEnum: case Mesh2DverticalEnum:
++		case Domain3DEnum: case Domain2DverticalEnum:
+ 			if(!element->IsOnBase()){xDelete<IssmDouble>(xyz_list); return;}
+ 			basalelement=element->SpawnBasalElement();
+ 			break;
+@@ -1747,7 +1747,7 @@
+ 	xDelete<IssmDouble>(values);
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<int>(doflist);
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ }/*}}}*/
+ 
+ /*L1L2*/
+@@ -1842,10 +1842,10 @@
+ 	/*Get basal element*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum: case Domain2DverticalEnum:
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+@@ -1858,7 +1858,7 @@
+ 	ElementVector* pe =new ElementVector(pe1,pe2);
+ 
+ 	/*clean-up and return*/
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	delete pe1;
+ 	delete pe2;
+ 	return pe;
+@@ -1972,7 +1972,7 @@
+ }/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionL1L2(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	int         i,domaintype;
++	int         i,dim,domaintype;
+ 	IssmDouble  rho_ice,g;
+ 	int*        doflist=NULL;
+ 	IssmDouble* xyz_list=NULL;
+@@ -1984,21 +1984,19 @@
+ 	IssmDouble* thickness = xNew<IssmDouble>(numvertices);
+ 	IssmDouble* surface   = xNew<IssmDouble>(numvertices);
+ 
++	element->FindParam(&dim,DomainDimensionEnum);
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	rho_ice =element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 	g       =element->GetMaterialParameter(ConstantsGEnum);
+-	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
+-			element->GetInputListOnVertices(thickness,ThicknessEnum);
+-			for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*thickness[i];
+-			break;
+-		case Mesh3DEnum:
+-			element->GetVerticesCoordinates(&xyz_list);
+-			element->GetInputListOnVertices(surface,SurfaceEnum);
+-			for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
+-			break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
++	if(dim==2){
++		element->GetInputListOnVertices(thickness,ThicknessEnum);
++		for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*thickness[i];
+ 	}
++	else{
++		element->GetVerticesCoordinates(&xyz_list);
++		element->GetInputListOnVertices(surface,SurfaceEnum);
++		for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
++	}
+ 	element->AddInput(PressureEnum,pressure,P1Enum);
+ 	xDelete<IssmDouble>(pressure);
+ 	xDelete<IssmDouble>(thickness);
+@@ -2006,10 +2004,10 @@
+ 
+ 	/*Get basal element*/
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			if(!element->IsOnBase()){xDelete<IssmDouble>(xyz_list); return;}
+ 			basalelement=element->SpawnBasalElement();
+ 			break;
+@@ -2067,7 +2065,7 @@
+ 	xDelete<IssmDouble>(values);
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<int>(doflist);
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ }/*}}}*/
+ 
+ /*HO*/
+@@ -2153,19 +2151,16 @@
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+ 	/*Intermediaries*/
+-	int         dim,domaintype,bsize;
++	int         dim,bsize;
+ 	IssmDouble  viscosity,newviscosity,oldviscosity;
+ 	IssmDouble  viscosity_overshoot,thickness,Jdet;
+ 	IssmDouble  D_scalar;
+ 	IssmDouble *xyz_list = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2; bsize = 2; break;
+-		case Mesh3DEnum:         dim = 3; bsize = 5; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
++	element->FindParam(&dim,DomainDimensionEnum);
++	if(dim==2) bsize = 2;
++	else       bsize = 5;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+@@ -2230,7 +2225,7 @@
+ 	if(element->IsFloating() || !element->IsOnBase()) return NULL;
+ 
+ 	/*Intermediaries*/
+-	int         dim,domaintype;
++	int         dim;
+ 	bool        mainlyfloating;
+ 	int         migration_style,point1;
+ 	IssmDouble  alpha2,Jdet,fraction1,fraction2;
+@@ -2239,12 +2234,7 @@
+ 	Gauss*      gauss         = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2; break;
+-		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
++	element->FindParam(&dim,DomainDimensionEnum);
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+@@ -2318,18 +2308,13 @@
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+ 	/*Intermediaries */
+-	int         dim,domaintype;
++	int         dim;
+ 	IssmDouble  x_coord,y_coord,z_coord;
+ 	IssmDouble  Jdet,forcex,forcey,forcez;
+ 	IssmDouble* xyz_list = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2; break;
+-		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
++	element->FindParam(&dim,DomainDimensionEnum);
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+@@ -2395,17 +2380,12 @@
+ 	if(!element->IsIceInElement()) return NULL;
+ 
+ 	/*Intermediaries */
+-	int         dim,domaintype;
++	int         dim;
+ 	IssmDouble  Jdet,slope[3];
+ 	IssmDouble* xyz_list = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2; break;
+-		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
++	element->FindParam(&dim,DomainDimensionEnum);
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = element->GetNumberOfNodes();
+@@ -2452,7 +2432,7 @@
+ 	if(!element->IsIcefront()) return NULL;
+ 
+ 	/*Intermediaries*/
+-	int         dim,domaintype;
++	int         dim;
+ 	IssmDouble  Jdet,surface,z,water_pressure,ice_pressure;
+ 	IssmDouble  surface_under_water,base_under_water,pressure;
+ 	IssmDouble* xyz_list       = NULL;
+@@ -2461,12 +2441,7 @@
+ 	Gauss*      gauss = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2; break;
+-		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
++	element->FindParam(&dim,DomainDimensionEnum);
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes    = element->GetNumberOfNodes();
+@@ -2654,17 +2629,12 @@
+ }/*}}}*/
+ void StressbalanceAnalysis::InputUpdateFromSolutionHO(IssmDouble* solution,Element* element){/*{{{*/
+ 
+-	int         i,dim,domaintype;
++	int         i,dim;
+ 	int*        doflist=NULL;
+ 	IssmDouble* xyz_list=NULL;
+ 
+ 	/*Get mesh dimension*/
+-	element->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2; break;
+-		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
++	element->FindParam(&dim,DomainDimensionEnum);
+ 
+ 	/*Deal with pressure first*/
+ 	int numvertices = element->GetNumberOfVertices();
+@@ -2743,15 +2713,10 @@
+ /*FS*/
+ ElementVector* StressbalanceAnalysis::CreateDVectorFS(Element* element){/*{{{*/
+ 
+-	int         domaintype,dim;
++	int dim;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2; break;
+-		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
++	element->FindParam(&dim,DomainDimensionEnum);
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int vnumnodes = element->NumberofNodesVelocity();
+@@ -2881,18 +2846,15 @@
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixFSViscousXTH(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int         i,domaintype,dim,epssize;
++	int         i,dim,epssize;
+ 	IssmDouble  r,FSreconditioning,Jdet;
+ 	IssmDouble *xyz_list = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&domaintype,DomainTypeEnum);
++	element->FindParam(&dim,DomainDimensionEnum);
+ 	element->FindParam(&r,AugmentedLagrangianREnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2; epssize = 3; break;
+-		case Mesh3DEnum:         dim = 3; epssize = 6; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
++	if(dim==2) epssize = 3;
++	else       epssize = 6;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int vnumnodes = element->NumberofNodesVelocity();
+@@ -2953,17 +2915,14 @@
+ ElementMatrix* StressbalanceAnalysis::CreateKMatrixFSViscous(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int         i,domaintype,dim,epssize;
++	int         i,dim,epssize;
+ 	IssmDouble  viscosity,FSreconditioning,Jdet;
+ 	IssmDouble *xyz_list = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2; epssize = 3; break;
+-		case Mesh3DEnum:         dim = 3; epssize = 6; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
++	element->FindParam(&dim,DomainDimensionEnum);
++	if(dim==2) epssize = 3;
++	else       epssize = 6;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int vnumnodes = element->NumberofNodesVelocity();
+@@ -3035,7 +2994,7 @@
+ 
+ 	/*Intermediaries*/
+ 	bool        mainlyfloating;
+-	int         j,i,domaintype,dim;
++	int         j,i,dim;
+ 	IssmDouble  Jdet,slope2,scalar,dt;
+ 	IssmDouble  slope[3];
+ 	IssmDouble *xyz_list_base = NULL;
+@@ -3043,12 +3002,7 @@
+ 	Gauss*      gauss         = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2;break;
+-		case Mesh3DEnum:         dim = 3;break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
++	element->FindParam(&dim,DomainDimensionEnum);
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int vnumnodes = element->NumberofNodesVelocity();
+@@ -3106,19 +3060,14 @@
+ 	if(approximation!=FSApproximationEnum && approximation!=SSAFSApproximationEnum && approximation!=HOFSApproximationEnum) return NULL;
+ 
+ 	/*Intermediaries*/
+-	int         i,domaintype,dim;
++	int         i,dim;
+ 	IssmDouble  alpha2,Jdet;
+ 	IssmDouble  x_coord,y_coord,z_coord;
+ 	IssmDouble *xyz_list_base = NULL;
+ 	Gauss*      gauss         = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2;break;
+-		case Mesh3DEnum:         dim = 3;break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
++	element->FindParam(&dim,DomainDimensionEnum);
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int vnumnodes = element->NumberofNodesVelocity();
+@@ -3170,18 +3119,13 @@
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorFS(Element* element){/*{{{*/
+ 
+-	int         i,domaintype,dim,fe_FS;
++	int         i,dim,fe_FS;
+ 	IssmDouble  x_coord,y_coord,z_coord;
+ 	IssmDouble  Jdet,forcex,forcey,forcez;
+ 	IssmDouble *xyz_list = NULL;
+ 
+ 	element->FindParam(&fe_FS,FlowequationFeFSEnum);
+-	element->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2; break;
+-		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
++	element->FindParam(&dim,DomainDimensionEnum);
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int vnumnodes = element->NumberofNodesVelocity();
+@@ -3253,7 +3197,7 @@
+ 
+ 	/*Intermediaries*/
+ 	bool        mainlyfloating;
+-	int         i,domaintype,dim,epssize;
++	int         i,dim,domaintype,epssize;
+ 	int         migration_style,point1;
+ 	IssmDouble  alpha2,Jdet,fraction1,fraction2;
+ 	IssmDouble  gllevelset,phi=1.;
+@@ -3261,12 +3205,8 @@
+ 	Gauss*      gauss         = NULL;
+ 
+ 	/*Get problem dimension*/
++	element->FindParam(&dim,DomainDimensionEnum);
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2;break;
+-		case Mesh3DEnum:         dim = 3;break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int vnumnodes = element->NumberofNodesVelocity();
+@@ -3293,7 +3233,7 @@
+ 	/*Recover portion of element that is grounded*/
+ 	if(migration_style==SubelementMigrationEnum) phi=element->GetGroundedPortion(xyz_list_base);
+ 	if(migration_style==SubelementMigration2Enum){
+-		if(domaintype==Mesh2DverticalEnum) _error_("Subelement Migration 2 not implemented yet for Flowline");
++		if(domaintype==Domain2DverticalEnum) _error_("Subelement Migration 2 not implemented yet for Flowline");
+ 		gllevelset_input=element->GetInput(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input);
+ 		element->GetGroundedPart(&point1,&fraction1,&fraction2,&mainlyfloating);
+ 		//gauss = element->NewGauss(point1,fraction1,fraction2,mainlyfloating,2);
+@@ -3370,17 +3310,12 @@
+ #endif
+ ElementVector* StressbalanceAnalysis::CreatePVectorFSViscous(Element* element){/*{{{*/
+ 
+-	int         i,domaintype,dim;
++	int         i,dim;
+ 	IssmDouble  Jdet,forcex,forcey,forcez;
+ 	IssmDouble *xyz_list = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2; break;
+-		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
++	element->FindParam(&dim,DomainDimensionEnum);
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int vnumnodes = element->NumberofNodesVelocity();
+@@ -3444,7 +3379,7 @@
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorFSViscousXTH(Element* element){/*{{{*/
+ 
+-	int         i,tausize,domaintype,dim;
++	int         i,tausize,dim;
+ 	IssmDouble  Jdet,r;
+ 	IssmDouble  epsxx,epsyy,epszz,epsxy,epsxz,epsyz;
+ 	IssmDouble  sigmapxx,sigmapyy,sigmapzz,sigmapxy,sigmapxz,sigmapyz;
+@@ -3452,12 +3387,9 @@
+ 	Gauss*      gauss    = NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2; tausize = 3; break;
+-		case Mesh3DEnum:         dim = 3; tausize = 6; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
++	element->FindParam(&dim,DomainDimensionEnum);
++	if(dim==2) tausize = 3;
++	else       tausize = 6;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int vnumnodes = element->NumberofNodesVelocity();
+@@ -3619,7 +3551,7 @@
+ }/*}}}*/
+ ElementVector* StressbalanceAnalysis::CreatePVectorFSShelf(Element* element){/*{{{*/
+ 
+-	int         i,domaintype,dim;
++	int         i,dim;
+ 	IssmDouble  Jdet,water_pressure,bed;
+ 	IssmDouble	normal[3];
+ 	IssmDouble *xyz_list_base = NULL;
+@@ -3628,12 +3560,7 @@
+ 	if(!element->IsOnBase() || !element->IsFloating()) return NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2; break;
+-		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
++	element->FindParam(&dim,DomainDimensionEnum);
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int vnumnodes = element->NumberofNodesVelocity();
+@@ -3693,7 +3620,7 @@
+ 	if(!element->IsIcefront()) return NULL;
+ 
+ 	/*Intermediaries*/
+-	int         i,domaintype,dim;
++	int         i,dim;
+ 	IssmDouble  Jdet,pressure,surface,z;
+ 	IssmDouble	normal[3];
+ 	IssmDouble *xyz_list       = NULL;
+@@ -3704,12 +3631,7 @@
+ 	if(!element->IsFloating()) return NULL;
+ 
+ 	/*Get problem dimension*/
+-	element->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2; break;
+-		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
++	element->FindParam(&dim,DomainDimensionEnum);
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int vnumnodes   = element->NumberofNodesVelocity();
+@@ -4050,18 +3972,13 @@
+ 	int*         vdoflist=NULL;
+ 	int*         pdoflist=NULL;
+ 	Input*       vz_input=NULL;
+-	int          domaintype,dim;
++	int          dim;
+ 	IssmDouble   vx,vy,vz,p;
+ 	IssmDouble   FSreconditioning;
+ 
+ 	/*Get some parameters*/
+-	element->FindParam(&domaintype,DomainTypeEnum);
++	element->FindParam(&dim,DomainDimensionEnum);
+ 	element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2; break;
+-		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int vnumnodes = element->NumberofNodesVelocity();
+@@ -4116,18 +4033,13 @@
+ void StressbalanceAnalysis::InitializeXTH(Elements* elements,Parameters* parameters){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int        domaintype,dim;
++	int        dim;
+ 	IssmDouble dvx[3],dvy[3],dvz[3];
+ 	IssmDouble viscosity;
+ 	IssmDouble *xyz_list = NULL;
+ 
+ 	/*Get problem dimension*/
+-	parameters->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2; break;
+-		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
++	parameters->FindParam(&dim,DomainDimensionEnum);
+ 
+ 	for(int i=0;i<elements->Size();i++){
+ 		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+@@ -4200,19 +4112,14 @@
+ void StressbalanceAnalysis::InputUpdateFromSolutionFS(IssmDouble* solution,Element* element){/*{{{*/
+ 
+ 	bool         results_on_nodes;
+-	int          i,dim,domaintype;
++	int          i,dim;
+ 	int*         vdoflist=NULL;
+ 	int*         pdoflist=NULL;
+ 	IssmDouble   FSreconditioning;
+ 
+-	element->FindParam(&domaintype,DomainTypeEnum);
++	element->FindParam(&dim,DomainDimensionEnum);
+ 	element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
+ 	element->FindParam(&results_on_nodes,SettingsResultsOnNodesEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2; break;
+-		case Mesh3DEnum:         dim = 3; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int vnumnodes = element->NumberofNodesVelocity();
+@@ -4295,7 +4202,7 @@
+ void StressbalanceAnalysis::InputUpdateFromSolutionFSXTH_d(Elements* elements,Parameters* parameters){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int         dim,tausize,domaintype;
++	int         dim,tausize;
+ 	IssmDouble  epsxx,epsyy,epszz,epsxy,epsxz,epsyz,D_scalar;
+ 	IssmDouble  epsxx_old,epsyy_old,epszz_old,epsxy_old,epsxz_old,epsyz_old;
+ 	IssmDouble  sigmapxx,sigmapyy,sigmapzz,sigmapxy,sigmapxz,sigmapyz;
+@@ -4304,12 +4211,9 @@
+ 	IssmDouble  Jdet,r;
+ 
+ 	parameters->FindParam(&r,AugmentedLagrangianREnum);
+-	parameters->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2; tausize = 3; break;
+-		case Mesh3DEnum:         dim = 3; tausize = 6; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
++	parameters->FindParam(&dim,DomainDimensionEnum);
++	if(dim==2) tausize = 3;
++	else       tausize = 6;
+ 
+ 	for(int i=0;i<elements->Size();i++){
+ 		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+@@ -4508,7 +4412,7 @@
+ void StressbalanceAnalysis::InputUpdateFromSolutionFSXTH_tau(Elements* elements,Parameters* parameters){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int         dim,tausize,domaintype;
++	int         dim,tausize;
+ 	IssmDouble  epsxx,epsyy,epszz,epsxy,epsxz,epsyz,D_scalar;
+ 	IssmDouble  d_xx,d_yy,d_zz,d_xy,d_xz,d_yz;
+ 	IssmDouble  sigmapxx,sigmapyy,sigmapzz,sigmapxy,sigmapxz,sigmapyz;
+@@ -4517,12 +4421,9 @@
+ 	IssmDouble  Jdet,r;
+ 
+ 	parameters->FindParam(&r,AugmentedLagrangianREnum);
+-	parameters->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Mesh2DverticalEnum: dim = 2; tausize = 3; break;
+-		case Mesh3DEnum:         dim = 3; tausize = 6; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
++	parameters->FindParam(&dim,DomainDimensionEnum);
++	if(dim==2) tausize = 3;
++	else       tausize = 6;
+ 
+ 	for(int i=0;i<elements->Size();i++){
+ 		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17700)
+@@ -87,7 +87,7 @@
+ 	iomodel->FetchDataToInput(elements,HydrologydcBasalMoulinInputEnum);
+ 	iomodel->FetchDataToInput(elements,SedimentHeadEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcSedimentTransmitivityEnum);
+-	if(iomodel->domaintype==Mesh3DEnum) iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
++	if(iomodel->domaintype==Domain3DEnum) iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 
+ 	if(isefficientlayer)iomodel->FetchDataToInput(elements,HydrologydcMaskEplactiveNodeEnum);
+ }/*}}}*/
+@@ -100,7 +100,7 @@
+ 	/*Now, do we really want DC?*/
+ 	if(hydrology_model!=HydrologydcEnum) return;
+ 
+-	if(iomodel->domaintype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,HydrologyDCInefficientAnalysisEnum,P1Enum);
+ 	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+@@ -120,12 +120,12 @@
+ 	iomodel->Constant(&hydrology_model,HydrologyModelEnum);
+ 	if(hydrology_model!=HydrologydcEnum) return;
+ 
+-	if(iomodel->domaintype==Mesh3DEnum) iomodel->FetchData(1,MeshVertexonbaseEnum);
++	if(iomodel->domaintype==Domain3DEnum) iomodel->FetchData(1,MeshVertexonbaseEnum);
+ 
+ 	//create penalties for nodes: no node can have water above the max
+ 	CreateSingleNodeToElementConnectivity(iomodel);
+ 	for(int i=0;i<iomodel->numberofvertices;i++){
+-		if (iomodel->domaintype!=Mesh3DEnum){
++		if (iomodel->domaintype!=Domain3DEnum){
+ 			/*keep only this partition's nodes:*/
+ 			if(iomodel->my_vertices[i]){
+ 				loads->AddObject(new Pengrid(iomodel->loadcounter+i+1,i,iomodel,HydrologyDCInefficientAnalysisEnum));
+@@ -160,10 +160,10 @@
+ 	/*Get basal element*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+@@ -253,7 +253,7 @@
+ 	xDelete<IssmDouble>(B);
+ 	xDelete<IssmDouble>(basis);
+ 	delete gauss;
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return Ke;
+ }/*}}}*/
+ ElementVector* HydrologyDCInefficientAnalysis::CreatePVector(Element* element){/*{{{*/
+@@ -265,10 +265,10 @@
+ 	/*Get basal element*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+@@ -356,7 +356,7 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+ 	delete gauss;
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
+ void HydrologyDCInefficientAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+@@ -397,7 +397,7 @@
+ 	Element*   basalelement=NULL;
+ 
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+-	if(domaintype!=Mesh2DhorizontalEnum){
++	if(domaintype!=Domain2DhorizontalEnum){
+ 		if(!element->IsOnBase()) return;
+ 		basalelement=element->SpawnBasalElement();
+ 	}
+@@ -445,7 +445,7 @@
+ 	xDelete<IssmDouble>(values);
+ 	xDelete<IssmDouble>(residual);
+ 	xDelete<int>(doflist);
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ }/*}}}*/
+ void HydrologyDCInefficientAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+ 	/*Default, do nothing*/
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17700)
+@@ -30,7 +30,7 @@
+ void ThermalAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+ 
+ 	/*Now, is the model 3d? otherwise, do nothing: */
+-	if(iomodel->domaintype==Mesh2DhorizontalEnum)return;
++	if(iomodel->domaintype==Domain2DhorizontalEnum)return;
+ 
+ 	/*Update elements: */
+ 	int counter=0;
+@@ -82,21 +82,21 @@
+ }/*}}}*/
+ void ThermalAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+-	if(iomodel->domaintype==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype==Domain3DEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,ThermalAnalysisEnum,P1Enum);
+ 	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+ void ThermalAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ 
+ 	/*Only 3d mesh supported*/
+-	if(iomodel->domaintype==Mesh3DEnum){
++	if(iomodel->domaintype==Domain3DEnum){
+ 		IoModelToConstraintsx(constraints,iomodel,ThermalSpctemperatureEnum,ThermalAnalysisEnum,P1Enum);
+ 	}
+ 
+ }/*}}}*/
+ void ThermalAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+ 
+-	if(iomodel->domaintype==Mesh2DhorizontalEnum) _error_("2d meshes not supported yet");
++	if(iomodel->domaintype==Domain2DhorizontalEnum) _error_("2d meshes not supported yet");
+ 
+ 	/*create penalties for nodes: no node can have a temperature over the melting point*/
+ 	iomodel->FetchData(1,ThermalSpctemperatureEnum);
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17700)
+@@ -59,7 +59,7 @@
+ 	/*What input do I need to run my damage evolution model?*/
+ 	iomodel->FetchDataToInput(elements,VxEnum);
+ 	iomodel->FetchDataToInput(elements,VyEnum);
+-	if(iomodel->domaintype==Mesh3DEnum) iomodel->FetchDataToInput(elements,VzEnum);
++	if(iomodel->domaintype==Domain3DEnum) iomodel->FetchDataToInput(elements,VzEnum);
+ 	iomodel->FetchDataToInput(elements,DamageDEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,PressureEnum);
+@@ -72,7 +72,7 @@
+ }/*}}}*/
+ void DamageEvolutionAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+-	if(iomodel->domaintype!=Mesh2DhorizontalEnum) iomodel->FetchData(1,MeshVertexonbaseEnum);
++	if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(1,MeshVertexonbaseEnum);
+ 	::CreateNodes(nodes,iomodel,DamageEvolutionAnalysisEnum,P1Enum);
+ 	iomodel->DeleteData(1,MeshVertexonbaseEnum);
+ }/*}}}*/
+@@ -117,11 +117,11 @@
+ 	/*Get problem dimension and basal element*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			basalelement = element;
+ 			dim = 2;
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			dim = 2;
+@@ -145,7 +145,7 @@
+ 	basalelement->FindParam(&stabilization,DamageStabilizationEnum);
+ 	Input* vxaverage_input=NULL;
+ 	Input* vyaverage_input=NULL;
+-	if(domaintype==Mesh2DhorizontalEnum){
++	if(domaintype==Domain2DhorizontalEnum){
+ 		vxaverage_input=basalelement->GetInput(VxEnum); _assert_(vxaverage_input);
+ 		vyaverage_input=basalelement->GetInput(VyEnum); _assert_(vyaverage_input);
+ 	}
+@@ -248,7 +248,7 @@
+ 	xDelete<IssmDouble>(Bprime);
+ 	xDelete<IssmDouble>(D);
+ 	delete gauss;
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return Ke;
+ }/*}}}*/
+ ElementVector* DamageEvolutionAnalysis::CreatePVector(Element* element){/*{{{*/
+@@ -266,10 +266,10 @@
+ 	/*Get basal element*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			basalelement = element;
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			break;
+@@ -310,7 +310,7 @@
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	delete gauss;
+ 	return pe;
+ }/*}}}*/
+@@ -382,7 +382,7 @@
+ 	Element*   basalelement=NULL;
+ 
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+-	if(domaintype!=Mesh2DhorizontalEnum){
++	if(domaintype!=Domain2DhorizontalEnum){
+ 		if(!element->IsOnBase()) return;
+ 		basalelement=element->SpawnBasalElement();
+ 	}
+@@ -415,7 +415,7 @@
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(newdamage);
+ 	xDelete<int>(doflist);
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ }/*}}}*/
+ void DamageEvolutionAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+ 	/*Default, do nothing*/
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17700)
+@@ -28,7 +28,7 @@
+ 	bool isenthalpy;
+ 
+ 	/*Now, is the model 3d? otherwise, do nothing: */
+-	if(iomodel->domaintype==Mesh2DhorizontalEnum)return;
++	if(iomodel->domaintype==Domain2DhorizontalEnum)return;
+ 
+ 	/*Is enthalpy requested?*/
+ 	iomodel->Constant(&isenthalpy,ThermalIsenthalpyEnum);
+@@ -93,7 +93,7 @@
+ }/*}}}*/
+ void EnthalpyAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+-	if(iomodel->domaintype==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype==Domain3DEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,EnthalpyAnalysisEnum,P1Enum);
+ 	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+@@ -116,7 +116,7 @@
+ 	iomodel->Constant(&referencetemperature,ConstantsReferencetemperatureEnum);
+ 
+ 	/*return if 2d mesh*/
+-	if(iomodel->domaintype==Mesh2DhorizontalEnum) return;
++	if(iomodel->domaintype==Domain2DhorizontalEnum) return;
+ 
+ 	/*Fetch data: */
+ 	iomodel->FetchData(&spcvector,&M,&N,ThermalSpctemperatureEnum);
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17700)
+@@ -13,7 +13,7 @@
+ void FreeSurfaceBaseAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+ 
+ 	/*Now, is the model 3d? otherwise, do nothing: */
+-	if (iomodel->domaintype==Mesh2DhorizontalEnum)return;
++	if (iomodel->domaintype==Domain2DhorizontalEnum)return;
+ 
+ 	/*Finite element type*/
+ 	int finiteelement = P1Enum;
+@@ -34,7 +34,7 @@
+ 	iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateCorrectionEnum,0.);
+ 	iomodel->FetchDataToInput(elements,VxEnum);
+ 	iomodel->FetchDataToInput(elements,VyEnum);
+-	if(iomodel->domaintype==Mesh3DEnum){
++	if(iomodel->domaintype==Domain3DEnum){
+ 		iomodel->FetchDataToInput(elements,VzEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+@@ -42,7 +42,7 @@
+ }/*}}}*/
+ void FreeSurfaceBaseAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+-	if(iomodel->domaintype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,FreeSurfaceBaseAnalysisEnum,P1Enum);
+ 	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+@@ -59,7 +59,7 @@
+ 	IssmDouble *vertex_pairing=NULL;
+ 	IssmDouble *nodeonbase=NULL;
+ 	iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,MasstransportVertexPairingEnum);
+-	if(iomodel->domaintype!=Mesh2DhorizontalEnum) iomodel->FetchData(&nodeonbase,NULL,NULL,MeshVertexonbaseEnum);
++	if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(&nodeonbase,NULL,NULL,MeshVertexonbaseEnum);
+ 	for(int i=0;i<numvertex_pairing;i++){
+ 
+ 		if(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+0])-1]){
+@@ -68,7 +68,7 @@
+ 			_assert_(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+1])-1]);
+ 
+ 			/*Skip if one of the two is not on the bed*/
+-			if(iomodel->domaintype!=Mesh2DhorizontalEnum){
++			if(iomodel->domaintype!=Domain2DhorizontalEnum){
+ 				if(!(reCast<bool>(nodeonbase[reCast<int>(vertex_pairing[2*i+0])-1])) || !(reCast<bool>(nodeonbase[reCast<int>(vertex_pairing[2*i+1])-1]))) continue;
+ 			}
+ 
+@@ -113,16 +113,16 @@
+ 	/*Get basal element*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			basalelement = element;
+ 			dim = 2;
+ 			break;
+-		case Mesh2DverticalEnum:
++		case Domain2DverticalEnum:
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			dim = 1;
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			dim = 2;
+@@ -222,7 +222,7 @@
+ 	xDelete<IssmDouble>(Bprime);
+ 	xDelete<IssmDouble>(D);
+ 	delete gauss;
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return Ke;
+ }/*}}}*/
+ ElementVector* FreeSurfaceBaseAnalysis::CreatePVector(Element* element){/*{{{*/
+@@ -236,16 +236,16 @@
+ 	/*Get basal element*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			basalelement = element;
+ 			dim = 2;
+ 			break;
+-		case Mesh2DverticalEnum:
++		case Domain2DverticalEnum:
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			dim = 1;
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			if(!element->IsOnBase()) return NULL;
+ 			basalelement = element->SpawnBasalElement();
+ 			dim = 2;
+@@ -297,7 +297,7 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(basis);
+ 	delete gauss;
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ 
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17700)
+@@ -29,7 +29,7 @@
+ 			counter++;
+ 		}
+ 	}
+-	if(iomodel->domaintype==Mesh3DEnum){
++	if(iomodel->domaintype==Domain3DEnum){
+ 		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
+@@ -37,7 +37,7 @@
+ /*}}}*/
+ void ExtrapolationAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 	int finiteelement=P1Enum;
+-	if(iomodel->domaintype!=Mesh2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
++	if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ 	::CreateNodes(nodes,iomodel,ExtrapolationAnalysisEnum,finiteelement);
+ 	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }
+@@ -98,9 +98,9 @@
+ 	/*Get problem dimension*/
+ 	basalelement->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DverticalEnum:   dim = 1; break;
+-		case Mesh2DhorizontalEnum: dim = 2; break;
+-		case Mesh3DEnum:           dim = 2; break;
++		case Domain2DverticalEnum:   dim = 1; break;
++		case Domain2DhorizontalEnum: dim = 2; break;
++		case Domain3DEnum:           dim = 2; break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+ 
+@@ -212,7 +212,7 @@
+ 	xDelete<IssmDouble>(dlsf);
+ 	xDelete<IssmDouble>(normal);
+ 	delete gauss;
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return Ke;
+ 
+ }/*}}}*/
+@@ -233,7 +233,7 @@
+ 		pe->values[i]=0.; 
+ 
+ 	basalelement->FindParam(&domaintype,DomainTypeEnum);
+-	if(domaintype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ 	return pe;
+ }/*}}}*/
+ void ExtrapolationAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+@@ -245,10 +245,10 @@
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	element->FindParam(&extrapolationvariable, ExtrapolationVariableEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			element->InputUpdateFromSolutionOneDof(solution,extrapolationvariable);
+ 			break;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			element->InputUpdateFromSolutionOneDofCollapsed(solution,extrapolationvariable);
+ 			break;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17699)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17700)
+@@ -210,13 +210,12 @@
+ 	MeshXEnum,
+ 	MeshYEnum,
+ 	MeshZEnum,
++	MeshElementtypeEnum,
+ 	DomainTypeEnum,
+ 	DomainDimensionEnum,
+-	MeshElementtypeEnum,
+-	Mesh2DhorizontalEnum,
+-	Mesh2DverticalEnum,
+-	Mesh3DEnum,
+-	Mesh3DtetrasEnum,
++	Domain2DhorizontalEnum,
++	Domain2DverticalEnum,
++	Domain3DEnum,
+ 	MiscellaneousNameEnum, //FIXME: only used by qmu, should not be marshalled (already in queueing script)
+ 	MasstransportHydrostaticAdjustmentEnum,
+ 	MasstransportIsfreesurfaceEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17700)
+@@ -218,13 +218,12 @@
+ 		case MeshXEnum : return "MeshX";
+ 		case MeshYEnum : return "MeshY";
+ 		case MeshZEnum : return "MeshZ";
++		case MeshElementtypeEnum : return "MeshElementtype";
+ 		case DomainTypeEnum : return "DomainType";
+ 		case DomainDimensionEnum : return "DomainDimension";
+-		case MeshElementtypeEnum : return "MeshElementtype";
+-		case Mesh2DhorizontalEnum : return "Mesh2Dhorizontal";
+-		case Mesh2DverticalEnum : return "Mesh2Dvertical";
+-		case Mesh3DEnum : return "Mesh3D";
+-		case Mesh3DtetrasEnum : return "Mesh3Dtetras";
++		case Domain2DhorizontalEnum : return "Domain2Dhorizontal";
++		case Domain2DverticalEnum : return "Domain2Dvertical";
++		case Domain3DEnum : return "Domain3D";
+ 		case MiscellaneousNameEnum : return "MiscellaneousName";
+ 		case MasstransportHydrostaticAdjustmentEnum : return "MasstransportHydrostaticAdjustment";
+ 		case MasstransportIsfreesurfaceEnum : return "MasstransportIsfreesurface";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17700)
+@@ -221,13 +221,12 @@
+ 	      else if (strcmp(name,"MeshX")==0) return MeshXEnum;
+ 	      else if (strcmp(name,"MeshY")==0) return MeshYEnum;
+ 	      else if (strcmp(name,"MeshZ")==0) return MeshZEnum;
++	      else if (strcmp(name,"MeshElementtype")==0) return MeshElementtypeEnum;
+ 	      else if (strcmp(name,"DomainType")==0) return DomainTypeEnum;
+ 	      else if (strcmp(name,"DomainDimension")==0) return DomainDimensionEnum;
+-	      else if (strcmp(name,"MeshElementtype")==0) return MeshElementtypeEnum;
+-	      else if (strcmp(name,"Mesh2Dhorizontal")==0) return Mesh2DhorizontalEnum;
+-	      else if (strcmp(name,"Mesh2Dvertical")==0) return Mesh2DverticalEnum;
+-	      else if (strcmp(name,"Mesh3D")==0) return Mesh3DEnum;
+-	      else if (strcmp(name,"Mesh3Dtetras")==0) return Mesh3DtetrasEnum;
++	      else if (strcmp(name,"Domain2Dhorizontal")==0) return Domain2DhorizontalEnum;
++	      else if (strcmp(name,"Domain2Dvertical")==0) return Domain2DverticalEnum;
++	      else if (strcmp(name,"Domain3D")==0) return Domain3DEnum;
+ 	      else if (strcmp(name,"MiscellaneousName")==0) return MiscellaneousNameEnum;
+ 	      else if (strcmp(name,"MasstransportHydrostaticAdjustment")==0) return MasstransportHydrostaticAdjustmentEnum;
+ 	      else if (strcmp(name,"MasstransportIsfreesurface")==0) return MasstransportIsfreesurfaceEnum;
+@@ -259,11 +258,11 @@
+ 	      else if (strcmp(name,"DebugProfiling")==0) return DebugProfilingEnum;
+ 	      else if (strcmp(name,"ProfilingCurrentMem")==0) return ProfilingCurrentMemEnum;
+ 	      else if (strcmp(name,"ProfilingCurrentFlops")==0) return ProfilingCurrentFlopsEnum;
++	      else if (strcmp(name,"ProfilingSolutionTime")==0) return ProfilingSolutionTimeEnum;
+          else stage=3;
+    }
+    if(stage==3){
+-	      if (strcmp(name,"ProfilingSolutionTime")==0) return ProfilingSolutionTimeEnum;
+-	      else if (strcmp(name,"MaxIterationConvergenceFlag")==0) return MaxIterationConvergenceFlagEnum;
++	      if (strcmp(name,"MaxIterationConvergenceFlag")==0) return MaxIterationConvergenceFlagEnum;
+ 	      else if (strcmp(name,"SteadystateMaxiter")==0) return SteadystateMaxiterEnum;
+ 	      else if (strcmp(name,"SteadystateNumRequestedOutputs")==0) return SteadystateNumRequestedOutputsEnum;
+ 	      else if (strcmp(name,"SteadystateReltol")==0) return SteadystateReltolEnum;
+@@ -382,11 +381,11 @@
+ 	      else if (strcmp(name,"FSvelocity")==0) return FSvelocityEnum;
+ 	      else if (strcmp(name,"FSpressure")==0) return FSpressureEnum;
+ 	      else if (strcmp(name,"Constraints")==0) return ConstraintsEnum;
++	      else if (strcmp(name,"Loads")==0) return LoadsEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"Loads")==0) return LoadsEnum;
+-	      else if (strcmp(name,"Materials")==0) return MaterialsEnum;
++	      if (strcmp(name,"Materials")==0) return MaterialsEnum;
+ 	      else if (strcmp(name,"Nodes")==0) return NodesEnum;
+ 	      else if (strcmp(name,"Contours")==0) return ContoursEnum;
+ 	      else if (strcmp(name,"Parameters")==0) return ParametersEnum;
+@@ -505,11 +504,11 @@
+ 	      else if (strcmp(name,"Vx")==0) return VxEnum;
+ 	      else if (strcmp(name,"VxPicard")==0) return VxPicardEnum;
+ 	      else if (strcmp(name,"VyAverage")==0) return VyAverageEnum;
++	      else if (strcmp(name,"Vy")==0) return VyEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"Vy")==0) return VyEnum;
+-	      else if (strcmp(name,"VyPicard")==0) return VyPicardEnum;
++	      if (strcmp(name,"VyPicard")==0) return VyPicardEnum;
+ 	      else if (strcmp(name,"Vz")==0) return VzEnum;
+ 	      else if (strcmp(name,"VzSSA")==0) return VzSSAEnum;
+ 	      else if (strcmp(name,"VzHO")==0) return VzHOEnum;
+@@ -628,11 +627,11 @@
+ 	      else if (strcmp(name,"QmuMaskGroundediceLevelset")==0) return QmuMaskGroundediceLevelsetEnum;
+ 	      else if (strcmp(name,"GaussSeg")==0) return GaussSegEnum;
+ 	      else if (strcmp(name,"GaussTria")==0) return GaussTriaEnum;
++	      else if (strcmp(name,"GaussTetra")==0) return GaussTetraEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"GaussTetra")==0) return GaussTetraEnum;
+-	      else if (strcmp(name,"GaussPenta")==0) return GaussPentaEnum;
++	      if (strcmp(name,"GaussPenta")==0) return GaussPentaEnum;
+ 	      else if (strcmp(name,"FSSolver")==0) return FSSolverEnum;
+ 	      else if (strcmp(name,"Adjoint")==0) return AdjointEnum;
+ 	      else if (strcmp(name,"Colinear")==0) return ColinearEnum;
+Index: ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp	(revision 17700)
+@@ -49,7 +49,7 @@
+ 		}
+ 
+ 		/* if solving 2d problem on vertically extende mesh, solve on basal layer only*/
+-		if(domaintype!=Mesh2DhorizontalEnum){
++		if(domaintype!=Domain2DhorizontalEnum){
+ 			femmodel->parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+ 			if(
+ 					analysis_type==FreeSurfaceBaseAnalysisEnum || 
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/NodesPartitioning.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/NodesPartitioning.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/NodesPartitioning.cpp	(revision 17700)
+@@ -64,7 +64,7 @@
+ 	bool* my_nodes=xNewZeroInit<bool>(3*iomodel->numberofelements);
+ 
+ 	/*First: add all the nodes of all the elements belonging to this cpu*/
+-	if(iomodel->domaintype==Mesh2DhorizontalEnum){
++	if(iomodel->domaintype==Domain2DhorizontalEnum){
+ 		for (i=0;i<iomodel->numberofelements;i++){
+ 			if (my_elements[i]){
+ 				my_nodes[3*i+0]=true;
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp	(revision 17700)
+@@ -16,10 +16,10 @@
+ 	_assert_(iomodel->elements);
+ 
+ 	/*Check Iomodel properties*/
+-	if(iomodel->domaintype==Mesh2DhorizontalEnum || iomodel->domaintype==Mesh2DverticalEnum){
++	if(iomodel->domaintype==Domain2DhorizontalEnum || iomodel->domaintype==Domain2DverticalEnum){
+ 		/*Keep going*/
+ 	}
+-	else if(iomodel->domaintype==Mesh3DEnum){
++	else if(iomodel->domaintype==Domain3DEnum){
+ 		CreateFaces3d(iomodel);
+ 		return;
+ 	}
+@@ -242,7 +242,7 @@
+ void FaceGetVertexIndices(IoModel* iomodel,int* pnumvertices,int** pverticesid,int facenumber){/*{{{*/
+ 
+ 	int numbervertices;
+-	if(iomodel->domaintype==Mesh3DEnum){
++	if(iomodel->domaintype==Domain3DEnum){
+ 		if((iomodel->faces[6*facenumber+5])==1){
+ 			numbervertices=3;
+ 		}
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/FacesPartitioning.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/FacesPartitioning.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/FacesPartitioning.cpp	(revision 17700)
+@@ -17,13 +17,13 @@
+ 	_assert_(iomodel->elementtofaceconnectivity);
+ 
+ 	/*Mesh dependent variables*/
+-	if(iomodel->domaintype==Mesh2DhorizontalEnum){
++	if(iomodel->domaintype==Domain2DhorizontalEnum){
+ 		elementnbf = 3;
+ 	}
+-	else if(iomodel->domaintype==Mesh2DverticalEnum){
++	else if(iomodel->domaintype==Domain2DverticalEnum){
+ 		elementnbf = 3;
+ 	}
+-	else if(iomodel->domaintype==Mesh3DEnum){
++	else if(iomodel->domaintype==Domain3DEnum){
+ 		elementnbf = 5;
+ 	}
+ 	else{
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17700)
+@@ -85,7 +85,7 @@
+ 	parameters->AddObject(iomodel->CopyConstantObject(StressbalanceRestolEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(StressbalanceReltolEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(StressbalanceAbstolEnum));
+-	if(iomodel->domaintype==Mesh3DEnum)
++	if(iomodel->domaintype==Domain3DEnum)
+ 	 parameters->AddObject(iomodel->CopyConstantObject(MeshNumberoflayersEnum));
+ 
+ 	/*Surface mass balance parameters*/
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateSingleNodeToElementConnectivity.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateSingleNodeToElementConnectivity.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateSingleNodeToElementConnectivity.cpp	(revision 17700)
+@@ -30,9 +30,9 @@
+ 
+ 	/*Get element width (3 or 6)*/
+ 	switch(iomodel->domaintype){
+-		case Mesh2DhorizontalEnum: elementswidth=3; break;
+-		case Mesh2DverticalEnum  : elementswidth=3; break;
+-		case Mesh3DEnum          : elementswidth=6; break;
++		case Domain2DhorizontalEnum: elementswidth=3; break;
++		case Domain2DverticalEnum  : elementswidth=3; break;
++		case Domain3DEnum          : elementswidth=6; break;
+ 		default:  _error_("mesh type "<<EnumToStringx(iomodel->domaintype)<<" not supported yet");
+ 	}
+ 
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp	(revision 17700)
+@@ -58,9 +58,9 @@
+ 		parameters->AddObject(new IntParam(AnalysisCounterEnum,i));
+ 
+ 		/*Hack for trasient runs (FIXME: to be improved)*/
+-		if(solution_enum==TransientSolutionEnum && analysis_enum==ThermalAnalysisEnum  && iomodel->domaintype==Mesh2DhorizontalEnum) continue;
+-		if(solution_enum==TransientSolutionEnum && analysis_enum==MeltingAnalysisEnum  && iomodel->domaintype==Mesh2DhorizontalEnum) continue;
+-		if(solution_enum==TransientSolutionEnum && analysis_enum==EnthalpyAnalysisEnum && iomodel->domaintype==Mesh2DhorizontalEnum) continue;
++		if(solution_enum==TransientSolutionEnum && analysis_enum==ThermalAnalysisEnum  && iomodel->domaintype==Domain2DhorizontalEnum) continue;
++		if(solution_enum==TransientSolutionEnum && analysis_enum==MeltingAnalysisEnum  && iomodel->domaintype==Domain2DhorizontalEnum) continue;
++		if(solution_enum==TransientSolutionEnum && analysis_enum==EnthalpyAnalysisEnum && iomodel->domaintype==Domain2DhorizontalEnum) continue;
+ 		if(solution_enum==TransientSolutionEnum && analysis_enum==ThermalAnalysisEnum && isthermal==false) continue;
+ 		if(solution_enum==TransientSolutionEnum && analysis_enum==MeltingAnalysisEnum && isthermal==false) continue;
+ 		if(solution_enum==TransientSolutionEnum && analysis_enum==EnthalpyAnalysisEnum && isthermal==false) continue;
+Index: ../trunk-jpl/src/c/cores/surfaceslope_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/surfaceslope_core.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/cores/surfaceslope_core.cpp	(revision 17700)
+@@ -27,18 +27,18 @@
+ 	femmodel->parameters->SetParam(SurfaceSlopeXEnum,InputToL2ProjectEnum);
+ 	solutionsequence_linear(femmodel);
+ 
+-	if(domaintype!=Mesh2DverticalEnum){
++	if(domaintype!=Domain2DverticalEnum){
+ 		femmodel->parameters->SetParam(SurfaceSlopeYEnum,InputToL2ProjectEnum);
+ 		solutionsequence_linear(femmodel);
+ 	}
+-	if(domaintype==Mesh2DverticalEnum){
++	if(domaintype==Domain2DverticalEnum){
+ 		femmodel->parameters->SetParam(SurfaceSlopeXEnum,InputToExtrudeEnum);
+ 		extrudefrombase_core(femmodel);
+ 	}
+ 
+ 	if(save_results){
+ 		if(VerboseSolution()) _printf0_("saving results:\n");
+-		if(domaintype!=Mesh2DverticalEnum){
++		if(domaintype!=Domain2DverticalEnum){
+ 			int outputs[2] = {SurfaceSlopeXEnum,SurfaceSlopeYEnum};
+ 			femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],2);
+ 
+Index: ../trunk-jpl/src/c/cores/transient_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17700)
+@@ -65,7 +65,7 @@
+ 		if(isstressbalance){
+ 			InputDuplicatex(femmodel,QmuVxEnum,VxEnum);
+ 			InputDuplicatex(femmodel,QmuVyEnum,VyEnum);
+-			if(domaintype==Mesh3DEnum){
++			if(domaintype==Domain3DEnum){
+ 				InputDuplicatex(femmodel,QmuVzEnum,VzEnum);
+ 				if(isFS)InputDuplicatex(femmodel,QmuPressureEnum,PressureEnum);
+ 			}
+@@ -77,7 +77,7 @@
+ 			InputDuplicatex(femmodel,QmuMaskIceLevelsetEnum,MaskIceLevelsetEnum);
+ 		}
+ 		if(isgroundingline) InputDuplicatex(femmodel,QmuMaskGroundediceLevelsetEnum,MaskGroundediceLevelsetEnum);
+-		if(isthermal && domaintype==Mesh3DEnum){
++		if(isthermal && domaintype==Domain3DEnum){
+ 			//Update Vertex Position after updating Thickness and Bed
+ 			femmodel->SetCurrentConfiguration(MasstransportAnalysisEnum);
+ 			femmodel->UpdateVertexPositionsx();
+@@ -113,7 +113,7 @@
+ 		 save_results=false;
+ 		femmodel->parameters->SetParam(save_results,SaveResultsEnum);
+ 
+-		if(isthermal && domaintype==Mesh3DEnum){
++		if(isthermal && domaintype==Domain3DEnum){
+ 			if(VerboseSolution()) _printf0_("   computing thermal regime\n");
+ 			thermal_core(femmodel);
+ 		}
+Index: ../trunk-jpl/src/c/cores/masstransport_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/masstransport_core.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/cores/masstransport_core.cpp	(revision 17700)
+@@ -47,13 +47,13 @@
+ 		if(VerboseSolution()) _printf0_("   call free surface computational core\n");
+ 		femmodel->SetCurrentConfiguration(FreeSurfaceBaseAnalysisEnum);
+ 		solutionsequence_linear(femmodel);
+-		if(domaintype!=Mesh2DhorizontalEnum){
++		if(domaintype!=Domain2DhorizontalEnum){
+ 			femmodel->parameters->SetParam(BaseEnum,InputToExtrudeEnum);
+ 			extrudefrombase_core(femmodel);
+ 		}
+ 		femmodel->SetCurrentConfiguration(FreeSurfaceTopAnalysisEnum);
+ 		solutionsequence_linear(femmodel);
+-		if(domaintype!=Mesh2DhorizontalEnum){
++		if(domaintype!=Domain2DhorizontalEnum){
+ 			femmodel->parameters->SetParam(SurfaceEnum,InputToExtrudeEnum);
+ 			extrudefromtop_core(femmodel);
+ 		}
+@@ -61,7 +61,7 @@
+ 	else{
+ 		if(VerboseSolution()) _printf0_("   call computational core\n");
+ 		solutionsequence_linear(femmodel);
+-		if(domaintype==Mesh2DverticalEnum){
++		if(domaintype==Domain2DverticalEnum){
+ 			femmodel->parameters->SetParam(ThicknessEnum,InputToExtrudeEnum);
+ 			extrudefrombase_core(femmodel);
+ 			femmodel->parameters->SetParam(BaseEnum,InputToExtrudeEnum);
+Index: ../trunk-jpl/src/c/cores/stressbalance_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/stressbalance_core.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/cores/stressbalance_core.cpp	(revision 17700)
+@@ -39,12 +39,12 @@
+ 	if(dakota_analysis && solution_type==StressbalanceSolutionEnum){
+ 		InputDuplicatex(femmodel,QmuVxEnum,VxEnum);
+ 		InputDuplicatex(femmodel,QmuVyEnum,VyEnum);
+-		if(domaintype==Mesh3DEnum) InputDuplicatex(femmodel,QmuVzEnum,VzEnum);
++		if(domaintype==Domain3DEnum) InputDuplicatex(femmodel,QmuVzEnum,VzEnum);
+ 		if(isFS) InputDuplicatex(femmodel,QmuPressureEnum,PressureEnum);
+ 	}
+ 
+ 	/*Compute slopes if necessary */
+-	if(isSIA || (isFS && domaintype==Mesh2DverticalEnum)) surfaceslope_core(femmodel);
++	if(isSIA || (isFS && domaintype==Domain2DverticalEnum)) surfaceslope_core(femmodel);
+ 	if(isFS){
+ 		bedslope_core(femmodel);
+ 		femmodel->SetCurrentConfiguration(StressbalanceAnalysisEnum);
+@@ -73,7 +73,7 @@
+ 	}
+ 
+ 	/*Compute vertical velocities*/
+-	if (domaintype==Mesh3DEnum && (isSIA || isSSA || isL1L2 || isHO)){
++	if (domaintype==Domain3DEnum && (isSIA || isSSA || isL1L2 || isHO)){
+ 		analysis = new StressbalanceVerticalAnalysis();
+ 		analysis->Core(femmodel);
+ 		delete analysis;
+Index: ../trunk-jpl/src/c/cores/levelsetfunctionslope_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/levelsetfunctionslope_core.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/cores/levelsetfunctionslope_core.cpp	(revision 17700)
+@@ -27,18 +27,18 @@
+ 	femmodel->parameters->SetParam(LevelsetfunctionSlopeXEnum,InputToL2ProjectEnum);
+ 	solutionsequence_linear(femmodel);
+ 
+-	if(domaintype!=Mesh2DverticalEnum){
++	if(domaintype!=Domain2DverticalEnum){
+ 		femmodel->parameters->SetParam(LevelsetfunctionSlopeYEnum,InputToL2ProjectEnum);
+ 		solutionsequence_linear(femmodel);
+ 	}
+-	if(domaintype==Mesh2DverticalEnum){
++	if(domaintype==Domain2DverticalEnum){
+ 	      femmodel->parameters->SetParam(LevelsetfunctionSlopeXEnum,InputToExtrudeEnum);
+ 		extrudefrombase_core(femmodel);
+ 	}
+ 
+ 	if(save_results){
+ 		if(VerboseSolution()) _printf0_("saving results:\n");
+-		if(domaintype!=Mesh2DverticalEnum){
++		if(domaintype!=Domain2DverticalEnum){
+ 			int outputs[2] = {LevelsetfunctionSlopeXEnum,LevelsetfunctionSlopeYEnum};
+ 			femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],2);
+ 
+Index: ../trunk-jpl/src/c/cores/bedslope_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/bedslope_core.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/cores/bedslope_core.cpp	(revision 17700)
+@@ -27,14 +27,14 @@
+ 	femmodel->parameters->SetParam(BedSlopeXEnum,InputToL2ProjectEnum);
+ 	solutionsequence_linear(femmodel);
+ 
+-	if(domaintype!=Mesh2DverticalEnum){
++	if(domaintype!=Domain2DverticalEnum){
+ 		femmodel->parameters->SetParam(BedSlopeYEnum,InputToL2ProjectEnum);
+ 		solutionsequence_linear(femmodel);
+ 	}
+ 
+ 	if(save_results){
+ 		if(VerboseSolution()) _printf0_("   saving results\n");
+-		if(domaintype!=Mesh2DverticalEnum){
++		if(domaintype!=Domain2DverticalEnum){
+ 			int outputs[2] = {BedSlopeXEnum,BedSlopeYEnum};
+ 			femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],2);
+ 		}
+Index: ../trunk-jpl/src/c/classes/Vertex.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Vertex.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/classes/Vertex.cpp	(revision 17700)
+@@ -35,11 +35,11 @@
+ 
+ 	_assert_(iomodel->Data(BaseEnum) && iomodel->Data(ThicknessEnum) && iomodel->numbernodetoelementconnectivity);
+ 	switch(iomodel->domaintype){
+-		case Mesh3DEnum:
+-		case Mesh2DhorizontalEnum:
++		case Domain3DEnum:
++		case Domain2DhorizontalEnum:
+ 			this->sigma = (iomodel->Data(MeshZEnum)[i]-iomodel->Data(BaseEnum)[i])/(iomodel->Data(ThicknessEnum)[i]);
+ 			break;
+-		case Mesh2DverticalEnum:
++		case Domain2DverticalEnum:
+ 			this->sigma = (iomodel->Data(MeshYEnum)[i]-iomodel->Data(BaseEnum)[i])/(iomodel->Data(ThicknessEnum)[i]);
+ 			break;
+ 	}
+@@ -132,17 +132,17 @@
+ 
+ 	/*sigma remains constant. z=bed+sigma*thickness*/
+ 	switch(this->domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			/*Nothing*/
+ 			return;
+-		case Mesh2DverticalEnum:
++		case Domain2DverticalEnum:
+ 			oldy = this->y;
+ 			newy = bed[this->pid]+sigma*(surface[this->pid] - bed[this->pid]);
+ 			vely = (newy-oldy)/dt;
+ 			this->y = newy;
+ 			vy->SetValue(this->pid,vely,INS_VAL);
+ 			return;
+-		case Mesh3DEnum:
++		case Domain3DEnum:
+ 			oldz = this->z;
+ 			newz = bed[this->pid]+sigma*(surface[this->pid] - bed[this->pid]);
+ 			velz = (newz-oldz)/dt;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17700)
+@@ -103,10 +103,10 @@
+ 	int domaintype;
+ 	parameters->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			this->inputs->AddInput(new TriaInput(input_enum,values,interpolation_enum));
+ 			break;
+-		case Mesh2DverticalEnum:{
++		case Domain2DverticalEnum:{
+ 			if(interpolation_enum==P1Enum){
+ 				IssmDouble values2[NUMVERTICES]={0.};
+ 				int        numindices;
+@@ -171,7 +171,7 @@
+ 
+ 	/*Retrieve all inputs we will be needing: */
+ 	this->FindParam(&domaintype,DomainTypeEnum);
+-	if(domaintype==Mesh2DhorizontalEnum) _error_("stress tensor calculation not supported for mesh of type " <<EnumToStringx(domaintype)<<", extrude mesh or call ComputeDeviatoricStressTensor");
++	if(domaintype==Domain2DhorizontalEnum) _error_("stress tensor calculation not supported for mesh of type " <<EnumToStringx(domaintype)<<", extrude mesh or call ComputeDeviatoricStressTensor");
+ 	Input* pressure_input=inputs->GetInput(PressureEnum); _assert_(pressure_input);
+ 	Input* vx_input=inputs->GetInput(VxEnum);             _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum);             _assert_(vy_input);
+@@ -224,7 +224,7 @@
+ 
+ 	/*Retrieve all inputs we will be needing: */
+ 	this->FindParam(&domaintype,DomainTypeEnum);
+-	if(domaintype!=Mesh2DhorizontalEnum) _error_("deviatoric stress tensor calculation not implemented for mesh of type " <<EnumToStringx(domaintype));
++	if(domaintype!=Domain2DhorizontalEnum) _error_("deviatoric stress tensor calculation not implemented for mesh of type " <<EnumToStringx(domaintype));
+ 	Input* vx_input=inputs->GetInput(VxEnum);             _assert_(vx_input);
+ 	Input* vy_input=inputs->GetInput(VyEnum);             _assert_(vy_input);
+ 
+@@ -528,7 +528,7 @@
+ 	if(gl[1]==0.) gl[1]=gl[1]+epsilon;
+ 	if(gl[2]==0.) gl[2]=gl[2]+epsilon;
+ 
+-	if(domaintype==Mesh2DverticalEnum){
++	if(domaintype==Domain2DverticalEnum){
+ 		this->EdgeOnBaseIndices(&index1,&index2);
+ 		if(gl[index1]>0 && gl[index2]>0) phi=1; // All grounded
+ 		else if(gl[index1]<0 && gl[index2]<0) phi=0; // All floating
+@@ -540,7 +540,7 @@
+ 		}
+ 
+ 	}
+-	else if(domaintype==Mesh2DhorizontalEnum || domaintype==Mesh3DEnum){
++	else if(domaintype==Domain2DhorizontalEnum || domaintype==Domain3DEnum){
+ 		/*Check that not all nodes are grounded or floating*/
+ 		if(gl[0]>0 && gl[1]>0 && gl[2]>0){ // All grounded
+ 			phi=1;
+@@ -1165,9 +1165,9 @@
+ 	int domaintype;
+ 	this->parameters->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DverticalEnum:
++		case Domain2DverticalEnum:
+ 			return HasEdgeOnBase();
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			return true;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+@@ -1179,9 +1179,9 @@
+ 	int domaintype;
+ 	this->parameters->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DverticalEnum:
++		case Domain2DverticalEnum:
+ 			return HasEdgeOnSurface();
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			return true;
+ 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+ 	}
+@@ -1844,9 +1844,9 @@
+ 
+ 	this->parameters->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			return this;
+-		case Mesh2DverticalEnum:
++		case Domain2DverticalEnum:
+ 			_assert_(HasEdgeOnBase());
+ 			this->EdgeOnBaseIndices(&index1,&index2);
+ 			return SpawnSeg(index1,index2);
+@@ -1863,9 +1863,9 @@
+ 
+ 	this->parameters->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Mesh2DhorizontalEnum:
++		case Domain2DhorizontalEnum:
+ 			return this;
+-		case Mesh2DverticalEnum:
++		case Domain2DverticalEnum:
+ 			_assert_(HasEdgeOnSurface());
+ 			this->EdgeOnSurfaceIndices(&index1,&index2);
+ 			return SpawnSeg(index2,index1); //reverse order
+@@ -2220,7 +2220,7 @@
+ 	/*Return: */
+ 	int domaintype;
+ 	parameters->FindParam(&domaintype,DomainTypeEnum);
+-	if(domaintype==Mesh2DverticalEnum){
++	if(domaintype==Domain2DverticalEnum){
+ 	  return base;
+ 	}
+ 	else{
+@@ -2296,7 +2296,7 @@
+ 	this->parameters->FindParam(&domaintype,DomainTypeEnum);
+ 	Input* vx_input=NULL;
+ 	Input* vy_input=NULL;
+-	if(domaintype==Mesh2DhorizontalEnum){
++	if(domaintype==Domain2DhorizontalEnum){
+ 		vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+ 		vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+ 	}
+@@ -2363,7 +2363,7 @@
+ 	this->parameters->FindParam(&domaintype,DomainTypeEnum);
+ 	Input* vx_input=NULL;
+ 	Input* vy_input=NULL;
+-	if(domaintype==Mesh2DhorizontalEnum){
++	if(domaintype==Domain2DhorizontalEnum){
+ 		vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
+ 		vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
+ 	}
+Index: ../trunk-jpl/src/c/classes/Node.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Node.cpp	(revision 17699)
++++ ../trunk-jpl/src/c/classes/Node.cpp	(revision 17700)
+@@ -60,7 +60,7 @@
+ 		XZvectorsToCoordinateSystem(&this->coord_system[0][0],&iomodel->Data(StressbalanceReferentialEnum)[io_index*6]);
+ 		_assert_(sqrt( coord_system[0][0]*coord_system[0][0] + coord_system[1][0]*coord_system[1][0]) >1.e-4);
+ 
+-		if(iomodel->domaintype!=Mesh2DhorizontalEnum){
++		if(iomodel->domaintype!=Domain2DhorizontalEnum){
+ 			/*We have a  3d mesh, we may have collapsed elements, hence dead nodes. Freeze them out: */
+ 			_assert_(iomodel->Data(MeshVertexonbaseEnum)); 
+ 			_assert_(iomodel->Data(FlowequationVertexEquationEnum));
+@@ -100,7 +100,7 @@
+ 				analysis_enum==LevelsetAnalysisEnum ||
+ 				analysis_enum==ExtrapolationAnalysisEnum
+ 				){
+-		if(iomodel->domaintype!=Mesh2DhorizontalEnum){
++		if(iomodel->domaintype!=Domain2DhorizontalEnum){
+ 			/*On a 3d mesh, we may have collapsed elements, hence dead nodes. Freeze them out: */
+ 			_assert_(iomodel->Data(MeshVertexonbaseEnum));
+ 			if(!(reCast<bool>(iomodel->Data(MeshVertexonbaseEnum)[io_index]))){
+@@ -111,7 +111,7 @@
+ 	if(
+ 				analysis_enum==FreeSurfaceTopAnalysisEnum
+ 				){
+-		if(iomodel->domaintype!=Mesh2DhorizontalEnum){
++		if(iomodel->domaintype!=Domain2DhorizontalEnum){
+ 			/*On a 3d mesh, we may have collapsed elements, hence dead nodes. Freeze them out: */
+ 			_assert_(iomodel->Data(MeshVertexonsurfaceEnum));
+ 			if(!(reCast<bool>(iomodel->Data(MeshVertexonsurfaceEnum)[io_index]))){
+Index: ../trunk-jpl/src/wrappers/MeshPartition/MeshPartition.cpp
+===================================================================
+--- ../trunk-jpl/src/wrappers/MeshPartition/MeshPartition.cpp	(revision 17699)
++++ ../trunk-jpl/src/wrappers/MeshPartition/MeshPartition.cpp	(revision 17700)
+@@ -18,7 +18,7 @@
+ 	int i,j;
+ 
+ 	/* required input: */
+-	int  domaintype;
++	int  meshelementtype;
+ 	int  numberofelements;
+ 	int  numberofvertices;
+ 	int *elements         = NULL;
+@@ -48,19 +48,19 @@
+ 	FetchData(&numberofvertices,mxGetAssignedField(MESH,0,"numberofvertices"));
+ 	FetchData(&elements,NULL,&elements_width,mxGetAssignedField(MESH,0,"elements"));
+ 
+-	if(strcmp(mxGetClassName(MESH),"mesh3d")==0){
+-		domaintype = Mesh3DEnum;
++	if(strcmp(mxGetClassName(MESH),"mesh3dprisms")==0){
++		meshelementtype = PentaEnum;
+ 		FetchData(&numberofelements2d,mxGetAssignedField(MESH,0,"numberofelements2d"));
+ 		FetchData(&numberofvertices2d,mxGetAssignedField(MESH,0,"numberofvertices2d"));
+ 		FetchData(&elements2d,NULL,NULL,mxGetAssignedField(MESH,0,"elements2d"));
+ 		FetchData(&numberoflayers,mxGetAssignedField(MESH,0,"numberoflayers"));
+ 	}
+ 	else if(strcmp(mxGetClassName(MESH),"mesh2dhorizontal")==0){
+-		domaintype = Mesh2DhorizontalEnum;
++		meshelementtype = TriaEnum;
+ 		numberoflayers=1;
+ 	}
+ 	else if(strcmp(mxGetClassName(MESH),"mesh2dvertical")==0){
+-		domaintype = Mesh2DverticalEnum;
++		meshelementtype = TriaEnum;
+ 		numberoflayers=1;
+ 	}
+ 	else{
+@@ -70,7 +70,7 @@
+ 
+ 	/*Run partitioning algorithm based on a "clever" use of the Metis partitioner: */
+ 	MeshPartitionx(&int_element_partitioning,&int_node_partitioning,numberofelements,numberofvertices,elements,
+-		numberofelements2d,numberofvertices2d,elements2d,numberoflayers,elements_width,domaintype,numareas);
++		numberofelements2d,numberofvertices2d,elements2d,numberoflayers,elements_width,meshelementtype,numareas);
+ 
+ 	/*Post process node_partitioning and element_partitioning to be in double format. Metis needed them in int* format: */
+ 	element_partitioning=xNew<double>(numberofelements);
+Index: ../trunk-jpl/src/m/miscellaneous/vorticity.m
+===================================================================
+--- ../trunk-jpl/src/m/miscellaneous/vorticity.m	(revision 17699)
++++ ../trunk-jpl/src/m/miscellaneous/vorticity.m	(revision 17700)
+@@ -1,4 +1,4 @@
+-function rot = vorticity(vx,vy)
++function rot = vorticity(md,vx,vy)
+ %VORTICITY - calculates 2d vorticity
+ %
+ %   rot = d/dx(vy) - d/dy(vx)
+@@ -28,6 +28,6 @@
+ dvxdy=(vx(index).*beta)*summation;
+ rot=dvxdy - dvydx;
+ 
+-if md.mesh.dimension==3,
++if strcmpi(meshtype(md.mesh),'3D'),
+ 	rot=project3d(md,'vector',rot,'type','element');
+ end
+Index: ../trunk-jpl/src/m/classes/mesh3dprisms.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh3dprisms.py	(revision 17699)
++++ ../trunk-jpl/src/m/classes/mesh3dprisms.py	(revision 17700)
+@@ -138,7 +138,7 @@
+ 		return "Penta"
+ 	#}}}
+ 	def marshall(self,md,fid):    # {{{
+-		WriteData(fid,'enum',DomainTypeEnum(),'data',StringToEnum("Mesh"+self.domaintype())[0],'format','Integer');
++		WriteData(fid,'enum',DomainTypeEnum(),'data',StringToEnum("Domain"+self.domaintype())[0],'format','Integer');
+ 		WriteData(fid,'enum',DomainDimensionEnum(),'data',self.dimension(),'format','Integer');
+ 		WriteData(fid,'enum',MeshElementtypeEnum(),'data',StringToEnum(self.elementtype())[0],'format','Integer');
+ 		WriteData(fid,'object',self,'class','mesh','fieldname','x','format','DoubleMat','mattype',1)
+Index: ../trunk-jpl/src/m/classes/mesh3dprisms.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh3dprisms.m	(revision 17699)
++++ ../trunk-jpl/src/m/classes/mesh3dprisms.m	(revision 17700)
+@@ -134,7 +134,7 @@
+ 			fielddisplay(obj,'hemisphere','Indicate hemisphere ''n'' or ''s'' ');
+ 		end % }}}
+ 		function marshall(obj,md,fid) % {{{
+-			WriteData(fid,'enum',DomainTypeEnum(),'data',StringToEnum(['Mesh' domaintype(obj)]),'format','Integer');
++			WriteData(fid,'enum',DomainTypeEnum(),'data',StringToEnum(['Domain' domaintype(obj)]),'format','Integer');
+ 			WriteData(fid,'enum',DomainDimensionEnum(),'data',dimension(obj),'format','Integer');
+ 			WriteData(fid,'enum',MeshElementtypeEnum(),'data',StringToEnum(elementtype(obj)),'format','Integer');
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','x','format','DoubleMat','mattype',1);
+Index: ../trunk-jpl/src/m/classes/mesh3dtetras.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh3dtetras.m	(revision 17699)
++++ ../trunk-jpl/src/m/classes/mesh3dtetras.m	(revision 17700)
+@@ -128,7 +128,7 @@
+ 			fielddisplay(obj,'hemisphere','Indicate hemisphere ''n'' or ''s'' ');
+ 		end % }}}
+ 		function marshall(obj,md,fid) % {{{
+-			WriteData(fid,'enum',DomainTypeEnum(),'data',StringToEnum(['Mesh' domaintype(obj)]),'format','Integer');
++			WriteData(fid,'enum',DomainTypeEnum(),'data',StringToEnum(['Domain' domaintype(obj)]),'format','Integer');
+ 			WriteData(fid,'enum',DomainDimensionEnum(),'data',dimension(obj),'format','Integer');
+ 			WriteData(fid,'enum',MeshElementtypeEnum(),'data',StringToEnum(elementtype(obj)),'format','Integer');
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','x','format','DoubleMat','mattype',1);
+Index: ../trunk-jpl/src/m/classes/mesh2dvertical.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh2dvertical.m	(revision 17699)
++++ ../trunk-jpl/src/m/classes/mesh2dvertical.m	(revision 17700)
+@@ -103,7 +103,7 @@
+ 			fielddisplay(obj,'hemisphere','Indicate hemisphere ''n'' or ''s'' ');
+ 		end % }}}
+ 		function marshall(obj,md,fid) % {{{
+-			WriteData(fid,'enum',DomainTypeEnum(),'data',StringToEnum(['Mesh' domaintype(obj)]),'format','Integer');
++			WriteData(fid,'enum',DomainTypeEnum(),'data',StringToEnum(['Domain' domaintype(obj)]),'format','Integer');
+ 			WriteData(fid,'enum',DomainDimensionEnum(),'data',dimension(obj),'format','Integer');
+ 			WriteData(fid,'enum',MeshElementtypeEnum(),'data',StringToEnum(elementtype(obj)),'format','Integer');
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','x','format','DoubleMat','mattype',1);
+Index: ../trunk-jpl/src/m/classes/mesh2d.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh2d.py	(revision 17699)
++++ ../trunk-jpl/src/m/classes/mesh2d.py	(revision 17700)
+@@ -107,7 +107,7 @@
+ 		return "Tria"
+ 	#}}}
+ 	def marshall(self,md,fid):    # {{{
+-		WriteData(fid,'enum',DomainTypeEnum(),'data',StringToEnum("Mesh"+self.domaintype())[0],'format','Integer');
++		WriteData(fid,'enum',DomainTypeEnum(),'data',StringToEnum("Domain"+self.domaintype())[0],'format','Integer');
+ 		WriteData(fid,'enum',DomainDimensionEnum(),'data',self.dimension(),'format','Integer');
+ 		WriteData(fid,'enum',MeshElementtypeEnum(),'data',StringToEnum(self.elementtype())[0],'format','Integer');
+ 		WriteData(fid,'object',self,'class','mesh','fieldname','x','format','DoubleMat','mattype',1)
+Index: ../trunk-jpl/src/m/enum/Mesh3DEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/Mesh3DEnum.m	(revision 17699)
++++ ../trunk-jpl/src/m/enum/Mesh3DEnum.m	(revision 17700)
+@@ -1,11 +0,0 @@
+-function macro=Mesh3DEnum()
+-%MESH3DENUM - Enum of Mesh3D
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=Mesh3DEnum()
+-
+-macro=StringToEnum('Mesh3D');
+Index: ../trunk-jpl/src/m/enum/Mesh2DverticalEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/Mesh2DverticalEnum.m	(revision 17699)
++++ ../trunk-jpl/src/m/enum/Mesh2DverticalEnum.m	(revision 17700)
+@@ -1,11 +0,0 @@
+-function macro=Mesh2DverticalEnum()
+-%MESH2DVERTICALENUM - Enum of Mesh2Dvertical
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=Mesh2DverticalEnum()
+-
+-macro=StringToEnum('Mesh2Dvertical');
+Index: ../trunk-jpl/src/m/enum/Mesh3DtetrasEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/Mesh3DtetrasEnum.m	(revision 17699)
++++ ../trunk-jpl/src/m/enum/Mesh3DtetrasEnum.m	(revision 17700)
+@@ -1,11 +0,0 @@
+-function macro=Mesh3DtetrasEnum()
+-%MESH3DTETRASENUM - Enum of Mesh3Dtetras
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=Mesh3DtetrasEnum()
+-
+-macro=StringToEnum('Mesh3Dtetras');
+Index: ../trunk-jpl/src/m/enum/Mesh2DhorizontalEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/Mesh2DhorizontalEnum.m	(revision 17699)
++++ ../trunk-jpl/src/m/enum/Mesh2DhorizontalEnum.m	(revision 17700)
+@@ -1,11 +0,0 @@
+-function macro=Mesh2DhorizontalEnum()
+-%MESH2DHORIZONTALENUM - Enum of Mesh2Dhorizontal
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=Mesh2DhorizontalEnum()
+-
+-macro=StringToEnum('Mesh2Dhorizontal');
+Index: ../trunk-jpl/src/m/enum/Domain2DverticalEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/Domain2DverticalEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/Domain2DverticalEnum.m	(revision 17700)
+@@ -0,0 +1,11 @@
++function macro=Domain2DverticalEnum()
++%DOMAIN2DVERTICALENUM - Enum of Domain2Dvertical
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=Domain2DverticalEnum()
++
++macro=StringToEnum('Domain2Dvertical');
+Index: ../trunk-jpl/src/m/enum/Domain2DhorizontalEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/Domain2DhorizontalEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/Domain2DhorizontalEnum.m	(revision 17700)
+@@ -0,0 +1,11 @@
++function macro=Domain2DhorizontalEnum()
++%DOMAIN2DHORIZONTALENUM - Enum of Domain2Dhorizontal
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=Domain2DhorizontalEnum()
++
++macro=StringToEnum('Domain2Dhorizontal');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17699)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17700)
+@@ -210,13 +210,12 @@
+ def MeshXEnum(): return StringToEnum("MeshX")[0]
+ def MeshYEnum(): return StringToEnum("MeshY")[0]
+ def MeshZEnum(): return StringToEnum("MeshZ")[0]
++def MeshElementtypeEnum(): return StringToEnum("MeshElementtype")[0]
+ def DomainTypeEnum(): return StringToEnum("DomainType")[0]
+ def DomainDimensionEnum(): return StringToEnum("DomainDimension")[0]
+-def MeshElementtypeEnum(): return StringToEnum("MeshElementtype")[0]
+-def Mesh2DhorizontalEnum(): return StringToEnum("Mesh2Dhorizontal")[0]
+-def Mesh2DverticalEnum(): return StringToEnum("Mesh2Dvertical")[0]
+-def Mesh3DEnum(): return StringToEnum("Mesh3D")[0]
+-def Mesh3DtetrasEnum(): return StringToEnum("Mesh3Dtetras")[0]
++def Domain2DhorizontalEnum(): return StringToEnum("Domain2Dhorizontal")[0]
++def Domain2DverticalEnum(): return StringToEnum("Domain2Dvertical")[0]
++def Domain3DEnum(): return StringToEnum("Domain3D")[0]
+ def MiscellaneousNameEnum(): return StringToEnum("MiscellaneousName")[0]
+ def MasstransportHydrostaticAdjustmentEnum(): return StringToEnum("MasstransportHydrostaticAdjustment")[0]
+ def MasstransportIsfreesurfaceEnum(): return StringToEnum("MasstransportIsfreesurface")[0]
+Index: ../trunk-jpl/src/m/enum/Domain3DEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/Domain3DEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/Domain3DEnum.m	(revision 17700)
+@@ -0,0 +1,11 @@
++function macro=Domain3DEnum()
++%DOMAIN3DENUM - Enum of Domain3D
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=Domain3DEnum()
++
++macro=StringToEnum('Domain3D');
Index: issm/oecreview/Archive/16554-17801/ISSM-17700-17701.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17700-17701.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17700-17701.diff	(revision 17802)
@@ -0,0 +1,152 @@
+Index: ../trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim
+===================================================================
+--- ../trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim	(revision 17700)
++++ ../trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim	(revision 17701)
+@@ -411,13 +411,14 @@
+ "ISSM's objects begin
+ syn keyword cType BoolInput
+ syn keyword cType BoolParam
++syn keyword cType classes
+ syn keyword cType Constraint
+ syn keyword cType Constraints
+ syn keyword cType Contour
+ syn keyword cType Contours
+ syn keyword cType ControlInput
++syn keyword cType DatasetInput
+ syn keyword cType DataSetParam
+-syn keyword cType DatasetInput
+ syn keyword cType Definition
+ syn keyword cType DependentObject
+ syn keyword cType DofIndexing
+@@ -430,19 +431,20 @@
+ syn keyword cType Element
+ syn keyword cType ElementHook
+ syn keyword cType ElementMatrix
++syn keyword cType Elements
+ syn keyword cType ElementVector
+-syn keyword cType Elements
+ syn keyword cType ExponentialVariogram
+ syn keyword cType ExternalResult
+ syn keyword cType FemModel
+ syn keyword cType FileParam
+ syn keyword cType Friction
+ syn keyword cType Gauss
++syn keyword cType GaussianVariogram
++syn keyword cType gaussobjects
+ syn keyword cType GaussPenta
+ syn keyword cType GaussSeg
+ syn keyword cType GaussTetra
+ syn keyword cType GaussTria
+-syn keyword cType GaussianVariogram
+ syn keyword cType GenericExternalResult
+ syn keyword cType GenericOption
+ syn keyword cType GenericParam
+@@ -456,6 +458,7 @@
+ syn keyword cType IntParam
+ syn keyword cType IntVecParam
+ syn keyword cType IoModel
++syn keyword cType krigingobjects
+ syn keyword cType Load
+ syn keyword cType Loads
+ syn keyword cType Massfluxatgate
+@@ -463,6 +466,7 @@
+ syn keyword cType Materials
+ syn keyword cType Matice
+ syn keyword cType Matpar
++syn keyword cType matrixobjects
+ syn keyword cType MatrixParam
+ syn keyword cType Misfit
+ syn keyword cType Node
+@@ -471,8 +475,8 @@
+ syn keyword cType Observation
+ syn keyword cType Observations
+ syn keyword cType Option
++syn keyword cType Options
+ syn keyword cType OptionUtilities
+-syn keyword cType Options
+ syn keyword cType Param
+ syn keyword cType Parameters
+ syn keyword cType Pengrid
+@@ -484,12 +488,12 @@
+ syn keyword cType Profiler
+ syn keyword cType Quadtree
+ syn keyword cType Results
++syn keyword cType Riftfront
+ syn keyword cType RiftStruct
+-syn keyword cType Riftfront
+ syn keyword cType Seg
+ syn keyword cType SegInput
++syn keyword cType Segment
+ syn keyword cType SegRef
+-syn keyword cType Segment
+ syn keyword cType SpcDynamic
+ syn keyword cType SpcStatic
+ syn keyword cType SpcTransient
+@@ -509,10 +513,6 @@
+ syn keyword cType VectorParam
+ syn keyword cType Vertex
+ syn keyword cType Vertices
+-syn keyword cType classes
+-syn keyword cType gaussobjects
+-syn keyword cType krigingobjects
+-syn keyword cType matrixobjects
+ syn keyword cType AdjointBalancethicknessAnalysis
+ syn keyword cType AdjointHorizAnalysis
+ syn keyword cType Analysis
+@@ -733,7 +733,7 @@
+ syn keyword cConstant MaterialsMantleShearModulusEnum
+ syn keyword cConstant MaterialsMantleDensityEnum
+ syn keyword cConstant MeshAverageVertexConnectivityEnum
+-syn keyword cConstant MeshElementonbedEnum
++syn keyword cConstant MeshElementonbaseEnum
+ syn keyword cConstant MeshElementonsurfaceEnum
+ syn keyword cConstant MeshElements2dEnum
+ syn keyword cConstant MeshElementsEnum
+@@ -744,16 +744,17 @@
+ syn keyword cConstant MeshNumberofvertices2dEnum
+ syn keyword cConstant MeshNumberofverticesEnum
+ syn keyword cConstant MeshUpperelementsEnum
+-syn keyword cConstant MeshVertexonbedEnum
++syn keyword cConstant MeshVertexonbaseEnum
+ syn keyword cConstant MeshVertexonsurfaceEnum
+ syn keyword cConstant MeshXEnum
+ syn keyword cConstant MeshYEnum
+ syn keyword cConstant MeshZEnum
+-syn keyword cConstant MeshTypeEnum
+-syn keyword cConstant Mesh2DhorizontalEnum
+-syn keyword cConstant Mesh2DverticalEnum
+-syn keyword cConstant Mesh3DEnum
+-syn keyword cConstant Mesh3DtetrasEnum
++syn keyword cConstant MeshElementtypeEnum
++syn keyword cConstant DomainTypeEnum
++syn keyword cConstant DomainDimensionEnum
++syn keyword cConstant Domain2DhorizontalEnum
++syn keyword cConstant Domain2DverticalEnum
++syn keyword cConstant Domain3DEnum
+ syn keyword cConstant MiscellaneousNameEnum
+ syn keyword cConstant MasstransportHydrostaticAdjustmentEnum
+ syn keyword cConstant MasstransportIsfreesurfaceEnum
+@@ -815,7 +816,7 @@
+ syn keyword cConstant TransientIsmasstransportEnum
+ syn keyword cConstant TransientIsthermalEnum
+ syn keyword cConstant TransientIsgiaEnum
+-syn keyword cConstant TransientIsdamageEnum
++syn keyword cConstant TransientIsdamageevolutionEnum
+ syn keyword cConstant TransientNumRequestedOutputsEnum
+ syn keyword cConstant TransientRequestedOutputsEnum
+ syn keyword cConstant SurfaceforcingsEnum
+@@ -1134,11 +1135,13 @@
+ syn keyword cConstant AbsoluteEnum
+ syn keyword cConstant IncrementalEnum
+ syn keyword cConstant AugmentedLagrangianREnum
++syn keyword cConstant AugmentedLagrangianThetaEnum
++syn keyword cConstant NoneEnum
+ syn keyword cConstant AgressiveMigrationEnum
+-syn keyword cConstant NoneEnum
+ syn keyword cConstant SoftMigrationEnum
+ syn keyword cConstant SubelementMigrationEnum
+ syn keyword cConstant SubelementMigration2Enum
++syn keyword cConstant ContactEnum
+ syn keyword cConstant MaskGroundediceLevelsetEnum
+ syn keyword cConstant QmuMaskGroundediceLevelsetEnum
+ syn keyword cConstant GaussSegEnum
Index: issm/oecreview/Archive/16554-17801/ISSM-17701-17702.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17701-17702.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17701-17702.diff	(revision 17802)
@@ -0,0 +1,28 @@
+Index: ../trunk-jpl/test/NightlyRun/test435.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test435.m	(revision 17701)
++++ ../trunk-jpl/test/NightlyRun/test435.m	(revision 17702)
+@@ -47,8 +47,8 @@
+ 	'Bed2','Surface2','Thickness2','Floatingice2','Vx2','Vy2','Vz2','Pressure2',...
+ 	'Bed3','Surface3','Thickness3','Floatingice3','Vx3','Vy3','Vz3','Pressure3'};
+ field_tolerances={2e-11,3e-12,2e-11,1e-11,4e-10,1e-08,6e-10,1e-13,...
+-	2e-11,4.5e-12,9e-10,2e-11,1e-09,1e-08,3e-10,1e-10,...
+-	1e-10,3e-11,1e-10,7e-11,1e-09,1e-08,1e-09,2e-11};
++	2e-11,3e-11,9e-10,7e-11,1e-09,1e-08,1e-09,1e-10,...
++	1e-10,3e-11,1e-10,7e-11,1e-09,1e-08,1e-09,1e-10};
+ field_values={...
+ 	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+Index: ../trunk-jpl/test/NightlyRun/test702.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test702.m	(revision 17701)
++++ ../trunk-jpl/test/NightlyRun/test702.m	(revision 17702)
+@@ -45,7 +45,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vel','Pressure'};
+-field_tolerances={3e-09,3e-09,3e-09,1e-08};
++field_tolerances={1e-08,1e-08,1e-08,1e-08};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
Index: issm/oecreview/Archive/16554-17801/ISSM-17702-17703.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17702-17703.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17702-17703.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/classes/mesh2d.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh2d.m	(revision 17702)
++++ ../trunk-jpl/src/m/classes/mesh2d.m	(revision 17703)
+@@ -104,7 +104,7 @@
+ 			fielddisplay(obj,'hemisphere','Indicate hemisphere ''n'' or ''s'' ');
+ 		end % }}}
+ 		function marshall(obj,md,fid) % {{{
+-			WriteData(fid,'enum',DomainTypeEnum(),'data',StringToEnum(['Mesh' domaintype(obj)]),'format','Integer');
++			WriteData(fid,'enum',DomainTypeEnum(),'data',StringToEnum(['Domain' domaintype(obj)]),'format','Integer');
+ 			WriteData(fid,'enum',DomainDimensionEnum(),'data',dimension(obj),'format','Integer');
+ 			WriteData(fid,'enum',MeshElementtypeEnum(),'data',StringToEnum(elementtype(obj)),'format','Integer');
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','x','format','DoubleMat','mattype',1);
Index: issm/oecreview/Archive/16554-17801/ISSM-17703-17704.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17703-17704.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17703-17704.diff	(revision 17802)
@@ -0,0 +1,75 @@
+Index: ../trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp	(revision 17703)
++++ ../trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp	(revision 17704)
+@@ -63,15 +63,27 @@
+ 	IssmDouble*  serial_vertexgrounded = NULL;
+ 	IssmDouble*  serial_vertexfloating = NULL;
+ 	IssmDouble*  phi                   = NULL;
++	int index;
++	int* dof=NULL;
++	IssmDouble* xyz_list=NULL;
+ 
+ 	/*Initialize vector with number of vertices*/
+-	int numberofvertices=vertices->NumberOfVertices();
+-	vertexgrounded=new Vector<IssmDouble>(numberofvertices);
+-	vertexfloating=new Vector<IssmDouble>(numberofvertices);
+-	phi           =xNew<IssmDouble>(numberofvertices);
++	int numberofvertices            = vertices->NumberOfVertices();
++	vertexgrounded                  = new Vector<IssmDouble>(numberofvertices);
++	vertexfloating                  = new Vector<IssmDouble>(numberofvertices);
++	phi                             = xNew<IssmDouble>(numberofvertices);
++	IssmDouble x[numberofvertices];
++	
++	/*Get x coordinate for each vertex*/
++	for(int i = 0;i<elements->Size();i++){
++		Element* element = dynamic_cast<Element*>(elements->GetObjectByOffset(i));
++		element->GetVerticesCoordinates(&xyz_list);
++		element->GetDofList(&dof,FSvelocityEnum,GsetEnum);	
++		for (int j=0;j<3;j++)	x[dof[j]]=xyz_list[3*j];
++	}
+ 
+ 	/*Fill vector vertices_potentially_floating: */
+-	for(int i=0;i<elements->Size();i++){
++	for(int i = 0;i<elements->Size();i++){
+ 		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+ 		element->FSContactMigration(vertexgrounded,vertexfloating);
+ 	}
+@@ -79,21 +91,27 @@
+ 	/*Assemble vector and serialize */
+ 	vertexgrounded->Assemble();
+ 	vertexfloating->Assemble();
+-	serial_vertexgrounded=vertexgrounded->ToMPISerial();
+-	serial_vertexfloating=vertexfloating->ToMPISerial();
++	serial_vertexgrounded = vertexgrounded->ToMPISerial();
++	serial_vertexfloating = vertexfloating->ToMPISerial();
+ 
+-	for(int i=0;i<numberofvertices;i++){
++	/*find vertex on GL */
++	for(int i = 0;i<numberofvertices;i++){
+ 		if(serial_vertexgrounded[i]==1. && serial_vertexfloating[i]==1.){
+-			phi[i]=0.;
++			phi[i] = 0.;
++			index  = i;
+ 		}
+-		else if(serial_vertexgrounded[i]==1.){
+-			phi[i]=1.;
++	}
++
++	/*assign value for phi, grounded if >0*/
++	for(int i = 0;i<numberofvertices;i++){
++		if (x[i] < x[index]) {
++			phi[i] = 1.;
+ 		}
+-		else if(serial_vertexfloating[i]==1.){
+-			phi[i]=-1.;
++		else if (x[i] > x[index]) {
++			phi[i] = -1.;
+ 		}
+-		else{
+-			_error_("not supported (vertexfloating="<<serial_vertexfloating[i]<<" vertexgrounded="<<serial_vertexgrounded[i]<<")");
++		else if (x[i]==x[index]) {
++			phi[i] = 0;
+ 		}
+ 	}
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17704-17705.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17704-17705.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17704-17705.diff	(revision 17802)
@@ -0,0 +1,76 @@
+Index: ../trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp	(revision 17704)
++++ ../trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp	(revision 17705)
+@@ -63,27 +63,15 @@
+ 	IssmDouble*  serial_vertexgrounded = NULL;
+ 	IssmDouble*  serial_vertexfloating = NULL;
+ 	IssmDouble*  phi                   = NULL;
+-	int index;
+-	int* dof=NULL;
+-	IssmDouble* xyz_list=NULL;
+ 
+ 	/*Initialize vector with number of vertices*/
+-	int numberofvertices            = vertices->NumberOfVertices();
+-	vertexgrounded                  = new Vector<IssmDouble>(numberofvertices);
+-	vertexfloating                  = new Vector<IssmDouble>(numberofvertices);
+-	phi                             = xNew<IssmDouble>(numberofvertices);
+-	IssmDouble x[numberofvertices];
+-	
+-	/*Get x coordinate for each vertex*/
+-	for(int i = 0;i<elements->Size();i++){
+-		Element* element = dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+-		element->GetVerticesCoordinates(&xyz_list);
+-		element->GetDofList(&dof,FSvelocityEnum,GsetEnum);	
+-		for (int j=0;j<3;j++)	x[dof[j]]=xyz_list[3*j];
+-	}
++	int numberofvertices = vertices->NumberOfVertices();
++	vertexgrounded = new Vector<IssmDouble>(numberofvertices);
++	vertexfloating = new Vector<IssmDouble>(numberofvertices);
++	phi            = xNew<IssmDouble>(numberofvertices);
+ 
+ 	/*Fill vector vertices_potentially_floating: */
+-	for(int i = 0;i<elements->Size();i++){
++	for(int i=0;i<elements->Size();i++){
+ 		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+ 		element->FSContactMigration(vertexgrounded,vertexfloating);
+ 	}
+@@ -91,27 +79,22 @@
+ 	/*Assemble vector and serialize */
+ 	vertexgrounded->Assemble();
+ 	vertexfloating->Assemble();
+-	serial_vertexgrounded = vertexgrounded->ToMPISerial();
+-	serial_vertexfloating = vertexfloating->ToMPISerial();
++	serial_vertexgrounded=vertexgrounded->ToMPISerial();
++	serial_vertexfloating=vertexfloating->ToMPISerial();
+ 
+-	/*find vertex on GL */
+-	for(int i = 0;i<numberofvertices;i++){
++	/*find vertices on GL */
++	for(int i=0;i<numberofvertices;i++){
+ 		if(serial_vertexgrounded[i]==1. && serial_vertexfloating[i]==1.){
+-			phi[i] = 0.;
+-			index  = i;
++			phi[i]=0.;
+ 		}
+-	}
+-
+-	/*assign value for phi, grounded if >0*/
+-	for(int i = 0;i<numberofvertices;i++){
+-		if (x[i] < x[index]) {
+-			phi[i] = 1.;
++		else if(serial_vertexgrounded[i]==1.){
++			phi[i]=1.;
+ 		}
+-		else if (x[i] > x[index]) {
+-			phi[i] = -1.;
++		else if(serial_vertexfloating[i]==1.){
++			phi[i]=-1.;
+ 		}
+-		else if (x[i]==x[index]) {
+-			phi[i] = 0;
++		else{
++			_error_("not supported (vertexfloating="<<serial_vertexfloating[i]<<" vertexgrounded="<<serial_vertexgrounded[i]<<")");
+ 		}
+ 	}
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17705-17706.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17705-17706.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17705-17706.diff	(revision 17802)
@@ -0,0 +1,30 @@
+Index: ../trunk-jpl/src/m/plot/plot_mesh.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_mesh.py	(revision 17705)
++++ ../trunk-jpl/src/m/plot/plot_mesh.py	(revision 17706)
+@@ -1,4 +1,3 @@
+-
+ try:
+ 	import pylab as p
+ except ImportError:
+Index: ../trunk-jpl/src/m/plot/applyoptions.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/applyoptions.py	(revision 17705)
++++ ../trunk-jpl/src/m/plot/applyoptions.py	(revision 17706)
+@@ -155,13 +155,13 @@
+ 	#clim {{{
+ 	if options.exist('clim'):
+ 		lims=options.getfieldvalue('clim')
++		assert len(lims)==2, 'error, clim should be passed as a list of length 2'
+ 	elif options.exist('caxis'):
+ 		lims=options.getfieldvalue('caxis')
++		assert len(lims)==2, 'error, caxis should be passed as a list of length 2'
+ 		options.addfielddefault('clim',lims)
+ 	else:
+-		lims=[min(data.flatten()),max(data.flatten())]
+-	if len(lims)!=2:
+-		print 'WARNING: clim/caxis should be passed as a list of length 2'
++		if len(data)>0: lims=[data.min(),data.max()]
+ 	#}}}
+ 
+ 	#shading
Index: issm/oecreview/Archive/16554-17801/ISSM-17706-17707.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17706-17707.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17706-17707.diff	(revision 17802)
@@ -0,0 +1,79 @@
+Index: ../trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp	(revision 17706)
++++ ../trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp	(revision 17707)
+@@ -94,7 +94,7 @@
+ 			phi[i]=-1.;
+ 		}
+ 		else{
+-			_error_("not supported (vertexfloating="<<serial_vertexfloating[i]<<" vertexgrounded="<<serial_vertexgrounded[i]<<")");
++			phi[i]=9999.;
+ 		}
+ 	}
+ 
+Index: ../trunk-jpl/src/c/cores/transient_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17706)
++++ ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17707)
+@@ -166,6 +166,11 @@
+ 		if(isgroundingline){
+ 			if(VerboseSolution()) _printf0_("   computing new grounding line position\n");
+ 			GroundinglineMigrationx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
++
++			if(groundingline_migration==ContactEnum){
++				femmodel->parameters->SetParam(MaskGroundediceLevelsetEnum,InputToExtrudeEnum);
++				extrudefrombase_core(femmodel);
++			}
+ 			if(save_results){
+ 				int outputs[3] = {SurfaceEnum,BaseEnum,MaskGroundediceLevelsetEnum};
+ 				femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],3);
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17706)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17707)
+@@ -4367,9 +4367,34 @@
+ 	density     = rho_ice/rho_water;
+ 	oldfloating = this->IsFloating(); //figure out if element is floating before we start to change everything
+ 
+-	if(migration_style==ContactEnum){
+-		for(i=0;i<NUMVERTICES;i++) phi[i]=phi_ungrounding[vertices[i]->Pid()];
++	if(migration_style == ContactEnum){
++		for(i = 0;i < NUMVERTICES;i++) phi[i] = phi_ungrounding[vertices[i]->Pid()];
+ 		this->inputs->AddInput(new TriaInput(MaskGroundediceLevelsetEnum,&phi[0],P1Enum));
++
++		/*go through vertices, and update inputs, considering them to be TriaVertex type: */
++		for(i = 0;i < NUMVERTICES;i++){
++			/*Ice shelf: if bed below bathymetry, impose it at the bathymetry and update surface, elso do nothing */
++			if(phi[i] >= 0.){
++				if(b[i] < r[i]){
++					b[i]  = r[i];
++				}
++			}
++		}
++
++		/*Add basal melting rate if element just ungrounded*/
++		for(i=0;i<NUMVERTICES;i++){
++			if(phi[i]<0.){
++				floatingelement=true;
++				break;
++			}
++		}
++		if(!oldfloating && floatingelement==true){
++			for(i=0;i<NUMVERTICES;i++) melting[i]=gl_melting_rate/yts;
++			this->inputs->AddInput(new TriaInput(BasalforcingsMeltingRateEnum,&melting[0],P1Enum));
++		} 
++
++		/*Update inputs*/
++		this->inputs->AddInput(new TriaInput(BaseEnum,&b[0],P1Enum));
+ 		return;
+ 	}
+ 
+@@ -4437,7 +4462,7 @@
+ 		}
+ 	}
+ 
+-   /*Add basal melting rate if element just ungrounded*/
++	/*Add basal melting rate if element just ungrounded*/
+ 	if(!oldfloating && floatingelement==true){
+ 		for(i=0;i<NUMVERTICES;i++)melting[i]=gl_melting_rate/yts;
+ 		this->inputs->AddInput(new TriaInput(BasalforcingsMeltingRateEnum,&melting[0],P1Enum));
Index: issm/oecreview/Archive/16554-17801/ISSM-17707-17708.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17707-17708.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17707-17708.diff	(revision 17802)
@@ -0,0 +1,25 @@
+Index: ../trunk-jpl/src/m/plot/applyoptions.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/applyoptions.m	(revision 17707)
++++ ../trunk-jpl/src/m/plot/applyoptions.m	(revision 17708)
+@@ -59,10 +59,18 @@
+ if exist(options,'axis')
+ 	eval(['axis ' getfieldvalue(options,'axis')]);
+ else
+-	if dimension(md.mesh)==2 | exist(options,'layer'),
++	if strcmp(domaintype(md.mesh),'3D'),
++		if ~exist(options,'layer'),
++			axis auto tight
++		else
++			axis tight equal
++		end
++	elseif strcmp(domaintype(md.mesh),'2Dvertical'),
++		axis auto tight
++	elseif strcmp(domaintype(md.mesh),'2Dhorizontal'),
+ 		axis tight equal;
+ 	else
+-		axis auto tight
++		error('type of domain not supported');
+ 	end
+ end
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17708-17709.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17708-17709.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17708-17709.diff	(revision 17802)
@@ -0,0 +1,50 @@
+Index: ../trunk-jpl/src/m/interp/interp.py
+===================================================================
+--- ../trunk-jpl/src/m/interp/interp.py	(revision 17708)
++++ ../trunk-jpl/src/m/interp/interp.py	(revision 17709)
+@@ -115,22 +115,37 @@
+ 		x=x.reshape(-1,)
+ 	if npy.ndim(y)==2:
+ 		y=y.reshape(-1,)
+-	if len(x) > data.shape[1]+1:
+-		raise ValueError('x should have same length as ncols(data)+1')
+-	if len(y) > data.shape[0]+1:
+-		raise ValueError('y should have same length as nrows(data)+1')
++	if len(x) != data.shape[1]+1 and len(x) != data.shape[1]:
++		raise ValueError('x should have same length as ncols(data) or ncols(data)+1')
++	if len(y) != data.shape[0]+1 and len(y) != data.shape[0]:
++		raise ValueError('y should have same length as nrows(data) or nrows(data)+1')
+ 	
+ 	# create sub-grid that just covers the limits of xi and yi
+ 	dx=x[1]-x[0]
+ 	dy=y[1]-y[0]
+ 	xlim=[min(xi)-dx,max(xi)+dx]
+ 	ylim=[min(yi)-dy,max(yi)+dy]
+-	xind=npy.nonzero(npy.logical_and(x>xlim[0],x<xlim[1]))[0]
+-	yind=npy.nonzero(npy.logical_and(y>ylim[0],y<ylim[1]))[0]
+-	subdata=data[yind[0]:yind[-1]+1,xind[0]:xind[-1]+1]
+ 
++	# TODO create grid differently depending on whether data is defined at x,y
++	# or at the center of a grid cell with corner coordinates defined by xi,yi
+ 	# create points array and flattened data array
+-	xg,yg=npy.meshgrid(x[xind],y[yind])
++	if len(x)==data.shape[1] and len(y)==data.shape[0]:
++		print 'x,y taken to define the center of data grid cells'
++		xind=npy.nonzero(npy.logical_and(x>xlim[0],x<xlim[1]))[0]
++		yind=npy.nonzero(npy.logical_and(y>ylim[0],y<ylim[1]))[0]
++		xg,yg=npy.meshgrid(x[xind],y[yind])
++		subdata=data[yind[0]:yind[-1]+1,xind[0]:xind[-1]+1]
++	elif len(x)==data.shape[1]+1 and len(y)==data.shape[0]+1:
++		print 'x,y taken to define the corners of data grid cells'
++		xcenter=npy.fromiter(((x[i]+x[i+1])/2 for i in range(len(x)-1)),npy.float)
++		ycenter=npy.fromiter(((y[i]+y[i+1])/2 for i in range(len(y)-1)),npy.float)
++		xind=npy.nonzero(npy.logical_and(xcenter>xlim[0],xcenter<xlim[1]))[0]
++		yind=npy.nonzero(npy.logical_and(ycenter>ylim[0],ycenter<ylim[1]))[0]
++		xg,yg=npy.meshgrid(xcenter[xind],ycenter[yind])
++		subdata=data[yind[0]:yind[-1]+1,xind[0]:xind[-1]+1]
++	else:
++		raise ValueError('x and y have inconsistent sizes: both should have length ncols(data)/nrows(data) or ncols(data)+1/nrows(data)+1')
++
+ 	points=npy.array([xg.ravel(),yg.ravel()]).T
+ 	flatsubdata=subdata.ravel()
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17709-17710.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17709-17710.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17709-17710.diff	(revision 17802)
@@ -0,0 +1,24 @@
+Index: ../trunk-jpl/src/m/interp/interp.py
+===================================================================
+--- ../trunk-jpl/src/m/interp/interp.py	(revision 17709)
++++ ../trunk-jpl/src/m/interp/interp.py	(revision 17710)
+@@ -59,8 +59,7 @@
+ 	mask=npy.isnan(subdata)
+ 	ind=npy.nonzero(mask)[0]
+ 	if len(ind) and fill_nans:
+-		print "WARNING: filling nans using spline fit through good data points,\
+-				which may or may not be appropriate. Check results carefully."
++		print "WARNING: filling nans using spline fit through good data points, which may or may not be appropriate. Check results carefully."
+ 	subdata=npy.delete(subdata,ind)
+ 	points=npy.delete(points,ind,axis=0)
+ 
+@@ -158,8 +157,7 @@
+ 	mask=npy.isnan(flatsubdata)
+ 	ind=npy.nonzero(mask)[0]
+ 	if len(ind) and fill_nans:
+-		print "WARNING: filling nans using spline fit through good data points,\
+-				which may or may not be appropriate. Check results carefully."
++		print "WARNING: filling nans using spline fit through good data points, which may or may not be appropriate. Check results carefully."
+ 	goodsubdata=npy.delete(flatsubdata,ind)
+ 	goodpoints=npy.delete(points,ind,axis=0)
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17710-17711.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17710-17711.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17710-17711.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/m/interp/interp.py
+===================================================================
+--- ../trunk-jpl/src/m/interp/interp.py	(revision 17710)
++++ ../trunk-jpl/src/m/interp/interp.py	(revision 17711)
+@@ -43,6 +43,7 @@
+ 	assert len(kwargs)==0, 'error, unexpected or misspelled kwargs'
+ 
+ 	# create sub-vectors that just cover the limits of xi and yi
++	# TODO x,y not necessarily a grid, so need a better definition of dx,dy (e.g. average element size)
+ 	dx=x[1]-x[0]
+ 	dy=y[1]-y[0]
+ 	xlim=[min(xi)-dx,max(xi)+dx]
Index: issm/oecreview/Archive/16554-17801/ISSM-17711-17712.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17711-17712.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17711-17712.diff	(revision 17802)
@@ -0,0 +1,36 @@
+Index: ../trunk-jpl/src/m/coordsystems/ll2xy.py
+===================================================================
+--- ../trunk-jpl/src/m/coordsystems/ll2xy.py	(revision 17711)
++++ ../trunk-jpl/src/m/coordsystems/ll2xy.py	(revision 17712)
+@@ -22,11 +22,11 @@
+ 	if sgn == 1:
+ 		delta = 45
+ 		slat = 70
+-		print 'Info: creating coordinates in polar stereographic (Std Latitude: 70N Meridian: 45)'
++		print '		ll2xy: creating coordinates in north polar stereographic (Std Latitude: 70N Meridian: 45)'
+ 	else: 
+ 		delta = central_meridian
+ 		slat = standard_parallel
+-		print 'Info: creating coordinates in polar stereographic (Std Latitude: 71S Meridian: 0)'
++		print '		ll2xy: creating coordinates in south polar stereographic (Std Latitude: 71S Meridian: 0)'
+ 	
+ 	# Conversion constant from degrees to radians
+ 	cde = 57.29577951
+Index: ../trunk-jpl/src/m/coordsystems/xy2ll.py
+===================================================================
+--- ../trunk-jpl/src/m/coordsystems/xy2ll.py	(revision 17711)
++++ ../trunk-jpl/src/m/coordsystems/xy2ll.py	(revision 17712)
+@@ -26,11 +26,11 @@
+ 		if sgn == 1:
+ 			delta = 45. 
+ 			slat = 70.
+-			print 'Warning: expecting coordinates in polar stereographic (Std Latitude: 70degN Meridian: 45deg)'
++			print '		xy2ll: creating coordinates in north polar stereographic (Std Latitude: 70degN Meridian: 45deg)'
+ 		elif sgn == -1:
+ 			delta = 0.  
+ 			slat = 71.
+-			print 'Warning: expecting coordinates in polar stereographic (Std Latitude: 71degS Meridian: 0deg)'
++			print '		xy2ll: creating coordinates in south polar stereographic (Std Latitude: 71degS Meridian: 0deg)'
+ 		else:
+ 			raise ValueError('sgn should be either +1 or -1')
+ 	else:
Index: issm/oecreview/Archive/16554-17801/ISSM-17712-17713.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17712-17713.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17712-17713.diff	(revision 17802)
@@ -0,0 +1,38 @@
+Index: ../trunk-jpl/src/m/interp/interp.py
+===================================================================
+--- ../trunk-jpl/src/m/interp/interp.py	(revision 17712)
++++ ../trunk-jpl/src/m/interp/interp.py	(revision 17713)
+@@ -60,7 +60,7 @@
+ 	mask=npy.isnan(subdata)
+ 	ind=npy.nonzero(mask)[0]
+ 	if len(ind) and fill_nans:
+-		print "WARNING: filling nans using spline fit through good data points, which may or may not be appropriate. Check results carefully."
++		print "		WARNING: filling nans using spline fit through good data points, which may or may not be appropriate. Check results carefully."
+ 	subdata=npy.delete(subdata,ind)
+ 	points=npy.delete(points,ind,axis=0)
+ 
+@@ -130,13 +130,13 @@
+ 	# or at the center of a grid cell with corner coordinates defined by xi,yi
+ 	# create points array and flattened data array
+ 	if len(x)==data.shape[1] and len(y)==data.shape[0]:
+-		print 'x,y taken to define the center of data grid cells'
++		print '		x,y taken to define the center of data grid cells'
+ 		xind=npy.nonzero(npy.logical_and(x>xlim[0],x<xlim[1]))[0]
+ 		yind=npy.nonzero(npy.logical_and(y>ylim[0],y<ylim[1]))[0]
+ 		xg,yg=npy.meshgrid(x[xind],y[yind])
+ 		subdata=data[yind[0]:yind[-1]+1,xind[0]:xind[-1]+1]
+ 	elif len(x)==data.shape[1]+1 and len(y)==data.shape[0]+1:
+-		print 'x,y taken to define the corners of data grid cells'
++		print '		x,y taken to define the corners of data grid cells'
+ 		xcenter=npy.fromiter(((x[i]+x[i+1])/2 for i in range(len(x)-1)),npy.float)
+ 		ycenter=npy.fromiter(((y[i]+y[i+1])/2 for i in range(len(y)-1)),npy.float)
+ 		xind=npy.nonzero(npy.logical_and(xcenter>xlim[0],xcenter<xlim[1]))[0]
+@@ -158,7 +158,7 @@
+ 	mask=npy.isnan(flatsubdata)
+ 	ind=npy.nonzero(mask)[0]
+ 	if len(ind) and fill_nans:
+-		print "WARNING: filling nans using spline fit through good data points, which may or may not be appropriate. Check results carefully."
++		print "		WARNING: filling nans using spline fit through good data points, which may or may not be appropriate. Check results carefully."
+ 	goodsubdata=npy.delete(flatsubdata,ind)
+ 	goodpoints=npy.delete(points,ind,axis=0)
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17713-17714.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17713-17714.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17713-17714.diff	(revision 17802)
@@ -0,0 +1,53 @@
+Index: ../trunk-jpl/src/m/classes/model.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.py	(revision 17713)
++++ ../trunk-jpl/src/m/classes/model.py	(revision 17714)
+@@ -186,15 +186,15 @@
+ 		   md must be followed by the corresponding exp file or flags list
+ 		   It can either be a domain file (argus type, .exp extension), or an array of element flags. 
+ 		   If user wants every element outside the domain to be 
+-		   extract2d, add '~' to the name of the domain file (ex: '~HO.exp');
++		   extract2d, add '~' to the name of the domain file (ex: '~HO.exp')
+ 		   an empty string '' will be considered as an empty domain
+ 		   a string 'all' will be considered as the entire domain
+ 
+ 		   Usage:
+-		      md2=extract(md,area);
++		      md2=extract(md,area)
+ 
+ 		   Examples:
+-		      md2=extract(md,'Domain.exp');
++		      md2=extract(md,'Domain.exp')
+ 
+ 		   See also: EXTRUDE, COLLAPSE
+ 		"""
+@@ -453,14 +453,14 @@
+  
+ 
+ 		   Usage:
+-		      md=extrude(md,numlayers,extrusionexponent);
+-		      md=extrude(md,numlayers,lowerexponent,upperexponent);
+-		      md=extrude(md,listofcoefficients);
++		      md=extrude(md,numlayers,extrusionexponent)
++		      md=extrude(md,numlayers,lowerexponent,upperexponent)
++		      md=extrude(md,listofcoefficients)
+ 
+ 		   Example:
+-		      md=extrude(md,8,3);
+-		      md=extrude(md,8,3,2);
+-		      md=extrude(md,[0 0.2 0.5 0.7 0.9 0.95 1]);
++		      md=extrude(md,8,3)
++		      md=extrude(md,8,3,2)
++		      md=extrude(md,[0 0.2 0.5 0.7 0.9 0.95 1])
+ 
+ 		   See also: MODELEXTRACT, COLLAPSE
+ 		"""
+@@ -679,7 +679,7 @@
+ 		md.mask.ice_levelset=project3d(md,'vector',md.mask.ice_levelset,'type','node')
+ 		md.mask.groundedice_levelset=project3d(md,'vector',md.mask.groundedice_levelset,'type','node')
+ 		if not numpy.any(numpy.isnan(md.inversion.cost_functions_coefficients)):
+-			md.inversion.cost_functions_coefficients=project3d(md,'vector',md.inversion.cost_functions_coefficients,'type','node');end;
++			md.inversion.cost_functions_coefficients=project3d(md,'vector',md.inversion.cost_functions_coefficients,'type','node')
+ 		if not numpy.any(numpy.isnan(md.inversion.min_parameters)):
+ 			md.inversion.min_parameters=project3d(md,'vector',md.inversion.min_parameters,'type','node')
+ 		if not numpy.any(numpy.isnan(md.inversion.max_parameters)):
Index: issm/oecreview/Archive/16554-17801/ISSM-17714-17715.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17714-17715.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17714-17715.diff	(revision 17802)
@@ -0,0 +1,46 @@
+Index: ../trunk-jpl/src/m/mech/robintemperature.py
+===================================================================
+--- ../trunk-jpl/src/m/mech/robintemperature.py	(revision 0)
++++ ../trunk-jpl/src/m/mech/robintemperature.py	(revision 17715)
+@@ -0,0 +1,41 @@
++import numpy as npy
++from scipy.special import erf
++
++def robintemperature(heatflux,accumrate,thickness,surftemp,z):
++	'''
++	Compute vertical temperature profile of an ice sheet (Robin, 1955)
++
++	This routine computes the vertical temperature profile of an ice sheet
++	according to the solution of Robin (1955), neglecting friction and
++	horizontal advection.  The solution is thus most appropriate at an ice
++	divide.
++
++	The coordinate system for the solution runs from z=0 at the base 
++	to z=H at the surface of the ice.
++
++	Parameters (SI units):
++		-heatflux	Geothermal heat flux (W m^-2)
++		-accumrate	Surface accumulation rate (m s^-1 ice equivalent)
++		-thickness	Ice thickness (m)
++		-surftemp	Surface temperature (K)
++		-z				Vertical position at which to calculate temperature
++						(z can be a scalar or a vector)
++
++	Returns a vector the same length as z containing the temperature in K
++
++	Usage:
++		tprofile=robintemperature(heatflux,accumrate,thickness,surftemp,z)
++	'''
++
++	# some constants (from Holland and Jenkins, 1999)
++	alphaT=1.14e-6 # thermal diffusivity (m^2 s^-1)
++	c=2009. # specific heat capacity (J kg^-1 K^-1)
++	rho=917.  # ice density (kg m^-3)
++	
++	#create vertical coordinate variable
++	zstar=npy.sqrt(2.*alphaT*thickness/accumrate)
++	
++	tprofile=surftemp+npy.sqrt(2.*thickness*npy.pi/accumrate/alphaT)*(-heatflux)/2./rho/c*(erf(z/zstar)-erf(thickness/zstar))
++	
++	# difference between surface and base temperature for check (Cuffey2010 p412):
++	# print tprofile-surftemp
Index: issm/oecreview/Archive/16554-17801/ISSM-17715-17716.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17715-17716.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17715-17716.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/plot/plot_unit.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_unit.py	(revision 17715)
++++ ../trunk-jpl/src/m/plot/plot_unit.py	(revision 17716)
+@@ -19,7 +19,7 @@
+ 	edgecolor=options.getfieldvalue('edgecolor','None')
+ 	
+ 	#number of colorlevels for plots
+-	colorlevels=options.getfieldvalue('colorlevels',256)
++	colorlevels=options.getfieldvalue('colorlevels',128)
+ 	
+ 	alpha=options.getfieldvalue('alpha',1)
+ 	
Index: issm/oecreview/Archive/16554-17801/ISSM-17716-17717.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17716-17717.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17716-17717.diff	(revision 17802)
@@ -0,0 +1,33 @@
+Index: ../trunk-jpl/src/m/plot/plot_vertexnumbering.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_vertexnumbering.m	(revision 17716)
++++ ../trunk-jpl/src/m/plot/plot_vertexnumbering.m	(revision 17717)
+@@ -27,13 +27,21 @@
+ 	text(x(pos),y(pos),z(pos),num2str(pos(:)),...
+ 		'backgroundcolor',[1 0 0],'HorizontalAlignment','center','VerticalAlignment','middle');
+ else
+-	%plot mesh 
+-	A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6);
+-	patch( 'Faces', [A B C],  'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
+-	patch( 'Faces', [D E F],  'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
+-	patch( 'Faces', [A B E D],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
+-	patch( 'Faces', [B E F C],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
+-	patch( 'Faces', [C A D F],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
++	if size(elements,2)==6, %prisms
++		%plot mesh 
++		A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6);
++		patch( 'Faces', [A B C],  'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
++		patch( 'Faces', [D E F],  'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
++		patch( 'Faces', [A B E D],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
++		patch( 'Faces', [B E F C],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
++		patch( 'Faces', [C A D F],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
++	elseif size(elements,2)==4, %tetras
++		A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4);
++		patch( 'Faces',[A B C],'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none','EdgeColor','black');
++		patch( 'Faces',[A B D],'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none','EdgeColor','black');
++		patch( 'Faces',[B C D],'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none','EdgeColor','black');
++		patch( 'Faces',[C A D],'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none','EdgeColor','black');
++	end
+ 
+ 	%numbering
+ 	text(x,y,z,num2str(vertexnumbers),...
Index: issm/oecreview/Archive/16554-17801/ISSM-17717-17718.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17717-17718.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17717-17718.diff	(revision 17802)
@@ -0,0 +1,106 @@
+Index: ../trunk-jpl/src/m/plot/plot_manager.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_manager.m	(revision 17717)
++++ ../trunk-jpl/src/m/plot/plot_manager.m	(revision 17718)
+@@ -111,6 +111,9 @@
+ 		case 'sarpwr',
+ 			plot_sarpwr(md,options,subplotwidth,i)
+ 			return
++		case 'time_dependant' ,
++			plot_vstime(md,options,nlines,ncols,i)
++			return
+ 		case 'icefront'
+ 			plot_icefront(md,options,subplotwidth,i,data)
+ 			return
+Index: ../trunk-jpl/src/m/plot/plot_profile.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_profile.m	(revision 17717)
++++ ../trunk-jpl/src/m/plot/plot_profile.m	(revision 17718)
+@@ -30,7 +30,7 @@
+ 	%Process data
+ 	[datai datatype]=processdata(md,data(:,i),options);
+ 
+-	%resolution
++	%resolution[z,data_interp]=ProfileValues(md,datai,xprof,yprof,resolution);
+ 	if exist(options,'resolution'),
+ 		resolution=getfieldvalue(options,'resolution');
+ 	else %Default resolution
+Index: ../trunk-jpl/src/m/plot/plot_vstime.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_vstime.m	(revision 0)
++++ ../trunk-jpl/src/m/plot/plot_vstime.m	(revision 17718)
+@@ -0,0 +1,55 @@
++function plot_vstime(md,options,nlines,ncols,i)
++
++%plot mesh
++subplot(nlines,ncols,i); 
++
++%getting the variable structure
++datastruct  = getfieldvalue(options,'Input');
++structnames = strsplit(datastruct,'.');
++
++%getting the position of the to be ploted point
++location=getfieldvalue(options,'position');
++if ~isnumeric(location) | numel(location)~=2,
++	error('location provided not supported (should be [x y])');
++end
++xpoint=location(1);
++ypoint=location(2);
++
++%gathering a few time related parameters
++FirstTime=md.timestepping.start_time;
++LastTime=md.timestepping.final_time;
++Dt=md.timestepping.time_step;
++OutputDt=md.settings.output_frequency*Dt;
++%Constructiion of the result structure(one step above variable in
++%the structure tree)
++solstruct = md;
++for i=2:numel(structnames)-1,
++	solstruct=solstruct.(char(structnames(i)));
++end
++
++timesteps   = numel(solstruct);
++%now build a table with the variable needed in the end plot
++Value(1:timesteps)=NaN*ones(timesteps,1);
++time(1:timesteps)=NaN*ones(timesteps,1);
++
++for t=1:timesteps,
++	
++	data=solstruct(t).(char(structnames(numel(structnames))));
++
++	[TimeData datatype]=processdata(md,data,options);
++	clear data
++	Value(t)=PointValues(md,TimeData,xpoint,ypoint);
++	time(t)=FirstTime+(t-1)*OutputDt+Dt;
++end
++
++plot(time,Value);
++clear Value time
++
++options=addfielddefault(options,'title',md.miscellaneous.name);
++options=addfielddefault(options,'ylabel',char(structnames(numel(structnames))));
++options=addfielddefault(options,'xlabel','Time');
++options=addfielddefault(options,'colorbar',0);
++options=addfielddefault(options,'axis','auto');
++options=addfielddefault(options,'xlim',[FirstTime LastTime]);
++options=addfielddefault(options,'view',2);
++applyoptions(md,[],options);
+Index: ../trunk-jpl/src/m/interp/PointValues.m
+===================================================================
+--- ../trunk-jpl/src/m/interp/PointValues.m	(revision 0)
++++ ../trunk-jpl/src/m/interp/PointValues.m	(revision 17718)
+@@ -0,0 +1,14 @@
++function [data_interp]=PointValues(md,data,xpoint,ypoint)
++%POINTVALUES - compute the value of a field on a single point
++%
++%   This routine gets the value of a given field of the model on points
++%
++%   Usage:
++%      [z,data]=PointValues(md,data,X,Y,Z)
++
++%Get bed and surface for each 2d point, offset to make sure that it is inside the glacier system
++%offset=10^-3;
++%bed=InterpFromMeshToMesh2d(md.mesh.elements2d,md.mesh.x2d,md.mesh.y2d,project2d(md,md.geometry.bed,1),xpoint,ypoint)+offset;
++%surface=InterpFromMeshToMesh2d(md.mesh.elements2d,md.mesh.x2d,md.mesh.y2d,project2d(md,md.geometry.surface,1),xpoint,ypoint)-offset;
++
++data_interp=InterpFromMeshToMesh2d(md.mesh.elements,md.mesh.x,md.mesh.y,data,xpoint,ypoint);
Index: issm/oecreview/Archive/16554-17801/ISSM-17718-17719.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17718-17719.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17718-17719.diff	(revision 17802)
@@ -0,0 +1,156 @@
+Index: ../trunk-jpl/src/m/contrib/dassflow/importgmsh.m
+===================================================================
+--- ../trunk-jpl/src/m/contrib/dassflow/importgmsh.m	(revision 17718)
++++ ../trunk-jpl/src/m/contrib/dassflow/importgmsh.m	(revision 17719)
+@@ -1,4 +1,4 @@
+-function md = importgmsh(filename)
++function md = importgmsh(filename,dim)
+ 
+ %some checks
+ if ~exist(filename),
+@@ -29,6 +29,8 @@
+ A=fscanf(fid,'%i %f %f %f',[4 nbv]);
+ x = A(2,:)';
+ y = A(3,:)';
++z = A(4,:)';
++
+ A=fscanf(fid,'%s',1);
+ if ~strcmp(A,'$EndNodes'), 
+ 	error(['Expecting $EndNodes (' A ')']);
+@@ -42,49 +44,107 @@
+ nbt=fscanf(fid,'%i',1);
+ disp(['Number of elements: ' num2str(nbt) ]);
+ counter = 0;
+-index   = zeros(0,3);
+-segments       = zeros(0,2);
+-segmentmarkers = zeros(0,1);
++if (dim==2),
++	index   = zeros(0,3);
++	segments       = zeros(0,2);
++	segmentmarkers = zeros(0,1);
++elseif (dim==3),
++	index   = zeros(0,4);
++	segments       = zeros(0,3);
++	segmentmarkers = zeros(0,1);
++else
++	error('not supported');
++end
++
+ while(counter<nbt);
+ 	id = fscanf(fid,'%i',1);
+ 	ty = fscanf(fid,'%i',1);
+-	if(ty>2) error('Type not supported'); end
+ 	nbf = fscanf(fid,'%i',1);
+ 	flags = fscanf(fid,'%i',nbf);
+ 
+-	if ty==1,
+-		A=fscanf(fid,'%i %i',2);
+-		segments(end+1,:)=A;
+-		if(flags(1)==5 & flags(2)==3), segmentmarkers(end+1)=3; 
+-		elseif(flags(1)==1 & flags(2)==4), segmentmarkers(end+1)=4;
+-		elseif(flags(1)==2 & flags(2)==1), segmentmarkers(end+1)=1;
+-		elseif(flags(1)==4 & flags(2)==2), segmentmarkers(end+1)=2;
+-		else error(['flags ' num2str(flags') ' not supported']);
+-		end
+-	else
+-		A=fscanf(fid,'%i %i %i',3);
+-		index(end+1,:)=A;
++	switch(ty)
++		case 1, %segments
++			A=fscanf(fid,'%i %i',2);
++			if (dim==2),  %Actual element
++				segments(end+1,:)=A;
++				if    (flags(1)==5 & flags(2)==3), segmentmarkers(end+1)=3; 
++				elseif(flags(1)==1 & flags(2)==4), segmentmarkers(end+1)=4;
++				elseif(flags(1)==2 & flags(2)==1), segmentmarkers(end+1)=1;
++				elseif(flags(1)==4 & flags(2)==2), segmentmarkers(end+1)=2;
++				else error(['flags ' num2str(flags') ' not supported']);
++				end
++			else
++				error('not supported');
++			end
++		case 2, %tria
++			A=fscanf(fid,'%i %i %i',3);
++			if (dim==2), %Actual element
++				index(end+1,:)=A;
++			else         %Boundary element
++				segments(end+1,:)=A;
++				if    (flags(1)==3), segmentmarkers(end+1)=3; 
++				elseif(flags(1)==4), segmentmarkers(end+1)=4;
++				elseif(flags(1)==1), segmentmarkers(end+1)=1;
++				elseif(flags(1)==2), segmentmarkers(end+1)=2;
++				elseif(flags(1)==5), segmentmarkers(end+1)=5;
++				elseif(flags(1)==6), segmentmarkers(end+1)=6;
++				else error(['flags ' num2str(flags') ' not supported']);
++				end
++			end
++		case 4, %tetra
++			A=fscanf(fid,'%i %i %i %i',4);
++			if (dim==3), %Actual element
++				index(end+1,:)=A;
++			else
++				error('not supported');
++			end
++		otherwise,
++			error(['Type ' num2str(ty) ' not supported']);
+ 	end
+ 	counter = counter + 1;
+ end
+ 
+ %recreate segments
+-nbs = size(segments,1);
+-segments = [segments zeros(nbs,1)];
+-for i=1:nbs,
+-	E = find(sum(ismember(index,segments(i,:)),2)>1);
+-	segments(i,3)=E;
++if dim==2,
++	nbs = size(segments,1);
++	segments = [segments zeros(nbs,1)];
++	for i=1:nbs,
++		E = find(sum(ismember(index,segments(i,:)),2)>1);
++		segments(i,3)=E;
++	end
++else
++	nbs = size(segments,1);
++	segments = [segments zeros(nbs,1)];
++	for i=1:nbs,
++		E = find(sum(ismember(index,segments(i,:)),2)>2);
++		segments(i,4)=E;
++	end
+ end
+ 
+ %close file
+ fclose(fid);
+ 
+ %Create model
+-md=meshconvert(model,index,x,y);
+-md.mesh=mesh2dvertical(md.mesh);
+-md.mesh.segmentmarkers=segmentmarkers;
+-md.mesh.segments=segments;
+-md.mesh.vertexonbase=zeros(md.mesh.numberofvertices,1);
+-md.mesh.vertexonbase(find(vertexflags(md.mesh,1)))=1;
+-md.mesh.vertexonsurface=zeros(md.mesh.numberofvertices,1);
+-md.mesh.vertexonsurface(find(vertexflags(md.mesh,3)))=1;
++if 0, %2d triangles
++	md=meshconvert(model,index,x,y);
++	md.mesh=mesh2dvertical(md.mesh);
++	md.mesh.segmentmarkers=segmentmarkers;
++	md.mesh.segments=segments;
++	md.mesh.vertexonbase=zeros(md.mesh.numberofvertices,1);
++	md.mesh.vertexonbase(find(vertexflags(md.mesh,1)))=1;
++	md.mesh.vertexonsurface=zeros(md.mesh.numberofvertices,1);
++	md.mesh.vertexonsurface(find(vertexflags(md.mesh,3)))=1;
++else
++	md=model();
++	md.mesh=mesh3dprisms();
++	md.mesh.x = x;
++	md.mesh.y = y;
++	md.mesh.z = z;
++	md.mesh.elements = index;
++	md.mesh.numberofelements=size(md.mesh.elements,1);
++	md.mesh.numberofvertices=length(md.mesh.x);
++	md.mesh.vertexonbase=zeros(md.mesh.numberofvertices,1);
++	md.mesh.vertexonbase(find(segments(find(segmentmarkers==1),1:3)))=1;
++	md.mesh.vertexonsurface=zeros(md.mesh.numberofvertices,1);
++	md.mesh.vertexonsurface(find(segments(find(segmentmarkers==3),1:3)))=1;
++end
Index: issm/oecreview/Archive/16554-17801/ISSM-17719-17720.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17719-17720.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17719-17720.diff	(revision 17802)
@@ -0,0 +1,977 @@
+Index: ../trunk-jpl/src/m/classes/initialization.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/initialization.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/initialization.m	(revision 17720)
+@@ -18,6 +18,23 @@
+ 		watercolumn   = NaN;
+ 	end
+ 	methods
++        function createxml(obj,fid) % {{{
++            fprintf(fid, '\n\n');
++            fprintf(fid, '%s\n', '<!-- initialization -->');
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Initial field values">','<section name="initialization" />');                    
++            
++			 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="vx" type="',class(obj.vx),'" default="',obj.vx,'">','     <section name="initialization" />','     <help> x component of velocity [m/yr] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="vy" type="',class(obj.vy),'" default="',obj.vy,'">','     <section name="initialization" />','     <help> y component of velocity [m/yr] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="vz" type="',class(obj.vz),'" default="',obj.vz,'">','     <section name="initialization" />','     <help> z component of velocity [m/yr] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="vel" type="',class(obj.vel),'" default="',obj.vel,'">','     <section name="initialization" />','     <help> velocity norm [m/yr] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="pressure" type="',class(obj.pressure),'" default="',obj.pressure,'">','     <section name="initialization" />','     <help> pressure field [Pa] </help>','</parameter>');
++        	 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="temperature" type="',class(obj.temperature),'" default="',obj.temperature,'">','     <section name="initialization" />','     <help> fraction of water in the ice </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="waterfraction" type="',class(obj.waterfraction),'" default="',obj.waterfraction,'">','     <section name="initialization" />','     <help> ice thickness [m] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="sediment_head" type="',class(obj.sediment_head),'" default="',obj.sediment_head,'">','     <section name="initialization" />','     <help> sediment water head of subglacial system [m] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="epl_head" type="',class(obj.epl_head),'" default="',obj.epl_head,'">','     <section name="initialization" />','     <help> epl water head of subglacial system [m] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','<parameter key ="watercolumn" type="',class(obj.watercolumn),'" default="',obj.watercolumn,'">','     <section name="initialization" />','     <help> thickness of subglacial water [m] </help>','</parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');
++        end % }}}
+ 		function obj = initialization(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/flaim.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/flaim.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/flaim.m	(revision 17720)
+@@ -20,6 +20,39 @@
+ 		opt_niter          = 30000
+ 	end
+ 	methods
++  	 	function createxml(obj,fid) % {{{
++            fprintf(fid, '<!-- flaim -->\n');            
++                    
++            % Input
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Input:">','<section name="flaim" />');                    
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="targets" type="',class(obj.targets),'" default="',convert2str(obj.targets),'">','     <section name="flaim" />','     <help> name of kml output targets file </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="tracks" type="',class(obj.tracks),'" default="',convert2str(obj.tracks),'">','     <section name="flaim" />','     <help> name of kml input tracks file </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="flightreqs" type="',class(obj.flightreqs),'" default="',convert2str(obj.flightreqs),'">','     <section name="flaim" />','     <help> structure of kml flight requirements (not used yet) </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="criterion" type="',class(obj.criterion),'" default="',convert2str(obj.criterion),'">','     <section name="flaim" />','     <help> element or nodal criterion for flight path evaluation (metric) </help>','  </parameter>');
++        	fprintf(fid,'%s\n%s\n','</frame>');    
++            
++            % Arguments
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="2" label="Arguments:">','<section name="flaim" />');                    
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="gridsatequator" type="',class(obj.gridsatequator),'" default="',convert2str(obj.gridsatequator),'">','     <section name="flaim" />','     <help> number of grids at equator (determines resolution) </help>','  </parameter>');
++            fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n%s\n','  <parameter key ="usevalueordering" type="',class(obj.usevalueordering),'" optional="false">','     <section name="flaim" />','         <option value="',convert2str(obj.usevalueordering),'" type="string" default="true"></option>','     <help> flag to consider target values for flight path evaluation </help>','  </parameter>');
++            fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n%s\n','  <parameter key ="split_antimeridian" type="',class(obj.split_antimeridian),'" optional="false">','     <section name="flaim" />','         <option value="',convert2str(obj.split_antimeridian),'" type="string" default="true"></option>','     <help> flag to split polygons on the antimeridian </help>','  </parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');   
++            
++            % Optimization
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="3" label="Optimization:">','<section name="flaim" />');                    
++            fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n%s\n','  <parameter key ="path_optimize" type="',class(obj.path_optimize),'" optional="false">','     <section name="flaim" />','         <option value="',convert2str(obj.path_optimize),'" type="string" default="true"></option>','     <help> optimize? (default false) </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="opt_ndir" type="',class(obj.opt_ndir),'" default="',convert2str(obj.opt_ndir),'">','     <section name="flaim" />','     <help> number of directions to test when moving a point.  If this value = 1, a random direction is tested. A value > 1 results in directions equally spaced from [0, 2*PI] being tested. For example, 4 would result in directions [0, PI/2, PI, 3PI/2] </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="opt_dist" type="',class(obj.opt_dist),'" default="',convert2str(obj.opt_dist),'">','     <section name="flaim" />','     <help> specifies the distance in km (default 25) to move a randomly selected path point on each iteration </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="opt_niter" type="',class(obj.opt_niter),'" default="',convert2str(obj.opt_niter),'">','     <section name="flaim" />','     <help> number of iterations (default 30,000) to run for flightplan optimization, i.e. the number of times to randomly select a point and move it. </help>','  </parameter>');
++        	fprintf(fid,'%s\n%s\n','</frame>');     
++            
++            % Output
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="4" label="Output:">','<section name="flaim" />');                    
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="solution" type="',class(obj.solution),'" default="',convert2str(obj.solution),'">','     <section name="flaim" />','     <help> name of kml solution file </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="quality" type="',class(obj.quality),'" default="',convert2str(obj.quality),'">','     <section name="flaim" />','     <help> quality of kml solution </help>','  </parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');              
++        
++        end % }}}
+ 		function obj = flaim(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/mask.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mask.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/mask.m	(revision 17720)
+@@ -21,6 +21,12 @@
+ 		end% }}}
+ 	end
+ 	methods
++        function createxml(obj,fid) % {{{
++            fprintf(fid, '\n\n');
++            fprintf(fid, '%s\n', '<!-- mask -->');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="groundedice_levelset" type="',class(obj.groundedice_levelset),'" default="',obj.groundedice_levelset,'">','     <section name="mask" />','     <help> is ice grounded ? grounded ice if > 0, grounding line position if = 0, floating ice if &amp;lt; 0 </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','<parameter key ="ice_levelset" type="',class(obj.ice_levelset),'" default="',obj.ice_levelset,'">','     <section name="mask" />','     <help> presence of ice if > 0, icefront position if = 0, no ice if &amp;lt; 0 </help>','</parameter>');
++		end % }}}
+ 		function obj = mask(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/balancethickness.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/balancethickness.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/balancethickness.m	(revision 17720)
+@@ -10,6 +10,15 @@
+ 		stabilization     = 0;
+ 	end
+ 	methods
++        function createxml(obj,fid) % {{{
++            fprintf(fid, '\n\n');
++            fprintf(fid, '%s\n', '<!-- balancethickness -->');
++            
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="spcthickness" type="',   	class(obj.spcthickness),'" default="',        convert2str(obj.spcthickness),'">',	'     <section name="balancethickness" />','     <help> thickness constraints (NaN means no constraint) [m] </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="thickening_rate" type="', 	class(obj.thickening_rate),'" default="',            convert2str(obj.thickening_rate),'">',     '     <section name="balancethickness" />','     <help> ice thickening rate used in the mass conservation (dh/dt) [m/yr] </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n',        '<parameter key ="stabilization" type="',      class(obj.stabilization),'" default="',          convert2str(obj.stabilization),'">',	'     <section name="balancethickness" />','     <help> 0: None, 1: SU, 2: SSAs artificial diffusivity, 3:DG </help>','</parameter>');
++
++        end % }}}
+ 		function obj = balancethickness(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/inversion.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/inversion.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/inversion.m	(revision 17720)
+@@ -25,17 +25,61 @@
+ 		thickness_obs               = NaN
+ 	end
+ 	methods
++         function createxml(obj,fid) % {{{
++            fprintf(fid, '<!-- inversion -->\n');            
++                    
++            % inversion parameters
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="inversion parameters">','<section name="inversion" />');                    
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="iscontrol" type="',class(obj.iscontrol),'" default="',convert2str(obj.iscontrol),'">','     <section name="inversion" />','     <help> is inversion activated? </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="incomplete_adjoint" type="',class(obj.incomplete_adjoint),'" default="',convert2str(obj.incomplete_adjoint),'">','     <section name="inversion" />','     <help> 1: linear viscosity, 0: non-linear viscosity </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="control_parameters" type="',class(obj.control_parameters),'" default="',convert2str(obj.control_parameters),'">','     <section name="inversion" />','     <help> ex: {''FrictionCoefficient''}, or {''MaterialsRheologyBbar''} </help>','  </parameter>');
++                
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="nsteps" type="',class(obj.nsteps),'" default="',convert2str(obj.nsteps),'">','     <section name="inversion" />','     <help> number of optimization searches </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="cost_functions" type="',class(obj.cost_functions),'" default="',convert2str(obj.cost_functions),'">','     <section name="inversion" />','     <help> indicate the type of response for each optimization step  </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="cost_functions_coefficients" type="',class(obj.cost_functions_coefficients),'" default="',convert2str(obj.cost_functions_coefficients),'">','     <section name="inversion" />','     <help> cost_functions_coefficients applied to the misfit of each vertex and for each control_parameter </help>','  </parameter>');
++                
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="cost_function_threshold" type="',class(obj.cost_function_threshold),'" default="',convert2str(obj.cost_function_threshold),'">','     <section name="inversion" />','     <help> misfit convergence criterion. Default is 1%, NaN if not applied </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="maxiter_per_step" type="',class(obj.maxiter_per_step),'" default="',convert2str(obj.maxiter_per_step),'">','     <section name="inversion" />','     <help> maximum iterations during each optimization step  </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="gradient_scaling" type="',class(obj.gradient_scaling),'" default="',convert2str(obj.gradient_scaling),'">','     <section name="inversion" />','     <help> scaling factor on gradient direction during optimization, for each optimization step </help>','  </parameter>');
++               
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="step_threshold" type="',class(obj.step_threshold),'" default="',convert2str(obj.step_threshold),'">','     <section name="inversion" />','     <help> decrease threshold for misfit, default is 30% </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="min_parameters" type="',class(obj.min_parameters),'" default="',convert2str(obj.min_parameters),'">','     <section name="inversion" />','     <help> absolute minimum acceptable value of the inversed parameter on each vertex </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="max_parameters" type="',class(obj.max_parameters),'" default="',convert2str(obj.max_parameters),'">','     <section name="inversion" />','     <help> absolute maximum acceptable value of the inversed parameter on each vertex </help>','  </parameter>');
++               
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vx_obs" type="',class(obj.vx_obs),'" default="',convert2str(obj.vx_obs),'">','     <section name="inversion" />','     <help> observed velocity x component [m/yr] </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vy_obs" type="',class(obj.vy_obs),'" default="',convert2str(obj.vy_obs),'">','     <section name="inversion" />','     <help> observed velocity y component [m/yr]  </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vel_obs" type="',class(obj.vel_obs),'" default="',convert2str(obj.vel_obs),'">','     <section name="inversion" />','     <help> observed velocity magnitude [m/yr] </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="thickness_obs" type="',class(obj.thickness_obs),'" default="',convert2str(obj.thickness_obs),'">','     <section name="inversion" />','     <help> observed thickness [m]) </help>','  </parameter>');
++               
++            fprintf(fid,'%s\n%s\n','</frame>');    
++            
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="2" label="Available cost functions">','<section name="inversion" />');                    
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceAbsVelMisfit" type="','string','" default="','101','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceRelVelMisfit" type="','string','" default="','102','">','     <section name="inversion" />','     <help>   </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceLogVelMisfit" type="','string','" default="','103','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
++                
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceLogVxVyMisfit" type="','string','" default="','104','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceAverageVelMisfit" type="','string','" default="','105','">','     <section name="inversion" />','     <help>   </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="ThicknessAbsMisfit" type="','string','" default="','106','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
++               
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="DragCoefficientAbsGradient" type="','string','" default="','107','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="RheologyBbarAbsGradient" type="','string','" default="','108','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="ThicknessAbsGradient" type="','string','" default="','109','">','     <section name="inversion" />','     <help> </help>','  </parameter>');
++               
++            fprintf(fid,'%s\n%s\n','</frame>');    
++        
++        end % }}}       
+ 		function obj = inversion(varargin) % {{{
+ 			switch nargin
+ 				case 0
+ 					obj=setdefaultparameters(obj);
+ 				case 1
+ 					if isa(varargin{1},'taoinversion'),
+-						disp('converting taoinversion to inversion');
++						disp('converting taoinversion');
+ 						in=varargin{1};
+ 						obj=inversion();
+ 						obj.iscontrol                   = in.iscontrol;
+-						obj.tao                         = 1;
++						obj.tao                         = 1;rsion to inve
+ 						obj.incomplete_adjoint          = in.incomplete_adjoint;
+ 						obj.control_parameters          = in.control_parameters;
+ 						obj.nsteps                      = in.nsteps;
+Index: ../trunk-jpl/src/m/classes/SMB.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/SMB.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/SMB.m	(revision 17720)
+@@ -8,6 +8,12 @@
+ 		mass_balance = NaN;
+ 	end
+ 	methods
++        function createxml(obj,fid) % {{{
++            fprintf(fid, '\n\n');
++            fprintf(fid, '%s\n', '<!-- surfaceforcings(SMB) -->');
++			 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','<parameter key ="mass_balance" type="',class(obj.mass_balance),'" default="',obj.mass_balance,'">','     <section name="surfaceforcings(SMB)" />','     <help> surface mass balance [m/yr ice eq] </help>','</parameter>');
++           
++        end % }}}
+ 		function obj = SMB(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/debug.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/debug.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/debug.m	(revision 17720)
+@@ -10,6 +10,13 @@
+ 		profiling = false;
+ 	end
+ 	methods
++        function createxml(obj,fid) % {{{
++            fprintf(fid, '\n\n');
++            fprintf(fid, '%s\n', '<!-- Debug -->');
++			 fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n%s\n',    '<parameter key ="valgrind" type="',              class(obj.valgrind),'" optional="false">',              '     <section name="debug" />','        <option value="',convert2str(obj.valgrind),'" type="string" default="true"></option>','     <help> use Valgrind to debug (0 or 1) </help>','</parameter>');
++             fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n%s\n',    '<parameter key ="gprof" type="',              class(obj.gprof),'" optional="false">',              '     <section name="debug" />','        <option value="',convert2str(obj.gprof),'" type="string" default="true"></option>','     <help> use gnu-profiler to find out where the time is spent </help>','</parameter>');
++             fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n',    '<parameter key ="profiling" type="',              class(obj.profiling),'" optional="false">',              '     <section name="debug" />','        <option value="',convert2str(obj.profiling),'" type="string" default="true"></option>','     <help> enables profiling (memory, flops, time) </help>','</parameter>');
++        end % }}}
+ 		function obj = debug(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/geometry.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/geometry.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/geometry.m	(revision 17720)
+@@ -32,6 +32,17 @@
+ 		end% }}}
+ 	end
+ 	methods
++        function createxml(obj,fid) % {{{
++            fprintf(fid, '\n\n');
++            fprintf(fid, '%s\n', '<!-- geometry -->');
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Geometry parameters">','<section name="geometry" />'); 
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="surface" type="','path','" optional="','false','">','     <section name="geometry" />','     <help> surface elevation [m] </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="thickness" type="','path','" optional="','false','">','     <section name="geometry" />','     <help> ice thickness [m] </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="bed" type="','path','" optional="','false','">','     <section name="geometry" />','     <help> bed elevation [m] </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="bathymetry" type="',class(obj.bathymetry),'" default="',convert2str(obj.bathymetry),'">','     <section name="geometry" />','     <help> bathymetry elevation [m] </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','<parameter key ="hydrostatic_ratio" type="',class(obj.hydrostatic_ratio),'" default="',convert2str(obj.hydrostatic_ratio),'">','     <section name="geometry" />','     <help> coefficient for ice shelves; thickness correction: hydrostatic_ratio H_obs+ (1-hydrostatic_ratio) H_hydro </help>','</parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');
++        end % }}}
+ 		function obj = geometry(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/thermal.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/thermal.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/thermal.m	(revision 17720)
+@@ -16,6 +16,23 @@
+ 		requested_outputs = {};
+ 	end
+ 	methods
++        function createxml(obj,fid) % {{{
++            fprintf(fid, '<!-- thermal -->\n');            
++                    
++            % thermal solution parameters
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Thermal solution parameters">','<section name="thermal" />');                    
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="spctemperature" type="',class(obj.spctemperature),'" default="',convert2str(obj.spctemperature),'">','     <section name="thermal" />','     <help> temperature constraints (NaN means no constraint) [K] </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="penalty_threshold" type="',class(obj.penalty_threshold),'" default="',convert2str(obj.penalty_threshold),'">','     <section name="thermal" />','     <help> 0: no, 1: artificial_diffusivity, 2: SUPG </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="stabilization" type="',class(obj.stabilization),'" default="',convert2str(obj.stabilization),'">','     <section name="thermal" />','     <help> maximum number of non linear iterations </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="maxiter" type="',class(obj.maxiter),'" default="',convert2str(obj.maxiter),'">','     <section name="thermal" />','     <help> stabilize unstable thermal constraints that keep zigzagging after n iteration (default is 0, no stabilization) </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="penalty_lock" type="',class(obj.penalty_lock),'" default="',convert2str(obj.penalty_lock),'">','     <section name="thermal" />','     <help> threshold to declare convergence of thermal solution (default is 0)  </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="penalty_factor" type="',class(obj.penalty_factor),'" default="',convert2str(obj.penalty_factor),'">','     <section name="thermal" />','     <help> scaling exponent (default is 3) </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="isenthalpy" type="',class(obj.isenthalpy),'" default="',convert2str(obj.isenthalpy),'">','     <section name="thermal" />','     <help> use an enthalpy formulation to include temperate ice (default is 0) </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="isdynamicbasalspc" type="',class(obj.isdynamicbasalspc),'" default="',convert2str(obj.isdynamicbasalspc),'">','     <section name="thermal" />','     <help> enable dynamic setting of basal forcing. required for enthalpy formulation (default is 0)  </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="requested_outputs" type="',class(obj.requested_outputs),'" default="',convert2str(obj.requested_outputs),'">','     <section name="thermal" />','     <help> additional outputs requested </help>','  </parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');    
++        
++        end % }}}
+ 		function obj = thermal(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/settings.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/settings.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/settings.m	(revision 17720)
+@@ -18,6 +18,21 @@
+ 
+ 	end
+ 	methods
++        function createxml(obj,fid) % {{{
++            fprintf(fid, '\n\n');
++            fprintf(fid, '%s\n', '<!-- settings -->');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="results_on_nodes" type="',      class(obj.results_on_nodes),'" default="',        convert2str(obj.results_on_nodes),'">',	'     <section name="settings" />','     <help> results are output for all the nodes of each element </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="io_gather" type="',          class(obj.io_gather),'" default="',           convert2str(obj.io_gather),'">',     '     <section name="settings" />','     <help> I/O gathering strategy for result outputs (default 1) </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',	'<parameter key ="lowmem" type="',        class(obj.lowmem),'" default="',         convert2str(obj.lowmem),'">',	'     <section name="settings" />','     <help> is the memory limited ? (0 or 1) </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="output_frequency" type="',          class(obj.output_frequency),'" default="',           convert2str(obj.output_frequency),'">',	'     <section name="settings" />','     <help> frequency at which results are saved in all solutions with multiple time_steps </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="waitonlock" type="',  	class(obj.waitonlock),'" default="',      convert2str(obj.waitonlock),'">',     '     <section name="settings" />','     <help> maximum number of minutes to wait for batch results (NaN to deactivate) </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="upload_server" type="',         class(obj.upload_server),'" default="',          convert2str(obj.upload_server),'">',	'     <section name="settings" />','     <help> server hostname where model should be uploaded </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="upload_path" type="',             class(obj.upload_path),'" default="',              convert2str(obj.upload_path),'">',     '     <section name="settings" />','     <help> path on server where model should be uploaded </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="upload_login" type="',        class(obj.upload_login),'" default="',         convert2str(obj.upload_login),'">',	'     <section name="settings" />','     <help> server login </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="upload_port" type="',    	class(obj.upload_port),'" default="',      convert2str(obj.upload_port),'">',     '     <section name="settings" />','     <help> port login (default is 0) </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n',    	'<parameter key ="upload_filename" type="',         class(obj.upload_filename),'" default="',          convert2str(obj.upload_filename),'">',	'     <section name="settings" />','     <help> unique id generated when uploading the file to server </help>','</parameter>');
++             
++        end % }}}
+ 		function obj = settings(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/gia.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/gia.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/gia.m	(revision 17720)
+@@ -10,6 +10,17 @@
+ 		cross_section_shape           = 0;
+ 	end
+ 	methods
++         function createxml(obj,fid) % {{{
++            fprintf(fid, '<!-- gia -->\n');            
++                    
++            % gia solution parameters
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="gia parameters">','<section name="gia" />');                    
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="mantle_viscosity" type="',class(obj.mantle_viscosity),'" default="',convert2str(obj.mantle_viscosity),'">','     <section name="gia" />','     <help> mantle viscosity[Pa s] </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="lithosphere_thickness" type="',class(obj.lithosphere_thickness),'" default="',convert2str(obj.lithosphere_thickness),'">','     <section name="gia" />','     <help> lithosphere thickness (km) </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="cross_section_shape" type="',class(obj.cross_section_shape),'" default="',convert2str(obj.cross_section_shape),'">','     <section name="gia" />','     <help> 1: square-edged (default). 2: elliptical.  See iedge in GiaDeflectionCore </help>','  </parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');    
++        
++        end % }}}
+ 		function obj = gia(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/miscellaneous.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/miscellaneous.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/miscellaneous.m	(revision 17720)
+@@ -10,6 +10,17 @@
+ 		dummy = struct();
+ 	end
+ 	methods
++        function createxml(obj,fid) % {{{
++            fprintf(fid, '<!-- miscellaneous -->\n');            
++                    
++            % miscellaneous solution parameters
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="miscellaneous parameters">','<section name="miscellaneous" />');                    
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="notes" type="',class(obj.notes),'" default="',convert2str(obj.notes),'">','     <section name="miscellaneous" />','     <help> notes in a cell of strings </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="name" type="',class(obj.name),'" default="',convert2str(obj.name),'">','     <section name="miscellaneous" />','     <help> model name </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="dummy" type="',class(obj.dummy),'" default="',convert2str(obj.dummy),'">','     <section name="miscellaneous" />','     <help> empty field to store some data </help>','  </parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');    
++        
++        end % }}}        
+ 		function obj = miscellaneous(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/groundingline.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/groundingline.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/groundingline.m	(revision 17720)
+@@ -9,6 +9,16 @@
+ 		melting_rate = NaN;
+ 	end
+ 	methods
++         function createxml(obj,fid) % {{{
++            fprintf(fid, '\n\n');
++            fprintf(fid, '%s\n', '<!-- groundingline -->');
++            
++            % Convergence criteria          
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Grounding line migration parameters">','<section name="groundingline" />');  
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="migration" type="',      class(obj.migration),'" default="',        convert2str(obj.migration),'">',	'     <section name="groundingline" />','     <help> type of grounding line migration: "SoftMigration","AgressiveMigration" or "None" </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n',    '<parameter key ="melting_rate" type="',          class(obj.melting_rate),'" default="',            convert2str(obj.melting_rate),'">',     '     <section name="groundingline" />','     <help> melting rate applied when previously grounded parts start floating [m/yr] </help>','</parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');
++        end % }}}
+ 		function obj = groundingline(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/clusters/generic.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/clusters/generic.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/clusters/generic.m	(revision 17720)
+@@ -22,6 +22,24 @@
+ 		%}}}
+ 	end
+ 	methods
++        function createxml(obj,fid) % {{{
++            fprintf(fid, '\n\n');
++            fprintf(fid, '%s\n', '<!-- generic -->');
++            
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="name" type="',class(obj.name),'" default="',convert2str(obj.name),'">',	'     <section name="cluster" />','     <help> N/A </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="login" type="',class(obj.login),'" default="',convert2str(obj.login),'">',     '     <section name="cluster" />','     <help> N/A </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',	'<parameter key ="np" type="',class(obj.np),'" default="',convert2str(obj.np),'">',	'     <section name="cluster" />','     <help> N/A </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="port" type="',class(obj.port),'" default="',convert2str(obj.port),'">',	'     <section name="cluster" />','     <help> N/A </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="codepath" type="',class(obj.codepath),'" default="',convert2str(obj.codepath),'">',     '     <section name="cluster" />','     <help> N/A </help>','</parameter>');
++             
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="executionpath" type="',class(obj.executionpath),'" default="',convert2str(obj.executionpath),'">',	'     <section name="cluster" />','     <help> N/A </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="etcpath" type="',class(obj.etcpath),'" default="',convert2str(obj.etcpath),'">',     '     <section name="cluster" />','     <help> N/A </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="valgrind" type="',class(obj.valgrind),'" default="',convert2str(obj.valgrind),'">',	'     <section name="cluster" />','     <help> N/A </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="valgrindlib" type="',class(obj.valgrindlib),'" default="',convert2str(obj.valgrindlib),'">',     '     <section name="cluster" />','     <help> N/A </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="valgrindsup" type="',class(obj.valgrindsup),'" default="',convert2str(obj.valgrindsup),'">',     '     <section name="cluster" />','     <help> N/A </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n',    	'<parameter key ="verbose" type="',class(obj.verbose),'" default="',convert2str(obj.verbose),'">',	'     <section name="cluster" />','     <help> N/A </help>','</parameter>');
++             
++        end % }}}
+ 		function cluster=generic(varargin) % {{{
+ 
+ 			%use provided options to change fields
+Index: ../trunk-jpl/src/m/classes/friction.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/friction.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/friction.m	(revision 17720)
+@@ -10,6 +10,15 @@
+ 		q           = NaN;
+ 	end
+ 	methods
++        function createxml(obj,fid) % {{{
++            fprintf(fid, '\n\n');
++            fprintf(fid, '%s\n', '<!-- Friction: Sigma= drag^2 * Neff ^r * u ^s, with Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p -->');
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Friction: Sigma= drag^2 * Neff ^r * u ^s, with Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p">','<section name="friction" />');   
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="coefficient" type="',   	class(obj.coefficient),'" default="',     	convert2str(obj.coefficient),'">',              '     <section name="friction" />','     <help> friction coefficient [SI] </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="p" type="',               class(obj.p),'" default="',                 convert2str(obj.p),'">',   '     <section name="friction" />','     <help> p exponent </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n',        '<parameter key ="q" type="',               class(obj.q),'" default="',                 convert2str(obj.q),'">',            '     <section name="friction" />','     <help> q exponent </help>','</parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');
++        end % }}}
+ 		function obj = friction(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/steadystate.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/steadystate.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/steadystate.m	(revision 17720)
+@@ -10,6 +10,17 @@
+ 		requested_outputs = {};
+ 	end
+ 	methods
++        function createxml(obj,fid) % {{{
++            fprintf(fid, '<!-- steadystate -->\n');            
++                    
++            % steadystate solution parameters
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="steadystate solution parameters">','<section name="steadystate" />');                    
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="reltol" type="',class(obj.reltol),'" default="',convert2str(obj.reltol),'">','     <section name="steadystate" />','     <help> relative tolerance criterion [K] </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="maxiter" type="',class(obj.maxiter),'" default="',convert2str(obj.maxiter),'">','     <section name="steadystate" />','     <help> maximum number of iterations </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="requested_outputs" type="',class(obj.requested_outputs),'" default="',convert2str(obj.requested_outputs),'">','     <section name="steadystate" />','     <help> additional requested outputs </help>','  </parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');    
++        
++        end % }}}
+ 		function obj = steadystate(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/autodiff.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/autodiff.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/autodiff.m	(revision 17720)
+@@ -19,6 +19,26 @@
+ 		end
+ 		%}}}
+ 	methods
++     	function createxml(obj,fid) % {{{
++            fprintf(fid, '<!-- autodiff -->\n');            
++                    
++            % automatic differentiation parameters 
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="automatic differentiation parameters">','<section name="autodiff" />');                    
++                fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n%s\n','  <parameter key ="isautodiff" type="',class(obj.isautodiff),'" optional="false">','     <section name="autodiff" />','         <option value="',convert2str(obj.isautodiff),'" type="string" default="true"></option>','     <help> indicates if the automatic differentiation is activated </help>','  </parameter>');
++             
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="dependents" type="',class(obj.dependents),'" default="',convert2str(obj.dependents),'">','     <section name="autodiff" />','     <help> list of dependent variables </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="independents" type="',class(obj.independents),'" default="',convert2str(obj.independents),'">','     <section name="autodiff" />','     <help> list of independent variables </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="driver" type="',class(obj.driver),'" default="',convert2str(obj.driver),'">','     <section name="autodiff" />','     <help> ADOLC driver (''fos_forward'' or ''fov_forward'') </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="obufsize" type="',class(obj.obufsize),'" default="',convert2str(obj.obufsize),'">','     <section name="autodiff" />','     <help> Number of operations per buffer (==OBUFSIZE in usrparms.h)  </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="lbufsize" type="',class(obj.lbufsize),'" default="',convert2str(obj.lbufsize),'">','     <section name="autodiff" />','     <help> Number of locations per buffer (==LBUFSIZE in usrparms.h) </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="cbufsize" type="',class(obj.cbufsize),'" default="',convert2str(obj.cbufsize),'">','     <section name="autodiff" />','     <help> Number of values per buffer (==CBUFSIZE in usrparms.h) </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="tbufsize" type="',class(obj.tbufsize),'" default="',convert2str(obj.tbufsize),'">','     <section name="autodiff" />','     <help> Number of taylors per buffer (&amp;lt;=TBUFSIZE in usrparms.h) </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="gcTriggerRatio" type="',class(obj.gcTriggerRatio),'" default="',convert2str(obj.gcTriggerRatio),'">','     <section name="autodiff" />','     <help> free location block sorting/consolidation triggered if the ratio between allocated and used locations exceeds gcTriggerRatio </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="gcTriggerRatio" type="',class(obj.gcTriggerRatio),'" default="',convert2str(obj.gcTriggerRatio),'">','     <section name="autodiff" />','     <help> free location block sorting/consolidation triggered if the allocated locations exceed gcTriggerMaxSize </help>','  </parameter>');
++            
++            fprintf(fid,'%s\n%s\n','</frame>');    
++        
++        end % }}}
+ 		function obj = autodiff(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/qmu.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/qmu.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/qmu.m	(revision 17720)
+@@ -23,6 +23,35 @@
+ 		vertex_weight               = NaN;
+ 	end
+ 	methods
++        function createxml(obj,fid) % {{{
++            fprintf(fid, '<!-- qmu -->\n');            
++                    
++            % qmu solution parameters
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="qmu parameters">','<section name="qmu" />');                    
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="isdakota" type="',class(obj.isdakota),'" default="',convert2str(obj.isdakota),'">','     <section name="qmu" />','     <help> is qmu analysis activated? </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="variables" type="',class(obj.variables),'" default="',convert2str(obj.variables),'">','     <section name="qmu" />','     <help> (arrays of each variable class) </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="responses" type="',class(obj.responses),'" default="',convert2str(obj.responses),'">','     <section name="qmu" />','     <help> (arrays of each response class) </help>','  </parameter>');
++                
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="numberofresponses" type="',class(obj.numberofresponses),'" default="',convert2str(obj.numberofresponses),'">','     <section name="qmu" />','     <help> number of responses </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="params" type="',class(obj.params),'" default="',convert2str(obj.params),'">','     <section name="qmu" />','     <help> (array of method-independent parameters)  </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="results" type="',class(obj.results),'" default="',convert2str(obj.results),'">','     <section name="qmu" />','     <help> (information from dakota files) </help>','  </parameter>');
++                
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="partition" type="',class(obj.partition),'" default="',convert2str(obj.partition),'">','     <section name="qmu" />','     <help> user provided mesh partitioning, defaults to metis if not specified </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="numberofpartitions" type="',class(obj.numberofpartitions),'" default="',convert2str(obj.numberofpartitions),'">','     <section name="qmu" />','     <help> number of partitions for semi-discrete qmu  </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="variabledescriptors" type="',class(obj.variabledescriptors),'" default="',convert2str(obj.variabledescriptors),'">','     <section name="qmu" />','     <help>  </help>','  </parameter>');
++            
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="responsedescriptors" type="',class(obj.responsedescriptors),'" default="',convert2str(obj.responsedescriptors),'">','     <section name="qmu" />','     <help> use an enthalpy formulation to include temperate ice (default is 0) </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="method" type="',class(obj.method),'" default="',convert2str(obj.method),'">','     <section name="qmu" />','     <help> array of dakota_method class </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="mass_flux_profile_directory" type="',class(obj.mass_flux_profile_directory),'" default="',convert2str(obj.mass_flux_profile_directory),'">','     <section name="qmu" />','     <help> directory for mass flux profiles </help>','  </parameter>');
++                
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="mass_flux_profiles" type="',class(obj.mass_flux_profiles),'" default="',convert2str(obj.mass_flux_profiles),'">','     <section name="qmu" />','     <help>  </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="mass_flux_segments" type="',class(obj.mass_flux_segments),'" default="',convert2str(obj.mass_flux_segments),'">','     <section name="qmu" />','     <help>  </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="adjacency" type="',class(obj.adjacency),'" default="',convert2str(obj.adjacency),'">','     <section name="qmu" />','     <help> additional outputs requested </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertex_weight" type="',class(obj.vertex_weight),'" default="',convert2str(obj.vertex_weight),'">','     <section name="qmu" />','     <help> weight applied to each mesh vertex </help>','  </parameter>');
++            
++            fprintf(fid,'%s\n%s\n','</frame>');    
++        
++        end % }}}        
+ 		function obj = qmu(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/matice.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/matice.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/matice.m	(revision 17720)
+@@ -29,6 +29,40 @@
+ 
+ 	end
+ 	methods
++        function createxml(obj,fid) % {{{
++            fprintf(fid, '\n\n');
++            fprintf(fid, '<!-- materials -->\n');
++			 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rho_ice" type="',class(obj.rho_ice),'" default="',convert2str(obj.rho_ice),'">','     <section name="materials" />','     <help> ice density [kg/m^3] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rho_water" type="',class(obj.rho_water),'" default="',convert2str(obj.rho_water),'">','     <section name="materials" />','     <help> ocean water density [kg/m^3] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rho_freshwater" type="',class(obj.rho_freshwater),'" default="',convert2str(obj.rho_freshwater),'">','     <section name="materials" />','     <help> fresh water density [kg/m^3] </help>','</parameter>');
++             
++  
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mu_water" type="',class(obj.mu_water),'" default="',convert2str(obj.mu_water),'">','     <section name="materials" />','     <help> water viscosity [N s/m^2] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="heatcapacity" type="',class(obj.heatcapacity),'" default="',convert2str(obj.heatcapacity),'">','     <section name="materials" />','     <help> heat capacity [J/kg/K] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="latentheat" type="',class(obj.latentheat),'" default="',convert2str(obj.latentheat),'">','     <section name="materials" />','     <help> latent heat of fusion [J/kg] </help>','</parameter>');
++             
++             
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="thermalconductivity" type="',class(obj.thermalconductivity),'" default="',convert2str(obj.thermalconductivity),'">','     <section name="materials" />','     <help> ice thermal conductivity [W/m/K] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="temperateiceconductivity" type="',class(obj.temperateiceconductivity),'" default="',convert2str(obj.temperateiceconductivity),'">','     <section name="materials" />','     <help> temperate ice thermal conductivity [W/m/K] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="meltingpoint" type="',class(obj.meltingpoint),'" default="',convert2str(obj.meltingpoint),'">','     <section name="materials" />','     <help> melting point of ice at 1atm in K </help>','</parameter>');
++             
++             
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="beta" type="',class(obj.beta),'" default="',convert2str(obj.beta),'">','     <section name="materials" />','     <help> rate of change of melting point with pressure [K/Pa] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mixed_layer_capacity" type="',class(obj.mixed_layer_capacity),'" default="',convert2str(obj.mixed_layer_capacity),'">','     <section name="materials" />','     <help> mixed layer capacity [W/kg/K] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="thermal_exchange_velocity" type="',class(obj.thermal_exchange_velocity),'" default="',convert2str(obj.thermal_exchange_velocity),'">','     <section name="materials" />','     <help> thermal exchange velocity [m/s] </help>','</parameter>');
++             
++             
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rheology_B" type="',class(obj.rheology_B),'" default="',convert2str(obj.rheology_B),'">','     <section name="materials" />','     <help> flow law parameter [Pa/s^(1/n)] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rheology_n" type="',class(obj.rheology_n),'" default="',convert2str(obj.rheology_n),'">','     <section name="materials" />','     <help> Glens flow law exponent </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rheology_law" type="',class(obj.rheology_law),'" default="',convert2str(obj.rheology_law),'">','     <section name="materials" />','     <help> law for the temperature dependance of the rheology: "None", "Paterson",  "Arrhenius" or "LliboutryDuval" </help>','</parameter>');
++             
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="lithosphere_shear_modulus" type="',class(obj.lithosphere_shear_modulus),'" default="',convert2str(obj.lithosphere_shear_modulus),'">','     <section name="materials" />','     <help> Lithosphere shear modulus [Pa] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="lithosphere_density" type="',class(obj.lithosphere_density),'" default="',convert2str(obj.lithosphere_density),'">','     <section name="materials" />','     <help> Lithosphere density [g/cm^-3] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mantle_shear_modulus" type="',class(obj.mantle_shear_modulus),'" default="',convert2str(obj.mantle_shear_modulus),'">','     <section name="materials" />','     <help> Mantle shear modulus [Pa] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mantle_density" type="',class(obj.mantle_density),'" default="',convert2str(obj.mantle_density),'">','     <section name="materials" />','     <help> Mantle density [g/cm^-3] </help>','</parameter>');
++        
++         
++        end % }}}
+ 		function obj = matice(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/verbose.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/verbose.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/verbose.m	(revision 17720)
+@@ -37,6 +37,21 @@
+ 	end
+ 	%}}}
+ 	methods
++        function createxml(obj,fid) % {{{
++            fprintf(fid, '\n\n');
++            fprintf(fid, '%s\n', '<!-- verbose -->');
++             
++             fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n%s\n',    '<parameter key ="mprocessor" type="',              class(obj.mprocessor),'" optional="false">',              '     <section name="verbose" />','        <option value="',convert2str(obj.mprocessor),'" type="string" default="true"></option>','     <help>  </help>','</parameter>');
++             fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n%s\n',    '<parameter key ="module" type="',              class(obj.module),'" optional="false">',              '     <section name="verbose" />','        <option value="',convert2str(obj.module),'" type="string" default="true"></option>','     <help>  </help>','</parameter>');
++             fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n%s\n',    '<parameter key ="solution" type="',              class(obj.solution),'" optional="false">',              '     <section name="verbose" />','        <option value="',convert2str(obj.solution),'" type="string" default="true"></option>','     <help>  </help>','</parameter>');
++             fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n%s\n',    '<parameter key ="solver" type="',              class(obj.solver),'" optional="false">',              '     <section name="verbose" />','        <option value="',convert2str(obj.solver),'" type="string" default="true"></option>','     <help>  </help>','</parameter>');
++             fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n%s\n',    '<parameter key ="convergence" type="',              class(obj.convergence),'" optional="false">',              '     <section name="verbose" />','        <option value="',convert2str(obj.convergence),'" type="string" default="true"></option>','     <help>  </help>','</parameter>');
++             fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n%s\n',    '<parameter key ="control" type="',              class(obj.control),'" optional="false">',              '     <section name="verbose" />','        <option value="',convert2str(obj.control),'" type="string" default="true"></option>','     <help>  </help>','</parameter>');
++             fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n%s\n',    '<parameter key ="qmu" type="',              class(obj.qmu),'" optional="false">',              '     <section name="verbose" />','        <option value="',convert2str(obj.qmu),'" type="string" default="true"></option>','     <help>  </help>','</parameter>');
++             fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n',    '<parameter key ="autodiff" type="',              class(obj.autodiff),'" optional="false">',              '     <section name="verbose" />','        <option value="',convert2str(obj.autodiff),'" type="string" default="true"></option>','     <help>  </help>','</parameter>');
++             
++             
++        end % }}}
+ 		function verbose=verbose(varargin) % {{{
+ 
+ 			switch(nargin),
+Index: ../trunk-jpl/src/m/classes/transient.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/transient.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/transient.m	(revision 17720)
+@@ -15,6 +15,22 @@
+ 		requested_outputs = {};
+ 	end
+ 	methods
++        function createxml(obj,fid) % {{{
++            fprintf(fid, '<!-- transient -->\n');            
++                    
++            % transient solution parameters
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="transient solution parameters">','<section name="transient" />');                    
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="ismasstransport" type="',class(obj.ismasstransport),'" default="',convert2str(obj.ismasstransport),'">','     <section name="transient" />','     <help> indicates whether a masstransport solution is used in the transient </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="isstressbalance" type="',class(obj.isstressbalance),'" default="',convert2str(obj.isstressbalance),'">','     <section name="transient" />','     <help> indicates whether a stressbalance solution is used in the transient </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="isthermal" type="',class(obj.isthermal),'" default="',convert2str(obj.isthermal),'">','     <section name="transient" />','     <help> indicates whether a thermal solution is used in the transient </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="isgroundingline" type="',class(obj.isgroundingline),'" default="',convert2str(obj.isgroundingline),'">','     <section name="transient" />','     <help> indicates whether a groundingline migration is used in the transient </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="isgia" type="',class(obj.isgia),'" default="',convert2str(obj.isgia),'">','     <section name="transient" />','     <help> indicates whether a postglacial rebound model is used in the transient </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="isdamage" type="',class(obj.isdamage),'" default="',convert2str(obj.isdamage),'">','     <section name="transient" />','     <help> indicates whether damage evolution is used in the transient </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="islevelset" type="',class(obj.islevelset),'" default="',convert2str(obj.islevelset),'">','     <section name="transient" />','     <help> LEVEL SET DESCRIPTION...  </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="requested_outputs" type="',class(obj.requested_outputs),'" default="',convert2str(obj.requested_outputs),'">','     <section name="transient" />','     <help> list of additional outputs requested </help>','  </parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');    
++        
++        end % }}}
+ 		function obj = transient(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/timestepping.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/timestepping.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/timestepping.m	(revision 17720)
+@@ -12,6 +12,17 @@
+ 		cfl_coefficient = 0.;
+ 	end
+ 	methods
++       function createxml(obj,fid) % {{{
++            fprintf(fid, '\n\n');
++            fprintf(fid, '%s\n', '<!-- Timestepping -->');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="start_time" type="',              class(obj.start_time),'" default="',                  convert2str(obj.start_time),'">',              '     <section name="timestepping" />','     <help> simulation starting time [yr] </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="final_time" type="',            class(obj.final_time),'" default="',                convert2str(obj.final_time),'">',   '     <section name="timestepping" />','     <help> final time to stop the simulation [yr] </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="time_step" type="',      class(obj.time_step),'" default="',          convert2str(obj.time_step),'">',            '     <section name="timestepping" />','     <help> length of time steps [yr] </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="time_adapt" type="',     class(obj.time_adapt),'" default="',         convert2str(obj.time_adapt),'">',            '     <section name="timestepping" />','     <help> use cfl condition to define time step ? (0 or 1)  </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="cfl_coefficient" type="',       class(obj.cfl_coefficient),'" default="',              convert2str(obj.cfl_coefficient),'">',              '     <section name="timestepping" />','     <help> coefficient applied to cfl condition </help>','</parameter>');
++            
++        end % }}}
++        
+ 		function obj = timestepping(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/outputdefinition.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/outputdefinition.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/outputdefinition.m	(revision 17720)
+@@ -8,6 +8,15 @@
+ 		definitions                 = {};
+ 	end
+ 	methods
++	   function createxml(obj,fid) % {{{
++            fprintf(fid, '<!-- outputdefinition -->\n');            
++                    
++            % outputdefinition solution parameters
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="outputdefinition">','<section name="outputdefinition" />');                    
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="definitions" type="',class(obj.definitions),'" default="',convert2str(obj.definitions),'">','     <section name="outputdefinition" />','     <help> list of potential outputs that can be requested, but which need additional data to be defined </help>','  </parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');    
++        
++        end % }}}
+ 		function obj = outputdefinition(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/constants.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/constants.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/constants.m	(revision 17720)
+@@ -10,6 +10,13 @@
+ 		referencetemperature = 0;
+ 	end
+ 	methods
++        function createxml(obj,fid) % {{{
++            fprintf(fid, '\n\n');
++            fprintf(fid, '%s\n', '<!-- constants -->');
++			 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="g" type="',class(obj.g),'" default="',num2str(obj.g),'">','     <section name="constants" />','     <help> gravitational acceleration [m/s^2] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="yts" type="',class(obj.yts),'" default="',num2str(obj.yts),'">','     <section name="constants" />','     <help> number of seconds in a year [s/yr] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','<parameter key ="referencetemperature" type="',class(obj.referencetemperature),'" default="',num2str(obj.referencetemperature),'">','     <section name="constants" />','     <help> reference temperature used in the enthalpy model [K] </help>','</parameter>');
++		end % }}}
+ 		function obj = constants(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/mesh2d.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh2d.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/mesh2d.m	(revision 17720)
+@@ -103,6 +103,81 @@
+ 			fielddisplay(obj,'long','vertices longitude [degrees]');
+ 			fielddisplay(obj,'hemisphere','Indicate hemisphere ''n'' or ''s'' ');
+ 		end % }}}
++        function createxml(obj,fid) % {{{
++            fprintf(fid, '<!-- mesh -->\n');
++            
++            % drop-down 
++            fprintf(fid,'%s%s%s%s%s\n%s\n','<parameter key ="Dimension" type="','alternative','" optional="','false','">','     <section name="mesh" />');
++            
++                % dimension=0
++                fprintf(fid,'%s%s%s%s%s\n%s\n','     <option value="0" type="','string','" default="','true','">','        <help> dimension is 0 </help>');
++                % footer for dim=0
++                fprintf(fid,'%s\n%s\n','     </option>');
++
++                % dimension=3
++                fprintf(fid,'%s%s%s\n%s\n','     <option value="3" type="','string','">','        <help> dimension is 3 </help>');
++
++                    fprintf(fid,'       <!-- Elements and vertices of the original 2d mesh -->\n');
++                    %fprintf(fid,'%s\n%s\n%s\n','       <frame key="dim=3" label="Elements and vertices of the original 2d mesh">','       <section name="mesh" />');
++                    fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="x2d" type="',class(obj.x2d),'" default="',convert2str(obj.x2d),'">','              <help> vertices x coordinate [m] </help>','          </parameter>');
++                    fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="y2d" type="',class(obj.y2d),'" default="',convert2str(obj.y2d),'">','              <help> vertices y coordinate [m] </help>','          </parameter>');
++                    fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="elements2d" type="',class(obj.elements2d),'" default="',convert2str(obj.elements2d),'">','              <help> vertex indices of the mesh elements </help>','          </parameter>');
++                    fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="numberofvertices2d" type="',class(obj.numberofvertices2d),'" default="',convert2str(obj.numberofvertices2d),'">','              <help> number of vertices </help>','          </parameter>');
++                    fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="numberofelements2d" type="',class(obj.numberofelements2d),'" default="',convert2str(obj.numberofelements2d),'">','              <help> number of elements </help>','          </parameter>');
++                    %fprintf(fid,'%s\n%s\n','       </frame>');
++                % footer for dim=3
++                fprintf(fid,'%s\n%s\n','     </option>');   
++            
++            % footer for drop-down
++            fprintf(fid,'%s\n%s\n%s','     <help> select a mesh dimension 0(default) or 3 </help>','</parameter>');
++            
++                    
++            % elements and vertices
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Elements and vertices">','<section name="mesh" />');                    
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="numberofelements" type="',class(obj.numberofelements),'" default="',convert2str(obj.numberofelements),'">','     <section name="mesh" />','     <help> number of elements </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="numberofvertices" type="',class(obj.numberofvertices),'" default="',convert2str(obj.numberofvertices),'">','     <section name="mesh" />','     <help> number of verticies </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="elements" type="',class(obj.elements),'" default="',convert2str(obj.elements),'">','     <section name="mesh" />','     <help> vertex indices of the mesh elements </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="x" type="',class(obj.x),'" default="',convert2str(obj.x),'">','     <section name="mesh" />','     <help> vertices x coordinate [m] </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="y" type="',class(obj.y),'" default="',convert2str(obj.y),'">','     <section name="mesh" />','     <help> vertices y coordinate [m] </help>','  </parameter>');
++		    fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="z" type="',class(obj.z),'" default="',convert2str(obj.z),'">','     <section name="mesh" />','     <help> vertices z coordinate [m] </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="edges" type="',class(obj.edges),'" default="',convert2str(obj.edges),'">','     <section name="mesh" />','     <help> edges of the 2d mesh (vertex1 vertex2 element1 element2) </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="numberofedges" type="',class(obj.numberofedges),'" default="',convert2str(obj.numberofedges),'">','     <section name="mesh" />','     <help> number of edges of the 2d mesh </help>','  </parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');
++            
++            % properties
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="2" label="Properties">','<section name="mesh" />');             
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="selected dimension" type="',class(obj.dimension),'" default="',convert2str(obj.dimension),'">','     <section name="mesh" />','     <help> mesh dimension </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="numberoflayers" type="',class(obj.numberoflayers),'" default="',convert2str(obj.numberoflayers),'">','     <section name="mesh" />','     <help> number of extrusion layers </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexonbed" type="',class(obj.vertexonbed),'" default="',convert2str(obj.vertexonbed),'">','     <section name="mesh" />','     <help> lower vertices flags list </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="elementonbed" type="',class(obj.elementonbed),'" default="',convert2str(obj.elementonbed),'">','     <section name="mesh" />','     <help> lower elements flags list </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexonsurface" type="',class(obj.vertexonsurface),'" default="',convert2str(obj.vertexonsurface),'">','     <section name="mesh" />','     <help> upper vertices flags list </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="elementonsurface" type="',class(obj.elementonsurface),'" default="',convert2str(obj.elementonsurface),'">','     <section name="mesh" />','     <help> upper element flag list </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="uppervertex" type="',class(obj.uppervertex),'" default="',convert2str(obj.uppervertex),'">','     <section name="mesh" />','     <help> upper vertex list (NaN for vertex on the upper surface) </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="upperelements" type="',class(obj.upperelements),'" default="',convert2str(obj.upperelements),'">','     <section name="mesh" />','     <help> upper element list (NaN for element on the upper layer) </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="lowervertex" type="',class(obj.lowervertex),'" default="',convert2str(obj.lowervertex),'">','     <section name="mesh" />','     <help> lower vertex list (NaN for vertex on the lower surface) </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="lowerelements" type="',class(obj.lowerelements),'" default="',convert2str(obj.lowerelements),'">','     <section name="mesh" />','     <help> lower element list (NaN for element on the lower layer </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexonboundary" type="',class(obj.vertexonboundary),'" default="',convert2str(obj.vertexonboundary),'">','     <section name="mesh" />','     <help> vertices on the boundary of the domain flag list </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="segments" type="',class(obj.segments),'" default="',convert2str(obj.segments),'">','     <section name="mesh" />','     <help> edges on domain boundary (vertex1 vertex2 element) </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="segmentmarkers" type="',class(obj.segmentmarkers),'" default="',convert2str(obj.segmentmarkers),'">','     <section name="mesh" />','     <help> number associated to each segment </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexconnectivity" type="',class(obj.vertexconnectivity),'" default="',convert2str(obj.vertexconnectivity),'">','     <section name="mesh" />','     <help> list of vertices connected to vertex_i </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="elementconnectivity" type="',class(obj.elementconnectivity),'" default="',convert2str(obj.elementconnectivity),'">','     <section name="mesh" />','     <help> list of vertices connected to element_i </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="average_vertex_connectivity" type="',class(obj.average_vertex_connectivity),'" default="',convert2str(obj.average_vertex_connectivity),'">','     <section name="mesh" />','     <help> average number of vertices connected to one vertex </help>','  </parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');
++            
++            %extracted model
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="3" label="Extracted Model">','<section name="mesh" />'); 
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="extractedvertices" type="',class(obj.extractedvertices),'" default="',convert2str(obj.extractedvertices),'">','     <section name="mesh" />','     <help> vertices extracted from the model </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="extractedelements" type="',class(obj.extractedelements),'" default="',convert2str(obj.extractedelements),'">','     <section name="mesh" />','     <help> elements extracted from the model </help>','  </parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');
++            
++            %projection
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="4" label="Projection">','<section name="mesh" />'); 
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="lat" type="',class(obj.lat),'" default="',convert2str(obj.lat),'">','     <section name="mesh" />','     <help> vertices latitude [degrees] </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="long" type="',class(obj.long),'" default="',convert2str(obj.long),'">','     <section name="mesh" />','     <help> verticies longitude [degrees] </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','  <parameter key ="hemisphere" type="',class(obj.hemisphere),'" default="',convert2str(obj.hemisphere),'">','     <section name="mesh" />','     <help> Indicate hemisphere ''n'' or ''s'' </help>','  </parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');
++        
++        end % }}}
+ 		function marshall(obj,md,fid) % {{{
+ 			WriteData(fid,'enum',DomainTypeEnum(),'data',StringToEnum(['Domain' domaintype(obj)]),'format','Integer');
+ 			WriteData(fid,'enum',DomainDimensionEnum(),'data',dimension(obj),'format','Integer');
+Index: ../trunk-jpl/src/m/classes/rifts.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/rifts.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/rifts.m	(revision 17720)
+@@ -9,6 +9,13 @@
+ 		riftproperties = NaN;
+ 	end
+ 	methods
++        function createxml(obj,fid) % {{{
++            fprintf(fid, '\n\n');
++            fprintf(fid, '%s\n', '<!-- rifts -->');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="riftstruct" type="',              class(obj.riftstruct),'" default="',                  obj.riftstruct,'">',              '     <section name="rifts" />','     <help> structure containing all rift information (vertices coordinates, segments, type of melange, ...) </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="riftproperties" type="',            class(obj.riftproperties),'" default="',                obj.riftproperties,'">',   '     <section name="rifts" />','     <help> N/A </help>','</parameter>');
++    
++        end % }}}
+ 		function obj = rifts(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/stressbalance.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/stressbalance.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/stressbalance.m	(revision 17720)
+@@ -25,6 +25,44 @@
+ 		requested_outputs      = {};
+ 	end
+ 	methods
++        function createxml(obj,fid) % {{{
++            fprintf(fid, '\n\n');
++            fprintf(fid, '%s\n', '<!-- StressBalance solution parameters: -->');
++            
++            % Convergence criteria            
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Convergence criteria">','<section name="stressbalance" />'); 
++			 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="restol" type="',      class(obj.restol),'" default="',        convert2str(obj.restol),'">',	'     <section name="stressbalance" />','     <help> mechanical equilibrium residual convergence criterion </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="reltol" type="',          class(obj.reltol),'" default="',            convert2str(obj.reltol),'">',     '     <section name="stressbalance" />','     <help> velocity relative convergence criterion, NaN: not applied </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',	'<parameter key ="abstol" type="',        class(obj.abstol),'" default="',          convert2str(obj.abstol),'">',	'     <section name="stressbalance" />','     <help> velocity absolute convergence criterion, NaN: not applied </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="isnewton" type="',          class(obj.isnewton),'" default="',            convert2str(obj.isnewton),'">',	'     <section name="stressbalance" />','     <help> 0: Picards fixed point, 1: Newtons method, 2: hybrid </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="maxiter" type="',  	class(obj.maxiter),'" default="',       convert2str(obj.maxiter),'">',     '     <section name="stressbalance" />','     <help> maximum number of nonlinear iterations </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="viscosity_overshoot" type="',         class(obj.viscosity_overshoot),'" default="',           convert2str(obj.viscosity_overshoot),'">',	'     <section name="stressbalance" />','     <help> over-shooting constant new=new+C*(new-old) </help>','</parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');
++            
++            % boundary conditions    
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="2" label="Boundary conditions">','<section name="stressbalance" />'); 			 
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="spcvx" type="',     	class(obj.spcvx),'" default="',    	convert2str(obj.spcvx),'">',     '     <section name="stressbalance" />','     <help> x-axis velocity constraint (NaN means no constraint) [m/yr] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="spcvy" type="',     	class(obj.spcvy),'" default="',    	convert2str(obj.spcvy),'">',	'     <section name="stressbalance" />','     <help> y-axis velocity constraint (NaN means no constraint) [m/yr] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="spcvz" type="',    	class(obj.spcvz),'" default="',    	convert2str(obj.spcvz),'">',     '     <section name="stressbalance" />','     <help> z-axis velocity constraint (NaN means no constraint) [m/yr] </help>','</parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');
++            
++            % Rift options   
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="3" label="Rift options">','<section name="stressbalance" />'); 	
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="rift_penalty_threshold" type="',    	class(obj.rift_penalty_threshold),'" default="',       convert2str(obj.rift_penalty_threshold),'">',     '     <section name="stressbalance" />','     <help> threshold for instability of mechanical constraints </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    	'<parameter key ="rift_penalty_lock" type="',         class(obj.rift_penalty_lock),'" default="',           convert2str(obj.rift_penalty_lock),'">',	'     <section name="stressbalance" />','     <help> number of iterations before rift penalties are locked </help>','</parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>'); 
++            
++            %others
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="4" label="Other">','<section name="stressbalance" />'); 	
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="shelf_dampening" type="',  	class(obj.shelf_dampening),'" default="',       convert2str(obj.shelf_dampening),'">',     '     <section name="stressbalance" />','     <help> use dampening for floating ice ? Only for FS model </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',  	'<parameter key ="FSreconditioning" type="', 	class(obj.FSreconditioning),'" default="',           convert2str(obj.FSreconditioning),'">',	'     <section name="stressbalance" />','     <help> multiplier for incompressibility equation. Only for FS model </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="referential" type="',  	class(obj.referential),'" default="',       convert2str(obj.referential),'">',     '     <section name="stressbalance" />','     <help> local referential </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',  	'<parameter key ="loadingforce" type="', 	class(obj.loadingforce),'" default="',           convert2str(obj.loadingforce),'">',	'     <section name="stressbalance" />','     <help> loading force applied on each point [N/m^3] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="requested_outputs" type="',  	class(obj.requested_outputs),'" default="',       convert2str(obj.requested_outputs),'">',     '     <section name="stressbalance" />','     <help> additional outputs requested </help>','</parameter>');
++             
++            
++            fprintf(fid,'%s\n%s\n','</frame>'); 
++        end % }}}
+ 		function obj = stressbalance(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/hydrologyshreve.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/hydrologyshreve.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/hydrologyshreve.m	(revision 17720)
+@@ -14,6 +14,22 @@
+ 		stabilization  = 0;
+ 	end
+ 	methods
++        function createxml(obj,fid) % {{{
++            fprintf(fid, '\n\n');
++            fprintf(fid, '%s\n', '<!-- Hydrology -->');
++            
++            % Convergence criteria            
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Hydrologyshreve solution parameters">','<section name="hydrologyshreve" />');                    
++            
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="spcwatercolumn" type="',      class(obj.spcwatercolumn),'" default="',        convert2str(obj.spcwatercolumn),'">',	'     <section name="hydrologyshreve" />','     <help> water thickness constraints (NaN means no constraint) [m] </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="n" type="',          class(obj.n),'" default="',            convert2str(obj.n),'">',     '     <section name="hydrologyshreve" />','     <help> Manning roughness coefficient </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',	'<parameter key ="CR" type="',        class(obj.CR),'" default="',          convert2str(obj.CR),'">',	'     <section name="hydrologyshreve" />','     <help> tortuosity parameter </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="p" type="',          class(obj.p),'" default="',            convert2str(obj.p),'">',	'     <section name="hydrologyshreve" />','     <help> dimensionless exponent in Manning velocity formula </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="q" type="',  	class(obj.q),'" default="',       convert2str(obj.q),'">',     '     <section name="hydrologyshreve" />','     <help> dimensionless exponent in Manning velocity formula </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="kn" type="',         class(obj.kn),'" default="',           convert2str(obj.kn),'">',	'     <section name="hydrologyshreve" />','     <help> parameter in effective pressure formula </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="stabilization" type="',         class(obj.stabilization),'" default="',           convert2str(obj.stabilization),'">',	'     <section name="hydrologyshreve" />','     <help> artificial diffusivity (default is 1). can be more than 1 to increase diffusivity. </help>','</parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');
++        end % }}}
+ 		function obj = hydrologyshreve(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/basalforcings.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/basalforcings.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/basalforcings.m	(revision 17720)
+@@ -10,6 +10,14 @@
+ 		geothermalflux           = NaN;
+ 	end
+ 	methods
++        function createxml(obj,fid) % {{{
++            fprintf(fid, '\n\n');
++            fprintf(fid, '%s\n', '<!-- basalforcings -->');
++			 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="melting_rate" type="',            class(obj.melting_rate),'" default="',              num2str(obj.melting_rate),'">',              '     <section name="basalforcings" />','     <help> basal melting rate (positive if melting) [m/yr] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="melting_rate_correction" type="', class(obj.melting_rate_correction),'" default="',   num2str(obj.melting_rate_correction),'">',   '     <section name="basalforcings" />','     <help> additional melting applied to compensate for dh/dt [m/yr] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n',        '<parameter key ="geothermalflux" type="',          class(obj.geothermalflux),'" default="',            num2str(obj.geothermalflux),'">',            '     <section name="basalforcings" />','     <help> geothermal heat flux [W/m^2] </help>','</parameter>');
++             
++        end % }}}
+ 		function obj = basalforcings(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/flowequation.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/flowequation.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/flowequation.m	(revision 17720)
+@@ -58,6 +58,29 @@
+ 		end% }}}
+ 	end
+ 	methods
++        function createxml(obj,fid) % {{{
++            fprintf(fid, '\n\n');
++            fprintf(fid, '%s\n', '<!-- flowequation -->');
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Flow equation parameters">','<section name="flowequation" />');                    
++            
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="isSIA" type="',              class(obj.isSIA),'" default="',                  convert2str(obj.isSIA),'">',              '     <section name="flowequation" />','     <help> is the Shallow Ice Approximation (SIA) used ? </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="isSSA" type="',            class(obj.isSSA),'" default="',                convert2str(obj.isSSA),'">',   '     <section name="flowequation" />','     <help> is the Shelfy-Stream Approximation (SSA) used ? </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="isL1L2" type="',      class(obj.isL1L2),'" default="',          convert2str(obj.isL1L2),'">',            '     <section name="flowequation" />','     <help> is the L1L2 approximation used ? </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="isHO" type="',     class(obj.isHO),'" default="',         convert2str(obj.isHO),'">',            '     <section name="flowequation" />','     <help> is the Higher-Order (HO) approximation used ? </help>','</parameter>');
++            
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="isFS" type="',       class(obj.isFS),'" default="',              convert2str(obj.isFS),'">',              '     <section name="flowequation" />','     <help> are the Full-FS (FS) equations used ? </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="fe_SSA" type="',             class(obj.fe_SSA),'" default="',   convert2str(obj.fe_SSA),'">',   '     <section name="flowequation" />','     <help> Finite Element for SSA  "P1", "P1bubble" "P1bubblecondensed" "P2" </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="fe_HO" type="',        class(obj.fe_HO),'" default="',            convert2str(obj.fe_HO),'">',            '     <section name="flowequation" />','     <help> Finite Element for HO   "P1" "P1bubble" "P1bubblecondensed" "P1xP2" "P2xP1" "P2" </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="fe_FS" type="',   class(obj.fe_FS),'" default="',            convert2str(obj.fe_FS),'">',            '     <section name="flowequation" />','     <help> Finite Element for FS   "P1P1" (debugging only) "P1P1GLS" "MINIcondensed" "MINI" "TaylorHood" </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="vertex_equation" type="',      class(obj.vertex_equation),'" default="',            convert2str(obj.vertex_equation),'">',            '     <section name="flowequation" />','     <help> flow equation for each vertex </help>','</parameter>');
++       
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="element_equation" type="',            class(obj.element_equation),'" default="',              convert2str(obj.element_equation),'">',              '     <section name="flowequation" />','     <help> flow equation for each element </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="borderSSA" type="', class(obj.borderSSA),'" default="',   convert2str(obj.borderSSA),'">',   '     <section name="flowequation" />','     <help> vertices on SSAs border (for tiling) </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="borderHO" type="',          class(obj.borderHO),'" default="',            convert2str(obj.borderHO),'">',            '     <section name="flowequation" />','     <help> vertices on HOs border (for tiling) </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n',        '<parameter key ="borderFS" type="',          class(obj.borderFS),'" default="',            convert2str(obj.borderFS),'">',            '     <section name="flowequation" />','     <help> vertices on FS border (for tiling) </help>','</parameter>');
++      
++            fprintf(fid,'%s\n%s\n','</frame>');
++        end % }}}
+ 		function obj = flowequation(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/damage.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/damage.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/damage.m	(revision 17720)
+@@ -29,6 +29,54 @@
+ 		requested_outputs   = {};
+ 	end
+ 	methods
++        function createxml(obj,fid) % {{{
++            fprintf(fid, '\n\n');
++            fprintf(fid, '%s\n', '<!-- damage -->');
++            fprintf(fid, '%s\n', '<!-- Note: this class depends on different input of law -->');
++            
++            %fprintf(fid,'%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="law" type="logical"',           '" default="',                num2str(obj.law),'">',   '     <section name="damage" />','     <help> damage law (string) from {"undamaged","pralong"} </help>','</parameter>');
++            % drop-down 
++            fprintf(fid,'%s%s%s%s%s\n\t%s\n','<parameter key ="law" type="','alternative','" optional="','false','">','<section name="damage" />');
++            
++            % law = 'undamage'
++            fprintf(fid,'\t%s%s%s%s%s\n\t\t%s\n','<option value="undamage" type="','string','" default="','true','">','<help> law = undamage </help>');
++            % footer for option
++            fprintf(fid,'\t%s\n%s\n','</option>');
++            
++            % law = 'pralong'
++            fprintf(fid,'\t%s%s%s%s%s\n\t\t%s\n','<option value="pralong" type="','string','" default="','false','">','<help> law = pralong </help>');
++                
++            fprintf(fid,'\t\t%s%s%s%s%s\n\t\t\t%s\n\t\t%s\n',   '<parameter key ="stress_threshold" type="',class(obj.stress_threshold),'" default="',num2str(obj.stress_threshold),'">','<help> damage stress threshold [Pa] </help>','</parameter>');
++            fprintf(fid,'\t\t%s%s%s%s%s\n\t\t\t%s\n\t\t%s\n',	'<parameter key ="c1" type="', class(obj.c1),'" default="',   num2str(obj.c1),'">',   '<help> damage parameter 1 </help>','</parameter>');
++            fprintf(fid,'\t\t%s%s%s%s%s\n\t\t\t%s\n\t\t%s\n',  	'<parameter key ="c2" type="',          class(obj.c2),'" default="',            num2str(obj.c2),'">','<help> damage parameter 2 </help>','</parameter>');
++            fprintf(fid,'\t\t%s%s%s%s%s\n\t\t\t%s\n\t\t%s\n',  	'<parameter key ="c3" type="',          class(obj.c3),'" default="',            num2str(obj.c3),'">','<help> damage parameter 3 [W/m^2] </help>','</parameter>');
++            fprintf(fid,'\t\t%s%s%s%s%s\n\t\t\t%s\n\t\t%s\n',  	'<parameter key ="c4" type="',            class(obj.c4),'" default="',              num2str(obj.c4),'">','<help> damage parameter 4 </help>','</parameter>');
++            fprintf(fid,'\t\t%s%s%s%s%s\n\t\t\t%s\n\t\t%s\n',  	'<parameter key ="healing" type="', class(obj.healing),'" default="',   num2str(obj.healing),'">','<help> damage healing parameter 1 </help>','</parameter>');
++            fprintf(fid,'\t\t%s%s%s%s%s\n\t\t\t%s\n\t\t%s\n',  	'<parameter key ="equiv_stress" type="',          class(obj.equiv_stress),'" default="',convert2str(obj.equiv_stress),'">','<help> 0: von Mises </help>','</parameter>');
++            fprintf(fid,'\t\t%s%s%s%s%s\n\t\t\t%s\n\t\t%s\n',  	'<parameter key ="requested_outputs" type="',          class(obj.requested_outputs),'" default="',convert2str(obj.requested_outputs),'">','<help> additional outputs requested </help>','</parameter>');
++             
++                
++            % footer for option
++            fprintf(fid,'\t%s\n%s\n','</option>');
++                 
++            
++            % footer for drop-down
++            fprintf(fid,'\t%s\n%s\n%s','<help> damage law (string) from {"undamaged","pralong"} </help>','</parameter>');
++            
++            
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="D" type="',              class(obj.D),'" default="',                  num2str(obj.D),'">',              '     <section name="damage" />','     <help> damage tensor (scalar) </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="law" type="',            class(obj.law),'" default="',                num2str(obj.law),'">',   '     <section name="damage" />','     <help> damage law (string) from {"undamaged","pralong"} </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="spcdamage" type="',      class(obj.spcdamage),'" default="',          num2str(obj.spcdamage),'">',            '     <section name="damage" />','     <help> damage constraints (NaN means no constraint) </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="max_damage" type="',     class(obj.max_damage),'" default="',         num2str(obj.max_damage),'">',            '     <section name="damage" />','     <help> maximum possible damage (0&amp;lt;=max_damage&amp;lt;1) </help>','</parameter>');
++             
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="stabilization" type="',       class(obj.stabilization),'" default="',              num2str(obj.stabilization),'">',              '     <section name="damage" />','     <help> 0: no, 1: artificial_diffusivity, 2: SUPG </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="maxiter" type="',             class(obj.maxiter),'" default="',   num2str(obj.maxiter),'">',   '     <section name="damage" />','     <help> maximum number of non linear iterations </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="penalty_lock" type="',        class(obj.penalty_lock),'" default="',            num2str(obj.penalty_lock),'">',            '     <section name="damage" />','     <help> stabilize unstable damage constraints that keep zigzagging after n iteration (default is 0, no stabilization) </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="penalty_threshold" type="',   class(obj.penalty_threshold),'" default="',            num2str(obj.penalty_threshold),'">',            '     <section name="damage" />','     <help> threshold to declare convergence of damage evolution solution (default is 0) </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="penalty_factor" type="',      class(obj.penalty_factor),'" default="',            num2str(obj.penalty_factor),'">',            '     <section name="damage" />','     <help> scaling exponent (default is 3) </help>','</parameter>');
++ 
++        end % }}}
++        
+ 		function obj = damage(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/masstransport.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/masstransport.m	(revision 17719)
++++ ../trunk-jpl/src/m/classes/masstransport.m	(revision 17720)
+@@ -42,6 +42,27 @@
+ 		end% }}}
+ 	end
+ 	methods
++         function createxml(obj,fid) % {{{
++            fprintf(fid, '<!-- masstransport -->\n');            
++                    
++            % Masstransport solution parameters
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Masstransport solution parameters">','<section name="masstransport" />');                    
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="spcthickness" type="',class(obj.spcthickness),'" default="',convert2str(obj.spcthickness),'">','     <section name="masstransport" />','     <help> thickness constraints (NaN means no constraint) [m] </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="calvingrate" type="',class(obj.calvingrate),'" default="',convert2str(obj.calvingrate),'">','     <section name="masstransport" />','     <help> calving rate at given location [m/a] </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="isfreesurface" type="',class(obj.isfreesurface),'" default="',convert2str(obj.isfreesurface),'">','     <section name="masstransport" />','     <help> do we use free surfaces (FS only) are mass conservation </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="min_thickness" type="',class(obj.min_thickness),'" default="',convert2str(obj.min_thickness),'">','     <section name="masstransport" />','     <help> minimum ice thickness allowed [m] </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="hydrostatic_adjustment" type="',class(obj.hydrostatic_adjustment),'" default="',convert2str(obj.hydrostatic_adjustment),'">','     <section name="masstransport" />','     <help> adjustment of ice shelves surface and bed elevations: ''Incremental'' or ''Absolute''  </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="stabilization" type="',class(obj.stabilization),'" default="',convert2str(obj.stabilization),'">','     <section name="masstransport" />','     <help> 0: no, 1:  artificial_diffusivity, 2: streamline upwinding, 3: discontinuous Galerkin </help>','  </parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');    
++            
++            %Penalty options
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="2" label="Penalty options">','<section name="masstransport" />'); 
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertex_pairing" type="',class(obj.vertex_pairing),'" default="',convert2str(obj.vertex_pairing),'">','     <section name="masstransport" />','     <help> offset used by penalties: penalty = Kmax*10^offset </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="penalty_factor" type="',class(obj.penalty_factor),'" default="',convert2str(obj.penalty_factor),'">','     <section name="masstransport" />','     <help> pairs of vertices that are penalized </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="requested_outputs" type="',class(obj.requested_outputs),'" default="',convert2str(obj.requested_outputs),'">','     <section name="masstransport" />','     <help> additional outputs requested </help>','  </parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');
++        
++        end % }}}
+ 		function obj = masstransport(varargin) % {{{
+ 			switch nargin
+ 				case 0
Index: issm/oecreview/Archive/16554-17801/ISSM-17720-17721.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17720-17721.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17720-17721.diff	(revision 17802)
@@ -0,0 +1,182 @@
+Index: ../trunk-jpl/src/m/solve/createxml.m
+===================================================================
+--- ../trunk-jpl/src/m/solve/createxml.m	(revision 0)
++++ ../trunk-jpl/src/m/solve/createxml.m	(revision 17721)
+@@ -0,0 +1,42 @@
++function createxml(xmlfilename,md)
++%EXTRUDEXML - output an XML file compatible with inishell for automatic gui generation
++%
++%   The routine creates an XML file that list fields from the underlying classes 
++%   in model, and that can be use to render a GUI using the java code inishell
++%
++%   Usage:
++%      createxml(md,xmlfilename)
++
++disp(['creating XML file ' xmlfilename]);
++
++%open file for binary writing
++fid=fopen(xmlfilename,'w');
++if fid==-1,
++	error(['extrudexml error message: could not open ' xmlfilename,' file for ASCII writing']);
++end
++
++%Go through all model fields: check that it is a class and call checkconsistency
++fields=properties('model');
++fprintf(fid, '<inishell_config application="ISSM prototype">\n\n'); % require header for xml file
++for i=1:length(fields), 
++	field=fields{i};
++
++	%Some properties do not need to XML rendered
++	if ismember(field,{'results' 'radaroverlay' 'toolkits' 'private'}),
++		continue;
++	end
++
++	%Check that current field is an object
++	if ~isobject(md.(field))
++		error(['field ''' char(field) ''' is not an object']);
++	end
++
++	%Create XML file for this subclass
++	createxml(md.(field),fid);
++end
++fprintf(fid, '\n\n</inishell_config>'); % require footer for xml file
++%close file
++st=fclose(fid);
++if st==-1,
++	error(['createxml error message: could not close file ' xmlfilename]);
++end
+Index: ../trunk-jpl/src/m/solve/convert2str.m
+===================================================================
+--- ../trunk-jpl/src/m/solve/convert2str.m	(revision 0)
++++ ../trunk-jpl/src/m/solve/convert2str.m	(revision 17721)
+@@ -0,0 +1,130 @@
++function str = convert2str(field)
++
++	str = parsedisplay(field);
++
++end %function
++
++function str = parsedisplay(field) % {{{
++
++	%string
++	if ischar(field),
++
++		if length(field)>30;
++			%str = displayunit('not displayed');
++            str=field;
++		else
++			str = displayunit(['''' field '''']);
++		end
++
++	%cell
++    elseif iscell(field),
++		str = cell_display(field),
++
++    %structure
++	elseif isstruct(field),
++		str = struct_display(field),
++        
++	%numeric
++	elseif isnumeric(field)
++
++		%get size
++		fieldsize=size(field);
++
++		%double
++		if max(fieldsize)==1,
++			str = displayunit(num2str(field)),
++			%matrix
++		else
++			str = displayunit(['(' num2str(fieldsize(1)) 'x' num2str(fieldsize(2)) ')']),
++        end
++        
++ 	%logical
++	elseif islogical(field)
++
++		%get size
++		fieldsize=size(field);
++
++		%single value
++		if max(fieldsize)==1,
++			if (field)
++				str = displayunit('true');
++			else
++				str = displayunit('false');
++			end
++		%matrix
++		else
++			str = displayunit(name,['(' num2str(fieldsize(1)) 'x' num2str(fieldsize(2)) ')']);
++        end    
++        
++    %misc/
++    else
++        str = displayunit(field);
++
++    end
++
++end
++
++function str = displayunit(characterization)% {{{
++
++	%take care of characterization
++	if (strcmp(characterization,['''' '''']) || strcmp(characterization,'NaN')),
++		characterization='N/A';
++	end
++	if length(characterization)>15,
++		characterization=[characterization(1:12) '...'];
++    end
++    
++    str = characterization;
++	
++end% }}}
++
++function str = cell_display(field)
++
++	%initialization
++	string='{';
++
++	%go through the cell and fill string
++	if length(field)<5;
++		for i=1:length(field),
++			if ischar(field{i}),
++				string=[string ''''  field{i} ''','];
++			elseif (isnumeric(field{i}) & length(field{i})==1)
++				string=[string num2str(field{i}) ',' ];
++			else
++				string='{';
++				break
++			end
++		end
++	end
++	if strcmp(string,'{'),
++		string=['(' num2str(size(field,1)) 'x' num2str(size(field,2)) ')'];
++	else
++		string=[string(1:end-1) '}'];
++    end
++    str = string;
++    
++    %disp(sprintf(string));
++end
++
++function str = struct_display(field) % {{{
++
++	if ~isempty(fields(field))
++		displayunit('(structure)'),
++
++		structure_fields=fields(field);
++
++		for i=1:length(structure_fields),
++
++			%get current field
++			sfield=field.(structure_fields{i});
++
++			%display value
++			%parsedisplay(sfield);
++            str = sfield;
++		end
++
++	else
++		%displayunit('N/A'),
++        str = 'N/A';
++	end
++end% }}}
Index: issm/oecreview/Archive/16554-17801/ISSM-17721-17722.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17721-17722.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17721-17722.diff	(revision 17802)
@@ -0,0 +1,12826 @@
+Index: ../trunk-jpl/src/java/build/gui_elements/PathPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/PathPanel.class
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/gui_elements/IntegerPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/IntegerPanel.class
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/gui_elements/DecimalPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/DecimalPanel.class
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/gui_elements/GUIBuildException.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/GUIBuildException.class
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/gui_elements/CombinedPanel$1.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/CombinedPanel$1.class
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/gui_elements/ControlledPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/ControlledPanel.class
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/gui_elements/DuplicatorPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/DuplicatorPanel.class
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/gui_elements/OptionPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/OptionPanel.class
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/gui_elements/AlternativePanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/AlternativePanel.class
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/gui_elements/CombinedPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/CombinedPanel.class
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/gui_elements/SelectorPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/SelectorPanel.class
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/gui_elements/ColorCellRenderer.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/ColorCellRenderer.class
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/gui_elements/CheckBoxPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/CheckBoxPanel.class
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/gui_elements/CombinedPanel$Type.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/CombinedPanel$Type.class
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/gui_elements/TextfieldPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/TextfieldPanel.class
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/gui_elements/FramePanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/FramePanel.class
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/main/GUIBuilder.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/main/GUIBuilder.class
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/main/GUIBuilder$1.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/main/GUIBuilder$1.class
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/main/PanelControl.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/main/PanelControl.class
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/main/XMLHelper.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/main/XMLHelper.class
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/main/GUI.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/main/GUI.class
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/main/PanelNode.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/main/PanelNode.class
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/resources/document-open-2.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/resources/document-open-2.png
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/resources/document-preview.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/resources/document-preview.png
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/resources/document-export-4.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/resources/document-export-4.png
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/resources/config_schema.xsd
+===================================================================
+--- ../trunk-jpl/src/java/build/resources/config_schema.xsd	(revision 0)
++++ ../trunk-jpl/src/java/build/resources/config_schema.xsd	(revision 17722)
+@@ -0,0 +1,141 @@
++<?xml version="1.0"?>
++<!-- 
++*   
++*	This file is part of INIshell.
++*
++*   INIshell is free software: you can redistribute it and/or modify
++*   it under the terms of the GNU General Public License as published by
++*   the Free Software Foundation, either version 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell is distributed in the hope that it will be useful,
++*   but WITHOUT ANY WARRANTY; without even the implied warranty of
++*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++*   GNU General Public License for more details.
++*
++*   You should have received a copy of the GNU General Public License
++*   along with INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*    	
++* -->
++
++<xsd:schema version="1.0"
++xmlns:xsd="http://www.w3.org/2001/XMLSchema">
++
++  <xsd:element name="inishell_config" type="general" />
++  
++	<xsd:complexType name="general">
++      <xsd:choice maxOccurs="unbounded">
++			<xsd:element name="parameter" type="parametertype" />
++			<xsd:element name="parametergroup" type="pargroup" />
++			<xsd:element name="include" type="pathonly" /> 
++      </xsd:choice>
++	  <xsd:attribute name="application" />
++    </xsd:complexType>
++	
++	<xsd:complexType name="parametertype">
++		<xsd:complexContent>
++			<xsd:extension base="parbasetype">
++				<xsd:attribute name="key" type="xsd:string" use="required"/> 
++				<xsd:attribute name="default" type="xsd:string" />
++				<xsd:attribute name="counter" type="xsd:integer" />
++			</xsd:extension>
++		</xsd:complexContent>		
++	</xsd:complexType>
++   
++   <xsd:complexType name="nameonly">
++		<xsd:attribute name="name" />   
++   </xsd:complexType>
++   
++   <xsd:complexType name="pathonly">
++		<xsd:attribute name="path" />   
++   </xsd:complexType>
++   
++	<xsd:complexType name="pargroup">
++		<xsd:choice minOccurs="1" maxOccurs="unbounded">
++			<xsd:element name="parameter" type="parametertype" />
++			<xsd:element name="reference" type="nameonly" />
++		</xsd:choice>
++		<xsd:attribute name="name" />
++	</xsd:complexType>
++  
++	
++	<xsd:complexType name="parbasetype">
++		<xsd:sequence>
++			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
++				<xsd:element name="section" type="nameonly"/>
++			</xsd:sequence>
++			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
++				<xsd:element name="replace" type="nameonly"/>
++			</xsd:sequence>
++			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
++				<xsd:element name="parameter" type="parametertype" />
++			</xsd:sequence>
++			<xsd:choice minOccurs="0" maxOccurs="unbounded">				
++				<xsd:element name="option" minOccurs="0">
++					<xsd:complexType>
++						<xsd:complexContent>
++							<xsd:extension base="parbasetype">
++								<xsd:attribute name="value" type="xsd:string" use="required" />
++								<xsd:attribute name="label" type="xsd:string" use="optional" />
++								<xsd:attribute name="default" type="xsd:boolean"/>
++							</xsd:extension>
++						</xsd:complexContent>
++					</xsd:complexType>
++				</xsd:element>
++			</xsd:choice>
++			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
++				<xsd:element name="reference" type="nameonly" />
++			</xsd:sequence>
++			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
++				<xsd:element name="help" type="helptype"/>	
++			</xsd:sequence>
++		</xsd:sequence>
++		
++		<xsd:attribute name="type" use="required">
++		     <xsd:simpleType>
++				<xsd:restriction base="xsd:string">
++					<xsd:enumeration value="integer" />
++					<xsd:enumeration value="integer+" />
++					<xsd:enumeration value="decimal" />
++					<xsd:enumeration value="path" />
++					<xsd:enumeration value="file" />
++					<xsd:enumeration value="choice" />
++					<xsd:enumeration value="alternative" />
++					<xsd:enumeration value="string" />
++					<xsd:enumeration value="combination" />
++					<xsd:enumeration value="selector" />
++				</xsd:restriction>
++			</xsd:simpleType>
++		</xsd:attribute>
++		
++		<xsd:attribute name="maximum" type="xsd:integer"/>
++		<xsd:attribute name="minimum" type="xsd:integer"/>
++		<xsd:attribute name="template" type="xsd:boolean" default="false" use="optional" />
++		<xsd:attribute name="optional" type="xsd:boolean" default="true" />
++	</xsd:complexType>
++	
++	<xsd:complexType name="needstype">
++		<xsd:attribute name="type" type="xsd:string" use="required" />
++		<xsd:attribute name="name" type="xsd:string" use="required" />
++	
++		<xsd:attribute name="value" />
++		<xsd:attribute name="optional" type="xsd:boolean" />
++		<xsd:attribute name="minoccur" type="xsd:integer" />
++		<xsd:attribute name="maxoccur" type="xsd:string" />
++	</xsd:complexType>
++	
++	<xsd:complexType name="baseType">
++		<xsd:sequence minOccurs="0" maxOccurs="1">
++			<xsd:element name="help" type="helptype" />		
++		</xsd:sequence>
++		<xsd:attribute name="key" type="xsd:string" use="required" />
++	</xsd:complexType>
++	
++	<xsd:complexType name="helptype" mixed="true">
++		<xsd:choice minOccurs="0" maxOccurs="unbounded">
++			<xsd:element name="section" type="nameonly" />
++			<xsd:element name="replace" type="nameonly" />
++		</xsd:choice>
++	</xsd:complexType>
++	
++</xsd:schema>
+
+Property changes on: ../trunk-jpl/src/java/build/resources/config_schema.xsd
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/resources/default_config.xml
+===================================================================
+--- ../trunk-jpl/src/java/build/resources/default_config.xml	(revision 0)
++++ ../trunk-jpl/src/java/build/resources/default_config.xml	(revision 17722)
+@@ -0,0 +1,1284 @@
++<inishell_config application="ISSM prototype">
++
++<!-- mesh -->
++<parameter key ="Dimension" type="alternative" optional="false">
++     <section name="mesh" />
++     <option value="0" type="string" default="true">
++        <help> dimension is 0 </help>
++     </option>
++     <option value="3" type="string">
++        <help> dimension is 3 </help>
++       <!-- Elements and vertices of the original 2d mesh -->
++          <parameter key ="x2d" type="double" default="N/A">
++              <help> vertices x coordinate [m] </help>
++          </parameter>
++          <parameter key ="y2d" type="double" default="N/A">
++              <help> vertices y coordinate [m] </help>
++          </parameter>
++          <parameter key ="elements2d" type="double" default="N/A">
++              <help> vertex indices of the mesh elements </help>
++          </parameter>
++          <parameter key ="numberofvertices2d" type="double" default="0">
++              <help> number of vertices </help>
++          </parameter>
++          <parameter key ="numberofelements2d" type="double" default="0">
++              <help> number of elements </help>
++          </parameter>
++     </option>
++     <help> select a mesh dimension 0(default) or 3 </help>
++</parameter>
++<frame key="1" label="Elements and vertices">
++<section name="mesh" />
++  <parameter key ="numberofelements" type="double" default="0">
++     <section name="mesh" />
++     <help> number of elements </help>
++  </parameter>
++  <parameter key ="numberofvertices" type="double" default="0">
++     <section name="mesh" />
++     <help> number of verticies </help>
++  </parameter>
++  <parameter key ="elements" type="double" default="N/A">
++     <section name="mesh" />
++     <help> vertex indices of the mesh elements </help>
++  </parameter>
++  <parameter key ="x" type="double" default="N/A">
++     <section name="mesh" />
++     <help> vertices x coordinate [m] </help>
++  </parameter>
++  <parameter key ="y" type="double" default="N/A">
++     <section name="mesh" />
++     <help> vertices y coordinate [m] </help>
++  </parameter>
++  <parameter key ="z" type="double" default="N/A">
++     <section name="mesh" />
++     <help> vertices z coordinate [m] </help>
++  </parameter>
++  <parameter key ="edges" type="double" default="N/A">
++     <section name="mesh" />
++     <help> edges of the 2d mesh (vertex1 vertex2 element1 element2) </help>
++  </parameter>
++  <parameter key ="numberofedges" type="double" default="0">
++     <section name="mesh" />
++     <help> number of edges of the 2d mesh </help>
++  </parameter>
++</frame>
++<frame key="2" label="Properties">
++<section name="mesh" />
++  <parameter key ="selected dimension" type="double" default="0">
++     <section name="mesh" />
++     <help> mesh dimension </help>
++  </parameter>
++  <parameter key ="numberoflayers" type="double" default="0">
++     <section name="mesh" />
++     <help> number of extrusion layers </help>
++  </parameter>
++  <parameter key ="vertexonbed" type="double" default="N/A">
++     <section name="mesh" />
++     <help> lower vertices flags list </help>
++  </parameter>
++  <parameter key ="elementonbed" type="double" default="N/A">
++     <section name="mesh" />
++     <help> lower elements flags list </help>
++  </parameter>
++  <parameter key ="vertexonsurface" type="double" default="N/A">
++     <section name="mesh" />
++     <help> upper vertices flags list </help>
++  </parameter>
++  <parameter key ="elementonsurface" type="double" default="N/A">
++     <section name="mesh" />
++     <help> upper element flag list </help>
++  </parameter>
++  <parameter key ="uppervertex" type="double" default="N/A">
++     <section name="mesh" />
++     <help> upper vertex list (NaN for vertex on the upper surface) </help>
++  </parameter>
++  <parameter key ="upperelements" type="double" default="N/A">
++     <section name="mesh" />
++     <help> upper element list (NaN for element on the upper layer) </help>
++  </parameter>
++  <parameter key ="lowervertex" type="double" default="N/A">
++     <section name="mesh" />
++     <help> lower vertex list (NaN for vertex on the lower surface) </help>
++  </parameter>
++  <parameter key ="lowerelements" type="double" default="N/A">
++     <section name="mesh" />
++     <help> lower element list (NaN for element on the lower layer </help>
++  </parameter>
++  <parameter key ="vertexonboundary" type="double" default="N/A">
++     <section name="mesh" />
++     <help> vertices on the boundary of the domain flag list </help>
++  </parameter>
++  <parameter key ="segments" type="double" default="N/A">
++     <section name="mesh" />
++     <help> edges on domain boundary (vertex1 vertex2 element) </help>
++  </parameter>
++  <parameter key ="segmentmarkers" type="double" default="N/A">
++     <section name="mesh" />
++     <help> number associated to each segment </help>
++  </parameter>
++  <parameter key ="vertexconnectivity" type="double" default="N/A">
++     <section name="mesh" />
++     <help> list of vertices connected to vertex_i </help>
++  </parameter>
++  <parameter key ="elementconnectivity" type="double" default="N/A">
++     <section name="mesh" />
++     <help> list of vertices connected to element_i </help>
++  </parameter>
++  <parameter key ="average_vertex_connectivity" type="double" default="25">
++     <section name="mesh" />
++     <help> average number of vertices connected to one vertex </help>
++  </parameter>
++</frame>
++<frame key="3" label="Extracted Model">
++<section name="mesh" />
++  <parameter key ="extractedvertices" type="double" default="N/A">
++     <section name="mesh" />
++     <help> vertices extracted from the model </help>
++  </parameter>
++  <parameter key ="extractedelements" type="double" default="N/A">
++     <section name="mesh" />
++     <help> elements extracted from the model </help>
++  </parameter>
++</frame>
++<frame key="4" label="Projection">
++<section name="mesh" />
++  <parameter key ="lat" type="double" default="N/A">
++     <section name="mesh" />
++     <help> vertices latitude [degrees] </help>
++  </parameter>
++  <parameter key ="long" type="double" default="N/A">
++     <section name="mesh" />
++     <help> verticies longitude [degrees] </help>
++  </parameter>
++  <parameter key ="hemisphere" type="double" default="N/A">
++     <section name="mesh" />
++     <help> Indicate hemisphere 'n' or 's' </help>
++  </parameter></frame>
++
++
++<!-- mask -->
++<parameter key ="groundedice_levelset" type="double" default="NaN">
++     <section name="mask" />
++     <help> is ice grounded ? grounded ice if > 0, grounding line position if = 0, floating ice if &amp;lt; 0 </help>
++</parameter>
++<parameter key ="ice_levelset" type="double" default="NaN">
++     <section name="mask" />
++     <help> presence of ice if > 0, icefront position if = 0, no ice if &amp;lt; 0 </help>
++</parameter>
++
++<!-- geometry -->
++<frame key="1" label="Geometry parameters">
++<section name="geometry" />
++<parameter key ="surface" type="path" optional="false">
++     <section name="geometry" />
++     <help> surface elevation [m] </help>
++</parameter>
++<parameter key ="thickness" type="path" optional="false">
++     <section name="geometry" />
++     <help> ice thickness [m] </help>
++</parameter>
++<parameter key ="bed" type="path" optional="false">
++     <section name="geometry" />
++     <help> bed elevation [m] </help>
++</parameter>
++<parameter key ="bathymetry" type="double" default="N/A">
++     <section name="geometry" />
++     <help> bathymetry elevation [m] </help>
++</parameter>
++<parameter key ="hydrostatic_ratio" type="double" default="N/A">
++     <section name="geometry" />
++     <help> coefficient for ice shelves; thickness correction: hydrostatic_ratio H_obs+ (1-hydrostatic_ratio) H_hydro </help>
++</parameter></frame>
++
++
++<!-- constants -->
++<parameter key ="g" type="double" default="9.81">
++     <section name="constants" />
++     <help> gravitational acceleration [m/s^2] </help>
++</parameter>
++<parameter key ="yts" type="double" default="31536000">
++     <section name="constants" />
++     <help> number of seconds in a year [s/yr] </help>
++</parameter>
++<parameter key ="referencetemperature" type="double" default="223.15">
++     <section name="constants" />
++     <help> reference temperature used in the enthalpy model [K] </help>
++</parameter>
++
++<!-- surfaceforcings(SMB) -->
++<parameter key ="mass_balance" type="double" default="NaN">
++     <section name="surfaceforcings(SMB)" />
++     <help> surface mass balance [m/yr ice eq] </help>
++</parameter>
++
++<!-- basalforcings -->
++<parameter key ="melting_rate" type="double" default="NaN">
++     <section name="basalforcings" />
++     <help> basal melting rate (positive if melting) [m/yr] </help>
++</parameter>
++<parameter key ="melting_rate_correction" type="double" default="NaN">
++     <section name="basalforcings" />
++     <help> additional melting applied to compensate for dh/dt [m/yr] </help>
++</parameter>
++<parameter key ="geothermalflux" type="double" default="NaN">
++     <section name="basalforcings" />
++     <help> geothermal heat flux [W/m^2] </help>
++</parameter>
++
++<!-- materials -->
++<parameter key ="rho_ice" type="double" default="917">
++     <section name="materials" />
++     <help> ice density [kg/m^3] </help>
++</parameter>
++<parameter key ="rho_water" type="double" default="1023">
++     <section name="materials" />
++     <help> ocean water density [kg/m^3] </help>
++</parameter>
++<parameter key ="rho_freshwater" type="double" default="1000">
++     <section name="materials" />
++     <help> fresh water density [kg/m^3] </help>
++</parameter>
++<parameter key ="mu_water" type="double" default="0.001787">
++     <section name="materials" />
++     <help> water viscosity [N s/m^2] </help>
++</parameter>
++<parameter key ="heatcapacity" type="double" default="2093">
++     <section name="materials" />
++     <help> heat capacity [J/kg/K] </help>
++</parameter>
++<parameter key ="latentheat" type="double" default="334000">
++     <section name="materials" />
++     <help> latent heat of fusion [J/kg] </help>
++</parameter>
++<parameter key ="thermalconductivity" type="double" default="2.4">
++     <section name="materials" />
++     <help> ice thermal conductivity [W/m/K] </help>
++</parameter>
++<parameter key ="temperateiceconductivity" type="double" default="0.24">
++     <section name="materials" />
++     <help> temperate ice thermal conductivity [W/m/K] </help>
++</parameter>
++<parameter key ="meltingpoint" type="double" default="273.15">
++     <section name="materials" />
++     <help> melting point of ice at 1atm in K </help>
++</parameter>
++<parameter key ="beta" type="double" default="9.8e-08">
++     <section name="materials" />
++     <help> rate of change of melting point with pressure [K/Pa] </help>
++</parameter>
++<parameter key ="mixed_layer_capacity" type="double" default="3974">
++     <section name="materials" />
++     <help> mixed layer capacity [W/kg/K] </help>
++</parameter>
++<parameter key ="thermal_exchange_velocity" type="double" default="0.0001">
++     <section name="materials" />
++     <help> thermal exchange velocity [m/s] </help>
++</parameter>
++<parameter key ="rheology_B" type="double" default="N/A">
++     <section name="materials" />
++     <help> flow law parameter [Pa/s^(1/n)] </help>
++</parameter>
++<parameter key ="rheology_n" type="double" default="N/A">
++     <section name="materials" />
++     <help> Glens flow law exponent </help>
++</parameter>
++<parameter key ="rheology_law" type="char" default="'Paterson'">
++     <section name="materials" />
++     <help> law for the temperature dependance of the rheology: "None", "Paterson",  "Arrhenius" or "LliboutryDuval" </help>
++</parameter>
++<parameter key ="lithosphere_shear_modulus" type="double" default="67000000000">
++     <section name="materials" />
++     <help> Lithosphere shear modulus [Pa] </help>
++</parameter>
++<parameter key ="lithosphere_density" type="double" default="3.32">
++     <section name="materials" />
++     <help> Lithosphere density [g/cm^-3] </help>
++</parameter>
++<parameter key ="mantle_shear_modulus" type="double" default="145000000000">
++     <section name="materials" />
++     <help> Mantle shear modulus [Pa] </help>
++</parameter>
++<parameter key ="mantle_density" type="double" default="3.34">
++     <section name="materials" />
++     <help> Mantle density [g/cm^-3] </help>
++</parameter>
++
++
++<!-- damage -->
++<!-- Note: this class depends on different input of law -->
++<parameter key ="law" type="alternative" optional="false">
++	<section name="damage" />
++	<option value="undamage" type="string" default="true">
++		<help> law = undamage </help>
++	</option>
++	<option value="pralong" type="string" default="false">
++		<help> law = pralong </help>
++		<parameter key ="stress_threshold" type="double" default="0">
++			<help> damage stress threshold [Pa] </help>
++		</parameter>
++		<parameter key ="c1" type="double" default="0">
++			<help> damage parameter 1 </help>
++		</parameter>
++		<parameter key ="c2" type="double" default="0">
++			<help> damage parameter 2 </help>
++		</parameter>
++		<parameter key ="c3" type="double" default="0">
++			<help> damage parameter 3 [W/m^2] </help>
++		</parameter>
++		<parameter key ="c4" type="double" default="0">
++			<help> damage parameter 4 </help>
++		</parameter>
++		<parameter key ="healing" type="double" default="0">
++			<help> damage healing parameter 1 </help>
++		</parameter>
++		<parameter key ="equiv_stress" type="double" default="0">
++			<help> 0: von Mises </help>
++		</parameter>
++		<parameter key ="requested_outputs" type="cell" default="{'default'}">
++			<help> additional outputs requested </help>
++		</parameter>
++	</option>
++	<help> damage law (string) from {"undamaged","pralong"} </help>
++</parameter>
++<parameter key ="D" type="double" default="0">
++     <section name="damage" />
++     <help> damage tensor (scalar) </help>
++</parameter>
++<parameter key ="law" type="char" default="undamaged">
++     <section name="damage" />
++     <help> damage law (string) from {"undamaged","pralong"} </help>
++</parameter>
++<parameter key ="spcdamage" type="double" default="NaN">
++     <section name="damage" />
++     <help> damage constraints (NaN means no constraint) </help>
++</parameter>
++<parameter key ="max_damage" type="double" default="0.99999">
++     <section name="damage" />
++     <help> maximum possible damage (0&amp;lt;=max_damage&amp;lt;1) </help>
++</parameter>
++<parameter key ="stabilization" type="double" default="2">
++     <section name="damage" />
++     <help> 0: no, 1: artificial_diffusivity, 2: SUPG </help>
++</parameter>
++<parameter key ="maxiter" type="double" default="100">
++     <section name="damage" />
++     <help> maximum number of non linear iterations </help>
++</parameter>
++<parameter key ="penalty_lock" type="double" default="0">
++     <section name="damage" />
++     <help> stabilize unstable damage constraints that keep zigzagging after n iteration (default is 0, no stabilization) </help>
++</parameter>
++<parameter key ="penalty_threshold" type="double" default="0">
++     <section name="damage" />
++     <help> threshold to declare convergence of damage evolution solution (default is 0) </help>
++</parameter>
++<parameter key ="penalty_factor" type="double" default="3">
++     <section name="damage" />
++     <help> scaling exponent (default is 3) </help>
++</parameter>
++
++
++<!-- Friction: Sigma= drag^2 * Neff ^r * u ^s, with Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p -->
++<frame key="1" label="Friction: Sigma= drag^2 * Neff ^r * u ^s, with Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p">
++<section name="friction" />
++<parameter key ="coefficient" type="double" default="N/A">
++     <section name="friction" />
++     <help> friction coefficient [SI] </help>
++</parameter>
++<parameter key ="p" type="double" default="N/A">
++     <section name="friction" />
++     <help> p exponent </help>
++</parameter>
++<parameter key ="q" type="double" default="N/A">
++     <section name="friction" />
++     <help> q exponent </help>
++</parameter></frame>
++
++
++<!-- flowequation -->
++<frame key="1" label="Flow equation parameters">
++<section name="flowequation" />
++<parameter key ="isSIA" type="double" default="0">
++     <section name="flowequation" />
++     <help> is the Shallow Ice Approximation (SIA) used ? </help>
++</parameter>
++<parameter key ="isSSA" type="double" default="0">
++     <section name="flowequation" />
++     <help> is the Shelfy-Stream Approximation (SSA) used ? </help>
++</parameter>
++<parameter key ="isL1L2" type="double" default="0">
++     <section name="flowequation" />
++     <help> is the L1L2 approximation used ? </help>
++</parameter>
++<parameter key ="isHO" type="double" default="0">
++     <section name="flowequation" />
++     <help> is the Higher-Order (HO) approximation used ? </help>
++</parameter>
++<parameter key ="isFS" type="double" default="0">
++     <section name="flowequation" />
++     <help> are the Full-FS (FS) equations used ? </help>
++</parameter>
++<parameter key ="fe_SSA" type="char" default="'P1'">
++     <section name="flowequation" />
++     <help> Finite Element for SSA  "P1", "P1bubble" "P1bubblecondensed" "P2" </help>
++</parameter>
++<parameter key ="fe_HO" type="char" default="'P1'">
++     <section name="flowequation" />
++     <help> Finite Element for HO   "P1" "P1bubble" "P1bubblecondensed" "P1xP2" "P2xP1" "P2" </help>
++</parameter>
++<parameter key ="fe_FS" type="char" default="'MINIcondensed'">
++     <section name="flowequation" />
++     <help> Finite Element for FS   "P1P1" (debugging only) "P1P1GLS" "MINIcondensed" "MINI" "TaylorHood" </help>
++</parameter>
++<parameter key ="vertex_equation" type="double" default="N/A">
++     <section name="flowequation" />
++     <help> flow equation for each vertex </help>
++</parameter>
++<parameter key ="element_equation" type="double" default="N/A">
++     <section name="flowequation" />
++     <help> flow equation for each element </help>
++</parameter>
++<parameter key ="borderSSA" type="double" default="N/A">
++     <section name="flowequation" />
++     <help> vertices on SSAs border (for tiling) </help>
++</parameter>
++<parameter key ="borderHO" type="double" default="N/A">
++     <section name="flowequation" />
++     <help> vertices on HOs border (for tiling) </help>
++</parameter>
++<parameter key ="borderFS" type="double" default="N/A">
++     <section name="flowequation" />
++     <help> vertices on FS border (for tiling) </help>
++</parameter></frame>
++
++
++<!-- Timestepping -->
++<parameter key ="start_time" type="double" default="0">
++     <section name="timestepping" />
++     <help> simulation starting time [yr] </help>
++</parameter>
++<parameter key ="final_time" type="double" default="5">
++     <section name="timestepping" />
++     <help> final time to stop the simulation [yr] </help>
++</parameter>
++<parameter key ="time_step" type="double" default="0.5">
++     <section name="timestepping" />
++     <help> length of time steps [yr] </help>
++</parameter>
++<parameter key ="time_adapt" type="double" default="0">
++     <section name="timestepping" />
++     <help> use cfl condition to define time step ? (0 or 1)  </help>
++</parameter>
++<parameter key ="cfl_coefficient" type="double" default="0.5">
++     <section name="timestepping" />
++     <help> coefficient applied to cfl condition </help>
++</parameter>
++
++
++<!-- initialization -->
++<frame key="1" label="Initial field values">
++<section name="initialization" />
++<parameter key ="vx" type="double" default="NaN">
++     <section name="initialization" />
++     <help> x component of velocity [m/yr] </help>
++</parameter>
++<parameter key ="vy" type="double" default="NaN">
++     <section name="initialization" />
++     <help> y component of velocity [m/yr] </help>
++</parameter>
++<parameter key ="vz" type="double" default="NaN">
++     <section name="initialization" />
++     <help> z component of velocity [m/yr] </help>
++</parameter>
++<parameter key ="vel" type="double" default="NaN">
++     <section name="initialization" />
++     <help> velocity norm [m/yr] </help>
++</parameter>
++<parameter key ="pressure" type="double" default="NaN">
++     <section name="initialization" />
++     <help> pressure field [Pa] </help>
++</parameter>
++<parameter key ="temperature" type="double" default="NaN">
++     <section name="initialization" />
++     <help> fraction of water in the ice </help>
++</parameter>
++<parameter key ="waterfraction" type="double" default="NaN">
++     <section name="initialization" />
++     <help> ice thickness [m] </help>
++</parameter>
++<parameter key ="sediment_head" type="double" default="NaN">
++     <section name="initialization" />
++     <help> sediment water head of subglacial system [m] </help>
++</parameter>
++<parameter key ="epl_head" type="double" default="NaN">
++     <section name="initialization" />
++     <help> epl water head of subglacial system [m] </help>
++</parameter>
++<parameter key ="watercolumn" type="double" default="NaN">
++     <section name="initialization" />
++     <help> thickness of subglacial water [m] </help>
++</parameter></frame>
++
++
++<!-- rifts -->
++<parameter key ="riftstruct" type="double" default="NaN">
++     <section name="rifts" />
++     <help> structure containing all rift information (vertices coordinates, segments, type of melange, ...) </help>
++</parameter>
++<parameter key ="riftproperties" type="double" default="NaN">
++     <section name="rifts" />
++     <help> N/A </help>
++</parameter>
++
++
++<!-- Debug -->
++<parameter key ="valgrind" type="logical" optional="false">
++     <section name="debug" />
++        <option value="false" type="string" default="true"></option>
++     <help> use Valgrind to debug (0 or 1) </help>
++</parameter>
++<parameter key ="gprof" type="logical" optional="false">
++     <section name="debug" />
++        <option value="false" type="string" default="true"></option>
++     <help> use gnu-profiler to find out where the time is spent </help>
++</parameter>
++<parameter key ="profiling" type="logical" optional="false">
++     <section name="debug" />
++        <option value="false" type="string" default="true"></option>
++     <help> enables profiling (memory, flops, time) </help>
++</parameter>
++
++<!-- verbose -->
++<parameter key ="mprocessor" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="false" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++<parameter key ="module" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="false" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++<parameter key ="solution" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="true" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++<parameter key ="solver" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="false" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++<parameter key ="convergence" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="false" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++<parameter key ="control" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="true" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++<parameter key ="qmu" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="true" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++<parameter key ="autodiff" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="false" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++
++<!-- settings -->
++<parameter key ="results_on_nodes" type="double" default="0">
++     <section name="settings" />
++     <help> results are output for all the nodes of each element </help>
++</parameter>
++<parameter key ="io_gather" type="double" default="1">
++     <section name="settings" />
++     <help> I/O gathering strategy for result outputs (default 1) </help>
++</parameter>
++<parameter key ="lowmem" type="double" default="0">
++     <section name="settings" />
++     <help> is the memory limited ? (0 or 1) </help>
++</parameter>
++<parameter key ="output_frequency" type="double" default="1">
++     <section name="settings" />
++     <help> frequency at which results are saved in all solutions with multiple time_steps </help>
++</parameter>
++<parameter key ="waitonlock" type="double" default="Inf">
++     <section name="settings" />
++     <help> maximum number of minutes to wait for batch results (NaN to deactivate) </help>
++</parameter>
++<parameter key ="upload_server" type="char" default="N/A">
++     <section name="settings" />
++     <help> server hostname where model should be uploaded </help>
++</parameter>
++<parameter key ="upload_path" type="char" default="N/A">
++     <section name="settings" />
++     <help> path on server where model should be uploaded </help>
++</parameter>
++<parameter key ="upload_login" type="char" default="N/A">
++     <section name="settings" />
++     <help> server login </help>
++</parameter>
++<parameter key ="upload_port" type="double" default="0">
++     <section name="settings" />
++     <help> port login (default is 0) </help>
++</parameter>
++<parameter key ="upload_filename" type="char" default="N/A">
++     <section name="settings" />
++     <help> unique id generated when uploading the file to server </help>
++</parameter>
++
++<!-- generic -->
++<parameter key ="name" type="char" default="'XPS'">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="login" type="char" default="N/A">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="np" type="double" default="1">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="port" type="double" default="0">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="codepath" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/bin">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="executionpath" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/execution">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="etcpath" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/etc">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="valgrind" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/externalpackages/valgrind/install/bin/valgrind">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="valgrindlib" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/externalpackages/valgrind/install/lib/libmpidebug.so">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="valgrindsup" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/externalpackages/valgrind/issm.supp">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="verbose" type="double" default="1">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++
++<!-- balancethickness -->
++<parameter key ="spcthickness" type="double" default="N/A">
++     <section name="balancethickness" />
++     <help> thickness constraints (NaN means no constraint) [m] </help>
++</parameter>
++<parameter key ="thickening_rate" type="double" default="N/A">
++     <section name="balancethickness" />
++     <help> ice thickening rate used in the mass conservation (dh/dt) [m/yr] </help>
++</parameter>
++<parameter key ="stabilization" type="double" default="1">
++     <section name="balancethickness" />
++     <help> 0: None, 1: SU, 2: SSAs artificial diffusivity, 3:DG </help>
++</parameter>
++
++<!-- StressBalance solution parameters: -->
++<frame key="1" label="Convergence criteria">
++<section name="stressbalance" />
++<parameter key ="restol" type="double" default="0.0001">
++     <section name="stressbalance" />
++     <help> mechanical equilibrium residual convergence criterion </help>
++</parameter>
++<parameter key ="reltol" type="double" default="0.01">
++     <section name="stressbalance" />
++     <help> velocity relative convergence criterion, NaN: not applied </help>
++</parameter>
++<parameter key ="abstol" type="double" default="10">
++     <section name="stressbalance" />
++     <help> velocity absolute convergence criterion, NaN: not applied </help>
++</parameter>
++<parameter key ="isnewton" type="double" default="0">
++     <section name="stressbalance" />
++     <help> 0: Picards fixed point, 1: Newtons method, 2: hybrid </help>
++</parameter>
++<parameter key ="maxiter" type="double" default="100">
++     <section name="stressbalance" />
++     <help> maximum number of nonlinear iterations </help>
++</parameter>
++<parameter key ="viscosity_overshoot" type="double" default="0">
++     <section name="stressbalance" />
++     <help> over-shooting constant new=new+C*(new-old) </help>
++</parameter>
++</frame>
++<frame key="2" label="Boundary conditions">
++<section name="stressbalance" />
++<parameter key ="spcvx" type="double" default="N/A">
++     <section name="stressbalance" />
++     <help> x-axis velocity constraint (NaN means no constraint) [m/yr] </help>
++</parameter>
++<parameter key ="spcvy" type="double" default="N/A">
++     <section name="stressbalance" />
++     <help> y-axis velocity constraint (NaN means no constraint) [m/yr] </help>
++</parameter>
++<parameter key ="spcvz" type="double" default="N/A">
++     <section name="stressbalance" />
++     <help> z-axis velocity constraint (NaN means no constraint) [m/yr] </help>
++</parameter>
++</frame>
++<frame key="3" label="Rift options">
++<section name="stressbalance" />
++<parameter key ="rift_penalty_threshold" type="double" default="0">
++     <section name="stressbalance" />
++     <help> threshold for instability of mechanical constraints </help>
++</parameter>
++<parameter key ="rift_penalty_lock" type="double" default="10">
++     <section name="stressbalance" />
++     <help> number of iterations before rift penalties are locked </help>
++</parameter>
++</frame>
++<frame key="4" label="Other">
++<section name="stressbalance" />
++<parameter key ="shelf_dampening" type="double" default="0">
++     <section name="stressbalance" />
++     <help> use dampening for floating ice ? Only for FS model </help>
++</parameter>
++<parameter key ="FSreconditioning" type="double" default="10000000000000">
++     <section name="stressbalance" />
++     <help> multiplier for incompressibility equation. Only for FS model </help>
++</parameter>
++<parameter key ="referential" type="double" default="N/A">
++     <section name="stressbalance" />
++     <help> local referential </help>
++</parameter>
++<parameter key ="loadingforce" type="double" default="N/A">
++     <section name="stressbalance" />
++     <help> loading force applied on each point [N/m^3] </help>
++</parameter>
++<parameter key ="requested_outputs" type="cell" default="{'default'}">
++     <section name="stressbalance" />
++     <help> additional outputs requested </help>
++</parameter>
++</frame>
++
++
++<!-- groundingline -->
++<frame key="1" label="Grounding line migration parameters">
++<section name="groundingline" />
++<parameter key ="migration" type="char" default="'None'">
++     <section name="groundingline" />
++     <help> type of grounding line migration: "SoftMigration","AgressiveMigration" or "None" </help>
++</parameter>
++<parameter key ="melting_rate" type="double" default="0">
++     <section name="groundingline" />
++     <help> melting rate applied when previously grounded parts start floating [m/yr] </help>
++</parameter></frame>
++
++
++<!-- Hydrology -->
++<frame key="1" label="Hydrologyshreve solution parameters">
++<section name="hydrologyshreve" />
++<parameter key ="spcwatercolumn" type="double" default="N/A">
++     <section name="hydrologyshreve" />
++     <help> water thickness constraints (NaN means no constraint) [m] </help>
++</parameter>
++<parameter key ="n" type="double" default="0.02">
++     <section name="hydrologyshreve" />
++     <help> Manning roughness coefficient </help>
++</parameter>
++<parameter key ="CR" type="double" default="0.01">
++     <section name="hydrologyshreve" />
++     <help> tortuosity parameter </help>
++</parameter>
++<parameter key ="p" type="double" default="2">
++     <section name="hydrologyshreve" />
++     <help> dimensionless exponent in Manning velocity formula </help>
++</parameter>
++<parameter key ="q" type="double" default="1">
++     <section name="hydrologyshreve" />
++     <help> dimensionless exponent in Manning velocity formula </help>
++</parameter>
++<parameter key ="kn" type="double" default="0">
++     <section name="hydrologyshreve" />
++     <help> parameter in effective pressure formula </help>
++</parameter>
++<parameter key ="stabilization" type="double" default="1">
++     <section name="hydrologyshreve" />
++     <help> artificial diffusivity (default is 1). can be more than 1 to increase diffusivity. </help>
++</parameter>
++</frame>
++<!-- masstransport -->
++<frame key="1" label="Masstransport solution parameters">
++<section name="masstransport" />
++  <parameter key ="spcthickness" type="double" default="N/A">
++     <section name="masstransport" />
++     <help> thickness constraints (NaN means no constraint) [m] </help>
++  </parameter>
++  <parameter key ="calvingrate" type="double" default="N/A">
++     <section name="masstransport" />
++     <help> calving rate at given location [m/a] </help>
++  </parameter>
++  <parameter key ="isfreesurface" type="double" default="0">
++     <section name="masstransport" />
++     <help> do we use free surfaces (FS only) are mass conservation </help>
++  </parameter>
++  <parameter key ="min_thickness" type="double" default="1">
++     <section name="masstransport" />
++     <help> minimum ice thickness allowed [m] </help>
++  </parameter>
++  <parameter key ="hydrostatic_adjustment" type="char" default="'Absolute'">
++     <section name="masstransport" />
++     <help> adjustment of ice shelves surface and bed elevations: 'Incremental' or 'Absolute'  </help>
++  </parameter>
++  <parameter key ="stabilization" type="double" default="1">
++     <section name="masstransport" />
++     <help> 0: no, 1:  artificial_diffusivity, 2: streamline upwinding, 3: discontinuous Galerkin </help>
++  </parameter>
++</frame>
++<frame key="2" label="Penalty options">
++<section name="masstransport" />
++  <parameter key ="vertex_pairing" type="double" default="N/A">
++     <section name="masstransport" />
++     <help> offset used by penalties: penalty = Kmax*10^offset </help>
++  </parameter>
++  <parameter key ="penalty_factor" type="double" default="3">
++     <section name="masstransport" />
++     <help> pairs of vertices that are penalized </help>
++  </parameter>
++  <parameter key ="requested_outputs" type="cell" default="{'default'}">
++     <section name="masstransport" />
++     <help> additional outputs requested </help>
++  </parameter>
++</frame>
++<!-- thermal -->
++<frame key="1" label="Thermal solution parameters">
++<section name="thermal" />
++  <parameter key ="spctemperature" type="double" default="N/A">
++     <section name="thermal" />
++     <help> temperature constraints (NaN means no constraint) [K] </help>
++  </parameter>
++  <parameter key ="penalty_threshold" type="double" default="0">
++     <section name="thermal" />
++     <help> 0: no, 1: artificial_diffusivity, 2: SUPG </help>
++  </parameter>
++  <parameter key ="stabilization" type="double" default="1">
++     <section name="thermal" />
++     <help> maximum number of non linear iterations </help>
++  </parameter>
++  <parameter key ="maxiter" type="double" default="100">
++     <section name="thermal" />
++     <help> stabilize unstable thermal constraints that keep zigzagging after n iteration (default is 0, no stabilization) </help>
++  </parameter>
++  <parameter key ="penalty_lock" type="double" default="0">
++     <section name="thermal" />
++     <help> threshold to declare convergence of thermal solution (default is 0)  </help>
++  </parameter>
++  <parameter key ="penalty_factor" type="double" default="3">
++     <section name="thermal" />
++     <help> scaling exponent (default is 3) </help>
++  </parameter>
++  <parameter key ="isenthalpy" type="double" default="0">
++     <section name="thermal" />
++     <help> use an enthalpy formulation to include temperate ice (default is 0) </help>
++  </parameter>
++  <parameter key ="isdynamicbasalspc" type="double" default="0">
++     <section name="thermal" />
++     <help> enable dynamic setting of basal forcing. required for enthalpy formulation (default is 0)  </help>
++  </parameter>
++  <parameter key ="requested_outputs" type="cell" default="{'default'}">
++     <section name="thermal" />
++     <help> additional outputs requested </help>
++  </parameter>
++</frame>
++<!-- steadystate -->
++<frame key="1" label="steadystate solution parameters">
++<section name="steadystate" />
++  <parameter key ="reltol" type="double" default="0.01">
++     <section name="steadystate" />
++     <help> relative tolerance criterion [K] </help>
++  </parameter>
++  <parameter key ="maxiter" type="double" default="100">
++     <section name="steadystate" />
++     <help> maximum number of iterations </help>
++  </parameter>
++  <parameter key ="requested_outputs" type="cell" default="{'default'}">
++     <section name="steadystate" />
++     <help> additional requested outputs </help>
++  </parameter>
++</frame>
++<!-- transient -->
++<frame key="1" label="transient solution parameters">
++<section name="transient" />
++  <parameter key ="ismasstransport" type="double" default="1">
++     <section name="transient" />
++     <help> indicates whether a masstransport solution is used in the transient </help>
++  </parameter>
++  <parameter key ="isstressbalance" type="double" default="1">
++     <section name="transient" />
++     <help> indicates whether a stressbalance solution is used in the transient </help>
++  </parameter>
++  <parameter key ="isthermal" type="double" default="1">
++     <section name="transient" />
++     <help> indicates whether a thermal solution is used in the transient </help>
++  </parameter>
++  <parameter key ="isgroundingline" type="double" default="0">
++     <section name="transient" />
++     <help> indicates whether a groundingline migration is used in the transient </help>
++  </parameter>
++  <parameter key ="isgia" type="double" default="0">
++     <section name="transient" />
++     <help> indicates whether a postglacial rebound model is used in the transient </help>
++  </parameter>
++  <parameter key ="isdamage" type="double" default="0">
++     <section name="transient" />
++     <help> indicates whether damage evolution is used in the transient </help>
++  </parameter>
++  <parameter key ="islevelset" type="double" default="0">
++     <section name="transient" />
++     <help> LEVEL SET DESCRIPTION...  </help>
++  </parameter>
++  <parameter key ="requested_outputs" type="cell" default="{'default'}">
++     <section name="transient" />
++     <help> list of additional outputs requested </help>
++  </parameter>
++</frame>
++<!-- gia -->
++<frame key="1" label="gia parameters">
++<section name="gia" />
++  <parameter key ="mantle_viscosity" type="double" default="N/A">
++     <section name="gia" />
++     <help> mantle viscosity[Pa s] </help>
++  </parameter>
++  <parameter key ="lithosphere_thickness" type="double" default="N/A">
++     <section name="gia" />
++     <help> lithosphere thickness (km) </help>
++  </parameter>
++  <parameter key ="cross_section_shape" type="double" default="1">
++     <section name="gia" />
++     <help> 1: square-edged (default). 2: elliptical.  See iedge in GiaDeflectionCore </help>
++  </parameter>
++</frame>
++<!-- autodiff -->
++<frame key="1" label="automatic differentiation parameters">
++<section name="autodiff" />
++  <parameter key ="isautodiff" type="logical" optional="false">
++     <section name="autodiff" />
++         <option value="false" type="string" default="true"></option>
++     <help> indicates if the automatic differentiation is activated </help>
++  </parameter>
++  <parameter key ="dependents" type="cell" default="(0x0)">
++     <section name="autodiff" />
++     <help> list of dependent variables </help>
++  </parameter>
++  <parameter key ="independents" type="cell" default="(0x0)">
++     <section name="autodiff" />
++     <help> list of independent variables </help>
++  </parameter>
++  <parameter key ="driver" type="char" default="'fos_forward'">
++     <section name="autodiff" />
++     <help> ADOLC driver ('fos_forward' or 'fov_forward') </help>
++  </parameter>
++  <parameter key ="obufsize" type="double" default="524288">
++     <section name="autodiff" />
++     <help> Number of operations per buffer (==OBUFSIZE in usrparms.h)  </help>
++  </parameter>
++  <parameter key ="lbufsize" type="double" default="524288">
++     <section name="autodiff" />
++     <help> Number of locations per buffer (==LBUFSIZE in usrparms.h) </help>
++  </parameter>
++  <parameter key ="cbufsize" type="double" default="524288">
++     <section name="autodiff" />
++     <help> Number of values per buffer (==CBUFSIZE in usrparms.h) </help>
++  </parameter>
++  <parameter key ="tbufsize" type="double" default="524288">
++     <section name="autodiff" />
++     <help> Number of taylors per buffer (&amp;lt;=TBUFSIZE in usrparms.h) </help>
++  </parameter>
++  <parameter key ="gcTriggerRatio" type="double" default="2">
++     <section name="autodiff" />
++     <help> free location block sorting/consolidation triggered if the ratio between allocated and used locations exceeds gcTriggerRatio </help>
++  </parameter>
++  <parameter key ="gcTriggerRatio" type="double" default="2">
++     <section name="autodiff" />
++     <help> free location block sorting/consolidation triggered if the allocated locations exceed gcTriggerMaxSize </help>
++  </parameter>
++</frame>
++<!-- flaim -->
++<frame key="1" label="Input:">
++<section name="flaim" />
++  <parameter key ="targets" type="char" default="N/A">
++     <section name="flaim" />
++     <help> name of kml output targets file </help>
++  </parameter>
++  <parameter key ="tracks" type="char" default="N/A">
++     <section name="flaim" />
++     <help> name of kml input tracks file </help>
++  </parameter>
++  <parameter key ="flightreqs" type="struct" default="N/A">
++     <section name="flaim" />
++     <help> structure of kml flight requirements (not used yet) </help>
++  </parameter>
++  <parameter key ="criterion" type="double" default="N/A">
++     <section name="flaim" />
++     <help> element or nodal criterion for flight path evaluation (metric) </help>
++  </parameter>
++</frame>
++<frame key="2" label="Arguments:">
++<section name="flaim" />
++  <parameter key ="gridsatequator" type="double" default="200000">
++     <section name="flaim" />
++     <help> number of grids at equator (determines resolution) </help>
++  </parameter>
++  <parameter key ="usevalueordering" type="logical" optional="false">
++     <section name="flaim" />
++         <option value="true" type="string" default="true"></option>
++     <help> flag to consider target values for flight path evaluation </help>
++  </parameter>
++  <parameter key ="split_antimeridian" type="logical" optional="false">
++     <section name="flaim" />
++         <option value="true" type="string" default="true"></option>
++     <help> flag to split polygons on the antimeridian </help>
++  </parameter>
++</frame>
++<frame key="3" label="Optimization:">
++<section name="flaim" />
++  <parameter key ="path_optimize" type="logical" optional="false">
++     <section name="flaim" />
++         <option value="false" type="string" default="true"></option>
++     <help> optimize? (default false) </help>
++  </parameter>
++  <parameter key ="opt_ndir" type="double" default="1">
++     <section name="flaim" />
++     <help> number of directions to test when moving a point.  If this value = 1, a random direction is tested. A value > 1 results in directions equally spaced from [0, 2*PI] being tested. For example, 4 would result in directions [0, PI/2, PI, 3PI/2] </help>
++  </parameter>
++  <parameter key ="opt_dist" type="double" default="25">
++     <section name="flaim" />
++     <help> specifies the distance in km (default 25) to move a randomly selected path point on each iteration </help>
++  </parameter>
++  <parameter key ="opt_niter" type="double" default="30000">
++     <section name="flaim" />
++     <help> number of iterations (default 30,000) to run for flightplan optimization, i.e. the number of times to randomly select a point and move it. </help>
++  </parameter>
++</frame>
++<frame key="4" label="Output:">
++<section name="flaim" />
++  <parameter key ="solution" type="char" default="N/A">
++     <section name="flaim" />
++     <help> name of kml solution file </help>
++  </parameter>
++  <parameter key ="quality" type="double" default="0">
++     <section name="flaim" />
++     <help> quality of kml solution </help>
++  </parameter>
++</frame>
++<!-- inversion -->
++<frame key="1" label="inversion parameters">
++<section name="inversion" />
++  <parameter key ="iscontrol" type="double" default="0">
++     <section name="inversion" />
++     <help> is inversion activated? </help>
++  </parameter>
++  <parameter key ="incomplete_adjoint" type="double" default="1">
++     <section name="inversion" />
++     <help> 1: linear viscosity, 0: non-linear viscosity </help>
++  </parameter>
++  <parameter key ="control_parameters" type="cell" default="{'FrictionCoefficient'}">
++     <section name="inversion" />
++     <help> ex: {'FrictionCoefficient'}, or {'MaterialsRheologyBbar'} </help>
++  </parameter>
++  <parameter key ="nsteps" type="double" default="20">
++     <section name="inversion" />
++     <help> number of optimization searches </help>
++  </parameter>
++  <parameter key ="cost_functions" type="double" default="101">
++     <section name="inversion" />
++     <help> indicate the type of response for each optimization step  </help>
++  </parameter>
++  <parameter key ="cost_functions_coefficients" type="double" default="N/A">
++     <section name="inversion" />
++     <help> cost_functions_coefficients applied to the misfit of each vertex and for each control_parameter </help>
++  </parameter>
++  <parameter key ="cost_function_threshold" type="double" default="N/A">
++     <section name="inversion" />
++     <help> misfit convergence criterion. Default is 1%, NaN if not applied </help>
++  </parameter>
++  <parameter key ="maxiter_per_step" type="double" default="(20x1)">
++     <section name="inversion" />
++     <help> maximum iterations during each optimization step  </help>
++  </parameter>
++  <parameter key ="gradient_scaling" type="double" default="(20x1)">
++     <section name="inversion" />
++     <help> scaling factor on gradient direction during optimization, for each optimization step </help>
++  </parameter>
++  <parameter key ="step_threshold" type="double" default="(20x1)">
++     <section name="inversion" />
++     <help> decrease threshold for misfit, default is 30% </help>
++  </parameter>
++  <parameter key ="min_parameters" type="double" default="N/A">
++     <section name="inversion" />
++     <help> absolute minimum acceptable value of the inversed parameter on each vertex </help>
++  </parameter>
++  <parameter key ="max_parameters" type="double" default="N/A">
++     <section name="inversion" />
++     <help> absolute maximum acceptable value of the inversed parameter on each vertex </help>
++  </parameter>
++  <parameter key ="vx_obs" type="double" default="N/A">
++     <section name="inversion" />
++     <help> observed velocity x component [m/yr] </help>
++  </parameter>
++  <parameter key ="vy_obs" type="double" default="N/A">
++     <section name="inversion" />
++     <help> observed velocity y component [m/yr]  </help>
++  </parameter>
++  <parameter key ="vel_obs" type="double" default="N/A">
++     <section name="inversion" />
++     <help> observed velocity magnitude [m/yr] </help>
++  </parameter>
++  <parameter key ="thickness_obs" type="double" default="N/A">
++     <section name="inversion" />
++     <help> observed thickness [m]) </help>
++  </parameter>
++</frame>
++<frame key="2" label="Available cost functions">
++<section name="inversion" />
++  <parameter key ="SurfaceAbsVelMisfit" type="string" default="101">
++     <section name="inversion" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="SurfaceRelVelMisfit" type="string" default="102">
++     <section name="inversion" />
++     <help>   </help>
++  </parameter>
++  <parameter key ="SurfaceLogVelMisfit" type="string" default="103">
++     <section name="inversion" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="SurfaceLogVxVyMisfit" type="string" default="104">
++     <section name="inversion" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="SurfaceAverageVelMisfit" type="string" default="105">
++     <section name="inversion" />
++     <help>   </help>
++  </parameter>
++  <parameter key ="ThicknessAbsMisfit" type="string" default="106">
++     <section name="inversion" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="DragCoefficientAbsGradient" type="string" default="107">
++     <section name="inversion" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="RheologyBbarAbsGradient" type="string" default="108">
++     <section name="inversion" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="ThicknessAbsGradient" type="string" default="109">
++     <section name="inversion" />
++     <help> </help>
++  </parameter>
++</frame>
++<!-- qmu -->
++<frame key="1" label="qmu parameters">
++<section name="qmu" />
++  <parameter key ="isdakota" type="double" default="0">
++     <section name="qmu" />
++     <help> is qmu analysis activated? </help>
++  </parameter>
++  <parameter key ="variables" type="struct" default="N/A">
++     <section name="qmu" />
++     <help> (arrays of each variable class) </help>
++  </parameter>
++  <parameter key ="responses" type="struct" default="N/A">
++     <section name="qmu" />
++     <help> (arrays of each response class) </help>
++  </parameter>
++  <parameter key ="numberofresponses" type="double" default="0">
++     <section name="qmu" />
++     <help> number of responses </help>
++  </parameter>
++  <parameter key ="params" type="struct" default="N/A">
++     <section name="qmu" />
++     <help> (array of method-independent parameters)  </help>
++  </parameter>
++  <parameter key ="results" type="struct" default="N/A">
++     <section name="qmu" />
++     <help> (information from dakota files) </help>
++  </parameter>
++  <parameter key ="partition" type="double" default="N/A">
++     <section name="qmu" />
++     <help> user provided mesh partitioning, defaults to metis if not specified </help>
++  </parameter>
++  <parameter key ="numberofpartitions" type="double" default="0">
++     <section name="qmu" />
++     <help> number of partitions for semi-discrete qmu  </help>
++  </parameter>
++  <parameter key ="variabledescriptors" type="cell" default="(0x0)">
++     <section name="qmu" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="responsedescriptors" type="cell" default="(0x0)">
++     <section name="qmu" />
++     <help> use an enthalpy formulation to include temperate ice (default is 0) </help>
++  </parameter>
++  <parameter key ="method" type="struct" default="N/A">
++     <section name="qmu" />
++     <help> array of dakota_method class </help>
++  </parameter>
++  <parameter key ="mass_flux_profile_directory" type="double" default="N/A">
++     <section name="qmu" />
++     <help> directory for mass flux profiles </help>
++  </parameter>
++  <parameter key ="mass_flux_profiles" type="double" default="N/A">
++     <section name="qmu" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="mass_flux_segments" type="cell" default="(0x0)">
++     <section name="qmu" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="adjacency" type="double" default="N/A">
++     <section name="qmu" />
++     <help> additional outputs requested </help>
++  </parameter>
++  <parameter key ="vertex_weight" type="double" default="N/A">
++     <section name="qmu" />
++     <help> weight applied to each mesh vertex </help>
++  </parameter>
++</frame>
++<!-- outputdefinition -->
++<frame key="1" label="outputdefinition">
++<section name="outputdefinition" />
++  <parameter key ="definitions" type="cell" default="(0x0)">
++     <section name="outputdefinition" />
++     <help> list of potential outputs that can be requested, but which need additional data to be defined </help>
++  </parameter>
++</frame>
++<!-- miscellaneous -->
++<frame key="1" label="miscellaneous parameters">
++<section name="miscellaneous" />
++  <parameter key ="notes" type="char" default="N/A">
++     <section name="miscellaneous" />
++     <help> notes in a cell of strings </help>
++  </parameter>
++  <parameter key ="name" type="char" default="N/A">
++     <section name="miscellaneous" />
++     <help> model name </help>
++  </parameter>
++  <parameter key ="dummy" type="struct" default="N/A">
++     <section name="miscellaneous" />
++     <help> empty field to store some data </help>
++  </parameter>
++</frame>
++
++
++</inishell_config>
+\ No newline at end of file
+
+Property changes on: ../trunk-jpl/src/java/build/resources/default_config.xml
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/resources/icons/file_ops.xcf
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/resources/icons/file_ops.xcf
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/resources/icons/filesave.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/resources/icons/filesave.png
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/resources/icons/viewmag.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/resources/icons/viewmag.png
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/resources/icons/ini_open.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/resources/icons/ini_open.png
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/resources/icons/fileopen.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/resources/icons/fileopen.png
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/resources/icons/xml_open.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/resources/icons/xml_open.png
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/resources/icons/filesaveas.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/resources/icons/filesaveas.png
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/resources/icons/opensettings.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/resources/icons/opensettings.png
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/resources/icons/reset.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/resources/icons/reset.png
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/resources/icons/advancedsettings.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/resources/icons/advancedsettings.png
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/resources/icons/mydocuments.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/resources/icons/mydocuments.png
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/resources/icons/readme.txt
+===================================================================
+--- ../trunk-jpl/src/java/build/resources/icons/readme.txt	(revision 0)
++++ ../trunk-jpl/src/java/build/resources/icons/readme.txt	(revision 17722)
+@@ -0,0 +1,10 @@
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++This copyright and license notice covers the images in this directory.
++************************************************************************
++
++TITLE:	Crystal Project Icons
++AUTHOR:	Everaldo Coelho
++SITE:	http://www.everaldo.com
++CONTACT: everaldo@everaldo.com
++
++Copyright (c)  2006-2007  Everaldo Coelho.
+
+Property changes on: ../trunk-jpl/src/java/build/resources/icons/readme.txt
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/resources/icons/kghostview.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/build/resources/icons/kghostview.png
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build/resources/config_schema-0.1.1.xsd
+===================================================================
+--- ../trunk-jpl/src/java/build/resources/config_schema-0.1.1.xsd	(revision 0)
++++ ../trunk-jpl/src/java/build/resources/config_schema-0.1.1.xsd	(revision 17722)
+@@ -0,0 +1,154 @@
++<?xml version="1.0"?>
++<!-- 
++*   
++*	This file is part of INIshell.
++*
++*   INIshell is free software: you can redistribute it and/or modify
++*   it under the terms of the GNU General Public License as published by
++*   the Free Software Foundation, either version 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell is distributed in the hope that it will be useful,
++*   but WITHOUT ANY WARRANTY; without even the implied warranty of
++*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++*   GNU General Public License for more details.
++*
++*   You should have received a copy of the GNU General Public License
++*   along with INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*    	
++* -->
++<xsd:schema version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
++  <xsd:element name="inishell_config" type="general" />
++  
++  <xsd:complexType name="general">
++    <xsd:choice maxOccurs="unbounded">
++      <xsd:element name="parameter" type="parametertype" />
++      <xsd:element name="parametergroup" type="pargroup" />
++      <xsd:element name="include" type="pathonly" /> 
++      <xsd:element name="frame" type="framegroup" /> 
++    </xsd:choice>
++    <xsd:attribute name="application" />
++  </xsd:complexType>
++
++  <xsd:complexType name="framegroup">
++    <xsd:choice minOccurs="1" maxOccurs="unbounded">
++      <xsd:element name="parameter" type="parametertype" />
++      <xsd:element name="reference" type="nameonly" />
++      <xsd:element name="section" type="nameonly"/>
++    </xsd:choice>
++    <xsd:attribute name="key" />
++    <xsd:attribute name="label" />
++  </xsd:complexType>
++  
++  <xsd:complexType name="parametertype">
++    <xsd:complexContent>
++      <xsd:extension base="parbasetype">
++		<xsd:attribute name="key" type="xsd:string" use="required"/> 
++		<xsd:attribute name="default" type="xsd:string" />
++		<xsd:attribute name="counter" type="xsd:integer" />
++      </xsd:extension>
++    </xsd:complexContent>		
++  </xsd:complexType>
++  
++  <xsd:complexType name="nameonly">
++	<xsd:attribute name="name" />   
++  </xsd:complexType>
++
++  <xsd:complexType name="optionvalue">
++	<xsd:attribute name="value" />   
++  </xsd:complexType>
++
++  <xsd:complexType name="pathonly">
++	<xsd:attribute name="path" />   
++  </xsd:complexType>
++  
++  <xsd:complexType name="pargroup">
++	<xsd:choice minOccurs="1" maxOccurs="unbounded">
++	  <xsd:element name="parameter" type="parametertype" />
++	  <xsd:element name="reference" type="nameonly" />
++	  <xsd:element name="option" type="optionvalue" />
++	  <xsd:element name="frame" type="framegroup" /> 
++	</xsd:choice>
++	<xsd:attribute name="name" />
++  </xsd:complexType>
++
++  <xsd:complexType name="parbasetype">
++	<xsd:sequence>
++	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
++		<xsd:element name="section" type="nameonly"/>
++	  </xsd:sequence>
++	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
++		<xsd:element name="replace" type="nameonly"/>
++	  </xsd:sequence>
++	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
++		<xsd:element name="parameter" type="parametertype" />
++	  </xsd:sequence>
++	  <xsd:choice minOccurs="0" maxOccurs="unbounded">				
++		<xsd:element name="option" minOccurs="0">
++		  <xsd:complexType>
++			<xsd:complexContent>
++			  <xsd:extension base="parbasetype">
++				<xsd:attribute name="value" type="xsd:string" use="required" />
++				<xsd:attribute name="label" type="xsd:string" use="optional" />
++				<xsd:attribute name="default" type="xsd:boolean" use="optional"/>
++			  </xsd:extension>
++			</xsd:complexContent>
++		  </xsd:complexType>
++		</xsd:element>
++	  </xsd:choice>
++	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
++		<xsd:element name="reference" type="nameonly" />
++	  </xsd:sequence>
++	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
++		<xsd:element name="help" type="helptype"/>	
++	  </xsd:sequence>
++	</xsd:sequence>
++	
++	<xsd:attribute name="type" use="required">
++	  <xsd:simpleType>
++		<xsd:restriction base="xsd:string">
++		  <xsd:enumeration value="integer" />
++		  <xsd:enumeration value="integer+" />
++		  <xsd:enumeration value="decimal" />
++		  <xsd:enumeration value="path" />
++		  <xsd:enumeration value="file" />
++		  <xsd:enumeration value="choice" />
++		  <xsd:enumeration value="alternative" />
++		  <xsd:enumeration value="dropdown" />
++		  <xsd:enumeration value="string" />
++		  <xsd:enumeration value="combination" />
++		  <xsd:enumeration value="selector" />
++		</xsd:restriction>
++	  </xsd:simpleType>
++	</xsd:attribute>
++	
++	<xsd:attribute name="maximum" type="xsd:integer"/>
++	<xsd:attribute name="minimum" type="xsd:integer"/>
++	<xsd:attribute name="template" type="xsd:boolean" default="false" use="optional" />
++	<xsd:attribute name="optional" type="xsd:boolean" default="true" />
++  </xsd:complexType>
++  
++  <xsd:complexType name="needstype">
++	<xsd:attribute name="type" type="xsd:string" use="required" />
++	<xsd:attribute name="name" type="xsd:string" use="required" />
++	
++	<xsd:attribute name="value" />
++	<xsd:attribute name="optional" type="xsd:boolean" />
++	<xsd:attribute name="minoccur" type="xsd:integer" />
++	<xsd:attribute name="maxoccur" type="xsd:string" />
++  </xsd:complexType>
++  
++  <xsd:complexType name="baseType">
++	<xsd:sequence minOccurs="0" maxOccurs="1">
++	  <xsd:element name="help" type="helptype" />		
++	</xsd:sequence>
++	<xsd:attribute name="key" type="xsd:string" use="required" />
++  </xsd:complexType>
++  
++  <xsd:complexType name="helptype" mixed="true">
++	<xsd:choice minOccurs="0" maxOccurs="unbounded">
++	  <xsd:element name="section" type="nameonly" />
++	  <xsd:element name="replace" type="nameonly" />
++	</xsd:choice>
++  </xsd:complexType> 
++</xsd:schema>
+
+Property changes on: ../trunk-jpl/src/java/build/resources/config_schema-0.1.1.xsd
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/License.txt
+===================================================================
+--- ../trunk-jpl/src/java/License.txt	(revision 0)
++++ ../trunk-jpl/src/java/License.txt	(revision 17722)
+@@ -0,0 +1,674 @@
++                    GNU GENERAL PUBLIC LICENSE
++                       Version 3, 29 June 2007
++
++ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
++ Everyone is permitted to copy and distribute verbatim copies
++ of this license document, but changing it is not allowed.
++
++                            Preamble
++
++  The GNU General Public License is a free, copyleft license for
++software and other kinds of works.
++
++  The licenses for most software and other practical works are designed
++to take away your freedom to share and change the works.  By contrast,
++the GNU General Public License is intended to guarantee your freedom to
++share and change all versions of a program--to make sure it remains free
++software for all its users.  We, the Free Software Foundation, use the
++GNU General Public License for most of our software; it applies also to
++any other work released this way by its authors.  You can apply it to
++your programs, too.
++
++  When we speak of free software, we are referring to freedom, not
++price.  Our General Public Licenses are designed to make sure that you
++have the freedom to distribute copies of free software (and charge for
++them if you wish), that you receive source code or can get it if you
++want it, that you can change the software or use pieces of it in new
++free programs, and that you know you can do these things.
++
++  To protect your rights, we need to prevent others from denying you
++these rights or asking you to surrender the rights.  Therefore, you have
++certain responsibilities if you distribute copies of the software, or if
++you modify it: responsibilities to respect the freedom of others.
++
++  For example, if you distribute copies of such a program, whether
++gratis or for a fee, you must pass on to the recipients the same
++freedoms that you received.  You must make sure that they, too, receive
++or can get the source code.  And you must show them these terms so they
++know their rights.
++
++  Developers that use the GNU GPL protect your rights with two steps:
++(1) assert copyright on the software, and (2) offer you this License
++giving you legal permission to copy, distribute and/or modify it.
++
++  For the developers' and authors' protection, the GPL clearly explains
++that there is no warranty for this free software.  For both users' and
++authors' sake, the GPL requires that modified versions be marked as
++changed, so that their problems will not be attributed erroneously to
++authors of previous versions.
++
++  Some devices are designed to deny users access to install or run
++modified versions of the software inside them, although the manufacturer
++can do so.  This is fundamentally incompatible with the aim of
++protecting users' freedom to change the software.  The systematic
++pattern of such abuse occurs in the area of products for individuals to
++use, which is precisely where it is most unacceptable.  Therefore, we
++have designed this version of the GPL to prohibit the practice for those
++products.  If such problems arise substantially in other domains, we
++stand ready to extend this provision to those domains in future versions
++of the GPL, as needed to protect the freedom of users.
++
++  Finally, every program is threatened constantly by software patents.
++States should not allow patents to restrict development and use of
++software on general-purpose computers, but in those that do, we wish to
++avoid the special danger that patents applied to a free program could
++make it effectively proprietary.  To prevent this, the GPL assures that
++patents cannot be used to render the program non-free.
++
++  The precise terms and conditions for copying, distribution and
++modification follow.
++
++                       TERMS AND CONDITIONS
++
++  0. Definitions.
++
++  "This License" refers to version 3 of the GNU General Public License.
++
++  "Copyright" also means copyright-like laws that apply to other kinds of
++works, such as semiconductor masks.
++
++  "The Program" refers to any copyrightable work licensed under this
++License.  Each licensee is addressed as "you".  "Licensees" and
++"recipients" may be individuals or organizations.
++
++  To "modify" a work means to copy from or adapt all or part of the work
++in a fashion requiring copyright permission, other than the making of an
++exact copy.  The resulting work is called a "modified version" of the
++earlier work or a work "based on" the earlier work.
++
++  A "covered work" means either the unmodified Program or a work based
++on the Program.
++
++  To "propagate" a work means to do anything with it that, without
++permission, would make you directly or secondarily liable for
++infringement under applicable copyright law, except executing it on a
++computer or modifying a private copy.  Propagation includes copying,
++distribution (with or without modification), making available to the
++public, and in some countries other activities as well.
++
++  To "convey" a work means any kind of propagation that enables other
++parties to make or receive copies.  Mere interaction with a user through
++a computer network, with no transfer of a copy, is not conveying.
++
++  An interactive user interface displays "Appropriate Legal Notices"
++to the extent that it includes a convenient and prominently visible
++feature that (1) displays an appropriate copyright notice, and (2)
++tells the user that there is no warranty for the work (except to the
++extent that warranties are provided), that licensees may convey the
++work under this License, and how to view a copy of this License.  If
++the interface presents a list of user commands or options, such as a
++menu, a prominent item in the list meets this criterion.
++
++  1. Source Code.
++
++  The "source code" for a work means the preferred form of the work
++for making modifications to it.  "Object code" means any non-source
++form of a work.
++
++  A "Standard Interface" means an interface that either is an official
++standard defined by a recognized standards body, or, in the case of
++interfaces specified for a particular programming language, one that
++is widely used among developers working in that language.
++
++  The "System Libraries" of an executable work include anything, other
++than the work as a whole, that (a) is included in the normal form of
++packaging a Major Component, but which is not part of that Major
++Component, and (b) serves only to enable use of the work with that
++Major Component, or to implement a Standard Interface for which an
++implementation is available to the public in source code form.  A
++"Major Component", in this context, means a major essential component
++(kernel, window system, and so on) of the specific operating system
++(if any) on which the executable work runs, or a compiler used to
++produce the work, or an object code interpreter used to run it.
++
++  The "Corresponding Source" for a work in object code form means all
++the source code needed to generate, install, and (for an executable
++work) run the object code and to modify the work, including scripts to
++control those activities.  However, it does not include the work's
++System Libraries, or general-purpose tools or generally available free
++programs which are used unmodified in performing those activities but
++which are not part of the work.  For example, Corresponding Source
++includes interface definition files associated with source files for
++the work, and the source code for shared libraries and dynamically
++linked subprograms that the work is specifically designed to require,
++such as by intimate data communication or control flow between those
++subprograms and other parts of the work.
++
++  The Corresponding Source need not include anything that users
++can regenerate automatically from other parts of the Corresponding
++Source.
++
++  The Corresponding Source for a work in source code form is that
++same work.
++
++  2. Basic Permissions.
++
++  All rights granted under this License are granted for the term of
++copyright on the Program, and are irrevocable provided the stated
++conditions are met.  This License explicitly affirms your unlimited
++permission to run the unmodified Program.  The output from running a
++covered work is covered by this License only if the output, given its
++content, constitutes a covered work.  This License acknowledges your
++rights of fair use or other equivalent, as provided by copyright law.
++
++  You may make, run and propagate covered works that you do not
++convey, without conditions so long as your license otherwise remains
++in force.  You may convey covered works to others for the sole purpose
++of having them make modifications exclusively for you, or provide you
++with facilities for running those works, provided that you comply with
++the terms of this License in conveying all material for which you do
++not control copyright.  Those thus making or running the covered works
++for you must do so exclusively on your behalf, under your direction
++and control, on terms that prohibit them from making any copies of
++your copyrighted material outside their relationship with you.
++
++  Conveying under any other circumstances is permitted solely under
++the conditions stated below.  Sublicensing is not allowed; section 10
++makes it unnecessary.
++
++  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
++
++  No covered work shall be deemed part of an effective technological
++measure under any applicable law fulfilling obligations under article
++11 of the WIPO copyright treaty adopted on 20 December 1996, or
++similar laws prohibiting or restricting circumvention of such
++measures.
++
++  When you convey a covered work, you waive any legal power to forbid
++circumvention of technological measures to the extent such circumvention
++is effected by exercising rights under this License with respect to
++the covered work, and you disclaim any intention to limit operation or
++modification of the work as a means of enforcing, against the work's
++users, your or third parties' legal rights to forbid circumvention of
++technological measures.
++
++  4. Conveying Verbatim Copies.
++
++  You may convey verbatim copies of the Program's source code as you
++receive it, in any medium, provided that you conspicuously and
++appropriately publish on each copy an appropriate copyright notice;
++keep intact all notices stating that this License and any
++non-permissive terms added in accord with section 7 apply to the code;
++keep intact all notices of the absence of any warranty; and give all
++recipients a copy of this License along with the Program.
++
++  You may charge any price or no price for each copy that you convey,
++and you may offer support or warranty protection for a fee.
++
++  5. Conveying Modified Source Versions.
++
++  You may convey a work based on the Program, or the modifications to
++produce it from the Program, in the form of source code under the
++terms of section 4, provided that you also meet all of these conditions:
++
++    a) The work must carry prominent notices stating that you modified
++    it, and giving a relevant date.
++
++    b) The work must carry prominent notices stating that it is
++    released under this License and any conditions added under section
++    7.  This requirement modifies the requirement in section 4 to
++    "keep intact all notices".
++
++    c) You must license the entire work, as a whole, under this
++    License to anyone who comes into possession of a copy.  This
++    License will therefore apply, along with any applicable section 7
++    additional terms, to the whole of the work, and all its parts,
++    regardless of how they are packaged.  This License gives no
++    permission to license the work in any other way, but it does not
++    invalidate such permission if you have separately received it.
++
++    d) If the work has interactive user interfaces, each must display
++    Appropriate Legal Notices; however, if the Program has interactive
++    interfaces that do not display Appropriate Legal Notices, your
++    work need not make them do so.
++
++  A compilation of a covered work with other separate and independent
++works, which are not by their nature extensions of the covered work,
++and which are not combined with it such as to form a larger program,
++in or on a volume of a storage or distribution medium, is called an
++"aggregate" if the compilation and its resulting copyright are not
++used to limit the access or legal rights of the compilation's users
++beyond what the individual works permit.  Inclusion of a covered work
++in an aggregate does not cause this License to apply to the other
++parts of the aggregate.
++
++  6. Conveying Non-Source Forms.
++
++  You may convey a covered work in object code form under the terms
++of sections 4 and 5, provided that you also convey the
++machine-readable Corresponding Source under the terms of this License,
++in one of these ways:
++
++    a) Convey the object code in, or embodied in, a physical product
++    (including a physical distribution medium), accompanied by the
++    Corresponding Source fixed on a durable physical medium
++    customarily used for software interchange.
++
++    b) Convey the object code in, or embodied in, a physical product
++    (including a physical distribution medium), accompanied by a
++    written offer, valid for at least three years and valid for as
++    long as you offer spare parts or customer support for that product
++    model, to give anyone who possesses the object code either (1) a
++    copy of the Corresponding Source for all the software in the
++    product that is covered by this License, on a durable physical
++    medium customarily used for software interchange, for a price no
++    more than your reasonable cost of physically performing this
++    conveying of source, or (2) access to copy the
++    Corresponding Source from a network server at no charge.
++
++    c) Convey individual copies of the object code with a copy of the
++    written offer to provide the Corresponding Source.  This
++    alternative is allowed only occasionally and noncommercially, and
++    only if you received the object code with such an offer, in accord
++    with subsection 6b.
++
++    d) Convey the object code by offering access from a designated
++    place (gratis or for a charge), and offer equivalent access to the
++    Corresponding Source in the same way through the same place at no
++    further charge.  You need not require recipients to copy the
++    Corresponding Source along with the object code.  If the place to
++    copy the object code is a network server, the Corresponding Source
++    may be on a different server (operated by you or a third party)
++    that supports equivalent copying facilities, provided you maintain
++    clear directions next to the object code saying where to find the
++    Corresponding Source.  Regardless of what server hosts the
++    Corresponding Source, you remain obligated to ensure that it is
++    available for as long as needed to satisfy these requirements.
++
++    e) Convey the object code using peer-to-peer transmission, provided
++    you inform other peers where the object code and Corresponding
++    Source of the work are being offered to the general public at no
++    charge under subsection 6d.
++
++  A separable portion of the object code, whose source code is excluded
++from the Corresponding Source as a System Library, need not be
++included in conveying the object code work.
++
++  A "User Product" is either (1) a "consumer product", which means any
++tangible personal property which is normally used for personal, family,
++or household purposes, or (2) anything designed or sold for incorporation
++into a dwelling.  In determining whether a product is a consumer product,
++doubtful cases shall be resolved in favor of coverage.  For a particular
++product received by a particular user, "normally used" refers to a
++typical or common use of that class of product, regardless of the status
++of the particular user or of the way in which the particular user
++actually uses, or expects or is expected to use, the product.  A product
++is a consumer product regardless of whether the product has substantial
++commercial, industrial or non-consumer uses, unless such uses represent
++the only significant mode of use of the product.
++
++  "Installation Information" for a User Product means any methods,
++procedures, authorization keys, or other information required to install
++and execute modified versions of a covered work in that User Product from
++a modified version of its Corresponding Source.  The information must
++suffice to ensure that the continued functioning of the modified object
++code is in no case prevented or interfered with solely because
++modification has been made.
++
++  If you convey an object code work under this section in, or with, or
++specifically for use in, a User Product, and the conveying occurs as
++part of a transaction in which the right of possession and use of the
++User Product is transferred to the recipient in perpetuity or for a
++fixed term (regardless of how the transaction is characterized), the
++Corresponding Source conveyed under this section must be accompanied
++by the Installation Information.  But this requirement does not apply
++if neither you nor any third party retains the ability to install
++modified object code on the User Product (for example, the work has
++been installed in ROM).
++
++  The requirement to provide Installation Information does not include a
++requirement to continue to provide support service, warranty, or updates
++for a work that has been modified or installed by the recipient, or for
++the User Product in which it has been modified or installed.  Access to a
++network may be denied when the modification itself materially and
++adversely affects the operation of the network or violates the rules and
++protocols for communication across the network.
++
++  Corresponding Source conveyed, and Installation Information provided,
++in accord with this section must be in a format that is publicly
++documented (and with an implementation available to the public in
++source code form), and must require no special password or key for
++unpacking, reading or copying.
++
++  7. Additional Terms.
++
++  "Additional permissions" are terms that supplement the terms of this
++License by making exceptions from one or more of its conditions.
++Additional permissions that are applicable to the entire Program shall
++be treated as though they were included in this License, to the extent
++that they are valid under applicable law.  If additional permissions
++apply only to part of the Program, that part may be used separately
++under those permissions, but the entire Program remains governed by
++this License without regard to the additional permissions.
++
++  When you convey a copy of a covered work, you may at your option
++remove any additional permissions from that copy, or from any part of
++it.  (Additional permissions may be written to require their own
++removal in certain cases when you modify the work.)  You may place
++additional permissions on material, added by you to a covered work,
++for which you have or can give appropriate copyright permission.
++
++  Notwithstanding any other provision of this License, for material you
++add to a covered work, you may (if authorized by the copyright holders of
++that material) supplement the terms of this License with terms:
++
++    a) Disclaiming warranty or limiting liability differently from the
++    terms of sections 15 and 16 of this License; or
++
++    b) Requiring preservation of specified reasonable legal notices or
++    author attributions in that material or in the Appropriate Legal
++    Notices displayed by works containing it; or
++
++    c) Prohibiting misrepresentation of the origin of that material, or
++    requiring that modified versions of such material be marked in
++    reasonable ways as different from the original version; or
++
++    d) Limiting the use for publicity purposes of names of licensors or
++    authors of the material; or
++
++    e) Declining to grant rights under trademark law for use of some
++    trade names, trademarks, or service marks; or
++
++    f) Requiring indemnification of licensors and authors of that
++    material by anyone who conveys the material (or modified versions of
++    it) with contractual assumptions of liability to the recipient, for
++    any liability that these contractual assumptions directly impose on
++    those licensors and authors.
++
++  All other non-permissive additional terms are considered "further
++restrictions" within the meaning of section 10.  If the Program as you
++received it, or any part of it, contains a notice stating that it is
++governed by this License along with a term that is a further
++restriction, you may remove that term.  If a license document contains
++a further restriction but permits relicensing or conveying under this
++License, you may add to a covered work material governed by the terms
++of that license document, provided that the further restriction does
++not survive such relicensing or conveying.
++
++  If you add terms to a covered work in accord with this section, you
++must place, in the relevant source files, a statement of the
++additional terms that apply to those files, or a notice indicating
++where to find the applicable terms.
++
++  Additional terms, permissive or non-permissive, may be stated in the
++form of a separately written license, or stated as exceptions;
++the above requirements apply either way.
++
++  8. Termination.
++
++  You may not propagate or modify a covered work except as expressly
++provided under this License.  Any attempt otherwise to propagate or
++modify it is void, and will automatically terminate your rights under
++this License (including any patent licenses granted under the third
++paragraph of section 11).
++
++  However, if you cease all violation of this License, then your
++license from a particular copyright holder is reinstated (a)
++provisionally, unless and until the copyright holder explicitly and
++finally terminates your license, and (b) permanently, if the copyright
++holder fails to notify you of the violation by some reasonable means
++prior to 60 days after the cessation.
++
++  Moreover, your license from a particular copyright holder is
++reinstated permanently if the copyright holder notifies you of the
++violation by some reasonable means, this is the first time you have
++received notice of violation of this License (for any work) from that
++copyright holder, and you cure the violation prior to 30 days after
++your receipt of the notice.
++
++  Termination of your rights under this section does not terminate the
++licenses of parties who have received copies or rights from you under
++this License.  If your rights have been terminated and not permanently
++reinstated, you do not qualify to receive new licenses for the same
++material under section 10.
++
++  9. Acceptance Not Required for Having Copies.
++
++  You are not required to accept this License in order to receive or
++run a copy of the Program.  Ancillary propagation of a covered work
++occurring solely as a consequence of using peer-to-peer transmission
++to receive a copy likewise does not require acceptance.  However,
++nothing other than this License grants you permission to propagate or
++modify any covered work.  These actions infringe copyright if you do
++not accept this License.  Therefore, by modifying or propagating a
++covered work, you indicate your acceptance of this License to do so.
++
++  10. Automatic Licensing of Downstream Recipients.
++
++  Each time you convey a covered work, the recipient automatically
++receives a license from the original licensors, to run, modify and
++propagate that work, subject to this License.  You are not responsible
++for enforcing compliance by third parties with this License.
++
++  An "entity transaction" is a transaction transferring control of an
++organization, or substantially all assets of one, or subdividing an
++organization, or merging organizations.  If propagation of a covered
++work results from an entity transaction, each party to that
++transaction who receives a copy of the work also receives whatever
++licenses to the work the party's predecessor in interest had or could
++give under the previous paragraph, plus a right to possession of the
++Corresponding Source of the work from the predecessor in interest, if
++the predecessor has it or can get it with reasonable efforts.
++
++  You may not impose any further restrictions on the exercise of the
++rights granted or affirmed under this License.  For example, you may
++not impose a license fee, royalty, or other charge for exercise of
++rights granted under this License, and you may not initiate litigation
++(including a cross-claim or counterclaim in a lawsuit) alleging that
++any patent claim is infringed by making, using, selling, offering for
++sale, or importing the Program or any portion of it.
++
++  11. Patents.
++
++  A "contributor" is a copyright holder who authorizes use under this
++License of the Program or a work on which the Program is based.  The
++work thus licensed is called the contributor's "contributor version".
++
++  A contributor's "essential patent claims" are all patent claims
++owned or controlled by the contributor, whether already acquired or
++hereafter acquired, that would be infringed by some manner, permitted
++by this License, of making, using, or selling its contributor version,
++but do not include claims that would be infringed only as a
++consequence of further modification of the contributor version.  For
++purposes of this definition, "control" includes the right to grant
++patent sublicenses in a manner consistent with the requirements of
++this License.
++
++  Each contributor grants you a non-exclusive, worldwide, royalty-free
++patent license under the contributor's essential patent claims, to
++make, use, sell, offer for sale, import and otherwise run, modify and
++propagate the contents of its contributor version.
++
++  In the following three paragraphs, a "patent license" is any express
++agreement or commitment, however denominated, not to enforce a patent
++(such as an express permission to practice a patent or covenant not to
++sue for patent infringement).  To "grant" such a patent license to a
++party means to make such an agreement or commitment not to enforce a
++patent against the party.
++
++  If you convey a covered work, knowingly relying on a patent license,
++and the Corresponding Source of the work is not available for anyone
++to copy, free of charge and under the terms of this License, through a
++publicly available network server or other readily accessible means,
++then you must either (1) cause the Corresponding Source to be so
++available, or (2) arrange to deprive yourself of the benefit of the
++patent license for this particular work, or (3) arrange, in a manner
++consistent with the requirements of this License, to extend the patent
++license to downstream recipients.  "Knowingly relying" means you have
++actual knowledge that, but for the patent license, your conveying the
++covered work in a country, or your recipient's use of the covered work
++in a country, would infringe one or more identifiable patents in that
++country that you have reason to believe are valid.
++
++  If, pursuant to or in connection with a single transaction or
++arrangement, you convey, or propagate by procuring conveyance of, a
++covered work, and grant a patent license to some of the parties
++receiving the covered work authorizing them to use, propagate, modify
++or convey a specific copy of the covered work, then the patent license
++you grant is automatically extended to all recipients of the covered
++work and works based on it.
++
++  A patent license is "discriminatory" if it does not include within
++the scope of its coverage, prohibits the exercise of, or is
++conditioned on the non-exercise of one or more of the rights that are
++specifically granted under this License.  You may not convey a covered
++work if you are a party to an arrangement with a third party that is
++in the business of distributing software, under which you make payment
++to the third party based on the extent of your activity of conveying
++the work, and under which the third party grants, to any of the
++parties who would receive the covered work from you, a discriminatory
++patent license (a) in connection with copies of the covered work
++conveyed by you (or copies made from those copies), or (b) primarily
++for and in connection with specific products or compilations that
++contain the covered work, unless you entered into that arrangement,
++or that patent license was granted, prior to 28 March 2007.
++
++  Nothing in this License shall be construed as excluding or limiting
++any implied license or other defenses to infringement that may
++otherwise be available to you under applicable patent law.
++
++  12. No Surrender of Others' Freedom.
++
++  If conditions are imposed on you (whether by court order, agreement or
++otherwise) that contradict the conditions of this License, they do not
++excuse you from the conditions of this License.  If you cannot convey a
++covered work so as to satisfy simultaneously your obligations under this
++License and any other pertinent obligations, then as a consequence you may
++not convey it at all.  For example, if you agree to terms that obligate you
++to collect a royalty for further conveying from those to whom you convey
++the Program, the only way you could satisfy both those terms and this
++License would be to refrain entirely from conveying the Program.
++
++  13. Use with the GNU Affero General Public License.
++
++  Notwithstanding any other provision of this License, you have
++permission to link or combine any covered work with a work licensed
++under version 3 of the GNU Affero General Public License into a single
++combined work, and to convey the resulting work.  The terms of this
++License will continue to apply to the part which is the covered work,
++but the special requirements of the GNU Affero General Public License,
++section 13, concerning interaction through a network will apply to the
++combination as such.
++
++  14. Revised Versions of this License.
++
++  The Free Software Foundation may publish revised and/or new versions of
++the GNU General Public License from time to time.  Such new versions will
++be similar in spirit to the present version, but may differ in detail to
++address new problems or concerns.
++
++  Each version is given a distinguishing version number.  If the
++Program specifies that a certain numbered version of the GNU General
++Public License "or any later version" applies to it, you have the
++option of following the terms and conditions either of that numbered
++version or of any later version published by the Free Software
++Foundation.  If the Program does not specify a version number of the
++GNU General Public License, you may choose any version ever published
++by the Free Software Foundation.
++
++  If the Program specifies that a proxy can decide which future
++versions of the GNU General Public License can be used, that proxy's
++public statement of acceptance of a version permanently authorizes you
++to choose that version for the Program.
++
++  Later license versions may give you additional or different
++permissions.  However, no additional obligations are imposed on any
++author or copyright holder as a result of your choosing to follow a
++later version.
++
++  15. Disclaimer of Warranty.
++
++  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
++APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
++HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
++OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
++THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
++PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
++IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
++ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
++
++  16. Limitation of Liability.
++
++  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
++WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
++THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
++GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
++USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
++DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
++PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
++EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
++SUCH DAMAGES.
++
++  17. Interpretation of Sections 15 and 16.
++
++  If the disclaimer of warranty and limitation of liability provided
++above cannot be given local legal effect according to their terms,
++reviewing courts shall apply local law that most closely approximates
++an absolute waiver of all civil liability in connection with the
++Program, unless a warranty or assumption of liability accompanies a
++copy of the Program in return for a fee.
++
++                     END OF TERMS AND CONDITIONS
++
++            How to Apply These Terms to Your New Programs
++
++  If you develop a new program, and you want it to be of the greatest
++possible use to the public, the best way to achieve this is to make it
++free software which everyone can redistribute and change under these terms.
++
++  To do so, attach the following notices to the program.  It is safest
++to attach them to the start of each source file to most effectively
++state the exclusion of warranty; and each file should have at least
++the "copyright" line and a pointer to where the full notice is found.
++
++    <one line to give the program's name and a brief idea of what it does.>
++    Copyright (C) <year>  <name of author>
++
++    This program is free software: you can redistribute it and/or modify
++    it under the terms of the GNU General Public License as published by
++    the Free Software Foundation, either version 3 of the License, or
++    (at your option) any later version.
++
++    This program is distributed in the hope that it will be useful,
++    but WITHOUT ANY WARRANTY; without even the implied warranty of
++    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++    GNU General Public License for more details.
++
++    You should have received a copy of the GNU General Public License
++    along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++Also add information on how to contact you by electronic and paper mail.
++
++  If the program does terminal interaction, make it output a short
++notice like this when it starts in an interactive mode:
++
++    <program>  Copyright (C) <year>  <name of author>
++    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
++    This is free software, and you are welcome to redistribute it
++    under certain conditions; type `show c' for details.
++
++The hypothetical commands `show w' and `show c' should show the appropriate
++parts of the General Public License.  Of course, your program's commands
++might be different; for a GUI interface, you would use an "about box".
++
++  You should also get your employer (if you work as a programmer) or school,
++if any, to sign a "copyright disclaimer" for the program, if necessary.
++For more information on this, and how to apply and follow the GNU GPL, see
++<http://www.gnu.org/licenses/>.
++
++  The GNU General Public License does not permit incorporating your program
++into proprietary programs.  If your program is a subroutine library, you
++may consider it more useful to permit linking proprietary applications with
++the library.  If this is what you want to do, use the GNU Lesser General
++Public License instead of this License.  But first, please read
++<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+
+Property changes on: ../trunk-jpl/src/java/License.txt
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/inishell.sh
+===================================================================
+--- ../trunk-jpl/src/java/inishell.sh	(revision 0)
++++ ../trunk-jpl/src/java/inishell.sh	(revision 17722)
+@@ -0,0 +1,3 @@
++#This is just the necessary command line to run a jar file
++
++java -jar dist/inishell.jar
+
+Property changes on: ../trunk-jpl/src/java/inishell.sh
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/Changelog_1.0.0.txt
+===================================================================
+--- ../trunk-jpl/src/java/Changelog_1.0.0.txt	(revision 0)
++++ ../trunk-jpl/src/java/Changelog_1.0.0.txt	(revision 17722)
+@@ -0,0 +1,29 @@
++This is the changelog for Inishell release 1.0.0
++	*editing existing ini file:
++		+populate the GUI according to the values in an existing ini file
++		+show progress bar while loading
++		+Comments are preserved, nested template parameters properly handled, unknown keys are preserved
++
++	*usability improvements:
++		+the file dialogs remember the last path they pointed to
++		+add ".ini" extension when saving to a config file if necessary
++		+new icons, hoping to make their meaning clearer
++		+reset button on the GUI to revert to defaults
++
++	*layout improvements:
++		+fixed help text horizontal alignements issues
++		+the help text is now verticaly aligned with the top of the widget
++		+Notion of hierarchy for an easier handling of layout issues
++		+layout now consistent between Linux and Windows, still some small spacing differences with osX
++		+possibility to group parameters in a frame with a frame title
++
++	*bug fixes:
++		+default value in comboBox is honored
++		+mandatory comboBox properly handled on osX
++		+better help text handling
++
++	*others:
++		+keys are printed in the order they appear on the GUI
++		+code cleanup and optimizations
++		+add version information in MANIFEST and title bar
++		+clean up and reorganization in build.xml, add help and pack targets
+
+Property changes on: ../trunk-jpl/src/java/Changelog_1.0.0.txt
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/dist/inishell.jar
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/dist/inishell.jar
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/doc/examples/io.ini
+===================================================================
+--- ../trunk-jpl/src/java/doc/examples/io.ini	(revision 0)
++++ ../trunk-jpl/src/java/doc/examples/io.ini	(revision 17722)
+@@ -0,0 +1,180 @@
++[General]
++PLUGINPATH	= ../../lib/plugins ;super
++BUFF_CHUNK_SIZE = 30
++BUFF_BEFORE	= 1.5
++
++[Input]
++COORDSYS	= CH1903
++TIME_ZONE	= 1
++; COORDSYS	= PROJ4
++; COORDPARAM	= 21781
++
++#reading ARC dem
++DEM		= ARC
++DEMFILE  	= ./input/surface-grids/Switzerland_1000m.asc
++
++#reading ARPS dem
++; DEM		= ARPS
++; DEMFILE 	= ./wgrt10r2_vw4.asc
++; ARPS_X 	= 653400
++; ARPS_Y 	= 112204
++
++#reading PGM image as dem
++; DEM		= PGM
++; DEMFILE	= ./Switzerland.pgm
++; PGM_XCOORD	= 479500.
++; PGM_YCOORD	= 73500.
++; PGM_CELLSIZE	= 1000.
++; PGM_MIN	= 193.
++; PGM_MAX	= 4204.
++
++; LANDUSE	= ARC
++; LANDUSEFILE	= ch_as97.asc
++
++#Alpine3D traditional inputs -> A3D plugin
++; METEO		= A3D
++; METEOPATH	= ./input/meteo
++
++#Borma
++; METEO		= BORMA
++; METEOPATH	= ./input/xml
++; NROFSTATIONS	= 1
++; STATION1	= 00.00.00.2
++
++#Snowpack input
++; METEO		= SNOWPACK
++; METEOPATH	= input
++; METAFILE	= IMIS_Extracted_Info.txt ;metadata for all stations
++; STATION1  	= MST96_RR.inp
++
++#SMET meteorological file format
++METEO		= SMET
++METEOPATH	= ./input/meteo
++STATION1	= FLU2.smet
++STATION2	= FIR2.smet
++STATION3	= FRA2.smet
++STATION4	= GLA2.smet
++STATION5	= ILI2.smet
++STATION6	= OTT2.smet
++STATION7	= TUJ3.smet
++
++#IMIS network database input -> IMIS plugin
++; METEO		= IMIS
++; DBNAME		= sdbo
++; DBUSER		= XXX
++; DBPASS		= XXX
++; NROFSTATIONS	= 4
++; STATION1	= MORN2
++; STATION2	= DAV3
++; STATION3	= KLO2
++; STATION4	= *SAM0
++
++#GEOtop traditional inputs -> GEOTOP plugin
++; METEO		 = GEOTOP
++; METEOPATH       = meteo/
++; METEOPREFIX     = _meteo
++
++#GSN direct input -> GSN plugin
++; METEO		= GSN
++; ENDPOINT	= http://montblanc.slf.ch:22001/services/A3DWebService
++; STATION1	= wan_sen14_2008
++; STATION2	= wan2
++
++[Output]
++COORDSYS	= CH1903
++TIME_ZONE 	= 1
++
++GRID2D		= ARC
++GRID2DPATH	= ./
++
++; GRID2D		= PNG
++; GRID2DPATH	= ./
++; PNG_MIN_SIZE	= 800x600
++; PNG_WORLD_FILE	= true
++; PNG_AUTOSCALE	= false
++; PNG_SCALING	= nearest
++
++METEO		= SMET
++METEOPATH	= ./
++
++[Filters]
++TA::filter1	= min_max
++TA::arg1	= 240 320
++
++RH::filter1	= min_max
++RH::arg1 	= 0.01 1.2
++RH::filter2	= min_max
++RH::arg2	= soft 0.05 1.0
++
++HNW::filter1	= min
++HNW::arg1	= -0.1
++HNW::filter2	= min
++HNW::arg2	= soft 0.
++
++ISWR::filter1	= min_max
++ISWR::arg1	= -10. 1500.
++ISWR::filter2	= min
++ISWR::arg2	= soft 0.
++
++RSWR::filter1	= min_max
++RSWR::arg1 	= -10 1500
++RSWR::filter2	= min
++RSWR::arg2	= soft 0
++
++#for TA between 240 and 320 K
++ILWR::filter1	= min_max
++ILWR::arg1	= 188 600
++ILWR::filter2	= min_max
++ILWR::arg2	= soft 200 400
++
++#we need to consider time with no snow -> TSS>0
++#min(TSS) in db since 1998: -50C
++TSS::filter1	= min_max
++TSS::arg1	= 200 320
++
++#idem
++TSG::filter1	= min_max
++TSG::arg1	= 200 320
++
++HS::filter1	= min
++HS::arg1	= soft 0.0
++HS::filter2	= rate
++HS::arg2	= 5.55e-5 ;0.20 m/h
++
++VW::filter1	= min_max
++VW::arg1	= -2 70
++VW::filter2	= min_max
++VW::arg2	= soft 0.2 50.0
++
++[Interpolations1D]
++WINDOW_SIZE	= 86400
++
++TA::resample	= linear
++
++RH::resample	= linear
++
++HS::resample	= linear
++
++VW::resample	= nearest_neighbour
++VW::args	= extrapolate
++
++HNW::resample	= linear
++
++[Interpolations2D]
++TA::algorithms	= IDW_LAPSE CST_LAPSE
++TA::cst_lapse	= -0.008
++TA::idw_lapse	= -0.008 soft
++
++RH::algorithms	= RH IDW_LAPSE CST
++
++HNW::algorithms	= IDW_LAPSE CST_LAPSE CST
++HNW::cst_lapse	= 0.0005 frac
++
++VW::algorithms	= IDW_LAPSE CST
++
++P::algorithms	= STD_PRESS
++
++ILWR::algorithms = CST_LAPSE
++ILWR::cst_lapse = -0.03125
++
++RSWR::algorithms = IDW CST
+
+Property changes on: ../trunk-jpl/src/java/doc/examples/io.ini
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/doc/examples/meteoio_config.xml
+===================================================================
+--- ../trunk-jpl/src/java/doc/examples/meteoio_config.xml	(revision 0)
++++ ../trunk-jpl/src/java/doc/examples/meteoio_config.xml	(revision 17722)
+@@ -0,0 +1,919 @@
++<inishell_config application="Meteo IO">
++
++	<!-- General Parameters -->
++	<parameter key="BUFF_CHUNK_SIZE" type="integer" default="30">
++		<section name="general" />
++		<help>Size in days of a chunk of data to read at once.</help>
++	</parameter>
++
++	<parameter key="BUFF_BEFORE" type="decimal" default="1.5">
++		<section name="general" />
++		<help>Alternate way of buffer centering: When rebuffering, the new date will be located BUFF_BEFORE days from the
++		beginning of the buffer (therefore, it takes a value in days).</help>
++	</parameter>
++
++	<!-- Coordinate systems, time zones -->
++	<parameter key="COORDSYS" type="alternative" optional="false">
++		<section name="input" />
++		<section name="output" />
++		<option value="CH1903" type="string" default="true">
++			<help>coordinates in the Swiss Grid &lt;a href="http://geomatics.ladetto.ch/ch1903_wgs84_de.pdf"&gt;http://geomatics.ladetto.ch/ch1903_wgs84_de.pdf&lt;/a&gt;</help>
++		</option>
++		<option value="UTM" type="string">
++			<parameter key="COORDPARAM" type="string">
++				<help>specify the zone with the zone letter (for example, 32T)</help>
++			</parameter>
++			<help>UTM coordinates, see &lt;a href="http://www.oc.nps.edu/oc2902w/maps/utmups.pdf"&gt;http://www.oc.nps.edu/oc2902w/maps/utmups.pdf&lt;/a&gt;</help>
++		</option>
++		<option value="UPS" type="string">
++			<parameter key="COORDPARAM" type="string">
++				<help>specify the hemisphere (either N or S)</help>
++			</parameter>
++			<help>Universal Polar Stereographic coordinates, see &lt;a href="https://en.wikipedia.org/wiki/Universal_Polar_Stereographic_coordinate_system"&gt;https://en.wikipedia.org/wiki/Universal_Polar_Stereographic_coordinate_system&lt;/a&gt;</help>
++		</option>
++		<option value="PROJ4" type="string">
++			<parameter key="COORDPARAM" type="string" optional="false" />
++			<help>external library: see &lt;a href="http://trac.osgeo.org/proj/"&gt;http://trac.osgeo.org/proj/&lt;/a&gt;</help>
++		</option>
++		<option value="LOCAL"  type="string">
++			<help>uses the horizontal and vertical distance from a reference point</help>
++		</option>
++		<help>coordinate system</help>
++	</parameter>
++
++	<parameter key="TIME_ZONE" type="integer+" default="+1" maximum="14" minimum="-12" optional="false">
++		<section name="input" />
++		<section name="output" />
++	</parameter>
++
++	<!-- Datatypes: special pts -->
++	<parameter key="SPECIALPTS" type="alternative">
++		<section name="input" />
++		<option value="A3D" type="string">
++			<parameter key="SPECIALPTSFILE" type="file" optional="false">
++				<help>a path+file name to the a file containing grid coordinates of special points of interest (for special outputs)</help>
++			</parameter>
++		</option>
++		<option value="SMET" type="string">
++			<parameter key="SPECIALPTSFILE" type="file" optional="false">
++				<help>a path+file name to the a file containing grid coordinates of special points of interest (for special outputs)</help>
++			</parameter>
++		</option>
++	</parameter>
++
++	<!-- Datatypes: Meteo Data -->
++	<parameter key="METEO" type="alternative">
++		<section name="input" />
++		<section name="output" />
++
++		<option value="A3D" type="string">
++			<parameter key="METEOPATH" type="path" optional="false">
++				<help>string containing the path to the meteorological files</help>
++			</parameter>
++		</option>
++		<option value="BORMA" type="string">
++			<section name="input" />
++			<reference name="BORMA" />
++		</option>
++		<option value="COSMO" type="string">
++			<parameter key="METEOPATH" type="path" optional="false">
++				<help>string containing the path to the meteorological files</help>
++			</parameter>
++		</option>
++		<option value="GEOTOP" type="string">
++			<section name="input" />
++			<reference name="GEOTOP_IN" />
++		</option>
++		<option value="GEOTOP" type="string">
++			<section name="output" />
++			<reference name="GEOTOP_OUT" />
++		</option>
++		<option value="GRIB" type="string">
++			<section name="input" />
++			<reference name="GRIB_METEO" />
++		</option>
++		<option value="GSN" type="string">
++			<section name="input" />
++			<reference name="GSN" />
++		</option>
++		<option value="IMIS" type="string">
++			<section name="input" />
++			<reference name="IMIS" />
++		</option>
++		<option value="SMET" type="string">
++			<section name="input" />
++			<reference name="SMET_IN" />
++		</option>
++		<option value="SMET" type="string">
++			<section name="output" />
++			<reference name="SMET_OUT" />
++		</option>
++		<option value="SNOWPACK" type="string">
++			<section name="input" />
++			<reference name="SNIO_IN" />
++		</option>
++		<option value="SNOWPACK" type="string">
++			<section name="output" />
++			<parameter key="METEOPATH" type="path" optional="false">
++				<help>string representing path where SNOWPACK files should be saved</help>
++			</parameter>
++		</option>
++
++		<help>plugin for METEO data </help>
++	</parameter>
++
++	<parameter key="Add Meteo parameter copy" type="selector">
++		<section name="input"/>
++		<parameter key="COPY::%" type="string" optional="false" template="true">
++		  <help>The name of the parameter to copy (e.g. TA, RH, VW, ISWR, etc)</help>
++		</parameter>
++	</parameter>
++
++	<!-- Datatypes: DEM -->
++	<frame key="dem_frame" label="Digital Elevation Model">
++	<section name="input"/>
++		<parameter key="DEM" type="alternative">
++			<section name="input" />
++			<option value="ARC" type="string">
++				<parameter key="DEMFILE" type="file" optional="false">
++					<help>For reading the data as a DEMObject</help>
++				</parameter>
++			</option>
++			<option value="ARPS" type="string">
++				<parameter key="DEMFILE" type="file" optional="false">
++					<help>For reading the data as a DEMObject</help>
++				</parameter>
++				<parameter key="ARPS_XCOORD" type="decimal" optional="false">
++					<help>x coordinate of the lower left corner of the grids</help>
++				</parameter>
++				<parameter key="ARPS_YCOORD" type="decimal" optional="false">
++					<help>y coordinate of the lower left corner of the grids</help>
++				</parameter>
++			</option>
++			<option value="GRASS" type="string">
++				<parameter key="DEMFILE" type="file" optional="false">
++					<help>For reading the data as a DEMObject</help>
++				</parameter>
++			</option>
++			<option value="GRIB" type="string">
++				<parameter key="DEMFILE" type="file" optional="false">
++					<help>For reading the data as a DEMObject</help>
++				</parameter>
++				<parameter key="GRIB_DEM_UPDATE" type="alternative" optional="true">
++					<option value="TRUE" type="string" />
++					<option value="FALSE" type="string" />
++					<help>recompute slope/azimuth from the elevations when reading a DEM (default=false, that is we use the slope and azimuth included in the GRIB file)</help>
++				</parameter>
++			</option>
++			<option value="PGM" type="string">
++				<parameter key="DEMFILE" type="file" optional="false">
++					<help>For reading the data as a DEMObject</help>
++				</parameter>
++				<reference name="PGM_IN" />
++			</option>
++
++			<help>plugin for Digital Elevation Model data </help>
++		</parameter>
++	</frame>
++
++	<!-- Datatypes: Landuse -->
++	<parameter key="LANDUSE" type="alternative">
++		<section name="input" />
++		<option value="ARC" type="string">
++			<parameter key="LANDUSEFILE" type="file" optional="false">
++				<help>File containing a grid of landuse codes</help>
++			</parameter>
++		</option>
++
++		<help>plugin for land cover data </help>
++	</parameter>
++
++	<!-- Datatypes: Grids -->
++	<parameter key="GRID2D" type="alternative">
++		<section name="input" />
++		<section name="output" />
++		<option value="ARC" type="string">
++			<parameter key="GRID2DPATH" type="path" optional="false">
++				<help>string representing path where grid files should be read from</help>
++			</parameter>
++			<reference name="ARC" />
++		</option>
++		<option value="ARPS" type="string">
++			<section name="input" />
++			<parameter key="GRID2DPATH" type="path" optional="false">
++				<help>string representing path where grid files should be read from</help>
++			</parameter>
++			<reference name="ARPS" />
++		</option>
++		<option value="GRASS" type="string">
++			<section name="input" />
++			<parameter key="GRID2DPATH" type="path" optional="false">
++				<help>string representing path where grid files should be read from</help>
++			</parameter>
++		</option>
++		<option value="GRIB" type="string">
++			<section name="input" />
++			<parameter key="GRID2DPATH" type="path" optional="false">
++				<help>string representing path where grid files should be read from</help>
++			</parameter>
++			<reference name="GRIB_GRIDS" />
++		</option>
++		<option value="PGM" type="string">
++			<section name="input" />
++			<parameter key="GRID2DPATH" type="path" optional="false">
++				<help>string representing path where grid files should be read from</help>
++			</parameter>
++			<reference name="PGM_IN" />
++		</option>
++		<option value="PGM" type="string">
++			<section name="output" />
++			<parameter key="GRID2DPATH" type="path" optional="false">
++				<help>string representing path where grid files should be read from</help>
++			</parameter>
++		</option>
++		<option value="PNG" type="string">
++			<section name="output" />
++			<parameter key="GRID2DPATH" type="path" optional="false">
++				<help>string representing path where grid files should be read from</help>
++			</parameter>
++			<reference name="PNG" />
++		</option>
++		<help>plugin for 2D gridded data </help>
++	</parameter>
++
++	<!--Parameter group for list of stations -->
++	<parametergroup name="stationgroup_files">
++		<parameter key="STATION#" type="file" counter="1" optional="false">
++			<help>filename for station number # </help>
++		</parameter>
++	</parametergroup>
++	<parametergroup name="stationgroup_names">
++		<parameter key="STATION#" type="string" counter="1" optional="false">
++			<help>station id for the given station number # </help>
++		</parameter>
++	</parametergroup>
++	<parametergroup name="stationgroup_pos">
++		<parameter key="STATION#" type="string" counter="1">
++			<help>Coordinates are given as "lat lon" or "xcoord ycoord epsg_code"</help>
++		</parameter>
++	</parametergroup>
++
++	<!-- Plugins for Meteo Data-->
++	<parametergroup name="BORMA">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the xml files</help>
++		</parameter>
++		<reference name="stationgroup_names" />
++	</parametergroup>
++
++	<parametergroup name="IMIS">
++		<parameter key="DBNAME" type="string" optional="false">
++			<help>database name, as provided by your database administrator</help>
++		</parameter>
++		<parameter key="DBUSER" type="string" optional="false">
++			<help>database user name</help>
++		</parameter>
++		<parameter key="DBPASS" type="string" optional="false">
++			<help>database password associated with the user name</help>
++		</parameter>
++		<parameter key="USEANETZ" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>OPTIONAL: use ANETZ stations to provide precipitations for normal IMIS stations.
++		  Each IMIS station is associated with one or two ANETZ stations and does a weighted
++		  average to get what should be its local precipitations</help>
++		</parameter>
++		<parameter key="USE_IMIS_HNW" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>OPTIONAL: if set to false (default), all IMIS precipitation will be deleted (since IMIS stations don't have heated rain gauges, their precipitation measurements are not good in winter conditions). If set to true, it is strongly advised to use a FilterHNWMelt filter to detect snow melting in the rain gauge and perform winter conditions detection in the application.</help>
++		</parameter>
++		<parameter key="USE_SNOWPACK_HNW" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>if set to true, the SNOWPACK simulated Snow Water Equivalent from the database will be used to compute HNW. Data gaps greater than 3 hours on SWE will lead to unchanged hnw while all data that can properly be computed will overwrite hnw. (default=false)</help>
++		</parameter>
++
++		<reference name="stationgroup_names" />
++	</parametergroup>
++
++	<parametergroup name="GRIB_METEO">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the grib files</help>
++		</parameter>
++		<parameter key="METEOEXT" type="string" optional="true">
++			<help>grib file extension, or none for no file extension (default: .grb)</help>
++		</parameter>
++
++		<reference name="stationgroup_pos" />
++	</parametergroup>
++
++	<parametergroup name="GEOTOP_IN">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the data files</help>
++		</parameter>
++		<parameter key="METAFILE" type="file" optional="false">
++			<help>absolute filename of the geotop.inpts file</help>
++		</parameter>
++		<parameter key="METEOPREFIX" type="string" optional="true">
++			<help>prefix to append when generating a file name for reading</help>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="GEOTOP_OUT">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the data files</help>
++		</parameter>
++		<parameter key="METEOSEQ" type="string" optional="false">
++			<help>specifiy in which order the columns should be printed out</help>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="GSN">
++		<parameter key="ENDPOINT" type="string" optional="false">
++			<help>webserver running GSN with its port number and full path. For example:
++			http://montblanc.slf.ch:22001/services/A3DWebService</help>
++		</parameter>
++		<parameter key="PROXY" type="string" optional="true">
++			<help>Should the connection go through a proxy? This is useful for servers
++			filtering on domains but usually not necessary.</help>
++		</parameter>
++		<parameter key="PROXYPORT" type="string" optional="true" />
++		<parameter key="PROXYUSER" type="string" optional="true" />
++		<parameter key="PROXYPASS" type="string" optional="true" />
++
++		<reference name="stationgroup_names" />
++	</parametergroup>
++
++	<parametergroup name="SMET_IN">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the smet files</help>
++		</parameter>
++		<reference name="stationgroup_files" />
++	</parametergroup>
++
++	<parametergroup name="SMET_OUT">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string representing path where SMET files should be saved</help>
++		</parameter>
++		<parameter key="METEOPARAM" type="alternative">
++		  <option value="ASCII" type="string" default="true">
++		    <help>Write ASCII SMET files</help>
++		  </option>
++		  <option value="BINARY" type="string">
++		    <help>Write BINARY SMET files</help>
++		  </option>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="SNIO_IN">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the SNOWPACK files</help>
++		</parameter>
++		<parameter key="METAFILE" type="file" optional="true">
++			<help>filename of the meta data file (in METEOPATH)</help>
++		</parameter>
++
++		<parameter key="NUMBER_MEAS_TEMPERATURES" type="integer+" minimum="0" default="0">
++		  <help>the number of measured snow temperatures provided</help>
++		</parameter>
++
++		<parameter key="NUMBER_OF_SOLUTES" type="integer+" minimum="0" default="0">
++		  <help>the number of solutes for which input data are provided</help>
++		</parameter>
++
++		<parameter key="RSWR_INP" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		</parameter>
++		<parameter key="ISWR_INP" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		</parameter>
++		<parameter key="VW_DRIFT" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>OPTIONAL: wind velocity to use for blowing and drifting snow is provided</help>
++		</parameter>
++		<parameter key="RHO_HN" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>OPTIONAL: measured new snow density is provided</help>
++		</parameter>
++
++		<reference name="stationgroup_files" />
++	</parametergroup>
++
++	<!-- Plugins for Gridded Data-->
++	<parametergroup name="ARC">
++		<parameter key="A3D_VIEW" type="alternative" optional="true">
++			<option value="TRUE" type="string" />
++			<option value="FALSE" type="string" />
++			<help>generate names compatible with Alpine3D's grid viewer?</help>
++		</parameter>
++		<parameter key="GRID2DEXT" type="string" optional="true">
++			<help>grid file extension, or none for no file extension (default: .asc)</help>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="ARPS">
++		<parameter key="ARPS_XCOORD" type="decimal" optional="false">
++			<help>x coordinate of the lower left corner of the grids</help>
++		</parameter>
++		<parameter key="ARPS_YCOORD" type="decimal" optional="false">
++			<help>y coordinate of the lower left corner of the grids</help>
++		</parameter>
++		<parameter key="GRID2DEXT" type="string" optional="true">
++			<help>grid file extension, or none for no file extension (default: .asc)</help>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="GRIB_GRIDS">
++		<parameter key="GRID2DPREFIX" type="string" optional="true">
++			<help>prefix to append when generating a file name for reading (ie: something like "laf" for Cosmo-Analysis-full domain)</help>
++		</parameter>
++		<parameter key="GRID2DEXT" type="string" optional="true">
++			<help>grib file extension, or none for no file extension (default: .grb)</help>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="PNG">
++		<parameter key="PNG_WORLD_FILE" type="alternative" optional="true">
++			<option value="TRUE" type="string" />
++			<option value="FALSE" type="string" />
++			<help>generate a world file for each output file? This file contains the geolocalization information</help>
++		</parameter>
++		<parameter key="PNG_LEGEND" type="alternative" optional="true">
++			<option value="TRUE" type="string" />
++			<option value="FALSE" type="string" />
++			<help>generate a legend?</help>
++		</parameter>
++		<parameter key="PNG_AUTOSCALE" type="alternative" optional="true">
++			<option value="TRUE" type="string" />
++			<option value="FALSE" type="string" />
++			<help>autoscale color scale?</help>
++		</parameter>
++		<parameter key="PNG_SCALING" type="alternative" optional="true">
++			<option value="nearest" type="string" />
++			<option value="bilinear" type="string" />
++			<help>scaling algorithm (default=bilinear)</help>
++		</parameter>
++		<parameter key="PNG_MIN_SIZE" type="string" optional="false">
++			<help>minimum dimensions of the PNG, like 640x480</help>
++		</parameter>
++		<parameter key="PNG_MAX_SIZE" type="string" optional="false">
++			<help>maximum dimensions of the PNG, like 1024x768</help>
++		</parameter>
++		<parameter key="PNG_INDEXED" type="alternative" optional="true">
++			<option value="TRUE" type="string" />
++			<option value="FALSE" type="string" />
++			<help>generate a color indexed file (default=true)</help>
++		</parameter>
++		<parameter key="PNG_SPEED_OPTIMIZE" type="alternative" optional="true">
++			<option value="TRUE" type="string" />
++			<option value="FALSE" type="string" />
++			<help>optimize for speed (default=false)</help>
++		</parameter>
++		<parameter key="PNG_NR_LEVELS" type="integer+" default="+30" maximum="255" minimum="6" optional="true">
++			<help>number of colors in the palette (default=30)</help>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="PGM_IN">
++		<parameter key="PGM_XCOORD" type="decimal" optional="false">
++			<help>lower left x coordinate</help>
++		</parameter>
++		<parameter key="PGM_YCOORD" type="decimal" optional="false">
++			<help>lower left y coordinate</help>
++		</parameter>
++		<parameter key="PGM_CELLSIZE" type="decimal" optional="false">
++			<help>cellsize in meters</help>
++		</parameter>
++		<parameter key="PGM_MIN" type="decimal" optional="false">
++			<help>minimum value in real world coordinates to match with the minimum value read out of the PGM file (such minimum being greater than 0 because 0 is NODATA)</help>
++		</parameter>
++		<parameter key="PGM_MAX" type="decimal" optional="false">
++			<help>maximum value in real world coordinates to match with the maximum value read out of the PGM file</help>
++		</parameter>
++	</parametergroup>
++
++	<!-- Meteo Parameters for Filters, resampling, spatial interpolations-->
++	<parametergroup name="METEOIOPARAMETERS">
++		<option value="TA"/>
++		<option value="RH"/>
++		<option value="VW"/>
++		<option value="DW"/>
++		<option value="VW_MAX"/>
++		<option value="ISWR"/>
++		<option value="RSWR"/>
++		<option value="ILWR"/>
++		<option value="HS"/>
++		<option value="HNW"/>
++		<option value="TSG"/>
++		<option value="TSS"/>
++		<option value="P"/>
++	</parametergroup>
++
++	<!-- Filters -->
++	<parameter key="Add/Remove Filter" type="selector">
++		<section name="filters" />
++
++		<parameter key="%::filter#" type="alternative" counter="1" template="true">
++			<section name="filters" />
++
++			<option label="MeanAvg" value="mean_avg" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Mean average processing. The mean average filter returns the mean value of all values within a user given time window.</help>
++			</option>
++
++			<option label="MedianAvg" value="median_avg" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="decimal" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Median average processing. The median average filter returns the median value of all values within a user given time window.</help>
++			</option>
++
++			<option label="Std Deviation Filter" value="std_dev" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Standard deviation filter. Values outside of mean ± 2 std_dev are rejected.</help>
++			</option>
++
++			<option label="MAD" value="mad" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Median Absolute Deviation. Values outside of median ± 3 σ_MAD are rejected. &lt;br&gt;
++			  See http://en.wikipedia.org/wiki/Median_absolute_deviation for more information.</help>
++			</option>
++
++			<option label="Tukey 53H Filter" value="Tukey" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      The keyword "soft" maybe added, if the window position is allowed to be adjusted to the data present.
++			      The two arguments may be preceded by the keywords "left", "center" or "right", indicating the window position.
++			    </help>
++			  </parameter>
++			  <help>Tukey 53H method A smooth time sequence is generated from the median, substracted from the original signal and
++			  compared with the standard deviation. see "Despiking Acoustic Doppler Velocimeter Data", Derek G. Goring and Vladimir
++			  L. Nikora, Journal of Hydraulic Engineering, 128, 1, 2002 The deviation factor coeffecient is currently hard-coded as k=1.5. </help>
++			</option>
++
++			<option label="Wind Averaging Filter" value="wind_avg" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Wind vector averaging. This calculates the vector average over a user given time period. Each wind vector
++			  within this period is added and the final sum is normalized by the number of vectors that have been added. </help>
++			</option>
++
++			<option label="Exponential Smoothing" value="exp_smoothing" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <option label="alpha:" value="0.8" type="decimal" minimum="0" maximum="1"/>
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			      Alpha needs to be provided as last argument. Please note that the standard filter works with a left window!
++			    </help>
++			  </parameter>
++			  <help>Exponential smooting processing, exponential moving average s_0 = x_0 s_n = alpha*x_(t-1) + (1-alpha)*s_t-1</help>
++			</option>
++
++			<option label="Weighted Moving Average Smoothing" value="wma_smoothing" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			      Please note that the standard filter works with a left window!
++			    </help>
++			  </parameter>
++			  <help>Weighted moving average smoothing such as: WMA = (1*X1 + 2*X2 + ... + n*Xn) / sum_of_weights</help>
++			</option>
++
++			<option label="Min Range Filter" value="min" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option label="Min:" value="" type="decimal" />
++			    <option label="Adjust to:" value="" type="decimal" />
++			    <help>The keyword "soft" maybe added, in such a case all data smaller than the min would be
++			    assigned the minimum permissible value or another value given as an extra argument</help>
++			  </parameter>
++			  <help>Min range filter. Reject all values smaller than the min.</help>
++			</option>
++
++			<option label="Max Range Filter" value="max" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option label="Max:" value="" type="decimal" />
++			    <option label="Adjust to:" value="" type="decimal" />
++			    <help>The keyword "soft" maybe added, in such a case all data greater than the max would be
++			    assigned the maximum permissible value or another value given as an extra argument</help>
++			  </parameter>
++			  <help>Max range filter. Reject all values greater than the max.</help>
++			</option>
++
++			<option label="MinMax (2 or 4 arguments)" value="min_max" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option label="Min:" value="" type="decimal" />
++			    <option label="Max:" value="" type="decimal" />
++			    <option label="Min adjust to:" value="" type="decimal" />
++			    <option label="Max adjust to:" value="" type="decimal" />
++			    <help>The keyword "soft" maybe added, in such a case all data greater than the max would be assigned
++			    the maximum permissible value and all data smaller than the min would be assigned the minimum
++			    permissible value or an optional extra set of two user provided values</help>
++			  </parameter>
++			  <help>Reject all values greater than the max or smaller than the min. &lt;br&gt;</help>
++			</option>
++
++			<option label="Rate Filter (1 argument)" value="rate" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option label="Max:" value="1.0" type="decimal" minimum="0" maximum="1" />
++			    <help>the absolute value of the maximum permissible rate of change (per seconds)</help>
++			  </parameter>
++			  <help>Rate of change filter. Calculate the change rate (ie: slope) between two points, if it is above a user given value, reject the point.</help>
++			</option>
++
++			<option label="Rate Filter (2 arguments)" value="rate" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option label="Min:" value="0.0" type="decimal" minimum="0" maximum="1" />
++			    <option label="Max:" value="1.0" type="decimal" minimum="0" maximum="1" />
++			    <help>the minimum and maximum permissible rate of change (per second)</help>
++			  </parameter>
++			  <help>Rate of change filter. Calculate the change rate (ie: slope) between two points, if it is above a user given value, reject the point.</help>
++			</option>
++
++			<option label="Unheated Rain Gauge Filter" value="Unheated_RainGauge" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option label="RH threshold:" value="0.5" type="decimal" minimum="0" maximum="1" />
++			    <option label="Delta_T threshold:" value="3.0" type="decimal" minimum="0" maximum="20" />
++			  </parameter>
++			  <help>Filters out snow melting in an unheated rain gauge. This filter can ONLY be applied to precipitation. Non-zero measurements are accepted only if they take place when the relative humidity is greater than RH_threshold and (TA-TSS) smaller than Delta_T_threshold, otherwise they get reset to 0. If none of these conditions could be tested (for lack of data), then the precipitation is reset to nodata (or left unchanged if "soft" has been selected).</help>
++			</option>
++
++			<option label="WMO Undercatch Filter" value="undercatch_wmo" type="string">
++			  <parameter key="%::arg#" type="combination">
++				<option value="Gage type" type="dropdown">
++					<option value="Nipher" type="string" />
++					<option value="Tretyakov" type="string" />
++					<option value="US8sh" type="string" />
++					<option value="US8unsh" type="string" />
++					<option value="Hellmann" type="string" />
++					<option value="Hellmannsh" type="string" />
++				</option>
++			  </parameter>
++			  <help>This implements the standard methods for precipitation correction as described in "WMO Solid Precipitation Measurement Intercomparison", B. Goodison, P. Louie and D. Yang, 872, 1998 as well as the overview given by "Literature Study on the Correction of Precipitation Measurements", Annette Wagner, 2009. The correction parameters for the shielded Hellmann gauge (German version) are from "Wind-induced Precipitation Undercatch of the Hellmann Gauges", Daqing Yang et al, Nordic Hydrology, 30, 1999, pp 57-80.</help>
++			</option>
++
++			<option label="WMO Undercatch Filter - simplified" value="undercatch_wmo" type="string">
++			  <parameter key="%::arg#" type="combination">
++				<option value="Kind" type="dropdown">
++					<option value="Cst" type="string" />
++				</option>
++				<option label="Snow factor:" value="1.3" type="decimal" minimum="0" maximum="5" />
++				<option label="Mixed prec factor:" value="1.1" type="decimal" minimum="0" maximum="5" />
++			  </parameter>
++			  <help>This applies a constant correction factor to the precipitation, one for pure snow and one for mixed precipitation. The following thresholds are used: pure snow below -2 C; mixed precipitation between -2 and +2 C; pure rain above 2 C. These threshold can be changed (see online documentation).</help>
++			</option>
++
++			<option label="Unventillated temperature sensor" value="Unventilated_T" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option label="albedo:" value="0.23" type="decimal" />
++			    <option value="soft" type="choice" />
++			    <help>If the "soft" option is given, the albedo has a value different according to snow (or no snow) on the ground</help>
++			  </parameter>
++			  <help>This implements the correction described in (Reina Nakamura, 2005) with an albedo dependency as introduced in (Huwald, 2009)</help>
++			</option>
++
++			<option label="Add an offset" value="add" type="string">
++			  <parameter key="%::arg#" type="combination">
++				<option label="offset:" value="0." type="decimal" />
++			  </parameter>
++			  <help>This adds a given offset to the data.</help>
++			</option>
++
++			<option label="Multiply by a factor" value="mult" type="string">
++			  <parameter key="%::arg#" type="combination">
++				<option label="factor:" value="1." type="decimal" />
++			  </parameter>
++			  <help>This multiplies the data by a given factor.</help>
++			</option>
++
++		</parameter>
++
++		<reference name="METEOIOPARAMETERS" />
++	</parameter>
++
++	<!-- 1D Interpolation -->
++	<parameter key="WINDOW_SIZE" type="integer+" minimum="1" default="43200">
++		<section name="Interpolations1D" />
++		<help>Affects resampling: expresses (in seconds) how far a valid point can be
++		searched for when re-interpolating a missing value</help>
++	</parameter>
++
++	<parameter key="Add/Remove 1D Interpolation" type="selector">
++		<section name="Interpolations1D" />
++
++		<parameter key="%::resample" type="alternative" template="true">
++			<section name="Interpolations1D" />
++			<option label="No Interpolation" value="none" type="string" />
++			<option label="Nearest Neighbour" value="nearest_neighbour" type="string" />
++			<option label="Linear" value="linear" type="string">
++			  <parameter key="%::args" type="combination">
++			    <option value="extrapolate" type="choice" />
++			    <help>
++			      If "extrapolate" is added, then data *outside* of the original date range can be interpolated.
++			      Otherwise, a data point will only be calculated between the original date range.
++			    </help>
++			  </parameter>
++			  <help>Mean average processing. The mean average filter returns the mean value of all values within a user given time window.</help>
++			</option>
++			<option label="Accumulate" value="accumulate" type="string">
++			  <parameter key="%::args" type="combination">
++			    <option value="strict" type="choice" />
++			    <option label="Seconds:" value="900" type="integer" minimum="1" />
++			    <help>Accumulation period (in seconds). This must usually match the model time step. if enabling "strict", nodatas will propagate (ie. a single nodata in the input will force the re-accumulated value to be nodata). Otherwise, all valid values are aggregated and only pure nodata intervals produce a nodata in the output.</help>
++			  </parameter>
++			  <help>Accumulation over a user given period (filter argument, in seconds -
++			  should coincide with your calculation step!).</help>
++			</option>
++		</parameter>
++
++		<reference name="METEOIOPARAMETERS" />
++	</parameter>
++
++	<!-- 2D Interpolation -->
++	<parameter key="Add/Remove 2D Interpolation" type="selector">
++		<section name="Interpolations2D" />
++
++		<parameter key="%::algorithms" type="choice" template="true">
++			<section name="Interpolations2D" />
++			<option value="STD_PRESS" type="choice">
++				<help>Generate a standard atmosphere pressure as a function of the cell's elevation</help>
++			</option>
++			<option value="CST" type="choice">
++				<help>Fill the grid with the average over all the stations</help>
++			</option>
++			<option value="CST_LAPSE" type="choice">
++			  <parameter key="%::cst_lapse" type="combination">
++			    <option label="Lapse Rate:" value="0.008" type="decimal" optional="false" />
++			    <option value="" type="dropdown">
++			      <option value="" type="string" />
++			      <option value="soft" type="string" />
++			      <option value="frac" type="string" />
++			    </option>
++			  </parameter>
++			  <help>Detrend the measured data, fill the grid with the average over all the stations, reapply the elevation trend</help>
++			</option>
++			<option value="IDW" type="choice">
++				<help>Inverse Distance Weighted average</help>
++			</option>
++			<option value="IDW_LAPSE" type="choice">
++			  <parameter key="%::idw_lapse" type="combination">
++			    <option label="Lapse Rate:" value="0.008" type="decimal" optional="false" />
++			    <option value="" type="dropdown">
++			      <option value="" type="string" />
++			      <option value="soft" type="string" />
++			      <option value="frac" type="string" />
++			    </option>
++			  </parameter>
++			  <help>Detrend the measured data, apply Inverse Distance Weighted average, reapply elevation trend</help>
++			</option>
++			<option value="LIDW_LAPSE" type="choice">
++			  <parameter key="%::lidw_lapse" type="combination">
++			    <option label="Lapse Rate:" value="0.008" type="decimal" optional="false" />
++			    <option value="" type="dropdown">
++			      <option value="" type="string" />
++			      <option value="soft" type="string" />
++			      <option value="frac" type="string" />
++			    </option>
++			  </parameter>
++			  <help>Same as IDW_LAPSE, but only considering a given number of neighboring stations</help>
++			</option>
++			<option value="RH" type="choice">
++				<help>Computes the dew point temperature, distribute it with IDW_LAPSE, recompute RH at each pixel</help>
++			</option>
++			<option value="ILWR" type="choice">
++				<help>Compute emissivity, distribute it with IDW_LAPSE, recompute ILWR at each pixel</help>
++			</option>
++			<option value="WIND_CURV" type="choice">
++				<help>Distribute wind velocity with IDW_LAPSE, then apply correction factors as a function of local slope and curvature</help>
++			</option>
++			<option value="HNW_SNOW" type="choice">
++				<parameter key="%::hnw_snow" type="combination">
++				<option value="IDW_LAPSE" type="dropdown">
++					<option value="CST" type="string" />
++					<option value="CST_LAPSE" type="string" />
++					<option value="IDW" type="string" />
++					<option value="IDW_LAPSE" type="string" />
++					<option value="ODKRIG" type="string" />
++				</option>
++				<help>Base algorithm (do not forget to add the options for the base algorithm)</help>
++				</parameter>
++				<help>Distribute precipitation with a base algorithm (IDW_LAPSE by default), then reduce/remove precipitation on
++				steep slopes and correct with the local curvature. This is to simulate snow redistribution processes.</help>
++			</option>
++			<option value="USER" type="choice">
++			  <parameter key="%::user" type="path" optional="false"/>
++			  <help>User provided grids, named as {numeric date}_{capitalized meteo parameter}.asc</help>
++			</option>
++			<option value="ODKRIG" type="choice">
++			  <parameter key="%::odkrig" type="combination">
++			  	<option value="" type="dropdown">
++					<option value="LINVARIO" type="string" />
++					<option value="EXPVARIO" type="string" />
++					<option value="SPHERICVARIO" type="string" />
++					<option value="RATQUADVARIO" type="string" />
++				</option>
++				<help>Variogram model</help>
++			  </parameter>
++			  <help>Ordinary kriging (EXPERIMENTAL)</help>
++			</option>
++		</parameter>
++
++		<reference name="METEOIOPARAMETERS" />
++	</parameter>
++</inishell_config>
+\ No newline at end of file
+
+Property changes on: ../trunk-jpl/src/java/doc/examples/meteoio_config.xml
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/doc/examples/snowpack_config.xml
+===================================================================
+--- ../trunk-jpl/src/java/doc/examples/snowpack_config.xml	(revision 0)
++++ ../trunk-jpl/src/java/doc/examples/snowpack_config.xml	(revision 17722)
+@@ -0,0 +1,1084 @@
++<inishell_config application="SNOWPACK">
++	<!-- <include path="doc/examples/meteoio_config.xml" /> -->
++
++	<!-- General Parameters -->
++	<parameter key="BUFF_CHUNK_SIZE" type="integer" default="30">
++		<section name="general" />
++		<help>Size in days of a chunk of data to read at once.</help>
++	</parameter>
++
++	<parameter key="BUFF_BEFORE" type="decimal" default="1.5">
++		<section name="general" />
++		<help>Alternate way of buffer centering: When rebuffering, the new date will be located BUFF_BEFORE days from the
++		beginning of the buffer (therefore, it takes a value in days).</help>
++	</parameter>
++
++	<!-- Coordinate systems, time zones -->
++	<parameter key="COORDSYS" type="alternative" optional="false">
++		<section name="input" />
++		<section name="output" />
++		<option value="CH1903" type="string">
++			<help>coordinates in the Swiss Grid &lt;a href="http://geomatics.ladetto.ch/ch1903_wgs84_de.pdf"&gt;http://geomatics.ladetto.ch/ch1903_wgs84_de.pdf&lt;/a&gt;</help>
++		</option>
++		<option value="UTM" type="string">
++			<parameter key="COORDPARAM" type="string">
++				<help>specify the zone with the zone letter (for example, 32T)</help>
++			</parameter>
++			<help>UTM coordinates, see &lt;a href="http://www.oc.nps.edu/oc2902w/maps/utmups.pdf"&gt;http://www.oc.nps.edu/oc2902w/maps/utmups.pdf&lt;/a&gt;</help>
++		</option>
++		<option value="UPS" type="string">
++			<parameter key="COORDPARAM" type="string">
++				<help>specify the hemisphere (either N or S)</help>
++			</parameter>
++			<help>Universal Polar Stereographic coordinates, see &lt;a href="https://en.wikipedia.org/wiki/Universal_Polar_Stereographic_coordinate_system"&gt;https://en.wikipedia.org/wiki/Universal_Polar_Stereographic_coordinate_system&lt;/a&gt;</help>
++		</option>
++		<option value="PROJ4" type="string">
++			<parameter key="COORDPARAM" type="string" optional="false" />
++			<help>external library: see &lt;a href="http://trac.osgeo.org/proj/"&gt;http://trac.osgeo.org/proj/&lt;/a&gt;</help>
++		</option>
++		<option value="LOCAL"  type="string">
++			<help>uses the horizontal and vertical distance from a reference point</help>
++		</option>
++		<help>coordinate system</help>
++	</parameter>
++
++	<parameter key="TIME_ZONE" type="integer+" default="+1" maximum="14" minimum="-12" optional="false">
++		<section name="input" />
++		<section name="output" />
++	</parameter>
++
++	<!-- Datatypes: Meteo Data -->
++	<frame key="meteo_frame" label="Meteorological Data">
++	<section name="input"/>
++	<parameter key="METEO" type="alternative" optional="false">
++		<section name="input" />
++
++		<option value="A3D" type="string">
++			<parameter key="METEOPATH" type="path" optional="false">
++				<help>string containing the path to the meteorological files</help>
++			</parameter>
++		</option>
++		<option value="BORMA" type="string">
++			<section name="input" />
++			<reference name="BORMA" />
++		</option>
++		<option value="COSMO" type="string">
++			<parameter key="METEOPATH" type="path" optional="false">
++				<help>string containing the path to the meteorological files</help>
++			</parameter>
++		</option>
++		<option value="GEOTOP" type="string">
++			<section name="input" />
++			<reference name="GEOTOP_IN" />
++		</option>
++		<option value="GRIB" type="string">
++			<section name="input" />
++			<reference name="GRIB_METEO" />
++		</option>
++		<option value="GSN" type="string">
++			<section name="input" />
++			<reference name="GSN" />
++		</option>
++		<option value="IMIS" type="string">
++			<section name="input" />
++			<reference name="IMIS" />
++		</option>
++		<option value="SMET" type="string">
++			<section name="input" />
++			<reference name="SMET_IN" />
++		</option>
++		<option value="SNOWPACK" type="string">
++			<section name="input" />
++			<reference name="SNIO_IN" />
++		</option>
++
++		<help>plugin for METEO data </help>
++	</parameter>
++	<parameter key="Add Meteo parameter copy" type="selector">
++		<section name="input"/>
++		<parameter key="COPY::%" type="string" optional="false" template="true">
++			<help>The name of the parameter to copy (e.g. TA, RH, VW, ISWR, etc)</help>
++		</parameter>
++		<help>Copy a meteo parameter into a new one (you should not need this)</help>
++	</parameter>
++	</frame>
++
++	<!-- Extra Input Parameters -->
++	<frame key="snow_frame" label="Initial Snow Profiles">
++	<section name="input"/>
++	<parameter key="SNOWPATH" type="path" default="./current_snow">
++		<section name="input" />
++		<help>Path to the land surface and snow input parameters</help>
++	</parameter>
++	<parameter key="SNOW" type="alternative" default="SMET" optional="true">
++		<section name="input" />
++		<option value="SNOWPACK" type="string" />
++		<option value="SMET" type="string" />
++		<help>Plugin to use for reading SNO data</help>
++	</parameter>
++	<parameter key="SNOWFILE#" type="file" counter="1" optional="false">
++		<section name="input" />
++		<help>file name for the initial profile for station number #</help>
++	</parameter>
++	<!-- <parameter key="NUMBER_OF_SOLUTES" type="integer" default="0" minimum="0" maximum="0">
++		<section name="input" />
++		<help>SNOWPACK can transport an arbitrary number of trace components in its snow and water phases [special use]</help>
++	</parameter> -->
++	</frame>
++
++	<!-- Output Parameters -->
++	<parameter key="METEOPATH" type="path" default="./output">
++		<section name="output" />
++		<help>Path to the outputs (this path MUST exist, it won't be created)</help>
++	</parameter>
++	<parameter key="EXPERIMENT" type="string" optional="false">
++		<section name="output" />
++		<help>Option to give an additional simulation specific output name to the run in addition to "STATION_NAME")</help>
++	</parameter>
++	<frame key="TS_frame" label="Time Series">
++	<section name="output"/>
++	<parameter key="TS_WRITE" type="alternative" optional="false">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Write meteo data out?</help>
++	</parameter>
++	<parameter key="TS_START" type="decimal" default="0" minimum="0" maximum="360">
++		<section name="output" />
++		<help>When to start writing meteo data out (offset, in days)</help>
++	</parameter>
++	<parameter key="TS_DAYS_BETWEEN" type="decimal" default="4.1666e-2" minimum="0" maximum="360">
++		<section name="output" />
++		<help>How often to write meteo data out (in days: 3 hours=.125, 1 hour=4.1666e-2)</help>
++	</parameter>
++	<parameter key="AVGSUM_TIME_SERIES" type="alternative" default="TRUE" optional="true">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>If AVGSUM_TIME_SERIES is set, mean fluxes and cumulated masses since last dump are written, else current energy fluxes, cumulated masses over last COMPUTATION_STEP_LENGTH (recommended setting in operational mode).</help>
++	</parameter>
++	<parameter key="CUMSUM_MASS" type="alternative" default="TRUE" optional="true">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>If CUMSUM_MASS is set, current value of cumulated masses since begin of run are dumped. Precipitations (rain and snow, rain) are always dumped as rates (kg m-2 h-1).</help>
++	</parameter>
++	<parameter key="PRECIP_RATES" type="alternative" optional="true" default="TRUE">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Write precipitation as rates (kg m-2 h-1, default) or as sums over the output time step. Please note that the units label in the output file and in SN_GUI &lt;b&gt;will remain kg m-2 h-1&lt;/b&gt; and will therefore not match sums.</help>
++	</parameter>
++	</frame>
++	<frame key="profiles_frame" label="Snow Profiles">
++	<section name="output"/>
++	<parameter key="PROFILE" type="alternative" default="ASCII" optional="false">
++		<section name="output" />
++		<option value="ASCII" type="string" />
++		<option value="IMIS" type="string" />
++		<option value="ASCII IMIS" type="string" />
++		<help>How to write the profiles (default: ASCII)</help>
++	</parameter>
++	<parameter key="PROF_WRITE" type="alternative" optional="false">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Write profile data out?</help>
++	</parameter>
++	<parameter key="PROF_START" type="decimal" default="0" minimum="0" maximum="360">
++		<section name="output" />
++		<help>When to start writing profile data out (offset, in days)</help>
++	</parameter>
++	<parameter key="PROF_DAYS_BETWEEN" type="decimal" default="4.1666e-2" minimum="0" maximum="360">
++		<section name="output" />
++		<help>How often to write profile data out (in days: 3 hours=.125, 1 hour=4.1666e-2)</help>
++	</parameter>
++	<parameter key="HARDNESS_IN_NEWTON" type="alternative" default="true">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Write the hand hardness in newtons (default) or as index</help>
++	</parameter>
++	<parameter key="CLASSIFY_PROFILE" type="alternative" default="false">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Classify the profile (default=false)? This is according to Schweizer, J. and M. Luetschg, &lt;i&gt;Characteristics of human-triggered avalanches&lt;/i&gt;, 2001, Cold Reg. Sci. Technol. &lt;b&gt;33&lt;/b&gt;(2-3)</help>
++	</parameter>
++	</frame>
++	<frame key="sno_frame" label="Status files">
++	<section name="output"/>
++	<parameter key="SNOW" type="alternative" default="SMET" optional="true">
++		<section name="output" />
++		<option value="SNOWPACK" type="string" />
++		<option value="SMET" type="string" />
++		<help>Plugin to use for reading SNO data</help>
++	</parameter>
++	<parameter key="BACKUP_DAYS_BETWEEN" type="decimal" default="365" minimum="0">
++		<section name="output" />
++		<help>Dump snow files every BACKUP_DAYS_BETWEEN days</help>
++	</parameter>
++	<parameter key="FIRST_BACKUP" type="decimal" default="400" minimum="0">
++		<section name="output" />
++		<help>First dump of sno files happens at end of run or after FIRST_BACKUP days, whichever happens first</help>
++	</parameter>
++	</frame>
++
++	<frame key="switch_frame" label="Outputs Selection">
++	<section name="output"/>
++	<parameter key="OUT_CANOPY" type="alternative" default="FALSE" optional="true">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Write canopy data out? To be set to TRUE only if CANOPY=TRUE</help>
++	</parameter>
++	<parameter key="OUT_HAZ" type="alternative" default="TRUE" optional="true">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Write hazard data out? This must be FALSE for Alpine3D</help>
++	</parameter>
++	<parameter key="OUT_HEAT" type="alternative" default="TRUE" optional="true">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Write turbulent fluxes out?</help>
++	</parameter>
++	<parameter key="OUT_T" type="alternative" default="TRUE" optional="true">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Write snow/soil temperatures out?</help>
++	</parameter>
++	<!-- <parameter key="OUT_LOAD" type="alternative" default="FALSE" optional="true">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Write solutes load data out?</help>
++	</parameter> -->
++	<parameter key="OUT_LW" type="alternative" default="TRUE" optional="true">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Write long wave radiation out?</help>
++	</parameter>
++	<parameter key="OUT_SW" type="alternative" default="TRUE" optional="true">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Write short wave radiation out?</help>
++	</parameter>
++	<parameter key="OUT_MASS" type="alternative" default="TRUE" optional="true">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Write mass balance terms out?</help>
++	</parameter>
++	<parameter key="OUT_METEO" type="alternative" default="TRUE" optional="true">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Write meteo parameters out?</help>
++	</parameter>
++	<parameter key="OUT_STAB" type="alternative" default="TRUE" optional="true">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Write stability parameters out?</help>
++	</parameter>
++	</frame>
++
++
++	<!-- Snowpack Parameters -->
++	<frame key="sn_parameters_frame" label="Model Parameters">
++	<section name="Snowpack"/>
++	<parameter key="CALCULATION_STEP_LENGTH" type="decimal" default="15" minimum="5" maximum="180">
++		<section name="Snowpack" />
++		<help>Internal time step (in minutes) used for model simulation. Please note that this MUST be the same as HNW::accumulate (the latter being in seconds) if re-acumulating precipitation, otherwise it would lead to wrong results.</help>
++	</parameter>
++	<parameter key="ROUGHNESS_LENGTH" type="decimal" default="0.002">
++		<section name="Snowpack" />
++		<help>Aerodynamic roughness length as a parameter for the Monin-Obukhov bulk formulation; A typical value for complex terrain is 0.01 m and for snow covered flat sites 0.001 m.</help>
++	</parameter>
++	<parameter key="HEIGHT_OF_METEO_VALUES" type="decimal" default="5.0">
++		<section name="Snowpack" />
++		<help>The instrument height (or model layer height) for meteorological input data except for wind, which may be at a different height; note that height is above ground for a standard SNOWPACK application but above surface (snow or ground) for Alpine3D applications.</help>
++	</parameter>
++	<parameter key="HEIGHT_OF_WIND_VALUE" type="decimal" default="5.0">
++		<section name="Snowpack" />
++		<help>The instrument height (or model layer height) for wind input data; note that height is above ground for a standard SNOWPACK application but above surface (snow or ground) for Alpine3D applications</help>
++	</parameter>
++	</frame>
++	<frame key="sn_switch_frame" label="Models Selection">
++	<section name="Snowpack"/>
++	<parameter key="ENFORCE_MEASURED_SNOW_HEIGHTS" type="alternative" optional="false">
++		<section name="Snowpack" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Input mode by which a measurement of snow depth is used to drive the snow cover mass balance</help>
++	</parameter>
++	<parameter key="SW_MODE" type="integer" default="0" minimum="0" maximum="2" optional="false">
++		<section name="Snowpack" />
++		<help>Define the shortwave radiation input: &lt;ol&gt; &lt;li value="0"&gt;Incoming shortwave radiation is measured and albedo estimated by the model;&lt;/li&gt; &lt;li&gt;Reflected shortwave radiation is available as input and albedo is estimated by the model (IMIS standard);&lt;/li&gt; &lt;li&gt;Incoming and reflected shortwave radiation are both measured and the albedo is estimated from both measurements subject to plausibility checks.&lt;/li&gt; &lt;/ol&gt;</help>
++	</parameter>
++	<parameter key="NEUTRAL" type="integer" default="1" minimum="-1" maximum="1" optional="false">
++		<section name="Snowpack" />
++		<help>Select the atmospheric stability correction model:&lt;ol&gt; &lt;li value="-1"&gt; use a simplified Richardson number stability correction;&lt;/li&gt; &lt;li&gt;assume standard Monin-Obukhov bulk formulation for surface exchange iteration with Paulson, Stearns and Weidner (can be used with BC_CHANGE=0); &lt;/li&gt; &lt;li&gt; force Monin-Obukhov formulation to assume neutral conditions regardless of the actual stratification; it has been shown to work well in complex terrain settings. It should be used with BC_CHANGE=1, i.e., Dirichlet bc but also is recommended with Neumann b.c., i.e., BC_CHANGE=0.&lt;/li&gt; &lt;/ol&gt;</help>
++	</parameter>
++	<parameter key="CANOPY" type="alternative" default="FALSE" optional="false">
++		<section name="Snowpack" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Switch to tell the model that canopy is present (note that Canopy parameters should then be provided in the *.sno file)</help>
++	</parameter>
++	<parameter key="MEAS_TSS" type="alternative" default="TRUE" optional="false">
++		<section name="Snowpack" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>A measured surface temperature is available and can be reliably used for various consistency tests (it needs to be set to true if enabling CHANGE_BC).</help>
++	</parameter>
++	<parameter key="CHANGE_BC" type="alternative" optional="false">
++		<section name="Snowpack" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Use measured surface temperature as Dirichlet temperature BC for sub-freezing snowpacks and switch to Neumann only for melting snowpacks. If set to false, assumes Neumann boundary conditions.</help>
++	</parameter>
++	<parameter key="THRESH_CHANGE_BC" type="decimal" default="-1.3">
++		<section name="Snowpack" />
++		<help>Threshold value (small number below freezing), which switches from Dirichlet to Neumann BCs if CHANGE_BC is selected</help>
++	</parameter>
++	</frame>
++	<frame key="sn_slopes_frame" label="Virtual slopes">
++	<section name="Snowpack"/>
++	<parameter key="NUMBER_SLOPES" type="alternative" default="1" optional="false">
++		<section name="Snowpack" />
++		<option value="1" type="string" />
++		<option value="5" type="string" />
++		<option value="3" type="string" />
++		<option value="9" type="string" />
++		<help>Based on meteorological input from a (flat field) automatic station or numerical weather model, up to 8 expositions can be calculated in addition to the flat field if the corresponding *.sno files are provided. For example, if you provide a flat field *.snow file (mandatory), which is named KLO3.sno and you want 4 slopes to be calculated the corresponding slope files should be named KLO21.sno, …,KLO24.sno</help>
++	</parameter>
++	<parameter key="INCOMING_LONGWAVE" type="alternative" default="FALSE" optional="false">
++		<section name="Snowpack" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Use the provided incoming long wave on the virtual slopes?</help>
++	</parameter>
++	<parameter key="SNOW_REDISTRIBUTION" type="alternative" default="FALSE" optional="false">
++		<section name="Snowpack" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Specifies if redistribution of snow is allowed from (upwind) expositions to lee slopes. In case just the flat field is calculated, snow erosion is enabled but only for "ENFORCE_MEASURED_SNOW_HEIGHTS".</help>
++	</parameter>
++	</frame>
++	<frame key="soil_frame" label="Soil Modeling">
++	<section name="Snowpack"/>
++	<parameter key="SNP_SOIL" type="alternative" default="TRUE" optional="false">
++		<section name="Snowpack" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Soil layers as defined by the *.sno files are included in the simulation</help>
++	</parameter>
++	<parameter key="SOIL_FLUX" type="alternative" default="FALSE" optional="false">
++		<section name="Snowpack" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Assume that the lower temperature boundary condition is given by GEO_HEAT (Neumann) and not by a measured temperature</help>
++	</parameter>
++	<parameter key="GEO_HEAT" type="decimal" default="0.06">
++		<section name="Snowpack" />
++		<help>Constant geothermal heat flux at great) depth W m-2): Lower flux boundary condition for temperature equation if BC is Neumann</help>
++	</parameter>
++	</frame>
++
++
++	<!-- SnowpackAdvanced Parameters -->
++	<parameter key="ASSUME_RESPONSIBILITY" type="alternative" default="AGREE">
++		<section name="SnowpackAdvanced" />
++		<option value="AGREE" type="string" />
++		<help>&lt;font color="FF0000"&gt;The keys in this section deeply affect the operation of the SNOWPACK model. This could lead to unexpected behavior or surprising results. If you are not an experienced Snowpack user, please do NOT change any keys below!&lt;/font&gt;</help>
++	</parameter>
++	<parameter key="VARIANT" type="alternative">
++		<section name="SnowpackAdvanced" />
++		<option value="DEFAULT" type="string" />
++		<option value="JAPAN" type="string" />
++		<option value="ANTARTICA" type="string" />
++		<!-- <option value="CALIBRATION" type="string" /> -->
++		<help>variant selection (includes a choice of specific models)</help>
++	</parameter>
++	<!-- <parameter key="RESEARCH" type="alternative" optional="true" default="TRUE">
++		<section name="SnowpackAdvanced" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>research_mode</help>
++	</parameter> -->
++	<!-- <parameter key="NUMBER_FIXED_RATES" type="integer" default="0">
++		<section name="SnowpackAdvanced" />
++		<help>number_fixed_rates</help>
++	</parameter> -->
++	<parameter key="PERP_TO_SLOPE" type="alternative" optional="true" default="FALSE">
++		<section name="SnowpackAdvanced" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>perp_to_slope</help>
++	</parameter>
++	<frame key="wind_frame" label="Wind Handling">
++	<section name="SnowpackAdvanced"/>
++	<parameter key="PREVAILING_WIND_DIR" type="decimal" default="0">
++		<section name="SnowpackAdvanced" />
++		<help>Shifts the origin of the wind rose for snow redistribution and slope simulations: e.g. choose 45° to have NE/SE/SW/NW</help>
++	</parameter>
++	<parameter key="WIND_SCALING_FACTOR" type="decimal" default="1.0" minimum="0" maximum="2">
++		<section name="SnowpackAdvanced" />
++		<help>Scaling factor to apply to wind values in case of drifting snow</help>
++	</parameter>
++	</frame>
++	<frame key="hnw_frame" label="Precipitation Handling">
++	<section name="SnowpackAdvanced"/>
++	<parameter key="FORCE_RH_WATER" type="alternative" optional="true">
++		<section name="SnowpackAdvanced" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Tell the model that relative humidity values are with respect to water regardless of the temperature</help>
++	</parameter>
++	<parameter key="THRESH_RAIN" type="decimal" default="1.2">
++		<section name="SnowpackAdvanced" />
++		<help>Temperature threshold for rain/snow transition</help>
++	</parameter>
++	<parameter key="THRESH_RH" type="decimal" default="0.5">
++		<section name="SnowpackAdvanced" />
++		<help>If ENFORCE_MEASURED_SNOW_HEIGHTS, relative humidity threshold for precipitation to occur</help>
++	</parameter>
++	<parameter key="THRESH_DT_AIR_SNOW" type="decimal" default="3.0">
++		<section name="SnowpackAdvanced" />
++		<help>If ENFORCE_MEASURED_SNOW_HEIGHTS, (TA-TSS) threshold for precipitation to occur</help>
++	</parameter>
++	</frame>
++	<frame key="hoar_frame" label="Hoar Handling">
++	<section name="SnowpackAdvanced"/>
++	<parameter key="HOAR_THRESH_RH" type="decimal" default="0.97">
++		<section name="SnowpackAdvanced" />
++		<help>Relative humidity threshold above which no surface hoar is allowed to form (because at very high humidity, typically no hoar crystals can form)</help>
++	</parameter>
++	<parameter key="HOAR_THRESH_VW" type="decimal" default="3.5">
++		<section name="SnowpackAdvanced" />
++		<help>Wind speed threshold above which no surface hoar is allowed to form (because it will drift away)</help>
++	</parameter>
++	<parameter key="HOAR_DENSITY_BURIED" type="decimal" default="125.0">
++		<section name="SnowpackAdvanced" />
++		<help>Define the initial density for surface hoar at the time it gets buried by new snow</help>
++	</parameter>
++	<parameter key="HOAR_MIN_SIZE_BURIED" type="decimal" default="2.0">
++		<section name="SnowpackAdvanced" />
++		<help>Define a threshold below which any traces of surface hoar will not be given a separate hoar layer when buried.</help>
++	</parameter>
++	<parameter key="HOAR_DENSITY_SURF" type="decimal" default="100.0">
++		<section name="SnowpackAdvanced" />
++		<help>Assumed density of surface hoar while exposed at the surface and not buried</help>
++	</parameter>
++	</frame>
++	<frame key="temps_frame" label="Temperatures Handling">
++	<section name="SnowpackAdvanced"/>
++	<parameter key="FIXED_POSITIONS" type="string" default="">
++		<section name="SnowpackAdvanced" />
++		<help>positions of temperatur sensors in snow or soil: positive values refer to heigths measured from the ground surface (snow only), negative values refer to depths measured from either the ground surface or the snow surface in case no soil layers are present. A sensor must at least be covered by MIN_DEPTH_SUBSURF (m) snow for its temperature to be output.</help>
++	</parameter>
++	<!-- <parameter key="MAX_NUMBER_MEAS_TEMPERATURES" type="integer" default="5">
++		<section name="SnowpackAdvanced" />
++		<help></help>
++	</parameter> -->
++	<parameter key="MIN_DEPTH_SUBSURF" type="decimal" default="0.07">
++		<section name="SnowpackAdvanced" />
++		<help>Minimum snow depth above a temperature sensor to accept the measurement</help>
++	</parameter>
++	<parameter key="T_CRAZY_MIN" type="decimal" default="210.">
++		<section name="SnowpackAdvanced" />
++		<help>If you go to Antarctica or the tropics you may expect different reasonable temperatures</help>
++	</parameter>
++	<parameter key="T_CRAZY_MAX" type="decimal" default="340.">
++		<section name="SnowpackAdvanced" />
++		<help>If you go to Antarctica or the tropics you may expect different reasonable temperatures</help>
++	</parameter>
++	</frame>
++	<frame key="sn_models_frame" label="Models Selection">
++	<section name="SnowpackAdvanced"/>
++	<parameter key="HN_DENSITY_MODEL" type="alternative" default="LEHNING_NEW">
++		<section name="SnowpackAdvanced" />
++		<option value="LEHNING_NEW" type="string" />
++		<option value="ZWART" type="string" />
++		<option value="BELLAIRE" type="string" />
++		<option value="LEHNING_OLD" type="string" />
++		<option value="PAHAUT" type="string" />
++		<help>Choice of new snow density model (diverse statistical models)</help>
++	</parameter>
++	<parameter key="HN_DENSITY" type="string" default="PARAMETERIZED">
++		<section name="SnowpackAdvanced" />
++		<help>Fixed value to be used as new snow density if a constant density model is chosen, otherwise the choices are "PARAMETERIZED" "EVENT" "MEASURED"</help>
++	</parameter>
++	<parameter key="METAMORPHISM_MODEL" type="alternative">
++		<section name="SnowpackAdvanced" />
++		<option value="DEFAULT" type="string" />
++		<option value="NIED" type="string" />
++		<help>metamorphism_model</help>
++	</parameter>
++	<parameter key="NEW_SNOW_GRAIN_RAD" type="decimal" default="0.15">
++		<section name="SnowpackAdvanced" />
++		<help>new_snow_grain_rad</help>
++	</parameter>
++	<parameter key="STRENGTH_MODEL" type="alternative">
++		<section name="SnowpackAdvanced" />
++		<option value="DEFAULT" type="string" />
++		<option value="NIED" type="string" />
++		<help>strength_model</help>
++	</parameter>
++	<parameter key="VISCOSITY_MODEL" type="alternative">
++		<section name="SnowpackAdvanced" />
++		<option value="DEFAULT" type="string" />
++		<option value="NIED" type="string" />
++		<help>viscosity_model</help>
++	</parameter>
++	<parameter key="HARDNESS_MODEL" type="alternative">
++		<section name="SnowpackAdvanced" />
++		<option value="MONTI" type="string" />
++		<option value="BELLAIRE" type="string" />
++		<option value="ASARC" type="string" />
++		<help>hardness_model</help>
++	</parameter>
++	<parameter key="DOORSCHOT" type="alternative" optional="true" default="FALSE">
++		<section name="SnowpackAdvanced" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Choose the Doorschot saltation model over the simple Sorenson parameterization</help>
++	</parameter>
++	<parameter key="MULTISTREAM" type="alternative" optional="true">
++		<section name="SnowpackAdvanced" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Select a multi stream model for shortwave radiation penetration into the snow cover</help>
++	</parameter>
++	<parameter key="FIXED_ALBEDO" type="alternative" optional="true">
++		<section name="SnowpackAdvanced" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Force the model to work with a fixed albedo</help>
++	</parameter>
++	<!-- <parameter key="SURFACECODE" type="alternative" optional="true">
++		<section name="SnowpackAdvanced" />
++		<option value="NEUMANN_BC" type="string" />
++		<option value="DIRICHLET_BC" type="string" />
++		<help>Select the boundary conditions to use</help>
++	</parameter> -->
++	</frame>
++	<frame key="sn_extra_frame" label="Extra Models Selection">
++	<section name="SnowpackAdvanced"/>
++	<parameter key="DETECT_GRASS" type="alternative" optional="true" default="TRUE">
++		<section name="SnowpackAdvanced" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Identify grass growing under the snow height sensor. This usually works well but might sometimes lead to problems</help>
++	</parameter>
++	<parameter key="PLASTIC" type="alternative" optional="true" default="FALSE">
++		<section name="SnowpackAdvanced" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Switch to tell the model that a impermeable layer should be simulated on top of some snow or ice: this requires that the *.sno file contains this layer, which is characterized via the soil parameters; the option has successfully been used to simulate snow and ice protection using geo-textiles and saw dust.</help>
++	</parameter>
++	<parameter key="JAM" type="alternative" optional="true" default="FALSE">
++		<section name="SnowpackAdvanced" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>If switched on, you can also simulate ponding on impermeable ice surfaces below the snow cover</help>
++	</parameter>
++	<parameter key="WATER_LAYER" type="alternative" optional="true" default="FALSE">
++		<section name="SnowpackAdvanced" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Assuming an impermeable surface such as on a road or on geo-textiles (e.g. for snow farming), a liquid water layer is allowed to form on this surface</help>
++	</parameter>
++	</frame>
++	<frame key="elements_frame" label="Elements Handling">
++	<section name="SnowpackAdvanced"/>
++	<parameter key="HEIGHT_NEW_ELEM" type="decimal" default="0.02">
++		<section name="SnowpackAdvanced" />
++		<help>Standard size of a new element added to the stack of elements (layers) during snowfall events</help>
++	</parameter>
++	<parameter key="MINIMUM_L_ELEMENT" type="decimal" default="0">
++		<section name="SnowpackAdvanced" />
++		<help>Threshold value for enforcing the layer to be merged with the layer above or below</help>
++	</parameter>
++	<parameter key="COMBINE_ELEMENTS" type="alternative" optional="true">
++		<section name="SnowpackAdvanced" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Combine neighboring elements based on a set of similarity conditions which are hard-coded</help>
++	</parameter>
++	</frame>
++
++	<!--Parameter group for list of stations -->
++	<parametergroup name="stationgroup_files">
++		<parameter key="STATION#" type="file" counter="1" optional="false">
++			<help>filename for station number # </help>
++		</parameter>
++	</parametergroup>
++	<parametergroup name="stationgroup_names">
++		<parameter key="STATION#" type="string" counter="1" optional="false">
++			<help>station id for the given station number # </help>
++		</parameter>
++	</parametergroup>
++	<parametergroup name="stationgroup_pos">
++		<parameter key="STATION#" type="string" counter="1">
++			<help>Coordinates are given as "lat lon" or "xcoord ycoord epsg_code"</help>
++		</parameter>
++	</parametergroup>
++
++	<!-- Plugins for Meteo Data-->
++	<parametergroup name="BORMA">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the xml files</help>
++		</parameter>
++		<reference name="stationgroup_names" />
++	</parametergroup>
++
++	<parametergroup name="IMIS">
++		<parameter key="DBNAME" type="string" optional="false">
++			<help>database name, as provided by your database administrator</help>
++		</parameter>
++		<parameter key="DBUSER" type="string" optional="false">
++			<help>database user name</help>
++		</parameter>
++		<parameter key="DBPASS" type="string" optional="false">
++			<help>database password associated with the user name</help>
++		</parameter>
++		<parameter key="USEANETZ" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>OPTIONAL: use ANETZ stations to provide precipitations for normal IMIS stations.
++		  Each IMIS station is associated with one or two ANETZ stations and does a weighted
++		  average to get what should be its local precipitations</help>
++		</parameter>
++		<parameter key="USE_IMIS_HNW" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>OPTIONAL: if set to false (default), all IMIS precipitation will be deleted (since IMIS stations don't have heated rain gauges, their precipitation measurements are not good in winter conditions). If set to true, it is strongly advised to use a FilterHNWMelt filter to detect snow melting in the rain gauge and perform winter conditions detection in the application.</help>
++		</parameter>
++		<parameter key="USE_SNOWPACK_HNW" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>if set to true, the SNOWPACK simulated Snow Water Equivalent from the database will be used to compute HNW. Data gaps greater than 3 hours on SWE will lead to unchanged hnw while all data that can properly be computed will overwrite hnw. (default=false)</help>
++		</parameter>
++
++		<reference name="stationgroup_names" />
++	</parametergroup>
++
++	<parametergroup name="GRIB_METEO">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the grib files</help>
++		</parameter>
++		<parameter key="METEOEXT" type="string" optional="true">
++			<help>grib file extension, or none for no file extension (default: .grb)</help>
++		</parameter>
++
++		<reference name="stationgroup_pos" />
++	</parametergroup>
++
++	<parametergroup name="GEOTOP_IN">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the data files</help>
++		</parameter>
++		<parameter key="METAFILE" type="file" optional="false">
++			<help>absolute filename of the geotop.inpts file</help>
++		</parameter>
++		<parameter key="METEOPREFIX" type="string" optional="true">
++			<help>prefix to append when generating a file name for reading</help>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="GSN">
++		<parameter key="ENDPOINT" type="string" optional="false">
++			<help>webserver running GSN with its port number and full path. For example:
++			http://montblanc.slf.ch:22001/services/A3DWebService</help>
++		</parameter>
++		<parameter key="PROXY" type="string" optional="true">
++			<help>Should the connection go through a proxy? This is useful for servers
++			filtering on domains but usually not necessary.</help>
++		</parameter>
++		<parameter key="PROXYPORT" type="string" optional="true" />
++		<parameter key="PROXYUSER" type="string" optional="true" />
++		<parameter key="PROXYPASS" type="string" optional="true" />
++
++		<reference name="stationgroup_names" />
++	</parametergroup>
++
++	<parametergroup name="SMET_IN">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the smet files</help>
++		</parameter>
++		<reference name="stationgroup_files" />
++	</parametergroup>
++
++	<parametergroup name="SNIO_IN">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the SNOWPACK files</help>
++		</parameter>
++		<parameter key="METAFILE" type="file" optional="true">
++			<help>filename of the meta data file (in METEOPATH)</help>
++		</parameter>
++		<parameter key="NUMBER_MEAS_TEMPERATURES" type="integer+" minimum="0" default="0">
++		  <help>the number of measured snow temperatures that are provided</help>
++		</parameter>
++		<parameter key="NUMBER_OF_SOLUTES" type="integer+" minimum="0" default="0">
++		  <help>the number of solutes for which input data are provided</help>
++		</parameter>
++
++		<parameter key="RSWR_INP" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		</parameter>
++		<parameter key="ISWR_INP" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		</parameter>
++		<parameter key="VW_DRIFT" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>OPTIONAL: wind velocity to use for blowing and drifting snow is provided</help>
++		</parameter>
++		<parameter key="RHO_HN" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>OPTIONAL: measured new snow density is provided</help>
++		</parameter>
++
++		<reference name="stationgroup_files" />
++	</parametergroup>
++
++	<!-- Meteo Parameters for Filters, resampling, spatial interpolations-->
++	<parametergroup name="METEOIOPARAMETERS">
++		<option value="TA"/>
++		<option value="RH"/>
++		<option value="VW"/>
++		<option value="DW"/>
++		<option value="VW_MAX"/>
++		<option value="ISWR"/>
++		<option value="RSWR"/>
++		<option value="ILWR"/>
++		<option value="HS"/>
++		<option value="HNW"/>
++		<option value="TSG"/>
++		<option value="TSS"/>
++		<option value="P"/>
++	</parametergroup>
++
++	<!-- Filters -->
++	<parameter key="Add/Remove Filter" type="selector">
++		<section name="filters" />
++
++		<parameter key="%::filter#" type="alternative" counter="1" template="true">
++			<section name="filters" />
++
++			<option label="MeanAvg" value="mean_avg" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Mean average processing. The mean average filter returns the mean value of all values within a user given time window.</help>
++			</option>
++
++
++			<option label="MedianAvg" value="median_avg" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="decimal" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Median average processing. The median average filter returns the median value of all values within a user given time window.</help>
++			</option>
++
++			<option label="Std Deviation Filter" value="std_dev" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Standard deviation filter. Values outside of mean ± 2 std_dev are rejected.</help>
++			</option>
++
++			<option label="MAD" value="mad" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Median Absolute Deviation. Values outside of median ± 3 σ_MAD are rejected. &lt;br&gt;
++			  See http://en.wikipedia.org/wiki/Median_absolute_deviation for more information.</help>
++			</option>
++
++			<option label="Tukey 53H Filter" value="Tukey" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      The keyword "soft" maybe added, if the window position is allowed to be adjusted to the data present.
++			      The two arguments may be preceded by the keywords "left", "center" or "right", indicating the window position.
++			    </help>
++			  </parameter>
++			  <help>Tukey 53H method A smooth time sequence is generated from the median, substracted from the original signal and
++			  compared with the standard deviation. see "Despiking Acoustic Doppler Velocimeter Data", Derek G. Goring and Vladimir
++			  L. Nikora, Journal of Hydraulic Engineering, 128, 1, 2002 The deviation factor coeffecient is currently hard-coded as k=1.5. </help>
++			</option>
++
++			<option label="Wind Averaging Filter" value="wind_avg" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Wind vector averaging. This calculates the vector average over a user given time period. Each wind vector
++			  within this period is added and the final sum is normalized by the number of vectors that have been added. </help>
++			</option>
++
++			<option label="Exponential Smoothing" value="exp_smoothing" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <option label="alpha:" value="0.8" type="decimal" minimum="0" maximum="1"/>
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			      Alpha needs to be provided as last argument. Please note that the standard filter works with a left window!
++			    </help>
++			  </parameter>
++			  <help>Exponential smooting processing, exponential moving average s_0 = x_0 s_n = alpha*x_(t-1) + (1-alpha)*s_t-1</help>
++			</option>
++
++			<option label="Weighted Moving Average Smoothing" value="wma_smoothing" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			      Please note that the standard filter works with a left window!
++			    </help>
++			  </parameter>
++			  <help>Weighted moving average smoothing such as: WMA = (1*X1 + 2*X2 + ... + n*Xn) / sum_of_weights</help>
++			</option>
++
++			<option label="Min Range Filter" value="min" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option label="Min:" value="" type="decimal" />
++			    <option label="Adjust to:" value="" type="decimal" />
++			    <help>The keyword "soft" maybe added, in such a case all data smaller than the min would be
++			    assigned the minimum permissible value or another value given as an extra argument</help>
++			  </parameter>
++			  <help>Min range filter. Reject all values smaller than the min.</help>
++			</option>
++
++			<option label="Max Range Filter" value="max" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option label="Max:" value="" type="decimal" />
++			    <option label="Adjust to:" value="" type="decimal" />
++			    <help>The keyword "soft" maybe added, in such a case all data greater than the max would be
++			    assigned the maximum permissible value or another value given as an extra argument</help>
++			  </parameter>
++			  <help>Max range filter. Reject all values greater than the max.</help>
++			</option>
++
++			<option label="MinMax (2 or 4 arguments)" value="min_max" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option label="Min:" value="" type="decimal" />
++			    <option label="Max:" value="" type="decimal" />
++			    <option label="Min adjust to:" value="" type="decimal" />
++			    <option label="Max adjust to:" value="" type="decimal" />
++			    <help>The keyword "soft" maybe added, in such a case all data greater than the max would be assigned
++			    the maximum permissible value and all data smaller than the min would be assigned the minimum
++			    permissible value or an optional extra set of two user provided values</help>
++			  </parameter>
++			  <help>Reject all values greater than the max or smaller than the min. &lt;br&gt;</help>
++			</option>
++
++			<option label="Rate Filter (1 argument)" value="rate" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option label="Max:" value="1.0" type="decimal" minimum="0" maximum="1" />
++			    <help>the absolute value of the maximum permissible rate of change (per seconds)</help>
++			  </parameter>
++			  <help>Rate of change filter. Calculate the change rate (ie: slope) between two points, if it is above a user given value, reject the point.</help>
++			</option>
++
++			<option label="Rate Filter (2 arguments)" value="rate" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option label="Min:" value="0.0" type="decimal" minimum="0" maximum="1" />
++			    <option label="Max:" value="1.0" type="decimal" minimum="0" maximum="1" />
++			    <help>the minimum and maximum permissible rate of change (per second)</help>
++			  </parameter>
++			  <help>Rate of change filter. Calculate the change rate (ie: slope) between two points, if it is above a user given value, reject the point.</help>
++			</option>
++
++			<option label="Unheated Rain Gauge Filter" value="Unheated_RainGauge" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option label="RH threshold:" value="0.5" type="decimal" minimum="0" maximum="1" />
++			    <option label="Delta_T threshold:" value="3.0" type="decimal" minimum="0" maximum="20" />
++			  </parameter>
++			  <help>Filters out snow melting in an unheated rain gauge. This filter can ONLY be applied to precipitation. Non-zero measurements are accepted only if they take place when the relative humidity is greater than RH_threshold and (TA-TSS) smaller than Delta_T_threshold, otherwise they get reset to 0. If none of these conditions could be tested (for lack of data), then the precipitation is reset to nodata (or left unchanged if "soft" has been selected).</help>
++			</option>
++
++			<option label="WMO Undercatch Filter" value="undercatch_wmo" type="string">
++			  <parameter key="%::arg#" type="combination">
++				<option value="Gage type" type="dropdown">
++					<option value="Nipher" type="string" />
++					<option value="Tretyakov" type="string" />
++					<option value="US8sh" type="string" />
++					<option value="US8unsh" type="string" />
++					<option value="Hellmann" type="string" />
++					<option value="Hellmannsh" type="string" />
++				</option>
++			  </parameter>
++			  <help>This implements the standard methods for precipitation correction as described in "WMO Solid Precipitation Measurement Intercomparison", B. Goodison, P. Louie and D. Yang, 872, 1998 as well as the overview given by "Literature Study on the Correction of Precipitation Measurements", Annette Wagner, 2009. The correction parameters for the shielded Hellmann gauge (German version) are from "Wind-induced Precipitation Undercatch of the Hellmann Gauges", Daqing Yang et al, Nordic Hydrology, 30, 1999, pp 57-80.</help>
++			</option>
++
++			<option label="WMO Undercatch Filter - simplified" value="undercatch_wmo" type="string">
++			  <parameter key="%::arg#" type="combination">
++				<option value="Kind" type="dropdown">
++					<option value="Cst" type="string" />
++				</option>
++				<option label="Snow factor:" value="1.3" type="decimal" minimum="0" maximum="5" />
++				<option label="Mixed precipitation factor:" value="1.1" type="decimal" minimum="0" maximum="5" />
++			  </parameter>
++			  <help>This applies a constant correction factor to the precipitation, one for pure snow and one for mixed precipitation. The following thresholds are used: pure snow below -2 C; mixed precipitation between -2 and +2 C; pure rain above 2 C. These threshold can be changed (see online documentation).</help>
++			</option>
++
++			<option label="Unventillated temperature sensor" value="Unventilated_T" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option label="albedo:" value="0.23" type="decimal" />
++			    <option value="soft" type="choice" />
++			    <help>If the "soft" option is given, the albedo has a value different according to snow (or no snow) on the ground</help>
++			  </parameter>
++			  <help>This implements the correction described in (Reina Nakamura, 2005) with an albedo dependency as introduced in (Huwald, 2009)</help>
++			</option>
++
++			<option label="Add an offset" value="add" type="string">
++			  <parameter key="%::arg#" type="combination">
++				<option label="offset:" value="0." type="decimal" />
++			  </parameter>
++			  <help>This adds a given offset to the data.</help>
++			</option>
++
++			<option label="Multiply by a factor" value="mult" type="string">
++			  <parameter key="%::arg#" type="combination">
++				<option label="factor:" value="1." type="decimal" />
++			  </parameter>
++			  <help>This multiplies the data by a given factor.</help>
++			</option>
++
++		</parameter>
++
++		<reference name="METEOIOPARAMETERS" />
++	</parameter>
++
++	<!-- 1D Interpolation -->
++	<parameter key="WINDOW_SIZE" type="integer+" minimum="1" default="43200">
++		<section name="Interpolations1D" />
++		<help>Affects resampling: expresses (in seconds) how far a valid point can be
++		searched for when re-interpolating a missing value</help>
++	</parameter>
++
++	<parameter key="Add/Remove 1D Interpolation" type="selector">
++		<section name="Interpolations1D" />
++
++		<parameter key="%::resample" type="alternative" template="true">
++			<section name="Interpolations1D" />
++			<option label="No Interpolation" value="none" type="string" />
++			<option label="Nearest Neighbour" value="nearest_neighbour" type="string" />
++			<option label="Linear" value="linear" type="string">
++			  <parameter key="%::args" type="combination">
++			    <option value="extrapolate" type="choice" />
++			    <help>
++			      If "extrapolate" is added, then data *outside* of the original date range can be interpolated.
++			      Otherwise, a data point will only be calculated between the original date range.
++			    </help>
++			  </parameter>
++			  <help>Mean average processing. The mean average filter returns the mean value of all values within a user given time window.</help>
++			</option>
++			<option label="Accumulate" value="accumulate" type="string">
++			  <parameter key="%::args" type="combination">
++			    <option value="strict" type="choice" />
++			    <option label="Seconds:" value="900" type="integer" minimum="1" />
++			    <help>Accumulation period (in seconds). This must usually match the model time step. if enabling "strict", nodatas will propagate (ie. a single nodata in the input will force the re-accumulated value to be nodata). Otherwise, all valid values are aggregated and only pure nodata intervals produce a nodata in the output.</help>
++			  </parameter>
++			  <help>Accumulation over a user given period (filter argument, in seconds -
++			  should coincide with your calculation step!).</help>
++			</option>
++		</parameter>
++
++		<reference name="METEOIOPARAMETERS" />
++	</parameter>
++
++</inishell_config>
+\ No newline at end of file
+
+Property changes on: ../trunk-jpl/src/java/doc/examples/snowpack_config.xml
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/doc/examples/issm.xml
+===================================================================
+--- ../trunk-jpl/src/java/doc/examples/issm.xml	(revision 0)
++++ ../trunk-jpl/src/java/doc/examples/issm.xml	(revision 17722)
+@@ -0,0 +1,1284 @@
++<inishell_config application="ISSM prototype">
++
++<!-- mesh -->
++<parameter key ="Dimension" type="alternative" optional="false">
++     <section name="mesh" />
++     <option value="0" type="string" default="true">
++        <help> dimension is 0 </help>
++     </option>
++     <option value="3" type="string">
++        <help> dimension is 3 </help>
++       <!-- Elements and vertices of the original 2d mesh -->
++          <parameter key ="x2d" type="double" default="N/A">
++              <help> vertices x coordinate [m] </help>
++          </parameter>
++          <parameter key ="y2d" type="double" default="N/A">
++              <help> vertices y coordinate [m] </help>
++          </parameter>
++          <parameter key ="elements2d" type="double" default="N/A">
++              <help> vertex indices of the mesh elements </help>
++          </parameter>
++          <parameter key ="numberofvertices2d" type="double" default="0">
++              <help> number of vertices </help>
++          </parameter>
++          <parameter key ="numberofelements2d" type="double" default="0">
++              <help> number of elements </help>
++          </parameter>
++     </option>
++     <help> select a mesh dimension 0(default) or 3 </help>
++</parameter>
++<frame key="1" label="Elements and vertices">
++<section name="mesh" />
++  <parameter key ="numberofelements" type="double" default="0">
++     <section name="mesh" />
++     <help> number of elements </help>
++  </parameter>
++  <parameter key ="numberofvertices" type="double" default="0">
++     <section name="mesh" />
++     <help> number of verticies </help>
++  </parameter>
++  <parameter key ="elements" type="double" default="N/A">
++     <section name="mesh" />
++     <help> vertex indices of the mesh elements </help>
++  </parameter>
++  <parameter key ="x" type="double" default="N/A">
++     <section name="mesh" />
++     <help> vertices x coordinate [m] </help>
++  </parameter>
++  <parameter key ="y" type="double" default="N/A">
++     <section name="mesh" />
++     <help> vertices y coordinate [m] </help>
++  </parameter>
++  <parameter key ="z" type="double" default="N/A">
++     <section name="mesh" />
++     <help> vertices z coordinate [m] </help>
++  </parameter>
++  <parameter key ="edges" type="double" default="N/A">
++     <section name="mesh" />
++     <help> edges of the 2d mesh (vertex1 vertex2 element1 element2) </help>
++  </parameter>
++  <parameter key ="numberofedges" type="double" default="0">
++     <section name="mesh" />
++     <help> number of edges of the 2d mesh </help>
++  </parameter>
++</frame>
++<frame key="2" label="Properties">
++<section name="mesh" />
++  <parameter key ="selected dimension" type="double" default="0">
++     <section name="mesh" />
++     <help> mesh dimension </help>
++  </parameter>
++  <parameter key ="numberoflayers" type="double" default="0">
++     <section name="mesh" />
++     <help> number of extrusion layers </help>
++  </parameter>
++  <parameter key ="vertexonbed" type="double" default="N/A">
++     <section name="mesh" />
++     <help> lower vertices flags list </help>
++  </parameter>
++  <parameter key ="elementonbed" type="double" default="N/A">
++     <section name="mesh" />
++     <help> lower elements flags list </help>
++  </parameter>
++  <parameter key ="vertexonsurface" type="double" default="N/A">
++     <section name="mesh" />
++     <help> upper vertices flags list </help>
++  </parameter>
++  <parameter key ="elementonsurface" type="double" default="N/A">
++     <section name="mesh" />
++     <help> upper element flag list </help>
++  </parameter>
++  <parameter key ="uppervertex" type="double" default="N/A">
++     <section name="mesh" />
++     <help> upper vertex list (NaN for vertex on the upper surface) </help>
++  </parameter>
++  <parameter key ="upperelements" type="double" default="N/A">
++     <section name="mesh" />
++     <help> upper element list (NaN for element on the upper layer) </help>
++  </parameter>
++  <parameter key ="lowervertex" type="double" default="N/A">
++     <section name="mesh" />
++     <help> lower vertex list (NaN for vertex on the lower surface) </help>
++  </parameter>
++  <parameter key ="lowerelements" type="double" default="N/A">
++     <section name="mesh" />
++     <help> lower element list (NaN for element on the lower layer </help>
++  </parameter>
++  <parameter key ="vertexonboundary" type="double" default="N/A">
++     <section name="mesh" />
++     <help> vertices on the boundary of the domain flag list </help>
++  </parameter>
++  <parameter key ="segments" type="double" default="N/A">
++     <section name="mesh" />
++     <help> edges on domain boundary (vertex1 vertex2 element) </help>
++  </parameter>
++  <parameter key ="segmentmarkers" type="double" default="N/A">
++     <section name="mesh" />
++     <help> number associated to each segment </help>
++  </parameter>
++  <parameter key ="vertexconnectivity" type="double" default="N/A">
++     <section name="mesh" />
++     <help> list of vertices connected to vertex_i </help>
++  </parameter>
++  <parameter key ="elementconnectivity" type="double" default="N/A">
++     <section name="mesh" />
++     <help> list of vertices connected to element_i </help>
++  </parameter>
++  <parameter key ="average_vertex_connectivity" type="double" default="25">
++     <section name="mesh" />
++     <help> average number of vertices connected to one vertex </help>
++  </parameter>
++</frame>
++<frame key="3" label="Extracted Model">
++<section name="mesh" />
++  <parameter key ="extractedvertices" type="double" default="N/A">
++     <section name="mesh" />
++     <help> vertices extracted from the model </help>
++  </parameter>
++  <parameter key ="extractedelements" type="double" default="N/A">
++     <section name="mesh" />
++     <help> elements extracted from the model </help>
++  </parameter>
++</frame>
++<frame key="4" label="Projection">
++<section name="mesh" />
++  <parameter key ="lat" type="double" default="N/A">
++     <section name="mesh" />
++     <help> vertices latitude [degrees] </help>
++  </parameter>
++  <parameter key ="long" type="double" default="N/A">
++     <section name="mesh" />
++     <help> verticies longitude [degrees] </help>
++  </parameter>
++  <parameter key ="hemisphere" type="double" default="N/A">
++     <section name="mesh" />
++     <help> Indicate hemisphere 'n' or 's' </help>
++  </parameter></frame>
++
++
++<!-- mask -->
++<parameter key ="groundedice_levelset" type="double" default="NaN">
++     <section name="mask" />
++     <help> is ice grounded ? grounded ice if > 0, grounding line position if = 0, floating ice if &amp;lt; 0 </help>
++</parameter>
++<parameter key ="ice_levelset" type="double" default="NaN">
++     <section name="mask" />
++     <help> presence of ice if > 0, icefront position if = 0, no ice if &amp;lt; 0 </help>
++</parameter>
++
++<!-- geometry -->
++<frame key="1" label="Geometry parameters">
++<section name="geometry" />
++<parameter key ="surface" type="path" optional="false">
++     <section name="geometry" />
++     <help> surface elevation [m] </help>
++</parameter>
++<parameter key ="thickness" type="path" optional="false">
++     <section name="geometry" />
++     <help> ice thickness [m] </help>
++</parameter>
++<parameter key ="bed" type="path" optional="false">
++     <section name="geometry" />
++     <help> bed elevation [m] </help>
++</parameter>
++<parameter key ="bathymetry" type="double" default="N/A">
++     <section name="geometry" />
++     <help> bathymetry elevation [m] </help>
++</parameter>
++<parameter key ="hydrostatic_ratio" type="double" default="N/A">
++     <section name="geometry" />
++     <help> coefficient for ice shelves; thickness correction: hydrostatic_ratio H_obs+ (1-hydrostatic_ratio) H_hydro </help>
++</parameter></frame>
++
++
++<!-- constants -->
++<parameter key ="g" type="double" default="9.81">
++     <section name="constants" />
++     <help> gravitational acceleration [m/s^2] </help>
++</parameter>
++<parameter key ="yts" type="double" default="31536000">
++     <section name="constants" />
++     <help> number of seconds in a year [s/yr] </help>
++</parameter>
++<parameter key ="referencetemperature" type="double" default="223.15">
++     <section name="constants" />
++     <help> reference temperature used in the enthalpy model [K] </help>
++</parameter>
++
++<!-- surfaceforcings(SMB) -->
++<parameter key ="mass_balance" type="double" default="NaN">
++     <section name="surfaceforcings(SMB)" />
++     <help> surface mass balance [m/yr ice eq] </help>
++</parameter>
++
++<!-- basalforcings -->
++<parameter key ="melting_rate" type="double" default="NaN">
++     <section name="basalforcings" />
++     <help> basal melting rate (positive if melting) [m/yr] </help>
++</parameter>
++<parameter key ="melting_rate_correction" type="double" default="NaN">
++     <section name="basalforcings" />
++     <help> additional melting applied to compensate for dh/dt [m/yr] </help>
++</parameter>
++<parameter key ="geothermalflux" type="double" default="NaN">
++     <section name="basalforcings" />
++     <help> geothermal heat flux [W/m^2] </help>
++</parameter>
++
++<!-- materials -->
++<parameter key ="rho_ice" type="double" default="917">
++     <section name="materials" />
++     <help> ice density [kg/m^3] </help>
++</parameter>
++<parameter key ="rho_water" type="double" default="1023">
++     <section name="materials" />
++     <help> ocean water density [kg/m^3] </help>
++</parameter>
++<parameter key ="rho_freshwater" type="double" default="1000">
++     <section name="materials" />
++     <help> fresh water density [kg/m^3] </help>
++</parameter>
++<parameter key ="mu_water" type="double" default="0.001787">
++     <section name="materials" />
++     <help> water viscosity [N s/m^2] </help>
++</parameter>
++<parameter key ="heatcapacity" type="double" default="2093">
++     <section name="materials" />
++     <help> heat capacity [J/kg/K] </help>
++</parameter>
++<parameter key ="latentheat" type="double" default="334000">
++     <section name="materials" />
++     <help> latent heat of fusion [J/kg] </help>
++</parameter>
++<parameter key ="thermalconductivity" type="double" default="2.4">
++     <section name="materials" />
++     <help> ice thermal conductivity [W/m/K] </help>
++</parameter>
++<parameter key ="temperateiceconductivity" type="double" default="0.24">
++     <section name="materials" />
++     <help> temperate ice thermal conductivity [W/m/K] </help>
++</parameter>
++<parameter key ="meltingpoint" type="double" default="273.15">
++     <section name="materials" />
++     <help> melting point of ice at 1atm in K </help>
++</parameter>
++<parameter key ="beta" type="double" default="9.8e-08">
++     <section name="materials" />
++     <help> rate of change of melting point with pressure [K/Pa] </help>
++</parameter>
++<parameter key ="mixed_layer_capacity" type="double" default="3974">
++     <section name="materials" />
++     <help> mixed layer capacity [W/kg/K] </help>
++</parameter>
++<parameter key ="thermal_exchange_velocity" type="double" default="0.0001">
++     <section name="materials" />
++     <help> thermal exchange velocity [m/s] </help>
++</parameter>
++<parameter key ="rheology_B" type="double" default="N/A">
++     <section name="materials" />
++     <help> flow law parameter [Pa/s^(1/n)] </help>
++</parameter>
++<parameter key ="rheology_n" type="double" default="N/A">
++     <section name="materials" />
++     <help> Glens flow law exponent </help>
++</parameter>
++<parameter key ="rheology_law" type="char" default="'Paterson'">
++     <section name="materials" />
++     <help> law for the temperature dependance of the rheology: "None", "Paterson",  "Arrhenius" or "LliboutryDuval" </help>
++</parameter>
++<parameter key ="lithosphere_shear_modulus" type="double" default="67000000000">
++     <section name="materials" />
++     <help> Lithosphere shear modulus [Pa] </help>
++</parameter>
++<parameter key ="lithosphere_density" type="double" default="3.32">
++     <section name="materials" />
++     <help> Lithosphere density [g/cm^-3] </help>
++</parameter>
++<parameter key ="mantle_shear_modulus" type="double" default="145000000000">
++     <section name="materials" />
++     <help> Mantle shear modulus [Pa] </help>
++</parameter>
++<parameter key ="mantle_density" type="double" default="3.34">
++     <section name="materials" />
++     <help> Mantle density [g/cm^-3] </help>
++</parameter>
++
++
++<!-- damage -->
++<!-- Note: this class depends on different input of law -->
++<parameter key ="law" type="alternative" optional="false">
++	<section name="damage" />
++	<option value="undamage" type="string" default="true">
++		<help> law = undamage </help>
++	</option>
++	<option value="pralong" type="string" default="false">
++		<help> law = pralong </help>
++		<parameter key ="stress_threshold" type="double" default="0">
++			<help> damage stress threshold [Pa] </help>
++		</parameter>
++		<parameter key ="c1" type="double" default="0">
++			<help> damage parameter 1 </help>
++		</parameter>
++		<parameter key ="c2" type="double" default="0">
++			<help> damage parameter 2 </help>
++		</parameter>
++		<parameter key ="c3" type="double" default="0">
++			<help> damage parameter 3 [W/m^2] </help>
++		</parameter>
++		<parameter key ="c4" type="double" default="0">
++			<help> damage parameter 4 </help>
++		</parameter>
++		<parameter key ="healing" type="double" default="0">
++			<help> damage healing parameter 1 </help>
++		</parameter>
++		<parameter key ="equiv_stress" type="double" default="0">
++			<help> 0: von Mises </help>
++		</parameter>
++		<parameter key ="requested_outputs" type="cell" default="{'default'}">
++			<help> additional outputs requested </help>
++		</parameter>
++	</option>
++	<help> damage law (string) from {"undamaged","pralong"} </help>
++</parameter>
++<parameter key ="D" type="double" default="0">
++     <section name="damage" />
++     <help> damage tensor (scalar) </help>
++</parameter>
++<parameter key ="law" type="char" default="undamaged">
++     <section name="damage" />
++     <help> damage law (string) from {"undamaged","pralong"} </help>
++</parameter>
++<parameter key ="spcdamage" type="double" default="NaN">
++     <section name="damage" />
++     <help> damage constraints (NaN means no constraint) </help>
++</parameter>
++<parameter key ="max_damage" type="double" default="0.99999">
++     <section name="damage" />
++     <help> maximum possible damage (0&amp;lt;=max_damage&amp;lt;1) </help>
++</parameter>
++<parameter key ="stabilization" type="double" default="2">
++     <section name="damage" />
++     <help> 0: no, 1: artificial_diffusivity, 2: SUPG </help>
++</parameter>
++<parameter key ="maxiter" type="double" default="100">
++     <section name="damage" />
++     <help> maximum number of non linear iterations </help>
++</parameter>
++<parameter key ="penalty_lock" type="double" default="0">
++     <section name="damage" />
++     <help> stabilize unstable damage constraints that keep zigzagging after n iteration (default is 0, no stabilization) </help>
++</parameter>
++<parameter key ="penalty_threshold" type="double" default="0">
++     <section name="damage" />
++     <help> threshold to declare convergence of damage evolution solution (default is 0) </help>
++</parameter>
++<parameter key ="penalty_factor" type="double" default="3">
++     <section name="damage" />
++     <help> scaling exponent (default is 3) </help>
++</parameter>
++
++
++<!-- Friction: Sigma= drag^2 * Neff ^r * u ^s, with Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p -->
++<frame key="1" label="Friction: Sigma= drag^2 * Neff ^r * u ^s, with Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p">
++<section name="friction" />
++<parameter key ="coefficient" type="double" default="N/A">
++     <section name="friction" />
++     <help> friction coefficient [SI] </help>
++</parameter>
++<parameter key ="p" type="double" default="N/A">
++     <section name="friction" />
++     <help> p exponent </help>
++</parameter>
++<parameter key ="q" type="double" default="N/A">
++     <section name="friction" />
++     <help> q exponent </help>
++</parameter></frame>
++
++
++<!-- flowequation -->
++<frame key="1" label="Flow equation parameters">
++<section name="flowequation" />
++<parameter key ="isSIA" type="double" default="0">
++     <section name="flowequation" />
++     <help> is the Shallow Ice Approximation (SIA) used ? </help>
++</parameter>
++<parameter key ="isSSA" type="double" default="0">
++     <section name="flowequation" />
++     <help> is the Shelfy-Stream Approximation (SSA) used ? </help>
++</parameter>
++<parameter key ="isL1L2" type="double" default="0">
++     <section name="flowequation" />
++     <help> is the L1L2 approximation used ? </help>
++</parameter>
++<parameter key ="isHO" type="double" default="0">
++     <section name="flowequation" />
++     <help> is the Higher-Order (HO) approximation used ? </help>
++</parameter>
++<parameter key ="isFS" type="double" default="0">
++     <section name="flowequation" />
++     <help> are the Full-FS (FS) equations used ? </help>
++</parameter>
++<parameter key ="fe_SSA" type="char" default="'P1'">
++     <section name="flowequation" />
++     <help> Finite Element for SSA  "P1", "P1bubble" "P1bubblecondensed" "P2" </help>
++</parameter>
++<parameter key ="fe_HO" type="char" default="'P1'">
++     <section name="flowequation" />
++     <help> Finite Element for HO   "P1" "P1bubble" "P1bubblecondensed" "P1xP2" "P2xP1" "P2" </help>
++</parameter>
++<parameter key ="fe_FS" type="char" default="'MINIcondensed'">
++     <section name="flowequation" />
++     <help> Finite Element for FS   "P1P1" (debugging only) "P1P1GLS" "MINIcondensed" "MINI" "TaylorHood" </help>
++</parameter>
++<parameter key ="vertex_equation" type="double" default="N/A">
++     <section name="flowequation" />
++     <help> flow equation for each vertex </help>
++</parameter>
++<parameter key ="element_equation" type="double" default="N/A">
++     <section name="flowequation" />
++     <help> flow equation for each element </help>
++</parameter>
++<parameter key ="borderSSA" type="double" default="N/A">
++     <section name="flowequation" />
++     <help> vertices on SSAs border (for tiling) </help>
++</parameter>
++<parameter key ="borderHO" type="double" default="N/A">
++     <section name="flowequation" />
++     <help> vertices on HOs border (for tiling) </help>
++</parameter>
++<parameter key ="borderFS" type="double" default="N/A">
++     <section name="flowequation" />
++     <help> vertices on FS border (for tiling) </help>
++</parameter></frame>
++
++
++<!-- Timestepping -->
++<parameter key ="start_time" type="double" default="0">
++     <section name="timestepping" />
++     <help> simulation starting time [yr] </help>
++</parameter>
++<parameter key ="final_time" type="double" default="5">
++     <section name="timestepping" />
++     <help> final time to stop the simulation [yr] </help>
++</parameter>
++<parameter key ="time_step" type="double" default="0.5">
++     <section name="timestepping" />
++     <help> length of time steps [yr] </help>
++</parameter>
++<parameter key ="time_adapt" type="double" default="0">
++     <section name="timestepping" />
++     <help> use cfl condition to define time step ? (0 or 1)  </help>
++</parameter>
++<parameter key ="cfl_coefficient" type="double" default="0.5">
++     <section name="timestepping" />
++     <help> coefficient applied to cfl condition </help>
++</parameter>
++
++
++<!-- initialization -->
++<frame key="1" label="Initial field values">
++<section name="initialization" />
++<parameter key ="vx" type="double" default="NaN">
++     <section name="initialization" />
++     <help> x component of velocity [m/yr] </help>
++</parameter>
++<parameter key ="vy" type="double" default="NaN">
++     <section name="initialization" />
++     <help> y component of velocity [m/yr] </help>
++</parameter>
++<parameter key ="vz" type="double" default="NaN">
++     <section name="initialization" />
++     <help> z component of velocity [m/yr] </help>
++</parameter>
++<parameter key ="vel" type="double" default="NaN">
++     <section name="initialization" />
++     <help> velocity norm [m/yr] </help>
++</parameter>
++<parameter key ="pressure" type="double" default="NaN">
++     <section name="initialization" />
++     <help> pressure field [Pa] </help>
++</parameter>
++<parameter key ="temperature" type="double" default="NaN">
++     <section name="initialization" />
++     <help> fraction of water in the ice </help>
++</parameter>
++<parameter key ="waterfraction" type="double" default="NaN">
++     <section name="initialization" />
++     <help> ice thickness [m] </help>
++</parameter>
++<parameter key ="sediment_head" type="double" default="NaN">
++     <section name="initialization" />
++     <help> sediment water head of subglacial system [m] </help>
++</parameter>
++<parameter key ="epl_head" type="double" default="NaN">
++     <section name="initialization" />
++     <help> epl water head of subglacial system [m] </help>
++</parameter>
++<parameter key ="watercolumn" type="double" default="NaN">
++     <section name="initialization" />
++     <help> thickness of subglacial water [m] </help>
++</parameter></frame>
++
++
++<!-- rifts -->
++<parameter key ="riftstruct" type="double" default="NaN">
++     <section name="rifts" />
++     <help> structure containing all rift information (vertices coordinates, segments, type of melange, ...) </help>
++</parameter>
++<parameter key ="riftproperties" type="double" default="NaN">
++     <section name="rifts" />
++     <help> N/A </help>
++</parameter>
++
++
++<!-- Debug -->
++<parameter key ="valgrind" type="logical" optional="false">
++     <section name="debug" />
++        <option value="false" type="string" default="true"></option>
++     <help> use Valgrind to debug (0 or 1) </help>
++</parameter>
++<parameter key ="gprof" type="logical" optional="false">
++     <section name="debug" />
++        <option value="false" type="string" default="true"></option>
++     <help> use gnu-profiler to find out where the time is spent </help>
++</parameter>
++<parameter key ="profiling" type="logical" optional="false">
++     <section name="debug" />
++        <option value="false" type="string" default="true"></option>
++     <help> enables profiling (memory, flops, time) </help>
++</parameter>
++
++<!-- verbose -->
++<parameter key ="mprocessor" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="false" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++<parameter key ="module" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="false" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++<parameter key ="solution" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="true" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++<parameter key ="solver" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="false" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++<parameter key ="convergence" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="false" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++<parameter key ="control" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="true" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++<parameter key ="qmu" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="true" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++<parameter key ="autodiff" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="false" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++
++<!-- settings -->
++<parameter key ="results_on_nodes" type="double" default="0">
++     <section name="settings" />
++     <help> results are output for all the nodes of each element </help>
++</parameter>
++<parameter key ="io_gather" type="double" default="1">
++     <section name="settings" />
++     <help> I/O gathering strategy for result outputs (default 1) </help>
++</parameter>
++<parameter key ="lowmem" type="double" default="0">
++     <section name="settings" />
++     <help> is the memory limited ? (0 or 1) </help>
++</parameter>
++<parameter key ="output_frequency" type="double" default="1">
++     <section name="settings" />
++     <help> frequency at which results are saved in all solutions with multiple time_steps </help>
++</parameter>
++<parameter key ="waitonlock" type="double" default="Inf">
++     <section name="settings" />
++     <help> maximum number of minutes to wait for batch results (NaN to deactivate) </help>
++</parameter>
++<parameter key ="upload_server" type="char" default="N/A">
++     <section name="settings" />
++     <help> server hostname where model should be uploaded </help>
++</parameter>
++<parameter key ="upload_path" type="char" default="N/A">
++     <section name="settings" />
++     <help> path on server where model should be uploaded </help>
++</parameter>
++<parameter key ="upload_login" type="char" default="N/A">
++     <section name="settings" />
++     <help> server login </help>
++</parameter>
++<parameter key ="upload_port" type="double" default="0">
++     <section name="settings" />
++     <help> port login (default is 0) </help>
++</parameter>
++<parameter key ="upload_filename" type="char" default="N/A">
++     <section name="settings" />
++     <help> unique id generated when uploading the file to server </help>
++</parameter>
++
++<!-- generic -->
++<parameter key ="name" type="char" default="'XPS'">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="login" type="char" default="N/A">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="np" type="double" default="1">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="port" type="double" default="0">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="codepath" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/bin">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="executionpath" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/execution">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="etcpath" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/etc">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="valgrind" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/externalpackages/valgrind/install/bin/valgrind">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="valgrindlib" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/externalpackages/valgrind/install/lib/libmpidebug.so">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="valgrindsup" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/externalpackages/valgrind/issm.supp">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="verbose" type="double" default="1">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++
++<!-- balancethickness -->
++<parameter key ="spcthickness" type="double" default="N/A">
++     <section name="balancethickness" />
++     <help> thickness constraints (NaN means no constraint) [m] </help>
++</parameter>
++<parameter key ="thickening_rate" type="double" default="N/A">
++     <section name="balancethickness" />
++     <help> ice thickening rate used in the mass conservation (dh/dt) [m/yr] </help>
++</parameter>
++<parameter key ="stabilization" type="double" default="1">
++     <section name="balancethickness" />
++     <help> 0: None, 1: SU, 2: SSAs artificial diffusivity, 3:DG </help>
++</parameter>
++
++<!-- StressBalance solution parameters: -->
++<frame key="1" label="Convergence criteria">
++<section name="stressbalance" />
++<parameter key ="restol" type="double" default="0.0001">
++     <section name="stressbalance" />
++     <help> mechanical equilibrium residual convergence criterion </help>
++</parameter>
++<parameter key ="reltol" type="double" default="0.01">
++     <section name="stressbalance" />
++     <help> velocity relative convergence criterion, NaN: not applied </help>
++</parameter>
++<parameter key ="abstol" type="double" default="10">
++     <section name="stressbalance" />
++     <help> velocity absolute convergence criterion, NaN: not applied </help>
++</parameter>
++<parameter key ="isnewton" type="double" default="0">
++     <section name="stressbalance" />
++     <help> 0: Picards fixed point, 1: Newtons method, 2: hybrid </help>
++</parameter>
++<parameter key ="maxiter" type="double" default="100">
++     <section name="stressbalance" />
++     <help> maximum number of nonlinear iterations </help>
++</parameter>
++<parameter key ="viscosity_overshoot" type="double" default="0">
++     <section name="stressbalance" />
++     <help> over-shooting constant new=new+C*(new-old) </help>
++</parameter>
++</frame>
++<frame key="2" label="Boundary conditions">
++<section name="stressbalance" />
++<parameter key ="spcvx" type="double" default="N/A">
++     <section name="stressbalance" />
++     <help> x-axis velocity constraint (NaN means no constraint) [m/yr] </help>
++</parameter>
++<parameter key ="spcvy" type="double" default="N/A">
++     <section name="stressbalance" />
++     <help> y-axis velocity constraint (NaN means no constraint) [m/yr] </help>
++</parameter>
++<parameter key ="spcvz" type="double" default="N/A">
++     <section name="stressbalance" />
++     <help> z-axis velocity constraint (NaN means no constraint) [m/yr] </help>
++</parameter>
++</frame>
++<frame key="3" label="Rift options">
++<section name="stressbalance" />
++<parameter key ="rift_penalty_threshold" type="double" default="0">
++     <section name="stressbalance" />
++     <help> threshold for instability of mechanical constraints </help>
++</parameter>
++<parameter key ="rift_penalty_lock" type="double" default="10">
++     <section name="stressbalance" />
++     <help> number of iterations before rift penalties are locked </help>
++</parameter>
++</frame>
++<frame key="4" label="Other">
++<section name="stressbalance" />
++<parameter key ="shelf_dampening" type="double" default="0">
++     <section name="stressbalance" />
++     <help> use dampening for floating ice ? Only for FS model </help>
++</parameter>
++<parameter key ="FSreconditioning" type="double" default="10000000000000">
++     <section name="stressbalance" />
++     <help> multiplier for incompressibility equation. Only for FS model </help>
++</parameter>
++<parameter key ="referential" type="double" default="N/A">
++     <section name="stressbalance" />
++     <help> local referential </help>
++</parameter>
++<parameter key ="loadingforce" type="double" default="N/A">
++     <section name="stressbalance" />
++     <help> loading force applied on each point [N/m^3] </help>
++</parameter>
++<parameter key ="requested_outputs" type="cell" default="{'default'}">
++     <section name="stressbalance" />
++     <help> additional outputs requested </help>
++</parameter>
++</frame>
++
++
++<!-- groundingline -->
++<frame key="1" label="Grounding line migration parameters">
++<section name="groundingline" />
++<parameter key ="migration" type="char" default="'None'">
++     <section name="groundingline" />
++     <help> type of grounding line migration: "SoftMigration","AgressiveMigration" or "None" </help>
++</parameter>
++<parameter key ="melting_rate" type="double" default="0">
++     <section name="groundingline" />
++     <help> melting rate applied when previously grounded parts start floating [m/yr] </help>
++</parameter></frame>
++
++
++<!-- Hydrology -->
++<frame key="1" label="Hydrologyshreve solution parameters">
++<section name="hydrologyshreve" />
++<parameter key ="spcwatercolumn" type="double" default="N/A">
++     <section name="hydrologyshreve" />
++     <help> water thickness constraints (NaN means no constraint) [m] </help>
++</parameter>
++<parameter key ="n" type="double" default="0.02">
++     <section name="hydrologyshreve" />
++     <help> Manning roughness coefficient </help>
++</parameter>
++<parameter key ="CR" type="double" default="0.01">
++     <section name="hydrologyshreve" />
++     <help> tortuosity parameter </help>
++</parameter>
++<parameter key ="p" type="double" default="2">
++     <section name="hydrologyshreve" />
++     <help> dimensionless exponent in Manning velocity formula </help>
++</parameter>
++<parameter key ="q" type="double" default="1">
++     <section name="hydrologyshreve" />
++     <help> dimensionless exponent in Manning velocity formula </help>
++</parameter>
++<parameter key ="kn" type="double" default="0">
++     <section name="hydrologyshreve" />
++     <help> parameter in effective pressure formula </help>
++</parameter>
++<parameter key ="stabilization" type="double" default="1">
++     <section name="hydrologyshreve" />
++     <help> artificial diffusivity (default is 1). can be more than 1 to increase diffusivity. </help>
++</parameter>
++</frame>
++<!-- masstransport -->
++<frame key="1" label="Masstransport solution parameters">
++<section name="masstransport" />
++  <parameter key ="spcthickness" type="double" default="N/A">
++     <section name="masstransport" />
++     <help> thickness constraints (NaN means no constraint) [m] </help>
++  </parameter>
++  <parameter key ="calvingrate" type="double" default="N/A">
++     <section name="masstransport" />
++     <help> calving rate at given location [m/a] </help>
++  </parameter>
++  <parameter key ="isfreesurface" type="double" default="0">
++     <section name="masstransport" />
++     <help> do we use free surfaces (FS only) are mass conservation </help>
++  </parameter>
++  <parameter key ="min_thickness" type="double" default="1">
++     <section name="masstransport" />
++     <help> minimum ice thickness allowed [m] </help>
++  </parameter>
++  <parameter key ="hydrostatic_adjustment" type="char" default="'Absolute'">
++     <section name="masstransport" />
++     <help> adjustment of ice shelves surface and bed elevations: 'Incremental' or 'Absolute'  </help>
++  </parameter>
++  <parameter key ="stabilization" type="double" default="1">
++     <section name="masstransport" />
++     <help> 0: no, 1:  artificial_diffusivity, 2: streamline upwinding, 3: discontinuous Galerkin </help>
++  </parameter>
++</frame>
++<frame key="2" label="Penalty options">
++<section name="masstransport" />
++  <parameter key ="vertex_pairing" type="double" default="N/A">
++     <section name="masstransport" />
++     <help> offset used by penalties: penalty = Kmax*10^offset </help>
++  </parameter>
++  <parameter key ="penalty_factor" type="double" default="3">
++     <section name="masstransport" />
++     <help> pairs of vertices that are penalized </help>
++  </parameter>
++  <parameter key ="requested_outputs" type="cell" default="{'default'}">
++     <section name="masstransport" />
++     <help> additional outputs requested </help>
++  </parameter>
++</frame>
++<!-- thermal -->
++<frame key="1" label="Thermal solution parameters">
++<section name="thermal" />
++  <parameter key ="spctemperature" type="double" default="N/A">
++     <section name="thermal" />
++     <help> temperature constraints (NaN means no constraint) [K] </help>
++  </parameter>
++  <parameter key ="penalty_threshold" type="double" default="0">
++     <section name="thermal" />
++     <help> 0: no, 1: artificial_diffusivity, 2: SUPG </help>
++  </parameter>
++  <parameter key ="stabilization" type="double" default="1">
++     <section name="thermal" />
++     <help> maximum number of non linear iterations </help>
++  </parameter>
++  <parameter key ="maxiter" type="double" default="100">
++     <section name="thermal" />
++     <help> stabilize unstable thermal constraints that keep zigzagging after n iteration (default is 0, no stabilization) </help>
++  </parameter>
++  <parameter key ="penalty_lock" type="double" default="0">
++     <section name="thermal" />
++     <help> threshold to declare convergence of thermal solution (default is 0)  </help>
++  </parameter>
++  <parameter key ="penalty_factor" type="double" default="3">
++     <section name="thermal" />
++     <help> scaling exponent (default is 3) </help>
++  </parameter>
++  <parameter key ="isenthalpy" type="double" default="0">
++     <section name="thermal" />
++     <help> use an enthalpy formulation to include temperate ice (default is 0) </help>
++  </parameter>
++  <parameter key ="isdynamicbasalspc" type="double" default="0">
++     <section name="thermal" />
++     <help> enable dynamic setting of basal forcing. required for enthalpy formulation (default is 0)  </help>
++  </parameter>
++  <parameter key ="requested_outputs" type="cell" default="{'default'}">
++     <section name="thermal" />
++     <help> additional outputs requested </help>
++  </parameter>
++</frame>
++<!-- steadystate -->
++<frame key="1" label="steadystate solution parameters">
++<section name="steadystate" />
++  <parameter key ="reltol" type="double" default="0.01">
++     <section name="steadystate" />
++     <help> relative tolerance criterion [K] </help>
++  </parameter>
++  <parameter key ="maxiter" type="double" default="100">
++     <section name="steadystate" />
++     <help> maximum number of iterations </help>
++  </parameter>
++  <parameter key ="requested_outputs" type="cell" default="{'default'}">
++     <section name="steadystate" />
++     <help> additional requested outputs </help>
++  </parameter>
++</frame>
++<!-- transient -->
++<frame key="1" label="transient solution parameters">
++<section name="transient" />
++  <parameter key ="ismasstransport" type="double" default="1">
++     <section name="transient" />
++     <help> indicates whether a masstransport solution is used in the transient </help>
++  </parameter>
++  <parameter key ="isstressbalance" type="double" default="1">
++     <section name="transient" />
++     <help> indicates whether a stressbalance solution is used in the transient </help>
++  </parameter>
++  <parameter key ="isthermal" type="double" default="1">
++     <section name="transient" />
++     <help> indicates whether a thermal solution is used in the transient </help>
++  </parameter>
++  <parameter key ="isgroundingline" type="double" default="0">
++     <section name="transient" />
++     <help> indicates whether a groundingline migration is used in the transient </help>
++  </parameter>
++  <parameter key ="isgia" type="double" default="0">
++     <section name="transient" />
++     <help> indicates whether a postglacial rebound model is used in the transient </help>
++  </parameter>
++  <parameter key ="isdamage" type="double" default="0">
++     <section name="transient" />
++     <help> indicates whether damage evolution is used in the transient </help>
++  </parameter>
++  <parameter key ="islevelset" type="double" default="0">
++     <section name="transient" />
++     <help> LEVEL SET DESCRIPTION...  </help>
++  </parameter>
++  <parameter key ="requested_outputs" type="cell" default="{'default'}">
++     <section name="transient" />
++     <help> list of additional outputs requested </help>
++  </parameter>
++</frame>
++<!-- gia -->
++<frame key="1" label="gia parameters">
++<section name="gia" />
++  <parameter key ="mantle_viscosity" type="double" default="N/A">
++     <section name="gia" />
++     <help> mantle viscosity[Pa s] </help>
++  </parameter>
++  <parameter key ="lithosphere_thickness" type="double" default="N/A">
++     <section name="gia" />
++     <help> lithosphere thickness (km) </help>
++  </parameter>
++  <parameter key ="cross_section_shape" type="double" default="1">
++     <section name="gia" />
++     <help> 1: square-edged (default). 2: elliptical.  See iedge in GiaDeflectionCore </help>
++  </parameter>
++</frame>
++<!-- autodiff -->
++<frame key="1" label="automatic differentiation parameters">
++<section name="autodiff" />
++  <parameter key ="isautodiff" type="logical" optional="false">
++     <section name="autodiff" />
++         <option value="false" type="string" default="true"></option>
++     <help> indicates if the automatic differentiation is activated </help>
++  </parameter>
++  <parameter key ="dependents" type="cell" default="(0x0)">
++     <section name="autodiff" />
++     <help> list of dependent variables </help>
++  </parameter>
++  <parameter key ="independents" type="cell" default="(0x0)">
++     <section name="autodiff" />
++     <help> list of independent variables </help>
++  </parameter>
++  <parameter key ="driver" type="char" default="'fos_forward'">
++     <section name="autodiff" />
++     <help> ADOLC driver ('fos_forward' or 'fov_forward') </help>
++  </parameter>
++  <parameter key ="obufsize" type="double" default="524288">
++     <section name="autodiff" />
++     <help> Number of operations per buffer (==OBUFSIZE in usrparms.h)  </help>
++  </parameter>
++  <parameter key ="lbufsize" type="double" default="524288">
++     <section name="autodiff" />
++     <help> Number of locations per buffer (==LBUFSIZE in usrparms.h) </help>
++  </parameter>
++  <parameter key ="cbufsize" type="double" default="524288">
++     <section name="autodiff" />
++     <help> Number of values per buffer (==CBUFSIZE in usrparms.h) </help>
++  </parameter>
++  <parameter key ="tbufsize" type="double" default="524288">
++     <section name="autodiff" />
++     <help> Number of taylors per buffer (&amp;lt;=TBUFSIZE in usrparms.h) </help>
++  </parameter>
++  <parameter key ="gcTriggerRatio" type="double" default="2">
++     <section name="autodiff" />
++     <help> free location block sorting/consolidation triggered if the ratio between allocated and used locations exceeds gcTriggerRatio </help>
++  </parameter>
++  <parameter key ="gcTriggerRatio" type="double" default="2">
++     <section name="autodiff" />
++     <help> free location block sorting/consolidation triggered if the allocated locations exceed gcTriggerMaxSize </help>
++  </parameter>
++</frame>
++<!-- flaim -->
++<frame key="1" label="Input:">
++<section name="flaim" />
++  <parameter key ="targets" type="char" default="N/A">
++     <section name="flaim" />
++     <help> name of kml output targets file </help>
++  </parameter>
++  <parameter key ="tracks" type="char" default="N/A">
++     <section name="flaim" />
++     <help> name of kml input tracks file </help>
++  </parameter>
++  <parameter key ="flightreqs" type="struct" default="N/A">
++     <section name="flaim" />
++     <help> structure of kml flight requirements (not used yet) </help>
++  </parameter>
++  <parameter key ="criterion" type="double" default="N/A">
++     <section name="flaim" />
++     <help> element or nodal criterion for flight path evaluation (metric) </help>
++  </parameter>
++</frame>
++<frame key="2" label="Arguments:">
++<section name="flaim" />
++  <parameter key ="gridsatequator" type="double" default="200000">
++     <section name="flaim" />
++     <help> number of grids at equator (determines resolution) </help>
++  </parameter>
++  <parameter key ="usevalueordering" type="logical" optional="false">
++     <section name="flaim" />
++         <option value="true" type="string" default="true"></option>
++     <help> flag to consider target values for flight path evaluation </help>
++  </parameter>
++  <parameter key ="split_antimeridian" type="logical" optional="false">
++     <section name="flaim" />
++         <option value="true" type="string" default="true"></option>
++     <help> flag to split polygons on the antimeridian </help>
++  </parameter>
++</frame>
++<frame key="3" label="Optimization:">
++<section name="flaim" />
++  <parameter key ="path_optimize" type="logical" optional="false">
++     <section name="flaim" />
++         <option value="false" type="string" default="true"></option>
++     <help> optimize? (default false) </help>
++  </parameter>
++  <parameter key ="opt_ndir" type="double" default="1">
++     <section name="flaim" />
++     <help> number of directions to test when moving a point.  If this value = 1, a random direction is tested. A value > 1 results in directions equally spaced from [0, 2*PI] being tested. For example, 4 would result in directions [0, PI/2, PI, 3PI/2] </help>
++  </parameter>
++  <parameter key ="opt_dist" type="double" default="25">
++     <section name="flaim" />
++     <help> specifies the distance in km (default 25) to move a randomly selected path point on each iteration </help>
++  </parameter>
++  <parameter key ="opt_niter" type="double" default="30000">
++     <section name="flaim" />
++     <help> number of iterations (default 30,000) to run for flightplan optimization, i.e. the number of times to randomly select a point and move it. </help>
++  </parameter>
++</frame>
++<frame key="4" label="Output:">
++<section name="flaim" />
++  <parameter key ="solution" type="char" default="N/A">
++     <section name="flaim" />
++     <help> name of kml solution file </help>
++  </parameter>
++  <parameter key ="quality" type="double" default="0">
++     <section name="flaim" />
++     <help> quality of kml solution </help>
++  </parameter>
++</frame>
++<!-- inversion -->
++<frame key="1" label="inversion parameters">
++<section name="inversion" />
++  <parameter key ="iscontrol" type="double" default="0">
++     <section name="inversion" />
++     <help> is inversion activated? </help>
++  </parameter>
++  <parameter key ="incomplete_adjoint" type="double" default="1">
++     <section name="inversion" />
++     <help> 1: linear viscosity, 0: non-linear viscosity </help>
++  </parameter>
++  <parameter key ="control_parameters" type="cell" default="{'FrictionCoefficient'}">
++     <section name="inversion" />
++     <help> ex: {'FrictionCoefficient'}, or {'MaterialsRheologyBbar'} </help>
++  </parameter>
++  <parameter key ="nsteps" type="double" default="20">
++     <section name="inversion" />
++     <help> number of optimization searches </help>
++  </parameter>
++  <parameter key ="cost_functions" type="double" default="101">
++     <section name="inversion" />
++     <help> indicate the type of response for each optimization step  </help>
++  </parameter>
++  <parameter key ="cost_functions_coefficients" type="double" default="N/A">
++     <section name="inversion" />
++     <help> cost_functions_coefficients applied to the misfit of each vertex and for each control_parameter </help>
++  </parameter>
++  <parameter key ="cost_function_threshold" type="double" default="N/A">
++     <section name="inversion" />
++     <help> misfit convergence criterion. Default is 1%, NaN if not applied </help>
++  </parameter>
++  <parameter key ="maxiter_per_step" type="double" default="(20x1)">
++     <section name="inversion" />
++     <help> maximum iterations during each optimization step  </help>
++  </parameter>
++  <parameter key ="gradient_scaling" type="double" default="(20x1)">
++     <section name="inversion" />
++     <help> scaling factor on gradient direction during optimization, for each optimization step </help>
++  </parameter>
++  <parameter key ="step_threshold" type="double" default="(20x1)">
++     <section name="inversion" />
++     <help> decrease threshold for misfit, default is 30% </help>
++  </parameter>
++  <parameter key ="min_parameters" type="double" default="N/A">
++     <section name="inversion" />
++     <help> absolute minimum acceptable value of the inversed parameter on each vertex </help>
++  </parameter>
++  <parameter key ="max_parameters" type="double" default="N/A">
++     <section name="inversion" />
++     <help> absolute maximum acceptable value of the inversed parameter on each vertex </help>
++  </parameter>
++  <parameter key ="vx_obs" type="double" default="N/A">
++     <section name="inversion" />
++     <help> observed velocity x component [m/yr] </help>
++  </parameter>
++  <parameter key ="vy_obs" type="double" default="N/A">
++     <section name="inversion" />
++     <help> observed velocity y component [m/yr]  </help>
++  </parameter>
++  <parameter key ="vel_obs" type="double" default="N/A">
++     <section name="inversion" />
++     <help> observed velocity magnitude [m/yr] </help>
++  </parameter>
++  <parameter key ="thickness_obs" type="double" default="N/A">
++     <section name="inversion" />
++     <help> observed thickness [m]) </help>
++  </parameter>
++</frame>
++<frame key="2" label="Available cost functions">
++<section name="inversion" />
++  <parameter key ="SurfaceAbsVelMisfit" type="string" default="101">
++     <section name="inversion" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="SurfaceRelVelMisfit" type="string" default="102">
++     <section name="inversion" />
++     <help>   </help>
++  </parameter>
++  <parameter key ="SurfaceLogVelMisfit" type="string" default="103">
++     <section name="inversion" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="SurfaceLogVxVyMisfit" type="string" default="104">
++     <section name="inversion" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="SurfaceAverageVelMisfit" type="string" default="105">
++     <section name="inversion" />
++     <help>   </help>
++  </parameter>
++  <parameter key ="ThicknessAbsMisfit" type="string" default="106">
++     <section name="inversion" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="DragCoefficientAbsGradient" type="string" default="107">
++     <section name="inversion" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="RheologyBbarAbsGradient" type="string" default="108">
++     <section name="inversion" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="ThicknessAbsGradient" type="string" default="109">
++     <section name="inversion" />
++     <help> </help>
++  </parameter>
++</frame>
++<!-- qmu -->
++<frame key="1" label="qmu parameters">
++<section name="qmu" />
++  <parameter key ="isdakota" type="double" default="0">
++     <section name="qmu" />
++     <help> is qmu analysis activated? </help>
++  </parameter>
++  <parameter key ="variables" type="struct" default="N/A">
++     <section name="qmu" />
++     <help> (arrays of each variable class) </help>
++  </parameter>
++  <parameter key ="responses" type="struct" default="N/A">
++     <section name="qmu" />
++     <help> (arrays of each response class) </help>
++  </parameter>
++  <parameter key ="numberofresponses" type="double" default="0">
++     <section name="qmu" />
++     <help> number of responses </help>
++  </parameter>
++  <parameter key ="params" type="struct" default="N/A">
++     <section name="qmu" />
++     <help> (array of method-independent parameters)  </help>
++  </parameter>
++  <parameter key ="results" type="struct" default="N/A">
++     <section name="qmu" />
++     <help> (information from dakota files) </help>
++  </parameter>
++  <parameter key ="partition" type="double" default="N/A">
++     <section name="qmu" />
++     <help> user provided mesh partitioning, defaults to metis if not specified </help>
++  </parameter>
++  <parameter key ="numberofpartitions" type="double" default="0">
++     <section name="qmu" />
++     <help> number of partitions for semi-discrete qmu  </help>
++  </parameter>
++  <parameter key ="variabledescriptors" type="cell" default="(0x0)">
++     <section name="qmu" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="responsedescriptors" type="cell" default="(0x0)">
++     <section name="qmu" />
++     <help> use an enthalpy formulation to include temperate ice (default is 0) </help>
++  </parameter>
++  <parameter key ="method" type="struct" default="N/A">
++     <section name="qmu" />
++     <help> array of dakota_method class </help>
++  </parameter>
++  <parameter key ="mass_flux_profile_directory" type="double" default="N/A">
++     <section name="qmu" />
++     <help> directory for mass flux profiles </help>
++  </parameter>
++  <parameter key ="mass_flux_profiles" type="double" default="N/A">
++     <section name="qmu" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="mass_flux_segments" type="cell" default="(0x0)">
++     <section name="qmu" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="adjacency" type="double" default="N/A">
++     <section name="qmu" />
++     <help> additional outputs requested </help>
++  </parameter>
++  <parameter key ="vertex_weight" type="double" default="N/A">
++     <section name="qmu" />
++     <help> weight applied to each mesh vertex </help>
++  </parameter>
++</frame>
++<!-- outputdefinition -->
++<frame key="1" label="outputdefinition">
++<section name="outputdefinition" />
++  <parameter key ="definitions" type="cell" default="(0x0)">
++     <section name="outputdefinition" />
++     <help> list of potential outputs that can be requested, but which need additional data to be defined </help>
++  </parameter>
++</frame>
++<!-- miscellaneous -->
++<frame key="1" label="miscellaneous parameters">
++<section name="miscellaneous" />
++  <parameter key ="notes" type="char" default="N/A">
++     <section name="miscellaneous" />
++     <help> notes in a cell of strings </help>
++  </parameter>
++  <parameter key ="name" type="char" default="N/A">
++     <section name="miscellaneous" />
++     <help> model name </help>
++  </parameter>
++  <parameter key ="dummy" type="struct" default="N/A">
++     <section name="miscellaneous" />
++     <help> empty field to store some data </help>
++  </parameter>
++</frame>
++
++
++</inishell_config>
+\ No newline at end of file
+
+Property changes on: ../trunk-jpl/src/java/doc/examples/issm.xml
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/doc/examples/min_example.xml
+===================================================================
+--- ../trunk-jpl/src/java/doc/examples/min_example.xml	(revision 0)
++++ ../trunk-jpl/src/java/doc/examples/min_example.xml	(revision 17722)
+@@ -0,0 +1,40 @@
++<inishell_config>
++	<parameter key="SOME_PARAMETER" type="string">
++		<section name="section1" />
++		<section name="section2" />
++		<help>
++			This is a parameter that asks for a string value and that is present in
++			both the section "section1" and "section2".
++		</help>
++	</parameter>
++	
++	<parameter key="NESTED_PARAMETERS" type="alternative" optional="false">
++		<section name="section1" />
++		<option value="NONE" type="string" />
++		<option value="ONE" type="string">
++			<parameter key="SOME_INTEGER" type="integer" 
++				minimum="-1" maximum="10" default="2">
++				<help>
++					The value for this parameter may be an integer between -1 and 10.
++					The default value is 2.
++					The user may use the + and - buttons to increment/decrement 
++					the number or type the number into the text field.</help>
++				</parameter>
++		</option>
++		<option value="TWO" type="string">
++			<reference name="a_group_that_can_be_referenced" />
++			<help>Here is a reference to two parameters.</help>
++		</option>
++		<help>
++			This parameter belongs to section1. 
++			When the "null" option is selected, the dropdown menu appears
++			red because this parameter is non-optional.
++			When the value "ONE" is selected a nested parameter "SOME_INTEGER" appears. 
++		</help>
++	</parameter>
++	
++	<parametergroup name="a_group_that_can_be_referenced">
++		<parameter key="SOME_FILE" type="file" />
++		<parameter key="A_PATH" type="path" />
++	</parametergroup>
++</inishell_config>
+\ No newline at end of file
+
+Property changes on: ../trunk-jpl/src/java/doc/examples/min_example.xml
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/lib/miglayout-4.0.jar
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/lib/miglayout-4.0.jar
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/MANIFEST.MF
+===================================================================
+--- ../trunk-jpl/src/java/MANIFEST.MF	(revision 0)
++++ ../trunk-jpl/src/java/MANIFEST.MF	(revision 17722)
+@@ -0,0 +1,14 @@
++Manifest-Version: 1.0
++Ant-Version: Apache Ant 1.8.4
++Created-By: 1.6.0_51-b11-457-11M4509 (Apple Inc.)
++Built-By: larour
++Built-On: 2014-04-14
++Built-At: 14:27:23
++Main-Class: main/GUIBuilder
++Specification-Title: INI file generator
++Specification-Version: 1.0.0-20140414
++Specification-Vendor: SLF, www.slf.ch
++Implementation-Title: INIshell ini creator
++Implementation-Version: 1.0.0
++Implementation-Vendor: SLF, www.slf.ch
++
+Index: ../trunk-jpl/src/java/src/gui_elements/CombinedPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/CombinedPanel.java	(revision 0)
++++ ../trunk-jpl/src/java/src/gui_elements/CombinedPanel.java	(revision 17722)
+@@ -0,0 +1,267 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell is free software: you can redistribute it and/or modify
++*   it under the terms of the GNU General Public License as published by
++*   the Free Software Foundation, either version 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell is distributed in the hope that it will be useful,
++*   but WITHOUT ANY WARRANTY; without even the implied warranty of
++*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++*   GNU General Public License for more details.
++*
++*   You should have received a copy of the GNU General Public License
++*   along with INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package gui_elements;
++
++import java.awt.event.ItemEvent;
++import java.text.NumberFormat;
++import java.util.*;
++import java.text.DecimalFormat;
++import java.text.DecimalFormatSymbols;
++
++import javax.swing.JCheckBox;
++import javax.swing.JComponent;
++import javax.swing.JFormattedTextField;
++import javax.swing.JTextField;
++import javax.swing.JLabel;
++import javax.swing.JComboBox;
++
++import main.XMLHelper;
++
++import org.w3c.dom.Element;
++import org.w3c.dom.Node;
++import org.w3c.dom.NodeList;
++import net.miginfocom.swing.MigLayout;
++
++/**
++ * @brief The CombinedPanel may contain other panels, such as check and drop down boxes and text fields
++ *
++ * @author Thomas Egger
++ */
++public class CombinedPanel extends OptionPanel {
++	enum Type { CHOICE, INTEGER, DECIMAL, STRING, DROPDOWN }
++
++	/**
++	 *
++	 */
++	private static final long serialVersionUID = -6751282938445852408L;;
++
++	private final LinkedList<JComponent> valueComponents;
++
++	/**
++	 * Constructor for a panel that can hold text, numbers and check boxes. It
++	 * corresponds to the parameter type "combination" in the configuration file
++	 * and its subcomponents correspond to the option values.
++	 *
++	 * @param element
++	 * @throws GUIBuildException
++	 */
++	public CombinedPanel(Element element, ControlledPanel parent) throws GUIBuildException {
++		super(element, parent, false); //doing layout by itself
++
++		//System.out.println("Hierarchy: Parent: " + parent.getKey() + ": "+ parent.getHierarchy() + "  own: " + getHierarchy());
++
++		int column1 = 200;
++		column1 -= getHierarchy() * 5;
++		this.setLayout(new MigLayout("gapx 6, wrap 8, ins n 5 n n", "["+column1+"!][78!][78!][78!][78!][78!][78!][20!][200:400:400]", ""));
++
++		this.add(jlabel, "gapleft " + getHierarchy() * 5);
++		this.add(help, "cell 8 0, wrap");
++
++		valueComponents = new LinkedList<JComponent>();
++
++		final Element[] optionElements = XMLHelper.getElementArray(element, "option");
++
++		byte lblcounter = 0;
++
++		DecimalFormat format = (DecimalFormat)DecimalFormat.getInstance();
++		DecimalFormatSymbols custom = new DecimalFormatSymbols();
++		custom.setDecimalSeparator('.');
++		format.setDecimalFormatSymbols(custom);
++		format.setGroupingUsed(false);
++
++		DecimalFormat integerFormat = (DecimalFormat)DecimalFormat.getIntegerInstance();
++		integerFormat.setGroupingUsed(false);
++
++		int row = 0;
++		int column = 1;
++		
++		for (int i=0;i<optionElements.length;i++) {
++			final Type optionType = Type.valueOf(optionElements[i].getAttribute("type").toUpperCase());
++			final String initialValue = optionElements[i].getAttribute("value");
++			final String label = optionElements[i].getAttribute("label");
++
++			JComponent component = null;
++			JLabel lblcomponent  = null;
++
++			NodeList nodelist = optionElements[i].getChildNodes();
++
++			switch (optionType) {
++			case INTEGER:
++				component = new JFormattedTextField(integerFormat);
++				((JFormattedTextField)component).setColumns(8);
++				if ((initialValue != null) && (!initialValue.equals("")))
++					((JFormattedTextField)component).setValue(new Integer(initialValue));
++				break;
++			case DECIMAL:
++				component = new JFormattedTextField(format);
++				((JFormattedTextField)component).setColumns(8);
++				if ((initialValue != null) && (!initialValue.equals("")))
++					((JFormattedTextField)component).setValue((new Double(initialValue)));
++				break;
++			case STRING:
++				component = new JTextField(10);
++				((JTextField)component).setText(initialValue);
++				break;
++			case CHOICE:
++				component = new JCheckBox(optionElements[i].getAttribute("value"));
++				((JCheckBox)component).addItemListener(this);
++				break;
++			case DROPDOWN:
++				component = new JComboBox();
++
++				for (int jj = 0; jj < nodelist.getLength(); jj++) {
++					if (nodelist.item(jj).getNodeType() == Node.ELEMENT_NODE) {
++						((JComboBox)component).addItem(((Element)nodelist.item(jj)).getAttribute("value"));
++					}
++				}
++
++				((JComboBox)component).setSelectedItem(optionElements[i].getAttribute("value"));
++				((JComboBox)component).addItemListener(this);
++				break;
++			}
++			
++			int width = 1;
++
++			if ((label != null) && (!label.equals(""))){
++				if (label.length() > 12) width = 2; //for oversize labels
++
++				if (column+width >= 7) { 
++					column = 1; 
++					row++; 
++				}
++				lblcomponent = new JLabel(label);
++				valueComponents.add(lblcomponent);
++				
++				//System.out.println("component: " + component.getClass() + ");
++				//System.out.println("component: " + lblcomponent.getClass() + "  size: " + lblcomponent.getWidth() + "  col: " + column + " row: " + row);
++				this.add(lblcomponent, "cell " + column + " " + row + " " + width + " 1");
++				column += width;
++				width = 1;
++				lblcomponent.setVisible(true);
++			}
++
++			if (column >= 7) { 
++				column = 1; 
++				row++; 
++			}
++			//System.out.println("component: " + component.getClass() + "  size: " + component.getWidth() + "  col: " + column + " row: " + row);
++			this.add(component, "cell " + column + " " + row + " " + width + " 1");
++			column++;
++
++			valueComponents.add(component);
++			component.setVisible(true);
++		}
++		
++		//System.out.println("\t-->Instantiated one Combined Panel with " + optionElements.length + " components");
++	}
++
++	@Override
++	public void close() {
++		// TODO Auto-generated method stub
++
++	}
++
++	@Override
++	public void set(HashMap hm, String inkey, String invalue) {
++		if (!hm.containsKey(hashKey)) return;
++		String val = (String)hm.get(hashKey);
++
++		//System.out.println("\tSetting CombinedPanel: " + hashKey + " = " + val);
++		//System.out.println("\tThis CombinedPanel has the key: " + this.getKey() + "  should be: " + inkey + " val: " + invalue);
++
++		//Now loop through valueComponents and see if the value string can be matched
++		if (val == null) return;
++
++		String[] tokens = val.split("\\s+");
++		int counter = 0;
++
++		//System.out.println("\t\tLooking at VAL param: " + val);
++		for (final JComponent comp : valueComponents) {
++			boolean digested = false;
++			if (tokens.length <= counter) break;
++			//System.out.println("\t\tLooking at USER param: " + tokens[counter]);
++
++			if (comp.getClass() == JCheckBox.class) {
++				String cbString = ((JCheckBox) comp).getText();
++				if (tokens[counter].equals(cbString)) {
++					((JCheckBox) comp).setSelected(true);
++					digested = true;
++				}
++			} else if (comp.getClass() == JComboBox.class) {
++				JComboBox box = (JComboBox) comp;
++
++				for (int ii=0; ii<box.getItemCount(); ii++) {
++					String itemString = (String) box.getItemAt(ii);
++					if (itemString.equals(tokens[counter])) {
++						box.setSelectedIndex(ii);
++						digested = true;
++					}
++				}
++			} else if (comp.getClass() == JTextField.class) {
++				((JTextField) comp).setText(tokens[counter]);
++				digested = true;
++			} else if (comp.getClass() == JFormattedTextField.class) {
++				((JFormattedTextField) comp).setText(tokens[counter]);
++				digested = true;
++			}
++
++			if ((comp.getClass() != JLabel.class) && (digested))
++				counter++;
++		}
++	}
++
++	@Override
++	public String getValue() {
++		String value = "";
++
++		for (final JComponent comp : valueComponents) {
++			if (comp.getClass() == JTextField.class) {
++				value += ((JTextField) comp).getText();
++			} else if (comp.getClass() == JFormattedTextField.class) {
++				value += ((JFormattedTextField) comp).getText();
++			} else if (comp.getClass() == JCheckBox.class) {
++				if (((JCheckBox) comp).isSelected())
++					value += ((JCheckBox) comp).getText();
++			} else if (comp.getClass() == JComboBox.class) {
++				value += ((String)((JComboBox)comp).getSelectedItem());
++			}
++
++			if (value.length() > 0)
++				value += " ";
++		}
++
++		if (value.equals("")) return null;
++		else	return value;
++	}
++
++	@Override
++	public void itemStateChanged(ItemEvent arg0) {
++		String selectedOption = null;
++
++		if (arg0.getItemSelectable().getClass() == JCheckBox.class) {
++			selectedOption = ((JCheckBox) arg0.getItemSelectable()).getText();
++			super.handleItemEvent(arg0, selectedOption);
++		} else if (arg0.getItemSelectable().getClass() == JComboBox.class) {
++			selectedOption = ((String)((JComboBox)arg0.getItemSelectable()).getSelectedItem());
++			//HACK: should call super...
++		}
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/gui_elements/CombinedPanel.java
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/gui_elements/SelectorPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/SelectorPanel.java	(revision 0)
++++ ../trunk-jpl/src/java/src/gui_elements/SelectorPanel.java	(revision 17722)
+@@ -0,0 +1,233 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++ *
++ *   INIshell is free software: you can redistribute it and/or modify
++ *   it under the terms of the GNU General Public License as published by
++ *   the Free Software Foundation, either version 3 of the License, or
++ *   (at your option) any later version.
++ *
++ *   INIshell is distributed in the hope that it will be useful,
++ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ *   GNU General Public License for more details.
++ *
++ *   You should have received a copy of the GNU General Public License
++ *   along with INIshell.  If not, see <http://www.gnu.org/licenses/>.
++ *
++ */
++
++package gui_elements;
++
++import java.awt.event.ActionEvent;
++import java.awt.event.ActionListener;
++
++import javax.swing.JButton;
++import javax.swing.JOptionPane;
++
++
++import main.GUIBuilder;
++import main.XMLHelper;
++
++import org.w3c.dom.Element;
++import org.w3c.dom.Node;
++import org.w3c.dom.NodeList;
++
++import java.util.List;
++import java.util.ArrayList;
++import java.util.HashMap;
++
++/**
++ * This class introduces more flexibility into the inishell interface:
++ * The SelectorPanel offers the user to add a specific parameter to
++ * the interface.
++ *
++ * @author Thomas Egger
++ */
++public class SelectorPanel extends ControlledPanel implements ActionListener {
++
++	private static final long serialVersionUID = 8610877538909126920L;
++
++	String[] parameters;
++
++	JButton addButton;
++	JButton removeButton;
++	Element template;
++	String  templateKey;
++	HashMap<String, ControlledPanel> mapOfParameters;
++	ControlledPanel cp = null;
++
++	public SelectorPanel(Element element, ControlledPanel parent) {
++		super(element, parent);
++		templateKey = ""; //will store the pattern of the key
++
++		addButton = new JButton("+");
++		this.add(addButton, "cell 1 0, split 2, grow");
++		addButton.addActionListener(this);
++
++		removeButton = new JButton("-");
++		this.add(removeButton, "cell 1 0, grow, wrap");
++		removeButton.addActionListener(this);
++
++		//The following lines try to extract the template key (e.g. %::filters#, %::resample, COPY::%)
++		final NodeList nodelist = element.getChildNodes();
++		for (int ii = 0; ii < nodelist.getLength(); ii++) {
++			if (nodelist.item(ii).getNodeType() == Node.ELEMENT_NODE) {
++				Element currentElement = (Element)nodelist.item(ii);
++				if (currentElement.getAttribute("template").equals("true")){
++					template = (Element)currentElement.cloneNode(true);
++					templateKey = template.getAttribute("key");
++					template.setAttribute("template", "false");
++				}
++			}
++		}
++
++		final Element[] options = XMLHelper.getElementArray(element, "option");
++		parameters = new String[options.length + 1];
++		for (int ii=0; ii < options.length; ii++) {
++			parameters[ii] = options[ii].getAttribute("value");
++		}
++		parameters[options.length] = "Other...";
++
++		key = templateKey; //IMPORTANT: this changes the key only, not the label!
++		hashKey = this.getSection().toUpperCase() + "::" + this.getKey().toUpperCase();
++		mapOfParameters  = new HashMap<String, ControlledPanel>();
++	}
++
++	@Override
++	public void actionPerformed(ActionEvent arg0) {
++		if (arg0.getSource() == addButton) {
++			add();
++		} else if (arg0.getSource() == removeButton) {
++			remove();
++		}
++	}
++
++	@Override
++	public void set(HashMap hm, String key, String value) {
++		//HACK
++		//System.out.println("\tKEY: " + key + "  VAL: " + value);
++
++		String myKey = this.section.toUpperCase() + "::" + templateKey.toUpperCase().replace("%","([a-zA-Z0-9_]+)");
++		myKey = myKey.replace("#","[1-9]+[0-9]*"); //all integer numbers from 1 to infinity
++		//System.out.println("PATTERN: " + myKey);
++		String myKey2 = key.replaceAll(myKey, "$1");
++		String myKey3 = key.replaceAll(myKey, "$0");
++
++		//System.out.println("HUHUI: " + templateKey + " --- " + myKey2 + " -- " + myKey3);
++
++		boolean toAdd = true;
++		if (mapOfParameters.get(myKey2) != null) toAdd = false; //Parameter already exists
++
++		if (toAdd) {
++			ControlledPanel child = add(myKey2, true, hm, key, value);
++			cp = child;
++			if (child != null) child.set(hm, key, value);
++		} else {
++			if (cp != null) cp.set(hm, key, value);
++		}
++	}
++
++	public void add() {
++		String param = "";
++		String choice = "Other...";
++
++		if (parameters.length > 1)
++			choice = (String)JOptionPane.showInputDialog(this, "Add a parameter", "Add", JOptionPane.QUESTION_MESSAGE, null, parameters, null);
++
++		if (choice == null) return;
++
++		if (choice.equals("Other...")) {
++			param = JOptionPane.showInputDialog(this, "Enter the name of a meteo parameter\n(e.g. VW_AVG, P2");
++		} else {
++			param = choice;
++		}
++
++		add(param, false, null, null, null);
++	}
++
++	public ControlledPanel add(String param, boolean doSet, HashMap hm, String key, String value) {
++		//System.out.println("Trying to add SelectorPanel: " + key + " ... " + value);
++
++		if ((param == null) || (param.length() == 0)) return null;
++		param = param.toUpperCase();
++
++		if (mapOfParameters.get(param) != null) return null; //Parameter already exists
++
++		Element child = (Element)template.cloneNode(true);
++		recursiveKeyReplace(child, param);
++		element.appendChild(child);
++
++		ControlledPanel childPanel = null;
++		try {
++			childPanel = ControlledPanel.createSingleParameterPanel(child, this);
++			childPanel.setKey(childPanel.getKey());
++			GUIBuilder.gui.addToTab(childPanel, section, this);
++			childPanel.hold();
++			GUIBuilder.control(childPanel);
++			GUIBuilder.recursiveBuild(child, this, doSet, hm, key, value);
++
++			mapOfParameters.put(param, childPanel);
++		} catch (final GUIBuildException e1) {
++			e1.printStackTrace();
++		}
++
++		this.invalidate();
++
++		return childPanel;
++	}
++
++	@Override
++	public void close() {
++
++	}
++
++	@Override
++	public String getValue() {
++		return null;
++	}
++
++	public void remove() {
++		if (mapOfParameters.size() == 0) return;
++
++		String choice = (String)JOptionPane.showInputDialog(this, "Remove a parameter", "Remove", JOptionPane.QUESTION_MESSAGE, null, mapOfParameters.keySet().toArray(), null);
++
++		if (choice == null) return; //nothing to do
++
++		String childKey = templateKey.replaceAll("%", choice);
++		final Element child = XMLHelper.getCertainChildElement(element, "parameter", "key", childKey);
++
++		if (child == null) return;
++
++		try { //this makes sure that all child nodes are destroyed
++			GUIBuilder.recursiveDestruct(child, this);
++			element.removeChild(child);
++			final ControlledPanel childPanel = GUIBuilder.panelControl.get(section, childKey);
++
++			childPanel.release();
++			childPanel.close();
++
++			if (!childPanel.isNeeded())
++				GUIBuilder.gui.removeFromTab(childPanel, section, this);
++
++			mapOfParameters.remove(choice);
++		} catch (final GUIBuildException e) {
++			e.printStackTrace();
++		}
++
++		this.invalidate();
++	}
++
++	private void recursiveKeyReplace(Element element, String string) {
++		if (element.hasAttribute("key"))
++			element.setAttribute("key", element.getAttribute("key").replaceAll("%", string));
++
++		final NodeList nodelist = element.getChildNodes();
++		for (int i = 0; i < nodelist.getLength(); i++) {
++			if (nodelist.item(i).getNodeType() == Node.ELEMENT_NODE) {
++				recursiveKeyReplace(((Element) nodelist.item(i)), string);
++			}
++		}
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/gui_elements/SelectorPanel.java
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/gui_elements/GUIBuildException.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/GUIBuildException.java	(revision 0)
++++ ../trunk-jpl/src/java/src/gui_elements/GUIBuildException.java	(revision 17722)
+@@ -0,0 +1,33 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell is free software: you can redistribute it and/or modify
++*   it under the terms of the GNU General Public License as published by
++*   the Free Software Foundation, either version 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell is distributed in the hope that it will be useful,
++*   but WITHOUT ANY WARRANTY; without even the implied warranty of
++*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++*   GNU General Public License for more details.
++*
++*   You should have received a copy of the GNU General Public License
++*   along with INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package gui_elements;
++
++public class GUIBuildException extends Exception {
++
++	/**
++	 *
++	 */
++	private static final long serialVersionUID = 1L;
++
++	public GUIBuildException(String message) {
++		super(message);
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/gui_elements/GUIBuildException.java
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/gui_elements/ControlledPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/ControlledPanel.java	(revision 0)
++++ ../trunk-jpl/src/java/src/gui_elements/ControlledPanel.java	(revision 17722)
+@@ -0,0 +1,285 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell is free software: you can redistribute it and/or modify
++*   it under the terms of the GNU General Public License as published by
++*   the Free Software Foundation, either version 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell is distributed in the hope that it will be useful,
++*   but WITHOUT ANY WARRANTY; without even the implied warranty of
++*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++*   GNU General Public License for more details.
++*
++*   You should have received a copy of the GNU General Public License
++*   along with INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package gui_elements;
++
++import java.awt.Color;
++import java.awt.Component;
++import java.awt.Font;
++
++import javax.swing.JEditorPane;
++import javax.swing.JLabel;
++import javax.swing.JPanel;
++import javax.swing.JSeparator;
++import javax.swing.*;
++import java.util.HashMap;
++import javax.swing.border.*;
++
++import main.GUI;
++import main.GUIBuilder;
++import main.XMLHelper;
++import net.miginfocom.swing.MigLayout;
++
++import org.w3c.dom.Element;
++import org.w3c.dom.Node;
++
++/**
++ * Abstract class for JPanels that are maintained with their key and designated
++ * section and can return their current value.
++ */
++public abstract class ControlledPanel extends JPanel {
++
++	private static final long serialVersionUID = 1L;
++
++	private int dependencies;
++
++	protected JLabel jlabel;
++
++	protected String section;
++	protected String key;
++	protected String label;
++	protected String hashKey;
++
++	protected Element element;
++
++	protected boolean optional;
++	protected String replace;
++
++	protected int hierarchy;
++	protected String helptext;
++	protected JEditorPane help;
++
++	/**
++	 * Constructor for a controlled panel.
++	 *
++	 * @param element
++	 */
++	public ControlledPanel(Element element, ControlledPanel parent) {
++		this(element, parent, true);
++	}
++
++	public ControlledPanel(Element element, ControlledPanel parent, boolean doLayout) {
++		super();
++		initialize(element, parent);
++
++		if (doLayout) {
++			int column1 = 200;
++			column1 -= getHierarchy() * 5; //Indentation for the label, 5px per hierarchy level
++
++			setLayout(new MigLayout("gapx 6, wrap 8, top, ins n 5 n n", "["+ column1 + "!][100!][100!][100!][100!][100!][300:400:400]", ""));
++			add(jlabel, "growx, ay top, gaptop 5, gapleft " + getHierarchy() * 5);
++			add(help, "cell 6 0, wrap");
++		}
++	}
++
++	private void initialize(Element element, ControlledPanel parent) {
++		dependencies = 0;
++
++		this.element = element;
++		this.key = element.getAttribute("key");
++		this.label = this.key;
++
++		this.section = element.getAttribute("section");
++		this.hashKey = this.section.toUpperCase() + "::" + this.key.toUpperCase();
++		this.optional = element.getAttribute("optional").equals("true");
++
++		jlabel = new JLabel(this.label + ":      ");
++		jlabel.setForeground(GUI.LABEL_COLOR);
++
++		this.setBackground(Color.white);
++		this.setVisible(true);
++
++		/* Add help to the right side of the panel. */
++		helptext = XMLHelper.getChildElementContent(element, "help");
++		help = ControlledPanel.createHelpPane("<html>"+helptext+"</html>");
++		if (helptext != null) help.setText(helptext);		
++
++		if (parent != null) {
++			setHierarchy(parent.getHierarchy() + 1);
++		} else {
++			setHierarchy(0);
++		}
++	}
++
++	/**
++	 * Creates a ControlledPanel for a parameter that matches its type. (i.e.
++	 * radio buttons for an option parameter, ...
++	 *
++	 * @param element
++	 * @return the Controlled Panel
++	 * @throws GUIBuildException
++	 */
++	public static ControlledPanel createSingleParameterPanel(Element element, ControlledPanel parent) throws GUIBuildException {
++		ControlledPanel panel;
++
++		//System.out.println("IN create: " + XMLHelper.getString((Node)element));
++
++		if (element.hasAttribute("counter")) {
++			panel = new DuplicatorPanel(element, parent);
++		} else if (element.getTagName().equals("frame")) {
++			panel = new FramePanel(element, parent);
++		} else if (element.getAttribute("type").equals("path")	|| element.getAttribute("type").equals("file")) {
++			panel = new PathPanel(element, parent);
++		} else if (element.getAttribute("type").equals("alternative") || element.getAttribute("type").equals("logical")) {
++			panel = new AlternativePanel(element, parent);
++		} else if (element.getAttribute("type").equals("choice")) {
++			panel = new CheckBoxPanel(element, parent);
++		} else if (element.getAttribute("type").equals("integer") || element.getAttribute("type").equals("integer+")){
++			panel = new IntegerPanel(element, parent);
++		} else if (element.getAttribute("type").equals("decimal")) {
++			panel = new DecimalPanel(element, parent);
++		} else if (element.getAttribute("type").equals("double")) {
++			panel = new TextfieldPanel(element, parent);
++		} else if (element.getAttribute("type").equals("string") || element.getAttribute("type").equals("char") || element.getAttribute("type").equals("cell")){
++			panel = new TextfieldPanel(element, parent);
++		} else if (element.getAttribute("type").equals("combination")) {
++			panel = new CombinedPanel(element, parent);
++		} else if (element.getAttribute("type").equals("selector")) {
++			panel = new SelectorPanel(element, parent);
++		} else {
++			throw new GUIBuildException("Cannot create a GUI panel for a parameter of type " + element.getAttribute("type"));
++		}
++
++		return panel;
++	}
++
++	public static JEditorPane createHelpPane(String helptext){
++		JEditorPane help = new JEditorPane();
++		help.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
++		help.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 12));
++		help.setEditable(false);
++		help.setContentType("text/html");
++		help.setForeground(Color.GRAY);
++		help.addHyperlinkListener(GUIBuilder.gui);
++
++		if (helptext!=null) {
++			help.setText("<html>"+helptext+"</html>");
++		} else {
++			help.setText("<html></html>");
++		}
++
++		return help;
++	}
++
++	public void setHierarchy(int val) {
++		hierarchy = val;		
++	}
++
++	public int getHierarchy() {
++		return hierarchy;
++	}
++
++	/**
++	 * This method should be called when the panel is removed.
++	 */
++	public abstract void close();
++
++	/**
++	 * @return the GUI component.
++	 */
++	public Component getComponent() {
++		return this;
++	}
++
++	/**
++	 * @return the number of dependencies on the panel.
++	 */
++	public int getDependencies() {
++		return dependencies;
++	}
++
++	/**
++	 * @return the key of the corresponding key / value set
++	 */
++	public String getKey() {
++		return key;
++	}
++
++	/**
++	 * @return the current value of the key / value set null if the key value
++	 *         set should not be printed
++	 */
++	public abstract String getValue();
++
++	/**
++	 * This method should be called when another panel depends needs this panel
++	 * to exist.
++	 */
++	public synchronized void hold() {
++		this.dependencies++;
++	}
++
++	/**
++	 * @return true if dependencies on this panel exist
++	 * @throws GUIBuildException
++	 */
++	public synchronized boolean isNeeded() throws GUIBuildException {
++		if (dependencies == 0) {
++			return false;
++		} else if (dependencies > 0) {
++			return true;
++		} else {
++			throw new GUIBuildException("Inplausible number of dependencies on panel");
++		}
++	}
++
++	/**
++	 * @return true if a value for the underlying parameter is optional
++	 */
++	public boolean isOptional() {
++		return optional;
++	}
++
++	/**
++	 * This method should be called when a panel no longer needs this panel to
++	 * exist. The panel will be removed if no dependency exists.
++	 */
++	public synchronized void release() {
++		this.dependencies--;
++	}
++
++	public void set(HashMap hm, String key, String value) {
++		System.out.println("Set not implemented for ControlledPanel: " + serialVersionUID);
++	}
++
++	public String getHashKey() {
++		return hashKey;
++	}
++
++	/**
++	 * This method sets a new key for a panel and changes its label.
++	 *
++	 * @param key
++	 *            the new key
++	 */
++	public void setKey(String key) {
++		this.key = key;
++		element.setAttribute("key", key);
++		jlabel.setText(this.label + ":      ");
++	}
++
++	/**
++	 * Getter method for the section.
++	 * @return the section
++	 */
++	public String getSection() {
++		return section;
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/gui_elements/ControlledPanel.java
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/gui_elements/CheckBoxPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/CheckBoxPanel.java	(revision 0)
++++ ../trunk-jpl/src/java/src/gui_elements/CheckBoxPanel.java	(revision 17722)
+@@ -0,0 +1,139 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell is free software: you can redistribute it and/or modify
++*   it under the terms of the GNU General Public License as published by
++*   the Free Software Foundation, either version 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell is distributed in the hope that it will be useful,
++*   but WITHOUT ANY WARRANTY; without even the implied warranty of
++*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++*   GNU General Public License for more details.
++*
++*   You should have received a copy of the GNU General Public License
++*   along with INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package gui_elements;
++
++import main.*;
++
++import java.awt.Color;
++import java.awt.event.ItemEvent;
++import java.util.HashMap;
++
++import javax.swing.JCheckBox;
++import javax.swing.JOptionPane;
++import javax.swing.JLabel;
++
++import org.w3c.dom.Element;
++import org.w3c.dom.Node;
++
++public class CheckBoxPanel extends OptionPanel {
++
++	private static final long serialVersionUID = 552186457208697362L;
++	private final JCheckBox[] boxes;
++	String concat;
++	private String setKey = null, setValue = null;
++	private boolean doSet = false;
++	private HashMap setMap;
++
++
++	/**
++	 * Constructor for a panel that can hold a number of checkboxes to compose
++	 * the value for a key/value set.
++	 *
++	 * @param element
++	 * @throws GUIBuildException
++	 */
++	public CheckBoxPanel(Element element, ControlledPanel parent) throws GUIBuildException {
++		super(element, parent);
++
++		concat = "";
++		boxes = new JCheckBox[values.length];
++		for (int i = 0; i < values.length; i++) {
++			boxes[i] = new JCheckBox(values[i]);
++
++			this.add(boxes[i], "cell 1 " + i + ", wrap, ay top");
++
++			String extra = "";
++			if (i > 0)
++				extra = ", gapleft 12";
++
++			this.add(ControlledPanel.createHelpPane(this.helptexts[i]), "cell 6 "+ i +", width 200:400:400, wrap" + extra);
++
++			boxes[i].setBackground(Color.white);
++			boxes[i].setVisible(true);
++			boxes[i].addItemListener(this);
++			if (defaultTrues.contains(values[i])) {
++				boxes[i].setSelected(true);
++				concat += values[i] + " ";
++			}
++		}
++	}
++
++	@Override
++	public void close() {
++		for (final JCheckBox box : boxes)
++			box.setSelected(false);
++	}
++
++	@Override
++	public String getValue() {
++		if (!isOptional() && concat.equals("")) {
++			JOptionPane.showMessageDialog(null, "No option was selected for "
++									+ getKey() + " (section '" + getSection().toUpperCase() + "')"
++									+ ".\nA value is required. Your .ini-file is probably incorrect.",
++									"Problem when building .ini file",
++									JOptionPane.WARNING_MESSAGE);
++		}
++
++		if (concat.equals("")) return null;
++		else	return concat.trim();
++	}
++
++	public synchronized void set(HashMap hm, String key, String value) {
++		String val = ((String)hm.get(hashKey)).toUpperCase();
++		//System.out.println("\tABOUT TO CHANGE CHECKBOXPANEL KEY: " + key + "  VAL: " + val);
++
++		String[] tokens = val.split("\\s+");
++		for (final JCheckBox box : boxes) {
++			box.setSelected(false);
++			
++			for (final String token : tokens) {
++				if (token.equals(box.getText())) {
++					//System.out.println("\t\tSelecting Checkbox: " + token);
++					doSet = true;
++					setKey = key;
++					setValue = value;
++					setMap = hm;
++					box.setSelected(true);
++				}
++			}
++		}
++	}
++
++
++	@Override
++	public synchronized void itemStateChanged(ItemEvent arg0) {
++		final String selectedOption = ((JCheckBox) arg0.getItemSelectable()).getText();
++
++		if (arg0.getStateChange() == ItemEvent.SELECTED) {
++			concat += selectedOption + " ";
++		} else {
++			concat = concat.replaceAll(new String(" " + selectedOption + " "), " ");
++			concat = concat.replaceFirst(new String("^" + selectedOption + " "), ""); //at the beginning of the concat
++		}
++
++		//super.handleItemEvent(arg0, selectedOption);
++		super.handleItemEvent(arg0, selectedOption, doSet, setMap, setKey, setValue);
++		doSet = false;
++		setKey = null;
++		setMap = null;
++		setValue = null;
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/gui_elements/CheckBoxPanel.java
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/gui_elements/DuplicatorPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/DuplicatorPanel.java	(revision 0)
++++ ../trunk-jpl/src/java/src/gui_elements/DuplicatorPanel.java	(revision 17722)
+@@ -0,0 +1,175 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell is free software: you can redistribute it and/or modify
++*   it under the terms of the GNU General Public License as published by
++*   the Free Software Foundation, either version 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell is distributed in the hope that it will be useful,
++*   but WITHOUT ANY WARRANTY; without even the implied warranty of
++*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++*   GNU General Public License for more details.
++*
++*   You should have received a copy of the GNU General Public License
++*   along with INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package gui_elements;
++
++import java.awt.event.ActionEvent;
++import java.awt.event.ActionListener;
++import java.util.*;
++
++import javax.swing.JButton;
++
++import main.GUIBuilder;
++import main.XMLHelper;
++
++import org.w3c.dom.Element;
++import org.w3c.dom.Node;
++import org.w3c.dom.NodeList;
++
++public class DuplicatorPanel extends ControlledPanel implements ActionListener {
++
++	/**
++	 *
++	 */
++	private static final long serialVersionUID = 6801877538909126920L;
++	JButton addButton;
++	Element clone;
++
++	JButton removeButton;
++
++	public DuplicatorPanel(Element element, ControlledPanel parent) {
++		super(element, parent);
++
++		addButton = new JButton("+");
++		this.add(addButton, "cell 1 0, split 2, grow");
++		addButton.addActionListener(this);
++
++		removeButton = new JButton("-");
++		this.add(removeButton, "cell 1 0, grow, wrap");
++		removeButton.addActionListener(this);
++
++		clone = (Element) element.cloneNode(true);
++		clone.removeAttribute("counter");
++		clone.setAttribute("counted", "true");
++	}
++
++	@Override
++	public void actionPerformed(ActionEvent arg0) {
++		if (arg0.getSource() == addButton) {
++			add();
++		} else if (arg0.getSource() == removeButton) {
++			remove();
++		}
++	}
++
++	@Override
++	public void set(HashMap hm, String key, String value) {
++		//System.out.println("Trying to add DUPLICATOR Panel: " + key + " ... " + value + "  HashKey: " + this.getHashKey());
++
++		if (key.indexOf('#') == -1) {
++			ControlledPanel child = add(true, hm, key, value);
++			child.set(hm, key, value);
++		}
++	}
++
++	public ControlledPanel add() {
++		return add(false, null, null, null);
++	}
++
++	public ControlledPanel add(boolean doSet, HashMap hm, String key, String value) {
++
++		final Element child = (Element) this.clone.cloneNode(true);
++		final int counter = Integer.parseInt(element.getAttribute("counter"));
++		element.setAttribute("counter", (counter + 1) + "");
++
++		// child.setAttribute("key",element.getAttribute("key").replaceAll("#",counter+""));
++
++		//System.out.println("\t-->Adding a child panel to DUPLICATOR with key: " + key + "  val: " + value + "  HASH: " + this.getHashKey() + "  hier: " + this.getHierarchy());
++
++		recursiveKeyReplace(child, counter + "");
++		element.appendChild(child);
++
++		ControlledPanel childPanel = null;
++		try {
++			childPanel = ControlledPanel.createSingleParameterPanel(child, this);
++			childPanel.setKey(childPanel.getKey());
++			GUIBuilder.gui.addToTab(childPanel, section, this);
++			childPanel.hold();
++			GUIBuilder.control(childPanel);
++			GUIBuilder.recursiveBuild(child, this, doSet, hm, key, value);
++
++		} catch (final GUIBuildException e1) {
++			// TODO Auto-generated catch block
++			e1.printStackTrace();
++		}
++
++		this.invalidate();
++		
++		return childPanel;
++	}
++
++	@Override
++	public void close() {
++		boolean doRemove = true;
++
++		do {
++			doRemove = remove();
++		} while (doRemove);
++	}
++
++	@Override
++	public String getValue() {
++		return null;
++	}
++
++	public boolean remove() {
++		final int counter = Integer.parseInt(element.getAttribute("counter")) - 1;
++		final String childKey = element.getAttribute("key").replace("#", counter + "");
++		final Element child = XMLHelper.getCertainChildElement(element, "parameter", "key", childKey);
++
++		if (child == null) return false;
++
++		element.removeChild(child);
++		element.setAttribute("counter", (counter) + "");
++
++		final ControlledPanel childPanel = GUIBuilder.panelControl.get(section, childKey);
++
++		if (childPanel != null) {
++			childPanel.release();
++			childPanel.close();
++
++			try {
++				if (!childPanel.isNeeded()) {
++					GUIBuilder.gui.removeFromTab(childPanel, section, this);
++				}
++			} catch (final GUIBuildException e) {
++				// TODO Auto-generated catch block
++				e.printStackTrace();
++			}
++		}
++
++		this.invalidate();
++
++		return true;
++	}
++
++	private void recursiveKeyReplace(Element element, String string) {
++		if (element.hasAttribute("key")) {
++			element.setAttribute("key", element.getAttribute("key").replaceAll("#", string));
++		}
++		final NodeList nodelist = element.getChildNodes();
++		for (int i = 0; i < nodelist.getLength(); i++) {
++			if (nodelist.item(i).getNodeType() == Node.ELEMENT_NODE) {
++				recursiveKeyReplace(((Element) nodelist.item(i)), string);
++			}
++		}
++	}
++
++}
+
+Property changes on: ../trunk-jpl/src/java/src/gui_elements/DuplicatorPanel.java
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/gui_elements/OptionPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/OptionPanel.java	(revision 0)
++++ ../trunk-jpl/src/java/src/gui_elements/OptionPanel.java	(revision 17722)
+@@ -0,0 +1,144 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell is free software: you can redistribute it and/or modify
++*   it under the terms of the GNU General Public License as published by
++*   the Free Software Foundation, either version 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell is distributed in the hope that it will be useful,
++*   but WITHOUT ANY WARRANTY; without even the implied warranty of
++*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++*   GNU General Public License for more details.
++*
++*   You should have received a copy of the GNU General Public License
++*   along with INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package gui_elements;
++
++import java.awt.event.ItemEvent;
++import java.awt.event.ItemListener;
++import java.util.LinkedList;
++import java.util.HashMap;
++import javax.swing.event.EventListenerList;
++
++import main.GUIBuilder;
++import main.XMLHelper;
++
++import org.w3c.dom.Element;
++import org.w3c.dom.Node;
++
++/**
++ * A ControlledPanel that maintains a group of choices and invokes panel
++ * creation according to the current choices.
++ *
++ * @author korhammer et egger
++ *
++ */
++public abstract class OptionPanel extends ControlledPanel implements ItemListener {
++
++	private static final long serialVersionUID = 88L;
++
++	protected LinkedList<String> defaultTrues;
++	protected EventListenerList listenerList;
++
++	protected String[] values;
++	protected String[] labels;
++	protected String[] helptexts;
++
++	/**
++	 * The constructor for an OptionPanel.
++	 *
++	 * @param element
++	 *            : The xml element which the OptionPanel is created for.
++	 * @throws GUIBuildException
++	 */
++	public OptionPanel(Element element, ControlledPanel parent) throws GUIBuildException {
++		this(element, parent, true);
++	}
++
++	public OptionPanel(Element element, ControlledPanel parent, boolean doLayout) throws GUIBuildException {
++		super(element, parent, doLayout);
++		
++		String elementdefault = "";
++
++		if (element.hasAttribute("default"))
++			elementdefault = element.getAttribute("default");
++
++		listenerList = new EventListenerList();
++
++		final Element[] options = XMLHelper.getElementArray(element, "option");
++		defaultTrues = new LinkedList<String>();
++
++		values = new String[options.length];
++		labels = new String[options.length];
++		helptexts = new String[options.length];
++
++		for (int i=0;i<options.length;i++) {
++			values[i] = options[i].getAttribute("value");
++			labels[i] = options[i].getAttribute("label");
++
++			if (labels[i] == "")
++				labels[i] = values[i];
++
++			if (elementdefault.equals(values[i]))
++				defaultTrues.add(values[i]);
++
++			if (options[i].hasAttribute("default") && options[i].getAttribute("default").equals("true"))
++				defaultTrues.add(values[i]);
++
++			helptexts[i] = XMLHelper.getChildElementContent(options[i],"help");
++		}
++	}
++
++	@Override
++	public void set(HashMap hm, String key, String value) {
++		//System.out.println("Trying to change OptionPanel");
++		//ControlledPanel child = add("TA2");
++		//child.set(element);
++	}
++
++
++	/**
++	 * Invokes the appropriate build or destruct methods when changes are made
++	 * to choices.
++	 *
++	 * @param arg0
++	 * @param selectedOption
++	 */
++	public void handleItemEvent(ItemEvent arg0, String selectedOption) {
++		handleItemEvent(arg0, selectedOption, false, null, null, null);
++	}
++
++	public void handleItemEvent(ItemEvent arg0, String selectedOption, boolean doSet, HashMap hm, String setKey, String setValue) {
++		Element optionElement = XMLHelper.getCertainChildElement(this.element, "option", "label", selectedOption);
++
++		if (optionElement == null)
++			optionElement = XMLHelper.getCertainChildElement(this.element, "option", "value", selectedOption);
++
++		//System.out.println("XML of handleItem("+arg0.getItemSelectable().getClass().toString()+"): " + XMLHelper.getString((Node)optionElement));//this.element));
++
++		if (arg0.getStateChange() == ItemEvent.SELECTED) {
++			try {
++				GUIBuilder.recursiveBuild(optionElement, this, doSet, hm, setKey, setValue);
++			} catch (final GUIBuildException e) {
++				// TODO Auto-generated catch block
++				e.printStackTrace();
++			}
++
++		} else {
++			try {
++				GUIBuilder.recursiveDestruct(optionElement, this);
++			} catch (final GUIBuildException e) {
++				// TODO Auto-generated catch block
++				e.printStackTrace();
++			}
++		}
++
++	}
++
++}
+
+Property changes on: ../trunk-jpl/src/java/src/gui_elements/OptionPanel.java
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/gui_elements/TextfieldPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/TextfieldPanel.java	(revision 0)
++++ ../trunk-jpl/src/java/src/gui_elements/TextfieldPanel.java	(revision 17722)
+@@ -0,0 +1,129 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell is free software: you can redistribute it and/or modify
++*   it under the terms of the GNU General Public License as published by
++*   the Free Software Foundation, either version 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell is distributed in the hope that it will be useful,
++*   but WITHOUT ANY WARRANTY; without even the implied warranty of
++*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++*   GNU General Public License for more details.
++*
++*   You should have received a copy of the GNU General Public License
++*   along with INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package gui_elements;
++
++import main.GUI;
++
++import java.awt.*;
++import java.awt.event.*;
++import java.util.HashMap;
++
++import javax.swing.JTextField;
++import javax.swing.JOptionPane;
++
++import org.w3c.dom.Element;
++
++/**
++ * A panel that contains a textfield.
++ *
++ * @author korhammer et egger
++ *
++ */
++public class TextfieldPanel extends ControlledPanel implements KeyListener {
++
++	private static final long serialVersionUID = 1L;
++	private String defaultText;
++
++	protected JTextField textfield;
++
++	/**
++	 * The constructor for a TextfieldPanel.
++	 *
++	 * @param element
++	 */
++	public TextfieldPanel(Element element, ControlledPanel parent) {
++		super(element, parent);
++		textfield = new JTextField(10);
++		textfield.setVisible(true);
++		this.add(textfield, "width 250:100:400, cell 1 0, growx, ay top, gaptop 3");
++		textfield.addKeyListener(this);
++
++		defaultText = "";
++		if (element.hasAttribute("default")) {
++			defaultText = element.getAttribute("default");
++		}
++		textfield.setText(defaultText);
++
++		if (!optional)
++			textfield.setBackground(GUI.WARNING_BACKGROUND_COLOR);
++
++		this.checkBgColor();
++		textfield.invalidate();
++	}
++
++
++
++	@Override
++	public void close() {
++		// TODO Auto-generated method stub
++
++	}
++
++	@Override
++	public void set(HashMap hm, String key, String value) {
++		//System.out.println("\tI'm changing the label of the TextField with key '" + this.getKey() + "'");
++		String val = (String)hm.get(hashKey);
++		if (val != null) textfield.setText(val);
++		this.checkBgColor();
++	}
++
++	@Override
++	public String getValue() {
++		String thetext = textfield.getText();
++
++		if (!isOptional() && thetext.equals("")) {
++			JOptionPane.showMessageDialog(null, "No value was entered for "
++									+ getKey() + " (section '" + getSection().toUpperCase() + "')"
++									+ ".\nA value is required. Your .ini-file is probably incorrect.",
++									"Problem when building .ini file",
++									JOptionPane.WARNING_MESSAGE);
++		}
++
++		if (thetext.equals(""))
++			return null;
++
++		return thetext;
++	}
++
++	/** Handle the key typed event from the text field. */
++	public void keyTyped(KeyEvent e) {}
++
++	/** Handle the key-pressed event from the text field. */
++	public void keyPressed(KeyEvent e) {}
++
++	/** Handle the key-released event from the text field. */
++	public void keyReleased(KeyEvent e) {
++		checkBgColor();
++	}
++
++	public void checkBgColor() {
++		String text = textfield.getText();
++		
++		if (!optional) {
++			if (text.length() > 0) {
++				textfield.setBackground(GUI.NORMAL_BACKGROUND_COLOR);
++			} else {
++				textfield.setBackground(GUI.WARNING_BACKGROUND_COLOR);
++			}
++			textfield.invalidate();
++		}
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/gui_elements/TextfieldPanel.java
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/gui_elements/FramePanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/FramePanel.java	(revision 0)
++++ ../trunk-jpl/src/java/src/gui_elements/FramePanel.java	(revision 17722)
+@@ -0,0 +1,71 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell is free software: you can redistribute it and/or modify
++*   it under the terms of the GNU General Public License as published by
++*   the Free Software Foundation, either version 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell is distributed in the hope that it will be useful,
++*   but WITHOUT ANY WARRANTY; without even the implied warranty of
++*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++*   GNU General Public License for more details.
++*
++*   You should have received a copy of the GNU General Public License
++*   along with INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package gui_elements;
++
++import main.GUIBuilder;
++import main.XMLHelper;
++
++import java.util.HashMap;
++import javax.swing.JPanel;
++import javax.swing.border.*;
++import javax.swing.BorderFactory;
++
++import org.w3c.dom.Element;
++import org.w3c.dom.Node;
++import org.w3c.dom.NodeList;
++import net.miginfocom.swing.MigLayout;
++
++public class FramePanel extends ControlledPanel {
++
++	private static final long serialVersionUID = 1987664773406118295L;
++	protected String title = "";
++
++	/**
++	 *
++	 *
++	 * @param element
++	 * @throws GUIBuildException
++	 */
++	public FramePanel(Element element, ControlledPanel parent) throws GUIBuildException {
++		super(element, parent, false);
++		this.setLayout(new MigLayout("wrap 8, top, ins n 5 n n", "[200!][100!][100!][100!][100!][100!][300:400:400]", ""));
++
++		if (parent == null)	hierarchy = 1;
++
++		title = element.getAttribute("label");
++
++		Border mytitledborder = BorderFactory.createTitledBorder(title);
++		//Border loweredetched = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
++		this.setBorder(mytitledborder);
++
++		this.invalidate();
++	}
++
++	@Override
++	public String getValue() {
++		return null;
++	}
++	
++	@Override
++	public void close() {
++
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/gui_elements/FramePanel.java
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/gui_elements/PathPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/PathPanel.java	(revision 0)
++++ ../trunk-jpl/src/java/src/gui_elements/PathPanel.java	(revision 17722)
+@@ -0,0 +1,118 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell is free software: you can redistribute it and/or modify
++*   it under the terms of the GNU General Public License as published by
++*   the Free Software Foundation, either version 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell is distributed in the hope that it will be useful,
++*   but WITHOUT ANY WARRANTY; without even the implied warranty of
++*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++*   GNU General Public License for more details.
++*
++*   You should have received a copy of the GNU General Public License
++*   along with INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package gui_elements;
++
++import java.awt.event.ActionEvent;
++import java.awt.event.ActionListener;
++import java.util.HashMap;
++
++import javax.swing.JButton;
++import javax.swing.JFileChooser;
++import javax.swing.JPanel;
++
++import org.w3c.dom.Element;
++
++public class PathPanel extends TextfieldPanel implements ActionListener {
++
++	/**
++	 *
++	 */
++	private static final long serialVersionUID = 1486664773406118295L;
++
++	JButton select_button;
++
++	/**
++	 * Creates a panel with a text field and a file / path chooser button.
++	 *
++	 * @param element
++	 * @throws GUIBuildException
++	 */
++	public PathPanel(Element element, ControlledPanel parent) throws GUIBuildException {
++		super(element, parent);
++
++		if (element.getAttribute("type").equals("path")) {
++			select_button = new JButton("Select Path");
++		} else if (element.getAttribute("type").equals("file")) {
++			select_button = new JButton("Select File");
++		} else {
++			throw new GUIBuildException("PathPanel is not applicable for parameter types other than 'file' and 'path'.");
++		}
++
++		this.remove(textfield);
++		this.add(textfield, "cell 1 0, growx, span2");
++
++		select_button.addActionListener(this);
++		select_button.setActionCommand("open chooser");
++		select_button.setVisible(true);
++		this.add(select_button, "cell 3 0, growx, wrap");
++
++	}
++
++	@Override
++	public void actionPerformed(ActionEvent event) {
++		if (event.getActionCommand().equals("open chooser") && event.getSource() == this.select_button) {
++			try {
++				chooseFile();
++			} catch (final GUIBuildException e) {
++				// TODO Auto-generated catch block
++				e.printStackTrace();
++			}
++		}
++	}
++
++	@Override
++	public void set(HashMap hm, String key, String value) {
++		String val = (String)hm.get(hashKey);
++		if (val != null) textfield.setText(val);
++		this.checkBgColor();
++	}
++
++	/**
++	 * Opens the file chooser dialog and writes the path / filepath into the
++	 * texfield.
++	 *
++	 * @throws GUIBuildException
++	 */
++	public void chooseFile() throws GUIBuildException {
++		final JFileChooser filechooser = new JFileChooser(System.getProperty("user.dir"));
++
++		if (element.getAttribute("type").equals("path")) {
++			filechooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
++		} else if (element.getAttribute("type").equals("file")) {
++			filechooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
++		} else {
++			throw new GUIBuildException("PathPanel is not applicable for parameter types other than 'file' and 'path'.");
++		}
++
++		final int returnVal = filechooser.showOpenDialog(new JPanel());
++
++		if (returnVal == JFileChooser.APPROVE_OPTION) {
++			if (element.getAttribute("type").equals("path")) {
++				textfield.setText(filechooser.getSelectedFile().getAbsolutePath());
++			} else {
++				textfield.setText(filechooser.getSelectedFile().getName());
++			}
++
++			checkBgColor();
++		}
++	}
++
++}
+
+Property changes on: ../trunk-jpl/src/java/src/gui_elements/PathPanel.java
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/gui_elements/IntegerPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/IntegerPanel.java	(revision 0)
++++ ../trunk-jpl/src/java/src/gui_elements/IntegerPanel.java	(revision 17722)
+@@ -0,0 +1,246 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell is free software: you can redistribute it and/or modify
++*   it under the terms of the GNU General Public License as published by
++*   the Free Software Foundation, either version 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell is distributed in the hope that it will be useful,
++*   but WITHOUT ANY WARRANTY; without even the implied warranty of
++*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++*   GNU General Public License for more details.
++*
++*   You should have received a copy of the GNU General Public License
++*   along with INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package gui_elements;
++
++import java.awt.event.*;
++import java.util.HashMap;
++
++import javax.swing.JButton;
++import javax.swing.JOptionPane;
++import javax.swing.SwingConstants;
++
++import org.w3c.dom.Element;
++
++/**
++ * A panel that maintains a number in an editable textfield,
++ * optionally with a maximum and minimum value.
++ * @author korhammer
++ *
++ */
++/**
++ * @author korhammer
++ *
++ */
++public class IntegerPanel extends TextfieldPanel implements ActionListener, FocusListener {
++	/**
++	 *
++	 */
++	private static final long serialVersionUID = -8959578535487185306L;
++
++	private int defaultvalue;
++	private int maximumvalue;
++	private int minimumvalue;
++
++	private boolean printPlus;
++
++	private final JButton down;
++	private final JButton up;
++
++	/**
++	 * Constructor for a NumberPanel.
++	 *
++	 * @param element
++	 * @throws GUIBuildException
++	 */
++	public IntegerPanel(Element element, ControlledPanel parent) throws GUIBuildException {
++		super(element, parent);
++
++		setDefaultvalue(0);
++		minimumvalue = Integer.MIN_VALUE;
++		maximumvalue = Integer.MAX_VALUE;
++		printPlus = false;
++
++		if (element.getAttribute("type").equals("integer+")) {
++			setPrintplus(true);
++		} else {
++			setPrintplus(false);
++		}
++
++		if (element.hasAttribute("default")) {
++			setDefaultvalue(element.getAttribute("default"));
++		}
++		if (element.hasAttribute("maximum")) {
++			setMaximumvalue(element.getAttribute("maximum"));
++		}
++		if (element.hasAttribute("minimum")) {
++			setMinimumvalue(element.getAttribute("minimum"));
++		}
++
++		textfield.setColumns(4);
++		textfield.invalidate();
++		textfield.setHorizontalAlignment(SwingConstants.RIGHT);
++
++		up = new JButton("+");
++		up.addActionListener(this);
++		down = new JButton("-");
++		down.addActionListener(this);
++		this.add(up, "split 2, growx, ay top");
++		this.add(down, "growx, ay top");
++		textfield.addActionListener(this);
++		textfield.addFocusListener(this);
++
++	}
++
++	/**
++	 * Parses a String to an integer. Different from the standard methods as it
++	 * handles the + sign e.g. in time zones.
++	 *
++	 * @param text
++	 * @return the parsed number
++	 * @throws NumberFormatException
++	 */
++	private static int parse(String text) throws NumberFormatException {
++
++		final char first = text.charAt(0);
++
++		if (first == '+')
++			return Integer.parseInt(text.substring(1));
++		if (first == '-')
++			return Integer.parseInt(text);
++		return Integer.parseInt(text);
++	}
++
++	/*
++	 * (non-Javadoc)
++	 *
++	 * @see
++	 * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
++	 */
++	@Override
++	public void actionPerformed(ActionEvent e) {
++		if (e.getSource() == up) {
++			manipulateNumber(1);
++		} else if (e.getSource() == down) {
++			manipulateNumber(-1);
++		} else if (e.getSource() == textfield) {
++			parseTextfield();
++		}
++	}
++
++	@Override
++	public void set(HashMap hm, String key, String value) {
++		String val = (String)hm.get(hashKey);
++		if (val != null) {
++			try {
++				Integer.parseInt(val);
++				textfield.setText(val);
++			} catch (Exception e) {} //Do nothing if conversion fails
++		}
++	}
++
++	@Override
++	public void focusGained(FocusEvent arg0) {
++
++	}
++
++	@Override
++	public void focusLost(FocusEvent arg0) {
++		parseTextfield();
++	}
++
++	/**
++	 * Manipulates the number in the text field by parsing it, adding the
++	 * increment and writing it back into the textfield.
++	 *
++	 * @param increment
++	 */
++	public void manipulateNumber(int increment) {
++		int number;
++
++		try {
++			number = parseTextfield();
++		} catch (final NumberFormatException nfe) {
++			return;
++		}
++
++		if (number + increment <= maximumvalue
++				&& number + increment >= minimumvalue) {
++			number += increment;
++		} else if (number + increment < minimumvalue) {
++			number = minimumvalue;
++		} else if (number + increment > maximumvalue) {
++			number = maximumvalue;
++		}
++
++		printToTextfield(number);
++	}
++
++	/**
++	 * Calls the parse method on the textfield.
++	 *
++	 * @return
++	 * @throws NumberFormatException
++	 */
++	public int parseTextfield() throws NumberFormatException {
++		try {
++			return parse(textfield.getText());
++		} catch (final NumberFormatException nfe) {
++			JOptionPane.showMessageDialog(null, "The textfield " + getKey()
++					+ " does not contain a number.");
++			throw nfe;
++		}
++	}
++
++	/**
++	 * Prints a number to the text field optionally with a plus sign.
++	 *
++	 * @param number
++	 */
++	public void printToTextfield(int number) {
++		if (this.printPlus && number > 0) {
++			textfield.setText("+" + number);
++		} else {
++			textfield.setText("" + number);
++		}
++		checkBgColor();
++	}
++
++	public void setDefaultvalue(int defaultvalue) {
++		this.defaultvalue = defaultvalue;
++		this.printToTextfield(defaultvalue);
++	}
++
++	public void setDefaultvalue(String defaultvalue) {
++		this.defaultvalue = parse(defaultvalue);
++		this.printToTextfield(this.defaultvalue);
++	}
++
++	public void setMaximumvalue(int maximumvalue) {
++		this.maximumvalue = maximumvalue;
++	}
++
++	public void setMaximumvalue(String maximumvalue) {
++		this.maximumvalue = parse(maximumvalue);
++	}
++
++	public void setMinimumvalue(int minimumvalue) {
++		this.minimumvalue = minimumvalue;
++	}
++
++	public void setMinimumvalue(String minimumvalue) {
++		this.minimumvalue = parse(minimumvalue);
++	}
++
++	public void setPrintplus(boolean printPlus) {
++		this.printPlus = printPlus;
++		printToTextfield(parse(textfield.getText()));
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/gui_elements/IntegerPanel.java
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/gui_elements/AlternativePanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/AlternativePanel.java	(revision 0)
++++ ../trunk-jpl/src/java/src/gui_elements/AlternativePanel.java	(revision 17722)
+@@ -0,0 +1,177 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell is free software: you can redistribute it and/or modify
++*   it under the terms of the GNU General Public License as published by
++*   the Free Software Foundation, either version 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell is distributed in the hope that it will be useful,
++*   but WITHOUT ANY WARRANTY; without even the implied warranty of
++*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++*   GNU General Public License for more details.
++*
++*   You should have received a copy of the GNU General Public License
++*   along with INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package gui_elements;
++
++import java.awt.event.ItemEvent;
++
++import javax.swing.JComboBox;
++import javax.swing.JOptionPane;
++import java.util.HashMap;
++import javax.swing.*;
++import java.awt.*;
++
++import main.GUI;
++
++import org.w3c.dom.Element;
++
++/**
++ * The AlternativePanel contains a dropdown list with alternatives to choose from.
++ *
++ * @author Thomas Egger
++ *
++ */
++public class AlternativePanel extends OptionPanel {
++
++	private static final long serialVersionUID = 4468480774697888798L;
++	private final JComboBox box;
++
++	private String setKey = null, setValue = null;
++	private boolean doSet = false;
++	private HashMap setMap;
++
++	/**
++	 * Constructor for the AlternativePanel
++	 *
++	 * @param element the <parameter ...> element for which the panel is created.
++	 * @throws GUIBuildException
++	 */
++	public AlternativePanel(Element element, ControlledPanel parent) throws GUIBuildException {
++		super(element, parent);
++
++		box = new JComboBox(labels);
++		box.insertItemAt("", 0);     //Add an empty label
++		box.setVisible(true);
++		box.setSelectedIndex(0);
++		box.addItemListener(this);
++
++		//Issue 263: On OSX the box.setBackground method does not function without this tweak:
++		if (System.getProperty("os.name").equals("Mac OS X")) 
++		    box.setRenderer(new ColorCellRenderer(box.getPreferredSize().width));
++
++		if (!optional) box.setBackground(GUI.WARNING_BACKGROUND_COLOR);
++
++		if (defaultTrues.size() > 1) {
++			throw new GUIBuildException("Element " + getHashKey() + " has multiple default values");
++		} else if (defaultTrues.size() == 1) {
++			box.setSelectedItem(defaultTrues.getFirst());
++		}
++
++		this.add(box, "cell 1 0, growx, ay top, wrap");
++	}
++
++	@Override
++	public void close() {
++		this.box.setSelectedIndex(0);
++	}
++
++	@Override
++	public String getValue() {
++
++		if (box.getSelectedIndex() != 0) {
++			//String selectedString = (String) box.getSelectedItem();
++			int index = box.getSelectedIndex() - 1;
++			if (index < 0)
++				return "";
++
++			return values[index];
++		}
++
++		if (!isOptional()) {
++			JOptionPane.showMessageDialog(null, "No option was selected for "
++									+ getKey() + " (section '" + getSection().toUpperCase() + "')"
++									+ ".\nA value is required. Your .ini-file is probably incorrect.",
++									"Problem when building .ini file",
++									JOptionPane.WARNING_MESSAGE);
++		}
++
++		return null;
++	}
++
++	@Override
++	public synchronized void set(HashMap hm, String key, String value) {
++		doSet = true;
++		setKey = key;
++		setValue = value;
++		setMap = hm;
++
++		if (!hm.containsKey(hashKey)) return;
++		String val = ((String)hm.get(hashKey)).toUpperCase();
++
++		//System.out.println("\tAP: Setting AlternativePanel: " + hashKey + " = " + val);
++
++		for (int ii=0; ii<values.length; ii++) { //loop through all existant items
++			if (val.equals(values[ii].toUpperCase())) { //compare to val
++				this.box.setSelectedIndex(ii+1);
++				break;
++			}
++		}
++	}
++
++	@Override
++	public synchronized void itemStateChanged(ItemEvent arg0) {
++		//Deal with help text
++		help.setText("");
++
++		if ((box.getSelectedIndex() > 0) && (helptexts[box.getSelectedIndex()-1] != null)) {
++			help.setText("<html>" + helptexts[box.getSelectedIndex()-1] + "</html>");
++		} else {
++			if (helptext != null) 
++				help.setText("<html>" + helptext + "</html>");
++		}
++
++		//handle selected Item
++		final String selectedOption = (String) arg0.getItem();
++		if (selectedOption == "") {
++			if (!optional) {
++				box.setBackground(GUI.WARNING_BACKGROUND_COLOR);
++			}
++		} else {
++			if (!optional) {
++				box.setBackground(GUI.NORMAL_BACKGROUND_COLOR);
++			}
++			//System.out.println("\tDOSET of AlternativePanel: " + doSet);
++			super.handleItemEvent(arg0, selectedOption, doSet, setMap, setKey, setValue);
++			doSet = false;
++			setKey = null;
++			setMap = null;
++			setValue = null;
++		}
++	}
++}
++
++class ColorCellRenderer implements ListCellRenderer {
++	protected DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer();
++	private Dimension preferredSize = new Dimension(0, 18);
++
++	public ColorCellRenderer(int width) {
++		width -= 50;
++
++		if (width < 100) width = 100; //Default size on OSX
++	
++		preferredSize = new Dimension(width, 18);
++	}
++
++	public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
++		JLabel renderer = (JLabel) defaultRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
++		renderer.setPreferredSize(preferredSize);
++		return renderer;
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/gui_elements/AlternativePanel.java
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/gui_elements/DecimalPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/DecimalPanel.java	(revision 0)
++++ ../trunk-jpl/src/java/src/gui_elements/DecimalPanel.java	(revision 17722)
+@@ -0,0 +1,133 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell is free software: you can redistribute it and/or modify
++*   it under the terms of the GNU General Public License as published by
++*   the Free Software Foundation, either version 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell is distributed in the hope that it will be useful,
++*   but WITHOUT ANY WARRANTY; without even the implied warranty of
++*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++*   GNU General Public License for more details.
++*
++*   You should have received a copy of the GNU General Public License
++*   along with INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package gui_elements;
++
++import java.awt.event.ActionEvent;
++import java.awt.event.ActionListener;
++import java.awt.event.FocusEvent;
++import java.awt.event.FocusListener;
++import java.util.HashMap;
++
++import java.text.DecimalFormat;
++import java.text.ParseException;
++import java.text.DecimalFormatSymbols;
++import javax.swing.JFormattedTextField;
++
++import org.w3c.dom.Element;
++
++public class DecimalPanel extends TextfieldPanel implements ActionListener, FocusListener{
++
++	/**
++	 *
++	 */
++	private static final long serialVersionUID = 1555742510677354674L;
++	double defaultvalue;
++	double maximumvalue;
++	double minimumvalue;
++
++	JFormattedTextField textfield;
++
++	public DecimalPanel(Element element, ControlledPanel parent) {
++		super(element, parent);
++		this.remove(super.textfield);
++
++		DecimalFormat format = (DecimalFormat)DecimalFormat.getInstance();
++		DecimalFormatSymbols custom = new DecimalFormatSymbols();
++		custom.setDecimalSeparator('.');
++		format.setDecimalFormatSymbols(custom);
++		format.setGroupingUsed(false);
++
++		textfield = new JFormattedTextField(format);
++		textfield.addActionListener(this);
++		textfield.addFocusListener(this);
++		this.add(textfield,"cell 1 0, growx, ay top, gaptop 3");
++		textfield.setVisible(true);
++		this.invalidate();
++		defaultvalue = 0.0;
++		maximumvalue = Double.MAX_VALUE;
++		minimumvalue = Double.MIN_VALUE;
++
++
++		if(element.hasAttribute("minimum")){
++			minimumvalue = Double.parseDouble(element.getAttribute("minimum"));
++		}
++		if(element.hasAttribute("maximum")){
++			maximumvalue = Double.parseDouble(element.getAttribute("maximum"));
++		}
++		if(element.hasAttribute("default")){
++			defaultvalue = Double.parseDouble(element.getAttribute("default"));
++		}
++		setToDefaultValue();
++	}
++
++	private void setToDefaultValue() {
++		textfield.setValue(new Double(defaultvalue));
++		this.invalidate();
++	}
++
++	private void checkValue(){
++		try {
++			textfield.commitEdit();
++		} catch (ParseException e) {
++			// TODO Auto-generated catch block
++			e.printStackTrace();
++		}
++		double currentvalue = ((Number)textfield.getValue()).doubleValue();
++		if(currentvalue > maximumvalue){
++			textfield.setValue(new Double(maximumvalue));
++		}
++		else if(currentvalue<minimumvalue){
++			textfield.setValue(new Double(minimumvalue));
++		}
++	}
++
++	public String getValue(){
++		return textfield.getValue().toString();
++	}
++
++	@Override
++	public void set(HashMap hm, String key, String value) {
++		String val = (String)hm.get(hashKey);
++		if (val != null) {
++			try {
++				Double.parseDouble(val);
++				textfield.setText(val);
++			} catch (Exception e) {} //Do nothing if conversion fails
++		}
++	}
++
++	@Override
++	public void focusGained(FocusEvent arg0) {
++		checkValue();
++
++	}
++
++	@Override
++	public void focusLost(FocusEvent arg0) {
++		checkValue();
++
++	}
++
++	@Override
++	public void actionPerformed(ActionEvent arg0) {
++		checkValue();
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/gui_elements/DecimalPanel.java
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/main/PanelControl.java
+===================================================================
+--- ../trunk-jpl/src/java/src/main/PanelControl.java	(revision 0)
++++ ../trunk-jpl/src/java/src/main/PanelControl.java	(revision 17722)
+@@ -0,0 +1,248 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell is free software: you can redistribute it and/or modify
++*   it under the terms of the GNU General Public License as published by
++*   the Free Software Foundation, either version 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell is distributed in the hope that it will be useful,
++*   but WITHOUT ANY WARRANTY; without even the implied warranty of
++*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++*   GNU General Public License for more details.
++*
++*   You should have received a copy of the GNU General Public License
++*   along with INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package main;
++
++import gui_elements.ControlledPanel;
++
++import java.io.File;
++import java.io.FileWriter;
++import java.io.IOException;
++import java.util.HashMap;
++import java.util.LinkedList;
++import java.util.Set;
++import java.util.TreeMap;
++import java.util.Iterator;
++
++/**
++ * Class that maintains all ControlledPanels so that values can be retrieved
++ * from panels, ini-files can be written. And a panel is not multiply created.
++ *
++ * @author korhammer
++ *
++ */
++public class PanelControl {
++
++	LinkedList<String> order;
++	HashMap<String, TreeMap<String, ControlledPanel>> panels;
++	HashMap<String, String> comments = null;
++	HashMap<String, String> added_comments = null;
++	HashMap<String, HashMap<String, String>> unusedKeys = null;
++	PanelNode rootNode = null;
++
++	/**
++	 * Constructor for the panel control.
++	 */
++	public PanelControl() {
++		panels = new HashMap<String, TreeMap<String, ControlledPanel>>();
++		order = new LinkedList<String>();
++
++		unusedKeys = new HashMap<String, HashMap<String, String>>();
++	}
++
++	public PanelControl(PanelControl p) {
++		panels = new HashMap<String, TreeMap<String, ControlledPanel>>(p.panels);
++		order = new LinkedList<String>(p.order);
++		if (added_comments != null)
++			added_comments = new HashMap<String, String>(p.added_comments);
++
++		if (comments != null)
++			comments = new HashMap<String, String>(p.comments);
++	}
++
++	public void setUnusedKeys(String key, String value) {
++		//Parse key
++		int offset = key.indexOf("::");
++		String section = key.substring(0, offset);
++		String sectionkey = key.substring(offset + 2);
++
++		HashMap<String, String> hm = unusedKeys.get(section);
++		if (hm == null) unusedKeys.put(section, new HashMap<String, String>());
++
++		unusedKeys.get(section).put(sectionkey, value);
++	}
++
++	public void setComments(HashMap<String, String> inaddedcomments, HashMap<String, String> incomments) {
++		this.added_comments = new HashMap<String, String>(inaddedcomments);
++		this.comments = new HashMap<String, String>(incomments);
++	}
++
++	/**
++	 * @param section
++	 * @param key
++	 * @return true if a panel with such key is maintained in the specified
++	 *         section
++	 */
++	public boolean contains(String section, String key) {
++		if (!panels.containsKey(section))
++			return false;
++
++		return panels.get(section).containsKey(key);
++	}
++
++	/**
++	 *
++	 * @param section
++	 * @param key
++	 * @return the panel with the specified section / key pair
++	 */
++	public ControlledPanel get(String section, String key) {
++		return panels.get(section).get(key);
++	}
++
++	/**
++	 * Prints the ini-file at the specified path.
++	 *
++	 * @param path
++	 */
++	public void printToFile(String path) {
++		/* create file */
++		final File file = new File(path);
++
++		try {
++			final FileWriter writer = new FileWriter(file);
++
++			writer.write(this.toString());
++			writer.close();
++		} catch (final IOException e) {
++			// TODO Auto-generated catch block
++			e.printStackTrace();
++		}
++	}
++
++	/**
++	 * Adds the panel to the specified section.
++	 *
++	 * @param section
++	 * @param panel
++	 */
++	public void put(String section, ControlledPanel panel) {
++		final String key = panel.getKey();
++		if (!panels.containsKey(section)) {
++			order.add(section);
++			panels.put(section, new TreeMap<String, ControlledPanel>());
++		}
++		panels.get(section).put(key, panel);
++	}
++
++	/**
++	 * Removes the panel with the specified section and key.
++	 *
++	 * @param section
++	 * @param key
++	 * @return the panel
++	 */
++	public ControlledPanel remove(String section, String key) {
++		return panels.get(section).remove(key);
++	}
++
++	/**
++	 * Prints the maintained panels to a string.
++	 *
++	 * @return an ini-file-like structure
++	 */
++	public void setRootNode(PanelNode inrootNode) {
++		rootNode = inrootNode;
++	}
++
++	public String extractKey(String instring) {
++		int offset = instring.indexOf("::");
++		if (offset == -1) return null;
++
++		return instring.substring(offset+2);
++	}
++
++	@Override
++	public String toString() {
++		String out = "";
++
++		for (final String section : order) {
++			/* create section */
++			final String sectionstring = "[" + section.toUpperCase() + "]\n";
++			String keyvaluestring = "";
++
++			/* print section */
++			LinkedList<String> keys = new LinkedList<String>();
++			PanelNode sectionNode = rootNode.get(section.toUpperCase());
++			if (sectionNode != null) sectionNode.getKeyList(keys);
++
++			//final Set<String> keys = panels.get(section).keySet();
++			for (final String hashKey : keys) {
++				String key = extractKey(hashKey);
++				if (key == null) continue;
++
++				final String value = panels.get(section).get(key).getValue();
++				if (value != null) {
++					if ((comments != null) && comments.containsKey(hashKey.toUpperCase())) {
++						String precomments =  comments.get(hashKey.toUpperCase());
++						if (!precomments.equals(""))
++						 	keyvaluestring += precomments;						
++					}
++
++					keyvaluestring += key + "\t=\t" + value;					
++
++					if ((added_comments != null) && added_comments.containsKey(hashKey.toUpperCase()))
++						keyvaluestring += "\t" + added_comments.get(hashKey.toUpperCase());
++
++					keyvaluestring += "\n";
++				}
++			}
++
++			//Add unused keys
++			HashMap<String, String> extra = unusedKeys.get(section.toUpperCase());
++			if (extra != null) {
++				if (!keyvaluestring.equals("")) keyvaluestring += "\n";
++
++				for (String extrakey : extra.keySet()) {
++					String hashKey = section.toUpperCase() + "::" + extrakey.toUpperCase();
++					if ((comments != null) && comments.containsKey(hashKey)) {
++						String precomments =  comments.get(hashKey);
++						if (!precomments.equals(""))
++						 	keyvaluestring += precomments;						
++					}
++				
++					keyvaluestring += extrakey + "\t=\t" + extra.get(extrakey);
++
++					if ((added_comments != null) && added_comments.containsKey(hashKey))
++					    keyvaluestring += "\t" + added_comments.get(hashKey);
++
++					keyvaluestring += "\n";
++				}
++			}
++			
++			//check if there aren't any comments in that section
++			String hashKey = section.toUpperCase() + "::";
++			if ((comments != null) && comments.containsKey(hashKey)) {
++				String precomments =  comments.get(hashKey);
++				if (!precomments.equals("")) {
++					if (precomments.indexOf("\n") == -1) precomments += "\n";
++					keyvaluestring = precomments + keyvaluestring + "\n";
++				}
++			}
++			
++			/* add section only if keys / values are printed */
++			if (!keyvaluestring.equals("")) {
++				out += sectionstring + keyvaluestring + "\n";
++			}
++		}
++
++		return out;
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/main/PanelControl.java
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/main/XMLHelper.java
+===================================================================
+--- ../trunk-jpl/src/java/src/main/XMLHelper.java	(revision 0)
++++ ../trunk-jpl/src/java/src/main/XMLHelper.java	(revision 17722)
+@@ -0,0 +1,525 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell is free software: you can redistribute it and/or modify
++*   it under the terms of the GNU General Public License as published by
++*   the Free Software Foundation, either version 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell is distributed in the hope that it will be useful,
++*   but WITHOUT ANY WARRANTY; without even the implied warranty of
++*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++*   GNU General Public License for more details.
++*
++*   You should have received a copy of the GNU General Public License
++*   along with INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package main;
++
++import gui_elements.GUIBuildException;
++
++import java.io.IOException;
++import java.util.LinkedList;
++
++import javax.xml.parsers.DocumentBuilder;
++import javax.xml.parsers.DocumentBuilderFactory;
++import javax.xml.parsers.ParserConfigurationException;
++import javax.xml.transform.TransformerConfigurationException;
++import javax.xml.transform.TransformerException;
++import javax.xml.transform.TransformerFactory;
++
++import org.w3c.dom.Document;
++import org.w3c.dom.Element;
++import org.w3c.dom.Node;
++import org.w3c.dom.NodeList;
++import org.xml.sax.SAXException;
++
++//for the XML printing
++import javax.xml.transform.stream.StreamResult;
++import javax.xml.transform.*;
++import javax.xml.transform.dom.*;
++import java.io.StringWriter;
++
++public class XMLHelper {
++
++	/**
++	 * Find the parameter values for which the element should be cloned
++	 * e.g. for section tags.
++	 *
++	 * @param element
++	 * @param tagName
++	 * @param attributeName
++	 * @param parentArgument
++	 * @return the
++	 */
++	public static String[] findApplicableValues(Element element,
++			String tagName, String attributeName, String parentArgument) {
++
++		final String[] argumentsFromElement = getAttributesFromChildren(
++				element, tagName, attributeName);
++
++		/*
++		 * If no such arguments are specified for the current element but there
++		 * are for the parent element, take that of the parent.
++		 */
++		if (argumentsFromElement.length == 0 && parentArgument != null)
++			return new String[] { parentArgument };
++		else if ((argumentsFromElement.length > 0 && parentArgument != null)) {
++			if (getCertainChildElement(element, tagName, attributeName,
++					parentArgument) != null)
++				return new String[] { parentArgument };
++			else
++				/*
++				 * The empty intersection is an empty array so that his case can
++				 * be handled differently from the null case below.
++				 */
++				return new String[0];
++		}
++
++		/*
++		 * If no arguments are specified for the parent use all element
++		 * arguments.
++		 */
++		else if (argumentsFromElement.length > 0 && parentArgument == null)
++			return argumentsFromElement;
++		else if (argumentsFromElement.length == 0 && parentArgument == null)
++			return null;
++		return null;
++	}
++
++	/**
++	 * Get all children of an element that have a certain element tag and
++	 * extract the values for a certain attribute.
++	 *
++	 * @param parent
++	 *            the parent element
++	 * @param tag
++	 *            the element tag
++	 * @param attribute
++	 *            the attribute name
++	 *
++	 * @return a String array with the attribute values
++	 */
++	public static String[] getAttributesFromChildren(Element parent, String tag, String attribute) {
++		final Element[] elements = getElementArray(parent, tag);
++
++		final String[] attributes = new String[elements.length];
++		for (int i = 0; i < elements.length; i++) {
++			attributes[i] = elements[i].getAttribute(attribute);
++		}
++		return attributes;
++	}
++
++	/**
++	 * Returns the first child element that has the specified element tag and
++	 * the value for the specified attribute.
++	 *
++	 * @param parent
++	 * @param tag
++	 * @param attribute
++	 * @param value
++	 * @return the first child element that meets the criteria
++	 */
++	public static Element getCertainChildElement(Element parent, String tag,
++			String attribute, String value) {
++		final Element[] allElements = getElementArray(parent, tag);
++		for (final Element element : allElements) {
++			if (element.hasAttribute(attribute)) {
++				if (element.getAttribute(attribute).equals(value))
++					return element;
++			}
++		}
++		return null;
++	}
++
++	/**
++	 * For the specified element gets the text that is contained in the first
++	 * child that has a certain element name.
++	 *
++	 *
++	 * @param parent
++	 *            the parent element
++	 * @param tag
++	 *            the element tag for the child
++	 * @return the text content
++	 */
++	public static String getChildElementContent(Element parent, String tag) {
++		final Element[] elements = getElementArray(parent, tag);
++		if (elements.length == 0)
++			return null;
++
++		return elements[0].getTextContent();
++	}
++
++
++
++	/**
++	 * @param parent
++	 * @param tag
++	 * @return all child elements of the parent with the specified tag
++	 */
++	public static Element[] getElementArray(Element parent, String tag) {
++		if (!parent.hasChildNodes())
++			return new Element[0];
++
++		final NodeList nodeList = parent.getChildNodes();
++		final LinkedList<Element> elementlist = new LinkedList<Element>();
++		for (int i = 0; i < nodeList.getLength(); i++) {
++
++			final Node element = nodeList.item(i);
++			if (element.getNodeType() == Node.ELEMENT_NODE && ((Element) element).getTagName().equals(tag)) {
++				elementlist.add((Element) element);
++			}
++		}
++		final Element[] elements = new Element[elementlist.size()];
++
++		return elementlist.toArray(elements);
++	}
++
++	public static Element[] getElementArray(Element parent, String[] tags) {
++		if (!parent.hasChildNodes())
++			return new Element[0];
++
++		final NodeList nodeList = parent.getChildNodes();
++		final LinkedList<Element> elementlist = new LinkedList<Element>();
++		for (int ii = 0; ii < nodeList.getLength(); ii++) {
++
++			final Node element = nodeList.item(ii);
++			if (element.getNodeType() == Node.ELEMENT_NODE) {
++				//Loop through all possible tags
++				for (int jj=0; jj<tags.length; jj++) {
++					if (((Element) element).getTagName().equals(tags[jj])) {
++						elementlist.add((Element) element);
++						break;
++					}
++				}
++			}
++		}
++
++		final Element[] elements = new Element[elementlist.size()];
++		return elementlist.toArray(elements);
++	}
++
++	/**
++	 * Prints the Document object to the console. as XML.
++	 *
++	 * @param doc
++	 */
++	public static String printToScreen(Document doc) {
++
++		final javax.xml.transform.TransformerFactory tfactory = TransformerFactory
++				.newInstance();
++
++		javax.xml.transform.Transformer xform;
++		try {
++			xform = tfactory.newTransformer();
++
++			final javax.xml.transform.Source src = new javax.xml.transform.dom.DOMSource(
++					doc);
++
++			final java.io.StringWriter writer = new java.io.StringWriter();
++			final javax.xml.transform.Result result = new javax.xml.transform.stream.StreamResult(
++					writer);
++
++			xform.transform(src, result);
++
++			return writer.toString();
++
++		} catch (final TransformerConfigurationException e) {
++			// TODO Auto-generated catch block
++			e.printStackTrace();
++		} catch (final TransformerException e) {
++			// TODO Auto-generated catch block
++			e.printStackTrace();
++		}
++		return null;
++	}
++
++
++
++	/**
++	 * Reads an XML file and writes it into a Document structure.
++	 *
++	 * @param filepath
++	 * @param xsdpath
++	 *            the path of the W3 XML schema that the file is based on.
++	 * @throws GUIBuildException
++	 */
++	public static Document readXML(String filepath, String xsdpath)
++			throws GUIBuildException {
++
++		/* read XML file and write it into Document structure */
++
++		final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
++		dbf.setIgnoringComments(true);
++		dbf.setValidating(true);
++		dbf.setIgnoringElementContentWhitespace(true);
++
++		dbf.setAttribute(
++				"http://java.sun.com/xml/jaxp/properties/schemaLanguage",
++				"http://www.w3.org/2001/XMLSchema");
++		dbf.setAttribute(
++				"http://java.sun.com/xml/jaxp/properties/schemaSource", xsdpath);
++
++
++		DocumentBuilder db;
++		Document doc;
++
++		try {
++
++			db = dbf.newDocumentBuilder();
++			doc = db.parse(filepath);
++		} catch (final ParserConfigurationException e) {
++			throw new GUIBuildException(e.getMessage());
++		} catch (final SAXException e) {
++			throw new GUIBuildException(e.getMessage());
++		} catch (final IOException e) {
++			throw new GUIBuildException(e.getMessage());
++		}
++
++		doc.normalize();
++		doc.normalizeDocument();
++
++		resolveIncludes(doc, xsdpath);
++		resolveReferences(doc);
++		recursivelyResolveSections(doc.getDocumentElement(), null);
++		recursivelyResolveReplaces(doc.getDocumentElement(), null);
++
++		return doc;
++	}
++
++	/**
++	 * This method recursively traverses the document tree and replaces all
++	 * parameters that contain replace elements with the corresponding number of
++	 * cloned elements.
++	 *
++	 * @param current
++	 *            the current element
++	 * @param parentReplace
++	 *
++	 */
++	public static void recursivelyResolveReplaces(Element current,
++			String parentReplace) {
++
++		final String[] replacements = XMLHelper.findApplicableValues(
++				current, "replace", "name", parentReplace);
++
++		/* delete replace children */
++		final Element[] replaceChildren = XMLHelper.getElementArray(current,
++				"replace");
++		for (final Element replace : replaceChildren) {
++			current.removeChild(replace);
++		}
++
++		if (replacements == null) {
++			final NodeList childNodes = current.getChildNodes();
++			final Node[] nodes = new Node[childNodes.getLength()];
++			for (int i = 0; i < childNodes.getLength(); i++) {
++				nodes[i] = childNodes.item(i);
++			}
++
++			for (final Node node : nodes) {
++				if (node.getNodeType() == Node.ELEMENT_NODE) {
++					XMLHelper.recursivelyResolveReplaces((Element) node,
++							parentReplace);
++				}
++			}
++		} else if (replacements.length == 0) {
++			current.getParentNode().removeChild(current);
++		} else if (replacements != null) {
++			/* clone element */
++			for (final String replace : replacements) {
++				final Element clone = (Element) current.cloneNode(true);
++				clone.setAttribute("key",
++						clone.getAttribute("key").replaceAll("%", replace));
++				clone.setAttribute("replaced", replace);
++				current.getParentNode().appendChild(clone);
++
++				/* Recursion: Do not do recursion on NodeList as it is updated */
++				final NodeList childNodes = clone.getChildNodes();
++				final Node[] nodes = new Node[childNodes.getLength()];
++				for (int i = 0; i < childNodes.getLength(); i++) {
++					nodes[i] = childNodes.item(i);
++				}
++
++				for (final Node node : nodes) {
++					if (node.getNodeType() == Node.ELEMENT_NODE) {
++						XMLHelper.recursivelyResolveReplaces((Element) node,
++								replace);
++					}
++				}
++
++			}
++			current.getParentNode().removeChild(current);
++		}
++	}
++
++	/**
++	 * This method recursively traverses the document tree and replaces all
++	 * parameters that contain section elements with the corresponding number of
++	 * cloned elements.
++	 *
++	 * @param current
++	 */
++	public static void recursivelyResolveSections(Element current,
++			String parentSection) {
++
++		final String[] sections = XMLHelper.findApplicableValues(current,
++				"section", "name", parentSection);
++
++
++		final Element[] sectionChildren = XMLHelper.getElementArray(current,
++				"section");
++		for (final Element section : sectionChildren) {
++			current.removeChild(section);
++		}
++
++		if (sections == null) {
++			final NodeList childNodes = current.getChildNodes();
++			final Node[] nodes = new Node[childNodes.getLength()];
++			for (int i = 0; i < childNodes.getLength(); i++) {
++				nodes[i] = childNodes.item(i);
++			}
++
++			for (final Node node : nodes) {
++				if (node.getNodeType() == Node.ELEMENT_NODE) {
++					XMLHelper.recursivelyResolveSections((Element) node,
++							parentSection);
++				}
++			}
++		} else if (sections != null) {
++			/* clone element */
++			for (final String section : sections) {
++				final Element clone = (Element) current.cloneNode(true);
++				clone.setAttribute("section", section);
++
++				current.getParentNode().appendChild(clone);
++
++				/* Recursion: Do not do recursion on NodeList as it is updated */
++				final NodeList childNodes = clone.getChildNodes();
++				final Node[] nodes = new Node[childNodes.getLength()];
++				for (int i = 0; i < childNodes.getLength(); i++) {
++					nodes[i] = childNodes.item(i);
++				}
++
++				for (final Node node : nodes) {
++					if (node.getNodeType() == Node.ELEMENT_NODE) {
++						XMLHelper.recursivelyResolveSections((Element) node,
++								section);
++					}
++				}
++
++			}
++			current.getParentNode().removeChild(current);
++		}
++	}
++
++	/**
++	 * Parses an XML file as specified in the path of an "include" element and
++	 * replaces the include element with the content of the XML file.
++	 *
++	 * @param doc
++	 */
++	public static Document resolveIncludes(Document doc, String xsdpath) {
++		final NodeList include = doc.getElementsByTagName("include");
++
++		for (int i = 0; i < include.getLength(); i++) {
++
++			final String includePath = ((Element) include.item(i))
++					.getAttribute("path");
++
++			try {
++				final Document partialDocument = readXML(includePath, xsdpath);
++
++				final NodeList children = partialDocument.getChildNodes()
++						.item(0).getChildNodes();
++				final Node parent = include.item(i).getParentNode();
++
++				for (int j = 0; j < children.getLength(); j++) {
++					final Node imported = doc
++							.importNode(children.item(j), true);
++					parent.appendChild(imported);
++				}
++
++				// parent.replaceChild(fragment, include.item(i));
++			} catch (final GUIBuildException e) {
++				// TODO Auto-generated catch block
++				e.printStackTrace();
++			}
++
++		}
++
++		return doc;
++	}
++
++	/**
++	 * Manipulates the document structure, so that "reference" elements are
++	 * replaced by the corresponding "parametergroup".
++	 *
++	 * @param doc
++	 * @return
++	 */
++	public static Document resolveReferences(Document doc) {
++
++		final NodeList references = doc.getElementsByTagName("reference");
++		final NodeList parametergroups = doc.getElementsByTagName("parametergroup");
++
++		while (references.getLength() != 0) {
++
++			final Element referenceElement = (Element) references.item(0);
++
++			final Element parent = (Element) referenceElement.getParentNode();
++
++			parent.removeChild(referenceElement);
++
++			for (int i = 0; i < parametergroups.getLength(); i++) {
++
++				final Node parametergroupElement = parametergroups.item(i);
++
++				if (((Element) parametergroupElement).getAttribute("name")
++						.equals(referenceElement.getAttribute("name"))) {
++					final NodeList children = parametergroupElement
++							.getChildNodes();
++
++					for (int j = 0; j < children.getLength(); j++) {
++						final Node clone = children.item(j).cloneNode(true);
++						parent.appendChild(clone);
++					}
++				}
++			}
++		}
++
++		while (parametergroups.getLength() != 0) {
++			parametergroups.item(0).getParentNode()
++					.removeChild(parametergroups.item(0));
++		}
++
++		return doc;
++	}
++
++
++	/**
++	 * @brief  The funciton expects a Node element as argument and transform the XML
++	 *         (sub)tree starting with the given Node into a string
++	 * @return A string representing the (sub)tree starting with node
++	 * @author Thomas Egger
++	 */
++	public static String getString(Node node){
++		String str = "";
++
++		try {
++			Transformer transformer = TransformerFactory.newInstance().newTransformer();
++			StringWriter buffer = new StringWriter();
++			transformer.transform(new DOMSource(node), new StreamResult(buffer));
++			str = buffer.toString();
++		} catch (Exception ex) {
++			throw new RuntimeException("Error converting to String", ex);
++		}
++
++		return str;
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/main/XMLHelper.java
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/main/GUI.java
+===================================================================
+--- ../trunk-jpl/src/java/src/main/GUI.java	(revision 0)
++++ ../trunk-jpl/src/java/src/main/GUI.java	(revision 17722)
+@@ -0,0 +1,548 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell is free software: you can redistribute it and/or modify
++*   it under the terms of the GNU General Public License as published by
++*   the Free Software Foundation, either version 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell is distributed in the hope that it will be useful,
++*   but WITHOUT ANY WARRANTY; without even the implied warranty of
++*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++*   GNU General Public License for more details.
++*
++*   You should have received a copy of the GNU General Public License
++*   along with INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package main;
++
++import gui_elements.ControlledPanel;
++import gui_elements.GUIBuildException;
++
++import java.awt.BorderLayout;
++import java.awt.Color;
++import java.awt.Component;
++import java.awt.Container;
++import java.awt.Desktop;
++import java.awt.*;
++import java.awt.event.ActionEvent;
++import java.awt.event.ActionListener;
++import java.awt.event.WindowEvent;
++import java.awt.event.WindowListener;
++import java.io.IOException;
++import java.net.URISyntaxException;
++import java.util.HashMap;
++import java.util.LinkedList;
++
++import javax.swing.BoxLayout;
++import javax.swing.ImageIcon;
++import javax.swing.JButton;
++import javax.swing.JEditorPane;
++import javax.swing.JFileChooser;
++import javax.swing.JFrame;
++import javax.swing.JOptionPane;
++import javax.swing.JPanel;
++import javax.swing.JScrollPane;
++import javax.swing.JTabbedPane;
++import javax.swing.JToolBar;
++import javax.swing.event.HyperlinkEvent;
++import javax.swing.event.HyperlinkListener;
++import javax.swing.filechooser.FileNameExtensionFilter;
++import java.io.*;
++import javax.swing.*;
++import java.awt.*;
++import java.awt.event.*;
++
++import net.miginfocom.swing.MigLayout;
++
++/**
++ * The GUI created by the author.
++ *
++ * @author korhammer et egger
++ *
++ */
++public class GUI extends JFrame implements WindowListener, ActionListener, HyperlinkListener {
++
++	/**
++	 *
++	 */
++	private static final long serialVersionUID = -2428732881181670225L;
++	public static PanelNode rootNode = null;
++
++	private static String title = GUI.class.getPackage().getImplementationTitle() + " " + GUI.class.getPackage().getImplementationVersion();
++
++	public static final Color LABEL_COLOR = Color.decode("#000080");
++	public static Color NORMAL_BACKGROUND_COLOR = Color.decode("#EEEEEE");
++	public static Color WARNING_BACKGROUND_COLOR = Color.decode("#FF0011");
++
++	public static ImageIcon openicon = new ImageIcon(GUI.class.getClassLoader().getResource("resources/icons/xml_open.png"));
++	public static ImageIcon openiniicon = new ImageIcon(GUI.class.getClassLoader().getResource("resources/icons/fileopen.png"));
++	public static ImageIcon exporticon = new ImageIcon(GUI.class.getClassLoader().getResource("resources/icons/filesave.png"));
++	public static ImageIcon previewicon = new ImageIcon(GUI.class.getClassLoader().getResource("resources/icons/kghostview.png"));
++	public static ImageIcon reseticon = new ImageIcon(GUI.class.getClassLoader().getResource("resources/icons/reset.png"));
++
++	private final JButton createbutton;
++	private final JButton previewButton;
++	private final JButton openbutton;
++	private final JButton openinibutton;
++	private final JButton resetbutton;
++
++	private final JTabbedPane tabpane;
++	private final JToolBar toolbar;
++	private HashMap<String,JPanel> tabpanels;
++
++	private String configFilePath, iniFilePath;
++
++	/*
++	 * Creates a window with the static components of the GUI, i.e. components
++	 * that do not depend on the configuration file.
++	 */
++	public GUI() throws GUIBuildException {
++		super(title);
++
++		configFilePath = System.getProperty("user.dir");
++		iniFilePath = System.getProperty("user.dir");
++
++		tabpanels = new HashMap<String,JPanel>();
++
++		Dimension screenDim = new Dimension(1280, 800);
++		Dimension maxDim = null;
++
++		if (this.getMaximizedBounds() == null) {
++			Toolkit tk = Toolkit.getDefaultToolkit();
++			maxDim = tk.getScreenSize();
++			this.setMaximizedBounds(new Rectangle(0, 0, (int)maxDim.getWidth(), (int)maxDim.getHeight()));
++		} else {
++			maxDim = this.getMaximizedBounds().getSize();
++		}
++
++		if (maxDim.height < screenDim.height) {
++			screenDim.height = maxDim.height;
++			if (screenDim.height > 100)
++				screenDim.height -= 25;
++		}
++
++		if (maxDim.width < screenDim.width) {
++			screenDim.width = maxDim.width;
++			if (screenDim.width > 100)
++				screenDim.width -= 25;
++		}
++
++		this.setSize(screenDim);
++		//this.setExtendedState(MAXIMIZED_BOTH);
++		this.setVisible(true);
++		this.setLayout(new BorderLayout());
++
++		this.toolbar = new JToolBar();
++		toolbar.setLayout(new BoxLayout(toolbar, 1));
++		toolbar.setFloatable(false);
++		this.setVisible(true);
++		this.add(toolbar, BorderLayout.WEST);
++
++		this.tabpane = new JTabbedPane();
++		this.add(tabpane);
++		tabpane.setVisible(true);
++
++		this.openbutton = new JButton(openicon);
++		this.openbutton.setActionCommand("open config");
++		this.openbutton.setToolTipText("Open XML-configuration");
++		openbutton.addActionListener(this);
++		toolbar.add(this.openbutton);
++
++		this.openinibutton = new JButton(openiniicon);
++		this.openinibutton.setActionCommand("open ini");
++		this.openinibutton.setToolTipText("Open existing INI file");
++		openinibutton.addActionListener(this);
++		toolbar.add(this.openinibutton);
++
++		this.resetbutton = new JButton(reseticon);
++		this.resetbutton.setActionCommand("reset");
++		this.resetbutton.setToolTipText("Reset Interface");
++		resetbutton.addActionListener(this);
++		toolbar.add(this.resetbutton);
++
++		this.createbutton = new JButton(exporticon);
++		this.createbutton.setActionCommand("write config");
++		this.createbutton.setToolTipText("Write to INI-file");
++		createbutton.addActionListener(this);
++		toolbar.add(this.createbutton);
++
++		this.previewButton = new JButton(previewicon);
++		this.previewButton.setActionCommand("preview");
++		this.previewButton.setToolTipText("Preview INI-file");
++		previewButton.addActionListener(this);
++		toolbar.add(previewButton);
++
++		this.addWindowListener(this);
++
++		rootNode = new PanelNode("");
++	}
++
++	/**
++	 * Writes the application name into the GUI window title bar.
++	 *
++	 * @param application
++	 */
++	public void setApplicationForTitle(String application){
++		if(application.equals("")){
++			this.setTitle(title);
++		}
++		else{
++			this.setTitle(title + " for "+application);
++		}
++	}
++
++	public void hideOpenButton(){
++		openbutton.setVisible(false);
++	}
++
++	/**
++	 * Closes all tabs.
++	 */
++	public void closeAllTabs(){
++		tabpane.removeAll();
++	}
++
++	/**
++	 * Adds a component to the tab specified and creates the tab if it does not
++	 * already exist.
++	 *
++	 * @param comp
++	 * @param tabName
++	 * @throws GUIBuildException
++	 */
++	public void addToTab(ControlledPanel comp, String tabName, ControlledPanel parentPanel) throws GUIBuildException {
++		tabName = Character.toUpperCase(tabName.charAt(0)) + tabName.substring(1).toLowerCase();
++
++		String section = ((ControlledPanel)comp).getSection().toUpperCase();
++		String key = section + "::" + ((ControlledPanel)comp).getKey();//((ControlledPanel)comp).getHashKey();
++		//System.out.println("\tPanel: " + ((ControlledPanel)comp).getHashKey() + "   Section: " + ((ControlledPanel)comp).getSection());
++
++		PanelNode sectionNode = rootNode.getChild(section);
++		if (sectionNode == null) {
++			PanelNode tmp = new PanelNode(section);
++			//System.out.println("\t--Adding section '" + section + "' to tree");
++			sectionNode = rootNode.add(tmp);
++		}
++
++		if (parentPanel != null) {
++			//System.out.println("\tLooking for node: " + parentPanel.getHashKey());
++			sectionNode = sectionNode.get(parentPanel.getSection().toUpperCase() + "::" + parentPanel.getKey());
++		}
++
++		if (sectionNode != null) {
++			PanelNode keyNode = sectionNode.get(key);
++			if (keyNode == null) {
++				PanelNode tmp = new PanelNode(key);
++				keyNode = sectionNode.add(tmp);
++				//System.out.println("\t--Adding key '" + key + "' to tree as leaf to " + sectionNode.getData());
++			}
++		}
++
++		JPanel tab;
++		if (tabpane.indexOfTab(tabName) == -1) {
++
++			tab = new JPanel();
++			tab.setBackground(Color.white);
++			tab.setVisible(true);
++			tab.setLayout(new MigLayout("wrap 1"));
++
++			JScrollPane scrollpane = new JScrollPane(tab);
++			tabpane.add(tabName, scrollpane);
++			tabpanels.put(tabName, tab);
++
++		} else {
++			tab = tabpanels.get(tabName);
++		}
++
++		if (parentPanel != null && containsPanel(tab, parentPanel)) {
++			parentPanel.add(comp, "span");
++		} else {
++			tab.add(comp);
++		}
++
++		//JViewport jv = ((JScrollPane)tabpane.getComponentAt(tabpane.indexOfTab(tabName))).getViewport();
++		//jv.setViewPosition(new Point(0,0));
++
++		this.validate();
++	}
++
++	public void removeFromTab(ControlledPanel parameterPanel, String section, ControlledPanel parentPanel) {
++		final String tabTitle = section.substring(0, 1).toUpperCase() + section.substring(1).toLowerCase();
++		final int index = tabpane.indexOfTab(tabTitle);
++
++		final Container container = (Container) tabpane.getComponentAt(index);
++
++		//System.out.println("Removing Panel: " + parameterPanel.getHashKey());
++		PanelNode tmp = rootNode.get(parameterPanel.getSection().toUpperCase() + "::" + parameterPanel.getKey());
++		tmp.getParent().remove(tmp);
++
++		if (parentPanel != null && containsPanel(container, parentPanel)) {
++			parentPanel.remove(parameterPanel);
++		} else {
++			container.remove(parameterPanel);
++		}
++
++		GUIBuilder.panelControl.remove(section, parameterPanel.getKey());
++
++		container.repaint();
++		this.validate();
++	}
++
++	public boolean containsPanel(Container container, JPanel panel) {
++
++		for (final Component component : container.getComponents()) {
++			if (component == panel)
++				return true;
++			if (containsPanel((Container) component, panel))
++				return true;
++		}
++		return false;
++	}
++
++	@Override
++	public void actionPerformed(ActionEvent e) {
++		if (e.getActionCommand().equals("write config") && GUIBuilder.application!=null ) {
++			GUIBuilder.panelControl.setRootNode(rootNode);
++
++			try {
++				GUIBuilder.printIOFile();
++			} catch (final IOException e1) {
++				// TODO Auto-generated catch block
++				e1.printStackTrace();
++			} catch (final GUIBuildException e2) {
++				// TODO Auto-generated catch block
++				e2.printStackTrace();
++			}
++		} else if (e.getActionCommand().equals("preview") && GUIBuilder.application!=null) {
++			GUIBuilder.panelControl.setRootNode(rootNode);
++			previewINIFile();
++		} else if (e.getActionCommand().equals("reset") && GUIBuilder.application!=null) {
++			resetGUI();
++		} else if( (e.getActionCommand().equals("open config"))) {
++			openFile();
++		} else if( (e.getActionCommand().equals("open ini"))) {
++			openINIFile();
++		}
++	}
++
++	public void resetGUI() {
++		try {
++			int returnval = GUIBuilder.closeFile();
++			if (returnval == JOptionPane.CANCEL_OPTION) return;
++			GUIBuilder.buildGUI(GUIBuilder.currentConfigFile);
++		} catch (GUIBuildException e) {
++			e.printStackTrace();
++		}
++	}
++
++	public void previewINIFile(){
++		JFrame frame = new JFrame();
++		frame.setSize(600,800);
++		frame.setVisible(true);
++		//frame.setLayout(new BorderLayout());
++
++		JEditorPane pane = new JEditorPane();
++
++		pane.setText(GUIBuilder.panelControl.toString());
++		pane.setVisible(true);
++		pane.setEditable(false);
++
++		JScrollPane scrollPane = new JScrollPane(pane);
++		scrollPane.setVisible(true);
++		frame.add(scrollPane);
++
++		frame.validate();
++		frame.repaint();
++	}
++
++	public void openINIFile(){
++		final FileNameExtensionFilter inifilter = new FileNameExtensionFilter(".ini files", "ini");
++		final JFileChooser filechooser = new JFileChooser(iniFilePath);
++		filechooser.setFileFilter(inifilter);
++		final int returnval = filechooser.showOpenDialog(new JPanel());
++
++		HashMap<String, String> hm = new HashMap<String, String>();
++		HashMap<String, String> comments = new HashMap<String, String>();
++		HashMap<String, String> added_comments = new HashMap<String, String>();
++
++		if (returnval == JFileChooser.APPROVE_OPTION) {
++			final String path = filechooser.getSelectedFile().toString();
++			if (filechooser.getSelectedFile().isDirectory()) return;
++
++			iniFilePath = filechooser.getSelectedFile().getParent();
++
++			System.out.println("Opening INI file: " + path);
++
++			try {
++				BufferedReader br = new BufferedReader(new FileReader(path));
++				String line;
++
++				String section = "GENERAL::";
++				String clines = "";
++
++				while((line = br.readLine()) != null) {
++					int offset = line.indexOf(";");
++					int offset2 = line.indexOf("#");
++
++					if ((offset2 != -1) && (offset != -1)) {
++						if (offset2 < offset) offset = offset2;
++					} else if ((offset2 != -1) && (offset == -1)) {
++						offset = offset2;
++					}
++
++					String comment = null;
++				     //System.out.println("CLINES" + clines);
++					if (offset != -1) {
++						//System.out.println("COMMENT: " + line.substring(offset));
++						comment = line.substring(offset);
++					} else {
++						//System.out.println("COMMENTLESS");
++					}
++
++					if (-1 != offset) line = line.substring(0, offset);
++
++					offset = line.indexOf("#");
++					if (-1 != offset) line = line.substring(0, offset);
++
++					line = line.trim(); //take away ws
++
++					if (line.length()>1) {
++
++						if (line.charAt(0) == '[') {
++							offset = line.indexOf("]");
++							if ((offset == -1) || (offset <= 1)) continue;
++
++							if (!clines.equals("")) {
++								int lbr = clines.indexOf("\n");
++								clines = clines.substring(0, lbr);
++								//System.out.println("Adding the precomment: " + clines);
++								comments.put(section, clines);
++								clines = "";
++							}
++
++							section = line.substring(1, offset).toUpperCase() + "::";
++							//System.out.println("New Section: " + section);
++
++						} else {
++							String[] tokens = line.split("=");
++							if (tokens.length == 2) {
++								String key = tokens[0].trim();
++								String value = tokens[1].trim();
++								if (key.length() > 0) {
++									hm.put(section + key.toUpperCase(), value);
++									if (comment != null) added_comments.put(section + key.toUpperCase(), comment);
++									if (!clines.equals("")) {
++										//System.out.println("Adding the precomment: " + clines);
++										comments.put(section + key.toUpperCase(), clines);
++										clines = "";
++									}
++								}
++							}
++						}
++
++						//System.out.println(line);
++					} else {
++						//it was a comment line only, associate it with the next key
++						if (comment != null) clines += comment;
++						clines += "\n";
++					}
++				}
++				br.close();
++
++				GUIBuilder.setValues(hm, added_comments, comments);
++			} catch (Exception e) {
++					// TODO Auto-generated catch block
++					e.printStackTrace();
++			}
++		}
++	}
++
++	public void openFile(){
++		/* If a configuration is already open, ask for close. */
++		final FileNameExtensionFilter xmlfilter = new FileNameExtensionFilter(".xml files", "xml");
++		final JFileChooser filechooser = new JFileChooser(configFilePath);
++		filechooser.setFileFilter(xmlfilter);
++		final int returnval = filechooser.showOpenDialog(new JPanel());
++		if (returnval == JFileChooser.APPROVE_OPTION) {
++			if(GUIBuilder.application != null){
++				final int returnval2 = GUIBuilder.closeFile();
++				if (returnval2 == JOptionPane.CANCEL_OPTION) return;
++			}
++
++			final String path = filechooser.getSelectedFile().toString();
++			if (filechooser.getSelectedFile().isDirectory()) return;
++
++			configFilePath = filechooser.getSelectedFile().getParent();
++
++			try {
++				GUIBuilder.buildGUI(path);
++			} catch (GUIBuildException e) {
++				// TODO Auto-generated catch block
++				e.printStackTrace();
++			}
++		}
++	}
++
++	@Override
++	public void windowActivated(WindowEvent e) {
++		// TODO Auto-generated method stub
++
++	}
++
++	@Override
++	public void windowClosed(WindowEvent e) {
++		// TODO Auto-generated method stub
++
++	}
++
++	@Override
++	public void windowClosing(WindowEvent e) {
++		System.exit(NORMAL);
++
++	}
++
++	@Override
++	public void windowDeactivated(WindowEvent e) {
++		// TODO Auto-generated method stub
++
++	}
++
++	@Override
++	public void windowDeiconified(WindowEvent e) {
++		// TODO Auto-generated method stub
++
++	}
++
++	@Override
++	public void windowIconified(WindowEvent e) {
++		// TODO Auto-generated method stub
++
++	}
++
++	@Override
++	public void windowOpened(WindowEvent e) {
++		// TODO Auto-generated method stub
++
++	}
++
++	@Override
++	public void hyperlinkUpdate(HyperlinkEvent e) {
++
++		if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
++		      try {
++				Desktop.getDesktop().browse(e.getURL().toURI());
++			} catch (IOException e1) {
++				// TODO Auto-generated catch block
++				e1.printStackTrace();
++			} catch (URISyntaxException e1) {
++				// TODO Auto-generated catch block
++				e1.printStackTrace();
++			}
++		}
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/main/GUI.java
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/main/PanelNode.java
+===================================================================
+--- ../trunk-jpl/src/java/src/main/PanelNode.java	(revision 0)
++++ ../trunk-jpl/src/java/src/main/PanelNode.java	(revision 17722)
+@@ -0,0 +1,69 @@
++package main;
++
++import java.util.List;
++import java.util.LinkedList;
++
++public class PanelNode {
++	private String data;
++	private PanelNode parent;
++	private LinkedList<PanelNode> children = new LinkedList<PanelNode>();
++
++	public PanelNode(String indata) {
++		data = indata;
++		parent = null;
++	}
++
++	public PanelNode(PanelNode p) {
++		data = p.data;
++		parent = p.parent;
++		children = new LinkedList<PanelNode>(p.children);
++	}
++
++	public String getData() {
++		return data;
++	}
++
++	public PanelNode getChild(String data) {
++		for (PanelNode child : children) {
++			if (child.data.equals(data))
++				return child;
++		}
++
++		return null;
++	}
++
++	public PanelNode add(PanelNode c) {
++		c.parent = this;
++		children.add(c);
++
++		return children.getLast();
++	}
++
++	public PanelNode get(String searchstring) {
++		if (data.equals(searchstring)) return this;
++
++		for (PanelNode child : children) {
++			PanelNode tmp = child.get(searchstring);
++			if (tmp != null) return tmp;
++		}
++
++		return null; //Nothing found in subtree
++	}
++
++	public boolean remove(PanelNode tmp) {
++		return children.remove(tmp);
++	}
++
++	public PanelNode getParent() {
++		return parent;
++	}
++
++	public void getKeyList(LinkedList<String> keyList) {
++		if ((data.indexOf('#') == -1) && (data.indexOf('%') == -1))
++			keyList.add(data);
++
++		for (PanelNode child : children) {
++			child.getKeyList(keyList);
++		}
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/main/PanelNode.java
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/main/GUIBuilder.java
+===================================================================
+--- ../trunk-jpl/src/java/src/main/GUIBuilder.java	(revision 0)
++++ ../trunk-jpl/src/java/src/main/GUIBuilder.java	(revision 17722)
+@@ -0,0 +1,391 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell is free software: you can redistribute it and/or modify
++*   it under the terms of the GNU General Public License as published by
++*   the Free Software Foundation, either version 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell is distributed in the hope that it will be useful,
++*   but WITHOUT ANY WARRANTY; without even the implied warranty of
++*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++*   GNU General Public License for more details.
++*
++*   You should have received a copy of the GNU General Public License
++*   along with INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package main;
++
++import gui_elements.ControlledPanel;
++import gui_elements.GUIBuildException;
++
++import java.io.IOException;
++
++import javax.swing.ProgressMonitor;
++import javax.swing.JFileChooser;
++import javax.swing.JOptionPane;
++import javax.swing.JPanel;
++import javax.swing.filechooser.FileNameExtensionFilter;
++
++import java.util.*;
++
++import org.w3c.dom.Document;
++import org.w3c.dom.Element;
++
++/**
++ * The main class to build the .ini file creator. Upon construction it reads an
++ * XML file and creates the corresponding GUI. Maintains an ElementControl
++ * object.
++ *
++ * @author korhammer et egger
++ *
++ */
++public class GUIBuilder {
++	public static ProgressMonitor monitor;
++
++	public static final String xsd = GUIBuilder.class.getClassLoader().getResource("resources/config_schema-0.1.1.xsd").toString();
++	public static String res_filepath = GUIBuilder.class.getClassLoader().getResource("resources/default_config.xml").toString(); //the default config to start with
++	public static Document doc;
++
++	public static GUI gui;
++	public static PanelControl panelControl;
++
++	public static String application;
++	public static String currentConfigFile;
++
++	public static String saveFilePath = System.getProperty("user.dir");
++
++
++	private static String getFileExtension(final String file_and_path) {
++		final String file_sep = System.getProperty("file.separator");
++
++		// get filename without path
++		final int fileSepIndex = file_and_path.lastIndexOf(file_sep);
++		if (fileSepIndex == -1) {
++			return "";
++		}
++		final String filename = file_and_path.substring(fileSepIndex+1); //remove path
++
++		// get the extension from the filename
++		final int extIndex = filename.lastIndexOf(".");
++		if (extIndex == -1)
++			return "";
++
++		return filename.substring(extIndex+1);
++	}
++
++	/**
++	 * The main method. Opens the GUI Builder with a menu bar on the side.
++	 * If an XML filepath is handed over as an argument,
++	 * the XML file is opened.
++	 *
++	 * @param args
++	 * @throws GUIBuildException
++	 */
++	public static void main(String args[]) throws GUIBuildException {
++
++		new GUIBuilder();
++
++		if ((args.length != 0) && (args[0].length() > 0))
++			res_filepath = args[0]; //User may provice xml file as first argument
++
++		buildGUI(res_filepath);
++		//gui.hideOpenButton();
++	}
++
++	/**
++	 * Builds a GUI from the XML-file specified with validation through
++	 * the specified schema.
++	 *
++	 * @param filepath
++	 * @param schemapath
++	 * @throws GUIBuildException
++	 */
++	public GUIBuilder()	throws GUIBuildException {
++		if (System.getProperty("mrj.version") != null) {  //detect if running on mac
++			System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Inishell");
++			System.setProperty("apple.awt.brushMetalLook", "true");
++		}
++		gui = new GUI();
++	}
++
++	public static void setComments(HashMap<String, String> added_comments, HashMap<String, String> comments) {
++		panelControl.setComments(added_comments, comments);
++	}
++
++	/**
++	 * Builds the gui for a filepath that can either be handed over as an argument
++	 * on application start or chosen by using the open button.
++	 *
++	 * @param filepath
++	 * @throws GUIBuildException
++	 */
++	public static void buildGUI(String filepath) throws GUIBuildException{
++		currentConfigFile = filepath;
++
++		doc = XMLHelper.readXML(filepath, xsd);
++		doc = XMLHelper.resolveReferences(doc);
++
++		application = doc.getDocumentElement().getAttribute("application");
++
++		gui.setApplicationForTitle(application);
++
++		panelControl = new PanelControl();
++
++		final Element root = doc.getDocumentElement();
++		recursiveBuild(root, null, false);
++	}
++
++
++	public static void setValues(final HashMap<String, String> hm, final HashMap<String, String> added_comments, final HashMap<String, String> comments) {
++		if (hm == null) return;
++
++		monitor = new ProgressMonitor(gui, "Loading INI file", "0 out of " + panelControl.order.size() + " sections loaded", 0, panelControl.order.size());
++		monitor.setMillisToPopup(0);
++
++		Thread myrunner = new Thread() {
++				public void run() {
++					int progress_counter = 0; //Effectively counts the sections already parsed into the GUI
++					try {
++						final int returnval = GUIBuilder.closeFile();
++						if (returnval == JOptionPane.CANCEL_OPTION) return;
++						monitor.setProgress(progress_counter);
++
++						GUIBuilder.buildGUI(currentConfigFile);
++					} catch (GUIBuildException e) {
++						e.printStackTrace();
++					}
++
++					gui.setEnabled(false); //Disable user interaction while the ProgressMonitor is on
++
++					HashSet<String> usedKeys = new HashSet<String>(); //save all keys that were used from the HashMap
++					HashSet<String> unusedKeys = new HashSet<String>(); //save all keys that were used from the HashMap
++
++					Iterator<Map.Entry<String, TreeMap<String, ControlledPanel>>> sectionIterator = panelControl.panels.entrySet().iterator();
++					while (sectionIterator.hasNext()) {
++						progress_counter++;
++						monitor.setProgress(progress_counter);
++						monitor.setNote(progress_counter + " out of " + panelControl.order.size() + " sections loaded");
++
++						if (monitor.isCanceled()) { //user cancelled loading
++							monitor.close();
++							gui.setEnabled(true);
++							break; //HACK, should reset the whole environment before breaking
++						}
++
++						Map.Entry<String, TreeMap<String, ControlledPanel>> entry = sectionIterator.next();
++						TreeMap<String, ControlledPanel> value = entry.getValue();
++
++						List<String> sectionKeys = new ArrayList<String>(hm.keySet()); //all keys as defined in the existing ini
++						String sectionKey = entry.getKey().toUpperCase() + "::"; //The section string
++						filterList(sectionKey, sectionKeys); //filter keys for current section only (optimization)
++
++						LinkedList<ControlledPanel> todos = new LinkedList<ControlledPanel>();
++						LinkedList<String> keys = new LinkedList<String>();
++						LinkedList<String> values = new LinkedList<String>();
++
++						do {
++							todos.clear();
++							keys.clear();
++							values.clear();
++
++							Iterator<Map.Entry<String, ControlledPanel>> keyIterator = value.entrySet().iterator();
++							while(keyIterator.hasNext()) { //go through all keys of current section
++								final ControlledPanel mypanel = keyIterator.next().getValue();
++								//System.out.println("\t" + mypanel.getKey());
++
++								String pattern = mypanel.getHashKey();
++								pattern = pattern.replace("%","[a-zA-Z0-9_]+");
++								pattern = pattern.replace("#","[1-9]+[0-9]*"); //all integer numbers from 1 to infinity
++								//System.out.println("Current pattern: " + pattern);
++
++								//Loop through all defined keys of this section and compare them with pattern
++								Iterator<String> keyit = sectionKeys.iterator();
++								while (keyit.hasNext()) {
++									final String currkey = keyit.next();
++									//System.out.println("sectionKeys contains: " + currkey);
++
++									if ((!usedKeys.contains(currkey)) && currkey.matches(pattern)) {
++										//Add mypanel to list of todos
++										//System.out.println("Adding panel for " + currkey);
++										todos.add(mypanel);
++										keys.add(currkey);
++										values.add(hm.get(currkey));
++
++										usedKeys.add(currkey);
++									}
++								}
++							}
++
++							for (int jj = 0; jj < todos.size(); jj++) {
++								//System.out.println("--> SETTING " + keys.get(jj) + "  = " +values.get(jj));
++								todos.get(jj).set(hm, keys.get(jj), values.get(jj));
++							}
++						} while (todos.size() != 0);
++
++						if (progress_counter == panelControl.order.size()) gui.setEnabled(true);
++					}
++
++					//Now find out all keys that were not used in the hashmap
++					for (String key : hm.keySet()) {
++						if (!usedKeys.contains(key)) {
++							//System.out.println("Unknown key = " + key);
++							unusedKeys.add(key);
++							panelControl.setUnusedKeys(key, hm.get(key));
++						}
++					}
++
++					setComments(added_comments, comments);
++				}
++			};//thread
++		myrunner.start();
++	}
++
++	private static void filterList(String filter, List<String> list) {
++		for (Iterator<String> it=list.iterator(); it.hasNext();) {
++			final String next = it.next();
++			if (!next.startsWith(filter)) {
++				it.remove();
++			}
++		}
++	}
++
++	public static int closeFile(){
++		final int returnval = JOptionPane.showConfirmDialog(new JPanel(),
++				"You will lose all changes made to the current ini-file. " +
++				"Do you want this?", "Inishell is already open for " + application, JOptionPane.OK_CANCEL_OPTION);
++
++
++
++		if (returnval == JOptionPane.OK_OPTION) {
++			gui.closeAllTabs();
++			gui.rootNode = new PanelNode("");
++			application = null;
++			doc = null;
++			panelControl = null;
++		}
++
++		return returnval;
++	}
++
++
++	/**
++	 * Puts the specified panel into the panel control.
++	 * @param panel
++	 */
++	public static void control(ControlledPanel panel) {
++		final String section = panel.getSection();
++		panelControl.put(section, panel);
++	}
++
++
++	/**
++	 * Recursively traverses all children of the specified element
++	 * and builds the corresponding panels.
++	 *
++	 * @param parentElement
++	 * @param parentPanel
++	 * @throws GUIBuildException
++	 */
++	public static void recursiveBuild(Element parentElement, ControlledPanel parentPanel, boolean doSet) throws GUIBuildException {
++		recursiveBuild(parentElement, parentPanel, doSet, null, null, null);
++	}
++
++
++	public static void recursiveBuild(Element parentElement, ControlledPanel parentPanel, boolean doSet, HashMap hm, String key, String value) throws GUIBuildException {
++
++		/* get all child elements for the root */
++		final String[] tags = {"parameter", "frame"};
++		final Element[] parameterElements = XMLHelper.getElementArray(parentElement, tags);
++
++		for (final Element element : parameterElements) {
++			final String section = element.getAttribute("section");
++			ControlledPanel parameterPanel;
++
++			if (!panelControl.contains(section, element.getAttribute("key"))) {
++				//System.out.println("Adding through recursiveBuild: " + element.getAttribute("key"));
++				parameterPanel = ControlledPanel.createSingleParameterPanel(element, parentPanel);
++				parameterPanel.setKey(parameterPanel.getKey());
++
++				if (!element.getAttribute("template").equals("true")) {
++					//if (doSet) System.out.println("\tSETTING component key: " + key + "  value: " + value);
++					if (doSet) parameterPanel.set(hm, parameterPanel.getKey(), value);
++
++					gui.addToTab(parameterPanel, section, parentPanel);
++					control(parameterPanel);
++				}
++			} else {
++				parameterPanel = panelControl.get(section, element.getAttribute("key"));
++			}
++
++			parameterPanel.hold();
++			recursiveBuild(element, parameterPanel, doSet);
++		}
++
++		gui.validate();
++	}
++
++	/**
++	 * Recursively destructs child elements of the specified root.
++	 *
++	 * @param rootElement
++	 * @param rootPanel
++	 * @throws GUIBuildException
++	 */
++	public static void recursiveDestruct(Element rootElement, ControlledPanel rootPanel)
++		throws GUIBuildException {
++
++		/* get all child elements for the root */
++		final Element[] parameterElements = XMLHelper.getElementArray(rootElement, "parameter");
++
++		for (final Element element : parameterElements) {
++			final String section = element.getAttribute("section");
++			final ControlledPanel parameterPanel = panelControl.get(section, element.getAttribute("key"));
++			recursiveDestruct(element, parameterPanel);
++
++			parameterPanel.release();
++			parameterPanel.close();
++
++			if (!parameterPanel.isNeeded()) {
++				gui.removeFromTab(parameterPanel, section, rootPanel);
++			}
++
++		}
++
++		gui.validate();
++	}
++
++
++	/**
++	 * Opens a prompt for the path to save the ini file to. Then prints the ini
++	 * to the path specified.
++	 *
++	 * @throws IOException
++	 * @throws GUIBuildException
++	 */
++	public static void printIOFile() throws IOException, GUIBuildException {
++		final FileNameExtensionFilter inifilter = new FileNameExtensionFilter(".ini files", "ini");
++
++		final JFileChooser filechooser = new JFileChooser(saveFilePath);
++		filechooser.setFileFilter(inifilter);
++
++		final int returnval = filechooser.showSaveDialog(new JPanel());
++
++		if (returnval == JFileChooser.APPROVE_OPTION) {
++			String path = filechooser.getSelectedFile().getAbsolutePath();
++			final String ext = getFileExtension(path).toLowerCase();
++			if(!ext.equals("ini")) {
++				path += ".ini";
++			}
++
++			if (filechooser.getSelectedFile().isDirectory()) return;
++			saveFilePath = filechooser.getSelectedFile().getParent();
++
++			panelControl.printToFile(path);
++		}
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/main/GUIBuilder.java
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/resources/document-open-2.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/src/resources/document-open-2.png
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/resources/document-preview.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/src/resources/document-preview.png
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/resources/document-export-4.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/src/resources/document-export-4.png
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/resources/config_schema.xsd
+===================================================================
+--- ../trunk-jpl/src/java/src/resources/config_schema.xsd	(revision 0)
++++ ../trunk-jpl/src/java/src/resources/config_schema.xsd	(revision 17722)
+@@ -0,0 +1,141 @@
++<?xml version="1.0"?>
++<!-- 
++*   
++*	This file is part of INIshell.
++*
++*   INIshell is free software: you can redistribute it and/or modify
++*   it under the terms of the GNU General Public License as published by
++*   the Free Software Foundation, either version 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell is distributed in the hope that it will be useful,
++*   but WITHOUT ANY WARRANTY; without even the implied warranty of
++*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++*   GNU General Public License for more details.
++*
++*   You should have received a copy of the GNU General Public License
++*   along with INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*    	
++* -->
++
++<xsd:schema version="1.0"
++xmlns:xsd="http://www.w3.org/2001/XMLSchema">
++
++  <xsd:element name="inishell_config" type="general" />
++  
++	<xsd:complexType name="general">
++      <xsd:choice maxOccurs="unbounded">
++			<xsd:element name="parameter" type="parametertype" />
++			<xsd:element name="parametergroup" type="pargroup" />
++			<xsd:element name="include" type="pathonly" /> 
++      </xsd:choice>
++	  <xsd:attribute name="application" />
++    </xsd:complexType>
++	
++	<xsd:complexType name="parametertype">
++		<xsd:complexContent>
++			<xsd:extension base="parbasetype">
++				<xsd:attribute name="key" type="xsd:string" use="required"/> 
++				<xsd:attribute name="default" type="xsd:string" />
++				<xsd:attribute name="counter" type="xsd:integer" />
++			</xsd:extension>
++		</xsd:complexContent>		
++	</xsd:complexType>
++   
++   <xsd:complexType name="nameonly">
++		<xsd:attribute name="name" />   
++   </xsd:complexType>
++   
++   <xsd:complexType name="pathonly">
++		<xsd:attribute name="path" />   
++   </xsd:complexType>
++   
++	<xsd:complexType name="pargroup">
++		<xsd:choice minOccurs="1" maxOccurs="unbounded">
++			<xsd:element name="parameter" type="parametertype" />
++			<xsd:element name="reference" type="nameonly" />
++		</xsd:choice>
++		<xsd:attribute name="name" />
++	</xsd:complexType>
++  
++	
++	<xsd:complexType name="parbasetype">
++		<xsd:sequence>
++			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
++				<xsd:element name="section" type="nameonly"/>
++			</xsd:sequence>
++			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
++				<xsd:element name="replace" type="nameonly"/>
++			</xsd:sequence>
++			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
++				<xsd:element name="parameter" type="parametertype" />
++			</xsd:sequence>
++			<xsd:choice minOccurs="0" maxOccurs="unbounded">				
++				<xsd:element name="option" minOccurs="0">
++					<xsd:complexType>
++						<xsd:complexContent>
++							<xsd:extension base="parbasetype">
++								<xsd:attribute name="value" type="xsd:string" use="required" />
++								<xsd:attribute name="label" type="xsd:string" use="optional" />
++								<xsd:attribute name="default" type="xsd:boolean"/>
++							</xsd:extension>
++						</xsd:complexContent>
++					</xsd:complexType>
++				</xsd:element>
++			</xsd:choice>
++			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
++				<xsd:element name="reference" type="nameonly" />
++			</xsd:sequence>
++			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
++				<xsd:element name="help" type="helptype"/>	
++			</xsd:sequence>
++		</xsd:sequence>
++		
++		<xsd:attribute name="type" use="required">
++		     <xsd:simpleType>
++				<xsd:restriction base="xsd:string">
++					<xsd:enumeration value="integer" />
++					<xsd:enumeration value="integer+" />
++					<xsd:enumeration value="decimal" />
++					<xsd:enumeration value="path" />
++					<xsd:enumeration value="file" />
++					<xsd:enumeration value="choice" />
++					<xsd:enumeration value="alternative" />
++					<xsd:enumeration value="string" />
++					<xsd:enumeration value="combination" />
++					<xsd:enumeration value="selector" />
++				</xsd:restriction>
++			</xsd:simpleType>
++		</xsd:attribute>
++		
++		<xsd:attribute name="maximum" type="xsd:integer"/>
++		<xsd:attribute name="minimum" type="xsd:integer"/>
++		<xsd:attribute name="template" type="xsd:boolean" default="false" use="optional" />
++		<xsd:attribute name="optional" type="xsd:boolean" default="true" />
++	</xsd:complexType>
++	
++	<xsd:complexType name="needstype">
++		<xsd:attribute name="type" type="xsd:string" use="required" />
++		<xsd:attribute name="name" type="xsd:string" use="required" />
++	
++		<xsd:attribute name="value" />
++		<xsd:attribute name="optional" type="xsd:boolean" />
++		<xsd:attribute name="minoccur" type="xsd:integer" />
++		<xsd:attribute name="maxoccur" type="xsd:string" />
++	</xsd:complexType>
++	
++	<xsd:complexType name="baseType">
++		<xsd:sequence minOccurs="0" maxOccurs="1">
++			<xsd:element name="help" type="helptype" />		
++		</xsd:sequence>
++		<xsd:attribute name="key" type="xsd:string" use="required" />
++	</xsd:complexType>
++	
++	<xsd:complexType name="helptype" mixed="true">
++		<xsd:choice minOccurs="0" maxOccurs="unbounded">
++			<xsd:element name="section" type="nameonly" />
++			<xsd:element name="replace" type="nameonly" />
++		</xsd:choice>
++	</xsd:complexType>
++	
++</xsd:schema>
+
+Property changes on: ../trunk-jpl/src/java/src/resources/config_schema.xsd
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/resources/default_config.xml
+===================================================================
+--- ../trunk-jpl/src/java/src/resources/default_config.xml	(revision 0)
++++ ../trunk-jpl/src/java/src/resources/default_config.xml	(revision 17722)
+@@ -0,0 +1,919 @@
++<inishell_config application="Meteo IO">
++
++	<!-- General Parameters -->
++	<parameter key="BUFF_CHUNK_SIZE" type="integer" default="30">
++		<section name="general" />
++		<help>Size in days of a chunk of data to read at once.</help>
++	</parameter>
++
++	<parameter key="BUFF_BEFORE" type="decimal" default="1.5">
++		<section name="general" />
++		<help>Alternate way of buffer centering: When rebuffering, the new date will be located BUFF_BEFORE days from the
++		beginning of the buffer (therefore, it takes a value in days).</help>
++	</parameter>
++
++	<!-- Coordinate systems, time zones -->
++	<parameter key="COORDSYS" type="alternative" optional="false">
++		<section name="input" />
++		<section name="output" />
++		<option value="CH1903" type="string" default="true">
++			<help>coordinates in the Swiss Grid &lt;a href="http://geomatics.ladetto.ch/ch1903_wgs84_de.pdf"&gt;http://geomatics.ladetto.ch/ch1903_wgs84_de.pdf&lt;/a&gt;</help>
++		</option>
++		<option value="UTM" type="string">
++			<parameter key="COORDPARAM" type="string">
++				<help>specify the zone with the zone letter (for example, 32T)</help>
++			</parameter>
++			<help>UTM coordinates, see &lt;a href="http://www.oc.nps.edu/oc2902w/maps/utmups.pdf"&gt;http://www.oc.nps.edu/oc2902w/maps/utmups.pdf&lt;/a&gt;</help>
++		</option>
++		<option value="UPS" type="string">
++			<parameter key="COORDPARAM" type="string">
++				<help>specify the hemisphere (either N or S)</help>
++			</parameter>
++			<help>Universal Polar Stereographic coordinates, see &lt;a href="https://en.wikipedia.org/wiki/Universal_Polar_Stereographic_coordinate_system"&gt;https://en.wikipedia.org/wiki/Universal_Polar_Stereographic_coordinate_system&lt;/a&gt;</help>
++		</option>
++		<option value="PROJ4" type="string">
++			<parameter key="COORDPARAM" type="string" optional="false" />
++			<help>external library: see &lt;a href="http://trac.osgeo.org/proj/"&gt;http://trac.osgeo.org/proj/&lt;/a&gt;</help>
++		</option>
++		<option value="LOCAL"  type="string">
++			<help>uses the horizontal and vertical distance from a reference point</help>
++		</option>
++		<help>coordinate system</help>
++	</parameter>
++
++	<parameter key="TIME_ZONE" type="integer+" default="+1" maximum="14" minimum="-12" optional="false">
++		<section name="input" />
++		<section name="output" />
++	</parameter>
++
++	<!-- Datatypes: special pts -->
++	<parameter key="SPECIALPTS" type="alternative">
++		<section name="input" />
++		<option value="A3D" type="string">
++			<parameter key="SPECIALPTSFILE" type="file" optional="false">
++				<help>a path+file name to the a file containing grid coordinates of special points of interest (for special outputs)</help>
++			</parameter>
++		</option>
++		<option value="SMET" type="string">
++			<parameter key="SPECIALPTSFILE" type="file" optional="false">
++				<help>a path+file name to the a file containing grid coordinates of special points of interest (for special outputs)</help>
++			</parameter>
++		</option>
++	</parameter>
++
++	<!-- Datatypes: Meteo Data -->
++	<parameter key="METEO" type="alternative">
++		<section name="input" />
++		<section name="output" />
++
++		<option value="A3D" type="string">
++			<parameter key="METEOPATH" type="path" optional="false">
++				<help>string containing the path to the meteorological files</help>
++			</parameter>
++		</option>
++		<option value="BORMA" type="string">
++			<section name="input" />
++			<reference name="BORMA" />
++		</option>
++		<option value="COSMO" type="string">
++			<parameter key="METEOPATH" type="path" optional="false">
++				<help>string containing the path to the meteorological files</help>
++			</parameter>
++		</option>
++		<option value="GEOTOP" type="string">
++			<section name="input" />
++			<reference name="GEOTOP_IN" />
++		</option>
++		<option value="GEOTOP" type="string">
++			<section name="output" />
++			<reference name="GEOTOP_OUT" />
++		</option>
++		<option value="GRIB" type="string">
++			<section name="input" />
++			<reference name="GRIB_METEO" />
++		</option>
++		<option value="GSN" type="string">
++			<section name="input" />
++			<reference name="GSN" />
++		</option>
++		<option value="IMIS" type="string">
++			<section name="input" />
++			<reference name="IMIS" />
++		</option>
++		<option value="SMET" type="string">
++			<section name="input" />
++			<reference name="SMET_IN" />
++		</option>
++		<option value="SMET" type="string">
++			<section name="output" />
++			<reference name="SMET_OUT" />
++		</option>
++		<option value="SNOWPACK" type="string">
++			<section name="input" />
++			<reference name="SNIO_IN" />
++		</option>
++		<option value="SNOWPACK" type="string">
++			<section name="output" />
++			<parameter key="METEOPATH" type="path" optional="false">
++				<help>string representing path where SNOWPACK files should be saved</help>
++			</parameter>
++		</option>
++
++		<help>plugin for METEO data </help>
++	</parameter>
++
++	<parameter key="Add Meteo parameter copy" type="selector">
++		<section name="input"/>
++		<parameter key="COPY::%" type="string" optional="false" template="true">
++		  <help>The name of the parameter to copy (e.g. TA, RH, VW, ISWR, etc)</help>
++		</parameter>
++	</parameter>
++
++	<!-- Datatypes: DEM -->
++	<frame key="dem_frame" label="Digital Elevation Model">
++	<section name="input"/>
++		<parameter key="DEM" type="alternative">
++			<section name="input" />
++			<option value="ARC" type="string">
++				<parameter key="DEMFILE" type="file" optional="false">
++					<help>For reading the data as a DEMObject</help>
++				</parameter>
++			</option>
++			<option value="ARPS" type="string">
++				<parameter key="DEMFILE" type="file" optional="false">
++					<help>For reading the data as a DEMObject</help>
++				</parameter>
++				<parameter key="ARPS_XCOORD" type="decimal" optional="false">
++					<help>x coordinate of the lower left corner of the grids</help>
++				</parameter>
++				<parameter key="ARPS_YCOORD" type="decimal" optional="false">
++					<help>y coordinate of the lower left corner of the grids</help>
++				</parameter>
++			</option>
++			<option value="GRASS" type="string">
++				<parameter key="DEMFILE" type="file" optional="false">
++					<help>For reading the data as a DEMObject</help>
++				</parameter>
++			</option>
++			<option value="GRIB" type="string">
++				<parameter key="DEMFILE" type="file" optional="false">
++					<help>For reading the data as a DEMObject</help>
++				</parameter>
++				<parameter key="GRIB_DEM_UPDATE" type="alternative" optional="true">
++					<option value="TRUE" type="string" />
++					<option value="FALSE" type="string" />
++					<help>recompute slope/azimuth from the elevations when reading a DEM (default=false, that is we use the slope and azimuth included in the GRIB file)</help>
++				</parameter>
++			</option>
++			<option value="PGM" type="string">
++				<parameter key="DEMFILE" type="file" optional="false">
++					<help>For reading the data as a DEMObject</help>
++				</parameter>
++				<reference name="PGM_IN" />
++			</option>
++
++			<help>plugin for Digital Elevation Model data </help>
++		</parameter>
++	</frame>
++
++	<!-- Datatypes: Landuse -->
++	<parameter key="LANDUSE" type="alternative">
++		<section name="input" />
++		<option value="ARC" type="string">
++			<parameter key="LANDUSEFILE" type="file" optional="false">
++				<help>File containing a grid of landuse codes</help>
++			</parameter>
++		</option>
++
++		<help>plugin for land cover data </help>
++	</parameter>
++
++	<!-- Datatypes: Grids -->
++	<parameter key="GRID2D" type="alternative">
++		<section name="input" />
++		<section name="output" />
++		<option value="ARC" type="string">
++			<parameter key="GRID2DPATH" type="path" optional="false">
++				<help>string representing path where grid files should be read from</help>
++			</parameter>
++			<reference name="ARC" />
++		</option>
++		<option value="ARPS" type="string">
++			<section name="input" />
++			<parameter key="GRID2DPATH" type="path" optional="false">
++				<help>string representing path where grid files should be read from</help>
++			</parameter>
++			<reference name="ARPS" />
++		</option>
++		<option value="GRASS" type="string">
++			<section name="input" />
++			<parameter key="GRID2DPATH" type="path" optional="false">
++				<help>string representing path where grid files should be read from</help>
++			</parameter>
++		</option>
++		<option value="GRIB" type="string">
++			<section name="input" />
++			<parameter key="GRID2DPATH" type="path" optional="false">
++				<help>string representing path where grid files should be read from</help>
++			</parameter>
++			<reference name="GRIB_GRIDS" />
++		</option>
++		<option value="PGM" type="string">
++			<section name="input" />
++			<parameter key="GRID2DPATH" type="path" optional="false">
++				<help>string representing path where grid files should be read from</help>
++			</parameter>
++			<reference name="PGM_IN" />
++		</option>
++		<option value="PGM" type="string">
++			<section name="output" />
++			<parameter key="GRID2DPATH" type="path" optional="false">
++				<help>string representing path where grid files should be read from</help>
++			</parameter>
++		</option>
++		<option value="PNG" type="string">
++			<section name="output" />
++			<parameter key="GRID2DPATH" type="path" optional="false">
++				<help>string representing path where grid files should be read from</help>
++			</parameter>
++			<reference name="PNG" />
++		</option>
++		<help>plugin for 2D gridded data </help>
++	</parameter>
++
++	<!--Parameter group for list of stations -->
++	<parametergroup name="stationgroup_files">
++		<parameter key="STATION#" type="file" counter="1" optional="false">
++			<help>filename for station number # </help>
++		</parameter>
++	</parametergroup>
++	<parametergroup name="stationgroup_names">
++		<parameter key="STATION#" type="string" counter="1" optional="false">
++			<help>station id for the given station number # </help>
++		</parameter>
++	</parametergroup>
++	<parametergroup name="stationgroup_pos">
++		<parameter key="STATION#" type="string" counter="1">
++			<help>Coordinates are given as "lat lon" or "xcoord ycoord epsg_code"</help>
++		</parameter>
++	</parametergroup>
++
++	<!-- Plugins for Meteo Data-->
++	<parametergroup name="BORMA">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the xml files</help>
++		</parameter>
++		<reference name="stationgroup_names" />
++	</parametergroup>
++
++	<parametergroup name="IMIS">
++		<parameter key="DBNAME" type="string" optional="false">
++			<help>database name, as provided by your database administrator</help>
++		</parameter>
++		<parameter key="DBUSER" type="string" optional="false">
++			<help>database user name</help>
++		</parameter>
++		<parameter key="DBPASS" type="string" optional="false">
++			<help>database password associated with the user name</help>
++		</parameter>
++		<parameter key="USEANETZ" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>OPTIONAL: use ANETZ stations to provide precipitations for normal IMIS stations.
++		  Each IMIS station is associated with one or two ANETZ stations and does a weighted
++		  average to get what should be its local precipitations</help>
++		</parameter>
++		<parameter key="USE_IMIS_HNW" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>OPTIONAL: if set to false (default), all IMIS precipitation will be deleted (since IMIS stations don't have heated rain gauges, their precipitation measurements are not good in winter conditions). If set to true, it is strongly advised to use a FilterHNWMelt filter to detect snow melting in the rain gauge and perform winter conditions detection in the application.</help>
++		</parameter>
++		<parameter key="USE_SNOWPACK_HNW" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>if set to true, the SNOWPACK simulated Snow Water Equivalent from the database will be used to compute HNW. Data gaps greater than 3 hours on SWE will lead to unchanged hnw while all data that can properly be computed will overwrite hnw. (default=false)</help>
++		</parameter>
++
++		<reference name="stationgroup_names" />
++	</parametergroup>
++
++	<parametergroup name="GRIB_METEO">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the grib files</help>
++		</parameter>
++		<parameter key="METEOEXT" type="string" optional="true">
++			<help>grib file extension, or none for no file extension (default: .grb)</help>
++		</parameter>
++
++		<reference name="stationgroup_pos" />
++	</parametergroup>
++
++	<parametergroup name="GEOTOP_IN">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the data files</help>
++		</parameter>
++		<parameter key="METAFILE" type="file" optional="false">
++			<help>absolute filename of the geotop.inpts file</help>
++		</parameter>
++		<parameter key="METEOPREFIX" type="string" optional="true">
++			<help>prefix to append when generating a file name for reading</help>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="GEOTOP_OUT">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the data files</help>
++		</parameter>
++		<parameter key="METEOSEQ" type="string" optional="false">
++			<help>specifiy in which order the columns should be printed out</help>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="GSN">
++		<parameter key="ENDPOINT" type="string" optional="false">
++			<help>webserver running GSN with its port number and full path. For example:
++			http://montblanc.slf.ch:22001/services/A3DWebService</help>
++		</parameter>
++		<parameter key="PROXY" type="string" optional="true">
++			<help>Should the connection go through a proxy? This is useful for servers
++			filtering on domains but usually not necessary.</help>
++		</parameter>
++		<parameter key="PROXYPORT" type="string" optional="true" />
++		<parameter key="PROXYUSER" type="string" optional="true" />
++		<parameter key="PROXYPASS" type="string" optional="true" />
++
++		<reference name="stationgroup_names" />
++	</parametergroup>
++
++	<parametergroup name="SMET_IN">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the smet files</help>
++		</parameter>
++		<reference name="stationgroup_files" />
++	</parametergroup>
++
++	<parametergroup name="SMET_OUT">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string representing path where SMET files should be saved</help>
++		</parameter>
++		<parameter key="METEOPARAM" type="alternative">
++		  <option value="ASCII" type="string" default="true">
++		    <help>Write ASCII SMET files</help>
++		  </option>
++		  <option value="BINARY" type="string">
++		    <help>Write BINARY SMET files</help>
++		  </option>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="SNIO_IN">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the SNOWPACK files</help>
++		</parameter>
++		<parameter key="METAFILE" type="file" optional="true">
++			<help>filename of the meta data file (in METEOPATH)</help>
++		</parameter>
++
++		<parameter key="NUMBER_MEAS_TEMPERATURES" type="integer+" minimum="0" default="0">
++		  <help>the number of measured snow temperatures provided</help>
++		</parameter>
++
++		<parameter key="NUMBER_OF_SOLUTES" type="integer+" minimum="0" default="0">
++		  <help>the number of solutes for which input data are provided</help>
++		</parameter>
++
++		<parameter key="RSWR_INP" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		</parameter>
++		<parameter key="ISWR_INP" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		</parameter>
++		<parameter key="VW_DRIFT" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>OPTIONAL: wind velocity to use for blowing and drifting snow is provided</help>
++		</parameter>
++		<parameter key="RHO_HN" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>OPTIONAL: measured new snow density is provided</help>
++		</parameter>
++
++		<reference name="stationgroup_files" />
++	</parametergroup>
++
++	<!-- Plugins for Gridded Data-->
++	<parametergroup name="ARC">
++		<parameter key="A3D_VIEW" type="alternative" optional="true">
++			<option value="TRUE" type="string" />
++			<option value="FALSE" type="string" />
++			<help>generate names compatible with Alpine3D's grid viewer?</help>
++		</parameter>
++		<parameter key="GRID2DEXT" type="string" optional="true">
++			<help>grid file extension, or none for no file extension (default: .asc)</help>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="ARPS">
++		<parameter key="ARPS_XCOORD" type="decimal" optional="false">
++			<help>x coordinate of the lower left corner of the grids</help>
++		</parameter>
++		<parameter key="ARPS_YCOORD" type="decimal" optional="false">
++			<help>y coordinate of the lower left corner of the grids</help>
++		</parameter>
++		<parameter key="GRID2DEXT" type="string" optional="true">
++			<help>grid file extension, or none for no file extension (default: .asc)</help>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="GRIB_GRIDS">
++		<parameter key="GRID2DPREFIX" type="string" optional="true">
++			<help>prefix to append when generating a file name for reading (ie: something like "laf" for Cosmo-Analysis-full domain)</help>
++		</parameter>
++		<parameter key="GRID2DEXT" type="string" optional="true">
++			<help>grib file extension, or none for no file extension (default: .grb)</help>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="PNG">
++		<parameter key="PNG_WORLD_FILE" type="alternative" optional="true">
++			<option value="TRUE" type="string" />
++			<option value="FALSE" type="string" />
++			<help>generate a world file for each output file? This file contains the geolocalization information</help>
++		</parameter>
++		<parameter key="PNG_LEGEND" type="alternative" optional="true">
++			<option value="TRUE" type="string" />
++			<option value="FALSE" type="string" />
++			<help>generate a legend?</help>
++		</parameter>
++		<parameter key="PNG_AUTOSCALE" type="alternative" optional="true">
++			<option value="TRUE" type="string" />
++			<option value="FALSE" type="string" />
++			<help>autoscale color scale?</help>
++		</parameter>
++		<parameter key="PNG_SCALING" type="alternative" optional="true">
++			<option value="nearest" type="string" />
++			<option value="bilinear" type="string" />
++			<help>scaling algorithm (default=bilinear)</help>
++		</parameter>
++		<parameter key="PNG_MIN_SIZE" type="string" optional="false">
++			<help>minimum dimensions of the PNG, like 640x480</help>
++		</parameter>
++		<parameter key="PNG_MAX_SIZE" type="string" optional="false">
++			<help>maximum dimensions of the PNG, like 1024x768</help>
++		</parameter>
++		<parameter key="PNG_INDEXED" type="alternative" optional="true">
++			<option value="TRUE" type="string" />
++			<option value="FALSE" type="string" />
++			<help>generate a color indexed file (default=true)</help>
++		</parameter>
++		<parameter key="PNG_SPEED_OPTIMIZE" type="alternative" optional="true">
++			<option value="TRUE" type="string" />
++			<option value="FALSE" type="string" />
++			<help>optimize for speed (default=false)</help>
++		</parameter>
++		<parameter key="PNG_NR_LEVELS" type="integer+" default="+30" maximum="255" minimum="6" optional="true">
++			<help>number of colors in the palette (default=30)</help>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="PGM_IN">
++		<parameter key="PGM_XCOORD" type="decimal" optional="false">
++			<help>lower left x coordinate</help>
++		</parameter>
++		<parameter key="PGM_YCOORD" type="decimal" optional="false">
++			<help>lower left y coordinate</help>
++		</parameter>
++		<parameter key="PGM_CELLSIZE" type="decimal" optional="false">
++			<help>cellsize in meters</help>
++		</parameter>
++		<parameter key="PGM_MIN" type="decimal" optional="false">
++			<help>minimum value in real world coordinates to match with the minimum value read out of the PGM file (such minimum being greater than 0 because 0 is NODATA)</help>
++		</parameter>
++		<parameter key="PGM_MAX" type="decimal" optional="false">
++			<help>maximum value in real world coordinates to match with the maximum value read out of the PGM file</help>
++		</parameter>
++	</parametergroup>
++
++	<!-- Meteo Parameters for Filters, resampling, spatial interpolations-->
++	<parametergroup name="METEOIOPARAMETERS">
++		<option value="TA"/>
++		<option value="RH"/>
++		<option value="VW"/>
++		<option value="DW"/>
++		<option value="VW_MAX"/>
++		<option value="ISWR"/>
++		<option value="RSWR"/>
++		<option value="ILWR"/>
++		<option value="HS"/>
++		<option value="HNW"/>
++		<option value="TSG"/>
++		<option value="TSS"/>
++		<option value="P"/>
++	</parametergroup>
++
++	<!-- Filters -->
++	<parameter key="Add/Remove Filter" type="selector">
++		<section name="filters" />
++
++		<parameter key="%::filter#" type="alternative" counter="1" template="true">
++			<section name="filters" />
++
++			<option label="MeanAvg" value="mean_avg" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Mean average processing. The mean average filter returns the mean value of all values within a user given time window.</help>
++			</option>
++
++			<option label="MedianAvg" value="median_avg" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="decimal" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Median average processing. The median average filter returns the median value of all values within a user given time window.</help>
++			</option>
++
++			<option label="Std Deviation Filter" value="std_dev" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Standard deviation filter. Values outside of mean ± 2 std_dev are rejected.</help>
++			</option>
++
++			<option label="MAD" value="mad" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Median Absolute Deviation. Values outside of median ± 3 σ_MAD are rejected. &lt;br&gt;
++			  See http://en.wikipedia.org/wiki/Median_absolute_deviation for more information.</help>
++			</option>
++
++			<option label="Tukey 53H Filter" value="Tukey" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      The keyword "soft" maybe added, if the window position is allowed to be adjusted to the data present.
++			      The two arguments may be preceded by the keywords "left", "center" or "right", indicating the window position.
++			    </help>
++			  </parameter>
++			  <help>Tukey 53H method A smooth time sequence is generated from the median, substracted from the original signal and
++			  compared with the standard deviation. see "Despiking Acoustic Doppler Velocimeter Data", Derek G. Goring and Vladimir
++			  L. Nikora, Journal of Hydraulic Engineering, 128, 1, 2002 The deviation factor coeffecient is currently hard-coded as k=1.5. </help>
++			</option>
++
++			<option label="Wind Averaging Filter" value="wind_avg" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Wind vector averaging. This calculates the vector average over a user given time period. Each wind vector
++			  within this period is added and the final sum is normalized by the number of vectors that have been added. </help>
++			</option>
++
++			<option label="Exponential Smoothing" value="exp_smoothing" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <option label="alpha:" value="0.8" type="decimal" minimum="0" maximum="1"/>
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			      Alpha needs to be provided as last argument. Please note that the standard filter works with a left window!
++			    </help>
++			  </parameter>
++			  <help>Exponential smooting processing, exponential moving average s_0 = x_0 s_n = alpha*x_(t-1) + (1-alpha)*s_t-1</help>
++			</option>
++
++			<option label="Weighted Moving Average Smoothing" value="wma_smoothing" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			      Please note that the standard filter works with a left window!
++			    </help>
++			  </parameter>
++			  <help>Weighted moving average smoothing such as: WMA = (1*X1 + 2*X2 + ... + n*Xn) / sum_of_weights</help>
++			</option>
++
++			<option label="Min Range Filter" value="min" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option label="Min:" value="" type="decimal" />
++			    <option label="Adjust to:" value="" type="decimal" />
++			    <help>The keyword "soft" maybe added, in such a case all data smaller than the min would be
++			    assigned the minimum permissible value or another value given as an extra argument</help>
++			  </parameter>
++			  <help>Min range filter. Reject all values smaller than the min.</help>
++			</option>
++
++			<option label="Max Range Filter" value="max" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option label="Max:" value="" type="decimal" />
++			    <option label="Adjust to:" value="" type="decimal" />
++			    <help>The keyword "soft" maybe added, in such a case all data greater than the max would be
++			    assigned the maximum permissible value or another value given as an extra argument</help>
++			  </parameter>
++			  <help>Max range filter. Reject all values greater than the max.</help>
++			</option>
++
++			<option label="MinMax (2 or 4 arguments)" value="min_max" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option label="Min:" value="" type="decimal" />
++			    <option label="Max:" value="" type="decimal" />
++			    <option label="Min adjust to:" value="" type="decimal" />
++			    <option label="Max adjust to:" value="" type="decimal" />
++			    <help>The keyword "soft" maybe added, in such a case all data greater than the max would be assigned
++			    the maximum permissible value and all data smaller than the min would be assigned the minimum
++			    permissible value or an optional extra set of two user provided values</help>
++			  </parameter>
++			  <help>Reject all values greater than the max or smaller than the min. &lt;br&gt;</help>
++			</option>
++
++			<option label="Rate Filter (1 argument)" value="rate" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option label="Max:" value="1.0" type="decimal" minimum="0" maximum="1" />
++			    <help>the absolute value of the maximum permissible rate of change (per seconds)</help>
++			  </parameter>
++			  <help>Rate of change filter. Calculate the change rate (ie: slope) between two points, if it is above a user given value, reject the point.</help>
++			</option>
++
++			<option label="Rate Filter (2 arguments)" value="rate" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option label="Min:" value="0.0" type="decimal" minimum="0" maximum="1" />
++			    <option label="Max:" value="1.0" type="decimal" minimum="0" maximum="1" />
++			    <help>the minimum and maximum permissible rate of change (per second)</help>
++			  </parameter>
++			  <help>Rate of change filter. Calculate the change rate (ie: slope) between two points, if it is above a user given value, reject the point.</help>
++			</option>
++
++			<option label="Unheated Rain Gauge Filter" value="Unheated_RainGauge" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option label="RH threshold:" value="0.5" type="decimal" minimum="0" maximum="1" />
++			    <option label="Delta_T threshold:" value="3.0" type="decimal" minimum="0" maximum="20" />
++			  </parameter>
++			  <help>Filters out snow melting in an unheated rain gauge. This filter can ONLY be applied to precipitation. Non-zero measurements are accepted only if they take place when the relative humidity is greater than RH_threshold and (TA-TSS) smaller than Delta_T_threshold, otherwise they get reset to 0. If none of these conditions could be tested (for lack of data), then the precipitation is reset to nodata (or left unchanged if "soft" has been selected).</help>
++			</option>
++
++			<option label="WMO Undercatch Filter" value="undercatch_wmo" type="string">
++			  <parameter key="%::arg#" type="combination">
++				<option value="Gage type" type="dropdown">
++					<option value="Nipher" type="string" />
++					<option value="Tretyakov" type="string" />
++					<option value="US8sh" type="string" />
++					<option value="US8unsh" type="string" />
++					<option value="Hellmann" type="string" />
++					<option value="Hellmannsh" type="string" />
++				</option>
++			  </parameter>
++			  <help>This implements the standard methods for precipitation correction as described in "WMO Solid Precipitation Measurement Intercomparison", B. Goodison, P. Louie and D. Yang, 872, 1998 as well as the overview given by "Literature Study on the Correction of Precipitation Measurements", Annette Wagner, 2009. The correction parameters for the shielded Hellmann gauge (German version) are from "Wind-induced Precipitation Undercatch of the Hellmann Gauges", Daqing Yang et al, Nordic Hydrology, 30, 1999, pp 57-80.</help>
++			</option>
++
++			<option label="WMO Undercatch Filter - simplified" value="undercatch_wmo" type="string">
++			  <parameter key="%::arg#" type="combination">
++				<option value="Kind" type="dropdown">
++					<option value="Cst" type="string" />
++				</option>
++				<option label="Snow factor:" value="1.3" type="decimal" minimum="0" maximum="5" />
++				<option label="Mixed prec factor:" value="1.1" type="decimal" minimum="0" maximum="5" />
++			  </parameter>
++			  <help>This applies a constant correction factor to the precipitation, one for pure snow and one for mixed precipitation. The following thresholds are used: pure snow below -2 C; mixed precipitation between -2 and +2 C; pure rain above 2 C. These threshold can be changed (see online documentation).</help>
++			</option>
++
++			<option label="Unventillated temperature sensor" value="Unventilated_T" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option label="albedo:" value="0.23" type="decimal" />
++			    <option value="soft" type="choice" />
++			    <help>If the "soft" option is given, the albedo has a value different according to snow (or no snow) on the ground</help>
++			  </parameter>
++			  <help>This implements the correction described in (Reina Nakamura, 2005) with an albedo dependency as introduced in (Huwald, 2009)</help>
++			</option>
++
++			<option label="Add an offset" value="add" type="string">
++			  <parameter key="%::arg#" type="combination">
++				<option label="offset:" value="0." type="decimal" />
++			  </parameter>
++			  <help>This adds a given offset to the data.</help>
++			</option>
++
++			<option label="Multiply by a factor" value="mult" type="string">
++			  <parameter key="%::arg#" type="combination">
++				<option label="factor:" value="1." type="decimal" />
++			  </parameter>
++			  <help>This multiplies the data by a given factor.</help>
++			</option>
++
++		</parameter>
++
++		<reference name="METEOIOPARAMETERS" />
++	</parameter>
++
++	<!-- 1D Interpolation -->
++	<parameter key="WINDOW_SIZE" type="integer+" minimum="1" default="43200">
++		<section name="Interpolations1D" />
++		<help>Affects resampling: expresses (in seconds) how far a valid point can be
++		searched for when re-interpolating a missing value</help>
++	</parameter>
++
++	<parameter key="Add/Remove 1D Interpolation" type="selector">
++		<section name="Interpolations1D" />
++
++		<parameter key="%::resample" type="alternative" template="true">
++			<section name="Interpolations1D" />
++			<option label="No Interpolation" value="none" type="string" />
++			<option label="Nearest Neighbour" value="nearest_neighbour" type="string" />
++			<option label="Linear" value="linear" type="string">
++			  <parameter key="%::args" type="combination">
++			    <option value="extrapolate" type="choice" />
++			    <help>
++			      If "extrapolate" is added, then data *outside* of the original date range can be interpolated.
++			      Otherwise, a data point will only be calculated between the original date range.
++			    </help>
++			  </parameter>
++			  <help>Mean average processing. The mean average filter returns the mean value of all values within a user given time window.</help>
++			</option>
++			<option label="Accumulate" value="accumulate" type="string">
++			  <parameter key="%::args" type="combination">
++			    <option value="strict" type="choice" />
++			    <option label="Seconds:" value="900" type="integer" minimum="1" />
++			    <help>Accumulation period (in seconds). This must usually match the model time step. if enabling "strict", nodatas will propagate (ie. a single nodata in the input will force the re-accumulated value to be nodata). Otherwise, all valid values are aggregated and only pure nodata intervals produce a nodata in the output.</help>
++			  </parameter>
++			  <help>Accumulation over a user given period (filter argument, in seconds -
++			  should coincide with your calculation step!).</help>
++			</option>
++		</parameter>
++
++		<reference name="METEOIOPARAMETERS" />
++	</parameter>
++
++	<!-- 2D Interpolation -->
++	<parameter key="Add/Remove 2D Interpolation" type="selector">
++		<section name="Interpolations2D" />
++
++		<parameter key="%::algorithms" type="choice" template="true">
++			<section name="Interpolations2D" />
++			<option value="STD_PRESS" type="choice">
++				<help>Generate a standard atmosphere pressure as a function of the cell's elevation</help>
++			</option>
++			<option value="CST" type="choice">
++				<help>Fill the grid with the average over all the stations</help>
++			</option>
++			<option value="CST_LAPSE" type="choice">
++			  <parameter key="%::cst_lapse" type="combination">
++			    <option label="Lapse Rate:" value="0.008" type="decimal" optional="false" />
++			    <option value="" type="dropdown">
++			      <option value="" type="string" />
++			      <option value="soft" type="string" />
++			      <option value="frac" type="string" />
++			    </option>
++			  </parameter>
++			  <help>Detrend the measured data, fill the grid with the average over all the stations, reapply the elevation trend</help>
++			</option>
++			<option value="IDW" type="choice">
++				<help>Inverse Distance Weighted average</help>
++			</option>
++			<option value="IDW_LAPSE" type="choice">
++			  <parameter key="%::idw_lapse" type="combination">
++			    <option label="Lapse Rate:" value="0.008" type="decimal" optional="false" />
++			    <option value="" type="dropdown">
++			      <option value="" type="string" />
++			      <option value="soft" type="string" />
++			      <option value="frac" type="string" />
++			    </option>
++			  </parameter>
++			  <help>Detrend the measured data, apply Inverse Distance Weighted average, reapply elevation trend</help>
++			</option>
++			<option value="LIDW_LAPSE" type="choice">
++			  <parameter key="%::lidw_lapse" type="combination">
++			    <option label="Lapse Rate:" value="0.008" type="decimal" optional="false" />
++			    <option value="" type="dropdown">
++			      <option value="" type="string" />
++			      <option value="soft" type="string" />
++			      <option value="frac" type="string" />
++			    </option>
++			  </parameter>
++			  <help>Same as IDW_LAPSE, but only considering a given number of neighboring stations</help>
++			</option>
++			<option value="RH" type="choice">
++				<help>Computes the dew point temperature, distribute it with IDW_LAPSE, recompute RH at each pixel</help>
++			</option>
++			<option value="ILWR" type="choice">
++				<help>Compute emissivity, distribute it with IDW_LAPSE, recompute ILWR at each pixel</help>
++			</option>
++			<option value="WIND_CURV" type="choice">
++				<help>Distribute wind velocity with IDW_LAPSE, then apply correction factors as a function of local slope and curvature</help>
++			</option>
++			<option value="HNW_SNOW" type="choice">
++				<parameter key="%::hnw_snow" type="combination">
++				<option value="IDW_LAPSE" type="dropdown">
++					<option value="CST" type="string" />
++					<option value="CST_LAPSE" type="string" />
++					<option value="IDW" type="string" />
++					<option value="IDW_LAPSE" type="string" />
++					<option value="ODKRIG" type="string" />
++				</option>
++				<help>Base algorithm (do not forget to add the options for the base algorithm)</help>
++				</parameter>
++				<help>Distribute precipitation with a base algorithm (IDW_LAPSE by default), then reduce/remove precipitation on
++				steep slopes and correct with the local curvature. This is to simulate snow redistribution processes.</help>
++			</option>
++			<option value="USER" type="choice">
++			  <parameter key="%::user" type="path" optional="false"/>
++			  <help>User provided grids, named as {numeric date}_{capitalized meteo parameter}.asc</help>
++			</option>
++			<option value="ODKRIG" type="choice">
++			  <parameter key="%::odkrig" type="combination">
++			  	<option value="" type="dropdown">
++					<option value="LINVARIO" type="string" />
++					<option value="EXPVARIO" type="string" />
++					<option value="SPHERICVARIO" type="string" />
++					<option value="RATQUADVARIO" type="string" />
++				</option>
++				<help>Variogram model</help>
++			  </parameter>
++			  <help>Ordinary kriging (EXPERIMENTAL)</help>
++			</option>
++		</parameter>
++
++		<reference name="METEOIOPARAMETERS" />
++	</parameter>
++</inishell_config>
+\ No newline at end of file
+
+Property changes on: ../trunk-jpl/src/java/src/resources/default_config.xml
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/resources/icons/file_ops.xcf
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/src/resources/icons/file_ops.xcf
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/resources/icons/filesave.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/src/resources/icons/filesave.png
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/resources/icons/viewmag.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/src/resources/icons/viewmag.png
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/resources/icons/ini_open.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/src/resources/icons/ini_open.png
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/resources/icons/fileopen.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/src/resources/icons/fileopen.png
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/resources/icons/xml_open.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/src/resources/icons/xml_open.png
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/resources/icons/filesaveas.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/src/resources/icons/filesaveas.png
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/resources/icons/opensettings.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/src/resources/icons/opensettings.png
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/resources/icons/reset.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/src/resources/icons/reset.png
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/resources/icons/advancedsettings.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/src/resources/icons/advancedsettings.png
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/resources/icons/mydocuments.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/src/resources/icons/mydocuments.png
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/resources/icons/readme.txt
+===================================================================
+--- ../trunk-jpl/src/java/src/resources/icons/readme.txt	(revision 0)
++++ ../trunk-jpl/src/java/src/resources/icons/readme.txt	(revision 17722)
+@@ -0,0 +1,10 @@
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++This copyright and license notice covers the images in this directory.
++************************************************************************
++
++TITLE:	Crystal Project Icons
++AUTHOR:	Everaldo Coelho
++SITE:	http://www.everaldo.com
++CONTACT: everaldo@everaldo.com
++
++Copyright (c)  2006-2007  Everaldo Coelho.
+
+Property changes on: ../trunk-jpl/src/java/src/resources/icons/readme.txt
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/resources/icons/kghostview.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: ../trunk-jpl/src/java/src/resources/icons/kghostview.png
+___________________________________________________________________
+Name: svn:mime-type
+   + application/octet-stream
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/src/resources/config_schema-0.1.1.xsd
+===================================================================
+--- ../trunk-jpl/src/java/src/resources/config_schema-0.1.1.xsd	(revision 0)
++++ ../trunk-jpl/src/java/src/resources/config_schema-0.1.1.xsd	(revision 17722)
+@@ -0,0 +1,154 @@
++<?xml version="1.0"?>
++<!-- 
++*   
++*	This file is part of INIshell.
++*
++*   INIshell is free software: you can redistribute it and/or modify
++*   it under the terms of the GNU General Public License as published by
++*   the Free Software Foundation, either version 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell is distributed in the hope that it will be useful,
++*   but WITHOUT ANY WARRANTY; without even the implied warranty of
++*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++*   GNU General Public License for more details.
++*
++*   You should have received a copy of the GNU General Public License
++*   along with INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*    	
++* -->
++<xsd:schema version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
++  <xsd:element name="inishell_config" type="general" />
++  
++  <xsd:complexType name="general">
++    <xsd:choice maxOccurs="unbounded">
++      <xsd:element name="parameter" type="parametertype" />
++      <xsd:element name="parametergroup" type="pargroup" />
++      <xsd:element name="include" type="pathonly" /> 
++      <xsd:element name="frame" type="framegroup" /> 
++    </xsd:choice>
++    <xsd:attribute name="application" />
++  </xsd:complexType>
++
++  <xsd:complexType name="framegroup">
++    <xsd:choice minOccurs="1" maxOccurs="unbounded">
++      <xsd:element name="parameter" type="parametertype" />
++      <xsd:element name="reference" type="nameonly" />
++      <xsd:element name="section" type="nameonly"/>
++    </xsd:choice>
++    <xsd:attribute name="key" />
++    <xsd:attribute name="label" />
++  </xsd:complexType>
++  
++  <xsd:complexType name="parametertype">
++    <xsd:complexContent>
++      <xsd:extension base="parbasetype">
++		<xsd:attribute name="key" type="xsd:string" use="required"/> 
++		<xsd:attribute name="default" type="xsd:string" />
++		<xsd:attribute name="counter" type="xsd:integer" />
++      </xsd:extension>
++    </xsd:complexContent>		
++  </xsd:complexType>
++  
++  <xsd:complexType name="nameonly">
++	<xsd:attribute name="name" />   
++  </xsd:complexType>
++
++  <xsd:complexType name="optionvalue">
++	<xsd:attribute name="value" />   
++  </xsd:complexType>
++
++  <xsd:complexType name="pathonly">
++	<xsd:attribute name="path" />   
++  </xsd:complexType>
++  
++  <xsd:complexType name="pargroup">
++	<xsd:choice minOccurs="1" maxOccurs="unbounded">
++	  <xsd:element name="parameter" type="parametertype" />
++	  <xsd:element name="reference" type="nameonly" />
++	  <xsd:element name="option" type="optionvalue" />
++	  <xsd:element name="frame" type="framegroup" /> 
++	</xsd:choice>
++	<xsd:attribute name="name" />
++  </xsd:complexType>
++
++  <xsd:complexType name="parbasetype">
++	<xsd:sequence>
++	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
++		<xsd:element name="section" type="nameonly"/>
++	  </xsd:sequence>
++	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
++		<xsd:element name="replace" type="nameonly"/>
++	  </xsd:sequence>
++	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
++		<xsd:element name="parameter" type="parametertype" />
++	  </xsd:sequence>
++	  <xsd:choice minOccurs="0" maxOccurs="unbounded">				
++		<xsd:element name="option" minOccurs="0">
++		  <xsd:complexType>
++			<xsd:complexContent>
++			  <xsd:extension base="parbasetype">
++				<xsd:attribute name="value" type="xsd:string" use="required" />
++				<xsd:attribute name="label" type="xsd:string" use="optional" />
++				<xsd:attribute name="default" type="xsd:boolean" use="optional"/>
++			  </xsd:extension>
++			</xsd:complexContent>
++		  </xsd:complexType>
++		</xsd:element>
++	  </xsd:choice>
++	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
++		<xsd:element name="reference" type="nameonly" />
++	  </xsd:sequence>
++	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
++		<xsd:element name="help" type="helptype"/>	
++	  </xsd:sequence>
++	</xsd:sequence>
++	
++	<xsd:attribute name="type" use="required">
++	  <xsd:simpleType>
++		<xsd:restriction base="xsd:string">
++		  <xsd:enumeration value="integer" />
++		  <xsd:enumeration value="integer+" />
++		  <xsd:enumeration value="decimal" />
++		  <xsd:enumeration value="path" />
++		  <xsd:enumeration value="file" />
++		  <xsd:enumeration value="choice" />
++		  <xsd:enumeration value="alternative" />
++		  <xsd:enumeration value="dropdown" />
++		  <xsd:enumeration value="string" />
++		  <xsd:enumeration value="combination" />
++		  <xsd:enumeration value="selector" />
++		</xsd:restriction>
++	  </xsd:simpleType>
++	</xsd:attribute>
++	
++	<xsd:attribute name="maximum" type="xsd:integer"/>
++	<xsd:attribute name="minimum" type="xsd:integer"/>
++	<xsd:attribute name="template" type="xsd:boolean" default="false" use="optional" />
++	<xsd:attribute name="optional" type="xsd:boolean" default="true" />
++  </xsd:complexType>
++  
++  <xsd:complexType name="needstype">
++	<xsd:attribute name="type" type="xsd:string" use="required" />
++	<xsd:attribute name="name" type="xsd:string" use="required" />
++	
++	<xsd:attribute name="value" />
++	<xsd:attribute name="optional" type="xsd:boolean" />
++	<xsd:attribute name="minoccur" type="xsd:integer" />
++	<xsd:attribute name="maxoccur" type="xsd:string" />
++  </xsd:complexType>
++  
++  <xsd:complexType name="baseType">
++	<xsd:sequence minOccurs="0" maxOccurs="1">
++	  <xsd:element name="help" type="helptype" />		
++	</xsd:sequence>
++	<xsd:attribute name="key" type="xsd:string" use="required" />
++  </xsd:complexType>
++  
++  <xsd:complexType name="helptype" mixed="true">
++	<xsd:choice minOccurs="0" maxOccurs="unbounded">
++	  <xsd:element name="section" type="nameonly" />
++	  <xsd:element name="replace" type="nameonly" />
++	</xsd:choice>
++  </xsd:complexType> 
++</xsd:schema>
+
+Property changes on: ../trunk-jpl/src/java/src/resources/config_schema-0.1.1.xsd
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/COPYING
+===================================================================
+--- ../trunk-jpl/src/java/COPYING	(revision 0)
++++ ../trunk-jpl/src/java/COPYING	(revision 17722)
+@@ -0,0 +1,674 @@
++                    GNU GENERAL PUBLIC LICENSE
++                       Version 3, 29 June 2007
++
++ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
++ Everyone is permitted to copy and distribute verbatim copies
++ of this license document, but changing it is not allowed.
++
++                            Preamble
++
++  The GNU General Public License is a free, copyleft license for
++software and other kinds of works.
++
++  The licenses for most software and other practical works are designed
++to take away your freedom to share and change the works.  By contrast,
++the GNU General Public License is intended to guarantee your freedom to
++share and change all versions of a program--to make sure it remains free
++software for all its users.  We, the Free Software Foundation, use the
++GNU General Public License for most of our software; it applies also to
++any other work released this way by its authors.  You can apply it to
++your programs, too.
++
++  When we speak of free software, we are referring to freedom, not
++price.  Our General Public Licenses are designed to make sure that you
++have the freedom to distribute copies of free software (and charge for
++them if you wish), that you receive source code or can get it if you
++want it, that you can change the software or use pieces of it in new
++free programs, and that you know you can do these things.
++
++  To protect your rights, we need to prevent others from denying you
++these rights or asking you to surrender the rights.  Therefore, you have
++certain responsibilities if you distribute copies of the software, or if
++you modify it: responsibilities to respect the freedom of others.
++
++  For example, if you distribute copies of such a program, whether
++gratis or for a fee, you must pass on to the recipients the same
++freedoms that you received.  You must make sure that they, too, receive
++or can get the source code.  And you must show them these terms so they
++know their rights.
++
++  Developers that use the GNU GPL protect your rights with two steps:
++(1) assert copyright on the software, and (2) offer you this License
++giving you legal permission to copy, distribute and/or modify it.
++
++  For the developers' and authors' protection, the GPL clearly explains
++that there is no warranty for this free software.  For both users' and
++authors' sake, the GPL requires that modified versions be marked as
++changed, so that their problems will not be attributed erroneously to
++authors of previous versions.
++
++  Some devices are designed to deny users access to install or run
++modified versions of the software inside them, although the manufacturer
++can do so.  This is fundamentally incompatible with the aim of
++protecting users' freedom to change the software.  The systematic
++pattern of such abuse occurs in the area of products for individuals to
++use, which is precisely where it is most unacceptable.  Therefore, we
++have designed this version of the GPL to prohibit the practice for those
++products.  If such problems arise substantially in other domains, we
++stand ready to extend this provision to those domains in future versions
++of the GPL, as needed to protect the freedom of users.
++
++  Finally, every program is threatened constantly by software patents.
++States should not allow patents to restrict development and use of
++software on general-purpose computers, but in those that do, we wish to
++avoid the special danger that patents applied to a free program could
++make it effectively proprietary.  To prevent this, the GPL assures that
++patents cannot be used to render the program non-free.
++
++  The precise terms and conditions for copying, distribution and
++modification follow.
++
++                       TERMS AND CONDITIONS
++
++  0. Definitions.
++
++  "This License" refers to version 3 of the GNU General Public License.
++
++  "Copyright" also means copyright-like laws that apply to other kinds of
++works, such as semiconductor masks.
++
++  "The Program" refers to any copyrightable work licensed under this
++License.  Each licensee is addressed as "you".  "Licensees" and
++"recipients" may be individuals or organizations.
++
++  To "modify" a work means to copy from or adapt all or part of the work
++in a fashion requiring copyright permission, other than the making of an
++exact copy.  The resulting work is called a "modified version" of the
++earlier work or a work "based on" the earlier work.
++
++  A "covered work" means either the unmodified Program or a work based
++on the Program.
++
++  To "propagate" a work means to do anything with it that, without
++permission, would make you directly or secondarily liable for
++infringement under applicable copyright law, except executing it on a
++computer or modifying a private copy.  Propagation includes copying,
++distribution (with or without modification), making available to the
++public, and in some countries other activities as well.
++
++  To "convey" a work means any kind of propagation that enables other
++parties to make or receive copies.  Mere interaction with a user through
++a computer network, with no transfer of a copy, is not conveying.
++
++  An interactive user interface displays "Appropriate Legal Notices"
++to the extent that it includes a convenient and prominently visible
++feature that (1) displays an appropriate copyright notice, and (2)
++tells the user that there is no warranty for the work (except to the
++extent that warranties are provided), that licensees may convey the
++work under this License, and how to view a copy of this License.  If
++the interface presents a list of user commands or options, such as a
++menu, a prominent item in the list meets this criterion.
++
++  1. Source Code.
++
++  The "source code" for a work means the preferred form of the work
++for making modifications to it.  "Object code" means any non-source
++form of a work.
++
++  A "Standard Interface" means an interface that either is an official
++standard defined by a recognized standards body, or, in the case of
++interfaces specified for a particular programming language, one that
++is widely used among developers working in that language.
++
++  The "System Libraries" of an executable work include anything, other
++than the work as a whole, that (a) is included in the normal form of
++packaging a Major Component, but which is not part of that Major
++Component, and (b) serves only to enable use of the work with that
++Major Component, or to implement a Standard Interface for which an
++implementation is available to the public in source code form.  A
++"Major Component", in this context, means a major essential component
++(kernel, window system, and so on) of the specific operating system
++(if any) on which the executable work runs, or a compiler used to
++produce the work, or an object code interpreter used to run it.
++
++  The "Corresponding Source" for a work in object code form means all
++the source code needed to generate, install, and (for an executable
++work) run the object code and to modify the work, including scripts to
++control those activities.  However, it does not include the work's
++System Libraries, or general-purpose tools or generally available free
++programs which are used unmodified in performing those activities but
++which are not part of the work.  For example, Corresponding Source
++includes interface definition files associated with source files for
++the work, and the source code for shared libraries and dynamically
++linked subprograms that the work is specifically designed to require,
++such as by intimate data communication or control flow between those
++subprograms and other parts of the work.
++
++  The Corresponding Source need not include anything that users
++can regenerate automatically from other parts of the Corresponding
++Source.
++
++  The Corresponding Source for a work in source code form is that
++same work.
++
++  2. Basic Permissions.
++
++  All rights granted under this License are granted for the term of
++copyright on the Program, and are irrevocable provided the stated
++conditions are met.  This License explicitly affirms your unlimited
++permission to run the unmodified Program.  The output from running a
++covered work is covered by this License only if the output, given its
++content, constitutes a covered work.  This License acknowledges your
++rights of fair use or other equivalent, as provided by copyright law.
++
++  You may make, run and propagate covered works that you do not
++convey, without conditions so long as your license otherwise remains
++in force.  You may convey covered works to others for the sole purpose
++of having them make modifications exclusively for you, or provide you
++with facilities for running those works, provided that you comply with
++the terms of this License in conveying all material for which you do
++not control copyright.  Those thus making or running the covered works
++for you must do so exclusively on your behalf, under your direction
++and control, on terms that prohibit them from making any copies of
++your copyrighted material outside their relationship with you.
++
++  Conveying under any other circumstances is permitted solely under
++the conditions stated below.  Sublicensing is not allowed; section 10
++makes it unnecessary.
++
++  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
++
++  No covered work shall be deemed part of an effective technological
++measure under any applicable law fulfilling obligations under article
++11 of the WIPO copyright treaty adopted on 20 December 1996, or
++similar laws prohibiting or restricting circumvention of such
++measures.
++
++  When you convey a covered work, you waive any legal power to forbid
++circumvention of technological measures to the extent such circumvention
++is effected by exercising rights under this License with respect to
++the covered work, and you disclaim any intention to limit operation or
++modification of the work as a means of enforcing, against the work's
++users, your or third parties' legal rights to forbid circumvention of
++technological measures.
++
++  4. Conveying Verbatim Copies.
++
++  You may convey verbatim copies of the Program's source code as you
++receive it, in any medium, provided that you conspicuously and
++appropriately publish on each copy an appropriate copyright notice;
++keep intact all notices stating that this License and any
++non-permissive terms added in accord with section 7 apply to the code;
++keep intact all notices of the absence of any warranty; and give all
++recipients a copy of this License along with the Program.
++
++  You may charge any price or no price for each copy that you convey,
++and you may offer support or warranty protection for a fee.
++
++  5. Conveying Modified Source Versions.
++
++  You may convey a work based on the Program, or the modifications to
++produce it from the Program, in the form of source code under the
++terms of section 4, provided that you also meet all of these conditions:
++
++    a) The work must carry prominent notices stating that you modified
++    it, and giving a relevant date.
++
++    b) The work must carry prominent notices stating that it is
++    released under this License and any conditions added under section
++    7.  This requirement modifies the requirement in section 4 to
++    "keep intact all notices".
++
++    c) You must license the entire work, as a whole, under this
++    License to anyone who comes into possession of a copy.  This
++    License will therefore apply, along with any applicable section 7
++    additional terms, to the whole of the work, and all its parts,
++    regardless of how they are packaged.  This License gives no
++    permission to license the work in any other way, but it does not
++    invalidate such permission if you have separately received it.
++
++    d) If the work has interactive user interfaces, each must display
++    Appropriate Legal Notices; however, if the Program has interactive
++    interfaces that do not display Appropriate Legal Notices, your
++    work need not make them do so.
++
++  A compilation of a covered work with other separate and independent
++works, which are not by their nature extensions of the covered work,
++and which are not combined with it such as to form a larger program,
++in or on a volume of a storage or distribution medium, is called an
++"aggregate" if the compilation and its resulting copyright are not
++used to limit the access or legal rights of the compilation's users
++beyond what the individual works permit.  Inclusion of a covered work
++in an aggregate does not cause this License to apply to the other
++parts of the aggregate.
++
++  6. Conveying Non-Source Forms.
++
++  You may convey a covered work in object code form under the terms
++of sections 4 and 5, provided that you also convey the
++machine-readable Corresponding Source under the terms of this License,
++in one of these ways:
++
++    a) Convey the object code in, or embodied in, a physical product
++    (including a physical distribution medium), accompanied by the
++    Corresponding Source fixed on a durable physical medium
++    customarily used for software interchange.
++
++    b) Convey the object code in, or embodied in, a physical product
++    (including a physical distribution medium), accompanied by a
++    written offer, valid for at least three years and valid for as
++    long as you offer spare parts or customer support for that product
++    model, to give anyone who possesses the object code either (1) a
++    copy of the Corresponding Source for all the software in the
++    product that is covered by this License, on a durable physical
++    medium customarily used for software interchange, for a price no
++    more than your reasonable cost of physically performing this
++    conveying of source, or (2) access to copy the
++    Corresponding Source from a network server at no charge.
++
++    c) Convey individual copies of the object code with a copy of the
++    written offer to provide the Corresponding Source.  This
++    alternative is allowed only occasionally and noncommercially, and
++    only if you received the object code with such an offer, in accord
++    with subsection 6b.
++
++    d) Convey the object code by offering access from a designated
++    place (gratis or for a charge), and offer equivalent access to the
++    Corresponding Source in the same way through the same place at no
++    further charge.  You need not require recipients to copy the
++    Corresponding Source along with the object code.  If the place to
++    copy the object code is a network server, the Corresponding Source
++    may be on a different server (operated by you or a third party)
++    that supports equivalent copying facilities, provided you maintain
++    clear directions next to the object code saying where to find the
++    Corresponding Source.  Regardless of what server hosts the
++    Corresponding Source, you remain obligated to ensure that it is
++    available for as long as needed to satisfy these requirements.
++
++    e) Convey the object code using peer-to-peer transmission, provided
++    you inform other peers where the object code and Corresponding
++    Source of the work are being offered to the general public at no
++    charge under subsection 6d.
++
++  A separable portion of the object code, whose source code is excluded
++from the Corresponding Source as a System Library, need not be
++included in conveying the object code work.
++
++  A "User Product" is either (1) a "consumer product", which means any
++tangible personal property which is normally used for personal, family,
++or household purposes, or (2) anything designed or sold for incorporation
++into a dwelling.  In determining whether a product is a consumer product,
++doubtful cases shall be resolved in favor of coverage.  For a particular
++product received by a particular user, "normally used" refers to a
++typical or common use of that class of product, regardless of the status
++of the particular user or of the way in which the particular user
++actually uses, or expects or is expected to use, the product.  A product
++is a consumer product regardless of whether the product has substantial
++commercial, industrial or non-consumer uses, unless such uses represent
++the only significant mode of use of the product.
++
++  "Installation Information" for a User Product means any methods,
++procedures, authorization keys, or other information required to install
++and execute modified versions of a covered work in that User Product from
++a modified version of its Corresponding Source.  The information must
++suffice to ensure that the continued functioning of the modified object
++code is in no case prevented or interfered with solely because
++modification has been made.
++
++  If you convey an object code work under this section in, or with, or
++specifically for use in, a User Product, and the conveying occurs as
++part of a transaction in which the right of possession and use of the
++User Product is transferred to the recipient in perpetuity or for a
++fixed term (regardless of how the transaction is characterized), the
++Corresponding Source conveyed under this section must be accompanied
++by the Installation Information.  But this requirement does not apply
++if neither you nor any third party retains the ability to install
++modified object code on the User Product (for example, the work has
++been installed in ROM).
++
++  The requirement to provide Installation Information does not include a
++requirement to continue to provide support service, warranty, or updates
++for a work that has been modified or installed by the recipient, or for
++the User Product in which it has been modified or installed.  Access to a
++network may be denied when the modification itself materially and
++adversely affects the operation of the network or violates the rules and
++protocols for communication across the network.
++
++  Corresponding Source conveyed, and Installation Information provided,
++in accord with this section must be in a format that is publicly
++documented (and with an implementation available to the public in
++source code form), and must require no special password or key for
++unpacking, reading or copying.
++
++  7. Additional Terms.
++
++  "Additional permissions" are terms that supplement the terms of this
++License by making exceptions from one or more of its conditions.
++Additional permissions that are applicable to the entire Program shall
++be treated as though they were included in this License, to the extent
++that they are valid under applicable law.  If additional permissions
++apply only to part of the Program, that part may be used separately
++under those permissions, but the entire Program remains governed by
++this License without regard to the additional permissions.
++
++  When you convey a copy of a covered work, you may at your option
++remove any additional permissions from that copy, or from any part of
++it.  (Additional permissions may be written to require their own
++removal in certain cases when you modify the work.)  You may place
++additional permissions on material, added by you to a covered work,
++for which you have or can give appropriate copyright permission.
++
++  Notwithstanding any other provision of this License, for material you
++add to a covered work, you may (if authorized by the copyright holders of
++that material) supplement the terms of this License with terms:
++
++    a) Disclaiming warranty or limiting liability differently from the
++    terms of sections 15 and 16 of this License; or
++
++    b) Requiring preservation of specified reasonable legal notices or
++    author attributions in that material or in the Appropriate Legal
++    Notices displayed by works containing it; or
++
++    c) Prohibiting misrepresentation of the origin of that material, or
++    requiring that modified versions of such material be marked in
++    reasonable ways as different from the original version; or
++
++    d) Limiting the use for publicity purposes of names of licensors or
++    authors of the material; or
++
++    e) Declining to grant rights under trademark law for use of some
++    trade names, trademarks, or service marks; or
++
++    f) Requiring indemnification of licensors and authors of that
++    material by anyone who conveys the material (or modified versions of
++    it) with contractual assumptions of liability to the recipient, for
++    any liability that these contractual assumptions directly impose on
++    those licensors and authors.
++
++  All other non-permissive additional terms are considered "further
++restrictions" within the meaning of section 10.  If the Program as you
++received it, or any part of it, contains a notice stating that it is
++governed by this License along with a term that is a further
++restriction, you may remove that term.  If a license document contains
++a further restriction but permits relicensing or conveying under this
++License, you may add to a covered work material governed by the terms
++of that license document, provided that the further restriction does
++not survive such relicensing or conveying.
++
++  If you add terms to a covered work in accord with this section, you
++must place, in the relevant source files, a statement of the
++additional terms that apply to those files, or a notice indicating
++where to find the applicable terms.
++
++  Additional terms, permissive or non-permissive, may be stated in the
++form of a separately written license, or stated as exceptions;
++the above requirements apply either way.
++
++  8. Termination.
++
++  You may not propagate or modify a covered work except as expressly
++provided under this License.  Any attempt otherwise to propagate or
++modify it is void, and will automatically terminate your rights under
++this License (including any patent licenses granted under the third
++paragraph of section 11).
++
++  However, if you cease all violation of this License, then your
++license from a particular copyright holder is reinstated (a)
++provisionally, unless and until the copyright holder explicitly and
++finally terminates your license, and (b) permanently, if the copyright
++holder fails to notify you of the violation by some reasonable means
++prior to 60 days after the cessation.
++
++  Moreover, your license from a particular copyright holder is
++reinstated permanently if the copyright holder notifies you of the
++violation by some reasonable means, this is the first time you have
++received notice of violation of this License (for any work) from that
++copyright holder, and you cure the violation prior to 30 days after
++your receipt of the notice.
++
++  Termination of your rights under this section does not terminate the
++licenses of parties who have received copies or rights from you under
++this License.  If your rights have been terminated and not permanently
++reinstated, you do not qualify to receive new licenses for the same
++material under section 10.
++
++  9. Acceptance Not Required for Having Copies.
++
++  You are not required to accept this License in order to receive or
++run a copy of the Program.  Ancillary propagation of a covered work
++occurring solely as a consequence of using peer-to-peer transmission
++to receive a copy likewise does not require acceptance.  However,
++nothing other than this License grants you permission to propagate or
++modify any covered work.  These actions infringe copyright if you do
++not accept this License.  Therefore, by modifying or propagating a
++covered work, you indicate your acceptance of this License to do so.
++
++  10. Automatic Licensing of Downstream Recipients.
++
++  Each time you convey a covered work, the recipient automatically
++receives a license from the original licensors, to run, modify and
++propagate that work, subject to this License.  You are not responsible
++for enforcing compliance by third parties with this License.
++
++  An "entity transaction" is a transaction transferring control of an
++organization, or substantially all assets of one, or subdividing an
++organization, or merging organizations.  If propagation of a covered
++work results from an entity transaction, each party to that
++transaction who receives a copy of the work also receives whatever
++licenses to the work the party's predecessor in interest had or could
++give under the previous paragraph, plus a right to possession of the
++Corresponding Source of the work from the predecessor in interest, if
++the predecessor has it or can get it with reasonable efforts.
++
++  You may not impose any further restrictions on the exercise of the
++rights granted or affirmed under this License.  For example, you may
++not impose a license fee, royalty, or other charge for exercise of
++rights granted under this License, and you may not initiate litigation
++(including a cross-claim or counterclaim in a lawsuit) alleging that
++any patent claim is infringed by making, using, selling, offering for
++sale, or importing the Program or any portion of it.
++
++  11. Patents.
++
++  A "contributor" is a copyright holder who authorizes use under this
++License of the Program or a work on which the Program is based.  The
++work thus licensed is called the contributor's "contributor version".
++
++  A contributor's "essential patent claims" are all patent claims
++owned or controlled by the contributor, whether already acquired or
++hereafter acquired, that would be infringed by some manner, permitted
++by this License, of making, using, or selling its contributor version,
++but do not include claims that would be infringed only as a
++consequence of further modification of the contributor version.  For
++purposes of this definition, "control" includes the right to grant
++patent sublicenses in a manner consistent with the requirements of
++this License.
++
++  Each contributor grants you a non-exclusive, worldwide, royalty-free
++patent license under the contributor's essential patent claims, to
++make, use, sell, offer for sale, import and otherwise run, modify and
++propagate the contents of its contributor version.
++
++  In the following three paragraphs, a "patent license" is any express
++agreement or commitment, however denominated, not to enforce a patent
++(such as an express permission to practice a patent or covenant not to
++sue for patent infringement).  To "grant" such a patent license to a
++party means to make such an agreement or commitment not to enforce a
++patent against the party.
++
++  If you convey a covered work, knowingly relying on a patent license,
++and the Corresponding Source of the work is not available for anyone
++to copy, free of charge and under the terms of this License, through a
++publicly available network server or other readily accessible means,
++then you must either (1) cause the Corresponding Source to be so
++available, or (2) arrange to deprive yourself of the benefit of the
++patent license for this particular work, or (3) arrange, in a manner
++consistent with the requirements of this License, to extend the patent
++license to downstream recipients.  "Knowingly relying" means you have
++actual knowledge that, but for the patent license, your conveying the
++covered work in a country, or your recipient's use of the covered work
++in a country, would infringe one or more identifiable patents in that
++country that you have reason to believe are valid.
++
++  If, pursuant to or in connection with a single transaction or
++arrangement, you convey, or propagate by procuring conveyance of, a
++covered work, and grant a patent license to some of the parties
++receiving the covered work authorizing them to use, propagate, modify
++or convey a specific copy of the covered work, then the patent license
++you grant is automatically extended to all recipients of the covered
++work and works based on it.
++
++  A patent license is "discriminatory" if it does not include within
++the scope of its coverage, prohibits the exercise of, or is
++conditioned on the non-exercise of one or more of the rights that are
++specifically granted under this License.  You may not convey a covered
++work if you are a party to an arrangement with a third party that is
++in the business of distributing software, under which you make payment
++to the third party based on the extent of your activity of conveying
++the work, and under which the third party grants, to any of the
++parties who would receive the covered work from you, a discriminatory
++patent license (a) in connection with copies of the covered work
++conveyed by you (or copies made from those copies), or (b) primarily
++for and in connection with specific products or compilations that
++contain the covered work, unless you entered into that arrangement,
++or that patent license was granted, prior to 28 March 2007.
++
++  Nothing in this License shall be construed as excluding or limiting
++any implied license or other defenses to infringement that may
++otherwise be available to you under applicable patent law.
++
++  12. No Surrender of Others' Freedom.
++
++  If conditions are imposed on you (whether by court order, agreement or
++otherwise) that contradict the conditions of this License, they do not
++excuse you from the conditions of this License.  If you cannot convey a
++covered work so as to satisfy simultaneously your obligations under this
++License and any other pertinent obligations, then as a consequence you may
++not convey it at all.  For example, if you agree to terms that obligate you
++to collect a royalty for further conveying from those to whom you convey
++the Program, the only way you could satisfy both those terms and this
++License would be to refrain entirely from conveying the Program.
++
++  13. Use with the GNU Affero General Public License.
++
++  Notwithstanding any other provision of this License, you have
++permission to link or combine any covered work with a work licensed
++under version 3 of the GNU Affero General Public License into a single
++combined work, and to convey the resulting work.  The terms of this
++License will continue to apply to the part which is the covered work,
++but the special requirements of the GNU Affero General Public License,
++section 13, concerning interaction through a network will apply to the
++combination as such.
++
++  14. Revised Versions of this License.
++
++  The Free Software Foundation may publish revised and/or new versions of
++the GNU General Public License from time to time.  Such new versions will
++be similar in spirit to the present version, but may differ in detail to
++address new problems or concerns.
++
++  Each version is given a distinguishing version number.  If the
++Program specifies that a certain numbered version of the GNU General
++Public License "or any later version" applies to it, you have the
++option of following the terms and conditions either of that numbered
++version or of any later version published by the Free Software
++Foundation.  If the Program does not specify a version number of the
++GNU General Public License, you may choose any version ever published
++by the Free Software Foundation.
++
++  If the Program specifies that a proxy can decide which future
++versions of the GNU General Public License can be used, that proxy's
++public statement of acceptance of a version permanently authorizes you
++to choose that version for the Program.
++
++  Later license versions may give you additional or different
++permissions.  However, no additional obligations are imposed on any
++author or copyright holder as a result of your choosing to follow a
++later version.
++
++  15. Disclaimer of Warranty.
++
++  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
++APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
++HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
++OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
++THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
++PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
++IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
++ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
++
++  16. Limitation of Liability.
++
++  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
++WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
++THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
++GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
++USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
++DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
++PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
++EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
++SUCH DAMAGES.
++
++  17. Interpretation of Sections 15 and 16.
++
++  If the disclaimer of warranty and limitation of liability provided
++above cannot be given local legal effect according to their terms,
++reviewing courts shall apply local law that most closely approximates
++an absolute waiver of all civil liability in connection with the
++Program, unless a warranty or assumption of liability accompanies a
++copy of the Program in return for a fee.
++
++                     END OF TERMS AND CONDITIONS
++
++            How to Apply These Terms to Your New Programs
++
++  If you develop a new program, and you want it to be of the greatest
++possible use to the public, the best way to achieve this is to make it
++free software which everyone can redistribute and change under these terms.
++
++  To do so, attach the following notices to the program.  It is safest
++to attach them to the start of each source file to most effectively
++state the exclusion of warranty; and each file should have at least
++the "copyright" line and a pointer to where the full notice is found.
++
++    <one line to give the program's name and a brief idea of what it does.>
++    Copyright (C) <year>  <name of author>
++
++    This program is free software: you can redistribute it and/or modify
++    it under the terms of the GNU General Public License as published by
++    the Free Software Foundation, either version 3 of the License, or
++    (at your option) any later version.
++
++    This program is distributed in the hope that it will be useful,
++    but WITHOUT ANY WARRANTY; without even the implied warranty of
++    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++    GNU General Public License for more details.
++
++    You should have received a copy of the GNU General Public License
++    along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++Also add information on how to contact you by electronic and paper mail.
++
++  If the program does terminal interaction, make it output a short
++notice like this when it starts in an interactive mode:
++
++    <program>  Copyright (C) <year>  <name of author>
++    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
++    This is free software, and you are welcome to redistribute it
++    under certain conditions; type `show c' for details.
++
++The hypothetical commands `show w' and `show c' should show the appropriate
++parts of the General Public License.  Of course, your program's commands
++might be different; for a GUI interface, you would use an "about box".
++
++  You should also get your employer (if you work as a programmer) or school,
++if any, to sign a "copyright disclaimer" for the program, if necessary.
++For more information on this, and how to apply and follow the GNU GPL, see
++<http://www.gnu.org/licenses/>.
++
++  The GNU General Public License does not permit incorporating your program
++into proprietary programs.  If your program is a subroutine library, you
++may consider it more useful to permit linking proprietary applications with
++the library.  If this is what you want to do, use the GNU Lesser General
++Public License instead of this License.  But first, please read
++<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+
+Property changes on: ../trunk-jpl/src/java/COPYING
+___________________________________________________________________
+Name: svn:executable
+   + *
+
+Index: ../trunk-jpl/src/java/build.xml
+===================================================================
+--- ../trunk-jpl/src/java/build.xml	(revision 0)
++++ ../trunk-jpl/src/java/build.xml	(revision 17722)
+@@ -0,0 +1,126 @@
++<project name="inishell" default="help" basedir=".">
++	<description>
++	Build and run the inishell Application from the command line.
++	</description>
++
++
++	<!-- set global properties for the build -->
++	<property name="src" location="src"/>
++	<property name="examples" location="doc/examples"/>
++	<property name="build" location="build"/>
++	<property name="dist"  location="dist"/>
++	<property name="lib.dir" location="lib"/>
++	<tstamp prefix="build-info">
++		<format property="date" pattern="yyyy-MM-dd" locale="en" />
++		<format property="time" pattern="HH:mm:ss" locale="en" />
++		<format property="num-date" pattern="yyyyMMdd" locale="en" />
++	</tstamp>
++	<property name="version.num" value="1.0.0" />
++	<!--<buildnumber file="dist/build.num"/>-->
++	<!--<property name="version-number" value="${version.num}-${build.number}" />-->
++	<property name="version-number" value="${version.num}" />
++	<property name="version-full" value="${version.num}-${build-info.num-date}" />
++
++	<path id="classpath">
++		<fileset dir="${lib.dir}" includes="**/*.jar"/>
++	</path>
++
++
++	<!-- targets -->
++	<target name="help">
++		<echo>You can use the following targets:</echo>
++		<echo> </echo>
++		<echo>  help     : (default) Prints this message </echo>
++		<echo>  init     : create necessary directories</echo>
++		<echo>  clean    : Deletes work directories</echo>
++		<echo>  compile  : Compiles into class files</echo>
++		<echo>  dist     : pack all necessary files into a JAR file</echo>
++		<echo>  issm 	 : create inishell GUI using issm.xml</echo>
++		<echo>  snowpack : dist tailored for snowpack</echo>
++		<echo>  meteoio  : dist tailored for meteoio</echo>
++		<echo>  run      : run the previously compiled version</echo>
++		<echo>  pack     : pack all in a zip file for a release</echo>
++		<echo></echo>
++	</target>
++
++	<target name="init">
++		<mkdir dir="${build}"/>
++		<mkdir dir="${dist}"/>
++	</target>
++
++	<target name="snowpack" depends="init" description="Make doc/examples/snowpack_config.xml the default XML config">
++		<copy file="${examples}/snowpack_config.xml" tofile="${build}/resources/default_config.xml" overwrite="true"/>
++		<antcall target="dist"/>
++	</target>
++
++	<target name="meteoio" depends="init" description="Make doc/examples/meteoio_config.xml the default XML config">
++		<copy file="${examples}/meteoio_config.xml" tofile="${build}/resources/default_config.xml" overwrite="true"/>
++		<antcall target="dist"/>
++	</target>
++	
++	<target name="issm" depends="init" description="Make doc/examples/issm.xml the default XML config">
++		<copy file="./doc/examples/issm.xml" tofile="${build}/resources/default_config.xml" overwrite="true"/>
++		<antcall target="dist"/>
++	</target>
++
++	<target name="compile" depends="init" description="Compile from ${src} to ${build}">
++		<javac srcdir="${src}" destdir="${build}" includeantruntime="false">
++			<classpath>
++				<fileset dir="lib">
++				<include name="**/*.jar"/>
++				</fileset>
++			</classpath>
++		</javac>
++		<copy todir="${build}/resources">
++		<fileset dir="${src}/resources" includes="**"/>
++	</copy>
++	</target>
++
++	<target name="dist" depends="compile" description="generate the distribution" >
++		<!-- Create the distribution directory -->
++		<delete file="MANIFEST.MF"/>
++		<manifest file="MANIFEST.MF">
++			<attribute name="Built-By" value="${user.name}"/>
++			<attribute name="Built-On" value="${build-info.date}" />
++			<attribute name="Built-At" value="${build-info.time}" />
++			<attribute name="Main-Class" value="main/GUIBuilder"/>
++			<attribute name="Specification-Title" value="INI file generator"/>
++			<attribute name="Specification-Version" value="${version-full}"/>
++			<attribute name="Specification-Vendor" value="SLF, www.slf.ch"/>
++			<attribute name="Implementation-Title" value="INIshell ini creator"/>
++			<attribute name="Implementation-Version" value="${version-number}"/>
++			<attribute name="Implementation-Vendor" value="SLF, www.slf.ch"/>
++		</manifest>
++
++		<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
++		<jar jarfile="${dist}/inishell.jar" basedir="${build}" manifest="MANIFEST.MF" index="true" >
++			<zipfileset src="${lib.dir}/miglayout-4.0.jar" includes="**/*.class"/>
++		</jar>
++	</target>
++
++	<target name="run" depends="dist">
++		<java fork="true" classname="main/GUIBuilder">
++			<classpath>
++				<path refid="classpath"/>
++				<path location="${dist}/inishell.jar"/>
++			</classpath>
++		</java>
++	</target>
++
++	<target name="clean" description="clean up" >
++		<!-- Delete the ${build} and ${dist} directory trees -->
++		<delete file="MANIFEST.MF"/>
++		<delete dir="${build}"/>
++		<delete dir="${dist}"/>
++	</target>
++
++	<target name="pack" depends="dist" description="pack for distribution">
++		<zip destfile="inishell-${version.num}.zip">
++			<zipfileset dir="doc/examples" prefix="inishell-${version.num}/doc/examples"/>
++			<zipfileset dir="dist" prefix="inishell-${version.num}/bin"/>
++			<zipfileset dir="." includes="inishell.sh" prefix="inishell-${version.num}/bin"/>
++			<zipfileset dir="." includes="Changelog_${version.num}.txt" prefix="inishell-${version.num}/doc"/>
++		</zip>
++	</target>
++
++</project>
+
+Property changes on: ../trunk-jpl/src/java/build.xml
+___________________________________________________________________
+Name: svn:executable
+   + *
+
Index: issm/oecreview/Archive/16554-17801/ISSM-17722-17723.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17722-17723.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17722-17723.diff	(revision 17802)
@@ -0,0 +1,14 @@
+Index: ../trunk-jpl/src/java/inishell.sh
+===================================================================
+--- ../trunk-jpl/src/java/inishell.sh	(revision 17722)
++++ ../trunk-jpl/src/java/inishell.sh	(revision 17723)
+@@ -1,3 +1,8 @@
++#/bin/bash
+ #This is just the necessary command line to run a jar file
+ 
+-java -jar dist/inishell.jar
++#recover file name: 
++xmlfilename=$1
++
++#call inishell
++java -jar dist/inishell.jar $xmlfilename
Index: issm/oecreview/Archive/16554-17801/ISSM-17723-17724.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17723-17724.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17723-17724.diff	(revision 17802)
@@ -0,0 +1,224 @@
+Index: ../trunk-jpl/src/m/classes/model.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.py	(revision 17723)
++++ ../trunk-jpl/src/m/classes/model.py	(revision 17724)
+@@ -41,15 +41,16 @@
+ from radaroverlay import radaroverlay
+ from miscellaneous import miscellaneous
+ from private import private
+-from EnumDefinitions import *
+ from mumpsoptions import mumpsoptions
+ from iluasmoptions import iluasmoptions
+ from project3d import project3d
++from project2d import project2d
+ from FlagElements import FlagElements
+ from NodeConnectivity import NodeConnectivity
+ from ElementConnectivity import ElementConnectivity
+ from contourenvelope import contourenvelope
+ import MatlabFuncs as m
++from DepthAverage import DepthAverage
+ #}}}
+ 
+ class model(object):
+@@ -174,7 +175,7 @@
+ 		return string
+ 	# }}}
+ 	def checkmessage(self,string):    # {{{
+-		print ("model not consistent: %s" % string)
++		print "model not consistent: ", string
+ 		self.private.isconsistent=False
+ 		return self
+ 	# }}}
+@@ -327,7 +328,7 @@
+ 
+ 		#Edges
+ 		if m.strcmp(md.mesh.domaintype(),'2Dhorizontal'):
+-			if numpy.ndim(md2.mesh.edges)>1 and numpy.size(md2.mesh.edges,axis=1)>1:    #do not use ~isnan because there are some NaNs...
++			if numpy.ndim(md2.mesh.edges)>1 and numpy.size(md2.mesh.edges,axis=1)>1:    #do not use ~isnan because there are some npy.nans...
+ 				#renumber first two columns
+ 				pos=numpy.nonzero(md2.mesh.edges[:,3]!=-1)[0]
+ 				md2.mesh.edges[:  ,0]=Pnode[md2.mesh.edges[:,0]-1]
+@@ -393,8 +394,8 @@
+ 				md2.stressbalance.spcvx[nodestoflag2]=md2.inversion.vx_obs[nodestoflag2] 
+ 				md2.stressbalance.spcvy[nodestoflag2]=md2.inversion.vy_obs[nodestoflag2]
+ 			else:
+-				md2.stressbalance.spcvx[nodestoflag2]=float('NaN')
+-				md2.stressbalance.spcvy[nodestoflag2]=float('NaN')
++				md2.stressbalance.spcvx[nodestoflag2]=npy.nan
++				md2.stressbalance.spcvy[nodestoflag2]=npy.nan
+ 				print "\n!! extract warning: spc values should be checked !!\n\n"
+ 			#put 0 for vz
+ 			md2.stressbalance.spcvz[nodestoflag2]=0
+@@ -639,9 +640,9 @@
+ 		md.stressbalance.spcvx=project3d(md,'vector',md.stressbalance.spcvx,'type','node')
+ 		md.stressbalance.spcvy=project3d(md,'vector',md.stressbalance.spcvy,'type','node')
+ 		md.stressbalance.spcvz=project3d(md,'vector',md.stressbalance.spcvz,'type','node')
+-		md.thermal.spctemperature=project3d(md,'vector',md.thermal.spctemperature,'type','node','layer',md.mesh.numberoflayers,'padding',float('NaN'))
++		md.thermal.spctemperature=project3d(md,'vector',md.thermal.spctemperature,'type','node','layer',md.mesh.numberoflayers,'padding',numpy.nan)
+ 		if isinstance(md.initialization.temperature,numpy.ndarray) and numpy.size(md.initialization.temperature,axis=0)==md.mesh.numberofvertices:
+-			md.thermal.spctemperature=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
++			md.thermal.spctemperature=numpy.nan*numpy.ones((md.mesh.numberofvertices,1))
+ 			if hasattr(md.mesh,'vertexonsurface'):
+ 				pos=numpy.nonzero(md.mesh.vertexonsurface)[0]
+ 				md.thermal.spctemperature[pos]=md.initialization.temperature[pos]    #impose observed temperature on surface
+@@ -702,3 +703,125 @@
+ 
+ 		return md
+ 		# }}}
++	def collapse(md): #{{{
++		'''
++		collapses a 3d mesh into a 2d mesh
++			
++		This routine collapses a 3d model into a 2d model and collapses all
++		the fileds of the 3d model by taking their depth-averaged values
++			
++		Usage:
++			md=collapse(md)
++		'''	
++
++		#Check that the model is really a 3d model
++		if md.mesh.domaintype().lower() != '3d':
++			raise StandardError("only a 3D model can be collapsed")
++		
++		#drag is limited to nodes that are on the bedrock.
++		md.friction.coefficient=project2d(md,md.friction.coefficient,1)
++
++		#p and q (same deal, except for element that are on the bedrock: )
++		md.friction.p=project2d(md,md.friction.p,1)
++		md.friction.q=project2d(md,md.friction.q,1)
++
++		#observations
++		if not numpy.isnan(md.inversion.vx_obs).all(): md.inversion.vx_obs=project2d(md,md.inversion.vx_obs,md.mesh.numberoflayers) 
++		if not numpy.isnan(md.inversion.vy_obs).all(): md.inversion.vy_obs=project2d(md,md.inversion.vy_obs,md.mesh.numberoflayers) 
++		if not numpy.isnan(md.inversion.vel_obs).all(): md.inversion.vel_obs=project2d(md,md.inversion.vel_obs,md.mesh.numberoflayers) 
++		if not numpy.isnan(md.inversion.cost_functions_coefficients).all(): md.inversion.cost_functions_coefficients=project2d(md,md.inversion.cost_functions_coefficients,md.mesh.numberoflayers) 
++		if md.inversion.min_parameters.size>1: md.inversion.min_parameters=project2d(md,md.inversion.min_parameters,md.mesh.numberoflayers) 
++		if md.inversion.max_parameters.size>1: md.inversion.max_parameters=project2d(md,md.inversion.max_parameters,md.mesh.numberoflayers) 
++		if not numpy.isnan(md.surfaceforcings.mass_balance).all():
++			md.surfaceforcings.mass_balance=project2d(md,md.surfaceforcings.mass_balance,md.mesh.numberoflayers) 
++		
++		if not numpy.isnan(md.balancethickness.thickening_rate).all(): md.balancethickness.thickening_rate=project2d(md,md.balancethickness.thickening_rate,md.mesh.numberoflayers) 
++
++		#results
++		if not numpy.isnan(md.initialization.vx).all(): md.initialization.vx=DepthAverage(md,md.initialization.vx)
++		if not numpy.isnan(md.initialization.vy).all(): md.initialization.vy=DepthAverage(md,md.initialization.vy)
++		if not numpy.isnan(md.initialization.vz).all(): md.initialization.vz=DepthAverage(md,md.initialization.vz)
++		if not numpy.isnan(md.initialization.vel).all(): md.initialization.vel=DepthAverage(md,md.initialization.vel)
++		if not numpy.isnan(md.initialization.temperature).all(): md.initialization.temperature=DepthAverage(md,md.initialization.temperature)
++
++		#gia
++		if not numpy.isnan(md.gia.mantle_viscosity).all(): md.gia.mantle_viscosity=project2d(md,md.gia.mantle_viscosity,1) 
++		if not numpy.isnan(md.gia.lithosphere_thickness).all(): md.gia.lithosphere_thickness=project2d(md,md.gia.lithosphere_thickness,1) 
++
++		#elementstype
++		if not numpy.isnan(md.flowequation.element_equation).all():
++			md.flowequation.element_equation=project2d(md,md.flowequation.element_equation,1)
++			md.flowequation.vertex_equation=project2d(md,md.flowequation.vertex_equation,1)
++			md.flowequation.borderSSA=project2d(md,md.flowequation.borderSSA,1)
++			md.flowequation.borderHO=project2d(md,md.flowequation.borderHO,1)
++			md.flowequation.borderFS=project2d(md,md.flowequation.borderFS,1)
++
++		#boundary conditions
++		md.stressbalance.spcvx=project2d(md,md.stressbalance.spcvx,md.mesh.numberoflayers)
++		md.stressbalance.spcvy=project2d(md,md.stressbalance.spcvy,md.mesh.numberoflayers)
++		md.stressbalance.spcvz=project2d(md,md.stressbalance.spcvz,md.mesh.numberoflayers)
++		md.stressbalance.referential=project2d(md,md.stressbalance.referential,md.mesh.numberoflayers)
++		md.stressbalance.loadingforce=project2d(md,md.stressbalance.loadingforce,md.mesh.numberoflayers)
++		md.masstransport.spcthickness=project2d(md,md.masstransport.spcthickness,md.mesh.numberoflayers)
++		md.damage.spcdamage=project2d(md,md.damage.spcdamage,md.mesh.numberoflayers-1)
++		md.thermal.spctemperature=project2d(md,md.thermal.spctemperature,md.mesh.numberoflayers-1)
++
++		#materials
++		md.materials.rheology_B=DepthAverage(md,md.materials.rheology_B)
++		md.materials.rheology_n=project2d(md,md.materials.rheology_n,1)
++		
++		#damage: 
++		md.damage.D=DepthAverage(md,md.damage.D)
++
++		#special for thermal modeling:
++		md.basalforcings.melting_rate=project2d(md,md.basalforcings.melting_rate,1) 
++		md.basalforcings.geothermalflux=project2d(md,md.basalforcings.geothermalflux,1) #bedrock only gets geothermal flux
++
++		#update of connectivity matrix
++		md.mesh.average_vertex_connectivity=25
++
++		#Collapse the mesh
++		nodes2d=md.mesh.numberofvertices2d
++		elements2d=md.mesh.numberofelements2d
++
++		#parameters
++		md.geometry.surface=project2d(md,md.geometry.surface,1)
++		md.geometry.thickness=project2d(md,md.geometry.thickness,1)
++		md.geometry.base=project2d(md,md.geometry.base,1)
++		md.geometry.bed=project2d(md,md.geometry.bed,1)
++		md.mesh.vertexonboundary=project2d(md,md.mesh.vertexonboundary,1)
++		md.mesh.elementconnectivity=project2d(md,md.mesh.elementconnectivity,1)
++		md.mask.groundedice_levelset=project2d(md,md.mask.groundedice_levelset,1)
++		md.mask.ice_levelset=project2d(md,md.mask.ice_levelset,1)
++
++		#lat long
++		if md.mesh.lat.size==md.mesh.numberofvertices:  md.mesh.lat=project2d(md,md.mesh.lat,1) 
++		if md.mesh.long.size==md.mesh.numberofvertices: md.mesh.long=project2d(md,md.mesh.long,1) 
++
++		#Initialize with the 2d mesh
++		mesh=mesh2d()
++		mesh.x=md.mesh.x2d
++		mesh.y=md.mesh.y2d
++		mesh.z=numpy.zeros_like(md.mesh.x2d)
++		mesh.numberofvertices=md.mesh.numberofvertices2d
++		mesh.numberofelements=md.mesh.numberofelements2d
++		mesh.elements=md.mesh.elements2d
++		md.mesh=mesh
++
++		#Keep a trace of lower and upper nodes
++		md.mesh.lowervertex=numpy.nan
++		md.mesh.uppervertex=numpy.nan
++		md.mesh.lowerelements=numpy.nan
++		md.mesh.upperelements=numpy.nan
++
++		#Remove old mesh 
++		md.mesh.x2d=numpy.nan
++		md.mesh.y2d=numpy.nan
++		md.mesh.elements2d=numpy.nan
++		md.mesh.numberofelements2d=md.mesh.numberofelements
++		md.mesh.numberofvertices2d=md.mesh.numberofvertices
++		md.mesh.numberoflayers=0
++
++		return md
++
++#}}}
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17723)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17724)
+@@ -159,7 +159,7 @@
+ 				error('collapse error message: only 3d mesh can be collapsed')
+ 			end
+ 
+-			%Start with changing alle the fields from the 3d mesh 
++			%Start with changing all the fields from the 3d mesh 
+ 
+ 			%drag is limited to nodes that are on the bedrock.
+ 			md.friction.coefficient=project2d(md,md.friction.coefficient,1);
+@@ -243,13 +243,14 @@
+ 			if numel(md.mesh.long)==md.mesh.numberofvertices, md.mesh.long=project2d(md,md.mesh.long,1); end
+ 
+ 			%Initialize with the 2d mesh
+-			md.mesh=mesh2d();
+-			md.mesh.x=md.mesh.x2d;
+-			md.mesh.y=md.mesh.y2d;
+-			md.mesh.z=zeros(size(md.mesh.x2d));
+-			md.mesh.numberofvertices=md.mesh.numberofvertices2d;
+-			md.mesh.numberofelements=md.mesh.numberofelements2d;
+-			md.mesh.elements=md.mesh.elements2d;
++			mesh=mesh2d();
++			mesh.x=md.mesh.x2d;
++			mesh.y=md.mesh.y2d;
++			mesh.z=zeros(size(md.mesh.x2d));
++			mesh.numberofvertices=md.mesh.numberofvertices2d;
++			mesh.numberofelements=md.mesh.numberofelements2d;
++			mesh.elements=md.mesh.elements2d;
++			md.mesh=mesh;
+ 
+ 			%Keep a trace of lower and upper nodes
+ 			md.mesh.lowervertex=NaN;
Index: issm/oecreview/Archive/16554-17801/ISSM-17724-17725.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17724-17725.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17724-17725.diff	(revision 17802)
@@ -0,0 +1,214 @@
+Index: ../trunk-jpl/src/m/extrusion/project2d.py
+===================================================================
+--- ../trunk-jpl/src/m/extrusion/project2d.py	(revision 0)
++++ ../trunk-jpl/src/m/extrusion/project2d.py	(revision 17725)
+@@ -0,0 +1,53 @@
++import numpy as npy
++
++def project2d(md3d,value,layer):
++	'''
++	returns the value of a field for a given layer of the mesh
++	
++	project 'value' vector taken at layer 'layer' from extruded 2d-3d
++	mesh onto 2d mesh used to do the extrusion. This routine is used to
++	compare values between a 2d-3d mesh at a certain layer, and the
++	equivalent value (if it exists), on the original 2d mesh.	
++
++	Note: for consistency with usage in ISSM, layers are indexed starting
++	from one.  This routine accounts for the fact that python indexes from
++	zero.  In other words, when using this function consider the bottom
++	layer as layer=1.  
++
++   Usage:
++      projection_value=project2d(md3d,value,layer)
++
++   Example:
++      vel2=project2d(md3d,md3d.vel,2)
++	'''
++
++	if md3d.mesh.domaintype().lower() != '3d':
++		raise StandardError("model passed to project2d function should be 3D")
++
++	if layer<1 or layer>md3d.mesh.numberoflayers:
++		raise ValueError("layer must be between 0 and %i" % md3d.mesh.numberoflayers)
++	
++	# coerce to array in case float is passed
++	if type(value)!=npy.ndarray:
++		print 'coercing array'
++		value=npy.array(value)
++
++	vec2d=False
++	if value.ndim==2: 
++		value=value.reshape(-1,)
++		vec2d=True
++	
++	if value.size==1:
++		projection_value=value[(layer-1)*md3d.mesh.numberofelements2d:layer*md3d.mesh.numberofelements2d]
++	elif value.shape[0]==md3d.mesh.numberofvertices:
++		#print 'indices: ', (layer-1)*md3d.mesh.numberofvertices2d, layer*md3d.mesh.numberofvertices2d
++		projection_value=value[(layer-1)*md3d.mesh.numberofvertices2d:layer*md3d.mesh.numberofvertices2d]
++	elif value.shape[0]==md3d.mesh.numberofvertices+1:
++		projection_value=[value[(layer-1)*md3d.mesh.numberofvertices2d:layer*md3d.mesh.numberofvertices2d], value[-1]]
++	else:
++		projection_value=value[(layer-1)*md3d.mesh.numberofelements2d:layer*md3d.mesh.numberofelements2d]
++
++	if vec2d:
++		projection_value=projection_value.reshape(-1,1)
++
++	return projection_value
+Index: ../trunk-jpl/src/m/extrusion/project3d.py
+===================================================================
+--- ../trunk-jpl/src/m/extrusion/project3d.py	(revision 17724)
++++ ../trunk-jpl/src/m/extrusion/project3d.py	(revision 17725)
+@@ -1,6 +1,5 @@
+ import numpy
+ from pairoptions import pairoptions
+-import MatlabFuncs as m
+ 
+ def project3d(md,*args):
+ 	"""
+@@ -15,41 +14,41 @@
+ 	   options: 
+ 	      'layer' a layer number where vector should keep its values. If not specified, all layers adopt the 
+ 	             value of the 2d vector.
+-	      'padding': default to 0 (value adopted by other 3d layers not being projected0
++	      'padding': default to 0 (value adopted by other 3d layers not being projected
+ 
+-	   Egs:
+-	      extruded_vector=project3d(md,'vector',vector2d,'type','node','layer',1,'padding',NaN);
+-	      extruded_vector=project3d(md,'vector',vector2d,'type','element','padding',0);
+-	      extruded_vector=project3d(md,'vector',vector2d,'type','node');
++	   Examples:
++	      extruded_vector=project3d(md,'vector',vector2d,'type','node','layer',1,'padding',NaN)
++	      extruded_vector=project3d(md,'vector',vector2d,'type','element','padding',0)
++	      extruded_vector=project3d(md,'vector',vector2d,'type','node')
+ 	"""
+ 
+ 	#some regular checks
+ 	if not md:
+ 		raise TypeError("bad usage")
+-	if not m.strcmp(md.mesh.elementtype(),'Penta'):
++	if md.mesh.domaintype().lower() != '3d':
+ 		raise TypeError("input model is not 3d")
+ 
+ 	#retrieve parameters from options.
+ 	options      = pairoptions(*args)
+ 	vector2d     = options.getfieldvalue('vector')       #mandatory
+-	type         = options.getfieldvalue('type')         #mandatory
++	vectype      = options.getfieldvalue('type')         #mandatory
+ 	layer        = options.getfieldvalue('layer',0)      #optional (do all layers otherwise)
+ 	paddingvalue = options.getfieldvalue('padding',0)    #0 by default
+ 
+ 	vector1d=False
+ 	if isinstance(vector2d,numpy.ndarray) and numpy.ndim(vector2d)==1:
+ 		vector1d=True
+-		vector2d=vector2d.reshape(numpy.size(vector2d),1)
++		vector2d=vector2d.reshape(-1,1)
+ 
+-	if   isinstance(vector2d,(bool,int,long,float)) or numpy.size(vector2d)==1:
++	if isinstance(vector2d,(bool,int,long,float)) or numpy.size(vector2d)==1:
+ 		projected_vector=vector2d
+ 
+-	elif m.strcmpi(type,'node'):
++	elif vectype.lower()=='node':
+ 
+ 		#Initialize 3d vector
+-		if   numpy.size(vector2d,axis=0)==md.mesh.numberofvertices2d:
++		if vector2d.shape[0]==md.mesh.numberofvertices2d:
+ 			projected_vector=(paddingvalue*numpy.ones((md.mesh.numberofvertices,  numpy.size(vector2d,axis=1)))).astype(vector2d.dtype)
+-		elif numpy.size(vector2d,axis=0)==md.mesh.numberofvertices2d+1:
++		elif vector2d.shape[0]==md.mesh.numberofvertices2d+1:
+ 			projected_vector=(paddingvalue*numpy.ones((md.mesh.numberofvertices+1,numpy.size(vector2d,axis=1)))).astype(vector2d.dtype)
+ 			projected_vector[-1,:]=vector2d[-1,:]
+ 			vector2d=vector2d[:-1,:]
+@@ -63,12 +62,12 @@
+ 		else:
+ 			projected_vector[((layer-1)*md.mesh.numberofvertices2d):(layer*md.mesh.numberofvertices2d),:]=vector2d
+ 
+-	elif m.strcmpi(type,'element'):
++	elif vectype.lower()=='element':
+ 
+ 		#Initialize 3d vector
+-		if   numpy.size(vector2d,axis=0)==md.mesh.numberofelements2d:
++		if vector2d.shape[0]==md.mesh.numberofelements2d:
+ 			projected_vector=(paddingvalue*numpy.ones((md.mesh.numberofelements,  numpy.size(vector2d,axis=1)))).astype(vector2d.dtype)
+-		elif numpy.size(vector2d,axis=0)==md.mesh.numberofelements2d+1:
++		elif vector2d.shape[0]==md.mesh.numberofelements2d+1:
+ 			projected_vector=(paddingvalue*numpy.ones((md.mesh.numberofelements+1,numpy.size(vector2d,axis=1)))).astype(vector2d.dtype)
+ 			projected_vector[-1,:]=vector2d[-1,:]
+ 			vector2d=vector2d[:-1,:]
+@@ -86,7 +85,6 @@
+ 		raise TypeError("project3d error message: unknown projection type")
+ 
+ 	if vector1d:
+-		projected_vector=projected_vector.reshape((numpy.size(projected_vector)))
++		projected_vector=projected_vector.reshape(-1,)
+ 
+ 	return projected_vector
+-
+Index: ../trunk-jpl/src/m/extrusion/DepthAverage.py
+===================================================================
+--- ../trunk-jpl/src/m/extrusion/DepthAverage.py	(revision 0)
++++ ../trunk-jpl/src/m/extrusion/DepthAverage.py	(revision 17725)
+@@ -0,0 +1,50 @@
++import numpy as npy
++from project2d import project2d
++
++def DepthAverage(md,vector):
++	'''
++	computes depth average of 3d vector using the trapezoidal rule, and returns
++	the value on the 2d mesh. 
++	
++	Usage:
++		vector_average=DepthAverage(md,vector)
++	
++	Example:
++		vel_bar=DepthAverage(md,md.initialization.vel)
++	'''
++
++	#check that the model given in input is 3d
++	if md.mesh.domaintype().lower() != '3d':
++		raise TypeError('DepthAverage error message: the model given in input must be 3d')
++
++	# coerce to array in case float is passed
++	if type(vector)!=npy.ndarray:
++		print 'coercing array'
++		vector=npy.array(value)
++
++	vec2d=False
++	if vector.ndim==2:
++		vec2d=True
++		vector=vector.reshape(-1,)
++
++	#nods data
++	if vector.shape[0]==md.mesh.numberofvertices:
++		vector_average=npy.zeros(md.mesh.numberofvertices2d)
++		for i in xrange(1,md.mesh.numberoflayers):
++			vector_average=vector_average+(project2d(md,vector,i)+project2d(md,vector,i+1))/2.*(project2d(md,md.mesh.z,i+1)-project2d(md,md.mesh.z,i))
++		vector_average=vector_average/project2d(md,md.geometry.thickness,1)
++	
++	#element data
++	elif vector.shape[0]==md.mesh.numberofelements:
++		vector_average=npy.zeros(md.mesh.numberofelements2d)
++		for i in xrange(1,md.mesh.numberoflayers):
++			vector_average=vector_average+project2d(md,vector,i)*(project2d(md,md.mesh.z,i+1)-project2d(md,md.mesh.z,i))
++		vector_average=vector_average/project2d(md,md.geometry.thickness,1)
++	
++	else:
++		raise ValueError('vector size not supported yet');
++
++	if vec2d:
++		vector_average=vector_average.reshape(-1,1)
++
++	return vector_average
+Index: ../trunk-jpl/src/m/extrusion/DepthAverage.m
+===================================================================
+--- ../trunk-jpl/src/m/extrusion/DepthAverage.m	(revision 17724)
++++ ../trunk-jpl/src/m/extrusion/DepthAverage.m	(revision 17725)
+@@ -1,5 +1,5 @@
+ function  vector_average=DepthAverage(md,vector)
+-%DEPTHAVERAGE - computes depth average of 3d vector, and return value on 2d mesh. 
++%DEPTHAVERAGE - computes depth average of 3d vector using the trapezoidal rule, and returns the value on 2d mesh. 
+ %
+ %   Usage:
+ %      vector_average=DepthAverage(md,vector);
Index: issm/oecreview/Archive/16554-17801/ISSM-17725-17726.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17725-17726.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17725-17726.diff	(revision 17802)
@@ -0,0 +1,33 @@
+Index: ../trunk-jpl/src/m/contrib/dassflow/importgmsh.m
+===================================================================
+--- ../trunk-jpl/src/m/contrib/dassflow/importgmsh.m	(revision 17725)
++++ ../trunk-jpl/src/m/contrib/dassflow/importgmsh.m	(revision 17726)
+@@ -82,12 +82,10 @@
+ 				index(end+1,:)=A;
+ 			else         %Boundary element
+ 				segments(end+1,:)=A;
+-				if    (flags(1)==3), segmentmarkers(end+1)=3; 
++				if    (flags(1)==1), segmentmarkers(end+1)=1; 
++				elseif(flags(1)==2), segmentmarkers(end+1)=2;
++				elseif(flags(1)==3), segmentmarkers(end+1)=3;
+ 				elseif(flags(1)==4), segmentmarkers(end+1)=4;
+-				elseif(flags(1)==1), segmentmarkers(end+1)=1;
+-				elseif(flags(1)==2), segmentmarkers(end+1)=2;
+-				elseif(flags(1)==5), segmentmarkers(end+1)=5;
+-				elseif(flags(1)==6), segmentmarkers(end+1)=6;
+ 				else error(['flags ' num2str(flags') ' not supported']);
+ 				end
+ 			end
+@@ -143,8 +141,10 @@
+ 	md.mesh.elements = index;
+ 	md.mesh.numberofelements=size(md.mesh.elements,1);
+ 	md.mesh.numberofvertices=length(md.mesh.x);
++
++	%base 2, surface 1, inflow 3, outflow 4
+ 	md.mesh.vertexonbase=zeros(md.mesh.numberofvertices,1);
+-	md.mesh.vertexonbase(find(segments(find(segmentmarkers==1),1:3)))=1;
++	md.mesh.vertexonbase(segments(find(segmentmarkers==2),1:3))=1;
+ 	md.mesh.vertexonsurface=zeros(md.mesh.numberofvertices,1);
+-	md.mesh.vertexonsurface(find(segments(find(segmentmarkers==3),1:3)))=1;
++	md.mesh.vertexonsurface(segments(find(segmentmarkers==1),1:3))=1;
+ end
Index: issm/oecreview/Archive/16554-17801/ISSM-17726-17727.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17726-17727.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17726-17727.diff	(revision 17802)
@@ -0,0 +1,20 @@
+Index: ../trunk-jpl/src/m/contrib/dassflow/importgmsh.m
+===================================================================
+--- ../trunk-jpl/src/m/contrib/dassflow/importgmsh.m	(revision 17726)
++++ ../trunk-jpl/src/m/contrib/dassflow/importgmsh.m	(revision 17727)
+@@ -134,7 +134,7 @@
+ 	md.mesh.vertexonsurface(find(vertexflags(md.mesh,3)))=1;
+ else
+ 	md=model();
+-	md.mesh=mesh3dprisms();
++	md.mesh=mesh3dtetras();
+ 	md.mesh.x = x;
+ 	md.mesh.y = y;
+ 	md.mesh.z = z;
+@@ -147,4 +147,6 @@
+ 	md.mesh.vertexonbase(segments(find(segmentmarkers==2),1:3))=1;
+ 	md.mesh.vertexonsurface=zeros(md.mesh.numberofvertices,1);
+ 	md.mesh.vertexonsurface(segments(find(segmentmarkers==1),1:3))=1;
++	md.mesh.vertexonboundary=zeros(md.mesh.numberofvertices,1);
++	md.mesh.vertexonboundary(segments(:,1:3))=1;
+ end
Index: issm/oecreview/Archive/16554-17801/ISSM-17727-17728.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17727-17728.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17727-17728.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/configs/config-linux64-skylla.sh
+===================================================================
+--- ../trunk-jpl/configs/config-linux64-skylla.sh	(revision 17727)
++++ ../trunk-jpl/configs/config-linux64-skylla.sh	(revision 17728)
+@@ -14,6 +14,7 @@
+  --with-mpi-libflags="-L$ISSM_DIR/externalpackages/mpich/install/lib/ -lmpich -lmpl " \
+  --with-petsc-arch=$ISSM_ARCH \
+  --with-blas-lapack-dir=$ISSM_DIR/externalpackages/petsc/install \
++ --with-tao-dir=$ISSM_DIR/externalpackages/tao/install/ \
+  --with-scalapack-dir=$ISSM_DIR/externalpackages/petsc/install/ \
+  --with-mumps-dir=$ISSM_DIR/externalpackages/petsc/install/ \
+  --with-fortran-lib="-L/usr/lib/gcc/x86_64-redhat-linux/4.1.2/ -lgfortran" \
Index: issm/oecreview/Archive/16554-17801/ISSM-17728-17729.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17728-17729.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17728-17729.diff	(revision 17802)
@@ -0,0 +1,66 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17728)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17729)
+@@ -106,7 +106,8 @@
+ void Tetra::FaceOnBaseIndices(int* pindex1,int* pindex2,int* pindex3){
+ 
+ 	IssmDouble values[NUMVERTICES];
+-	int        indices[4][3] = {{0,1,2},{0,1,3},{1,2,3},{2,0,3}};
++	//int        indices[4][3] = {{0,1,2},{0,1,3},{1,2,3},{2,0,3}};
++	int        indices[4][3] = {{0,1,2},{3,1,0},{3,2,1},{3,0,2}};
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	GetInputListOnVertices(&values[0],MeshVertexonbaseEnum);
+@@ -218,6 +219,36 @@
+ 	*pxyz_list = xyz_list_edge;
+ 
+ }/*}}}*/
++/*FUNCTION Tetra::GetXcoord {{{*/
++IssmDouble Tetra::GetXcoord(Gauss* gauss){
++
++	int    i;
++	IssmDouble z;
++	IssmDouble xyz_list[NUMVERTICES][3];
++	IssmDouble z_list[NUMVERTICES];
++
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	for(i=0;i<NUMVERTICES;i++) z_list[i]=xyz_list[i][0];
++	TetraRef::GetInputValue(&z,&z_list[0],(GaussTetra*)gauss,P1Enum);
++
++	return z;
++}
++/*}}}*/
++/*FUNCTION Tetra::GetYcoord {{{*/
++IssmDouble Tetra::GetYcoord(Gauss* gauss){
++
++	int    i;
++	IssmDouble z;
++	IssmDouble xyz_list[NUMVERTICES][3];
++	IssmDouble z_list[NUMVERTICES];
++
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	for(i=0;i<NUMVERTICES;i++) z_list[i]=xyz_list[i][1];
++	TetraRef::GetInputValue(&z,&z_list[0],(GaussTetra*)gauss,P1Enum);
++
++	return z;
++}
++/*}}}*/
+ /*FUNCTION Tetra::GetZcoord {{{*/
+ IssmDouble Tetra::GetZcoord(Gauss* gauss){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17728)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17729)
+@@ -111,8 +111,8 @@
+ 		IssmDouble  GetGroundedPortion(IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		void        GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");};
+ 		Node*       GetNode(int node_number){_error_("Not implemented");};
+-		IssmDouble  GetXcoord(Gauss* gauss){_error_("Not implemented");};
+-		IssmDouble  GetYcoord(Gauss* gauss){_error_("Not implemented");};
++		IssmDouble  GetXcoord(Gauss* gauss);
++		IssmDouble  GetYcoord(Gauss* gauss);
+ 		IssmDouble  GetZcoord(Gauss* gauss);
+ 		int         GetElementType(void);
+ 		Gauss*      NewGauss(void);
Index: issm/oecreview/Archive/16554-17801/ISSM-17729-17730.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17729-17730.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17729-17730.diff	(revision 17802)
@@ -0,0 +1,31 @@
+Index: ../trunk-jpl/src/m/exp/expread.py
+===================================================================
+--- ../trunk-jpl/src/m/exp/expread.py	(revision 17729)
++++ ../trunk-jpl/src/m/exp/expread.py	(revision 17730)
+@@ -29,7 +29,7 @@
+ 		raise OSError("expread error message: file '%s' not found!" % filename)
+ 
+ 	#initialize number of profile
+-	contours=[]
++	contours=OrderedDict()
+ 
+ 	#open file
+ 	fid=open(filename,'r')
+@@ -66,7 +66,7 @@
+ 
+ 		#Get number of nodes and density
+ 		A=fid.readline().split()
+-		contour['nods']   =float(A[0])
++		contour['nods']=int(A[0])
+ 		contour['density']=float(A[1])
+ 
+ 		#Get Info
+@@ -91,7 +91,7 @@
+ 		else:
+ 			contour['closed']=False
+ 
+-		contours.append(contour)
++		contours.update(contour)
+ 
+ 	#close file
+ 	fid.close()
Index: issm/oecreview/Archive/16554-17801/ISSM-17730-17731.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17730-17731.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17730-17731.diff	(revision 17802)
@@ -0,0 +1,22 @@
+Index: ../trunk-jpl/src/m/exp/expread.py
+===================================================================
+--- ../trunk-jpl/src/m/exp/expread.py	(revision 17730)
++++ ../trunk-jpl/src/m/exp/expread.py	(revision 17731)
+@@ -29,7 +29,7 @@
+ 		raise OSError("expread error message: file '%s' not found!" % filename)
+ 
+ 	#initialize number of profile
+-	contours=OrderedDict()
++	contours=[]
+ 
+ 	#open file
+ 	fid=open(filename,'r')
+@@ -91,7 +91,7 @@
+ 		else:
+ 			contour['closed']=False
+ 
+-		contours.update(contour)
++		contours.append(contour)
+ 
+ 	#close file
+ 	fid.close()
Index: issm/oecreview/Archive/16554-17801/ISSM-17731-17732.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17731-17732.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17731-17732.diff	(revision 17802)
@@ -0,0 +1,24 @@
+Index: ../trunk-jpl/src/m/classes/model.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.py	(revision 17731)
++++ ../trunk-jpl/src/m/classes/model.py	(revision 17732)
+@@ -328,7 +328,7 @@
+ 
+ 		#Edges
+ 		if m.strcmp(md.mesh.domaintype(),'2Dhorizontal'):
+-			if numpy.ndim(md2.mesh.edges)>1 and numpy.size(md2.mesh.edges,axis=1)>1:    #do not use ~isnan because there are some npy.nans...
++			if numpy.ndim(md2.mesh.edges)>1 and numpy.size(md2.mesh.edges,axis=1)>1:    #do not use ~isnan because there are some numpy.nans...
+ 				#renumber first two columns
+ 				pos=numpy.nonzero(md2.mesh.edges[:,3]!=-1)[0]
+ 				md2.mesh.edges[:  ,0]=Pnode[md2.mesh.edges[:,0]-1]
+@@ -394,8 +394,8 @@
+ 				md2.stressbalance.spcvx[nodestoflag2]=md2.inversion.vx_obs[nodestoflag2] 
+ 				md2.stressbalance.spcvy[nodestoflag2]=md2.inversion.vy_obs[nodestoflag2]
+ 			else:
+-				md2.stressbalance.spcvx[nodestoflag2]=npy.nan
+-				md2.stressbalance.spcvy[nodestoflag2]=npy.nan
++				md2.stressbalance.spcvx[nodestoflag2]=numpy.nan
++				md2.stressbalance.spcvy[nodestoflag2]=numpy.nan
+ 				print "\n!! extract warning: spc values should be checked !!\n\n"
+ 			#put 0 for vz
+ 			md2.stressbalance.spcvz[nodestoflag2]=0
Index: issm/oecreview/Archive/16554-17801/ISSM-17732-17733.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17732-17733.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17732-17733.diff	(revision 17802)
@@ -0,0 +1,170 @@
+Index: ../trunk-jpl/src/m/interp/SectionValues.m
+===================================================================
+--- ../trunk-jpl/src/m/interp/SectionValues.m	(revision 17732)
++++ ../trunk-jpl/src/m/interp/SectionValues.m	(revision 17733)
+@@ -91,9 +91,9 @@
+ 
+ 	%vertically extrude mesh
+ 
+-	%Get bed and surface for each 2d point, offset to make sure that it is inside the glacier system
++	%Get base and surface for each 2d point, offset to make sure that it is inside the glacier system
+ 	offset=10^-3;
+-	bed=InterpFromMeshToMesh2d(md.mesh.elements2d,md.mesh.x2d,md.mesh.y2d,project2d(md,md.geometry.base,1),X,Y)+offset;
++	base=InterpFromMeshToMesh2d(md.mesh.elements2d,md.mesh.x2d,md.mesh.y2d,project2d(md,md.geometry.base,1),X,Y)+offset;
+ 	surface=InterpFromMeshToMesh2d(md.mesh.elements2d,md.mesh.x2d,md.mesh.y2d,project2d(md,md.geometry.surface,1),X,Y)-offset;
+ 
+ 	%Some useful parameters
+@@ -110,7 +110,7 @@
+ 	for i=1:layers
+ 		X3(i:layers:end)=X;
+ 		Y3(i:layers:end)=Y;
+-		Z3(i:layers:end)=bed+(i-1)*(surface-bed)/(layers-1);
++		Z3(i:layers:end)=base+(i-1)*(surface-base)/(layers-1);
+ 		S3(i:layers:end)=S;
+ 
+ 		if i<layers %Build index3 with quads
+Index: ../trunk-jpl/src/m/interp/SectionValues.py
+===================================================================
+--- ../trunk-jpl/src/m/interp/SectionValues.py	(revision 0)
++++ ../trunk-jpl/src/m/interp/SectionValues.py	(revision 17733)
+@@ -0,0 +1,140 @@
++import os
++from expread import expread
++import numpy as npy
++from project2d import project2d
++#from InterpFromMesh2d import InterpFromMesh2d
++from InterpFromMeshToMesh2d import InterpFromMeshToMesh2d
++#from InterpFromMeshToMesh3d import InterpFromMeshToMesh3d
++
++def SectionValues(md,data,infile,resolution):
++	'''
++	compute the value of a field on a section
++	
++	This routine gets the value of a given field of the model on points
++	given in the file infile (Argus type file). Resolution must be a list
++	[horizontal_resolution, vertical_resolution]
++	
++	Usage:
++	[elements,x,y,z,s,data]=SectionValues(md,data,filename,resolution)
++	[elements,x,y,z,s,data]=SectionValues(md,data,profile_structure,resolution)
++	'''
++
++	if os.path.isfile(infile):
++		profile=expread(infile)[0]
++		nods=profile['nods']
++		x=profile['x']
++		y=profile['y']
++	else:
++		raise IOError('file %s not found' % infile)
++
++	#get the specified resolution
++	if len(resolution)!=2:
++		raise ValueError('SectionValues error message: Resolution must be a list [horizontal_resolution, vertical_resolution]')
++	else:
++		res_h=resolution[0]
++
++	if md.mesh.domaintype().lower() == '3d':
++		if isinstance(resolution[1],int) or isinstance(resolution[1],float):
++			res_v=resolution[1]
++		else:
++			raise ValueError('SectionValues error: resolution must be a length-2 list of integers or floats')
++
++	#initialization
++	X=npy.array([]) #X-coordinate
++	Y=npy.array([]) #Y-coordinate
++	S=npy.array([0.])  #curvilinear coordinate
++	
++	for i in xrange(nods-1):
++	
++		x_start=x[i]
++		x_end=x[i+1]
++		y_start=y[i]
++		y_end=y[i+1]
++		s_start=S[-1]
++	
++		length_segment=npy.sqrt((x_end-x_start)**2+(y_end-y_start)**2)
++		portion=npy.ceil(length_segment/res_h)
++	
++		x_segment=npy.zeros(portion)
++		y_segment=npy.zeros(portion)
++		s_segment=npy.zeros(portion)
++
++		for j in xrange(int(portion)):
++			x_segment[j]=x_start+(j-1)*(x_end-x_start)/portion
++			y_segment[j]=y_start+(j-1)*(y_end-y_start)/portion
++			s_segment[j]=s_start+j*length_segment/portion
++	
++		#plug into X and Y
++		X=npy.append(X,x_segment)
++		Y=npy.append(Y,y_segment)
++		S=npy.append(S,s_segment)
++
++	X=npy.append(X,x[nods-1])
++	Y=npy.append(Y,y[nods-1])
++	
++	#Number of nodes:
++	numberofnodes=X.shape[0]
++	
++	#Compute Z
++	Z=npy.zeros(numberofnodes)
++	
++	#New mesh and Data interpolation
++	if md.mesh.domaintype().lower() == '2d':
++	
++		#Interpolation of data on specified points
++		#data_interp=InterpFromMesh2d(md.mesh.elements,md.mesh.x,md.mesh.y,data,X,Y)[0]
++		data_interp=InterpFromMeshToMesh2d(md.mesh.elements,md.mesh.x,md.mesh.y,data,X,Y)[0]
++		#data_interp=griddata(md.mesh.x,md.mesh.y,data,X,Y)
++	
++		#Compute index
++		index=npy.array([range(1,numberofnodes),range(2,numberofnodes+1)]).T
++	
++	else:
++	
++		#vertically extrude mesh
++	
++		#Get base and surface for each 2d point, offset to make sure that it is inside the glacier system
++		offset=1.e-3
++		base=InterpFromMeshToMesh2d(md.mesh.elements2d,md.mesh.x2d,md.mesh.y2d,project2d(md,md.geometry.base,1),X,Y)[0]+offset
++		base=base.reshape(-1,)
++		surface=InterpFromMeshToMesh2d(md.mesh.elements2d,md.mesh.x2d,md.mesh.y2d,project2d(md,md.geometry.surface,1),X,Y)[0]-offset
++		surface=surface.reshape(-1,)
++	
++		#Some useful parameters
++		layers=int(npy.ceil(npy.mean(md.geometry.thickness)/res_v))
++		print 'layers=', layers
++		nodesperlayer=int(numberofnodes)
++		nodestot=int(nodesperlayer*layers)
++		elementsperlayer=int(nodesperlayer-1)
++		elementstot=int((nodesperlayer-1)*(layers-1))
++	
++		#initialization
++		X3=npy.zeros(nodesperlayer*layers) 
++		Y3=npy.zeros(nodesperlayer*layers) 
++		Z3=npy.zeros(nodesperlayer*layers) 
++		S3=npy.zeros(nodesperlayer*layers) 
++		index3=npy.zeros((elementstot,4))
++	
++		#Get new coordinates in 3d
++		for i in xrange(1,layers+1):
++			X3[i-1::layers]=X
++			Y3[i-1::layers]=Y
++			Z3[i-1::layers]=base+(i-1)*(surface-base)/(layers-1)
++			S3[i-1::layers]=S
++	
++			if i<layers-1:  #Build index3 with quads
++				ids=npy.vstack((npy.arange(i,nodestot-layers,layers),npy.arange(i+1,nodestot-layers,layers),npy.arange(i+layers+1,nodestot,layers),npy.arange(i+layers,nodestot,layers))).T
++				index3[(i-1)*elementsperlayer:i*elementsperlayer,:]=ids
++
++		#Interpolation of data on specified points
++		# TODO data_interp=InterpFromMeshToMesh3d(md.mesh.elements,md.mesh.x,md.mesh.y,md.mesh.z,data,X3,Y3,Z3,npy.nan)
++	
++		#build outputs
++		X=X3 
++		Y=Y3 
++		Z=Z3  
++		S=S3 
++
++		index=index3
++
++		return index,X,Y,Z,S,data_interp
Index: issm/oecreview/Archive/16554-17801/ISSM-17733-17734.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17733-17734.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17733-17734.diff	(revision 17802)
@@ -0,0 +1,629 @@
+Index: ../trunk-jpl/test/NightlyRun/test332.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test332.m	(revision 17733)
++++ ../trunk-jpl/test/NightlyRun/test332.m	(revision 17734)
+@@ -1,6 +1,8 @@
+ md=triangle(model(),'../Exp/Square.exp',100000.);
+ md=setmask(md,'','');
+ md=parameterize(md,'../Par/SquareSheetConstrained.par');
++md.transient=deactivateall(md.transient);
++md.transient.ishydrology=1;
+ md=setflowequation(md,'SSA','all');
+ md.cluster=generic('name',oshostname(),'np',1);
+ md.hydrology=(hydrologydc);
+Index: ../trunk-jpl/test/NightlyRun/test333.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test333.m	(revision 17733)
++++ ../trunk-jpl/test/NightlyRun/test333.m	(revision 17734)
+@@ -1,6 +1,8 @@
+ md=triangle(model(),'../Exp/Square.exp',100000.);
+ md=setmask(md,'','');
+ md=parameterize(md,'../Par/SquareSheetConstrained.par');
++md.transient=deactivateall(md.transient);
++md.transient.ishydrology=1;
+ md=setflowequation(md,'SSA','all');
+ md.cluster=generic('name',oshostname(),'np',1);
+ md.hydrology=(hydrologydc);
+@@ -25,7 +27,7 @@
+ 
+ %md.verbose.solution=1;
+ 
+-md=solve(md,HydrologySolutionEnum());
++md=solve(md,TransientSolutionEnum());
+ 
+ %store=md.constants.g*md.hydrology.sediment_porosity*md.materials.rho_freshwater*((md.hydrology.sediment_compressibility/md.hydrology.sediment_porosity)+md.hydrology.water_compressibility);
+ %sedstore=20.0*store;
+@@ -44,15 +46,15 @@
+ 	1e-13, 1e-13, 1e-13,...
+ 	1e-13, 1e-12, 8e-12,...
+ 	1e-13, 2e-12, 1e-11};
+-field_values={md.results.HydrologySolution(1).SedimentHead, ...
+-							md.results.HydrologySolution(1).EplHead,...
+-							md.results.HydrologySolution(1).SedimentHeadResidual,...
+-							md.results.HydrologySolution(4).SedimentHead,...
+-							md.results.HydrologySolution(4).EplHead,...
+-							md.results.HydrologySolution(4).SedimentHeadResidual, ...
+-							md.results.HydrologySolution(5).SedimentHead,...
+-							md.results.HydrologySolution(5).EplHead,...
+-							md.results.HydrologySolution(5).SedimentHeadResidual, ...
+-							md.results.HydrologySolution(9).SedimentHead,...
+-							md.results.HydrologySolution(9).EplHead,...
+-							md.results.HydrologySolution(9).SedimentHeadResidual};
++field_values={md.results.TransientSolution(1).SedimentHead, ...
++							md.results.TransientSolution(1).EplHead,...
++							md.results.TransientSolution(1).SedimentHeadResidual,...
++							md.results.TransientSolution(4).SedimentHead,...
++							md.results.TransientSolution(4).EplHead,...
++							md.results.TransientSolution(4).SedimentHeadResidual, ...
++							md.results.TransientSolution(5).SedimentHead,...
++							md.results.TransientSolution(5).EplHead,...
++							md.results.TransientSolution(5).SedimentHeadResidual, ...
++							md.results.TransientSolution(9).SedimentHead,...
++							md.results.TransientSolution(9).EplHead,...
++							md.results.TransientSolution(9).SedimentHeadResidual};
+Index: ../trunk-jpl/test/NightlyRun/test3300.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test3300.m	(revision 17733)
++++ ../trunk-jpl/test/NightlyRun/test3300.m	(revision 17734)
+@@ -1,6 +1,8 @@
+ md=triangle(model(),'../Exp/Square.exp',100000.);
+ md=setmask(md,'','');
+ md=parameterize(md,'../Par/SquareSheetConstrained.par');
++md.transient=deactivateall(md.transient);
++md.transient.ishydrology=1;
+ md=setflowequation(md,'SSA','all');
+ md.cluster=generic('name',oshostname(),'np',1);
+ md.hydrology=(hydrologydc);
+@@ -44,11 +46,11 @@
+ md.timestepping.time_step=0.2;
+ md.timestepping.final_time=8.0;
+ 
+-md=solve(md,HydrologySolutionEnum());
++md=solve(md,TransientSolutionEnum());
+ 
+ field_names     ={'SedimentWaterHead5','EplWaterHead5','SedimentWaterHead40','EplWaterHead40'};
+ field_tolerances={1e-13, 1e-13, 1e-13, 1e-13, 1e-13};
+-field_values={md.results.HydrologySolution(5).SedimentHead, ...
+-							md.results.HydrologySolution(5).EplHead,...
+-							md.results.HydrologySolution(40).SedimentHead,...
+-							md.results.HydrologySolution(40).EplHead};
++field_values={md.results.TransientSolution(5).SedimentHead, ...
++							md.results.TransientSolution(5).EplHead,...
++							md.results.TransientSolution(40).SedimentHead,...
++							md.results.TransientSolution(40).EplHead};
+Index: ../trunk-jpl/test/NightlyRun/test334.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test334.m	(revision 17733)
++++ ../trunk-jpl/test/NightlyRun/test334.m	(revision 17734)
+@@ -1,5 +1,7 @@
+ md=triangle(model(),'../Exp/Square.exp',100000.);
+ md=setmask(md,'','');
++md.transient=deactivateall(md.transient);
++md.transient.ishydrology=1;
+ md=parameterize(md,'../Par/SquareSheetConstrained.par');
+ md=setflowequation(md,'SSA','all');
+ md.cluster=generic('name',oshostname(),'np',1);
+Index: ../trunk-jpl/test/NightlyRun/test335.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test335.m	(revision 17733)
++++ ../trunk-jpl/test/NightlyRun/test335.m	(revision 17734)
+@@ -1,5 +1,7 @@
+ md=triangle(model(),'../Exp/Square.exp',100000.);
+ md=setmask(md,'','');
++md.transient=deactivateall(md.transient);
++md.transient.ishydrology=1;
+ md=parameterize(md,'../Par/SquareSheetConstrained.par');
+ md=setflowequation(md,'SSA','all');
+ md.cluster=generic('name',oshostname(),'np',1);
+@@ -25,7 +27,7 @@
+ 
+ %md.verbose.solution=1;
+ md=extrude(md,3,1.1);
+-md=solve(md,HydrologySolutionEnum());
++md=solve(md,TransientSolutionEnum());
+ 
+ %store=md.constants.g*md.hydrology.sediment_porosity* ...
+ %			md.materials.rho_freshwater*((md.hydrology.sediment_compressibility/md.hydrology.sediment_porosity)+md.hydrology.water_compressibility)
+@@ -50,15 +52,15 @@
+ 								 1e-13, 1e-13, 1e-13,...
+ 								 1e-13, 1e-12, 9e-12,...
+ 								 1e-13, 9e-13, 1e-11};
+-field_values={md.results.HydrologySolution(1).SedimentHead, ...
+-							md.results.HydrologySolution(1).EplHead,...
+-							md.results.HydrologySolution(1).SedimentHeadResidual,...
+-							md.results.HydrologySolution(4).SedimentHead,...
+-							md.results.HydrologySolution(4).EplHead,...
+-							md.results.HydrologySolution(4).SedimentHeadResidual, ...
+-							md.results.HydrologySolution(5).SedimentHead,...
+-							md.results.HydrologySolution(5).EplHead,...
+-							md.results.HydrologySolution(5).SedimentHeadResidual, ...
+-							md.results.HydrologySolution(9).SedimentHead,...
+-							md.results.HydrologySolution(9).EplHead,...
+-							md.results.HydrologySolution(9).SedimentHeadResidual};
++field_values={md.results.TransientSolution(1).SedimentHead, ...
++							md.results.TransientSolution(1).EplHead,...
++							md.results.TransientSolution(1).SedimentHeadResidual,...
++							md.results.TransientSolution(4).SedimentHead,...
++							md.results.TransientSolution(4).EplHead,...
++							md.results.TransientSolution(4).SedimentHeadResidual, ...
++							md.results.TransientSolution(5).SedimentHead,...
++							md.results.TransientSolution(5).EplHead,...
++							md.results.TransientSolution(5).SedimentHeadResidual, ...
++							md.results.TransientSolution(9).SedimentHead,...
++							md.results.TransientSolution(9).EplHead,...
++							md.results.TransientSolution(9).SedimentHeadResidual};
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17733)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17734)
+@@ -212,7 +212,6 @@
+ 		gauss          -> GaussPoint(ig);
+ 		basalelement   -> JacobianDeterminant(&Jdet,xyz_list,gauss);
+ 		SedTrans_input -> GetInputValue(&sediment_transmitivity,gauss);
+-		
+ 		/*Diffusivity*/
+ 		D_scalar=sediment_transmitivity*gauss->weight*Jdet;
+ 		if(dt!=0.) D_scalar=D_scalar*dt;
+@@ -671,3 +670,4 @@
+ 		element->AddInput(new BoolInput(HydrologydcMaskEplactiveEltEnum,element_active));
+ 	}
+ }/*}}}*/
++
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17733)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17734)
+@@ -280,6 +280,7 @@
+ 	TransientIsthermalEnum,
+ 	TransientIsgiaEnum,
+ 	TransientIsdamageevolutionEnum,
++	TransientIshydrologyEnum,
+ 	TransientNumRequestedOutputsEnum,
+ 	TransientRequestedOutputsEnum,
+ 	/*}}}*/
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17733)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17734)
+@@ -286,6 +286,7 @@
+ 		case TransientIsthermalEnum : return "TransientIsthermal";
+ 		case TransientIsgiaEnum : return "TransientIsgia";
+ 		case TransientIsdamageevolutionEnum : return "TransientIsdamageevolution";
++		case TransientIshydrologyEnum : return "TransientIshydrology";
+ 		case TransientNumRequestedOutputsEnum : return "TransientNumRequestedOutputs";
+ 		case TransientRequestedOutputsEnum : return "TransientRequestedOutputs";
+ 		case SurfaceforcingsEnum : return "Surfaceforcings";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17733)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17734)
+@@ -292,6 +292,7 @@
+ 	      else if (strcmp(name,"TransientIsthermal")==0) return TransientIsthermalEnum;
+ 	      else if (strcmp(name,"TransientIsgia")==0) return TransientIsgiaEnum;
+ 	      else if (strcmp(name,"TransientIsdamageevolution")==0) return TransientIsdamageevolutionEnum;
++	      else if (strcmp(name,"TransientIshydrology")==0) return TransientIshydrologyEnum;
+ 	      else if (strcmp(name,"TransientNumRequestedOutputs")==0) return TransientNumRequestedOutputsEnum;
+ 	      else if (strcmp(name,"TransientRequestedOutputs")==0) return TransientRequestedOutputsEnum;
+ 	      else if (strcmp(name,"Surfaceforcings")==0) return SurfaceforcingsEnum;
+@@ -381,11 +382,11 @@
+ 	      else if (strcmp(name,"FSvelocity")==0) return FSvelocityEnum;
+ 	      else if (strcmp(name,"FSpressure")==0) return FSpressureEnum;
+ 	      else if (strcmp(name,"Constraints")==0) return ConstraintsEnum;
+-	      else if (strcmp(name,"Loads")==0) return LoadsEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"Materials")==0) return MaterialsEnum;
++	      if (strcmp(name,"Loads")==0) return LoadsEnum;
++	      else if (strcmp(name,"Materials")==0) return MaterialsEnum;
+ 	      else if (strcmp(name,"Nodes")==0) return NodesEnum;
+ 	      else if (strcmp(name,"Contours")==0) return ContoursEnum;
+ 	      else if (strcmp(name,"Parameters")==0) return ParametersEnum;
+@@ -504,11 +505,11 @@
+ 	      else if (strcmp(name,"Vx")==0) return VxEnum;
+ 	      else if (strcmp(name,"VxPicard")==0) return VxPicardEnum;
+ 	      else if (strcmp(name,"VyAverage")==0) return VyAverageEnum;
+-	      else if (strcmp(name,"Vy")==0) return VyEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"VyPicard")==0) return VyPicardEnum;
++	      if (strcmp(name,"Vy")==0) return VyEnum;
++	      else if (strcmp(name,"VyPicard")==0) return VyPicardEnum;
+ 	      else if (strcmp(name,"Vz")==0) return VzEnum;
+ 	      else if (strcmp(name,"VzSSA")==0) return VzSSAEnum;
+ 	      else if (strcmp(name,"VzHO")==0) return VzHOEnum;
+@@ -627,11 +628,11 @@
+ 	      else if (strcmp(name,"QmuMaskGroundediceLevelset")==0) return QmuMaskGroundediceLevelsetEnum;
+ 	      else if (strcmp(name,"GaussSeg")==0) return GaussSegEnum;
+ 	      else if (strcmp(name,"GaussTria")==0) return GaussTriaEnum;
+-	      else if (strcmp(name,"GaussTetra")==0) return GaussTetraEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"GaussPenta")==0) return GaussPentaEnum;
++	      if (strcmp(name,"GaussTetra")==0) return GaussTetraEnum;
++	      else if (strcmp(name,"GaussPenta")==0) return GaussPentaEnum;
+ 	      else if (strcmp(name,"FSSolver")==0) return FSSolverEnum;
+ 	      else if (strcmp(name,"Adjoint")==0) return AdjointEnum;
+ 	      else if (strcmp(name,"Colinear")==0) return ColinearEnum;
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17733)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17734)
+@@ -71,6 +71,7 @@
+ 	parameters->AddObject(iomodel->CopyConstantObject(TransientIsgiaEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(TransientIslevelsetEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(TransientIsdamageevolutionEnum));
++	parameters->AddObject(iomodel->CopyConstantObject(TransientIshydrologyEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(MaterialsRheologyLawEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(AutodiffIsautodiffEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(QmuIsdakotaEnum));
+Index: ../trunk-jpl/src/c/cores/transient_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17733)
++++ ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17734)
+@@ -21,7 +21,7 @@
+ 	/*parameters: */
+ 	int    i;
+ 	IssmDouble starttime,finaltime,dt,yts;
+-	bool   isstressbalance,ismasstransport,isFS,isthermal,isgroundingline,isgia,islevelset,isdamageevolution;
++	bool   isstressbalance,ismasstransport,isFS,isthermal,isgroundingline,isgia,islevelset,isdamageevolution,ishydrology;
+ 	bool   save_results,dakota_analysis;
+ 	bool   time_adapt=false;
+ 	int    output_frequency;
+@@ -51,6 +51,7 @@
+ 	femmodel->parameters->FindParam(&isgroundingline,TransientIsgroundinglineEnum);
+ 	femmodel->parameters->FindParam(&islevelset,TransientIslevelsetEnum);
+ 	femmodel->parameters->FindParam(&isdamageevolution,TransientIsdamageevolutionEnum);
++	femmodel->parameters->FindParam(&ishydrology,TransientIshydrologyEnum);
+ 	femmodel->parameters->FindParam(&isFS,FlowequationIsFSEnum);
+ 	if(isgroundingline) femmodel->parameters->FindParam(&groundingline_migration,GroundinglineMigrationEnum);
+ 	femmodel->parameters->FindParam(&numoutputs,TransientNumRequestedOutputsEnum);
+@@ -94,7 +95,6 @@
+ 	}
+ 
+ 	while(time < finaltime - (yts*DBL_EPSILON)){ //make sure we run up to finaltime.
+-
+ 		/*Increment*/
+ 		if(time_adapt){
+ 			femmodel->TimeAdaptx(&dt);
+@@ -118,6 +118,11 @@
+ 			thermal_core(femmodel);
+ 		}
+ 
++		if(ishydrology){
++			if(VerboseSolution()) _printf0_("   computing water heads\n");
++			hydrology_core(femmodel);
++		}
++
+ 		if(isstressbalance){
+ 			if(VerboseSolution()) _printf0_("   computing new velocity\n");
+ 			stressbalance_core(femmodel);
+Index: ../trunk-jpl/src/c/cores/hydrology_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/hydrology_core.cpp	(revision 17733)
++++ ../trunk-jpl/src/c/cores/hydrology_core.cpp	(revision 17734)
+@@ -11,23 +11,14 @@
+ 
+ void hydrology_core(FemModel* femmodel){
+ 
+-	int i;
+-
+ 	/*intermediary*/
+-	int        step,nsteps;
+-	int        output_frequency,hydrology_model;
++	int        hydrology_model;
+ 	bool       save_results;
+ 	bool       modify_loads=true;
+ 	bool       isefficientlayer;
+-	IssmDouble starttime,final_time;
+-	IssmDouble time,dt;
+ 
+ 	/*first recover parameters common to all solutions*/
+-	femmodel->parameters->FindParam(&starttime,TimesteppingStartTimeEnum);
+-	femmodel->parameters->FindParam(&final_time,TimesteppingFinalTimeEnum);
+-	femmodel->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
+-	femmodel->parameters->FindParam(&output_frequency,SettingsOutputFrequencyEnum);
+ 	femmodel->parameters->FindParam(&hydrology_model,HydrologyModelEnum);
+ 
+ 	/*first compute slopes: */
+@@ -36,74 +27,53 @@
+ 		bedslope_core(femmodel);
+ 	}
+ 
+-	/*Compute number of time steps: */
+-	if((dt==0)|| (final_time==0)){
+-		dt=0;
+-		nsteps=1;
++	/*Using the Shreve based Model*/
++	if (hydrology_model==HydrologyshreveEnum){
++		if(VerboseSolution()) _printf0_("   computing water column\n");
++		femmodel->SetCurrentConfiguration(HydrologyShreveAnalysisEnum);
++		solutionsequence_nonlinear(femmodel,modify_loads);
++		
++		/*transfer water column thickness to old water column thickness: */
++		
++		InputDuplicatex(femmodel,WatercolumnEnum,WaterColumnOldEnum);
++		
++		if(save_results){
++			if(VerboseSolution()) _printf0_("   saving results \n");
++			int outputs[3] = {WatercolumnEnum,HydrologyWaterVxEnum,HydrologyWaterVyEnum};
++			femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],3);
++			
++			/*unload results*/
++			if(VerboseSolution()) _printf0_("   saving temporary results\n");
++			OutputResultsx(femmodel);
++		}
+ 	}
+-	else nsteps=reCast<int,IssmDouble>((final_time-starttime)/dt);
+ 
+-	/*initialize: */
+-	step=0;
+-	time=starttime;
+-
+-	/*Loop through time: */
+-	for(i=0;i<nsteps;i++){
+-
+-		if(nsteps)if(VerboseSolution()) _printf0_("time step:" << i+1 << "/" << nsteps << "\n");
+-		time+=dt;
+-		step+=1;
+-		femmodel->parameters->SetParam(time,TimeEnum);
+-		femmodel->parameters->SetParam(step,StepEnum);
+-
+-		/*Using the Shreve based Model*/
+-		if (hydrology_model==HydrologyshreveEnum){
+-			if(VerboseSolution()) _printf0_("   computing water column\n");
+-			femmodel->SetCurrentConfiguration(HydrologyShreveAnalysisEnum);
+-			solutionsequence_nonlinear(femmodel,modify_loads);
+-
+-			/*transfer water column thickness to old water column thickness: */
+-
+-			InputDuplicatex(femmodel,WatercolumnEnum,WaterColumnOldEnum);
+-
+-			if(save_results && ((i+1)%output_frequency==0 || (i+1)==nsteps || i==0)){
+-				if(VerboseSolution()) _printf0_("   saving results \n");
+-				int outputs[3] = {WatercolumnEnum,HydrologyWaterVxEnum,HydrologyWaterVyEnum};
+-				femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],3);
+-
+-				/*unload results*/
+-				if(VerboseSolution()) _printf0_("   saving temporary results\n");
+-				OutputResultsx(femmodel);
+-			}
++	/*Using the double continuum model*/
++	else if (hydrology_model==HydrologydcEnum){
++		InputDuplicatex(femmodel,SedimentHeadEnum,SedimentHeadOldEnum);
++		femmodel->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);
++		if (isefficientlayer){
++			InputDuplicatex(femmodel,EplHeadEnum,EplHeadOldEnum);
++			InputDuplicatex(femmodel,HydrologydcEplThicknessEnum,HydrologydcEplThicknessOldEnum);
+ 		}
+-
+-		/*Using the double continuum model*/
+-		else if (hydrology_model==HydrologydcEnum){
+-			InputDuplicatex(femmodel,SedimentHeadEnum,SedimentHeadOldEnum);
+-			femmodel->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);
+-			if (isefficientlayer){
+-				InputDuplicatex(femmodel,EplHeadEnum,EplHeadOldEnum);
+-				InputDuplicatex(femmodel,HydrologydcEplThicknessEnum,HydrologydcEplThicknessOldEnum);
++		
++		/*Proceed now to heads computations*/
++		if(VerboseSolution()) _printf0_("   computing water head\n");
++		solutionsequence_hydro_nonlinear(femmodel);
++		if(save_results){
++			if(VerboseSolution()) _printf0_("   saving results \n");
++			if(isefficientlayer){
++				int outputs[8] = {SedimentHeadEnum,SedimentHeadResidualEnum,EplHeadEnum,HydrologydcMaskEplactiveNodeEnum,HydrologydcMaskEplactiveEltEnum,EplHeadSlopeXEnum,EplHeadSlopeYEnum,HydrologydcEplThicknessEnum};
++				femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],8);
+ 			}
+-			
+-			/*Proceed now to heads computations*/
+-			if(VerboseSolution()) _printf0_("   computing water head\n");
+-			solutionsequence_hydro_nonlinear(femmodel);
+-			if(save_results && ((i+1)%output_frequency==0 || (i+1)==nsteps || i==0)){
+-				if(VerboseSolution()) _printf0_("   saving results \n");
+-				if(isefficientlayer){
+-					int outputs[8] = {SedimentHeadEnum,SedimentHeadResidualEnum,EplHeadEnum,HydrologydcMaskEplactiveNodeEnum,HydrologydcMaskEplactiveEltEnum,EplHeadSlopeXEnum,EplHeadSlopeYEnum,HydrologydcEplThicknessEnum};
+-					femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],8);
+-				}
+-				else{
+-					int outputs[2] = {SedimentHeadEnum,SedimentHeadResidualEnum};
+-					femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],2);
+-				}
+-				/*unload results*/
+-				if(VerboseSolution()) _printf0_("   saving temporary results\n");
+-				OutputResultsx(femmodel);
++			else{
++				int outputs[2] = {SedimentHeadEnum,SedimentHeadResidualEnum};
++				femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],2);
+ 			}
++			/*unload results*/
++			if(VerboseSolution()) _printf0_("   saving temporary results\n");
++			OutputResultsx(femmodel);
+ 		}
+-
+ 	}
+ }
++
+Index: ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp	(revision 17733)
++++ ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp	(revision 17734)
+@@ -116,7 +116,7 @@
+ 			break;
+ 
+ 		case TransientSolutionEnum:
+-			numanalyses=16;
++			numanalyses=21;
+ 			analyses=xNew<int>(numanalyses);
+ 			analyses[ 0]=StressbalanceAnalysisEnum;
+ 			analyses[ 1]=StressbalanceVerticalAnalysisEnum;
+@@ -134,6 +134,11 @@
+ 			analyses[13]=ExtrapolationAnalysisEnum;
+ 			analyses[14]=LsfReinitializationAnalysisEnum;
+ 			analyses[15]=DamageEvolutionAnalysisEnum;
++			analyses[16]=HydrologyShreveAnalysisEnum;
++			analyses[17]=HydrologyDCInefficientAnalysisEnum;
++			analyses[18]=HydrologyDCEfficientAnalysisEnum;
++			analyses[19]=L2ProjectionBaseAnalysisEnum;
++			analyses[20]=L2ProjectionEPLAnalysisEnum;
+ 			break;
+ 
+ 		default:
+Index: ../trunk-jpl/src/m/classes/transient.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/transient.py	(revision 17733)
++++ ../trunk-jpl/src/m/classes/transient.py	(revision 17734)
+@@ -19,6 +19,7 @@
+ 		self.isgia             = False
+ 		self.isdamageevolution = False
+ 		self.islevelset        = False
++		self.ishydrology       = False
+ 		self.requested_outputs = []
+ 
+ 		#set defaults
+@@ -34,6 +35,7 @@
+ 		string="%s\n%s"%(string,fielddisplay(self,'isgia','indicates if a postglacial rebound is used in the transient'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'isdamageevolution','indicates whether damage evolution is used in the transient'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'islevelset','LEVELSET METHOD DESCRIPTION'))
++		string="%s\n%s"%(string,fielddisplay(self,'ishydrology','indicates whether an hydrology model is used'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'requested_outputs','list of additional outputs requested'))
+ 		return string
+ 		#}}}
+@@ -55,6 +57,7 @@
+ 		self.isgia           = False
+ 		self.isdamageevolution = False
+ 		self.islevelset      = False
++                self.ishydrology     = False
+ 
+ 		#default output
+ 		self.requested_outputs=['default']
+@@ -73,6 +76,7 @@
+ 		md = checkfield(md,'fieldname','transient.isgia','numel',[1],'values',[0,1])
+ 		md = checkfield(md,'fieldname','transient.isdamageevolution','numel',[1],'values',[0,1])
+ 		md = checkfield(md,'fieldname','transient.islevelset','numel',[1],'values',[0,1])
++		md = checkfield(md,'fieldname','transient.ishydrology','numel',[1],'values',[0,1])
+ 		md = checkfield(md,'fieldname','transient.requested_outputs','stringrow',1)
+ 
+ 		return md
+@@ -85,6 +89,7 @@
+ 		WriteData(fid,'object',self,'fieldname','isgia','format','Boolean')
+ 		WriteData(fid,'object',self,'fieldname','isdamageevolution','format','Boolean')
+ 		WriteData(fid,'object',self,'fieldname','islevelset','format','Boolean')
++		WriteData(fid,'object',self,'fieldname','ishydrology','format','Boolean')
+ 
+ 		#process requested outputs
+ 		outputs = self.requested_outputs
+Index: ../trunk-jpl/src/m/classes/transient.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/transient.m	(revision 17733)
++++ ../trunk-jpl/src/m/classes/transient.m	(revision 17734)
+@@ -12,6 +12,7 @@
+ 		isgia             = 0;
+ 		isdamageevolution = 0;
+ 		islevelset        = 0;
++		ishydrology       = 0;
+ 		requested_outputs = {};
+ 	end
+ 	methods
+@@ -39,6 +40,21 @@
+ 					error('constructor not supported');
+ 			end
+ 		end % }}}
++		function obj = deactivateall(obj) % {{{
++
++			%full analysis: Stressbalance, Masstransport and Thermal but no groundingline migration for now
++			obj.ismasstransport = 0;
++			obj.isstressbalance = 0;
++			obj.isthermal       = 0;
++			obj.isgroundingline = 0;
++			obj.isgia           = 0;
++			obj.isdamageevolution = 0;
++			obj.islevelset      = 0;
++			obj.ishydrology     = 0;
++
++			%default output
++			obj.requested_outputs={'default'};
++		end % }}}
+ 		function obj = setdefaultparameters(obj) % {{{
+ 
+ 			%full analysis: Stressbalance, Masstransport and Thermal but no groundingline migration for now
+@@ -49,6 +65,7 @@
+ 			obj.isgia           = 0;
+ 			obj.isdamageevolution = 0;
+ 			obj.islevelset      = 0;
++			obj.ishydrology     = 0;
+ 
+ 			%default output
+ 			obj.requested_outputs={'default'};
+@@ -72,6 +89,7 @@
+ 			md = checkfield(md,'fieldname','transient.isgia','numel',[1],'values',[0 1]);
+ 			md = checkfield(md,'fieldname','transient.isdamageevolution','numel',[1],'values',[0 1]);
+ 			md = checkfield(md,'fieldname','transient.islevelset','numel',[1],'values',[0 1]);
++			md = checkfield(md,'fieldname','transient.ishydrology','numel',[1],'values',[0 1]);
+ 			md = checkfield(md,'fieldname','transient.requested_outputs','stringrow',1);
+ 
+ 		end % }}}
+@@ -85,6 +103,7 @@
+ 			fielddisplay(obj,'isgia','indicates whether a postglacial rebound model is used in the transient');
+ 			fielddisplay(obj,'isdamageevolution','indicates whether damage evolution is used in the transient');
+ 			fielddisplay(obj,'islevelset','LEVEL SET DESCRIPTION...');
++			fielddisplay(obj,'ishydrology','indicates whether an hydrology model is used');
+ 			fielddisplay(obj,'requested_outputs','list of additional outputs requested');
+ 
+ 		end % }}}
+@@ -95,6 +114,7 @@
+ 			WriteData(fid,'object',obj,'fieldname','isgroundingline','format','Boolean');
+ 			WriteData(fid,'object',obj,'fieldname','isgia','format','Boolean');
+ 			WriteData(fid,'object',obj,'fieldname','isdamageevolution','format','Boolean');
++			WriteData(fid,'object',obj,'fieldname','ishydrology','format','Boolean');
+ 			WriteData(fid,'object',obj,'fieldname','islevelset','format','Boolean');
+ 
+ 			%process requested outputs
+Index: ../trunk-jpl/src/m/contrib/paraview/exportVTK.m
+===================================================================
+--- ../trunk-jpl/src/m/contrib/paraview/exportVTK.m	(revision 17733)
++++ ../trunk-jpl/src/m/contrib/paraview/exportVTK.m	(revision 17734)
+@@ -22,7 +22,12 @@
+ mkdir(filename);
+ 
+ %get the element related variables
+-points=[model.mesh.x model.mesh.y model.mesh.z];
++if dimension(model.mesh)==2,
++	points=[model.mesh.x model.mesh.y zeros(model.mesh.numberofvertices,1)];
++else
++	points=[model.mesh.x model.mesh.y model.mesh.z];
++end
++
+ [num_of_points,dim]=size(points);
+ [num_of_elt]=size(model.mesh.elements,1);
+ [point_per_elt]=size(model.mesh.elements,2);
+Index: ../trunk-jpl/src/m/enum/TransientIshydrologyEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/TransientIshydrologyEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/TransientIshydrologyEnum.m	(revision 17734)
+@@ -0,0 +1,11 @@
++function macro=TransientIshydrologyEnum()
++%TRANSIENTISHYDROLOGYENUM - Enum of TransientIshydrology
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=TransientIshydrologyEnum()
++
++macro=StringToEnum('TransientIshydrology');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17733)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17734)
+@@ -278,6 +278,7 @@
+ def TransientIsthermalEnum(): return StringToEnum("TransientIsthermal")[0]
+ def TransientIsgiaEnum(): return StringToEnum("TransientIsgia")[0]
+ def TransientIsdamageevolutionEnum(): return StringToEnum("TransientIsdamageevolution")[0]
++def TransientIshydrologyEnum(): return StringToEnum("TransientIshydrology")[0]
+ def TransientNumRequestedOutputsEnum(): return StringToEnum("TransientNumRequestedOutputs")[0]
+ def TransientRequestedOutputsEnum(): return StringToEnum("TransientRequestedOutputs")[0]
+ def SurfaceforcingsEnum(): return StringToEnum("Surfaceforcings")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17734-17735.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17734-17735.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17734-17735.diff	(revision 17802)
@@ -0,0 +1,174 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17734)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17735)
+@@ -524,6 +524,7 @@
+ 		IssmDouble latentheat       = element->GetMaterialParameter(MaterialsLatentheatEnum);
+ 		IssmDouble epl_conductivity = element->GetMaterialParameter(HydrologydcEplConductivityEnum);
+ 		IssmDouble init_thick       =	element->GetMaterialParameter(HydrologydcEplInitialThicknessEnum);
++		IssmDouble max_thick        =	element->GetMaterialParameter(HydrologydcEplMaxThicknessEnum);
+ 		
+ 		A=pow(B,-n);
+ 		
+@@ -554,8 +555,8 @@
+ 				thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*EPLgrad2-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
+ 				
+ 				/*Take care of otherthikening*/
+-				if(thickness[i]>10.0*init_thick){
+-					thickness[i] = 10.0*init_thick;
++				if(thickness[i]>max_thick){
++					thickness[i] = max_thick;
+ 				}
+ 			}
+ 		}
+@@ -629,6 +630,7 @@
+ 	IssmDouble* residual      =xNew<IssmDouble>(numnodes);
+ 
+ 	IssmDouble init_thick =	basalelement->GetMaterialParameter(HydrologydcEplInitialThicknessEnum);
++	IssmDouble init_thick =	basalelement->GetMaterialParameter(HydrologydcEplMaximalThicknessEnum);
+ 
+ 	Input* active_element_input=basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);
+ 	active_element_input->GetInputValue(&active_element);
+@@ -652,7 +654,7 @@
+ 		/*If mask was already one, keep one*/
+ 		else if(old_active[i]>0.){
+ 			vec_mask->SetValue(basalelement->nodes[i]->Sid(),1.,INS_VAL);
+-			/*If epl thickness gets under , close the layer*/
++			/*If epl thickness gets under 10-3 initial thickness, close the layer*/
+ 			if(epl_thickness[i]<0.001*init_thick){
+ 				vec_mask->SetValue(basalelement->nodes[i]->Sid(),0.,INS_VAL);
+ 				epl_thickness[i]=init_thick;
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17734)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17735)
+@@ -115,6 +115,7 @@
+ 	HydrologydcEplCompressibilityEnum,
+ 	HydrologydcEplPorosityEnum,
+ 	HydrologydcEplInitialThicknessEnum,
++	HydrologydcEplMaxThicknessEnum,
+ 	HydrologydcEplThicknessEnum,
+ 	HydrologydcEplThicknessOldEnum,
+ 	HydrologydcEplConductivityEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17734)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17735)
+@@ -123,6 +123,7 @@
+ 		case HydrologydcEplCompressibilityEnum : return "HydrologydcEplCompressibility";
+ 		case HydrologydcEplPorosityEnum : return "HydrologydcEplPorosity";
+ 		case HydrologydcEplInitialThicknessEnum : return "HydrologydcEplInitialThickness";
++		case HydrologydcEplMaxThicknessEnum : return "HydrologydcEplMaxThickness";
+ 		case HydrologydcEplThicknessEnum : return "HydrologydcEplThickness";
+ 		case HydrologydcEplThicknessOldEnum : return "HydrologydcEplThicknessOld";
+ 		case HydrologydcEplConductivityEnum : return "HydrologydcEplConductivity";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17734)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17735)
+@@ -123,6 +123,7 @@
+ 	      else if (strcmp(name,"HydrologydcEplCompressibility")==0) return HydrologydcEplCompressibilityEnum;
+ 	      else if (strcmp(name,"HydrologydcEplPorosity")==0) return HydrologydcEplPorosityEnum;
+ 	      else if (strcmp(name,"HydrologydcEplInitialThickness")==0) return HydrologydcEplInitialThicknessEnum;
++	      else if (strcmp(name,"HydrologydcEplMaxThickness")==0) return HydrologydcEplMaxThicknessEnum;
+ 	      else if (strcmp(name,"HydrologydcEplThickness")==0) return HydrologydcEplThicknessEnum;
+ 	      else if (strcmp(name,"HydrologydcEplThicknessOld")==0) return HydrologydcEplThicknessOldEnum;
+ 	      else if (strcmp(name,"HydrologydcEplConductivity")==0) return HydrologydcEplConductivityEnum;
+@@ -135,11 +136,11 @@
+ 	      else if (strcmp(name,"HydrologydcPenaltyLock")==0) return HydrologydcPenaltyLockEnum;
+ 	      else if (strcmp(name,"HydrologydcBasalMoulinInput")==0) return HydrologydcBasalMoulinInputEnum;
+ 	      else if (strcmp(name,"HydrologyLayer")==0) return HydrologyLayerEnum;
+-	      else if (strcmp(name,"HydrologySediment")==0) return HydrologySedimentEnum;
+          else stage=2;
+    }
+    if(stage==2){
+-	      if (strcmp(name,"HydrologyEfficient")==0) return HydrologyEfficientEnum;
++	      if (strcmp(name,"HydrologySediment")==0) return HydrologySedimentEnum;
++	      else if (strcmp(name,"HydrologyEfficient")==0) return HydrologyEfficientEnum;
+ 	      else if (strcmp(name,"HydrologySedimentKmax")==0) return HydrologySedimentKmaxEnum;
+ 	      else if (strcmp(name,"IndependentObject")==0) return IndependentObjectEnum;
+ 	      else if (strcmp(name,"InversionControlParameters")==0) return InversionControlParametersEnum;
+@@ -258,11 +259,11 @@
+ 	      else if (strcmp(name,"DebugProfiling")==0) return DebugProfilingEnum;
+ 	      else if (strcmp(name,"ProfilingCurrentMem")==0) return ProfilingCurrentMemEnum;
+ 	      else if (strcmp(name,"ProfilingCurrentFlops")==0) return ProfilingCurrentFlopsEnum;
+-	      else if (strcmp(name,"ProfilingSolutionTime")==0) return ProfilingSolutionTimeEnum;
+          else stage=3;
+    }
+    if(stage==3){
+-	      if (strcmp(name,"MaxIterationConvergenceFlag")==0) return MaxIterationConvergenceFlagEnum;
++	      if (strcmp(name,"ProfilingSolutionTime")==0) return ProfilingSolutionTimeEnum;
++	      else if (strcmp(name,"MaxIterationConvergenceFlag")==0) return MaxIterationConvergenceFlagEnum;
+ 	      else if (strcmp(name,"SteadystateMaxiter")==0) return SteadystateMaxiterEnum;
+ 	      else if (strcmp(name,"SteadystateNumRequestedOutputs")==0) return SteadystateNumRequestedOutputsEnum;
+ 	      else if (strcmp(name,"SteadystateReltol")==0) return SteadystateReltolEnum;
+@@ -381,11 +382,11 @@
+ 	      else if (strcmp(name,"FSApproximation")==0) return FSApproximationEnum;
+ 	      else if (strcmp(name,"FSvelocity")==0) return FSvelocityEnum;
+ 	      else if (strcmp(name,"FSpressure")==0) return FSpressureEnum;
+-	      else if (strcmp(name,"Constraints")==0) return ConstraintsEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"Loads")==0) return LoadsEnum;
++	      if (strcmp(name,"Constraints")==0) return ConstraintsEnum;
++	      else if (strcmp(name,"Loads")==0) return LoadsEnum;
+ 	      else if (strcmp(name,"Materials")==0) return MaterialsEnum;
+ 	      else if (strcmp(name,"Nodes")==0) return NodesEnum;
+ 	      else if (strcmp(name,"Contours")==0) return ContoursEnum;
+@@ -504,11 +505,11 @@
+ 	      else if (strcmp(name,"VxAverage")==0) return VxAverageEnum;
+ 	      else if (strcmp(name,"Vx")==0) return VxEnum;
+ 	      else if (strcmp(name,"VxPicard")==0) return VxPicardEnum;
+-	      else if (strcmp(name,"VyAverage")==0) return VyAverageEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"Vy")==0) return VyEnum;
++	      if (strcmp(name,"VyAverage")==0) return VyAverageEnum;
++	      else if (strcmp(name,"Vy")==0) return VyEnum;
+ 	      else if (strcmp(name,"VyPicard")==0) return VyPicardEnum;
+ 	      else if (strcmp(name,"Vz")==0) return VzEnum;
+ 	      else if (strcmp(name,"VzSSA")==0) return VzSSAEnum;
+@@ -627,11 +628,11 @@
+ 	      else if (strcmp(name,"MaskGroundediceLevelset")==0) return MaskGroundediceLevelsetEnum;
+ 	      else if (strcmp(name,"QmuMaskGroundediceLevelset")==0) return QmuMaskGroundediceLevelsetEnum;
+ 	      else if (strcmp(name,"GaussSeg")==0) return GaussSegEnum;
+-	      else if (strcmp(name,"GaussTria")==0) return GaussTriaEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"GaussTetra")==0) return GaussTetraEnum;
++	      if (strcmp(name,"GaussTria")==0) return GaussTriaEnum;
++	      else if (strcmp(name,"GaussTetra")==0) return GaussTetraEnum;
+ 	      else if (strcmp(name,"GaussPenta")==0) return GaussPentaEnum;
+ 	      else if (strcmp(name,"FSSolver")==0) return FSSolverEnum;
+ 	      else if (strcmp(name,"Adjoint")==0) return AdjointEnum;
+Index: ../trunk-jpl/src/m/enum/HydrologydcEplMaxThicknessEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/HydrologydcEplMaxThicknessEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/HydrologydcEplMaxThicknessEnum.m	(revision 17735)
+@@ -0,0 +1,11 @@
++function macro=HydrologydcEplMaxThicknessEnum()
++%HYDROLOGYDCEPLMAXTHICKNESSENUM - Enum of HydrologydcEplMaxThickness
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=HydrologydcEplMaxThicknessEnum()
++
++macro=StringToEnum('HydrologydcEplMaxThickness');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17734)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17735)
+@@ -115,6 +115,7 @@
+ def HydrologydcEplCompressibilityEnum(): return StringToEnum("HydrologydcEplCompressibility")[0]
+ def HydrologydcEplPorosityEnum(): return StringToEnum("HydrologydcEplPorosity")[0]
+ def HydrologydcEplInitialThicknessEnum(): return StringToEnum("HydrologydcEplInitialThickness")[0]
++def HydrologydcEplMaxThicknessEnum(): return StringToEnum("HydrologydcEplMaxThickness")[0]
+ def HydrologydcEplThicknessEnum(): return StringToEnum("HydrologydcEplThickness")[0]
+ def HydrologydcEplThicknessOldEnum(): return StringToEnum("HydrologydcEplThicknessOld")[0]
+ def HydrologydcEplConductivityEnum(): return StringToEnum("HydrologydcEplConductivity")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17735-17736.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17735-17736.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17735-17736.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17735)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17736)
+@@ -630,7 +630,6 @@
+ 	IssmDouble* residual      =xNew<IssmDouble>(numnodes);
+ 
+ 	IssmDouble init_thick =	basalelement->GetMaterialParameter(HydrologydcEplInitialThicknessEnum);
+-	IssmDouble init_thick =	basalelement->GetMaterialParameter(HydrologydcEplMaximalThicknessEnum);
+ 
+ 	Input* active_element_input=basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);
+ 	active_element_input->GetInputValue(&active_element);
Index: issm/oecreview/Archive/16554-17801/ISSM-17736-17737.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17736-17737.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17736-17737.diff	(revision 17802)
@@ -0,0 +1,33 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp	(revision 17736)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp	(revision 17737)
+@@ -15,7 +15,7 @@
+ void ModelProcessorx(Elements** pelements, Nodes** pnodes, Vertices** pvertices, Materials** pmaterials, Constraints** pconstraints, Loads** ploads, Parameters** pparameters, FILE* IOMODEL,FILE* toolkitfile, char* rootpath,const int solution_enum,const int nummodels,const int* analysis_enum_list){
+ 
+ 	int   i,analysis_enum,verbose;
+-	bool  isthermal,ismasstransport,isstressbalance,isgroundingline,isenthalpy,islevelset,isdamage;
++	bool  isthermal,ismasstransport,isstressbalance,isgroundingline,isenthalpy,islevelset,isdamage,ishydrology;
+ 
+ 	/*Initialize datasets*/
+ 	Elements    *elements    = new Elements();
+@@ -38,6 +38,7 @@
+ 	iomodel->Constant(&isstressbalance,TransientIsstressbalanceEnum);
+ 	iomodel->Constant(&isgroundingline,TransientIsgroundinglineEnum);
+ 	iomodel->Constant(&isdamage,TransientIsdamageevolutionEnum);
++	iomodel->Constant(&ishydrology,TransientIshydrologyEnum);
+ 
+ 	SetVerbosityLevel(verbose);
+ 
+@@ -77,8 +78,10 @@
+ 		if(solution_enum==TransientSolutionEnum && analysis_enum==LevelsetAnalysisEnum && islevelset==false) continue;
+ 		if(solution_enum==TransientSolutionEnum && analysis_enum==ExtrapolationAnalysisEnum && islevelset==false) continue;
+ 		if(solution_enum==TransientSolutionEnum && analysis_enum==LsfReinitializationAnalysisEnum && islevelset==false) continue;
++		if(solution_enum==TransientSolutionEnum && analysis_enum==HydrologyShreveAnalysisEnum && ishydrology==false) continue;
++		if(solution_enum==TransientSolutionEnum && analysis_enum==HydrologyDCEfficientAnalysisEnum && ishydrology==false) continue;
++		if(solution_enum==TransientSolutionEnum && analysis_enum==HydrologyDCInefficientAnalysisEnum && ishydrology==false) continue;
+ 
+-
+ 		if(VerboseMProcessor()) _printf0_("   creating datasets for analysis " << EnumToStringx(analysis_enum) << "\n");
+ 		Analysis* analysis = EnumToAnalysis(analysis_enum);
+ 		analysis->UpdateParameters(parameters,iomodel,solution_enum,analysis_enum);
Index: issm/oecreview/Archive/16554-17801/ISSM-17737-17738.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17737-17738.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17737-17738.diff	(revision 17802)
@@ -0,0 +1,144 @@
+Index: ../trunk-jpl/test/NightlyRun/test333.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test333.m	(revision 17737)
++++ ../trunk-jpl/test/NightlyRun/test333.m	(revision 17738)
+@@ -22,6 +22,7 @@
+ md.basalforcings.melting_rate = 2.0*ones(md.mesh.numberofvertices,1);
+ md.hydrology.epl_conductivity=30;
+ md.hydrology.epl_initial_thickness=1;
++md.hydrology.epl_max_thickness=1;
+ md.timestepping.time_step=0.2;
+ md.timestepping.final_time=2.0;
+ 
+Index: ../trunk-jpl/test/NightlyRun/test3300.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test3300.m	(revision 17737)
++++ ../trunk-jpl/test/NightlyRun/test3300.m	(revision 17738)
+@@ -23,6 +23,7 @@
+ 
+ md.hydrology.epl_conductivity=1.5e-2;
+ md.hydrology.epl_initial_thickness=1.0;
++md.hydrology.epl_max_thickness=5.0;
+ 
+ md.hydrology.transfer_flag=1;
+ md.hydrology.leakage_factor=500;
+Index: ../trunk-jpl/test/NightlyRun/test335.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test335.m	(revision 17737)
++++ ../trunk-jpl/test/NightlyRun/test335.m	(revision 17738)
+@@ -22,6 +22,7 @@
+ md.basalforcings.melting_rate = 2.0*ones(md.mesh.numberofvertices,1);
+ md.hydrology.epl_conductivity=30;
+ md.hydrology.epl_initial_thickness=1;
++md.hydrology.epl_max_thickness=1;
+ md.timestepping.time_step=0.2;
+ md.timestepping.final_time=2.0;
+ 
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17737)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17738)
+@@ -53,6 +53,7 @@
+ 	iomodel->FetchDataToInput(elements,EplHeadEnum);
+ 	iomodel->FetchDataToInput(elements,SedimentHeadEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcEplInitialThicknessEnum);
++	iomodel->FetchDataToInput(elements,HydrologydcEplMaxThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcSedimentTransmitivityEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcEplThicknessEnum);
+ 	if(iomodel->domaintype==Domain3DEnum) iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 17737)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 17738)
+@@ -78,6 +78,7 @@
+ 				iomodel->Constant(&this->epl_compressibility,HydrologydcEplCompressibilityEnum);
+ 				iomodel->Constant(&this->epl_porosity,HydrologydcEplPorosityEnum);
+ 				iomodel->Constant(&this->epl_init_thickness,HydrologydcEplInitialThicknessEnum);
++				iomodel->Constant(&this->epl_max_thickness,HydrologydcEplMaxThicknessEnum);
+ 				iomodel->Constant(&this->epl_conductivity,HydrologydcEplConductivityEnum);
+ 		}
+ 	}
+@@ -262,6 +263,7 @@
+ 		case HydrologydcEplCompressibilityEnum:      return this->epl_compressibility;
+ 		case HydrologydcEplConductivityEnum:         return this->epl_conductivity;
+ 		case HydrologydcEplInitialThicknessEnum:     return this->epl_init_thickness;
++		case HydrologydcEplMaxThicknessEnum:         return this->epl_max_thickness;
+ 		case HydrologydcWaterCompressibilityEnum:    return this->water_compressibility;
+ 		case HydrologyshreveCREnum:                  return this->hydro_CR;
+ 		case HydrologyshreveKnEnum:                  return this->hydro_kn;
+@@ -402,6 +404,11 @@
+ 	return epl_init_thickness;		 
+ }		 
+ /*}}}*/	
++/*FUNCTION Matpar::GetEplMaxThickness {{{*/
++IssmDouble Matpar::GetEplMaxThickness(){
++	return epl_max_thickness;		 
++}		 
++/*}}}*/	
+ /*FUNCTION Matpar::GetEplConductivity {{{*/
+ IssmDouble Matpar::GetEplConductivity(){
+ 	return epl_conductivity;		 
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 17737)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 17738)
+@@ -48,6 +48,7 @@
+ 		IssmDouble  epl_compressibility;
+ 		IssmDouble  epl_porosity;
+ 		IssmDouble  epl_init_thickness;
++		IssmDouble  epl_max_thickness;
+ 		IssmDouble  epl_conductivity;	 
+ 
+ 		/*gia: */
+@@ -120,6 +121,7 @@
+ 		IssmDouble GetSedimentThickness();
+ 		IssmDouble GetEplConductivity();
+ 		IssmDouble GetEplInitialThickness();
++		IssmDouble GetEplMaxThickness();
+ 		IssmDouble TMeltingPoint(IssmDouble pressure);
+ 		IssmDouble PureIceEnthalpy(IssmDouble pressure);
+ 		IssmDouble GetEnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure);
+Index: ../trunk-jpl/src/m/classes/hydrologydc.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/hydrologydc.m	(revision 17737)
++++ ../trunk-jpl/src/m/classes/hydrologydc.m	(revision 17738)
+@@ -29,6 +29,7 @@
+ 		epl_compressibility      = 0;
+ 		epl_porosity             = 0;
+ 		epl_initial_thickness    = 0;
++		epl_max_thickness    = 0;
+ 		epl_conductivity         = 0;
+   end
+ 	methods
+@@ -71,6 +72,7 @@
+ 			obj.epl_compressibility      = 1.0e-08;
+ 			obj.epl_porosity             = 0.4;
+ 			obj.epl_initial_thickness    = 1.0;
++			obj.epl_max_thickness    = 5.0;
+ 			obj.epl_conductivity         = 8.0e-02;
+ 
+ 		end 
+@@ -109,6 +111,7 @@
+ 				md = checkfield(md,'fieldname','hydrology.epl_compressibility','>',0,'numel',1);
+ 				md = checkfield(md,'fieldname','hydrology.epl_porosity','>',0,'numel',1);
+ 				md = checkfield(md,'fieldname','hydrology.epl_initial_thickness','>',0,'numel',1);
++				md = checkfield(md,'fieldname','hydrology.epl_max_thickness','>',0,'numel',1);
+ 				md = checkfield(md,'fieldname','hydrology.epl_conductivity','>',0,'numel',1);
+ 	    end
+ 		end 
+@@ -152,6 +155,7 @@
+ 				fielddisplay(obj,'epl_compressibility','epl compressibility [Pa^-1]');
+ 				fielddisplay(obj,'epl_porosity','epl [dimensionless]');
+ 				fielddisplay(obj,'epl_initial_thickness','epl initial thickness [m]');
++				fielddisplay(obj,'epl_max_thickness','epl maximal thickness [m]');
+ 				fielddisplay(obj,'epl_conductivity','epl conductivity [m^2/s]');
+ 	    end
+ 
+@@ -188,6 +192,7 @@
+ 				WriteData(fid,'object',obj,'fieldname','epl_compressibility','format','Double');			
+ 				WriteData(fid,'object',obj,'fieldname','epl_porosity','format','Double');			
+ 				WriteData(fid,'object',obj,'fieldname','epl_initial_thickness','format','Double');
++				WriteData(fid,'object',obj,'fieldname','epl_max_thickness','format','Double');
+ 				WriteData(fid,'object',obj,'fieldname','epl_conductivity','format','Double');
+ 			end
+ 		end 
Index: issm/oecreview/Archive/16554-17801/ISSM-17738-17739.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17738-17739.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17738-17739.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp	(revision 17738)
++++ ../trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp	(revision 17739)
+@@ -137,7 +137,7 @@
+ 			z=y;
+ 			return -10*PI*p*sqrt((9.0L/25.0L)*pow(PI, 2)*pow(p, 2)*pow(cos(2*PI*p*x), 2) + 1)*(9*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*pow(cos(2*PI*p*x), 2)*pow(cos(PI*p*z), 2) - 9*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*z), 2)*pow(cos(PI*p*x), 2)*pow(cos(2*PI*p*x), 2) + 90*PI*p*sin(PI*p*x)*sin(PI*p*z)*cos(PI*p*x)*cos(2*PI*p*x)*cos(PI*p*z) - 25*pow(sin(PI*p*x), 2)*pow(cos(PI*p*z), 2) + 25*pow(sin(PI*p*z), 2)*pow(cos(PI*p*x), 2))/((9*pow(PI, 2)*pow(p, 2)*pow(cos(2*PI*p*x), 2) + 25)*(3*PI*p*sin(PI*p*z)*cos(PI*p*x)*cos(2*PI*p*x) - 5*sin(PI*p*x)*cos(PI*p*z))*sin(PI*p*x)*sin(PI*p*z));
+ 		case 18:
+-			return (120.0L/109.0L)*sqrt(109)/(10*x - 3*z);
++			return (120.0L/109.0L)*sqrt(109.)/(10*x - 3*z);
+ 		default:
+ 			_error_("FS analytical solution"<<testid<<" not implemented yet");
+ 	}
Index: issm/oecreview/Archive/16554-17801/ISSM-17739-17740.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17739-17740.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17739-17740.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/shared/Numerics/NewtonSolveDnorm.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Numerics/NewtonSolveDnorm.cpp	(revision 17739)
++++ ../trunk-jpl/src/c/shared/Numerics/NewtonSolveDnorm.cpp	(revision 17740)
+@@ -31,7 +31,7 @@
+ 	while(true){
+ 
+ 		/*Newton step*/
+-		y2 = y1 - (c1*pow(pow(10.,y1),s-1.) + c2*pow(10.,y1) - c3)/((s-1)*c1*log(10)*pow(pow(10.,y1),s-1.) + c2*log(10.)*pow(10.,y1));
++		y2 = y1 - (c1*pow(pow(10.,y1),s-1.) + c2*pow(10.,y1) - c3)/((s-1)*c1*log(10.)*pow(pow(10.,y1),s-1.) + c2*log(10.)*pow(10.,y1));
+ 
+ 		if( fabs(y2-y1)/(fabs(y2))<threshold ){
+ 			break;
Index: issm/oecreview/Archive/16554-17801/ISSM-17740-17741.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17740-17741.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17740-17741.diff	(revision 17802)
@@ -0,0 +1,23 @@
+Index: ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp	(revision 17740)
++++ ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp	(revision 17741)
+@@ -116,7 +116,7 @@
+ 			break;
+ 
+ 		case TransientSolutionEnum:
+-			numanalyses=21;
++			numanalyses=20;
+ 			analyses=xNew<int>(numanalyses);
+ 			analyses[ 0]=StressbalanceAnalysisEnum;
+ 			analyses[ 1]=StressbalanceVerticalAnalysisEnum;
+@@ -137,8 +137,7 @@
+ 			analyses[16]=HydrologyShreveAnalysisEnum;
+ 			analyses[17]=HydrologyDCInefficientAnalysisEnum;
+ 			analyses[18]=HydrologyDCEfficientAnalysisEnum;
+-			analyses[19]=L2ProjectionBaseAnalysisEnum;
+-			analyses[20]=L2ProjectionEPLAnalysisEnum;
++			analyses[19]=L2ProjectionEPLAnalysisEnum;
+ 			break;
+ 
+ 		default:
Index: issm/oecreview/Archive/16554-17801/ISSM-17741-17742.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17741-17742.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17741-17742.diff	(revision 17802)
@@ -0,0 +1,276 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17741)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17742)
+@@ -302,7 +302,7 @@
+ 	Input* epl_head_input    = basalelement->GetInput(EplHeadEnum);
+ 	Input* sed_trans_input   = basalelement->GetInput(HydrologydcSedimentTransmitivityEnum);
+ 	Input* thickness_input   = basalelement->GetInput(ThicknessEnum);
+-	Input* base_input         = basalelement->GetInput(BaseEnum);
++	Input* base_input        = basalelement->GetInput(BaseEnum);
+ 	Input* water_input       = basalelement->GetInput(BasalforcingsMeltingRateEnum);    _assert_(water_input);
+ 	if(dt!= 0.){old_wh_input = basalelement->GetInput(SedimentHeadOldEnum);             _assert_(old_wh_input);}
+ 
+@@ -410,6 +410,7 @@
+ 	/*Fetch dof list and allocate solution vector*/
+ 	basalelement->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+ 	IssmDouble* values   = xNew<IssmDouble>(numnodes);
++	IssmDouble* pressure = xNew<IssmDouble>(numnodes);
+ 	IssmDouble* residual = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Use the dof list to index into the solution vector: */
+@@ -418,31 +419,53 @@
+ 		if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector");
+ 	}
+ 
+-	/*If converged keep the residual in mind*/
+-	element->GetInputValue(&converged,ConvergedEnum);
++	/*If converged keep the residual in mind, also compute effective pressure*/
++	basalelement->GetInputValue(&converged,ConvergedEnum);
+ 
+ 	/*Get inputs*/
+ 	if(converged){
+ 		IssmDouble penalty_factor,kmax,kappa,h_max;
+-		element->FindParam(&kmax,HydrologySedimentKmaxEnum);
+-		element->FindParam(&penalty_factor,HydrologydcPenaltyFactorEnum);
++		IssmDouble rho_freshwater,rho_ice;
++		IssmDouble g;
++		IssmDouble* thickness = xNew<IssmDouble>(numnodes);
++		IssmDouble* base      = xNew<IssmDouble>(numnodes);
+ 
++		basalelement->FindParam(&kmax,HydrologySedimentKmaxEnum);
++		basalelement->FindParam(&penalty_factor,HydrologydcPenaltyFactorEnum);
++		basalelement->GetMaterialParameter(MaterialsRhoFreshwaterEnum);
++		basalelement->GetMaterialParameter(MaterialsRhoIceEnum);
++		basalelement->GetMaterialParameter(ConstantsGEnum);
++		
++		basalelement->GetInputListOnVertices(thickness,ThicknessEnum);
++		basalelement->GetInputListOnVertices(base,BaseEnum);
++
+ 		kappa=kmax*pow(10.,penalty_factor);
+ 
+ 		for(int i=0;i<numnodes;i++){
++
+ 			GetHydrologyDCInefficientHmax(&h_max,basalelement,basalelement->GetNode(i));
+-			if(values[i]>h_max) residual[i] = kappa*(values[i]-h_max);
+-			else                residual[i] = 0.;
++			if(values[i]>h_max) {
++				residual[i] = kappa*(values[i]-h_max);
++				pressure[i]=(rho_ice*g*thickness[i])-(rho_freshwater*g*(values[i]-base[i]));
++			}
++			else{
++				residual[i] = 0.;
++				pressure[i]=(rho_ice*g*thickness[i])-(rho_freshwater*g*(h_max-base[i]));
++			}
+ 		}
++		xDelete<IssmDouble>(thickness);
++		xDelete<IssmDouble>(base);
+ 	}
+ 
+ 	/*Add input to the element: */
+ 	element->AddBasalInput(SedimentHeadEnum,values,P1Enum);
+ 	element->AddBasalInput(SedimentHeadResidualEnum,residual,P1Enum);
++	element->AddBasalInput(EffectivePressureEnum,pressure,P1Enum);
+ 
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(values);
+ 	xDelete<IssmDouble>(residual);
++	xDelete<IssmDouble>(pressure);
+ 	xDelete<int>(doflist);
+ 	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17741)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17742)
+@@ -97,6 +97,7 @@
+ 	SedimentHeadEnum,
+ 	SedimentHeadOldEnum,
+ 	SedimentHeadResidualEnum,
++	EffectivePressureEnum,
+ 	EplHeadEnum,
+ 	EplHeadOldEnum,
+   EplHeadSlopeXEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17741)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17742)
+@@ -105,6 +105,7 @@
+ 		case SedimentHeadEnum : return "SedimentHead";
+ 		case SedimentHeadOldEnum : return "SedimentHeadOld";
+ 		case SedimentHeadResidualEnum : return "SedimentHeadResidual";
++		case EffectivePressureEnum : return "EffectivePressure";
+ 		case EplHeadEnum : return "EplHead";
+ 		case EplHeadOldEnum : return "EplHeadOld";
+ 		case EplHeadSlopeXEnum : return "EplHeadSlopeX";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17741)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17742)
+@@ -105,6 +105,7 @@
+ 	      else if (strcmp(name,"SedimentHead")==0) return SedimentHeadEnum;
+ 	      else if (strcmp(name,"SedimentHeadOld")==0) return SedimentHeadOldEnum;
+ 	      else if (strcmp(name,"SedimentHeadResidual")==0) return SedimentHeadResidualEnum;
++	      else if (strcmp(name,"EffectivePressure")==0) return EffectivePressureEnum;
+ 	      else if (strcmp(name,"EplHead")==0) return EplHeadEnum;
+ 	      else if (strcmp(name,"EplHeadOld")==0) return EplHeadOldEnum;
+ 	      else if (strcmp(name,"EplHeadSlopeX")==0) return EplHeadSlopeXEnum;
+@@ -135,11 +136,11 @@
+ 	      else if (strcmp(name,"HydrologydcPenaltyFactor")==0) return HydrologydcPenaltyFactorEnum;
+ 	      else if (strcmp(name,"HydrologydcPenaltyLock")==0) return HydrologydcPenaltyLockEnum;
+ 	      else if (strcmp(name,"HydrologydcBasalMoulinInput")==0) return HydrologydcBasalMoulinInputEnum;
+-	      else if (strcmp(name,"HydrologyLayer")==0) return HydrologyLayerEnum;
+          else stage=2;
+    }
+    if(stage==2){
+-	      if (strcmp(name,"HydrologySediment")==0) return HydrologySedimentEnum;
++	      if (strcmp(name,"HydrologyLayer")==0) return HydrologyLayerEnum;
++	      else if (strcmp(name,"HydrologySediment")==0) return HydrologySedimentEnum;
+ 	      else if (strcmp(name,"HydrologyEfficient")==0) return HydrologyEfficientEnum;
+ 	      else if (strcmp(name,"HydrologySedimentKmax")==0) return HydrologySedimentKmaxEnum;
+ 	      else if (strcmp(name,"IndependentObject")==0) return IndependentObjectEnum;
+@@ -258,11 +259,11 @@
+ 	      else if (strcmp(name,"SettingsWaitonlock")==0) return SettingsWaitonlockEnum;
+ 	      else if (strcmp(name,"DebugProfiling")==0) return DebugProfilingEnum;
+ 	      else if (strcmp(name,"ProfilingCurrentMem")==0) return ProfilingCurrentMemEnum;
+-	      else if (strcmp(name,"ProfilingCurrentFlops")==0) return ProfilingCurrentFlopsEnum;
+          else stage=3;
+    }
+    if(stage==3){
+-	      if (strcmp(name,"ProfilingSolutionTime")==0) return ProfilingSolutionTimeEnum;
++	      if (strcmp(name,"ProfilingCurrentFlops")==0) return ProfilingCurrentFlopsEnum;
++	      else if (strcmp(name,"ProfilingSolutionTime")==0) return ProfilingSolutionTimeEnum;
+ 	      else if (strcmp(name,"MaxIterationConvergenceFlag")==0) return MaxIterationConvergenceFlagEnum;
+ 	      else if (strcmp(name,"SteadystateMaxiter")==0) return SteadystateMaxiterEnum;
+ 	      else if (strcmp(name,"SteadystateNumRequestedOutputs")==0) return SteadystateNumRequestedOutputsEnum;
+@@ -381,11 +382,11 @@
+ 	      else if (strcmp(name,"HOFSApproximation")==0) return HOFSApproximationEnum;
+ 	      else if (strcmp(name,"FSApproximation")==0) return FSApproximationEnum;
+ 	      else if (strcmp(name,"FSvelocity")==0) return FSvelocityEnum;
+-	      else if (strcmp(name,"FSpressure")==0) return FSpressureEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"Constraints")==0) return ConstraintsEnum;
++	      if (strcmp(name,"FSpressure")==0) return FSpressureEnum;
++	      else if (strcmp(name,"Constraints")==0) return ConstraintsEnum;
+ 	      else if (strcmp(name,"Loads")==0) return LoadsEnum;
+ 	      else if (strcmp(name,"Materials")==0) return MaterialsEnum;
+ 	      else if (strcmp(name,"Nodes")==0) return NodesEnum;
+@@ -504,11 +505,11 @@
+ 	      else if (strcmp(name,"Velocity")==0) return VelocityEnum;
+ 	      else if (strcmp(name,"VxAverage")==0) return VxAverageEnum;
+ 	      else if (strcmp(name,"Vx")==0) return VxEnum;
+-	      else if (strcmp(name,"VxPicard")==0) return VxPicardEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"VyAverage")==0) return VyAverageEnum;
++	      if (strcmp(name,"VxPicard")==0) return VxPicardEnum;
++	      else if (strcmp(name,"VyAverage")==0) return VyAverageEnum;
+ 	      else if (strcmp(name,"Vy")==0) return VyEnum;
+ 	      else if (strcmp(name,"VyPicard")==0) return VyPicardEnum;
+ 	      else if (strcmp(name,"Vz")==0) return VzEnum;
+@@ -627,11 +628,11 @@
+ 	      else if (strcmp(name,"Contact")==0) return ContactEnum;
+ 	      else if (strcmp(name,"MaskGroundediceLevelset")==0) return MaskGroundediceLevelsetEnum;
+ 	      else if (strcmp(name,"QmuMaskGroundediceLevelset")==0) return QmuMaskGroundediceLevelsetEnum;
+-	      else if (strcmp(name,"GaussSeg")==0) return GaussSegEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"GaussTria")==0) return GaussTriaEnum;
++	      if (strcmp(name,"GaussSeg")==0) return GaussSegEnum;
++	      else if (strcmp(name,"GaussTria")==0) return GaussTriaEnum;
+ 	      else if (strcmp(name,"GaussTetra")==0) return GaussTetraEnum;
+ 	      else if (strcmp(name,"GaussPenta")==0) return GaussPentaEnum;
+ 	      else if (strcmp(name,"FSSolver")==0) return FSSolverEnum;
+Index: ../trunk-jpl/src/c/cores/hydrology_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/hydrology_core.cpp	(revision 17741)
++++ ../trunk-jpl/src/c/cores/hydrology_core.cpp	(revision 17742)
+@@ -63,12 +63,12 @@
+ 		if(save_results){
+ 			if(VerboseSolution()) _printf0_("   saving results \n");
+ 			if(isefficientlayer){
+-				int outputs[8] = {SedimentHeadEnum,SedimentHeadResidualEnum,EplHeadEnum,HydrologydcMaskEplactiveNodeEnum,HydrologydcMaskEplactiveEltEnum,EplHeadSlopeXEnum,EplHeadSlopeYEnum,HydrologydcEplThicknessEnum};
+-				femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],8);
++				int outputs[9] = {SedimentHeadEnum,SedimentHeadResidualEnum,EplHeadEnum,HydrologydcMaskEplactiveNodeEnum,HydrologydcMaskEplactiveEltEnum,EplHeadSlopeXEnum,EplHeadSlopeYEnum,HydrologydcEplThicknessEnum,EffectivePressureEnum};
++				femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],9);
+ 			}
+ 			else{
+-				int outputs[2] = {SedimentHeadEnum,SedimentHeadResidualEnum};
+-				femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],2);
++				int outputs[3] = {SedimentHeadEnum,SedimentHeadResidualEnum,EffectivePressureEnum};
++				femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],3);
+ 			}
+ 			/*unload results*/
+ 			if(VerboseSolution()) _printf0_("   saving temporary results\n");
+Index: ../trunk-jpl/src/m/classes/transient.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/transient.py	(revision 17741)
++++ ../trunk-jpl/src/m/classes/transient.py	(revision 17742)
+@@ -47,6 +47,22 @@
+ 			return []
+ 
+ 	#}}}
++	def setallnullparameters(self): # {{{
++		
++		#Nothing done
++		self.ismasstransport = False
++		self.isstressbalance = False
++		self.isthermal       = False
++		self.isgroundingline = False
++		self.isgia           = False
++		self.isdamageevolution = False
++		self.islevelset      = False
++                self.ishydrology     = False
++
++		#default output
++		self.requested_outputs=['none']
++		return self
++	#}}}
+ 	def setdefaultparameters(self): # {{{
+ 		
+ 		#full analysis: Stressbalance, Masstransport and Thermal but no groundingline migration for now
+Index: ../trunk-jpl/src/m/classes/transient.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/transient.m	(revision 17741)
++++ ../trunk-jpl/src/m/classes/transient.m	(revision 17742)
+@@ -53,7 +53,7 @@
+ 			obj.ishydrology     = 0;
+ 
+ 			%default output
+-			obj.requested_outputs={'default'};
++			obj.requested_outputs={'none'};
+ 		end % }}}
+ 		function obj = setdefaultparameters(obj) % {{{
+ 
+Index: ../trunk-jpl/src/m/enum/EffectivePressureEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/EffectivePressureEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/EffectivePressureEnum.m	(revision 17742)
+@@ -0,0 +1,11 @@
++function macro=EffectivePressureEnum()
++%EFFECTIVEPRESSUREENUM - Enum of EffectivePressure
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=EffectivePressureEnum()
++
++macro=StringToEnum('EffectivePressure');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17741)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17742)
+@@ -97,6 +97,7 @@
+ def SedimentHeadEnum(): return StringToEnum("SedimentHead")[0]
+ def SedimentHeadOldEnum(): return StringToEnum("SedimentHeadOld")[0]
+ def SedimentHeadResidualEnum(): return StringToEnum("SedimentHeadResidual")[0]
++def EffectivePressureEnum(): return StringToEnum("EffectivePressure")[0]
+ def EplHeadEnum(): return StringToEnum("EplHead")[0]
+ def EplHeadOldEnum(): return StringToEnum("EplHeadOld")[0]
+ def EplHeadSlopeXEnum(): return StringToEnum("EplHeadSlopeX")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17742-17743.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17742-17743.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17742-17743.diff	(revision 17802)
@@ -0,0 +1,78 @@
+Index: ../trunk-jpl/src/wrappers/python/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/wrappers/python/Makefile.am	(revision 17742)
++++ ../trunk-jpl/src/wrappers/python/Makefile.am	(revision 17743)
+@@ -52,6 +52,7 @@
+ 						ElementConnectivity.la\
+ 						EnumToString.la\
+ 						InterpFromMeshToMesh2d.la\
++						InterpFromMeshToMesh3d.la\
+ 						InterpFromGridToMesh.la\
+ 						InterpFromMeshToGrid.la\
+ 						IssmConfig.la\
+@@ -143,6 +144,10 @@
+ 												../InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.h
+ InterpFromMeshToMesh2d_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(MULTITHREADINGLIB) $(GSLLIB)
+ 
++InterpFromMeshToMesh3d_la_SOURCES = ../InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp\
++												../InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.h
++InterpFromMeshToMesh3d_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(MULTITHREADINGLIB) $(GSLLIB)
++
+ InterpFromGridToMesh_la_SOURCES = ../InterpFromGridToMesh/InterpFromGridToMesh.cpp\
+ 												../InterpFromGridToMesh/InterpFromGridToMesh.h
+ InterpFromGridToMesh_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(MULTITHREADINGLIB) $(GSLLIB)
+@@ -151,7 +156,6 @@
+ 												../InterpFromMeshToGrid/InterpFromMeshToGrid.h
+ InterpFromMeshToGrid_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(MULTITHREADINGLIB) $(GSLLIB)
+ 
+-
+ IssmConfig_la_SOURCES = ../IssmConfig/IssmConfig.cpp\
+ 											 ../IssmConfig/IssmConfig.h
+ IssmConfig_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+Index: ../trunk-jpl/src/wrappers/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp
+===================================================================
+--- ../trunk-jpl/src/wrappers/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp	(revision 17742)
++++ ../trunk-jpl/src/wrappers/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp	(revision 17743)
+@@ -65,7 +65,9 @@
+ 	MODULEBOOT();
+ 
+ 	/*checks on arguments on the matlab side: */
++	#ifdef _HAVE_MATLAB_MODULES_
+ 	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&InterpFromMeshToMesh3dUsage);
++	#endif
+ 
+ 	/*Input datasets: */
+ 	FetchData(&index_data,&index_data_rows,NULL,INDEXHANDLE);
+Index: ../trunk-jpl/src/wrappers/InterpFromMesh2d/InterpFromMesh2d.cpp
+===================================================================
+--- ../trunk-jpl/src/wrappers/InterpFromMesh2d/InterpFromMesh2d.cpp	(revision 17742)
++++ ../trunk-jpl/src/wrappers/InterpFromMesh2d/InterpFromMesh2d.cpp	(revision 17743)
+@@ -92,6 +92,7 @@
+ 
+ 	if(nrhs>=8){
+ 
++		#ifdef _HAVE_MATLAB_MODULES_
+ 		/*Call expread on filename to build a contour array in the matlab workspace: */
+ 		mexCallMATLAB( 1, &matlabstructure, 1, (mxArray**)&FILENAME, "expread");
+ 
+@@ -108,17 +109,9 @@
+ 			contouri->y=mxGetPr(mxGetField(matlabstructure,i,"y"));
+ 			*(contours+i)=contouri;
+ 		}
+-
+-		/* Debugging of contours :{{{1*/
+-		/*for(i=0;i<numcontours;i++){
+-		  _printf_("\nContour echo: contour number  " << i+1 << " / " << numcontours << "\n");
+-		  contouri=*(contours+i);
+-		  _printf_("   Number of vertices " << contouri->nods << "\n");
+-		  for (j=0;j<contouri->nods;j++){
+-		  _printf_("   " << *(contouri->x+j) << "f " << *(contouri->y+j) << "f\n");
+-		  }
+-		  }*/
+-		/*}}}*/
++		#else
++		_error_("not supported");
++		#endif
+ 	}
+ 	else{
+ 		numcontours=0;
Index: issm/oecreview/Archive/16554-17801/ISSM-17743-17744.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17743-17744.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17743-17744.diff	(revision 17802)
@@ -0,0 +1,92 @@
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17743)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17744)
+@@ -46,12 +46,14 @@
+ }/*}}}*/
+ void DamageEvolutionAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+ 
++	int finiteelement = P1Enum;
++
+ 	/*Update elements: */
+ 	int counter=0;
+ 	for(int i=0;i<iomodel->numberofelements;i++){
+ 		if(iomodel->my_elements[i]){
+ 			Element* element=(Element*)elements->GetObjectByOffset(counter);
+-			element->Update(i,iomodel,analysis_counter,analysis_type,P1Enum);
++			element->Update(i,iomodel,analysis_counter,analysis_type,finiteelement);
+ 			counter++;
+ 		}
+ 	}
+@@ -72,16 +74,19 @@
+ }/*}}}*/
+ void DamageEvolutionAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
++	int finiteelement = P1Enum;
++
+ 	if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(1,MeshVertexonbaseEnum);
+-	::CreateNodes(nodes,iomodel,DamageEvolutionAnalysisEnum,P1Enum);
++	::CreateNodes(nodes,iomodel,DamageEvolutionAnalysisEnum,finiteelement);
+ 	iomodel->DeleteData(1,MeshVertexonbaseEnum);
+ }/*}}}*/
+ void DamageEvolutionAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ 
+-	int stabilization,finitelelement;
++	int stabilization;
++	int finiteelement = P1Enum;
+ 	iomodel->Constant(&stabilization,DamageStabilizationEnum);
+ 
+-	IoModelToConstraintsx(constraints,iomodel,DamageSpcdamageEnum,DamageEvolutionAnalysisEnum,P1Enum);
++	IoModelToConstraintsx(constraints,iomodel,DamageSpcdamageEnum,DamageEvolutionAnalysisEnum,finiteelement);
+ 
+ }/*}}}*/
+ void DamageEvolutionAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+@@ -410,7 +415,12 @@
+ 	}
+ 
+ 	/*Get all inputs and parameters*/
+-	basalelement->AddBasalInput(DamageDEnum,newdamage,P1Enum);
++	if(domaintype==Domain2DhorizontalEnum){
++		basalelement->AddInput(DamageDbarEnum,newdamage,element->GetElementType());
++	}
++	else{
++		basalelement->AddBasalInput(DamageDEnum,newdamage,element->GetElementType());
++	}
+ 
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(newdamage);
+@@ -430,7 +440,7 @@
+ 	IssmDouble s_xx,s_xy,s_yy,s1,s2,stmp;
+ 	IssmDouble J2s,Chi,Psi,PosPsi,NegPsi;
+ 	IssmDouble damage,tau_xx,tau_xy,tau_yy;
+-	int equivstress;
++	int equivstress,domaintype;
+ 
+ 	/*Fetch number of vertices and allocate output*/
+ 	int numvertices = element->GetNumberOfVertices();
+@@ -442,6 +452,7 @@
+ 	element->FindParam(&c3,DamageC3Enum);
+ 	element->FindParam(&healing,DamageHealingEnum);
+ 	element->FindParam(&stress_threshold,DamageStressThresholdEnum);
++	element->FindParam(&domaintype,DomainTypeEnum);
+ 
+ 	/*Compute stress tensor: */
+ 	element->ComputeDeviatoricStressTensor();
+@@ -450,8 +461,16 @@
+ 	Input* tau_xx_input  = element->GetInput(DeviatoricStressxxEnum);     _assert_(tau_xx_input);
+ 	Input* tau_xy_input  = element->GetInput(DeviatoricStressxyEnum);     _assert_(tau_xy_input);
+ 	Input* tau_yy_input  = element->GetInput(DeviatoricStressyyEnum);     _assert_(tau_yy_input);
+-	Input* damage_input    = element->GetInput(DamageDEnum); _assert_(damage_input);
++	Input* damage_input = NULL;
++	if(domaintype==Domain2DhorizontalEnum){
++		damage_input = element->GetInput(DamageDbarEnum); 	_assert_(damage_input);
++	}
++	else{
++		damage_input = element->GetInput(DamageDEnum);   _assert_(damage_input);
++	}
+ 
++
++
+ 	/*retrieve the desired type of equivalent stress*/
+ 	element->FindParam(&equivstress,DamageEquivStressEnum);
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17744-17745.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17744-17745.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17744-17745.diff	(revision 17802)
@@ -0,0 +1,36 @@
+Index: ../trunk-jpl/src/m/classes/damage.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/damage.py	(revision 17744)
++++ ../trunk-jpl/src/m/classes/damage.py	(revision 17745)
+@@ -108,8 +108,11 @@
+ 		return self
+ 	# }}}
+ 	def defaultoutputs(self,md): # {{{
+-
+-		list = ['DamageD']
++		
++		if md.mesh.domaintype().lower()=='2dhorizontal':
++			list = ['DamageDbar']
++		else:
++			list = ['DamageD']
+ 		return list
+ 
+ 	#}}}
+Index: ../trunk-jpl/src/m/classes/damage.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/damage.m	(revision 17744)
++++ ../trunk-jpl/src/m/classes/damage.m	(revision 17745)
+@@ -164,8 +164,11 @@
+ 		end % }}}
+ 		function list=defaultoutputs(self,md) % {{{
+ 
+-			list = {'DamageD'};
+-
++			if strcmp(domaintype(md.mesh),'2Dhorizontal'),
++            list = {'DamageDbar'};
++         else
++            list = {'DamageD'};
++         end
+ 		end % }}}
+ 		function disp(obj) % {{{
+ 			disp(sprintf('   Damage:\n'));
Index: issm/oecreview/Archive/16554-17801/ISSM-17745-17746.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17745-17746.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17745-17746.diff	(revision 17802)
@@ -0,0 +1,48 @@
+Index: ../trunk-jpl/test/NightlyRun/test275.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test275.py	(revision 17745)
++++ ../trunk-jpl/test/NightlyRun/test275.py	(revision 17746)
+@@ -33,6 +33,6 @@
+ field_names=['D','F']
+ field_tolerances=[1.e-13,1.e-13]
+ field_values=[\
+-		md.results.DamageEvolutionSolution.DamageD,\
++		md.results.DamageEvolutionSolution.DamageDbar,\
+ 		md.results.DamageEvolutionSolution.DamageF,\
+ 		]
+Index: ../trunk-jpl/test/NightlyRun/test275.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test275.m	(revision 17745)
++++ ../trunk-jpl/test/NightlyRun/test275.m	(revision 17746)
+@@ -21,6 +21,6 @@
+ field_names={'D','F'}
+ field_tolerances={1e-13,1e-13}
+ field_values={...
+-		(md.results.DamageEvolutionSolution.DamageD),...
++		(md.results.DamageEvolutionSolution.DamageDbar),...
+ 		(md.results.DamageEvolutionSolution.DamageF),...
+ 	};
+Index: ../trunk-jpl/test/NightlyRun/test271.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test271.py	(revision 17745)
++++ ../trunk-jpl/test/NightlyRun/test271.py	(revision 17746)
+@@ -30,6 +30,6 @@
+ field_names=['D','F']
+ field_tolerances=[1.e-13,1.e-13]
+ field_values=[\
+-		md.results.DamageEvolutionSolution.DamageD,\
++		md.results.DamageEvolutionSolution.DamageDbar,\
+ 		md.results.DamageEvolutionSolution.DamageF,\
+ 		]
+Index: ../trunk-jpl/test/NightlyRun/test271.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test271.m	(revision 17745)
++++ ../trunk-jpl/test/NightlyRun/test271.m	(revision 17746)
+@@ -22,6 +22,6 @@
+ field_names={'D','F'}
+ field_tolerances={1e-13,1e-13};
+ field_values={...
+-		(md.results.DamageEvolutionSolution.DamageD),...
++		(md.results.DamageEvolutionSolution.DamageDbar),...
+ 		(md.results.DamageEvolutionSolution.DamageF),...
+ 	};
Index: issm/oecreview/Archive/16554-17801/ISSM-17746-17747.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17746-17747.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17746-17747.diff	(revision 17802)
@@ -0,0 +1,214 @@
+Index: ../trunk-jpl/test/NightlyRun/test410.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test410.m	(revision 17746)
++++ ../trunk-jpl/test/NightlyRun/test410.m	(revision 17747)
+@@ -9,7 +9,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure','Temperature','BasalforcingsMeltingRate'};
+-field_tolerances={1e-09,1e-09,1e-08,3e-10,1e-13,2e-10,1e-06};
++field_tolerances={1e-09,1e-09,1e-08,3e-10,1e-13,3e-10,1e-06};
+ field_values={...
+ 	(md.results.SteadystateSolution.Vx),...
+ 	(md.results.SteadystateSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test435.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test435.m	(revision 17746)
++++ ../trunk-jpl/test/NightlyRun/test435.m	(revision 17747)
+@@ -47,7 +47,7 @@
+ 	'Bed2','Surface2','Thickness2','Floatingice2','Vx2','Vy2','Vz2','Pressure2',...
+ 	'Bed3','Surface3','Thickness3','Floatingice3','Vx3','Vy3','Vz3','Pressure3'};
+ field_tolerances={2e-11,3e-12,2e-11,1e-11,4e-10,1e-08,6e-10,1e-13,...
+-	2e-11,3e-11,9e-10,7e-11,1e-09,1e-08,1e-09,1e-10,...
++	3e-11,3e-11,9e-10,7e-11,1e-09,1e-08,1e-09,1e-10,...
+ 	1e-10,3e-11,1e-10,7e-11,1e-09,1e-08,1e-09,1e-10};
+ field_values={...
+ 	(md.results.TransientSolution(1).Base),...
+Index: ../trunk-jpl/test/NightlyRun/test206.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test206.m	(revision 17746)
++++ ../trunk-jpl/test/NightlyRun/test206.m	(revision 17747)
+@@ -9,7 +9,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Temperature','BasalforcingsMeltingRate'};
+-field_tolerances={1e-13,2.6e-6};
++field_tolerances={1e-13,5e-6};
+ field_values={...
+ 	(md.results.ThermalSolution.Temperature),...
+ 	(md.results.ThermalSolution.BasalforcingsMeltingRate),...
+Index: ../trunk-jpl/test/NightlyRun/test322.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test322.m	(revision 17746)
++++ ../trunk-jpl/test/NightlyRun/test322.m	(revision 17747)
+@@ -22,7 +22,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Gradient','Misfits','FrictionCoefficient','Pressure','Vel','Vx','Vy'};
+-field_tolerances={1e-06,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,2e-09,2e-09,2e-09};
++field_tolerances={2e-06,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,2e-09,2e-09,2e-09};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Gradient1),...
+ 	(md.results.StressbalanceSolution.J),...
+Index: ../trunk-jpl/test/NightlyRun/test221.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test221.py	(revision 17746)
++++ ../trunk-jpl/test/NightlyRun/test221.py	(revision 17747)
+@@ -18,7 +18,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Vx','Vy','Vz','Vel','Pressure']
+-field_tolerances=[1e-09,1e-09,1e-06,1e-09,1e-09]
++field_tolerances=[1e-09,1e-09,5e-06,1e-09,1e-09]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Vx,\
+ 	md.results.StressbalanceSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test209.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test209.py	(revision 17746)
++++ ../trunk-jpl/test/NightlyRun/test209.py	(revision 17747)
+@@ -25,8 +25,8 @@
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3']
+ field_tolerances=[\
+ 	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-8,\
+-	1e-13,1e-13,3e-9,1e-13,3.8e-11,3.85e-11,3.85e-11,3.85e-11,1e-13,1.9e-8,\
+-	5e-11,6e-12,1e-08,6e-12,3.9e-11,1e-10,1e-10,1e-10,9e-12,1.85e-8]
++	1e-13,1e-13,3e-9,1e-13,3.8e-11,3.85e-11,3.85e-11,3.85e-11,1e-13,2e-8,\
++	5e-11,6e-12,1e-08,6e-12,3.9e-11,1e-10,1e-10,1e-10,9e-12,2e-8]
+ 
+ field_values=[\
+ 	md.results.TransientSolution[0].Vx,\
+Index: ../trunk-jpl/test/NightlyRun/test233.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test233.m	(revision 17746)
++++ ../trunk-jpl/test/NightlyRun/test233.m	(revision 17747)
+@@ -15,8 +15,8 @@
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3', ...
+ 	'Vx4','Vy4','Vz4','Vel4','Pressure4','Bed4','Surface4','Thickness4','Temperature4','BasalforcingsMeltingRate4'};
+ field_tolerances={1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09, ...
+-	1e-09,1e-09,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-07, ...
+ 	1e-09,1e-09,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-06, ...
++	1e-09,1e-09,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-06, ...
+ 	1e-09,1e-09,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-06};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
+Index: ../trunk-jpl/test/NightlyRun/test455.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test455.py	(revision 17746)
++++ ../trunk-jpl/test/NightlyRun/test455.py	(revision 17747)
+@@ -22,7 +22,7 @@
+ 	md.flowequation.fe_HO=i
+ 	md=solve(md,StressbalanceSolutionEnum())
+ 	field_names     =field_names+['Vx'+i,'Vy'+i,'Vz'+i,'Vel'+i,'Pressure'+i]
+-	field_tolerances=field_tolerances+[4e-08,4e-08,1e-08,4e-08,3e-13]
++	field_tolerances=field_tolerances+[5e-08,4e-08,1e-08,4e-08,3e-13]
+ 	field_values=field_values+[\
+ 			md.results.StressbalanceSolution.Vx,\
+ 			md.results.StressbalanceSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test455.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test455.m	(revision 17746)
++++ ../trunk-jpl/test/NightlyRun/test455.m	(revision 17747)
+@@ -12,7 +12,7 @@
+ 	md.flowequation.fe_HO=i{1};
+ 	md=solve(md,StressbalanceSolutionEnum());
+ 	field_names     ={field_names{:},['Vx' i{1}],['Vy' i{1}],['Vz' i{1}],['Vel' i{1}],['Pressure' i{1}]};
+-	field_tolerances={field_tolerances{:},4e-08,4e-08,1e-08,4e-08,3e-13};
++	field_tolerances={field_tolerances{:},5e-08,4e-08,1e-08,4e-08,3e-13};
+ 	field_values={field_values{:},...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test410.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test410.py	(revision 17746)
++++ ../trunk-jpl/test/NightlyRun/test410.py	(revision 17747)
+@@ -19,7 +19,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Vx','Vy','Vz','Vel','Pressure','Temperature','BasalforcingsMeltingRate']
+-field_tolerances=[1e-09,1e-09,1e-08,1e-09,1e-13,2e-10,1e-06]
++field_tolerances=[1e-09,1e-09,1e-08,1e-09,1e-13,3e-10,1e-06]
+ field_values=[\
+ 	md.results.SteadystateSolution.Vx,\
+ 	md.results.SteadystateSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test209.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test209.m	(revision 17746)
++++ ../trunk-jpl/test/NightlyRun/test209.m	(revision 17747)
+@@ -12,8 +12,8 @@
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3'};
+ field_tolerances={...
+ 	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-8,...
+-	1e-13,1e-13,3e-9,1e-13,3.8e-11,3.85e-11,3.85e-11,3.85e-11,1e-13,1.9e-8,...
+-	5e-11,6e-12,1e-08,6e-12,3.9e-11,1e-10,1e-10,1e-10,9e-12,1.85e-8};
++	1e-13,1e-13,3e-9,1e-13,3.8e-11,3.85e-11,3.85e-11,3.85e-11,1e-13,2e-8,...
++	5e-11,6e-12,1e-08,6e-12,3.9e-11,1e-10,1e-10,1e-10,9e-12,2-8};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
+ 	(md.results.TransientSolution(1).Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test285.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test285.m	(revision 17746)
++++ ../trunk-jpl/test/NightlyRun/test285.m	(revision 17747)
+@@ -12,7 +12,7 @@
+ 	md.flowequation.fe_HO=i{1};
+ 	md=solve(md,StressbalanceSolutionEnum());
+ 	field_names     ={field_names{:},['Vx' i{1}],['Vy' i{1}],['Vz' i{1}],['Vel' i{1}],['Pressure' i{1}]};
+-	field_tolerances={field_tolerances{:},6e-08,2e-08,2e-08,2e-08,1e-13};
++	field_tolerances={field_tolerances{:},6e-08,3e-08,2e-08,3e-08,1e-13};
+ 	field_values={field_values{:},...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test285.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test285.py	(revision 17746)
++++ ../trunk-jpl/test/NightlyRun/test285.py	(revision 17747)
+@@ -22,7 +22,7 @@
+ 	md.flowequation.fe_HO=i
+ 	md=solve(md,StressbalanceSolutionEnum())
+ 	field_names     =field_names+['Vx'+i,'Vy'+i,'Vz'+i,'Vel'+i,'Pressure'+i]
+-	field_tolerances=field_tolerances+[6e-08,2e-08,2e-08,2e-08,1e-13]
++	field_tolerances=field_tolerances+[6e-08,3e-08,2e-08,3e-08,1e-13]
+ 	field_values=field_values+[\
+ 		md.results.StressbalanceSolution.Vx,\
+ 		md.results.StressbalanceSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test206.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test206.py	(revision 17746)
++++ ../trunk-jpl/test/NightlyRun/test206.py	(revision 17747)
+@@ -22,7 +22,7 @@
+ # Fields and tolerances to track changes
+ 
+ field_names     =['Temperature','BasalforcingsMeltingRate']
+-field_tolerances=[1e-13,1.35e-6]
++field_tolerances=[1e-13,5e-6]
+ field_values=[\
+ 	md.results.ThermalSolution.Temperature,\
+ 	md.results.ThermalSolution.BasalforcingsMeltingRate,\
+Index: ../trunk-jpl/test/NightlyRun/test221.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test221.m	(revision 17746)
++++ ../trunk-jpl/test/NightlyRun/test221.m	(revision 17747)
+@@ -9,7 +9,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure'};
+-field_tolerances={1e-09,1e-09,1e-06,1e-09,1e-09};
++field_tolerances={1e-09,1e-09,5e-06,1e-09,1e-09};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test233.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test233.py	(revision 17746)
++++ ../trunk-jpl/test/NightlyRun/test233.py	(revision 17747)
+@@ -25,8 +25,8 @@
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3', \
+ 	'Vx4','Vy4','Vz4','Vel4','Pressure4','Bed4','Surface4','Thickness4','Temperature4','BasalforcingsMeltingRate4']
+ field_tolerances=[1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09, \
+-	1e-09,1e-09,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-07, \
+ 	1e-09,1e-09,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-06, \
++	1e-09,1e-09,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-06, \
+ 	1e-09,1e-09,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-06]
+ field_values=[\
+ 	md.results.TransientSolution[0].Vx,\
Index: issm/oecreview/Archive/16554-17801/ISSM-17747-17748.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17747-17748.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17747-17748.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/classes/transient.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/transient.m	(revision 17747)
++++ ../trunk-jpl/src/m/classes/transient.m	(revision 17748)
+@@ -53,7 +53,7 @@
+ 			obj.ishydrology     = 0;
+ 
+ 			%default output
+-			obj.requested_outputs={'none'};
++			obj.requested_outputs={};
+ 		end % }}}
+ 		function obj = setdefaultparameters(obj) % {{{
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17748-17749.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17748-17749.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17748-17749.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/classes/transient.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/transient.py	(revision 17748)
++++ ../trunk-jpl/src/m/classes/transient.py	(revision 17749)
+@@ -60,7 +60,7 @@
+                 self.ishydrology     = False
+ 
+ 		#default output
+-		self.requested_outputs=['none']
++		self.requested_outputs=[]
+ 		return self
+ 	#}}}
+ 	def setdefaultparameters(self): # {{{
Index: issm/oecreview/Archive/16554-17801/ISSM-17749-17750.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17749-17750.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17749-17750.diff	(revision 17802)
@@ -0,0 +1,39 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17749)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17750)
+@@ -106,8 +106,7 @@
+ void Tetra::FaceOnBaseIndices(int* pindex1,int* pindex2,int* pindex3){
+ 
+ 	IssmDouble values[NUMVERTICES];
+-	//int        indices[4][3] = {{0,1,2},{0,1,3},{1,2,3},{2,0,3}};
+-	int        indices[4][3] = {{0,1,2},{3,1,0},{3,2,1},{3,0,2}};
++	int        indices[4][3] = {{0,1,2},{0,3,1},{1,3,2},{0,2,3}};
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	GetInputListOnVertices(&values[0],MeshVertexonbaseEnum);
+Index: ../trunk-jpl/src/c/classes/gauss/GaussTetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussTetra.cpp	(revision 17749)
++++ ../trunk-jpl/src/c/classes/gauss/GaussTetra.cpp	(revision 17750)
+@@ -52,17 +52,17 @@
+ 		coords4=xNew<IssmDouble>(numgauss);
+ 		for(int i=0;i<numgauss;i++) coords4[i]=0.;
+ 	}
+-	else if(index1==0 && index2==1 && index3==3){
++	else if(index1==0 && index2==3 && index3==1){
+ 		GaussLegendreTria(&numgauss,&coords1,&coords2,&coords4,&weights,order);
+ 		coords3=xNew<IssmDouble>(numgauss);
+ 		for(int i=0;i<numgauss;i++) coords3[i]=0.;
+ 	}
+-	else if(index1==1 && index2==2 && index3==3){
++	else if(index1==1 && index2==3 && index3==2){
+ 		GaussLegendreTria(&numgauss,&coords2,&coords3,&coords4,&weights,order);
+ 		coords1=xNew<IssmDouble>(numgauss);
+ 		for(int i=0;i<numgauss;i++) coords1[i]=0.;
+ 	}
+-	else if(index1==2 && index2==0 && index3==3){
++	else if(index1==0 && index2==2 && index3==3){
+ 		GaussLegendreTria(&numgauss,&coords1,&coords3,&coords4,&weights,order);
+ 		coords2=xNew<IssmDouble>(numgauss);
+ 		for(int i=0;i<numgauss;i++) coords2[i]=0.;
Index: issm/oecreview/Archive/16554-17801/ISSM-17750-17751.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17750-17751.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17750-17751.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/m4/issm_options.m4
+===================================================================
+--- ../trunk-jpl/m4/issm_options.m4	(revision 17750)
++++ ../trunk-jpl/m4/issm_options.m4	(revision 17751)
+@@ -38,7 +38,7 @@
+ 		[enable_development=no])                                      dnl action if not given
+ 
+ 	AC_MSG_CHECKING(for development support)
+-	if test "x$enable_debugging" = xyes; then
++	if test "x$enable_development" = xyes; then
+ 		AC_DEFINE([_DEVELOPMENT_],[1],[Macro to enable development version in ISSM])
+ 	fi
+ 	AM_CONDITIONAL([DEVELOPMENT], [test x$enable_development = xyes])
Index: issm/oecreview/Archive/16554-17801/ISSM-17751-17752.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17751-17752.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17751-17752.diff	(revision 17802)
@@ -0,0 +1,126 @@
+Index: ../trunk-jpl/test/NightlyRun/test211.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.py	(revision 17751)
++++ ../trunk-jpl/test/NightlyRun/test211.py	(revision 17752)
+@@ -28,7 +28,7 @@
+ field_tolerances=[\
+ 	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,\
+ 	2e-08,3e-08,1e-06,3e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06,\
+-	1e-07,1e-07,1e-06,3e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06]
++	1e-07,1e-07,1e-06,5e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06]
+ field_values=[\
+ 	md.results.TransientSolution[0].Vx,\
+ 	md.results.TransientSolution[0].Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test290.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test290.m	(revision 17751)
++++ ../trunk-jpl/test/NightlyRun/test290.m	(revision 17752)
+@@ -9,7 +9,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure'};
+-field_tolerances={5e-5,5e-5,5e-5,5e-5,1e-7};
++field_tolerances={5e-5,5e-5,8e-5,5e-5,1e-7};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test209.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test209.m	(revision 17751)
++++ ../trunk-jpl/test/NightlyRun/test209.m	(revision 17752)
+@@ -13,7 +13,7 @@
+ field_tolerances={...
+ 	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-8,...
+ 	1e-13,1e-13,3e-9,1e-13,3.8e-11,3.85e-11,3.85e-11,3.85e-11,1e-13,2e-8,...
+-	5e-11,6e-12,1e-08,6e-12,3.9e-11,1e-10,1e-10,1e-10,9e-12,2-8};
++	5e-11,6e-12,1e-08,6e-12,3.9e-11,1e-10,1e-10,1e-10,9e-12,2e-8};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
+ 	(md.results.TransientSolution(1).Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test333.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test333.m	(revision 17751)
++++ ../trunk-jpl/test/NightlyRun/test333.m	(revision 17752)
+@@ -39,14 +39,14 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'SedimentWaterHead1','EplWaterHead1','SedimentHeadResidual1',...
+-								 'SedimentWaterHead4','EplWaterHead4','SedimentHeadResidual4',...
+-								 'SedimentWaterHead5','EplWaterHead5','SedimentHeadResidual5',...
+-								 'SedimentWaterHead9','EplWaterHead9','SedimentHeadResidual9'};
++						'SedimentWaterHead4','EplWaterHead4','SedimentHeadResidual4',...
++						'SedimentWaterHead5','EplWaterHead5','SedimentHeadResidual5',...
++						'SedimentWaterHead9','EplWaterHead9','SedimentHeadResidual9'};
+ field_tolerances={...
+ 	1e-13, 1e-13, 1e-13,...
+ 	1e-13, 1e-13, 1e-13,...
+-	1e-13, 1e-12, 8e-12,...
+-	1e-13, 2e-12, 1e-11};
++	1e-13, 5e-12, 8e-12,...
++	1e-13, 5e-12, 1e-11};
+ field_values={md.results.TransientSolution(1).SedimentHead, ...
+ 							md.results.TransientSolution(1).EplHead,...
+ 							md.results.TransientSolution(1).SedimentHeadResidual,...
+Index: ../trunk-jpl/test/NightlyRun/test211.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.m	(revision 17751)
++++ ../trunk-jpl/test/NightlyRun/test211.m	(revision 17752)
+@@ -15,7 +15,7 @@
+ field_tolerances={...
+ 	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,...
+ 	2e-08,3e-08,1e-06,3e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06,...
+-	1e-07,1e-07,1e-06,3e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06};
++	1e-07,1e-07,1e-06,5e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
+ 	(md.results.TransientSolution(1).Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test335.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test335.m	(revision 17751)
++++ ../trunk-jpl/test/NightlyRun/test335.m	(revision 17752)
+@@ -46,13 +46,13 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'SedimentWaterHead1','EplWaterHead1','SedimentHeadResidual1',...
+-								 'SedimentWaterHead4','EplWaterHead4','SedimentHeadResidual4',...
+-								 'SedimentWaterHead5','EplWaterHead5','SedimentHeadResidual5',...
+-								 'SedimentWaterHead9','EplWaterHead9','SedimentHeadResidual9'};
++						'SedimentWaterHead4','EplWaterHead4','SedimentHeadResidual4',...
++						'SedimentWaterHead5','EplWaterHead5','SedimentHeadResidual5',...
++						'SedimentWaterHead9','EplWaterHead9','SedimentHeadResidual9'};
+ field_tolerances={1e-13, 1e-13, 1e-13,...
+-								 1e-13, 1e-13, 1e-13,...
+-								 1e-13, 1e-12, 9e-12,...
+-								 1e-13, 9e-13, 1e-11};
++						1e-13, 1e-13, 1e-13,...
++						1e-13, 5e-12, 9e-12,...
++						1e-13, 5e-12, 1e-11};
+ field_values={md.results.TransientSolution(1).SedimentHead, ...
+ 							md.results.TransientSolution(1).EplHead,...
+ 							md.results.TransientSolution(1).SedimentHeadResidual,...
+Index: ../trunk-jpl/test/NightlyRun/test290.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test290.py	(revision 17751)
++++ ../trunk-jpl/test/NightlyRun/test290.py	(revision 17752)
+@@ -19,7 +19,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Vx', 'Vy', 'Vz', 'Vel','Pressure'];
+-field_tolerances=[5e-5,5e-5,5e-5,5e-5,1e-7]
++field_tolerances=[5e-5,5e-5,8e-5,5e-5,1e-7]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Vx,\
+ 	md.results.StressbalanceSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test702.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test702.m	(revision 17751)
++++ ../trunk-jpl/test/NightlyRun/test702.m	(revision 17752)
+@@ -45,7 +45,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vel','Pressure'};
+-field_tolerances={1e-08,1e-08,1e-08,1e-08};
++field_tolerances={2e-08,2e-08,2e-08,2e-08};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
Index: issm/oecreview/Archive/16554-17801/ISSM-17752-17753.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17752-17753.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17752-17753.diff	(revision 17802)
@@ -0,0 +1,61 @@
+Index: ../trunk-jpl/jenkins/linux64_murdo
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo	(revision 17752)
++++ ../trunk-jpl/jenkins/linux64_murdo	(revision 17753)
+@@ -31,6 +31,7 @@
+ 	--with-dakota-dir=$ISSM_DIR/externalpackages/dakota/install \
+ 	--with-boost-dir=$ISSM_DIR/externalpackages/boost/install/ \
+ 	--with-tao-dir=$ISSM_DIR/externalpackages/tao/install \
++	--enable-development \
+ 	--enable-debugging '
+ 
+ #MATLAB path
+Index: ../trunk-jpl/jenkins/linux64_murdo_ad
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo_ad	(revision 17752)
++++ ../trunk-jpl/jenkins/linux64_murdo_ad	(revision 17753)
+@@ -12,13 +12,13 @@
+ 
+ #ISSM CONFIGURATION 
+ ISSM_CONFIG='--prefix=$ISSM_DIR\
+-                  --prefix=$ISSM_DIR \
+-				  --without-kriging \
+-				  --without-kml \
+-				  --with-gsl-dir=$ISSM_DIR/externalpackages/gsl/install \
+-				  --with-adolc-dir=$ISSM_DIR/externalpackages/adolc/install \
+-				  --with-matlab-dir=$MATLAB_DIR \
+-				  --with-triangle-dir=$ISSM_DIR/externalpackages/triangle/install '
++				--prefix=$ISSM_DIR \
++				--without-kriging \
++				--without-kml \
++				--with-gsl-dir=$ISSM_DIR/externalpackages/gsl/install \
++				--with-adolc-dir=$ISSM_DIR/externalpackages/adolc/install \
++				--with-matlab-dir=$MATLAB_DIR \
++				--with-triangle-dir=$ISSM_DIR/externalpackages/triangle/install '
+ #MATLAB path
+ MATLAB_PATH="/usr/local/matlab80/"
+ 
+Index: ../trunk-jpl/jenkins/linux64_murdo_ampi
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo_ampi	(revision 17752)
++++ ../trunk-jpl/jenkins/linux64_murdo_ampi	(revision 17753)
+@@ -28,6 +28,7 @@
+ 				  --with-numthreads=18  \
+ 				  --with-scalapack-dir=$ISSM_DIR/externalpackages/petsc/install/ \
+ 				  --with-triangle-dir=$ISSM_DIR/externalpackages/triangle/install \
++				  --enable-development \
+ 				  --enable-debugging CXXFLAGS="-g -O0" '
+ #MATLAB path
+ MATLAB_PATH="/usr/local/matlab80/"
+Index: ../trunk-jpl/jenkins/linux64_larsen
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_larsen	(revision 17752)
++++ ../trunk-jpl/jenkins/linux64_larsen	(revision 17753)
+@@ -29,6 +29,7 @@
+ 	--with-cxxoptflags="-mtune=barcelona -ffast-math -O3 -msse4.2 -Wno-write-strings "\
+ 	--with-graphics-lib="/usr/lib/x86_64-linux-gnu/libX11.so" \
+ 	--with-tao-dir=$ISSM_DIR/externalpackages/tao/install \
++	--enable-development \
+ 	--enable-debugging '
+ 
+ #MATLAB path
Index: issm/oecreview/Archive/16554-17801/ISSM-17753-17754.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17753-17754.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17753-17754.diff	(revision 17802)
@@ -0,0 +1,90 @@
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17753)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17754)
+@@ -1143,11 +1143,80 @@
+ 			%Initialize tetra mesh
+ 			md.mesh=mesh3dtetras(md.mesh);
+ 
+-			%Split in 3 tetras
+-			subelement1 = [1 2 3 5];
+-			subelement2 = [4 6 5 1];
+-			subelement3 = [5 6 3 1];
+-			elements=[md.mesh.elements(:,subelement1);md.mesh.elements(:,subelement2);md.mesh.elements(:,subelement3)];
++			%Subdivision from Philipp Furnstahl (http://studierstube.icg.tugraz.at/thesis/fuernstahl_thesis.pdf)
++			steiner  = 0;
++			nbv      = md.mesh.numberofvertices;
++			nbt      = 3*md.mesh.numberofelements;
++			elements = zeros(nbt,4);
++			for i=1:md.mesh.numberofelements
++				v1=md.mesh.elements(i,1); v2=md.mesh.elements(i,2); v3=md.mesh.elements(i,3);
++				v4=md.mesh.elements(i,4); v5=md.mesh.elements(i,5); v6=md.mesh.elements(i,6);
++				if(min(v2,v4)<min(v1,v5) & min(v1,v6)<min(v3,v4) & min(v3,v5)<min(v2,v6)),
++					steiner = steiner+1; nbv = nbv+1; nbt = nbt+5; v7 = nbv;
++					md.mesh.x=[md.mesh.x; mean(md.mesh.x(md.mesh.elements(i,:)))];
++					md.mesh.y=[md.mesh.y; mean(md.mesh.y(md.mesh.elements(i,:)))];
++					md.mesh.z=[md.mesh.z; mean(md.mesh.z(md.mesh.elements(i,:)))];
++					elements(3*(i-1)+1,:) = [v1 v2 v3 v7];
++					elements(3*(i-1)+2,:) = [v1 v2 v4 v7];
++					elements(3*(i-1)+3,:) = [v2 v4 v5 v7];
++					elements(end+1,:) = [v2 v3 v5 v7];
++					elements(end+1,:) = [v3 v5 v6 v7];
++					elements(end+1,:) = [v1 v3 v6 v7];
++					elements(end+1,:) = [v1 v4 v6 v7];
++					elements(end+1,:) = [v4 v5 v6 v7];
++				elseif(min(v2,v4)<min(v1,v5) & min(v1,v6)<min(v3,v4) & min(v3,v5)>min(v2,v6)),
++					elements(3*(i-1)+1,:) = [v1 v2 v4 v6];
++					elements(3*(i-1)+2,:) = [v2 v4 v5 v6];
++					elements(3*(i-1)+3,:) = [v1 v2 v3 v6];
++				elseif(min(v2,v4)<min(v1,v5) & min(v1,v6)>min(v3,v4) & min(v3,v5)<min(v2,v6)),
++					elements(3*(i-1)+1,:) = [v1 v2 v3 v4];
++					elements(3*(i-1)+2,:) = [v2 v3 v4 v5];
++					elements(3*(i-1)+3,:) = [v3 v4 v5 v6];
++				elseif(min(v2,v4)<min(v1,v5) & min(v1,v6)>min(v3,v4) & min(v3,v5)>min(v2,v6)),
++					elements(3*(i-1)+1,:) = [v1 v2 v3 v4];
++					elements(3*(i-1)+2,:) = [v2 v4 v5 v6];
++					elements(3*(i-1)+3,:) = [v2 v3 v4 v6];
++				elseif(min(v2,v4)>min(v1,v5) & min(v1,v6)<min(v3,v4) & min(v3,v5)>min(v2,v6)),
++					elements(3*(i-1)+1,:) = [v1 v4 v5 v6];
++					elements(3*(i-1)+2,:) = [v1 v2 v3 v5];
++					elements(3*(i-1)+3,:) = [v1 v3 v5 v6];
++				elseif(min(v2,v4)>min(v1,v5) & min(v1,v6)<min(v3,v4) & min(v3,v5)>min(v2,v6)),
++					elements(3*(i-1)+1,:) = [v1 v4 v5 v6];
++					elements(3*(i-1)+2,:) = [v1 v2 v5 v6];
++					elements(3*(i-1)+3,:) = [v1 v2 v3 v6];
++				elseif(min(v2,v4)>min(v1,v5) & min(v1,v6)>min(v3,v4) & min(v3,v5)<min(v2,v6)),
++					elements(3*(i-1)+1,:) = [v1 v3 v4 v5];
++					elements(3*(i-1)+2,:) = [v1 v2 v3 v5];
++					elements(3*(i-1)+3,:) = [v3 v4 v5 v6];
++				elseif(min(v2,v4)>min(v1,v5) & min(v1,v6)<min(v3,v4) & min(v3,v5)<min(v2,v6)),
++					%NEW
++					elements(3*(i-1)+1,:) = [v1 v5 v6 v4];
++					elements(3*(i-1)+2,:) = [v1 v2 v3 v5];
++					elements(3*(i-1)+3,:) = [v5 v6 v3 v1];
++				elseif(min(v2,v4)>min(v1,v5) & min(v1,v6)>min(v3,v4) & min(v3,v5)>min(v2,v6)),
++					steiner = steiner+1; nbv = nbv+1; nbt = nbt+5; v7 = nbv;
++					md.mesh.x=[md.mesh.x; mean(md.mesh.x(md.mesh.elements(i,:)))];
++					md.mesh.y=[md.mesh.y; mean(md.mesh.y(md.mesh.elements(i,:)))];
++					md.mesh.z=[md.mesh.z; mean(md.mesh.z(md.mesh.elements(i,:)))];
++					elements(3*(i-1)+1,:) = [v1 v2 v3 v7];
++					elements(3*(i-1)+2,:) = [v1 v4 v5 v7];
++					elements(3*(i-1)+3,:) = [v1 v2 v5 v7];
++					elements(end+1,:) = [v2 v5 v6 v7];
++					elements(end+1,:) = [v2 v3 v6 v7];
++					elements(end+1,:) = [v3 v4 v6 v7];
++					elements(end+1,:) = [v1 v3 v4 v7];
++					elements(end+1,:) = [v4 v5 v6 v7];
++				else
++					error('Case not supported'); %not supposed to happen!
++				end
++			end
++			%%Split in 3 tetras
++			%subelement1 = [1 2 3 5];
++			%subelement2 = [4 6 5 1];
++			%subelement3 = [5 6 3 1];
++			%elements=[md.mesh.elements(:,subelement1);md.mesh.elements(:,subelement2);md.mesh.elements(:,subelement3)];
++			disp([num2str(steiner) ' Steiner points had to be included'])
++
+ 			pos_elements = repmat([1:md.mesh.numberofelements]',3,1);
+ 
+ 			md.mesh.elements=elements;
Index: issm/oecreview/Archive/16554-17801/ISSM-17754-17755.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17754-17755.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17754-17755.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/test/NightlyRun/test211.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.py	(revision 17754)
++++ ../trunk-jpl/test/NightlyRun/test211.py	(revision 17755)
+@@ -28,7 +28,7 @@
+ field_tolerances=[\
+ 	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,\
+ 	2e-08,3e-08,1e-06,3e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06,\
+-	1e-07,1e-07,1e-06,5e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06]
++	1e-07,1e-07,1e-05,5e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06]
+ field_values=[\
+ 	md.results.TransientSolution[0].Vx,\
+ 	md.results.TransientSolution[0].Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test211.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.m	(revision 17754)
++++ ../trunk-jpl/test/NightlyRun/test211.m	(revision 17755)
+@@ -15,7 +15,7 @@
+ field_tolerances={...
+ 	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,...
+ 	2e-08,3e-08,1e-06,3e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06,...
+-	1e-07,1e-07,1e-06,5e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06};
++	1e-07,1e-07,1e-05,5e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
+ 	(md.results.TransientSolution(1).Vy),...
Index: issm/oecreview/Archive/16554-17801/ISSM-17755-17756.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17755-17756.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17755-17756.diff	(revision 17802)
@@ -0,0 +1,228 @@
+Index: ../trunk-jpl/src/m/plot/plot_manager.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_manager.py	(revision 17755)
++++ ../trunk-jpl/src/m/plot/plot_manager.py	(revision 17756)
+@@ -30,6 +30,9 @@
+ 	#initialize plot handle variable
+ 	handle=None
+ 
++	# initialize subplot
++	p.subplot(nlines,ncols,i,aspect='equal')
++
+ 	##basemap plot
+ 	#if options.exist('basemap'):
+ 	#	plot_basemap(md,data,options,nlines,ncols,i)
+@@ -69,8 +72,8 @@
+ 	data2,datatype=processdata(md,data,options)
+ 
+ 	#standard plot
+-	if not handle:
+-		p.subplot(nlines,ncols,i,aspect='equal')
++	#if not handle:
++	#	p.subplot(nlines,ncols,i,aspect='equal')
+ 
+ 	#plot unit
+ 	plot_unit(x,y,z,elements,data2,is2d,isplanet,datatype,options)
+Index: ../trunk-jpl/src/m/plot/plot_overlay.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_overlay.py	(revision 17755)
++++ ../trunk-jpl/src/m/plot/plot_overlay.py	(revision 17756)
+@@ -51,7 +51,7 @@
+ 	
+ 	gtif=gdal.Open(inputname)
+ 	arr=gtif.ReadAsArray()
+-	os.system('rm -rf ./temp.tif')
++	#os.system('rm -rf ./temp.tif')
+ 	
+ 	if gtif.RasterCount>=3:  # RGB array
+ 		r=gtif.GetRasterBand(1).ReadAsArray()
+@@ -62,6 +62,20 @@
+ 	# normalize array
+ 	arr=arr/npy.float(npy.max(arr.ravel()))
+ 
++	if options.getfieldvalue('overlayhist',0)==1:
++		ax=plt.gca()
++		num=2
++		while True:
++			if not plt.fignum_exists(num):
++				break
++			else:
++				num+=1
++		plt.figure(num)
++		plt.hist(arr.flatten(),bins=256,range=(0.,1.))
++		plt.title('histogram of overlay image, use for setting overlaylims')
++		plt.sca(ax) # return to original axes/figure
++		
++
+ 	# get parameters from cropped geotiff
+ 	trans=gtif.GetGeoTransform()
+ 	xmin=trans[0]
+@@ -88,6 +102,7 @@
+ 	overlaylims=options.getfieldvalue('overlaylims',[min(arr.ravel()),max(arr.ravel())])
+ 
+ 	norm=mpl.colors.Normalize(vmin=overlaylims[0],vmax=overlaylims[1])
++
+ 	handle.pcolormesh(xgmap, ygmap, npy.flipud(arr), cmap=mpl.cm.Greys, norm=norm)
+-	plt.axes().set_aspect('equal','box')
++	handle.set_aspect('equal','box')
+ 	return handle
+Index: ../trunk-jpl/src/m/plot/plot_contour.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_contour.py	(revision 0)
++++ ../trunk-jpl/src/m/plot/plot_contour.py	(revision 17756)
+@@ -0,0 +1,39 @@
++from averaging import averaging
++import matplotlib.pyplot as plt
++from processmesh import processmesh
++from processdata import processdata
++
++def plot_contour(md,datain,options):
++	'''
++	plot contours of a given field (called within plotmodel)
++
++	Usage:
++		plot_contour(md,data,options)
++
++	See also: plotmodel
++	'''
++
++	x,y,z,elements,is2d,isplanet=processmesh(md,datain,options)
++	data,datatype=processdata(md,datain,options)
++	ax=plt.gca()
++
++	# process data: must be on nodes
++	if datatype==1: # element data
++		data=averaging(md,data,0)
++	elif datatype==2:
++		pass
++	elif datatype==3: # quiver (vector) data
++		data=npy.sqrt(datain**2)
++	else:
++		raise ValueError('datatype not supported in call to plot_contour')
++
++	# contouronly TODO (cla will also clear an overlay image)
++
++	# retrieve necessary options
++	levels=options.getfieldvalue('contourlevels')
++	colors=options.getfieldvalue('contourcolors')
++	norm=options.getfieldvalue('colornorm')
++	linestyles=options.getfieldvalue('contourlinestyles')
++	linewidths=options.getfieldvalue('contourlinewidths')
++
++	ax.tricontour(x,y,elements,data,levels,colors=colors,norm=norm,linestyles=linestyles,linewidths=linewidths)
+Index: ../trunk-jpl/src/m/plot/plotmodel.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plotmodel.py	(revision 17755)
++++ ../trunk-jpl/src/m/plot/plotmodel.py	(revision 17756)
+@@ -55,8 +55,9 @@
+ 		#handling the 'visible' option will need some check on whether ipython is currently in interactive or non-interactive mode
+ 
+ 		if not hold: # TODO need to also check whether figurenumber is a new plot so that old plots are not mistakenly cleared
+-			p.clf()
++			p.cla()
+ 
++		#TODO fig, axarray = plt.subplots(nrows,ncols), then pass fix and axarr to plot_manager
+ 		#if figsize specified
+ 		if options.list[0].exist('figsize'):
+ 			figsize=options.list[0].getfieldvalue('figsize')
+Index: ../trunk-jpl/src/m/plot/applyoptions.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/applyoptions.py	(revision 17755)
++++ ../trunk-jpl/src/m/plot/applyoptions.py	(revision 17756)
+@@ -1,5 +1,6 @@
+ import numpy as npy
+ from cmaptools import truncate_colormap
++from plot_contour import plot_contour
+ 
+ try:
+ 	from matplotlib.ticker import MaxNLocator
+@@ -23,6 +24,10 @@
+ 	#if not isnan(md.mesh.hemisphere):
+ 	#	options.addfielddefault('hemisphere',md.mesh.hemisphere)
+ 
++	# get handle to current figure and axes instance
++	fig = p.gcf()
++	ax=p.gca()
++
+ 	#font {{{
+ 	fontsize=options.getfieldvalue('fontsize',14)
+ 	fontweight=options.getfieldvalue('fontweight','normal')
+@@ -112,12 +117,11 @@
+ 	#}}}
+ 
+ 	#ticklabel notation {{{
+-	p.gca().ticklabel_format(style='sci',scilimits=(0,0))
++	#ax.ticklabel_format(style='sci',scilimits=(0,0))
+ 	#}}}
+ 
+ 	#ticklabelfontsize {{{
+ 	if options.exist('ticklabelfontsize'):
+-		ax=p.gca()
+ 		for label in ax.get_xticklabels() + ax.get_yticklabels():
+ 			label.set_fontsize(options.getfieldvalue('ticklabelfontsize'))
+ 		if int(md.mesh.dimension)==3: 
+@@ -130,9 +134,9 @@
+ 	#axis {{{
+ 	if options.exist('axis'):
+ 		if options.getfieldvalue('axis',True)=='off':
+-			p.gca().ticklabel_format(style='plain')
+-			p.setp(p.gca().get_xticklabels(), visible=False)
+-			p.setp(p.gca().get_yticklabels(), visible=False)
++			ax.ticklabel_format(style='plain')
++			p.setp(ax.get_xticklabels(), visible=False)
++			p.setp(ax.get_yticklabels(), visible=False)
+ 	# }}}
+ 
+ 	#box
+@@ -176,27 +180,27 @@
+ 	# default sequential colormap
+ 	defaultmap=truncate_colormap(mpl.cm.gnuplot2,0.1,0.9,128)
+ 	cmap=options.getfieldvalue('colormap',defaultmap)
++	norm = mpl.colors.Normalize(vmin=lims[0], vmax=lims[1])
++	options.addfield('colornorm',norm)
++	cbar_extend=0
++	if options.exist('cmap_set_over'):
++		over=options.getfieldvalue('cmap_set_over','0.5')
++		cmap.set_over(over)
++		cbar_extend+=1
++	if options.exist('cmap_set_under'):
++		under=options.getfieldvalue('cmap_set_under','0.5')
++		cmap.set_under(under)
++		cbar_extend+=2
++	options.addfield('colormap',cmap)
+ 	#}}}
+ 
+ 	#wrapping
+ 
+ 	#colorbar {{{
+ 	if options.getfieldvalue('colorbar',1)==1:
+-		fig = p.gcf()
+-		ax = p.gca()
+ 		divider = make_axes_locatable(ax)
+ 		cax = divider.new_horizontal("5%", pad=0.05, axes_class=mpl.axes.Axes)
+ 		fig.add_axes(cax) 
+-		norm = mpl.colors.Normalize(vmin=lims[0], vmax=lims[1])
+-		cbar_extend=0
+-		if options.exist('cmap_set_over'):
+-			over=options.getfieldvalue('cmap_set_over','0.5')
+-			cmap.set_over(over)
+-			cbar_extend+=1
+-		if options.exist('cmap_set_under'):
+-			under=options.getfieldvalue('cmap_set_under','0.5')
+-			cmap.set_under(under)
+-			cbar_extend+=2
+ 		if cbar_extend==0:
+ 			extend='neither'
+ 		elif cbar_extend==1:
+@@ -225,7 +229,10 @@
+ 
+ 	#streamlines
+ 
+-	#contours
++	#contours {{{
++	if options.exist('contourlevels'):
++		plot_contour(md,data,options)
++	#}}}
+ 
+ 	#axis positions
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17756-17757.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17756-17757.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17756-17757.diff	(revision 17802)
@@ -0,0 +1,720 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17756)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17757)
+@@ -130,6 +130,7 @@
+ 	bool   control_analysis;
+ 	bool   dakota_analysis;
+ 	bool   islevelset;
++	bool   isdamage;
+ 
+ 	/*Fetch constants needed: */
+ 	iomodel->Constant(&isSSA,FlowequationIsSSAEnum);
+@@ -154,6 +155,11 @@
+ 	else
+ 	 iscoupling = false;
+ 
++	/*is damage mechanics being used?*/
++	if(materials_type==MaticeEnum) isdamage = false;
++	else if(materials_type==MatdamageiceEnum) isdamage = true;
++	else _error_("Material type not recognized");
++
+ 	/*Get finite element type*/
+ 	if(!iscoupling){
+ 		if(isSSA)       iomodel->Constant(&finiteelement,FlowequationFeSSAEnum);
+@@ -211,7 +217,7 @@
+ 	if(dakota_analysis)elements->InputDuplicate(VyEnum,QmuVyEnum);
+ 	iomodel->FetchDataToInput(elements,LoadingforceXEnum);
+ 	iomodel->FetchDataToInput(elements,LoadingforceYEnum);
+-	iomodel->FetchDataToInput(elements,DamageDEnum);
++	if(isdamage)iomodel->FetchDataToInput(elements,DamageDEnum);
+ 
+ 	if(iomodel->domaintype==Domain3DEnum){
+ 		if(iomodel->meshelementtype==PentaEnum){
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17756)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17757)
+@@ -172,6 +172,7 @@
+ 	DamageC2Enum,
+ 	DamageC3Enum,
+ 	DamageC4Enum,
++	DamageElementinterpEnum,
+ 	DamageHealingEnum,
+ 	DamageStressThresholdEnum,
+ 	DamageStabilizationEnum,
+@@ -415,6 +416,7 @@
+ 	IntVecParamEnum,
+ 	TransientParamEnum,
+ 	MaticeEnum,
++	MatdamageiceEnum,
+ 	MatparEnum,
+ 	NodeEnum,
+ 	NumericalfluxEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17756)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17757)
+@@ -180,6 +180,7 @@
+ 		case DamageC2Enum : return "DamageC2";
+ 		case DamageC3Enum : return "DamageC3";
+ 		case DamageC4Enum : return "DamageC4";
++		case DamageElementinterpEnum : return "DamageElementinterp";
+ 		case DamageHealingEnum : return "DamageHealing";
+ 		case DamageStressThresholdEnum : return "DamageStressThreshold";
+ 		case DamageStabilizationEnum : return "DamageStabilization";
+@@ -410,6 +411,7 @@
+ 		case IntVecParamEnum : return "IntVecParam";
+ 		case TransientParamEnum : return "TransientParam";
+ 		case MaticeEnum : return "Matice";
++		case MatdamageiceEnum : return "Matdamageice";
+ 		case MatparEnum : return "Matpar";
+ 		case NodeEnum : return "Node";
+ 		case NumericalfluxEnum : return "Numericalflux";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17756)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17757)
+@@ -183,6 +183,7 @@
+ 	      else if (strcmp(name,"DamageC2")==0) return DamageC2Enum;
+ 	      else if (strcmp(name,"DamageC3")==0) return DamageC3Enum;
+ 	      else if (strcmp(name,"DamageC4")==0) return DamageC4Enum;
++	      else if (strcmp(name,"DamageElementinterp")==0) return DamageElementinterpEnum;
+ 	      else if (strcmp(name,"DamageHealing")==0) return DamageHealingEnum;
+ 	      else if (strcmp(name,"DamageStressThreshold")==0) return DamageStressThresholdEnum;
+ 	      else if (strcmp(name,"DamageStabilization")==0) return DamageStabilizationEnum;
+@@ -258,11 +259,11 @@
+ 	      else if (strcmp(name,"SettingsOutputFrequency")==0) return SettingsOutputFrequencyEnum;
+ 	      else if (strcmp(name,"SettingsWaitonlock")==0) return SettingsWaitonlockEnum;
+ 	      else if (strcmp(name,"DebugProfiling")==0) return DebugProfilingEnum;
+-	      else if (strcmp(name,"ProfilingCurrentMem")==0) return ProfilingCurrentMemEnum;
+          else stage=3;
+    }
+    if(stage==3){
+-	      if (strcmp(name,"ProfilingCurrentFlops")==0) return ProfilingCurrentFlopsEnum;
++	      if (strcmp(name,"ProfilingCurrentMem")==0) return ProfilingCurrentMemEnum;
++	      else if (strcmp(name,"ProfilingCurrentFlops")==0) return ProfilingCurrentFlopsEnum;
+ 	      else if (strcmp(name,"ProfilingSolutionTime")==0) return ProfilingSolutionTimeEnum;
+ 	      else if (strcmp(name,"MaxIterationConvergenceFlag")==0) return MaxIterationConvergenceFlagEnum;
+ 	      else if (strcmp(name,"SteadystateMaxiter")==0) return SteadystateMaxiterEnum;
+@@ -381,11 +382,11 @@
+ 	      else if (strcmp(name,"HOApproximation")==0) return HOApproximationEnum;
+ 	      else if (strcmp(name,"HOFSApproximation")==0) return HOFSApproximationEnum;
+ 	      else if (strcmp(name,"FSApproximation")==0) return FSApproximationEnum;
+-	      else if (strcmp(name,"FSvelocity")==0) return FSvelocityEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"FSpressure")==0) return FSpressureEnum;
++	      if (strcmp(name,"FSvelocity")==0) return FSvelocityEnum;
++	      else if (strcmp(name,"FSpressure")==0) return FSpressureEnum;
+ 	      else if (strcmp(name,"Constraints")==0) return ConstraintsEnum;
+ 	      else if (strcmp(name,"Loads")==0) return LoadsEnum;
+ 	      else if (strcmp(name,"Materials")==0) return MaterialsEnum;
+@@ -419,6 +420,7 @@
+ 	      else if (strcmp(name,"IntVecParam")==0) return IntVecParamEnum;
+ 	      else if (strcmp(name,"TransientParam")==0) return TransientParamEnum;
+ 	      else if (strcmp(name,"Matice")==0) return MaticeEnum;
++	      else if (strcmp(name,"Matdamageice")==0) return MatdamageiceEnum;
+ 	      else if (strcmp(name,"Matpar")==0) return MatparEnum;
+ 	      else if (strcmp(name,"Node")==0) return NodeEnum;
+ 	      else if (strcmp(name,"Numericalflux")==0) return NumericalfluxEnum;
+@@ -503,12 +505,12 @@
+ 	      else if (strcmp(name,"ThicknessAbsMisfit")==0) return ThicknessAbsMisfitEnum;
+ 	      else if (strcmp(name,"Vel")==0) return VelEnum;
+ 	      else if (strcmp(name,"Velocity")==0) return VelocityEnum;
+-	      else if (strcmp(name,"VxAverage")==0) return VxAverageEnum;
+-	      else if (strcmp(name,"Vx")==0) return VxEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"VxPicard")==0) return VxPicardEnum;
++	      if (strcmp(name,"VxAverage")==0) return VxAverageEnum;
++	      else if (strcmp(name,"Vx")==0) return VxEnum;
++	      else if (strcmp(name,"VxPicard")==0) return VxPicardEnum;
+ 	      else if (strcmp(name,"VyAverage")==0) return VyAverageEnum;
+ 	      else if (strcmp(name,"Vy")==0) return VyEnum;
+ 	      else if (strcmp(name,"VyPicard")==0) return VyPicardEnum;
+@@ -626,12 +628,12 @@
+ 	      else if (strcmp(name,"SubelementMigration")==0) return SubelementMigrationEnum;
+ 	      else if (strcmp(name,"SubelementMigration2")==0) return SubelementMigration2Enum;
+ 	      else if (strcmp(name,"Contact")==0) return ContactEnum;
+-	      else if (strcmp(name,"MaskGroundediceLevelset")==0) return MaskGroundediceLevelsetEnum;
+-	      else if (strcmp(name,"QmuMaskGroundediceLevelset")==0) return QmuMaskGroundediceLevelsetEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"GaussSeg")==0) return GaussSegEnum;
++	      if (strcmp(name,"MaskGroundediceLevelset")==0) return MaskGroundediceLevelsetEnum;
++	      else if (strcmp(name,"QmuMaskGroundediceLevelset")==0) return QmuMaskGroundediceLevelsetEnum;
++	      else if (strcmp(name,"GaussSeg")==0) return GaussSegEnum;
+ 	      else if (strcmp(name,"GaussTria")==0) return GaussTriaEnum;
+ 	      else if (strcmp(name,"GaussTetra")==0) return GaussTetraEnum;
+ 	      else if (strcmp(name,"GaussPenta")==0) return GaussPentaEnum;
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17756)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17757)
+@@ -18,7 +18,7 @@
+ void CreateParameters(Parameters* parameters,IoModel* iomodel,char* rootpath,FILE* toolkitsoptionsfid,const int solution_type){
+ 
+ 	int         i,j,m,k;
+-	int         numoutputs,domaintype,smb_model;
++	int         numoutputs,domaintype,materialtype,smb_model;
+ 	char**      requestedoutputs = NULL;
+ 	IssmDouble  time;
+ 	bool        ispdd,isdelta18o;
+@@ -148,10 +148,13 @@
+ 	if(numoutputs)parameters->AddObject(new StringArrayParam(SteadystateRequestedOutputsEnum,requestedoutputs,numoutputs));
+ 	iomodel->DeleteData(&requestedoutputs,numoutputs,SteadystateRequestedOutputsEnum);
+ 
+-	iomodel->FetchData(&requestedoutputs,&numoutputs,DamageEvolutionRequestedOutputsEnum);
+-	parameters->AddObject(new IntParam(DamageEvolutionNumRequestedOutputsEnum,numoutputs));
+-	if(numoutputs)parameters->AddObject(new StringArrayParam(DamageEvolutionRequestedOutputsEnum,requestedoutputs,numoutputs));
+-	iomodel->DeleteData(&requestedoutputs,numoutputs,DamageEvolutionRequestedOutputsEnum);
++	iomodel->Constant(&materialtype,MaterialsEnum);
++	if(materialtype==MatdamageiceEnum){
++		iomodel->FetchData(&requestedoutputs,&numoutputs,DamageEvolutionRequestedOutputsEnum);
++		parameters->AddObject(new IntParam(DamageEvolutionNumRequestedOutputsEnum,numoutputs));
++		if(numoutputs)parameters->AddObject(new StringArrayParam(DamageEvolutionRequestedOutputsEnum,requestedoutputs,numoutputs));
++		iomodel->DeleteData(&requestedoutputs,numoutputs,DamageEvolutionRequestedOutputsEnum);
++	}
+ 
+ 	/*Deal with mass flux segments: {{{*/
+ 	iomodel->FetchData(&qmu_mass_flux_present,QmuMassFluxSegmentsPresentEnum);
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp	(revision 17756)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp	(revision 17757)
+@@ -81,6 +81,7 @@
+ 		if(solution_enum==TransientSolutionEnum && analysis_enum==HydrologyShreveAnalysisEnum && ishydrology==false) continue;
+ 		if(solution_enum==TransientSolutionEnum && analysis_enum==HydrologyDCEfficientAnalysisEnum && ishydrology==false) continue;
+ 		if(solution_enum==TransientSolutionEnum && analysis_enum==HydrologyDCInefficientAnalysisEnum && ishydrology==false) continue;
++		if(solution_enum==TransientSolutionEnum && analysis_enum==DamageEvolutionAnalysisEnum && isdamage==false) continue;
+ 
+ 		if(VerboseMProcessor()) _printf0_("   creating datasets for analysis " << EnumToStringx(analysis_enum) << "\n");
+ 		Analysis* analysis = EnumToAnalysis(analysis_enum);
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp	(revision 17756)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp	(revision 17757)
+@@ -51,6 +51,22 @@
+ 		case MaticeEnum:
+ 			iomodel->FetchDataToInput(elements,MaterialsRheologyBEnum);
+ 			iomodel->FetchDataToInput(elements,MaterialsRheologyNEnum);
++			for (i=0;i<iomodel->numberofelements;i++) if(iomodel->my_elements[i]) materials->AddObject(new Matice(i+1,i,iomodel));
++			switch(iomodel->domaindim){
++				case 2:
++					elements->InputDuplicate(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum);
++					if(dakota_analysis) elements->InputDuplicate(MaterialsRheologyBbarEnum,QmuMaterialsRheologyBEnum);
++					break;
++				case 3:
++					if(dakota_analysis) elements->InputDuplicate(MaterialsRheologyBEnum,QmuMaterialsRheologyBEnum); 
++					break;
++				default:
++					_error_("Mesh not supported yet");
++			}
++			break;
++		case MatdamageiceEnum:
++			iomodel->FetchDataToInput(elements,MaterialsRheologyBEnum);
++			iomodel->FetchDataToInput(elements,MaterialsRheologyNEnum);
+ 			iomodel->FetchDataToInput(elements,DamageDEnum);
+ 			for (i=0;i<iomodel->numberofelements;i++) if(iomodel->my_elements[i]) materials->AddObject(new Matice(i+1,i,iomodel));
+ 			switch(iomodel->domaindim){
+Index: ../trunk-jpl/src/c/classes/Materials/Matice.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 17756)
++++ ../trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 17757)
+@@ -47,6 +47,13 @@
+ 	this->helement=new Hook(&matice_eid,1);
+ 	this->element=NULL;
+ 
++	 /*Other perporties*/
++   int    materialtype;
++   iomodel->Constant(&materialtype,MaterialsEnum);
++   if(materialtype==MatdamageiceEnum) this->isdamage = true;
++   else if(materialtype==MaticeEnum) this->isdamage = false;
++   else _error_("Material type not recognized");
++
+ 	return;
+ 
+ }
+@@ -198,9 +205,9 @@
+ /*FUNCTION Matice::GetD {{{*/
+ IssmDouble Matice::GetD(){
+ 
++	_assert_(this->isdamage);
+ 	/*Output*/
+ 	IssmDouble D;
+-
+ 	element->inputs->GetInputAverage(&D,DamageDEnum);
+ 	return D;
+ }
+@@ -208,6 +215,7 @@
+ /*FUNCTION Matice::GetDbar {{{*/
+ IssmDouble Matice::GetDbar(){
+ 
++	_assert_(this->isdamage);
+ 	/*Output*/
+ 	IssmDouble Dbar;
+ 	element->inputs->GetInputAverage(&Dbar,DamageDbarEnum);
+@@ -232,12 +240,15 @@
+ 	IssmDouble viscosity;
+ 
+ 	/*Intermediary: */
+-	IssmDouble B,D,n;
++	IssmDouble B,D=0.,n;
+ 
+ 	/*Get B and n*/
+ 	B=GetB(); _assert_(B>0.);
+ 	n=GetN(); _assert_(n>0.);
+-	D=GetD(); _assert_(D>=0. && D<1.);
++	if(this->isdamage){
++		D=GetD();
++		_assert_(D>=0. && D<1.);
++	}
+ 
+ 	if (n==1.){
+ 		/*Linear Viscous behavior (Newtonian fluid) viscosity=B/2: */
+@@ -282,12 +293,15 @@
+ 	IssmDouble viscosity;
+ 
+ 	/*Intermediary: */
+-	IssmDouble B,D,n;
++	IssmDouble B,D=0.,n;
+ 
+ 	/*Get B and n*/
+ 	B=GetBbar(); _assert_(B>0.);
+ 	n=GetN();    _assert_(n>0.);
+-	D=GetDbar(); _assert_(D>=0. && D<1.);
++	if(this->isdamage){
++		D=GetDbar();
++		_assert_(D>=0. && D<1.);
++	}
+ 
+ 	if (n==1.){
+ 		/*Linear Viscous behavior (Newtonian fluid) viscosity=B/2: */
+@@ -333,10 +347,13 @@
+ 
+ 	/*Intermediary value A and exponent e: */
+ 	IssmDouble A,e;
+-	IssmDouble D,n;
++	IssmDouble D=0.,n;
+ 
+ 	/*Get D and n*/
+-	D=GetDbar();
++	if(this->isdamage){
++		D=GetDbar(); /* GetD()? */
++		_assert_(D>=0. && D<1.);
++	}
+ 	n=GetN();
+ 
+ 	if(epsilon){
+Index: ../trunk-jpl/src/c/classes/Materials/Matice.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matice.h	(revision 17756)
++++ ../trunk-jpl/src/c/classes/Materials/Matice.h	(revision 17757)
+@@ -23,6 +23,7 @@
+ 
+ 	private: 
+ 		int      mid;
++		bool     isdamage;
+ 		Hook    *helement;
+ 		Element *element;
+ 
+Index: ../trunk-jpl/src/m/mech/mechanicalproperties.m
+===================================================================
+--- ../trunk-jpl/src/m/mech/mechanicalproperties.m	(revision 17756)
++++ ../trunk-jpl/src/m/mech/mechanicalproperties.m	(revision 17757)
+@@ -115,7 +115,7 @@
+ stress.principalaxis1=directionsstress(:,1:2);
+ stress.principalvalue2=valuesstress(:,2);
+ stress.principalaxis2=directionsstress(:,3:4);
+-stress.effectivevalue=1/sqrt(2)*sqrt(stress.xx.^2+stress.yy.^2+2*stress.xy.^2); % effective shear stress
++stress.effectivevalue=1/sqrt(2)*sqrt(stress.xx.^2+stress.yy.^2+2*stress.xy.^2); % effective shear stress (sqrt(J2))
+ md.results.stress=stress;
+ 
+ strainrate=struct('xx',[],'yy',[],'xy',[],'principalvalue1',[],'principalaxis1',[],'principalvalue2',[],'principalaxis2',[],'effectivevalue',[]);
+Index: ../trunk-jpl/src/m/classes/matdamageice.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/matdamageice.m	(revision 0)
++++ ../trunk-jpl/src/m/classes/matdamageice.m	(revision 17757)
+@@ -0,0 +1,197 @@
++%MATICE class definition
++%
++%   Usage:
++%      matice=matice();
++
++classdef matice
++	properties (SetAccess=public) 
++		rho_ice                    = 0.;
++		rho_water                  = 0.;
++		rho_freshwater             = 0.;
++		mu_water                   = 0.;
++		heatcapacity               = 0.;
++		latentheat                 = 0.;
++		thermalconductivity        = 0.;
++		temperateiceconductivity   = 0.;
++		meltingpoint               = 0.;
++		beta                       = 0.;
++		mixed_layer_capacity       = 0.;
++		thermal_exchange_velocity  = 0.;
++		rheology_B   = NaN;
++		rheology_n   = NaN;
++		rheology_law = '';
++
++		%gia: 
++		lithosphere_shear_modulus  = 0.;
++		lithosphere_density        = 0.;
++		mantle_shear_modulus       = 0.;
++		mantle_density             = 0.;
++
++	end
++	methods
++        function createxml(obj,fid) % {{{
++            fprintf(fid, '\n\n');
++            fprintf(fid, '<!-- materials -->\n');
++			 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rho_ice" type="',class(obj.rho_ice),'" default="',convert2str(obj.rho_ice),'">','     <section name="materials" />','     <help> ice density [kg/m^3] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rho_water" type="',class(obj.rho_water),'" default="',convert2str(obj.rho_water),'">','     <section name="materials" />','     <help> ocean water density [kg/m^3] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rho_freshwater" type="',class(obj.rho_freshwater),'" default="',convert2str(obj.rho_freshwater),'">','     <section name="materials" />','     <help> fresh water density [kg/m^3] </help>','</parameter>');
++             
++  
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mu_water" type="',class(obj.mu_water),'" default="',convert2str(obj.mu_water),'">','     <section name="materials" />','     <help> water viscosity [N s/m^2] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="heatcapacity" type="',class(obj.heatcapacity),'" default="',convert2str(obj.heatcapacity),'">','     <section name="materials" />','     <help> heat capacity [J/kg/K] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="latentheat" type="',class(obj.latentheat),'" default="',convert2str(obj.latentheat),'">','     <section name="materials" />','     <help> latent heat of fusion [J/kg] </help>','</parameter>');
++             
++             
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="thermalconductivity" type="',class(obj.thermalconductivity),'" default="',convert2str(obj.thermalconductivity),'">','     <section name="materials" />','     <help> ice thermal conductivity [W/m/K] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="temperateiceconductivity" type="',class(obj.temperateiceconductivity),'" default="',convert2str(obj.temperateiceconductivity),'">','     <section name="materials" />','     <help> temperate ice thermal conductivity [W/m/K] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="meltingpoint" type="',class(obj.meltingpoint),'" default="',convert2str(obj.meltingpoint),'">','     <section name="materials" />','     <help> melting point of ice at 1atm in K </help>','</parameter>');
++             
++             
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="beta" type="',class(obj.beta),'" default="',convert2str(obj.beta),'">','     <section name="materials" />','     <help> rate of change of melting point with pressure [K/Pa] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mixed_layer_capacity" type="',class(obj.mixed_layer_capacity),'" default="',convert2str(obj.mixed_layer_capacity),'">','     <section name="materials" />','     <help> mixed layer capacity [W/kg/K] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="thermal_exchange_velocity" type="',class(obj.thermal_exchange_velocity),'" default="',convert2str(obj.thermal_exchange_velocity),'">','     <section name="materials" />','     <help> thermal exchange velocity [m/s] </help>','</parameter>');
++             
++             
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rheology_B" type="',class(obj.rheology_B),'" default="',convert2str(obj.rheology_B),'">','     <section name="materials" />','     <help> flow law parameter [Pa/s^(1/n)] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rheology_n" type="',class(obj.rheology_n),'" default="',convert2str(obj.rheology_n),'">','     <section name="materials" />','     <help> Glens flow law exponent </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rheology_law" type="',class(obj.rheology_law),'" default="',convert2str(obj.rheology_law),'">','     <section name="materials" />','     <help> law for the temperature dependance of the rheology: "None", "Paterson",  "Arrhenius" or "LliboutryDuval" </help>','</parameter>');
++             
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="lithosphere_shear_modulus" type="',class(obj.lithosphere_shear_modulus),'" default="',convert2str(obj.lithosphere_shear_modulus),'">','     <section name="materials" />','     <help> Lithosphere shear modulus [Pa] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="lithosphere_density" type="',class(obj.lithosphere_density),'" default="',convert2str(obj.lithosphere_density),'">','     <section name="materials" />','     <help> Lithosphere density [g/cm^-3] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mantle_shear_modulus" type="',class(obj.mantle_shear_modulus),'" default="',convert2str(obj.mantle_shear_modulus),'">','     <section name="materials" />','     <help> Mantle shear modulus [Pa] </help>','</parameter>');
++             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mantle_density" type="',class(obj.mantle_density),'" default="',convert2str(obj.mantle_density),'">','     <section name="materials" />','     <help> Mantle density [g/cm^-3] </help>','</parameter>');
++        
++         
++        end % }}}
++		function obj = matice(varargin) % {{{
++			switch nargin
++				case 0
++					obj=setdefaultparameters(obj);
++				case 1
++					inputstruct=varargin{1};
++					list1 = properties('matice');
++					list2 = fieldnames(inputstruct);
++					for i=1:length(list1)
++						fieldname = list1{i};
++						if ismember(fieldname,list2),
++							obj.(fieldname) = inputstruct.(fieldname);
++						end
++					end
++				otherwise
++					error('constructor not supported');
++			end
++		end % }}}
++		function obj = setdefaultparameters(obj) % {{{
++
++			%ice density (kg/m^3)
++			obj.rho_ice=917.;
++
++			%ocean water density (kg/m^3)
++			obj.rho_water=1023.;
++
++			%fresh water density (kg/m^3)
++			obj.rho_freshwater=1000.;
++
++			%water viscosity (N.s/m^2)
++			obj.mu_water=0.001787;  
++
++			%ice heat capacity cp (J/kg/K)
++			obj.heatcapacity=2093.;
++
++			%ice latent heat of fusion L (J/kg)
++			obj.latentheat=3.34*10^5;
++
++			%ice thermal conductivity (W/m/K)
++			obj.thermalconductivity=2.4;
++			
++			%wet ice thermal conductivity (W/m/K)
++			obj.temperateiceconductivity=.24;
++
++			%the melting point of ice at 1 atmosphere of pressure in K
++			obj.meltingpoint=273.15;
++
++			%rate of change of melting point with pressure (K/Pa)
++			obj.beta=9.8*10^-8;
++
++			%mixed layer (ice-water interface) heat capacity (J/kg/K)
++			obj.mixed_layer_capacity=3974.;
++
++			%thermal exchange velocity (ice-water interface) (m/s)
++			obj.thermal_exchange_velocity=1.00*10^-4;
++
++			%Rheology law: what is the temperature dependence of B with T
++			%available: none, paterson and arrhenius
++			obj.rheology_law='Paterson';
++
++			% GIA:
++			obj.lithosphere_shear_modulus  = 6.7*10^10;  % (Pa)
++			obj.lithosphere_density        = 3.32;       % (g/cm^-3)
++			obj.mantle_shear_modulus       = 1.45*10^11; % (Pa)
++			obj.mantle_density             = 3.34;       % (g/cm^-3)
++
++		end % }}}
++		function md = checkconsistency(obj,md,solution,analyses) % {{{
++			md = checkfield(md,'fieldname','materials.rho_ice','>',0);
++			md = checkfield(md,'fieldname','materials.rho_water','>',0);
++			md = checkfield(md,'fieldname','materials.rho_freshwater','>',0);
++			md = checkfield(md,'fieldname','materials.mu_water','>',0);
++			md = checkfield(md,'fieldname','materials.rheology_B','>',0,'size',[md.mesh.numberofvertices 1]);
++			md = checkfield(md,'fieldname','materials.rheology_n','>',0,'size',[md.mesh.numberofelements 1]);
++			md = checkfield(md,'fieldname','materials.rheology_law','values',{'None' 'Cuffey' 'Paterson' 'Arrhenius' 'LliboutryDuval'});
++
++			if ismember(GiaAnalysisEnum(),analyses),
++				md = checkfield(md,'fieldname','materials.lithosphere_shear_modulus','>',0,'numel',1);
++				md = checkfield(md,'fieldname','materials.lithosphere_density','>',0,'numel',1);
++				md = checkfield(md,'fieldname','materials.mantle_shear_modulus','>',0,'numel',1);
++				md = checkfield(md,'fieldname','materials.mantle_density','>',0,'numel',1);
++			end
++
++		end % }}}
++		function disp(obj) % {{{
++			disp(sprintf('   Materials:'));
++
++			fielddisplay(obj,'rho_ice','ice density [kg/m^3]');
++			fielddisplay(obj,'rho_water','ocean water density [kg/m^3]');
++			fielddisplay(obj,'rho_freshwater','fresh water density [kg/m^3]');
++			fielddisplay(obj,'mu_water','water viscosity [N s/m^2]');
++			fielddisplay(obj,'heatcapacity','heat capacity [J/kg/K]');
++			fielddisplay(obj,'thermalconductivity',['ice thermal conductivity [W/m/K]']);
++			fielddisplay(obj,'temperateiceconductivity','temperate ice thermal conductivity [W/m/K]');
++			fielddisplay(obj,'meltingpoint','melting point of ice at 1atm in K');
++			fielddisplay(obj,'latentheat','latent heat of fusion [J/kg]');
++			fielddisplay(obj,'beta','rate of change of melting point with pressure [K/Pa]');
++			fielddisplay(obj,'mixed_layer_capacity','mixed layer capacity [W/kg/K]');
++			fielddisplay(obj,'thermal_exchange_velocity','thermal exchange velocity [m/s]');
++			fielddisplay(obj,'rheology_B','flow law parameter [Pa/s^(1/n)]');
++			fielddisplay(obj,'rheology_n','Glen''s flow law exponent');
++			fielddisplay(obj,'rheology_law',['law for the temperature dependance of the rheology: ''None'', ''Cuffey'', ''Paterson'', ''Arrhenius'' or ''LliboutryDuval''']);
++			fielddisplay(obj,'lithosphere_shear_modulus','Lithosphere shear modulus [Pa]');
++			fielddisplay(obj,'lithosphere_density','Lithosphere density [g/cm^-3]');
++			fielddisplay(obj,'mantle_shear_modulus','Mantle shear modulus [Pa]');
++			fielddisplay(obj,'mantle_density','Mantle density [g/cm^-3]');
++		end % }}}
++		function marshall(obj,md,fid) % {{{
++			WriteData(fid,'enum',MaterialsEnum(),'data',MatdamageiceEnum(),'format','Integer');
++			WriteData(fid,'object',obj,'class','materials','fieldname','rho_ice','format','Double');
++			WriteData(fid,'object',obj,'class','materials','fieldname','rho_water','format','Double');
++			WriteData(fid,'object',obj,'class','materials','fieldname','rho_freshwater','format','Double');
++			WriteData(fid,'object',obj,'class','materials','fieldname','mu_water','format','Double');
++			WriteData(fid,'object',obj,'class','materials','fieldname','heatcapacity','format','Double');
++			WriteData(fid,'object',obj,'class','materials','fieldname','latentheat','format','Double');
++			WriteData(fid,'object',obj,'class','materials','fieldname','thermalconductivity','format','Double');
++			WriteData(fid,'object',obj,'class','materials','fieldname','temperateiceconductivity','format','Double');
++			WriteData(fid,'object',obj,'class','materials','fieldname','meltingpoint','format','Double');
++			WriteData(fid,'object',obj,'class','materials','fieldname','beta','format','Double');
++			WriteData(fid,'object',obj,'class','materials','fieldname','mixed_layer_capacity','format','Double');
++			WriteData(fid,'object',obj,'class','materials','fieldname','thermal_exchange_velocity','format','Double');
++			WriteData(fid,'object',obj,'class','materials','fieldname','rheology_B','format','DoubleMat','mattype',1);
++			WriteData(fid,'object',obj,'class','materials','fieldname','rheology_n','format','DoubleMat','mattype',2);
++			WriteData(fid,'data',StringToEnum(obj.rheology_law),'enum',MaterialsRheologyLawEnum(),'format','Integer');
++
++			WriteData(fid,'object',obj,'class','materials','fieldname','lithosphere_shear_modulus','format','Double');
++			WriteData(fid,'object',obj,'class','materials','fieldname','lithosphere_density','format','Double','scale',10^3);
++			WriteData(fid,'object',obj,'class','materials','fieldname','mantle_shear_modulus','format','Double');
++			WriteData(fid,'object',obj,'class','materials','fieldname','mantle_density','format','Double','scale',10^3);
++		end % }}}
++	end
++end
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17756)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17757)
+@@ -29,10 +29,10 @@
+ 		cluster          = 0;
+ 
+ 		balancethickness = 0;
+-		stressbalance       = 0;
++		stressbalance    = 0;
+ 		groundingline    = 0;
+ 		hydrology        = 0;
+-		masstransport       = 0;
++		masstransport    = 0;
+ 		thermal          = 0;
+ 		steadystate      = 0;
+ 		transient        = 0;
+Index: ../trunk-jpl/src/m/classes/damage.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/damage.m	(revision 17756)
++++ ../trunk-jpl/src/m/classes/damage.m	(revision 17757)
+@@ -13,8 +13,9 @@
+ 	
+ 		%numerical
+ 		stabilization       = NaN;
++		maxiter             = NaN;
++		elementinterp       = '';
+ 		penalty_threshold   = NaN;
+-		maxiter             = NaN;
+ 		penalty_lock        = NaN;
+ 		penalty_factor      = NaN;
+ 		
+@@ -109,6 +110,9 @@
+ 			%Maximum number of iterations
+ 			obj.maxiter=100;
+ 
++			%finite element interpolation
++			obj.elementinterp='P1';
++
+ 			%factor used to compute the values of the penalties: kappa=max(stiffness matrix)*10^penalty_factor
+ 			obj.penalty_factor=3;
+ 			
+@@ -133,16 +137,19 @@
+ 		end % }}}
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+ 			
+-			md = checkfield(md,'fieldname','damage.D','>=',0,'<=',obj.max_damage,'size',[md.mesh.numberofvertices 1]);
+-			md = checkfield(md,'fieldname','damage.max_damage','<',1,'>=',0);
+ 			md = checkfield(md,'fieldname','damage.law','values',{'undamaged','pralong'});
+-			md = checkfield(md,'fieldname','damage.spcdamage','forcing',1);
+-			
+-			md = checkfield(md,'fieldname','damage.stabilization','numel',[1],'values',[0 1 2]);
+-			md = checkfield(md,'fieldname','damage.maxiter','>=0',0);
+-			md = checkfield(md,'fieldname','damage.penalty_factor','>=0',0);
+-			md = checkfield(md,'fieldname','damage.penalty_lock','>=0',0);
+-			md = checkfield(md,'fieldname','damage.penalty_threshold','>=0',0);
++			if ~strcmpi(obj.law,'undamaged'),
++				md = checkfield(md,'fieldname','damage.D','>=',0,'<=',obj.max_damage,'size',[md.mesh.numberofvertices 1]);
++				md = checkfield(md,'fieldname','damage.max_damage','<',1,'>=',0);
++				md = checkfield(md,'fieldname','damage.spcdamage','forcing',1);
++				
++				md = checkfield(md,'fieldname','damage.stabilization','numel',[1],'values',[0 1 2]);
++				md = checkfield(md,'fieldname','damage.maxiter','>=0',0);
++				md = checkfield(md,'fieldname','damage.elementinterp','values',{'P1','P2'});
++				md = checkfield(md,'fieldname','damage.penalty_factor','>=0',0);
++				md = checkfield(md,'fieldname','damage.penalty_lock','>=0',0);
++				md = checkfield(md,'fieldname','damage.penalty_threshold','>=0',0);
++			end
+ 
+ 			if strcmpi(obj.law,'pralong'),
+ 				md = checkfield(md,'fieldname','damage.healing','>=',0);
+@@ -168,21 +175,24 @@
+             list = {'DamageDbar'};
+          else
+             list = {'DamageD'};
+-         end
++			end
+ 		end % }}}
+ 		function disp(obj) % {{{
+ 			disp(sprintf('   Damage:\n'));
+ 
+-			fielddisplay(obj,'D','damage tensor (scalar)');
+ 			fielddisplay(obj,'law','damage law (string) from {''undamaged'',''pralong''}');
+-			fielddisplay(obj,'spcdamage','damage constraints (NaN means no constraint)');
+-			fielddisplay(obj,'max_damage','maximum possible damage (0<=max_damage<1)');
+-			
+-			fielddisplay(obj,'stabilization','0: no, 1: artificial_diffusivity, 2: SUPG');
+-			fielddisplay(obj,'maxiter','maximum number of non linear iterations');
+-			fielddisplay(obj,'penalty_lock','stabilize unstable damage constraints that keep zigzagging after n iteration (default is 0, no stabilization)');
+-			fielddisplay(obj,'penalty_threshold','threshold to declare convergence of damage evolution solution (default is 0)');
+-			fielddisplay(obj,'penalty_factor','scaling exponent (default is 3)');
++			if ~strcmpi(obj.law,'undamaged'),
++				fielddisplay(obj,'D','damage tensor (scalar)');
++				fielddisplay(obj,'spcdamage','damage constraints (NaN means no constraint)');
++				fielddisplay(obj,'max_damage','maximum possible damage (0<=max_damage<1)');
++				
++				fielddisplay(obj,'stabilization','0: no, 1: artificial_diffusivity, 2: SUPG');
++				fielddisplay(obj,'maxiter','maximum number of non linear iterations');
++				fielddisplay(obj,'elementinterp','interpolation scheme for finite elements {''P1'',''P2''}');
++				fielddisplay(obj,'penalty_lock','stabilize unstable damage constraints that keep zigzagging after n iteration (default is 0, no stabilization)');
++				fielddisplay(obj,'penalty_threshold','threshold to declare convergence of damage evolution solution (default is 0)');
++				fielddisplay(obj,'penalty_factor','scaling exponent (default is 3)');
++			end
+ 
+ 			if strcmpi(obj.law,'pralong'),
+ 				fielddisplay(obj,'c1','damage parameter 1');
+@@ -198,16 +208,19 @@
+ 		end % }}}
+ 		function marshall(obj,md,fid) % {{{
+ 		
+-			WriteData(fid,'object',obj,'fieldname','D','format','DoubleMat','mattype',1);
+ 			WriteData(fid,'object',obj,'fieldname','law','format','String');
+-			WriteData(fid,'object',obj,'fieldname','spcdamage','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
+-			WriteData(fid,'object',obj,'fieldname','max_damage','format','Double');
++			if ~strcmpi(obj.law,'undamaged'),
++				WriteData(fid,'object',obj,'fieldname','D','format','DoubleMat','mattype',1);
++				WriteData(fid,'object',obj,'fieldname','spcdamage','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
++				WriteData(fid,'object',obj,'fieldname','max_damage','format','Double');
+ 
+-			WriteData(fid,'object',obj,'fieldname','stabilization','format','Integer');
+-			WriteData(fid,'object',obj,'fieldname','penalty_threshold','format','Integer');
+-			WriteData(fid,'object',obj,'fieldname','maxiter','format','Integer');
+-			WriteData(fid,'object',obj,'fieldname','penalty_lock','format','Integer');
+-			WriteData(fid,'object',obj,'fieldname','penalty_factor','format','Double');
++				WriteData(fid,'object',obj,'fieldname','stabilization','format','Integer');
++				WriteData(fid,'object',obj,'fieldname','maxiter','format','Integer');
++				WriteData(fid,'object',obj,'fieldname','elementinterp','format','String');
++				WriteData(fid,'object',obj,'fieldname','penalty_threshold','format','Integer');
++				WriteData(fid,'object',obj,'fieldname','penalty_lock','format','Integer');
++				WriteData(fid,'object',obj,'fieldname','penalty_factor','format','Double');
++			end
+ 	
+ 			if strcmpi(obj.law,'pralong'),
+ 				WriteData(fid,'object',obj,'fieldname','c1','format','Double');
+@@ -226,7 +239,9 @@
+ 				outputs(pos) = [];                         %remove 'default' from outputs
+ 				outputs      = [outputs defaultoutputs(obj,md)]; %add defaults
+ 			end
+-			WriteData(fid,'data',outputs,'enum',DamageEvolutionRequestedOutputsEnum,'format','StringArray');
++			if ~strcmpi(obj.law,'undamaged'),
++				WriteData(fid,'data',outputs,'enum',DamageEvolutionRequestedOutputsEnum,'format','StringArray');
++			end
+ 
+ 		end % }}}
+ 	end
+Index: ../trunk-jpl/src/m/enum/MatdamageiceEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/MatdamageiceEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/MatdamageiceEnum.m	(revision 17757)
+@@ -0,0 +1,11 @@
++function macro=MatdamageiceEnum()
++%MATDAMAGEICEENUM - Enum of Matdamageice
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=MatdamageiceEnum()
++
++macro=StringToEnum('Matdamageice');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17756)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17757)
+@@ -172,6 +172,7 @@
+ def DamageC2Enum(): return StringToEnum("DamageC2")[0]
+ def DamageC3Enum(): return StringToEnum("DamageC3")[0]
+ def DamageC4Enum(): return StringToEnum("DamageC4")[0]
++def DamageElementinterpEnum(): return StringToEnum("DamageElementinterp")[0]
+ def DamageHealingEnum(): return StringToEnum("DamageHealing")[0]
+ def DamageStressThresholdEnum(): return StringToEnum("DamageStressThreshold")[0]
+ def DamageStabilizationEnum(): return StringToEnum("DamageStabilization")[0]
+@@ -402,6 +403,7 @@
+ def IntVecParamEnum(): return StringToEnum("IntVecParam")[0]
+ def TransientParamEnum(): return StringToEnum("TransientParam")[0]
+ def MaticeEnum(): return StringToEnum("Matice")[0]
++def MatdamageiceEnum(): return StringToEnum("Matdamageice")[0]
+ def MatparEnum(): return StringToEnum("Matpar")[0]
+ def NodeEnum(): return StringToEnum("Node")[0]
+ def NumericalfluxEnum(): return StringToEnum("Numericalflux")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17757-17758.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17757-17758.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17757-17758.diff	(revision 17802)
@@ -0,0 +1,16 @@
+Index: ../trunk-jpl/src/m/enum/DamageElementinterpEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/DamageElementinterpEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/DamageElementinterpEnum.m	(revision 17758)
+@@ -0,0 +1,11 @@
++function macro=DamageElementinterpEnum()
++%DAMAGEELEMENTINTERPENUM - Enum of DamageElementinterp
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=DamageElementinterpEnum()
++
++macro=StringToEnum('DamageElementinterp');
Index: issm/oecreview/Archive/16554-17801/ISSM-17758-17759.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17758-17759.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17758-17759.diff	(revision 17802)
@@ -0,0 +1,184 @@
+Index: ../trunk-jpl/src/c/classes/Materials/Matice.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 17758)
++++ ../trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 17759)
+@@ -30,6 +30,7 @@
+ Matice::Matice(){
+ 	this->helement=NULL;
+ 	this->element=NULL;
++	this->isdamaged=NULL;
+ 	return;
+ }
+ /*}}}*/
+@@ -50,8 +51,8 @@
+ 	 /*Other perporties*/
+    int    materialtype;
+    iomodel->Constant(&materialtype,MaterialsEnum);
+-   if(materialtype==MatdamageiceEnum) this->isdamage = true;
+-   else if(materialtype==MaticeEnum) this->isdamage = false;
++   if(materialtype==MatdamageiceEnum) this->isdamaged = true;
++   else if(materialtype==MaticeEnum) this->isdamaged = false;
+    else _error_("Material type not recognized");
+ 
+ 	return;
+@@ -205,23 +206,29 @@
+ /*FUNCTION Matice::GetD {{{*/
+ IssmDouble Matice::GetD(){
+ 
+-	_assert_(this->isdamage);
++	_assert_(this->isdamaged);
+ 	/*Output*/
+ 	IssmDouble D;
+-	element->inputs->GetInputAverage(&D,DamageDEnum);
++	if(this->isdamaged)element->inputs->GetInputAverage(&D,DamageDEnum);
+ 	return D;
+ }
+ /*}}}*/
+ /*FUNCTION Matice::GetDbar {{{*/
+ IssmDouble Matice::GetDbar(){
+ 
+-	_assert_(this->isdamage);
++	_assert_(this->isdamaged);
+ 	/*Output*/
+ 	IssmDouble Dbar;
+-	element->inputs->GetInputAverage(&Dbar,DamageDbarEnum);
++	if(this->isdamaged)element->inputs->GetInputAverage(&Dbar,DamageDbarEnum);
+ 	return Dbar;
+ }
+ /*}}}*/
++/*FUNCTION Matice::IsDamage() {{{*/
++bool Matice::IsDamage(){
++
++	return this->isdamaged;
++}
++/*}}}*/
+ /*FUNCTION Matice::GetViscosity {{{*/
+ void  Matice::GetViscosity(IssmDouble* pviscosity,IssmDouble eps_eff){
+ 	/*From a string tensor and a material object, return viscosity, using Glen's flow law.
+@@ -245,7 +252,7 @@
+ 	/*Get B and n*/
+ 	B=GetB(); _assert_(B>0.);
+ 	n=GetN(); _assert_(n>0.);
+-	if(this->isdamage){
++	if(this->isdamaged){
+ 		D=GetD();
+ 		_assert_(D>=0. && D<1.);
+ 	}
+@@ -298,7 +305,7 @@
+ 	/*Get B and n*/
+ 	B=GetBbar(); _assert_(B>0.);
+ 	n=GetN();    _assert_(n>0.);
+-	if(this->isdamage){
++	if(this->isdamaged){
+ 		D=GetDbar();
+ 		_assert_(D>=0. && D<1.);
+ 	}
+@@ -350,7 +357,7 @@
+ 	IssmDouble D=0.,n;
+ 
+ 	/*Get D and n*/
+-	if(this->isdamage){
++	if(this->isdamaged){
+ 		D=GetDbar(); /* GetD()? */
+ 		_assert_(D>=0. && D<1.);
+ 	}
+Index: ../trunk-jpl/src/c/classes/Materials/Material.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Material.h	(revision 17758)
++++ ../trunk-jpl/src/c/classes/Materials/Material.h	(revision 17759)
+@@ -38,6 +38,7 @@
+ 		virtual IssmDouble GetN()=0;
+ 		virtual IssmDouble GetD()=0;
+ 		virtual IssmDouble GetDbar()=0;
++		virtual bool       IsDamage()=0;
+ 
+ };
+ #endif
+Index: ../trunk-jpl/src/c/classes/Materials/Matice.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matice.h	(revision 17758)
++++ ../trunk-jpl/src/c/classes/Materials/Matice.h	(revision 17759)
+@@ -23,7 +23,7 @@
+ 
+ 	private: 
+ 		int      mid;
+-		bool     isdamage;
++		bool     isdamaged;
+ 		Hook    *helement;
+ 		Element *element;
+ 
+@@ -67,6 +67,7 @@
+ 		IssmDouble GetD();
+ 		IssmDouble GetDbar();
+ 		IssmDouble GetN();
++		bool       IsDamage();
+ 		/*}}}*/
+ };
+ 
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 17758)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 17759)
+@@ -95,6 +95,7 @@
+ 		IssmDouble GetN(){_error_("not supported");};
+ 		IssmDouble GetD(){_error_("not supported");};
+ 		IssmDouble GetDbar(){_error_("not supported");};
++		bool       IsDamage(){_error_("not supported");};
+ 		/*}}}*/
+ 		/*Numerics: {{{*/
+ 		IssmDouble GetG();
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17758)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17759)
+@@ -3113,7 +3113,9 @@
+ 	Input* vy_input=inputs->GetInput(VyEnum);                                   _assert_(vy_input);
+ 	Input* adjointx_input=inputs->GetInput(AdjointxEnum);                       _assert_(adjointx_input);
+ 	Input* adjointy_input=inputs->GetInput(AdjointyEnum);                       _assert_(adjointy_input);
+-	Input* rheologyd_input=inputs->GetInput(DamageDbarEnum); _assert_(rheologyd_input);
++	if(this->material->IsDamage()){
++		Input* rheologyd_input=inputs->GetInput(DamageDbarEnum); _assert_(rheologyd_input);
++	}
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	gauss=new GaussTria(4);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17758)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17759)
+@@ -2132,7 +2132,7 @@
+ 	_assert_(this->IsOnBase());
+ 
+ 	this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum);
+-	this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum);
++	if(this->material->IsDamage())this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum);
+ 	if(this->inputs->GetInput(VxEnum)) this->InputDepthAverageAtBase(VxEnum,VxAverageEnum);
+ 	if(this->inputs->GetInput(VyEnum)) this->InputDepthAverageAtBase(VyEnum,VyAverageEnum);
+ 	Tria* tria=(Tria*)SpawnTria(0,1,2);
+@@ -3424,7 +3424,7 @@
+ 
+ 	/*Depth Average B*/
+ 	this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum);
+-	this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum);
++	if(this->material->IsDamage())this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum);
+ 
+ 	/*Collapse element to the base*/
+ 	Tria* tria=(Tria*)SpawnTria(0,1,2);
+@@ -3444,7 +3444,7 @@
+ 
+ 	/*Depth Average B and D*/
+ 	this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum);
+-	this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum);
++	if(this->material->IsDamage())this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum);
+ 
+ 	/*Collapse element to the base*/
+ 	Tria* tria=(Tria*)SpawnTria(0,1,2);
+@@ -3463,7 +3463,7 @@
+ 
+ 	/*Depth Average B and D*/
+ 	this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum);
+-	this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum);
++	if(this->material->IsDamage())this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum);
+ 
+ 	/*Collapse element to the base*/
+ 	Tria* tria=(Tria*)SpawnTria(0,1,2);
Index: issm/oecreview/Archive/16554-17801/ISSM-17759-17760.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17759-17760.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17759-17760.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/cores/transient_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17759)
++++ ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17760)
+@@ -175,6 +175,8 @@
+ 			if(groundingline_migration==ContactEnum){
+ 				femmodel->parameters->SetParam(MaskGroundediceLevelsetEnum,InputToExtrudeEnum);
+ 				extrudefrombase_core(femmodel);
++				femmodel->parameters->SetParam(BaseEnum,InputToExtrudeEnum);
++				extrudefrombase_core(femmodel);
+ 			}
+ 			if(save_results){
+ 				int outputs[3] = {SurfaceEnum,BaseEnum,MaskGroundediceLevelsetEnum};
Index: issm/oecreview/Archive/16554-17801/ISSM-17760-17761.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17760-17761.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17760-17761.diff	(revision 17802)
@@ -0,0 +1,14 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17760)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17761)
+@@ -4377,9 +4377,7 @@
+ 		for(i = 0;i < NUMVERTICES;i++){
+ 			/*Ice shelf: if bed below bathymetry, impose it at the bathymetry and update surface, elso do nothing */
+ 			if(phi[i] >= 0.){
+-				if(b[i] < r[i]){
+ 					b[i]  = r[i];
+-				}
+ 			}
+ 		}
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17761-17762.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17761-17762.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17761-17762.diff	(revision 17802)
@@ -0,0 +1,647 @@
+Index: ../trunk-jpl/test/Par/SquareEISMINT.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareEISMINT.py	(revision 17761)
++++ ../trunk-jpl/test/Par/SquareEISMINT.py	(revision 17762)
+@@ -28,9 +28,6 @@
+ md.materials.rheology_B=1.7687*10**8*numpy.ones((md.mesh.numberofvertices,1))
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.D=numpy.zeros((md.mesh.numberofvertices,1))
+-
+ print "      creating surface mass balance"
+ md.surfaceforcings.mass_balance=0.2*numpy.ones((md.mesh.numberofvertices,1))    #0m/a
+ md.basalforcings.melting_rate=0.*numpy.ones((md.mesh.numberofvertices,1))    #0m/a
+Index: ../trunk-jpl/test/Par/RoundSheetShelf.py
+===================================================================
+--- ../trunk-jpl/test/Par/RoundSheetShelf.py	(revision 17761)
++++ ../trunk-jpl/test/Par/RoundSheetShelf.py	(revision 17762)
+@@ -67,9 +67,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature)
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.D=numpy.zeros((md.mesh.numberofvertices,1))
+-
+ #Surface mass balance and basal melting
+ md.surfaceforcings.mass_balance=-10.*numpy.ones((md.mesh.numberofvertices,1))
+ md.basalforcings.melting_rate=numpy.zeros((md.mesh.numberofvertices,1))
+@@ -121,7 +118,6 @@
+ pos=numpy.nonzero(md.mesh.vertexonboundary)
+ md.mask.ice_levelset[pos]=0
+ md.balancethickness.spcthickness=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
+-md.damage.spcdamage=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
+ md.masstransport.spcthickness=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
+ md.stressbalance.referential=float('nan')*numpy.ones((md.mesh.numberofvertices,6))
+ md.stressbalance.loadingforce=0*numpy.ones((md.mesh.numberofvertices,3))
+Index: ../trunk-jpl/test/Par/RoundSheetEISMINT.par
+===================================================================
+--- ../trunk-jpl/test/Par/RoundSheetEISMINT.par	(revision 17761)
++++ ../trunk-jpl/test/Par/RoundSheetEISMINT.par	(revision 17762)
+@@ -20,9 +20,6 @@
+ md.materials.rheology_B=6.81*10^7*ones(md.mesh.numberofvertices,1); %to have the same B as the analytical solution 
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.D=zeros(md.mesh.numberofvertices,1);
+-
+ disp('      creating surface mass balance');
+ smb_max=0.5; %m/yr
+ sb=10^-2/1000.; %m/yr/m
+Index: ../trunk-jpl/test/Par/79North.par
+===================================================================
+--- ../trunk-jpl/test/Par/79North.par	(revision 17761)
++++ ../trunk-jpl/test/Par/79North.par	(revision 17762)
+@@ -20,9 +20,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.D=zeros(md.mesh.numberofvertices,1);
+-
+ %Friction
+ md.friction.coefficient=50.*ones(md.mesh.numberofvertices,1);
+ md.friction.coefficient(find(md.mask.groundedice_levelset<0.))=0.;
+Index: ../trunk-jpl/test/Par/SquareShelf2.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareShelf2.py	(revision 17761)
++++ ../trunk-jpl/test/Par/SquareShelf2.py	(revision 17762)
+@@ -58,9 +58,6 @@
+ md.materials.rheology_B = paterson(md.initialization.temperature)
+ md.materials.rheology_n = 3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.D=numpy.zeros((md.mesh.numberofvertices,1))
+-
+ #Friction
+ md.friction.coefficient = 20.*numpy.ones((md.mesh.numberofvertices,1))
+ md.friction.coefficient[numpy.nonzero(md.mask.groundedice_levelset<0.)[0]]=0.
+Index: ../trunk-jpl/test/Par/SquareThermal.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareThermal.par	(revision 17761)
++++ ../trunk-jpl/test/Par/SquareThermal.par	(revision 17762)
+@@ -26,9 +26,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.D=zeros(md.mesh.numberofvertices,1);
+-
+ disp('      creating surface mass balance');
+ md.surfaceforcings.mass_balance=ones(md.mesh.numberofvertices,1)/md.constants.yts; %1m/a
+ md.basalforcings.melting_rate=0.*ones(md.mesh.numberofvertices,1)/md.constants.yts; %1m/a
+Index: ../trunk-jpl/test/Par/RoundSheetEISMINT.py
+===================================================================
+--- ../trunk-jpl/test/Par/RoundSheetEISMINT.py	(revision 17761)
++++ ../trunk-jpl/test/Par/RoundSheetEISMINT.py	(revision 17762)
+@@ -23,9 +23,6 @@
+ md.materials.rheology_B=6.81*10**7*numpy.ones((md.mesh.numberofvertices,1))    #to have the same B as the analytical solution 
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.D=numpy.zeros((md.mesh.numberofvertices,1))
+-
+ print "      creating surface mass balance"
+ smb_max=0.5    #m/yr
+ sb=10**-2/1000.    #m/yr/m
+Index: ../trunk-jpl/test/Par/Pig.par
+===================================================================
+--- ../trunk-jpl/test/Par/Pig.par	(revision 17761)
++++ ../trunk-jpl/test/Par/Pig.par	(revision 17762)
+@@ -25,9 +25,6 @@
+ md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
+ md.initialization.temperature=md.initialization.temperature;
+ 
+-%Damage
+-md.damage.D=zeros(md.mesh.numberofvertices,1);
+-
+ %Friction
+ md.friction.coefficient=50*ones(md.mesh.numberofvertices,1);
+ md.friction.coefficient(find(md.mask.groundedice_levelset<0.))=0.;
+Index: ../trunk-jpl/test/Par/RoundSheetStaticEISMINT.par
+===================================================================
+--- ../trunk-jpl/test/Par/RoundSheetStaticEISMINT.par	(revision 17761)
++++ ../trunk-jpl/test/Par/RoundSheetStaticEISMINT.par	(revision 17762)
+@@ -24,9 +24,6 @@
+ md.materials.rheology_B=6.81*10^7*ones(md.mesh.numberofvertices,1); %to have the same B as the analytical solution 
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.D=zeros(md.mesh.numberofvertices,1);
+-
+ disp('      creating surface mass balance');
+ smb_max=0.5; %m/yr
+ sb=10^-2/1000.; %m/yr/m
+Index: ../trunk-jpl/test/Par/SquareShelf.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareShelf.par	(revision 17761)
++++ ../trunk-jpl/test/Par/SquareShelf.par	(revision 17762)
+@@ -28,9 +28,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.D=zeros(md.mesh.numberofvertices,1);
+-
+ %Friction
+ md.friction.coefficient=20*ones(md.mesh.numberofvertices,1);
+ md.friction.coefficient(find(md.mask.groundedice_levelset<0.))=0.;
+Index: ../trunk-jpl/test/Par/ISMIPA.par
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPA.par	(revision 17761)
++++ ../trunk-jpl/test/Par/ISMIPA.par	(revision 17762)
+@@ -15,9 +15,6 @@
+ md.materials.rheology_B=6.8067*10^7*ones(md.mesh.numberofvertices,1);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.D=zeros(md.mesh.numberofvertices,1);
+-
+ disp('      boundary conditions for stressbalance model');
+ %Create node on boundary first (because we cannot use mesh)
+ md=SetIceSheetBC(md);
+Index: ../trunk-jpl/test/Par/SquareShelfConstrained.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareShelfConstrained.py	(revision 17761)
++++ ../trunk-jpl/test/Par/SquareShelfConstrained.py	(revision 17762)
+@@ -39,9 +39,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature)
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.D=numpy.zeros((md.mesh.numberofvertices,1))
+-
+ #Surface mass balance and basal melting
+ md.surfaceforcings.mass_balance=10.*numpy.ones((md.mesh.numberofvertices,1))
+ md.basalforcings.melting_rate=5.*numpy.ones((md.mesh.numberofvertices,1))
+Index: ../trunk-jpl/test/Par/ISMIPB.par
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPB.par	(revision 17761)
++++ ../trunk-jpl/test/Par/ISMIPB.par	(revision 17762)
+@@ -15,9 +15,6 @@
+ md.materials.rheology_B=6.8067*10^7*ones(md.mesh.numberofvertices,1);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.D=zeros(md.mesh.numberofvertices,1);
+-
+ disp('      boundary conditions for stressbalance model');
+ %Create node on boundary first (because we cannot use mesh)
+ md=SetIceSheetBC(md);
+Index: ../trunk-jpl/test/Par/SquareThermal.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareThermal.py	(revision 17761)
++++ ../trunk-jpl/test/Par/SquareThermal.py	(revision 17762)
+@@ -30,9 +30,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature)
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.D=numpy.zeros((md.mesh.numberofvertices,1))
+-
+ print "      creating surface mass balance"
+ md.surfaceforcings.mass_balance=numpy.ones((md.mesh.numberofvertices,1))/md.constants.yts    #1m/a
+ md.basalforcings.melting_rate=0.*numpy.ones((md.mesh.numberofvertices,1))/md.constants.yts    #1m/a
+Index: ../trunk-jpl/test/Par/ISMIPC.par
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPC.par	(revision 17761)
++++ ../trunk-jpl/test/Par/ISMIPC.par	(revision 17762)
+@@ -16,9 +16,6 @@
+ md.materials.rheology_B=6.8067*10^7*ones(md.mesh.numberofvertices,1);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.D=zeros(md.mesh.numberofvertices,1);
+-
+ disp('      boundary conditions for stressbalance model:');
+ %Create node on boundary first (because we can not use mesh)
+ md=SetIceSheetBC(md);
+Index: ../trunk-jpl/test/Par/ISMIPD.par
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPD.par	(revision 17761)
++++ ../trunk-jpl/test/Par/ISMIPD.par	(revision 17762)
+@@ -15,9 +15,6 @@
+ md.materials.rheology_B=6.8067*10^7*ones(md.mesh.numberofvertices,1);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.D=zeros(md.mesh.numberofvertices,1);
+-
+ disp('      boundary conditions for stressbalance model:');
+ %Create node on boundary first (because we can not use mesh)
+ md=SetIceSheetBC(md);
+Index: ../trunk-jpl/test/Par/Pig.py
+===================================================================
+--- ../trunk-jpl/test/Par/Pig.py	(revision 17761)
++++ ../trunk-jpl/test/Par/Pig.py	(revision 17762)
+@@ -36,9 +36,6 @@
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ md.initialization.temperature=md.initialization.temperature
+ 
+-#Damage
+-md.damage.D=numpy.zeros((md.mesh.numberofvertices,1))
+-
+ #Friction
+ md.friction.coefficient=50.*numpy.ones((md.mesh.numberofvertices,1))
+ md.friction.coefficient[numpy.nonzero(md.mask.groundedice_levelset<0.)[0]]=0.
+Index: ../trunk-jpl/test/Par/ISMIPE.par
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPE.par	(revision 17761)
++++ ../trunk-jpl/test/Par/ISMIPE.par	(revision 17762)
+@@ -25,9 +25,6 @@
+ md.materials.rheology_B=6.8067*10^7*ones(md.mesh.numberofvertices,1);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.D=zeros(md.mesh.numberofvertices,1);
+-
+ disp('      boundary conditions for stressbalance model:');
+ %Create node on boundary first (because we can not use mesh)
+ md=SetIceSheetBC(md);
+Index: ../trunk-jpl/test/Par/ISMIPF.par
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPF.par	(revision 17761)
++++ ../trunk-jpl/test/Par/ISMIPF.par	(revision 17762)
+@@ -17,9 +17,6 @@
+ md.materials.rheology_n=1.*ones(md.mesh.numberofelements,1);
+ md.materials.rheology_law='None';
+ 
+-%Damage
+-md.damage.D=zeros(md.mesh.numberofvertices,1);
+-
+ disp('      boundary conditions for stressbalance model');
+ %Create node on boundary first (because we cannot use mesh)
+ md=SetIceSheetBC(md);
+Index: ../trunk-jpl/test/Par/RoundSheetStaticEISMINT.py
+===================================================================
+--- ../trunk-jpl/test/Par/RoundSheetStaticEISMINT.py	(revision 17761)
++++ ../trunk-jpl/test/Par/RoundSheetStaticEISMINT.py	(revision 17762)
+@@ -27,9 +27,6 @@
+ md.materials.rheology_B=6.81*10**7*numpy.ones((md.mesh.numberofvertices,1))    #to have the same B as the analytical solution 
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.D=numpy.zeros((md.mesh.numberofvertices,1))
+-
+ print "      creating surface mass balance"
+ smb_max=0.5    #m/yr
+ sb=10**-2/1000.    #m/yr/m
+Index: ../trunk-jpl/test/Par/ISMIPB.py
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPB.py	(revision 17761)
++++ ../trunk-jpl/test/Par/ISMIPB.py	(revision 17762)
+@@ -18,9 +18,6 @@
+ md.materials.rheology_B=6.8067*10**7*numpy.ones((md.mesh.numberofvertices,1))
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.D=numpy.zeros((md.mesh.numberofvertices,1))
+-
+ print "      boundary conditions for stressbalance model"
+ #Create node on boundary first (because we cannot use mesh)
+ md=SetIceSheetBC(md)
+Index: ../trunk-jpl/test/Par/ISMIPD.py
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPD.py	(revision 17761)
++++ ../trunk-jpl/test/Par/ISMIPD.py	(revision 17762)
+@@ -18,9 +18,6 @@
+ md.materials.rheology_B=6.8067*10**7*numpy.ones((md.mesh.numberofvertices,1))
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.D=numpy.zeros((md.mesh.numberofvertices,1))
+-
+ print "      boundary conditions for stressbalance model:"
+ #Create node on boundary first (because we can not use mesh)
+ md=SetIceSheetBC(md)
+Index: ../trunk-jpl/test/Par/ISMIPF.py
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPF.py	(revision 17761)
++++ ../trunk-jpl/test/Par/ISMIPF.py	(revision 17762)
+@@ -20,9 +20,6 @@
+ md.materials.rheology_n=1.*numpy.ones((md.mesh.numberofelements,1))
+ md.materials.rheology_law='None'
+ 
+-#Damage
+-md.damage.D=numpy.zeros((md.mesh.numberofvertices,1))
+-
+ print "      boundary conditions for stressbalance model"
+ #Create node on boundary first (because we cannot use mesh)
+ md=SetIceSheetBC(md)
+Index: ../trunk-jpl/test/Par/GiaBenchmarksAB.par
+===================================================================
+--- ../trunk-jpl/test/Par/GiaBenchmarksAB.par	(revision 17761)
++++ ../trunk-jpl/test/Par/GiaBenchmarksAB.par	(revision 17762)
+@@ -43,9 +43,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.D=zeros(md.mesh.numberofvertices,1);
+-
+ %Friction
+ md.friction.coefficient=20.*ones(md.mesh.numberofvertices,1);
+ md.friction.coefficient(find(md.mask.groundedice_levelset<0.))=0.;
+Index: ../trunk-jpl/test/Par/RoundSheetShelf.par
+===================================================================
+--- ../trunk-jpl/test/Par/RoundSheetShelf.par	(revision 17761)
++++ ../trunk-jpl/test/Par/RoundSheetShelf.par	(revision 17762)
+@@ -60,9 +60,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.D=zeros(md.mesh.numberofvertices,1);
+-
+ %Surface mass balance and basal melting
+ md.surfaceforcings.mass_balance=-10.*ones(md.mesh.numberofvertices,1);
+ md.basalforcings.melting_rate=zeros(md.mesh.numberofvertices,1);
+@@ -111,7 +108,6 @@
+ 
+ md.mask.ice_levelset(find(md.mesh.vertexonboundary))=0;
+ md.balancethickness.spcthickness=NaN*ones(md.mesh.numberofvertices,1);
+-md.damage.spcdamage=NaN*ones(md.mesh.numberofvertices,1);
+ md.masstransport.spcthickness=NaN*ones(md.mesh.numberofvertices,1);
+ md.stressbalance.referential=NaN*ones(md.mesh.numberofvertices,6);
+ md.stressbalance.loadingforce=0*ones(md.mesh.numberofvertices,3);
+Index: ../trunk-jpl/test/Par/SquareShelf2.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareShelf2.par	(revision 17761)
++++ ../trunk-jpl/test/Par/SquareShelf2.par	(revision 17762)
+@@ -28,9 +28,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.D=zeros(md.mesh.numberofvertices,1);
+-
+ %Friction
+ md.friction.coefficient=20*ones(md.mesh.numberofvertices,1);
+ md.friction.coefficient(find(md.mask.groundedice_levelset<0.))=0.;
+Index: ../trunk-jpl/test/Par/ValleyGlacierShelf.par
+===================================================================
+--- ../trunk-jpl/test/Par/ValleyGlacierShelf.par	(revision 17761)
++++ ../trunk-jpl/test/Par/ValleyGlacierShelf.par	(revision 17762)
+@@ -47,9 +47,6 @@
+ %Groundingline
+ md.groundingline.migration = 'SubelementMigration';
+ 
+-%Damage
+-md.damage.D = zeros(md.mesh.numberofvertices,1);
+-
+ %Surface mass balance and basal melting
+ md.surfaceforcings.mass_balance = 0.3*ones(md.mesh.numberofvertices,1);
+ md.basalforcings.melting_rate = md.surfaceforcings.mass_balance;
+Index: ../trunk-jpl/test/Par/GiaBenchmarksCD.par
+===================================================================
+--- ../trunk-jpl/test/Par/GiaBenchmarksCD.par	(revision 17761)
++++ ../trunk-jpl/test/Par/GiaBenchmarksCD.par	(revision 17762)
+@@ -42,9 +42,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.D=zeros(md.mesh.numberofvertices,1);
+-
+ %Friction
+ md.friction.coefficient=20.*ones(md.mesh.numberofvertices,1);
+ md.friction.coefficient(find(md.mask.groundedice_levelset<0.))=0.;
+Index: ../trunk-jpl/test/Par/ValleyGlacierShelf.py
+===================================================================
+--- ../trunk-jpl/test/Par/ValleyGlacierShelf.py	(revision 17761)
++++ ../trunk-jpl/test/Par/ValleyGlacierShelf.py	(revision 17762)
+@@ -54,9 +54,6 @@
+ #Groundingline
+ md.groundingline.migration='SubelementMigration'
+ 
+-#Damage
+-md.damage.D=numpy.zeros((md.mesh.numberofvertices,1))
+-
+ #Surface mass balance and basal melting
+ md.surfaceforcings.mass_balance=0.3*numpy.ones((md.mesh.numberofvertices,1))
+ md.basalforcings.melting_rate=md.surfaceforcings.mass_balance
+Index: ../trunk-jpl/test/Par/SquareSheetShelf.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareSheetShelf.par	(revision 17761)
++++ ../trunk-jpl/test/Par/SquareSheetShelf.par	(revision 17762)
+@@ -31,9 +31,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.D=zeros(md.mesh.numberofvertices,1);
+-
+ %Accumulation and melting
+ md.surfaceforcings.mass_balance=10.*ones(md.mesh.numberofvertices,1);
+ md.basalforcings.melting_rate=5.*ones(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/test/Par/SquareShelfConstrained.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareShelfConstrained.par	(revision 17761)
++++ ../trunk-jpl/test/Par/SquareShelfConstrained.par	(revision 17762)
+@@ -28,9 +28,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.D=zeros(md.mesh.numberofvertices,1);
+-
+ %Surface mass balance and basal melting
+ md.surfaceforcings.mass_balance=10*ones(md.mesh.numberofvertices,1);
+ md.basalforcings.melting_rate=5*ones(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/test/Par/79North.py
+===================================================================
+--- ../trunk-jpl/test/Par/79North.py	(revision 17761)
++++ ../trunk-jpl/test/Par/79North.py	(revision 17762)
+@@ -32,9 +32,6 @@
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ md.initialization.temperature=md.initialization.temperature
+ 
+-#Damage
+-md.damage.D=numpy.zeros((md.mesh.numberofvertices,1))
+-
+ #Friction
+ md.friction.coefficient=50.*numpy.ones((md.mesh.numberofvertices,1))
+ md.friction.coefficient[numpy.nonzero(md.mask.groundedice_levelset<0.)[0]]=0.
+Index: ../trunk-jpl/test/Par/SquareSheetShelf.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareSheetShelf.py	(revision 17761)
++++ ../trunk-jpl/test/Par/SquareSheetShelf.py	(revision 17762)
+@@ -42,9 +42,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature)
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.D=numpy.zeros((md.mesh.numberofvertices,1))
+-
+ #Accumulation and melting
+ md.surfaceforcings.mass_balance=10.*numpy.ones((md.mesh.numberofvertices,1))
+ md.basalforcings.melting_rate=5.*numpy.ones((md.mesh.numberofvertices,1))
+Index: ../trunk-jpl/test/Par/SquareSheetConstrained.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareSheetConstrained.par	(revision 17761)
++++ ../trunk-jpl/test/Par/SquareSheetConstrained.par	(revision 17762)
+@@ -29,8 +29,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.D=zeros(md.mesh.numberofvertices,1);
+ md.masstransport.calvingrate=zeros(md.mesh.numberofvertices,1);
+ 
+ %Friction
+Index: ../trunk-jpl/test/Par/SquareShelf.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareShelf.py	(revision 17761)
++++ ../trunk-jpl/test/Par/SquareShelf.py	(revision 17762)
+@@ -58,9 +58,6 @@
+ md.materials.rheology_B = paterson(md.initialization.temperature)
+ md.materials.rheology_n = 3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.D=numpy.zeros((md.mesh.numberofvertices,1))
+-
+ #Friction
+ md.friction.coefficient = 20.*numpy.ones((md.mesh.numberofvertices,1))
+ md.friction.coefficient[numpy.nonzero(md.mask.groundedice_levelset<0.)[0]]=0.
+Index: ../trunk-jpl/test/Par/ISMIPA.py
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPA.py	(revision 17761)
++++ ../trunk-jpl/test/Par/ISMIPA.py	(revision 17762)
+@@ -18,9 +18,6 @@
+ md.materials.rheology_B=6.8067*10**7*numpy.ones((md.mesh.numberofvertices,1))
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.D=numpy.zeros((md.mesh.numberofvertices,1))
+-
+ print "      boundary conditions for stressbalance model"
+ #Create node on boundary first (because we cannot use mesh)
+ md=SetIceSheetBC(md)
+Index: ../trunk-jpl/test/Par/SquareSheetConstrained.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareSheetConstrained.py	(revision 17761)
++++ ../trunk-jpl/test/Par/SquareSheetConstrained.py	(revision 17762)
+@@ -39,9 +39,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature)
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.D=numpy.zeros((md.mesh.numberofvertices,1))
+-
+ #Masstransport
+ md.masstransport.calvingrate=0.*numpy.ones((md.mesh.numberofvertices,1))
+ 
+Index: ../trunk-jpl/test/Par/SquareEISMINT.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareEISMINT.par	(revision 17761)
++++ ../trunk-jpl/test/Par/SquareEISMINT.par	(revision 17762)
+@@ -25,9 +25,6 @@
+ md.materials.rheology_B=1.7687*10^8*ones(md.mesh.numberofvertices,1);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.D=zeros(md.mesh.numberofvertices,1);
+-
+ disp('      creating surface mass balance');
+ md.surfaceforcings.mass_balance=0.2*ones(md.mesh.numberofvertices,1); %0m/a
+ md.basalforcings.melting_rate=0.*ones(md.mesh.numberofvertices,1); %0m/a
+Index: ../trunk-jpl/test/Par/ISMIPC.py
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPC.py	(revision 17761)
++++ ../trunk-jpl/test/Par/ISMIPC.py	(revision 17762)
+@@ -19,9 +19,6 @@
+ md.materials.rheology_B=6.8067*10**7*numpy.ones((md.mesh.numberofvertices,1))
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.D=numpy.zeros((md.mesh.numberofvertices,1))
+-
+ print "      boundary conditions for stressbalance model:"
+ #Create node on boundary first (because we can not use mesh)
+ md=SetIceSheetBC(md)
+Index: ../trunk-jpl/test/Par/ISMIPE.py
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPE.py	(revision 17761)
++++ ../trunk-jpl/test/Par/ISMIPE.py	(revision 17762)
+@@ -30,9 +30,6 @@
+ md.materials.rheology_B=6.8067*10**7*numpy.ones((md.mesh.numberofvertices,1))
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.D=numpy.zeros((md.mesh.numberofvertices,1))
+-
+ print "      boundary conditions for stressbalance model:"
+ #Create node on boundary first (because we can not use mesh)
+ md=SetIceSheetBC(md)
+Index: ../trunk-jpl/test/NightlyRun/test703.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test703.m	(revision 17761)
++++ ../trunk-jpl/test/NightlyRun/test703.m	(revision 17762)
+@@ -19,8 +19,6 @@
+ md.initialization.temperature=(273.-20.)*ones(md.mesh.numberofvertices,1);
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
+-md.damage.D=zeros(md.mesh.numberofvertices,1);
+-md.damage.spcdamage=NaN(md.mesh.numberofvertices,1);
+ md.friction.coefficient=zeros(md.mesh.numberofvertices,1);
+ md.friction.coefficient(find(vertexflags(md.mesh,1)))=20;
+ md.friction.p=ones(md.mesh.numberofelements,1);
+Index: ../trunk-jpl/test/NightlyRun/test275.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test275.m	(revision 17761)
++++ ../trunk-jpl/test/NightlyRun/test275.m	(revision 17762)
+@@ -12,14 +12,14 @@
+ md.damage.stress_threshold=1e5;
+ md.damage.stabilization=1;
+ 
+-md.damage.requested_outputs={'default','DamageF'}
++md.damage.requested_outputs={'default','DamageF'};
+ 
+ md=setflowequation(md,'SSA','all');
+ md.cluster=generic('name',oshostname(),'np',3);
+ md=solve(md,DamageEvolutionSolutionEnum());
+ 
+-field_names={'D','F'}
+-field_tolerances={1e-13,1e-13}
++field_names={'D','F'};
++field_tolerances={1e-13,1e-13};
+ field_values={...
+ 		(md.results.DamageEvolutionSolution.DamageDbar),...
+ 		(md.results.DamageEvolutionSolution.DamageF),...
+Index: ../trunk-jpl/test/NightlyRun/IdToName.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/IdToName.m	(revision 17761)
++++ ../trunk-jpl/test/NightlyRun/IdToName.m	(revision 17762)
+@@ -71,6 +71,7 @@
+ 	case 272, name='SquareShelfCMZSSA2dDamage';
+ 	case 274, name='SquareShelfStressSSA2dDamageRift';
+ 	case 275, name='SquareShelfDamageEvolutionSSA2d';
++	case 276, name='SquareShelfDamageEvolutionSSA2dP2';
+ 	case 280, name='SquareShelfStressSSA2dHigherOrder';
+ 	case 285, name='SquareShelfStressHOHigherOrder';
+ 	case 290, name='SquareShelfStressFSP2P1';
+Index: ../trunk-jpl/test/NightlyRun/test701.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test701.m	(revision 17761)
++++ ../trunk-jpl/test/NightlyRun/test701.m	(revision 17762)
+@@ -18,8 +18,6 @@
+ md.initialization.temperature=(273-20)*ones(md.mesh.numberofvertices,1);
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
+-md.damage.D=zeros(md.mesh.numberofvertices,1);
+-md.damage.spcdamage=NaN(md.mesh.numberofvertices,1);
+ 
+ %friction
+ md.friction.coefficient=zeros(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/test/NightlyRun/IdToName.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/IdToName.py	(revision 17761)
++++ ../trunk-jpl/test/NightlyRun/IdToName.py	(revision 17762)
+@@ -72,6 +72,7 @@
+ 	272  : 'SquareShelfCMZSSA2dDamage',
+ 	274  : 'SquareShelfStressSSA2dDamageRift',
+ 	275  : 'SquareShelfDamageEvolutionSSA2d',
++	276  : 'SquareShelfDamageEvolutionSSA2dP2',
+ 	280  : 'SquareShelfStressSSA2dHigherOrder',
+ 	285  : 'SquareShelfStressHOHigherOrder',
+ 	290  : 'SquareShelfStressFSP2P1',
Index: issm/oecreview/Archive/16554-17801/ISSM-17762-17763.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17762-17763.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17762-17763.diff	(revision 17802)
@@ -0,0 +1,328 @@
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17762)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17763)
+@@ -163,6 +163,7 @@
+ 	MaterialsRheologyBbarEnum,
+ 	MaterialsRheologyLawEnum,
+ 	MaterialsRheologyNEnum,
++	DamageIsdamageEnum,
+ 	DamageDEnum,
+ 	DamageFEnum,
+ 	QmuDamageDEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17762)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17763)
+@@ -171,6 +171,7 @@
+ 		case MaterialsRheologyBbarEnum : return "MaterialsRheologyBbar";
+ 		case MaterialsRheologyLawEnum : return "MaterialsRheologyLaw";
+ 		case MaterialsRheologyNEnum : return "MaterialsRheologyN";
++		case DamageIsdamageEnum : return "DamageIsdamage";
+ 		case DamageDEnum : return "DamageD";
+ 		case DamageFEnum : return "DamageF";
+ 		case QmuDamageDEnum : return "QmuDamageD";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17762)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17763)
+@@ -174,6 +174,7 @@
+ 	      else if (strcmp(name,"MaterialsRheologyBbar")==0) return MaterialsRheologyBbarEnum;
+ 	      else if (strcmp(name,"MaterialsRheologyLaw")==0) return MaterialsRheologyLawEnum;
+ 	      else if (strcmp(name,"MaterialsRheologyN")==0) return MaterialsRheologyNEnum;
++	      else if (strcmp(name,"DamageIsdamage")==0) return DamageIsdamageEnum;
+ 	      else if (strcmp(name,"DamageD")==0) return DamageDEnum;
+ 	      else if (strcmp(name,"DamageF")==0) return DamageFEnum;
+ 	      else if (strcmp(name,"QmuDamageD")==0) return QmuDamageDEnum;
+@@ -258,11 +259,11 @@
+ 	      else if (strcmp(name,"SettingsLowmem")==0) return SettingsLowmemEnum;
+ 	      else if (strcmp(name,"SettingsOutputFrequency")==0) return SettingsOutputFrequencyEnum;
+ 	      else if (strcmp(name,"SettingsWaitonlock")==0) return SettingsWaitonlockEnum;
+-	      else if (strcmp(name,"DebugProfiling")==0) return DebugProfilingEnum;
+          else stage=3;
+    }
+    if(stage==3){
+-	      if (strcmp(name,"ProfilingCurrentMem")==0) return ProfilingCurrentMemEnum;
++	      if (strcmp(name,"DebugProfiling")==0) return DebugProfilingEnum;
++	      else if (strcmp(name,"ProfilingCurrentMem")==0) return ProfilingCurrentMemEnum;
+ 	      else if (strcmp(name,"ProfilingCurrentFlops")==0) return ProfilingCurrentFlopsEnum;
+ 	      else if (strcmp(name,"ProfilingSolutionTime")==0) return ProfilingSolutionTimeEnum;
+ 	      else if (strcmp(name,"MaxIterationConvergenceFlag")==0) return MaxIterationConvergenceFlagEnum;
+@@ -381,11 +382,11 @@
+ 	      else if (strcmp(name,"L1L2Approximation")==0) return L1L2ApproximationEnum;
+ 	      else if (strcmp(name,"HOApproximation")==0) return HOApproximationEnum;
+ 	      else if (strcmp(name,"HOFSApproximation")==0) return HOFSApproximationEnum;
+-	      else if (strcmp(name,"FSApproximation")==0) return FSApproximationEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"FSvelocity")==0) return FSvelocityEnum;
++	      if (strcmp(name,"FSApproximation")==0) return FSApproximationEnum;
++	      else if (strcmp(name,"FSvelocity")==0) return FSvelocityEnum;
+ 	      else if (strcmp(name,"FSpressure")==0) return FSpressureEnum;
+ 	      else if (strcmp(name,"Constraints")==0) return ConstraintsEnum;
+ 	      else if (strcmp(name,"Loads")==0) return LoadsEnum;
+@@ -504,11 +505,11 @@
+ 	      else if (strcmp(name,"TemperaturePicard")==0) return TemperaturePicardEnum;
+ 	      else if (strcmp(name,"ThicknessAbsMisfit")==0) return ThicknessAbsMisfitEnum;
+ 	      else if (strcmp(name,"Vel")==0) return VelEnum;
+-	      else if (strcmp(name,"Velocity")==0) return VelocityEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"VxAverage")==0) return VxAverageEnum;
++	      if (strcmp(name,"Velocity")==0) return VelocityEnum;
++	      else if (strcmp(name,"VxAverage")==0) return VxAverageEnum;
+ 	      else if (strcmp(name,"Vx")==0) return VxEnum;
+ 	      else if (strcmp(name,"VxPicard")==0) return VxPicardEnum;
+ 	      else if (strcmp(name,"VyAverage")==0) return VyAverageEnum;
+@@ -627,11 +628,11 @@
+ 	      else if (strcmp(name,"SoftMigration")==0) return SoftMigrationEnum;
+ 	      else if (strcmp(name,"SubelementMigration")==0) return SubelementMigrationEnum;
+ 	      else if (strcmp(name,"SubelementMigration2")==0) return SubelementMigration2Enum;
+-	      else if (strcmp(name,"Contact")==0) return ContactEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"MaskGroundediceLevelset")==0) return MaskGroundediceLevelsetEnum;
++	      if (strcmp(name,"Contact")==0) return ContactEnum;
++	      else if (strcmp(name,"MaskGroundediceLevelset")==0) return MaskGroundediceLevelsetEnum;
+ 	      else if (strcmp(name,"QmuMaskGroundediceLevelset")==0) return QmuMaskGroundediceLevelsetEnum;
+ 	      else if (strcmp(name,"GaussSeg")==0) return GaussSegEnum;
+ 	      else if (strcmp(name,"GaussTria")==0) return GaussTriaEnum;
+Index: ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py
+===================================================================
+--- ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py	(revision 17762)
++++ ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py	(revision 17763)
+@@ -31,19 +31,20 @@
+ 		vertexonicefront=numpy.logical_and(md.mesh.vertexonboundary,incontour.reshape(-1))
+ 	else:
+ 		#Guess where the ice front is
+-		vertexonfloatingice=numpy.zeros((md.mesh.numberofvertices,1))
+-		pos=numpy.nonzero(numpy.sum(md.mask.groundedice_levelset[md.mesh.elements-1]<0.,axis=1) >0.)[0]
+-		vertexonfloatingice[md.mesh.elements[pos].astype(int)-1]=1.
+-		vertexonicefront=numpy.logical_and(numpy.reshape(md.mesh.vertexonboundary,(-1,1)),vertexonfloatingice>0.)
++		vertexonfloatingice=numpy.zeros((md.mesh.numberofvertices,))
++		pos=numpy.nonzero(numpy.sum(md.mask.groundedice_levelset[md.mesh.elements-1]<0,axis=1) > 0)[0]
++		#vertexonfloatingice[md.mesh.elements[pos].astype(int)-1]=1.
++		vertexonfloatingice[md.mesh.elements[pos]-1]=1.
++		vertexonicefront=numpy.logical_and(md.mesh.vertexonboundary,vertexonfloatingice>0.)
+ 
+ #	pos=find(md.mesh.vertexonboundary & ~vertexonicefront);
+ 	pos=numpy.nonzero(numpy.logical_and(md.mesh.vertexonboundary,numpy.logical_not(vertexonicefront)))[0]
+ 	if not numpy.size(pos):
+ 		print "SetMarineIceSheetBC warning: ice front all around the glacier, no dirichlet found. Dirichlet must be added manually."
+ 
+-	md.stressbalance.spcvx=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
+-	md.stressbalance.spcvy=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
+-	md.stressbalance.spcvz=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
++	md.stressbalance.spcvx=float('nan')*numpy.ones((md.mesh.numberofvertices,))
++	md.stressbalance.spcvy=float('nan')*numpy.ones((md.mesh.numberofvertices,))
++	md.stressbalance.spcvz=float('nan')*numpy.ones((md.mesh.numberofvertices,))
+ 	md.stressbalance.referential=float('nan')*numpy.ones((md.mesh.numberofvertices,6))
+ 	md.stressbalance.loadingforce=0*numpy.ones((md.mesh.numberofvertices,3))
+ 
+@@ -67,9 +68,9 @@
+ 		pos=md.mesh.segments[segments,0:-1]-1
+ 	else:
+ 		pos=numpy.nonzero(md.mesh.vertexonboundary)[0]
+-	md.stressbalance.spcvx[pos[:]]=0
+-	md.stressbalance.spcvy[pos[:]]=0
+-	md.stressbalance.spcvz[pos[:]]=0
++	md.stressbalance.spcvx[pos]=0
++	md.stressbalance.spcvy[pos]=0
++	md.stressbalance.spcvz[pos]=0
+ 
+ 	#Dirichlet Values
+ 	if isinstance(md.inversion.vx_obs,numpy.ndarray) and numpy.size(md.inversion.vx_obs,axis=0)==md.mesh.numberofvertices and isinstance(md.inversion.vy_obs,numpy.ndarray) and numpy.size(md.inversion.vy_obs,axis=0)==md.mesh.numberofvertices:
+@@ -89,23 +90,22 @@
+ 
+ 	#Deal with other boundary conditions
+ 	if numpy.all(numpy.isnan(md.balancethickness.thickening_rate)):
+-		md.balancethickness.thickening_rate=numpy.zeros((md.mesh.numberofvertices,1))
++		md.balancethickness.thickening_rate=numpy.zeros((md.mesh.numberofvertices,))
+ 		print "      no balancethickness.thickening_rate specified: values set as zero"
+ 
+-	md.masstransport.spcthickness=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
+-	md.balancethickness.spcthickness=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
+-	md.damage.spcdamage=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
++	md.masstransport.spcthickness=float('nan')*numpy.ones((md.mesh.numberofvertices,))
++	md.balancethickness.spcthickness=float('nan')*numpy.ones((md.mesh.numberofvertices,))
++	md.damage.spcdamage=float('nan')*numpy.ones((md.mesh.numberofvertices,))
+ 
+ 	if isinstance(md.initialization.temperature,numpy.ndarray) and numpy.size(md.initialization.temperature,axis=0)==md.mesh.numberofvertices:
+-		md.thermal.spctemperature=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
++		md.thermal.spctemperature=float('nan')*numpy.ones((md.mesh.numberofvertices,))
+ 		if hasattr(md.mesh,'vertexonsurface'):
+ 			pos=numpy.nonzero(md.mesh.vertexonsurface)[0]
+ 			md.thermal.spctemperature[pos]=md.initialization.temperature[pos]    #impose observed temperature on surface
+ 		if not isinstance(md.basalforcings.geothermalflux,numpy.ndarray) or not numpy.size(md.basalforcings.geothermalflux,axis=0)==md.mesh.numberofvertices:
+-			md.basalforcings.geothermalflux=numpy.zeros((md.mesh.numberofvertices,1))
+-			md.basalforcings.geothermalflux[numpy.nonzero(md.mask.groundedice_levelset>0.)]=50.*10.**-3    #50mW/m2
++			md.basalforcings.geothermalflux=numpy.zeros((md.mesh.numberofvertices,))
++			md.basalforcings.geothermalflux[numpy.nonzero(md.mask.groundedice_levelset>0.)[0]]=50.*10.**-3    #50mW/m2
+ 	else:
+ 		print "      no thermal boundary conditions created: no observed temperature found"
+ 
+ 	return md
+-
+Index: ../trunk-jpl/src/m/classes/damage.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/damage.py	(revision 17762)
++++ ../trunk-jpl/src/m/classes/damage.py	(revision 17763)
+@@ -16,6 +16,7 @@
+ 	def __init__(self,*args):    # {{{
+ 			
+ 		#damage: 
++		self.isdamage           = float('NaN')
+ 		self.D						= float('NaN')
+ 		self.law						= ''
+ 		self.spcdamage				= float('NaN')
+@@ -23,8 +24,9 @@
+ 		
+ 		#numerical
+ 		stabilization				= float('NaN')
++		maxiter						= float('NaN')
++		elementinterp           = ''
+ 		penalty_threshold			= float('NaN')
+-		maxiter						= float('NaN')
+ 		penalty_lock				= float('NaN')
+ 		penalty_factor				= float('NaN')
+ 
+@@ -46,18 +48,21 @@
+ 	# }}}
+ 	def __repr__(self):    # {{{
+ 		s ='   Damage:\n'
++		
++		s+="%s\n" % fielddisplay(self,"isdamage","is damage mechanics being used? [0 (default) or 1]")
++		if self.isdamage:
++			s+="%s\n" % fielddisplay(self,"D","damage tensor (scalar for now)")
++			s+="%s\n" % fielddisplay(self,"law","damage law (string) from ['undamaged','pralong']")
++			s+="%s\n" % fielddisplay(self,"spcdamage","damage constraints (NaN means no constraint)")
++			s+="%s\n" % fielddisplay(self,"max_damage","maximum possible damage (0<=max_damage<1)")
+ 
+-		s+="%s\n" % fielddisplay(self,"D","damage tensor (scalar for now)")
+-		s+="%s\n" % fielddisplay(self,"law","damage law (string) from ['undamaged','pralong']")
+-		s+="%s\n" % fielddisplay(self,"spcdamage","damage constraints (NaN means no constraint)")
+-		s+="%s\n" % fielddisplay(self,"max_damage","maximum possible damage (0<=max_damage<1)")
++			s+="%s\n" % fielddisplay(self,"stabilization","0: no, 1: artificial_diffusivity, 2: SUPG")
++			s+="%s\n" % fielddisplay(self,"maxiter","maximum number of non linear iterations")
++			s+="%s\n" %	fielddisplay(self,"elementinterp","interpolation scheme for finite elements {''P1'',''P2''}")
++			s+="%s\n" % fielddisplay(self,"penalty_lock","stabilize unstable damage constraints that keep zigzagging after n iteration (default is 0, no stabilization)")
++			s+="%s\n" % fielddisplay(self,"penalty_threshold","threshold to declare convergence of damage evolution solution (default is 0)")
++			s+="%s\n" % fielddisplay(self,"penalty_factor","scaling exponent (default is 3)")
+ 
+-		s+="%s\n" % fielddisplay(self,"stabilization","0: no, 1: artificial_diffusivity, 2: SUPG")
+-		s+="%s\n" % fielddisplay(self,"maxiter","maximum number of non linear iterations")
+-		s+="%s\n" % fielddisplay(self,"penalty_lock","stabilize unstable damage constraints that keep zigzagging after n iteration (default is 0, no stabilization)")
+-		s+="%s\n" % fielddisplay(self,"penalty_threshold","threshold to declare convergence of damage evolution solution (default is 0)")
+-		s+="%s\n" % fielddisplay(self,"penalty_factor","scaling exponent (default is 3)")
+-
+ 		if (self.law=='pralong'):
+ 			s+="%s\n" % fielddisplay(self,"c1","damage parameter 1 ")
+ 			s+="%s\n" % fielddisplay(self,"c2","damage parameter 2 ")
+@@ -73,6 +78,7 @@
+ 	def setdefaultparameters(self):    # {{{
+ 
+ 		#damage parameters: 
++		self.isdamage=0
+ 		self.D=0
+ 		self.law='undamaged'
+ 
+@@ -84,6 +90,9 @@
+ 		#Maximum number of iterations
+ 		self.maxiter=100
+ 
++		#finite element interpolation
++		self.elementinterp='P1'
++
+ 		#factor used to compute the values of the penalties: kappa=max(stiffness matrix)*10^penalty_factor
+ 		self.penalty_factor=3
+ 			
+@@ -118,16 +127,19 @@
+ 	#}}}
+ 	def checkconsistency(self,md,solution,analyses):    # {{{
+ 
+-		md = checkfield(md,'fieldname','damage.D','>=',0,'<=',self.max_damage,'size',[md.mesh.numberofvertices])
+-		md = checkfield(md,'fieldname','damage.max_damage','<',1,'>=',0)
+-		md = checkfield(md,'fieldname','damage.law','values',['undamaged','pralong'])
+-		md = checkfield(md,'fieldname','damage.spcdamage','forcing',1)
+-			
+-		md = checkfield(md,'fieldname','damage.stabilization','numel',[1],'values',[0,1,2])
+-		md = checkfield(md,'fieldname','damage.maxiter','>=0',0)
+-		md = checkfield(md,'fieldname','damage.penalty_factor','>=0',0)
+-		md = checkfield(md,'fieldname','damage.penalty_lock','>=0',0)
+-		md = checkfield(md,'fieldname','damage.penalty_threshold','>=0',0)
++		md = checkfield(md,'fieldname','damage.isdamage','numel',[1],'values',[0,1])
++		if self.isdamage:
++			md = checkfield(md,'fieldname','damage.D','>=',0,'<=',self.max_damage,'size',[md.mesh.numberofvertices])
++			md = checkfield(md,'fieldname','damage.max_damage','<',1,'>=',0)
++			md = checkfield(md,'fieldname','damage.law','values',['undamaged','pralong'])
++			md = checkfield(md,'fieldname','damage.spcdamage','forcing',1)
++				
++			md = checkfield(md,'fieldname','damage.stabilization','numel',[1],'values',[0,1,2])
++			md = checkfield(md,'fieldname','damage.maxiter','>=0',0)
++			md = checkfield(md,'fieldname','damage.elementinterp','values',['P1','P2'])
++			md = checkfield(md,'fieldname','damage.penalty_factor','>=0',0)
++			md = checkfield(md,'fieldname','damage.penalty_lock','>=0',0)
++			md = checkfield(md,'fieldname','damage.penalty_threshold','>=0',0)
+ 
+ 		if self.law == 'pralong':
+ 			md = checkfield(md,'fieldname','damage.healing','>=',0)
+@@ -147,16 +159,19 @@
+ 	# }}}
+ 	def marshall(self,md,fid):    # {{{
+ 
+-		WriteData(fid,'object',self,'fieldname','D','format','DoubleMat','mattype',1)
+-		WriteData(fid,'object',self,'fieldname','law','format','String')
+-		WriteData(fid,'object',self,'fieldname','spcdamage','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1)
+-		WriteData(fid,'object',self,'fieldname','max_damage','format','Double')
++		WriteData(fid,'object',self,'fieldname','isdamage','format','Boolean')
++		if self.isdamage:
++			WriteData(fid,'object',self,'fieldname','D','format','DoubleMat','mattype',1)
++			WriteData(fid,'object',self,'fieldname','law','format','String')
++			WriteData(fid,'object',self,'fieldname','spcdamage','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1)
++			WriteData(fid,'object',self,'fieldname','max_damage','format','Double')
+ 
+-		WriteData(fid,'object',self,'fieldname','stabilization','format','Integer')
+-		WriteData(fid,'object',self,'fieldname','penalty_threshold','format','Integer')
+-		WriteData(fid,'object',self,'fieldname','maxiter','format','Integer')
+-		WriteData(fid,'object',self,'fieldname','penalty_lock','format','Integer')
+-		WriteData(fid,'object',self,'fieldname','penalty_factor','format','Double')
++			WriteData(fid,'object',self,'fieldname','stabilization','format','Integer')
++			WriteData(fid,'object',self,'fieldname','elementinterp','format','String')
++			WriteData(fid,'object',self,'fieldname','penalty_threshold','format','Integer')
++			WriteData(fid,'object',self,'fieldname','maxiter','format','Integer')
++			WriteData(fid,'object',self,'fieldname','penalty_lock','format','Integer')
++			WriteData(fid,'object',self,'fieldname','penalty_factor','format','Double')
+ 
+ 		if self.law=='pralong':
+ 			WriteData(fid,'object',self,'fieldname','c1','format','Double')
+Index: ../trunk-jpl/src/m/enum/DamageIsdamageEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/DamageIsdamageEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/DamageIsdamageEnum.m	(revision 17763)
+@@ -0,0 +1,11 @@
++function macro=DamageIsdamageEnum()
++%DAMAGEISDAMAGEENUM - Enum of DamageIsdamage
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=DamageIsdamageEnum()
++
++macro=StringToEnum('DamageIsdamage');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17762)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17763)
+@@ -163,6 +163,7 @@
+ def MaterialsRheologyBbarEnum(): return StringToEnum("MaterialsRheologyBbar")[0]
+ def MaterialsRheologyLawEnum(): return StringToEnum("MaterialsRheologyLaw")[0]
+ def MaterialsRheologyNEnum(): return StringToEnum("MaterialsRheologyN")[0]
++def DamageIsdamageEnum(): return StringToEnum("DamageIsdamage")[0]
+ def DamageDEnum(): return StringToEnum("DamageD")[0]
+ def DamageFEnum(): return StringToEnum("DamageF")[0]
+ def QmuDamageDEnum(): return StringToEnum("QmuDamageD")[0]
Index: issm/oecreview/Archive/16554-17801/ISSM-17763-17764.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17763-17764.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17763-17764.diff	(revision 17802)
@@ -0,0 +1,240 @@
+Index: ../trunk-jpl/test/NightlyRun/test274.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test274.py	(revision 17763)
++++ ../trunk-jpl/test/NightlyRun/test274.py	(revision 17764)
+@@ -1,20 +1,23 @@
+ import numpy
+-from model import *
+-from triangle import *
+-from meshprocessrifts import *
+-from setmask import *
+-from parameterize import *
+-from paterson import *
+-from setflowequation import *
+-from EnumDefinitions import *
+-from solve import *
+-from MatlabFuncs import *
++from model import model
++from triangle import triangle
++from setmask import setmask
++from parameterize import parameterize
++from setflowequation import setflowequation
++from EnumDefinitions import StressbalanceSolutionEnum
++from solve import solve
++from socket import gethostname as oshostname
++from matdamageice import matdamageice
++from meshprocessrifts import meshprocessrifts
+ 
+ md=triangle(model(),'../Exp/SquareHole.exp','../Exp/Rifts.exp',50000.)
+ md=meshprocessrifts(md,'../Exp/Square.exp')
+ md=setmask(md,'all','')
++md.materials=matdamageice()
+ md=parameterize(md,'../Par/SquareShelf2.py')
+-md.damage.D=0.5*numpy.ones((md.mesh.numberofvertices,1))
++md.damage.isdamage=1
++md.damage.D=0.5*numpy.ones(md.mesh.numberofvertices)
++md.damage.spcdamage=numpy.nan*numpy.ones(md.mesh.numberofvertices)
+ md=setflowequation(md,'SSA','all')
+ 
+ md.cluster=generic('name',oshostname(),'np',3)
+Index: ../trunk-jpl/test/NightlyRun/test274.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test274.m	(revision 17763)
++++ ../trunk-jpl/test/NightlyRun/test274.m	(revision 17764)
+@@ -1,8 +1,11 @@
+ md=triangle(model(),'../Exp/SquareHole.exp','../Exp/Rifts.exp',50000.);
+ md=meshprocessrifts(md,'../Exp/Square.exp');
+ md=setmask(md,'all','');
++md.materials=matdamageice();
+ md=parameterize(md,'../Par/SquareShelf2.par');
++md.damage.isdamage=1;
+ md.damage.D=0.5*ones(md.mesh.numberofvertices,1);
++md.damage.spcdamage=NaN*ones(md.mesh.numberofvertices,1);
+ md=setflowequation(md,'SSA','all');
+ 
+ md.cluster=generic('name',oshostname(),'np',3);
+Index: ../trunk-jpl/test/NightlyRun/test275.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test275.py	(revision 17763)
++++ ../trunk-jpl/test/NightlyRun/test275.py	(revision 17764)
+@@ -1,4 +1,4 @@
+-import numpy as npy
++import numpy
+ from triangle import triangle
+ from model import model
+ from setmask import setmask
+@@ -12,9 +12,11 @@
+ 
+ md=triangle(model(),'../Exp/Square.exp',150000.)
+ md=setmask(md,'all','')
++md.materials=matdamageice()
+ md=parameterize(md,'../Par/SquareShelf.py')
+-md.damage.D=0.1*npy.ones((md.mesh.numberofvertices,1))
+-md.damage.spcdamage=npy.float('nan')*npy.ones((md.mesh.numberofvertices,1))
++md.damage.isdamage=1
++md.damage.D=0.1*numpy.ones(md.mesh.numberofvertices)
++md.damage.spcdamage=numpy.nan*numpy.ones(md.mesh.numberofvertices)
+ md.damage.law='pralong'
+ 
+ md.damage.c1=1.e-11
+Index: ../trunk-jpl/test/NightlyRun/test275.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test275.m	(revision 17763)
++++ ../trunk-jpl/test/NightlyRun/test275.m	(revision 17764)
+@@ -1,6 +1,8 @@
+ md=triangle(model(),'../Exp/Square.exp',150000.);
+ md=setmask(md,'all','');
++md.materials=matdamageice();
+ md=parameterize(md,'../Par/SquareShelf.par');
++md.damage.isdamage=1;
+ md.damage.D=0.1*ones(md.mesh.numberofvertices,1);
+ md.damage.spcdamage=NaN*ones(md.mesh.numberofvertices,1);
+ md.damage.law='pralong';
+Index: ../trunk-jpl/test/NightlyRun/test270.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test270.py	(revision 17763)
++++ ../trunk-jpl/test/NightlyRun/test270.py	(revision 17764)
+@@ -1,18 +1,22 @@
+ import numpy
+-from model import *
+-from triangle import *
+-from setmask import *
+-from parameterize import *
+-from paterson import *
+-from setflowequation import *
+-from EnumDefinitions import *
+-from solve import *
+-from MatlabFuncs import *
++from model import model
++from triangle import triangle
++from setmask import setmask
++from parameterize import parameterize
++from setflowequation import setflowequation
++from EnumDefinitions import StressbalanceSolutionEnum
++from solve import solve
++from matdamageice import matdamageice
++from generic import generic
++from socket import gethostname as oshostname
+ 
+ md=triangle(model(),'../Exp/Square.exp',150000.)
+ md=setmask(md,'all','')
++md.materials=matdamageice()
+ md=parameterize(md,'../Par/SquareShelf.py')
+-md.damage.D=0.5*numpy.ones((md.mesh.numberofvertices,1))
++md.damage.isdamage=1
++md.damage.D=0.5*numpy.ones(md.mesh.numberofvertices)
++md.damage.spcdamage=numpy.nan*numpy.ones(md.mesh.numberofvertices)
+ md=setflowequation(md,'SSA','all')
+ md.cluster=generic('name',oshostname(),'np',3)
+ md=solve(md,StressbalanceSolutionEnum())
+Index: ../trunk-jpl/test/NightlyRun/test271.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test271.py	(revision 17763)
++++ ../trunk-jpl/test/NightlyRun/test271.py	(revision 17764)
+@@ -1,4 +1,4 @@
+-import numpy as npy
++import numpy 
+ from triangle import triangle
+ from model import model
+ from setmask import setmask
+@@ -9,16 +9,19 @@
+ from socket import gethostname as oshostname
+ from solve import solve
+ from EnumDefinitions import DamageEvolutionSolutionEnum
++from matdamageice import matdamageice
+ 
+ md=triangle(model(),'../Exp/Square.exp',150000.)
+ md=setmask(md,'all','')
++md.materials=matdamageice()
+ md=parameterize(md,'../Par/SquareShelf.py')
+-md.damage.D=npy.zeros((md.mesh.numberofvertices,1))
+-md.damage.spcdamage=npy.float('nan')*npy.ones((md.mesh.numberofvertices,1))
++md.damage.isdamage=1
++md.damage.D=numpy.zeros(md.mesh.numberofvertices)
++md.damage.spcdamage=numpy.nan*numpy.ones(md.mesh.numberofvertices)
+ md.damage.law='pralong'
+ md.damage.stabilization=1;
+ 
+-pos=npy.nonzero(npy.logical_and(md.mask.ice_levelset[:,0]!=0,md.mesh.vertexonboundary==1))
++pos=numpy.nonzero(numpy.logical_and(md.mask.ice_levelset[:,0]!=0,md.mesh.vertexonboundary==1))
+ md.damage.spcdamage[pos]=0.5;
+ 
+ md.damage.requested_outputs=['default','DamageF']
+Index: ../trunk-jpl/test/NightlyRun/test270.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test270.m	(revision 17763)
++++ ../trunk-jpl/test/NightlyRun/test270.m	(revision 17764)
+@@ -1,7 +1,9 @@
+ md=triangle(model(),'../Exp/Square.exp',150000.);
+ md=setmask(md,'all','');
+ md=parameterize(md,'../Par/SquareShelf.par');
++md.damage.isdamage=1;
+ md.damage.D=0.5*ones(md.mesh.numberofvertices,1);
++md.damage.spcdamage=NaN*ones(md.mesh.numberofvertices,1);
+ md=setflowequation(md,'SSA','all');
+ md.cluster=generic('name',oshostname(),'np',3);
+ md=solve(md,StressbalanceSolutionEnum());
+Index: ../trunk-jpl/test/NightlyRun/test272.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test272.py	(revision 17763)
++++ ../trunk-jpl/test/NightlyRun/test272.py	(revision 17764)
+@@ -1,18 +1,21 @@
+ import numpy
+-from model import *
+-from triangle import *
+-from setmask import *
+-from parameterize import *
+-from paterson import *
+-from setflowequation import *
+-from EnumDefinitions import *
+-from solve import *
+-from MatlabFuncs import *
++from model import model
++from triangle import triangle
++from setmask import setmask
++from parameterize import parameterize
++from setflowequation import setflowequation
++from EnumDefinitions import StressbalanceSolutionEnum
++from solve import solve
++from socket import gethostname as oshostname
++from matdamageice import matdamageice
+ 
+ md=triangle(model(),'../Exp/Square.exp',150000.)
+ md=setmask(md,'all','')
++md.materials=matdamageice()
+ md=parameterize(md,'../Par/SquareShelf.py')
+-md.damage.D=0.5*numpy.ones((md.mesh.numberofvertices,1))
++md.damage.isdamage=1
++md.damage.D=0.5*numpy.ones(md.mesh.numberofvertices)
++md.damage.spcdamage=numpy.nan*numpy.ones(md.mesh.numberofvertices)
+ md=setflowequation(md,'SSA','all')
+ 
+ #control parameters
+Index: ../trunk-jpl/test/NightlyRun/test271.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test271.m	(revision 17763)
++++ ../trunk-jpl/test/NightlyRun/test271.m	(revision 17764)
+@@ -1,6 +1,8 @@
+ md=triangle(model(),'../Exp/Square.exp',150000.);
+ md=setmask(md,'all','');
++md.materials=matdamageice();
+ md=parameterize(md,'../Par/SquareShelf.par');
++md.damage.isdamage=1;
+ md.damage.D=zeros(md.mesh.numberofvertices,1);
+ md.damage.spcdamage=NaN*ones(md.mesh.numberofvertices,1);
+ md.damage.law='pralong';
+Index: ../trunk-jpl/test/NightlyRun/test272.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test272.m	(revision 17763)
++++ ../trunk-jpl/test/NightlyRun/test272.m	(revision 17764)
+@@ -1,7 +1,10 @@
+ md=triangle(model(),'../Exp/Square.exp',150000.);
+ md=setmask(md,'all','');
++md.materials=matdamageice();
+ md=parameterize(md,'../Par/SquareShelf.par');
++md.damage.isdamage=1;
+ md.damage.D=0.5*ones(md.mesh.numberofvertices,1);
++md.damage.spcdamage=NaN*ones(md.mesh.numberofvertices,1);
+ md=setflowequation(md,'SSA','all');
+ md.verbose=verbose('control',true);
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17764-17765.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17764-17765.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17764-17765.diff	(revision 17802)
@@ -0,0 +1,188 @@
+Index: ../trunk-jpl/src/m/classes/matdamageice.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/matdamageice.py	(revision 0)
++++ ../trunk-jpl/src/m/classes/matdamageice.py	(revision 17765)
+@@ -0,0 +1,150 @@
++from fielddisplay import fielddisplay
++from EnumDefinitions import MaterialsEnum, MatdamageiceEnum, MaterialsRheologyLawEnum
++from StringToEnum import StringToEnum
++from checkfield import checkfield
++from WriteData import WriteData
++
++class matdamageice(object):
++	"""
++	MATICE class definition
++
++	   Usage:
++	      matdamagice=matdamageice();
++	"""
++
++	def __init__(self): # {{{
++		self.rho_ice                   = 0.
++		self.rho_water                 = 0.
++		self.rho_freshwater            = 0.
++		self.mu_water                  = 0.
++		self.heatcapacity              = 0.
++		self.latentheat                = 0.
++		self.thermalconductivity       = 0.
++		self.temperateiceconductivity  = 0.
++		self.meltingpoint              = 0.
++		self.beta                      = 0.
++		self.mixed_layer_capacity      = 0.
++		self.thermal_exchange_velocity = 0.
++		self.rheology_B                = float('NaN')
++		self.rheology_n                = float('NaN')
++		self.rheology_law              = ''
++
++		#gia: 
++		self.lithosphere_shear_modulus  = 0.
++		self.lithosphere_density        = 0.
++		self.mantle_shear_modulus       = 0.
++		self.mantle_density             = 0.
++
++		self.setdefaultparameters()
++		#}}}
++	def __repr__(self): # {{{
++		string="   Materials:"
++
++		string="%s\n%s"%(string,fielddisplay(self,"rho_ice","ice density [kg/m^3]"))
++		string="%s\n%s"%(string,fielddisplay(self,"rho_water","water density [kg/m^3]"))
++		string="%s\n%s"%(string,fielddisplay(self,"rho_freshwater","fresh water density [kg/m^3]"))
++		string="%s\n%s"%(string,fielddisplay(self,"mu_water","water viscosity [N s/m^2]"))
++		string="%s\n%s"%(string,fielddisplay(self,"heatcapacity","heat capacity [J/kg/K]"))
++		string="%s\n%s"%(string,fielddisplay(self,"thermalconductivity","ice thermal conductivity [W/m/K]"))
++		string="%s\n%s"%(string,fielddisplay(self,"temperateiceconductivity","temperate ice thermal conductivity [W/m/K]"))
++		string="%s\n%s"%(string,fielddisplay(self,"meltingpoint","melting point of ice at 1atm in K"))
++		string="%s\n%s"%(string,fielddisplay(self,"latentheat","latent heat of fusion [J/m^3]"))
++		string="%s\n%s"%(string,fielddisplay(self,"beta","rate of change of melting point with pressure [K/Pa]"))
++		string="%s\n%s"%(string,fielddisplay(self,"mixed_layer_capacity","mixed layer capacity [W/kg/K]"))
++		string="%s\n%s"%(string,fielddisplay(self,"thermal_exchange_velocity","thermal exchange velocity [m/s]"))
++		string="%s\n%s"%(string,fielddisplay(self,"rheology_B","flow law parameter [Pa/s^(1/n)]"))
++		string="%s\n%s"%(string,fielddisplay(self,"rheology_n","Glen's flow law exponent"))
++		string="%s\n%s"%(string,fielddisplay(self,"rheology_law","law for the temperature dependance of the rheology: 'None', 'Cuffey', 'Paterson', 'Arrhenius' or 'LliboutryDuval'"))
++		string="%s\n%s"%(string,fielddisplay(self,"lithosphere_shear_modulus","Lithosphere shear modulus [Pa]"))
++		string="%s\n%s"%(string,fielddisplay(self,"lithosphere_density","Lithosphere density [g/cm^-3]"))
++		string="%s\n%s"%(string,fielddisplay(self,"mantle_shear_modulus","Mantle shear modulus [Pa]"))
++		string="%s\n%s"%(string,fielddisplay(self,"mantle_density","Mantle density [g/cm^-3]"))
++
++		return string
++		#}}}
++	def setdefaultparameters(self): # {{{
++		#ice density (kg/m^3)
++		self.rho_ice=917.
++
++		#ocean water density (kg/m^3)
++		self.rho_water=1023.
++
++		#fresh water density (kg/m^3)
++		self.rho_freshwater=1000.
++
++		#water viscosity (N.s/m^2)
++		self.mu_water=0.001787  
++
++		#ice heat capacity cp (J/kg/K)
++		self.heatcapacity=2093.
++
++		#ice latent heat of fusion L (J/kg)
++		self.latentheat=3.34*10**5
++
++		#ice thermal conductivity (W/m/K)
++		self.thermalconductivity=2.4
++
++		#temperate ice thermal conductivity (W/m/K)
++		self.temperateiceconductivity=0.24
++
++		#the melting point of ice at 1 atmosphere of pressure in K
++		self.meltingpoint=273.15
++
++		#rate of change of melting point with pressure (K/Pa)
++		self.beta=9.8*10**-8
++
++		#mixed layer (ice-water interface) heat capacity (J/kg/K)
++		self.mixed_layer_capacity=3974.
++
++		#thermal exchange velocity (ice-water interface) (m/s)
++		self.thermal_exchange_velocity=1.00*10**-4
++
++		#Rheology law: what is the temperature dependence of B with T
++		#available: none, paterson and arrhenius
++		self.rheology_law='Paterson'
++
++		# GIA:
++		self.lithosphere_shear_modulus  = 6.7*10**10  # (Pa)
++		self.lithosphere_density        = 3.32        # (g/cm^-3)
++		self.mantle_shear_modulus       = 1.45*10**11 # (Pa)
++		self.mantle_density             = 3.34        # (g/cm^-3)
++
++		return self
++		#}}}
++	def checkconsistency(self,md,solution,analyses):    # {{{
++		md = checkfield(md,'fieldname','materials.rho_ice','>',0)
++		md = checkfield(md,'fieldname','materials.rho_water','>',0)
++		md = checkfield(md,'fieldname','materials.rho_freshwater','>',0)
++		md = checkfield(md,'fieldname','materials.mu_water','>',0)
++		md = checkfield(md,'fieldname','materials.rheology_B','>',0,'size',[md.mesh.numberofvertices])
++		md = checkfield(md,'fieldname','materials.rheology_n','>',0,'size',[md.mesh.numberofelements])
++		md = checkfield(md,'fieldname','materials.rheology_law','values',['None','Cuffey','Paterson','Arrhenius','LliboutryDuval'])
++		md = checkfield(md,'fieldname','materials.lithosphere_shear_modulus','>',0,'numel',[1]);
++		md = checkfield(md,'fieldname','materials.lithosphere_density','>',0,'numel',[1]);
++		md = checkfield(md,'fieldname','materials.mantle_shear_modulus','>',0,'numel',[1]);
++		md = checkfield(md,'fieldname','materials.mantle_density','>',0,'numel',[1]);
++		return md
++	# }}}
++	def marshall(self,md,fid):    # {{{
++		WriteData(fid,'enum',MaterialsEnum(),'data',MatdamageiceEnum(),'format','Integer');
++		WriteData(fid,'object',self,'class','materials','fieldname','rho_ice','format','Double')
++		WriteData(fid,'object',self,'class','materials','fieldname','rho_water','format','Double')
++		WriteData(fid,'object',self,'class','materials','fieldname','rho_freshwater','format','Double')
++		WriteData(fid,'object',self,'class','materials','fieldname','mu_water','format','Double')
++		WriteData(fid,'object',self,'class','materials','fieldname','heatcapacity','format','Double')
++		WriteData(fid,'object',self,'class','materials','fieldname','latentheat','format','Double')
++		WriteData(fid,'object',self,'class','materials','fieldname','thermalconductivity','format','Double')
++		WriteData(fid,'object',self,'class','materials','fieldname','temperateiceconductivity','format','Double')
++		WriteData(fid,'object',self,'class','materials','fieldname','meltingpoint','format','Double')
++		WriteData(fid,'object',self,'class','materials','fieldname','beta','format','Double')
++		WriteData(fid,'object',self,'class','materials','fieldname','mixed_layer_capacity','format','Double')
++		WriteData(fid,'object',self,'class','materials','fieldname','thermal_exchange_velocity','format','Double')
++		WriteData(fid,'object',self,'class','materials','fieldname','rheology_B','format','DoubleMat','mattype',1)
++		WriteData(fid,'object',self,'class','materials','fieldname','rheology_n','format','DoubleMat','mattype',2)
++		WriteData(fid,'data',StringToEnum(self.rheology_law)[0],'enum',MaterialsRheologyLawEnum(),'format','Integer')
++
++		WriteData(fid,'object',self,'class','materials','fieldname','lithosphere_shear_modulus','format','Double');
++		WriteData(fid,'object',self,'class','materials','fieldname','lithosphere_density','format','Double','scale',10.**3.);
++		WriteData(fid,'object',self,'class','materials','fieldname','mantle_shear_modulus','format','Double');
++		WriteData(fid,'object',self,'class','materials','fieldname','mantle_density','format','Double','scale',10.**3.);
++	# }}}
+Index: ../trunk-jpl/src/m/classes/matdamageice.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/matdamageice.m	(revision 17764)
++++ ../trunk-jpl/src/m/classes/matdamageice.m	(revision 17765)
+@@ -1,9 +1,9 @@
+-%MATICE class definition
++%MATDAMAGEICE class definition
+ %
+ %   Usage:
+-%      matice=matice();
++%      matdamageice=matdamageice();
+ 
+-classdef matice
++classdef matdamageice
+ 	properties (SetAccess=public) 
+ 		rho_ice                    = 0.;
+ 		rho_water                  = 0.;
+@@ -63,13 +63,13 @@
+         
+          
+         end % }}}
+-		function obj = matice(varargin) % {{{
++		function obj = matdamageice(varargin) % {{{
+ 			switch nargin
+ 				case 0
+ 					obj=setdefaultparameters(obj);
+ 				case 1
+ 					inputstruct=varargin{1};
+-					list1 = properties('matice');
++					list1 = properties('matdamageice');
+ 					list2 = fieldnames(inputstruct);
+ 					for i=1:length(list1)
+ 						fieldname = list1{i};
Index: issm/oecreview/Archive/16554-17801/ISSM-17765-17766.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17765-17766.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17765-17766.diff	(revision 17802)
@@ -0,0 +1,76 @@
+Index: ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py
+===================================================================
+--- ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py	(revision 17765)
++++ ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py	(revision 17766)
+@@ -31,20 +31,19 @@
+ 		vertexonicefront=numpy.logical_and(md.mesh.vertexonboundary,incontour.reshape(-1))
+ 	else:
+ 		#Guess where the ice front is
+-		vertexonfloatingice=numpy.zeros((md.mesh.numberofvertices,))
+-		pos=numpy.nonzero(numpy.sum(md.mask.groundedice_levelset[md.mesh.elements-1]<0,axis=1) > 0)[0]
+-		#vertexonfloatingice[md.mesh.elements[pos].astype(int)-1]=1.
+-		vertexonfloatingice[md.mesh.elements[pos]-1]=1.
+-		vertexonicefront=numpy.logical_and(md.mesh.vertexonboundary,vertexonfloatingice>0.)
++		vertexonfloatingice=numpy.zeros((md.mesh.numberofvertices,1))
++		pos=numpy.nonzero(numpy.sum(md.mask.groundedice_levelset[md.mesh.elements-1]<0.,axis=1) >0.)[0]
++		vertexonfloatingice[md.mesh.elements[pos].astype(int)-1]=1.
++		vertexonicefront=numpy.logical_and(numpy.reshape(md.mesh.vertexonboundary,(-1,1)),vertexonfloatingice>0.)
+ 
+ #	pos=find(md.mesh.vertexonboundary & ~vertexonicefront);
+ 	pos=numpy.nonzero(numpy.logical_and(md.mesh.vertexonboundary,numpy.logical_not(vertexonicefront)))[0]
+ 	if not numpy.size(pos):
+ 		print "SetMarineIceSheetBC warning: ice front all around the glacier, no dirichlet found. Dirichlet must be added manually."
+ 
+-	md.stressbalance.spcvx=float('nan')*numpy.ones((md.mesh.numberofvertices,))
+-	md.stressbalance.spcvy=float('nan')*numpy.ones((md.mesh.numberofvertices,))
+-	md.stressbalance.spcvz=float('nan')*numpy.ones((md.mesh.numberofvertices,))
++	md.stressbalance.spcvx=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
++	md.stressbalance.spcvy=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
++	md.stressbalance.spcvz=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
+ 	md.stressbalance.referential=float('nan')*numpy.ones((md.mesh.numberofvertices,6))
+ 	md.stressbalance.loadingforce=0*numpy.ones((md.mesh.numberofvertices,3))
+ 
+@@ -68,9 +67,9 @@
+ 		pos=md.mesh.segments[segments,0:-1]-1
+ 	else:
+ 		pos=numpy.nonzero(md.mesh.vertexonboundary)[0]
+-	md.stressbalance.spcvx[pos]=0
+-	md.stressbalance.spcvy[pos]=0
+-	md.stressbalance.spcvz[pos]=0
++	md.stressbalance.spcvx[pos[:]]=0
++	md.stressbalance.spcvy[pos[:]]=0
++	md.stressbalance.spcvz[pos[:]]=0
+ 
+ 	#Dirichlet Values
+ 	if isinstance(md.inversion.vx_obs,numpy.ndarray) and numpy.size(md.inversion.vx_obs,axis=0)==md.mesh.numberofvertices and isinstance(md.inversion.vy_obs,numpy.ndarray) and numpy.size(md.inversion.vy_obs,axis=0)==md.mesh.numberofvertices:
+@@ -90,22 +89,23 @@
+ 
+ 	#Deal with other boundary conditions
+ 	if numpy.all(numpy.isnan(md.balancethickness.thickening_rate)):
+-		md.balancethickness.thickening_rate=numpy.zeros((md.mesh.numberofvertices,))
++		md.balancethickness.thickening_rate=numpy.zeros((md.mesh.numberofvertices,1))
+ 		print "      no balancethickness.thickening_rate specified: values set as zero"
+ 
+-	md.masstransport.spcthickness=float('nan')*numpy.ones((md.mesh.numberofvertices,))
+-	md.balancethickness.spcthickness=float('nan')*numpy.ones((md.mesh.numberofvertices,))
+-	md.damage.spcdamage=float('nan')*numpy.ones((md.mesh.numberofvertices,))
++	md.masstransport.spcthickness=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
++	md.balancethickness.spcthickness=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
++	md.damage.spcdamage=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
+ 
+ 	if isinstance(md.initialization.temperature,numpy.ndarray) and numpy.size(md.initialization.temperature,axis=0)==md.mesh.numberofvertices:
+-		md.thermal.spctemperature=float('nan')*numpy.ones((md.mesh.numberofvertices,))
++		md.thermal.spctemperature=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
+ 		if hasattr(md.mesh,'vertexonsurface'):
+ 			pos=numpy.nonzero(md.mesh.vertexonsurface)[0]
+ 			md.thermal.spctemperature[pos]=md.initialization.temperature[pos]    #impose observed temperature on surface
+ 		if not isinstance(md.basalforcings.geothermalflux,numpy.ndarray) or not numpy.size(md.basalforcings.geothermalflux,axis=0)==md.mesh.numberofvertices:
+-			md.basalforcings.geothermalflux=numpy.zeros((md.mesh.numberofvertices,))
+-			md.basalforcings.geothermalflux[numpy.nonzero(md.mask.groundedice_levelset>0.)[0]]=50.*10.**-3    #50mW/m2
++			md.basalforcings.geothermalflux=numpy.zeros((md.mesh.numberofvertices,1))
++			md.basalforcings.geothermalflux[numpy.nonzero(md.mask.groundedice_levelset>0.)]=50.*10.**-3    #50mW/m2
+ 	else:
+ 		print "      no thermal boundary conditions created: no observed temperature found"
+ 
+ 	return md
++
Index: issm/oecreview/Archive/16554-17801/ISSM-17766-17767.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17766-17767.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17766-17767.diff	(revision 17802)
@@ -0,0 +1,560 @@
+Index: ../trunk-jpl/test/Par/SquareEISMINT.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareEISMINT.py	(revision 17766)
++++ ../trunk-jpl/test/Par/SquareEISMINT.py	(revision 17767)
+@@ -28,6 +28,9 @@
+ md.materials.rheology_B=1.7687*10**8*numpy.ones((md.mesh.numberofvertices,1))
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
++#Damage
++md.damage.isdamage=0
++
+ print "      creating surface mass balance"
+ md.surfaceforcings.mass_balance=0.2*numpy.ones((md.mesh.numberofvertices,1))    #0m/a
+ md.basalforcings.melting_rate=0.*numpy.ones((md.mesh.numberofvertices,1))    #0m/a
+Index: ../trunk-jpl/test/Par/RoundSheetShelf.py
+===================================================================
+--- ../trunk-jpl/test/Par/RoundSheetShelf.py	(revision 17766)
++++ ../trunk-jpl/test/Par/RoundSheetShelf.py	(revision 17767)
+@@ -67,6 +67,9 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature)
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
++#Damage
++md.damage.isdamage=0
++
+ #Surface mass balance and basal melting
+ md.surfaceforcings.mass_balance=-10.*numpy.ones((md.mesh.numberofvertices,1))
+ md.basalforcings.melting_rate=numpy.zeros((md.mesh.numberofvertices,1))
+Index: ../trunk-jpl/test/Par/RoundSheetEISMINT.par
+===================================================================
+--- ../trunk-jpl/test/Par/RoundSheetEISMINT.par	(revision 17766)
++++ ../trunk-jpl/test/Par/RoundSheetEISMINT.par	(revision 17767)
+@@ -20,6 +20,9 @@
+ md.materials.rheology_B=6.81*10^7*ones(md.mesh.numberofvertices,1); %to have the same B as the analytical solution 
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
++%Damage
++md.damage.isdamage=0;
++
+ disp('      creating surface mass balance');
+ smb_max=0.5; %m/yr
+ sb=10^-2/1000.; %m/yr/m
+Index: ../trunk-jpl/test/Par/79North.par
+===================================================================
+--- ../trunk-jpl/test/Par/79North.par	(revision 17766)
++++ ../trunk-jpl/test/Par/79North.par	(revision 17767)
+@@ -20,6 +20,9 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
+ 
++%Damage
++md.damage.isdamage=0;
++
+ %Friction
+ md.friction.coefficient=50.*ones(md.mesh.numberofvertices,1);
+ md.friction.coefficient(find(md.mask.groundedice_levelset<0.))=0.;
+Index: ../trunk-jpl/test/Par/SquareShelf2.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareShelf2.py	(revision 17766)
++++ ../trunk-jpl/test/Par/SquareShelf2.py	(revision 17767)
+@@ -58,6 +58,9 @@
+ md.materials.rheology_B = paterson(md.initialization.temperature)
+ md.materials.rheology_n = 3.*numpy.ones((md.mesh.numberofelements,1))
+ 
++#Damage
++md.damage.isdamage=0
++
+ #Friction
+ md.friction.coefficient = 20.*numpy.ones((md.mesh.numberofvertices,1))
+ md.friction.coefficient[numpy.nonzero(md.mask.groundedice_levelset<0.)[0]]=0.
+Index: ../trunk-jpl/test/Par/SquareThermal.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareThermal.par	(revision 17766)
++++ ../trunk-jpl/test/Par/SquareThermal.par	(revision 17767)
+@@ -26,6 +26,9 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
++%Damage
++md.damage.isdamage=0;
++
+ disp('      creating surface mass balance');
+ md.surfaceforcings.mass_balance=ones(md.mesh.numberofvertices,1)/md.constants.yts; %1m/a
+ md.basalforcings.melting_rate=0.*ones(md.mesh.numberofvertices,1)/md.constants.yts; %1m/a
+Index: ../trunk-jpl/test/Par/RoundSheetEISMINT.py
+===================================================================
+--- ../trunk-jpl/test/Par/RoundSheetEISMINT.py	(revision 17766)
++++ ../trunk-jpl/test/Par/RoundSheetEISMINT.py	(revision 17767)
+@@ -23,6 +23,9 @@
+ md.materials.rheology_B=6.81*10**7*numpy.ones((md.mesh.numberofvertices,1))    #to have the same B as the analytical solution 
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
++#Damage
++md.damage.isdamage=0
++
+ print "      creating surface mass balance"
+ smb_max=0.5    #m/yr
+ sb=10**-2/1000.    #m/yr/m
+Index: ../trunk-jpl/test/Par/Pig.par
+===================================================================
+--- ../trunk-jpl/test/Par/Pig.par	(revision 17766)
++++ ../trunk-jpl/test/Par/Pig.par	(revision 17767)
+@@ -25,6 +25,9 @@
+ md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
+ md.initialization.temperature=md.initialization.temperature;
+ 
++%Damage
++md.damage.isdamage=0;
++
+ %Friction
+ md.friction.coefficient=50*ones(md.mesh.numberofvertices,1);
+ md.friction.coefficient(find(md.mask.groundedice_levelset<0.))=0.;
+Index: ../trunk-jpl/test/Par/RoundSheetStaticEISMINT.par
+===================================================================
+--- ../trunk-jpl/test/Par/RoundSheetStaticEISMINT.par	(revision 17766)
++++ ../trunk-jpl/test/Par/RoundSheetStaticEISMINT.par	(revision 17767)
+@@ -24,6 +24,9 @@
+ md.materials.rheology_B=6.81*10^7*ones(md.mesh.numberofvertices,1); %to have the same B as the analytical solution 
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
++%Damage
++md.damage.isdamage=0;
++
+ disp('      creating surface mass balance');
+ smb_max=0.5; %m/yr
+ sb=10^-2/1000.; %m/yr/m
+Index: ../trunk-jpl/test/Par/SquareShelf.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareShelf.par	(revision 17766)
++++ ../trunk-jpl/test/Par/SquareShelf.par	(revision 17767)
+@@ -28,6 +28,9 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
+ 
++%Damage
++md.damage.isdamage=0;
++
+ %Friction
+ md.friction.coefficient=20*ones(md.mesh.numberofvertices,1);
+ md.friction.coefficient(find(md.mask.groundedice_levelset<0.))=0.;
+Index: ../trunk-jpl/test/Par/ISMIPA.par
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPA.par	(revision 17766)
++++ ../trunk-jpl/test/Par/ISMIPA.par	(revision 17767)
+@@ -15,6 +15,9 @@
+ md.materials.rheology_B=6.8067*10^7*ones(md.mesh.numberofvertices,1);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
++%Damage
++md.damage.isdamage=0;
++
+ disp('      boundary conditions for stressbalance model');
+ %Create node on boundary first (because we cannot use mesh)
+ md=SetIceSheetBC(md);
+Index: ../trunk-jpl/test/Par/SquareShelfConstrained.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareShelfConstrained.py	(revision 17766)
++++ ../trunk-jpl/test/Par/SquareShelfConstrained.py	(revision 17767)
+@@ -39,6 +39,9 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature)
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
++#Damage
++md.damage.isdamage=0
++
+ #Surface mass balance and basal melting
+ md.surfaceforcings.mass_balance=10.*numpy.ones((md.mesh.numberofvertices,1))
+ md.basalforcings.melting_rate=5.*numpy.ones((md.mesh.numberofvertices,1))
+Index: ../trunk-jpl/test/Par/ISMIPB.par
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPB.par	(revision 17766)
++++ ../trunk-jpl/test/Par/ISMIPB.par	(revision 17767)
+@@ -15,6 +15,9 @@
+ md.materials.rheology_B=6.8067*10^7*ones(md.mesh.numberofvertices,1);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
++%Damage
++md.damage.isdamage=0;
++
+ disp('      boundary conditions for stressbalance model');
+ %Create node on boundary first (because we cannot use mesh)
+ md=SetIceSheetBC(md);
+Index: ../trunk-jpl/test/Par/SquareThermal.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareThermal.py	(revision 17766)
++++ ../trunk-jpl/test/Par/SquareThermal.py	(revision 17767)
+@@ -30,6 +30,9 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature)
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
++#Damage
++md.damage.isdamage=0
++
+ print "      creating surface mass balance"
+ md.surfaceforcings.mass_balance=numpy.ones((md.mesh.numberofvertices,1))/md.constants.yts    #1m/a
+ md.basalforcings.melting_rate=0.*numpy.ones((md.mesh.numberofvertices,1))/md.constants.yts    #1m/a
+Index: ../trunk-jpl/test/Par/ISMIPC.par
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPC.par	(revision 17766)
++++ ../trunk-jpl/test/Par/ISMIPC.par	(revision 17767)
+@@ -16,6 +16,9 @@
+ md.materials.rheology_B=6.8067*10^7*ones(md.mesh.numberofvertices,1);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
++%Damage
++md.damage.isdamage=0;
++
+ disp('      boundary conditions for stressbalance model:');
+ %Create node on boundary first (because we can not use mesh)
+ md=SetIceSheetBC(md);
+Index: ../trunk-jpl/test/Par/ISMIPD.par
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPD.par	(revision 17766)
++++ ../trunk-jpl/test/Par/ISMIPD.par	(revision 17767)
+@@ -15,6 +15,9 @@
+ md.materials.rheology_B=6.8067*10^7*ones(md.mesh.numberofvertices,1);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
++%Damage
++md.damage.isdamage=0;
++
+ disp('      boundary conditions for stressbalance model:');
+ %Create node on boundary first (because we can not use mesh)
+ md=SetIceSheetBC(md);
+Index: ../trunk-jpl/test/Par/Pig.py
+===================================================================
+--- ../trunk-jpl/test/Par/Pig.py	(revision 17766)
++++ ../trunk-jpl/test/Par/Pig.py	(revision 17767)
+@@ -36,6 +36,9 @@
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ md.initialization.temperature=md.initialization.temperature
+ 
++#Damage
++md.damage.isdamage=0
++
+ #Friction
+ md.friction.coefficient=50.*numpy.ones((md.mesh.numberofvertices,1))
+ md.friction.coefficient[numpy.nonzero(md.mask.groundedice_levelset<0.)[0]]=0.
+Index: ../trunk-jpl/test/Par/ISMIPE.par
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPE.par	(revision 17766)
++++ ../trunk-jpl/test/Par/ISMIPE.par	(revision 17767)
+@@ -25,6 +25,9 @@
+ md.materials.rheology_B=6.8067*10^7*ones(md.mesh.numberofvertices,1);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
++%Damage
++md.damage.isdamage=0;
++
+ disp('      boundary conditions for stressbalance model:');
+ %Create node on boundary first (because we can not use mesh)
+ md=SetIceSheetBC(md);
+Index: ../trunk-jpl/test/Par/ISMIPF.par
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPF.par	(revision 17766)
++++ ../trunk-jpl/test/Par/ISMIPF.par	(revision 17767)
+@@ -17,6 +17,9 @@
+ md.materials.rheology_n=1.*ones(md.mesh.numberofelements,1);
+ md.materials.rheology_law='None';
+ 
++%Damage
++md.damage.isdamage=0;
++
+ disp('      boundary conditions for stressbalance model');
+ %Create node on boundary first (because we cannot use mesh)
+ md=SetIceSheetBC(md);
+Index: ../trunk-jpl/test/Par/RoundSheetStaticEISMINT.py
+===================================================================
+--- ../trunk-jpl/test/Par/RoundSheetStaticEISMINT.py	(revision 17766)
++++ ../trunk-jpl/test/Par/RoundSheetStaticEISMINT.py	(revision 17767)
+@@ -27,6 +27,9 @@
+ md.materials.rheology_B=6.81*10**7*numpy.ones((md.mesh.numberofvertices,1))    #to have the same B as the analytical solution 
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
++#Damage
++md.damage.isdamage=0
++
+ print "      creating surface mass balance"
+ smb_max=0.5    #m/yr
+ sb=10**-2/1000.    #m/yr/m
+Index: ../trunk-jpl/test/Par/ISMIPB.py
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPB.py	(revision 17766)
++++ ../trunk-jpl/test/Par/ISMIPB.py	(revision 17767)
+@@ -18,6 +18,9 @@
+ md.materials.rheology_B=6.8067*10**7*numpy.ones((md.mesh.numberofvertices,1))
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
++#Damage
++md.damage.isdamage=0
++
+ print "      boundary conditions for stressbalance model"
+ #Create node on boundary first (because we cannot use mesh)
+ md=SetIceSheetBC(md)
+Index: ../trunk-jpl/test/Par/ISMIPD.py
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPD.py	(revision 17766)
++++ ../trunk-jpl/test/Par/ISMIPD.py	(revision 17767)
+@@ -18,6 +18,9 @@
+ md.materials.rheology_B=6.8067*10**7*numpy.ones((md.mesh.numberofvertices,1))
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
++#Damage
++md.damage.isdamage=0
++
+ print "      boundary conditions for stressbalance model:"
+ #Create node on boundary first (because we can not use mesh)
+ md=SetIceSheetBC(md)
+Index: ../trunk-jpl/test/Par/ISMIPF.py
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPF.py	(revision 17766)
++++ ../trunk-jpl/test/Par/ISMIPF.py	(revision 17767)
+@@ -20,6 +20,9 @@
+ md.materials.rheology_n=1.*numpy.ones((md.mesh.numberofelements,1))
+ md.materials.rheology_law='None'
+ 
++#Damage
++md.damage.isdamage=0
++
+ print "      boundary conditions for stressbalance model"
+ #Create node on boundary first (because we cannot use mesh)
+ md=SetIceSheetBC(md)
+Index: ../trunk-jpl/test/Par/GiaBenchmarksAB.par
+===================================================================
+--- ../trunk-jpl/test/Par/GiaBenchmarksAB.par	(revision 17766)
++++ ../trunk-jpl/test/Par/GiaBenchmarksAB.par	(revision 17767)
+@@ -43,6 +43,9 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
++%Damage
++md.damage.isdamage=0;
++
+ %Friction
+ md.friction.coefficient=20.*ones(md.mesh.numberofvertices,1);
+ md.friction.coefficient(find(md.mask.groundedice_levelset<0.))=0.;
+Index: ../trunk-jpl/test/Par/RoundSheetShelf.par
+===================================================================
+--- ../trunk-jpl/test/Par/RoundSheetShelf.par	(revision 17766)
++++ ../trunk-jpl/test/Par/RoundSheetShelf.par	(revision 17767)
+@@ -60,6 +60,9 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
++%Damage
++md.damage.isdamage=0;
++
+ %Surface mass balance and basal melting
+ md.surfaceforcings.mass_balance=-10.*ones(md.mesh.numberofvertices,1);
+ md.basalforcings.melting_rate=zeros(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/test/Par/SquareShelf2.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareShelf2.par	(revision 17766)
++++ ../trunk-jpl/test/Par/SquareShelf2.par	(revision 17767)
+@@ -28,6 +28,9 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
+ 
++%Damage
++md.damage.isdamage=0;
++
+ %Friction
+ md.friction.coefficient=20*ones(md.mesh.numberofvertices,1);
+ md.friction.coefficient(find(md.mask.groundedice_levelset<0.))=0.;
+Index: ../trunk-jpl/test/Par/ValleyGlacierShelf.par
+===================================================================
+--- ../trunk-jpl/test/Par/ValleyGlacierShelf.par	(revision 17766)
++++ ../trunk-jpl/test/Par/ValleyGlacierShelf.par	(revision 17767)
+@@ -40,6 +40,9 @@
+ md.materials.rheology_B = paterson(md.initialization.temperature);
+ md.materials.rheology_n = 3.*ones(md.mesh.numberofelements,1);
+ 
++%Damage
++md.damage.isdamage=0;
++
+ %Thermal
+ md.thermal.isenthalpy = 0;
+ md.thermal.spctemperature = NaN(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/test/Par/GiaBenchmarksCD.par
+===================================================================
+--- ../trunk-jpl/test/Par/GiaBenchmarksCD.par	(revision 17766)
++++ ../trunk-jpl/test/Par/GiaBenchmarksCD.par	(revision 17767)
+@@ -42,6 +42,9 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
++%Damage
++md.damage.isdamage=0;
++
+ %Friction
+ md.friction.coefficient=20.*ones(md.mesh.numberofvertices,1);
+ md.friction.coefficient(find(md.mask.groundedice_levelset<0.))=0.;
+Index: ../trunk-jpl/test/Par/ValleyGlacierShelf.py
+===================================================================
+--- ../trunk-jpl/test/Par/ValleyGlacierShelf.py	(revision 17766)
++++ ../trunk-jpl/test/Par/ValleyGlacierShelf.py	(revision 17767)
+@@ -47,6 +47,9 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature)
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
++#Damage
++md.damage.isdamage=0
++
+ #Thermal
+ md.thermal.isenthalpy=False
+ md.thermal.spctemperature=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
+Index: ../trunk-jpl/test/Par/SquareSheetShelf.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareSheetShelf.par	(revision 17766)
++++ ../trunk-jpl/test/Par/SquareSheetShelf.par	(revision 17767)
+@@ -31,6 +31,9 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
++%Damage
++md.damage.isdamage=0;
++
+ %Accumulation and melting
+ md.surfaceforcings.mass_balance=10.*ones(md.mesh.numberofvertices,1);
+ md.basalforcings.melting_rate=5.*ones(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/test/Par/SquareShelfConstrained.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareShelfConstrained.par	(revision 17766)
++++ ../trunk-jpl/test/Par/SquareShelfConstrained.par	(revision 17767)
+@@ -28,6 +28,9 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
+ 
++%Damage
++md.damage.isdamage=0;
++
+ %Surface mass balance and basal melting
+ md.surfaceforcings.mass_balance=10*ones(md.mesh.numberofvertices,1);
+ md.basalforcings.melting_rate=5*ones(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/test/Par/79North.py
+===================================================================
+--- ../trunk-jpl/test/Par/79North.py	(revision 17766)
++++ ../trunk-jpl/test/Par/79North.py	(revision 17767)
+@@ -32,6 +32,9 @@
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ md.initialization.temperature=md.initialization.temperature
+ 
++#Damage
++md.damage.isdamage=0
++
+ #Friction
+ md.friction.coefficient=50.*numpy.ones((md.mesh.numberofvertices,1))
+ md.friction.coefficient[numpy.nonzero(md.mask.groundedice_levelset<0.)[0]]=0.
+Index: ../trunk-jpl/test/Par/SquareSheetShelf.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareSheetShelf.py	(revision 17766)
++++ ../trunk-jpl/test/Par/SquareSheetShelf.py	(revision 17767)
+@@ -42,6 +42,9 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature)
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
++#Damage
++md.damage.isdamage=0
++
+ #Accumulation and melting
+ md.surfaceforcings.mass_balance=10.*numpy.ones((md.mesh.numberofvertices,1))
+ md.basalforcings.melting_rate=5.*numpy.ones((md.mesh.numberofvertices,1))
+Index: ../trunk-jpl/test/Par/SquareSheetConstrained.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareSheetConstrained.par	(revision 17766)
++++ ../trunk-jpl/test/Par/SquareSheetConstrained.par	(revision 17767)
+@@ -29,6 +29,9 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
++%Damage
++md.damage.isdamage=0;
++
+ md.masstransport.calvingrate=zeros(md.mesh.numberofvertices,1);
+ 
+ %Friction
+Index: ../trunk-jpl/test/Par/SquareShelf.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareShelf.py	(revision 17766)
++++ ../trunk-jpl/test/Par/SquareShelf.py	(revision 17767)
+@@ -58,6 +58,9 @@
+ md.materials.rheology_B = paterson(md.initialization.temperature)
+ md.materials.rheology_n = 3.*numpy.ones((md.mesh.numberofelements,1))
+ 
++#Damage
++md.damage.isdamage=0
++
+ #Friction
+ md.friction.coefficient = 20.*numpy.ones((md.mesh.numberofvertices,1))
+ md.friction.coefficient[numpy.nonzero(md.mask.groundedice_levelset<0.)[0]]=0.
+Index: ../trunk-jpl/test/Par/ISMIPA.py
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPA.py	(revision 17766)
++++ ../trunk-jpl/test/Par/ISMIPA.py	(revision 17767)
+@@ -18,6 +18,9 @@
+ md.materials.rheology_B=6.8067*10**7*numpy.ones((md.mesh.numberofvertices,1))
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
++#Damage
++md.damage.isdamage=0
++
+ print "      boundary conditions for stressbalance model"
+ #Create node on boundary first (because we cannot use mesh)
+ md=SetIceSheetBC(md)
+Index: ../trunk-jpl/test/Par/SquareSheetConstrained.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareSheetConstrained.py	(revision 17766)
++++ ../trunk-jpl/test/Par/SquareSheetConstrained.py	(revision 17767)
+@@ -39,6 +39,9 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature)
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
++#Damage
++md.damage.isdamage=0
++
+ #Masstransport
+ md.masstransport.calvingrate=0.*numpy.ones((md.mesh.numberofvertices,1))
+ 
+Index: ../trunk-jpl/test/Par/SquareEISMINT.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareEISMINT.par	(revision 17766)
++++ ../trunk-jpl/test/Par/SquareEISMINT.par	(revision 17767)
+@@ -25,6 +25,9 @@
+ md.materials.rheology_B=1.7687*10^8*ones(md.mesh.numberofvertices,1);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
++%Damage
++md.damage.isdamage=0;
++
+ disp('      creating surface mass balance');
+ md.surfaceforcings.mass_balance=0.2*ones(md.mesh.numberofvertices,1); %0m/a
+ md.basalforcings.melting_rate=0.*ones(md.mesh.numberofvertices,1); %0m/a
+Index: ../trunk-jpl/test/Par/ISMIPC.py
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPC.py	(revision 17766)
++++ ../trunk-jpl/test/Par/ISMIPC.py	(revision 17767)
+@@ -19,6 +19,9 @@
+ md.materials.rheology_B=6.8067*10**7*numpy.ones((md.mesh.numberofvertices,1))
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
++#Damage
++md.damage.isdamage=0
++
+ print "      boundary conditions for stressbalance model:"
+ #Create node on boundary first (because we can not use mesh)
+ md=SetIceSheetBC(md)
+Index: ../trunk-jpl/test/Par/ISMIPE.py
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPE.py	(revision 17766)
++++ ../trunk-jpl/test/Par/ISMIPE.py	(revision 17767)
+@@ -30,6 +30,9 @@
+ md.materials.rheology_B=6.8067*10**7*numpy.ones((md.mesh.numberofvertices,1))
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
++#Damage
++md.damage.isdamage=0
++
+ print "      boundary conditions for stressbalance model:"
+ #Create node on boundary first (because we can not use mesh)
+ md=SetIceSheetBC(md)
Index: issm/oecreview/Archive/16554-17801/ISSM-17767-17768.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17767-17768.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17767-17768.diff	(revision 17802)
@@ -0,0 +1,60 @@
+Index: ../trunk-jpl/src/m/classes/damage.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/damage.m	(revision 17767)
++++ ../trunk-jpl/src/m/classes/damage.m	(revision 17768)
+@@ -6,6 +6,7 @@
+ classdef damage
+ 	properties (SetAccess=public)  
+ 		%damage 
++		isdamage            = NaN;
+ 		D                   = NaN;
+ 		law                 = '';
+ 		spcdamage           = NaN; 
+@@ -99,6 +100,7 @@
+ 		function obj = setdefaultparameters(obj) % {{{
+ 
+ 			%damage parameters: 
++			obj.isdamage=false;
+ 			obj.D=0;
+ 			obj.law='undamaged';
+ 			
+@@ -137,11 +139,12 @@
+ 		end % }}}
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+ 			
+-			md = checkfield(md,'fieldname','damage.law','values',{'undamaged','pralong'});
+-			if ~strcmpi(obj.law,'undamaged'),
++			md = checkfield(md,'fieldname','damage.isdamage','values',[1,0]);
++			if obj.isdamage,
++				md = checkfield(md,'fieldname','damage.law','values',{'undamaged','pralong'});
+ 				md = checkfield(md,'fieldname','damage.D','>=',0,'<=',obj.max_damage,'size',[md.mesh.numberofvertices 1]);
++				md = checkfield(md,'fieldname','damage.spcdamage','forcing',1);
+ 				md = checkfield(md,'fieldname','damage.max_damage','<',1,'>=',0);
+-				md = checkfield(md,'fieldname','damage.spcdamage','forcing',1);
+ 				
+ 				md = checkfield(md,'fieldname','damage.stabilization','numel',[1],'values',[0 1 2]);
+ 				md = checkfield(md,'fieldname','damage.maxiter','>=0',0);
+@@ -180,8 +183,9 @@
+ 		function disp(obj) % {{{
+ 			disp(sprintf('   Damage:\n'));
+ 
+-			fielddisplay(obj,'law','damage law (string) from {''undamaged'',''pralong''}');
+-			if ~strcmpi(obj.law,'undamaged'),
++			fielddisplay(obj,'isdamage','is damage mechanics being used? {true,false}');
++			if obj.isdamage,
++				fielddisplay(obj,'law','damage law (string) from {''undamaged'',''pralong''}');
+ 				fielddisplay(obj,'D','damage tensor (scalar)');
+ 				fielddisplay(obj,'spcdamage','damage constraints (NaN means no constraint)');
+ 				fielddisplay(obj,'max_damage','maximum possible damage (0<=max_damage<1)');
+@@ -208,8 +212,9 @@
+ 		end % }}}
+ 		function marshall(obj,md,fid) % {{{
+ 		
+-			WriteData(fid,'object',obj,'fieldname','law','format','String');
+-			if ~strcmpi(obj.law,'undamaged'),
++			WriteData(fid,'object',obj,'fieldname','isdamage','format','Boolean');
++			if obj.isdamage,
++				WriteData(fid,'object',obj,'fieldname','law','format','String');
+ 				WriteData(fid,'object',obj,'fieldname','D','format','DoubleMat','mattype',1);
+ 				WriteData(fid,'object',obj,'fieldname','spcdamage','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
+ 				WriteData(fid,'object',obj,'fieldname','max_damage','format','Double');
Index: issm/oecreview/Archive/16554-17801/ISSM-17768-17769.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17768-17769.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17768-17769.diff	(revision 17802)
@@ -0,0 +1,581 @@
+Index: ../trunk-jpl/test/Par/SquareEISMINT.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareEISMINT.py	(revision 17768)
++++ ../trunk-jpl/test/Par/SquareEISMINT.py	(revision 17769)
+@@ -28,9 +28,6 @@
+ md.materials.rheology_B=1.7687*10**8*numpy.ones((md.mesh.numberofvertices,1))
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.isdamage=0
+-
+ print "      creating surface mass balance"
+ md.surfaceforcings.mass_balance=0.2*numpy.ones((md.mesh.numberofvertices,1))    #0m/a
+ md.basalforcings.melting_rate=0.*numpy.ones((md.mesh.numberofvertices,1))    #0m/a
+Index: ../trunk-jpl/test/Par/RoundSheetShelf.py
+===================================================================
+--- ../trunk-jpl/test/Par/RoundSheetShelf.py	(revision 17768)
++++ ../trunk-jpl/test/Par/RoundSheetShelf.py	(revision 17769)
+@@ -67,9 +67,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature)
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.isdamage=0
+-
+ #Surface mass balance and basal melting
+ md.surfaceforcings.mass_balance=-10.*numpy.ones((md.mesh.numberofvertices,1))
+ md.basalforcings.melting_rate=numpy.zeros((md.mesh.numberofvertices,1))
+Index: ../trunk-jpl/test/Par/RoundSheetEISMINT.par
+===================================================================
+--- ../trunk-jpl/test/Par/RoundSheetEISMINT.par	(revision 17768)
++++ ../trunk-jpl/test/Par/RoundSheetEISMINT.par	(revision 17769)
+@@ -20,9 +20,6 @@
+ md.materials.rheology_B=6.81*10^7*ones(md.mesh.numberofvertices,1); %to have the same B as the analytical solution 
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.isdamage=0;
+-
+ disp('      creating surface mass balance');
+ smb_max=0.5; %m/yr
+ sb=10^-2/1000.; %m/yr/m
+Index: ../trunk-jpl/test/Par/79North.par
+===================================================================
+--- ../trunk-jpl/test/Par/79North.par	(revision 17768)
++++ ../trunk-jpl/test/Par/79North.par	(revision 17769)
+@@ -20,9 +20,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.isdamage=0;
+-
+ %Friction
+ md.friction.coefficient=50.*ones(md.mesh.numberofvertices,1);
+ md.friction.coefficient(find(md.mask.groundedice_levelset<0.))=0.;
+Index: ../trunk-jpl/test/Par/SquareShelf2.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareShelf2.py	(revision 17768)
++++ ../trunk-jpl/test/Par/SquareShelf2.py	(revision 17769)
+@@ -58,9 +58,6 @@
+ md.materials.rheology_B = paterson(md.initialization.temperature)
+ md.materials.rheology_n = 3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.isdamage=0
+-
+ #Friction
+ md.friction.coefficient = 20.*numpy.ones((md.mesh.numberofvertices,1))
+ md.friction.coefficient[numpy.nonzero(md.mask.groundedice_levelset<0.)[0]]=0.
+Index: ../trunk-jpl/test/Par/SquareThermal.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareThermal.par	(revision 17768)
++++ ../trunk-jpl/test/Par/SquareThermal.par	(revision 17769)
+@@ -26,9 +26,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.isdamage=0;
+-
+ disp('      creating surface mass balance');
+ md.surfaceforcings.mass_balance=ones(md.mesh.numberofvertices,1)/md.constants.yts; %1m/a
+ md.basalforcings.melting_rate=0.*ones(md.mesh.numberofvertices,1)/md.constants.yts; %1m/a
+Index: ../trunk-jpl/test/Par/RoundSheetEISMINT.py
+===================================================================
+--- ../trunk-jpl/test/Par/RoundSheetEISMINT.py	(revision 17768)
++++ ../trunk-jpl/test/Par/RoundSheetEISMINT.py	(revision 17769)
+@@ -23,9 +23,6 @@
+ md.materials.rheology_B=6.81*10**7*numpy.ones((md.mesh.numberofvertices,1))    #to have the same B as the analytical solution 
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.isdamage=0
+-
+ print "      creating surface mass balance"
+ smb_max=0.5    #m/yr
+ sb=10**-2/1000.    #m/yr/m
+Index: ../trunk-jpl/test/Par/Pig.par
+===================================================================
+--- ../trunk-jpl/test/Par/Pig.par	(revision 17768)
++++ ../trunk-jpl/test/Par/Pig.par	(revision 17769)
+@@ -25,9 +25,6 @@
+ md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
+ md.initialization.temperature=md.initialization.temperature;
+ 
+-%Damage
+-md.damage.isdamage=0;
+-
+ %Friction
+ md.friction.coefficient=50*ones(md.mesh.numberofvertices,1);
+ md.friction.coefficient(find(md.mask.groundedice_levelset<0.))=0.;
+Index: ../trunk-jpl/test/Par/RoundSheetStaticEISMINT.par
+===================================================================
+--- ../trunk-jpl/test/Par/RoundSheetStaticEISMINT.par	(revision 17768)
++++ ../trunk-jpl/test/Par/RoundSheetStaticEISMINT.par	(revision 17769)
+@@ -24,9 +24,6 @@
+ md.materials.rheology_B=6.81*10^7*ones(md.mesh.numberofvertices,1); %to have the same B as the analytical solution 
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.isdamage=0;
+-
+ disp('      creating surface mass balance');
+ smb_max=0.5; %m/yr
+ sb=10^-2/1000.; %m/yr/m
+Index: ../trunk-jpl/test/Par/SquareShelf.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareShelf.par	(revision 17768)
++++ ../trunk-jpl/test/Par/SquareShelf.par	(revision 17769)
+@@ -28,9 +28,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.isdamage=0;
+-
+ %Friction
+ md.friction.coefficient=20*ones(md.mesh.numberofvertices,1);
+ md.friction.coefficient(find(md.mask.groundedice_levelset<0.))=0.;
+Index: ../trunk-jpl/test/Par/ISMIPA.par
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPA.par	(revision 17768)
++++ ../trunk-jpl/test/Par/ISMIPA.par	(revision 17769)
+@@ -15,9 +15,6 @@
+ md.materials.rheology_B=6.8067*10^7*ones(md.mesh.numberofvertices,1);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.isdamage=0;
+-
+ disp('      boundary conditions for stressbalance model');
+ %Create node on boundary first (because we cannot use mesh)
+ md=SetIceSheetBC(md);
+Index: ../trunk-jpl/test/Par/SquareShelfConstrained.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareShelfConstrained.py	(revision 17768)
++++ ../trunk-jpl/test/Par/SquareShelfConstrained.py	(revision 17769)
+@@ -39,9 +39,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature)
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.isdamage=0
+-
+ #Surface mass balance and basal melting
+ md.surfaceforcings.mass_balance=10.*numpy.ones((md.mesh.numberofvertices,1))
+ md.basalforcings.melting_rate=5.*numpy.ones((md.mesh.numberofvertices,1))
+Index: ../trunk-jpl/test/Par/ISMIPB.par
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPB.par	(revision 17768)
++++ ../trunk-jpl/test/Par/ISMIPB.par	(revision 17769)
+@@ -15,9 +15,6 @@
+ md.materials.rheology_B=6.8067*10^7*ones(md.mesh.numberofvertices,1);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.isdamage=0;
+-
+ disp('      boundary conditions for stressbalance model');
+ %Create node on boundary first (because we cannot use mesh)
+ md=SetIceSheetBC(md);
+Index: ../trunk-jpl/test/Par/SquareThermal.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareThermal.py	(revision 17768)
++++ ../trunk-jpl/test/Par/SquareThermal.py	(revision 17769)
+@@ -30,9 +30,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature)
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.isdamage=0
+-
+ print "      creating surface mass balance"
+ md.surfaceforcings.mass_balance=numpy.ones((md.mesh.numberofvertices,1))/md.constants.yts    #1m/a
+ md.basalforcings.melting_rate=0.*numpy.ones((md.mesh.numberofvertices,1))/md.constants.yts    #1m/a
+Index: ../trunk-jpl/test/Par/ISMIPC.par
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPC.par	(revision 17768)
++++ ../trunk-jpl/test/Par/ISMIPC.par	(revision 17769)
+@@ -16,9 +16,6 @@
+ md.materials.rheology_B=6.8067*10^7*ones(md.mesh.numberofvertices,1);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.isdamage=0;
+-
+ disp('      boundary conditions for stressbalance model:');
+ %Create node on boundary first (because we can not use mesh)
+ md=SetIceSheetBC(md);
+Index: ../trunk-jpl/test/Par/ISMIPD.par
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPD.par	(revision 17768)
++++ ../trunk-jpl/test/Par/ISMIPD.par	(revision 17769)
+@@ -15,9 +15,6 @@
+ md.materials.rheology_B=6.8067*10^7*ones(md.mesh.numberofvertices,1);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.isdamage=0;
+-
+ disp('      boundary conditions for stressbalance model:');
+ %Create node on boundary first (because we can not use mesh)
+ md=SetIceSheetBC(md);
+Index: ../trunk-jpl/test/Par/Pig.py
+===================================================================
+--- ../trunk-jpl/test/Par/Pig.py	(revision 17768)
++++ ../trunk-jpl/test/Par/Pig.py	(revision 17769)
+@@ -36,9 +36,6 @@
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ md.initialization.temperature=md.initialization.temperature
+ 
+-#Damage
+-md.damage.isdamage=0
+-
+ #Friction
+ md.friction.coefficient=50.*numpy.ones((md.mesh.numberofvertices,1))
+ md.friction.coefficient[numpy.nonzero(md.mask.groundedice_levelset<0.)[0]]=0.
+Index: ../trunk-jpl/test/Par/ISMIPE.par
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPE.par	(revision 17768)
++++ ../trunk-jpl/test/Par/ISMIPE.par	(revision 17769)
+@@ -25,9 +25,6 @@
+ md.materials.rheology_B=6.8067*10^7*ones(md.mesh.numberofvertices,1);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.isdamage=0;
+-
+ disp('      boundary conditions for stressbalance model:');
+ %Create node on boundary first (because we can not use mesh)
+ md=SetIceSheetBC(md);
+Index: ../trunk-jpl/test/Par/ISMIPF.par
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPF.par	(revision 17768)
++++ ../trunk-jpl/test/Par/ISMIPF.par	(revision 17769)
+@@ -17,9 +17,6 @@
+ md.materials.rheology_n=1.*ones(md.mesh.numberofelements,1);
+ md.materials.rheology_law='None';
+ 
+-%Damage
+-md.damage.isdamage=0;
+-
+ disp('      boundary conditions for stressbalance model');
+ %Create node on boundary first (because we cannot use mesh)
+ md=SetIceSheetBC(md);
+Index: ../trunk-jpl/test/Par/RoundSheetStaticEISMINT.py
+===================================================================
+--- ../trunk-jpl/test/Par/RoundSheetStaticEISMINT.py	(revision 17768)
++++ ../trunk-jpl/test/Par/RoundSheetStaticEISMINT.py	(revision 17769)
+@@ -27,9 +27,6 @@
+ md.materials.rheology_B=6.81*10**7*numpy.ones((md.mesh.numberofvertices,1))    #to have the same B as the analytical solution 
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.isdamage=0
+-
+ print "      creating surface mass balance"
+ smb_max=0.5    #m/yr
+ sb=10**-2/1000.    #m/yr/m
+Index: ../trunk-jpl/test/Par/ISMIPB.py
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPB.py	(revision 17768)
++++ ../trunk-jpl/test/Par/ISMIPB.py	(revision 17769)
+@@ -18,9 +18,6 @@
+ md.materials.rheology_B=6.8067*10**7*numpy.ones((md.mesh.numberofvertices,1))
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.isdamage=0
+-
+ print "      boundary conditions for stressbalance model"
+ #Create node on boundary first (because we cannot use mesh)
+ md=SetIceSheetBC(md)
+Index: ../trunk-jpl/test/Par/ISMIPD.py
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPD.py	(revision 17768)
++++ ../trunk-jpl/test/Par/ISMIPD.py	(revision 17769)
+@@ -18,9 +18,6 @@
+ md.materials.rheology_B=6.8067*10**7*numpy.ones((md.mesh.numberofvertices,1))
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.isdamage=0
+-
+ print "      boundary conditions for stressbalance model:"
+ #Create node on boundary first (because we can not use mesh)
+ md=SetIceSheetBC(md)
+Index: ../trunk-jpl/test/Par/ISMIPF.py
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPF.py	(revision 17768)
++++ ../trunk-jpl/test/Par/ISMIPF.py	(revision 17769)
+@@ -20,9 +20,6 @@
+ md.materials.rheology_n=1.*numpy.ones((md.mesh.numberofelements,1))
+ md.materials.rheology_law='None'
+ 
+-#Damage
+-md.damage.isdamage=0
+-
+ print "      boundary conditions for stressbalance model"
+ #Create node on boundary first (because we cannot use mesh)
+ md=SetIceSheetBC(md)
+Index: ../trunk-jpl/test/Par/GiaBenchmarksAB.par
+===================================================================
+--- ../trunk-jpl/test/Par/GiaBenchmarksAB.par	(revision 17768)
++++ ../trunk-jpl/test/Par/GiaBenchmarksAB.par	(revision 17769)
+@@ -43,9 +43,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.isdamage=0;
+-
+ %Friction
+ md.friction.coefficient=20.*ones(md.mesh.numberofvertices,1);
+ md.friction.coefficient(find(md.mask.groundedice_levelset<0.))=0.;
+Index: ../trunk-jpl/test/Par/RoundSheetShelf.par
+===================================================================
+--- ../trunk-jpl/test/Par/RoundSheetShelf.par	(revision 17768)
++++ ../trunk-jpl/test/Par/RoundSheetShelf.par	(revision 17769)
+@@ -60,9 +60,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.isdamage=0;
+-
+ %Surface mass balance and basal melting
+ md.surfaceforcings.mass_balance=-10.*ones(md.mesh.numberofvertices,1);
+ md.basalforcings.melting_rate=zeros(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/test/Par/SquareShelf2.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareShelf2.par	(revision 17768)
++++ ../trunk-jpl/test/Par/SquareShelf2.par	(revision 17769)
+@@ -28,9 +28,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.isdamage=0;
+-
+ %Friction
+ md.friction.coefficient=20*ones(md.mesh.numberofvertices,1);
+ md.friction.coefficient(find(md.mask.groundedice_levelset<0.))=0.;
+Index: ../trunk-jpl/test/Par/ValleyGlacierShelf.par
+===================================================================
+--- ../trunk-jpl/test/Par/ValleyGlacierShelf.par	(revision 17768)
++++ ../trunk-jpl/test/Par/ValleyGlacierShelf.par	(revision 17769)
+@@ -40,9 +40,6 @@
+ md.materials.rheology_B = paterson(md.initialization.temperature);
+ md.materials.rheology_n = 3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.isdamage=0;
+-
+ %Thermal
+ md.thermal.isenthalpy = 0;
+ md.thermal.spctemperature = NaN(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/test/Par/GiaBenchmarksCD.par
+===================================================================
+--- ../trunk-jpl/test/Par/GiaBenchmarksCD.par	(revision 17768)
++++ ../trunk-jpl/test/Par/GiaBenchmarksCD.par	(revision 17769)
+@@ -42,9 +42,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.isdamage=0;
+-
+ %Friction
+ md.friction.coefficient=20.*ones(md.mesh.numberofvertices,1);
+ md.friction.coefficient(find(md.mask.groundedice_levelset<0.))=0.;
+Index: ../trunk-jpl/test/Par/ValleyGlacierShelf.py
+===================================================================
+--- ../trunk-jpl/test/Par/ValleyGlacierShelf.py	(revision 17768)
++++ ../trunk-jpl/test/Par/ValleyGlacierShelf.py	(revision 17769)
+@@ -47,9 +47,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature)
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.isdamage=0
+-
+ #Thermal
+ md.thermal.isenthalpy=False
+ md.thermal.spctemperature=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
+Index: ../trunk-jpl/test/Par/SquareSheetShelf.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareSheetShelf.par	(revision 17768)
++++ ../trunk-jpl/test/Par/SquareSheetShelf.par	(revision 17769)
+@@ -31,9 +31,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.isdamage=0;
+-
+ %Accumulation and melting
+ md.surfaceforcings.mass_balance=10.*ones(md.mesh.numberofvertices,1);
+ md.basalforcings.melting_rate=5.*ones(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/test/Par/SquareShelfConstrained.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareShelfConstrained.par	(revision 17768)
++++ ../trunk-jpl/test/Par/SquareShelfConstrained.par	(revision 17769)
+@@ -28,9 +28,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.isdamage=0;
+-
+ %Surface mass balance and basal melting
+ md.surfaceforcings.mass_balance=10*ones(md.mesh.numberofvertices,1);
+ md.basalforcings.melting_rate=5*ones(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/test/Par/79North.py
+===================================================================
+--- ../trunk-jpl/test/Par/79North.py	(revision 17768)
++++ ../trunk-jpl/test/Par/79North.py	(revision 17769)
+@@ -32,9 +32,6 @@
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ md.initialization.temperature=md.initialization.temperature
+ 
+-#Damage
+-md.damage.isdamage=0
+-
+ #Friction
+ md.friction.coefficient=50.*numpy.ones((md.mesh.numberofvertices,1))
+ md.friction.coefficient[numpy.nonzero(md.mask.groundedice_levelset<0.)[0]]=0.
+Index: ../trunk-jpl/test/Par/SquareSheetShelf.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareSheetShelf.py	(revision 17768)
++++ ../trunk-jpl/test/Par/SquareSheetShelf.py	(revision 17769)
+@@ -42,9 +42,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature)
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.isdamage=0
+-
+ #Accumulation and melting
+ md.surfaceforcings.mass_balance=10.*numpy.ones((md.mesh.numberofvertices,1))
+ md.basalforcings.melting_rate=5.*numpy.ones((md.mesh.numberofvertices,1))
+Index: ../trunk-jpl/test/Par/SquareSheetConstrained.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareSheetConstrained.par	(revision 17768)
++++ ../trunk-jpl/test/Par/SquareSheetConstrained.par	(revision 17769)
+@@ -29,9 +29,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.isdamage=0;
+-
+ md.masstransport.calvingrate=zeros(md.mesh.numberofvertices,1);
+ 
+ %Friction
+Index: ../trunk-jpl/test/Par/SquareShelf.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareShelf.py	(revision 17768)
++++ ../trunk-jpl/test/Par/SquareShelf.py	(revision 17769)
+@@ -58,9 +58,6 @@
+ md.materials.rheology_B = paterson(md.initialization.temperature)
+ md.materials.rheology_n = 3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.isdamage=0
+-
+ #Friction
+ md.friction.coefficient = 20.*numpy.ones((md.mesh.numberofvertices,1))
+ md.friction.coefficient[numpy.nonzero(md.mask.groundedice_levelset<0.)[0]]=0.
+Index: ../trunk-jpl/test/Par/ISMIPA.py
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPA.py	(revision 17768)
++++ ../trunk-jpl/test/Par/ISMIPA.py	(revision 17769)
+@@ -18,9 +18,6 @@
+ md.materials.rheology_B=6.8067*10**7*numpy.ones((md.mesh.numberofvertices,1))
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.isdamage=0
+-
+ print "      boundary conditions for stressbalance model"
+ #Create node on boundary first (because we cannot use mesh)
+ md=SetIceSheetBC(md)
+Index: ../trunk-jpl/test/Par/SquareSheetConstrained.py
+===================================================================
+--- ../trunk-jpl/test/Par/SquareSheetConstrained.py	(revision 17768)
++++ ../trunk-jpl/test/Par/SquareSheetConstrained.py	(revision 17769)
+@@ -39,9 +39,6 @@
+ md.materials.rheology_B=paterson(md.initialization.temperature)
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.isdamage=0
+-
+ #Masstransport
+ md.masstransport.calvingrate=0.*numpy.ones((md.mesh.numberofvertices,1))
+ 
+Index: ../trunk-jpl/test/Par/SquareEISMINT.par
+===================================================================
+--- ../trunk-jpl/test/Par/SquareEISMINT.par	(revision 17768)
++++ ../trunk-jpl/test/Par/SquareEISMINT.par	(revision 17769)
+@@ -25,9 +25,6 @@
+ md.materials.rheology_B=1.7687*10^8*ones(md.mesh.numberofvertices,1);
+ md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
+ 
+-%Damage
+-md.damage.isdamage=0;
+-
+ disp('      creating surface mass balance');
+ md.surfaceforcings.mass_balance=0.2*ones(md.mesh.numberofvertices,1); %0m/a
+ md.basalforcings.melting_rate=0.*ones(md.mesh.numberofvertices,1); %0m/a
+Index: ../trunk-jpl/test/Par/ISMIPC.py
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPC.py	(revision 17768)
++++ ../trunk-jpl/test/Par/ISMIPC.py	(revision 17769)
+@@ -19,9 +19,6 @@
+ md.materials.rheology_B=6.8067*10**7*numpy.ones((md.mesh.numberofvertices,1))
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.isdamage=0
+-
+ print "      boundary conditions for stressbalance model:"
+ #Create node on boundary first (because we can not use mesh)
+ md=SetIceSheetBC(md)
+Index: ../trunk-jpl/test/Par/ISMIPE.py
+===================================================================
+--- ../trunk-jpl/test/Par/ISMIPE.py	(revision 17768)
++++ ../trunk-jpl/test/Par/ISMIPE.py	(revision 17769)
+@@ -30,9 +30,6 @@
+ md.materials.rheology_B=6.8067*10**7*numpy.ones((md.mesh.numberofvertices,1))
+ md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
+ 
+-#Damage
+-md.damage.isdamage=0
+-
+ print "      boundary conditions for stressbalance model:"
+ #Create node on boundary first (because we can not use mesh)
+ md=SetIceSheetBC(md)
+Index: ../trunk-jpl/test/NightlyRun/test271.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test271.m	(revision 17768)
++++ ../trunk-jpl/test/NightlyRun/test271.m	(revision 17769)
+@@ -14,14 +14,14 @@
+ md.damage.spcdamage(pos)=0.5;
+ md.damage.stabilization=1;
+ 
+-md.damage.requested_outputs={'default','DamageF'}
++md.damage.requested_outputs={'default','DamageF'};
+ 
+ md=setflowequation(md,'SSA','all');
+ md.cluster=generic('name',oshostname(),'np',3);
+ md=solve(md,DamageEvolutionSolutionEnum());
+ 
+ %Fields and tolerances to track changes
+-field_names={'D','F'}
++field_names={'D','F'};
+ field_tolerances={1e-13,1e-13};
+ field_values={...
+ 		(md.results.DamageEvolutionSolution.DamageDbar),...
Index: issm/oecreview/Archive/16554-17801/ISSM-17769-17770.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17769-17770.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17769-17770.diff	(revision 17802)
@@ -0,0 +1,11 @@
+Index: ../trunk-jpl/test/NightlyRun/test270.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test270.m	(revision 17769)
++++ ../trunk-jpl/test/NightlyRun/test270.m	(revision 17770)
+@@ -1,5 +1,6 @@
+ md=triangle(model(),'../Exp/Square.exp',150000.);
+ md=setmask(md,'all','');
++md.materials=matdamageice();
+ md=parameterize(md,'../Par/SquareShelf.par');
+ md.damage.isdamage=1;
+ md.damage.D=0.5*ones(md.mesh.numberofvertices,1);
Index: issm/oecreview/Archive/16554-17801/ISSM-17770-17771.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17770-17771.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17770-17771.diff	(revision 17802)
@@ -0,0 +1,22 @@
+Index: ../trunk-jpl/src/m/classes/damage.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/damage.m	(revision 17770)
++++ ../trunk-jpl/src/m/classes/damage.m	(revision 17771)
+@@ -100,7 +100,7 @@
+ 		function obj = setdefaultparameters(obj) % {{{
+ 
+ 			%damage parameters: 
+-			obj.isdamage=false;
++			obj.isdamage=0;
+ 			obj.D=0;
+ 			obj.law='undamaged';
+ 			
+@@ -244,7 +244,7 @@
+ 				outputs(pos) = [];                         %remove 'default' from outputs
+ 				outputs      = [outputs defaultoutputs(obj,md)]; %add defaults
+ 			end
+-			if ~strcmpi(obj.law,'undamaged'),
++			if obj.isdamage,
+ 				WriteData(fid,'data',outputs,'enum',DamageEvolutionRequestedOutputsEnum,'format','StringArray');
+ 			end
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17771-17772.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17771-17772.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17771-17772.diff	(revision 17802)
@@ -0,0 +1,36 @@
+Index: ../trunk-jpl/test/NightlyRun/test274.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test274.py	(revision 17771)
++++ ../trunk-jpl/test/NightlyRun/test274.py	(revision 17772)
+@@ -9,6 +9,7 @@
+ from socket import gethostname as oshostname
+ from matdamageice import matdamageice
+ from meshprocessrifts import meshprocessrifts
++from generic import generic
+ 
+ md=triangle(model(),'../Exp/SquareHole.exp','../Exp/Rifts.exp',50000.)
+ md=meshprocessrifts(md,'../Exp/Square.exp')
+Index: ../trunk-jpl/test/NightlyRun/test275.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test275.py	(revision 17771)
++++ ../trunk-jpl/test/NightlyRun/test275.py	(revision 17772)
+@@ -9,6 +9,7 @@
+ from socket import gethostname as oshostname
+ from solve import solve
+ from EnumDefinitions import DamageEvolutionSolutionEnum
++from matdamageice import matdamageice
+ 
+ md=triangle(model(),'../Exp/Square.exp',150000.)
+ md=setmask(md,'all','')
+Index: ../trunk-jpl/test/NightlyRun/test272.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test272.py	(revision 17771)
++++ ../trunk-jpl/test/NightlyRun/test272.py	(revision 17772)
+@@ -8,6 +8,7 @@
+ from solve import solve
+ from socket import gethostname as oshostname
+ from matdamageice import matdamageice
++from generic import generic
+ 
+ md=triangle(model(),'../Exp/Square.exp',150000.)
+ md=setmask(md,'all','')
Index: issm/oecreview/Archive/16554-17801/ISSM-17772-17773.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17772-17773.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17772-17773.diff	(revision 17802)
@@ -0,0 +1,27 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17772)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17773)
+@@ -127,7 +127,7 @@
+ void Tetra::FaceOnSurfaceIndices(int* pindex1,int* pindex2,int* pindex3){
+ 
+ 	IssmDouble values[NUMVERTICES];
+-	int        indices[4][3] = {{0,1,2},{0,1,3},{1,2,3},{2,0,3}};
++	int        indices[4][3] = {{0,1,2},{0,3,1},{1,3,2},{0,2,3}};
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	GetInputListOnVertices(&values[0],MeshVertexonsurfaceEnum);
+@@ -144,11 +144,11 @@
+ 	_error_("Could not find 3 vertices on bed");
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::FaceOnFranceIndices{{{*/
++/*FUNCTION Tetra::FaceOnFrontIndices{{{*/
+ void Tetra::FaceOnFrontIndices(int* pindex1,int* pindex2,int* pindex3){
+ 
+ 	IssmDouble values[NUMVERTICES];
+-	int        indices[4][3] = {{0,1,2},{0,1,3},{1,2,3},{2,0,3}};
++	int        indices[4][3] = {{0,1,2},{0,3,1},{1,3,2},{0,2,3}};
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	GetInputListOnVertices(&values[0],MaskIceLevelsetEnum);
Index: issm/oecreview/Archive/16554-17801/ISSM-17773-17774.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17773-17774.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17773-17774.diff	(revision 17802)
@@ -0,0 +1,57 @@
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17773)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17774)
+@@ -1209,13 +1209,27 @@
+ 				else
+ 					error('Case not supported'); %not supposed to happen!
+ 				end
++				%Reorder elements to make sure they are direct
++				for j=1:3
++					element = elements(3*(i-1)+j,:);
++					matrix = [md.mesh.x(element), md.mesh.y(element), md.mesh.z(element), ones(4,1)];
++					if det(matrix)>0,
++						elements(3*(i-1)+j,1)=element(2);
++						elements(3*(i-1)+j,2)=element(1);
++					end
++				end
+ 			end
+ 			%%Split in 3 tetras
+ 			%subelement1 = [1 2 3 5];
+ 			%subelement2 = [4 6 5 1];
+ 			%subelement3 = [5 6 3 1];
+ 			%elements=[md.mesh.elements(:,subelement1);md.mesh.elements(:,subelement2);md.mesh.elements(:,subelement3)];
+-			disp([num2str(steiner) ' Steiner points had to be included'])
++			if steiner==0,
++				disp('No Steiner point required to split prismatic mesh into tets');
++			else
++				disp([num2str(steiner) ' Steiner points had to be included'])
++				error('Steiner point not supported yet');
++			end
+ 
+ 			pos_elements = repmat([1:md.mesh.numberofelements]',3,1);
+ 
+@@ -1223,8 +1237,10 @@
+ 			md.mesh.numberofelements=size(elements,1);
+ 
+ 			%p and q (same deal, except for element that are on the bedrock: )
+-			md.friction.p=md.friction.p(pos_elements);
+-			md.friction.q=md.friction.q(pos_elements);
++			if ~isnan(md.friction.p),
++				md.friction.p=md.friction.p(pos_elements);
++				md.friction.q=md.friction.q(pos_elements);
++			end
+ 
+ 			%elementstype
+ 			if ~isnan(md.flowequation.element_equation)
+@@ -1236,7 +1252,9 @@
+ 			md.mesh.elementconnectivity=NaN;
+ 
+ 			%materials
+-			md.materials.rheology_n=md.materials.rheology_n(pos_elements);
++			if ~isnan(md.materials.rheology_n),
++				md.materials.rheology_n=md.materials.rheology_n(pos_elements);
++			end
+ 
+ 			%increase connectivity if less than 25:
+ 			if md.mesh.average_vertex_connectivity<=25,
Index: issm/oecreview/Archive/16554-17801/ISSM-17774-17775.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17774-17775.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17774-17775.diff	(revision 17802)
@@ -0,0 +1,838 @@
+Index: ../trunk-jpl/m4/issm_options.m4
+===================================================================
+--- ../trunk-jpl/m4/issm_options.m4	(revision 17774)
++++ ../trunk-jpl/m4/issm_options.m4	(revision 17775)
+@@ -1602,413 +1602,8 @@
+ 		AM_CONDITIONAL([GIA], [test x$HAVE_GIA = xyes])
+ 		AC_MSG_RESULT($HAVE_GIA)
+ 		dnl }}}
+-	dnl with-AdjointBalancethickness{{{
+-	AC_ARG_WITH([AdjointBalancethickness],
+-		AS_HELP_STRING([--with-AdjointBalancethickness = YES], [compile with AdjointBalancethickness capabilities (default is yes)]),
+-		[ADJOINTBALANCETHICKNESS=$withval],[ADJOINTBALANCETHICKNESS=yes]) 
+-	AC_MSG_CHECKING(for AdjointBalancethickness capability compilation)
++	AX_ANALYSES_SELECTION
+ 
+-	HAVE_ADJOINTBALANCETHICKNESS=no
+-	if test "x$ADJOINTBALANCETHICKNESS" = "xyes"; then
+-		HAVE_ADJOINTBALANCETHICKNESS=yes
+-		AC_DEFINE([_HAVE_ADJOINTBALANCETHICKNESS_],[1],[with AdjointBalancethickness capability])
+-	fi
+-	AM_CONDITIONAL([ADJOINTBALANCETHICKNESS], [test x$HAVE_ADJOINTBALANCETHICKNESS = xyes])
+-	AC_MSG_RESULT($HAVE_ADJOINTBALANCETHICKNESS)
+-	dnl }}}
+-	dnl with-AdjointHoriz{{{
+-	AC_ARG_WITH([AdjointHoriz],
+-		AS_HELP_STRING([--with-AdjointHoriz = YES], [compile with AdjointHoriz capabilities (default is yes)]),
+-		[ADJOINTHORIZ=$withval],[ADJOINTHORIZ=yes]) 
+-	AC_MSG_CHECKING(for AdjointHoriz capability compilation)
+-
+-	HAVE_ADJOINTHORIZ=no
+-	if test "x$ADJOINTHORIZ" = "xyes"; then
+-		HAVE_ADJOINTHORIZ=yes
+-		AC_DEFINE([_HAVE_ADJOINTHORIZ_],[1],[with AdjointHoriz capability])
+-	fi
+-	AM_CONDITIONAL([ADJOINTHORIZ], [test x$HAVE_ADJOINTHORIZ = xyes])
+-	AC_MSG_RESULT($HAVE_ADJOINTHORIZ)
+-	dnl }}}
+-	dnl with-Balancethickness{{{
+-	AC_ARG_WITH([Balancethickness],
+-		AS_HELP_STRING([--with-Balancethickness = YES], [compile with Balancethickness capabilities (default is yes)]),
+-		[BALANCETHICKNESS=$withval],[BALANCETHICKNESS=yes]) 
+-	AC_MSG_CHECKING(for Balancethickness capability compilation)
+-
+-	HAVE_BALANCETHICKNESS=no
+-	if test "x$BALANCETHICKNESS" = "xyes"; then
+-		HAVE_BALANCETHICKNESS=yes
+-		AC_DEFINE([_HAVE_BALANCETHICKNESS_],[1],[with Balancethickness capability])
+-	fi
+-	AM_CONDITIONAL([BALANCETHICKNESS], [test x$HAVE_BALANCETHICKNESS = xyes])
+-	AC_MSG_RESULT($HAVE_BALANCETHICKNESS)
+-	dnl }}}
+-	dnl with-BalancethicknessSoft{{{
+-	AC_ARG_WITH([BalancethicknessSoft],
+-		AS_HELP_STRING([--with-BalancethicknessSoft = YES], [compile with BalancethicknessSoft capabilities (default is yes)]),
+-		[BALANCETHICKNESSSOFT=$withval],[BALANCETHICKNESSSOFT=yes]) 
+-	AC_MSG_CHECKING(for BalancethicknessSoft capability compilation)
+-
+-	HAVE_BALANCETHICKNESSSOFT=no
+-	if test "x$BALANCETHICKNESSSOFT" = "xyes"; then
+-		HAVE_BALANCETHICKNESSSOFT=yes
+-		AC_DEFINE([_HAVE_BALANCETHICKNESSSOFT_],[1],[with BalancethicknessSoft capability])
+-	fi
+-	AM_CONDITIONAL([BALANCETHICKNESSSOFT], [test x$HAVE_BALANCETHICKNESSSOFT = xyes])
+-	AC_MSG_RESULT($HAVE_BALANCETHICKNESSSOFT)
+-	dnl }}}
+-	dnl with-Balancevelocity{{{
+-	AC_ARG_WITH([Balancevelocity],
+-		AS_HELP_STRING([--with-Balancevelocity = YES], [compile with Balancevelocity capabilities (default is yes)]),
+-		[BALANCEVELOCITY=$withval],[BALANCEVELOCITY=yes]) 
+-	AC_MSG_CHECKING(for Balancevelocity capability compilation)
+-
+-	HAVE_BALANCEVELOCITY=no
+-	if test "x$BALANCEVELOCITY" = "xyes"; then
+-		HAVE_BALANCEVELOCITY=yes
+-		AC_DEFINE([_HAVE_BALANCEVELOCITY_],[1],[with Balancevelocity capability])
+-	fi
+-	AM_CONDITIONAL([BALANCEVELOCITY], [test x$HAVE_BALANCEVELOCITY = xyes])
+-	AC_MSG_RESULT($HAVE_BALANCEVELOCITY)
+-	dnl }}}
+-	dnl with-L2ProjectionEPL{{{
+-	AC_ARG_WITH([L2ProjectionEPL],
+-		AS_HELP_STRING([--with-L2ProjectionEPL = YES], [compile with L2ProjectionEPL capabilities (default is yes)]),
+-		[L2PROJECTIONEPL=$withval],[L2PROJECTIONEPL=yes]) 
+-	AC_MSG_CHECKING(for L2ProjectionEPL capability compilation)
+-
+-	HAVE_L2PROJECTIONEPL=no
+-	if test "x$L2PROJECTIONEPL" = "xyes"; then
+-		HAVE_L2PROJECTIONEPL=yes
+-		AC_DEFINE([_HAVE_L2PROJECTIONEPL_],[1],[with L2ProjectionEPL capability])
+-	fi
+-	AM_CONDITIONAL([L2PROJECTIONEPL], [test x$HAVE_L2PROJECTIONEPL = xyes])
+-	AC_MSG_RESULT($HAVE_L2PROJECTIONEPL)
+-	dnl }}}
+-	dnl with-L2ProjectionBase{{{
+-	AC_ARG_WITH([L2ProjectionBase],
+-		AS_HELP_STRING([--with-L2ProjectionBase = YES], [compile with L2ProjectionBase capabilities (default is yes)]),
+-		[L2PROJECTIONBASE=$withval],[L2PROJECTIONBASE=yes]) 
+-	AC_MSG_CHECKING(for L2ProjectionBase capability compilation)
+-
+-	HAVE_L2PROJECTIONBASE=no
+-	if test "x$L2PROJECTIONBASE" = "xyes"; then
+-		HAVE_L2PROJECTIONBASE=yes
+-		AC_DEFINE([_HAVE_L2PROJECTIONBASE_],[1],[with L2ProjectionBase capability])
+-	fi
+-	AM_CONDITIONAL([L2PROJECTIONBASE], [test x$HAVE_L2PROJECTIONBASE = xyes])
+-	AC_MSG_RESULT($HAVE_L2PROJECTIONBASE)
+-	dnl }}}
+-	dnl with-DamageEvolution{{{
+-	AC_ARG_WITH([DamageEvolution],
+-		AS_HELP_STRING([--with-DamageEvolution = YES], [compile with DamageEvolution capabilities (default is yes)]),
+-		[DAMAGEEVOLUTION=$withval],[DAMAGEEVOLUTION=yes]) 
+-	AC_MSG_CHECKING(for DamageEvolution capability compilation)
+-
+-	HAVE_DAMAGEEVOLUTION=no
+-	if test "x$DAMAGEEVOLUTION" = "xyes"; then
+-		HAVE_DAMAGEEVOLUTION=yes
+-		AC_DEFINE([_HAVE_DAMAGEEVOLUTION_],[1],[with DamageEvolution capability])
+-	fi
+-	AM_CONDITIONAL([DAMAGEEVOLUTION], [test x$HAVE_DAMAGEEVOLUTION = xyes])
+-	AC_MSG_RESULT($HAVE_DAMAGEEVOLUTION)
+-	dnl }}}
+-	dnl with-DepthAverage{{{
+-	AC_ARG_WITH([DepthAverage],
+-		AS_HELP_STRING([--with-DepthAverage = YES], [compile with DepthAverage capabilities (default is yes)]),
+-		[DEPTHAVERAGE=$withval],[DEPTHAVERAGE=yes]) 
+-	AC_MSG_CHECKING(for DepthAverage capability compilation)
+-
+-	HAVE_DEPTHAVERAGE=no
+-	if test "x$DEPTHAVERAGE" = "xyes"; then
+-		HAVE_DEPTHAVERAGE=yes
+-		AC_DEFINE([_HAVE_DEPTHAVERAGE_],[1],[with DepthAverage capability])
+-	fi
+-	AM_CONDITIONAL([DEPTHAVERAGE], [test x$HAVE_DEPTHAVERAGE = xyes])
+-	AC_MSG_RESULT($HAVE_DEPTHAVERAGE)
+-	dnl }}}
+-	dnl with-stressbalance{{{
+-	AC_ARG_WITH([stressbalance],
+-		AS_HELP_STRING([--with-stressbalance = YES], [compile with stressbalance capabilities (default is yes)]),
+-		[STRESSBALANCE=$withval],[STRESSBALANCE=yes]) 
+-	AC_MSG_CHECKING(for stressbalance capability compilation)
+-
+-	HAVE_STRESSBALANCE=no
+-	if test "x$STRESSBALANCE" = "xyes"; then
+-		HAVE_STRESSBALANCE=yes
+-		AC_DEFINE([_HAVE_STRESSBALANCE_],[1],[with stressbalance capability])
+-	fi
+-	AM_CONDITIONAL([STRESSBALANCE], [test x$HAVE_STRESSBALANCE = xyes])
+-	AC_MSG_RESULT($HAVE_STRESSBALANCE)
+-	dnl }}}
+-	dnl with-stressbalanceSIA{{{
+-		AC_ARG_WITH([stressbalanceSIA],
+-					AS_HELP_STRING([--with-stressbalanceSIA = YES], [compile with stressbalanceSIA capabilities (default is yes)]),
+-					[STRESSBALANCESIA=$withval],[STRESSBALANCESIA=yes]) 
+-		  AC_MSG_CHECKING(for stressbalanceSIA capability compilation)
+-
+-		  HAVE_STRESSBALANCESIA=no
+-		  if test "x$STRESSBALANCESIA" = "xyes"; then
+-			HAVE_STRESSBALANCESIA=yes
+-			  AC_DEFINE([_HAVE_STRESSBALANCESIA_],[1],[with stressbalanceSIA capability])
+-			  fi
+-			  AM_CONDITIONAL([STRESSBALANCESIA], [test x$HAVE_STRESSBALANCESIA = xyes])
+-			  AC_MSG_RESULT($HAVE_STRESSBALANCESIA)
+-			  dnl }}}
+-	dnl with-StressbalanceVertical{{{
+-	AC_ARG_WITH([StressbalanceVertical],
+-		AS_HELP_STRING([--with-StressbalanceVertical = YES], [compile with StressbalanceVertical capabilities (default is yes)]),
+-		[STRESSBALANCEVERTICAL=$withval],[STRESSBALANCEVERTICAL=yes]) 
+-	AC_MSG_CHECKING(for StressbalanceVertical capability compilation)
+-
+-	HAVE_STRESSBALANCEVERTICAL=no
+-	if test "x$STRESSBALANCEVERTICAL" = "xyes"; then
+-		HAVE_STRESSBALANCEVERTICAL=yes
+-		AC_DEFINE([_HAVE_STRESSBALANCEVERTICAL_],[1],[with StressbalanceVertical capability])
+-	fi
+-	AM_CONDITIONAL([STRESSBALANCEVERTICAL], [test x$HAVE_STRESSBALANCEVERTICAL = xyes])
+-	AC_MSG_RESULT($HAVE_STRESSBALANCEVERTICAL)
+-	dnl }}}
+-	dnl with-Enthalpy{{{
+-	AC_ARG_WITH([Enthalpy],
+-		AS_HELP_STRING([--with-Enthalpy = YES], [compile with Enthalpy capabilities (default is yes)]),
+-		[ENTHALPY=$withval],[ENTHALPY=yes]) 
+-	AC_MSG_CHECKING(for Enthalpy capability compilation)
+-
+-	HAVE_ENTHALPY=no
+-	if test "x$ENTHALPY" = "xyes"; then
+-		HAVE_ENTHALPY=yes
+-		AC_DEFINE([_HAVE_ENTHALPY_],[1],[with Enthalpy capability])
+-	fi
+-	AM_CONDITIONAL([ENTHALPY], [test x$HAVE_ENTHALPY = xyes])
+-	AC_MSG_RESULT($HAVE_ENTHALPY)
+-	dnl }}}
+-	dnl with-HydrologyShreve{{{
+-	AC_ARG_WITH([HydrologyShreve],
+-		AS_HELP_STRING([--with-HydrologyShreve = YES], [compile with HydrologyShreve capabilities (default is yes)]),
+-		[HYDROLOGYSHREVE=$withval],[HYDROLOGYSHREVE=yes]) 
+-	AC_MSG_CHECKING(for HydrologyShreve capability compilation)
+-
+-	HAVE_HYDROLOGYSHREVE=no
+-	if test "x$HYDROLOGYSHREVE" = "xyes"; then
+-		HAVE_HYDROLOGYSHREVE=yes
+-		AC_DEFINE([_HAVE_HYDROLOGYSHREVE_],[1],[with HydrologyShreve capability])
+-	fi
+-	AM_CONDITIONAL([HYDROLOGYSHREVE], [test x$HAVE_HYDROLOGYSHREVE = xyes])
+-	AC_MSG_RESULT($HAVE_HYDROLOGYSHREVE)
+-	dnl }}}
+-	dnl with-HydrologyDCInefficient{{{
+-	AC_ARG_WITH([HydrologyDCInefficient],
+-		AS_HELP_STRING([--with-HydrologyDCInefficient = YES], [compile with HydrologyDCInefficient capabilities (default is yes)]),
+-		[HYDROLOGYDCINEFFICIENT=$withval],[HYDROLOGYDCINEFFICIENT=yes]) 
+-	AC_MSG_CHECKING(for HydrologyDCInefficient capability compilation)
+-
+-	HAVE_HYDROLOGYDCINEFFICIENT=no
+-	if test "x$HYDROLOGYDCINEFFICIENT" = "xyes"; then
+-		HAVE_HYDROLOGYDCINEFFICIENT=yes
+-		AC_DEFINE([_HAVE_HYDROLOGYDCINEFFICIENT_],[1],[with HydrologyDCInefficient capability])
+-	fi
+-	AM_CONDITIONAL([HYDROLOGYDCINEFFICIENT], [test x$HAVE_HYDROLOGYDCINEFFICIENT = xyes])
+-	AC_MSG_RESULT($HAVE_HYDROLOGYDCINEFFICIENT)
+-	dnl }}}
+-	dnl with-HydrologyDCEfficient{{{
+-	AC_ARG_WITH([HydrologyDCEfficient],
+-		AS_HELP_STRING([--with-HydrologyDCEfficient = YES], [compile with HydrologyDCEfficient capabilities (default is yes)]),
+-		[HYDROLOGYDCEFFICIENT=$withval],[HYDROLOGYDCEFFICIENT=yes]) 
+-	AC_MSG_CHECKING(for HydrologyDCEfficient capability compilation)
+-
+-	HAVE_HYDROLOGYDCEFFICIENT=no
+-	if test "x$HYDROLOGYDCEFFICIENT" = "xyes"; then
+-		HAVE_HYDROLOGYDCEFFICIENT=yes
+-		AC_DEFINE([_HAVE_HYDROLOGYDCEFFICIENT_],[1],[with HydrologyDCEfficient capability])
+-	fi
+-	AM_CONDITIONAL([HYDROLOGYDCEFFICIENT], [test x$HAVE_HYDROLOGYDCEFFICIENT = xyes])
+-	AC_MSG_RESULT($HAVE_HYDROLOGYDCEFFICIENT)
+-	dnl }}}
+-	dnl with-Melting{{{
+-	AC_ARG_WITH([Melting],
+-		AS_HELP_STRING([--with-Melting = YES], [compile with Melting capabilities (default is yes)]),
+-		[MELTING=$withval],[MELTING=yes]) 
+-	AC_MSG_CHECKING(for Melting capability compilation)
+-
+-	HAVE_MELTING=no
+-	if test "x$MELTING" = "xyes"; then
+-		HAVE_MELTING=yes
+-		AC_DEFINE([_HAVE_MELTING_],[1],[with Melting capability])
+-	fi
+-	AM_CONDITIONAL([MELTING], [test x$HAVE_MELTING = xyes])
+-	AC_MSG_RESULT($HAVE_MELTING)
+-	dnl }}}
+-	dnl with-Masstransport{{{
+-	AC_ARG_WITH([Masstransport],
+-		AS_HELP_STRING([--with-Masstransport = YES], [compile with Masstransport capabilities (default is yes)]),
+-		[MASSTRANSPORT=$withval],[MASSTRANSPORT=yes]) 
+-	AC_MSG_CHECKING(for Masstransport capability compilation)
+-
+-	HAVE_MASSTRANSPORT=no
+-	if test "x$MASSTRANSPORT" = "xyes"; then
+-		HAVE_MASSTRANSPORT=yes
+-		AC_DEFINE([_HAVE_MASSTRANSPORT_],[1],[with Masstransport capability])
+-	fi
+-	AM_CONDITIONAL([MASSTRANSPORT], [test x$HAVE_MASSTRANSPORT = xyes])
+-	AC_MSG_RESULT($HAVE_MASSTRANSPORT)
+-	dnl }}}
+-	dnl with-FreeSurfaceBase{{{
+-	AC_ARG_WITH([FreeSurfaceBase],
+-		AS_HELP_STRING([--with-FreeSurfaceBase = YES], [compile with FreeSurfaceBase capabilities (default is yes)]),
+-		[FREESURFACEBASE=$withval],[FREESURFACEBASE=yes]) 
+-	AC_MSG_CHECKING(for FreeSurfaceBase capability compilation)
+-
+-	HAVE_FREESURFACEBASE=no
+-	if test "x$FREESURFACEBASE" = "xyes"; then
+-		HAVE_FREESURFACEBASE=yes
+-		AC_DEFINE([_HAVE_FREESURFACEBASE_],[1],[with FreeSurfaceBase capability])
+-	fi
+-	AM_CONDITIONAL([FREESURFACEBASE], [test x$HAVE_FREESURFACEBASE = xyes])
+-	AC_MSG_RESULT($HAVE_FREESURFACEBASE)
+-	dnl }}}
+-	dnl with-FreeSurfaceTop{{{
+-		AC_ARG_WITH([FreeSurfaceTop],
+-					AS_HELP_STRING([--with-FreeSurfaceTop = YES], [compile with FreeSurfaceTop capabilities (default is yes)]),
+-					[FREESURFACETOP=$withval],[FREESURFACETOP=yes]) 
+-		  AC_MSG_CHECKING(for FreeSurfaceTop capability compilation)
+-
+-		  HAVE_FREESURFACETOP=no
+-		  if test "x$FREESURFACETOP" = "xyes"; then
+-			HAVE_FREESURFACETOP=yes
+-			  AC_DEFINE([_HAVE_FREESURFACETOP_],[1],[with FreeSurfaceTop capability])
+-			  fi
+-			  AM_CONDITIONAL([FREESURFACETOP], [test x$HAVE_FREESURFACETOP = xyes])
+-			  AC_MSG_RESULT($HAVE_FREESURFACETOP)
+-			  dnl }}}
+-	dnl with-ExtrudeFromBase{{{
+-	AC_ARG_WITH([ExtrudeFromBase],
+-		AS_HELP_STRING([--with-ExtrudeFromBase = YES], [compile with ExtrudeFromBase capabilities (default is yes)]),
+-		[EXTRUDEFROMBASE=$withval],[EXTRUDEFROMBASE=yes]) 
+-	AC_MSG_CHECKING(for ExtrudeFromBase capability compilation)
+-
+-	HAVE_EXTRUDEFROMBASE=no
+-	if test "x$EXTRUDEFROMBASE" = "xyes"; then
+-		HAVE_EXTRUDEFROMBASE=yes
+-		AC_DEFINE([_HAVE_EXTRUDEFROMBASE_],[1],[with ExtrudeFromBase capability])
+-	fi
+-	AM_CONDITIONAL([EXTRUDEFROMBASE], [test x$HAVE_EXTRUDEFROMBASE = xyes])
+-	AC_MSG_RESULT($HAVE_EXTRUDEFROMBASE)
+-	dnl }}}
+-	dnl with-ExtrudeFromTop{{{
+-		AC_ARG_WITH([ExtrudeFromTop],
+-					AS_HELP_STRING([--with-ExtrudeFromTop = YES], [compile with ExtrudeFromTop capabilities (default is yes)]),
+-					[EXTRUDEFROMTOP=$withval],[EXTRUDEFROMTOP=yes]) 
+-		  AC_MSG_CHECKING(for ExtrudeFromTop capability compilation)
+-
+-		  HAVE_EXTRUDEFROMTOP=no
+-		  if test "x$EXTRUDEFROMTOP" = "xyes"; then
+-			HAVE_EXTRUDEFROMTOP=yes
+-			  AC_DEFINE([_HAVE_EXTRUDEFROMTOP_],[1],[with ExtrudeFromTop capability])
+-			  fi
+-			  AM_CONDITIONAL([EXTRUDEFROMTOP], [test x$HAVE_EXTRUDEFROMTOP = xyes])
+-			  AC_MSG_RESULT($HAVE_EXTRUDEFROMTOP)
+-			  dnl }}}
+-	dnl with-Thermal{{{
+-	AC_ARG_WITH([Thermal],
+-		AS_HELP_STRING([--with-Thermal = YES], [compile with Thermal capabilities (default is yes)]),
+-		[THERMAL=$withval],[THERMAL=yes]) 
+-	AC_MSG_CHECKING(for Thermal capability compilation)
+-
+-	HAVE_THERMAL=no
+-	if test "x$THERMAL" = "xyes"; then
+-		HAVE_THERMAL=yes
+-		AC_DEFINE([_HAVE_THERMAL_],[1],[with Thermal capability])
+-	fi
+-	AM_CONDITIONAL([THERMAL], [test x$HAVE_THERMAL = xyes])
+-	AC_MSG_RESULT($HAVE_THERMAL)
+-	dnl }}}
+-	dnl with-SmoothedSurfaceSlopeX{{{
+-	AC_ARG_WITH([SmoothedSurfaceSlopeX],
+-		AS_HELP_STRING([--with-SmoothedSurfaceSlopeX = YES], [compile with SmoothedSurfaceSlopeX capabilities (default is yes)]),
+-		[SMOOTHEDSURFACESLOPEX=$withval],[SMOOTHEDSURFACESLOPEX=yes]) 
+-	AC_MSG_CHECKING(for SmoothedSurfaceSlopeX capability compilation)
+-
+-	HAVE_SMOOTHEDSURFACESLOPEX=no
+-	if test "x$SMOOTHEDSURFACESLOPEX" = "xyes"; then
+-		HAVE_SMOOTHEDSURFACESLOPEX=yes
+-		AC_DEFINE([_HAVE_SMOOTHEDSURFACESLOPEX_],[1],[with SmoothedSurfaceSlopeX capability])
+-	fi
+-	AM_CONDITIONAL([SMOOTHEDSURFACESLOPEX], [test x$HAVE_SMOOTHEDSURFACESLOPEX = xyes])
+-	AC_MSG_RESULT($HAVE_SMOOTHEDSURFACESLOPEX)
+-	dnl }}}
+-	dnl with-SmoothedSurfaceSlopeY{{{
+-	AC_ARG_WITH([SmoothedSurfaceSlopeY],
+-		AS_HELP_STRING([--with-SmoothedSurfaceSlopeY = YES], [compile with SmoothedSurfaceSlopeY capabilities (default is yes)]),
+-		[SMOOTHEDSURFACESLOPEY=$withval],[SMOOTHEDSURFACESLOPEY=yes]) 
+-	AC_MSG_CHECKING(for SmoothedSurfaceSlopeY capability compilation)
+-
+-	HAVE_SMOOTHEDSURFACESLOPEY=no
+-	if test "x$SMOOTHEDSURFACESLOPEY" = "xyes"; then
+-		HAVE_SMOOTHEDSURFACESLOPEY=yes
+-		AC_DEFINE([_HAVE_SMOOTHEDSURFACESLOPEY_],[1],[with SmoothedSurfaceSlopeY capability])
+-	fi
+-	AM_CONDITIONAL([SMOOTHEDSURFACESLOPEY], [test x$HAVE_SMOOTHEDSURFACESLOPEY = xyes])
+-	AC_MSG_RESULT($HAVE_SMOOTHEDSURFACESLOPEY)
+-	dnl }}}
+-	dnl with-Meshdeformation{{{
+-	AC_ARG_WITH([Meshdeformation],
+-		AS_HELP_STRING([--with-Meshdeformation = YES], [compile with Meshdeformation capabilities (default is yes)]),
+-		[MESHDEFORMATION=$withval],[MESHDEFORMATION=yes]) 
+-	AC_MSG_CHECKING(for Meshdeformation capability compilation)
+-
+-	HAVE_MESHDEFORMATION=no
+-	if test "x$MESHDEFORMATION" = "xyes"; then
+-		HAVE_MESHDEFORMATION=yes
+-		AC_DEFINE([_HAVE_MESHDEFORMATION_],[1],[with Meshdeformation capability])
+-	fi
+-	AM_CONDITIONAL([MESHDEFORMATION], [test x$HAVE_MESHDEFORMATION = xyes])
+-	AC_MSG_RESULT($HAVE_MESHDEFORMATION)
+-	dnl }}}
+-	dnl with-Levelset{{{
+-	AC_ARG_WITH([Levelset],
+-		AS_HELP_STRING([--with-Levelset = YES], [compile with Levelset capabilities (default is yes)]),
+-		[LEVELSET=$withval],[LEVELSET=yes]) 
+-	AC_MSG_CHECKING(for Levelset capability compilation)
+-
+-	HAVE_LEVELSET=no
+-	if test "x$LEVELSET" = "xyes"; then
+-		HAVE_LEVELSET=yes
+-		AC_DEFINE([_HAVE_LEVELSET_],[1],[with Levelset capability])
+-	fi
+-	AM_CONDITIONAL([LEVELSET], [test x$HAVE_LEVELSET = xyes])
+-	AC_MSG_RESULT($HAVE_LEVELSET)
+-	dnl }}}
+-	dnl with-Extrapolation{{{
+-	AC_ARG_WITH([Extrapolation],
+-		AS_HELP_STRING([--with-Extrapolation = YES], [compile with Extrapolation capabilities (default is yes)]),
+-		[EXTRAPOLATION=$withval],[EXTRAPOLATION=yes]) 
+-	AC_MSG_CHECKING(for Extrapolation capability compilation)
+-
+-	HAVE_EXTRAPOLATION=no
+-	if test "x$EXTRAPOLATION" = "xyes"; then
+-		HAVE_EXTRAPOLATION=yes
+-		AC_DEFINE([_HAVE_EXTRAPOLATION_],[1],[with Extrapolation capability])
+-	fi
+-	AM_CONDITIONAL([EXTRAPOLATION], [test x$HAVE_EXTRAPOLATION = xyes])
+-	AC_MSG_RESULT($HAVE_EXTRAPOLATION)
+-	dnl }}}
+-	dnl with-LsfReinitialization{{{
+-	AC_ARG_WITH([LsfReinitialization],
+-		AS_HELP_STRING([--with-LsfReinitialization = YES], [compile with LsfReinitialization capabilities (default is yes)]),
+-		[LSFREINITIALIZATION=$withval],[LSFREINITIALIZATION=yes]) 
+-	AC_MSG_CHECKING(for LsfReinitialization capability compilation)
+-
+-	HAVE_LSFREINITIALIZATION=no
+-	if test "x$LSFREINITIALIZATION" = "xyes"; then
+-		HAVE_LSFREINITIALIZATION=yes
+-		AC_DEFINE([_HAVE_LSFREINITIALIZATION_],[1],[with LsfReinitialization capability])
+-	fi
+-	AM_CONDITIONAL([LSFREINITIALIZATION], [test x$HAVE_LSFREINITIALIZATION = xyes])
+-	AC_MSG_RESULT($HAVE_LSFREINITIALIZATION)
+-	dnl }}}
+-
+ 	dnl Platform specifics
+ 	dnl with-ios{{{
+ 	AC_ARG_WITH([ios],
+Index: ../trunk-jpl/m4/analyses.m4
+===================================================================
+--- ../trunk-jpl/m4/analyses.m4	(revision 0)
++++ ../trunk-jpl/m4/analyses.m4	(revision 17775)
+@@ -0,0 +1,414 @@
++# AX_ANALYSES_SELECTION
++# -----------------
++# Check for analyses compilation
++AC_DEFUN([AX_ANALYSES_SELECTION],
++			[
++	dnl with-AdjointBalancethickness{{{
++	AC_ARG_WITH([AdjointBalancethickness],
++		AS_HELP_STRING([--with-AdjointBalancethickness = YES], [compile with AdjointBalancethickness capabilities (default is yes)]),
++		[ADJOINTBALANCETHICKNESS=$withval],[ADJOINTBALANCETHICKNESS=yes]) 
++	AC_MSG_CHECKING(for AdjointBalancethickness capability compilation)
++
++	HAVE_ADJOINTBALANCETHICKNESS=no
++	if test "x$ADJOINTBALANCETHICKNESS" = "xyes"; then
++		HAVE_ADJOINTBALANCETHICKNESS=yes
++		AC_DEFINE([_HAVE_ADJOINTBALANCETHICKNESS_],[1],[with AdjointBalancethickness capability])
++	fi
++	AM_CONDITIONAL([ADJOINTBALANCETHICKNESS], [test x$HAVE_ADJOINTBALANCETHICKNESS = xyes])
++	AC_MSG_RESULT($HAVE_ADJOINTBALANCETHICKNESS)
++	dnl }}}
++	dnl with-AdjointHoriz{{{
++	AC_ARG_WITH([AdjointHoriz],
++		AS_HELP_STRING([--with-AdjointHoriz = YES], [compile with AdjointHoriz capabilities (default is yes)]),
++		[ADJOINTHORIZ=$withval],[ADJOINTHORIZ=yes]) 
++	AC_MSG_CHECKING(for AdjointHoriz capability compilation)
++
++	HAVE_ADJOINTHORIZ=no
++	if test "x$ADJOINTHORIZ" = "xyes"; then
++		HAVE_ADJOINTHORIZ=yes
++		AC_DEFINE([_HAVE_ADJOINTHORIZ_],[1],[with AdjointHoriz capability])
++	fi
++	AM_CONDITIONAL([ADJOINTHORIZ], [test x$HAVE_ADJOINTHORIZ = xyes])
++	AC_MSG_RESULT($HAVE_ADJOINTHORIZ)
++	dnl }}}
++	dnl with-Balancethickness{{{
++	AC_ARG_WITH([Balancethickness],
++		AS_HELP_STRING([--with-Balancethickness = YES], [compile with Balancethickness capabilities (default is yes)]),
++		[BALANCETHICKNESS=$withval],[BALANCETHICKNESS=yes]) 
++	AC_MSG_CHECKING(for Balancethickness capability compilation)
++
++	HAVE_BALANCETHICKNESS=no
++	if test "x$BALANCETHICKNESS" = "xyes"; then
++		HAVE_BALANCETHICKNESS=yes
++		AC_DEFINE([_HAVE_BALANCETHICKNESS_],[1],[with Balancethickness capability])
++	fi
++	AM_CONDITIONAL([BALANCETHICKNESS], [test x$HAVE_BALANCETHICKNESS = xyes])
++	AC_MSG_RESULT($HAVE_BALANCETHICKNESS)
++	dnl }}}
++	dnl with-BalancethicknessSoft{{{
++	AC_ARG_WITH([BalancethicknessSoft],
++		AS_HELP_STRING([--with-BalancethicknessSoft = YES], [compile with BalancethicknessSoft capabilities (default is yes)]),
++		[BALANCETHICKNESSSOFT=$withval],[BALANCETHICKNESSSOFT=yes]) 
++	AC_MSG_CHECKING(for BalancethicknessSoft capability compilation)
++
++	HAVE_BALANCETHICKNESSSOFT=no
++	if test "x$BALANCETHICKNESSSOFT" = "xyes"; then
++		HAVE_BALANCETHICKNESSSOFT=yes
++		AC_DEFINE([_HAVE_BALANCETHICKNESSSOFT_],[1],[with BalancethicknessSoft capability])
++	fi
++	AM_CONDITIONAL([BALANCETHICKNESSSOFT], [test x$HAVE_BALANCETHICKNESSSOFT = xyes])
++	AC_MSG_RESULT($HAVE_BALANCETHICKNESSSOFT)
++	dnl }}}
++	dnl with-Balancevelocity{{{
++	AC_ARG_WITH([Balancevelocity],
++		AS_HELP_STRING([--with-Balancevelocity = YES], [compile with Balancevelocity capabilities (default is yes)]),
++		[BALANCEVELOCITY=$withval],[BALANCEVELOCITY=yes]) 
++	AC_MSG_CHECKING(for Balancevelocity capability compilation)
++
++	HAVE_BALANCEVELOCITY=no
++	if test "x$BALANCEVELOCITY" = "xyes"; then
++		HAVE_BALANCEVELOCITY=yes
++		AC_DEFINE([_HAVE_BALANCEVELOCITY_],[1],[with Balancevelocity capability])
++	fi
++	AM_CONDITIONAL([BALANCEVELOCITY], [test x$HAVE_BALANCEVELOCITY = xyes])
++	AC_MSG_RESULT($HAVE_BALANCEVELOCITY)
++	dnl }}}
++	dnl with-L2ProjectionEPL{{{
++	AC_ARG_WITH([L2ProjectionEPL],
++		AS_HELP_STRING([--with-L2ProjectionEPL = YES], [compile with L2ProjectionEPL capabilities (default is yes)]),
++		[L2PROJECTIONEPL=$withval],[L2PROJECTIONEPL=yes]) 
++	AC_MSG_CHECKING(for L2ProjectionEPL capability compilation)
++
++	HAVE_L2PROJECTIONEPL=no
++	if test "x$L2PROJECTIONEPL" = "xyes"; then
++		HAVE_L2PROJECTIONEPL=yes
++		AC_DEFINE([_HAVE_L2PROJECTIONEPL_],[1],[with L2ProjectionEPL capability])
++	fi
++	AM_CONDITIONAL([L2PROJECTIONEPL], [test x$HAVE_L2PROJECTIONEPL = xyes])
++	AC_MSG_RESULT($HAVE_L2PROJECTIONEPL)
++	dnl }}}
++	dnl with-L2ProjectionBase{{{
++	AC_ARG_WITH([L2ProjectionBase],
++		AS_HELP_STRING([--with-L2ProjectionBase = YES], [compile with L2ProjectionBase capabilities (default is yes)]),
++		[L2PROJECTIONBASE=$withval],[L2PROJECTIONBASE=yes]) 
++	AC_MSG_CHECKING(for L2ProjectionBase capability compilation)
++
++	HAVE_L2PROJECTIONBASE=no
++	if test "x$L2PROJECTIONBASE" = "xyes"; then
++		HAVE_L2PROJECTIONBASE=yes
++		AC_DEFINE([_HAVE_L2PROJECTIONBASE_],[1],[with L2ProjectionBase capability])
++	fi
++	AM_CONDITIONAL([L2PROJECTIONBASE], [test x$HAVE_L2PROJECTIONBASE = xyes])
++	AC_MSG_RESULT($HAVE_L2PROJECTIONBASE)
++	dnl }}}
++	dnl with-DamageEvolution{{{
++	AC_ARG_WITH([DamageEvolution],
++		AS_HELP_STRING([--with-DamageEvolution = YES], [compile with DamageEvolution capabilities (default is yes)]),
++		[DAMAGEEVOLUTION=$withval],[DAMAGEEVOLUTION=yes]) 
++	AC_MSG_CHECKING(for DamageEvolution capability compilation)
++
++	HAVE_DAMAGEEVOLUTION=no
++	if test "x$DAMAGEEVOLUTION" = "xyes"; then
++		HAVE_DAMAGEEVOLUTION=yes
++		AC_DEFINE([_HAVE_DAMAGEEVOLUTION_],[1],[with DamageEvolution capability])
++	fi
++	AM_CONDITIONAL([DAMAGEEVOLUTION], [test x$HAVE_DAMAGEEVOLUTION = xyes])
++	AC_MSG_RESULT($HAVE_DAMAGEEVOLUTION)
++	dnl }}}
++	dnl with-DepthAverage{{{
++	AC_ARG_WITH([DepthAverage],
++		AS_HELP_STRING([--with-DepthAverage = YES], [compile with DepthAverage capabilities (default is yes)]),
++		[DEPTHAVERAGE=$withval],[DEPTHAVERAGE=yes]) 
++	AC_MSG_CHECKING(for DepthAverage capability compilation)
++
++	HAVE_DEPTHAVERAGE=no
++	if test "x$DEPTHAVERAGE" = "xyes"; then
++		HAVE_DEPTHAVERAGE=yes
++		AC_DEFINE([_HAVE_DEPTHAVERAGE_],[1],[with DepthAverage capability])
++	fi
++	AM_CONDITIONAL([DEPTHAVERAGE], [test x$HAVE_DEPTHAVERAGE = xyes])
++	AC_MSG_RESULT($HAVE_DEPTHAVERAGE)
++	dnl }}}
++	dnl with-stressbalance{{{
++	AC_ARG_WITH([stressbalance],
++		AS_HELP_STRING([--with-stressbalance = YES], [compile with stressbalance capabilities (default is yes)]),
++		[STRESSBALANCE=$withval],[STRESSBALANCE=yes]) 
++	AC_MSG_CHECKING(for stressbalance capability compilation)
++
++	HAVE_STRESSBALANCE=no
++	if test "x$STRESSBALANCE" = "xyes"; then
++		HAVE_STRESSBALANCE=yes
++		AC_DEFINE([_HAVE_STRESSBALANCE_],[1],[with stressbalance capability])
++	fi
++	AM_CONDITIONAL([STRESSBALANCE], [test x$HAVE_STRESSBALANCE = xyes])
++	AC_MSG_RESULT($HAVE_STRESSBALANCE)
++	dnl }}}
++	dnl with-stressbalanceSIA{{{
++		AC_ARG_WITH([stressbalanceSIA],
++					AS_HELP_STRING([--with-stressbalanceSIA = YES], [compile with stressbalanceSIA capabilities (default is yes)]),
++					[STRESSBALANCESIA=$withval],[STRESSBALANCESIA=yes]) 
++		  AC_MSG_CHECKING(for stressbalanceSIA capability compilation)
++
++		  HAVE_STRESSBALANCESIA=no
++		  if test "x$STRESSBALANCESIA" = "xyes"; then
++			HAVE_STRESSBALANCESIA=yes
++			  AC_DEFINE([_HAVE_STRESSBALANCESIA_],[1],[with stressbalanceSIA capability])
++			  fi
++			  AM_CONDITIONAL([STRESSBALANCESIA], [test x$HAVE_STRESSBALANCESIA = xyes])
++			  AC_MSG_RESULT($HAVE_STRESSBALANCESIA)
++			  dnl }}}
++	dnl with-StressbalanceVertical{{{
++	AC_ARG_WITH([StressbalanceVertical],
++		AS_HELP_STRING([--with-StressbalanceVertical = YES], [compile with StressbalanceVertical capabilities (default is yes)]),
++		[STRESSBALANCEVERTICAL=$withval],[STRESSBALANCEVERTICAL=yes]) 
++	AC_MSG_CHECKING(for StressbalanceVertical capability compilation)
++
++	HAVE_STRESSBALANCEVERTICAL=no
++	if test "x$STRESSBALANCEVERTICAL" = "xyes"; then
++		HAVE_STRESSBALANCEVERTICAL=yes
++		AC_DEFINE([_HAVE_STRESSBALANCEVERTICAL_],[1],[with StressbalanceVertical capability])
++	fi
++	AM_CONDITIONAL([STRESSBALANCEVERTICAL], [test x$HAVE_STRESSBALANCEVERTICAL = xyes])
++	AC_MSG_RESULT($HAVE_STRESSBALANCEVERTICAL)
++	dnl }}}
++	dnl with-Enthalpy{{{
++	AC_ARG_WITH([Enthalpy],
++		AS_HELP_STRING([--with-Enthalpy = YES], [compile with Enthalpy capabilities (default is yes)]),
++		[ENTHALPY=$withval],[ENTHALPY=yes]) 
++	AC_MSG_CHECKING(for Enthalpy capability compilation)
++
++	HAVE_ENTHALPY=no
++	if test "x$ENTHALPY" = "xyes"; then
++		HAVE_ENTHALPY=yes
++		AC_DEFINE([_HAVE_ENTHALPY_],[1],[with Enthalpy capability])
++	fi
++	AM_CONDITIONAL([ENTHALPY], [test x$HAVE_ENTHALPY = xyes])
++	AC_MSG_RESULT($HAVE_ENTHALPY)
++	dnl }}}
++	dnl with-HydrologyShreve{{{
++	AC_ARG_WITH([HydrologyShreve],
++		AS_HELP_STRING([--with-HydrologyShreve = YES], [compile with HydrologyShreve capabilities (default is yes)]),
++		[HYDROLOGYSHREVE=$withval],[HYDROLOGYSHREVE=yes]) 
++	AC_MSG_CHECKING(for HydrologyShreve capability compilation)
++
++	HAVE_HYDROLOGYSHREVE=no
++	if test "x$HYDROLOGYSHREVE" = "xyes"; then
++		HAVE_HYDROLOGYSHREVE=yes
++		AC_DEFINE([_HAVE_HYDROLOGYSHREVE_],[1],[with HydrologyShreve capability])
++	fi
++	AM_CONDITIONAL([HYDROLOGYSHREVE], [test x$HAVE_HYDROLOGYSHREVE = xyes])
++	AC_MSG_RESULT($HAVE_HYDROLOGYSHREVE)
++	dnl }}}
++	dnl with-HydrologyDCInefficient{{{
++	AC_ARG_WITH([HydrologyDCInefficient],
++		AS_HELP_STRING([--with-HydrologyDCInefficient = YES], [compile with HydrologyDCInefficient capabilities (default is yes)]),
++		[HYDROLOGYDCINEFFICIENT=$withval],[HYDROLOGYDCINEFFICIENT=yes]) 
++	AC_MSG_CHECKING(for HydrologyDCInefficient capability compilation)
++
++	HAVE_HYDROLOGYDCINEFFICIENT=no
++	if test "x$HYDROLOGYDCINEFFICIENT" = "xyes"; then
++		HAVE_HYDROLOGYDCINEFFICIENT=yes
++		AC_DEFINE([_HAVE_HYDROLOGYDCINEFFICIENT_],[1],[with HydrologyDCInefficient capability])
++	fi
++	AM_CONDITIONAL([HYDROLOGYDCINEFFICIENT], [test x$HAVE_HYDROLOGYDCINEFFICIENT = xyes])
++	AC_MSG_RESULT($HAVE_HYDROLOGYDCINEFFICIENT)
++	dnl }}}
++	dnl with-HydrologyDCEfficient{{{
++	AC_ARG_WITH([HydrologyDCEfficient],
++		AS_HELP_STRING([--with-HydrologyDCEfficient = YES], [compile with HydrologyDCEfficient capabilities (default is yes)]),
++		[HYDROLOGYDCEFFICIENT=$withval],[HYDROLOGYDCEFFICIENT=yes]) 
++	AC_MSG_CHECKING(for HydrologyDCEfficient capability compilation)
++
++	HAVE_HYDROLOGYDCEFFICIENT=no
++	if test "x$HYDROLOGYDCEFFICIENT" = "xyes"; then
++		HAVE_HYDROLOGYDCEFFICIENT=yes
++		AC_DEFINE([_HAVE_HYDROLOGYDCEFFICIENT_],[1],[with HydrologyDCEfficient capability])
++	fi
++	AM_CONDITIONAL([HYDROLOGYDCEFFICIENT], [test x$HAVE_HYDROLOGYDCEFFICIENT = xyes])
++	AC_MSG_RESULT($HAVE_HYDROLOGYDCEFFICIENT)
++	dnl }}}
++	dnl with-Melting{{{
++	AC_ARG_WITH([Melting],
++		AS_HELP_STRING([--with-Melting = YES], [compile with Melting capabilities (default is yes)]),
++		[MELTING=$withval],[MELTING=yes]) 
++	AC_MSG_CHECKING(for Melting capability compilation)
++
++	HAVE_MELTING=no
++	if test "x$MELTING" = "xyes"; then
++		HAVE_MELTING=yes
++		AC_DEFINE([_HAVE_MELTING_],[1],[with Melting capability])
++	fi
++	AM_CONDITIONAL([MELTING], [test x$HAVE_MELTING = xyes])
++	AC_MSG_RESULT($HAVE_MELTING)
++	dnl }}}
++	dnl with-Masstransport{{{
++	AC_ARG_WITH([Masstransport],
++		AS_HELP_STRING([--with-Masstransport = YES], [compile with Masstransport capabilities (default is yes)]),
++		[MASSTRANSPORT=$withval],[MASSTRANSPORT=yes]) 
++	AC_MSG_CHECKING(for Masstransport capability compilation)
++
++	HAVE_MASSTRANSPORT=no
++	if test "x$MASSTRANSPORT" = "xyes"; then
++		HAVE_MASSTRANSPORT=yes
++		AC_DEFINE([_HAVE_MASSTRANSPORT_],[1],[with Masstransport capability])
++	fi
++	AM_CONDITIONAL([MASSTRANSPORT], [test x$HAVE_MASSTRANSPORT = xyes])
++	AC_MSG_RESULT($HAVE_MASSTRANSPORT)
++	dnl }}}
++	dnl with-FreeSurfaceBase{{{
++	AC_ARG_WITH([FreeSurfaceBase],
++		AS_HELP_STRING([--with-FreeSurfaceBase = YES], [compile with FreeSurfaceBase capabilities (default is yes)]),
++		[FREESURFACEBASE=$withval],[FREESURFACEBASE=yes]) 
++	AC_MSG_CHECKING(for FreeSurfaceBase capability compilation)
++
++	HAVE_FREESURFACEBASE=no
++	if test "x$FREESURFACEBASE" = "xyes"; then
++		HAVE_FREESURFACEBASE=yes
++		AC_DEFINE([_HAVE_FREESURFACEBASE_],[1],[with FreeSurfaceBase capability])
++	fi
++	AM_CONDITIONAL([FREESURFACEBASE], [test x$HAVE_FREESURFACEBASE = xyes])
++	AC_MSG_RESULT($HAVE_FREESURFACEBASE)
++	dnl }}}
++	dnl with-FreeSurfaceTop{{{
++		AC_ARG_WITH([FreeSurfaceTop],
++					AS_HELP_STRING([--with-FreeSurfaceTop = YES], [compile with FreeSurfaceTop capabilities (default is yes)]),
++					[FREESURFACETOP=$withval],[FREESURFACETOP=yes]) 
++		  AC_MSG_CHECKING(for FreeSurfaceTop capability compilation)
++
++		  HAVE_FREESURFACETOP=no
++		  if test "x$FREESURFACETOP" = "xyes"; then
++			HAVE_FREESURFACETOP=yes
++			  AC_DEFINE([_HAVE_FREESURFACETOP_],[1],[with FreeSurfaceTop capability])
++			  fi
++			  AM_CONDITIONAL([FREESURFACETOP], [test x$HAVE_FREESURFACETOP = xyes])
++			  AC_MSG_RESULT($HAVE_FREESURFACETOP)
++			  dnl }}}
++	dnl with-ExtrudeFromBase{{{
++	AC_ARG_WITH([ExtrudeFromBase],
++		AS_HELP_STRING([--with-ExtrudeFromBase = YES], [compile with ExtrudeFromBase capabilities (default is yes)]),
++		[EXTRUDEFROMBASE=$withval],[EXTRUDEFROMBASE=yes]) 
++	AC_MSG_CHECKING(for ExtrudeFromBase capability compilation)
++
++	HAVE_EXTRUDEFROMBASE=no
++	if test "x$EXTRUDEFROMBASE" = "xyes"; then
++		HAVE_EXTRUDEFROMBASE=yes
++		AC_DEFINE([_HAVE_EXTRUDEFROMBASE_],[1],[with ExtrudeFromBase capability])
++	fi
++	AM_CONDITIONAL([EXTRUDEFROMBASE], [test x$HAVE_EXTRUDEFROMBASE = xyes])
++	AC_MSG_RESULT($HAVE_EXTRUDEFROMBASE)
++	dnl }}}
++	dnl with-ExtrudeFromTop{{{
++		AC_ARG_WITH([ExtrudeFromTop],
++					AS_HELP_STRING([--with-ExtrudeFromTop = YES], [compile with ExtrudeFromTop capabilities (default is yes)]),
++					[EXTRUDEFROMTOP=$withval],[EXTRUDEFROMTOP=yes]) 
++		  AC_MSG_CHECKING(for ExtrudeFromTop capability compilation)
++
++		  HAVE_EXTRUDEFROMTOP=no
++		  if test "x$EXTRUDEFROMTOP" = "xyes"; then
++			HAVE_EXTRUDEFROMTOP=yes
++			  AC_DEFINE([_HAVE_EXTRUDEFROMTOP_],[1],[with ExtrudeFromTop capability])
++			  fi
++			  AM_CONDITIONAL([EXTRUDEFROMTOP], [test x$HAVE_EXTRUDEFROMTOP = xyes])
++			  AC_MSG_RESULT($HAVE_EXTRUDEFROMTOP)
++			  dnl }}}
++	dnl with-Thermal{{{
++	AC_ARG_WITH([Thermal],
++		AS_HELP_STRING([--with-Thermal = YES], [compile with Thermal capabilities (default is yes)]),
++		[THERMAL=$withval],[THERMAL=yes]) 
++	AC_MSG_CHECKING(for Thermal capability compilation)
++
++	HAVE_THERMAL=no
++	if test "x$THERMAL" = "xyes"; then
++		HAVE_THERMAL=yes
++		AC_DEFINE([_HAVE_THERMAL_],[1],[with Thermal capability])
++	fi
++	AM_CONDITIONAL([THERMAL], [test x$HAVE_THERMAL = xyes])
++	AC_MSG_RESULT($HAVE_THERMAL)
++	dnl }}}
++	dnl with-SmoothedSurfaceSlopeX{{{
++	AC_ARG_WITH([SmoothedSurfaceSlopeX],
++		AS_HELP_STRING([--with-SmoothedSurfaceSlopeX = YES], [compile with SmoothedSurfaceSlopeX capabilities (default is yes)]),
++		[SMOOTHEDSURFACESLOPEX=$withval],[SMOOTHEDSURFACESLOPEX=yes]) 
++	AC_MSG_CHECKING(for SmoothedSurfaceSlopeX capability compilation)
++
++	HAVE_SMOOTHEDSURFACESLOPEX=no
++	if test "x$SMOOTHEDSURFACESLOPEX" = "xyes"; then
++		HAVE_SMOOTHEDSURFACESLOPEX=yes
++		AC_DEFINE([_HAVE_SMOOTHEDSURFACESLOPEX_],[1],[with SmoothedSurfaceSlopeX capability])
++	fi
++	AM_CONDITIONAL([SMOOTHEDSURFACESLOPEX], [test x$HAVE_SMOOTHEDSURFACESLOPEX = xyes])
++	AC_MSG_RESULT($HAVE_SMOOTHEDSURFACESLOPEX)
++	dnl }}}
++	dnl with-SmoothedSurfaceSlopeY{{{
++	AC_ARG_WITH([SmoothedSurfaceSlopeY],
++		AS_HELP_STRING([--with-SmoothedSurfaceSlopeY = YES], [compile with SmoothedSurfaceSlopeY capabilities (default is yes)]),
++		[SMOOTHEDSURFACESLOPEY=$withval],[SMOOTHEDSURFACESLOPEY=yes]) 
++	AC_MSG_CHECKING(for SmoothedSurfaceSlopeY capability compilation)
++
++	HAVE_SMOOTHEDSURFACESLOPEY=no
++	if test "x$SMOOTHEDSURFACESLOPEY" = "xyes"; then
++		HAVE_SMOOTHEDSURFACESLOPEY=yes
++		AC_DEFINE([_HAVE_SMOOTHEDSURFACESLOPEY_],[1],[with SmoothedSurfaceSlopeY capability])
++	fi
++	AM_CONDITIONAL([SMOOTHEDSURFACESLOPEY], [test x$HAVE_SMOOTHEDSURFACESLOPEY = xyes])
++	AC_MSG_RESULT($HAVE_SMOOTHEDSURFACESLOPEY)
++	dnl }}}
++	dnl with-Meshdeformation{{{
++	AC_ARG_WITH([Meshdeformation],
++		AS_HELP_STRING([--with-Meshdeformation = YES], [compile with Meshdeformation capabilities (default is yes)]),
++		[MESHDEFORMATION=$withval],[MESHDEFORMATION=yes]) 
++	AC_MSG_CHECKING(for Meshdeformation capability compilation)
++
++	HAVE_MESHDEFORMATION=no
++	if test "x$MESHDEFORMATION" = "xyes"; then
++		HAVE_MESHDEFORMATION=yes
++		AC_DEFINE([_HAVE_MESHDEFORMATION_],[1],[with Meshdeformation capability])
++	fi
++	AM_CONDITIONAL([MESHDEFORMATION], [test x$HAVE_MESHDEFORMATION = xyes])
++	AC_MSG_RESULT($HAVE_MESHDEFORMATION)
++	dnl }}}
++	dnl with-Levelset{{{
++	AC_ARG_WITH([Levelset],
++		AS_HELP_STRING([--with-Levelset = YES], [compile with Levelset capabilities (default is yes)]),
++		[LEVELSET=$withval],[LEVELSET=yes]) 
++	AC_MSG_CHECKING(for Levelset capability compilation)
++
++	HAVE_LEVELSET=no
++	if test "x$LEVELSET" = "xyes"; then
++		HAVE_LEVELSET=yes
++		AC_DEFINE([_HAVE_LEVELSET_],[1],[with Levelset capability])
++	fi
++	AM_CONDITIONAL([LEVELSET], [test x$HAVE_LEVELSET = xyes])
++	AC_MSG_RESULT($HAVE_LEVELSET)
++	dnl }}}
++	dnl with-Extrapolation{{{
++	AC_ARG_WITH([Extrapolation],
++		AS_HELP_STRING([--with-Extrapolation = YES], [compile with Extrapolation capabilities (default is yes)]),
++		[EXTRAPOLATION=$withval],[EXTRAPOLATION=yes]) 
++	AC_MSG_CHECKING(for Extrapolation capability compilation)
++
++	HAVE_EXTRAPOLATION=no
++	if test "x$EXTRAPOLATION" = "xyes"; then
++		HAVE_EXTRAPOLATION=yes
++		AC_DEFINE([_HAVE_EXTRAPOLATION_],[1],[with Extrapolation capability])
++	fi
++	AM_CONDITIONAL([EXTRAPOLATION], [test x$HAVE_EXTRAPOLATION = xyes])
++	AC_MSG_RESULT($HAVE_EXTRAPOLATION)
++	dnl }}}
++	dnl with-LsfReinitialization{{{
++	AC_ARG_WITH([LsfReinitialization],
++		AS_HELP_STRING([--with-LsfReinitialization = YES], [compile with LsfReinitialization capabilities (default is yes)]),
++		[LSFREINITIALIZATION=$withval],[LSFREINITIALIZATION=yes]) 
++	AC_MSG_CHECKING(for LsfReinitialization capability compilation)
++
++	HAVE_LSFREINITIALIZATION=no
++	if test "x$LSFREINITIALIZATION" = "xyes"; then
++		HAVE_LSFREINITIALIZATION=yes
++		AC_DEFINE([_HAVE_LSFREINITIALIZATION_],[1],[with LsfReinitialization capability])
++	fi
++	AM_CONDITIONAL([LSFREINITIALIZATION], [test x$HAVE_LSFREINITIALIZATION = xyes])
++	AC_MSG_RESULT($HAVE_LSFREINITIALIZATION)
++	dnl }}}
++
++
++])
Index: issm/oecreview/Archive/16554-17801/ISSM-17775-17776.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17775-17776.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17775-17776.diff	(revision 17802)
@@ -0,0 +1,952 @@
+Index: ../trunk-jpl/m4/analyses.m4
+===================================================================
+--- ../trunk-jpl/m4/analyses.m4	(revision 17775)
++++ ../trunk-jpl/m4/analyses.m4	(revision 17776)
+@@ -1,3 +1,8 @@
++
++dnl   WARNING: DO NOT MODIFY THIS FILE
++dnl            this file has been automatically generated by Synchronize.sh
++dnl            Please read README for more information
++
+ # AX_ANALYSES_SELECTION
+ # -----------------
+ # Check for analyses compilation
+@@ -2,411 +7,425 @@
+ AC_DEFUN([AX_ANALYSES_SELECTION],
+-			[
+-	dnl with-AdjointBalancethickness{{{
+-	AC_ARG_WITH([AdjointBalancethickness],
+-		AS_HELP_STRING([--with-AdjointBalancethickness = YES], [compile with AdjointBalancethickness capabilities (default is yes)]),
+-		[ADJOINTBALANCETHICKNESS=$withval],[ADJOINTBALANCETHICKNESS=yes]) 
+-	AC_MSG_CHECKING(for AdjointBalancethickness capability compilation)
++[
+ 
+-	HAVE_ADJOINTBALANCETHICKNESS=no
+-	if test "x$ADJOINTBALANCETHICKNESS" = "xyes"; then
+-		HAVE_ADJOINTBALANCETHICKNESS=yes
+-		AC_DEFINE([_HAVE_ADJOINTBALANCETHICKNESS_],[1],[with AdjointBalancethickness capability])
+-	fi
+-	AM_CONDITIONAL([ADJOINTBALANCETHICKNESS], [test x$HAVE_ADJOINTBALANCETHICKNESS = xyes])
+-	AC_MSG_RESULT($HAVE_ADJOINTBALANCETHICKNESS)
+-	dnl }}}
+-	dnl with-AdjointHoriz{{{
+-	AC_ARG_WITH([AdjointHoriz],
+-		AS_HELP_STRING([--with-AdjointHoriz = YES], [compile with AdjointHoriz capabilities (default is yes)]),
+-		[ADJOINTHORIZ=$withval],[ADJOINTHORIZ=yes]) 
+-	AC_MSG_CHECKING(for AdjointHoriz capability compilation)
++dnl with-AdjointBalancethickness{{{
++AC_ARG_WITH([AdjointBalancethickness],
++	AS_HELP_STRING([--with-AdjointBalancethickness = YES], [compile with AdjointBalancethickness capabilities (default is yes)]),
++	[ADJOINTBALANCETHICKNESS=$withval],[ADJOINTBALANCETHICKNESS=yes])
++AC_MSG_CHECKING(for AdjointBalancethickness capability compilation)
+ 
+-	HAVE_ADJOINTHORIZ=no
+-	if test "x$ADJOINTHORIZ" = "xyes"; then
+-		HAVE_ADJOINTHORIZ=yes
+-		AC_DEFINE([_HAVE_ADJOINTHORIZ_],[1],[with AdjointHoriz capability])
+-	fi
+-	AM_CONDITIONAL([ADJOINTHORIZ], [test x$HAVE_ADJOINTHORIZ = xyes])
+-	AC_MSG_RESULT($HAVE_ADJOINTHORIZ)
+-	dnl }}}
+-	dnl with-Balancethickness{{{
+-	AC_ARG_WITH([Balancethickness],
+-		AS_HELP_STRING([--with-Balancethickness = YES], [compile with Balancethickness capabilities (default is yes)]),
+-		[BALANCETHICKNESS=$withval],[BALANCETHICKNESS=yes]) 
+-	AC_MSG_CHECKING(for Balancethickness capability compilation)
++HAVE_ADJOINTBALANCETHICKNESS=no 
++if test "x$ADJOINTBALANCETHICKNESS" = "xyes"; then
++	HAVE_ADJOINTBALANCETHICKNESS=yes
++	AC_DEFINE([_HAVE_ADJOINTBALANCETHICKNESS_],[1],[with AdjointBalancethicknesscapability])
++fi
++AM_CONDITIONAL([ADJOINTBALANCETHICKNESS], [test x$HAVE_ADJOINTBALANCETHICKNESS = xyes])
++AC_MSG_RESULT($HAVE_ADJOINTBALANCETHICKNESS)
++dnl }}}
++dnl with-AdjointHoriz{{{
++AC_ARG_WITH([AdjointHoriz],
++	AS_HELP_STRING([--with-AdjointHoriz = YES], [compile with AdjointHoriz capabilities (default is yes)]),
++	[ADJOINTHORIZ=$withval],[ADJOINTHORIZ=yes])
++AC_MSG_CHECKING(for AdjointHoriz capability compilation)
+ 
+-	HAVE_BALANCETHICKNESS=no
+-	if test "x$BALANCETHICKNESS" = "xyes"; then
+-		HAVE_BALANCETHICKNESS=yes
+-		AC_DEFINE([_HAVE_BALANCETHICKNESS_],[1],[with Balancethickness capability])
+-	fi
+-	AM_CONDITIONAL([BALANCETHICKNESS], [test x$HAVE_BALANCETHICKNESS = xyes])
+-	AC_MSG_RESULT($HAVE_BALANCETHICKNESS)
+-	dnl }}}
+-	dnl with-BalancethicknessSoft{{{
+-	AC_ARG_WITH([BalancethicknessSoft],
+-		AS_HELP_STRING([--with-BalancethicknessSoft = YES], [compile with BalancethicknessSoft capabilities (default is yes)]),
+-		[BALANCETHICKNESSSOFT=$withval],[BALANCETHICKNESSSOFT=yes]) 
+-	AC_MSG_CHECKING(for BalancethicknessSoft capability compilation)
++HAVE_ADJOINTHORIZ=no 
++if test "x$ADJOINTHORIZ" = "xyes"; then
++	HAVE_ADJOINTHORIZ=yes
++	AC_DEFINE([_HAVE_ADJOINTHORIZ_],[1],[with AdjointHorizcapability])
++fi
++AM_CONDITIONAL([ADJOINTHORIZ], [test x$HAVE_ADJOINTHORIZ = xyes])
++AC_MSG_RESULT($HAVE_ADJOINTHORIZ)
++dnl }}}
++dnl with-Balancethickness{{{
++AC_ARG_WITH([Balancethickness],
++	AS_HELP_STRING([--with-Balancethickness = YES], [compile with Balancethickness capabilities (default is yes)]),
++	[BALANCETHICKNESS=$withval],[BALANCETHICKNESS=yes])
++AC_MSG_CHECKING(for Balancethickness capability compilation)
+ 
+-	HAVE_BALANCETHICKNESSSOFT=no
+-	if test "x$BALANCETHICKNESSSOFT" = "xyes"; then
+-		HAVE_BALANCETHICKNESSSOFT=yes
+-		AC_DEFINE([_HAVE_BALANCETHICKNESSSOFT_],[1],[with BalancethicknessSoft capability])
+-	fi
+-	AM_CONDITIONAL([BALANCETHICKNESSSOFT], [test x$HAVE_BALANCETHICKNESSSOFT = xyes])
+-	AC_MSG_RESULT($HAVE_BALANCETHICKNESSSOFT)
+-	dnl }}}
+-	dnl with-Balancevelocity{{{
+-	AC_ARG_WITH([Balancevelocity],
+-		AS_HELP_STRING([--with-Balancevelocity = YES], [compile with Balancevelocity capabilities (default is yes)]),
+-		[BALANCEVELOCITY=$withval],[BALANCEVELOCITY=yes]) 
+-	AC_MSG_CHECKING(for Balancevelocity capability compilation)
++HAVE_BALANCETHICKNESS=no 
++if test "x$BALANCETHICKNESS" = "xyes"; then
++	HAVE_BALANCETHICKNESS=yes
++	AC_DEFINE([_HAVE_BALANCETHICKNESS_],[1],[with Balancethicknesscapability])
++fi
++AM_CONDITIONAL([BALANCETHICKNESS], [test x$HAVE_BALANCETHICKNESS = xyes])
++AC_MSG_RESULT($HAVE_BALANCETHICKNESS)
++dnl }}}
++dnl with-BalancethicknessSoft{{{
++AC_ARG_WITH([BalancethicknessSoft],
++	AS_HELP_STRING([--with-BalancethicknessSoft = YES], [compile with BalancethicknessSoft capabilities (default is yes)]),
++	[BALANCETHICKNESSSOFT=$withval],[BALANCETHICKNESSSOFT=yes])
++AC_MSG_CHECKING(for BalancethicknessSoft capability compilation)
+ 
+-	HAVE_BALANCEVELOCITY=no
+-	if test "x$BALANCEVELOCITY" = "xyes"; then
+-		HAVE_BALANCEVELOCITY=yes
+-		AC_DEFINE([_HAVE_BALANCEVELOCITY_],[1],[with Balancevelocity capability])
+-	fi
+-	AM_CONDITIONAL([BALANCEVELOCITY], [test x$HAVE_BALANCEVELOCITY = xyes])
+-	AC_MSG_RESULT($HAVE_BALANCEVELOCITY)
+-	dnl }}}
+-	dnl with-L2ProjectionEPL{{{
+-	AC_ARG_WITH([L2ProjectionEPL],
+-		AS_HELP_STRING([--with-L2ProjectionEPL = YES], [compile with L2ProjectionEPL capabilities (default is yes)]),
+-		[L2PROJECTIONEPL=$withval],[L2PROJECTIONEPL=yes]) 
+-	AC_MSG_CHECKING(for L2ProjectionEPL capability compilation)
++HAVE_BALANCETHICKNESSSOFT=no 
++if test "x$BALANCETHICKNESSSOFT" = "xyes"; then
++	HAVE_BALANCETHICKNESSSOFT=yes
++	AC_DEFINE([_HAVE_BALANCETHICKNESSSOFT_],[1],[with BalancethicknessSoftcapability])
++fi
++AM_CONDITIONAL([BALANCETHICKNESSSOFT], [test x$HAVE_BALANCETHICKNESSSOFT = xyes])
++AC_MSG_RESULT($HAVE_BALANCETHICKNESSSOFT)
++dnl }}}
++dnl with-Balancevelocity{{{
++AC_ARG_WITH([Balancevelocity],
++	AS_HELP_STRING([--with-Balancevelocity = YES], [compile with Balancevelocity capabilities (default is yes)]),
++	[BALANCEVELOCITY=$withval],[BALANCEVELOCITY=yes])
++AC_MSG_CHECKING(for Balancevelocity capability compilation)
+ 
+-	HAVE_L2PROJECTIONEPL=no
+-	if test "x$L2PROJECTIONEPL" = "xyes"; then
+-		HAVE_L2PROJECTIONEPL=yes
+-		AC_DEFINE([_HAVE_L2PROJECTIONEPL_],[1],[with L2ProjectionEPL capability])
+-	fi
+-	AM_CONDITIONAL([L2PROJECTIONEPL], [test x$HAVE_L2PROJECTIONEPL = xyes])
+-	AC_MSG_RESULT($HAVE_L2PROJECTIONEPL)
+-	dnl }}}
+-	dnl with-L2ProjectionBase{{{
+-	AC_ARG_WITH([L2ProjectionBase],
+-		AS_HELP_STRING([--with-L2ProjectionBase = YES], [compile with L2ProjectionBase capabilities (default is yes)]),
+-		[L2PROJECTIONBASE=$withval],[L2PROJECTIONBASE=yes]) 
+-	AC_MSG_CHECKING(for L2ProjectionBase capability compilation)
++HAVE_BALANCEVELOCITY=no 
++if test "x$BALANCEVELOCITY" = "xyes"; then
++	HAVE_BALANCEVELOCITY=yes
++	AC_DEFINE([_HAVE_BALANCEVELOCITY_],[1],[with Balancevelocitycapability])
++fi
++AM_CONDITIONAL([BALANCEVELOCITY], [test x$HAVE_BALANCEVELOCITY = xyes])
++AC_MSG_RESULT($HAVE_BALANCEVELOCITY)
++dnl }}}
++dnl with-L2ProjectionEPL{{{
++AC_ARG_WITH([L2ProjectionEPL],
++	AS_HELP_STRING([--with-L2ProjectionEPL = YES], [compile with L2ProjectionEPL capabilities (default is yes)]),
++	[L2PROJECTIONEPL=$withval],[L2PROJECTIONEPL=yes])
++AC_MSG_CHECKING(for L2ProjectionEPL capability compilation)
+ 
+-	HAVE_L2PROJECTIONBASE=no
+-	if test "x$L2PROJECTIONBASE" = "xyes"; then
+-		HAVE_L2PROJECTIONBASE=yes
+-		AC_DEFINE([_HAVE_L2PROJECTIONBASE_],[1],[with L2ProjectionBase capability])
+-	fi
+-	AM_CONDITIONAL([L2PROJECTIONBASE], [test x$HAVE_L2PROJECTIONBASE = xyes])
+-	AC_MSG_RESULT($HAVE_L2PROJECTIONBASE)
+-	dnl }}}
+-	dnl with-DamageEvolution{{{
+-	AC_ARG_WITH([DamageEvolution],
+-		AS_HELP_STRING([--with-DamageEvolution = YES], [compile with DamageEvolution capabilities (default is yes)]),
+-		[DAMAGEEVOLUTION=$withval],[DAMAGEEVOLUTION=yes]) 
+-	AC_MSG_CHECKING(for DamageEvolution capability compilation)
++HAVE_L2PROJECTIONEPL=no 
++if test "x$L2PROJECTIONEPL" = "xyes"; then
++	HAVE_L2PROJECTIONEPL=yes
++	AC_DEFINE([_HAVE_L2PROJECTIONEPL_],[1],[with L2ProjectionEPLcapability])
++fi
++AM_CONDITIONAL([L2PROJECTIONEPL], [test x$HAVE_L2PROJECTIONEPL = xyes])
++AC_MSG_RESULT($HAVE_L2PROJECTIONEPL)
++dnl }}}
++dnl with-L2ProjectionBase{{{
++AC_ARG_WITH([L2ProjectionBase],
++	AS_HELP_STRING([--with-L2ProjectionBase = YES], [compile with L2ProjectionBase capabilities (default is yes)]),
++	[L2PROJECTIONBASE=$withval],[L2PROJECTIONBASE=yes])
++AC_MSG_CHECKING(for L2ProjectionBase capability compilation)
+ 
+-	HAVE_DAMAGEEVOLUTION=no
+-	if test "x$DAMAGEEVOLUTION" = "xyes"; then
+-		HAVE_DAMAGEEVOLUTION=yes
+-		AC_DEFINE([_HAVE_DAMAGEEVOLUTION_],[1],[with DamageEvolution capability])
+-	fi
+-	AM_CONDITIONAL([DAMAGEEVOLUTION], [test x$HAVE_DAMAGEEVOLUTION = xyes])
+-	AC_MSG_RESULT($HAVE_DAMAGEEVOLUTION)
+-	dnl }}}
+-	dnl with-DepthAverage{{{
+-	AC_ARG_WITH([DepthAverage],
+-		AS_HELP_STRING([--with-DepthAverage = YES], [compile with DepthAverage capabilities (default is yes)]),
+-		[DEPTHAVERAGE=$withval],[DEPTHAVERAGE=yes]) 
+-	AC_MSG_CHECKING(for DepthAverage capability compilation)
++HAVE_L2PROJECTIONBASE=no 
++if test "x$L2PROJECTIONBASE" = "xyes"; then
++	HAVE_L2PROJECTIONBASE=yes
++	AC_DEFINE([_HAVE_L2PROJECTIONBASE_],[1],[with L2ProjectionBasecapability])
++fi
++AM_CONDITIONAL([L2PROJECTIONBASE], [test x$HAVE_L2PROJECTIONBASE = xyes])
++AC_MSG_RESULT($HAVE_L2PROJECTIONBASE)
++dnl }}}
++dnl with-DamageEvolution{{{
++AC_ARG_WITH([DamageEvolution],
++	AS_HELP_STRING([--with-DamageEvolution = YES], [compile with DamageEvolution capabilities (default is yes)]),
++	[DAMAGEEVOLUTION=$withval],[DAMAGEEVOLUTION=yes])
++AC_MSG_CHECKING(for DamageEvolution capability compilation)
+ 
+-	HAVE_DEPTHAVERAGE=no
+-	if test "x$DEPTHAVERAGE" = "xyes"; then
+-		HAVE_DEPTHAVERAGE=yes
+-		AC_DEFINE([_HAVE_DEPTHAVERAGE_],[1],[with DepthAverage capability])
+-	fi
+-	AM_CONDITIONAL([DEPTHAVERAGE], [test x$HAVE_DEPTHAVERAGE = xyes])
+-	AC_MSG_RESULT($HAVE_DEPTHAVERAGE)
+-	dnl }}}
+-	dnl with-stressbalance{{{
+-	AC_ARG_WITH([stressbalance],
+-		AS_HELP_STRING([--with-stressbalance = YES], [compile with stressbalance capabilities (default is yes)]),
+-		[STRESSBALANCE=$withval],[STRESSBALANCE=yes]) 
+-	AC_MSG_CHECKING(for stressbalance capability compilation)
++HAVE_DAMAGEEVOLUTION=no 
++if test "x$DAMAGEEVOLUTION" = "xyes"; then
++	HAVE_DAMAGEEVOLUTION=yes
++	AC_DEFINE([_HAVE_DAMAGEEVOLUTION_],[1],[with DamageEvolutioncapability])
++fi
++AM_CONDITIONAL([DAMAGEEVOLUTION], [test x$HAVE_DAMAGEEVOLUTION = xyes])
++AC_MSG_RESULT($HAVE_DAMAGEEVOLUTION)
++dnl }}}
++dnl with-Stressbalance{{{
++AC_ARG_WITH([Stressbalance],
++	AS_HELP_STRING([--with-Stressbalance = YES], [compile with Stressbalance capabilities (default is yes)]),
++	[STRESSBALANCE=$withval],[STRESSBALANCE=yes])
++AC_MSG_CHECKING(for Stressbalance capability compilation)
+ 
+-	HAVE_STRESSBALANCE=no
+-	if test "x$STRESSBALANCE" = "xyes"; then
+-		HAVE_STRESSBALANCE=yes
+-		AC_DEFINE([_HAVE_STRESSBALANCE_],[1],[with stressbalance capability])
+-	fi
+-	AM_CONDITIONAL([STRESSBALANCE], [test x$HAVE_STRESSBALANCE = xyes])
+-	AC_MSG_RESULT($HAVE_STRESSBALANCE)
+-	dnl }}}
+-	dnl with-stressbalanceSIA{{{
+-		AC_ARG_WITH([stressbalanceSIA],
+-					AS_HELP_STRING([--with-stressbalanceSIA = YES], [compile with stressbalanceSIA capabilities (default is yes)]),
+-					[STRESSBALANCESIA=$withval],[STRESSBALANCESIA=yes]) 
+-		  AC_MSG_CHECKING(for stressbalanceSIA capability compilation)
++HAVE_STRESSBALANCE=no 
++if test "x$STRESSBALANCE" = "xyes"; then
++	HAVE_STRESSBALANCE=yes
++	AC_DEFINE([_HAVE_STRESSBALANCE_],[1],[with Stressbalancecapability])
++fi
++AM_CONDITIONAL([STRESSBALANCE], [test x$HAVE_STRESSBALANCE = xyes])
++AC_MSG_RESULT($HAVE_STRESSBALANCE)
++dnl }}}
++dnl with-StressbalanceSIA{{{
++AC_ARG_WITH([StressbalanceSIA],
++	AS_HELP_STRING([--with-StressbalanceSIA = YES], [compile with StressbalanceSIA capabilities (default is yes)]),
++	[STRESSBALANCESIA=$withval],[STRESSBALANCESIA=yes])
++AC_MSG_CHECKING(for StressbalanceSIA capability compilation)
+ 
+-		  HAVE_STRESSBALANCESIA=no
+-		  if test "x$STRESSBALANCESIA" = "xyes"; then
+-			HAVE_STRESSBALANCESIA=yes
+-			  AC_DEFINE([_HAVE_STRESSBALANCESIA_],[1],[with stressbalanceSIA capability])
+-			  fi
+-			  AM_CONDITIONAL([STRESSBALANCESIA], [test x$HAVE_STRESSBALANCESIA = xyes])
+-			  AC_MSG_RESULT($HAVE_STRESSBALANCESIA)
+-			  dnl }}}
+-	dnl with-StressbalanceVertical{{{
+-	AC_ARG_WITH([StressbalanceVertical],
+-		AS_HELP_STRING([--with-StressbalanceVertical = YES], [compile with StressbalanceVertical capabilities (default is yes)]),
+-		[STRESSBALANCEVERTICAL=$withval],[STRESSBALANCEVERTICAL=yes]) 
+-	AC_MSG_CHECKING(for StressbalanceVertical capability compilation)
++HAVE_STRESSBALANCESIA=no 
++if test "x$STRESSBALANCESIA" = "xyes"; then
++	HAVE_STRESSBALANCESIA=yes
++	AC_DEFINE([_HAVE_STRESSBALANCESIA_],[1],[with StressbalanceSIAcapability])
++fi
++AM_CONDITIONAL([STRESSBALANCESIA], [test x$HAVE_STRESSBALANCESIA = xyes])
++AC_MSG_RESULT($HAVE_STRESSBALANCESIA)
++dnl }}}
++dnl with-StressbalanceVertical{{{
++AC_ARG_WITH([StressbalanceVertical],
++	AS_HELP_STRING([--with-StressbalanceVertical = YES], [compile with StressbalanceVertical capabilities (default is yes)]),
++	[STRESSBALANCEVERTICAL=$withval],[STRESSBALANCEVERTICAL=yes])
++AC_MSG_CHECKING(for StressbalanceVertical capability compilation)
+ 
+-	HAVE_STRESSBALANCEVERTICAL=no
+-	if test "x$STRESSBALANCEVERTICAL" = "xyes"; then
+-		HAVE_STRESSBALANCEVERTICAL=yes
+-		AC_DEFINE([_HAVE_STRESSBALANCEVERTICAL_],[1],[with StressbalanceVertical capability])
+-	fi
+-	AM_CONDITIONAL([STRESSBALANCEVERTICAL], [test x$HAVE_STRESSBALANCEVERTICAL = xyes])
+-	AC_MSG_RESULT($HAVE_STRESSBALANCEVERTICAL)
+-	dnl }}}
+-	dnl with-Enthalpy{{{
+-	AC_ARG_WITH([Enthalpy],
+-		AS_HELP_STRING([--with-Enthalpy = YES], [compile with Enthalpy capabilities (default is yes)]),
+-		[ENTHALPY=$withval],[ENTHALPY=yes]) 
+-	AC_MSG_CHECKING(for Enthalpy capability compilation)
++HAVE_STRESSBALANCEVERTICAL=no 
++if test "x$STRESSBALANCEVERTICAL" = "xyes"; then
++	HAVE_STRESSBALANCEVERTICAL=yes
++	AC_DEFINE([_HAVE_STRESSBALANCEVERTICAL_],[1],[with StressbalanceVerticalcapability])
++fi
++AM_CONDITIONAL([STRESSBALANCEVERTICAL], [test x$HAVE_STRESSBALANCEVERTICAL = xyes])
++AC_MSG_RESULT($HAVE_STRESSBALANCEVERTICAL)
++dnl }}}
++dnl with-Enthalpy{{{
++AC_ARG_WITH([Enthalpy],
++	AS_HELP_STRING([--with-Enthalpy = YES], [compile with Enthalpy capabilities (default is yes)]),
++	[ENTHALPY=$withval],[ENTHALPY=yes])
++AC_MSG_CHECKING(for Enthalpy capability compilation)
+ 
+-	HAVE_ENTHALPY=no
+-	if test "x$ENTHALPY" = "xyes"; then
+-		HAVE_ENTHALPY=yes
+-		AC_DEFINE([_HAVE_ENTHALPY_],[1],[with Enthalpy capability])
+-	fi
+-	AM_CONDITIONAL([ENTHALPY], [test x$HAVE_ENTHALPY = xyes])
+-	AC_MSG_RESULT($HAVE_ENTHALPY)
+-	dnl }}}
+-	dnl with-HydrologyShreve{{{
+-	AC_ARG_WITH([HydrologyShreve],
+-		AS_HELP_STRING([--with-HydrologyShreve = YES], [compile with HydrologyShreve capabilities (default is yes)]),
+-		[HYDROLOGYSHREVE=$withval],[HYDROLOGYSHREVE=yes]) 
+-	AC_MSG_CHECKING(for HydrologyShreve capability compilation)
++HAVE_ENTHALPY=no 
++if test "x$ENTHALPY" = "xyes"; then
++	HAVE_ENTHALPY=yes
++	AC_DEFINE([_HAVE_ENTHALPY_],[1],[with Enthalpycapability])
++fi
++AM_CONDITIONAL([ENTHALPY], [test x$HAVE_ENTHALPY = xyes])
++AC_MSG_RESULT($HAVE_ENTHALPY)
++dnl }}}
++dnl with-HydrologyShreve{{{
++AC_ARG_WITH([HydrologyShreve],
++	AS_HELP_STRING([--with-HydrologyShreve = YES], [compile with HydrologyShreve capabilities (default is yes)]),
++	[HYDROLOGYSHREVE=$withval],[HYDROLOGYSHREVE=yes])
++AC_MSG_CHECKING(for HydrologyShreve capability compilation)
+ 
+-	HAVE_HYDROLOGYSHREVE=no
+-	if test "x$HYDROLOGYSHREVE" = "xyes"; then
+-		HAVE_HYDROLOGYSHREVE=yes
+-		AC_DEFINE([_HAVE_HYDROLOGYSHREVE_],[1],[with HydrologyShreve capability])
+-	fi
+-	AM_CONDITIONAL([HYDROLOGYSHREVE], [test x$HAVE_HYDROLOGYSHREVE = xyes])
+-	AC_MSG_RESULT($HAVE_HYDROLOGYSHREVE)
+-	dnl }}}
+-	dnl with-HydrologyDCInefficient{{{
+-	AC_ARG_WITH([HydrologyDCInefficient],
+-		AS_HELP_STRING([--with-HydrologyDCInefficient = YES], [compile with HydrologyDCInefficient capabilities (default is yes)]),
+-		[HYDROLOGYDCINEFFICIENT=$withval],[HYDROLOGYDCINEFFICIENT=yes]) 
+-	AC_MSG_CHECKING(for HydrologyDCInefficient capability compilation)
++HAVE_HYDROLOGYSHREVE=no 
++if test "x$HYDROLOGYSHREVE" = "xyes"; then
++	HAVE_HYDROLOGYSHREVE=yes
++	AC_DEFINE([_HAVE_HYDROLOGYSHREVE_],[1],[with HydrologyShrevecapability])
++fi
++AM_CONDITIONAL([HYDROLOGYSHREVE], [test x$HAVE_HYDROLOGYSHREVE = xyes])
++AC_MSG_RESULT($HAVE_HYDROLOGYSHREVE)
++dnl }}}
++dnl with-HydrologyDCInefficient{{{
++AC_ARG_WITH([HydrologyDCInefficient],
++	AS_HELP_STRING([--with-HydrologyDCInefficient = YES], [compile with HydrologyDCInefficient capabilities (default is yes)]),
++	[HYDROLOGYDCINEFFICIENT=$withval],[HYDROLOGYDCINEFFICIENT=yes])
++AC_MSG_CHECKING(for HydrologyDCInefficient capability compilation)
+ 
+-	HAVE_HYDROLOGYDCINEFFICIENT=no
+-	if test "x$HYDROLOGYDCINEFFICIENT" = "xyes"; then
+-		HAVE_HYDROLOGYDCINEFFICIENT=yes
+-		AC_DEFINE([_HAVE_HYDROLOGYDCINEFFICIENT_],[1],[with HydrologyDCInefficient capability])
+-	fi
+-	AM_CONDITIONAL([HYDROLOGYDCINEFFICIENT], [test x$HAVE_HYDROLOGYDCINEFFICIENT = xyes])
+-	AC_MSG_RESULT($HAVE_HYDROLOGYDCINEFFICIENT)
+-	dnl }}}
+-	dnl with-HydrologyDCEfficient{{{
+-	AC_ARG_WITH([HydrologyDCEfficient],
+-		AS_HELP_STRING([--with-HydrologyDCEfficient = YES], [compile with HydrologyDCEfficient capabilities (default is yes)]),
+-		[HYDROLOGYDCEFFICIENT=$withval],[HYDROLOGYDCEFFICIENT=yes]) 
+-	AC_MSG_CHECKING(for HydrologyDCEfficient capability compilation)
++HAVE_HYDROLOGYDCINEFFICIENT=no 
++if test "x$HYDROLOGYDCINEFFICIENT" = "xyes"; then
++	HAVE_HYDROLOGYDCINEFFICIENT=yes
++	AC_DEFINE([_HAVE_HYDROLOGYDCINEFFICIENT_],[1],[with HydrologyDCInefficientcapability])
++fi
++AM_CONDITIONAL([HYDROLOGYDCINEFFICIENT], [test x$HAVE_HYDROLOGYDCINEFFICIENT = xyes])
++AC_MSG_RESULT($HAVE_HYDROLOGYDCINEFFICIENT)
++dnl }}}
++dnl with-HydrologyDCEfficient{{{
++AC_ARG_WITH([HydrologyDCEfficient],
++	AS_HELP_STRING([--with-HydrologyDCEfficient = YES], [compile with HydrologyDCEfficient capabilities (default is yes)]),
++	[HYDROLOGYDCEFFICIENT=$withval],[HYDROLOGYDCEFFICIENT=yes])
++AC_MSG_CHECKING(for HydrologyDCEfficient capability compilation)
+ 
+-	HAVE_HYDROLOGYDCEFFICIENT=no
+-	if test "x$HYDROLOGYDCEFFICIENT" = "xyes"; then
+-		HAVE_HYDROLOGYDCEFFICIENT=yes
+-		AC_DEFINE([_HAVE_HYDROLOGYDCEFFICIENT_],[1],[with HydrologyDCEfficient capability])
+-	fi
+-	AM_CONDITIONAL([HYDROLOGYDCEFFICIENT], [test x$HAVE_HYDROLOGYDCEFFICIENT = xyes])
+-	AC_MSG_RESULT($HAVE_HYDROLOGYDCEFFICIENT)
+-	dnl }}}
+-	dnl with-Melting{{{
+-	AC_ARG_WITH([Melting],
+-		AS_HELP_STRING([--with-Melting = YES], [compile with Melting capabilities (default is yes)]),
+-		[MELTING=$withval],[MELTING=yes]) 
+-	AC_MSG_CHECKING(for Melting capability compilation)
++HAVE_HYDROLOGYDCEFFICIENT=no 
++if test "x$HYDROLOGYDCEFFICIENT" = "xyes"; then
++	HAVE_HYDROLOGYDCEFFICIENT=yes
++	AC_DEFINE([_HAVE_HYDROLOGYDCEFFICIENT_],[1],[with HydrologyDCEfficientcapability])
++fi
++AM_CONDITIONAL([HYDROLOGYDCEFFICIENT], [test x$HAVE_HYDROLOGYDCEFFICIENT = xyes])
++AC_MSG_RESULT($HAVE_HYDROLOGYDCEFFICIENT)
++dnl }}}
++dnl with-Melting{{{
++AC_ARG_WITH([Melting],
++	AS_HELP_STRING([--with-Melting = YES], [compile with Melting capabilities (default is yes)]),
++	[MELTING=$withval],[MELTING=yes])
++AC_MSG_CHECKING(for Melting capability compilation)
+ 
+-	HAVE_MELTING=no
+-	if test "x$MELTING" = "xyes"; then
+-		HAVE_MELTING=yes
+-		AC_DEFINE([_HAVE_MELTING_],[1],[with Melting capability])
+-	fi
+-	AM_CONDITIONAL([MELTING], [test x$HAVE_MELTING = xyes])
+-	AC_MSG_RESULT($HAVE_MELTING)
+-	dnl }}}
+-	dnl with-Masstransport{{{
+-	AC_ARG_WITH([Masstransport],
+-		AS_HELP_STRING([--with-Masstransport = YES], [compile with Masstransport capabilities (default is yes)]),
+-		[MASSTRANSPORT=$withval],[MASSTRANSPORT=yes]) 
+-	AC_MSG_CHECKING(for Masstransport capability compilation)
++HAVE_MELTING=no 
++if test "x$MELTING" = "xyes"; then
++	HAVE_MELTING=yes
++	AC_DEFINE([_HAVE_MELTING_],[1],[with Meltingcapability])
++fi
++AM_CONDITIONAL([MELTING], [test x$HAVE_MELTING = xyes])
++AC_MSG_RESULT($HAVE_MELTING)
++dnl }}}
++dnl with-Masstransport{{{
++AC_ARG_WITH([Masstransport],
++	AS_HELP_STRING([--with-Masstransport = YES], [compile with Masstransport capabilities (default is yes)]),
++	[MASSTRANSPORT=$withval],[MASSTRANSPORT=yes])
++AC_MSG_CHECKING(for Masstransport capability compilation)
+ 
+-	HAVE_MASSTRANSPORT=no
+-	if test "x$MASSTRANSPORT" = "xyes"; then
+-		HAVE_MASSTRANSPORT=yes
+-		AC_DEFINE([_HAVE_MASSTRANSPORT_],[1],[with Masstransport capability])
+-	fi
+-	AM_CONDITIONAL([MASSTRANSPORT], [test x$HAVE_MASSTRANSPORT = xyes])
+-	AC_MSG_RESULT($HAVE_MASSTRANSPORT)
+-	dnl }}}
+-	dnl with-FreeSurfaceBase{{{
+-	AC_ARG_WITH([FreeSurfaceBase],
+-		AS_HELP_STRING([--with-FreeSurfaceBase = YES], [compile with FreeSurfaceBase capabilities (default is yes)]),
+-		[FREESURFACEBASE=$withval],[FREESURFACEBASE=yes]) 
+-	AC_MSG_CHECKING(for FreeSurfaceBase capability compilation)
++HAVE_MASSTRANSPORT=no 
++if test "x$MASSTRANSPORT" = "xyes"; then
++	HAVE_MASSTRANSPORT=yes
++	AC_DEFINE([_HAVE_MASSTRANSPORT_],[1],[with Masstransportcapability])
++fi
++AM_CONDITIONAL([MASSTRANSPORT], [test x$HAVE_MASSTRANSPORT = xyes])
++AC_MSG_RESULT($HAVE_MASSTRANSPORT)
++dnl }}}
++dnl with-FreeSurfaceBase{{{
++AC_ARG_WITH([FreeSurfaceBase],
++	AS_HELP_STRING([--with-FreeSurfaceBase = YES], [compile with FreeSurfaceBase capabilities (default is yes)]),
++	[FREESURFACEBASE=$withval],[FREESURFACEBASE=yes])
++AC_MSG_CHECKING(for FreeSurfaceBase capability compilation)
+ 
+-	HAVE_FREESURFACEBASE=no
+-	if test "x$FREESURFACEBASE" = "xyes"; then
+-		HAVE_FREESURFACEBASE=yes
+-		AC_DEFINE([_HAVE_FREESURFACEBASE_],[1],[with FreeSurfaceBase capability])
+-	fi
+-	AM_CONDITIONAL([FREESURFACEBASE], [test x$HAVE_FREESURFACEBASE = xyes])
+-	AC_MSG_RESULT($HAVE_FREESURFACEBASE)
+-	dnl }}}
+-	dnl with-FreeSurfaceTop{{{
+-		AC_ARG_WITH([FreeSurfaceTop],
+-					AS_HELP_STRING([--with-FreeSurfaceTop = YES], [compile with FreeSurfaceTop capabilities (default is yes)]),
+-					[FREESURFACETOP=$withval],[FREESURFACETOP=yes]) 
+-		  AC_MSG_CHECKING(for FreeSurfaceTop capability compilation)
++HAVE_FREESURFACEBASE=no 
++if test "x$FREESURFACEBASE" = "xyes"; then
++	HAVE_FREESURFACEBASE=yes
++	AC_DEFINE([_HAVE_FREESURFACEBASE_],[1],[with FreeSurfaceBasecapability])
++fi
++AM_CONDITIONAL([FREESURFACEBASE], [test x$HAVE_FREESURFACEBASE = xyes])
++AC_MSG_RESULT($HAVE_FREESURFACEBASE)
++dnl }}}
++dnl with-FreeSurfaceTop{{{
++AC_ARG_WITH([FreeSurfaceTop],
++	AS_HELP_STRING([--with-FreeSurfaceTop = YES], [compile with FreeSurfaceTop capabilities (default is yes)]),
++	[FREESURFACETOP=$withval],[FREESURFACETOP=yes])
++AC_MSG_CHECKING(for FreeSurfaceTop capability compilation)
+ 
+-		  HAVE_FREESURFACETOP=no
+-		  if test "x$FREESURFACETOP" = "xyes"; then
+-			HAVE_FREESURFACETOP=yes
+-			  AC_DEFINE([_HAVE_FREESURFACETOP_],[1],[with FreeSurfaceTop capability])
+-			  fi
+-			  AM_CONDITIONAL([FREESURFACETOP], [test x$HAVE_FREESURFACETOP = xyes])
+-			  AC_MSG_RESULT($HAVE_FREESURFACETOP)
+-			  dnl }}}
+-	dnl with-ExtrudeFromBase{{{
+-	AC_ARG_WITH([ExtrudeFromBase],
+-		AS_HELP_STRING([--with-ExtrudeFromBase = YES], [compile with ExtrudeFromBase capabilities (default is yes)]),
+-		[EXTRUDEFROMBASE=$withval],[EXTRUDEFROMBASE=yes]) 
+-	AC_MSG_CHECKING(for ExtrudeFromBase capability compilation)
++HAVE_FREESURFACETOP=no 
++if test "x$FREESURFACETOP" = "xyes"; then
++	HAVE_FREESURFACETOP=yes
++	AC_DEFINE([_HAVE_FREESURFACETOP_],[1],[with FreeSurfaceTopcapability])
++fi
++AM_CONDITIONAL([FREESURFACETOP], [test x$HAVE_FREESURFACETOP = xyes])
++AC_MSG_RESULT($HAVE_FREESURFACETOP)
++dnl }}}
++dnl with-ExtrudeFromBase{{{
++AC_ARG_WITH([ExtrudeFromBase],
++	AS_HELP_STRING([--with-ExtrudeFromBase = YES], [compile with ExtrudeFromBase capabilities (default is yes)]),
++	[EXTRUDEFROMBASE=$withval],[EXTRUDEFROMBASE=yes])
++AC_MSG_CHECKING(for ExtrudeFromBase capability compilation)
+ 
+-	HAVE_EXTRUDEFROMBASE=no
+-	if test "x$EXTRUDEFROMBASE" = "xyes"; then
+-		HAVE_EXTRUDEFROMBASE=yes
+-		AC_DEFINE([_HAVE_EXTRUDEFROMBASE_],[1],[with ExtrudeFromBase capability])
+-	fi
+-	AM_CONDITIONAL([EXTRUDEFROMBASE], [test x$HAVE_EXTRUDEFROMBASE = xyes])
+-	AC_MSG_RESULT($HAVE_EXTRUDEFROMBASE)
+-	dnl }}}
+-	dnl with-ExtrudeFromTop{{{
+-		AC_ARG_WITH([ExtrudeFromTop],
+-					AS_HELP_STRING([--with-ExtrudeFromTop = YES], [compile with ExtrudeFromTop capabilities (default is yes)]),
+-					[EXTRUDEFROMTOP=$withval],[EXTRUDEFROMTOP=yes]) 
+-		  AC_MSG_CHECKING(for ExtrudeFromTop capability compilation)
++HAVE_EXTRUDEFROMBASE=no 
++if test "x$EXTRUDEFROMBASE" = "xyes"; then
++	HAVE_EXTRUDEFROMBASE=yes
++	AC_DEFINE([_HAVE_EXTRUDEFROMBASE_],[1],[with ExtrudeFromBasecapability])
++fi
++AM_CONDITIONAL([EXTRUDEFROMBASE], [test x$HAVE_EXTRUDEFROMBASE = xyes])
++AC_MSG_RESULT($HAVE_EXTRUDEFROMBASE)
++dnl }}}
++dnl with-ExtrudeFromTop{{{
++AC_ARG_WITH([ExtrudeFromTop],
++	AS_HELP_STRING([--with-ExtrudeFromTop = YES], [compile with ExtrudeFromTop capabilities (default is yes)]),
++	[EXTRUDEFROMTOP=$withval],[EXTRUDEFROMTOP=yes])
++AC_MSG_CHECKING(for ExtrudeFromTop capability compilation)
+ 
+-		  HAVE_EXTRUDEFROMTOP=no
+-		  if test "x$EXTRUDEFROMTOP" = "xyes"; then
+-			HAVE_EXTRUDEFROMTOP=yes
+-			  AC_DEFINE([_HAVE_EXTRUDEFROMTOP_],[1],[with ExtrudeFromTop capability])
+-			  fi
+-			  AM_CONDITIONAL([EXTRUDEFROMTOP], [test x$HAVE_EXTRUDEFROMTOP = xyes])
+-			  AC_MSG_RESULT($HAVE_EXTRUDEFROMTOP)
+-			  dnl }}}
+-	dnl with-Thermal{{{
+-	AC_ARG_WITH([Thermal],
+-		AS_HELP_STRING([--with-Thermal = YES], [compile with Thermal capabilities (default is yes)]),
+-		[THERMAL=$withval],[THERMAL=yes]) 
+-	AC_MSG_CHECKING(for Thermal capability compilation)
++HAVE_EXTRUDEFROMTOP=no 
++if test "x$EXTRUDEFROMTOP" = "xyes"; then
++	HAVE_EXTRUDEFROMTOP=yes
++	AC_DEFINE([_HAVE_EXTRUDEFROMTOP_],[1],[with ExtrudeFromTopcapability])
++fi
++AM_CONDITIONAL([EXTRUDEFROMTOP], [test x$HAVE_EXTRUDEFROMTOP = xyes])
++AC_MSG_RESULT($HAVE_EXTRUDEFROMTOP)
++dnl }}}
++dnl with-DepthAverage{{{
++AC_ARG_WITH([DepthAverage],
++	AS_HELP_STRING([--with-DepthAverage = YES], [compile with DepthAverage capabilities (default is yes)]),
++	[DEPTHAVERAGE=$withval],[DEPTHAVERAGE=yes])
++AC_MSG_CHECKING(for DepthAverage capability compilation)
+ 
+-	HAVE_THERMAL=no
+-	if test "x$THERMAL" = "xyes"; then
+-		HAVE_THERMAL=yes
+-		AC_DEFINE([_HAVE_THERMAL_],[1],[with Thermal capability])
+-	fi
+-	AM_CONDITIONAL([THERMAL], [test x$HAVE_THERMAL = xyes])
+-	AC_MSG_RESULT($HAVE_THERMAL)
+-	dnl }}}
+-	dnl with-SmoothedSurfaceSlopeX{{{
+-	AC_ARG_WITH([SmoothedSurfaceSlopeX],
+-		AS_HELP_STRING([--with-SmoothedSurfaceSlopeX = YES], [compile with SmoothedSurfaceSlopeX capabilities (default is yes)]),
+-		[SMOOTHEDSURFACESLOPEX=$withval],[SMOOTHEDSURFACESLOPEX=yes]) 
+-	AC_MSG_CHECKING(for SmoothedSurfaceSlopeX capability compilation)
++HAVE_DEPTHAVERAGE=no 
++if test "x$DEPTHAVERAGE" = "xyes"; then
++	HAVE_DEPTHAVERAGE=yes
++	AC_DEFINE([_HAVE_DEPTHAVERAGE_],[1],[with DepthAveragecapability])
++fi
++AM_CONDITIONAL([DEPTHAVERAGE], [test x$HAVE_DEPTHAVERAGE = xyes])
++AC_MSG_RESULT($HAVE_DEPTHAVERAGE)
++dnl }}}
++dnl with-SmoothedSurfaceSlopeX{{{
++AC_ARG_WITH([SmoothedSurfaceSlopeX],
++	AS_HELP_STRING([--with-SmoothedSurfaceSlopeX = YES], [compile with SmoothedSurfaceSlopeX capabilities (default is yes)]),
++	[SMOOTHEDSURFACESLOPEX=$withval],[SMOOTHEDSURFACESLOPEX=yes])
++AC_MSG_CHECKING(for SmoothedSurfaceSlopeX capability compilation)
+ 
+-	HAVE_SMOOTHEDSURFACESLOPEX=no
+-	if test "x$SMOOTHEDSURFACESLOPEX" = "xyes"; then
+-		HAVE_SMOOTHEDSURFACESLOPEX=yes
+-		AC_DEFINE([_HAVE_SMOOTHEDSURFACESLOPEX_],[1],[with SmoothedSurfaceSlopeX capability])
+-	fi
+-	AM_CONDITIONAL([SMOOTHEDSURFACESLOPEX], [test x$HAVE_SMOOTHEDSURFACESLOPEX = xyes])
+-	AC_MSG_RESULT($HAVE_SMOOTHEDSURFACESLOPEX)
+-	dnl }}}
+-	dnl with-SmoothedSurfaceSlopeY{{{
+-	AC_ARG_WITH([SmoothedSurfaceSlopeY],
+-		AS_HELP_STRING([--with-SmoothedSurfaceSlopeY = YES], [compile with SmoothedSurfaceSlopeY capabilities (default is yes)]),
+-		[SMOOTHEDSURFACESLOPEY=$withval],[SMOOTHEDSURFACESLOPEY=yes]) 
+-	AC_MSG_CHECKING(for SmoothedSurfaceSlopeY capability compilation)
++HAVE_SMOOTHEDSURFACESLOPEX=no 
++if test "x$SMOOTHEDSURFACESLOPEX" = "xyes"; then
++	HAVE_SMOOTHEDSURFACESLOPEX=yes
++	AC_DEFINE([_HAVE_SMOOTHEDSURFACESLOPEX_],[1],[with SmoothedSurfaceSlopeXcapability])
++fi
++AM_CONDITIONAL([SMOOTHEDSURFACESLOPEX], [test x$HAVE_SMOOTHEDSURFACESLOPEX = xyes])
++AC_MSG_RESULT($HAVE_SMOOTHEDSURFACESLOPEX)
++dnl }}}
++dnl with-SmoothedSurfaceSlopeY{{{
++AC_ARG_WITH([SmoothedSurfaceSlopeY],
++	AS_HELP_STRING([--with-SmoothedSurfaceSlopeY = YES], [compile with SmoothedSurfaceSlopeY capabilities (default is yes)]),
++	[SMOOTHEDSURFACESLOPEY=$withval],[SMOOTHEDSURFACESLOPEY=yes])
++AC_MSG_CHECKING(for SmoothedSurfaceSlopeY capability compilation)
+ 
+-	HAVE_SMOOTHEDSURFACESLOPEY=no
+-	if test "x$SMOOTHEDSURFACESLOPEY" = "xyes"; then
+-		HAVE_SMOOTHEDSURFACESLOPEY=yes
+-		AC_DEFINE([_HAVE_SMOOTHEDSURFACESLOPEY_],[1],[with SmoothedSurfaceSlopeY capability])
+-	fi
+-	AM_CONDITIONAL([SMOOTHEDSURFACESLOPEY], [test x$HAVE_SMOOTHEDSURFACESLOPEY = xyes])
+-	AC_MSG_RESULT($HAVE_SMOOTHEDSURFACESLOPEY)
+-	dnl }}}
+-	dnl with-Meshdeformation{{{
+-	AC_ARG_WITH([Meshdeformation],
+-		AS_HELP_STRING([--with-Meshdeformation = YES], [compile with Meshdeformation capabilities (default is yes)]),
+-		[MESHDEFORMATION=$withval],[MESHDEFORMATION=yes]) 
+-	AC_MSG_CHECKING(for Meshdeformation capability compilation)
++HAVE_SMOOTHEDSURFACESLOPEY=no 
++if test "x$SMOOTHEDSURFACESLOPEY" = "xyes"; then
++	HAVE_SMOOTHEDSURFACESLOPEY=yes
++	AC_DEFINE([_HAVE_SMOOTHEDSURFACESLOPEY_],[1],[with SmoothedSurfaceSlopeYcapability])
++fi
++AM_CONDITIONAL([SMOOTHEDSURFACESLOPEY], [test x$HAVE_SMOOTHEDSURFACESLOPEY = xyes])
++AC_MSG_RESULT($HAVE_SMOOTHEDSURFACESLOPEY)
++dnl }}}
++dnl with-Thermal{{{
++AC_ARG_WITH([Thermal],
++	AS_HELP_STRING([--with-Thermal = YES], [compile with Thermal capabilities (default is yes)]),
++	[THERMAL=$withval],[THERMAL=yes])
++AC_MSG_CHECKING(for Thermal capability compilation)
+ 
+-	HAVE_MESHDEFORMATION=no
+-	if test "x$MESHDEFORMATION" = "xyes"; then
+-		HAVE_MESHDEFORMATION=yes
+-		AC_DEFINE([_HAVE_MESHDEFORMATION_],[1],[with Meshdeformation capability])
+-	fi
+-	AM_CONDITIONAL([MESHDEFORMATION], [test x$HAVE_MESHDEFORMATION = xyes])
+-	AC_MSG_RESULT($HAVE_MESHDEFORMATION)
+-	dnl }}}
+-	dnl with-Levelset{{{
+-	AC_ARG_WITH([Levelset],
+-		AS_HELP_STRING([--with-Levelset = YES], [compile with Levelset capabilities (default is yes)]),
+-		[LEVELSET=$withval],[LEVELSET=yes]) 
+-	AC_MSG_CHECKING(for Levelset capability compilation)
++HAVE_THERMAL=no 
++if test "x$THERMAL" = "xyes"; then
++	HAVE_THERMAL=yes
++	AC_DEFINE([_HAVE_THERMAL_],[1],[with Thermalcapability])
++fi
++AM_CONDITIONAL([THERMAL], [test x$HAVE_THERMAL = xyes])
++AC_MSG_RESULT($HAVE_THERMAL)
++dnl }}}
++dnl with-Gia{{{
++AC_ARG_WITH([Gia],
++	AS_HELP_STRING([--with-Gia = YES], [compile with Gia capabilities (default is yes)]),
++	[GIA=$withval],[GIA=yes])
++AC_MSG_CHECKING(for Gia capability compilation)
+ 
+-	HAVE_LEVELSET=no
+-	if test "x$LEVELSET" = "xyes"; then
+-		HAVE_LEVELSET=yes
+-		AC_DEFINE([_HAVE_LEVELSET_],[1],[with Levelset capability])
+-	fi
+-	AM_CONDITIONAL([LEVELSET], [test x$HAVE_LEVELSET = xyes])
+-	AC_MSG_RESULT($HAVE_LEVELSET)
+-	dnl }}}
+-	dnl with-Extrapolation{{{
+-	AC_ARG_WITH([Extrapolation],
+-		AS_HELP_STRING([--with-Extrapolation = YES], [compile with Extrapolation capabilities (default is yes)]),
+-		[EXTRAPOLATION=$withval],[EXTRAPOLATION=yes]) 
+-	AC_MSG_CHECKING(for Extrapolation capability compilation)
++HAVE_GIA=no 
++if test "x$GIA" = "xyes"; then
++	HAVE_GIA=yes
++	AC_DEFINE([_HAVE_GIA_],[1],[with Giacapability])
++fi
++AM_CONDITIONAL([GIA], [test x$HAVE_GIA = xyes])
++AC_MSG_RESULT($HAVE_GIA)
++dnl }}}
++dnl with-Meshdeformation{{{
++AC_ARG_WITH([Meshdeformation],
++	AS_HELP_STRING([--with-Meshdeformation = YES], [compile with Meshdeformation capabilities (default is yes)]),
++	[MESHDEFORMATION=$withval],[MESHDEFORMATION=yes])
++AC_MSG_CHECKING(for Meshdeformation capability compilation)
+ 
+-	HAVE_EXTRAPOLATION=no
+-	if test "x$EXTRAPOLATION" = "xyes"; then
+-		HAVE_EXTRAPOLATION=yes
+-		AC_DEFINE([_HAVE_EXTRAPOLATION_],[1],[with Extrapolation capability])
+-	fi
+-	AM_CONDITIONAL([EXTRAPOLATION], [test x$HAVE_EXTRAPOLATION = xyes])
+-	AC_MSG_RESULT($HAVE_EXTRAPOLATION)
+-	dnl }}}
+-	dnl with-LsfReinitialization{{{
+-	AC_ARG_WITH([LsfReinitialization],
+-		AS_HELP_STRING([--with-LsfReinitialization = YES], [compile with LsfReinitialization capabilities (default is yes)]),
+-		[LSFREINITIALIZATION=$withval],[LSFREINITIALIZATION=yes]) 
+-	AC_MSG_CHECKING(for LsfReinitialization capability compilation)
++HAVE_MESHDEFORMATION=no 
++if test "x$MESHDEFORMATION" = "xyes"; then
++	HAVE_MESHDEFORMATION=yes
++	AC_DEFINE([_HAVE_MESHDEFORMATION_],[1],[with Meshdeformationcapability])
++fi
++AM_CONDITIONAL([MESHDEFORMATION], [test x$HAVE_MESHDEFORMATION = xyes])
++AC_MSG_RESULT($HAVE_MESHDEFORMATION)
++dnl }}}
++dnl with-Levelset{{{
++AC_ARG_WITH([Levelset],
++	AS_HELP_STRING([--with-Levelset = YES], [compile with Levelset capabilities (default is yes)]),
++	[LEVELSET=$withval],[LEVELSET=yes])
++AC_MSG_CHECKING(for Levelset capability compilation)
+ 
+-	HAVE_LSFREINITIALIZATION=no
+-	if test "x$LSFREINITIALIZATION" = "xyes"; then
+-		HAVE_LSFREINITIALIZATION=yes
+-		AC_DEFINE([_HAVE_LSFREINITIALIZATION_],[1],[with LsfReinitialization capability])
+-	fi
+-	AM_CONDITIONAL([LSFREINITIALIZATION], [test x$HAVE_LSFREINITIALIZATION = xyes])
+-	AC_MSG_RESULT($HAVE_LSFREINITIALIZATION)
+-	dnl }}}
++HAVE_LEVELSET=no 
++if test "x$LEVELSET" = "xyes"; then
++	HAVE_LEVELSET=yes
++	AC_DEFINE([_HAVE_LEVELSET_],[1],[with Levelsetcapability])
++fi
++AM_CONDITIONAL([LEVELSET], [test x$HAVE_LEVELSET = xyes])
++AC_MSG_RESULT($HAVE_LEVELSET)
++dnl }}}
++dnl with-Extrapolation{{{
++AC_ARG_WITH([Extrapolation],
++	AS_HELP_STRING([--with-Extrapolation = YES], [compile with Extrapolation capabilities (default is yes)]),
++	[EXTRAPOLATION=$withval],[EXTRAPOLATION=yes])
++AC_MSG_CHECKING(for Extrapolation capability compilation)
+ 
++HAVE_EXTRAPOLATION=no 
++if test "x$EXTRAPOLATION" = "xyes"; then
++	HAVE_EXTRAPOLATION=yes
++	AC_DEFINE([_HAVE_EXTRAPOLATION_],[1],[with Extrapolationcapability])
++fi
++AM_CONDITIONAL([EXTRAPOLATION], [test x$HAVE_EXTRAPOLATION = xyes])
++AC_MSG_RESULT($HAVE_EXTRAPOLATION)
++dnl }}}
++dnl with-LsfReinitialization{{{
++AC_ARG_WITH([LsfReinitialization],
++	AS_HELP_STRING([--with-LsfReinitialization = YES], [compile with LsfReinitialization capabilities (default is yes)]),
++	[LSFREINITIALIZATION=$withval],[LSFREINITIALIZATION=yes])
++AC_MSG_CHECKING(for LsfReinitialization capability compilation)
+ 
++HAVE_LSFREINITIALIZATION=no 
++if test "x$LSFREINITIALIZATION" = "xyes"; then
++	HAVE_LSFREINITIALIZATION=yes
++	AC_DEFINE([_HAVE_LSFREINITIALIZATION_],[1],[with LsfReinitializationcapability])
++fi
++AM_CONDITIONAL([LSFREINITIALIZATION], [test x$HAVE_LSFREINITIALIZATION = xyes])
++AC_MSG_RESULT($HAVE_LSFREINITIALIZATION)
++dnl }}}
++
+ ])
+Index: ../trunk-jpl/src/c/shared/Enum/Synchronize.sh
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/Synchronize.sh	(revision 17775)
++++ ../trunk-jpl/src/c/shared/Enum/Synchronize.sh	(revision 17776)
+@@ -13,6 +13,81 @@
+ #Get number of enums
+ NUMENUMS=$(wc -l temp | awk '{printf("%s",$1);}');
+ 
++#Deal with Analyses
++#Build EnumToAnalysis.cpp {{{
++#Header
++cat <<END > $ISSM_DIR/src/c/analyses/EnumToAnalysis.cpp
++/*
++* \file EnumToAnalysis.cpp
++* \brief: output class depending on enum
++*
++*   WARNING: DO NOT MODIFY THIS FILE
++*            this file has been automatically generated by Synchronize.sh
++*            Please read README for more information
++*/
++
++#include "./analyses.h"
++#include "../shared/shared.h"
++
++Analysis* EnumToAnalysis(int analysis_enum){
++
++	switch(analysis_enum){
++END
++#core
++cat temp | grep [a-zA-Z]Analysis | \
++	grep -v DefaultAnalysis | grep -v FlaimAnalysis | grep -v SurfaceSlopeAnalysis | grep -v BedSlopeAnalysis | \
++	awk '{print "\t\t#ifdef _HAVE_"toupper(substr($1,1,length($1)-12))"_\n\t\t" "case " $1" : return new " substr($1,1,length($1)-4) "();\n\t\t#endif"}' \
++		>> $ISSM_DIR/src/c/analyses/EnumToAnalysis.cpp
++
++#Footer
++cat <<END >> $ISSM_DIR/src/c/analyses/EnumToAnalysis.cpp
++		default : _error_("enum provided not supported ("<<EnumToStringx(analysis_enum)<<")");
++	}
++}
++END
++#}}}
++#Build analyses.m4{{{
++#Header
++cat <<END > $ISSM_DIR/m4/analyses.m4
++
++dnl   WARNING: DO NOT MODIFY THIS FILE
++dnl            this file has been automatically generated by Synchronize.sh
++dnl            Please read README for more information
++
++# AX_ANALYSES_SELECTION
++# -----------------
++# Check for analyses compilation
++AC_DEFUN([AX_ANALYSES_SELECTION],
++[
++
++END
++#core
++cat temp | grep [a-zA-Z]Analysis | \
++	grep -v DefaultAnalysis | grep -v FlaimAnalysis | grep -v SurfaceSlopeAnalysis | grep -v BedSlopeAnalysis | \
++	sed -e "s/AnalysisEnum//g" | \
++	awk '{print "dnl with-" $1"{{{\n\
++AC_ARG_WITH([" $1"],\n\
++\tAS_HELP_STRING([--with-" $1" = YES], [compile with " $1" capabilities (default is yes)]),\n\
++\t[" toupper($1)"=$withval],[" toupper($1)"=yes])\n\
++AC_MSG_CHECKING(for " $1" capability compilation)\n\n\
++HAVE_"  toupper($1)"=no \n\
++if test \"x$"  toupper($1)"\" = \"xyes\"; then\n\
++	HAVE_"  toupper($1)"=yes\n\
++	AC_DEFINE([_HAVE_"  toupper($1)"_],[1],[with " $1"capability])\n\
++fi\n\
++AM_CONDITIONAL([" toupper($1)"], [test x$HAVE_" toupper($1)" = xyes])\n\
++AC_MSG_RESULT($HAVE_" toupper($1)")\n\
++dnl }}}"}' \
++	>> $ISSM_DIR/m4/analyses.m4
++
++#Footer
++cat <<END >> $ISSM_DIR/m4/analyses.m4
++
++])
++END
++#}}}
++
++#Enum to String conversions
+ #Build EnumToStringx.cpp {{{
+ #Header
+ cat <<END >  $ISSM_DIR/src/c/shared/Enum/EnumToStringx.cpp
+@@ -103,38 +178,8 @@
+ }
+ END
+ #}}}
+-#Build EnumToAnalysis.cpp {{{
+-#Header
+-cat <<END > $ISSM_DIR/src/c/analyses/EnumToAnalysis.cpp
+-/*
+-* \file EnumToAnalysis.cpp
+-* \brief: output class depending on enum
+-*
+-*   WARNING: DO NOT MODIFY THIS FILE
+-*            this file has been automatically generated by Synchronize.sh
+-*            Please read README for more information
+-*/
+ 
+-#include "./analyses.h"
+-#include "../shared/shared.h"
+-
+-Analysis* EnumToAnalysis(int analysis_enum){
+-
+-	switch(analysis_enum){
+-END
+-#core
+-cat temp | grep [a-zA-Z]Analysis | \
+-	grep -v DefaultAnalysis | grep -v FlaimAnalysis | grep -v SurfaceSlopeAnalysis | grep -v BedSlopeAnalysis | \
+-	awk '{print "\t\t#ifdef _HAVE_"toupper(substr($1,1,length($1)-12))"_\n\t\t" "case " $1" : return new " substr($1,1,length($1)-4) "();\n\t\t#endif"}' \
+-		>> $ISSM_DIR/src/c/analyses/EnumToAnalysis.cpp
+-
+-#Footer
+-cat <<END >> $ISSM_DIR/src/c/analyses/EnumToAnalysis.cpp
+-		default : _error_("enum provided not supported ("<<EnumToStringx(analysis_enum)<<")");
+-	}
+-}
+-END
+-#}}}
++#Deal with Python Enums
+ #Build EnumDefinitions.py{{{
+ cat <<END > $ISSM_DIR/src/m/enum/EnumDefinitions.py
+ from StringToEnum import StringToEnum
+@@ -152,7 +197,7 @@
+ cat temp |  awk '{print "def " $1"(): return StringToEnum(\"" substr($1,1,length($1)-4) "\")[0]"}' >> $ISSM_DIR/src/m/enum/EnumDefinitions.py
+ #}}}
+ 
+-# go through the lines of temp
++#Deal with Matlab Enums`
+ ENUM=0;
+ 
+ for NAMEENUM in $(cat temp); do
Index: issm/oecreview/Archive/16554-17801/ISSM-17776-17777.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17776-17777.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17776-17777.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/cores/gia_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/gia_core.cpp	(revision 17776)
++++ ../trunk-jpl/src/c/cores/gia_core.cpp	(revision 17777)
+@@ -49,7 +49,7 @@
+ 
+ 	if(save_results){
+ 		if(VerboseSolution()) _printf0_("   saving results\n");
+-		const int outputs[2] = {GiaWEnum,GiadWdtEnum};
++		int outputs[2] = {GiaWEnum,GiadWdtEnum};
+ 		femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],2);
+ 	}
+ 
Index: issm/oecreview/Archive/16554-17801/ISSM-17777-17778.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17777-17778.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17777-17778.diff	(revision 17802)
@@ -0,0 +1,471 @@
+Index: ../trunk-jpl/src/m/plot/plot_manager.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_manager.py	(revision 17777)
++++ ../trunk-jpl/src/m/plot/plot_manager.py	(revision 17778)
+@@ -1,5 +1,6 @@
+ try:
+ 	import pylab as p
++	import matplotlib.pyplot as plt
+ except ImportError:
+ 	print "could not import pylab, matplotlib has not been installed, no plotting capabilities enabled"
+ 
+@@ -11,14 +12,19 @@
+ from applyoptions import applyoptions
+ from plot_overlay import plot_overlay
+ 
+-def plot_manager(md,options,subplotwidth,nlines,ncols,i):
++def plot_manager(md,options,fig,ax):
+ 	'''
+ 	PLOT_MANAGER - distribute the plots called by plotmodel
+ 
+-		Usage:
+-			plot_manager(md,options,subplotwidth,i);
++	'fig' is a handle to the figure instance created by plotmodel.
+ 
+-		See also: PLOTMODEL, PLOT_UNIT
++	'ax' is a handle to the axes instance created by plotmodel.  This is
++	currently generated using matplotlib's AxesGrid toolki.
++
++	Usage:
++		plot_manager(md,options,fig,ax);
++
++	See also: PLOTMODEL, PLOT_UNIT
+ 	'''
+ 
+ 	#parse options and get a structure of options
+@@ -28,18 +34,18 @@
+ 	data=options.getfieldvalue('data');
+ 
+ 	#initialize plot handle variable
+-	handle=None
++	#handle=None
+ 
+ 	# initialize subplot
+-	p.subplot(nlines,ncols,i,aspect='equal')
++	#p.subplot(nrows,ncols,i,aspect='equal')
+ 
+ 	##basemap plot
+ 	#if options.exist('basemap'):
+-	#	plot_basemap(md,data,options,nlines,ncols,i)
++	#	plot_basemap(md,data,options,nrows,ncols,i)
+ 
+ 	#overlay plot
+ 	if options.exist('overlay'):
+-		handle=plot_overlay(md,data,options,nlines,ncols,i)
++		plot_overlay(md,data,options,ax)
+ 		options.addfielddefault('alpha',0.5)
+ 		options.addfielddefault('xlim',[min(md.mesh.x),max(md.mesh.x)])
+ 		options.addfielddefault('ylim',[min(md.mesh.y),max(md.mesh.y)])
+@@ -49,7 +55,7 @@
+ 
+ 		# convert string to lower case for a case-insensitive comparison
+ 		if data.lower()=='mesh': 
+-			plot_mesh(md,options,nlines,ncols,i)
++			plot_mesh(md,options,ax)
+ 			return
+ 		elif data.lower()=='none':
+ 			print 'no data provided to plot (TODO: write plot_none.py)'
+@@ -73,12 +79,12 @@
+ 
+ 	#standard plot
+ 	#if not handle:
+-	#	p.subplot(nlines,ncols,i,aspect='equal')
++	#	p.subplot(nrows,ncols,i,aspect='equal')
+ 
+ 	#plot unit
+-	plot_unit(x,y,z,elements,data2,is2d,isplanet,datatype,options)
++	plot_unit(x,y,z,elements,data2,is2d,isplanet,datatype,options,ax)
+ 
+ 	#apply all options
+-	applyoptions(md,data2,options)
++	applyoptions(md,data2,options,fig,ax)
+ 	
+ 	#ground overlay on kml plot_unit
+Index: ../trunk-jpl/src/m/plot/plot_overlay.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_overlay.py	(revision 17777)
++++ ../trunk-jpl/src/m/plot/plot_overlay.py	(revision 17778)
+@@ -6,7 +6,7 @@
+ import matplotlib as mpl
+ import os
+ 
+-def plot_overlay(md,data,options,rows,cols,i):
++def plot_overlay(md,data,options,ax):
+ 	'''
+ 	Function for plotting a georeferenced image.  This function is called
+ 	from within the plotmodel code.
+@@ -75,7 +75,6 @@
+ 		plt.title('histogram of overlay image, use for setting overlaylims')
+ 		plt.sca(ax) # return to original axes/figure
+ 		
+-
+ 	# get parameters from cropped geotiff
+ 	trans=gtif.GetGeoTransform()
+ 	xmin=trans[0]
+@@ -89,20 +88,16 @@
+ 	yarr=npy.arange(ymin,ymax,-dy) # -dy since origin='upper' (not sure how robust this is)
+ 	xg,yg=npy.meshgrid(xarr,yarr)
+ 	if options.exist('basemap'):
+-		# TODO get handle to basemap instance 
+-		# handle= functiontogethandle()
++		# TODO get handle to or create basemap instance 
+ 		# create coordinate grid in map projection units (for plotting)
+ 		lats,lons=xy2ll(xg,yg,-1,0,71)
+ 		xgmap,ygmap=m(lons,lats) # map projection units returned by basemap instance
+ 	else:
+ 		xgmap=xg
+ 		ygmap=yg
+-		handle=plt.gca()
+ 	
+ 	overlaylims=options.getfieldvalue('overlaylims',[min(arr.ravel()),max(arr.ravel())])
+ 
+ 	norm=mpl.colors.Normalize(vmin=overlaylims[0],vmax=overlaylims[1])
+ 
+-	handle.pcolormesh(xgmap, ygmap, npy.flipud(arr), cmap=mpl.cm.Greys, norm=norm)
+-	handle.set_aspect('equal','box')
+-	return handle
++	ax.pcolormesh(xgmap, ygmap, npy.flipud(arr), cmap=mpl.cm.Greys, norm=norm)
+Index: ../trunk-jpl/src/m/plot/plot_contour.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_contour.py	(revision 17777)
++++ ../trunk-jpl/src/m/plot/plot_contour.py	(revision 17778)
+@@ -3,7 +3,7 @@
+ from processmesh import processmesh
+ from processdata import processdata
+ 
+-def plot_contour(md,datain,options):
++def plot_contour(md,datain,options,ax):
+ 	'''
+ 	plot contours of a given field (called within plotmodel)
+ 
+@@ -15,7 +15,6 @@
+ 
+ 	x,y,z,elements,is2d,isplanet=processmesh(md,datain,options)
+ 	data,datatype=processdata(md,datain,options)
+-	ax=plt.gca()
+ 
+ 	# process data: must be on nodes
+ 	if datatype==1: # element data
+Index: ../trunk-jpl/src/m/plot/plotmodel.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plotmodel.py	(revision 17777)
++++ ../trunk-jpl/src/m/plot/plotmodel.py	(revision 17778)
+@@ -3,6 +3,8 @@
+ 
+ try:
+ 	import pylab as p
++	import matplotlib.pyplot as plt
++	from mpl_toolkits.axes_grid1 import ImageGrid
+ except ImportError:
+ 	print "could not import pylab, matplotlib has not been installed, no plotting capabilities enabled"
+ 
+@@ -27,13 +29,13 @@
+ 	#get hold
+ 	hold=options.list[0].getfieldvalue('hold',False)
+ 
+-	#if nlines and ncols specified, then bypass
+-	if options.list[0].exist('nlines'):
+-		nlines=options.list[0].getfieldvalue('nlines')
+-		nl=True
++	#if nrows and ncols specified, then bypass
++	if options.list[0].exist('nrows'):
++		nrows=options.list[0].getfieldvalue('nrows')
++		nr=True
+ 	else:
+-		nlines=npy.ceil(numberofplots/subplotwidth)
+-		nl=False
++		nrows=npy.ceil(numberofplots/subplotwidth)
++		nr=False
+ 	
+ 	if options.list[0].exist('ncols'):
+ 		ncols=options.list[0].getfieldvalue('ncols')
+@@ -42,34 +44,41 @@
+ 		ncols=subplotwidth
+ 		nc=False
+ 	
+-	#check that nlines and ncols were given at the same time!
+-	if not nl==nc:
+-		raise StandardError('error: nlines and ncols need to be specified together, or not at all')
++	#check that nrows and ncols were given at the same time!
++	if not nr==nc:
++		raise StandardError('error: nrows and ncols need to be specified together, or not at all')
+ 	
+ 	#Go through plots
+ 	if numberofplots:
+ 		
+-		#Create figure
+-		#plots will be visible by default if ipython is run in interactive mode (invoked by ipython --pylab)
+-		#UNLESS plotmodel is called within a script (e.g. a runme.py file) 
+-		#handling the 'visible' option will need some check on whether ipython is currently in interactive or non-interactive mode
+-
+ 		if not hold: # TODO need to also check whether figurenumber is a new plot so that old plots are not mistakenly cleared
+-			p.cla()
++			plt.cla()
+ 
+-		#TODO fig, axarray = plt.subplots(nrows,ncols), then pass fix and axarr to plot_manager
+ 		#if figsize specified
+ 		if options.list[0].exist('figsize'):
+ 			figsize=options.list[0].getfieldvalue('figsize')
+-			p.figure(figurenumber,figsize=figsize)
++			fig=plt.figure(figurenumber,figsize=figsize,tight_layout=True)
+ 		else:
+-			p.figure(figurenumber)
+-			
+-		#try:
++			fig=plt.figure(figurenumber,tight_layout=True)
++		fig.clf()
++	
++		# options to pass: axes_pad, share_all, label_mode ("1","L","all"), cbar_mode (none,single,each), cbar_location(right,top)
++		axgrid=ImageGrid(fig, 111,
++				nrows_ncols=(nrows,ncols),
++				direction='row',
++				axes_pad=0.05,
++				add_all=True,
++				share_all=True,
++				label_mode='all',
++				cbar_mode='single',
++				cbar_location='right',
++				cbar_size='5%',
++				cbar_pad=0.05
++				)
++
+ 		for i in xrange(numberofplots):
+-			plot_manager(options.list[i].getfieldvalue('model',md),options.list[i],subplotwidth,nlines,ncols,i+1)
+-		#except StandardError:
+-		#	print 'error in plot_manager'
+-		p.show()
++			plot_manager(options.list[i].getfieldvalue('model',md),options.list[i],fig,axgrid[i])
++
++		plt.show()
+ 	else:
+ 		raise StandardError('plotmodel error message: no output data found.')
+Index: ../trunk-jpl/src/m/plot/applyoptions.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/applyoptions.py	(revision 17777)
++++ ../trunk-jpl/src/m/plot/applyoptions.py	(revision 17778)
+@@ -7,13 +7,17 @@
+ 	from mpl_toolkits.axes_grid1 import make_axes_locatable
+ 	import matplotlib as mpl
+ 	import pylab as p
++	import matplotlib.pyplot as plt
+ except ImportError:
+ 	print "could not import pylab, matplotlib has not been installed, no plotting capabilities enabled"
+ 
+-def applyoptions(md,data,options):
++def applyoptions(md,data,options,fig,ax):
+ 	'''
+ 	APPLYOPTIONS - apply options to current plot
+ 
++	'plotobj' is the object returned by the specific plot call used to
++	render the data.  This object is used for adding a colorbar.
++
+ 		Usage:
+ 			applyoptions(md,data,options)
+ 
+@@ -25,11 +29,11 @@
+ 	#	options.addfielddefault('hemisphere',md.mesh.hemisphere)
+ 
+ 	# get handle to current figure and axes instance
+-	fig = p.gcf()
+-	ax=p.gca()
++	#fig = p.gcf()
++	#ax=p.gca()
+ 
+ 	#font {{{
+-	fontsize=options.getfieldvalue('fontsize',14)
++	fontsize=options.getfieldvalue('fontsize',8)
+ 	fontweight=options.getfieldvalue('fontweight','normal')
+ 	fontfamily=options.getfieldvalue('fontfamily','sans-serif')
+ 	font={
+@@ -54,7 +58,7 @@
+ 		titlefont=font.copy()
+ 		titlefont['size']=titlefontsize
+ 		titlefont['weight']=titlefontweight
+-		p.title(title,**titlefont)
++		fig.set_title(title,**titlefont)
+ 	#}}}
+ 		
+ 	#xlabel, ylabel, zlabel {{{
+@@ -73,47 +77,47 @@
+ 	labelfont['fontweight']=labelfontweight
+ 
+ 	if options.exist('xlabel'):
+-		p.xlabel(options.getfieldvalue('xlabel'),**labelfont)
++		ax.set_xlabel(options.getfieldvalue('xlabel'),**labelfont)
+ 	if options.exist('ylabel'):
+-		p.ylabel(options.getfieldvalue('ylabel'),**labelfont)
++		ax.set_ylabel(options.getfieldvalue('ylabel'),**labelfont)
+ 	if options.exist('zlabel'):
+-		p.zlabel(options.getfieldvalue('zlabel'),**labelfont)
++		ax.set_zlabel(options.getfieldvalue('zlabel'),**labelfont)
+ 	#}}}
+ 
+ 	#xticks, yticks, zticks (tick locations) {{{
+ 	if options.exist('xticks'):
+ 		if options.exist('xticklabels'):
+ 			xticklabels=options.getfieldvalue('xticklabels')
+-			p.xticks(options.getfieldvalue('xticks'),xticklabels)
++			ax.set_xticks(options.getfieldvalue('xticks'),xticklabels)
+ 		else:
+-			p.xticks(options.getfieldvalue('xticks'))
++			ax.set_xticks(options.getfieldvalue('xticks'))
+ 	if options.exist('yticks'):
+ 		if options.exist('yticklabels'):
+ 			yticklabels=options.getfieldvalue('yticklabels')
+-			p.yticks(options.getfieldvalue('yticks'),yticklabels)
++			ax.set_yticks(options.getfieldvalue('yticks'),yticklabels)
+ 		else:
+-			p.yticks(options.getfieldvalue('yticks'))
++			ax.set_yticks(options.getfieldvalue('yticks'))
+ 	if options.exist('zticks'):
+ 		if options.exist('zticklabels'):
+ 			zticklabels=options.getfieldvalue('zticklabels')
+-			p.zticks(options.getfieldvalue('zticks'),zticklabels)
++			ax.set_zticks(options.getfieldvalue('zticks'),zticklabels)
+ 		else:
+-			p.zticks(options.getfieldvalue('zticks'))
++			ax.set_zticks(options.getfieldvalue('zticks'))
+ 	#}}}
+ 
+ 	#xticklabels,yticklabels,zticklabels {{{
+ 	if options.exist('xticklabels'):
+ 		xticklabels=options.getfieldvalue('xticklabels')
+ 		xtickloc=p.xticks()[0]	
+-		p.xticks(xtickloc,xticklabels)
++		ax.set_xticks(xtickloc,xticklabels)
+ 	if options.exist('yticklabels'):
+ 		yticklabels=options.getfieldvalue('yticklabels')
+ 		ytickloc=p.yticks()[0]	
+-		p.yticks(ytickloc,yticklabels)
++		ax.set_yticks(ytickloc,yticklabels)
+ 	if options.exist('zticklabels'):
+ 		zticklabels=options.getfieldvalue('zticklabels')
+ 		ztickloc=p.zticks()[0]	
+-		p.zticks(ztickloc,zticklabels)
++		ax.set_zticks(ztickloc,zticklabels)
+ 	#}}}
+ 
+ 	#ticklabel notation {{{
+@@ -143,11 +147,11 @@
+ 
+ 	#xlim, ylim, zlim {{{
+ 	if options.exist('xlim'):
+-		p.xlim(options.getfieldvalue('xlim'))
++		ax.set_xlim(options.getfieldvalue('xlim'))
+ 	if options.exist('ylim'):
+-		p.ylim(options.getfieldvalue('ylim'))
++		ax.set_ylim(options.getfieldvalue('ylim'))
+ 	if options.exist('zlim'):
+-		p.zlim(options.getfieldvalue('zlim'))
++		ax.set_zlim(options.getfieldvalue('zlim'))
+ 	#}}}
+ 
+ 	#latlon
+@@ -173,7 +177,7 @@
+ 	#grid {{{
+ 	if options.exist('grid'):
+ 		if 'on' in options.getfieldvalue('grid','on'):
+-			p.grid()
++			ax.grid()
+ 	#}}}
+ 
+ 	#colormap {{{
+@@ -194,13 +198,15 @@
+ 	options.addfield('colormap',cmap)
+ 	#}}}
+ 
++	#contours {{{
++	if options.exist('contourlevels'):
++		plot_contour(md,data,options,ax)
++	#}}}
++
+ 	#wrapping
+ 
+ 	#colorbar {{{
+ 	if options.getfieldvalue('colorbar',1)==1:
+-		divider = make_axes_locatable(ax)
+-		cax = divider.new_horizontal("5%", pad=0.05, axes_class=mpl.axes.Axes)
+-		fig.add_axes(cax) 
+ 		if cbar_extend==0:
+ 			extend='neither'
+ 		elif cbar_extend==1:
+@@ -209,12 +215,21 @@
+ 			extend='min'
+ 		elif cbar_extend==3:
+ 			extend='both'
+-		cb = mpl.colorbar.ColorbarBase(cax, cmap=cmap, norm=norm, extend=extend)
++		cb = mpl.colorbar.ColorbarBase(ax.cax, cmap=cmap, norm=norm, extend=extend)
+ 		cb.locator=MaxNLocator(nbins=5) # default 5 ticks
+-		cb.update_ticks()
++		if options.exist('alpha'):
++			cb.set_alpha(options.getfieldvalue('alpha'))
+ 		if options.exist('colorbarnumticks'):
+ 			cb.locator=MaxNLocator(nbins=options.getfieldvalue('colorbarnumticks',5))
+-			cb.update_ticks()
++		if options.exist('colorbartickspacing'):
++			locs=npy.arange(lims[0],lims[1]+1,options.getfieldvalue('colorbartickspacing'))
++			cb.set_ticks(locs)
++		if options.exist('colorbarlines'):
++			locs=npy.arange(lims[0],lims[1]+1,options.getfieldvalue('colorbarlines'))
++			cb.add_lines(locs,['k' for i in range(len(locs))],npy.ones_like(locs))
++		if options.exist('colorbartitle'):
++			cb.set_label(options.getfieldvalue('colorbartitle'),fontsize=fontsize)
++		cb.ax.tick_params(labelsize=fontsize)
+ 	#}}}
+ 
+ 	#area
+@@ -229,10 +244,6 @@
+ 
+ 	#streamlines
+ 
+-	#contours {{{
+-	if options.exist('contourlevels'):
+-		plot_contour(md,data,options)
+-	#}}}
+ 
+ 	#axis positions
+ 
+Index: ../trunk-jpl/src/m/plot/plot_unit.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_unit.py	(revision 17777)
++++ ../trunk-jpl/src/m/plot/plot_unit.py	(revision 17778)
+@@ -2,10 +2,11 @@
+ try:
+ 	import pylab as p
+ 	import matplotlib as mpl
++	import matplotlib.pyplot as plt
+ except ImportError:
+ 	print "could not import pylab, matplotlib has not been installed, no plotting capabilities enabled"
+ 
+-def plot_unit(x,y,z,elements,data,is2d,isplanet,datatype,options):
++def plot_unit(x,y,z,elements,data,is2d,isplanet,datatype,options,ax):
+ 	"""
+ 	PLOT_UNIT - unit plot, display data
+ 	
+@@ -45,17 +46,17 @@
+ 	if datatype==1:
+ 	   #element plot
+ 		if is2d:
+-			p.tripcolor(x,y,elements,data,colorlevels,cmap=cmap,edgecolors=edgecolor)
++			tri=ax.tripcolor(x,y,elements,data,colorlevels,cmap=cmap,edgecolors=edgecolor)
+ 		else:
+ 			raise ValueError('plot_unit error: 3D element plot not supported yet')
+-		return
++		return 
+ 	
+ 	elif datatype==2:
+ 		#node plot
+ 		if is2d:
+-			p.tricontourf(x,y,elements,data,colorlevels,cmap=cmap,norm=norm,alpha=alpha)
++			tri=ax.tricontourf(x,y,elements,data,colorlevels,cmap=cmap,norm=norm,alpha=alpha)
+ 			if edgecolor != 'None':
+-				p.triplot(x,y,elements,color=edgecolor)
++				ax.triplot(x,y,elements,color=edgecolor)
+ 		else:
+ 			raise ValueError('plot_unit error: 3D node plot not supported yet')
+ 		return
+@@ -75,3 +76,4 @@
+ 	
+ 	else:
+ 		raise ValueError('datatype=%d not supported' % datatype)
++
Index: issm/oecreview/Archive/16554-17801/ISSM-17778-17779.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17778-17779.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17778-17779.diff	(revision 17802)
@@ -0,0 +1,68 @@
+Index: ../trunk-jpl/src/m/classes/inversion.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/inversion.m	(revision 17778)
++++ ../trunk-jpl/src/m/classes/inversion.m	(revision 17779)
+@@ -242,18 +242,18 @@
+ 			%process cost functions
+ 			num_cost_functions=size(obj.cost_functions,2);
+ 			data=obj.cost_functions;
+-			pos=find(data==101); data(pos)=SurfaceAbsVelMisfitEnum();
+-			pos=find(data==102); data(pos)=SurfaceRelVelMisfitEnum();
+-			pos=find(data==103); data(pos)=SurfaceLogVelMisfitEnum();
+-			pos=find(data==104); data(pos)=SurfaceLogVxVyMisfitEnum();
+-			pos=find(data==105); data(pos)=SurfaceAverageVelMisfitEnum();
+-			pos=find(data==201); data(pos)=ThicknessAbsMisfitEnum();
+-			pos=find(data==501); data(pos)=DragCoefficientAbsGradientEnum();
+-			pos=find(data==502); data(pos)=RheologyBbarAbsGradientEnum();
+-			pos=find(data==503); data(pos)=ThicknessAbsGradientEnum();
+-			pos=find(data==504); data(pos)=ThicknessAlongGradientEnum();
+-			pos=find(data==505); data(pos)=ThicknessAcrossGradientEnum();
+-			pos=find(data==506); data(pos)=BalancethicknessMisfitEnum();
++			pos=find(obj.cost_functions==101); data(pos)=SurfaceAbsVelMisfitEnum();
++			pos=find(obj.cost_functions==102); data(pos)=SurfaceRelVelMisfitEnum();
++			pos=find(obj.cost_functions==103); data(pos)=SurfaceLogVelMisfitEnum();
++			pos=find(obj.cost_functions==104); data(pos)=SurfaceLogVxVyMisfitEnum();
++			pos=find(obj.cost_functions==105); data(pos)=SurfaceAverageVelMisfitEnum();
++			pos=find(obj.cost_functions==201); data(pos)=ThicknessAbsMisfitEnum();
++			pos=find(obj.cost_functions==501); data(pos)=DragCoefficientAbsGradientEnum();
++			pos=find(obj.cost_functions==502); data(pos)=RheologyBbarAbsGradientEnum();
++			pos=find(obj.cost_functions==503); data(pos)=ThicknessAbsGradientEnum();
++			pos=find(obj.cost_functions==504); data(pos)=ThicknessAlongGradientEnum();
++			pos=find(obj.cost_functions==505); data(pos)=ThicknessAcrossGradientEnum();
++			pos=find(obj.cost_functions==506); data(pos)=BalancethicknessMisfitEnum();
+ 			WriteData(fid,'data',data,'enum',InversionCostFunctionsEnum(),'format','DoubleMat','mattype',3);
+ 			WriteData(fid,'data',num_cost_functions,'enum',InversionNumCostFunctionsEnum(),'format','Integer');
+ 		end % }}}
+Index: ../trunk-jpl/src/m/classes/inversion.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/inversion.py	(revision 17778)
++++ ../trunk-jpl/src/m/classes/inversion.py	(revision 17779)
+@@ -172,17 +172,17 @@
+ 		#process cost functions
+ 		num_cost_functions=numpy.size(self.cost_functions)
+ 		data=copy.deepcopy(self.cost_functions)
+-		data=[SurfaceAbsVelMisfitEnum()        if x==101 else x for x in data]
+-		data=[SurfaceRelVelMisfitEnum()        if x==102 else x for x in data]
+-		data=[SurfaceLogVelMisfitEnum()        if x==103 else x for x in data]
+-		data=[SurfaceLogVxVyMisfitEnum()       if x==104 else x for x in data]
+-		data=[SurfaceAverageVelMisfitEnum()    if x==105 else x for x in data]
+-		data=[ThicknessAbsMisfitEnum()         if x==201 else x for x in data]
+-		data=[DragCoefficientAbsGradientEnum() if x==501 else x for x in data]
+-		data=[RheologyBbarAbsGradientEnum()    if x==502 else x for x in data]
+-		data=[ThicknessAbsGradientEnum()       if x==503 else x for x in data]
+-		data=[ThicknessAlongGradientEnum()     if x==504 else x for x in data]
+-		data=[ThicknessAcrossGradientEnum()    if x==505 else x for x in data]
++		data=[SurfaceAbsVelMisfitEnum()        if x==101 else x for x in self.cost_functions]
++		data=[SurfaceRelVelMisfitEnum()        if x==102 else x for x in self.cost_functions]
++		data=[SurfaceLogVelMisfitEnum()        if x==103 else x for x in self.cost_functions]
++		data=[SurfaceLogVxVyMisfitEnum()       if x==104 else x for x in self.cost_functions]
++		data=[SurfaceAverageVelMisfitEnum()    if x==105 else x for x in self.cost_functions]
++		data=[ThicknessAbsMisfitEnum()         if x==201 else x for x in self.cost_functions]
++		data=[DragCoefficientAbsGradientEnum() if x==501 else x for x in self.cost_functions]
++		data=[RheologyBbarAbsGradientEnum()    if x==502 else x for x in self.cost_functions]
++		data=[ThicknessAbsGradientEnum()       if x==503 else x for x in self.cost_functions]
++		data=[ThicknessAlongGradientEnum()     if x==504 else x for x in self.cost_functions]
++		data=[ThicknessAcrossGradientEnum()    if x==505 else x for x in self.cost_functions]
+ 		WriteData(fid,'data',numpy.array(data).reshape(1,-1),'enum',InversionCostFunctionsEnum(),'format','DoubleMat','mattype',3)
+ 		WriteData(fid,'data',num_cost_functions,'enum',InversionNumCostFunctionsEnum(),'format','Integer')
+ 	# }}}
Index: issm/oecreview/Archive/16554-17801/ISSM-17779-17780.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17779-17780.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17779-17780.diff	(revision 17802)
@@ -0,0 +1,44 @@
+Index: ../trunk-jpl/src/m/classes/inversion.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/inversion.py	(revision 17779)
++++ ../trunk-jpl/src/m/classes/inversion.py	(revision 17780)
+@@ -172,17 +172,28 @@
+ 		#process cost functions
+ 		num_cost_functions=numpy.size(self.cost_functions)
+ 		data=copy.deepcopy(self.cost_functions)
+-		data=[SurfaceAbsVelMisfitEnum()        if x==101 else x for x in self.cost_functions]
+-		data=[SurfaceRelVelMisfitEnum()        if x==102 else x for x in self.cost_functions]
+-		data=[SurfaceLogVelMisfitEnum()        if x==103 else x for x in self.cost_functions]
+-		data=[SurfaceLogVxVyMisfitEnum()       if x==104 else x for x in self.cost_functions]
+-		data=[SurfaceAverageVelMisfitEnum()    if x==105 else x for x in self.cost_functions]
+-		data=[ThicknessAbsMisfitEnum()         if x==201 else x for x in self.cost_functions]
+-		data=[DragCoefficientAbsGradientEnum() if x==501 else x for x in self.cost_functions]
+-		data=[RheologyBbarAbsGradientEnum()    if x==502 else x for x in self.cost_functions]
+-		data=[ThicknessAbsGradientEnum()       if x==503 else x for x in self.cost_functions]
+-		data=[ThicknessAlongGradientEnum()     if x==504 else x for x in self.cost_functions]
+-		data=[ThicknessAcrossGradientEnum()    if x==505 else x for x in self.cost_functions]
++		pos=[i for i,x in enumerate(self.cost_functions) if x==101];
++		for i in pos: data[i]=SurfaceAbsVelMisfitEnum()        
++		pos=[i for i,x in enumerate(self.cost_functions) if x==102];
++		for i in pos: data[i]=SurfaceRelVelMisfitEnum()        
++		pos=[i for i,x in enumerate(self.cost_functions) if x==103];
++		for i in pos: data[i]=SurfaceLogVelMisfitEnum()        
++		pos=[i for i,x in enumerate(self.cost_functions) if x==104];
++		for i in pos: data[i]=SurfaceLogVxVyMisfitEnum()       
++		pos=[i for i,x in enumerate(self.cost_functions) if x==105];
++		for i in pos: data[i]=SurfaceAverageVelMisfitEnum()    
++		pos=[i for i,x in enumerate(self.cost_functions) if x==201];
++		for i in pos: data[i]=ThicknessAbsMisfitEnum()         
++		pos=[i for i,x in enumerate(self.cost_functions) if x==501];
++		for i in pos: data[i]=DragCoefficientAbsGradientEnum() 
++		pos=[i for i,x in enumerate(self.cost_functions) if x==502];
++		for i in pos: data[i]=RheologyBbarAbsGradientEnum()    
++		pos=[i for i,x in enumerate(self.cost_functions) if x==503];
++		for i in pos: data[i]=ThicknessAbsGradientEnum()       
++		pos=[i for i,x in enumerate(self.cost_functions) if x==504];
++		for i in pos: data[i]=ThicknessAlongGradientEnum()     
++		pos=[i for i,x in enumerate(self.cost_functions) if x==505];
++		for i in pos: data[i]=ThicknessAcrossGradientEnum()    
+ 		WriteData(fid,'data',numpy.array(data).reshape(1,-1),'enum',InversionCostFunctionsEnum(),'format','DoubleMat','mattype',3)
+ 		WriteData(fid,'data',num_cost_functions,'enum',InversionNumCostFunctionsEnum(),'format','Integer')
+ 	# }}}
Index: issm/oecreview/Archive/16554-17801/ISSM-17780-17781.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17780-17781.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17780-17781.diff	(revision 17802)
@@ -0,0 +1,52 @@
+Index: ../trunk-jpl/test/NightlyRun/test513.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test513.py	(revision 17780)
++++ ../trunk-jpl/test/NightlyRun/test513.py	(revision 17781)
+@@ -35,7 +35,7 @@
+ 
+ # Fields and tolerances to track changes
+ field_names     =['Gradient','Misfits','FrictionCoefficient','Pressure','Vel','Vx','Vy','Vz','Temperature','BasalforcingsMeltingRate']
+-field_tolerances=[2e-10,2e-10,1e-10,1e-10,2e-6,1e-6,2e-6,2e-6,1e-6,2e-06]
++field_tolerances=[2e-10,2e-10,1e-10,1e-10,2e-6,1e-6,2e-6,2e-6,2e-6,2e-06]
+ field_values=[\
+ 	md.results.SteadystateSolution.Gradient1,\
+ 	md.results.SteadystateSolution.J,\
+Index: ../trunk-jpl/test/NightlyRun/test421.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test421.m	(revision 17780)
++++ ../trunk-jpl/test/NightlyRun/test421.m	(revision 17781)
+@@ -8,7 +8,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure'};
+-field_tolerances={1e-07,1e-07,2e-05,1e-07,2e-07};
++field_tolerances={6e-07,6e-07,2e-05,6e-07,6e-07};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test513.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test513.m	(revision 17780)
++++ ../trunk-jpl/test/NightlyRun/test513.m	(revision 17781)
+@@ -24,7 +24,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Gradient','Misfits','FrictionCoefficient','Pressure','Vel','Vx','Vy','Vz','Temperature','BasalforcingsMeltingRate'};
+-field_tolerances={2e-10,2e-10,1e-10,1e-10,2e-6,1e-6,2e-6,2e-6,1e-6,2e-06};
++field_tolerances={2e-10,2e-10,1e-10,1e-10,2e-6,1e-6,2e-6,2e-6,2e-6,2e-06};
+ field_values={...
+ 	(md.results.SteadystateSolution.Gradient1),...
+ 	md.results.SteadystateSolution.J,...
+Index: ../trunk-jpl/test/NightlyRun/test421.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test421.py	(revision 17780)
++++ ../trunk-jpl/test/NightlyRun/test421.py	(revision 17781)
+@@ -18,7 +18,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Vx','Vy','Vz','Vel','Pressure']
+-field_tolerances=[2e-07,1e-07,2e-05,1e-07,2e-07]
++field_tolerances=[6e-07,6e-07,2e-05,6e-07,6e-07]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Vx,\
+ 	md.results.StressbalanceSolution.Vy,\
Index: issm/oecreview/Archive/16554-17801/ISSM-17781-17782.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17781-17782.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17781-17782.diff	(revision 17802)
@@ -0,0 +1,87 @@
+Index: ../trunk-jpl/src/m/solve/solve.py
+===================================================================
+--- ../trunk-jpl/src/m/solve/solve.py	(revision 17781)
++++ ../trunk-jpl/src/m/solve/solve.py	(revision 17782)
+@@ -95,11 +95,6 @@
+ 		filelist.append(modelname+'.qmu.in')
+ 	cluster.LaunchQueueJob(md.miscellaneous.name,md.private.runtimename,filelist)
+ 
+-	#did we even try to run? if so, wait on lock
+-	if m.strcmpi(options['upload'],'on'):
+-		print 'solve done uploading test decks'
+-		return md
+-
+ 	#wait on lock
+ 	if md.settings.waitonlock>0:
+ 		#we wait for the done file
+Index: ../trunk-jpl/src/m/solve/solve.m
+===================================================================
+--- ../trunk-jpl/src/m/solve/solve.m	(revision 17781)
++++ ../trunk-jpl/src/m/solve/solve.m	(revision 17782)
+@@ -102,14 +102,6 @@
+ end
+ LaunchQueueJob(cluster,md.miscellaneous.name,md.private.runtimename,filelist);
+ 
+-%did we even try to run? if so, wait on lock
+-if strcmpi(options.upload,'on'),
+-	if md.verbose.solution,
+-		disp('solve done uploading test decks');
+-	end
+-	return;
+-end
+-
+ %wait on lock
+ if isnan(md.settings.waitonlock),
+ 	%load when user enters 'y'
+Index: ../trunk-jpl/src/m/solve/process_solve_options.py
+===================================================================
+--- ../trunk-jpl/src/m/solve/process_solve_options.py	(revision 17781)
++++ ../trunk-jpl/src/m/solve/process_solve_options.py	(revision 17782)
+@@ -17,18 +17,11 @@
+ 
+ 	#solution_type: check on this option, error out otherwise
+ 	solution_type=options.getfieldvalue('solution_type')
+-	if solution_type not in (StressbalanceSolutionEnum(),MasstransportSolutionEnum(),ThermalSolutionEnum(),\
+-			SteadystateSolutionEnum(),TransientSolutionEnum(),\
+-			BalancethicknessSolutionEnum(),BalancevelocitySolutionEnum(),\
+-			BedSlopeSolutionEnum(),SurfaceSlopeSolutionEnum(),\
+-			HydrologySolutionEnum(),FlaimSolutionEnum(),GiaSolutionEnum(),DamageEvolutionSolutionEnum()):
+-		raise ValueError("process_solve_options error message: solution_type '%s' not supported yet!" % EnumToString(solution_type)[0])
++	if EnumToString(solution_type)[0][-8:] != 'Solution':
++		raise ValueError("solution_type '%s' not supported!" % EnumToString(solution_type)[0])
+ 	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()))
+Index: ../trunk-jpl/src/m/solve/process_solve_options.m
+===================================================================
+--- ../trunk-jpl/src/m/solve/process_solve_options.m	(revision 17781)
++++ ../trunk-jpl/src/m/solve/process_solve_options.m	(revision 17782)
+@@ -8,20 +8,13 @@
+ 
+ %solution_type: check on this option, error out otherwise
+ solution_type=getfieldvalue(options,'solution_type');
+-if ~ismember(solution_type,[StressbalanceSolutionEnum(),MasstransportSolutionEnum(),ThermalSolutionEnum(),...
+-		SteadystateSolutionEnum(),TransientSolutionEnum(),...
+-		BalancethicknessSolutionEnum(),BalancethicknessSoftSolutionEnum(),...
+-		BalancevelocitySolutionEnum(),BedSlopeSolutionEnum(),...
+-		SurfaceSlopeSolutionEnum(),HydrologySolutionEnum(),FlaimSolutionEnum(),GiaSolutionEnum(),DamageEvolutionSolutionEnum()]),
+-	error(['process_solve_options error message: solution_type ' EnumToString(solution_type) ' not supported yet!']);
++if ~strncmp(fliplr(EnumToString(solution_type)),fliplr('Solution'),9),
++	error(['solution_type ' EnumToString(solution_type) ' not supported!']);
+ end
+ outoptions.solution_type=solution_type;
+-
+ outoptions.runtimename=getfieldvalue(options,'runtimename',true);
+-outoptions.upload=getfieldvalue(options,'upload','off');
+ outoptions.batch=getfieldvalue(options,'batch','no');
+ outoptions.loadonly=getfieldvalue(options,'loadonly',false);
+-outoptions.directory=getfieldvalue(options,'directory','');
+ 
+ %  process qmu arguments
+ outoptions.qmudir=getfieldvalue(options,'qmudir',['qmu' num2str(feature('GetPid'))]);  % qmudir =['qmu_' datestr(now,'yyyymmdd_HHMMSS')];
Index: issm/oecreview/Archive/16554-17801/ISSM-17782-17783.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17782-17783.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17782-17783.diff	(revision 17802)
@@ -0,0 +1,28 @@
+Index: ../trunk-jpl/externalpackages/gmsh/install.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/gmsh/install.sh	(revision 0)
++++ ../trunk-jpl/externalpackages/gmsh/install.sh	(revision 17783)
+@@ -0,0 +1,17 @@
++#!/bin/bash
++set -eu
++
++#Some cleanup
++rm -rf install src
++mkdir install
++
++#Download latest version
++svn --username gmsh --password gmsh co https://geuz.org/svn/gmsh/trunk src
++
++#Configure
++cd install
++
++#Install
++cmake ../src
++make
++make install
+
+Property changes on: ../trunk-jpl/externalpackages/gmsh/install.sh
+___________________________________________________________________
+Name: svn:executable
+   + *
+
Index: issm/oecreview/Archive/16554-17801/ISSM-17783-17784.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17783-17784.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17783-17784.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/solve/process_solve_options.m
+===================================================================
+--- ../trunk-jpl/src/m/solve/process_solve_options.m	(revision 17783)
++++ ../trunk-jpl/src/m/solve/process_solve_options.m	(revision 17784)
+@@ -8,7 +8,7 @@
+ 
+ %solution_type: check on this option, error out otherwise
+ solution_type=getfieldvalue(options,'solution_type');
+-if ~strncmp(fliplr(EnumToString(solution_type)),fliplr('Solution'),9),
++if ~strncmp(fliplr(EnumToString(solution_type)),fliplr('Solution'),8),
+ 	error(['solution_type ' EnumToString(solution_type) ' not supported!']);
+ end
+ outoptions.solution_type=solution_type;
Index: issm/oecreview/Archive/16554-17801/ISSM-17784-17785.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17784-17785.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17784-17785.diff	(revision 17802)
@@ -0,0 +1,14 @@
+Index: ../trunk-jpl/src/m/plot/plot_section.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_section.m	(revision 17784)
++++ ../trunk-jpl/src/m/plot/plot_section.m	(revision 17785)
+@@ -31,7 +31,8 @@
+ %replug x and y onto model so that SectionValue treats the problem correctly
+ md3d=md;
+ if exist(options,'layer')
+-	md.mesh.x=md.mesh.x2d; md.mesh.y=md.mesh.y2d; md.mesh.elements=md.mesh.elements2d; md.mesh.dimension=2;
++	md.mesh.x=md.mesh.x2d; md.mesh.y=md.mesh.y2d; md.mesh.elements=md.mesh.elements2d;
++	md.mesh=mesh2d(md.mesh);
+ end
+ 
+ %read contours: 
Index: issm/oecreview/Archive/16554-17801/ISSM-17785-17786.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17785-17786.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17785-17786.diff	(revision 17802)
@@ -0,0 +1,28 @@
+Index: ../trunk-jpl/src/m/plot/plot_section.m
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_section.m	(revision 17785)
++++ ../trunk-jpl/src/m/plot/plot_section.m	(revision 17786)
+@@ -195,7 +195,6 @@
+ 				A=elements(:,1); B=elements(:,2); C=elements(:,3);  D=elements(:,4); 
+ 				patch( 'Faces', [A B C D], 'Vertices', [x y z],'FaceVertexCData',data_s,'FaceColor','interp','EdgeColor','none');
+ 				view(3)
+-
+ 			end
+ 		end
+ 	end
+@@ -206,11 +205,12 @@
+ if dimension(md.mesh)==2
+ 	options=addfielddefault(options,'colorbar',0);
+ end
+-if ((dimension(md.mesh)==2) | getfieldvalue(options,'view')==2 )
++if ((dimension(md.mesh)==2) | getfieldvalue(options,'view',2)==2 )
+ 	options=addfielddefault(options,'xlabel','Curvilinear coordinate');
+ 	options=addfielddefault(options,'axis','auto');
+ end
+-if (dimension(md.mesh)==3 & getfieldvalue(options,'view')==2 )
++if (dimension(md.mesh)==3 & getfieldvalue(options,'view',2)==2 )
+ 	options=addfielddefault(options,'ylabel','z');
++	options=addfielddefault(options,'axis','auto');
+ end
+-applyoptions(md,[],options);
++applyoptions(md3d,[],options);
Index: issm/oecreview/Archive/16554-17801/ISSM-17786-17787.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17786-17787.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17786-17787.diff	(revision 17802)
@@ -0,0 +1,65 @@
+Index: ../trunk-jpl/test/NightlyRun/test435.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test435.m	(revision 17786)
++++ ../trunk-jpl/test/NightlyRun/test435.m	(revision 17787)
+@@ -46,7 +46,7 @@
+ field_names     ={'Bed1','Surface1','Thickness1','Floatingice1','Vx1','Vy1','Vz1','Pressure1',...
+ 	'Bed2','Surface2','Thickness2','Floatingice2','Vx2','Vy2','Vz2','Pressure2',...
+ 	'Bed3','Surface3','Thickness3','Floatingice3','Vx3','Vy3','Vz3','Pressure3'};
+-field_tolerances={2e-11,3e-12,2e-11,1e-11,4e-10,1e-08,6e-10,1e-13,...
++field_tolerances={2e-11,5e-12,2e-11,1e-11,4e-10,1e-08,6e-10,1e-13,...
+ 	3e-11,3e-11,9e-10,7e-11,1e-09,1e-08,1e-09,1e-10,...
+ 	1e-10,3e-11,1e-10,7e-11,1e-09,1e-08,1e-09,1e-10};
+ field_values={...
+Index: ../trunk-jpl/test/NightlyRun/test322.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test322.m	(revision 17786)
++++ ../trunk-jpl/test/NightlyRun/test322.m	(revision 17787)
+@@ -22,7 +22,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Gradient','Misfits','FrictionCoefficient','Pressure','Vel','Vx','Vy'};
+-field_tolerances={2e-06,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,2e-09,2e-09,2e-09};
++field_tolerances={1e-05,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,2e-09,2e-09,2e-09};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Gradient1),...
+ 	(md.results.StressbalanceSolution.J),...
+Index: ../trunk-jpl/test/NightlyRun/test209.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test209.py	(revision 17786)
++++ ../trunk-jpl/test/NightlyRun/test209.py	(revision 17787)
+@@ -26,7 +26,7 @@
+ field_tolerances=[\
+ 	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-8,\
+ 	1e-13,1e-13,3e-9,1e-13,3.8e-11,3.85e-11,3.85e-11,3.85e-11,1e-13,2e-8,\
+-	5e-11,6e-12,1e-08,6e-12,3.9e-11,1e-10,1e-10,1e-10,9e-12,2e-8]
++	5e-11,6e-12,1e-08,6e-12,3.9e-11,1e-10,1e-10,1e-10,9e-12,5e-8]
+ 
+ field_values=[\
+ 	md.results.TransientSolution[0].Vx,\
+Index: ../trunk-jpl/test/NightlyRun/test209.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test209.m	(revision 17786)
++++ ../trunk-jpl/test/NightlyRun/test209.m	(revision 17787)
+@@ -13,7 +13,7 @@
+ field_tolerances={...
+ 	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-8,...
+ 	1e-13,1e-13,3e-9,1e-13,3.8e-11,3.85e-11,3.85e-11,3.85e-11,1e-13,2e-8,...
+-	5e-11,6e-12,1e-08,6e-12,3.9e-11,1e-10,1e-10,1e-10,9e-12,2e-8};
++	5e-11,6e-12,1e-08,6e-12,3.9e-11,1e-10,1e-10,1e-10,9e-12,5e-8};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
+ 	(md.results.TransientSolution(1).Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test322.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test322.py	(revision 17786)
++++ ../trunk-jpl/test/NightlyRun/test322.py	(revision 17787)
+@@ -34,7 +34,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Gradient','Misfits','FrictionCoefficient','Pressure','Vel','Vx','Vy']
+-field_tolerances=[5e-05,1e-08,1e-09,1e-09,2e-09,2e-09,2e-09]
++field_tolerances=[1e-05,1e-08,1e-09,1e-09,2e-09,2e-09,2e-09]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Gradient1,\
+ 	md.results.StressbalanceSolution.J,\
Index: issm/oecreview/Archive/16554-17801/ISSM-17787-17788.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17787-17788.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17787-17788.diff	(revision 17802)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/test/NightlyRun/test211.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.py	(revision 17787)
++++ ../trunk-jpl/test/NightlyRun/test211.py	(revision 17788)
+@@ -27,7 +27,7 @@
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3']
+ field_tolerances=[\
+ 	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,\
+-	2e-08,3e-08,1e-06,3e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06,\
++	5e-08,3e-08,1e-06,3e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06,\
+ 	1e-07,1e-07,1e-05,5e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06]
+ field_values=[\
+ 	md.results.TransientSolution[0].Vx,\
+Index: ../trunk-jpl/test/NightlyRun/test211.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.m	(revision 17787)
++++ ../trunk-jpl/test/NightlyRun/test211.m	(revision 17788)
+@@ -14,7 +14,7 @@
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3'};
+ field_tolerances={...
+ 	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,...
+-	2e-08,3e-08,1e-06,3e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06,...
++	5e-08,3e-08,1e-06,3e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06,...
+ 	1e-07,1e-07,1e-05,5e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
Index: issm/oecreview/Archive/16554-17801/ISSM-17788-17789.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17788-17789.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17788-17789.diff	(revision 17802)
@@ -0,0 +1,20 @@
+Index: ../trunk-jpl/externalpackages/gmsh/install.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/gmsh/install.sh	(revision 17788)
++++ ../trunk-jpl/externalpackages/gmsh/install.sh	(revision 17789)
+@@ -10,8 +10,12 @@
+ 
+ #Configure
+ cd install
++cmake ../src -DCMAKE_INSTALL_PREFIX="$ISSM_DIR/externalpackages/gmsh/install"
+ 
+-#Install
+-cmake ../src
+-make
++#Compile and install
++if [ $# -eq 0 ]; then
++	make
++else
++	make -j $1
++fi
+ make install
Index: issm/oecreview/Archive/16554-17801/ISSM-17789-17790.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17789-17790.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17789-17790.diff	(revision 17802)
@@ -0,0 +1,223 @@
+Index: ../trunk-jpl/src/m/solve/process_solve_options.py
+===================================================================
+--- ../trunk-jpl/src/m/solve/process_solve_options.py	(revision 17789)
++++ ../trunk-jpl/src/m/solve/process_solve_options.py	(revision 17790)
+@@ -1,45 +0,0 @@
+-import os
+-from collections import OrderedDict
+-from EnumDefinitions import *
+-from EnumToString import EnumToString
+-
+-def process_solve_options(options):
+-	"""
+-	DEFAULT_SOLVE_OPTIONS - set up default options for solve phase
+- 
+-	   Usage:
+-	      options=process_solve_options(options)
+- 
+-	   See also: SOLVE
+-	"""
+-
+-	outoptions=OrderedDict()
+-
+-	#solution_type: check on this option, error out otherwise
+-	solution_type=options.getfieldvalue('solution_type')
+-	if EnumToString(solution_type)[0][-8:] != 'Solution':
+-		raise ValueError("solution_type '%s' not supported!" % EnumToString(solution_type)[0])
+-	outoptions['solution_type']=solution_type
+-	outoptions['batch']=options.getfieldvalue('batch','no')
+-	outoptions['loadonly']=options.getfieldvalue('loadonly',False)
+-
+-	#  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',[])
+-
+-	return outoptions
+-
+Index: ../trunk-jpl/src/m/solve/process_solve_options.m
+===================================================================
+--- ../trunk-jpl/src/m/solve/process_solve_options.m	(revision 17789)
++++ ../trunk-jpl/src/m/solve/process_solve_options.m	(revision 17790)
+@@ -1,35 +0,0 @@
+-function outoptions=process_solve_options(options)
+-%DEFAULT_SOLVE_OPTIONS - set up default options for solve phase
+-%
+-%   Usage:
+-%      options=process_solve_options(options)
+-%
+-%   See also: SOLVE
+-
+-%solution_type: check on this option, error out otherwise
+-solution_type=getfieldvalue(options,'solution_type');
+-if ~strncmp(fliplr(EnumToString(solution_type)),fliplr('Solution'),8),
+-	error(['solution_type ' EnumToString(solution_type) ' not supported!']);
+-end
+-outoptions.solution_type=solution_type;
+-outoptions.runtimename=getfieldvalue(options,'runtimename',true);
+-outoptions.batch=getfieldvalue(options,'batch','no');
+-outoptions.loadonly=getfieldvalue(options,'loadonly',false);
+-
+-%  process qmu arguments
+-outoptions.qmudir=getfieldvalue(options,'qmudir',['qmu' num2str(feature('GetPid'))]);  % qmudir =['qmu_' datestr(now,'yyyymmdd_HHMMSS')];
+-outoptions.qmufile=getfieldvalue(options,'qmufile','qmu');% qmufile cannot be changed unless ????script.sh is also changed
+-outoptions.overwrite=getfieldvalue(options,'overwrite','n');
+-outoptions.keep=getfieldvalue(options,'keep','n');
+-outoptions.ivar=getfieldvalue(options,'ivar',1);
+-outoptions.iresp=getfieldvalue(options,'iresp',1);
+-outoptions.imethod=getfieldvalue(options,'imethod',1);
+-outoptions.iparams=getfieldvalue(options,'iparams',1);
+-outoptions.runmpi=getfieldvalue(options,'runmpi',false);
+-
+-%  process flaim arguments
+-outoptions.fmdir=getfieldvalue(options,'fmdir',['fm' num2str(feature('GetPid'))]);
+-outoptions.overwrite=getfieldvalue(options,'overwrite','n');
+-outoptions.keep=getfieldvalue(options,'keep','y');
+-outoptions.latsgn=getfieldvalue(options,'latsgn',0);
+-outoptions.cmap=getfieldvalue(options,'cmap',[]);
+Index: ../trunk-jpl/src/m/solve/solve.py
+===================================================================
+--- ../trunk-jpl/src/m/solve/solve.py	(revision 17789)
++++ ../trunk-jpl/src/m/solve/solve.py	(revision 17790)
+@@ -24,7 +24,7 @@
+ 	      - MasstransportSolutionEnum
+ 	      - ThermalSolutionEnum
+ 	      - SteadystateSolutionEnum
+-	      - TransientSolutionEnum...
++	      - TransientSolutionEnum
+ 	      - BalancethicknessSolutionEnum
+ 	      - BedSlopeSolutionEnum
+ 	      - SurfaceSlopeSolutionEnum
+@@ -39,11 +39,12 @@
+ 	"""
+ 
+ 	#recover and process solve options
+-	options=pairoptions('solution_type',solutionenum,*args)
+-	options=process_solve_options(options)
++	if EnumToString(solutionenum)[0][-8:] != 'Solution':
++		raise ValueError("solutionenum '%s' not supported!" % EnumToString(solutionenum)[0])
++	options=pairoptions('solutionenum',solutionenum,*args)
+ 
+ 	#recover some fields
+-	md.private.solution=options['solution_type']
++	md.private.solution=solutionenum
+ 	cluster=md.cluster
+ 
+ 	#check model consistency
+@@ -67,13 +68,13 @@
+ 		md=preqmu(md,options)
+ 
+ 	#flaim analysis
+-	if options['solution_type'] == FlaimSolutionEnum():
++	if solutionenum == FlaimSolutionEnum():
+ 		md=flaim_sol(md,options)
+-		[md.private.solution]=EnumToString(options['solution_type'])
++		[md.private.solution]=EnumToString(solutionenum)
+ 		return md
+ 
+ 	#Do we load results only?
+-	if options['loadonly']:  
++	if options.getfieldvalue('loadonly',False):
+ 		md=loadresultsfromcluster(md)
+ 		return md
+ 
+@@ -83,7 +84,7 @@
+ 	cluster.BuildQueueScript(md.private.runtimename,md.miscellaneous.name,md.private.solution,md.settings.io_gather,md.debug.valgrind,md.debug.gprof)    # queue file
+ 
+ 	#Stop here if batch mode
+-	if m.strcmpi(options['batch'],'yes'):
++	if m.strcmpi(options.getfieldvalue('batch','no'),'yes'):
+ 		print 'batch mode requested: not launching job interactively'
+ 		print 'launch solution sequence on remote cluster by hand'
+ 		return md
+@@ -111,4 +112,3 @@
+ 			shutil.rmtree('qmu'+str(os.getpid()))
+ 
+ 	return md
+-
+Index: ../trunk-jpl/src/m/solve/solve.m
+===================================================================
+--- ../trunk-jpl/src/m/solve/solve.m	(revision 17789)
++++ ../trunk-jpl/src/m/solve/solve.m	(revision 17790)
+@@ -10,7 +10,7 @@
+ %		 - MasstransportSolutionEnum
+ %		 - ThermalSolutionEnum
+ %		 - SteadystateSolutionEnum
+-%		 - TransientSolutionEnum...
++%		 - TransientSolutionEnum
+ %		 - BalancethicknessSolutionEnum
+ %		 - BedSlopeSolutionEnum
+ %		 - SurfaceSlopeSolutionEnum
+@@ -25,11 +25,13 @@
+ %      md=solve(md,StressbalanceSolutionEnum);
+ 
+ %recover and process solve options
+-options=pairoptions(varargin{:},'solution_type',solutionenum);
+-options=process_solve_options(options);
++if ~strncmp(fliplr(EnumToString(solutionenum)),fliplr('Solution'),8),
++	error(['solutionenum ' EnumToString(solutionenum) ' not supported!']);
++end
++options=pairoptions(varargin{:},'solutionenum',solutionenum);
+ 
+ %recover some fields
+-md.private.solution=options.solution_type;
++md.private.solution=solutionenum;
+ cluster=md.cluster;
+ 
+ %check model consistency
+@@ -48,7 +50,7 @@
+ end
+ 
+ %First, build a runtime name that is unique
+-if options.runtimename,
++if getfieldvalue(options,'runtimename',true),
+ 	c=clock;
+ 	md.private.runtimename=sprintf('%s-%02i-%02i-%04i-%02i-%02i-%02i-%i',md.miscellaneous.name,c(2),c(3),c(1),c(4),c(5),floor(c(6)),feature('GetPid'));
+ else
+@@ -61,15 +63,20 @@
+ 	md=preqmu(md,options);
+ end
+ 
+-%flaim analysis
+-if (options.solution_type == FlaimSolutionEnum())
++%flaim analysis (To be removed?)
++if (solutionenum == FlaimSolutionEnum())
++	%fmdir     = getfieldvalue(options,'fmdir',['fm' num2str(feature('GetPid'))]);
++	%overwrite = getfieldvalue(options,'overwrite','n');
++	%keep      = getfieldvalue(options,'keep','y');
++	%latsgn    = getfieldvalue(options,'latsgn',0);
++	%cmap      = getfieldvalue(options,'cmap',[]);
+ 	md=flaim_sol(md,options);
+-	md.private.solution=EnumToString(options.solution_type);
++	md.private.solution=EnumToString(solutionenum);
+ 	return;
+ end
+ 
+ %Do we load results only?
+-if options.loadonly,  
++if getfieldvalue(options,'loadonly',false),
+ 	md=loadresultsfromcluster(md);
+ 	return;
+ end
+@@ -80,7 +87,7 @@
+ BuildQueueScript(cluster,md.private.runtimename,md.miscellaneous.name,md.private.solution,md.settings.io_gather,md.debug.valgrind,md.debug.gprof); % queue file
+ 
+ %Stop here if batch mode
+-if strcmpi(options.batch,'yes')
++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');
Index: issm/oecreview/Archive/16554-17801/ISSM-17790-17791.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17790-17791.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17790-17791.diff	(revision 17802)
@@ -0,0 +1,77 @@
+Index: ../trunk-jpl/src/m/qmu/preqmu.m
+===================================================================
+--- ../trunk-jpl/src/m/qmu/preqmu.m	(revision 17790)
++++ ../trunk-jpl/src/m/qmu/preqmu.m	(revision 17791)
+@@ -12,17 +12,19 @@
+ %       imethod: same thing for methods
+ %       iparams: same thing for params
+ %       overwrite: overwrite qmudir before analysis
+-%       keep: keep qmudir after analysis
+-%       outfiles: (John?)
+-%       rstfile: backup file name
+-%       rundakota: (John?)
+-%       runmpi: (John?)
+ 
+ disp('preprocessing dakota inputs');
++qmudir    = getfieldvalue(options,'qmudir',['qmu' num2str(feature('GetPid'))]);  % qmudir = ['qmu_' datestr(now,'yyyymmdd_HHMMSS')];
++qmufile   = getfieldvalue(options,'qmufile','qmu');% qmufile cannot be changed unless ????script.sh is also changed
++overwrite = getfieldvalue(options,'overwrite','n');
++ivar      = getfieldvalue(options,'ivar',1);
++iresp     = getfieldvalue(options,'iresp',1);
++imethod   = getfieldvalue(options,'imethod',1);
++iparams   = getfieldvalue(options,'iparams',1);
+ 
+ %first create temporary directory in which we will work
+-if strncmpi(options.overwrite,'y',1)
+-	system(['rm -rf ' options.qmudir '/*']); 
++if strncmpi(overwrite,'y',1)
++	system(['rm -rf ' qmudir '/*']); 
+ else
+ 	%does the directory exist? if so, then error out
+ 	if exist(options.qmudir)==7,
+@@ -33,11 +35,11 @@
+ cd(options.qmudir)
+ 
+ %when running in library mode, the in file needs to be called md.miscellaneous.name.qmu.in
+-options.qmufile=[md.miscellaneous.name ];
++qmufile=[md.miscellaneous.name ];
+ 
+ %retrieve variables and resposnes for this particular analysis.
+-variables=md.qmu.variables(options.ivar);
+-responses=md.qmu.responses(options.iresp);
++variables=md.qmu.variables(ivar);
++responses=md.qmu.responses(iresp);
+ 
+ %expand variables and responses
+ variables=expandvariables(md,variables);
+@@ -72,25 +74,25 @@
+ %}}}}
+ 
+ %create in file for dakota
+-dakota_in_data(md.qmu.method(options.imethod),variables,responses,md.qmu.params(options.iparams),options.qmufile);
++dakota_in_data(md.qmu.method(imethod),variables,responses,md.qmu.params(iparams),qmufile);
+ system(['rm -rf ' md.miscellaneous.name '.m']);
+ 
+ %build a list of variables and responses descriptors. the list is not expanded. {{{
+ variabledescriptors={};
+-variable_fieldnames=fieldnames(md.qmu.variables(options.ivar));
++variable_fieldnames=fieldnames(md.qmu.variables(ivar));
+ for i=1:length(variable_fieldnames),
+ 	field_name=variable_fieldnames{i};
+-	fieldvariables=md.qmu.variables(options.ivar).(field_name);
++	fieldvariables=md.qmu.variables(ivar).(field_name);
+ 	for j=1:numel(fieldvariables)
+ 		variabledescriptors{end+1}=fieldvariables(j).descriptor;
+ 	end
+ end
+ 
+ responsedescriptors={};
+-response_fieldnames=fieldnames(md.qmu.responses(options.iresp));
++response_fieldnames=fieldnames(md.qmu.responses(iresp));
+ for i=1:length(response_fieldnames),
+ 	field_name=response_fieldnames{i};
+-	fieldresponses=md.qmu.responses(options.iresp).(field_name);
++	fieldresponses=md.qmu.responses(iresp).(field_name);
+ 	for j=1:numel(fieldresponses)
+ 		responsedescriptors{end+1}=fieldresponses(j).descriptor;
+ 	end
Index: issm/oecreview/Archive/16554-17801/ISSM-17791-17792.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17791-17792.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17791-17792.diff	(revision 17802)
@@ -0,0 +1,20 @@
+Index: ../trunk-jpl/src/m/qmu/preqmu.m
+===================================================================
+--- ../trunk-jpl/src/m/qmu/preqmu.m	(revision 17791)
++++ ../trunk-jpl/src/m/qmu/preqmu.m	(revision 17792)
+@@ -27,12 +27,12 @@
+ 	system(['rm -rf ' qmudir '/*']); 
+ else
+ 	%does the directory exist? if so, then error out
+-	if exist(options.qmudir)==7,
++	if exist(qmudir)==7,
+ 		error('Existing ''%s'' directory, cannot overwrite. Specify ''overwrite'',''y'' option in solve arguments.',options.qmudir);
+ 	end
+ end
+-mkdir(options.qmudir)
+-cd(options.qmudir)
++mkdir(qmudir)
++cd(qmudir)
+ 
+ %when running in library mode, the in file needs to be called md.miscellaneous.name.qmu.in
+ qmufile=[md.miscellaneous.name ];
Index: issm/oecreview/Archive/16554-17801/ISSM-17792-17793.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17792-17793.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17792-17793.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/m/contrib/bamg/YamsCall.m
+===================================================================
+--- ../trunk-jpl/src/m/contrib/bamg/YamsCall.m	(revision 17792)
++++ ../trunk-jpl/src/m/contrib/bamg/YamsCall.m	(revision 17793)
+@@ -84,7 +84,6 @@
+ Coor=load('carre1.coor');
+ md.mesh.x=Coor(:,1);
+ md.mesh.y=Coor(:,2);
+-md.mesh.z=zeros(size(Coor,1),1);
+ md.mesh.elements=Tria;
+ md.mesh.numberofvertices=size(Coor,1);
+ md.mesh.numberofelements=size(Tria,1);
Index: issm/oecreview/Archive/16554-17801/ISSM-17793-17794.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17793-17794.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17793-17794.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/solve/solve.m
+===================================================================
+--- ../trunk-jpl/src/m/solve/solve.m	(revision 17793)
++++ ../trunk-jpl/src/m/solve/solve.m	(revision 17794)
+@@ -132,7 +132,7 @@
+ 
+ %post processes qmu results if necessary
+ if md.qmu.isdakota,
+-	if ~strncmpi(options.keep,'y',1)
++	if ~strncmpi(getfieldvalue(options,'keep','y'),'y',1)
+ 		system(['rm -rf qmu' num2str(feature('GetPid'))]);
+ 	end
+ end
Index: issm/oecreview/Archive/16554-17801/ISSM-17794-17795.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17794-17795.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17794-17795.diff	(revision 17802)
@@ -0,0 +1,88 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17794)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17795)
+@@ -395,7 +395,7 @@
+ 				}
+ 			}
+ 
+-			/*P1xP3 pressure*/
++			/*P1 pressure*/
+ 			vnodes = id0+3*iomodel->numberoffaces;
+ 			for(i=0;i<iomodel->numberofvertices;i++){
+ 				if(iomodel->my_vertices[i]){
+@@ -403,17 +403,6 @@
+ 				}
+ 				counter++;
+ 			}
+-			for(i=0;i<iomodel->numberofedges;i++){
+-				if(iomodel->edges[i*3+2]==2){
+-					if(my_edges[i]){
+-						node = new Node(vnodes+iomodel->numberofvertices+2*i+1,counter+1,lid++,0,iomodel,analysis,FSpressureEnum);
+-						nodes->AddObject(node);
+-						node = new Node(vnodes+iomodel->numberofvertices+2*i+2,counter+2,lid++,0,iomodel,analysis,FSpressureEnum);
+-						nodes->AddObject(node);
+-					}
+-					counter=counter+2;
+-				}
+-			}
+ 			break;
+ 
+ 		default:
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17794)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17795)
+@@ -1129,7 +1129,7 @@
+ 		case MINIcondensedEnum:     return NUMNODESP1b+NUMNODESP1;
+ 		case MINIEnum:              return NUMNODESP1b+NUMNODESP1;
+ 		case TaylorHoodEnum:        return NUMNODESP2+NUMNODESP1;
+-		case OneLayerP4zEnum:       return NUMNODESP2xP4+NUMNODESP1xP3;
++		case OneLayerP4zEnum:       return NUMNODESP2xP4+NUMNODESP1;
+ 		case P2xP4Enum:             return NUMNODESP2xP4;
+ 		case P1xP3Enum:             return NUMNODESP1xP3;
+ 		default:       _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+@@ -1147,7 +1147,7 @@
+ 		case MINIcondensedEnum: return NUMNODESP1;
+ 		case MINIEnum:          return NUMNODESP1;
+ 		case TaylorHoodEnum:    return NUMNODESP1;
+-		case OneLayerP4zEnum:   return NUMNODESP1xP3;
++		case OneLayerP4zEnum:   return NUMNODESP1;
+ 		default: _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+ 	}
+ 
+@@ -1195,7 +1195,7 @@
+ 		case MINIcondensedEnum: return P1Enum;
+ 		case MINIEnum:          return P1Enum;
+ 		case TaylorHoodEnum:    return P1Enum;
+-		case OneLayerP4zEnum:   return P1xP3Enum;
++		case OneLayerP4zEnum:   return P1Enum;
+ 		default:       _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+ 	}
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17794)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17795)
+@@ -2497,7 +2497,7 @@
+ 			penta_node_ids[23]=iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofedges+iomodel->numberoffaces+iomodel->elements[6*index+5];
+ 			break;
+ 		case OneLayerP4zEnum:
+-			numnodes         = 30+12;
++			numnodes         = 30+6;
+ 			penta_node_ids   = xNew<int>(numnodes);
+ 			penta_node_ids[ 0]=iomodel->nodecounter+iomodel->elements[6*index+0]; /*Vertex 1*/
+ 			penta_node_ids[ 1]=iomodel->nodecounter+iomodel->elements[6*index+1]; /*Vertex 2*/
+@@ -2536,12 +2536,6 @@
+ 			penta_node_ids[33]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->numberoffaces+iomodel->elements[6*index+3];
+ 			penta_node_ids[34]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->numberoffaces+iomodel->elements[6*index+4];
+ 			penta_node_ids[35]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->numberoffaces+iomodel->elements[6*index+5];
+-			penta_node_ids[36]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->numberoffaces+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+0]+1;
+-			penta_node_ids[37]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->numberoffaces+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+1]+1;
+-			penta_node_ids[38]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->numberoffaces+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+2]+1;
+-			penta_node_ids[39]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->numberoffaces+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+0]+2;
+-			penta_node_ids[40]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->numberoffaces+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+1]+2;
+-			penta_node_ids[41]=iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*iomodel->numberoffaces+iomodel->numberofvertices+2*iomodel->elementtoedgeconnectivity[9*index+2]+2;
+ 			break;
+ 		default:
+ 			_error_("Finite element "<<EnumToStringx(finiteelement_type)<<" not supported yet");
Index: issm/oecreview/Archive/16554-17801/ISSM-17795-17796.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17795-17796.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17795-17796.diff	(revision 17802)
@@ -0,0 +1,39 @@
+Index: ../trunk-jpl/test/NightlyRun/test403.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test403.m	(revision 17795)
++++ ../trunk-jpl/test/NightlyRun/test403.m	(revision 17796)
+@@ -8,7 +8,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure'};
+-field_tolerances={1e-09,1e-09,1e-09,1e-09,1e-09};
++field_tolerances={2e-09,1e-09,1e-09,1e-09,1e-09};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test285.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test285.m	(revision 17795)
++++ ../trunk-jpl/test/NightlyRun/test285.m	(revision 17796)
+@@ -12,7 +12,7 @@
+ 	md.flowequation.fe_HO=i{1};
+ 	md=solve(md,StressbalanceSolutionEnum());
+ 	field_names     ={field_names{:},['Vx' i{1}],['Vy' i{1}],['Vz' i{1}],['Vel' i{1}],['Pressure' i{1}]};
+-	field_tolerances={field_tolerances{:},6e-08,3e-08,2e-08,3e-08,1e-13};
++	field_tolerances={field_tolerances{:},6e-08,4e-08,2e-08,4e-08,1e-13};
+ 	field_values={field_values{:},...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test285.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test285.py	(revision 17795)
++++ ../trunk-jpl/test/NightlyRun/test285.py	(revision 17796)
+@@ -22,7 +22,7 @@
+ 	md.flowequation.fe_HO=i
+ 	md=solve(md,StressbalanceSolutionEnum())
+ 	field_names     =field_names+['Vx'+i,'Vy'+i,'Vz'+i,'Vel'+i,'Pressure'+i]
+-	field_tolerances=field_tolerances+[6e-08,3e-08,2e-08,3e-08,1e-13]
++	field_tolerances=field_tolerances+[6e-08,4e-08,2e-08,4e-08,1e-13]
+ 	field_values=field_values+[\
+ 		md.results.StressbalanceSolution.Vx,\
+ 		md.results.StressbalanceSolution.Vy,\
Index: issm/oecreview/Archive/16554-17801/ISSM-17796-17797.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17796-17797.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17796-17797.diff	(revision 17802)
@@ -0,0 +1,191 @@
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17796)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17797)
+@@ -538,6 +538,7 @@
+ 	QmuTemperatureEnum,
+ 	HydrologyWaterVxEnum,
+ 	HydrologyWaterVyEnum,
++	SigmaNNEnum,
+ 	StressTensorEnum,
+ 	StressTensorxxEnum,
+ 	StressTensorxyEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17796)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17797)
+@@ -527,6 +527,7 @@
+ 		case QmuTemperatureEnum : return "QmuTemperature";
+ 		case HydrologyWaterVxEnum : return "HydrologyWaterVx";
+ 		case HydrologyWaterVyEnum : return "HydrologyWaterVy";
++		case SigmaNNEnum : return "SigmaNN";
+ 		case StressTensorEnum : return "StressTensor";
+ 		case StressTensorxxEnum : return "StressTensorxx";
+ 		case StressTensorxyEnum : return "StressTensorxy";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17796)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17797)
+@@ -539,6 +539,7 @@
+ 	      else if (strcmp(name,"QmuTemperature")==0) return QmuTemperatureEnum;
+ 	      else if (strcmp(name,"HydrologyWaterVx")==0) return HydrologyWaterVxEnum;
+ 	      else if (strcmp(name,"HydrologyWaterVy")==0) return HydrologyWaterVyEnum;
++	      else if (strcmp(name,"SigmaNN")==0) return SigmaNNEnum;
+ 	      else if (strcmp(name,"StressTensor")==0) return StressTensorEnum;
+ 	      else if (strcmp(name,"StressTensorxx")==0) return StressTensorxxEnum;
+ 	      else if (strcmp(name,"StressTensorxy")==0) return StressTensorxyEnum;
+@@ -627,11 +628,11 @@
+ 	      else if (strcmp(name,"AgressiveMigration")==0) return AgressiveMigrationEnum;
+ 	      else if (strcmp(name,"SoftMigration")==0) return SoftMigrationEnum;
+ 	      else if (strcmp(name,"SubelementMigration")==0) return SubelementMigrationEnum;
+-	      else if (strcmp(name,"SubelementMigration2")==0) return SubelementMigration2Enum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"Contact")==0) return ContactEnum;
++	      if (strcmp(name,"SubelementMigration2")==0) return SubelementMigration2Enum;
++	      else if (strcmp(name,"Contact")==0) return ContactEnum;
+ 	      else if (strcmp(name,"MaskGroundediceLevelset")==0) return MaskGroundediceLevelsetEnum;
+ 	      else if (strcmp(name,"QmuMaskGroundediceLevelset")==0) return QmuMaskGroundediceLevelsetEnum;
+ 	      else if (strcmp(name,"GaussSeg")==0) return GaussSegEnum;
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17796)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17797)
+@@ -199,6 +199,7 @@
+ 
+ 		virtual IssmDouble SurfaceArea(void)=0;
+ 		virtual void   InputDepthAverageAtBase(int enum_type,int average_enum_type)=0;
++		virtual void   ComputeSigmaNN(void)=0;
+ 		virtual void   ComputeBasalStress(Vector<IssmDouble>* sigma_b)=0;
+ 		virtual void   ComputeStrainRate(Vector<IssmDouble>* eps)=0;
+ 		virtual void   ComputeStressTensor(void)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17796)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17797)
+@@ -146,6 +146,61 @@
+ 	_error_("Not Implemented yet");
+ }
+ /*}}}*/
++/*FUNCTION Tria::ComputeSigmaNN {{{*/
++void  Tria::ComputeSigmaNN(){
++
++	if(~IsOnBase()){
++		IssmDouble sigma_nn=0;
++		this->inputs->AddInput(new TriaInput(SigmaNNEnum,&sigma_nn,P0Enum));
++		return;
++	}
++	else{
++		IssmDouble* xyz_list=NULL;
++		IssmDouble  pressure,viscosity,sigma_nn;
++		IssmDouble  sigma_xx,sigma_xy,sigma_yy;
++		IssmDouble  epsilon[3]; /* epsilon=[exx,eyy,exy];*/
++		IssmDouble  base_normal[2]; 
++		int domaintype,dim=2;
++
++		/* Get node coordinates and dof list: */
++		GetVerticesCoordinates(&xyz_list);
++
++		/*Retrieve all inputs we will be needing: */
++		this->FindParam(&domaintype,DomainTypeEnum);
++		if(domaintype==Domain2DhorizontalEnum) _error_("stress tensor calculation not supported for mesh of type " <<EnumToStringx(domaintype)<<", extrude mesh or call ComputeDeviatoricStressTensor");
++		Input* pressure_input=inputs->GetInput(PressureEnum); _assert_(pressure_input);
++		Input* vx_input=inputs->GetInput(VxEnum);             _assert_(vx_input);
++		Input* vy_input=inputs->GetInput(VyEnum);             _assert_(vy_input);
++
++		/* Start looping on the number of vertices: */
++		Gauss* gauss=NewGaussBase(1);
++		gauss->GaussPoint(0);
++
++		/*Compute strain rate viscosity and pressure: */
++		this->StrainRateSSA(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
++		this->ViscosityFS(&viscosity,dim,xyz_list,gauss,vx_input,vy_input,NULL);
++		pressure_input->GetInputValue(&pressure,gauss);
++
++		/*Compute Stress*/
++		sigma_xx=2*viscosity*epsilon[0]-pressure; // sigma = nu eps - pressure
++		sigma_yy=2*viscosity*epsilon[1]-pressure;
++		sigma_xy=2*viscosity*epsilon[2];
++
++		/*Get normal vector to the bed */
++		NormalBase(&base_normal[0],xyz_list);
++
++		/*Compute sigma_nn*/
++		sigma_nn=sigma_xx*base_normal[0]*base_normal[0] + sigma_xy*base_normal[0]*base_normal[1] + sigma_yy*base_normal[1]*base_normal[1];
++
++		/*Add Stress tensor components into inputs*/
++		this->inputs->AddInput(new TriaInput(SigmaNNEnum,&sigma_nn,P0Enum));
++
++		/*Clean up and return*/
++		xDelete<IssmDouble>(xyz_list);
++		delete gauss;
++	}
++}
++/*}}}*/
+ /*FUNCTION Tria::ComputeStrainRate {{{*/
+ void  Tria::ComputeStrainRate(Vector<IssmDouble>* eps){
+ 	_error_("Not Implemented yet");
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17796)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17797)
+@@ -51,6 +51,7 @@
+ 		/*Element virtual functions definitions: {{{*/
+ 		IssmDouble  CharacteristicLength(void);
+ 		void        ComputeBasalStress(Vector<IssmDouble>* sigma_b);
++		void        ComputeSigmaNN();
+ 		void        ComputeStrainRate(Vector<IssmDouble>* eps);
+ 		void        ComputeStressTensor();
+ 		void        ComputeDeviatoricStressTensor();
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17796)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17797)
+@@ -55,6 +55,7 @@
+ 		IssmDouble CharacteristicLength(void){_error_("not implemented yet");};
+ 		void   ComputeBasalStress(Vector<IssmDouble>* sigma_b);
+ 		void   ComputeStrainRate(Vector<IssmDouble>* eps);
++		void   ComputeSigmaNN(){_error_("not implemented yet");};
+ 		void   ComputeStressTensor();
+ 		void   ComputeDeviatoricStressTensor();
+ 		void   Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17796)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17797)
+@@ -53,6 +53,7 @@
+ 		void        AddInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
+ 		IssmDouble  CharacteristicLength(void);
+ 		void        ComputeBasalStress(Vector<IssmDouble>* sigma_b){_error_("not implemented yet");};
++		void        ComputeSigmaNN(){_error_("not implemented yet");};
+ 		void        ComputeStrainRate(Vector<IssmDouble>* eps){_error_("not implemented yet");};
+ 		void        ComputeStressTensor(){_error_("not implemented yet");};
+ 		void        ComputeDeviatoricStressTensor(){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17796)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17797)
+@@ -53,6 +53,7 @@
+ 		void        AddInput(int input_enum, IssmDouble* values, int interpolation_enum);
+ 		IssmDouble  CharacteristicLength(void){_error_("not implemented yet");};
+ 		void        ComputeBasalStress(Vector<IssmDouble>* sigma_b){_error_("not implemented yet");};
++		void        ComputeSigmaNN(){_error_("not implemented yet");};
+ 		void        ComputeStrainRate(Vector<IssmDouble>* eps){_error_("not implemented yet");};
+ 		void        ComputeStressTensor(){_error_("not implemented yet");};
+ 		void        ComputeDeviatoricStressTensor(){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17796)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17797)
+@@ -826,6 +826,10 @@
+ 				this->ComputeDeviatoricStressTensor();
+ 				input=this->inputs->GetInput(output_enum);
+ 				break;
++			case SigmaNNEnum: 
++				this->ComputeSigmaNN();
++				input=this->inputs->GetInput(output_enum);
++				break;
+ 			default:
+ 				_error_("input "<<EnumToStringx(output_enum)<<" not found in element");
+ 		}
Index: issm/oecreview/Archive/16554-17801/ISSM-17797-17798.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17797-17798.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17797-17798.diff	(revision 17802)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/m/solve/solve.py
+===================================================================
+--- ../trunk-jpl/src/m/solve/solve.py	(revision 17797)
++++ ../trunk-jpl/src/m/solve/solve.py	(revision 17798)
+@@ -2,7 +2,6 @@
+ import os
+ import shutil
+ from pairoptions import pairoptions
+-from process_solve_options import process_solve_options
+ from EnumDefinitions import *
+ from EnumToString import EnumToString
+ from ismodelselfconsistent import ismodelselfconsistent
Index: issm/oecreview/Archive/16554-17801/ISSM-17798-17799.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17798-17799.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17798-17799.diff	(revision 17802)
@@ -0,0 +1,44 @@
+Index: ../trunk-jpl/examples/SquareIceShelf/Square.par
+===================================================================
+--- ../trunk-jpl/examples/SquareIceShelf/Square.par	(revision 17798)
++++ ../trunk-jpl/examples/SquareIceShelf/Square.par	(revision 17799)
+@@ -5,9 +5,9 @@
+ hmax=1000;
+ ymin=min(md.mesh.y);
+ ymax=max(md.mesh.y);
+-md.geometry.thickness=hmax+(hmin-hmax)*(md.mesh.y-ymin)/(ymax-ymin);
+-md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
+-md.geometry.surface=md.geometry.bed+md.geometry.thickness;
++md.geometry.thickness = hmax+(hmin-hmax)*(md.mesh.y-ymin)/(ymax-ymin);
++md.geometry.base      = -md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
++md.geometry.surface   = md.geometry.base+md.geometry.thickness;
+ 
+ disp('      creating drag');
+ md.friction.coefficient=200*ones(md.mesh.numberofvertices,1);
+Index: ../trunk-jpl/examples/Jakobshavn/runme.m
+===================================================================
+--- ../trunk-jpl/examples/Jakobshavn/runme.m	(revision 17798)
++++ ../trunk-jpl/examples/Jakobshavn/runme.m	(revision 17799)
+@@ -1,4 +1,4 @@
+-steps=[2:3];
++steps=[1:3];
+ 
+ if any(steps==1)
+ 	disp('	Step 1: Mesh creation'); 
+Index: ../trunk-jpl/examples/Jakobshavn/Jks.par
+===================================================================
+--- ../trunk-jpl/examples/Jakobshavn/Jks.par	(revision 17798)
++++ ../trunk-jpl/examples/Jakobshavn/Jks.par	(revision 17799)
+@@ -21,10 +21,10 @@
+ md.geometry.thickness(pos0)=10;
+ 
+ disp('   Interpolating bedrock topography');
+-md.geometry.bed=InterpFromGridToMesh(x1,y1,topg,md.mesh.x,md.mesh.y,0);
++md.geometry.base = InterpFromGridToMesh(x1,y1,topg,md.mesh.x,md.mesh.y,0);
+ 
+ disp('   Constructing surface elevation');
+-md.geometry.surface=md.geometry.thickness+md.geometry.bed;
++md.geometry.surface=md.geometry.thickness+md.geometry.base;
+ 
+ disp('   Interpolating velocities');
+ md.inversion.vx_obs  = InterpFromGridToMesh(x1,y1,velx,md.mesh.x,md.mesh.y,0);
Index: issm/oecreview/Archive/16554-17801/ISSM-17799-17800.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17799-17800.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17799-17800.diff	(revision 17802)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/configure.ac
+===================================================================
+--- ../trunk-jpl/configure.ac	(revision 17799)
++++ ../trunk-jpl/configure.ac	(revision 17800)
+@@ -1,7 +1,7 @@
+ # Process this file with autoconf to produce a configure script.
+ 
+ #AUTOCONF
+-AC_INIT([Ice Sheet System Model (ISSM)],[4.5],[issm@jpl.nasa.gov],[issm],[http://issm.jpl.nasa.gov]) #Initializing configure
++AC_INIT([Ice Sheet System Model (ISSM)],[4.6],[issm@jpl.nasa.gov],[issm],[http://issm.jpl.nasa.gov]) #Initializing configure
+ AC_CONFIG_AUX_DIR([./aux-config])         #Put config files in aux-config
+ AC_CONFIG_MACRO_DIR([m4])                 #m4 macros are located in m4
+ m4_include([m4/issm_options.m4])
Index: issm/oecreview/Archive/16554-17801/ISSM-17800-17801.diff
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-17800-17801.diff	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-17800-17801.diff	(revision 17802)
@@ -0,0 +1,178 @@
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17800)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17801)
+@@ -88,172 +88,8 @@
+ }/*}}}*/
+ ElementMatrix* LevelsetAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+-	if(!element->IsOnBase()) return NULL;
+-	Element* basalelement = element->SpawnBasalElement();
++	_error_("NOT IMPLEMENTED YET");
+ 
+-	/*Intermediaries */
+-	int  dim, domaintype;
+-	int i, row, col;
+-	IssmDouble kappa;
+-	IssmDouble Jdet, dt, D_scalar;
+-	IssmDouble h,hx,hy,hz;
+-	IssmDouble vel, calvingrate;
+-	IssmDouble norm_dlsf;
+-	IssmDouble* xyz_list = NULL;
+-
+-	/*Get problem dimension*/
+-	basalelement->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Domain2DverticalEnum:   dim = 1; break;
+-		case Domain2DhorizontalEnum: dim = 2; break;
+-		case Domain3DEnum:           dim = 2; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes    = basalelement->GetNumberOfNodes();
+-
+-	/*Initialize Element vector and other vectors*/
+-	ElementMatrix* Ke       = basalelement->NewElementMatrix();
+-	IssmDouble*    basis    = xNew<IssmDouble>(numnodes);
+-	IssmDouble*    B        = xNew<IssmDouble>(dim*numnodes);
+-	IssmDouble*    Bprime   = xNew<IssmDouble>(dim*numnodes);
+-	IssmDouble*    D        = xNew<IssmDouble>(dim*dim);
+-	IssmDouble*    v        = xNew<IssmDouble>(dim);
+-	IssmDouble*    w        = xNew<IssmDouble>(dim);
+-	IssmDouble*    c        = xNew<IssmDouble>(dim);
+-	IssmDouble*    dlsf     = xNew<IssmDouble>(dim);
+-
+-	/*Retrieve all inputs and parameters*/
+-	basalelement->GetVerticesCoordinates(&xyz_list);
+-	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
+-	Input* vx_input=NULL;
+-	Input* vy_input=NULL;
+-	if(domaintype==Domain2DhorizontalEnum){
+-		vx_input=basalelement->GetInput(VxEnum); _assert_(vx_input);
+-		vy_input=basalelement->GetInput(VyEnum); _assert_(vy_input);
+-	}
+-	else{
+-		if(dim==1){
+-			vx_input=basalelement->GetInput(VxEnum); _assert_(vx_input);
+-		}
+-		if(dim==2){
+-			vx_input=basalelement->GetInput(VxAverageEnum); _assert_(vx_input);
+-			vy_input=basalelement->GetInput(VyAverageEnum); _assert_(vy_input);
+-		}
+-	}
+-
+-	Input* lsf_slopex_input  = basalelement->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
+-	Input* lsf_slopey_input  = basalelement->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+-	Input* calvingrate_input  = basalelement->GetInput(MasstransportCalvingrateEnum);     _assert_(calvingrate_input);
+-	
+-	/* Start  looping on the number of gaussian points: */
+-	Gauss* gauss=basalelement->NewGauss(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-		gauss->GaussPoint(ig);
+-
+-		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
+-		D_scalar=gauss->weight*Jdet;
+-
+-		/* Transient */
+-		if(dt!=0.){
+-			basalelement->NodalFunctions(basis,gauss);
+-			TripleMultiply(basis,numnodes,1,0,
+-						&D_scalar,1,1,0,
+-						basis,1,numnodes,0,
+-						&Ke->values[0],1);
+-			D_scalar*=dt;
+-		}
+-
+-		/* Advection */
+-		GetB(B,basalelement,xyz_list,gauss); 
+-		GetBprime(Bprime,basalelement,xyz_list,gauss); 
+-		vx_input->GetInputValue(&v[0],gauss); // in 3D case, add mesh velocity 
+-		vy_input->GetInputValue(&v[1],gauss); 
+-		lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
+-		lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
+-		calvingrate_input->GetInputValue(&calvingrate,gauss);
+-
+-		norm_dlsf=0.;
+-		for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
+-		norm_dlsf=sqrt(norm_dlsf);
+-
+-		if(norm_dlsf>1.e-10)
+-			for(i=0;i<dim;i++) c[i]=calvingrate*dlsf[i]/norm_dlsf;
+-		else
+-			for(i=0;i<dim;i++) c[i]=0.;
+-		
+-		for(i=0;i<dim;i++) w[i]=v[i]-c[i];
+-
+-		for(row=0;row<dim;row++)
+-			for(col=0;col<dim;col++)
+-				if(row==col)
+-					D[row*dim+col]=D_scalar*w[row];
+-				else
+-				   D[row*dim+col]=0.;
+-
+-		TripleMultiply(B,dim,numnodes,1,
+-					D,dim,dim,0,
+-					Bprime,dim,numnodes,0,
+-					&Ke->values[0],1);
+-
+-		/* Stabilization */
+-		int stabilization=2;
+-		vel=0.;
+-		for(i=0;i<dim;i++) vel+=v[i]*v[i];
+-		vel=sqrt(vel)+1.e-14;
+-		switch(stabilization){
+-			case 0:
+-				// no stabilization, do nothing
+-				break;
+-			case 1:
+-				/* Artificial Diffusion */
+-				basalelement->ElementSizes(&hx,&hy,&hz);
+-				h=sqrt( pow(hx*v[0]/vel,2) + pow(hy*v[1]/vel,2) ); 
+-				kappa=h*vel/2.;
+-				for(row=0;row<dim;row++)
+-					for(col=0;col<dim;col++)
+-					if(row==col)
+-						D[row*dim+col]=D_scalar*kappa;
+-					else
+-						D[row*dim+col]=0.;
+-
+-				TripleMultiply(Bprime,dim,numnodes,1,
+-							D,dim,dim,0,
+-							Bprime,dim,numnodes,0,
+-							&Ke->values[0],1);
+-				break;	
+-			case 2:
+-				/* Streamline Upwinding */
+-				basalelement->ElementSizes(&hx,&hy,&hz);
+-				h=sqrt( pow(hx*v[0]/vel,2) + pow(hy*v[1]/vel,2) );
+-				for(row=0;row<dim;row++) 
+-					for(col=0;col<dim;col++) 
+-						D[row*dim+col] = D_scalar*h/(2.*vel)*v[row]*v[col];
+-
+-				TripleMultiply(Bprime,dim,numnodes,1,
+-							D,dim,dim,0,
+-							Bprime,dim,numnodes,0,
+-							&Ke->values[0],1);
+-				break;
+-			default:
+-				_error_("unknown type of stabilization in LevelsetAnalysis.cpp");
+-		}
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(xyz_list);
+-	xDelete<IssmDouble>(basis);
+-	xDelete<IssmDouble>(B);
+-	xDelete<IssmDouble>(D);
+-	xDelete<IssmDouble>(Bprime);
+-	xDelete<IssmDouble>(v);
+-	xDelete<IssmDouble>(w);
+-	xDelete<IssmDouble>(c);
+-	xDelete<IssmDouble>(dlsf);
+-	delete gauss;
+-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+-	return Ke;
+ }/*}}}*/
+ ElementVector* LevelsetAnalysis::CreatePVector(Element* element){/*{{{*/
+ 	
Index: issm/oecreview/Archive/16554-17801/ISSM-DocReview-16554-17801.tex
===================================================================
--- issm/oecreview/Archive/16554-17801/ISSM-DocReview-16554-17801.tex	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/ISSM-DocReview-16554-17801.tex	(revision 17802)
@@ -0,0 +1,67 @@
+\documentclass[]{report}   % list options between brackets
+\usepackage{graphicx}              % list packages between braces
+
+% type user-defined commands here
+
+\begin{document}
+
+\title{JPL EXPORT ADMINISTRATION \\ DOCUMENT REVIEW RECORD}   % type title between braces
+\author{Tom Scavo}         % type author(s) between braces
+\date{October 27, 1995}    % type date between braces
+%\maketitle
+
+
+\begin{center}
+\begin{tabular}{ |c|c| }
+\hline
+JPL EXPORT ADMINISTRATION \\
+\textit{ DOCUMENT REVIEW RECORD} \\
+\hline
+\end{tabular}
+\end{center}
+
+\hfill Log \#: \underline{\input{LogNumber}}
+
+\vspace{1cm}
+\noindent (Note: This form and process do not replace the procedures described in JPL Policy relating to review and approval of proposals and contractual 
+documents. This process is intended to document the review and coordination of requests to ascertain the export control ramifications relating to specific 
+documents. Export Administration signature does not convey authority to export or release the "Exporter of Record" from any export laws or regulations.)\\
+
+\noindent \textbf{Program:} \underline{ISSM: Ice Sheet System Model} \\ \\
+\noindent \textbf{Person Requesting or Initiating Export}: \underline{Dr. Eric Larour}\\ \\
+\noindent \textbf{Date Received}: \underline{\input{Date}}\\ \\
+\noindent \textbf{Document Title/Description}: ISSM changes from revision \input{r1} to revision \input{r2} \\ \\
+\noindent \textbf{Release to:} \underline{http://issm.ess.uci.edu/svn/issm/issm/trunk on ISSM svn repository}\\ \\
+\noindent \textbf{JPL Intranet:} \underline{murdo.jpl.nasa.gov/proj/ice/larour/issm-uci/trunk-jpl}\\ \\
+
+\noindent \textbf{Disposition: 6 } 
+Does not contain export-controlled information. May be released/disclosed as requested subject to 
+Company guidelines on protection of proprietary information (if applicable). \\
+
+\noindent \textbf{Comments:}  see table of changes below. \\ \\
+\noindent \textbf{Reviewed by ISSM Export Transfer Liaison:} Dr. Eric Larour \hfill \textbf{Date:} \input{Date} \\ 
+\includegraphics[scale=1]{signature}
+
+\noindent JPL Export Administration Form TBS – June 29, 2011
+
+\begin{center}
+\line(1,0){250}
+\end{center}
+
+\noindent \textbf{Disposition:} \\
+1:	  Public Domain Information (Ref ITAR Section 120.11) \\
+2:	  Qualifies for ITAR Exemption				 \\
+3:	  Covered by Department of State License/Agreement Number					  \\
+4:	  Covered by Department of Commerce validated license or exception				 \\
+5:	  New License Required \\
+6:	  Does not contain export-controlled information.  May be released/disclosed as requested subject
+   to Company guidelines on protection of proprietary information (if applicable). \\
+7:	 Other (specify)   
+\begin{center}
+\line(1,0){250}
+\end{center}
+
+
+\input{log}
+
+\end{document}
Index: issm/oecreview/Archive/16554-17801/LogNumber.tex
===================================================================
--- issm/oecreview/Archive/16554-17801/LogNumber.tex	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/LogNumber.tex	(revision 17802)
@@ -0,0 +1,1 @@
+16554-17801
Index: issm/oecreview/Archive/16554-17801/Makefile
===================================================================
--- issm/oecreview/Archive/16554-17801/Makefile	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/Makefile	(revision 17802)
@@ -0,0 +1,8 @@
+TARGET=ISSM-DocReview-16554-17801
+
+all: 
+	pdflatex -interaction=errorstopmode -file-line-error -halt-on-error $(TARGET).tex
+	rm -rf *.log *.aux 
+
+clean:
+	rm -rf *.log *.aux
Index: issm/oecreview/Archive/16554-17801/log.tex
===================================================================
--- issm/oecreview/Archive/16554-17801/log.tex	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/log.tex	(revision 17802)
@@ -0,0 +1,8652 @@
+\noindent \textbf{Change \#1} with diff file ISSM-16554-16555.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test120.py M /issm/trunk-jpl/test/NightlyRun/test421.py\\
+Export determination: 6. \\
+Rationale: CHG: tolerances python\\
+\vspace{3em}
+
+\noindent \textbf{Change \#2} with diff file ISSM-16555-16556.diff: \\
+Function name: \\
+M /issm/trunk-jpl M /issm/trunk-jpl/examples/Jakobshavn/Jks.par M /issm/trunk-jpl/examples/Jakobshavn/runme.m M /issm/trunk-jpl/examples/SquareIceShelf/runme.m\\
+Export determination: 6. \\
+Rationale: merged trunk and trunk-jpl\\
+\vspace{3em}
+
+\noindent \textbf{Change \#3} with diff file ISSM-16558-16559.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/IdToName.m A /issm/trunk-jpl/test/NightlyRun/test334.m A /issm/trunk-jpl/test/NightlyRun/test335.m\\
+Export determination: 6. \\
+Rationale: adding extruded test case for the hydrologyDC\\
+\vspace{3em}
+
+\noindent \textbf{Change \#4} with diff file ISSM-16559-16560.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/model.m\\
+Export determination: 6. \\
+Rationale: adding extrusion rules for the hydro solver\\
+\vspace{3em}
+
+\noindent \textbf{Change \#5} with diff file ISSM-16561-16562.diff: \\
+Function name: \\
+M /issm/trunk-jpl M /issm/trunk-jpl/src M /issm/trunk-jpl/test\\
+Export determination: 6. \\
+Rationale: Block revision 16560 from being merged into trunk-jpl\\
+\vspace{3em}
+
+\noindent \textbf{Change \#6} with diff file ISSM-16563-16564.diff: \\
+Function name: \\
+M /issm/trunk-jpl M /issm/trunk-jpl/test\\
+Export determination: 6. \\
+Rationale: merged trunk and trunk-jpl\\
+\vspace{3em}
+
+\noindent \textbf{Change \#7} with diff file ISSM-16565-16566.diff: \\
+Function name: \\
+M /issm/trunk-jpl M /issm/trunk-jpl/src M /issm/trunk-jpl/test\\
+Export determination: 6. \\
+Rationale: Block revision 16564 from being merged into trunk-jpl\\
+\vspace{3em}
+
+\noindent \textbf{Change \#8} with diff file ISSM-16566-16567.diff: \\
+Function name: \\
+A /issm/trunk-jpl/test/Archives/Archive334.nc A /issm/trunk-jpl/test/Archives/Archive335.nc\\
+Export determination: 6. \\
+Rationale: NEW: added archives hydrology 3d\\
+\vspace{3em}
+
+\noindent \textbf{Change \#9} with diff file ISSM-16567-16568.diff: \\
+Function name: \\
+M /issm/trunk/configure.ac M /issm/trunk-jpl/configure.ac\\
+Export determination: 6. \\
+Rationale: CHG: updating issm version\\
+\vspace{3em}
+
+\noindent \textbf{Change \#10} with diff file ISSM-16568-16569.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/wrappers/AverageFilter M /issm/trunk-jpl/src/wrappers/BamgConvertMesh M /issm/trunk-jpl/src/wrappers/BamgMesher M /issm/trunk-jpl/src/wrappers/BamgTriangulate M /issm/trunk-jpl/src/wrappers/Chaco M /issm/trunk-jpl/src/wrappers/ContourToMesh M /issm/trunk-jpl/src/wrappers/ContourToNodes M /issm/trunk-jpl/src/wrappers/EdgeDetection M /issm/trunk-jpl/src/wrappers/ElementConnectivity M /issm/trunk-jpl/src/wrappers/EnumToString M /issm/trunk-jpl/src/wrappers/Exp2Kml M /issm/trunk-jpl/src/wrappers/ExpSimplify M /issm/trunk-jpl/src/wrappers/HoleFiller M /issm/trunk-jpl/src/wrappers/InternalFront M /issm/trunk-jpl/src/wrappers/InterpFromGridToMesh M /issm/trunk-jpl/src/wrappers/InterpFromMesh2d M /issm/trunk-jpl/src/wrappers/InterpFromMeshToGrid M /issm/trunk-jpl/src/wrappers/InterpFromMeshToMesh2d M /issm/trunk-jpl/src/wrappers/InterpFromMeshToMesh3d M /issm/trunk-jpl/src/wrappers/KMLFileRead M /issm/trunk-jpl/src/wrappers/KMLMeshWrite M /issm/trunk-jpl/src/wrappers/KMLOverlay M /issm/trunk-jpl/src/wrappers/Kml2Exp M /issm/trunk-jpl/src/wrappers/Kriging M /issm/trunk-jpl/src/wrappers/Ll2xy M /issm/trunk-jpl/src/wrappers/MeshPartition M /issm/trunk-jpl/src/wrappers/MeshProfileIntersection M /issm/trunk-jpl/src/wrappers/NodeConnectivity M /issm/trunk-jpl/src/wrappers/PointCloudFindNeighbors M /issm/trunk-jpl/src/wrappers/PropagateFlagsFromConnectivity M /issm/trunk-jpl/src/wrappers/Scotch M /issm/trunk-jpl/src/wrappers/Shp2Kml M /issm/trunk-jpl/src/wrappers/StringToEnum M /issm/trunk-jpl/src/wrappers/TriMesh M /issm/trunk-jpl/src/wrappers/TriMeshProcessRifts M /issm/trunk-jpl/src/wrappers/TriaSearch M /issm/trunk-jpl/src/wrappers/Xy2ll M /issm/trunk-jpl/src/wrappers/matlab/io M /issm/trunk-jpl/src/wrappers/python/io\\
+Export determination: 6. \\
+Rationale: CHG: get svn to ignore some files\\
+\vspace{3em}
+
+\noindent \textbf{Change \#11} with diff file ISSM-16569-16570.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/wrappers/ShpRead\\
+Export determination: 6. \\
+Rationale: CHG: get svn to ignore some files\\
+\vspace{3em}
+
+\noindent \textbf{Change \#12} with diff file ISSM-16570-16571.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: Hacking the convergence criterion when the sediment layer is empty\\
+\vspace{3em}
+
+\noindent \textbf{Change \#13} with diff file ISSM-16571-16572.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/contrib/paraview/exportVTK.m\\
+Export determination: 6. \\
+Rationale: Fixing timestep issues for results with differnet number of time step\\
+\vspace{3em}
+
+\noindent \textbf{Change \#14} with diff file ISSM-16572-16573.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/Makefile.am\\
+Export determination: 6. \\
+Rationale: CHG: add issmversion to bin/\\
+\vspace{3em}
+
+\noindent \textbf{Change \#15} with diff file ISSM-16573-16574.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed memory leaks\\
+\vspace{3em}
+
+\noindent \textbf{Change \#16} with diff file ISSM-16574-16575.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed wroing Enum\\
+\vspace{3em}
+
+\noindent \textbf{Change \#17} with diff file ISSM-16575-16576.diff: \\
+Function name: \\
+M /issm/trunk-jpl/m4/issm\_options.m4\\
+Export determination: 6. \\
+Rationale: CHG: minor change in date if not found\\
+\vspace{3em}
+
+\noindent \textbf{Change \#18} with diff file ISSM-16576-16577.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/inversion.m\\
+Export determination: 6. \\
+Rationale: CHG: taoinversion and inversion have now the same cost\_functions\\
+\vspace{3em}
+
+\noindent \textbf{Change \#19} with diff file ISSM-16577-16578.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/model.m M /issm/trunk-jpl/src/m/classes/model.py\\
+Export determination: 6. \\
+Rationale: CHG: extrude thickness\_obs also\\
+\vspace{3em}
+
+\noindent \textbf{Change \#20} with diff file ISSM-16578-16579.diff: \\
+Function name: \\
+M /issm/trunk-jpl/m4/issm\_options.m4\\
+Export determination: 6. \\
+Rationale: CHG: new configuration for pleaides gcc\\
+\vspace{3em}
+
+\noindent \textbf{Change \#21} with diff file ISSM-16579-16580.diff: \\
+Function name: \\
+M /issm/trunk-jpl/configs/config-linux64-pleiades-ampi-gcc.sh\\
+Export determination: 6. \\
+Rationale: NEW: new config for ampi runs on pleaides, using our own mpi.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#22} with diff file ISSM-16580-16581.diff: \\
+Function name: \\
+A /issm/trunk-jpl/externalpackages/adjoinablempi/install-pleaides-gcc.sh\\
+Export determination: 6. \\
+Rationale: CHG: pleaides gcc adjoinable mpi\\
+\vspace{3em}
+
+\noindent \textbf{Change \#23} with diff file ISSM-16581-16582.diff: \\
+Function name: \\
+M /issm/trunk-jpl/etc/environment.csh\\
+Export determination: 6. \\
+Rationale: CHG: fixed environment for mpich\\
+\vspace{3em}
+
+\noindent \textbf{Change \#24} with diff file ISSM-16582-16583.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/mpich/install-2\_1.5-linux64.sh\\
+Export determination: 6. \\
+Rationale: CHG: N/A\\
+\vspace{3em}
+
+\noindent \textbf{Change \#25} with diff file ISSM-16583-16584.diff: \\
+Function name: \\
+A /issm/trunk-jpl/externalpackages/petsc/install-3.4-pleiades-mpich2.sh\\
+Export determination: 6. \\
+Rationale: NEW: config for pleiades.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#26} with diff file ISSM-16584-16585.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/modules/install-macosx64.sh\\
+Export determination: 6. \\
+Rationale: CHG: minor\\
+\vspace{3em}
+
+\noindent \textbf{Change \#27} with diff file ISSM-16585-16586.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/adjoinablempi/install-pleaides-gcc.sh M /issm/trunk-jpl/externalpackages/adolc/install-withampi-pleiades-gcc.sh\\
+Export determination: 6. \\
+Rationale: CHG: adjustments on pleaides using mpich (our own) and gcc 4.7.0\\
+\vspace{3em}
+
+\noindent \textbf{Change \#28} with diff file ISSM-16586-16587.diff: \\
+Function name: \\
+A /issm/trunk-jpl/configs/config-linux64-pleiades-intel2012.0.032-mpt.2.06rp16.sh A /issm/trunk-jpl/externalpackages/petsc/install-3.4-pleiades-intel2012.0.032-mpt.2.06rp16\\
+Export determination: 6. \\
+Rationale: NEW: new configuration files for a pleaides intel compile using a certain set of compilers.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#29} with diff file ISSM-16587-16588.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/clusters/discover.m\\
+Export determination: 6. \\
+Rationale: CHG: update to SLURM script type\\
+\vspace{3em}
+
+\noindent \textbf{Change \#30} with diff file ISSM-16588-16589.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/clusters/discover.m\\
+Export determination: 6. \\
+Rationale: CHG: update to SLURM script type\\
+\vspace{3em}
+
+\noindent \textbf{Change \#31} with diff file ISSM-16589-16590.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h M /issm/trunk-jpl/src/c/classes/FemModel.cpp\\
+Export determination: 6. \\
+Rationale: CHG: make external results active, otherwise we have an issue with MPI type in ADOLC related operations.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#32} with diff file ISSM-16590-16591.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matpar.h M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/classes/matice.m M /issm/trunk-jpl/src/m/classes/matice.py M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/MaterialsTemperateiceconductivityEnum.m M /issm/trunk-jpl/test/Archives/Archive120.nc M /issm/trunk-jpl/test/Archives/Archive121.nc M /issm/trunk-jpl/test/Archives/Archive122.nc M /issm/trunk-jpl/test/Archives/Archive325.nc M /issm/trunk-jpl/test/Archives/Archive326.nc M /issm/trunk-jpl/test/Archives/Archive327.nc M /issm/trunk-jpl/test/Archives/Archive431.nc M /issm/trunk-jpl/test/Archives/Archive432.nc\\
+Export determination: 6. \\
+Rationale: ADD: thermal conductivity of temperate ice "materials.temperateiceconductivity", minor bugs\\
+\vspace{3em}
+
+\noindent \textbf{Change \#33} with diff file ISSM-16591-16592.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/FemModel.cpp M /issm/trunk-jpl/src/c/classes/FemModel.h M /issm/trunk-jpl/src/c/cores/hydrology\_core.cpp M /issm/trunk-jpl/src/c/cores/transient\_core.cpp M /issm/trunk-jpl/src/c/main/issm.cpp M /issm/trunk-jpl/src/c/modules/OutputResultsx/OutputResultsx.cpp M /issm/trunk-jpl/src/c/modules/OutputResultsx/OutputResultsx.h\\
+Export determination: 6. \\
+Rationale: CHG: simplifying prototype for OutputResultsx\\
+\vspace{3em}
+
+\noindent \textbf{Change \#34} with diff file ISSM-16592-16593.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/cores/hydrology\_core.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp M /issm/trunk-jpl/src/m/classes/clusters/greenplanet.m M /issm/trunk-jpl/src/m/contrib/paraview/exportVTK.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/EplHeadSlopeXEnum.m A /issm/trunk-jpl/src/m/enum/EplHeadSlopeYEnum.m M /issm/trunk-jpl/src/m/plot/plot\_contour.m\\
+Export determination: 6. \\
+Rationale: Adding a slope computation for the EPL head\\
+\vspace{3em}
+
+\noindent \textbf{Change \#35} with diff file ISSM-16593-16594.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: CHG:Adapt IceVolume routine to work for 2D Flowline mesh\\
+\vspace{3em}
+
+\noindent \textbf{Change \#36} with diff file ISSM-16594-16595.diff: \\
+Function name: \\
+A /issm/trunk-jpl/scripts/jenkins.sh\\
+Export determination: 6. \\
+Rationale: CHG new nightly system using jenkins, testing\\
+\vspace{3em}
+
+\noindent \textbf{Change \#37} with diff file ISSM-16595-16596.diff: \\
+Function name: \\
+M /issm/trunk-jpl/scripts/jenkins.sh\\
+Export determination: 6. \\
+Rationale: CHG: no nightly locks on this type of checks\\
+\vspace{3em}
+
+\noindent \textbf{Change \#38} with diff file ISSM-16596-16597.diff: \\
+Function name: \\
+M /issm/trunk-jpl/scripts/jenkins.sh\\
+Export determination: 6. \\
+Rationale: CHG: we do not manage svn\\
+\vspace{3em}
+
+\noindent \textbf{Change \#39} with diff file ISSM-16597-16598.diff: \\
+Function name: \\
+M /issm/trunk-jpl/scripts/jenkins.sh\\
+Export determination: 6. \\
+Rationale: CHG: duplicate logs\\
+\vspace{3em}
+
+\noindent \textbf{Change \#40} with diff file ISSM-16598-16599.diff: \\
+Function name: \\
+M /issm/trunk-jpl/scripts/jenkins.sh\\
+Export determination: 6. \\
+Rationale: CHG: forgot to tee the logs\\
+\vspace{3em}
+
+\noindent \textbf{Change \#41} with diff file ISSM-16599-16600.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp\\
+Export determination: 6. \\
+Rationale: CHG: moving analysis specific parameters to their file\\
+\vspace{3em}
+
+\noindent \textbf{Change \#42} with diff file ISSM-16600-16601.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/FemModel.cpp M /issm/trunk-jpl/src/c/classes/FemModel.h M /issm/trunk-jpl/src/c/classes/Loads/Pengrid.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/classes/hydrologydc.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/HydrologydcPenaltyLockEnum.m\\
+Export determination: 6. \\
+Rationale: Adding a ZigZag lock for hydrology and framing the variable thickness of the EPL\\
+\vspace{3em}
+
+\noindent \textbf{Change \#43} with diff file ISSM-16601-16602.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp\\
+Export determination: 6. \\
+Rationale: BUG: reverted some changes for fix NR\\
+\vspace{3em}
+
+\noindent \textbf{Change \#44} with diff file ISSM-16602-16603.diff: \\
+Function name: \\
+A /issm/trunk-jpl/externalpackages/shell2junit A /issm/trunk-jpl/externalpackages/shell2junit/README A /issm/trunk-jpl/externalpackages/shell2junit/install.sh A /issm/trunk-jpl/externalpackages/shell2junit/shell2junit-1.0.0.zip\\
+Export determination: 6. \\
+Rationale: NEW: new shell2junit script for integration within Jenkins\\
+\vspace{3em}
+
+\noindent \textbf{Change \#45} with diff file ISSM-16603-16604.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/shell2junit M /issm/trunk-jpl/externalpackages/shell2junit/install.sh\\
+Export determination: 6. \\
+Rationale: CHG: get svn to ignore some files. Also streamline installation so we don't have the examples installed in the prefix target.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#46} with diff file ISSM-16604-16605.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp\\
+Export determination: 6. \\
+Rationale: CHG: moving Enthalpy parameters to EnthalpyAnalysis\\
+\vspace{3em}
+
+\noindent \textbf{Change \#47} with diff file ISSM-16605-16606.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: missing additional parameter (parameters->AddObject(iomodel->CopyConstantObject(ThermalPenaltyFactorEnum));)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#48} with diff file ISSM-16606-16607.diff: \\
+Function name: \\
+D /issm/trunk-jpl/scripts/jenkins.sh\\
+Export determination: 6. \\
+Rationale: CHG: moved jenkins.sh to issm-jpl\\
+\vspace{3em}
+
+\noindent \textbf{Change \#49} with diff file ISSM-16607-16608.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: spcvz converted twice from m/yr to m/s\\
+\vspace{3em}
+
+\noindent \textbf{Change \#50} with diff file ISSM-16608-16609.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test1106.m M /issm/trunk-jpl/test/NightlyRun/test1108.m M /issm/trunk-jpl/test/NightlyRun/test1110.m M /issm/trunk-jpl/test/NightlyRun/test1208.m M /issm/trunk-jpl/test/NightlyRun/test212.m\\
+Export determination: 6. \\
+Rationale: CHG: updated tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#51} with diff file ISSM-16609-16610.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive1502.nc M /issm/trunk-jpl/test/NightlyRun/test1502.m\\
+Export determination: 6. \\
+Rationale: BUG: fixed NR test1502 with archive\\
+\vspace{3em}
+
+\noindent \textbf{Change \#52} with diff file ISSM-16610-16611.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/mpich/install-3.0-macosx64.sh\\
+Export determination: 6. \\
+Rationale: CHG: no need to use llvm-gcc most of the time\\
+\vspace{3em}
+
+\noindent \textbf{Change \#53} with diff file ISSM-16611-16612.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Seg.cpp\\
+Export determination: 6. \\
+Rationale: BUG: slope was not recopmuted if already in inputs\\
+\vspace{3em}
+
+\noindent \textbf{Change \#54} with diff file ISSM-16612-16613.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/cores/AnalysisConfiguration.cpp M /issm/trunk-jpl/src/c/cores/stressbalance\_core.cpp M /issm/trunk-jpl/src/c/cores/surfaceslope\_core.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py\\
+Export determination: 6. \\
+Rationale: CHG: several changes regarding surface normal velocity computation at free surface for 2D vertical transient run\\
+\vspace{3em}
+
+\noindent \textbf{Change \#55} with diff file ISSM-16613-16614.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: CHG: added note for hack\\
+\vspace{3em}
+
+\noindent \textbf{Change \#56} with diff file ISSM-16614-16615.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matpar.h M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h\\
+Export determination: 6. \\
+Rationale: BUG: ThermalSolution and SteadystateSolution give same results now. ADD: thermal conductivity at CTS is calculated using harmonic mean.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#57} with diff file ISSM-16615-16616.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive120.nc M /issm/trunk-jpl/test/Archives/Archive121.nc M /issm/trunk-jpl/test/Archives/Archive122.nc M /issm/trunk-jpl/test/Archives/Archive325.nc M /issm/trunk-jpl/test/Archives/Archive326.nc M /issm/trunk-jpl/test/Archives/Archive327.nc M /issm/trunk-jpl/test/Archives/Archive431.nc M /issm/trunk-jpl/test/Archives/Archive432.nc\\
+Export determination: 6. \\
+Rationale: CHG: update archives enthalpy\\
+\vspace{3em}
+
+\noindent \textbf{Change \#58} with diff file ISSM-16616-16617.diff: \\
+Function name: \\
+A /issm/trunk-jpl/jenkins A /issm/trunk-jpl/jenkins/imac A /issm/trunk-jpl/jenkins/jenkins.sh A /issm/trunk-jpl/jenkins/linux64\_larsen A /issm/trunk-jpl/jenkins/linux64\_murdo\\
+Export determination: 6. \\
+Rationale: CHG: jenkins configuration needs to be in trunk\\
+\vspace{3em}
+
+\noindent \textbf{Change \#59} with diff file ISSM-16617-16618.diff: \\
+Function name: \\
+A /issm/trunk-jpl/jenkins/execute\_shell\\
+Export determination: 6. \\
+Rationale: CHG: execute shell\\
+\vspace{3em}
+
+\noindent \textbf{Change \#60} with diff file ISSM-16618-16619.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/linux64\_larsen M /issm/trunk-jpl/jenkins/linux64\_murdo\\
+Export determination: 6. \\
+Rationale: CHG: some testing\\
+\vspace{3em}
+
+\noindent \textbf{Change \#61} with diff file ISSM-16619-16620.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/imac\\
+Export determination: 6. \\
+Rationale: CHG: no need to install packages\\
+\vspace{3em}
+
+\noindent \textbf{Change \#62} with diff file ISSM-16620-16621.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/matice.m\\
+Export determination: 6. \\
+Rationale: Correction on matice display\\
+\vspace{3em}
+
+\noindent \textbf{Change \#63} with diff file ISSM-16621-16622.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp M /issm/trunk-jpl/test/Archives/Archive120.nc M /issm/trunk-jpl/test/Archives/Archive121.nc M /issm/trunk-jpl/test/Archives/Archive122.nc M /issm/trunk-jpl/test/Archives/Archive325.nc M /issm/trunk-jpl/test/Archives/Archive326.nc M /issm/trunk-jpl/test/Archives/Archive327.nc M /issm/trunk-jpl/test/Archives/Archive431.nc M /issm/trunk-jpl/test/Archives/Archive432.nc\\
+Export determination: 6. \\
+Rationale: CHG: Added harmonic mean for better convergence of steadystate and transient solver when handling a jump in enthalpy conductivity\\
+\vspace{3em}
+
+\noindent \textbf{Change \#64} with diff file ISSM-16622-16623.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/execute\_shell\\
+Export determination: 6. \\
+Rationale: CHG: changed name\\
+\vspace{3em}
+
+\noindent \textbf{Change \#65} with diff file ISSM-16623-16624.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/runme.m\\
+Export determination: 6. \\
+Rationale: CHG: verbose runme more so jenkins can pick up the logs\\
+\vspace{3em}
+
+\noindent \textbf{Change \#66} with diff file ISSM-16624-16625.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/runme.m\\
+Export determination: 6. \\
+Rationale: CHG: further changes to the runme to verbose for jenkins.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#67} with diff file ISSM-16625-16626.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/runme.m\\
+Export determination: 6. \\
+Rationale: CHG: corrected printing bug.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#68} with diff file ISSM-16626-16627.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/jenkins.sh\\
+Export determination: 6. \\
+Rationale: CHG: better handling of test results.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#69} with diff file ISSM-16627-16628.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/linux64\_murdo\\
+Export determination: 6. \\
+Rationale: CHG: added dakota build\\
+\vspace{3em}
+
+\noindent \textbf{Change \#70} with diff file ISSM-16628-16629.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/jenkins.sh M /issm/trunk-jpl/jenkins/linux64\_murdo\\
+Export determination: 6. \\
+Rationale: CHG: better name convention for juLogging\\
+\vspace{3em}
+
+\noindent \textbf{Change \#71} with diff file ISSM-16629-16630.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/shell2junit/install.sh A /issm/trunk-jpl/externalpackages/shell2junit/install.sh.old A /issm/trunk-jpl/externalpackages/shell2junit/patch A /issm/trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh\\
+Export determination: 6. \\
+Rationale: CHG: starting patches\\
+\vspace{3em}
+
+\noindent \textbf{Change \#72} with diff file ISSM-16630-16631.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/linux64\_murdo\\
+Export determination: 6. \\
+Rationale: CHG: testing new julog script\\
+\vspace{3em}
+
+\noindent \textbf{Change \#73} with diff file ISSM-16631-16632.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/jenkins.sh\\
+Export determination: 6. \\
+Rationale: CHG: missing argument for juLog argument test\\
+\vspace{3em}
+
+\noindent \textbf{Change \#74} with diff file ISSM-16632-16633.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/jenkins.sh\\
+Export determination: 6. \\
+Rationale: CHG: get the right pwd for juLog processing\\
+\vspace{3em}
+
+\noindent \textbf{Change \#75} with diff file ISSM-16633-16634.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh\\
+Export determination: 6. \\
+Rationale: CHG: better naming conventions for sh2ju.sh\\
+\vspace{3em}
+
+\noindent \textbf{Change \#76} with diff file ISSM-16634-16635.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh\\
+Export determination: 6. \\
+Rationale: CHG: better name for the tests\\
+\vspace{3em}
+
+\noindent \textbf{Change \#77} with diff file ISSM-16635-16636.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh\\
+Export determination: 6. \\
+Rationale: CHG: better name for the tests\\
+\vspace{3em}
+
+\noindent \textbf{Change \#78} with diff file ISSM-16636-16637.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp\\
+Export determination: 6. \\
+Rationale: BUG: use EnthalpyPicard for Enthalpy non linear iterations\\
+\vspace{3em}
+
+\noindent \textbf{Change \#79} with diff file ISSM-16637-16638.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateSingleNodeToElementConnectivity.cpp\\
+Export determination: 6. \\
+Rationale: BUG: elementwidth not supported for 2dvertical\\
+\vspace{3em}
+
+\noindent \textbf{Change \#80} with diff file ISSM-16638-16639.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Materials/Material.h M /issm/trunk-jpl/src/c/classes/Materials/Matice.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matice.h M /issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matpar.h M /issm/trunk-jpl/src/c/cores/hydrology\_core.cpp M /issm/trunk-jpl/src/c/modules/InputDuplicatex/InputDuplicatex.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp M /issm/trunk-jpl/src/m/classes/hydrologydc.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/HydrologydcEplConductivityEnum.m A /issm/trunk-jpl/src/m/enum/HydrologydcEplThicknessOldEnum.m\\
+Export determination: 6. \\
+Rationale: modifying the hydro solver to take into account a variable EPL thickness\\
+\vspace{3em}
+
+\noindent \textbf{Change \#81} with diff file ISSM-16639-16640.diff: \\
+Function name: \\
+D /issm/trunk-jpl/src/m/enum/HydrologydcEplTransmitivityEnum.m\\
+Export determination: 6. \\
+Rationale: removing unused Enum\\
+\vspace{3em}
+
+\noindent \textbf{Change \#82} with diff file ISSM-16640-16641.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: fixing typo\\
+\vspace{3em}
+
+\noindent \textbf{Change \#83} with diff file ISSM-16641-16642.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/IoModel.cpp\\
+Export determination: 6. \\
+Rationale: CHG: updated statement\\
+\vspace{3em}
+
+\noindent \textbf{Change \#84} with diff file ISSM-16642-16643.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh\\
+Export determination: 6. \\
+Rationale: CHG: testing various echos on sh2ju.sh\\
+\vspace{3em}
+
+\noindent \textbf{Change \#85} with diff file ISSM-16643-16644.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/linux64\_murdo\\
+Export determination: 6. \\
+Rationale: CHG: more jenkins testing\\
+\vspace{3em}
+
+\noindent \textbf{Change \#86} with diff file ISSM-16644-16645.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh\\
+Export determination: 6. \\
+Rationale: CHG: testing various echos on sh2ju.sh\\
+\vspace{3em}
+
+\noindent \textbf{Change \#87} with diff file ISSM-16645-16646.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/shell2junit/patch/sh2ju.sh\\
+Export determination: 6. \\
+Rationale: CHG: testing various echos on sh2ju.sh\\
+\vspace{3em}
+
+\noindent \textbf{Change \#88} with diff file ISSM-16646-16647.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/linux64\_murdo\\
+Export determination: 6. \\
+Rationale: CHG: exploring new configurations for jenkins\\
+\vspace{3em}
+
+\noindent \textbf{Change \#89} with diff file ISSM-16647-16648.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: BUG: forgot to condense matrix\\
+\vspace{3em}
+
+\noindent \textbf{Change \#90} with diff file ISSM-16648-16649.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: CHG: do not forget to collapse p if MINI condensed\\
+\vspace{3em}
+
+\noindent \textbf{Change \#91} with diff file ISSM-16649-16650.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test333.m M /issm/trunk-jpl/test/NightlyRun/test335.m\\
+Export determination: 6. \\
+Rationale: updating hydrological tests\\
+\vspace{3em}
+
+\noindent \textbf{Change \#92} with diff file ISSM-16650-16651.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive333.nc M /issm/trunk-jpl/test/Archives/Archive335.nc\\
+Export determination: 6. \\
+Rationale: CHG: updated tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#93} with diff file ISSM-16651-16652.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/jenkins.sh\\
+Export determination: 6. \\
+Rationale: CHG: better formatting of jenkins test results\\
+\vspace{3em}
+
+\noindent \textbf{Change \#94} with diff file ISSM-16652-16653.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/imac M /issm/trunk-jpl/jenkins/linux64\_larsen M /issm/trunk-jpl/jenkins/linux64\_murdo\\
+Export determination: 6. \\
+Rationale: CHG: configuration changes\\
+\vspace{3em}
+
+\noindent \textbf{Change \#95} with diff file ISSM-16653-16654.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Inputs/BoolInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/IntInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/SegInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp M /issm/trunk-jpl/src/c/classes/Params/BoolParam.cpp M /issm/trunk-jpl/src/c/classes/Params/DoubleParam.cpp M /issm/trunk-jpl/src/c/classes/Params/FileParam.cpp M /issm/trunk-jpl/src/c/classes/Params/IntParam.cpp M /issm/trunk-jpl/src/c/classes/Params/StringParam.cpp\\
+Export determination: 6. \\
+Rationale: CHG: better Echo formatting\\
+\vspace{3em}
+
+\noindent \textbf{Change \#96} with diff file ISSM-16654-16655.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive120.nc M /issm/trunk-jpl/test/Archives/Archive122.nc M /issm/trunk-jpl/test/Archives/Archive325.nc M /issm/trunk-jpl/test/Archives/Archive431.nc M /issm/trunk-jpl/test/Archives/Archive432.nc\\
+Export determination: 6. \\
+Rationale: CHG: updated archives enthalpy\\
+\vspace{3em}
+
+\noindent \textbf{Change \#97} with diff file ISSM-16655-16656.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Params/BoolParam.cpp M /issm/trunk-jpl/src/c/classes/Params/DataSetParam.cpp M /issm/trunk-jpl/src/c/classes/Params/DoubleParam.cpp M /issm/trunk-jpl/src/c/classes/Params/DoubleVecParam.cpp M /issm/trunk-jpl/src/c/classes/Params/FileParam.cpp M /issm/trunk-jpl/src/c/classes/Params/IntParam.cpp M /issm/trunk-jpl/src/c/classes/Params/StringArrayParam.cpp M /issm/trunk-jpl/src/c/classes/Params/StringParam.cpp\\
+Export determination: 6. \\
+Rationale: CHG: even better formatting\\
+\vspace{3em}
+
+\noindent \textbf{Change \#98} with diff file ISSM-16656-16657.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Inputs/BoolInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/IntInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/SegInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp\\
+Export determination: 6. \\
+Rationale: CHG: Echo better formatting\\
+\vspace{3em}
+
+\noindent \textbf{Change \#99} with diff file ISSM-16657-16658.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/matrix/ElementMatrix.cpp\\
+Export determination: 6. \\
+Rationale: BUG: constraints need to be applied even if node is clone\\
+\vspace{3em}
+
+\noindent \textbf{Change \#100} with diff file ISSM-16658-16659.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/matrix/ElementMatrix.cpp\\
+Export determination: 6. \\
+Rationale: CHG: reverting back\\
+\vspace{3em}
+
+\noindent \textbf{Change \#101} with diff file ISSM-16659-16660.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp\\
+Export determination: 6. \\
+Rationale: adding an Enum for slope computation in EPL\\
+\vspace{3em}
+
+\noindent \textbf{Change \#102} with diff file ISSM-16660-16661.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/L2ProjectionEPLAnalysisEnum.m\\
+Export determination: 6. \\
+Rationale: adding an Enum for slope computation in EPL\\
+\vspace{3em}
+
+\noindent \textbf{Change \#103} with diff file ISSM-16661-16662.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/jenkins.sh\\
+Export determination: 6. \\
+Rationale: CHG: adding a new capability to skip externalpackage install if nothing was modified\\
+\vspace{3em}
+
+\noindent \textbf{Change \#104} with diff file ISSM-16662-16663.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/jenkins.sh\\
+Export determination: 6. \\
+Rationale: CHG: more involved checks on external packages install\\
+\vspace{3em}
+
+\noindent \textbf{Change \#105} with diff file ISSM-16663-16664.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/jenkins.sh\\
+Export determination: 6. \\
+Rationale: CHG: took out some debug statements\\
+\vspace{3em}
+
+\noindent \textbf{Change \#106} with diff file ISSM-16664-16665.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/jenkins.sh\\
+Export determination: 6. \\
+Rationale: CHG: better use of svnversion script\\
+\vspace{3em}
+
+\noindent \textbf{Change \#107} with diff file ISSM-16665-16666.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/jenkins.sh\\
+Export determination: 6. \\
+Rationale: CHG: refining jenkins way of checking externalpackages installs.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#108} with diff file ISSM-16666-16667.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/jenkins.sh\\
+Export determination: 6. \\
+Rationale: CHG: missing sourcing of environment\\
+\vspace{3em}
+
+\noindent \textbf{Change \#109} with diff file ISSM-16667-16668.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/jenkins.sh\\
+Export determination: 6. \\
+Rationale: CHG: failsafe for failed externalpackages installs\\
+\vspace{3em}
+
+\noindent \textbf{Change \#110} with diff file ISSM-16668-16669.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/enum/SurfaceNormalVelocityEnum.m\\
+Export determination: 6. \\
+Rationale: CHG: add SurfaceNormalVelocityEnum.m\\
+\vspace{3em}
+
+\noindent \textbf{Change \#111} with diff file ISSM-16669-16670.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp\\
+Export determination: 6. \\
+Rationale: changinig enum order\\
+\vspace{3em}
+
+\noindent \textbf{Change \#112} with diff file ISSM-16670-16671.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py\\
+Export determination: 6. \\
+Rationale: changinig enum order\\
+\vspace{3em}
+
+\noindent \textbf{Change \#113} with diff file ISSM-16671-16672.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/linux64\_larsen M /issm/trunk-jpl/jenkins/linux64\_murdo\\
+Export determination: 6. \\
+Rationale: CHG: boost dir missing\\
+\vspace{3em}
+
+\noindent \textbf{Change \#114} with diff file ISSM-16672-16673.diff: \\
+Function name: \\
+D /issm/trunk-jpl/jenkins/imac A /issm/trunk-jpl/jenkins/imac-012301-gil (from /issm/trunk-jpl/jenkins/imac:16671)\\
+Export determination: 6. \\
+Rationale: CHG: new configuration name for imac machine\\
+\vspace{3em}
+
+\noindent \textbf{Change \#115} with diff file ISSM-16673-16674.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/execute\_shell\\
+Export determination: 6. \\
+Rationale: CHG: new name of configuration\\
+\vspace{3em}
+
+\noindent \textbf{Change \#116} with diff file ISSM-16674-16675.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/execute\_shell\\
+Export determination: 6. \\
+Rationale: CHG: introducing ad runs\\
+\vspace{3em}
+
+\noindent \textbf{Change \#117} with diff file ISSM-16675-16676.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/Makefile.am M /issm/trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h M /issm/trunk-jpl/src/c/analyses/Analysis.h M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h M /issm/trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h M /issm/trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.h M /issm/trunk-jpl/src/c/analyses/EnumToAnalysis.h M /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h M /issm/trunk-jpl/src/c/analyses/GiaAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/GiaAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.h M /issm/trunk-jpl/src/c/analyses/MeltingAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MeltingAnalysis.h M /issm/trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.cpp M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/Inputs/BoolInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/BoolInput.h M /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.h M /issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.h M /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.h M /issm/trunk-jpl/src/c/classes/Inputs/Input.h M /issm/trunk-jpl/src/c/classes/Inputs/IntInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/IntInput.h M /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.h M /issm/trunk-jpl/src/c/classes/Inputs/SegInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/SegInput.h M /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.h M /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.h A /issm/trunk-jpl/src/c/classes/gauss/Gauss.h M /issm/trunk-jpl/src/c/classes/gauss/GaussPenta.cpp M /issm/trunk-jpl/src/c/classes/gauss/GaussPenta.h M /issm/trunk-jpl/src/c/classes/gauss/GaussSeg.cpp M /issm/trunk-jpl/src/c/classes/gauss/GaussSeg.h M /issm/trunk-jpl/src/c/classes/gauss/GaussTria.cpp M /issm/trunk-jpl/src/c/classes/gauss/GaussTria.h M /issm/trunk-jpl/src/c/classes/gauss/gaussobjects.h M /issm/trunk-jpl/src/c/modules/GetSolutionFromInputsx/GetSolutionFromInputsx.cpp M /issm/trunk-jpl/src/c/modules/GetSolutionFromInputsx/GetSolutionFromInputsx.h M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/c/toolkits/objects/Matrix.h M /issm/trunk-jpl/src/c/toolkits/objects/Solver.h M /issm/trunk-jpl/src/c/toolkits/objects/Vector.h\\
+Export determination: 6. \\
+Rationale: NEW: moved GetSolutionFromInputs from Element to analysis\\
+\vspace{3em}
+
+\noindent \textbf{Change \#118} with diff file ISSM-16676-16677.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: forgot brackets arround vz\_input\\
+\vspace{3em}
+
+\noindent \textbf{Change \#119} with diff file ISSM-16677-16678.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed failures in NR\\
+\vspace{3em}
+
+\noindent \textbf{Change \#120} with diff file ISSM-16678-16679.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: fixed errors in UpdateSOlutionFromInput for L1L2\\
+\vspace{3em}
+
+\noindent \textbf{Change \#121} with diff file ISSM-16679-16680.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/GaussPentaEnum.m A /issm/trunk-jpl/src/m/enum/GaussSegEnum.m A /issm/trunk-jpl/src/m/enum/GaussTriaEnum.m\\
+Export determination: 6. \\
+Rationale: Sync'ed Enum\\
+\vspace{3em}
+
+\noindent \textbf{Change \#122} with diff file ISSM-16680-16681.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed solution from inputs for tiling\\
+\vspace{3em}
+
+\noindent \textbf{Change \#123} with diff file ISSM-16681-16682.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: DEL: removed GetSolutionFromInputs from element\\
+\vspace{3em}
+
+\noindent \textbf{Change \#124} with diff file ISSM-16682-16683.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: L1L2 solution from input was not using inputs\\
+\vspace{3em}
+
+\noindent \textbf{Change \#125} with diff file ISSM-16683-16684.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive434.nc\\
+Export determination: 6. \\
+Rationale: CHG: updated l1l2 tolerance for improved solution from input\\
+\vspace{3em}
+
+\noindent \textbf{Change \#126} with diff file ISSM-16684-16685.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h M /issm/trunk-jpl/src/c/analyses/Analysis.h M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h M /issm/trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h M /issm/trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.h M /issm/trunk-jpl/src/c/analyses/EnumToAnalysis.h M /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h M /issm/trunk-jpl/src/c/analyses/GiaAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/GiaAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.h M /issm/trunk-jpl/src/c/analyses/MeltingAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MeltingAnalysis.h M /issm/trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.h\\
+Export determination: 6. \\
+Rationale: NEW: moving InputUpdateFromSolution from element to analysis\\
+\vspace{3em}
+
+\noindent \textbf{Change \#127} with diff file ISSM-16685-16686.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/Makefile.am M /issm/trunk-jpl/src/c/analyses/EnumToAnalysis.cpp A /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp A /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h M /issm/trunk-jpl/src/c/analyses/analyses.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/FemModel.cpp M /issm/trunk-jpl/src/c/classes/FemModel.h M /issm/trunk-jpl/src/c/cores/AnalysisConfiguration.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: Adding stuff to compute Epl slopes only on active EPL\\
+\vspace{3em}
+
+\noindent \textbf{Change \#128} with diff file ISSM-16686-16687.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h\\
+Export determination: 6. \\
+Rationale: Bug: Adding new function in L2ProjectionEPLAnalysis\\
+\vspace{3em}
+
+\noindent \textbf{Change \#129} with diff file ISSM-16687-16688.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/execute\_shell A /issm/trunk-jpl/jenkins/execute\_shell\_ad\\
+Export determination: 6. \\
+Rationale: CHG: new configuration for ad runs on murdo\\
+\vspace{3em}
+
+\noindent \textbf{Change \#130} with diff file ISSM-16688-16689.diff: \\
+Function name: \\
+A /issm/trunk-jpl/jenkins/linux64\_murdo\_ad A /issm/trunk-jpl/jenkins/linux64\_murdo\_ampi\\
+Export determination: 6. \\
+Rationale: CHG: configuration files for linux murdo automatic differentiation runs\\
+\vspace{3em}
+
+\noindent \textbf{Change \#131} with diff file ISSM-16689-16690.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/execute\_shell\_ad\\
+Export determination: 6. \\
+Rationale: CHG: slight mode in vairable name\\
+\vspace{3em}
+
+\noindent \textbf{Change \#132} with diff file ISSM-16690-16691.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp\\
+Export determination: 6. \\
+Rationale: BUG: adding isefficient test in L2ProjectionEPLAnalysis\\
+\vspace{3em}
+
+\noindent \textbf{Change \#133} with diff file ISSM-16691-16692.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: BUG Removing debug printf\\
+\vspace{3em}
+
+\noindent \textbf{Change \#134} with diff file ISSM-16692-16693.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/linux64\_murdo\_ad M /issm/trunk-jpl/jenkins/linux64\_murdo\_ampi\\
+Export determination: 6. \\
+Rationale: CHG: commi missing shell2junit package\\
+\vspace{3em}
+
+\noindent \textbf{Change \#135} with diff file ISSM-16693-16694.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: NEW: working on InputUpdateFromSolutionHoriz\\
+\vspace{3em}
+
+\noindent \textbf{Change \#136} with diff file ISSM-16694-16695.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixinf enum order\\
+\vspace{3em}
+
+\noindent \textbf{Change \#137} with diff file ISSM-16695-16696.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.h\\
+Export determination: 6. \\
+Rationale: CHG: added header file Analysis.h\\
+\vspace{3em}
+
+\noindent \textbf{Change \#138} with diff file ISSM-16696-16697.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp\\
+Export determination: 6. \\
+Rationale: CHG: preparing analysis orientation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#139} with diff file ISSM-16697-16698.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.cpp M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matpar.h\\
+Export determination: 6. \\
+Rationale: CHG: do not get Matpar pointer, use GetMaterialParameter instead\\
+\vspace{3em}
+
+\noindent \textbf{Change \#140} with diff file ISSM-16698-16699.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.cpp M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: CHG: working on UpdateInputFromSolution\\
+\vspace{3em}
+
+\noindent \textbf{Change \#141} with diff file ISSM-16699-16700.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: NEW: added case in thermalanalysis\\
+\vspace{3em}
+
+\noindent \textbf{Change \#142} with diff file ISSM-16700-16701.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: NEW: added vertical solution for stressbalance analysis\\
+\vspace{3em}
+
+\noindent \textbf{Change \#143} with diff file ISSM-16701-16702.diff: \\
+Function name: \\
+A /issm/trunk-jpl/jenkins/parsing\_rules\\
+Export determination: 6. \\
+Rationale: NEW: parsing rules for jenkins\\
+\vspace{3em}
+
+\noindent \textbf{Change \#144} with diff file ISSM-16702-16703.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: CHG: fixed casting issue that was incompatible with AD compilation.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#145} with diff file ISSM-16703-16704.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/linux64\_murdo\_ampi\\
+Export determination: 6. \\
+Rationale: CHG: fixed issue with prefix directory ill-specified\\
+\vspace{3em}
+
+\noindent \textbf{Change \#146} with diff file ISSM-16704-16705.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive3108.nc\\
+Export determination: 6. \\
+Rationale: CHG: changed tolerance for temperature runs in AD mode.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#147} with diff file ISSM-16705-16706.diff: \\
+Function name: \\
+A /issm/trunk-jpl/jenkins/linux64\_murdo\_pythonandmatlab\\
+Export determination: 6. \\
+Rationale: CHG: trying matlab and python\\
+\vspace{3em}
+
+\noindent \textbf{Change \#148} with diff file ISSM-16706-16707.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/jenkins.sh\\
+Export determination: 6. \\
+Rationale: CHG: process python logs\\
+\vspace{3em}
+
+\noindent \textbf{Change \#149} with diff file ISSM-16707-16708.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/nose/install-linux64-python2.sh M /issm/trunk-jpl/externalpackages/nose/install-linux64-python3.sh M /issm/trunk-jpl/externalpackages/nose/install-macosx64-python2.sh M /issm/trunk-jpl/externalpackages/nose/install-macosx64-python3.sh\\
+Export determination: 6. \\
+Rationale: CHG: create empty install directory, so that jenkins can flag the install automatically\\
+\vspace{3em}
+
+\noindent \textbf{Change \#150} with diff file ISSM-16708-16709.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/nose/install-linux64-python3.sh M /issm/trunk-jpl/externalpackages/nose/install-macosx64-python2.sh M /issm/trunk-jpl/externalpackages/nose/install-macosx64-python3.sh M /issm/trunk-jpl/externalpackages/numpy/install-linux64.sh M /issm/trunk-jpl/externalpackages/numpy/install-macosx-lion.sh M /issm/trunk-jpl/externalpackages/numpy/install-macosx-mlion.sh M /issm/trunk-jpl/externalpackages/numpy/install-macosx-snowleopard.sh\\
+Export determination: 6. \\
+Rationale: CHG: create fake install directory for jenkins to pick up on.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#151} with diff file ISSM-16709-16710.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/jenkins.sh M /issm/trunk-jpl/test/NightlyRun/runme.py\\
+Export determination: 6. \\
+Rationale: CHG: get jenkins to do the logs nicely for python. Modify runme.py to display markers for each test.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#152} with diff file ISSM-16710-16711.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/runme.py\\
+Export determination: 6. \\
+Rationale: CHG: formatting error with print statement\\
+\vspace{3em}
+
+\noindent \textbf{Change \#153} with diff file ISSM-16711-16712.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/linux64\_murdo D /issm/trunk-jpl/jenkins/linux64\_murdo\_pythonandmatlab\\
+Export determination: 6. \\
+Rationale: CHG: finished testing addition of python in tests\\
+\vspace{3em}
+
+\noindent \textbf{Change \#154} with diff file ISSM-16712-16713.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive333.nc M /issm/trunk-jpl/test/Archives/Archive335.nc\\
+Export determination: 6. \\
+Rationale: CHG: updating archives for new hydrology solution\\
+\vspace{3em}
+
+\noindent \textbf{Change \#155} with diff file ISSM-16713-16714.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/jenkins.sh\\
+Export determination: 6. \\
+Rationale: CHG: avoid python log processing if running exclusively in matlab\\
+\vspace{3em}
+
+\noindent \textbf{Change \#156} with diff file ISSM-16714-16715.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/clusters/greenplanet.m\\
+Export determination: 6. \\
+Rationale: BUG: uncomenting launchcommand\\
+\vspace{3em}
+
+\noindent \textbf{Change \#157} with diff file ISSM-16715-16716.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: NEW: moved InputUpdateFromSolution in analyses for Stokes\\
+\vspace{3em}
+
+\noindent \textbf{Change \#158} with diff file ISSM-16716-16717.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_linear.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing bug in EPLDomain for L2 computation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#159} with diff file ISSM-16717-16718.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h\\
+Export determination: 6. \\
+Rationale: NEW: moved SIA update from solution in analyses\\
+\vspace{3em}
+
+\noindent \textbf{Change \#160} with diff file ISSM-16718-16719.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/shp/shpwrite.m\\
+Export determination: 6. \\
+Rationale: CHG: more involved shp write shapes, polygon, line, etc ...\\
+\vspace{3em}
+
+\noindent \textbf{Change \#161} with diff file ISSM-16719-16720.diff: \\
+Function name: \\
+M /issm/trunk-jpl/etc/environment.csh M /issm/trunk-jpl/etc/environment.sh\\
+Export determination: 6. \\
+Rationale: CHG: added shell2junit environment variable\\
+\vspace{3em}
+
+\noindent \textbf{Change \#162} with diff file ISSM-16720-16721.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: NEW: adding mass transport in analyses\\
+\vspace{3em}
+
+\noindent \textbf{Change \#163} with diff file ISSM-16721-16722.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: NEW: working on mass transport analyses for extrusion of solution\\
+\vspace{3em}
+
+\noindent \textbf{Change \#164} with diff file ISSM-16722-16723.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/dev/devpath.py\\
+Export determination: 6. \\
+Rationale: CHG: add .libs path\\
+\vspace{3em}
+
+\noindent \textbf{Change \#165} with diff file ISSM-16723-16724.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp\\
+Export determination: 6. \\
+Rationale: NEW: Adding an enum to deal with initial thickness of the EPL\\
+\vspace{3em}
+
+\noindent \textbf{Change \#166} with diff file ISSM-16724-16725.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/HydrologydcEplInitialThicknessEnum.m\\
+Export determination: 6. \\
+Rationale: NEW: Adding an enum to deal with initial thickness of the EPL\\
+\vspace{3em}
+
+\noindent \textbf{Change \#167} with diff file ISSM-16725-16726.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matpar.h M /issm/trunk-jpl/src/c/cores/hydrology\_core.cpp\\
+Export determination: 6. \\
+Rationale: NEW: There is now an initial thickness for the EPL\\
+\vspace{3em}
+
+\noindent \textbf{Change \#168} with diff file ISSM-16726-16727.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/hydrologydc.m\\
+Export determination: 6. \\
+Rationale: NEW: There is now an initial thickness for the EPL\\
+\vspace{3em}
+
+\noindent \textbf{Change \#169} with diff file ISSM-16727-16728.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: BUG: fixed SSA InputUpdateFromSolution\\
+\vspace{3em}
+
+\noindent \textbf{Change \#170} with diff file ISSM-16728-16729.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: balance thickness input from solution\\
+\vspace{3em}
+
+\noindent \textbf{Change \#171} with diff file ISSM-16729-16730.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/MeltingAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/TriaRef.cpp\\
+Export determination: 6. \\
+Rationale: NEW: extended new InputUpdateFromSolution to Thermal\\
+\vspace{3em}
+
+\noindent \textbf{Change \#172} with diff file ISSM-16730-16731.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test333.m M /issm/trunk-jpl/test/NightlyRun/test335.m\\
+Export determination: 6. \\
+Rationale: BUG: Changing epl thickness name\\
+\vspace{3em}
+
+\noindent \textbf{Change \#173} with diff file ISSM-16731-16732.diff: \\
+Function name: \\
+A /issm/trunk-jpl/externalpackages/petsc/install-3.4-acenet.sh\\
+Export determination: 6. \\
+Rationale: NEW: added install-3.4-acenet.sh\\
+\vspace{3em}
+
+\noindent \textbf{Change \#174} with diff file ISSM-16732-16733.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/petsc/install-3.4-acenet.sh\\
+Export determination: 6. \\
+Rationale: CHG: added blas lapack to acenet\\
+\vspace{3em}
+
+\noindent \textbf{Change \#175} with diff file ISSM-16733-16734.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plot\_section.m\\
+Export determination: 6. \\
+Rationale: added an option to print the mean value of data along a section in sectionvalue plot\\
+\vspace{3em}
+
+\noindent \textbf{Change \#176} with diff file ISSM-16734-16735.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: CHG: adding Enthalpy GetInputFromSolution\\
+\vspace{3em}
+
+\noindent \textbf{Change \#177} with diff file ISSM-16735-16736.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: meshtype not recovered\\
+\vspace{3em}
+
+\noindent \textbf{Change \#178} with diff file ISSM-16736-16737.diff: \\
+Function name: \\
+A /issm/trunk-jpl/configs/config-linux64-acenet.sh\\
+Export determination: 6. \\
+Rationale: config file for acenet\\
+\vspace{3em}
+
+\noindent \textbf{Change \#179} with diff file ISSM-16737-16738.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/clusters/acenet.m\\
+Export determination: 6. \\
+Rationale: BUG: need to source environment.sh otherwise issm.exe does not know where to find libpetsc.so\\
+\vspace{3em}
+
+\noindent \textbf{Change \#180} with diff file ISSM-16738-16739.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive333.nc M /issm/trunk-jpl/test/Archives/Archive335.nc\\
+Export determination: 6. \\
+Rationale: CHG: new archives saved on larsen\\
+\vspace{3em}
+
+\noindent \textbf{Change \#181} with diff file ISSM-16739-16740.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.cpp\\
+Export determination: 6. \\
+Rationale: CHG: changes input update of thermal\\
+\vspace{3em}
+
+\noindent \textbf{Change \#182} with diff file ISSM-16740-16741.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.h\\
+Export determination: 6. \\
+Rationale: NEW: trying to make TransientInput creation faster\\
+\vspace{3em}
+
+\noindent \textbf{Change \#183} with diff file ISSM-16741-16742.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive333.nc M /issm/trunk-jpl/test/Archives/Archive335.nc\\
+Export determination: 6. \\
+Rationale: CHG: reverting back, per Basile's request\\
+\vspace{3em}
+
+\noindent \textbf{Change \#184} with diff file ISSM-16742-16743.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/cores/masstransport\_core.cpp M /issm/trunk-jpl/src/c/cores/steadystate\_core.cpp M /issm/trunk-jpl/src/c/cores/stressbalance\_core.cpp M /issm/trunk-jpl/src/c/cores/thermal\_core.cpp M /issm/trunk-jpl/src/c/cores/transient\_core.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing memory leaks (requested\_output needs to be freed)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#185} with diff file ISSM-16743-16744.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp\\
+Export determination: 6. \\
+Rationale: CHG: better B in enthalpy solution\\
+\vspace{3em}
+
+\noindent \textbf{Change \#186} with diff file ISSM-16744-16745.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing memory leaks (input needs to be freed)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#187} with diff file ISSM-16745-16746.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp\\
+Export determination: 6. \\
+Rationale: CHG: working on Thermal and Enthalpy input update from solution\\
+\vspace{3em}
+
+\noindent \textbf{Change \#188} with diff file ISSM-16746-16747.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp\\
+Export determination: 6. \\
+Rationale: CHG: fixing thermal and enthalpy\\
+\vspace{3em}
+
+\noindent \textbf{Change \#189} with diff file ISSM-16747-16748.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive111.nc M /issm/trunk-jpl/test/Archives/Archive121.nc M /issm/trunk-jpl/test/Archives/Archive122.nc M /issm/trunk-jpl/test/Archives/Archive207.nc M /issm/trunk-jpl/test/Archives/Archive209.nc M /issm/trunk-jpl/test/Archives/Archive210.nc M /issm/trunk-jpl/test/Archives/Archive211.nc M /issm/trunk-jpl/test/Archives/Archive224.nc M /issm/trunk-jpl/test/Archives/Archive225.nc M /issm/trunk-jpl/test/Archives/Archive227.nc M /issm/trunk-jpl/test/Archives/Archive232.nc M /issm/trunk-jpl/test/Archives/Archive233.nc M /issm/trunk-jpl/test/Archives/Archive237.nc M /issm/trunk-jpl/test/Archives/Archive315.nc M /issm/trunk-jpl/test/Archives/Archive317.nc M /issm/trunk-jpl/test/Archives/Archive318.nc M /issm/trunk-jpl/test/Archives/Archive324.nc M /issm/trunk-jpl/test/Archives/Archive326.nc M /issm/trunk-jpl/test/Archives/Archive327.nc M /issm/trunk-jpl/test/Archives/Archive329.nc M /issm/trunk-jpl/test/Archives/Archive409.nc M /issm/trunk-jpl/test/Archives/Archive410.nc M /issm/trunk-jpl/test/Archives/Archive411.nc M /issm/trunk-jpl/test/Archives/Archive415.nc M /issm/trunk-jpl/test/Archives/Archive416.nc M /issm/trunk-jpl/test/Archives/Archive431.nc M /issm/trunk-jpl/test/Archives/Archive432.nc M /issm/trunk-jpl/test/Archives/Archive505.nc M /issm/trunk-jpl/test/Archives/Archive506.nc M /issm/trunk-jpl/test/Archives/Archive507.nc M /issm/trunk-jpl/test/Archives/Archive508.nc M /issm/trunk-jpl/test/Archives/Archive509.nc M /issm/trunk-jpl/test/Archives/Archive510.nc M /issm/trunk-jpl/test/Archives/Archive513.nc M /issm/trunk-jpl/test/Archives/Archive515.nc\\
+Export determination: 6. \\
+Rationale: CHG: updated archives for B update for enthalpy and thermal, we now use real P1 Enum\\
+\vspace{3em}
+
+\noindent \textbf{Change \#190} with diff file ISSM-16748-16749.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed enthalpy analysis solution\\
+\vspace{3em}
+
+\noindent \textbf{Change \#191} with diff file ISSM-16749-16750.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive333.nc M /issm/trunk-jpl/test/Archives/Archive335.nc\\
+Export determination: 6. \\
+Rationale: CHG: archives hydrology\\
+\vspace{3em}
+
+\noindent \textbf{Change \#192} with diff file ISSM-16750-16751.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: finished changes of InputUpdateFromSolution in enthalpy analysis\\
+\vspace{3em}
+
+\noindent \textbf{Change \#193} with diff file ISSM-16751-16752.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: NEW: added InputUpdateFromSolution for AdjointHoriz\\
+\vspace{3em}
+
+\noindent \textbf{Change \#194} with diff file ISSM-16752-16753.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h\\
+Export determination: 6. \\
+Rationale: CHG: added InputUpdateFromSolution for Adjoint Stokes\\
+\vspace{3em}
+
+\noindent \textbf{Change \#195} with diff file ISSM-16753-16754.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: added support for balance velocities and balance thickness\\
+\vspace{3em}
+
+\noindent \textbf{Change \#196} with diff file ISSM-16754-16755.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: NEW: extending new InputUpdateFromSolution to FS 2d\\
+\vspace{3em}
+
+\noindent \textbf{Change \#197} with diff file ISSM-16755-16756.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/cores/hydrology\_core.cpp M /issm/trunk-jpl/src/c/cores/transient\_core.cpp M /issm/trunk-jpl/src/m/solve/parseresultsfromdisk.m\\
+Export determination: 6. \\
+Rationale: NEW: do not save empty steps in results\\
+\vspace{3em}
+
+\noindent \textbf{Change \#198} with diff file ISSM-16756-16757.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp\\
+Export determination: 6. \\
+Rationale: NEW: extended InputUpdateFromSolution for FS 2d\\
+\vspace{3em}
+
+\noindent \textbf{Change \#199} with diff file ISSM-16757-16758.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/contrib/paraview/exportVTK.m\\
+Export determination: 6. \\
+Rationale: BUG: changing lenght in numel to check vector size\\
+\vspace{3em}
+
+\noindent \textbf{Change \#200} with diff file ISSM-16758-16759.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: CHG : cleanup and change in mask update\\
+\vspace{3em}
+
+\noindent \textbf{Change \#201} with diff file ISSM-16759-16760.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing update for adjoint FS\\
+\vspace{3em}
+
+\noindent \textbf{Change \#202} with diff file ISSM-16760-16761.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp\\
+Export determination: 6. \\
+Rationale: BUG: reverting back to previous version (still testing)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#203} with diff file ISSM-16761-16762.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: NEW: extended InputUpdateFromSolution to Hydrology\\
+\vspace{3em}
+
+\noindent \textbf{Change \#204} with diff file ISSM-16762-16763.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: BUG: fixed issues for higher order elements and trying to get Tiling HO SSA to work\\
+\vspace{3em}
+
+\noindent \textbf{Change \#205} with diff file ISSM-16763-16764.diff: \\
+Function name: \\
+D /issm/trunk-jpl/test/NightlyRun/testad.m\\
+Export determination: 6. \\
+Rationale: CHG: not needed anymore\\
+\vspace{3em}
+
+\noindent \textbf{Change \#206} with diff file ISSM-16764-16765.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/autodiff.m M /issm/trunk-jpl/src/m/classes/autodiff.py M /issm/trunk-jpl/src/m/classes/balancethickness.m M /issm/trunk-jpl/src/m/classes/balancethickness.py M /issm/trunk-jpl/src/m/classes/basalforcings.m M /issm/trunk-jpl/src/m/classes/basalforcings.py M /issm/trunk-jpl/src/m/classes/constants.m M /issm/trunk-jpl/src/m/classes/constants.py M /issm/trunk-jpl/src/m/classes/damage.m M /issm/trunk-jpl/src/m/classes/damage.py M /issm/trunk-jpl/src/m/classes/flaim.m M /issm/trunk-jpl/src/m/classes/flaim.py M /issm/trunk-jpl/src/m/classes/flowequation.m M /issm/trunk-jpl/src/m/classes/flowequation.py M /issm/trunk-jpl/src/m/classes/friction.m M /issm/trunk-jpl/src/m/classes/friction.py M /issm/trunk-jpl/src/m/classes/geometry.m M /issm/trunk-jpl/src/m/classes/geometry.py M /issm/trunk-jpl/src/m/classes/gia.m M /issm/trunk-jpl/src/m/classes/gia.py M /issm/trunk-jpl/src/m/classes/groundingline.m M /issm/trunk-jpl/src/m/classes/groundingline.py M /issm/trunk-jpl/src/m/classes/hydrologydc.m M /issm/trunk-jpl/src/m/classes/hydrologyshreve.m M /issm/trunk-jpl/src/m/classes/hydrologyshreve.py M /issm/trunk-jpl/src/m/classes/initialization.m M /issm/trunk-jpl/src/m/classes/initialization.py M /issm/trunk-jpl/src/m/classes/inversion.m M /issm/trunk-jpl/src/m/classes/inversion.py M /issm/trunk-jpl/src/m/classes/mask.m M /issm/trunk-jpl/src/m/classes/mask.py M /issm/trunk-jpl/src/m/classes/masstransport.m M /issm/trunk-jpl/src/m/classes/masstransport.py M /issm/trunk-jpl/src/m/classes/matice.m M /issm/trunk-jpl/src/m/classes/matice.py M /issm/trunk-jpl/src/m/classes/mesh.m M /issm/trunk-jpl/src/m/classes/mesh.py M /issm/trunk-jpl/src/m/classes/mesh2d.m M /issm/trunk-jpl/src/m/classes/mesh2d.py M /issm/trunk-jpl/src/m/classes/mesh2dvertical.m M /issm/trunk-jpl/src/m/classes/miscellaneous.m M /issm/trunk-jpl/src/m/classes/miscellaneous.py M /issm/trunk-jpl/src/m/classes/outputdefinition.m M /issm/trunk-jpl/src/m/classes/outputdefinition.py M /issm/trunk-jpl/src/m/classes/settings.m M /issm/trunk-jpl/src/m/classes/settings.py M /issm/trunk-jpl/src/m/classes/snowpack.m M /issm/trunk-jpl/src/m/classes/spheremesh.m M /issm/trunk-jpl/src/m/classes/steadystate.m M /issm/trunk-jpl/src/m/classes/steadystate.py M /issm/trunk-jpl/src/m/classes/stressbalance.m M /issm/trunk-jpl/src/m/classes/stressbalance.py M /issm/trunk-jpl/src/m/classes/surfaceforcings.m M /issm/trunk-jpl/src/m/classes/surfaceforcings.py M /issm/trunk-jpl/src/m/classes/taoinversion.m M /issm/trunk-jpl/src/m/classes/thermal.m M /issm/trunk-jpl/src/m/classes/thermal.py M /issm/trunk-jpl/src/m/classes/timestepping.m M /issm/trunk-jpl/src/m/classes/timestepping.py M /issm/trunk-jpl/src/m/classes/transient.m M /issm/trunk-jpl/src/m/classes/transient.py M /issm/trunk-jpl/src/m/consistency/checkfield.m M /issm/trunk-jpl/src/m/consistency/checkfield.py M /issm/trunk-jpl/src/m/interp/averaging.py\\
+Export determination: 6. \\
+Rationale: CHG: checkfield could not run for massatfluggate or misfit classes, because these classes do not have access to their own fields through the model! So we modified checkfield.m and checkfield.py to accept either directly a field, or indirectly a fieldname which then is used to retrieve from the model.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#207} with diff file ISSM-16765-16766.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/rifts.m\\
+Export determination: 6. \\
+Rationale: CHG: fixed bug in rifts check consistency\\
+\vspace{3em}
+
+\noindent \textbf{Change \#208} with diff file ISSM-16766-16767.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/rifts.py\\
+Export determination: 6. \\
+Rationale: CHG: fixed bug in rifts check consistency\\
+\vspace{3em}
+
+\noindent \textbf{Change \#209} with diff file ISSM-16767-16768.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/MisfitModelEnum.m A /issm/trunk-jpl/src/m/enum/MisfitNameEnum.m A /issm/trunk-jpl/src/m/enum/MisfitObservationsEnum.m A /issm/trunk-jpl/src/m/enum/MisfitTimeinterpolationEnum.m A /issm/trunk-jpl/src/m/enum/MisfitWeightsEnum.m\\
+Export determination: 6. \\
+Rationale: NEW: new enums for misfit class.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#210} with diff file ISSM-16768-16769.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/IoModel.cpp M /issm/trunk-jpl/src/c/classes/IoModel.h\\
+Export determination: 6. \\
+Rationale: CHG: new fetch multiple data for integers.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#211} with diff file ISSM-16769-16770.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: minor\\
+\vspace{3em}
+
+\noindent \textbf{Change \#212} with diff file ISSM-16770-16771.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/IoModel.cpp M /issm/trunk-jpl/src/c/classes/IoModel.h\\
+Export determination: 6. \\
+Rationale: CHG: added multiple integer vector fetch.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#213} with diff file ISSM-16771-16772.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/IoModel.cpp\\
+Export determination: 6. \\
+Rationale: CHG: fixed simple bugs.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#214} with diff file ISSM-16772-16773.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/exp/expdisp.m\\
+Export determination: 6. \\
+Rationale: NEW : modifying the way in which single points are ploted\\
+\vspace{3em}
+
+\noindent \textbf{Change \#215} with diff file ISSM-16773-16774.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h\\
+Export determination: 6. \\
+Rationale: BUG: fixed InputUpdateFromSolution for SSA HO tiling\\
+\vspace{3em}
+
+\noindent \textbf{Change \#216} with diff file ISSM-16774-16775.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h\\
+Export determination: 6. \\
+Rationale: NEW: working on HOFS\\
+\vspace{3em}
+
+\noindent \textbf{Change \#217} with diff file ISSM-16775-16776.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: CHG: fixinf HOFS coupling\\
+\vspace{3em}
+
+\noindent \textbf{Change \#218} with diff file ISSM-16776-16777.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h\\
+Export determination: 6. \\
+Rationale: NEW: done with SSAFS InputUpdateFromSolution\\
+\vspace{3em}
+
+\noindent \textbf{Change \#219} with diff file ISSM-16777-16778.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed SIASSA coup;ing\\
+\vspace{3em}
+
+\noindent \textbf{Change \#220} with diff file ISSM-16778-16779.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: BUG: fixed leak, spawned element need to delete its materials\\
+\vspace{3em}
+
+\noindent \textbf{Change \#221} with diff file ISSM-16779-16780.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed memory leak\\
+\vspace{3em}
+
+\noindent \textbf{Change \#222} with diff file ISSM-16780-16781.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed pressure HO issue for higher order element (need to be on vertices and not nodes)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#223} with diff file ISSM-16781-16782.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed memory leak\\
+\vspace{3em}
+
+\noindent \textbf{Change \#224} with diff file ISSM-16782-16783.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h M /issm/trunk-jpl/src/c/analyses/Analysis.h M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h M /issm/trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h M /issm/trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.h M /issm/trunk-jpl/src/c/analyses/EnumToAnalysis.h M /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h M /issm/trunk-jpl/src/c/analyses/GiaAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/GiaAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.h M /issm/trunk-jpl/src/c/analyses/MeltingAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MeltingAnalysis.h M /issm/trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.h\\
+Export determination: 6. \\
+Rationale: NEW: preparing CreateKMatrix and PVector (empty for now)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#225} with diff file ISSM-16783-16784.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/Loads/Numericalflux.h M /issm/trunk-jpl/src/c/classes/Loads/Pengrid.cpp M /issm/trunk-jpl/src/c/classes/Loads/Pengrid.h M /issm/trunk-jpl/src/c/classes/Loads/Penpair.h M /issm/trunk-jpl/src/c/classes/Loads/Riftfront.h M /issm/trunk-jpl/src/c/classes/Materials/Matice.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matice.h M /issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matpar.h M /issm/trunk-jpl/src/c/classes/Update.h M /issm/trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp\\
+Export determination: 6. \\
+Rationale: NEW: InputUpdateFromSolution is now entirely done by analyses\\
+\vspace{3em}
+
+\noindent \textbf{Change \#226} with diff file ISSM-16784-16785.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp\\
+Export determination: 6. \\
+Rationale: CHG: line not needed anymore\\
+\vspace{3em}
+
+\noindent \textbf{Change \#227} with diff file ISSM-16785-16786.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed bug in balance velocities\\
+\vspace{3em}
+
+\noindent \textbf{Change \#228} with diff file ISSM-16786-16787.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test511.m\\
+Export determination: 6. \\
+Rationale: reducing number of cpus\\
+\vspace{3em}
+
+\noindent \textbf{Change \#229} with diff file ISSM-16787-16788.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/Makefile.am M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h A /issm/trunk-jpl/src/c/classes/Misfit.h M /issm/trunk-jpl/src/c/classes/classes.h M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateOutputDefinitions.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.h M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp A /issm/trunk-jpl/src/m/classes/misfit.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py D /issm/trunk-jpl/src/m/enum/MisfitModelEnum.m A /issm/trunk-jpl/src/m/enum/MisfitModelEnumEnum.m A /issm/trunk-jpl/src/m/enum/MisfitObservationEnum.m A /issm/trunk-jpl/src/m/enum/MisfitObservationEnumEnum.m D /issm/trunk-jpl/src/m/enum/MisfitObservationsEnum.m A /issm/trunk-jpl/src/m/enum/MisfitWeightsEnumEnum.m A /issm/trunk-jpl/src/m/enum/SurfaceObservationEnum.m A /issm/trunk-jpl/src/m/enum/WeightsSurfaceObservationEnum.m\\
+Export determination: 6. \\
+Rationale: CHG: new Misfit output definition. Adapted ModelProcessorx and CreateOutputDefinitions accordingly. Created enums that go with it. Also create misfit.m class to setup this specific output definition.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#230} with diff file ISSM-16788-16789.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/FemModel.cpp M /issm/trunk-jpl/src/c/classes/Loads/Pengrid.cpp\\
+Export determination: 6. \\
+Rationale: BUG+CHG: fixing a conditional jmp in pengrid and changing the way in which we deal with the active nodes for L2ProjectionEPL\\
+\vspace{3em}
+
+\noindent \textbf{Change \#231} with diff file ISSM-16789-16790.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp M /issm/trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.h\\
+Export determination: 6. \\
+Rationale: NEW: AddToGlobal and condensation now done by SystemMatrices\\
+\vspace{3em}
+
+\noindent \textbf{Change \#232} with diff file ISSM-16790-16791.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp\\
+Export determination: 6. \\
+Rationale: BUG: do not delete Ke while reducing matrices\\
+\vspace{3em}
+
+\noindent \textbf{Change \#233} with diff file ISSM-16791-16792.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/SurfaceAreax/SurfaceAreax.h\\
+Export determination: 6. \\
+Rationale: CHG: reduce header file include scope\\
+\vspace{3em}
+
+\noindent \textbf{Change \#234} with diff file ISSM-16792-16793.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Params/DataSetParam.h M /issm/trunk-jpl/src/c/classes/Params/Parameters.cpp M /issm/trunk-jpl/src/c/classes/Params/Parameters.h\\
+Export determination: 6. \\
+Rationale: CHG: making a new SetParam functionality in Parameters for DataSetParam type objects.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#235} with diff file ISSM-16793-16794.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Misfit.h\\
+Export determination: 6. \\
+Rationale: CHG: finished implementing an arbitrary misfit routine, which returns the temporally and spatially averaged misfit of the model with resepct to observations.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#236} with diff file ISSM-16794-16795.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/OutputDefinitionsResponsex/OutputDefinitionsResponsex.cpp\\
+Export determination: 6. \\
+Rationale: CHG: changed the way OutputDefinitionsResponsex retrieves the output definitions, so we can store information in the output definitions without it being wiped out the next time we call the corresponding response function.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#237} with diff file ISSM-16795-16796.diff: \\
+Function name: \\
+A /issm/trunk-jpl/test/Archives/Archive123.nc M /issm/trunk-jpl/test/NightlyRun/IdToName.m A /issm/trunk-jpl/test/NightlyRun/test123.m\\
+Export determination: 6. \\
+Rationale: NEW: new test123 in Nightly Runs, to test the surface misfit in transient mode.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#238} with diff file ISSM-16796-16797.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/gdal/install-1.10-macosx64.sh M /issm/trunk-jpl/externalpackages/gdal/install-1.6-macosx64.sh\\
+Export determination: 6. \\
+Rationale: CHG: better install, with in particular linking to the right libexpat.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#239} with diff file ISSM-16797-16798.diff: \\
+Function name: \\
+M /issm/trunk-jpl/etc/environment.sh\\
+Export determination: 6. \\
+Rationale: CHG: PROJ.4 and libexpat pre and post- appending onto LD\_LIBRARY\_PATH\\
+\vspace{3em}
+
+\noindent \textbf{Change \#240} with diff file ISSM-16798-16799.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/coordsystems/gdaltransform.m\\
+Export determination: 6. \\
+Rationale: NEW: gdaltransform routine, to handle any type of projection!\\
+\vspace{3em}
+
+\noindent \textbf{Change \#241} with diff file ISSM-16799-16800.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/Inputs/BoolInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/BoolInput.h M /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.h M /issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.h M /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.h M /issm/trunk-jpl/src/c/classes/Inputs/Input.h M /issm/trunk-jpl/src/c/classes/Inputs/IntInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/IntInput.h M /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.h M /issm/trunk-jpl/src/c/classes/Inputs/SegInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/SegInput.h M /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.h M /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.h M /issm/trunk-jpl/src/c/classes/gauss/Gauss.h\\
+Export determination: 6. \\
+Rationale: CHG: moving Pvector in Analysis\\
+\vspace{3em}
+
+\noindent \textbf{Change \#242} with diff file ISSM-16800-16801.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: CHG: implementing PVector in analysis for SSA and removing CreateKMatrix(pf)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#243} with diff file ISSM-16801-16802.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/gauss/GaussPenta.h M /issm/trunk-jpl/src/c/classes/gauss/GaussSeg.h M /issm/trunk-jpl/src/c/classes/gauss/GaussTria.h\\
+Export determination: 6. \\
+Rationale: CHG: done with Driving stress SSA\\
+\vspace{3em}
+
+\noindent \textbf{Change \#244} with diff file ISSM-16802-16803.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h\\
+Export determination: 6. \\
+Rationale: NEW: implementing TransformLoad\\
+\vspace{3em}
+
+\noindent \textbf{Change \#245} with diff file ISSM-16803-16804.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: NEW: done with SSA 3d\\
+\vspace{3em}
+
+\noindent \textbf{Change \#246} with diff file ISSM-16804-16805.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: some clean up\\
+\vspace{3em}
+
+\noindent \textbf{Change \#247} with diff file ISSM-16805-16806.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp\\
+Export determination: 6. \\
+Rationale: NEW: working on FS\\
+\vspace{3em}
+
+\noindent \textbf{Change \#248} with diff file ISSM-16806-16807.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/solve/parseresultsfromdisk.m\\
+Export determination: 6. \\
+Rationale: CHG: error out if result is empty\\
+\vspace{3em}
+
+\noindent \textbf{Change \#249} with diff file ISSM-16807-16808.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: NEW: done with FS shelf\\
+\vspace{3em}
+
+\noindent \textbf{Change \#250} with diff file ISSM-16808-16809.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp\\
+Export determination: 6. \\
+Rationale: BUG: reverting back to working version\\
+\vspace{3em}
+
+\noindent \textbf{Change \#251} with diff file ISSM-16809-16810.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: NEW: done with Mass conservation CG and DG\\
+\vspace{3em}
+
+\noindent \textbf{Change \#252} with diff file ISSM-16810-16811.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/MeltingAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: NEW: done with thermal shelf\\
+\vspace{3em}
+
+\noindent \textbf{Change \#253} with diff file ISSM-16811-16812.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h\\
+Export determination: 6. \\
+Rationale: NEW: PVEctor Balance thickness\\
+\vspace{3em}
+
+\noindent \textbf{Change \#254} with diff file ISSM-16812-16813.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matpar.h\\
+Export determination: 6. \\
+Rationale: NEW: working on wnthalpy\\
+\vspace{3em}
+
+\noindent \textbf{Change \#255} with diff file ISSM-16813-16814.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: BUG: fixed enthalpy\\
+\vspace{3em}
+
+\noindent \textbf{Change \#256} with diff file ISSM-16814-16815.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim\\
+Export determination: 6. \\
+Rationale: CHG: updated C syntax highlight\\
+\vspace{3em}
+
+\noindent \textbf{Change \#257} with diff file ISSM-16815-16816.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/independent.m M /issm/trunk-jpl/src/m/classes/independent.py\\
+Export determination: 6. \\
+Rationale: CHG: new checkfield routine in independent class.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#258} with diff file ISSM-16816-16817.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/shared/Elements/DrainageFunctionWaterfraction.cpp M /issm/trunk-jpl/src/c/shared/Elements/LliboutryDuval.cpp M /issm/trunk-jpl/test/Archives/Archive121.nc M /issm/trunk-jpl/test/Archives/Archive122.nc M /issm/trunk-jpl/test/Archives/Archive325.nc M /issm/trunk-jpl/test/Archives/Archive326.nc M /issm/trunk-jpl/test/Archives/Archive327.nc M /issm/trunk-jpl/test/Archives/Archive431.nc M /issm/trunk-jpl/test/Archives/Archive432.nc\\
+Export determination: 6. \\
+Rationale: CHG: Drainage of waterfraction debugged. Drainage happens now in Penta::ComputeBasalMeltingrates()\\
+\vspace{3em}
+
+\noindent \textbf{Change \#259} with diff file ISSM-16817-16818.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/FemModel.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: CHG : clean up and change in the way we treat inactive nodes for the epl thickness computation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#260} with diff file ISSM-16818-16819.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/Analysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.cpp M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/Elements/TriaRef.cpp M /issm/trunk-jpl/src/c/classes/Elements/TriaRef.h M /issm/trunk-jpl/src/c/classes/Inputs/BoolInput.h M /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.h M /issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.h M /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.h M /issm/trunk-jpl/src/c/classes/Inputs/Input.h M /issm/trunk-jpl/src/c/classes/Inputs/IntInput.h M /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.h M /issm/trunk-jpl/src/c/classes/Inputs/SegInput.h M /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.h M /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.h\\
+Export determination: 6. \\
+Rationale: NEW: CreateKMatrixSSA in analysis\\
+\vspace{3em}
+
+\noindent \textbf{Change \#261} with diff file ISSM-16819-16820.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp M /issm/trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp\\
+Export determination: 6. \\
+Rationale: CHG: add friction coefficient for some users\\
+\vspace{3em}
+
+\noindent \textbf{Change \#262} with diff file ISSM-16820-16821.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/consistency/checkfield.m\\
+Export determination: 6. \\
+Rationale: BUG: check that string row is a cell first\\
+\vspace{3em}
+
+\noindent \textbf{Change \#263} with diff file ISSM-16821-16822.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/consistency/ismodelselfconsistent.m\\
+Export determination: 6. \\
+Rationale: BUG: skip field if not an object\\
+\vspace{3em}
+
+\noindent \textbf{Change \#264} with diff file ISSM-16822-16823.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/model.m\\
+Export determination: 6. \\
+Rationale: BUG: fixed loadmodel for older model where outputdefinition is not defined\\
+\vspace{3em}
+
+\noindent \textbf{Change \#265} with diff file ISSM-16823-16824.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: CHG: adding other sliding laws in SIA\\
+\vspace{3em}
+
+\noindent \textbf{Change \#266} with diff file ISSM-16824-16825.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: CHG: added ref\\
+\vspace{3em}
+
+\noindent \textbf{Change \#267} with diff file ISSM-16825-16826.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test508.m M /issm/trunk-jpl/test/NightlyRun/test508.py M /issm/trunk-jpl/test/NightlyRun/test513.m M /issm/trunk-jpl/test/NightlyRun/test513.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxing some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#268} with diff file ISSM-16826-16827.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp\\
+Export determination: 6. \\
+Rationale: BUG: SIA do not delete gauss before dealing with base\\
+\vspace{3em}
+
+\noindent \textbf{Change \#269} with diff file ISSM-16827-16828.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: NEW: done with CreateKMatrixVert\\
+\vspace{3em}
+
+\noindent \textbf{Change \#270} with diff file ISSM-16828-16829.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: minor clean up\\
+\vspace{3em}
+
+\noindent \textbf{Change \#271} with diff file ISSM-16829-16830.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: NEW: added KMatrix HO\\
+\vspace{3em}
+
+\noindent \textbf{Change \#272} with diff file ISSM-16830-16831.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/Makefile.am\\
+Export determination: 6. \\
+Rationale: CHG: Added the Python scripts from the interp directory to the install list.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#273} with diff file ISSM-16831-16832.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: NEW: added FS KMatrix Shelf\\
+\vspace{3em}
+
+\noindent \textbf{Change \#274} with diff file ISSM-16832-16833.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: NEW: added mass transport\\
+\vspace{3em}
+
+\noindent \textbf{Change \#275} with diff file ISSM-16833-16834.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: CHG: added function to figure out if an element includes zero level set values\\
+\vspace{3em}
+
+\noindent \textbf{Change \#276} with diff file ISSM-16834-16835.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: CHG: some simplifications\\
+\vspace{3em}
+
+\noindent \textbf{Change \#277} with diff file ISSM-16835-16836.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp\\
+Export determination: 6. \\
+Rationale: BUG: added N to GetMaterialParameter\\
+\vspace{3em}
+
+\noindent \textbf{Change \#278} with diff file ISSM-16836-16837.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp\\
+Export determination: 6. \\
+Rationale: BUG: added B to GetMaterialParameter\\
+\vspace{3em}
+
+\noindent \textbf{Change \#279} with diff file ISSM-16837-16838.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: added error message when water fraction exceeds 100%\\
+\vspace{3em}
+
+\noindent \textbf{Change \#280} with diff file ISSM-16838-16839.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.cpp M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: CHG: starting to move Front vectors in analysis\\
+\vspace{3em}
+
+\noindent \textbf{Change \#281} with diff file ISSM-16839-16840.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: CHG: moved ice front HO in analysis\\
+\vspace{3em}
+
+\noindent \textbf{Change \#282} with diff file ISSM-16840-16841.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/MeltingAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: NEW: working on thermal KMatrix\\
+\vspace{3em}
+
+\noindent \textbf{Change \#283} with diff file ISSM-16841-16842.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing KMatrix Thermal\\
+\vspace{3em}
+
+\noindent \textbf{Change \#284} with diff file ISSM-16842-16843.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing transient term in KMatrix\\
+\vspace{3em}
+
+\noindent \textbf{Change \#285} with diff file ISSM-16843-16844.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h\\
+Export determination: 6. \\
+Rationale: NEW: done with bal H\\
+\vspace{3em}
+
+\noindent \textbf{Change \#286} with diff file ISSM-16844-16845.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: NEW: FS front\\
+\vspace{3em}
+
+\noindent \textbf{Change \#287} with diff file ISSM-16845-16846.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: no need to be on bed\\
+\vspace{3em}
+
+\noindent \textbf{Change \#288} with diff file ISSM-16846-16847.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: Bug : Fixing issues in the epl gradient computation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#289} with diff file ISSM-16847-16848.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.cpp M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: NEW: done with PVector Adjoint Horiz\\
+\vspace{3em}
+
+\noindent \textbf{Change \#290} with diff file ISSM-16848-16849.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp A /issm/trunk-jpl/src/m/enum/DamageFEnum.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py\\
+Export determination: 6. \\
+Rationale: CHG: done with Damage evolution\\
+\vspace{3em}
+
+\noindent \textbf{Change \#291} with diff file ISSM-16849-16850.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: NEW: PVector SIA 2D\\
+\vspace{3em}
+
+\noindent \textbf{Change \#292} with diff file ISSM-16850-16851.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: NEW: PVector SIA 3d\\
+\vspace{3em}
+
+\noindent \textbf{Change \#293} with diff file ISSM-16851-16852.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp\\
+Export determination: 6. \\
+Rationale: CHG: Adding an element active mask for the EPL\\
+\vspace{3em}
+
+\noindent \textbf{Change \#294} with diff file ISSM-16852-16853.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/HydrologydcMaskEplactiveEltEnum.m A /issm/trunk-jpl/src/m/enum/HydrologydcMaskEplactiveNodeEnum.m M /issm/trunk-jpl/src/m/shp/Shp2Exp.m\\
+Export determination: 6. \\
+Rationale: CHG: Adding an element active mask for the EPL\\
+\vspace{3em}
+
+\noindent \textbf{Change \#295} with diff file ISSM-16853-16854.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp\\
+Export determination: 6. \\
+Rationale: NEW: PVector DC\\
+\vspace{3em}
+
+\noindent \textbf{Change \#296} with diff file ISSM-16854-16855.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/FemModel.cpp M /issm/trunk-jpl/src/c/cores/hydrology\_core.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: CHG: changing current enum of mask epl active to reflect the nodal caracteristic\\
+\vspace{3em}
+
+\noindent \textbf{Change \#297} with diff file ISSM-16855-16856.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/hydrologydc.m\\
+Export determination: 6. \\
+Rationale: CHG: changing current enum of mask epl active to reflect the nodal caracteristic\\
+\vspace{3em}
+
+\noindent \textbf{Change \#298} with diff file ISSM-16856-16857.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test333.m M /issm/trunk-jpl/test/NightlyRun/test335.m\\
+Export determination: 6. \\
+Rationale: CHG : Changing the hydro runs to reflect the Enum change\\
+\vspace{3em}
+
+\noindent \textbf{Change \#299} with diff file ISSM-16857-16858.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: BUG: commenting printfs\\
+\vspace{3em}
+
+\noindent \textbf{Change \#300} with diff file ISSM-16858-16859.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: minor\\
+\vspace{3em}
+
+\noindent \textbf{Change \#301} with diff file ISSM-16859-16860.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h\\
+Export determination: 6. \\
+Rationale: NEW: PVector L1L2\\
+\vspace{3em}
+
+\noindent \textbf{Change \#302} with diff file ISSM-16860-16861.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: NEW: bal vel PVector\\
+\vspace{3em}
+
+\noindent \textbf{Change \#303} with diff file ISSM-16861-16862.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/model.m\\
+Export determination: 6. \\
+Rationale: BUG : Fix related to Enum Name change\\
+\vspace{3em}
+
+\noindent \textbf{Change \#304} with diff file ISSM-16862-16863.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Seg.cpp M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: NEW: Adjoint BalH\\
+\vspace{3em}
+
+\noindent \textbf{Change \#305} with diff file ISSM-16863-16864.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing some memory leaks\\
+\vspace{3em}
+
+\noindent \textbf{Change \#306} with diff file ISSM-16864-16865.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: CHG:Modification in the way we treat with the epl element mask\\
+\vspace{3em}
+
+\noindent \textbf{Change \#307} with diff file ISSM-16865-16866.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: memory leak\\
+\vspace{3em}
+
+\noindent \textbf{Change \#308} with diff file ISSM-16866-16867.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: CHG: added FS vertical\\
+\vspace{3em}
+
+\noindent \textbf{Change \#309} with diff file ISSM-16867-16868.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/runme.m\\
+Export determination: 6. \\
+Rationale: CHG: added stoponerror option to runme.m\\
+\vspace{3em}
+
+\noindent \textbf{Change \#310} with diff file ISSM-16868-16869.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: BUG: Bug in retrieving the epl mask input\\
+\vspace{3em}
+
+\noindent \textbf{Change \#311} with diff file ISSM-16869-16870.diff: \\
+Function name: \\
+A /issm/trunk-jpl/jenkins/windows.sh\\
+Export determination: 6. \\
+Rationale: CHG: adding windows platform\\
+\vspace{3em}
+
+\noindent \textbf{Change \#312} with diff file ISSM-16870-16871.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/cores/hydrology\_core.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: BUG: Fixing issue with the epl mask when we use only one layer\\
+\vspace{3em}
+
+\noindent \textbf{Change \#313} with diff file ISSM-16871-16872.diff: \\
+Function name: \\
+A /issm/trunk-jpl/jenkins/windows (from /issm/trunk-jpl/jenkins/windows.sh:16869) D /issm/trunk-jpl/jenkins/windows.sh\\
+Export determination: 6. \\
+Rationale: CHG: wrong name\\
+\vspace{3em}
+
+\noindent \textbf{Change \#314} with diff file ISSM-16872-16873.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: CHG: added SSA friction KMatrix in analysis\\
+\vspace{3em}
+
+\noindent \textbf{Change \#315} with diff file ISSM-16873-16874.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/Loads/Friction.cpp M /issm/trunk-jpl/src/c/classes/Loads/Friction.h\\
+Export determination: 6. \\
+Rationale: CHG: changed friction's interface\\
+\vspace{3em}
+
+\noindent \textbf{Change \#316} with diff file ISSM-16874-16875.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: NEW: KMatrix friction SSA\\
+\vspace{3em}
+
+\noindent \textbf{Change \#317} with diff file ISSM-16875-16876.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h\\
+Export determination: 6. \\
+Rationale: NEW: added KMatrix damage\\
+\vspace{3em}
+
+\noindent \textbf{Change \#318} with diff file ISSM-16876-16877.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.cpp M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: NEW: Adjoint SSA and SIA\\
+\vspace{3em}
+
+\noindent \textbf{Change \#319} with diff file ISSM-16877-16878.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/imac-012301-gil M /issm/trunk-jpl/jenkins/jenkins.sh M /issm/trunk-jpl/jenkins/linux64\_larsen M /issm/trunk-jpl/jenkins/linux64\_murdo M /issm/trunk-jpl/jenkins/linux64\_murdo\_ad M /issm/trunk-jpl/jenkins/linux64\_murdo\_ampi M /issm/trunk-jpl/jenkins/windows\\
+Export determination: 6. \\
+Rationale: CHG: adjusting for hostnaames on cygwin and missing REPOSITORY environmental variable.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#320} with diff file ISSM-16878-16879.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/windows\\
+Export determination: 6. \\
+Rationale: CHG: refining windows platform settings\\
+\vspace{3em}
+
+\noindent \textbf{Change \#321} with diff file ISSM-16879-16880.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/windows\\
+Export determination: 6. \\
+Rationale: CHG: install cccl compiler first.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#322} with diff file ISSM-16880-16881.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/petsc/install-3.1-win7.sh\\
+Export determination: 6. \\
+Rationale: CHG: get petsc directory into cygwin compatible path.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#323} with diff file ISSM-16881-16882.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/petsc/install-3.1-win7.sh\\
+Export determination: 6. \\
+Rationale: CHG: prefix directory also requires going through cygpath.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#324} with diff file ISSM-16882-16883.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h\\
+Export determination: 6. \\
+Rationale: NEW: done with friction\\
+\vspace{3em}
+
+\noindent \textbf{Change \#325} with diff file ISSM-16883-16884.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/windows\\
+Export determination: 6. \\
+Rationale: CHG: forgot to install matlab.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#326} with diff file ISSM-16884-16885.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/windows\\
+Export determination: 6. \\
+Rationale: CHG: typo in windows jenkins configuration\\
+\vspace{3em}
+
+\noindent \textbf{Change \#327} with diff file ISSM-16885-16886.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/windows\\
+Export determination: 6. \\
+Rationale: CHG: using the new m4 mpi macros\\
+\vspace{3em}
+
+\noindent \textbf{Change \#328} with diff file ISSM-16886-16887.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: NEW: KMatrix Adjoint FS and HO\\
+\vspace{3em}
+
+\noindent \textbf{Change \#329} with diff file ISSM-16887-16888.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/cores/hydrology\_core.cpp\\
+Export determination: 6. \\
+Rationale: BUG: Taking of EPLMaskELt from the output to avoid the P0 interpolation on outputs (not implemented)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#330} with diff file ISSM-16888-16889.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.h\\
+Export determination: 6. \\
+Rationale: CHG: added Enthalpy but not working\\
+\vspace{3em}
+
+\noindent \textbf{Change \#331} with diff file ISSM-16889-16890.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: NEW: K matrix bal vel\\
+\vspace{3em}
+
+\noindent \textbf{Change \#332} with diff file ISSM-16890-16891.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: NEW: FS flowband\\
+\vspace{3em}
+
+\noindent \textbf{Change \#333} with diff file ISSM-16891-16892.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: BUG: wrong size to create Gauss point on front\\
+\vspace{3em}
+
+\noindent \textbf{Change \#334} with diff file ISSM-16892-16893.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/gauss/Gauss.h M /issm/trunk-jpl/src/c/classes/gauss/GaussPenta.cpp M /issm/trunk-jpl/src/c/classes/gauss/GaussPenta.h M /issm/trunk-jpl/src/c/classes/gauss/GaussSeg.cpp M /issm/trunk-jpl/src/c/classes/gauss/GaussSeg.h M /issm/trunk-jpl/src/c/classes/gauss/GaussTria.cpp M /issm/trunk-jpl/src/c/classes/gauss/GaussTria.h\\
+Export determination: 6. \\
+Rationale: NEW: KMatrix L1L2 (not working)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#335} with diff file ISSM-16893-16894.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing problem with L1L2 friction\\
+\vspace{3em}
+
+\noindent \textbf{Change \#336} with diff file ISSM-16894-16895.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing enthalpy (fabs not used in stabilization)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#337} with diff file ISSM-16895-16896.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.h\\
+Export determination: 6. \\
+Rationale: CHG: fixed Enthalpy\\
+\vspace{3em}
+
+\noindent \textbf{Change \#338} with diff file ISSM-16896-16897.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing enthalpy KMatrix\\
+\vspace{3em}
+
+\noindent \textbf{Change \#339} with diff file ISSM-16897-16898.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: fixing thermal but still not there yet\\
+\vspace{3em}
+
+\noindent \textbf{Change \#340} with diff file ISSM-16898-16899.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing stabilization=2 in thermal\\
+\vspace{3em}
+
+\noindent \textbf{Change \#341} with diff file ISSM-16899-16900.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h M /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp\\
+Export determination: 6. \\
+Rationale: CHG: preparing KMatrix Hydrology DC\\
+\vspace{3em}
+
+\noindent \textbf{Change \#342} with diff file ISSM-16900-16901.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: CHG : Changing the position of the transfer computation in Hydrologydc\\
+\vspace{3em}
+
+\noindent \textbf{Change \#343} with diff file ISSM-16901-16902.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/solvers/bcgsasmoptions.m A /issm/trunk-jpl/src/m/solvers/bcgsbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/bcgsgamgoptions.m A /issm/trunk-jpl/src/m/solvers/bcgsgasmoptions.m A /issm/trunk-jpl/src/m/solvers/bcgshypreoptions.m A /issm/trunk-jpl/src/m/solvers/bcgsjacobioptions.m A /issm/trunk-jpl/src/m/solvers/bcgslasmoptions.m A /issm/trunk-jpl/src/m/solvers/bcgslbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/bcgslgamgoptions.m A /issm/trunk-jpl/src/m/solvers/bcgslgasmoptions.m A /issm/trunk-jpl/src/m/solvers/bcgslhypreoptions.m A /issm/trunk-jpl/src/m/solvers/bcgsljacobioptions.m A /issm/trunk-jpl/src/m/solvers/bcgslmgoptions.m A /issm/trunk-jpl/src/m/solvers/bcgslpbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/bcgslsoroptions.m A /issm/trunk-jpl/src/m/solvers/bcgsmgoptions.m A /issm/trunk-jpl/src/m/solvers/bcgspbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/bcgssoroptions.m A /issm/trunk-jpl/src/m/solvers/bicgasmoptions.m A /issm/trunk-jpl/src/m/solvers/bicgbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/bicggamgoptions.m A /issm/trunk-jpl/src/m/solvers/bicggasmoptions.m A /issm/trunk-jpl/src/m/solvers/bicghypreoptions.m A /issm/trunk-jpl/src/m/solvers/bicgjacobioptions.m A /issm/trunk-jpl/src/m/solvers/bicgmgoptions.m A /issm/trunk-jpl/src/m/solvers/bicgpbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/bicgsoroptions.m A /issm/trunk-jpl/src/m/solvers/cgasmoptions.m A /issm/trunk-jpl/src/m/solvers/cgbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/cggamgoptions.m A /issm/trunk-jpl/src/m/solvers/cggasmoptions.m A /issm/trunk-jpl/src/m/solvers/cghypreoptions.m A /issm/trunk-jpl/src/m/solvers/cgjacobioptions.m A /issm/trunk-jpl/src/m/solvers/cgmgoptions.m A /issm/trunk-jpl/src/m/solvers/cgneasmoptions.m A /issm/trunk-jpl/src/m/solvers/cgnebjacobioptions.m A /issm/trunk-jpl/src/m/solvers/cgnegamgoptions.m A /issm/trunk-jpl/src/m/solvers/cgnegasmoptions.m A /issm/trunk-jpl/src/m/solvers/cgnehypreoptions.m A /issm/trunk-jpl/src/m/solvers/cgnejacobioptions.m A /issm/trunk-jpl/src/m/solvers/cgnemgoptions.m A /issm/trunk-jpl/src/m/solvers/cgnepbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/cgnesoroptions.m A /issm/trunk-jpl/src/m/solvers/cgpbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/cgsasmoptions.m A /issm/trunk-jpl/src/m/solvers/cgsbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/cgsgamgoptions.m A /issm/trunk-jpl/src/m/solvers/cgsgasmoptions.m A /issm/trunk-jpl/src/m/solvers/cgshypreoptions.m A /issm/trunk-jpl/src/m/solvers/cgsjacobioptions.m A /issm/trunk-jpl/src/m/solvers/cgsmgoptions.m A /issm/trunk-jpl/src/m/solvers/cgsoroptions.m A /issm/trunk-jpl/src/m/solvers/cgspbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/cgssoroptions.m A /issm/trunk-jpl/src/m/solvers/conditionnumberoptions.m A /issm/trunk-jpl/src/m/solvers/crasmoptions.m A /issm/trunk-jpl/src/m/solvers/crbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/crgamgoptions.m A /issm/trunk-jpl/src/m/solvers/crgasmoptions.m A /issm/trunk-jpl/src/m/solvers/crhypreoptions.m A /issm/trunk-jpl/src/m/solvers/crjacobioptions.m A /issm/trunk-jpl/src/m/solvers/crmgoptions.m A /issm/trunk-jpl/src/m/solvers/crpbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/crsoroptions.m A /issm/trunk-jpl/src/m/solvers/dgmresasmoptions.m A /issm/trunk-jpl/src/m/solvers/dgmresbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/dgmresgamgoptions.m A /issm/trunk-jpl/src/m/solvers/dgmresgasmoptions.m A /issm/trunk-jpl/src/m/solvers/dgmreshypreoptions.m A /issm/trunk-jpl/src/m/solvers/dgmresjacobioptions.m A /issm/trunk-jpl/src/m/solvers/dgmresmgoptions.m A /issm/trunk-jpl/src/m/solvers/dgmrespbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/dgmressoroptions.m A /issm/trunk-jpl/src/m/solvers/fgmresasmoptions.m A /issm/trunk-jpl/src/m/solvers/fgmresbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/fgmresgamgoptions.m A /issm/trunk-jpl/src/m/solvers/fgmresgasmoptions.m A /issm/trunk-jpl/src/m/solvers/fgmreshypreoptions.m A /issm/trunk-jpl/src/m/solvers/fgmresjacobioptions.m A /issm/trunk-jpl/src/m/solvers/fgmresmgoptions.m A /issm/trunk-jpl/src/m/solvers/fgmrespbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/fgmressoroptions.m A /issm/trunk-jpl/src/m/solvers/gcrasmoptions.m A /issm/trunk-jpl/src/m/solvers/gcrbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/gcrgamgoptions.m A /issm/trunk-jpl/src/m/solvers/gcrgasmoptions.m A /issm/trunk-jpl/src/m/solvers/gcrhypreoptions.m A /issm/trunk-jpl/src/m/solvers/gcrjacobioptions.m A /issm/trunk-jpl/src/m/solvers/gcrmgoptions.m A /issm/trunk-jpl/src/m/solvers/gcrpbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/gcrsoroptions.m A /issm/trunk-jpl/src/m/solvers/gltrasmoptions.m A /issm/trunk-jpl/src/m/solvers/gltrbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/gltrgamgoptions.m A /issm/trunk-jpl/src/m/solvers/gltrgasmoptions.m A /issm/trunk-jpl/src/m/solvers/gltrhypreoptions.m A /issm/trunk-jpl/src/m/solvers/gltrjacobioptions.m A /issm/trunk-jpl/src/m/solvers/gltrmgoptions.m A /issm/trunk-jpl/src/m/solvers/gltrpbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/gltrsoroptions.m A /issm/trunk-jpl/src/m/solvers/gmresasmoptions.m A /issm/trunk-jpl/src/m/solvers/gmresbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/gmresgamgoptions.m A /issm/trunk-jpl/src/m/solvers/gmresgasmoptions.m A /issm/trunk-jpl/src/m/solvers/gmreshypreoptions.m A /issm/trunk-jpl/src/m/solvers/gmresjacobioptions.m A /issm/trunk-jpl/src/m/solvers/gmresmgoptions.m A /issm/trunk-jpl/src/m/solvers/gmrespbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/gmressoroptions.m A /issm/trunk-jpl/src/m/solvers/ibcgsasmoptions.m A /issm/trunk-jpl/src/m/solvers/ibcgsbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/ibcgsgamgoptions.m A /issm/trunk-jpl/src/m/solvers/ibcgsgasmoptions.m A /issm/trunk-jpl/src/m/solvers/ibcgshypreoptions.m A /issm/trunk-jpl/src/m/solvers/ibcgsjacobioptions.m A /issm/trunk-jpl/src/m/solvers/ibcgsmgoptions.m A /issm/trunk-jpl/src/m/solvers/ibcgspbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/ibcgssoroptions.m A /issm/trunk-jpl/src/m/solvers/lcdasmoptions.m A /issm/trunk-jpl/src/m/solvers/lcdbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/lcdgamgoptions.m A /issm/trunk-jpl/src/m/solvers/lcdgasmoptions.m A /issm/trunk-jpl/src/m/solvers/lcdhypreoptions.m A /issm/trunk-jpl/src/m/solvers/lcdjacobioptions.m A /issm/trunk-jpl/src/m/solvers/lcdmgoptions.m A /issm/trunk-jpl/src/m/solvers/lcdpbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/lcdsoroptions.m A /issm/trunk-jpl/src/m/solvers/lsqrasmoptions.m A /issm/trunk-jpl/src/m/solvers/lsqrbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/lsqrgamgoptions.m A /issm/trunk-jpl/src/m/solvers/lsqrgasmoptions.m A /issm/trunk-jpl/src/m/solvers/lsqrhypreoptions.m A /issm/trunk-jpl/src/m/solvers/lsqrjacobioptions.m A /issm/trunk-jpl/src/m/solvers/lsqrmgoptions.m A /issm/trunk-jpl/src/m/solvers/lsqrpbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/lsqrsoroptions.m A /issm/trunk-jpl/src/m/solvers/minresasmoptions.m A /issm/trunk-jpl/src/m/solvers/minresbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/minresgamgoptions.m A /issm/trunk-jpl/src/m/solvers/minresgasmoptions.m A /issm/trunk-jpl/src/m/solvers/minreshypreoptions.m A /issm/trunk-jpl/src/m/solvers/minresjacobioptions.m A /issm/trunk-jpl/src/m/solvers/minresmgoptions.m A /issm/trunk-jpl/src/m/solvers/minrespbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/minressoroptions.m A /issm/trunk-jpl/src/m/solvers/richardsonasmoptions.m A /issm/trunk-jpl/src/m/solvers/richardsonbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/richardsongamgoptions.m A /issm/trunk-jpl/src/m/solvers/richardsongasmoptions.m A /issm/trunk-jpl/src/m/solvers/richardsonhypreoptions.m A /issm/trunk-jpl/src/m/solvers/richardsonjacobioptions.m A /issm/trunk-jpl/src/m/solvers/richardsonmgoptions.m A /issm/trunk-jpl/src/m/solvers/richardsonpbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/richardsonsoroptions.m A /issm/trunk-jpl/src/m/solvers/stcgasmoptions.m A /issm/trunk-jpl/src/m/solvers/stcgbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/stcggamgoptions.m A /issm/trunk-jpl/src/m/solvers/stcggasmoptions.m A /issm/trunk-jpl/src/m/solvers/stcghypreoptions.m A /issm/trunk-jpl/src/m/solvers/stcgjacobioptions.m A /issm/trunk-jpl/src/m/solvers/stcgmgoptions.m A /issm/trunk-jpl/src/m/solvers/stcgpbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/stcgsoroptions.m A /issm/trunk-jpl/src/m/solvers/symmlqasmoptions.m A /issm/trunk-jpl/src/m/solvers/symmlqbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/symmlqgamgoptions.m A /issm/trunk-jpl/src/m/solvers/symmlqgasmoptions.m A /issm/trunk-jpl/src/m/solvers/symmlqhypreoptions.m A /issm/trunk-jpl/src/m/solvers/symmlqjacobioptions.m A /issm/trunk-jpl/src/m/solvers/symmlqmgoptions.m A /issm/trunk-jpl/src/m/solvers/symmlqpbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/symmlqsoroptions.m A /issm/trunk-jpl/src/m/solvers/tfqmrasmoptions.m A /issm/trunk-jpl/src/m/solvers/tfqmrbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/tfqmrgamgoptions.m A /issm/trunk-jpl/src/m/solvers/tfqmrgasmoptions.m A /issm/trunk-jpl/src/m/solvers/tfqmrhypreoptions.m A /issm/trunk-jpl/src/m/solvers/tfqmrjacobioptions.m A /issm/trunk-jpl/src/m/solvers/tfqmrmgoptions.m A /issm/trunk-jpl/src/m/solvers/tfqmrpbjacobioptions.m A /issm/trunk-jpl/src/m/solvers/tfqmrsoroptions.m\\
+Export determination: 6. \\
+Rationale: PETSc Itererative solver combinations (i.e. preconditioner and iterative methods). Stick with default solver (i.e. MUMPS) for stability. Try one of the highlighted solvers (from the paper) for a larger model or faster solution. CAUTION: iterative methods are sensitive to boundary conditions (i.e. multipoint constraints can cause convergence problems). Feel free to customize these templates with specific PETSc options.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#344} with diff file ISSM-16902-16903.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: BUG: commented out comment\\
+\vspace{3em}
+
+\noindent \textbf{Change \#345} with diff file ISSM-16903-16904.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp\\
+Export determination: 6. \\
+Rationale: NEW: done with hydrology Shreve\\
+\vspace{3em}
+
+\noindent \textbf{Change \#346} with diff file ISSM-16904-16905.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h M /issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp\\
+Export determination: 6. \\
+Rationale: NEW: KMatrix Hydrology DC Eff\\
+\vspace{3em}
+
+\noindent \textbf{Change \#347} with diff file ISSM-16905-16906.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: in 2d zmin is actually ymin (same for max)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#348} with diff file ISSM-16906-16907.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: cosmetics\\
+\vspace{3em}
+
+\noindent \textbf{Change \#349} with diff file ISSM-16907-16908.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: CHG: moving coupling SSAHO in analysis\\
+\vspace{3em}
+
+\noindent \textbf{Change \#350} with diff file ISSM-16908-16909.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed SSAHO PVector Coupling Viscous\\
+\vspace{3em}
+
+\noindent \textbf{Change \#351} with diff file ISSM-16909-16910.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: added friction in analysis for coupling SSAHO\\
+\vspace{3em}
+
+\noindent \textbf{Change \#352} with diff file ISSM-16910-16911.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.cpp M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: NEW: moving some functions from Tria and Penta to Element.cpp, because these functions do not depend on the type of element\\
+\vspace{3em}
+
+\noindent \textbf{Change \#353} with diff file ISSM-16911-16912.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/Makefile.am\\
+Export determination: 6. \\
+Rationale: BUG: forgot to commit new Makefile.am, which includes Element.cpp\\
+\vspace{3em}
+
+\noindent \textbf{Change \#354} with diff file ISSM-16912-16913.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.cpp M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: NEW: moving more stuff from Tria to Element.cpp\\
+\vspace{3em}
+
+\noindent \textbf{Change \#355} with diff file ISSM-16913-16914.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.cpp M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: CHG: moving stuff to Element.cpp\\
+\vspace{3em}
+
+\noindent \textbf{Change \#356} with diff file ISSM-16914-16915.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: CHG: moved more stuff to Element.cpp\\
+\vspace{3em}
+
+\noindent \textbf{Change \#357} with diff file ISSM-16915-16916.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: CHG: moved more stuff from Tria to Element.cpp\\
+\vspace{3em}
+
+\noindent \textbf{Change \#358} with diff file ISSM-16916-16917.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: CHG: moved more stuff from Tria to Element.cpp\\
+\vspace{3em}
+
+\noindent \textbf{Change \#359} with diff file ISSM-16917-16918.diff: \\
+Function name: \\
+M /issm/trunk-jpl/etc/environment.sh\\
+Export determination: 6. \\
+Rationale: CHG: adapted pathprepend and pathappend to adapt to cygwin conventions.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#360} with diff file ISSM-16918-16919.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: BUG: Changing the initialization of the transfer to deal with single layer hydrology model\\
+\vspace{3em}
+
+\noindent \textbf{Change \#361} with diff file ISSM-16919-16920.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive111.nc M /issm/trunk-jpl/test/Archives/Archive207.nc M /issm/trunk-jpl/test/Archives/Archive209.nc M /issm/trunk-jpl/test/Archives/Archive210.nc M /issm/trunk-jpl/test/Archives/Archive211.nc M /issm/trunk-jpl/test/Archives/Archive224.nc M /issm/trunk-jpl/test/Archives/Archive225.nc M /issm/trunk-jpl/test/Archives/Archive227.nc M /issm/trunk-jpl/test/Archives/Archive232.nc M /issm/trunk-jpl/test/Archives/Archive233.nc M /issm/trunk-jpl/test/Archives/Archive237.nc M /issm/trunk-jpl/test/Archives/Archive315.nc M /issm/trunk-jpl/test/Archives/Archive317.nc M /issm/trunk-jpl/test/Archives/Archive318.nc M /issm/trunk-jpl/test/Archives/Archive324.nc M /issm/trunk-jpl/test/Archives/Archive329.nc M /issm/trunk-jpl/test/Archives/Archive410.nc M /issm/trunk-jpl/test/Archives/Archive411.nc M /issm/trunk-jpl/test/Archives/Archive415.nc M /issm/trunk-jpl/test/Archives/Archive416.nc M /issm/trunk-jpl/test/Archives/Archive505.nc M /issm/trunk-jpl/test/Archives/Archive506.nc M /issm/trunk-jpl/test/Archives/Archive507.nc M /issm/trunk-jpl/test/Archives/Archive508.nc M /issm/trunk-jpl/test/Archives/Archive509.nc M /issm/trunk-jpl/test/Archives/Archive510.nc M /issm/trunk-jpl/test/Archives/Archive513.nc M /issm/trunk-jpl/test/Archives/Archive515.nc\\
+Export determination: 6. \\
+Rationale: CHG: saving archive, changed GaussPenta from 2,3 to 3,3\\
+\vspace{3em}
+
+\noindent \textbf{Change \#362} with diff file ISSM-16920-16921.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/windows\\
+Export determination: 6. \\
+Rationale: CHG: no need for autotools anymore, patched directly\\
+\vspace{3em}
+
+\noindent \textbf{Change \#363} with diff file ISSM-16921-16922.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/test/Archives/Archive121.nc M /issm/trunk-jpl/test/Archives/Archive122.nc M /issm/trunk-jpl/test/Archives/Archive285.nc M /issm/trunk-jpl/test/Archives/Archive325.nc M /issm/trunk-jpl/test/Archives/Archive326.nc M /issm/trunk-jpl/test/Archives/Archive327.nc M /issm/trunk-jpl/test/Archives/Archive333.nc M /issm/trunk-jpl/test/Archives/Archive335.nc M /issm/trunk-jpl/test/Archives/Archive409.nc M /issm/trunk-jpl/test/Archives/Archive426.nc M /issm/trunk-jpl/test/Archives/Archive427.nc M /issm/trunk-jpl/test/Archives/Archive431.nc M /issm/trunk-jpl/test/Archives/Archive432.nc M /issm/trunk-jpl/test/Archives/Archive455.nc M /issm/trunk-jpl/test/Archives/Archive516.nc\\
+Export determination: 6. \\
+Rationale: CHG: switching some gauss points from 2,3 to 3,3\\
+\vspace{3em}
+
+\noindent \textbf{Change \#364} with diff file ISSM-16922-16923.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h\\
+Export determination: 6. \\
+Rationale: CHG: ViscosityFS now requires dim\\
+\vspace{3em}
+
+\noindent \textbf{Change \#365} with diff file ISSM-16923-16924.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/cccl/install-win7.sh\\
+Export determination: 6. \\
+Rationale: CHG: fix permission issue.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#366} with diff file ISSM-16924-16925.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/cccl/install-win7.sh\\
+Export determination: 6. \\
+Rationale: CHG: better level of permission.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#367} with diff file ISSM-16925-16926.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/jenkins.sh\\
+Export determination: 6. \\
+Rationale: CHG: check on compilation return!\\
+\vspace{3em}
+
+\noindent \textbf{Change \#368} with diff file ISSM-16926-16927.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: CHG: keep working on coupling PVectors\\
+\vspace{3em}
+
+\noindent \textbf{Change \#369} with diff file ISSM-16927-16928.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/windows\\
+Export determination: 6. \\
+Rationale: CHG: more cpus on the new machine\\
+\vspace{3em}
+
+\noindent \textbf{Change \#370} with diff file ISSM-16928-16929.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: new FiscosityFS arguents\\
+\vspace{3em}
+
+\noindent \textbf{Change \#371} with diff file ISSM-16929-16930.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: minor\\
+\vspace{3em}
+
+\noindent \textbf{Change \#372} with diff file ISSM-16930-16931.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/shell2junit\\
+Export determination: 6. \\
+Rationale: CHG: get svn to ignore some files.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#373} with diff file ISSM-16931-16932.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp\\
+Export determination: 6. \\
+Rationale: CHG: minor\\
+\vspace{3em}
+
+\noindent \textbf{Change \#374} with diff file ISSM-16932-16933.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp\\
+Export determination: 6. \\
+Rationale: CHG: finished PVector coupling HOFS\\
+\vspace{3em}
+
+\noindent \textbf{Change \#375} with diff file ISSM-16933-16934.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/windows\\
+Export determination: 6. \\
+Rationale: CHG: reverting back to 8 threads.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#376} with diff file ISSM-16934-16935.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/execute\_shell\\
+Export determination: 6. \\
+Rationale: CHG: new execute shell that includes windows build.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#377} with diff file ISSM-16935-16936.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/windows\\
+Export determination: 6. \\
+Rationale: CHG: do not overwhelm the matlab license manager.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#378} with diff file ISSM-16936-16937.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp\\
+Export determination: 6. \\
+Rationale: CHG: KMatric coupling HO viscous\\
+\vspace{3em}
+
+\noindent \textbf{Change \#379} with diff file ISSM-16937-16938.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/runme.m\\
+Export determination: 6. \\
+Rationale: CHG: not needed anymore\\
+\vspace{3em}
+
+\noindent \textbf{Change \#380} with diff file ISSM-16938-16939.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test119.m M /issm/trunk-jpl/test/NightlyRun/test119.py M /issm/trunk-jpl/test/NightlyRun/test215.m M /issm/trunk-jpl/test/NightlyRun/test215.py M /issm/trunk-jpl/test/NightlyRun/test322.m M /issm/trunk-jpl/test/NightlyRun/test322.py M /issm/trunk-jpl/test/NightlyRun/test410.m M /issm/trunk-jpl/test/NightlyRun/test410.py M /issm/trunk-jpl/test/NightlyRun/test415.m M /issm/trunk-jpl/test/NightlyRun/test415.py M /issm/trunk-jpl/test/NightlyRun/test423.m M /issm/trunk-jpl/test/NightlyRun/test423.py M /issm/trunk-jpl/test/NightlyRun/test426.m M /issm/trunk-jpl/test/NightlyRun/test426.py M /issm/trunk-jpl/test/NightlyRun/test501.m M /issm/trunk-jpl/test/NightlyRun/test501.py M /issm/trunk-jpl/test/NightlyRun/test504.m M /issm/trunk-jpl/test/NightlyRun/test504.py M /issm/trunk-jpl/test/NightlyRun/test511.m M /issm/trunk-jpl/test/NightlyRun/test511.py M /issm/trunk-jpl/test/NightlyRun/test514.m M /issm/trunk-jpl/test/NightlyRun/test514.py M /issm/trunk-jpl/test/NightlyRun/test515.m M /issm/trunk-jpl/test/NightlyRun/test515.py M /issm/trunk-jpl/test/NightlyRun/test608.m M /issm/trunk-jpl/test/NightlyRun/test608.py M /issm/trunk-jpl/test/NightlyRun/test610.m M /issm/trunk-jpl/test/NightlyRun/test610.py M /issm/trunk-jpl/test/NightlyRun/test701.m M /issm/trunk-jpl/test/NightlyRun/test702.m\\
+Export determination: 6. \\
+Rationale: CHG: adjusting tolerances.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#381} with diff file ISSM-16939-16940.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: fixed assert.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#382} with diff file ISSM-16940-16941.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h\\
+Export determination: 6. \\
+Rationale: CHG: Added Pvector coupling SSAFS viscous and friction\\
+\vspace{3em}
+
+\noindent \textbf{Change \#383} with diff file ISSM-16941-16942.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test215.py M /issm/trunk-jpl/test/NightlyRun/test508.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxing tolerances on murdo.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#384} with diff file ISSM-16942-16943.diff: \\
+Function name: \\
+M /issm/trunk-jpl/lib M /issm/trunk-jpl/src/c M /issm/trunk-jpl/src/c/analyses M /issm/trunk-jpl/src/c/cores M /issm/trunk-jpl/src/c/toolkits/mpi/commops M /issm/trunk-jpl/src/c/toolkits/petsc/objects M /issm/trunk-jpl/src/c/toolkits/petsc/patches M /issm/trunk-jpl/src/wrappers/matlab\\
+Export determination: 6. \\
+Rationale: CHG: get svn to ignore some files.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#385} with diff file ISSM-16943-16944.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/clusters/generic.m\\
+Export determination: 6. \\
+Rationale: CHG: not allowing parallel runs yet!\\
+\vspace{3em}
+
+\noindent \textbf{Change \#386} with diff file ISSM-16944-16945.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test508.m M /issm/trunk-jpl/test/NightlyRun/test508.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxing tolerances.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#387} with diff file ISSM-16945-16946.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/imac-012301-gil M /issm/trunk-jpl/test/NightlyRun/test101.m M /issm/trunk-jpl/test/NightlyRun/test203.m M /issm/trunk-jpl/test/NightlyRun/test206.m M /issm/trunk-jpl/test/NightlyRun/test209.m M /issm/trunk-jpl/test/NightlyRun/test415.m M /issm/trunk-jpl/test/NightlyRun/test426.m M /issm/trunk-jpl/test/NightlyRun/test427.m M /issm/trunk-jpl/test/NightlyRun/test507.m M /issm/trunk-jpl/test/NightlyRun/test515.m\\
+Export determination: 6. \\
+Rationale: CHG: relaxing tolerances. Not running dakota on imac.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#388} with diff file ISSM-16946-16947.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test508.py\\
+Export determination: 6. \\
+Rationale: CHG: adjusting tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#389} with diff file ISSM-16947-16948.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: New: added support for P0 interpolation results and moved some stuff from Penta to Element.cpp\\
+\vspace{3em}
+
+\noindent \textbf{Change \#390} with diff file ISSM-16948-16949.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/FemModel.cpp\\
+Export determination: 6. \\
+Rationale: BUG: allocate right size in result vector:\\
+\vspace{3em}
+
+\noindent \textbf{Change \#391} with diff file ISSM-16949-16950.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: CHG: moved KMatrix viscous couping SSAFS in analysis\\
+\vspace{3em}
+
+\noindent \textbf{Change \#392} with diff file ISSM-16950-16951.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: minor\\
+\vspace{3em}
+
+\noindent \textbf{Change \#393} with diff file ISSM-16951-16952.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h\\
+Export determination: 6. \\
+Rationale: CHG: starting friction SSAFS\\
+\vspace{3em}
+
+\noindent \textbf{Change \#394} with diff file ISSM-16952-16953.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test290.py M /issm/trunk-jpl/test/NightlyRun/test508.m M /issm/trunk-jpl/test/NightlyRun/test513.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxing tolerances.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#395} with diff file ISSM-16953-16954.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plot\_section.m M /issm/trunk-jpl/src/m/plot/radarpower.m\\
+Export determination: 6. \\
+Rationale: CHG: adding section median and standard deviation if sectionmean requested\\
+\vspace{3em}
+
+\noindent \textbf{Change \#396} with diff file ISSM-16954-16955.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/cores/hydrology\_core.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: CHG: Changing the convergance mecanism in hydro\\
+\vspace{3em}
+
+\noindent \textbf{Change \#397} with diff file ISSM-16955-16956.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: \\
+\vspace{3em}
+
+\noindent \textbf{Change \#398} with diff file ISSM-16956-16957.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: CHG: finished coupling SSAFS\\
+\vspace{3em}
+
+\noindent \textbf{Change \#399} with diff file ISSM-16957-16958.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/os/oshostname.m\\
+Export determination: 6. \\
+Rationale: BUG: safer oshostname, needed to add < /dev/null to avoid wrong name\\
+\vspace{3em}
+
+\noindent \textbf{Change \#400} with diff file ISSM-16958-16959.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/os/oshostname.m\\
+Export determination: 6. \\
+Rationale: CHG: minor, missing ;\\
+\vspace{3em}
+
+\noindent \textbf{Change \#401} with diff file ISSM-16959-16960.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/os/oshostname.m\\
+Export determination: 6. \\
+Rationale: CHG: reverting change for windows machine, where /dev/null obviously does not exist\\
+\vspace{3em}
+
+\noindent \textbf{Change \#402} with diff file ISSM-16960-16961.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing leaks in hydrology\\
+\vspace{3em}
+
+\noindent \textbf{Change \#403} with diff file ISSM-16961-16962.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: fixed leak\\
+\vspace{3em}
+
+\noindent \textbf{Change \#404} with diff file ISSM-16962-16963.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/mesh/bamg.py\\
+Export determination: 6. \\
+Rationale: CHG: fixed section dealing with required vertices.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#405} with diff file ISSM-16963-16964.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: BUG:fixing invalid read in hydro\\
+\vspace{3em}
+
+\noindent \textbf{Change \#406} with diff file ISSM-16964-16965.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: NEW: added some InputUpdateFromSolution\\
+\vspace{3em}
+
+\noindent \textbf{Change \#407} with diff file ISSM-16965-16966.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/Bamg/BigPrimeNumber.cpp\\
+Export determination: 6. \\
+Rationale: CHG: cosmetics\\
+\vspace{3em}
+
+\noindent \textbf{Change \#408} with diff file ISSM-16966-16967.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive119.nc M /issm/trunk-jpl/test/NightlyRun/runme.m M /issm/trunk-jpl/test/NightlyRun/test119.m\\
+Export determination: 6. \\
+Rationale: NEW: added 'rand' option to bamg so that NR tests work on multiple platforms\\
+\vspace{3em}
+
+\noindent \textbf{Change \#409} with diff file ISSM-16967-16968.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/bamg/BamgOpts.cpp M /issm/trunk-jpl/src/c/bamg/BamgOpts.h M /issm/trunk-jpl/src/c/bamg/Mesh.cpp M /issm/trunk-jpl/src/c/bamg/Mesh.h M /issm/trunk-jpl/src/m/mesh/bamg.m M /issm/trunk-jpl/src/m/mesh/bamg.py\\
+Export determination: 6. \\
+Rationale: NEW: added 'rand' option to bamg so that NR tests work on multiple platforms\\
+\vspace{3em}
+
+\noindent \textbf{Change \#410} with diff file ISSM-16968-16969.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/wrappers/matlab/io/FetchMatlabData.cpp M /issm/trunk-jpl/src/wrappers/python/io/FetchPythonData.cpp\\
+Export determination: 6. \\
+Rationale: NEW: added 'rand' option to bamg so that NR tests work on multiple platforms\\
+\vspace{3em}
+
+\noindent \textbf{Change \#411} with diff file ISSM-16969-16970.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/bamg/Mesh.cpp\\
+Export determination: 6. \\
+Rationale: CHG: typo\\
+\vspace{3em}
+
+\noindent \textbf{Change \#412} with diff file ISSM-16970-16971.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test119.py\\
+Export determination: 6. \\
+Rationale: CHG: updated python script\\
+\vspace{3em}
+
+\noindent \textbf{Change \#413} with diff file ISSM-16971-16972.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test334.m\\
+Export determination: 6. \\
+Rationale: CHG: minor, missing ;\\
+\vspace{3em}
+
+\noindent \textbf{Change \#414} with diff file ISSM-16972-16973.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing hydro tests\\
+\vspace{3em}
+
+\noindent \textbf{Change \#415} with diff file ISSM-16973-16974.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed HOFS tiling for friction\\
+\vspace{3em}
+
+\noindent \textbf{Change \#416} with diff file ISSM-16974-16975.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/test/Archives/Archive204.nc M /issm/trunk-jpl/test/Archives/Archive290.nc M /issm/trunk-jpl/test/Archives/Archive322.nc M /issm/trunk-jpl/test/Archives/Archive404.nc M /issm/trunk-jpl/test/Archives/Archive421.nc M /issm/trunk-jpl/test/Archives/Archive422.nc M /issm/trunk-jpl/test/Archives/Archive503.nc M /issm/trunk-jpl/test/Archives/Archive507.nc M /issm/trunk-jpl/test/Archives/Archive510.nc M /issm/trunk-jpl/test/Archives/Archive702.nc\\
+Export determination: 6. \\
+Rationale: CHG: made Gauss point similar in element and analyses\\
+\vspace{3em}
+
+\noindent \textbf{Change \#417} with diff file ISSM-16975-16976.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: making gauss point order similar to element\\
+\vspace{3em}
+
+\noindent \textbf{Change \#418} with diff file ISSM-16976-16977.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: trying to fix SSAFS coupling\\
+\vspace{3em}
+
+\noindent \textbf{Change \#419} with diff file ISSM-16977-16978.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: trying to fix SSAFS\\
+\vspace{3em}
+
+\noindent \textbf{Change \#420} with diff file ISSM-16978-16979.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: no more leaks\\
+\vspace{3em}
+
+\noindent \textbf{Change \#421} with diff file ISSM-16979-16980.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: no more leaks\\
+\vspace{3em}
+
+\noindent \textbf{Change \#422} with diff file ISSM-16980-16981.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: getinput must be called by basalelement\\
+\vspace{3em}
+
+\noindent \textbf{Change \#423} with diff file ISSM-16981-16982.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: missing term in PVector Efficient\\
+\vspace{3em}
+
+\noindent \textbf{Change \#424} with diff file ISSM-16982-16983.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.cpp M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp\\
+Export determination: 6. \\
+Rationale: CHG: use analysis to create P Vector instead of element\\
+\vspace{3em}
+
+\noindent \textbf{Change \#425} with diff file ISSM-16983-16984.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive511.nc M /issm/trunk-jpl/test/Archives/Archive512.nc\\
+Export determination: 6. \\
+Rationale: NEW: updated archives for Pvector created by analysis instead of element\\
+\vspace{3em}
+
+\noindent \textbf{Change \#426} with diff file ISSM-16984-16985.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test3004.m M /issm/trunk-jpl/test/NightlyRun/test3004.py M /issm/trunk-jpl/test/NightlyRun/test3104.m M /issm/trunk-jpl/test/NightlyRun/test3104.py\\
+Export determination: 6. \\
+Rationale: CHG: legitimate relaxation of test tolerances.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#427} with diff file ISSM-16985-16986.diff: \\
+Function name: \\
+A /issm/trunk-jpl/test/NightlyRun/temp291.m\\
+Export determination: 6. \\
+Rationale: NEW: added temporary test for debugging new FS finite element\\
+\vspace{3em}
+
+\noindent \textbf{Change \#428} with diff file ISSM-16986-16987.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: kappa is supposed to be calculated from EnthalpyPicardEnum\\
+\vspace{3em}
+
+\noindent \textbf{Change \#429} with diff file ISSM-16987-16988.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: removing return NULL\\
+\vspace{3em}
+
+\noindent \textbf{Change \#430} with diff file ISSM-16988-16989.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: SSA3d friction needs to be done on basalelement\\
+\vspace{3em}
+
+\noindent \textbf{Change \#431} with diff file ISSM-16989-16990.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/bamg/Mesh.cpp M /issm/trunk-jpl/src/c/classes/kriging/Observations.cpp M /issm/trunk-jpl/src/c/classes/kriging/Quadtree.cpp M /issm/trunk-jpl/src/c/modules/Krigingx/pKrigingx.cpp\\
+Export determination: 6. \\
+Rationale: CHG: fixing some stuff in Kriging\\
+\vspace{3em}
+
+\noindent \textbf{Change \#432} with diff file ISSM-16990-16991.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: SSAHO supposed to call SSA3d and not SSA\\
+\vspace{3em}
+
+\noindent \textbf{Change \#433} with diff file ISSM-16991-16992.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: removed comments\\
+\vspace{3em}
+
+\noindent \textbf{Change \#434} with diff file ISSM-16992-16993.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h M /issm/trunk-jpl/src/c/analyses/Analysis.h M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h M /issm/trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h M /issm/trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.h M /issm/trunk-jpl/src/c/analyses/EnumToAnalysis.h M /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h M /issm/trunk-jpl/src/c/analyses/GiaAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/GiaAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.h M /issm/trunk-jpl/src/c/analyses/MeltingAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MeltingAnalysis.h M /issm/trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.h\\
+Export determination: 6. \\
+Rationale: NEW: added CreateJacobianMatrix to each analysis\\
+\vspace{3em}
+
+\noindent \textbf{Change \#435} with diff file ISSM-16993-16994.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.cpp M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/modules/CreateJacobianMatrixx/CreateJacobianMatrixx.cpp M /issm/trunk-jpl/src/c/modules/CreateJacobianMatrixx/CreateJacobianMatrixx.h M /issm/trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp\\
+Export determination: 6. \\
+Rationale: NEW: moving all Stiffness matrices and Jacobian matrices to analyses\\
+\vspace{3em}
+
+\noindent \textbf{Change \#436} with diff file ISSM-16994-16995.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed memory leak\\
+\vspace{3em}
+
+\noindent \textbf{Change \#437} with diff file ISSM-16995-16996.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed memory leak\\
+\vspace{3em}
+
+\noindent \textbf{Change \#438} with diff file ISSM-16996-16997.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: CHG: cleaning up\\
+\vspace{3em}
+
+\noindent \textbf{Change \#439} with diff file ISSM-16997-16998.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed memory leak\\
+\vspace{3em}
+
+\noindent \textbf{Change \#440} with diff file ISSM-16998-16999.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test3104.m\\
+Export determination: 6. \\
+Rationale: CHG: relaxing tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#441} with diff file ISSM-16999-17000.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing invalid write\\
+\vspace{3em}
+
+\noindent \textbf{Change \#442} with diff file ISSM-17000-17001.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h M /issm/trunk-jpl/src/c/analyses/Analysis.h M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h M /issm/trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h M /issm/trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.h M /issm/trunk-jpl/src/c/analyses/EnumToAnalysis.h M /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h M /issm/trunk-jpl/src/c/analyses/GiaAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/GiaAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.h M /issm/trunk-jpl/src/c/analyses/MeltingAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MeltingAnalysis.h M /issm/trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.h\\
+Export determination: 6. \\
+Rationale: NEW: added CreateDVector in all analyses\\
+\vspace{3em}
+
+\noindent \textbf{Change \#443} with diff file ISSM-17001-17002.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp\\
+Export determination: 6. \\
+Rationale: CHG: moving DVector to analysis\\
+\vspace{3em}
+
+\noindent \textbf{Change \#444} with diff file ISSM-17002-17003.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.h\\
+Export determination: 6. \\
+Rationale: CHG: trying to add EnthalpyPostProcessing back to EnthalpyAnalysis.cpp\\
+\vspace{3em}
+
+\noindent \textbf{Change \#445} with diff file ISSM-17003-17004.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/interp/export\_geotif.m\\
+Export determination: 6. \\
+Rationale: CHG: export geotif\\
+\vspace{3em}
+
+\noindent \textbf{Change \#446} with diff file ISSM-17004-17005.diff: \\
+Function name: \\
+D /issm/trunk-jpl/src/m/interp/export\_geotif.m A /issm/trunk-jpl/src/m/print/export\_geotiff.m (from /issm/trunk-jpl/src/m/interp/export\_geotif.m:17003)\\
+Export determination: 6. \\
+Rationale: CHG: moved print/export\_geotiff.m\\
+\vspace{3em}
+
+\noindent \textbf{Change \#447} with diff file ISSM-17005-17006.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h M /issm/trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h M /issm/trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.h M /issm/trunk-jpl/src/c/analyses/EnumToAnalysis.h M /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h M /issm/trunk-jpl/src/c/analyses/GiaAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/GiaAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.h M /issm/trunk-jpl/src/c/analyses/MeltingAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MeltingAnalysis.h M /issm/trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.h\\
+Export determination: 6. \\
+Rationale: NEW: adding cores\\
+\vspace{3em}
+
+\noindent \textbf{Change \#448} with diff file ISSM-17006-17007.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: BUG: modification in the way the transfer deals with its mask\\
+\vspace{3em}
+
+\noindent \textbf{Change \#449} with diff file ISSM-17007-17008.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Vertex.cpp\\
+Export determination: 6. \\
+Rationale: BUG: do not change z for 2d horizontal meshes\\
+\vspace{3em}
+
+\noindent \textbf{Change \#450} with diff file ISSM-17008-17009.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test209.py M /issm/trunk-jpl/test/NightlyRun/test290.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxing tolerances of python tests\\
+\vspace{3em}
+
+\noindent \textbf{Change \#451} with diff file ISSM-17009-17010.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/Analysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp M /issm/trunk-jpl/src/c/cores/stressbalance\_core.cpp\\
+Export determination: 6. \\
+Rationale: NEW: moving some cores to analyses\\
+\vspace{3em}
+
+\noindent \textbf{Change \#452} with diff file ISSM-17010-17011.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp M /issm/trunk-jpl/src/c/cores/stressbalance\_core.cpp\\
+Export determination: 6. \\
+Rationale: BUG: vertical velocities should not be calculated in StressbalanceAnalysis\\
+\vspace{3em}
+
+\noindent \textbf{Change \#453} with diff file ISSM-17011-17012.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test119.m M /issm/trunk-jpl/test/NightlyRun/test119.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxed bamg tolerance\\
+\vspace{3em}
+
+\noindent \textbf{Change \#454} with diff file ISSM-17012-17013.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/cores/hydrology\_core.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing the update of eplthickness\\
+\vspace{3em}
+
+\noindent \textbf{Change \#455} with diff file ISSM-17013-17014.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive333.nc M /issm/trunk-jpl/test/Archives/Archive335.nc\\
+Export determination: 6. \\
+Rationale: CHG: updated Hydro archives\\
+\vspace{3em}
+
+\noindent \textbf{Change \#456} with diff file ISSM-17014-17015.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: CHG: filled EnthalpyAnalysis::ComputeBasalMeltingrate with content. ADD: GetUpperElement, ThermalToEnthalpy for parent class Element*.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#457} with diff file ISSM-17015-17016.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed compilation error (Johannes, make sure you have --enable-debugging in your configure.sh)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#458} with diff file ISSM-17017-17018.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp\\
+Export determination: 6. \\
+Rationale: NEW: moving Eike and Pierre's modifs from trunk to trunk-jpl\\
+\vspace{3em}
+
+\noindent \textbf{Change \#459} with diff file ISSM-17018-17019.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/P1xP3Enum.m A /issm/trunk-jpl/src/m/enum/P2xP4Enum.m\\
+Export determination: 6. \\
+Rationale: NEW: moving Eike and Pierre's modifs from trunk to trunk-jpl\\
+\vspace{3em}
+
+\noindent \textbf{Change \#460} with diff file ISSM-17019-17020.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test3104.m\\
+Export determination: 6. \\
+Rationale: CHG: relaxing tolerance, after commit shows impact beyond numerics\\
+\vspace{3em}
+
+\noindent \textbf{Change \#461} with diff file ISSM-17020-17021.diff: \\
+Function name: \\
+D /issm/trunk-jpl/src/m/enum/HydrologydcMaskEplactiveEnum.m\\
+Export determination: 6. \\
+Rationale: BUG: removing an old enum\\
+\vspace{3em}
+
+\noindent \textbf{Change \#462} with diff file ISSM-17021-17022.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matpar.h M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: CHG:the sediment transmitivity is now a mat and no more a constant\\
+\vspace{3em}
+
+\noindent \textbf{Change \#463} with diff file ISSM-17022-17023.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/hydrologydc.m M /issm/trunk-jpl/src/m/classes/model.m\\
+Export determination: 6. \\
+Rationale: CHG:the sediment transmitivity is now a mat and no more a constant\\
+\vspace{3em}
+
+\noindent \textbf{Change \#464} with diff file ISSM-17023-17024.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test332.m M /issm/trunk-jpl/test/NightlyRun/test333.m M /issm/trunk-jpl/test/NightlyRun/test334.m M /issm/trunk-jpl/test/NightlyRun/test335.m\\
+Export determination: 6. \\
+Rationale: CHG:the sediment transmitivity is now a mat and no more a constant\\
+\vspace{3em}
+
+\noindent \textbf{Change \#465} with diff file ISSM-17024-17025.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: CHG: new solution sequence hydrology BUG:adding delete in efficient analysis\\
+\vspace{3em}
+
+\noindent \textbf{Change \#466} with diff file ISSM-17025-17026.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive333.nc M /issm/trunk-jpl/test/Archives/Archive335.nc\\
+Export determination: 6. \\
+Rationale: CHG: updated Hydro DC Archive per Basile's request\\
+\vspace{3em}
+
+\noindent \textbf{Change \#467} with diff file ISSM-17026-17027.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/shp/Shp2Exp.m\\
+Export determination: 6. \\
+Rationale: CHG: added support for line shapefiles\\
+\vspace{3em}
+
+\noindent \textbf{Change \#468} with diff file ISSM-17027-17028.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/cores/thermal\_core.cpp M /issm/trunk-jpl/src/c/shared/Elements/LliboutryDuval.cpp M /issm/trunk-jpl/src/m/materials/arrhenius.m\\
+Export determination: 6. \\
+Rationale: CHG: moved ComputeBasalMeltingrate and UpdateBasalConstraints to EnthalpyAnalysis. Minor fixes to the LliboutryDuval rheology.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#469} with diff file ISSM-17028-17029.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/Makefile.am M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.h D /issm/trunk-jpl/src/c/modules/PostprocessingEnthalpyx M /issm/trunk-jpl/src/c/modules/modules.h\\
+Export determination: 6. \\
+Rationale: DEL: UpdateBasalConstraintsEnthalpy, ComputeBasalMeltingrate and DrainWaterfraction from Element and its children. DEL: module PostprocessingEnthalpyx\\
+\vspace{3em}
+
+\noindent \textbf{Change \#470} with diff file ISSM-17029-17030.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: fixed Postprocessing of Enthalpy\\
+\vspace{3em}
+
+\noindent \textbf{Change \#471} with diff file ISSM-17030-17031.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: CHG: uniformisation of the mask gestion in Hydrology\\
+\vspace{3em}
+
+\noindent \textbf{Change \#472} with diff file ISSM-17031-17032.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: BUG: commenting printf\\
+\vspace{3em}
+
+\noindent \textbf{Change \#473} with diff file ISSM-17032-17033.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: BUG: commenting printf\\
+\vspace{3em}
+
+\noindent \textbf{Change \#474} with diff file ISSM-17033-17034.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: BUG: missing commented bracket\\
+\vspace{3em}
+
+\noindent \textbf{Change \#475} with diff file ISSM-17034-17035.diff: \\
+Function name: \\
+A /issm/trunk-jpl/test/NightlyRun/temp291.py\\
+Export determination: 6. \\
+Rationale: NEW: added temp291.py\\
+\vspace{3em}
+
+\noindent \textbf{Change \#476} with diff file ISSM-17035-17036.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/groundingline.m M /issm/trunk-jpl/src/m/classes/groundingline.py\\
+Export determination: 6. \\
+Rationale: CHG: better check on bathymetry and bed.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#477} with diff file ISSM-17036-17037.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/groundingline.py\\
+Export determination: 6. \\
+Rationale: CHG: better construct from Chris\\
+\vspace{3em}
+
+\noindent \textbf{Change \#478} with diff file ISSM-17037-17038.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/groundingline.m M /issm/trunk-jpl/src/m/classes/groundingline.py\\
+Export determination: 6. \\
+Rationale: BUG: fixing grounding line check (nothing was checked anymore...)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#479} with diff file ISSM-17038-17039.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/OneLayerP4zEnum.m\\
+Export determination: 6. \\
+Rationale: NEW: Added new Stokes element: OneLayerP4zEnum\\
+\vspace{3em}
+
+\noindent \textbf{Change \#480} with diff file ISSM-17039-17040.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim\\
+Export determination: 6. \\
+Rationale: CHG: sync'ed syntax with Enums\\
+\vspace{3em}
+
+\noindent \textbf{Change \#481} with diff file ISSM-17040-17041.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/flowequation.m M /issm/trunk-jpl/src/m/classes/flowequation.py M /issm/trunk-jpl/test/NightlyRun/temp291.m M /issm/trunk-jpl/test/NightlyRun/temp291.py\\
+Export determination: 6. \\
+Rationale: NEW: added OneLayerP4z for fe\_FS\\
+\vspace{3em}
+
+\noindent \textbf{Change \#482} with diff file ISSM-17041-17042.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/gauss/GaussPenta.cpp M /issm/trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp M /issm/trunk-jpl/src/m/classes/flowequation.m M /issm/trunk-jpl/src/m/classes/flowequation.py\\
+Export determination: 6. \\
+Rationale: NEW: working on P1xP3 element (needs some debugging)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#483} with diff file ISSM-17042-17043.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp\\
+Export determination: 6. \\
+Rationale: CHG: minor constraint indexing\\
+\vspace{3em}
+
+\noindent \textbf{Change \#484} with diff file ISSM-17043-17044.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing some nodal function derivatives P1xP3\\
+\vspace{3em}
+
+\noindent \textbf{Change \#485} with diff file ISSM-17044-17045.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing another sign in P1P3 nodal function derivatives\\
+\vspace{3em}
+
+\noindent \textbf{Change \#486} with diff file ISSM-17045-17046.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/cores/thermal\_core.cpp\\
+Export determination: 6. \\
+Rationale: BUG basal conditions corrected\\
+\vspace{3em}
+
+\noindent \textbf{Change \#487} with diff file ISSM-17046-17047.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: windows build broke because dim was not declared a constant.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#488} with diff file ISSM-17047-17048.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: CHG: added MisfitArea function\\
+\vspace{3em}
+
+\noindent \textbf{Change \#489} with diff file ISSM-17048-17049.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Misfit.h\\
+Export determination: 6. \\
+Rationale: CHG: added MisfitArea.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#490} with diff file ISSM-17049-17050.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/solve/waitonlock.m\\
+Export determination: 6. \\
+Rationale: CHG: some changes for the lock and output file names\\
+\vspace{3em}
+
+\noindent \textbf{Change \#491} with diff file ISSM-17050-17051.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/solve/marshall.m M /issm/trunk-jpl/src/m/solve/solve.m\\
+Export determination: 6. \\
+Rationale: CHG: control verbosing.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#492} with diff file ISSM-17051-17052.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/friction.m M /issm/trunk-jpl/src/m/classes/friction.py\\
+Export determination: 6. \\
+Rationale: CHG: make coefficient a forcing.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#493} with diff file ISSM-17052-17053.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/clusters/generic.m\\
+Export determination: 6. \\
+Rationale: CHG: control verbose level of generic cluster\\
+\vspace{3em}
+
+\noindent \textbf{Change \#494} with diff file ISSM-17053-17054.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/misfit.m\\
+Export determination: 6. \\
+Rationale: CHG: makes weights a transient input.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#495} with diff file ISSM-17054-17055.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/solvers/gcrbjacobioptions.m\\
+Export determination: 6. \\
+Rationale: CHG: fixed broken solver class.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#496} with diff file ISSM-17055-17056.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp M /issm/trunk-jpl/src/c/modules/OutputResultsx/OutputResultsx.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_newton.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_nonlinear.cpp M /issm/trunk-jpl/src/m/solve/parseresultsfromdisk.m\\
+Export determination: 6. \\
+Rationale: CHG: make sure that start time is the one set in timestepping, not 0.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#497} with diff file ISSM-17056-17057.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed final nodal function derivatives P1xP3\\
+\vspace{3em}
+
+\noindent \textbf{Change \#498} with diff file ISSM-17057-17058.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/gauss/GaussPenta.cpp M /issm/trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp\\
+Export determination: 6. \\
+Rationale: NEW: working on P2xP4 finite elements\\
+\vspace{3em}
+
+\noindent \textbf{Change \#499} with diff file ISSM-17058-17059.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.cpp\\
+Export determination: 6. \\
+Rationale: Fixed several errors in the derivatives of the P2xP4 Element.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#500} with diff file ISSM-17059-17060.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/windows M /issm/trunk-jpl/src/m/solvers/gmresjacobioptions.m M /issm/trunk-jpl/test/NightlyRun/test332.m M /issm/trunk-jpl/test/NightlyRun/test334.m\\
+Export determination: 6. \\
+Rationale: CHG: relaxed tolerances for windows tests on 334 and 332. For Windows runs, no MUMPS yet, so can't do the FS runs, exclude these from the nightlys. gmresjacobioptions: need to convert all the solvers to the new IssmConfig format.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#501} with diff file ISSM-17060-17061.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/windows M /issm/trunk-jpl/packagers/win7/package32.sh M /issm/trunk-jpl/packagers/win7/package64.sh M /issm/trunk-jpl/test/NightlyRun/test216.m M /issm/trunk-jpl/test/NightlyRun/test314.m M /issm/trunk-jpl/test/NightlyRun/test315.m M /issm/trunk-jpl/test/NightlyRun/test318.m M /issm/trunk-jpl/test/NightlyRun/test324.m M /issm/trunk-jpl/test/NightlyRun/test328.m M /issm/trunk-jpl/test/NightlyRun/test333.m M /issm/trunk-jpl/test/NightlyRun/test335.m M /issm/trunk-jpl/test/NightlyRun/test410.m M /issm/trunk-jpl/test/NightlyRun/test423.m M /issm/trunk-jpl/test/NightlyRun/test505.m\\
+Export determination: 6. \\
+Rationale: CHG: exclude dakota runs in windows nightlys. packagers: update old scripts using the new Caphyon installer. Get rid of some obsolete target files. tests: relax tolerances for tests to run succesfully on Windows platforms.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#502} with diff file ISSM-17061-17062.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/windows\\
+Export determination: 6. \\
+Rationale: CHG: new windows tests that do not carry higher order dynamics or penalties, as our solvers can't take that yet\\
+\vspace{3em}
+
+\noindent \textbf{Change \#503} with diff file ISSM-17062-17063.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing constraints on P2xP4\\
+\vspace{3em}
+
+\noindent \textbf{Change \#504} with diff file ISSM-17063-17064.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp\\
+Export determination: 6. \\
+Rationale: NEW: creating FS One layer nodes\\
+\vspace{3em}
+
+\noindent \textbf{Change \#505} with diff file ISSM-17064-17065.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/FemModel.cpp M /issm/trunk-jpl/src/c/classes/FemModel.h M /issm/trunk-jpl/src/c/cores/transient\_core.cpp\\
+Export determination: 6. \\
+Rationale: CHG: changed the logic in the transient core so that: 1/ final time does always output the results. 2/ results are output at output\_frequency, unless these results are coming from a complicated output definition, in which case, for each transient time step, the result is computed, and only output at the requested output frequency.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#506} with diff file ISSM-17065-17066.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp\\
+Export determination: 6. \\
+Rationale: CHG: putting together FS OneLayerz4 formulation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#507} with diff file ISSM-17066-17067.diff: \\
+Function name: \\
+A /issm/trunk-jpl/externalpackages/cython/install-18.sh (from /issm/trunk-jpl/externalpackages/cython/install.sh:17065) A /issm/trunk-jpl/externalpackages/cython/install-19.2.sh D /issm/trunk-jpl/externalpackages/cython/install.sh\\
+Export determination: 6. \\
+Rationale: CHG: new version of cython.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#508} with diff file ISSM-17067-17068.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/windows\\
+Export determination: 6. \\
+Rationale: CHG: excluding tests 612 (discontinuous control method, unstable) and the Bamg Mesh test (which can only be run on larsen).\\
+\vspace{3em}
+
+\noindent \textbf{Change \#509} with diff file ISSM-17068-17069.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Misfit.h\\
+Export determination: 6. \\
+Rationale: CHG: make sure when area is nill that our misfit is nill too.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#510} with diff file ISSM-17069-17070.diff: \\
+Function name: \\
+M /issm/trunk-jpl/examples/Jakobshavn/Jks.par M /issm/trunk-jpl/examples/Jakobshavn/runme.m M /issm/trunk-jpl/examples/SquareIceShelf/Square.par\\
+Export determination: 6. \\
+Rationale: BUG: fixing tutorials with new damage field\\
+\vspace{3em}
+
+\noindent \textbf{Change \#511} with diff file ISSM-17070-17071.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.cpp\\
+Export determination: 6. \\
+Rationale: CHG: minor cosmetics\\
+\vspace{3em}
+
+\noindent \textbf{Change \#512} with diff file ISSM-17071-17072.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/boundaryconditions/SetIceSheetBC.m M /issm/trunk-jpl/src/m/boundaryconditions/SetIceSheetBC.py M /issm/trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.m M /issm/trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py M /issm/trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.m M /issm/trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py M /issm/trunk-jpl/src/m/classes/basalforcings.m M /issm/trunk-jpl/src/m/classes/basalforcings.py M /issm/trunk-jpl/src/m/classes/surfaceforcings.m M /issm/trunk-jpl/src/m/classes/surfaceforcings.py\\
+Export determination: 6. \\
+Rationale: NEW: initialize forcings by class itself instead of boundary condition method\\
+\vspace{3em}
+
+\noindent \textbf{Change \#513} with diff file ISSM-17072-17073.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp M /issm/trunk-jpl/src/c/cores/masstransport\_core.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp A /issm/trunk-jpl/src/m/classes/SMB.m M /issm/trunk-jpl/src/m/classes/surfaceforcings.m M /issm/trunk-jpl/src/m/classes/surfaceforcings.py M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py\\
+Export determination: 6. \\
+Rationale: NEW: working on SMB new class for surface mass balance\\
+\vspace{3em}
+
+\noindent \textbf{Change \#514} with diff file ISSM-17073-17074.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/enum/SMBEnum.m A /issm/trunk-jpl/src/m/enum/SurfaceforcingsEnum.m\\
+Export determination: 6. \\
+Rationale: NEW: syncing enums\\
+\vspace{3em}
+
+\noindent \textbf{Change \#515} with diff file ISSM-17074-17075.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/SMB.m A /issm/trunk-jpl/src/m/classes/SMB.py M /issm/trunk-jpl/src/m/classes/model.py\\
+Export determination: 6. \\
+Rationale: NEW: added python's equivalent of SMB class\\
+\vspace{3em}
+
+\noindent \textbf{Change \#516} with diff file ISSM-17075-17076.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/cython/install-19.2.sh M /issm/trunk-jpl/externalpackages/git/install.sh M /issm/trunk-jpl/externalpackages/nose/install-linux64-python2.sh M /issm/trunk-jpl/externalpackages/petsc/install-3.4-linux64.sh M /issm/trunk-jpl/externalpackages/python/install-2.7.3-linux64.sh M /issm/trunk-jpl/externalpackages/scipy/install-linux64.sh M /issm/trunk-jpl/src/c/Makefile.am M /issm/trunk-jpl/src/c/analyses/EnumToAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/analyses/analyses.h M /issm/trunk-jpl/src/c/cores/AnalysisConfiguration.cpp M /issm/trunk-jpl/src/c/cores/transient\_core.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/classes/transient.m M /issm/trunk-jpl/src/m/classes/transient.py M /issm/trunk-jpl/src/m/dev/devpath.py M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py\\
+Export determination: 6. \\
+Rationale: ADD: Shell for Level-Set Method\\
+\vspace{3em}
+
+\noindent \textbf{Change \#517} with diff file ISSM-17076-17077.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp A /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.h\\
+Export determination: 6. \\
+Rationale: ADD: Shell for Level-Set Method pt. 2\\
+\vspace{3em}
+
+\noindent \textbf{Change \#518} with diff file ISSM-17077-17078.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/cython/install-19.2.sh M /issm/trunk-jpl/externalpackages/git/install.sh M /issm/trunk-jpl/externalpackages/nose/install-linux64-python2.sh M /issm/trunk-jpl/externalpackages/petsc/install-3.4-linux64.sh M /issm/trunk-jpl/externalpackages/python/install-2.7.3-linux64.sh M /issm/trunk-jpl/externalpackages/scipy/install-linux64.sh\\
+Export determination: 6. \\
+Rationale: CHG: restoring corrupted install scripts for externalpackages\\
+\vspace{3em}
+
+\noindent \textbf{Change \#519} with diff file ISSM-17078-17079.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp M /issm/trunk-jpl/src/c/cores/masstransport\_core.cpp M /issm/trunk-jpl/src/c/cores/transient\_core.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp A /issm/trunk-jpl/src/m/classes/SMBgradients.m A /issm/trunk-jpl/src/m/classes/SMBgradients.py A /issm/trunk-jpl/src/m/classes/SMBpdd.m A /issm/trunk-jpl/src/m/classes/SMBpdd.py M /issm/trunk-jpl/src/m/classes/model.py M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/LevelsetAnalysisEnum.m A /issm/trunk-jpl/src/m/enum/SMBgradientsEnum.m A /issm/trunk-jpl/src/m/enum/SMBpddEnum.m A /issm/trunk-jpl/src/m/enum/TransientIslevelsetEnum.m\\
+Export determination: 6. \\
+Rationale: NEW: added 2 more SMB classes\\
+\vspace{3em}
+
+\noindent \textbf{Change \#520} with diff file ISSM-17079-17080.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/SMB.m M /issm/trunk-jpl/src/m/classes/SMB.py M /issm/trunk-jpl/src/m/classes/SMBgradients.m M /issm/trunk-jpl/src/m/classes/SMBgradients.py M /issm/trunk-jpl/src/m/classes/SMBpdd.m M /issm/trunk-jpl/src/m/classes/SMBpdd.py M /issm/trunk-jpl/src/m/classes/model.m M /issm/trunk-jpl/src/m/classes/model.py M /issm/trunk-jpl/src/m/classes/oldclasses/README M /issm/trunk-jpl/src/m/classes/oldclasses/diagnostic.m M /issm/trunk-jpl/src/m/classes/oldclasses/hydrology.m M /issm/trunk-jpl/src/m/classes/oldclasses/prognostic.m A /issm/trunk-jpl/src/m/classes/oldclasses/surfaceforcings.m (from /issm/trunk-jpl/src/m/classes/surfaceforcings.m:17078) D /issm/trunk-jpl/src/m/classes/surfaceforcings.m D /issm/trunk-jpl/src/m/classes/surfaceforcings.py M /issm/trunk-jpl/src/m/classes/transient.m M /issm/trunk-jpl/src/m/classes/transient.py\\
+Export determination: 6. \\
+Rationale: NEW: deleted surfaceforcings class, now users need to decide what surfaceforcings class they want to use (SMB, SMBgradients, SMBpdd and more to come)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#521} with diff file ISSM-17080-17081.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp M /issm/trunk-jpl/src/c/cores/masstransport\_core.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp\\
+Export determination: 6. \\
+Rationale: CHG: cleaning up surface forcings, not needed anymore\\
+\vspace{3em}
+
+\noindent \textbf{Change \#522} with diff file ISSM-17081-17082.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test236.m M /issm/trunk-jpl/test/NightlyRun/test236.py M /issm/trunk-jpl/test/NightlyRun/test237.m M /issm/trunk-jpl/test/NightlyRun/test237.py M /issm/trunk-jpl/test/NightlyRun/test328.m M /issm/trunk-jpl/test/NightlyRun/test328.py M /issm/trunk-jpl/test/NightlyRun/test329.m M /issm/trunk-jpl/test/NightlyRun/test329.py\\
+Export determination: 6. \\
+Rationale: CHG: fixing NR with new SMB classes\\
+\vspace{3em}
+
+\noindent \textbf{Change \#523} with diff file ISSM-17082-17083.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test236.m M /issm/trunk-jpl/test/NightlyRun/test236.py\\
+Export determination: 6. \\
+Rationale: BUG: fixing test\\
+\vspace{3em}
+
+\noindent \textbf{Change \#524} with diff file ISSM-17083-17084.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: free surfaces should not try to get the SMB unless smb\_model = SMBEnum\\
+\vspace{3em}
+
+\noindent \textbf{Change \#525} with diff file ISSM-17084-17085.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test237.m M /issm/trunk-jpl/test/NightlyRun/test237.py\\
+Export determination: 6. \\
+Rationale: BUG: adding outputs to results\\
+\vspace{3em}
+
+\noindent \textbf{Change \#526} with diff file ISSM-17085-17086.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/Makefile.am M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp M /issm/trunk-jpl/src/c/cores/masstransport\_core.cpp D /issm/trunk-jpl/src/c/modules/Delta18oParameterizationx M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp D /issm/trunk-jpl/src/c/modules/PositiveDegreeDayx D /issm/trunk-jpl/src/c/modules/SmbGradientsx A /issm/trunk-jpl/src/c/modules/SurfaceMassBalancex A /issm/trunk-jpl/src/c/modules/SurfaceMassBalancex/.deps A /issm/trunk-jpl/src/c/modules/SurfaceMassBalancex/.deps/SurfaceMassBalancex.Plo A /issm/trunk-jpl/src/c/modules/SurfaceMassBalancex/.deps/libISSMCore\_a-SurfaceMassBalancex.Po A /issm/trunk-jpl/src/c/modules/SurfaceMassBalancex/.deps/libISSMRose\_a-SurfaceMassBalancex.r2cpp.Po A /issm/trunk-jpl/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.cpp A /issm/trunk-jpl/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.h M /issm/trunk-jpl/src/c/modules/modules.h M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp\\
+Export determination: 6. \\
+Rationale: CHG: merging all SMB modules into one for simplicity\\
+\vspace{3em}
+
+\noindent \textbf{Change \#527} with diff file ISSM-17086-17087.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/classes/SMBhenning.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/SMBhenningEnum.m\\
+Export determination: 6. \\
+Rationale: CHG: syncing enums\\
+\vspace{3em}
+
+\noindent \textbf{Change \#528} with diff file ISSM-17087-17088.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.cpp M /issm/trunk-jpl/src/m/classes/SMBhenning.m\\
+Export determination: 6. \\
+Rationale: NEW: added SMBhenning fonction, to be completed by Henning (dummy for now)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#529} with diff file ISSM-17088-17089.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive119.nc M /issm/trunk-jpl/test/NightlyRun/test119.m M /issm/trunk-jpl/test/NightlyRun/test119.py\\
+Export determination: 6. \\
+Rationale: BUG: fixing bamg test for different OSs\\
+\vspace{3em}
+
+\noindent \textbf{Change \#530} with diff file ISSM-17089-17090.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/model.py\\
+Export determination: 6. \\
+Rationale: BUG: no more surfaceforcings\\
+\vspace{3em}
+
+\noindent \textbf{Change \#531} with diff file ISSM-17090-17091.diff: \\
+Function name: \\
+D /issm/trunk-jpl/test/Archives/Archive331.nc D /issm/trunk-jpl/test/Archives/Archive612.nc M /issm/trunk-jpl/test/NightlyRun/IdToName.m M /issm/trunk-jpl/test/NightlyRun/IdToName.py D /issm/trunk-jpl/test/NightlyRun/test331.m D /issm/trunk-jpl/test/NightlyRun/test331.py D /issm/trunk-jpl/test/NightlyRun/test612.m D /issm/trunk-jpl/test/NightlyRun/test612.py\\
+Export determination: 6. \\
+Rationale: CHG: removing Shreve test and CM Balance thickness DG, which both fail randomly\\
+\vspace{3em}
+
+\noindent \textbf{Change \#532} with diff file ISSM-17091-17092.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/runme.m\\
+Export determination: 6. \\
+Rationale: CHG: print error message under Jenkins too\\
+\vspace{3em}
+
+\noindent \textbf{Change \#533} with diff file ISSM-17092-17093.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/SurfaceMassBalancex D /issm/trunk-jpl/src/c/modules/SurfaceMassBalancex/.deps\\
+Export determination: 6. \\
+Rationale: DEL: do not add .deps under svn\\
+\vspace{3em}
+
+\noindent \textbf{Change \#534} with diff file ISSM-17093-17094.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp\\
+Export determination: 6. \\
+Rationale: CHG: simplifying strain rate computation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#535} with diff file ISSM-17094-17095.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Inputs/BoolInput.h M /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.h M /issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.h M /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.h M /issm/trunk-jpl/src/c/classes/Inputs/Input.h M /issm/trunk-jpl/src/c/classes/Inputs/IntInput.h M /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.h M /issm/trunk-jpl/src/c/classes/Inputs/SegInput.h M /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.h M /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.h\\
+Export determination: 6. \\
+Rationale: DEL: cleaning up Strain rate computation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#536} with diff file ISSM-17095-17096.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.cpp M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.h M /issm/trunk-jpl/src/c/classes/Elements/TriaRef.cpp M /issm/trunk-jpl/src/c/classes/Elements/TriaRef.h\\
+Export determination: 6. \\
+Rationale: CHG: cleaning up reference elements\\
+\vspace{3em}
+
+\noindent \textbf{Change \#537} with diff file ISSM-17096-17097.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: keep solution on the same finite element (commented out for now)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#538} with diff file ISSM-17097-17098.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.cpp\\
+Export determination: 6. \\
+Rationale: NEW: added basal node indices for P2xP4\\
+\vspace{3em}
+
+\noindent \textbf{Change \#539} with diff file ISSM-17098-17099.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.h M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py\\
+Export determination: 6. \\
+Rationale: CHG: LevelsetAnalysis::CreateKMatrix and CreatePVector filled, required enums added\\
+\vspace{3em}
+
+\noindent \textbf{Change \#540} with diff file ISSM-17099-17100.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.cpp\\
+Export determination: 6. \\
+Rationale: BUG: do not return, just break\\
+\vspace{3em}
+
+\noindent \textbf{Change \#541} with diff file ISSM-17100-17101.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/FemModel.cpp M /issm/trunk-jpl/src/c/classes/Inputs/BoolInput.h M /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.h M /issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.h M /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.h M /issm/trunk-jpl/src/c/classes/Inputs/Input.h M /issm/trunk-jpl/src/c/classes/Inputs/IntInput.h M /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.h M /issm/trunk-jpl/src/c/classes/Inputs/SegInput.h M /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.h M /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.h M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/classes/settings.m M /issm/trunk-jpl/src/m/classes/settings.py M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/SettingsResultsOnNodesEnum.m\\
+Export determination: 6. \\
+Rationale: NEW: added results as patch so that we can have nodal values\\
+\vspace{3em}
+
+\noindent \textbf{Change \#542} with diff file ISSM-17101-17102.diff: \\
+Function name: \\
+A /issm/trunk-jpl/externalpackages/cython/install.sh (from /issm/trunk-jpl/externalpackages/cython/install.sh:15675)\\
+Export determination: 6. \\
+Rationale: CHG: Install script now clones directly from main development branch. This was done in order to stay consistent with SciPy.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#543} with diff file ISSM-17102-17103.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/FemModel.cpp M /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.h M /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp\\
+Export determination: 6. \\
+Rationale: CHG: preparing output on nodes for FS\\
+\vspace{3em}
+
+\noindent \textbf{Change \#544} with diff file ISSM-17103-17104.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: NEW: making Stress balance analysis work with md.settings.results\_on\_nodes=1\\
+\vspace{3em}
+
+\noindent \textbf{Change \#545} with diff file ISSM-17104-17105.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp\\
+Export determination: 6. \\
+Rationale: CHG: fixing node numbering for OneLayerP4z elements\\
+\vspace{3em}
+
+\noindent \textbf{Change \#546} with diff file ISSM-17105-17106.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/model.py\\
+Export determination: 6. \\
+Rationale: ADD: minor: extrusion of md.initialization.watercolumn\\
+\vspace{3em}
+
+\noindent \textbf{Change \#547} with diff file ISSM-17106-17107.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp M /issm/trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp\\
+Export determination: 6. \\
+Rationale: CHG: use id0 instead of iomodel->nodecounter\\
+\vspace{3em}
+
+\noindent \textbf{Change \#548} with diff file ISSM-17107-17108.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp\\
+Export determination: 6. \\
+Rationale: REV: reverting back to previous version\\
+\vspace{3em}
+
+\noindent \textbf{Change \#549} with diff file ISSM-17108-17109.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: reverting back (again...)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#550} with diff file ISSM-17109-17110.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscMat.cpp\\
+Export determination: 6. \\
+Rationale: NEW: starting to add analytical functions for FS\\
+\vspace{3em}
+
+\noindent \textbf{Change \#551} with diff file ISSM-17110-17111.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscMat.cpp\\
+Export determination: 6. \\
+Rationale: BUG: wrong petsc option\\
+\vspace{3em}
+
+\noindent \textbf{Change \#552} with diff file ISSM-17111-17112.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/Makefile.am M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h A /issm/trunk-jpl/src/c/shared/FSanalyticals A /issm/trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h A /issm/trunk-jpl/src/c/shared/FSanalyticals/fx.cpp A /issm/trunk-jpl/src/c/shared/FSanalyticals/fy.cpp A /issm/trunk-jpl/src/c/shared/FSanalyticals/fz.cpp M /issm/trunk-jpl/src/c/shared/shared.h\\
+Export determination: 6. \\
+Rationale: NEW: adding analytical functions framework for FS tests\\
+\vspace{3em}
+
+\noindent \textbf{Change \#553} with diff file ISSM-17112-17113.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: no analytical test by default\\
+\vspace{3em}
+
+\noindent \textbf{Change \#554} with diff file ISSM-17113-17114.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/Makefile.am A /issm/trunk-jpl/src/c/shared/FSanalyticals/FSanalytical1.cpp (from /issm/trunk-jpl/src/c/shared/FSanalyticals/fx.cpp:17111) M /issm/trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h D /issm/trunk-jpl/src/c/shared/FSanalyticals/fx.cpp D /issm/trunk-jpl/src/c/shared/FSanalyticals/fy.cpp D /issm/trunk-jpl/src/c/shared/FSanalyticals/fz.cpp\\
+Export determination: 6. \\
+Rationale: CHG: adding analytical function values\\
+\vspace{3em}
+
+\noindent \textbf{Change \#555} with diff file ISSM-17114-17115.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/cores/transient\_core.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp M /issm/trunk-jpl/src/m/classes/mask.m M /issm/trunk-jpl/src/m/classes/mask.py M /issm/trunk-jpl/src/m/classes/transient.m M /issm/trunk-jpl/src/m/classes/transient.py M /issm/trunk-jpl/src/m/parameterization/setmask.m M /issm/trunk-jpl/src/m/parameterization/setmask.py\\
+Export determination: 6. \\
+Rationale: ADD: Building LSM shell pt2: Adding InputUpdateFromSolution, CreateKMatrix, Artificial Diffusivity etc. CHG: m/py code modified such that ice exists where LSF negative\\
+\vspace{3em}
+
+\noindent \textbf{Change \#556} with diff file ISSM-17115-17116.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/parameterization/setmask.m M /issm/trunk-jpl/src/m/parameterization/setmask.py\\
+Export determination: 6. \\
+Rationale: BUG: for now levelset is >0 when ice is present\\
+\vspace{3em}
+
+\noindent \textbf{Change \#557} with diff file ISSM-17116-17117.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: improved analytical FS\\
+\vspace{3em}
+
+\noindent \textbf{Change \#558} with diff file ISSM-17117-17118.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plot\_elementnumbering.m\\
+Export determination: 6. \\
+Rationale: BUG: fixing highlight elements in 3d\\
+\vspace{3em}
+
+\noindent \textbf{Change \#559} with diff file ISSM-17118-17119.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/Loads/Numericalflux.cpp M /issm/trunk-jpl/src/m/parameterization/setmask.m M /issm/trunk-jpl/src/m/parameterization/setmask.py\\
+Export determination: 6. \\
+Rationale: CHG: Negative sign of md.mask.ice\_levelset represents existence of ice. This way the normal computed by the level-set function points out of the ice domain.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#560} with diff file ISSM-17119-17120.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test217.m M /issm/trunk-jpl/test/NightlyRun/test217.py M /issm/trunk-jpl/test/NightlyRun/test701.m M /issm/trunk-jpl/test/NightlyRun/test702.m\\
+Export determination: 6. \\
+Rationale: BUG: fixing level set in NR\\
+\vspace{3em}
+
+\noindent \textbf{Change \#561} with diff file ISSM-17120-17121.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: cannot allocate array with int that is not const (const int dim = 2 was required)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#562} with diff file ISSM-17121-17122.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/mesh/triangle.m M /issm/trunk-jpl/src/m/mesh/triangle2dvertical.m\\
+Export determination: 6. \\
+Rationale: BUG: use size,1 to get the number of elements rather than length (does not work for meshes with 1 or 2 elements otherwise)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#563} with diff file ISSM-17122-17123.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/IoModel.h M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/FacesPartitioning.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.h\\
+Export determination: 6. \\
+Rationale: NEW: added face creation and partitioning\\
+\vspace{3em}
+
+\noindent \textbf{Change \#564} with diff file ISSM-17123-17124.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/Makefile.am A /issm/trunk-jpl/src/c/shared/FSanalyticals/FSanalytical2.cpp M /issm/trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h\\
+Export determination: 6. \\
+Rationale: NEW: added second analytical solutions for FS\\
+\vspace{3em}
+
+\noindent \textbf{Change \#565} with diff file ISSM-17124-17125.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/FSanalyticals/FSanalytical2.cpp\\
+Export determination: 6. \\
+Rationale: CHG: minor header file\\
+\vspace{3em}
+
+\noindent \textbf{Change \#566} with diff file ISSM-17125-17126.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp\\
+Export determination: 6. \\
+Rationale: CHG: minor\\
+\vspace{3em}
+
+\noindent \textbf{Change \#567} with diff file ISSM-17126-17127.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/os/issmscpout.py\\
+Export determination: 6. \\
+Rationale: CHG: use gethostname() homogeneously across the code.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#568} with diff file ISSM-17127-17128.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/os/issmscpin.py M /issm/trunk-jpl/src/m/os/issmssh.py\\
+Export determination: 6. \\
+Rationale: CHG: corrected issues with uneven use of gethostname() routine.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#569} with diff file ISSM-17128-17129.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: minor cleaning code\\
+\vspace{3em}
+
+\noindent \textbf{Change \#570} with diff file ISSM-17129-17130.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/wrappers/InterpFromMeshToGrid/InterpFromMeshToGrid.cpp M /issm/trunk-jpl/src/wrappers/InterpFromMeshToGrid/InterpFromMeshToGrid.h M /issm/trunk-jpl/src/wrappers/python/Makefile.am\\
+Export determination: 6. \\
+Rationale: CHG: new python module\\
+\vspace{3em}
+
+\noindent \textbf{Change \#571} with diff file ISSM-17130-17131.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/FemModel.cpp\\
+Export determination: 6. \\
+Rationale: BUG: use ISSM\_MPI\_Allreduce instead of MPI\_Allreduce for AD compilation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#572} with diff file ISSM-17131-17132.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/linux64\_murdo\\
+Export determination: 6. \\
+Rationale: CHG: trying to exclude some tests\\
+\vspace{3em}
+
+\noindent \textbf{Change \#573} with diff file ISSM-17132-17133.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/petsc/install-3.4-acenet.sh\\
+Export determination: 6. \\
+Rationale: CHG: using mkl libraries for bals - lapack\\
+\vspace{3em}
+
+\noindent \textbf{Change \#574} with diff file ISSM-17133-17134.diff: \\
+Function name: \\
+M /issm/trunk-jpl/m4/issm\_options.m4\\
+Export determination: 6. \\
+Rationale: CHG: added intel-acenet VENDOR for mkl libraries\\
+\vspace{3em}
+
+\noindent \textbf{Change \#575} with diff file ISSM-17134-17135.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/linux64\_murdo\\
+Export determination: 6. \\
+Rationale: CHG: excluding 119 from murdo\\
+\vspace{3em}
+
+\noindent \textbf{Change \#576} with diff file ISSM-17135-17136.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp\\
+Export determination: 6. \\
+Rationale: NEW: use Faces for P2xP4 elements\\
+\vspace{3em}
+
+\noindent \textbf{Change \#577} with diff file ISSM-17136-17137.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive285.nc M /issm/trunk-jpl/test/Archives/Archive455.nc M /issm/trunk-jpl/test/NightlyRun/test285.m M /issm/trunk-jpl/test/NightlyRun/test285.py M /issm/trunk-jpl/test/NightlyRun/test455.m M /issm/trunk-jpl/test/NightlyRun/test455.py\\
+Export determination: 6. \\
+Rationale: NEW: added P1xP3 and P2xP4 tests HO\\
+\vspace{3em}
+
+\noindent \textbf{Change \#578} with diff file ISSM-17137-17138.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp\\
+Export determination: 6. \\
+Rationale: CHG: OneLayerP4z now uses faces instead of edges\\
+\vspace{3em}
+
+\noindent \textbf{Change \#579} with diff file ISSM-17138-17139.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/IoModel.cpp M /issm/trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing a bunch of memory leaks\\
+\vspace{3em}
+
+\noindent \textbf{Change \#580} with diff file ISSM-17139-17140.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/Makefile.am A /issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp A /issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.h M /issm/trunk-jpl/src/c/analyses/analyses.h M /issm/trunk-jpl/src/c/cores/transient\_core.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py\\
+Export determination: 6. \\
+Rationale: ADD: Shell for extrapolation: ExtrapolationAnalysis\\
+\vspace{3em}
+
+\noindent \textbf{Change \#581} with diff file ISSM-17140-17141.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/FemModel.cpp\\
+Export determination: 6. \\
+Rationale: NEW: trying to solve AD compilation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#582} with diff file ISSM-17141-17142.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: improved FS analytical 2\\
+\vspace{3em}
+
+\noindent \textbf{Change \#583} with diff file ISSM-17142-17143.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.cpp\\
+Export determination: 6. \\
+Rationale: CHG: simplifying Nodalfunctions Velocity and Pressure\\
+\vspace{3em}
+
+\noindent \textbf{Change \#584} with diff file ISSM-17143-17144.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: CHG: removing eric's commit 17047\\
+\vspace{3em}
+
+\noindent \textbf{Change \#585} with diff file ISSM-17144-17145.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.h\\
+Export determination: 6. \\
+Rationale: ADD: setting spcs on ice domain for extrapolation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#586} with diff file ISSM-17145-17146.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h\\
+Export determination: 6. \\
+Rationale: CHG: missing instantiation.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#587} with diff file ISSM-17146-17147.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/contrib/paraview/exportVTK.m\\
+Export determination: 6. \\
+Rationale: BUG:fixing minor issue with almost zero values\\
+\vspace{3em}
+
+\noindent \textbf{Change \#588} with diff file ISSM-17147-17148.diff: \\
+Function name: \\
+D /issm/trunk-jpl/src/m/inversions/misfit.m A /issm/trunk-jpl/src/m/inversions/velocitymisfit.m (from /issm/trunk-jpl/src/m/inversions/misfit.m:17146)\\
+Export determination: 6. \\
+Rationale: CHG: renamed old misfit function to resolve naming conflict with recently-implemented misfit class\\
+\vspace{3em}
+
+\noindent \textbf{Change \#589} with diff file ISSM-17148-17149.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/IdToName.py A /issm/trunk-jpl/test/NightlyRun/test336.py\\
+Export determination: 6. \\
+Rationale: ADD: NightlyRun for Level-Set Method\\
+\vspace{3em}
+
+\noindent \textbf{Change \#590} with diff file ISSM-17149-17150.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test336.py\\
+Export determination: 6. \\
+Rationale: CHG: LSM nightlyrun uses SquareSheetConstrained par file now\\
+\vspace{3em}
+
+\noindent \textbf{Change \#591} with diff file ISSM-17150-17151.diff: \\
+Function name: \\
+A /issm/trunk-jpl/test/Archives/Archive336.nc\\
+Export determination: 6. \\
+Rationale: NEW: adding archive\\
+\vspace{3em}
+
+\noindent \textbf{Change \#592} with diff file ISSM-17151-17152.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/flowequation.py\\
+Export determination: 6. \\
+Rationale: CHG: adding 'P1xP3','P2xP4' to consistency tests\\
+\vspace{3em}
+
+\noindent \textbf{Change \#593} with diff file ISSM-17152-17153.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test285.m M /issm/trunk-jpl/test/NightlyRun/test285.py M /issm/trunk-jpl/test/NightlyRun/test325.m M /issm/trunk-jpl/test/NightlyRun/test325.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxing some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#594} with diff file ISSM-17153-17154.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test203.py\\
+Export determination: 6. \\
+Rationale: CHG: Updated python tolerance (smae as matlab's)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#595} with diff file ISSM-17154-17155.diff: \\
+Function name: \\
+M /issm/trunk-jpl/m4/issm\_options.m4\\
+Export determination: 6. \\
+Rationale: CHG: added \_DEVELOPMENT\_ macro\\
+\vspace{3em}
+
+\noindent \textbf{Change \#596} with diff file ISSM-17155-17156.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: added error message if non development version\\
+\vspace{3em}
+
+\noindent \textbf{Change \#597} with diff file ISSM-17156-17157.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed topy on defined\\
+\vspace{3em}
+
+\noindent \textbf{Change \#598} with diff file ISSM-17157-17158.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: enthalpy melting rates and drainage are now computed in water equivalent\\
+\vspace{3em}
+
+\noindent \textbf{Change \#599} with diff file ISSM-17158-17159.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: ADD: Tria::GetNode(int node\_number) filled in\\
+\vspace{3em}
+
+\noindent \textbf{Change \#600} with diff file ISSM-17159-17160.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnumToAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp M /issm/trunk-jpl/src/c/cores/AnalysisConfiguration.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py\\
+Export determination: 6. \\
+Rationale: CHG: extrapolation of scalar field using a steadystate solver\\
+\vspace{3em}
+
+\noindent \textbf{Change \#601} with diff file ISSM-17160-17161.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/applyoptions.py\\
+Export determination: 6. \\
+Rationale: BUG: missed some import statements for specifying colorbar limits\\
+\vspace{3em}
+
+\noindent \textbf{Change \#602} with diff file ISSM-17161-17162.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test285.m M /issm/trunk-jpl/test/NightlyRun/test285.py M /issm/trunk-jpl/test/NightlyRun/test404.m M /issm/trunk-jpl/test/NightlyRun/test404.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxing some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#603} with diff file ISSM-17162-17163.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/FemModel.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: CHG: Modification in the epl system looping\\
+\vspace{3em}
+
+\noindent \textbf{Change \#604} with diff file ISSM-17163-17164.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/solve/WriteData.m\\
+Export determination: 6. \\
+Rationale: CHG: add error to Double Mat for arrays that are too large\\
+\vspace{3em}
+
+\noindent \textbf{Change \#605} with diff file ISSM-17164-17165.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/enum/ExtrapolationAnalysisEnum.m A /issm/trunk-jpl/src/m/enum/ExtrapolationVariableEnum.m\\
+Export determination: 6. \\
+Rationale: NEW: adding enums\\
+\vspace{3em}
+
+\noindent \textbf{Change \#606} with diff file ISSM-17165-17166.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: BUG: adding a bypass for the transfered keyword when the efficient layer isn't used\\
+\vspace{3em}
+
+\noindent \textbf{Change \#607} with diff file ISSM-17166-17167.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.h\\
+Export determination: 6. \\
+Rationale: CHG: separated computation of basal melting rates and drainage of excess water in ice column. minor cleanups\\
+\vspace{3em}
+
+\noindent \textbf{Change \#608} with diff file ISSM-17167-17168.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/solve/WriteData.py\\
+Export determination: 6. \\
+Rationale: CHG: Attempt to add error to python WriteData for large arrays...\\
+\vspace{3em}
+
+\noindent \textbf{Change \#609} with diff file ISSM-17168-17169.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/runme.py\\
+Export determination: 6. \\
+Rationale: CHG: enable passing list of ids: --exclude 101 102\\
+\vspace{3em}
+
+\noindent \textbf{Change \#610} with diff file ISSM-17169-17170.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/solve/WriteData.py\\
+Export determination: 6. \\
+Rationale: BUG: fixing previous commit, python's exponent is **, and EnumToString returns only one output -> [0]\\
+\vspace{3em}
+
+\noindent \textbf{Change \#611} with diff file ISSM-17170-17171.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/linux64\_murdo\\
+Export determination: 6. \\
+Rationale: CHG: excluding more python tests\\
+\vspace{3em}
+
+\noindent \textbf{Change \#612} with diff file ISSM-17171-17172.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: Added artificial diffusion to extrapolation routine to stabilize solution\\
+\vspace{3em}
+
+\noindent \textbf{Change \#613} with diff file ISSM-17172-17173.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp\\
+Export determination: 6. \\
+Rationale: NEW: trying to reimplement free surfaces (testing soon)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#614} with diff file ISSM-17173-17174.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp\\
+Export determination: 6. \\
+Rationale: CHG: commenting out this->Report() which forces error messages to be printed\\
+\vspace{3em}
+
+\noindent \textbf{Change \#615} with diff file ISSM-17174-17175.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/FSanalyticals\\
+Export determination: 6. \\
+Rationale: CHG: getting svn to ignore some files\\
+\vspace{3em}
+
+\noindent \textbf{Change \#616} with diff file ISSM-17175-17176.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/IoModel.cpp\\
+Export determination: 6. \\
+Rationale: BUG : fixing a conditional jump due to elementtofaceconectivity\\
+\vspace{3em}
+
+\noindent \textbf{Change \#617} with diff file ISSM-17176-17177.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: CHG: Removing hydrological relaxation that mess up with the accuracy of the results\\
+\vspace{3em}
+
+\noindent \textbf{Change \#618} with diff file ISSM-17177-17178.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Seg.cpp M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing some free surface problems\\
+\vspace{3em}
+
+\noindent \textbf{Change \#619} with diff file ISSM-17178-17179.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing free surfaces in 1d\\
+\vspace{3em}
+
+\noindent \textbf{Change \#620} with diff file ISSM-17179-17180.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h\\
+Export determination: 6. \\
+Rationale: BUG: some fixes\\
+\vspace{3em}
+
+\noindent \textbf{Change \#621} with diff file ISSM-17180-17181.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: Fixing free surface models\\
+\vspace{3em}
+
+\noindent \textbf{Change \#622} with diff file ISSM-17181-17182.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: Fixing free surface models\\
+\vspace{3em}
+
+\noindent \textbf{Change \#623} with diff file ISSM-17182-17183.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/cores/masstransport\_core.cpp\\
+Export determination: 6. \\
+Rationale: NEW: enabeling extrudefrombase for 3d meshes\\
+\vspace{3em}
+
+\noindent \textbf{Change \#624} with diff file ISSM-17183-17184.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h\\
+Export determination: 6. \\
+Rationale: BUG: needed to at dimension so that we get z axis properly\\
+\vspace{3em}
+
+\noindent \textbf{Change \#625} with diff file ISSM-17184-17185.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing extrusion for 3d meshes\\
+\vspace{3em}
+
+\noindent \textbf{Change \#626} with diff file ISSM-17185-17186.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/IdToName.m A /issm/trunk-jpl/test/NightlyRun/test124.m A /issm/trunk-jpl/test/NightlyRun/test703.m\\
+Export determination: 6. \\
+Rationale: NEW: added 2 tests of free surfaces\\
+\vspace{3em}
+
+\noindent \textbf{Change \#627} with diff file ISSM-17186-17187.diff: \\
+Function name: \\
+A /issm/trunk-jpl/test/Archives/Archive124.nc A /issm/trunk-jpl/test/Archives/Archive703.nc\\
+Export determination: 6. \\
+Rationale: NEW: added archives for 703 and 124\\
+\vspace{3em}
+
+\noindent \textbf{Change \#628} with diff file ISSM-17187-17188.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive122.nc M /issm/trunk-jpl/test/Archives/Archive325.nc\\
+Export determination: 6. \\
+Rationale: CHG: updated archives for enthalpy change\\
+\vspace{3em}
+
+\noindent \textbf{Change \#629} with diff file ISSM-17188-17189.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive124.nc\\
+Export determination: 6. \\
+Rationale: CHG: updated archive 124\\
+\vspace{3em}
+
+\noindent \textbf{Change \#630} with diff file ISSM-17189-17190.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test124.m M /issm/trunk-jpl/test/NightlyRun/test404.m M /issm/trunk-jpl/test/NightlyRun/test404.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxing some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#631} with diff file ISSM-17190-17191.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test124.m\\
+Export determination: 6. \\
+Rationale: CHG: relaxing tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#632} with diff file ISSM-17191-17192.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/HydrologydcMaxIterEnum.m\\
+Export determination: 6. \\
+Rationale: NEW : Adding a max iter enum for the hydro model\\
+\vspace{3em}
+
+\noindent \textbf{Change \#633} with diff file ISSM-17192-17193.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: NEW: changing the maxiter parameter from hard codded to Enum\\
+\vspace{3em}
+
+\noindent \textbf{Change \#634} with diff file ISSM-17193-17194.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: coupling between LSM and stressbalance by checking for ice in element\\
+\vspace{3em}
+
+\noindent \textbf{Change \#635} with diff file ISSM-17194-17195.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: ADD: 2 methods: 1st get the ice front of the ice domain; 2nd Get the normal on the surface of the ice domain from the levelset function\\
+\vspace{3em}
+
+\noindent \textbf{Change \#636} with diff file ISSM-17195-17196.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test124.m\\
+Export determination: 6. \\
+Rationale: CHG: stricter tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#637} with diff file ISSM-17196-17197.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/materials/TMeltingPoint.m A /issm/trunk-jpl/src/m/materials/TMeltingPoint.py M /issm/trunk-jpl/src/m/materials/arrhenius.m\\
+Export determination: 6. \\
+Rationale: CHG: stripped TMeltingPoint function out of arrhenius to make it an independent function\\
+\vspace{3em}
+
+\noindent \textbf{Change \#638} with diff file ISSM-17197-17198.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test124.m\\
+Export determination: 6. \\
+Rationale: CHG: relaxing tolerances test124\\
+\vspace{3em}
+
+\noindent \textbf{Change \#639} with diff file ISSM-17198-17199.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test333.m\\
+Export determination: 6. \\
+Rationale: CHG: minorchange in my personnal checkout things\\
+\vspace{3em}
+
+\noindent \textbf{Change \#640} with diff file ISSM-17199-17200.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/m/classes/hydrologydc.m\\
+Export determination: 6. \\
+Rationale: BUG; few fix related to the new enum\\
+\vspace{3em}
+
+\noindent \textbf{Change \#641} with diff file ISSM-17200-17201.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test124.m M /issm/trunk-jpl/test/NightlyRun/test211.m M /issm/trunk-jpl/test/NightlyRun/test211.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxing some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#642} with diff file ISSM-17201-17202.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plot\_unit.py\\
+Export determination: 6. \\
+Rationale: CHG: use tripcolor to enable edgecolors for mesh overlay\\
+\vspace{3em}
+
+\noindent \textbf{Change \#643} with diff file ISSM-17202-17203.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plot\_unit.py\\
+Export determination: 6. \\
+Rationale: CHG: reverting previous commit, adding temporary mesh overlay to plots until I sort out the edgecolor problem\\
+\vspace{3em}
+
+\noindent \textbf{Change \#644} with diff file ISSM-17203-17204.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plot\_unit.py\\
+Export determination: 6. \\
+Rationale: CHG: enable support for edgecolor for python plots\\
+\vspace{3em}
+
+\noindent \textbf{Change \#645} with diff file ISSM-17204-17205.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/shp/shpdisp.m M /issm/trunk-jpl/src/m/shp/shpread.m\\
+Export determination: 6. \\
+Rationale: NEW: adding point ability for shapefile read and plot\\
+\vspace{3em}
+
+\noindent \textbf{Change \#646} with diff file ISSM-17205-17206.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test285.m M /issm/trunk-jpl/test/NightlyRun/test285.py M /issm/trunk-jpl/test/NightlyRun/test511.m M /issm/trunk-jpl/test/NightlyRun/test511.py\\
+Export determination: 6. \\
+Rationale: CHG: updated some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#647} with diff file ISSM-17206-17207.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/imac-012301-gil\\
+Export determination: 6. \\
+Rationale: CHG: excluding some more tests\\
+\vspace{3em}
+
+\noindent \textbf{Change \#648} with diff file ISSM-17207-17208.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/InterpFromMeshToGridx/InterpFromMeshToGridx.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixinf segmentation fault due to bad indexing\\
+\vspace{3em}
+
+\noindent \textbf{Change \#649} with diff file ISSM-17208-17209.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/cores/transient\_core.cpp\\
+Export determination: 6. \\
+Rationale: CHG: setting of BCs for LSM, minor bugs\\
+\vspace{3em}
+
+\noindent \textbf{Change \#650} with diff file ISSM-17209-17210.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive336.nc M /issm/trunk-jpl/test/NightlyRun/test336.py\\
+Export determination: 6. \\
+Rationale: BUG: update failing LSM test\\
+\vspace{3em}
+
+\noindent \textbf{Change \#651} with diff file ISSM-17210-17211.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/ipython/install.sh M /issm/trunk-jpl/externalpackages/matplotlib/install-linux64.sh M /issm/trunk-jpl/externalpackages/vim/addons/vimrc M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/FemModel.cpp M /issm/trunk-jpl/src/c/cores/transient\_core.cpp M /issm/trunk-jpl/test/Archives/Archive336.nc M /issm/trunk-jpl/test/NightlyRun/test336.py\\
+Export determination: 6. \\
+Rationale: revert to r17207\\
+\vspace{3em}
+
+\noindent \textbf{Change \#652} with diff file ISSM-17211-17212.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/ipython/install.sh M /issm/trunk-jpl/externalpackages/matplotlib/install-linux64.sh M /issm/trunk-jpl/externalpackages/vim/addons/vimrc M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: minor: partial correction of revert\\
+\vspace{3em}
+
+\noindent \textbf{Change \#653} with diff file ISSM-17212-17213.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h M /issm/trunk-jpl/src/c/analyses/Analysis.h M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h M /issm/trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h M /issm/trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.h M /issm/trunk-jpl/src/c/analyses/EnumToAnalysis.h M /issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.h M /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h M /issm/trunk-jpl/src/c/analyses/GiaAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/GiaAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.h M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.h M /issm/trunk-jpl/src/c/analyses/MeltingAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MeltingAnalysis.h M /issm/trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.h\\
+Export determination: 6. \\
+Rationale: NEW: added UpdateConstraints method to all analyses\\
+\vspace{3em}
+
+\noindent \textbf{Change \#654} with diff file ISSM-17213-17214.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test211.m M /issm/trunk-jpl/test/NightlyRun/test211.py M /issm/trunk-jpl/test/NightlyRun/test426.py M /issm/trunk-jpl/test/NightlyRun/test455.m M /issm/trunk-jpl/test/NightlyRun/test455.py M /issm/trunk-jpl/test/NightlyRun/test703.m\\
+Export determination: 6. \\
+Rationale: CHG: relaxing some tolerances for jenkins\\
+\vspace{3em}
+
+\noindent \textbf{Change \#655} with diff file ISSM-17214-17215.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/mask.m M /issm/trunk-jpl/src/m/classes/mask.py\\
+Export determination: 6. \\
+Rationale: BUG: description of ice\_levelset was backwards for ice versus no ice areas\\
+\vspace{3em}
+
+\noindent \textbf{Change \#656} with diff file ISSM-17215-17216.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test211.m M /issm/trunk-jpl/test/NightlyRun/test211.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxing some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#657} with diff file ISSM-17216-17217.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test333.m\\
+Export determination: 6. \\
+Rationale: CHG: relaxing some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#658} with diff file ISSM-17217-17218.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/imac-012301-gil M /issm/trunk-jpl/jenkins/windows\\
+Export determination: 6. \\
+Rationale: CHG: excluding some tests\\
+\vspace{3em}
+
+\noindent \textbf{Change \#659} with diff file ISSM-17218-17219.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test211.m M /issm/trunk-jpl/test/NightlyRun/test211.py M /issm/trunk-jpl/test/NightlyRun/test285.m M /issm/trunk-jpl/test/NightlyRun/test285.py M /issm/trunk-jpl/test/NightlyRun/test333.m M /issm/trunk-jpl/test/NightlyRun/test455.m M /issm/trunk-jpl/test/NightlyRun/test455.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxing some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#660} with diff file ISSM-17219-17220.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test211.m M /issm/trunk-jpl/test/NightlyRun/test211.py M /issm/trunk-jpl/test/NightlyRun/test455.m M /issm/trunk-jpl/test/NightlyRun/test455.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxing some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#661} with diff file ISSM-17220-17221.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test404.m M /issm/trunk-jpl/test/NightlyRun/test404.py M /issm/trunk-jpl/test/NightlyRun/test513.m M /issm/trunk-jpl/test/NightlyRun/test513.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxed tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#662} with diff file ISSM-17221-17222.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test422.m M /issm/trunk-jpl/test/NightlyRun/test422.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxed some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#663} with diff file ISSM-17222-17223.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/classes/mask.m M /issm/trunk-jpl/src/m/classes/mask.py M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py\\
+Export determination: 6. \\
+Rationale: ADD: IceMaskNodeActivationEnum. Ice mask for activation of nodes now marshalled during initialization of model\\
+\vspace{3em}
+
+\noindent \textbf{Change \#664} with diff file ISSM-17223-17224.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/enum/IceMaskNodeActivationEnum.m\\
+Export determination: 6. \\
+Rationale: BUG: syncing enums\\
+\vspace{3em}
+
+\noindent \textbf{Change \#665} with diff file ISSM-17224-17225.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plot\_overlay.m M /issm/trunk-jpl/src/m/plot/radarpower.m\\
+Export determination: 6. \\
+Rationale: NEW: enableing landsat image overlay, and commented out imadjust, because no license is ever available and creates an error\\
+\vspace{3em}
+
+\noindent \textbf{Change \#666} with diff file ISSM-17225-17226.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.cpp M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.h M /issm/trunk-jpl/src/c/classes/IoModel.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed problem in the case of no initial field\\
+\vspace{3em}
+
+\noindent \textbf{Change \#667} with diff file ISSM-17226-17227.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/TriaRef.cpp\\
+Export determination: 6. \\
+Rationale: BUG: missing P0 interpolation in TriaRef\\
+\vspace{3em}
+
+\noindent \textbf{Change \#668} with diff file ISSM-17227-17228.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/vim/addons/vimrc M /issm/trunk-jpl/src/c/Makefile.am M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/FemModel.cpp M /issm/trunk-jpl/src/c/cores/transient\_core.cpp M /issm/trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp M /issm/trunk-jpl/src/c/modules/modules.h M /issm/trunk-jpl/src/m/dev/devpath.py M /issm/trunk-jpl/src/m/plot/processmesh.py M /issm/trunk-jpl/test/Archives/Archive336.nc M /issm/trunk-jpl/test/NightlyRun/test336.py\\
+Export determination: 6. \\
+Rationale: CHG: backup dump - to be reverted\\
+\vspace{3em}
+
+\noindent \textbf{Change \#669} with diff file ISSM-17228-17229.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed spawn input in case interpolation is P0\\
+\vspace{3em}
+
+\noindent \textbf{Change \#670} with diff file ISSM-17229-17230.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed spawn input in case interpolation is P0\\
+\vspace{3em}
+
+\noindent \textbf{Change \#671} with diff file ISSM-17230-17231.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/vim/addons/vimrc M /issm/trunk-jpl/src/c/Makefile.am M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/FemModel.cpp M /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp M /issm/trunk-jpl/src/c/cores/transient\_core.cpp M /issm/trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp M /issm/trunk-jpl/src/c/modules/modules.h M /issm/trunk-jpl/src/m/dev/devpath.py M /issm/trunk-jpl/src/m/plot/processmesh.py M /issm/trunk-jpl/test/Archives/Archive336.nc M /issm/trunk-jpl/test/NightlyRun/test336.py\\
+Export determination: 6. \\
+Rationale: revert to r17226\\
+\vspace{3em}
+
+\noindent \textbf{Change \#672} with diff file ISSM-17231-17232.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp\\
+Export determination: 6. \\
+Rationale: CHG: correct revert gone too far\\
+\vspace{3em}
+
+\noindent \textbf{Change \#673} with diff file ISSM-17232-17233.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: BUG: P1Enum should be provided to GetInputValue when it is not consistent with the element interpolation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#674} with diff file ISSM-17233-17234.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/SegRef.cpp\\
+Export determination: 6. \\
+Rationale: CHG: added P0 number of nodes\\
+\vspace{3em}
+
+\noindent \textbf{Change \#675} with diff file ISSM-17234-17235.diff: \\
+Function name: \\
+M /issm/trunk-jpl/packagers/win7/startup.m\\
+Export determination: 6. \\
+Rationale: CHG: startup missing path to lib on windows platforms\\
+\vspace{3em}
+
+\noindent \textbf{Change \#676} with diff file ISSM-17235-17236.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/SegRef.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing P0 Inputs\\
+\vspace{3em}
+
+\noindent \textbf{Change \#677} with diff file ISSM-17236-17237.diff: \\
+Function name: \\
+M /issm/trunk-jpl/m4/issm\_options.m4 M /issm/trunk-jpl/src/c/Makefile.am M /issm/trunk-jpl/src/c/analyses/EnumToAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/FemModel.cpp M /issm/trunk-jpl/src/c/classes/FemModel.h M /issm/trunk-jpl/src/c/classes/Loads/Pengrid.cpp M /issm/trunk-jpl/src/c/classes/Loads/Pengrid.h M /issm/trunk-jpl/src/c/classes/Materials/Matice.cpp M /issm/trunk-jpl/src/c/classes/Node.cpp M /issm/trunk-jpl/src/c/classes/Node.h M /issm/trunk-jpl/src/c/cores/CorePointerFromSolutionEnum.cpp M /issm/trunk-jpl/src/c/cores/WrapperCorePointerFromSolutionEnum.cpp M /issm/trunk-jpl/src/c/cores/steadystate\_core.cpp M /issm/trunk-jpl/src/c/cores/transient\_core.cpp M /issm/trunk-jpl/src/c/modules/ConstraintsStatex/ConstraintsStatex.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp M /issm/trunk-jpl/src/c/modules/ResetConstraintsx/ResetConstraintsx.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/c/shared/Enum/Synchronize.sh\\
+Export determination: 6. \\
+Rationale: CHG: adding conditionnal compilation back (based on analyses for now)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#678} with diff file ISSM-17237-17238.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/FemModel.cpp\\
+Export determination: 6. \\
+Rationale: BUG: reverted default back\\
+\vspace{3em}
+
+\noindent \textbf{Change \#679} with diff file ISSM-17238-17239.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/Makefile.am\\
+Export determination: 6. \\
+Rationale: BUG: forgot to add kriging\_sources to modules\\
+\vspace{3em}
+
+\noindent \textbf{Change \#680} with diff file ISSM-17239-17240.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/c/modules/SetActiveNodesLSMx A /issm/trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp A /issm/trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.h\\
+Export determination: 6. \\
+Rationale: NEW: module to set active/deactive nodes according to MaskIceLevelset\\
+\vspace{3em}
+
+\noindent \textbf{Change \#681} with diff file ISSM-17240-17241.diff: \\
+Function name: \\
+M /issm/trunk-jpl/m4/issm\_options.m4 M /issm/trunk-jpl/src/c/Makefile.am M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing some missing analyses (conditional)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#682} with diff file ISSM-17241-17242.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/Makefile.am M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/FemModel.cpp M /issm/trunk-jpl/src/c/modules/modules.h\\
+Export determination: 6. \\
+Rationale: BUG: integration for steadystate stressbalance LSM over elements with no ice\\
+\vspace{3em}
+
+\noindent \textbf{Change \#683} with diff file ISSM-17242-17243.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/TriaRef.cpp M /issm/trunk-jpl/src/c/classes/Materials/Material.h M /issm/trunk-jpl/src/c/classes/Materials/Matice.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matice.h M /issm/trunk-jpl/src/c/classes/Materials/Matpar.h\\
+Export determination: 6. \\
+Rationale: NEW: preparing HO 2dvertical\\
+\vspace{3em}
+
+\noindent \textbf{Change \#684} with diff file ISSM-17243-17244.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/flowequation.m\\
+Export determination: 6. \\
+Rationale: NEW: preparing HO 2dvertical\\
+\vspace{3em}
+
+\noindent \textbf{Change \#685} with diff file ISSM-17244-17245.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matice.cpp\\
+Export determination: 6. \\
+Rationale: NEW: done with HO 2d vertical (results does not seem to make sense yet\\
+\vspace{3em}
+
+\noindent \textbf{Change \#686} with diff file ISSM-17245-17246.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed boundary condition problem for Mesh2dHorizontal (vy can be spc'ed)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#687} with diff file ISSM-17246-17247.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: commenting out SetActiveNodesLSMx for now (FS issue)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#688} with diff file ISSM-17247-17248.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed non initialization of D friction HO\\
+\vspace{3em}
+
+\noindent \textbf{Change \#689} with diff file ISSM-17248-17249.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Materials/Material.h M /issm/trunk-jpl/src/c/classes/Materials/Matice.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matice.h M /issm/trunk-jpl/src/c/classes/Materials/Matpar.h M /issm/trunk-jpl/test/Archives/Archive103.nc\\
+Export determination: 6. \\
+Rationale: CHG: simplifying getviscosity calls, now only provide effective strain rate\\
+\vspace{3em}
+
+\noindent \textbf{Change \#690} with diff file ISSM-17249-17250.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing AD build\\
+\vspace{3em}
+
+\noindent \textbf{Change \#691} with diff file ISSM-17250-17251.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/cores/transient\_core.cpp M /issm/trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp\\
+Export determination: 6. \\
+Rationale: BUG: minor bugs; transient coupling between stressbalance and lsm\\
+\vspace{3em}
+
+\noindent \textbf{Change \#692} with diff file ISSM-17251-17252.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test336.py\\
+Export determination: 6. \\
+Rationale: CHG: changed domain to circle in test336.py\\
+\vspace{3em}
+
+\noindent \textbf{Change \#693} with diff file ISSM-17252-17253.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive336.nc\\
+Export determination: 6. \\
+Rationale: CHG: updated archive for test336\\
+\vspace{3em}
+
+\noindent \textbf{Change \#694} with diff file ISSM-17253-17254.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: commenting levelset out for now\\
+\vspace{3em}
+
+\noindent \textbf{Change \#695} with diff file ISSM-17254-17255.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/toolkits/mpi/issmmpi.cpp\\
+Export determination: 6. \\
+Rationale: CHG update after AMPI change (was to disambiguate Fortran support in AMPI)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#696} with diff file ISSM-17255-17256.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Node.cpp M /issm/trunk-jpl/src/c/classes/Node.h\\
+Export determination: 6. \\
+Rationale: CHG: moved matrix rotation from Node.cpp to Element.cpp\\
+\vspace{3em}
+
+\noindent \textbf{Change \#697} with diff file ISSM-17256-17257.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/applyoptions.py\\
+Export determination: 6. \\
+Rationale: BUG: plotmodel sets ylim, zlim as xlim\\
+\vspace{3em}
+
+\noindent \textbf{Change \#698} with diff file ISSM-17257-17258.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: ADD: bool Element::IsIceFront(), minor bugs\\
+\vspace{3em}
+
+\noindent \textbf{Change \#699} with diff file ISSM-17258-17259.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed Transform solution going in circles\\
+\vspace{3em}
+
+\noindent \textbf{Change \#700} with diff file ISSM-17259-17260.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/organizer.m\\
+Export determination: 6. \\
+Rationale: NEW: allow *.mat extension\\
+\vspace{3em}
+
+\noindent \textbf{Change \#701} with diff file ISSM-17260-17261.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/mask.m\\
+Export determination: 6. \\
+Rationale: BUG: added warning when old models are loaded since we changed the sign of ice levelset\\
+\vspace{3em}
+
+\noindent \textbf{Change \#702} with diff file ISSM-17261-17262.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/cores/transient\_core.cpp\\
+Export determination: 6. \\
+Rationale: CHG: Add coupling LSM - masstransport - ice dynamics. Order of transient computation is now: stressbalance - moving boundary - masstransport on new domain\\
+\vspace{3em}
+
+\noindent \textbf{Change \#703} with diff file ISSM-17262-17263.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plot\_icefront.m\\
+Export determination: 6. \\
+Rationale: BUG: wrong sign for ice\_levelset in BC plot\\
+\vspace{3em}
+
+\noindent \textbf{Change \#704} with diff file ISSM-17263-17264.diff: \\
+Function name: \\
+M /issm/trunk-jpl/scripts/vie M /issm/trunk-jpl/scripts/vil\\
+Export determination: 6. \\
+Rationale: BUG: fixed script for gp\\
+\vspace{3em}
+
+\noindent \textbf{Change \#705} with diff file ISSM-17264-17265.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/clusters/generic.py M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py M /issm/trunk-jpl/src/m/miscellaneous/MatlabFuncs.py M /issm/trunk-jpl/src/m/solve/waitonlock.py\\
+Export determination: 6. \\
+Rationale: BUG: fixing oshostname issue, do not use split('.') anymore\\
+\vspace{3em}
+
+\noindent \textbf{Change \#706} with diff file ISSM-17265-17266.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/solve/loadresultsfromcluster.py\\
+Export determination: 6. \\
+Rationale: BUG: fixing oshostname issue, do not use split('.') anymore\\
+\vspace{3em}
+
+\noindent \textbf{Change \#707} with diff file ISSM-17266-17267.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Loads/Load.h M /issm/trunk-jpl/src/c/classes/Loads/Numericalflux.cpp M /issm/trunk-jpl/src/c/classes/Loads/Numericalflux.h M /issm/trunk-jpl/src/c/classes/Materials/Material.h M /issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp\\
+Export determination: 6. \\
+Rationale: CHG: removing inputs from NumericalFlux\\
+\vspace{3em}
+
+\noindent \textbf{Change \#708} with diff file ISSM-17267-17268.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h\\
+Export determination: 6. \\
+Rationale: ADD: Penta::IsIcefront()\\
+\vspace{3em}
+
+\noindent \textbf{Change \#709} with diff file ISSM-17268-17269.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Loads/Pengrid.cpp M /issm/trunk-jpl/src/c/classes/Loads/Pengrid.h\\
+Export determination: 6. \\
+Rationale: CHG: removing inputs from Pengrid\\
+\vspace{3em}
+
+\noindent \textbf{Change \#710} with diff file ISSM-17269-17270.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Loads/Numericalflux.h M /issm/trunk-jpl/src/c/classes/Loads/Riftfront.cpp M /issm/trunk-jpl/src/c/classes/Loads/Riftfront.h\\
+Export determination: 6. \\
+Rationale: CHG: removing inputs from Riftfront\\
+\vspace{3em}
+
+\noindent \textbf{Change \#711} with diff file ISSM-17270-17271.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/cores/transient\_core.cpp\\
+Export determination: 6. \\
+Rationale: CHG: restoring order stressbalance - levelset - masstransport - groundingline - gia in transient\_core.cpp\\
+\vspace{3em}
+
+\noindent \textbf{Change \#712} with diff file ISSM-17271-17272.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_thermal\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: CHG: use setparam instead of InputUpdateFromConstantx(femmodel,melting\_offset,MeltingOffsetEnum);\\
+\vspace{3em}
+
+\noindent \textbf{Change \#713} with diff file ISSM-17272-17273.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/adolc/install-withampi.sh\\
+Export determination: 6. \\
+Rationale: CHG space inserted to trigger rebuild on jenkins - following Eric's advice\\
+\vspace{3em}
+
+\noindent \textbf{Change \#714} with diff file ISSM-17273-17274.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/adjoinablempi/install.sh\\
+Export determination: 6. \\
+Rationale: CHG space inserted to trigger rebuild on jenkins - following Eric's advice\\
+\vspace{3em}
+
+\noindent \textbf{Change \#715} with diff file ISSM-17274-17275.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/Makefile.am M /issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/cores/cores.h A /issm/trunk-jpl/src/c/cores/levelsetfunctionslope\_core.cpp M /issm/trunk-jpl/src/c/cores/transient\_core.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/LevelsetfunctionSlopeXEnum.m A /issm/trunk-jpl/src/m/enum/LevelsetfunctionSlopeYEnum.m\\
+Export determination: 6. \\
+Rationale: CHG: slope of levelset function for derivation of normal is now calculated once before extrapolation, since calculation in element can lead to normal = 0 for equal values on nodes.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#716} with diff file ISSM-17275-17276.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/Loads/Pengrid.cpp M /issm/trunk-jpl/src/c/classes/Materials/Material.h M /issm/trunk-jpl/src/c/classes/Materials/Materials.cpp M /issm/trunk-jpl/src/c/classes/Materials/Materials.h M /issm/trunk-jpl/src/c/classes/Materials/Matice.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matice.h M /issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matpar.h M /issm/trunk-jpl/src/c/modules/GetVectorFromInputsx/GetVectorFromInputsx.cpp M /issm/trunk-jpl/src/c/modules/InputDuplicatex/InputDuplicatex.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp\\
+Export determination: 6. \\
+Rationale: CHG: removing materials inputs, that are now in element\\
+\vspace{3em}
+
+\noindent \textbf{Change \#717} with diff file ISSM-17276-17277.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: minor typo\\
+\vspace{3em}
+
+\noindent \textbf{Change \#718} with diff file ISSM-17277-17278.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: temporary fix for SetActiveNodesLSMx in stressbalance/masstransport\\
+\vspace{3em}
+
+\noindent \textbf{Change \#719} with diff file ISSM-17278-17279.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp\\
+Export determination: 6. \\
+Rationale: BUG: added case Mesh2dVertical\\
+\vspace{3em}
+
+\noindent \textbf{Change \#720} with diff file ISSM-17279-17280.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/cores/stressbalance\_core.cpp\\
+Export determination: 6. \\
+Rationale: BUG: do not duplicate QmuVz if not in 3d\\
+\vspace{3em}
+
+\noindent \textbf{Change \#721} with diff file ISSM-17280-17281.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/adjoinablempi/install.sh\\
+Export determination: 6. \\
+Rationale: CHG whitespace change to try again to trigger the jenkins rebuild\\
+\vspace{3em}
+
+\noindent \textbf{Change \#722} with diff file ISSM-17281-17282.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Materials/Material.h M /issm/trunk-jpl/src/c/classes/Materials/Matice.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matice.h M /issm/trunk-jpl/src/c/classes/Materials/Matpar.h\\
+Export determination: 6. \\
+Rationale: CHG: renamed new copy function copy2 to avoid shadowing Object->copy()\\
+\vspace{3em}
+
+\noindent \textbf{Change \#723} with diff file ISSM-17282-17283.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp M /issm/trunk-jpl/test/Archives/Archive336.nc\\
+Export determination: 6. \\
+Rationale: CHG: update archive 336; using SU stabilization instead of artificial diffusion for better front tracking\\
+\vspace{3em}
+
+\noindent \textbf{Change \#724} with diff file ISSM-17283-17284.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/mask.py\\
+Export determination: 6. \\
+Rationale: BUG: in lsm, an element has ice only if at least one of its vertices has a negative levelset function value\\
+\vspace{3em}
+
+\noindent \textbf{Change \#725} with diff file ISSM-17284-17285.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/mech/robintemperature.m\\
+Export determination: 6. \\
+Rationale: BUG: fix for elementwise division in case accumrate is a vector\\
+\vspace{3em}
+
+\noindent \textbf{Change \#726} with diff file ISSM-17285-17286.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/Makefile.am A /issm/trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp M /issm/trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h\\
+Export determination: 6. \\
+Rationale: NEW: adding full stokes analytical function form flowband\\
+\vspace{3em}
+
+\noindent \textbf{Change \#727} with diff file ISSM-17286-17287.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp\\
+Export determination: 6. \\
+Rationale: BUG: y instead of z\\
+\vspace{3em}
+
+\noindent \textbf{Change \#728} with diff file ISSM-17287-17288.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: typo\\
+\vspace{3em}
+
+\noindent \textbf{Change \#729} with diff file ISSM-17288-17289.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing analytical 2d\\
+\vspace{3em}
+
+\noindent \textbf{Change \#730} with diff file ISSM-17289-17290.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp M /issm/trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h\\
+Export determination: 6. \\
+Rationale: NEW: new analytical force for 3d case\\
+\vspace{3em}
+
+\noindent \textbf{Change \#731} with diff file ISSM-17290-17291.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive3003.nc M /issm/trunk-jpl/test/Archives/Archive3019.nc M /issm/trunk-jpl/test/Archives/Archive3103.nc\\
+Export determination: 6. \\
+Rationale: CHG: updated archives for stress tensor for AD mode\\
+\vspace{3em}
+
+\noindent \textbf{Change \#732} with diff file ISSM-17291-17292.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp M /issm/trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h\\
+Export determination: 6. \\
+Rationale: NEW: added analytical test 5:\\
+\vspace{3em}
+
+\noindent \textbf{Change \#733} with diff file ISSM-17292-17293.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/adolc/install-withampi-macosx64.sh M /issm/trunk-jpl/externalpackages/adolc/install-withampi-pleiades-gcc.sh M /issm/trunk-jpl/externalpackages/adolc/install-withampi-pleiades.sh M /issm/trunk-jpl/externalpackages/adolc/install-withampi.sh\\
+Export determination: 6. \\
+Rationale: CHG the new version of adolc by default renames the library when compiled with AMPI (insisted on by the Paderborn folks); use the switch to keep the library name the same\\
+\vspace{3em}
+
+\noindent \textbf{Change \#734} with diff file ISSM-17293-17294.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/FSanalyticals M /issm/trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp\\
+Export determination: 6. \\
+Rationale: CHG: trying cmath instead of math to fix windows compile\\
+\vspace{3em}
+
+\noindent \textbf{Change \#735} with diff file ISSM-17294-17295.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/FemModel.cpp M /issm/trunk-jpl/src/c/classes/Loads/Riftfront.cpp M /issm/trunk-jpl/src/c/classes/Misfit.h M /issm/trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing some windows warnings\\
+\vspace{3em}
+
+\noindent \textbf{Change \#736} with diff file ISSM-17295-17296.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp\\
+Export determination: 6. \\
+Rationale: CHG: trying to fix windows compile\\
+\vspace{3em}
+
+\noindent \textbf{Change \#737} with diff file ISSM-17296-17297.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: CHG: moved some functions from each element to Element.cpp\\
+\vspace{3em}
+
+\noindent \textbf{Change \#738} with diff file ISSM-17297-17298.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h\\
+Export determination: 6. \\
+Rationale: CHG: preparing SSA 1d\\
+\vspace{3em}
+
+\noindent \textbf{Change \#739} with diff file ISSM-17298-17299.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing SSA 2d\\
+\vspace{3em}
+
+\noindent \textbf{Change \#740} with diff file ISSM-17299-17300.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/mesh2d.m\\
+Export determination: 6. \\
+Rationale: CHG: added conversion from mesh to mesh2d\\
+\vspace{3em}
+
+\noindent \textbf{Change \#741} with diff file ISSM-17300-17301.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/mesh2d.m\\
+Export determination: 6. \\
+Rationale: BUG: fixed case 1 in constructor\\
+\vspace{3em}
+
+\noindent \textbf{Change \#742} with diff file ISSM-17301-17302.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/SetActiveNodesLSMx\\
+Export determination: 6. \\
+Rationale: BUG: do not commit with FSANALYTICAL macro\\
+\vspace{3em}
+
+\noindent \textbf{Change \#743} with diff file ISSM-17302-17303.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: do not commit with FSANALYTICAL uncommented\\
+\vspace{3em}
+
+\noindent \textbf{Change \#744} with diff file ISSM-17303-17304.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/Makefile.am M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp D /issm/trunk-jpl/src/c/shared/FSanalyticals/FSanalytical1.cpp D /issm/trunk-jpl/src/c/shared/FSanalyticals/FSanalytical2.cpp D /issm/trunk-jpl/src/c/shared/FSanalyticals/FSanalytical3.cpp A /issm/trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp M /issm/trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h\\
+Export determination: 6. \\
+Rationale: CHG: cleaned analytical solutions code\\
+\vspace{3em}
+
+\noindent \textbf{Change \#745} with diff file ISSM-17304-17305.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp M /issm/trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h\\
+Export determination: 6. \\
+Rationale: CHG: minor name\\
+\vspace{3em}
+
+\noindent \textbf{Change \#746} with diff file ISSM-17305-17306.diff: \\
+Function name: \\
+M /issm/trunk-jpl/m4/issm\_options.m4 M /issm/trunk-jpl/src/c/Makefile.am M /issm/trunk-jpl/src/c/analyses/EnumToAnalysis.cpp A /issm/trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp A /issm/trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.h M /issm/trunk-jpl/src/c/analyses/analyses.h M /issm/trunk-jpl/src/c/cores/AnalysisConfiguration.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/LsfReinitializationAnalysisEnum.m\\
+Export determination: 6. \\
+Rationale: ADD: shell for levelset function reinitialization analysis\\
+\vspace{3em}
+
+\noindent \textbf{Change \#747} with diff file ISSM-17306-17307.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp M /issm/trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h\\
+Export determination: 6. \\
+Rationale: NEW: additional analytical 2d tests\\
+\vspace{3em}
+
+\noindent \textbf{Change \#748} with diff file ISSM-17307-17308.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.h\\
+Export determination: 6. \\
+Rationale: BUG: removing error messages\\
+\vspace{3em}
+
+\noindent \textbf{Change \#749} with diff file ISSM-17308-17309.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.m\\
+Export determination: 6. \\
+Rationale: CHG: added note about spc for vertical velocity as a reminder for future discussion\\
+\vspace{3em}
+
+\noindent \textbf{Change \#750} with diff file ISSM-17309-17310.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.cpp M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/SegRef.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/Inputs/SegInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/SegInput.h M /issm/trunk-jpl/src/c/classes/gauss/GaussSeg.cpp M /issm/trunk-jpl/src/c/classes/gauss/GaussSeg.h M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp\\
+Export determination: 6. \\
+Rationale: CHG: preparing SSA 1d\\
+\vspace{3em}
+
+\noindent \textbf{Change \#751} with diff file ISSM-17310-17311.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Seg.cpp M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/gauss/GaussSeg.cpp M /issm/trunk-jpl/src/c/classes/gauss/GaussSeg.h\\
+Export determination: 6. \\
+Rationale: CHG: working on SSA 1d\\
+\vspace{3em}
+
+\noindent \textbf{Change \#752} with diff file ISSM-17311-17312.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test103.m M /issm/trunk-jpl/test/NightlyRun/test103.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxing some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#753} with diff file ISSM-17312-17313.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/imac-012301-gil\\
+Export determination: 6. \\
+Rationale: CHG: excluding FS tests, not stable for now\\
+\vspace{3em}
+
+\noindent \textbf{Change \#754} with diff file ISSM-17313-17314.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test455.m M /issm/trunk-jpl/test/NightlyRun/test455.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxing some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#755} with diff file ISSM-17314-17315.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/flowequation.m\\
+Export determination: 6. \\
+Rationale: CHG: accept SSA in 2d vertical\\
+\vspace{3em}
+
+\noindent \textbf{Change \#756} with diff file ISSM-17315-17316.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Seg.cpp M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/gauss/GaussSeg.cpp\\
+Export determination: 6. \\
+Rationale: CHG: working on SSA 1d\\
+\vspace{3em}
+
+\noindent \textbf{Change \#757} with diff file ISSM-17316-17317.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test204.m M /issm/trunk-jpl/test/NightlyRun/test204.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxing some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#758} with diff file ISSM-17317-17318.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed SSA 2d horizontal\\
+\vspace{3em}
+
+\noindent \textbf{Change \#759} with diff file ISSM-17318-17319.diff: \\
+Function name: \\
+A /issm/trunk-jpl/test/Archives/Archive435.nc M /issm/trunk-jpl/test/NightlyRun/IdToName.m A /issm/trunk-jpl/test/NightlyRun/test435.m\\
+Export determination: 6. \\
+Rationale: NEW: additional test for grounding lines in HO\\
+\vspace{3em}
+
+\noindent \textbf{Change \#760} with diff file ISSM-17319-17320.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: CHG: fixing assertion\\
+\vspace{3em}
+
+\noindent \textbf{Change \#761} with diff file ISSM-17320-17321.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test513.m M /issm/trunk-jpl/test/NightlyRun/test513.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxing some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#762} with diff file ISSM-17321-17322.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp M /issm/trunk-jpl/src/c/classes/Node.cpp\\
+Export determination: 6. \\
+Rationale: CHG: done with SSA 1d\\
+\vspace{3em}
+
+\noindent \textbf{Change \#763} with diff file ISSM-17322-17323.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/Makefile.am M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/cores/stressbalance\_core.cpp D /issm/trunk-jpl/src/c/modules/ResetCoordinateSystemx A /issm/trunk-jpl/src/c/modules/ResetFSBasalBoundaryConditionx (from /issm/trunk-jpl/src/c/modules/ResetCoordinateSystemx:17321) D /issm/trunk-jpl/src/c/modules/ResetFSBasalBoundaryConditionx/ResetCoordinateSystemx.cpp D /issm/trunk-jpl/src/c/modules/ResetFSBasalBoundaryConditionx/ResetCoordinateSystemx.h A /issm/trunk-jpl/src/c/modules/ResetFSBasalBoundaryConditionx/ResetFSBasalBoundaryConditionx.cpp (from /issm/trunk-jpl/src/c/modules/ResetCoordinateSystemx/ResetCoordinateSystemx.cpp:17321) A /issm/trunk-jpl/src/c/modules/ResetFSBasalBoundaryConditionx/ResetFSBasalBoundaryConditionx.h (from /issm/trunk-jpl/src/c/modules/ResetCoordinateSystemx/ResetCoordinateSystemx.h:17321) M /issm/trunk-jpl/src/c/modules/modules.h\\
+Export determination: 6. \\
+Rationale: CHG: changed name of ResetCoordinateSystemx to include FS boundary condition\\
+\vspace{3em}
+
+\noindent \textbf{Change \#764} with diff file ISSM-17323-17324.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Node.cpp\\
+Export determination: 6. \\
+Rationale: NEW: adding assert in NodeInSset\\
+\vspace{3em}
+
+\noindent \textbf{Change \#765} with diff file ISSM-17324-17325.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed node on bed assertion\\
+\vspace{3em}
+
+\noindent \textbf{Change \#766} with diff file ISSM-17325-17326.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp\\
+Export determination: 6. \\
+Rationale: CHG: updating no penetration condition for FS at each time step\\
+\vspace{3em}
+
+\noindent \textbf{Change \#767} with diff file ISSM-17326-17327.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive435.nc M /issm/trunk-jpl/test/NightlyRun/test435.m\\
+Export determination: 6. \\
+Rationale: CHG: updated archives and tolerance recent test\\
+\vspace{3em}
+
+\noindent \textbf{Change \#768} with diff file ISSM-17327-17328.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/kriging/Observations.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing number of observations in case\\
+\vspace{3em}
+
+\noindent \textbf{Change \#769} with diff file ISSM-17328-17329.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/kriging/Observations.cpp M /issm/trunk-jpl/src/c/toolkits/gsl/DenseGslSolve.cpp M /issm/trunk-jpl/src/c/toolkits/gsl/gslincludes.h\\
+Export determination: 6. \\
+Rationale: NEW: added GslTriple solve to have a faster solution of Kriging\\
+\vspace{3em}
+
+\noindent \textbf{Change \#770} with diff file ISSM-17329-17330.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/kriging/Observations.cpp\\
+Export determination: 6. \\
+Rationale: CHG: fixing DenseGslTripleSolve call\\
+\vspace{3em}
+
+\noindent \textbf{Change \#771} with diff file ISSM-17330-17331.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed set FS basal boundary conditions for flow line models\\
+\vspace{3em}
+
+\noindent \textbf{Change \#772} with diff file ISSM-17331-17332.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.h\\
+Export determination: 6. \\
+Rationale: NEW: added mass transport for flowline models\\
+\vspace{3em}
+
+\noindent \textbf{Change \#773} with diff file ISSM-17332-17333.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: BUG: ficed wrong mesh type\\
+\vspace{3em}
+
+\noindent \textbf{Change \#774} with diff file ISSM-17333-17334.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/cores/masstransport\_core.cpp\\
+Export determination: 6. \\
+Rationale: NEW: finished implementation of mass transport in 2d flowband\\
+\vspace{3em}
+
+\noindent \textbf{Change \#775} with diff file ISSM-17334-17335.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/LevelsetfunctionPicardEnum.m\\
+Export determination: 6. \\
+Rationale: ADD: LsfReinitializationAnalysis: CreateKMatrix, CreatePVector. Preparing Picard Iteration on Levelsetfunction for initialization.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#776} with diff file ISSM-17335-17336.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/cores/masstransport\_core.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed meshtype that need vertical extrusion\\
+\vspace{3em}
+
+\noindent \textbf{Change \#777} with diff file ISSM-17336-17337.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: trying to fix the AD build\\
+\vspace{3em}
+
+\noindent \textbf{Change \#778} with diff file ISSM-17337-17338.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp\\
+Export determination: 6. \\
+Rationale: iBUG: fixed FS basal boundary conditions for tiling\\
+\vspace{3em}
+
+\noindent \textbf{Change \#779} with diff file ISSM-17338-17339.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: CHG: moved some GetInputValue to Element.cpp\\
+\vspace{3em}
+
+\noindent \textbf{Change \#780} with diff file ISSM-17339-17340.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed Reset for real stokes\\
+\vspace{3em}
+
+\noindent \textbf{Change \#781} with diff file ISSM-17340-17341.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/kriging/Observations.cpp\\
+Export determination: 6. \\
+Rationale: CHG: simplified kriging\\
+\vspace{3em}
+
+\noindent \textbf{Change \#782} with diff file ISSM-17341-17342.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing SSA friction\\
+\vspace{3em}
+
+\noindent \textbf{Change \#783} with diff file ISSM-17342-17343.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/kriging/Observations.cpp\\
+Export determination: 6. \\
+Rationale: CHG: error is now identical to gslib\\
+\vspace{3em}
+
+\noindent \textbf{Change \#784} with diff file ISSM-17343-17344.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/toolkits/gsl/DenseGslSolve.cpp M /issm/trunk-jpl/src/c/toolkits/gsl/gslincludes.h\\
+Export determination: 6. \\
+Rationale: DEL: removed TripleSolve, not needed anymore\\
+\vspace{3em}
+
+\noindent \textbf{Change \#785} with diff file ISSM-17344-17345.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test435.m\\
+Export determination: 6. \\
+Rationale: CHG: relaxed some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#786} with diff file ISSM-17345-17346.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.h\\
+Export determination: 6. \\
+Rationale: BUG: fixed failure in weekly NR\\
+\vspace{3em}
+
+\noindent \textbf{Change \#787} with diff file ISSM-17346-17347.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/shp/Shp2Exp.m\\
+Export determination: 6. \\
+Rationale: BUG: better support for line layers with multiple features\\
+\vspace{3em}
+
+\noindent \textbf{Change \#788} with diff file ISSM-17347-17348.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Seg.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed gauss point when position is provided\\
+\vspace{3em}
+
+\noindent \textbf{Change \#789} with diff file ISSM-17348-17349.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: NEW: added friction law for Henning:\\
+\vspace{3em}
+
+\noindent \textbf{Change \#790} with diff file ISSM-17349-17350.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: CHG:Now computing the transfer between layer in an implicit way\\
+\vspace{3em}
+
+\noindent \textbf{Change \#791} with diff file ISSM-17350-17351.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: BUG: leaving a dummy hydrologytransfer routine\\
+\vspace{3em}
+
+\noindent \textbf{Change \#792} with diff file ISSM-17351-17352.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing analysis related bug in hydrology\\
+\vspace{3em}
+
+\noindent \textbf{Change \#793} with diff file ISSM-17352-17353.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py D /issm/trunk-jpl/src/m/enum/L2ProjectionTopAnalysisEnum.m D /issm/trunk-jpl/src/m/enum/WaterTransferEnum.m\\
+Export determination: 6. \\
+Rationale: CHG: removing water transfer enum, cleaning L2ProjectionTopAnalysisEnum\\
+\vspace{3em}
+
+\noindent \textbf{Change \#794} with diff file ISSM-17353-17354.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/FemModel.cpp M /issm/trunk-jpl/src/c/classes/FemModel.h M /issm/trunk-jpl/src/c/cores/hydrology\_core.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: CHG: cleaning water transfer from tria and related stuff\\
+\vspace{3em}
+
+\noindent \textbf{Change \#795} with diff file ISSM-17354-17355.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/SegRef.cpp\\
+Export determination: 6. \\
+Rationale: NEW: added basal functions and derivatives in Segment\\
+\vspace{3em}
+
+\noindent \textbf{Change \#796} with diff file ISSM-17355-17356.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: CHG: cleaning element, initializing transfer to 0 in case there is no transfer\\
+\vspace{3em}
+
+\noindent \textbf{Change \#797} with diff file ISSM-17356-17357.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: CHG: minor cosmetics\\
+\vspace{3em}
+
+\noindent \textbf{Change \#798} with diff file ISSM-17357-17358.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: CHG: minor cleanup\\
+\vspace{3em}
+
+\noindent \textbf{Change \#799} with diff file ISSM-17358-17359.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp\\
+Export determination: 6. \\
+Rationale: CHG: improved maximum numberoffaces\\
+\vspace{3em}
+
+\noindent \textbf{Change \#800} with diff file ISSM-17359-17360.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp M /issm/trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h\\
+Export determination: 6. \\
+Rationale: NEW: added HO convergence tests\\
+\vspace{3em}
+
+\noindent \textbf{Change \#801} with diff file ISSM-17360-17361.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp M /issm/trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h\\
+Export determination: 6. \\
+Rationale: CHG: cleaned analytical solutions\\
+\vspace{3em}
+
+\noindent \textbf{Change \#802} with diff file ISSM-17361-17362.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/FemModel.cpp M /issm/trunk-jpl/src/c/classes/FemModel.h M /issm/trunk-jpl/src/c/classes/Loads/Pengrid.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: CHG:transferring epl thickness computation to the analysis\\
+\vspace{3em}
+
+\noindent \textbf{Change \#803} with diff file ISSM-17362-17363.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp\\
+Export determination: 6. \\
+Rationale: CHG: Getting rid of AllActive\\
+\vspace{3em}
+
+\noindent \textbf{Change \#804} with diff file ISSM-17363-17364.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: Instead of extrapolation along normal, diffuse variable outward. Once initialization of levelset function to signed distance function is working, revert this step.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#805} with diff file ISSM-17364-17365.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/cores/transient\_core.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/classes/masstransport.m M /issm/trunk-jpl/src/m/classes/masstransport.py M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/MasstransportCalvingrateEnum.m M /issm/trunk-jpl/test/Archives/Archive336.nc M /issm/trunk-jpl/test/NightlyRun/test336.py\\
+Export determination: 6. \\
+Rationale: ADD: Calvingrate as model field; LevelsetAnalysis::SetDistanceOnIntersectedElements; MINOR: code cleanup\\
+\vspace{3em}
+
+\noindent \textbf{Change \#806} with diff file ISSM-17365-17366.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/classes/hydrologydc.py M /issm/trunk-jpl/src/m/classes/hydrologyshreve.py\\
+Export determination: 6. \\
+Rationale: NEW: adding python for hydrologydc\\
+\vspace{3em}
+
+\noindent \textbf{Change \#807} with diff file ISSM-17366-17367.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/hydrologyshreve.py\\
+Export determination: 6. \\
+Rationale: minor: typo\\
+\vspace{3em}
+
+\noindent \textbf{Change \#808} with diff file ISSM-17367-17368.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/classes/damage.m M /issm/trunk-jpl/src/m/classes/damage.py M /issm/trunk-jpl/src/m/classes/model.m A /issm/trunk-jpl/src/m/enum/DamageEquivStressEnum.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py M /issm/trunk-jpl/src/m/mech/mechanicalproperties.m M /issm/trunk-jpl/src/m/mech/steadystateiceshelftemp.m M /issm/trunk-jpl/src/m/mech/thomasparams.m M /issm/trunk-jpl/src/m/plot/colormaps/getcolormap.m\\
+Export determination: 6. \\
+Rationale: CHG: added a model field to choose the type of scalar equivalent stress for a damage evolution solution\\
+\vspace{3em}
+
+\noindent \textbf{Change \#809} with diff file ISSM-17368-17369.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: incompatibility of ternary operator with adolc\\
+\vspace{3em}
+
+\noindent \textbf{Change \#810} with diff file ISSM-17369-17370.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp M /issm/trunk-jpl/src/c/cores/damage\_core.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/classes/damage.m M /issm/trunk-jpl/src/m/classes/damage.py A /issm/trunk-jpl/src/m/enum/DamageEvolutionNumRequestedOutputsEnum.m A /issm/trunk-jpl/src/m/enum/DamageEvolutionRequestedOutputsEnum.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py\\
+Export determination: 6. \\
+Rationale: CHG: enable requested outputs for damage evolution solution\\
+\vspace{3em}
+
+\noindent \textbf{Change \#811} with diff file ISSM-17370-17371.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: trying to fix AD\\
+\vspace{3em}
+
+\noindent \textbf{Change \#812} with diff file ISSM-17371-17372.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: replaced static arrays by dynamic ones\\
+\vspace{3em}
+
+\noindent \textbf{Change \#813} with diff file ISSM-17372-17373.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/FemModel.cpp M /issm/trunk-jpl/src/c/classes/Loads/Pengrid.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_hydro\_nonlinear.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_linear.cpp\\
+Export determination: 6. \\
+Rationale: CHG: moving hydrology related routines from the element to the analysis\\
+\vspace{3em}
+
+\noindent \textbf{Change \#814} with diff file ISSM-17373-17374.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/windows\\
+Export determination: 6. \\
+Rationale: CHG: excluding FS test\\
+\vspace{3em}
+
+\noindent \textbf{Change \#815} with diff file ISSM-17374-17375.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/imac-012301-gil M /issm/trunk-jpl/jenkins/linux64\_murdo\\
+Export determination: 6. \\
+Rationale: CHG: excluding test 435, which is failing for unknown reasons\\
+\vspace{3em}
+
+\noindent \textbf{Change \#816} with diff file ISSM-17375-17376.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h\\
+Export determination: 6. \\
+Rationale: CHG: change input managment in Hydro\\
+\vspace{3em}
+
+\noindent \textbf{Change \#817} with diff file ISSM-17376-17377.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/IdToName.py A /issm/trunk-jpl/test/NightlyRun/test3300.m\\
+Export determination: 6. \\
+Rationale: NEW: adding a more evolve hydro test case\\
+\vspace{3em}
+
+\noindent \textbf{Change \#818} with diff file ISSM-17377-17378.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/imac-012301-gil M /issm/trunk-jpl/jenkins/windows\\
+Export determination: 6. \\
+Rationale: CHG: removing 435 from windows only\\
+\vspace{3em}
+
+\noindent \textbf{Change \#819} with diff file ISSM-17378-17379.diff: \\
+Function name: \\
+A /issm/trunk-jpl/externalpackages/petsc/install-3.4-pleiades2.sh\\
+Export determination: 6. \\
+Rationale: NEW: added install-3.4-pleiades2.sh with old packages\\
+\vspace{3em}
+
+\noindent \textbf{Change \#820} with diff file ISSM-17379-17380.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/contrib/paraview/exportVTK.m D /issm/trunk-jpl/src/m/enum/DamageEvolutionNumRequestedOutputsEnum.m D /issm/trunk-jpl/src/m/enum/DamageEvolutionRequestedOutputsEnum.m M /issm/trunk-jpl/src/m/exp/expdisp.m\\
+Export determination: 6. \\
+Rationale: BUG: Fix in exportVTK to deal with simulation without results\\
+\vspace{3em}
+
+\noindent \textbf{Change \#821} with diff file ISSM-17380-17381.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/enum/DamageEvolutionNumRequestedOutputsEnum.m A /issm/trunk-jpl/src/m/enum/DamageEvolutionRequestedOutputsEnum.m\\
+Export determination: 6. \\
+Rationale: BUG: Reverting enums\\
+\vspace{3em}
+
+\noindent \textbf{Change \#822} with diff file ISSM-17381-17382.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/solve/process\_solve\_options.m M /issm/trunk-jpl/src/m/solve/solve.m\\
+Export determination: 6. \\
+Rationale: NEW: added 'runtimename' option to avoid complex filename convention so that runtimename = md.miscellaneous.name (default is true)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#823} with diff file ISSM-17383-17384.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.cpp M /issm/trunk-jpl/src/c/classes/gauss/GaussPenta.cpp M /issm/trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.h\\
+Export determination: 6. \\
+Rationale: BUG: fixed P2 in Penta\\
+\vspace{3em}
+
+\noindent \textbf{Change \#824} with diff file ISSM-17384-17385.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed segfault of P2 caused by Facepartitionning\\
+\vspace{3em}
+
+\noindent \textbf{Change \#825} with diff file ISSM-17385-17386.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive285.nc M /issm/trunk-jpl/test/Archives/Archive290.nc M /issm/trunk-jpl/test/Archives/Archive455.nc\\
+Export determination: 6. \\
+Rationale: CHG: updated archives for new P2 penta\\
+\vspace{3em}
+
+\noindent \textbf{Change \#826} with diff file ISSM-17386-17387.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed problem with 2d taylor hood\\
+\vspace{3em}
+
+\noindent \textbf{Change \#827} with diff file ISSM-17387-17388.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test290.m M /issm/trunk-jpl/test/NightlyRun/test290.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxed tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#828} with diff file ISSM-17388-17389.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp\\
+Export determination: 6. \\
+Rationale: NEW: another analytical solution\\
+\vspace{3em}
+
+\noindent \textbf{Change \#829} with diff file ISSM-17389-17390.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/mech/analyticaldamage.m\\
+Export determination: 6. \\
+Rationale: BUG: fixed wrong vector length in damage calculation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#830} with diff file ISSM-17390-17391.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/mech/mechanicalproperties.m\\
+Export determination: 6. \\
+Rationale: CHG: added some comments to clarify stress calculations\\
+\vspace{3em}
+
+\noindent \textbf{Change \#831} with diff file ISSM-17391-17392.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h M /issm/trunk-jpl/src/c/classes/Loads/Pengrid.cpp M /issm/trunk-jpl/src/c/cores/damage\_core.cpp\\
+Export determination: 6. \\
+Rationale: CHG: misc changes to damage evolution solution, mirroring changes to mass transport analysis\\
+\vspace{3em}
+
+\noindent \textbf{Change \#832} with diff file ISSM-17392-17393.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/damage.m M /issm/trunk-jpl/src/m/classes/damage.py M /issm/trunk-jpl/src/m/consistency/ismodelselfconsistent.py M /issm/trunk-jpl/src/m/solve/process\_solve\_options.py\\
+Export determination: 6. \\
+Rationale: CHG: updates for damage evolution in python\\
+\vspace{3em}
+
+\noindent \textbf{Change \#833} with diff file ISSM-17393-17394.diff: \\
+Function name: \\
+A /issm/trunk-jpl/test/Archives/Archive275.nc M /issm/trunk-jpl/test/NightlyRun/IdToName.m M /issm/trunk-jpl/test/NightlyRun/IdToName.py M /issm/trunk-jpl/test/NightlyRun/runme.py A /issm/trunk-jpl/test/NightlyRun/test275.m A /issm/trunk-jpl/test/NightlyRun/test275.py\\
+Export determination: 6. \\
+Rationale: CHG: new NR for damage evolution\\
+\vspace{3em}
+
+\noindent \textbf{Change \#834} with diff file ISSM-17394-17395.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/FemModel.cpp M /issm/trunk-jpl/src/c/classes/FemModel.h M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp\\
+Export determination: 6. \\
+Rationale: NEW: added divergence calculation in elements\\
+\vspace{3em}
+
+\noindent \textbf{Change \#835} with diff file ISSM-17395-17396.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/mech/mechanicalproperties.py\\
+Export determination: 6. \\
+Rationale: CHG: fixing array size for python calcs\\
+\vspace{3em}
+
+\noindent \textbf{Change \#836} with diff file ISSM-17396-17397.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp M /issm/trunk-jpl/src/m/classes/damage.m M /issm/trunk-jpl/src/m/classes/damage.py\\
+Export determination: 6. \\
+Rationale: CHG: added max principal stress as option for damage equiv\_stress\\
+\vspace{3em}
+
+\noindent \textbf{Change \#837} with diff file ISSM-17397-17398.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp\\
+Export determination: 6. \\
+Rationale: BUG: comparison of constant 3 with expression of type 'bool' is always false\\
+\vspace{3em}
+
+\noindent \textbf{Change \#838} with diff file ISSM-17398-17399.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/Makefile.am A /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp A /issm/trunk-jpl/src/c/classes/Elements/Tetra.h A /issm/trunk-jpl/src/c/classes/Elements/TetraRef.cpp A /issm/trunk-jpl/src/c/classes/Elements/TetraRef.h M /issm/trunk-jpl/src/c/classes/classes.h A /issm/trunk-jpl/src/c/classes/gauss/GaussTetra.cpp A /issm/trunk-jpl/src/c/classes/gauss/GaussTetra.h M /issm/trunk-jpl/src/c/classes/gauss/gaussobjects.h M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp\\
+Export determination: 6. \\
+Rationale: NEW: preparing Tetra elements\\
+\vspace{3em}
+
+\noindent \textbf{Change \#839} with diff file ISSM-17399-17400.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/enum/DivergenceEnum.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/GaussTetraEnum.m A /issm/trunk-jpl/src/m/enum/TetraEnum.m A /issm/trunk-jpl/src/m/enum/TetraInputEnum.m\\
+Export determination: 6. \\
+Rationale: CHG:Sync'ed Enums\\
+\vspace{3em}
+
+\noindent \textbf{Change \#840} with diff file ISSM-17400-17401.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive271.nc M /issm/trunk-jpl/test/NightlyRun/test271.m A /issm/trunk-jpl/test/NightlyRun/test271.py\\
+Export determination: 6. \\
+Rationale: updated archive and added source term as a checked field\\
+\vspace{3em}
+
+\noindent \textbf{Change \#841} with diff file ISSM-17401-17402.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/damage.py\\
+Export determination: 6. \\
+Rationale: CHG: fixed field display for damage class\\
+\vspace{3em}
+
+\noindent \textbf{Change \#842} with diff file ISSM-17402-17403.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plotmodel.py\\
+Export determination: 6. \\
+Rationale: CHG: clear any previous plot window for re-plotting\\
+\vspace{3em}
+
+\noindent \textbf{Change \#843} with diff file ISSM-17403-17404.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.cpp\\
+Export determination: 6. \\
+Rationale: CHG: updating Henning's surface mass balance scheme\\
+\vspace{3em}
+
+\noindent \textbf{Change \#844} with diff file ISSM-17404-17405.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp\\
+Export determination: 6. \\
+Rationale: NEW: another analytical solution\\
+\vspace{3em}
+
+\noindent \textbf{Change \#845} with diff file ISSM-17405-17406.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/TetraRef.cpp M /issm/trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp\\
+Export determination: 6. \\
+Rationale: CHG: implementing nodal functions P1 and P2 for tetra\\
+\vspace{3em}
+
+\noindent \textbf{Change \#846} with diff file ISSM-17406-17407.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/TetraRef.cpp\\
+Export determination: 6. \\
+Rationale: NEW: added Jacobian:\\
+\vspace{3em}
+
+\noindent \textbf{Change \#847} with diff file ISSM-17407-17408.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: extrapolate by diffusion or along normal by setting bool 'extrapolatebydiffusion'\\
+\vspace{3em}
+
+\noindent \textbf{Change \#848} with diff file ISSM-17408-17409.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/Makefile.am\\
+Export determination: 6. \\
+Rationale: CHG: moved issmversion.py to PYTHON build\\
+\vspace{3em}
+
+\noindent \textbf{Change \#849} with diff file ISSM-17409-17410.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed problem with numberoffaces in 2d\\
+\vspace{3em}
+
+\noindent \textbf{Change \#850} with diff file ISSM-17410-17411.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/jenkins.sh\\
+Export determination: 6. \\
+Rationale: CHG: clean up execution first to avoid disk space limitations\\
+\vspace{3em}
+
+\noindent \textbf{Change \#851} with diff file ISSM-17411-17412.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h\\
+Export determination: 6. \\
+Rationale: NEW: added ice shelf dampening for FS\\
+\vspace{3em}
+
+\noindent \textbf{Change \#852} with diff file ISSM-17412-17413.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: fixed windows compilation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#853} with diff file ISSM-17413-17414.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp\\
+Export determination: 6. \\
+Rationale: CHG: mow using local coordinate system for all nodes at the base in FS (for shelf dampening)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#854} with diff file ISSM-17414-17415.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: CHG: local referential coordinates in tria as well\\
+\vspace{3em}
+
+\noindent \textbf{Change \#855} with diff file ISSM-17415-17416.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive703.nc M /issm/trunk-jpl/test/NightlyRun/test703.m\\
+Export determination: 6. \\
+Rationale: NEW: added test for shelf dampening (FS)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#856} with diff file ISSM-17416-17417.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp\\
+Export determination: 6. \\
+Rationale: BUG: numberoffaces only in 3D\\
+\vspace{3em}
+
+\noindent \textbf{Change \#857} with diff file ISSM-17417-17418.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp\\
+Export determination: 6. \\
+Rationale: BUG: another numberoffaces missing\\
+\vspace{3em}
+
+\noindent \textbf{Change \#858} with diff file ISSM-17418-17419.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp\\
+Export determination: 6. \\
+Rationale: BUG: wrong commit\\
+\vspace{3em}
+
+\noindent \textbf{Change \#859} with diff file ISSM-17419-17420.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed problem with nodes in 2d\\
+\vspace{3em}
+
+\noindent \textbf{Change \#860} with diff file ISSM-17420-17421.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/test/Archives/Archive204.nc M /issm/trunk-jpl/test/NightlyRun/test204.m M /issm/trunk-jpl/test/NightlyRun/test204.py\\
+Export determination: 6. \\
+Rationale: BUG: fixed Stokes ice shelf dampening in 3d\\
+\vspace{3em}
+
+\noindent \textbf{Change \#861} with diff file ISSM-17421-17422.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/Numerics/GaussPoints.cpp\\
+Export determination: 6. \\
+Rationale: BUG: wrong gauss point for order 3 tetra\\
+\vspace{3em}
+
+\noindent \textbf{Change \#862} with diff file ISSM-17422-17423.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/classes/hydrologydc.m M /issm/trunk-jpl/src/m/classes/model.m M /issm/trunk-jpl/src/m/contrib/paraview/exportVTK.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py M /issm/trunk-jpl/test/NightlyRun/test3300.m M /issm/trunk-jpl/test/NightlyRun/test332.m M /issm/trunk-jpl/test/NightlyRun/test333.m M /issm/trunk-jpl/test/NightlyRun/test334.m M /issm/trunk-jpl/test/NightlyRun/test335.m\\
+Export determination: 6. \\
+Rationale: NEW: Adding new stuff to deal with moulin input\\
+\vspace{3em}
+
+\noindent \textbf{Change \#863} with diff file ISSM-17424-17425.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive703.nc\\
+Export determination: 6. \\
+Rationale: CHG: updated archives for dampening\\
+\vspace{3em}
+
+\noindent \textbf{Change \#864} with diff file ISSM-17425-17426.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: save results after extrapolation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#865} with diff file ISSM-17426-17427.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: adaptation to LSM in 3D\\
+\vspace{3em}
+
+\noindent \textbf{Change \#866} with diff file ISSM-17427-17428.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: adaptation of LSM to 3D\\
+\vspace{3em}
+
+\noindent \textbf{Change \#867} with diff file ISSM-17428-17429.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: PVector for spawned basal element; minor cleanup\\
+\vspace{3em}
+
+\noindent \textbf{Change \#868} with diff file ISSM-17429-17430.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Node.cpp\\
+Export determination: 6. \\
+Rationale: BUG: deactivate nodes on non-basal layer for 2d solving process of extrapolation and LSM\\
+\vspace{3em}
+
+\noindent \textbf{Change \#869} with diff file ISSM-17430-17431.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp M /issm/trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.h\\
+Export determination: 6. \\
+Rationale: CHG: SetActiveNodesLSMx adapted to 3D case with distinction for 2D calculations; ADD: coupling LSM - HO flow approximation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#870} with diff file ISSM-17431-17432.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: ADD: coupling LSM - SIA flow model. Use this as a template for coupling LSM to an analysis.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#871} with diff file ISSM-17432-17433.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/parameterization/setmask.m M /issm/trunk-jpl/src/m/parameterization/setmask.py\\
+Export determination: 6. \\
+Rationale: ADD: setting mask.ice\_levelset from argus file in setmask\\
+\vspace{3em}
+
+\noindent \textbf{Change \#872} with diff file ISSM-17433-17434.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/parameterization/setmask.m\\
+Export determination: 6. \\
+Rationale: BUG: fixed setmask in matlab\\
+\vspace{3em}
+
+\noindent \textbf{Change \#873} with diff file ISSM-17434-17435.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: ADD: Coupling LSM to thermal and enthalpy analysis\\
+\vspace{3em}
+
+\noindent \textbf{Change \#874} with diff file ISSM-17435-17436.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/model.m M /issm/trunk-jpl/src/m/classes/model.py\\
+Export determination: 6. \\
+Rationale: ADD: extrusion of masstransport.calvingrate\\
+\vspace{3em}
+
+\noindent \textbf{Change \#875} with diff file ISSM-17436-17437.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: do drain waterfraction\\
+\vspace{3em}
+
+\noindent \textbf{Change \#876} with diff file ISSM-17437-17438.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive336.nc M /issm/trunk-jpl/test/NightlyRun/test336.py\\
+Export determination: 6. \\
+Rationale: CHG: enabled masstransport; checking fields Thickness and Surface\\
+\vspace{3em}
+
+\noindent \textbf{Change \#877} with diff file ISSM-17438-17439.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Par/SquareSheetConstrained.py\\
+Export determination: 6. \\
+Rationale: ADD: field masstransport.calvingrate to parameter file\\
+\vspace{3em}
+
+\noindent \textbf{Change \#878} with diff file ISSM-17439-17440.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/IdToName.m M /issm/trunk-jpl/test/NightlyRun/IdToName.py A /issm/trunk-jpl/test/NightlyRun/test336.m\\
+Export determination: 6. \\
+Rationale: ADD: LSM NR; update IdToName\\
+\vspace{3em}
+
+\noindent \textbf{Change \#879} with diff file ISSM-17440-17441.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Par/SquareSheetConstrained.par\\
+Export determination: 6. \\
+Rationale: BUG: missing calving rate in matlab\\
+\vspace{3em}
+
+\noindent \textbf{Change \#880} with diff file ISSM-17441-17442.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test336.m\\
+Export determination: 6. \\
+Rationale: CHG: trying to fix matlab test\\
+\vspace{3em}
+
+\noindent \textbf{Change \#881} with diff file ISSM-17442-17443.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/cores/transient\_core.cpp\\
+Export determination: 6. \\
+Rationale: BUG: ZeroLevelsetCoordinates method get non-covered cases\\
+\vspace{3em}
+
+\noindent \textbf{Change \#882} with diff file ISSM-17443-17444.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test336.m\\
+Export determination: 6. \\
+Rationale: CHG: minor typos in matlab test\\
+\vspace{3em}
+
+\noindent \textbf{Change \#883} with diff file ISSM-17444-17445.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Loads/Pengrid.cpp M /issm/trunk-jpl/src/c/classes/Loads/Pengrid.h M /issm/trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp\\
+Export determination: 6. \\
+Rationale: NEW:Adding moulin Input capability to the Hydro Model\\
+\vspace{3em}
+
+\noindent \textbf{Change \#884} with diff file ISSM-17445-17446.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/enum/HydrologydcBasalMoulinInputEnum.m\\
+Export determination: 6. \\
+Rationale: NEW: Adding enum\\
+\vspace{3em}
+
+\noindent \textbf{Change \#885} with diff file ISSM-17446-17447.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: CHG: making detection of zero levelset in element more general\\
+\vspace{3em}
+
+\noindent \textbf{Change \#886} with diff file ISSM-17447-17448.diff: \\
+Function name: \\
+A /issm/trunk-jpl/test/Archives/Archive801.nc M /issm/trunk-jpl/test/NightlyRun/IdToName.py A /issm/trunk-jpl/test/NightlyRun/test801.py\\
+Export determination: 6. \\
+Rationale: ADD: Levelset Method NightlyRun: ValleyGlacierLevelsetSSA2d\\
+\vspace{3em}
+
+\noindent \textbf{Change \#887} with diff file ISSM-17448-17449.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive801.nc M /issm/trunk-jpl/test/NightlyRun/test801.py A /issm/trunk-jpl/test/Par/ValleyGlacierShelf.py\\
+Export determination: 6. \\
+Rationale: ADD: Valley glacier parameter file; coarsened resolution; setting ice domain to 2/3 of square.exp\\
+\vspace{3em}
+
+\noindent \textbf{Change \#888} with diff file ISSM-17449-17450.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: CHG: friction in 3d tria (for ssa 3d)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#889} with diff file ISSM-17450-17451.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp\\
+Export determination: 6. \\
+Rationale: BUG: multiple manipulations on vector if running in parallel mode leads to inconsistencies in vector values\\
+\vspace{3em}
+
+\noindent \textbf{Change \#890} with diff file ISSM-17451-17452.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive801.nc A /issm/trunk-jpl/test/Archives/Archive802.nc M /issm/trunk-jpl/test/NightlyRun/IdToName.py M /issm/trunk-jpl/test/NightlyRun/test801.py A /issm/trunk-jpl/test/NightlyRun/test802.py M /issm/trunk-jpl/test/Par/ValleyGlacierShelf.py\\
+Export determination: 6. \\
+Rationale: ADD: Levelset NR ValleyGlacierLevelsetThermalSSA2d; CHG: change test801 to 3 processors\\
+\vspace{3em}
+
+\noindent \textbf{Change \#891} with diff file ISSM-17452-17453.diff: \\
+Function name: \\
+A /issm/trunk-jpl/test/Archives/Archive803.nc M /issm/trunk-jpl/test/NightlyRun/IdToName.py A /issm/trunk-jpl/test/NightlyRun/test803.py M /issm/trunk-jpl/test/Par/ValleyGlacierShelf.py\\
+Export determination: 6. \\
+Rationale: ADD: Levelset NR 803: ValleyGlacierLevelsetEnthalpyHO3d\\
+\vspace{3em}
+
+\noindent \textbf{Change \#892} with diff file ISSM-17453-17454.diff: \\
+Function name: \\
+D /issm/trunk-jpl/test/Archives/Archive336.nc M /issm/trunk-jpl/test/NightlyRun/IdToName.m M /issm/trunk-jpl/test/NightlyRun/IdToName.py D /issm/trunk-jpl/test/NightlyRun/test336.m D /issm/trunk-jpl/test/NightlyRun/test336.py\\
+Export determination: 6. \\
+Rationale: DEL: obsolete Levelset nightlyruns\\
+\vspace{3em}
+
+\noindent \textbf{Change \#893} with diff file ISSM-17454-17455.diff: \\
+Function name: \\
+A /issm/trunk-jpl/test/Archives/Archive804.nc A /issm/trunk-jpl/test/Archives/Archive805.nc M /issm/trunk-jpl/test/NightlyRun/IdToName.py M /issm/trunk-jpl/test/NightlyRun/test803.py A /issm/trunk-jpl/test/NightlyRun/test804.py A /issm/trunk-jpl/test/NightlyRun/test805.py\\
+Export determination: 6. \\
+Rationale: ADD: Levelset method NRs: ValleyGlacierLevelsetCalvingSIA2d \& ValleyGlacierLevelsetEnthCalvingHO3d\\
+\vspace{3em}
+
+\noindent \textbf{Change \#894} with diff file ISSM-17455-17456.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/materials/cuffey.m A /issm/trunk-jpl/src/m/materials/cuffey.py M /issm/trunk-jpl/src/m/materials/paterson.m\\
+Export determination: 6. \\
+Rationale: NEW: added cuffey rigidity parameter\\
+\vspace{3em}
+
+\noindent \textbf{Change \#895} with diff file ISSM-17456-17457.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/matice.m M /issm/trunk-jpl/src/m/classes/matice.py\\
+Export determination: 6. \\
+Rationale: NEW: added cuffey rigidity parameter\\
+\vspace{3em}
+
+\noindent \textbf{Change \#896} with diff file ISSM-17457-17458.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/Makefile.am A /issm/trunk-jpl/src/c/shared/Elements/Cuffey.cpp M /issm/trunk-jpl/src/c/shared/Elements/Paterson.cpp M /issm/trunk-jpl/src/c/shared/Elements/elements.h M /issm/trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp\\
+Export determination: 6. \\
+Rationale: NEW: added Cuffey.cpp\\
+\vspace{3em}
+
+\noindent \textbf{Change \#897} with diff file ISSM-17458-17459.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim\\
+Export determination: 6. \\
+Rationale: CHG: syncing syntax highlight\\
+\vspace{3em}
+
+\noindent \textbf{Change \#898} with diff file ISSM-17459-17460.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp\\
+Export determination: 6. \\
+Rationale: NEW: added CuffeyEnum\\
+\vspace{3em}
+
+\noindent \textbf{Change \#899} with diff file ISSM-17460-17461.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/enum/CuffeyEnum.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py\\
+Export determination: 6. \\
+Rationale: NEW: added CuffeyEnum\\
+\vspace{3em}
+
+\noindent \textbf{Change \#900} with diff file ISSM-17461-17462.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/clusters/greenplanet.m\\
+Export determination: 6. \\
+Rationale: NEW : adding walltime and memory limit\\
+\vspace{3em}
+
+\noindent \textbf{Change \#901} with diff file ISSM-17462-17463.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive801.nc M /issm/trunk-jpl/test/Archives/Archive802.nc M /issm/trunk-jpl/test/Archives/Archive803.nc M /issm/trunk-jpl/test/Archives/Archive804.nc M /issm/trunk-jpl/test/Archives/Archive805.nc M /issm/trunk-jpl/test/NightlyRun/test801.py M /issm/trunk-jpl/test/NightlyRun/test802.py M /issm/trunk-jpl/test/NightlyRun/test805.py M /issm/trunk-jpl/test/Par/ValleyGlacierShelf.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxing tolerances, adding slope in y direction for geometry\\
+\vspace{3em}
+
+\noindent \textbf{Change \#902} with diff file ISSM-17463-17464.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/FemModel.cpp M /issm/trunk-jpl/src/c/cores/transient\_core.cpp M /issm/trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp\\
+Export determination: 6. \\
+Rationale: minor: cleanup code\\
+\vspace{3em}
+
+\noindent \textbf{Change \#903} with diff file ISSM-17464-17465.diff: \\
+Function name: \\
+A /issm/trunk-jpl/test/NightlyRun/test801.m M /issm/trunk-jpl/test/NightlyRun/test801.py A /issm/trunk-jpl/test/NightlyRun/test802.m A /issm/trunk-jpl/test/NightlyRun/test803.m A /issm/trunk-jpl/test/NightlyRun/test804.m A /issm/trunk-jpl/test/NightlyRun/test805.m\\
+Export determination: 6. \\
+Rationale: ADD: Matlab NRs for level set method\\
+\vspace{3em}
+
+\noindent \textbf{Change \#904} with diff file ISSM-17465-17466.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/extrusion/project3d.m M /issm/trunk-jpl/src/m/extrusion/project3d.py\\
+Export determination: 6. \\
+Rationale: CHG: no more dimensions, look for meshtype\\
+\vspace{3em}
+
+\noindent \textbf{Change \#905} with diff file ISSM-17466-17467.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/parameterization/setflowequation.py\\
+Export determination: 6. \\
+Rationale: CHG: HO and FS now available for 2d flowbands\\
+\vspace{3em}
+
+\noindent \textbf{Change \#906} with diff file ISSM-17467-17468.diff: \\
+Function name: \\
+A /issm/trunk-jpl/test/Par/ValleyGlacierShelf.par\\
+Export determination: 6. \\
+Rationale: ADD: Matlab parameter file for ValleyGlacier setup\\
+\vspace{3em}
+
+\noindent \textbf{Change \#907} with diff file ISSM-17468-17469.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test801.m M /issm/trunk-jpl/test/NightlyRun/test802.m M /issm/trunk-jpl/test/NightlyRun/test803.m M /issm/trunk-jpl/test/NightlyRun/test804.m M /issm/trunk-jpl/test/NightlyRun/test805.m\\
+Export determination: 6. \\
+Rationale: minor: semicolons\\
+\vspace{3em}
+
+\noindent \textbf{Change \#908} with diff file ISSM-17469-17470.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Par/ValleyGlacierShelf.par\\
+Export determination: 6. \\
+Rationale: minor: more semicolons\\
+\vspace{3em}
+
+\noindent \textbf{Change \#909} with diff file ISSM-17470-17471.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/IdToName.m M /issm/trunk-jpl/test/NightlyRun/test801.m M /issm/trunk-jpl/test/NightlyRun/test802.m M /issm/trunk-jpl/test/NightlyRun/test803.m M /issm/trunk-jpl/test/NightlyRun/test803.py M /issm/trunk-jpl/test/NightlyRun/test804.m M /issm/trunk-jpl/test/NightlyRun/test805.m M /issm/trunk-jpl/test/NightlyRun/test805.py M /issm/trunk-jpl/test/Par/ValleyGlacierShelf.par\\
+Export determination: 6. \\
+Rationale: BUG: fixed level set tests in matlab\\
+\vspace{3em}
+
+\noindent \textbf{Change \#910} with diff file ISSM-17471-17472.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/thermal.py\\
+Export determination: 6. \\
+Rationale: CHG: make python's checkconsistency consistent to matlab's one\\
+\vspace{3em}
+
+\noindent \textbf{Change \#911} with diff file ISSM-17472-17473.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/Makefile.am M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.cpp M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tetra.h M /issm/trunk-jpl/src/c/classes/Elements/TetraRef.cpp M /issm/trunk-jpl/src/c/classes/Elements/TetraRef.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h A /issm/trunk-jpl/src/c/classes/Inputs/TetraInput.cpp A /issm/trunk-jpl/src/c/classes/Inputs/TetraInput.h M /issm/trunk-jpl/src/c/classes/classes.h M /issm/trunk-jpl/src/c/classes/gauss/GaussTetra.cpp M /issm/trunk-jpl/src/c/classes/gauss/GaussTetra.h M /issm/trunk-jpl/src/c/modules/MeshPartitionx/MeshPartitionx.h M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp\\
+Export determination: 6. \\
+Rationale: NEW: working on Tetra elements\\
+\vspace{3em}
+
+\noindent \textbf{Change \#912} with diff file ISSM-17473-17474.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/Mesh3DtetrasEnum.m\\
+Export determination: 6. \\
+Rationale: CHG: syncing enums\\
+\vspace{3em}
+
+\noindent \textbf{Change \#913} with diff file ISSM-17474-17475.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plot\_highlightelements.m M /issm/trunk-jpl/src/m/plot/plot\_mesh.m M /issm/trunk-jpl/src/m/plot/processdata.m M /issm/trunk-jpl/src/m/plot/processmesh.m\\
+Export determination: 6. \\
+Rationale: CHG: some changes to display results on tetra mesh, stop looking for md.mesh.dimension\\
+\vspace{3em}
+
+\noindent \textbf{Change \#914} with diff file ISSM-17475-17476.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.m M /issm/trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py\\
+Export determination: 6. \\
+Rationale: CHG: stop looking for md.mesh.dimension\\
+\vspace{3em}
+
+\noindent \textbf{Change \#915} with diff file ISSM-17476-17477.diff: \\
+Function name: \\
+D /issm/trunk-jpl/src/m/mesh/planet/planetmesher.m D /issm/trunk-jpl/src/m/mesh/planet/planetmixedmesh.m M /issm/trunk-jpl/src/m/mesh/planet/planettrimesh.m\\
+Export determination: 6. \\
+Rationale: DEL removed some unused files\\
+\vspace{3em}
+
+\noindent \textbf{Change \#916} with diff file ISSM-17477-17478.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py\\
+Export determination: 6. \\
+Rationale: BUG: fixed python version\\
+\vspace{3em}
+
+\noindent \textbf{Change \#917} with diff file ISSM-17478-17479.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test803.m M /issm/trunk-jpl/test/NightlyRun/test803.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxed some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#918} with diff file ISSM-17479-17480.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/Numerics/GaussPoints.cpp M /issm/trunk-jpl/src/c/shared/Numerics/GaussPoints.h\\
+Export determination: 6. \\
+Rationale: BUG: fixinf AD compilation, gauss tetra needs to have IssmDouble and not PDouble\\
+\vspace{3em}
+
+\noindent \textbf{Change \#919} with diff file ISSM-17480-17481.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/boundaryconditions/SetIceSheetBC.py M /issm/trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py M /issm/trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py M /issm/trunk-jpl/src/m/classes/clusters/generic.py M /issm/trunk-jpl/src/m/classes/damage.py M /issm/trunk-jpl/src/m/classes/dependent.py M /issm/trunk-jpl/src/m/classes/flowequation.py M /issm/trunk-jpl/src/m/classes/groundingline.py M /issm/trunk-jpl/src/m/classes/independent.py M /issm/trunk-jpl/src/m/classes/initialization.py M /issm/trunk-jpl/src/m/classes/mesh.py M /issm/trunk-jpl/src/m/classes/mesh2d.py M /issm/trunk-jpl/src/m/classes/pairoptions.py M /issm/trunk-jpl/src/m/classes/plotoptions.py M /issm/trunk-jpl/src/m/classes/qmu.py M /issm/trunk-jpl/src/m/classes/results.py M /issm/trunk-jpl/src/m/classes/stressbalance.py M /issm/trunk-jpl/src/m/classes/toolkits.py M /issm/trunk-jpl/src/m/classes/verbose.py M /issm/trunk-jpl/src/m/consistency/checkfield.py M /issm/trunk-jpl/src/m/contrib/bamg/YamsCall.py M /issm/trunk-jpl/src/m/exp/expcoarsen.py M /issm/trunk-jpl/src/m/exp/expread.py M /issm/trunk-jpl/src/m/extrusion/project3d.py M /issm/trunk-jpl/src/m/geometry/FlagElements.py M /issm/trunk-jpl/src/m/mesh/ComputeHessian.py M /issm/trunk-jpl/src/m/mesh/bamg.py M /issm/trunk-jpl/src/m/mesh/rifts/meshprocessoutsiderifts.py M /issm/trunk-jpl/src/m/mesh/triangle.py M /issm/trunk-jpl/src/m/miscellaneous/fielddisplay.py M /issm/trunk-jpl/src/m/os/issmdir.py M /issm/trunk-jpl/src/m/os/issmscpin.py M /issm/trunk-jpl/src/m/os/issmscpout.py M /issm/trunk-jpl/src/m/os/issmssh.py M /issm/trunk-jpl/src/m/parameterization/setflowequation.py M /issm/trunk-jpl/src/m/solve/WriteData.py M /issm/trunk-jpl/src/m/solve/loadresultsfromcluster.py M /issm/trunk-jpl/src/m/solve/loadresultsfromdisk.py M /issm/trunk-jpl/src/m/solve/parseresultsfromdisk.py M /issm/trunk-jpl/src/m/solve/solve.py M /issm/trunk-jpl/src/m/solve/waitonlock.py\\
+Export determination: 6. \\
+Rationale: CHG: cleaning up python imports. Use "m" prefix when using MatlabFuncs so that users can track down where these functions are defined rather than assuming they are mysterious python built-ins. Avoid importing Archive Forms oecreview.sh TEMP Template when possible, which cleans up the namespace and makes sure each module imports only what it needs (and that modules are not using functions imported by another module, which can break the code if modules are moved around)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#920} with diff file ISSM-17481-17482.diff: \\
+Function name: \\
+A /issm/trunk-jpl/externalpackages/fti A /issm/trunk-jpl/externalpackages/fti/Makefile A /issm/trunk-jpl/externalpackages/fti/install.sh\\
+Export determination: 6. \\
+Rationale: NEW: added fti for checkpointing\\
+\vspace{3em}
+
+\noindent \textbf{Change \#921} with diff file ISSM-17482-17483.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plot\_unit.m\\
+Export determination: 6. \\
+Rationale: CHG: preparing plot for tetras\\
+\vspace{3em}
+
+\noindent \textbf{Change \#922} with diff file ISSM-17483-17484.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/classes/mesh3dtetras.m M /issm/trunk-jpl/src/m/classes/model.m\\
+Export determination: 6. \\
+Rationale: NEW: added tetras method in model that splits mesh3dprism into mesh3dtetra\\
+\vspace{3em}
+
+\noindent \textbf{Change \#923} with diff file ISSM-17484-17485.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing numberofvertices\\
+\vspace{3em}
+
+\noindent \textbf{Change \#924} with diff file ISSM-17485-17486.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/gauss/GaussTetra.cpp\\
+Export determination: 6. \\
+Rationale: CHG: fixed volume of reference tetra:\\
+\vspace{3em}
+
+\noindent \textbf{Change \#925} with diff file ISSM-17486-17487.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/TetraRef.cpp\\
+Export determination: 6. \\
+Rationale: BUG: got Jacobian rightvim TetraRef.cpp\\
+\vspace{3em}
+
+\noindent \textbf{Change \#926} with diff file ISSM-17487-17488.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp\\
+Export determination: 6. \\
+Rationale: BUG: make ElementsAndVerticesPartitioning work for any type of mesh\\
+\vspace{3em}
+
+\noindent \textbf{Change \#927} with diff file ISSM-17488-17489.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/model.py M /issm/trunk-jpl/src/m/exp/expread.py M /issm/trunk-jpl/src/m/mesh/ComputeHessian.py M /issm/trunk-jpl/src/m/parameterization/contourenvelope.py M /issm/trunk-jpl/src/m/parameterization/setmask.py\\
+Export determination: 6. \\
+Rationale: BUG: missed a few changes after updating the import of MatlabFuncs\\
+\vspace{3em}
+
+\noindent \textbf{Change \#928} with diff file ISSM-17489-17490.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp\\
+Export determination: 6. \\
+Rationale: CHG: removed some comments\\
+\vspace{3em}
+
+\noindent \textbf{Change \#929} with diff file ISSM-17490-17491.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp M /issm/trunk-jpl/src/c/classes/Elements/TetraRef.cpp M /issm/trunk-jpl/src/c/classes/gauss/GaussTetra.cpp M /issm/trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/EdgesPartitioning.cpp M /issm/trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp\\
+Export determination: 6. \\
+Rationale: NEW: P1bubble implemented for tetras\\
+\vspace{3em}
+
+\noindent \textbf{Change \#930} with diff file ISSM-17491-17492.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp\\
+Export determination: 6. \\
+Rationale: NEW: done with Tetra P1bubblecondensed\\
+\vspace{3em}
+
+\noindent \textbf{Change \#931} with diff file ISSM-17492-17493.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp\\
+Export determination: 6. \\
+Rationale: CHG: reverting back\\
+\vspace{3em}
+
+\noindent \textbf{Change \#932} with diff file ISSM-17493-17494.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tetra.h M /issm/trunk-jpl/src/c/classes/Elements/TetraRef.cpp M /issm/trunk-jpl/src/c/classes/Elements/TetraRef.h\\
+Export determination: 6. \\
+Rationale: CHG: working on MINI elements FS\\
+\vspace{3em}
+
+\noindent \textbf{Change \#933} with diff file ISSM-17494-17495.diff: \\
+Function name: \\
+M /issm/trunk-jpl/m4/issm\_options.m4 M /issm/trunk-jpl/src/c/Makefile.am A /issm/trunk-jpl/src/c/analyses/DepthAverageAnalysis.cpp A /issm/trunk-jpl/src/c/analyses/DepthAverageAnalysis.h M /issm/trunk-jpl/src/c/analyses/EnumToAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/analyses.h A /issm/trunk-jpl/src/c/cores/depthaverage\_core.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp\\
+Export determination: 6. \\
+Rationale: NEW: working on depthaveraging method\\
+\vspace{3em}
+
+\noindent \textbf{Change \#934} with diff file ISSM-17495-17496.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp\\
+Export determination: 6. \\
+Rationale: CHG: reverting back\\
+\vspace{3em}
+
+\noindent \textbf{Change \#935} with diff file ISSM-17496-17497.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/parameterization/setflowequation.py\\
+Export determination: 6. \\
+Rationale: BUG: missed a couple references to PythonFuncs\\
+\vspace{3em}
+
+\noindent \textbf{Change \#936} with diff file ISSM-17497-17498.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/SMB.py M /issm/trunk-jpl/src/m/classes/SMBgradients.py M /issm/trunk-jpl/src/m/classes/SMBpdd.py M /issm/trunk-jpl/src/m/classes/autodiff.py M /issm/trunk-jpl/src/m/classes/balancethickness.py M /issm/trunk-jpl/src/m/classes/basalforcings.py M /issm/trunk-jpl/src/m/classes/constants.py M /issm/trunk-jpl/src/m/classes/flaim.py M /issm/trunk-jpl/src/m/classes/friction.py M /issm/trunk-jpl/src/m/classes/geometry.py M /issm/trunk-jpl/src/m/classes/gia.py M /issm/trunk-jpl/src/m/classes/hydrologydc.py M /issm/trunk-jpl/src/m/classes/hydrologyshreve.py M /issm/trunk-jpl/src/m/classes/inversion.py M /issm/trunk-jpl/src/m/classes/mask.py M /issm/trunk-jpl/src/m/classes/massfluxatgate.py M /issm/trunk-jpl/src/m/classes/masstransport.py M /issm/trunk-jpl/src/m/classes/matice.py M /issm/trunk-jpl/src/m/classes/miscellaneous.py M /issm/trunk-jpl/src/m/classes/organizer.py M /issm/trunk-jpl/src/m/classes/outputdefinition.py M /issm/trunk-jpl/src/m/classes/private.py M /issm/trunk-jpl/src/m/classes/rifts.py M /issm/trunk-jpl/src/m/classes/settings.py M /issm/trunk-jpl/src/m/classes/steadystate.py M /issm/trunk-jpl/src/m/classes/thermal.py M /issm/trunk-jpl/src/m/classes/timestepping.py M /issm/trunk-jpl/src/m/classes/transient.py M /issm/trunk-jpl/src/m/io/loadmodel.py M /issm/trunk-jpl/src/m/mesh/ElementsFromEdge.py M /issm/trunk-jpl/src/m/mesh/meshconvert.py M /issm/trunk-jpl/src/m/mesh/rifts/meshprocessrifts.py M /issm/trunk-jpl/src/m/mesh/roundmesh.py M /issm/trunk-jpl/src/m/mesh/squaremesh.py M /issm/trunk-jpl/src/m/parameterization/contourenvelope.py M /issm/trunk-jpl/src/m/parameterization/setflowequation.py M /issm/trunk-jpl/src/m/parameterization/setmask.py M /issm/trunk-jpl/src/m/plot/plot\_manager.py M /issm/trunk-jpl/src/m/plot/plotmodel.py M /issm/trunk-jpl/src/m/solve/marshall.py M /issm/trunk-jpl/src/m/solvers/asmoptions.py M /issm/trunk-jpl/src/m/solvers/iluasmoptions.py M /issm/trunk-jpl/src/m/solvers/issmgslsolver.py M /issm/trunk-jpl/src/m/solvers/issmmumpssolver.py M /issm/trunk-jpl/src/m/solvers/jacobiasmoptions.py M /issm/trunk-jpl/src/m/solvers/jacobicgoptions.py M /issm/trunk-jpl/src/m/solvers/matlaboptions.py M /issm/trunk-jpl/src/m/solvers/mumpsoptions.py M /issm/trunk-jpl/src/m/solvers/soroptions.py M /issm/trunk-jpl/src/m/solvers/stokesoptions.py\\
+Export determination: 6. \\
+Rationale: CHG: cleaning up import Archive Forms oecreview.sh TEMP Template statements, caught a few missing modules\\
+\vspace{3em}
+
+\noindent \textbf{Change \#937} with diff file ISSM-17498-17499.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/enum/DepthAverageAnalysisEnum.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/InputToDepthaverageEnum.m\\
+Export determination: 6. \\
+Rationale: CHG: syncing enums\\
+\vspace{3em}
+
+\noindent \textbf{Change \#938} with diff file ISSM-17499-17500.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test101.py M /issm/trunk-jpl/test/NightlyRun/test202.py M /issm/trunk-jpl/test/NightlyRun/test203.py M /issm/trunk-jpl/test/NightlyRun/test204.py M /issm/trunk-jpl/test/NightlyRun/test205.py M /issm/trunk-jpl/test/NightlyRun/test206.py M /issm/trunk-jpl/test/NightlyRun/test207.py M /issm/trunk-jpl/test/NightlyRun/test208.py M /issm/trunk-jpl/test/NightlyRun/test209.py M /issm/trunk-jpl/test/NightlyRun/test211.py M /issm/trunk-jpl/test/NightlyRun/test212.py M /issm/trunk-jpl/test/NightlyRun/test213.py M /issm/trunk-jpl/test/NightlyRun/test214.py M /issm/trunk-jpl/test/NightlyRun/test215.py M /issm/trunk-jpl/test/NightlyRun/test216.py M /issm/trunk-jpl/test/NightlyRun/test217.py M /issm/trunk-jpl/test/NightlyRun/test219.py M /issm/trunk-jpl/test/NightlyRun/test220.py M /issm/trunk-jpl/test/NightlyRun/test237.py\\
+Export determination: 6. \\
+Rationale: BUG: NR's need to import generic class\\
+\vspace{3em}
+
+\noindent \textbf{Change \#939} with diff file ISSM-17500-17501.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/parameterization/setmask.py\\
+Export determination: 6. \\
+Rationale: BUG: missed import\\
+\vspace{3em}
+
+\noindent \textbf{Change \#940} with diff file ISSM-17501-17502.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/organizer.py\\
+Export determination: 6. \\
+Rationale: BUG: missed import\\
+\vspace{3em}
+
+\noindent \textbf{Change \#941} with diff file ISSM-17502-17503.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/plotoptions.py M /issm/trunk-jpl/src/m/plot/plotmodel.py\\
+Export determination: 6. \\
+Rationale: BUG: instantiation of pairoptions in plotoptions\\
+\vspace{3em}
+
+\noindent \textbf{Change \#942} with diff file ISSM-17503-17504.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.h M /issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp\\
+Export determination: 6. \\
+Rationale: CHG: Levelsetfunction initialization routine to solve penalization scheme in a transient fashion with artificial time steps\\
+\vspace{3em}
+
+\noindent \textbf{Change \#943} with diff file ISSM-17504-17505.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.cpp M /issm/trunk-jpl/src/c/classes/gauss/GaussPenta.cpp\\
+Export determination: 6. \\
+Rationale: CHG: cosmetics\\
+\vspace{3em}
+
+\noindent \textbf{Change \#944} with diff file ISSM-17505-17506.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test210.py\\
+Export determination: 6. \\
+Rationale: BUG: missed cluster import\\
+\vspace{3em}
+
+\noindent \textbf{Change \#945} with diff file ISSM-17506-17507.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/SMBpdd.py\\
+Export determination: 6. \\
+Rationale: BUG: missed numpy import\\
+\vspace{3em}
+
+\noindent \textbf{Change \#946} with diff file ISSM-17507-17508.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/bamg/BamgQuadtree.cpp M /issm/trunk-jpl/src/c/bamg/BamgVertex.cpp M /issm/trunk-jpl/src/c/bamg/Geometry.cpp M /issm/trunk-jpl/src/c/bamg/ListofIntersectionTriangles.cpp M /issm/trunk-jpl/src/c/bamg/Mesh.cpp M /issm/trunk-jpl/src/c/bamg/Triangle.cpp\\
+Export determination: 6. \\
+Rationale: CHG: removed all register commands to get rid of (warning: 'register' storage class specifier is deprecated)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#947} with diff file ISSM-17508-17509.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed Dirichlet conditions on faces for P2P4\\
+\vspace{3em}
+
+\noindent \textbf{Change \#948} with diff file ISSM-17509-17510.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/toolkits/objects/Vector.h M /issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscVec.cpp M /issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscVec.h\\
+Export determination: 6. \\
+Rationale: NEW: added Max function to PetscVec\\
+\vspace{3em}
+
+\noindent \textbf{Change \#949} with diff file ISSM-17510-17511.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/extrusion/DepthAverage.m M /issm/trunk-jpl/src/m/extrusion/project2d.m\\
+Export determination: 6. \\
+Rationale: CHG: do not use md.mesh.dimension anymore\\
+\vspace{3em}
+
+\noindent \textbf{Change \#950} with diff file ISSM-17511-17512.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/DepthAverageAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tetra.h M /issm/trunk-jpl/src/c/cores/AnalysisConfiguration.cpp M /issm/trunk-jpl/src/c/cores/cores.h M /issm/trunk-jpl/src/c/cores/depthaverage\_core.cpp M /issm/trunk-jpl/src/c/cores/surfaceslope\_core.cpp\\
+Export determination: 6. \\
+Rationale: NEW: done with depth averaging solution :)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#951} with diff file ISSM-17512-17513.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing numbering of dirichlet on faces P2P4\\
+\vspace{3em}
+
+\noindent \textbf{Change \#952} with diff file ISSM-17513-17514.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/ElementHook.cpp M /issm/trunk-jpl/src/c/classes/Elements/ElementHook.h M /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tetra.h M /issm/trunk-jpl/src/c/classes/Inputs/BoolInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/BoolInput.h M /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.h M /issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.h M /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.h M /issm/trunk-jpl/src/c/classes/Inputs/Input.h M /issm/trunk-jpl/src/c/classes/Inputs/Inputs.cpp M /issm/trunk-jpl/src/c/classes/Inputs/Inputs.h M /issm/trunk-jpl/src/c/classes/Inputs/IntInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/IntInput.h M /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.h M /issm/trunk-jpl/src/c/classes/Inputs/SegInput.h M /issm/trunk-jpl/src/c/classes/Inputs/TetraInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/TetraInput.h M /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.h M /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.h M /issm/trunk-jpl/src/c/classes/Node.cpp M /issm/trunk-jpl/src/c/shared/Exceptions/exceptions.h\\
+Export determination: 6. \\
+Rationale: CHG: working on spawnTria function of Tetra\\
+\vspace{3em}
+
+\noindent \textbf{Change \#953} with diff file ISSM-17514-17515.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/ElementHook.cpp M /issm/trunk-jpl/src/c/classes/Elements/ElementHook.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Inputs/BoolInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/BoolInput.h M /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.h M /issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.h M /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.h M /issm/trunk-jpl/src/c/classes/Inputs/Input.h M /issm/trunk-jpl/src/c/classes/Inputs/Inputs.cpp M /issm/trunk-jpl/src/c/classes/Inputs/IntInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/IntInput.h M /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.h M /issm/trunk-jpl/src/c/classes/Inputs/SegInput.h M /issm/trunk-jpl/src/c/classes/Inputs/TetraInput.h M /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.h M /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.h\\
+Export determination: 6. \\
+Rationale: CHG: removed duplicate SpawnTria that required location only\\
+\vspace{3em}
+
+\noindent \textbf{Change \#954} with diff file ISSM-17515-17516.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tetra.h M /issm/trunk-jpl/src/c/classes/Elements/TetraRef.cpp\\
+Export determination: 6. \\
+Rationale: NEW: working on FS Tetra:\\
+\vspace{3em}
+
+\noindent \textbf{Change \#955} with diff file ISSM-17516-17517.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.cpp M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tetra.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/Loads/Pengrid.cpp M /issm/trunk-jpl/src/c/classes/Loads/Pengrid.h D /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_damage\_nonlinear.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequences.h\\
+Export determination: 6. \\
+Rationale: CHG: cosmetics, removed penalties from damage transient, merged some functions from Tria and Penta to Element\\
+\vspace{3em}
+
+\noindent \textbf{Change \#956} with diff file ISSM-17517-17518.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/Makefile.am\\
+Export determination: 6. \\
+Rationale: BUG: removed ./solutionsequences/solutionsequence\_damage\_nonlinear.cpp from Makefile\\
+\vspace{3em}
+
+\noindent \textbf{Change \#957} with diff file ISSM-17518-17519.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: wrong artificial diffusion caught by Hongju\\
+\vspace{3em}
+
+\noindent \textbf{Change \#958} with diff file ISSM-17519-17520.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: wrong artificial diffusion caught by Hongju\\
+\vspace{3em}
+
+\noindent \textbf{Change \#959} with diff file ISSM-17520-17521.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test1502.m\\
+Export determination: 6. \\
+Rationale: CHG: no verbose needed in Nighlty runs\\
+\vspace{3em}
+
+\noindent \textbf{Change \#960} with diff file ISSM-17521-17522.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: variable 'approximation' is used before its value is set\\
+\vspace{3em}
+
+\noindent \textbf{Change \#961} with diff file ISSM-17522-17523.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/classes/flowequation.m M /issm/trunk-jpl/src/m/classes/flowequation.py M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/XTaylorHoodEnum.m\\
+Export determination: 6. \\
+Rationale: NEW: added new enum for Nathan's LA theta algo\\
+\vspace{3em}
+
+\noindent \textbf{Change \#962} with diff file ISSM-17523-17524.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/m/classes/initialization.m M /issm/trunk-jpl/src/m/classes/model.m\\
+Export determination: 6. \\
+Rationale: CHG: adding an initialization value for the epl thickness\\
+\vspace{3em}
+
+\noindent \textbf{Change \#963} with diff file ISSM-17524-17525.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test3300.m M /issm/trunk-jpl/test/NightlyRun/test333.m M /issm/trunk-jpl/test/NightlyRun/test335.m\\
+Export determination: 6. \\
+Rationale: CHG: updating hydro test to the new initialization method\\
+\vspace{3em}
+
+\noindent \textbf{Change \#964} with diff file ISSM-17525-17526.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/Makefile.am M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/TriaRef.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp A /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_la\_theta.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequences.h\\
+Export determination: 6. \\
+Rationale: CHG: working on XTaylorhood\\
+\vspace{3em}
+
+\noindent \textbf{Change \#965} with diff file ISSM-17526-17527.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: working onXTH\\
+\vspace{3em}
+
+\noindent \textbf{Change \#966} with diff file ISSM-17527-17528.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: BUG: while spawning segments for top, make sure to have consistent elements (x increasing)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#967} with diff file ISSM-17528-17529.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: fixed coupling FS\\
+\vspace{3em}
+
+\noindent \textbf{Change \#968} with diff file ISSM-17529-17530.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/test/Archives/Archive703.nc\\
+Export determination: 6. \\
+Rationale: CHG: fixed indexing on top segments (see Hongju's email)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#969} with diff file ISSM-17530-17531.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/imac-012301-gil\\
+Export determination: 6. \\
+Rationale: CHG: enable development to check moving boundaries\\
+\vspace{3em}
+
+\noindent \textbf{Change \#970} with diff file ISSM-17531-17532.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/imac-012301-gil\\
+Export determination: 6. \\
+Rationale: BUG: fixed syntax:\\
+\vspace{3em}
+
+\noindent \textbf{Change \#971} with diff file ISSM-17532-17533.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: BUG: local coordinates for all elements on the bed thanks to hongju\\
+\vspace{3em}
+
+\noindent \textbf{Change \#972} with diff file ISSM-17533-17534.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/windows\\
+Export determination: 6. \\
+Rationale: CHG: enable development to check moving boundaries\\
+\vspace{3em}
+
+\noindent \textbf{Change \#973} with diff file ISSM-17534-17535.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive104.nc M /issm/trunk-jpl/test/Archives/Archive124.nc M /issm/trunk-jpl/test/Archives/Archive211.nc M /issm/trunk-jpl/test/Archives/Archive215.nc M /issm/trunk-jpl/test/Archives/Archive220.nc M /issm/trunk-jpl/test/Archives/Archive221.nc M /issm/trunk-jpl/test/Archives/Archive503.nc M /issm/trunk-jpl/test/Archives/Archive507.nc M /issm/trunk-jpl/test/Archives/Archive510.nc M /issm/trunk-jpl/test/Archives/Archive511.nc\\
+Export determination: 6. \\
+Rationale: CHG: updating archives for local coordinates ice shelf\\
+\vspace{3em}
+
+\noindent \textbf{Change \#974} with diff file ISSM-17535-17536.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp A /issm/trunk-jpl/src/m/enum/DeviatoricStressEnum.m A /issm/trunk-jpl/src/m/enum/DeviatoricStressxxEnum.m A /issm/trunk-jpl/src/m/enum/DeviatoricStressxyEnum.m A /issm/trunk-jpl/src/m/enum/DeviatoricStressxzEnum.m A /issm/trunk-jpl/src/m/enum/DeviatoricStressyyEnum.m A /issm/trunk-jpl/src/m/enum/DeviatoricStressyzEnum.m A /issm/trunk-jpl/src/m/enum/DeviatoricStresszzEnum.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/StrainRateEnum.m A /issm/trunk-jpl/src/m/enum/StrainRatexxEnum.m A /issm/trunk-jpl/src/m/enum/StrainRatexyEnum.m A /issm/trunk-jpl/src/m/enum/StrainRatexzEnum.m A /issm/trunk-jpl/src/m/enum/StrainRateyyEnum.m A /issm/trunk-jpl/src/m/enum/StrainRateyzEnum.m A /issm/trunk-jpl/src/m/enum/StrainRatezzEnum.m\\
+Export determination: 6. \\
+Rationale: CHG: constructing d and tau from inputs\\
+\vspace{3em}
+
+\noindent \textbf{Change \#975} with diff file ISSM-17536-17537.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.cpp M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tetra.h M /issm/trunk-jpl/src/c/classes/Elements/TetraRef.cpp M /issm/trunk-jpl/src/c/classes/Elements/TetraRef.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/Elements/TriaRef.cpp M /issm/trunk-jpl/src/c/classes/Elements/TriaRef.h\\
+Export determination: 6. \\
+Rationale: CHG: adding Tensor basis functions'\\
+\vspace{3em}
+
+\noindent \textbf{Change \#976} with diff file ISSM-17537-17538.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: creating Dstar matrix\\
+\vspace{3em}
+
+\noindent \textbf{Change \#977} with diff file ISSM-17538-17539.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: done with create P Vector\\
+\vspace{3em}
+
+\noindent \textbf{Change \#978} with diff file ISSM-17539-17540.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h\\
+Export determination: 6. \\
+Rationale: CHG: working on initialization\\
+\vspace{3em}
+
+\noindent \textbf{Change \#979} with diff file ISSM-17540-17541.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/TriaRef.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_la\_theta.cpp\\
+Export determination: 6. \\
+Rationale: CHG: moved initialization to solution sequence\\
+\vspace{3em}
+
+\noindent \textbf{Change \#980} with diff file ISSM-17541-17542.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_la\_theta.cpp\\
+Export determination: 6. \\
+Rationale: NEW: preparing input update from solution XTH\\
+\vspace{3em}
+
+\noindent \textbf{Change \#981} with diff file ISSM-17542-17543.diff: \\
+Function name: \\
+D /issm/trunk-jpl/src/m/shp/Shp2Exp.m A /issm/trunk-jpl/src/m/shp/shp2exp.m (from /issm/trunk-jpl/src/m/shp/Shp2Exp.m:17515) A /issm/trunk-jpl/src/m/shp/shp2exp.py\\
+Export determination: 6. \\
+Rationale: NEW: python version of shp2exp. renamed matlab version for consistency of capitalization with other shp functions\\
+\vspace{3em}
+
+\noindent \textbf{Change \#982} with diff file ISSM-17543-17544.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/Numerics/GaussPoints.cpp M /issm/trunk-jpl/src/c/shared/Numerics/GaussPoints.h\\
+Export determination: 6. \\
+Rationale: NEW: added gauss points for segments up to 7 order\\
+\vspace{3em}
+
+\noindent \textbf{Change \#983} with diff file ISSM-17544-17545.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive104.nc M /issm/trunk-jpl/test/Archives/Archive124.nc M /issm/trunk-jpl/test/Archives/Archive204.nc M /issm/trunk-jpl/test/Archives/Archive211.nc M /issm/trunk-jpl/test/Archives/Archive215.nc M /issm/trunk-jpl/test/Archives/Archive220.nc M /issm/trunk-jpl/test/Archives/Archive221.nc M /issm/trunk-jpl/test/Archives/Archive503.nc M /issm/trunk-jpl/test/Archives/Archive507.nc M /issm/trunk-jpl/test/Archives/Archive511.nc M /issm/trunk-jpl/test/Archives/Archive702.nc M /issm/trunk-jpl/test/Archives/Archive703.nc\\
+Export determination: 6. \\
+Rationale: CHG: updated archives NR\\
+\vspace{3em}
+
+\noindent \textbf{Change \#984} with diff file ISSM-17545-17546.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim\\
+Export determination: 6. \\
+Rationale: CHG: syncing enums\\
+\vspace{3em}
+
+\noindent \textbf{Change \#985} with diff file ISSM-17546-17547.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/Makefile.am M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp A /issm/trunk-jpl/src/c/shared/Numerics/NewtonSolveDnorm.cpp M /issm/trunk-jpl/src/c/shared/Numerics/numerics.h\\
+Export determination: 6. \\
+Rationale: NEW: done with NewtonSolve\\
+\vspace{3em}
+
+\noindent \textbf{Change \#986} with diff file ISSM-17547-17548.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/materials/paterson.py\\
+Export determination: 6. \\
+Rationale: BUG: fixed paterson to accept scalar temperature\\
+\vspace{3em}
+
+\noindent \textbf{Change \#987} with diff file ISSM-17548-17549.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/shared/Matrix/MatrixUtils.cpp M /issm/trunk-jpl/src/c/shared/Matrix/matrix.h\\
+Export determination: 6. \\
+Rationale: CHG: done with updating tau and d\\
+\vspace{3em}
+
+\noindent \textbf{Change \#988} with diff file ISSM-17549-17550.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/TriaRef.cpp\\
+Export determination: 6. \\
+Rationale: CHG: done with updating tau and d\\
+\vspace{3em}
+
+\noindent \textbf{Change \#989} with diff file ISSM-17550-17551.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive435.nc\\
+Export determination: 6. \\
+Rationale: CHG: minor for new gauss points\\
+\vspace{3em}
+
+\noindent \textbf{Change \#990} with diff file ISSM-17551-17552.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/interp/averaging.py A /issm/trunk-jpl/src/m/interp/holefiller.py\\
+Export determination: 6. \\
+Rationale: NEW: python module for filling holes in data using k nearest neighbors\\
+\vspace{3em}
+
+\noindent \textbf{Change \#991} with diff file ISSM-17552-17553.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive510.nc\\
+Export determination: 6. \\
+Rationale: CHG: minor updated archive\\
+\vspace{3em}
+
+\noindent \textbf{Change \#992} with diff file ISSM-17553-17554.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/c/shared/Numerics/NewtonSolveDnorm.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_la\_theta.cpp A /issm/trunk-jpl/src/m/enum/AugmentedLagrangianREnum.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py\\
+Export determination: 6. \\
+Rationale: CHG: done with first version of XTH algorithm\\
+\vspace{3em}
+
+\noindent \textbf{Change \#993} with diff file ISSM-17554-17555.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim\\
+Export determination: 6. \\
+Rationale: CHG: Syncing enums\\
+\vspace{3em}
+
+\noindent \textbf{Change \#994} with diff file ISSM-17555-17556.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MeltingAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/FemModel.cpp M /issm/trunk-jpl/src/c/classes/Loads/Friction.cpp M /issm/trunk-jpl/src/c/classes/Loads/Riftfront.cpp M /issm/trunk-jpl/src/c/classes/Vertex.cpp M /issm/trunk-jpl/src/c/cores/masstransport\_core.cpp M /issm/trunk-jpl/src/c/cores/transient\_core.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/Transient/UpdateElementsTransient.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/classes/geometry.m M /issm/trunk-jpl/src/m/classes/geometry.py M /issm/trunk-jpl/src/m/classes/masstransport.m M /issm/trunk-jpl/src/m/classes/masstransport.py A /issm/trunk-jpl/src/m/enum/BaseEnum.m D /issm/trunk-jpl/src/m/enum/BathymetryEnum.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/QmuBaseEnum.m D /issm/trunk-jpl/src/m/enum/QmuBedEnum.m M /issm/trunk-jpl/test/NightlyRun/test110.m M /issm/trunk-jpl/test/NightlyRun/test110.py M /issm/trunk-jpl/test/NightlyRun/test111.m M /issm/trunk-jpl/test/NightlyRun/test111.py M /issm/trunk-jpl/test/NightlyRun/test1208.m M /issm/trunk-jpl/test/NightlyRun/test1208.py M /issm/trunk-jpl/test/NightlyRun/test122.m M /issm/trunk-jpl/test/NightlyRun/test122.py M /issm/trunk-jpl/test/NightlyRun/test124.m M /issm/trunk-jpl/test/NightlyRun/test1501.m M /issm/trunk-jpl/test/NightlyRun/test1501.py M /issm/trunk-jpl/test/NightlyRun/test1502.m M /issm/trunk-jpl/test/NightlyRun/test1502.py M /issm/trunk-jpl/test/NightlyRun/test208.m M /issm/trunk-jpl/test/NightlyRun/test208.py M /issm/trunk-jpl/test/NightlyRun/test209.m M /issm/trunk-jpl/test/NightlyRun/test209.py M /issm/trunk-jpl/test/NightlyRun/test210.m M /issm/trunk-jpl/test/NightlyRun/test210.py M /issm/trunk-jpl/test/NightlyRun/test211.m M /issm/trunk-jpl/test/NightlyRun/test211.py M /issm/trunk-jpl/test/NightlyRun/test222.m M /issm/trunk-jpl/test/NightlyRun/test222.py M /issm/trunk-jpl/test/NightlyRun/test223.m M /issm/trunk-jpl/test/NightlyRun/test223.py M /issm/trunk-jpl/test/NightlyRun/test224.m M /issm/trunk-jpl/test/NightlyRun/test224.py M /issm/trunk-jpl/test/NightlyRun/test225.m M /issm/trunk-jpl/test/NightlyRun/test225.py M /issm/trunk-jpl/test/NightlyRun/test226.m M /issm/trunk-jpl/test/NightlyRun/test226.py M /issm/trunk-jpl/test/NightlyRun/test227.m M /issm/trunk-jpl/test/NightlyRun/test227.py M /issm/trunk-jpl/test/NightlyRun/test228.m M /issm/trunk-jpl/test/NightlyRun/test228.py M /issm/trunk-jpl/test/NightlyRun/test229.m M /issm/trunk-jpl/test/NightlyRun/test229.py M /issm/trunk-jpl/test/NightlyRun/test230.m M /issm/trunk-jpl/test/NightlyRun/test230.py M /issm/trunk-jpl/test/NightlyRun/test231.m M /issm/trunk-jpl/test/NightlyRun/test231.py M /issm/trunk-jpl/test/NightlyRun/test233.m M /issm/trunk-jpl/test/NightlyRun/test233.py M /issm/trunk-jpl/test/NightlyRun/test236.m M /issm/trunk-jpl/test/NightlyRun/test236.py M /issm/trunk-jpl/test/NightlyRun/test237.m M /issm/trunk-jpl/test/NightlyRun/test237.py M /issm/trunk-jpl/test/NightlyRun/test3010.m M /issm/trunk-jpl/test/NightlyRun/test3010.py M /issm/trunk-jpl/test/NightlyRun/test3110.m M /issm/trunk-jpl/test/NightlyRun/test3110.py M /issm/trunk-jpl/test/NightlyRun/test314.m M /issm/trunk-jpl/test/NightlyRun/test314.py M /issm/trunk-jpl/test/NightlyRun/test315.m M /issm/trunk-jpl/test/NightlyRun/test315.py M /issm/trunk-jpl/test/NightlyRun/test316.m M /issm/trunk-jpl/test/NightlyRun/test316.py M /issm/trunk-jpl/test/NightlyRun/test317.m M /issm/trunk-jpl/test/NightlyRun/test317.py M /issm/trunk-jpl/test/NightlyRun/test323.m M /issm/trunk-jpl/test/NightlyRun/test323.py M /issm/trunk-jpl/test/NightlyRun/test324.m M /issm/trunk-jpl/test/NightlyRun/test324.py M /issm/trunk-jpl/test/NightlyRun/test327.m M /issm/trunk-jpl/test/NightlyRun/test327.py M /issm/trunk-jpl/test/NightlyRun/test328.m M /issm/trunk-jpl/test/NightlyRun/test328.py M /issm/trunk-jpl/test/NightlyRun/test329.m M /issm/trunk-jpl/test/NightlyRun/test329.py M /issm/trunk-jpl/test/NightlyRun/test408.m M /issm/trunk-jpl/test/NightlyRun/test408.py M /issm/trunk-jpl/test/NightlyRun/test409.m M /issm/trunk-jpl/test/NightlyRun/test409.py M /issm/trunk-jpl/test/NightlyRun/test424.m M /issm/trunk-jpl/test/NightlyRun/test424.py M /issm/trunk-jpl/test/NightlyRun/test425.m M /issm/trunk-jpl/test/NightlyRun/test425.py M /issm/trunk-jpl/test/NightlyRun/test426.m M /issm/trunk-jpl/test/NightlyRun/test426.py M /issm/trunk-jpl/test/NightlyRun/test427.m M /issm/trunk-jpl/test/NightlyRun/test427.py M /issm/trunk-jpl/test/NightlyRun/test435.m M /issm/trunk-jpl/test/NightlyRun/test504.m M /issm/trunk-jpl/test/NightlyRun/test504.py M /issm/trunk-jpl/test/NightlyRun/test505.m M /issm/trunk-jpl/test/NightlyRun/test505.py M /issm/trunk-jpl/test/NightlyRun/test506.m M /issm/trunk-jpl/test/NightlyRun/test506.py M /issm/trunk-jpl/test/NightlyRun/test507.m M /issm/trunk-jpl/test/NightlyRun/test507.py M /issm/trunk-jpl/test/NightlyRun/test703.m\\
+Export determination: 6. \\
+Rationale: NEW: renamed Bed -> Base in src/c (matlab to be done)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#995} with diff file ISSM-17556-17557.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/classes/mesh3dprisms.m A /issm/trunk-jpl/src/m/classes/mesh3dprisms.py\\
+Export determination: 6. \\
+Rationale: NEW: added mesh3dprisms\\
+\vspace{3em}
+
+\noindent \textbf{Change \#996} with diff file ISSM-17557-17558.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test1108.m\\
+Export determination: 6. \\
+Rationale: CHG: minor removed verbose of solution\\
+\vspace{3em}
+
+\noindent \textbf{Change \#997} with diff file ISSM-17558-17559.diff: \\
+Function name: \\
+D /issm/trunk-jpl/src/m/classes/mesh.m D /issm/trunk-jpl/src/m/classes/mesh.py M /issm/trunk-jpl/src/m/classes/mesh2d.py M /issm/trunk-jpl/src/m/classes/mesh3dprisms.m M /issm/trunk-jpl/src/m/classes/mesh3dprisms.py M /issm/trunk-jpl/src/m/classes/model.m M /issm/trunk-jpl/src/m/classes/model.py A /issm/trunk-jpl/src/m/classes/oldclasses/mesh.m (from /issm/trunk-jpl/src/m/classes/mesh.m:17553) M /issm/trunk-jpl/src/m/mesh/argusmesh.m M /issm/trunk-jpl/src/m/mesh/bamg.m M /issm/trunk-jpl/src/m/mesh/bamg.py M /issm/trunk-jpl/src/m/mesh/meshconvert.m M /issm/trunk-jpl/src/m/mesh/meshconvert.py M /issm/trunk-jpl/src/m/mesh/rifts/meshaddrifts.m M /issm/trunk-jpl/src/m/mesh/rifts/meshprocessoutsiderifts.m M /issm/trunk-jpl/src/m/mesh/rifts/meshprocessoutsiderifts.py M /issm/trunk-jpl/src/m/mesh/rifts/meshprocessrifts.m M /issm/trunk-jpl/src/m/mesh/rifts/meshprocessrifts.py M /issm/trunk-jpl/src/m/mesh/squaremesh.m M /issm/trunk-jpl/src/m/mesh/squaremesh.py M /issm/trunk-jpl/src/m/mesh/triangle.m M /issm/trunk-jpl/src/m/mesh/triangle.py M /issm/trunk-jpl/src/m/mesh/triangle2dvertical.m M /issm/trunk-jpl/src/m/parameterization/contourenvelope.m M /issm/trunk-jpl/src/m/parameterization/contourenvelope.py\\
+Export determination: 6. \\
+Rationale: NEW: removed old mesh classes, use subclasses instead\\
+\vspace{3em}
+
+\noindent \textbf{Change \#998} with diff file ISSM-17559-17560.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/model.m M /issm/trunk-jpl/src/m/classes/modellist.m M /issm/trunk-jpl/src/m/classes/rifts.m M /issm/trunk-jpl/src/m/classes/rifts.py M /issm/trunk-jpl/src/m/classes/spheremesh.m M /issm/trunk-jpl/src/m/classes/thermal.m M /issm/trunk-jpl/src/m/classes/thermal.py M /issm/trunk-jpl/src/m/contrib/ecco/PropagateFlagsUntilDistance.m M /issm/trunk-jpl/src/m/contrib/hack/tres.m M /issm/trunk-jpl/src/m/contrib/massbalance/divergence.m M /issm/trunk-jpl/src/m/contrib/massbalance/outflux.m M /issm/trunk-jpl/src/m/exp/contourlevelzero.m M /issm/trunk-jpl/src/m/geometry/slope.m M /issm/trunk-jpl/src/m/geometry/slope.py M /issm/trunk-jpl/src/m/interp/SectionValues.m M /issm/trunk-jpl/src/m/interp/averaging.m M /issm/trunk-jpl/src/m/interp/averaging.py M /issm/trunk-jpl/src/m/inversions/velocitymisfit.m M /issm/trunk-jpl/src/m/mech/analyticaldamage.m M /issm/trunk-jpl/src/m/mech/backstressfrominversion.m M /issm/trunk-jpl/src/m/mech/damagefrominversion.m M /issm/trunk-jpl/src/m/mech/mechanicalproperties.m M /issm/trunk-jpl/src/m/mech/strainrateuncert.m M /issm/trunk-jpl/src/m/mech/thomasparams.m M /issm/trunk-jpl/src/m/mesh/bamg.m M /issm/trunk-jpl/src/m/mesh/bamg.py M /issm/trunk-jpl/src/m/partition/AreaAverageOntoPartition.m M /issm/trunk-jpl/src/m/partition/partitioner.m M /issm/trunk-jpl/src/m/plot/plot\_basaldrag.m M /issm/trunk-jpl/src/m/plot/plot\_edges.m M /issm/trunk-jpl/src/m/plot/plot\_icefront.m M /issm/trunk-jpl/src/m/plot/plot\_penalties.m M /issm/trunk-jpl/src/m/plot/plot\_qmu\_mass\_flux\_segments.m M /issm/trunk-jpl/src/m/plot/plot\_referential.m M /issm/trunk-jpl/src/m/plot/plot\_section.m M /issm/trunk-jpl/src/m/plot/plot\_segments.m M /issm/trunk-jpl/src/m/plot/plot\_tensor\_components.m M /issm/trunk-jpl/src/m/plot/plot\_tensor\_principal.m M /issm/trunk-jpl/src/m/plot/plot\_tensor\_principalaxis.m M /issm/trunk-jpl/src/m/plot/plot\_transient\_results.m M /issm/trunk-jpl/src/m/plot/processmesh.py\\
+Export determination: 6. \\
+Rationale: CHG: changing some md.mesh.dimension\\
+\vspace{3em}
+
+\noindent \textbf{Change \#999} with diff file ISSM-17560-17561.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: do not load meshvertexonbed if mesh is 2d\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1000} with diff file ISSM-17561-17562.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp\\
+Export determination: 6. \\
+Rationale: CHG: Fixing dirichlet for P2 and P2xP4\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1001} with diff file ISSM-17562-17563.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/mesh2d.m M /issm/trunk-jpl/src/m/classes/mesh2d.py M /issm/trunk-jpl/src/m/classes/mesh2dvertical.m M /issm/trunk-jpl/src/m/classes/mesh3dprisms.m M /issm/trunk-jpl/src/m/classes/mesh3dprisms.py M /issm/trunk-jpl/src/m/classes/mesh3dtetras.m M /issm/trunk-jpl/src/m/classes/model.m M /issm/trunk-jpl/src/m/classes/model.py\\
+Export determination: 6. \\
+Rationale: BUG: spctemperature were not set correctly because 2d meshes do not have vertexonsurface anymore\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1002} with diff file ISSM-17563-17564.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/model.m M /issm/trunk-jpl/src/m/classes/model.py M /issm/trunk-jpl/src/m/classes/rifts.py M /issm/trunk-jpl/src/m/classes/thermal.py\\
+Export determination: 6. \\
+Rationale: BUG: fixing some tests now that subclasses are used for md.mesh\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1003} with diff file ISSM-17564-17565.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp M /issm/trunk-jpl/src/m/classes/model.m M /issm/trunk-jpl/src/m/classes/model.py\\
+Export determination: 6. \\
+Rationale: BUG: fixing some issues realted to mesh subclasses\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1004} with diff file ISSM-17565-17566.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/model.m M /issm/trunk-jpl/src/m/classes/model.py\\
+Export determination: 6. \\
+Rationale: BUG: fixing extract 3D\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1005} with diff file ISSM-17566-17567.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/model.m\\
+Export determination: 6. \\
+Rationale: CHG: fixed load of old mesh classes\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1006} with diff file ISSM-17567-17568.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/boundaryconditions/PattynSMB.m A /issm/trunk-jpl/src/m/boundaryconditions/PattynSMB.py\\
+Export determination: 6. \\
+Rationale: CHG: generate SMB in Antarctica from simple semi-empirical considerations.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1007} with diff file ISSM-17568-17569.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/applyoptions.m\\
+Export determination: 6. \\
+Rationale: CHG: added marker size option\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1008} with diff file ISSM-17569-17570.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/solve/waitonlock.m M /issm/trunk-jpl/src/m/solve/waitonlock.py\\
+Export determination: 6. \\
+Rationale: CHG: shortening wait on lock.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1009} with diff file ISSM-17570-17571.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_la\_theta.cpp\\
+Export determination: 6. \\
+Rationale: CHG: fixed issues with AD compile.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1010} with diff file ISSM-17571-17572.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/solve/waitonlock.m\\
+Export determination: 6. \\
+Rationale: BUG: fixing waitonlock for acenet\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1011} with diff file ISSM-17572-17573.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp A /issm/trunk-jpl/src/m/enum/ContactEnum.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py\\
+Export determination: 6. \\
+Rationale: NEW: new GL migration option for FS based on contact mechanics\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1012} with diff file ISSM-17573-17574.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test435.m\\
+Export determination: 6. \\
+Rationale: CHG: minor tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1013} with diff file ISSM-17574-17575.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/solve/waitonlock.py\\
+Export determination: 6. \\
+Rationale: BUG: fixed gethostname\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1014} with diff file ISSM-17575-17576.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/miscellaneous/vorticity.m\\
+Export determination: 6. \\
+Rationale: NEW: added vorticity.m\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1015} with diff file ISSM-17576-17577.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/processmesh.m\\
+Export determination: 6. \\
+Rationale: BUG: fixed processmesh for 2d meshes\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1016} with diff file ISSM-17577-17578.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/processmesh.m\\
+Export determination: 6. \\
+Rationale: BUG: fixed processmesh for 2d meshes\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1017} with diff file ISSM-17578-17579.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/processmesh.m\\
+Export determination: 6. \\
+Rationale: CHG: fixed simple name bug.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1018} with diff file ISSM-17579-17580.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tetra.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp M /issm/trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.h M /issm/trunk-jpl/src/m/classes/groundingline.m M /issm/trunk-jpl/src/m/classes/groundingline.py\\
+Export determination: 6. \\
+Rationale: NEW: added FS contact method for GL (not implemented yet)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1019} with diff file ISSM-17580-17581.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: NEW: added FS contact method for GL (not implemented yet)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1020} with diff file ISSM-17581-17582.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/processmesh.py\\
+Export determination: 6. \\
+Rationale: BUG: missed import of MatlabFuncs\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1021} with diff file ISSM-17582-17583.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: CHG: some minor details in FS contact migration\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1022} with diff file ISSM-17583-17584.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing compilation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1023} with diff file ISSM-17584-17585.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp M /issm/trunk-jpl/test/Archives/Archive703.nc\\
+Export determination: 6. \\
+Rationale: NEW: fixing constraints at the bed for grounded free surface bed\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1024} with diff file ISSM-17585-17586.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MeltingAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tetra.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/Loads/Pengrid.cpp\\
+Export determination: 6. \\
+Rationale: CHG: renaming OnBed OnBase for consistency\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1025} with diff file ISSM-17586-17587.diff: \\
+Function name: \\
+D /issm/trunk-jpl/CMakeLists.txt D /issm/trunk-jpl/m4/issm\_options.cmake D /issm/trunk-jpl/src/CMakeLists.txt D /issm/trunk-jpl/src/c/CMakeLists.txt\\
+Export determination: 6. \\
+Rationale: CHG: removing cmake files, Gil is giving up the idea\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1026} with diff file ISSM-17587-17588.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/coordsystems/ll2xy.py\\
+Export determination: 6. \\
+Rationale: NEW: python version of ll2xy\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1027} with diff file ISSM-17588-17589.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/model.py M /issm/trunk-jpl/src/m/parameterization/contourenvelope.py\\
+Export determination: 6. \\
+Rationale: BUG: class mesh does not exist anymore\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1028} with diff file ISSM-17589-17590.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/mesh3dprisms.m\\
+Export determination: 6. \\
+Rationale: BUG: fixed mesh3dprisms constructor\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1029} with diff file ISSM-17590-17591.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/geometry.m M /issm/trunk-jpl/src/m/classes/geometry.py M /issm/trunk-jpl/src/m/classes/groundingline.m M /issm/trunk-jpl/src/m/classes/groundingline.py M /issm/trunk-jpl/src/m/classes/mesh3dprisms.m M /issm/trunk-jpl/src/m/classes/mesh3dtetras.m M /issm/trunk-jpl/src/m/classes/model.m M /issm/trunk-jpl/src/m/classes/model.py M /issm/trunk-jpl/src/m/contrib/hydrology/effectivepressure.m M /issm/trunk-jpl/src/m/geometry/ThicknessCorrection.m M /issm/trunk-jpl/src/m/interp/ProfileValues.m M /issm/trunk-jpl/src/m/interp/SectionValues.m M /issm/trunk-jpl/src/m/mech/basalstress.m M /issm/trunk-jpl/src/m/plot/plot\_basaldrag.m M /issm/trunk-jpl/test/NightlyRun/test217.m M /issm/trunk-jpl/test/NightlyRun/test217.py M /issm/trunk-jpl/test/NightlyRun/test218.m M /issm/trunk-jpl/test/NightlyRun/test223.m M /issm/trunk-jpl/test/NightlyRun/test223.py M /issm/trunk-jpl/test/NightlyRun/test225.m M /issm/trunk-jpl/test/NightlyRun/test225.py M /issm/trunk-jpl/test/NightlyRun/test3015.m M /issm/trunk-jpl/test/NightlyRun/test3015.py M /issm/trunk-jpl/test/NightlyRun/test3020.m M /issm/trunk-jpl/test/NightlyRun/test3020.py M /issm/trunk-jpl/test/NightlyRun/test423.m M /issm/trunk-jpl/test/NightlyRun/test423.py M /issm/trunk-jpl/test/NightlyRun/test424.m M /issm/trunk-jpl/test/NightlyRun/test424.py M /issm/trunk-jpl/test/NightlyRun/test425.m M /issm/trunk-jpl/test/NightlyRun/test425.py M /issm/trunk-jpl/test/NightlyRun/test426.m M /issm/trunk-jpl/test/NightlyRun/test426.py M /issm/trunk-jpl/test/NightlyRun/test427.m M /issm/trunk-jpl/test/NightlyRun/test427.py M /issm/trunk-jpl/test/NightlyRun/test435.m M /issm/trunk-jpl/test/NightlyRun/test511.m M /issm/trunk-jpl/test/NightlyRun/test511.py M /issm/trunk-jpl/test/NightlyRun/test701.m M /issm/trunk-jpl/test/NightlyRun/test702.m M /issm/trunk-jpl/test/NightlyRun/test703.m M /issm/trunk-jpl/test/Par/79North.par M /issm/trunk-jpl/test/Par/79North.py M /issm/trunk-jpl/test/Par/GiaBenchmarksAB.par M /issm/trunk-jpl/test/Par/GiaBenchmarksCD.par M /issm/trunk-jpl/test/Par/ISMIPA.par M /issm/trunk-jpl/test/Par/ISMIPA.py M /issm/trunk-jpl/test/Par/ISMIPB.par M /issm/trunk-jpl/test/Par/ISMIPB.py M /issm/trunk-jpl/test/Par/ISMIPC.par M /issm/trunk-jpl/test/Par/ISMIPC.py M /issm/trunk-jpl/test/Par/ISMIPD.par M /issm/trunk-jpl/test/Par/ISMIPD.py M /issm/trunk-jpl/test/Par/ISMIPE.par M /issm/trunk-jpl/test/Par/ISMIPE.py M /issm/trunk-jpl/test/Par/ISMIPF.par M /issm/trunk-jpl/test/Par/ISMIPF.py M /issm/trunk-jpl/test/Par/Pig.par M /issm/trunk-jpl/test/Par/Pig.py M /issm/trunk-jpl/test/Par/RoundSheetEISMINT.par M /issm/trunk-jpl/test/Par/RoundSheetEISMINT.py M /issm/trunk-jpl/test/Par/RoundSheetShelf.par M /issm/trunk-jpl/test/Par/RoundSheetShelf.py M /issm/trunk-jpl/test/Par/RoundSheetStaticEISMINT.par M /issm/trunk-jpl/test/Par/RoundSheetStaticEISMINT.py M /issm/trunk-jpl/test/Par/SquareEISMINT.par M /issm/trunk-jpl/test/Par/SquareEISMINT.py M /issm/trunk-jpl/test/Par/SquareSheetConstrained.par M /issm/trunk-jpl/test/Par/SquareSheetConstrained.py M /issm/trunk-jpl/test/Par/SquareSheetShelf.par M /issm/trunk-jpl/test/Par/SquareSheetShelf.py M /issm/trunk-jpl/test/Par/SquareShelf.par M /issm/trunk-jpl/test/Par/SquareShelf.py M /issm/trunk-jpl/test/Par/SquareShelf2.par M /issm/trunk-jpl/test/Par/SquareShelf2.py M /issm/trunk-jpl/test/Par/SquareShelfConstrained.par M /issm/trunk-jpl/test/Par/SquareShelfConstrained.py M /issm/trunk-jpl/test/Par/SquareThermal.par M /issm/trunk-jpl/test/Par/SquareThermal.py M /issm/trunk-jpl/test/Par/ValleyGlacierShelf.par M /issm/trunk-jpl/test/Par/ValleyGlacierShelf.py\\
+Export determination: 6. \\
+Rationale: CHG: WARNING: md.geometry.bed is now md.geometry.base and bathymetry is bed\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1030} with diff file ISSM-17591-17592.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/solve/waitonlock.m\\
+Export determination: 6. \\
+Rationale: BUG: fixed for pfe interactive=0\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1031} with diff file ISSM-17592-17593.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test423.m M /issm/trunk-jpl/test/NightlyRun/test423.py M /issm/trunk-jpl/test/NightlyRun/test424.m M /issm/trunk-jpl/test/NightlyRun/test424.py M /issm/trunk-jpl/test/NightlyRun/test425.m M /issm/trunk-jpl/test/NightlyRun/test425.py M /issm/trunk-jpl/test/NightlyRun/test427.m M /issm/trunk-jpl/test/NightlyRun/test427.py M /issm/trunk-jpl/test/NightlyRun/test435.m\\
+Export determination: 6. \\
+Rationale: CHG: fixed GL tests\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1032} with diff file ISSM-17593-17594.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/groundingline.py\\
+Export determination: 6. \\
+Rationale: BUG: fixed grounding line migration type\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1033} with diff file ISSM-17594-17595.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Par/RoundSheetShelf.py M /issm/trunk-jpl/test/Par/ValleyGlacierShelf.py\\
+Export determination: 6. \\
+Rationale: BUG: fixed bathymetry:\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1034} with diff file ISSM-17595-17596.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test426.py\\
+Export determination: 6. \\
+Rationale: CHG: minor\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1035} with diff file ISSM-17596-17597.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/interp/interp.py\\
+Export determination: 6. \\
+Rationale: NEW: python interpolation module. Largely analogous to existing Interp routines but adds new functionality (piecewise cubic spline interpolation, guaranteed to be continuously differentiable), radial interpolation for smoothing, etc. Still needs more thorough testing.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1036} with diff file ISSM-17597-17598.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/processdata.m M /issm/trunk-jpl/src/m/plot/processdata.py M /issm/trunk-jpl/src/m/plot/processmesh.py\\
+Export determination: 6. \\
+Rationale: BUG: some fixes for new mesh handling\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1037} with diff file ISSM-17598-17599.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/interp/interp.py\\
+Export determination: 6. \\
+Rationale: CHG: subset the input data for better efficiency, mask out nan's since they corrupt the spline calculation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1038} with diff file ISSM-17599-17600.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test426.m\\
+Export determination: 6. \\
+Rationale: CHG: fixed bathymetry\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1039} with diff file ISSM-17600-17601.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Constraints/SpcDynamic.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Node.cpp M /issm/trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.h\\
+Export determination: 6. \\
+Rationale: NEW: relaxed constrain for free surface bed when floating, and removed +1 shift in dof for constraints (really a headhache), use C convention all over now\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1040} with diff file ISSM-17601-17602.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test237.py\\
+Export determination: 6. \\
+Rationale: BUG: fixed initial temperatures\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1041} with diff file ISSM-17602-17603.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/parameterization/contourenvelope.py\\
+Export determination: 6. \\
+Rationale: BUG: do not use mesh variable\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1042} with diff file ISSM-17603-17604.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_la\_theta.cpp\\
+Export determination: 6. \\
+Rationale: NEW: added convergence test for LA Theta algorithm\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1043} with diff file ISSM-17604-17605.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: for FS, do not reinterpolate results on P1 inputs, keep the same interpolation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1044} with diff file ISSM-17605-17606.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp\\
+Export determination: 6. \\
+Rationale: CHG: fixing depth averaging for non P1 input\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1045} with diff file ISSM-17606-17607.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive104.nc M /issm/trunk-jpl/test/Archives/Archive204.nc M /issm/trunk-jpl/test/Archives/Archive211.nc M /issm/trunk-jpl/test/Archives/Archive215.nc M /issm/trunk-jpl/test/Archives/Archive220.nc M /issm/trunk-jpl/test/Archives/Archive221.nc M /issm/trunk-jpl/test/Archives/Archive290.nc M /issm/trunk-jpl/test/Archives/Archive308.nc M /issm/trunk-jpl/test/Archives/Archive322.nc M /issm/trunk-jpl/test/Archives/Archive404.nc M /issm/trunk-jpl/test/Archives/Archive421.nc M /issm/trunk-jpl/test/Archives/Archive422.nc M /issm/trunk-jpl/test/Archives/Archive503.nc M /issm/trunk-jpl/test/Archives/Archive507.nc M /issm/trunk-jpl/test/Archives/Archive510.nc M /issm/trunk-jpl/test/Archives/Archive511.nc\\
+Export determination: 6. \\
+Rationale: CHG: updating FS archives: now keep vx and vy on actual interpolation (do not use P1)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1046} with diff file ISSM-17607-17608.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive124.nc M /issm/trunk-jpl/test/Archives/Archive211.nc M /issm/trunk-jpl/test/Archives/Archive701.nc M /issm/trunk-jpl/test/Archives/Archive702.nc M /issm/trunk-jpl/test/Archives/Archive703.nc\\
+Export determination: 6. \\
+Rationale: CHG: updating archives now that FS does not reinterpolate to P1\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1047} with diff file ISSM-17608-17609.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed some memory leaks/delete problems\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1048} with diff file ISSM-17609-17610.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: InputUpdateFromSolution do not assume a P1 finite element anymore\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1049} with diff file ISSM-17610-17611.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/DepthAverageAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MeltingAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Node.cpp M /issm/trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/classes/mesh2dvertical.m M /issm/trunk-jpl/src/m/classes/mesh3dprisms.m M /issm/trunk-jpl/src/m/classes/mesh3dprisms.py M /issm/trunk-jpl/src/m/classes/mesh3dtetras.m M /issm/trunk-jpl/src/m/classes/model.m M /issm/trunk-jpl/src/m/classes/model.py M /issm/trunk-jpl/src/m/classes/oldclasses/mesh.m M /issm/trunk-jpl/src/m/classes/stressbalance.m M /issm/trunk-jpl/src/m/classes/stressbalance.py M /issm/trunk-jpl/src/m/consistency/checkfield.m M /issm/trunk-jpl/src/m/consistency/checkfield.py M /issm/trunk-jpl/src/m/contrib/bamg/yams.m M /issm/trunk-jpl/src/m/contrib/dassflow/importgmsh.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/MeshElementonbaseEnum.m D /issm/trunk-jpl/src/m/enum/MeshElementonbedEnum.m A /issm/trunk-jpl/src/m/enum/MeshVertexonbaseEnum.m D /issm/trunk-jpl/src/m/enum/MeshVertexonbedEnum.m M /issm/trunk-jpl/src/m/mesh/bamgflowband.m M /issm/trunk-jpl/test/NightlyRun/test1101.m M /issm/trunk-jpl/test/NightlyRun/test1101.py M /issm/trunk-jpl/test/NightlyRun/test1102.m M /issm/trunk-jpl/test/NightlyRun/test1102.py M /issm/trunk-jpl/test/NightlyRun/test1103.m M /issm/trunk-jpl/test/NightlyRun/test1103.py M /issm/trunk-jpl/test/NightlyRun/test1104.m M /issm/trunk-jpl/test/NightlyRun/test1104.py M /issm/trunk-jpl/test/NightlyRun/test1105.m M /issm/trunk-jpl/test/NightlyRun/test1105.py M /issm/trunk-jpl/test/NightlyRun/test1107.m M /issm/trunk-jpl/test/NightlyRun/test1107.py M /issm/trunk-jpl/test/NightlyRun/test1108.m M /issm/trunk-jpl/test/NightlyRun/test1108.py M /issm/trunk-jpl/test/NightlyRun/test1109.m M /issm/trunk-jpl/test/NightlyRun/test1110.m M /issm/trunk-jpl/test/NightlyRun/test1205.m M /issm/trunk-jpl/test/NightlyRun/test1205.py M /issm/trunk-jpl/test/NightlyRun/test1206.m M /issm/trunk-jpl/test/NightlyRun/test1206.py M /issm/trunk-jpl/test/NightlyRun/test1207.m M /issm/trunk-jpl/test/NightlyRun/test1207.py M /issm/trunk-jpl/test/NightlyRun/test1208.m M /issm/trunk-jpl/test/NightlyRun/test1208.py M /issm/trunk-jpl/test/NightlyRun/test1302.m M /issm/trunk-jpl/test/NightlyRun/test1302.py M /issm/trunk-jpl/test/NightlyRun/test1303.m M /issm/trunk-jpl/test/NightlyRun/test1303.py M /issm/trunk-jpl/test/NightlyRun/test703.m\\
+Export determination: 6. \\
+Rationale: NEW: renamed onbed -> onbase\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1050} with diff file ISSM-17611-17612.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/oldclasses/mesh.m\\
+Export determination: 6. \\
+Rationale: CHG: do not update old class\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1051} with diff file ISSM-17612-17613.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/shp/shp2exp.py\\
+Export determination: 6. \\
+Rationale: BUG: fixed shp2exp for point shapefiles\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1052} with diff file ISSM-17613-17614.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive280.nc M /issm/trunk-jpl/test/Archives/Archive285.nc M /issm/trunk-jpl/test/Archives/Archive450.nc M /issm/trunk-jpl/test/Archives/Archive455.nc\\
+Export determination: 6. \\
+Rationale: CHG: updating archives now that we do not reinterpolate results on P1\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1053} with diff file ISSM-17614-17615.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/exp/expread.py\\
+Export determination: 6. \\
+Rationale: corrected help text for python usage\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1054} with diff file ISSM-17615-17616.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp\\
+Export determination: 6. \\
+Rationale: CHG: added 1/sqrt(2) factor in effective straine rate for flow band models\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1055} with diff file ISSM-17616-17617.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive701.nc M /issm/trunk-jpl/test/Archives/Archive702.nc M /issm/trunk-jpl/test/Archives/Archive703.nc\\
+Export determination: 6. \\
+Rationale: CHG: updating FS archives: now keep vx and vy on actual interpolation (do not use P1)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1056} with diff file ISSM-17617-17618.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plotmodel.py M /issm/trunk-jpl/src/m/plot/processdata.py\\
+Export determination: 6. \\
+Rationale: CHG: fill nan's by default since matplotlib doesn't handle them\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1057} with diff file ISSM-17618-17619.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/processdata.py\\
+Export determination: 6. \\
+Rationale: better default fill value for nan's\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1058} with diff file ISSM-17619-17620.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Materials/Matice.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_la\_theta.cpp\\
+Export determination: 6. \\
+Rationale: CHG: added initial guess when u=0 and number of non linear iterations from md.stressbalance\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1059} with diff file ISSM-17621-17622.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: fixing some memory leaks\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1060} with diff file ISSM-17622-17623.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/mech/analyticaldamage.py A /issm/trunk-jpl/src/m/mech/backstressfrominversion.py A /issm/trunk-jpl/src/m/mech/damagefrominversion.py M /issm/trunk-jpl/src/m/mech/mechanicalproperties.py A /issm/trunk-jpl/src/m/mech/thomasparams.py\\
+Export determination: 6. \\
+Rationale: python-izing some mech functions\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1061} with diff file ISSM-17623-17624.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/SegRef.cpp\\
+Export determination: 6. \\
+Rationale: BUG: use only x to compute Jacobian (1d model do not use 3d coordinates)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1062} with diff file ISSM-17624-17625.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/mech/damagefrominversion.py\\
+Export determination: 6. \\
+Rationale: BUG: fixed problem for vector vs. array in damage calcs\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1063} with diff file ISSM-17625-17626.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive702.nc M /issm/trunk-jpl/test/Archives/Archive703.nc\\
+Export determination: 6. \\
+Rationale: CHG: updated flow line archives\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1064} with diff file ISSM-17626-17627.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.h\\
+Export determination: 6. \\
+Rationale: CHG: trying to make \_DEVELOPMENT\_ variable defined\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1065} with diff file ISSM-17627-17628.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/IoModel.cpp M /issm/trunk-jpl/src/c/toolkits/mpi/issmmpi.h\\
+Export determination: 6. \\
+Rationale: CHG: working on templating MPI calls\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1066} with diff file ISSM-17628-17629.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: fixing Dstar\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1067} with diff file ISSM-17629-17630.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/shared/Numerics/NewtonSolveDnorm.cpp M /issm/trunk-jpl/src/c/shared/Numerics/numerics.h\\
+Export determination: 6. \\
+Rationale: CHG: fixing Newton algo with first guess\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1068} with diff file ISSM-17630-17631.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test211.m M /issm/trunk-jpl/test/NightlyRun/test211.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxing some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1069} with diff file ISSM-17631-17632.diff: \\
+Function name: \\
+M /issm/trunk-jpl/m4/issm\_options.m4\\
+Export determination: 6. \\
+Rationale: BUG: fixed problem with matlab mex extension when matlab is installed after automakererun\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1070} with diff file ISSM-17632-17633.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/damage.py\\
+Export determination: 6. \\
+Rationale: BUG: fixed indent error in output marshalling for damage\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1071} with diff file ISSM-17633-17634.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: NEW: first version of contact GL criterion\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1072} with diff file ISSM-17634-17635.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: CHG: minor, no need to declare basis variable\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1073} with diff file ISSM-17635-17636.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/applyoptions.py M /issm/trunk-jpl/src/m/plot/plot\_unit.py\\
+Export determination: 6. \\
+Rationale: CHG: better default handling of colormap in python plots\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1074} with diff file ISSM-17636-17637.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: CHG: (1) add constraint on vy if levelset == 0 (2) GL migration only allowed for the first grounded element that touches the GL\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1075} with diff file ISSM-17637-17638.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp\\
+Export determination: 6. \\
+Rationale: CHG: constrain vz on FS if levelset = 0\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1076} with diff file ISSM-17638-17639.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: CHG: using max instead of min of Groundedicelevelset to test if element is contact with GL\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1077} with diff file ISSM-17639-17640.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive702.nc M /issm/trunk-jpl/test/Archives/Archive703.nc\\
+Export determination: 6. \\
+Rationale: CHG: saved archive now that vz Dirichlet is applied at the GL\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1078} with diff file ISSM-17640-17641.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/applyoptions.py M /issm/trunk-jpl/src/m/plot/plot\_unit.py\\
+Export determination: 6. \\
+Rationale: CHG: better handling of colormap and clim, added options to specify the color when data falls outside the range specified by clim\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1079} with diff file ISSM-17641-17642.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp\\
+Export determination: 6. \\
+Rationale: CHG: added GL Migration in 3d, testing required\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1080} with diff file ISSM-17642-17643.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp M /issm/trunk-jpl/src/c/cores/AnalysisConfiguration.cpp M /issm/trunk-jpl/src/c/cores/transient\_core.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/classes/transient.py M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py D /issm/trunk-jpl/src/m/enum/TransientIsdamageEnum.m A /issm/trunk-jpl/src/m/enum/TransientIsdamageevolutionEnum.m M /issm/trunk-jpl/src/m/interp/averaging.py\\
+Export determination: 6. \\
+Rationale: CHG: added damage evolution analysis to transient run\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1081} with diff file ISSM-17643-17644.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plot\_unit.py\\
+Export determination: 6. \\
+Rationale: CHG: minor, index for colorbar saturation not needed here\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1082} with diff file ISSM-17644-17645.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/damage.m M /issm/trunk-jpl/src/m/classes/transient.m\\
+Export determination: 6. \\
+Rationale: BUG: fixed a couple bugs in matlab code for damage evolution analysis in transient\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1083} with diff file ISSM-17645-17646.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: forgot to remove print statement from debugging\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1084} with diff file ISSM-17646-17647.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: only load Vz in 3d models\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1085} with diff file ISSM-17647-17648.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: tau must be stored in Dev Stress\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1086} with diff file ISSM-17648-17649.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/coordsystems/xy2ll.py\\
+Export determination: 6. \\
+Rationale: minor bug in xy2ll if statement\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1087} with diff file ISSM-17649-17650.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/plot/colormaps/cmaptools.py\\
+Export determination: 6. \\
+Rationale: NEW: module for modifying matplotlib colormaps, for now just contains a function to truncate an existing colormap to desired interval\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1088} with diff file ISSM-17650-17651.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/shared/Numerics/NewtonSolveDnorm.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_la\_theta.cpp\\
+Export determination: 6. \\
+Rationale: NEW: done with X-TH LA\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1089} with diff file ISSM-17651-17652.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp A /issm/trunk-jpl/src/m/enum/AugmentedLagrangianThetaEnum.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py\\
+Export determination: 6. \\
+Rationale: NEW: added new enum\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1090} with diff file ISSM-17652-17653.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp M /issm/trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h\\
+Export determination: 6. \\
+Rationale: NEW: added friction fonction to test analytical solutions\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1091} with diff file ISSM-17653-17654.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_la\_theta.cpp\\
+Export determination: 6. \\
+Rationale: CHG: separating update tau and d\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1092} with diff file ISSM-17654-17655.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plot\_manager.py A /issm/trunk-jpl/src/m/plot/plot\_overlay.py M /issm/trunk-jpl/src/m/plot/plot\_unit.py\\
+Export determination: 6. \\
+Rationale: NEW: overlay plotting capability in python\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1093} with diff file ISSM-17655-17656.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/interp/interp.py\\
+Export determination: 6. \\
+Rationale: added option to plot data for inspecting holes before spline interpolation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1094} with diff file ISSM-17656-17657.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plot\_overlay.py\\
+Export determination: 6. \\
+Rationale: CHG: check whether geotiff is a 3-band rgb raster; if so, convert to single band greyscale\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1095} with diff file ISSM-17657-17658.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plot\_overlay.py\\
+Export determination: 6. \\
+Rationale: BUG: ensure result of max is a float\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1096} with diff file ISSM-17659-17660.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_la\_theta.cpp M /issm/trunk-jpl/src/m/classes/flowequation.m M /issm/trunk-jpl/src/m/classes/flowequation.py\\
+Export determination: 6. \\
+Rationale: NEW: added r and theta as model parameters in md.flowequations\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1097} with diff file ISSM-17660-17661.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/IoModel.cpp\\
+Export determination: 6. \\
+Rationale: CHG: reverting to initial version\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1098} with diff file ISSM-17661-17662.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/solvers/mumpsoptions.m\\
+Export determination: 6. \\
+Rationale: CHG: make sure // matlab reordering is used\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1099} with diff file ISSM-17662-17663.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/toolkits/petsc/patches/NewVec.cpp\\
+Export determination: 6. \\
+Rationale: CHG: no need to initialize vector with 0, this is done automatically\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1100} with diff file ISSM-17663-17664.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test204.m M /issm/trunk-jpl/test/NightlyRun/test204.py M /issm/trunk-jpl/test/NightlyRun/test335.m M /issm/trunk-jpl/test/NightlyRun/test419.m M /issm/trunk-jpl/test/NightlyRun/test419.py M /issm/trunk-jpl/test/NightlyRun/test427.m M /issm/trunk-jpl/test/NightlyRun/test427.py M /issm/trunk-jpl/test/NightlyRun/test435.m M /issm/trunk-jpl/test/NightlyRun/test455.m M /issm/trunk-jpl/test/NightlyRun/test455.py M /issm/trunk-jpl/test/NightlyRun/test702.m M /issm/trunk-jpl/test/NightlyRun/test804.m M /issm/trunk-jpl/test/NightlyRun/test804.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxing some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1101} with diff file ISSM-17664-17665.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_la\_theta.cpp\\
+Export determination: 6. \\
+Rationale: CHG: trying to fix AD compilation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1102} with diff file ISSM-17665-17666.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/toolkits/mpi/issmmpi.h\\
+Export determination: 6. \\
+Rationale: CHG: trying to fix AD compilation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1103} with diff file ISSM-17666-17667.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test274.m M /issm/trunk-jpl/test/NightlyRun/test435.m\\
+Export determination: 6. \\
+Rationale: CHG: minor tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1104} with diff file ISSM-17667-17668.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/tao/install-2.2.sh\\
+Export determination: 6. \\
+Rationale: CHG: use tao-2.2.2 instead of tao-2.2-pre1\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1105} with diff file ISSM-17668-17669.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/Krigingx/pKrigingx.cpp\\
+Export determination: 6. \\
+Rationale: NEW: added distance output for pKriging\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1106} with diff file ISSM-17669-17670.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/toolkits/mpi/issmmpi.h\\
+Export determination: 6. \\
+Rationale: CHG: removing template that makes AD mpi off crash\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1107} with diff file ISSM-17670-17671.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: CHG: for clarity, explicitly define dim variable for use in viscosity calc\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1108} with diff file ISSM-17671-17672.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tetra.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: CHG: moving some stuff from Tria to Element\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1109} with diff file ISSM-17672-17673.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp\\
+Export determination: 6. \\
+Rationale: BUG: GetVectorFromInputs needs to call GetInputListOnVertices\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1110} with diff file ISSM-17674-17675.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h M /issm/trunk-jpl/src/c/analyses/Analysis.h M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h M /issm/trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h M /issm/trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h M /issm/trunk-jpl/src/c/analyses/DepthAverageAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/DepthAverageAnalysis.h M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.h M /issm/trunk-jpl/src/c/analyses/EnumToAnalysis.h M /issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.h M /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h M /issm/trunk-jpl/src/c/analyses/GiaAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/GiaAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.h M /issm/trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.h M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.h M /issm/trunk-jpl/src/c/analyses/MeltingAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MeltingAnalysis.h M /issm/trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/IoModel.cpp M /issm/trunk-jpl/src/c/classes/IoModel.h M /issm/trunk-jpl/src/c/classes/Node.cpp M /issm/trunk-jpl/src/c/classes/Vertex.cpp M /issm/trunk-jpl/src/c/classes/Vertex.h M /issm/trunk-jpl/src/c/cores/bedslope\_core.cpp M /issm/trunk-jpl/src/c/cores/levelsetfunctionslope\_core.cpp M /issm/trunk-jpl/src/c/cores/masstransport\_core.cpp M /issm/trunk-jpl/src/c/cores/stressbalance\_core.cpp M /issm/trunk-jpl/src/c/cores/surfaceslope\_core.cpp M /issm/trunk-jpl/src/c/cores/transient\_core.cpp M /issm/trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp M /issm/trunk-jpl/src/c/modules/MeshPartitionx/MeshPartitionx.h M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateSingleNodeToElementConnectivity.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/EdgesPartitioning.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/FacesPartitioning.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/NodesPartitioning.cpp M /issm/trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.m M /issm/trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py M /issm/trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.m M /issm/trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py M /issm/trunk-jpl/src/m/classes/damage.m M /issm/trunk-jpl/src/m/classes/damage.py M /issm/trunk-jpl/src/m/classes/flowequation.m M /issm/trunk-jpl/src/m/classes/flowequation.py M /issm/trunk-jpl/src/m/classes/initialization.m M /issm/trunk-jpl/src/m/classes/initialization.py M /issm/trunk-jpl/src/m/classes/mesh2d.m M /issm/trunk-jpl/src/m/classes/mesh2d.py M /issm/trunk-jpl/src/m/classes/mesh2dvertical.m M /issm/trunk-jpl/src/m/classes/mesh3dprisms.m M /issm/trunk-jpl/src/m/classes/mesh3dprisms.py M /issm/trunk-jpl/src/m/classes/mesh3dtetras.m M /issm/trunk-jpl/src/m/classes/model.m M /issm/trunk-jpl/src/m/classes/model.py M /issm/trunk-jpl/src/m/classes/modellist.m M /issm/trunk-jpl/src/m/classes/rifts.m M /issm/trunk-jpl/src/m/classes/rifts.py M /issm/trunk-jpl/src/m/classes/stressbalance.m M /issm/trunk-jpl/src/m/classes/stressbalance.py M /issm/trunk-jpl/src/m/classes/thermal.m M /issm/trunk-jpl/src/m/classes/thermal.py M /issm/trunk-jpl/src/m/contrib/ecco/PropagateFlagsUntilDistance.m M /issm/trunk-jpl/src/m/contrib/hack/tres.m M /issm/trunk-jpl/src/m/contrib/massbalance/divergence.m M /issm/trunk-jpl/src/m/contrib/massbalance/outflux.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/MeshDimEnum.m A /issm/trunk-jpl/src/m/enum/MeshXDimEnum.m M /issm/trunk-jpl/src/m/exp/contourlevelzero.m M /issm/trunk-jpl/src/m/extrusion/DepthAverage.m M /issm/trunk-jpl/src/m/extrusion/project2d.m M /issm/trunk-jpl/src/m/extrusion/project3d.m M /issm/trunk-jpl/src/m/extrusion/project3d.py M /issm/trunk-jpl/src/m/geometry/slope.m M /issm/trunk-jpl/src/m/geometry/slope.py M /issm/trunk-jpl/src/m/interp/SectionValues.m M /issm/trunk-jpl/src/m/interp/averaging.m M /issm/trunk-jpl/src/m/interp/averaging.py M /issm/trunk-jpl/src/m/inversions/velocitymisfit.m M /issm/trunk-jpl/src/m/mech/analyticaldamage.m M /issm/trunk-jpl/src/m/mech/backstressfrominversion.m M /issm/trunk-jpl/src/m/mech/damagefrominversion.m M /issm/trunk-jpl/src/m/mech/mechanicalproperties.m M /issm/trunk-jpl/src/m/mech/strainrateuncert.m M /issm/trunk-jpl/src/m/mech/thomasparams.m M /issm/trunk-jpl/src/m/mesh/bamg.m M /issm/trunk-jpl/src/m/mesh/bamg.py M /issm/trunk-jpl/src/m/miscellaneous/vorticity.m M /issm/trunk-jpl/src/m/parameterization/contourenvelope.m M /issm/trunk-jpl/src/m/parameterization/contourenvelope.py M /issm/trunk-jpl/src/m/parameterization/setflowequation.m M /issm/trunk-jpl/src/m/partition/AreaAverageOntoPartition.m M /issm/trunk-jpl/src/m/partition/partitioner.m M /issm/trunk-jpl/src/m/plot/applyoptions.m M /issm/trunk-jpl/src/m/plot/plot\_basaldrag.m M /issm/trunk-jpl/src/m/plot/plot\_edges.m M /issm/trunk-jpl/src/m/plot/plot\_icefront.m M /issm/trunk-jpl/src/m/plot/plot\_penalties.m M /issm/trunk-jpl/src/m/plot/plot\_qmu\_mass\_flux\_segments.m M /issm/trunk-jpl/src/m/plot/plot\_referential.m M /issm/trunk-jpl/src/m/plot/plot\_section.m M /issm/trunk-jpl/src/m/plot/plot\_segments.m M /issm/trunk-jpl/src/m/plot/plot\_tensor\_components.m M /issm/trunk-jpl/src/m/plot/plot\_tensor\_principal.m M /issm/trunk-jpl/src/m/plot/plot\_tensor\_principalaxis.m M /issm/trunk-jpl/src/m/plot/plot\_transient\_results.m M /issm/trunk-jpl/src/m/plot/processdata.m M /issm/trunk-jpl/src/m/plot/processmesh.m M /issm/trunk-jpl/src/m/plot/processmesh.py M /issm/trunk-jpl/src/wrappers/MeshPartition/MeshPartition.cpp\\
+Export determination: 6. \\
+Rationale: CHG: renamed meshtype->meshxdim (Extended Dimension) and added meshdim (2 or 3) and meshtype (Tria Penta Tetra)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1111} with diff file ISSM-17675-17676.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/model.m\\
+Export determination: 6. \\
+Rationale: BUG: fixing split to tetras\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1112} with diff file ISSM-17676-17677.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/parameterization/setflowequation.m\\
+Export determination: 6. \\
+Rationale: BUG: FS is allowed for 2d vertical meshes\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1113} with diff file ISSM-17677-17678.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/contrib/gslib/gslib.m\\
+Export determination: 6. \\
+Rationale: CHG: making gslib more flexible with additional input params\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1114} with diff file ISSM-17678-17679.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_la\_theta.cpp\\
+Export determination: 6. \\
+Rationale: NEW: convergence test on Vx for now\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1115} with diff file ISSM-17679-17680.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/TetraInput.cpp M /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing GetVectorFromInputs, which assumes P1 interpolation only\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1116} with diff file ISSM-17680-17681.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tetra.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: CHG: do not compute stress tensor for a 2d horiz mesh, new function ction to compute deviatoric stress\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1117} with diff file ISSM-17681-17682.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: CHG: renamed meshtype->meshxdim for consistency (though meshxdim is a bit confusing, sounds like the x-dimension)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1118} with diff file ISSM-17682-17683.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/stressbalance.py\\
+Export determination: 6. \\
+Rationale: BUG: forgot parenthesis after meshtype\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1119} with diff file ISSM-17683-17684.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test101.m M /issm/trunk-jpl/test/NightlyRun/test101.py\\
+Export determination: 6. \\
+Rationale: CHG: output DeviatoricStress instead of Stress Tensor\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1120} with diff file ISSM-17684-17685.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: NEW: added Deviatoricstress tensor as available output\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1121} with diff file ISSM-17685-17686.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/runme.py\\
+Export determination: 6. \\
+Rationale: BUG: fixed strcmpi\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1122} with diff file ISSM-17686-17687.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.h M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.h M /issm/trunk-jpl/src/c/analyses/Analysis.h M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.h M /issm/trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancethicknessSoftAnalysis.h M /issm/trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancevelocityAnalysis.h M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h M /issm/trunk-jpl/src/c/analyses/DepthAverageAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/DepthAverageAnalysis.h M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.h M /issm/trunk-jpl/src/c/analyses/EnumToAnalysis.h M /issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.h M /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h M /issm/trunk-jpl/src/c/analyses/GiaAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/GiaAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.h M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.h M /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.h M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.h M /issm/trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.h M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.h M /issm/trunk-jpl/src/c/analyses/MeltingAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MeltingAnalysis.h M /issm/trunk-jpl/src/c/analyses/MeshdeformationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MeshdeformationAnalysis.h M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.h M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.h M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/IoModel.cpp M /issm/trunk-jpl/src/c/classes/IoModel.h M /issm/trunk-jpl/src/c/classes/Node.cpp M /issm/trunk-jpl/src/c/classes/Vertex.cpp M /issm/trunk-jpl/src/c/classes/Vertex.h M /issm/trunk-jpl/src/c/cores/bedslope\_core.cpp M /issm/trunk-jpl/src/c/cores/levelsetfunctionslope\_core.cpp M /issm/trunk-jpl/src/c/cores/masstransport\_core.cpp M /issm/trunk-jpl/src/c/cores/stressbalance\_core.cpp M /issm/trunk-jpl/src/c/cores/surfaceslope\_core.cpp M /issm/trunk-jpl/src/c/cores/transient\_core.cpp M /issm/trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp M /issm/trunk-jpl/src/c/modules/MeshPartitionx/MeshPartitionx.h M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateSingleNodeToElementConnectivity.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/EdgesPartitioning.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/FacesPartitioning.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/NodesPartitioning.cpp M /issm/trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.m M /issm/trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py M /issm/trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.m M /issm/trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py M /issm/trunk-jpl/src/m/classes/flowequation.m M /issm/trunk-jpl/src/m/classes/flowequation.py M /issm/trunk-jpl/src/m/classes/initialization.m M /issm/trunk-jpl/src/m/classes/initialization.py M /issm/trunk-jpl/src/m/classes/mesh2d.m M /issm/trunk-jpl/src/m/classes/mesh2d.py M /issm/trunk-jpl/src/m/classes/mesh2dvertical.m M /issm/trunk-jpl/src/m/classes/mesh3dprisms.m M /issm/trunk-jpl/src/m/classes/mesh3dprisms.py M /issm/trunk-jpl/src/m/classes/mesh3dtetras.m M /issm/trunk-jpl/src/m/classes/model.m M /issm/trunk-jpl/src/m/classes/model.py M /issm/trunk-jpl/src/m/classes/modellist.m M /issm/trunk-jpl/src/m/classes/rifts.m M /issm/trunk-jpl/src/m/classes/rifts.py M /issm/trunk-jpl/src/m/classes/stressbalance.m M /issm/trunk-jpl/src/m/classes/stressbalance.py M /issm/trunk-jpl/src/m/classes/thermal.m M /issm/trunk-jpl/src/m/classes/thermal.py M /issm/trunk-jpl/src/m/contrib/ecco/PropagateFlagsUntilDistance.m M /issm/trunk-jpl/src/m/contrib/hack/tres.m M /issm/trunk-jpl/src/m/contrib/massbalance/divergence.m M /issm/trunk-jpl/src/m/contrib/massbalance/outflux.m A /issm/trunk-jpl/src/m/enum/DomainDimensionEnum.m A /issm/trunk-jpl/src/m/enum/DomainTypeEnum.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py D /issm/trunk-jpl/src/m/enum/MeshDimEnum.m A /issm/trunk-jpl/src/m/enum/MeshElementtypeEnum.m D /issm/trunk-jpl/src/m/enum/MeshTypeEnum.m D /issm/trunk-jpl/src/m/enum/MeshXDimEnum.m M /issm/trunk-jpl/src/m/exp/contourlevelzero.m M /issm/trunk-jpl/src/m/extrusion/DepthAverage.m M /issm/trunk-jpl/src/m/extrusion/project2d.m M /issm/trunk-jpl/src/m/extrusion/project3d.m M /issm/trunk-jpl/src/m/extrusion/project3d.py M /issm/trunk-jpl/src/m/geometry/slope.m M /issm/trunk-jpl/src/m/geometry/slope.py M /issm/trunk-jpl/src/m/interp/SectionValues.m M /issm/trunk-jpl/src/m/interp/averaging.m M /issm/trunk-jpl/src/m/interp/averaging.py M /issm/trunk-jpl/src/m/inversions/velocitymisfit.m M /issm/trunk-jpl/src/m/mech/analyticaldamage.m M /issm/trunk-jpl/src/m/mech/backstressfrominversion.m M /issm/trunk-jpl/src/m/mech/damagefrominversion.m M /issm/trunk-jpl/src/m/mech/mechanicalproperties.m M /issm/trunk-jpl/src/m/mech/strainrateuncert.m M /issm/trunk-jpl/src/m/mech/thomasparams.m M /issm/trunk-jpl/src/m/mesh/bamg.m M /issm/trunk-jpl/src/m/mesh/bamg.py M /issm/trunk-jpl/src/m/miscellaneous/vorticity.m M /issm/trunk-jpl/src/m/parameterization/contourenvelope.m M /issm/trunk-jpl/src/m/parameterization/contourenvelope.py M /issm/trunk-jpl/src/m/parameterization/setflowequation.m M /issm/trunk-jpl/src/m/partition/AreaAverageOntoPartition.m M /issm/trunk-jpl/src/m/partition/partitioner.m M /issm/trunk-jpl/src/m/plot/applyoptions.m M /issm/trunk-jpl/src/m/plot/plot\_basaldrag.m M /issm/trunk-jpl/src/m/plot/plot\_edges.m M /issm/trunk-jpl/src/m/plot/plot\_icefront.m M /issm/trunk-jpl/src/m/plot/plot\_penalties.m M /issm/trunk-jpl/src/m/plot/plot\_qmu\_mass\_flux\_segments.m M /issm/trunk-jpl/src/m/plot/plot\_referential.m M /issm/trunk-jpl/src/m/plot/plot\_section.m M /issm/trunk-jpl/src/m/plot/plot\_segments.m M /issm/trunk-jpl/src/m/plot/plot\_tensor\_components.m M /issm/trunk-jpl/src/m/plot/plot\_tensor\_principal.m M /issm/trunk-jpl/src/m/plot/plot\_tensor\_principalaxis.m M /issm/trunk-jpl/src/m/plot/plot\_transient\_results.m M /issm/trunk-jpl/src/m/plot/processdata.m M /issm/trunk-jpl/src/m/plot/processmesh.m M /issm/trunk-jpl/src/m/plot/processmesh.py M /issm/trunk-jpl/src/wrappers/MeshPartition/MeshPartition.cpp\\
+Export determination: 6. \\
+Rationale: CHG: following Chris' suggestions, we adopt the following convention md.mesh.dimension -> DomainDimensionEnum md.mesh.domaintype ->DomainTypeEnum md.mesh.elementtype->MeshElementtypeEnum\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1123} with diff file ISSM-17687-17688.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.m M /issm/trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py M /issm/trunk-jpl/src/m/classes/model.m M /issm/trunk-jpl/src/m/contrib/ecco/PropagateFlagsUntilDistance.m M /issm/trunk-jpl/src/m/extrusion/DepthAverage.m M /issm/trunk-jpl/src/m/parameterization/contourenvelope.m M /issm/trunk-jpl/src/m/parameterization/contourenvelope.py M /issm/trunk-jpl/src/m/plot/applyoptions.m M /issm/trunk-jpl/src/m/plot/plot\_edges.m M /issm/trunk-jpl/src/m/plot/plot\_icefront.m M /issm/trunk-jpl/src/m/plot/plot\_penalties.m M /issm/trunk-jpl/src/m/plot/plot\_qmu\_mass\_flux\_segments.m M /issm/trunk-jpl/src/m/plot/plot\_referential.m M /issm/trunk-jpl/src/m/plot/plot\_segments.m M /issm/trunk-jpl/src/m/plot/plot\_tensor\_components.m M /issm/trunk-jpl/src/m/plot/plot\_transient\_results.m M /issm/trunk-jpl/src/m/plot/processdata.m M /issm/trunk-jpl/src/m/plot/processmesh.py\\
+Export determination: 6. \\
+Rationale: CHG: replacing some meshtype by meshdimension\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1124} with diff file ISSM-17688-17689.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/mesh2d.m M /issm/trunk-jpl/src/m/classes/mesh2d.py M /issm/trunk-jpl/src/m/classes/mesh2dvertical.m M /issm/trunk-jpl/src/m/classes/mesh3dprisms.m M /issm/trunk-jpl/src/m/classes/mesh3dprisms.py M /issm/trunk-jpl/src/m/classes/mesh3dtetras.m\\
+Export determination: 6. \\
+Rationale: CHG: marshalling domain properties\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1125} with diff file ISSM-17689-17690.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive101.nc M /issm/trunk-jpl/test/NightlyRun/test322.py\\
+Export determination: 6. \\
+Rationale: CHG: fixed nightly runs\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1126} with diff file ISSM-17690-17691.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/TetraRef.cpp\\
+Export determination: 6. \\
+Rationale: BUG: use finitelement instead of element\_type\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1127} with diff file ISSM-17691-17692.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plot\_unit.py\\
+Export determination: 6. \\
+Rationale: BUG: forgot to assign cmap in element plot\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1128} with diff file ISSM-17692-17693.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/DepthAverageAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/IoModel.cpp M /issm/trunk-jpl/src/c/classes/IoModel.h M /issm/trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp M /issm/trunk-jpl/src/c/modules/MeshPartitionx/MeshPartitionx.h M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/EdgesPartitioning.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp\\
+Export determination: 6. \\
+Rationale: CHG: starting to change iomodel->domaintype to iomodel->meshelementtype when necessary (useful for Tetras)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1129} with diff file ISSM-17693-17694.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: minor adjustements for Tets\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1130} with diff file ISSM-17694-17695.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tetra.h\\
+Export determination: 6. \\
+Rationale: CHG: fixed HO for Tetras\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1131} with diff file ISSM-17695-17696.diff: \\
+Function name: \\
+D /issm/trunk-jpl/test/Archives/Archive999.hdf5 D /issm/trunk-jpl/test/Archives/Archive999.nc\\
+Export determination: 6. \\
+Rationale: DEL: not needed anymore\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1132} with diff file ISSM-17696-17697.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/processdata.py\\
+Export determination: 6. \\
+Rationale: BUG: create copy so that original data is not overwritten by processdata\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1133} with diff file ISSM-17697-17698.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/interp/interp.py\\
+Export determination: 6. \\
+Rationale: CHG: by default, do not fill nan's using the spline fit, rather mark them using nearest neighbors\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1134} with diff file ISSM-17698-17699.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/applyoptions.py M /issm/trunk-jpl/src/m/plot/plot\_unit.py M /issm/trunk-jpl/src/m/plot/plotmodel.py M /issm/trunk-jpl/src/m/plot/processdata.py\\
+Export determination: 6. \\
+Rationale: CHG: misc changes for dealing with nan's when plotting in python\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1135} with diff file ISSM-17699-17700.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/mesh3dtetras.m\\
+Export determination: 6. \\
+Rationale: CHG: do not marhall DomainType as Mesh3DtetrasEnum\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1136} with diff file ISSM-17700-17701.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/AdjointBalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/DepthAverageAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MeltingAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Node.cpp M /issm/trunk-jpl/src/c/classes/Vertex.cpp M /issm/trunk-jpl/src/c/cores/bedslope\_core.cpp M /issm/trunk-jpl/src/c/cores/levelsetfunctionslope\_core.cpp M /issm/trunk-jpl/src/c/cores/masstransport\_core.cpp M /issm/trunk-jpl/src/c/cores/stressbalance\_core.cpp M /issm/trunk-jpl/src/c/cores/surfaceslope\_core.cpp M /issm/trunk-jpl/src/c/cores/transient\_core.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateSingleNodeToElementConnectivity.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/FacesPartitioning.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/NodesPartitioning.cpp M /issm/trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/classes/mesh2d.py M /issm/trunk-jpl/src/m/classes/mesh2dvertical.m M /issm/trunk-jpl/src/m/classes/mesh3dprisms.m M /issm/trunk-jpl/src/m/classes/mesh3dprisms.py M /issm/trunk-jpl/src/m/classes/mesh3dtetras.m A /issm/trunk-jpl/src/m/enum/Domain2DhorizontalEnum.m A /issm/trunk-jpl/src/m/enum/Domain2DverticalEnum.m A /issm/trunk-jpl/src/m/enum/Domain3DEnum.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py D /issm/trunk-jpl/src/m/enum/Mesh2DhorizontalEnum.m D /issm/trunk-jpl/src/m/enum/Mesh2DverticalEnum.m D /issm/trunk-jpl/src/m/enum/Mesh3DEnum.m D /issm/trunk-jpl/src/m/enum/Mesh3DtetrasEnum.m M /issm/trunk-jpl/src/m/miscellaneous/vorticity.m M /issm/trunk-jpl/src/wrappers/MeshPartition/MeshPartition.cpp\\
+Export determination: 6. \\
+Rationale: CHG: renamed Mesh3D Domain3D etc and simplified the way we get the dimension when possible\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1137} with diff file ISSM-17701-17702.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim\\
+Export determination: 6. \\
+Rationale: CHG: syncing Enum\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1138} with diff file ISSM-17702-17703.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test435.m M /issm/trunk-jpl/test/NightlyRun/test702.m\\
+Export determination: 6. \\
+Rationale: CHG: relaxed tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1139} with diff file ISSM-17703-17704.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/mesh2d.m\\
+Export determination: 6. \\
+Rationale: BUG: Mesh2d is now Domain2D\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1140} with diff file ISSM-17704-17705.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp\\
+Export determination: 6. \\
+Rationale: CHG: Assign 1 or -1 for vertices not on bed\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1141} with diff file ISSM-17705-17706.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp\\
+Export determination: 6. \\
+Rationale: BUG: reverting back (wrong dynamic allocation and not 3d compatible\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1142} with diff file ISSM-17706-17707.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/applyoptions.py M /issm/trunk-jpl/src/m/plot/plot\_mesh.py\\
+Export determination: 6. \\
+Rationale: BUG: don't try to set default clim when data is empty, such as for a mesh plot\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1143} with diff file ISSM-17707-17708.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/cores/transient\_core.cpp M /issm/trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp\\
+Export determination: 6. \\
+Rationale: CHG: do extrusionfrombase for maskgroundedicelevelset for element not attach to base\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1144} with diff file ISSM-17708-17709.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/applyoptions.m\\
+Export determination: 6. \\
+Rationale: CHG: using domaintype to choose axis options in plotmodel\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1145} with diff file ISSM-17709-17710.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/interp/interp.py\\
+Export determination: 6. \\
+Rationale: BUG: define x,y coords in centers of grid cells if appropriate\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1146} with diff file ISSM-17710-17711.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/interp/interp.py\\
+Export determination: 6. \\
+Rationale: CHG: cosmetic\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1147} with diff file ISSM-17711-17712.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/interp/interp.py\\
+Export determination: 6. \\
+Rationale: minor, adding todo\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1148} with diff file ISSM-17712-17713.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/coordsystems/ll2xy.py M /issm/trunk-jpl/src/m/coordsystems/xy2ll.py\\
+Export determination: 6. \\
+Rationale: CHG: changed display text for consistency and clarity\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1149} with diff file ISSM-17713-17714.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/interp/interp.py\\
+Export determination: 6. \\
+Rationale: CHG: cosmetic\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1150} with diff file ISSM-17714-17715.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/model.py\\
+Export determination: 6. \\
+Rationale: BUG: errant end statement\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1151} with diff file ISSM-17715-17716.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/mech/robintemperature.py\\
+Export determination: 6. \\
+Rationale: NEW: python version of robin temperature calculation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1152} with diff file ISSM-17716-17717.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plot\_unit.py\\
+Export determination: 6. \\
+Rationale: CHG: changed colorlevels for consistency with colormap\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1153} with diff file ISSM-17717-17718.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plot\_vertexnumbering.m\\
+Export determination: 6. \\
+Rationale: CHG: fixed plot\_vertexnumbering.m for tetras\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1154} with diff file ISSM-17718-17719.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/interp/PointValues.m M /issm/trunk-jpl/src/m/plot/plot\_manager.m M /issm/trunk-jpl/src/m/plot/plot\_profile.m A /issm/trunk-jpl/src/m/plot/plot\_vstime.m\\
+Export determination: 6. \\
+Rationale: NEW:adding a plotmodel option to plot the values at a point function of time\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1155} with diff file ISSM-17719-17720.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/contrib/dassflow/importgmsh.m\\
+Export determination: 6. \\
+Rationale: NEW: importgmsh.m now compatible with 3d meshes\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1156} with diff file ISSM-17720-17721.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/SMB.m M /issm/trunk-jpl/src/m/classes/autodiff.m M /issm/trunk-jpl/src/m/classes/balancethickness.m M /issm/trunk-jpl/src/m/classes/basalforcings.m M /issm/trunk-jpl/src/m/classes/clusters/generic.m M /issm/trunk-jpl/src/m/classes/constants.m M /issm/trunk-jpl/src/m/classes/damage.m M /issm/trunk-jpl/src/m/classes/debug.m M /issm/trunk-jpl/src/m/classes/flaim.m M /issm/trunk-jpl/src/m/classes/flowequation.m M /issm/trunk-jpl/src/m/classes/friction.m M /issm/trunk-jpl/src/m/classes/geometry.m M /issm/trunk-jpl/src/m/classes/gia.m M /issm/trunk-jpl/src/m/classes/groundingline.m M /issm/trunk-jpl/src/m/classes/hydrologyshreve.m M /issm/trunk-jpl/src/m/classes/initialization.m M /issm/trunk-jpl/src/m/classes/inversion.m M /issm/trunk-jpl/src/m/classes/mask.m M /issm/trunk-jpl/src/m/classes/masstransport.m M /issm/trunk-jpl/src/m/classes/matice.m M /issm/trunk-jpl/src/m/classes/mesh2d.m M /issm/trunk-jpl/src/m/classes/miscellaneous.m M /issm/trunk-jpl/src/m/classes/outputdefinition.m M /issm/trunk-jpl/src/m/classes/qmu.m M /issm/trunk-jpl/src/m/classes/rifts.m M /issm/trunk-jpl/src/m/classes/settings.m M /issm/trunk-jpl/src/m/classes/steadystate.m M /issm/trunk-jpl/src/m/classes/stressbalance.m M /issm/trunk-jpl/src/m/classes/thermal.m M /issm/trunk-jpl/src/m/classes/timestepping.m M /issm/trunk-jpl/src/m/classes/transient.m M /issm/trunk-jpl/src/m/classes/verbose.m\\
+Export determination: 6. \\
+Rationale: CHG: implemented createxml method for each class.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1157} with diff file ISSM-17721-17722.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/solve/convert2str.m A /issm/trunk-jpl/src/m/solve/createxml.m\\
+Export determination: 6. \\
+Rationale: NEW: createxml method to create an inishell compatible xml file from a model.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1158} with diff file ISSM-17722-17723.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/java A /issm/trunk-jpl/src/java/COPYING A /issm/trunk-jpl/src/java/Changelog\_1.0.0.txt A /issm/trunk-jpl/src/java/License.txt A /issm/trunk-jpl/src/java/MANIFEST.MF A /issm/trunk-jpl/src/java/build A /issm/trunk-jpl/src/java/build/gui\_elements A /issm/trunk-jpl/src/java/build/gui\_elements/AlternativePanel.class A /issm/trunk-jpl/src/java/build/gui\_elements/CheckBoxPanel.class A /issm/trunk-jpl/src/java/build/gui\_elements/ColorCellRenderer.class A /issm/trunk-jpl/src/java/build/gui\_elements/CombinedPanel\$1.class A /issm/trunk-jpl/src/java/build/gui\_elements/CombinedPanel\$Type.class A /issm/trunk-jpl/src/java/build/gui\_elements/CombinedPanel.class A /issm/trunk-jpl/src/java/build/gui\_elements/ControlledPanel.class A /issm/trunk-jpl/src/java/build/gui\_elements/DecimalPanel.class A /issm/trunk-jpl/src/java/build/gui\_elements/DuplicatorPanel.class A /issm/trunk-jpl/src/java/build/gui\_elements/FramePanel.class A /issm/trunk-jpl/src/java/build/gui\_elements/GUIBuildException.class A /issm/trunk-jpl/src/java/build/gui\_elements/IntegerPanel.class A /issm/trunk-jpl/src/java/build/gui\_elements/OptionPanel.class A /issm/trunk-jpl/src/java/build/gui\_elements/PathPanel.class A /issm/trunk-jpl/src/java/build/gui\_elements/SelectorPanel.class A /issm/trunk-jpl/src/java/build/gui\_elements/TextfieldPanel.class A /issm/trunk-jpl/src/java/build/main A /issm/trunk-jpl/src/java/build/main/GUI.class A /issm/trunk-jpl/src/java/build/main/GUIBuilder\$1.class A /issm/trunk-jpl/src/java/build/main/GUIBuilder.class A /issm/trunk-jpl/src/java/build/main/PanelControl.class A /issm/trunk-jpl/src/java/build/main/PanelNode.class A /issm/trunk-jpl/src/java/build/main/XMLHelper.class A /issm/trunk-jpl/src/java/build/resources A /issm/trunk-jpl/src/java/build/resources/config\_schema-0.1.1.xsd A /issm/trunk-jpl/src/java/build/resources/config\_schema.xsd A /issm/trunk-jpl/src/java/build/resources/default\_config.xml A /issm/trunk-jpl/src/java/build/resources/document-export-4.png A /issm/trunk-jpl/src/java/build/resources/document-open-2.png A /issm/trunk-jpl/src/java/build/resources/document-preview.png A /issm/trunk-jpl/src/java/build/resources/icons A /issm/trunk-jpl/src/java/build/resources/icons/advancedsettings.png A /issm/trunk-jpl/src/java/build/resources/icons/file\_ops.xcf A /issm/trunk-jpl/src/java/build/resources/icons/fileopen.png A /issm/trunk-jpl/src/java/build/resources/icons/filesave.png A /issm/trunk-jpl/src/java/build/resources/icons/filesaveas.png A /issm/trunk-jpl/src/java/build/resources/icons/ini\_open.png A /issm/trunk-jpl/src/java/build/resources/icons/kghostview.png A /issm/trunk-jpl/src/java/build/resources/icons/mydocuments.png A /issm/trunk-jpl/src/java/build/resources/icons/opensettings.png A /issm/trunk-jpl/src/java/build/resources/icons/readme.txt A /issm/trunk-jpl/src/java/build/resources/icons/reset.png A /issm/trunk-jpl/src/java/build/resources/icons/viewmag.png A /issm/trunk-jpl/src/java/build/resources/icons/xml\_open.png A /issm/trunk-jpl/src/java/build.xml A /issm/trunk-jpl/src/java/dist A /issm/trunk-jpl/src/java/dist/inishell.jar A /issm/trunk-jpl/src/java/doc A /issm/trunk-jpl/src/java/doc/examples A /issm/trunk-jpl/src/java/doc/examples/io.ini A /issm/trunk-jpl/src/java/doc/examples/issm.xml A /issm/trunk-jpl/src/java/doc/examples/meteoio\_config.xml A /issm/trunk-jpl/src/java/doc/examples/min\_example.xml A /issm/trunk-jpl/src/java/doc/examples/snowpack\_config.xml A /issm/trunk-jpl/src/java/inishell.sh A /issm/trunk-jpl/src/java/lib A /issm/trunk-jpl/src/java/lib/miglayout-4.0.jar A /issm/trunk-jpl/src/java/src A /issm/trunk-jpl/src/java/src/gui\_elements A /issm/trunk-jpl/src/java/src/gui\_elements/AlternativePanel.java A /issm/trunk-jpl/src/java/src/gui\_elements/CheckBoxPanel.java A /issm/trunk-jpl/src/java/src/gui\_elements/CombinedPanel.java A /issm/trunk-jpl/src/java/src/gui\_elements/ControlledPanel.java A /issm/trunk-jpl/src/java/src/gui\_elements/DecimalPanel.java A /issm/trunk-jpl/src/java/src/gui\_elements/DuplicatorPanel.java A /issm/trunk-jpl/src/java/src/gui\_elements/FramePanel.java A /issm/trunk-jpl/src/java/src/gui\_elements/GUIBuildException.java A /issm/trunk-jpl/src/java/src/gui\_elements/IntegerPanel.java A /issm/trunk-jpl/src/java/src/gui\_elements/OptionPanel.java A /issm/trunk-jpl/src/java/src/gui\_elements/PathPanel.java A /issm/trunk-jpl/src/java/src/gui\_elements/SelectorPanel.java A /issm/trunk-jpl/src/java/src/gui\_elements/TextfieldPanel.java A /issm/trunk-jpl/src/java/src/main A /issm/trunk-jpl/src/java/src/main/GUI.java A /issm/trunk-jpl/src/java/src/main/GUIBuilder.java A /issm/trunk-jpl/src/java/src/main/PanelControl.java A /issm/trunk-jpl/src/java/src/main/PanelNode.java A /issm/trunk-jpl/src/java/src/main/XMLHelper.java A /issm/trunk-jpl/src/java/src/resources A /issm/trunk-jpl/src/java/src/resources/config\_schema-0.1.1.xsd A /issm/trunk-jpl/src/java/src/resources/config\_schema.xsd A /issm/trunk-jpl/src/java/src/resources/default\_config.xml A /issm/trunk-jpl/src/java/src/resources/document-export-4.png A /issm/trunk-jpl/src/java/src/resources/document-open-2.png A /issm/trunk-jpl/src/java/src/resources/document-preview.png A /issm/trunk-jpl/src/java/src/resources/icons A /issm/trunk-jpl/src/java/src/resources/icons/advancedsettings.png A /issm/trunk-jpl/src/java/src/resources/icons/file\_ops.xcf A /issm/trunk-jpl/src/java/src/resources/icons/fileopen.png A /issm/trunk-jpl/src/java/src/resources/icons/filesave.png A /issm/trunk-jpl/src/java/src/resources/icons/filesaveas.png A /issm/trunk-jpl/src/java/src/resources/icons/ini\_open.png A /issm/trunk-jpl/src/java/src/resources/icons/kghostview.png A /issm/trunk-jpl/src/java/src/resources/icons/mydocuments.png A /issm/trunk-jpl/src/java/src/resources/icons/opensettings.png A /issm/trunk-jpl/src/java/src/resources/icons/readme.txt A /issm/trunk-jpl/src/java/src/resources/icons/reset.png A /issm/trunk-jpl/src/java/src/resources/icons/viewmag.png A /issm/trunk-jpl/src/java/src/resources/icons/xml\_open.png\\
+Export determination: 6. \\
+Rationale: CHG: inishell project\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1159} with diff file ISSM-17723-17724.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/java/inishell.sh\\
+Export determination: 6. \\
+Rationale: CHG: improved inishell.sh launch command.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1160} with diff file ISSM-17724-17725.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/model.m M /issm/trunk-jpl/src/m/classes/model.py\\
+Export determination: 6. \\
+Rationale: CHG: added collapse function to python model, fixed bug when initializing 2d mesh wiped out old mesh before assignment\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1161} with diff file ISSM-17725-17726.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/extrusion/DepthAverage.m A /issm/trunk-jpl/src/m/extrusion/DepthAverage.py A /issm/trunk-jpl/src/m/extrusion/project2d.py M /issm/trunk-jpl/src/m/extrusion/project3d.py\\
+Export determination: 6. \\
+Rationale: NEW: project2d and DepthAverage functions in python\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1162} with diff file ISSM-17726-17727.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/contrib/dassflow/importgmsh.m\\
+Export determination: 6. \\
+Rationale: CHG: fixed surface and base falgs\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1163} with diff file ISSM-17727-17728.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/contrib/dassflow/importgmsh.m\\
+Export determination: 6. \\
+Rationale: CHG: fixed boundary\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1164} with diff file ISSM-17728-17729.diff: \\
+Function name: \\
+M /issm/trunk-jpl/configs/config-linux64-skylla.sh\\
+Export determination: 6. \\
+Rationale: added tao in the config file\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1165} with diff file ISSM-17729-17730.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tetra.h\\
+Export determination: 6. \\
+Rationale: CHG: fixed spawn for gmesh tetras\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1166} with diff file ISSM-17730-17731.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/exp/expread.py\\
+Export determination: 6. \\
+Rationale: CHG: use OrderedDict and update rather than list of dicts for python expread\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1167} with diff file ISSM-17731-17732.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/exp/expread.py\\
+Export determination: 6. \\
+Rationale: BUG: reverting change, save contours as list of dicts\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1168} with diff file ISSM-17732-17733.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/model.py\\
+Export determination: 6. \\
+Rationale: BUG: wrong handle for numpy\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1169} with diff file ISSM-17733-17734.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/interp/SectionValues.m A /issm/trunk-jpl/src/m/interp/SectionValues.py\\
+Export determination: 6. \\
+Rationale: NEW: template for python version of SectionValues\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1170} with diff file ISSM-17734-17735.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/cores/AnalysisConfiguration.cpp M /issm/trunk-jpl/src/c/cores/hydrology\_core.cpp M /issm/trunk-jpl/src/c/cores/transient\_core.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/classes/transient.m M /issm/trunk-jpl/src/m/classes/transient.py M /issm/trunk-jpl/src/m/contrib/paraview/exportVTK.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/TransientIshydrologyEnum.m M /issm/trunk-jpl/test/NightlyRun/test3300.m M /issm/trunk-jpl/test/NightlyRun/test332.m M /issm/trunk-jpl/test/NightlyRun/test333.m M /issm/trunk-jpl/test/NightlyRun/test334.m M /issm/trunk-jpl/test/NightlyRun/test335.m\\
+Export determination: 6. \\
+Rationale: CHG: adding the hydrology solution to transient\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1171} with diff file ISSM-17735-17736.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/HydrologydcEplMaxThicknessEnum.m\\
+Export determination: 6. \\
+Rationale: BUG: fixing enums\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1172} with diff file ISSM-17736-17737.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: minor fix\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1173} with diff file ISSM-17737-17738.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp\\
+Export determination: 6. \\
+Rationale: BUG : fixing model processor for hydromodels\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1174} with diff file ISSM-17738-17739.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matpar.h M /issm/trunk-jpl/src/m/classes/hydrologydc.m M /issm/trunk-jpl/test/NightlyRun/test3300.m M /issm/trunk-jpl/test/NightlyRun/test333.m M /issm/trunk-jpl/test/NightlyRun/test335.m\\
+Export determination: 6. \\
+Rationale: NEW: adding a stand alone max limit for epl thickness\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1175} with diff file ISSM-17739-17740.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing windows compile\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1176} with diff file ISSM-17740-17741.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/Numerics/NewtonSolveDnorm.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixing windows compile\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1177} with diff file ISSM-17741-17742.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/cores/AnalysisConfiguration.cpp\\
+Export determination: 6. \\
+Rationale: BUG: do not add twice the same analysis\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1178} with diff file ISSM-17742-17743.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/cores/hydrology\_core.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/classes/transient.m M /issm/trunk-jpl/src/m/classes/transient.py A /issm/trunk-jpl/src/m/enum/EffectivePressureEnum.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py\\
+Export determination: 6. \\
+Rationale: NEW: adding effective pressure computation within the Hydro\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1179} with diff file ISSM-17743-17744.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/wrappers/InterpFromMesh2d/InterpFromMesh2d.cpp M /issm/trunk-jpl/src/wrappers/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp M /issm/trunk-jpl/src/wrappers/python/Makefile.am\\
+Export determination: 6. \\
+Rationale: CHG: added python wrapper for InterpFromMeshToMesh3d\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1180} with diff file ISSM-17744-17745.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: handle D vs. Dbar depending on domaintype\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1181} with diff file ISSM-17745-17746.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/damage.m M /issm/trunk-jpl/src/m/classes/damage.py\\
+Export determination: 6. \\
+Rationale: CHG: default output is D or Dbar depending on domaintype\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1182} with diff file ISSM-17746-17747.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test271.m M /issm/trunk-jpl/test/NightlyRun/test271.py M /issm/trunk-jpl/test/NightlyRun/test275.m M /issm/trunk-jpl/test/NightlyRun/test275.py\\
+Export determination: 6. \\
+Rationale: BUG: Dbar is now returned for 2dhoriz models\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1183} with diff file ISSM-17747-17748.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test206.m M /issm/trunk-jpl/test/NightlyRun/test206.py M /issm/trunk-jpl/test/NightlyRun/test209.m M /issm/trunk-jpl/test/NightlyRun/test209.py M /issm/trunk-jpl/test/NightlyRun/test221.m M /issm/trunk-jpl/test/NightlyRun/test221.py M /issm/trunk-jpl/test/NightlyRun/test233.m M /issm/trunk-jpl/test/NightlyRun/test233.py M /issm/trunk-jpl/test/NightlyRun/test285.m M /issm/trunk-jpl/test/NightlyRun/test285.py M /issm/trunk-jpl/test/NightlyRun/test322.m M /issm/trunk-jpl/test/NightlyRun/test410.m M /issm/trunk-jpl/test/NightlyRun/test410.py M /issm/trunk-jpl/test/NightlyRun/test435.m M /issm/trunk-jpl/test/NightlyRun/test455.m M /issm/trunk-jpl/test/NightlyRun/test455.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxing some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1184} with diff file ISSM-17748-17749.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/transient.m\\
+Export determination: 6. \\
+Rationale: BUG: fixing requested\_outputs in transient.m\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1185} with diff file ISSM-17749-17750.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/transient.py\\
+Export determination: 6. \\
+Rationale: BUG: fixing requested\_outputs in transient.m\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1186} with diff file ISSM-17750-17751.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp M /issm/trunk-jpl/src/c/classes/gauss/GaussTetra.cpp\\
+Export determination: 6. \\
+Rationale: CHG: fixing indices of tetra base that need to be direct\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1187} with diff file ISSM-17751-17752.diff: \\
+Function name: \\
+M /issm/trunk-jpl/m4/issm\_options.m4\\
+Export determination: 6. \\
+Rationale: CHG: fixed enable-development macro (nor based on debugging)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1188} with diff file ISSM-17752-17753.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test209.m M /issm/trunk-jpl/test/NightlyRun/test211.m M /issm/trunk-jpl/test/NightlyRun/test211.py M /issm/trunk-jpl/test/NightlyRun/test290.m M /issm/trunk-jpl/test/NightlyRun/test290.py M /issm/trunk-jpl/test/NightlyRun/test333.m M /issm/trunk-jpl/test/NightlyRun/test335.m M /issm/trunk-jpl/test/NightlyRun/test702.m\\
+Export determination: 6. \\
+Rationale: CHG: relaxing tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1189} with diff file ISSM-17753-17754.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/linux64\_larsen M /issm/trunk-jpl/jenkins/linux64\_murdo M /issm/trunk-jpl/jenkins/linux64\_murdo\_ad M /issm/trunk-jpl/jenkins/linux64\_murdo\_ampi\\
+Export determination: 6. \\
+Rationale: CHG: enable development\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1190} with diff file ISSM-17754-17755.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/model.m\\
+Export determination: 6. \\
+Rationale: NEW: better split in tetras\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1191} with diff file ISSM-17755-17756.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test211.m M /issm/trunk-jpl/test/NightlyRun/test211.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxed tolerances:\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1192} with diff file ISSM-17756-17757.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/applyoptions.py A /issm/trunk-jpl/src/m/plot/plot\_contour.py M /issm/trunk-jpl/src/m/plot/plot\_manager.py M /issm/trunk-jpl/src/m/plot/plot\_overlay.py M /issm/trunk-jpl/src/m/plot/plotmodel.py\\
+Export determination: 6. \\
+Rationale: working on python plotmodel, added plot\_contour\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1193} with diff file ISSM-17757-17758.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matice.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matice.h M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/classes/damage.m A /issm/trunk-jpl/src/m/classes/matdamageice.m M /issm/trunk-jpl/src/m/classes/model.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/MatdamageiceEnum.m M /issm/trunk-jpl/src/m/mech/mechanicalproperties.m\\
+Export determination: 6. \\
+Rationale: CHG: stripping damage out of solution if MaterialsType is MaticeEnum\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1194} with diff file ISSM-17758-17759.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/enum/DamageElementinterpEnum.m\\
+Export determination: 6. \\
+Rationale: CHG: forgot to add enum\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1195} with diff file ISSM-17759-17760.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Materials/Material.h M /issm/trunk-jpl/src/c/classes/Materials/Matice.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matice.h M /issm/trunk-jpl/src/c/classes/Materials/Matpar.h\\
+Export determination: 6. \\
+Rationale: CHG: added IsDamage function to Material class to check for damage in elements\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1196} with diff file ISSM-17760-17761.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/cores/transient\_core.cpp\\
+Export determination: 6. \\
+Rationale: CHG: Do extrusionfrombase for base after GL movement\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1197} with diff file ISSM-17761-17762.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: Set base at bed for grounded element even some nodes is above bed\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1198} with diff file ISSM-17762-17763.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/IdToName.m M /issm/trunk-jpl/test/NightlyRun/IdToName.py M /issm/trunk-jpl/test/NightlyRun/test275.m M /issm/trunk-jpl/test/NightlyRun/test701.m M /issm/trunk-jpl/test/NightlyRun/test703.m M /issm/trunk-jpl/test/Par/79North.par M /issm/trunk-jpl/test/Par/79North.py M /issm/trunk-jpl/test/Par/GiaBenchmarksAB.par M /issm/trunk-jpl/test/Par/GiaBenchmarksCD.par M /issm/trunk-jpl/test/Par/ISMIPA.par M /issm/trunk-jpl/test/Par/ISMIPA.py M /issm/trunk-jpl/test/Par/ISMIPB.par M /issm/trunk-jpl/test/Par/ISMIPB.py M /issm/trunk-jpl/test/Par/ISMIPC.par M /issm/trunk-jpl/test/Par/ISMIPC.py M /issm/trunk-jpl/test/Par/ISMIPD.par M /issm/trunk-jpl/test/Par/ISMIPD.py M /issm/trunk-jpl/test/Par/ISMIPE.par M /issm/trunk-jpl/test/Par/ISMIPE.py M /issm/trunk-jpl/test/Par/ISMIPF.par M /issm/trunk-jpl/test/Par/ISMIPF.py M /issm/trunk-jpl/test/Par/Pig.par M /issm/trunk-jpl/test/Par/Pig.py M /issm/trunk-jpl/test/Par/RoundSheetEISMINT.par M /issm/trunk-jpl/test/Par/RoundSheetEISMINT.py M /issm/trunk-jpl/test/Par/RoundSheetShelf.par M /issm/trunk-jpl/test/Par/RoundSheetShelf.py M /issm/trunk-jpl/test/Par/RoundSheetStaticEISMINT.par M /issm/trunk-jpl/test/Par/RoundSheetStaticEISMINT.py M /issm/trunk-jpl/test/Par/SquareEISMINT.par M /issm/trunk-jpl/test/Par/SquareEISMINT.py M /issm/trunk-jpl/test/Par/SquareSheetConstrained.par M /issm/trunk-jpl/test/Par/SquareSheetConstrained.py M /issm/trunk-jpl/test/Par/SquareSheetShelf.par M /issm/trunk-jpl/test/Par/SquareSheetShelf.py M /issm/trunk-jpl/test/Par/SquareShelf.par M /issm/trunk-jpl/test/Par/SquareShelf.py M /issm/trunk-jpl/test/Par/SquareShelf2.par M /issm/trunk-jpl/test/Par/SquareShelf2.py M /issm/trunk-jpl/test/Par/SquareShelfConstrained.par M /issm/trunk-jpl/test/Par/SquareShelfConstrained.py M /issm/trunk-jpl/test/Par/SquareThermal.par M /issm/trunk-jpl/test/Par/SquareThermal.py M /issm/trunk-jpl/test/Par/ValleyGlacierShelf.par M /issm/trunk-jpl/test/Par/ValleyGlacierShelf.py\\
+Export determination: 6. \\
+Rationale: CHG: unnecessary to specify damage now for anything other than a damage analysis\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1199} with diff file ISSM-17763-17764.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py M /issm/trunk-jpl/src/m/classes/damage.py A /issm/trunk-jpl/src/m/enum/DamageIsdamageEnum.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py\\
+Export determination: 6. \\
+Rationale: CHG: python fixes for NR now that it is no longer necessary to specify damage\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1200} with diff file ISSM-17764-17765.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test270.m M /issm/trunk-jpl/test/NightlyRun/test270.py M /issm/trunk-jpl/test/NightlyRun/test271.m M /issm/trunk-jpl/test/NightlyRun/test271.py M /issm/trunk-jpl/test/NightlyRun/test272.m M /issm/trunk-jpl/test/NightlyRun/test272.py M /issm/trunk-jpl/test/NightlyRun/test274.m M /issm/trunk-jpl/test/NightlyRun/test274.py M /issm/trunk-jpl/test/NightlyRun/test275.m M /issm/trunk-jpl/test/NightlyRun/test275.py\\
+Export determination: 6. \\
+Rationale: CHG: updating damage runs for new matdamageice class\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1201} with diff file ISSM-17765-17766.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/matdamageice.m A /issm/trunk-jpl/src/m/classes/matdamageice.py\\
+Export determination: 6. \\
+Rationale: BUG: fixes for matdamageice, forgot to include python version\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1202} with diff file ISSM-17766-17767.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py\\
+Export determination: 6. \\
+Rationale: CHG: reverting change to postpone python handling of vectors/arrays for now\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1203} with diff file ISSM-17767-17768.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Par/79North.par M /issm/trunk-jpl/test/Par/79North.py M /issm/trunk-jpl/test/Par/GiaBenchmarksAB.par M /issm/trunk-jpl/test/Par/GiaBenchmarksCD.par M /issm/trunk-jpl/test/Par/ISMIPA.par M /issm/trunk-jpl/test/Par/ISMIPA.py M /issm/trunk-jpl/test/Par/ISMIPB.par M /issm/trunk-jpl/test/Par/ISMIPB.py M /issm/trunk-jpl/test/Par/ISMIPC.par M /issm/trunk-jpl/test/Par/ISMIPC.py M /issm/trunk-jpl/test/Par/ISMIPD.par M /issm/trunk-jpl/test/Par/ISMIPD.py M /issm/trunk-jpl/test/Par/ISMIPE.par M /issm/trunk-jpl/test/Par/ISMIPE.py M /issm/trunk-jpl/test/Par/ISMIPF.par M /issm/trunk-jpl/test/Par/ISMIPF.py M /issm/trunk-jpl/test/Par/Pig.par M /issm/trunk-jpl/test/Par/Pig.py M /issm/trunk-jpl/test/Par/RoundSheetEISMINT.par M /issm/trunk-jpl/test/Par/RoundSheetEISMINT.py M /issm/trunk-jpl/test/Par/RoundSheetShelf.par M /issm/trunk-jpl/test/Par/RoundSheetShelf.py M /issm/trunk-jpl/test/Par/RoundSheetStaticEISMINT.par M /issm/trunk-jpl/test/Par/RoundSheetStaticEISMINT.py M /issm/trunk-jpl/test/Par/SquareEISMINT.par M /issm/trunk-jpl/test/Par/SquareEISMINT.py M /issm/trunk-jpl/test/Par/SquareSheetConstrained.par M /issm/trunk-jpl/test/Par/SquareSheetConstrained.py M /issm/trunk-jpl/test/Par/SquareSheetShelf.par M /issm/trunk-jpl/test/Par/SquareSheetShelf.py M /issm/trunk-jpl/test/Par/SquareShelf.par M /issm/trunk-jpl/test/Par/SquareShelf.py M /issm/trunk-jpl/test/Par/SquareShelf2.par M /issm/trunk-jpl/test/Par/SquareShelf2.py M /issm/trunk-jpl/test/Par/SquareShelfConstrained.par M /issm/trunk-jpl/test/Par/SquareShelfConstrained.py M /issm/trunk-jpl/test/Par/SquareThermal.par M /issm/trunk-jpl/test/Par/SquareThermal.py M /issm/trunk-jpl/test/Par/ValleyGlacierShelf.par M /issm/trunk-jpl/test/Par/ValleyGlacierShelf.py\\
+Export determination: 6. \\
+Rationale: BUG: forgot to set isdamage=0 in par files\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1204} with diff file ISSM-17768-17769.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/damage.m\\
+Export determination: 6. \\
+Rationale: BUG: spelling\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1205} with diff file ISSM-17769-17770.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test271.m M /issm/trunk-jpl/test/Par/79North.par M /issm/trunk-jpl/test/Par/79North.py M /issm/trunk-jpl/test/Par/GiaBenchmarksAB.par M /issm/trunk-jpl/test/Par/GiaBenchmarksCD.par M /issm/trunk-jpl/test/Par/ISMIPA.par M /issm/trunk-jpl/test/Par/ISMIPA.py M /issm/trunk-jpl/test/Par/ISMIPB.par M /issm/trunk-jpl/test/Par/ISMIPB.py M /issm/trunk-jpl/test/Par/ISMIPC.par M /issm/trunk-jpl/test/Par/ISMIPC.py M /issm/trunk-jpl/test/Par/ISMIPD.par M /issm/trunk-jpl/test/Par/ISMIPD.py M /issm/trunk-jpl/test/Par/ISMIPE.par M /issm/trunk-jpl/test/Par/ISMIPE.py M /issm/trunk-jpl/test/Par/ISMIPF.par M /issm/trunk-jpl/test/Par/ISMIPF.py M /issm/trunk-jpl/test/Par/Pig.par M /issm/trunk-jpl/test/Par/Pig.py M /issm/trunk-jpl/test/Par/RoundSheetEISMINT.par M /issm/trunk-jpl/test/Par/RoundSheetEISMINT.py M /issm/trunk-jpl/test/Par/RoundSheetShelf.par M /issm/trunk-jpl/test/Par/RoundSheetShelf.py M /issm/trunk-jpl/test/Par/RoundSheetStaticEISMINT.par M /issm/trunk-jpl/test/Par/RoundSheetStaticEISMINT.py M /issm/trunk-jpl/test/Par/SquareEISMINT.par M /issm/trunk-jpl/test/Par/SquareEISMINT.py M /issm/trunk-jpl/test/Par/SquareSheetConstrained.par M /issm/trunk-jpl/test/Par/SquareSheetConstrained.py M /issm/trunk-jpl/test/Par/SquareSheetShelf.par M /issm/trunk-jpl/test/Par/SquareSheetShelf.py M /issm/trunk-jpl/test/Par/SquareShelf.par M /issm/trunk-jpl/test/Par/SquareShelf.py M /issm/trunk-jpl/test/Par/SquareShelf2.par M /issm/trunk-jpl/test/Par/SquareShelf2.py M /issm/trunk-jpl/test/Par/SquareShelfConstrained.par M /issm/trunk-jpl/test/Par/SquareShelfConstrained.py M /issm/trunk-jpl/test/Par/SquareThermal.par M /issm/trunk-jpl/test/Par/SquareThermal.py M /issm/trunk-jpl/test/Par/ValleyGlacierShelf.par M /issm/trunk-jpl/test/Par/ValleyGlacierShelf.py\\
+Export determination: 6. \\
+Rationale: CHG: reverting previous change, isdamage=0 is specified by default in the damage class, problem was a typo elsewhere...\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1206} with diff file ISSM-17770-17771.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test270.m\\
+Export determination: 6. \\
+Rationale: BUG: missed matdamageice initialization\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1207} with diff file ISSM-17771-17772.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/damage.m\\
+Export determination: 6. \\
+Rationale: CHG: initialize as integer rather than bool\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1208} with diff file ISSM-17772-17773.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test272.py M /issm/trunk-jpl/test/NightlyRun/test274.py M /issm/trunk-jpl/test/NightlyRun/test275.py\\
+Export determination: 6. \\
+Rationale: CHG: updates to damage NR in python\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1209} with diff file ISSM-17773-17774.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp\\
+Export determination: 6. \\
+Rationale: CHG: fixing indices in Tetra faces\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1210} with diff file ISSM-17774-17775.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/model.m\\
+Export determination: 6. \\
+Rationale: BUG: fixing split of prismatic mesh into tets\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1211} with diff file ISSM-17775-17776.diff: \\
+Function name: \\
+A /issm/trunk-jpl/m4/analyses.m4 M /issm/trunk-jpl/m4/issm\_options.m4\\
+Export determination: 6. \\
+Rationale: NEW: trying to autoamtically generate analyses.m4\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1212} with diff file ISSM-17776-17777.diff: \\
+Function name: \\
+M /issm/trunk-jpl/m4/analyses.m4 M /issm/trunk-jpl/src/c/shared/Enum/Synchronize.sh\\
+Export determination: 6. \\
+Rationale: NEW: automated analyses.m4 from EnumDefinitions\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1213} with diff file ISSM-17777-17778.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/cores/gia\_core.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed compilation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1214} with diff file ISSM-17778-17779.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/applyoptions.py M /issm/trunk-jpl/src/m/plot/plot\_contour.py M /issm/trunk-jpl/src/m/plot/plot\_manager.py M /issm/trunk-jpl/src/m/plot/plot\_overlay.py M /issm/trunk-jpl/src/m/plot/plot\_unit.py M /issm/trunk-jpl/src/m/plot/plotmodel.py\\
+Export determination: 6. \\
+Rationale: CHG: better handling of multiple subplots in python plotmodel, now uses matplotlib's AxesGrid toolkit to specify the axes grid at the beginning of plotting; this ensures better handling of things like aspect ratios, colorbars, and spacing between plots\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1215} with diff file ISSM-17779-17780.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/inversion.m M /issm/trunk-jpl/src/m/classes/inversion.py\\
+Export determination: 6. \\
+Rationale: BUG: fixing problem with cost function being marshalled (data is changing as it is converted)\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1216} with diff file ISSM-17780-17781.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/inversion.py\\
+Export determination: 6. \\
+Rationale: BUG: fixed matrix renumbering\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1217} with diff file ISSM-17781-17782.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test421.m M /issm/trunk-jpl/test/NightlyRun/test421.py M /issm/trunk-jpl/test/NightlyRun/test513.m M /issm/trunk-jpl/test/NightlyRun/test513.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxing some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1218} with diff file ISSM-17782-17783.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/solve/process\_solve\_options.m M /issm/trunk-jpl/src/m/solve/process\_solve\_options.py M /issm/trunk-jpl/src/m/solve/solve.m M /issm/trunk-jpl/src/m/solve/solve.py\\
+Export determination: 6. \\
+Rationale: CHG: simplifying solve options\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1219} with diff file ISSM-17783-17784.diff: \\
+Function name: \\
+A /issm/trunk-jpl/externalpackages/gmsh A /issm/trunk-jpl/externalpackages/gmsh/install.sh\\
+Export determination: 6. \\
+Rationale: NEW: added gmsh\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1220} with diff file ISSM-17784-17785.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/solve/process\_solve\_options.m\\
+Export determination: 6. \\
+Rationale: BUG: Solution is 8 charqacters long\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1221} with diff file ISSM-17785-17786.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plot\_section.m\\
+Export determination: 6. \\
+Rationale: BUG: fixed plot\_section for given layer\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1222} with diff file ISSM-17786-17787.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plot\_section.m\\
+Export determination: 6. \\
+Rationale: BUG: fixed plot\_section for given layer\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1223} with diff file ISSM-17787-17788.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test209.m M /issm/trunk-jpl/test/NightlyRun/test209.py M /issm/trunk-jpl/test/NightlyRun/test322.m M /issm/trunk-jpl/test/NightlyRun/test322.py M /issm/trunk-jpl/test/NightlyRun/test435.m\\
+Export determination: 6. \\
+Rationale: CHG: relaxing some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1224} with diff file ISSM-17788-17789.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test211.m M /issm/trunk-jpl/test/NightlyRun/test211.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxing tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1225} with diff file ISSM-17789-17790.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/gmsh/install.sh\\
+Export determination: 6. \\
+Rationale: CHG: better installation script\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1226} with diff file ISSM-17790-17791.diff: \\
+Function name: \\
+D /issm/trunk-jpl/src/m/solve/process\_solve\_options.m D /issm/trunk-jpl/src/m/solve/process\_solve\_options.py M /issm/trunk-jpl/src/m/solve/solve.m M /issm/trunk-jpl/src/m/solve/solve.py\\
+Export determination: 6. \\
+Rationale: CHG: removed process\_solve\_options\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1227} with diff file ISSM-17791-17792.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/qmu/preqmu.m\\
+Export determination: 6. \\
+Rationale: CHG: updating preqmu\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1228} with diff file ISSM-17792-17793.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/qmu/preqmu.m\\
+Export determination: 6. \\
+Rationale: BUG: no more process\_solve\_options\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1229} with diff file ISSM-17793-17794.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/contrib/bamg/YamsCall.m\\
+Export determination: 6. \\
+Rationale: CHG: no more z in yams mesh2d\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1230} with diff file ISSM-17794-17795.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/solve/solve.m\\
+Export determination: 6. \\
+Rationale: CHG: options is not a struct anymore\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1231} with diff file ISSM-17795-17796.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp\\
+Export determination: 6. \\
+Rationale: CHG: OneLayerP4 working with P1 pressure\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1232} with diff file ISSM-17796-17797.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test285.m M /issm/trunk-jpl/test/NightlyRun/test285.py M /issm/trunk-jpl/test/NightlyRun/test403.m\\
+Export determination: 6. \\
+Rationale: CHG: relaxing some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1233} with diff file ISSM-17797-17798.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tetra.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp\\
+Export determination: 6. \\
+Rationale: NEW: added sigma\_nn in outputs\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1234} with diff file ISSM-17798-17799.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/solve/solve.py\\
+Export determination: 6. \\
+Rationale: BUG: no more process\_solve\_options\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1235} with diff file ISSM-17799-17800.diff: \\
+Function name: \\
+M /issm/trunk-jpl/examples/Jakobshavn/Jks.par M /issm/trunk-jpl/examples/Jakobshavn/runme.m M /issm/trunk-jpl/examples/SquareIceShelf/Square.par\\
+Export determination: 6. \\
+Rationale: CHG: bed is now base\\
+\vspace{3em}
+
+\noindent \textbf{Change \#1236} with diff file ISSM-17800-17801.diff: \\
+Function name: \\
+M /issm/trunk-jpl/configure.ac\\
+Export determination: 6. \\
+Rationale: CHG: increasing version number for sync\\
+\vspace{3em}
+
Index: issm/oecreview/Archive/16554-17801/r1.tex
===================================================================
--- issm/oecreview/Archive/16554-17801/r1.tex	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/r1.tex	(revision 17802)
@@ -0,0 +1,1 @@
+16554
Index: issm/oecreview/Archive/16554-17801/r2.tex
===================================================================
--- issm/oecreview/Archive/16554-17801/r2.tex	(revision 17802)
+++ issm/oecreview/Archive/16554-17801/r2.tex	(revision 17802)
@@ -0,0 +1,1 @@
+17801
